code-playpad 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ import{t as e}from"./worker-runtime-Kjkt5ChF.js";var t='"use strict";(()=>{function Yr(i,t){let e=[0];for(let n=0;n<t.length;n++){let s=t.charCodeAt(n);s===13?(t.charCodeAt(n+1)===10&&n++,e.push(n+1)):s===10&&e.push(n+1)}return{name:i,text:t,lineStarts:e}}function Zn(i,t){let e=i.lineStarts,n=0,s=e.length-1;for(;n<s;){let r=n+s+1>>1;e[r]<=t?n=r:s=r-1}return{line:n+1,column:t-e[n]+1}}function Qr(i,t){let e=i.lineStarts[t-1];if(e===void 0)return"";let n=i.lineStarts[t],s=n===void 0?i.text.length:n;for(;s>e&&(i.text.charCodeAt(s-1)===10||i.text.charCodeAt(s-1)===13);)s--;return i.text.slice(e,s)}var v={syntax:"syntax",unsupported:"unsupported",limit:"limit",cantResolve:"cant-resolve",incompatibleTypes:"incompatible-types",badOperands:"bad-operands",alreadyDefined:"already-defined",uninitialized:"var-might-not-have-been-initialized",unreported:"unreported-exception",notEffectivelyFinal:"not-effectively-final",unreachable:"unreachable",missingReturn:"missing-return",finalAssign:"final-assign",notStatement:"not-a-statement",numberTooLarge:"int-number-too-large",noMain:"no-main",unchecked:"unchecked",deprecation:"deprecation"},ts=class{items=[];error(t,e,n,s,r,a){let{line:o,column:c}=Zn(t,e),u={code:s,phase:n,severity:"error",file:t.name,line:o,column:c,message:r,offset:e};return a&&a.length&&(u.details=a),this.items.push(u),u}warning(t,e,n,s,r){let a=this.error(t,e,"type",n,s,r);return a.severity="warning",a}launchError(t,e,n){let s={code:e,phase:"launch",severity:"error",file:t,line:0,column:0,message:n};return this.items.push(s),s}get hasErrors(){return this.items.some(t=>t.severity==="error")}};function Zr(i,t){let e=i.filter(o=>o.phase!=="launch"),n=i.filter(o=>o.phase==="launch"),s=[];for(let o of e){s.push(`${o.file}:${o.line}: ${o.severity}: ${o.message}`);let c=t.get(o.file);if(c&&o.line>0){let u=Qr(c,o.line);s.push(u);let m="";for(let h=0;h<o.column-1;h++)m+=u[h]===" "?" ":" ";s.push(m+"^")}for(let u of o.details??[])s.push(u)}let r=e.filter(o=>o.severity==="error").length,a=e.filter(o=>o.severity==="warning").length;r&&s.push(r===1?"1 error":`${r} errors`),a&&s.push(a===1?"1 warning":`${a} warnings`),r&&s.push("error: compilation failed");for(let o of n)s.push(`error: ${o.message}`);return s.join(`\n`)+`\n`}function Ga(i){return i>=48&&i<=57?i-48:i>=65&&i<=70?i-55:i>=97&&i<=102?i-87:-1}function ti(i){if(i.indexOf("\\\\u")===-1){let a=new Int32Array(i.length+1);for(let o=0;o<=i.length;o++)a[o]=o;return{text:i,offsets:a,errors:[]}}let t=[],e=[],n=[],s=0,r=0;for(;r<i.length;){let a=i.charCodeAt(r);if(a===92&&s%2===0&&i.charCodeAt(r+1)===117){let o=r+1;for(;i.charCodeAt(o)===117;)o++;let c=0,u=-1;for(let m=0;m<4;m++){let h=Ga(i.charCodeAt(o+m));if(h<0){u=o+m;break}c=c*16+h}if(u>=0){n.push({offset:u,message:"illegal unicode escape"}),t.push("\\\\"),e.push(r),s=1,r++;continue}t.push(String.fromCharCode(c)),e.push(r),s=0,r=o+4;continue}s=a===92?s+1:0,t.push(i[r]),e.push(r),r++}return e.push(i.length),{text:t.join(""),offsets:Int32Array.from(e),errors:n}}var za=new Set(["abstract","assert","boolean","break","byte","case","catch","char","class","const","continue","default","do","double","else","enum","extends","final","finally","float","for","goto","if","implements","import","instanceof","int","interface","long","native","new","package","private","protected","public","return","short","static","strictfp","super","switch","synchronized","this","throw","throws","transient","try","void","volatile","while","_","true","false","null"]),Ka=[">>>=","<<=",">>=",">>>","...","->","::","++","--","&&","||","==","!=","<=",">=","+=","-=","*=","/=","&=","|=","^=","%=","<<",">>","(",")","{","}","[","]",";",",",".","@","=",">","<","!","~","?",":","+","-","*","/","&","|","^","%"];function ni(i){return i>=65&&i<=90||i>=97&&i<=122||i===95||i===36}function ei(i){return ni(i)||i>=48&&i<=57}function ie(i){return i>=48&&i<=57}function qa(i){let t=i.charCodeAt(0);return t>=32&&t<127?`\'${i}\'`:`\'\\\\u${t.toString(16).padStart(4,"0")}\'`}function si(i){let t=ti(i),e=t.text,n=t.offsets,s=[],r=t.errors.map(k=>({offset:k.offset,code:"syntax",message:k.message}));if(r.length)return{tokens:[{kind:"eof",text:"",start:i.length,end:i.length}],errors:r};let a=(k,x,w="syntax")=>{r.push({offset:n[k],code:w,message:x})},o=(k,x,w,I)=>{s.push({kind:k,text:e.slice(x,w),start:n[x],end:n[w],...I})},c=e.length;c>0&&e.charCodeAt(c-1)===26&&c--;let u=0;for(;u<c;){let k=e.charCodeAt(u);if(k===32||k===9||k===12||k===10||k===13){u++;continue}if(k===47&&e.charCodeAt(u+1)===47){for(;u<c&&e.charCodeAt(u)!==10&&e.charCodeAt(u)!==13;)u++;continue}if(k===47&&e.charCodeAt(u+1)===42){let w=e.indexOf("*/",u+2);if(w===-1||w+2>c){a(u,"unclosed comment"),u=c;break}u=w+2;continue}if(ni(k)){let w=u;for(;u<c&&ei(e.charCodeAt(u));)u++;if(u<c&&e.charCodeAt(u)>127&&/[\\p{L}\\p{Nl}\\p{Mn}\\p{Mc}\\p{Nd}\\p{Pc}\\p{Sc}]/u.test(e[u]))for(a(u,"identifiers containing non-ASCII characters are not supported in this version","unsupported");u<c&&(ei(e.charCodeAt(u))||e.charCodeAt(u)>127);)u++;let I=e.slice(w,u);o(za.has(I)?"keyword":"identifier",w,u);continue}if(ie(k)||k===46&&ie(e.charCodeAt(u+1))){u=m(u);continue}if(k===39){u=d(u);continue}if(k===34){e.startsWith(\'"""\',u)?u=C(u):u=p(u);continue}let x=Ka.find(w=>e.startsWith(w,u));if(x){o("operator",u,u+x.length),u+=x.length;continue}k>127&&/[\\p{L}\\p{Nl}\\p{Sc}\\p{Pc}]/u.test(e[u])?a(u,"identifiers containing non-ASCII characters are not supported in this version","unsupported"):a(u,`illegal character: ${qa(e[u])}`),u++}return s.push({kind:"eof",text:"",start:n[c],end:n[c]}),{tokens:s,errors:r};function m(k){let x=J=>J<c?e.charCodeAt(J):-1,w=J=>x(J)|32,I=J=>ie(J)||(J|32)>=97&&(J|32)<=102,L=(J,F)=>{let K=J;for(;K<c&&(F(x(K))||x(K)===95);)K++;return K>J&&x(K-1)===95?(a(K-1,"illegal underscore"),null):K},$=(J,F,K)=>{let dt=e.slice(K,J).replace(/_/g,""),Z=BigInt((F===16?"0x":F===8?"0o":F===2?"0b":"")+(dt||"0"));return(x(J)|32)===108?(o("long-literal",k,J+1,{integer:{value:Z,radix:F}}),J+1):(o("int-literal",k,J,{integer:{value:Z,radix:F}}),J)},O=(J,F)=>{if(w(J)!==F)return J;let K=J+1;return(x(K)===43||x(K)===45)&&K++,ie(x(K))?L(K,ie):(a(k,"malformed floating-point literal"),null)},R=J=>{let F=w(J);return F===102?(o("float-literal",k,J+1),J+1):F===100?(o("double-literal",k,J+1),J+1):(o("double-literal",k,J),J)};if(x(k)===48&&w(k+1)===120){let J=k+2;if(x(J)===95)return a(J,"illegal underscore"),J+1;let F=L(J,I);if(F===null)return c;let K=F>J;if(x(F)===46||w(F)===112){if(x(F)===46){let Wt=L(F+1,I);if(Wt===null)return c;if(!K&&Wt===F+1)return a(k,"hexadecimal numbers must contain at least one hexadecimal digit"),Wt;F=Wt}if(w(F)!==112)return a(k,"malformed floating-point literal"),F;let dt=O(F,112);return dt===null?c:R(dt)}return K?$(F,16,J):(a(k,"hexadecimal numbers must contain at least one hexadecimal digit"),F)}if(x(k)===48&&w(k+1)===98){let J=k+2;if(x(J)===95)return a(J,"illegal underscore"),J+1;let F=L(J,ie);return F===null?c:F===J?(a(k,"binary numbers must contain at least one binary digit"),F):/[2-9]/.test(e.slice(J,F))?(a(k,"illegal digit in a binary literal"),F):$(F,2,J)}let N=k;if(ie(x(k))&&(N=L(k,ie),N===null))return c;if(x(N)===46&&(N>k||ie(x(N+1)))||w(N)===101||w(N)===102||w(N)===100)return x(N)===46&&(N=ie(x(N+1))?L(N+1,ie):N+1,N===null)?c:(N=O(N,101),N===null?c:R(N));if(x(k)===48&&N>k+1){for(let J=k+1;J<N;J++)if(x(J)===56||x(J)===57)return a(J,"illegal digit in an octal literal"),N;return $(N,8,k+1)}return $(N,10,k)}function h(k){let x=e[k+1];switch(x){case"b":return["\\b",k+2];case"s":return[" ",k+2];case"t":return[" ",k+2];case"n":return[`\n`,k+2];case"f":return["\\f",k+2];case"r":return["\\r",k+2];case\'"\':return[\'"\',k+2];case"\'":return["\'",k+2];case"\\\\":return["\\\\",k+2]}if(x!==void 0&&x>="0"&&x<="7"){let w=x<="3"?3:2,I=k+1,L="";for(;L.length<w&&I<c&&e[I]>="0"&&e[I]<="7";)L+=e[I++];return[String.fromCharCode(parseInt(L,8)),I]}return null}function d(k){let x=k+1,w="";for(;x<c;){let I=e.charCodeAt(x);if(I===39)break;if(I===10||I===13)return a(k,"unclosed character literal"),x;if(I===92){let L=h(x);if(!L)return a(x+1,"illegal escape character"),S(x);w+=L[0],x=L[1];continue}w+=e[x],x++}return x>=c?(a(k,"unclosed character literal"),x):w.length===0?(a(k,"empty character literal"),x+1):w.length>1?(a(k,"unclosed character literal"),x+1):(o("char-literal",k,x+1,{stringValue:w}),x+1)}function p(k){let x=k+1,w="";for(;x<c;){let I=e.charCodeAt(x);if(I===34)return o("string-literal",k,x+1,{stringValue:w}),x+1;if(I===10||I===13)break;if(I===92){let L=h(x);if(!L)return a(x+1,"illegal escape character"),S(x);w+=L[0],x=L[1];continue}w+=e[x],x++}return a(k,"unclosed string literal"),x}function C(k){let x=k+3;for(;x<c&&(e[x]===" "||e[x]===" "||e[x]==="\\f");)x++;if(x<c&&e[x]!==`\n`&&e[x]!=="\\r")return a(x,"illegal text block open delimiter sequence, missing line terminator"),x;if(x>=c)return a(k,"unclosed text block"),c;x+=e[x]==="\\r"&&e[x+1]===`\n`?2:1;let w=x;for(;x<c;){if(e.charCodeAt(x)===92){let L=e[x+1];if(L===`\n`||L==="\\r"){x+=L==="\\r"&&e[x+2]===`\n`?3:2;continue}let $=h(x);if(!$){a(x+1,"illegal escape character"),x+=2;continue}x=$[1];continue}if(e.startsWith(\'"""\',x))return o("text-block",k,x+3,{stringValue:Wa(e.slice(w,x))}),x+3;x++}return a(k,"unclosed text block"),c}function S(k){for(;k<c&&e.charCodeAt(k)!==10&&e.charCodeAt(k)!==13;)k++;return k}}var Vs=/[\\t\\x0b\\f\\x1c-\\x20\\u1680\\u2000-\\u2006\\u2008-\\u200a\\u2028\\u2029\\u205f\\u3000]/;function Wa(i){let t=i.replace(/\\r\\n?/g,`\n`).split(`\n`),e=a=>[...a].every(o=>Vs.test(o)),n=a=>{let o=0;for(;o<a.length&&Vs.test(a[o]);)o++;return o},s=1/0;t.forEach((a,o)=>{(!e(a)||o===t.length-1)&&(s=Math.min(s,n(a)))});let r=t.map(a=>{if(e(a))return"";let o=a.length;for(;o>0&&Vs.test(a[o-1]);)o--;return a.slice(s,o)});return Xa(r.join(`\n`))}function Xa(i){if(!i.includes("\\\\"))return i;let t="";for(let e=0;e<i.length;e++){let n=i[e];if(n!=="\\\\"){t+=n;continue}let s=i[++e];switch(s){case`\n`:continue;case"b":t+="\\b";continue;case"s":t+=" ";continue;case"t":t+=" ";continue;case"n":t+=`\n`;continue;case"f":t+="\\f";continue;case"r":t+="\\r";continue}if(s>="0"&&s<="7"){let r=s<="3"?3:2,a="";for(;a.length<r&&e<i.length&&i[e]>="0"&&i[e]<="7";)a+=i[e++];e--,t+=String.fromCharCode(parseInt(a,8));continue}t+=s}return t}var tn=Number.MAX_SAFE_INTEGER,Gs=9223372036854775807n,zs=-9223372036854775808n,ri=9223372036854776e3;function vt(i){let t=BigInt.asIntN(64,i);return t>=-9007199254740991n&&t<=9007199254740991n?Number(t):t}var It=i=>typeof i=="bigint"?i:BigInt(i),en=i=>i===0?0:i;function ii(i,t){if(typeof i=="number"&&typeof t=="number"){let e=i+t;if(e<=tn&&e>=-tn)return e}return vt(It(i)+It(t))}function ai(i,t){if(typeof i=="number"&&typeof t=="number"){let e=i-t;if(e<=tn&&e>=-tn)return e}return vt(It(i)-It(t))}function oi(i,t){if(typeof i=="number"&&typeof t=="number"){let e=i*t;if(e<=tn&&e>=-tn)return en(e)}return vt(It(i)*It(t))}function li(i,t){return typeof i=="number"&&typeof t=="number"?en(Math.trunc(i/t)):vt(It(i)/It(t))}function ci(i,t){return typeof i=="number"&&typeof t=="number"?en(i%t):vt(It(i)%It(t))}function Ks(i){return typeof i=="number"?en(-i):vt(-i)}function ui(i,t){return vt(It(i)<<BigInt(t&63))}function hi(i,t){return vt(It(i)>>BigInt(t&63))}function di(i,t){return vt(BigInt.asUintN(64,It(i))>>BigInt(t&63))}function fi(i,t){return vt(It(i)&It(t))}function mi(i,t){return vt(It(i)|It(t))}function pi(i,t){return vt(It(i)^It(t))}function ss(i){return typeof i=="number"?i|0:Number(BigInt.asIntN(32,i))}function rs(i){return Number(i)}function nn(i){if(typeof i=="number")return Math.fround(i);let t=i<0n,e=t?-i:i,n=e.toString(2).length;if(n>26){let s=BigInt(n-26),r=(e&(1n<<s)-1n)!==0n?1n:0n;e=e>>s<<1n|r;let a=Math.fround(Number(e)*2**(n-27));return t?-a:a}return Math.fround(Number(i))}function wn(i){if(Number.isNaN(i))return 0;if(i>=ri)return Gs;if(i<=-ri)return zs;let t=Math.trunc(i);return Number.isSafeInteger(t)?en(t):BigInt(t)}function kn(i){return Number.isNaN(i)?0:i>=2147483647?2147483647:i<=-2147483648?-2147483648:en(Math.trunc(i))}function yi(i){return Number.isNaN(i)?0:kn(Math.abs(i)>=8388608?i:Math.floor(i+.5))}function gi(i){return wn(Math.round(i))}function Ya(i,t,e,n){if(n){if(t=t.replace(/0+$/,"")||"0",e>=0){let s=t.slice(0,e+1).padEnd(e+1,"0"),r=t.slice(e+1)||"0";return`${i}${s}.${r}`}return`${i}0.${"0".repeat(-e-1)}${t}`}return`${i}${t[0]}.${t.slice(1).replace(/0+$/,"")||"0"}E${e}`}var es=new DataView(new ArrayBuffer(4));function bi(i){return es.setFloat32(0,i),es.getInt32(0)}function is(i){return Number.isNaN(i)?2143289344:bi(i)}function Ti(i){return es.setInt32(0,i),es.getFloat32(0)}var ns=i=>10n**BigInt(i);function Ne(i){if(Number.isNaN(i))return"NaN";if(i===1/0)return"Infinity";if(i===-1/0)return"-Infinity";if(i===0)return Object.is(i,-0)?"-0.0":"0.0";let t=bi(i),e=t>>>23&255,n=t&8388607,s=BigInt(e===0?n:n|8388608),r=e===0?-149:e-150,a=Math.max(0,2-r),o=($,O)=>O>=0?$<<BigInt(O):$>>BigInt(-O),c=o(s,r+a),u=o(2n*s+1n,r-1+a),m=n===0&&e>1?o(4n*s-1n,r-2+a):o(2n*s-1n,r-1+a),h=(s&1n)===0n,d=1n<<BigInt(a),p=$=>$<0?{A:ns(-$),B:d}:{A:1n,B:ns($)*d},C=$=>{let{A:O,B:R}=p($),N=m*O,B=u*O,J=(N+R-1n)/R;!h&&J*R===N&&J++;let F=B/R;return!h&&F*R===B&&F--,{dLo:J,dHi:F,A:O,B:R}},S=$=>{let{dLo:O,dHi:R,A:N,B}=C($);if(O>R)return null;let J=c*N,F=J/B,K=2n*J,dt=(2n*F+1n)*B;return(K>dt||K===dt&&(F&1n)===1n)&&F++,F<O&&(F=O),F>R&&(F=R),F},k=Math.floor(Math.log10(Math.abs(i)))+2,x=S(k);for(;x===null;)x=S(--k);x<10n&&(k--,x=S(k));let w=x.toString(),I=k+w.length-1,L=Math.abs(i);return Ya(i<0?"-":"",w,I,L>=.001&&L<1e7)}function Qa(i,t,e){let n=o=>e?-o:o;if(i===0n)return n(0);let s=i.toString().length;if(s+t<-46)return n(0);if(s+t-1>39)return n(1/0);let r=t>=0?i*ns(t):i,a=t>=0?1n:ns(-t);return n(Hs(r,a))}function Hs(i,t){let e=s=>s.toString(2).length,n=e(i)-e(t)-24;for(;;){n<-149&&(n=-149);let s=n>=0?i:i<<BigInt(-n),r=n>=0?t<<BigInt(n):t,a=s/r;if(a>=1n<<24n){n++;continue}if(a<1n<<23n&&n>-149){n--;continue}let o=s-a*r;return(2n*o>r||2n*o===r&&(a&1n)===1n)&&a++,a===1n<<24n&&(a=1n<<23n,n++),n>104?1/0:Number(a)*2**n}}function Si(i,t){return i===0n?0:t>=0?Hs(i<<BigInt(t),1n):Hs(i,1n<<BigInt(-t))}function xi(i){let t=i.replace(/_/g,"").replace(/[fF]$/,""),e,n;if(/^0[xX]/.test(t)){let s=/^0[xX]([0-9a-fA-F]*)(?:\\.([0-9a-fA-F]*))?[pP]([+-]?\\d+)$/.exec(t),r=s[1]??"",a=s[2]??"",o=BigInt("0x"+(r+a||"0"));n=o!==0n,e=Si(o,Number(s[3])-4*a.length)}else e=qs(t),n=/[1-9]/.test(t.replace(/[eE].*$/,""));return e===1/0?{error:"too-large"}:e===0&&n?{error:"too-small"}:{value:e}}function vi(i,t){let e=/^([+-]?)0[xX]([0-9a-fA-F]*)(?:\\.([0-9a-fA-F]*))?[pP]([+-]?\\d+)[fFdD]?$/.exec(i);if(!e||!(e[2]||e[3]))return NaN;let n=e[3]??"",s=BigInt("0x"+((e[2]??"")+n||"0")),r=Math.max(-1e5,Math.min(1e5,Number(e[4])))-4*n.length,a=t?Si(s,r):ki(s,r);return e[1]==="-"?-a:a}function qs(i){let t=/^([+-]?)(\\d*)(?:\\.(\\d*))?(?:[eE]([+-]?\\d+))?$/.exec(i);if(!t)return NaN;let e=t[2]??"",n=t[3]??"",s=BigInt((e+n).replace(/^0+(?=\\d)/,"")||"0"),r=Math.max(-1e5,Math.min(1e5,Number(t[4]??"0")))-n.length;return Qa(s,r,t[1]==="-")}function ae(i){if(Number.isNaN(i))return"NaN";if(i===1/0)return"Infinity";if(i===-1/0)return"-Infinity";if(i===0)return Object.is(i,-0)?"-0.0":"0.0";let t=i<0?"-":"",e=Math.abs(i),[n,s]=e.toExponential().split("e");n.includes(".")||([n,s]=e.toExponential(1).split("e"));let r=n.replace(".",""),a=Number(s);if(e>=.001&&e<1e7){if(r=r.replace(/0+$/,"")||"0",a>=0){let o=r.slice(0,a+1).padEnd(a+1,"0"),c=r.slice(a+1)||"0";return`${t}${o}.${c}`}return`${t}0.${"0".repeat(-a-1)}${r}`}return`${t}${r[0]}.${r.slice(1)||"0"}E${a}`}function wi(i){let t=i.replace(/_/g,"").replace(/[dD]$/,""),e,n;if(/^0[xX]/.test(t)){let s=/^0[xX]([0-9a-fA-F]*)(?:\\.([0-9a-fA-F]*))?[pP]([+-]?\\d+)$/.exec(t),r=s[1]??"",a=s[2]??"",o=BigInt("0x"+(r+a||"0"));n=o!==0n,e=ki(o,Number(s[3])-4*a.length)}else e=Number(t),n=/[1-9]/.test(t.replace(/[eE].*$/,""));return e===1/0?{error:"too-large"}:e===0&&n?{error:"too-small"}:{value:e}}function ki(i,t){if(i===0n)return 0;let e=i.toString(2).length,n=i,s=t;if(e>64){let r=BigInt(e-64),a=(n&(1n<<r)-1n)!==0n?1n:0n;n=n>>r|a,s+=e-64}return Number(n)*2**s}function Ws(i){return i.kind==="Assignment"||i.kind==="IncDec"||i.kind==="MethodCall"||i.kind==="NewObject"}var Ft=class extends Error{info;constructor(t){super(t.message),this.info=t}},Be=new Set(["int","boolean","byte","short","long","char","float","double"]),Ci=new Set(["public","protected","private","static","final","abstract","native","synchronized","transient","volatile","strictfp","default"]),Za={"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"<":7,">":7,"<=":7,">=":7,instanceof:7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10},Ei=new Set(["=","+=","-=","*=","/=","%=","&=","|=","^=","<<=",">>=",">>>="]),to={synchronized:"\'synchronized\' statements"},eo=new Set(["(","!","~","this","super","new","true","false","null","switch"]);function Ai(i,t,e){let n=new Xs(i,t,e);try{return{unit:n.compilationUnit(),error:null}}catch(s){if(s instanceof Ft)return{unit:null,error:s.info};throw s}}var Xs=class{#B;#N;#G=[];#z;#$=0;#Z=0;constructor(t,e,n){this.#B=t,this.#N=[...e],this.#z=n}#r(t=0){return this.#N[Math.min(this.#$+t,this.#N.length-1)]}#y(){return this.#N[Math.max(this.#$-1,0)]}#s(){let t=this.#r();return this.#$<this.#N.length-1&&this.#$++,t}#n(t,e=0){let n=this.#r(e);return(n.kind==="operator"||n.kind==="keyword")&&n.text===t}#v(t=0,e){let n=this.#r(t);return n.kind==="identifier"&&(e===void 0||n.text===e)}#u(t){return this.#n(t)?(this.#s(),!0):!1}#i(t){if(this.#n(t))return this.#s();throw this.#r().kind==="eof"&&t==="}"&&this.#U(),this.#o(this.#y().end,`\'${t}\' expected`)}#k(){let t=this.#r();if(t.kind==="identifier")return this.#s();throw t.kind==="keyword"&&t.text==="_"?this.#b(t.start,"the unnamed variable \'_\'",!0):(t.kind==="eof"&&this.#U(),this.#o(t.kind==="keyword"?t.start:this.#y().end,"<identifier> expected"))}#U(){throw this.#o(this.#y().end,"reached end of file while parsing")}#o(t,e){return new Ft({offset:t,code:"syntax",message:e})}#b(t,e,n=!1){return new Ft({offset:t,code:"unsupported",message:`${e} ${n?"is":"are"} not supported in this version`})}#mt(){return{i:this.#$,splits:this.#G.length}}#tt(t){for(;this.#G.length>t.splits;){let e=this.#G.pop();this.#N.splice(e.index,2,e.token)}this.#$=t.i}#R(){let t=this.#r();if(t.kind==="operator"&&t.text===">"){this.#s();return}if(t.kind==="operator"&&(t.text===">>"||t.text===">>>"||t.text===">="||t.text===">>=")){let e={...t,text:">",end:t.start+1},n={...t,text:t.text.slice(1),start:t.start+1};this.#G.push({index:this.#$,token:t}),this.#N.splice(this.#$,1,e,n),this.#s();return}throw t.kind==="eof"&&this.#U(),this.#o(t.start,"\'>\' expected")}#ot(){this.#i("<");let t=[];do{let e=this.#r();if(e.kind==="operator"&&e.text==="@")throw this.#b(e.start,"annotations");let n=this.#k(),s=[];if(this.#u("extends"))do s.push(this.#f());while(this.#u("&"));t.push({name:n.text,pos:n.start,bounds:s})}while(this.#u(","));return this.#R(),t}#W(){if(this.#i("<"),this.#u(">"))return"diamond";let t=[];do{let e=this.#r();if(e.kind==="operator"&&e.text==="@")throw this.#b(e.start,"annotations");if(this.#u("?")){let n=null,s=!1;this.#u("extends")?n=this.#f():this.#u("super")&&(s=!0,n=this.#f()),t.push({kind:"WildcardType",bound:n,isSuper:s,pos:e.start,start:e.start,end:this.#y().end})}else t.push(this.#f())}while(this.#u(","));return this.#R(),t}#yt(){if(++this.#Z>this.#z.maxNestingDepth)throw new Ft({offset:this.#r().start,code:"limit",message:`code is nested too deeply for this engine (limit ${this.#z.maxNestingDepth})`})}#a(){this.#Z--}#c(t,...e){let n=0;for(let s of e)n=Math.max(n,s.depth);if(t.depth=n+1,t.depth>this.#z.maxExpressionDepth)throw new Ft({offset:t.start,code:"limit",message:`expression is nested too deeply for this engine (limit ${this.#z.maxExpressionDepth})`});return t}compilationUnit(){let t={file:this.#B,imports:[],types:[]},e=[];if(this.#n("package"))throw this.#b(this.#r().start,"package declarations");for(;this.#n("import");)t.imports.push(this.#X());for(;this.#r().kind!=="eof";){if(this.#u(";"))continue;let n=this.#r().start;if(this.#n("import"))throw this.#gt(t,e);let s=this.#T();if(this.#n("class")||this.#n("interface")){t.types.push(this.#ht(s,n));continue}if(this.#n("enum")){t.types.push(this.#P(s,n));continue}if(this.#n("@")&&this.#n("interface",1))throw this.#b(this.#r().start,"annotation interface declarations");if(this.#v(0,"record")&&this.#v(1)&&(this.#n("(",2)||this.#n("<",2))){t.types.push(this.#D(s,n));continue}if(this.#O()){e.push(this.#t(s,n,null));continue}throw this.#gt(t,e)}if(e.length){let n=[...e,...t.types].sort((a,o)=>a.start-o.start),s=n[0],r=this.#B.replace(/^.*[\\\\/]/,"").replace(/\\.java$/,"");t.types=[{kind:"ClassDeclaration",keyword:"class",extendsTypes:[],implementsTypes:[],modifiers:{keywords:[]},name:r,namePos:s.start,keywordPos:s.start,members:n,implicit:!0,pos:s.start,start:s.start,end:n[n.length-1].end}]}return t}#X(){let t=this.#i("import"),e=this.#n("static");e&&this.#s();let n=[this.#k().text],s=t.start,r=[],a=!1,o=this.#y().start;for(;this.#n(".");){if(s=this.#s().start,r.push(s),this.#n("*")){o=this.#s().start,a=!0;break}let u=this.#k();n.push(u.text),o=u.start}let c=this.#i(";");return{names:n,onDemand:a,lastDotPos:s,dots:r,...e?{isStatic:!0}:{},pos:o,start:t.start,end:c.end}}#gt(t,e){let n=this.#N.some(s=>s.kind==="keyword"&&(s.text==="class"||s.text==="interface"||s.text==="enum"));return!t.types.length&&!e.length&&!n?new Ft({offset:0,code:"no-class",message:"no class declared in source file"}):this.#o(this.#r().start,"class, interface, annotation type, enum, record, method or field expected")}#O(){let t=this.#mt();try{if(this.#n("void"))this.#s();else if(!this.#S())return!1;return this.#v()?(this.#s(),this.#n("(")||this.#n("=")||this.#n(";")||this.#n(",")):!1}finally{this.#tt(t)}}#T(){let t={keywords:[]};for(;;){let e=this.#r();if(e.kind==="operator"&&e.text==="@"){if(this.#n("interface",1))return t;(t.annotations??=[]).push(this.#C());continue}if(e.kind==="keyword"&&Ci.has(e.text)){if(t.keywords.some(n=>n.name===e.text))throw this.#o(e.start,"repeated modifier");t.keywords.push({name:e.text,pos:e.start}),this.#s();continue}if(e.kind==="identifier"){let n=a=>this.#n("class",a)||this.#n("interface",a)||this.#v(a,"sealed")||this.#v(a,"non")||this.#n("abstract",a)||this.#r(a).kind==="keyword"&&Ci.has(this.#r(a).text),s=e.text==="sealed"&&n(1),r=e.text==="non"&&this.#n("-",1)&&this.#v(2,"sealed")&&this.#r(1).start===e.end&&this.#r(2).start===this.#r(1).end&&n(3);if(s||r){let a=s?"sealed":"non-sealed";if(t.keywords.some(o=>o.name===a))throw this.#o(e.start,"repeated modifier");t.keywords.push({name:a,pos:e.start}),this.#s(),r&&(this.#s(),this.#s());continue}}return t}}#C(){let t=this.#i("@"),e=this.#k(),n=[e.text];for(;this.#n(".")&&this.#v(1);)this.#s(),n.push(this.#s().text);let s={name:n[n.length-1],names:n,pos:t.start,namePos:e.start};if(this.#u("(")){let r=[];for(;!this.#n(")");){let a=this.#r().start,o=null;if(this.#v()&&this.#n("=",1)&&(o=this.#s().text,this.#s()),r.push({name:o,value:this.#A(),pos:a}),!this.#u(","))break}this.#i(")"),s.args=r}return s}#A(){if(this.#n("@"))throw this.#b(this.#r().start,"nested annotations");if(!this.#n("{"))return this.#m();let t=this.#s(),e=[];for(;!this.#n("}")&&(e.push(this.#A()),!!this.#u(",")););return this.#i("}"),{kind:"ElementArray",elements:e,pos:t.start}}#L(t,e){for(;!this.#n("}");)this.#r().kind==="eof"&&this.#U(),!this.#u(";")&&t.members.push(this.#te(t.name,e));t.end=this.#i("}").end}#Ht(t){if(this.#u("implements"))do t.implementsTypes.push(this.#f());while(this.#u(","))}#P(t,e){let n=this.#i("enum"),s=this.#k(),r={kind:"ClassDeclaration",keyword:"enum",extendsTypes:[],implementsTypes:[],enumConstants:[],modifiers:t,name:s.text,namePos:s.start,keywordPos:n.start,members:[],pos:s.start,start:e,end:e};if(this.#n("<"))throw this.#b(this.#r().start,"generic enums");if(this.#n("extends"))throw this.#o(this.#y().end,"\'{\' expected");for(this.#Ht(r),this.#i("{");this.#v()||this.#n("@");){if(this.#n("@"))throw this.#b(this.#r().start,"annotations");let a=this.#s(),o=this.#n("(")?this.#pt():[],c;if(this.#n("{")){let u=this.#s();c={kind:"ClassDeclaration",keyword:"class",extendsTypes:[],implementsTypes:[],modifiers:{keywords:[]},name:"",namePos:a.start,keywordPos:a.start,members:[],anonymous:!0,pos:a.start,start:u.start,end:u.start},this.#L(c)}if(r.enumConstants.push({name:a.text,args:o,...c?{body:c}:{},pos:a.start,start:a.start,end:this.#y().end}),!this.#u(","))break}if(!this.#n("}")&&!this.#u(";"))throw this.#o(this.#y().end,"\',\', \'}\', or \';\' expected");return this.#L(r),r}#D(t,e){let n=this.#s(),s=this.#k(),r=this.#n("<")?this.#ot():void 0,a={...r?{typeParams:r}:{},kind:"ClassDeclaration",keyword:"record",extendsTypes:[],implementsTypes:[],components:[],modifiers:t,name:s.text,namePos:s.start,keywordPos:n.start,members:[],pos:s.start,start:e,end:e};if(this.#i("("),!this.#n(")"))do{let o=this.#F();if(o.varargs)throw this.#b(o.pos,"variable-arity record components");a.components.push(o)}while(this.#u(","));if(this.#i(")"),this.#n("extends"))throw this.#o(this.#y().end,"\'{\' expected");return this.#Ht(a),this.#i("{"),this.#L(a,a.name),a}#ht(t,e){let n=this.#n("interface"),s=this.#s(),r=this.#k(),a={kind:"ClassDeclaration",keyword:n?"interface":"class",extendsTypes:[],implementsTypes:[],modifiers:t,name:r.text,namePos:r.start,keywordPos:s.start,members:[],pos:r.start,start:e,end:e};if(this.#n("<")&&(a.typeParams=this.#ot()),this.#u("extends"))do a.extendsTypes.push(this.#f());while(n&&this.#u(","));if(this.#n("implements")){if(n)throw this.#o(this.#r().start,"\'{\' expected");this.#s();do a.implementsTypes.push(this.#f());while(this.#u(","))}if(this.#v(0,"permits")){this.#s(),a.permits=[];do a.permits.push(this.#f());while(this.#u(","))}for(this.#i("{");!this.#n("}");)this.#r().kind==="eof"&&this.#U(),!this.#u(";")&&a.members.push(this.#te(a.name));return a.end=this.#i("}").end,a}#te(t,e){let n=this.#r().start;if(this.#n("{")||this.#n("static")&&this.#n("{",1)){let r={keywords:[]};this.#n("static")&&r.keywords.push({name:"static",pos:this.#s().start});let a=this.#et();return{kind:"Initializer",modifiers:r,isStatic:r.keywords.length>0,body:a,pos:n,start:n,end:a.end}}let s=this.#T();if(this.#n("class")||this.#n("interface"))return this.#ht(s,n);if(this.#n("enum"))return this.#P(s,n);if(this.#v(0,"record")&&this.#v(1)&&(this.#n("(",2)||this.#n("<",2)))return this.#D(s,n);if(e!==void 0&&this.#v(0,e)&&this.#n("{",1)){let r=this.#s(),a=this.#et();return{kind:"MethodDeclaration",modifiers:s,returnType:{kind:"VoidType",pos:r.start,start:r.start,end:r.start},name:r.text,namePos:r.start,params:[],body:a,closeBracePos:a.end-1,isConstructor:!0,compact:!0,pos:r.start,start:n,end:a.end}}return this.#t(s,n,t)}#t(t,e,n){if(this.#n("<")){let a=this.#ot(),o=this.#t(t,e,n);if(o.kind!=="MethodDeclaration")throw this.#o(o.pos,"<identifier> expected");return o.typeParams=a,o}if(n!==null&&this.#v()&&this.#n("(",1)){let a=this.#r();if(a.text!==n)throw this.#o(a.start,"invalid method declaration; return type required");this.#s();let o={kind:"VoidType",pos:a.start,start:a.start,end:a.start},c=this.#d(t,o,a,e);return c.isConstructor=!0,c}let s;if(this.#n("void")){let a=this.#s();s={kind:"VoidType",pos:a.start,start:a.start,end:a.end}}else s=this.#f();let r=this.#k();if(!this.#n("(")){if(s.kind!=="VoidType"&&(this.#n("=")||this.#n(";")||this.#n(",")||this.#n("[")))return this.#w(t,s,r,e);throw this.#o(this.#y().end,"\'(\' expected")}return this.#d(t,s,r,e)}#w(t,e,n,s){let r=[],a=n;for(;;){let c=0;for(;this.#n("[")&&this.#n("]",1);)this.#s(),this.#s(),c++;let u=null;if(this.#u("=")&&(u=this.#n("{")?this.#rt():this.#m()),r.push({name:a.text,extraDims:c,init:u,pos:a.start,start:a.start,end:this.#y().end}),!this.#u(","))break;a=this.#k()}let o=this.#i(";");return{kind:"FieldDeclaration",modifiers:t,type:e,declarators:r,pos:n.start,start:s,end:o.end}}#d(t,e,n,s){let r={kind:"MethodDeclaration",modifiers:t,returnType:e,name:n.text,namePos:n.start,params:[],body:null,pos:n.start,start:s,end:s};if(this.#i("("),!this.#n(")"))do{let a=r.params[r.params.length-1];if(a?.varargs)throw this.#o(a.pos,"varargs parameter must be the last parameter");r.params.push(this.#F())}while(this.#u(","));if(this.#i(")"),this.#n("["))throw this.#b(this.#r().start,"array dimensions after a parameter list");if(this.#u("throws")){r.throwsTypes=[];do r.throwsTypes.push(this.#f());while(this.#u(","))}if(this.#u(";"))return r.end=this.#y().end,r;if(!this.#n("{"))throw this.#o(this.#y().end,"\'{\' expected");return r.body=this.#et(),r.end=r.body.end,r.closeBracePos=r.body.end-1,r}#F(){let t=this.#r().start,e=this.#T(),n=this.#f(),s=!1;this.#u("...")&&(s=!0);let r=this.#k();for(;this.#n("[")&&this.#n("]",1);){let a=this.#s(),o=this.#s();n={kind:"ArrayType",element:n,pos:a.start,start:n.start,end:o.end}}if(s){let a=this.#y().end;n={kind:"ArrayType",element:n,pos:n.pos,start:n.start,end:a}}return{modifiers:e,type:n,name:r.text,varargs:s,pos:r.start,start:t,end:r.end}}#f(){let t=this.#r(),e;if(t.kind==="keyword"&&Be.has(t.text))this.#s(),e={kind:"PrimitiveType",name:t.text,pos:t.start,start:t.start,end:t.end};else if(t.kind==="identifier"){let n=[this.#s().text],s=!1,r,a,o;for(;;){if(this.#n("<")){let c=this.#r().start;r??=c;let u=this.#W();if(u==="diamond")throw this.#o(this.#y().start,"illegal start of type");a=u,s=!0}if(this.#n(".")&&this.#v(1)){o=this.#s().start,n.push(this.#s().text);continue}break}e={kind:"ClassType",names:n,hasTypeArguments:s,typeArgumentsPos:r,typeArguments:a,lastDotPos:o,pos:t.start,start:t.start,end:this.#y().end}}else if(t.kind==="eof")this.#U();else throw this.#o(t.start,"<identifier> expected");for(;this.#n("[")&&this.#n("]",1);){let n=this.#s(),s=this.#s();e={kind:"ArrayType",element:e,pos:n.start,start:e.start,end:s.end}}return e}#S(){let t=this.#mt();try{return this.#f(),!0}catch(e){if(!(e instanceof Ft))throw e;return this.#tt(t),!1}}#et(){let t=this.#i("{");this.#yt();let e=[];for(;!this.#n("}");)this.#r().kind==="eof"&&this.#U(),e.push(this.#Ot());let n=this.#i("}");return this.#a(),{kind:"Block",statements:e,pos:t.start,start:t.start,end:n.end}}#Ot(){if(this.#p())return this.#M();if(this.#n("static")&&(this.#n("class",1)||this.#n("interface",1)))throw this.#o(this.#r().start,"illegal start of expression");let t=this.#n("class")||this.#n("interface")||this.#n("enum")||(this.#n("abstract")||this.#n("final"))&&this.#n("class",1),e=this.#v(0,"record")&&this.#v(1)&&(this.#n("(",2)||this.#n("<",2));if(t||e){let n=this.#r().start,s=this.#T(),r=this.#n("enum")?this.#P(s,n):e?this.#D(s,n):this.#ht(s,n);return{kind:"LocalClass",declaration:r,pos:r.keywordPos,start:n,end:r.end}}return this.#q()?this.#Lt():this.#M()}#q(){if(this.#n("final")||this.#n("@")&&!this.#n("interface",1))return!0;let t=this.#r();if(t.kind==="keyword"&&Be.has(t.text))return!this.#n(".",1);if(t.kind!=="identifier")return!1;let e=this.#mt();try{if(!this.#S())return!1;let n=this.#r();return n.kind==="identifier"||n.kind==="keyword"&&n.text==="_"}finally{this.#tt(e)}}#Lt(){let t=this.#r().start,e=this.#T();for(let a of e.keywords)if(a.name!=="final")throw this.#o(a.pos,"illegal start of expression");let n=this.#f();n.kind==="ClassType"&&n.names.length===1&&n.names[0]==="var"&&!n.hasTypeArguments&&(n={kind:"VarType",pos:n.pos,start:n.start,end:n.end});let s=[];do{let a=this.#k(),o=0;for(;this.#n("[")&&this.#n("]",1);)this.#s(),this.#s(),o++;let c=null;this.#u("=")&&(c=this.#n("{")?this.#rt():this.#m()),s.push({name:a.text,extraDims:o,init:c,pos:a.start,start:a.start,end:this.#y().end})}while(this.#u(","));let r=this.#i(";");return{kind:"LocalVariableDeclaration",modifiers:e,type:n,declarators:s,pos:t,start:t,end:r.end}}#M(){this.#yt();try{let t=this.#r();if(t.kind==="operator"&&t.text==="{")return this.#et();if(t.kind==="operator"&&t.text===";")return this.#s(),{kind:"EmptyStatement",pos:t.start,start:t.start,end:t.end};if(t.kind==="keyword"){if((t.text==="this"||t.text==="super")&&this.#n("(",1))return this.#nt();if(t.text==="if")return this.#K();if(t.text==="while")return this.#Gt();if(t.text==="do")return this.#e();if(t.text==="switch")return this.#st();if(t.text==="for")return this.#Oe();if(t.text==="return")return this.#ee();if(t.text==="break"||t.text==="continue")return this.#Kt();if(t.text==="throw")return this.#At();if(t.text==="try")return this.#zt();if(t.text==="assert")return this.#Q();let e=to[t.text];if(e)throw this.#b(t.start,e);if(t.text==="else")throw this.#o(t.start,"\'else\' without \'if\'")}if(t.kind==="identifier"){if(this.#n(":",1))return this.#E();if(this.#p())return this.#j()}if(this.#q()){let e=this.#Lt();throw this.#o(e.declarators[0].pos,"variable declaration not allowed here")}return this.#$t()}finally{this.#a()}}#nt(){let t=this.#s(),e=this.#r().start,n=this.#pt(),s=this.#i(";");return{kind:"ConstructorCall",keyword:t.text,thisPos:t.start,args:n,pos:e,start:t.start,end:s.end}}#K(){let t=this.#i("if");this.#i("(");let e=this.#m();this.#i(")");let n=this.#M(),s=null;this.#u("else")&&(s=this.#M());let r=(s??n).end;return{kind:"IfStatement",condition:e,then:n,otherwise:s,pos:t.start,start:t.start,end:r}}#p(){if(!this.#v(0,"yield"))return!1;let t=this.#r(1);return t.kind==="eof"?!1:t.kind!=="operator"?!0:Ei.has(t.text)?!1:![".","(","[","++","--",";",":",")",","].includes(t.text)}#j(){let t=this.#s(),e=this.#m(),n=this.#i(";");return{kind:"YieldStatement",value:e,pos:t.start,start:t.start,end:n.end}}#E(){let t=this.#s();this.#i(":");let e=this.#M();return{kind:"LabeledStatement",label:t.text,body:e,pos:t.start,start:t.start,end:e.end}}#e(){let t=this.#i("do"),e=this.#M();this.#i("while"),this.#i("(");let n=this.#m();this.#i(")");let s=this.#i(";");return{kind:"DoStatement",body:e,condition:n,pos:t.start,start:t.start,end:s.end}}#st(){let t=this.#i("switch"),e=this.#r().start,n=this.#bt(),{cases:s,end:r}=this.#Tt(!1);return{kind:"SwitchStatement",selector:n,selectorPos:e,cases:s,pos:t.start,start:t.start,end:r}}#bt(){this.#i("(");let t=this.#m();return this.#i(")"),t}#Tt(t){this.#i("{"),this.#yt();let e=[];for(;!this.#n("}");){this.#r().kind==="eof"&&this.#U();let s=this.#r(),r=[],a=!1,o={};if(this.#u("default"))a=!0;else if(this.#u("case")){let u,m,h=!1;do{if(this.#n("null")&&(this.#n(",",1)||this.#n("->",1)||this.#n(":",1))){this.#s(),h=!0;continue}if(h&&this.#n("default")){this.#s(),a=!0;continue}if(this.#l()){if(u||r.length)throw this.#b(this.#r().start,"several patterns in one case label");u=this.#Nt(!0),this.#v(0,"when")&&(this.#s(),m=this.#m());continue}if(this.#v()&&(this.#n("->",1)||this.#n(",",1)||this.#n(":",1))){let d=this.#s();r.push({kind:"Name",identifier:d.text,depth:1,pos:d.start,start:d.start,end:d.end})}else r.push(this.#Mt())}while(this.#u(","));if(u&&(r.length||h))throw this.#b(u.pos,"a pattern combined with other case labels");o={...u?{pattern:u}:{},...m?{guard:m}:{},...h?{nullLabel:h}:{}}}else throw this.#o(s.start,"\'case\', \'default\', or \'}\' expected");let c={labels:r,isDefault:a,arrow:!1,statements:[],body:null,...o,pos:s.start,start:s.start,end:s.end};if(this.#u("->"))if(c.arrow=!0,this.#n("{"))c.body=this.#et();else if(this.#n("throw")){let u=this.#At();c.body={kind:"Block",statements:[u],pos:u.pos,start:u.start,end:u.end}}else{let u=this.#m();if(!t&&!Ws(u))throw this.#o(u.pos,"not a statement");this.#i(";"),c.body=u}else{if(!this.#n(":"))throw this.#o(this.#y().end,"\':\' or \'->\' expected");for(this.#s();!this.#n("case")&&!this.#n("default")&&!this.#n("}");)this.#r().kind==="eof"&&this.#U(),c.statements.push(this.#Ot())}c.end=this.#y().end,e.push(c)}let n=this.#i("}");return this.#a(),{cases:e,end:n.end}}#l(){let t=this.#mt();try{this.#u("final");let e=this.#r();return!(e.kind==="identifier"||e.kind==="keyword"&&Be.has(e.text))||!this.#S()?!1:this.#v()||this.#n("(")||this.#n("_")}finally{this.#tt(t)}}#Nt(t){let e=this.#r().start;if(!t&&this.#n("_")){let a=this.#s();return{kind:"TypePattern",type:null,name:"_",namePos:a.start,isFinal:!1,pos:a.start,start:a.start,end:a.end}}let n=this.#u("final"),s;if(!t&&this.#v(0,"var")&&(this.#v(1)||this.#n("_",1))?(this.#s(),s=null):s=this.#f(),s&&this.#n("(")){if(n)throw this.#o(e,"illegal start of expression");this.#s();let a=[];if(!this.#n(")"))do a.push(this.#Nt(!1));while(this.#u(","));let o=this.#i(")");return{kind:"RecordPattern",type:s,components:a,pos:e,start:e,end:o.end}}let r=this.#r();if(this.#n("_"))return this.#s(),{kind:"TypePattern",type:s,name:"_",namePos:r.start,isFinal:n,pos:e,start:e,end:r.end};if(!this.#v())throw this.#o(this.#y().end,"<identifier> expected");return this.#s(),{kind:"TypePattern",type:s,name:r.text,namePos:r.start,isFinal:n,pos:e,start:e,end:r.end}}#Gt(){let t=this.#i("while");this.#i("(");let e=this.#m();this.#i(")");let n=this.#M();return{kind:"WhileStatement",condition:e,body:n,pos:t.start,start:t.start,end:n.end}}#Oe(){let t=this.#i("for");if(this.#i("("),this.#ge())return this.#Le(t);let e=null;this.#q()?e=this.#Lt():(this.#n(";")||(e=this.#be()),this.#i(";"));let n=this.#n(";")?null:this.#m();this.#i(";");let s=this.#n(")")?[]:this.#be();this.#i(")");let r=this.#M();return{kind:"ForStatement",init:e,condition:n,update:s,body:r,pos:t.start,start:t.start,end:r.end}}#Le(t){let e=this.#T();for(let o of e.keywords)if(o.name!=="final")throw this.#o(o.pos,"illegal start of expression");let n=this.#f();n.kind==="ClassType"&&n.names.length===1&&n.names[0]==="var"&&!n.hasTypeArguments&&(n={kind:"VarType",pos:n.pos,start:n.start,end:n.end});let s=this.#k();this.#i(":");let r=this.#m();this.#i(")");let a=this.#M();return{kind:"ForEachStatement",modifiers:e,type:n,name:s.text,namePos:s.start,iterable:r,body:a,pos:t.start,start:t.start,end:a.end}}#ge(){let t=this.#mt();try{return this.#T(),!this.#S()||!this.#v()?!1:(this.#s(),this.#n(":"))}catch(e){if(e instanceof Ft)return!1;throw e}finally{this.#tt(t)}}#be(){let t=[];do{let e=this.#m();if(!Ws(e))throw this.#o(e.pos,"not a statement");t.push(e)}while(this.#u(","));return t}#ee(){let t=this.#i("return"),e=this.#n(";")?null:this.#m(),n=this.#i(";");return{kind:"ReturnStatement",value:e,pos:t.start,start:t.start,end:n.end}}#At(){let t=this.#i("throw"),e=this.#m(),n=this.#i(";");return{kind:"ThrowStatement",expression:e,pos:t.start,start:t.start,end:n.end}}#Q(){let t=this.#i("assert"),e=this.#m(),n=this.#u(":")?this.#m():null,s=this.#i(";");return{kind:"AssertStatement",condition:e,message:n,pos:t.start,start:t.start,end:s.end}}#zt(){let t=this.#i("try"),e=[];if(this.#u("(")){for(;!this.#n(")");){let o=this.#r().start;if(this.#v()&&(this.#n(";",1)||this.#n(")",1))){let c=this.#s();e.push({kind:"variable",expression:{kind:"Name",identifier:c.text,depth:1,pos:c.start,start:c.start,end:c.end},pos:c.start,start:o,end:c.end})}else{this.#T();let c=this.#f();c.kind==="ClassType"&&c.names.length===1&&c.names[0]==="var"&&!c.hasTypeArguments&&(c={kind:"VarType",pos:c.pos,start:c.start,end:c.end});let u=this.#k();this.#i("=");let m=this.#m();e.push({kind:"declaration",type:c,name:u.text,namePos:u.start,init:m,pos:u.start,start:o,end:m.end})}if(!this.#u(";"))break}this.#i(")")}let n=this.#et(),s=[];for(;this.#n("catch");){let o=this.#s();this.#i("(");let c=this.#T(),u=[this.#f()];for(;this.#u("|");)u.push(this.#f());let m=this.#k();this.#i(")");let h=this.#et();s.push({types:u,name:m.text,namePos:m.start,isFinal:c.keywords.some(d=>d.name==="final"),block:h,pos:o.start,start:o.start,end:h.end})}let r=this.#u("finally")?this.#et():null;if(!s.length&&!r&&!e.length)throw this.#o(t.start,"\'try\' without \'catch\', \'finally\' or resource declarations");let a=(r??s[s.length-1]?.block??n).end;return{kind:"TryStatement",resources:e,block:n,catches:s,finallyBlock:r,pos:t.start,start:t.start,end:a}}#Kt(){let t=this.#s(),e=this.#v()?this.#s().text:void 0,n=this.#i(";");return{kind:t.text==="break"?"BreakStatement":"ContinueStatement",label:e,pos:t.start,start:t.start,end:n.end}}#rt(){let t=this.#i("{");this.#yt();let e=[];for(;!this.#n("}")&&(e.push(this.#n("{")?this.#rt():this.#m()),!!this.#u(",")););let n=this.#i("}");return this.#a(),{kind:"ArrayInitializer",elements:e,pos:t.start,start:t.start,end:n.end}}#$t(){let t=this.#m();if(!Ws(t))throw this.#o(t.pos,"not a statement");let e=this.#i(";");return{kind:"ExpressionStatement",expression:t,pos:t.pos,start:t.start,end:e.end}}#m(){this.#yt();try{let t=this.#Mt(),e=this.#r();if(e.kind==="operator"&&Ei.has(e.text)){this.#s();let n=this.#m();return this.#c({kind:"Assignment",operator:e.text,target:t,value:n,depth:0,pos:e.start,start:t.start,end:n.end},t,n)}return t}finally{this.#a()}}#Mt(){let t=this.#Pt(1);if(!this.#n("?"))return t;let e=this.#s(),n=this.#m();this.#i(":");let s=this.#Mt();return this.#c({kind:"Conditional",condition:t,whenTrue:n,whenFalse:s,depth:0,pos:e.start,start:t.start,end:s.end},t,n,s)}#Pt(t){let e=this.#_();for(;;){let n=this.#r();if(n.kind!=="operator"&&!(n.kind==="keyword"&&n.text==="instanceof"))break;let s=Za[n.text];if(s===void 0||s<t)break;if(n.text==="instanceof"){e=this.#lt(e);continue}this.#s();let r=this.#Pt(s+1);e=this.#c({kind:"Binary",operator:n.text,left:e,right:r,depth:0,pos:n.start,start:e.start,end:r.end},e,r)}return e}#lt(t){let e=this.#s(),n=!1;this.#n("final")&&(this.#s(),n=!0);let s=this.#f(),r,a;if(this.#n("(")){this.#s();let c=[];if(!this.#n(")"))do c.push(this.#Nt(!1));while(this.#u(","));let u=this.#i(")");a={kind:"RecordPattern",type:s,components:c,pos:s.pos,start:s.start,end:u.end}}else if(this.#v()){let c=this.#s();r={name:c.text,pos:c.start,isFinal:n}}else if(n)throw this.#o(this.#y().end,"<identifier> expected");let o={kind:"InstanceOf",expression:t,targetType:s,...r?{binding:r}:{},...a?{recordPattern:a}:{},depth:0,pos:e.start,start:t.start,end:this.#y().end};return this.#c(o,t)}#_(){this.#yt();try{let t=this.#r();if(t.kind==="operator")switch(t.text){case"-":case"+":{this.#s();let e=this.#r(),n=t.text==="-"&&e.kind==="int-literal"&&e.integer?.radix===10&&e.integer.value===2147483648n?this.#Te(!0):t.text==="-"&&e.kind==="long-literal"&&e.integer?.radix===10&&e.integer.value===9223372036854775808n?this.#_t(!0):this.#_();return this.#c({kind:"Unary",operator:t.text,operand:n,depth:0,pos:t.start,start:t.start,end:n.end},n)}case"!":case"~":{this.#s();let e=this.#_();return this.#c({kind:"Unary",operator:t.text,operand:e,depth:0,pos:t.start,start:t.start,end:e.end},e)}case"++":case"--":{this.#s();let e=this.#_();return this.#c({kind:"IncDec",operator:t.text,prefix:!0,operand:e,depth:0,pos:t.start,start:t.start,end:e.end},e)}case"(":if(this.#Rt()){this.#s();let e=this.#f();this.#i(")");let n=this.#_();return this.#c({kind:"Cast",targetType:e,expression:n,depth:0,pos:t.start,start:t.start,end:n.end},n)}break}return this.#h(this.#Jt())}finally{this.#a()}}#Rt(){if(this.#Se())return!1;let t=this.#r(1);if(t.kind==="keyword"&&Be.has(t.text))return this.#n(")",2)||this.#n("[",2)&&this.#n("]",3);if(t.kind!=="identifier")return!1;let e=this.#mt();try{if(this.#s(),!this.#S()||!this.#u(")"))return!1;let n=this.#r();return n.kind==="identifier"||n.kind.endsWith("-literal")||n.kind==="text-block"?!0:(n.kind==="operator"||n.kind==="keyword")&&eo.has(n.text)}finally{this.#tt(e)}}#h(t){let e=t;for(;;){let n=this.#r();if(n.kind!=="operator")return e;if(n.text==="."){this.#s();let s;if(this.#n("<")){let o=this.#W();if(o==="diamond")throw this.#o(this.#r().start,"illegal start of type");if(s=o,!this.#v()||!this.#n("(",1))throw this.#o(this.#r().start,"<identifier> expected")}let r=this.#r();if(r.kind==="keyword"&&r.text==="class"){this.#s(),e=this.#c({kind:"ClassLiteral",target:e,depth:0,pos:n.start,start:e.start,end:r.end},e);continue}if(r.kind==="keyword"&&r.text==="this"&&(e.kind==="Name"||e.kind==="FieldAccess")){this.#s();let o=[];for(let c=e;;c=c.target){if(c.kind==="Name"){o.unshift(c.identifier);break}if(c.kind!=="FieldAccess")throw this.#o(r.start,"<identifier> expected");o.unshift(c.name)}e=this.#c({kind:"This",qualifier:o,depth:0,pos:e.start,start:e.start,end:r.end},e);continue}if(r.kind==="keyword"&&r.text==="super"&&(e.kind==="Name"||e.kind==="FieldAccess")&&(this.#n(".",1)||this.#n("::",1))){let o=[];for(let c=e;;){if(c.kind==="Name"){o.unshift(c.identifier);break}if(c.kind!=="FieldAccess")throw this.#o(r.start,"<identifier> expected");o.unshift(c.name),c=c.target}this.#s(),e=this.#c({kind:"Super",qualifier:o,qualifierPos:e.start,dotPos:n.start,depth:0,pos:r.start,start:e.start,end:r.end},e);continue}if(r.kind==="keyword"&&["this","super","new"].includes(r.text))throw this.#b(r.start,`\'.${r.text}\' expressions`);let a=this.#k();if(this.#n("(")){let o=this.#r().start,c=this.#pt();e=this.#c({kind:"MethodCall",target:e,name:a.text,namePos:a.start,selectPos:n.start,args:c,...s?{typeArguments:s}:{},depth:0,pos:o,start:e.start,end:this.#y().end},e,...c)}else e=this.#c({kind:"FieldAccess",target:e,name:a.text,namePos:a.start,depth:0,pos:n.start,start:e.start,end:a.end},e);continue}if(n.text==="["&&this.#n("]",1)&&this.#ne()){let s=this.#St(e);for(;this.#n("[");){this.#s();let r=this.#i("]");s={kind:"ArrayType",element:s,pos:s.pos,start:s.start,end:r.end}}return this.#se(null,s,e.start)}if(n.text==="["){this.#s();let s=this.#m(),r=this.#i("]");e=this.#c({kind:"ArrayAccess",array:e,index:s,depth:0,pos:n.start,start:e.start,end:r.end},e,s);continue}if(n.text==="::")return this.#se(e,void 0,e.start);if(n.text==="<"&&(e.kind==="Name"||e.kind==="FieldAccess")&&this.#dt())throw this.#b(n.start,"method references on a parameterized type (write a lambda)");if(n.text==="++"||n.text==="--"){this.#s(),e=this.#c({kind:"IncDec",operator:n.text,prefix:!1,operand:e,depth:0,pos:n.start,start:e.start,end:n.end},e);continue}return e}}#dt(){let t=this.#mt();try{return this.#W()!=="diamond"&&this.#n("::")}catch(e){if(!(e instanceof Ft))throw e;return!1}finally{this.#tt(t)}}#ne(){let t=0;for(;this.#n("[",t)&&this.#n("]",t+1);)t+=2;return t>0&&this.#n("::",t)}#St(t){let e=[],n=t;for(;n.kind==="FieldAccess";)e.unshift(n.name),n=n.target;if(n.kind!=="Name")throw this.#o(t.pos,"<identifier> expected");return e.unshift(n.identifier),{kind:"ClassType",names:e,hasTypeArguments:!1,pos:t.pos,start:t.start,end:t.end}}#se(t,e,n){let s=this.#i("::"),r=this.#r();if(r.kind==="operator"&&r.text==="<")throw this.#b(r.start,"explicit type arguments in method references");if(!(r.kind==="identifier"||r.kind==="keyword"&&r.text==="new"))throw this.#o(r.start,"<identifier> expected");if(this.#s(),e&&r.text!=="new")throw this.#o(r.start,"<identifier> expected");return{kind:"MethodRef",target:t,...e?{arrayType:e}:{},name:r.text,namePos:r.start,depth:(t?.depth??0)+1,pos:s.start,start:n,end:r.end}}#pt(){this.#i("(");let t=[];if(!this.#n(")"))do t.push(this.#m());while(this.#u(","));return this.#i(")"),t}#Te(t){let e=this.#s(),{value:n,radix:s}=e.integer,r;if(s===10){if(n>2147483648n||n===2147483648n&&!t)throw new Ft({offset:e.start,code:"int-number-too-large",message:"integer number too large"});r=Number(BigInt.asIntN(32,n))}else{if(n>0xffffffffn)throw new Ft({offset:e.start,code:"int-number-too-large",message:"integer number too large"});r=Number(BigInt.asIntN(32,n))}return{kind:"Literal",literalKind:"int",value:r,depth:1,pos:e.start,start:e.start,end:e.end}}#_t(t){let e=this.#s(),{value:n,radix:s}=e.integer;if(s===10?n>9223372036854775808n||n===9223372036854775808n&&!t:n>0xffffffffffffffffn)throw new Ft({offset:e.start,code:"int-number-too-large",message:"integer number too large"});return{kind:"Literal",literalKind:"long",value:BigInt.asIntN(64,n),depth:1,pos:e.start,start:e.start,end:e.end}}#Jt(){let t=this.#r(),e=(n,s)=>(this.#s(),{kind:"Literal",literalKind:n,value:s,depth:1,pos:t.start,start:t.start,end:t.end});switch(t.kind){case"int-literal":return this.#Te(!1);case"long-literal":return this.#_t(!1);case"float-literal":case"double-literal":{let n=t.kind==="float-literal",s=n?xi(t.text):wi(t.text);if("error"in s)throw new Ft({offset:t.start,code:"fp-number-out-of-range",message:s.error==="too-large"?"floating-point number too large":"floating-point number too small"});return this.#s(),{kind:"Literal",literalKind:n?"float":"double",value:s.value,depth:1,pos:t.start,start:t.start,end:t.end}}case"char-literal":return e("char",t.stringValue??"");case"string-literal":return e("string",t.stringValue??"");case"text-block":return e("string",t.stringValue??"");case"identifier":{if(this.#n("->",1))return this.#s(),this.#vt(t.start,[{name:t.text,pos:t.start,type:null}]);if(this.#s(),this.#n("(")){let n=this.#r().start,s=this.#pt();return this.#c({kind:"MethodCall",target:null,name:t.text,namePos:t.start,selectPos:t.start,args:s,depth:0,pos:n,start:t.start,end:this.#y().end},...s)}return{kind:"Name",identifier:t.text,depth:1,pos:t.start,start:t.start,end:t.end}}case"keyword":switch(t.text){case"true":case"false":return this.#s(),{kind:"Literal",literalKind:"boolean",value:t.text==="true",depth:1,pos:t.start,start:t.start,end:t.end};case"null":return this.#s(),{kind:"Literal",literalKind:"null",value:null,depth:1,pos:t.start,start:t.start,end:t.end};case"this":if(this.#n("(",1))throw this.#b(t.start,"constructor calls with \'this(...)\'");return this.#s(),{kind:"This",depth:1,pos:t.start,start:t.start,end:t.end};case"super":if(!this.#n(".",1)&&!this.#n("::",1))throw this.#b(t.start,"\'super\' other than in super.member or super(...)",!0);return this.#s(),{kind:"Super",depth:1,pos:t.start,start:t.start,end:t.end};case"new":return this.#xt();case"switch":{this.#s();let n=this.#r().start,s=this.#bt(),{cases:r,end:a}=this.#Tt(!0);return this.#c({kind:"SwitchExpression",selector:s,selectorPos:n,cases:r,depth:0,pos:t.start,start:t.start,end:a},s)}}if(Be.has(t.text)&&this.#n("[",1)&&this.#n("]",2)){this.#s();let n={kind:"PrimitiveType",name:t.text,pos:t.start,start:t.start,end:t.end};for(;this.#n("[")&&this.#n("]",1);){this.#s();let s=this.#i("]");n={kind:"ArrayType",element:n,pos:n.pos,start:n.start,end:s.end}}if(this.#n("::"))return this.#se(null,n,t.start)}if(Be.has(t.text)||t.text==="void")throw this.#b(t.start,"class literals");break;case"operator":if(t.text==="("){if(this.#Se())return this.#re();this.#s();let n=this.#m(),s=this.#i(")");return this.#c({kind:"Parenthesized",expression:n,depth:0,pos:t.start,start:t.start,end:s.end},n)}break;case"eof":this.#U()}throw this.#o(t.start,"illegal start of expression")}#xt(){let t=this.#i("new"),e=this.#r(),n;if(e.kind==="keyword"&&Be.has(e.text))this.#s(),n={kind:"PrimitiveType",name:e.text,pos:e.start,start:e.start,end:e.end};else if(e.kind==="identifier"){let a=[this.#s().text],o;for(;this.#n(".")&&this.#v(1);)o=this.#s().start,a.push(this.#s().text);let c,u=!1,m;if(this.#n("<")){m=this.#r().start;let h=this.#W();if(h==="diamond"?u=!0:c=h,!this.#n("(")&&u)throw this.#b(m,"array creation with \'<>\'",!0)}if(n={kind:"ClassType",names:a,hasTypeArguments:u||c!==void 0,typeArgumentsPos:m,typeArguments:c,diamond:u,lastDotPos:o,pos:e.start,start:e.start,end:this.#y().end},this.#n("(")){let h=this.#pt(),d;if(this.#n("{")){let p=this.#s();d={kind:"ClassDeclaration",keyword:"class",extendsTypes:[],implementsTypes:[],modifiers:{keywords:[]},name:"",namePos:p.start,keywordPos:p.start,members:[],anonymous:!0,pos:p.start,start:p.start,end:p.start},this.#yt(),this.#L(d),this.#a()}return this.#c({kind:"NewObject",classType:n,args:h,...d?{body:d}:{},depth:0,pos:t.start,start:t.start,end:this.#y().end},...h)}}else throw this.#o(e.start,"<identifier> expected");if(!this.#n("["))throw this.#o(this.#y().end,"\'(\' or \'[\' expected");if(this.#n("]",1)){let a=0;for(;this.#n("[")&&this.#n("]",1);)this.#s(),this.#s(),a++;if(!this.#n("{"))throw this.#o(this.#y().end,"array dimension missing");let o=this.#rt();return this.#c({kind:"NewArray",elementType:n,dimensions:[],extraDims:a,initializer:o,depth:0,pos:t.start,start:t.start,end:o.end})}let s=[],r=0;for(;this.#n("[");){if(this.#n("]",1)){this.#s(),this.#s(),r++;continue}if(r)throw this.#o(this.#r().start,"\']\' expected");this.#s(),s.push(this.#m()),this.#i("]")}if(this.#n("{"))throw this.#o(this.#r().start,"\';\' expected");return this.#c({kind:"NewArray",elementType:n,dimensions:s,extraDims:r,initializer:null,depth:0,pos:t.start,start:t.start,end:this.#y().end},...s)}#re(){let t=this.#i("("),e=[];if(!this.#n(")"))do{if(this.#v()&&(this.#n(",",1)||this.#n(")",1))){let o=this.#s();e.push({name:o.text,pos:o.start,type:null});continue}if(this.#n("final"))throw this.#b(this.#r().start,"\'final\' lambda parameters");if(this.#v(0,"var"))throw this.#b(this.#r().start,"\'var\' lambda parameters");let r=this.#f(),a=this.#k();e.push({name:a.text,pos:a.start,type:r})}while(this.#u(","));this.#i(")");let n=e.filter(s=>s.type).length;if(n&&n<e.length)throw new Ft({offset:t.start,code:"syntax",message:"invalid lambda parameter declaration",details:[" (cannot mix implicitly-typed and explicitly-typed parameters)"]});return this.#vt(t.start,e)}#vt(t,e){if(this.#i("->"),this.#n("{")){let s=this.#et();return{kind:"Lambda",params:e,body:s,depth:1,pos:t,start:t,end:s.end}}let n=this.#m();return this.#c({kind:"Lambda",params:e,body:n,depth:0,pos:t,start:t,end:n.end},n)}#Se(){let t=0;for(let e=0;;e++){let n=this.#r(e);if(n.kind==="eof")return!1;if(n.kind==="operator")if(n.text==="(")t++;else{if(n.text===")"&&--t===0)return this.#n("->",e+1);if(n.text===";"||n.text==="{"||n.text==="}")return!1}}}};function as(i){if(i.kind==="MethodRef")return st(i);let t=i.kind==="Lambda"?Oi(i):st(i);return t.length>=20?`${t.slice(0,10)}[...]${t.slice(-5)}`:t}function Oi(i){let t=i.params.every(n=>!n.type)?i.params.map(n=>n.name).join(","):i.params.map(n=>`${te(n.type)} ${n.name}`).join(", "),e=i.body.kind==="Block"?Li(i.body.statements):st(i.body);return`(${t})->${e}`}function te(i){switch(i.kind){case"PrimitiveType":return i.name;case"ClassType":return i.names.join(".")+(i.typeArguments?`<${i.typeArguments.map(te).join(",")}>`:i.diamond?"<>":"");case"ArrayType":return`${te(i.element)}[]`;case"WildcardType":return i.bound?`? ${i.isSuper?"super":"extends"} ${te(i.bound)}`:"?";case"VoidType":return"void";case"VarType":return"var"}}function Ii(i,t){let e={"\\b":"\\\\b"," ":"\\\\t","\\n":"\\\\n","\\f":"\\\\f","\\r":"\\\\r",\'"\':\'\\\\"\',"\'":"\\\\\'","\\\\":"\\\\\\\\"},n="";for(let s of i){let r=s.charCodeAt(0);n+=e[s]??(r<32||r>126?`\\\\u${r.toString(16).padStart(4,"0")}`:s)}return t+n+t}function st(i){switch(i.kind){case"Literal":switch(i.literalKind){case"long":return`${i.value}L`;case"double":return ae(i.value);case"float":return`${ae(parseFloat(String(i.value)))}F`;case"char":return Ii(i.value,"\'");case"string":case"text-block":return Ii(i.value,\'"\');default:return String(i.value)}case"Name":return i.identifier;case"FieldAccess":return`${st(i.target)}.${i.name}`;case"MethodCall":return`${i.target?st(i.target)+".":""}${i.name}(${i.args.map(st).join(", ")})`;case"Unary":return i.operator+st(i.operand);case"IncDec":return i.prefix?i.operator+st(i.operand):st(i.operand)+i.operator;case"Binary":return`${st(i.left)} ${i.operator} ${st(i.right)}`;case"Assignment":return`${st(i.target)} ${i.operator} ${st(i.value)}`;case"Parenthesized":return`(${st(i.expression)})`;case"ArrayAccess":return`${st(i.array)}[${st(i.index)}]`;case"NewArray":{let t=i.dimensions.map(e=>`[${st(e)}]`).join("")+"[]".repeat(i.extraDims);return i.initializer?`new ${te(i.elementType)}${"[]".repeat(Math.max(1,i.extraDims))}{${i.initializer.elements.map(e=>e.kind==="ArrayInitializer"?"{...}":st(e)).join(", ")}}`:`new ${te(i.elementType)}${t}`}case"Cast":return`(${te(i.targetType)})${st(i.expression)}`;case"This":return"this";case"NewObject":return`new ${te(i.classType)}(${i.args.map(st).join(", ")})`;case"Conditional":return`${st(i.condition)} ? ${st(i.whenTrue)} : ${st(i.whenFalse)}`;case"SwitchExpression":return`switch (${st(i.selector)}) {...}`;case"Lambda":return Oi(i);case"MethodRef":return`${i.arrayType?te(i.arrayType):i.target?st(i.target):""}::${i.name}`;case"InstanceOf":return`${st(i.expression)} instanceof ${te(i.targetType)}${i.binding?` ${i.binding.name}`:""}`;case"Super":return"super";case"ClassLiteral":return`${st(i.target)}.class`}}function Li(i){return i.length?`{ ${i.map(Ve).join(" ")} }`:"{ }"}function Ve(i){switch(i.kind){case"Block":return Li(i.statements);case"ReturnStatement":return i.value?`return ${st(i.value)};`:"return;";case"ExpressionStatement":return`${st(i.expression)};`;case"LocalVariableDeclaration":return`${te(i.type)} ${i.declarators.map(t=>t.init&&t.init.kind!=="ArrayInitializer"?`${t.name} = ${st(t.init)}`:t.name).join(", ")};`;case"IfStatement":return`if (${st(i.condition)}) ${Ve(i.then)}${i.otherwise?` else ${Ve(i.otherwise)}`:""}`;case"WhileStatement":return`while (${st(i.condition)}) ${Ve(i.body)}`;case"DoStatement":return`do ${Ve(i.body)} while (${st(i.condition)});`;case"ForStatement":return`for (...) ${Ve(i.body)}`;case"ForEachStatement":return`for (${te(i.type)} ${i.name} : ${st(i.iterable)}) ${Ve(i.body)}`;case"BreakStatement":return i.label?`break ${i.label};`:"break;";case"ContinueStatement":return i.label?`continue ${i.label};`:"continue;";case"EmptyStatement":return";";case"YieldStatement":return`yield ${st(i.value)};`;default:return"..."}}var Pt={Runnable:"java.lang",Stream:"java.util.stream",IntStream:"java.util.stream",LongStream:"java.util.stream",DoubleStream:"java.util.stream",Collectors:"java.util.stream",Collector:"java.util.stream",Optional:"java.util",OptionalInt:"java.util",OptionalLong:"java.util",OptionalDouble:"java.util",IntSummaryStatistics:"java.util",LongSummaryStatistics:"java.util",DoubleSummaryStatistics:"java.util",LongPredicate:"java.util.function",DoublePredicate:"java.util.function",LongConsumer:"java.util.function",DoubleConsumer:"java.util.function",LongSupplier:"java.util.function",DoubleSupplier:"java.util.function",LongFunction:"java.util.function",DoubleFunction:"java.util.function",IntToLongFunction:"java.util.function",IntToDoubleFunction:"java.util.function",LongToIntFunction:"java.util.function",LongToDoubleFunction:"java.util.function",DoubleToIntFunction:"java.util.function",DoubleToLongFunction:"java.util.function",Function:"java.util.function",BiFunction:"java.util.function",Supplier:"java.util.function",Consumer:"java.util.function",BiConsumer:"java.util.function",Predicate:"java.util.function",BiPredicate:"java.util.function",UnaryOperator:"java.util.function",BinaryOperator:"java.util.function",IntBinaryOperator:"java.util.function",IntUnaryOperator:"java.util.function",IntPredicate:"java.util.function",IntFunction:"java.util.function",IntConsumer:"java.util.function",IntSupplier:"java.util.function",ToIntFunction:"java.util.function",ToLongFunction:"java.util.function",ToDoubleFunction:"java.util.function",ToIntBiFunction:"java.util.function",LongBinaryOperator:"java.util.function",LongUnaryOperator:"java.util.function",DoubleBinaryOperator:"java.util.function",DoubleUnaryOperator:"java.util.function",BooleanSupplier:"java.util.function",ObjIntConsumer:"java.util.function",List:"java.util",ArrayList:"java.util",Map:"java.util",HashMap:"java.util",Set:"java.util",HashSet:"java.util",LinkedHashMap:"java.util",TreeMap:"java.util",TreeSet:"java.util",SortedMap:"java.util",NavigableMap:"java.util",SortedSet:"java.util",NavigableSet:"java.util",LinkedList:"java.util",Stack:"java.util",LinkedHashSet:"java.util",Entry:"java.util",Deque:"java.util",Queue:"java.util",ArrayDeque:"java.util",PriorityQueue:"java.util",Collection:"java.util",Iterator:"java.util",Arrays:"java.util",Comparator:"java.util",Collections:"java.util",Random:"java.util",Scanner:"java.util",Iterable:"java.lang",Comparable:"java.lang",Class:"java.lang",Objects:"java.util",StringBuilder:"java.lang",Number:"java.lang",Integer:"java.lang",Long:"java.lang",Double:"java.lang",Character:"java.lang",Boolean:"java.lang",Float:"java.lang",BigInteger:"java.math",EnumMap:"java.util",EnumSet:"java.util",BigDecimal:"java.math",RoundingMode:"java.math",MathContext:"java.math",Byte:"java.lang",Short:"java.lang",OutputStream:"java.io",Reader:"java.io",InputStreamReader:"java.io",StringReader:"java.io",BufferedReader:"java.io",Writer:"java.io",OutputStreamWriter:"java.io",BufferedWriter:"java.io",StringWriter:"java.io",PrintWriter:"java.io",StreamTokenizer:"java.io",StringTokenizer:"java.util",CharSequence:"java.lang"},jt={Entry:"Map"},sn=class extends Error{constructor(){super("the Java library chunk is needed"),this.name="NeedsLibrary"}},rn=null;function Ni(i){rn=i}function an(){return rn}function oe(i){if(i in Pt){if(!rn)throw new sn;return rn.classes.get(i)}}function le(i){if(!rn)throw new sn;return rn.classes.get(i)}var U={tag:"int"},Cn={tag:"byte"},cn={tag:"short"},Se={tag:"char"},ft={tag:"boolean"},Lt={tag:"long"},St={tag:"float"},lt={tag:"double"},Tt={tag:"void"},Zs={tag:"null"},ct={tag:"string"},G={tag:"object"},Pi={tag:"printstream"},E={tag:"error"};function Kt(i){return{tag:"array",element:i}}function X(i,t){return t?.length?{tag:"class",name:i.displayName,symbol:i,args:t}:{tag:"class",name:i.displayName,symbol:i}}function xe(i){return{tag:"typevar",name:i.name,symbol:i}}function ce(i){return X(i,i.typeParams?.map(xe))}function os(i){return i.symbol?.key??i.name}function Qs(i){return i.symbol?.bounds[0]??G}function Bt(i,t){if(!t.size)return i;switch(i.tag){case"typevar":return t.get(os(i))??i;case"array":return Kt(Bt(i.element,t));case"library":return i.args.length?mt(i.symbol,i.args.map(e=>Bt(e,t))):i;case"class":return i.args?.length?X(i.symbol,i.args.map(e=>Bt(e,t))):i;case"wildcard":return i.bound?{...i,bound:Bt(i.bound,t)}:i;default:return i}}function En(i){let t=new Map,e=i.symbol.typeParams??[];return i.args?.length===e.length&&e.forEach((n,s)=>t.set(n.key,i.args[s])),t}function An(i){return i.tag==="class"&&(i.symbol.typeParams?.length??0)>0&&!i.args?.length}function q(i){switch(i.tag){case"typevar":return i.symbol?q(Qs(i)):G;case"wildcard":return G;case"array":return Kt(q(i.element));case"library":return i.args.length?mt(i.symbol):i;case"class":return i.args?.length?X(i.symbol):i;default:return i}}function In(i){let t=i.symbol,e=[];if(t.superType?e.push(t.superType):t.superclass&&e.push(X(t.superclass)),t.interfaceTypes?e.push(...t.interfaceTypes):e.push(...t.interfaces.map(s=>X(s))),e.push(...t.libraryInterfaces),!t.typeParams?.length)return e;if(!i.args?.length)return e.map(q);let n=En(i);return e.map(s=>Bt(s,n))}function ee(i,t){if(i.tag==="typevar"&&i.symbol){for(let e of i.symbol.bounds){let n=ee(e,t);if(n)return n}return null}if(i.tag!=="class")return null;if(i.symbol===t)return i;for(let e of In(i)){let n=ee(e,t);if(n)return n}return null}function Ge(i,t=new Set){if(t.has(i.symbol))return[];t.add(i.symbol);let e=[];for(let n of In(i))n.tag==="library"?e.push(n):n.tag==="class"&&e.push(...Ge(n,t));return e}function Ce(i,t,e){if(!t.typeParams?.length)return e;let n=ee(i,t);return n?n.args?.length?Bt(e,En(n)):q(e):e}function mt(i,t=[]){return{tag:"library",symbol:i,args:t}}function At(i,t,e){switch(i.tag){case"typevar":{if(i.symbol)return i;let n=t.indexOf(i.name);return n>=0&&e[n]?e[n]:G}case"array":return Kt(At(i.element,t,e));case"library":return i.args.length?mt(i.symbol,i.args.map(n=>At(n,t,e))):i;case"wildcard":return i.bound?{...i,bound:At(i.bound,t,e)}:i;default:return i}}function Xt(i,t,e){switch(i.tag){case"typevar":{if(i.symbol)return i;let n=t.indexOf(i.name);return n>=0&&e[n]?e[n]:i}case"array":return Kt(Xt(i.element,t,e));case"library":return i.args.length?mt(i.symbol,i.args.map(n=>Xt(n,t,e))):i;case"wildcard":return i.bound?{...i,bound:Xt(i.bound,t,e)}:i;default:return i}}function tr(i){return i.symbol.supertypes.map(t=>At(t,i.symbol.typeParams,i.args))}function _t(i,t){if(i.tag!=="library")return null;if(i.symbol===t)return i;for(let e of tr(i)){let n=_t(e,t);if(n)return n}return null}function qt(i){let t={int:"Integer",long:"Long",double:"Double",char:"Character",boolean:"Boolean",float:"Float",byte:"Byte",short:"Short"}[i.tag],e=t?an()?.classes.get(t):void 0;return e?mt(e):null}function yt(i){return i.tag!=="library"||!i.symbol.box?null:{int:U,long:Lt,double:lt,char:Se,boolean:ft,float:St,byte:Cn,short:cn}[i.symbol.box]}function P(i){switch(i.tag){case"int":case"byte":case"short":case"char":case"boolean":case"long":case"float":case"double":case"void":return i.tag;case"null":return"<null>";case"string":return"String";case"object":return"Object";case"printstream":return"PrintStream";case"array":return P(i.element)+"[]";case"class":return i.args?.length?`${i.name}<${i.args.map(P).join(",")}>`:i.name;case"library":return i.args.length?`${i.symbol.name}<${i.args.map(P).join(",")}>`:i.symbol.name;case"diamond":return`${i.symbol.name}<>`;case"typevar":return i.name;case"wildcard":return i.poly&&i.bound?P(i.bound):i.bound?`? ${i.isSuper?"super":"extends"} ${P(i.bound)}`:"?";case"lambda":return i.text;case"error":return"<any>"}}function rt(i,t){if(i.tag!==t.tag)return!1;if(i.tag==="array"&&t.tag==="array")return rt(i.element,t.element);if(i.tag==="class"&&t.tag==="class"){let e=i.args??[],n=t.args??[];return i.symbol===t.symbol&&e.length===n.length&&e.every((s,r)=>rt(s,n[r]))}return i.tag==="wildcard"&&t.tag==="wildcard"?i.isSuper===t.isSuper&&(i.bound===null?t.bound===null:t.bound!==null&&rt(i.bound,t.bound)):i.tag==="library"&&t.tag==="library"?i.symbol===t.symbol&&i.args.length===t.args.length&&i.args.every((e,n)=>rt(e,t.args[n])):i.tag==="typevar"&&t.tag==="typevar"?i.symbol===t.symbol&&i.name===t.name:i.tag==="diamond"&&t.tag==="diamond"?i.symbol===t.symbol:!0}function tt(i){return i.tag==="string"||i.tag==="null"||i.tag==="object"||i.tag==="printstream"||i.tag==="array"||i.tag==="class"||i.tag==="library"||i.tag==="typevar"||i.tag==="diamond"}function Y(i){return["int","byte","short","char","boolean","long","float","double"].includes(i.tag)}function Ot(i){return["int","byte","short","char","long","float","double"].includes(i.tag)}var $i={byte:0,short:1,char:1,int:2,long:3,float:4,double:5};function no(i,t){return!Ot(i)||!Ot(t)||i.tag==="char"||t.tag==="char"&&i.tag==="short"?!1:$i[t.tag]<$i[i.tag]}function on(i,t){return i===t||i.superclass&&on(i.superclass,t)?!0:i.interfaces.some(e=>on(e,t))}function ln(i,t=new Set){if(t.has(i))return[];t.add(i);let e=[...i.libraryInterfaces];i.superclass&&e.push(...ln(i.superclass,t));for(let n of i.interfaces)e.push(...ln(n,t));return e}var On={tag:"typevar",name:"?open"};function Ys(i,t){let e=t.args??[];return!i.args?.length&&e.length?!1:(i.args??[]).every((n,s)=>{let r=e[s];if(n===On||!r)return!0;let a=n.tag==="wildcard"&&n.poly&&n.bound?n.bound:n;return a!==n&&r.tag!=="wildcard"?H(a,r):r.tag==="wildcard"?r.bound?a.tag==="wildcard"?r.isSuper?a.isSuper===!0&&a.bound!==null&&H(r.bound,a.bound):a.isSuper?r.bound.tag==="object":H(a.bound??G,r.bound):r.isSuper?H(r.bound,a):H(a,r.bound):!0:rt(a,r)})}function H(i,t){if(rt(i,t))return!0;if(i.tag==="null")return tt(t);if(t.tag==="object")return tt(i);if(i.tag==="array"&&t.tag==="array")return tt(i.element)&&tt(t.element)&&H(i.element,t.element);if(i.tag==="typevar"&&i.symbol)return i.symbol.bounds.some(s=>H(s,t));if(i.tag==="class"&&t.tag==="class"){let s=ee(i,t.symbol);return s?t.args?.length?(s.args?.length??0)>0&&Ys(s,t):!0:!1}if(i.tag==="class"&&i.symbol.isEnum&&t.tag==="library"&&t.symbol.name==="Comparable"){let s=t.args[0];return!s||rt(s,i)||s.tag==="wildcard"&&(!s.bound||(s.isSuper?H(s.bound,i):H(i,s.bound)))}if(i.tag==="class"&&t.tag==="library")return Ge(i).some(s=>{let r=_t(s,t.symbol);return r!==null&&Ys(r,t)});if((i.tag==="string"||i.tag==="library"&&(i.symbol.box!==void 0||i.symbol.name==="StringBuilder"))&&t.tag==="library"&&t.symbol.name==="Comparable"){let s=t.args[0];return!s||rt(s,i)||s.tag==="wildcard"&&(!s.bound||(s.isSuper?H(s.bound,i):H(i,s.bound)))}if(t.tag!=="library")return!1;if(t.symbol.name==="CharSequence"&&(i.tag==="string"||i.tag==="library"&&i.symbol.name==="StringBuilder"))return!0;if(i.tag==="printstream")return t.symbol.name==="OutputStream";if(i.tag==="diamond")return _t(mt(i.symbol,i.symbol.typeParams.map(()=>G)),t.symbol)!==null;let n=_t(i,t.symbol);return n?Ys(n,t):!1}function so(i){return i.box!==void 0||i.name==="StringBuilder"||i.name==="Scanner"}function Mi(i){switch(i.tag){case"class":return{interface:i.symbol.isInterface,final:i.symbol.isFinal};case"library":case"diamond":return{interface:i.symbol.isInterface,final:!i.symbol.isInterface&&so(i.symbol)};case"string":return{interface:!1,final:!0};default:return null}}function Te(i,t){if(H(t,i)||H(i,t))return!0;if(i.tag==="typevar"&&i.symbol)return Te(Qs(i),t);if(t.tag==="typevar"&&t.symbol)return Te(i,Qs(t));if(i.tag==="array"&&t.tag==="array")return tt(i.element)&&tt(t.element)?Te(i.element,t.element):rt(i.element,t.element);let e=Mi(i),n=Mi(t);return!e||!n?!1:e.interface&&n.interface?!0:e.interface?!n.final:n.interface?!e.final:!1}function He(i,t){return i.tag==="error"||t.tag==="error"?!0:t.tag==="lambda"?Ji(i,t)===null:rt(i,t)||no(i,t)?!0:tt(i)&&H(t,i)}function ve(i,t){if(He(i,t))return!0;if(Y(t)&&tt(i)){if(i.tag==="object")return!0;let n=qt(t);return n!==null&&H(n,i)}let e=yt(t);return e!==null&&Y(i)&&He(i,e)}var ro={byte:[-128,127],short:[-32768,32767],char:[0,65535]};function Yt(i,t,e){if(ve(i,t))return!0;let n=i.tag==="library"?i.symbol.box:i.tag,s=n?ro[n]:void 0;if(s&&["int","byte","short","char"].includes(t.tag)&&e&&(e.kind==="int"||e.kind==="char")){let r=e.value;return r>=s[0]&&r<=s[1]}return!1}function io(i){if(i.tag==="class"&&i.symbol.isInterface&&!i.symbol.isSealed){let n=ls(i.symbol);return n.length===1?{params:n[0].params,returnType:n[0].returnType}:null}if(i.tag!=="library"||!i.symbol.functional)return null;let t=i.symbol.methods.find(n=>n.name===i.symbol.functional&&!n.isStatic),e=i.symbol.typeParams.map((n,s)=>{let r=i.args[s];return r?r.tag==="wildcard"?r.bound??G:r:G});return{params:t.params.map(n=>At(n,i.symbol.typeParams,e)),returnType:At(t.returnType,i.symbol.typeParams,e)}}function Ri(i){switch(i.tag){case"typevar":case"wildcard":case"object":return"Object";case"string":return"String";case"library":return i.symbol.qualifiedName;case"class":return i.symbol.binaryName;case"array":return Ri(i.element)+"[]";default:return i.tag}}function ls(i){let t=new Set(["equals(Object)","hashCode()","toString()"]),e=[],n=[i];for(let s=0;s<n.length;s++){let r=n[s];for(let a of r.methods){if(a.isStatic||a.isPrivate)continue;let o=`${a.name}(${a.params.map(Ri).join(",")})`;t.has(o)||(t.add(o),a.isAbstract&&e.push(a))}n.push(...r.interfaces)}return e}function Ji(i,t){if(i.tag==="error")return null;let e=io(i);return e?t.arity<0||e.params.length===t.arity?null:"incompatible parameter types in lambda expression":`${i.tag==="array"?"Array":i.tag==="library"||i.tag==="diamond"?i.symbol.name:i.tag==="class"?i.symbol.displayName:P(i)} is not a functional interface`}function $e(i,t){return t.tag==="lambda"?Ji(i,t)??"":Ot(i)&&Ot(t)?`possible lossy conversion from ${P(t)} to ${P(i)}`:`${P(t)} cannot be converted to ${P(i)}`}function Ln(i){switch(i.kind){case"int":case"byte":case"short":case"long":return String(i.value);case"double":return ae(i.value);case"float":return Ne(i.value);case"char":return String.fromCharCode(i.value);case"boolean":return i.value?"true":"false";case"string":return i.value}}function Q(i){return{kind:"int",value:i|0}}function Nn(i){return{kind:"char",value:i&65535}}function Nt(i){return{kind:"long",value:BigInt.asIntN(64,i)}}function cs(i){return{kind:"byte",value:i<<24>>24}}function us(i){return{kind:"short",value:i<<16>>16}}function ue(i){return{kind:"float",value:Math.fround(i)}}function Qt(i){return{kind:"double",value:i}}function gt(i){return{kind:"boolean",value:i}}function er(i){return{kind:"string",value:i}}var nr=new Set(["int","byte","short","char"]);function un(i){return nr.has(i.kind)?i.value:void 0}function hn(i){if(i.kind==="long")return i.value;if(nr.has(i.kind))return BigInt(i.value)}function $n(i){if(i.kind==="double"||i.kind==="float")return i.value;if(i.kind==="long")return rs(vt(i.value));if(nr.has(i.kind))return i.value}function hs(i){if(i.kind==="long")return nn(vt(i.value));let t=$n(i);return t===void 0?void 0:Math.fround(t)}function Di(i,t){if(i.kind==="boolean"||i.kind==="string")return;let e=()=>i.kind==="double"||i.kind==="float"?kn(i.value):i.kind==="long"?ss(vt(i.value)):i.value;switch(t){case"double":return Qt($n(i));case"float":return ue(hs(i));case"long":return i.kind==="double"||i.kind==="float"?Nt(BigInt(wn(i.value))):Nt(hn(i));case"int":return Q(e());case"byte":return cs(e());case"short":return us(e());case"char":return Nn(e())}}function Mn(i){return i!==void 0&&i.kind==="boolean"&&i.value}function ds(i){return i!==void 0&&i.kind==="boolean"&&!i.value}var ne=["none","message","message-cause","cause"],Vt=["none","message"],ao=[["java.lang.Throwable",null,ne],["java.lang.Exception","java.lang.Throwable",ne],["java.lang.Error","java.lang.Throwable",ne],["java.lang.RuntimeException","java.lang.Exception",ne],["java.lang.ArithmeticException","java.lang.RuntimeException",Vt],["java.lang.ArrayStoreException","java.lang.RuntimeException",Vt],["java.lang.ClassCastException","java.lang.RuntimeException",Vt],["java.lang.IllegalArgumentException","java.lang.RuntimeException",ne],["java.lang.IllegalStateException","java.lang.RuntimeException",ne],["java.lang.IndexOutOfBoundsException","java.lang.RuntimeException",["none","message","index"],"Index out of range: "],["java.lang.ArrayIndexOutOfBoundsException","java.lang.IndexOutOfBoundsException",["none","message","index"],"Array index out of range: "],["java.lang.StringIndexOutOfBoundsException","java.lang.IndexOutOfBoundsException",["none","message","index"],"String index out of range: "],["java.lang.NegativeArraySizeException","java.lang.RuntimeException",Vt],["java.lang.NullPointerException","java.lang.RuntimeException",Vt],["java.lang.NumberFormatException","java.lang.IllegalArgumentException",Vt],["java.lang.UnsupportedOperationException","java.lang.RuntimeException",ne],["java.lang.CloneNotSupportedException","java.lang.Exception",Vt],["java.lang.InterruptedException","java.lang.Exception",Vt],["java.lang.ReflectiveOperationException","java.lang.Exception",ne],["java.lang.ClassNotFoundException","java.lang.ReflectiveOperationException",["none","message","message-cause"]],["java.lang.AssertionError","java.lang.Error",["none","object"]],["java.lang.LinkageError","java.lang.Error",["none","message","message-cause"]],["java.lang.ExceptionInInitializerError","java.lang.LinkageError",Vt],["java.lang.NoClassDefFoundError","java.lang.LinkageError",Vt],["java.lang.VirtualMachineError","java.lang.Error",ne],["java.lang.StackOverflowError","java.lang.VirtualMachineError",Vt],["java.lang.OutOfMemoryError","java.lang.VirtualMachineError",Vt],["java.util.NoSuchElementException","java.lang.RuntimeException",ne],["java.util.InputMismatchException","java.util.NoSuchElementException",Vt],["java.util.ConcurrentModificationException","java.lang.RuntimeException",ne],["java.util.EmptyStackException","java.lang.RuntimeException",["none"]],["java.util.IllegalFormatException","java.lang.IllegalArgumentException",[]],["java.util.MissingFormatArgumentException","java.util.IllegalFormatException",[]],["java.util.UnknownFormatConversionException","java.util.IllegalFormatException",[]],["java.util.IllegalFormatConversionException","java.util.IllegalFormatException",[]],["java.util.IllegalFormatPrecisionException","java.util.IllegalFormatException",[]],["java.util.IllegalFormatWidthException","java.util.IllegalFormatException",[]],["java.util.MissingFormatWidthException","java.util.IllegalFormatException",[]],["java.util.IllegalFormatCodePointException","java.util.IllegalFormatException",[]],["java.util.IllegalFormatFlagsException","java.util.IllegalFormatException",[]],["java.util.FormatFlagsConversionMismatchException","java.util.IllegalFormatException",[]],["java.util.DuplicateFormatFlagsException","java.util.IllegalFormatException",[]],["java.util.UnknownFormatFlagsException","java.util.IllegalFormatException",[]],["java.util.regex.PatternSyntaxException","java.lang.IllegalArgumentException",[]],["java.io.IOException","java.lang.Exception",ne],["java.io.FileNotFoundException","java.io.IOException",Vt],["java.io.EOFException","java.io.IOException",Vt],["java.io.UncheckedIOException","java.lang.RuntimeException",["message-cause","cause"]]],dn=ao.map(([i,t,e,n])=>({name:i,superclass:t,constructors:e,...n?{indexPrefix:n}:{}})),ut={message:0,cause:1,trace:2,suppressed:3,causeSet:4},Fi=5;function ji(i){let t=i.lastIndexOf(".");return{pkg:i.slice(0,t),simple:i.slice(t+1)}}var Pn=new Set(["Object","Integer","Long","Double","Float","Short","Byte","Character","Boolean","Number","Math","StrictMath","StringBuilder","StringBuffer","CharSequence","Iterable","Comparable","Thread","Runnable","Runtime","Process","Class","Enum","Record","Void","IO","Throwable","Exception","Error","RuntimeException","ArithmeticException","ArrayIndexOutOfBoundsException","IndexOutOfBoundsException","StringIndexOutOfBoundsException","NullPointerException","ClassCastException","IllegalArgumentException","IllegalStateException","NumberFormatException","UnsupportedOperationException","NegativeArraySizeException","StackOverflowError","OutOfMemoryError","AssertionError","InterruptedException","CloneNotSupportedException","Override","Deprecated","FunctionalInterface","SuppressWarnings","SafeVarargs","Cloneable","AutoCloseable","Appendable","Readable","ThreadLocal"]),oo=new Set(["printf","format","flush","write","append","close","checkError","writeBytes","charset"]),_i=new Set(["currentTimeMillis","nanoTime","exit","arraycopy","getProperty","getProperties","setProperty","clearProperty","lineSeparator","identityHashCode","getenv","gc","setOut","setErr","setIn","console","inheritedChannel","getLogger","load","loadLibrary","mapLibraryName","runFinalization"]),lo=new Set(["substring","indexOf","lastIndexOf","isBlank","toUpperCase","toLowerCase","trim","strip","stripLeading","stripTrailing","split","contains","startsWith","endsWith","replace","replaceAll","replaceFirst","compareToIgnoreCase","equalsIgnoreCase","concat","chars","codePoints","format","formatted","valueOf","copyValueOf","join","repeat","matches","hashCode","intern","codePointAt","codePointBefore","codePointCount","offsetByCodePoints","getBytes","getChars","lines","indent","translateEscapes","stripIndent","transform","describeConstable","resolveConstantDesc","contentEquals","regionMatches","subSequence","toString","getClass","wait","notify","notifyAll","splitWithDelimiters"]),co=new Set(["name","ordinal","compareTo","equals","hashCode","getDeclaringClass"]),uo=new Set(["clone","getClass","hashCode","equals","toString","wait","notify","notifyAll"]),fs={Integer:{MAX_VALUE:{type:U,constant:Q(2147483647)},MIN_VALUE:{type:U,constant:Q(-2147483648)},SIZE:{type:U,constant:Q(32)},BYTES:{type:U,constant:Q(4)}},Long:{MAX_VALUE:{type:Lt,constant:Nt(Gs)},MIN_VALUE:{type:Lt,constant:Nt(zs)},SIZE:{type:U,constant:Q(64)},BYTES:{type:U,constant:Q(8)}},Double:{MAX_VALUE:{type:lt,constant:Qt(Number.MAX_VALUE)},MIN_VALUE:{type:lt,constant:Qt(Number.MIN_VALUE)},MIN_NORMAL:{type:lt,constant:Qt(22250738585072014e-324)},POSITIVE_INFINITY:{type:lt,constant:Qt(1/0)},NEGATIVE_INFINITY:{type:lt,constant:Qt(-1/0)},NaN:{type:lt,constant:Qt(NaN)},SIZE:{type:U,constant:Q(64)},BYTES:{type:U,constant:Q(8)}},Float:{MAX_VALUE:{type:St,constant:ue(34028234663852886e22)},MIN_VALUE:{type:St,constant:ue(1401298464324817e-60)},MIN_NORMAL:{type:St,constant:ue(11754943508222875e-54)},POSITIVE_INFINITY:{type:St,constant:ue(1/0)},NEGATIVE_INFINITY:{type:St,constant:ue(-1/0)},NaN:{type:St,constant:ue(NaN)},MAX_EXPONENT:{type:U,constant:Q(127)},MIN_EXPONENT:{type:U,constant:Q(-126)},SIZE:{type:U,constant:Q(32)},BYTES:{type:U,constant:Q(4)}},Byte:{MAX_VALUE:{type:Cn,constant:cs(127)},MIN_VALUE:{type:Cn,constant:cs(-128)},SIZE:{type:U,constant:Q(8)},BYTES:{type:U,constant:Q(1)}},Short:{MAX_VALUE:{type:cn,constant:us(32767)},MIN_VALUE:{type:cn,constant:us(-32768)},SIZE:{type:U,constant:Q(16)},BYTES:{type:U,constant:Q(2)}},Character:{MAX_VALUE:{type:Se,constant:Nn(65535)},MIN_VALUE:{type:Se,constant:Nn(0)},MIN_RADIX:{type:U,constant:Q(2)},MAX_RADIX:{type:U,constant:Q(36)},SIZE:{type:U,constant:Q(16)},BYTES:{type:U,constant:Q(2)}},Math:{PI:{type:lt,constant:Qt(Math.PI)},E:{type:lt,constant:Qt(Math.E)}},StreamTokenizer:{TT_EOF:{type:U,constant:Q(-1)},TT_EOL:{type:U,constant:Q(10)},TT_NUMBER:{type:U,constant:Q(-2)},TT_WORD:{type:U,constant:Q(-3)}}},Rn={abs:[{params:[U],returnType:U,fn:"abs-int"},{params:[Lt],returnType:Lt,fn:"abs-long"},{params:[St],returnType:St,fn:"abs-float"},{params:[lt],returnType:lt,fn:"abs-double"}],max:[{params:[U,U],returnType:U,fn:"max-int"},{params:[Lt,Lt],returnType:Lt,fn:"max-long"},{params:[St,St],returnType:St,fn:"max-float"},{params:[lt,lt],returnType:lt,fn:"max-double"}],min:[{params:[U,U],returnType:U,fn:"min-int"},{params:[Lt,Lt],returnType:Lt,fn:"min-long"},{params:[St,St],returnType:St,fn:"min-float"},{params:[lt,lt],returnType:lt,fn:"min-double"}],sqrt:[{params:[lt],returnType:lt,fn:"sqrt"}],floor:[{params:[lt],returnType:lt,fn:"floor"}],ceil:[{params:[lt],returnType:lt,fn:"ceil"}],round:[{params:[St],returnType:U,fn:"round-float"},{params:[lt],returnType:Lt,fn:"round-double"}]},Ui=i=>i.target?.kind==="Name"&&i.target.staticOwner===!0,Jn=i=>i.tag==="int"||i.tag==="char"||i.tag==="long"||i.tag==="byte"||i.tag==="short",Bi=i=>i.tag==="char"||i.tag==="byte"||i.tag==="short"?U:i;function Un(i,t){return i.tag==="double"||t.tag==="double"?lt:i.tag==="float"||t.tag==="float"?St:i.tag==="long"||t.tag==="long"?Lt:U}var ms=new Set(["java.lang","java.util","java.io","java.math","java.net","java.nio","java.nio.file","java.nio.charset","java.text","java.time","java.time.format","java.time.temporal","java.util.function","java.util.stream","java.util.concurrent","java.util.concurrent.atomic","java.util.regex","java.lang.reflect","java.security","java.awt","javax.swing"]),Zi=new Set(["LinkedList","TreeMap","TreeSet","LinkedHashMap","LinkedHashSet","Stack","Vector","Optional","OptionalInt","StringJoiner","BitSet","Hashtable","Date","Calendar","Locale","UUID","NoSuchElementException","ConcurrentModificationException","SortedMap","SortedSet","NavigableMap","NavigableSet","ListIterator","AbstractList","AbstractMap","EnumMap","EnumSet","IdentityHashMap","WeakHashMap","Properties","Timer","Formatter","Currency","InputMismatchException","Spliterator","IntSummaryStatistics","Base64","Map.Entry","Entry","Enumeration","EventListener","Observable","SequencedCollection"]),sr={"java.util":[...Zi].filter(i=>!i.includes(".")),"java.io":["PrintStream","InputStream","File","FileReader","FileWriter","FileInputStream","FileOutputStream","DataInputStream","DataOutputStream","BufferedInputStream","BufferedOutputStream","ByteArrayInputStream","ByteArrayOutputStream","Serializable","Closeable","Flushable","Console"],"java.math":["BigInteger","BigDecimal","RoundingMode","MathContext"],"java.time":["LocalDate","LocalTime","LocalDateTime","ZonedDateTime","Instant","Duration","Period","DayOfWeek","Month","Year","YearMonth","ZoneId","Clock"],"java.time.format":["DateTimeFormatter"],"java.time.temporal":["ChronoUnit","TemporalAdjusters"],"java.text":["DecimalFormat","NumberFormat","SimpleDateFormat","MessageFormat"],"java.util.regex":["Pattern","Matcher","PatternSyntaxException"],"java.util.concurrent":["ConcurrentHashMap","CopyOnWriteArrayList","ExecutorService","Executors","TimeUnit","Future","CompletableFuture","ThreadLocalRandom","CountDownLatch","ConcurrentLinkedQueue","LinkedBlockingQueue","ArrayBlockingQueue"],"java.util.concurrent.atomic":["AtomicInteger","AtomicLong","AtomicBoolean","AtomicReference"],"java.nio.file":["Files","Path","Paths"]},Vi={private:0,package:1,protected:2,public:3},ho={Comparable:["compareTo"],Comparator:["compare"],Iterable:["iterator"],Iterator:["hasNext","next"]},fo=new Set(["Comparable","Comparator","Iterable","Iterator"]);function Hi(i){return fo.has(i.name)||i.functional!==void 0}var ps=new Set(["getClass","wait","notify","notifyAll","clone","finalize"]),Gi=[ft,Se,U,Lt,St,lt,Kt(Se),ct,G];function mo(i){return(i==="println"?[[],...Gi.map(e=>[e])]:Gi.map(e=>[e])).map(e=>({owner:"PrintStream",name:i,params:e,returnType:Tt}))}var Dn={length:{owner:"String",name:"length",params:[],returnType:U},charAt:{owner:"String",name:"charAt",params:[U],returnType:Se},equals:{owner:"String",name:"equals",params:[G],returnType:ft},isEmpty:{owner:"String",name:"isEmpty",params:[],returnType:ft},toCharArray:{owner:"String",name:"toCharArray",params:[],returnType:Kt(Se)},compareTo:{owner:"String",name:"compareTo",params:[ct],returnType:U}},Ee={toString:{owner:"Object",name:"toString",params:[],returnType:ct,objectMethod:"toString"},hashCode:{owner:"Object",name:"hashCode",params:[],returnType:U,objectMethod:"hashCode"},equals:{owner:"Object",name:"equals",params:[G],returnType:ft,objectMethod:"equals"}},rr=()=>({all:!1,vars:new Set,unassigned:new Set}),Ht=()=>({all:!0,vars:new Set,unassigned:new Set}),Pe=i=>({all:i.all,vars:new Set(i.vars),unassigned:new Set(i.unassigned)});function xt(i,...t){let e=i;for(let n of t){if(e.all){e=Pe(n);continue}if(n.all)continue;let s=new Set;for(let a of e.vars)n.vars.has(a)&&s.add(a);let r=new Set;for(let a of e.unassigned)n.unassigned.has(a)&&r.add(a);e={all:!1,vars:s,unassigned:r}}return e}function po(i,t){if(i.all||t.all)return i.all?Pe(t.all?i:t):Pe(i);let e=new Set;for(let n of i.unassigned)t.unassigned.has(n)&&e.add(n);return{all:!1,vars:new Set([...i.vars,...t.vars]),unassigned:e}}function fn(i,t){return i.all||i.vars.has(t)}function Fn(i,t){return i.all||i.unassigned.has(t)}function Ae(i,t){if(i.all)return i;let e=Pe(i);return e.vars.add(t),e.unassigned.delete(t),e}function yo(i,t){if(i.all)return i;let e=Pe(i);return e.vars.delete(t),e}function zi(i){return i.kind==="LocalVariableDeclaration"?i.declarators[0].pos:i.start}function ht(i){let t=i;for(;t.kind==="Parenthesized";)t=t.expression;return t}var Gt=(i,t)=>i.keywords.some(e=>e.name===t);function ta(i,t,e,n={}){return new or(t,e).checkUnit(i,n.launch??!0)}var or=class{#B;#N;#G=[];#z=[];#$=[];#Z=new Set;#r=new Set;#y=new Map;#s=[];#n=new Map;#v=[];#u=new Map;#i=[];#k=new Map;#U=new Map;#o=[];#b=!1;#mt=0;#tt=!1;#R=null;#ot;#W=[];#yt=new Map;#a;#c=null;#X=null;#gt=null;#O=new Map;#T=!0;#C=[];#A=0;#L=[];#Ht=!1;#P=!1;#D=null;#ht="";#te=new Map;#t=[];#w=[];#d=[];#F=new Map;#f=[];#S=new Set;#et=new WeakMap;#Ot=[];#q=new Map;#Lt=new Map;#M=[];#nt=[];#K=new Map;#p=new Map;#j=0;#E=[];constructor(t,e){this.#B=t,this.#N=e}#e(t,e,n,s){this.#N.error(this.#B,t,"type",e,n,s)}#st(t,e,n,s){let r=a=>a!==void 0&&a.has(e);for(let a=this.#a??null;a;a=a.outer)if(r(a.suppressed))return;r(this.#ot)||this.#W.some(r)||this.#N.warning(this.#B,t,e,`[${e}] ${n}`,s)}#bt(t,e){let n=this.#yt.get(t);if(n)return n;let s=new Set;this.#yt.set(t,s);let r=new Set,a={Override:["method"],FunctionalInterface:["type"],SafeVarargs:["method","constructor"],SuppressWarnings:["type","field","method","parameter","constructor","local"],Deprecated:["type","field","method","parameter","constructor","local"]};for(let o of t.annotations??[]){if(!(Object.hasOwn(a,o.name)&&(o.names.length===1?!this.#le(o.name):o.names.join(".")===`java.lang.${o.name}`))){o.names.length===1&&!this.#le(o.name)&&!Pn.has(o.name)&&!this.#u.has(o.name)?this.#e(o.namePos,v.cantResolve,"cannot find symbol",[` symbol: class ${o.name}`,` location: class ${this.#a.displayName}`]):this.#l(o.pos,`the annotation @${o.names.join(".")}`,!0);continue}if(r.has(o.name)){this.#e(o.pos,v.syntax,`${o.name} is not a repeatable annotation interface`);continue}if(r.add(o.name),!a[o.name].includes(e)){this.#e(o.pos,v.syntax,"annotation interface not applicable to this kind of declaration");continue}let u=o.args??[];if(o.name==="SuppressWarnings"){let m=u.find(h=>h.name===null||h.name==="value");if(!m||u.some(h=>h!==m)){m?this.#l(o.pos,"elements of @SuppressWarnings other than value"):this.#e(o.pos,v.syntax,"annotation @SuppressWarnings is missing a default value for the element \'value\'");continue}for(let h of m.value.kind==="ElementArray"?m.value.elements:[m.value])h.kind==="Literal"&&(h.literalKind==="string"||h.literalKind==="text-block")?s.add(h.value):h.kind==="Literal"?this.#e(h.pos,v.incompatibleTypes,`incompatible types: ${h.literalKind} cannot be converted to String`):this.#l(h.pos,"@SuppressWarnings values other than string literals")}else o.name==="Deprecated"?u.every(h=>h.name==="since"&&h.value.kind==="Literal"&&h.value.literalKind==="string"||h.name==="forRemoval"&&h.value.kind==="Literal"&&h.value.literalKind==="boolean")||this.#l(o.pos,"these elements of @Deprecated"):u.length&&this.#l(o.pos,`elements of @${o.name}`)}return s}#Tt(t,e){return t.annotations?.find(n=>n.name===e)}#l(t,e,n=!1){this.#e(t,v.unsupported,`${e} ${n?"is":"are"} not supported in this version`)}checkUnit(t,e=!0){if(!t.types.length)return this.#N.launchError(this.#B.name,v.noMain,"no class declared in source file"),null;for(let r of t.imports)this.#ge(r);if(t.types[0]?.implicit===!0)for(let r of Object.keys(sr))this.#h(r);for(let r of t.types)this.#ne(r,null);this.#Te();for(let r of this.#G)!r.typeParams||r.local||(this.#a=r,this.#b=!1,this.#an(r.typeParams,r.declaration.typeParams));let n=r=>r.anonymous===!0||r.local===!0||r.outer!==null&&n(r.outer);for(let r of this.#G)n(r)||this.#vt(r);this.#Se(this.#G.filter(r=>!n(r)));for(let r of this.#G)n(r)||this.#qt(r);this.#Ue();let s=this.#z[0];if(s?.declaration.implicit&&!this.#Gt(s))return this.#e(s.declaration.members[0].start,v.noMain,"compact source file does not have main method in the form of void main() or void main(String[] args)"),null;for(let r of this.#z)this.#$e(r),this.#N.hasErrors||this.#Cr(r);return this.#N.hasErrors||!s?null:e?this.#Nt(s):{classes:this.#G,mainClass:s,methods:this.#$,staticFields:this.#i,selectors:this.#U,main:null,mainConstructor:null}}#Nt(t){let e=this.#B.name.replace(/^.*[\\\\/]/,"").replace(/\\.java$/,""),n=this.#Gt(t)?t:this.#z.find(a=>a.name===e);if(!n)return this.#N.launchError(this.#B.name,v.noMain,`can\'t find class: ${e}`),null;let s=this.#Gt(n);if(!s)return this.#N.launchError(this.#B.name,v.noMain,`can\'t find main(String[]) or main() method in class: ${n.name}`),null;let r=null;return!s.isStatic&&(r=n.constructors.find(a=>a.params.length===0)??null,!r)?(this.#N.launchError(this.#B.name,v.noMain,`can\'t find no argument constructor in class: ${n.name}`),null):{classes:this.#G,mainClass:n,methods:this.#$,staticFields:this.#i,selectors:this.#U,main:s,mainConstructor:r}}#Gt(t){let e=t.methods.filter(n=>this.#Oe(n.declaration));return e.find(n=>n.params.length===1)??e.find(n=>n.params.length===0)??null}#Oe(t){if(t.isConstructor||t.name!=="main"||t.returnType.kind!=="VoidType"||Gt(t.modifiers,"private"))return!1;if(t.params.length===0)return!0;if(t.params.length!==1)return!1;let e=t.params[0].type;return e.kind==="ArrayType"&&this.#Le(e.element)}#Le(t){if(t.kind!=="ClassType"||t.hasTypeArguments)return!1;let e=t.names.join(".");return e==="String"||e==="java.lang.String"}#ge(t){if(t.isStatic)return this.#be(t);let e=t.names,n=t.onDemand?e.join("."):e.slice(0,-1).join("."),s=e[e.length-1],r=t.onDemand?e[e.length-1]:e[e.length-2],a=e.slice(0,t.onDemand?-1:-2).join(".");if(Pt[r]===a&&!jt[r]){for(let[o,c]of Object.entries(jt))c===r&&(t.onDemand||o===s)&&this.#Z.add(o);if(t.onDemand||jt[s]===r)return}if(!ms.has(n)){this.#e(t.lastDotPos,v.cantResolve,`package ${n} does not exist`);return}if(t.onDemand){this.#r.add(n),this.#h(n);return}if(Pt[s]===n&&!jt[s]||dn.some(o=>o.name===`${n}.${s}`)){this.#Z.add(s);return}if(n==="java.util"&&!Zi.has(s)){this.#e(t.lastDotPos,v.cantResolve,"cannot find symbol",[` symbol: class ${s}`,` location: package ${n}`]);return}this.#u.set(s,`${n}.${s}`)}#be(t){let e=t.names,n=t.onDemand?e:e.slice(0,-1),s=this.#ee(t,n);if(typeof s=="object"&&s!==null){t.onDemand?this.#v.push(s.unsupported):this.#n.set(e[e.length-1],s.unsupported);return}if(s===null){t.onDemand||this.#e(t.start,v.cantResolve,"static import only from classes and interfaces");return}if(t.onDemand){this.#s.includes(s)||this.#s.push(s);for(let[o,c]of Object.entries(jt))c===s&&this.#Z.add(o);return}let r=e[e.length-1],a=jt[r]===s;if(a&&this.#Z.add(r),this.#Q(s,r)||this.#zt(s,r)){let o=this.#y.get(r)??[];o.includes(s)||o.push(s),this.#y.set(r,o)}else if(!a){let o=this.#At(s)?.isInterface?"interface":"class";this.#e(t.start,v.cantResolve,"cannot find symbol",[` symbol: static ${r}`,` location: ${o} ${s}`])}}#ee(t,e){let n=e[e.length-1],s=e.slice(0,-1).join("."),r=t.dots[e.length-2]??t.start,a=e[e.length-2];return a&&jt[n]===a&&Pt[a]===e.slice(0,-2).join(".")||s==="java.lang"&&(n==="Math"||n==="System"||n==="String")||Pt[n]===s&&!jt[n]?n:ms.has(s)&&((s==="java.lang"?Pn.has(n):(sr[s]??[]).includes(n))||dn.some(c=>c.name===`${s}.${n}`))?{unsupported:`${s}.${n}`}:(ms.has(s)||[...ms].some(o=>o.startsWith(`${s}.`))?this.#e(r,v.cantResolve,"cannot find symbol",[` symbol: class ${n}`,` location: package ${s}`]):this.#e(r,v.cantResolve,`package ${s} does not exist`),null)}#At(t){return t==="Math"||t==="String"||t==="System"?le(t):oe(t)??null}#Q(t,e){if(t==="Math"&&Object.hasOwn(Rn,e))return!0;if(t==="System")return _i.has(e);let n=this.#At(t);return n?n.methods.some(s=>s.isStatic&&s.name===e)||t!=="String"&&n.unsupported.has(e):!1}#zt(t,e){if(t==="System")return e==="out"||e==="err"||e==="in";if(Object.hasOwn(fs,t)&&Object.hasOwn(fs[t],e))return!0;if(t==="Math"||t==="String")return!1;let n=this.#At(t)?.staticFields;return n!==void 0&&Object.hasOwn(n,e)}#Kt(t,e){let n=(this.#y.get(t)??[]).filter(s=>e.call(this,s,t));return n.length?n:this.#s.filter(s=>e.call(this,s,t))}#rt(t,e){let n=this.#n.get(t)??this.#v[0];return n?(this.#l(e,`the class ${n}`,!0),!0):!1}#$t(t){for(let e=this.#a;e;e=e.outer)if(this.#Ct(e,t).length)return!0;return Object.hasOwn(Ee,t)||ps.has(t)}#m(t,e){return{kind:"Name",identifier:t,depth:1,pos:e.pos,start:e.start,end:e.end,staticOwner:!0}}#Mt(t,e){if(this.#$t(t.name))return!0;let n=this.#Kt(t.name,this.#Q);if(n.length>1){let s=this.#Pt(t,n,e);if(!s)return!1;n=[s]}return n.length===1&&(t.target=this.#m(n[0],{pos:t.selectPos,start:t.start,end:t.start})),!0}#Pt(t,e,n){let s=e.flatMap(m=>this.#lt(m,t.name).map(h=>({owner:m,...h}))),r=s.filter(m=>this.#_(m,n,!0)),a=r.length?r:s.filter(m=>this.#_(m,n,!1));if(!a.length)return e.find(m=>this.#lt(m,t.name).some(h=>h.params.length===n.length))??e[0];let o=(m,h)=>m.params.length===h.params.length&&m.params.every((d,p)=>He(q(h.params[p]),q(d))),c=a.filter(m=>a.every(h=>m===h||o(m,h))),u=[...new Set(c.map(m=>m.owner))];if(u.length===1)return u[0];if(c.length>=2&&!c.some(m=>m.varargs)){let[m,h]=c,d=p=>`method ${t.name}(${p.params.map(P).join(",")}) in ${p.owner}`;return this.#e(t.selectPos,v.cantResolve,`reference to ${t.name} is ambiguous`,[` both ${d(m)} and ${d(h)} match`]),null}return this.#l(t.selectPos,`a call of ${t.name}(), which more than one static import could mean`,!0),null}#lt(t,e){let n=[];if(t==="Math"&&Object.hasOwn(Rn,e))for(let r of Rn[e])n.push({params:r.params,varargs:!1});let s=t==="System"?null:this.#At(t);for(let r of s?.methods??[])r.isStatic&&r.name===e&&n.push({params:r.params,varargs:r.varargs===!0});return n}#_(t,e,n=!1){let{params:s,varargs:r}=t;if(n&&r&&e.length!==s.length)return!1;let a=r?s.length-1:s.length;return(r?e.length<a:e.length!==a)?!1:e.every((o,c)=>{if(o.tag==="lambda"||o.tag==="diamond")return!0;let u=c<a||r&&e.length===s.length&&o.tag==="array"?s[c]:s[a].element;return n?He(q(u),o):ve(q(u),o)})}#Rt(t){let e=this.#Kt(t.identifier,this.#zt);return e.length?e.length>1?(this.#e(t.pos,v.cantResolve,`reference to ${t.identifier} is ambiguous`,[` both variable ${t.identifier} in ${e[1]} and variable ${t.identifier} in ${e[0]} match`]),"error"):{kind:"FieldAccess",target:this.#m(e[0],t),name:t.identifier,namePos:t.pos,depth:2,pos:t.pos,start:t.start,end:t.end}:null}#h(t){for(let e of sr[t]??[])Pt[e]||dn.some(n=>n.name===`${t}.${e}`)||this.#u.has(e)||this.#u.set(e,`${t}.${e}`)}#dt(t){let e;if(t.length===1){e=t[0];let n=Pt[e];if(!n||!(jt[e]?this.#Z.has(e):n==="java.lang"||this.#Z.has(e)||this.#r.has(n)||this.#z[0]?.declaration.implicit===!0))return null}else if(t.length>=3&&t[0]==="java"&&Pt[t[t.length-1]]===t.slice(0,-1).join(".")&&!jt[t[t.length-1]])e=t[t.length-1];else if(t.length===2&&jt[t[1]]===t[0]&&this.#dt([t[0]]))e=t[1];else if(t.length===4&&t[0]==="java"&&jt[t[3]]===t[2]&&Pt[t[2]]===`java.${t[1]}`)e=t[3];else return null;return oe(e)??null}#ne(t,e){let n=t.modifiers,s=t.keyword==="interface",r=t.keyword==="enum",a=t.keyword==="record";for(let c of n.keywords)if(c.name!=="public"&&!(c.name==="abstract"&&!r&&!a)&&!(c.name==="final"&&!s&&!r)){if(c.name==="sealed"||c.name==="non-sealed"){if(!r&&!a)continue;this.#e(c.pos,v.syntax,`\'${c.name}\' is not allowed here`);continue}e&&["private","protected","static"].includes(c.name)||(c.name==="strictfp"?this.#l(c.pos,`\'strictfp\' ${s?"interfaces":"classes"}`):this.#e(t.keywordPos,v.syntax,`modifier ${c.name} not allowed here`))}if(e){if(e.membersByName.has(t.name)){this.#e(t.keywordPos,v.alreadyDefined,`class ${t.name} is already defined in class ${e.displayName}`);return}}else if(this.#z.some(c=>c.name===t.name)){this.#e(t.keywordPos,v.alreadyDefined,`duplicate class: ${t.name}`);return}let o={kind:"class",name:t.name,binaryName:e?`${e.binaryName}$${t.name}`:t.name,displayName:e?.topLevel.declaration.implicit?`${e.displayName}.${t.name}`:t.name,declaration:t,outer:e,topLevel:null,isInner:e!==null&&t.keyword==="class"&&!e.isInterface&&!Gt(n,"static"),isPrivate:Gt(n,"private"),isInterface:s,isAbstract:s||Gt(n,"abstract"),isFinal:r&&!t.enumConstants?.some(c=>c.body)||a||Gt(n,"final"),...Gt(n,"sealed")?{isSealed:!0}:{},...Gt(n,"non-sealed")?{isNonSealed:!0}:{},isEnum:r,isRecord:a,enumConstants:[],components:[],superclass:null,interfaces:[],libraryInterfaces:[],hierarchyState:0,index:this.#G.length,fields:[],fieldsByName:new Map,methods:[],methodsByName:new Map,constructors:[],members:[],membersByName:new Map,instanceCount:0,outerField:-1};if(o.topLevel=e?e.topLevel:o,t.typeParams?.length){let c=a?"record":s?"interface":"class";o.typeParams=this.#in(t.typeParams,`${c} ${o.displayName}`,o)}t.symbol=o,this.#G.push(o),e?(e.members.push(o),e.membersByName.set(o.name,o)):this.#z.push(o);for(let c of t.members)c.kind==="ClassDeclaration"&&this.#ne(c,o);this.#St(o)}#St(t){let e=[],n=0,s=new Map,r=(a,o)=>{if(Array.isArray(a)){for(let u of a)r(u,o);return}if(a===null||typeof a!="object")return;let c=a;if(c.kind!=="ClassDeclaration"){if(c.kind==="NewObject"&&c.body){r(c.args,o);let u=c.body,m=this.#pt(t,u,++n,o);e.push(m);return}if(c.kind==="LocalClass"){let u=c.declaration,m=(s.get(u.name)??0)+1;s.set(u.name,m),e.push(this.#se(t,u,m,o));return}for(let[u,m]of Object.entries(c))u!=="symbol"&&m&&typeof m=="object"&&r(m,o)}};for(let a of t.declaration.enumConstants??[])if(r(a.args,!0),a.body){let o=this.#pt(t,a.body,++n,!0);o.enumBody=!0,e.push(o)}for(let a of t.declaration.members){if(a.kind==="ClassDeclaration")continue;let o=Gt(a.modifiers,"static")||t.isInterface&&a.kind==="FieldDeclaration";r(a,o)}e.length&&(t.anonymousClasses=e)}#se(t,e,n,s){let r=e.keyword;for(let c of e.modifiers.keywords)c.name!=="abstract"&&c.name!=="final"&&c.name!=="strictfp"&&this.#e(e.keywordPos,v.syntax,`modifier ${c.name} not allowed here`);let a=this.#pt(t,e,0,s||r!=="class"),o=`${t.binaryName}$${n}${e.name}`;return Object.assign(a,{name:e.name,binaryName:o,displayName:e.name,anonymous:!1,local:!0,isInterface:r==="interface",isEnum:r==="enum",isRecord:r==="record",isAbstract:r==="interface"||Gt(e.modifiers,"abstract"),isFinal:r==="enum"||r==="record"||Gt(e.modifiers,"final")}),e.typeParams?.length&&(a.typeParams=this.#in(e.typeParams,`${r==="record"?"record":r==="interface"?"interface":"class"} ${e.name}`,a)),a}#pt(t,e,n,s){let r=`${t.binaryName}$${n}`,a={kind:"class",name:"",binaryName:r,displayName:`<anonymous ${r}>`,declaration:e,outer:t,topLevel:t.topLevel,isInner:!s,isPrivate:!1,isInterface:!1,isAbstract:!1,isFinal:!1,isEnum:!1,isRecord:!1,enumConstants:[],components:[],superclass:null,interfaces:[],libraryInterfaces:[],hierarchyState:0,index:this.#G.length,fields:[],fieldsByName:new Map,methods:[],methodsByName:new Map,constructors:[],members:[],membersByName:new Map,instanceCount:0,outerField:-1,anonymous:!0};e.symbol=a,this.#G.push(a);for(let o of e.members)o.kind==="ClassDeclaration"&&this.#ne(o,a);return this.#St(a),a}#Te(){let t=(o,c)=>{let{pkg:u,simple:m}=ji(o),h={kind:"ClassDeclaration",keyword:c?"interface":"class",extendsTypes:[],implementsTypes:[],modifiers:{keywords:[]},name:m,namePos:0,keywordPos:0,members:[],pos:0,start:0,end:0},d={kind:"class",name:m,binaryName:o,displayName:m,declaration:h,outer:null,topLevel:null,isInner:!1,isPrivate:!1,isInterface:c,isAbstract:c,isFinal:!1,isEnum:!1,isRecord:!1,enumConstants:[],components:[],superclass:null,interfaces:[],libraryInterfaces:[],hierarchyState:2,index:this.#G.length,fields:[],fieldsByName:new Map,methods:[],methodsByName:new Map,constructors:[],members:[],membersByName:new Map,instanceCount:c?0:Fi,outerField:-1,membersEntered:!0,builtin:{pkg:u}};return d.topLevel=d,h.symbol=d,this.#G.push(d),this.#k.set(o,d),d};for(let o of dn){let c=t(o.name,!1);c.superclass=o.superclass?this.#k.get(o.superclass):null,o.indexPrefix&&(c.builtin.indexPrefix=o.indexPrefix)}let e=this.#k.get("java.lang.Throwable"),n=X(e);this.#V(e,"getMessage",[],ct,"throwable-getMessage"),this.#V(e,"getLocalizedMessage",[],ct,"throwable-getLocalizedMessage"),this.#V(e,"getCause",[],n,"throwable-getCause"),this.#V(e,"initCause",[n],n,"throwable-initCause"),this.#V(e,"toString",[],ct,"throwable-toString"),this.#V(e,"printStackTrace",[],Tt,"throwable-printStackTrace"),this.#V(e,"addSuppressed",[n],Tt,"throwable-addSuppressed",{isFinal:!0}),this.#V(e,"getSuppressed",[],Kt(n),"throwable-getSuppressed",{isFinal:!0}),this.#V(e,"fillInStackTrace",[],n,"throwable-fillInStackTrace");let s={none:[],message:[ct],"message-cause":[ct,n],cause:[n],index:[U],object:[G]};for(let o of dn){let c=this.#k.get(o.name);for(let u of o.constructors){let m=this.#V(c,c.name,s[u],Tt,"throwable-constructor",{isConstructor:!0});m.throwableConstructor=u}}let r=t("java.lang.AutoCloseable",!0),a=this.#V(r,"close",[],Tt,void 0,{throws:[X(this.#k.get("java.lang.Exception"))]});a.isAbstract=!0,delete a.builtin}#_t(t){if(t.length>1)return this.#k.get(t.join("."))??null;for(let e of this.#k.values()){if(e.name!==t[0])continue;let n=e.builtin.pkg;return n==="java.lang"||this.#Z.has(e.name)||this.#r.has(n)||this.#z[0]?.declaration.implicit===!0?e:null}return null}#Jt(){return X(this.#k.get("java.lang.Throwable"))}#xt(t){return t.tag==="null"||H(t,this.#Jt())}#re(t){return t.tag==="class"&&this.#xt(t)&&!H(t,X(this.#k.get("java.lang.RuntimeException")))&&!H(t,X(this.#k.get("java.lang.Error")))}#vt(t){if(t.hierarchyState!==0)return;t.hierarchyState=1;let e=this.#a;this.#a=t,this.#b=!1,this.#o=[];let n=t.declaration,s=t.isInterface?[]:n.extendsTypes.slice(0,1);for(let a of s){let o=this.#xe(a);if(!o||o.tag==="object")continue;if(o.tag==="string"){this.#e(a.pos,v.syntax,"cannot inherit from final String");continue}if(o.tag==="library"){o.symbol.isInterface?this.#e(a.pos,v.syntax,"no interface expected here"):this.#l(a.pos,`extending the library class ${o.symbol.name}`,!0);continue}if(o.tag!=="class")continue;let c=o.symbol;if(c.isInterface){this.#e(a.pos,v.syntax,"no interface expected here");continue}if(c.hierarchyState===1||c===t){this.#e(this.#ie(t).declaration.keywordPos,v.syntax,`cyclic inheritance involving ${this.#ie(t).displayName}`);continue}if(this.#vt(c),c.isFinal){this.#e(a.pos,v.syntax,`cannot inherit from final ${c.displayName}`);continue}if(c.isInner){this.#l(a.pos,"extending an inner (non-static) class",!0);continue}t.superclass=c,t.superType=o}let r=t.isInterface?n.extendsTypes:n.implementsTypes;for(let a of r){let o=this.#xe(a);if(!o)continue;if(o.tag==="library"){o.symbol.isInterface?Hi(o.symbol)?t.libraryInterfaces.push(o):this.#l(a.pos,`implementing the library interface ${o.symbol.name}`,!0):this.#e(a.pos,v.syntax,"interface expected here");continue}if(o.tag!=="class"||!o.symbol.isInterface){o.tag!=="error"&&this.#e(a.pos,v.syntax,"interface expected here");continue}let c=o.symbol;if(c.hierarchyState===1||c===t){this.#e(this.#ie(t).declaration.keywordPos,v.syntax,`cyclic inheritance involving ${this.#ie(t).displayName}`);continue}this.#vt(c),t.interfaces.includes(c)||(t.interfaces.push(c),(t.interfaceTypes??=[]).push(o))}this.#a=e,t.hierarchyState=2}#Se(t){let e=r=>r.binaryName.replace(/\\$/g,"."),n=r=>r.isInterface?"interface":"class",s=r=>[...r.superclass?[r.superclass]:[],...r.interfaces];for(let r of t){let a=r.declaration;if(r.isSealed&&r.isFinal&&!r.isEnum&&!r.isRecord){this.#e(a.keywordPos,v.syntax,"illegal combination of modifiers: final and sealed");continue}if(r.isSealed&&r.isNonSealed){this.#e(a.keywordPos,v.syntax,"illegal combination of modifiers: sealed and non-sealed");continue}if(r.isNonSealed&&!r.isFinal&&!s(r).some(c=>c.isSealed)&&this.#e(a.keywordPos,v.syntax,"non-sealed modifier not allowed here",[` (${n(r)} ${e(r)} does not have any sealed supertypes)`]),!r.isSealed)continue;let o=a.permits;if(o){let c=[];this.#a=r.outer??r;for(let u of o){let m=this.#J(u);if(m.tag!=="class")continue;let h=m.symbol;if(c.includes(h)){this.#e(u.pos,v.syntax,"invalid permits clause",[` (must not contain duplicates: ${P(m)})`]);continue}c.push(h),s(h).includes(r)||this.#e(u.pos,v.syntax,"invalid permits clause",[` (${n(h)} ${P(m)} must extend sealed ${n(r)})`])}r.permitted=c}else r.permitted=t.filter(c=>s(c).includes(r)),r.permitted.length||this.#e(a.keywordPos,v.syntax,"sealed class must have subclasses")}for(let r of t){let a=s(r).filter(c=>c.isSealed);if(!a.length)continue;let o=a.find(c=>c.declaration.permits&&!(c.permitted??[]).includes(r));if(o){this.#e(r.declaration.keywordPos,v.syntax,`class is not allowed to extend sealed class: ${o.displayName} (as it is not listed in its \'permits\' clause)`);continue}!r.isFinal&&!r.isSealed&&!r.isNonSealed&&this.#e(r.declaration.keywordPos,v.syntax,"sealed, non-sealed or final modifiers expected")}}#_e(t){[...t.superclass?[t.superclass]:[],...t.interfaces].some(n=>n.isSealed)&&this.#e(t.declaration.keywordPos,v.syntax,`${t.anonymous?"anonymous":"local"} classes must not extend sealed classes`)}#ie(t){return this.#G.filter(n=>n.hierarchyState===1).reduce((n,s)=>n.declaration.keywordPos<=s.declaration.keywordPos?n:s,t)}#xe(t){if(t.kind!=="ClassType")return this.#e(t.pos,v.syntax,"unexpected type"),null;let e=this.#J(t);return e.tag==="error"?null:e}#qt(t){if(t.membersEntered)return;t.membersEntered=!0,t.superclass&&this.#qt(t.superclass);let e=this.#a;this.#a=t,t.instanceCount=t.superclass?.instanceCount??0,t.isInner&&(t.outerField=t.instanceCount++),t.isEnum&&(t.instanceCount=2,this.#Ne(t)),t.isRecord&&this.#rs(t);for(let a of t.declaration.members)a.kind==="FieldDeclaration"?this.#os(t,a):a.kind==="MethodDeclaration"&&this.#ls(t,a);t.isRecord?t.constructors.some(a=>this.#vn(t,a))||this.#V(t,t.name,t.components.map(a=>a.type),Tt,"record-constructor",{isConstructor:!0}):!t.isInterface&&!t.anonymous&&!t.declaration.members.some(a=>a.kind==="MethodDeclaration"&&a.isConstructor)&&this.#cs(t),t.isEnum&&this.#is(t),t.isRecord&&this.#as(t);let n=t.methodsByName.get("toString")?.find(a=>!a.isStatic&&a.params.length===0&&a.returnType.tag==="string");n&&(t.toStringMethod=n);let s=t.methodsByName.get("equals")?.find(a=>!a.isStatic&&a.params.length===1&&a.params[0].tag==="object"&&a.returnType.tag==="boolean");s&&(t.equalsMethod=s);let r=t.methodsByName.get("hashCode")?.find(a=>!a.isStatic&&a.params.length===0&&a.returnType.tag==="int");r&&(t.hashCodeMethod=r),this.#a=e}#Ne(t){let e=X(t);(t.declaration.enumConstants??[]).forEach((s,r)=>{if(t.fieldsByName.has(s.name)){this.#e(s.pos,v.alreadyDefined,`variable ${s.name} is already defined in enum ${t.displayName}`);return}let a={name:s.name,extraDims:0,init:null,pos:s.pos,start:s.start,end:s.end},o={kind:"FieldDeclaration",modifiers:{keywords:[]},type:{kind:"VoidType",pos:s.pos,start:s.pos,end:s.pos},declarators:[a],pos:s.pos,start:s.start,end:s.end},c={kind:"field",name:s.name,type:e,owner:t,isStatic:!0,isFinal:!0,isPrivate:!1,index:this.#i.length,order:t.fields.length,state:"done",declaration:o,declarator:a,enumConstant:{node:s,ordinal:r}};this.#i.push(c),s.field=c,t.fields.push(c),t.fieldsByName.set(c.name,c),t.enumConstants.push(c)})}#rs(t){for(let e of t.declaration.components??[]){let n=this.#J(e.type);if(n.tag==="error")continue;if(t.fieldsByName.has(e.name)){this.#e(e.pos,v.alreadyDefined,`record component ${e.name} is already defined in record ${t.displayName}`);continue}let s={name:e.name,extraDims:0,init:null,pos:e.pos,start:e.start,end:e.end},r={kind:"FieldDeclaration",modifiers:{keywords:[{name:"private",pos:e.pos},{name:"final",pos:e.pos}]},type:e.type,declarators:[s],pos:e.pos,start:e.start,end:e.end},a={kind:"field",name:e.name,type:n,owner:t,isStatic:!1,isFinal:!0,isPrivate:!0,index:t.instanceCount++,order:t.fields.length,state:"done",declaration:r,declarator:s};s.field=a,t.fields.push(a),t.fieldsByName.set(a.name,a),t.components.push(a)}}#vn(t,e){return e.isConstructor&&(e.declaration.compact===!0||e.params.length===t.components.length&&e.params.every((n,s)=>rt(n,t.components[s].type)))}#V(t,e,n,s,r,a={}){let o=t.declaration.keywordPos,c={kind:"MethodDeclaration",modifiers:{keywords:[]},returnType:{kind:"VoidType",pos:o,start:o,end:o},name:e,namePos:o,params:[],body:{kind:"Block",statements:[],pos:o,start:o,end:o+1},synthetic:!0,pos:o,start:o,end:o};a.isConstructor&&(c.isConstructor=!0);let u={kind:"method",name:e,owner:t,isStatic:a.isStatic??!1,isConstructor:a.isConstructor??!1,isPrivate:!1,isAbstract:!1,isFinal:a.isFinal??!1,access:a.isConstructor&&t.isEnum?"private":"public",params:n,returnType:s,index:this.#$.length,declaration:c,locals:[],maxSlots:(a.isStatic?0:1)+n.reduce((m,h)=>m+Me(h),0),builtin:r,throws:a.throws??[]};return a.component!==void 0&&(u.component=a.component),c.symbol=u,this.#$.push(u),u.isConstructor?t.constructors.push(u):(t.methods.push(u),t.methodsByName.set(e,[...t.methodsByName.get(e)??[],u])),u}#Ut(t,e,n){return(t.methodsByName.get(e)??[]).some(s=>s.params.length===n.length&&s.params.every((r,a)=>rt(r,n[a])))}#is(t){let e=X(t);this.#Ut(t,"values",[])||this.#V(t,"values",[],Kt(e),"enum-values",{isStatic:!0}),this.#Ut(t,"valueOf",[ct])||this.#V(t,"valueOf",[ct],e,"enum-valueOf",{isStatic:!0}),this.#Ut(t,"name",[])||this.#V(t,"name",[],ct,"enum-name",{isFinal:!0}),this.#Ut(t,"ordinal",[])||this.#V(t,"ordinal",[],U,"enum-ordinal",{isFinal:!0}),this.#Ut(t,"compareTo",[e])||this.#V(t,"compareTo",[e],U,"enum-compareTo",{isFinal:!0}),this.#Ut(t,"toString",[])||this.#V(t,"toString",[],ct,"enum-toString")}#as(t){t.components.forEach((e,n)=>{(t.methodsByName.get(e.name)??[]).find(r=>r.params.length===0)||this.#V(t,e.name,[],e.type,"record-accessor",{component:n})}),this.#Ut(t,"toString",[])||this.#V(t,"toString",[],ct,"record-toString"),this.#Ut(t,"hashCode",[])||this.#V(t,"hashCode",[],U,"record-hashCode"),this.#Ut(t,"equals",[G])||this.#V(t,"equals",[G],ft,"record-equals")}#Ue(t=this.#$){for(let e of t){if(e.selector!==void 0||e.isStatic||e.isConstructor||e.isPrivate||e.lambda)continue;let n=he(e.name,e.params),s=this.#U.get(n);s===void 0&&this.#U.set(n,s=this.#U.size),e.selector=s}}#os(t,e){let n=e.modifiers.keywords.map(m=>m.name),s=this.#bt(e.modifiers,"field");for(let m of e.modifiers.keywords){if(m.name==="transient"||m.name==="volatile"){this.#l(m.pos,`\'${m.name}\' fields`);return}if(["abstract","synchronized","native","strictfp","default"].includes(m.name)){this.#e(e.declarators[0].pos,v.syntax,`modifier ${m.name} not allowed here`);return}}let r=e.type;if(r.kind==="VarType"||r.kind==="ClassType"&&r.names.length===1&&r.names[0]==="var"&&!r.hasTypeArguments&&!this.#le("var")){this.#e(r.pos,v.syntax,"\'var\' is not allowed here");return}if(t.isInterface&&(n.includes("private")||n.includes("protected"))){this.#e(e.declarators[0].pos,v.syntax,`modifier ${n.includes("private")?"private":"protected"} not allowed here`);return}if(t.isRecord&&!n.includes("static")){this.#e(e.declarators[0].pos,v.syntax,"field declaration must be static",[" (consider replacing field with record component)"]);return}let a=t.isInterface||n.includes("static"),o=t.isInterface||n.includes("final");if(t.isInterface&&e.declarators.some(m=>!m.init)){let m=e.declarators.find(h=>!h.init);this.#e(m.end,v.syntax,"= expected");return}let c=this.#o;this.#b=a,t.anonymous||(this.#o=[]);let u=this.#J(e.type);this.#b=!1,this.#o=c;for(let m of e.declarators){let h=u;for(let p=0;p<m.extraDims&&h.tag!=="error";p++)h=Kt(h);if(h.tag==="error")continue;if(t.fieldsByName.has(m.name)){this.#e(m.pos,v.alreadyDefined,`variable ${m.name} is already defined in class ${t.displayName}`);continue}let d={kind:"field",name:m.name,type:h,owner:t,isStatic:a,isFinal:o,isPrivate:n.includes("private"),index:a?this.#i.length:t.instanceCount++,order:t.fields.length,state:"pending",declaration:e,declarator:m,...s.size?{suppressed:s}:{}};a&&this.#i.push(d),m.field=d,t.fields.push(d),t.fieldsByName.set(d.name,d)}}#ls(t,e){let n=e.isConstructor===!0;for(let I of e.modifiers.keywords){if(n&&["static","final","abstract","native","synchronized","strictfp","default","transient","volatile"].includes(I.name)){this.#e(e.namePos,v.syntax,`modifier ${I.name} not allowed here`);return}if(["strictfp","native"].includes(I.name)){this.#l(I.pos,`\'${I.name}\' methods`);return}if(I.name==="default"&&!t.isInterface||I.name==="synchronized"&&t.isInterface||I.name==="transient"||I.name==="volatile"){this.#e(e.namePos,v.syntax,`modifier ${I.name} not allowed here`);return}if(t.isInterface&&(I.name==="protected"||I.name==="final")){this.#e(e.namePos,v.syntax,`modifier ${I.name} not allowed here`);return}}let s=this.#bt(e.modifiers,n?"constructor":"method");if(e.compact){if(!t.isRecord){this.#e(e.namePos,v.syntax,"invalid method declaration; return type required");return}e.params=(t.declaration.components??[]).map(I=>({...I,symbol:void 0}))}if(n&&e.typeParams?.length){this.#l(e.typeParams[0].pos,"generic constructors");return}let r=this.#o;this.#b=Gt(e.modifiers,"static");let a=e.typeParams?.length?this.#in(e.typeParams,"",null):void 0;a&&this.#an(a,e.typeParams),this.#o=a?[...r,a]:r;let o=e.params.map(I=>this.#J(I.type)),c=e.returnType.kind==="VoidType"?Tt:this.#J(e.returnType),u=[],m=!0;for(let I of e.throwsTypes??[]){let L=this.#J(I);if(L.tag==="error"){m=!1;break}if(!this.#xt(L)){this.#H(I,L,this.#Jt()),m=!1;break}u.push(L)}if(this.#o=r,this.#b=!1,o.some(I=>I.tag==="error")||c.tag==="error"||!m)return;if(a){let I=e.params.map((L,$)=>L.varargs?`${P(o[$].element)}...`:P(o[$]));for(let L of a)L.declaredIn=`method <${a.map($=>$.name).join(",")}>${e.name}(${I.join(",")})`}let h=n?t.constructors:t.methodsByName.get(e.name)??[];if(h.some(I=>I.params.length===o.length&&I.params.every((L,$)=>rt(L,o[$])))){let I=n?"constructor":"method";this.#e(e.namePos,v.alreadyDefined,`${I} ${e.name}(${o.map(P).join(",")}) is already defined in class ${t.displayName}`);return}let d=h.find(I=>he(I.name,I.params)===he(e.name,o));if(d){let I=(L,$)=>`${L}(${$.map(P).join(",")})`;this.#e(e.namePos,v.alreadyDefined,`name clash: ${I(e.name,o)} and ${I(d.name,d.params)} have the same erasure`,$t([...o,...d.params]));return}if(n&&t.isInterface){this.#e(e.namePos,v.syntax,"invalid method declaration; return type required");return}if(n&&t.isEnum){let I=e.modifiers.keywords.find(L=>L.name==="public"||L.name==="protected");I&&this.#e(e.namePos,v.syntax,`modifier ${I.name} not allowed here`)}let p=I=>Gt(e.modifiers,I),C=p("abstract")||t.isInterface&&!p("default")&&!p("static")&&!p("private");if(C&&(p("private")||p("static")||p("final")||p("synchronized"))){let I=p("private")?"private":p("static")?"static":p("final")?"final":"synchronized";this.#e(e.namePos,v.syntax,`illegal combination of modifiers: abstract and ${I}`);return}if(C&&e.body){let I=t.isInterface&&!p("abstract");this.#e(I?e.body.pos:e.namePos,v.syntax,I?"interface abstract methods cannot have body":"abstract methods cannot have a body");return}if(!C&&!e.body){this.#e(e.namePos,v.syntax,"missing method body, or declare abstract");return}let S=p("private")?"private":p("public")||t.isInterface?"public":p("protected")?"protected":"package",k={kind:"method",name:e.name,owner:t,isStatic:p("static"),isConstructor:n,isPrivate:p("private"),isAbstract:C,isFinal:p("final"),access:S,params:o,returnType:c,index:this.#$.length,...a?{typeParams:a}:{},declaration:e,locals:[],maxSlots:0,throws:u,...s.size?{suppressed:s}:{}},x=this.#Tt(e.modifiers,"SafeVarargs");if(x&&!e.params.some(I=>I.varargs))this.#e(e.namePos,v.syntax,`Invalid SafeVarargs annotation. ${n?"Constructor":"Method"} ${e.name}(${o.map(P).join(",")}) is not a varargs method.`);else if(x&&!n&&!k.isStatic&&!k.isFinal&&!k.isPrivate){let I=a?`<${a.map(L=>L.name).join(",")}>`:"";this.#e(e.namePos,v.syntax,`Invalid SafeVarargs annotation. Instance method ${I}${this.#Dt(k)} is neither final nor private.`,$t(o))}e.symbol=k,this.#$.push(k),n?t.constructors.push(k):(t.methods.push(k),t.methodsByName.set(e.name,[...h,k]));let w=t.isRecord&&!n&&!k.isStatic&&o.length===0?t.components.find(I=>I.name===e.name):void 0;w&&(rt(c,w.type)?S!=="public"&&this.#e(e.namePos,v.syntax,`invalid accessor method in record ${t.displayName}`,[" (accessor method must be public)"]):this.#e(e.namePos,v.syntax,`invalid accessor method in record ${t.displayName}`,[` (return type of accessor method ${e.name}() must match the type of record component ${e.name})`]))}#cs(t){let e=t.declaration.namePos,n={kind:"MethodDeclaration",modifiers:{keywords:t.isPrivate?[{name:"private",pos:e}]:[]},returnType:{kind:"VoidType",pos:e,start:e,end:e},name:t.name,namePos:e,params:[],body:{kind:"Block",statements:[],pos:e,start:e,end:e+1},isConstructor:!0,synthetic:!0,pos:e,start:e,end:e},s={kind:"method",name:t.name,owner:t,isStatic:!1,isConstructor:!0,isPrivate:t.isPrivate,isAbstract:!1,isFinal:!1,access:t.isPrivate?"private":"package",params:[],returnType:Tt,index:this.#$.length,declaration:n,locals:[],maxSlots:0,throws:[]};n.symbol=s,this.#$.push(s),t.constructors.push(s)}#Dt(t){let e=t.declaration.params.map((n,s)=>n.varargs?`${P(t.params[s].element)}...`:P(t.params[s]));return`${t.name}(${e.join(",")})`}#ae(){return{method:this.#c,field:this.#X,isStatic:this.#T,scopes:this.#C,nextSlot:this.#A,jumps:this.#L,typeScopes:this.#o,typeStatic:this.#b,memberSuppressed:this.#ot,localSuppressed:this.#W}}#oe(t){this.#c=t.method,this.#X=t.field,this.#T=t.isStatic,this.#C=t.scopes,this.#A=t.nextSlot,this.#L=t.jumps,this.#o=t.typeScopes,this.#b=t.typeStatic,this.#ot=t.memberSuppressed,this.#W=t.localSuppressed}#$e(t){this.#a=t;let e=this.#bt(t.declaration.modifiers,"type");e.size&&(t.suppressed=e);let n=this.#Tt(t.declaration.modifiers,"FunctionalInterface");if(n){let s=t.isInterface?ls(t):[];if(s.length!==1){let r=[` ${t.displayName} is not a functional interface`];t.isInterface&&r.push(s.length?` multiple non-overriding abstract methods found in interface ${t.displayName}`:` no abstract method found in interface ${t.displayName}`),this.#e(n.pos,v.syntax,"Unexpected @FunctionalInterface annotation",r)}}this.#ys(t),t.isEnum&&this.#ds(t);for(let s of t.declaration.members)if(this.#a=t,s.kind==="FieldDeclaration")for(let r of s.declarators)r.field&&this.#En(r.field);else s.kind==="MethodDeclaration"?s.symbol&&this.#fs(s.symbol):s.kind==="Initializer"?this.#us(t,s):s.symbol&&this.#$e(s.symbol);this.#a=t,this.#gs(t)}#us(t,e){if(t.isInterface){this.#e(e.body.pos,v.syntax,"initializers not allowed in interfaces");return}if(t.isRecord&&!e.isStatic){this.#e(e.body.pos,v.syntax,"instance initializers not allowed in records");return}let n=e.isStatic?"static":"new",s={kind:"MethodDeclaration",modifiers:e.modifiers,returnType:{kind:"VoidType",pos:e.pos,start:e.pos,end:e.pos},name:n,namePos:e.pos,params:[],body:e.body,pos:e.pos,start:e.start,end:e.end},r={kind:"method",name:n,owner:t,isStatic:e.isStatic,isConstructor:!1,isPrivate:!0,isAbstract:!1,isFinal:!1,access:"private",params:[],returnType:Tt,index:-1,declaration:s,locals:[],maxSlots:0,throws:[],initializer:e.isStatic?"static":"instance"};e.symbol=r;let a=this.#ae(),o=this.#gt,c=t.fields.find(u=>!u.enumConstant&&!u.capturedLocal&&u.declarator.pos>e.start);this.#gt={owner:t,isStatic:e.isStatic,order:c?c.order:t.fields.length},this.#a=t,this.#c=r,this.#X=null,this.#T=e.isStatic,this.#b=e.isStatic,this.#o=[],this.#ot=void 0,this.#W=[],this.#C=[],this.#A=e.isStatic?0:1,r.maxSlots=this.#A,this.#L=[],this.#wt();for(let u of e.body.statements)this.#Xt(u);this.#kt(),this.#oe(a),this.#gt=o,this.#a=t}#hs(t,e,n){t.superclass=e,t.superType=X(e),t.hierarchyState=2;let s=this.#ae(),r=this.#D,a=this.#P;this.#qt(t);let o=this.#_n(t,n);return this.#Ue([...t.methods,...t.constructors]),this.#q.set(t,{scopes:[]}),this.#D=null,this.#P=!1,this.#$e(t),this.#oe(s),this.#D=r,this.#P=a,this.#a=e,o}#ds(t){for(let e of t.enumConstants){let n=e.enumConstant.node,s=this.#ae();this.#c=null,this.#X=e,this.#T=!0,this.#C=[{names:new Map,nextSlot:0}],this.#A=0,this.#L=[];let r=this.#Yt(n.args);if(!r.some(a=>a.tag==="error")){let a=this.#at({pos:n.pos,name:t.name},this.#Fe(t),r,"constructor");if(a&&!n.body&&t.enumAbstract)this.#e(n.pos,v.syntax,`${t.displayName} is abstract; cannot be instantiated`);else if(a){this.#de(n.args,a.params),n.ctor=n.body?.symbol?this.#hs(n.body.symbol,t,a):a.method;let o=this.#Ce(a,n.pos);o&&(n.varargs=o)}this.#De(n.args)}this.#oe(s),this.#a=t}}#fs(t){if(t.builtin)return;this.#a=t.owner,this.#c=t,this.#X=null,this.#T=t.isStatic,this.#b=t.isStatic,this.#o=t.typeParams?[t.typeParams]:[],this.#ot=t.suppressed,this.#W=[],this.#C=[];let e=t.isConstructor&&t.owner.isInner?1:t.isConstructor&&t.owner.isEnum?2:0;this.#A=(t.isStatic?0:1)+e,t.maxSlots=this.#A,this.#L=[],this.#ms(t);let n=t.declaration.params[t.declaration.params.length-1];if(n?.varargs&&!gn(t.params[t.params.length-1])&&!this.#Tt(t.declaration.modifiers,"SafeVarargs")){let r=t.params[t.params.length-1].element;this.#st(n.pos,"unchecked",`Possible heap pollution from parameterized vararg type ${P(r)}`,$t([r]))}if(t.isAbstract){this.#c=null;return}this.#wt(),t.declaration.params.forEach((r,a)=>{this.#bt(r.modifiers,"parameter");let o=this.#Ft(r.name,t.params[a],r.pos,Gt(r.modifiers,"final"));o.parameter=a+1+e,r.symbol=o});let s=t.declaration.body.statements;t.isConstructor&&t.owner.isRecord&&!this.#vn(t.owner,t)&&!(s[0]?.kind==="ConstructorCall"&&s[0].keyword==="this")&&this.#e(t.declaration.namePos,v.syntax,`constructor is not canonical, so it must invoke another constructor of class ${t.owner.displayName}`),t.isConstructor&&t.owner.isEnum&&s[0]?.kind==="ConstructorCall"&&s[0].keyword==="super"&&this.#e(s[0].thisPos,v.syntax,"call to super not allowed in enum constructor"),t.isConstructor&&s[0]?.kind!=="ConstructorCall"&&!t.forwardsToSuper&&this.#wn(t),s.forEach((r,a)=>{r.kind==="ConstructorCall"?this.#Cn(r,a===0):this.#Xt(r)}),this.#kt(),this.#c=null}#wn(t){let e=t.owner.superclass;if(!e)return;let n=t.declaration.synthetic?t.owner.declaration.keywordPos:t.declaration.body.pos,s=this.#at({pos:n,name:e.name},this.#Fe(e,t.owner.superType),[],"constructor");if(!s||!this.#he(s.method,n,`${e.name}()`))return;t.superConstructor=s.method;let r=this.#Ce(s,n);r&&(t.superVarargs=r)}#ms(t){let e=t.declaration,n=this.#Tt(e.modifiers,"Override");if(t.isConstructor)return;let s=t.isPrivate?[]:this.#ps(t);if(!s.length){n&&this.#e(n.pos,v.syntax,"method does not override or implement a method from a supertype");return}for(let r of s){let a=r.fromInterface&&!t.owner.isInterface&&!t.isStatic?"implement":"override",o=`${this.#Dt(t)} in ${t.owner.displayName} cannot ${a} ${r.signature} in ${r.ownerName}`;if(t.isStatic&&!r.isStatic){this.#e(e.namePos,v.syntax,o,[" overriding method is static"]);return}if(!t.isStatic&&r.isStatic){this.#e(e.namePos,v.syntax,o,[" overridden method is static"]);return}if(t.isStatic)continue;if(r.isFinal){this.#e(e.namePos,v.syntax,o,[" overridden method is final"]);return}if(Vi[t.access]<Vi[r.access]){this.#e(e.namePos,v.syntax,o,[` attempting to assign weaker access privileges; was ${r.access}`]);return}let c=t.returnType;if(!(Y(r.returnType)||r.returnType.tag==="void"?rt(c,r.returnType):H(c,r.returnType))){this.#e(e.namePos,v.incompatibleTypes,o,[` return type ${P(c)} is not compatible with ${P(r.returnType)}`]);return}let m=t.throws.find(h=>this.#re(h)&&!(r.throws??[]).some(d=>H(h,d)));if(m){this.#e(e.namePos,v.syntax,o,[` overridden method does not throw ${P(m)}`]);return}}}#ps(t){let e=[],n=he(t.name,t.params);for(let s of this.#kn(t.owner))s.name===t.name&&he(s.name,s.params)===n&&e.push(s);return e}#kn(t){let e=[],n=new Set,s=(h,d)=>{for(let p of h.methods){if(p.isPrivate||p.lambda||p.isStatic&&h.isInterface||h.isEnum&&p.builtin&&co.has(p.name))continue;let C=k=>p.isStatic?k:Ce(d,h,k),S=p.params.map(C);e.push({name:p.name,params:S,returnType:C(p.returnType),isStatic:p.isStatic,isFinal:p.isFinal,isAbstract:p.isAbstract,isDefault:h.isInterface&&!p.isAbstract&&!p.isStatic,access:p.access,ownerName:h.displayName,signature:this.#Dt(p),fromInterface:h.isInterface,interfaceSymbol:h.isInterface?h:void 0,throws:p.throws,method:p})}},r=ce(t),a=h=>In(h).filter(d=>d.tag==="class"&&d.symbol.isInterface),o=h=>{if(!n.has(h.symbol)){n.add(h.symbol),s(h.symbol,h);for(let d of a(h))o(d)}},c=[r];for(let h=t.superclass;h;h=h.superclass)c.push(ee(r,h)??X(h));for(let h of c.slice(1))s(h.symbol,h);let u=[];for(let h of c)u.push(...a(h));for(let h of u)o(h);for(let h of Ge(r))for(let d of ho[h.symbol.name]??(h.symbol.functional?[h.symbol.functional]:[])){let p=h.symbol.methods.find(S=>S.name===d),C=p.params.map(S=>At(S,h.symbol.typeParams,h.args));e.push({name:d,params:C,returnType:At(p.returnType,h.symbol.typeParams,h.args),isStatic:!1,isFinal:!1,isAbstract:!0,isDefault:!1,access:"public",ownerName:h.symbol.name,signature:`${d}(${C.map(P).join(",")})`,fromInterface:!0})}let m=t.isEnum?t:t.enumBody?t.superclass:null;if(m){let h=X(m),d=(p,C,S)=>({name:p,params:C,returnType:S,isStatic:!1,isFinal:!0,isAbstract:!1,isDefault:!1,access:"public",ownerName:"Enum",signature:`${p}(${C.map(P).join(",")})`,fromInterface:!1});e.push(d("name",[],ct),d("ordinal",[],U),d("compareTo",[h],U),d("equals",[G],ft),d("hashCode",[],U))}for(let h of Object.values(Ee))e.push({name:h.name,params:h.params,returnType:h.returnType,isStatic:!1,isFinal:!1,isAbstract:!1,isDefault:!1,access:"public",ownerName:"Object",signature:`${h.name}(${h.params.map(P).join(",")})`,fromInterface:!1,isObject:!0});return e}#ys(t){if(t.isInterface)return;for(let c of t.constructors)c.declaration.synthetic&&!c.forwardsToSuper&&this.#wn(c);let e=new Set,n=new Map,s=ce(t);for(let c=t;c;c=c.superclass){let u=ee(s,c)??X(c);for(let m of c.methods){if(m.isAbstract||m.isStatic||m.lambda)continue;let h=he(m.name,m.params.map(d=>Ce(u,c,d)));e.add(h),!m.isPrivate&&!n.has(h)&&n.set(h,m)}}for(let c of Object.values(Ee))e.add(he(c.name,c.params));let r=this.#kn(t);for(let c of r){let u=c.method;if(!u||u.selector===void 0)continue;let m=n.get(he(c.name,c.params));if(!m||m===u||m.selector===void 0||m.selector===u.selector)continue;let h=t.bridges??=[];h.some(([d])=>d===u.selector)||h.push([u.selector,m.selector])}let a=new Map;for(let c of r){if(!c.isDefault)continue;let u=he(c.name,c.params);a.set(u,[...a.get(u)??[],c])}let o=t.isEnum&&t.declaration.enumConstants?.some(c=>c.body)===!0;if(!t.isAbstract){let c=t.methods.filter(u=>u.isAbstract).map(u=>({name:u.name,params:u.params,returnType:u.returnType,isStatic:!1,isFinal:!1,isAbstract:!0,isDefault:!1,access:u.access,ownerName:t.displayName,signature:this.#Dt(u),fromInterface:!1}));for(let u of[...c,...r]){if(!u.isAbstract)continue;let m=he(u.name,u.params);if(!(e.has(m)||a.has(m))){if(o){t.enumAbstract=!0;break}this.#e(t.declaration.keywordPos,v.syntax,`${t.displayName} is not abstract and does not override abstract method ${u.signature} in ${u.ownerName}`);return}}}for(let[c,u]of a){if(e.has(c)||u.length<2)continue;let[m,h]=u;if(!(m.interfaceSymbol&&h.interfaceSymbol&&(on(m.interfaceSymbol,h.interfaceSymbol)||on(h.interfaceSymbol,m.interfaceSymbol))||m.interfaceSymbol===h.interfaceSymbol)){this.#e(t.declaration.keywordPos,v.syntax,`types ${m.ownerName} and ${h.ownerName} are incompatible;`,[` class ${t.displayName} inherits unrelated defaults for ${m.signature} from types ${m.ownerName} and ${h.ownerName}`]);return}}}#Cn(t,e){let n=this.#c;if(!n?.isConstructor){this.#e(t.pos,v.syntax,"explicit constructor invocation may only appear within a constructor body");return}if(!e){this.#l(t.thisPos,`statements before \'${t.keyword}(...)\' in a constructor`);return}this.#P=!0;let s=this.#Yt(t.args);if(this.#P=!1,s.some(u=>u.tag==="error"))return;let r=t.keyword==="this"?n.owner:n.owner.superclass;if(!r){s.length&&this.#e(t.thisPos,v.cantResolve,"constructor Object in class Object cannot be applied to given types;",[" required: no arguments",` found: ${s.map(P).join(",")}`," reason: actual and formal argument lists differ in length"]);return}if(this.#hn(r,s.length,t.thisPos))return;let a=t.keyword==="this"?ce(r):n.owner.superType,o=this.#at({pos:t.thisPos,name:r.name},this.#Fe(r,a),s,"constructor");if(!o||!this.#he(o.method,t.thisPos,`${r.name}(${o.params.map(P).join(",")})`))return;this.#P=!0,this.#de(t.args,o.params),this.#De(t.args),this.#P=!1,t.target=o.method;let c=this.#Ce(o,t.thisPos);c&&(t.varargs=c)}#gs(t){let e=new Map;for(let s of t.constructors){let r=s.declaration.body?.statements[0];r?.kind==="ConstructorCall"&&r.keyword==="this"&&r.target&&e.set(s,r)}let n=new Set;for(let s of t.constructors){let r=new Set,a=s;for(;a&&!n.has(a);){r.add(a);let o=e.get(a),c=o?.target;if(c&&r.has(c)){this.#e(o.thisPos,v.syntax,"recursive constructor invocation"),e.delete(a);break}a=c}for(let o of r)n.add(o)}}#En(t){if(t.state!=="pending")return;t.state="attributing";let e=this.#ae(),n=this.#a;this.#a=t.owner,this.#c=null,this.#X=t,this.#T=t.isStatic,this.#b=t.isStatic,this.#o=[],this.#ot=t.suppressed,this.#W=[],this.#C=[{names:new Map,nextSlot:0}],this.#A=0,this.#L=[];let s=t.declarator.init;if(s)if(s.kind==="ArrayInitializer")this.#we(s,t.type);else{let r=this.#I(s,t.type);this.#He(t.type,r,s)?t.isFinal&&s.constant&&(Y(t.type)||t.type.tag==="string")&&(t.constant=yn(s.constant,t.type)):this.#H(s,r,t.type)}this.#oe(e),this.#a=n,t.state="done"}#wt(){this.#C.push({names:new Map,nextSlot:this.#A})}#kt(){let t=this.#C.pop();this.#A=t.nextSlot}#ft(t){for(let e=this.#C.length-1;e>=0;e--){let n=this.#C[e].names.get(t);if(n)return n}}#Ft(t,e,n,s,r=!1){let a=this.#c,o=this.#ft(t)||r?null:this.#yn(t),c=o?.method??a;!r&&(this.#ft(t)||o&&c)&&this.#e(n,v.alreadyDefined,`variable ${t} is already defined in ${c.isConstructor?"constructor":"method"} ${this.#Dt(c)}`);let u={kind:"local",name:t,type:e,index:a.locals.length,slot:this.#A,isFinal:s,declPos:n};return this.#A+=Me(e),a.maxSlots=Math.max(a.maxSlots,this.#A),a.locals.push(u),this.#C[this.#C.length-1].names.set(t,u),u}#Wt(t){let e=0;for(let n=this.#a;n;n=n.outer,e++){let s=this.#Me(n,t);if(s&&!(n.enumBody&&s.isPrivate&&s.owner!==n))return{field:s,hops:e};let r=n.anonymous||n.local?this.#Ws(n,t):null;if(r)return{field:r,hops:e}}return null}#Me(t,e,n=new Set){if(n.has(t))return null;n.add(t);let s=t.fieldsByName.get(e);if(s)return s;if(t.superclass){let r=this.#Me(t.superclass,e,n);if(r)return r}for(let r of t.interfaces){let a=this.#Me(r,e,n);if(a)return a}return null}#Ct(t,e){let n=[],s=new Set,r=new Set,a=ce(t),o=(c,u)=>{if(!r.has(c)){r.add(c);for(let m of c.methodsByName.get(e)??[]){if(u&&(m.isPrivate||m.isStatic&&c.isInterface))continue;let h=he(m.name,m.isStatic?m.params:m.params.map(d=>Ce(a,c,d)));s.has(h)||(s.add(h),n.push(m))}c.superclass&&o(c.superclass,!0);for(let m of c.interfaces)o(m,!0)}};return o(t,!1),n}#Be(t){let e=this.#a;for(let n=0;n<t;n++,e=e.outer)if(!e?.isInner)return!1;return!0}#bs(t){let e=this.#a;for(let n=0;n<t&&e;n++)e=e.outer;return e}#Ts(t,e){for(let n=e;n;n=n.outer)if(n===t)return!0;return!1}#Ss(t,e){for(let n=t.superclass;n;n=n.superclass){let s=n.methodsByName.get(e)?.find(r=>r.isPrivate);if(s)return s}return null}#le(t){let e=s=>{for(let r=s.length-1;r>=0;r--){let a=s[r].classes?.get(t);if(a)return a}return null},n=e(this.#C);if(n)return n;for(let s=this.#D;s;s=s.outer){let r=e(s.scopes);if(r)return r}for(let s=this.#a;s;s=s.outer){let r=s.membersByName.get(t);if(r)return r;if(s.name===t&&!s.declaration.implicit)return s;let a=s.anonymous||s.local?this.#q.get(s):void 0,o=a?e(a.scopes):null;if(o)return o}return this.#z.find(s=>s.name===t&&!s.declaration.implicit)??null}#Pe(t){this.#wt();for(let e of t.statements)this.#Xt(e);this.#kt()}#Xt(t){let e=this.#A,n=this.#f.length;this.#xs(t);let s=this.#f.slice(n);if(t.kind==="LocalVariableDeclaration")for(let r of t.declarators)r.symbol&&s.push(r.symbol);this.#A=Math.max(e,...s.map(r=>r.slot+Me(r.type)))}#xs(t){switch(t.kind){case"Block":this.#Pe(t);return;case"LocalVariableDeclaration":this.#Ln(t);return;case"ExpressionStatement":this.#I(t.expression);return;case"IfStatement":{this.#ce(t.condition);let e=this.#it(t.condition,!0),n=this.#it(t.condition,!1);this.#Bt(e,()=>this.#nn(t.then)),t.otherwise&&this.#Bt(n,()=>this.#nn(t.otherwise)),n.length&&!this.#sn(t.then)&&this.#Je(n),e.length&&t.otherwise&&!this.#sn(t.otherwise)&&this.#Je(e);return}case"WhileStatement":this.#ce(t.condition),this.#Bt(this.#it(t.condition,!0),()=>this.#Ve(t,t.body)),de(t.body,t)||this.#Je(this.#it(t.condition,!1));return;case"DoStatement":this.#Ve(t,t.body),this.#ce(t.condition),de(t.body,t)||this.#Je(this.#it(t.condition,!1));return;case"ForStatement":this.#Es(t);return;case"ForEachStatement":this.#As(t);return;case"LabeledStatement":this.#Is(t);return;case"SwitchStatement":this.#An(t,void 0);return;case"YieldStatement":this.#Ns(t);return;case"BreakStatement":t.liveSlots=this.#A,this.#Os(t);return;case"ContinueStatement":t.liveSlots=this.#A,this.#Ls(t);return;case"ReturnStatement":if(this.#c?.initializer){this.#e(t.pos,v.syntax,"return outside method");return}t.liveSlots=this.#A+(t.value&&this.#c?Me(this.#c.returnType):0),this.#Ms(t);return;case"EmptyStatement":return;case"ConstructorCall":this.#Cn(t,!1);return;case"ThrowStatement":{let e=this.#Y(t.expression);e.tag!=="error"&&!this.#xt(e)&&this.#e(t.pos,v.incompatibleTypes,`incompatible types: ${$e(this.#Jt(),e)}`);return}case"TryStatement":this.#ws(t);return;case"AssertStatement":this.#ce(t.condition),t.message&&this.#Y(t.message);return;case"LocalClass":this.#vs(t.declaration);return}}#vs(t){let e=t.symbol;if(!e)return;let n=this.#C[this.#C.length-1];if(this.#C.some(h=>h.classes?.has(e.name))&&this.#c){this.#e(t.keywordPos,v.alreadyDefined,`class ${e.name} is already defined in ${this.#c.isConstructor?"constructor":"method"} ${this.#Dt(this.#c)}`);return}(n.classes??=new Map).set(e.name,e);let r=this.#ae(),a=this.#a,o=this.#D,c=this.#ht,u=this.#P;e.declaration.keyword==="class"&&this.#q.set(e,{scopes:r.scopes});let m=[e,...ur(e,!0)];for(let h of m)h.typeParams&&(this.#a=h,this.#an(h.typeParams,h.declaration.typeParams));for(let h of m)this.#vt(h);this.#_e(e);for(let h of m)this.#qt(h);for(let h of m)this.#Ue([...h.methods,...h.constructors]);this.#D=null,this.#P=!1,this.#$e(e),this.#oe(r),this.#a=a,this.#D=o,this.#ht=c,this.#P=u}#ws(t){this.#wt();for(let n of t.resources)this.#ks(n);this.#Pe(t.block),this.#kt();let e=[];for(let n of t.catches){let s=[];for(let o of n.types){let c=this.#J(o);if(c.tag==="error")continue;if(!this.#xt(c)){this.#H(o,c,this.#Jt());continue}let u=s.find(m=>H(c,m)||H(m,c));if(u){let[m,h]=H(c,u)?[c,u]:[u,c];this.#e(o.pos,v.syntax,"Alternatives in a multi-catch statement cannot be related by subclassing",[` Alternative ${P(m)} is a subclass of alternative ${P(h)}`]);continue}if(e.some(m=>H(c,m))){this.#e(n.types.length===1?n.pos:o.pos,v.syntax,`exception ${P(c)} has already been caught`);continue}s.push(c)}e.push(...s),n.caught=s,this.#wt();let r=s.length===1?s[0]:s.length?this.#Cs(s):E,a=this.#Ft(n.name,r,n.namePos,n.isFinal||n.types.length>1);n.types.length>1&&(a.multiCatch=!0),n.symbol=a,this.#Pe(n.block),this.#kt()}if(t.finallyBlock){let n=this.#c,s=n.maxSlots,r=this.#A,a=n.locals.length;this.#Pe(t.finallyBlock);let o=Math.max(0,...n.locals.slice(a).map(c=>c.slot+Me(c.type)-r));t.finallySlots={base:r,extent:o,before:s},n.finallySlots=Math.max(n.finallySlots??0,n.maxSlots)+3+2*o}}#ks(t){if(t.kind==="variable"){let r=this.#I(t.expression),a=ht(t.expression);a.kind==="Name"&&a.symbol?.kind==="local"&&(t.symbol=a.symbol),r.tag!=="error"&&!this.#tn(r)?this.#en(t.expression,r):t.closeMethod=this.#Ze(r);return}if(t.type.kind==="VarType"){let r=this.#I(t.init),a=r.tag==="null"||r.tag==="void"?E:r;if(a.tag==="error"&&r.tag!=="error"&&this.#e(t.namePos,v.cantResolve,`cannot infer type for local variable ${t.name}`,[` (variable initializer is \'${r.tag}\')`]),t.symbol=this.#Ft(t.name,a,t.namePos,!0),a.tag==="error")return;this.#tn(a)?t.closeMethod=this.#Ze(a):this.#en(t.init,a);return}let e=this.#J(t.type),n=this.#Ft(t.name,e,t.namePos,!0);t.symbol=n;let s=this.#I(t.init,e);if(!(e.tag==="error"||s.tag==="error")){if(!Yt(e,s,t.init.constant)){this.#H(t.init,s,e);return}this.#tn(e)?t.closeMethod=this.#Ze(e):this.#en(t.type,e)}}#Ze(t){if(t.tag==="class")return this.#Ct(t.symbol,"close").find(e=>e.params.length===0)}#tn(t){return t.tag==="library"?t.symbol.closeable===!0:H(t,X(this.#k.get("java.lang.AutoCloseable")))}#en(t,e){this.#e(t.pos,v.incompatibleTypes,"incompatible types: try-with-resources not applicable to variable type",[` (${P(e)} cannot be converted to AutoCloseable)`])}#Cs(t){let s=(r=>{let a=[];for(let o=r.tag==="class"?r.symbol:null;o;o=o.superclass)a.push(o);return a})(t[0]).find(r=>t.every(a=>a.tag==="class"&&H(a,X(r))));return s?X(s):this.#Jt()}#nn(t){this.#wt(),this.#Xt(t),this.#kt()}#Es(t){if(this.#wt(),t.init&&!Array.isArray(t.init))this.#Ln(t.init);else for(let s of t.init??[])this.#I(s);t.condition&&this.#ce(t.condition);let e=t.condition?this.#it(t.condition,!0):[];this.#Bt(e,()=>{for(let s of t.update)this.#I(s);this.#Ve(t,t.body)});let n=t.condition?this.#it(t.condition,!1):[];this.#kt(),de(t.body,t)||this.#Je(n)}#sn(t){let e=[this.#M,this.#nt,this.#K,this.#j,this.#E,this.#p];this.#M=[],this.#nt=[],this.#K=new Map,this.#j=0,this.#E=[],this.#p=new Map;let n=this.#Et(t,Ht(),!0).completes;return[this.#M,this.#nt,this.#K,this.#j,this.#E,this.#p]=e,n}#Ve(t,e){this.#L.push({kind:"loop",node:t}),this.#nn(e),this.#L.pop()}#As(t){let e=this.#I(t.iterable);this.#wt();let n=E,s=c=>c.tag==="library"?[c]:c.tag==="diamond"?[this.#fn(c)]:c.tag==="class"?Ge(c):c.tag==="typevar"&&c.symbol?c.symbol.bounds.flatMap(s):[],r=s(e).map(c=>_t(c,oe("Iterable"))).find(c=>c!==null)??null;e.tag==="array"?(n=e.element,t.hidden={array:this.#ve(e),length:this.#ve(U),index:this.#ve(U)}):r?(n=Ie(r.args[0]??G),t.element=n,t.iterator=this.#ve(G)):e.tag!=="error"&&this.#e(t.iterable.pos,v.incompatibleTypes,"for-each not applicable to expression type",[" required: array or java.lang.Iterable",` found: ${P(e)}`]),this.#bt(t.modifiers,"local");let a=t.type.kind==="VarType"?n:this.#J(t.type),o=this.#Ft(t.name,a,t.namePos,Gt(t.modifiers,"final"));o.forEach=!0,t.symbol=o,n.tag!=="error"&&a.tag!=="error"&&!Yt(a,n)&&this.#H(t.iterable,n,a),this.#Ve(t,t.body),this.#kt()}#Is(t){this.#L.some(s=>s.kind==="label"&&s.label===t.label)&&this.#e(t.pos,v.syntax,`label ${t.label} already in use`);let e=t.body,n=["WhileStatement","DoStatement","ForStatement","ForEachStatement"].includes(e.kind);this.#L.push({kind:"label",node:t,label:t.label,loop:n?e:void 0}),this.#Xt(e),this.#L.pop()}#Os(t){for(let e=this.#L.length-1;e>=0;e--){let n=this.#L[e];if(n.kind==="switch-expression"){this.#e(t.pos,v.syntax,"attempt to break out of a switch expression");return}if(t.label===void 0?n.kind==="loop"||n.kind==="switch":n.kind==="label"&&n.label===t.label){t.target=n.node;return}}t.label!==void 0?this.#e(t.pos,v.syntax,`undefined label: ${t.label}`):this.#e(t.pos,v.syntax,"break outside switch or loop")}#Ls(t){for(let e=this.#L.length-1;e>=0;e--){let n=this.#L[e];if(n.kind==="switch-expression"){this.#e(t.pos,v.syntax,"attempt to continue out of a switch expression");return}if(t.label===void 0&&n.kind==="loop"){t.target=n.node;return}if(t.label!==void 0&&n.kind==="label"&&n.label===t.label){n.loop?t.target=n.loop:this.#e(t.pos,v.syntax,`not a loop label: ${t.label}`);return}}t.label!==void 0?this.#e(t.pos,v.syntax,`undefined label: ${t.label}`):this.#e(t.pos,v.syntax,"continue outside of loop")}#Ns(t){let e=[...this.#L].reverse().find(s=>s.kind==="switch-expression");if(!e){this.#e(t.pos,v.syntax,"yield outside of switch expression"),this.#I(t.value);return}t.target=e.node;let n=this.#Y(t.value,e.target);e.results.push({expression:t.value,type:n})}#ve(t){let e=this.#c;if(!e)throw new Error("checker: hidden local outside a method");let n={kind:"local",name:"",type:t,index:e.locals.length,slot:this.#A,isFinal:!1,declPos:-1};return this.#A+=Me(t),e.maxSlots=Math.max(e.maxSlots,this.#A),e.locals.push(n),n}#An(t,e){let n=t.kind==="SwitchExpression",s=this.#I(t.selector),r=s.tag!=="error",a=s.tag==="class"&&s.symbol.isEnum?s.symbol:null,o=a!==null||["int","byte","short","char","string"].includes(s.tag)||yt(s)!==null;if(r&&(t.cases.some(p=>p.pattern||p.nullLabel)||!o&&tt(s)))return this.#$s(t,s,e);r&&!a&&!["int","byte","short","char","string"].includes(s.tag)&&(r=!1,yt(s)?this.#l(t.selectorPos,`switching on ${mn(P(s))}`,!0):Y(s)?this.#e(t.selectorPos,v.syntax,"primitive patterns are a preview feature and are disabled by default.",[" (use --enable-preview to enable primitive patterns)"]):this.#l(t.selectorPos,`switching on ${mn(P(s))}`,!0)),this.#wt(),r&&s.tag==="string"&&(this.#c?t.hidden={copy:this.#ve(ct),index:this.#ve(U)}:(this.#l(t.pos,"a switch on a String in a field initializer",!0),r=!1));let c=n?{kind:"switch-expression",node:t,results:[],target:e}:{kind:"switch",node:t};this.#L.push(c);let u=new Set,m=0,h=!1,d=t.cases[0]?.arrow??!1;for(let p of t.cases){if(p.arrow!==d&&!h&&(h=!0,this.#e(p.pos,v.syntax,"different case kinds used in the switch")),p.isDefault&&++m>1&&this.#e(p.pos,v.syntax,"duplicate default label"),a){p.ordinals=[];for(let C of p.labels){let S=this.#In(C,a);S!==null&&(u.has(`e:${S}`)&&this.#e(C.pos,v.syntax,"duplicate case label"),u.add(`e:${S}`),p.ordinals.push(S))}this.#rn(p,n,c);continue}for(let C of p.labels){let S=this.#I(C,r?s:void 0);if(!r||S.tag==="error")continue;if(!C.constant){this.#e(C.pos,v.syntax,"constant expression required");continue}if(!Yt(s,S,C.constant)){this.#H(C,S,s);continue}let k=C.constant.kind==="string"?`s:${C.constant.value}`:`n:${un(C.constant)}`;u.has(k)&&this.#e(p.pos,v.syntax,"duplicate case label"),u.add(k)}this.#rn(p,n,c)}return this.#L.pop(),this.#kt(),a&&(t.coversAllConstants=a.enumConstants.every(p=>u.has(`e:${p.enumConstant.ordinal}`))),n?this.#On(t,c.results,e):Tt}#$s(t,e,n){let s=t.kind==="SwitchExpression";t.patternSwitch=!0;let r=e.tag==="class"&&e.symbol.isEnum?e.symbol:null;this.#wt();let a=s?{kind:"switch-expression",node:t,results:[],target:n}:{kind:"switch",node:t};this.#L.push(a);let o=!1,c=0,u=!1,m=t.cases[0]?.arrow??!1,h=[],d=new Set,p=null,C=[],S=!1,k=yt(e);t.cases.forEach((w,I)=>{w.arrow!==m&&!o&&(o=!0,this.#e(w.pos,v.syntax,"different case kinds used in the switch")),w.isDefault&&++c>1&&this.#e(w.pos,v.syntax,"duplicate default label");let L=[];w.nullLabel&&Y(e)&&this.#H({pos:w.pos},Zs,e);for(let $ of w.labels){if(r){let R=this.#In($,r);if(R===null)continue;d.has(`e:${R}`)&&this.#e($.pos,v.syntax,"duplicate case label"),d.add(`e:${R}`),(w.ordinals??=[]).push(R),C.push({constantOf:r,ordinal:R})}else{let R=this.#I($,k??e);if(R.tag==="error")continue;let N=$.kind==="FieldAccess"?$.fieldSymbol:void 0;if(R.tag==="class"&&R.symbol.isEnum&&N?.enumConstant&&H(R,e)){(w.enumFields??=[]).push(N),C.push({constantOf:R.symbol,ordinal:N.enumConstant.ordinal}),h.some(F=>H(R,F))&&this.#e($.pos,v.syntax,"this case label is dominated by a preceding case label");continue}if(!(e.tag==="string"?R.tag==="string":k!==null&&Y(R)&&$.constant!==void 0&&Yt(k,R,$.constant))){k&&$.constant?this.#H($,R,k):this.#l($.pos,`constant labels in a switch on ${mn(P(e))}`,!0);continue}if(!$.constant){this.#e($.pos,v.syntax,"constant expression required");continue}let J=$.constant.kind==="string"?`s:${$.constant.value}`:`n:${un($.constant)}`;d.has(J)&&this.#e(w.pos,v.syntax,"duplicate case label"),d.add(J)}let O=r||k?e:ct;h.some(R=>H(O,R))&&this.#e($.pos,v.syntax,"this case label is dominated by a preceding case label")}if(w.pattern){let $=w.pattern;if(!this.#on($,e,!0,L))S=!0;else{let R=$.tested;(u||h.some(B=>H(q(R),q(B))))&&this.#e($.pos,v.syntax,"this case label is dominated by a preceding case label");let N=w.guard!==void 0;$.kind==="TypePattern"&&!N&&(h.push(R),$.unconditional&&(p=w)),(!w.guard||Mn(w.guard.constant))&&C.push({pattern:$})}let O=t.cases[I-1];!w.arrow&&O&&!O.arrow&&O.statements.length&&L.length&&this.#sn({kind:"Block",statements:O.statements,pos:O.pos,start:O.start,end:O.end})&&this.#e($.pos,v.syntax,"illegal fall-through to a pattern",[" (the previous case label is missing a break)"])}w.isDefault&&(u=!0,C.push({all:!0})),this.#Bt(L,()=>{let $=[];w.guard&&(this.#ce(w.guard),ds(w.guard.constant)&&this.#e(w.guard.pos,v.syntax,"this case label has a guard that is a constant expression with value \'false\'"),$=this.#it(w.guard,!0)),this.#Bt($,()=>this.#rn(w,s,a))})});let x=t.cases.find(w=>w.isDefault&&!w.nullLabel)??t.cases.find(w=>w.isDefault);return p&&x&&this.#e(x.pos,v.syntax,"switch has both an unconditional pattern and a default label"),this.#L.pop(),this.#kt(),t.exhaustive=vo(e,C),!t.exhaustive&&!S&&this.#e(t.pos,v.syntax,`the switch ${s?"expression":"statement"} does not cover all possible input values`),s?this.#On(t,a.results,n):Tt}#In(t,e){let n=ht(t);if(n.kind==="Name"){let a=e.fieldsByName.get(n.identifier);return a?.enumConstant?(n.symbol=a,t.type=X(e),a.enumConstant.ordinal):(this.#e(n.pos,v.cantResolve,"cannot find symbol",[` symbol: variable ${n.identifier}`,` location: class ${this.#a.displayName}`]),null)}let s=this.#I(t);if(s.tag==="error")return null;let r=n.kind==="FieldAccess"?n.fieldSymbol:void 0;return r?.enumConstant&&r.owner===e?r.enumConstant.ordinal:(Yt(X(e),s)?this.#e(t.pos,v.syntax,"constant expression required"):this.#H(t,s,X(e)),null)}#rn(t,e,n){if(!t.arrow){for(let r of t.statements)this.#Xt(r);return}let s=t.body;s.kind==="Block"?this.#Pe(s):e?n.results.push({expression:s,type:this.#Y(s,n.target)}):this.#I(s)}#On(t,e,n){if(e.some(r=>r.type.tag==="error"))return E;if(n&&n.tag!=="error"){let r=!0;for(let{expression:a,type:o}of e)Yt(n,o,a.constant)||(this.#e(a.pos,v.incompatibleTypes,"incompatible types: bad type in switch expression",[` ${$e(n,o)}`]),r=!1);return r?n:E}let s=e.map(r=>r.type);return s.length?s.every(r=>r.tag==="boolean")?ft:s.every(r=>Ot(r))?s.every(r=>rt(r,s[0]))?s[0]:s.reduce((r,a)=>Un(r,a)):s.every(r=>tt(r))?s.reduce((r,a)=>Qi(r,a)):(this.#l(t.pos,"switch expressions that need boxing"),E):E}#Ms(t){let e=this.#c.returnType;if(this.#c.lambda&&this.#c.returnType===jn){if(!t.value)return;let s=this.#I(t.value);s.tag!=="error"&&(this.#c.returnType=qt(s)??(s.tag==="null"?G:s));return}if(this.#c.lambda){let s=`incompatible types: bad return type in ${this.#c.lambda.reference?"method reference":"lambda expression"}`;if(!t.value){e.tag!=="void"&&this.#e(t.pos,v.incompatibleTypes,s,[" missing return value"]);return}if(e.tag==="void"){this.#I(t.value),this.#e(t.value.pos,v.incompatibleTypes,"incompatible types: unexpected return value");return}let r=this.#I(t.value,e);r.tag!=="error"&&!Yt(e,r,t.value.constant)&&this.#e(t.value.pos,v.incompatibleTypes,s,[` ${$e(e,r)}`]);return}if(!t.value){e.tag!=="void"&&this.#e(t.pos,v.incompatibleTypes,"incompatible types: missing return value");return}let n=this.#I(t.value,e.tag==="void"?void 0:e);if(e.tag==="void"){n.tag!=="error"&&this.#e(t.value.pos,v.incompatibleTypes,"incompatible types: unexpected return value");return}this.#He(e,n,t.value)||this.#H(t.value,n,e)}#ce(t){let e=this.#I(t);e.tag!=="error"&&(yt(e)??e).tag!=="boolean"&&this.#H(t,e,ft)}#Ln(t){let e=Gt(t.modifiers,"final"),n=this.#bt(t.modifiers,"local");if(this.#W=[...this.#W,n],this.#Tt(t.modifiers,"Deprecated"))for(let s of t.declarators)this.#st(s.pos,"deprecation","@Deprecated annotation has no effect on this variable declaration");t.type.kind==="VarType"?this.#Rs(t,e):this.#Ps(t,e),this.#W=this.#W.slice(0,-1)}#Ps(t,e){let n=this.#J(t.type);for(let s of t.declarators){let r=n;for(let u=0;u<s.extraDims&&r.tag!=="error";u++)r=Kt(r);let a=this.#Ft(s.name,r,s.pos,e);s.symbol=a;let o=s.init;if(o||(a.noInitializer=!0),!o){e&&this.#l(s.pos,"final local variables without an initializer");continue}if(o.kind==="ArrayInitializer"){this.#we(o,r);continue}let c=this.#I(o,r);this.#He(r,c,o)?e&&o.constant&&(Y(r)||r.tag==="string")&&(a.constant=yn(o.constant,r)):this.#H(o,c,r)}}#Rs(t,e){let n=t.type.pos;if(t.declarators.length>1){this.#e(n,v.syntax,"\'var\' is not allowed in a compound declaration");return}let s=t.declarators[0];if(s.extraDims){this.#e(n,v.syntax,"\'var\' is not allowed as an element type of an array");return}let r=m=>this.#e(s.pos,v.cantResolve,`cannot infer type for local variable ${s.name}`,[` (${m})`]),a=s.init,o=a&&a.kind!=="ArrayInitializer"?ht(a):null,c=E;if(!a)r("cannot use \'var\' on variable without initializer");else if(a.kind==="ArrayInitializer")r("array initializer needs an explicit target-type");else if(o.kind==="Lambda")r("lambda expression needs an explicit target-type");else if(o.kind==="MethodRef")r("method reference needs an explicit target-type");else if(Io(a,s.name))r("cannot use \'var\' on self-referencing variable");else{let m=this.#I(a);m.tag==="null"?r("variable initializer is \'null\'"):m.tag==="void"?r("variable initializer is \'void\'"):c=m.tag==="diamond"?this.#fn(m):m,c.tag==="class"&&c.args?.includes(On)&&(c=E)}let u=this.#Ft(s.name,c,s.pos,e);s.symbol=u,a||(u.noInitializer=!0),a&&a.kind!=="ArrayInitializer"&&e&&a.constant&&(Y(c)||c.tag==="string")&&(u.constant=yn(a.constant,c))}#He(t,e,n){return q(t).tag==="object"&&delete ht(n).genericCast,Yt(t,e,n.constant)?!0:pn(t,e)?(this.#st(n.pos,"unchecked","unchecked conversion",[` required: ${P(t)}`,` found: ${P(e)}`,...$t([t,e])]),!0):!1}#we(t,e){if(e.tag==="error"){for(let n of t.elements)n.kind==="ArrayInitializer"?this.#we(n,E):this.#I(n);return}if(e.tag!=="array"){this.#e(t.pos,v.incompatibleTypes,`illegal initializer for ${P(e)}`);return}t.elementType=e.element;for(let n of t.elements){if(n.kind==="ArrayInitializer"){this.#we(n,e.element);continue}let s=this.#I(n,e.element);Yt(e.element,s,n.constant)||this.#H(n,s,e.element)}}#in(t,e,n){let s=[];for(let r of t){if(s.some(a=>a.name===r.name)){this.#e(r.pos,v.alreadyDefined,`type variable ${r.name} is already defined in ${e}`);continue}s.push({kind:"typevar",name:r.name,key:`${r.name}#${this.#mt++}`,bounds:[],declaredIn:e,pos:r.pos,ofClass:n})}return s}#an(t,e){this.#o=[...this.#o,t.filter(s=>!s.ofClass)];let n=this.#tt;this.#tt=!0;for(let s of t){let r=e.find(a=>a.name===s.name&&a.pos===s.pos);for(let a of r?.bounds??[]){let o=this.#J(a);if(o.tag!=="error"){if(!tt(o)||o.tag==="array"){this.#e(a.pos,v.incompatibleTypes,"unexpected type",[" required: class",` found: ${P(o)}`]);continue}o.tag==="object"&&r.bounds.length===1||s.bounds.push(o)}}}this.#tt=n,this.#o=this.#o.slice(0,-1)}#Js(t,e){for(let s=this.#o.length-1;s>=0;s--){let r=this.#o[s].find(a=>a.name===t);if(r)return xe(r)}let n=this.#b;for(let s=this.#a??null;s;s=s.outer){let r=s.typeParams?.find(a=>a.name===t);if(r)return n?(this.#e(e,v.syntax,`non-static type variable ${t} cannot be referenced from a static context`),E):xe(r);s.isInner||(n=!0)}return null}#Re(t){if(t.kind==="WildcardType"){if(!t.bound)return{tag:"wildcard",bound:null};let e=this.#Re(t.bound);return e.tag==="error"||e.tag==="wildcard"?E:{tag:"wildcard",bound:e,isSuper:t.isSuper}}return t.kind==="PrimitiveType"?(this.#e(t.pos,v.incompatibleTypes,"unexpected type",[" required: reference",` found: ${t.name}`]),E):this.#J(t)}#Ds(t,e){let n=t.typeParams??[];if(e.diamond)return X(t);if(!n.length)return this.#e(e.typeArgumentsPos??e.pos,v.syntax,`type ${t.displayName} does not take parameters`),E;let s=e.typeArguments??[];if(s.length!==n.length)return this.#e(e.typeArgumentsPos??e.pos,v.syntax,`wrong number of type arguments; required ${n.length}`),E;let r=[];for(let o of s){let c=this.#Re(o);if(c.tag==="error")return E;r.push(c)}let a=X(t,r);if(!this.#tt){let o=En(a);for(let c=0;c<n.length;c++){let u=r[c];if(u.tag==="wildcard")continue;if(!n[c].bounds.every(h=>H(u,Bt(h,o))))return this.#e(s[c].pos,v.incompatibleTypes,`type argument ${P(u)} is not within bounds of type-variable ${n[c].name}`,$t([xe(n[c])])),E}}return a}#J(t,e=!1){switch(t.kind){case"PrimitiveType":return t.name==="int"?U:t.name==="boolean"?ft:t.name==="char"?Se:t.name==="long"?Lt:t.name==="double"?lt:t.name==="float"?St:t.name==="byte"?Cn:cn;case"VarType":return this.#l(t.pos,"\'var\' declarations"),E;case"WildcardType":return this.#l(t.pos,"wildcard types"),E;case"VoidType":return this.#e(t.pos,v.syntax,"\'void\' type not allowed here"),E;case"ArrayType":{let n=this.#J(t.element);return n.tag==="error"?E:Kt(n)}case"ClassType":{let n=t.names.join(".");if((n==="Object"||n==="java.lang.Object")&&!this.#ue(t.names))return t.hasTypeArguments?(this.#e(t.typeArgumentsPos??t.pos,v.syntax,"type Object does not take parameters"),E):G;if(n==="String"||n==="java.lang.String")return t.hasTypeArguments?(this.#e(t.typeArgumentsPos??t.pos,v.syntax,"type String does not take parameters"),E):ct;if(t.names.length===1){let o=this.#Js(n,t.pos);if(o)return t.hasTypeArguments?(this.#e(t.typeArgumentsPos??t.pos,v.syntax,`type ${n} does not take parameters`),E):o}let s=this.#ue(t.names)??this.#_t(t.names);if(s)return t.hasTypeArguments?this.#Ds(s,t):X(s);let r=this.#dt(t.names);if(r)return this.#Fs(r,t,e);let a=t.names.length===1?this.#u.get(n):void 0;return a?(this.#l(t.pos,`the class ${a}`,!0),E):t.names.length===1&&(Pn.has(n)||n===this.#js())?(this.#l(t.pos,`the type ${n}`,!0),E):t.names.length>1&&(t.names[0]==="java"||t.names[0]==="javax")?(this.#l(t.pos,`the type ${n}`,!0),E):t.names.length>1?(this.#e(t.lastDotPos??t.pos,v.cantResolve,`package ${t.names.slice(0,-1).join(".")} does not exist`),E):(this.#e(t.pos,v.cantResolve,"cannot find symbol",[` symbol: class ${n}`,` location: class ${this.#a.displayName}`]),E)}}}#Fs(t,e,n=!1){let s=t.typeParams;if(t.name==="Class"&&e.typeArguments)return this.#l(e.typeArgumentsPos??e.pos,"Class<...> types (declare the variable as Class)"),E;if(!e.typeArguments)return e.diamond?{tag:"diamond",symbol:t,fromArgs:null}:mt(t);if(e.typeArguments.length!==s.length)return this.#e(e.typeArgumentsPos??e.pos,v.syntax,s.length?`wrong number of type arguments; required ${s.length}`:`type ${t.name} does not take parameters`),E;let r=[];for(let a of e.typeArguments){let o=this.#Re(a);if(o.tag==="error")return E;r.push(o)}return mt(t,r)}#ue(t){let e=this.#le(t[0]);for(let n of t.slice(1))e=e?.membersByName.get(n)??null;return e}#js(){return this.#z.find(t=>t.declaration.implicit)?.name}#H(t,e,n){e.tag==="error"||n.tag==="error"||this.#e(t.pos,v.incompatibleTypes,`incompatible types: ${$e(n,e)}`,$t([e,n]))}#I(t,e){let n=this.#_s(t,e);return t.type=n,n}#Y(t,e){let n=this.#I(t,e);return n.tag==="void"?(this.#e(t.pos,v.incompatibleTypes,"\'void\' type not allowed here"),E):n}#_s(t,e){switch(t.kind){case"Literal":switch(t.literalKind){case"int":return t.constant=Q(t.value),U;case"char":return t.constant=Nn(t.value.charCodeAt(0)),Se;case"boolean":return t.constant=gt(t.value),ft;case"long":return t.constant=Nt(t.value),Lt;case"double":return t.constant=Qt(t.value),lt;case"float":return t.constant=ue(t.value),St;case"string":return t.constant=er(t.value),ct;case"null":return Zs;default:return this.#l(t.pos,`\'${t.literalKind}\' literals`),E}case"Name":return this.#Xs(t);case"Parenthesized":{let n=this.#I(t.expression,e);return t.expression.constant&&(t.constant=t.expression.constant),n}case"FieldAccess":return this.#Pn(t);case"MethodCall":{let n=this.#nr(t,e);return this.#De(t.args),n}case"Unary":return this.#gr(t);case"IncDec":return this.#Tr(t);case"Binary":return this.#Sr(t);case"Assignment":return this.#xr(t);case"ArrayAccess":return this.#vr(t);case"NewArray":return this.#wr(t);case"Cast":return this.#kr(t);case"This":return this.#Ks(t);case"NewObject":{let n=this.#or(t,e);return this.#De(t.args),n}case"Conditional":return this.#hr(t,e);case"SwitchExpression":return this.#An(t,e);case"Lambda":return this.#pn(t,e);case"MethodRef":return t.lambda?.method?e??E:this.#Bn(t,e);case"InstanceOf":return this.#Hs(t);case"Super":return this.#$n(t);case"ClassLiteral":return this.#Us(t)}}#Us(t){let e=this.#Ge(t.target);if(!("kind"in e))return e.tag!=="error"&&this.#e(t.target.pos,v.cantResolve,"cannot find symbol",[` symbol: class ${lr(t.target)??"?"}`,` location: class ${this.#a.displayName}`]),E;let n=s=>mt(oe("Class"),[s]);if(e.symbol)return t.className=e.symbol.binaryName,t.isInterface=e.symbol.isInterface,n(X(e.symbol));if(e.name==="String")return t.className="java.lang.String",n(ct);if(Pt[e.name]){let s=oe(e.name);return t.className=s.qualifiedName,t.isInterface=s.isInterface,n(mt(s))}return e.name==="Object"||e.name==="System"||e.name==="Math"?(t.className=`java.lang.${e.name}`,mt(oe("Class"))):(this.#l(t.pos,`the class literal ${e.name}.class`,!0),E)}#Nn(t,e){if(!e&&(this.#T||this.#P))return this.#Zt(t.selectPos,"non-static method getClass() cannot be referenced from a static context"),E;if(e||this.#Vt(),e&&Y(e))return this.#e(t.selectPos,v.cantResolve,`${P(e)} cannot be dereferenced`),E;let n=oe("Class");return t.libraryCall={native:"Object.getClass",isStatic:!1,params:[],returnsValue:!0,display:"Object.getClass()"},mt(n)}#$n(t){return t.qualifier?this.#Bs(t,t.qualifier):this.#T?(this.#Zt(t.pos,"non-static variable super cannot be referenced from a static context"),E):(this.#Vt(),this.#P?(this.#l(t.pos,"using \'super\' in the arguments of \'this(...)\' or \'super(...)\'",!0),E):this.#a.isInterface?(this.#l(t.pos,"\'super\' in an interface",!0),E):this.#a.superType??(this.#a.superclass?X(this.#a.superclass):G))}#Bs(t,e){let n=t.dotPos??t.pos,s=e.length===1?this.#le(e[0]):this.#un(this.#Vs(e,t.qualifierPos??t.pos));if(!s){let a=e[e.length-1];return Pt[a]||Pn.has(a)||this.#u.has(a)?(this.#l(t.qualifierPos??t.pos,`\'${a}.super\' of a library type`,!0),E):(this.#e(t.qualifierPos??t.pos,v.cantResolve,"cannot find symbol",[` symbol: class ${a}`,` location: class ${this.#a.displayName}`]),E)}let r=()=>(this.#e(n,v.cantResolve,`not an enclosing class: ${s.displayName}`),E);if(s.isInterface){if(this.#T||!this.#a.interfaces.includes(s))return r();let a=this.#a.interfaces.find(o=>o!==s&&on(o,s));return a?(this.#e(n,v.cantResolve,`bad type qualifier ${s.displayName} in default super call`,[` redundant interface ${s.displayName} is extended by ${a.displayName}`]),E):(this.#Vt(),this.#P?(this.#l(t.pos,"using \'super\' in the arguments of \'this(...)\' or \'super(...)\'",!0),E):(t.interfaceSymbol=s,X(s)))}if(s===this.#a){let a={...t};return delete a.qualifier,this.#$n(a)}for(let a=this.#a.outer;a;a=a.outer)if(a===s)return this.#l(t.qualifierPos??t.pos,`\'${s.displayName}.super\' of an enclosing class`,!0),E;return r()}#Vs(t,e){let n={kind:"Name",identifier:t[0],depth:1,pos:e,start:e,end:e};for(let s of t.slice(1))n={kind:"FieldAccess",target:n,name:s,namePos:e,depth:1,pos:e,start:e,end:e};return n}#Hs(t){if(t.recordPattern){let r=this.#Y(t.expression);if(r.tag==="error")return E;if(!this.#c)return this.#l(t.recordPattern.pos,"pattern variables in field initializers"),E;let a=[];return this.#on(t.recordPattern,r,!0,a)?(t.testedType=t.recordPattern.tested,t.patternBindings=a,ft):E}let e=this.#Y(t.expression),n=t.targetType.kind==="ClassType"&&!t.targetType.hasTypeArguments?this.#dt(t.targetType.names):null,s=n&&n.typeParams.length?mt(n):this.#J(t.targetType);if(e.tag==="error"||s.tag==="error")return E;if(Y(e)||Y(s))return Y(s)?this.#e(t.targetType.pos,v.syntax,"primitive patterns are a preview feature and are disabled by default.",[" (use --enable-preview to enable primitive patterns)"]):this.#e(t.expression.pos,v.incompatibleTypes,"unexpected type",[" required: reference",` found: ${P(e)}`]),E;if(s.tag==="library"&&s.args.some(r=>r.tag!=="wildcard"||r.bound!==null))return this.#l(t.targetType.pos,"instanceof with a generic type",!0),E;if(!Te(s,e))return this.#H(t.expression,e,s),E;if(t.testedType=s,t.binding){if(!this.#c)return this.#l(t.binding.pos,"pattern variables in field initializers"),E;t.binding.symbol=this.#ln(t.binding.name,s,t.binding.pos,t.binding.isFinal)}return ft}#on(t,e,n,s){let r=this.#Gs(t,e,n,s);return r||this.#Mn(t,s),r}#Mn(t,e){if(t.kind==="RecordPattern")return t.components.forEach(n=>this.#Mn(n,e));t.symbol||t.name==="_"||(t.symbol=this.#ln(t.name,E,t.namePos,t.isFinal),e.push(t.symbol))}#Gs(t,e,n,s){if(t.kind==="TypePattern"){let h;if(t.type===null)h=e;else{let d=t.type.kind==="ClassType"&&!t.type.hasTypeArguments?this.#dt(t.type.names):null;if(h=d&&d.typeParams.length?mt(d):this.#J(t.type,!0),h.tag==="error")return!1;if(n&&(Y(e)||Y(h))||!n&&Y(h)!==Y(e)||Y(h)&&!rt(h,e))return this.#e(t.pos,v.syntax,"primitive patterns are a preview feature and are disabled by default.",[" (use --enable-preview to enable primitive patterns)"]),!1;if(h.tag==="library"&&h.args.some(p=>p.tag!=="wildcard"||p.bound!==null))return this.#l(t.pos,"patterns of a parameterized type",!0),!1;if(!Y(h)&&!Te(h,e))return this.#H(t,e,h),!1}return t.tested=h,t.unconditional=Y(h)||H(q(e),q(h)),t.name!=="_"&&(t.symbol=this.#ln(t.name,h,t.namePos,t.isFinal),s.push(t.symbol)),!0}let r=this.#J(t.type,!0);if(r.tag==="error")return!1;if(r.tag!=="class"||!r.symbol.isRecord)return this.#e(t.pos,v.syntax,`deconstruction patterns can only be applied to records, ${P(r)} is not a record`),!1;let a=r.symbol,o=r;if(a.typeParams?.length&&!r.args?.length){let h=e.tag==="class"?ee(e,a):null;o=h?.args?.length?h:r}if(!Te(o,e))return this.#H(t,e,o),!1;let c=a.components,u=c.map(h=>Ie(Ce(o,a,h.type)));if(c.length!==t.components.length){let h=t.components.map(d=>d.kind==="TypePattern"&&d.type===null?"var":P(this.#zs(d)));return this.#e(t.pos,v.syntax,"incorrect number of nested patterns",[` required: ${u.map(P).join(",")}`,` found: ${h.join(",")}`]),!1}t.tested=o,t.accessors=c.map(h=>this.#Ct(a,h.name).find(d=>!d.isStatic&&d.params.length===0));let m=!0;return t.components.forEach((h,d)=>{this.#on(h,u[d],!1,s)||(m=!1)}),m}#zs(t){return t.type?this.#Hn(t.type):G}#ln(t,e,n,s){let r=this.#c;(this.#ft(t)||this.#yn(t))&&this.#e(n,v.alreadyDefined,`variable ${t} is already defined in ${r.isConstructor?"constructor":"method"} ${this.#Dt(r)}`);let a={kind:"local",name:t,type:e,index:r.locals.length,slot:this.#A,isFinal:s,declPos:n,binding:!0};return this.#A+=Me(e),r.maxSlots=Math.max(r.maxSlots,this.#A),r.locals.push(a),a}#it(t,e){switch(t.kind){case"Parenthesized":return this.#it(t.expression,e);case"Unary":return t.operator==="!"?this.#it(t.operand,!e):[];case"InstanceOf":return e?t.binding?.symbol?[t.binding.symbol]:t.patternBindings??[]:[];case"Binary":return t.operator==="&&"&&e?[...this.#it(t.left,!0),...this.#it(t.right,!0)]:t.operator==="||"&&!e?[...this.#it(t.left,!1),...this.#it(t.right,!1)]:[];default:return[]}}#Bt(t,e){if(!t.length)return e();this.#wt();let n=this.#C[this.#C.length-1];for(let a of t)n.names.set(a.name,a);let s=e(),r=this.#A;return this.#kt(),this.#A=r,s}#Je(t){let e=this.#C[this.#C.length-1];for(let n of t)e.names.has(n.name)||this.#ft(n.name)||(e.names.set(n.name,n),this.#f.push(n))}#Ks(t){return t.qualifier?this.#qs(t,t.qualifier):this.#T?(this.#Zt(t.pos,"non-static variable this cannot be referenced from a static context"),E):(this.#Vt(),this.#P?(this.#l(t.pos,"using \'this\' in the arguments of \'this(...)\'",!0),E):ce(this.#a))}#qs(t,e){let n=this.#ue(e),s=0,r=this.#a;for(;r&&r!==n;)r=r.outer,s++;return!n||!r?(this.#e(t.pos,v.syntax,`not an enclosing class: ${e[e.length-1]}`),E):this.#T||!this.#Be(s)?(this.#Zt(t.pos,"non-static variable this cannot be referenced from a static context"),E):(this.#Vt(),s&&(t.outerHops=s),ce(n))}#Ws(t,e){let n=t.captures?.find(m=>m.local.name===e);if(n)return n.field;let s=this.#q.get(t);if(!s)return null;let r;for(let m=s.scopes.length-1;m>=0&&!r;m--)r=s.scopes[m].names.get(e);if(!r)return null;let a=t.declaration.pos,o={name:`val$${e}`,extraDims:0,init:null,pos:a,start:a,end:a},c={kind:"FieldDeclaration",modifiers:{keywords:[]},type:{kind:"VoidType",pos:a,start:a,end:a},declarators:[o],pos:a,start:a,end:a},u={kind:"field",name:`val$${e}`,type:r.type,owner:t,isStatic:!1,isFinal:!0,isPrivate:!0,index:t.instanceCount++,order:t.fields.length,state:"done",declaration:c,declarator:o,capturedLocal:r};return t.fields.push(u),(t.captures??=[]).push({field:u,local:r}),u}#Xs(t){let e=this.#ft(t.identifier);if(e)return e.captureOf&&this.#Ot.push({local:e,pos:t.pos,top:this.#a.topLevel}),t.symbol=e,e.constant&&(t.constant=e.constant),e.type;let n=this.#Wt(t.identifier);if(n){let{field:r,hops:a}=n,o=this.#a;for(let u=0;u<a;u++)o=o.outer;if(r.isPrivate&&r.owner!==o&&!this.#Ts(r.owner,o))return this.#e(t.pos,v.cantResolve,`${r.name} has private access in ${r.owner.displayName}`),E;if(!r.isStatic){if(this.#T||!this.#Be(a))return this.#Zt(t.pos,`non-static variable ${r.name} cannot be referenced from a static context`),E;if(this.#Vt(),this.#P&&a===0)return this.#l(t.pos,"using the object\'s fields in the arguments of \'this(...)\'"),E}let c=this.#X??this.#gt;return a===0&&c&&!this.#Ht&&!r.capturedLocal&&r.owner===c.owner&&r.isStatic===c.isStatic&&r.order>=c.order?(this.#e(t.pos,v.syntax,r===c?"self-reference in initializer":"illegal forward reference"),E):(t.symbol=r,a>0&&!r.isStatic&&(t.outerHops=a),r.capturedLocal&&this.#Ot.push({local:r.capturedLocal,pos:t.pos,top:this.#a.topLevel,inner:!0}),this.#cn(t,r,r.isStatic?void 0:ce(o)))}let s=this.#Rt(t);if(s==="error")return E;if(s){t.imported=s;let r=this.#Pn(s);return s.type=r,s.constant&&(t.constant=s.constant),r}return this.#rt(t.identifier,t.pos)?E:(this.#e(t.pos,v.cantResolve,"cannot find symbol",[` symbol: variable ${t.identifier}`,` location: class ${this.#a.displayName}`]),E)}#cn(t,e,n){if(e.isFinal&&e.state==="pending"&&this.#En(e),e.constant&&(t.constant=e.constant),!n)return e.type;let s=Ie(Ce(n,e.owner,e.type));return qi(t,e.type,s),s}#Ge(t){if(t.kind==="Name"&&t.staticOwner)return t.symbol={kind:"type",name:t.identifier},{kind:"type",name:t.identifier,qualified:!0};if(t.kind==="Name"&&!this.#ft(t.identifier)&&!this.#Wt(t.identifier)&&this.#Kt(t.identifier,this.#zt).length)return this.#I(t);if(t.kind==="Name"&&!this.#ft(t.identifier)&&!this.#Wt(t.identifier)){let e=t.identifier,n=this.#le(e);if(n)return t.symbol={kind:"type",name:e,symbol:n},{kind:"type",name:e,symbol:n};let s=this.#_t([e]);if(s)return t.symbol={kind:"type",name:e,symbol:s},{kind:"type",name:e,symbol:s};if(e==="System"||e==="String"||Pn.has(e)||Pt[e]&&this.#ze(e))return t.symbol={kind:"type",name:e},{kind:"type",name:e};if(this.#u.get(e))return t.symbol={kind:"type",name:e},{kind:"type",name:e}}if(t.kind==="FieldAccess"){if(t.target.kind==="Name"&&jt[t.name]===t.target.identifier&&!this.#ft(t.target.identifier)&&this.#ze(t.target.identifier))return{kind:"type",name:t.name,qualified:!0};let e=lr(t.target);if((e==="java.util"||e==="java.lang")&&!this.#ft("java")&&!this.#Wt("java")&&(Pt[t.name]===e||e==="java.lang"&&(t.name==="Math"||t.name==="System"||t.name==="String")))return{kind:"type",name:t.name,qualified:!0};let n=this.#un(t.target),s=n?.membersByName.get(t.name);if(n&&s&&!n.fieldsByName.has(t.name))return t.typeSymbol=s,{kind:"type",name:s.name,symbol:s}}return this.#I(t)}#ze(t){let e=Pt[t];return jt[t]?this.#Z.has(t):e==="java.lang"||this.#Z.has(t)||e!==void 0&&this.#r.has(e)||this.#z[0]?.declaration.implicit===!0}#un(t){if(t.kind==="Name"&&!this.#ft(t.identifier)&&!this.#Wt(t.identifier)){let e=this.#le(t.identifier);return e&&(t.symbol={kind:"type",name:t.identifier,symbol:e}),e}if(t.kind==="FieldAccess"){let e=this.#un(t.target),n=e?.membersByName.get(t.name);if(e&&n&&!e.fieldsByName.has(t.name))return t.typeSymbol=n,n}return null}#ke(t,e){if(!t)return` location: class ${this.#a.displayName}`;let n=ht(t);return n.kind==="Name"&&n.symbol?.kind==="local"?` location: variable ${n.identifier} of type ${P(e)}`:n.kind==="Name"&&n.symbol?.kind==="field"?` location: variable ${n.identifier} of type ${P(e)}`:n.kind==="FieldAccess"&&(n.field&&n.field!=="length"||n.fieldSymbol)?` location: variable ${n.name} of type ${P(e)}`:` location: class ${P(e)}`}#he(t,e,n){return!t.isPrivate||t.owner.topLevel===this.#a.topLevel?!0:(this.#e(e,v.cantResolve,`${n} has private access in ${t.owner.displayName}`),!1)}#Pn(t){let e=ht(t.target);if(e.kind==="Super"&&e.qualifier){if(this.#I(e).tag==="error")return E;if(e.interfaceSymbol)return this.#e(e.dotPos??e.pos,v.cantResolve,`not an enclosing class: ${e.interfaceSymbol.displayName}`),E}let n=this.#Ge(t.target);if("kind"in n&&n.kind==="type"){if(n.symbol){let m=n.symbol,h=this.#Me(m,t.name);return h?h.isPrivate&&h.owner!==m?(this.#e(t.pos,v.cantResolve,`${h.name} has private access in ${h.owner.displayName}`),E):h.isStatic?this.#he(h,t.pos,h.name)?(t.fieldSymbol=h,this.#cn(t,h)):E:(this.#Zt(t.pos,`non-static variable ${h.name} cannot be referenced from a static context`),E):(this.#e(t.pos,v.cantResolve,"cannot find symbol",[` symbol: variable ${t.name}`,` location: class ${m.displayName}`]),E)}if(n.name==="System")return t.name==="out"||t.name==="err"?(t.field=t.name==="out"?"System.out":"System.err",Pi):t.name==="in"?(t.field="System.in",mt(le("InputStream"))):(this.#e(t.pos,v.cantResolve,"cannot find symbol",[` symbol: variable ${t.name}`," location: class System"]),E);let a=Object.hasOwn(fs,n.name)?fs[n.name]:{},o=Object.hasOwn(a,t.name)?a[t.name]:void 0;if(o)return t.constant=o.constant,o.type;let c=Pt[n.name]?this.#dt([n.name]):null,u=c?.staticFields&&Object.hasOwn(c.staticFields,t.name)?c.staticFields[t.name]:void 0;return c&&u?(t.libraryField=`${c.name}.${t.name}`,u):(this.#l(t.pos,`the field ${n.name}.${t.name}`,!0),E)}let s=n,r=s.tag==="typevar"&&s.symbol?s.symbol.bounds.find(a=>a.tag==="class")??G:s;switch(r.tag){case"error":return E;case"class":{let a=this.#Me(r.symbol,t.name);if(a)return a.isPrivate&&a.owner!==r.symbol?(this.#e(t.pos,v.cantResolve,`${a.name} has private access in ${a.owner.displayName}`),E):this.#he(a,t.pos,a.name)?(t.fieldSymbol=a,this.#cn(t,a,a.isStatic?void 0:s)):E;break}case"library":{let a=r.symbol.instanceFields;if(a&&Object.hasOwn(a,t.name))return t.libraryField=`${r.symbol.name}#${t.name}`,a[t.name];break}case"null":return this.#e(t.pos,v.cantResolve,"<null> cannot be dereferenced"),E;case"array":if(t.name==="length")return t.field="length",U;break;default:if(Y(s)||s.tag==="void")return this.#e(t.pos,v.cantResolve,`${P(s)} cannot be dereferenced`),E}return this.#e(t.pos,v.cantResolve,"cannot find symbol",[` symbol: variable ${t.name}`,this.#ke(t.target,s),...$t([s])]),E}#Yt(t){return t.map(e=>{let n=ht(e);if(n.kind==="MethodRef")return{tag:"lambda",arity:this.#qe(n)?.params.length??-1,text:as(n)};if(n.kind==="Lambda")return{tag:"lambda",arity:n.params.length,text:as(n)};let s=this.#Rn(e);if(s)return this.#S.add(e),{tag:"diamond",symbol:s,fromArgs:null};let r=n.kind==="NewObject"&&n.body&&n.classType.kind==="ClassType"&&n.classType.diamond?this.#dt(n.classType.names):null;if(r)return this.#S.add(e),{tag:"diamond",symbol:r,fromArgs:null};this.#R=e;let a=this.#Y(e),o=this.#et.get(n);if(!o||a.tag!=="library"||n.kind!=="MethodCall")return a;let c=new Map;return this.#Qt(o.method,o.types,c),{...a,args:a.args.map((u,m)=>{let h=o.method.returnType.tag==="library"?o.method.returnType.args[m]:void 0;if(!o.flags[m]||h?.tag!=="typevar")return u;let d=_n([h],o.symbol,Yi(o.symbol,o.method,o.types.length));return{tag:"wildcard",bound:u,poly:{name:h.name,lows:c.get(h.name)??[],where:d}}})}})}#Rn(t){if(t.kind!=="MethodCall")return null;let e;if(t.target){let a=ze(t.target);if(!a||this.#ft(a[0])||this.#Wt(a[0]))return null;e=a.length===2&&jt[a[1]]===a[0]&&this.#ze(a[0])?oe(a[1])??null:this.#dt(a)}else{let a=this.#y.size||this.#s.length?this.#Kt(t.name,this.#Q):[];if(a.length!==1||this.#$t(t.name))return null;e=this.#At(a[0])}if(!e)return null;let n=e.methods.filter(a=>a.name===t.name&&a.isStatic);if(!n.length||n.some(a=>!a.typeParams?.length))return null;let s=n[0].returnType;return s.tag!=="library"||n.some(a=>a.returnType.tag!=="library"||a.returnType.symbol!==s.symbol)?null:t.args.length===0||t.args.some(a=>{let o=ht(a);return o.kind==="Lambda"&&o.params.some(c=>!c.type)||o.kind==="MethodRef"&&(!this.#qe(o)||this.#Dn(o))||this.#Rn(o)!==null})?s.symbol:null}#De(t){for(let e of t)this.#S.has(e)&&(this.#S.delete(e),e.type=this.#I(e))}#jt(t,e){return`${t}(${e.map(P).join(",")})`}#Ys(t,e,n=ce(t)){let s=this.#Ct(t,e).map(a=>{let o=c=>a.isStatic?c:Ie(Ce(n,a.owner,c));return{owner:a.owner.displayName,name:a.name,params:a.params.map(o),returnType:o(a.returnType),method:a,...Wi(a)?{varargs:!0}:{}}}),r=Ee[e];return r&&Object.hasOwn(Ee,e)&&!s.some(a=>a.params.length===r.params.length&&a.params.every((o,c)=>rt(o,r.params[c])))&&s.push(r),s}#hn(t,e,n){return!t.builtin||t.constructors.some(s=>s.params.length===e)?!1:(this.#l(n,`this ${t.name} constructor`,!0),!0)}#Qs(t,e){if(!this.#xt(X(t)))return null;let n=this.#Ct(t,e.name);return(e.name==="getStackTrace"||e.name==="setStackTrace")&&!n.length?`the method Throwable.${e.name}()`:e.name==="printStackTrace"&&e.args.length&&!n.some(s=>s.params.length===e.args.length)?"printStackTrace to a stream":null}#Fe(t,e){let n=t.isEnum?"enum":t.isRecord?"record":"class",s=e?.tag==="class"?En(e):new Map,r=e!==void 0&&An(e);return t.constructors.map(a=>({owner:t.displayName,ownerKind:n,name:t.name,params:a.params.map(o=>r?q(o):Bt(o,s)),returnType:Tt,method:a,...Wi(a)?{varargs:!0}:{}}))}#Ce(t,e){if(!t.expanded||!t.method)return;let n=t.params[t.params.length-1],s=n.element;return!gn(n)&&!this.#Tt(t.method.declaration.modifiers,"SafeVarargs")&&this.#st(e,"unchecked",`unchecked generic array creation for varargs parameter of type ${P(n)}`,$t([n])),{from:t.params.length-1,element:s}}#Zs(t,e,n,s,r,a){let o=t.method?.typeParams;if(!o)return t;let c=o.map(h=>h.key),u=new Map,m=new Map;if(n){if(n.length!==o.length)return{...t,shown:t.params,problem:{reason:`wrong number of type arguments; required ${o.length}`,alone:!0}};o.forEach((h,d)=>u.set(h.key,n[d]))}else{Ki(c,Xi(t,e),e,u,m);let h=[...m.keys()].filter(d=>!u.has(d));for(let[d,p]of m)u.has(d)||u.set(d,p.reduce(ar));if(s&&(t.returnType.tag==="library"||t.returnType.tag==="class")){let d=new Map;bt(t.returnType,s,d);for(let p of h){let C=d.get(p);!C||C===On||C.tag==="wildcard"||C.tag==="typevar"&&!C.symbol||m.get(p).every(S=>H(S,C))&&u.set(p,C)}}r.forEach((d,p)=>{let C=ht(d),S=C.kind==="MethodRef"&&t.params[p]?ys(Bt(t.params[p],u)):null;if(!S||C.kind!=="MethodRef")return;let k=this.#qe(C,S.params[0]&&!se(S.params[0],c)?S.params[0]:void 0);k&&(k.params.forEach((x,w)=>S.params[w]&&bt(S.params[w],qt(x)??x,u)),k.returnType.tag!=="void"&&bt(S.returnType,qt(k.returnType)??k.returnType,u))}),a&&o.some(d=>!u.has(d.key))&&this.#tr(t.params,r,u,c),s&&t.returnType.tag!=="void"&&o.some(d=>!u.has(d.key))&&bt(t.returnType,s,u);for(let d of o){let p=u.get(d.key);if(!p||d.bounds.every(x=>H(p,Bt(x,u))))continue;let C=m.get(d.key)??[p],S=`inference variable ${d.name} has incompatible bounds`,k=C.length>1&&d.bounds.some(x=>se(x,[d.key]))?[S,` equality constraints: ${C.map(P).join(",")}`,` lower bounds: ${[...C].reverse().map(P).join(",")}`]:[S,` upper bounds: ${d.bounds.map(P).join(",")}`,` lower bounds: ${C.map(P).join(",")}`];return{...t,shown:t.params,problem:{reason:k.join(`\n`)}}}}for(let h of o)u.has(h.key)||u.set(h.key,q(xe(h)));return{...t,shown:t.params,params:t.params.map(h=>Bt(h,u)),returnType:Bt(t.returnType,u)}}#tr(t,e,n,s){let r=a=>se(a,s.filter(o=>!n.has(o)));e.forEach((a,o)=>{let c=ht(a);if(c.kind!=="Lambda"||c.method||!t[o])return;let u=Bt(t[o],n),m=this.#mn(u);if("problem"in m||m.params.some(r)||!r(m.returnType))return;this.#pn(c,u,s.filter(d=>!n.has(d)));let h=c.method?.returnType;h&&h.tag!=="error"&&h.tag!=="void"&&bt(m.returnType,qt(h)??h,n)})}#er(t){let e=0;for(let n=this.#a;n;n=n.outer,e++)if(this.#Ct(n,t).length||Object.hasOwn(Ee,t))return{owner:n,hops:e};return{owner:this.#a,hops:0}}#nr(t,e){let n=null,s=t.target===null?this.#Yt(t.args):null;if(s&&(this.#y.size||this.#s.length)&&!s.some(d=>d.tag==="error")&&!this.#Mt(t,s))return E;t.target&&(n=this.#Ge(t.target));let r=s??this.#Yt(t.args);if(r.some(d=>d.tag==="error")||n&&"tag"in n&&n.tag==="error")return E;let a=t.typeArguments?t.typeArguments.map(d=>this.#Re(d)):null;if(a?.some(d=>d.tag==="error"))return E;let o=n;if(n&&"tag"in n&&n.tag==="typevar"&&n.symbol){let d=C=>C.tag==="class"&&this.#Ct(C.symbol,t.name).length>0||C.tag==="library"&&C.symbol.methods.some(S=>S.name===t.name),p=n.symbol.bounds.find(d)??(Object.hasOwn(Ee,t.name)?G:null);if(!p)return this.#e(t.selectPos,v.cantResolve,"cannot find symbol",[` symbol: method ${this.#jt(t.name,r)}`,this.#ke(t.target,n),...$t([n,...r])]),E;n=p}if(t.name==="getClass"&&!r.length&&(n===null||"tag"in n)&&!(n===null&&this.#Ct(this.#a,"getClass").length))return this.#Nn(t,n);let c=n===null?this.#a.isEnum:"tag"in n&&n.tag==="class"&&n.symbol.isEnum;if(t.name==="getDeclaringClass"&&!r.length&&c){let d=this.#Nn(t,n);return t.libraryCall&&(t.libraryCall.native="Enum.getDeclaringClass",t.libraryCall.display=`${n?.symbol.binaryName??this.#a.binaryName}.getDeclaringClass()`),d}let u=n!==null&&"kind"in n&&n.symbol!==void 0,m=n!==null&&"tag"in n&&n.tag==="class";if(!n||u||m){let d,p=0;if(n?d=n.symbol:{owner:d,hops:p}=this.#er(t.name),ps.has(t.name)&&!this.#Ct(d,t.name).length)return this.#l(t.selectPos,`the method Object.${t.name}()`,!0),E;let C=this.#Qs(d,t);if(C)return this.#l(t.selectPos,C,!0),E;let S=m?o:ce(d),k=this.#Ys(d,t.name,S),x=k.map(N=>this.#Zs(N,r,a,e,t.args,k.length===1)),w=t.target?ht(t.target):null,I=w?.kind==="Super"?w.interfaceSymbol:void 0;if(!x.length&&I)return this.#e(t.selectPos,v.cantResolve,"cannot find symbol",[` symbol: method ${this.#jt(t.name,r)}`]),E;if(!x.length){let N=this.#Ss(d,t.name);if(N)return this.#e(t.selectPos,v.cantResolve,`${t.name}(${N.params.map(P).join(",")}) has private access in ${N.owner.displayName}`),E;if(!n&&this.#rt(t.name,t.selectPos))return E;let B=u?` location: class ${d.displayName}`:n?this.#ke(t.target,n):` location: class ${this.#a.displayName}`;return this.#e(t.selectPos,v.cantResolve,"cannot find symbol",[` symbol: method ${this.#jt(t.name,r)}`,B,...$t([...m?[n]:[],...r])]),E}let L=this.#at({pos:t.selectPos,name:t.name},x,r,"method");if(!L)return E;let $=L.method?L.method.isStatic:!1;if(I&&$)return this.#e(t.pos,v.cantResolve,"illegal static interface method call",[` the receiver expression should be replaced with the type qualifier \'${I.displayName}\'`]),E;let O=u||!n&&(this.#T||!this.#Be(p));if(!$&&O)return this.#Zt(t.selectPos,`non-static method ${t.name}(${L.params.map(P).join(",")}) cannot be referenced from a static context`),E;if(!$&&!n&&this.#Vt(),!$&&!n&&this.#P&&p===0)return this.#l(t.selectPos,"calling the object\'s methods in the arguments of \'this(...)\'"),E;let R=t.target!==null&&ht(t.target).kind==="Super";if(L.method){if(!this.#he(L.method,t.selectPos,`${t.name}(${L.params.map(P).join(",")})`))return E;if(R&&L.method.isAbstract)return this.#e(t.selectPos,v.syntax,`abstract method ${this.#Dt(L.method)} in ${L.method.owner.displayName} cannot be accessed directly`),E;if(u&&L.method.isStatic&&L.method.owner.isInterface&&L.method.owner!==d)return this.#e(t.selectPos,v.cantResolve,"cannot find symbol",[` symbol: method ${this.#jt(t.name,r)}`,` location: class ${d.displayName}`]),E;this.#de(t.args,L.params),t.method=L.method;let N=this.#Ce(L,t.pos);N&&(t.varargs=N);let B=L.method.params;m&&An(o)&&B.some(J=>Bn([J]).some(F=>F.ofClass))&&this.#st(t.pos,"unchecked",`unchecked call to ${this.#Dt(L.method)} as a member of the raw type ${P(o)}`,$t(B)),this.#Jn(t.pos,`method ${t.name} in ${d.isInterface?"interface":"class"} ${d.displayName}`,B,L.params,r,t.args,$t),this.#Ke(t.args,B.map(q)),t.qualifier=L.method.isStatic?L.method.owner.binaryName:d.binaryName}else t.objectMethod=L.objectMethod,t.qualifier=d.isInterface&&!R?d.binaryName:"Object";return R&&(t.isSuper=!0),!n&&p>0&&!$&&(t.outerHops=p),L.method&&qi(t,L.method.returnType,L.returnType),L.returnType}if("kind"in n&&n.name==="IO")return this.#fr(t,r);if("kind"in n&&n.name==="Math"&&Object.hasOwn(Rn,t.name))return this.#dr(t,r);if("kind"in n&&!n.symbol&&(n.name==="Math"||n.name==="String"))return this.#je(t,le(n.name),null,r,e);if("kind"in n&&this.#u.has(n.name))return this.#l(t.target.pos,`the class ${this.#u.get(n.name)}`,!0),E;if("kind"in n&&Pt[n.name]&&(n.qualified||this.#ze(n.name)))return this.#je(t,oe(n.name),null,r,e);if("kind"in n)return n.name==="System"&&!n.symbol?_i.has(t.name)?this.#je(t,le("System"),null,r,e):(this.#e(t.selectPos,v.cantResolve,"cannot find symbol",[` symbol: method ${this.#jt(t.name,r)}`," location: class System"]),E):(this.#l(t.selectPos,`${n.name}.${t.name}()`,!0),E);let h=n.tag==="diamond"?this.#fn(n):n;switch(h.tag){case"null":return this.#e(t.selectPos,v.cantResolve,"<null> cannot be dereferenced"),E;case"printstream":return this.#yr(t,h,r);case"library":return this.#je(t,h.symbol,h,r,e);case"string":{let d=Object.hasOwn(Dn,t.name)?Dn[t.name]:void 0;if(d){let p=this.#at({pos:t.selectPos,name:t.name},[d],r,"method");return p?(t.stringMethod=t.name,p.returnType):E}if(lo.has(t.name)){let p=le("String");return this.#je(t,p,mt(p),r,e)}break}case"object":case"array":{let d=Object.hasOwn(Ee,t.name)?Ee[t.name]:void 0;if(d){let p=this.#at({pos:t.selectPos,name:t.name},[d],r,"method");return p?(t.objectMethod=p.objectMethod,t.qualifier="Object",ht(t.target).kind==="Super"&&(t.isSuper=!0),p.returnType):E}if(ps.has(t.name)||h.tag==="array"&&uo.has(t.name))return this.#l(t.selectPos,h.tag==="array"?`the array method ${t.name}()`:`the method Object.${t.name}()`,!0),E;break}default:if(Y(h)||h.tag==="void")return this.#e(t.selectPos,v.cantResolve,`${P(h)} cannot be dereferenced`),E}return this.#e(t.selectPos,v.cantResolve,"cannot find symbol",[` symbol: method ${this.#jt(t.name,r)}`,this.#ke(t.target,h)]),E}#je(t,e,n,s,r){let a=n?n.args:[],o=n!==null&&!n.args.length&&e.typeParams.length>0,c=e.methods.filter(N=>N.name===t.name);if(!c.length&&(e.unsupported.has(t.name)||ps.has(t.name)))return this.#l(t.selectPos,`the ${e.name} method ${t.name}()`,!0),E;if(!c.length){let N=n?this.#ke(t.target,n):` location: class ${e.name}`;return this.#e(t.selectPos,v.cantResolve,"cannot find symbol",[` symbol: method ${this.#jt(t.name,s)}`,N]),E}let u=t.typeArguments?t.typeArguments.map(N=>this.#Re(N)):null,m=N=>u!==null&&u.length===(N.typeParams?.length??0)&&u.length>0,h=c.map(N=>{let B=[...N.isStatic?[]:e.typeParams,...N.typeParams??[]],J=u&&u.length===(N.typeParams?.length??0)?u:this.#rr(N,s),F=[...N.isStatic?[]:a.map(Oo),...J],K=[...N.isStatic?[]:a.map(Ie),...J],dt=o&&!N.isStatic;return{owner:N.owner,name:N.name,params:N.params.map(Wt=>dt?q(Wt):At(Wt,B,F)),returnType:dt?q(N.returnType):At(N.returnType,B,K),library:N,...N.varargs?{varargs:!0}:{}}}),d=this.#at({pos:t.selectPos,name:t.name,imported:Ui(t)},h,s,"method");if(!d)return E;let p=d.library,C=this.#Qt(p,s),S=!o&&s.some((N,B)=>p.params[B]!==void 0&&pn(p.params[B],N));if(p.comparableParams&&!S&&p.comparableParams.some(N=>C.has(N)&&!ea(C.get(N))))return this.#l(t.selectPos,`${e.name}.${t.name}() of elements that are not Comparable`,!0),E;if(!p.native)return this.#l(t.selectPos,`${e.name}.${t.name}(${p.params.map(bn).join(", ")})`,!0),E;if(!p.isStatic&&!n)return this.#e(t.selectPos,v.cantResolve,`non-static method ${t.name}(${d.params.map(P).join(",")}) cannot be referenced from a static context`),E;let k=!o&&p.typeParams?.length&&!m(p)&&t.args.some(N=>["Lambda","MethodRef"].includes(ht(N).kind)||this.#S.has(N)),x=t.args.filter(N=>this.#S.has(N)),w=k?this.#sr(p,e,a,t.args,s,r,d.params):null,I=!k&&p.isStatic&&p.typeParams?.length&&!m(p)&&r?this.#Fn(t,e,p,s,r):null;if(!k&&!r&&p.isStatic&&p.typeParams?.length&&!m(p)&&p.returnType.tag==="library"){let N=new Map;this.#Qt(p,s,N);let B=p.returnType.args.map(J=>J.tag==="typevar"&&!J.symbol&&N.has(J.name));B.some(Boolean)&&this.#et.set(t,{flags:B,symbol:e,method:p,types:s})}if(I==="error")return E;let L=I?p.typeParams.map(N=>I.get(N)??G):[];I&&(d.params=d.params.map((N,B)=>At(p.params[Math.min(B,p.params.length-1)],p.typeParams,L))),this.#de(t.args,w?w.params:d.params),t.libraryCall=this.#dn(p,n??mt(e),d.params),d.expanded&&(t.libraryCall.varargsFrom=d.params.length-1);let $=N=>_n(N,e,p);if(o&&!p.isStatic&&p.params.some(N=>se(N,null))&&this.#st(t.pos,"unchecked",`unchecked call to ${p.name}(${p.params.map(P).join(",")}) as a member of the raw type ${e.name}`,$(p.params)),this.#Jn(t.pos,`method ${p.name} in ${e.isInterface?"interface":"class"} ${e.name}`,p.params,d.params,s,t.args,$),this.#Ke(t.args,p.params.map(q)),o)return Ie(d.returnType);if(S)return q(p.isStatic?p.returnType:Xt(p.returnType,e.typeParams,a));let O=m(p)?d.returnType:I?At(p.returnType,p.typeParams,L):w?.returnType??this.#jn(p,e,a,s,r)??d.returnType;if(p.typeParams?.length&&x.length&&!m(p)){let N=new Map(w?.bound??this.#Qt(p,s)),B=p.isStatic?p.returnType:Xt(p.returnType,e.typeParams,a);if(r?.tag==="library"&&B.tag==="library"){let J=_t(B,r.symbol);J&&J.args.forEach((F,K)=>fe(r.args[K])&&bt(F,fe(r.args[K]),N))}t.args.forEach((J,F)=>x.includes(J)&&J.type&&bt(p.params[Math.min(F,p.params.length-1)],J.type,N)),O=this.#jn(p,e,a,s,r,N)??O}let R=O.tag==="typevar"&&!O.symbol?G:Ie(O);return p.returnType.tag==="typevar"&&Ao(R)&&(t.genericCast=q(R)),R}#Jn(t,e,n,s,r,a,o){let c=r.map((u,m)=>s[m]!==void 0&&(!ve(s[m],u)||n[m]!==void 0)&&pn(n[m]??s[m],u));c.some(Boolean)&&(this.#st(t,"unchecked",`unchecked method invocation: ${e} is applied to given types`,[` required: ${n.map(P).join(",")}`,` found: ${r.map(P).join(",")}`,...o([...n,...r])]),c.forEach((u,m)=>{u&&this.#st(a[m].pos,"unchecked","unchecked conversion",[` required: ${P(n[m])}`,` found: ${P(r[m])}`,...o([n[m],r[m]])])}))}#Ke(t,e){t.forEach((n,s)=>{e[Math.min(s,e.length-1)]?.tag==="object"&&delete ht(n).genericCast})}#sr(t,e,n,s,r,a,o){let c=t.typeParams,u=O=>t.isStatic?O:Xt(O,e.typeParams,n),m=O=>u(t.params[Math.min(O,t.params.length-1)]),h=this.#Qt(t,r),d=O=>se(O,c.filter(R=>!h.has(R))),p=(O,R)=>{let N=R.params[0]&&!d(R.params[0])?R.params[0]:void 0;if(!N&&this.#Dn(O))return!1;let B=this.#qe(O,N);return B&&(B.params.forEach((J,F)=>R.params[F]&&bt(R.params[F],J,h)),B.returnType.tag!=="void"&&bt(R.returnType,qt(B.returnType)??B.returnType,h)),!0},C=[];s.forEach((O,R)=>{let N=ht(O),B=ys(m(R));B&&(N.kind==="MethodRef"?p(N,B)||C.push(R):N.kind==="Lambda"&&N.params.length&&N.params.every(J=>J.type)&&N.params.forEach((J,F)=>{let K=this.#J(J.type);K.tag!=="error"&&B.params[F]&&bt(B.params[F],K,h)}))});let S=u(t.returnType);if(a?.tag==="library"&&S.tag==="library"){let O=_t(S,a.symbol);O&&O.args.forEach((R,N)=>fe(a.args[N])&&bt(R,fe(a.args[N]),h))}for(let O of C){let R=c.filter(B=>h.has(B)),N=ys(Xt(m(O),R,R.map(B=>h.get(B))));N&&p(ht(s[O]),N)}let k=()=>c.filter(O=>h.has(O)),x=O=>Xt(m(O),k(),k().map(R=>h.get(R)));s.forEach((O,R)=>{this.#S.has(O)&&(this.#S.delete(O),O.type=this.#I(O,x(R)),O.type.tag!=="error"&&bt(m(R),O.type,h))});let w=new Map;s.forEach((O,R)=>{let N=ht(O);if(N.kind==="Lambda"?N.method:N.kind!=="MethodRef"||N.lambda)return;let B=x(R),J=ys(B);if(!J||J.params.some(d)||!d(J.returnType))return;let F;N.kind==="Lambda"?(this.#pn(N,B,!0),F=N.method?.returnType):N.kind==="MethodRef"&&(this.#Bn(N,B,!0),F=N.lambda?.method?.returnType),F?.tag==="diamond"&&J.returnType.tag==="typevar"?w.set(J.returnType.name,F):F&&F.tag!=="error"&&F.tag!=="void"&&bt(J.returnType,qt(F)??F,h)});for(let[O,R]of w){if(h.has(O))continue;let N=t.typeParamBounds?.[O],B=c.filter(K=>h.has(K)),J=N?Xt(u(N),B,B.map(K=>h.get(K))):void 0,F=gs(R.symbol,J);h.set(O,mt(R.symbol,R.symbol.typeParams.map(K=>F.get(K)??G)))}let I=c.map(O=>h.get(O)??G),L=O=>At(u(O),c,I);return{params:o.map((O,R)=>L(t.params[Math.min(R,t.params.length-1)])),returnType:L(t.returnType),bound:h}}#Dn(t){if(!t.target||t.name==="new"||t.arrayType)return!1;let e=ze(t.target);if(!e||this.#ft(e[0])||this.#Wt(e[0]))return!1;let n=this.#ue(e);return n!==null&&(n.typeParams?.length??0)>0&&this.#Ct(n,t.name).some(s=>!s.isStatic)}#qe(t,e){if(t.arrayType){let c=this.#J(t.arrayType);return c.tag==="error"?null:{params:[U],returnType:c}}if(!t.target||t.name==="new")return null;let n=ze(t.target);if(!n||this.#ft(n[0])||this.#Wt(n[0]))return null;let s=this.#ue(n);if(s){let c=this.#Ct(s,t.name);if(c.length!==1||c[0].declaration.params.some(m=>m.varargs)||c[0].typeParams?.length)return null;let u=c[0];if(u.isStatic)return{params:u.params,returnType:u.returnType};if(s.typeParams?.length&&e){let m=ee(e,s);if(!m?.args?.length)return null;let h=d=>Ie(Ce(m,u.owner,d));return{params:[m,...u.params.map(h)],returnType:h(u.returnType)}}return{params:[X(s),...u.params],returnType:u.returnType}}if(n.length===1&&n[0]==="String"){if(Object.hasOwn(Dn,t.name))return{params:[ct,...Dn[t.name].params],returnType:Dn[t.name].returnType};let c=le("String").methods.filter(u=>u.name===t.name);return c.length!==1||c[0].varargs?null:{params:c[0].isStatic?c[0].params:[ct,...c[0].params],returnType:c[0].returnType}}let r=this.#dt(n);if(!r)return null;let a=r.methods.filter(c=>c.name===t.name);if(a.length!==1||a[0].varargs||a[0].typeParams?.length||r.typeParams.length)return null;let o=a[0];return{params:o.isStatic?o.params:[mt(r),...o.params],returnType:o.returnType}}#Qt(t,e,n){let s=new Map,r=new Map,a=(u,m)=>{if(u.tag==="typevar"&&!u.symbol&&t.typeParams?.includes(u.name)&&m&&m.tag!=="wildcard"){if(m.tag==="null"||m.tag==="diamond"||m.tag==="lambda"||m.tag==="error"||m.tag==="typevar"&&!m.symbol)return;let h=tt(m)?hr(m):qt(m);h&&r.set(u.name,[...r.get(u.name)??[],h]);return}bt(u,m,s)},o=t.params,c=t.varargs?o.length-1:o.length;for(let u=0;u<c;u++)a(o[u],e[u]);if(t.varargs){let u=o[o.length-1],m=e.slice(c);if(m.length===1&&m[0].tag==="array"&&tt(m[0].element))bt(u,m[0],s);else for(let d of m)a(u.element,d)}for(let[u,m]of r)s.has(u)||(s.set(u,m.reduce(ar)),n?.set(u,m));return s}#Fn(t,e,n,s,r,a=!1){let o=n.returnType;if(r.tag!=="library"||o.tag!=="library")return null;let c=_t(o,r.symbol);if(!c)return null;let u=new Map,m=this.#Qt(n,s,u),h=!1;for(let[d,p]of c.args.entries()){let C=r.args[d];if(p.tag!=="typevar"||p.symbol||!u.has(p.name)||!C||C.tag==="wildcard"||C.tag==="typevar"&&!C.symbol)continue;let S=u.get(p.name);if(S.some(k=>!H(k,C))){if(a)return null;let k=S.filter((x,w)=>S.findIndex(I=>rt(I,x))===w);return this.#e(t.pos,v.incompatibleTypes,`incompatible types: inference variable ${p.name} has incompatible bounds`,[` equality constraints: ${P(C)}`,` lower bounds: ${[...k].reverse().map(P).join(",")}`,..._n([p],e,Yi(e,n,s.length))]),"error"}rt(m.get(p.name),C)||(m.set(p.name,C),h=!0)}return h?m:null}#rr(t,e){if(!t.typeParams)return[];let n=this.#Qt(t,e);return t.typeParams.map(s=>n.get(s)??G)}#jn(t,e,n,s,r,a){if(!t.typeParams)return null;let o=a??this.#Qt(t,s),c=t.isStatic?t.returnType:Xt(t.returnType,e.typeParams,n);if(t.typeParams.every(d=>o.has(d)))return a?At(c,t.typeParams,t.typeParams.map(d=>o.get(d))):null;if(r?.tag==="library"&&c.tag==="library"){let d=_t(c,r.symbol);d&&d.args.forEach((p,C)=>fe(r.args[C])&&bt(p,fe(r.args[C]),o))}r&&c.tag==="typevar"&&!c.symbol&&t.typeParams.includes(c.name)&&!o.has(c.name)&&tt(r)&&o.set(c.name,r);let u=t.typeParams.map(d=>o.get(d)??G),m=At(c,t.typeParams,u),h=t.typeParams.filter(d=>!o.has(d));if(!r&&h.length&&c.tag==="library"&&c.args.some(d=>d.tag==="typevar"&&h.includes(d.name))){let d=c.args.every(p=>p.tag==="typevar"&&h.includes(p.name))?null:m.args;return{tag:"diamond",symbol:c.symbol,fromArgs:d}}return m}#dn(t,e,n){let s=e.tag==="library"?go(e.symbol):P(e),r=t.name==="<init>"?"<init>":t.name;return{native:t.native,isStatic:t.isStatic,params:n,returnsValue:t.name==="<init>"||t.returnType.tag!=="void",display:`${s}.${r}(${t.params.map(bn).join(", ")})`,...t.throws?{throws:t.throws}:{}}}#fn(t){return mt(t.symbol,t.fromArgs??t.symbol.typeParams.map(()=>G))}#de(t,e){t.forEach((n,s)=>{let r=ht(n),a=r.kind==="MethodCall"?this.#et.get(r):void 0;if(a&&r.kind==="MethodCall"){this.#et.delete(r);let m=e[Math.min(s,e.length-1)],h=m?this.#Fn(r,a.symbol,a.method,a.types,m,!0):null;if(h&&h!=="error"){let d=a.method.typeParams.map(C=>h.get(C)??G),p=At(a.method.returnType,a.method.typeParams,d);r.type=p,n!==r&&(n.type=p),r.libraryCall&&(r.libraryCall.params=r.libraryCall.params.map((C,S)=>At(a.method.params[Math.min(S,a.method.params.length-1)],a.method.typeParams,d)))}return}if(this.#S.has(n)){this.#S.delete(n),n.type=this.#I(n,e[Math.min(s,e.length-1)]);return}let o=ht(n).kind;if(o==="Lambda"||o==="MethodRef"){this.#I(n,e[s]);return}if(n.kind==="NewObject"&&n.openDiamond){let{symbol:m,bound:h}=n.openDiamond;delete n.openDiamond;let d=ir(m,e[Math.min(s,e.length-1)]);n.type=X(m,m.typeParams.map(p=>h.get(p.key)??d.get(p.key)??q(xe(p))));return}let c=n.type;if(c?.tag!=="diamond")return;let u=gs(c.symbol,e[s]);n.type=mt(c.symbol,c.symbol.typeParams.map((m,h)=>u.get(m)??c.fromArgs?.[h]??G))})}#ir(t,e,n){let s=e.tag==="library"||e.tag==="diamond"?e.symbol:null;if(!s)return E;let r=this.#Yt(t.args);if(r.some(S=>S.tag==="error"))return E;if(s.isInterface||s.name==="Number")return this.#e(t.pos,v.cantResolve,`${s.name} is abstract; cannot be instantiated`),E;if(!s.constructors.length)return this.#l(t.pos,`creating ${mn(s.name)} with \'new\'`,!0),E;let a=e.tag==="diamond";n===jn&&(n=void 0);let o=a&&n?gs(s,n,!0):new Map,c=S=>{if(!a)return e.args.slice();let k=new Map(o);return S.params.forEach((x,w)=>bt(x,r[w],k)),s.typeParams.map(x=>k.get(x)??G)},u=e.tag==="library"&&!e.args.length&&s.typeParams.length>0,m=s.constructors.map(S=>{let k=c(S);return{owner:s.name,name:s.name,params:S.params.map(x=>u?q(x):At(x,s.typeParams,k)),returnType:Tt,library:S,...S.varargs?{varargs:!0}:{}}}),h=this.#at({pos:t.pos,name:s.name},m,r,"constructor");if(!h)return E;let d=h.library;if(!d.native)return this.#l(t.pos,`the constructor ${s.name}(${d.params.map(bn).join(", ")})`,!0),E;u&&d.params.some(S=>se(S,null))&&this.#st(t.pos,"unchecked",`unchecked call to ${s.name}(${d.params.map(P).join(",")}) as a member of the raw type ${s.name}`,_n(d.params,s)),this.#de(t.args,h.params);let p=a&&r.some((S,k)=>d.params[k]!==void 0&&pn(d.params[k],S));p&&this.#st(t.pos,"unchecked",`unchecked method invocation: constructor <init> in class ${s.name} is applied to given types`,[` required: ${d.params.map(P).join(",")}`,` found: ${r.map(P).join(",")}`,..._n([...d.params,...r],s)]);let C;if(p)C=mt(s);else if(!a)C=e;else{let S=new Map(o);d.params.forEach((w,I)=>bt(w,r[I],S));let k=s.typeParams.every(w=>S.has(w)),x=s.typeParams.map(w=>S.get(w)??G);C=k||n?mt(s,x):{tag:"diamond",symbol:s,fromArgs:s.typeParams.some(w=>S.has(w))?x:null}}return t.libraryCall=this.#dn({...d,name:"<init>"},mt(s),h.params),h.expanded&&(t.libraryCall.varargsFrom=h.params.length-1),C}#ar(t){let e=this.#Yt(t.args);if(e.some(a=>a.tag==="error"))return E;let s=le("String").constructors.map(a=>({owner:"String",name:"String",params:a.params,returnType:Tt,library:a})),r=this.#at({pos:t.pos,name:"String"},s,e,"constructor");return r?(t.libraryCall=this.#dn({...r.library,name:"<init>"},ct,r.params),ct):E}#or(t,e){if(t.body)return this.#lr(t,t.body,e);let n=this.#R===t;this.#R=null;let s=this.#J(t.classType);if(s.tag==="library"||s.tag==="diamond")return this.#ir(t,s,e);if(s.tag==="string")return this.#ar(t);let r=this.#Yt(t.args);if(s.tag==="error"||r.some(d=>d.tag==="error"))return E;if(s.tag==="typevar")return this.#e(t.classType.pos,v.incompatibleTypes,"unexpected type",[" required: class",` found: type parameter ${s.name}`,...$t([s])]),E;if(s.tag!=="class")return this.#l(t.pos,`creating ${mn(P(s))} with \'new\'`,!0),E;let a=s.symbol;if(a.isEnum)return this.#e(t.pos,v.syntax,"enum classes may not be instantiated"),E;if(a.isAbstract)return this.#e(t.pos,v.cantResolve,`${a.displayName} is abstract; cannot be instantiated`),E;if(this.#hn(a,r.length,t.pos))return E;let o=t.classType.kind==="ClassType"?t.classType:null,c=o?.diamond===!0;if(c&&!a.typeParams?.length)return this.#e(o.typeArgumentsPos??t.pos,v.cantResolve,`cannot infer type arguments for ${a.displayName}`,[` reason: cannot use \'<>\' with non-generic class ${a.displayName}`]),E;let u=this.#Fe(a,c?void 0:s),m=s;if(c){let d=a.typeParams,p=d.map($=>$.key),C=ir(a,e),S=new Map;u=u.map($=>{let O=new Map(C),R=new Map;Ki(p,Xi($,r),r,O,R);for(let B of d){let J=R.get(B.key);if(!J)continue;let F=C.get(B.key);if(F&&J.some(K=>!H(K,F))){let K=[`inference variable ${B.name} has incompatible bounds`,` equality constraints: ${P(F)}`,` lower bounds: ${J.map(P).join(",")}`];return{...$,shown:$.params,problem:{reason:K.join(`\n`),diamond:!0}}}O.has(B.key)||O.set(B.key,J.reduce(ar))}let N={...$,shown:$.params,params:$.params.map(B=>Bt(B,O))};return S.set(N,O),N});let k=u.filter($=>$.params.length===r.length),x=k.length===1&&k[0].problem?.diamond?k[0]:null;if(x){let[$,...O]=x.problem.reason.split(`\n`);return this.#e(o.typeArgumentsPos??t.pos,v.incompatibleTypes,`incompatible types: cannot infer type arguments for ${a.displayName}<>`,[` reason: ${$}`,...O.map(R=>` ${R}`),...$t(d.map(xe))]),E}let w=this.#at({pos:t.pos,name:a.name},u,r,"constructor");if(!w)return E;let I=S.get(u.find($=>$.method===w.method))??new Map;return d.filter($=>!I.has($.key)).length&&n&&!e?(t.openDiamond={symbol:a,bound:I},m=X(a,d.map($=>I.get($.key)??On))):m=X(a,d.map($=>I.get($.key)??q(xe($)))),this.#Un(t,a,w,m)}let h=this.#at({pos:t.pos,name:a.name},u,r,"constructor");return h?(An(s)&&h.method.params.some(d=>Bn([d]).length)&&this.#st(t.pos,"unchecked",`unchecked call to ${this.#Dt(h.method).replace(/^[^(]*/,a.name)} as a member of the raw type ${a.displayName}`,$t(h.method.params)),this.#Ke(t.args,h.method.params.map(q)),this.#Un(t,a,h,m)):E}#lr(t,e,n){this.#R=null;let s=e.symbol,r=this.#J(t.classType),a=this.#Yt(t.args);if(r.tag==="error"||a.some(x=>x.tag==="error"))return E;if(r.tag==="diamond"){let x=gs(r.symbol,n);r=mt(r.symbol,r.symbol.typeParams.map(w=>x.get(w)??G))}else if(r.tag==="class"&&t.classType.kind==="ClassType"&&t.classType.diamond&&r.symbol.typeParams?.length){let x=ir(r.symbol,n);r=X(r.symbol,r.symbol.typeParams.map(w=>x.get(w.key)??q(xe(w))))}if((r.tag==="library"||r.tag==="class")&&r.symbol.isInterface&&t.args.length)return this.#e(t.args[0].pos,v.syntax,"anonymous class implements interface; cannot have arguments"),E;let c=r.tag==="string"?"String":r.tag==="class"&&(r.symbol.isFinal||r.symbol.isEnum)?r.symbol.displayName:r.tag==="library"&&!r.symbol.isInterface&&r.symbol.box?r.symbol.name:null;if(c)return this.#e(t.classType.pos,v.syntax,`cannot inherit from final ${c}`),E;if(r.tag==="library"){if(!r.symbol.isInterface)return this.#l(t.classType.pos,`extending the library class ${r.symbol.name}`,!0),E;if(!Hi(r.symbol))return this.#l(t.classType.pos,`implementing the library interface ${r.symbol.name}`,!0),E;s.libraryInterfaces.push(r)}else if(r.tag==="class")if(r.symbol.isInterface)s.interfaces.push(r.symbol),s.interfaceTypes=[r];else{if(r.symbol.isInner)return this.#l(t.classType.pos,"extending an inner (non-static) class",!0),E;s.superclass=r.symbol,s.superType=r}else if(r.tag!=="object")return this.#l(t.pos,`creating ${mn(P(r))} with \'new\'`,!0),E;if(r.tag==="class"&&r.symbol.isSealed)return this.#_e(s),E;let u=null;if(s.superclass){if(this.#hn(s.superclass,a.length,t.pos))return E;if(u=this.#at({pos:t.pos,name:s.superclass.name},this.#Fe(s.superclass,s.superType),a,"constructor"),!u)return E;if(!this.#he(u.method,t.pos,`${s.superclass.name}(${u.method.params.map(P).join(",")})`))return E}else if(a.length)return this.#e(t.pos,v.cantResolve,"constructor Object in class Object cannot be applied to given types;",[" required: no arguments",` found: ${a.map(P).join(",")}`," reason: actual and formal argument lists differ in length"]),E;s.hierarchyState=2;let m=this.#ae(),h=this.#a,d=this.#D,p=this.#ht,C=this.#P;this.#qt(s);let S=this.#_n(s,u);this.#Ue([...s.methods,...s.constructors]),this.#q.set(s,{scopes:m.scopes}),this.#D=null,this.#P=!1,this.#$e(s),this.#oe(m),this.#a=h,this.#D=d,this.#ht=p,this.#P=C,u&&this.#de(t.args,u.params),this.#De(t.args);let k=u?this.#Ce(u,t.pos):void 0;return k&&(t.varargs=k),s.isInner&&(t.outer=0,this.#Vt()),t.ctor=S,X(s)}#_n(t,e){let n=t.declaration.pos,s=e?e.params.slice():[],r={kind:"MethodDeclaration",modifiers:{keywords:[]},returnType:{kind:"VoidType",pos:n,start:n,end:n},name:"<init>",namePos:n,params:[],body:{kind:"Block",statements:[],pos:n,start:n,end:n+1},isConstructor:!0,synthetic:!0,pos:n,start:n,end:n},a={kind:"method",name:t.binaryName.slice(t.binaryName.lastIndexOf("$")+1),owner:t,isStatic:!1,isConstructor:!0,isPrivate:!1,isAbstract:!1,isFinal:!1,access:"package",params:s,returnType:Tt,index:this.#$.length,declaration:r,locals:[],maxSlots:1+(t.isInner?1:t.enumBody?2:0)+s.reduce((o,c)=>o+Me(c),0),throws:e?.method?.throws??[],forwardsToSuper:!0,...e?.method?{superConstructor:e.method}:{}};return r.symbol=a,this.#$.push(a),t.constructors.push(a),a}#Un(t,e,n,s){let r=n.method,a=this.#Ce(n,t.pos);if(a&&(t.varargs=a),!this.#he(r,t.pos,`${e.name}(${r.params.map(P).join(",")})`))return E;if(this.#de(t.args,n.params),e.isInner){let o=0;for(let u=this.#a;u&&u!==e.outer;u=u.outer)o++;let c=this.#a===e.outer||o>0&&this.#Be(o)&&this.#bs(o)===e.outer;if(!this.#T&&!this.#P&&c&&(t.outer=o),t.outer!==void 0)this.#Vt();else return this.#Zt(t.pos,"non-static variable this cannot be referenced from a static context"),E}return t.ctor=r,s}#mn(t){if(t.tag==="library"&&t.symbol.functional){let s=t.symbol,r=s.methods.find(c=>c.name===s.functional&&!c.isStatic),a=s.typeParams.map((c,u)=>{let m=t.args[u];return m?m.tag==="wildcard"?m.bound??G:m:G}),o=c=>At(c,s.typeParams,a);return{params:r.params.map(o),returnType:o(r.returnType),iface:s.qualifiedName,samKey:r.native}}if(t.tag==="class"&&t.symbol.isInterface){let s=ls(t.symbol),r=t.symbol.displayName;if(s.length===1&&!t.symbol.isSealed){let o=s[0],c=X(t.symbol,t.args?.map(m=>Ie(m))),u=m=>Ce(c,o.owner,m);return{params:o.params.map(u),returnType:u(o.returnType),iface:t.symbol.binaryName,sam:o}}let a=t.symbol.isSealed?[]:[s.length?` multiple non-overriding abstract methods found in interface ${r}`:` no abstract method found in interface ${r}`];return{problem:`${r} is not a functional interface`,details:a}}let e=t.tag==="array"?"Array":t.tag==="library"||t.tag==="diamond"?t.symbol.name:t.tag==="class"?t.symbol.displayName:P(t),n=t.tag==="library"&&t.symbol.isInterface?[` multiple non-overriding abstract methods found in interface ${t.symbol.name}`]:void 0;return{problem:`${e} is not a functional interface`,details:n}}#pn(t,e,n=!1){if(t.method)return e??E;if(!e)return this.#e(t.pos,v.incompatibleTypes,"lambda expression not expected here"),E;if(e.tag==="error")return E;if(e.tag==="library"&&e.symbol.name==="Iterable")return this.#l(t.pos,"lambda expressions that implement Iterable"),E;let s=this.#mn(e);if("problem"in s)return this.#e(t.pos,v.incompatibleTypes,`incompatible types: ${s.problem}`,s.details),E;if(s.params.length!==t.params.length)return this.#e(t.pos,v.incompatibleTypes,"incompatible types: incompatible parameter types in lambda expression"),E;for(let[a,o]of t.params.entries()){if(!o.type)continue;let c=this.#J(o.type);if(c.tag==="error")return E;if(!rt(c,s.params[a]))return this.#e(t.pos,v.incompatibleTypes,"incompatible types: incompatible parameter types in lambda expression"),E}if(s.returnType.tag==="void"&&t.body.kind!=="Block"&&!To(t.body))return this.#e(t.body.pos,v.incompatibleTypes,"incompatible types: lambda body is not compatible with a void functional interface",[" (consider using a block lambda body, or use a statement expression instead)"]),E;n&&se(s.returnType,Array.isArray(n)?n:null)&&(s.returnType=jn);let r=t.body.kind==="Block"?t.body:s.returnType.tag==="void"?{kind:"Block",statements:[{kind:"ExpressionStatement",expression:t.body,pos:t.body.pos,start:t.body.start,end:t.body.end}],pos:t.body.pos,start:t.body.start,end:t.body.end}:{kind:"Block",statements:[{kind:"ReturnStatement",value:t.body,pos:t.body.pos,start:t.body.start,end:t.body.end}],pos:t.body.pos,start:t.body.start,end:t.body.end};return this.#fe(t,s,r,[],()=>{for(let a of r.statements)this.#Xt(a)}),e}#fe(t,e,n,s,r){let a=t.reference===!0,o,c=this.#ht;if(a)o=`lambda$ref$${this.#$.length}`;else{c=this.#D?this.#ht:this.#c?this.#c.isConstructor?"new":this.#c.name:this.#T?"static":"new";let O=this.#te.get(this.#a)??new Map;this.#te.set(this.#a,O);let R=O.get(c)??0;O.set(c,R+1),o=`lambda$${c}$${R}`}let u=[],m=new Set(t.params.map(O=>O.name));bs(n,(O,R)=>{if(m.has(O))return;let N=this.#ft(O)??this.#yn(O)?.local;N&&!u.some(B=>B.outer===N)&&u.push({outer:N,pos:R})});let h={keywords:[],annotations:[]},d={kind:"VoidType",pos:t.pos,start:t.pos,end:t.pos},p=t.params.map(O=>({modifiers:h,type:O.type??d,name:O.name,varargs:!1,pos:O.pos,start:O.pos,end:O.pos})),C={kind:"MethodDeclaration",modifiers:h,returnType:d,name:o,namePos:t.pos,params:p,body:n,pos:t.pos,start:t.start,end:t.end},S={kind:"method",name:o,owner:this.#a,isStatic:!0,isConstructor:!1,isPrivate:!0,isAbstract:!1,isFinal:!1,access:"private",params:[...s.map(O=>O.type),...u.map(O=>O.outer.type),...e.params],returnType:e.returnType,index:this.#$.length,declaration:C,locals:[],maxSlots:0,lambda:t,throws:[],...a?{hidden:!0}:{}};C.symbol=S,this.#$.push(S),!this.#c&&!this.#D&&this.#Lt.set(this.#a,[...this.#Lt.get(this.#a)??[],S]),t.method=S,t.captures=u.map(O=>O.outer),t.capturedAt=u.map(O=>O.pos),t.functional={iface:e.iface,...e.samKey?{samKey:e.samKey}:{},...e.sam?{sam:e.sam}:{}};let k=this.#ae(),x=this.#D,w=this.#ht,I=this.#T;this.#D={scopes:this.#C,method:this.#c,isStatic:I,outer:this.#D},this.#ht=c,this.#c=S,this.#X=null,this.#T=I,this.#C=[],this.#A=0,this.#L=[];let L=this.#N.items.length;this.#wt();let $=0;for(let O of s){let R=this.#Ft(O.name,O.type,t.pos,!0,!0);R.parameter=++$}for(let O of u){let R=this.#Ft(O.outer.name,O.outer.type,O.pos,!1,!0);R.parameter=++$,R.captureOf=O.outer}return p.forEach((O,R)=>{let N=this.#Ft(O.name,e.params[R],O.pos,!1);N.parameter=++$,O.symbol=N}),r(),this.#kt(),t.body.kind==="Block"&&e.returnType.tag!=="void"&&this.#N.items.length===L&&this.#ur(S)&&this.#e(t.pos,v.incompatibleTypes,"incompatible types: bad return type in lambda expression",[" missing return value"]),S.usesThis&&(S.isStatic=!1,So(S,1)),this.#oe(k),this.#D=x,this.#ht=w,S}#Vt(){let t=this.#c;for(let e=this.#D;t?.lambda&&e;e=e.outer)t.usesThis=!0,t=e.method}#Bn(t,e,n=!1){if(!e)return this.#e(t.start,v.incompatibleTypes,"method reference not expected here"),E;if(e.tag==="error")return E;let s=this.#mn(e);if("problem"in s)return this.#e(t.start,v.incompatibleTypes,`incompatible types: ${s.problem}`,s.details),E;n&&se(s.returnType,null)&&(s.returnType=jn);let r=s.params.length,a={kind:"Lambda",params:Array.from({length:r},(x,w)=>({name:`$${w}`,pos:t.start,type:null})),body:{kind:"Block",statements:[],pos:t.start,start:t.start,end:t.end},reference:!0,depth:t.depth,pos:t.start,start:t.start,end:t.end};t.lambda=a;let o=x=>({kind:"Name",identifier:`$${x}`,depth:1,pos:t.start,start:t.start,end:t.end}),c=x=>Array.from({length:r-x},(w,I)=>o(x+I)),u={depth:2,pos:t.start,start:t.start,end:t.end},m=(x,w)=>({kind:"MethodCall",target:x,name:t.name,namePos:t.namePos,selectPos:t.start,args:c(w),plainNpe:!0,...u}),h=x=>s.returnType.tag==="void"?{kind:"ExpressionStatement",expression:x,...u}:{kind:"ReturnStatement",value:x,...u},d=a.body;if(t.arrayType){let w={kind:"NewArray",elementType:t.arrayType.kind==="ArrayType"?t.arrayType.element:t.arrayType,dimensions:r?[o(0)]:[],extraDims:0,initializer:null,...u};return d.statements.push(h(w)),this.#fe(a,s,d,[],()=>this.#me(d)),e}let p=t.target;if(p.kind==="Super"||p.kind==="This")return d.statements.push(h(m(p,0))),this.#fe(a,s,d,[],()=>this.#me(d)),e;if(p.kind==="FieldAccess"&&p.target.kind==="Name"&&p.target.identifier==="System"&&(p.name==="out"||p.name==="err")&&!this.#ft("System"))return d.statements.push(h(m(p,0))),this.#fe(a,s,d,[],()=>this.#me(d)),e;if(t.name==="new"){let x=this.#cr(p)?this.#Vn(p):null;if(!x)return this.#e(t.start,v.cantResolve,"cannot find symbol",[` symbol: class ${this.#Gn(p)}`,` location: class ${this.#a.displayName}`]),E;let w={kind:"NewObject",classType:x,args:c(0),...u};return d.statements.push(h(w)),this.#fe(a,s,d,[],()=>this.#me(d)),e}let C=this.#Ge(p);if("tag"in C){if(C.tag==="error")return E;t.receiver=p;let x={kind:"Name",identifier:"$recv",depth:1,pos:t.start,start:t.start,end:t.end},w=m(x,0);return d.statements.push(h(w)),this.#fe(a,s,d,[{name:"$recv",type:C}],()=>this.#me(d)),e}let S=this.#Gn(p),k=x=>h(x?m(o(0),1):m(p,0));return this.#fe(a,s,d,[],()=>{let x=B=>{let J=k(B),F=this.#N.items.length;d.statements=[J],this.#me(d);let K=this.#N.items.splice(F),dt=J.kind==="ReturnStatement"?J.value:J.expression,Wt=dt.method!==void 0||dt.libraryCall!==void 0||dt.stringMethod!==void 0||dt.mathFunction!==void 0||dt.objectMethod!==void 0,Z=dt.method?dt.method.isStatic:dt.libraryCall?dt.libraryCall.isStatic:dt.mathFunction!==void 0,ot=dt.method?`method ${dt.method.name}(${dt.method.params.map(P).join(",")}) in ${dt.method.owner.displayName}`:dt.libraryCall?`method ${t.name}(${dt.libraryCall.params.map(P).join(",")}) in ${S}`:void 0;return{ok:Wt&&Z!==B,...ot?{found:ot}:{},...K[0]?{message:K[0].message}:{}}},w=x(!1),I=this.#Vn(p),L=I?this.#Hn(I):null,$=L?.tag==="diamond"?mt(L.symbol):L,O=s.params[0],R=!$||$.tag==="error"||O===void 0||O===jn||H(qt(O)??O,$)||O.tag==="typevar",N=r>0&&R?x(!0):{ok:!1};if(w.ok&&N.ok){this.#e(t.start,v.incompatibleTypes,"incompatible types: invalid method reference",[` reference to ${t.name} is ambiguous`,` both ${w.found} and ${N.found} match`]);return}if(!w.ok&&!N.ok){let B=/^non-static method (.*) cannot be referenced from a static context$/.exec(w.message??"");if(B){this.#e(t.start,v.incompatibleTypes,"incompatible types: invalid method reference",[` unexpected instance method ${B[1]} found in unbound lookup`]);return}this.#e(t.start,v.cantResolve,"invalid method reference",[" cannot find symbol",` symbol: method ${t.name}(${s.params.map(P).join(",")})`,` location: class ${S}`]);return}d.statements=[k(!w.ok)],this.#me(d)}),e}#me(t){for(let e of t.statements)this.#Xt(e)}#cr(t){let e=ze(t);return e!==null&&(this.#ue(e)!==null||this.#dt(e)!==null||e.join(".")==="String")}#Vn(t){let e=ze(t);if(!e)return null;let n=this.#ue(e)?null:this.#dt(e);return{kind:"ClassType",names:e,hasTypeArguments:!1,...n&&n.typeParams.length?{diamond:!0}:{},pos:t.pos,start:t.start,end:t.end}}#Hn(t){let e=this.#N.items.length,n=this.#J(t,!0);return this.#N.items.splice(e),n}#Gn(t){return ze(t)?.join(".")??as(t)}#ur(t){let e=this.#M,n=this.#nt,s=[this.#K,this.#j,this.#E,this.#p];this.#M=[],this.#nt=[];let r=this.#ye(t.declaration.body.statements,Ht(),!0).completes;return this.#M=e,this.#nt=n,[this.#K,this.#j,this.#E,this.#p]=s,r}#yn(t){for(let e=this.#D;e;e=e.outer)for(let n=e.scopes.length-1;n>=0;n--){let s=e.scopes[n].names.get(t);if(s){let r=e.method;for(let a=e.outer;a&&r?.lambda;a=a.outer)r=a.method;return{local:s,method:r}}}return null}#Zt(t,e){this.#e(t,v.cantResolve,e)}#hr(t,e){this.#ce(t.condition);let n=t.condition.type??E,s=e!==void 0&&e.tag!=="error"?e:void 0,r=this.#Bt(this.#it(t.condition,!0),()=>this.#Y(t.whenTrue,s)),a=this.#Bt(this.#it(t.condition,!1),()=>this.#Y(t.whenFalse,s));if(n.tag!=="boolean"||r.tag==="error"||a.tag==="error")return E;let o,c=yt(r)??r,u=yt(a)??a;if(Y(c)&&Y(u)&&!(tt(r)&&tt(a)&&s&&tt(s)))if(c.tag==="boolean"&&u.tag==="boolean")o=ft;else if(Ot(c)&&Ot(u))o=Lo(c,u,t.whenTrue.constant,t.whenFalse.constant);else return this.#l(t.pos,"conditional expressions mixing boolean and numeric operands"),E;else if(Y(r)&&a.tag==="null"||Y(a)&&r.tag==="null"){let h=Y(r)?r:a,d=this.#zn(h);if(!d)return E;if(o=s&&tt(s)?s:d,s&&!Yt(s,d))return this.#H(Y(r)?t.whenTrue:t.whenFalse,h,s),E}else{if(s){let h=!0;for(let[d,p]of[[t.whenTrue,r],[t.whenFalse,a]])Yt(s,p,d.constant)||(this.#e(d.pos,v.incompatibleTypes,"incompatible types: bad type in conditional expression",[` ${$e(s,p)}`]),h=!1);if(!h)return E}if(Y(r)||Y(a))return this.#l(t.pos,"conditional expressions that need boxing"),E;o=s&&tt(s)?s:Qi(r,a)}let m=t.condition.constant;return m?.kind==="boolean"&&t.whenTrue.constant&&t.whenFalse.constant&&(t.constant=yn(m.value?t.whenTrue.constant:t.whenFalse.constant,o)),o}#dr(t,e){let n=Rn[t.name],s=n.map(o=>({owner:"Math",name:t.name,params:o.params,returnType:o.returnType})),r=this.#at({pos:t.selectPos,name:t.name,imported:Ui(t)},s,e,"method");if(!r)return E;let a=n[s.indexOf(r)];return a.fn?(t.mathFunction={fn:a.fn,params:a.params},r.returnType):(this.#l(t.selectPos,`Math.${t.name}(${r.params.map(P).join(",")})`,!0),E)}#zn(t){let e={int:"Integer",long:"Long",double:"Double",char:"Character",boolean:"Boolean",float:"Float",byte:"Byte",short:"Short"}[t.tag],n=e?oe(e):void 0;return n?mt(n):null}#fr(t,e){if(t.name==="readln"){le("System");let o=[{owner:"IO",name:"readln",params:[],returnType:ct},{owner:"IO",name:"readln",params:[ct],returnType:ct}],c=this.#at({pos:t.selectPos,name:t.name},o,e,"method");if(!c)return E;let u=`readln(${c.params.length?"String":""})`;return t.libraryCall={native:`IO.${u}`,isStatic:!0,params:c.params,returnsValue:!0,display:`java.lang.IO.${u}`},ct}if(t.name!=="print"&&t.name!=="println")return this.#e(t.selectPos,v.cantResolve,"cannot find symbol",[` symbol: method ${this.#jt(t.name,e)}`," location: class IO"]),E;let n=t.name==="println"?[{owner:"IO",name:"println",params:[G],returnType:Tt},{owner:"IO",name:"println",params:[],returnType:Tt}]:[{owner:"IO",name:"print",params:[G],returnType:Tt}];if(!this.#at({pos:t.selectPos,name:t.name},n,e,"method"))return E;let r=e[0],a="none";if(r)switch(r.tag){case"int":a="int";break;case"char":a="char";break;case"boolean":a="boolean";break;case"long":a="long";break;case"double":a="double";break;case"string":case"null":a="string";break;default:a="object"}return t.print={stream:"out",newline:t.name==="println",argument:a},Tt}#mr(t){let e=ht(t);if(e.kind==="FieldAccess")return e.field;if(e.kind==="Name"&&e.imported)return e.imported.field}#pr(t,e,n){le("System");let s={owner:"PrintStream",name:t.name,params:[ct,Kt(G)],returnType:Tt,varargs:!0},r=this.#at({pos:t.selectPos,name:t.name},[s],n,"method");return r?(t.libraryCall={native:`PrintStream.${e}.printf(String,Object[])`,isStatic:!0,params:r.params,returnsValue:!1,display:`java.io.PrintStream.${t.name}(String, Object[])`},r.expanded&&(t.libraryCall.varargsFrom=1),Tt):E}#yr(t,e,n){let s=this.#mr(t.target)==="System.err"?"err":"out";if(t.name==="printf"||t.name==="format")return this.#pr(t,s,n);if((t.name==="flush"||t.name==="close"||t.name==="checkError")&&!n.length)return le("System"),t.libraryCall={native:`PrintStream.${s}.${t.name}()`,isStatic:!0,params:[],returnsValue:t.name==="checkError",display:`java.io.PrintStream.${t.name}()`},t.name==="checkError"?ft:Tt;if(t.name!=="print"&&t.name!=="println")return oo.has(t.name)?this.#l(t.selectPos,`PrintStream.${t.name}()`,!0):this.#e(t.selectPos,v.cantResolve,"cannot find symbol",[` symbol: method ${this.#jt(t.name,n)}`,this.#ke(t.target,e)]),E;let r=this.#at({pos:t.selectPos,name:t.name},mo(t.name),n,"method");if(!r)return E;let a=r.params[0],o="none";if(a)switch(a.tag){case"int":o="int";break;case"char":o="char";break;case"boolean":o="boolean";break;case"string":o="string";break;case"array":o="char-array";break;case"object":o="object",this.#Ke(t.args,[G]);break;case"long":o="long";break;case"double":o="double";break;case"float":o="float";break;default:throw new Error(`checker: unexpected print overload ${P(a)}`)}return t.print={stream:s,newline:t.name==="println",argument:o},Tt}#at(t,e,n,s){let r=(S,k)=>{if(S.params.length!==n.length)return"actual and formal argument lists differ in length";if(S.problem)return S.problem.reason;for(let x=0;x<n.length;x++)if(!k(S.params[x],n[x]))return`argument mismatch; ${xo(S.params[x],n[x])??$e(S.params[x],n[x])}`;return null},a=S=>r(S,(k,x)=>ve(k,x)||pn(k,x)),o=e.filter(S=>r(S,He)===null);if(o.length||(o=e.filter(S=>a(S)===null)),!o.length)for(let S of e){if(!S.varargs||n.length<S.params.length-1)continue;let k=S.params[S.params.length-1].element;if([...S.params.slice(0,-1),...n.slice(S.params.length-1).map(()=>k)].every((w,I)=>ve(w,n[I])))return{...S,expanded:!0}}let c=S=>S.length?S.map(P).join(","):"no arguments";if(!o.length){if(e.length===1){let w=e[0],I=w.shown??w.params,L=(Co(w,n)??a(w)).split(`\n`),$=w.problem?.alone?[` reason: ${L[0]}`]:[` required: ${c(I)}`,` found: ${c(n)}`,` reason: ${L[0]}`,...L.slice(1)];return this.#e(t.pos,v.cantResolve,`${s} ${t.name} in ${w.ownerKind??"class"} ${w.owner} cannot be applied to given types;`,[...$,...w.problem?.alone?[]:$t([...I,...n])]),null}let S=[],k=[];for(let w of t.imported?[...e].reverse():e){let I=w.shown??w.params,L=w.method?.typeParams;k.push(...I),S.push(` ${s} ${w.owner}.${L?`<${L.map(O=>O.name).join(",")}>`:""}${w.name}(${I.map(P).join(",")}) is not applicable`);let $=a(w).split(`\n`);S.push(` (${$[0]}${$.length>1?"":")"}`,...$.slice(1).map((O,R,N)=>` ${O}${R===N.length-1?")":""}`))}let x=n.length?this.#jt(t.name,n):`${t.name}(no arguments)`;return this.#e(t.pos,v.cantResolve,`no suitable ${s} found for ${x}`,[...S,...$t([...k,...n])]),null}let u=(S,k)=>S.params.every((x,w)=>He(k.params[w],x)),m=o.filter(S=>o.every(k=>S===k||u(S,k)));if(m.length===1)return m[0];let h=o.filter(S=>!o.some(k=>k!==S&&u(k,S)&&!u(S,k))),[d,p]=h,C=S=>`${s} ${S.name}(${S.params.map(P).join(",")}) in ${S.owner}`;return this.#e(t.pos,v.cantResolve,`reference to ${t.name} is ambiguous`,[` both ${C(d)} and ${C(p)} match`]),null}#gr(t){let e=this.#Y(t.operand);if(e.tag==="error")return E;let n=yt(e)??e;if(t.operator==="!")return n.tag!=="boolean"?this.#gn(t,n):(t.operand.constant?.kind==="boolean"&&(t.constant=gt(!t.operand.constant.value)),ft);if(!Ot(n)||t.operator==="~"&&!Jn(n))return this.#gn(t,n);let s=Bi(n),r=t.operand.constant;return r&&(t.constant=No(t.operator,r,s)),s}#gn(t,e){return this.#e(t.pos,v.badOperands,`bad operand type ${P(e)} for unary operator \'${t.operator}\'`),E}#Kn(t){let e=ht(t);this.#Ht=e.kind==="Name";let n=this.#I(e);if(this.#Ht=!1,t.type=n,n.tag==="error")return null;if(e.kind==="Name"&&e.symbol?.kind==="local")return e.symbol.multiCatch?(this.#e(e.pos,v.finalAssign,`multi-catch parameter ${e.identifier} may not be assigned`),null):e.symbol.isFinal&&!e.symbol.forEach?(this.#e(e.pos,v.finalAssign,`cannot assign a value to final variable ${e.identifier}`),null):(e.symbol.reassigned=!0,e.symbol.assignCount=(e.symbol.assignCount??0)+1,{kind:"local",variable:e.symbol});let s=e.kind==="Name"&&e.symbol?.kind==="field"?e.symbol:e.kind==="FieldAccess"?e.fieldSymbol:void 0;if(s)return s.isFinal&&!this.#br(e,s)?(this.#e(e.pos,v.finalAssign,`cannot assign a value to ${s.isStatic?"static final":"final"} variable ${s.name}`),null):{kind:"field",field:s};if(e.kind==="ArrayAccess")return{kind:"element",type:n};if(e.kind==="Name"&&e.imported)return this.#e(e.pos,v.finalAssign,`cannot assign a value to static final variable ${e.identifier}`),null;if(e.kind==="FieldAccess"&&e.field){let r=e.field==="length"?"final variable length":`static final variable ${e.name}`;return this.#e(e.pos,v.finalAssign,`cannot assign a value to ${r}`),null}return this.#e(e.pos,v.incompatibleTypes,"unexpected type",[" required: variable"," found: value"]),null}#br(t,e){if(e.declarator.init)return!1;let n=this.#c?.initializer;return n&&this.#c.owner===e.owner&&n==="static"===e.isStatic?t.kind==="Name"?!t.outerHops:!e.isStatic&&t.kind==="FieldAccess"&&ht(t.target).kind==="This":e.isStatic||!this.#c?.isConstructor||this.#c.owner!==e.owner||this.#c.declaration.compact?!1:t.kind==="Name"?!t.outerHops:t.kind==="FieldAccess"&&ht(t.target).kind==="This"}#Tr(t){if(!this.#Kn(t.operand))return E;let n=t.operand.type;return Ot(yt(n)??n)?n:this.#gn(t,n)}#qn(t,e,n,s){return this.#e(t.pos,v.badOperands,`bad operand types for binary operator \'${e}\'`,[` first type: ${P(n)}`,` second type: ${P(s)}`]),E}#Wn(t,e,n){if(t==="+"&&(e.tag==="string"||n.tag==="string"))return ct;if((t==="=="||t==="!=")&&tt(e)&&tt(n))return Te(e,n)?ft:null;let s=yt(e)??e,r=yt(n)??n,a=Ot(s)&&Ot(r);switch(t){case"+":return s.tag==="string"||r.tag==="string"?ct:a?Un(s,r):null;case"-":case"*":case"/":case"%":return a?Un(s,r):null;case"<<":case">>":case">>>":return Jn(s)&&Jn(r)?Bi(s):null;case"<":case">":case"<=":case">=":return a?ft:null;case"==":case"!=":return a?ft:s.tag==="boolean"&&r.tag==="boolean"?ft:tt(s)&&tt(r)&&(H(s,r)||H(r,s))?ft:null;case"&":case"|":case"^":return Jn(s)&&Jn(r)?Un(s,r):s.tag==="boolean"&&r.tag==="boolean"?ft:null;case"&&":case"||":return s.tag==="boolean"&&r.tag==="boolean"?ft:null}return null}#Sr(t){let e=this.#Y(t.left),n=t.operator==="&&"||t.operator==="||"?this.#Bt(this.#it(t.left,t.operator==="&&"),()=>this.#Y(t.right)):this.#Y(t.right);if(e.tag==="error"||n.tag==="error")return E;let s=this.#Wn(t.operator,e,n);if(!s){let o=c=>Y(c)||tt(c);return(t.operator==="=="||t.operator==="!=")&&o(e)&&o(n)&&Y(e)===Y(n)?(this.#e(t.pos,v.badOperands,`incomparable types: ${P(e)} and ${P(n)}`),E):this.#qn(t,t.operator,e,n)}let r=t.left.constant,a=t.right.constant;if(r&&a){let o=$o(t.operator,r,a,s);o&&(t.constant=o)}return s}#xr(t){let e=this.#Kn(t.target),n=t.target.type??E,s=this.#Y(t.value,t.operator==="="?n:void 0);if(!e||n.tag==="error"||s.tag==="error")return e?n:E;if(t.operator==="="){if(!this.#He(n,s,t.value))return this.#H(t.value,s,n),E;let u=ht(t.target);return u.kind==="FieldAccess"&&u.fieldSymbol&&u.target.type&&An(u.target.type)&&Bn([u.fieldSymbol.type]).length&&this.#st(u.pos,"unchecked",`unchecked assignment to variable ${u.name} as member of raw type ${P(u.target.type)}`),n}let r=t.operator.slice(0,-1),a=this.#Wn(r,n,s);if(!a)return this.#qn(t,r,n,s);let o=yt(n);return(o?rt(o,a):Ot(a)&&Ot(n)||rt(a,n))?n:(this.#e(t.value.pos,v.incompatibleTypes,`incompatible types: ${P(a)} cannot be converted to ${P(n)}`),E)}#vr(t){let e=this.#Y(t.array),n=this.#Y(t.index);return e.tag==="error"||n.tag==="error"?E:e.tag!=="array"?(this.#e(t.pos,v.incompatibleTypes,`array required, but ${P(e)} found`),E):ve(U,n)?e.element:(this.#H(t.index,n,U),E)}#wr(t){let e=this.#J(t.elementType,!0);if(e.tag!=="error"&&!gn(e)){this.#e(t.pos,v.syntax,"generic array creation");for(let s of t.dimensions)this.#Y(s);return E}for(let s of t.dimensions){let r=this.#Y(s);r.tag!=="error"&&!ve(U,r)&&this.#H(s,r,U)}if(e.tag==="error")return t.initializer&&this.#we(t.initializer,E),E;let n=e;for(let s=0;s<t.dimensions.length+t.extraDims;s++)n=Kt(n);return t.initializer&&this.#we(t.initializer,n),n}#kr(t){let e=this.#J(t.targetType),n=this.#Y(t.expression);if(e.tag==="error"||n.tag==="error")return E;let s=yt(n),r=Ot(e)&&Ot(n)||e.tag==="boolean"&&n.tag==="boolean"||tt(e)&&tt(n)&&Te(e,n)||tt(e)&&Y(n)&&Yt(e,n)||Y(e)&&s!==null&&(rt(s,e)||Ot(s)&&Ot(e)&&ve(e,s));if(!r&&Y(e)&&tt(n)&&!s){let o=this.#zn(e);o&&Te(o,n)&&(t.checked=o,r=!0)}if(!r)return this.#H(t.expression,n,e),E;if(Eo(e,n))return this.#H(t.expression,n,e),E;if(tt(e)&&tt(n)&&!gn(e)&&!H(n,e)){this.#st(t.expression.pos,"unchecked","unchecked cast",[` required: ${P(e)}`,` found: ${P(n)}`,...$t([e,n])]);let o=q(e);!H(n,o)&&o.tag!=="object"&&(t.checked=o)}else tt(e)&&tt(n)&&!H(n,e)&&(t.checked=e);let a=t.expression.constant;return a&&(Y(e)||e.tag==="string")&&(t.constant=yn(a,e)),e}#pe(t,e,n){!this.#j&&!this.#M.some(([s])=>s===t)&&this.#M.push([t,e,n])}#Ee(t,e){this.#nt.some(([n])=>n===t)||this.#nt.push([t,e])}#Cr(t){this.#M=[],this.#nt=[];let e=ur(t);for(let n of e)this.#Qn(n);this.#Qn(t);for(let[n,s,r]of this.#M)this.#e(n,s==="missing return statement"?v.missingReturn:v.unreachable,s,r);for(let[n,s]of this.#nt)this.#e(n,v.uninitialized,s);this.#t=[];for(let n of e)this.#Xn(n);this.#Xn(t);for(let[n,s,r]of this.#t)this.#e(n,v.unreported,s,r);for(let n of this.#Ot)n.top!==t||bo(n.local)||this.#e(n.pos,v.notEffectivelyFinal,`local variables referenced from ${n.inner?"an inner class":"a lambda expression"} must be final or effectively final`)}#Xn(t){this.#a=t;for(let e of t.fields){let n=e.declarator.init;n&&this.#Ae([],()=>n.kind==="ArrayInitializer"?this.#We(n):this.#g(n));let s=e.enumConstant?.node;s&&this.#Ae([],()=>{for(let r of s.args)this.#g(r);if(s.ctor)for(let r of s.ctor.throws)this.#It(r,s.pos)})}for(let e of t.declaration.members){if(e.kind==="Initializer"&&e.symbol){this.#Ae(e.isStatic?[]:this.#Er(t),()=>{for(let s of e.body.statements)this.#ct(s)});continue}if(e.kind!=="MethodDeclaration"||!e.symbol||e.symbol.isAbstract||e.symbol.builtin)continue;let n=e.symbol;this.#Ae(n.throws,()=>{if(n.superConstructor)for(let s of n.superConstructor.throws)this.#It(s,n.declaration.synthetic?t.declaration.keywordPos:n.declaration.body.pos);for(let s of n.declaration.body.statements)this.#ct(s)})}for(let e of t.constructors)!e.declaration.synthetic||e.builtin||!e.superConstructor||e.forwardsToSuper||this.#Ae([],()=>{for(let n of e.superConstructor.throws)this.#It(n,t.declaration.keywordPos)})}#Er(t){let e=t.constructors.filter(n=>!n.declaration.synthetic&&!n.builtin);return e.length?e.flatMap(n=>n.throws).filter(n=>e.every(s=>s.throws.some(r=>H(n,r)))):[]}#Ae(t,e){let n=[this.#w,this.#d];this.#w=t,this.#d=[],e(),[this.#w,this.#d]=n}#It(t,e,n){if(this.#re(t)){for(let s=this.#d.length-1;s>=0;s--){let r=this.#d[s];if(r.thrown.push(t),r.caught.some(a=>H(t,a)))return}this.#w.some(s=>H(t,s))||this.#t.some(([s])=>s===e)||this.#t.push([e,`unreported exception ${P(t)}; must be caught or declared to be thrown`,n])}}#ct(t){switch(t.kind){case"Block":for(let e of t.statements)this.#ct(e);return;case"LocalVariableDeclaration":for(let e of t.declarators)e.init?.kind==="ArrayInitializer"?this.#We(e.init):e.init&&this.#g(e.init);return;case"ExpressionStatement":this.#g(t.expression);return;case"IfStatement":this.#g(t.condition),this.#ct(t.then),t.otherwise&&this.#ct(t.otherwise);return;case"WhileStatement":case"DoStatement":this.#g(t.condition),this.#ct(t.body);return;case"ForStatement":if(t.init&&!Array.isArray(t.init))this.#ct(t.init);else for(let e of t.init??[])this.#g(e);t.condition&&this.#g(t.condition);for(let e of t.update)this.#g(e);this.#ct(t.body);return;case"ForEachStatement":this.#g(t.iterable),this.#ct(t.body);return;case"LabeledStatement":this.#ct(t.body);return;case"SwitchStatement":this.#Yn(t);return;case"YieldStatement":this.#g(t.value);return;case"ReturnStatement":t.value&&this.#g(t.value);return;case"ConstructorCall":for(let e of t.args)this.#g(e);if(t.target)for(let e of t.target.throws)this.#It(e,t.thisPos);return;case"AssertStatement":this.#g(t.condition),t.message&&this.#g(t.message);return;case"LocalClass":return;case"ThrowStatement":{this.#g(t.expression);let e=ht(t.expression),n=e.kind==="Name"&&e.symbol?.kind==="local"&&!e.symbol.reassigned?this.#F.get(e.symbol):void 0;if(n)for(let s of n)this.#It(s,t.pos);else t.expression.type&&this.#It(t.expression.type,t.pos);return}case"TryStatement":this.#Ar(t);return;case"BreakStatement":case"ContinueStatement":case"EmptyStatement":return}}#Yn(t){this.#g(t.selector);for(let e of t.cases){for(let n of e.statements)this.#ct(n);e.body?.kind==="Block"?this.#ct(e.body):e.body&&this.#g(e.body)}}#Ar(t){let n={caught:t.catches.flatMap(r=>r.caught??[]),thrown:[]};this.#d.push(n);for(let r of t.resources)r.kind==="declaration"?this.#g(r.init):this.#g(r.expression);this.#ct(t.block);for(let r of[...t.resources].reverse()){let a=r.kind==="declaration"?r.symbol?.type:r.expression.type,o=r.kind==="declaration"?r.name:r.symbol?.name??"";for(let c of this.#Ir(a))this.#It(c,r.pos,[` exception thrown from implicit call to close() on resource variable \'${o}\'`])}this.#d.pop();let s=[];for(let r of t.catches){if(r.types.forEach((a,o)=>{let c=r.caught?.[o];if(!c||!this.#re(c))return;let u=c.tag==="class"?c.symbol.binaryName:"";u==="java.lang.Exception"||u==="java.lang.Throwable"||n.thrown.some(m=>H(m,c)||H(c,m))||this.#t.push([r.types.length===1?r.pos:a.pos,`exception ${P(c)} is never thrown in body of corresponding try statement`,void 0])}),r.symbol){let a=r.caught??[];this.#F.set(r.symbol,n.thrown.filter(o=>a.some(c=>H(o,c))&&!s.some(c=>H(o,c))))}s.push(...r.caught??[]),this.#ct(r.block)}t.finallyBlock&&this.#ct(t.finallyBlock)}#Ir(t){return t?.tag==="library"?this.#bn(t.symbol.methods.find(n=>n.name==="close"&&!n.params.length)?.throws):!t||t.tag!=="class"?[]:this.#Ct(t.symbol,"close").find(n=>n.params.length===0)?.throws??[]}#bn(t){return(t??[]).map(e=>X(this.#k.get(e)))}#We(t){for(let e of t.elements)e.kind==="ArrayInitializer"?this.#We(e):this.#g(e)}#g(t){switch(t.kind){case"MethodCall":t.target&&this.#g(t.target);for(let e of t.args)this.#g(e);if(t.method)for(let e of t.method.throws)this.#It(e,t.pos);for(let e of this.#bn(t.libraryCall?.throws))this.#It(e,t.pos);return;case"NewObject":for(let e of t.args)this.#g(e);if(t.ctor)for(let e of t.ctor.throws)this.#It(e,t.pos);for(let e of this.#bn(t.libraryCall?.throws))this.#It(e,t.pos);return;case"MethodRef":t.receiver&&this.#g(t.receiver),t.lambda&&this.#g(t.lambda);return;case"Lambda":if(t.method){let e=t.method.declaration.body;this.#Ae([],()=>{for(let n of e.statements)this.#ct(n)})}return;case"SwitchExpression":this.#Yn(t);return;case"FieldAccess":this.#g(t.target);return;case"Unary":case"IncDec":this.#g(t.operand);return;case"Binary":this.#g(t.left),this.#g(t.right);return;case"Assignment":this.#g(t.target),this.#g(t.value);return;case"Parenthesized":this.#g(t.expression);return;case"ArrayAccess":this.#g(t.array),this.#g(t.index);return;case"NewArray":for(let e of t.dimensions)this.#g(e);t.initializer&&this.#We(t.initializer);return;case"Cast":this.#g(t.expression);return;case"Conditional":this.#g(t.condition),this.#g(t.whenTrue),this.#g(t.whenFalse);return;case"InstanceOf":this.#g(t.expression);return;case"ClassLiteral":case"Literal":case"Name":case"This":case"Super":return}}#Qn(t){this.#a=t;let e=t.constructors.some(r=>!r.declaration.synthetic),n=this.#Zn(t,!0),s=this.#Zn(t,!1);this.#O.set(t,s);for(let r of t.fields)!r.isFinal||r.declarator.init||r.enumConstant||r.capturedLocal||(r.isStatic?n.get(r)?.assigned||this.#nt.push([r.declarator.pos,`variable ${r.name} might not have been initialized`]):!e&&!t.isRecord&&!s.get(r)?.assigned&&this.#nt.push([r.declarator.pos,`variable ${r.name} not initialized in the default constructor`]));for(let r of t.declaration.members)r.kind==="MethodDeclaration"&&r.symbol&&!r.symbol.declaration.synthetic&&!r.symbol.isAbstract&&this.#Xe(r.symbol);for(let r of this.#Lt.get(t)??[])this.#Xe(r)}#Zn(t,e){let n=new Map;for(let a of t.fields)a.isStatic===e&&a.isFinal&&!a.declarator.init&&!a.enumConstant&&!a.capturedLocal&&n.set(a,1e6+n.size);let s=rr();for(let a of n.values())s.unassigned.add(a);for(let a of t.declaration.members){if(a.kind!=="Initializer"||a.isStatic!==e||!a.symbol)continue;this.#K=new Map,this.#j=0,this.#E=[],this.#p=n;let o=this.#ye(a.body.statements,s,!0);o.completes||this.#pe(a.pos,"initializer must be able to complete normally");let c=rr();for(let u of n.values())fn(o.after,u)&&c.vars.add(u),Fn(o.after,u)&&c.unassigned.add(u);s=c}this.#p=new Map;let r=new Map;for(let[a,o]of n)r.set(a,{assigned:fn(s,o),unassigned:Fn(s,o)});return r}#Xe(t){let e=rr();for(let o of t.declaration.params)o.symbol&&(e=Ae(e,o.symbol.index));for(let o of t.locals)o.parameter!==void 0&&(e=Ae(e,o.index));this.#K=new Map,this.#j=0,this.#E=[],this.#p=new Map;let n=t.declaration.body,s=n.statements[0],r=t.isConstructor&&!t.declaration.compact&&!(s?.kind==="ConstructorCall"&&s.keyword==="this");if(r){let o=this.#O.get(t.owner);for(let c of t.owner.fields){if(c.isStatic||!c.isFinal||c.declarator.init||c.capturedLocal)continue;let u=t.locals.length+this.#p.size;this.#p.set(c,u);let m=o?.get(c);m?.assigned&&e.vars.add(u),(!m||m.unassigned)&&e.unassigned.add(u)}}let a=this.#ye(n.statements,e,!0);if(a.completes&&!a.recovery&&t.returnType.tag!=="void"&&!t.lambda&&this.#pe(t.declaration.closeBracePos??n.end-1,"missing return statement"),r){for(let[o,c]of this.#p)fn(a.after,c)||this.#Ee(t.declaration.closeBracePos??n.end-1,`variable ${o.name} might not have been initialized`);for(let o of this.#E)for(let[c,u]of this.#p)fn(o.state,u)||this.#Ee(o.pos,`variable ${c.name} might not have been initialized`)}this.#p=new Map}#ye(t,e,n){let s=e,r=n,a=!1;for(let o of t){r||(this.#pe(zi(o),"unreachable statement"),r=!0,a=!0,s=Ht());let c=this.#Et(o,s,r);s=c.after,r=c.completes,c.recovery&&(a=!0)}return{after:s,completes:r,...a&&r?{recovery:!0}:{}}}#Et(t,e,n){switch(t.kind){case"Block":return this.#ye(t.statements,e,n);case"LocalVariableDeclaration":return{after:this.#ns(t,e),completes:n};case"ExpressionStatement":return{after:this.#x(t.expression,e),completes:n};case"EmptyStatement":return{after:e,completes:n};case"ConstructorCall":{let s=e;for(let r of t.args)s=this.#x(r,s);return{after:s,completes:n}}case"IfStatement":{let s=this.#ut(t.condition,e),r=this.#Et(t.then,s.whenTrue,n);if(!t.otherwise)return{after:xt(r.after,s.whenFalse),completes:n};let a=this.#Et(t.otherwise,s.whenFalse,n);return{after:xt(r.after,a.after),completes:r.completes||a.completes}}case"WhileStatement":return this.#ts(t,t.condition,t.body,[],e,n);case"ForStatement":{let s=e;if(t.init&&!Array.isArray(t.init))s=this.#ns(t.init,s);else for(let r of t.init??[])s=this.#x(r,s);return this.#ts(t,t.condition,t.body,t.update,s,n)}case"DoStatement":return this.#Lr(t,e,n);case"ForEachStatement":return this.#Nr(t,e,n);case"LabeledStatement":{let s=this.#Ie(t),r=this.#Et(t.body,e,n);return{after:xt(r.after,...s.breaks),completes:r.completes||s.breaks.length>0}}case"SwitchStatement":return this.#$r(t,e,n);case"YieldStatement":{let s=this.#x(t.value,e);return t.target&&this.#K.get(t.target)?.yields.push(s),{after:Ht(),completes:!1}}case"BreakStatement":return t.target&&this.#K.get(t.target)?.breaks.push(e),{after:Ht(),completes:!1};case"ContinueStatement":return t.target&&this.#K.get(t.target)?.continues.push(e),{after:Ht(),completes:!1};case"ReturnStatement":{let s=t.value?this.#x(t.value,e):e;return this.#p.size&&this.#E.push({pos:t.pos,state:s}),{after:Ht(),completes:!1}}case"ThrowStatement":return this.#x(t.expression,e),{after:Ht(),completes:!1};case"AssertStatement":{let s=this.#ut(t.condition,e);return t.message&&this.#x(t.message,s.whenFalse),{after:e,completes:n}}case"TryStatement":return this.#Or(t,e,n);case"LocalClass":return{after:e,completes:n}}}#Or(t,e,n){let s=e;for(let h of t.resources)h.kind==="declaration"?(s=this.#x(h.init,s),h.symbol&&(s=Ae(s,h.symbol.index))):s=this.#x(h.expression,s);let r=this.#Et(t.block,s,n);t.blockCompletes=r.completes;let a=[r],o=h=>{let d=Pe(e);if(!h.all)for(let p of[...d.unassigned])h.unassigned.has(p)||d.unassigned.delete(p);return d};for(let h of t.catches){let d=o(r.after);h.symbol&&(d=Ae(d,h.symbol.index));let p=this.#Et(h.block,d,n);h.completes=p.completes,a.push(p)}let c=a.filter(h=>h.completes),u=c.length?xt(c[0].after,...c.slice(1).map(h=>h.after)):Ht();if(!t.finallyBlock)return{after:u,completes:c.length>0};let m=this.#Et(t.finallyBlock,o(xt(r.after,...a.map(h=>h.after))),n);return{after:po(u,m.after),completes:c.length>0&&m.completes}}#Ie(t){let e={breaks:[],continues:[],yields:[]};return this.#K.set(t,e),e}#Tn(t,e){let n=e(t,!0),s=[...t.unassigned].some(o=>!Fn(n.backEdge,o));if(!this.#p.size||t.all||!s)return n.result;let r=Pe(t);for(let o of[...r.unassigned])Fn(n.backEdge,o)||r.unassigned.delete(o);this.#j++;let a=e(r,!1);return this.#j--,a.result}#ts(t,e,n,s,r,a){return this.#Tn(r,(o,c)=>{let u=e?this.#ut(e,o):{whenTrue:o,whenFalse:Ht()},m=e?e.constant:gt(!0),h=a&&!ds(m);c&&a&&!h&&this.#pe(zi(n),"unreachable statement");let d=this.#Ie(t),p=this.#Et(n,h?u.whenTrue:Ht(),!0),C=xt(p.after,...d.continues);for(let S of s)C=this.#x(S,C);return{backEdge:C,result:{after:xt(u.whenFalse,...d.breaks),completes:a&&(!Mn(m)||d.breaks.length>0)}}})}#Lr(t,e,n){return this.#Tn(e,s=>{let r=this.#Ie(t),a=this.#Et(t.body,s,n),o=xt(a.after,...r.continues),c=this.#ut(t.condition,o),u=a.completes||r.continues.length>0;return{backEdge:c.whenTrue,result:{after:xt(c.whenFalse,...r.breaks),completes:n&&(u&&!Mn(t.condition.constant)||r.breaks.length>0)}}})}#Nr(t,e,n){let s=this.#x(t.iterable,e);return this.#Tn(s,r=>{let a=this.#Ie(t),o=t.symbol?Ae(r,t.symbol.index):r,c=this.#Et(t.body,o,n);return{backEdge:xt(c.after,...a.continues),result:{after:xt(r,...a.breaks),completes:n}}})}#$r(t,e,n){let s=this.#es(t,this.#x(t.selector,e)),r=this.#Ie(t),a=[],o=!1;if(t.cases[0]?.arrow)for(let c of t.cases){let u=c.body,m=u.kind==="Block"?this.#Et(u,s,n):{after:this.#x(u,s),completes:n};m.completes&&(a.push(m.after),o=!0)}else{let c=null;for(let u of t.cases){let m=c?.completes?xt(s,c.after):s;c=this.#ye(u.statements,m,n)}(!c||c.completes)&&(a.push(c?c.after:s),o=!0)}return!t.cases.some(c=>c.isDefault)&&!t.exhaustive&&(a.push(s),o=!0),a.push(...r.breaks),r.breaks.length&&(o=!0),{after:a.length?xt(a[0],...a.slice(1)):Ht(),completes:n&&o}}#es(t,e){let n=e;for(let s of t.cases)s.guard&&(n=xt(n,this.#x(s.guard,n)));return n}#Mr(t,e){let n=this.#es(t,this.#x(t.selector,e)),s=this.#Ie(t),r=[];if(t.cases[0]?.arrow)for(let a of t.cases){let o=a.body;if(o.kind!=="Block"){r.push(this.#x(o,n));continue}this.#ye(o.statements,n,!0).completes&&this.#pe(o.end-1,"switch rule completes without providing a value",[" (switch rules in switch expressions must either provide a value or throw)"])}else{let a=null;for(let o of t.cases){let c=a?.completes?xt(n,a.after):n;a=this.#ye(o.statements,c,!0)}a?.completes&&this.#pe(t.end-1,"switch expression completes without providing a value",[" (switch expressions must either provide a value or throw for all possible input values)"])}return!t.patternSwitch&&!t.cases.some(a=>a.isDefault)&&!t.coversAllConstants&&this.#pe(t.pos,"the switch expression does not cover all possible input values"),r.push(...s.yields),r.length?xt(r[0],...r.slice(1)):Ht()}#Sn(t,e){let n=e;for(let s of t.elements)n=s.kind==="ArrayInitializer"?this.#Sn(s,n):this.#x(s,n);return n}#ns(t,e){let n=e;for(let s of t.declarators){let r=s.symbol;r&&(n=yo(n,r.index));let a=s.init;a&&(n=a.kind==="ArrayInitializer"?this.#Sn(a,n):this.#x(a,n),r&&(n=Ae(n,r.index)))}return n}#ut(t,e){if(Mn(t.constant))return{whenTrue:e,whenFalse:Ht()};if(ds(t.constant))return{whenTrue:Ht(),whenFalse:e};if(t.kind==="Parenthesized")return this.#ut(t.expression,e);if(t.kind==="Unary"&&t.operator==="!"){let s=this.#ut(t.operand,e);return{whenTrue:s.whenFalse,whenFalse:s.whenTrue}}if(t.kind==="Binary"&&t.operator==="&&"){let s=this.#ut(t.left,e),r=this.#ut(t.right,s.whenTrue);return{whenTrue:r.whenTrue,whenFalse:xt(s.whenFalse,r.whenFalse)}}if(t.kind==="Binary"&&t.operator==="||"){let s=this.#ut(t.left,e),r=this.#ut(t.right,s.whenFalse);return{whenTrue:xt(s.whenTrue,r.whenTrue),whenFalse:r.whenFalse}}if(t.kind==="Conditional"&&t.type?.tag==="boolean"){let s=this.#ut(t.condition,e),r=this.#ut(t.whenTrue,s.whenTrue),a=this.#ut(t.whenFalse,s.whenFalse);return{whenTrue:xt(r.whenTrue,a.whenTrue),whenFalse:xt(r.whenFalse,a.whenFalse)}}let n=this.#x(t,e);return{whenTrue:n,whenFalse:n}}#xn(t,e,n){return t.binding||fn(n,t.index)?n:(this.#Ee(e,`variable ${t.name} might not have been initialized`),Ae(n,t.index))}#Ye(t){if(!this.#p.size)return null;let e;t.kind==="Name"&&t.symbol?.kind==="field"&&!t.outerHops?e=t.symbol:t.kind==="FieldAccess"&&t.fieldSymbol&&ht(t.target).kind==="This"&&(e=t.fieldSymbol);let n=e&&this.#p.get(e);return e&&n!==void 0?{field:e,index:n}:null}#Qe(t,e,n){if(fn(n,t.index))return n;this.#Ee(e,`variable ${t.field.name} might not have been initialized`);let s=Pe(n);return s.vars.add(t.index),s}#x(t,e){switch(t.kind){case"Literal":case"This":case"Super":return e;case"InstanceOf":return this.#x(t.expression,e);case"ClassLiteral":return e;case"Lambda":{let n=e;t.captures?.forEach((r,a)=>n=this.#xn(r,t.capturedAt[a],n));let s=[this.#K,this.#j,this.#E,this.#p];return t.method&&this.#Xe(t.method),[this.#K,this.#j,this.#E,this.#p]=s,n}case"MethodRef":{let n=t.receiver?this.#x(t.receiver,e):e,s=[this.#K,this.#j,this.#E,this.#p];return t.lambda?.method&&this.#Xe(t.lambda.method),[this.#K,this.#j,this.#E,this.#p]=s,n}case"Name":{if(t.symbol?.kind==="local"&&!t.constant)return this.#xn(t.symbol,t.pos,e);let n=this.#Ye(t);return n?this.#Qe(n,t.pos,e):e}case"Parenthesized":return this.#x(t.expression,e);case"FieldAccess":{let n=this.#Ye(t);return n?this.#Qe(n,t.pos,e):this.#x(t.target,e)}case"MethodCall":{let n=t.target?this.#x(t.target,e):e;for(let s of t.args)n=this.#x(s,n);return n}case"NewObject":{let n=e;for(let s of t.args)n=this.#x(s,n);return n}case"Conditional":{let n=this.#ut(t.condition,e);return xt(this.#x(t.whenTrue,n.whenTrue),this.#x(t.whenFalse,n.whenFalse))}case"Unary":if(t.operator==="!"){let n=this.#ut(t,e);return xt(n.whenTrue,n.whenFalse)}return this.#x(t.operand,e);case"IncDec":{let n=this.#Ye(ht(t.operand));return n?this.#ss(n,ht(t.operand).pos,this.#Qe(n,ht(t.operand).pos,e)):this.#x(t.operand,e)}case"Cast":return this.#x(t.expression,e);case"ArrayAccess":return this.#x(t.index,this.#x(t.array,e));case"NewArray":{let n=e;for(let s of t.dimensions)n=this.#x(s,n);return t.initializer?this.#Sn(t.initializer,n):n}case"SwitchExpression":return this.#Mr(t,e);case"Binary":{if(t.operator==="&&"||t.operator==="||"){let n=this.#ut(t,e);return xt(n.whenTrue,n.whenFalse)}return this.#x(t.right,this.#x(t.left,e))}case"Assignment":{let n=ht(t.target);if(n.kind==="Name"&&n.symbol?.kind==="local"){let r=t.operator==="="?e:this.#xn(n.symbol,n.pos,e);return r=this.#x(t.value,r),n.symbol.isFinal&&n.symbol.forEach&&this.#Ee(n.pos,`variable ${n.symbol.name} might already have been assigned`),Ae(r,n.symbol.index)}let s=this.#Ye(n);if(s){let r=t.operator==="="?e:this.#Qe(s,n.pos,e);return r=this.#x(t.value,r),this.#ss(s,n.pos,r)}return this.#x(t.value,this.#x(t.target,e))}}}#ss(t,e,n){if(!Fn(n,t.index)){let s=this.#j?"might be assigned in loop":"might already have been assigned";this.#Ee(e,`variable ${t.field.name} ${s}`)}return Ae(n,t.index)}};function he(i,t){return`${i}(${t.map(bn).join(",")})`}function Me(i){return i.tag==="long"||i.tag==="double"?2:1}function de(i,t){let e=n=>n.some(s=>de(s,t));switch(i.kind){case"BreakStatement":return i.target===t;case"Block":return e(i.statements);case"IfStatement":return de(i.then,t)||i.otherwise!==null&&de(i.otherwise,t);case"WhileStatement":case"DoStatement":case"ForStatement":case"ForEachStatement":case"LabeledStatement":return de(i.body,t);case"SwitchStatement":return i.cases.some(n=>e(n.statements)||n.body?.kind==="Block"&&de(n.body,t));case"TryStatement":return de(i.block,t)||i.catches.some(n=>de(n.block,t))||i.finallyBlock!==null&&de(i.finallyBlock,t);default:return!1}}function go(i){return i.qualifiedName==="java.lang.String"?"String":i.qualifiedName}function bn(i){switch(i.tag){case"typevar":return i.symbol?bn(q(i)):"Object";case"wildcard":case"object":return"Object";case"string":return"String";case"library":return i.symbol.qualifiedName;case"class":return i.symbol.binaryName;case"array":return bn(i.element)+"[]";default:return P(i)}}function ea(i){return i.tag==="typevar"&&i.symbol?i.symbol.bounds.some(t=>ea(t)||t.tag==="library"&&t.symbol.name==="Comparable"):i.tag==="class"?i.symbol.isEnum||ln(i.symbol).some(t=>t.symbol.name==="Comparable"):i.tag==="string"||i.tag==="library"&&(i.symbol.box!==void 0||i.symbol.name==="StringBuilder"||i.symbol.supertypes.some(t=>t.tag==="library"&&t.symbol.name==="Comparable"))}function lr(i){if(i.kind==="Name")return i.identifier;if(i.kind!=="FieldAccess")return null;let t=lr(i.target);return t===null?null:`${t}.${i.name}`}function mn(i){return`${/^[AEIOU]/i.test(i)?"an":"a"} ${i}`}function fe(i){if(!i)return;let t=i.tag==="wildcard"?i.bound??void 0:i;return t?.tag==="object"?void 0:t}var jn={tag:"typevar",name:"?return"};function se(i,t){switch(i.tag){case"typevar":return t===null?!i.symbol:t.includes(os(i));case"class":return i.args?.some(e=>se(e,t))??!1;case"array":return se(i.element,t);case"wildcard":return i.bound!==null&&se(i.bound,t);case"library":return i.args.some(e=>se(e,t));default:return!1}}function ys(i){if(i.tag!=="library"||!i.symbol.functional)return null;let t=i.symbol.methods.find(n=>n.name===i.symbol.functional&&!n.isStatic);if(!t)return null;let e=i.symbol.typeParams.map((n,s)=>{let r=i.args[s];return r?r.tag==="wildcard"?r.bound??G:r:G});return{params:t.params.map(n=>Xt(n,i.symbol.typeParams,e)),returnType:Xt(t.returnType,i.symbol.typeParams,e)}}function bo(i){let t=0,e=i;for(let n=i;n;n=n.captureOf)t+=n.assignCount??0,e=n;return e.isFinal&&!e.forEach?!0:e.noInitializer?t<=1:t===0}function To(i){return i.kind==="MethodCall"||i.kind==="Assignment"||i.kind==="IncDec"||i.kind==="NewObject"}function ze(i){if(i.kind==="Name")return[i.identifier];if(i.kind==="FieldAccess"){let t=ze(i.target);return t?[...t,i.name]:null}return null}var na=new Set(["type","symbol","method","constant","libraryCall","ctor","fieldSymbol","captures","functional","caught","finallySlots","lambda","receiver","mathFunction","interfaceSymbol","imported"]);function bs(i,t){if(Array.isArray(i)){for(let n of i)bs(n,t);return}if(i===null||typeof i!="object")return;let e=i;e.kind==="Name"&&typeof e.identifier=="string"&&t(e.identifier,e.pos);for(let[n,s]of Object.entries(e))na.has(n)||s===null||typeof s!="object"||bs(s,t)}function So(i,t){for(let n of i.locals)n.slot+=t;i.maxSlots+=t,i.finallySlots!==void 0&&(i.finallySlots+=t);let e=n=>{if(Array.isArray(n)){for(let a of n)e(a);return}if(n===null||typeof n!="object")return;let s=n;if(s.kind==="Lambda"||s.kind==="MethodRef"||s.kind==="ClassDeclaration")return;typeof s.liveSlots=="number"&&(s.liveSlots=s.liveSlots+t);let r=s.finallySlots;r&&typeof r.base=="number"&&(r.base+=t,r.before+=t);for(let[a,o]of Object.entries(s))!na.has(a)&&o&&typeof o=="object"&&e(o)};e(i.declaration.body)}function bt(i,t,e){if(!t)return;if(i.tag==="typevar"){let s=os(i);if(e.has(s)||t.tag==="null"||t.tag==="diamond"||t.tag==="lambda"||t.tag==="error"||t.tag==="typevar"&&!t.symbol)return;let r=t.tag==="wildcard"&&t.poly?t.bound:tt(t)?hr(t):t.tag==="wildcard"?t:qt(t);r&&e.set(s,r);return}if(i.tag==="wildcard"){i.bound&&bt(i.bound,t,e);return}if(i.tag==="array"&&t.tag==="array"){if(i.element.tag==="typevar"&&!tt(t.element))return;bt(i.element,t.element,e);return}let n=s=>s.tag==="wildcard"?s.bound??G:s;if(i.tag==="library"&&(t.tag==="library"||t.tag==="class"||t.tag==="typevar")){let s=t.tag==="library"?_t(t,i.symbol):t.tag==="class"?Ge(t).map(r=>_t(r,i.symbol)).find(r=>r)??null:null;if(s)i.args.forEach((r,a)=>s.args[a]&&bt(r,r.tag==="typevar"&&!cr(s.args[a])?s.args[a]:n(s.args[a]),e));else if(t.tag==="typevar"&&t.symbol)for(let r of t.symbol.bounds)bt(i,r,e);return}if(i.tag==="class"&&i.args?.length&&(t.tag==="class"||t.tag==="typevar")){let s=ee(t,i.symbol);s?.args&&i.args.forEach((r,a)=>s.args[a]&&bt(r,n(s.args[a]),e))}}function cr(i){return i.tag==="wildcard"&&i.poly!==void 0}function xo(i,t){if(i.tag!=="library"||t.tag!=="library")return null;let e=_t(t,i.symbol);if(!e)return null;for(let[n,s]of e.args.entries()){let r=i.args[n];if(s.tag!=="wildcard"||!s.poly||!r||r.tag==="wildcard"||!s.poly.lows.some(o=>!H(o,r)))continue;let a=s.poly.lows.filter((o,c)=>s.poly.lows.findIndex(u=>rt(u,o))===c);return[`inference variable ${s.poly.name} has incompatible bounds`,` equality constraints: ${P(r)}`,` lower bounds: ${[...a].reverse().map(P).join(",")}`,...s.poly.where].join(`\n`)}return null}function hr(i){return i.tag==="library"&&i.args.some(cr)?{...i,args:i.args.map(t=>cr(t)?t.bound:t)}:i}function gs(i,t,e=!1){let n=new Map;if(t?.tag!=="library")return n;let s=mt(i,i.typeParams.map(o=>({tag:"typevar",name:o}))),r=_t(s,t.symbol),a=o=>e&&o?.tag==="object"?o:fe(o);return r&&r.args.forEach((o,c)=>a(t.args[c])&&bt(o,a(t.args[c]),n)),n}function ir(i,t){let e=new Map;if(!t)return e;let n=ce(i);if(t.tag==="class"){let s=ee(n,t.symbol);s?.args&&t.args&&s.args.forEach((r,a)=>fe(t.args[a])&&bt(r,fe(t.args[a]),e))}else if(t.tag==="library"){let s=Ge(n).map(r=>_t(r,t.symbol)).find(r=>r);s&&s.args.forEach((r,a)=>fe(t.args[a])&&bt(r,fe(t.args[a]),e))}return e}function Ki(i,t,e,n,s){t.forEach((r,a)=>{let o=e[a];if(!(!o||o.tag==="null"||o.tag==="lambda"||o.tag==="diamond"||o.tag==="error"))if(r.tag==="typevar"&&r.symbol&&i.includes(r.symbol.key)){let c=tt(o)?hr(o):qt(o);if(!c)return;let u=s.get(r.symbol.key)??[];u.some(m=>rt(m,c))||u.push(c),s.set(r.symbol.key,u)}else bt(r,o,n)})}function qi(i,t,e){if(!Bn([t]).length||!tt(e))return;let n=q(e);n.tag!=="object"&&n.tag!=="null"&&!H(q(t),n)&&(i.genericCast=n)}function vo(i,t){if(t.some(s=>"all"in s))return!0;let e=t.flatMap(s=>"pattern"in s?[s.pattern]:[]),n=t.flatMap(s=>"constantOf"in s?[s]:[]);return dr(i,e,n,new Set)}function dr(i,t,e,n){let s=q(i);if(t.some(o=>o.kind==="TypePattern"&&o.tested&&H(s,q(o.tested))))return!0;let r=i.tag==="typevar"&&i.symbol?ko(i):i;if(r.tag!=="class")return!1;let a=r.symbol;if(n.has(a))return!1;if(a.isEnum){let o=new Set(e.filter(c=>c.constantOf===a).map(c=>c.ordinal));return a.enumConstants.every(c=>o.has(c.enumConstant.ordinal))}if(a.isSealed&&a.permitted){if(!a.isAbstract)return!1;let o=new Set(n).add(a);return a.permitted.every(c=>dr(X(c),t,e,o))}if(a.isRecord){let o=t.filter(u=>u.kind==="RecordPattern"&&u.tested?.tag==="class"&&u.tested.symbol===a);if(!o.length)return!1;let c=a.components.map(u=>u.type);return sa(c,o.map(u=>u.components),n)}return!1}function sa(i,t,e){if(!i.length)return t.length>0;let[n,...s]=i;return ra(n).every(r=>{let a=t.filter(o=>wo(o[0],r,e));return sa(s,a.map(o=>o.slice(1)),e)})}function ra(i){return i.tag==="class"&&i.symbol.isSealed&&i.symbol.isAbstract&&i.symbol.permitted?i.symbol.permitted.flatMap(t=>ra(X(t))):[i]}function wo(i,t,e){return i.kind==="TypePattern"?i.unconditional===!0||i.tested!==void 0&&(Y(t)?rt(t,i.tested):H(q(t),q(i.tested))):t.tag==="class"&&dr(t,[i],[],e)}function ko(i){return i.symbol?.bounds[0]??G}function ur(i,t=!1){let e=[];for(let n of t?i.members:[...i.members,...i.anonymousClasses??[]])!t&&(n.anonymous||n.local)&&n.hierarchyState!==2||e.push(...ur(n,t),n);return e}function Wi(i){return i.declaration.params[i.declaration.params.length-1]?.varargs===!0}function Xi(i,t){let e=i.params[i.params.length-1];return!i.varargs||e?.tag!=="array"||t.length===i.params.length&&t[t.length-1].tag==="array"?i.params:[...i.params.slice(0,-1),...t.slice(i.params.length-1).map(()=>e.element)]}function Co(i,t){if(!i.varargs||i.problem||t.length<i.params.length-1)return null;let e=i.params[i.params.length-1].element;for(let n=i.params.length-1;n<t.length;n++)if(!ve(e,t[n]))return`varargs mismatch; ${$e(e,t[n])}`;return null}function gn(i){switch(i.tag){case"typevar":return!1;case"array":return gn(i.element);case"library":return i.args.every(t=>t.tag==="wildcard"&&!t.bound);case"class":return(i.args??[]).every(t=>t.tag==="wildcard"&&!t.bound);default:return!0}}function Eo(i,t){let e=n=>n.tag!=="wildcard"&&n.tag!=="typevar"&&gn(n);if(i.tag==="library"&&t.tag==="library"&&i.args.length){let n=_t(t,i.symbol);return n!==null&&n.args.some((s,r)=>e(s)&&e(i.args[r])&&!rt(s,i.args[r]))}if(i.tag==="class"&&t.tag==="class"&&i.args?.length){let n=ee(t,i.symbol);return n?.args!==void 0&&n.args.some((s,r)=>e(s)&&e(i.args[r])&&!rt(s,i.args[r]))}return!1}function Ao(i){return i.tag==="string"||i.tag==="class"||i.tag==="array"||i.tag==="library"&&i.symbol.box!==void 0}function Yi(i,t,e){if(!t.varargs||t.name!=="of"||!["List","Set"].includes(i.name)||e>10||t.params.length!==1)return t;let n=t.params[0].element;return{...t,varargs:!1,params:Array.from({length:e},()=>n)}}function _n(i,t,e){let n=[],s=a=>{a.tag==="typevar"&&!a.symbol&&!n.includes(a.name)?n.push(a.name):a.tag==="array"?s(a.element):a.tag==="wildcard"&&a.bound?s(a.bound):a.tag==="library"&&a.args.forEach(s)};if(i.forEach(s),!n.length)return[];let r=[n.length===1?` where ${n[0]} is a type-variable:`:` where ${n.join(",")} are type-variables:`];for(let a of n)if(e?.typeParams?.includes(a)){let o=e.typeParamBounds?.[a],c=e.params.map((u,m)=>e.varargs&&m===e.params.length-1&&u.tag==="array"?`${P(u.element)}...`:P(u));r.push(` ${a} extends ${e.typeParamShown?.[a]??(o?P(o):"Object")} declared in method <${e.typeParams.join(",")}>${e.name}(${c.join(",")})`)}else r.push(` ${a} extends Object declared in ${t.isInterface?"interface":"class"} ${t.name}`);return r}function pn(i,t){if(i.tag==="array"&&t.tag==="array")return tt(i.element)&&pn(i.element,t.element);let e=t.tag==="library"&&t.symbol.typeParams.length>0&&!t.args.length||t.tag==="class"&&(t.symbol.typeParams?.length??0)>0&&!t.args?.length,n=i.tag==="library"?i.args:i.tag==="class"?i.args??[]:[],s=n.length>0&&!n.every(r=>r.tag==="wildcard"&&!r.bound);return e&&s&&H(t,q(i))}function Io(i,t){let e=!1;return bs(i,n=>{n===t&&(e=!0)}),e}function ar(i,t){if(H(i,t))return t;if(H(t,i))return i;let e=[],n=[i];for(;n.length;){let r=n.shift(),a=r.tag==="class"?In(r):r.tag==="library"?tr(r):[];for(let o of a)e.some(c=>rt(c,o))||(e.push(o),n.push(o))}let s=e.filter(r=>H(t,r)&&!rt(r,G));return s.find(r=>r.tag==="class"&&!r.symbol.isInterface)??s.find(r=>r.tag==="class")??s.find(r=>r.tag==="library"&&!r.symbol.isInterface)??G}function Oo(i){return i.tag==="wildcard"?i.bound??G:i}function Ie(i){return i.tag==="wildcard"?i.isSuper?G:i.bound??G:i}function Bn(i,t=[]){let e=n=>{switch(n.tag){case"typevar":n.symbol&&!t.includes(n.symbol)&&t.push(n.symbol);return;case"array":return e(n.element);case"wildcard":n.bound&&e(n.bound);return;case"library":return n.args.forEach(e);case"class":return n.args?.forEach(e)}};return i.forEach(e),t}function $t(i){let t=Bn(i);if(!t.length)return[];let e=[t.length===1?` where ${t[0].name} is a type-variable:`:` where ${t.map(n=>n.name).join(",")} are type-variables:`];for(let n of t)e.push(` ${n.name} extends ${n.bounds.length?n.bounds.map(P).join(","):"Object"} declared in ${n.declaredIn}`);return e}function Lo(i,t,e,n){if(rt(i,t))return i;if(i.tag==="byte"&&t.tag==="short"||i.tag==="short"&&t.tag==="byte")return cn;let s={byte:[-128,127],short:[-32768,32767],char:[0,65535]},r=(a,o)=>{let c=s[a.tag];return c!==void 0&&o?.kind==="int"&&o.value>=c[0]&&o.value<=c[1]};return r(i,n)?i:r(t,e)?t:Un(i,t)}function Qi(i,t){return rt(i,t)?i:i.tag==="null"?t:t.tag==="null"?i:G}function yn(i,t){return Ot(t)?Di(i,t.tag)??i:i}function No(i,t,e){let n=yn(t,e);switch(n.kind){case"int":return Q(i==="-"?-n.value:i==="~"?~n.value:n.value);case"long":return Nt(i==="-"?-n.value:i==="~"?~n.value:n.value);case"double":return Qt(i==="-"?-n.value:n.value);case"float":return ue(i==="-"?-n.value:n.value)}}function $o(i,t,e,n){if(i==="+"&&(t.kind==="string"||e.kind==="string"))return er(Ln(t)+Ln(e));let s=t.kind==="double"||e.kind==="double"?"double":t.kind==="float"||e.kind==="float"?"float":t.kind==="long"||e.kind==="long"?"long":"int",r=i==="<<"||i===">>"||i===">>>";if(n?.tag==="long"||!r&&s==="long"&&t.kind!=="boolean"){if(r){let m=hn(t),h=hn(e);if(m===void 0||h===void 0)return;let d=BigInt(Number(BigInt.asUintN(6,h)));return i==="<<"?Nt(m<<d):i===">>"?Nt(m>>d):Nt(BigInt.asUintN(64,m)>>d)}let c=hn(t),u=hn(e);if(c===void 0||u===void 0)return;switch(i){case"+":return Nt(c+u);case"-":return Nt(c-u);case"*":return Nt(c*u);case"/":return u===0n?void 0:Nt(c/u);case"%":return u===0n?void 0:Nt(c%u);case"&":return Nt(c&u);case"|":return Nt(c|u);case"^":return Nt(c^u);case"<":return gt(c<u);case">":return gt(c>u);case"<=":return gt(c<=u);case">=":return gt(c>=u);case"==":return gt(c===u);case"!=":return gt(c!==u)}return}if((s==="double"||s==="float")&&!r){let c=s==="float",u=c?hs(t):$n(t),m=c?hs(e):$n(e);if(u===void 0||m===void 0)return;let h=c?ue:Qt;switch(i){case"+":return h(u+m);case"-":return h(u-m);case"*":return h(u*m);case"/":return h(u/m);case"%":return h(u%m);case"<":return gt(u<m);case">":return gt(u>m);case"<=":return gt(u<=m);case">=":return gt(u>=m);case"==":return gt(u===m);case"!=":return gt(u!==m)}return}let a=un(t),o=t.kind==="long"||e.kind==="long"?e.kind==="long"?Number(BigInt.asIntN(32,e.value)):un(e):un(e);if(a!==void 0&&o!==void 0){switch(i){case"+":return Q(a+o);case"-":return Q(a-o);case"*":return Q(Math.imul(a,o));case"/":return o===0?void 0:Q(a/o);case"%":return o===0?void 0:Q(a%o);case"<<":return Q(a<<o);case">>":return Q(a>>o);case">>>":return Q(a>>>o);case"&":return Q(a&o);case"|":return Q(a|o);case"^":return Q(a^o);case"<":return gt(a<o);case">":return gt(a>o);case"<=":return gt(a<=o);case">=":return gt(a>=o);case"==":return gt(a===o);case"!=":return gt(a!==o)}return}if(t.kind==="boolean"&&e.kind==="boolean"){let c=t.value,u=e.value;switch(i){case"&&":case"&":return gt(c&&u);case"||":case"|":return gt(c||u);case"^":case"!=":return gt(c!==u);case"==":return gt(c===u)}return}if(t.kind==="string"&&e.kind==="string"&&(i==="=="||i==="!=")){let c=t.value===e.value;return gt(i==="=="?c:!c)}}var l={ICONST:1,SCONST:2,ACONST_NULL:3,LOAD:4,STORE:5,POP:6,DUP:7,DUP_X1:8,DUP_X2:9,DUP2:24,IADD:10,ISUB:11,IMUL:12,IDIV:13,IREM:14,INEG:15,ISHL:16,ISHR:17,IUSHR:18,IAND:19,IOR:20,IXOR:21,INOT:22,BNOT:23,I2C:25,ICMPEQ:30,ICMPNE:31,ICMPLT:32,ICMPLE:33,ICMPGT:34,ICMPGE:35,ACMPEQ:36,ACMPNE:37,JUMP:40,JUMP_IF_FALSE:41,JUMP_IF_TRUE:42,IINC:43,TOSTRING_INT:50,TOSTRING_BOOL:51,TOSTRING_REF:52,SCONCAT:53,TOSTRING_CHAR:54,PRINT:60,RETURN:70,RETURN_VALUE:71,INVOKE:72,NEWARRAY:80,NEWARRAY_REF:84,ALOAD:81,ASTORE:82,ARRAYLENGTH:83,STR_LENGTH:90,STR_CHARAT:91,STR_EQUALS:92,GETSTATIC:100,PUTSTATIC:101,GETFIELD:102,PUTFIELD:103,NEW:104,VALUEOF:110,OBJ_TOSTRING:111,OBJ_HASHCODE:112,OBJ_EQUALS:113,NCONST:120,LADD:121,LSUB:122,LMUL:123,LDIV:124,LREM:125,LNEG:126,LSHL:127,LSHR:128,LUSHR:129,LAND:130,LOR:131,LXOR:132,DADD:133,DSUB:134,DMUL:135,DDIV:136,DREM:137,DNEG:138,L2I:139,L2D:140,D2I:141,D2L:142,TOSTRING_LONG:143,TOSTRING_DOUBLE:144,NEWMULTI:145,CHECKNULL:146,MATH:147,INVOKE_NATIVE:148,BOX:149,UNBOX:150,STR_TOCHARS:151,LAMBDA:152,STR_COMPARETO:153,HOST_ARG:154,HOST_RESULT:155,INVOKE_VIRTUAL:156,CHECKCAST:157,INSTANCEOF:158,OBJ_SUPER:159,ENUM_VALUEOF:160,ATHROW:161,THROWABLE:162,I2B:163,I2S:164,I2F:165,L2F:166,D2F:167,FADD:168,FSUB:169,FMUL:170,FDIV:171,FREM:172,TOSTRING_FLOAT:173,IF_CMP:180,IF_K:181,IF_LL:182,IF_LK:183,IF_LNULL:184,LOAD2:185,LOADK:186,IADDK:187,IINC_JUMP:188,ALOAD_LL:189,IOPK:190},Mt={FILL_TRACE:0,PRINT_TRACE:1,ADD_SUPPRESSED:2,GET_SUPPRESSED:3,CLASS_NAME:4,PRINT_UNCAUGHT:5,INIT_CAUSE:6},Mo=[[1,1],[1,0],[2,0],[1,1],[1,1],[1,0],[2,1]],Oe={INT:0,LONG:1,DOUBLE:2,CHAR:3,BOOLEAN:4,FLOAT:5,BYTE:6,SHORT:7},fr=["int","long","double","char","boolean","float","byte","short"],it={ABS_I:0,ABS_L:1,ABS_D:2,MAX_I:3,MAX_L:4,MAX_D:5,MIN_I:6,MIN_L:7,MIN_D:8,SQRT:9,FLOOR:10,CEIL:11,ROUND:12,ROUND_F:13},Po=[1,1,1,2,2,2,2,2,2,1,1,1,1,1],wt={NONE:0,INT:1,BOOLEAN:2,STRING:3,CHAR:4,CHAR_ARRAY:5,OBJECT:6,LONG:7,DOUBLE:8,FLOAT:9},z={INT:0,BOOLEAN:1,CHAR:2,REF:3,LONG:4,DOUBLE:5,BYTE:6,SHORT:7,FLOAT:8},Ke={};for(let[i,t]of Object.entries(l))Ke[t]={name:i,operands:0,pop:0,push:0};var _=(i,t,e,n)=>Object.assign(Ke[i],{operands:t,pop:e,push:n});_(l.ICONST,1,0,1);_(l.SCONST,1,0,1);_(l.ACONST_NULL,0,0,1);_(l.LOAD,1,0,1);_(l.STORE,1,1,0);_(l.POP,0,1,0);_(l.DUP,0,1,2);_(l.DUP_X1,0,2,3);_(l.DUP_X2,0,3,4);_(l.DUP2,0,2,4);for(let i of[l.IADD,l.ISUB,l.IMUL,l.IDIV,l.IREM,l.ISHL,l.ISHR,l.IUSHR,l.IAND,l.IOR,l.IXOR])_(i,0,2,1);for(let i of[l.ICMPEQ,l.ICMPNE,l.ICMPLT,l.ICMPLE,l.ICMPGT,l.ICMPGE,l.ACMPEQ,l.ACMPNE])_(i,0,2,1);for(let i of[l.INEG,l.INOT,l.BNOT,l.I2C,l.TOSTRING_INT,l.TOSTRING_BOOL,l.TOSTRING_REF,l.TOSTRING_CHAR])_(i,0,1,1);_(l.JUMP,1,0,0);_(l.JUMP_IF_FALSE,1,1,0);_(l.JUMP_IF_TRUE,1,1,0);_(l.IINC,2,0,0);_(l.SCONCAT,0,2,1);_(l.PRINT,3,0,0);_(l.RETURN,0,0,0);_(l.RETURN_VALUE,0,1,0);_(l.INVOKE,2,0,0);_(l.NEWARRAY,1,1,1);_(l.NEWARRAY_REF,1,1,1);_(l.ALOAD,2,2,1);_(l.ASTORE,2,3,0);_(l.ARRAYLENGTH,1,1,1);_(l.STR_LENGTH,1,1,1);_(l.STR_CHARAT,1,2,1);_(l.STR_EQUALS,1,2,1);_(l.GETSTATIC,1,0,1);_(l.PUTSTATIC,1,1,0);_(l.GETFIELD,2,1,1);_(l.PUTFIELD,2,2,0);_(l.NEW,1,0,1);_(l.VALUEOF,0,1,1);_(l.OBJ_TOSTRING,1,1,1);_(l.OBJ_HASHCODE,1,1,1);_(l.OBJ_EQUALS,1,2,1);_(l.NCONST,1,0,1);for(let i of[l.LADD,l.LSUB,l.LMUL,l.LDIV,l.LREM,l.LSHL,l.LSHR,l.LUSHR,l.LAND,l.LOR,l.LXOR])_(i,0,2,1);for(let i of[l.DADD,l.DSUB,l.DMUL,l.DDIV,l.DREM])_(i,0,2,1);for(let i of[l.LNEG,l.DNEG,l.L2I,l.L2D,l.D2I,l.D2L,l.TOSTRING_LONG,l.TOSTRING_DOUBLE])_(i,0,1,1);for(let i of[l.I2B,l.I2S,l.I2F,l.L2F,l.D2F,l.TOSTRING_FLOAT])_(i,0,1,1);for(let i of[l.FADD,l.FSUB,l.FMUL,l.FDIV,l.FREM])_(i,0,2,1);_(l.NEWMULTI,2,0,1);_(l.CHECKNULL,1,1,0);_(l.MATH,1,0,1);_(l.INVOKE_NATIVE,2,0,0);_(l.BOX,1,1,1);_(l.UNBOX,2,1,1);_(l.STR_TOCHARS,1,1,1);_(l.LAMBDA,5,0,1);_(l.STR_COMPARETO,2,2,1);_(l.HOST_ARG,1,0,1);_(l.HOST_RESULT,0,1,0);_(l.INVOKE_VIRTUAL,2,0,0);_(l.CHECKCAST,1,1,1);_(l.INSTANCEOF,1,1,1);_(l.OBJ_SUPER,1,0,1);_(l.ENUM_VALUEOF,1,1,1);_(l.ATHROW,1,1,0);_(l.THROWABLE,1,0,0);_(l.IF_CMP,2,2,0);_(l.IF_K,3,1,0);_(l.IF_LL,4,0,0);_(l.IF_LK,4,0,0);_(l.IF_LNULL,3,0,0);_(l.LOAD2,2,0,2);_(l.LOADK,2,0,2);_(l.IADDK,1,1,1);_(l.IINC_JUMP,3,0,0);_(l.ALOAD_LL,4,0,1);_(l.IOPK,2,1,1);var mr={[l.IF_CMP]:2,[l.IF_K]:3,[l.IF_LL]:4,[l.IF_LK]:4,[l.IF_LNULL]:3,[l.IINC_JUMP]:3},Ro={[l.IF_LL]:[2,3],[l.IF_LK]:[2],[l.IF_LNULL]:[2],[l.LOAD2]:[1,2],[l.LOADK]:[1],[l.IINC_JUMP]:[1],[l.ALOAD_LL]:[1,2]},pr=new Set([l.IMUL,l.IDIV,l.IREM,l.IAND,l.IOR,l.IXOR,l.ISHL,l.ISHR,l.IUSHR]),Jo=new Set([l.IF_CMP,l.IF_K,l.IF_LL,l.IF_LK]),Do=new Set([l.ATHROW,l.ARRAYLENGTH,l.STR_LENGTH,l.STR_CHARAT,l.STR_EQUALS,l.OBJ_TOSTRING,l.OBJ_HASHCODE,l.OBJ_EQUALS,l.CHECKNULL,l.STR_TOCHARS,l.STR_COMPARETO]),Fo=new Set([l.ALOAD,l.ASTORE,l.INVOKE,l.INVOKE_VIRTUAL,l.GETFIELD,l.PUTFIELD,l.INVOKE_NATIVE,l.UNBOX,l.STR_COMPARETO]),et=class extends Error{constructor(t){super(`invalid bytecode: ${t}`),this.name="BytecodeError"}};function ia(i,t){let e=t.classes??[],n=Math.max(0,...e.map(m=>m.instanceFieldIsReference.length)),s=i.code,r=new Set;for(let m=0;m<s.length;){let h=Ke[s[m]];if(!h)throw new et(`unknown opcode ${s[m]} at ${m}`);if(r.add(m),m+=1+h.operands,m>s.length)throw new et("truncated instruction at end")}let a=new Map,o=[[0,0]],c=i.handlers??new Int32Array(0);if(c.length%4!==0)throw new et("bad handler table");for(let m=0;m<c.length;m+=4){let[h,d,p,C]=[c[m],c[m+1],c[m+2],c[m+3]];if(!r.has(h)||!(r.has(d)||d===s.length)||d<=h||!r.has(p))throw new et(`bad handler ${m/4}`);if(C<-1||C>=t.strings.length)throw new et(`bad handler type ${m/4}`);o.push([p,1])}let u=0;for(;o.length;){let[m,h]=o.pop(),d=m,p=h;for(;;){if(!r.has(d))throw new et(`control reaches non-instruction offset ${d}`);let C=a.get(d);if(C!==void 0){if(C!==p)throw new et(`stack height ${p} != ${C} at merge ${d}`);break}a.set(d,p);let S=s[d],k=Ke[S],x=k.pop,w=k.push;if(S===l.PRINT&&(x=s[d+3]===wt.NONE?0:1),S===l.NEWMULTI&&(x=s[d+2]),S===l.MATH){let O=Po[s[d+1]];if(O===void 0)throw new et(`bad Math function at ${d}`);x=O}if(S===l.INVOKE||S===l.INVOKE_VIRTUAL){let O=t.methods[s[d+1]];if(!O)throw new et(`call to unknown method ${s[d+1]} at ${d}`);x=O.argCount,w=O.returnsValue?1:0}if(S===l.INVOKE_NATIVE){let O=t.natives?.[s[d+1]];if(!O)throw new et(`call to unknown native ${s[d+1]} at ${d}`);x=O.argCount,w=O.returnsValue?1:0}if((S===l.BOX||S===l.UNBOX)&&(s[d+1]<0||s[d+1]>=fr.length))throw new et(`bad box kind at ${d}`);if(S===l.LAMBDA){let O=t.methods[s[d+1]],R=s[d+2];if(!O||R<0||R>O.argCount)throw new et(`bad lambda method at ${d}`);if(s[d+3]<0||s[d+3]>=t.strings.length||s[d+5]>=t.strings.length)throw new et(`bad lambda interface at ${d}`);x=R}if(S===l.NEW&&(s[d+1]<0||s[d+1]>=e.length))throw new et(`bad class index at ${d}`);if(S===l.INVOKE_VIRTUAL&&t.methods[s[d+1]]?.selector===void 0)throw new et(`virtual call to a method without a selector at ${d}`);if(S===l.THROWABLE){let O=Mo[s[d+1]];if(!O)throw new et(`bad Throwable operation at ${d}`);[x,w]=O}if(S===l.OBJ_SUPER){let O=s[d+1];if(O<0||O>2)throw new et(`bad Object method at ${d}`);x=O===2?2:1}if((S===l.NEWARRAY_REF||S===l.NEWMULTI||S===l.CHECKCAST||S===l.INSTANCEOF)&&(s[d+1]<0||s[d+1]>=t.strings.length))throw new et(`bad descriptor index at ${d}`);if(S===l.NEWMULTI&&s[d+2]<2)throw new et(`NEWMULTI needs two or more lengths at ${d}`);if(S===l.NCONST&&(s[d+1]<0||s[d+1]>=(t.numbers?.length??0)))throw new et(`bad number index at ${d}`);if(p<x)throw new et(`stack underflow at ${d} (${k.name})`);if(p=p-x+w,u=Math.max(u,p),S===l.LOAD||S===l.STORE||S===l.IINC){let O=s[d+1];if(O<0||O>=i.maxLocals)throw new et(`bad local slot ${O} at ${d}`)}for(let O of Ro[S]??[]){let R=s[d+O];if(R<0||R>=i.maxLocals)throw new et(`bad local slot ${R} at ${d}`)}if(S===l.IOPK&&!pr.has(s[d+1]))throw new et(`bad operator at ${d}`);if(S===l.IOPK&&(s[d+1]===l.IDIV||s[d+1]===l.IREM)&&s[d+2]===0)throw new et(`division by a zero constant at ${d}`);if(Jo.has(S)&&(s[d+1]<0||s[d+1]>11))throw new et(`bad condition at ${d}`);if(S===l.ALOAD_LL&&(s[d+4]<-1||s[d+4]>=t.messages.length))throw new et(`bad message index at ${d}`);if(S===l.SCONST&&(s[d+1]<0||s[d+1]>=t.strings.length))throw new et(`bad string index at ${d}`);if(S===l.GETSTATIC||S===l.PUTSTATIC||S===l.GETFIELD||S===l.PUTFIELD){let O=S<=l.PUTSTATIC?t.staticFieldIsReference?.length??0:n;if(s[d+1]<0||s[d+1]>=O)throw new et(`bad field index at ${d}`)}let I=Fo.has(S)?s[d+2]:Do.has(S)?s[d+1]:null;if(I!==null&&(I<-1||I>=t.messages.length))throw new et(`bad message index at ${d}`);if(S===l.RETURN||S===l.RETURN_VALUE){if(S===l.RETURN_VALUE!==i.returnsValue)throw new et(`wrong return kind at ${d}`);if(p!==0)throw new et(`return with non-empty stack at ${d}`);break}if(S===l.ATHROW)break;let L=d+1+k.operands,$=mr[S];if($!==void 0){let O=s[d+$];if(!r.has(O))throw new et(`jump to ${O} at ${d}`);if(o.push([O,p]),S===l.IINC_JUMP)break}if(S===l.JUMP||S===l.JUMP_IF_FALSE||S===l.JUMP_IF_TRUE){let O=s[d+1];if(!r.has(O))throw new et(`jump to ${O} at ${d}`);if(o.push([O,p]),S===l.JUMP)break}if(L>=s.length)throw new et(`falls off the end at ${d}`);d=L}}return u}function aa(i,t){let e=i.lines,n=0;for(let s=0;s<e.length&&!(e[s]>t);s+=2)n=e[s+1];return n}var jo=l.ICMPEQ,Ts=i=>i!==void 0&&i>=l.ICMPEQ&&i<=l.ICMPGE,Ss=(i,t)=>i-jo+(t===l.JUMP_IF_FALSE?6:0),Vn=i=>i===l.JUMP_IF_FALSE||i===l.JUMP_IF_TRUE;function oa(i){let t=i.code,e=[];for(let u=0;u<t.length;u+=1+Ke[t[u]].operands)e.push(u);let n=new Set;for(let u of e){let m=t[u];(m===l.JUMP||m===l.JUMP_IF_FALSE||m===l.JUMP_IF_TRUE)&&n.add(t[u+1])}let s=i.handlers??new Int32Array(0);for(let u=0;u<s.length;u+=4)n.add(s[u]).add(s[u+1]).add(s[u+2]);for(let u=0;u<i.lines.length;u+=2)n.add(i.lines[u]);let r=[],a=new Map,o=[];for(let u=0;u<e.length;){let m=w=>e[u+w],h=w=>m(w)===void 0?void 0:t[m(w)],d=(w,I=1)=>t[m(w)+I],p=w=>{for(let I=1;I<w;I++)if(m(I)===void 0||n.has(m(I)))return!1;return!0},C=(w,...I)=>{let L=r.length;for(let O=0;O<w;O++)a.set(m(O),L);r.push(...I);let $=mr[I[0]];$!==void 0&&o.push(L+$),u+=w},S=h(0);if(S===l.LOAD&&h(1)===l.LOAD&&Ts(h(2))&&Vn(h(3))&&p(4)){C(4,l.IF_LL,Ss(h(2),h(3)),d(0),d(1),d(3));continue}if(S===l.LOAD&&h(1)===l.ICONST&&Ts(h(2))&&Vn(h(3))&&p(4)){C(4,l.IF_LK,Ss(h(2),h(3)),d(0),d(1),d(3));continue}if(S===l.LOAD&&h(1)===l.ACONST_NULL&&(h(2)===l.ACMPEQ||h(2)===l.ACMPNE)&&Vn(h(3))&&p(4)){let w=h(2)===l.ACMPEQ==(h(3)===l.JUMP_IF_TRUE);C(4,l.IF_LNULL,w?1:0,d(0),d(3));continue}if(S===l.ICONST&&Ts(h(1))&&Vn(h(2))&&p(3)){C(3,l.IF_K,Ss(h(1),h(2)),d(0),d(2));continue}if(Ts(S)&&Vn(h(1))&&p(2)){C(2,l.IF_CMP,Ss(S,h(1)),d(1));continue}if(S===l.LOAD&&h(1)===l.LOAD&&h(2)===l.ALOAD&&p(3)){C(3,l.ALOAD_LL,d(0),d(1),d(2),d(2,2));continue}if(S===l.ICONST&&(h(1)===l.IADD||h(1)===l.ISUB)&&p(2)){C(2,l.IADDK,h(1)===l.IADD?d(0):-d(0)|0);continue}if(S===l.ICONST&&pr.has(h(1))&&p(2)&&!((h(1)===l.IDIV||h(1)===l.IREM)&&d(0)===0)){C(2,l.IOPK,h(1),d(0));continue}if(S===l.IINC&&h(1)===l.JUMP&&p(2)){C(2,l.IINC_JUMP,d(0),d(0,2),d(1));continue}if(S===l.LOAD&&h(1)===l.LOAD&&p(2)){C(2,l.LOAD2,d(0),d(1));continue}if(S===l.LOAD&&h(1)===l.ICONST&&p(2)){C(2,l.LOADK,d(0),d(1));continue}let k=m(0),x=1+Ke[S].operands;a.set(k,r.length),(S===l.JUMP||S===l.JUMP_IF_FALSE||S===l.JUMP_IF_TRUE)&&o.push(r.length+1);for(let w=0;w<x;w++)r.push(t[k+w]);u++}if(r.length===t.length)return;a.set(t.length,r.length);let c=u=>{let m=a.get(u);if(m===void 0)throw new Error(`fuse: offset ${u} is not an instruction start`);return m};for(let u of o)r[u]=c(r[u]);i.code=Int32Array.from(r),i.lines=i.lines.map((u,m)=>m%2===0?c(u):u),i.handlers&&(i.handlers=i.handlers.map((u,m)=>m%4===3?u:c(u)))}var Uo=["getMessage","getLocalizedMessage","getCause","toString","fillInStackTrace"];function Tr(i,t){return i.declaration.members.filter(e=>e.kind==="Initializer"&&e.isStatic===t&&e.symbol!==void 0)}function la(i){return Math.max(i.maxSlots,i.finallySlots??0)}function xr(i,t,e){let n=new Sr(t),s=i.classes.find(d=>d.binaryName==="java.lang.Throwable");n.useThrowable(s);let r=i.methods.map(d=>d.builtin?n.builtin(d):d.isAbstract?n.abstractStub(d):d.isConstructor?n.constructorCode(d):n.method(d)),a=Bo(i),o=d=>i.selectors.get(d)??-1,c=i.classes.map(d=>{let p=d.fields.filter(L=>L.isStatic&&L.declarator.init&&!L.constant),C=Tr(d,!0),S=p.length||d.enumConstants.length||C.length?r.push(n.staticInitializer(d,p))-1:-1,k=new Array(d.instanceCount).fill(!1);for(let L=d;L;L=L.superclass){L.outerField>=0&&(k[L.outerField]=!0);for(let $ of L.fields)$.isStatic||(k[$.index]=ws($.type));L===s&&k.fill(!0,ut.message,ut.causeSet)}let x=a.get(d),w=L=>o(L)>=0?x[o(L)]:-1,I={};return x.forEach((L,$)=>{if(L<0)return;let O=i.methods[L],R=`${O.name}/${O.params.length}`;(!(R in I)||O.owner===d)&&(I[R]=L)}),{name:d.binaryName,instanceFieldIsReference:k,clinit:S,toString:w("toString()"),equals:w("equals(Object)"),hashCode:w("hashCode()"),superclass:d.superclass?.index??-1,isInterface:d.isInterface,types:Vo(d),vtable:x,virtuals:I,...d.isEnum?{enumConstants:d.enumConstants.map(L=>L.index),canonicalName:d.binaryName.replace(/\\$/g,".")}:{}}}),u=r.push(e?n.practiceLauncher(e):n.launcher(i))-1,m=r.push(n.uncaughtPrinter(s))-1,h={version:13,classes:c,strings:n.strings,numbers:n.numbers,natives:n.natives,messages:n.messages,methods:r,staticFieldIsReference:i.staticFields.map(d=>ws(d.type)),staticFieldOwner:i.staticFields.map(d=>d.owner.index),entry:u,uncaught:m};for(let d of r)oa(d),d.maxStack=ia(d,h);return h}function Bo(i){let t=i.selectors.size,e=new Map,n=(r,a=[])=>{for(let o of r.interfaces)a.includes(o)||a.push(o),n(o,a);return r.superclass&&n(r.superclass,a),a},s=r=>{let a=e.get(r);if(a)return a;let o=r.superclass?s(r.superclass).slice():new Int32Array(t).fill(-1);for(let c of r.methods)c.selector!==void 0&&(o[c.selector]=c.index);for(let c of n(r))for(let u of c.methods){if(u.selector===void 0||u.isAbstract)continue;let m=o[u.selector];(m<0||i.methods[m].isAbstract)&&(o[u.selector]=u.index)}for(let c=r;c;c=c.superclass)for(let[u,m]of c.bridges??[])o[m]>=0&&(o[u]=o[m]);return e.set(r,o),o};for(let r of i.classes)s(r);return e}function Vo(i){let t=new Set,e=n=>{t.add(n.binaryName),n.isEnum&&t.add("java.lang.Enum").add("java.lang.Comparable");for(let s of n.libraryInterfaces)t.add(s.symbol.qualifiedName);n.superclass&&e(n.superclass);for(let s of n.interfaces)e(s)};return e(i),i.isRecord&&t.add("java.lang.Record"),t.add("java.lang.Object"),[...t]}var W=class{pc=-1;uses=[]};function Re(i){switch(i.tag){case"int":return z.INT;case"boolean":return z.BOOLEAN;case"char":return z.CHAR;case"long":return z.LONG;case"double":return z.DOUBLE;case"byte":return z.BYTE;case"short":return z.SHORT;case"float":return z.FLOAT;case"string":case"class":case"array":case"library":case"diamond":case"object":case"typevar":return z.REF;default:throw new Error(`codegen: array of ${P(i)}`)}}var ca=["int","byte/boolean","char","object","long","double","byte/boolean","short","float"];function re(i){switch(i.tag){case"int":return"I";case"char":return"C";case"boolean":return"Z";case"long":return"J";case"double":return"D";case"byte":return"B";case"short":return"S";case"float":return"F";case"string":return"Ljava.lang.String;";case"class":return`L${i.symbol.binaryName};`;case"library":case"diamond":return`L${i.symbol.qualifiedName};`;case"object":return"Ljava.lang.Object;";case"array":return"["+re(i.element);case"typevar":return re(q(i));default:throw new Error(`codegen: descriptor of ${P(i)}`)}}function Hn(i){return i.tag==="class"?i.symbol.binaryName:i.tag==="array"?Hn(i.element)+"[]":P(i)}function Le(i){let t=i;for(;t.kind==="Parenthesized";)t=t.expression;return t}function yr(i){let t=Le(i);return t.kind==="Name"&&t.symbol?.kind==="type"||t.kind==="FieldAccess"&&t.typeSymbol!==void 0}function gr(i,t){return i.tag==="double"||t.tag==="double"?lt:i.tag==="float"||t.tag==="float"?St:i.tag==="long"||t.tag==="long"?Lt:U}var Ho=new Set(["int","byte","short","char","long","float","double"]),Gn=i=>i!==void 0&&Ho.has(i.tag),br=i=>i.tag==="int"||i.tag==="byte"||i.tag==="short"||i.tag==="char",we=i=>Gn(i)||i?.tag==="boolean",Zt={int:Oe.INT,long:Oe.LONG,double:Oe.DOUBLE,char:Oe.CHAR,boolean:Oe.BOOLEAN,float:Oe.FLOAT,byte:Oe.BYTE,short:Oe.SHORT},Go={int:"java.lang.Integer.intValue()",long:"java.lang.Long.longValue()",double:"java.lang.Double.doubleValue()",char:"java.lang.Character.charValue()",boolean:"java.lang.Boolean.booleanValue()",float:"java.lang.Float.floatValue()",byte:"java.lang.Byte.byteValue()",short:"java.lang.Short.shortValue()"},zo={"+":{int:l.IADD,long:l.LADD,double:l.DADD,float:l.FADD},"-":{int:l.ISUB,long:l.LSUB,double:l.DSUB,float:l.FSUB},"*":{int:l.IMUL,long:l.LMUL,double:l.DMUL,float:l.FMUL},"/":{int:l.IDIV,long:l.LDIV,double:l.DDIV,float:l.FDIV},"%":{int:l.IREM,long:l.LREM,double:l.DREM,float:l.FREM},"<<":{int:l.ISHL,long:l.LSHL},">>":{int:l.ISHR,long:l.LSHR},">>>":{int:l.IUSHR,long:l.LUSHR},"&":{int:l.IAND,long:l.LAND},"|":{int:l.IOR,long:l.LOR},"^":{int:l.IXOR,long:l.LXOR}},xs={"<":l.ICMPLT,"<=":l.ICMPLE,">":l.ICMPGT,">=":l.ICMPGE,"==":l.ICMPEQ,"!=":l.ICMPNE},Ko={"abs-int":it.ABS_I,"abs-long":it.ABS_L,"abs-double":it.ABS_D,"max-int":it.MAX_I,"max-long":it.MAX_L,"max-double":it.MAX_D,"min-int":it.MIN_I,"min-long":it.MIN_L,"min-double":it.MIN_D,"abs-float":it.ABS_D,"max-float":it.MAX_D,"min-float":it.MIN_D,"round-float":it.ROUND_F,sqrt:it.SQRT,floor:it.FLOOR,ceil:it.CEIL,"round-double":it.ROUND},vs=class{segments=[];start=-1;open(t){this.start<0&&(this.start=t)}close(t){this.start>=0&&t>this.start&&this.segments.push([this.start,t]),this.start=-1}},Sr=class{strings=[];numbers=[];natives=[];#B=new Map;messages=[];#N=new Map;#G=new Map;#z=new Map;#$;#Z;#r=[];#y=[];#s=-1;#n=new Map;#v=U;#u=0;#i=!1;#k=[];#U=0;#o=0;#b=0;#mt=0;#tt=[];#R=[];#ot=Object.create(null);constructor(t){this.#$=t}#W(t){return`${t.owner.binaryName}.${t.name}(${t.params.map(Hn).join(", ")})`}#yt(t,e){return`${t.qualifier??e.owner.binaryName}.${e.name}(${e.params.map(Hn).join(", ")})`}#a(t,e,n){this.#Z=t,this.#r=[],this.#y=[],this.#s=-1,this.#n=new Map,this.#v=n,this.#u=e,this.#k=[],this.#U=0,this.#o=0,this.#b=0,this.#mt=0,this.#tt=[],this.#R=[]}useThrowable(t){for(let e of t.methods)Uo.includes(e.name)&&(this.#ot[e.name]=e)}#c(t){if(t.lambda){let s=t.locals.filter(r=>r.parameter!==void 0).sort((r,a)=>r.parameter-a.parameter);return s.some(r=>r.type.tag==="long"||r.type.tag==="double")?Int32Array.from([...t.isStatic?[]:[0],...s.map(r=>r.slot)]):void 0}let e=t.declaration.params;if(!e.some(s=>s.symbol&&(s.symbol.type.tag==="long"||s.symbol.type.tag==="double")))return;let n=(t.isStatic?0:1)+(t.isConstructor&&t.owner.isInner?1:0)+(t.isConstructor&&(t.owner.isEnum||t.owner.enumBody)?2:0);return Int32Array.from([...Array.from({length:n},(s,r)=>r),...e.map(s=>s.symbol.slot)])}#X(t,e){let n={className:t.binaryName,classIndex:t.index,isStatic:e.isStatic,name:e.name,display:e.display,file:this.#$.name,argCount:e.argCount,returnsValue:e.returnsValue,code:Int32Array.from(this.#r),lines:Int32Array.from(this.#y),maxLocals:Math.max(1,this.#u+this.#mt),maxStack:0};return e.hidden&&(n.hidden=!0),this.#tt.length&&(n.handlers=Int32Array.from(this.#tt)),n}#gt(t){return t.parameter!==void 0?`<parameter${t.parameter}>`:`<local${this.#O(t)}>`}#O(t){let e=t.slot;for(let n of this.#k)t.slot>=n.from&&(e+=n.by);return e}#T(){let t=this.#u+this.#b++;return this.#mt=Math.max(this.#mt,this.#b),t}#C(){this.#b--}staticInitializer(t,e){this.#a(t,Math.max(1,...Tr(t,!0).map(n=>la(n.symbol))),U);for(let n of t.enumConstants){let{node:s,ordinal:r}=n.enumConstant;this.#w(s.pos),this.#t(l.NEW,s.ctor.owner.index,l.DUP,l.SCONST,this.#S(s.name),l.ICONST,r),this.#lt(s.args,s.ctor.params,s.varargs),this.#t(l.INVOKE,s.ctor.index,-1,l.PUTSTATIC,n.index)}return this.#A(t,!0,n=>e.includes(n),0),this.#t(l.RETURN),this.#X(t,{name:"<clinit>",display:`${t.binaryName}.<clinit>()`,isStatic:!0,argCount:0,returnsValue:!1})}#A(t,e,n,s){for(let r of t.declaration.members)if(r.kind==="FieldDeclaration")for(let a of r.declarators){let o=a.field;o&&o.isStatic===e&&n(o)&&this.#L(o)}else r.kind==="Initializer"&&r.isStatic===e&&r.symbol&&(s&&this.#k.push({from:1,by:s}),this.#E(r.body),s&&this.#k.pop())}#L(t){let e=t.declarator.init;this.#w(t.declarator.pos),t.isStatic||this.#t(l.LOAD,0),e.kind==="ArrayInitializer"?this.#xt(e):(this.#h(e,!0),this.#m(t.type,e)),t.isStatic?this.#t(l.PUTSTATIC,t.index):this.#t(l.PUTFIELD,t.index,-1)}constructorCode(t){let e=t.owner,n=e.isInner?1:e.isEnum||e.enumBody?2:0,s=t.params.length+1+n,r=1+n+t.params.reduce((d,p)=>d+(p.tag==="long"||p.tag==="double"?2:1),0),a=Tr(e,!1).map(d=>r-1+la(d.symbol));this.#a(e,Math.max(s,t.maxSlots,t.finallySlots??0,...a),U);let o=t.declaration.body,c=o.statements,u=c[0];if(u?.kind==="ConstructorCall"&&u.keyword==="this")this.#w(u.start),this.#t(l.LOAD,0),n&&this.#t(l.LOAD,1),n===2&&this.#t(l.LOAD,2),this.#lt(u.args,u.target.params,u.varargs),this.#t(l.INVOKE,u.target.index,-1),c=c.slice(1);else{if(e.isInner&&this.#t(l.LOAD,0,l.LOAD,1,l.PUTFIELD,e.outerField,-1),e.isEnum&&this.#t(l.LOAD,0,l.LOAD,1,l.PUTFIELD,0,-1,l.LOAD,0,l.LOAD,2,l.PUTFIELD,1,-1),u?.kind==="ConstructorCall")u.target&&(this.#w(u.start),this.#t(l.LOAD,0),this.#lt(u.args,u.target.params,u.varargs),this.#t(l.INVOKE,u.target.index,-1)),c=c.slice(1);else if(t.forwardsToSuper){if(t.superConstructor){this.#w(o.pos),this.#t(l.LOAD,0),e.enumBody&&this.#t(l.LOAD,1,l.LOAD,2);let d=1+n;for(let p of t.params)this.#t(l.LOAD,d),d+=p.tag==="long"||p.tag==="double"?2:1;this.#t(l.INVOKE,t.superConstructor.index,-1)}}else t.superConstructor&&(this.#w(o.pos),this.#t(l.LOAD,0),this.#lt([],t.superConstructor.params,t.superVarargs),this.#t(l.INVOKE,t.superConstructor.index,-1));this.#A(e,!1,d=>d.declarator.init!==void 0&&d.declarator.init!==null,r-1)}for(let d of c)this.#E(d);this.#w(o.end-1),t.declaration.compact&&t.declaration.params.forEach((d,p)=>this.#t(l.LOAD,0,l.LOAD,d.symbol.slot,l.PUTFIELD,e.components[p].index,-1)),this.#t(l.RETURN);let m=this.#X(e,{name:"<init>",display:`${e.binaryName}.<init>(${t.params.map(Hn).join(", ")})`,isStatic:!1,argCount:s,returnsValue:!1}),h=this.#c(t);return h&&(m.argSlots=h),m}launcher(t){let e=t.main,n=t.mainClass;return this.#a(n,1,U),e.isStatic||this.#t(l.NEW,n.index,l.DUP,l.INVOKE,t.mainConstructor.index,-1),e.params.length&&this.#t(l.ICONST,0,l.NEWARRAY,z.REF),this.#t(l.INVOKE,e.index,-1,l.RETURN),this.#y=[],this.#X(n,{name:"<launch>",display:"<launch>",isStatic:!0,argCount:0,returnsValue:!1,hidden:!0})}practiceLauncher(t){let{method:e}=t,n=e.owner;return this.#a(n,1,U),e.isStatic||this.#t(l.NEW,n.index,l.DUP,l.INVOKE,t.constructor.index,-1),e.params.forEach((s,r)=>this.#t(l.HOST_ARG,r)),this.#t(l.INVOKE,e.index,-1),e.returnType.tag!=="void"&&this.#t(l.HOST_RESULT),this.#t(l.RETURN),this.#y=[],this.#X(n,{name:"<practice>",display:"<practice>",isStatic:!0,argCount:0,returnsValue:!1,hidden:!0})}builtin(t){let e=t.owner,n=t.params.length+(t.isStatic?0:1);this.#a(e,Math.max(n,t.maxSlots,t.finallySlots??0),t.returnType),this.#w(e.declaration.keywordPos);let s=a=>this.#t(l.LOAD,0,l.GETFIELD,a.index,-1);switch(t.builtin){case"enum-values":this.#t(l.ICONST,e.enumConstants.length,l.NEWARRAY_REF,this.#S(`[L${e.binaryName};`)),e.enumConstants.forEach((a,o)=>this.#t(l.DUP,l.ICONST,o,l.GETSTATIC,a.index,l.ASTORE,z.REF,-1)),this.#t(l.RETURN_VALUE);break;case"enum-valueOf":this.#t(l.LOAD,0,l.ENUM_VALUEOF,e.index,l.RETURN_VALUE);break;case"enum-name":case"enum-toString":this.#t(l.LOAD,0,l.GETFIELD,0,-1,l.RETURN_VALUE);break;case"enum-ordinal":this.#t(l.LOAD,0,l.GETFIELD,1,-1,l.RETURN_VALUE);break;case"enum-compareTo":this.#t(l.LOAD,0,l.GETFIELD,1,-1,l.LOAD,1,l.GETFIELD,1,this.#K(\'Cannot invoke "Object.getClass()" because "other" is null\'),l.ISUB,l.RETURN_VALUE);break;case"record-constructor":{let a=1;for(let o of e.components)this.#t(l.LOAD,0,l.LOAD,a,l.PUTFIELD,o.index,-1),a+=o.type.tag==="long"||o.type.tag==="double"?2:1;this.#t(l.RETURN);break}case"record-accessor":s(e.components[t.component]),this.#t(l.RETURN_VALUE);break;case"record-toString":this.#D(e);break;case"record-hashCode":this.#ht(e);break;case"record-equals":this.#te(e);break;case"throwable-constructor":this.#Ht(t);break;case"throwable-getMessage":this.#t(l.LOAD,0,l.GETFIELD,ut.message,-1,l.RETURN_VALUE);break;case"throwable-getLocalizedMessage":this.#t(l.LOAD,0,l.INVOKE_VIRTUAL,this.#ot.getMessage.index,-1,l.RETURN_VALUE);break;case"throwable-getCause":this.#t(l.LOAD,0,l.GETFIELD,ut.cause,-1,l.RETURN_VALUE);break;case"throwable-initCause":this.#t(l.LOAD,0,l.LOAD,1,l.THROWABLE,Mt.INIT_CAUSE,l.RETURN_VALUE);break;case"throwable-toString":{let a=new W,o=this.#T();this.#t(l.LOAD,0,l.THROWABLE,Mt.CLASS_NAME,l.LOAD,0,l.INVOKE_VIRTUAL,this.#ot.getLocalizedMessage.index,-1,l.STORE,o),this.#t(l.LOAD,o,l.ACONST_NULL,l.ACMPEQ),this.#d(l.JUMP_IF_TRUE,a),this.#t(l.SCONST,this.#S(": "),l.SCONCAT,l.LOAD,o,l.SCONCAT),this.#f(a),this.#t(l.RETURN_VALUE),this.#C();break}case"throwable-printStackTrace":this.#t(l.LOAD,0,l.THROWABLE,Mt.PRINT_TRACE,l.RETURN);break;case"throwable-addSuppressed":this.#t(l.LOAD,0,l.LOAD,1,l.THROWABLE,Mt.ADD_SUPPRESSED,l.RETURN);break;case"throwable-getSuppressed":this.#t(l.LOAD,0,l.THROWABLE,Mt.GET_SUPPRESSED,l.RETURN_VALUE);break;case"throwable-fillInStackTrace":this.#t(l.LOAD,0,l.THROWABLE,Mt.FILL_TRACE,l.RETURN_VALUE);break}let r=this.#X(e,{name:t.isConstructor?"<init>":t.name,display:t.isConstructor?`${e.binaryName}.<init>(${t.params.map(Hn).join(", ")})`:this.#W(t),isStatic:t.isStatic,argCount:n,returnsValue:t.returnType.tag!=="void"});if(t.selector!==void 0&&(r.selector=t.selector),(t.builtin==="enum-name"||t.builtin==="enum-ordinal"||t.builtin==="enum-compareTo"||t.builtin==="enum-toString"||t.builtin.startsWith("throwable-"))&&(r.hidden=!0),t.builtin==="record-constructor"&&e.components.some(a=>a.type.tag==="long"||a.type.tag==="double")){let a=[0],o=1;for(let c of e.components)a.push(o),o+=c.type.tag==="long"||c.type.tag==="double"?2:1;r.argSlots=Int32Array.from(a)}return r}#Ht(t){let e=(n,s)=>{this.#t(l.LOAD,0),s(),this.#t(l.PUTFIELD,n,-1)};switch(this.#t(l.LOAD,0,l.INVOKE_VIRTUAL,this.#ot.fillInStackTrace.index,-1,l.POP),t.throwableConstructor){case"message":e(ut.message,()=>this.#t(l.LOAD,1));break;case"message-cause":e(ut.message,()=>this.#t(l.LOAD,1)),e(ut.cause,()=>this.#t(l.LOAD,2)),e(ut.causeSet,()=>this.#t(l.ICONST,1));break;case"cause":{let n=new W;this.#t(l.LOAD,1,l.ACONST_NULL,l.ACMPEQ),this.#d(l.JUMP_IF_TRUE,n),e(ut.message,()=>this.#t(l.LOAD,1,l.INVOKE_VIRTUAL,this.#ot.toString.index,-1)),this.#f(n),e(ut.cause,()=>this.#t(l.LOAD,1)),e(ut.causeSet,()=>this.#t(l.ICONST,1));break}case"index":e(ut.message,()=>this.#t(l.SCONST,this.#S(t.owner.builtin.indexPrefix),l.LOAD,1,l.TOSTRING_INT,l.SCONCAT));break;case"object":{e(ut.message,()=>this.#t(l.LOAD,1,l.VALUEOF,l.TOSTRING_REF));let n=new W;this.#t(l.LOAD,1,l.INSTANCEOF,this.#S("Ljava.lang.Throwable;")),this.#d(l.JUMP_IF_FALSE,n),e(ut.cause,()=>this.#t(l.LOAD,1)),e(ut.causeSet,()=>this.#t(l.ICONST,1)),this.#f(n);break}}this.#t(l.RETURN)}uncaughtPrinter(t){return this.#a(t,1,U),this.#t(l.LOAD,0,l.THROWABLE,Mt.PRINT_UNCAUGHT,l.RETURN),this.#X(t,{name:"<uncaught>",display:"<uncaught>",isStatic:!0,argCount:1,returnsValue:!1,hidden:!0})}#P(t){this.#t(l.LOAD,0,l.GETFIELD,t.index,-1);let e={int:l.TOSTRING_INT,byte:l.TOSTRING_INT,short:l.TOSTRING_INT,char:l.TOSTRING_CHAR,boolean:l.TOSTRING_BOOL,long:l.TOSTRING_LONG,float:l.TOSTRING_FLOAT,double:l.TOSTRING_DOUBLE}[t.type.tag];e!==void 0?this.#t(e):this.#t(l.VALUEOF,l.TOSTRING_REF)}#D(t){t.components.forEach((e,n)=>{this.#t(l.SCONST,this.#S(`${n===0?`${t.name}[`:", "}${e.name}=`)),n>0&&this.#t(l.SCONCAT),this.#P(e),this.#t(l.SCONCAT)}),this.#t(l.SCONST,this.#S(t.components.length?"]":`${t.name}[]`)),t.components.length&&this.#t(l.SCONCAT),this.#t(l.RETURN_VALUE)}#ht(t){this.#t(l.ICONST,0);for(let e of t.components){this.#t(l.ICONST,31,l.IMUL,l.LOAD,0,l.GETFIELD,e.index,-1);let n=Zt[e.type.tag];if(n!==void 0)this.#t(l.BOX,n,l.OBJ_HASHCODE,-1);else{let s=new W,r=new W;this.#t(l.DUP,l.ACONST_NULL,l.ACMPEQ),this.#d(l.JUMP_IF_TRUE,s),this.#t(l.OBJ_HASHCODE,-1),this.#d(l.JUMP,r),this.#f(s),this.#t(l.POP,l.ICONST,0),this.#f(r)}this.#t(l.IADD)}this.#t(l.RETURN_VALUE)}#te(t){let e=new W,n=new W;this.#t(l.LOAD,0,l.LOAD,1,l.ACMPEQ),this.#d(l.JUMP_IF_TRUE,e),this.#t(l.LOAD,1,l.INSTANCEOF,this.#S(`L${t.binaryName};`)),this.#d(l.JUMP_IF_FALSE,n);for(let s of t.components){let r=a=>this.#t(l.LOAD,a,l.GETFIELD,s.index,-1);if(s.type.tag==="double"||s.type.tag==="float")r(0),this.#t(l.BOX,Zt[s.type.tag]),r(1),this.#t(l.BOX,Zt[s.type.tag],l.OBJ_EQUALS,-1),this.#d(l.JUMP_IF_FALSE,n);else if(Zt[s.type.tag]!==void 0)r(0),r(1),this.#t(l.ICMPEQ),this.#d(l.JUMP_IF_FALSE,n);else{let a=new W;r(0),r(1),this.#t(l.ACMPEQ),this.#d(l.JUMP_IF_TRUE,a),r(0),this.#t(l.ACONST_NULL,l.ACMPEQ),this.#d(l.JUMP_IF_TRUE,n),r(0),r(1),this.#t(l.OBJ_EQUALS,-1),this.#d(l.JUMP_IF_FALSE,n),this.#f(a)}}this.#f(e),this.#t(l.ICONST,1,l.RETURN_VALUE),this.#f(n),this.#t(l.ICONST,0,l.RETURN_VALUE)}abstractStub(t){let e=t.params.length+(t.isStatic?0:1);this.#a(t.owner,Math.max(1,e),t.returnType),t.returnType.tag==="void"?this.#t(l.RETURN):this.#t(l.ACONST_NULL,l.RETURN_VALUE);let n=this.#X(t.owner,{name:t.name,display:this.#W(t),isStatic:t.isStatic,argCount:e,returnsValue:t.returnType.tag!=="void"});return t.selector!==void 0&&(n.selector=t.selector),n}method(t){let e=t.params.length+(t.isStatic?0:1);this.#a(t.owner,Math.max(e,t.maxSlots,t.finallySlots??0),t.returnType);let n=t.declaration.body;this.#i=t.lambda?.reference===!0;for(let a of n.statements)this.#E(a);this.#i=!1,t.returnType.tag==="void"&&(this.#w(n.end-1),this.#t(l.RETURN));let s=this.#X(t.owner,{name:t.name,display:this.#W(t),isStatic:t.isStatic,argCount:e,returnsValue:t.returnType.tag!=="void"});t.selector!==void 0&&(s.selector=t.selector),t.hidden&&(s.hidden=!0);let r=this.#c(t);return r&&(s.argSlots=r),s}#t(...t){for(let e of t)this.#r.push(e)}#w(t){let{line:e}=Zn(this.#$,t);e!==this.#s&&(this.#s=e,this.#y.push(this.#r.length,e))}#d(t,e){this.#t(t,-1),e.uses.push(this.#r.length-1),e.pc>=0&&(this.#r[this.#r.length-1]=e.pc)}#F(t){t.pc=this.#r.length;for(let e of t.uses)this.#r[e]=t.pc;this.#s=-1}#f(t){t.pc=this.#r.length;for(let e of t.uses)this.#r[e]=t.pc}#S(t){let e=this.#N.get(t);return e===void 0&&(e=this.strings.length,this.strings.push(t),this.#N.set(t,e)),e}#et(t){if(typeof t=="number"&&t===(t|0)&&!Object.is(t,-0)){this.#t(l.ICONST,t);return}let e=typeof t=="bigint"?`L${t}`:Object.is(t,-0)?"-0":String(t),n=this.#G.get(e);n===void 0&&(n=this.numbers.length,this.numbers.push(t),this.#G.set(e,n)),this.#t(l.NCONST,n)}#Ot(t){switch(t.kind){case"int":case"byte":case"short":case"char":this.#t(l.ICONST,t.value);return;case"long":this.#et(vt(t.value));return;case"double":case"float":this.#et(t.value);return;case"boolean":this.#t(l.ICONST,t.value?1:0);return;case"string":this.#t(l.SCONST,this.#S(t.value));return}}#q(t,e,n){let s=`${t}/${n}`,r=this.#B.get(s);return r===void 0&&(r=this.natives.length,this.natives.push({name:t,argCount:e,returnsValue:n}),this.#B.set(s,r)),r}#Lt(t,e,n,s){let r=-1;e&&(this.#h(e,!0),r=this.#j(`Cannot invoke "${t.display}"`,e));let a=n.length;if(t.varargsFrom===void 0)this.#lt(n,t.params);else{let c=t.varargsFrom;this.#lt(n.slice(0,c),t.params);let u=t.params[c].element,m=n.slice(c);this.#t(l.ICONST,m.length),this.#pt(u),m.forEach((h,d)=>{this.#t(l.DUP,l.ICONST,d),this.#h(h,!0),this.#m(u,h),this.#t(l.ASTORE,Re(u),-1)}),a=c+1}let o=a+(e?1:0);this.#t(l.INVOKE_NATIVE,this.#q(t.native,o,t.returnsValue),r),!s&&t.returnsValue&&this.#t(l.POP)}#M(t){let e=Le(t);switch(e.kind){case"Name":return e.symbol?.kind==="field"?e.outerHops?`${this.#se(e.outerHops)}.${e.symbol.name}`:this.#nt(e.symbol):e.symbol?.kind!=="local"?null:this.#gt(e.symbol);case"FieldAccess":{let n=e.fieldSymbol;if(!n)return null;if(n.isStatic)return this.#nt(n);if(Le(e.target).kind==="This")return`this.${n.name}`;let s=this.#M(e.target);return s===null?null:`${s}.${n.name}`}case"MethodCall":return e.method?this.#yt(e,e.method):e.objectMethod?`${e.qualifier??"Object"}.${ua[e.objectMethod]}`:e.libraryCall?e.libraryCall.display:null;case"ArrayAccess":{let n=this.#M(e.array);if(n===null)return null;let s=Le(e.index),r=e.index.constant&&(e.index.constant.kind==="int"||e.index.constant.kind==="char")?String(e.index.constant.value):s.kind==="Name"?this.#M(s)??"...":"...";return`${n}[${r}]`}case"Cast":return this.#M(e.expression);default:return null}}#nt(t){return t.isStatic?`${t.owner.binaryName}.${t.name}`:`this.${t.name}`}#K(t){let e=this.#z.get(t);return e===void 0&&(e=this.messages.length,this.messages.push(t),this.#z.set(t,e)),e}#p(t,e){if(this.#i)return-1;let n=t;if(typeof e=="string")n+=` because "${e}" is null`;else{let r=Le(e);if(r.kind==="MethodCall"&&(r.method||r.objectMethod||r.libraryCall))n+=` because the return value of "${this.#M(r)}" is null`;else{let a=this.#M(e);a!==null&&(n+=` because "${a}" is null`)}}let s=this.#z.get(n);return s===void 0&&(s=this.messages.length,this.messages.push(n),this.#z.set(n,s)),s}#j(t,e){return Le(e).kind==="This"?-1:this.#p(t,e)}#E(t){switch(t.kind){case"Block":for(let e of t.statements)this.#E(e);return;case"EmptyStatement":return;case"LocalVariableDeclaration":for(let e of t.declarators)e.init&&(this.#w(e.pos),e.init.kind==="ArrayInitializer"?this.#xt(e.init):(this.#h(e.init,!0),this.#m(e.symbol.type,e.init)),this.#t(l.STORE,this.#O(e.symbol)));return;case"ExpressionStatement":this.#w(t.start),this.#h(t.expression,!1);return;case"IfStatement":{let e=t.condition.constant;if(e&&e.kind==="boolean"){e.value?this.#E(t.then):t.otherwise&&this.#E(t.otherwise);return}this.#w(t.start);let n=new W;if(this.#Q(t.condition,n,!1),this.#E(t.then),t.otherwise){let s=new W;this.#d(l.JUMP,s),this.#F(n),this.#E(t.otherwise),this.#F(s)}else this.#F(n);return}case"WhileStatement":this.#Gt(t,t.start,t.condition,t.body,[]);return;case"ForStatement":if(t.init&&!Array.isArray(t.init))this.#E(t.init);else for(let e of t.init??[])this.#w(e.start),this.#h(e,!1);this.#Gt(t,t.start,t.condition,t.body,t.update);return;case"DoStatement":{let e=new W,n=new W,s=new W;this.#n.set(t,{breakLabel:s,continueLabel:n,tryDepth:this.#R.length}),this.#F(e),this.#E(t.body),this.#F(n),this.#w(t.condition.start),this.#Q(t.condition,e,!0),this.#F(s);return}case"ForEachStatement":this.#Oe(t);return;case"LabeledStatement":{let e=new W;this.#n.set(t,{breakLabel:e,tryDepth:this.#R.length}),this.#E(t.body),this.#F(e);return}case"SwitchStatement":this.#ge(t,!1);return;case"YieldStatement":{this.#w(t.start);let e=this.#n.get(t.target);this.#h(t.value,!0),this.#m(e.resultType,t.value),this.#d(l.JUMP,e.breakLabel);return}case"BreakStatement":{this.#w(t.start);let e=this.#n.get(t.target);this.#Nt(e.tryDepth??0,t.liveSlots,()=>this.#d(l.JUMP,e.breakLabel));return}case"ContinueStatement":{this.#w(t.start);let e=this.#n.get(t.target);this.#Nt(e.tryDepth??0,t.liveSlots,()=>this.#d(l.JUMP,e.continueLabel));return}case"ReturnStatement":if(this.#w(t.start),t.value){if(this.#h(t.value,!0),this.#m(this.#v,t.value),!this.#R.length){this.#t(l.RETURN_VALUE);return}let e=this.#T();this.#t(l.STORE,e),this.#Nt(0,t.liveSlots,()=>this.#t(l.LOAD,e,l.RETURN_VALUE)),this.#C()}else this.#Nt(0,t.liveSlots,()=>this.#t(l.RETURN));return;case"ConstructorCall":throw new Error("codegen: this(...) outside a constructor prologue");case"ThrowStatement":this.#w(t.start),this.#h(t.expression,!0),this.#t(l.ATHROW,this.#p("Cannot throw exception",t.expression));return;case"AssertStatement":return;case"LocalClass":return;case"TryStatement":this.#e(t);return}}#e(t){let e=t.catches.map(o=>({types:(o.caught??[]).map(c=>re(c)),body:()=>{this.#t(l.STORE,this.#O(o.symbol)),this.#E(o.block)}})),n=t.finallyBlock,s=t.resources.length?()=>this.#Tt(t.resources,0,()=>this.#E(t.block)):()=>this.#E(t.block);if(!e.length&&!n){s();return}let r=t.finallySlots,a=n&&r?{run:(o,c)=>{let u=o??r.base,m=c&&!this.#o;m&&(this.#U=Math.max(this.#U,u+r.extent)),m||this.#o++,this.#k.push({from:r.base,by:u-r.base}),this.#E(n),this.#k.pop(),m||this.#o--},anyAt:()=>Math.max(r.before,this.#U)+1,blockCompletes:t.blockCompletes??!0,handlerCompletes:t.catches.map(o=>o.completes??!0)}:null;this.#bt(s,e,a)}#st(t){return{run:()=>t(),anyAt:()=>0,blockCompletes:!0,handlerCompletes:[]}}#bt(t,e,n){let s=new vs,r=n?new vs:null,a=new W,o={regions:r?[s,r]:[s],finallyBody:n};this.#R.push(o),s.open(this.#r.length),r?.open(this.#r.length),t(),s.close(this.#r.length),r?.close(this.#r.length),this.#R.pop(),n?.run(void 0,n.blockCompletes),this.#d(l.JUMP,a);let c=[];for(let[u,m]of e.entries()){let h=this.#r.length;this.#s=-1,this.#R.push({regions:r?[r]:[],finallyBody:n}),r?.open(this.#r.length),m.body(),r?.close(this.#r.length),this.#R.pop(),n?.run(void 0,n.handlerCompletes[u]??!0),this.#d(l.JUMP,a);for(let d of m.types){let p=d===null?-1:this.#S(d);for(let[C,S]of s.segments)c.push(C,S,h,p)}}if(r&&n){let u=this.#r.length;this.#s=-1;let m=this.#T();this.#t(l.STORE,m),n.run(n.anyAt(),!0),this.#t(l.LOAD,m,l.ATHROW,-1),this.#C();for(let[h,d]of r.segments)c.push(h,d,u,-1)}this.#tt.push(...c),this.#F(a)}#Tt(t,e,n){if(e===t.length){n();return}let s=t[e];this.#w(s.start);let r=s.symbol?this.#O(s.symbol):this.#T();s.kind==="declaration"?(this.#h(s.init,!0),this.#m(s.symbol.type,s.init)):this.#h(s.expression,!0),this.#t(l.STORE,r);let a=this.#T();this.#t(l.ACONST_NULL,l.STORE,a);let o=()=>this.#l(s,r);this.#bt(()=>this.#Tt(t,e+1,n),[{types:[null],body:()=>this.#t(l.DUP,l.STORE,a,l.ATHROW,-1)}],this.#st(()=>{let c=new W,u=new W;this.#t(l.LOAD,r,l.ACONST_NULL,l.ACMPEQ),this.#d(l.JUMP_IF_TRUE,c),this.#t(l.LOAD,a,l.ACONST_NULL,l.ACMPEQ),this.#d(l.JUMP_IF_TRUE,u),this.#bt(o,[{types:[null],body:()=>{let m=this.#T();this.#t(l.STORE,m,l.LOAD,a,l.LOAD,m,l.THROWABLE,Mt.ADD_SUPPRESSED),this.#C()}}],null),this.#d(l.JUMP,c),this.#f(u),o(),this.#f(c)})),s.kind==="declaration"&&!this.#o&&(this.#U=Math.max(this.#U,r+3)),this.#C(),s.symbol||this.#C()}#l(t,e){this.#t(l.LOAD,e),t.closeMethod?this.#t(l.INVOKE_VIRTUAL,t.closeMethod.index,-1):this.#t(l.INVOKE_NATIVE,this.#q("close()",1,!1),-1)}#Nt(t,e,n){let s=this.#R.slice(t);if(!s.length){n();return}let r=this.#R;for(let a=s.length-1;a>=0;a--){for(let o of s[a].regions)o.close(this.#r.length);this.#R=r.slice(0,t+a),s[a].finallyBody?.run(e,!0)}this.#R=r,n();for(let a of s)for(let o of a.regions)o.open(this.#r.length)}#Gt(t,e,n,s,r){let a=n?.constant;if(a&&a.kind==="boolean"&&!a.value)return;let o=new W,c=new W,u=new W;this.#n.set(t,{breakLabel:u,continueLabel:c,tryDepth:this.#R.length}),this.#F(o),this.#w(e),n&&!a&&this.#Q(n,u,!1),this.#E(s),this.#F(c);for(let m of r)this.#w(m.start),this.#h(m,!1);this.#d(l.JUMP,o),this.#F(u)}#Oe(t){if(t.iterator){this.#Le(t);return}let{array:e,length:n,index:s}=t.hidden,r=e.type.element;this.#w(t.start),this.#h(t.iterable,!0),this.#t(l.STORE,this.#O(e),l.LOAD,this.#O(e)),this.#t(l.ARRAYLENGTH,this.#p("Cannot read the array length",this.#gt(e))),this.#t(l.STORE,this.#O(n),l.ICONST,0,l.STORE,this.#O(s));let a=new W,o=new W,c=new W;this.#n.set(t,{breakLabel:c,continueLabel:o,tryDepth:this.#R.length}),this.#F(a),this.#w(t.start),this.#t(l.LOAD,this.#O(s),l.LOAD,this.#O(n),l.ICMPLT),this.#d(l.JUMP_IF_FALSE,c),this.#t(l.LOAD,this.#O(e),l.LOAD,this.#O(s),l.ALOAD,Re(r),-1),this.#Mt(r,t.symbol.type,{description:`${this.#gt(e)}[${this.#gt(s)}]`}),this.#t(l.STORE,this.#O(t.symbol)),this.#E(t.body),this.#F(o),this.#w(t.start),this.#t(l.IINC,this.#O(s),1),this.#d(l.JUMP,a),this.#F(c)}#Le(t){let e=t.iterator,n=t.iterable.type,s=n.tag==="library"||n.tag==="diamond"?n.symbol.qualifiedName:"java.lang.Iterable";this.#w(t.start),this.#h(t.iterable,!0),this.#t(l.INVOKE_NATIVE,this.#q("Iterable.iterator",1,!0),this.#p(`Cannot invoke "${s}.iterator()"`,t.iterable)),this.#t(l.STORE,this.#O(e));let r=new W,a=new W;this.#n.set(t,{breakLabel:a,continueLabel:r,tryDepth:this.#R.length}),this.#F(r),this.#w(t.start),this.#t(l.LOAD,this.#O(e),l.INVOKE_NATIVE,this.#q("Iterator.hasNext",1,!0),-1),this.#d(l.JUMP_IF_FALSE,a),this.#t(l.LOAD,this.#O(e),l.INVOKE_NATIVE,this.#q("Iterator.next",1,!0),-1);let o=t.element??ha(n),c=t.symbol.type,u=we(c)?qt(c):q(c);u&&u.tag!=="object"&&(u.tag==="string"||u.tag==="class"||u.tag==="array"||u.tag==="library"&&u.symbol.box)&&this.#t(l.CHECKCAST,this.#S(re(u))),this.#Mt(o,t.symbol.type,{returnValue:"java.util.Iterator.next()"}),this.#t(l.STORE,this.#O(t.symbol)),this.#E(t.body),this.#d(l.JUMP,r),this.#F(a)}#ge(t,e){if(t.patternSwitch)return this.#be(t,e);this.#w(t.start);let n=t.selector.type?.tag==="string",s=t.selector.type,r=s?.tag==="class"&&s.symbol.isEnum?s.symbol:null;this.#h(t.selector,!0);let a;if(r)this.#t(l.GETFIELD,1,this.#p(`Cannot invoke "${r.binaryName}.ordinal()"`,t.selector)),a=this.#T(),this.#t(l.STORE,a);else if(n){let h=t.hidden.copy;a=this.#O(h),this.#t(l.STORE,a,l.LOAD,a),this.#t(l.CHECKNULL,this.#p(\'Cannot invoke "String.hashCode()"\',this.#gt(h)))}else a=this.#T(),this.#t(l.STORE,a);let o=new W,c=e?t.type:void 0;this.#n.set(t,{breakLabel:o,resultType:c,tryDepth:this.#R.length});let u=t.cases.map(()=>new W),m=o;t.cases.forEach((h,d)=>{if(h.isDefault&&(m=u[d]),r){for(let p of h.ordinals??[])this.#t(l.LOAD,a,l.ICONST,p,l.ICMPEQ),this.#d(l.JUMP_IF_TRUE,u[d]);return}for(let p of h.labels)this.#t(l.LOAD,a),this.#Ot(p.constant),this.#t(n?l.STR_EQUALS:l.ICMPEQ,...n?[-1]:[]),this.#d(l.JUMP_IF_TRUE,u[d])}),e&&m===o&&u.length&&(m=u[0]),this.#d(l.JUMP,m),t.cases.forEach((h,d)=>{this.#F(u[d]),this.#At(h,e,o,c)}),this.#f(o),this.#s=-1,n||this.#C()}#be(t,e){this.#w(t.start);let n=t.selector.type,s=n?.tag==="class"&&n.symbol.isEnum?n.symbol:null;this.#h(t.selector,!0);let r=this.#T();this.#t(l.STORE,r);let a=new W,o=e?t.type:void 0;this.#n.set(t,{breakLabel:a,resultType:o,tryDepth:this.#R.length});let c=t.cases.map(()=>new W),u=t.cases.findIndex(h=>h.nullLabel);this.#t(l.LOAD,r),u>=0?(this.#t(l.ACONST_NULL,l.ACMPEQ),this.#d(l.JUMP_IF_TRUE,c[u])):this.#t(l.CHECKNULL,-1);let m=null;t.cases.forEach((h,d)=>{if(h.isDefault&&(m=c[d]),s)for(let p of h.ordinals??[])this.#t(l.LOAD,r,l.GETFIELD,1,-1,l.ICONST,p,l.ICMPEQ),this.#d(l.JUMP_IF_TRUE,c[d]);else{let p=n?yt(n):null;for(let C of h.enumFields??[])this.#t(l.LOAD,r,l.GETSTATIC,C.index,l.ACMPEQ),this.#d(l.JUMP_IF_TRUE,c[d]);for(let C of h.enumFields?.length?[]:h.labels)this.#t(l.LOAD,r),p&&this.#t(l.UNBOX,Zt[p.tag],-1),this.#Ot(C.constant),p&&this.#rt(C.type,p),this.#t(p?l.ICMPEQ:l.STR_EQUALS,...p?[]:[-1]),this.#d(l.JUMP_IF_TRUE,c[d])}if(h.pattern){let p=new W,C=this.#ee(h.pattern,r,p,!1);h.guard&&this.#Q(h.guard,p,!1),this.#d(l.JUMP,c[d]),this.#f(p);for(let S=0;S<C;S++)this.#C()}}),this.#d(l.JUMP,m??(t.exhaustive&&c.length?c[0]:a)),t.cases.forEach((h,d)=>{this.#F(c[d]),this.#At(h,e,a,o)}),this.#f(a),this.#s=-1,this.#C()}#ee(t,e,n,s){if(t.kind==="TypePattern")return!(s&&t.unconditional)&&!we(t.tested)&&(this.#t(l.LOAD,e,l.INSTANCEOF,this.#S(re(q(t.tested)))),this.#d(l.JUMP_IF_FALSE,n)),t.symbol&&this.#t(l.LOAD,e,l.STORE,this.#O(t.symbol)),0;this.#t(l.LOAD,e,l.INSTANCEOF,this.#S(re(q(t.tested)))),this.#d(l.JUMP_IF_FALSE,n);let r=0;return t.components.forEach((a,o)=>{let c=t.accessors[o],u=this.#T();r++,this.#t(l.LOAD,e,c.selector!==void 0?l.INVOKE_VIRTUAL:l.INVOKE,c.index,-1,l.STORE,u),r+=this.#ee(a,u,n,!0)}),r}#At(t,e,n,s){if(!t.arrow){for(let a of t.statements)this.#E(a);return}let r=t.body;if(r.kind==="Block"){this.#E(r),e||this.#d(l.JUMP,n);return}this.#w(r.start),e?(this.#h(r,!0),this.#m(s,r)):this.#h(r,!1),this.#d(l.JUMP,n)}#Q(t,e,n){let s=t.constant;if(s&&s.kind==="boolean"){s.value===n&&this.#d(l.JUMP,e);return}if(t.kind==="Parenthesized")return this.#Q(t.expression,e,n);if(t.kind==="Unary"&&t.operator==="!")return this.#Q(t.operand,e,!n);if(t.kind==="Binary"&&(t.operator==="&&"||t.operator==="||")){if(t.operator==="&&"!==n)this.#Q(t.left,e,n),this.#Q(t.right,e,n);else{let a=new W;this.#Q(t.left,a,!n),this.#Q(t.right,e,n),this.#f(a)}return}if(t.kind==="InstanceOf"){this.#zt(t,e,n);return}this.#_(t,ft),this.#d(n?l.JUMP_IF_TRUE:l.JUMP_IF_FALSE,e)}#zt(t,e,n){if(t.recordPattern){let c=this.#T();this.#h(t.expression,!0),this.#t(l.STORE,c);let u=new W,m=this.#ee(t.recordPattern,c,n?u:e,!1);n&&this.#d(l.JUMP,e),this.#f(u);for(let h=0;h<=m;h++)this.#C();return}let s=this.#S(re(this.#Kt(t))),r=t.binding?.symbol;if(!r){this.#h(t.expression,!0),this.#t(l.INSTANCEOF,s),this.#d(n?l.JUMP_IF_TRUE:l.JUMP_IF_FALSE,e);return}let a=this.#T();this.#h(t.expression,!0),this.#t(l.STORE,a,l.LOAD,a,l.INSTANCEOF,s);let o=new W;this.#d(l.JUMP_IF_FALSE,n?o:e),this.#t(l.LOAD,a,l.STORE,this.#O(r)),n&&this.#d(l.JUMP,e),this.#f(o),this.#C()}#Kt(t){return t.binding?.symbol?.type??t.testedType}#rt(t,e){t&&(t.tag==="long"&&e.tag==="double"?this.#t(l.L2D):e.tag==="float"&&t.tag==="long"?this.#t(l.L2F):e.tag==="float"&&br(t)&&this.#t(l.I2F))}#$t(t,e){if(!Gn(t)||!Gn(e))return;let n=br(t)?"int":t.tag;switch(e.tag){case"char":case"byte":case"short":case"int":n==="long"&&this.#t(l.L2I),(n==="double"||n==="float")&&this.#t(l.D2I),e.tag==="char"&&t.tag!=="char"&&this.#t(l.I2C),e.tag==="byte"&&t.tag!=="byte"&&this.#t(l.I2B),e.tag==="short"&&t.tag!=="byte"&&t.tag!=="short"&&this.#t(l.I2S);return;case"long":(n==="double"||n==="float")&&this.#t(l.D2L);return;case"float":n==="double"?this.#t(l.D2F):this.#rt(t,e);return;case"double":n==="long"&&this.#t(l.L2D);return}}#m(t,e){this.#Mt(e.type,t,e,e.constant!==void 0)}#Mt(t,e,n,s=!1){let r=yt(t);if(we(e)){if(r&&(this.#t(l.UNBOX,Zt[r.tag],this.#Pt(r,n)),t=r),s){this.#rt(t,e);return}e.tag==="char"&&t.tag!=="char"?this.#t(l.I2C):this.#rt(t,e);return}if(we(t)){let a=yt(e)?.tag??t.tag;!s&&a==="char"&&t.tag==="int"&&this.#t(l.I2C),t.tag==="long"&&a==="double"&&this.#t(l.L2D),this.#t(l.BOX,Zt[a])}}#Pt(t,e){let n=`Cannot invoke "${Go[t.tag]}"`;return"returnValue"in e?this.#K(`${n} because the return value of "${e.returnValue}" is null`):"description"in e?this.#p(n,e.description):this.#p(n,e)}#lt(t,e,n){if(!n){t.forEach((r,a)=>{this.#h(r,!0),this.#m(e[a],r)});return}this.#lt(t.slice(0,n.from),e);let s=t.slice(n.from);this.#t(l.ICONST,s.length),this.#pt(n.element),s.forEach((r,a)=>{this.#t(l.DUP,l.ICONST,a),this.#h(r,!0),this.#m(n.element,r),this.#t(l.ASTORE,Re(n.element),-1)})}#_(t,e){if(this.#h(t,!0),t.constant){this.#rt(t.type,e);return}let n=yt(t.type);if(n){this.#t(l.UNBOX,Zt[n.tag],this.#Pt(n,t)),this.#rt(n,e);return}this.#rt(t.type,e)}#Rt(t,e){let n=zo[t];return e.tag==="double"?n.double:e.tag==="float"?n.float:e.tag==="long"?n.long:n.int}#h(t,e){if(e&&t.genericCast){let n=t.genericCast;t.genericCast=void 0,this.#h(t,!0),t.genericCast=n,this.#t(l.CHECKCAST,this.#S(re(n)));return}if(t.constant){e&&this.#Ot(t.constant);return}switch(t.kind){case"Literal":if(t.literalKind!=="null")throw new Error(`codegen: unexpected literal ${t.literalKind}`);e&&this.#t(l.ACONST_NULL);return;case"Name":{if(t.imported){this.#h(t.imported,e);return}if(t.symbol?.kind==="field"){if(!e)return;let n=t.symbol;n.isStatic?this.#t(l.GETSTATIC,n.index):(this.#St(t.outerHops),this.#t(l.GETFIELD,n.index,-1));return}if(t.symbol?.kind!=="local")throw new Error("codegen: unresolved name");e&&this.#t(l.LOAD,this.#O(t.symbol));return}case"This":e&&this.#St(t.outerHops);return;case"Super":e&&this.#t(l.LOAD,0);return;case"ClassLiteral":e&&this.#t(l.SCONST,this.#S(t.className),l.ICONST,t.isInterface?1:0,l.INVOKE_NATIVE,this.#q("Class.literal",2,!0),-1);return;case"InstanceOf":{let n=new W,s=new W;this.#zt(t,n,!0),this.#t(l.ICONST,0),this.#d(l.JUMP,s),this.#f(n),this.#t(l.ICONST,1),this.#f(s),e||this.#t(l.POP);return}case"Parenthesized":this.#h(t.expression,e);return;case"Unary":{let n=t.type;this.#_(t.operand,n),t.operator==="-"?this.#t(n.tag==="double"||n.tag==="float"?l.DNEG:n.tag==="long"?l.LNEG:l.INEG):t.operator==="~"?n.tag==="long"?this.#t(l.ICONST,-1,l.LXOR):this.#t(l.INOT):t.operator==="!"&&this.#t(l.BNOT),e||this.#t(l.POP);return}case"Cast":{let n=t.expression.type;if(t.checked&&we(t.type)){this.#h(t.expression,!0),this.#t(l.CHECKCAST,this.#S(re(t.checked)));let r=yt(t.checked);this.#t(l.UNBOX,Zt[r.tag],this.#Pt(r,t.expression)),this.#$t(r,t.type),e||this.#t(l.POP);return}let s=we(t.type)?yt(n):null;s?this.#_(t.expression,s):this.#h(t.expression,!0),we(n)&&!we(t.type)?this.#Mt(n,t.type,t.expression,t.expression.constant!==void 0):this.#$t(s??n,t.type),t.checked&&this.#t(l.CHECKCAST,this.#S(re(t.checked))),e||this.#t(l.POP);return}case"IncDec":this.#Se(t,e);return;case"Binary":this.#ne(t),e||this.#t(l.POP);return;case"Assignment":this.#_e(t,e);return;case"ArrayAccess":this.#h(t.array,!0),this.#_(t.index,U),this.#_t(t.type,t.array),e||this.#t(l.POP);return;case"NewArray":this.#Te(t),e||this.#t(l.POP);return;case"FieldAccess":if(t.fieldSymbol){let n=t.fieldSymbol;n.isStatic?(yr(t.target)||this.#h(t.target,!1),e&&this.#t(l.GETSTATIC,n.index)):(this.#h(t.target,!0),this.#t(l.GETFIELD,n.index,this.#j(`Cannot read field "${n.name}"`,t.target)),e||this.#t(l.POP));return}if(t.field==="System.in"){e&&this.#t(l.INVOKE_NATIVE,this.#q("System.in",0,!0),-1);return}if(t.field==="System.out"||t.field==="System.err"){e&&this.#t(l.INVOKE_NATIVE,this.#q(t.field,0,!0),-1);return}if(t.libraryField?.includes("#")){this.#h(t.target,!0),this.#t(l.INVOKE_NATIVE,this.#q(t.libraryField,1,!0),this.#j(`Cannot read field "${t.name}"`,t.target)),e||this.#t(l.POP);return}if(t.libraryField){e&&this.#t(l.INVOKE_NATIVE,this.#q(t.libraryField,0,!0),-1);return}if(t.field!=="length")throw new Error("codegen: field access used as a value");this.#h(t.target,!0),this.#t(l.ARRAYLENGTH,this.#p("Cannot read the array length",t.target)),e||this.#t(l.POP);return;case"MethodCall":this.#re(t,e);return;case"NewObject":{if(t.libraryCall){this.#Lt(t.libraryCall,null,t.args,e);return}let n=t.ctor;this.#t(l.NEW,n.owner.index,l.DUP);for(let s of n.owner.captures??[]){this.#t(l.DUP);let r=qo(this.#Z,n.owner);r>=0?(this.#St(r),this.#t(l.GETFIELD,s.field.index,-1)):this.#t(l.LOAD,this.#O(s.local)),this.#t(l.PUTFIELD,s.field.index,-1)}t.outer!==void 0&&this.#St(t.outer),this.#lt(t.args,n.params,t.varargs),this.#t(l.INVOKE,n.index,-1),e||this.#t(l.POP);return}case"Conditional":{let n=t.condition.constant;if(n?.kind==="boolean"){let a=n.value?t.whenTrue:t.whenFalse;this.#h(a,e),e&&this.#m(t.type,a);return}let s=new W,r=new W;this.#Q(t.condition,s,!1),this.#h(t.whenTrue,!0),this.#m(t.type,t.whenTrue),this.#d(l.JUMP,r),this.#f(s),this.#h(t.whenFalse,!0),this.#m(t.type,t.whenFalse),this.#f(r),e||this.#t(l.POP);return}case"SwitchExpression":this.#ge(t,!0),e||this.#t(l.POP);return;case"Lambda":this.#dt(t,null,e);return;case"MethodRef":this.#dt(t.lambda,t.receiver??null,e);return}}#dt(t,e,n){let s=t.method,r=0;s.usesThis&&(this.#t(l.LOAD,0),r++),e&&(this.#h(e,!0),this.#t(l.DUP,l.CHECKNULL,-1),r++);for(let o of t.captures??[])this.#t(l.LOAD,this.#O(o)),r++;let a=t.functional;this.#t(l.LAMBDA,s.index,r,this.#S(a.iface),a.sam?.selector??-1,a.samKey?this.#S(a.samKey):-1),n||this.#t(l.POP)}#ne(t){let e=t.operator;if(e==="&&"||e==="||"){let a=new W,o=new W;this.#Q(t,a,!1),this.#t(l.ICONST,1),this.#d(l.JUMP,o),this.#f(a),this.#t(l.ICONST,0),this.#f(o);return}let n=t.left.type,s=t.right.type;if(t.type?.tag==="string"){this.#Ne(t.left),this.#Ne(t.right),this.#t(l.SCONCAT);return}if(e in xs){let a=yt(n)??n,o=yt(s)??s,c=we(n)||we(s)||e!=="=="&&e!=="!=";if(c&&a.tag==="boolean"&&o.tag==="boolean"){this.#_(t.left,ft),this.#_(t.right,ft),this.#t(xs[e]);return}if(c&&Gn(a)&&Gn(o)){let m=gr(a,o);this.#_(t.left,m),this.#_(t.right,m),this.#t(xs[e]);return}this.#h(t.left,!0),this.#h(t.right,!0);let u=ws(n)||ws(s);this.#t(e==="=="?u?l.ACMPEQ:l.ICMPEQ:e==="!="?u?l.ACMPNE:l.ICMPNE:xs[e]);return}let r=t.type;if(e==="<<"||e===">>"||e===">>>"){this.#_(t.left,r),this.#h(t.right,!0),s.tag==="long"&&this.#t(l.L2I),this.#t(this.#Rt(e,r));return}this.#_(t.left,r),this.#_(t.right,r),this.#t(this.#Rt(e,r.tag==="boolean"?U:r))}#St(t=0){this.#t(l.LOAD,0);let e=this.#Z;for(let n=0;n<t&&e;n++,e=e.outer)this.#t(l.GETFIELD,e.outerField,-1)}#se(t){let e=r=>{let a=0;for(let o=r.outer;o;o=o.outer)a++;return a},n="this",s=this.#Z;for(let r=0;r<t&&s?.outer;r++,s=s.outer)n+=`.this$${e(s)-1}`;return n}#pt(t){Re(t)===z.REF&&t.tag!=="string"?this.#t(l.NEWARRAY_REF,this.#S("["+re(t))):this.#t(l.NEWARRAY,Re(t))}#Te(t){if(t.initializer){this.#xt(t.initializer);return}let e=t.type;for(let n of t.dimensions)this.#_(n,U);t.dimensions.length===1?this.#pt(e.element):this.#t(l.NEWMULTI,this.#S(re(e)),t.dimensions.length)}#_t(t,e){let n=Re(t);this.#t(l.ALOAD,n,this.#p(`Cannot load from ${ca[n]} array`,e))}#Jt(t,e){let n=Re(t);this.#t(l.ASTORE,n,this.#p(`Cannot store to ${ca[n]} array`,e))}#xt(t){let e=t.elementType,n=Re(e);this.#t(l.ICONST,t.elements.length),this.#pt(e),t.elements.forEach((s,r)=>{this.#t(l.DUP,l.ICONST,r),s.kind==="ArrayInitializer"?this.#xt(s):(this.#h(s,!0),this.#m(e,s)),this.#t(l.ASTORE,n,-1)})}#re(t,e){if(t.print){let s=wt.NONE;if(t.print.argument!=="none"){let r=t.args[0];this.#h(r,!0),t.print.argument==="object"?(this.#t(l.VALUEOF,l.TOSTRING_REF),s=wt.STRING):s={int:wt.INT,char:wt.CHAR,boolean:wt.BOOLEAN,long:wt.LONG,float:wt.FLOAT,double:wt.DOUBLE,string:wt.STRING,"char-array":wt.CHAR_ARRAY}[t.print.argument]}this.#t(l.PRINT,t.print.stream==="err"?1:0,t.print.newline?1:0,s);return}if(t.libraryCall){let s=t.libraryCall.isStatic?null:t.target??{kind:"This",depth:1,pos:t.pos,start:t.pos,end:t.pos};this.#Lt(t.libraryCall,s,t.args,e);return}if(t.mathFunction){this.#lt(t.args,t.mathFunction.params),this.#t(l.MATH,Ko[t.mathFunction.fn]),e||this.#t(l.POP);return}let n=t.target?Le(t.target):null;if(t.method){let s=t.method,r=-1;s.isStatic?n&&!yr(n)&&this.#h(n,!1):n?(this.#h(n,!0),r=this.#j(`Cannot invoke "${this.#yt(t,s)}"`,n)):this.#St(t.outerHops),this.#lt(t.args,s.params,t.varargs);let a=s.selector!==void 0&&!t.isSuper;this.#t(a?l.INVOKE_VIRTUAL:l.INVOKE,s.index,r),!e&&s.returnType.tag!=="void"&&this.#t(l.POP);return}if(t.objectMethod){let s=-1;if(n?(this.#h(n,!0),s=this.#j(`Cannot invoke "${t.qualifier??"Object"}.${ua[t.objectMethod]}"`,n)):this.#St(),this.#lt(t.args,t.args.map(()=>G)),t.isSuper)this.#t(l.OBJ_SUPER,{toString:0,hashCode:1,equals:2}[t.objectMethod]);else{let r={toString:l.OBJ_TOSTRING,hashCode:l.OBJ_HASHCODE,equals:l.OBJ_EQUALS}[t.objectMethod];this.#t(r,s)}e||this.#t(l.POP);return}if(t.stringMethod){this.#h(t.target,!0);for(let s of t.args)this.#h(s,!0);switch(t.stringMethod){case"length":this.#t(l.STR_LENGTH,this.#p(\'Cannot invoke "String.length()"\',t.target));break;case"charAt":this.#t(l.STR_CHARAT,this.#p(\'Cannot invoke "String.charAt(int)"\',t.target));break;case"equals":this.#t(l.STR_EQUALS,this.#p(\'Cannot invoke "String.equals(Object)"\',t.target));break;case"isEmpty":this.#t(l.STR_LENGTH,this.#p(\'Cannot invoke "String.isEmpty()"\',t.target),l.ICONST,0,l.ICMPEQ);break;case"toCharArray":this.#t(l.STR_TOCHARS,this.#p(\'Cannot invoke "String.toCharArray()"\',t.target));break;case"compareTo":this.#t(l.STR_COMPARETO,this.#p(\'Cannot invoke "String.compareTo(String)"\',t.target),this.#K(\'Cannot read field "value" because "anotherString" is null\'));break}e||this.#t(l.POP);return}throw new Error(`codegen: unresolved call to ${t.name}`)}#vt(t,e,n){let s=yt(t);s&&this.#t(l.UNBOX,Zt[s.tag],this.#Pt(s,n));let r=s??t;this.#t(l.ICONST,e,r.tag==="double"?l.DADD:r.tag==="float"?l.FADD:r.tag==="long"?l.LADD:l.IADD),r.tag==="char"&&this.#t(l.I2C),r.tag==="byte"&&this.#t(l.I2B),r.tag==="short"&&this.#t(l.I2S),s&&this.#t(l.BOX,Zt[s.tag])}#Se(t,e){let n=Le(t.operand),s=t.operator==="++"?1:-1,r=t.type;if(n.kind==="Name"&&n.symbol?.kind==="local"){let o=this.#O(n.symbol);if(r.tag==="int"){e&&!t.prefix&&this.#t(l.LOAD,o),this.#t(l.IINC,o,s),e&&t.prefix&&this.#t(l.LOAD,o);return}this.#t(l.LOAD,o),e&&!t.prefix&&this.#t(l.DUP),this.#vt(r,s,n),e&&t.prefix&&this.#t(l.DUP),this.#t(l.STORE,o);return}let a=this.#ie(n);if(a){if(a.isStatic)this.#qt(n),this.#t(l.GETSTATIC,a.index),e&&!t.prefix&&this.#t(l.DUP),this.#vt(r,s,n),e&&t.prefix&&this.#t(l.DUP),this.#t(l.PUTSTATIC,a.index);else{let o=this.#xe(n,a,"read");this.#t(l.DUP,l.GETFIELD,a.index,o),e&&!t.prefix&&this.#t(l.DUP_X1),this.#vt(r,s,n),e&&t.prefix&&this.#t(l.DUP_X1),this.#t(l.PUTFIELD,a.index,-1)}return}if(n.kind!=="ArrayAccess")throw new Error("codegen: ++/-- target");this.#h(n.array,!0),this.#h(n.index,!0),this.#t(l.DUP2),this.#_t(r,n.array),e&&!t.prefix&&this.#t(l.DUP_X2),this.#vt(r,s,n),e&&t.prefix&&this.#t(l.DUP_X2),this.#Jt(r,n.array)}#_e(t,e){let n=Le(t.target),s=t.target.type,r=()=>{if(t.operator==="="){this.#h(t.value,!0),this.#m(s,t.value);return}if(s.tag==="string"){this.#t(l.TOSTRING_REF),this.#Ne(t.value),this.#t(l.SCONCAT);return}let o=t.operator.slice(0,-1),c=t.value.type;if(o==="<<"||o===">>"||o===">>>"){let h=br(s)?U:s;this.#h(t.value,!0),c.tag==="long"&&this.#t(l.L2I),this.#t(this.#Rt(o,h)),this.#$t(h,s);return}if(s.tag==="boolean"){this.#_(t.value,ft),this.#t(this.#Rt(o,U));return}let u=yt(s);if(u){this.#t(l.UNBOX,Zt[u.tag],this.#Pt(u,n));let h=gr(u,yt(c)??c);this.#rt(u,h),this.#_(t.value,h),this.#t(this.#Rt(o,h)),this.#$t(h,u),this.#t(l.BOX,Zt[u.tag]);return}let m=gr(s,yt(c)??c);this.#rt(s,m),this.#_(t.value,m),this.#t(this.#Rt(o,m)),this.#$t(m,s)};if(n.kind==="Name"&&n.symbol?.kind==="local"){t.operator!=="="&&this.#t(l.LOAD,this.#O(n.symbol)),r(),e&&this.#t(l.DUP),this.#t(l.STORE,this.#O(n.symbol));return}let a=this.#ie(n);if(a){if(a.isStatic)this.#qt(n),t.operator!=="="&&this.#t(l.GETSTATIC,a.index),r(),e&&this.#t(l.DUP),this.#t(l.PUTSTATIC,a.index);else if(t.operator==="="){let o=this.#xe(n,a,"assign");r(),e&&this.#t(l.DUP_X1),this.#t(l.PUTFIELD,a.index,o)}else{let o=this.#xe(n,a,"read");this.#t(l.DUP,l.GETFIELD,a.index,o),r(),e&&this.#t(l.DUP_X1),this.#t(l.PUTFIELD,a.index,-1)}return}if(n.kind!=="ArrayAccess")throw new Error("codegen: assignment target");this.#h(n.array,!0),this.#h(n.index,!0),t.operator!=="="&&(this.#t(l.DUP2),this.#_t(s,n.array)),r(),e&&this.#t(l.DUP_X2),this.#Jt(s,n.array)}#ie(t){if(t.kind==="Name"&&t.symbol?.kind==="field")return t.symbol;if(t.kind==="FieldAccess")return t.fieldSymbol}#xe(t,e,n){if(t.kind==="FieldAccess"){this.#h(t.target,!0);let s=n==="read"?"Cannot read field":"Cannot assign field";return this.#j(`${s} "${e.name}"`,t.target)}return this.#St(t.kind==="Name"?t.outerHops:0),-1}#qt(t){t.kind==="FieldAccess"&&!yr(t.target)&&this.#h(t.target,!1)}#Ne(t){if(t.constant){this.#t(l.SCONST,this.#S(Ln(t.constant)));return}switch(this.#h(t,!0),t.type?.tag){case"int":case"byte":case"short":this.#t(l.TOSTRING_INT);return;case"float":this.#t(l.TOSTRING_FLOAT);return;case"char":this.#t(l.TOSTRING_CHAR);return;case"boolean":this.#t(l.TOSTRING_BOOL);return;case"long":this.#t(l.TOSTRING_LONG);return;case"double":this.#t(l.TOSTRING_DOUBLE);return;case"string":case"null":case"array":this.#t(l.TOSTRING_REF);return;case"class":case"object":case"library":case"diamond":case"typevar":this.#t(l.VALUEOF,l.TOSTRING_REF);return;default:throw new Error(`codegen: string conversion of ${t.type?.tag}`)}}},ua={toString:"toString()",hashCode:"hashCode()",equals:"equals(Object)"};function qo(i,t){let e=0;for(let n=i;n;n=n.outer,e++)if(n===t)return e;return-1}function ws(i){return i!==void 0&&["string","null","array","class","object","library","diamond","typevar"].includes(i.tag)}function ha(i){if(i.tag==="class"){let n=ln(i.symbol).find(s=>s.symbol.name==="Iterable"||s.symbol.supertypes.some(r=>r.tag==="library"&&r.symbol.name==="Iterable"));return n?ha(n):{tag:"object"}}if(i.tag!=="library")return{tag:"object"};let t=i,e=new Set;for(;t&&t.tag==="library"&&t.symbol.name!=="Iterable"&&!e.has(t.symbol);){e.add(t.symbol);let n=t,s=n.symbol.supertypes[0];t=s?da(s,n):null}return t&&t.tag==="library"?t.args[0]??{tag:"object"}:{tag:"object"}}function da(i,t){if(i.tag==="typevar"){let e=t.symbol.typeParams.indexOf(i.name);return t.args[e]??{tag:"object"}}return i.tag==="library"?{tag:"library",symbol:i.symbol,args:i.args.map(e=>da(e,t))}:i}var nt=class{value;constructor(t){this.value=t}},Rt=class{kind;data;hash;descriptor;constructor(t,e,n,s=Wo[t]){this.kind=t,this.data=e,this.hash=n,this.descriptor=s}},Ut=class{className;classIndex;fields;hash;constructor(t,e,n,s){this.className=t,this.classIndex=e,this.fields=n,this.hash=s}},zt=class{kind;value;constructor(t,e){this.kind=t,this.value=e}},me=class{hash;constructor(t){this.hash=t}},pe=class extends me{className;method;captured;iface;samSelector;samKey;constructor(t,e,n,s=[],r="java.util.Comparator",a=-1,o="compare(T,T)"){super(n),this.className=t,this.method=e,this.captured=s,this.iface=r,this.samSelector=a,this.samKey=o}},Je=class i{invoke;args;then;resumes;convert;constructor(t,e,n,s=null,r=null){this.invoke=t,this.args=e,this.then=n,this.resumes=s,this.convert=r}*[Symbol.iterator](){let t=this;for(;t instanceof i;)t=t.then(yield t);return t!==null&&typeof t=="object"&&Symbol.iterator in t?yield*t:t}},Wo=["[I","[Z","[C","[Ljava.lang.String;","[J","[D","[B","[S","[F"];function De(i){return i instanceof Rt?vr(i):`${i.className}@${i.hash.toString(16)}`}function vr(i){return`${i.descriptor}@${i.hash.toString(16)}`}var ks=class{#B=new Map;intern(t){let e=this.#B.get(t);return e||(e=new nt(t),this.#B.set(t,e)),e}},Cs=class{#B=625341585;next(){let t=this.#B;return t^=t<<13,t^=t>>>17,t^=t<<5,this.#B=t>>>0,this.#B&2147483647||1}};var fa=i=>`${i.className}.${i.method}(${i.file}:${i.line})`;var Is=class{className;message;constructor(t,e){this.className=t,this.message=e}},zn=class{message;constructor(t){this.message=t}},Kn=class{result;constructor(t){this.result=t}},Tn=class{thrown;constructor(t){this.thrown=t}},Os=class{frames;constructor(t){this.frames=t}},Ls=class{message;constructor(t){this.message=t}};function Yo(i,t,e){switch(i){case 12:return Math.imul(t,e);case 13:return t/e|0;case 14:return t%e|0;case 19:return t&e;case 20:return t|e;case 21:return t^e;case 16:return t<<e;case 17:return t>>e;default:return t>>>e|0}}function Es(i,t,e){switch(i){case 0:return t===e;case 1:return t!==e;case 2:return t<e;case 3:return t<=e;case 4:return t>e;case 5:return t>=e;case 6:return t!==e;case 7:return t===e;case 8:return!(t<e);case 9:return!(t<=e);case 10:return!(t>e);default:return!(t>=e)}}var Qo=Object.getPrototypeOf(Object.getPrototypeOf((function*(){})())),wr=i=>typeof i=="object"&&i!==null&&Object.getPrototypeOf(Object.getPrototypeOf(i))===Qo;function kr(i){switch(i.kind){case"double":return ae(i.value);case"float":return Ne(i.value);case"char":return String.fromCharCode(i.value);case"boolean":return i.value?"true":"false";default:return String(i.value)}}var pa={className:"",classIndex:-1,isStatic:!0,name:"<native>",display:"<native>",file:"",argCount:0,returnsValue:!1,hidden:!0,code:new Int32Array(0),lines:new Int32Array(0),maxLocals:0,maxStack:0},Zo=0,tl=1,qe=2,ya=3,Ar="\\0launcher",el=Array.from({length:5},(i,t)=>`${Ar}${t}`),ga=65536;function Cr(i,t){switch(i){case z.INT:return new Int32Array(t);case z.BOOLEAN:return new Uint8Array(t);case z.CHAR:return new Uint16Array(t);case z.LONG:return new Array(t).fill(0);case z.DOUBLE:return new Float64Array(t);case z.BYTE:return new Int8Array(t);case z.SHORT:return new Int16Array(t);case z.FLOAT:return new Float32Array(t);default:return new Array(t).fill(null)}}var As=(i,t)=>`Index ${i} out of bounds for length ${t}`;function nl(i){switch(i){case"I":return z.INT;case"Z":return z.BOOLEAN;case"C":return z.CHAR;case"J":return z.LONG;case"D":return z.DOUBLE;case"B":return z.BYTE;case"S":return z.SHORT;case"F":return z.FLOAT;default:return z.REF}}function sl(i){let t="";for(let e=0;e<i.length;e+=8192)t+=String.fromCharCode(...i.subarray(e,e+8192));return t}var ba=["java.lang.String","java.lang.Object","java.lang.Comparable","java.lang.CharSequence"],Ir={int:"java.lang.Integer",long:"java.lang.Long",double:"java.lang.Double",char:"java.lang.Character",boolean:"java.lang.Boolean",float:"java.lang.Float",byte:"java.lang.Byte",short:"java.lang.Short"},rl=Object.fromEntries(Object.keys(Ir).map(i=>[i,[Ir[i],"java.lang.Object","java.lang.Comparable",...i==="char"||i==="boolean"?[]:["java.lang.Number"]]])),il=["java.lang.Object","java.lang.Cloneable","java.io.Serializable"],al="com.sun.tools.javac.launcher.MemoryClassLoader @6d06d69c";function ol(i){let t=0;for(let e=0;e<i.length;e++)t=Math.imul(t,31)+i.charCodeAt(e)|0;return t}var Er=new DataView(new ArrayBuffer(8));function ll(i){switch(i.kind){case"int":case"char":case"byte":case"short":return i.value;case"float":return is(i.value);case"long":{let t=BigInt.asUintN(64,BigInt(i.value));return Number(BigInt.asIntN(32,t^t>>32n))}case"double":return Er.setFloat64(0,Number.isNaN(i.value)?NaN:i.value),Er.getInt32(0)^Er.getInt32(4)|0;case"boolean":return i.value?1231:1237}}function Ta(i,t,e,n,s,r=""){let a=new ks,o=new Cs,c=i.strings.map(f=>a.intern(f)),u=i.numbers,m=an(),h=i.natives.map(f=>{let b=m?.natives[f.name];if(!b)throw new Error(`interpreter: the library native ${f.name} is not loaded`);return b}),d=i.messages,p=i.methods,C=globalThis.performance,S=e.maxDurationMs>0?C.now()+e.maxDurationMs:1/0,k=(f,b=-1)=>({method:f,code:f.code,locals:new Array(f.maxLocals).fill(0),stack:new Array(f.maxStack+1).fill(0),sp:0,pc:0,returnPc:0,initClass:b}),x=i.staticFieldIsReference.map(f=>f?null:0),w=i.staticFieldOwner,I=i.classes,L=I.map(f=>f.instanceFieldIsReference.map(b=>b?null:0)),$=new Uint8Array(I.length),O=new Map(I.map(f=>[f.name,f.types])),R=f=>f instanceof Ut?I[f.classIndex].types:f instanceof nt?ba:f instanceof zt?rl[f.kind]:f instanceof Rt?il:f instanceof pe?O.get(f.iface)??m?.typesOf(f.iface)??[f.iface,"java.lang.Object"]:f instanceof me?m?.typesOf(f.className)??["java.lang.Object"]:["java.lang.Object"],N=(f,b)=>{if(f===b)return!0;let A=f.slice(1),M=b.slice(1);if(M==="Ljava.lang.Object;")return A.startsWith("[")||A.startsWith("L");if(A.startsWith("[")&&M.startsWith("["))return N(A,M);if(A.startsWith("L")&&M.startsWith("L")){let j=A.slice(1,-1);return(O.get(j)??(j==="java.lang.String"?ba:[j,"java.lang.Object"])).includes(M.slice(1,-1))}return!1},B=(f,b)=>f instanceof nt?b==="[Ljava.lang.String;"||F(f,b.slice(1)):f instanceof Ut&&b.length===f.className.length+3&&b.slice(2,-1)===f.className?!0:F(f,b.slice(1)),J=new Map,F=(f,b)=>{if(f===null||typeof f!="object")return!1;if(b.charCodeAt(0)===91)return f instanceof Rt&&N(f.descriptor,b);let A=J.get(b);return A===void 0&&J.set(b,A=b.slice(1,-1)),R(f).includes(A)},K=f=>f instanceof Ut?f.className:f instanceof nt?"java.lang.String":f instanceof zt?Ir[f.kind]:f instanceof Rt?f.descriptor:f.className,dt=f=>{let b=f.replace(/^\\[+/,"").replace(/^L(.*);$/,"$1");return O.has(b)&&!b.includes(".")?`unnamed module of loader ${al}`:"module java.base of loader \'bootstrap\'"},Wt=(f,b)=>{let A=K(f),M=dt(A),j=dt(b),V=M===j?`${A} and ${b} are in ${M}`:`${A} is in ${M}; ${b} is in ${j}`;return`class ${A} cannot be cast to class ${b} (${V})`},Z=k(p[i.entry]),ot=[Z],D=Z.code,kt=Z.locals,g=Z.stack,y=0,T=0,Dt=0,Lr=Math.min(ga,e.maxInstructions+1),Ms=0,ge=0,ke=(f,b)=>({outcome:{kind:"resource-limit",limit:f,message:b},instructions:Math.min(Dt,e.maxInstructions)}),Nr=f=>{Z.pc=T;let b=[],A=f!==void 0;for(let M=ot.length-1;M>=0&&b.length<1024;M--){let j=ot[M];j.method.hidden||A&&f(j)||(A=!1,b.push({className:j.method.className,method:j.method.name,file:j.method.file,line:aa(j.method,j.pc)}))}return b},$r=new Map(I.map((f,b)=>[f.name,b])),Ps=(f,b,A=null,M)=>{let j=$r.get(f)??$r.get("java.lang.RuntimeException"),V=L[j].slice();return V[ut.message]=b===null?null:new nt(b),V[ut.trace]=new Os(M??Nr()),A&&(V[ut.cause]=A,V[ut.causeSet]=1),new Ut(f,j,V,o.next())},at=(f,b,A=null)=>{throw new Tn(Ps(f,b,A))},Mr=[],_a=f=>{let b=Mr[f],A=b.fields[ut.message],M=A===null?b.className:`${b.className}: ${A.value}`,j=b.fields[ut.trace]?.frames??[],V=Ps("java.lang.ExceptionInInitializerError",`Exception ${M} [in thread "main"]`,null,j);return at("java.lang.NoClassDefFoundError",`Could not initialize class ${I[f].name}`,V)},xn=null,Rs="",Pr=()=>({outcome:{kind:"exception",className:xn.className,text:Rs},instructions:Dt,...Ds?{inputExhausted:Ds}:{}}),Ua=f=>{let b=f;for(Z.pc=T;ot.length;){let M=ot[ot.length-1],j=M.method.handlers;if(j)for(let V=0;V<j.length;V+=4){if(M.pc<j[V]||M.pc>=j[V+1])continue;let pt=j[V+3];if(!(pt>=0&&!F(b,i.strings[pt])))return Z=M,D=M.code,kt=M.locals,g=M.stack,y=0,g[y++]=b,T=j[V+2],null}ot.pop(),M.initClass>=0&&($[M.initClass]=ya,Mr[M.initClass]=b,!F(b,"Ljava.lang.Error;")&&ot.length&&(Z=ot[ot.length-1],T=Z.pc,b=Ps("java.lang.ExceptionInInitializerError",null,b)))}if(xn)return Rs+=`\nException: ${b.className} thrown from the UncaughtExceptionHandler in thread "main"\n`,Pr();xn=b;let A=k(p[i.uncaught]);return A.locals[0]=b,ot.push(A),Z=A,D=A.code,kt=A.locals,g=A.stack,y=0,T=0,null},Rr=new Map,Jr=new Map,Js=(f,b)=>{if(!(f==="boolean"||f==="byte"||(f==="int"||f==="long"||f==="short")&&b>=-128&&b<=127||f==="char"&&b<=127))return new zt(f,b);let M=f+b,j=Jr.get(M);return j||Jr.set(M,j=new zt(f,b)),j},Ds=!1,Fs={stdout:!1,stderr:!1},Fe={hash:()=>o.next(),fail:(f,b)=>{throw new Is(f,b)},raise:f=>{throw new Tn(f)},limitation:f=>{throw new Ls(f)},charge:f=>{Dt+=f},allocate:f=>{if(ge+f>e.maxArrayElements)throw new zn(`the program allocated more than ${e.maxArrayElements.toLocaleString("en-US")} array elements`);ge+=f},print:(f,b)=>{let A=Hr(f==="out"?"stdout":"stderr",b);if(A)throw new Kn(A)},closeStream:f=>{Fs[f==="out"?"stdout":"stderr"]=!0},streamClosed:f=>Fs[f==="out"?"stdout":"stderr"],exit:f=>{throw new Kn({outcome:{kind:"exit",status:f},instructions:Dt})},seed:()=>BigInt(Math.floor(Math.random()*2**32))*2n**16n+BigInt(Math.floor(Math.random()*2**16)),stdin:()=>r,inputExhausted:()=>{Ds=!0},checkString:f=>{if(f>e.maxStringLength)throw new zn(`the program built a String longer than ${e.maxStringLength.toLocaleString("en-US")} characters`)},methodOf:(f,b,A)=>I[f.classIndex].virtuals[`${b}/${A}`]??-1,castMessage:Wt,storable:(f,b)=>B(f,b),className:f=>K(f),toStringMethod:f=>I[f.classIndex].toString,equalsMethod:f=>I[f.classIndex].equals,hashCodeMethod:f=>I[f.classIndex].hashCode,box:Js,staticMethod:(f,b,A)=>p.findIndex(M=>M.isStatic&&M.className===f&&M.name===b&&M.argCount===A)},Yn=f=>f instanceof Is?at(f.className,f.message):f instanceof Ls?{outcome:{kind:"engine-limitation",message:f.message},instructions:Dt}:f instanceof zn?ke("memory",f.message):f instanceof Kn?f.result:null,js=(f,b)=>{let A=p[f];if(ot.length>e.maxCallDepth)return at("java.lang.StackOverflowError",null);let M=Br(A,-1),j=A.argSlots;for(let V=0;V<b.length;V++)M.locals[j?j[V]:V]=b[V];return ot.push(M),Z=M,D=M.code,kt=M.locals,g=M.stack,y=0,T=0,A.isStatic&&$[A.classIndex]!==qe&&Qe(A.classIndex),null},_s=[],Dr=f=>{let b=Z,A;try{let j=b.then;if(j){if(A=j(f),A instanceof Je)return A.resumes?(b.then=null,b.native=A.resumes,b.convert=A.convert):b.then=A.then,js(A.invoke,A.args);wr(A)&&(b.then=null,b.native=A,f=void 0)}if(!b.then){let V=b.native.next(f);if(!V.done)return js(V.value.invoke,V.value.args);let pt=b.convert;A=pt?pt(V.value):V.value}}catch(j){let V=Yn(j);if(V)return V;throw j}ot.pop();let M=b.nativeReturns;return b.native=null,b.then=null,b.convert=null,_s.length<32&&_s.push(b),Z=ot[ot.length-1],D=Z.code,kt=Z.locals,g=Z.stack,y=Z.sp,T=Z.returnPc,M&&(g[y++]=A??null),null},Fr=(f,b)=>{if(Z.pc=T,Z.returnPc=b,Z.sp=y,ot.length>e.maxCallDepth)return null;let A=_s.pop()??k(pa);return A.nativeReturns=f,ot.push(A),Z=A,A},Ye=(f,b,A)=>{let M=Fr(b,A);return M?(M.native=f,Dr(void 0)):at("java.lang.StackOverflowError",null)},jr=(f,b,A)=>{let M=Fr(b,A);return M?(f.resumes?(M.native=f.resumes,M.convert=f.convert):M.then=f.then,js(f.invoke,f.args)):at("java.lang.StackOverflowError",null)};function*_r(f){let b=yield*m.toString(Fe,f);return new nt(b)}let Ur=(f,b,A)=>{y-=b.length;let M;try{M=m.natives[f](Fe,b)}catch(j){let V=Yn(j);if(V)return V;throw j}return M instanceof Je?jr(M,!0,A):wr(M)?Ye(M,!0,A):(g[y++]=M??null,T=A,null)};for(let f of p)f.freeFrames=[];let Br=(f,b)=>{let A=f.freeFrames.pop();if(!A)return k(f,b);let M=A.locals;for(let j=0;j<M.length;j++)M[j]=0;return A.sp=0,A.pc=0,A.returnPc=0,A.initClass=b,A},Ba=f=>{let b=f.method.freeFrames;b&&b.length<32&&b.push(f)},je=(f,b,A=-1)=>{Z.pc=T,Z.returnPc=b,y-=f.argCount,Z.sp=y;let M=Br(f,A),j=f.argSlots;if(j)for(let V=0;V<f.argCount;V++)M.locals[j[V]]=g[y+V];else for(let V=0;V<f.argCount;V++)M.locals[V]=g[y+V];ot.push(M),Z=M,D=M.code,kt=M.locals,g=M.stack,y=0,T=0},Qe=f=>{if($[f]!==Zo)return $[f]===ya&&_a(f),!1;let b=I[f].superclass;if(b>=0&&Qe(b))return!0;let A=I[f].clinit;return A<0?($[f]=qe,!1):($[f]=tl,je(p[A],T,f),!0)},Ct=f=>at("java.lang.NullPointerException",f>=0?d[f]:null),Vr=(f,b,A)=>{let M=b[A],j=f.slice(1);if(A===b.length-1){let pt=nl(j);return new Rt(pt,Cr(pt,M),o.next(),f)}let V=new Array(M);for(let pt=0;pt<M;pt++)V[pt]=Vr(j,b,A+1);return new Rt(z.REF,V,o.next(),f)},Hr=(f,b)=>{if(Fs[f])return null;if(xn&&f==="stderr")return Rs+=b,null;if(Ms+b.length>e.maxOutputChars){let A=e.maxOutputChars-Ms;return A>0&&t(f,b.slice(0,A)),ke("output",`the program printed more than ${e.maxOutputChars.toLocaleString("en-US")} characters`)}return Ms+=b.length,Dt+=b.length>>>6,b&&t(f,b),null},Gr=[];if(s){let f={string:b=>new nt(b),box:Js,array:(b,A,M)=>new Rt(b,A,o.next(),M),object:b=>{let A=i.classes[b];return new Ut(A.name,b,A.instanceFieldIsReference.map(M=>M?null:0),o.next())},list:b=>{if(!m)throw new Error("interpreter: practice lists need the Java library");return m.newList(Fe,b)},allocate:b=>Fe.allocate(b)};try{Gr=s.args(f)}catch(b){let A=Yn(b);if(A)return A;throw b}}for(;;)try{for(;;){if(++Dt>=Lr){if(Dt>e.maxInstructions)return ke("instructions",`the program ran more than ${e.maxInstructions.toLocaleString("en-US")} steps`);if(S!==1/0&&C.now()>S)return ke("time",`the program ran longer than ${e.maxDurationMs} ms`);Lr=Math.min(Dt+ga,e.maxInstructions+1),n?.()}switch(D[T]){case 1:g[y++]=D[T+1],T+=2;break;case 2:g[y++]=c[D[T+1]],T+=2;break;case 3:g[y++]=null,T+=1;break;case 4:g[y++]=kt[D[T+1]],T+=2;break;case 5:kt[D[T+1]]=g[--y],T+=2;break;case 6:y--,T+=1;break;case 7:g[y]=g[y-1],y++,T+=1;break;case 8:{let f=g[y-1];g[y-1]=g[y-2],g[y-2]=f,g[y++]=f,T+=1;break}case 9:{let f=g[y-1];g[y-1]=g[y-2],g[y-2]=g[y-3],g[y-3]=f,g[y++]=f,T+=1;break}case 24:g[y]=g[y-2],g[y+1]=g[y-1],y+=2,T+=1;break;case 10:{let f=g[--y];g[y-1]=g[y-1]+f|0,T+=1;break}case 11:{let f=g[--y];g[y-1]=g[y-1]-f|0,T+=1;break}case 12:{let f=g[--y];g[y-1]=Math.imul(g[y-1],f),T+=1;break}case 13:{let f=g[--y];if(f===0)return at("java.lang.ArithmeticException","/ by zero");g[y-1]=g[y-1]/f|0,T+=1;break}case 14:{let f=g[--y];if(f===0)return at("java.lang.ArithmeticException","/ by zero");g[y-1]=g[y-1]%f|0,T+=1;break}case 15:g[y-1]=-g[y-1]|0,T+=1;break;case 16:{let f=g[--y];g[y-1]=g[y-1]<<f,T+=1;break}case 17:{let f=g[--y];g[y-1]=g[y-1]>>f,T+=1;break}case 18:{let f=g[--y];g[y-1]=g[y-1]>>>f|0,T+=1;break}case 19:{let f=g[--y];g[y-1]=g[y-1]&f,T+=1;break}case 20:{let f=g[--y];g[y-1]=g[y-1]|f,T+=1;break}case 21:{let f=g[--y];g[y-1]=g[y-1]^f,T+=1;break}case 22:g[y-1]=~g[y-1],T+=1;break;case 23:g[y-1]=g[y-1]^1,T+=1;break;case 25:g[y-1]=g[y-1]&65535,T+=1;break;case 163:g[y-1]=g[y-1]<<24>>24,T+=1;break;case 164:g[y-1]=g[y-1]<<16>>16,T+=1;break;case 165:case 167:g[y-1]=Math.fround(g[y-1]),T+=1;break;case 166:g[y-1]=nn(g[y-1]),T+=1;break;case 168:{let f=g[--y];g[y-1]=Math.fround(g[y-1]+f),T+=1;break}case 169:{let f=g[--y];g[y-1]=Math.fround(g[y-1]-f),T+=1;break}case 170:{let f=g[--y];g[y-1]=Math.fround(g[y-1]*f),T+=1;break}case 171:{let f=g[--y];g[y-1]=Math.fround(g[y-1]/f),T+=1;break}case 172:{let f=g[--y];g[y-1]=Math.fround(g[y-1]%f),T+=1;break}case 173:g[y-1]=new nt(Ne(g[y-1])),T+=1;break;case 30:case 36:{let f=g[--y];g[y-1]=g[y-1]===f?1:0,T+=1;break}case 31:case 37:{let f=g[--y];g[y-1]=g[y-1]!==f?1:0,T+=1;break}case 32:{let f=g[--y];g[y-1]=g[y-1]<f?1:0,T+=1;break}case 33:{let f=g[--y];g[y-1]=g[y-1]<=f?1:0,T+=1;break}case 34:{let f=g[--y];g[y-1]=g[y-1]>f?1:0,T+=1;break}case 35:{let f=g[--y];g[y-1]=g[y-1]>=f?1:0,T+=1;break}case 40:T=D[T+1];break;case 41:T=g[--y]===0?D[T+1]:T+2;break;case 180:{let f=g[--y],b=g[--y];T=Es(D[T+1],b,f)?D[T+2]:T+3;break}case 181:T=Es(D[T+1],g[--y],D[T+2])?D[T+3]:T+4;break;case 182:T=Es(D[T+1],kt[D[T+2]],kt[D[T+3]])?D[T+4]:T+5;break;case 183:T=Es(D[T+1],kt[D[T+2]],D[T+3])?D[T+4]:T+5;break;case 184:T=kt[D[T+2]]===null==(D[T+1]===1)?D[T+3]:T+4;break;case 185:g[y++]=kt[D[T+1]],g[y++]=kt[D[T+2]],T+=3;break;case 186:g[y++]=kt[D[T+1]],g[y++]=D[T+2],T+=3;break;case 187:g[y-1]=g[y-1]+D[T+1]|0,T+=2;break;case 190:g[y-1]=Yo(D[T+1],g[y-1],D[T+2]),T+=3;break;case 188:{let f=D[T+1];kt[f]=kt[f]+D[T+2]|0,T=D[T+3];break}case 189:{let f=kt[D[T+1]],b=kt[D[T+2]];if(f===null)return Ct(D[T+4]);if(b<0||b>=f.data.length)return at("java.lang.ArrayIndexOutOfBoundsException",As(b,f.data.length));g[y++]=f.data[b],T+=5;break}case 42:T=g[--y]!==0?D[T+1]:T+2;break;case 43:{let f=D[T+1];kt[f]=kt[f]+D[T+2]|0,T+=3;break}case 50:g[y-1]=new nt(String(g[y-1])),T+=1;break;case 54:g[y-1]=new nt(String.fromCharCode(g[y-1])),T+=1;break;case 143:g[y-1]=new nt(String(g[y-1])),T+=1;break;case 144:g[y-1]=new nt(ae(g[y-1])),T+=1;break;case 120:g[y++]=u[D[T+1]],T+=2;break;case 121:{let f=g[--y];g[y-1]=ii(g[y-1],f),T+=1;break}case 122:{let f=g[--y];g[y-1]=ai(g[y-1],f),T+=1;break}case 123:{let f=g[--y];g[y-1]=oi(g[y-1],f),T+=1;break}case 124:{let f=g[--y];if(f===0)return at("java.lang.ArithmeticException","/ by zero");g[y-1]=li(g[y-1],f),T+=1;break}case 125:{let f=g[--y];if(f===0)return at("java.lang.ArithmeticException","/ by zero");g[y-1]=ci(g[y-1],f),T+=1;break}case 126:g[y-1]=Ks(g[y-1]),T+=1;break;case 127:{let f=g[--y];g[y-1]=ui(g[y-1],f),T+=1;break}case 128:{let f=g[--y];g[y-1]=hi(g[y-1],f),T+=1;break}case 129:{let f=g[--y];g[y-1]=di(g[y-1],f),T+=1;break}case 130:{let f=g[--y];g[y-1]=fi(g[y-1],f),T+=1;break}case 131:{let f=g[--y];g[y-1]=mi(g[y-1],f),T+=1;break}case 132:{let f=g[--y];g[y-1]=pi(g[y-1],f),T+=1;break}case 133:{let f=g[--y];g[y-1]=g[y-1]+f,T+=1;break}case 134:{let f=g[--y];g[y-1]=g[y-1]-f,T+=1;break}case 135:{let f=g[--y];g[y-1]=g[y-1]*f,T+=1;break}case 136:{let f=g[--y];g[y-1]=g[y-1]/f,T+=1;break}case 137:{let f=g[--y];g[y-1]=g[y-1]%f,T+=1;break}case 138:g[y-1]=-g[y-1],T+=1;break;case 139:g[y-1]=ss(g[y-1]),T+=1;break;case 140:g[y-1]=rs(g[y-1]),T+=1;break;case 141:g[y-1]=kn(g[y-1]),T+=1;break;case 142:g[y-1]=wn(g[y-1]),T+=1;break;case 146:if(g[--y]===null)return Ct(D[T+1]);T+=2;break;case 147:{switch(D[T+1]){case it.ABS_I:g[y-1]=Math.abs(g[y-1])|0;break;case it.ABS_L:{let b=g[y-1];g[y-1]=b<0?Ks(b):b;break}case it.ABS_D:g[y-1]=Math.abs(g[y-1]);break;case it.MAX_I:case it.MAX_D:{let b=g[--y];g[y-1]=Math.max(g[y-1],b);break}case it.MIN_I:case it.MIN_D:{let b=g[--y];g[y-1]=Math.min(g[y-1],b);break}case it.MAX_L:{let b=g[--y],A=g[y-1];g[y-1]=A>=b?A:b;break}case it.MIN_L:{let b=g[--y],A=g[y-1];g[y-1]=A<=b?A:b;break}case it.SQRT:g[y-1]=Math.sqrt(g[y-1]);break;case it.FLOOR:g[y-1]=Math.floor(g[y-1]);break;case it.CEIL:g[y-1]=Math.ceil(g[y-1]);break;case it.ROUND:g[y-1]=gi(g[y-1]);break;case it.ROUND_F:g[y-1]=yi(g[y-1]);break}T+=2;break}case 145:{let f=i.strings[D[T+1]],b=D[T+2],A=g.slice(y-b,y);y-=b;for(let V of A)if(V<0)return at("java.lang.NegativeArraySizeException",String(V));let M=0,j=1;for(let V of A)j*=V,M+=j;if(ge+M>e.maxArrayElements)return ke("memory",`the program allocated more than ${e.maxArrayElements.toLocaleString("en-US")} array elements`);ge+=M,Dt+=M>>>4,g[y++]=Vr(f,A,0),T+=3;break}case 51:g[y-1]=new nt(g[y-1]?"true":"false"),T+=1;break;case 52:{let f=g[y-1];f===null?g[y-1]=new nt("null"):f instanceof zt?g[y-1]=new nt(kr(f)):f instanceof nt||(g[y-1]=new nt(De(f))),T+=1;break}case 53:{let f=g[--y],b=g[y-1],A=b.value.length+f.value.length;if(A>e.maxStringLength)return ke("memory",`the program built a String longer than ${e.maxStringLength.toLocaleString("en-US")} characters`);Dt+=A>>>6,g[y-1]=new nt(b.value+f.value),T+=1;break}case 60:{let f=D[T+3],b="";if(f!==wt.NONE){let M=g[--y];switch(f){case wt.INT:b=String(M);break;case wt.CHAR:b=String.fromCharCode(M);break;case wt.BOOLEAN:b=M?"true":"false";break;case wt.STRING:b=M===null?"null":M.value;break;case wt.LONG:b=String(M);break;case wt.DOUBLE:b=ae(M);break;case wt.FLOAT:b=Ne(M);break;case wt.CHAR_ARRAY:if(M===null)return at("java.lang.NullPointerException",\'Cannot read the array length because "cbuf" is null\');b=sl(M.data);break;default:b=M===null?"null":M instanceof nt?M.value:De(M)}}D[T+2]===1&&(b+=`\n`);let A=Hr(D[T+1]===1?"stderr":"stdout",b);if(A)return A;T+=4;break}case 72:{let f=p[D[T+1]];if(f.isStatic&&$[f.classIndex]!==qe&&Qe(f.classIndex))break;let b=D[T+2];if(b>=0&&g[y-f.argCount]===null)return Ct(b);if(ot.length>e.maxCallDepth)return at("java.lang.StackOverflowError",null);je(f,T+3);break}case 70:case 71:{let f=D[T]===l.RETURN_VALUE?g[--y]:void 0,b=ot.pop();if(b.initClass>=0&&($[b.initClass]=qe),Ba(b),!ot.length)return xn?Pr():{outcome:{kind:"completed"},instructions:Dt};if(Z=ot[ot.length-1],Z.method===pa){let A=Dr(f);if(A)return A;break}D=Z.code,kt=Z.locals,g=Z.stack,y=Z.sp,T=Z.returnPc,f!==void 0&&(g[y++]=f);break}case 80:{let f=g[y-1];if(f<0)return at("java.lang.NegativeArraySizeException",String(f));if(ge+f>e.maxArrayElements)return ke("memory",`the program allocated more than ${e.maxArrayElements.toLocaleString("en-US")} array elements`);ge+=f,Dt+=f>>>4,g[y-1]=new Rt(D[T+1],Cr(D[T+1],f),o.next()),T+=2;break}case 84:{let f=g[y-1];if(f<0)return at("java.lang.NegativeArraySizeException",String(f));if(ge+f>e.maxArrayElements)return ke("memory",`the program allocated more than ${e.maxArrayElements.toLocaleString("en-US")} array elements`);ge+=f,Dt+=f>>>4,g[y-1]=new Rt(z.REF,Cr(z.REF,f),o.next(),i.strings[D[T+1]]),T+=2;break}case 81:{let f=g[--y],b=g[y-1];if(b===null)return Ct(D[T+2]);if(f<0||f>=b.data.length)return at("java.lang.ArrayIndexOutOfBoundsException",As(f,b.data.length));g[y-1]=b.data[f],T+=3;break}case 82:{let f=g[--y],b=g[--y],A=g[--y];if(A===null)return Ct(D[T+2]);if(b<0||b>=A.data.length)return at("java.lang.ArrayIndexOutOfBoundsException",As(b,A.data.length));if(f!==null&&D[T+1]===z.REF&&A.descriptor!=="[Ljava.lang.Object;"&&!B(f,A.descriptor))return at("java.lang.ArrayStoreException",K(f));A.data[b]=f,T+=3;break}case 83:{let f=g[y-1];if(f===null)return Ct(D[T+1]);g[y-1]=f.data.length,T+=2;break}case 90:{let f=g[y-1];if(f===null)return Ct(D[T+1]);g[y-1]=f.value.length,T+=2;break}case 91:{let f=g[--y],b=g[y-1];if(b===null)return Ct(D[T+1]);if(f<0||f>=b.value.length)return at("java.lang.StringIndexOutOfBoundsException",As(f,b.value.length));g[y-1]=b.value.charCodeAt(f),T+=2;break}case 92:{let f=g[--y],b=g[y-1];if(b===null)return Ct(D[T+1]);g[y-1]=f instanceof nt&&f.value===b.value?1:0,T+=2;break}case 153:{let f=g[--y],b=g[y-1];if(b===null)return Ct(D[T+1]);if(f===null)return Ct(D[T+2]);let A=b.value,M=f.value,j=Math.min(A.length,M.length),V=A.length-M.length;for(let pt=0;pt<j;pt++){let _e=A.charCodeAt(pt)-M.charCodeAt(pt);if(_e!==0){V=_e;break}}Dt+=j>>>4,g[y-1]=V,T+=3;break}case 100:{let f=D[T+1],b=w[f];if($[b]!==qe&&Qe(b))break;g[y++]=x[f],T+=2;break}case 101:{let f=D[T+1],b=w[f];if($[b]!==qe&&Qe(b))break;x[f]=g[--y],T+=2;break}case 102:{let f=g[y-1];if(f===null)return Ct(D[T+2]);g[y-1]=f.fields[D[T+1]],T+=3;break}case 103:{let f=g[--y],b=g[--y];if(b===null)return Ct(D[T+2]);b.fields[D[T+1]]=f,T+=3;break}case 104:{let f=D[T+1];if($[f]!==qe&&Qe(f))break;g[y++]=new Ut(I[f].name,f,L[f].slice(),o.next()),T+=2;break}case 110:{let f=g[y-1];if(f instanceof Ut){let b=I[f.classIndex].toString;if(b>=0){if(ot.length>e.maxCallDepth)return at("java.lang.StackOverflowError",null);je(p[b],T+1);break}g[y-1]=new nt(De(f))}else if(f===null)g[y-1]=new nt("null");else if(f instanceof Rt)g[y-1]=new nt(vr(f));else if(f instanceof zt)g[y-1]=new nt(kr(f));else if(f instanceof me){y--;let b=Ye(_r(f),!0,T+1);if(b)return b;break}T+=1;break}case 148:{let f=D[T+1],b=i.natives[f],A=D[T+2];if(A>=0&&g[y-b.argCount]===null)return Ct(A);let M=g.slice(y-b.argCount,y);y-=b.argCount;let j;try{j=h[f](Fe,M)}catch(V){let pt=Yn(V);if(pt)return pt;throw V}if(j instanceof Je){let V=jr(j,b.returnsValue,T+3);if(V)return V;break}if(wr(j)){let V=Ye(j,b.returnsValue,T+3);if(V)return V;break}b.returnsValue&&(g[y++]=j??null),T+=3;break}case 149:g[y-1]=Js(fr[D[T+1]],g[y-1]),T+=2;break;case 150:{let f=g[y-1];if(f===null)return Ct(D[T+2]);g[y-1]=f.value,T+=3;break}case 154:g[y++]=Gr[D[T+1]],T+=2;break;case 155:s.result(g[--y]),T+=1;break;case 152:{let f=D[T+1],b=D[T+2],A=c[D[T+3]].value,M=D[T+5]>=0?c[D[T+5]].value:null;if(b===0){let j=Rr.get(f);j||Rr.set(f,j=new pe(`${p[f].className}$$Lambda`,f,o.next(),[],A,D[T+4],M)),g[y++]=j}else{let j=g.slice(y-b,y);y-=b,g[y++]=new pe(`${p[f].className}$$Lambda`,f,o.next(),j,A,D[T+4],M)}T+=6;break}case 151:{let f=g[y-1];if(f===null)return Ct(D[T+1]);let b=new Uint16Array(f.value.length);for(let A=0;A<b.length;A++)b[A]=f.value.charCodeAt(A);if(ge+b.length>e.maxArrayElements)return ke("memory",`the program allocated more than ${e.maxArrayElements.toLocaleString("en-US")} array elements`);ge+=b.length,Dt+=b.length>>>4,g[y-1]=new Rt(z.CHAR,b,o.next()),T+=2;break}case 111:{let f=g[y-1];if(f===null)return Ct(D[T+1]);if(f instanceof Ut&&I[f.classIndex].toString>=0){if(ot.length>e.maxCallDepth)return at("java.lang.StackOverflowError",null);je(p[I[f.classIndex].toString],T+2);break}if(f instanceof me){y--;let b=Ye(_r(f),!0,T+2);if(b)return b;break}f instanceof zt?g[y-1]=new nt(kr(f)):f instanceof nt||(g[y-1]=new nt(De(f))),T+=2;break}case 112:{let f=g[y-1];if(f===null)return Ct(D[T+1]);if(f instanceof Ut&&I[f.classIndex].hashCode>=0){if(ot.length>e.maxCallDepth)return at("java.lang.StackOverflowError",null);je(p[I[f.classIndex].hashCode],T+2);break}if(f instanceof me&&!(f instanceof pe)&&m?.natives["hashCode()"]){let b=Ur("hashCode()",[f],T+2);if(b)return b;break}g[y-1]=f instanceof nt?ol(f.value):f instanceof zt?ll(f):f.hash,T+=2;break}case 113:{let f=g[y-1],b=g[y-2];if(b===null)return Ct(D[T+1]);if(b instanceof Ut&&I[b.classIndex].equals>=0){if(ot.length>e.maxCallDepth)return at("java.lang.StackOverflowError",null);je(p[I[b.classIndex].equals],T+2);break}if(b instanceof me&&!(b instanceof pe)&&m?.natives["equals(Object)"]){let A=Ur("equals(Object)",[b,f],T+2);if(A)return A;break}y--,b instanceof nt?g[y-1]=f instanceof nt&&f.value===b.value?1:0:b instanceof zt?g[y-1]=f instanceof zt&&f.kind===b.kind&&Object.is(f.value,b.value)?1:0:g[y-1]=b===f?1:0,T+=2;break}case 159:{let f=D[T+1];if(f===2){let b=g[--y];g[y-1]=g[y-1]===b?1:0}else{let b=g[y-1];g[y-1]=f===0?new nt(De(b)):b.hash}T+=2;break}case 156:{let f=p[D[T+1]],b=D[T+2],A=g[y-f.argCount];if(A===null)return Ct(b);let M=f;if(A instanceof Ut){let j=I[A.classIndex].vtable[f.selector];j>=0&&(M=p[j])}else if(A instanceof pe&&A.samSelector===f.selector){let j=y-f.argCount,V=g.slice(j+1,y);y=j;for(let pt of A.captured)g[y++]=pt;for(let pt of V)g[y++]=pt;M=p[A.method]}if(ot.length>e.maxCallDepth)return at("java.lang.StackOverflowError",null);je(M,T+3);break}case 157:{let f=g[y-1],b=i.strings[D[T+1]];if(f!==null&&!F(f,b)){let A=b.startsWith("[")?b:b.slice(1,-1);return at("java.lang.ClassCastException",Wt(f,A))}T+=2;break}case 160:{let f=I[D[T+1]],b=g[y-1];if(b===null)return at("java.lang.NullPointerException","Name is null");let A=f.enumConstants.find(M=>x[M].fields[0].value===b.value);if(A===void 0)return at("java.lang.IllegalArgumentException",`No enum constant ${f.canonicalName}.${b.value}`);g[y-1]=x[A],T+=2;break}case 158:g[y-1]=F(g[y-1],i.strings[D[T+1]])?1:0,T+=2;break;case 161:{let f=g[--y];if(f===null)return Ct(D[T+1]);throw new Tn(f)}case 162:{let f=D[T+1];if(f===Mt.PRINT_TRACE||f===Mt.PRINT_UNCAUGHT){let b=g[--y],A=Ye(Ha(b,f===Mt.PRINT_UNCAUGHT),!1,T+2);if(A)return A;break}if(f===Mt.FILL_TRACE){let b=g[y-1],A=I[b.classIndex].types,M=j=>(j.method.name==="<init>"||j.method.name==="fillInStackTrace")&&A.includes(j.method.className);b.fields[ut.trace]=new Os(Nr(M))}else if(f===Mt.ADD_SUPPRESSED){let b=g[--y],A=g[--y];if(b===A)return at("java.lang.IllegalArgumentException","Self-suppression not permitted",b);if(b===null)return at("java.lang.NullPointerException","Cannot suppress a null exception.");let M=A.fields[ut.suppressed];M?M.push(b):A.fields[ut.suppressed]=[b]}else if(f===Mt.GET_SUPPRESSED){let b=g[y-1],A=Us(b);Fe.allocate(A.length),g[y-1]=new Rt(z.REF,A.slice(),o.next(),"[Ljava.lang.Throwable;")}else if(f===Mt.CLASS_NAME)g[y-1]=new nt(g[y-1].className);else if(f===Mt.INIT_CAUSE){let b=g[y-1],A=g[y-2];if(A.fields[ut.causeSet]){y-=2;let M=Ye(Va(A,b),!1,T+2);if(M)return M;break}if(b===A)return at("java.lang.IllegalArgumentException","Self-causation not permitted",A);A.fields[ut.cause]=b,A.fields[ut.causeSet]=1,y--}T+=2;break}default:throw new Error(`interpreter: unknown opcode ${D[T]} at ${T}`)}}}catch(f){if(!(f instanceof Tn))throw f;let b=Ua(f.thrown);if(b)return b}function Us(f){return f.fields[ut.suppressed]??[]}function*Qn(f){let b=yield{invoke:I[f.classIndex].toString,args:[f]};return b==null?"null":b.value}function*Va(f,b){let A=b===null?"a null":yield*Qn(b);return at("java.lang.IllegalStateException",`Can\'t overwrite cause with ${A}`,f)}function*Ha(f,b){let A=Et=>Fe.print("err",Et),M=new Set([f]),j=Et=>(Et.fields[ut.trace]?.frames??[]).map(fa),V=Et=>[...j(Et),...el].slice(0,1024);function*pt(Et){return yield{invoke:I[Et.classIndex].virtuals["getCause/0"],args:[Et]}}function*_e(Et,Kr,qr,Ze){if(M.has(Et)){A(`${Ze}${qr}[CIRCULAR REFERENCE: ${yield*Qn(Et)}]\n`);return}M.add(Et);let Ue=V(Et),vn=Ue.length-1;for(let be=Kr.length-1;vn>=0&&be>=0&&Ue[vn]===Kr[be];be--)vn--;let Wr=Ue.length-1-vn;A(`${Ze}${qr}${yield*Qn(Et)}\n`);for(let be=0;be<=vn;be++)Ue[be].startsWith(Ar)||A(`${Ze} at ${Ue[be]}\n`);Wr&&A(`${Ze} ... ${Wr} more\n`);for(let be of Us(Et))yield*_e(be,Ue,"Suppressed: ",Ze+" ");let Xr=yield*pt(Et);Xr&&(yield*_e(Xr,Ue,"Caused by: ",Ze))}b&&A(\'Exception in thread "main" \'),A(`${yield*Qn(f)}\n`);let Bs=b?j(f):V(f);for(let Et of Bs)Et.startsWith(Ar)||A(` at ${Et}\n`);for(let Et of Us(f))yield*_e(Et,Bs,"Suppressed: "," ");let zr=yield*pt(f);zr&&(yield*_e(zr,Bs,"Caused by: ",""))}}var Jt=class extends Error{},ye=class extends Error{},Xe=class extends Error{},Sa=i=>i.replace(/\\s+/g,"");function va(i,t){let e=t.className?i.classes.filter(h=>h.name===t.className||h.displayName===t.className):i.classes;if(t.className&&!e.length)throw new Jt(`no class ${t.className} in the program`);let n=e.flatMap(h=>h.methods.filter(d=>d.name===t.method&&!d.lambda));if(t.params){let h=t.params.map(Sa);n=n.filter(d=>d.params.length===h.length&&d.params.every((p,C)=>Sa(P(p))===h[C]))}let s=`${t.method}(${(t.params??[]).join(", ")})`;if(!n.length)throw new Jt(`no method ${t.params?s:t.method+"(...)"}${t.className?` in class ${t.className}`:""}`);if(n.length>1)throw new Jt(`${n.length} methods named ${t.method}: list its parameter types in practice.params to choose one`);let r=n[0],a=null;if(!r.isStatic){if(r.owner.isInner)throw new Jt(`${r.name} is an instance method of an inner class; make the class static or the method static`);if(a=r.owner.constructors.find(h=>h.params.length===0)??null,!a)throw new Jt(`${r.owner.displayName} needs a constructor with no parameters, to call its instance method ${r.name}`)}let o=r.params.map((h,d)=>Wn(h,t,`parameter ${d+1} of ${r.name}`)),c=t.compare??{kind:"return"},u=null,m=null;if(c.kind==="argument"){if(!Number.isInteger(c.index)||c.index<0||c.index>=o.length)throw new Jt(`compare.index ${c.index} is not a parameter of ${r.name}`);m=c.index}else{if(r.returnType.tag==="void")throw new Jt(`${r.name} returns nothing: compare one of its arguments instead ({ kind: \'argument\', index })`);u=Wn(r.returnType,t,`the result of ${r.name}`)}return{target:{method:r,constructor:a},params:o,result:u,compareIndex:m,tolerance:c.tolerance??0,signature:`${r.owner.displayName}.${r.name}(${r.params.map(P).join(", ")})`}}function wa(i){switch(i.tag){case"int":return"I";case"long":return"J";case"double":return"D";case"char":return"C";case"boolean":return"Z";case"string":return"Ljava.lang.String;";case"class":return`L${i.symbol.binaryName};`;case"library":return`L${i.symbol.qualifiedName};`;case"array":return`[${wa(i.element)}`;default:return"Ljava.lang.Object;"}}var cl={int:z.INT,boolean:z.BOOLEAN,char:z.CHAR,long:z.LONG,double:z.DOUBLE};function Wn(i,t,e){switch(i.tag){case"int":case"long":case"double":case"char":case"boolean":return{kind:i.tag};case"string":return{kind:"string"};case"array":return{kind:"array",element:Wn(i.element,t,e),arrayKind:cl[i.element.tag]??z.REF,descriptor:wa(i),type:P(i)};case"library":let n=i.symbol.box;if(n&&n!=="float"&&n!=="byte"&&n!=="short")return{kind:"box",box:n};if(["List","ArrayList","Collection"].includes(i.symbol.name)&&i.args[0])return{kind:"list",element:Wn(i.args[0],t,e)};break;case"class":return ul(i.symbol,t,e)}throw new Jt(`${e} has type ${P(i)}, which practice cases cannot pass or compare yet`)}function ul(i,t,e){let n=i.fields.filter(C=>!C.isStatic),s=C=>{let S=n.find(k=>k.name===C);if(!S)throw new Jt(`practice.nodes.${i.name}: ${i.name} has no field ${C}`);return S},r=n.filter(C=>C.type.tag==="class"&&C.type.symbol===i),a=n.filter(C=>!r.includes(C)),o=t.nodes?.[i.name],c=o?.kind??(r.length===1&&a.length===1?"list":r.length===2&&a.length===1?"tree":null);if(!c)throw new Jt(`${e} has type ${i.displayName}, which is not a list or tree node; describe it in practice.nodes`);let u=o?.value?s(o.value):a[0];if(!u)throw new Jt(`practice.nodes.${i.name} needs its value field`);let m=Wn(u.type,t,`${i.name}.${u.name}`);if(c==="list"){let C=o?.next?s(o.next):r[0];if(!C)throw new Jt(`practice.nodes.${i.name} needs its next field`);return{kind:"linked-list",cls:i,value:u,valueCodec:m,next:C}}let h=C=>r.find(S=>S.name===C),d=o?.left?s(o.left):h("left")??r[0],p=o?.right?s(o.right):h("right")??r.find(C=>C!==d);if(!d||!p)throw new Jt(`practice.nodes.${i.name} needs its left and right fields`);return{kind:"tree",cls:i,value:u,valueCodec:m,left:d,right:p}}var hl=-2147483648,dl=2147483647,fl=-(1n<<63n),ml=(1n<<63n)-1n;function Sn(i){return JSON.stringify(i)??"undefined"}function xa(i,t,e){let n=s=>{throw new ye(`${e}: expected ${s}, got ${Sn(i)}`)};switch(t){case"int":return(typeof i!="number"||!Number.isInteger(i)||i<hl||i>dl)&&n("an int"),i;case"long":{let s;if(typeof i=="string"&&/^-?\\d+$/.test(i))s=BigInt(i);else if(typeof i=="number"&&Number.isSafeInteger(i))s=BigInt(i);else return n("a long, as a decimal string");return(s<fl||s>ml)&&n("a long in range"),vt(s)}case"double":return typeof i=="number"?i:i==="NaN"?NaN:i==="Infinity"?1/0:i==="-Infinity"?-1/0:n(\'a double (a number, or "NaN", "Infinity", "-Infinity")\');case"char":return(typeof i!="string"||i.length!==1)&&n("a char, as a one-character string"),i.charCodeAt(0);case"boolean":return typeof i!="boolean"&&n("a boolean"),i?1:0}}function qn(i,t,e,n){switch(t.kind){case"int":case"long":case"double":case"char":case"boolean":return xa(i,t.kind,n);case"string":if(i===null)return null;if(typeof i!="string")throw new ye(`${n}: expected a String, got ${Sn(i)}`);return e.string(i);case"box":return i===null?null:e.box(t.box,xa(i,t.box,n));case"array":{if(i===null)return null;if(!Array.isArray(i))throw new ye(`${n}: expected ${t.type}, an array, got ${Sn(i)}`);e.allocate(i.length);let s=i.map((a,o)=>qn(a,t.element,e,`${n}[${o}]`)),r;switch(t.arrayKind){case z.INT:r=Int32Array.from(s);break;case z.BOOLEAN:r=Uint8Array.from(s);break;case z.CHAR:r=Uint16Array.from(s);break;case z.DOUBLE:r=Float64Array.from(s);break;default:r=s}return e.array(t.arrayKind,r,t.descriptor)}case"list":{if(i===null)return null;if(!Array.isArray(i))throw new ye(`${n}: expected a List, an array, got ${Sn(i)}`);return e.list(i.map((s,r)=>qn(s,t.element,e,`${n}[${r}]`)))}case"linked-list":{if(i===null)return null;if(!Array.isArray(i))throw new ye(`${n}: expected a ${t.cls.name} list, an array of values, got ${Sn(i)}`);e.allocate(i.length);let s=null;for(let r=i.length-1;r>=0;r--){let a=e.object(t.cls.index);a.fields[t.value.index]=qn(i[r],t.valueCodec,e,`${n}[${r}]`),a.fields[t.next.index]=s,s=a}return s}case"tree":{if(i===null)return null;if(!Array.isArray(i))throw new ye(`${n}: expected a ${t.cls.name} tree, a level-order array, got ${Sn(i)}`);if(!i.length||i[0]===null)return null;e.allocate(i.length);let s=c=>{let u=e.object(t.cls.index);return u.fields[t.value.index]=qn(i[c],t.valueCodec,e,`${n}[${c}]`),u},r=s(0),a=[r],o=1;for(let c=0;c<a.length&&o<i.length;c++){let u=a[c];for(let m of[t.left,t.right]){if(o>=i.length)break;if(i[o]!==null){let h=s(o);u.fields[m.index]=h,a.push(h)}o++}}return r}}}var ka=1e5;function We(i,t,e){let n=s=>{if(e.nodes-=s,e.nodes<0)throw new Xe(`the result has more than ${ka.toLocaleString("en-US")} elements, or is cyclic`)};switch(t.kind){case"int":return i;case"long":return String(i);case"double":return pl(i);case"char":return String.fromCharCode(i);case"boolean":return i===1;case"string":return i===null?null:i.value;case"box":return i===null?null:We(i.value,{kind:t.box},e);case"array":{if(i===null)return null;let s=i.data;return n(s.length),Array.from(s,r=>We(r,t.element,e))}case"list":{if(i===null)return null;let s=an()?.listItems(i);if(!s)throw new Xe("the result is not an ArrayList");return n(s.length),s.map(r=>We(r,t.element,e))}case"linked-list":{let s=[],r=new Set;for(let a=i;a;a=a.fields[t.next.index]){if(r.has(a))throw new Xe(`the ${t.cls.name} list has a cycle`);r.add(a),n(1),s.push(We(a.fields[t.value.index],t.valueCodec,e))}return s}case"tree":{if(i===null)return[];let s=[],r=[i];for(let a=0;a<r.length;a++){let o=r[a];if(n(1),!o){s.push(null);continue}s.push(We(o.fields[t.value.index],t.valueCodec,e)),r.push(o.fields[t.left.index],o.fields[t.right.index])}for(;s.length&&s[s.length-1]===null;)s.pop();return s}}}function pl(i){return Number.isNaN(i)?"NaN":i===1/0?"Infinity":i===-1/0?"-Infinity":i}function Ns(i,t,e=0){if(typeof i=="number"&&typeof t=="number")return i===t||Math.abs(i-t)<=e;if(Array.isArray(i)&&Array.isArray(t))return i.length===t.length&&i.every((n,s)=>Ns(n,t[s],e));if(i&&t&&typeof i=="object"&&typeof t=="object"&&!Array.isArray(i)&&!Array.isArray(t)){let n=Object.keys(i);return n.length===Object.keys(t).length&&n.every(s=>Ns(i[s],t[s],e))}return i===t}function Ca(i,t){if(t.length!==i.params.length)throw new ye(`${i.signature} takes ${i.params.length} argument${i.params.length===1?"":"s"}, the case has ${t.length}`);let e=[],n=null;return{host:{args:a=>e=t.map((o,c)=>qn(o,i.params[c],a,`argument ${c+1}`)),result:a=>{n=a}},actual:()=>{let a={nodes:ka};return i.compareIndex!==null?We(e[i.compareIndex],i.params[i.compareIndex],a):We(n,i.result,a)}}}function yl(i,t){let e=`${i}(${t.args.map(a=>JSON.stringify(a)).join(", ")})`,n=a=>JSON.stringify(a),s=[];switch(t.status){case"passed":s.push(`\\u2713 ${t.id} ${e} \\u2192 ${n(t.actual)}`);break;case"failed":s.push(`\\u2717 ${t.id} ${e} \\u2192 ${n(t.actual)}, expected ${n(t.expected)}`);break;case"completed":s.push(`\\u2022 ${t.id} ${e} \\u2192 ${n(t.actual)}`);break;case"invalid-case":s.push(`? ${t.id} invalid case: ${t.error}`);break;case"not-run":s.push(`- ${t.id} not run (${t.reason})`);break;default:s.push(`\\u2717 ${t.id} ${e}: ${t.status.replace("-"," ")}`),t.error&&s.push(...t.error.trimEnd().split(`\n`).map(a=>` ${a}`))}let r=t.stdout+t.stderr;return r&&s.push(...r.trimEnd().split(`\n`).map(a=>` | ${a}`)),s}function Ea(i,t){let e=t.flatMap(r=>yl(i,r)),n=t.filter(r=>r.expected!==void 0).length,s=t.filter(r=>r.status==="passed").length;return e.push(n?`${s} of ${n} passed`:`${t.length} case${t.length===1?"":"s"} run`),e.join(`\n`)+`\n`}var Or={maxFiles:32,maxSourceChars:5e5,maxNestingDepth:200,maxExpressionDepth:1e3,maxInstructions:2e8,maxOutputChars:1e6,maxStringLength:1e7,maxArrayElements:16e6,maxCallDepth:5e4,maxDurationMs:0},Xn=()=>globalThis.performance.now();function gl(i,t){let e=Object.keys(i);return t&&t in i?t:"Main.java"in i?"Main.java":e.find(n=>n.endsWith(".java"))??e[0]??"Main.java"}function Ia(i,t={}){return Oa(i,t).result}function Oa(i,t,e=!0){let n=Xn(),s={...Or,...t.limits},r=gl(i,t.entry),a=new ts,o=i[r]??"",c=Yr(r,o),u=new Map([[r,c]]),m=null,h=C=>({result:{program:C,diagnostics:a.items,entry:r,diagnosticText:a.items.length?Zr(a.items,u):"",compileMs:Xn()-n},checked:m,source:c});if(Object.keys(i).length>s.maxFiles)return a.launchError(r,v.limit,`too many files for this engine (limit ${s.maxFiles})`),h(null);if(!(r in i))return a.launchError(r,v.noMain,`file not found: ${r}`),h(null);if(o.length>s.maxSourceChars)return a.launchError(r,v.limit,`${r} is too large for this engine (limit ${s.maxSourceChars.toLocaleString("en-US")} characters)`),h(null);let d=si(o);if(d.errors.length){for(let C of d.errors)a.error(c,C.offset,"lex",C.code,C.message);return h(null)}let p=Ai(r,d.tokens,s);if(p.error)return p.error.code==="no-class"?a.launchError(r,v.noMain,p.error.message):a.error(c,p.error.offset,"parse",p.error.code,p.error.message,p.error.details),h(null);try{let C=ta(p.unit,c,a,{launch:e});return!C||a.hasErrors?h(null):(m=C,h(e?xr(C,c):null))}catch(C){if(!(C instanceof sn))throw C;return{result:{program:null,diagnostics:[],entry:r,diagnosticText:"",compileMs:Xn()-n,needsLibrary:!0},checked:null,source:c}}}var bl={instructions:"The program ran for a very long time, so it was stopped. Look for a loop whose condition never becomes false.",output:"The program printed more output than this page can show, so it was stopped. Look for a print inside a loop that never ends.",memory:"The program used more memory (a very large array or String) than this in-browser Java engine allows, so it was stopped.",time:"The program ran longer than the time allowed, so it was stopped."},Tl="This program reached Java behavior this in-browser engine does not reproduce exactly, so it stopped rather than show something that might differ from a real JVM.";function La(i,t={}){return Na(i,t)}var Sl="The program read more input than standard input had (a Scanner found nothing left to read). Type the input in the input box, one value or line for each read, then run again.";function Na(i,t,e){let n={...Or,...t.limits},s="",r="",a=(p,C)=>{p==="stdout"?s+=C:r+=C,t.onOutput?.(p,C)};t.warnings&&a("stderr",t.warnings);let o=Xn(),{outcome:c,instructions:u,inputExhausted:m}=Ta(i,a,n,t.onCheckpoint,e,t.stdin??""),h=Xn()-o,d={stdout:s,diagnostics:[],instructions:u,compileMs:t.compileMs??0,runMs:h};switch(c.kind){case"completed":return{...d,status:"success",stderr:r,exitCode:0};case"exception":{let p=c.text;return m&&c.className==="java.util.NoSuchElementException"?{...d,status:"runtime-error",stderr:r+p,errorText:p,hint:Sl,hintAbout:"stdin",exitCode:1}:{...d,status:"runtime-error",stderr:r+p,errorText:p,exitCode:1}}case"resource-limit":{let p=`Stopped: ${c.message} (limit of this in-browser Java engine).\n`;return{...d,status:"resource-limit",stderr:r+p,errorText:p,hint:bl[c.limit],exitCode:1}}case"engine-limitation":{let p=`Stopped: ${c.message} (limitation of this in-browser Java engine).\n`;return{...d,status:"engine-limitation",stderr:r+p,errorText:p,hint:Tl,exitCode:1}}case"exit":return{...d,status:c.status===0?"success":"exited",stderr:r,exitCode:c.status,exited:!0}}}var Aa=500;function $a(i,t,e={}){let n={...Or,...e.limits},s=Array.isArray(t.cases)?t.cases:[],r=C=>s.map((S,k)=>({id:S.id??String(k+1),status:"not-run",args:S.args??[],expected:S.expected,stdout:"",stderr:"",reason:C,instructions:0,durationMs:0})),{result:a,checked:o,source:c}=Oa(i,e,!1),u={passed:0,total:s.length,diagnostics:a.diagnostics,diagnosticText:a.diagnosticText,compileMs:a.compileMs},m=C=>({...u,status:"invalid-practice",message:C,cases:r("invalid-practice")});if(!Array.isArray(t.cases)||typeof t.method!="string")return m("practice needs a method name and a list of cases");if(s.length>Aa)return m(`too many cases (limit ${Aa})`);if(a.needsLibrary)return{...u,status:"compile-error",cases:[],needsLibrary:!0};if(!o)return{...u,status:"compile-error",cases:r("compile-error")};let h;try{h=va(o,t)}catch(C){if(C instanceof Jt)return m(C.message);throw C}let d=xr(o,c,h.target),p=[];for(let[C,S]of s.entries()){let k=Array.isArray(S.args)?S.args:[],x={id:S.id??String(C+1),status:"not-run",args:k,expected:S.expected,stdout:"",stderr:"",instructions:0,durationMs:0};p.push(x);let w,I;try{let L=Ca(h,k);I=L.actual,w=Na(d,{limits:n},L.host)}catch(L){if(L instanceof ye){x.status="invalid-case",x.error=L.message;continue}let $=L instanceof Error?L.message:String(L);x.reason="engine-failure";for(let O of r("engine-failure").slice(C+1))p.push(O);return{...u,status:"internal-error",message:`Internal error in the Java engine: ${$}`,cases:p,passed:p.filter(O=>O.status==="passed").length}}if(x.stdout=w.stdout,x.stderr=w.errorText?w.stderr.slice(0,w.stderr.length-w.errorText.length):w.stderr,x.instructions=w.instructions,x.durationMs=Math.round(w.runMs*100)/100,w.exited){x.status="runtime-error",x.error=`System.exit(${w.exitCode}) ended the program before ${t.method}() returned`;continue}if(w.status!=="success"){x.status=w.status==="runtime-error"||w.status==="resource-limit"||w.status==="engine-limitation"?w.status:"runtime-error",x.error=w.errorText,w.hint&&(x.hint=w.hint);continue}try{x.actual=I()}catch(L){if(!(L instanceof Xe))throw L;x.status="runtime-error",x.error=`ResultEncodingError: ${L.message}`;continue}x.status=S.expected===void 0?"completed":Ns(x.actual,S.expected,h.tolerance)?"passed":"failed"}return{...u,status:"completed",cases:p,passed:p.filter(C=>C.status==="passed").length}}var xl={JString:nt,JArray:Rt,JObject:Ut,JBox:zt,JLibObject:me,JLambda:pe,NativeThen:Je,doubleToString:ae,objectToString:De,normLong:vt,floatToString:Ne,floatToIntBits:is,intBitsToFloat:Ti,parseDecimalFloat:qs,parseHexFloating:vi,l2f:nn};function Ma(i){Ni(i(xl))}var Pa="javaOnlineCompilerLibrary";var Ra="0.26.0";var $s="java-library";async function vl(i){let t=globalThis,e=URL.createObjectURL(new Blob([i],{type:"text/javascript"}));try{let s=!1;if(typeof t.importScripts=="function")try{t.importScripts(e),s=!0}catch{}s||await import(e)}finally{URL.revokeObjectURL(e)}let n=t[Pa];if(typeof n!="function")throw new Error("the library script did not define its factory");return n}var wl=8192,Da=16;function Fa(i,t={}){let e=t.now??(()=>globalThis.performance.now()),n=[],s=0,r=0,a=0,o=null,c=()=>{if(r=e(),!n.length)return;let p=n;n=[],s=0;for(let C of p)i({type:C.type,id:a,text:C.text})},u=(p,C)=>{let S=n[n.length-1];S&&S.type===p?S.text+=C:n.push({type:p,text:C}),s+=C.length,(s>=wl||e()-r>=Da)&&c()},m=p=>{a=p.id,n=[],s=0,r=e();let C=e(),S=p.entry||"Main.java",k=p.files&&Object.keys(p.files).length?{...p.files}:{};S in k||(k[S]=p.code??"");try{let x=()=>{n.length&&e()-r>=Da&&c()};if(p.practice){h(p,k,S,C);return}let w=Ia(k,{entry:S,limits:t.limits});if(w.needsLibrary){o=p,i({type:"module-request",id:p.id,name:$s});return}let I=w.program?La(w.program,{limits:t.limits,stdin:p.stdin??"",onOutput:u,onCheckpoint:x,compileMs:w.compileMs,warnings:w.diagnosticText}):{status:"compile-error",stdout:"",stderr:w.diagnosticText,errorText:w.diagnosticText,diagnostics:w.diagnostics,exitCode:1,instructions:0,compileMs:w.compileMs,runMs:0};c();let L=e()-C;if(I.status==="success"){i({type:"result",id:p.id,durationMs:L,status:"success"});return}if(I.status==="cancelled")return;i({type:"error",id:p.id,message:I.status==="exited"?`Exited with status ${I.exitCode}.`:(I.errorText??"").replace(/\\n$/,""),hint:I.hint,...I.hintAbout?{hintAbout:I.hintAbout}:{},durationMs:L,status:I.status,...I.diagnostics.length?{diagnostics:I.diagnostics}:{}})}catch(x){c();let w=x instanceof Error?x.message:String(x);i({type:"fatal",id:p.id,message:`Internal error in the Java engine: ${w}`})}},h=(p,C,S,k)=>{let x=p.practice,w=$a(C,x,{entry:S,limits:t.limits});if(w.needsLibrary){o=p,i({type:"module-request",id:p.id,name:$s});return}let I=e()-k;switch(w.status){case"completed":i({type:"stdout",id:p.id,text:Ea(x.method,w.cases)}),i({type:"result",id:p.id,durationMs:I,status:"success",cases:w.cases,passed:w.passed,total:w.total});return;case"compile-error":i({type:"error",id:p.id,message:w.diagnosticText.replace(/\\n$/,""),durationMs:I,status:"compile-error",cases:w.cases,...w.diagnostics.length?{diagnostics:w.diagnostics}:{}});return;case"invalid-practice":i({type:"error",id:p.id,message:`Practice: ${w.message}`,durationMs:I,status:"invalid-practice",cases:w.cases});return;case"internal-error":i({type:"fatal",id:p.id,message:w.message??"Internal error in the Java engine"});return}},d=async p=>{let C=o;if(!(!C||p.name!==$s)){o=null;try{if(p.code===void 0)throw new Error(p.error??"the host sent no code");Ma(await(t.evaluateLibrary??vl)(p.code))}catch(S){let k=S instanceof Error?S.message:String(S);i({type:"fatal",id:C.id,message:`Internal error in the Java engine: could not load the Java library (${k})`});return}m(C)}};return p=>{switch(p.type){case"init":i({type:"ready",version:"25",interactiveStdin:!1,java:"25",engine:Ra});return;case"run":m(p);return;case"stdin-response":return;case"module":return d(p)}}}var ja=globalThis,kl=Fa(i=>ja.postMessage(i));ja.onmessage=i=>kl(i.data);})();\n',n=new class extends e{id=`java`;supportsPractice=!0;statusDecidesFailure=!0;get source(){return t}async loadModule(e){if(e!==`java-library`)throw Error(`no module named ${e}`);let{JAVA_LIBRARY_SOURCE:t}=await import(`./java-library.generated-Bg_JSWb_.js`);return t}get label(){return this.version?`Java ${this.version} (subset)`:`Java`}async editorLanguage(){let{java:e}=await import(`@codemirror/lang-java`);return e()}};export{n as javaRuntime};