mirror of
https://github.com/fluencelabs/assemblyscript
synced 2025-04-25 07:02:13 +00:00
3 lines
514 KiB
JavaScript
3 lines
514 KiB
JavaScript
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r(require("binaryen")):"function"==typeof define&&define.amd?define(["binaryen"],r):"object"==typeof exports?exports.assemblyscript=r(require("binaryen")):e.assemblyscript=r(e.binaryen)}("undefined"!=typeof self?self:this,function(e){return function(e){var r={};function t(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,t),i.l=!0,i.exports}return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var i in e)t.d(n,i,function(r){return e[r]}.bind(null,i));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="",t(t.s=16)}([function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),function(e){e[e.NONE=0]="NONE",e[e.IMPORT=1]="IMPORT",e[e.EXPORT=2]="EXPORT",e[e.DECLARE=4]="DECLARE",e[e.CONST=8]="CONST",e[e.LET=16]="LET",e[e.STATIC=32]="STATIC",e[e.READONLY=64]="READONLY",e[e.ABSTRACT=128]="ABSTRACT",e[e.PUBLIC=256]="PUBLIC",e[e.PRIVATE=512]="PRIVATE",e[e.PROTECTED=1024]="PROTECTED",e[e.GET=2048]="GET",e[e.SET=4096]="SET",e[e.DEFINITE_ASSIGNMENT=8192]="DEFINITE_ASSIGNMENT",e[e.AMBIENT=16384]="AMBIENT",e[e.GENERIC=32768]="GENERIC",e[e.GENERIC_CONTEXT=65536]="GENERIC_CONTEXT",e[e.INSTANCE=131072]="INSTANCE",e[e.CONSTRUCTOR=262144]="CONSTRUCTOR",e[e.MODULE_EXPORT=524288]="MODULE_EXPORT",e[e.MODULE_IMPORT=1048576]="MODULE_IMPORT",e[e.RESOLVED=2097152]="RESOLVED",e[e.COMPILED=4194304]="COMPILED",e[e.INLINED=8388608]="INLINED",e[e.SCOPED=16777216]="SCOPED",e[e.TRAMPOLINE=33554432]="TRAMPOLINE",e[e.VIRTUAL=67108864]="VIRTUAL",e[e.MAIN=134217728]="MAIN",e[e.QUOTED=268435456]="QUOTED"}(r.CommonFlags||(r.CommonFlags={})),r.PATH_DELIMITER="/",r.PARENT_SUBST="..",r.GETTER_PREFIX="get:",r.SETTER_PREFIX="set:",r.INSTANCE_DELIMITER="#",r.STATIC_DELIMITER=".",r.INNER_DELIMITER="~",r.LIBRARY_SUBST="~lib",r.LIBRARY_PREFIX=r.LIBRARY_SUBST+r.PATH_DELIMITER,r.INDEX_SUFFIX=r.PATH_DELIMITER+"index",function(e){e.EMPTY="",e.i8="i8",e.i16="i16",e.i32="i32",e.i64="i64",e.isize="isize",e.u8="u8",e.u16="u16",e.u32="u32",e.u64="u64",e.usize="usize",e.bool="bool",e.f32="f32",e.f64="f64",e.v128="v128",e.i8x16="i8x16",e.u8x16="u8x16",e.i16x8="i16x8",e.u16x8="u16x8",e.i32x4="i32x4",e.u32x4="u32x4",e.i64x2="i64x2",e.u64x2="u64x2",e.f32x4="f32x4",e.f64x2="f64x2",e.void_="void",e.number="number",e.boolean="boolean",e.string="string",e.native="native",e.null_="null",e.true_="true",e.false_="false",e.this_="this",e.super_="super",e.constructor="constructor"}(r.CommonSymbols||(r.CommonSymbols={})),function(e){e.ASC_TARGET="ASC_TARGET",e.ASC_NO_TREESHAKING="ASC_NO_TREESHAKING",e.ASC_NO_ASSERT="ASC_NO_ASSERT",e.ASC_MEMORY_BASE="ASC_MEMORY_BASE",e.ASC_OPTIMIZE_LEVEL="ASC_OPTIMIZE_LEVEL",e.ASC_SHRINK_LEVEL="ASC_SHRINK_LEVEL",e.ASC_FEATURE_MUTABLE_GLOBAL="ASC_FEATURE_MUTABLE_GLOBAL",e.ASC_FEATURE_SIGN_EXTENSION="ASC_FEATURE_SIGN_EXTENSION",e.ASC_FEATURE_BULK_MEMORY="ASC_FEATURE_BULK_MEMORY",e.ASC_FEATURE_SIMD="ASC_FEATURE_SIMD",e.ASC_FEATURE_THREADS="ASC_FEATURE_THREADS",e.I8="I8",e.I16="I16",e.I32="I32",e.I64="I64",e.Isize="Isize",e.U8="U8",e.U16="U16",e.U32="U32",e.U64="U64",e.Usize="Usize",e.Bool="Bool",e.F32="F32",e.F64="F64",e.V128="V128",e.String="String",e.Array="Array",e.ArrayBuffer="ArrayBuffer",e.Math="Math",e.Mathf="Mathf",e.memory="memory",e.allocate="allocate",e.abort="abort",e.main="main",e.length="length",e.byteLength="byteLength",e.pow="pow",e.mod="mod"}(r.LibrarySymbols||(r.LibrarySymbols={}))},function(e,r,t){"use strict";function n(e){for(var t in e)r.hasOwnProperty(t)||(r[t]=e[t])}Object.defineProperty(r,"__esModule",{value:!0}),n(t(25)),n(t(26)),n(t(27)),n(t(28)),n(t(29)),n(t(30)),r.isPowerOf2=function(e){return 0!=e&&0==(e&e-1)}},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n,i=t(11),a=t(1),s=t(11);function o(e){switch(e){case n.INFO:return"INFO";case n.WARNING:return"WARNING";case n.ERROR:return"ERROR";default:return assert(!1),""}}function c(e){switch(e){case n.INFO:return r.COLOR_BLUE;case n.WARNING:return r.COLOR_YELLOW;case n.ERROR:return r.COLOR_RED;default:return assert(!1),""}}r.DiagnosticCode=s.DiagnosticCode,r.diagnosticCodeToString=s.diagnosticCodeToString,function(e){e[e.INFO=0]="INFO",e[e.WARNING=1]="WARNING",e[e.ERROR=2]="ERROR"}(n=r.DiagnosticCategory||(r.DiagnosticCategory={})),r.diagnosticCategoryToString=o,r.COLOR_BLUE="[96m",r.COLOR_YELLOW="[93m",r.COLOR_RED="[91m",r.COLOR_RESET="[0m",r.diagnosticCategoryToColor=c;var l=function(){function e(e,r,t){this.range=null,this.relatedRange=null,this.code=e,this.category=r,this.message=t}return e.create=function(r,t,n,a,s){void 0===n&&(n=null),void 0===a&&(a=null),void 0===s&&(s=null);var o=i.diagnosticCodeToString(r);return null!=n&&(o=o.replace("{0}",n)),null!=a&&(o=o.replace("{1}",a)),null!=s&&(o=o.replace("{2}",s)),new e(r,t,o)},e.createInfo=function(r,t,i){return void 0===t&&(t=null),void 0===i&&(i=null),e.create(r,n.INFO,t,i)},e.createWarning=function(r,t,i){return void 0===t&&(t=null),void 0===i&&(i=null),e.create(r,n.WARNING,t,i)},e.createError=function(r,t,i){return void 0===t&&(t=null),void 0===i&&(i=null),e.create(r,n.ERROR,t,i)},e.prototype.withRange=function(e){return this.range=e,this},e.prototype.withRelatedRange=function(e){return this.relatedRange=e,this},e.prototype.toString=function(){return this.range?o(this.category)+" "+this.code.toString(10)+': "'+this.message+'" in '+this.range.source.normalizedPath+":"+this.range.line.toString(10)+":"+this.range.column.toString(10):o(this.category)+" "+this.code.toString(10)+": "+this.message},e}();function p(e,t){void 0===t&&(t=!1);for(var n=e.source.text,i=n.length,s=e.start,o=e.end;s>0&&!a.isLineBreak(n.charCodeAt(s-1));)s--;for(;o<i&&!a.isLineBreak(n.charCodeAt(o));)o++;for(var c=["\n ",n.substring(s,o),"\n "];s<e.start;)c.push(" "),s++;if(t&&c.push(r.COLOR_RED),e.start==e.end)c.push("^");else for(;s++<e.end;)c.push("~");return t&&c.push(r.COLOR_RESET),c.join("")}r.DiagnosticMessage=l,r.formatDiagnosticMessage=function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!1);var i=[];if(t&&i.push(c(e.category)),i.push(o(e.category)),t&&i.push(r.COLOR_RESET),i.push(e.code<1e3?" AS":" TS"),i.push(e.code.toString(10)),i.push(": "),i.push(e.message),e.range){var a=e.range;n&&(i.push("\n"),i.push(p(a,t))),i.push("\n"),i.push(" in "),i.push(a.source.normalizedPath),i.push("("),i.push(a.line.toString(10)),i.push(","),i.push(a.column.toString(10)),i.push(")");var s=e.relatedRange;s&&(n&&(i.push("\n"),i.push(p(s,t))),i.push("\n"),i.push(" in "),i.push(a.source.normalizedPath),i.push("("),i.push(a.line.toString(10)),i.push(","),i.push(a.column.toString(10)),i.push(")"))}return i.join("")},r.formatDiagnosticContext=p;var u=function(){function e(e){void 0===e&&(e=null),this.diagnostics=e||new Array}return e.prototype.emitDiagnostic=function(e,r,t,n,i,a,s){void 0===i&&(i=null),void 0===a&&(a=null),void 0===s&&(s=null);var o=l.create(e,r,i,a,s).withRange(t);n&&(o.relatedRange=n),this.diagnostics.push(o)},e.prototype.info=function(e,r,t,i,a){void 0===t&&(t=null),void 0===i&&(i=null),void 0===a&&(a=null),this.emitDiagnostic(e,n.INFO,r,null,t,i,a)},e.prototype.infoRelated=function(e,r,t,i,a,s){void 0===i&&(i=null),void 0===a&&(a=null),void 0===s&&(s=null),this.emitDiagnostic(e,n.INFO,r,t,i,a,s)},e.prototype.warning=function(e,r,t,i,a){void 0===t&&(t=null),void 0===i&&(i=null),void 0===a&&(a=null),this.emitDiagnostic(e,n.WARNING,r,null,t,i,a)},e.prototype.warningRelated=function(e,r,t,i,a,s){void 0===i&&(i=null),void 0===a&&(a=null),void 0===s&&(s=null),this.emitDiagnostic(e,n.WARNING,r,t,i,a,s)},e.prototype.error=function(e,r,t,i,a){void 0===t&&(t=null),void 0===i&&(i=null),void 0===a&&(a=null),this.emitDiagnostic(e,n.ERROR,r,null,t,i,a)},e.prototype.errorRelated=function(e,r,t,i,a,s){void 0===i&&(i=null),void 0===a&&(a=null),void 0===s&&(s=null),this.emitDiagnostic(e,n.ERROR,r,t,i,a,s)},e}();r.DiagnosticEmitter=u},function(e,r,t){"use strict";var n,i=this&&this.__extends||(n=function(e,r){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)r.hasOwnProperty(t)&&(e[t]=r[t])})(e,r)},function(e,r){function t(){this.constructor=e}n(e,r),e.prototype=null===r?Object.create(r):(t.prototype=r.prototype,new t)}),a=this&&this.__values||function(e){var r="function"==typeof Symbol&&e[Symbol.iterator],t=0;return r?r.call(e):{next:function(){return e&&t>=e.length&&(e=void 0),{value:e&&e[t++],done:!e}}}},s=this&&this.__read||function(e,r){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var n,i,a=t.call(e),s=[];try{for(;(void 0===r||r-- >0)&&!(n=a.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(t=a.return)&&t.call(a)}finally{if(i)throw i.error}}return s};Object.defineProperty(r,"__esModule",{value:!0});var o,c=t(0),l=t(2),p=t(6),u=t(5),_=t(9),h=t(12),d=function(){return function(e,r,t,n,i){this.localFile=e,this.localIdentifier=r,this.foreignIdentifier=t,this.foreignPath=n,this.foreignPathAlt=i}}(),y=function(){return function(e,r,t,n){this.localIdentifier=e,this.foreignIdentifier=r,this.foreignPath=t,this.foreignPathAlt=n}}(),m=function(){return function(e,r,t){this.foreignPath=e,this.foreignPathAlt=r,this.pathLiteral=t}}();function T(e,r){switch(assert(r.length),e){case u.DecoratorKind.OPERATOR:case u.DecoratorKind.OPERATOR_BINARY:switch(r.charCodeAt(0)){case 91:if("[]"==r)return o.INDEXED_GET;if("[]="==r)return o.INDEXED_SET;break;case 123:if("{}"==r)return o.UNCHECKED_INDEXED_GET;if("{}="==r)return o.UNCHECKED_INDEXED_SET;break;case 43:if("+"==r)return o.ADD;break;case 45:if("-"==r)return o.SUB;break;case 42:if("*"==r)return o.MUL;if("**"==r)return o.POW;break;case 47:if("/"==r)return o.DIV;break;case 37:if("%"==r)return o.REM;break;case 38:if("&"==r)return o.BITWISE_AND;break;case 124:if("|"==r)return o.BITWISE_OR;break;case 94:if("^"==r)return o.BITWISE_XOR;break;case 61:if("=="==r)return o.EQ;break;case 33:if("!="==r)return o.NE;break;case 62:if(">"==r)return o.GT;if(">="==r)return o.GE;if(">>"==r)return o.BITWISE_SHR;if(">>>"==r)return o.BITWISE_SHR_U;break;case 60:if("<"==r)return o.LT;if("<="==r)return o.LE;if("<<"==r)return o.BITWISE_SHL}break;case u.DecoratorKind.OPERATOR_PREFIX:switch(r.charCodeAt(0)){case 43:if("+"==r)return o.PLUS;if("++"==r)return o.PREFIX_INC;break;case 45:if("-"==r)return o.MINUS;if("--"==r)return o.PREFIX_DEC;break;case 33:if("!"==r)return o.NOT;break;case 126:if("~"==r)return o.BITWISE_NOT}break;case u.DecoratorKind.OPERATOR_POSTFIX:switch(r.charCodeAt(0)){case 43:if("++"==r)return o.POSTFIX_INC;break;case 45:if("--"==r)return o.POSTFIX_DEC}}return o.INVALID}!function(e){e[e.INVALID=0]="INVALID",e[e.INDEXED_GET=1]="INDEXED_GET",e[e.INDEXED_SET=2]="INDEXED_SET",e[e.UNCHECKED_INDEXED_GET=3]="UNCHECKED_INDEXED_GET",e[e.UNCHECKED_INDEXED_SET=4]="UNCHECKED_INDEXED_SET",e[e.ADD=5]="ADD",e[e.SUB=6]="SUB",e[e.MUL=7]="MUL",e[e.DIV=8]="DIV",e[e.REM=9]="REM",e[e.POW=10]="POW",e[e.BITWISE_AND=11]="BITWISE_AND",e[e.BITWISE_OR=12]="BITWISE_OR",e[e.BITWISE_XOR=13]="BITWISE_XOR",e[e.BITWISE_SHL=14]="BITWISE_SHL",e[e.BITWISE_SHR=15]="BITWISE_SHR",e[e.BITWISE_SHR_U=16]="BITWISE_SHR_U",e[e.EQ=17]="EQ",e[e.NE=18]="NE",e[e.GT=19]="GT",e[e.GE=20]="GE",e[e.LT=21]="LT",e[e.LE=22]="LE",e[e.PLUS=23]="PLUS",e[e.MINUS=24]="MINUS",e[e.NOT=25]="NOT",e[e.BITWISE_NOT=26]="BITWISE_NOT",e[e.PREFIX_INC=27]="PREFIX_INC",e[e.PREFIX_DEC=28]="PREFIX_DEC",e[e.POSTFIX_INC=29]="POSTFIX_INC",e[e.POSTFIX_DEC=30]="POSTFIX_DEC"}(o=r.OperatorKind||(r.OperatorKind={}));var f,E,g=function(e){function r(r){void 0===r&&(r=null);var t=e.call(this,r)||this;t.sources=[],t.diagnosticsOffset=0,t.explicitStartFunction=null,t.filesByName=new Map,t.elementsByName=new Map,t.elementsByDeclaration=new Map,t.instancesByName=new Map,t.typeClasses=new Map,t.arrayBufferInstance=null,t.arrayPrototype=null,t.stringInstance=null,t.abortInstance=null,t.memoryAllocateInstance=null,t.hasGC=!1,t.gcAllocateInstance=null,t.gcLinkInstance=null,t.gcMarkInstance=null,t.gcHeaderSize=0,t.gcHookOffset=0,t.nativeDummySignature=null;var n=new u.Source(c.LIBRARY_SUBST,"[native code]",u.SourceKind.LIBRARY);t.nativeSource=n;var i=new S(t,n);return t.nativeFile=i,t.filesByName.set(i.internalName,i),t.resolver=new _.Resolver(t),t}return i(r,e),r.prototype.makeNativeVariableDeclaration=function(e,r){void 0===r&&(r=c.CommonFlags.NONE);var t=this.nativeSource.range;return u.Node.createVariableDeclaration(u.Node.createIdentifierExpression(e,t),null,null,null,r,t)},r.prototype.makeNativeTypeDeclaration=function(e,r){void 0===r&&(r=c.CommonFlags.NONE);var t=this.nativeSource.range,n=u.Node.createIdentifierExpression(e,t);return u.Node.createTypeDeclaration(n,null,u.Node.createOmittedType(t),null,r,t)},r.prototype.makeNativeFunctionDeclaration=function(e,r){void 0===r&&(r=c.CommonFlags.NONE);var t=this.nativeSource.range;return u.Node.createFunctionDeclaration(u.Node.createIdentifierExpression(e,t),null,this.nativeDummySignature||(this.nativeDummySignature=u.Node.createSignature([],u.Node.createType(u.Node.createSimpleTypeName(c.CommonSymbols.void_,t),null,!1,t),null,!1,t)),null,null,r,0,t)},r.prototype.makeNativeNamespaceDeclaration=function(e,r){void 0===r&&(r=c.CommonFlags.NONE);var t=this.nativeSource.range;return u.Node.createNamespaceDeclaration(u.Node.createIdentifierExpression(e,t),[],null,r,t)},r.prototype.makeNativeFunction=function(e,r,t,n,i){return void 0===t&&(t=this.nativeFile),void 0===n&&(n=c.CommonFlags.NONE),void 0===i&&(i=E.NONE),new U(e,new B(e,t,this.makeNativeFunctionDeclaration(e,n),i),r)},r.prototype.getElementByDeclaration=function(e){var r=this.elementsByDeclaration;return assert(r.has(e)),r.get(e)},r.prototype.initialize=function(e){var r,t,n,i,o,_,h,d,y,m,T,g;this.options=e,this.registerNativeType(c.CommonSymbols.i8,p.Type.i8),this.registerNativeType(c.CommonSymbols.i16,p.Type.i16),this.registerNativeType(c.CommonSymbols.i32,p.Type.i32),this.registerNativeType(c.CommonSymbols.i64,p.Type.i64),this.registerNativeType(c.CommonSymbols.isize,e.isizeType),this.registerNativeType(c.CommonSymbols.u8,p.Type.u8),this.registerNativeType(c.CommonSymbols.u16,p.Type.u16),this.registerNativeType(c.CommonSymbols.u32,p.Type.u32),this.registerNativeType(c.CommonSymbols.u64,p.Type.u64),this.registerNativeType(c.CommonSymbols.usize,e.usizeType),this.registerNativeType(c.CommonSymbols.bool,p.Type.bool),this.registerNativeType(c.CommonSymbols.f32,p.Type.f32),this.registerNativeType(c.CommonSymbols.f64,p.Type.f64),this.registerNativeType(c.CommonSymbols.void_,p.Type.void),this.registerNativeType(c.CommonSymbols.number,p.Type.f64),this.registerNativeType(c.CommonSymbols.boolean,p.Type.bool),this.nativeFile.add(c.CommonSymbols.native,new A(c.CommonSymbols.native,this.nativeFile,this.makeNativeTypeDeclaration(c.CommonSymbols.native,c.CommonFlags.EXPORT|c.CommonFlags.GENERIC),E.BUILTIN)),e.hasFeature(8)&&this.registerNativeType(c.CommonSymbols.v128,p.Type.v128),this.registerConstantInteger(c.LibrarySymbols.ASC_TARGET,p.Type.i32,i64_new(e.isWasm64?2:1)),this.registerConstantInteger(c.LibrarySymbols.ASC_NO_ASSERT,p.Type.bool,i64_new(e.noAssert?1:0,0)),this.registerConstantInteger(c.LibrarySymbols.ASC_MEMORY_BASE,p.Type.i32,i64_new(e.memoryBase,0)),this.registerConstantInteger(c.LibrarySymbols.ASC_OPTIMIZE_LEVEL,p.Type.i32,i64_new(e.optimizeLevelHint,0)),this.registerConstantInteger(c.LibrarySymbols.ASC_SHRINK_LEVEL,p.Type.i32,i64_new(e.shrinkLevelHint,0)),this.registerConstantInteger(c.LibrarySymbols.ASC_FEATURE_MUTABLE_GLOBAL,p.Type.bool,i64_new(e.hasFeature(2)?1:0,0)),this.registerConstantInteger(c.LibrarySymbols.ASC_FEATURE_SIGN_EXTENSION,p.Type.bool,i64_new(e.hasFeature(1)?1:0,0)),this.registerConstantInteger(c.LibrarySymbols.ASC_FEATURE_BULK_MEMORY,p.Type.bool,i64_new(e.hasFeature(4)?1:0,0)),this.registerConstantInteger(c.LibrarySymbols.ASC_FEATURE_SIMD,p.Type.bool,i64_new(e.hasFeature(8)?1:0,0)),this.registerConstantInteger(c.LibrarySymbols.ASC_FEATURE_THREADS,p.Type.bool,i64_new(e.hasFeature(16)?1:0,0));for(var v=new Array,I=new Map,x=new Map,N=new Array,O=new Array,C=0,k=this.sources.length;C<k;++C){var R=this.sources[C],L=new S(this,R);this.filesByName.set(L.internalName,L);for(var F=R.statements,B=0,U=F.length;B<U;++B){var D=F[B];switch(D.kind){case u.NodeKind.EXPORT:this.initializeExports(D,L,I,x);break;case u.NodeKind.IMPORT:this.initializeImports(D,L,v,I);break;case u.NodeKind.VARIABLE:this.initializeVariables(D,L);break;case u.NodeKind.CLASSDECLARATION:this.initializeClass(D,L,N,O);break;case u.NodeKind.ENUMDECLARATION:this.initializeEnum(D,L);break;case u.NodeKind.FUNCTIONDECLARATION:this.initializeFunction(D,L);break;case u.NodeKind.INTERFACEDECLARATION:this.initializeInterface(D,L);break;case u.NodeKind.NAMESPACEDECLARATION:this.initializeNamespace(D,L,N,O);break;case u.NodeKind.TYPEDECLARATION:this.initializeTypeDefinition(D,L)}}}try{for(var w=a(x),P=w.next();!P.done;P=w.next()){var M=s(P.value,2),V=(L=M[0],M[1]);for(C=0,k=V.length;C<k;++C){var G=V[C];(K=this.lookupForeignFile(G.foreignPath,G.foreignPathAlt))?L.ensureExportStar(K):this.error(l.DiagnosticCode.File_0_not_found,G.pathLiteral.range,G.pathLiteral.value)}}}catch(e){r={error:e}}finally{try{P&&!P.done&&(t=w.return)&&t.call(w)}finally{if(r)throw r.error}}for(C=0,k=v.length;C<k;++C){var K,z=v[C],H=z.foreignIdentifier;if(H)(me=this.lookupForeign(H.text,z.foreignPath,z.foreignPathAlt,I))?z.localFile.add(z.localIdentifier.text,me,!0):this.error(l.DiagnosticCode.Module_0_has_no_exported_member_1,H.range,z.foreignPath,H.text);else if(K=this.lookupForeignFile(z.foreignPath,z.foreignPathAlt)){var Y=z.localFile,W=z.localIdentifier.text;Y.add(W,K.asImportedNamespace(W,Y),!0)}else assert(!1)}try{for(var X=a(I),q=X.next();!q.done;q=X.next()){var Q=s(q.value,2),j=(L=Q[0],Q[1]);try{for(var Z=a(j),J=Z.next();!J.done;J=Z.next()){var $=s(J.value,2),ee=$[0],re=$[1],te=(W=re.localIdentifier.text,re.foreignPath);if(te)(me=this.lookupForeign(W,te,assert(re.foreignPathAlt),I))?L.ensureExport(ee,me):this.error(l.DiagnosticCode.Module_0_has_no_exported_member_1,re.localIdentifier.range,te,W);else if(me=L.lookupInSelf(W))L.ensureExport(ee,me);else{var ne=this.lookupGlobal(W);ne&&ne instanceof b?L.ensureExport(ee,ne):this.error(l.DiagnosticCode.Module_0_has_no_exported_member_1,re.foreignIdentifier.range,L.internalName,re.foreignIdentifier.text)}}}catch(e){o={error:e}}finally{try{J&&!J.done&&(_=Z.return)&&_.call(Z)}finally{if(o)throw o.error}}}}catch(e){n={error:e}}finally{try{q&&!q.done&&(i=X.return)&&i.call(X)}finally{if(n)throw n.error}}this.registerNativeTypeClass(0,c.LibrarySymbols.I8),this.registerNativeTypeClass(1,c.LibrarySymbols.I16),this.registerNativeTypeClass(2,c.LibrarySymbols.I32),this.registerNativeTypeClass(3,c.LibrarySymbols.I64),this.registerNativeTypeClass(4,c.LibrarySymbols.Isize),this.registerNativeTypeClass(5,c.LibrarySymbols.U8),this.registerNativeTypeClass(6,c.LibrarySymbols.U16),this.registerNativeTypeClass(7,c.LibrarySymbols.U32),this.registerNativeTypeClass(8,c.LibrarySymbols.U64),this.registerNativeTypeClass(9,c.LibrarySymbols.Usize),this.registerNativeTypeClass(10,c.LibrarySymbols.Bool),this.registerNativeTypeClass(11,c.LibrarySymbols.F32),this.registerNativeTypeClass(12,c.LibrarySymbols.F64),e.hasFeature(8)&&this.registerNativeTypeClass(13,c.LibrarySymbols.V128);var ie=this.resolver;for(C=0,k=N.length;C<k;++C){var ae=N[C],se=assert(ae.extendsNode),oe=ie.resolveTypeName(se.name,ae.parent);if(oe)if(oe.kind==f.CLASS_PROTOTYPE){var ce=oe;ce.hasDecorator(E.SEALED)&&this.error(l.DiagnosticCode.Class_0_is_sealed_and_cannot_be_extended,se.range,oe.identifierNode.text),ce.hasDecorator(E.UNMANAGED)!=ae.hasDecorator(E.UNMANAGED)&&this.error(l.DiagnosticCode.Unmanaged_classes_cannot_extend_managed_classes_and_vice_versa,u.Range.join(ae.identifierNode.range,se.range)),ae.basePrototype=ce}else this.error(l.DiagnosticCode.A_class_may_only_extend_another_class,se.range)}var le=e.globalAliases;if(le)try{for(var pe=a(le),ue=pe.next();!ue.done;ue=pe.next()){var _e=s(ue.value,2),he=_e[0],de=_e[1];if(de.length){var ye=this.elementsByName;if(!(me=ye.get(de)))throw new Error("no such global element: "+de);if(ye.has(he))throw new Error("duplicate global element: "+de);ye.set(he,me)}}}catch(e){h={error:e}}finally{try{ue&&!ue.done&&(d=pe.return)&&d.call(pe)}finally{if(h)throw h.error}}var me=void 0;if((me=this.lookupGlobal(c.LibrarySymbols.String))&&(assert(me.kind==f.CLASS_PROTOTYPE),this.stringInstance=ie.resolveClass(me,null)),(me=this.lookupGlobal(c.LibrarySymbols.ArrayBuffer))&&(assert(me.kind==f.CLASS_PROTOTYPE),this.arrayBufferInstance=ie.resolveClass(me,null)),(me=this.lookupGlobal(c.LibrarySymbols.Array))&&(assert(me.kind==f.CLASS_PROTOTYPE),this.arrayPrototype=me),(me=this.lookupGlobal(c.LibrarySymbols.abort))&&(assert(me.kind==f.FUNCTION_PROTOTYPE),this.abortInstance=this.resolver.resolveFunction(me,null)),(me=this.lookupGlobal(c.LibrarySymbols.memory))&&(me=me.lookupInSelf(c.LibrarySymbols.allocate))&&(assert(me.kind==f.FUNCTION_PROTOTYPE),this.memoryAllocateInstance=this.resolver.resolveFunction(me,null)),this.elementsByName.has("__gc_allocate")&&this.elementsByName.has("__gc_link")&&this.elementsByName.has("__gc_mark")){me=this.elementsByName.get("__gc_allocate");assert(me.kind==f.FUNCTION_PROTOTYPE);var Te=assert(this.resolver.resolveFunction(me,null)),fe=Te.signature;assert(2==fe.parameterTypes.length),assert(fe.parameterTypes[0]==this.options.usizeType),assert(fe.parameterTypes[1].signatureReference),assert(fe.returnType==this.options.usizeType),me=this.elementsByName.get("__gc_link"),assert(me.kind==f.FUNCTION_PROTOTYPE);var Ee=assert(this.resolver.resolveFunction(me,null));fe=Ee.signature,assert(2==fe.parameterTypes.length),assert(fe.parameterTypes[0]==this.options.usizeType),assert(fe.parameterTypes[1]==this.options.usizeType),assert(fe.returnType==p.Type.void),me=this.elementsByName.get("__gc_mark"),assert(me.kind==f.FUNCTION_PROTOTYPE);var ge=assert(this.resolver.resolveFunction(me,null));fe=ge.signature,assert(1==fe.parameterTypes.length),assert(fe.parameterTypes[0]==this.options.usizeType),assert(fe.returnType==p.Type.void),this.gcAllocateInstance=Te,this.gcLinkInstance=Ee,this.gcMarkInstance=ge;var ve=2*e.usizeType.byteSize;this.gcHookOffset=ve,this.gcHeaderSize=ve+4+7&-8,this.hasGC=!0}try{for(var Ie=a(this.filesByName.values()),be=Ie.next();!be.done;be=Ie.next()){j=(L=be.value).exports;if(L.source.isEntry&&j)try{for(var xe=a(j.values()),Se=xe.next();!Se.done;Se=xe.next()){me=Se.value;this.markModuleExport(me)}}catch(e){T={error:e}}finally{try{Se&&!Se.done&&(g=xe.return)&&g.call(xe)}finally{if(T)throw T.error}}}}catch(e){y={error:e}}finally{try{be&&!be.done&&(m=Ie.return)&&m.call(Ie)}finally{if(y)throw y.error}}},r.prototype.markModuleExport=function(e){var r,t,n,i;switch(e.set(c.CommonFlags.MODULE_EXPORT),e.kind){case f.CLASS_PROTOTYPE:var s=e.instanceMembers;if(s)try{for(var o=a(s.values()),l=o.next();!l.done;l=o.next()){var p=l.value;this.markModuleExport(p)}}catch(e){r={error:e}}finally{try{l&&!l.done&&(t=o.return)&&t.call(o)}finally{if(r)throw r.error}}break;case f.PROPERTY_PROTOTYPE:var u=e.getterPrototype;u&&this.markModuleExport(u);var _=e.setterPrototype;_&&this.markModuleExport(_);break;case f.PROPERTY:case f.FUNCTION:case f.FIELD:case f.CLASS:assert(!1)}var h=e.members;if(h)try{for(var d=a(h.values()),y=d.next();!y.done;y=d.next()){p=y.value;this.markModuleExport(p)}}catch(e){n={error:e}}finally{try{y&&!y.done&&(i=d.return)&&i.call(d)}finally{if(n)throw n.error}}},r.prototype.registerNativeType=function(e,r){var t=new A(e,this.nativeFile,this.makeNativeTypeDeclaration(e,c.CommonFlags.EXPORT),E.BUILTIN);t.setType(r),this.nativeFile.add(e,t)},r.prototype.registerNativeTypeClass=function(e,r){assert(!this.typeClasses.has(e));var t=this.lookupGlobal(r);if(t){assert(t.kind==f.CLASS_PROTOTYPE);var n=this.resolver.resolveClass(t,null);n&&this.typeClasses.set(e,n)}},r.prototype.registerConstantInteger=function(e,r,t){assert(r.is(4));var n=new R(e,this.nativeFile,E.NONE,this.makeNativeVariableDeclaration(e,c.CommonFlags.CONST|c.CommonFlags.EXPORT));n.setConstantIntegerValue(t,r),this.nativeFile.add(e,n)},r.prototype.registerConstantFloat=function(e,r,t){assert(r.is(8));var n=new R(e,this.nativeFile,E.NONE,this.makeNativeVariableDeclaration(e,c.CommonFlags.CONST|c.CommonFlags.EXPORT));n.setConstantFloatValue(t,r),this.nativeFile.add(e,n)},r.prototype.ensureGlobal=function(e,r){var t=this.elementsByName;if(t.has(e)&&t.get(e)!==r){var n=W(t.get(e),r);if(!n)return void this.error(l.DiagnosticCode.Duplicate_identifier_0,r.identifierNode.range,e);r=n}t.set(e,r)},r.prototype.lookupGlobal=function(e){var r=this.elementsByName;return r.has(e)?r.get(e):null},r.prototype.lookupForeignFile=function(e,r){var t=this.filesByName;return t.has(e)?t.get(e):t.has(r)?t.get(r):null},r.prototype.lookupForeign=function(e,r,t,n){for(;;){var i=this.lookupForeignFile(r,t);if(!i)return null;var a=i.lookupExport(e);if(a)return a;if(n.has(i)){var s=n.get(i);if(s.has(e)){var o=s.get(e);if(o.foreignPath){e=o.localIdentifier.text,r=o.foreignPath,t=assert(o.foreignPathAlt);continue}if(a=i.lookupInSelf(o.localIdentifier.text))return a}}break}return null},r.prototype.checkDecorators=function(e,r){var t=E.NONE;if(e)for(var n=0,i=e.length;n<i;++n){var a=e[n],s=v(u.decoratorNameToKind(a.name));s&&(s==E.BUILTIN?a.range.source.isLibrary?t|=s:this.error(l.DiagnosticCode.Decorator_0_is_not_valid_here,a.range,a.name.range.toString()):r&s?t&s?this.error(l.DiagnosticCode.Duplicate_decorator,a.range,a.name.range.toString()):t|=s:this.error(l.DiagnosticCode.Decorator_0_is_not_valid_here,a.range,a.name.range.toString()))}return t},r.prototype.initializeClass=function(e,r,t,n){var i=e.name.text,a=new G(i,r,e,this.checkDecorators(e.decorators,E.GLOBAL|E.SEALED|E.UNMANAGED));if(r.add(i,a)){var s=e.implementsTypes;if(s){var o=s.length;if(a.hasDecorator(E.UNMANAGED))o&&this.error(l.DiagnosticCode.Unmanaged_classes_cannot_implement_interfaces,u.Range.join(e.name.range,s[o-1].range));else if(o){for(var p=0;p<o;++p)this.warning(l.DiagnosticCode.Operation_not_supported,s[p].range);n.push(a)}}e.extendsType&&t.push(a);for(var _=e.members,h=(p=0,_.length);p<h;++p){var d=_[p];switch(d.kind){case u.NodeKind.FIELDDECLARATION:this.initializeField(d,a);break;case u.NodeKind.METHODDECLARATION:d.isAny(c.CommonFlags.GET|c.CommonFlags.SET)?this.initializeProperty(d,a):this.initializeMethod(d,a);break;case u.NodeKind.INDEXSIGNATUREDECLARATION:break;default:assert(!1)}}}},r.prototype.initializeField=function(e,r){var t,n=e.name.text,i=e.decorators;if(e.is(c.CommonFlags.STATIC)){if(assert(r.kind!=f.INTERFACE_PROTOTYPE),t=new R(n,r,this.checkDecorators(i,(e.is(c.CommonFlags.READONLY)?E.INLINE:E.NONE)|E.LAZY),e),!r.add(n,t))return}else if(assert(!e.isAny(c.CommonFlags.ABSTRACT|c.CommonFlags.GET|c.CommonFlags.SET)),t=new w(n,r,e,this.checkDecorators(i,E.NONE)),!r.addInstance(n,t))return},r.prototype.initializeMethod=function(e,r){var t=e.name.text,n=e.is(c.CommonFlags.STATIC),i=E.INLINE;e.is(c.CommonFlags.GENERIC)||(i|=E.OPERATOR_BINARY|E.OPERATOR_PREFIX|E.OPERATOR_POSTFIX);var a=new B(t,r,e,this.checkDecorators(e.decorators,i));if(n){if(assert(e.name.kind!=u.NodeKind.CONSTRUCTOR),!r.add(t,a))return}else if(!r.addInstance(t,a))return;this.checkOperatorOverloads(e.decorators,a,r)},r.prototype.checkOperatorOverloads=function(e,r,t){if(e)for(var n=0,i=e.length;n<i;++n){var a=e[n];switch(a.decoratorKind){case u.DecoratorKind.OPERATOR:case u.DecoratorKind.OPERATOR_BINARY:case u.DecoratorKind.OPERATOR_PREFIX:case u.DecoratorKind.OPERATOR_POSTFIX:var s=a.arguments&&a.arguments.length||0;if(1==s){var c=a.arguments[0];if(c.kind==u.NodeKind.LITERAL&&c.literalKind==u.LiteralKind.STRING){var p=T(a.decoratorKind,c.value);if(p==o.INVALID)this.error(l.DiagnosticCode.Operation_not_supported,c.range);else{var _=t.overloadPrototypes;_.has(p)?this.error(l.DiagnosticCode.Duplicate_function_implementation,c.range):(r.operatorKind=p,_.set(p,r))}}else this.error(l.DiagnosticCode.String_literal_expected,c.range)}else this.error(l.DiagnosticCode.Expected_0_arguments_but_got_1,a.range,"1",s.toString(10))}}},r.prototype.ensureProperty=function(e,r){var t=e.name.text;if(e.is(c.CommonFlags.STATIC)){if(!(i=r.members)||!i.has(t)){var n=new M(t,r,e);return r.add(t,n)?n:null}if((n=i.get(t)).kind==f.PROPERTY_PROTOTYPE)return n}else{var i;if(!(i=r.instanceMembers)||!i.has(t)){n=new M(t,r,e);return r.addInstance(t,n)?n:null}if((n=i.get(t)).kind==f.PROPERTY_PROTOTYPE)return n}return this.error(l.DiagnosticCode.Duplicate_property_0,e.name.range,t),null},r.prototype.initializeProperty=function(e,r){var t=this.ensureProperty(e,r);if(t){var n=e.name.text,i=e.is(c.CommonFlags.GET);if(i){if(t.getterPrototype)return void this.error(l.DiagnosticCode.Duplicate_property_0,e.name.range,n)}else if(t.setterPrototype)return void this.error(l.DiagnosticCode.Duplicate_property_0,e.name.range,n);var a=new B((i?c.GETTER_PREFIX:c.SETTER_PREFIX)+n,t,e,this.checkDecorators(e.decorators,E.INLINE));i?t.getterPrototype=a:t.setterPrototype=a}},r.prototype.initializeEnum=function(e,r){var t=e.name.text,n=new O(t,r,e,this.checkDecorators(e.decorators,E.GLOBAL|E.INLINE|E.LAZY));if(r.add(t,n))for(var i=e.values,a=0,s=i.length;a<s;++a)this.initializeEnumValue(i[a],n)},r.prototype.initializeEnumValue=function(e,r){var t=e.name.text,n=new k(t,r,e,this.checkDecorators(e.decorators,E.NONE));r.add(t,n)},r.prototype.initializeExports=function(e,r,t,n){var i=e.members;if(i)for(var a=0,s=i.length;a<s;++a)this.initializeExport(i[a],r,e.internalPath,t);else{var o=void 0;n.has(r)?o=n.get(r):n.set(r,o=[]);var l=assert(e.internalPath);o.push(new m(l,l.endsWith(c.INDEX_SUFFIX)?l.substring(0,l.length-c.INDEX_SUFFIX.length):l+c.INDEX_SUFFIX,assert(e.path)))}},r.prototype.initializeExport=function(e,r,t,n){var i=e.localName.text,a=e.exportedName.text,s=r.lookupExport(a);if(s)this.error(l.DiagnosticCode.Export_declaration_conflicts_with_exported_declaration_of_0,e.exportedName.range,a);else if(null===t)if(s=r.lookupInSelf(i))r.ensureExport(a,s);else{var o=void 0;n.has(r)?o=n.get(r):n.set(r,o=new Map),o.set(a,new y(e.localName,e.exportedName,null,null))}else{o=void 0;n.has(r)?o=n.get(r):n.set(r,o=new Map),o.set(a,new y(e.localName,e.exportedName,t,t.endsWith(c.INDEX_SUFFIX)?t.substring(0,t.length-c.INDEX_SUFFIX.length):t+c.INDEX_SUFFIX))}},r.prototype.initializeImports=function(e,r,t,n){var i=e.declarations;if(i)for(var a=0,s=i.length;a<s;++a)this.initializeImport(i[a],r,e.internalPath,t,n);else e.namespaceName&&t.push(new d(r,e.namespaceName,null,e.internalPath,e.internalPath+c.INDEX_SUFFIX))},r.prototype.initializeImport=function(e,r,t,n,i){var a=t.endsWith(c.INDEX_SUFFIX)?t.substring(0,t.length-c.INDEX_SUFFIX.length):t+c.INDEX_SUFFIX,s=this.lookupForeign(e.foreignName.text,t,a,i);s?r.add(e.name.text,s,!0):n.push(new d(r,e.name,e.foreignName,t,a))},r.prototype.initializeFunction=function(e,r){var t=e.name.text,n=E.NONE;e.is(c.CommonFlags.AMBIENT)?n|=E.EXTERNAL:n|=E.INLINE,e.is(c.CommonFlags.INSTANCE)||r.kind!=f.CLASS_PROTOTYPE&&(n|=E.GLOBAL),e.is(c.CommonFlags.GENERIC)||r.kind==f.FILE&&r.source.isEntry&&(n|=E.START);var i=new B(t,r,e,this.checkDecorators(e.decorators,n));r.add(t,i)&&i.hasDecorator(E.START)&&(this.explicitStartFunction?this.error(l.DiagnosticCode.Module_cannot_have_multiple_start_functions,assert(u.findDecorator(u.DecoratorKind.START,e.decorators)).range):this.explicitStartFunction=i)},r.prototype.initializeInterface=function(e,r){var t=e.name.text,n=new z(t,r,e,this.checkDecorators(e.decorators,E.GLOBAL));if(r.add(t,n))for(var i=e.members,a=0,s=i.length;a<s;++a){var o=i[a];switch(o.kind){case u.NodeKind.FIELDDECLARATION:this.initializeField(o,n);break;case u.NodeKind.METHODDECLARATION:o.isAny(c.CommonFlags.GET|c.CommonFlags.SET)?this.initializeProperty(o,n):this.initializeMethod(o,n);break;default:assert(!1)}}},r.prototype.initializeNamespace=function(e,r,t,n){var i=e.name.text,a=new N(i,r,e);if(r.add(i,a)){a=assert(r.lookupInSelf(i));for(var s=e.members,o=0,c=s.length;o<c;++o){var l=s[o];switch(l.kind){case u.NodeKind.CLASSDECLARATION:this.initializeClass(l,a,t,n);break;case u.NodeKind.ENUMDECLARATION:this.initializeEnum(l,a);break;case u.NodeKind.FUNCTIONDECLARATION:this.initializeFunction(l,a);break;case u.NodeKind.INTERFACEDECLARATION:this.initializeInterface(l,a);break;case u.NodeKind.NAMESPACEDECLARATION:this.initializeNamespace(l,a,t,n);break;case u.NodeKind.TYPEDECLARATION:this.initializeTypeDefinition(l,a);break;case u.NodeKind.VARIABLE:this.initializeVariables(l,a);break;default:assert(!1)}}}},r.prototype.initializeTypeDefinition=function(e,r){var t=e.name.text,n=new A(t,r,e,this.checkDecorators(e.decorators,E.NONE));r.add(t,n)},r.prototype.initializeVariables=function(e,r){for(var t=e.declarations,n=0,i=t.length;n<i;++n){var a=t[n],s=a.name.text,o=E.GLOBAL|E.LAZY;a.is(c.CommonFlags.DECLARE)&&(o|=E.EXTERNAL),a.is(c.CommonFlags.CONST)&&(o|=E.INLINE);var l=new R(s,r,this.checkDecorators(a.decorators,o),a);r.add(s,l)}},r}(l.DiagnosticEmitter);function v(e){switch(e){case u.DecoratorKind.GLOBAL:return E.GLOBAL;case u.DecoratorKind.OPERATOR:case u.DecoratorKind.OPERATOR_BINARY:return E.OPERATOR_BINARY;case u.DecoratorKind.OPERATOR_PREFIX:return E.OPERATOR_PREFIX;case u.DecoratorKind.OPERATOR_POSTFIX:return E.OPERATOR_POSTFIX;case u.DecoratorKind.UNMANAGED:return E.UNMANAGED;case u.DecoratorKind.SEALED:return E.SEALED;case u.DecoratorKind.INLINE:return E.INLINE;case u.DecoratorKind.EXTERNAL:return E.EXTERNAL;case u.DecoratorKind.BUILTIN:return E.BUILTIN;case u.DecoratorKind.LAZY:return E.LAZY;case u.DecoratorKind.START:return E.START;default:return E.NONE}}r.Program=g,function(e){e[e.GLOBAL=0]="GLOBAL",e[e.LOCAL=1]="LOCAL",e[e.ENUM=2]="ENUM",e[e.ENUMVALUE=3]="ENUMVALUE",e[e.FUNCTION_PROTOTYPE=4]="FUNCTION_PROTOTYPE",e[e.FUNCTION=5]="FUNCTION",e[e.FUNCTION_TARGET=6]="FUNCTION_TARGET",e[e.CLASS_PROTOTYPE=7]="CLASS_PROTOTYPE",e[e.CLASS=8]="CLASS",e[e.INTERFACE_PROTOTYPE=9]="INTERFACE_PROTOTYPE",e[e.INTERFACE=10]="INTERFACE",e[e.FIELD_PROTOTYPE=11]="FIELD_PROTOTYPE",e[e.FIELD=12]="FIELD",e[e.PROPERTY_PROTOTYPE=13]="PROPERTY_PROTOTYPE",e[e.PROPERTY=14]="PROPERTY",e[e.NAMESPACE=15]="NAMESPACE",e[e.FILE=16]="FILE",e[e.TYPEDEFINITION=17]="TYPEDEFINITION"}(f=r.ElementKind||(r.ElementKind={})),function(e){e[e.NONE=0]="NONE",e[e.GLOBAL=1]="GLOBAL",e[e.OPERATOR_BINARY=2]="OPERATOR_BINARY",e[e.OPERATOR_PREFIX=4]="OPERATOR_PREFIX",e[e.OPERATOR_POSTFIX=8]="OPERATOR_POSTFIX",e[e.UNMANAGED=16]="UNMANAGED",e[e.SEALED=32]="SEALED",e[e.INLINE=64]="INLINE",e[e.EXTERNAL=128]="EXTERNAL",e[e.BUILTIN=256]="BUILTIN",e[e.LAZY=512]="LAZY",e[e.START=1024]="START"}(E=r.DecoratorFlags||(r.DecoratorFlags={})),r.decoratorKindToFlag=v;var I=function(){function e(e,r,t,n,i){this.kind=e,this.name=r,this.internalName=t,this.program=n,this.flags=c.CommonFlags.NONE,this.decoratorFlags=E.NONE,this.members=null,this.shadowType=null,this.program=n,this.name=r,this.internalName=t,i?this.parent=i:(assert(this.kind==f.FILE),this.parent=this)}return Object.defineProperty(e.prototype,"file",{get:function(){for(var e=this;;)if((e=e.parent).kind==f.FILE)return e},enumerable:!0,configurable:!0}),e.prototype.is=function(e){return(this.flags&e)==e},e.prototype.isAny=function(e){return 0!=(this.flags&e)},e.prototype.set=function(e){this.flags|=e},e.prototype.hasDecorator=function(e){return(this.decoratorFlags&e)==e},e.prototype.lookupInSelf=function(e){var r=this.members;return r&&r.has(e)?r.get(e):null},e.prototype.add=function(e,r){var t=r.declaration,n=this.members;if(n){if(n.has(e)){var i=n.get(e);if(i.parent!==this);else{var a=W(i,r);if(!a)return this.program.error(l.DiagnosticCode.Duplicate_identifier_0,r.identifierNode.range,r.identifierNode.text),!1;r=a}}}else this.members=n=new Map;n.set(e,r);var s=this.program;return r.kind==f.FUNCTION_PROTOTYPE&&r.isBound||(s.elementsByName.set(r.internalName,r),s.elementsByDeclaration.set(t,r)),!0},e.prototype.toString=function(){return f[this.kind]+":"+this.internalName},e}();r.Element=I;var b=function(e){function r(r,t,n,i,a,s){var o=e.call(this,r,t,n,i,a)||this;return o.declaration=s,o.declaration=s,o.flags=s.flags,o}return i(r,e),Object.defineProperty(r.prototype,"isDeclaredInLibrary",{get:function(){return this.declaration.range.source.isLibrary},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"identifierNode",{get:function(){return this.declaration.name},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"decoratorNodes",{get:function(){return this.declaration.decorators},enumerable:!0,configurable:!0}),r}(I);r.DeclaredElement=b;var x=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.type=p.Type.void,r}return i(r,e),r.prototype.setType=function(e){assert(!this.is(c.CommonFlags.RESOLVED)),this.type=e,this.set(c.CommonFlags.RESOLVED)},r}(b);r.TypedElement=x;var S=function(e){function r(r,t){var n=e.call(this,f.FILE,t.normalizedPath,t.internalPath,r,null)||this;n.source=t,n.exports=null,n.exportsStar=null,n.source=t,assert(!r.filesByName.has(n.internalName)),r.filesByName.set(n.internalName,n);var i=n.program.makeNativeFunction("start:"+n.internalName,new p.Signature(null,p.Type.void),n);return i.internalName=i.name,n.startFunction=i,n}return i(r,e),r.prototype.add=function(r,t,n){return void 0===n&&(n=!1),!!e.prototype.add.call(this,r,t)&&((t=assert(this.lookupInSelf(r))).is(c.CommonFlags.EXPORT)&&!n&&this.ensureExport(t.name,t),t.hasDecorator(E.GLOBAL)&&this.program.ensureGlobal(r,t),!0)},r.prototype.lookupInSelf=function(r){var t=e.prototype.lookupInSelf.call(this,r);if(t)return t;var n=this.exportsStar;if(n)for(var i=0,a=n.length;i<a;++i)if(t=n[i].lookupInSelf(r))return t;return null},r.prototype.lookup=function(e){var r=this.lookupInSelf(e);return r||this.program.lookupGlobal(e)},r.prototype.ensureExport=function(e,r){var t=this.exports;t||(this.exports=t=new Map),t.set(e,r),this.source.isLibrary&&this.program.ensureGlobal(e,r)},r.prototype.ensureExportStar=function(e){var r=this.exportsStar;if(r){if(r.includes(e))return}else this.exportsStar=r=[];r.push(e)},r.prototype.lookupExport=function(e){var r=this.exports;if(r&&r.has(e))return r.get(e);var t=this.exportsStar;if(t)for(var n=0,i=t.length;n<i;++n){var a=t[n].lookupExport(e);if(a)return a}return null},r.prototype.asImportedNamespace=function(e,r){var t,n,i=new N(e,r,this.program.makeNativeNamespaceDeclaration(e)),o=this.exports;if(o)try{for(var c=a(o),l=c.next();!l.done;l=c.next()){var p=s(l.value,2),u=p[0],_=p[1];i.add(u,_)}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=c.return)&&n.call(c)}finally{if(t)throw t.error}}return i},r}(I);r.File=S;var A=function(e){function r(r,t,n,i){void 0===i&&(i=E.NONE);var a=e.call(this,f.TYPEDEFINITION,r,q(r,t,!1),t.program,t,n)||this;return a.decoratorFlags=i,a}return i(r,e),Object.defineProperty(r.prototype,"typeParameterNodes",{get:function(){return this.declaration.typeParameters},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"typeNode",{get:function(){return this.declaration.type},enumerable:!0,configurable:!0}),r.prototype.lookup=function(e){return this.parent.lookup(e)},r}(x);r.TypeDefinition=A;var N=function(e){function r(r,t,n){return e.call(this,f.NAMESPACE,r,q(r,t,!1),t.program,t,n)||this}return i(r,e),r.prototype.lookup=function(e){return this.lookupInSelf(e)||this.parent.lookup(e)},r}(b);r.Namespace=N;var O=function(e){function r(r,t,n,i){void 0===i&&(i=E.NONE);var a=e.call(this,f.ENUM,r,q(r,t,!1),t.program,t,n)||this;return a.decoratorFlags=i,a.setType(p.Type.i32),a}return i(r,e),r.prototype.lookup=function(e){return this.lookupInSelf(e)||this.parent.lookup(e)},r}(x);r.Enum=O,function(e){e[e.NONE=0]="NONE",e[e.INTEGER=1]="INTEGER",e[e.FLOAT=2]="FLOAT"}(r.ConstantValueKind||(r.ConstantValueKind={}));var C=function(e){function r(r,t,n,i){void 0===i&&(i=n.program.makeNativeVariableDeclaration(t));var a=e.call(this,r,t,q(t,n,!1),n.program,n,i)||this;return a.constantValueKind=0,a.flags=i.flags,a}return i(r,e),Object.defineProperty(r.prototype,"typeNode",{get:function(){return this.declaration.type},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"initializerNode",{get:function(){return this.declaration.initializer},enumerable:!0,configurable:!0}),r.prototype.setConstantIntegerValue=function(e,r){assert(r.is(4)),this.type=r,this.constantValueKind=1,this.constantIntegerValue=e,this.set(c.CommonFlags.CONST|c.CommonFlags.INLINED|c.CommonFlags.RESOLVED)},r.prototype.setConstantFloatValue=function(e,r){assert(r.is(8)),this.type=r,this.constantValueKind=2,this.constantFloatValue=e,this.set(c.CommonFlags.CONST|c.CommonFlags.INLINED|c.CommonFlags.RESOLVED)},r.prototype.lookup=function(e){return this.parent.lookup(e)},r}(x);r.VariableLikeElement=C;var k=function(e){function r(r,t,n,i){void 0===i&&(i=E.NONE);var a=e.call(this,f.ENUMVALUE,r,t,n)||this;return a.decoratorFlags=i,a.setType(p.Type.i32),a}return i(r,e),Object.defineProperty(r.prototype,"valueNode",{get:function(){return this.declaration.value},enumerable:!0,configurable:!0}),r.prototype.lookup=function(e){return this.parent.lookup(e)},r}(C);r.EnumValue=k;var R=function(e){function r(r,t,n,i){void 0===i&&(i=t.program.makeNativeVariableDeclaration(r));var a=e.call(this,f.GLOBAL,r,t,i)||this;return a.decoratorFlags=n,a}return i(r,e),r}(C);r.Global=R;var L=function(){return function(e,r,t){void 0===t&&(t=null),this.name=e,this.type=r,this.initializer=t}}();r.Parameter=L;var F=function(e){function r(r,t,n,i,a){void 0===a&&(a=i.program.makeNativeVariableDeclaration(r));var s=e.call(this,f.LOCAL,r,i,a)||this;return s.index=t,s.index=t,assert(n!=p.Type.void),s.setType(n),s}return i(r,e),r}(C);r.Local=F;var B=function(e){function r(r,t,n,i){void 0===i&&(i=E.NONE);var a=e.call(this,f.FUNCTION_PROTOTYPE,r,q(r,t,n.is(c.CommonFlags.INSTANCE)),t.program,t,n)||this;return a.operatorKind=o.INVALID,a.instances=null,a.boundPrototypes=null,a.decoratorFlags=i,a}return i(r,e),Object.defineProperty(r.prototype,"typeParameterNodes",{get:function(){return this.declaration.typeParameters},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"signatureNode",{get:function(){return this.declaration.signature},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"bodyNode",{get:function(){return this.declaration.body},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"arrowKind",{get:function(){return this.declaration.arrowKind},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"isBound",{get:function(){var e=this.parent;return e.kind==f.CLASS||e.kind==f.PROPERTY_PROTOTYPE&&e.parent.kind==f.CLASS},enumerable:!0,configurable:!0}),r.prototype.toBound=function(e){assert(this.is(c.CommonFlags.INSTANCE)),assert(!this.isBound);var t=this.boundPrototypes;if(t){if(t.has(e))return t.get(e)}else this.boundPrototypes=t=new Map;var n=this.declaration;assert(n.kind==u.NodeKind.METHODDECLARATION);var i=new r(this.name,e,n,this.decoratorFlags);return i.flags=this.flags,i.operatorKind=this.operatorKind,t.set(e,i),i},r.prototype.getResolvedInstance=function(e){var r=this.instances;return r&&r.has(e)?r.get(e):null},r.prototype.setResolvedInstance=function(e,r){var t=this.instances;t?assert(!t.has(e)):this.instances=t=new Map,t.set(e,r)},r.prototype.lookup=function(e){return this.parent.lookup(e)},r}(b);r.FunctionPrototype=B;var U=function(e){function r(r,t,n,i){void 0===i&&(i=null);var a=e.call(this,f.FUNCTION,r,q(r,t.parent,t.is(c.CommonFlags.INSTANCE)),t.program,t.parent,t.declaration)||this;if(a.localsByName=new Map,a.localsByIndex=[],a.additionalLocals=[],a.debugLocations=[],a.ref=0,a.functionTableIndex=-1,a.trampoline=null,a.nextInlineId=0,a.nextAnonymousId=0,a.tempI32s=null,a.tempI64s=null,a.tempF32s=null,a.tempF64s=null,a.tempV128s=null,a.nextBreakId=0,a.breakStack=null,a.breakLabel=null,a.prototype=t,a.signature=n,a.flags=t.flags|c.CommonFlags.RESOLVED,a.decoratorFlags=t.decoratorFlags,a.contextualTypeArguments=i,a.type=p.Type.u32.asFunction(n),!t.is(c.CommonFlags.AMBIENT)){var s=0;if(a.is(c.CommonFlags.INSTANCE)){var o=new F(c.CommonSymbols.this_,s++,assert(n.thisType),a);a.localsByName.set(c.CommonSymbols.this_,o),a.localsByIndex[o.index]=o}for(var l=n.parameterTypes,u=0,_=l.length;u<_;++u){var d=l[u],y=n.getParameterName(u);o=new F(y,s++,d,a);a.localsByName.set(y,o),a.localsByIndex[o.index]=o}}return a.flow=h.Flow.create(a),Y(a.program,a),a}return i(r,e),r.prototype.addLocal=function(e,r,t){void 0===r&&(r=null),void 0===t&&(t=null);var n=this.signature.parameterTypes.length+this.additionalLocals.length;this.is(c.CommonFlags.INSTANCE)&&++n;var i=null!==r?r:"var$"+n.toString(),a=new F(i,n,e,this,t||this.program.makeNativeVariableDeclaration(i));if(r){if(this.localsByName.has(r))throw new Error("duplicate local name");this.localsByName.set(r,a)}return this.localsByIndex[a.index]=a,this.additionalLocals.push(e),a},r.prototype.lookup=function(e){var r=this.localsByName;return r.has(e)?r.get(e):this.parent.lookup(e)},r.prototype.finalize=function(e,r){if(this.ref=r,assert(!this.breakStack||!this.breakStack.length),this.breakStack=null,this.breakLabel=null,this.tempI32s=this.tempI64s=this.tempF32s=this.tempF64s=null,this.program.options.sourceMap)for(var t=this.debugLocations,n=0,i=t.length;n<i;++n){var a=t[n];e.setDebugLocation(r,a.debugInfoRef,a.source.debugInfoIndex,a.line,a.column)}},r}(x);r.Function=U;var D=function(e){function r(r,t,n){void 0===n&&(n="");var i=e.call(this,f.FUNCTION_TARGET,n="sig:"+r.toSignatureString(),n,t,t.nativeFile)||this;return i.signature=r,i.flags=c.CommonFlags.RESOLVED,i.type=p.Type.u32.asFunction(r),i}return i(r,e),r.prototype.lookup=function(e){return null},r}(I);r.FunctionTarget=D;var w=function(e){function r(r,t,n,i){void 0===i&&(i=E.NONE);var a=e.call(this,f.FIELD_PROTOTYPE,r,q(r,t,assert(n.is(c.CommonFlags.INSTANCE))),t.program,t,n)||this;return a.decoratorFlags=i,a}return i(r,e),Object.defineProperty(r.prototype,"typeNode",{get:function(){return this.declaration.type},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"initializerNode",{get:function(){return this.declaration.initializer},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"parameterIndex",{get:function(){return this.declaration.parameterIndex},enumerable:!0,configurable:!0}),r.prototype.lookup=function(e){return this.parent.lookup(e)},r}(b);r.FieldPrototype=w;var P=function(e){function r(r,t,n){var i=e.call(this,f.FIELD,r.name,t,r.declaration)||this;return i.memoryOffset=-1,i.prototype=r,i.flags=r.flags,assert(n!=p.Type.void),i.setType(n),Y(i.program,i),i}return i(r,e),r}(C);r.Field=P;var M=function(e){function r(r,t,n){var i=e.call(this,f.PROPERTY_PROTOTYPE,r,q(r,t,n.is(c.CommonFlags.INSTANCE)),t.program,t,n)||this;return i.getterPrototype=null,i.setterPrototype=null,i.flags&=~(c.CommonFlags.GET|c.CommonFlags.SET),i}return i(r,e),r.prototype.lookup=function(e){return this.parent.lookup(e)},r}(b);r.PropertyPrototype=M;var V=function(e){function r(r,t){var n=e.call(this,f.PROPERTY,r.name,t,r.program.makeNativeVariableDeclaration(r.name,r.is(c.CommonFlags.INSTANCE)?c.CommonFlags.INSTANCE:c.CommonFlags.NONE))||this;return n.getterInstance=null,n.setterInstance=null,n.prototype=r,Y(n.program,n),n}return i(r,e),r.prototype.lookup=function(e){return this.parent.lookup(e)},r}(C);r.Property=V;var G=function(e){function r(r,t,n,i,a){void 0===i&&(i=E.NONE),void 0===a&&(a=!1);var s=e.call(this,a?f.INTERFACE_PROTOTYPE:f.CLASS_PROTOTYPE,r,q(r,t,n.is(c.CommonFlags.INSTANCE)),t.program,t,n)||this;return s.instanceMembers=null,s.basePrototype=null,s.constructorPrototype=null,s.overloadPrototypes=new Map,s.instances=null,s.decoratorFlags=i,s}return i(r,e),Object.defineProperty(r.prototype,"typeParameterNodes",{get:function(){return this.declaration.typeParameters},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"extendsNode",{get:function(){return this.declaration.extendsType},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"implementsNodes",{get:function(){return this.declaration.implementsTypes},enumerable:!0,configurable:!0}),r.prototype.extends=function(e){var r=this;do{if(r===e)return!0}while(r=r.basePrototype);return!1},r.prototype.addInstance=function(e,r){var t=r.declaration,n=this.instanceMembers;if(n){if(n.has(e)){var i=W(n.get(e),r);if(!i)return this.program.error(l.DiagnosticCode.Duplicate_identifier_0,r.identifierNode.range,r.identifierNode.text),!1;r=i}}else this.instanceMembers=n=new Map;return n.set(e,r),r.is(c.CommonFlags.EXPORT)&&this.is(c.CommonFlags.MODULE_EXPORT)&&r.set(c.CommonFlags.MODULE_EXPORT),this.program.elementsByDeclaration.set(t,r),!0},r.prototype.getResolvedInstance=function(e){var r=this.instances;return r&&r.has(e)?r.get(e):null},r.prototype.setResolvedInstance=function(e,r){var t=this.instances;t?assert(!t.has(e)):this.instances=t=new Map,t.set(e,r)},r.prototype.lookup=function(e){return this.parent.lookup(e)},r}(b);r.ClassPrototype=G;var K=function(e){function r(r,t,n,i,o){var l,p;void 0===n&&(n=null),void 0===i&&(i=null),void 0===o&&(o=!1);var u=e.call(this,o?f.INTERFACE:f.CLASS,r,q(r,t.parent,t.is(c.CommonFlags.INSTANCE)),t.program,t.parent,t.declaration)||this;if(u.contextualTypeArguments=null,u.currentMemoryOffset=0,u.constructorInstance=null,u.overloads=null,u.gcHookIndex=-1,u.prototype=t,u.flags=t.flags,u.decoratorFlags=t.decoratorFlags,u.typeArguments=n,u.setType(u.program.options.usizeType.asClass(u)),u.base=i,i){var _=i.contextualTypeArguments;if(_){var h=u.contextualTypeArguments;try{for(var d=a(_),y=d.next();!y.done;y=d.next()){var m=s(y.value,2),T=m[0],E=m[1];h||(u.contextualTypeArguments=h=new Map),h.set(T,E)}}catch(e){l={error:e}}finally{try{y&&!y.done&&(p=d.return)&&p.call(d)}finally{if(l)throw l.error}}}}var g=t.typeParameterNodes;if(n){var v=n.length;if(!g||v!=g.length)throw new Error("type argument count mismatch");if(v){u.contextualTypeArguments||(u.contextualTypeArguments=new Map);for(var I=0;I<v;++I)u.contextualTypeArguments.set(g[I].name.text,n[I])}}else if(g&&g.length)throw new Error("type argument count mismatch");return Y(u.program,u),u}return i(r,e),r.prototype.isAssignableTo=function(e){var r=this;do{if(r==e)return!0}while(r=r.base);return!1},r.prototype.lookupOverload=function(e,r){if(void 0===r&&(r=!1),r)switch(e){case o.INDEXED_GET:if(t=this.lookupOverload(o.UNCHECKED_INDEXED_GET))return t;break;case o.INDEXED_SET:var t;if(t=this.lookupOverload(o.UNCHECKED_INDEXED_SET))return t;break;default:assert(!1)}var n=this;do{var i=n.overloads;if(i){var a=i.get(e);if(a)return a}}while(n=n.base);return null},r.prototype.lookup=function(e){return this.parent.lookup(e)},r.prototype.offsetof=function(e){var r=assert(this.members);assert(r.has(e));var t=r.get(e);return assert(t.kind==f.FIELD),t.memoryOffset},r}(x);r.Class=K;var z=function(e){function r(r,t,n,i){return e.call(this,r,t,n,i,!0)||this}return i(r,e),r}(G);r.InterfacePrototype=z;var H=function(e){function r(r,t,n,i){return void 0===n&&(n=[]),void 0===i&&(i=null),e.call(this,r,t,n,i,!0)||this}return i(r,e),r}(K);function Y(e,r){assert(!e.instancesByName.has(r.internalName)),e.instancesByName.set(r.internalName,r)}function W(e,r){assert(e.program===r.program),assert(!r.members);var t=null;switch(e.kind){case f.FUNCTION_PROTOTYPE:switch(r.kind){case f.NAMESPACE:X(r,e),t=e;break;case f.TYPEDEFINITION:e.shadowType||(e.shadowType=r,X(r,e),t=e)}break;case f.CLASS_PROTOTYPE:case f.ENUM:if(r.kind==f.NAMESPACE){X(r,e),t=e;break}break;case f.NAMESPACE:switch(r.kind){case f.ENUM:case f.CLASS_PROTOTYPE:case f.FUNCTION_PROTOTYPE:X(e,r),t=r;break;case f.NAMESPACE:X(r,e),t=e;break;case f.TYPEDEFINITION:e.shadowType||(e.shadowType=r,X(r,e),t=e)}break;case f.GLOBAL:r.kind==f.TYPEDEFINITION&&(e.shadowType||(e.shadowType=r,X(r,e),t=e));break;case f.TYPEDEFINITION:switch(r.kind){case f.GLOBAL:case f.FUNCTION_PROTOTYPE:case f.NAMESPACE:r.shadowType||(r.shadowType=e,X(e,r),t=r)}}return t&&e.is(c.CommonFlags.EXPORT)!=r.is(c.CommonFlags.EXPORT)&&e.program.error(l.DiagnosticCode.Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local,t.identifierNode.range,t.identifierNode.text),t}function X(e,r){var t,n,i=e.members;if(i){var o=r.members;o||(r.members=o=new Map);try{for(var c=a(i),l=c.next();!l.done;l=c.next()){var p=s(l.value,2),u=p[0],_=p[1];o.set(u,_)}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=c.return)&&n.call(c)}finally{if(t)throw t.error}}}}function q(e,r,t,n){switch(void 0===n&&(n=!1),r.kind){case f.FILE:return n?e:r.internalName+c.PATH_DELIMITER+e;case f.FUNCTION:return n?e:(assert(!t),r.internalName+c.INNER_DELIMITER+e);default:return q(r.name,r.parent,r.is(c.CommonFlags.INSTANCE),n)+(t?c.INSTANCE_DELIMITER:c.STATIC_DELIMITER)+e}}r.Interface=H,r.mangleInternalName=q},function(e,r,t){"use strict";var n=this&&this.__values||function(e){var r="function"==typeof Symbol&&e[Symbol.iterator],t=0;return r?r.call(e):{next:function(){return e&&t>=e.length&&(e=void 0),{value:e&&e[t++],done:!e}}}};Object.defineProperty(r,"__esModule",{value:!0});var i,a,s=t(10);!function(e){e[e.None=_BinaryenTypeNone()]="None",e[e.I32=_BinaryenTypeInt32()]="I32",e[e.I64=_BinaryenTypeInt64()]="I64",e[e.F32=_BinaryenTypeFloat32()]="F32",e[e.F64=_BinaryenTypeFloat64()]="F64",e[e.V128=_BinaryenTypeVec128()]="V128",e[e.Unreachable=_BinaryenTypeUnreachable()]="Unreachable",e[e.Auto=_BinaryenTypeAuto()]="Auto"}(i=r.NativeType||(r.NativeType={})),function(e){e[e.Invalid=_BinaryenInvalidId()]="Invalid",e[e.Block=_BinaryenBlockId()]="Block",e[e.If=_BinaryenIfId()]="If",e[e.Loop=_BinaryenLoopId()]="Loop",e[e.Break=_BinaryenBreakId()]="Break",e[e.Switch=_BinaryenSwitchId()]="Switch",e[e.Call=_BinaryenCallId()]="Call",e[e.CallIndirect=_BinaryenCallIndirectId()]="CallIndirect",e[e.GetLocal=_BinaryenGetLocalId()]="GetLocal",e[e.SetLocal=_BinaryenSetLocalId()]="SetLocal",e[e.GetGlobal=_BinaryenGetGlobalId()]="GetGlobal",e[e.SetGlobal=_BinaryenSetGlobalId()]="SetGlobal",e[e.Load=_BinaryenLoadId()]="Load",e[e.Store=_BinaryenStoreId()]="Store",e[e.Const=_BinaryenConstId()]="Const",e[e.Unary=_BinaryenUnaryId()]="Unary",e[e.Binary=_BinaryenBinaryId()]="Binary",e[e.Select=_BinaryenSelectId()]="Select",e[e.Drop=_BinaryenDropId()]="Drop",e[e.Return=_BinaryenReturnId()]="Return",e[e.Host=_BinaryenHostId()]="Host",e[e.Nop=_BinaryenNopId()]="Nop",e[e.Unreachable=_BinaryenUnreachableId()]="Unreachable",e[e.AtomicCmpxchg=_BinaryenAtomicCmpxchgId()]="AtomicCmpxchg",e[e.AtomicRMW=_BinaryenAtomicRMWId()]="AtomicRMW",e[e.AtomicWait=_BinaryenAtomicWaitId()]="AtomicWait",e[e.AtomicWake=_BinaryenAtomicWakeId()]="AtomicWake",e[e.SIMDExtract=_BinaryenSIMDExtractId()]="SIMDExtract",e[e.SIMDReplace=_BinaryenSIMDReplaceId()]="SIMDReplace",e[e.SIMDShuffle=_BinaryenSIMDShuffleId()]="SIMDShuffle",e[e.SIMDBitselect=_BinaryenSIMDBitselectId()]="SIMDBitselect",e[e.SIMDShift=_BinaryenSIMDShiftId()]="SIMDShift",e[e.MemoryInit=_BinaryenMemoryInitId()]="MemoryInit",e[e.DataDrop=_BinaryenDataDropId()]="DataDrop",e[e.MemoryCopy=_BinaryenMemoryCopyId()]="MemoryCopy",e[e.MemoryFill=_BinaryenMemoryFillId()]="MemoryFill"}(a=r.ExpressionId||(r.ExpressionId={})),function(e){e[e.ClzI32=_BinaryenClzInt32()]="ClzI32",e[e.CtzI32=_BinaryenCtzInt32()]="CtzI32",e[e.PopcntI32=_BinaryenPopcntInt32()]="PopcntI32",e[e.NegF32=_BinaryenNegFloat32()]="NegF32",e[e.AbsF32=_BinaryenAbsFloat32()]="AbsF32",e[e.CeilF32=_BinaryenCeilFloat32()]="CeilF32",e[e.FloorF32=_BinaryenFloorFloat32()]="FloorF32",e[e.TruncF32=_BinaryenTruncFloat32()]="TruncF32",e[e.NearestF32=_BinaryenNearestFloat32()]="NearestF32",e[e.SqrtF32=_BinaryenSqrtFloat32()]="SqrtF32",e[e.EqzI32=_BinaryenEqZInt32()]="EqzI32",e[e.ClzI64=_BinaryenClzInt64()]="ClzI64",e[e.CtzI64=_BinaryenCtzInt64()]="CtzI64",e[e.PopcntI64=_BinaryenPopcntInt64()]="PopcntI64",e[e.NegF64=_BinaryenNegFloat64()]="NegF64",e[e.AbsF64=_BinaryenAbsFloat64()]="AbsF64",e[e.CeilF64=_BinaryenCeilFloat64()]="CeilF64",e[e.FloorF64=_BinaryenFloorFloat64()]="FloorF64",e[e.TruncF64=_BinaryenTruncFloat64()]="TruncF64",e[e.NearestF64=_BinaryenNearestFloat64()]="NearestF64",e[e.SqrtF64=_BinaryenSqrtFloat64()]="SqrtF64",e[e.EqzI64=_BinaryenEqZInt64()]="EqzI64",e[e.ExtendI32=_BinaryenExtendSInt32()]="ExtendI32",e[e.ExtendU32=_BinaryenExtendUInt32()]="ExtendU32",e[e.WrapI64=_BinaryenWrapInt64()]="WrapI64",e[e.TruncF32ToI32=_BinaryenTruncSFloat32ToInt32()]="TruncF32ToI32",e[e.TruncF32ToI64=_BinaryenTruncSFloat32ToInt64()]="TruncF32ToI64",e[e.TruncF32ToU32=_BinaryenTruncUFloat32ToInt32()]="TruncF32ToU32",e[e.TruncF32ToU64=_BinaryenTruncUFloat32ToInt64()]="TruncF32ToU64",e[e.TruncF64ToI32=_BinaryenTruncSFloat64ToInt32()]="TruncF64ToI32",e[e.TruncF64ToI64=_BinaryenTruncSFloat64ToInt64()]="TruncF64ToI64",e[e.TruncF64ToU32=_BinaryenTruncUFloat64ToInt32()]="TruncF64ToU32",e[e.TruncF64ToU64=_BinaryenTruncUFloat64ToInt64()]="TruncF64ToU64",e[e.ReinterpretF32=_BinaryenReinterpretFloat32()]="ReinterpretF32",e[e.ReinterpretF64=_BinaryenReinterpretFloat64()]="ReinterpretF64",e[e.ConvertI32ToF32=_BinaryenConvertSInt32ToFloat32()]="ConvertI32ToF32",e[e.ConvertI32ToF64=_BinaryenConvertSInt32ToFloat64()]="ConvertI32ToF64",e[e.ConvertU32ToF32=_BinaryenConvertUInt32ToFloat32()]="ConvertU32ToF32",e[e.ConvertU32ToF64=_BinaryenConvertUInt32ToFloat64()]="ConvertU32ToF64",e[e.ConvertI64ToF32=_BinaryenConvertSInt64ToFloat32()]="ConvertI64ToF32",e[e.ConvertI64ToF64=_BinaryenConvertSInt64ToFloat64()]="ConvertI64ToF64",e[e.ConvertU64ToF32=_BinaryenConvertUInt64ToFloat32()]="ConvertU64ToF32",e[e.ConvertU64ToF64=_BinaryenConvertUInt64ToFloat64()]="ConvertU64ToF64",e[e.PromoteF32=_BinaryenPromoteFloat32()]="PromoteF32",e[e.DemoteF64=_BinaryenDemoteFloat64()]="DemoteF64",e[e.ReinterpretI32=_BinaryenReinterpretInt32()]="ReinterpretI32",e[e.ReinterpretI64=_BinaryenReinterpretInt64()]="ReinterpretI64",e[e.ExtendI8ToI32=_BinaryenExtendS8Int32()]="ExtendI8ToI32",e[e.ExtendI16ToI32=_BinaryenExtendS16Int32()]="ExtendI16ToI32",e[e.ExtendI8ToI64=_BinaryenExtendS8Int64()]="ExtendI8ToI64",e[e.ExtendI16ToI64=_BinaryenExtendS16Int64()]="ExtendI16ToI64",e[e.ExtendI32ToI64=_BinaryenExtendS32Int64()]="ExtendI32ToI64",e[e.SplatVecI8x16=_BinaryenSplatVecI8x16()]="SplatVecI8x16",e[e.SplatVecI16x8=_BinaryenSplatVecI16x8()]="SplatVecI16x8",e[e.SplatVecI32x4=_BinaryenSplatVecI32x4()]="SplatVecI32x4",e[e.SplatVecI64x2=_BinaryenSplatVecI64x2()]="SplatVecI64x2",e[e.SplatVecF32x4=_BinaryenSplatVecF32x4()]="SplatVecF32x4",e[e.SplatVecF64x2=_BinaryenSplatVecF64x2()]="SplatVecF64x2",e[e.NotVec128=_BinaryenNotVec128()]="NotVec128",e[e.NegVecI8x16=_BinaryenNegVecI8x16()]="NegVecI8x16",e[e.AnyTrueVecI8x16=_BinaryenAnyTrueVecI8x16()]="AnyTrueVecI8x16",e[e.AllTrueVecI8x16=_BinaryenAllTrueVecI8x16()]="AllTrueVecI8x16",e[e.NegVecI16x8=_BinaryenNegVecI16x8()]="NegVecI16x8",e[e.AnyTrueVecI16x8=_BinaryenAnyTrueVecI16x8()]="AnyTrueVecI16x8",e[e.AllTrueVecI16x8=_BinaryenAllTrueVecI16x8()]="AllTrueVecI16x8",e[e.NegVecI32x4=_BinaryenNegVecI32x4()]="NegVecI32x4",e[e.AnyTrueVecI32x4=_BinaryenAnyTrueVecI32x4()]="AnyTrueVecI32x4",e[e.AllTrueVecI32x4=_BinaryenAllTrueVecI32x4()]="AllTrueVecI32x4",e[e.NegVecI64x2=_BinaryenNegVecI64x2()]="NegVecI64x2",e[e.AnyTrueVecI64x2=_BinaryenAnyTrueVecI64x2()]="AnyTrueVecI64x2",e[e.AllTrueVecI64x2=_BinaryenAllTrueVecI64x2()]="AllTrueVecI64x2",e[e.AbsVecF32x4=_BinaryenAbsVecF32x4()]="AbsVecF32x4",e[e.NegVecF32x4=_BinaryenNegVecF32x4()]="NegVecF32x4",e[e.SqrtVecF32x4=_BinaryenSqrtVecF32x4()]="SqrtVecF32x4",e[e.AbsVecF64x2=_BinaryenAbsVecF64x2()]="AbsVecF64x2",e[e.NegVecF64x2=_BinaryenNegVecF64x2()]="NegVecF64x2",e[e.SqrtVecF64x2=_BinaryenSqrtVecF64x2()]="SqrtVecF64x2",e[e.TruncSatSVecF32x4ToVecI32x4=_BinaryenTruncSatSVecF32x4ToVecI32x4()]="TruncSatSVecF32x4ToVecI32x4",e[e.TruncSatUVecF32x4ToVecI32x4=_BinaryenTruncSatUVecF32x4ToVecI32x4()]="TruncSatUVecF32x4ToVecI32x4",e[e.TruncSatSVecF64x2ToVecI64x2=_BinaryenTruncSatSVecF64x2ToVecI64x2()]="TruncSatSVecF64x2ToVecI64x2",e[e.TruncSatUVecF64x2ToVecI64x2=_BinaryenTruncSatUVecF64x2ToVecI64x2()]="TruncSatUVecF64x2ToVecI64x2",e[e.ConvertSVecI32x4ToVecF32x4=_BinaryenConvertSVecI32x4ToVecF32x4()]="ConvertSVecI32x4ToVecF32x4",e[e.ConvertUVecI32x4ToVecF32x4=_BinaryenConvertUVecI32x4ToVecF32x4()]="ConvertUVecI32x4ToVecF32x4",e[e.ConvertSVecI64x2ToVecF64x2=_BinaryenConvertSVecI64x2ToVecF64x2()]="ConvertSVecI64x2ToVecF64x2",e[e.ConvertUVecI64x2ToVecF64x2=_BinaryenConvertUVecI64x2ToVecF64x2()]="ConvertUVecI64x2ToVecF64x2"}(r.UnaryOp||(r.UnaryOp={})),function(e){e[e.AddI32=_BinaryenAddInt32()]="AddI32",e[e.SubI32=_BinaryenSubInt32()]="SubI32",e[e.MulI32=_BinaryenMulInt32()]="MulI32",e[e.DivI32=_BinaryenDivSInt32()]="DivI32",e[e.DivU32=_BinaryenDivUInt32()]="DivU32",e[e.RemI32=_BinaryenRemSInt32()]="RemI32",e[e.RemU32=_BinaryenRemUInt32()]="RemU32",e[e.AndI32=_BinaryenAndInt32()]="AndI32",e[e.OrI32=_BinaryenOrInt32()]="OrI32",e[e.XorI32=_BinaryenXorInt32()]="XorI32",e[e.ShlI32=_BinaryenShlInt32()]="ShlI32",e[e.ShrU32=_BinaryenShrUInt32()]="ShrU32",e[e.ShrI32=_BinaryenShrSInt32()]="ShrI32",e[e.RotlI32=_BinaryenRotLInt32()]="RotlI32",e[e.RotrI32=_BinaryenRotRInt32()]="RotrI32",e[e.EqI32=_BinaryenEqInt32()]="EqI32",e[e.NeI32=_BinaryenNeInt32()]="NeI32",e[e.LtI32=_BinaryenLtSInt32()]="LtI32",e[e.LtU32=_BinaryenLtUInt32()]="LtU32",e[e.LeI32=_BinaryenLeSInt32()]="LeI32",e[e.LeU32=_BinaryenLeUInt32()]="LeU32",e[e.GtI32=_BinaryenGtSInt32()]="GtI32",e[e.GtU32=_BinaryenGtUInt32()]="GtU32",e[e.GeI32=_BinaryenGeSInt32()]="GeI32",e[e.GeU32=_BinaryenGeUInt32()]="GeU32",e[e.AddI64=_BinaryenAddInt64()]="AddI64",e[e.SubI64=_BinaryenSubInt64()]="SubI64",e[e.MulI64=_BinaryenMulInt64()]="MulI64",e[e.DivI64=_BinaryenDivSInt64()]="DivI64",e[e.DivU64=_BinaryenDivUInt64()]="DivU64",e[e.RemI64=_BinaryenRemSInt64()]="RemI64",e[e.RemU64=_BinaryenRemUInt64()]="RemU64",e[e.AndI64=_BinaryenAndInt64()]="AndI64",e[e.OrI64=_BinaryenOrInt64()]="OrI64",e[e.XorI64=_BinaryenXorInt64()]="XorI64",e[e.ShlI64=_BinaryenShlInt64()]="ShlI64",e[e.ShrU64=_BinaryenShrUInt64()]="ShrU64",e[e.ShrI64=_BinaryenShrSInt64()]="ShrI64",e[e.RotlI64=_BinaryenRotLInt64()]="RotlI64",e[e.RotrI64=_BinaryenRotRInt64()]="RotrI64",e[e.EqI64=_BinaryenEqInt64()]="EqI64",e[e.NeI64=_BinaryenNeInt64()]="NeI64",e[e.LtI64=_BinaryenLtSInt64()]="LtI64",e[e.LtU64=_BinaryenLtUInt64()]="LtU64",e[e.LeI64=_BinaryenLeSInt64()]="LeI64",e[e.LeU64=_BinaryenLeUInt64()]="LeU64",e[e.GtI64=_BinaryenGtSInt64()]="GtI64",e[e.GtU64=_BinaryenGtUInt64()]="GtU64",e[e.GeI64=_BinaryenGeSInt64()]="GeI64",e[e.GeU64=_BinaryenGeUInt64()]="GeU64",e[e.AddF32=_BinaryenAddFloat32()]="AddF32",e[e.SubF32=_BinaryenSubFloat32()]="SubF32",e[e.MulF32=_BinaryenMulFloat32()]="MulF32",e[e.DivF32=_BinaryenDivFloat32()]="DivF32",e[e.CopysignF32=_BinaryenCopySignFloat32()]="CopysignF32",e[e.MinF32=_BinaryenMinFloat32()]="MinF32",e[e.MaxF32=_BinaryenMaxFloat32()]="MaxF32",e[e.EqF32=_BinaryenEqFloat32()]="EqF32",e[e.NeF32=_BinaryenNeFloat32()]="NeF32",e[e.LtF32=_BinaryenLtFloat32()]="LtF32",e[e.LeF32=_BinaryenLeFloat32()]="LeF32",e[e.GtF32=_BinaryenGtFloat32()]="GtF32",e[e.GeF32=_BinaryenGeFloat32()]="GeF32",e[e.AddF64=_BinaryenAddFloat64()]="AddF64",e[e.SubF64=_BinaryenSubFloat64()]="SubF64",e[e.MulF64=_BinaryenMulFloat64()]="MulF64",e[e.DivF64=_BinaryenDivFloat64()]="DivF64",e[e.CopysignF64=_BinaryenCopySignFloat64()]="CopysignF64",e[e.MinF64=_BinaryenMinFloat64()]="MinF64",e[e.MaxF64=_BinaryenMaxFloat64()]="MaxF64",e[e.EqF64=_BinaryenEqFloat64()]="EqF64",e[e.NeF64=_BinaryenNeFloat64()]="NeF64",e[e.LtF64=_BinaryenLtFloat64()]="LtF64",e[e.LeF64=_BinaryenLeFloat64()]="LeF64",e[e.GtF64=_BinaryenGtFloat64()]="GtF64",e[e.GeF64=_BinaryenGeFloat64()]="GeF64",e[e.EqVecI8x16=_BinaryenEqVecI8x16()]="EqVecI8x16",e[e.NeVecI8x16=_BinaryenNeVecI8x16()]="NeVecI8x16",e[e.LtSVecI8x16=_BinaryenLtSVecI8x16()]="LtSVecI8x16",e[e.LtUVecI8x16=_BinaryenLtUVecI8x16()]="LtUVecI8x16",e[e.LeSVecI8x16=_BinaryenLeSVecI8x16()]="LeSVecI8x16",e[e.LeUVecI8x16=_BinaryenLeUVecI8x16()]="LeUVecI8x16",e[e.GtSVecI8x16=_BinaryenGtSVecI8x16()]="GtSVecI8x16",e[e.GtUVecI8x16=_BinaryenGtUVecI8x16()]="GtUVecI8x16",e[e.GeSVecI8x16=_BinaryenGeSVecI8x16()]="GeSVecI8x16",e[e.GeUVecI8x16=_BinaryenGeUVecI8x16()]="GeUVecI8x16",e[e.EqVecI16x8=_BinaryenEqVecI16x8()]="EqVecI16x8",e[e.NeVecI16x8=_BinaryenNeVecI16x8()]="NeVecI16x8",e[e.LtSVecI16x8=_BinaryenLtSVecI16x8()]="LtSVecI16x8",e[e.LtUVecI16x8=_BinaryenLtUVecI16x8()]="LtUVecI16x8",e[e.LeSVecI16x8=_BinaryenLeSVecI16x8()]="LeSVecI16x8",e[e.LeUVecI16x8=_BinaryenLeUVecI16x8()]="LeUVecI16x8",e[e.GtSVecI16x8=_BinaryenGtSVecI16x8()]="GtSVecI16x8",e[e.GtUVecI16x8=_BinaryenGtUVecI16x8()]="GtUVecI16x8",e[e.GeSVecI16x8=_BinaryenGeSVecI16x8()]="GeSVecI16x8",e[e.GeUVecI16x8=_BinaryenGeUVecI16x8()]="GeUVecI16x8",e[e.EqVecI32x4=_BinaryenEqVecI32x4()]="EqVecI32x4",e[e.NeVecI32x4=_BinaryenNeVecI32x4()]="NeVecI32x4",e[e.LtSVecI32x4=_BinaryenLtSVecI32x4()]="LtSVecI32x4",e[e.LtUVecI32x4=_BinaryenLtUVecI32x4()]="LtUVecI32x4",e[e.LeSVecI32x4=_BinaryenLeSVecI32x4()]="LeSVecI32x4",e[e.LeUVecI32x4=_BinaryenLeUVecI32x4()]="LeUVecI32x4",e[e.GtSVecI32x4=_BinaryenGtSVecI32x4()]="GtSVecI32x4",e[e.GtUVecI32x4=_BinaryenGtUVecI32x4()]="GtUVecI32x4",e[e.GeSVecI32x4=_BinaryenGeSVecI32x4()]="GeSVecI32x4",e[e.GeUVecI32x4=_BinaryenGeUVecI32x4()]="GeUVecI32x4",e[e.EqVecF32x4=_BinaryenEqVecF32x4()]="EqVecF32x4",e[e.NeVecF32x4=_BinaryenNeVecF32x4()]="NeVecF32x4",e[e.LtVecF32x4=_BinaryenLtVecF32x4()]="LtVecF32x4",e[e.LeVecF32x4=_BinaryenLeVecF32x4()]="LeVecF32x4",e[e.GtVecF32x4=_BinaryenGtVecF32x4()]="GtVecF32x4",e[e.GeVecF32x4=_BinaryenGeVecF32x4()]="GeVecF32x4",e[e.EqVecF64x2=_BinaryenEqVecF64x2()]="EqVecF64x2",e[e.NeVecF64x2=_BinaryenNeVecF64x2()]="NeVecF64x2",e[e.LtVecF64x2=_BinaryenLtVecF64x2()]="LtVecF64x2",e[e.LeVecF64x2=_BinaryenLeVecF64x2()]="LeVecF64x2",e[e.GtVecF64x2=_BinaryenGtVecF64x2()]="GtVecF64x2",e[e.GeVecF64x2=_BinaryenGeVecF64x2()]="GeVecF64x2",e[e.AndVec128=_BinaryenAndVec128()]="AndVec128",e[e.OrVec128=_BinaryenOrVec128()]="OrVec128",e[e.XorVec128=_BinaryenXorVec128()]="XorVec128",e[e.AddVecI8x16=_BinaryenAddVecI8x16()]="AddVecI8x16",e[e.AddSatSVecI8x16=_BinaryenAddSatSVecI8x16()]="AddSatSVecI8x16",e[e.AddSatUVecI8x16=_BinaryenAddSatUVecI8x16()]="AddSatUVecI8x16",e[e.SubVecI8x16=_BinaryenSubVecI8x16()]="SubVecI8x16",e[e.SubSatSVecI8x16=_BinaryenSubSatSVecI8x16()]="SubSatSVecI8x16",e[e.SubSatUVecI8x16=_BinaryenSubSatUVecI8x16()]="SubSatUVecI8x16",e[e.MulVecI8x16=_BinaryenMulVecI8x16()]="MulVecI8x16",e[e.AddVecI16x8=_BinaryenAddVecI16x8()]="AddVecI16x8",e[e.AddSatSVecI16x8=_BinaryenAddSatSVecI16x8()]="AddSatSVecI16x8",e[e.AddSatUVecI16x8=_BinaryenAddSatUVecI16x8()]="AddSatUVecI16x8",e[e.SubVecI16x8=_BinaryenSubVecI16x8()]="SubVecI16x8",e[e.SubSatSVecI16x8=_BinaryenSubSatSVecI16x8()]="SubSatSVecI16x8",e[e.SubSatUVecI16x8=_BinaryenSubSatUVecI16x8()]="SubSatUVecI16x8",e[e.MulVecI16x8=_BinaryenMulVecI16x8()]="MulVecI16x8",e[e.AddVecI32x4=_BinaryenAddVecI32x4()]="AddVecI32x4",e[e.SubVecI32x4=_BinaryenSubVecI32x4()]="SubVecI32x4",e[e.MulVecI32x4=_BinaryenMulVecI32x4()]="MulVecI32x4",e[e.AddVecI64x2=_BinaryenAddVecI64x2()]="AddVecI64x2",e[e.SubVecI64x2=_BinaryenSubVecI64x2()]="SubVecI64x2",e[e.AddVecF32x4=_BinaryenAddVecF32x4()]="AddVecF32x4",e[e.SubVecF32x4=_BinaryenSubVecF32x4()]="SubVecF32x4",e[e.MulVecF32x4=_BinaryenMulVecF32x4()]="MulVecF32x4",e[e.DivVecF32x4=_BinaryenDivVecF32x4()]="DivVecF32x4",e[e.MinVecF32x4=_BinaryenMinVecF32x4()]="MinVecF32x4",e[e.MaxVecF32x4=_BinaryenMaxVecF32x4()]="MaxVecF32x4",e[e.AddVecF64x2=_BinaryenAddVecF64x2()]="AddVecF64x2",e[e.SubVecF64x2=_BinaryenSubVecF64x2()]="SubVecF64x2",e[e.MulVecF64x2=_BinaryenMulVecF64x2()]="MulVecF64x2",e[e.DivVecF64x2=_BinaryenDivVecF64x2()]="DivVecF64x2",e[e.MinVecF64x2=_BinaryenMinVecF64x2()]="MinVecF64x2",e[e.MaxVecF64x2=_BinaryenMaxVecF64x2()]="MaxVecF64x2"}(r.BinaryOp||(r.BinaryOp={})),function(e){e[e.CurrentMemory=_BinaryenCurrentMemory()]="CurrentMemory",e[e.GrowMemory=_BinaryenGrowMemory()]="GrowMemory"}(r.HostOp||(r.HostOp={})),function(e){e[e.Add=_BinaryenAtomicRMWAdd()]="Add",e[e.Sub=_BinaryenAtomicRMWSub()]="Sub",e[e.And=_BinaryenAtomicRMWAnd()]="And",e[e.Or=_BinaryenAtomicRMWOr()]="Or",e[e.Xor=_BinaryenAtomicRMWXor()]="Xor",e[e.Xchg=_BinaryenAtomicRMWXchg()]="Xchg"}(r.AtomicRMWOp||(r.AtomicRMWOp={})),function(e){e[e.ExtractLaneSVecI8x16=_BinaryenExtractLaneSVecI8x16()]="ExtractLaneSVecI8x16",e[e.ExtractLaneUVecI8x16=_BinaryenExtractLaneUVecI8x16()]="ExtractLaneUVecI8x16",e[e.ExtractLaneSVecI16x8=_BinaryenExtractLaneSVecI16x8()]="ExtractLaneSVecI16x8",e[e.ExtractLaneUVecI16x8=_BinaryenExtractLaneUVecI16x8()]="ExtractLaneUVecI16x8",e[e.ExtractLaneVecI32x4=_BinaryenExtractLaneVecI32x4()]="ExtractLaneVecI32x4",e[e.ExtractLaneVecI64x2=_BinaryenExtractLaneVecI64x2()]="ExtractLaneVecI64x2",e[e.ExtractLaneVecF32x4=_BinaryenExtractLaneVecF32x4()]="ExtractLaneVecF32x4",e[e.ExtractLaneVecF64x2=_BinaryenExtractLaneVecF64x2()]="ExtractLaneVecF64x2"}(r.SIMDExtractOp||(r.SIMDExtractOp={})),function(e){e[e.ReplaceLaneVecI8x16=_BinaryenReplaceLaneVecI8x16()]="ReplaceLaneVecI8x16",e[e.ReplaceLaneVecI16x8=_BinaryenReplaceLaneVecI16x8()]="ReplaceLaneVecI16x8",e[e.ReplaceLaneVecI32x4=_BinaryenReplaceLaneVecI32x4()]="ReplaceLaneVecI32x4",e[e.ReplaceLaneVecI64x2=_BinaryenReplaceLaneVecI64x2()]="ReplaceLaneVecI64x2",e[e.ReplaceLaneVecF32x4=_BinaryenReplaceLaneVecF32x4()]="ReplaceLaneVecF32x4",e[e.ReplaceLaneVecF64x2=_BinaryenReplaceLaneVecF64x2()]="ReplaceLaneVecF64x2"}(r.SIMDReplaceOp||(r.SIMDReplaceOp={})),function(e){e[e.ShlVecI8x16=_BinaryenShlVecI8x16()]="ShlVecI8x16",e[e.ShrSVecI8x16=_BinaryenShrSVecI8x16()]="ShrSVecI8x16",e[e.ShrUVecI8x16=_BinaryenShrUVecI8x16()]="ShrUVecI8x16",e[e.ShlVecI16x8=_BinaryenShlVecI16x8()]="ShlVecI16x8",e[e.ShrSVecI16x8=_BinaryenShrSVecI16x8()]="ShrSVecI16x8",e[e.ShrUVecI16x8=_BinaryenShrUVecI16x8()]="ShrUVecI16x8",e[e.ShlVecI32x4=_BinaryenShlVecI32x4()]="ShlVecI32x4",e[e.ShrSVecI32x4=_BinaryenShrSVecI32x4()]="ShrSVecI32x4",e[e.ShrUVecI32x4=_BinaryenShrUVecI32x4()]="ShrUVecI32x4",e[e.ShlVecI64x2=_BinaryenShlVecI64x2()]="ShlVecI64x2",e[e.ShrSVecI64x2=_BinaryenShrSVecI64x2()]="ShrSVecI64x2",e[e.ShrUVecI64x2=_BinaryenShrUVecI64x2()]="ShrUVecI64x2"}(r.SIMDShiftOp||(r.SIMDShiftOp={}));var o=function(){function e(){}return e.create=function(r,t){var n=new e;return n.buffer=r,n.offset=t,n},e}();r.MemorySegment=o;var c=function(){function e(){this.hasTemporaryFunction=!1,this.cachedPrecomputeNames=0,this.cachedStrings=new Map}return e.create=function(){var r=new e;return r.ref=_BinaryenModuleCreate(),r.lit=memory.allocate(_BinaryenSizeofLiteral()),r},e.createFrom=function(r){var t=p(r);try{var n=new e;return n.ref=_BinaryenModuleRead(t,r.length),n.lit=memory.allocate(_BinaryenSizeofLiteral()),n}finally{memory.free(changetype(t))}},e.prototype.addFunctionType=function(e,r,t){var n=this.allocStringCached(e),i=u(t);try{return _BinaryenAddFunctionType(this.ref,n,r,i,t?t.length:0)}finally{memory.free(i)}},e.prototype.getFunctionTypeBySignature=function(e,r){var t=u(r);try{return _BinaryenGetFunctionTypeBySignature(this.ref,e,t,r?r.length:0)}finally{memory.free(t)}},e.prototype.removeFunctionType=function(e){var r=this.allocStringCached(e);_BinaryenRemoveFunctionType(this.ref,r)},e.prototype.createI32=function(e){var r=this.lit;return _BinaryenLiteralInt32(r,e),_BinaryenConst(this.ref,r)},e.prototype.createI64=function(e,r){void 0===r&&(r=0);var t=this.lit;return _BinaryenLiteralInt64(t,e,r),_BinaryenConst(this.ref,t)},e.prototype.createF32=function(e){var r=this.lit;return _BinaryenLiteralFloat32(r,e),_BinaryenConst(this.ref,r)},e.prototype.createF64=function(e){var r=this.lit;return _BinaryenLiteralFloat64(r,e),_BinaryenConst(this.ref,r)},e.prototype.createV128=function(e){assert(16==e.length);for(var r=this.lit,t=0;t<16;++t)store(r+t,e[t]);return _BinaryenLiteralVec128(r,r),_BinaryenConst(this.ref,r)},e.prototype.createUnary=function(e,r){return _BinaryenUnary(this.ref,e,r)},e.prototype.createBinary=function(e,r,t){return _BinaryenBinary(this.ref,e,r,t)},e.prototype.createHost=function(e,r,t){void 0===r&&(r=null),void 0===t&&(t=null);var n=this.allocStringCached(r),i=_(t);try{return _BinaryenHost(this.ref,e,n,i,t?t.length:0)}finally{memory.free(i)}},e.prototype.createGetLocal=function(e,r){return _BinaryenGetLocal(this.ref,e,r)},e.prototype.createTeeLocal=function(e,r){return _BinaryenTeeLocal(this.ref,e,r)},e.prototype.createGetGlobal=function(e,r){var t=this.allocStringCached(e);return _BinaryenGetGlobal(this.ref,t,r)},e.prototype.createLoad=function(e,r,t,n,i,a){return void 0===i&&(i=0),void 0===a&&(a=e),_BinaryenLoad(this.ref,e,r?1:0,i,a,n,t)},e.prototype.createStore=function(e,r,t,n,i,a){return void 0===i&&(i=0),void 0===a&&(a=e),_BinaryenStore(this.ref,e,i,a,r,t,n)},e.prototype.createAtomicLoad=function(e,r,t,n){return void 0===n&&(n=0),_BinaryenAtomicLoad(this.ref,e,n,t,r)},e.prototype.createAtomicStore=function(e,r,t,n,i){return void 0===i&&(i=0),_BinaryenAtomicStore(this.ref,e,i,r,t,n)},e.prototype.createAtomicRMW=function(e,r,t,n,i,a){return _BinaryenAtomicRMW(this.ref,e,r,t,n,i,a)},e.prototype.createAtomicCmpxchg=function(e,r,t,n,i,a){return _BinaryenAtomicCmpxchg(this.ref,e,r,t,n,i,a)},e.prototype.createAtomicWait=function(e,r,t,n){return _BinaryenAtomicWait(this.ref,e,r,t,n)},e.prototype.createAtomicWake=function(e,r){return _BinaryenAtomicWake(this.ref,e,r)},e.prototype.createSetLocal=function(e,r){return _BinaryenSetLocal(this.ref,e,r)},e.prototype.createSetGlobal=function(e,r){var t=this.allocStringCached(e);return _BinaryenSetGlobal(this.ref,t,r)},e.prototype.createBlock=function(e,r,t){void 0===t&&(t=i.None);var n=this.allocStringCached(e),a=_(r);try{return _BinaryenBlock(this.ref,n,a,r.length,t)}finally{memory.free(a)}},e.prototype.createBreak=function(e,r,t){void 0===r&&(r=0),void 0===t&&(t=0);var n=this.allocStringCached(e);return _BinaryenBreak(this.ref,n,r,t)},e.prototype.createDrop=function(e){return _BinaryenDrop(this.ref,e)},e.prototype.createLoop=function(e,r){var t=this.allocStringCached(e);return _BinaryenLoop(this.ref,t,r)},e.prototype.createIf=function(e,r,t){return void 0===t&&(t=0),_BinaryenIf(this.ref,e,r,t)},e.prototype.createNop=function(){return _BinaryenNop(this.ref)},e.prototype.createReturn=function(e){return void 0===e&&(e=0),_BinaryenReturn(this.ref,e)},e.prototype.createSelect=function(e,r,t){return _BinaryenSelect(this.ref,t,e,r)},e.prototype.createSwitch=function(e,r,t,n){void 0===n&&(n=0);for(var i=e.length,a=new Array(i),s=0;s<i;++s)a[s]=this.allocStringCached(e[s]);var o=u(a),c=this.allocStringCached(r);try{return _BinaryenSwitch(this.ref,o,i,c,t,n)}finally{memory.free(o)}},e.prototype.createCall=function(e,r,t){var n=this.allocStringCached(e),i=_(r);try{return _BinaryenCall(this.ref,n,i,r&&r.length||0,t)}finally{memory.free(i)}},e.prototype.createCallIndirect=function(e,r,t){var n=this.allocStringCached(t),i=_(r);try{return _BinaryenCallIndirect(this.ref,e,i,r&&r.length||0,n)}finally{memory.free(i)}},e.prototype.createUnreachable=function(){return _BinaryenUnreachable(this.ref)},e.prototype.createMemoryCopy=function(e,r,t){return _BinaryenMemoryCopy(this.ref,e,r,t)},e.prototype.createMemoryFill=function(e,r,t){return _BinaryenMemoryFill(this.ref,e,r,t)},e.prototype.createSIMDExtract=function(e,r,t){return _BinaryenSIMDExtract(this.ref,e,r,t)},e.prototype.createSIMDReplace=function(e,r,t,n){return _BinaryenSIMDReplace(this.ref,e,r,t,n)},e.prototype.createSIMDShuffle=function(e,r,t){assert(16==t.length);var n=p(t);try{return _BinaryenSIMDShuffle(this.ref,e,r,n)}finally{memory.free(n)}},e.prototype.createSIMDBitselect=function(e,r,t){return _BinaryenSIMDBitselect(this.ref,e,r,t)},e.prototype.createSIMDShift=function(e,r,t){return _BinaryenSIMDShift(this.ref,e,r,t)},e.prototype.addGlobal=function(e,r,t,n){var i=this.allocStringCached(e);return _BinaryenAddGlobal(this.ref,i,r,t?1:0,n)},e.prototype.removeGlobal=function(e){var r=this.allocStringCached(e);_BinaryenRemoveGlobal(this.ref,r)},e.prototype.addFunction=function(e,r,t,n){var i=this.allocStringCached(e),a=u(t);try{return _BinaryenAddFunction(this.ref,i,r,a,t?t.length:0,n)}finally{memory.free(a)}},e.prototype.removeFunction=function(e){var r=this.allocStringCached(e);_BinaryenRemoveFunction(this.ref,r)},e.prototype.addTemporaryFunction=function(e,r,t){this.hasTemporaryFunction=assert(!this.hasTemporaryFunction);var n=this.allocStringCached(""),i=u(r);try{var a=_BinaryenAddFunctionType(this.ref,n,e,i,r?r.length:0);return _BinaryenAddFunction(this.ref,n,a,0,0,t)}finally{memory.free(i)}},e.prototype.removeTemporaryFunction=function(){this.hasTemporaryFunction=!assert(this.hasTemporaryFunction);var e=this.allocStringCached("");_BinaryenRemoveFunction(this.ref,e),_BinaryenRemoveFunctionType(this.ref,e)},e.prototype.addFunctionExport=function(e,r){var t=this.allocStringCached(e),n=this.allocStringCached(r);return _BinaryenAddFunctionExport(this.ref,t,n)},e.prototype.addTableExport=function(e,r){var t=this.allocStringCached(e),n=this.allocStringCached(r);return _BinaryenAddTableExport(this.ref,t,n)},e.prototype.addMemoryExport=function(e,r){var t=this.allocStringCached(e),n=this.allocStringCached(r);return _BinaryenAddMemoryExport(this.ref,t,n)},e.prototype.addGlobalExport=function(e,r){var t=this.allocStringCached(e),n=this.allocStringCached(r);return _BinaryenAddGlobalExport(this.ref,t,n)},e.prototype.removeExport=function(e){var r=this.allocStringCached(e);_BinaryenRemoveExport(this.ref,r)},e.prototype.addFunctionImport=function(e,r,t,n){var i=this.allocStringCached(e),a=this.allocStringCached(r),s=this.allocStringCached(t);return _BinaryenAddFunctionImport(this.ref,i,a,s,n)},e.prototype.addTableImport=function(e,r,t){var n=this.allocStringCached(e),i=this.allocStringCached(r),a=this.allocStringCached(t);return _BinaryenAddTableImport(this.ref,n,i,a)},e.prototype.addMemoryImport=function(e,r,t,n){void 0===n&&(n=!1);var i=this.allocStringCached(e),a=this.allocStringCached(r),s=this.allocStringCached(t);return _BinaryenAddMemoryImport(this.ref,i,a,s,n)},e.prototype.addGlobalImport=function(e,r,t,n){var i=this.allocStringCached(e),a=this.allocStringCached(r),s=this.allocStringCached(t);return _BinaryenAddGlobalImport(this.ref,i,a,s,n)},e.prototype.setMemory=function(e,r,t,n,i,a){void 0===i&&(i=null),void 0===a&&(a=!1);for(var o=this.allocStringCached(i),c=t.length,l=new Array(c),_=new Array(c),h=new Array(c),d=0;d<c;++d){var y=t[d].buffer,m=t[d].offset;l[d]=p(y),_[d]=n==s.Target.WASM64?this.createI64(i64_low(m),i64_high(m)):this.createI32(i64_low(m)),h[d]=y.length}var T=u(l),f=u(_),E=u(h);try{_BinaryenSetMemory(this.ref,e,r,o,T,f,E,c,a)}finally{memory.free(E),memory.free(f),memory.free(T);for(d=c-1;d>=0;--d)memory.free(l[d])}},e.prototype.setFunctionTable=function(e,r,t){for(var n=t.length,i=new Array(n),a=0;a<n;++a)i[a]=this.allocStringCached(t[a]);var s=u(i);try{_BinaryenSetFunctionTable(this.ref,e,r,s,n)}finally{memory.free(s)}},e.prototype.setStart=function(e){_BinaryenSetStart(this.ref,e)},e.prototype.getOptimizeLevel=function(){return _BinaryenGetOptimizeLevel()},e.prototype.setOptimizeLevel=function(e){void 0===e&&(e=2),_BinaryenSetOptimizeLevel(e)},e.prototype.getShrinkLevel=function(){return _BinaryenGetShrinkLevel()},e.prototype.setShrinkLevel=function(e){void 0===e&&(e=1),_BinaryenSetShrinkLevel(e)},e.prototype.setDebugInfo=function(e){void 0===e&&(e=!1),_BinaryenSetDebugInfo(e)},e.prototype.optimize=function(e){void 0===e&&(e=0),e?_BinaryenFunctionOptimize(e,this.ref):_BinaryenModuleOptimize(this.ref)},e.prototype.runPasses=function(e,r){void 0===r&&(r=0);for(var t=e.length,n=new Array(t),i=0;i<t;++i)n[i]=h(e[i]);var a=u(n);try{r?_BinaryenFunctionRunPasses(r,this.ref,a,t):_BinaryenModuleRunPasses(this.ref,a,t)}finally{memory.free(a);for(i=t;i>=0;--i)memory.free(n[i])}},e.prototype.precomputeExpression=function(e){var r=_BinaryenGetOptimizeLevel(),t=_BinaryenGetShrinkLevel(),n=_BinaryenGetDebugInfo();_BinaryenSetOptimizeLevel(4),_BinaryenSetShrinkLevel(0),_BinaryenSetDebugInfo(!1);var i=_BinaryenExpressionGetType(e),a=this.addTemporaryFunction(i,null,e),s=this.cachedPrecomputeNames;return s||(this.cachedPrecomputeNames=s=u([this.allocStringCached("precompute")])),_BinaryenFunctionRunPasses(a,this.ref,s,1),e=_BinaryenFunctionGetBody(a),this.removeTemporaryFunction(),_BinaryenSetOptimizeLevel(r),_BinaryenSetShrinkLevel(t),_BinaryenSetDebugInfo(n),e},e.prototype.validate=function(){return 1==_BinaryenModuleValidate(this.ref)},e.prototype.interpret=function(){_BinaryenModuleInterpret(this.ref)},e.prototype.toBinary=function(e){var r=this.lit;assert(_BinaryenSizeofLiteral()>=12);var t=h(e),n=0,i=0;try{_BinaryenModuleAllocateAndWrite(r,this.ref,t),n=d(r);var a=d(r+4);i=d(r+8);var s=new m;return s.output=function(e,r){for(var t=new Uint8Array(r),n=0;n<r;++n)t[n]=load(e+n);return t}(n,a),s.sourceMap=y(i),s}finally{t&&memory.free(t),n&&memory.free(n),i&&memory.free(i)}},e.prototype.toText=function(){throw new Error("not implemented")},e.prototype.toAsmjs=function(){throw new Error("not implemented")},e.prototype.allocStringCached=function(e){if(null==e)return 0;var r=this.cachedStrings;if(r.has(e))return r.get(e);var t=h(e);return r.set(e,t),t},e.prototype.dispose=function(){var e,r;assert(this.ref);try{for(var t=n(this.cachedStrings.values()),i=t.next();!i.done;i=t.next()){var a=i.value;memory.free(a)}}catch(r){e={error:r}}finally{try{i&&!i.done&&(r=t.return)&&r.call(t)}finally{if(e)throw e.error}}this.cachedStrings=new Map,memory.free(this.lit),memory.free(this.cachedPrecomputeNames),this.cachedPrecomputeNames=0,_BinaryenModuleDispose(this.ref),this.ref=0},e.prototype.createRelooper=function(){return l.create(this)},e.prototype.cloneExpression=function(e,r,t){if(void 0===r&&(r=!1),void 0===t&&(t=i32.MAX_VALUE),t<0)return 0;var n,s;switch(t-=1,_BinaryenExpressionGetId(e)){case a.Const:switch(_BinaryenExpressionGetType(e)){case i.I32:return this.createI32(_BinaryenConstGetValueI32(e));case i.I64:return this.createI64(_BinaryenConstGetValueI64Low(e),_BinaryenConstGetValueI64High(e));case i.F32:return this.createF32(_BinaryenConstGetValueF32(e));case i.F64:return this.createF64(_BinaryenConstGetValueF64(e));case i.V128:return 0;default:throw new Error("concrete type expected")}case a.GetLocal:return _BinaryenGetLocal(this.ref,_BinaryenGetLocalGetIndex(e),_BinaryenExpressionGetType(e));case a.GetGlobal:var o=_BinaryenGetGlobalGetName(e);if(!o)break;return _BinaryenGetGlobal(this.ref,o,_BinaryenExpressionGetType(e));case a.Load:if(!(n=this.cloneExpression(_BinaryenLoadGetPtr(e),r,t)))break;return _BinaryenLoadIsAtomic(e)?_BinaryenAtomicLoad(this.ref,_BinaryenLoadGetBytes(e),_BinaryenLoadGetOffset(e),_BinaryenExpressionGetType(e),n):_BinaryenLoad(this.ref,_BinaryenLoadGetBytes(e),_BinaryenLoadIsSigned(e)?1:0,_BinaryenLoadGetOffset(e),_BinaryenLoadGetAlign(e),_BinaryenExpressionGetType(e),n);case a.Unary:if(!(n=this.cloneExpression(_BinaryenUnaryGetValue(e),r,t)))break;return _BinaryenUnary(this.ref,_BinaryenUnaryGetOp(e),n);case a.Binary:if(!(n=this.cloneExpression(_BinaryenBinaryGetLeft(e),r,t)))break;if(!(s=this.cloneExpression(_BinaryenBinaryGetRight(e),r,t)))break;return _BinaryenBinary(this.ref,_BinaryenBinaryGetOp(e),n,s)}return 0},e.prototype.addDebugInfoFile=function(e){var r=h(e);try{return _BinaryenModuleAddDebugInfoFileName(this.ref,r)}finally{memory.free(r)}},e.prototype.getDebugInfoFile=function(e){return y(_BinaryenModuleGetDebugInfoFileName(this.ref,e))},e.prototype.setDebugLocation=function(e,r,t,n,i){_BinaryenFunctionSetDebugLocation(e,r,t,n,i)},e.UNLIMITED_MEMORY=-1,e}();r.Module=c,r.getExpressionId=function(e){return _BinaryenExpressionGetId(e)},r.getExpressionType=function(e){return _BinaryenExpressionGetType(e)},r.getConstValueI32=function(e){return _BinaryenConstGetValueI32(e)},r.getConstValueI64Low=function(e){return _BinaryenConstGetValueI64Low(e)},r.getConstValueI64High=function(e){return _BinaryenConstGetValueI64High(e)},r.getConstValueF32=function(e){return _BinaryenConstGetValueF32(e)},r.getConstValueF64=function(e){return _BinaryenConstGetValueF64(e)},r.getGetLocalIndex=function(e){return _BinaryenGetLocalGetIndex(e)},r.getSetLocalIndex=function(e){return _BinaryenSetLocalGetIndex(e)},r.getSetLocalValue=function(e){return _BinaryenSetLocalGetValue(e)},r.isTeeLocal=function(e){return _BinaryenSetLocalIsTee(e)},r.getGetGlobalName=function(e){return y(_BinaryenGetGlobalGetName(e))},r.getBinaryOp=function(e){return _BinaryenBinaryGetOp(e)},r.getBinaryLeft=function(e){return _BinaryenBinaryGetLeft(e)},r.getBinaryRight=function(e){return _BinaryenBinaryGetRight(e)},r.getUnaryOp=function(e){return _BinaryenUnaryGetOp(e)},r.getUnaryValue=function(e){return _BinaryenUnaryGetValue(e)},r.getLoadBytes=function(e){return _BinaryenLoadGetBytes(e)},r.getLoadOffset=function(e){return _BinaryenLoadGetOffset(e)},r.getLoadPtr=function(e){return _BinaryenLoadGetPtr(e)},r.isLoadSigned=function(e){return _BinaryenLoadIsSigned(e)},r.getStoreBytes=function(e){return _BinaryenStoreGetBytes(e)},r.getStoreOffset=function(e){return _BinaryenStoreGetOffset(e)},r.getStorePtr=function(e){return _BinaryenStoreGetPtr(e)},r.getStoreValue=function(e){return _BinaryenStoreGetValue(e)},r.getBlockName=function(e){return y(_BinaryenBlockGetName(e))},r.getBlockChildCount=function(e){return _BinaryenBlockGetNumChildren(e)},r.getBlockChild=function(e,r){return _BinaryenBlockGetChild(e,r)},r.getIfCondition=function(e){return _BinaryenIfGetCondition(e)},r.getIfTrue=function(e){return _BinaryenIfGetIfTrue(e)},r.getIfFalse=function(e){return _BinaryenIfGetIfFalse(e)},r.getLoopName=function(e){return y(_BinaryenLoopGetName(e))},r.getLoopBody=function(e){return _BinaryenLoopGetBody(e)},r.getBreakName=function(e){return y(_BinaryenBreakGetName(e))},r.getBreakCondition=function(e){return _BinaryenBreakGetCondition(e)},r.getSelectThen=function(e){return _BinaryenSelectGetIfTrue(e)},r.getSelectElse=function(e){return _BinaryenSelectGetIfFalse(e)},r.getSelectCondition=function(e){return _BinaryenSelectGetCondition(e)},r.getDropValue=function(e){return _BinaryenDropGetValue(e)},r.getReturnValue=function(e){return _BinaryenReturnGetValue(e)},r.getCallTarget=function(e){return y(_BinaryenCallGetTarget(e))},r.getHostOp=function(e){return _BinaryenHostGetOp(e)},r.getHostOperandCount=function(e){return _BinaryenHostGetNumOperands(e)},r.getHostOperand=function(e,r){return _BinaryenHostGetOperand(e,r)},r.getHostName=function(e){return y(_BinaryenHostGetNameOperand(e))},r.getFunctionBody=function(e){return _BinaryenFunctionGetBody(e)},r.getFunctionName=function(e){return y(_BinaryenFunctionGetName(e))},r.getFunctionParamCount=function(e){return _BinaryenFunctionGetNumParams(e)},r.getFunctionParamType=function(e,r){return _BinaryenFunctionGetParam(e,r)},r.getFunctionResultType=function(e){return _BinaryenFunctionGetResult(e)};var l=function(){function e(){}return e.create=function(r){var t=new e;return t.module=r,t.ref=_RelooperCreate(r.ref),t},e.prototype.addBlock=function(e){return _RelooperAddBlock(this.ref,e)},e.prototype.addBranch=function(e,r,t,n){void 0===t&&(t=0),void 0===n&&(n=0),_RelooperAddBranch(e,r,t,n)},e.prototype.addBlockWithSwitch=function(e,r){return _RelooperAddBlockWithSwitch(this.ref,e,r)},e.prototype.addBranchForSwitch=function(e,r,t,n){void 0===n&&(n=0);var i=u(t);try{_RelooperAddBranchForSwitch(e,r,i,t.length,n)}finally{memory.free(i)}},e.prototype.renderAndDispose=function(e,r){return _RelooperRenderAndDispose(this.ref,e,r)},e}();function p(e){if(!e)return 0;for(var r=e.length,t=memory.allocate(r),n=t,i=0;i<r;++i)store(n++,e[i]);return t}function u(e){if(!e)return 0;for(var r=memory.allocate(e.length<<2),t=r,n=0,i=e.length;n<i;++n){var a=e[n];store(t,255&a),store(t+1,a>>8&255),store(t+2,a>>16&255),store(t+3,a>>>24),t+=4}return r}function _(e){return u(e)}function h(e){if(null==e)return 0;for(var r=memory.allocate(function(e){for(var r=0,t=0,n=e.length;t<n;++t){var i=e.charCodeAt(t);i>=55296&&i<=57343&&t+1<n&&(i=65536+((1023&i)<<10)|1023&e.charCodeAt(++t)),i<=127?++r:r+=i<=2047?2:i<=65535?3:i<=2097151?4:i<=67108863?5:6}return r}(e)+1),t=r,n=0,i=e.length;n<i;++n){var a=e.charCodeAt(n);a>=55296&&a<=57343&&n+1<i&&(a=65536+((1023&a)<<10)|1023&e.charCodeAt(++n)),a<=127?store(t++,a):a<=2047?(store(t++,192|a>>>6),store(t++,128|63&a)):a<=65535?(store(t++,224|a>>>12),store(t++,128|a>>>6&63),store(t++,128|63&a)):a<=2097151?(store(t++,240|a>>>18),store(t++,128|a>>>12&63),store(t++,128|a>>>6&63),store(t++,128|63&a)):a<=67108863?(store(t++,248|a>>>24),store(t++,128|a>>>18&63),store(t++,128|a>>>12&63),store(t++,128|a>>>6&63),store(t++,128|63&a)):(store(t++,252|a>>>30),store(t++,128|a>>>24&63),store(t++,128|a>>>18&63),store(t++,128|a>>>12&63),store(t++,128|a>>>6&63),store(t++,128|63&a))}return store(t,0),r}function d(e){return load(e)|load(e+1)<<8|load(e+2)<<16|load(e+3)<<24}function y(e){if(!e)return null;for(var r,t,n,i,a,s=new Array;r=load(e++);)128&r?(t=63&load(e++),192!=(224&r)?(n=63&load(e++),224==(240&r)?r=(15&r)<<12|t<<6|n:(i=63&load(e++),240==(248&r)?r=(7&r)<<18|t<<12|n<<6|i:(a=63&load(e++),r=248==(252&r)?(3&r)<<24|t<<18|n<<12|i<<6|a:(1&r)<<30|t<<24|n<<18|i<<12|a<<6|63&load(e++))),s.push(r)):s.push((31&r)<<6|t)):s.push(r);return String.fromCodePoints(s)}r.Relooper=l,r.readString=y;var m=function(){return function(){}}();r.BinaryModule=m,r.needsExplicitUnreachable=function e(r){switch(_BinaryenExpressionGetType(r)){case i.I32:case i.I64:case i.F32:case i.F64:case i.V128:return!1}switch(_BinaryenExpressionGetId(r)){case a.Unreachable:case a.Return:return!1;case a.Break:return 0!=_BinaryenBreakGetCondition(r);case a.Block:if(!_BinaryenBlockGetName(r)){var t=_BinaryenBlockGetNumChildren(r);return t>0&&e(_BinaryenBlockGetChild(r,t-1))}}return!0}},function(e,r,t){"use strict";var n,i=this&&this.__extends||(n=function(e,r){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)r.hasOwnProperty(t)&&(e[t]=r[t])})(e,r)},function(e,r){function t(){this.constructor=e}n(e,r),e.prototype=null===r?Object.create(r):(t.prototype=r.prototype,new t)});Object.defineProperty(r,"__esModule",{value:!0});var a=t(0),s=t(7);r.Token=s.Token,r.Range=s.Range;var o,c=t(1);!function(e){e[e.SOURCE=0]="SOURCE",e[e.TYPE=1]="TYPE",e[e.TYPENAME=2]="TYPENAME",e[e.TYPEPARAMETER=3]="TYPEPARAMETER",e[e.PARAMETER=4]="PARAMETER",e[e.SIGNATURE=5]="SIGNATURE",e[e.IDENTIFIER=6]="IDENTIFIER",e[e.ASSERTION=7]="ASSERTION",e[e.BINARY=8]="BINARY",e[e.CALL=9]="CALL",e[e.CLASS=10]="CLASS",e[e.COMMA=11]="COMMA",e[e.ELEMENTACCESS=12]="ELEMENTACCESS",e[e.FALSE=13]="FALSE",e[e.FUNCTION=14]="FUNCTION",e[e.INSTANCEOF=15]="INSTANCEOF",e[e.LITERAL=16]="LITERAL",e[e.NEW=17]="NEW",e[e.NULL=18]="NULL",e[e.PARENTHESIZED=19]="PARENTHESIZED",e[e.PROPERTYACCESS=20]="PROPERTYACCESS",e[e.TERNARY=21]="TERNARY",e[e.SUPER=22]="SUPER",e[e.THIS=23]="THIS",e[e.TRUE=24]="TRUE",e[e.CONSTRUCTOR=25]="CONSTRUCTOR",e[e.UNARYPOSTFIX=26]="UNARYPOSTFIX",e[e.UNARYPREFIX=27]="UNARYPREFIX",e[e.BLOCK=28]="BLOCK",e[e.BREAK=29]="BREAK",e[e.CONTINUE=30]="CONTINUE",e[e.DO=31]="DO",e[e.EMPTY=32]="EMPTY",e[e.EXPORT=33]="EXPORT",e[e.EXPORTIMPORT=34]="EXPORTIMPORT",e[e.EXPRESSION=35]="EXPRESSION",e[e.FOR=36]="FOR",e[e.IF=37]="IF",e[e.IMPORT=38]="IMPORT",e[e.RETURN=39]="RETURN",e[e.SWITCH=40]="SWITCH",e[e.THROW=41]="THROW",e[e.TRY=42]="TRY",e[e.VARIABLE=43]="VARIABLE",e[e.VOID=44]="VOID",e[e.WHILE=45]="WHILE",e[e.CLASSDECLARATION=46]="CLASSDECLARATION",e[e.ENUMDECLARATION=47]="ENUMDECLARATION",e[e.ENUMVALUEDECLARATION=48]="ENUMVALUEDECLARATION",e[e.FIELDDECLARATION=49]="FIELDDECLARATION",e[e.FUNCTIONDECLARATION=50]="FUNCTIONDECLARATION",e[e.IMPORTDECLARATION=51]="IMPORTDECLARATION",e[e.INDEXSIGNATUREDECLARATION=52]="INDEXSIGNATUREDECLARATION",e[e.INTERFACEDECLARATION=53]="INTERFACEDECLARATION",e[e.METHODDECLARATION=54]="METHODDECLARATION",e[e.NAMESPACEDECLARATION=55]="NAMESPACEDECLARATION",e[e.TYPEDECLARATION=56]="TYPEDECLARATION",e[e.VARIABLEDECLARATION=57]="VARIABLEDECLARATION",e[e.DECORATOR=58]="DECORATOR",e[e.EXPORTMEMBER=59]="EXPORTMEMBER",e[e.SWITCHCASE=60]="SWITCHCASE",e[e.COMMENT=61]="COMMENT"}(o=r.NodeKind||(r.NodeKind={})),r.nodeIsConstantValue=function(e){switch(e){case o.LITERAL:case o.NULL:case o.TRUE:case o.FALSE:return!0}return!1},r.nodeIsCallable=function(e){switch(e){case o.IDENTIFIER:case o.ASSERTION:case o.CALL:case o.ELEMENTACCESS:case o.PARENTHESIZED:case o.PROPERTYACCESS:case o.SUPER:return!0}return!1},r.nodeIsGenericCallable=function(e){switch(e){case o.IDENTIFIER:case o.PROPERTYACCESS:return!0}return!1};var l=function(){function e(){}return e.createTypeName=function(e,r){var t=new u;return t.range=r,t.identifier=e,t.next=null,t},e.createSimpleTypeName=function(r,t){return e.createTypeName(e.createIdentifierExpression(r,t),t)},e.createType=function(e,r,t,n){var i=new _;return i.range=n,i.name=e,i.typeArguments=r,i.isNullable=t,i},e.createOmittedType=function(r){return e.createType(e.createSimpleTypeName("",r),null,!1,r)},e.createTypeParameter=function(e,r,t,n){var i=new h;return i.range=n,i.name=e,i.extendsType=r,i.defaultType=t,i},e.createParameter=function(e,r,t,n,i){var a=new d;return a.range=i,a.name=e,a.type=r,a.initializer=t,a.parameterKind=n,a},e.createSignature=function(e,r,t,n,i){var a=new m;return a.range=i,a.parameters=e,a.returnType=r,a.explicitThisType=t,a.isNullable=n,a},e.createDecorator=function(e,r,t){var n=new f;return n.range=t,n.name=e,n.arguments=r,n.decoratorKind=T(e),n},e.createComment=function(e,r,t){var n=new E;return n.range=t,n.commentKind=r,n.text=e,n},e.createIdentifierExpression=function(e,r,t){void 0===t&&(t=!1);var n=new I;return n.range=r,n.text=e,n.symbol=e,n.isQuoted=t,n},e.createEmptyIdentifierExpression=function(e){var r=new I;return r.range=e,r.text="",r},e.createArrayLiteralExpression=function(e,r){var t=new x;return t.range=r,t.elementExpressions=e,t},e.createAssertionExpression=function(e,r,t,n){var i=new S;return i.range=n,i.assertionKind=e,i.expression=r,i.toType=t,i},e.createBinaryExpression=function(e,r,t,n){var i=new A;return i.range=n,i.operator=e,i.left=r,i.right=t,i},e.createCallExpression=function(e,r,t,n){var i=new N;return i.range=n,i.expression=e,i.typeArguments=r,i.arguments=t,i},e.createClassExpression=function(e){var r=new O;return r.range=e.range,r.declaration=e,r},e.createCommaExpression=function(e,r){var t=new C;return t.range=r,t.expressions=e,t},e.createConstructorExpression=function(e){var r=new k;return r.range=e,r},e.createElementAccessExpression=function(e,r,t){var n=new R;return n.range=t,n.expression=e,n.elementExpression=r,n},e.createFalseExpression=function(e){var r=new X;return r.range=e,r},e.createFloatLiteralExpression=function(e,r){var t=new L;return t.range=r,t.value=e,t},e.createFunctionExpression=function(e){var r=new F;return r.range=e.range,r.declaration=e,r},e.createInstanceOfExpression=function(e,r,t){var n=new B;return n.range=t,n.expression=e,n.isType=r,n},e.createIntegerLiteralExpression=function(e,r){var t=new U;return t.range=r,t.value=e,t},e.createNewExpression=function(e,r,t,n){var i=new D;return i.range=n,i.expression=e,i.typeArguments=r,i.arguments=t,i},e.createNullExpression=function(e){var r=new w;return r.range=e,r},e.createObjectLiteralExpression=function(e,r,t){var n=new P;return n.range=t,n.names=e,n.values=r,n},e.createParenthesizedExpression=function(e,r){var t=new M;return t.range=r,t.expression=e,t},e.createPropertyAccessExpression=function(e,r,t){var n=new V;return n.range=t,n.expression=e,n.property=r,n},e.createRegexpLiteralExpression=function(e,r,t){var n=new G;return n.range=t,n.pattern=e,n.patternFlags=r,n},e.createTernaryExpression=function(e,r,t,n){var i=new K;return i.range=n,i.condition=e,i.ifThen=r,i.ifElse=t,i},e.createStringLiteralExpression=function(e,r){var t=new z;return t.range=r,t.value=e,t},e.createSuperExpression=function(e){var r=new H;return r.range=e,r},e.createThisExpression=function(e){var r=new Y;return r.range=e,r},e.createTrueExpression=function(e){var r=new W;return r.range=e,r},e.createUnaryPostfixExpression=function(e,r,t){var n=new Q;return n.range=t,n.operator=e,n.operand=r,n},e.createUnaryPrefixExpression=function(e,r,t){var n=new j;return n.range=t,n.operator=e,n.operand=r,n},e.createBlockStatement=function(e,r){var t=new ne;return t.range=r,t.statements=e,t},e.createBreakStatement=function(e,r){var t=new ie;return t.range=r,t.label=e,t},e.createClassDeclaration=function(e,r,t,n,i,a,s,o){var c=new ae;return c.range=o,c.flags=s,c.name=e,c.typeParameters=r,c.extendsType=t,c.implementsTypes=n,c.members=i,c.decorators=a,c},e.createContinueStatement=function(e,r){var t=new se;return t.range=r,t.label=e,t},e.createDoStatement=function(e,r,t){var n=new oe;return n.range=t,n.statement=e,n.condition=r,n},e.createEmptyStatement=function(e){var r=new ce;return r.range=e,r},e.createEnumDeclaration=function(e,r,t,n,i){var a=new le;return a.range=i,a.flags=n,a.name=e,a.values=r,a.decorators=t,a},e.createEnumValueDeclaration=function(e,r,t,n){var i=new pe;return i.range=n,i.flags=t,i.name=e,i.value=r,i},e.createExportStatement=function(e,r,t,n){var i=new he;if(i.range=n,i.members=e,i.path=r,r){var a=c.normalizePath(r.value);r.value.startsWith(".")?i.normalizedPath=c.resolvePath(a,n.source.normalizedPath):i.normalizedPath=a,i.internalPath=Be(i.normalizedPath)}else i.normalizedPath=null,i.internalPath=null;return i.isDeclare=t,i},e.createExportImportStatement=function(e,r,t){var n=new ue;return n.range=t,n.name=e,n.externalName=r,n},e.createExportMember=function(e,r,t){var n=new _e;return n.range=t,n.localName=e,r||(r=e),n.exportedName=r,n},e.createExpressionStatement=function(e){var r=new de;return r.range=e.range,r.expression=e,r},e.createIfStatement=function(e,r,t,n){var i=new fe;return i.range=n,i.condition=e,i.ifTrue=r,i.ifFalse=t,i},e.createImportStatement=function(e,r,t){var n=new ge;n.range=t,n.declarations=e,n.namespaceName=null,n.path=r;var i=c.normalizePath(r.value);return r.value.startsWith(".")?n.normalizedPath=c.resolvePath(i,t.source.normalizedPath):(i.startsWith(a.LIBRARY_PREFIX)||(i=a.LIBRARY_PREFIX+i),n.normalizedPath=i),n.internalPath=Be(n.normalizedPath),n},e.createImportStatementWithWildcard=function(e,r,t){var n=new ge;return n.range=t,n.declarations=null,n.namespaceName=e,n.path=r,n.normalizedPath=c.resolvePath(c.normalizePath(r.value),t.source.normalizedPath),n.internalPath=Be(n.normalizedPath),n},e.createImportDeclaration=function(e,r,t){var n=new Ee;return n.range=t,n.foreignName=e,r||(r=e),n.name=r,n},e.createInterfaceDeclaration=function(e,r,t,n,i,a,s){var o=new ve;return o.range=s,o.flags=a,o.name=e,o.typeParameters=r,o.extendsType=t,o.members=n,o.decorators=i,o},e.createFieldDeclaration=function(e,r,t,n,i,a){var s=new ye;return s.range=a,s.flags=i,s.name=e,s.type=r,s.initializer=t,s.decorators=n,s},e.createForStatement=function(e,r,t,n,i){var a=new me;return a.range=i,a.initializer=e,a.condition=r,a.incrementor=t,a.statement=n,a},e.createFunctionDeclaration=function(e,r,t,n,i,a,s,o){var c=new Te;return c.range=o,c.flags=a,c.name=e,c.typeParameters=r,c.signature=t,c.body=n,c.decorators=i,c.arrowKind=s,c},e.createIndexSignatureDeclaration=function(e,r,t){var n=new re;return n.range=t,n.keyType=e,n.valueType=r,n},e.createMethodDeclaration=function(e,r,t,n,i,a,s){var o=new Ie;return o.range=s,o.flags=a,o.name=e,o.typeParameters=r,o.signature=t,o.body=n,o.decorators=i,o},e.createNamespaceDeclaration=function(e,r,t,n,i){var a=new be;return a.range=i,a.flags=n,a.name=e,a.members=r,a.decorators=t,a},e.createReturnStatement=function(e,r){var t=new xe;return t.range=r,t.value=e,t},e.createSwitchStatement=function(e,r,t){var n=new Ae;return n.range=t,n.condition=e,n.cases=r,n},e.createSwitchCase=function(e,r,t){var n=new Se;return n.range=t,n.label=e,n.statements=r,n},e.createThrowStatement=function(e,r){var t=new Ne;return t.range=r,t.value=e,t},e.createTryStatement=function(e,r,t,n,i){var a=new Oe;return a.range=i,a.statements=e,a.catchVariable=r,a.catchStatements=t,a.finallyStatements=n,a},e.createTypeDeclaration=function(e,r,t,n,i,a){var s=new Ce;return s.range=a,s.flags=i,s.name=e,s.typeParameters=r,s.type=t,s.decorators=n,s},e.createVariableStatement=function(e,r,t){var n=new Re;return n.range=t,n.declarations=e,n.decorators=r,n},e.createVariableDeclaration=function(e,r,t,n,i,a){var s=new ke;return s.range=a,s.flags=i,s.name=e,s.type=r,s.initializer=t,s.decorators=n,s},e.createVoidStatement=function(e,r){var t=new Le;return t.range=r,t.expression=e,t},e.createWhileStatement=function(e,r,t){var n=new Fe;return n.range=t,n.condition=e,n.statement=r,n},e}();r.Node=l;var p=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return i(r,e),r}(l);r.CommonTypeNode=p;var u=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.TYPENAME,r}return i(r,e),r}(l);r.TypeName=u;var _=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.TYPE,r}return i(r,e),r}(p);r.TypeNode=_;var h=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.TYPEPARAMETER,r}return i(r,e),r}(l);r.TypeParameterNode=h,function(e){e[e.DEFAULT=0]="DEFAULT",e[e.OPTIONAL=1]="OPTIONAL",e[e.REST=2]="REST"}(r.ParameterKind||(r.ParameterKind={}));var d=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.PARAMETER,r.implicitFieldDeclaration=null,r.flags=a.CommonFlags.NONE,r}return i(r,e),r.prototype.is=function(e){return(this.flags&e)==e},r.prototype.isAny=function(e){return 0!=(this.flags&e)},r.prototype.set=function(e){this.flags|=e},r}(l);r.ParameterNode=d;var y,m=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.SIGNATURE,r}return i(r,e),r}(p);function T(e){if(e.kind==o.IDENTIFIER){var r=e.text;switch(assert(r.length),r.charCodeAt(0)){case 98:if("builtin"==r)return y.BUILTIN;break;case 101:if("external"==r)return y.EXTERNAL;break;case 103:if("global"==r)return y.GLOBAL;break;case 105:if("inline"==r)return y.INLINE;break;case 108:if("lazy"==r)return y.LAZY;break;case 111:if("operator"==r)return y.OPERATOR;break;case 115:if("sealed"==r)return y.SEALED;if("start"==r)return y.START;break;case 117:if("unmanaged"==r)return y.UNMANAGED}}else if(e.kind==o.PROPERTYACCESS&&e.expression.kind==o.IDENTIFIER){r=e.expression.text;assert(r.length);var t=e.property.text;if(assert(t.length),"operator"==r)switch(t.charCodeAt(0)){case 98:if("binary"==t)return y.OPERATOR_BINARY;break;case 112:switch(t){case"prefix":return y.OPERATOR_PREFIX;case"postfix":return y.OPERATOR_POSTFIX}}}return y.CUSTOM}r.SignatureNode=m,function(e){e[e.CUSTOM=0]="CUSTOM",e[e.GLOBAL=1]="GLOBAL",e[e.OPERATOR=2]="OPERATOR",e[e.OPERATOR_BINARY=3]="OPERATOR_BINARY",e[e.OPERATOR_PREFIX=4]="OPERATOR_PREFIX",e[e.OPERATOR_POSTFIX=5]="OPERATOR_POSTFIX",e[e.UNMANAGED=6]="UNMANAGED",e[e.SEALED=7]="SEALED",e[e.INLINE=8]="INLINE",e[e.EXTERNAL=9]="EXTERNAL",e[e.BUILTIN=10]="BUILTIN",e[e.LAZY=11]="LAZY",e[e.START=12]="START"}(y=r.DecoratorKind||(r.DecoratorKind={})),r.decoratorNameToKind=T;var f=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.DECORATOR,r}return i(r,e),r}(l);r.DecoratorNode=f,function(e){e[e.LINE=0]="LINE",e[e.TRIPLE=1]="TRIPLE",e[e.BLOCK=2]="BLOCK"}(r.CommentKind||(r.CommentKind={}));var E=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.COMMENT,r}return i(r,e),r}(l);r.CommentNode=E;var g=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return i(r,e),r}(l);r.Expression=g;var v,I=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.IDENTIFIER,r}return i(r,e),r}(g);r.IdentifierExpression=I,function(e){e[e.FLOAT=0]="FLOAT",e[e.INTEGER=1]="INTEGER",e[e.STRING=2]="STRING",e[e.REGEXP=3]="REGEXP",e[e.ARRAY=4]="ARRAY",e[e.OBJECT=5]="OBJECT"}(v=r.LiteralKind||(r.LiteralKind={}));var b=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.LITERAL,r}return i(r,e),r}(g);r.LiteralExpression=b;var x=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.literalKind=v.ARRAY,r}return i(r,e),r}(b);r.ArrayLiteralExpression=x,function(e){e[e.PREFIX=0]="PREFIX",e[e.AS=1]="AS",e[e.NONNULL=2]="NONNULL"}(r.AssertionKind||(r.AssertionKind={}));var S=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.ASSERTION,r}return i(r,e),r}(g);r.AssertionExpression=S;var A=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.BINARY,r}return i(r,e),r}(g);r.BinaryExpression=A;var N=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.CALL,r}return i(r,e),Object.defineProperty(r.prototype,"typeArgumentsRange",{get:function(){var e,r=this.typeArguments;return r&&(e=r.length)?s.Range.join(r[0].range,r[e-1].range):this.expression.range},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"argumentsRange",{get:function(){var e=this.arguments,r=e.length;return r?s.Range.join(e[0].range,e[r-1].range):this.expression.range},enumerable:!0,configurable:!0}),r}(g);r.CallExpression=N;var O=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.CLASS,r}return i(r,e),r}(g);r.ClassExpression=O;var C=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.COMMA,r}return i(r,e),r}(g);r.CommaExpression=C;var k=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.CONSTRUCTOR,r.text="constructor",r.symbol=a.CommonSymbols.constructor,r}return i(r,e),r}(I);r.ConstructorExpression=k;var R=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.ELEMENTACCESS,r}return i(r,e),r}(g);r.ElementAccessExpression=R;var L=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.literalKind=v.FLOAT,r}return i(r,e),r}(b);r.FloatLiteralExpression=L;var F=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.FUNCTION,r}return i(r,e),r}(g);r.FunctionExpression=F;var B=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.INSTANCEOF,r}return i(r,e),r}(g);r.InstanceOfExpression=B;var U=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.literalKind=v.INTEGER,r}return i(r,e),r}(b);r.IntegerLiteralExpression=U;var D=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.NEW,r}return i(r,e),r}(N);r.NewExpression=D;var w=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.NULL,r.text="null",r.symbol=a.CommonSymbols.null_,r}return i(r,e),r}(I);r.NullExpression=w;var P=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.literalKind=v.OBJECT,r}return i(r,e),r}(b);r.ObjectLiteralExpression=P;var M=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.PARENTHESIZED,r}return i(r,e),r}(g);r.ParenthesizedExpression=M;var V=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.PROPERTYACCESS,r}return i(r,e),r}(g);r.PropertyAccessExpression=V;var G=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.literalKind=v.REGEXP,r}return i(r,e),r}(b);r.RegexpLiteralExpression=G;var K=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.TERNARY,r}return i(r,e),r}(g);r.TernaryExpression=K;var z=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.literalKind=v.STRING,r}return i(r,e),r}(b);r.StringLiteralExpression=z;var H=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.SUPER,r.text="super",r.symbol=a.CommonSymbols.super_,r}return i(r,e),r}(I);r.SuperExpression=H;var Y=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.THIS,r.text="this",r.symbol=a.CommonSymbols.this_,r}return i(r,e),r}(I);r.ThisExpression=Y;var W=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.TRUE,r.text="true",r.symbol=a.CommonSymbols.true_,r}return i(r,e),r}(I);r.TrueExpression=W;var X=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.FALSE,r.text="false",r.symbol=a.CommonSymbols.false_,r}return i(r,e),r}(I);r.FalseExpression=X;var q=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return i(r,e),r}(g);r.UnaryExpression=q;var Q=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.UNARYPOSTFIX,r}return i(r,e),r}(q);r.UnaryPostfixExpression=Q;var j=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.UNARYPREFIX,r}return i(r,e),r}(q);r.UnaryPrefixExpression=j;var Z,J=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return i(r,e),r}(l);r.Statement=J,function(e){e[e.DEFAULT=0]="DEFAULT",e[e.ENTRY=1]="ENTRY",e[e.LIBRARY=2]="LIBRARY"}(Z=r.SourceKind||(r.SourceKind={}));var $=function(e){function r(r,t,n){var i=e.call(this)||this;i.kind=o.SOURCE,i.parent=null,i.tokenizer=null,i.debugInfoIndex=-1,i.exportPaths=null,i.sourceKind=n,i.normalizedPath=r;var c=Be(i.normalizedPath);i.internalPath=c;var l=c.lastIndexOf(a.PATH_DELIMITER);return i.simplePath=l>=0?c.substring(l+1):c,i.statements=new Array,i.range=new s.Range(i,0,t.length),i.text=t,i}return i(r,e),Object.defineProperty(r.prototype,"isEntry",{get:function(){return this.sourceKind==Z.ENTRY},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"isLibrary",{get:function(){return this.sourceKind==Z.LIBRARY},enumerable:!0,configurable:!0}),r}(l);r.Source=$;var ee=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.decorators=null,r.flags=a.CommonFlags.NONE,r}return i(r,e),r.prototype.is=function(e){return(this.flags&e)==e},r.prototype.isAny=function(e){return 0!=(this.flags&e)},r.prototype.set=function(e){this.flags|=e},r}(J);r.DeclarationStatement=ee;var re=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.INDEXSIGNATUREDECLARATION,r}return i(r,e),r}(ee);r.IndexSignatureDeclaration=re;var te=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return i(r,e),r}(ee);r.VariableLikeDeclarationStatement=te;var ne=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.BLOCK,r}return i(r,e),r}(J);r.BlockStatement=ne;var ie=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.BREAK,r}return i(r,e),r}(J);r.BreakStatement=ie;var ae=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.CLASSDECLARATION,r}return i(r,e),Object.defineProperty(r.prototype,"isGeneric",{get:function(){var e=this.typeParameters;return null!=e&&e.length>0},enumerable:!0,configurable:!0}),r}(ee);r.ClassDeclaration=ae;var se=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.CONTINUE,r}return i(r,e),r}(J);r.ContinueStatement=se;var oe=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.DO,r}return i(r,e),r}(J);r.DoStatement=oe;var ce=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.EMPTY,r}return i(r,e),r}(J);r.EmptyStatement=ce;var le=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.ENUMDECLARATION,r}return i(r,e),r}(ee);r.EnumDeclaration=le;var pe=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.ENUMVALUEDECLARATION,r}return i(r,e),r}(te);r.EnumValueDeclaration=pe;var ue=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.EXPORTIMPORT,r}return i(r,e),r}(l);r.ExportImportStatement=ue;var _e=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.EXPORTMEMBER,r}return i(r,e),r}(l);r.ExportMember=_e;var he=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.EXPORT,r}return i(r,e),r}(J);r.ExportStatement=he;var de=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.EXPRESSION,r}return i(r,e),r}(J);r.ExpressionStatement=de;var ye=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.FIELDDECLARATION,r.parameterIndex=-1,r}return i(r,e),r}(te);r.FieldDeclaration=ye;var me=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.FOR,r}return i(r,e),r}(J);r.ForStatement=me,function(e){e[e.NONE=0]="NONE",e[e.ARROW_PARENTHESIZED=1]="ARROW_PARENTHESIZED",e[e.ARROW_SINGLE=2]="ARROW_SINGLE"}(r.ArrowKind||(r.ArrowKind={}));var Te=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.FUNCTIONDECLARATION,r}return i(r,e),Object.defineProperty(r.prototype,"isGeneric",{get:function(){var e=this.typeParameters;return null!=e&&e.length>0},enumerable:!0,configurable:!0}),r.prototype.clone=function(){return l.createFunctionDeclaration(this.name,this.typeParameters,this.signature,this.body,this.decorators,this.flags,this.arrowKind,this.range)},r}(ee);r.FunctionDeclaration=Te;var fe=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.IF,r}return i(r,e),r}(J);r.IfStatement=fe;var Ee=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.IMPORTDECLARATION,r}return i(r,e),r}(ee);r.ImportDeclaration=Ee;var ge=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.IMPORT,r}return i(r,e),r}(J);r.ImportStatement=ge;var ve=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.INTERFACEDECLARATION,r}return i(r,e),r}(ae);r.InterfaceDeclaration=ve;var Ie=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.METHODDECLARATION,r}return i(r,e),r}(Te);r.MethodDeclaration=Ie;var be=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.NAMESPACEDECLARATION,r}return i(r,e),r}(ee);r.NamespaceDeclaration=be;var xe=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.RETURN,r}return i(r,e),r}(J);r.ReturnStatement=xe;var Se=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.SWITCHCASE,r}return i(r,e),r}(l);r.SwitchCase=Se;var Ae=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.SWITCH,r}return i(r,e),r}(J);r.SwitchStatement=Ae;var Ne=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.THROW,r}return i(r,e),r}(J);r.ThrowStatement=Ne;var Oe=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.TRY,r}return i(r,e),r}(J);r.TryStatement=Oe;var Ce=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.TYPEDECLARATION,r}return i(r,e),r}(ee);r.TypeDeclaration=Ce;var ke=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.VARIABLEDECLARATION,r}return i(r,e),r}(te);r.VariableDeclaration=ke;var Re=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.VARIABLE,r}return i(r,e),r}(J);r.VariableStatement=Re;var Le=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.VOID,r}return i(r,e),r}(J);r.VoidStatement=Le;var Fe=function(e){function r(){var r=null!==e&&e.apply(this,arguments)||this;return r.kind=o.WHILE,r}return i(r,e),r}(J);function Be(e){return e.endsWith(".ts")&&(e=e.substring(0,e.length-3)),e}r.WhileStatement=Fe,r.findDecorator=function(e,r){if(r)for(var t=0,n=r.length;t<n;++t){var i=r[t];if(i.decoratorKind==e)return i}return null},r.mangleInternalPath=Be,r.isTypeOmitted=function(e){if(e.kind==o.TYPE){var r=e.name;return!(r.next||r.identifier.text.length)}return!1}},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t(3),i=t(4);!function(e){e[e.I8=0]="I8",e[e.I16=1]="I16",e[e.I32=2]="I32",e[e.I64=3]="I64",e[e.ISIZE=4]="ISIZE",e[e.U8=5]="U8",e[e.U16=6]="U16",e[e.U32=7]="U32",e[e.U64=8]="U64",e[e.USIZE=9]="USIZE",e[e.BOOL=10]="BOOL",e[e.F32=11]="F32",e[e.F64=12]="F64",e[e.V128=13]="V128",e[e.VOID=14]="VOID"}(r.TypeKind||(r.TypeKind={})),function(e){e[e.NONE=0]="NONE",e[e.SIGNED=1]="SIGNED",e[e.UNSIGNED=2]="UNSIGNED",e[e.INTEGER=4]="INTEGER",e[e.FLOAT=8]="FLOAT",e[e.POINTER=16]="POINTER",e[e.SHORT=32]="SHORT",e[e.LONG=64]="LONG",e[e.VALUE=128]="VALUE",e[e.REFERENCE=256]="REFERENCE",e[e.NULLABLE=512]="NULLABLE",e[e.VECTOR=1024]="VECTOR"}(r.TypeFlags||(r.TypeFlags={}));var a=new Uint8Array(16),s=function(){function e(e,r,t){this.cachedNullableType=null,this.kind=e,this.flags=r,this.size=t,this.byteSize=ceil(t/8),this.classReference=null,this.signatureReference=null,this.nonNullableType=this}return Object.defineProperty(e.prototype,"intType",{get:function(){switch(this.kind){case 0:return e.i8;case 1:return e.i16;case 11:case 2:return e.i32;case 12:case 3:return e.i64;case 4:return 64==this.size?e.isize64:e.isize32;case 5:return e.u8;case 6:return e.u16;case 7:return e.u32;case 8:return e.u64;case 9:return 64==this.size?e.usize64:e.usize32;case 10:default:return e.i32}},enumerable:!0,configurable:!0}),e.prototype.isManaged=function(e){if(e.hasGC){var r=this.classReference;return null!==r&&!r.hasDecorator(n.DecoratorFlags.UNMANAGED)}return!1},e.prototype.computeSmallIntegerShift=function(e){return e.size-this.size},e.prototype.computeSmallIntegerMask=function(e){var r=this.is(2)?this.size:this.size-1;return-1>>>e.size-r},e.prototype.is=function(e){return(this.flags&e)==e},e.prototype.isAny=function(e){return 0!=(this.flags&e)},e.prototype.asClass=function(r){assert(9==this.kind&&!this.classReference);var t=new e(this.kind,-129&this.flags|256,this.size);return t.classReference=r,t},e.prototype.asFunction=function(r){assert(7==this.kind&&!this.signatureReference);var t=new e(this.kind,-129&this.flags|256,this.size);return t.signatureReference=r,t},e.prototype.asNullable=function(){return assert(this.is(256)),this.cachedNullableType||(assert(!this.is(512)),this.cachedNullableType=new e(this.kind,512|this.flags,this.size),this.cachedNullableType.nonNullableType=this,this.cachedNullableType.classReference=this.classReference,this.cachedNullableType.signatureReference=this.signatureReference),this.cachedNullableType},e.prototype.isAssignableTo=function(r,t){var n,i,a,s;if(void 0===t&&(t=!1),this.is(256)){if(r.is(256)&&(!this.is(512)||r.is(512)))if(n=this.classReference){if(i=r.classReference)return n.isAssignableTo(i)}else if((a=this.signatureReference)&&(s=r.signatureReference))return a.isAssignableTo(s)}else if(!r.is(256))if(this.is(4))if(r.is(4)){if(!t||this==e.bool||this.is(1)==r.is(1))return this.size<=r.size}else{if(11==r.kind)return this.size<=23;if(12==r.kind)return this.size<=52}else if(this.is(8)){if(r.is(8))return this.size<=r.size}else if(this.is(1024)&&r.is(1024))return this.size==r.size;return!1},e.prototype.isStrictlyAssignableTo=function(e,r){return void 0===r&&(r=!1),this.is(256)?this.isAssignableTo(e):!e.is(256)&&(this.is(4)?e.is(4)&&e.size==this.size&&(!r||this.is(1)==e.is(1)):this.kind==e.kind)},e.commonDenominator=function(e,r,t){return r.isAssignableTo(e,t)?e:e.isAssignableTo(r,t)?r:null},e.prototype.toString=function(e){if(void 0===e&&(e=!1),!e&&this.is(256)){var r=this.classReference;if(r)return this.is(512)?r.name+" | null":r.name;var t=this.signatureReference;if(t)return this.is(512)?"("+t.toString(!0)+") | null":t.toString(!0);assert(!1)}switch(this.kind){case 0:return"i8";case 1:return"i16";case 2:return"i32";case 3:return"i64";case 4:return"isize";case 5:return"u8";case 6:return"u16";case 7:return"u32";case 8:return"u64";case 9:return"usize";case 10:return"bool";case 11:return"f32";case 12:return"f64";case 13:return"v128";default:assert(!1);case 14:return"void"}},e.prototype.toNativeType=function(){switch(this.kind){default:return i.NativeType.I32;case 3:case 8:return i.NativeType.I64;case 4:case 9:return 64==this.size?i.NativeType.I64:i.NativeType.I32;case 11:return i.NativeType.F32;case 12:return i.NativeType.F64;case 13:return i.NativeType.V128;case 14:return i.NativeType.None}},e.prototype.toNativeZero=function(e){switch(this.kind){case 14:assert(!1);default:return e.createI32(0);case 4:case 9:if(64!=this.size)return e.createI32(0);case 3:case 8:return e.createI64(0);case 11:return e.createF32(0);case 12:return e.createF64(0);case 13:return e.createV128(a)}},e.prototype.toNativeOne=function(e){switch(this.kind){case 13:case 14:assert(!1);default:return e.createI32(1);case 4:case 9:if(64!=this.size)return e.createI32(1);case 3:case 8:return e.createI64(1);case 11:return e.createF32(1);case 12:return e.createF64(1)}},e.prototype.toNativeNegOne=function(e){switch(this.kind){case 13:case 14:assert(!1);default:return e.createI32(-1);case 4:case 9:if(64!=this.size)return e.createI32(-1);case 3:case 8:return e.createI64(-1,-1);case 11:return e.createF32(-1);case 12:return e.createF64(-1)}},e.prototype.toSignatureString=function(){switch(this.kind){case 0:case 5:case 1:case 6:case 2:case 7:case 10:return"i";case 3:case 8:return"j";case 4:case 9:return 64==this.size?"j":"i";case 11:return"f";case 12:return"d";case 13:return"V";case 14:return"v";default:assert(!1)}return"i"},e.i8=new e(0,165,8),e.i16=new e(1,165,16),e.i32=new e(2,133,32),e.i64=new e(3,197,64),e.isize32=new e(4,149,32),e.isize64=new e(4,213,64),e.u8=new e(5,166,8),e.u16=new e(6,166,16),e.u32=new e(7,134,32),e.u64=new e(8,198,64),e.usize32=new e(9,150,32),e.usize64=new e(9,214,64),e.bool=new e(10,166,1),e.f32=new e(11,137,32),e.f64=new e(12,201,64),e.v128=new e(13,1152,128),e.void=new e(14,0,0),e}();r.Type=s,r.typesToNativeTypes=function(e){for(var r=e.length,t=new Array(r),n=0;n<r;++n)t[n]=e[n].toNativeType();return t},r.typesToString=function(e){var r=e.length;if(!r)return"";for(var t=new Array(r),n=0;n<r;++n)t[n]=e[n].toString();return t.join(",")};var o=function(){function e(e,r,t){void 0===e&&(e=null),void 0===r&&(r=null),void 0===t&&(t=null),this.cachedFunctionTarget=null,this.parameterTypes=e||[],this.parameterNames=null,this.requiredParameters=0,this.returnType=r||s.void,this.thisType=t,this.hasRest=!1,this.type=s.u32.asFunction(this)}return e.prototype.asFunctionTarget=function(e){var r=this.cachedFunctionTarget;return r?assert(r.program==e):this.cachedFunctionTarget=r=new n.FunctionTarget(this,e),r},e.prototype.getParameterName=function(e){var r=this.parameterNames;return r&&r.length>e?r[e]:l(e)},e.prototype.isAssignableTo=function(e){var r=this.thisType,t=e.thisType;if(r){if(!t||!r.isAssignableTo(t))return!1}else if(t)return!1;if(this.hasRest!=e.hasRest)return!1;var n=this.parameterTypes,i=e.parameterTypes,a=n.length;if(a!=i.length)return!1;for(var s=0;s<a;++s){var o=n[s],c=i[s];if(!o.isAssignableTo(c))return!1}var l=this.returnType,p=e.returnType;return l==p||l.isAssignableTo(p)},e.makeSignatureString=function(e,r,t){void 0===t&&(t=null);var n=[];if(n.push(r.toSignatureString()),t&&n.push(t.toSignatureString()),e)for(var i=0,a=e.length;i<a;++i)n.push(e[i].toSignatureString());return"FUNCSIG$"+n.join("")},e.prototype.toSignatureString=function(){return e.makeSignatureString(this.parameterTypes,this.returnType,this.thisType)},e.prototype.toString=function(e){void 0===e&&(e=!1);var r=new Array;r.push("(");var t=0,n=this.thisType;n&&e&&(r.push("this: "),r.push(n.toString()),t=1);var i=this.parameterTypes,a=i.length;if(a)for(var s=this.parameterNames,o=s?s.length:0,c=this.requiredParameters,p=this.hasRest?a-1:-1,u=0;u<a;++u,++t)t&&r.push(", "),u==p&&r.push("..."),u<o?r.push(s[u]):r.push(l(u)),u>=c&&u!=p?r.push("?: "):r.push(": "),r.push(i[u].toString());return r.push(") => "),r.push(this.returnType.toString()),r.join("")},e}();r.Signature=o;var c=null;function l(e){c||(c=[]);for(var r=c.length;r<=e;++r)c.push("arg$"+r.toString(10));return c[e-1]}r.getDefaultParameterName=l},function(e,r,t){"use strict";var n,i=this&&this.__extends||(n=function(e,r){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)r.hasOwnProperty(t)&&(e[t]=r[t])})(e,r)},function(e,r){function t(){this.constructor=e}n(e,r),e.prototype=null===r?Object.create(r):(t.prototype=r.prototype,new t)});Object.defineProperty(r,"__esModule",{value:!0});var a,s,o=t(2),c=t(5),l=t(1);function p(e){switch(assert(e.length),e.charCodeAt(0)){case 97:switch(e){case"abstract":return a.ABSTRACT;case"as":return a.AS;case"async":return a.ASYNC;case"await":return a.AWAIT}break;case 98:switch(e){case"break":return a.BREAK}break;case 99:switch(e){case"case":return a.CASE;case"catch":return a.CATCH;case"class":return a.CLASS;case"continue":return a.CONTINUE;case"const":return a.CONST;case"constructor":return a.CONSTRUCTOR}break;case 100:switch(e){case"debugger":return a.DEBUGGER;case"declare":return a.DECLARE;case"default":return a.DEFAULT;case"delete":return a.DELETE;case"do":return a.DO}break;case 101:switch(e){case"else":return a.ELSE;case"enum":return a.ENUM;case"export":return a.EXPORT;case"extends":return a.EXTENDS}break;case 102:switch(e){case"false":return a.FALSE;case"finally":return a.FINALLY;case"for":return a.FOR;case"from":return a.FROM;case"function":return a.FUNCTION}break;case 103:switch(e){case"get":return a.GET}break;case 105:switch(e){case"if":return a.IF;case"implements":return a.IMPLEMENTS;case"import":return a.IMPORT;case"in":return a.IN;case"instanceof":return a.INSTANCEOF;case"interface":return a.INTERFACE;case"is":return a.IS}break;case 107:switch(e){case"keyof":return a.KEYOF}break;case 108:switch(e){case"let":return a.LET}break;case 109:switch(e){case"module":return a.MODULE}break;case 110:switch(e){case"namespace":return a.NAMESPACE;case"new":return a.NEW;case"null":return a.NULL}break;case 111:switch(e){case"of":return a.OF}break;case 112:switch(e){case"package":return a.PACKAGE;case"private":return a.PRIVATE;case"protected":return a.PROTECTED;case"public":return a.PUBLIC}break;case 114:switch(e){case"readonly":return a.READONLY;case"return":return a.RETURN}break;case 115:switch(e){case"set":return a.SET;case"static":return a.STATIC;case"super":return a.SUPER;case"switch":return a.SWITCH}break;case 116:switch(e){case"this":return a.THIS;case"throw":return a.THROW;case"true":return a.TRUE;case"try":return a.TRY;case"type":return a.TYPE;case"typeof":return a.TYPEOF}break;case 118:switch(e){case"var":return a.VAR;case"void":return a.VOID}break;case 119:switch(e){case"while":return a.WHILE;case"with":return a.WITH}break;case 121:switch(e){case"yield":return a.YIELD}}return a.INVALID}function u(e){switch(e){case a.ABSTRACT:case a.AS:case a.CONSTRUCTOR:case a.DECLARE:case a.DELETE:case a.FROM:case a.FOR:case a.GET:case a.IS:case a.KEYOF:case a.MODULE:case a.NAMESPACE:case a.READONLY:case a.SET:case a.TYPE:case a.VOID:return!0;default:return!1}}!function(e){e[e.ABSTRACT=0]="ABSTRACT",e[e.AS=1]="AS",e[e.ASYNC=2]="ASYNC",e[e.AWAIT=3]="AWAIT",e[e.BREAK=4]="BREAK",e[e.CASE=5]="CASE",e[e.CATCH=6]="CATCH",e[e.CLASS=7]="CLASS",e[e.CONST=8]="CONST",e[e.CONTINUE=9]="CONTINUE",e[e.CONSTRUCTOR=10]="CONSTRUCTOR",e[e.DEBUGGER=11]="DEBUGGER",e[e.DECLARE=12]="DECLARE",e[e.DEFAULT=13]="DEFAULT",e[e.DELETE=14]="DELETE",e[e.DO=15]="DO",e[e.ELSE=16]="ELSE",e[e.ENUM=17]="ENUM",e[e.EXPORT=18]="EXPORT",e[e.EXTENDS=19]="EXTENDS",e[e.FALSE=20]="FALSE",e[e.FINALLY=21]="FINALLY",e[e.FOR=22]="FOR",e[e.FROM=23]="FROM",e[e.FUNCTION=24]="FUNCTION",e[e.GET=25]="GET",e[e.IF=26]="IF",e[e.IMPLEMENTS=27]="IMPLEMENTS",e[e.IMPORT=28]="IMPORT",e[e.IN=29]="IN",e[e.INSTANCEOF=30]="INSTANCEOF",e[e.INTERFACE=31]="INTERFACE",e[e.IS=32]="IS",e[e.KEYOF=33]="KEYOF",e[e.LET=34]="LET",e[e.MODULE=35]="MODULE",e[e.NAMESPACE=36]="NAMESPACE",e[e.NEW=37]="NEW",e[e.NULL=38]="NULL",e[e.OF=39]="OF",e[e.PACKAGE=40]="PACKAGE",e[e.PRIVATE=41]="PRIVATE",e[e.PROTECTED=42]="PROTECTED",e[e.PUBLIC=43]="PUBLIC",e[e.READONLY=44]="READONLY",e[e.RETURN=45]="RETURN",e[e.SET=46]="SET",e[e.STATIC=47]="STATIC",e[e.SUPER=48]="SUPER",e[e.SWITCH=49]="SWITCH",e[e.THIS=50]="THIS",e[e.THROW=51]="THROW",e[e.TRUE=52]="TRUE",e[e.TRY=53]="TRY",e[e.TYPE=54]="TYPE",e[e.TYPEOF=55]="TYPEOF",e[e.VAR=56]="VAR",e[e.VOID=57]="VOID",e[e.WHILE=58]="WHILE",e[e.WITH=59]="WITH",e[e.YIELD=60]="YIELD",e[e.OPENBRACE=61]="OPENBRACE",e[e.CLOSEBRACE=62]="CLOSEBRACE",e[e.OPENPAREN=63]="OPENPAREN",e[e.CLOSEPAREN=64]="CLOSEPAREN",e[e.OPENBRACKET=65]="OPENBRACKET",e[e.CLOSEBRACKET=66]="CLOSEBRACKET",e[e.DOT=67]="DOT",e[e.DOT_DOT_DOT=68]="DOT_DOT_DOT",e[e.SEMICOLON=69]="SEMICOLON",e[e.COMMA=70]="COMMA",e[e.LESSTHAN=71]="LESSTHAN",e[e.GREATERTHAN=72]="GREATERTHAN",e[e.LESSTHAN_EQUALS=73]="LESSTHAN_EQUALS",e[e.GREATERTHAN_EQUALS=74]="GREATERTHAN_EQUALS",e[e.EQUALS_EQUALS=75]="EQUALS_EQUALS",e[e.EXCLAMATION_EQUALS=76]="EXCLAMATION_EQUALS",e[e.EQUALS_EQUALS_EQUALS=77]="EQUALS_EQUALS_EQUALS",e[e.EXCLAMATION_EQUALS_EQUALS=78]="EXCLAMATION_EQUALS_EQUALS",e[e.EQUALS_GREATERTHAN=79]="EQUALS_GREATERTHAN",e[e.PLUS=80]="PLUS",e[e.MINUS=81]="MINUS",e[e.ASTERISK_ASTERISK=82]="ASTERISK_ASTERISK",e[e.ASTERISK=83]="ASTERISK",e[e.SLASH=84]="SLASH",e[e.PERCENT=85]="PERCENT",e[e.PLUS_PLUS=86]="PLUS_PLUS",e[e.MINUS_MINUS=87]="MINUS_MINUS",e[e.LESSTHAN_LESSTHAN=88]="LESSTHAN_LESSTHAN",e[e.GREATERTHAN_GREATERTHAN=89]="GREATERTHAN_GREATERTHAN",e[e.GREATERTHAN_GREATERTHAN_GREATERTHAN=90]="GREATERTHAN_GREATERTHAN_GREATERTHAN",e[e.AMPERSAND=91]="AMPERSAND",e[e.BAR=92]="BAR",e[e.CARET=93]="CARET",e[e.EXCLAMATION=94]="EXCLAMATION",e[e.TILDE=95]="TILDE",e[e.AMPERSAND_AMPERSAND=96]="AMPERSAND_AMPERSAND",e[e.BAR_BAR=97]="BAR_BAR",e[e.QUESTION=98]="QUESTION",e[e.COLON=99]="COLON",e[e.EQUALS=100]="EQUALS",e[e.PLUS_EQUALS=101]="PLUS_EQUALS",e[e.MINUS_EQUALS=102]="MINUS_EQUALS",e[e.ASTERISK_EQUALS=103]="ASTERISK_EQUALS",e[e.ASTERISK_ASTERISK_EQUALS=104]="ASTERISK_ASTERISK_EQUALS",e[e.SLASH_EQUALS=105]="SLASH_EQUALS",e[e.PERCENT_EQUALS=106]="PERCENT_EQUALS",e[e.LESSTHAN_LESSTHAN_EQUALS=107]="LESSTHAN_LESSTHAN_EQUALS",e[e.GREATERTHAN_GREATERTHAN_EQUALS=108]="GREATERTHAN_GREATERTHAN_EQUALS",e[e.GREATERTHAN_GREATERTHAN_GREATERTHAN_EQUALS=109]="GREATERTHAN_GREATERTHAN_GREATERTHAN_EQUALS",e[e.AMPERSAND_EQUALS=110]="AMPERSAND_EQUALS",e[e.BAR_EQUALS=111]="BAR_EQUALS",e[e.CARET_EQUALS=112]="CARET_EQUALS",e[e.AT=113]="AT",e[e.IDENTIFIER=114]="IDENTIFIER",e[e.STRINGLITERAL=115]="STRINGLITERAL",e[e.INTEGERLITERAL=116]="INTEGERLITERAL",e[e.FLOATLITERAL=117]="FLOATLITERAL",e[e.INVALID=118]="INVALID",e[e.ENDOFFILE=119]="ENDOFFILE"}(a=r.Token||(r.Token={})),function(e){e[e.DEFAULT=0]="DEFAULT",e[e.PREFER=1]="PREFER",e[e.ALWAYS=2]="ALWAYS"}(s=r.IdentifierHandling||(r.IdentifierHandling={})),r.tokenFromKeyword=p,r.tokenIsAlsoIdentifier=u,r.operatorTokenToString=function(e){switch(e){case a.DELETE:return"delete";case a.IN:return"in";case a.INSTANCEOF:return"instanceof";case a.NEW:return"new";case a.TYPEOF:return"typeof";case a.VOID:return"void";case a.YIELD:return"yield";case a.DOT_DOT_DOT:return"...";case a.COMMA:return",";case a.LESSTHAN:return"<";case a.GREATERTHAN:return">";case a.LESSTHAN_EQUALS:return"<=";case a.GREATERTHAN_EQUALS:return">=";case a.EQUALS_EQUALS:return"==";case a.EXCLAMATION_EQUALS:return"!=";case a.EQUALS_EQUALS_EQUALS:return"===";case a.EXCLAMATION_EQUALS_EQUALS:return"!==";case a.PLUS:return"+";case a.MINUS:return"-";case a.ASTERISK_ASTERISK:return"**";case a.ASTERISK:return"*";case a.SLASH:return"/";case a.PERCENT:return"%";case a.PLUS_PLUS:return"++";case a.MINUS_MINUS:return"--";case a.LESSTHAN_LESSTHAN:return"<<";case a.GREATERTHAN_GREATERTHAN:return">>";case a.GREATERTHAN_GREATERTHAN_GREATERTHAN:return">>>";case a.AMPERSAND:return"&";case a.BAR:return"|";case a.CARET:return"^";case a.EXCLAMATION:return"!";case a.TILDE:return"~";case a.AMPERSAND_AMPERSAND:return"&&";case a.BAR_BAR:return"||";case a.EQUALS:return"=";case a.PLUS_EQUALS:return"+=";case a.MINUS_EQUALS:return"-=";case a.ASTERISK_EQUALS:return"*=";case a.ASTERISK_ASTERISK_EQUALS:return"**=";case a.SLASH_EQUALS:return"/=";case a.PERCENT_EQUALS:return"%=";case a.LESSTHAN_LESSTHAN_EQUALS:return"<<=";case a.GREATERTHAN_GREATERTHAN_EQUALS:return">>=";case a.GREATERTHAN_GREATERTHAN_GREATERTHAN_EQUALS:return">>>=";case a.AMPERSAND_EQUALS:return"&=";case a.BAR_EQUALS:return"|=";case a.CARET_EQUALS:return"^=";default:return assert(!1),""}};var _=function(){function e(e,r,t){this.debugInfoRef=0,this.source=e,this.start=r,this.end=t}return e.join=function(r,t){if(r.source!=t.source)throw new Error("source mismatch");return new e(r.source,r.start<t.start?r.start:t.start,r.end>t.end?r.end:t.end)},Object.defineProperty(e.prototype,"atStart",{get:function(){return new e(this.source,this.start,this.start)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"atEnd",{get:function(){return new e(this.source,this.end,this.end)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"line",{get:function(){for(var e=this.source.text,r=1,t=this.start;t>=0;--t)10==e.charCodeAt(t)&&r++;return r},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"column",{get:function(){for(var e=this.source.text,r=0,t=this.start-1;t>=0&&10!=e.charCodeAt(t);--t)++r;return r},enumerable:!0,configurable:!0}),e.prototype.toString=function(){return this.source.text.substring(this.start,this.end)},e}();r.Range=_;var h=function(e){function r(r,t){void 0===t&&(t=null);var n=e.call(this,t)||this;n.end=0,n.pos=0,n.token=-1,n.tokenPos=0,n.nextToken=-1,n.nextTokenPos=0,n.nextTokenOnNewLine=!1,n.onComment=null,n.source=r,n.pos=0,n.end=r.text.length,n.diagnostics=t||new Array;var i=r.text;if(n.pos<n.end&&65279==i.charCodeAt(n.pos)&&++n.pos,n.pos+1<n.end&&35==i.charCodeAt(n.pos)&&33==i.charCodeAt(n.pos+1))for(n.pos+=2;n.pos<n.end&&10!=i.charCodeAt(n.pos);)++n.pos;return n}return i(r,e),r.prototype.next=function(e){return void 0===e&&(e=s.DEFAULT),this.nextToken=-1,this.token=this.unsafeNext(e)},r.prototype.unsafeNext=function(e,r){void 0===e&&(e=s.DEFAULT),void 0===r&&(r=i32.MAX_VALUE);for(var t=this.source.text;this.pos<this.end;){this.tokenPos=this.pos;var n=t.charCodeAt(this.pos);switch(n){case 13:if(!(++this.pos<this.end&&10==t.charCodeAt(this.pos)))break;case 10:case 9:case 11:case 12:case 32:++this.pos;break;case 33:return++this.pos,r>1&&this.pos<this.end&&61==t.charCodeAt(this.pos)?(++this.pos,r>2&&this.pos<this.end&&61==t.charCodeAt(this.pos)?(++this.pos,a.EXCLAMATION_EQUALS_EQUALS):a.EXCLAMATION_EQUALS):a.EXCLAMATION;case 34:case 39:case 96:return a.STRINGLITERAL;case 37:return++this.pos,r>1&&this.pos<this.end&&61==t.charCodeAt(this.pos)?(++this.pos,a.PERCENT_EQUALS):a.PERCENT;case 38:if(++this.pos,r>1&&this.pos<this.end){if(38==(i=t.charCodeAt(this.pos)))return++this.pos,a.AMPERSAND_AMPERSAND;if(61==i)return++this.pos,a.AMPERSAND_EQUALS}return a.AMPERSAND;case 40:return++this.pos,a.OPENPAREN;case 41:return++this.pos,a.CLOSEPAREN;case 42:if(++this.pos,r>1&&this.pos<this.end){if(61==(i=t.charCodeAt(this.pos)))return++this.pos,a.ASTERISK_EQUALS;if(42==i)return++this.pos,r>2&&this.pos<this.end&&61==t.charCodeAt(this.pos)?(++this.pos,a.ASTERISK_ASTERISK_EQUALS):a.ASTERISK_ASTERISK}return a.ASTERISK;case 43:if(++this.pos,r>1&&this.pos<this.end){if(43==(i=t.charCodeAt(this.pos)))return++this.pos,a.PLUS_PLUS;if(61==i)return++this.pos,a.PLUS_EQUALS}return a.PLUS;case 44:return++this.pos,a.COMMA;case 45:if(++this.pos,r>1&&this.pos<this.end){if(45==(i=t.charCodeAt(this.pos)))return++this.pos,a.MINUS_MINUS;if(61==i)return++this.pos,a.MINUS_EQUALS}return a.MINUS;case 46:if(++this.pos,r>1&&this.pos<this.end){var i=t.charCodeAt(this.pos);if(l.isDecimalDigit(i))return--this.pos,a.FLOATLITERAL;if(r>2&&this.pos+1<this.end&&46==i&&46==t.charCodeAt(this.pos+1))return this.pos+=2,a.DOT_DOT_DOT}return a.DOT;case 47:var _=this.pos;if(++this.pos,r>1&&this.pos<this.end){if(47==(i=t.charCodeAt(this.pos))){var h=c.CommentKind.LINE;for(this.pos+1<this.end&&47==t.charCodeAt(this.pos+1)&&(++this.pos,h=c.CommentKind.TRIPLE);++this.pos<this.end;)if(10==t.charCodeAt(this.pos)){++this.pos;break}this.onComment&&this.onComment(h,t.substring(_,this.pos),this.range(_,this.pos));break}if(42==i){for(var d=!1;++this.pos<this.end;)if(42==(n=t.charCodeAt(this.pos))&&this.pos+1<this.end&&47==t.charCodeAt(this.pos+1)){this.pos+=2,d=!0;break}d?this.onComment&&this.onComment(c.CommentKind.BLOCK,t.substring(_,this.pos),this.range(_,this.pos)):this.error(o.DiagnosticCode._0_expected,this.range(this.pos),"*/");break}if(61==i)return++this.pos,a.SLASH_EQUALS}return a.SLASH;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.testInteger()?a.INTEGERLITERAL:a.FLOATLITERAL;case 58:return++this.pos,a.COLON;case 59:return++this.pos,a.SEMICOLON;case 60:if(++this.pos,r>1&&this.pos<this.end){if(60==(i=t.charCodeAt(this.pos)))return++this.pos,r>2&&this.pos<this.end&&61==t.charCodeAt(this.pos)?(++this.pos,a.LESSTHAN_LESSTHAN_EQUALS):a.LESSTHAN_LESSTHAN;if(61==i)return++this.pos,a.LESSTHAN_EQUALS}return a.LESSTHAN;case 61:if(++this.pos,r>1&&this.pos<this.end){if(61==(i=t.charCodeAt(this.pos)))return++this.pos,r>2&&this.pos<this.end&&61==t.charCodeAt(this.pos)?(++this.pos,a.EQUALS_EQUALS_EQUALS):a.EQUALS_EQUALS;if(62==i)return++this.pos,a.EQUALS_GREATERTHAN}return a.EQUALS;case 62:if(++this.pos,r>1&&this.pos<this.end){if(62==(i=t.charCodeAt(this.pos))){if(++this.pos,r>2&&this.pos<this.end){if(62==(i=t.charCodeAt(this.pos)))return++this.pos,r>3&&this.pos<this.end&&61==t.charCodeAt(this.pos)?(++this.pos,a.GREATERTHAN_GREATERTHAN_GREATERTHAN_EQUALS):a.GREATERTHAN_GREATERTHAN_GREATERTHAN;if(61==i)return++this.pos,a.GREATERTHAN_GREATERTHAN_EQUALS}return a.GREATERTHAN_GREATERTHAN}if(61==i)return++this.pos,a.GREATERTHAN_EQUALS}return a.GREATERTHAN;case 63:return++this.pos,a.QUESTION;case 91:return++this.pos,a.OPENBRACKET;case 93:return++this.pos,a.CLOSEBRACKET;case 94:return++this.pos,r>1&&this.pos<this.end&&61==t.charCodeAt(this.pos)?(++this.pos,a.CARET_EQUALS):a.CARET;case 123:return++this.pos,a.OPENBRACE;case 124:if(++this.pos,r>1&&this.pos<this.end){if(124==(i=t.charCodeAt(this.pos)))return++this.pos,a.BAR_BAR;if(61==i)return++this.pos,a.BAR_EQUALS}return a.BAR;case 125:return++this.pos,a.CLOSEBRACE;case 126:return++this.pos,a.TILDE;case 64:return++this.pos,a.AT;default:if(l.isIdentifierStart(n)){if(l.isKeywordCharacter(n)){for(var y=this.pos;++this.pos<this.end&&l.isIdentifierPart(n=t.charCodeAt(this.pos));)if(!l.isKeywordCharacter(n))return this.pos=y,a.IDENTIFIER;var m=p(t.substring(y,this.pos));if(m!==a.INVALID&&e!==s.ALWAYS&&(e!==s.PREFER||!u(m)))return m;this.pos=y}return a.IDENTIFIER}if(l.isWhiteSpace(n)){++this.pos;break}return this.error(o.DiagnosticCode.Invalid_character,this.range(this.pos,this.pos+1)),++this.pos,a.INVALID}}return a.ENDOFFILE},r.prototype.peek=function(e,r,t){void 0===e&&(e=!1),void 0===r&&(r=s.DEFAULT),void 0===t&&(t=i32.MAX_VALUE);var n=this.source.text;if(this.nextToken<0){var i=this.pos,a=this.token,o=this.tokenPos;if(this.nextToken=this.unsafeNext(r,t),this.nextTokenPos=this.tokenPos,e){this.nextTokenOnNewLine=!1;for(var c=i,p=this.nextTokenPos;c<p;++c)if(l.isLineBreak(n.charCodeAt(c))){this.nextTokenOnNewLine=!0;break}}this.pos=i,this.token=a,this.tokenPos=o}return this.nextToken},r.prototype.skipIdentifier=function(e){return void 0===e&&(e=s.PREFER),this.skip(a.IDENTIFIER,e)},r.prototype.skip=function(e,r){void 0===r&&(r=s.DEFAULT);var t=this.pos,n=this.token,i=this.tokenPos,o=i32.MAX_VALUE;switch(e){case a.GREATERTHAN:o=1}return this.token=this.unsafeNext(r,o),this.token==e?(this.nextToken=-1,!0):(this.pos=t,this.token=n,this.tokenPos=i,!1)},r.prototype.mark=function(){var e;return y?(e=y,y=null):e=new d,e.pos=this.pos,e.token=this.token,e.tokenPos=this.tokenPos,e},r.prototype.discard=function(e){y=e},r.prototype.reset=function(e){this.pos=e.pos,this.token=e.token,this.tokenPos=e.tokenPos,this.nextToken=-1},r.prototype.range=function(e,r){return void 0===e&&(e=-1),void 0===r&&(r=-1),e<0?(e=this.tokenPos,r=this.pos):r<0&&(r=e),new _(this.source,e,r)},r.prototype.readIdentifier=function(){for(var e=this.source.text,r=this.pos;++this.pos<this.end&&l.isIdentifierPart(e.charCodeAt(this.pos)););return e.substring(r,this.pos)},r.prototype.readString=function(){for(var e=this.source.text,r=e.charCodeAt(this.pos++),t=this.pos,n="";;){if(this.pos>=this.end){n+=e.substring(t,this.pos),this.error(o.DiagnosticCode.Unterminated_string_literal,this.range(t-1,this.end));break}var i=e.charCodeAt(this.pos);if(i==r){n+=e.substring(t,this.pos++);break}if(92!=i){if(l.isLineBreak(i)){n+=e.substring(t,this.pos),this.error(o.DiagnosticCode.Unterminated_string_literal,this.range(t-1,this.pos));break}++this.pos}else n+=e.substring(t,this.pos),n+=this.readEscapeSequence(),t=this.pos}return n},r.prototype.readEscapeSequence=function(){if(++this.pos>=this.end)return this.error(o.DiagnosticCode.Unexpected_end_of_text,this.range(this.end)),"";var e=this.source.text,r=e.charCodeAt(this.pos++);switch(r){case 48:return"\0";case 98:return"\b";case 116:return"\t";case 110:return"\n";case 118:return"\v";case 102:return"\f";case 114:return"\r";case 39:return"'";case 34:return'"';case 117:return this.pos<this.end&&123==e.charCodeAt(this.pos)?(++this.pos,this.readExtendedUnicodeEscape()):this.readUnicodeEscape();case 13:this.pos<this.end&&10==e.charCodeAt(this.pos)&&++this.pos;case 10:case 8232:case 8233:return"";default:return String.fromCharCode(r)}},r.prototype.readRegexpPattern=function(){for(var e=this.source.text,r=this.pos,t=!1;;){if(this.pos>=this.end){this.error(o.DiagnosticCode.Unterminated_regular_expression_literal,this.range(r,this.end));break}if(92!=e.charCodeAt(this.pos)){var n=e.charCodeAt(this.pos);if(!t&&47==n)break;if(l.isLineBreak(n)){this.error(o.DiagnosticCode.Unterminated_regular_expression_literal,this.range(r,this.pos));break}++this.pos,t=!1}else++this.pos,t=!0}return e.substring(r,this.pos)},r.prototype.readRegexpFlags=function(){for(var e=this.source.text,r=this.pos,t=0;this.pos<this.end;){var n=e.charCodeAt(this.pos);if(!l.isIdentifierPart(n))break;switch(++this.pos,n){case 103:t|=1&t?-1:1;break;case 105:t|=2&t?-1:2;break;case 109:t|=4&t?-1:4;break;default:t=-1}}return-1==t&&this.error(o.DiagnosticCode.Invalid_regular_expression_flags,this.range(r,this.pos)),e.substring(r,this.pos)},r.prototype.testInteger=function(){var e=this.source.text;if(this.pos+1<this.end&&48==e.charCodeAt(this.pos))switch(e.charCodeAt(this.pos+2)){case 120:case 88:case 98:case 66:case 111:case 79:return!0}for(var r=this.pos;r<this.end;){var t=e.charCodeAt(r);if(46==t||101==t||69==t)return!1;if((t<48||t>57)&&95!=t)break;r++}return!0},r.prototype.readInteger=function(){var e=this.source.text;if(this.pos+2<this.end&&48==e.charCodeAt(this.pos)){switch(e.charCodeAt(this.pos+1)){case 120:case 88:return this.pos+=2,this.readHexInteger();case 98:case 66:return this.pos+=2,this.readBinaryInteger();case 111:case 79:return this.pos+=2,this.readOctalInteger()}if(l.isOctalDigit(e.charCodeAt(this.pos+1))){var r=this.pos;++this.pos;var t=this.readOctalInteger();return this.error(o.DiagnosticCode.Octal_literals_are_not_allowed_in_strict_mode,this.range(r,this.pos)),t}}return this.readDecimalInteger()},r.prototype.readHexInteger=function(){for(var e=this.source.text,r=this.pos,t=i64_new(0),n=i64_new(4),i=r;this.pos<this.end;){var a=this.pos,s=e.charCodeAt(a);if(s>=48&&s<=57)t=i64_add(i64_shl(t,n),i64_new(s-48));else if(s>=65&&s<=70)t=i64_add(i64_shl(t,n),i64_new(10+s-65));else if(s>=97&&s<=102)t=i64_add(i64_shl(t,n),i64_new(10+s-97));else{if(95!=s)break;i==a&&this.error(i==r?o.DiagnosticCode.Numeric_separators_are_not_allowed_here:o.DiagnosticCode.Multiple_consecutive_numeric_separators_are_not_permitted,this.range(a)),i=a+1}this.pos=a+1}return this.pos==r?this.error(o.DiagnosticCode.Hexadecimal_digit_expected,this.range(r)):i==this.pos&&this.error(o.DiagnosticCode.Numeric_separators_are_not_allowed_here,this.range(i-1)),t},r.prototype.readDecimalInteger=function(){for(var e=this.source.text,r=this.pos,t=i64_new(0),n=i64_new(10),i=r;this.pos<this.end;){var a=this.pos,s=e.charCodeAt(a);if(s>=48&&s<=57)t=i64_add(i64_mul(t,n),i64_new(s-48));else{if(95!=s)break;i==a&&this.error(i==r?o.DiagnosticCode.Numeric_separators_are_not_allowed_here:o.DiagnosticCode.Multiple_consecutive_numeric_separators_are_not_permitted,this.range(a)),i=a+1}this.pos=a+1}return this.pos==r?this.error(o.DiagnosticCode.Digit_expected,this.range(r)):i==this.pos&&this.error(o.DiagnosticCode.Numeric_separators_are_not_allowed_here,this.range(i-1)),t},r.prototype.readOctalInteger=function(){for(var e=this.source.text,r=this.pos,t=i64_new(0),n=i64_new(3),i=r;this.pos<this.end;){var a=this.pos,s=e.charCodeAt(a);if(s>=48&&s<=55)t=i64_add(i64_shl(t,n),i64_new(s-48));else{if(95!=s)break;i==a&&this.error(i==r?o.DiagnosticCode.Numeric_separators_are_not_allowed_here:o.DiagnosticCode.Multiple_consecutive_numeric_separators_are_not_permitted,this.range(a)),i=a+1}++this.pos}return this.pos==r?this.error(o.DiagnosticCode.Octal_digit_expected,this.range(r)):i==this.pos&&this.error(o.DiagnosticCode.Numeric_separators_are_not_allowed_here,this.range(i-1)),t},r.prototype.readBinaryInteger=function(){for(var e=this.source.text,r=this.pos,t=i64_new(0),n=i64_new(1),i=r;this.pos<this.end;){var a=this.pos,s=e.charCodeAt(a);if(48==s)t=i64_shl(t,n);else if(49==s)t=i64_add(i64_shl(t,n),n);else{if(95!=s)break;i==a&&this.error(i==r?o.DiagnosticCode.Numeric_separators_are_not_allowed_here:o.DiagnosticCode.Multiple_consecutive_numeric_separators_are_not_permitted,this.range(a)),i=a+1}this.pos=a+1}return this.pos==r?this.error(o.DiagnosticCode.Binary_digit_expected,this.range(r)):i==this.pos&&this.error(o.DiagnosticCode.Numeric_separators_are_not_allowed_here,this.range(i-1)),t},r.prototype.readFloat=function(){return this.readDecimalFloat()},r.prototype.readDecimalFloat=function(){for(var e=this.pos,r=this.source.text;this.pos<this.end&&l.isDecimalDigit(r.charCodeAt(this.pos));)++this.pos;if(this.pos<this.end&&46==r.charCodeAt(this.pos))for(++this.pos;this.pos<this.end&&l.isDecimalDigit(r.charCodeAt(this.pos));)++this.pos;if(this.pos<this.end){var t=r.charCodeAt(this.pos);if(101==t||69==t)for((++this.pos<this.end&&45==(t=r.charCodeAt(this.pos))||43==t&&l.isDecimalDigit(r.charCodeAt(this.pos+1)))&&++this.pos;this.pos<this.end&&l.isDecimalDigit(r.charCodeAt(this.pos));)++this.pos}return parseFloat(r.substring(e,this.pos))},r.prototype.readHexFloat=function(){throw new Error("not implemented")},r.prototype.readUnicodeEscape=function(){for(var e=4,r=0,t=this.source.text;this.pos<this.end;){var n=t.charCodeAt(this.pos++);if(n>=48&&n<=57)r=(r<<4)+n-48;else if(n>=65&&n<=70)r=(r<<4)+n+-55;else{if(!(n>=97&&n<=102))return this.error(o.DiagnosticCode.Hexadecimal_digit_expected,this.range(this.pos-1,this.pos)),"";r=(r<<4)+n+-87}if(0==--e)break}return e?(this.error(o.DiagnosticCode.Unexpected_end_of_text,this.range(this.pos)),""):String.fromCharCode(r)},r.prototype.readExtendedUnicodeEscape=function(){var e=this.pos,r=this.readHexInteger(),t=i64_low(r),n=!1;assert(!i64_high(r)),t>1114111&&(this.error(o.DiagnosticCode.An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive,this.range(e,this.pos)),n=!0);var i=this.source.text;return this.pos>=this.end?(this.error(o.DiagnosticCode.Unexpected_end_of_text,this.range(e,this.end)),n=!0):125==i.charCodeAt(this.pos)?++this.pos:(this.error(o.DiagnosticCode.Unterminated_Unicode_escape_sequence,this.range(e,this.pos)),n=!0),n?"":t<65536?String.fromCharCode(t):String.fromCharCode(55296+(t-65536>>>10),56320+(t-65536&1023))},r.prototype.finish=function(){},r}(o.DiagnosticEmitter);r.Tokenizer=h;var d=function(){return function(){}}();r.State=d;var y=null},function(e,r){var t;t=function(){return this}();try{t=t||new Function("return this")()}catch(e){"object"==typeof window&&(t=window)}e.exports=t},function(e,r,t){"use strict";var n,i=this&&this.__extends||(n=function(e,r){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)r.hasOwnProperty(t)&&(e[t]=r[t])})(e,r)},function(e,r){function t(){this.constructor=e}n(e,r),e.prototype=null===r?Object.create(r):(t.prototype=r.prototype,new t)}),a=this&&this.__values||function(e){var r="function"==typeof Symbol&&e[Symbol.iterator],t=0;return r?r.call(e):{next:function(){return e&&t>=e.length&&(e=void 0),{value:e&&e[t++],done:!e}}}},s=this&&this.__read||function(e,r){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var n,i,a=t.call(e),s=[];try{for(;(void 0===r||r-- >0)&&!(n=a.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(t=a.return)&&t.call(a)}finally{if(i)throw i.error}}return s};Object.defineProperty(r,"__esModule",{value:!0});var o,c=t(2),l=t(3),p=t(5),u=t(6),_=t(0),h=t(1),d=t(7);!function(e){e[e.REPORT=0]="REPORT",e[e.SWALLOW=1]="SWALLOW"}(o=r.ReportMode||(r.ReportMode={}));var y=function(e){function r(r){var t=e.call(this,r.diagnostics)||this;return t.currentThisExpression=null,t.currentElementExpression=null,t.program=r,t}return i(r,e),r.prototype.resolveType=function(e,r,t,n){if(void 0===t&&(t=null),void 0===n&&(n=o.REPORT),e.kind==p.NodeKind.SIGNATURE){var i=e.explicitThisType,a=null;if(i&&!(a=this.resolveType(i,r,t,n)))return null;for(var s=e.parameters,d=s.length,y=new Array(d),m=new Array(d),T=0,f=!1,E=0;E<d;++E){var g=s[E];switch(g.parameterKind){case p.ParameterKind.DEFAULT:T=E+1;break;case p.ParameterKind.REST:assert(E==d),f=!0}var v=g.type;if(p.isTypeOmitted(v))return n==o.REPORT&&this.error(c.DiagnosticCode.Type_expected,v.range),null;var I=this.resolveType(v,r,t,n);if(!I)return null;y[E]=I,m[E]=g.name.text}var b=e.returnType;if(p.isTypeOmitted(b))return n==o.REPORT&&this.error(c.DiagnosticCode.Type_expected,b.range),null;var x=void 0;if(b){if(!(x=this.resolveType(b,r,t,n)))return null}else x=u.Type.void;var S=new u.Signature(y,x,a);return S.parameterNames=m,S.requiredParameters=T,S.hasRest=f,e.isNullable?S.type.asNullable():S.type}assert(e.kind==p.NodeKind.TYPE);var A=e,N=A.name,O=A.typeArguments,C=!N.next;if(C&&t&&t.has(N.identifier.text)){var k=t.get(N.identifier.text);return null!==O&&O.length&&n==o.REPORT&&this.error(c.DiagnosticCode.Type_0_is_not_generic,e.range,k.toString()),e.isNullable?(k.is(256)||n==o.REPORT&&this.error(c.DiagnosticCode.Basic_type_0_cannot_be_nullable,e.range,k.toString()),k.asNullable()):k}var R=this.resolveTypeName(N,r,n);if(!R)return null;if(R.shadowType)R=R.shadowType;else{if(R.kind==l.ElementKind.ENUM)return null!==O&&O.length&&n==o.REPORT&&this.error(c.DiagnosticCode.Type_0_is_not_generic,e.range,R.internalName),e.isNullable&&n==o.REPORT&&this.error(c.DiagnosticCode.Basic_type_0_cannot_be_nullable,e.range,R.name),u.Type.i32;if(R.kind==l.ElementKind.CLASS_PROTOTYPE){var L=this.resolveClassInclTypeArguments(R,O,r,h.makeMap(t),e);return L?e.isNullable?L.type.asNullable():L.type:null}}if(R.kind==l.ElementKind.TYPEDEFINITION){if(R.is(_.CommonFlags.RESOLVED)){null!==O&&O.length&&n==o.REPORT&&this.error(c.DiagnosticCode.Type_0_is_not_generic,e.range,R.internalName);k=R.type;if(e.isNullable){if(k.is(256))return k.asNullable();n==o.REPORT&&this.error(c.DiagnosticCode.Basic_type_0_cannot_be_nullable,A.name.range,N.identifier.text)}return k}if(C&&N.identifier.text==_.CommonSymbols.native){if(!O||1!=O.length)return n==o.REPORT&&this.error(c.DiagnosticCode.Expected_0_type_arguments_but_got_1,A.range,"1",(O?O.length:1).toString(10)),null;var F=this.resolveType(O[0],r,t,n);if(!F)return null;switch(F.kind){case 0:case 1:case 2:return u.Type.i32;case 4:if(!this.program.options.isWasm64)return u.Type.i32;case 3:return u.Type.i64;case 5:case 6:case 7:case 10:return u.Type.u32;case 9:if(!this.program.options.isWasm64)return u.Type.u32;case 8:return u.Type.u64;case 11:return u.Type.f32;case 12:return u.Type.f64;case 13:return u.Type.v128;case 14:return u.Type.void;default:assert(!1)}}var B=R.typeParameterNodes;if(B){if(!this.resolveTypeArguments(B,O,r,t=h.makeMap(t),e,n))return null}else O&&O.length&&this.error(c.DiagnosticCode.Type_0_is_not_generic,A.range,N.identifier.text);return this.resolveType(R.typeNode,R,t,n)}return n==o.REPORT&&this.error(c.DiagnosticCode.Cannot_find_name_0,A.name.range,N.identifier.text),null},r.prototype.resolveTypeName=function(e,r,t){void 0===t&&(t=o.REPORT);var n=r.lookup(e.identifier.text);if(!n)return t==o.REPORT&&this.error(c.DiagnosticCode.Cannot_find_name_0,e.range,e.identifier.text),null;for(var i=e,a=e.next;a;){if(!(n=n.lookupInSelf(a.identifier.text)))return t==o.REPORT&&this.error(c.DiagnosticCode.Property_0_does_not_exist_on_type_1,a.range,a.identifier.text,i.identifier.text),null;i=a,a=a.next}return n},r.prototype.resolveTypeArguments=function(e,r,t,n,i,a){void 0===n&&(n=h.makeMap()),void 0===i&&(i=null),void 0===a&&(a=o.REPORT);for(var s=0,l=0,u=0;u<e.length;++u)e[u].defaultType||++s,++l;var _=r?r.length:0;if(_<s||_>l)return this.error(c.DiagnosticCode.Expected_0_type_arguments_but_got_1,_?p.Range.join(r[0].range,r[_-1].range):assert(i).range,(_<s?s:l).toString(10),_.toString(10)),null;var d=new Array(l);for(u=0;u<l;++u){var y=u<_?this.resolveType(r[u],t,n,a):this.resolveType(assert(e[u].defaultType),t,n,a);if(!y)return null;n.set(e[u].name.text,y),d[u]=y}return d},r.prototype.resolveIdentifier=function(e,r,t,n){void 0===n&&(n=o.REPORT);var i,a=e.text;return r&&(i=r.lookup(a))?(this.currentThisExpression=null,this.currentElementExpression=null,i):t&&(i=t.lookup(a))?(this.currentThisExpression=null,this.currentElementExpression=null,i):(i=this.program.lookupGlobal(a))?(this.currentThisExpression=null,this.currentElementExpression=null,i):(n==o.REPORT&&this.error(c.DiagnosticCode.Cannot_find_name_0,e.range,a),null)},r.prototype.ensureResolvedLazyGlobal=function(e,r){if(void 0===r&&(r=o.REPORT),e.is(_.CommonFlags.RESOLVED))return!0;var t=e.typeNode;if(!t)return!1;var n=this.resolveType(t,e.parent,null,r);return!!n&&(e.setType(n),!0)},r.prototype.resolvePropertyAccessExpression=function(e,r,t,n){void 0===n&&(n=o.REPORT);var i=e.expression,a=this.resolveExpression(i,r,t,n);if(!a)return null;var s=e.property.text;switch(a.kind){case l.ElementKind.GLOBAL:if(!this.ensureResolvedLazyGlobal(a,n))return null;case l.ElementKind.LOCAL:case l.ElementKind.FIELD:var p=a.type;if(assert(p!=u.Type.void),!(y=p.classReference)){var _=this.program.typeClasses;if(p.is(256)||!_.has(p.kind))return this.error(c.DiagnosticCode.Property_0_does_not_exist_on_type_1,e.property.range,s,a.type.toString()),null;y=_.get(p.kind)}a=y;break;case l.ElementKind.PROPERTY_PROTOTYPE:if(!(d=this.resolveFunction(assert(a.getterPrototype),null,h.makeMap(),n)))return null;if(!(y=d.signature.returnType.classReference))return this.error(c.DiagnosticCode.Property_0_does_not_exist_on_type_1,e.property.range,s,d.signature.returnType.toString()),null;a=y;break;case l.ElementKind.PROPERTY:var d,y;if(!(y=(d=assert(a.getterInstance)).signature.returnType.classReference))return this.error(c.DiagnosticCode.Property_0_does_not_exist_on_type_1,e.property.range,s,d.signature.returnType.toString()),null;a=y;break;case l.ElementKind.CLASS:var m=this.currentElementExpression;if(m){var T=a.lookupOverload(l.OperatorKind.INDEXED_GET);if(!T)return this.error(c.DiagnosticCode.Index_signature_is_missing_in_type_0,m.range,a.internalName),null;var f=T.signature.returnType;if(!(a=f.classReference))return this.error(c.DiagnosticCode.Property_0_does_not_exist_on_type_1,e.property.range,s,f.toString()),null}}switch(a.kind){case l.ElementKind.CLASS_PROTOTYPE:case l.ElementKind.CLASS:for(;;){if((E=a.members)&&E.has(s))return this.currentThisExpression=i,this.currentElementExpression=null,E.get(s);if(a.kind==l.ElementKind.CLASS_PROTOTYPE){if(!a.basePrototype)break;a=a.basePrototype}else{if(a.kind!=l.ElementKind.CLASS)break;if(!a.base)break;a=a.base}}break;default:var E;if((E=a.members)&&E.has(s))return this.currentThisExpression=i,this.currentElementExpression=null,E.get(s)}return this.error(c.DiagnosticCode.Property_0_does_not_exist_on_type_1,e.property.range,s,a.internalName),null},r.prototype.resolveElementAccessExpression=function(e,r,t,n){void 0===n&&(n=o.REPORT);var i=e.expression,a=this.resolveExpression(i,r,t,n);if(!a)return null;switch(a.kind){case l.ElementKind.GLOBAL:if(!this.ensureResolvedLazyGlobal(a,n))return null;case l.ElementKind.LOCAL:case l.ElementKind.FIELD:if(a=a.type.classReference)return this.currentThisExpression=i,this.currentElementExpression=e.elementExpression,a;break;case l.ElementKind.CLASS:var s=a.lookupOverload(l.OperatorKind.INDEXED_GET);return s?i.kind==p.NodeKind.ELEMENTACCESS?(a=s.signature.returnType.classReference)?(this.currentThisExpression=i,this.currentElementExpression=e.elementExpression,a):null:(this.currentThisExpression=i,this.currentElementExpression=e.elementExpression,a):(n==o.REPORT&&this.error(c.DiagnosticCode.Index_signature_is_missing_in_type_0,e.range,a.internalName),null)}return n==o.REPORT&&this.error(c.DiagnosticCode.Operation_not_supported,i.range),null},r.prototype.determineIntegerLiteralType=function(e,r){if(!r.is(256))switch(r.kind){case 0:if(i64_is_i8(e))return u.Type.i8;break;case 5:if(i64_is_u8(e))return u.Type.u8;break;case 1:if(i64_is_i16(e))return u.Type.i16;break;case 6:if(i64_is_u16(e))return u.Type.u16;break;case 2:if(i64_is_i32(e))return u.Type.i32;break;case 7:if(i64_is_u32(e))return u.Type.u32;break;case 10:if(i64_is_bool(e))return u.Type.bool;break;case 4:if(!this.program.options.isWasm64){if(i64_is_i32(e))return u.Type.isize32;break}return u.Type.isize64;case 9:if(!this.program.options.isWasm64){if(i64_is_u32(e))return u.Type.usize32;break}return u.Type.usize64;case 3:return u.Type.i64;case 8:return u.Type.u64;case 11:return u.Type.f32;case 12:return u.Type.f64;case 14:break;default:assert(!1)}return i64_is_i32(e)?u.Type.i32:i64_is_u32(e)?u.Type.u32:u.Type.i64},r.prototype.resolveExpression=function(e,r,t,n){for(void 0===t&&(t=u.Type.void),void 0===n&&(n=o.REPORT);e.kind==p.NodeKind.PARENTHESIZED;)e=e.expression;switch(e.kind){case p.NodeKind.ASSERTION:return this.resolveAssertionExpression(e,r,t,n);case p.NodeKind.UNARYPREFIX:return this.resolveUnaryPrefixExpression(e,r,t,n);case p.NodeKind.UNARYPOSTFIX:return this.resolveUnaryPostfixExpression(e,r,t,n);case p.NodeKind.BINARY:return this.resolveBinaryExpression(e,r,t,n);case p.NodeKind.THIS:return this.resolveThisExpression(e,r,t,n);case p.NodeKind.SUPER:return this.resolveSuperExpression(e,r,t,n);case p.NodeKind.IDENTIFIER:return this.resolveIdentifier(e,r,r.actualFunction,n);case p.NodeKind.LITERAL:return this.resolveLiteralExpression(e,r,t,n);case p.NodeKind.PROPERTYACCESS:return this.resolvePropertyAccessExpression(e,r,t,n);case p.NodeKind.ELEMENTACCESS:return this.resolveElementAccessExpression(e,r,t,n);case p.NodeKind.CALL:return this.resolveCallExpression(e,r,t,n)}return n==o.REPORT&&this.error(c.DiagnosticCode.Operation_not_supported,e.range),null},r.prototype.resolveAssertionExpression=function(e,r,t,n){if(void 0===t&&(t=u.Type.void),void 0===n&&(n=o.REPORT),e.assertionKind==p.AssertionKind.NONNULL)return this.resolveExpression(e.expression,r,t,n);var i=this.resolveType(assert(e.toType),r.actualFunction,r.contextualTypeArguments,n);if(!i)return null;var a=i.classReference;if(!a){var s=i.signatureReference;if(!s)return null;a=s.asFunctionTarget(this.program)}return this.currentThisExpression=null,this.currentElementExpression=null,a},r.prototype.resolveUnaryPrefixExpression=function(e,r,t,n){void 0===t&&(t=u.Type.void),void 0===n&&(n=o.REPORT);var i=e.operand;switch(e.operator){case d.Token.MINUS:if(i.kind==p.NodeKind.LITERAL&&i.literalKind==p.LiteralKind.INTEGER){var a=this.determineIntegerLiteralType(i64_sub(i64_zero,i.value),t);return(s=this.program.typeClasses).has(a.kind)?s.get(a.kind):null}return this.resolveExpression(i,r,t,n);case d.Token.PLUS:case d.Token.PLUS_PLUS:case d.Token.MINUS_MINUS:return this.resolveExpression(e.operand,r,t,n);case d.Token.EXCLAMATION:var s;return(s=this.program.typeClasses).has(10)?s.get(10):null;case d.Token.TILDE:if(!this.resolveExpression(e.operand,r,t,n))return null;break;default:assert(!1)}return n==o.REPORT&&this.error(c.DiagnosticCode.Operation_not_supported,e.range),null},r.prototype.resolveUnaryPostfixExpression=function(e,r,t,n){switch(void 0===t&&(t=u.Type.void),void 0===n&&(n=o.REPORT),e.operator){case d.Token.PLUS_PLUS:case d.Token.MINUS_MINUS:return this.resolveExpression(e.operand,r,t,n);default:assert(!1)}return n==o.REPORT&&this.error(c.DiagnosticCode.Operation_not_supported,e.range),null},r.prototype.resolveBinaryExpression=function(e,r,t,n){return void 0===t&&(t=u.Type.void),void 0===n&&(n=o.REPORT),n==o.REPORT&&this.error(c.DiagnosticCode.Operation_not_supported,e.range),null},r.prototype.resolveThisExpression=function(e,r,t,n){if(void 0===t&&(t=u.Type.void),void 0===n&&(n=o.REPORT),r.is(4096)){var i=r.lookupLocal(_.CommonSymbols.this_);if(i)return this.currentThisExpression=null,this.currentElementExpression=null,i}var a=r.actualFunction.parent;return a?(this.currentThisExpression=null,this.currentElementExpression=null,a):(n==o.REPORT&&this.error(c.DiagnosticCode._this_cannot_be_referenced_in_current_location,e.range),null)},r.prototype.resolveSuperExpression=function(e,r,t,n){if(void 0===t&&(t=u.Type.void),void 0===n&&(n=o.REPORT),r.is(4096)){var i=r.lookupLocal(_.CommonSymbols.super_);if(i)return this.currentThisExpression=null,this.currentElementExpression=null,i}var a=r.actualFunction.parent;return a&&a.kind==l.ElementKind.CLASS&&(a=a.base)?(this.currentThisExpression=null,this.currentElementExpression=null,a):(n==o.REPORT&&this.error(c.DiagnosticCode._super_can_only_be_referenced_in_a_derived_class,e.range),null)},r.prototype.resolveLiteralExpression=function(e,r,t,n){switch(void 0===t&&(t=u.Type.void),void 0===n&&(n=o.REPORT),e.literalKind){case p.LiteralKind.INTEGER:this.currentThisExpression=e,this.currentElementExpression=null;var i=this.determineIntegerLiteralType(e.value,t);return(a=this.program.typeClasses).has(i.kind)?a.get(i.kind):null;case p.LiteralKind.FLOAT:this.currentThisExpression=e,this.currentElementExpression=null;var a;i=t==u.Type.f32?u.Type.f32:u.Type.f64;return(a=this.program.typeClasses).has(i.kind)?a.get(i.kind):null;case p.LiteralKind.STRING:return this.currentThisExpression=e,this.currentElementExpression=null,this.program.stringInstance}return n==o.REPORT&&this.error(c.DiagnosticCode.Operation_not_supported,e.range),null},r.prototype.resolveCallExpression=function(e,r,t,n){void 0===t&&(t=u.Type.void),void 0===n&&(n=o.REPORT);var i=e.expression,a=this.resolveExpression(i,r,t,n);if(!a)return null;if(a.kind==l.ElementKind.FUNCTION_PROTOTYPE){var s=this.resolveFunctionInclTypeArguments(a,e.typeArguments,r.actualFunction,h.makeMap(r.contextualTypeArguments),e,n);if(!s)return null;var p=s.signature.returnType,_=p.classReference;if(_)return _;var d=p.signatureReference;return d?d.asFunctionTarget(this.program):(n==o.REPORT&&this.error(c.DiagnosticCode.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures,i.range,a.internalName),null)}return n==o.REPORT&&this.error(c.DiagnosticCode.Operation_not_supported,e.range),null},r.prototype.resolveFunction=function(e,r,t,n){void 0===t&&(t=h.makeMap()),void 0===n&&(n=o.REPORT);var i=e.parent.kind==l.ElementKind.PROPERTY_PROTOTYPE?e.parent.parent:e.parent,a=null,s=r?u.typesToString(r):"";if(e.is(_.CommonFlags.INSTANCE)){if(assert(i.kind==l.ElementKind.CLASS),a=i,E=e.getResolvedInstance(s))return E;var d=a.typeArguments;if(d){var y=assert(a.prototype.typeParameterNodes),m=y.length;assert(m==y.length);for(var T=0;T<m;++T){var f=y[T].name.text;t.has(f)||t.set(f,d[T])}}}else{var E;if(assert(i.kind!=l.ElementKind.CLASS),E=e.getResolvedInstance(s))return E}var g,v=e.signatureNode,I=e.typeParameterNodes;if(r&&(g=r.length)){assert(I&&g==I.length);for(T=0;T<g;++T)t.set(I[T].name.text,r[T])}else assert(!I||0==I.length);var b=null,x=v.explicitThisType;if(x){if(!(b=this.resolveType(x,e.parent,t,n)))return null;t.set(_.CommonSymbols.this_,b)}else a&&(b=a.type,t.set(_.CommonSymbols.this_,b));var S,A=v.parameters,N=A.length,O=new Array(N),C=new Array(N),k=0;for(T=0;T<N;++T){var R=A[T];R.parameterKind==p.ParameterKind.DEFAULT&&(k=T+1);var L=R.type;if(p.isTypeOmitted(L))return this.error(c.DiagnosticCode.Type_expected,L.range),null;var F=this.resolveType(L,e.parent,t,n);if(!F)return null;O[T]=F,C[T]=R.name.text}if(e.is(_.CommonFlags.SET))S=u.Type.void;else if(e.is(_.CommonFlags.CONSTRUCTOR))S=assert(a).type;else{L=v.returnType;if(p.isTypeOmitted(L))return this.error(c.DiagnosticCode.Type_expected,L.range),null;var B=this.resolveType(L,e.parent,t,n);if(!B)return null;S=B}var U=new u.Signature(O,S,b);U.parameterNames=C,U.requiredParameters=k;var D=e.name;s.length&&(D+="<"+s+">");var w=new l.Function(D,e,U,t);return e.setResolvedInstance(s,w),w},r.prototype.resolveFunctionInclTypeArguments=function(e,r,t,n,i,a){void 0===a&&(a=o.REPORT);var s=e.parent.kind==l.ElementKind.PROPERTY_PROTOTYPE?e.parent.parent:e.parent,p=null;if(e.is(_.CommonFlags.GENERIC)){if(e.is(_.CommonFlags.INSTANCE)){assert(s.kind==l.ElementKind.CLASS);var u=s.typeArguments;if(u){var h=assert(s.prototype.typeParameterNodes),d=u.length;assert(d==h.length);for(var y=0;y<d;++y)n.set(h[y].name.text,u[y])}}if(!(p=this.resolveTypeArguments(assert(e.typeParameterNodes),r,t,n,i,a)))return null}else if(null!==r&&r.length)return a==o.REPORT&&this.error(c.DiagnosticCode.Type_0_is_not_generic,i.range,e.internalName),null;return this.resolveFunction(e,p,n,a)},r.prototype.resolveClass=function(e,r,t,n){var i,p,d,y,m,T;void 0===t&&(t=h.makeMap()),void 0===n&&(n=o.REPORT);var f=r?u.typesToString(r):"",E=e.getResolvedInstance(f);if(E)return E;if(r){var g=(b=assert(e.typeParameterNodes)).length,v=r.length;assert(v==g);for(var I=0;I<v;++I)t.set(b[I].name.text,r[I])}else{var b=e.typeParameterNodes;assert(!(b&&b.length))}var x=e.basePrototype,S=null;if(x){var A=assert(e.extendsNode);if(!(S=this.resolveClassInclTypeArguments(x,A.typeArguments,e.parent,h.makeMap(t),A,n)))return null}var N=e.name;f.length&&(N+="<"+f+">"),(E=new l.Class(N,e,r,S)).contextualTypeArguments=t,e.setResolvedInstance(f,E);var O=0;if(S){if(G=S.members){(P=E.members)||(E.members=P=new Map);try{for(var C=a(G),k=C.next();!k.done;k=C.next()){var R=s(k.value,2),L=R[0],F=R[1];P.set(L,F)}}catch(e){i={error:e}}finally{try{k&&!k.done&&(p=C.return)&&p.call(C)}finally{if(i)throw i.error}}}O=S.currentMemoryOffset}var B=e.instanceMembers;if(B)try{for(var U=a(B.values()),D=U.next();!D.done;D=U.next()){var w=D.value;switch(w.kind){case l.ElementKind.FIELD_PROTOTYPE:var P;if(P=E.members){if(P.has(w.name)){this.error(c.DiagnosticCode.Duplicate_identifier_0,w.identifierNode.range,w.name);break}}else E.members=P=new Map;var M=w.typeNode,V=null;if(M)V=this.resolveType(M,e.parent,E.contextualTypeArguments,n);else{var G;if(S)if((G=S.members)&&G.has(w.name)){var K=G.get(w.name);K.is(_.CommonFlags.PRIVATE)||(assert(K.kind==l.ElementKind.FIELD),V=K.type)}V||n==o.REPORT&&this.error(c.DiagnosticCode.Type_expected,w.identifierNode.range.atEnd)}if(!V)break;var z=new l.Field(w,E,V);assert(h.isPowerOf2(V.byteSize));var H=V.byteSize-1;O&H&&(O=1+(O|H)),z.memoryOffset=O,O+=V.byteSize,E.add(w.name,z);break;case l.ElementKind.FUNCTION_PROTOTYPE:var Y=w.toBound(E);E.add(Y.name,Y);break;case l.ElementKind.PROPERTY_PROTOTYPE:var W=new l.Property(w,E),X=w.getterPrototype;if(X){var q=this.resolveFunction(X.toBound(E),null,h.makeMap(E.contextualTypeArguments),n);q&&(W.getterInstance=q,W.setType(q.signature.returnType))}var Q=w.setterPrototype;if(Q){var j=this.resolveFunction(Q.toBound(E),null,h.makeMap(E.contextualTypeArguments),n);j&&(W.setterInstance=j,W.is(_.CommonFlags.RESOLVED)||(assert(1==j.signature.parameterTypes.length),W.setType(j.signature.parameterTypes[0])))}E.add(W.name,W);break;default:assert(!1)}}}catch(e){d={error:e}}finally{try{D&&!D.done&&(y=U.return)&&y.call(U)}finally{if(d)throw d.error}}E.currentMemoryOffset=O;var Z=E.lookupInSelf(_.CommonSymbols.constructor);if(Z&&Z.parent===E){assert(Z.kind==l.ElementKind.FUNCTION_PROTOTYPE);var J=this.resolveFunction(Z,null,E.contextualTypeArguments,n);J&&(E.constructorInstance=J)}try{for(var $=a(e.overloadPrototypes),ee=$.next();!ee.done;ee=$.next()){var re=s(ee.value,2),te=re[0],ne=re[1];assert(te!=l.OperatorKind.INVALID);var ie=void 0;if(ne.is(_.CommonFlags.INSTANCE)){Y=ne.toBound(E);ie=this.resolveFunction(Y,null,h.makeMap(),n)}else ie=this.resolveFunction(ne,null,h.makeMap(),n);if(ie){var ae=E.overloads;ae||(E.overloads=ae=new Map),ae.set(te,ie)}}}catch(e){m={error:e}}finally{try{ee&&!ee.done&&(T=$.return)&&T.call($)}finally{if(m)throw m.error}}return E},r.prototype.resolveClassInclTypeArguments=function(e,r,t,n,i,a){void 0===a&&(a=o.REPORT);var s=null;if(e.is(_.CommonFlags.GENERIC)){if(!(s=this.resolveTypeArguments(assert(e.typeParameterNodes),r,t,n,i,a)))return null}else if(null!==r&&r.length)return a==o.REPORT&&this.error(c.DiagnosticCode.Type_0_is_not_generic,i.range,e.internalName),null;return this.resolveClass(e,s,n,a)},r}(c.DiagnosticEmitter);r.Resolver=y},function(e,r,t){"use strict";var n,i=this&&this.__extends||(n=function(e,r){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)r.hasOwnProperty(t)&&(e[t]=r[t])})(e,r)},function(e,r){function t(){this.constructor=e}n(e,r),e.prototype=null===r?Object.create(r):(t.prototype=r.prototype,new t)}),a=this&&this.__values||function(e){var r="function"==typeof Symbol&&e[Symbol.iterator],t=0;return r?r.call(e):{next:function(){return e&&t>=e.length&&(e=void 0),{value:e&&e[t++],done:!e}}}},s=this&&this.__read||function(e,r){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var n,i,a=t.call(e),s=[];try{for(;(void 0===r||r-- >0)&&!(n=a.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(t=a.return)&&t.call(a)}finally{if(i)throw i.error}}return s};Object.defineProperty(r,"__esModule",{value:!0});var o,c=t(24),l=t(2),p=t(4),u=t(0),_=t(3),h=t(12),d=t(9),y=t(7),m=t(5),T=t(6),f=t(1);!function(e){e[e.WASM32=0]="WASM32",e[e.WASM64=1]="WASM64"}(o=r.Target||(r.Target={}));var E=function(){function e(){this.target=o.WASM32,this.noAssert=!1,this.importMemory=!1,this.sharedMemory=0,this.importTable=!1,this.sourceMap=!1,this.memoryBase=0,this.globalAliases=null,this.features=0,this.optimizeLevelHint=0,this.shrinkLevelHint=0}return Object.defineProperty(e.prototype,"isWasm64",{get:function(){return this.target==o.WASM64},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"usizeType",{get:function(){return this.target==o.WASM64?T.Type.usize64:T.Type.usize32},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isizeType",{get:function(){return this.target==o.WASM64?T.Type.isize64:T.Type.isize32},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nativeSizeType",{get:function(){return this.target==o.WASM64?p.NativeType.I64:p.NativeType.I32},enumerable:!0,configurable:!0}),e.prototype.hasFeature=function(e){return 0!=(this.features&e)},e}();r.Options=E,function(e){e[e.NONE=0]="NONE",e[e.SIGN_EXTENSION=1]="SIGN_EXTENSION",e[e.MUTABLE_GLOBAL=2]="MUTABLE_GLOBAL",e[e.BULK_MEMORY=4]="BULK_MEMORY",e[e.SIMD=8]="SIMD",e[e.THREADS=16]="THREADS"}(r.Feature||(r.Feature={})),function(e){e[e.NONE=0]="NONE",e[e.IMPLICIT=1]="IMPLICIT",e[e.EXPLICIT=2]="EXPLICIT"}(r.ConversionKind||(r.ConversionKind={})),function(e){e[e.NONE=0]="NONE",e[e.WRAP=1]="WRAP"}(r.WrapMode||(r.WrapMode={}));var g,v,I,b=function(e){function r(r,t){void 0===t&&(t=null);var n=e.call(this,r.diagnostics)||this;return n.currentInlineFunctions=[],n.currentEnum=null,n.currentType=T.Type.void,n.memorySegments=[],n.stringSegments=new Map,n.functionTable=["null"],n.argcVar=0,n.argcSet=0,n.needsIterateRoots=!1,n.f32ModInstance=null,n.f64ModInstance=null,n.f32PowInstance=null,n.f64PowInstance=null,n.program=r,n.resolver=r.resolver,t||(t=new E),n.options=t,n.memoryOffset=i64_new(max(t.memoryBase,8)),n.module=p.Module.create(),n}return i(r,e),r.compile=function(e,t){return void 0===t&&(t=null),new r(e,t).compile()},r.prototype.compile=function(){var e,r,t,n,i=this.options,s=this.module,o=this.program;o.initialize(i);var l=o.makeNativeFunction("start",new T.Signature([],T.Type.void));l.internalName="start";var u=new Array;this.currentFlow=l.flow,this.currentBody=u,i.isWasm64?s.addGlobal(c.BuiltinSymbols.HEAP_BASE,p.NativeType.I64,!0,s.createI64(0,0)):s.addGlobal(c.BuiltinSymbols.HEAP_BASE,p.NativeType.I32,!1,s.createI32(0));var _=o.filesByName;try{for(var h=a(_.values()),d=h.next();!d.done;d=h.next()){(x=d.value).source.isEntry&&(this.compileFile(x),this.compileExports(x))}}catch(r){e={error:r}}finally{try{d&&!d.done&&(r=h.return)&&r.call(h)}finally{if(e)throw e.error}}var y=o.explicitStartFunction;if(u.length||y){var m=l.signature,f=s.addFunction(l.internalName,this.ensureFunctionType(m.parameterTypes,m.returnType,m.thisType),T.typesToNativeTypes(l.additionalLocals),s.createBlock(null,u));l.finalize(s,f),y||s.setStart(f)}var E=this.memoryOffset;E=i64_align(E,i.usizeType.byteSize),this.memoryOffset=E,s.removeGlobal(c.BuiltinSymbols.HEAP_BASE),i.isWasm64?s.addGlobal(c.BuiltinSymbols.HEAP_BASE,p.NativeType.I64,!1,s.createI64(i64_low(E),i64_high(E))):s.addGlobal(c.BuiltinSymbols.HEAP_BASE,p.NativeType.I32,!1,s.createI32(i64_low(E)));var g=i.hasFeature(16)&&i.sharedMemory>0;s.setMemory(this.options.memoryBase||this.memorySegments.length?i64_low(i64_shr_u(i64_align(E,65536),i64_new(16,0))):0,g?i.sharedMemory:p.Module.UNLIMITED_MEMORY,this.memorySegments,i.target,"memory",g),i.importMemory&&s.addMemoryImport("0","env","memory",g);var v=this.functionTable;s.setFunctionTable(v.length,4294967295,v),s.addTableExport("0","table"),s.addFunction("null",this.ensureFunctionType(null,T.Type.void),null,s.createBlock(null,[])),i.importTable&&s.addTableImport("0","env","table");try{for(var I=a(this.program.filesByName.values()),b=I.next();!b.done;b=I.next()){var x;(x=b.value).source.isEntry&&this.makeModuleExports(x)}}catch(e){t={error:e}}finally{try{b&&!b.done&&(n=I.return)&&n.call(I)}finally{if(t)throw t.error}}return this.needsIterateRoots&&c.compileIterateRoots(this),s},r.prototype.makeModuleExports=function(e){var r,t,n=e.exports;if(n)try{for(var i=a(n),o=i.next();!o.done;o=i.next()){var c=s(o.value,2),l=c[0],p=c[1];this.makeModuleExport(l,p)}}catch(e){r={error:e}}finally{try{o&&!o.done&&(t=i.return)&&t.call(i)}finally{if(r)throw r.error}}var u=e.exportsStar;if(u)for(var _=0,h=u.length;_<h;++_)this.makeModuleExports(u[_])},r.prototype.makeModuleExport=function(e,r,t){var n,i,s,o,c,p,h,d;switch(void 0===t&&(t=""),r.kind){case _.ElementKind.FUNCTION_PROTOTYPE:if(g=r.instances)try{for(var y=a(g.values()),m=y.next();!m.done;m=y.next()){var f=m.value,E=e;if(f.is(u.CommonFlags.GENERIC))E+=(b=f.internalName).substring(b.lastIndexOf("<"));this.makeModuleExport(E,f,t)}}catch(e){n={error:e}}finally{try{m&&!m.done&&(i=y.return)&&i.call(y)}finally{if(n)throw n.error}}break;case _.ElementKind.CLASS_PROTOTYPE:var g;if(g=r.instances)try{for(var v=a(g.values()),I=v.next();!I.done;I=v.next()){var b;f=I.value,E=e;if(f.is(u.CommonFlags.GENERIC))E+=(b=f.internalName).substring(b.lastIndexOf("<"));this.makeModuleExport(E,f,t)}}catch(e){s={error:e}}finally{try{I&&!I.done&&(o=v.return)&&o.call(v)}finally{if(s)throw s.error}}break;case _.ElementKind.PROPERTY_PROTOTYPE:var x=r.getterPrototype,S=r.setterPrototype;x&&this.makeModuleExport(u.GETTER_PREFIX+e,x,t),S&&this.makeModuleExport(u.SETTER_PREFIX+e,S,t);break;case _.ElementKind.GLOBAL:r.is(u.CommonFlags.CONST)||r.is(u.CommonFlags.STATIC|u.CommonFlags.READONLY)||this.options.hasFeature(2)?this.module.addGlobalExport(r.internalName,t+e):this.error(l.DiagnosticCode.Cannot_export_a_mutable_global,r.identifierNode.range);break;case _.ElementKind.ENUMVALUE:assert(r.parent).is(u.CommonFlags.CONST)||this.options.hasFeature(2)?this.module.addGlobalExport(r.internalName,t+e):this.error(l.DiagnosticCode.Cannot_export_a_mutable_global,r.identifierNode.range);break;case _.ElementKind.FUNCTION:var A=(f=r).signature;A.requiredParameters<A.parameterTypes.length&&(f=this.ensureTrampoline(f),this.ensureArgcSet()),f.is(u.CommonFlags.COMPILED)&&this.module.addFunctionExport(f.internalName,t+e);break;case _.ElementKind.PROPERTY:(x=r.getterInstance)&&this.makeModuleExport(u.GETTER_PREFIX+e,x,t),(S=r.setterInstance)&&this.makeModuleExport(u.SETTER_PREFIX+e,S,t);break;case _.ElementKind.FIELD:var N=this.module,O=r.type,C=O.toNativeType(),k=r.memoryOffset,R=this.options.usizeType,L=this.options.nativeSizeType,F=t+u.GETTER_PREFIX+e;if(N.addFunction(F,this.ensureFunctionType(null,O,R),null,N.createLoad(O.byteSize,O.is(1),N.createGetLocal(0,L),C,k)),N.addFunctionExport(F,F),!r.is(u.CommonFlags.READONLY)){var B=t+u.SETTER_PREFIX+e;N.addFunction(B,this.ensureFunctionType([O],T.Type.void,R),null,N.createStore(O.byteSize,N.createGetLocal(0,L),N.createGetLocal(1,C),C,k)),N.addFunctionExport(B,B)}break;case _.ElementKind.ENUM:case _.ElementKind.CLASS:case _.ElementKind.NAMESPACE:case _.ElementKind.FILE:case _.ElementKind.TYPEDEFINITION:break;default:assert(!1)}var U=r.members;if(U){var D=t+e+(r.kind==_.ElementKind.CLASS?u.INSTANCE_DELIMITER:u.STATIC_DELIMITER);if(r.kind==_.ElementKind.NAMESPACE||r.kind==_.ElementKind.FILE)try{for(var w=a(U.values()),P=w.next();!P.done;P=w.next()){(G=P.value).is(u.CommonFlags.EXPORT)&&this.makeModuleExport(G.name,G,D)}}catch(e){c={error:e}}finally{try{P&&!P.done&&(p=w.return)&&p.call(w)}finally{if(c)throw c.error}}else try{for(var M=a(U.values()),V=M.next();!V.done;V=M.next()){var G;(G=V.value).is(u.CommonFlags.PRIVATE)||this.makeModuleExport(G.name,G,D)}}catch(e){h={error:e}}finally{try{V&&!V.done&&(d=M.return)&&d.call(M)}finally{if(h)throw h.error}}}},r.prototype.compileElement=function(e,r){switch(void 0===r&&(r=!0),e.kind){case _.ElementKind.GLOBAL:this.compileGlobal(e);break;case _.ElementKind.ENUM:this.compileEnum(e);break;case _.ElementKind.FUNCTION_PROTOTYPE:e.is(u.CommonFlags.GENERIC)||this.compileFunctionUsingTypeArguments(e,[]);break;case _.ElementKind.CLASS_PROTOTYPE:e.is(u.CommonFlags.GENERIC)||this.compileClassUsingTypeArguments(e,[]);break;case _.ElementKind.PROPERTY_PROTOTYPE:var t=e.getterPrototype;t&&this.compileFunctionUsingTypeArguments(t,[]);var n=e.setterPrototype;n&&this.compileFunctionUsingTypeArguments(n,[]);break;case _.ElementKind.NAMESPACE:case _.ElementKind.TYPEDEFINITION:case _.ElementKind.ENUMVALUE:break;default:assert(!1,_.ElementKind[e.kind])}r&&this.compileMembers(e)},r.prototype.compileMembers=function(e){var r,t,n=e.members;if(n)try{for(var i=a(n.values()),s=i.next();!s.done;s=i.next()){var o=s.value;this.compileElement(o)}}catch(e){r={error:e}}finally{try{s&&!s.done&&(t=i.return)&&t.call(i)}finally{if(r)throw r.error}}},r.prototype.compileExports=function(e){var r,t,n,i,s=e.exports;if(s)try{for(var o=a(s.values()),c=o.next();!c.done;c=o.next()){var l=c.value;this.compileElement(l)}}catch(e){r={error:e}}finally{try{c&&!c.done&&(t=o.return)&&t.call(o)}finally{if(r)throw r.error}}var p=e.exportsStar;if(p)try{for(var u=a(p),_=u.next();!_.done;_=u.next()){var h=_.value;this.compileFile(h)}}catch(e){n={error:e}}finally{try{_&&!_.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}},r.prototype.compileFileByPath=function(e,r){var t,n,i=this.program.filesByName;if(i.has(e))t=i.get(e);else{if(!i.has(n=e+u.INDEX_SUFFIX))return void this.error(l.DiagnosticCode.File_0_not_found,r.range,e);t=i.get(n)}this.compileFile(t)},r.prototype.compileFile=function(e){if(!e.is(u.CommonFlags.COMPILED)){e.set(u.CommonFlags.COMPILED);var r=e.startFunction,t=this.currentBody,n=new Array;this.currentBody=n;var i=this.currentFlow;this.currentFlow=r.flow;for(var a=e.source.statements,s=0,o=a.length;s<o;++s)this.compileTopLevelStatement(a[s],n);if(this.currentFlow=i,this.currentBody=t,n.length){var c=this.module,l=r.localsByIndex,_=l.length,h=new Array(_);for(s=0;s<_;++s)h[s]=l[s].type.toNativeType();c.addFunction(r.internalName,this.ensureFunctionType(r.signature.parameterTypes,r.signature.returnType),h,n.length>1?c.createBlock(null,n):n[0]),t.push(c.createCall(r.internalName,null,p.NativeType.None))}}},r.prototype.compileGlobal=function(e){if(e.is(u.CommonFlags.COMPILED))return!0;e.set(u.CommonFlags.COMPILED);var r=this.module,t=0,n=e.typeNode,i=e.initializerNode;if(!e.is(u.CommonFlags.RESOLVED))if(n){var a=this.resolver.resolveType(n,e.parent);if(!a)return!1;if(a==T.Type.void)return this.error(l.DiagnosticCode.Type_expected,n.range),!1;e.setType(a)}else{if(!i)return this.error(l.DiagnosticCode.Type_expected,e.identifierNode.range.atEnd),!1;var s=this.currentFlow;if(e.hasDecorator(_.DecoratorFlags.LAZY)&&(this.currentFlow=e.file.startFunction.flow),t=this.compileExpressionRetainType(i,T.Type.void,1),this.currentFlow=s,this.currentType==T.Type.void)return this.error(l.DiagnosticCode.Type_0_is_not_assignable_to_type_1,i.range,this.currentType.toString(),"<auto>"),!1;e.setType(this.currentType)}if(e.is(u.CommonFlags.AMBIENT)&&e.hasDecorator(_.DecoratorFlags.BUILTIN))return!0;var o=e.type.toNativeType(),c=e.is(u.CommonFlags.CONST)||e.is(u.CommonFlags.STATIC|u.CommonFlags.READONLY);if(e.is(u.CommonFlags.AMBIENT))return c||this.options.hasFeature(2)?(e.set(u.CommonFlags.MODULE_IMPORT),x(e,e.declaration),r.addGlobalImport(e.internalName,g,v,o),e.set(u.CommonFlags.COMPILED),!0):(this.error(l.DiagnosticCode.Operation_not_supported,e.declaration.range),!1);var h=!1;if(i){if(!t){s=this.currentFlow;e.hasDecorator(_.DecoratorFlags.LAZY)&&(this.currentFlow=e.file.startFunction.flow),t=this.compileExpression(i,e.type,1,1),this.currentFlow=s}if(p.getExpressionId(t)!=p.ExpressionId.Const&&(c?(t=r.precomputeExpression(t),p.getExpressionId(t)!=p.ExpressionId.Const&&(this.warning(l.DiagnosticCode.Compiling_constant_with_non_constant_initializer_as_mutable,i.range),h=!0)):h=!0),e.hasDecorator(_.DecoratorFlags.INLINE)&&!h){switch(assert(p.getExpressionId(t)==p.ExpressionId.Const),p.getExpressionType(t)){case p.NativeType.I32:e.constantValueKind=1,e.constantIntegerValue=i64_new(p.getConstValueI32(t),0);break;case p.NativeType.I64:e.constantValueKind=1,e.constantIntegerValue=i64_new(p.getConstValueI64Low(t),p.getConstValueI64High(t));break;case p.NativeType.F32:e.constantValueKind=2,e.constantFloatValue=p.getConstValueF32(t);break;case p.NativeType.F64:e.constantValueKind=2,e.constantFloatValue=p.getConstValueF64(t);break;default:return assert(!1),!1}e.set(u.CommonFlags.INLINED)}}else t=e.type.toNativeZero(r);var d=e.internalName;return h?(e.hasDecorator(_.DecoratorFlags.INLINE)&&this.error(l.DiagnosticCode.Decorator_0_is_not_valid_here,e.identifierNode.range,"inline"),r.addGlobal(d,o,!0,e.type.toNativeZero(r)),this.currentBody.push(r.createSetGlobal(d,t))):e.hasDecorator(_.DecoratorFlags.INLINE)||r.addGlobal(d,o,!c,t),!0},r.prototype.compileEnum=function(e){var r,t;if(e.is(u.CommonFlags.COMPILED))return!0;e.set(u.CommonFlags.COMPILED);var n=this.module;this.currentEnum=e;var i=null,s=!1,o=e.is(u.CommonFlags.CONST)||e.hasDecorator(_.DecoratorFlags.INLINE);if(e.members)try{for(var c=a(e.members.values()),h=c.next();!h.done;h=c.next()){var d=h.value;if(d.kind==_.ElementKind.ENUMVALUE){var y=!1,m=d,f=m.valueNode;m.set(u.CommonFlags.COMPILED);var E=this.currentFlow;e.hasDecorator(_.DecoratorFlags.LAZY)&&(this.currentFlow=e.file.startFunction.flow);var g=void 0;f?(g=this.compileExpression(f,T.Type.i32,1,0),p.getExpressionId(g)!=p.ExpressionId.Const&&(e.is(u.CommonFlags.CONST)?(g=n.precomputeExpression(g),p.getExpressionId(g)!=p.ExpressionId.Const&&(this.error(l.DiagnosticCode.In_const_enum_declarations_member_initializer_must_be_constant_expression,f.range),y=!0)):y=!0)):null==i?g=n.createI32(0):(s&&this.error(l.DiagnosticCode.Enum_member_must_have_initializer,d.identifierNode.range.atEnd),g=n.createBinary(p.BinaryOp.AddI32,n.createGetGlobal(i.internalName,p.NativeType.I32),n.createI32(1)),g=n.precomputeExpression(g),p.getExpressionId(g)!=p.ExpressionId.Const&&(e.is(u.CommonFlags.CONST)&&this.error(l.DiagnosticCode.In_const_enum_declarations_member_initializer_must_be_constant_expression,d.declaration.range),y=!0)),this.currentFlow=E,y?(n.addGlobal(m.internalName,p.NativeType.I32,!0,n.createI32(0)),this.currentBody.push(n.createSetGlobal(m.internalName,g)),s=!0):(o?(m.setConstantIntegerValue(i64_new(p.getConstValueI32(g)),T.Type.i32),m.is(u.CommonFlags.MODULE_EXPORT)&&n.addGlobal(m.internalName,p.NativeType.I32,!1,g)):n.addGlobal(m.internalName,p.NativeType.I32,!0,g),s=!1),i=m}}}catch(e){r={error:e}}finally{try{h&&!h.done&&(t=c.return)&&t.call(c)}finally{if(r)throw r.error}}return this.currentEnum=null,!0},r.prototype.compileFunctionUsingTypeArguments=function(e,r,t,n){if(void 0===t&&(t=f.makeMap()),void 0===n&&(n=null),e.hasDecorator(_.DecoratorFlags.BUILTIN))return null;var i=this.resolver.resolveFunctionInclTypeArguments(e,r,e.parent,t,n||e.declaration);return i&&this.compileFunction(i)?i:null},r.prototype.ensureFunctionType=function(e,r,t){void 0===t&&(t=null);var n,i=e?e.length:0,a=0;if(t?((n=new Array(1+i))[0]=t.toNativeType(),a=1):n=new Array(i),e)for(var s=0;s<i;++s,++a)n[a]=e[s].toNativeType();var o=r.toNativeType(),c=this.module,l=c.getFunctionTypeBySignature(o,n);if(!l){var p=T.Signature.makeSignatureString(e,r,t);l=c.addFunctionType(p,o,n)}return l},r.prototype.compileFunctionBody=function(e){var r,t=this.module,n=assert(e.prototype.bodyNode),i=e.signature.returnType,a=this.currentFlow;if(n.kind==m.NodeKind.BLOCK)r=this.compileStatements(n.statements,!0);else{assert(n.kind==m.NodeKind.EXPRESSION),assert(e.prototype.arrowKind),assert(!e.isAny(u.CommonFlags.CONSTRUCTOR|u.CommonFlags.GET|u.CommonFlags.SET|u.CommonFlags.MAIN));var s=this.compileExpression(n.expression,i,1,0);a.set(1),a.canOverflow(s,i)||a.set(2),r=[s]}if(e.prototype==this.program.explicitStartFunction&&(t.addGlobal(I.started,p.NativeType.I32,!0,t.createI32(0)),r.unshift(t.createIf(t.createUnary(p.UnaryOp.EqzI32,t.createGetGlobal(I.started,p.NativeType.I32)),t.createBlock(null,[t.createCall("start",null,p.NativeType.None),t.createSetGlobal(I.started,t.createI32(1))])))),e.is(u.CommonFlags.CONSTRUCTOR)){var o=this.options.nativeSizeType;assert(e.is(u.CommonFlags.INSTANCE));var c=assert(e.parent);if(assert(c.kind==_.ElementKind.CLASS),!a.isAny(29)){var h=a.is(4096)?assert(a.lookupLocal(u.CommonSymbols.this_)).index:0;a.is(32)||(r.push(t.createIf(t.createUnary(o==p.NativeType.I64?p.UnaryOp.EqzI64:p.UnaryOp.EqzI32,t.createGetLocal(h,o)),t.createSetLocal(h,this.makeAllocation(c)))),this.makeFieldInitialization(c,r)),r.push(t.createGetLocal(h,o))}c.base&&!a.is(64)&&this.error(l.DiagnosticCode.Constructors_for_derived_classes_must_contain_a_super_call,e.prototype.declaration.range)}else i==T.Type.void||a.is(1)||this.error(l.DiagnosticCode.A_function_whose_declared_type_is_not_void_must_return_a_value,e.prototype.signatureNode.returnType.range);return r},r.prototype.compileFunction=function(e){if(e.is(u.CommonFlags.COMPILED))return!0;assert(!(e.is(u.CommonFlags.AMBIENT)&&e.hasDecorator(_.DecoratorFlags.BUILTIN))),e.set(u.CommonFlags.COMPILED);var r,t=this.module,n=e.signature,i=e.prototype.bodyNode,a=this.ensureFunctionType(n.parameterTypes,n.returnType,n.thisType);if(i){if(e.is(u.CommonFlags.AMBIENT)&&this.error(l.DiagnosticCode.An_implementation_cannot_be_declared_in_ambient_contexts,e.identifierNode.range),e.hasDecorator(_.DecoratorFlags.EXTERNAL)){var s=e.decoratorNodes,o=assert(m.findDecorator(m.DecoratorKind.EXTERNAL,s));this.error(l.DiagnosticCode.Operation_not_supported,o.range)}var c=this.currentFlow;this.currentFlow=e.flow;var p=this.compileFunctionBody(e);this.currentFlow=c,r=t.addFunction(e.internalName,a,T.typesToNativeTypes(e.additionalLocals),p.length?1==p.length?p[0]:t.createBlock(null,p,e.signature.returnType.toNativeType()):t.createNop())}else e.is(u.CommonFlags.AMBIENT)||this.error(l.DiagnosticCode.Function_implementation_is_missing_or_not_immediately_following_the_declaration,e.identifierNode.range),e.set(u.CommonFlags.MODULE_IMPORT),x(e,e.declaration),r=t.addFunctionImport(e.internalName,g,v,a);return e.finalize(t,r),!0},r.prototype.compileClassUsingTypeArguments=function(e,r,t,n){void 0===t&&(t=f.makeMap()),void 0===n&&(n=null);var i=this.resolver.resolveClassInclTypeArguments(e,r,e.parent,t,n||e.declaration);i&&this.compileClass(i)},r.prototype.compileClass=function(e){var r,t,n,i;if(e.is(u.CommonFlags.COMPILED))return!0;e.set(u.CommonFlags.COMPILED);var s=e.prototype.members;if(s)try{for(var o=a(s.values()),c=o.next();!c.done;c=o.next()){switch((y=c.value).kind){case _.ElementKind.GLOBAL:this.compileGlobal(y);break;case _.ElementKind.FUNCTION_PROTOTYPE:y.is(u.CommonFlags.GENERIC)||this.compileFunctionUsingTypeArguments(y,[],f.makeMap(),y.identifierNode);break;case _.ElementKind.PROPERTY_PROTOTYPE:(m=y.getterPrototype)&&this.compileFunctionUsingTypeArguments(m,[],f.makeMap(),m.identifierNode),(T=y.setterPrototype)&&this.compileFunctionUsingTypeArguments(T,[],f.makeMap(),T.identifierNode);break;case _.ElementKind.PROPERTY:}}}catch(e){r={error:e}}finally{try{c&&!c.done&&(t=o.return)&&t.call(o)}finally{if(r)throw r.error}}var l=e.constructorInstance;l&&this.compileFunction(l);var p=e.members;if(p)try{for(var h=a(p.values()),d=h.next();!d.done;d=h.next()){var y;switch((y=d.value).kind){case _.ElementKind.FUNCTION_PROTOTYPE:y.is(u.CommonFlags.GENERIC)||this.compileFunctionUsingTypeArguments(y,[],f.makeMap(e.contextualTypeArguments),y.declaration.name);break;case _.ElementKind.FIELD_PROTOTYPE:y.set(u.CommonFlags.COMPILED);break;case _.ElementKind.PROPERTY:var m,T;(m=y.getterInstance)&&this.compileFunction(m),(T=y.setterInstance)&&this.compileFunction(T)}}}catch(e){n={error:e}}finally{try{d&&!d.done&&(i=h.return)&&i.call(h)}finally{if(n)throw n.error}}return!0},r.prototype.compileInterfaceDeclaration=function(e,r,t,n){void 0===t&&(t=null),void 0===n&&(n=null),this.error(l.DiagnosticCode.Operation_not_supported,e.range)},r.prototype.addMemorySegment=function(e,r){void 0===r&&(r=8);var t=i64_align(this.memoryOffset,r),n=p.MemorySegment.create(e,t);return this.memorySegments.push(n),this.memoryOffset=i64_add(t,i64_new(e.length,0)),n},r.prototype.ensureFunctionTableEntry=function(e){if(assert(e.is(u.CommonFlags.COMPILED)),e.functionTableIndex>=0)return e.functionTableIndex;var r=this.functionTable,t=r.length;return!e.is(u.CommonFlags.TRAMPOLINE)&&e.signature.requiredParameters<e.signature.parameterTypes.length&&(e=this.ensureTrampoline(e)),r.push(e.internalName),e.functionTableIndex=t,t},r.prototype.compileTopLevelStatement=function(e,r){switch(e.kind){case m.NodeKind.CLASSDECLARATION:for(var t=0,n=(a=e.members).length;t<n;++t)this.compileTopLevelStatement(a[t],r);break;case m.NodeKind.ENUMDECLARATION:var i=this.program.getElementByDeclaration(e);assert(i.kind==_.ElementKind.ENUM),i.hasDecorator(_.DecoratorFlags.LAZY)||this.compileEnum(i);break;case m.NodeKind.NAMESPACEDECLARATION:var a;for(t=0,n=(a=e.members).length;t<n;++t)this.compileTopLevelStatement(a[t],r);break;case m.NodeKind.VARIABLE:var s=e.declarations;for(t=0,n=s.length;t<n;++t){i=this.program.getElementByDeclaration(s[t]);assert(i.kind==_.ElementKind.GLOBAL),i.is(u.CommonFlags.AMBIENT)||i.hasDecorator(_.DecoratorFlags.LAZY)||this.compileGlobal(i)}break;case m.NodeKind.FIELDDECLARATION:(i=this.program.getElementByDeclaration(e)).kind==_.ElementKind.GLOBAL&&(i.hasDecorator(_.DecoratorFlags.LAZY)||this.compileGlobal(i));break;case m.NodeKind.EXPORT:null!=e.normalizedPath&&this.compileFileByPath(e.normalizedPath,e.path);break;case m.NodeKind.IMPORT:this.compileFileByPath(e.normalizedPath,e.path);break;case m.NodeKind.FUNCTIONDECLARATION:case m.NodeKind.METHODDECLARATION:case m.NodeKind.INTERFACEDECLARATION:case m.NodeKind.INDEXSIGNATUREDECLARATION:case m.NodeKind.TYPEDECLARATION:break;default:var o=this.compileStatement(e);p.getExpressionId(o)!=p.ExpressionId.Nop&&r.push(o)}},r.prototype.compileStatement=function(e,r){void 0===r&&(r=!1);var t,n=this.module;switch(e.kind){case m.NodeKind.BLOCK:t=this.compileBlockStatement(e);break;case m.NodeKind.BREAK:t=this.compileBreakStatement(e);break;case m.NodeKind.CONTINUE:t=this.compileContinueStatement(e);break;case m.NodeKind.DO:t=this.compileDoStatement(e);break;case m.NodeKind.EMPTY:t=this.compileEmptyStatement(e);break;case m.NodeKind.EXPRESSION:t=this.compileExpressionStatement(e);break;case m.NodeKind.FOR:t=this.compileForStatement(e);break;case m.NodeKind.IF:t=this.compileIfStatement(e);break;case m.NodeKind.RETURN:t=this.compileReturnStatement(e,r);break;case m.NodeKind.SWITCH:t=this.compileSwitchStatement(e);break;case m.NodeKind.THROW:t=this.compileThrowStatement(e);break;case m.NodeKind.TRY:t=this.compileTryStatement(e);break;case m.NodeKind.VARIABLE:(t=this.compileVariableStatement(e))||(t=n.createNop());break;case m.NodeKind.VOID:t=this.compileVoidStatement(e);break;case m.NodeKind.WHILE:t=this.compileWhileStatement(e);break;case m.NodeKind.TYPEDECLARATION:this.error(l.DiagnosticCode.Operation_not_supported,e.range),t=n.createUnreachable();break;default:assert(!1),t=n.createUnreachable()}return this.options.sourceMap&&this.addDebugLocation(t,e.range),t},r.prototype.compileStatements=function(e,r){void 0===r&&(r=!1);var t=e.length,n=new Array(t);n.length=0;for(var i=this.currentFlow,a=0;a<t;++a){var s=this.compileStatement(e[a],r&&a==t-1);switch(p.getExpressionId(s)){case p.ExpressionId.Block:if(!p.getBlockName(s)){for(var o=0,c=p.getBlockChildCount(s);o<c;++o)n.push(p.getBlockChild(s,o));break}default:n.push(s);case p.ExpressionId.Nop:}if(i.isAny(29)){p.needsExplicitUnreachable(s)&&n.push(this.module.createUnreachable());break}}return n},r.prototype.compileBlockStatement=function(e){var r=e.statements,t=this.currentFlow,n=t.fork();this.currentFlow=n;var i=this.compileStatements(r),a=0==i.length?this.module.createNop():1==i.length?i[0]:this.module.createBlock(null,i,p.getExpressionType(i[i.length-1]));return n.freeScopedLocals(),t.inherit(n),this.currentFlow=t,a},r.prototype.compileBreakStatement=function(e){var r=this.module;if(e.label)return this.error(l.DiagnosticCode.Operation_not_supported,e.label.range),r.createUnreachable();var t=this.currentFlow,n=t.breakLabel;return null==n?(this.error(l.DiagnosticCode.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement,e.range),r.createUnreachable()):(t.set(8),r.createBreak(n))},r.prototype.compileContinueStatement=function(e){var r=this.module,t=e.label;if(t)return this.error(l.DiagnosticCode.Operation_not_supported,t.range),r.createUnreachable();var n=this.currentFlow,i=n.continueLabel;return null==i?(this.error(l.DiagnosticCode.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement,e.range),r.createUnreachable()):(n.set(16),r.createBreak(i))},r.prototype.compileDoStatement=function(e){var r=this.module,t=this.currentFlow,n=t.pushBreakLabel(),i=t.fork();this.currentFlow=i;var a="break|"+n;i.breakLabel=a;var s="continue|"+n;i.continueLabel=s;var o=this.compileStatement(e.statement),c=this.makeIsTrueish(this.compileExpression(e.condition,T.Type.i32,0,0),this.currentType);i.freeScopedLocals(),t.popBreakLabel(),this.currentFlow=t;var l=i.isAny(29);i.unset(1560),t.inherit(i);var u=[r.createLoop(s,l?o:r.createBlock(null,[o,r.createBreak(s,c)],p.NativeType.None))];return l&&u.push(r.createUnreachable()),r.createBlock(a,u)},r.prototype.compileEmptyStatement=function(e){return this.module.createNop()},r.prototype.compileExpressionStatement=function(e){var r=this.compileExpression(e.expression,T.Type.void,0,0);return this.currentType!=T.Type.void&&(r=this.module.createDrop(r),this.currentType=T.Type.void),r},r.prototype.compileForStatement=function(e){var r=this.currentFlow,t=r.pushBreakLabel(),n=r.fork();this.currentFlow=n;var i=n.breakLabel="break|"+t;n.breakLabel=i;var a="continue|"+t;n.continueLabel=a;var s="repeat|"+t,o=this.module,c=e.initializer?this.compileStatement(e.initializer):0,l=0,u=!1;if(e.condition){l=this.makeIsTrueish(this.compileExpressionRetainType(e.condition,T.Type.bool,0),this.currentType);var _=o.precomputeExpression(l);p.getExpressionId(_)==p.ExpressionId.Const&&(assert(p.getExpressionType(_)==p.NativeType.I32),0!=p.getConstValueI32(_)&&(u=!0)),l=this.makeIsTrueish(this.compileExpressionRetainType(e.condition,T.Type.bool,0),this.currentType)}else l=o.createI32(1),u=!0;var h=e.incrementor?this.compileExpression(e.incrementor,T.Type.void,1,0):0,d=e.statement,y=d.kind==m.NodeKind.BLOCK&&1==d.statements.length?this.compileStatement(d.statements[0]):this.compileStatement(d);n.freeScopedLocals(),r.popBreakLabel(),this.currentFlow=r;var f=n.isAny(1040);n.unset(1560),u?r.inherit(n):r.inheritConditional(n);var E=new Array;c&&E.push(c);var g=new Array;return f?g.push(o.createBlock(a,[o.createBreak(i,o.createUnary(p.UnaryOp.EqzI32,l)),y],p.NativeType.None)):(g.push(o.createBreak(i,o.createUnary(p.UnaryOp.EqzI32,l))),g.push(y)),h&&g.push(h),g.push(o.createBreak(s)),E.push(o.createLoop(s,o.createBlock(null,g,p.NativeType.None))),o.createBlock(i,E)},r.prototype.compileIfStatement=function(e){var r=this.module,t=e.ifTrue,n=e.ifFalse,i=this.currentFlow,a=(i.actualFunction,this.makeIsTrueish(this.compileExpressionRetainType(e.condition,T.Type.bool,0),this.currentType)),s=r.precomputeExpression(a);if(p.getExpressionId(s)==p.ExpressionId.Const&&p.getExpressionType(s)==p.NativeType.I32)return p.getConstValueI32(s)?this.compileStatement(t):n?this.compileStatement(n):r.createNop();a=this.makeIsTrueish(this.compileExpressionRetainType(e.condition,T.Type.bool,0),this.currentType);var o=i.fork();this.currentFlow=o;var c=this.compileStatement(t);o.freeScopedLocals(),this.currentFlow=i;var l=0;if(n){var u=i.fork();this.currentFlow=u,l=this.compileStatement(n),u.freeScopedLocals(),this.currentFlow=i,i.inheritMutual(o,u)}else i.inheritConditional(o);return r.createIf(a,c,l)},r.prototype.compileReturnStatement=function(e,r){var t=this.module,n=0,i=this.currentFlow,a=i.returnType;if(i.set(1),e.value){if(a==T.Type.void)return this.compileExpressionRetainType(e.value,a,0),this.error(l.DiagnosticCode.Type_0_is_not_assignable_to_type_1,e.value.range,this.currentType.toString(),a.toString()),this.currentType=T.Type.void,t.createUnreachable();n=this.compileExpression(e.value,a,1,i.actualFunction.is(u.CommonFlags.MODULE_EXPORT)?1:0),i.canOverflow(n,a)||i.set(2)}else a!=T.Type.void&&(this.error(l.DiagnosticCode.Type_0_is_not_assignable_to_type_1,e.range,"void",a.toString()),n=t.createUnreachable());return r?n||t.createNop():i.is(4096)?t.createBreak(assert(i.inlineReturnLabel),0,n):t.createReturn(n)},r.prototype.compileSwitchStatement=function(e){var r=this.module,t=e.cases,n=t.length;if(!n)return this.compileExpression(e.condition,T.Type.void,1,0);var i=this.currentFlow,a=i.pushBreakLabel(),s=i.getTempLocal(T.Type.u32,!1),o=s.index,c=new Array(1+n);c[0]=r.createSetLocal(o,this.compileExpression(e.condition,T.Type.u32,1,0));for(var l=1,u=-1,_=0;_<n;++_){var h=t[_].label;h?c[l++]=r.createBreak("case"+_.toString(10)+"|"+a,r.createBinary(p.BinaryOp.EqI32,r.createGetLocal(o,p.NativeType.I32),this.compileExpression(h,T.Type.u32,1,0))):u=_}i.freeTempLocal(s),c[l]=r.createBreak((u>=0?"case"+u.toString(10):"break")+"|"+a);var d=r.createBlock("case0|"+a,c,p.NativeType.None),y=!0,m=!0,f=!0,E=!0;for(_=0;_<n;++_){var g=t[_].statements,v=g.length,I=i.fork();this.currentFlow=I;var b="break|"+a;I.breakLabel=b;var x=_==n-1,S=x?b:"case"+(_+1).toString(10)+"|"+a,A=new Array(1+v);A[0]=d;for(var N=1,O=!1,C=0;C<v;++C){var k=this.compileStatement(g[C]);if(p.getExpressionId(k)!=p.ExpressionId.Nop&&(A[N++]=k,I.isAny(29))){O=!0;break}}A.length=N,(O||x)&&(I.is(1)||(y=!1),I.is(2)||(m=!1),I.is(4)||(f=!1),I.is(32)||(E=!1)),I.unset(520),I.freeScopedLocals(),this.currentFlow=i,d=r.createBlock(S,A,p.NativeType.None)}return i.popBreakLabel(),u>=0&&(y&&i.set(1),m&&i.set(2),f&&i.set(4),E&&i.set(32)),d},r.prototype.compileThrowStatement=function(e){var r=this.currentFlow;return r.set(4),r.set(1),c.compileAbort(this,null,e)},r.prototype.compileTryStatement=function(e){return this.error(l.DiagnosticCode.Operation_not_supported,e.range),this.module.createUnreachable()},r.prototype.compileVariableStatement=function(e){for(var r=e.declarations,t=r.length,n=this.currentFlow,i=new Array,a=this.resolver,s=0;s<t;++s){var o=r[s],c=o.name.text,h=null,d=0;if(o.type){if(!(h=a.resolveType(o.type,n.actualFunction,n.contextualTypeArguments)))continue;o.initializer&&(d=this.compileExpression(o.initializer,h,1,0))}else{if(!o.initializer){this.error(l.DiagnosticCode.Type_expected,o.name.range.atEnd);continue}if(d=this.compileExpressionRetainType(o.initializer,T.Type.void,0),this.currentType==T.Type.void){this.error(l.DiagnosticCode.Type_0_is_not_assignable_to_type_1,o.range,this.currentType.toString(),"<auto>");continue}h=this.currentType}var y=!1;if(o.is(u.CommonFlags.CONST))if(d)if(d=this.module.precomputeExpression(d),p.getExpressionId(d)==p.ExpressionId.Const){var m=new _.Local(c,-1,h,n.parentFunction);switch(p.getExpressionType(d)){case p.NativeType.I32:m.setConstantIntegerValue(i64_new(p.getConstValueI32(d),0),h);break;case p.NativeType.I64:m.setConstantIntegerValue(i64_new(p.getConstValueI64Low(d),p.getConstValueI64High(d)),h);break;case p.NativeType.F32:m.setConstantFloatValue(p.getConstValueF32(d),h);break;case p.NativeType.F64:m.setConstantFloatValue(p.getConstValueF64(d),h);break;default:return assert(!1),this.module.createUnreachable()}var f=n.scopedLocals;if(f){if(f.has(c))return this.error(l.DiagnosticCode.Duplicate_identifier_0,o.name.range,c),this.module.createUnreachable()}else n.scopedLocals=f=new Map;f.set(c,m),y=!0}else this.warning(l.DiagnosticCode.Compiling_constant_with_non_constant_initializer_as_mutable,o.range);else this.error(l.DiagnosticCode._const_declarations_must_be_initialized,o.range);if(!y){m=void 0;if(o.isAny(u.CommonFlags.LET|u.CommonFlags.CONST)||n.is(4096))m=n.addScopedLocal(c,h,!1,o.name);else{if(n.lookupLocal(c)){this.error(l.DiagnosticCode.Duplicate_identifier_0,o.name.range,c);continue}m=n.parentFunction.addLocal(h,c,o)}d?(i.push(this.compileAssignmentWithValue(o.name,d)),m.type.is(36)&&n.setLocalWrapped(m.index,!n.canOverflow(d,h))):m.type.is(36)&&n.setLocalWrapped(m.index,!0)}}return i.length?1==i.length?i[0]:this.module.createBlock(null,i,p.NativeType.None):0},r.prototype.compileVoidStatement=function(e){return this.compileExpression(e.expression,T.Type.void,2,0)},r.prototype.compileWhileStatement=function(e){var r=this.module,t=this.currentFlow,n=this.makeIsTrueish(this.compileExpressionRetainType(e.condition,T.Type.bool,0),this.currentType),i=r.precomputeExpression(n);if(p.getExpressionId(i)==p.ExpressionId.Const&&p.getExpressionType(i)==p.NativeType.I32){if(!p.getConstValueI32(i))return r.createNop()}else n=this.makeIsTrueish(this.compileExpressionRetainType(e.condition,T.Type.bool,0),this.currentType);var a=t.pushBreakLabel(),s=t.fork();this.currentFlow=s;var o="break|"+a;s.breakLabel=o;var c="continue|"+a;s.continueLabel=c;var l=this.compileStatement(e.statement),u=s.isAny(29);return s.freeScopedLocals(),t.popBreakLabel(),this.currentFlow=t,s.unset(1560),t.inheritConditional(s),r.createBlock(o,[r.createLoop(c,r.createIf(n,u?l:r.createBlock(null,[l,r.createBreak(c)],p.NativeType.None)))])},r.prototype.compileInlineConstant=function(e,r,t){assert(e.is(u.CommonFlags.INLINED));var n=e.type;switch(!t&&n.is(4)&&r.is(4)&&n.size<r.size?(this.currentType=r).kind:(this.currentType=n).kind){case 0:case 1:var i=n.computeSmallIntegerShift(T.Type.i32);return this.module.createI32(1==e.constantValueKind?i64_low(e.constantIntegerValue)<<i>>i:0);case 5:case 6:case 10:var a=e.type.computeSmallIntegerMask(T.Type.i32);return this.module.createI32(1==e.constantValueKind?i64_low(e.constantIntegerValue)&a:0);case 2:case 7:return this.module.createI32(1==e.constantValueKind?i64_low(e.constantIntegerValue):0);case 4:case 9:if(!e.program.options.isWasm64)return this.module.createI32(1==e.constantValueKind?i64_low(e.constantIntegerValue):0);case 3:case 8:return 1==e.constantValueKind?this.module.createI64(i64_low(e.constantIntegerValue),i64_high(e.constantIntegerValue)):this.module.createI64(0);case 12:if(!e.hasDecorator(_.DecoratorFlags.BUILTIN)||r!=T.Type.f32)return this.module.createF64(e.constantFloatValue);this.currentType=T.Type.f32;case 11:return this.module.createF32(e.constantFloatValue);default:return assert(!1),this.module.createUnreachable()}},r.prototype.compileExpression=function(e,r,t,n){var i;switch(this.currentType=r,e.kind){case m.NodeKind.ASSERTION:i=this.compileAssertionExpression(e,r);break;case m.NodeKind.BINARY:i=this.compileBinaryExpression(e,r);break;case m.NodeKind.CALL:i=this.compileCallExpression(e,r);break;case m.NodeKind.COMMA:i=this.compileCommaExpression(e,r);break;case m.NodeKind.ELEMENTACCESS:i=this.compileElementAccessExpression(e,r);break;case m.NodeKind.FUNCTION:i=this.compileFunctionExpression(e,r.signatureReference);break;case m.NodeKind.IDENTIFIER:case m.NodeKind.FALSE:case m.NodeKind.NULL:case m.NodeKind.THIS:case m.NodeKind.SUPER:case m.NodeKind.TRUE:i=this.compileIdentifierExpression(e,r,0==t);break;case m.NodeKind.INSTANCEOF:i=this.compileInstanceOfExpression(e,r);break;case m.NodeKind.LITERAL:i=this.compileLiteralExpression(e,r);break;case m.NodeKind.NEW:i=this.compileNewExpression(e,r);break;case m.NodeKind.PARENTHESIZED:i=this.compileParenthesizedExpression(e,r);break;case m.NodeKind.PROPERTYACCESS:i=this.compilePropertyAccessExpression(e,r,0==t);break;case m.NodeKind.TERNARY:i=this.compileTernaryExpression(e,r);break;case m.NodeKind.UNARYPOSTFIX:i=this.compileUnaryPostfixExpression(e,r);break;case m.NodeKind.UNARYPREFIX:i=this.compileUnaryPrefixExpression(e,r);break;default:this.error(l.DiagnosticCode.Operation_not_supported,e.range),i=this.module.createUnreachable()}var a=this.currentType;return 0!=t&&a!=r?(i=this.convertExpression(i,a,r,t,n,e),this.currentType=r):1==n&&(i=this.ensureSmallIntegerWrap(i,a)),this.options.sourceMap&&this.addDebugLocation(i,e.range),i},r.prototype.compileExpressionRetainType=function(e,r,t){return this.compileExpression(e,r==T.Type.void?T.Type.i32:r,0,t)},r.prototype.precomputeExpression=function(e,r,t,n){return this.module.precomputeExpression(this.compileExpression(e,r,t,n))},r.prototype.convertExpression=function(e,r,t,n,i,a){assert(0!=n);var s=this.module;return 14==r.kind?(assert(14!=t.kind),this.error(l.DiagnosticCode.Type_0_is_not_assignable_to_type_1,a.range,r.toString(),t.toString()),s.createUnreachable()):14==t.kind?s.createDrop(e):(r.isAssignableTo(t)||1==n&&this.error(l.DiagnosticCode.Conversion_from_type_0_to_1_requires_an_explicit_cast,a.range,r.toString(),t.toString()),r.is(8)?t.is(8)?11==r.kind?12==t.kind&&(e=s.createUnary(p.UnaryOp.PromoteF32,e)):11==t.kind&&(e=s.createUnary(p.UnaryOp.DemoteF64,e)):t.is(4)?11==r.kind?t==T.Type.bool?(e=s.createBinary(p.BinaryOp.NeF32,e,s.createF32(0)),i=0):e=t.is(1)?t.is(64)?s.createUnary(p.UnaryOp.TruncF32ToI64,e):s.createUnary(p.UnaryOp.TruncF32ToI32,e):t.is(64)?s.createUnary(p.UnaryOp.TruncF32ToU64,e):s.createUnary(p.UnaryOp.TruncF32ToU32,e):t==T.Type.bool?(e=s.createBinary(p.BinaryOp.NeF64,e,s.createF64(0)),i=0):e=t.is(1)?t.is(64)?s.createUnary(p.UnaryOp.TruncF64ToI64,e):s.createUnary(p.UnaryOp.TruncF64ToI32,e):t.is(64)?s.createUnary(p.UnaryOp.TruncF64ToU64,e):s.createUnary(p.UnaryOp.TruncF64ToU32,e):(assert(0==t.flags,"void type expected"),e=s.createDrop(e)):r.is(4)&&t.is(8)?e=11==t.kind?r.is(64)?s.createUnary(r.is(1)?p.UnaryOp.ConvertI64ToF32:p.UnaryOp.ConvertU64ToF32,e):s.createUnary(r.is(1)?p.UnaryOp.ConvertI32ToF32:p.UnaryOp.ConvertU32ToF32,e):r.is(64)?s.createUnary(r.is(1)?p.UnaryOp.ConvertI64ToF64:p.UnaryOp.ConvertU64ToF64,e):s.createUnary(r.is(1)?p.UnaryOp.ConvertI32ToF64:p.UnaryOp.ConvertU32ToF64,e):r.is(64)?t==T.Type.bool?(e=s.createBinary(p.BinaryOp.NeI64,e,s.createI64(0)),i=0):t.is(64)||(e=s.createUnary(p.UnaryOp.WrapI64,e)):t.is(64)?(e=s.createUnary(r.is(1)?p.UnaryOp.ExtendI32:p.UnaryOp.ExtendU32,this.ensureSmallIntegerWrap(e,r)),i=0):r.is(32)&&r.size<t.size&&(e=this.ensureSmallIntegerWrap(e,r),i=0),this.currentType=t,1==i?this.ensureSmallIntegerWrap(e,t):e)},r.prototype.compileAssertionExpression=function(e,r){switch(e.assertionKind){case m.AssertionKind.PREFIX:case m.AssertionKind.AS:var t=this.resolver.resolveType(assert(e.toType),this.currentFlow.actualFunction,this.currentFlow.contextualTypeArguments);return t?this.compileExpression(e.expression,t,2,0):this.module.createUnreachable();case m.AssertionKind.NONNULL:assert(!e.toType);var n=this.compileExpressionRetainType(e.expression,r,0);return this.currentType=this.currentType.nonNullableType,n;default:assert(!1)}return this.module.createUnreachable()},r.prototype.compileBinaryExpression=function(e,r){var t,n,i,a,s,o,c=this.module,h=e.left,d=e.right,m=!1,f=e.operator;switch(f){case y.Token.LESSTHAN:if(t=this.compileExpressionRetainType(h,r,0),n=this.currentType,this.currentType.is(256)){if(I=n.classReference)if(b=I.lookupOverload(_.OperatorKind.LT)){o=this.compileBinaryOverload(b,h,t,d,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),this.module.createUnreachable()}if(i=this.compileExpressionRetainType(d,n,0),a=this.currentType,!(s=T.Type.commonDenominator(n,a,!0)))return this.error(l.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,"<",n.toString(),a.toString()),this.currentType=r,c.createUnreachable();switch(t=this.convertExpression(t,n,n=s,1,1,h),i=this.convertExpression(i,a,a=s,1,1,d),s.kind){case 0:case 1:case 2:o=c.createBinary(p.BinaryOp.LtI32,t,i);break;case 3:o=c.createBinary(p.BinaryOp.LtI64,t,i);break;case 4:o=c.createBinary(this.options.isWasm64?p.BinaryOp.LtI64:p.BinaryOp.LtI32,t,i);break;case 5:case 6:case 7:case 10:o=c.createBinary(p.BinaryOp.LtU32,t,i);break;case 9:o=c.createBinary(this.options.isWasm64?p.BinaryOp.LtU64:p.BinaryOp.LtU32,t,i);break;case 8:o=c.createBinary(p.BinaryOp.LtU64,t,i);break;case 11:o=c.createBinary(p.BinaryOp.LtF32,t,i);break;case 12:o=c.createBinary(p.BinaryOp.LtF64,t,i);break;default:assert(!1),o=c.createUnreachable()}this.currentType=T.Type.bool;break;case y.Token.GREATERTHAN:if(t=this.compileExpressionRetainType(h,r,0),n=this.currentType,this.currentType.is(256)){if(I=n.classReference)if(b=I.lookupOverload(_.OperatorKind.GT)){o=this.compileBinaryOverload(b,h,t,d,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),this.module.createUnreachable()}if(i=this.compileExpressionRetainType(d,n,0),a=this.currentType,!(s=T.Type.commonDenominator(n,a,!0)))return this.error(l.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,">",n.toString(),a.toString()),this.currentType=r,c.createUnreachable();switch(t=this.convertExpression(t,n,n=s,1,1,h),i=this.convertExpression(i,a,a=s,1,1,d),s.kind){case 0:case 1:case 2:o=c.createBinary(p.BinaryOp.GtI32,t,i);break;case 4:o=c.createBinary(this.options.isWasm64?p.BinaryOp.GtI64:p.BinaryOp.GtI32,t,i);break;case 3:o=c.createBinary(p.BinaryOp.GtI64,t,i);break;case 5:case 6:case 7:case 10:o=c.createBinary(p.BinaryOp.GtU32,t,i);break;case 9:o=c.createBinary(this.options.isWasm64?p.BinaryOp.GtU64:p.BinaryOp.GtU32,t,i);break;case 8:o=c.createBinary(p.BinaryOp.GtU64,t,i);break;case 11:o=c.createBinary(p.BinaryOp.GtF32,t,i);break;case 12:o=c.createBinary(p.BinaryOp.GtF64,t,i);break;default:assert(!1),o=c.createUnreachable()}this.currentType=T.Type.bool;break;case y.Token.LESSTHAN_EQUALS:if(t=this.compileExpressionRetainType(h,r,0),n=this.currentType,this.currentType.is(256)){if(I=n.classReference)if(b=I.lookupOverload(_.OperatorKind.LE)){o=this.compileBinaryOverload(b,h,t,d,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),this.module.createUnreachable()}if(i=this.compileExpressionRetainType(d,n,0),a=this.currentType,!(s=T.Type.commonDenominator(n,a,!0)))return this.error(l.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,"<=",n.toString(),a.toString()),this.currentType=r,c.createUnreachable();switch(t=this.convertExpression(t,n,n=s,1,1,h),i=this.convertExpression(i,a,a=s,1,1,d),s.kind){case 0:case 1:case 2:o=c.createBinary(p.BinaryOp.LeI32,t,i);break;case 4:o=c.createBinary(this.options.isWasm64?p.BinaryOp.LeI64:p.BinaryOp.LeI32,t,i);break;case 3:o=c.createBinary(p.BinaryOp.LeI64,t,i);break;case 5:case 6:case 7:case 10:o=c.createBinary(p.BinaryOp.LeU32,t,i);break;case 9:o=c.createBinary(this.options.isWasm64?p.BinaryOp.LeU64:p.BinaryOp.LeU32,t,i);break;case 8:o=c.createBinary(p.BinaryOp.LeU64,t,i);break;case 11:o=c.createBinary(p.BinaryOp.LeF32,t,i);break;case 12:o=c.createBinary(p.BinaryOp.LeF64,t,i);break;default:assert(!1),o=c.createUnreachable()}this.currentType=T.Type.bool;break;case y.Token.GREATERTHAN_EQUALS:if(t=this.compileExpressionRetainType(h,r,0),n=this.currentType,this.currentType.is(256)){if(I=n.classReference)if(b=I.lookupOverload(_.OperatorKind.GE)){o=this.compileBinaryOverload(b,h,t,d,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),this.module.createUnreachable()}if(i=this.compileExpressionRetainType(d,n,0),a=this.currentType,!(s=T.Type.commonDenominator(n,a,!0)))return this.error(l.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,">=",n.toString(),a.toString()),this.currentType=r,c.createUnreachable();switch(t=this.convertExpression(t,n,n=s,1,1,h),i=this.convertExpression(i,a,a=s,1,1,d),s.kind){case 0:case 1:case 2:o=c.createBinary(p.BinaryOp.GeI32,t,i);break;case 4:o=c.createBinary(this.options.isWasm64?p.BinaryOp.GeI64:p.BinaryOp.GeI32,t,i);break;case 3:o=c.createBinary(p.BinaryOp.GeI64,t,i);break;case 5:case 6:case 7:case 10:o=c.createBinary(p.BinaryOp.GeU32,t,i);break;case 9:o=c.createBinary(this.options.isWasm64?p.BinaryOp.GeU64:p.BinaryOp.GeU32,t,i);break;case 8:o=c.createBinary(p.BinaryOp.GeU64,t,i);break;case 11:o=c.createBinary(p.BinaryOp.GeF32,t,i);break;case 12:o=c.createBinary(p.BinaryOp.GeF64,t,i);break;default:assert(!1),o=c.createUnreachable()}this.currentType=T.Type.bool;break;case y.Token.EQUALS_EQUALS_EQUALS:case y.Token.EQUALS_EQUALS:if(t=this.compileExpressionRetainType(h,r,0),n=this.currentType,f==y.Token.EQUALS_EQUALS&&this.currentType.is(256))if(I=n.classReference)if(b=I.lookupOverload(_.OperatorKind.EQ)){o=this.compileBinaryOverload(b,h,t,d,e);break}if(i=this.compileExpressionRetainType(d,n,0),a=this.currentType,!(s=T.Type.commonDenominator(n,a,!1)))return this.error(l.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,y.operatorTokenToString(e.operator),n.toString(),a.toString()),this.currentType=r,c.createUnreachable();switch(t=this.convertExpression(t,n,n=s,1,1,h),i=this.convertExpression(i,a,a=s,1,1,d),s.kind){case 0:case 1:case 2:case 5:case 6:case 7:case 10:o=c.createBinary(p.BinaryOp.EqI32,t,i);break;case 9:case 4:o=c.createBinary(this.options.isWasm64?p.BinaryOp.EqI64:p.BinaryOp.EqI32,t,i);break;case 3:case 8:o=c.createBinary(p.BinaryOp.EqI64,t,i);break;case 11:o=c.createBinary(p.BinaryOp.EqF32,t,i);break;case 12:o=c.createBinary(p.BinaryOp.EqF64,t,i);break;case 13:o=c.createUnary(p.UnaryOp.AllTrueVecI8x16,c.createBinary(p.BinaryOp.EqVecI8x16,t,i));break;default:assert(!1),o=c.createUnreachable()}this.currentType=T.Type.bool;break;case y.Token.EXCLAMATION_EQUALS_EQUALS:case y.Token.EXCLAMATION_EQUALS:if(t=this.compileExpressionRetainType(h,r,0),n=this.currentType,f==y.Token.EXCLAMATION_EQUALS&&this.currentType.is(256))if(I=n.classReference)if(b=I.lookupOverload(_.OperatorKind.NE)){o=this.compileBinaryOverload(b,h,t,d,e);break}if(i=this.compileExpressionRetainType(d,n,0),a=this.currentType,!(s=T.Type.commonDenominator(n,a,!1)))return this.error(l.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,y.operatorTokenToString(e.operator),n.toString(),a.toString()),this.currentType=r,c.createUnreachable();switch(t=this.convertExpression(t,n,n=s,1,1,h),i=this.convertExpression(i,a,a=s,1,1,d),s.kind){case 0:case 1:case 2:case 5:case 6:case 7:case 10:o=c.createBinary(p.BinaryOp.NeI32,t,i);break;case 9:case 4:o=c.createBinary(this.options.isWasm64?p.BinaryOp.NeI64:p.BinaryOp.NeI32,t,i);break;case 3:case 8:o=c.createBinary(p.BinaryOp.NeI64,t,i);break;case 11:o=c.createBinary(p.BinaryOp.NeF32,t,i);break;case 12:o=c.createBinary(p.BinaryOp.NeF64,t,i);break;case 13:o=c.createUnary(p.UnaryOp.AnyTrueVecI8x16,c.createBinary(p.BinaryOp.NeVecI8x16,t,i));break;default:assert(!1),o=c.createUnreachable()}this.currentType=T.Type.bool;break;case y.Token.EQUALS:return this.compileAssignment(h,d,r);case y.Token.PLUS_EQUALS:m=!0;case y.Token.PLUS:if(t=this.compileExpressionRetainType(h,r,0),n=this.currentType,this.currentType.is(256)){if(I=n.classReference)if(b=I.lookupOverload(_.OperatorKind.ADD)){o=this.compileBinaryOverload(b,h,t,d,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),this.module.createUnreachable()}if(m)i=this.compileExpression(d,n,1,0);else{if(i=this.compileExpressionRetainType(d,n,0),a=this.currentType,!(s=T.Type.commonDenominator(n,a,!1)))return this.error(l.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,"+",n.toString(),a.toString()),this.currentType=r,c.createUnreachable();t=this.convertExpression(t,n,n=s,1,0,h),i=this.convertExpression(i,a,a=s,1,0,d)}switch(this.currentType.kind){case 0:case 1:case 5:case 6:case 10:case 2:case 7:o=c.createBinary(p.BinaryOp.AddI32,t,i);break;case 9:case 4:o=c.createBinary(this.options.isWasm64?p.BinaryOp.AddI64:p.BinaryOp.AddI32,t,i);break;case 3:case 8:o=c.createBinary(p.BinaryOp.AddI64,t,i);break;case 11:o=c.createBinary(p.BinaryOp.AddF32,t,i);break;case 12:o=c.createBinary(p.BinaryOp.AddF64,t,i);break;default:assert(!1),o=c.createUnreachable()}break;case y.Token.MINUS_EQUALS:m=!0;case y.Token.MINUS:if(t=this.compileExpressionRetainType(h,r,0),n=this.currentType,this.currentType.is(256)){if(I=n.classReference)if(b=I.lookupOverload(_.OperatorKind.SUB)){o=this.compileBinaryOverload(b,h,t,d,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),this.module.createUnreachable()}if(m)i=this.compileExpression(d,n,1,0),a=this.currentType;else{if(i=this.compileExpressionRetainType(d,n,0),a=this.currentType,!(s=T.Type.commonDenominator(n,a,!1)))return this.error(l.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,"-",n.toString(),a.toString()),this.currentType=r,c.createUnreachable();t=this.convertExpression(t,n,n=s,1,0,h),i=this.convertExpression(i,a,a=s,1,0,d)}switch(this.currentType.kind){case 0:case 1:case 5:case 6:case 10:case 2:case 7:o=c.createBinary(p.BinaryOp.SubI32,t,i);break;case 9:case 4:o=c.createBinary(this.options.isWasm64?p.BinaryOp.SubI64:p.BinaryOp.SubI32,t,i);break;case 3:case 8:o=c.createBinary(p.BinaryOp.SubI64,t,i);break;case 11:o=c.createBinary(p.BinaryOp.SubF32,t,i);break;case 12:o=c.createBinary(p.BinaryOp.SubF64,t,i);break;default:assert(!1),o=c.createUnreachable()}break;case y.Token.ASTERISK_EQUALS:m=!0;case y.Token.ASTERISK:if(t=this.compileExpressionRetainType(h,r,0),n=this.currentType,this.currentType.is(256)){if(I=n.classReference)if(b=I.lookupOverload(_.OperatorKind.MUL)){o=this.compileBinaryOverload(b,h,t,d,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),this.module.createUnreachable()}if(m)t=this.ensureSmallIntegerWrap(t,n),i=this.compileExpression(d,n,1,1);else{if(i=this.compileExpressionRetainType(d,n,0),a=this.currentType,!(s=T.Type.commonDenominator(n,a,!1)))return this.error(l.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,"*",n.toString(),a.toString()),this.currentType=r,c.createUnreachable();t=this.convertExpression(t,n,n=s,1,0,h),i=this.convertExpression(i,a,a=s,1,0,d)}switch(this.currentType.kind){case 0:case 1:case 5:case 6:case 10:case 2:case 7:o=c.createBinary(p.BinaryOp.MulI32,t,i);break;case 9:case 4:o=c.createBinary(this.options.isWasm64?p.BinaryOp.MulI64:p.BinaryOp.MulI32,t,i);break;case 3:case 8:o=c.createBinary(p.BinaryOp.MulI64,t,i);break;case 11:o=c.createBinary(p.BinaryOp.MulF32,t,i);break;case 12:o=c.createBinary(p.BinaryOp.MulF64,t,i);break;default:assert(!1),o=c.createUnreachable()}break;case y.Token.ASTERISK_ASTERISK_EQUALS:m=!0;case y.Token.ASTERISK_ASTERISK:if(t=this.compileExpressionRetainType(h,r,0),n=this.currentType,this.currentType.is(256)){if(I=n.classReference)if(b=I.lookupOverload(_.OperatorKind.POW)){o=this.compileBinaryOverload(b,h,t,d,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),this.module.createUnreachable()}var E=void 0;if(11==this.currentType.kind){if(i=this.compileExpression(d,T.Type.f32,1,0),a=this.currentType,!(E=this.f32PowInstance)){if(!(g=this.program.lookupGlobal(u.LibrarySymbols.Mathf))){this.error(l.DiagnosticCode.Cannot_find_name_0,e.range,"Mathf"),o=c.createUnreachable();break}if(!(v=g.members?g.members.get(u.LibrarySymbols.pow):null)){this.error(l.DiagnosticCode.Cannot_find_name_0,e.range,"Mathf.pow"),o=c.createUnreachable();break}assert(v.kind==_.ElementKind.FUNCTION_PROTOTYPE),this.f32PowInstance=E=this.resolver.resolveFunction(v,null)}}else if(t=this.convertExpression(t,this.currentType,T.Type.f64,1,0,h),n=this.currentType,i=this.compileExpression(d,T.Type.f64,1,0),a=this.currentType,!(E=this.f64PowInstance)){if(!(g=this.program.lookupGlobal(u.LibrarySymbols.Math))){this.error(l.DiagnosticCode.Cannot_find_name_0,e.range,"Math"),o=c.createUnreachable();break}if(!(v=g.members?g.members.get(u.LibrarySymbols.pow):null)){this.error(l.DiagnosticCode.Cannot_find_name_0,e.range,"Math.pow"),o=c.createUnreachable();break}assert(v.kind==_.ElementKind.FUNCTION_PROTOTYPE),this.f64PowInstance=E=this.resolver.resolveFunction(v,null)}o=E&&this.compileFunction(E)?this.makeCallDirect(E,[t,i]):c.createUnreachable();break;case y.Token.SLASH_EQUALS:m=!0;case y.Token.SLASH:if(t=this.compileExpressionRetainType(h,r,0),n=this.currentType,this.currentType.is(256)){if(I=n.classReference)if(b=I.lookupOverload(_.OperatorKind.DIV)){o=this.compileBinaryOverload(b,h,t,d,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),this.module.createUnreachable()}if(m)t=this.ensureSmallIntegerWrap(t,n),i=this.compileExpression(d,n,1,1),a=this.currentType;else{if(i=this.compileExpressionRetainType(d,n,0),a=this.currentType,!(s=T.Type.commonDenominator(n,a,!1)))return this.error(l.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,"/",n.toString(),a.toString()),this.currentType=r,c.createUnreachable();t=this.convertExpression(t,n,n=s,1,1,h),i=this.convertExpression(i,a,a=s,1,1,d)}switch(this.currentType.kind){case 0:case 1:case 2:o=c.createBinary(p.BinaryOp.DivI32,t,i);break;case 4:o=c.createBinary(this.options.isWasm64?p.BinaryOp.DivI64:p.BinaryOp.DivI32,t,i);break;case 3:o=c.createBinary(p.BinaryOp.DivI64,t,i);break;case 5:case 6:case 10:case 7:o=c.createBinary(p.BinaryOp.DivU32,t,i);break;case 9:o=c.createBinary(this.options.isWasm64?p.BinaryOp.DivU64:p.BinaryOp.DivU32,t,i);break;case 8:o=c.createBinary(p.BinaryOp.DivU64,t,i);break;case 11:o=c.createBinary(p.BinaryOp.DivF32,t,i);break;case 12:o=c.createBinary(p.BinaryOp.DivF64,t,i);break;default:assert(!1),o=c.createUnreachable()}break;case y.Token.PERCENT_EQUALS:m=!0;case y.Token.PERCENT:if(t=this.compileExpressionRetainType(h,r,0),n=this.currentType,this.currentType.is(256)){if(I=n.classReference)if(b=I.lookupOverload(_.OperatorKind.REM)){o=this.compileBinaryOverload(b,h,t,d,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),this.module.createUnreachable()}if(m)t=this.ensureSmallIntegerWrap(t,n),i=this.compileExpression(d,n,1,1),a=this.currentType;else{if(i=this.compileExpressionRetainType(d,n,0),a=this.currentType,!(s=T.Type.commonDenominator(n,a,!1)))return this.error(l.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,"%",n.toString(),a.toString()),this.currentType=r,c.createUnreachable();t=this.convertExpression(t,n,n=s,1,1,h),i=this.convertExpression(i,a,a=s,1,1,d)}switch(this.currentType.kind){case 0:case 1:case 2:o=c.createBinary(p.BinaryOp.RemI32,t,i);break;case 4:o=c.createBinary(this.options.isWasm64?p.BinaryOp.RemI64:p.BinaryOp.RemI32,t,i);break;case 3:o=c.createBinary(p.BinaryOp.RemI64,t,i);break;case 5:case 6:case 10:case 7:o=c.createBinary(p.BinaryOp.RemU32,t,i);break;case 9:o=c.createBinary(this.options.isWasm64?p.BinaryOp.RemU64:p.BinaryOp.RemU32,t,i);break;case 8:o=c.createBinary(p.BinaryOp.RemU64,t,i);break;case 11:if(!(E=this.f32ModInstance)){if(!(g=this.program.lookupGlobal(u.LibrarySymbols.Mathf))){this.error(l.DiagnosticCode.Cannot_find_name_0,e.range,"Mathf"),o=c.createUnreachable();break}if(!(v=g.members?g.members.get(u.LibrarySymbols.mod):null)){this.error(l.DiagnosticCode.Cannot_find_name_0,e.range,"Mathf.mod"),o=c.createUnreachable();break}assert(v.kind==_.ElementKind.FUNCTION_PROTOTYPE),this.f32ModInstance=E=this.resolver.resolveFunction(v,null)}o=E&&this.compileFunction(E)?this.makeCallDirect(E,[t,i]):c.createUnreachable();break;case 12:if(!(E=this.f64ModInstance)){var g,v;if(!(g=this.program.lookupGlobal(u.LibrarySymbols.Math))){this.error(l.DiagnosticCode.Cannot_find_name_0,e.range,"Math"),o=c.createUnreachable();break}if(!(v=g.members?g.members.get(u.LibrarySymbols.mod):null)){this.error(l.DiagnosticCode.Cannot_find_name_0,e.range,"Math.mod"),o=c.createUnreachable();break}assert(v.kind==_.ElementKind.FUNCTION_PROTOTYPE),this.f64ModInstance=E=this.resolver.resolveFunction(v,null)}o=E&&this.compileFunction(E)?this.makeCallDirect(E,[t,i]):c.createUnreachable();break;default:assert(!1),o=c.createUnreachable()}break;case y.Token.LESSTHAN_LESSTHAN_EQUALS:m=!0;case y.Token.LESSTHAN_LESSTHAN:if(t=this.compileExpressionRetainType(h,r.intType,0),n=this.currentType,this.currentType.is(256)){if(I=n.classReference)if(b=I.lookupOverload(_.OperatorKind.BITWISE_SHL)){o=this.compileBinaryOverload(b,h,t,d,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),this.module.createUnreachable()}switch(i=this.compileExpression(d,n,1,0),a=this.currentType,this.currentType.kind){case 0:case 1:case 5:case 6:case 10:case 2:case 7:o=c.createBinary(p.BinaryOp.ShlI32,t,i);break;case 3:case 8:o=c.createBinary(p.BinaryOp.ShlI64,t,i);break;case 9:case 4:o=c.createBinary(this.options.isWasm64?p.BinaryOp.ShlI64:p.BinaryOp.ShlI32,t,i);break;case 11:case 12:return this.error(l.DiagnosticCode.The_0_operator_cannot_be_applied_to_type_1,e.range,y.operatorTokenToString(e.operator),this.currentType.toString()),c.createUnreachable();default:assert(!1),o=c.createUnreachable()}break;case y.Token.GREATERTHAN_GREATERTHAN_EQUALS:m=!0;case y.Token.GREATERTHAN_GREATERTHAN:if(t=this.compileExpressionRetainType(h,r.intType,0),n=this.currentType,this.currentType.is(256)){if(I=n.classReference)if(b=I.lookupOverload(_.OperatorKind.BITWISE_SHR)){o=this.compileBinaryOverload(b,h,t,d,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),this.module.createUnreachable()}switch(t=this.ensureSmallIntegerWrap(t,n),i=this.compileExpression(d,n,1,1),a=this.currentType,this.currentType.kind){case 0:case 1:case 2:o=c.createBinary(p.BinaryOp.ShrI32,t,i);break;case 3:o=c.createBinary(p.BinaryOp.ShrI64,t,i);break;case 4:o=c.createBinary(this.options.isWasm64?p.BinaryOp.ShrI64:p.BinaryOp.ShrI32,t,i);break;case 5:case 6:case 10:case 7:o=c.createBinary(p.BinaryOp.ShrU32,t,i);break;case 8:o=c.createBinary(p.BinaryOp.ShrU64,t,i);break;case 9:o=c.createBinary(this.options.isWasm64?p.BinaryOp.ShrU64:p.BinaryOp.ShrU32,t,i);break;case 11:case 12:return this.error(l.DiagnosticCode.The_0_operator_cannot_be_applied_to_type_1,e.range,y.operatorTokenToString(e.operator),this.currentType.toString()),c.createUnreachable();default:assert(!1),o=c.createUnreachable()}break;case y.Token.GREATERTHAN_GREATERTHAN_GREATERTHAN_EQUALS:m=!0;case y.Token.GREATERTHAN_GREATERTHAN_GREATERTHAN:if(t=this.compileExpressionRetainType(h,r.intType,0),n=this.currentType,this.currentType.is(256)){if(I=n.classReference)if(b=I.lookupOverload(_.OperatorKind.BITWISE_SHR_U)){o=this.compileBinaryOverload(b,h,t,d,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),this.module.createUnreachable()}switch(t=this.ensureSmallIntegerWrap(t,n),i=this.compileExpression(d,n,1,0),a=this.currentType,this.currentType.kind){case 5:case 6:case 10:o=c.createBinary(p.BinaryOp.ShrU32,t,i);case 0:case 1:case 2:case 7:o=c.createBinary(p.BinaryOp.ShrU32,t,i);break;case 3:case 8:o=c.createBinary(p.BinaryOp.ShrU64,t,i);break;case 9:case 4:o=c.createBinary(this.options.isWasm64?p.BinaryOp.ShrU64:p.BinaryOp.ShrU32,t,i);break;case 11:case 12:return this.error(l.DiagnosticCode.The_0_operator_cannot_be_applied_to_type_1,e.range,y.operatorTokenToString(e.operator),this.currentType.toString()),c.createUnreachable();default:assert(!1),o=c.createUnreachable()}break;case y.Token.AMPERSAND_EQUALS:m=!0;case y.Token.AMPERSAND:if(t=this.compileExpressionRetainType(h,r.intType,0),n=this.currentType,this.currentType.is(256)){if(I=n.classReference)if(b=I.lookupOverload(_.OperatorKind.BITWISE_AND)){o=this.compileBinaryOverload(b,h,t,d,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),this.module.createUnreachable()}if(m)i=this.compileExpression(d,n,1,0),a=this.currentType;else{if(i=this.compileExpressionRetainType(d,n,0),a=this.currentType,!(s=T.Type.commonDenominator(n,a,!1)))return this.error(l.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,"&",n.toString(),a.toString()),this.currentType=r,c.createUnreachable();t=this.convertExpression(t,n,n=s,1,0,h),i=this.convertExpression(i,a,a=s,1,0,d)}switch(this.currentType.kind){case 0:case 1:case 2:case 5:case 6:case 10:case 7:o=c.createBinary(p.BinaryOp.AndI32,t,i);break;case 3:case 8:o=c.createBinary(p.BinaryOp.AndI64,t,i);break;case 9:case 4:o=c.createBinary(this.options.isWasm64?p.BinaryOp.AndI64:p.BinaryOp.AndI32,t,i);break;case 11:case 12:return this.error(l.DiagnosticCode.The_0_operator_cannot_be_applied_to_type_1,e.range,y.operatorTokenToString(e.operator),this.currentType.toString()),c.createUnreachable();default:assert(!1),o=c.createUnreachable()}break;case y.Token.BAR_EQUALS:m=!0;case y.Token.BAR:if(t=this.compileExpressionRetainType(h,r.intType,0),n=this.currentType,this.currentType.is(256)){if(I=n.classReference)if(b=I.lookupOverload(_.OperatorKind.BITWISE_OR)){o=this.compileBinaryOverload(b,h,t,d,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),this.module.createUnreachable()}if(m)i=this.compileExpression(d,n,1,0),a=this.currentType;else{if(i=this.compileExpressionRetainType(d,n,0),a=this.currentType,!(s=T.Type.commonDenominator(n,a,!1)))return this.error(l.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,"|",n.toString(),a.toString()),this.currentType=r,c.createUnreachable();t=this.convertExpression(t,n,n=s,1,0,h),i=this.convertExpression(i,a,a=s,1,0,d)}switch(this.currentType.kind){case 0:case 1:case 5:case 6:case 10:o=c.createBinary(p.BinaryOp.OrI32,t,i);break;case 2:case 7:o=c.createBinary(p.BinaryOp.OrI32,t,i);break;case 3:case 8:o=c.createBinary(p.BinaryOp.OrI64,t,i);break;case 9:case 4:o=c.createBinary(this.options.isWasm64?p.BinaryOp.OrI64:p.BinaryOp.OrI32,t,i);break;case 11:case 12:return this.error(l.DiagnosticCode.The_0_operator_cannot_be_applied_to_type_1,e.range,y.operatorTokenToString(e.operator),this.currentType.toString()),c.createUnreachable();default:assert(!1),o=c.createUnreachable()}break;case y.Token.CARET_EQUALS:m=!0;case y.Token.CARET:if(t=this.compileExpressionRetainType(h,r.intType,0),n=this.currentType,this.currentType.is(256)){var I,b;if(I=n.classReference)if(b=I.lookupOverload(_.OperatorKind.BITWISE_XOR)){o=this.compileBinaryOverload(b,h,t,d,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),this.module.createUnreachable()}if(m)i=this.compileExpression(d,n,1,0),a=this.currentType;else{if(i=this.compileExpressionRetainType(d,n,0),a=this.currentType,!(s=T.Type.commonDenominator(n,a,!1)))return this.error(l.DiagnosticCode.Operator_0_cannot_be_applied_to_types_1_and_2,e.range,"^",n.toString(),a.toString()),this.currentType=r,c.createUnreachable();t=this.convertExpression(t,n,n=s,1,0,h),i=this.convertExpression(i,a,a=s,1,0,d)}switch(this.currentType.kind){case 0:case 1:case 5:case 6:case 10:o=c.createBinary(p.BinaryOp.XorI32,t,i);break;case 2:case 7:o=c.createBinary(p.BinaryOp.XorI32,t,i);break;case 3:case 8:o=c.createBinary(p.BinaryOp.XorI64,t,i);break;case 9:case 4:o=c.createBinary(this.options.isWasm64?p.BinaryOp.XorI64:p.BinaryOp.XorI32,t,i);break;case 11:case 12:return this.error(l.DiagnosticCode.The_0_operator_cannot_be_applied_to_type_1,e.range,y.operatorTokenToString(e.operator),this.currentType.toString()),c.createUnreachable();default:assert(!1),o=c.createUnreachable()}break;case y.Token.AMPERSAND_AMPERSAND:if(t=this.compileExpressionRetainType(h,r,0),n=this.currentType,i=this.compileExpression(d,n,1,0),a=this.currentType,o=c.cloneExpression(t,!0,0))o=c.createIf(this.makeIsTrueish(t,this.currentType),i,o);else{var x=(S=this.currentFlow).getAndFreeTempLocal(this.currentType,!S.canOverflow(t,this.currentType));o=c.createIf(this.makeIsTrueish(c.createTeeLocal(x.index,t),this.currentType),i,c.createGetLocal(assert(x).index,this.currentType.toNativeType()))}break;case y.Token.BAR_BAR:if(t=this.compileExpressionRetainType(h,r,0),n=this.currentType,i=this.compileExpression(d,n,1,0),a=this.currentType,o=this.module.cloneExpression(t,!0,0))o=this.module.createIf(this.makeIsTrueish(t,this.currentType),o,i);else{var S;x=(S=this.currentFlow).getAndFreeTempLocal(this.currentType,!S.canOverflow(t,this.currentType));o=c.createIf(this.makeIsTrueish(c.createTeeLocal(x.index,t),this.currentType),c.createGetLocal(assert(x).index,this.currentType.toNativeType()),i)}break;default:assert(!1),o=this.module.createUnreachable()}return m?this.compileAssignmentWithValue(h,o,r!=T.Type.void):o},r.prototype.compileUnaryOverload=function(e,r,t,n){var i,a=0;return e.is(u.CommonFlags.INSTANCE)?(a=t,i=[]):i=[r],this.compileCallDirect(e,i,n,a)},r.prototype.compileBinaryOverload=function(e,r,t,n,i){var a,s=0;if(e.is(u.CommonFlags.INSTANCE)){var o=assert(e.parent);assert(o.kind==_.ElementKind.CLASS),s=t,a=[n]}else a=[r,n];return this.compileCallDirect(e,a,i,s)},r.prototype.compileAssignment=function(e,r,t){var n,i=this.program.resolver,a=this.currentFlow,s=i.resolveExpression(e,a);if(!s)return this.module.createUnreachable();switch(s.kind){case _.ElementKind.GLOBAL:if(!this.compileGlobal(s))return this.module.createUnreachable();assert(s.type!=T.Type.void);case _.ElementKind.LOCAL:case _.ElementKind.FIELD:n=s.type;break;case _.ElementKind.PROPERTY_PROTOTYPE:var o=s.setterPrototype;if(!o)return this.error(l.DiagnosticCode.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property,e.range,s.internalName),this.module.createUnreachable();if(!(c=this.resolver.resolveFunction(o,null,f.makeMap(),d.ReportMode.REPORT)))return this.module.createUnreachable();assert(1==c.signature.parameterTypes.length),n=c.signature.parameterTypes[0];break;case _.ElementKind.PROPERTY:var c;if(!(c=s.setterInstance))return this.error(l.DiagnosticCode.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property,e.range,s.internalName),this.module.createUnreachable();assert(1==c.signature.parameterTypes.length),n=c.signature.parameterTypes[0];break;case _.ElementKind.CLASS:if(i.currentElementExpression){var p=a.is(8192),u=s.lookupOverload(_.OperatorKind.INDEXED_SET,p);if(!u)return s.lookupOverload(_.OperatorKind.INDEXED_GET,p)?this.error(l.DiagnosticCode.Index_signature_in_type_0_only_permits_reading,e.range,s.internalName):this.error(l.DiagnosticCode.Index_signature_is_missing_in_type_0,e.range,s.internalName),this.module.createUnreachable();assert(2==u.signature.parameterTypes.length),n=u.signature.parameterTypes[1];break}default:return this.error(l.DiagnosticCode.Operation_not_supported,e.range),this.module.createUnreachable()}assert(n!=T.Type.void);var h=this.compileExpression(r,n,1,0);return this.compileAssignmentWithValue(e,h,t!=T.Type.void)},r.prototype.compileAssignmentWithValue=function(e,r,t){void 0===t&&(t=!1);var n=this.module,i=this.currentFlow,a=this.resolver.resolveExpression(e,i);if(!a)return n.createUnreachable();switch(a.kind){case _.ElementKind.LOCAL:var s=a.type;return assert(s!=T.Type.void),this.currentType=t?s:T.Type.void,a.is(u.CommonFlags.CONST)?(this.error(l.DiagnosticCode.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property,e.range,a.internalName),n.createUnreachable()):(s.is(36)&&i.setLocalWrapped(a.index,!i.canOverflow(r,s)),t?n.createTeeLocal(a.index,r):n.createSetLocal(a.index,r));case _.ElementKind.GLOBAL:if(!this.compileGlobal(a))return n.createUnreachable();s=a.type;if(assert(s!=T.Type.void),this.currentType=t?s:T.Type.void,a.is(u.CommonFlags.CONST))return this.error(l.DiagnosticCode.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property,e.range,a.internalName),n.createUnreachable();if(r=this.ensureSmallIntegerWrap(r,s),t){var o=s.toNativeType(),c=a.internalName;return n.createBlock(null,[n.createSetGlobal(c,r),n.createGetGlobal(c,o)],o)}return n.createSetGlobal(a.internalName,r);case _.ElementKind.FIELD:var p=a.initializerNode;if(a.is(u.CommonFlags.READONLY)&&!i.actualFunction.is(u.CommonFlags.CONSTRUCTOR)&&!p)return this.error(l.DiagnosticCode.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property,e.range,a.internalName),n.createUnreachable();var h=assert(this.resolver.currentThisExpression),y=this.compileExpressionRetainType(h,this.options.usizeType,0);s=a.type;this.currentType=t?s:T.Type.void;o=s.toNativeType();if(10==s.kind&&(r=this.ensureSmallIntegerWrap(r,s)),t){var m=this.currentFlow,E=m.getAndFreeTempLocal(s,!m.canOverflow(r,s)).index;return n.createBlock(null,[n.createSetLocal(E,r),n.createStore(s.byteSize,y,n.createGetLocal(E,o),o,a.memoryOffset),n.createGetLocal(E,o)],o)}return n.createStore(s.byteSize,y,r,o,a.memoryOffset);case _.ElementKind.PROPERTY_PROTOTYPE:var g=a.setterPrototype;if(!g)return this.error(l.DiagnosticCode.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property,e.range,a.internalName),n.createUnreachable();if(!(b=this.resolver.resolveFunction(g,null,f.makeMap(),d.ReportMode.REPORT)))return n.createUnreachable();if(!t)return this.makeCallDirect(b,[r]);var v=assert(a.getterPrototype);if(!(S=this.resolver.resolveFunction(v,null,f.makeMap(),d.ReportMode.REPORT)))return n.createUnreachable();var I=(B=S.signature.returnType).toNativeType();return n.createBlock(null,[this.makeCallDirect(b,[r]),this.makeCallDirect(S)],I);case _.ElementKind.PROPERTY:var b;if(!(b=a.setterInstance))return this.error(l.DiagnosticCode.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property,e.range,a.internalName),n.createUnreachable();if(!t){var x=this.compileExpressionRetainType(assert(this.resolver.currentThisExpression),this.options.usizeType,0);return this.makeCallDirect(b,[x,r])}var S;I=(B=(S=assert(a.getterInstance)).signature.returnType).toNativeType(),y=this.compileExpressionRetainType(assert(this.resolver.currentThisExpression),this.options.usizeType,0),E=i.getAndFreeTempLocal(B,!1).index;return n.createBlock(null,[this.makeCallDirect(b,[n.createTeeLocal(E,y),r]),this.makeCallDirect(S,[n.createGetLocal(E,I)])],I);case _.ElementKind.CLASS:var A=this.resolver.currentElementExpression;if(A){var N=i.is(8192),O=a.lookupOverload(_.OperatorKind.INDEXED_GET,N);if(!O)return this.error(l.DiagnosticCode.Index_signature_is_missing_in_type_0,e.range,a.internalName),n.createUnreachable();var C=a.lookupOverload(_.OperatorKind.INDEXED_SET,N);if(!C)return this.error(l.DiagnosticCode.Index_signature_in_type_0_only_permits_reading,e.range,a.internalName),this.currentType=t?O.signature.returnType:T.Type.void,n.createUnreachable();var k=a.type,R=(h=assert(this.resolver.currentThisExpression),y=this.compileExpressionRetainType(h,this.options.usizeType,0),this.compileExpression(A,T.Type.i32,1,0));if(t){var L=i.getTempLocal(k,!1),F=i.getAndFreeTempLocal(this.currentType,!1),B=O.signature.returnType;return i.freeTempLocal(L),n.createBlock(null,[this.makeCallDirect(C,[n.createTeeLocal(L.index,y),n.createTeeLocal(F.index,R),r]),this.makeCallDirect(O,[n.createGetLocal(L.index,L.type.toNativeType()),n.createGetLocal(F.index,F.type.toNativeType())])],B.toNativeType())}return this.makeCallDirect(C,[y,R,r])}}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),n.createUnreachable()},r.prototype.compileCallExpression=function(e,r){var t=this.module,n=this.currentFlow;if(e.expression.kind==m.NodeKind.SUPER){var i=this.currentFlow,a=i.actualFunction;if(!a.is(u.CommonFlags.CONSTRUCTOR))return this.error(l.DiagnosticCode.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors,e.range),t.createUnreachable();var s=assert(a.parent);assert(s.kind==_.ElementKind.CLASS);var o=assert(s.base),c=assert(i.lookupLocal(u.CommonSymbols.this_)),h=this.options.nativeSizeType,d=[t.createSetLocal(c.index,this.compileCallDirect(this.ensureConstructor(o,e),e.arguments,e,t.createIf(t.createGetLocal(c.index,h),t.createGetLocal(c.index,h),this.makeAllocation(s))))];return this.makeFieldInitialization(s,d),i.isAny(2080)?(this.error(l.DiagnosticCode._super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class,e.range),t.createUnreachable()):(i.set(96),this.currentType=T.Type.void,t.createBlock(null,d))}var y,E,g=this.resolver.resolveExpression(e.expression,n);if(!g)return t.createUnreachable();switch(g.kind){case _.ElementKind.FUNCTION_PROTOTYPE:var v=g,I=e.typeArguments;if(v.hasDecorator(_.DecoratorFlags.BUILTIN))return this.compileCallExpressionBuiltin(v,e,r);var b=null;if(I){if(!v.is(u.CommonFlags.GENERIC))return this.error(l.DiagnosticCode.Type_0_is_not_generic,e.expression.range,v.internalName),t.createUnreachable();b=this.resolver.resolveFunctionInclTypeArguments(v,I,n.actualFunction.parent,f.makeMap(n.contextualTypeArguments),e)}else{if(v.is(u.CommonFlags.GENERIC)){for(var x=new Map,S=assert(v.typeParameterNodes),A=S.length,N=0;N<A;++N)x.set(S[N].name.text,null);var O=v.signatureNode.parameters,C=O.length,k=e.arguments,R=k.length,L=new Array(R);for(N=0;N<C;++N){var F=O[N].type,B=F.kind!=m.NodeKind.TYPE||F.name.next?null:F.name.identifier.text,U=N<R?k[N]:O[N].initializer;if(!U)return this.error(l.DiagnosticCode.Expected_0_arguments_but_got_1,e.range,C.toString(10),R.toString(10)),t.createUnreachable();if(null!==B&&x.has(B)){if(M=x.get(B)){L[N]=this.compileExpressionRetainType(U,M,0);var D=void 0;if(!(D=T.Type.commonDenominator(M,this.currentType,!0))&&!(D=T.Type.commonDenominator(M,this.currentType,!1)))return this.error(l.DiagnosticCode.Type_0_is_not_assignable_to_type_1,O[N].type.range,this.currentType.toString(),M.toString()),t.createUnreachable();M=D}else L[N]=this.compileExpressionRetainType(U,T.Type.i32,0),M=this.currentType;x.set(B,M)}else{var w=this.resolver.resolveType(O[N].type,n.actualFunction,n.contextualTypeArguments);if(!w)return t.createUnreachable();L[N]=this.compileExpression(U,w,1,0)}}var P=new Array(A);for(N=0;N<A;++N){var M=assert(x.get(S[N].name.text));P[N]=M}return(b=this.resolver.resolveFunction(v,P,f.makeMap(n.contextualTypeArguments)))?this.makeCallDirect(b,L):this.module.createUnreachable()}b=this.resolver.resolveFunction(v,null)}if(!b)return this.module.createUnreachable();var V=0;return b.is(u.CommonFlags.INSTANCE)&&(V=this.compileExpressionRetainType(assert(this.resolver.currentThisExpression),this.options.usizeType,0)),this.compileCallDirect(b,e.arguments,e,V);case _.ElementKind.LOCAL:if(y=g.type.signatureReference){E=g.is(u.CommonFlags.INLINED)?t.createI32(i64_low(g.constantIntegerValue)):t.createGetLocal(g.index,p.NativeType.I32);break}return this.error(l.DiagnosticCode.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures,e.range,g.type.toString()),t.createUnreachable();case _.ElementKind.GLOBAL:if(y=g.type.signatureReference){E=t.createGetGlobal(g.internalName,g.type.toNativeType());break}return this.error(l.DiagnosticCode.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures,e.range,g.type.toString()),t.createUnreachable();case _.ElementKind.FIELD:var G=g.type;if(y=G.signatureReference){var K=assert(this.resolver.currentThisExpression);V=this.compileExpressionRetainType(K,this.options.usizeType,0);E=t.createLoad(4,!1,V,p.NativeType.I32,g.memoryOffset);break}return this.error(l.DiagnosticCode.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures,e.range,G.toString()),t.createUnreachable();case _.ElementKind.FUNCTION_TARGET:y=g.signature,E=this.compileExpression(e.expression,g.type,1,0);break;case _.ElementKind.PROPERTY_PROTOTYPE:var z=assert(g.getterPrototype);if(!(H=this.resolver.resolveFunction(z,null)))return t.createUnreachable();if(E=this.compileCallDirect(H,[],e.expression),!(y=this.currentType.signatureReference))return this.error(l.DiagnosticCode.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures,e.range,this.currentType.toString()),t.createUnreachable();break;case _.ElementKind.PROPERTY:var H=assert(g.getterInstance);if(E=this.compileCallDirect(H,[],e.expression,this.compileExpressionRetainType(assert(this.resolver.currentThisExpression),this.options.usizeType,0)),!(y=this.currentType.signatureReference))return this.error(l.DiagnosticCode.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures,e.range,this.currentType.toString()),t.createUnreachable();break;default:return this.error(l.DiagnosticCode.Operation_not_supported,e.range),t.createUnreachable()}return this.compileCallIndirect(y,E,e.arguments,e)},r.prototype.compileCallExpressionBuiltin=function(e,r,t){var n=null,i=e.typeParameterNodes,a=r.typeArguments;r.typeArguments&&(e.is(u.CommonFlags.GENERIC)||this.error(l.DiagnosticCode.Type_0_is_not_generic,r.range,e.internalName),n=this.resolver.resolveTypeArguments(assert(i),a,this.currentFlow.actualFunction.parent,f.makeMap(this.currentFlow.contextualTypeArguments),r));var s=c.compileCall(this,e,n,r.arguments,t,r);return s||(this.error(l.DiagnosticCode.Operation_not_supported,r.range),this.module.createUnreachable())},r.prototype.checkCallSignature=function(e,r,t,n){if(t!=(null!=e.thisType))return this.error(l.DiagnosticCode.Operation_not_supported,n.range),!1;var i=e.hasRest;if(i)return this.error(l.DiagnosticCode.Operation_not_supported,n.range),!1;var a=e.requiredParameters,s=e.parameterTypes.length;return r<a?(this.error(a<s?l.DiagnosticCode.Expected_at_least_0_arguments_but_got_1:l.DiagnosticCode.Expected_0_arguments_but_got_1,n.range,a.toString(),r.toString()),!1):!(r>s&&!i)||(this.error(l.DiagnosticCode.Expected_0_arguments_but_got_1,n.range,s.toString(),r.toString()),!1)},r.prototype.compileCallDirect=function(e,r,t,n){void 0===n&&(n=0);var i=r.length,a=e.signature;if(!this.checkCallSignature(a,i,0!=n,t))return this.module.createUnreachable();if(e.hasDecorator(_.DecoratorFlags.INLINE)){if(assert(!e.is(u.CommonFlags.TRAMPOLINE)),!this.currentInlineFunctions.includes(e)){this.currentInlineFunctions.push(e);var s=this.compileCallInlinePrechecked(e,r,n);return this.currentInlineFunctions.pop(),s}this.warning(l.DiagnosticCode.Function_0_cannot_be_inlined_into_itself,t.range,e.internalName)}var o=n?i+1:i,c=new Array(o),p=0;n&&(c[0]=n,p=1);for(var h=a.parameterTypes,d=0;d<i;++d,++p)c[p]=this.compileExpression(r[d],h[d],1,0);return assert(p==o),this.makeCallDirect(e,c)},r.prototype.compileCallInlinePrechecked=function(e,r,t){void 0===t&&(t=0);var n=this.module,i=this.currentFlow,a=h.Flow.createInline(i.parentFunction,e),s=[];if(t){var o=assert(e.parent);assert(o.kind==_.ElementKind.CLASS);var c=assert(e.signature.thisType),l=a.addScopedLocal(u.CommonSymbols.this_,c,!1);s.push(n.createSetLocal(l.index,t));var p=o.base;p&&a.addScopedAlias(u.CommonSymbols.super_,p.type,l.index)}for(var d=r.length,y=e.signature,m=y.parameterTypes,T=0;T<d;++T){var f=this.compileExpression(r[T],m[T],1,0),E=a.addScopedLocal(y.getParameterName(T),m[T],!i.canOverflow(f,m[T]));s.push(n.createSetLocal(E.index,f))}this.currentFlow=a;var g=y.parameterTypes.length;for(T=d;T<g;++T){var v=this.compileExpression(assert(e.prototype.signatureNode.parameters[T].initializer),m[T],1,1);E=a.addScopedLocal(y.getParameterName(T),m[T],!a.canOverflow(v,m[T]));s.push(n.createSetLocal(E.index,v))}for(var I=this.compileFunctionBody(e),b=(T=0,I.length);T<b;++T)s.push(I[T]);a.freeScopedLocals();var x=a.returnType;return this.currentFlow=i,this.currentType=x,n.createBlock(a.inlineReturnLabel,s,x.toNativeType())},r.prototype.ensureTrampoline=function(e){var r=e.trampoline;if(r)return r;var t=e.signature,n=e.internalName,i=t.parameterTypes,a=e.prototype.signatureNode.parameters,s=t.returnType,o=t.thisType,c=e.is(u.CommonFlags.INSTANCE),h=t.requiredParameters,d=h,y=i.length,m=y;c&&(++d,++m);var f=assert(m-d),E=new Array(d),g=0,v=this.module;c&&(E[0]=v.createGetLocal(0,this.options.nativeSizeType),g=1);for(var b=0;b<h;++b,++g)E[g]=v.createGetLocal(g,i[b].toNativeType());assert(g==d);var x=new T.Signature(i,s,o);x.requiredParameters=y,(r=new _.Function(e.name+"|trampoline",e.prototype,x,e.contextualTypeArguments)).set(e.flags|u.CommonFlags.TRAMPOLINE|u.CommonFlags.COMPILED),e.trampoline=r;var S=this.currentFlow;this.currentFlow=r.flow;var A=f+1,N=new Array(A),O="of"+f.toString(10);for(b=0;b<A;++b){var C=b.toString(10)+O;N[b]=C}var k=v.createBlock(N[0],[v.createBlock("outOfRange",[v.createSwitch(N,"outOfRange",h?v.createBinary(p.BinaryOp.SubI32,v.createGetGlobal(I.argc,p.NativeType.I32),v.createI32(h)):v.createGetGlobal(I.argc,p.NativeType.I32))]),v.createUnreachable()]);for(b=0;b<f;++b,++g){var R=i[h+b],L=a[h+b],F=L.initializer,B=void 0;F?B=v.createSetLocal(g,this.compileExpression(F,R,1,1)):(this.error(l.DiagnosticCode.Optional_parameter_must_have_an_initializer,L.range),B=v.createUnreachable()),k=v.createBlock(N[b+1],[k,B]),E[g]=v.createGetLocal(g,R.toNativeType())}this.currentFlow=S,assert(g==m);var U=v.addFunction(r.internalName,this.ensureFunctionType(x.parameterTypes,x.returnType,x.thisType),T.typesToNativeTypes(r.additionalLocals),v.createBlock(null,[k,v.createCall(n,E,s.toNativeType())],s.toNativeType()));return r.finalize(v,U),r},r.prototype.ensureArgcVar=function(){if(!this.argcVar){var e=this.module;this.argcVar=e.addGlobal(I.argc,p.NativeType.I32,!0,e.createI32(0))}return I.argc},r.prototype.ensureArgcSet=function(){var e=I.setargc;if(!this.argcSet){var r=this.module;this.argcSet=r.addFunction(e,this.ensureFunctionType([T.Type.u32],T.Type.void),null,r.createSetGlobal(this.ensureArgcVar(),r.createGetLocal(0,p.NativeType.I32))),r.addFunctionExport(e,"_setargc")}return e},r.prototype.makeCallDirect=function(e,r){void 0===r&&(r=null);var t=r?r.length:0,n=t,i=e.signature.requiredParameters,a=e.signature.parameterTypes.length,s=a;e.is(u.CommonFlags.INSTANCE)&&(++i,++s,--n),assert(t>=i);var o=this.module;if(!this.compileFunction(e))return o.createUnreachable();var c=e.signature.returnType,l=e.is(u.CommonFlags.MODULE_IMPORT);if(t<s){r||((r=new Array(s)).length=0);var p=e.signature.parameterTypes,_=e.prototype.signatureNode.parameters;assert(_.length==p.length);for(var h=!0,d=n;d<a;++d){var y=_[d].initializer;if(!y||!m.nodeIsConstantValue(y.kind)){h=!1;break}}if(h)for(d=n;d<a;++d)r.push(this.compileExpression(_[d].initializer,p[d],1,0));else{for(d=n;d<a;++d)r.push(p[d].toNativeZero(o));if(!l){var T=e;if(e=this.ensureTrampoline(e),!this.compileFunction(e))return o.createUnreachable();e.flow.flags=T.flow.flags;var f=c.toNativeType();return this.currentType=c,o.createBlock(null,[o.createSetGlobal(this.ensureArgcVar(),o.createI32(n)),o.createCall(e.internalName,r,f)],f)}}}return this.currentType=c,o.createCall(e.internalName,r,c.toNativeType())},r.prototype.compileCallIndirect=function(e,r,t,n,i){void 0===i&&(i=0);var a=t.length;if(!this.checkCallSignature(e,a,0!=i,n))return this.module.createUnreachable();var s=i?a+1:a,o=new Array(s),c=0;i&&(o[0]=i,c=1);for(var l=e.parameterTypes,p=0;p<a;++p,++c)o[c]=this.compileExpression(t[p],l[p],1,0);return assert(c==s),this.makeCallIndirect(e,r,o)},r.prototype.makeCallIndirect=function(e,r,t){void 0===t&&(t=null);var n=t?t.length:0,i=n,a=e.requiredParameters,s=e.parameterTypes.length,o=s;e.thisType&&(++a,++o,--i),assert(n>=a),this.ensureFunctionType(e.parameterTypes,e.returnType,e.thisType);var c=this.module;if(n<o){t||((t=new Array(o)).length=0);for(var l=e.parameterTypes,p=i;p<s;++p)t.push(l[p].toNativeZero(c))}var u=e.returnType;return this.currentType=u,c.createBlock(null,[c.createSetGlobal(this.ensureArgcVar(),c.createI32(i)),c.createCallIndirect(r,t,e.toSignatureString())],u.toNativeType())},r.prototype.compileCommaExpression=function(e,r){for(var t=e.expressions,n=t.length,i=new Array(n--),a=0;a<n;++a)i[a]=this.compileExpression(t[a],T.Type.void,2,0);return i[n]=this.compileExpression(t[n],r,1,0),this.module.createBlock(null,i,this.currentType.toNativeType())},r.prototype.compileElementAccessExpression=function(e,r){var t=this.resolver.resolveElementAccessExpression(e,this.currentFlow,r);if(!t)return this.module.createUnreachable();switch(t.kind){case _.ElementKind.CLASS:var n=this.currentFlow.is(8192),i=t.lookupOverload(_.OperatorKind.INDEXED_GET,n);if(!i)return this.error(l.DiagnosticCode.Index_signature_is_missing_in_type_0,e.expression.range,t.internalName),this.module.createUnreachable();var a=this.compileExpression(e.expression,t.type,1,0);return this.compileCallDirect(i,[e.elementExpression],e,a)}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),this.module.createUnreachable()},r.prototype.compileFunctionExpression=function(e,r){var t=e.declaration.clone();assert(!t.typeParameters);var n,i=this.currentFlow,a=i.actualFunction,s=new _.FunctionPrototype(t.name.text.length?t.name.text:"anonymous|"+(a.nextAnonymousId++).toString(10),a,t,_.DecoratorFlags.NONE),o=f.makeMap(i.contextualTypeArguments);if(r){var c=s.signatureNode,p=c.parameters,u=p.length,h=r.parameterTypes,d=h.length;if(u>d)return this.error(l.DiagnosticCode.Expected_0_arguments_but_got_1,e.range,d.toString(),u.toString()),this.module.createUnreachable();for(var y=new Array(u),E=0;E<u;++E){var g=p[E];if(y[E]=g.name.text,!m.isTypeOmitted(g.type)){if(!(x=this.resolver.resolveType(g.type,a.parent,o)))return this.module.createUnreachable();if(!h[E].isStrictlyAssignableTo(x))return this.error(l.DiagnosticCode.Type_0_is_not_assignable_to_type_1,g.range,h[E].toString(),x.toString()),this.module.createUnreachable()}}var v=r.returnType;if(!m.isTypeOmitted(c.returnType)){if(!(x=this.resolver.resolveType(c.returnType,a.parent,o)))return this.module.createUnreachable();if(v==T.Type.void?x!=T.Type.void:!x.isStrictlyAssignableTo(v))return this.error(l.DiagnosticCode.Type_0_is_not_assignable_to_type_1,c.returnType.range,x.toString(),v.toString()),this.module.createUnreachable()}var I=r.thisType,b=c.explicitThisType;if(b){if(!I)return this.error(l.DiagnosticCode._this_cannot_be_referenced_in_current_location,b.range),this.module.createUnreachable();var x;if(!(x=this.resolver.resolveType(b,a.parent,o)))return this.module.createUnreachable();if(!I.isStrictlyAssignableTo(x))return this.error(l.DiagnosticCode.Type_0_is_not_assignable_to_type_1,b.range,I.toString(),x.toString()),this.module.createUnreachable()}var S=new T.Signature(h,v,I);if(S.requiredParameters=d,S.parameterNames=y,n=new _.Function(s.name,s,S,o),!this.compileFunction(n))return this.module.createUnreachable();this.currentType=r.type}else{if(!(n=this.compileFunctionUsingTypeArguments(s,[],o)))return this.module.createUnreachable();this.currentType=n.signature.type}var A=this.ensureFunctionTableEntry(n);return A<0?this.module.createUnreachable():this.module.createI32(A)},r.prototype.maybeCompileEnclosingSource=function(e){var r=e.range.source.internalPath,t=this.program.filesByName;assert(t.has(r)),t.get(r).is(u.CommonFlags.COMPILED)||this.compileFileByPath(r,e)},r.prototype.compileIdentifierExpression=function(e,r,t){var n=this.module,i=this.currentFlow,a=i.actualFunction;switch(e.kind){case m.NodeKind.NULL:var s=this.options;return r.classReference||(this.currentType=s.usizeType),s.isWasm64?n.createI64(0):n.createI32(0);case m.NodeKind.TRUE:return this.currentType=T.Type.bool,n.createI32(1);case m.NodeKind.FALSE:return this.currentType=T.Type.bool,n.createI32(0);case m.NodeKind.THIS:if(a.is(u.CommonFlags.INSTANCE)){var o=assert(i.lookupLocal(u.CommonSymbols.this_)),c=assert(a.parent);assert(c.kind==_.ElementKind.CLASS);var h=this.options.nativeSizeType;if(a.is(u.CommonFlags.CONSTRUCTOR)&&!i.is(32)){i.set(32);var d=[n.createIf(n.createUnary(h==p.NativeType.I64?p.UnaryOp.EqzI64:p.UnaryOp.EqzI32,n.createGetLocal(o.index,h)),n.createSetLocal(o.index,this.makeAllocation(c)))];return this.makeFieldInitialization(c,d),d.push(n.createGetLocal(o.index,h)),this.currentType=o.type,n.createBlock(null,d,h)}var y=assert(a.signature.thisType);return this.currentType=y,n.createGetLocal(o.index,y.toNativeType())}return this.error(l.DiagnosticCode._this_cannot_be_referenced_in_current_location,e.range),this.currentType=this.options.usizeType,n.createUnreachable();case m.NodeKind.SUPER:var E=this.currentFlow,g=E.actualFunction;if(g.is(u.CommonFlags.CONSTRUCTOR)&&(E.is(64)||this.error(l.DiagnosticCode._super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class,e.range)),E.is(4096)){var v=E.lookupLocal(u.CommonSymbols.this_);if(v){var I=assert(v.type.classReference).base;if(I)return this.currentType=I.type,n.createGetLocal(v.index,I.type.toNativeType())}}if(g.is(u.CommonFlags.INSTANCE)){c=assert(g.parent);assert(c.kind==_.ElementKind.CLASS);var b=c.base;if(b){var x=b.type;return this.currentType=x,n.createGetLocal(0,x.toNativeType())}}return this.error(l.DiagnosticCode._super_can_only_be_referenced_in_a_derived_class,e.range),this.currentType=this.options.usizeType,n.createUnreachable()}this.maybeCompileEnclosingSource(e);var S=this.resolver.resolveIdentifier(e,i,this.currentEnum||a);if(!S)return n.createUnreachable();switch(S.kind){case _.ElementKind.LOCAL:var A=S.type;if(assert(A!=T.Type.void),S.is(u.CommonFlags.INLINED))return this.compileInlineConstant(S,r,t);var N=S.index;return assert(N>=0),this.currentType=A,this.module.createGetLocal(N,A.toNativeType());case _.ElementKind.GLOBAL:if(!this.compileGlobal(S))return this.module.createUnreachable();var O=S.type;return assert(O!=T.Type.void),S.is(u.CommonFlags.INLINED)?this.compileInlineConstant(S,r,t):(this.currentType=O,this.module.createGetGlobal(S.internalName,O.toNativeType()));case _.ElementKind.ENUMVALUE:return S.is(u.CommonFlags.COMPILED)?(this.currentType=T.Type.i32,S.is(u.CommonFlags.INLINED)?(assert(1==S.constantValueKind),this.module.createI32(i64_low(S.constantIntegerValue))):this.module.createGetGlobal(S.internalName,p.NativeType.I32)):(this.error(l.DiagnosticCode.A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums,e.range),this.currentType=T.Type.i32,this.module.createUnreachable());case _.ElementKind.FUNCTION_PROTOTYPE:var C=this.resolver.resolveFunction(S,null,f.makeMap(i.contextualTypeArguments));if(!C||!this.compileFunction(C))return n.createUnreachable();var k=this.ensureFunctionTableEntry(C);return this.currentType=C.signature.type,this.module.createI32(k)}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),this.module.createUnreachable()},r.prototype.compileInstanceOfExpression=function(e,r){var t=this.module,n=this.compileExpressionRetainType(e.expression,this.options.usizeType,0),i=this.currentType,a=this.resolver.resolveType(e.isType,this.currentFlow.actualFunction);return this.currentType=T.Type.bool,a?a.is(256)?i.is(512)&&!a.is(512)&&i.nonNullableType.isAssignableTo(a)?t.createBinary(i.is(64)?p.BinaryOp.NeI64:p.BinaryOp.NeI32,n,i.toNativeZero(t)):t.createI32(i.isAssignableTo(a)?1:0):t.createI32(i==a?1:0):t.createUnreachable()},r.prototype.compileLiteralExpression=function(e,r,t){void 0===t&&(t=!1);var n=this.module;switch(e.literalKind){case m.LiteralKind.ARRAY:assert(!t);var i=r.classReference;return i&&i.prototype==this.program.arrayPrototype?this.compileArrayLiteral(assert(i.typeArguments)[0],e.elementExpressions,!1,e):(this.error(l.DiagnosticCode.Operation_not_supported,e.range),n.createUnreachable());case m.LiteralKind.FLOAT:var a=e.value;return t&&(a=-a),r==T.Type.f32?n.createF32(a):(this.currentType=T.Type.f64,n.createF64(a));case m.LiteralKind.INTEGER:var s=e.value;t&&(s=i64_sub(i64_new(0),s));var o=this.resolver.determineIntegerLiteralType(s,r);switch(this.currentType=o,o.kind){case 4:if(!this.options.isWasm64)return n.createI32(i64_low(s));case 3:return n.createI64(i64_low(s),i64_high(s));case 9:if(!this.options.isWasm64)return n.createI32(i64_low(s));case 8:return n.createI64(i64_low(s),i64_high(s));case 11:return n.createF32(i64_to_f32(s));case 12:return n.createF64(i64_to_f64(s));default:return n.createI32(i64_low(s))}case m.LiteralKind.STRING:return assert(!t),this.compileStringLiteral(e);case m.LiteralKind.OBJECT:return assert(!t),this.compileObjectLiteral(e,r)}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),this.currentType=r,n.createUnreachable()},r.prototype.ensureStaticString=function(e){var r,t=this.program,n=t.hasGC,i=t.gcHeaderSize,a=assert(t.stringInstance),s=this.stringSegments;if(s.has(e))r=s.get(e);else{var o=e.length,l=a.currentMemoryOffset+1&-2,p=l+2*o,_=void 0,h=void 0;n?(_=new Uint8Array(i+p),h=i,f.writeI32(c.ensureGCHook(this,a),_,t.gcHookOffset)):(_=new Uint8Array(p),h=0),f.writeI32(o,_,h+a.offsetof(u.LibrarySymbols.length)),h+=l;for(var d=0;d<o;++d)f.writeI16(e.charCodeAt(d),_,h+(d<<1));r=this.addMemorySegment(_),s.set(e,r)}var y=r.offset;return n&&(y=i64_add(y,i64_new(i))),this.currentType=a.type,this.options.isWasm64?this.module.createI64(i64_low(y),i64_high(y)):(assert(i64_is_u32(y)),this.module.createI32(i64_low(y)))},r.prototype.compileStringLiteral=function(e){return this.ensureStaticString(e.value)},r.prototype.ensureStaticArray=function(e,r){var t,n,i=this.program,a=i.hasGC,s=i.gcHeaderSize,o=r.length,l=e.byteSize,_=o*l,h=this.options.usizeType.byteSize,d=assert(i.arrayBufferInstance),y=d.currentMemoryOffset+7&-8,m=1<<32-clz(y+_-1);a?(t=new Uint8Array(s+m),n=s,f.writeI32(c.ensureGCHook(this,d),t,i.gcHookOffset)):(t=new Uint8Array(m),n=0),f.writeI32(_,t,n+d.offsetof(u.LibrarySymbols.byteLength)),n+=y;var T=e.toNativeType();switch(T){case p.NativeType.I32:switch(l){case 1:for(var E=0;E<o;++E){var g=r[E];assert(p.getExpressionType(g)==T),assert(p.getExpressionId(g)==p.ExpressionId.Const),f.writeI8(p.getConstValueI32(g),t,n),n+=1}break;case 2:for(E=0;E<o;++E){g=r[E];assert(p.getExpressionType(g)==T),assert(p.getExpressionId(g)==p.ExpressionId.Const),f.writeI16(p.getConstValueI32(g),t,n),n+=2}break;case 4:for(E=0;E<o;++E){g=r[E];assert(p.getExpressionType(g)==T),assert(p.getExpressionId(g)==p.ExpressionId.Const),f.writeI32(p.getConstValueI32(g),t,n),n+=4}break;default:assert(!1)}break;case p.NativeType.I64:for(E=0;E<o;++E){g=r[E];assert(p.getExpressionType(g)==T),assert(p.getExpressionId(g)==p.ExpressionId.Const),f.writeI64(i64_new(p.getConstValueI64Low(g),p.getConstValueI64High(g)),t,n),n+=8}break;case p.NativeType.F32:for(E=0;E<o;++E){g=r[E];assert(p.getExpressionType(g)==T),assert(p.getExpressionId(g)==p.ExpressionId.Const),f.writeF32(p.getConstValueF32(g),t,n),n+=4}break;case p.NativeType.F64:for(E=0;E<o;++E){g=r[E];assert(p.getExpressionType(g)==T),assert(p.getExpressionId(g)==p.ExpressionId.Const),f.writeF64(p.getConstValueF64(g),t,n),n+=8}break;default:assert(!1)}var v=this.addMemorySegment(t).offset;a&&(v=i64_add(v,i64_new(s)));var I=assert(i.arrayPrototype),b=assert(this.resolver.resolveClass(I,[e],f.makeMap())),x=b.currentMemoryOffset+7&-8;a?(t=new Uint8Array(s+x),n=s,f.writeI32(c.ensureGCHook(this,b),t,i.gcHookOffset)):(t=new Uint8Array(x),n=0);var S=this.addMemorySegment(t).offset;a&&(S=i64_add(S,i64_new(s))),this.currentType=b.type;var A=n+b.offsetof("buffer_"),N=n+b.offsetof("length_");return 8==h?(f.writeI64(v,t,A),f.writeI32(o,t,N),this.module.createI64(i64_low(S),i64_high(S))):(assert(i64_is_u32(v)),f.writeI32(i64_low(v),t,A),f.writeI32(o,t,N),assert(i64_is_u32(S)),this.module.createI32(i64_low(S)))},r.prototype.compileArrayLiteral=function(e,r,t,n){for(var i=this.module,a=r.length,s=new Array(a),o=new Array(a),c=e.toNativeType(),u=!0,h=0;h<a;++h){var d=r[h],y=d?this.compileExpression(d,e,1,0):e.toNativeZero(i);s[h]=y,u&&(y=i.precomputeExpression(y),p.getExpressionId(y)==p.ExpressionId.Const?(assert(p.getExpressionType(y)==c),o[h]=y):(t&&this.warning(l.DiagnosticCode.Compiling_constant_with_non_constant_initializer_as_mutable,n.range),u=!1))}if(u)return this.ensureStaticArray(e,o);var m=assert(this.program.arrayPrototype),T=assert(this.resolver.resolveClass(m,[e],f.makeMap())),E=T.type;this.currentType=E;var g=T.lookupOverload(_.OperatorKind.INDEXED_SET,!0);if(!g)return this.error(l.DiagnosticCode.Index_signature_in_type_0_only_permits_reading,n.range,T.internalName),i.createUnreachable();var v=E.toNativeType(),I=this.currentFlow,b=I.parentFunction.addLocal(E),x=new Array(2+a),S=0;x[S++]=i.createSetLocal(b.index,this.makeCallDirect(assert(T.constructorInstance),[i.createI32(0),i.createI32(a)]));for(h=0;h<a;++h)x[S++]=this.makeCallDirect(g,[i.createGetLocal(b.index,v),i.createI32(h),s[h]]);return assert(S+1==x.length),x[S]=i.createGetLocal(b.index,v),I.freeTempLocal(b),this.currentType=E,i.createBlock(null,x,v)},r.prototype.compileObjectLiteral=function(e,r){var t=this.module,n=r.classReference;if(!n||n.is(u.CommonFlags.ABSTRACT))return this.error(l.DiagnosticCode.Type_0_is_not_assignable_to_type_1,e.range,"<object>",r.toString()),t.createUnreachable();var i=n.constructorInstance;if(i){if(i.signature.requiredParameters)return this.error(l.DiagnosticCode.Constructor_of_class_0_must_not_require_any_arguments,e.range,n.toString()),t.createUnreachable();if(i.is(u.CommonFlags.PRIVATE))return this.error(l.DiagnosticCode.Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration,e.range,n.toString()),t.createUnreachable();if(i.is(u.CommonFlags.PROTECTED))return this.error(l.DiagnosticCode.Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration,e.range,n.toString()),t.createUnreachable()}var a=e.names,s=a.length,o=e.values,c=n.members,p=!1,h=new Array(s+2),d=this.currentFlow.getTempLocal(this.options.usizeType);assert(s==o.length);for(var y=0,m=s;y<m;++y){var T=c?c.get(a[y].text):null;if(T&&T.kind==_.ElementKind.FIELD){var f=T.type;h[y+1]=this.module.createStore(f.byteSize,this.module.createGetLocal(d.index,this.options.nativeSizeType),this.compileExpression(o[y],T.type,1,0),f.toNativeType(),T.memoryOffset)}else this.error(l.DiagnosticCode.Property_0_does_not_exist_on_type_1,a[y].range,a[y].text,n.toString()),p=!0}return this.currentType=n.type.nonNullableType,p?t.createUnreachable():(h[0]=t.createSetLocal(d.index,this.makeAllocation(n)),h[h.length-1]=t.createGetLocal(d.index,this.options.nativeSizeType),t.createBlock(null,h,this.options.nativeSizeType))},r.prototype.compileNewExpression=function(e,r){var t=this.module,n=this.currentFlow,i=this.resolver.resolveExpression(e.expression,n);if(!i)return t.createUnreachable();if(i.kind!=_.ElementKind.CLASS_PROTOTYPE)return this.error(l.DiagnosticCode.Cannot_use_new_with_an_expression_whose_type_lacks_a_construct_signature,e.expression.range),this.module.createUnreachable();var a,s=i,o=null,c=e.typeArguments;return(o=!c&&null!==(a=r.classReference)&&a.is(u.CommonFlags.GENERIC)?this.resolver.resolveClass(s,a.typeArguments,f.makeMap(n.contextualTypeArguments)):this.resolver.resolveClassInclTypeArguments(s,c,n.actualFunction.parent,f.makeMap(n.contextualTypeArguments),e))?this.compileInstantiate(o,e.arguments,e):t.createUnreachable()},r.prototype.ensureConstructor=function(e,r){var t=e.constructorInstance;if(t)return t.hasDecorator(_.DecoratorFlags.INLINE)||this.compileFunction(t),t;var n=e.base;if(n){var i=this.ensureConstructor(n,r);t=new _.Function(u.CommonSymbols.constructor,new _.FunctionPrototype(u.CommonSymbols.constructor,e,i.declaration.clone()),i.signature,null)}else t=new _.Function(u.CommonSymbols.constructor,new _.FunctionPrototype(u.CommonSymbols.constructor,e,this.program.makeNativeFunctionDeclaration(u.CommonSymbols.constructor,u.CommonFlags.INSTANCE|u.CommonFlags.CONSTRUCTOR)),new T.Signature(null,e.type,e.type),null);t.internalName=e.internalName+u.INSTANCE_DELIMITER+"constructor",t.set(u.CommonFlags.COMPILED),t.prototype.setResolvedInstance("",t),e.constructorInstance=t;var a=this.currentFlow;this.currentFlow=t.flow;var s=t.signature,o=this.module,c=this.options.nativeSizeType,l=new Array;if(l.push(o.createIf(o.createUnary(c==p.NativeType.I64?p.UnaryOp.EqzI64:p.UnaryOp.EqzI32,o.createGetLocal(0,c)),o.createSetLocal(0,this.makeAllocation(e)))),n){var h=s.parameterTypes,d=h.length,y=new Array(1+d);y[0]=o.createGetLocal(0,c);for(var m=0;m<d;++m)y[m+1]=o.createGetLocal(m+1,h[m].toNativeType());l.push(o.createSetLocal(0,this.makeCallDirect(assert(n.constructorInstance),y)))}this.makeFieldInitialization(e,l),l.push(o.createGetLocal(0,c));var f=this.ensureFunctionType(s.parameterTypes,s.returnType,s.thisType),E=t.localsByIndex,g=new Array,v=1+s.parameterTypes.length,I=E.length;if(I>v)for(m=v;m<I;++m)g.push(E[m].type.toNativeType());var b=o.addFunction(t.internalName,f,g,1==l.length?l[0]:o.createBlock(null,l,c));return t.finalize(o,b),this.currentFlow=a,t},r.prototype.compileInstantiate=function(e,r,t){var n=this.ensureConstructor(e,t),i=this.compileCallDirect(n,r,t,this.options.usizeType.toNativeZero(this.module));return this.currentType=e.type,i},r.prototype.compileParenthesizedExpression=function(e,r){return this.compileExpression(e.expression,r,0,0)},r.prototype.compilePropertyAccessExpression=function(e,r,t){var n=this.module,i=this.currentFlow;this.maybeCompileEnclosingSource(e);var a=this.resolver.resolvePropertyAccessExpression(e,i,r);if(!a)return n.createUnreachable();switch(a.kind){case _.ElementKind.GLOBAL:if(!this.compileGlobal(a))return n.createUnreachable();var s=a.type;return assert(s!=T.Type.void),a.is(u.CommonFlags.INLINED)?this.compileInlineConstant(a,r,t):(this.currentType=s,n.createGetGlobal(a.internalName,s.toNativeType()));case _.ElementKind.ENUMVALUE:var o=assert(a.parent);return assert(o.kind==_.ElementKind.ENUM),this.compileEnum(o)?(this.currentType=T.Type.i32,a.is(u.CommonFlags.INLINED)?(assert(1==a.constantValueKind),n.createI32(i64_low(a.constantIntegerValue))):n.createGetGlobal(a.internalName,p.NativeType.I32)):(this.currentType=T.Type.i32,this.module.createUnreachable());case _.ElementKind.FIELD:assert(a.memoryOffset>=0);var c=this.compileExpressionRetainType(assert(this.resolver.currentThisExpression),this.options.usizeType,0);return this.currentType=a.type,n.createLoad(a.type.byteSize,a.type.is(5),c,a.type.toNativeType(),a.memoryOffset);case _.ElementKind.PROPERTY_PROTOTYPE:var h=a.getterPrototype;if(h){var d=this.resolver.resolveFunction(h,null);if(d)return this.compileCallDirect(d,[],e,0)}return n.createUnreachable();case _.ElementKind.PROPERTY:var y=assert(a.getterInstance);return this.compileCallDirect(y,[],e,this.compileExpressionRetainType(assert(this.resolver.currentThisExpression),this.options.usizeType,0));case _.ElementKind.FUNCTION_PROTOTYPE:return this.error(l.DiagnosticCode.Cannot_access_method_0_without_calling_it_as_it_requires_this_to_be_set,e.range,a.name),n.createUnreachable()}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),n.createUnreachable()},r.prototype.compileGetter=function(e,r){var t=e.getterPrototype;if(t){var n=this.resolver.resolveFunction(t,null);if(!n)return this.module.createUnreachable();var i=n.signature;if(!this.checkCallSignature(i,0,n.is(u.CommonFlags.INSTANCE),r))return this.module.createUnreachable();if(n.is(u.CommonFlags.INSTANCE)){var a=assert(n.parent);assert(a.kind==_.ElementKind.CLASS);var s=assert(this.resolver.currentThisExpression),o=this.compileExpressionRetainType(s,this.options.usizeType,0);//!!!
|
||
return this.currentType=i.returnType,this.compileCallDirect(n,[],r,o)}return this.currentType=i.returnType,this.compileCallDirect(n,[],r,0)}return this.error(l.DiagnosticCode.Property_0_does_not_exist_on_type_1,r.range,e.name,e.parent.toString()),this.module.createUnreachable()},r.prototype.compileTernaryExpression=function(e,r){var t=e.ifThen,n=e.ifElse,i=this.currentFlow,a=this.makeIsTrueish(this.compileExpressionRetainType(e.condition,T.Type.bool,0),this.currentType),s=this.module.precomputeExpression(a);if(p.getExpressionId(s)==p.ExpressionId.Const&&p.getExpressionType(s)==p.NativeType.I32)return p.getConstValueI32(s)?this.compileExpressionRetainType(t,r,0):this.compileExpressionRetainType(n,r,0);a=this.makeIsTrueish(this.compileExpressionRetainType(e.condition,T.Type.bool,0),this.currentType);var o=i.fork();this.currentFlow=o;var c=this.compileExpressionRetainType(t,r,0),u=this.currentType;o.freeScopedLocals();var _=i.fork();this.currentFlow=_;var h=this.compileExpressionRetainType(n,r,0),d=this.currentType;_.freeScopedLocals(),this.currentFlow=i,i.inheritMutual(o,_);var y=T.Type.commonDenominator(u,d,!1);return y?(c=this.convertExpression(c,u,y,1,0,t),h=this.convertExpression(h,d,y,1,0,n),this.currentType=y,this.module.createIf(a,c,h)):(this.error(l.DiagnosticCode.Type_0_is_not_assignable_to_type_1,e.range,u.toString(),d.toString()),this.currentType=r,this.module.createUnreachable())},r.prototype.compileUnaryPostfixExpression=function(e,r){var t=this.module,n=this.currentFlow,i=this.compileExpression(e.operand,r==T.Type.void?T.Type.i32:r,0,0);if(p.getExpressionId(i)==p.ExpressionId.Unreachable)return i;var a,s=this.currentType,o=null;switch(r!=T.Type.void&&(o=n.getTempLocal(s,!1),i=t.createTeeLocal(o.index,i)),e.operator){case y.Token.PLUS_PLUS:switch(s.kind){case 0:case 1:case 2:case 5:case 6:case 7:case 10:a=t.createBinary(p.BinaryOp.AddI32,i,t.createI32(1));break;case 9:if(this.currentType.is(256)){if(u=this.currentType.classReference)if(h=u.lookupOverload(_.OperatorKind.POSTFIX_INC)){a=this.compileUnaryOverload(h,e.operand,i,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),t.createUnreachable()}case 4:var c=this.options;a=t.createBinary(c.isWasm64?p.BinaryOp.AddI64:p.BinaryOp.AddI32,i,s.toNativeOne(t));break;case 3:case 8:a=t.createBinary(p.BinaryOp.AddI64,i,t.createI64(1));break;case 11:a=t.createBinary(p.BinaryOp.AddF32,i,t.createF32(1));break;case 12:a=t.createBinary(p.BinaryOp.AddF64,i,t.createF64(1));break;default:return assert(!1),t.createUnreachable()}break;case y.Token.MINUS_MINUS:switch(s.kind){case 0:case 1:case 2:case 5:case 6:case 7:case 10:a=t.createBinary(p.BinaryOp.SubI32,i,t.createI32(1));break;case 9:if(this.currentType.is(256)){var u,h;if(u=this.currentType.classReference)if(h=u.lookupOverload(_.OperatorKind.POSTFIX_DEC)){a=this.compileUnaryOverload(h,e.operand,i,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),t.createUnreachable()}case 4:c=this.options;a=t.createBinary(c.isWasm64?p.BinaryOp.SubI64:p.BinaryOp.SubI32,i,s.toNativeOne(t));break;case 3:case 8:a=t.createBinary(p.BinaryOp.SubI64,i,t.createI64(1));break;case 11:a=t.createBinary(p.BinaryOp.SubF32,i,t.createF32(1));break;case 12:a=t.createBinary(p.BinaryOp.SubF64,i,t.createF64(1));break;default:return assert(!1),t.createUnreachable()}break;default:return assert(!1),t.createUnreachable()}if(!o)return this.currentType=T.Type.void,this.compileAssignmentWithValue(e.operand,a,!1);var d=this.compileAssignmentWithValue(e.operand,a,!1);this.currentType=o.type,n.freeTempLocal(o);var m=o.type.toNativeType();return t.createBlock(null,[d,t.createGetLocal(o.index,m)],m)},r.prototype.compileUnaryPrefixExpression=function(e,r){var t,n=this.module,i=!1;switch(e.operator){case y.Token.PLUS:if(t=this.compileExpression(e.operand,r==T.Type.void?T.Type.i32:r,0,0),this.currentType.is(256)){if(a=this.currentType.classReference)if(s=a.lookupOverload(_.OperatorKind.PLUS)){t=this.compileUnaryOverload(s,e.operand,t,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),n.createUnreachable()}break;case y.Token.MINUS:if(e.operand.kind==m.NodeKind.LITERAL&&(e.operand.literalKind==m.LiteralKind.INTEGER||e.operand.literalKind==m.LiteralKind.FLOAT)){t=this.compileLiteralExpression(e.operand,r,!0),this.options.sourceMap&&this.addDebugLocation(t,e.range);break}if(t=this.compileExpression(e.operand,r==T.Type.void?T.Type.i32:r,0,0),this.currentType.is(256)){if(a=this.currentType.classReference)if(s=a.lookupOverload(_.OperatorKind.MINUS)){t=this.compileUnaryOverload(s,e.operand,t,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),n.createUnreachable()}switch(this.currentType.kind){case 0:case 1:case 2:case 5:case 6:case 7:case 10:t=n.createBinary(p.BinaryOp.SubI32,n.createI32(0),t);break;case 9:case 4:t=n.createBinary(this.options.isWasm64?p.BinaryOp.SubI64:p.BinaryOp.SubI32,this.currentType.toNativeZero(n),t);break;case 3:case 8:t=n.createBinary(p.BinaryOp.SubI64,n.createI64(0),t);break;case 11:t=n.createUnary(p.UnaryOp.NegF32,t);break;case 12:t=n.createUnary(p.UnaryOp.NegF64,t);break;default:assert(!1),t=n.createUnreachable()}break;case y.Token.PLUS_PLUS:if(i=!0,t=this.compileExpression(e.operand,r==T.Type.void?T.Type.i32:r,0,0),this.currentType.is(256)){if(a=this.currentType.classReference)if(s=a.lookupOverload(_.OperatorKind.PREFIX_INC)){t=this.compileUnaryOverload(s,e.operand,t,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),n.createUnreachable()}switch(this.currentType.kind){case 0:case 1:case 2:case 5:case 6:case 7:case 10:t=n.createBinary(p.BinaryOp.AddI32,t,this.module.createI32(1));break;case 9:case 4:t=n.createBinary(this.options.isWasm64?p.BinaryOp.AddI64:p.BinaryOp.AddI32,t,this.currentType.toNativeOne(n));break;case 3:case 8:t=n.createBinary(p.BinaryOp.AddI64,t,n.createI64(1));break;case 11:t=n.createBinary(p.BinaryOp.AddF32,t,n.createF32(1));break;case 12:t=n.createBinary(p.BinaryOp.AddF64,t,n.createF64(1));break;default:assert(!1),t=n.createUnreachable()}break;case y.Token.MINUS_MINUS:if(i=!0,t=this.compileExpression(e.operand,r==T.Type.void?T.Type.i32:r,0,0),this.currentType.is(256)){if(a=this.currentType.classReference)if(s=a.lookupOverload(_.OperatorKind.PREFIX_DEC)){t=this.compileUnaryOverload(s,e.operand,t,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),n.createUnreachable()}switch(this.currentType.kind){case 0:case 1:case 2:case 5:case 6:case 7:case 10:t=n.createBinary(p.BinaryOp.SubI32,t,n.createI32(1));break;case 9:case 4:t=n.createBinary(this.options.isWasm64?p.BinaryOp.SubI64:p.BinaryOp.SubI32,t,this.currentType.toNativeOne(n));break;case 3:case 8:t=n.createBinary(p.BinaryOp.SubI64,t,n.createI64(1));break;case 11:t=n.createBinary(p.BinaryOp.SubF32,t,n.createF32(1));break;case 12:t=n.createBinary(p.BinaryOp.SubF64,t,n.createF64(1));break;default:assert(!1),t=n.createUnreachable()}break;case y.Token.EXCLAMATION:if(t=this.compileExpression(e.operand,r==T.Type.void?T.Type.i32:r,0,0),this.currentType.is(256))if(a=this.currentType.classReference)if(s=a.lookupOverload(_.OperatorKind.NOT)){t=this.compileUnaryOverload(s,e.operand,t,e);break}t=this.makeIsFalseish(t,this.currentType),this.currentType=T.Type.bool;break;case y.Token.TILDE:if(t=this.compileExpression(e.operand,r==T.Type.void?T.Type.i32:r.is(8)?T.Type.i64:r,0,0),this.currentType.is(256)){var a,s;if(a=this.currentType.classReference)if(s=a.lookupOverload(_.OperatorKind.BITWISE_NOT)){t=this.compileUnaryOverload(s,e.operand,t,e);break}return this.error(l.DiagnosticCode.Operation_not_supported,e.range),n.createUnreachable()}switch(t=this.convertExpression(t,this.currentType,this.currentType.intType,1,0,e.operand),this.currentType.kind){case 0:case 1:case 2:case 5:case 6:case 7:case 10:t=n.createBinary(p.BinaryOp.XorI32,t,n.createI32(-1));break;case 9:case 4:t=n.createBinary(this.options.isWasm64?p.BinaryOp.XorI64:p.BinaryOp.XorI32,t,this.currentType.toNativeNegOne(n));break;case 3:case 8:t=n.createBinary(p.BinaryOp.XorI64,t,n.createI64(-1,-1));break;default:assert(!1),t=n.createUnreachable()}break;case y.Token.TYPEOF:return this.error(l.DiagnosticCode.Operation_not_supported,e.range),n.createUnreachable();default:return assert(!1),n.createUnreachable()}return i?this.compileAssignmentWithValue(e.operand,t,r!=T.Type.void):t},r.prototype.ensureSmallIntegerWrap=function(e,r){var t=this.module,n=this.currentFlow;switch(r.kind){case 0:n.canOverflow(e,r)&&(e=this.options.hasFeature(1)?t.createUnary(p.UnaryOp.ExtendI8ToI32,e):t.createBinary(p.BinaryOp.ShrI32,t.createBinary(p.BinaryOp.ShlI32,e,t.createI32(24)),t.createI32(24)));break;case 1:n.canOverflow(e,r)&&(e=this.options.hasFeature(1)?t.createUnary(p.UnaryOp.ExtendI16ToI32,e):t.createBinary(p.BinaryOp.ShrI32,t.createBinary(p.BinaryOp.ShlI32,e,t.createI32(16)),t.createI32(16)));break;case 5:n.canOverflow(e,r)&&(e=t.createBinary(p.BinaryOp.AndI32,e,t.createI32(255)));break;case 6:n.canOverflow(e,r)&&(e=t.createBinary(p.BinaryOp.AndI32,e,t.createI32(65535)));break;case 10:n.canOverflow(e,r)&&(e=t.createBinary(p.BinaryOp.NeI32,e,t.createI32(0)))}return e},r.prototype.makeIsFalseish=function(e,r){var t=this.module;switch(r.kind){case 0:case 1:case 5:case 6:case 10:e=this.ensureSmallIntegerWrap(e,r);case 2:case 7:return t.createUnary(p.UnaryOp.EqzI32,e);case 3:case 8:return t.createUnary(p.UnaryOp.EqzI64,e);case 9:case 4:return t.createUnary(64==r.size?p.UnaryOp.EqzI64:p.UnaryOp.EqzI32,e);case 11:return t.createBinary(p.BinaryOp.EqF32,e,t.createF32(0));case 12:return t.createBinary(p.BinaryOp.EqF64,e,t.createF64(0));default:return assert(!1),t.createI32(1)}},r.prototype.makeIsTrueish=function(e,r){var t=this.module;switch(r.kind){case 0:case 1:case 5:case 6:case 10:e=this.ensureSmallIntegerWrap(e,r);case 2:case 7:return e;case 3:case 8:return t.createBinary(p.BinaryOp.NeI64,e,t.createI64(0));case 9:case 4:return 64==r.size?t.createBinary(p.BinaryOp.NeI64,e,t.createI64(0)):e;case 11:return t.createBinary(p.BinaryOp.NeF32,e,t.createF32(0));case 12:return t.createBinary(p.BinaryOp.NeF64,e,t.createF64(0));default:return assert(!1),t.createI32(0)}},r.prototype.makeAllocation=function(e){var r=this.program;assert(e.program==r);var t=this.module,n=this.options;if(r.hasGC&&e.type.isManaged(r)){var i=assert(r.gcAllocateInstance);return this.compileFunction(i)?(this.currentType=e.type,t.createCall(i.internalName,[n.isWasm64?t.createI64(e.currentMemoryOffset):t.createI32(e.currentMemoryOffset),t.createI32(c.ensureGCHook(this,e))],n.nativeSizeType)):t.createUnreachable()}return(i=r.memoryAllocateInstance)&&this.compileFunction(i)?(this.currentType=e.type,t.createCall(i.internalName,[n.isWasm64?t.createI64(e.currentMemoryOffset):t.createI32(e.currentMemoryOffset)],n.nativeSizeType)):t.createUnreachable()},r.prototype.makeFieldInitialization=function(e,r){var t,n;void 0===r&&(r=[]);var i=e.members;if(!i)return[];var s=this.module,o=this.currentFlow,c=o.is(4096),l=c?assert(o.lookupLocal(u.CommonSymbols.this_)).index:0,p=this.options.nativeSizeType;try{for(var h=a(i.values()),d=h.next();!d.done;d=h.next()){var y=d.value;if(y.kind==_.ElementKind.FIELD&&y.parent==e){var m=y;assert(!m.isAny(u.CommonFlags.CONST));var T=m.type,f=T.toNativeType(),E=m.prototype.initializerNode;if(E)r.push(s.createStore(T.byteSize,s.createGetLocal(l,p),this.compileExpression(E,T,1,0),f,m.memoryOffset));else{var g=m.prototype.parameterIndex;r.push(s.createStore(T.byteSize,s.createGetLocal(l,p),g>=0?s.createGetLocal(c?assert(o.lookupLocal(m.name)).index:1+g,f):T.toNativeZero(s),f,m.memoryOffset))}}}}catch(e){t={error:e}}finally{try{d&&!d.done&&(n=h.return)&&n.call(h)}finally{if(t)throw t.error}}return r},r.prototype.addDebugLocation=function(e,r){var t=this.currentFlow.parentFunction,n=r.source;n.debugInfoIndex<0&&(n.debugInfoIndex=this.module.addDebugInfoFile(n.normalizedPath)),r.debugInfoRef=e,t.debugLocations.push(r)},r}(l.DiagnosticEmitter);function x(e,r){if(g=r.range.source.simplePath,v=_.mangleInternalName(e.name,e.parent,e.is(u.CommonFlags.INSTANCE),!0),e.hasDecorator(_.DecoratorFlags.EXTERNAL)){var t=e.program,n=assert(m.findDecorator(m.DecoratorKind.EXTERNAL,r.decorators)),i=n.arguments;if(i&&i.length){var a=i[0];a.kind==m.NodeKind.LITERAL&&a.literalKind==m.LiteralKind.STRING?(v=a.value,i.length>=2&&((a=i[1]).kind==m.NodeKind.LITERAL&&a.literalKind==m.LiteralKind.STRING?(g=v,v=a.value,i.length>2&&t.error(l.DiagnosticCode.Expected_0_arguments_but_got_1,n.range,"2",i.length.toString())):t.error(l.DiagnosticCode.String_literal_expected,a.range))):t.error(l.DiagnosticCode.String_literal_expected,a.range)}else t.error(l.DiagnosticCode.Expected_at_least_0_arguments_but_got_1,n.range,"1","0")}}r.Compiler=b,function(e){e.started="~lib/started",e.argc="~lib/argc",e.setargc="~lib/setargc"}(I||(I={}))},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),function(e){e[e.Operation_not_supported=100]="Operation_not_supported",e[e.Operation_is_unsafe=101]="Operation_is_unsafe",e[e.User_defined_0=102]="User_defined_0",e[e.Conversion_from_type_0_to_1_requires_an_explicit_cast=200]="Conversion_from_type_0_to_1_requires_an_explicit_cast",e[e.Conversion_from_type_0_to_1_will_require_an_explicit_cast_when_switching_between_32_64_bit=201]="Conversion_from_type_0_to_1_will_require_an_explicit_cast_when_switching_between_32_64_bit",e[e.Type_0_cannot_be_changed_to_type_1=202]="Type_0_cannot_be_changed_to_type_1",e[e.Type_0_cannot_be_reinterpreted_as_type_1=203]="Type_0_cannot_be_reinterpreted_as_type_1",e[e.Basic_type_0_cannot_be_nullable=204]="Basic_type_0_cannot_be_nullable",e[e.Cannot_export_a_mutable_global=205]="Cannot_export_a_mutable_global",e[e.Compiling_constant_with_non_constant_initializer_as_mutable=206]="Compiling_constant_with_non_constant_initializer_as_mutable",e[e.Unmanaged_classes_cannot_extend_managed_classes_and_vice_versa=207]="Unmanaged_classes_cannot_extend_managed_classes_and_vice_versa",e[e.Unmanaged_classes_cannot_implement_interfaces=208]="Unmanaged_classes_cannot_implement_interfaces",e[e.Invalid_regular_expression_flags=209]="Invalid_regular_expression_flags",e[e.Implementation_0_must_match_the_signature_1=210]="Implementation_0_must_match_the_signature_1",e[e.Class_0_is_sealed_and_cannot_be_extended=211]="Class_0_is_sealed_and_cannot_be_extended",e[e.Decorator_0_is_not_valid_here=212]="Decorator_0_is_not_valid_here",e[e.Duplicate_decorator=213]="Duplicate_decorator",e[e.An_allocator_must_be_declared_to_allocate_memory_Try_importing_allocator_arena_or_allocator_tlsf=214]="An_allocator_must_be_declared_to_allocate_memory_Try_importing_allocator_arena_or_allocator_tlsf",e[e.Optional_parameter_must_have_an_initializer=215]="Optional_parameter_must_have_an_initializer",e[e.Constructor_of_class_0_must_not_require_any_arguments=216]="Constructor_of_class_0_must_not_require_any_arguments",e[e.Function_0_cannot_be_inlined_into_itself=217]="Function_0_cannot_be_inlined_into_itself",e[e.Cannot_access_method_0_without_calling_it_as_it_requires_this_to_be_set=218]="Cannot_access_method_0_without_calling_it_as_it_requires_this_to_be_set",e[e.Optional_properties_are_not_supported=219]="Optional_properties_are_not_supported",e[e.Expression_must_be_a_compile_time_constant=220]="Expression_must_be_a_compile_time_constant",e[e.Module_cannot_have_multiple_start_functions=221]="Module_cannot_have_multiple_start_functions",e[e._0_must_be_a_value_between_1_and_2_inclusive=222]="_0_must_be_a_value_between_1_and_2_inclusive",e[e._0_must_be_a_power_of_two=223]="_0_must_be_a_power_of_two",e[e.Unterminated_string_literal=1002]="Unterminated_string_literal",e[e.Identifier_expected=1003]="Identifier_expected",e[e._0_expected=1005]="_0_expected",e[e.A_file_cannot_have_a_reference_to_itself=1006]="A_file_cannot_have_a_reference_to_itself",e[e.Trailing_comma_not_allowed=1009]="Trailing_comma_not_allowed",e[e.Unexpected_token=1012]="Unexpected_token",e[e.A_rest_parameter_must_be_last_in_a_parameter_list=1014]="A_rest_parameter_must_be_last_in_a_parameter_list",e[e.Parameter_cannot_have_question_mark_and_initializer=1015]="Parameter_cannot_have_question_mark_and_initializer",e[e.A_required_parameter_cannot_follow_an_optional_parameter=1016]="A_required_parameter_cannot_follow_an_optional_parameter",e[e.Statements_are_not_allowed_in_ambient_contexts=1036]="Statements_are_not_allowed_in_ambient_contexts",e[e.Initializers_are_not_allowed_in_ambient_contexts=1039]="Initializers_are_not_allowed_in_ambient_contexts",e[e._0_modifier_cannot_be_used_here=1042]="_0_modifier_cannot_be_used_here",e[e.A_rest_parameter_cannot_be_optional=1047]="A_rest_parameter_cannot_be_optional",e[e.A_rest_parameter_cannot_have_an_initializer=1048]="A_rest_parameter_cannot_have_an_initializer",e[e.A_set_accessor_must_have_exactly_one_parameter=1049]="A_set_accessor_must_have_exactly_one_parameter",e[e.A_set_accessor_parameter_cannot_have_an_initializer=1052]="A_set_accessor_parameter_cannot_have_an_initializer",e[e.A_get_accessor_cannot_have_parameters=1054]="A_get_accessor_cannot_have_parameters",e[e.Enum_member_must_have_initializer=1061]="Enum_member_must_have_initializer",e[e.Type_parameters_cannot_appear_on_a_constructor_declaration=1092]="Type_parameters_cannot_appear_on_a_constructor_declaration",e[e.Type_annotation_cannot_appear_on_a_constructor_declaration=1093]="Type_annotation_cannot_appear_on_a_constructor_declaration",e[e.An_accessor_cannot_have_type_parameters=1094]="An_accessor_cannot_have_type_parameters",e[e.A_set_accessor_cannot_have_a_return_type_annotation=1095]="A_set_accessor_cannot_have_a_return_type_annotation",e[e.Type_parameter_list_cannot_be_empty=1098]="Type_parameter_list_cannot_be_empty",e[e.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement=1104]="A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement",e[e.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement=1105]="A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement",e[e.A_return_statement_can_only_be_used_within_a_function_body=1108]="A_return_statement_can_only_be_used_within_a_function_body",e[e.Expression_expected=1109]="Expression_expected",e[e.Type_expected=1110]="Type_expected",e[e.A_default_clause_cannot_appear_more_than_once_in_a_switch_statement=1113]="A_default_clause_cannot_appear_more_than_once_in_a_switch_statement",e[e.Duplicate_label_0=1114]="Duplicate_label_0",e[e.Octal_literals_are_not_allowed_in_strict_mode=1121]="Octal_literals_are_not_allowed_in_strict_mode",e[e.Digit_expected=1124]="Digit_expected",e[e.Hexadecimal_digit_expected=1125]="Hexadecimal_digit_expected",e[e.Unexpected_end_of_text=1126]="Unexpected_end_of_text",e[e.Invalid_character=1127]="Invalid_character",e[e._case_or_default_expected=1130]="_case_or_default_expected",e[e._super_must_be_followed_by_an_argument_list_or_member_access=1034]="_super_must_be_followed_by_an_argument_list_or_member_access",e[e.A_declare_modifier_cannot_be_used_in_an_already_ambient_context=1038]="A_declare_modifier_cannot_be_used_in_an_already_ambient_context",e[e.Type_argument_expected=1140]="Type_argument_expected",e[e.String_literal_expected=1141]="String_literal_expected",e[e.Line_break_not_permitted_here=1142]="Line_break_not_permitted_here",e[e.Declaration_expected=1146]="Declaration_expected",e[e._const_declarations_must_be_initialized=1155]="_const_declarations_must_be_initialized",e[e.Unterminated_regular_expression_literal=1161]="Unterminated_regular_expression_literal",e[e.Interface_declaration_cannot_have_implements_clause=1176]="Interface_declaration_cannot_have_implements_clause",e[e.Binary_digit_expected=1177]="Binary_digit_expected",e[e.Octal_digit_expected=1178]="Octal_digit_expected",e[e.An_implementation_cannot_be_declared_in_ambient_contexts=1183]="An_implementation_cannot_be_declared_in_ambient_contexts",e[e.An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive=1198]="An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive",e[e.Unterminated_Unicode_escape_sequence=1199]="Unterminated_Unicode_escape_sequence",e[e.Decorators_are_not_valid_here=1206]="Decorators_are_not_valid_here",e[e._abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration=1242]="_abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration",e[e.Method_0_cannot_have_an_implementation_because_it_is_marked_abstract=1245]="Method_0_cannot_have_an_implementation_because_it_is_marked_abstract",e[e.A_definite_assignment_assertion_is_not_permitted_in_this_context=1255]="A_definite_assignment_assertion_is_not_permitted_in_this_context",e[e.A_class_may_only_extend_another_class=1311]="A_class_may_only_extend_another_class",e[e.A_parameter_property_cannot_be_declared_using_a_rest_parameter=1317]="A_parameter_property_cannot_be_declared_using_a_rest_parameter",e[e.Duplicate_identifier_0=2300]="Duplicate_identifier_0",e[e.Cannot_find_name_0=2304]="Cannot_find_name_0",e[e.Module_0_has_no_exported_member_1=2305]="Module_0_has_no_exported_member_1",e[e.Generic_type_0_requires_1_type_argument_s=2314]="Generic_type_0_requires_1_type_argument_s",e[e.Type_0_is_not_generic=2315]="Type_0_is_not_generic",e[e.Type_0_is_not_assignable_to_type_1=2322]="Type_0_is_not_assignable_to_type_1",e[e.Index_signature_is_missing_in_type_0=2329]="Index_signature_is_missing_in_type_0",e[e._this_cannot_be_referenced_in_current_location=2332]="_this_cannot_be_referenced_in_current_location",e[e._super_can_only_be_referenced_in_a_derived_class=2335]="_super_can_only_be_referenced_in_a_derived_class",e[e.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors=2337]="Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors",e[e.Property_0_does_not_exist_on_type_1=2339]="Property_0_does_not_exist_on_type_1",e[e.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures=2349]="Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures",e[e.Cannot_use_new_with_an_expression_whose_type_lacks_a_construct_signature=2351]="Cannot_use_new_with_an_expression_whose_type_lacks_a_construct_signature",e[e.A_function_whose_declared_type_is_not_void_must_return_a_value=2355]="A_function_whose_declared_type_is_not_void_must_return_a_value",e[e.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access=2357]="The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access",e[e.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access=2364]="The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access",e[e.Operator_0_cannot_be_applied_to_types_1_and_2=2365]="Operator_0_cannot_be_applied_to_types_1_and_2",e[e.A_super_call_must_be_the_first_statement_in_the_constructor=2376]="A_super_call_must_be_the_first_statement_in_the_constructor",e[e.Constructors_for_derived_classes_must_contain_a_super_call=2377]="Constructors_for_derived_classes_must_contain_a_super_call",e[e._get_and_set_accessor_must_have_the_same_type=2380]="_get_and_set_accessor_must_have_the_same_type",e[e.Constructor_implementation_is_missing=2390]="Constructor_implementation_is_missing",e[e.Function_implementation_is_missing_or_not_immediately_following_the_declaration=2391]="Function_implementation_is_missing_or_not_immediately_following_the_declaration",e[e.Multiple_constructor_implementations_are_not_allowed=2392]="Multiple_constructor_implementations_are_not_allowed",e[e.Duplicate_function_implementation=2393]="Duplicate_function_implementation",e[e.Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local=2395]="Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local",e[e.A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged=2434]="A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged",e[e.Type_0_has_no_property_1=2460]="Type_0_has_no_property_1",e[e.The_0_operator_cannot_be_applied_to_type_1=2469]="The_0_operator_cannot_be_applied_to_type_1",e[e.In_const_enum_declarations_member_initializer_must_be_constant_expression=2474]="In_const_enum_declarations_member_initializer_must_be_constant_expression",e[e.Export_declaration_conflicts_with_exported_declaration_of_0=2484]="Export_declaration_conflicts_with_exported_declaration_of_0",e[e.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property=2540]="Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property",e[e.The_target_of_an_assignment_must_be_a_variable_or_a_property_access=2541]="The_target_of_an_assignment_must_be_a_variable_or_a_property_access",e[e.Index_signature_in_type_0_only_permits_reading=2542]="Index_signature_in_type_0_only_permits_reading",e[e.Expected_0_arguments_but_got_1=2554]="Expected_0_arguments_but_got_1",e[e.Expected_at_least_0_arguments_but_got_1=2555]="Expected_at_least_0_arguments_but_got_1",e[e.Expected_0_type_arguments_but_got_1=2558]="Expected_0_type_arguments_but_got_1",e[e.A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums=2651]="A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums",e[e.Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration=2673]="Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration",e[e.Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration=2674]="Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration",e[e.Namespace_0_has_no_exported_member_1=2694]="Namespace_0_has_no_exported_member_1",e[e.Required_type_parameters_may_not_follow_optional_type_parameters=2706]="Required_type_parameters_may_not_follow_optional_type_parameters",e[e.Duplicate_property_0=2718]="Duplicate_property_0",e[e.File_0_not_found=6054]="File_0_not_found",e[e.Numeric_separators_are_not_allowed_here=6188]="Numeric_separators_are_not_allowed_here",e[e.Multiple_consecutive_numeric_separators_are_not_permitted=6189]="Multiple_consecutive_numeric_separators_are_not_permitted",e[e._super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class=17009]="_super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class",e[e._super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class=17011]="_super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class"}(r.DiagnosticCode||(r.DiagnosticCode={})),r.diagnosticCodeToString=function(e){switch(e){case 100:return"Operation not supported.";case 101:return"Operation is unsafe.";case 102:return"User-defined: {0}";case 200:return"Conversion from type '{0}' to '{1}' requires an explicit cast.";case 201:return"Conversion from type '{0}' to '{1}' will require an explicit cast when switching between 32/64-bit.";case 202:return"Type '{0}' cannot be changed to type '{1}'.";case 203:return"Type '{0}' cannot be reinterpreted as type '{1}'.";case 204:return"Basic type '{0}' cannot be nullable.";case 205:return"Cannot export a mutable global.";case 206:return"Compiling constant with non-constant initializer as mutable.";case 207:return"Unmanaged classes cannot extend managed classes and vice-versa.";case 208:return"Unmanaged classes cannot implement interfaces.";case 209:return"Invalid regular expression flags.";case 210:return"Implementation '{0}' must match the signature '{1}'.";case 211:return"Class '{0}' is sealed and cannot be extended.";case 212:return"Decorator '{0}' is not valid here.";case 213:return"Duplicate decorator.";case 214:return"An allocator must be declared to allocate memory. Try importing allocator/arena or allocator/tlsf.";case 215:return"Optional parameter must have an initializer.";case 216:return"Constructor of class '{0}' must not require any arguments.";case 217:return"Function '{0}' cannot be inlined into itself.";case 218:return"Cannot access method '{0}' without calling it as it requires 'this' to be set.";case 219:return"Optional properties are not supported.";case 220:return"Expression must be a compile-time constant.";case 221:return"Module cannot have multiple start functions.";case 222:return"'{0}' must be a value between '{1}' and '{2}' inclusive.";case 223:return"'{0}' must be a power of two.";case 1002:return"Unterminated string literal.";case 1003:return"Identifier expected.";case 1005:return"'{0}' expected.";case 1006:return"A file cannot have a reference to itself.";case 1009:return"Trailing comma not allowed.";case 1012:return"Unexpected token.";case 1014:return"A rest parameter must be last in a parameter list.";case 1015:return"Parameter cannot have question mark and initializer.";case 1016:return"A required parameter cannot follow an optional parameter.";case 1036:return"Statements are not allowed in ambient contexts.";case 1039:return"Initializers are not allowed in ambient contexts.";case 1042:return"'{0}' modifier cannot be used here.";case 1047:return"A rest parameter cannot be optional.";case 1048:return"A rest parameter cannot have an initializer.";case 1049:return"A 'set' accessor must have exactly one parameter.";case 1052:return"A 'set' accessor parameter cannot have an initializer.";case 1054:return"A 'get' accessor cannot have parameters.";case 1061:return"Enum member must have initializer.";case 1092:return"Type parameters cannot appear on a constructor declaration.";case 1093:return"Type annotation cannot appear on a constructor declaration.";case 1094:return"An accessor cannot have type parameters.";case 1095:return"A 'set' accessor cannot have a return type annotation.";case 1098:return"Type parameter list cannot be empty.";case 1104:return"A 'continue' statement can only be used within an enclosing iteration statement.";case 1105:return"A 'break' statement can only be used within an enclosing iteration or switch statement.";case 1108:return"A 'return' statement can only be used within a function body.";case 1109:return"Expression expected.";case 1110:return"Type expected.";case 1113:return"A 'default' clause cannot appear more than once in a 'switch' statement.";case 1114:return"Duplicate label '{0}'.";case 1121:return"Octal literals are not allowed in strict mode.";case 1124:return"Digit expected.";case 1125:return"Hexadecimal digit expected.";case 1126:return"Unexpected end of text.";case 1127:return"Invalid character.";case 1130:return"'case' or 'default' expected.";case 1034:return"'super' must be followed by an argument list or member access.";case 1038:return"A 'declare' modifier cannot be used in an already ambient context.";case 1140:return"Type argument expected.";case 1141:return"String literal expected.";case 1142:return"Line break not permitted here.";case 1146:return"Declaration expected.";case 1155:return"'const' declarations must be initialized.";case 1161:return"Unterminated regular expression literal.";case 1176:return"Interface declaration cannot have 'implements' clause.";case 1177:return"Binary digit expected.";case 1178:return"Octal digit expected.";case 1183:return"An implementation cannot be declared in ambient contexts.";case 1198:return"An extended Unicode escape value must be between 0x0 and 0x10FFFF inclusive.";case 1199:return"Unterminated Unicode escape sequence.";case 1206:return"Decorators are not valid here.";case 1242:return"'abstract' modifier can only appear on a class, method, or property declaration.";case 1245:return"Method '{0}' cannot have an implementation because it is marked abstract.";case 1255:return"A definite assignment assertion '!' is not permitted in this context.";case 1311:return"A class may only extend another class.";case 1317:return"A parameter property cannot be declared using a rest parameter.";case 2300:return"Duplicate identifier '{0}'.";case 2304:return"Cannot find name '{0}'.";case 2305:return"Module '{0}' has no exported member '{1}'.";case 2314:return"Generic type '{0}' requires {1} type argument(s).";case 2315:return"Type '{0}' is not generic.";case 2322:return"Type '{0}' is not assignable to type '{1}'.";case 2329:return"Index signature is missing in type '{0}'.";case 2332:return"'this' cannot be referenced in current location.";case 2335:return"'super' can only be referenced in a derived class.";case 2337:return"Super calls are not permitted outside constructors or in nested functions inside constructors.";case 2339:return"Property '{0}' does not exist on type '{1}'.";case 2349:return"Cannot invoke an expression whose type lacks a call signature. Type '{0}' has no compatible call signatures.";case 2351:return"Cannot use 'new' with an expression whose type lacks a construct signature.";case 2355:return"A function whose declared type is not 'void' must return a value.";case 2357:return"The operand of an increment or decrement operator must be a variable or a property access.";case 2364:return"The left-hand side of an assignment expression must be a variable or a property access.";case 2365:return"Operator '{0}' cannot be applied to types '{1}' and '{2}'.";case 2376:return"A 'super' call must be the first statement in the constructor.";case 2377:return"Constructors for derived classes must contain a 'super' call.";case 2380:return"'get' and 'set' accessor must have the same type.";case 2390:return"Constructor implementation is missing.";case 2391:return"Function implementation is missing or not immediately following the declaration.";case 2392:return"Multiple constructor implementations are not allowed.";case 2393:return"Duplicate function implementation.";case 2395:return"Individual declarations in merged declaration '{0}' must be all exported or all local.";case 2434:return"A namespace declaration cannot be located prior to a class or function with which it is merged.";case 2460:return"Type '{0}' has no property '{1}'.";case 2469:return"The '{0}' operator cannot be applied to type '{1}'.";case 2474:return"In 'const' enum declarations member initializer must be constant expression.";case 2484:return"Export declaration conflicts with exported declaration of '{0}'.";case 2540:return"Cannot assign to '{0}' because it is a constant or a read-only property.";case 2541:return"The target of an assignment must be a variable or a property access.";case 2542:return"Index signature in type '{0}' only permits reading.";case 2554:return"Expected {0} arguments, but got {1}.";case 2555:return"Expected at least {0} arguments, but got {1}.";case 2558:return"Expected {0} type arguments, but got {1}.";case 2651:return"A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums.";case 2673:return"Constructor of class '{0}' is private and only accessible within the class declaration.";case 2674:return"Constructor of class '{0}' is protected and only accessible within the class declaration.";case 2694:return"Namespace '{0}' has no exported member '{1}'.";case 2706:return"Required type parameters may not follow optional type parameters.";case 2718:return"Duplicate property '{0}'.";case 6054:return"File '{0}' not found.";case 6188:return"Numeric separators are not allowed here.";case 6189:return"Multiple consecutive numeric separators are not permitted.";case 17009:return"'super' must be called before accessing 'this' in the constructor of a derived class.";case 17011:return"'super' must be called before accessing a property of 'super' in the constructor of a derived class.";default:return""}}},function(e,r,t){"use strict";var n=this&&this.__values||function(e){var r="function"==typeof Symbol&&e[Symbol.iterator],t=0;return r?r.call(e):{next:function(){return e&&t>=e.length&&(e=void 0),{value:e&&e[t++],done:!e}}}};Object.defineProperty(r,"__esModule",{value:!0});var i=t(6),a=t(3),s=t(4),o=t(0),c=t(2),l=t(1);!function(e){e[e.NONE=0]="NONE",e[e.RETURNS=1]="RETURNS",e[e.RETURNS_WRAPPED=2]="RETURNS_WRAPPED",e[e.THROWS=4]="THROWS",e[e.BREAKS=8]="BREAKS",e[e.CONTINUES=16]="CONTINUES",e[e.ALLOCATES=32]="ALLOCATES",e[e.CALLS_SUPER=64]="CALLS_SUPER",e[e.CONDITIONALLY_RETURNS=128]="CONDITIONALLY_RETURNS",e[e.CONDITIONALLY_THROWS=256]="CONDITIONALLY_THROWS",e[e.CONDITIONALLY_BREAKS=512]="CONDITIONALLY_BREAKS",e[e.CONDITIONALLY_CONTINUES=1024]="CONDITIONALLY_CONTINUES",e[e.CONDITIONALLY_ALLOCATES=2048]="CONDITIONALLY_ALLOCATES",e[e.INLINE_CONTEXT=4096]="INLINE_CONTEXT",e[e.UNCHECKED_CONTEXT=8192]="UNCHECKED_CONTEXT",e[e.ANY_TERMINATING=29]="ANY_TERMINATING",e[e.ANY_CATEGORICAL=127]="ANY_CATEGORICAL",e[e.ANY_CONDITIONAL=3968]="ANY_CONDITIONAL"}(r.FlowFlags||(r.FlowFlags={}));var p=function(){function e(){this.scopedLocals=null}return e.create=function(r){var t=new e;return t.parent=null,t.flags=0,t.parentFunction=r,t.continueLabel=null,t.breakLabel=null,t.returnType=r.signature.returnType,t.contextualTypeArguments=r.contextualTypeArguments,t.wrappedLocals=i64_new(0),t.wrappedLocalsExt=null,t.inlineFunction=null,t.inlineReturnLabel=null,t},e.createInline=function(r,t){var n=e.create(r);return n.set(4096),n.inlineFunction=t,n.inlineReturnLabel=t.internalName+"|inlined."+(t.nextInlineId++).toString(10),n.returnType=t.signature.returnType,n.contextualTypeArguments=t.contextualTypeArguments,n},Object.defineProperty(e.prototype,"actualFunction",{get:function(){return this.inlineFunction||this.parentFunction},enumerable:!0,configurable:!0}),e.prototype.is=function(e){return(this.flags&e)==e},e.prototype.isAny=function(e){return 0!=(this.flags&e)},e.prototype.set=function(e){this.flags|=e},e.prototype.unset=function(e){this.flags&=~e},e.prototype.fork=function(){var r=new e;return r.parent=this,r.flags=this.flags,r.parentFunction=this.parentFunction,r.continueLabel=this.continueLabel,r.breakLabel=this.breakLabel,r.returnType=this.returnType,r.contextualTypeArguments=this.contextualTypeArguments,r.wrappedLocals=this.wrappedLocals,r.wrappedLocalsExt=this.wrappedLocalsExt?this.wrappedLocalsExt.slice():null,r.inlineFunction=this.inlineFunction,r.inlineReturnLabel=this.inlineReturnLabel,r},e.prototype.getTempLocal=function(e,r){void 0===r&&(r=!1);var t,n,i=this.parentFunction;switch(e.toNativeType()){case s.NativeType.I32:t=i.tempI32s;break;case s.NativeType.I64:t=i.tempI64s;break;case s.NativeType.F32:t=i.tempF32s;break;case s.NativeType.F64:t=i.tempF64s;break;case s.NativeType.V128:t=i.tempV128s;break;default:throw new Error("concrete type expected")}return t&&t.length?((n=t.pop()).type=e,n.flags=o.CommonFlags.NONE):n=i.addLocal(e),e.is(36)&&this.setLocalWrapped(n.index,r),n},e.prototype.freeTempLocal=function(e){if(!e.is(o.CommonFlags.INLINED)){assert(e.index>=0);var r,t=this.parentFunction;switch(assert(null!=e.type),e.type.toNativeType()){case s.NativeType.I32:r=t.tempI32s||(t.tempI32s=[]);break;case s.NativeType.I64:r=t.tempI64s||(t.tempI64s=[]);break;case s.NativeType.F32:r=t.tempF32s||(t.tempF32s=[]);break;case s.NativeType.F64:r=t.tempF64s||(t.tempF64s=[]);break;case s.NativeType.V128:r=t.tempV128s||(t.tempV128s=[]);break;default:throw new Error("concrete type expected")}assert(e.index>=0),r.push(e)}},e.prototype.getAndFreeTempLocal=function(e,r){var t,n,i=this.parentFunction;switch(e.toNativeType()){case s.NativeType.I32:t=i.tempI32s||(i.tempI32s=[]);break;case s.NativeType.I64:t=i.tempI64s||(i.tempI64s=[]);break;case s.NativeType.F32:t=i.tempF32s||(i.tempF32s=[]);break;case s.NativeType.F64:t=i.tempF64s||(i.tempF64s=[]);break;case s.NativeType.V128:t=i.tempV128s||(i.tempV128s=[]);break;default:throw new Error("concrete type expected")}return t.length?(n=t[t.length-1]).type=e:(n=i.addLocal(e),t.push(n)),e.is(36)&&this.setLocalWrapped(n.index,r),n},e.prototype.addScopedLocal=function(e,r,t,n){void 0===n&&(n=null);var i=this.getTempLocal(r,!1);if(this.scopedLocals){var a=this.scopedLocals.get(e);if(a)return n&&this.parentFunction.program.error(c.DiagnosticCode.Duplicate_identifier_0,n.range),a}else this.scopedLocals=new Map;return i.set(o.CommonFlags.SCOPED),this.scopedLocals.set(e,i),r.is(36)&&this.setLocalWrapped(i.index,t),i},e.prototype.addScopedAlias=function(e,r,t,n){if(void 0===n&&(n=null),this.scopedLocals){var i=this.scopedLocals.get(e);if(i)return n&&this.parentFunction.program.error(c.DiagnosticCode.Duplicate_identifier_0,n.range),i}else this.scopedLocals=new Map;assert(t<this.parentFunction.localsByIndex.length);var s=new a.Local(e,t,r,this.parentFunction);return this.scopedLocals.set(e,s),s},e.prototype.freeScopedLocals=function(){var e,r;if(this.scopedLocals){try{for(var t=n(this.scopedLocals.values()),i=t.next();!i.done;i=t.next()){var a=i.value;a.is(o.CommonFlags.SCOPED)&&this.freeTempLocal(a)}}catch(r){e={error:r}}finally{try{i&&!i.done&&(r=t.return)&&r.call(t)}finally{if(e)throw e.error}}this.scopedLocals=null}},e.prototype.lookupLocal=function(e){var r,t=this;do{if((r=t.scopedLocals)&&r.has(e))return r.get(e)}while(t=t.parent);return this.parentFunction.localsByName.get(e)},e.prototype.lookup=function(e){var r=this.lookupLocal(e);return r||this.actualFunction.lookup(e)},e.prototype.isLocalWrapped=function(e){if(e<0)return!0;if(e<64)return l.bitsetIs(this.wrappedLocals,e);var r=this.wrappedLocalsExt,t=(e-64)/64|0;return!!(r&&t<r.length)&&l.bitsetIs(r[t],e-64*(t+1))},e.prototype.setLocalWrapped=function(e,r){if(!(e<0))if(e<64)this.wrappedLocals=l.bitsetSet(this.wrappedLocals,e,r);else{var t=this.wrappedLocalsExt,n=(e-64)/64|0;if(t)for(;t.length<=n;)t.push(i64_new(0));else{this.wrappedLocalsExt=t=new Array(n+1);for(var i=0;i<=n;++i)t[i]=i64_new(0)}t[n]=l.bitsetSet(t[n],e-64*(n+1),r)}},e.prototype.pushBreakLabel=function(){var e=this.parentFunction,r=e.nextBreakId++,t=e.breakStack;return t?t.push(r):e.breakStack=[r],e.breakLabel=r.toString(10)},e.prototype.popBreakLabel=function(){var e=this.parentFunction,r=assert(e.breakStack),t=assert(r.length);r.pop(),t>1?e.breakLabel=r[t-2].toString(10):(e.breakLabel=null,e.breakStack=null)},e.prototype.inherit=function(e){this.flags|=4095&e.flags,this.wrappedLocals=e.wrappedLocals,this.wrappedLocalsExt=e.wrappedLocalsExt},e.prototype.inheritConditional=function(e){e.is(1)&&this.set(128),e.is(4)&&this.set(256),e.is(8)&&e.breakLabel==this.breakLabel&&this.set(512),e.is(16)&&e.continueLabel==this.continueLabel&&this.set(1024),e.is(32)&&this.set(2048)},e.prototype.inheritMutual=function(e,r){this.flags|=e.flags&r.flags&127,this.flags|=3968&e.flags,this.flags|=3968&r.flags,this.wrappedLocals=i64_and(e.wrappedLocals,r.wrappedLocals);var t=e.wrappedLocalsExt,n=r.wrappedLocalsExt;if(null!=t&&null!=n){var i=this.wrappedLocalsExt,a=min(t.length,n.length);if(a){if(i)for(;i.length<a;)i.push(i64_new(0));else i=new Array(a);for(var s=0;s<a;++s)i[s]=i64_and(t[s],n[s])}}},e.prototype.canOverflow=function(e,r){if(assert(r!=i.Type.void),!r.is(36))return!1;var t;switch(s.getExpressionId(e)){case s.ExpressionId.GetLocal:var n=this.parentFunction.localsByIndex[s.getGetLocalIndex(e)];return!this.isLocalWrapped(n.index)||u(n.type,r);case s.ExpressionId.SetLocal:return assert(s.isTeeLocal(e)),this.canOverflow(s.getSetLocalValue(e),r);case s.ExpressionId.GetGlobal:var o=assert(this.parentFunction.program.elementsByName.get(assert(s.getGetGlobalName(e))));return assert(o.kind==a.ElementKind.GLOBAL),u(assert(o.type),r);case s.ExpressionId.Binary:switch(s.getBinaryOp(e)){case s.BinaryOp.EqI32:case s.BinaryOp.EqI64:case s.BinaryOp.EqF32:case s.BinaryOp.EqF64:case s.BinaryOp.NeI32:case s.BinaryOp.NeI64:case s.BinaryOp.NeF32:case s.BinaryOp.NeF64:case s.BinaryOp.LtI32:case s.BinaryOp.LtU32:case s.BinaryOp.LtI64:case s.BinaryOp.LtU64:case s.BinaryOp.LtF32:case s.BinaryOp.LtF64:case s.BinaryOp.LeI32:case s.BinaryOp.LeU32:case s.BinaryOp.LeI64:case s.BinaryOp.LeU64:case s.BinaryOp.LeF32:case s.BinaryOp.LeF64:case s.BinaryOp.GtI32:case s.BinaryOp.GtU32:case s.BinaryOp.GtI64:case s.BinaryOp.GtU64:case s.BinaryOp.GtF32:case s.BinaryOp.GtF64:case s.BinaryOp.GeI32:case s.BinaryOp.GeU32:case s.BinaryOp.GeI64:case s.BinaryOp.GeU64:case s.BinaryOp.GeF32:case s.BinaryOp.GeF64:return!1;case s.BinaryOp.MulI32:return!(s.getExpressionId(t=s.getBinaryLeft(e))==s.ExpressionId.Const&&(0==s.getConstValueI32(t)||1==s.getConstValueI32(t)&&!this.canOverflow(s.getBinaryRight(e),r))||s.getExpressionId(t=s.getBinaryRight(e))==s.ExpressionId.Const&&(0==s.getConstValueI32(t)||1==s.getConstValueI32(t)&&!this.canOverflow(s.getBinaryLeft(e),r)));case s.BinaryOp.AndI32:return!(s.getExpressionId(t=s.getBinaryLeft(e))==s.ExpressionId.Const&&s.getConstValueI32(t)<=r.computeSmallIntegerMask(i.Type.i32)||!this.canOverflow(t,r)||s.getExpressionId(t=s.getBinaryRight(e))==s.ExpressionId.Const&&s.getConstValueI32(t)<=r.computeSmallIntegerMask(i.Type.i32)||!this.canOverflow(t,r));case s.BinaryOp.ShlI32:var c=32-r.size;return s.getExpressionId(t=s.getBinaryRight(e))!=s.ExpressionId.Const||s.getConstValueI32(t)<c;case s.BinaryOp.ShrI32:c=32-r.size;return this.canOverflow(s.getBinaryLeft(e),r)&&(s.getExpressionId(t=s.getBinaryRight(e))!=s.ExpressionId.Const||s.getConstValueI32(t)<c);case s.BinaryOp.ShrU32:c=32-r.size;return r.is(1)?!(s.getExpressionId(t=s.getBinaryRight(e))==s.ExpressionId.Const&&s.getConstValueI32(t)>c):this.canOverflow(s.getBinaryLeft(e),r)&&!(s.getExpressionId(t=s.getBinaryRight(e))==s.ExpressionId.Const&&s.getConstValueI32(t)>=c);case s.BinaryOp.DivU32:case s.BinaryOp.RemI32:case s.BinaryOp.RemU32:return this.canOverflow(s.getBinaryLeft(e),r)||this.canOverflow(s.getBinaryRight(e),r)}break;case s.ExpressionId.Unary:switch(s.getUnaryOp(e)){case s.UnaryOp.EqzI32:case s.UnaryOp.EqzI64:return!1;case s.UnaryOp.ClzI32:case s.UnaryOp.CtzI32:case s.UnaryOp.PopcntI32:return r.size<7}break;case s.ExpressionId.Const:var l=0;switch(s.getExpressionType(e)){case s.NativeType.I32:l=s.getConstValueI32(e);break;case s.NativeType.I64:l=s.getConstValueI64Low(e);break;case s.NativeType.F32:l=i32(s.getConstValueF32(e));break;case s.NativeType.F64:l=i32(s.getConstValueF64(e));break;default:assert(!1)}switch(r.kind){case 0:return l<i8.MIN_VALUE||l>i8.MAX_VALUE;case 1:return l<i16.MIN_VALUE||l>i16.MAX_VALUE;case 5:return l<0||l>u8.MAX_VALUE;case 6:return l<0||l>u16.MAX_VALUE;case 10:return 0!=(-2&l)}break;case s.ExpressionId.Load:var p=void 0;switch(s.getLoadBytes(e)){case 1:p=s.isLoadSigned(e)?i.Type.i8:i.Type.u8;break;case 2:p=s.isLoadSigned(e)?i.Type.i16:i.Type.u16;break;default:p=s.isLoadSigned(e)?i.Type.i32:i.Type.u32}return u(p,r);case s.ExpressionId.Block:if(!s.getBlockName(e)){var _=assert(s.getBlockChildCount(e)),h=s.getBlockChild(e,_-1);return this.canOverflow(h,r)}break;case s.ExpressionId.If:return this.canOverflow(s.getIfTrue(e),r)||this.canOverflow(assert(s.getIfFalse(e)),r);case s.ExpressionId.Select:return this.canOverflow(s.getSelectThen(e),r)||this.canOverflow(s.getSelectElse(e),r);case s.ExpressionId.Call:var d=this.parentFunction.program,y=assert(d.instancesByName.get(assert(s.getCallTarget(e))));assert(y.kind==a.ElementKind.FUNCTION);var m=y.signature.returnType;return!y.flow.is(2)||u(m,r);case s.ExpressionId.Unreachable:return!1}return!0},e}();function u(e,r){return!e.is(4)||e.size>r.size||e.is(1)!=r.is(1)}r.Flow=p},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t(4),i=function(){function e(){this.text=[],this.functionId=0}return e.decompile=function(r){var t=new e;return t.decompile(r),t.finish()},e.prototype.decompile=function(e){throw new Error("not implemented")},e.prototype.decompileFunction=function(e){var r=n.getFunctionName(e)||"$"+this.functionId.toString(10),t=n.getFunctionBody(e);this.push("function "),this.push(r),this.push("(");for(var i=0,s=n.getFunctionParamCount(e);i<s;++i)i>0&&this.push(", "),this.push("$"),this.push(i.toString(10)),this.push(": "),this.push(a(n.getFunctionParamType(e,i)));this.push("): "),this.push(a(n.getFunctionResultType(e))),this.push(" "),n.getExpressionId(t)!=n.ExpressionId.Block&&this.push("{\n"),this.decompileExpression(t),n.getExpressionId(t)!=n.ExpressionId.Block&&this.push("\n}\n"),++this.functionId},e.prototype.decompileExpression=function(e){var r,t,i,s,o=n.getExpressionId(e),c=n.getExpressionType(e);switch(o){case n.ExpressionId.Block:for(null!=(t=n.getBlockName(e))&&(this.push(t),this.push(": ")),this.push("{\n"),s=n.getBlockChildCount(e),i=0;i<s;++i)this.decompileExpression(n.getBlockChild(e,i));return void this.push("}\n");case n.ExpressionId.If:return void(c==n.NativeType.None?(this.push("if ("),this.decompileExpression(n.getIfCondition(e)),this.push(") "),this.decompileExpression(n.getIfTrue(e)),(r=n.getIfFalse(e))&&(this.push(" else "),this.decompileExpression(r))):(this.decompileExpression(n.getIfCondition(e)),this.push(" ? "),this.decompileExpression(n.getIfTrue(e)),this.push(" : "),this.decompileExpression(n.getIfFalse(e))));case n.ExpressionId.Loop:null!=(t=n.getLoopName(e))&&(this.push(t),this.push(": ")),this.push("do "),this.decompileExpression(n.getLoopBody(e)),this.push("while (0);\n");case n.ExpressionId.Break:return(r=n.getBreakCondition(e))&&(this.push("if ("),this.decompileExpression(r),this.push(") ")),void(null!=(t=n.getBreakName(e))?(this.push("break "),this.push(t),this.push(";\n")):this.push("break;\n"));case n.ExpressionId.Switch:case n.ExpressionId.Call:case n.ExpressionId.CallIndirect:throw new Error("not implemented");case n.ExpressionId.GetLocal:return this.push("$"),void this.push(n.getGetLocalIndex(e).toString(10));case n.ExpressionId.SetLocal:return this.push("$"),this.push(n.getSetLocalIndex(e).toString(10)),this.push(" = "),void this.decompileExpression(n.getSetLocalValue(e));case n.ExpressionId.GetGlobal:case n.ExpressionId.SetGlobal:throw new Error("not implemented");case n.ExpressionId.Load:return this.push("load<"),this.push(a(c)),this.push(">("),this.push(n.getLoadOffset(e).toString(10)),this.push(" + "),this.decompileExpression(n.getLoadPtr(e)),void this.push(")");case n.ExpressionId.Store:return this.push("store<"),this.push(a(c)),this.push(">("),this.push(n.getStoreOffset(e).toString(10)),this.push(" + "),this.decompileExpression(n.getStorePtr(e)),this.push(", "),this.decompileExpression(n.getStoreValue(e)),void this.push(")");case n.ExpressionId.Const:switch(c){case n.NativeType.I32:return void this.push(n.getConstValueI32(e).toString(10));case n.NativeType.I64:return void this.push(i64_to_string(i64_new(n.getConstValueI64Low(e),n.getConstValueI64High(e))));case n.NativeType.F32:return void this.push(n.getConstValueF32(e).toString(10));case n.NativeType.F64:return void this.push(n.getConstValueF64(e).toString(10))}break;case n.ExpressionId.Unary:switch(n.getUnaryOp(e)){case n.UnaryOp.ClzI32:return this.push("clz<i32>("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.CtzI32:return this.push("ctz<i32>("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.PopcntI32:return this.push("popcnt<i32>("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.NegF32:case n.UnaryOp.NegF64:return this.push("-"),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.AbsF32:return this.push("abs<f32>("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.CeilF32:return this.push("ceil<f32>("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.FloorF32:return this.push("floor<f32>("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.TruncF32:return this.push("trunc<f32>("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.NearestF32:return this.push("nearest<i32>("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.SqrtF32:return this.push("sqrt<f32>("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.EqzI32:case n.UnaryOp.EqzI64:return this.push("!"),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.ClzI64:return this.push("clz<i64>("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.CtzI64:return this.push("ctz<i64>("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.PopcntI64:return this.push("popcnt<i64>("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.AbsF64:return this.push("abs<f64>("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.CeilF64:return this.push("ceil<f64>("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.FloorF64:return this.push("floor<f64>("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.TruncF64:return this.push("trunc<f64>("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.NearestF64:return this.push("nearest<f64>("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.SqrtF64:return this.push("sqrt<f64>("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.ExtendI32:return this.push("<i64>"),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.ExtendU32:return this.push("<i64><u64>"),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.WrapI64:case n.UnaryOp.TruncF32ToI32:return this.push("<i32>"),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.TruncF32ToI64:return this.push("<i64>"),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.TruncF32ToU32:return this.push("<i32><u32>"),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.TruncF32ToU64:return this.push("<i64><u64>"),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.TruncF64ToI32:return this.push("<i32>"),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.TruncF64ToI64:return this.push("<i64>"),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.TruncF64ToU32:return this.push("<i32><u32>"),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.TruncF64ToU64:return this.push("<i64><u64>"),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.ReinterpretF32:return this.push("reinterpret<f32,i32>("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.ReinterpretF64:return this.push("reinterpret<f64,i64>("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.ConvertI32ToF32:return this.push("<f32>"),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.ConvertI32ToF64:return this.push("<f64>"),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.ConvertU32ToF32:return this.push("<f32><u32>"),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.ConvertU32ToF64:return this.push("<f64><u32>"),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.ConvertI64ToF32:return this.push("<f32>"),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.ConvertI64ToF64:return this.push("<f64>"),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.ConvertU64ToF32:return this.push("<f32><u64>"),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.ConvertU64ToF64:return this.push("<f64><u64>"),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.PromoteF32:return this.push("<f64>"),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.DemoteF64:return this.push("<f32>"),void this.decompileExpression(n.getUnaryValue(e));case n.UnaryOp.ReinterpretI32:return this.push("reinterpret<i32,f32>("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")");case n.UnaryOp.ReinterpretI64:return this.push("reinterpret<i64,f64>("),this.decompileExpression(n.getUnaryValue(e)),void this.push(")")}break;case n.ExpressionId.Binary:switch(n.getBinaryOp(e)){case n.BinaryOp.AddI32:case n.BinaryOp.AddI64:case n.BinaryOp.AddF32:case n.BinaryOp.AddF64:return this.decompileExpression(n.getBinaryLeft(e)),this.push(" + "),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.SubI32:case n.BinaryOp.SubI64:case n.BinaryOp.SubF32:case n.BinaryOp.SubF64:return this.decompileExpression(n.getBinaryLeft(e)),this.push(" - "),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.MulI32:case n.BinaryOp.MulI64:case n.BinaryOp.MulF32:case n.BinaryOp.MulF64:return this.decompileExpression(n.getBinaryLeft(e)),this.push(" * "),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.DivI32:case n.BinaryOp.DivI64:case n.BinaryOp.DivF32:case n.BinaryOp.DivF64:return this.decompileExpression(n.getBinaryLeft(e)),this.push(" / "),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.DivU32:return this.push("<i32>(<u32>"),this.decompileExpression(n.getBinaryLeft(e)),this.push(" / <u32>"),this.decompileExpression(n.getBinaryRight(e)),void this.push(")");case n.BinaryOp.RemI32:case n.BinaryOp.RemI64:return this.decompileExpression(n.getBinaryLeft(e)),this.push(" % "),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.RemU32:return this.push("<i32>(<u32>"),this.decompileExpression(n.getBinaryLeft(e)),this.push(" / <u32>"),this.decompileExpression(n.getBinaryRight(e)),void this.push(")");case n.BinaryOp.AndI32:case n.BinaryOp.AndI64:return this.decompileExpression(n.getBinaryLeft(e)),this.push(" & "),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.OrI32:case n.BinaryOp.OrI64:return this.decompileExpression(n.getBinaryLeft(e)),this.push(" | "),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.XorI32:case n.BinaryOp.XorI64:return this.decompileExpression(n.getBinaryLeft(e)),this.push(" ^ "),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.ShlI32:case n.BinaryOp.ShlI64:return this.decompileExpression(n.getBinaryLeft(e)),this.push(" << "),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.ShrU32:case n.BinaryOp.ShrU64:return this.decompileExpression(n.getBinaryLeft(e)),this.push(" >>> "),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.ShrI32:case n.BinaryOp.ShrI64:return this.decompileExpression(n.getBinaryLeft(e)),this.push(" >> "),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.RotlI32:return this.push("rotl<i32>("),this.decompileExpression(n.getBinaryLeft(e)),this.push(", "),this.decompileExpression(n.getBinaryRight(e)),void this.push(")");case n.BinaryOp.RotrI32:return this.push("rotr<i32>("),this.decompileExpression(n.getBinaryLeft(e)),this.push(", "),this.decompileExpression(n.getBinaryRight(e)),void this.push(")");case n.BinaryOp.EqI32:case n.BinaryOp.EqI64:case n.BinaryOp.EqF32:case n.BinaryOp.EqF64:return this.decompileExpression(n.getBinaryLeft(e)),this.push(" == "),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.NeI32:case n.BinaryOp.NeI64:case n.BinaryOp.NeF32:case n.BinaryOp.NeF64:return this.decompileExpression(n.getBinaryLeft(e)),this.push(" != "),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.LtI32:case n.BinaryOp.LtI64:case n.BinaryOp.LtF32:case n.BinaryOp.LtF64:return this.decompileExpression(n.getBinaryLeft(e)),this.push(" < "),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.LtU32:return this.push("<u32>"),this.decompileExpression(n.getBinaryLeft(e)),this.push(" < <u32>"),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.LeI32:case n.BinaryOp.LeI64:case n.BinaryOp.LeF32:case n.BinaryOp.LeF64:return this.decompileExpression(n.getBinaryLeft(e)),this.push(" <= "),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.LeU32:return this.push("<u32>"),this.decompileExpression(n.getBinaryLeft(e)),this.push(" <= <u32>"),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.GtI32:case n.BinaryOp.GtI64:case n.BinaryOp.GtF32:case n.BinaryOp.GtF64:return this.decompileExpression(n.getBinaryLeft(e)),this.push(" > "),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.GtU32:return this.push("<u32>"),this.decompileExpression(n.getBinaryLeft(e)),this.push(" > <u32>"),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.GeI32:case n.BinaryOp.GeI64:case n.BinaryOp.GeF32:case n.BinaryOp.GeF64:return this.decompileExpression(n.getBinaryLeft(e)),this.push(" >= "),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.GeU32:return this.push("<u32>"),this.decompileExpression(n.getBinaryLeft(e)),this.push(" >= <u32>"),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.DivU64:return this.push("<u64>"),this.decompileExpression(n.getBinaryLeft(e)),this.push(" / <u64>"),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.RemU64:return this.push("<u64>"),this.decompileExpression(n.getBinaryLeft(e)),this.push(" % <u64>"),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.RotlI64:return this.push("rotl<i64>("),this.decompileExpression(n.getBinaryLeft(e)),this.push(", "),this.decompileExpression(n.getBinaryRight(e)),void this.push(")");case n.BinaryOp.RotrI64:return this.push("rotr<i64>("),this.decompileExpression(n.getBinaryLeft(e)),this.push(", "),this.decompileExpression(n.getBinaryRight(e)),void this.push(")");case n.BinaryOp.LtU64:return this.push("<u64>"),this.decompileExpression(n.getBinaryLeft(e)),this.push(" < <u64>"),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.LeU64:return this.push("<u64>"),this.decompileExpression(n.getBinaryLeft(e)),this.push(" <= <u64>"),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.GtU64:return this.push("<u64>"),this.decompileExpression(n.getBinaryLeft(e)),this.push(" > <u64>"),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.GeU64:return this.push("<u64>"),this.decompileExpression(n.getBinaryLeft(e)),this.push(" >= <u64>"),void this.decompileExpression(n.getBinaryRight(e));case n.BinaryOp.CopysignF32:return this.push("copysign<f32>("),this.decompileExpression(n.getBinaryLeft(e)),this.push(", "),this.decompileExpression(n.getBinaryRight(e)),void this.push(")");case n.BinaryOp.MinF32:return this.push("min<f32>("),this.decompileExpression(n.getBinaryLeft(e)),this.push(", "),this.decompileExpression(n.getBinaryRight(e)),void this.push(")");case n.BinaryOp.MaxF32:return this.push("max<f32>("),this.decompileExpression(n.getBinaryLeft(e)),this.push(", "),this.decompileExpression(n.getBinaryRight(e)),void this.push(")");case n.BinaryOp.CopysignF64:return this.push("copysign<f64>("),this.decompileExpression(n.getBinaryLeft(e)),this.push(", "),this.decompileExpression(n.getBinaryRight(e)),void this.push(")");case n.BinaryOp.MinF64:return this.push("min<f64>("),this.decompileExpression(n.getBinaryLeft(e)),this.push(", "),this.decompileExpression(n.getBinaryRight(e)),void this.push(")");case n.BinaryOp.MaxF64:return this.push("max<f64>("),this.decompileExpression(n.getBinaryLeft(e)),this.push(", "),this.decompileExpression(n.getBinaryRight(e)),void this.push(")")}return;case n.ExpressionId.Select:return this.push("select<"),this.push(a(c)),this.push(">("),this.decompileExpression(n.getSelectThen(e)),this.push(", "),this.decompileExpression(n.getSelectElse(e)),this.push(", "),this.decompileExpression(n.getSelectCondition(e)),void this.push(")");case n.ExpressionId.Drop:return this.decompileExpression(n.getDropValue(e)),void this.push(";\n");case n.ExpressionId.Return:return void((r=n.getReturnValue(e))?(this.push("return "),this.decompileExpression(r),this.push(";\n")):this.push("return;\n"));case n.ExpressionId.Host:switch(n.getHostOp(e)){case n.HostOp.CurrentMemory:return void this.push("memory.size()");case n.HostOp.GrowMemory:return this.push("memory.grow("),this.decompileExpression(n.getHostOperand(e,0)),void this.push(")")}break;case n.ExpressionId.Nop:return void this.push(";\n");case n.ExpressionId.Unreachable:return void this.push("unreachable()");case n.ExpressionId.AtomicCmpxchg:case n.ExpressionId.AtomicRMW:case n.ExpressionId.AtomicWait:case n.ExpressionId.AtomicWake:}throw new Error("not implemented")},e.prototype.push=function(e){this.text.push(e)},e.prototype.finish=function(){var e=this.text.join("");return this.text=[],e},e}();function a(e){switch(e){case n.NativeType.None:return"void";case n.NativeType.I32:return"i32";case n.NativeType.I64:return"i64";case n.NativeType.F32:return"f32";case n.NativeType.F64:return"f64";case n.NativeType.V128:return"v128";case n.NativeType.Unreachable:throw new Error("unreachable type");case n.NativeType.Auto:throw new Error("auto type");default:throw new Error("unexpected type")}}r.Decompiler=i},function(e,r,t){"use strict";var n,i=this&&this.__extends||(n=function(e,r){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)r.hasOwnProperty(t)&&(e[t]=r[t])})(e,r)},function(e,r){function t(){this.constructor=e}n(e,r),e.prototype=null===r?Object.create(r):(t.prototype=r.prototype,new t)}),a=this&&this.__values||function(e){var r="function"==typeof Symbol&&e[Symbol.iterator],t=0;return r?r.call(e):{next:function(){return e&&t>=e.length&&(e=void 0),{value:e&&e[t++],done:!e}}}},s=this&&this.__read||function(e,r){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var n,i,a=t.call(e),s=[];try{for(;(void 0===r||r-- >0)&&!(n=a.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(t=a.return)&&t.call(a)}finally{if(i)throw i.error}}return s};Object.defineProperty(r,"__esModule",{value:!0});var o=t(0),c=t(3),l=t(1),p=function(){function e(e,r){void 0===r&&(r=!1),this.todo=[],this.seen=new Set,this.program=e,this.includePrivate}return e.prototype.walk=function(){var e,r,t,n;try{for(var i=a(this.program.filesByName.values()),s=i.next();!s.done;s=i.next()){var o=s.value.members;if(o)try{for(var c=a(o.values()),l=c.next();!l.done;l=c.next()){var p=l.value;this.visitElement(p)}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=c.return)&&n.call(c)}finally{if(t)throw t.error}}}}catch(r){e={error:r}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(e)throw e.error}}for(var u=this.todo;0<u.length;)this.visitElement(u[0])},e.prototype.visitElement=function(e){if((!e.is(o.CommonFlags.PRIVATE)||this.includePrivate)&&!this.seen.has(e))switch(this.seen.add(e),e.kind){case c.ElementKind.GLOBAL:e.is(o.CommonFlags.COMPILED)&&this.visitGlobal(e);break;case c.ElementKind.ENUM:e.is(o.CommonFlags.COMPILED)&&this.visitEnum(e);break;case c.ElementKind.FUNCTION_PROTOTYPE:this.visitFunctionInstances(e);break;case c.ElementKind.CLASS_PROTOTYPE:this.visitClassInstances(e);break;case c.ElementKind.FIELD:e.is(o.CommonFlags.COMPILED)&&this.visitField(e);break;case c.ElementKind.PROPERTY_PROTOTYPE:this.visitPropertyInstances(e);break;case c.ElementKind.PROPERTY:var r=e,t=r.getterInstance;t&&this.visitFunction(t);var n=r.setterInstance;n&&this.visitFunction(n);break;case c.ElementKind.NAMESPACE:(function e(r){var t,n,i,s,l,p;var u=r.members;if(u)try{for(var _=a(u.values()),h=_.next();!h.done;h=_.next()){var d=h.value;switch(d.kind){case c.ElementKind.FUNCTION_PROTOTYPE:var y=d.instances;if(y)try{for(var m=a(y.values()),T=m.next();!T.done;T=m.next()){var f=T.value;if(f.is(o.CommonFlags.COMPILED))return!0}}catch(e){i={error:e}}finally{try{T&&!T.done&&(s=m.return)&&s.call(m)}finally{if(i)throw i.error}}break;case c.ElementKind.CLASS_PROTOTYPE:var y=d.instances;if(y)try{for(var E=a(y.values()),g=E.next();!g.done;g=E.next()){var f=g.value;if(f.is(o.CommonFlags.COMPILED))return!0}}catch(e){l={error:e}}finally{try{g&&!g.done&&(p=E.return)&&p.call(E)}finally{if(l)throw l.error}}break;default:if(d.is(o.CommonFlags.COMPILED)||e(d))return!0}}}catch(e){t={error:e}}finally{try{h&&!h.done&&(n=_.return)&&n.call(_)}finally{if(t)throw t.error}}return!1})(e)&&this.visitNamespace(e);break;case c.ElementKind.TYPEDEFINITION:break;default:assert(!1)}},e.prototype.visitFunctionInstances=function(e){var r,t,n=e.instances;if(n)try{for(var i=a(n.values()),s=i.next();!s.done;s=i.next()){var c=s.value;c.is(o.CommonFlags.COMPILED)&&this.visitFunction(c)}}catch(e){r={error:e}}finally{try{s&&!s.done&&(t=i.return)&&t.call(i)}finally{if(r)throw r.error}}},e.prototype.visitClassInstances=function(e){var r,t,n=e.instances;if(n)try{for(var i=a(n.values()),s=i.next();!s.done;s=i.next()){var c=s.value;c.is(o.CommonFlags.COMPILED)&&this.visitClass(c)}}catch(e){r={error:e}}finally{try{s&&!s.done&&(t=i.return)&&t.call(i)}finally{if(r)throw r.error}}},e.prototype.visitPropertyInstances=function(e){assert(!1)},e}(),u=function(e){function r(r,t){void 0===t&&(t=!1);var n=e.call(this,r,t)||this;return n.sb=[],n.indentLevel=0,n}return i(r,e),r.build=function(e){return new r(e).build()},r.prototype.visitGlobal=function(e){var r=this.sb,t=e.is(o.CommonFlags.INLINED);if(l.indent(r,this.indentLevel),t&&r.push("const "),r.push(this.typeToString(e.type)),r.push(" "),r.push(e.name),t)switch(e.constantValueKind){case 1:r.push(" = "),r.push(i64_to_string(e.constantIntegerValue));break;case 2:r.push(" = "),r.push(e.constantFloatValue.toString());break;default:assert(!1)}r.push(";\n")},r.prototype.visitEnum=function(e){var r,t,n,i,p=this.sb;l.indent(p,this.indentLevel++),p.push("interface "),p.push(e.name),p.push(" {\n");var u=e.members;if(u){try{for(var _=a(u),h=_.next();!h.done;h=_.next()){var d=s(h.value,2),y=d[0];if((E=d[1]).kind==c.ElementKind.ENUMVALUE){var m=E.is(o.CommonFlags.INLINED);l.indent(p,this.indentLevel),m?p.push("const "):p.push("readonly "),p.push("unsigned long "),p.push(y),m&&(p.push(" = "),assert(1==E.constantValueKind),p.push(i64_low(E.constantIntegerValue).toString(10))),p.push(";\n")}}}catch(e){r={error:e}}finally{try{h&&!h.done&&(t=_.return)&&t.call(_)}finally{if(r)throw r.error}}try{for(var T=a(u.values()),f=T.next();!f.done;f=T.next()){var E;(E=f.value).kind!=c.ElementKind.ENUMVALUE&&this.visitElement(E)}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=T.return)&&i.call(T)}finally{if(n)throw n.error}}}l.indent(p,--this.indentLevel),p.push("}\n")},r.prototype.visitFunction=function(e){var r,t,n=this.sb,i=e.signature;l.indent(n,this.indentLevel),n.push(this.typeToString(i.returnType)),n.push(" "),n.push(e.name),n.push("(");for(var s=i.parameterTypes,o=s.length,c=0;c<o;++c)c&&n.push(", "),n.push(this.typeToString(s[c])),n.push(" "),n.push(i.getParameterName(c));n.push(");\n");var p=e.members;if(p&&p.size){l.indent(n,this.indentLevel),n.push("interface "),n.push(e.name),n.push(" {\n");try{for(var u=a(p.values()),_=u.next();!_.done;_=u.next()){var h=_.value;this.visitElement(h)}}catch(e){r={error:e}}finally{try{_&&!_.done&&(t=u.return)&&t.call(u)}finally{if(r)throw r.error}}l.indent(n,--this.indentLevel),n.push("}\n")}},r.prototype.visitClass=function(e){var r=this.sb;l.indent(r,this.indentLevel++),r.push("interface "),r.push(e.name),r.push(" {\n"),l.indent(r,--this.indentLevel),r.push("}\n")},r.prototype.visitInterface=function(e){this.visitClass(e)},r.prototype.visitField=function(e){},r.prototype.visitNamespace=function(e){var r,t,n=this.sb;l.indent(n,this.indentLevel++),n.push("interface "),n.push(e.name),n.push(" {\n");var i=e.members;if(i)try{for(var s=a(i.values()),o=s.next();!o.done;o=s.next()){var c=o.value;this.visitElement(c)}}catch(e){r={error:e}}finally{try{o&&!o.done&&(t=s.return)&&t.call(s)}finally{if(r)throw r.error}}l.indent(n,--this.indentLevel),n.push("}\n")},r.prototype.typeToString=function(e){switch(e.kind){case 0:return"byte";case 1:return"short";case 2:return"long";case 3:return"long long";case 4:return this.program.options.isWasm64?"long long":"long";case 5:return"octet";case 6:return"unsigned short";case 7:return"unsigned long";case 8:return"unsigned long long";case 9:return this.program.options.isWasm64?"unsigned long long":"unsigned long";case 10:return"boolean";case 11:return"unrestricted float";case 12:return"unrestricted double";case 14:return"void";default:return assert(!1),""}},r.prototype.build=function(){var e=this.sb;return e.push("interface ASModule {\n"),++this.indentLevel,this.walk(),--this.indentLevel,e.push("}\n"),e.join("")},r}(p);r.IDLBuilder=u;var _=function(e){function r(r,t){void 0===t&&(t=!1);var n=e.call(this,r,t)||this;return n.sb=[],n.indentLevel=0,n}return i(r,e),r.build=function(e){return new r(e).build()},r.prototype.visitGlobal=function(e){var r=this.sb,t=e.is(o.CommonFlags.INLINED);l.indent(r,this.indentLevel),e.is(o.CommonFlags.STATIC)?t?r.push("static readonly "):r.push("static "):t?r.push("const "):r.push("var "),r.push(e.name),r.push(": "),r.push(this.typeToString(e.type)),r.push(";\n"),this.visitNamespace(e)},r.prototype.visitEnum=function(e){var r,t,n=this.sb;l.indent(n,this.indentLevel++),n.push("enum "),n.push(e.name),n.push(" {\n");var i=e.members;if(i){var p=i.size;try{for(var u=a(i),_=u.next();!_.done;_=u.next()){var h=s(_.value,2),d=h[0],y=h[1];y.kind==c.ElementKind.ENUMVALUE&&(l.indent(n,this.indentLevel),n.push(d),y.is(o.CommonFlags.INLINED)&&(n.push(" = "),assert(1==y.constantValueKind),n.push(i64_low(y.constantIntegerValue).toString(10))),n.push(",\n"),--p)}}catch(e){r={error:e}}finally{try{_&&!_.done&&(t=u.return)&&t.call(u)}finally{if(r)throw r.error}}p&&this.visitNamespace(e)}l.indent(n,--this.indentLevel),n.push("}\n")},r.prototype.visitFunction=function(e){if(!e.isAny(o.CommonFlags.PRIVATE|o.CommonFlags.SET)){var r=this.sb,t=e.signature;if(l.indent(r,this.indentLevel),e.is(o.CommonFlags.PROTECTED)&&r.push("protected "),e.is(o.CommonFlags.STATIC)&&r.push("static "),e.is(o.CommonFlags.GET))return r.push(e.identifierNode.text),r.push(": "),r.push(this.typeToString(t.returnType)),void r.push(";\n");e.isAny(o.CommonFlags.STATIC|o.CommonFlags.INSTANCE)||r.push("function "),r.push(e.name),r.push("(");for(var n=t.parameterTypes,i=n.length,a=0;a<i;++a)a&&r.push(", "),r.push(t.getParameterName(a)),r.push(": "),r.push(this.typeToString(n[a]));e.isAny(o.CommonFlags.CONSTRUCTOR|o.CommonFlags.SET)?r.push(")"):(r.push("): "),r.push(this.typeToString(t.returnType))),r.push(";\n"),this.visitNamespace(e)}},r.prototype.visitClass=function(e){var r,t,n,i,s=this.sb,p=e.kind==c.ElementKind.INTERFACE;l.indent(s,this.indentLevel++),p?s.push("interface "):(e.is(o.CommonFlags.ABSTRACT)&&s.push("abstract "),s.push("class ")),s.push(e.name);var u=e.base;u&&u.is(o.CommonFlags.COMPILED|o.CommonFlags.MODULE_EXPORT)&&(s.push(" extends "),s.push(u.name)),s.push(" {\n");var _=e.parent.members;if(_)try{for(var h=a(_.values()),d=h.next();!d.done;d=h.next()){var y=d.value;this.visitElement(y)}}catch(e){r={error:e}}finally{try{d&&!d.done&&(t=h.return)&&t.call(h)}finally{if(r)throw r.error}}var m=e.constructorInstance;if(m&&this.visitFunction(m),_=e.members)try{for(var T=a(_.values()),f=T.next();!f.done;f=T.next()){y=f.value;this.visitElement(y)}}catch(e){n={error:e}}finally{try{f&&!f.done&&(i=T.return)&&i.call(T)}finally{if(n)throw n.error}}l.indent(s,--this.indentLevel),s.push("}\n")},r.prototype.visitInterface=function(e){this.visitClass(e)},r.prototype.visitField=function(e){if(!e.is(o.CommonFlags.PRIVATE)){var r=this.sb;l.indent(r,this.indentLevel),e.is(o.CommonFlags.PROTECTED)&&r.push("protected "),e.is(o.CommonFlags.STATIC)&&r.push("static "),e.is(o.CommonFlags.READONLY)&&r.push("readonly "),r.push(e.name),r.push(": "),r.push(this.typeToString(e.type)),r.push(";\n")}},r.prototype.visitNamespace=function(e){var r,t,n=e.members;if(n&&n.size){var i=this.sb;l.indent(i,this.indentLevel++),i.push("namespace "),i.push(e.name),i.push(" {\n");try{for(var s=a(n.values()),o=s.next();!o.done;o=s.next()){var c=o.value;this.visitElement(c)}}catch(e){r={error:e}}finally{try{o&&!o.done&&(t=s.return)&&t.call(s)}finally{if(r)throw r.error}}l.indent(i,--this.indentLevel),i.push("}\n")}},r.prototype.typeToString=function(e){switch(e.kind){case 0:return"i8";case 1:return"i16";case 2:return"i32";case 3:return"I64";case 4:return this.program.options.isWasm64?"I64":"i32";case 5:return"u8";case 6:return"u16";case 7:return"u32";case 8:return"U64";case 9:return this.program.options.isWasm64?"U64":"u32";case 10:return"bool";case 11:return"f32";case 12:return"f64";case 13:return"v128";case 14:return"void";default:return assert(!1),""}},r.prototype.build=function(){var e=this.sb;return e.push("declare module ASModule {\n"),e.push(" type i8 = number;\n"),e.push(" type i16 = number;\n"),e.push(" type i32 = number;\n"),e.push(" type u8 = number;\n"),e.push(" type u16 = number;\n"),e.push(" type u32 = number;\n"),e.push(" type f32 = number;\n"),e.push(" type f64 = number;\n"),e.push(" type bool = any;\n"),++this.indentLevel,this.walk(),--this.indentLevel,e.push("}\n"),e.push("export default ASModule;\n"),this.sb.join("")},r}(p);r.TSDBuilder=_},function(e,r,t){"use strict";var n,i=this&&this.__extends||(n=function(e,r){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)r.hasOwnProperty(t)&&(e[t]=r[t])})(e,r)},function(e,r){function t(){this.constructor=e}n(e,r),e.prototype=null===r?Object.create(r):(t.prototype=r.prototype,new t)});Object.defineProperty(r,"__esModule",{value:!0});var a=t(0),s=t(3),o=t(7),c=t(2),l=t(1),p=t(5),u=function(e){function r(){var r=e.call(this)||this;return r.backlog=new Array,r.seenlog=new Set,r.donelog=new Set,r.onComment=null,r.tryParseSignatureIsSignature=!1,r.parseParametersThis=null,r.program=new s.Program(r.diagnostics),r}return i(r,e),r.prototype.parseFile=function(e,r,t){var n=l.normalizePath(r),i=p.mangleInternalPath(n);if(!this.donelog.has(i)){this.donelog.add(i),this.seenlog.add(i);var s=new p.Source(n,e,t?p.SourceKind.ENTRY:r.startsWith(a.LIBRARY_PREFIX)&&r.indexOf(a.PATH_DELIMITER,a.LIBRARY_PREFIX.length)<0?p.SourceKind.LIBRARY:p.SourceKind.DEFAULT),c=this.program;c.sources.push(s);var u=new o.Tokenizer(s,c.diagnostics);u.onComment=this.onComment,s.tokenizer=u;for(var _=s.statements;!u.skip(o.Token.ENDOFFILE);){var h=this.parseTopLevelStatement(u,null);h&&_.push(h)}u.finish()}},r.prototype.parseTopLevelStatement=function(e,r){void 0===r&&(r=null);for(var t=a.CommonFlags.NONE,n=-1,i=null;e.skip(o.Token.AT);){n<0&&(n=e.tokenPos);var s=this.parseDecorator(e);s?(i||(i=[]),i.push(s)):this.skipStatement(e)}var l=0,p=0;e.skip(o.Token.EXPORT)&&(e.skip(o.Token.DEFAULT)&&this.error(c.DiagnosticCode.Operation_not_supported,e.range()),n<0&&(n=e.tokenPos),t|=a.CommonFlags.EXPORT,l=e.tokenPos,p=e.pos);var u=null!=r&&r.is(a.CommonFlags.AMBIENT);e.skip(o.Token.DECLARE)?(n<0&&(n=e.tokenPos),u&&this.error(c.DiagnosticCode.A_declare_modifier_cannot_be_used_in_an_already_ambient_context,e.range()),t|=a.CommonFlags.DECLARE|a.CommonFlags.AMBIENT):u&&(t|=a.CommonFlags.AMBIENT);var _=null,h=e.peek();switch(n<0&&(n=e.nextTokenPos),h){case o.Token.CONST:e.next(),t|=a.CommonFlags.CONST,_=e.skip(o.Token.ENUM)?this.parseEnum(e,t,i,n):this.parseVariable(e,t,i,n),i=null;break;case o.Token.LET:t|=a.CommonFlags.LET;case o.Token.VAR:e.next(),_=this.parseVariable(e,t,i,n),i=null;break;case o.Token.ENUM:e.next(),_=this.parseEnum(e,t,i,n),i=null;break;case o.Token.FUNCTION:e.next(),_=this.parseFunction(e,t,i,n),i=null;break;case o.Token.ABSTRACT:var d=e.mark();if(e.next(),!e.skip(o.Token.CLASS)){e.reset(d),_=this.parseStatement(e,!0);break}e.discard(d),t|=a.CommonFlags.ABSTRACT;case o.Token.CLASS:case o.Token.INTERFACE:e.next(),_=this.parseClassOrInterface(e,t,i,n),i=null;break;case o.Token.NAMESPACE:d=e.mark();e.next(),e.peek(!1,o.IdentifierHandling.PREFER)==o.Token.IDENTIFIER?(e.discard(d),_=this.parseNamespace(e,t,i,n),i=null):(e.reset(d),_=this.parseStatement(e,!0));break;case o.Token.IMPORT:e.next(),_=(t|=a.CommonFlags.IMPORT)&a.CommonFlags.EXPORT?this.parseExportImport(e,n):this.parseImport(e);break;case o.Token.TYPE:d=e.mark();e.next(),e.peek(!1,o.IdentifierHandling.PREFER)==o.Token.IDENTIFIER?(e.discard(d),_=this.parseTypeDeclaration(e,t,i,n),i=null):(e.reset(d),_=this.parseStatement(e,!0));break;default:t&a.CommonFlags.EXPORT?_=this.parseExport(e,n,0!=(t&a.CommonFlags.DECLARE)):(p&&this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(l,p),"export"),r||(_=this.parseStatement(e,!0)))}if(i)for(var y=0,m=i.length;y<m;++y)this.error(c.DiagnosticCode.Decorators_are_not_valid_here,i[y].range);return _},r.prototype.nextFile=function(){var e=this.backlog;return e.length?e.shift():null},r.prototype.finish=function(){if(this.backlog.length)throw new Error("backlog is not empty");return this.backlog=[],this.seenlog.clear(),this.donelog.clear(),this.program},r.prototype.parseType=function(e,r,t){void 0===r&&(r=!0),void 0===t&&(t=!1);var n,i=e.next(),a=e.tokenPos;if(i==o.Token.OPENPAREN){var s=e.skip(o.Token.OPENPAREN),l=this.tryParseSignature(e);if(l){if(s){if(!e.skip(o.Token.CLOSEPAREN))return this.error(c.DiagnosticCode._0_expected,e.range(),")"),null;if(!e.skip(o.Token.BAR))return this.error(c.DiagnosticCode._0_expected,e.range(),"|"),null;e.skip(o.Token.NULL)||this.error(c.DiagnosticCode._0_expected,e.range(),"null"),l.isNullable=!0}return l}if(s||this.tryParseSignatureIsSignature)return this.error(c.DiagnosticCode.Unexpected_token,e.range()),null;if(!r)return this.error(c.DiagnosticCode.Unexpected_token,e.range()),null;var u=this.parseType(e,!1,t);if(!u)return null;if(!e.skip(o.Token.CLOSEPAREN))return t||this.error(c.DiagnosticCode._0_expected,e.range(e.pos),"}"),null;(n=u).range.start=a,n.range.end=e.pos}else if(i==o.Token.VOID)n=p.Node.createType(p.Node.createSimpleTypeName("void",e.range()),[],!1,e.range(a,e.pos));else if(i==o.Token.THIS)n=p.Node.createType(p.Node.createSimpleTypeName("this",e.range()),[],!1,e.range(a,e.pos));else if(i==o.Token.TRUE||i==o.Token.FALSE)n=p.Node.createType(p.Node.createSimpleTypeName("bool",e.range()),[],!1,e.range(a,e.pos));else if(i==o.Token.STRINGLITERAL)e.readString(),n=p.Node.createType(p.Node.createSimpleTypeName("string",e.range()),[],!1,e.range(a,e.pos));else{if(i!=o.Token.IDENTIFIER)return t||this.error(c.DiagnosticCode.Identifier_expected,e.range()),null;for(var _=p.Node.createSimpleTypeName(e.readIdentifier(),e.range()),h=_,d=new Array,y=!1;e.skip(o.Token.DOT);){if(!e.skip(o.Token.IDENTIFIER))return this.error(c.DiagnosticCode.Identifier_expected,e.range(e.pos)),null;var m=p.Node.createSimpleTypeName(e.readIdentifier(),e.range());h.next=m,h=m}if(e.skip(o.Token.LESSTHAN)){do{var T=this.parseType(e,!0,t);if(!T)return null;d.push(T)}while(e.skip(o.Token.COMMA));if(!e.skip(o.Token.GREATERTHAN))return t||this.error(c.DiagnosticCode._0_expected,e.range(e.pos),">"),null}for(;e.skip(o.Token.BAR);){if(!e.skip(o.Token.NULL))return t||this.error(c.DiagnosticCode._0_expected,e.range(e.pos),"null"),null;y=!0}n=p.Node.createType(_,d,y,e.range(a,e.pos))}for(;e.skip(o.Token.OPENBRACKET);){var f=e.tokenPos;if(!e.skip(o.Token.CLOSEBRACKET))return t||this.error(c.DiagnosticCode._0_expected,e.range(),"]"),null;var E=e.range(f,e.pos);y=!1;if(e.skip(o.Token.BAR)){if(!e.skip(o.Token.NULL))return t||this.error(c.DiagnosticCode._0_expected,e.range(),"null"),null;y=!0}if(n=p.Node.createType(p.Node.createSimpleTypeName("Array",E),[n],y,e.range(a,e.pos)),y)break}return n},r.prototype.tryParseSignature=function(e){var r,t=e.mark(),n=e.tokenPos,i=null,a=null,s=!1;if(e.skip(o.Token.CLOSEPAREN))s=!0,e.discard(t),i=[];else{s=!1;do{var l=p.ParameterKind.DEFAULT;if(e.skip(o.Token.DOT_DOT_DOT)&&(s=!0,e.discard(t),l=p.ParameterKind.REST),e.skip(o.Token.THIS)){if(!e.skip(o.Token.COLON))return e.reset(t),this.tryParseSignatureIsSignature=!1,null;s=!0,e.discard(t);var u=this.parseType(e,!1);if(!u)return null;if(u.kind!=p.NodeKind.TYPE)return this.error(c.DiagnosticCode.Operation_not_supported,u.range),this.tryParseSignatureIsSignature=!0,null;a=u}else{if(!e.skipIdentifier())return s?this.error(c.DiagnosticCode.Identifier_expected,e.range()):e.reset(t),this.tryParseSignatureIsSignature=s,null;var _=p.Node.createIdentifierExpression(e.readIdentifier(),e.range(e.tokenPos,e.pos));if(e.skip(o.Token.QUESTION)&&(s=!0,e.discard(t),l==p.ParameterKind.REST?this.error(c.DiagnosticCode.A_rest_parameter_cannot_be_optional,e.range()):l=p.ParameterKind.OPTIONAL),e.skip(o.Token.COLON)){s=!0,e.discard(t);var h=this.parseType(e);if(!h)return this.tryParseSignatureIsSignature=s,null;var d=new p.ParameterNode;d.parameterKind=l,d.name=_,d.type=h,i?i.push(d):i=[d]}else s&&this.error(c.DiagnosticCode.Type_expected,e.range())}}while(e.skip(o.Token.COMMA));if(!e.skip(o.Token.CLOSEPAREN))return s?this.error(c.DiagnosticCode._0_expected,e.range(),")"):e.reset(t),this.tryParseSignatureIsSignature=s,null}return e.skip(o.Token.EQUALS_GREATERTHAN)?(s=!0,e.discard(t),(r=this.parseType(e))?(this.tryParseSignatureIsSignature=!0,p.Node.createSignature(i||[],r,a,!1,e.range(n,e.pos))):(this.tryParseSignatureIsSignature=s,null)):(s?this.error(c.DiagnosticCode._0_expected,e.range(),"=>"):e.reset(t),this.tryParseSignatureIsSignature=s,null)},r.prototype.parseDecorator=function(e){var r=e.tokenPos;if(e.skipIdentifier()){for(var t=e.readIdentifier(),n=p.Node.createIdentifierExpression(t,e.range(r,e.pos));e.skip(o.Token.DOT);){if(!e.skipIdentifier())return this.error(c.DiagnosticCode.Identifier_expected,e.range()),null;t=e.readIdentifier(),n=p.Node.createPropertyAccessExpression(n,p.Node.createIdentifierExpression(t,e.range()),e.range(r,e.pos))}var i=void 0;if(!e.skip(o.Token.OPENPAREN))return p.Node.createDecorator(n,null,e.range(r,e.pos));if(i=this.parseArguments(e))return p.Node.createDecorator(n,i,e.range(r,e.pos))}else this.error(c.DiagnosticCode.Identifier_expected,e.range());return null},r.prototype.parseVariable=function(e,r,t,n){var i=new Array;do{var a=this.parseVariableDeclaration(e,r,t);if(!a)return null;i.push(a)}while(e.skip(o.Token.COMMA));var s=p.Node.createVariableStatement(i,t,e.range(n,e.pos));return e.skip(o.Token.SEMICOLON),s},r.prototype.parseVariableDeclaration=function(e,r,t){if(!e.skipIdentifier())return this.error(c.DiagnosticCode.Identifier_expected,e.range()),null;var n=p.Node.createIdentifierExpression(e.readIdentifier(),e.range()),i=r;e.skip(o.Token.EXCLAMATION)&&(i|=a.CommonFlags.DEFINITE_ASSIGNMENT);var s=null;e.skip(o.Token.COLON)&&(s=this.parseType(e));var l=null;if(e.skip(o.Token.EQUALS)){if(i&a.CommonFlags.AMBIENT&&this.error(c.DiagnosticCode.Initializers_are_not_allowed_in_ambient_contexts,e.range()),!(l=this.parseExpression(e,2)))return null}else i&a.CommonFlags.CONST?i&a.CommonFlags.AMBIENT||this.error(c.DiagnosticCode._const_declarations_must_be_initialized,n.range):s||this.error(c.DiagnosticCode.Type_expected,e.range(e.pos));var u=o.Range.join(n.range,e.range());return i&a.CommonFlags.DEFINITE_ASSIGNMENT&&l&&this.error(c.DiagnosticCode.A_definite_assignment_assertion_is_not_permitted_in_this_context,u),p.Node.createVariableDeclaration(n,s,l,t,i,u)},r.prototype.parseEnum=function(e,r,t,n){if(e.next()!=o.Token.IDENTIFIER)return this.error(c.DiagnosticCode.Identifier_expected,e.range()),null;var i=p.Node.createIdentifierExpression(e.readIdentifier(),e.range());if(e.next()!=o.Token.OPENBRACE)return this.error(c.DiagnosticCode._0_expected,e.range(),"{"),null;for(var s=new Array;!e.skip(o.Token.CLOSEBRACE);){var l=this.parseEnumValue(e,a.CommonFlags.NONE);if(!l)return null;if(s.push(l),!e.skip(o.Token.COMMA)){if(e.skip(o.Token.CLOSEBRACE))break;return this.error(c.DiagnosticCode._0_expected,e.range(),"}"),null}}var u=p.Node.createEnumDeclaration(i,s,t,r,e.range(n,e.pos));return e.skip(o.Token.SEMICOLON),u},r.prototype.parseEnumValue=function(e,r){if(!e.skipIdentifier())return this.error(c.DiagnosticCode.Identifier_expected,e.range()),null;var t=p.Node.createIdentifierExpression(e.readIdentifier(),e.range()),n=null;return e.skip(o.Token.EQUALS)&&!(n=this.parseExpression(e,2))?null:p.Node.createEnumValueDeclaration(t,n,r,o.Range.join(t.range,e.range()))},r.prototype.parseReturn=function(e){var r=null;if(e.peek(!0)!=o.Token.SEMICOLON&&e.nextToken!=o.Token.CLOSEBRACE&&!e.nextTokenOnNewLine&&!(r=this.parseExpression(e)))return null;var t=p.Node.createReturnStatement(r,e.range());return e.skip(o.Token.SEMICOLON),t},r.prototype.parseTypeParameters=function(e){for(var r=new Array,t=!1;!e.skip(o.Token.GREATERTHAN);){var n=this.parseTypeParameter(e);if(!n)return null;if(null!==n.defaultType?t=!0:t&&(this.error(c.DiagnosticCode.Required_type_parameters_may_not_follow_optional_type_parameters,n.range),n.defaultType=null),r.push(n),!e.skip(o.Token.COMMA)){if(e.skip(o.Token.GREATERTHAN))break;return this.error(c.DiagnosticCode._0_expected,e.range(),">"),null}}return 0===r.length&&this.error(c.DiagnosticCode.Type_parameter_list_cannot_be_empty,e.range()),r},r.prototype.parseTypeParameter=function(e){if(e.next()==o.Token.IDENTIFIER){var r=p.Node.createIdentifierExpression(e.readIdentifier(),e.range()),t=null;if(e.skip(o.Token.EXTENDS)){if(!(i=this.parseType(e)))return null;if(i.kind!=p.NodeKind.TYPE)return this.error(c.DiagnosticCode.Operation_not_supported,i.range),null;t=i}var n=null;if(e.skip(o.Token.EQUALS)){var i;if(!(i=this.parseType(e)))return null;if(i.kind!=p.NodeKind.TYPE)return this.error(c.DiagnosticCode.Operation_not_supported,i.range),null;n=i}return p.Node.createTypeParameter(r,t,n,o.Range.join(r.range,e.range()))}return this.error(c.DiagnosticCode.Identifier_expected,e.range()),null},r.prototype.parseParameters=function(e,r){void 0===r&&(r=!1);var t=new Array,n=null,i=!1,a=!1,s=null;if(this.parseParametersThis=null,e.skip(o.Token.THIS)){if(!e.skip(o.Token.COLON))return this.error(c.DiagnosticCode._0_expected,e.range(),":"),null;if(!(s=this.parseType(e)))return null;if(s.kind==p.NodeKind.TYPE?this.parseParametersThis=s:this.error(c.DiagnosticCode.Operation_not_supported,s.range),!e.skip(o.Token.COMMA))return e.skip(o.Token.CLOSEPAREN)?t:(this.error(c.DiagnosticCode._0_expected,e.range(),")"),null)}for(;!e.skip(o.Token.CLOSEPAREN);){var l=this.parseParameter(e,r);if(!l)return null;switch(n&&!a&&(this.error(c.DiagnosticCode.A_rest_parameter_must_be_last_in_a_parameter_list,n.name.range),a=!0),l.parameterKind){default:i&&this.error(c.DiagnosticCode.A_required_parameter_cannot_follow_an_optional_parameter,l.name.range);break;case p.ParameterKind.OPTIONAL:i=!0;break;case p.ParameterKind.REST:n=l}if(t.push(l),!e.skip(o.Token.COMMA)){if(e.skip(o.Token.CLOSEPAREN))break;return this.error(c.DiagnosticCode._0_expected,e.range(),")"),null}}return t},r.prototype.parseParameter=function(e,r){void 0===r&&(r=!1);var t=!1,n=!1,i=null,s=a.CommonFlags.NONE;if(r&&(e.skip(o.Token.PUBLIC)?(i=e.range(),s|=a.CommonFlags.PUBLIC):e.skip(o.Token.PROTECTED)?(i=e.range(),s|=a.CommonFlags.PROTECTED):e.skip(o.Token.PRIVATE)&&(i=e.range(),s|=a.CommonFlags.PRIVATE),e.peek()==o.Token.READONLY)){var l=e.mark();e.next(),e.peek()!=o.Token.COLON?(e.discard(l),i||(i=e.range()),s|=a.CommonFlags.READONLY):e.reset(l)}if(e.skip(o.Token.DOT_DOT_DOT)&&(s?this.error(c.DiagnosticCode.A_parameter_property_cannot_be_declared_using_a_rest_parameter,e.range()):i=e.range(),t=!0),e.skipIdentifier()){t||(i=e.range());var u=p.Node.createIdentifierExpression(e.readIdentifier(),e.range()),_=null;if((n=e.skip(o.Token.QUESTION))&&t&&this.error(c.DiagnosticCode.A_rest_parameter_cannot_be_optional,u.range),e.skip(o.Token.COLON)){if(!(_=this.parseType(e)))return null}else _=p.Node.createOmittedType(e.range(e.pos));var h=null;if(e.skip(o.Token.EQUALS)&&(t&&this.error(c.DiagnosticCode.A_rest_parameter_cannot_have_an_initializer,u.range),n?this.error(c.DiagnosticCode.Parameter_cannot_have_question_mark_and_initializer,u.range):n=!0,!(h=this.parseExpression(e,2))))return null;var d=p.Node.createParameter(u,_,h,t?p.ParameterKind.REST:n?p.ParameterKind.OPTIONAL:p.ParameterKind.DEFAULT,o.Range.join(i,e.range()));return d.flags|=s,d}return this.error(c.DiagnosticCode.Identifier_expected,e.range()),null},r.prototype.parseFunction=function(e,r,t,n){if(!e.skipIdentifier())return this.error(c.DiagnosticCode.Identifier_expected,e.range(e.pos)),null;var i=p.Node.createIdentifierExpression(e.readIdentifier(),e.range()),s=-1,l=null;if(e.skip(o.Token.LESSTHAN)){if(s=e.tokenPos,!(l=this.parseTypeParameters(e)))return null;r|=a.CommonFlags.GENERIC}if(!e.skip(o.Token.OPENPAREN))return this.error(c.DiagnosticCode._0_expected,e.range(e.pos),"("),null;s<0&&(s=e.tokenPos);var u=this.parseParameters(e);if(!u)return null;var _=this.parseParametersThis,h=0!=(r&a.CommonFlags.SET);h&&(1!=u.length&&this.error(c.DiagnosticCode.A_set_accessor_must_have_exactly_one_parameter,i.range),u.length&&u[0].initializer&&this.error(c.DiagnosticCode.A_set_accessor_parameter_cannot_have_an_initializer,i.range)),r&a.CommonFlags.GET&&u.length&&this.error(c.DiagnosticCode.A_get_accessor_cannot_have_parameters,i.range);var d=null;if(e.skip(o.Token.COLON)&&!(d=this.parseType(e,!0,h)))return null;d||(d=p.Node.createOmittedType(e.range(e.pos)),h||this.error(c.DiagnosticCode.Type_expected,d.range));var y=p.Node.createSignature(u,d,_,!1,e.range(s,e.pos)),m=null;if(e.skip(o.Token.OPENBRACE)){if(r&a.CommonFlags.AMBIENT&&this.error(c.DiagnosticCode.An_implementation_cannot_be_declared_in_ambient_contexts,e.range()),!(m=this.parseBlockStatement(e,!1)))return null}else r&a.CommonFlags.AMBIENT||this.error(c.DiagnosticCode.Function_implementation_is_missing_or_not_immediately_following_the_declaration,e.range(e.pos));var T=p.Node.createFunctionDeclaration(i,l,y,m,t,r,0,e.range(n,e.pos));return e.skip(o.Token.SEMICOLON),T},r.prototype.parseFunctionExpression=function(e){var r,t=e.tokenPos,n=0;if(e.token==o.Token.FUNCTION){if(r=e.skipIdentifier()?p.Node.createIdentifierExpression(e.readIdentifier(),e.range()):p.Node.createEmptyIdentifierExpression(e.range(e.pos)),!e.skip(o.Token.OPENPAREN))return this.error(c.DiagnosticCode._0_expected,e.range(e.pos),"("),null}else n=1,assert(e.token==o.Token.OPENPAREN),r=p.Node.createEmptyIdentifierExpression(e.range(e.tokenPos));var i=e.pos,a=this.parseParameters(e);return a?this.parseFunctionExpressionCommon(e,r,a,n,t,i):null},r.prototype.parseFunctionExpressionCommon=function(e,r,t,n,i,s){void 0===i&&(i=-1),void 0===s&&(s=-1),i<0&&(i=r.range.start),s<0&&(s=i);var l=null;if(2!=n&&e.skip(o.Token.COLON)){if(!(l=this.parseType(e)))return null}else l=p.Node.createOmittedType(e.range(e.pos));if(n&&!e.skip(o.Token.EQUALS_GREATERTHAN))return this.error(c.DiagnosticCode._0_expected,e.range(e.pos),"=>"),null;var u,_=p.Node.createSignature(t,l,null,!1,e.range(s,e.pos));if(n)u=this.parseStatement(e,!1);else{if(!e.skip(o.Token.OPENBRACE))return this.error(c.DiagnosticCode._0_expected,e.range(e.pos),"{"),null;u=this.parseBlockStatement(e,!1)}if(!u)return null;var h=p.Node.createFunctionDeclaration(r,null,_,u,null,a.CommonFlags.NONE,n,e.range(i,e.pos));return p.Node.createFunctionExpression(h)},r.prototype.parseClassOrInterface=function(e,r,t,n){var i=e.token==o.Token.INTERFACE;if(!e.skipIdentifier())return this.error(c.DiagnosticCode.Identifier_expected,e.range()),null;var s=p.Node.createIdentifierExpression(e.readIdentifier(),e.range()),l=null;if(e.skip(o.Token.LESSTHAN)){if(!(l=this.parseTypeParameters(e)))return null;r|=a.CommonFlags.GENERIC}var u=null;if(e.skip(o.Token.EXTENDS)){var _=this.parseType(e);if(!_)return null;if(_.kind!=p.NodeKind.TYPE)return this.error(c.DiagnosticCode.Operation_not_supported,_.range),null;u=_}var h=null;if(e.skip(o.Token.IMPLEMENTS)){i&&this.error(c.DiagnosticCode.Interface_declaration_cannot_have_implements_clause,e.range());do{var d=this.parseType(e);if(!d)return null;i||(h||(h=[]),h.push(d))}while(e.skip(o.Token.COMMA))}if(!e.skip(o.Token.OPENBRACE))return this.error(c.DiagnosticCode._0_expected,e.range(),"{"),null;var y,m=new Array;if(i?(assert(!h),y=p.Node.createInterfaceDeclaration(s,l,u,m,t,r,e.range(n,e.pos))):y=p.Node.createClassDeclaration(s,l,u,h,m,t,r,e.range(n,e.pos)),!e.skip(o.Token.CLOSEBRACE))do{var T=this.parseClassMember(e,y);T&&m.push(T)}while(!e.skip(o.Token.CLOSEBRACE));return y},r.prototype.parseClassExpression=function(e){var r,t=e.tokenPos;if(r=e.skipIdentifier()?p.Node.createIdentifierExpression(e.readIdentifier(),e.range()):p.Node.createEmptyIdentifierExpression(e.range(e.pos)),!e.skip(o.Token.OPENBRACE))return this.error(c.DiagnosticCode._0_expected,e.range(e.pos),"{"),null;var n=new Array,i=p.Node.createClassDeclaration(r,[],null,null,n,null,a.CommonFlags.NONE,e.range(t,e.pos));if(!e.skip(o.Token.CLOSEBRACE))do{var s=this.parseClassMember(e,i);s&&n.push(s)}while(!e.skip(o.Token.CLOSEBRACE));return p.Node.createClassExpression(i)},r.prototype.parseClassMember=function(e,r){var t=e.pos,n=r.kind==p.NodeKind.INTERFACEDECLARATION,i=new Array;if(e.skip(o.Token.AT)){do{var s=this.parseDecorator(e);if(!s)break;i.push(s)}while(e.skip(o.Token.AT));n&&this.error(c.DiagnosticCode.Decorators_are_not_valid_here,o.Range.join(i[0].range,i[i.length-1].range))}var l=r.flags&a.CommonFlags.AMBIENT;n&&(l|=a.CommonFlags.VIRTUAL);var u=0,_=0;e.skip(o.Token.PUBLIC)?(n&&this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(),"public"),l|=a.CommonFlags.PUBLIC,u=e.tokenPos,_=e.pos):e.skip(o.Token.PRIVATE)?(n&&this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(),"private"),l|=a.CommonFlags.PRIVATE,u=e.tokenPos,_=e.pos):e.skip(o.Token.PROTECTED)&&(n&&this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(),"protected"),l|=a.CommonFlags.PROTECTED,u=e.tokenPos,_=e.pos);var h=0,d=0,y=0,m=0;e.skip(o.Token.STATIC)?(n&&this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(),"static"),l|=a.CommonFlags.STATIC,h=e.tokenPos,d=e.pos):(l|=a.CommonFlags.INSTANCE,e.skip(o.Token.ABSTRACT)&&(n&&this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(),"abstract"),l|=a.CommonFlags.ABSTRACT,y=e.tokenPos,m=e.pos),r.flags&a.CommonFlags.GENERIC&&(l|=a.CommonFlags.GENERIC_CONTEXT));var T=0,f=0;e.skip(o.Token.READONLY)&&(l|=a.CommonFlags.READONLY,T=e.tokenPos,f=e.pos);var E,g=e.mark(),v=!1,I=!1,b=!1,x=0,S=0;if(n||(e.skip(o.Token.GET)?e.peek(!0,o.IdentifierHandling.PREFER)!=o.Token.IDENTIFIER||e.nextTokenOnNewLine?e.reset(g):(l|=a.CommonFlags.GET,I=!0,x=e.tokenPos,S=e.pos,l&a.CommonFlags.READONLY&&this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(T,f),"readonly")):e.skip(o.Token.SET)?e.peek(!0,o.IdentifierHandling.PREFER)!=o.Token.IDENTIFIER||e.nextTokenOnNewLine?e.reset(g):(l|=a.CommonFlags.SET,b=!0,x=e.tokenPos,S=e.pos,l&a.CommonFlags.READONLY&&this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(T,f),"readonly")):e.skip(o.Token.CONSTRUCTOR)&&(v=!0,(l|=a.CommonFlags.CONSTRUCTOR)&a.CommonFlags.STATIC&&this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(h,d),"static"),l&a.CommonFlags.ABSTRACT&&this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(y,m),"abstract"),l&a.CommonFlags.READONLY&&this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(T,f),"readonly"))),v)E=p.Node.createConstructorExpression(e.range());else{if(!I&&!b&&e.skip(o.Token.OPENBRACKET)){l&a.CommonFlags.PUBLIC?this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(u,_),"public"):l&a.CommonFlags.PROTECTED?this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(u,_),"protected"):l&a.CommonFlags.PRIVATE&&this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(u,_),"protected"),l&a.CommonFlags.STATIC&&this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(h,d),"static"),l&a.CommonFlags.ABSTRACT&&this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(y,m),"abstract"),l&a.CommonFlags.READONLY&&this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(T,f),"readonly");var A=this.parseIndexSignatureDeclaration(e,i);return A?(e.skip(o.Token.SEMICOLON),A):null}if(!e.skipIdentifier())return this.error(c.DiagnosticCode.Identifier_expected,e.range()),null;E=p.Node.createIdentifierExpression(e.readIdentifier(),e.range())}var N=null;if(e.skip(o.Token.LESSTHAN)){var O=e.tokenPos;if(!(N=this.parseTypeParameters(e)))return null;v?this.error(c.DiagnosticCode.Type_parameters_cannot_appear_on_a_constructor_declaration,e.range(O,e.pos)):I||b?this.error(c.DiagnosticCode.An_accessor_cannot_have_type_parameters,e.range(O,e.pos)):l|=a.CommonFlags.GENERIC}if(e.skip(o.Token.OPENPAREN)){var C=e.tokenPos,k=this.parseParameters(e,v);if(!k)return null;var R=this.parseParametersThis;if(v)for(var L=0,F=k.length;L<F;++L){var B=k[L];if(B.isAny(a.CommonFlags.PUBLIC|a.CommonFlags.PROTECTED|a.CommonFlags.PRIVATE|a.CommonFlags.READONLY)){var U=p.Node.createFieldDeclaration(B.name,B.type,null,null,B.flags|a.CommonFlags.INSTANCE,B.range);U.parameterIndex=L,B.implicitFieldDeclaration=U,r.members.push(U)}}else I?k.length&&this.error(c.DiagnosticCode.A_get_accessor_cannot_have_parameters,E.range):b&&(1!=k.length&&this.error(c.DiagnosticCode.A_set_accessor_must_have_exactly_one_parameter,E.range),k.length&&k[0].initializer&&this.error(c.DiagnosticCode.A_set_accessor_parameter_cannot_have_an_initializer,E.range));var D=null;if(e.skip(o.Token.COLON)){if(E.kind==p.NodeKind.CONSTRUCTOR?this.error(c.DiagnosticCode.Type_annotation_cannot_appear_on_a_constructor_declaration,e.range()):b&&this.error(c.DiagnosticCode.A_set_accessor_cannot_have_a_return_type_annotation,e.range()),!(D=this.parseType(e,E.kind==p.NodeKind.CONSTRUCTOR||b)))return null}else D=p.Node.createOmittedType(e.range(e.pos)),b||E.kind==p.NodeKind.CONSTRUCTOR||this.error(c.DiagnosticCode.Type_expected,D.range);var w=p.Node.createSignature(k,D,R,!1,e.range(C,e.pos)),P=null;if(e.skip(o.Token.OPENBRACE)){if(l&a.CommonFlags.AMBIENT?this.error(c.DiagnosticCode.An_implementation_cannot_be_declared_in_ambient_contexts,e.range()):l&a.CommonFlags.ABSTRACT&&this.error(c.DiagnosticCode.Method_0_cannot_have_an_implementation_because_it_is_marked_abstract,e.range(),E.text),!(P=this.parseBlockStatement(e,!1)))return null}else l&a.CommonFlags.AMBIENT||n||this.error(c.DiagnosticCode.Function_implementation_is_missing_or_not_immediately_following_the_declaration,e.range());var M=p.Node.createMethodDeclaration(E,N,w,P,i,l,e.range(t,e.pos));return e.skip(o.Token.SEMICOLON),M}if(v)this.error(c.DiagnosticCode.Constructor_implementation_is_missing,E.range);else{if(!I&&!b){l&a.CommonFlags.ABSTRACT&&this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(y,m),"abstract"),l&a.CommonFlags.GET&&this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(0,0),"get"),l&a.CommonFlags.SET&&this.error(c.DiagnosticCode._0_modifier_cannot_be_used_here,e.range(x,S),"set");var V=null;if(e.skip(o.Token.QUESTION)&&this.error(c.DiagnosticCode.Optional_properties_are_not_supported,e.range(t,e.pos)),e.skip(o.Token.EXCLAMATION)&&(l|=a.CommonFlags.DEFINITE_ASSIGNMENT),e.skip(o.Token.COLON)){if(!(V=this.parseType(e)))return null}else this.error(c.DiagnosticCode.Type_expected,e.range());var G=null;if(e.skip(o.Token.EQUALS)&&!(G=this.parseExpression(e)))return null;var K=e.range(t,e.pos);l&a.CommonFlags.DEFINITE_ASSIGNMENT&&(l&a.CommonFlags.STATIC||n||G)&&this.error(c.DiagnosticCode.A_definite_assignment_assertion_is_not_permitted_in_this_context,K);var z=p.Node.createFieldDeclaration(E,V,G,i,l,K);return e.skip(o.Token.SEMICOLON),z}this.error(c.DiagnosticCode.Function_implementation_is_missing_or_not_immediately_following_the_declaration,E.range)}return null},r.prototype.parseIndexSignatureDeclaration=function(e,r){r.length&&this.error(c.DiagnosticCode.Decorators_are_not_valid_here,o.Range.join(r[0].range,r[r.length-1].range));var t=e.tokenPos;if(e.skipIdentifier())if("key"==e.readIdentifier())if(e.skip(o.Token.COLON)){var n=this.parseType(e);if(!n)return null;if(n.kind!=p.NodeKind.TYPE)return this.error(c.DiagnosticCode.Type_expected,e.range()),null;if(e.skip(o.Token.CLOSEBRACKET)){if(e.skip(o.Token.COLON)){var i=this.parseType(e);return i?p.Node.createIndexSignatureDeclaration(n,i,e.range(t,e.pos)):null}this.error(c.DiagnosticCode._0_expected,e.range(),":")}else this.error(c.DiagnosticCode._0_expected,e.range(),"]")}else this.error(c.DiagnosticCode._0_expected,e.range(),":");else this.error(c.DiagnosticCode._0_expected,e.range(),"key");else this.error(c.DiagnosticCode.Identifier_expected,e.range());return null},r.prototype.parseNamespace=function(e,r,t,n){if(e.skipIdentifier()){var i=p.Node.createIdentifierExpression(e.readIdentifier(),e.range());if(e.skip(o.Token.OPENBRACE)){for(var a=new Array,s=p.Node.createNamespaceDeclaration(i,a,t,r,e.range(n,e.pos));!e.skip(o.Token.CLOSEBRACE);){var l=this.parseTopLevelStatement(e,s);l&&a.push(l)}return e.skip(o.Token.SEMICOLON),s}this.error(c.DiagnosticCode._0_expected,e.range(),"{")}else this.error(c.DiagnosticCode.Identifier_expected,e.range());return null},r.prototype.parseExport=function(e,r,t){var n=null;if(e.skip(o.Token.OPENBRACE)){for(var i=new Array;!e.skip(o.Token.CLOSEBRACE);){var a=this.parseExportMember(e);if(!a)return null;if(i.push(a),!e.skip(o.Token.COMMA)){if(e.skip(o.Token.CLOSEBRACE))break;return this.error(c.DiagnosticCode._0_expected,e.range(),"}"),null}}if(e.skip(o.Token.FROM)){if(!e.skip(o.Token.STRINGLITERAL))return this.error(c.DiagnosticCode.String_literal_expected,e.range()),null;n=p.Node.createStringLiteralExpression(e.readString(),e.range())}return null===(l=(s=p.Node.createExportStatement(i,n,t,e.range(r,e.pos))).internalPath)||this.seenlog.has(l)||(this.backlog.push(l),this.seenlog.add(l)),e.skip(o.Token.SEMICOLON),s}if(e.skip(o.Token.ASTERISK))if(e.skip(o.Token.FROM)){if(e.skip(o.Token.STRINGLITERAL)){n=p.Node.createStringLiteralExpression(e.readString(),e.range());var s=p.Node.createExportStatement(null,n,t,e.range(r,e.pos)),l=assert(s.internalPath),u=e.source;return u.exportPaths||(u.exportPaths=new Set),u.exportPaths.add(l),this.seenlog.has(l)||(this.backlog.push(l),this.seenlog.add(l)),e.skip(o.Token.SEMICOLON),s}this.error(c.DiagnosticCode.String_literal_expected,e.range())}else this.error(c.DiagnosticCode._0_expected,e.range(),"from");else this.error(c.DiagnosticCode._0_expected,e.range(),"{");return null},r.prototype.parseExportMember=function(e){if(e.skipIdentifier()){var r=p.Node.createIdentifierExpression(e.readIdentifier(),e.range()),t=null;if(e.skip(o.Token.AS)){if(!e.skipIdentifier(o.IdentifierHandling.ALWAYS))return this.error(c.DiagnosticCode.Identifier_expected,e.range()),null;t=p.Node.createIdentifierExpression(e.readIdentifier(),e.range())}return p.Node.createExportMember(r,t,t?o.Range.join(r.range,t.range):r.range)}return this.error(c.DiagnosticCode.Identifier_expected,e.range()),null},r.prototype.parseImport=function(e){var r=e.tokenPos,t=null,n=null,i=!1;if(e.skip(o.Token.OPENBRACE))for(t=new Array;!e.skip(o.Token.CLOSEBRACE);){var a=this.parseImportDeclaration(e);if(!a)return null;if(t.push(a),!e.skip(o.Token.COMMA)){if(e.skip(o.Token.CLOSEBRACE))break;return this.error(c.DiagnosticCode._0_expected,e.range(),"}"),null}}else if(e.skip(o.Token.ASTERISK)){if(!e.skip(o.Token.AS))return this.error(c.DiagnosticCode._0_expected,e.range(),"as"),null;if(!e.skipIdentifier())return this.error(c.DiagnosticCode.Identifier_expected,e.range()),null;n=p.Node.createIdentifierExpression(e.readIdentifier(),e.range())}else i=!0;if(i||e.skip(o.Token.FROM)){if(e.skip(o.Token.STRINGLITERAL)){var s=p.Node.createStringLiteralExpression(e.readString(),e.range()),l=void 0;n?(assert(!t),l=p.Node.createImportStatementWithWildcard(n,s,e.range(r,e.pos))):l=p.Node.createImportStatement(t,s,e.range(r,e.pos));var u=l.internalPath;return this.seenlog.has(u)||(this.backlog.push(u),this.seenlog.add(u)),e.skip(o.Token.SEMICOLON),l}this.error(c.DiagnosticCode.String_literal_expected,e.range())}else this.error(c.DiagnosticCode._0_expected,e.range(),"from");return null},r.prototype.parseImportDeclaration=function(e){if(e.skipIdentifier(o.IdentifierHandling.ALWAYS)){var r=p.Node.createIdentifierExpression(e.readIdentifier(),e.range()),t=null;if(e.skip(o.Token.AS)){if(!e.skipIdentifier())return this.error(c.DiagnosticCode.Identifier_expected,e.range()),null;t=p.Node.createIdentifierExpression(e.readIdentifier(),e.range())}return p.Node.createImportDeclaration(r,t,t?o.Range.join(r.range,t.range):r.range)}return this.error(c.DiagnosticCode.Identifier_expected,e.range()),null},r.prototype.parseExportImport=function(e,r){if(e.skipIdentifier()){var t=p.Node.createIdentifierExpression(e.readIdentifier(),e.range());if(e.skip(o.Token.EQUALS)){if(e.skipIdentifier()){var n=p.Node.createIdentifierExpression(e.readIdentifier(),e.range()),i=p.Node.createExportImportStatement(n,t,e.range(r,e.pos));return e.skip(o.Token.SEMICOLON),i}this.error(c.DiagnosticCode.Identifier_expected,e.range())}else this.error(c.DiagnosticCode._0_expected,e.range(),"=")}else this.error(c.DiagnosticCode.Identifier_expected,e.range());return null},r.prototype.parseStatement=function(e,r){void 0===r&&(r=!1);var t=e.mark(),n=null;switch(e.next()){case o.Token.BREAK:n=this.parseBreak(e);break;case o.Token.CONST:n=this.parseVariable(e,a.CommonFlags.CONST,null,e.tokenPos);break;case o.Token.CONTINUE:n=this.parseContinue(e);break;case o.Token.DO:n=this.parseDoStatement(e);break;case o.Token.FOR:n=this.parseForStatement(e);break;case o.Token.IF:n=this.parseIfStatement(e);break;case o.Token.LET:n=this.parseVariable(e,a.CommonFlags.LET,null,e.tokenPos);break;case o.Token.VAR:n=this.parseVariable(e,a.CommonFlags.NONE,null,e.tokenPos);break;case o.Token.OPENBRACE:n=this.parseBlockStatement(e,r);break;case o.Token.RETURN:r&&this.error(c.DiagnosticCode.A_return_statement_can_only_be_used_within_a_function_body,e.range()),n=this.parseReturn(e);break;case o.Token.SEMICOLON:return p.Node.createEmptyStatement(e.range(e.tokenPos));case o.Token.SWITCH:n=this.parseSwitchStatement(e);break;case o.Token.THROW:n=this.parseThrowStatement(e);break;case o.Token.TRY:n=this.parseTryStatement(e);break;case o.Token.VOID:n=this.parseVoidStatement(e);break;case o.Token.WHILE:n=this.parseWhileStatement(e);break;case o.Token.TYPE:if(e.peek(!1,o.IdentifierHandling.PREFER)==o.Token.IDENTIFIER){n=this.parseTypeDeclaration(e,a.CommonFlags.NONE,null,e.tokenPos);break}default:e.reset(t),n=this.parseExpressionStatement(e)}return n?e.discard(t):(e.reset(t),this.skipStatement(e)),n},r.prototype.parseBlockStatement=function(e,r){for(var t=e.tokenPos,n=new Array;!e.skip(o.Token.CLOSEBRACE);){var i=e.mark(),a=this.parseStatement(e,r);if(a)e.discard(i),n.push(a);else{if(e.token==o.Token.ENDOFFILE)return null;e.reset(i),this.skipStatement(e)}}var s=p.Node.createBlockStatement(n,e.range(t,e.pos));return e.skip(o.Token.SEMICOLON),s},r.prototype.parseBreak=function(e){var r=null;e.peek(!0)!=o.Token.IDENTIFIER||e.nextTokenOnNewLine||(e.next(o.IdentifierHandling.PREFER),r=p.Node.createIdentifierExpression(e.readIdentifier(),e.range()));var t=p.Node.createBreakStatement(r,e.range());return e.skip(o.Token.SEMICOLON),t},r.prototype.parseContinue=function(e){var r=null;e.peek(!0)!=o.Token.IDENTIFIER||e.nextTokenOnNewLine||(e.next(o.IdentifierHandling.PREFER),r=p.Node.createIdentifierExpression(e.readIdentifier(),e.range()));var t=p.Node.createContinueStatement(r,e.range());return e.skip(o.Token.SEMICOLON),t},r.prototype.parseDoStatement=function(e){var r=e.tokenPos,t=this.parseStatement(e);if(!t)return null;if(e.skip(o.Token.WHILE))if(e.skip(o.Token.OPENPAREN)){var n=this.parseExpression(e);if(!n)return null;if(e.skip(o.Token.CLOSEPAREN)){var i=p.Node.createDoStatement(t,n,e.range(r,e.pos));return e.skip(o.Token.SEMICOLON),i}this.error(c.DiagnosticCode._0_expected,e.range(),")")}else this.error(c.DiagnosticCode._0_expected,e.range(),"(");else this.error(c.DiagnosticCode._0_expected,e.range(),"while");return null},r.prototype.parseExpressionStatement=function(e){var r=this.parseExpression(e);if(!r)return null;var t=p.Node.createExpressionStatement(r);return e.skip(o.Token.SEMICOLON),t},r.prototype.parseForStatement=function(e){var r=e.tokenPos;if(e.skip(o.Token.OPENPAREN)){var t=null;if(e.skip(o.Token.CONST))t=this.parseVariable(e,a.CommonFlags.CONST,null,e.tokenPos);else if(e.skip(o.Token.LET))t=this.parseVariable(e,a.CommonFlags.LET,null,e.tokenPos);else if(e.skip(o.Token.VAR))t=this.parseVariable(e,a.CommonFlags.NONE,null,e.tokenPos);else if(!e.skip(o.Token.SEMICOLON)&&!(t=this.parseExpressionStatement(e)))return null;if(e.token==o.Token.SEMICOLON){var n=null;if(!e.skip(o.Token.SEMICOLON)&&!(n=this.parseExpressionStatement(e)))return null;if(e.token==o.Token.SEMICOLON){var i=null;if(!e.skip(o.Token.CLOSEPAREN)){if(!(i=this.parseExpression(e)))return null;if(!e.skip(o.Token.CLOSEPAREN))return this.error(c.DiagnosticCode._0_expected,e.range(),")"),null}var s=this.parseStatement(e);return s?p.Node.createForStatement(t,n?n.expression:null,i,s,e.range(r,e.pos)):null}this.error(c.DiagnosticCode._0_expected,e.range(),";")}else this.error(c.DiagnosticCode._0_expected,e.range(),";")}else this.error(c.DiagnosticCode._0_expected,e.range(),"(");return null},r.prototype.parseIfStatement=function(e){var r=e.tokenPos;if(e.skip(o.Token.OPENPAREN)){var t=this.parseExpression(e);if(!t)return null;if(e.skip(o.Token.CLOSEPAREN)){var n=this.parseStatement(e);if(!n)return null;var i=null;return e.skip(o.Token.ELSE)&&!(i=this.parseStatement(e))?null:p.Node.createIfStatement(t,n,i,e.range(r,e.pos))}this.error(c.DiagnosticCode._0_expected,e.range(),")")}else this.error(c.DiagnosticCode._0_expected,e.range(),"(");return null},r.prototype.parseSwitchStatement=function(e){var r=e.tokenPos;if(e.skip(o.Token.OPENPAREN)){var t=this.parseExpression(e);if(!t)return null;if(e.skip(o.Token.CLOSEPAREN)){if(e.skip(o.Token.OPENBRACE)){for(var n=new Array;!e.skip(o.Token.CLOSEBRACE);){var i=this.parseSwitchCase(e);if(!i)return null;n.push(i)}var a=p.Node.createSwitchStatement(t,n,e.range(r,e.pos));return e.skip(o.Token.SEMICOLON),a}this.error(c.DiagnosticCode._0_expected,e.range(),"{")}else this.error(c.DiagnosticCode._0_expected,e.range(),")")}else this.error(c.DiagnosticCode._0_expected,e.range(),"(");return null},r.prototype.parseSwitchCase=function(e){var r,t,n=e.tokenPos;if(e.skip(o.Token.CASE)){var i=this.parseExpression(e);if(!i)return null;if(e.skip(o.Token.COLON)){for(r=new Array;e.peek()!=o.Token.CASE&&e.nextToken!=o.Token.DEFAULT&&e.nextToken!=o.Token.CLOSEBRACE;){if(!(t=this.parseStatement(e)))return null;r.push(t)}return p.Node.createSwitchCase(i,r,e.range(n,e.pos))}this.error(c.DiagnosticCode._0_expected,e.range(),":")}else if(e.skip(o.Token.DEFAULT)){if(e.skip(o.Token.COLON)){for(r=new Array;e.peek()!=o.Token.CASE&&e.nextToken!=o.Token.DEFAULT&&e.nextToken!=o.Token.CLOSEBRACE;){if(!(t=this.parseStatement(e)))return null;r.push(t)}return p.Node.createSwitchCase(null,r,e.range(n,e.pos))}this.error(c.DiagnosticCode._0_expected,e.range(),":")}else this.error(c.DiagnosticCode._case_or_default_expected,e.range());return null},r.prototype.parseThrowStatement=function(e){var r=e.tokenPos,t=this.parseExpression(e);if(!t)return null;var n=p.Node.createThrowStatement(t,e.range(r,e.pos));return e.skip(o.Token.SEMICOLON),n},r.prototype.parseTryStatement=function(e){var r,t=e.tokenPos;if(e.skip(o.Token.OPENBRACE)){for(var n=new Array;!e.skip(o.Token.CLOSEBRACE);){if(!(r=this.parseStatement(e)))return null;n.push(r)}var i=null,a=null,s=null;if(e.skip(o.Token.CATCH)){if(!e.skip(o.Token.OPENPAREN))return this.error(c.DiagnosticCode._0_expected,e.range(),"("),null;if(!e.skipIdentifier())return this.error(c.DiagnosticCode.Identifier_expected,e.range()),null;if(i=p.Node.createIdentifierExpression(e.readIdentifier(),e.range()),!e.skip(o.Token.CLOSEPAREN))return this.error(c.DiagnosticCode._0_expected,e.range(),")"),null;if(!e.skip(o.Token.OPENBRACE))return this.error(c.DiagnosticCode._0_expected,e.range(),"{"),null;for(a=[];!e.skip(o.Token.CLOSEBRACE);){if(!(r=this.parseStatement(e)))return null;a.push(r)}}if(e.skip(o.Token.FINALLY)){if(!e.skip(o.Token.OPENBRACE))return this.error(c.DiagnosticCode._0_expected,e.range(),"{"),null;for(s=[];!e.skip(o.Token.CLOSEBRACE);){if(!(r=this.parseStatement(e)))return null;s.push(r)}}if(!a&&!s)return this.error(c.DiagnosticCode._0_expected,e.range(),"catch"),null;var l=p.Node.createTryStatement(n,i,a,s,e.range(t,e.pos));return e.skip(o.Token.SEMICOLON),l}return this.error(c.DiagnosticCode._0_expected,e.range(),"{"),null},r.prototype.parseTypeDeclaration=function(e,r,t,n){if(e.skipIdentifier()){var i=p.Node.createIdentifierExpression(e.readIdentifier(),e.range()),s=null;if(e.skip(o.Token.LESSTHAN)){if(!(s=this.parseTypeParameters(e)))return null;r|=a.CommonFlags.GENERIC}if(e.skip(o.Token.EQUALS)){var l=this.parseType(e);if(!l)return null;var u=p.Node.createTypeDeclaration(i,s,l,t,r,e.range(n,e.pos));return e.skip(o.Token.SEMICOLON),u}this.error(c.DiagnosticCode._0_expected,e.range(),"=")}else this.error(c.DiagnosticCode.Identifier_expected,e.range());return null},r.prototype.parseVoidStatement=function(e){var r=e.tokenPos,t=this.parseExpression(e,21);if(!t)return null;var n=p.Node.createVoidStatement(t,e.range(r,e.pos));return e.skip(o.Token.SEMICOLON),n},r.prototype.parseWhileStatement=function(e){var r=e.tokenPos;if(e.skip(o.Token.OPENPAREN)){var t=this.parseExpression(e);if(!t)return null;if(e.skip(o.Token.CLOSEPAREN)){var n=this.parseStatement(e);if(!n)return null;var i=p.Node.createWhileStatement(t,n,e.range(r,e.pos));return e.skip(o.Token.SEMICOLON),i}this.error(c.DiagnosticCode._0_expected,e.range(),")")}else this.error(c.DiagnosticCode._0_expected,e.range(),"(");return null},r.prototype.parseExpressionStart=function(e){var r=e.next(o.IdentifierHandling.PREFER),t=e.tokenPos,n=function(e){switch(e){case o.Token.DOT_DOT_DOT:return 2;case o.Token.YIELD:return 3;case o.Token.EXCLAMATION:case o.Token.TILDE:case o.Token.PLUS:case o.Token.MINUS:case o.Token.PLUS_PLUS:case o.Token.MINUS_MINUS:case o.Token.TYPEOF:case o.Token.VOID:case o.Token.DELETE:return 17;case o.Token.NEW:return 20}return 0}(r);if(0!=n){var i=void 0;return r==o.Token.NEW?(i=this.parseExpression(e,19))?i.kind==p.NodeKind.CALL?p.Node.createNewExpression(i.expression,i.typeArguments,i.arguments,e.range(t,e.pos)):(this.error(c.DiagnosticCode.Operation_not_supported,e.range()),null):null:(i=this.parseExpression(e,n))?(r!=o.Token.PLUS_PLUS&&r!=o.Token.MINUS_MINUS||i.kind!=p.NodeKind.IDENTIFIER&&i.kind!=p.NodeKind.ELEMENTACCESS&&i.kind!=p.NodeKind.PROPERTYACCESS&&this.error(c.DiagnosticCode.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access,i.range),p.Node.createUnaryPrefixExpression(r,i,e.range(t,e.pos))):null}var a=null;switch(r){case o.Token.NULL:return p.Node.createNullExpression(e.range());case o.Token.TRUE:return p.Node.createTrueExpression(e.range());case o.Token.FALSE:return p.Node.createFalseExpression(e.range());case o.Token.OPENPAREN:if(e.skip(o.Token.CLOSEPAREN))return this.parseFunctionExpressionCommon(e,p.Node.createEmptyIdentifierExpression(e.range(t)),[],1);var s=e.mark(),l=!0;do{switch(e.next(o.IdentifierHandling.PREFER)){case o.Token.DOT_DOT_DOT:return e.reset(s),this.parseFunctionExpression(e);case o.Token.IDENTIFIER:switch(e.readIdentifier(),e.next()){case o.Token.CLOSEPAREN:if(!e.skip(o.Token.COLON)&&!e.skip(o.Token.EQUALS_GREATERTHAN)){l=!1;break}case o.Token.COLON:return e.reset(s),this.parseFunctionExpression(e);case o.Token.QUESTION:if(e.skip(o.Token.COLON)||e.skip(o.Token.COMMA)||e.skip(o.Token.CLOSEPAREN))return e.reset(s),this.parseFunctionExpression(e);l=!1;break;case o.Token.COMMA:break;default:l=!1}break;default:l=!1}}while(l);return e.reset(s),(a=this.parseExpression(e))?e.skip(o.Token.CLOSEPAREN)?p.Node.createParenthesizedExpression(a,e.range(t,e.pos)):(this.error(c.DiagnosticCode._0_expected,e.range(),")"),null):null;case o.Token.OPENBRACKET:for(var u=new Array;!e.skip(o.Token.CLOSEBRACKET);){if(e.peek()==o.Token.COMMA)a=null;else if(!(a=this.parseExpression(e,2)))return null;if(u.push(a),!e.skip(o.Token.COMMA)){if(e.skip(o.Token.CLOSEBRACKET))break;return this.error(c.DiagnosticCode._0_expected,e.range(),"]"),null}}return p.Node.createArrayLiteralExpression(u,e.range(t,e.pos));case o.Token.OPENBRACE:for(var _=e.tokenPos,h=new Array,d=new Array,y=void 0;!e.skip(o.Token.CLOSEBRACE);){if(e.skipIdentifier())y=p.Node.createIdentifierExpression(e.readIdentifier(),e.range());else{if(!e.skip(o.Token.STRINGLITERAL))return this.error(c.DiagnosticCode.Identifier_expected,e.range()),null;(y=p.Node.createIdentifierExpression(e.readString(),e.range())).isQuoted=!0}if(h.push(y),e.skip(o.Token.COLON)){var m=this.parseExpression(e,2);if(!m)return null;d.push(m)}else{if(y.isQuoted)return this.error(c.DiagnosticCode._0_expected,e.range(),":"),null;d.push(y)}if(!e.skip(o.Token.COMMA)){if(e.skip(o.Token.CLOSEBRACE))break;return this.error(c.DiagnosticCode._0_expected,e.range(),"}"),null}}return p.Node.createObjectLiteralExpression(h,d,e.range(_,e.pos));case o.Token.LESSTHAN:var T=this.parseType(e);return T?e.skip(o.Token.GREATERTHAN)?(a=this.parseExpression(e,19))?p.Node.createAssertionExpression(p.AssertionKind.PREFIX,a,T,e.range(t,e.pos)):null:(this.error(c.DiagnosticCode._0_expected,e.range(),">"),null):null;case o.Token.IDENTIFIER:var f=p.Node.createIdentifierExpression(e.readIdentifier(),e.range(t,e.pos));return e.peek(!0)!=o.Token.EQUALS_GREATERTHAN||e.nextTokenOnNewLine?f:this.parseFunctionExpressionCommon(e,p.Node.createEmptyIdentifierExpression(e.range(t)),[p.Node.createParameter(f,p.Node.createOmittedType(f.range.atEnd),null,p.ParameterKind.DEFAULT,f.range)],2,t);case o.Token.THIS:return p.Node.createThisExpression(e.range(t,e.pos));case o.Token.CONSTRUCTOR:return p.Node.createConstructorExpression(e.range(t,e.pos));case o.Token.SUPER:return e.peek()!=o.Token.DOT&&e.nextToken!=o.Token.OPENPAREN&&this.error(c.DiagnosticCode._super_must_be_followed_by_an_argument_list_or_member_access,e.range()),p.Node.createSuperExpression(e.range(t,e.pos));case o.Token.STRINGLITERAL:return p.Node.createStringLiteralExpression(e.readString(),e.range(t,e.pos));case o.Token.INTEGERLITERAL:return p.Node.createIntegerLiteralExpression(e.readInteger(),e.range(t,e.pos));case o.Token.FLOATLITERAL:return p.Node.createFloatLiteralExpression(e.readFloat(),e.range(t,e.pos));case o.Token.SLASH:var E=e.readRegexpPattern();return e.skip(o.Token.SLASH)?p.Node.createRegexpLiteralExpression(E,e.readRegexpFlags(),e.range(t,e.pos)):(this.error(c.DiagnosticCode._0_expected,e.range(),"/"),null);case o.Token.FUNCTION:return this.parseFunctionExpression(e);case o.Token.CLASS:return this.parseClassExpression(e);default:return r==o.Token.ENDOFFILE?this.error(c.DiagnosticCode.Unexpected_end_of_text,e.range(t)):this.error(c.DiagnosticCode.Expression_expected,e.range()),null}},r.prototype.tryParseTypeArgumentsBeforeArguments=function(e){var r=e.mark();if(!e.skip(o.Token.LESSTHAN))return null;var t=new Array;do{if(e.peek()===o.Token.GREATERTHAN)break;var n=this.parseType(e,!0,!0);if(!n)return e.reset(r),null;t.push(n)}while(e.skip(o.Token.COMMA));return e.skip(o.Token.GREATERTHAN)&&e.skip(o.Token.OPENPAREN)?t:(e.reset(r),null)},r.prototype.parseArguments=function(e){for(var r=new Array;!e.skip(o.Token.CLOSEPAREN);){var t=this.parseExpression(e,2);if(!t)return null;if(r.push(t),!e.skip(o.Token.COMMA)){if(e.skip(o.Token.CLOSEPAREN))break;return this.error(c.DiagnosticCode._0_expected,e.range(),")"),null}}return r},r.prototype.parseExpression=function(e,r){void 0===r&&(r=1),assert(0!=r);var t=this.parseExpressionStart(e);if(!t)return null;for(var n,i,a=(t=this.maybeParseCallExpression(e,t)).range.start,s=null;(i=_(n=e.peek()))>=r;){switch(e.next(),n){case o.Token.AS:var l=this.parseType(e);if(!l)return null;t=p.Node.createAssertionExpression(p.AssertionKind.AS,t,l,e.range(a,e.pos));break;case o.Token.EXCLAMATION:t=p.Node.createAssertionExpression(p.AssertionKind.NONNULL,t,null,e.range(a,e.pos));break;case o.Token.INSTANCEOF:var u=this.parseType(e);if(!u)return null;t=p.Node.createInstanceOfExpression(t,u,e.range(a,e.pos));break;case o.Token.OPENBRACKET:if(!(s=this.parseExpression(e)))return null;if(!e.skip(o.Token.CLOSEBRACKET))return this.error(c.DiagnosticCode._0_expected,e.range(),"]"),null;t=p.Node.createElementAccessExpression(t,s,e.range(a,e.pos));break;case o.Token.PLUS_PLUS:case o.Token.MINUS_MINUS:t.kind!=p.NodeKind.IDENTIFIER&&t.kind!=p.NodeKind.ELEMENTACCESS&&t.kind!=p.NodeKind.PROPERTYACCESS&&this.error(c.DiagnosticCode.The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access,t.range),t=p.Node.createUnaryPostfixExpression(n,t,e.range(a,e.pos));break;case o.Token.QUESTION:var d=this.parseExpression(e);if(!d)return null;if(!e.skip(o.Token.COLON))return this.error(c.DiagnosticCode._0_expected,e.range(),":"),null;var y=this.parseExpression(e,r>1?2:1);if(!y)return null;t=p.Node.createTernaryExpression(t,d,y,e.range(a,e.pos));break;case o.Token.COMMA:var m=[t];do{if(!(t=this.parseExpression(e,2)))return null;m.push(t)}while(e.skip(o.Token.COMMA));t=p.Node.createCommaExpression(m,e.range(a,e.pos));break;default:if(n==o.Token.DOT){if(e.skipIdentifier())s=p.Node.createIdentifierExpression(e.readIdentifier(),e.range());else if(!(s=this.parseExpression(e,h(n)?i:i+1)))return null;if(s.kind==p.NodeKind.IDENTIFIER)t=p.Node.createPropertyAccessExpression(t,s,e.range(a,e.pos));else{if(s.kind!=p.NodeKind.CALL)return this.error(c.DiagnosticCode.Identifier_expected,s.range),null;if(!(t=this.joinPropertyCall(e,a,t,s)))return null}}else{if(!(s=this.parseExpression(e,h(n)?i:i+1)))return null;t=p.Node.createBinaryExpression(n,t,s,e.range(a,e.pos))}}t=this.maybeParseCallExpression(e,t)}return t},r.prototype.joinPropertyCall=function(e,r,t,n){var i=n.expression;switch(i.kind){case p.NodeKind.IDENTIFIER:n.expression=p.Node.createPropertyAccessExpression(t,i,e.range(r,e.pos));break;case p.NodeKind.CALL:var a=this.joinPropertyCall(e,r,t,i);if(!a)return null;n.expression=a,n.range=e.range(r,e.pos);break;default:return this.error(c.DiagnosticCode.Identifier_expected,n.range),null}return n},r.prototype.maybeParseCallExpression=function(e,r){if(p.nodeIsCallable(r.kind))for(var t=null;e.skip(o.Token.OPENPAREN)||p.nodeIsGenericCallable(r.kind)&&null!==(t=this.tryParseTypeArgumentsBeforeArguments(e));){var n=this.parseArguments(e);if(!n)break;r=p.Node.createCallExpression(r,t,n,e.range(r.range.start,e.pos))}return r},r.prototype.skipStatement=function(e){for(e.peek(!0),e.nextTokenOnNewLine&&e.next();;){var r=e.peek(!0);if(r==o.Token.ENDOFFILE||r==o.Token.SEMICOLON){e.next();break}if(e.nextTokenOnNewLine)break;switch(e.next()){case o.Token.IDENTIFIER:e.readIdentifier();break;case o.Token.STRINGLITERAL:e.readString();break;case o.Token.INTEGERLITERAL:e.readInteger();break;case o.Token.FLOATLITERAL:e.readFloat()}}},r.prototype.skipBlock=function(e){var r=1,t=!0;do{switch(e.next()){case o.Token.ENDOFFILE:this.error(c.DiagnosticCode._0_expected,e.range(),"}"),t=!1;break;case o.Token.OPENBRACE:++r;break;case o.Token.CLOSEBRACE:--r||(t=!1);break;case o.Token.IDENTIFIER:e.readIdentifier();break;case o.Token.STRINGLITERAL:e.readString();break;case o.Token.INTEGERLITERAL:e.readInteger();break;case o.Token.FLOATLITERAL:e.readFloat()}}while(t)},r}(c.DiagnosticEmitter);function _(e){switch(e){case o.Token.COMMA:return 1;case o.Token.EQUALS:case o.Token.PLUS_EQUALS:case o.Token.MINUS_EQUALS:case o.Token.ASTERISK_ASTERISK_EQUALS:case o.Token.ASTERISK_EQUALS:case o.Token.SLASH_EQUALS:case o.Token.PERCENT_EQUALS:case o.Token.LESSTHAN_LESSTHAN_EQUALS:case o.Token.GREATERTHAN_GREATERTHAN_EQUALS:case o.Token.GREATERTHAN_GREATERTHAN_GREATERTHAN_EQUALS:case o.Token.AMPERSAND_EQUALS:case o.Token.CARET_EQUALS:case o.Token.BAR_EQUALS:return 4;case o.Token.QUESTION:return 5;case o.Token.BAR_BAR:return 6;case o.Token.AMPERSAND_AMPERSAND:return 7;case o.Token.BAR:return 8;case o.Token.CARET:return 9;case o.Token.AMPERSAND:return 10;case o.Token.EQUALS_EQUALS:case o.Token.EXCLAMATION_EQUALS:case o.Token.EQUALS_EQUALS_EQUALS:case o.Token.EXCLAMATION_EQUALS_EQUALS:return 11;case o.Token.AS:case o.Token.IN:case o.Token.INSTANCEOF:case o.Token.LESSTHAN:case o.Token.GREATERTHAN:case o.Token.LESSTHAN_EQUALS:case o.Token.GREATERTHAN_EQUALS:return 12;case o.Token.LESSTHAN_LESSTHAN:case o.Token.GREATERTHAN_GREATERTHAN:case o.Token.GREATERTHAN_GREATERTHAN_GREATERTHAN:return 13;case o.Token.PLUS:case o.Token.MINUS:return 14;case o.Token.ASTERISK:case o.Token.SLASH:case o.Token.PERCENT:return 15;case o.Token.ASTERISK_ASTERISK:return 16;case o.Token.PLUS_PLUS:case o.Token.MINUS_MINUS:return 18;case o.Token.DOT:case o.Token.NEW:case o.Token.OPENBRACKET:case o.Token.EXCLAMATION:return 20}return 0}function h(e){switch(e){case o.Token.EQUALS:case o.Token.PLUS_EQUALS:case o.Token.MINUS_EQUALS:case o.Token.ASTERISK_ASTERISK_EQUALS:case o.Token.ASTERISK_EQUALS:case o.Token.SLASH_EQUALS:case o.Token.PERCENT_EQUALS:case o.Token.LESSTHAN_LESSTHAN_EQUALS:case o.Token.GREATERTHAN_GREATERTHAN_EQUALS:case o.Token.GREATERTHAN_GREATERTHAN_GREATERTHAN_EQUALS:case o.Token.AMPERSAND_EQUALS:case o.Token.CARET_EQUALS:case o.Token.BAR_EQUALS:case o.Token.QUESTION:case o.Token.ASTERISK_ASTERISK:return!0;default:return!1}}r.Parser=u,function(e){e[e.NONE=0]="NONE",e[e.COMMA=1]="COMMA",e[e.SPREAD=2]="SPREAD",e[e.YIELD=3]="YIELD",e[e.ASSIGNMENT=4]="ASSIGNMENT",e[e.CONDITIONAL=5]="CONDITIONAL",e[e.LOGICAL_OR=6]="LOGICAL_OR",e[e.LOGICAL_AND=7]="LOGICAL_AND",e[e.BITWISE_OR=8]="BITWISE_OR",e[e.BITWISE_XOR=9]="BITWISE_XOR",e[e.BITWISE_AND=10]="BITWISE_AND",e[e.EQUALITY=11]="EQUALITY",e[e.RELATIONAL=12]="RELATIONAL",e[e.SHIFT=13]="SHIFT",e[e.ADDITIVE=14]="ADDITIVE",e[e.MULTIPLICATIVE=15]="MULTIPLICATIVE",e[e.EXPONENTIATED=16]="EXPONENTIATED",e[e.UNARY_PREFIX=17]="UNARY_PREFIX",e[e.UNARY_POSTFIX=18]="UNARY_POSTFIX",e[e.CALL=19]="CALL",e[e.MEMBERACCESS=20]="MEMBERACCESS",e[e.GROUPING=21]="GROUPING"}(r.Precedence||(r.Precedence={}))},function(e,r,t){t(17),e.exports=t(31)},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),t(18),t(20),t(21),t(22);var n=t(4);n.Module.prototype.toText=function(){return binaryen.wrapModule(this.ref).emitStackIR()},n.Module.prototype.toAsmjs=function(){return binaryen.wrapModule(this.ref).emitAsmjs()}},function(e,r,t){(function(e){const r=e.Binaryen||t(19);for(var n in e.binaryen=r,r)(n.startsWith("_Binaryen")||n.startsWith("_Relooper"))&&(e[n]=r[n]);e.__memory_allocate=r._malloc,e.__memory_free=r._free,e.__memory_copy=r._memmove,e.__store=function(e,t){r.HEAPU8[e]=t},e.__load=function(e){return r.HEAPU8[e]}}).call(this,t(8))},function(r,t){r.exports=e},function(e,r,t){(function(e){var r="undefined"!=typeof window&&window||void 0!==e&&e||self;r.ASC_TARGET=0,r.ASC_NO_ASSERT=!1,r.ASC_MEMORY_BASE=0,r.ASC_OPTIMIZE_LEVEL=3,r.ASC_SHRINK_LEVEL=0,r.ASC_FEATURE_MUTABLE_GLOBAL=!1,r.ASC_FEATURE_SIGN_EXTENSION=!1,r.ASC_FEATURE_BULK_MEMORY=!1,r.ASC_FEATURE_SIMD=!1,r.ASC_FEATURE_THREADS=!1;var t=new Float64Array(1),n=new Uint32Array(t.buffer);function i(){Error.captureStackTrace?Error.captureStackTrace(this,i):this.stack=this.name+": "+this.message+"\n"+(new Error).stack}function a(e){this.message=e||"assertion failed",Error.captureStackTrace?Error.captureStackTrace(this,a):this.stack=this.name+": "+this.message+"\n"+(new Error).stack}Object.defineProperties(r.i8=function(e){return e<<24>>24},{MIN_VALUE:{value:-128,writable:!1},MAX_VALUE:{value:127,writable:!1}}),Object.defineProperties(r.i16=function(e){return e<<16>>16},{MIN_VALUE:{value:-32768,writable:!1},MAX_VALUE:{value:32767,writable:!1}}),Object.defineProperties(r.i32=r.isize=function(e){return 0|e},{MIN_VALUE:{value:-2147483648,writable:!1},MAX_VALUE:{value:2147483647,writable:!1}}),Object.defineProperties(r.u8=function(e){return 255&e},{MIN_VALUE:{value:0,writable:!1},MAX_VALUE:{value:255,writable:!1}}),Object.defineProperties(r.u16=function(e){return 65535&e},{MIN_VALUE:{value:0,writable:!1},MAX_VALUE:{value:65535,writable:!1}}),Object.defineProperties(r.u32=r.usize=function(e){return e>>>0},{MIN_VALUE:{value:0,writable:!1},MAX_VALUE:{value:4294967295,writable:!1}}),Object.defineProperties(r.bool=function(e){return!!e},{MIN_VALUE:{value:!1,writable:!1},MAX_VALUE:{value:!0,writable:!1}}),Object.defineProperties(r.f32=function(e){return Math.fround(e)},{EPSILON:{value:Math.fround(1.1920929e-7),writable:!1},MIN_VALUE:{value:Math.fround(1.4012985e-45),writable:!1},MAX_VALUE:{value:Math.fround(3.4028235e38),writable:!1},MIN_NORMAL_VALUE:{value:Math.fround(1.17549435e-38),writable:!1},MIN_SAFE_INTEGER:{value:-16777215,writable:!1},MAX_SAFE_INTEGER:{value:16777215,writable:!1}}),Object.defineProperties(r.f64=function(e){return+e},{EPSILON:{value:2.220446049250313e-16,writable:!1},MIN_VALUE:{value:5e-324,writable:!1},MAX_VALUE:{value:1.7976931348623157e308,writable:!1},MIN_NORMAL_VALUE:{value:2.2250738585072014e-308,writable:!1},MIN_SAFE_INTEGER:{value:-9007199254740991,writable:!1},MAX_SAFE_INTEGER:{value:9007199254740991,writable:!1}}),r.clz=Math.clz32,r.ctz=function(e){var r=Math.clz32(e&-e);return e?31-r:r},r.popcnt=function(e){return 16843009*((e=(858993459&(e-=e>>>1&1431655765))+(e>>>2&858993459))+(e>>>4)&252645135)>>>24},r.rotl=function(e,r){return e<<(r&=31)|e>>>32-r},r.rotr=function(e,r){return e>>>(r&=31)|e<<32-r},r.abs=Math.abs,r.max=Math.max,r.min=Math.min,r.ceil=Math.ceil,r.floor=Math.floor,r.nearest=function(e){return.5===Math.abs(e-Math.trunc(e))?2*Math.round(.5*e):Math.round(e)},r.select=function(e,r,t){return t?e:r},r.sqrt=Math.sqrt,r.trunc=Math.trunc,r.copysign=function(e,r){return Math.abs(e)*Math.sign(r)},r.bswap=function(e){var r=e>>8&16711935,t=(16711935&e)<<8;return(r=(e=r|t)>>16&65535)|(t=(65535&e)<<16)},r.bswap16=function(e){return e<<8&65280|e>>8&255|4294901760&e},i.prototype=Object.create(Error.prototype),i.prototype.name="UnreachableError",i.prototype.message="unreachable",r.unreachable=function(){throw new i},a.prototype=Object.create(Error.prototype),a.prototype.name="AssertionError",r.assert=function(e,r){if(e)return e;throw new a(r)},r.changetype=function(e){return e},r.parseI32=function(e,r){return 0|parseInt(e,void 0)},String.fromCharCodes=function(e){return String.fromCharCode.apply(String,e)},String.fromCodePoints=function(e){return String.fromCodePoint.apply(String,e)},r.isInteger=Number.isInteger,r.isFloat=function(e){return"number"==typeof e},r.isNullable=function(e){return!0},r.isReference=function(e){return"object"==typeof e||"string"==typeof e},r.isFunction=function(e){return"function"==typeof e},r.isString=function(e){return"string"==typeof e||e instanceof String},r.isArray=Array.isArray,r.isArrayLike=function(e){return e&&"object"==typeof e&&"number"==typeof e.length&&e.length>=0&&Math.trunc(e.length)===e.length},r.isDefined=function(e){return void 0!==e},r.isConstant=function(e){return!1},r.unchecked=function(e){return e},r.fmod=function(e,r){return e%r},r.fmodf=function(e,r){return Math.fround(e%r)},r.JSMath=Math,Object.defineProperties(r.JSMath,{sincos_sin:{value:0,writable:!0},sincos_cos:{value:0,writable:!0},signbit:{value:function(e){return t[0]=e,Boolean(n[1]>>>31&e==e)}},sincos:{value:function(e){this.sincos_sin=Math.sin(e),this.sincos_cos=Math.cos(e)}}}),r.memory=(()=>{var e=new Uint8Array(0),t=0;return{allocate:r.__memory_allocate||function(r){if(!(r>>>=0))return 0;if(t+r>e.length){var n=e;(e=new Uint8Array(Math.max(65536,e.length+r,2*e.length))).set(n)}var i=t;return 7&(t+=r)&&(t=1+(7|t)),i},fill:r.__memory_fill||function(r,t,n){e.fill(t,r,r+n)},free:r.__memory_free||function(e){},copy:r.__memory_copy||function(r,t,n){e.copyWithin(r,t,t+n)},reset:r.__memory_reset||function(){e=new Uint8Array(0),t=0}}})(),r.store=r.__store||function(e,r,t){HEAP[(0|e)+(0|t)]=r},r.load=r.__load||function(e,r){return HEAP[(0|e)+(0|r)]}}).call(this,t(8))},function(e,r,t){(function(e){const r=new Float64Array(1),t=new Float32Array(r.buffer),n=new Int32Array(r.buffer);e.f32_as_i32=function(e){return t[0]=e,n[0]},e.i32_as_f32=function(e){return n[0]=e,t[0]},e.f64_as_i64=function(e){return r[0]=e,i64_new(n[0],n[1])},e.i64_as_f64=function(e){return n[0]=i64_low(e),n[1]=i64_high(e),r[0]}}).call(this,t(8))},function(e,r,t){(function(e){const r=e.Long||t(23);e.i64_zero=r.ZERO,e.i64_one=r.ONE,e.i64_new=function(e,t){return r.fromBits(e,t)},e.i64_low=function(e){return e.low},e.i64_high=function(e){return e.high},e.i64_add=function(e,r){return e.add(r)},e.i64_sub=function(e,r){return e.sub(r)},e.i64_mul=function(e,r){return e.mul(r)},e.i64_div=function(e,r){return e.div(r)},e.i64_div_u=function(e,r){return e.toUnsigned().div(r.toUnsigned()).toSigned()},e.i64_rem=function(e,r){return e.mod(r)},e.i64_rem_u=function(e,r){return e.toUnsigned().mod(r.toUnsigned()).toSigned()},e.i64_and=function(e,r){return e.and(r)},e.i64_or=function(e,r){return e.or(r)},e.i64_xor=function(e,r){return e.xor(r)},e.i64_shl=function(e,r){return e.shl(r)},e.i64_shr=function(e,r){return e.shr(r)},e.i64_shr_u=function(e,r){return e.shru(r)},e.i64_not=function(e){return e.not()},e.i64_eq=function(e,r){return e.eq(r)},e.i64_ne=function(e,r){return e.ne(r)},e.i64_align=function(e,t){assert(t&&0==(t&t-1));var n=r.fromInt(t-1);return e.add(n).and(n.not())},e.i64_is_i8=function(e){return 0===e.high&&e.low>=0&&e.low<=i8.MAX_VALUE||-1===e.high&&e.low>=i8.MIN_VALUE&&e.low<0},e.i64_is_i16=function(e){return 0===e.high&&e.low>=0&&e.low<=i16.MAX_VALUE||-1===e.high&&e.low>=i16.MIN_VALUE&&e.low<0},e.i64_is_i32=function(e){return 0===e.high&&e.low>=0||-1===e.high&&e.low<0},e.i64_is_u8=function(e){return 0===e.high&&e.low>=0&&e.low<=u8.MAX_VALUE},e.i64_is_u16=function(e){return 0===e.high&&e.low>=0&&e.low<=u16.MAX_VALUE},e.i64_is_u32=function(e){return 0===e.high},e.i64_is_bool=function(e){return 0===e.high&&(0===e.low||1===e.low)};const n=r.fromNumber(f32.MIN_SAFE_INTEGER),i=r.fromNumber(f32.MAX_SAFE_INTEGER);e.i64_is_f32=function(e){return e.gte(n)&&e.lte(i)};const a=r.fromNumber(f64.MIN_SAFE_INTEGER),s=r.fromNumber(f64.MAX_SAFE_INTEGER);e.i64_is_f64=function(e){return e.gte(a)&&e.lte(s)},e.i64_to_f32=function(r){return e.Math.fround(r.toNumber())},e.i64_to_f64=function(e){return e.toNumber()},e.i64_to_string=function(e,r){return(r?e.toUnsigned():e).toString(10)}}).call(this,t(8))},function(e,r){e.exports=n;var t=null;try{t=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(e){}function n(e,r,t){this.low=0|e,this.high=0|r,this.unsigned=!!t}function i(e){return!0===(e&&e.__isLong__)}n.prototype.__isLong__,Object.defineProperty(n.prototype,"__isLong__",{value:!0}),n.isLong=i;var a={},s={};function o(e,r){var t,n,i;return r?(i=0<=(e>>>=0)&&e<256)&&(n=s[e])?n:(t=l(e,(0|e)<0?-1:0,!0),i&&(s[e]=t),t):(i=-128<=(e|=0)&&e<128)&&(n=a[e])?n:(t=l(e,e<0?-1:0,!1),i&&(a[e]=t),t)}function c(e,r){if(isNaN(e))return r?f:T;if(r){if(e<0)return f;if(e>=d)return b}else{if(e<=-y)return x;if(e+1>=y)return I}return e<0?c(-e,r).neg():l(e%h|0,e/h|0,r)}function l(e,r,t){return new n(e,r,t)}n.fromInt=o,n.fromNumber=c,n.fromBits=l;var p=Math.pow;function u(e,r,t){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return T;if("number"==typeof r?(t=r,r=!1):r=!!r,(t=t||10)<2||36<t)throw RangeError("radix");var n;if((n=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===n)return u(e.substring(1),r,t).neg();for(var i=c(p(t,8)),a=T,s=0;s<e.length;s+=8){var o=Math.min(8,e.length-s),l=parseInt(e.substring(s,s+o),t);if(o<8){var _=c(p(t,o));a=a.mul(_).add(c(l))}else a=(a=a.mul(i)).add(c(l))}return a.unsigned=r,a}function _(e,r){return"number"==typeof e?c(e,r):"string"==typeof e?u(e,r):l(e.low,e.high,"boolean"==typeof r?r:e.unsigned)}n.fromString=u,n.fromValue=_;var h=4294967296,d=h*h,y=d/2,m=o(1<<24),T=o(0);n.ZERO=T;var f=o(0,!0);n.UZERO=f;var E=o(1);n.ONE=E;var g=o(1,!0);n.UONE=g;var v=o(-1);n.NEG_ONE=v;var I=l(-1,2147483647,!1);n.MAX_VALUE=I;var b=l(-1,-1,!0);n.MAX_UNSIGNED_VALUE=b;var x=l(0,-2147483648,!1);n.MIN_VALUE=x;var S=n.prototype;S.toInt=function(){return this.unsigned?this.low>>>0:this.low},S.toNumber=function(){return this.unsigned?(this.high>>>0)*h+(this.low>>>0):this.high*h+(this.low>>>0)},S.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(x)){var r=c(e),t=this.div(r),n=t.mul(r).sub(this);return t.toString(e)+n.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var i=c(p(e,6),this.unsigned),a=this,s="";;){var o=a.div(i),l=(a.sub(o.mul(i)).toInt()>>>0).toString(e);if((a=o).isZero())return l+s;for(;l.length<6;)l="0"+l;s=""+l+s}},S.getHighBits=function(){return this.high},S.getHighBitsUnsigned=function(){return this.high>>>0},S.getLowBits=function(){return this.low},S.getLowBitsUnsigned=function(){return this.low>>>0},S.getNumBitsAbs=function(){if(this.isNegative())return this.eq(x)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,r=31;r>0&&0==(e&1<<r);r--);return 0!=this.high?r+33:r+1},S.isZero=function(){return 0===this.high&&0===this.low},S.eqz=S.isZero,S.isNegative=function(){return!this.unsigned&&this.high<0},S.isPositive=function(){return this.unsigned||this.high>=0},S.isOdd=function(){return 1==(1&this.low)},S.isEven=function(){return 0==(1&this.low)},S.equals=function(e){return i(e)||(e=_(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&(this.high===e.high&&this.low===e.low)},S.eq=S.equals,S.notEquals=function(e){return!this.eq(e)},S.neq=S.notEquals,S.ne=S.notEquals,S.lessThan=function(e){return this.comp(e)<0},S.lt=S.lessThan,S.lessThanOrEqual=function(e){return this.comp(e)<=0},S.lte=S.lessThanOrEqual,S.le=S.lessThanOrEqual,S.greaterThan=function(e){return this.comp(e)>0},S.gt=S.greaterThan,S.greaterThanOrEqual=function(e){return this.comp(e)>=0},S.gte=S.greaterThanOrEqual,S.ge=S.greaterThanOrEqual,S.compare=function(e){if(i(e)||(e=_(e)),this.eq(e))return 0;var r=this.isNegative(),t=e.isNegative();return r&&!t?-1:!r&&t?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},S.comp=S.compare,S.negate=function(){return!this.unsigned&&this.eq(x)?x:this.not().add(E)},S.neg=S.negate,S.add=function(e){i(e)||(e=_(e));var r=this.high>>>16,t=65535&this.high,n=this.low>>>16,a=65535&this.low,s=e.high>>>16,o=65535&e.high,c=e.low>>>16,p=0,u=0,h=0,d=0;return h+=(d+=a+(65535&e.low))>>>16,u+=(h+=n+c)>>>16,p+=(u+=t+o)>>>16,p+=r+s,l((h&=65535)<<16|(d&=65535),(p&=65535)<<16|(u&=65535),this.unsigned)},S.subtract=function(e){return i(e)||(e=_(e)),this.add(e.neg())},S.sub=S.subtract,S.multiply=function(e){if(this.isZero())return T;if(i(e)||(e=_(e)),t)return l(t.mul(this.low,this.high,e.low,e.high),t.get_high(),this.unsigned);if(e.isZero())return T;if(this.eq(x))return e.isOdd()?x:T;if(e.eq(x))return this.isOdd()?x:T;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(m)&&e.lt(m))return c(this.toNumber()*e.toNumber(),this.unsigned);var r=this.high>>>16,n=65535&this.high,a=this.low>>>16,s=65535&this.low,o=e.high>>>16,p=65535&e.high,u=e.low>>>16,h=65535&e.low,d=0,y=0,f=0,E=0;return f+=(E+=s*h)>>>16,y+=(f+=a*h)>>>16,f&=65535,y+=(f+=s*u)>>>16,d+=(y+=n*h)>>>16,y&=65535,d+=(y+=a*u)>>>16,y&=65535,d+=(y+=s*p)>>>16,d+=r*h+n*u+a*p+s*o,l((f&=65535)<<16|(E&=65535),(d&=65535)<<16|(y&=65535),this.unsigned)},S.mul=S.multiply,S.divide=function(e){if(i(e)||(e=_(e)),e.isZero())throw Error("division by zero");var r,n,a;if(t)return this.unsigned||-2147483648!==this.high||-1!==e.low||-1!==e.high?l((this.unsigned?t.div_u:t.div_s)(this.low,this.high,e.low,e.high),t.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?f:T;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return f;if(e.gt(this.shru(1)))return g;a=f}else{if(this.eq(x))return e.eq(E)||e.eq(v)?x:e.eq(x)?E:(r=this.shr(1).div(e).shl(1)).eq(T)?e.isNegative()?E:v:(n=this.sub(e.mul(r)),a=r.add(n.div(e)));if(e.eq(x))return this.unsigned?f:T;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();a=T}for(n=this;n.gte(e);){r=Math.max(1,Math.floor(n.toNumber()/e.toNumber()));for(var s=Math.ceil(Math.log(r)/Math.LN2),o=s<=48?1:p(2,s-48),u=c(r),h=u.mul(e);h.isNegative()||h.gt(n);)h=(u=c(r-=o,this.unsigned)).mul(e);u.isZero()&&(u=E),a=a.add(u),n=n.sub(h)}return a},S.div=S.divide,S.modulo=function(e){return i(e)||(e=_(e)),t?l((this.unsigned?t.rem_u:t.rem_s)(this.low,this.high,e.low,e.high),t.get_high(),this.unsigned):this.sub(this.div(e).mul(e))},S.mod=S.modulo,S.rem=S.modulo,S.not=function(){return l(~this.low,~this.high,this.unsigned)},S.and=function(e){return i(e)||(e=_(e)),l(this.low&e.low,this.high&e.high,this.unsigned)},S.or=function(e){return i(e)||(e=_(e)),l(this.low|e.low,this.high|e.high,this.unsigned)},S.xor=function(e){return i(e)||(e=_(e)),l(this.low^e.low,this.high^e.high,this.unsigned)},S.shiftLeft=function(e){return i(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?l(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):l(0,this.low<<e-32,this.unsigned)},S.shl=S.shiftLeft,S.shiftRight=function(e){return i(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?l(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):l(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},S.shr=S.shiftRight,S.shiftRightUnsigned=function(e){if(i(e)&&(e=e.toInt()),0===(e&=63))return this;var r=this.high;return e<32?l(this.low>>>e|r<<32-e,r>>>e,this.unsigned):l(32===e?r:r>>>e-32,0,this.unsigned)},S.shru=S.shiftRightUnsigned,S.shr_u=S.shiftRightUnsigned,S.toSigned=function(){return this.unsigned?l(this.low,this.high,!1):this},S.toUnsigned=function(){return this.unsigned?this:l(this.low,this.high,!0)},S.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},S.toBytesLE=function(){var e=this.high,r=this.low;return[255&r,r>>>8&255,r>>>16&255,r>>>24,255&e,e>>>8&255,e>>>16&255,e>>>24]},S.toBytesBE=function(){var e=this.high,r=this.low;return[e>>>24,e>>>16&255,e>>>8&255,255&e,r>>>24,r>>>16&255,r>>>8&255,255&r]},n.fromBytes=function(e,r,t){return t?n.fromBytesLE(e,r):n.fromBytesBE(e,r)},n.fromBytesLE=function(e,r){return new n(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,r)},n.fromBytesBE=function(e,r){return new n(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],r)}},function(e,r,t){"use strict";var n=this&&this.__values||function(e){var r="function"==typeof Symbol&&e[Symbol.iterator],t=0;return r?r.call(e):{next:function(){return e&&t>=e.length&&(e=void 0),{value:e&&e[t++],done:!e}}}};Object.defineProperty(r,"__esModule",{value:!0});var i,a=t(2),s=t(5),o=t(6),c=t(4),l=t(3),p=t(9),u=t(0),_=t(1);function h(e,r,t,n,u,h,b){void 0===b&&(b=!1);var x=e.module;switch(r.internalName){case i.isInteger:var S=m(e,t,n,h);return e.currentType=o.Type.bool,S?S.is(4)&&!S.is(256)?x.createI32(1):x.createI32(0):x.createUnreachable();case i.isFloat:S=m(e,t,n,h);return e.currentType=o.Type.bool,S?S.is(8)?x.createI32(1):x.createI32(0):x.createUnreachable();case i.isSigned:S=m(e,t,n,h);return e.currentType=o.Type.bool,S?S.is(1)?x.createI32(1):x.createI32(0):x.createUnreachable();case i.isReference:S=m(e,t,n,h);return e.currentType=o.Type.bool,S?S.is(256)?x.createI32(1):x.createI32(0):x.createUnreachable();case i.isString:S=m(e,t,n,h);if(e.currentType=o.Type.bool,!S)return x.createUnreachable();if(F=S.classReference){var A=e.program.stringInstance;if(A&&F.isAssignableTo(A))return x.createI32(1)}return x.createI32(0);case i.isArray:S=m(e,t,n,h);if(e.currentType=o.Type.bool,!S)return x.createUnreachable();if(!(O=S.classReference))return x.createI32(0);var N=O.prototype;return x.createI32(N.extends(e.program.arrayPrototype)?1:0);case i.isArrayLike:var O;S=m(e,t,n,h);return e.currentType=o.Type.bool,S?(O=S.classReference)?x.createI32(O.lookupInSelf("length")&&(O.lookupOverload(l.OperatorKind.INDEXED_GET)||O.lookupOverload(l.OperatorKind.UNCHECKED_INDEXED_GET))?1:0):x.createI32(0):x.createUnreachable();case i.isFunction:S=m(e,t,n,h);return e.currentType=o.Type.bool,S?x.createI32(S.signatureReference?1:0):x.createUnreachable();case i.isNullable:S=m(e,t,n,h);return e.currentType=o.Type.bool,S?x.createI32(S.is(512)?1:0):x.createUnreachable();case i.isDefined:if(e.currentType=o.Type.bool,g(t,h,r)|v(n,1,h,e))return x.createUnreachable();var C=e.resolver.resolveExpression(n[0],e.currentFlow,o.Type.void,p.ReportMode.SWALLOW);return x.createI32(C?1:0);case i.isConstant:if(e.currentType=o.Type.bool,g(t,h,r)|v(n,1,h,e))return x.createUnreachable();var k=e.compileExpressionRetainType(n[0],o.Type.i32,0);return e.currentType=o.Type.bool,x.createI32(c.getExpressionId(k)==c.ExpressionId.Const?1:0);case i.isManaged:if(!e.program.hasGC)return e.currentType=o.Type.bool,x.createI32(0);S=m(e,t,n,h);return e.currentType=o.Type.bool,S?null===(F=S.classReference)||F.hasDecorator(l.DecoratorFlags.UNMANAGED)?x.createI32(0):x.createI32(1):x.createUnreachable();case i.sizeof:if(e.currentType=e.options.usizeType,f(t,h,e)|v(n,0,h,e))return x.createUnreachable();var R=t[0].byteSize,k=void 0;return e.options.isWasm64?u.is(4)&&u.size<=32?(e.currentType=o.Type.u32,k=x.createI32(R)):k=x.createI64(R,0):u.is(4)&&64==u.size?(e.currentType=o.Type.u64,k=x.createI64(R,0)):k=x.createI32(R),k;case i.alignof:if(e.currentType=e.options.usizeType,f(t,h,e)|v(n,0,h,e))return x.createUnreachable();R=t[0].byteSize;assert(_.isPowerOf2(R));var L=ctz(R);k=void 0;return e.options.isWasm64?u.is(4)&&u.size<=32?(e.currentType=o.Type.u32,k=x.createI32(L)):k=x.createI64(L,0):u.is(4)&&64==u.size?(e.currentType=o.Type.u64,k=x.createI64(L,0)):k=x.createI32(L),k;case i.offsetof:if(e.currentType=e.options.usizeType,f(t,h,e)|I(n,0,1,h,e))return x.createUnreachable();var F;if(!(F=t[0].classReference))return e.error(a.DiagnosticCode.Operation_not_supported,h.typeArgumentsRange),x.createUnreachable();var B=void 0;if(n.length){if(n[0].kind!=s.NodeKind.LITERAL||n[0].literalKind!=s.LiteralKind.STRING)return e.error(a.DiagnosticCode.String_literal_expected,n[0].range),x.createUnreachable();var U=n[0].value,D=F.members?F.members.get(U):null;if(!D||D.kind!=l.ElementKind.FIELD)return e.error(a.DiagnosticCode.Type_0_has_no_property_1,n[0].range,F.internalName,U),x.createUnreachable();B=D.memoryOffset}else B=F.currentMemoryOffset;return e.options.isWasm64?u.is(4)&&u.size<=32?(e.currentType=o.Type.u32,x.createI32(B)):x.createI64(B):u.is(4)&&64==u.size?(e.currentType=o.Type.u64,x.createI64(B)):x.createI32(B);case i.clz:case i.ctz:case i.popcnt:if(E(t,h,e,!0)|v(n,1,h,e))return x.createUnreachable();var w=t?e.compileExpression(n[0],t[0],1,1):e.compileExpression(n[0],o.Type.i32,0,1);if((S=e.currentType).is(256))return e.error(a.DiagnosticCode.Operation_not_supported,h.typeArgumentsRange),x.createUnreachable();var P=-1;switch(r.internalName){case i.clz:switch(S.kind){case 10:case 0:case 5:case 1:case 6:case 2:case 7:P=c.UnaryOp.ClzI32;break;case 9:case 4:P=e.options.isWasm64?c.UnaryOp.ClzI64:c.UnaryOp.ClzI32;break;case 3:case 8:P=c.UnaryOp.ClzI64}break;case i.ctz:switch(S.kind){case 10:case 0:case 5:case 1:case 6:case 2:case 7:P=c.UnaryOp.CtzI32;break;case 9:case 4:P=e.options.isWasm64?c.UnaryOp.CtzI64:c.UnaryOp.CtzI32;break;case 3:case 8:P=c.UnaryOp.CtzI64}break;case i.popcnt:switch(e.currentType.kind){case 10:case 0:case 5:case 1:case 6:case 2:case 7:P=c.UnaryOp.PopcntI32;break;case 9:case 4:P=e.options.isWasm64?c.UnaryOp.PopcntI64:c.UnaryOp.PopcntI32;break;case 3:case 8:P=c.UnaryOp.PopcntI64}}return-1==P?(e.error(a.DiagnosticCode.Operation_not_supported,h.typeArgumentsRange),x.createUnreachable()):x.createUnary(P,w);case i.rotl:if(E(t,h,e,!0)|v(n,2,h,e))return x.createUnreachable();w=t?e.compileExpression(n[0],t[0],1,1):e.compileExpression(n[0],o.Type.i32,0,1);if((S=e.currentType).is(256))return e.error(a.DiagnosticCode.Operation_not_supported,h.typeArgumentsRange),x.createUnreachable();var M=e.compileExpression(n[1],S,1,0);k=void 0;switch(S.kind){case 0:case 1:case 5:case 6:case 10:k=e.ensureSmallIntegerWrap(x.createBinary(c.BinaryOp.RotlI32,w,M),S);case 2:case 7:k=x.createBinary(c.BinaryOp.RotlI32,w,M);break;case 9:case 4:k=x.createBinary(e.options.isWasm64?c.BinaryOp.RotlI64:c.BinaryOp.RotlI32,w,M);break;case 3:case 8:k=x.createBinary(c.BinaryOp.RotlI64,w,M);break;default:e.error(a.DiagnosticCode.Operation_not_supported,h.typeArgumentsRange),k=x.createUnreachable()}return k;case i.rotr:if(E(t,h,e,!0)|v(n,2,h,e))return x.createUnreachable();w=t?e.compileExpression(n[0],t[0],1,1):e.compileExpression(n[0],o.Type.i32,0,1);if((S=e.currentType).is(256))return e.error(a.DiagnosticCode.Operation_not_supported,h.typeArgumentsRange),x.createUnreachable();M=e.compileExpression(n[1],S,1,0),k=void 0;switch(S.kind){case 0:case 1:case 5:case 6:case 10:k=e.ensureSmallIntegerWrap(x.createBinary(c.BinaryOp.RotrI32,w,M),S);break;case 2:case 7:k=x.createBinary(c.BinaryOp.RotrI32,w,M);break;case 9:case 4:k=x.createBinary(e.options.isWasm64?c.BinaryOp.RotrI64:c.BinaryOp.RotrI32,w,M);break;case 3:case 8:k=x.createBinary(c.BinaryOp.RotrI64,w,M);break;default:e.error(a.DiagnosticCode.Operation_not_supported,h.typeArgumentsRange),k=x.createUnreachable()}return k;case i.abs:if(E(t,h,e,!0)|v(n,1,h,e))return x.createUnreachable();w=t?e.compileExpression(n[0],t[0],1,1):e.compileExpression(n[0],o.Type.f64,0,1);if((S=e.currentType).is(256))return e.error(a.DiagnosticCode.Operation_not_supported,h.typeArgumentsRange),x.createUnreachable();k=void 0;switch(S.kind){case 0:case 1:case 2:var V=(H=e.currentFlow).getTempLocal(o.Type.i32,!1),G=H.getAndFreeTempLocal(o.Type.i32,!1).index,K=V.index;k=x.createBinary(c.BinaryOp.XorI32,x.createBinary(c.BinaryOp.AddI32,x.createTeeLocal(G,x.createBinary(c.BinaryOp.ShrI32,x.createTeeLocal(K,w),x.createI32(31))),x.createGetLocal(K,c.NativeType.I32)),x.createGetLocal(G,c.NativeType.I32)),H.freeTempLocal(V);break;case 4:var z=e.options,H=e.currentFlow,Y=z.isWasm64;V=H.getTempLocal(z.usizeType,!1),G=H.getAndFreeTempLocal(z.usizeType,!1).index,K=V.index;k=x.createBinary(Y?c.BinaryOp.XorI64:c.BinaryOp.XorI32,x.createBinary(Y?c.BinaryOp.AddI64:c.BinaryOp.AddI32,x.createTeeLocal(G,x.createBinary(Y?c.BinaryOp.ShrI64:c.BinaryOp.ShrI32,x.createTeeLocal(K,w),Y?x.createI64(63):x.createI32(31))),x.createGetLocal(K,z.nativeSizeType)),x.createGetLocal(G,z.nativeSizeType)),H.freeTempLocal(V);break;case 3:V=(H=e.currentFlow).getTempLocal(o.Type.i64,!1),G=H.getAndFreeTempLocal(o.Type.i64,!1).index,K=V.index;k=x.createBinary(c.BinaryOp.XorI64,x.createBinary(c.BinaryOp.AddI64,x.createTeeLocal(G,x.createBinary(c.BinaryOp.ShrI64,x.createTeeLocal(K,w),x.createI64(63))),x.createGetLocal(K,c.NativeType.I64)),x.createGetLocal(G,c.NativeType.I64)),H.freeTempLocal(V);break;case 9:case 5:case 6:case 7:case 8:case 10:k=w;break;case 11:k=x.createUnary(c.UnaryOp.AbsF32,w);break;case 12:k=x.createUnary(c.UnaryOp.AbsF64,w);break;default:e.error(a.DiagnosticCode.Operation_not_supported,h.typeArgumentsRange),k=x.createUnreachable()}return k;case i.max:if(E(t,h,e,!0)|v(n,2,h,e))return x.createUnreachable();w=t?e.compileExpression(n[0],t[0],1,1):e.compileExpression(n[0],o.Type.f64,0,1);if((S=e.currentType).is(256))return e.error(a.DiagnosticCode.Operation_not_supported,h.typeArgumentsRange),x.createUnreachable();M=e.compileExpression(n[1],S,1,1),P=void 0;switch(S.kind){case 0:case 1:case 2:P=c.BinaryOp.GtI32;break;case 5:case 6:case 7:case 10:P=c.BinaryOp.GtU32;break;case 3:P=c.BinaryOp.GtI64;break;case 8:P=c.BinaryOp.GtU64;break;case 4:P=e.options.isWasm64?c.BinaryOp.GtI64:c.BinaryOp.GtI32;break;case 9:P=e.options.isWasm64?c.BinaryOp.GtU64:c.BinaryOp.GtU32;break;case 11:return x.createBinary(c.BinaryOp.MaxF32,w,M);case 12:return x.createBinary(c.BinaryOp.MaxF64,w,M);default:return e.error(a.DiagnosticCode.Operation_not_supported,h.typeArgumentsRange),x.createUnreachable()}H=e.currentFlow;var W=S.toNativeType(),X=H.getTempLocal(S,!0);V=H.getAndFreeTempLocal(S,!0);return H.freeTempLocal(X),x.createSelect(x.createTeeLocal(X.index,w),x.createTeeLocal(V.index,M),x.createBinary(P,x.createGetLocal(X.index,W),x.createGetLocal(V.index,W)));case i.min:if(E(t,h,e,!0)|v(n,2,h,e))return x.createUnreachable();w=t?e.compileExpression(n[0],t[0],1,1):e.compileExpression(n[0],o.Type.f64,0,1);if((S=e.currentType).is(256))return e.error(a.DiagnosticCode.Operation_not_supported,h.typeArgumentsRange),x.createUnreachable();M=e.compileExpression(n[1],S,1,1),P=void 0;switch(S.kind){case 0:case 1:case 2:P=c.BinaryOp.LtI32;break;case 5:case 6:case 7:case 10:P=c.BinaryOp.LtU32;break;case 3:P=c.BinaryOp.LtI64;break;case 8:P=c.BinaryOp.LtU64;break;case 4:P=e.options.isWasm64?c.BinaryOp.LtI64:c.BinaryOp.LtI32;break;case 9:P=e.options.isWasm64?c.BinaryOp.LtU64:c.BinaryOp.LtU32;break;case 11:return x.createBinary(c.BinaryOp.MinF32,w,M);case 12:return x.createBinary(c.BinaryOp.MinF64,w,M);default:return e.error(a.DiagnosticCode.Operation_not_supported,h.typeArgumentsRange),x.createUnreachable()}H=e.currentFlow,W=S.toNativeType(),X=H.getTempLocal(S,!0),V=H.getAndFreeTempLocal(S,!0);return H.freeTempLocal(X),x.createSelect(x.createTeeLocal(X.index,w),x.createTeeLocal(V.index,M),x.createBinary(P,x.createGetLocal(X.index,W),x.createGetLocal(V.index,W)));case i.ceil:case i.floor:if(E(t,h,e,!0)|v(n,1,h,e))return x.createUnreachable();w=t?e.compileExpression(n[0],t[0],1,0):e.compileExpression(n[0],o.Type.f64,0,0);if((S=e.currentType).is(256))return e.error(a.DiagnosticCode.Operation_not_supported,h.typeArgumentsRange),x.createUnreachable();P=void 0;switch(S.kind){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:return w;case 11:P=r.internalName==i.ceil?c.UnaryOp.CeilF32:c.UnaryOp.FloorF32;break;case 12:P=r.internalName==i.ceil?c.UnaryOp.CeilF64:c.UnaryOp.FloorF64;break;default:return e.error(a.DiagnosticCode.Operation_not_supported,h.typeArgumentsRange),x.createUnreachable()}return x.createUnary(P,w);case i.copysign:if(E(t,h,e,!0)|v(n,2,h,e))return x.createUnreachable();w=t?e.compileExpression(n[0],t[0],1,0):e.compileExpression(n[0],o.Type.f64,0,0);if((S=e.currentType).is(256))return e.error(a.DiagnosticCode.Operation_not_supported,h.typeArgumentsRange),x.createUnreachable();M=e.compileExpression(n[1],S,1,0),P=void 0;switch(S.kind){case 11:P=c.BinaryOp.CopysignF32;break;case 12:P=c.BinaryOp.CopysignF64;break;default:return e.error(a.DiagnosticCode.Operation_not_supported,h.typeArgumentsRange),x.createUnreachable()}return x.createBinary(P,w,M);case i.nearest:if(E(t,h,e,!0)|v(n,1,h,e))return x.createUnreachable();w=t?e.compileExpression(n[0],t[0],1,0):e.compileExpression(n[0],o.Type.f64,0,0);if((S=e.currentType).is(256))return e.error(a.DiagnosticCode.Operation_not_supported,h.typeArgumentsRange),x.createUnreachable();k=void 0;switch(S.kind){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:k=w;break;case 11:k=x.createUnary(c.UnaryOp.NearestF32,w);break;case 12:k=x.createUnary(c.UnaryOp.NearestF64,w);break;default:e.error(a.DiagnosticCode.Operation_not_supported,h.typeArgumentsRange),k=x.createUnreachable()}return k;case i.reinterpret:if(f(t,h,e,!0)|v(n,1,h,e))return x.createUnreachable();if((S=t[0]).is(256))return e.currentType=S,e.error(a.DiagnosticCode.Operation_not_supported,h.typeArgumentsRange),x.createUnreachable();k=void 0;switch(S.kind){case 2:case 7:w=e.compileExpression(n[0],o.Type.f32,1,0);k=x.createUnary(c.UnaryOp.ReinterpretF32,w);break;case 3:case 8:w=e.compileExpression(n[0],o.Type.f64,1,0);k=x.createUnary(c.UnaryOp.ReinterpretF64,w);break;case 4:case 9:w=e.compileExpression(n[0],e.options.isWasm64?o.Type.f64:o.Type.f32,1,0);k=x.createUnary(e.options.isWasm64?c.UnaryOp.ReinterpretF64:c.UnaryOp.ReinterpretF32,w);break;case 11:w=e.compileExpression(n[0],o.Type.i32,1,0);k=x.createUnary(c.UnaryOp.ReinterpretI32,w);break;case 12:w=e.compileExpression(n[0],o.Type.i64,1,0);k=x.createUnary(c.UnaryOp.ReinterpretI64,w);break;default:e.error(a.DiagnosticCode.Operation_not_supported,h.typeArgumentsRange),k=x.createUnreachable()}return e.currentType=S,k;case i.sqrt:if(E(t,h,e,!0)|v(n,1,h,e))return x.createUnreachable();w=t?e.compileExpression(n[0],t[0],1,0):e.compileExpression(n[0],o.Type.f64,0,0);if((S=e.currentType).is(256))return e.currentType=S,e.error(a.DiagnosticCode.Operation_not_supported,h.typeArgumentsRange),x.createUnreachable();k=void 0;switch(S.kind){case 11:k=x.createUnary(c.UnaryOp.SqrtF32,w);break;case 12:k=x.createUnary(c.UnaryOp.SqrtF64,w);break;default:e.error(a.DiagnosticCode.Operation_not_supported,h.typeArgumentsRange),k=x.createUnreachable()}return k;case i.trunc:if(E(t,h,e,!0)|v(n,1,h,e))return x.createUnreachable();w=t?e.compileExpression(n[0],t[0],1,0):e.compileExpression(n[0],o.Type.f64,0,0);if((S=e.currentType).is(256))return e.error(a.DiagnosticCode.Operation_not_supported,h.range),x.createUnreachable();k=void 0;switch(S.kind){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:k=w;break;case 11:k=x.createUnary(c.UnaryOp.TruncF32,w);break;case 12:k=x.createUnary(c.UnaryOp.TruncF64,w);break;default:e.error(a.DiagnosticCode.Operation_not_supported,h.typeArgumentsRange),k=x.createUnreachable()}return k;case i.load:if(f(t,h,e,!0)|I(n,1,3,h,e))return x.createUnreachable();var q=(S=t[0]).is(4)&&u.is(4)&&u.size>S.size?u:S;w=e.compileExpression(n[0],e.options.usizeType,1,0);if((J=(le=n.length)>=2?T(n[1],e):0)<0)return e.currentType=q,x.createUnreachable();var Q=void 0,j=S.byteSize;if(3==le){if((Q=T(n[2],e))<0)return e.currentType=q,x.createUnreachable();if(Q>j)return e.error(a.DiagnosticCode._0_must_be_a_value_between_1_and_2_inclusive,n[2].range,"Alignment","0",j.toString()),e.currentType=q,x.createUnreachable();if(!_.isPowerOf2(Q))return e.error(a.DiagnosticCode._0_must_be_a_power_of_two,n[2].range,"Alignment"),e.currentType=q,x.createUnreachable()}else Q=j;return e.currentType=q,x.createLoad(S.byteSize,S.is(5),w,q.toNativeType(),J,Q);case i.store:if(e.currentType=o.Type.void,f(t,h,e)|I(n,2,4,h,e))return x.createUnreachable();S=t[0],w=e.compileExpression(n[0],e.options.usizeType,1,0),M=b?e.compileExpression(n[1],u,1,0):e.compileExpression(n[1],S,S.is(4)?0:1,0);var Z=e.currentType;if(S.is(4)&&(!Z.is(4)||Z.size<S.size)&&(M=e.convertExpression(M,Z,S,1,0,n[1]),Z=S),(J=n.length>=3?T(n[2],e):0)<0)return e.currentType=o.Type.void,x.createUnreachable();Q=void 0,j=S.byteSize;if(4==n.length){if((Q=T(n[3],e))<0)return e.currentType=o.Type.void,x.createUnreachable();if(Q>j)return e.error(a.DiagnosticCode._0_must_be_a_value_between_1_and_2_inclusive,n[3].range,"Alignment","0",j.toString()),e.currentType=o.Type.void,x.createUnreachable();if(!_.isPowerOf2(Q))return e.error(a.DiagnosticCode._0_must_be_a_power_of_two,n[3].range,"Alignment"),e.currentType=o.Type.void,x.createUnreachable()}else Q=j;return e.currentType=o.Type.void,x.createStore(S.byteSize,w,M,Z.toNativeType(),J,Q);case i.atomic_load:if(!e.options.hasFeature(16))break;if(f(t,h,e,!0)|I(n,1,2,h,e))return x.createUnreachable();q=(S=t[0]).is(4)&&u.is(4)&&u.size>S.size?u:S;if(!S.is(4))return e.error(a.DiagnosticCode.Operation_not_supported,h.typeArgumentsRange),e.currentType=q,x.createUnreachable();w=e.compileExpression(n[0],e.options.usizeType,1,0);return(J=2==n.length?T(n[1],e):0)<0?(e.currentType=q,x.createUnreachable()):(e.currentType=q,x.createAtomicLoad(S.byteSize,w,q.toNativeType(),J));case i.atomic_store:if(!e.options.hasFeature(16))break;if(e.currentType=o.Type.void,f(t,h,e)|I(n,2,3,h,e))return x.createUnreachable();if(!(S=t[0]).is(4)||S.size<8)return e.error(a.DiagnosticCode.Operation_not_supported,h.typeArgumentsRange),x.createUnreachable();w=e.compileExpression(n[0],e.options.usizeType,1,0),M=b?e.compileExpression(n[1],u,1,0):e.compileExpression(n[1],S,S.is(4)?0:1,0),Z=e.currentType;return S.is(4)&&(!Z.is(4)||Z.size<S.size)&&(M=e.convertExpression(M,Z,S,1,0,n[1]),Z=S),(J=3==n.length?T(n[2],e):0)<0?(e.currentType=o.Type.void,x.createUnreachable()):(e.currentType=o.Type.void,x.createAtomicStore(S.byteSize,w,M,Z.toNativeType(),J));case i.atomic_add:case i.atomic_sub:case i.atomic_and:case i.atomic_or:case i.atomic_xor:case i.atomic_xchg:if(!e.options.hasFeature(16))break;if(f(t,h,e,!0)|I(n,2,3,h,e))return x.createUnreachable();if(!(S=t[0]).is(4)||S.size<8)return e.error(a.DiagnosticCode.Operation_not_supported,h.typeArgumentsRange),x.createUnreachable();w=e.compileExpression(n[0],e.options.usizeType,1,0),M=b?e.compileExpression(n[1],u,1,0):e.compileExpression(n[1],S,S.is(4)?0:1,0),Z=e.currentType;if(S.is(4)&&(!Z.is(4)||Z.size<S.size)&&(M=e.convertExpression(M,Z,S,1,0,n[1]),Z=S),(J=3==n.length?T(n[2],e):0)<0)return e.currentType=Z,x.createUnreachable();P=void 0;switch(r.internalName){default:assert(!1);case i.atomic_add:P=c.AtomicRMWOp.Add;break;case i.atomic_sub:P=c.AtomicRMWOp.Sub;break;case i.atomic_and:P=c.AtomicRMWOp.And;break;case i.atomic_or:P=c.AtomicRMWOp.Or;break;case i.atomic_xor:P=c.AtomicRMWOp.Xor;break;case i.atomic_xchg:P=c.AtomicRMWOp.Xchg}return e.currentType=Z,x.createAtomicRMW(P,S.byteSize,J,w,M,Z.toNativeType());case i.atomic_cmpxchg:if(!e.options.hasFeature(16))break;if(f(t,h,e,!0)|I(n,3,4,h,e))return x.createUnreachable();if(!(S=t[0]).is(4)||S.size<8)return e.error(a.DiagnosticCode.Operation_not_supported,h.typeArgumentsRange),x.createUnreachable();w=e.compileExpression(n[0],e.options.usizeType,1,0),M=b?e.compileExpression(n[1],u,1,0):e.compileExpression(n[1],S,S.is(4)?0:1,0),Z=e.currentType;var J,$=e.compileExpression(n[2],Z,1,0);return S.is(4)&&(!Z.is(4)||Z.size<S.size)&&(M=e.convertExpression(M,Z,S,1,0,n[1]),$=e.convertExpression($,Z,S,1,0,n[2]),Z=S),(J=4==n.length?T(n[3],e):0)<0?(e.currentType=Z,x.createUnreachable()):(e.currentType=Z,x.createAtomicCmpxchg(S.byteSize,J,w,M,$,Z.toNativeType()));case i.atomic_wait:if(!e.options.hasFeature(16))break;if(e.currentType=o.Type.i32,f(t,h,e)|v(n,3,h,e))return x.createUnreachable();if(!(S=t[0]).is(4)||S.size<32)return e.error(a.DiagnosticCode.Operation_not_supported,h.typeArgumentsRange),x.createUnreachable();w=e.compileExpression(n[0],e.options.usizeType,1,0),M=e.compileExpression(n[1],S,1,0),$=e.compileExpression(n[2],o.Type.i64,1,0);return e.currentType=o.Type.i32,x.createAtomicWait(w,M,$,S.toNativeType());case i.atomic_notify:if(!e.options.hasFeature(16))break;if(e.currentType=o.Type.i32,f(t,h,e)|v(n,2,h,e))return x.createUnreachable();if(!(S=t[0]).is(4)||S.size<32)return e.error(a.DiagnosticCode.Operation_not_supported,h.typeArgumentsRange),x.createUnreachable();w=e.compileExpression(n[0],e.options.usizeType,1,0),M=e.compileExpression(n[1],S,1,0);return e.currentType=o.Type.i32,x.createAtomicWake(w,M);case i.select:if(E(t,h,e,!0)|v(n,3,h,e))return x.createUnreachable();w=t?e.compileExpression(n[0],t[0],1,0):e.compileExpressionRetainType(n[0],o.Type.i32,0);if(!(S=e.currentType).isAny(384))return e.error(a.DiagnosticCode.Operation_not_supported,h.typeArgumentsRange),x.createUnreachable();M=e.compileExpression(n[1],S,1,0),$=e.makeIsTrueish(e.compileExpressionRetainType(n[2],o.Type.bool,0),e.currentType);return e.currentType=S,x.createSelect(w,M,$);case i.unreachable:return t&&e.error(a.DiagnosticCode.Type_0_is_not_generic,h.typeArgumentsRange,r.internalName),v(n,0,h,e),x.createUnreachable();case i.memory_size:return e.currentType=o.Type.i32,g(t,h,r)|v(n,0,h,e)?x.createUnreachable():x.createHost(c.HostOp.CurrentMemory);case i.memory_grow:return e.currentType=o.Type.i32,g(t,h,r)|v(n,1,h,e)?x.createUnreachable():x.createHost(c.HostOp.GrowMemory,null,[e.compileExpression(n[0],o.Type.i32,1,0)]);case i.memory_copy:if(e.currentType=o.Type.void,g(t,h,r)|v(n,3,h,e))return x.createUnreachable();if(!e.options.hasFeature(4)){var ee=e.resolver.resolveFunction(r,null);return e.currentType=o.Type.void,ee?e.compileCallDirect(ee,n,h):x.createUnreachable()}var re=e.options.usizeType;w=e.compileExpression(n[0],re,1,0),M=e.compileExpression(n[1],re,1,0),$=e.compileExpression(n[2],re,1,0);return e.currentType=o.Type.void,x.createMemoryCopy(w,M,$);case i.memory_fill:if(e.currentType=o.Type.void,g(t,h,r)|v(n,3,h,e))return x.createUnreachable();if(!e.options.hasFeature(4)){ee=e.resolver.resolveFunction(r,null);return e.currentType=o.Type.void,ee?e.compileCallDirect(ee,n,h):x.createUnreachable()}re=e.options.usizeType,w=e.compileExpression(n[0],re,1,0),M=e.compileExpression(n[1],o.Type.u8,1,0),$=e.compileExpression(n[2],re,1,0);return e.currentType=o.Type.void,x.createMemoryFill(w,M,$);case i.changetype:if(f(t,h,e,!0)|v(n,1,h,e))return x.createUnreachable();var te=t[0],ne=(w=e.compileExpressionRetainType(n[0],te,0),e.currentType);return e.currentType=te,ne.size!=te.size?(e.error(a.DiagnosticCode.Operation_not_supported,h.range),x.createUnreachable()):w;case i.assert:if(E(t,h,e)|I(n,1,2,h,e))return t&&(assert(t.length),e.currentType=t[0].nonNullableType),x.createUnreachable();w=t?e.compileExpression(n[0],t[0],1,1):e.compileExpressionRetainType(n[0],o.Type.bool,1),S=e.currentType;if(e.currentType=S.nonNullableType,e.options.noAssert)return u==o.Type.void?(e.currentType=o.Type.void,x.createNop()):w;var ie=y(e,2==n.length?n[1]:null,h);e.currentType=S.nonNullableType;k=void 0;if(u==o.Type.void)switch(e.currentType=o.Type.void,S.kind){case 0:case 1:case 2:case 5:case 6:case 7:case 10:k=x.createIf(x.createUnary(c.UnaryOp.EqzI32,w),ie);break;case 3:case 8:k=x.createIf(x.createUnary(c.UnaryOp.EqzI64,w),ie);break;case 4:case 9:k=x.createIf(x.createUnary(e.options.isWasm64?c.UnaryOp.EqzI64:c.UnaryOp.EqzI32,w),ie);break;case 11:k=x.createIf(x.createBinary(c.BinaryOp.EqF32,w,x.createF32(0)),ie);break;case 12:k=x.createIf(x.createBinary(c.BinaryOp.EqF64,w,x.createF64(0)),ie);break;default:e.error(a.DiagnosticCode.Operation_not_supported,h.typeArgumentsRange),k=ie}else switch(e.currentType=S.nonNullableType,e.currentType.kind){case 0:case 1:case 2:case 5:case 6:case 7:case 10:var ae=e.currentFlow.getAndFreeTempLocal(S,!0);k=x.createIf(x.createTeeLocal(ae.index,w),x.createGetLocal(ae.index,c.NativeType.I32),ie);break;case 3:case 8:ae=e.currentFlow.getAndFreeTempLocal(o.Type.i64,!1);k=x.createIf(x.createUnary(c.UnaryOp.EqzI64,x.createTeeLocal(ae.index,w)),ie,x.createGetLocal(ae.index,c.NativeType.I64));break;case 4:case 9:ae=e.currentFlow.getAndFreeTempLocal(e.options.usizeType,!1);k=x.createIf(x.createUnary(e.options.isWasm64?c.UnaryOp.EqzI64:c.UnaryOp.EqzI32,x.createTeeLocal(ae.index,w)),ie,x.createGetLocal(ae.index,e.options.nativeSizeType));break;case 11:ae=e.currentFlow.getAndFreeTempLocal(o.Type.f32,!1);k=x.createIf(x.createBinary(c.BinaryOp.EqF32,x.createTeeLocal(ae.index,w),x.createF32(0)),ie,x.createGetLocal(ae.index,c.NativeType.F32));break;case 12:ae=e.currentFlow.getAndFreeTempLocal(o.Type.f64,!1);k=x.createIf(x.createBinary(c.BinaryOp.EqF64,x.createTeeLocal(ae.index,w),x.createF64(0)),ie,x.createGetLocal(ae.index,c.NativeType.F64));break;default:e.error(a.DiagnosticCode.Operation_not_supported,h.typeArgumentsRange),k=ie}return k;case i.unchecked:if(g(t,h,r)|v(n,1,h,e))return x.createUnreachable();var se=(H=e.currentFlow).is(8192);H.set(8192);k=e.compileExpressionRetainType(n[0],u,0);return se||H.unset(8192),k;case i.call_indirect:if(E(t,h,e,!0)|I(n,1,i32.MAX_VALUE,h,e))return x.createUnreachable();var oe=t?t[0]:u,ce=(w=e.compileExpressionRetainType(n[0],o.Type.u32,0),e.currentType);if(!(ce==o.Type.u32||7==ce.kind&&ce.signatureReference))return e.error(a.DiagnosticCode.Operation_not_supported,n[0].range),x.createUnreachable();for(var le=n.length-1,pe=new Array(le),ue=oe.toNativeType(),_e=new Array(le),he=new Array(le),de=0;de<le;++de){pe[de]=e.compileExpressionRetainType(n[1+de],o.Type.i32,0);var ye=e.currentType;_e[de]=ye,he[de]=ye.toNativeType()}var me=o.Signature.makeSignatureString(_e,oe),Te=x.getFunctionTypeBySignature(ue,he);return Te||(Te=x.addFunctionType(me,ue,he)),e.currentType=oe,x.createCallIndirect(w,pe,me);case i.instantiate:if(f(t,h,e,!0))return x.createUnreachable();var fe=t[0].classReference;return fe?(e.currentType=fe.type,e.compileInstantiate(fe,n,h)):(e.error(a.DiagnosticCode.Operation_not_supported,h.typeArgumentsRange),x.createUnreachable());case i.ERROR:return g(t,h,r),e.error(a.DiagnosticCode.User_defined_0,h.range,(n.length?n[0]:h).range.toString()),x.createUnreachable();case i.WARNING:return g(t,h,r),e.warning(a.DiagnosticCode.User_defined_0,h.range,(n.length?n[0]:h).range.toString()),x.createNop();case i.INFO:return g(t,h,r),e.info(a.DiagnosticCode.User_defined_0,h.range,(n.length?n[0]:h).range.toString()),x.createNop();case i.i8:return g(t,h,r)|v(n,1,h,e)?(e.currentType=o.Type.i8,x.createUnreachable()):e.compileExpression(n[0],o.Type.i8,2,0);case i.i16:return g(t,h,r)|v(n,1,h,e)?(e.currentType=o.Type.i16,x.createUnreachable()):e.compileExpression(n[0],o.Type.i16,2,0);case i.i32:return g(t,h,r)|v(n,1,h,e)?(e.currentType=o.Type.i32,x.createUnreachable()):e.compileExpression(n[0],o.Type.i32,2,0);case i.i64:return g(t,h,r)|v(n,1,h,e)?(e.currentType=o.Type.i64,x.createUnreachable()):e.compileExpression(n[0],o.Type.i64,2,0);case i.isize:var Ee=e.options.isizeType;return g(t,h,r)|v(n,1,h,e)?(e.currentType=Ee,x.createUnreachable()):e.compileExpression(n[0],Ee,2,0);case i.u8:return g(t,h,r)|v(n,1,h,e)?(e.currentType=o.Type.u8,x.createUnreachable()):e.compileExpression(n[0],o.Type.u8,2,0);case i.u16:return g(t,h,r)|v(n,1,h,e)?(e.currentType=o.Type.u16,x.createUnreachable()):e.compileExpression(n[0],o.Type.u16,2,0);case i.u32:return g(t,h,r)|v(n,1,h,e)?(e.currentType=o.Type.u32,x.createUnreachable()):e.compileExpression(n[0],o.Type.u32,2,0);case i.u64:return g(t,h,r)|v(n,1,h,e)?(e.currentType=o.Type.u64,x.createUnreachable()):e.compileExpression(n[0],o.Type.u64,2,0);case i.usize:re=e.options.usizeType;return g(t,h,r)|v(n,1,h,e)?(e.currentType=re,x.createUnreachable()):e.compileExpression(n[0],re,2,0);case i.bool:return g(t,h,r)|v(n,1,h,e)?(e.currentType=o.Type.bool,x.createUnreachable()):e.compileExpression(n[0],o.Type.bool,2,0);case i.f32:return g(t,h,r)|v(n,1,h,e)?(e.currentType=o.Type.f32,x.createUnreachable()):e.compileExpression(n[0],o.Type.f32,2,0);case i.f64:return g(t,h,r)|v(n,1,h,e)?(e.currentType=o.Type.f64,x.createUnreachable()):e.compileExpression(n[0],o.Type.f64,2,0);case i.v128:case i.i8x16:if(!e.options.hasFeature(8))break;if(g(t,h,r)|v(n,16,h,e))return e.currentType=o.Type.v128,x.createUnreachable();var ge=new Uint8Array(16);for(de=0;de<16;++de){if(Ie=n[de]){k=x.precomputeExpression(e.compileExpression(Ie,o.Type.i8,1,0));if(c.getExpressionId(k)!=c.ExpressionId.Const)return e.error(a.DiagnosticCode.Expression_must_be_a_compile_time_constant,Ie.range),e.currentType=o.Type.v128,x.createUnreachable();assert(c.getExpressionType(k)==c.NativeType.I32),_.writeI8(c.getConstValueI32(k),ge,de)}}return e.currentType=o.Type.v128,x.createV128(ge);case i.i16x8:if(!e.options.hasFeature(8))break;if(g(t,h,r)|v(n,8,h,e))return e.currentType=o.Type.v128,x.createUnreachable();for(ge=new Uint8Array(16),de=0;de<8;++de){if(Ie=n[de]){k=x.precomputeExpression(e.compileExpression(Ie,o.Type.i16,1,0));if(c.getExpressionId(k)!=c.ExpressionId.Const)return e.error(a.DiagnosticCode.Expression_must_be_a_compile_time_constant,Ie.range),e.currentType=o.Type.v128,x.createUnreachable();assert(c.getExpressionType(k)==c.NativeType.I32),_.writeI16(c.getConstValueI32(k),ge,de<<1)}}return e.currentType=o.Type.v128,x.createV128(ge);case i.i32x4:if(!e.options.hasFeature(8))break;if(g(t,h,r)|v(n,4,h,e))return e.currentType=o.Type.v128,x.createUnreachable();for(ge=new Uint8Array(16),de=0;de<4;++de){if(Ie=n[de]){k=x.precomputeExpression(e.compileExpression(Ie,o.Type.i32,1,0));if(c.getExpressionId(k)!=c.ExpressionId.Const)return e.error(a.DiagnosticCode.Expression_must_be_a_compile_time_constant,Ie.range),e.currentType=o.Type.v128,x.createUnreachable();assert(c.getExpressionType(k)==c.NativeType.I32),_.writeI32(c.getConstValueI32(k),ge,de<<2)}}return e.currentType=o.Type.v128,x.createV128(ge);case i.i64x2:if(!e.options.hasFeature(8))break;if(g(t,h,r)|v(n,2,h,e))return e.currentType=o.Type.v128,x.createUnreachable();for(ge=new Uint8Array(16),de=0;de<2;++de){if(Ie=n[de]){k=x.precomputeExpression(e.compileExpression(Ie,o.Type.i64,1,0));if(c.getExpressionId(k)!=c.ExpressionId.Const)return e.error(a.DiagnosticCode.Expression_must_be_a_compile_time_constant,Ie.range),e.currentType=o.Type.v128,x.createUnreachable();assert(c.getExpressionType(k)==c.NativeType.I64);var ve=de<<3;_.writeI32(c.getConstValueI64Low(k),ge,ve),_.writeI32(c.getConstValueI64High(k),ge,ve+4)}}return e.currentType=o.Type.v128,x.createV128(ge);case i.f32x4:if(!e.options.hasFeature(8))break;if(g(t,h,r)|v(n,4,h,e))return e.currentType=o.Type.v128,x.createUnreachable();for(ge=new Uint8Array(16),de=0;de<4;++de){if(Ie=n[de]){k=x.precomputeExpression(e.compileExpression(Ie,o.Type.f32,1,0));if(c.getExpressionId(k)!=c.ExpressionId.Const)return e.error(a.DiagnosticCode.Expression_must_be_a_compile_time_constant,Ie.range),e.currentType=o.Type.v128,x.createUnreachable();assert(c.getExpressionType(k)==c.NativeType.F32),_.writeF32(c.getConstValueF32(k),ge,de<<2)}}return e.currentType=o.Type.v128,x.createV128(ge);case i.f64x2:if(!e.options.hasFeature(8))break;if(g(t,h,r)|v(n,2,h,e))return e.currentType=o.Type.v128,x.createUnreachable();for(ge=new Uint8Array(16),de=0;de<2;++de){var Ie;if(Ie=n[de]){k=x.precomputeExpression(e.compileExpression(Ie,o.Type.f64,1,0));if(c.getExpressionId(k)!=c.ExpressionId.Const)return e.error(a.DiagnosticCode.Expression_must_be_a_compile_time_constant,Ie.range),e.currentType=o.Type.v128,x.createUnreachable();assert(c.getExpressionType(k)==c.NativeType.F64),_.writeF64(c.getConstValueF64(k),ge,de<<3)}}return e.currentType=o.Type.v128,x.createV128(ge);case i.v128_splat:if(!e.options.hasFeature(8))break;if(f(t,h,e)|v(n,1,h,e))return e.currentType=o.Type.v128,x.createUnreachable();if((S=t[0]).is(256))return e.error(a.DiagnosticCode.Operation_not_supported,h.typeArgumentsRange),e.currentType=o.Type.v128,x.createUnreachable();P=void 0;switch(S.kind){case 0:case 5:P=c.UnaryOp.SplatVecI8x16;break;case 1:case 6:P=c.UnaryOp.SplatVecI16x8;break;case 2:case 7:P=c.UnaryOp.SplatVecI32x4;break;case 3:case 8:P=c.UnaryOp.SplatVecI64x2;break;case 4:case 9:P=e.options.isWasm64?c.UnaryOp.SplatVecI64x2:c.UnaryOp.SplatVecI32x4;break;case 11:P=c.UnaryOp.SplatVecF32x4;break;case 12:P=c.UnaryOp.SplatVecF64x2;break;default:return e.error(a.DiagnosticCode.Operation_not_supported,h.typeArgumentsRange),e.currentType=o.Type.v128,x.createUnreachable()}w=e.compileExpression(n[0],S,1,0);return e.currentType=o.Type.v128,x.createUnary(P,w);case i.v128_extract_lane:if(!e.options.hasFeature(8))break;if(f(t,h,e,!0)|v(n,2,h,e))return x.createUnreachable();if((S=t[0]).is(256))return e.error(a.DiagnosticCode.Operation_not_supported,h.typeArgumentsRange),e.currentType=S,x.createUnreachable();P=void 0;switch(S.kind){case 0:P=c.SIMDExtractOp.ExtractLaneSVecI8x16;break;case 5:P=c.SIMDExtractOp.ExtractLaneUVecI8x16;break;case 1:P=c.SIMDExtractOp.ExtractLaneSVecI16x8;break;case 6:P=c.SIMDExtractOp.ExtractLaneUVecI16x8;break;case 2:case 7:P=c.SIMDExtractOp.ExtractLaneVecI32x4;break;case 3:case 8:P=c.SIMDExtractOp.ExtractLaneVecI64x2;break;case 4:case 9:P=e.options.isWasm64?c.SIMDExtractOp.ExtractLaneVecI64x2:c.SIMDExtractOp.ExtractLaneVecI32x4;break;case 11:P=c.SIMDExtractOp.ExtractLaneVecF32x4;break;case 12:P=c.SIMDExtractOp.ExtractLaneVecF64x2;break;default:return e.error(a.DiagnosticCode.Operation_not_supported,h.typeArgumentsRange),e.currentType=S,x.createUnreachable()}w=e.compileExpression(n[0],o.Type.v128,1,0),M=x.precomputeExpression(e.compileExpression(n[1],o.Type.u8,1,0));if(e.currentType=S,c.getExpressionId(M)!=c.ExpressionId.Const)return e.error(a.DiagnosticCode.Expression_must_be_a_compile_time_constant,n[1].range),x.createUnreachable();assert(c.getExpressionType(M)==c.NativeType.I32);var be=16/S.byteSize-1;return(Ne=c.getConstValueI32(M))<0||Ne>be?(e.error(a.DiagnosticCode._0_must_be_a_value_between_1_and_2_inclusive,n[1].range,"Lane index","0",be.toString()),x.createUnreachable()):x.createSIMDExtract(P,w,Ne);case i.v128_replace_lane:if(!e.options.hasFeature(8))break;if(f(t,h,e)|v(n,3,h,e))return e.currentType=o.Type.v128,x.createUnreachable();if((S=t[0]).is(256))return e.error(a.DiagnosticCode.Operation_not_supported,h.typeArgumentsRange),e.currentType=o.Type.v128,x.createUnreachable();P=void 0;switch(S.kind){case 0:case 5:P=c.SIMDReplaceOp.ReplaceLaneVecI8x16;break;case 1:case 6:P=c.SIMDReplaceOp.ReplaceLaneVecI16x8;break;case 2:case 7:P=c.SIMDReplaceOp.ReplaceLaneVecI32x4;break;case 3:case 8:P=c.SIMDReplaceOp.ReplaceLaneVecI64x2;break;case 4:case 9:P=e.options.isWasm64?c.SIMDReplaceOp.ReplaceLaneVecI64x2:c.SIMDReplaceOp.ReplaceLaneVecI32x4;break;case 11:P=c.SIMDReplaceOp.ReplaceLaneVecF32x4;break;case 12:P=c.SIMDReplaceOp.ReplaceLaneVecF64x2;break;default:return e.error(a.DiagnosticCode.Operation_not_supported,h.typeArgumentsRange),e.currentType=o.Type.v128,x.createUnreachable()}w=e.compileExpression(n[0],o.Type.v128,1,0),M=x.precomputeExpression(e.compileExpression(n[1],o.Type.u8,1,0));if(c.getExpressionId(M)!=c.ExpressionId.Const)return e.error(a.DiagnosticCode.Expression_must_be_a_compile_time_constant,n[1].range),e.currentType=o.Type.v128,x.createUnreachable();assert(c.getExpressionType(M)==c.NativeType.I32);be=16/S.byteSize-1;if((Ne=c.getConstValueI32(M))<0||Ne>be)return e.error(a.DiagnosticCode._0_must_be_a_value_between_1_and_2_inclusive,n[1].range,"Lane index","0",be.toString()),x.createUnreachable();$=e.compileExpression(n[2],S,1,0);return e.currentType=o.Type.v128,x.createSIMDReplace(P,w,Ne,$);case i.v128_shuffle:if(!e.options.hasFeature(8))break;if(f(t,h,e))return e.currentType=o.Type.v128,x.createUnreachable();if((S=t[0]).is(256))return e.error(a.DiagnosticCode.Operation_not_supported,h.typeArgumentsRange),e.currentType=o.Type.v128,x.createUnreachable();var xe=S.byteSize,Se=16/xe;if(assert(isInteger(Se)&&_.isPowerOf2(Se)),v(n,2+Se,h,e))return e.currentType=o.Type.v128,x.createUnreachable();switch(S.kind){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 11:case 12:break;default:return e.error(a.DiagnosticCode.Operation_not_supported,h.typeArgumentsRange),e.currentType=o.Type.v128,x.createUnreachable()}w=e.compileExpression(n[0],o.Type.v128,1,0),M=e.compileExpression(n[1],o.Type.v128,1,0);var Ae=new Uint8Array(16);for(be=(Se<<1)-1,de=0;de<Se;++de){var Ne,Oe=n[2+de],Ce=x.precomputeExpression(e.compileExpression(Oe,o.Type.u8,1,0));if(c.getExpressionId(Ce)!=c.ExpressionId.Const)return e.error(a.DiagnosticCode.Expression_must_be_a_compile_time_constant,Oe.range),e.currentType=o.Type.v128,x.createUnreachable();if(assert(c.getExpressionType(Ce)==c.NativeType.I32),(Ne=c.getConstValueI32(Ce))<0||Ne>be)return e.error(a.DiagnosticCode._0_must_be_a_value_between_1_and_2_inclusive,Oe.range,"Lane index","0",be.toString()),e.currentType=o.Type.v128,x.createUnreachable();switch(xe){case 1:_.writeI8(Ne,Ae,de);break;case 2:var ke=de<<1,Re=Ne<<1;_.writeI8(Re,Ae,ke),_.writeI8(Re+1,Ae,ke+1);break;case 4:ke=de<<2,Re=Ne<<2;_.writeI8(Re,Ae,ke),_.writeI8(Re+1,Ae,ke+1),_.writeI8(Re+2,Ae,ke+2),_.writeI8(Re+3,Ae,ke+3);break;case 8:ke=de<<3,Re=Ne<<3;_.writeI8(Re,Ae,ke),_.writeI8(Re+1,Ae,ke+1),_.writeI8(Re+2,Ae,ke+2),_.writeI8(Re+3,Ae,ke+3),_.writeI8(Re+4,Ae,ke+4),_.writeI8(Re+5,Ae,ke+5),_.writeI8(Re+6,Ae,ke+6),_.writeI8(Re+7,Ae,ke+7);break;default:assert(!1)}}return e.currentType=o.Type.v128,x.createSIMDShuffle(w,M,Ae);case i.v128_add:case i.v128_sub:case i.v128_mul:case i.v128_div:case i.v128_add_saturate:case i.v128_sub_saturate:case i.v128_min:case i.v128_max:case i.v128_eq:case i.v128_ne:case i.v128_lt:case i.v128_le:case i.v128_gt:case i.v128_ge:if(!e.options.hasFeature(8))break;if(f(t,h,e)|v(n,2,h,e))return e.currentType=o.Type.v128,x.createUnreachable();if((S=t[0]).is(256))return e.error(a.DiagnosticCode.Operation_not_supported,h.typeArgumentsRange),e.currentType=o.Type.v128,x.createUnreachable();P=-1;switch(r.internalName){case i.v128_add:switch(S.kind){case 0:case 5:P=c.BinaryOp.AddVecI8x16;break;case 1:case 6:P=c.BinaryOp.AddVecI16x8;break;case 2:case 7:P=c.BinaryOp.AddVecI32x4;break;case 3:case 8:P=c.BinaryOp.AddVecI64x2;break;case 4:case 9:P=e.options.isWasm64?c.BinaryOp.AddVecI64x2:c.BinaryOp.AddVecI32x4;break;case 11:P=c.BinaryOp.AddVecF32x4;break;case 12:P=c.BinaryOp.AddVecF64x2}break;case i.v128_sub:switch(S.kind){case 0:case 5:P=c.BinaryOp.SubVecI8x16;break;case 1:case 6:P=c.BinaryOp.SubVecI16x8;break;case 2:case 7:P=c.BinaryOp.SubVecI32x4;break;case 3:case 8:P=c.BinaryOp.SubVecI64x2;break;case 4:case 9:P=e.options.isWasm64?c.BinaryOp.SubVecI64x2:c.BinaryOp.SubVecI32x4;break;case 11:P=c.BinaryOp.SubVecF32x4;break;case 12:P=c.BinaryOp.SubVecF64x2}break;case i.v128_mul:switch(S.kind){case 0:case 5:P=c.BinaryOp.MulVecI8x16;break;case 1:case 6:P=c.BinaryOp.MulVecI16x8;break;case 2:case 7:P=c.BinaryOp.MulVecI32x4;break;case 11:P=c.BinaryOp.MulVecF32x4;break;case 12:P=c.BinaryOp.MulVecF64x2;break;case 4:case 9:e.options.isWasm64||(P=c.BinaryOp.MulVecI32x4)}break;case i.v128_div:switch(S.kind){case 11:P=c.BinaryOp.DivVecF32x4;break;case 12:P=c.BinaryOp.DivVecF64x2}break;case i.v128_add_saturate:switch(S.kind){case 0:P=c.BinaryOp.AddSatSVecI8x16;break;case 5:P=c.BinaryOp.AddSatUVecI8x16;break;case 1:P=c.BinaryOp.AddSatSVecI16x8;break;case 6:P=c.BinaryOp.AddSatUVecI16x8}break;case i.v128_sub_saturate:switch(S.kind){case 0:P=c.BinaryOp.SubSatSVecI8x16;break;case 5:P=c.BinaryOp.SubSatUVecI8x16;break;case 1:P=c.BinaryOp.SubSatSVecI16x8;break;case 6:P=c.BinaryOp.SubSatUVecI16x8}break;case i.v128_min:switch(S.kind){case 11:P=c.BinaryOp.MinVecF32x4;break;case 12:P=c.BinaryOp.MinVecF64x2}break;case i.v128_max:switch(S.kind){case 11:P=c.BinaryOp.MaxVecF32x4;break;case 12:P=c.BinaryOp.MaxVecF64x2}break;case i.v128_eq:switch(S.kind){case 0:case 5:P=c.BinaryOp.EqVecI8x16;break;case 1:case 6:P=c.BinaryOp.EqVecI16x8;break;case 2:case 7:P=c.BinaryOp.EqVecI32x4;break;case 11:P=c.BinaryOp.EqVecF32x4;break;case 12:P=c.BinaryOp.EqVecF64x2;break;case 4:case 9:e.options.isWasm64||(P=c.BinaryOp.EqVecI32x4)}break;case i.v128_ne:switch(S.kind){case 0:case 5:P=c.BinaryOp.NeVecI8x16;break;case 1:case 6:P=c.BinaryOp.NeVecI16x8;break;case 2:case 7:P=c.BinaryOp.NeVecI32x4;break;case 11:P=c.BinaryOp.NeVecF32x4;break;case 12:P=c.BinaryOp.NeVecF64x2;break;case 4:case 9:e.options.isWasm64||(P=c.BinaryOp.NeVecI32x4)}break;case i.v128_lt:switch(S.kind){case 0:P=c.BinaryOp.LtSVecI8x16;break;case 5:P=c.BinaryOp.LtUVecI8x16;break;case 1:P=c.BinaryOp.LtSVecI16x8;break;case 6:P=c.BinaryOp.LtUVecI16x8;break;case 2:P=c.BinaryOp.LtSVecI32x4;break;case 7:P=c.BinaryOp.LtUVecI32x4;break;case 11:P=c.BinaryOp.LtVecF32x4;break;case 12:P=c.BinaryOp.LtVecF64x2;break;case 4:case 9:e.options.isWasm64||(P=4==S.kind?c.BinaryOp.LtSVecI32x4:c.BinaryOp.LtUVecI32x4)}break;case i.v128_le:switch(S.kind){case 0:P=c.BinaryOp.LeSVecI8x16;break;case 5:P=c.BinaryOp.LeUVecI8x16;break;case 1:P=c.BinaryOp.LeSVecI16x8;break;case 6:P=c.BinaryOp.LeUVecI16x8;break;case 2:P=c.BinaryOp.LeSVecI32x4;break;case 7:P=c.BinaryOp.LeUVecI32x4;break;case 11:P=c.BinaryOp.LeVecF32x4;break;case 12:P=c.BinaryOp.LeVecF64x2;break;case 4:case 9:e.options.isWasm64||(P=4==S.kind?c.BinaryOp.LeSVecI32x4:c.BinaryOp.LeUVecI32x4)}break;case i.v128_gt:switch(S.kind){case 0:P=c.BinaryOp.GtSVecI8x16;break;case 5:P=c.BinaryOp.GtUVecI8x16;break;case 1:P=c.BinaryOp.GtSVecI16x8;break;case 6:P=c.BinaryOp.GtUVecI16x8;break;case 2:P=c.BinaryOp.GtSVecI32x4;break;case 7:P=c.BinaryOp.GtUVecI32x4;break;case 11:P=c.BinaryOp.GtVecF32x4;break;case 12:P=c.BinaryOp.GtVecF64x2;break;case 4:case 9:e.options.isWasm64||(P=4==S.kind?c.BinaryOp.GtSVecI32x4:c.BinaryOp.GtUVecI32x4)}break;case i.v128_ge:switch(S.kind){case 0:P=c.BinaryOp.GeSVecI8x16;break;case 5:P=c.BinaryOp.GeUVecI8x16;break;case 1:P=c.BinaryOp.GeSVecI16x8;break;case 6:P=c.BinaryOp.GeUVecI16x8;break;case 2:P=c.BinaryOp.GeSVecI32x4;break;case 7:P=c.BinaryOp.GeUVecI32x4;break;case 11:P=c.BinaryOp.GeVecF32x4;break;case 12:P=c.BinaryOp.GeVecF64x2;break;case 4:case 9:e.options.isWasm64||(P=4==S.kind?c.BinaryOp.GeSVecI32x4:c.BinaryOp.GeUVecI32x4)}}if(-1==P)return e.error(a.DiagnosticCode.Operation_not_supported,h.typeArgumentsRange),e.currentType=o.Type.v128,x.createUnreachable();w=e.compileExpression(n[0],o.Type.v128,1,0),M=e.compileExpression(n[1],o.Type.v128,1,0);return e.currentType=o.Type.v128,x.createBinary(P,w,M);case i.v128_neg:case i.v128_abs:case i.v128_sqrt:case i.v128_convert:case i.v128_trunc:if(!e.options.hasFeature(8))break;if(f(t,h,e)|v(n,1,h,e))return e.currentType=o.Type.v128,x.createUnreachable();if((S=t[0]).is(256))return e.error(a.DiagnosticCode.Operation_not_supported,h.range),e.currentType=o.Type.v128,x.createUnreachable();P=-1;switch(r.internalName){case i.v128_neg:switch(S.kind){case 0:case 5:P=c.UnaryOp.NegVecI8x16;break;case 1:case 6:P=c.UnaryOp.NegVecI16x8;break;case 2:case 7:P=c.UnaryOp.NegVecI32x4;break;case 3:case 8:P=c.UnaryOp.NegVecI64x2;break;case 4:case 9:P=e.options.isWasm64?c.UnaryOp.NegVecI64x2:c.UnaryOp.NegVecI32x4;break;case 11:P=c.UnaryOp.NegVecF32x4;break;case 12:P=c.UnaryOp.NegVecF64x2}break;case i.v128_abs:switch(S.kind){case 11:P=c.UnaryOp.AbsVecF32x4;break;case 12:P=c.UnaryOp.AbsVecF64x2}break;case i.v128_sqrt:switch(S.kind){case 11:P=c.UnaryOp.SqrtVecF32x4;break;case 12:P=c.UnaryOp.SqrtVecF64x2}break;case i.v128_convert:switch(S.kind){case 2:P=c.UnaryOp.ConvertSVecI32x4ToVecF32x4;break;case 7:P=c.UnaryOp.ConvertUVecI32x4ToVecF32x4;break;case 3:P=c.UnaryOp.ConvertSVecI64x2ToVecF64x2;break;case 8:P=c.UnaryOp.ConvertUVecI64x2ToVecF64x2}break;case i.v128_trunc:switch(S.kind){case 2:P=c.UnaryOp.TruncSatSVecF32x4ToVecI32x4;break;case 7:P=c.UnaryOp.TruncSatUVecF32x4ToVecI32x4;break;case 3:P=c.UnaryOp.TruncSatSVecF64x2ToVecI64x2;break;case 8:P=c.UnaryOp.TruncSatUVecF64x2ToVecI64x2}}if(-1==P)return e.error(a.DiagnosticCode.Operation_not_supported,h.typeArgumentsRange),e.currentType=o.Type.v128,x.createUnreachable();w=e.compileExpression(n[0],o.Type.v128,1,0);return e.currentType=o.Type.v128,x.createUnary(P,w);case i.v128_shl:case i.v128_shr:if(!e.options.hasFeature(8))break;if(f(t,h,e)|v(n,2,h,e))return e.currentType=o.Type.v128,x.createUnreachable();if((S=t[0]).is(256))return e.error(a.DiagnosticCode.Operation_not_supported,h.typeArgumentsRange),e.currentType=o.Type.v128,x.createUnreachable();P=-1;switch(r.internalName){case i.v128_shl:switch(S.kind){case 0:case 5:P=c.SIMDShiftOp.ShlVecI8x16;break;case 1:case 6:P=c.SIMDShiftOp.ShlVecI16x8;break;case 2:case 7:P=c.SIMDShiftOp.ShlVecI32x4;break;case 3:case 8:P=c.SIMDShiftOp.ShlVecI64x2;break;case 4:case 9:P=e.options.isWasm64?c.SIMDShiftOp.ShlVecI64x2:c.SIMDShiftOp.ShlVecI32x4}break;case i.v128_shr:switch(S.kind){case 0:P=c.SIMDShiftOp.ShrSVecI8x16;break;case 5:P=c.SIMDShiftOp.ShrUVecI8x16;break;case 1:P=c.SIMDShiftOp.ShrSVecI16x8;break;case 6:P=c.SIMDShiftOp.ShrUVecI16x8;break;case 2:P=c.SIMDShiftOp.ShrSVecI32x4;break;case 7:P=c.SIMDShiftOp.ShrUVecI32x4;break;case 3:P=c.SIMDShiftOp.ShrSVecI64x2;break;case 8:P=c.SIMDShiftOp.ShrUVecI64x2;break;case 4:P=e.options.isWasm64?c.SIMDShiftOp.ShrSVecI64x2:c.SIMDShiftOp.ShrSVecI32x4;break;case 9:P=e.options.isWasm64?c.SIMDShiftOp.ShrUVecI64x2:c.SIMDShiftOp.ShrUVecI32x4}}if(-1==P)return e.error(a.DiagnosticCode.Operation_not_supported,h.range),e.currentType=o.Type.v128,x.createUnreachable();w=e.compileExpression(n[0],o.Type.v128,1,0),M=e.compileExpression(n[1],o.Type.i32,1,0);return e.currentType=o.Type.v128,x.createSIMDShift(P,w,M);case i.v128_and:case i.v128_or:case i.v128_xor:if(!e.options.hasFeature(8))break;if(g(t,h,r)|v(n,2,h,e))return e.currentType=o.Type.v128,x.createUnreachable();P=-1;switch(r.internalName){default:assert(!1);case i.v128_and:P=c.BinaryOp.AndVec128;break;case i.v128_or:P=c.BinaryOp.OrVec128;break;case i.v128_xor:P=c.BinaryOp.XorVec128}w=e.compileExpression(n[0],o.Type.v128,1,0),M=e.compileExpression(n[1],o.Type.v128,1,0);return x.createBinary(P,w,M);case i.v128_not:if(!e.options.hasFeature(8))break;if(g(t,h,r)|v(n,1,h,e))return e.currentType=o.Type.v128,x.createUnreachable();w=e.compileExpression(n[0],o.Type.v128,1,0);return x.createUnary(c.UnaryOp.NotVec128,w);case i.v128_bitselect:if(!e.options.hasFeature(8))break;if(g(t,h,r)|v(n,3,h,e))return e.currentType=o.Type.v128,x.createUnreachable();w=e.compileExpression(n[0],o.Type.v128,1,0),M=e.compileExpression(n[1],o.Type.v128,1,0),$=e.compileExpression(n[2],o.Type.v128,1,0);return x.createSIMDBitselect(w,M,$);case i.v128_any_true:case i.v128_all_true:if(!e.options.hasFeature(8))break;if(f(t,h,e)|v(n,1,h,e))return e.currentType=o.Type.bool,x.createUnreachable();if((S=t[0]).is(256))return e.error(a.DiagnosticCode.Operation_not_supported,h.typeArgumentsRange),x.createUnreachable();P=-1;switch(r.internalName){default:assert(!1);case i.v128_any_true:switch(S.kind){case 0:case 5:P=c.UnaryOp.AnyTrueVecI8x16;break;case 1:case 6:P=c.UnaryOp.AnyTrueVecI16x8;break;case 2:case 7:P=c.UnaryOp.AnyTrueVecI32x4;break;case 3:case 8:P=c.UnaryOp.AnyTrueVecI64x2;break;case 4:case 9:P=e.options.isWasm64?c.UnaryOp.AnyTrueVecI64x2:c.UnaryOp.AnyTrueVecI32x4}break;case i.v128_all_true:switch(S.kind){case 0:case 5:P=c.UnaryOp.AllTrueVecI8x16;break;case 1:case 6:P=c.UnaryOp.AllTrueVecI16x8;break;case 2:case 7:P=c.UnaryOp.AllTrueVecI32x4;break;case 3:case 8:P=c.UnaryOp.AllTrueVecI64x2;break;case 4:case 9:P=e.options.isWasm64?c.UnaryOp.AllTrueVecI64x2:c.UnaryOp.AllTrueVecI32x4}}if(-1==P)return e.error(a.DiagnosticCode.Operation_not_supported,h.typeArgumentsRange),e.currentType=o.Type.bool,x.createUnreachable();w=e.compileExpression(n[0],o.Type.v128,1,0);return e.currentType=o.Type.bool,x.createUnary(P,w);case i.iterateRoots:if(g(t,h,r)|v(n,1,h,e))return e.currentType=o.Type.void,x.createUnreachable();k=e.compileExpressionRetainType(n[0],o.Type.u32,0);var Le=(S=e.currentType).signatureReference;return S.is(256)&&Le&&1==Le.parameterTypes.length&&Le.parameterTypes[0]==e.options.usizeType?(e.needsIterateRoots=!0,e.currentType=o.Type.void,x.createCall("~iterateRoots",[k],c.NativeType.None)):(e.error(a.DiagnosticCode.Type_0_is_not_assignable_to_type_1,h.range,S.toString(),"(ref: usize) => void"),e.currentType=o.Type.void,x.createUnreachable())}return(k=function(e,r,t,n){switch(r.internalName){case i.i32_clz:return d(i.clz,e,o.Type.i32,t,o.Type.i32,n);case i.i64_clz:return d(i.clz,e,o.Type.i64,t,o.Type.i64,n);case i.i32_ctz:return d(i.ctz,e,o.Type.i32,t,o.Type.i32,n);case i.i64_ctz:return d(i.ctz,e,o.Type.i64,t,o.Type.i64,n);case i.i32_popcnt:return d(i.popcnt,e,o.Type.i32,t,o.Type.i32,n);case i.i64_popcnt:return d(i.popcnt,e,o.Type.i64,t,o.Type.i64,n);case i.i32_rotl:return d(i.rotl,e,o.Type.i32,t,o.Type.i32,n);case i.i64_rotl:return d(i.rotl,e,o.Type.i64,t,o.Type.i64,n);case i.i32_rotr:return d(i.rotr,e,o.Type.i32,t,o.Type.i32,n);case i.i64_rotr:return d(i.rotr,e,o.Type.i64,t,o.Type.i64,n);case i.f32_abs:return d(i.abs,e,o.Type.f32,t,o.Type.f32,n);case i.f64_abs:return d(i.abs,e,o.Type.f64,t,o.Type.f64,n);case i.f32_max:return d(i.max,e,o.Type.f32,t,o.Type.f32,n);case i.f64_max:return d(i.max,e,o.Type.f64,t,o.Type.f64,n);case i.f32_min:return d(i.min,e,o.Type.f32,t,o.Type.f32,n);case i.f64_min:return d(i.min,e,o.Type.f64,t,o.Type.f64,n);case i.f32_ceil:return d(i.ceil,e,o.Type.f32,t,o.Type.f32,n);case i.f64_ceil:return d(i.ceil,e,o.Type.f64,t,o.Type.f64,n);case i.f32_floor:return d(i.floor,e,o.Type.f32,t,o.Type.f32,n);case i.f64_floor:return d(i.floor,e,o.Type.f64,t,o.Type.f64,n);case i.f32_copysign:return d(i.copysign,e,o.Type.f32,t,o.Type.f32,n);case i.f64_copysign:return d(i.copysign,e,o.Type.f64,t,o.Type.f64,n);case i.f32_nearest:return d(i.nearest,e,o.Type.f32,t,o.Type.f32,n);case i.f64_nearest:return d(i.nearest,e,o.Type.f64,t,o.Type.f64,n);case i.i32_reinterpret_f32:return d(i.reinterpret,e,o.Type.i32,t,o.Type.f32,n);case i.i64_reinterpret_f64:return d(i.reinterpret,e,o.Type.i64,t,o.Type.f64,n);case i.f32_reinterpret_i32:return d(i.reinterpret,e,o.Type.f32,t,o.Type.i32,n);case i.f64_reinterpret_i64:return d(i.reinterpret,e,o.Type.f64,t,o.Type.i64,n);case i.f32_sqrt:return d(i.sqrt,e,o.Type.f32,t,o.Type.f32,n);case i.f64_sqrt:return d(i.sqrt,e,o.Type.f64,t,o.Type.f64,n);case i.f32_trunc:return d(i.trunc,e,o.Type.f32,t,o.Type.f32,n);case i.f64_trunc:return d(i.trunc,e,o.Type.f64,t,o.Type.f64,n);case i.i32_load8_s:return d(i.load,e,o.Type.i8,t,o.Type.i32,n);case i.i32_load8_u:return d(i.load,e,o.Type.u8,t,o.Type.i32,n);case i.i32_load16_s:return d(i.load,e,o.Type.i16,t,o.Type.i32,n);case i.i32_load16_u:return d(i.load,e,o.Type.u16,t,o.Type.i32,n);case i.i32_load:return d(i.load,e,o.Type.i32,t,o.Type.i32,n);case i.i64_load8_s:return d(i.load,e,o.Type.i8,t,o.Type.i64,n);case i.i64_load8_u:return d(i.load,e,o.Type.u8,t,o.Type.i64,n);case i.i64_load16_s:return d(i.load,e,o.Type.i16,t,o.Type.i64,n);case i.i64_load16_u:return d(i.load,e,o.Type.u16,t,o.Type.i64,n);case i.i64_load32_s:return d(i.load,e,o.Type.i32,t,o.Type.i64,n);case i.i64_load32_u:return d(i.load,e,o.Type.u32,t,o.Type.i64,n);case i.i64_load:return d(i.load,e,o.Type.i64,t,o.Type.i64,n);case i.f32_load:return d(i.load,e,o.Type.f32,t,o.Type.f32,n);case i.f64_load:return d(i.load,e,o.Type.f64,t,o.Type.f64,n);case i.i32_store8:return d(i.store,e,o.Type.i8,t,o.Type.i32,n);case i.i32_store16:return d(i.store,e,o.Type.i16,t,o.Type.i32,n);case i.i32_store:return d(i.store,e,o.Type.i32,t,o.Type.i32,n);case i.i64_store8:return d(i.store,e,o.Type.i8,t,o.Type.i64,n);case i.i64_store16:return d(i.store,e,o.Type.i16,t,o.Type.i64,n);case i.i64_store32:return d(i.store,e,o.Type.i32,t,o.Type.i64,n);case i.i64_store:return d(i.store,e,o.Type.i64,t,o.Type.i64,n);case i.f32_store:return d(i.store,e,o.Type.f32,t,o.Type.f32,n);case i.f64_store:return d(i.store,e,o.Type.f64,t,o.Type.f64,n)}if(e.options.hasFeature(16))switch(r.internalName){case i.i32_atomic_load8_u:return d(i.atomic_load,e,o.Type.u8,t,o.Type.i32,n);case i.i32_atomic_load16_u:return d(i.atomic_load,e,o.Type.u16,t,o.Type.i32,n);case i.i32_atomic_load:return d(i.atomic_load,e,o.Type.i32,t,o.Type.i32,n);case i.i64_atomic_load8_u:return d(i.atomic_load,e,o.Type.u8,t,o.Type.i64,n);case i.i64_atomic_load16_u:return d(i.atomic_load,e,o.Type.u16,t,o.Type.i64,n);case i.i64_atomic_load32_u:return d(i.atomic_load,e,o.Type.u32,t,o.Type.i64,n);case i.i64_atomic_load:return d(i.atomic_load,e,o.Type.i64,t,o.Type.i64,n);case i.i32_atomic_store8:return d(i.atomic_store,e,o.Type.u8,t,o.Type.i32,n);case i.i32_atomic_store16:return d(i.atomic_store,e,o.Type.u16,t,o.Type.i32,n);case i.i32_atomic_store:return d(i.atomic_store,e,o.Type.i32,t,o.Type.i32,n);case i.i64_atomic_store8:return d(i.atomic_store,e,o.Type.u8,t,o.Type.i64,n);case i.i64_atomic_store16:return d(i.atomic_store,e,o.Type.u16,t,o.Type.i64,n);case i.i64_atomic_store32:return d(i.atomic_store,e,o.Type.u32,t,o.Type.i64,n);case i.i64_atomic_store:return d(i.atomic_store,e,o.Type.i64,t,o.Type.i64,n);case i.i32_atomic_rmw8_add_u:return d(i.atomic_add,e,o.Type.u8,t,o.Type.i32,n);case i.i32_atomic_rmw16_add_u:return d(i.atomic_add,e,o.Type.u16,t,o.Type.i32,n);case i.i32_atomic_rmw_add:return d(i.atomic_add,e,o.Type.i32,t,o.Type.i32,n);case i.i64_atomic_rmw8_add_u:return d(i.atomic_add,e,o.Type.u8,t,o.Type.i64,n);case i.i64_atomic_rmw16_add_u:return d(i.atomic_add,e,o.Type.u16,t,o.Type.i64,n);case i.i64_atomic_rmw32_add_u:return d(i.atomic_add,e,o.Type.u32,t,o.Type.i64,n);case i.i64_atomic_rmw_add:return d(i.atomic_add,e,o.Type.i64,t,o.Type.i64,n);case i.i32_atomic_rmw8_sub_u:return d(i.atomic_sub,e,o.Type.u8,t,o.Type.i32,n);case i.i32_atomic_rmw16_sub_u:return d(i.atomic_sub,e,o.Type.u16,t,o.Type.i32,n);case i.i32_atomic_rmw_sub:return d(i.atomic_sub,e,o.Type.i32,t,o.Type.i32,n);case i.i64_atomic_rmw8_sub_u:return d(i.atomic_sub,e,o.Type.u8,t,o.Type.i64,n);case i.i64_atomic_rmw16_sub_u:return d(i.atomic_sub,e,o.Type.u16,t,o.Type.i64,n);case i.i64_atomic_rmw32_sub_u:return d(i.atomic_sub,e,o.Type.u32,t,o.Type.i64,n);case i.i64_atomic_rmw_sub:return d(i.atomic_sub,e,o.Type.i64,t,o.Type.i64,n);case i.i32_atomic_rmw8_and_u:return d(i.atomic_and,e,o.Type.u8,t,o.Type.i32,n);case i.i32_atomic_rmw16_and_u:return d(i.atomic_and,e,o.Type.u16,t,o.Type.i32,n);case i.i32_atomic_rmw_and:return d(i.atomic_and,e,o.Type.i32,t,o.Type.i32,n);case i.i64_atomic_rmw8_and_u:return d(i.atomic_and,e,o.Type.u8,t,o.Type.i64,n);case i.i64_atomic_rmw16_and_u:return d(i.atomic_and,e,o.Type.u16,t,o.Type.i64,n);case i.i64_atomic_rmw32_and_u:return d(i.atomic_and,e,o.Type.u32,t,o.Type.i64,n);case i.i64_atomic_rmw_and:return d(i.atomic_and,e,o.Type.i64,t,o.Type.i64,n);case i.i32_atomic_rmw8_or_u:return d(i.atomic_or,e,o.Type.u8,t,o.Type.i32,n);case i.i32_atomic_rmw16_or_u:return d(i.atomic_or,e,o.Type.u16,t,o.Type.i32,n);case i.i32_atomic_rmw_or:return d(i.atomic_or,e,o.Type.i32,t,o.Type.i32,n);case i.i64_atomic_rmw8_or_u:return d(i.atomic_or,e,o.Type.u8,t,o.Type.i64,n);case i.i64_atomic_rmw16_or_u:return d(i.atomic_or,e,o.Type.u16,t,o.Type.i64,n);case i.i64_atomic_rmw32_or_u:return d(i.atomic_or,e,o.Type.u32,t,o.Type.i64,n);case i.i64_atomic_rmw_or:return d(i.atomic_or,e,o.Type.i64,t,o.Type.i64,n);case i.i32_atomic_rmw8_u_xor:return d(i.atomic_xor,e,o.Type.u8,t,o.Type.i32,n);case i.i32_atomic_rmw16_u_xor:return d(i.atomic_xor,e,o.Type.u16,t,o.Type.i32,n);case i.i32_atomic_rmw_xor:return d(i.atomic_xor,e,o.Type.i32,t,o.Type.i32,n);case i.i64_atomic_rmw8_xor_u:return d(i.atomic_xor,e,o.Type.u8,t,o.Type.i64,n);case i.i64_atomic_rmw16_xor_u:return d(i.atomic_xor,e,o.Type.u16,t,o.Type.i64,n);case i.i64_atomic_rmw32_xor_u:return d(i.atomic_xor,e,o.Type.u32,t,o.Type.i64,n);case i.i64_atomic_rmw_xor:return d(i.atomic_xor,e,o.Type.i64,t,o.Type.i64,n);case i.i32_atomic_rmw8_xchg_u:return d(i.atomic_xchg,e,o.Type.u8,t,o.Type.i32,n);case i.i32_atomic_rmw16_xchg_u:return d(i.atomic_xchg,e,o.Type.u16,t,o.Type.i32,n);case i.i32_atomic_rmw_xchg:return d(i.atomic_xchg,e,o.Type.i32,t,o.Type.i32,n);case i.i64_atomic_rmw8_xchg_u:return d(i.atomic_xchg,e,o.Type.u8,t,o.Type.i64,n);case i.i64_atomic_rmw16_xchg_u:return d(i.atomic_xchg,e,o.Type.u16,t,o.Type.i64,n);case i.i64_atomic_rmw32_xchg_u:return d(i.atomic_xchg,e,o.Type.u32,t,o.Type.i64,n);case i.i64_atomic_rmw_xchg:return d(i.atomic_xchg,e,o.Type.i64,t,o.Type.i64,n);case i.i32_atomic_rmw8_cmpxchg_u:return d(i.atomic_cmpxchg,e,o.Type.u8,t,o.Type.i32,n);case i.i32_atomic_rmw16_cmpxchg_u:return d(i.atomic_cmpxchg,e,o.Type.u16,t,o.Type.i32,n);case i.i32_atomic_rmw_cmpxchg:return d(i.atomic_cmpxchg,e,o.Type.i32,t,o.Type.i32,n);case i.i64_atomic_rmw8_cmpxchg_u:return d(i.atomic_cmpxchg,e,o.Type.u8,t,o.Type.i64,n);case i.i64_atomic_rmw16_cmpxchg_u:return d(i.atomic_cmpxchg,e,o.Type.u16,t,o.Type.i64,n);case i.i64_atomic_rmw32_cmpxchg_u:return d(i.atomic_cmpxchg,e,o.Type.u32,t,o.Type.i64,n);case i.i64_atomic_rmw_cmpxchg:return d(i.atomic_cmpxchg,e,o.Type.i64,t,o.Type.i64,n);case i.i32_wait:return d(i.atomic_wait,e,o.Type.i32,t,o.Type.i32,n);case i.i64_wait:return d(i.atomic_wait,e,o.Type.i64,t,o.Type.i32,n);case i.i32_notify:return d(i.atomic_notify,e,o.Type.i32,t,o.Type.i32,n);case i.i64_notify:return d(i.atomic_notify,e,o.Type.i64,t,o.Type.i32,n)}if(e.options.hasFeature(8))switch(r.internalName){case i.v128_load:return d(i.load,e,o.Type.v128,t,o.Type.v128,n);case i.v128_store:return d(i.store,e,o.Type.v128,t,o.Type.void,n);case i.i8x16_splat:return d(i.v128_splat,e,o.Type.i8,t,o.Type.v128,n);case i.i8x16_extract_lane_s:return d(i.v128_extract_lane,e,o.Type.i8,t,o.Type.i8,n);case i.i8x16_extract_lane_u:return d(i.v128_extract_lane,e,o.Type.u8,t,o.Type.u8,n);case i.i8x16_replace_lane:return d(i.v128_replace_lane,e,o.Type.i8,t,o.Type.v128,n);case i.i8x16_add:return d(i.v128_add,e,o.Type.i8,t,o.Type.v128,n);case i.i8x16_sub:return d(i.v128_sub,e,o.Type.i8,t,o.Type.v128,n);case i.i8x16_mul:return d(i.v128_mul,e,o.Type.i8,t,o.Type.v128,n);case i.i8x16_neg:return d(i.v128_neg,e,o.Type.i8,t,o.Type.v128,n);case i.i8x16_add_saturate_s:return d(i.v128_add_saturate,e,o.Type.i8,t,o.Type.v128,n);case i.i8x16_add_saturate_u:return d(i.v128_add_saturate,e,o.Type.u8,t,o.Type.v128,n);case i.i8x16_sub_saturate_s:return d(i.v128_sub_saturate,e,o.Type.i8,t,o.Type.v128,n);case i.i8x16_sub_saturate_u:return d(i.v128_sub_saturate,e,o.Type.u8,t,o.Type.v128,n);case i.i8x16_shl:return d(i.v128_shl,e,o.Type.i8,t,o.Type.v128,n);case i.i8x16_shr_s:return d(i.v128_shr,e,o.Type.i8,t,o.Type.v128,n);case i.i8x16_shr_u:return d(i.v128_shr,e,o.Type.u8,t,o.Type.v128,n);case i.i8x16_any_true:return d(i.v128_any_true,e,o.Type.i8,t,o.Type.i32,n);case i.i8x16_all_true:return d(i.v128_all_true,e,o.Type.i8,t,o.Type.i32,n);case i.i8x16_eq:return d(i.v128_eq,e,o.Type.i8,t,o.Type.v128,n);case i.i8x16_ne:return d(i.v128_ne,e,o.Type.i8,t,o.Type.v128,n);case i.i8x16_lt_s:return d(i.v128_lt,e,o.Type.i8,t,o.Type.v128,n);case i.i8x16_lt_u:return d(i.v128_lt,e,o.Type.u8,t,o.Type.v128,n);case i.i8x16_le_s:return d(i.v128_le,e,o.Type.i8,t,o.Type.v128,n);case i.i8x16_le_u:return d(i.v128_le,e,o.Type.u8,t,o.Type.v128,n);case i.i8x16_gt_s:return d(i.v128_gt,e,o.Type.i8,t,o.Type.v128,n);case i.i8x16_gt_u:return d(i.v128_gt,e,o.Type.u8,t,o.Type.v128,n);case i.i8x16_ge_s:return d(i.v128_ge,e,o.Type.i8,t,o.Type.v128,n);case i.i8x16_ge_u:return d(i.v128_ge,e,o.Type.u8,t,o.Type.v128,n);case i.i16x8_splat:return d(i.v128_splat,e,o.Type.i16,t,o.Type.v128,n);case i.i16x8_extract_lane_s:return d(i.v128_extract_lane,e,o.Type.i16,t,o.Type.i16,n);case i.i16x8_extract_lane_u:return d(i.v128_extract_lane,e,o.Type.u16,t,o.Type.u16,n);case i.i16x8_replace_lane:return d(i.v128_replace_lane,e,o.Type.i16,t,o.Type.v128,n);case i.i16x8_add:return d(i.v128_add,e,o.Type.i16,t,o.Type.v128,n);case i.i16x8_sub:return d(i.v128_sub,e,o.Type.i16,t,o.Type.v128,n);case i.i16x8_mul:return d(i.v128_mul,e,o.Type.i16,t,o.Type.v128,n);case i.i16x8_neg:return d(i.v128_neg,e,o.Type.i16,t,o.Type.v128,n);case i.i16x8_add_saturate_s:return d(i.v128_add_saturate,e,o.Type.i16,t,o.Type.v128,n);case i.i16x8_add_saturate_u:return d(i.v128_add_saturate,e,o.Type.u16,t,o.Type.v128,n);case i.i16x8_sub_saturate_s:return d(i.v128_sub_saturate,e,o.Type.i16,t,o.Type.v128,n);case i.i16x8_sub_saturate_u:return d(i.v128_sub_saturate,e,o.Type.u16,t,o.Type.v128,n);case i.i16x8_shl:return d(i.v128_shl,e,o.Type.i16,t,o.Type.v128,n);case i.i16x8_shr_s:return d(i.v128_shr,e,o.Type.i16,t,o.Type.v128,n);case i.i16x8_shr_u:return d(i.v128_shr,e,o.Type.u16,t,o.Type.v128,n);case i.i16x8_any_true:return d(i.v128_any_true,e,o.Type.i16,t,o.Type.i32,n);case i.i16x8_all_true:return d(i.v128_all_true,e,o.Type.i16,t,o.Type.i32,n);case i.i16x8_eq:return d(i.v128_eq,e,o.Type.i16,t,o.Type.v128,n);case i.i16x8_ne:return d(i.v128_ne,e,o.Type.i16,t,o.Type.v128,n);case i.i16x8_lt_s:return d(i.v128_lt,e,o.Type.i16,t,o.Type.v128,n);case i.i16x8_lt_u:return d(i.v128_lt,e,o.Type.u16,t,o.Type.v128,n);case i.i16x8_le_s:return d(i.v128_le,e,o.Type.i16,t,o.Type.v128,n);case i.i16x8_le_u:return d(i.v128_le,e,o.Type.u16,t,o.Type.v128,n);case i.i16x8_gt_s:return d(i.v128_gt,e,o.Type.i16,t,o.Type.v128,n);case i.i16x8_gt_u:return d(i.v128_gt,e,o.Type.u16,t,o.Type.v128,n);case i.i16x8_ge_s:return d(i.v128_ge,e,o.Type.i16,t,o.Type.v128,n);case i.i16x8_ge_u:return d(i.v128_ge,e,o.Type.u16,t,o.Type.v128,n);case i.i32x4_splat:return d(i.v128_splat,e,o.Type.i32,t,o.Type.v128,n);case i.i32x4_extract_lane:return d(i.v128_extract_lane,e,o.Type.i32,t,o.Type.i32,n);case i.i32x4_replace_lane:return d(i.v128_replace_lane,e,o.Type.i32,t,o.Type.v128,n);case i.i32x4_add:return d(i.v128_add,e,o.Type.i32,t,o.Type.v128,n);case i.i32x4_sub:return d(i.v128_sub,e,o.Type.i32,t,o.Type.v128,n);case i.i32x4_mul:return d(i.v128_mul,e,o.Type.i32,t,o.Type.v128,n);case i.i32x4_neg:return d(i.v128_neg,e,o.Type.i32,t,o.Type.v128,n);case i.i32x4_shl:return d(i.v128_shl,e,o.Type.i32,t,o.Type.v128,n);case i.i32x4_shr_s:return d(i.v128_shr,e,o.Type.i32,t,o.Type.v128,n);case i.i32x4_shr_u:return d(i.v128_shr,e,o.Type.u32,t,o.Type.v128,n);case i.i32x4_any_true:return d(i.v128_any_true,e,o.Type.i32,t,o.Type.i32,n);case i.i32x4_all_true:return d(i.v128_all_true,e,o.Type.i32,t,o.Type.i32,n);case i.i32x4_eq:return d(i.v128_eq,e,o.Type.i32,t,o.Type.v128,n);case i.i32x4_ne:return d(i.v128_ne,e,o.Type.i32,t,o.Type.v128,n);case i.i32x4_lt_s:return d(i.v128_lt,e,o.Type.i32,t,o.Type.v128,n);case i.i32x4_lt_u:return d(i.v128_lt,e,o.Type.u32,t,o.Type.v128,n);case i.i32x4_le_s:return d(i.v128_le,e,o.Type.i32,t,o.Type.v128,n);case i.i32x4_le_u:return d(i.v128_le,e,o.Type.u32,t,o.Type.v128,n);case i.i32x4_gt_s:return d(i.v128_gt,e,o.Type.i32,t,o.Type.v128,n);case i.i32x4_gt_u:return d(i.v128_gt,e,o.Type.u32,t,o.Type.v128,n);case i.i32x4_ge_s:return d(i.v128_ge,e,o.Type.i32,t,o.Type.v128,n);case i.i32x4_ge_u:return d(i.v128_ge,e,o.Type.u32,t,o.Type.v128,n);case i.i32x4_trunc_s_f32x4_sat:return d(i.v128_trunc,e,o.Type.i32,t,o.Type.v128,n);case i.i32x4_trunc_u_f32x4_sat:return d(i.v128_trunc,e,o.Type.u32,t,o.Type.v128,n);case i.i64x2_splat:return d(i.v128_splat,e,o.Type.i64,t,o.Type.v128,n);case i.i64x2_extract_lane:return d(i.v128_extract_lane,e,o.Type.i64,t,o.Type.i64,n);case i.i64x2_replace_lane:return d(i.v128_replace_lane,e,o.Type.i64,t,o.Type.v128,n);case i.i64x2_add:return d(i.v128_add,e,o.Type.i64,t,o.Type.v128,n);case i.i64x2_sub:return d(i.v128_sub,e,o.Type.i64,t,o.Type.v128,n);case i.i64x2_neg:return d(i.v128_neg,e,o.Type.i64,t,o.Type.v128,n);case i.i64x2_shl:return d(i.v128_shl,e,o.Type.i64,t,o.Type.v128,n);case i.i64x2_shr_s:return d(i.v128_shr,e,o.Type.i64,t,o.Type.v128,n);case i.i64x2_shr_u:return d(i.v128_shr,e,o.Type.u64,t,o.Type.v128,n);case i.i64x2_any_true:return d(i.v128_any_true,e,o.Type.i64,t,o.Type.i32,n);case i.i64x2_all_true:return d(i.v128_all_true,e,o.Type.i64,t,o.Type.i32,n);case i.i64x2_trunc_s_f64x2_sat:return d(i.v128_trunc,e,o.Type.i64,t,o.Type.v128,n);case i.i64x2_trunc_u_f64x2_sat:return d(i.v128_trunc,e,o.Type.u64,t,o.Type.v128,n);case i.f32x4_splat:return d(i.v128_splat,e,o.Type.f32,t,o.Type.v128,n);case i.f32x4_extract_lane:return d(i.v128_extract_lane,e,o.Type.f32,t,o.Type.f32,n);case i.f32x4_replace_lane:return d(i.v128_replace_lane,e,o.Type.f32,t,o.Type.v128,n);case i.f32x4_add:return d(i.v128_add,e,o.Type.f32,t,o.Type.v128,n);case i.f32x4_sub:return d(i.v128_sub,e,o.Type.f32,t,o.Type.v128,n);case i.f32x4_mul:return d(i.v128_mul,e,o.Type.f32,t,o.Type.v128,n);case i.f32x4_div:return d(i.v128_div,e,o.Type.f32,t,o.Type.v128,n);case i.f32x4_neg:return d(i.v128_neg,e,o.Type.f32,t,o.Type.v128,n);case i.f32x4_min:return d(i.v128_min,e,o.Type.f32,t,o.Type.v128,n);case i.f32x4_max:return d(i.v128_max,e,o.Type.f32,t,o.Type.v128,n);case i.f32x4_abs:return d(i.v128_abs,e,o.Type.f32,t,o.Type.v128,n);case i.f32x4_sqrt:return d(i.v128_sqrt,e,o.Type.f32,t,o.Type.v128,n);case i.f32x4_eq:return d(i.v128_eq,e,o.Type.f32,t,o.Type.v128,n);case i.f32x4_ne:return d(i.v128_ne,e,o.Type.f32,t,o.Type.v128,n);case i.f32x4_lt:return d(i.v128_lt,e,o.Type.f32,t,o.Type.v128,n);case i.f32x4_le:return d(i.v128_le,e,o.Type.f32,t,o.Type.v128,n);case i.f32x4_gt:return d(i.v128_gt,e,o.Type.f32,t,o.Type.v128,n);case i.f32x4_ge:return d(i.v128_ge,e,o.Type.f32,t,o.Type.v128,n);case i.f32x4_convert_s_i32x4:return d(i.v128_convert,e,o.Type.i32,t,o.Type.v128,n);case i.f32x4_convert_u_i32x4:return d(i.v128_convert,e,o.Type.u32,t,o.Type.v128,n);case i.f64x2_splat:return d(i.v128_splat,e,o.Type.f64,t,o.Type.v128,n);case i.f64x2_extract_lane:return d(i.v128_extract_lane,e,o.Type.f64,t,o.Type.f64,n);case i.f64x2_replace_lane:return d(i.v128_replace_lane,e,o.Type.f64,t,o.Type.v128,n);case i.f64x2_add:return d(i.v128_add,e,o.Type.f64,t,o.Type.v128,n);case i.f64x2_sub:return d(i.v128_sub,e,o.Type.f64,t,o.Type.v128,n);case i.f64x2_mul:return d(i.v128_mul,e,o.Type.f64,t,o.Type.v128,n);case i.f64x2_div:return d(i.v128_div,e,o.Type.f64,t,o.Type.v128,n);case i.f64x2_neg:return d(i.v128_neg,e,o.Type.f64,t,o.Type.v128,n);case i.f64x2_min:return d(i.v128_min,e,o.Type.f64,t,o.Type.v128,n);case i.f64x2_max:return d(i.v128_max,e,o.Type.f64,t,o.Type.v128,n);case i.f64x2_abs:return d(i.v128_abs,e,o.Type.f64,t,o.Type.v128,n);case i.f64x2_sqrt:return d(i.v128_sqrt,e,o.Type.f64,t,o.Type.v128,n);case i.f64x2_eq:return d(i.v128_eq,e,o.Type.f64,t,o.Type.v128,n);case i.f64x2_ne:return d(i.v128_ne,e,o.Type.f64,t,o.Type.v128,n);case i.f64x2_lt:return d(i.v128_lt,e,o.Type.f64,t,o.Type.v128,n);case i.f64x2_le:return d(i.v128_le,e,o.Type.f64,t,o.Type.v128,n);case i.f64x2_gt:return d(i.v128_gt,e,o.Type.f64,t,o.Type.v128,n);case i.f64x2_ge:return d(i.v128_ge,e,o.Type.f64,t,o.Type.v128,n);case i.f64x2_convert_s_i64x2:return d(i.v128_convert,e,o.Type.i64,t,o.Type.v128,n);case i.f64x2_convert_u_i64x2:return d(i.v128_convert,e,o.Type.u64,t,o.Type.v128,n);case i.v8x16_shuffle:return d(i.v128_shuffle,e,o.Type.i8,t,o.Type.v128,n)}return 0}(e,r,n,h))?(t&&e.error(a.DiagnosticCode.Type_0_is_not_generic,h.typeArgumentsRange,r.internalName),k):(e.error(a.DiagnosticCode.Cannot_find_name_0,h.expression.range,r.internalName),x.createUnreachable())}function d(e,r,t,n,i,a){assert(r.program.elementsByName.has(e));var s=r.program.elementsByName.get(e);return assert(s.kind==l.ElementKind.FUNCTION_PROTOTYPE),h(r,s,[t],n,i,a,!0)}function y(e,r,t){var n=e.program,i=e.module,a=e.program.stringInstance;if(!a)return i.createUnreachable();var s=n.abortInstance;if(!s||!e.compileFunction(s))return i.createUnreachable();var l=null!=r?e.compileExpression(r,a.type,1,0):a.type.toNativeZero(i),p=e.ensureStaticString(t.range.source.normalizedPath);return e.currentType=o.Type.void,i.createBlock(null,[i.createCall(s.internalName,[l,p,i.createI32(t.range.line),i.createI32(t.range.column)],c.NativeType.None),i.createUnreachable()])}function m(e,r,t,n){if(0==t.length)return r&&1==r.length?r[0]:(e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,n.typeArgumentsRange,"1",r?r.length.toString(10):"0"),null);if(1==t.length){if(r)if(1==r.length)e.compileExpression(t[0],r[0],1,0);else{if(r.length)return e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,n.typeArgumentsRange,"1",r.length.toString(10)),null;e.compileExpressionRetainType(t[0],o.Type.i32,0)}else e.compileExpressionRetainType(t[0],o.Type.i32,0);return e.currentType}return r&&r.length>1&&e.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,n.typeArgumentsRange,"1",r.length.toString(10)),e.error(a.DiagnosticCode.Expected_0_arguments_but_got_1,n.argumentsRange,"1",t.length.toString(10)),null}function T(e,r){var t,n;return r.options.isWasm64?(t=r.precomputeExpression(e,o.Type.usize64,1,0),(c.getExpressionId(t)!=c.ExpressionId.Const||c.getExpressionType(t)!=c.NativeType.I64||0!=c.getConstValueI64High(t)||(n=c.getConstValueI64Low(t))<0)&&(r.error(a.DiagnosticCode.Expression_must_be_a_compile_time_constant,e.range),n=-1)):(t=r.precomputeExpression(e,o.Type.usize32,1,0),(c.getExpressionId(t)!=c.ExpressionId.Const||c.getExpressionType(t)!=c.NativeType.I32||(n=c.getConstValueI32(t))<0)&&(r.error(a.DiagnosticCode.Expression_must_be_a_compile_time_constant,e.range),n=-1)),n}function f(e,r,t,n){if(void 0===n&&(n=!1),e){var i=e.length;if(1==i)return 0;assert(i),n&&(t.currentType=e[0]),t.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,r.typeArgumentsRange,"1",i.toString())}else t.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,r.range,"1","0");return 1}function E(e,r,t,n){if(void 0===n&&(n=!1),e){var i=e.length;return 1==i?0:(assert(i),n&&(t.currentType=e[0]),t.error(a.DiagnosticCode.Expected_0_type_arguments_but_got_1,r.typeArgumentsRange,"1",i.toString()),1)}return 0}function g(e,r,t){return e?(t.program.error(a.DiagnosticCode.Type_0_is_not_generic,r.typeArgumentsRange,t.internalName),1):0}function v(e,r,t,n){return e.length!=r?(n.error(a.DiagnosticCode.Expected_0_arguments_but_got_1,t.range,r.toString(),e.length.toString()),1):0}function I(e,r,t,n,i){var s=e.length;return s<r?(i.error(a.DiagnosticCode.Expected_at_least_0_arguments_but_got_1,n.range,r.toString(),s.toString()),1):s>t?(i.error(a.DiagnosticCode.Expected_0_arguments_but_got_1,n.range,t.toString(),s.toString()),1):0}!function(e){e.isInteger="~lib/builtins/isInteger",e.isFloat="~lib/builtins/isFloat",e.isSigned="~lib/builtins/isSigned",e.isReference="~lib/builtins/isReference",e.isString="~lib/builtins/isString",e.isArray="~lib/builtins/isArray",e.isArrayLike="~lib/builtins/isArrayLike",e.isFunction="~lib/builtins/isFunction",e.isNullable="~lib/builtins/isNullable",e.isDefined="~lib/builtins/isDefined",e.isConstant="~lib/builtins/isConstant",e.isManaged="~lib/builtins/isManaged",e.clz="~lib/builtins/clz",e.ctz="~lib/builtins/ctz",e.popcnt="~lib/builtins/popcnt",e.rotl="~lib/builtins/rotl",e.rotr="~lib/builtins/rotr",e.abs="~lib/builtins/abs",e.max="~lib/builtins/max",e.min="~lib/builtins/min",e.ceil="~lib/builtins/ceil",e.floor="~lib/builtins/floor",e.copysign="~lib/builtins/copysign",e.nearest="~lib/builtins/nearest",e.reinterpret="~lib/builtins/reinterpret",e.sqrt="~lib/builtins/sqrt",e.trunc="~lib/builtins/trunc",e.load="~lib/builtins/load",e.store="~lib/builtins/store",e.atomic_load="~lib/builtins/atomic.load",e.atomic_store="~lib/builtins/atomic.store",e.atomic_add="~lib/builtins/atomic.add",e.atomic_sub="~lib/builtins/atomic.sub",e.atomic_and="~lib/builtins/atomic.and",e.atomic_or="~lib/builtins/atomic.or",e.atomic_xor="~lib/builtins/atomic.xor",e.atomic_xchg="~lib/builtins/atomic.xchg",e.atomic_cmpxchg="~lib/builtins/atomic.cmpxchg",e.atomic_wait="~lib/builtins/atomic.wait",e.atomic_notify="~lib/builtins/atomic.notify",e.sizeof="~lib/builtins/sizeof",e.alignof="~lib/builtins/alignof",e.offsetof="~lib/builtins/offsetof",e.select="~lib/builtins/select",e.unreachable="~lib/builtins/unreachable",e.changetype="~lib/builtins/changetype",e.assert="~lib/builtins/assert",e.unchecked="~lib/builtins/unchecked",e.call_indirect="~lib/builtins/call_indirect",e.instantiate="~lib/builtins/instantiate",e.i8="~lib/builtins/i8",e.i16="~lib/builtins/i16",e.i32="~lib/builtins/i32",e.i64="~lib/builtins/i64",e.isize="~lib/builtins/isize",e.u8="~lib/builtins/u8",e.u16="~lib/builtins/u16",e.u32="~lib/builtins/u32",e.u64="~lib/builtins/u64",e.usize="~lib/builtins/usize",e.bool="~lib/builtins/bool",e.f32="~lib/builtins/f32",e.f64="~lib/builtins/f64",e.v128="~lib/builtins/v128",e.void_="~lib/builtins/void",e.i32_clz="~lib/builtins/i32.clz",e.i64_clz="~lib/builtins/i64.clz",e.i32_ctz="~lib/builtins/i32.ctz",e.i64_ctz="~lib/builtins/i64.ctz",e.i32_popcnt="~lib/builtins/i32.popcnt",e.i64_popcnt="~lib/builtins/i64.popcnt",e.i32_rotl="~lib/builtins/i32.rotl",e.i64_rotl="~lib/builtins/i64.rotl",e.i32_rotr="~lib/builtins/i32.rotr",e.i64_rotr="~lib/builtins/i64.rotr",e.f32_abs="~lib/builtins/f32.abs",e.f64_abs="~lib/builtins/f64.abs",e.f32_max="~lib/builtins/f32.max",e.f64_max="~lib/builtins/f64.max",e.f32_min="~lib/builtins/f32.min",e.f64_min="~lib/builtins/f64.min",e.f32_ceil="~lib/builtins/f32.ceil",e.f64_ceil="~lib/builtins/f64.ceil",e.f32_floor="~lib/builtins/f32.floor",e.f64_floor="~lib/builtins/f64.floor",e.f32_copysign="~lib/builtins/f32.copysign",e.f64_copysign="~lib/builtins/f64.copysign",e.f32_nearest="~lib/builtins/f32.nearest",e.f64_nearest="~lib/builtins/f64.nearest",e.i32_reinterpret_f32="~lib/builtins/i32.reinterpret_f32",e.i64_reinterpret_f64="~lib/builtins/i64.reinterpret_f64",e.f32_reinterpret_i32="~lib/builtins/f32.reinterpret_i32",e.f64_reinterpret_i64="~lib/builtins/f64.reinterpret_i64",e.f32_sqrt="~lib/builtins/f32.sqrt",e.f64_sqrt="~lib/builtins/f64.sqrt",e.f32_trunc="~lib/builtins/f32.trunc",e.f64_trunc="~lib/builtins/f64.trunc",e.i32_load8_s="~lib/builtins/i32.load8_s",e.i32_load8_u="~lib/builtins/i32.load8_u",e.i32_load16_s="~lib/builtins/i32.load16_s",e.i32_load16_u="~lib/builtins/i32.load16_u",e.i32_load="~lib/builtins/i32.load",e.i64_load8_s="~lib/builtins/i64.load8_s",e.i64_load8_u="~lib/builtins/i64.load8_u",e.i64_load16_s="~lib/builtins/i64.load16_s",e.i64_load16_u="~lib/builtins/i64.load16_u",e.i64_load32_s="~lib/builtins/i64.load32_s",e.i64_load32_u="~lib/builtins/i64.load32_u",e.i64_load="~lib/builtins/i64.load",e.f32_load="~lib/builtins/f32.load",e.f64_load="~lib/builtins/f64.load",e.i32_store8="~lib/builtins/i32.store8",e.i32_store16="~lib/builtins/i32.store16",e.i32_store="~lib/builtins/i32.store",e.i64_store8="~lib/builtins/i64.store8",e.i64_store16="~lib/builtins/i64.store16",e.i64_store32="~lib/builtins/i64.store32",e.i64_store="~lib/builtins/i64.store",e.f32_store="~lib/builtins/f32.store",e.f64_store="~lib/builtins/f64.store",e.i32_atomic_load8_u="~lib/builtins/i32.atomic.load8_u",e.i32_atomic_load16_u="~lib/builtins/i32.atomic.load16_u",e.i32_atomic_load="~lib/builtins/i32.atomic.load",e.i64_atomic_load8_u="~lib/builtins/i64.atomic.load8_u",e.i64_atomic_load16_u="~lib/builtins/i64.atomic.load16_u",e.i64_atomic_load32_u="~lib/builtins/i64.atomic.load32_u",e.i64_atomic_load="~lib/builtins/i64.atomic.load",e.i32_atomic_store8="~lib/builtins/i32.atomic.store8",e.i32_atomic_store16="~lib/builtins/i32.atomic.store16",e.i32_atomic_store="~lib/builtins/i32.atomic.store",e.i64_atomic_store8="~lib/builtins/i64.atomic.store8",e.i64_atomic_store16="~lib/builtins/i64.atomic.store16",e.i64_atomic_store32="~lib/builtins/i64.atomic.store32",e.i64_atomic_store="~lib/builtins/i64.atomic.store",e.i32_atomic_rmw8_add_u="~lib/builtins/i32.atomic.rmw8.add_u",e.i32_atomic_rmw16_add_u="~lib/builtins/i32.atomic.rmw16.add_u",e.i32_atomic_rmw_add="~lib/builtins/i32.atomic.rmw.add",e.i64_atomic_rmw8_add_u="~lib/builtins/i64.atomic.rmw8.add_u",e.i64_atomic_rmw16_add_u="~lib/builtins/i64.atomic.rmw16.add_u",e.i64_atomic_rmw32_add_u="~lib/builtins/i64.atomic.rmw32.add_u",e.i64_atomic_rmw_add="~lib/builtins/i64.atomic.rmw.add",e.i32_atomic_rmw8_sub_u="~lib/builtins/i32.atomic.rmw8.sub_u",e.i32_atomic_rmw16_sub_u="~lib/builtins/i32.atomic.rmw16.sub_u",e.i32_atomic_rmw_sub="~lib/builtins/i32.atomic.rmw.sub",e.i64_atomic_rmw8_sub_u="~lib/builtins/i64.atomic.rmw8.sub_u",e.i64_atomic_rmw16_sub_u="~lib/builtins/i64.atomic.rmw16.sub_u",e.i64_atomic_rmw32_sub_u="~lib/builtins/i64.atomic.rmw32.sub_u",e.i64_atomic_rmw_sub="~lib/builtins/i64.atomic.rmw.sub",e.i32_atomic_rmw8_and_u="~lib/builtins/i32.atomic.rmw8.and_u",e.i32_atomic_rmw16_and_u="~lib/builtins/i32.atomic.rmw16.and_u",e.i32_atomic_rmw_and="~lib/builtins/i32.atomic.rmw.and",e.i64_atomic_rmw8_and_u="~lib/builtins/i64.atomic.rmw8.and_u",e.i64_atomic_rmw16_and_u="~lib/builtins/i64.atomic.rmw16.and_u",e.i64_atomic_rmw32_and_u="~lib/builtins/i64.atomic.rmw32.and_u",e.i64_atomic_rmw_and="~lib/builtins/i64.atomic.rmw.and",e.i32_atomic_rmw8_or_u="~lib/builtins/i32.atomic.rmw8.or_u",e.i32_atomic_rmw16_or_u="~lib/builtins/i32.atomic.rmw16.or_u",e.i32_atomic_rmw_or="~lib/builtins/i32.atomic.rmw.or",e.i64_atomic_rmw8_or_u="~lib/builtins/i64.atomic.rmw8.or_u",e.i64_atomic_rmw16_or_u="~lib/builtins/i64.atomic.rmw16.or_u",e.i64_atomic_rmw32_or_u="~lib/builtins/i64.atomic.rmw32.or_u",e.i64_atomic_rmw_or="~lib/builtins/i64.atomic.rmw.or",e.i32_atomic_rmw8_u_xor="~lib/builtins/i32.atomic.rmw8.xor_u",e.i32_atomic_rmw16_u_xor="~lib/builtins/i32.atomic.rmw16.xor_u",e.i32_atomic_rmw_xor="~lib/builtins/i32.atomic.rmw.xor",e.i64_atomic_rmw8_xor_u="~lib/builtins/i64.atomic.rmw8.xor_u",e.i64_atomic_rmw16_xor_u="~lib/builtins/i64.atomic.rmw16.xor_u",e.i64_atomic_rmw32_xor_u="~lib/builtins/i64.atomic.rmw32.xor_u",e.i64_atomic_rmw_xor="~lib/builtins/i64.atomic.rmw.xor",e.i32_atomic_rmw8_xchg_u="~lib/builtins/i32.atomic.rmw8.xchg_u",e.i32_atomic_rmw16_xchg_u="~lib/builtins/i32.atomic.rmw16.xchg_u",e.i32_atomic_rmw_xchg="~lib/builtins/i32.atomic.rmw.xchg",e.i64_atomic_rmw8_xchg_u="~lib/builtins/i64.atomic.rmw8.xchg_u",e.i64_atomic_rmw16_xchg_u="~lib/builtins/i64.atomic.rmw16.xchg_u",e.i64_atomic_rmw32_xchg_u="~lib/builtins/i64.atomic.rmw32.xchg_u",e.i64_atomic_rmw_xchg="~lib/builtins/i64.atomic.rmw.xchg",e.i32_atomic_rmw8_cmpxchg_u="~lib/builtins/i32.atomic.rmw8.cmpxchg_u",e.i32_atomic_rmw16_cmpxchg_u="~lib/builtins/i32.atomic.rmw16.cmpxchg_u",e.i32_atomic_rmw_cmpxchg="~lib/builtins/i32.atomic.rmw.cmpxchg",e.i64_atomic_rmw8_cmpxchg_u="~lib/builtins/i64.atomic.rmw8.cmpxchg_u",e.i64_atomic_rmw16_cmpxchg_u="~lib/builtins/i64.atomic.rmw16.cmpxchg_u",e.i64_atomic_rmw32_cmpxchg_u="~lib/builtins/i64.atomic.rmw32.cmpxchg_u",e.i64_atomic_rmw_cmpxchg="~lib/builtins/i64.atomic.rmw.cmpxchg",e.i32_wait="~lib/builtins/i32.wait",e.i64_wait="~lib/builtins/i64.wait",e.i32_notify="~lib/builtins/i32.notify",e.i64_notify="~lib/builtins/i64.notify",e.v128_splat="~lib/builtins/v128.splat",e.v128_extract_lane="~lib/builtins/v128.extract_lane",e.v128_replace_lane="~lib/builtins/v128.replace_lane",e.v128_shuffle="~lib/builtins/v128.shuffle",e.v128_load="~lib/builtins/v128.load",e.v128_store="~lib/builtins/v128.store",e.v128_add="~lib/builtins/v128.add",e.v128_sub="~lib/builtins/v128.sub",e.v128_mul="~lib/builtins/v128.mul",e.v128_div="~lib/builtins/v128.div",e.v128_neg="~lib/builtins/v128.neg",e.v128_add_saturate="~lib/builtins/v128.add_saturate",e.v128_sub_saturate="~lib/builtins/v128.sub_saturate",e.v128_shl="~lib/builtins/v128.shl",e.v128_shr="~lib/builtins/v128.shr",e.v128_and="~lib/builtins/v128.and",e.v128_or="~lib/builtins/v128.or",e.v128_xor="~lib/builtins/v128.xor",e.v128_not="~lib/builtins/v128.not",e.v128_bitselect="~lib/builtins/v128.bitselect",e.v128_any_true="~lib/builtins/v128.any_true",e.v128_all_true="~lib/builtins/v128.all_true",e.v128_min="~lib/builtins/v128.min",e.v128_max="~lib/builtins/v128.max",e.v128_abs="~lib/builtins/v128.abs",e.v128_sqrt="~lib/builtins/v128.sqrt",e.v128_eq="~lib/builtins/v128.eq",e.v128_ne="~lib/builtins/v128.ne",e.v128_lt="~lib/builtins/v128.lt",e.v128_le="~lib/builtins/v128.le",e.v128_gt="~lib/builtins/v128.gt",e.v128_ge="~lib/builtins/v128.ge",e.v128_convert="~lib/builtins/v128.convert",e.v128_trunc="~lib/builtins/v128.trunc",e.i8x16="~lib/builtins/i8x16",e.i16x8="~lib/builtins/i16x8",e.i32x4="~lib/builtins/i32x4",e.i64x2="~lib/builtins/i64x2",e.f32x4="~lib/builtins/f32x4",e.f64x2="~lib/builtins/f64x2",e.i8x16_splat="~lib/builtins/i8x16.splat",e.i8x16_extract_lane_s="~lib/builtins/i8x16.extract_lane_s",e.i8x16_extract_lane_u="~lib/builtins/i8x16.extract_lane_u",e.i8x16_replace_lane="~lib/builtins/i8x16.replace_lane",e.i8x16_add="~lib/builtins/i8x16.add",e.i8x16_sub="~lib/builtins/i8x16.sub",e.i8x16_mul="~lib/builtins/i8x16.mul",e.i8x16_neg="~lib/builtins/i8x16.neg",e.i8x16_add_saturate_s="~lib/builtins/i8x16.add_saturate_s",e.i8x16_add_saturate_u="~lib/builtins/i8x16.add_saturate_u",e.i8x16_sub_saturate_s="~lib/builtins/i8x16.sub_saturate_s",e.i8x16_sub_saturate_u="~lib/builtins/i8x16.sub_saturate_u",e.i8x16_shl="~lib/builtins/i8x16.shl",e.i8x16_shr_s="~lib/builtins/i8x16.shr_s",e.i8x16_shr_u="~lib/builtins/i8x16.shr_u",e.i8x16_any_true="~lib/builtins/i8x16.any_true",e.i8x16_all_true="~lib/builtins/i8x16.all_true",e.i8x16_eq="~lib/builtins/i8x16.eq",e.i8x16_ne="~lib/builtins/i8x16.ne",e.i8x16_lt_s="~lib/builtins/i8x16.lt_s",e.i8x16_lt_u="~lib/builtins/i8x16.lt_u",e.i8x16_le_s="~lib/builtins/i8x16.le_s",e.i8x16_le_u="~lib/builtins/i8x16.le_u",e.i8x16_gt_s="~lib/builtins/i8x16.gt_s",e.i8x16_gt_u="~lib/builtins/i8x16.gt_u",e.i8x16_ge_s="~lib/builtins/i8x16.ge_s",e.i8x16_ge_u="~lib/builtins/i8x16.ge_u",e.i16x8_splat="~lib/builtins/i16x8.splat",e.i16x8_extract_lane_s="~lib/builtins/i16x8.extract_lane_s",e.i16x8_extract_lane_u="~lib/builtins/i16x8.extract_lane_u",e.i16x8_replace_lane="~lib/builtins/i16x8.replace_lane",e.i16x8_add="~lib/builtins/i16x8.add",e.i16x8_sub="~lib/builtins/i16x8.sub",e.i16x8_mul="~lib/builtins/i16x8.mul",e.i16x8_neg="~lib/builtins/i16x8.neg",e.i16x8_add_saturate_s="~lib/builtins/i16x8.add_saturate_s",e.i16x8_add_saturate_u="~lib/builtins/i16x8.add_saturate_u",e.i16x8_sub_saturate_s="~lib/builtins/i16x8.sub_saturate_s",e.i16x8_sub_saturate_u="~lib/builtins/i16x8.sub_saturate_u",e.i16x8_shl="~lib/builtins/i16x8.shl",e.i16x8_shr_s="~lib/builtins/i16x8.shr_s",e.i16x8_shr_u="~lib/builtins/i16x8.shr_u",e.i16x8_any_true="~lib/builtins/i16x8.any_true",e.i16x8_all_true="~lib/builtins/i16x8.all_true",e.i16x8_eq="~lib/builtins/i16x8.eq",e.i16x8_ne="~lib/builtins/i16x8.ne",e.i16x8_lt_s="~lib/builtins/i16x8.lt_s",e.i16x8_lt_u="~lib/builtins/i16x8.lt_u",e.i16x8_le_s="~lib/builtins/i16x8.le_s",e.i16x8_le_u="~lib/builtins/i16x8.le_u",e.i16x8_gt_s="~lib/builtins/i16x8.gt_s",e.i16x8_gt_u="~lib/builtins/i16x8.gt_u",e.i16x8_ge_s="~lib/builtins/i16x8.ge_s",e.i16x8_ge_u="~lib/builtins/i16x8.ge_u",e.i32x4_splat="~lib/builtins/i32x4.splat",e.i32x4_extract_lane="~lib/builtins/i32x4.extract_lane",e.i32x4_replace_lane="~lib/builtins/i32x4.replace_lane",e.i32x4_add="~lib/builtins/i32x4.add",e.i32x4_sub="~lib/builtins/i32x4.sub",e.i32x4_mul="~lib/builtins/i32x4.mul",e.i32x4_neg="~lib/builtins/i32x4.neg",e.i32x4_shl="~lib/builtins/i32x4.shl",e.i32x4_shr_s="~lib/builtins/i32x4.shr_s",e.i32x4_shr_u="~lib/builtins/i32x4.shr_u",e.i32x4_any_true="~lib/builtins/i32x4.any_true",e.i32x4_all_true="~lib/builtins/i32x4.all_true",e.i32x4_eq="~lib/builtins/i32x4.eq",e.i32x4_ne="~lib/builtins/i32x4.ne",e.i32x4_lt_s="~lib/builtins/i32x4.lt_s",e.i32x4_lt_u="~lib/builtins/i32x4.lt_u",e.i32x4_le_s="~lib/builtins/i32x4.le_s",e.i32x4_le_u="~lib/builtins/i32x4.le_u",e.i32x4_gt_s="~lib/builtins/i32x4.gt_s",e.i32x4_gt_u="~lib/builtins/i32x4.gt_u",e.i32x4_ge_s="~lib/builtins/i32x4.ge_s",e.i32x4_ge_u="~lib/builtins/i32x4.ge_u",e.i32x4_trunc_s_f32x4_sat="~lib/builtins/i32x4.trunc_s_f32x4_sat",e.i32x4_trunc_u_f32x4_sat="~lib/builtins/i32x4.trunc_u_f32x4_sat",e.i64x2_splat="~lib/builtins/i64x2.splat",e.i64x2_extract_lane="~lib/builtins/i64x2.extract_lane",e.i64x2_replace_lane="~lib/builtins/i64x2.replace_lane",e.i64x2_add="~lib/builtins/i64x2.add",e.i64x2_sub="~lib/builtins/i64x2.sub",e.i64x2_neg="~lib/builtins/i64x2.neg",e.i64x2_shl="~lib/builtins/i64x2.shl",e.i64x2_shr_s="~lib/builtins/i64x2.shr_s",e.i64x2_shr_u="~lib/builtins/i64x2.shr_u",e.i64x2_any_true="~lib/builtins/i64x2.any_true",e.i64x2_all_true="~lib/builtins/i64x2.all_true",e.i64x2_trunc_s_f64x2_sat="~lib/builtins/i64x2.trunc_s_f64x2_sat",e.i64x2_trunc_u_f64x2_sat="~lib/builtins/i64x2.trunc_u_f64x2_sat",e.f32x4_splat="~lib/builtins/f32x4.splat",e.f32x4_extract_lane="~lib/builtins/f32x4.extract_lane",e.f32x4_replace_lane="~lib/builtins/f32x4.replace_lane",e.f32x4_add="~lib/builtins/f32x4.add",e.f32x4_sub="~lib/builtins/f32x4.sub",e.f32x4_mul="~lib/builtins/f32x4.mul",e.f32x4_div="~lib/builtins/f32x4.div",e.f32x4_neg="~lib/builtins/f32x4.neg",e.f32x4_min="~lib/builtins/f32x4.min",e.f32x4_max="~lib/builtins/f32x4.max",e.f32x4_abs="~lib/builtins/f32x4.abs",e.f32x4_sqrt="~lib/builtins/f32x4.sqrt",e.f32x4_eq="~lib/builtins/f32x4.eq",e.f32x4_ne="~lib/builtins/f32x4.ne",e.f32x4_lt="~lib/builtins/f32x4.lt",e.f32x4_le="~lib/builtins/f32x4.le",e.f32x4_gt="~lib/builtins/f32x4.gt",e.f32x4_ge="~lib/builtins/f32x4.ge",e.f32x4_convert_s_i32x4="~lib/builtins/f32x4.convert_s_i32x4",e.f32x4_convert_u_i32x4="~lib/builtins/f32x4.convert_u_i32x4",e.f64x2_splat="~lib/builtins/f64x2.splat",e.f64x2_extract_lane="~lib/builtins/f64x2.extract_lane",e.f64x2_replace_lane="~lib/builtins/f64x2.replace_lane",e.f64x2_add="~lib/builtins/f64x2.add",e.f64x2_sub="~lib/builtins/f64x2.sub",e.f64x2_mul="~lib/builtins/f64x2.mul",e.f64x2_div="~lib/builtins/f64x2.div",e.f64x2_neg="~lib/builtins/f64x2.neg",e.f64x2_min="~lib/builtins/f64x2.min",e.f64x2_max="~lib/builtins/f64x2.max",e.f64x2_abs="~lib/builtins/f64x2.abs",e.f64x2_sqrt="~lib/builtins/f64x2.sqrt",e.f64x2_eq="~lib/builtins/f64x2.eq",e.f64x2_ne="~lib/builtins/f64x2.ne",e.f64x2_lt="~lib/builtins/f64x2.lt",e.f64x2_le="~lib/builtins/f64x2.le",e.f64x2_gt="~lib/builtins/f64x2.gt",e.f64x2_ge="~lib/builtins/f64x2.ge",e.f64x2_convert_s_i64x2="~lib/builtins/f64x2.convert_s_i64x2",e.f64x2_convert_u_i64x2="~lib/builtins/f64x2.convert_u_i64x2",e.v8x16_shuffle="~lib/builtins/v8x16.shuffle",e.ERROR="~lib/diagnostics/ERROR",e.WARNING="~lib/diagnostics/WARNING",e.INFO="~lib/diagnostics/INFO",e.HEAP_BASE="~lib/memory/HEAP_BASE",e.memory_size="~lib/memory/memory.size",e.memory_grow="~lib/memory/memory.grow",e.memory_copy="~lib/memory/memory.copy",e.memory_fill="~lib/memory/memory.fill",e.iterateRoots="~lib/gc/iterateRoots"}(i=r.BuiltinSymbols||(r.BuiltinSymbols={})),r.compileCall=h,r.compileAbort=y,r.compileIterateRoots=function(e){var r,t,i=e.module,a=new Array,s=o.Signature.makeSignatureString([o.Type.i32],o.Type.void),p=e.ensureFunctionType([o.Type.i32],o.Type.void);try{for(var _=n(e.program.elementsByName.values()),h=_.next();!h.done;h=_.next()){var d=h.value;if(d.kind==l.ElementKind.GLOBAL){var y=d,m=y.type.classReference;if(y.is(u.CommonFlags.COMPILED)&&null!==m&&!m.hasDecorator(l.DecoratorFlags.UNMANAGED))if(y.is(u.CommonFlags.INLINED)){var T=y.constantIntegerValue;a.push(i.createCallIndirect(i.createGetLocal(0,c.NativeType.I32),[e.options.isWasm64?i.createI64(i64_low(T),i64_high(T)):i.createI32(i64_low(T))],s))}else a.push(i.createCallIndirect(i.createGetLocal(0,c.NativeType.I32),[i.createGetGlobal(y.internalName,e.options.nativeSizeType)],s))}}}catch(e){r={error:e}}finally{try{h&&!h.done&&(t=_.return)&&t.call(_)}finally{if(r)throw r.error}}i.addFunction("~iterateRoots",p,[],a.length?i.createBlock(null,a):i.createNop())},r.ensureGCHook=function e(r,t){var i,a,s=r.program;assert(t.type.isManaged(s));var p=t.gcHookIndex;if(-1!=p)return p;var _=t.members;if(t.isDeclaredInLibrary&&null!==_&&_.has("__gc")){var h=assert(_.get("__gc"));assert(h.kind==l.ElementKind.FUNCTION_PROTOTYPE);var d=assert(s.resolver.resolveFunction(h,null));assert(d.is(u.CommonFlags.PRIVATE|u.CommonFlags.INSTANCE)),assert(!d.isAny(u.CommonFlags.AMBIENT|u.CommonFlags.VIRTUAL)),assert(0==d.signature.parameterTypes.length),assert(d.signature.returnType==o.Type.void),d.internalName=t.internalName+"~gc",assert(r.compileFunction(d));var y=r.ensureFunctionTableEntry(d);return t.gcHookIndex=y,y}var m=r.module,T=r.options,f=T.nativeSizeType,E=T.usizeType.byteSize,g=new Array;g.push(m.createIf(m.createUnary(T.isWasm64?c.UnaryOp.EqzI64:c.UnaryOp.EqzI32,m.createGetLocal(0,f)),m.createReturn()));var v=r.functionTable,I=v.length;v.push("<placeholder>"),t.gcHookIndex=I;var b=t.base;if(b?(assert(b.type.isManaged(s)),g.push(m.createCallIndirect(m.createI32(e(r,b.type.classReference)),[m.createGetLocal(0,f)],"FUNCSIG$"+(f==c.NativeType.I64?"vj":"vi")))):g.push(m.createCall(assert(s.gcMarkInstance).internalName,[m.createGetLocal(0,f)],c.NativeType.None)),_)try{for(var x=n(_.values()),S=x.next();!S.done;S=x.next()){var A=S.value;if(A.kind==l.ElementKind.FIELD&&A.parent===t&&A.type.isManaged(s)){var N=A.memoryOffset;assert(N>=0),g.push(m.createCall(assert(s.gcMarkInstance).internalName,[m.createLoad(E,!1,m.createGetLocal(0,f),f,N)],c.NativeType.None))}}}catch(e){i={error:e}}finally{try{S&&!S.done&&(a=x.return)&&a.call(x)}finally{if(i)throw i.error}}var O=t.internalName+"~gc";return m.addFunction(O,r.ensureFunctionType(null,o.Type.void,T.usizeType),null,m.createBlock(null,g)),v[I]=O,I}},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.bitsetIs=function(e,r){return assert(r>=0&&r<64),i64_ne(i64_and(e,i64_shl(i64_one,i64_new(r))),i64_zero)},r.bitsetSet=function(e,r,t){return assert(r>=0&&r<64),t?i64_or(e,i64_shl(i64_one,i64_new(r))):i64_and(e,i64_not(i64_shl(i64_one,i64_new(r))))}},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),function(e){e[e.NULL=0]="NULL",e[e.LINEFEED=10]="LINEFEED",e[e.CARRIAGERETURN=13]="CARRIAGERETURN",e[e.LINESEPARATOR=8232]="LINESEPARATOR",e[e.PARAGRAPHSEPARATOR=8233]="PARAGRAPHSEPARATOR",e[e.NEXTLINE=133]="NEXTLINE",e[e.SPACE=32]="SPACE",e[e.NONBREAKINGSPACE=160]="NONBREAKINGSPACE",e[e.ENQUAD=8192]="ENQUAD",e[e.EMQUAD=8193]="EMQUAD",e[e.ENSPACE=8194]="ENSPACE",e[e.EMSPACE=8195]="EMSPACE",e[e.THREEPEREMSPACE=8196]="THREEPEREMSPACE",e[e.FOURPEREMSPACE=8197]="FOURPEREMSPACE",e[e.SIXPEREMSPACE=8198]="SIXPEREMSPACE",e[e.FIGURESPACE=8199]="FIGURESPACE",e[e.PUNCTUATIONSPACE=8200]="PUNCTUATIONSPACE",e[e.THINSPACE=8201]="THINSPACE",e[e.HAIRSPACE=8202]="HAIRSPACE",e[e.ZEROWIDTHSPACE=8203]="ZEROWIDTHSPACE",e[e.NARROWNOBREAKSPACE=8239]="NARROWNOBREAKSPACE",e[e.IDEOGRAPHICSPACE=12288]="IDEOGRAPHICSPACE",e[e.MATHEMATICALSPACE=8287]="MATHEMATICALSPACE",e[e.OGHAM=5760]="OGHAM",e[e._=95]="_",e[e._0=48]="_0",e[e._1=49]="_1",e[e._2=50]="_2",e[e._3=51]="_3",e[e._4=52]="_4",e[e._5=53]="_5",e[e._6=54]="_6",e[e._7=55]="_7",e[e._8=56]="_8",e[e._9=57]="_9",e[e.a=97]="a",e[e.b=98]="b",e[e.c=99]="c",e[e.d=100]="d",e[e.e=101]="e",e[e.f=102]="f",e[e.g=103]="g",e[e.h=104]="h",e[e.i=105]="i",e[e.j=106]="j",e[e.k=107]="k",e[e.l=108]="l",e[e.m=109]="m",e[e.n=110]="n",e[e.o=111]="o",e[e.p=112]="p",e[e.q=113]="q",e[e.r=114]="r",e[e.s=115]="s",e[e.t=116]="t",e[e.u=117]="u",e[e.v=118]="v",e[e.w=119]="w",e[e.x=120]="x",e[e.y=121]="y",e[e.z=122]="z",e[e.A=65]="A",e[e.B=66]="B",e[e.C=67]="C",e[e.D=68]="D",e[e.E=69]="E",e[e.F=70]="F",e[e.G=71]="G",e[e.H=72]="H",e[e.I=73]="I",e[e.J=74]="J",e[e.K=75]="K",e[e.L=76]="L",e[e.M=77]="M",e[e.N=78]="N",e[e.O=79]="O",e[e.P=80]="P",e[e.Q=81]="Q",e[e.R=82]="R",e[e.S=83]="S",e[e.T=84]="T",e[e.U=85]="U",e[e.V=86]="V",e[e.W=87]="W",e[e.X=88]="X",e[e.Y=89]="Y",e[e.Z=90]="Z",e[e.AMPERSAND=38]="AMPERSAND",e[e.ASTERISK=42]="ASTERISK",e[e.AT=64]="AT",e[e.BACKSLASH=92]="BACKSLASH",e[e.BACKTICK=96]="BACKTICK",e[e.BAR=124]="BAR",e[e.CARET=94]="CARET",e[e.CLOSEBRACE=125]="CLOSEBRACE",e[e.CLOSEBRACKET=93]="CLOSEBRACKET",e[e.CLOSEPAREN=41]="CLOSEPAREN",e[e.COLON=58]="COLON",e[e.COMMA=44]="COMMA",e[e.DOLLAR=36]="DOLLAR",e[e.DOT=46]="DOT",e[e.DOUBLEQUOTE=34]="DOUBLEQUOTE",e[e.EQUALS=61]="EQUALS",e[e.EXCLAMATION=33]="EXCLAMATION",e[e.GREATERTHAN=62]="GREATERTHAN",e[e.HASH=35]="HASH",e[e.LESSTHAN=60]="LESSTHAN",e[e.MINUS=45]="MINUS",e[e.OPENBRACE=123]="OPENBRACE",e[e.OPENBRACKET=91]="OPENBRACKET",e[e.OPENPAREN=40]="OPENPAREN",e[e.PERCENT=37]="PERCENT",e[e.PLUS=43]="PLUS",e[e.QUESTION=63]="QUESTION",e[e.SEMICOLON=59]="SEMICOLON",e[e.SINGLEQUOTE=39]="SINGLEQUOTE",e[e.SLASH=47]="SLASH",e[e.TILDE=126]="TILDE",e[e.BACKSPACE=8]="BACKSPACE",e[e.FORMFEED=12]="FORMFEED",e[e.BYTEORDERMARK=65279]="BYTEORDERMARK",e[e.TAB=9]="TAB",e[e.VERTICALTAB=11]="VERTICALTAB"}(r.CharCode||(r.CharCode={})),r.isLineBreak=function(e){switch(e){case 10:case 13:case 8232:case 8233:return!0;default:return!1}},r.isWhiteSpace=function(e){switch(e){case 32:case 9:case 11:case 12:case 160:case 133:case 5760:case 8239:case 8287:case 12288:case 65279:return!0;default:return e>=8192&&e<=8203}},r.isDecimalDigit=function(e){return e>=48&&e<=57},r.isOctalDigit=function(e){return e>=48&&e<=55},r.isIdentifierStart=function(e){return e>=97&&e<=122||e>=65&&e<=90||95==e||36==e||e>127&&!((r=e)<0||r>65535)&&a(r,n);var r},r.isKeywordCharacter=function(e){return e>=97&&e<=122},r.isIdentifierPart=function(e){return e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57||95==e||36==e||e>127&&!((r=e)<0||r>65535)&&a(r,i);var r};var n=[170,170,181,181,186,186,192,214,216,246,248,705,710,721,736,740,748,748,750,750,880,884,886,887,890,893,902,902,904,906,908,908,910,929,931,1013,1015,1153,1162,1319,1329,1366,1369,1369,1377,1415,1488,1514,1520,1522,1568,1610,1646,1647,1649,1747,1749,1749,1765,1766,1774,1775,1786,1788,1791,1791,1808,1808,1810,1839,1869,1957,1969,1969,1994,2026,2036,2037,2042,2042,2048,2069,2074,2074,2084,2084,2088,2088,2112,2136,2208,2208,2210,2220,2308,2361,2365,2365,2384,2384,2392,2401,2417,2423,2425,2431,2437,2444,2447,2448,2451,2472,2474,2480,2482,2482,2486,2489,2493,2493,2510,2510,2524,2525,2527,2529,2544,2545,2565,2570,2575,2576,2579,2600,2602,2608,2610,2611,2613,2614,2616,2617,2649,2652,2654,2654,2674,2676,2693,2701,2703,2705,2707,2728,2730,2736,2738,2739,2741,2745,2749,2749,2768,2768,2784,2785,2821,2828,2831,2832,2835,2856,2858,2864,2866,2867,2869,2873,2877,2877,2908,2909,2911,2913,2929,2929,2947,2947,2949,2954,2958,2960,2962,2965,2969,2970,2972,2972,2974,2975,2979,2980,2984,2986,2990,3001,3024,3024,3077,3084,3086,3088,3090,3112,3114,3123,3125,3129,3133,3133,3160,3161,3168,3169,3205,3212,3214,3216,3218,3240,3242,3251,3253,3257,3261,3261,3294,3294,3296,3297,3313,3314,3333,3340,3342,3344,3346,3386,3389,3389,3406,3406,3424,3425,3450,3455,3461,3478,3482,3505,3507,3515,3517,3517,3520,3526,3585,3632,3634,3635,3648,3654,3713,3714,3716,3716,3719,3720,3722,3722,3725,3725,3732,3735,3737,3743,3745,3747,3749,3749,3751,3751,3754,3755,3757,3760,3762,3763,3773,3773,3776,3780,3782,3782,3804,3807,3840,3840,3904,3911,3913,3948,3976,3980,4096,4138,4159,4159,4176,4181,4186,4189,4193,4193,4197,4198,4206,4208,4213,4225,4238,4238,4256,4293,4295,4295,4301,4301,4304,4346,4348,4680,4682,4685,4688,4694,4696,4696,4698,4701,4704,4744,4746,4749,4752,4784,4786,4789,4792,4798,4800,4800,4802,4805,4808,4822,4824,4880,4882,4885,4888,4954,4992,5007,5024,5108,5121,5740,5743,5759,5761,5786,5792,5866,5870,5872,5888,5900,5902,5905,5920,5937,5952,5969,5984,5996,5998,6e3,6016,6067,6103,6103,6108,6108,6176,6263,6272,6312,6314,6314,6320,6389,6400,6428,6480,6509,6512,6516,6528,6571,6593,6599,6656,6678,6688,6740,6823,6823,6917,6963,6981,6987,7043,7072,7086,7087,7098,7141,7168,7203,7245,7247,7258,7293,7401,7404,7406,7409,7413,7414,7424,7615,7680,7957,7960,7965,7968,8005,8008,8013,8016,8023,8025,8025,8027,8027,8029,8029,8031,8061,8064,8116,8118,8124,8126,8126,8130,8132,8134,8140,8144,8147,8150,8155,8160,8172,8178,8180,8182,8188,8305,8305,8319,8319,8336,8348,8450,8450,8455,8455,8458,8467,8469,8469,8473,8477,8484,8484,8486,8486,8488,8488,8490,8493,8495,8505,8508,8511,8517,8521,8526,8526,8544,8584,11264,11310,11312,11358,11360,11492,11499,11502,11506,11507,11520,11557,11559,11559,11565,11565,11568,11623,11631,11631,11648,11670,11680,11686,11688,11694,11696,11702,11704,11710,11712,11718,11720,11726,11728,11734,11736,11742,11823,11823,12293,12295,12321,12329,12337,12341,12344,12348,12353,12438,12445,12447,12449,12538,12540,12543,12549,12589,12593,12686,12704,12730,12784,12799,13312,19893,19968,40908,40960,42124,42192,42237,42240,42508,42512,42527,42538,42539,42560,42606,42623,42647,42656,42735,42775,42783,42786,42888,42891,42894,42896,42899,42912,42922,43e3,43009,43011,43013,43015,43018,43020,43042,43072,43123,43138,43187,43250,43255,43259,43259,43274,43301,43312,43334,43360,43388,43396,43442,43471,43471,43520,43560,43584,43586,43588,43595,43616,43638,43642,43642,43648,43695,43697,43697,43701,43702,43705,43709,43712,43712,43714,43714,43739,43741,43744,43754,43762,43764,43777,43782,43785,43790,43793,43798,43808,43814,43816,43822,43968,44002,44032,55203,55216,55238,55243,55291,63744,64109,64112,64217,64256,64262,64275,64279,64285,64285,64287,64296,64298,64310,64312,64316,64318,64318,64320,64321,64323,64324,64326,64433,64467,64829,64848,64911,64914,64967,65008,65019,65136,65140,65142,65276,65313,65338,65345,65370,65382,65470,65474,65479,65482,65487,65490,65495,65498,65500],i=[170,170,181,181,186,186,192,214,216,246,248,705,710,721,736,740,748,748,750,750,768,884,886,887,890,893,902,902,904,906,908,908,910,929,931,1013,1015,1153,1155,1159,1162,1319,1329,1366,1369,1369,1377,1415,1425,1469,1471,1471,1473,1474,1476,1477,1479,1479,1488,1514,1520,1522,1552,1562,1568,1641,1646,1747,1749,1756,1759,1768,1770,1788,1791,1791,1808,1866,1869,1969,1984,2037,2042,2042,2048,2093,2112,2139,2208,2208,2210,2220,2276,2302,2304,2403,2406,2415,2417,2423,2425,2431,2433,2435,2437,2444,2447,2448,2451,2472,2474,2480,2482,2482,2486,2489,2492,2500,2503,2504,2507,2510,2519,2519,2524,2525,2527,2531,2534,2545,2561,2563,2565,2570,2575,2576,2579,2600,2602,2608,2610,2611,2613,2614,2616,2617,2620,2620,2622,2626,2631,2632,2635,2637,2641,2641,2649,2652,2654,2654,2662,2677,2689,2691,2693,2701,2703,2705,2707,2728,2730,2736,2738,2739,2741,2745,2748,2757,2759,2761,2763,2765,2768,2768,2784,2787,2790,2799,2817,2819,2821,2828,2831,2832,2835,2856,2858,2864,2866,2867,2869,2873,2876,2884,2887,2888,2891,2893,2902,2903,2908,2909,2911,2915,2918,2927,2929,2929,2946,2947,2949,2954,2958,2960,2962,2965,2969,2970,2972,2972,2974,2975,2979,2980,2984,2986,2990,3001,3006,3010,3014,3016,3018,3021,3024,3024,3031,3031,3046,3055,3073,3075,3077,3084,3086,3088,3090,3112,3114,3123,3125,3129,3133,3140,3142,3144,3146,3149,3157,3158,3160,3161,3168,3171,3174,3183,3202,3203,3205,3212,3214,3216,3218,3240,3242,3251,3253,3257,3260,3268,3270,3272,3274,3277,3285,3286,3294,3294,3296,3299,3302,3311,3313,3314,3330,3331,3333,3340,3342,3344,3346,3386,3389,3396,3398,3400,3402,3406,3415,3415,3424,3427,3430,3439,3450,3455,3458,3459,3461,3478,3482,3505,3507,3515,3517,3517,3520,3526,3530,3530,3535,3540,3542,3542,3544,3551,3570,3571,3585,3642,3648,3662,3664,3673,3713,3714,3716,3716,3719,3720,3722,3722,3725,3725,3732,3735,3737,3743,3745,3747,3749,3749,3751,3751,3754,3755,3757,3769,3771,3773,3776,3780,3782,3782,3784,3789,3792,3801,3804,3807,3840,3840,3864,3865,3872,3881,3893,3893,3895,3895,3897,3897,3902,3911,3913,3948,3953,3972,3974,3991,3993,4028,4038,4038,4096,4169,4176,4253,4256,4293,4295,4295,4301,4301,4304,4346,4348,4680,4682,4685,4688,4694,4696,4696,4698,4701,4704,4744,4746,4749,4752,4784,4786,4789,4792,4798,4800,4800,4802,4805,4808,4822,4824,4880,4882,4885,4888,4954,4957,4959,4992,5007,5024,5108,5121,5740,5743,5759,5761,5786,5792,5866,5870,5872,5888,5900,5902,5908,5920,5940,5952,5971,5984,5996,5998,6e3,6002,6003,6016,6099,6103,6103,6108,6109,6112,6121,6155,6157,6160,6169,6176,6263,6272,6314,6320,6389,6400,6428,6432,6443,6448,6459,6470,6509,6512,6516,6528,6571,6576,6601,6608,6617,6656,6683,6688,6750,6752,6780,6783,6793,6800,6809,6823,6823,6912,6987,6992,7001,7019,7027,7040,7155,7168,7223,7232,7241,7245,7293,7376,7378,7380,7414,7424,7654,7676,7957,7960,7965,7968,8005,8008,8013,8016,8023,8025,8025,8027,8027,8029,8029,8031,8061,8064,8116,8118,8124,8126,8126,8130,8132,8134,8140,8144,8147,8150,8155,8160,8172,8178,8180,8182,8188,8204,8205,8255,8256,8276,8276,8305,8305,8319,8319,8336,8348,8400,8412,8417,8417,8421,8432,8450,8450,8455,8455,8458,8467,8469,8469,8473,8477,8484,8484,8486,8486,8488,8488,8490,8493,8495,8505,8508,8511,8517,8521,8526,8526,8544,8584,11264,11310,11312,11358,11360,11492,11499,11507,11520,11557,11559,11559,11565,11565,11568,11623,11631,11631,11647,11670,11680,11686,11688,11694,11696,11702,11704,11710,11712,11718,11720,11726,11728,11734,11736,11742,11744,11775,11823,11823,12293,12295,12321,12335,12337,12341,12344,12348,12353,12438,12441,12442,12445,12447,12449,12538,12540,12543,12549,12589,12593,12686,12704,12730,12784,12799,13312,19893,19968,40908,40960,42124,42192,42237,42240,42508,42512,42539,42560,42607,42612,42621,42623,42647,42655,42737,42775,42783,42786,42888,42891,42894,42896,42899,42912,42922,43e3,43047,43072,43123,43136,43204,43216,43225,43232,43255,43259,43259,43264,43309,43312,43347,43360,43388,43392,43456,43471,43481,43520,43574,43584,43597,43600,43609,43616,43638,43642,43643,43648,43714,43739,43741,43744,43759,43762,43766,43777,43782,43785,43790,43793,43798,43808,43814,43816,43822,43968,44010,44012,44013,44016,44025,44032,55203,55216,55238,55243,55291,63744,64109,64112,64217,64256,64262,64275,64279,64285,64296,64298,64310,64312,64316,64318,64318,64320,64321,64323,64324,64326,64433,64467,64829,64848,64911,64914,64967,65008,65019,65024,65039,65056,65062,65075,65076,65101,65103,65136,65140,65142,65276,65296,65305,65313,65338,65343,65343,65345,65370,65382,65470,65474,65479,65482,65487,65490,65495,65498,65500];function a(e,r){if(e<r[0])return!1;for(var t,n,i=0,a=r.length;i+1<a;){if(t=i+(a-i>>1),(n=r[t-=1&t])<=e&&e<=r[t+1])return!0;e<n?a=t:i=t+2}return!1}},function(e,r,t){"use strict";var n=this&&this.__values||function(e){var r="function"==typeof Symbol&&e[Symbol.iterator],t=0;return r?r.call(e):{next:function(){return e&&t>=e.length&&(e=void 0),{value:e&&e[t++],done:!e}}}},i=this&&this.__read||function(e,r){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var n,i,a=t.call(e),s=[];try{for(;(void 0===r||r-- >0)&&!(n=a.next()).done;)s.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(t=a.return)&&t.call(a)}finally{if(i)throw i.error}}return s};Object.defineProperty(r,"__esModule",{value:!0}),r.makeArray=function(e){if(void 0===e&&(e=null),e){for(var r=new Array(e.length),t=0,n=e.length;t<n;++t)unchecked(r[t]=e[t]);return r}return new Array},r.makeSet=function(e){var r,t;if(void 0===e&&(e=null),e){var i=new Set;try{for(var a=n(e),s=a.next();!s.done;s=a.next()){var o=s.value;i.add(o)}}catch(e){r={error:e}}finally{try{s&&!s.done&&(t=a.return)&&t.call(a)}finally{if(r)throw r.error}}return i}return new Set},r.makeMap=function(e,r){var t,a,s,o,c,l;void 0===e&&(e=null),void 0===r&&(r=null);var p=new Map;if(e){try{for(var u=n(e),_=u.next();!_.done;_=u.next()){var h=i(_.value,2),d=h[0],y=h[1];p.set(d,y)}}catch(e){t={error:e}}finally{try{_&&!_.done&&(a=u.return)&&a.call(u)}finally{if(t)throw t.error}}if(r)try{for(var m=n(r),T=m.next();!T.done;T=m.next()){var f=i(T.value,2);d=f[0],y=f[1],p.set(d,y)}}catch(e){s={error:e}}finally{try{T&&!T.done&&(o=m.return)&&o.call(m)}finally{if(s)throw s.error}}}else if(r)try{for(var E=n(r),g=E.next();!g.done;g=E.next()){var v=i(g.value,2);d=v[0],y=v[1],p.set(d,y)}}catch(e){c={error:e}}finally{try{g&&!g.done&&(l=E.return)&&l.call(E)}finally{if(c)throw c.error}}return p}},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=t(0),i=47;function a(e){for(var r,t=0,n=e.length;t+1<n&&46==e.charCodeAt(t)&&e.charCodeAt(t+1)==i;)t+=2;for((t>0||n<e.length)&&(e=e.substring(t,n),n-=t,t=0);t+1<n;){if(r=!1,e.charCodeAt(t)==i&&46==e.charCodeAt(t+1)){if((r=t+2==n)||t+2<n&&e.charCodeAt(t+2)==i){e=r?e.substring(0,t):e.substring(0,t)+e.substring(t+2),n-=2;continue}if((r=t+3==n)&&46==e.charCodeAt(t+2)||t+3<n&&46==e.charCodeAt(t+2)&&e.charCodeAt(t+3)==i){for(var a=t;--a>=0;)if(e.charCodeAt(a)==i){t-a==3&&46==e.charCodeAt(a+1)&&46==e.charCodeAt(a+2)||(e=r?e.substring(0,a):e.substring(0,a)+e.substring(t+3),n-=t+3-a,t=a-1);break}if(a<0&&t>0&&(2!=t||46!=e.charCodeAt(0)||46!=e.charCodeAt(1))){n=(e=e.substring(t+4)).length;continue}}}t++}return n>0?e:"."}function s(e){var r=e.length;if(r<=1){if(0==r)return".";if(e.charCodeAt(0)==i)return e}for(;--r>0;)if(e.charCodeAt(r)==i)return e.substring(0,r);return"."}r.normalizePath=a,r.resolvePath=function(e,r){return e.startsWith("std/")?e:a(s(r)+n.PATH_DELIMITER+e)},r.dirname=s},function(e,r,t){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=" ",i=" ",a=" ";r.indent=function(e,r){for(;r>=4;)e.push(a),r-=4;r>=2&&(e.push(i),r-=2),r&&e.push(n)}},function(e,r,t){"use strict";function n(e,r){return e[r]|e[r+1]<<8|e[r+2]<<16|e[r+3]<<24}function i(e,r,t){r[t]=e,r[t+1]=e>>>8,r[t+2]=e>>>16,r[t+3]=e>>>24}function a(e,r){var t=n(e,r),i=n(e,r+4);return i64_new(t,i)}Object.defineProperty(r,"__esModule",{value:!0}),r.readI8=function(e,r){return e[r]},r.writeI8=function(e,r,t){r[t]=e},r.readI16=function(e,r){return e[r]|e[r+1]<<8},r.writeI16=function(e,r,t){r[t]=e,r[t+1]=e>>>8},r.readI32=n,r.writeI32=i,r.readI64=a,r.writeI64=function(e,r,t){i(i64_low(e),r,t),i(i64_high(e),r,t+4)},r.readF32=function(e,r){return i32_as_f32(n(e,r))},r.writeF32=function(e,r,t){i(f32_as_i32(e),r,t)},r.readF64=function(e,r){return i64_as_f64(a(e,r))},r.writeF64=function(e,r,t){var n=f64_as_i64(e);i(i64_low(n),r,t),i(i64_high(n),r,t+4)}},function(e,r,t){"use strict";function n(e){for(var t in e)r.hasOwnProperty(t)||(r[t]=e[t])}Object.defineProperty(r,"__esModule",{value:!0});var i=t(10),a=t(13),s=t(14),o=t(2);r.formatDiagnostic=o.formatDiagnosticMessage;var c=t(15);r.parseFile=function(e,r,t,n){return void 0===t&&(t=!1),void 0===n&&(n=null),n||(n=new c.Parser),n.parseFile(e,r,t),n},r.nextFile=function(e){return e.nextFile()},r.nextDiagnostic=function(e){var r=e.program;return r.diagnosticsOffset<r.diagnostics.length?r.diagnostics[r.diagnosticsOffset++]:null},r.isInfo=function(e){return e.category==o.DiagnosticCategory.INFO},r.isWarning=function(e){return e.category==o.DiagnosticCategory.WARNING},r.isError=function(e){return e.category==o.DiagnosticCategory.ERROR},r.createOptions=function(){return new i.Options},r.setTarget=function(e,r){e.target=r},r.setNoAssert=function(e,r){e.noAssert=r},r.setImportMemory=function(e,r){e.importMemory=r},r.setSharedMemory=function(e,r){e.sharedMemory=r},r.setImportTable=function(e,r){e.importTable=r},r.setSourceMap=function(e,r){e.sourceMap=r},r.setMemoryBase=function(e,r){e.memoryBase=r},r.setGlobalAlias=function(e,r,t){var n=e.globalAliases;n||(e.globalAliases=n=new Map),n.set(r,t)},r.FEATURE_SIGN_EXTENSION=1,r.FEATURE_MUTABLE_GLOBAL=2,r.FEATURE_BULK_MEMORY=4,r.FEATURE_SIMD=8,r.FEATURE_THREADS=16,r.enableFeature=function(e,r){e.features|=r},r.setOptimizeLevelHints=function(e,r,t){e.optimizeLevelHint=r,e.shrinkLevelHint=t},r.finishParsing=function(e){return e.finish()},r.compileProgram=function(e,r){return void 0===r&&(r=null),new i.Compiler(e,r).compile()},r.decompileModule=function(e){var r=new a.Decompiler;return r.decompile(e),r.finish()},r.buildIDL=function(e){return s.IDLBuilder.build(e)},r.buildTSD=function(e){return s.TSDBuilder.build(e)};var l=t(0);r.LIBRARY_PREFIX=l.LIBRARY_PREFIX,n(t(5)),n(t(0)),n(t(10)),n(t(13)),n(t(14)),n(t(11)),n(t(2)),n(t(12)),n(t(4)),n(t(15)),n(t(3)),n(t(9)),n(t(7)),n(t(6)),n(t(1))}])});
|
||
//# sourceMappingURL=assemblyscript.js.map
|