code-playpad 0.4.0 → 0.5.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.
- package/JAVA-COMPATIBILITY.md +7 -7
- package/README.md +50 -5
- package/dist/cdn.js +2 -2
- package/dist/{element-Bh4TdnGA.js → element-yit-fyhg.js} +1 -1
- package/dist/element.js +1 -1
- package/dist/index.js +1 -1
- package/dist/java-BHbRkfsQ.js +1 -0
- package/dist/java-BuW8Eeg_.js +6 -0
- package/dist/{java-library.generated-Bg_JSWb_.js → java-library.generated-I0MB-4YJ.js} +1 -1
- package/dist/{javascript-C1_thu8i.js → javascript-krS-hdur.js} +1 -1
- package/dist/{pyodide-CqcU3YGb.js → pyodide-C9S4Me6g.js} +1 -1
- package/dist/react.js +1 -1
- package/dist/runtime/java-library.generated.d.ts +3 -3
- package/dist/runtime/java-worker.generated.d.ts +3 -3
- package/dist/standalone.js +1 -1
- package/dist/{worker-runtime-Kjkt5ChF.js → worker-runtime-B64HCt-B.js} +1 -1
- package/package.json +1 -1
- package/dist/java-CDMXnFT7.js +0 -6
- package/dist/java-DrWI9a5Q.js +0 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* code-playpad — MIT © 2026 Seung Hun Lee
|
|
3
|
+
* Bundles CodeMirror 6 and Lezer (MIT) © Marijn Haverbeke and others.
|
|
4
|
+
* Full third-party licences: THIRD-PARTY-NOTICES.txt in this package.
|
|
5
|
+
*/
|
|
6
|
+
import{t as e}from"./worker-runtime-CNPpMRo1.js";var t='"use strict";(()=>{function Ks(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 rs(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 si(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"},nn=class{items=[];error(t,e,n,s,r,a){let{line:o,column:c}=rs(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 qs(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=si(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 Xa(i){return i>=48&&i<=57?i-48:i>=65&&i<=70?i-55:i>=97&&i<=102?i-87:-1}function ri(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=Xa(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 Ya=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"]),Qa=[">>>=","<<=",">>=",">>>","...","->","::","++","--","&&","||","==","!=","<=",">=","+=","-=","*=","/=","&=","|=","^=","%=","<<",">>","(",")","{","}","[","]",";",",",".","@","=",">","<","!","~","?",":","+","-","*","/","&","|","^","%"];function ai(i){return i>=65&&i<=90||i>=97&&i<=122||i===95||i===36}function ii(i){return ai(i)||i>=48&&i<=57}function ae(i){return i>=48&&i<=57}function Za(i){let t=i.charCodeAt(0);return t>=32&&t<127?`\'${i}\'`:`\'\\\\u${t.toString(16).padStart(4,"0")}\'`}function oi(i){let t=ri(i),e=t.text,n=t.offsets,s=[],r=t.errors.map(w=>({offset:w.offset,code:"syntax",message:w.message}));if(r.length)return{tokens:[{kind:"eof",text:"",start:i.length,end:i.length}],errors:r};let a=(w,x,k="syntax")=>{r.push({offset:n[w],code:k,message:x})},o=(w,x,k,I)=>{s.push({kind:w,text:e.slice(x,k),start:n[x],end:n[k],...I})},c=e.length;c>0&&e.charCodeAt(c-1)===26&&c--;let u=0;for(;u<c;){let w=e.charCodeAt(u);if(w===32||w===9||w===12||w===10||w===13){u++;continue}if(w===47&&e.charCodeAt(u+1)===47){for(;u<c&&e.charCodeAt(u)!==10&&e.charCodeAt(u)!==13;)u++;continue}if(w===47&&e.charCodeAt(u+1)===42){let k=e.indexOf("*/",u+2);if(k===-1||k+2>c){a(u,"unclosed comment"),u=c;break}u=k+2;continue}if(ai(w)){let k=u;for(;u<c&&ii(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&&(ii(e.charCodeAt(u))||e.charCodeAt(u)>127);)u++;let I=e.slice(k,u);o(Ya.has(I)?"keyword":"identifier",k,u);continue}if(ae(w)||w===46&&ae(e.charCodeAt(u+1))){u=m(u);continue}if(w===39){u=f(u);continue}if(w===34){e.startsWith(\'"""\',u)?u=C(u):u=p(u);continue}let x=Qa.find(k=>e.startsWith(k,u));if(x){o("operator",u,u+x.length),u+=x.length;continue}w>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: ${Za(e[u])}`),u++}return s.push({kind:"eof",text:"",start:n[c],end:n[c]}),{tokens:s,errors:r};function m(w){let x=J=>J<c?e.charCodeAt(J):-1,k=J=>x(J)|32,I=J=>ae(J)||(J|32)>=97&&(J|32)<=102,L=(J,j)=>{let K=J;for(;K<c&&(j(x(K))||x(K)===95);)K++;return K>J&&x(K-1)===95?(a(K-1,"illegal underscore"),null):K},$=(J,j,K)=>{let st=e.slice(K,J).replace(/_/g,""),Fe=BigInt((j===16?"0x":j===8?"0o":j===2?"0b":"")+(st||"0"));return(x(J)|32)===108?(o("long-literal",w,J+1,{integer:{value:Fe,radix:j}}),J+1):(o("int-literal",w,J,{integer:{value:Fe,radix:j}}),J)},O=(J,j)=>{if(k(J)!==j)return J;let K=J+1;return(x(K)===43||x(K)===45)&&K++,ae(x(K))?L(K,ae):(a(w,"malformed floating-point literal"),null)},R=J=>{let j=k(J);return j===102?(o("float-literal",w,J+1),J+1):j===100?(o("double-literal",w,J+1),J+1):(o("double-literal",w,J),J)};if(x(w)===48&&k(w+1)===120){let J=w+2;if(x(J)===95)return a(J,"illegal underscore"),J+1;let j=L(J,I);if(j===null)return c;let K=j>J;if(x(j)===46||k(j)===112){if(x(j)===46){let Kt=L(j+1,I);if(Kt===null)return c;if(!K&&Kt===j+1)return a(w,"hexadecimal numbers must contain at least one hexadecimal digit"),Kt;j=Kt}if(k(j)!==112)return a(w,"malformed floating-point literal"),j;let st=O(j,112);return st===null?c:R(st)}return K?$(j,16,J):(a(w,"hexadecimal numbers must contain at least one hexadecimal digit"),j)}if(x(w)===48&&k(w+1)===98){let J=w+2;if(x(J)===95)return a(J,"illegal underscore"),J+1;let j=L(J,ae);return j===null?c:j===J?(a(w,"binary numbers must contain at least one binary digit"),j):/[2-9]/.test(e.slice(J,j))?(a(w,"illegal digit in a binary literal"),j):$(j,2,J)}let N=w;if(ae(x(w))&&(N=L(w,ae),N===null))return c;if(x(N)===46&&(N>w||ae(x(N+1)))||k(N)===101||k(N)===102||k(N)===100)return x(N)===46&&(N=ae(x(N+1))?L(N+1,ae):N+1,N===null)?c:(N=O(N,101),N===null?c:R(N));if(x(w)===48&&N>w+1){for(let J=w+1;J<N;J++)if(x(J)===56||x(J)===57)return a(J,"illegal digit in an octal literal"),N;return $(N,8,w+1)}return $(N,10,w)}function h(w){let x=e[w+1];switch(x){case"b":return["\\b",w+2];case"s":return[" ",w+2];case"t":return[" ",w+2];case"n":return[`\n`,w+2];case"f":return["\\f",w+2];case"r":return["\\r",w+2];case\'"\':return[\'"\',w+2];case"\'":return["\'",w+2];case"\\\\":return["\\\\",w+2]}if(x!==void 0&&x>="0"&&x<="7"){let k=x<="3"?3:2,I=w+1,L="";for(;L.length<k&&I<c&&e[I]>="0"&&e[I]<="7";)L+=e[I++];return[String.fromCharCode(parseInt(L,8)),I]}return null}function f(w){let x=w+1,k="";for(;x<c;){let I=e.charCodeAt(x);if(I===39)break;if(I===10||I===13)return a(w,"unclosed character literal"),x;if(I===92){let L=h(x);if(!L)return a(x+1,"illegal escape character"),T(x);k+=L[0],x=L[1];continue}k+=e[x],x++}return x>=c?(a(w,"unclosed character literal"),x):k.length===0?(a(w,"empty character literal"),x+1):k.length>1?(a(w,"unclosed character literal"),x+1):(o("char-literal",w,x+1,{stringValue:k}),x+1)}function p(w){let x=w+1,k="";for(;x<c;){let I=e.charCodeAt(x);if(I===34)return o("string-literal",w,x+1,{stringValue:k}),x+1;if(I===10||I===13)break;if(I===92){let L=h(x);if(!L)return a(x+1,"illegal escape character"),T(x);k+=L[0],x=L[1];continue}k+=e[x],x++}return a(w,"unclosed string literal"),x}function C(w){let x=w+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(w,"unclosed text block"),c;x+=e[x]==="\\r"&&e[x+1]===`\n`?2:1;let k=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",w,x+3,{stringValue:to(e.slice(k,x))}),x+3;x++}return a(w,"unclosed text block"),c}function T(w){for(;w<c&&e.charCodeAt(w)!==10&&e.charCodeAt(w)!==13;)w++;return w}}var Ws=/[\\t\\x0b\\f\\x1c-\\x20\\u1680\\u2000-\\u2006\\u2008-\\u200a\\u2028\\u2029\\u205f\\u3000]/;function to(i){let t=i.replace(/\\r\\n?/g,`\n`).split(`\n`),e=a=>[...a].every(o=>Ws.test(o)),n=a=>{let o=0;for(;o<a.length&&Ws.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&&Ws.test(a[o-1]);)o--;return a.slice(s,o)});return eo(r.join(`\n`))}function eo(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 sn=Number.MAX_SAFE_INTEGER,Ys=9223372036854775807n,Qs=-9223372036854775808n,li=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),rn=i=>i===0?0:i;function ci(i,t){if(typeof i=="number"&&typeof t=="number"){let e=i+t;if(e<=sn&&e>=-sn)return e}return vt(It(i)+It(t))}function ui(i,t){if(typeof i=="number"&&typeof t=="number"){let e=i-t;if(e<=sn&&e>=-sn)return e}return vt(It(i)-It(t))}function hi(i,t){if(typeof i=="number"&&typeof t=="number"){let e=i*t;if(e<=sn&&e>=-sn)return rn(e)}return vt(It(i)*It(t))}function di(i,t){return typeof i=="number"&&typeof t=="number"?rn(Math.trunc(i/t)):vt(It(i)/It(t))}function fi(i,t){return typeof i=="number"&&typeof t=="number"?rn(i%t):vt(It(i)%It(t))}function Zs(i){return typeof i=="number"?rn(-i):vt(-i)}function mi(i,t){return vt(It(i)<<BigInt(t&63))}function pi(i,t){return vt(It(i)>>BigInt(t&63))}function yi(i,t){return vt(BigInt.asUintN(64,It(i))>>BigInt(t&63))}function gi(i,t){return vt(It(i)&It(t))}function bi(i,t){return vt(It(i)|It(t))}function Ti(i,t){return vt(It(i)^It(t))}function os(i){return typeof i=="number"?i|0:Number(BigInt.asIntN(32,i))}function ls(i){return Number(i)}function an(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 An(i){if(Number.isNaN(i))return 0;if(i>=li)return Ys;if(i<=-li)return Qs;let t=Math.trunc(i);return Number.isSafeInteger(t)?rn(t):BigInt(t)}function In(i){return Number.isNaN(i)?0:i>=2147483647?2147483647:i<=-2147483648?-2147483648:rn(Math.trunc(i))}function Si(i){return Number.isNaN(i)?0:In(Math.abs(i)>=8388608?i:Math.floor(i+.5))}function xi(i){return An(Math.round(i))}function no(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 is=new DataView(new ArrayBuffer(4));function vi(i){return is.setFloat32(0,i),is.getInt32(0)}function cs(i){return Number.isNaN(i)?2143289344:vi(i)}function wi(i){return is.setInt32(0,i),is.getFloat32(0)}var as=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=vi(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,f=1n<<BigInt(a),p=$=>$<0?{A:as(-$),B:f}:{A:1n,B:as($)*f},C=$=>{let{A:O,B:R}=p($),N=m*O,B=u*O,J=(N+R-1n)/R;!h&&J*R===N&&J++;let j=B/R;return!h&&j*R===B&&j--,{dLo:J,dHi:j,A:O,B:R}},T=$=>{let{dLo:O,dHi:R,A:N,B}=C($);if(O>R)return null;let J=c*N,j=J/B,K=2n*J,st=(2n*j+1n)*B;return(K>st||K===st&&(j&1n)===1n)&&j++,j<O&&(j=O),j>R&&(j=R),j},w=Math.floor(Math.log10(Math.abs(i)))+2,x=T(w);for(;x===null;)x=T(--w);x<10n&&(w--,x=T(w));let k=x.toString(),I=w+k.length-1,L=Math.abs(i);return no(i<0?"-":"",k,I,L>=.001&&L<1e7)}function so(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*as(t):i,a=t>=0?1n:as(-t);return n(Xs(r,a))}function Xs(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 ki(i,t){return i===0n?0:t>=0?Xs(i<<BigInt(t),1n):Xs(i,1n<<BigInt(-t))}function Ci(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=ki(o,Number(s[3])-4*a.length)}else e=tr(t),n=/[1-9]/.test(t.replace(/[eE].*$/,""));return e===1/0?{error:"too-large"}:e===0&&n?{error:"too-small"}:{value:e}}function Ei(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?ki(s,r):Ii(s,r);return e[1]==="-"?-a:a}function tr(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 so(s,r,t[1]==="-")}function oe(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 Ai(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=Ii(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 Ii(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 er(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}},Ve=new Set(["int","boolean","byte","short","long","char","float","double"]),Oi=new Set(["public","protected","private","static","final","abstract","native","synchronized","transient","volatile","strictfp","default"]),ro={"||":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"<":7,">":7,"<=":7,">=":7,instanceof:7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10},Li=new Set(["=","+=","-=","*=","/=","%=","&=","|=","^=","<<=",">>=",">>>="]),io={synchronized:"\'synchronized\' statements"},ao=new Set(["(","!","~","this","super","new","true","false","null","switch"]);function Ni(i,t,e){let n=new nr(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 nr=class{#A;#dt;#Lt=[];#M;#R=0;#ot=0;constructor(t,e,n){this.#A=t,this.#dt=[...e],this.#M=n}#r(t=0){return this.#dt[Math.min(this.#R+t,this.#dt.length-1)]}#h(){return this.#dt[Math.max(this.#R-1,0)]}#s(){let t=this.#r();return this.#R<this.#dt.length-1&&this.#R++,t}#n(t,e=0){let n=this.#r(e);return(n.kind==="operator"||n.kind==="keyword")&&n.text===t}#m(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.#N(),this.#d(this.#h().end,`\'${t}\' expected`)}#j(){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.#N(),this.#d(t.kind==="keyword"?t.start:this.#h().end,"<identifier> expected"))}#N(){throw this.#d(this.#h().end,"reached end of file while parsing")}#d(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`})}#et(){return{i:this.#R,splits:this.#Lt.length}}#I(t){for(;this.#Lt.length>t.splits;){let e=this.#Lt.pop();this.#dt.splice(e.index,2,e.token)}this.#R=t.i}#K(){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.#Lt.push({index:this.#R,token:t}),this.#dt.splice(this.#R,1,e,n),this.#s();return}throw t.kind==="eof"&&this.#N(),this.#d(t.start,"\'>\' expected")}#_(){this.#i("<");let t=[];do{let e=this.#r();if(e.kind==="operator"&&e.text==="@")throw this.#b(e.start,"annotations");let n=this.#j(),s=[];if(this.#u("extends"))do s.push(this.#p());while(this.#u("&"));t.push({name:n.text,pos:n.start,bounds:s})}while(this.#u(","));return this.#K(),t}#ft(){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.#p():this.#u("super")&&(s=!0,n=this.#p()),t.push({kind:"WildcardType",bound:n,isSuper:s,pos:e.start,start:e.start,end:this.#h().end})}else t.push(this.#p())}while(this.#u(","));return this.#K(),t}#lt(){if(++this.#ot>this.#M.maxNestingDepth)throw new Ft({offset:this.#r().start,code:"limit",message:`code is nested too deeply for this engine (limit ${this.#M.maxNestingDepth})`})}#st(){this.#ot--}#g(t,...e){let n=0;for(let s of e)n=Math.max(n,s.depth);if(t.depth=n+1,t.depth>this.#M.maxExpressionDepth)throw new Ft({offset:t.start,code:"limit",message:`expression is nested too deeply for this engine (limit ${this.#M.maxExpressionDepth})`});return t}compilationUnit(){let t={file:this.#A,imports:[],types:[]},e=[];if(this.#n("package"))throw this.#b(this.#r().start,"package declarations");for(;this.#n("import");)t.imports.push(this.#ee());for(;this.#r().kind!=="eof";){if(this.#u(";"))continue;let n=this.#r().start;if(this.#n("import"))throw this.#yt(t,e);let s=this.#o();if(this.#n("class")||this.#n("interface")){t.types.push(this.#$(s,n));continue}if(this.#n("enum")){t.types.push(this.#L(s,n));continue}if(this.#n("@")&&this.#n("interface",1))throw this.#b(this.#r().start,"annotation interface declarations");if(this.#m(0,"record")&&this.#m(1)&&(this.#n("(",2)||this.#n("<",2))){t.types.push(this.#k(s,n));continue}if(this.#a()){e.push(this.#P(s,n,null));continue}throw this.#yt(t,e)}if(e.length){let n=[...e,...t.types].sort((a,o)=>a.start-o.start),s=n[0],r=this.#A.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}#ee(){let t=this.#i("import"),e=this.#n("static");e&&this.#s();let n=[this.#j().text],s=t.start,r=[],a=!1,o=this.#h().start;for(;this.#n(".");){if(s=this.#s().start,r.push(s),this.#n("*")){o=this.#s().start,a=!0;break}let u=this.#j();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}}#yt(t,e){let n=this.#dt.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.#d(this.#r().start,"class, interface, annotation type, enum, record, method or field expected")}#a(){let t=this.#et();try{if(this.#n("void"))this.#s();else if(!this.#C())return!1;return this.#m()?(this.#s(),this.#n("(")||this.#n("=")||this.#n(";")||this.#n(",")):!1}finally{this.#I(t)}}#o(){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.#U());continue}if(e.kind==="keyword"&&Oi.has(e.text)){if(t.keywords.some(n=>n.name===e.text))throw this.#d(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.#m(a,"sealed")||this.#m(a,"non")||this.#n("abstract",a)||this.#r(a).kind==="keyword"&&Oi.has(this.#r(a).text),s=e.text==="sealed"&&n(1),r=e.text==="non"&&this.#n("-",1)&&this.#m(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.#d(e.start,"repeated modifier");t.keywords.push({name:a,pos:e.start}),this.#s(),r&&(this.#s(),this.#s());continue}}return t}}#U(){let t=this.#i("@"),e=this.#j(),n=[e.text];for(;this.#n(".")&&this.#m(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.#m()&&this.#n("=",1)&&(o=this.#s().text,this.#s()),r.push({name:o,value:this.#Y(),pos:a}),!this.#u(","))break}this.#i(")"),s.args=r}return s}#Y(){if(this.#n("@"))throw this.#b(this.#r().start,"nested annotations");if(!this.#n("{"))return this.#w();let t=this.#s(),e=[];for(;!this.#n("}")&&(e.push(this.#Y()),!!this.#u(",")););return this.#i("}"),{kind:"ElementArray",elements:e,pos:t.start}}#Nt(t,e){for(;!this.#n("}");)this.#r().kind==="eof"&&this.#N(),!this.#u(";")&&t.members.push(this.#Ht(t.name,e));t.end=this.#i("}").end}#V(t){if(this.#u("implements"))do t.implementsTypes.push(this.#p());while(this.#u(","))}#L(t,e){let n=this.#i("enum"),s=this.#j(),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.#d(this.#h().end,"\'{\' expected");for(this.#V(r),this.#i("{");this.#m()||this.#n("@");){if(this.#n("@"))throw this.#b(this.#r().start,"annotations");let a=this.#s(),o=this.#n("(")?this.#nt():[],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.#Nt(c)}if(r.enumConstants.push({name:a.text,args:o,...c?{body:c}:{},pos:a.start,start:a.start,end:this.#h().end}),!this.#u(","))break}if(!this.#n("}")&&!this.#u(";"))throw this.#d(this.#h().end,"\',\', \'}\', or \';\' expected");return this.#Nt(r),r}#k(t,e){let n=this.#s(),s=this.#j(),r=this.#n("<")?this.#_():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.#d(this.#h().end,"\'{\' expected");return this.#V(a),this.#i("{"),this.#Nt(a,a.name),a}#$(t,e){let n=this.#n("interface"),s=this.#s(),r=this.#j(),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.#_()),this.#u("extends"))do a.extendsTypes.push(this.#p());while(n&&this.#u(","));if(this.#n("implements")){if(n)throw this.#d(this.#r().start,"\'{\' expected");this.#s();do a.implementsTypes.push(this.#p());while(this.#u(","))}if(this.#m(0,"permits")){this.#s(),a.permits=[];do a.permits.push(this.#p());while(this.#u(","))}for(this.#i("{");!this.#n("}");)this.#r().kind==="eof"&&this.#N(),!this.#u(";")&&a.members.push(this.#Ht(a.name));return a.end=this.#i("}").end,a}#Ht(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.#T();return{kind:"Initializer",modifiers:r,isStatic:r.keywords.length>0,body:a,pos:n,start:n,end:a.end}}let s=this.#o();if(this.#n("class")||this.#n("interface"))return this.#$(s,n);if(this.#n("enum"))return this.#L(s,n);if(this.#m(0,"record")&&this.#m(1)&&(this.#n("(",2)||this.#n("<",2)))return this.#k(s,n);if(e!==void 0&&this.#m(0,e)&&this.#n("{",1)){let r=this.#s(),a=this.#T();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.#P(s,n,t)}#P(t,e,n){if(this.#n("<")){let a=this.#_(),o=this.#P(t,e,n);if(o.kind!=="MethodDeclaration")throw this.#d(o.pos,"<identifier> expected");return o.typeParams=a,o}if(n!==null&&this.#m()&&this.#n("(",1)){let a=this.#r();if(a.text!==n)throw this.#d(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.#y(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.#p();let r=this.#j();if(!this.#n("(")){if(s.kind!=="VoidType"&&(this.#n("=")||this.#n(";")||this.#n(",")||this.#n("[")))return this.#t(t,s,r,e);throw this.#d(this.#h().end,"\'(\' expected")}return this.#y(t,s,r,e)}#t(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.#xt():this.#w()),r.push({name:a.text,extraDims:c,init:u,pos:a.start,start:a.start,end:this.#h().end}),!this.#u(","))break;a=this.#j()}let o=this.#i(";");return{kind:"FieldDeclaration",modifiers:t,type:e,declarators:r,pos:n.start,start:s,end:o.end}}#y(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.#d(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.#p());while(this.#u(","))}if(this.#u(";"))return r.end=this.#h().end,r;if(!this.#n("{"))throw this.#d(this.#h().end,"\'{\' expected");return r.body=this.#T(),r.end=r.body.end,r.closeBracePos=r.body.end-1,r}#f(){let t=this.#r().start,e=this.#o(),n=this.#p(),s=!1;this.#u("...")&&(s=!0);let r=this.#j();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.#h().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}}#p(){let t=this.#r(),e;if(t.kind==="keyword"&&Ve.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.#ft();if(u==="diamond")throw this.#d(this.#h().start,"illegal start of type");a=u,s=!0}if(this.#n(".")&&this.#m(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.#h().end}}else if(t.kind==="eof")this.#N();else throw this.#d(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}#C(){let t=this.#et();try{return this.#p(),!0}catch(e){if(!(e instanceof Ft))throw e;return this.#I(t),!1}}#T(){let t=this.#i("{");this.#lt();let e=[];for(;!this.#n("}");)this.#r().kind==="eof"&&this.#N(),e.push(this.#Gt());let n=this.#i("}");return this.#st(),{kind:"Block",statements:e,pos:t.start,start:t.start,end:n.end}}#Gt(){if(this.#Mt())return this.#rt();if(this.#n("static")&&(this.#n("class",1)||this.#n("interface",1)))throw this.#d(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.#m(0,"record")&&this.#m(1)&&(this.#n("(",2)||this.#n("<",2));if(t||e){let n=this.#r().start,s=this.#o(),r=this.#n("enum")?this.#L(s,n):e?this.#k(s,n):this.#$(s,n);return{kind:"LocalClass",declaration:r,pos:r.keywordPos,start:n,end:r.end}}return this.#Et()?this.#J():this.#rt()}#Et(){if(this.#n("final")||this.#n("@")&&!this.#n("interface",1))return!0;let t=this.#r();if(t.kind==="keyword"&&Ve.has(t.text))return!this.#n(".",1);if(t.kind!=="identifier")return!1;let e=this.#et();try{if(!this.#C())return!1;let n=this.#r();return n.kind==="identifier"||n.kind==="keyword"&&n.text==="_"}finally{this.#I(e)}}#J(){let t=this.#r().start,e=this.#o();for(let a of e.keywords)if(a.name!=="final")throw this.#d(a.pos,"illegal start of expression");let n=this.#p();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.#j(),o=0;for(;this.#n("[")&&this.#n("]",1);)this.#s(),this.#s(),o++;let c=null;this.#u("=")&&(c=this.#n("{")?this.#xt():this.#w()),s.push({name:a.text,extraDims:o,init:c,pos:a.start,start:a.start,end:this.#h().end})}while(this.#u(","));let r=this.#i(";");return{kind:"LocalVariableDeclaration",modifiers:e,type:n,declarators:s,pos:t,start:t,end:r.end}}#rt(){this.#lt();try{let t=this.#r();if(t.kind==="operator"&&t.text==="{")return this.#T();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.#St();if(t.text==="if")return this.#$t();if(t.text==="while")return this.#bt();if(t.text==="do")return this.#v();if(t.text==="switch")return this.#D();if(t.text==="for")return this.#At();if(t.text==="return")return this.#Oe();if(t.text==="break"||t.text==="continue")return this.#Se();if(t.text==="throw")return this.#zt();if(t.text==="try")return this.#ct();if(t.text==="assert")return this.#Te();let e=io[t.text];if(e)throw this.#b(t.start,e);if(t.text==="else")throw this.#d(t.start,"\'else\' without \'if\'")}if(t.kind==="identifier"){if(this.#n(":",1))return this.#z();if(this.#Mt())return this.#O()}if(this.#Et()){let e=this.#J();throw this.#d(e.declarators[0].pos,"variable declaration not allowed here")}return this.#mt()}finally{this.#st()}}#St(){let t=this.#s(),e=this.#r().start,n=this.#nt(),s=this.#i(";");return{kind:"ConstructorCall",keyword:t.text,thisPos:t.start,args:n,pos:e,start:t.start,end:s.end}}#$t(){let t=this.#i("if");this.#i("(");let e=this.#w();this.#i(")");let n=this.#rt(),s=null;this.#u("else")&&(s=this.#rt());let r=(s??n).end;return{kind:"IfStatement",condition:e,then:n,otherwise:s,pos:t.start,start:t.start,end:r}}#Mt(){if(!this.#m(0,"yield"))return!1;let t=this.#r(1);return t.kind==="eof"?!1:t.kind!=="operator"?!0:Li.has(t.text)?!1:![".","(","[","++","--",";",":",")",","].includes(t.text)}#O(){let t=this.#s(),e=this.#w(),n=this.#i(";");return{kind:"YieldStatement",value:e,pos:t.start,start:t.start,end:n.end}}#z(){let t=this.#s();this.#i(":");let e=this.#rt();return{kind:"LabeledStatement",label:t.text,body:e,pos:t.start,start:t.start,end:e.end}}#v(){let t=this.#i("do"),e=this.#rt();this.#i("while"),this.#i("(");let n=this.#w();this.#i(")");let s=this.#i(";");return{kind:"DoStatement",body:e,condition:n,pos:t.start,start:t.start,end:s.end}}#D(){let t=this.#i("switch"),e=this.#r().start,n=this.#q(),{cases:s,end:r}=this.#W(!1);return{kind:"SwitchStatement",selector:n,selectorPos:e,cases:s,pos:t.start,start:t.start,end:r}}#q(){this.#i("(");let t=this.#w();return this.#i(")"),t}#W(t){this.#i("{"),this.#lt();let e=[];for(;!this.#n("}");){this.#r().kind==="eof"&&this.#N();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.#e()){if(u||r.length)throw this.#b(this.#r().start,"several patterns in one case label");u=this.#Q(!0),this.#m(0,"when")&&(this.#s(),m=this.#w());continue}if(this.#m()&&(this.#n("->",1)||this.#n(",",1)||this.#n(":",1))){let f=this.#s();r.push({kind:"Name",identifier:f.text,depth:1,pos:f.start,start:f.start,end:f.end})}else r.push(this.#B())}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.#d(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.#T();else if(this.#n("throw")){let u=this.#zt();c.body={kind:"Block",statements:[u],pos:u.pos,start:u.start,end:u.end}}else{let u=this.#w();if(!t&&!er(u))throw this.#d(u.pos,"not a statement");this.#i(";"),c.body=u}else{if(!this.#n(":"))throw this.#d(this.#h().end,"\':\' or \'->\' expected");for(this.#s();!this.#n("case")&&!this.#n("default")&&!this.#n("}");)this.#r().kind==="eof"&&this.#N(),c.statements.push(this.#Gt())}c.end=this.#h().end,e.push(c)}let n=this.#i("}");return this.#st(),{cases:e,end:n.end}}#e(){let t=this.#et();try{this.#u("final");let e=this.#r();return!(e.kind==="identifier"||e.kind==="keyword"&&Ve.has(e.text))||!this.#C()?!1:this.#m()||this.#n("(")||this.#n("_")}finally{this.#I(t)}}#Q(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.#m(0,"var")&&(this.#m(1)||this.#n("_",1))?(this.#s(),s=null):s=this.#p(),s&&this.#n("(")){if(n)throw this.#d(e,"illegal start of expression");this.#s();let a=[];if(!this.#n(")"))do a.push(this.#Q(!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.#m())throw this.#d(this.#h().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}}#bt(){let t=this.#i("while");this.#i("(");let e=this.#w();this.#i(")");let n=this.#rt();return{kind:"WhileStatement",condition:e,body:n,pos:t.start,start:t.start,end:n.end}}#At(){let t=this.#i("for");if(this.#i("("),this.#Ie())return this.#l(t);let e=null;this.#Et()?e=this.#J():(this.#n(";")||(e=this.#Pt()),this.#i(";"));let n=this.#n(";")?null:this.#w();this.#i(";");let s=this.#n(")")?[]:this.#Pt();this.#i(")");let r=this.#rt();return{kind:"ForStatement",init:e,condition:n,update:s,body:r,pos:t.start,start:t.start,end:r.end}}#l(t){let e=this.#o();for(let o of e.keywords)if(o.name!=="final")throw this.#d(o.pos,"illegal start of expression");let n=this.#p();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.#j();this.#i(":");let r=this.#w();this.#i(")");let a=this.#rt();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}}#Ie(){let t=this.#et();try{return this.#o(),!this.#C()||!this.#m()?!1:(this.#s(),this.#n(":"))}catch(e){if(e instanceof Ft)return!1;throw e}finally{this.#I(t)}}#Pt(){let t=[];do{let e=this.#w();if(!er(e))throw this.#d(e.pos,"not a statement");t.push(e)}while(this.#u(","));return t}#Oe(){let t=this.#i("return"),e=this.#n(";")?null:this.#w(),n=this.#i(";");return{kind:"ReturnStatement",value:e,pos:t.start,start:t.start,end:n.end}}#zt(){let t=this.#i("throw"),e=this.#w(),n=this.#i(";");return{kind:"ThrowStatement",expression:e,pos:t.start,start:t.start,end:n.end}}#Te(){let t=this.#i("assert"),e=this.#w(),n=this.#u(":")?this.#w():null,s=this.#i(";");return{kind:"AssertStatement",condition:e,message:n,pos:t.start,start:t.start,end:s.end}}#ct(){let t=this.#i("try"),e=[];if(this.#u("(")){for(;!this.#n(")");){let o=this.#r().start;if(this.#m()&&(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.#o();let c=this.#p();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.#j();this.#i("=");let m=this.#w();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.#T(),s=[];for(;this.#n("catch");){let o=this.#s();this.#i("(");let c=this.#o(),u=[this.#p()];for(;this.#u("|");)u.push(this.#p());let m=this.#j();this.#i(")");let h=this.#T();s.push({types:u,name:m.text,namePos:m.start,isFinal:c.keywords.some(f=>f.name==="final"),block:h,pos:o.start,start:o.start,end:h.end})}let r=this.#u("finally")?this.#T():null;if(!s.length&&!r&&!e.length)throw this.#d(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}}#Se(){let t=this.#s(),e=this.#m()?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}}#xt(){let t=this.#i("{");this.#lt();let e=[];for(;!this.#n("}")&&(e.push(this.#n("{")?this.#xt():this.#w()),!!this.#u(",")););let n=this.#i("}");return this.#st(),{kind:"ArrayInitializer",elements:e,pos:t.start,start:t.start,end:n.end}}#mt(){let t=this.#w();if(!er(t))throw this.#d(t.pos,"not a statement");let e=this.#i(";");return{kind:"ExpressionStatement",expression:t,pos:t.pos,start:t.start,end:e.end}}#w(){this.#lt();try{let t=this.#B(),e=this.#r();if(e.kind==="operator"&&Li.has(e.text)){this.#s();let n=this.#w();return this.#g({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.#st()}}#B(){let t=this.#Rt(1);if(!this.#n("?"))return t;let e=this.#s(),n=this.#w();this.#i(":");let s=this.#B();return this.#g({kind:"Conditional",condition:t,whenTrue:n,whenFalse:s,depth:0,pos:e.start,start:t.start,end:s.end},t,n,s)}#Rt(t){let e=this.#X();for(;;){let n=this.#r();if(n.kind!=="operator"&&!(n.kind==="keyword"&&n.text==="instanceof"))break;let s=ro[n.text];if(s===void 0||s<t)break;if(n.text==="instanceof"){e=this.#Jt(e);continue}this.#s();let r=this.#Rt(s+1);e=this.#g({kind:"Binary",operator:n.text,left:e,right:r,depth:0,pos:n.start,start:e.start,end:r.end},e,r)}return e}#Jt(t){let e=this.#s(),n=!1;this.#n("final")&&(this.#s(),n=!0);let s=this.#p(),r,a;if(this.#n("(")){this.#s();let c=[];if(!this.#n(")"))do c.push(this.#Q(!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.#m()){let c=this.#s();r={name:c.text,pos:c.start,isFinal:n}}else if(n)throw this.#d(this.#h().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.#h().end};return this.#g(o,t)}#X(){this.#lt();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.#It(!0):t.text==="-"&&e.kind==="long-literal"&&e.integer?.radix===10&&e.integer.value===9223372036854775808n?this.#se(!0):this.#X();return this.#g({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.#X();return this.#g({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.#X();return this.#g({kind:"IncDec",operator:t.text,prefix:!0,operand:e,depth:0,pos:t.start,start:t.start,end:e.end},e)}case"(":if(this.#Z()){this.#s();let e=this.#p();this.#i(")");let n=this.#X();return this.#g({kind:"Cast",targetType:e,expression:n,depth:0,pos:t.start,start:t.start,end:n.end},n)}break}return this.#Dt(this.#re())}finally{this.#st()}}#Z(){if(this.#Tt())return!1;let t=this.#r(1);if(t.kind==="keyword"&&Ve.has(t.text))return this.#n(")",2)||this.#n("[",2)&&this.#n("]",3);if(t.kind!=="identifier")return!1;let e=this.#et();try{if(this.#s(),!this.#C()||!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")&&ao.has(n.text)}finally{this.#I(e)}}#Dt(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.#ft();if(o==="diamond")throw this.#d(this.#r().start,"illegal start of type");if(s=o,!this.#m()||!this.#n("(",1))throw this.#d(this.#r().start,"<identifier> expected")}let r=this.#r();if(r.kind==="keyword"&&r.text==="class"){this.#s(),e=this.#g({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.#d(r.start,"<identifier> expected");o.unshift(c.name)}e=this.#g({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.#d(r.start,"<identifier> expected");o.unshift(c.name),c=c.target}this.#s(),e=this.#g({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.#j();if(this.#n("(")){let o=this.#r().start,c=this.#nt();e=this.#g({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.#h().end},e,...c)}else e=this.#g({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.#Le(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.#gt(null,s,e.start)}if(n.text==="["){this.#s();let s=this.#w(),r=this.#i("]");e=this.#g({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.#gt(e,void 0,e.start);if(n.text==="<"&&(e.kind==="Name"||e.kind==="FieldAccess")&&this.#c())throw this.#b(n.start,"method references on a parameterized type (write a lambda)");if(n.text==="++"||n.text==="--"){this.#s(),e=this.#g({kind:"IncDec",operator:n.text,prefix:!1,operand:e,depth:0,pos:n.start,start:e.start,end:n.end},e);continue}return e}}#c(){let t=this.#et();try{return this.#ft()!=="diamond"&&this.#n("::")}catch(e){if(!(e instanceof Ft))throw e;return!1}finally{this.#I(t)}}#ne(){let t=0;for(;this.#n("[",t)&&this.#n("]",t+1);)t+=2;return t>0&&this.#n("::",t)}#Le(t){let e=[],n=t;for(;n.kind==="FieldAccess";)e.unshift(n.name),n=n.target;if(n.kind!=="Name")throw this.#d(t.pos,"<identifier> expected");return e.unshift(n.identifier),{kind:"ClassType",names:e,hasTypeArguments:!1,pos:t.pos,start:t.start,end:t.end}}#gt(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.#d(r.start,"<identifier> expected");if(this.#s(),e&&r.text!=="new")throw this.#d(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}}#nt(){this.#i("(");let t=[];if(!this.#n(")"))do t.push(this.#w());while(this.#u(","));return this.#i(")"),t}#It(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}}#se(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}}#re(){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.#It(!1);case"long-literal":return this.#se(!1);case"float-literal":case"double-literal":{let n=t.kind==="float-literal",s=n?Ci(t.text):Ai(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.#ie(t.start,[{name:t.text,pos:t.start,type:null}]);if(this.#s(),this.#n("(")){let n=this.#r().start,s=this.#nt();return this.#g({kind:"MethodCall",target:null,name:t.text,namePos:t.start,selectPos:t.start,args:s,depth:0,pos:n,start:t.start,end:this.#h().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.#Kt();case"switch":{this.#s();let n=this.#r().start,s=this.#q(),{cases:r,end:a}=this.#W(!0);return this.#g({kind:"SwitchExpression",selector:s,selectorPos:n,cases:r,depth:0,pos:t.start,start:t.start,end:a},s)}}if(Ve.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.#gt(null,n,t.start)}if(Ve.has(t.text)||t.text==="void")throw this.#b(t.start,"class literals");break;case"operator":if(t.text==="("){if(this.#Tt())return this.#qt();this.#s();let n=this.#w(),s=this.#i(")");return this.#g({kind:"Parenthesized",expression:n,depth:0,pos:t.start,start:t.start,end:s.end},n)}break;case"eof":this.#N()}throw this.#d(t.start,"illegal start of expression")}#Kt(){let t=this.#i("new"),e=this.#r(),n;if(e.kind==="keyword"&&Ve.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.#m(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.#ft();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.#h().end},this.#n("(")){let h=this.#nt(),f;if(this.#n("{")){let p=this.#s();f={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.#lt(),this.#Nt(f),this.#st()}return this.#g({kind:"NewObject",classType:n,args:h,...f?{body:f}:{},depth:0,pos:t.start,start:t.start,end:this.#h().end},...h)}}else throw this.#d(e.start,"<identifier> expected");if(!this.#n("["))throw this.#d(this.#h().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.#d(this.#h().end,"array dimension missing");let o=this.#xt();return this.#g({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.#d(this.#r().start,"\']\' expected");this.#s(),s.push(this.#w()),this.#i("]")}if(this.#n("{"))throw this.#d(this.#r().start,"\';\' expected");return this.#g({kind:"NewArray",elementType:n,dimensions:s,extraDims:r,initializer:null,depth:0,pos:t.start,start:t.start,end:this.#h().end},...s)}#qt(){let t=this.#i("("),e=[];if(!this.#n(")"))do{if(this.#m()&&(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.#m(0,"var"))throw this.#b(this.#r().start,"\'var\' lambda parameters");let r=this.#p(),a=this.#j();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.#ie(t.start,e)}#ie(t,e){if(this.#i("->"),this.#n("{")){let s=this.#T();return{kind:"Lambda",params:e,body:s,depth:1,pos:t,start:t,end:s.end}}let n=this.#w();return this.#g({kind:"Lambda",params:e,body:n,depth:0,pos:t,start:t,end:n.end},n)}#Tt(){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 us(i){if(i.kind==="MethodRef")return nt(i);let t=i.kind==="Lambda"?Mi(i):nt(i);return t.length>=20?`${t.slice(0,10)}[...]${t.slice(-5)}`:t}function Mi(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"?Pi(i.body.statements):nt(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 $i(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 nt(i){switch(i.kind){case"Literal":switch(i.literalKind){case"long":return`${i.value}L`;case"double":return oe(i.value);case"float":return`${oe(parseFloat(String(i.value)))}F`;case"char":return $i(i.value,"\'");case"string":case"text-block":return $i(i.value,\'"\');default:return String(i.value)}case"Name":return i.identifier;case"FieldAccess":return`${nt(i.target)}.${i.name}`;case"MethodCall":return`${i.target?nt(i.target)+".":""}${i.name}(${i.args.map(nt).join(", ")})`;case"Unary":return i.operator+nt(i.operand);case"IncDec":return i.prefix?i.operator+nt(i.operand):nt(i.operand)+i.operator;case"Binary":return`${nt(i.left)} ${i.operator} ${nt(i.right)}`;case"Assignment":return`${nt(i.target)} ${i.operator} ${nt(i.value)}`;case"Parenthesized":return`(${nt(i.expression)})`;case"ArrayAccess":return`${nt(i.array)}[${nt(i.index)}]`;case"NewArray":{let t=i.dimensions.map(e=>`[${nt(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"?"{...}":nt(e)).join(", ")}}`:`new ${te(i.elementType)}${t}`}case"Cast":return`(${te(i.targetType)})${nt(i.expression)}`;case"This":return"this";case"NewObject":return`new ${te(i.classType)}(${i.args.map(nt).join(", ")})`;case"Conditional":return`${nt(i.condition)} ? ${nt(i.whenTrue)} : ${nt(i.whenFalse)}`;case"SwitchExpression":return`switch (${nt(i.selector)}) {...}`;case"Lambda":return Mi(i);case"MethodRef":return`${i.arrayType?te(i.arrayType):i.target?nt(i.target):""}::${i.name}`;case"InstanceOf":return`${nt(i.expression)} instanceof ${te(i.targetType)}${i.binding?` ${i.binding.name}`:""}`;case"Super":return"super";case"ClassLiteral":return`${nt(i.target)}.class`}}function Pi(i){return i.length?`{ ${i.map(He).join(" ")} }`:"{ }"}function He(i){switch(i.kind){case"Block":return Pi(i.statements);case"ReturnStatement":return i.value?`return ${nt(i.value)};`:"return;";case"ExpressionStatement":return`${nt(i.expression)};`;case"LocalVariableDeclaration":return`${te(i.type)} ${i.declarators.map(t=>t.init&&t.init.kind!=="ArrayInitializer"?`${t.name} = ${nt(t.init)}`:t.name).join(", ")};`;case"IfStatement":return`if (${nt(i.condition)}) ${He(i.then)}${i.otherwise?` else ${He(i.otherwise)}`:""}`;case"WhileStatement":return`while (${nt(i.condition)}) ${He(i.body)}`;case"DoStatement":return`do ${He(i.body)} while (${nt(i.condition)});`;case"ForStatement":return`for (...) ${He(i.body)}`;case"ForEachStatement":return`for (${te(i.type)} ${i.name} : ${nt(i.iterable)}) ${He(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 ${nt(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"},on=class extends Error{constructor(){super("the Java library chunk is needed"),this.name="NeedsLibrary"}},ln=null;function Ri(i){ln=i}function cn(){return ln}function le(i){if(i in Pt){if(!ln)throw new on;return ln.classes.get(i)}}function ee(i){if(!ln)throw new on;return ln.classes.get(i)}var U={tag:"int"},On={tag:"byte"},dn={tag:"short"},Se={tag:"char"},dt={tag:"boolean"},Lt={tag:"long"},St={tag:"float"},lt={tag:"double"},Tt={tag:"void"},ir={tag:"null"},ct={tag:"string"},G={tag:"object"},Fi={tag:"printstream"},E={tag:"error"};function qt(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 hs(i){return i.symbol?.key??i.name}function rr(i){return i.symbol?.bounds[0]??G}function Bt(i,t){if(!t.size)return i;switch(i.tag){case"typevar":return t.get(hs(i))??i;case"array":return qt(Bt(i.element,t));case"library":return i.args.length?ft(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 Ln(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 Nn(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(rr(i)):G;case"wildcard":return G;case"array":return qt(q(i.element));case"library":return i.args.length?ft(i.symbol):i;case"class":return i.args?.length?X(i.symbol):i;default:return i}}function $n(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=Ln(i);return e.map(s=>Bt(s,n))}function ne(i,t){if(i.tag==="typevar"&&i.symbol){for(let e of i.symbol.bounds){let n=ne(e,t);if(n)return n}return null}if(i.tag!=="class")return null;if(i.symbol===t)return i;for(let e of $n(i)){let n=ne(e,t);if(n)return n}return null}function ze(i,t=new Set){if(t.has(i.symbol))return[];t.add(i.symbol);let e=[];for(let n of $n(i))n.tag==="library"?e.push(n):n.tag==="class"&&e.push(...ze(n,t));return e}function Ce(i,t,e){if(!t.typeParams?.length)return e;let n=ne(i,t);return n?n.args?.length?Bt(e,Ln(n)):q(e):e}function ft(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 qt(At(i.element,t,e));case"library":return i.args.length?ft(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 qt(Xt(i.element,t,e));case"library":return i.args.length?ft(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 ar(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 ar(i)){let n=_t(e,t);if(n)return n}return null}function Wt(i){let t={int:"Integer",long:"Long",double:"Double",char:"Character",boolean:"Boolean",float:"Float",byte:"Byte",short:"Short"}[i.tag],e=t?cn()?.classes.get(t):void 0;return e?ft(e):null}function yt(i){return i.tag!=="library"||!i.symbol.box?null:{int:U,long:Lt,double:lt,char:Se,boolean:dt,float:St,byte:On,short:dn}[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 Z(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 Ji={byte:0,short:1,char:1,int:2,long:3,float:4,double:5};function oo(i,t){return!Ot(i)||!Ot(t)||i.tag==="char"||t.tag==="char"&&i.tag==="short"?!1:Ji[t.tag]<Ji[i.tag]}function un(i,t){return i===t||i.superclass&&un(i.superclass,t)?!0:i.interfaces.some(e=>un(e,t))}function hn(i,t=new Set){if(t.has(i))return[];t.add(i);let e=[...i.libraryInterfaces];i.superclass&&e.push(...hn(i.superclass,t));for(let n of i.interfaces)e.push(...hn(n,t));return e}var Mn={tag:"typevar",name:"?open"};function sr(i,t){let e=t.args??[];return!i.args?.length&&e.length?!1:(i.args??[]).every((n,s)=>{let r=e[s];if(n===Mn||!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 Z(t);if(t.tag==="object")return Z(i);if(i.tag==="array"&&t.tag==="array")return Z(i.element)&&Z(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=ne(i,t.symbol);return s?t.args?.length?(s.args?.length??0)>0&&sr(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 ze(i).some(s=>{let r=_t(s,t.symbol);return r!==null&&sr(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(ft(i.symbol,i.symbol.typeParams.map(()=>G)),t.symbol)!==null;let n=_t(i,t.symbol);return n?sr(n,t):!1}function lo(i){return i.box!==void 0||i.name==="StringBuilder"||i.name==="Scanner"}function Di(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&&lo(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(rr(i),t);if(t.tag==="typevar"&&t.symbol)return Te(i,rr(t));if(i.tag==="array"&&t.tag==="array")return Z(i.element)&&Z(t.element)?Te(i.element,t.element):rt(i.element,t.element);let e=Di(i),n=Di(t);return!e||!n?!1:e.interface&&n.interface?!0:e.interface?!n.final:n.interface?!e.final:!1}function Ge(i,t){return i.tag==="error"||t.tag==="error"?!0:t.tag==="lambda"?_i(i,t)===null:rt(i,t)||oo(i,t)?!0:Z(i)&&H(t,i)}function ve(i,t){if(Ge(i,t))return!0;if(Y(t)&&Z(i)){if(i.tag==="object")return!0;let n=Wt(t);return n!==null&&H(n,i)}let e=yt(t);return e!==null&&Y(i)&&Ge(i,e)}var co={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?co[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 uo(i){if(i.tag==="class"&&i.symbol.isInterface&&!i.symbol.isSealed){let n=ds(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 ji(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 ji(i.element)+"[]";default:return i.tag}}function ds(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(ji).join(",")})`;t.has(o)||(t.add(o),a.isAbstract&&e.push(a))}n.push(...r.interfaces)}return e}function _i(i,t){if(i.tag==="error")return null;let e=uo(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"?_i(i,t)??"":Ot(i)&&Ot(t)?`possible lossy conversion from ${P(t)} to ${P(i)}`:`${P(t)} cannot be converted to ${P(i)}`}function Pn(i){switch(i.kind){case"int":case"byte":case"short":case"long":return String(i.value);case"double":return oe(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 Rn(i){return{kind:"char",value:i&65535}}function Nt(i){return{kind:"long",value:BigInt.asIntN(64,i)}}function fs(i){return{kind:"byte",value:i<<24>>24}}function ms(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 or(i){return{kind:"string",value:i}}var lr=new Set(["int","byte","short","char"]);function fn(i){return lr.has(i.kind)?i.value:void 0}function mn(i){if(i.kind==="long")return i.value;if(lr.has(i.kind))return BigInt(i.value)}function Jn(i){if(i.kind==="double"||i.kind==="float")return i.value;if(i.kind==="long")return ls(vt(i.value));if(lr.has(i.kind))return i.value}function ps(i){if(i.kind==="long")return an(vt(i.value));let t=Jn(i);return t===void 0?void 0:Math.fround(t)}function Ui(i,t){if(i.kind==="boolean"||i.kind==="string")return;let e=()=>i.kind==="double"||i.kind==="float"?In(i.value):i.kind==="long"?os(vt(i.value)):i.value;switch(t){case"double":return Qt(Jn(i));case"float":return ue(ps(i));case"long":return i.kind==="double"||i.kind==="float"?Nt(BigInt(An(i.value))):Nt(mn(i));case"int":return Q(e());case"byte":return fs(e());case"short":return ms(e());case"char":return Rn(e())}}function Dn(i){return i!==void 0&&i.kind==="boolean"&&i.value}function ys(i){return i!==void 0&&i.kind==="boolean"&&!i.value}var se=["none","message","message-cause","cause"],Vt=["none","message"],ho=[["java.lang.Throwable",null,se],["java.lang.Exception","java.lang.Throwable",se],["java.lang.Error","java.lang.Throwable",se],["java.lang.RuntimeException","java.lang.Exception",se],["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",se],["java.lang.IllegalStateException","java.lang.RuntimeException",se],["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",se],["java.lang.CloneNotSupportedException","java.lang.Exception",Vt],["java.lang.InterruptedException","java.lang.Exception",Vt],["java.lang.ReflectiveOperationException","java.lang.Exception",se],["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",se],["java.lang.StackOverflowError","java.lang.VirtualMachineError",Vt],["java.lang.OutOfMemoryError","java.lang.VirtualMachineError",Vt],["java.util.NoSuchElementException","java.lang.RuntimeException",se],["java.util.InputMismatchException","java.util.NoSuchElementException",Vt],["java.util.ConcurrentModificationException","java.lang.RuntimeException",se],["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",se],["java.io.FileNotFoundException","java.io.IOException",Vt],["java.io.EOFException","java.io.IOException",Vt],["java.io.UncheckedIOException","java.lang.RuntimeException",["message-cause","cause"]]],pn=ho.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},Bi=5;function Vi(i){let t=i.lastIndexOf(".");return{pkg:i.slice(0,t),simple:i.slice(t+1)}}var Fn=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"]),fo=new Set(["printf","format","flush","write","append","close","checkError","writeBytes","charset"]),Hi=new Set(["currentTimeMillis","nanoTime","exit","arraycopy","getProperty","getProperties","setProperty","clearProperty","lineSeparator","identityHashCode","getenv","gc","setOut","setErr","setIn","console","inheritedChannel","getLogger","load","loadLibrary","mapLibraryName","runFinalization"]),mo=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"]),po=new Set(["name","ordinal","compareTo","equals","hashCode","getDeclaringClass"]),yo=new Set(["clone","getClass","hashCode","equals","toString","wait","notify","notifyAll"]),gs={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(Ys)},MIN_VALUE:{type:Lt,constant:Nt(Qs)},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:On,constant:fs(127)},MIN_VALUE:{type:On,constant:fs(-128)},SIZE:{type:U,constant:Q(8)},BYTES:{type:U,constant:Q(1)}},Short:{MAX_VALUE:{type:dn,constant:ms(32767)},MIN_VALUE:{type:dn,constant:ms(-32768)},SIZE:{type:U,constant:Q(16)},BYTES:{type:U,constant:Q(2)}},Character:{MAX_VALUE:{type:Se,constant:Rn(65535)},MIN_VALUE:{type:Se,constant:Rn(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)}}},jn={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"}]},Gi=i=>i.target?.kind==="Name"&&i.target.staticOwner===!0,_n=i=>i.tag==="int"||i.tag==="char"||i.tag==="long"||i.tag==="byte"||i.tag==="short",zi=i=>i.tag==="char"||i.tag==="byte"||i.tag==="short"?U:i;function Gn(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 bs=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"]),ra=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"]),cr={"java.util":[...ra].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"]},Ki={private:0,package:1,protected:2,public:3},go={Comparable:["compareTo"],Comparator:["compare"],Iterable:["iterator"],Iterator:["hasNext","next"]},bo=new Set(["Comparable","Comparator","Iterable","Iterator"]);function qi(i){return bo.has(i.name)||i.functional!==void 0}var Ts=new Set(["getClass","wait","notify","notifyAll","clone","finalize"]),Wi=[dt,Se,U,Lt,St,lt,qt(Se),ct,G];function To(i){return(i==="println"?[[],...Wi.map(e=>[e])]:Wi.map(e=>[e])).map(e=>({owner:"PrintStream",name:i,params:e,returnType:Tt}))}var Un={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:dt},isEmpty:{owner:"String",name:"isEmpty",params:[],returnType:dt},toCharArray:{owner:"String",name:"toCharArray",params:[],returnType:qt(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:dt,objectMethod:"equals"}},ur=()=>({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 So(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 yn(i,t){return i.all||i.vars.has(t)}function Bn(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 xo(i,t){if(i.all)return i;let e=Pe(i);return e.vars.delete(t),e}function Xi(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),Kn=class extends Error{fileName;constructor(t){super(`needs ${t}`),this.fileName=t}},qe=class extends Error{};function ia(i,t,e={}){return new fr(i[0].file,t,e.available??new Set).checkUnits(i,e.launch??!0)}var Yi=(i,t,e)=>({file:i,launch:t,compact:e,imported:new Set,onDemand:new Set,staticSingle:new Map,staticOnDemand:[],unsupportedStaticSingle:new Map,unsupportedStaticOnDemand:[],unsupportedImports:new Map}),fr=class{#A;#dt=new WeakMap;#Lt;#M;#R=[];#ot=[];#r=[];get#h(){return this.#A.file}get#s(){return this.#A.imported}get#n(){return this.#A.onDemand}get#m(){return this.#A.staticSingle}get#u(){return this.#A.staticOnDemand}get#i(){return this.#A.unsupportedStaticSingle}get#j(){return this.#A.unsupportedStaticOnDemand}get#N(){return this.#A.unsupportedImports}#d=[];#b=new Map;#et=new Map;#I=[];#K=!1;#_=0;#ft=!1;#lt=null;#st;#g=[];#ee=new Map;#yt;get#a(){return this.#yt}set#a(t){this.#yt=t;let e=t?this.#dt.get(t.topLevel):void 0;e&&(this.#A=e)}#o=null;#U=null;#Y=null;#Nt=new Map;#V=!0;#L=[];#k=0;#$=[];#Ht=!1;#P=!1;#t=null;#y="";#f=new Map;#p=[];#C=[];#T=[];#Gt=new Map;#Et=[];#J=new Set;#rt=new WeakMap;#St=[];#$t=new Map;#Mt=new Map;#O=[];#z=[];#v=new Map;#D=new Map;#q=0;#W=[];constructor(t,e,n){this.#A=Yi(t,!0,!1),this.#Lt=n,this.#M=e}#e(t,e,n,s){this.#M.error(this.#h,t,"type",e,n,s)}#Q(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.#st)||this.#g.some(r)||this.#M.warning(this.#h,t,e,`[${e}] ${n}`,s)}#bt(t,e){let n=this.#ee.get(t);if(n)return n;let s=new Set;this.#ee.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.#ue(o.name):o.names.join(".")===`java.lang.${o.name}`))){o.names.length===1&&!this.#ue(o.name)&&!Fn.has(o.name)&&!this.#N.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}#At(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`)}checkUnits(t,e=!0){if(!t[0].unit.types.length)return this.#M.launchError(this.#h.name,v.noMain,"no class declared in source file"),null;let s=this.#A,r=[];t.forEach(({unit:c,file:u},m)=>{let h=c.types[0]?.implicit===!0,f=m===0?s:Yi(u,!1,h);f.compact=h,this.#A=f,m>0&&h&&r.push({declaration:c.types[0],file:u});for(let C of c.imports)this.#Te(C);if(h)for(let C of Object.keys(cr))this.#gt(C);let p=this.#ot.length;for(let C of c.types)this.#It(C,null);for(let C of this.#ot.slice(p))C.file=u,this.#dt.set(C,f);if(m>0&&!h){let C=u.name.replace(/\\.java$/,"");if(!this.#ot.slice(p).some(T=>T.name===C))throw new qe(`${u.name} does not declare class ${C}, so the launcher cannot find that class there`)}}),this.#A=s,this.#qt();for(let c of this.#R)!c.typeParams||c.local||(this.#a=c,this.#K=!1,this.#cn(c.typeParams,c.declaration.typeParams));let a=c=>c.anonymous===!0||c.local===!0||c.outer!==null&&a(c.outer);for(let c of this.#R)a(c)||this.#oe(c);this.#$e(this.#R.filter(c=>!a(c)));for(let c of this.#R)a(c)||this.#Pe(c);this.#Ve();let o=this.#ot[0];for(let{declaration:c,file:u}of r){let m=c.symbol;if(this.#a=m,!this.#Pt(m))return this.#e(c.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;throw new qe(`${u.name} is a compact source file; only the launched file may be one`)}if(o&&(this.#a=o),o?.declaration.implicit&&!this.#Pt(o))return this.#e(o.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 c of this.#ot)this.#Re(c),this.#M.hasErrors||this.#Lr(c);return this.#M.hasErrors||!o?null:e?this.#Ie(o):{classes:this.#R,mainClass:o,methods:this.#r,staticFields:this.#d,selectors:this.#et,main:null,mainConstructor:null}}#Ie(t){let e=this.#h.name.replace(/^.*[\\\\/]/,"").replace(/\\.java$/,""),n=this.#Pt(t)?t:this.#ot.find(a=>a.name===e&&a.file===t.file);if(!n)return this.#M.launchError(this.#h.name,v.noMain,`can\'t find class: ${e}`),null;let s=this.#Pt(n);if(!s)return this.#M.launchError(this.#h.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.#M.launchError(this.#h.name,v.noMain,`can\'t find no argument constructor in class: ${n.name}`),null):{classes:this.#R,mainClass:n,methods:this.#r,staticFields:this.#d,selectors:this.#et,main:s,mainConstructor:r}}#Pt(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.#zt(e.element)}#zt(t){if(t.kind!=="ClassType"||t.hasTypeArguments)return!1;let e=t.names.join(".");return e==="String"||e==="java.lang.String"}#Te(t){if(t.isStatic)return this.#ct(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.#s.add(o);if(t.onDemand||jt[s]===r)return}if(!bs.has(n)){this.#e(t.lastDotPos,v.cantResolve,`package ${n} does not exist`);return}if(t.onDemand){this.#n.add(n),this.#gt(n);return}if(Pt[s]===n&&!jt[s]||pn.some(o=>o.name===`${n}.${s}`)){this.#s.add(s);return}if(n==="java.util"&&!ra.has(s)){this.#e(t.lastDotPos,v.cantResolve,"cannot find symbol",[` symbol: class ${s}`,` location: package ${n}`]);return}this.#N.set(s,`${n}.${s}`)}#ct(t){let e=t.names,n=t.onDemand?e:e.slice(0,-1),s=this.#Se(t,n);if(typeof s=="object"&&s!==null){t.onDemand?this.#j.push(s.unsupported):this.#i.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.#u.includes(s)||this.#u.push(s);for(let[o,c]of Object.entries(jt))c===s&&this.#s.add(o);return}let r=e[e.length-1],a=jt[r]===s;if(a&&this.#s.add(r),this.#mt(s,r)||this.#w(s,r)){let o=this.#m.get(r)??[];o.includes(s)||o.push(s),this.#m.set(r,o)}else if(!a){let o=this.#xt(s)?.isInterface?"interface":"class";this.#e(t.start,v.cantResolve,"cannot find symbol",[` symbol: static ${r}`,` location: ${o} ${s}`])}}#Se(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:bs.has(s)&&((s==="java.lang"?Fn.has(n):(cr[s]??[]).includes(n))||pn.some(c=>c.name===`${s}.${n}`))?{unsupported:`${s}.${n}`}:(bs.has(s)||[...bs].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)}#xt(t){return t==="Math"||t==="String"||t==="System"?ee(t):le(t)??null}#mt(t,e){if(t==="Math"&&Object.hasOwn(jn,e))return!0;if(t==="System")return Hi.has(e);let n=this.#xt(t);return n?n.methods.some(s=>s.isStatic&&s.name===e)||t!=="String"&&n.unsupported.has(e):!1}#w(t,e){if(t==="System")return e==="out"||e==="err"||e==="in";if(Object.hasOwn(gs,t)&&Object.hasOwn(gs[t],e))return!0;if(t==="Math"||t==="String")return!1;let n=this.#xt(t)?.staticFields;return n!==void 0&&Object.hasOwn(n,e)}#B(t,e){let n=(this.#m.get(t)??[]).filter(s=>e.call(this,s,t));return n.length?n:this.#u.filter(s=>e.call(this,s,t))}#Rt(t,e){let n=this.#i.get(t)??this.#j[0];return n?(this.#l(e,`the class ${n}`,!0),!0):!1}#Jt(t){for(let e=this.#a;e;e=e.outer)if(this.#kt(e,t).length)return!0;return Object.hasOwn(Ee,t)||Ts.has(t)}#X(t,e){return{kind:"Name",identifier:t,depth:1,pos:e.pos,start:e.start,end:e.end,staticOwner:!0}}#Z(t,e){if(this.#Jt(t.name))return!0;let n=this.#B(t.name,this.#mt);if(n.length>1){let s=this.#Dt(t,n,e);if(!s)return!1;n=[s]}return n.length===1&&(t.target=this.#X(n[0],{pos:t.selectPos,start:t.start,end:t.start})),!0}#Dt(t,e,n){let s=e.flatMap(m=>this.#c(m,t.name).map(h=>({owner:m,...h}))),r=s.filter(m=>this.#ne(m,n,!0)),a=r.length?r:s.filter(m=>this.#ne(m,n,!1));if(!a.length)return e.find(m=>this.#c(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((f,p)=>Ge(q(h.params[p]),q(f))),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,f=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 ${f(m)} and ${f(h)} match`]),null}return this.#l(t.selectPos,`a call of ${t.name}(), which more than one static import could mean`,!0),null}#c(t,e){let n=[];if(t==="Math"&&Object.hasOwn(jn,e))for(let r of jn[e])n.push({params:r.params,varargs:!1});let s=t==="System"?null:this.#xt(t);for(let r of s?.methods??[])r.isStatic&&r.name===e&&n.push({params:r.params,varargs:r.varargs===!0});return n}#ne(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?Ge(q(u),o):ve(q(u),o)})}#Le(t){let e=this.#B(t.identifier,this.#w);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.#X(e[0],t),name:t.identifier,namePos:t.pos,depth:2,pos:t.pos,start:t.start,end:t.end}:null}#gt(t){for(let e of cr[t]??[])Pt[e]||pn.some(n=>n.name===`${t}.${e}`)||this.#N.has(e)||this.#N.set(e,`${t}.${e}`)}#nt(t){let e;if(t.length===1){e=t[0];let n=Pt[e];if(!n||!(jt[e]?this.#s.has(e):n==="java.lang"||this.#s.has(e)||this.#n.has(n)||this.#A.compact))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.#nt([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 le(e)??null}#It(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.#ot.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.#R.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.#ln(t.typeParams,`${c} ${o.displayName}`,o)}t.symbol=o,this.#R.push(o),e?(e.members.push(o),e.membersByName.set(o.name,o)):this.#ot.push(o);for(let c of t.members)c.kind==="ClassDeclaration"&&this.#It(c,o);this.#se(o)}#se(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.#Kt(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.#re(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.#Kt(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)}#re(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.#Kt(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.#ln(e.typeParams,`${r==="record"?"record":r==="interface"?"interface":"class"} ${e.name}`,a)),a}#Kt(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.#R.length,fields:[],fieldsByName:new Map,methods:[],methodsByName:new Map,constructors:[],members:[],membersByName:new Map,instanceCount:0,outerField:-1,anonymous:!0};e.symbol=a,this.#R.push(a);for(let o of e.members)o.kind==="ClassDeclaration"&&this.#It(o,a);return this.#se(a),a}#qt(){let t=(o,c)=>{let{pkg:u,simple:m}=Vi(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},f={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.#R.length,fields:[],fieldsByName:new Map,methods:[],methodsByName:new Map,constructors:[],members:[],membersByName:new Map,instanceCount:c?0:Bi,outerField:-1,membersEntered:!0,builtin:{pkg:u}};return f.topLevel=f,h.symbol=f,this.#R.push(f),this.#b.set(o,f),f};for(let o of pn){let c=t(o.name,!1);c.superclass=o.superclass?this.#b.get(o.superclass):null,o.indexPrefix&&(c.builtin.indexPrefix=o.indexPrefix)}let e=this.#b.get("java.lang.Throwable"),n=X(e);this.#H(e,"getMessage",[],ct,"throwable-getMessage"),this.#H(e,"getLocalizedMessage",[],ct,"throwable-getLocalizedMessage"),this.#H(e,"getCause",[],n,"throwable-getCause"),this.#H(e,"initCause",[n],n,"throwable-initCause"),this.#H(e,"toString",[],ct,"throwable-toString"),this.#H(e,"printStackTrace",[],Tt,"throwable-printStackTrace"),this.#H(e,"addSuppressed",[n],Tt,"throwable-addSuppressed",{isFinal:!0}),this.#H(e,"getSuppressed",[],qt(n),"throwable-getSuppressed",{isFinal:!0}),this.#H(e,"fillInStackTrace",[],n,"throwable-fillInStackTrace");let s={none:[],message:[ct],"message-cause":[ct,n],cause:[n],index:[U],object:[G]};for(let o of pn){let c=this.#b.get(o.name);for(let u of o.constructors){let m=this.#H(c,c.name,s[u],Tt,"throwable-constructor",{isConstructor:!0});m.throwableConstructor=u}}let r=t("java.lang.AutoCloseable",!0),a=this.#H(r,"close",[],Tt,void 0,{throws:[X(this.#b.get("java.lang.Exception"))]});a.isAbstract=!0,delete a.builtin}#ie(t){if(t.length>1)return this.#b.get(t.join("."))??null;for(let e of this.#b.values()){if(e.name!==t[0])continue;let n=e.builtin.pkg;return n==="java.lang"||this.#s.has(e.name)||this.#n.has(n)||this.#A.compact?e:null}return null}#Tt(){return X(this.#b.get("java.lang.Throwable"))}#ae(t){return t.tag==="null"||H(t,this.#Tt())}#Ne(t){return t.tag==="class"&&this.#ae(t)&&!H(t,X(this.#b.get("java.lang.RuntimeException")))&&!H(t,X(this.#b.get("java.lang.Error")))}#oe(t){if(t.hierarchyState!==0)return;t.hierarchyState=1;let e=this.#a;this.#a=t,this.#K=!1,this.#I=[];let n=t.declaration,s=t.isInterface?[]:n.extendsTypes.slice(0,1);for(let a of s){let o=this.#kn(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.#Wt(t).declaration.keywordPos,v.syntax,`cyclic inheritance involving ${this.#Wt(t).displayName}`);continue}if(this.#oe(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.#kn(a);if(!o)continue;if(o.tag==="library"){o.symbol.isInterface?qi(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.#Wt(t).declaration.keywordPos,v.syntax,`cyclic inheritance involving ${this.#Wt(t).displayName}`);continue}this.#oe(c),t.interfaces.includes(c)||(t.interfaces.push(c),(t.interfaceTypes??=[]).push(o))}this.#a=e,t.hierarchyState=2}#$e(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.#F(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")}}#Me(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`)}#Wt(t){return this.#R.filter(n=>n.hierarchyState===1).reduce((n,s)=>n.declaration.keywordPos<=s.declaration.keywordPos?n:s,t)}#kn(t){if(t.kind!=="ClassType")return this.#e(t.pos,v.syntax,"unexpected type"),null;let e=this.#F(t);return e.tag==="error"?null:e}#Pe(t){if(t.membersEntered)return;t.membersEntered=!0,t.superclass&&this.#Pe(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.#os(t)),t.isRecord&&this.#ls(t);for(let a of t.declaration.members)a.kind==="FieldDeclaration"?this.#hs(t,a):a.kind==="MethodDeclaration"&&this.#ds(t,a);t.isRecord?t.constructors.some(a=>this.#Cn(t,a))||this.#H(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.#fs(t),t.isEnum&&this.#cs(t),t.isRecord&&this.#us(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}#os(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.#d.length,order:t.fields.length,state:"done",declaration:o,declarator:a,enumConstant:{node:s,ordinal:r}};this.#d.push(c),s.field=c,t.fields.push(c),t.fieldsByName.set(c.name,c),t.enumConstants.push(c)})}#ls(t){for(let e of t.declaration.components??[]){let n=this.#F(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)}}#Cn(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)))}#H(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.#r.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.#r.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])))}#cs(t){let e=X(t);this.#Ut(t,"values",[])||this.#H(t,"values",[],qt(e),"enum-values",{isStatic:!0}),this.#Ut(t,"valueOf",[ct])||this.#H(t,"valueOf",[ct],e,"enum-valueOf",{isStatic:!0}),this.#Ut(t,"name",[])||this.#H(t,"name",[],ct,"enum-name",{isFinal:!0}),this.#Ut(t,"ordinal",[])||this.#H(t,"ordinal",[],U,"enum-ordinal",{isFinal:!0}),this.#Ut(t,"compareTo",[e])||this.#H(t,"compareTo",[e],U,"enum-compareTo",{isFinal:!0}),this.#Ut(t,"toString",[])||this.#H(t,"toString",[],ct,"enum-toString")}#us(t){t.components.forEach((e,n)=>{(t.methodsByName.get(e.name)??[]).find(r=>r.params.length===0)||this.#H(t,e.name,[],e.type,"record-accessor",{component:n})}),this.#Ut(t,"toString",[])||this.#H(t,"toString",[],ct,"record-toString"),this.#Ut(t,"hashCode",[])||this.#H(t,"hashCode",[],U,"record-hashCode"),this.#Ut(t,"equals",[G])||this.#H(t,"equals",[G],dt,"record-equals")}#Ve(t=this.#r){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.#et.get(n);s===void 0&&this.#et.set(n,s=this.#et.size),e.selector=s}}#hs(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.#ue("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.#I;this.#K=a,t.anonymous||(this.#I=[]);let u=this.#F(e.type);this.#K=!1,this.#I=c;for(let m of e.declarators){let h=u;for(let p=0;p<m.extraDims&&h.tag!=="error";p++)h=qt(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 f={kind:"field",name:m.name,type:h,owner:t,isStatic:a,isFinal:o,isPrivate:n.includes("private"),index:a?this.#d.length:t.instanceCount++,order:t.fields.length,state:"pending",declaration:e,declarator:m,...s.size?{suppressed:s}:{}};a&&this.#d.push(f),m.field=f,t.fields.push(f),t.fieldsByName.set(f.name,f)}}#ds(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.#I;this.#K=Gt(e.modifiers,"static");let a=e.typeParams?.length?this.#ln(e.typeParams,"",null):void 0;a&&this.#cn(a,e.typeParams),this.#I=a?[...r,a]:r;let o=e.params.map(I=>this.#F(I.type)),c=e.returnType.kind==="VoidType"?Tt:this.#F(e.returnType),u=[],m=!0;for(let I of e.throwsTypes??[]){let L=this.#F(I);if(L.tag==="error"){m=!1;break}if(!this.#ae(L)){this.#G(I,L,this.#Tt()),m=!1;break}u.push(L)}if(this.#I=r,this.#K=!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 f=h.find(I=>he(I.name,I.params)===he(e.name,o));if(f){let I=(L,$)=>`${L}(${$.map(P).join(",")})`;this.#e(e.namePos,v.alreadyDefined,`name clash: ${I(e.name,o)} and ${I(f.name,f.params)} have the same erasure`,$t([...o,...f.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 T=p("private")?"private":p("public")||t.isInterface?"public":p("protected")?"protected":"package",w={kind:"method",name:e.name,owner:t,isStatic:p("static"),isConstructor:n,isPrivate:p("private"),isAbstract:C,isFinal:p("final"),access:T,params:o,returnType:c,index:this.#r.length,...a?{typeParams:a}:{},declaration:e,locals:[],maxSlots:0,throws:u,...s.size?{suppressed:s}:{}},x=this.#At(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&&!w.isStatic&&!w.isFinal&&!w.isPrivate){let I=a?`<${a.map(L=>L.name).join(",")}>`:"";this.#e(e.namePos,v.syntax,`Invalid SafeVarargs annotation. Instance method ${I}${this.#Ft(w)} is neither final nor private.`,$t(o))}e.symbol=w,this.#r.push(w),n?t.constructors.push(w):(t.methods.push(w),t.methodsByName.set(e.name,[...h,w]));let k=t.isRecord&&!n&&!w.isStatic&&o.length===0?t.components.find(I=>I.name===e.name):void 0;k&&(rt(c,k.type)?T!=="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})`]))}#fs(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.#r.length,declaration:n,locals:[],maxSlots:0,throws:[]};n.symbol=s,this.#r.push(s),t.constructors.push(s)}#Ft(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(",")})`}#le(){return{method:this.#o,field:this.#U,isStatic:this.#V,scopes:this.#L,nextSlot:this.#k,jumps:this.#$,typeScopes:this.#I,typeStatic:this.#K,memberSuppressed:this.#st,localSuppressed:this.#g}}#ce(t){this.#o=t.method,this.#U=t.field,this.#V=t.isStatic,this.#L=t.scopes,this.#k=t.nextSlot,this.#$=t.jumps,this.#I=t.typeScopes,this.#K=t.typeStatic,this.#st=t.memberSuppressed,this.#g=t.localSuppressed}#Re(t){this.#a=t;let e=this.#bt(t.declaration.modifiers,"type");e.size&&(t.suppressed=e);let n=this.#At(t.declaration.modifiers,"FunctionalInterface");if(n){let s=t.isInterface?ds(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.#Ss(t),t.isEnum&&this.#ys(t);for(let s of t.declaration.members)if(this.#a=t,s.kind==="FieldDeclaration")for(let r of s.declarators)r.field&&this.#On(r.field);else s.kind==="MethodDeclaration"?s.symbol&&this.#gs(s.symbol):s.kind==="Initializer"?this.#ms(t,s):s.symbol&&this.#Re(s.symbol);this.#a=t,this.#xs(t)}#ms(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.#le(),o=this.#Y,c=t.fields.find(u=>!u.enumConstant&&!u.capturedLocal&&u.declarator.pos>e.start);this.#Y={owner:t,isStatic:e.isStatic,order:c?c.order:t.fields.length},this.#a=t,this.#o=r,this.#U=null,this.#V=e.isStatic,this.#K=e.isStatic,this.#I=[],this.#st=void 0,this.#g=[],this.#L=[],this.#k=e.isStatic?0:1,r.maxSlots=this.#k,this.#$=[],this.#vt();for(let u of e.body.statements)this.#Yt(u);this.#wt(),this.#ce(a),this.#Y=o,this.#a=t}#ps(t,e,n){t.superclass=e,t.superType=X(e),t.hierarchyState=2;let s=this.#le(),r=this.#t,a=this.#P;this.#Pe(t);let o=this.#Vn(t,n);return this.#Ve([...t.methods,...t.constructors]),this.#$t.set(t,{scopes:[]}),this.#t=null,this.#P=!1,this.#Re(t),this.#ce(s),this.#t=r,this.#P=a,this.#a=e,o}#ys(t){for(let e of t.enumConstants){let n=e.enumConstant.node,s=this.#le();this.#o=null,this.#U=e,this.#V=!0,this.#L=[{names:new Map,nextSlot:0}],this.#k=0,this.#$=[];let r=this.#Qt(n.args);if(!r.some(a=>a.tag==="error")){let a=this.#at({pos:n.pos,name:t.name},this.#Ue(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.#me(n.args,a.params),n.ctor=n.body?.symbol?this.#ps(n.body.symbol,t,a):a.method;let o=this.#ke(a,n.pos);o&&(n.varargs=o)}this.#_e(n.args)}this.#ce(s),this.#a=t}}#gs(t){if(t.builtin)return;this.#a=t.owner,this.#o=t,this.#U=null,this.#V=t.isStatic,this.#K=t.isStatic,this.#I=t.typeParams?[t.typeParams]:[],this.#st=t.suppressed,this.#g=[],this.#L=[];let e=t.isConstructor&&t.owner.isInner?1:t.isConstructor&&t.owner.isEnum?2:0;this.#k=(t.isStatic?0:1)+e,t.maxSlots=this.#k,this.#$=[],this.#bs(t);let n=t.declaration.params[t.declaration.params.length-1];if(n?.varargs&&!Sn(t.params[t.params.length-1])&&!this.#At(t.declaration.modifiers,"SafeVarargs")){let r=t.params[t.params.length-1].element;this.#Q(n.pos,"unchecked",`Possible heap pollution from parameterized vararg type ${P(r)}`,$t([r]))}if(t.isAbstract){this.#o=null;return}this.#vt(),t.declaration.params.forEach((r,a)=>{this.#bt(r.modifiers,"parameter");let o=this.#jt(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.#Cn(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.#En(t),s.forEach((r,a)=>{r.kind==="ConstructorCall"?this.#In(r,a===0):this.#Yt(r)}),this.#wt(),this.#o=null}#En(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.#Ue(e,t.owner.superType),[],"constructor");if(!s||!this.#fe(s.method,n,`${e.name}()`))return;t.superConstructor=s.method;let r=this.#ke(s,n);r&&(t.superVarargs=r)}#bs(t){let e=t.declaration,n=this.#At(e.modifiers,"Override");if(t.isConstructor)return;let s=t.isPrivate?[]:this.#Ts(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.#Ft(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(Ki[t.access]<Ki[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.#Ne(h)&&!(r.throws??[]).some(f=>H(h,f)));if(m){this.#e(e.namePos,v.syntax,o,[` overridden method does not throw ${P(m)}`]);return}}}#Ts(t){let e=[],n=he(t.name,t.params);for(let s of this.#An(t.owner))s.name===t.name&&he(s.name,s.params)===n&&e.push(s);return e}#An(t){let e=[],n=new Set,s=(h,f)=>{for(let p of h.methods){if(p.isPrivate||p.lambda||p.isStatic&&h.isInterface||h.isEnum&&p.builtin&&po.has(p.name))continue;let C=w=>p.isStatic?w:Ce(f,h,w),T=p.params.map(C);e.push({name:p.name,params:T,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.#Ft(p),fromInterface:h.isInterface,interfaceSymbol:h.isInterface?h:void 0,throws:p.throws,method:p})}},r=ce(t),a=h=>$n(h).filter(f=>f.tag==="class"&&f.symbol.isInterface),o=h=>{if(!n.has(h.symbol)){n.add(h.symbol),s(h.symbol,h);for(let f of a(h))o(f)}},c=[r];for(let h=t.superclass;h;h=h.superclass)c.push(ne(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 ze(r))for(let f of go[h.symbol.name]??(h.symbol.functional?[h.symbol.functional]:[])){let p=h.symbol.methods.find(T=>T.name===f),C=p.params.map(T=>At(T,h.symbol.typeParams,h.args));e.push({name:f,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:`${f}(${C.map(P).join(",")})`,fromInterface:!0})}let m=t.isEnum?t:t.enumBody?t.superclass:null;if(m){let h=X(m),f=(p,C,T)=>({name:p,params:C,returnType:T,isStatic:!1,isFinal:!0,isAbstract:!1,isDefault:!1,access:"public",ownerName:"Enum",signature:`${p}(${C.map(P).join(",")})`,fromInterface:!1});e.push(f("name",[],ct),f("ordinal",[],U),f("compareTo",[h],U),f("equals",[G],dt),f("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}#Ss(t){if(t.isInterface)return;for(let c of t.constructors)c.declaration.synthetic&&!c.forwardsToSuper&&this.#En(c);let e=new Set,n=new Map,s=ce(t);for(let c=t;c;c=c.superclass){let u=ne(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(f=>Ce(u,c,f)));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.#An(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(([f])=>f===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.#Ft(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&&(un(m.interfaceSymbol,h.interfaceSymbol)||un(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}}}#In(t,e){let n=this.#o;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.#Qt(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.#mn(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.#Ue(r,a),s,"constructor");if(!o||!this.#fe(o.method,t.thisPos,`${r.name}(${o.params.map(P).join(",")})`))return;this.#P=!0,this.#me(t.args,o.params),this.#_e(t.args),this.#P=!1,t.target=o.method;let c=this.#ke(o,t.thisPos);c&&(t.varargs=c)}#xs(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)}}#On(t){if(t.state!=="pending")return;t.state="attributing";let e=this.#le(),n=this.#a;this.#a=t.owner,this.#o=null,this.#U=t,this.#V=t.isStatic,this.#K=t.isStatic,this.#I=[],this.#st=t.suppressed,this.#g=[],this.#L=[{names:new Map,nextSlot:0}],this.#k=0,this.#$=[];let s=t.declarator.init;if(s)if(s.kind==="ArrayInitializer")this.#ve(s,t.type);else{let r=this.#E(s,t.type);this.#ze(t.type,r,s)?t.isFinal&&s.constant&&(Y(t.type)||t.type.tag==="string")&&(t.constant=Tn(s.constant,t.type)):this.#G(s,r,t.type)}this.#ce(e),this.#a=n,t.state="done"}#vt(){this.#L.push({names:new Map,nextSlot:this.#k})}#wt(){let t=this.#L.pop();this.#k=t.nextSlot}#pt(t){for(let e=this.#L.length-1;e>=0;e--){let n=this.#L[e].names.get(t);if(n)return n}}#jt(t,e,n,s,r=!1){let a=this.#o,o=this.#pt(t)||r?null:this.#bn(t),c=o?.method??a;!r&&(this.#pt(t)||o&&c)&&this.#e(n,v.alreadyDefined,`variable ${t} is already defined in ${c.isConstructor?"constructor":"method"} ${this.#Ft(c)}`);let u={kind:"local",name:t,type:e,index:a.locals.length,slot:this.#k,isFinal:s,declPos:n};return this.#k+=Me(e),a.maxSlots=Math.max(a.maxSlots,this.#k),a.locals.push(u),this.#L[this.#L.length-1].names.set(t,u),u}#Xt(t){let e=0;for(let n=this.#a;n;n=n.outer,e++){let s=this.#Je(n,t);if(s&&!(n.enumBody&&s.isPrivate&&s.owner!==n))return{field:s,hops:e};let r=n.anonymous||n.local?this.#Zs(n,t):null;if(r)return{field:r,hops:e}}return null}#Je(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.#Je(t.superclass,e,n);if(r)return r}for(let r of t.interfaces){let a=this.#Je(r,e,n);if(a)return a}return null}#kt(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(f=>Ce(a,c,f)));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}#He(t){let e=this.#a;for(let n=0;n<t;n++,e=e.outer)if(!e?.isInner)return!1;return!0}#vs(t){let e=this.#a;for(let n=0;n<t&&e;n++)e=e.outer;return e}#ws(t,e){for(let n=e;n;n=n.outer)if(n===t)return!0;return!1}#ks(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}#ue(t){let e=r=>{for(let a=r.length-1;a>=0;a--){let o=r[a].classes?.get(t);if(o)return o}return null},n=e(this.#L);if(n)return n;for(let r=this.#t;r;r=r.outer){let a=e(r.scopes);if(a)return a}for(let r=this.#a;r;r=r.outer){let a=r.membersByName.get(t);if(a)return a;if(r.name===t&&!r.declaration.implicit)return r;let o=r.anonymous||r.local?this.#$t.get(r):void 0,c=o?e(o.scopes):null;if(c)return c}let s=this.#ot.find(r=>r.name===t&&!r.declaration.implicit);if(s){let r=this.#dt.get(s);if(r&&!r.launch&&r!==this.#A&&`${t}.java`!==r.file.name)throw new qe(`class ${t} is declared in ${r.file.name}, a file not named after it, and used from another file`);return s}if(this.#Lt.has(`${t}.java`))throw new Kn(`${t}.java`);return null}#De(t){this.#vt();for(let e of t.statements)this.#Yt(e);this.#wt()}#Yt(t){let e=this.#k,n=this.#Et.length;this.#Cs(t);let s=this.#Et.slice(n);if(t.kind==="LocalVariableDeclaration")for(let r of t.declarators)r.symbol&&s.push(r.symbol);this.#k=Math.max(e,...s.map(r=>r.slot+Me(r.type)))}#Cs(t){switch(t.kind){case"Block":this.#De(t);return;case"LocalVariableDeclaration":this.#Mn(t);return;case"ExpressionStatement":this.#E(t.expression);return;case"IfStatement":{this.#he(t.condition);let e=this.#it(t.condition,!0),n=this.#it(t.condition,!1);this.#Bt(e,()=>this.#in(t.then)),t.otherwise&&this.#Bt(n,()=>this.#in(t.otherwise)),n.length&&!this.#an(t.then)&&this.#je(n),e.length&&t.otherwise&&!this.#an(t.otherwise)&&this.#je(e);return}case"WhileStatement":this.#he(t.condition),this.#Bt(this.#it(t.condition,!0),()=>this.#Ge(t,t.body)),de(t.body,t)||this.#je(this.#it(t.condition,!1));return;case"DoStatement":this.#Ge(t,t.body),this.#he(t.condition),de(t.body,t)||this.#je(this.#it(t.condition,!1));return;case"ForStatement":this.#Ls(t);return;case"ForEachStatement":this.#Ns(t);return;case"LabeledStatement":this.#$s(t);return;case"SwitchStatement":this.#Ln(t,void 0);return;case"YieldStatement":this.#Rs(t);return;case"BreakStatement":t.liveSlots=this.#k,this.#Ms(t);return;case"ContinueStatement":t.liveSlots=this.#k,this.#Ps(t);return;case"ReturnStatement":if(this.#o?.initializer){this.#e(t.pos,v.syntax,"return outside method");return}t.liveSlots=this.#k+(t.value&&this.#o?Me(this.#o.returnType):0),this.#Ds(t);return;case"EmptyStatement":return;case"ConstructorCall":this.#In(t,!1);return;case"ThrowStatement":{let e=this.#tt(t.expression);e.tag!=="error"&&!this.#ae(e)&&this.#e(t.pos,v.incompatibleTypes,`incompatible types: ${$e(this.#Tt(),e)}`);return}case"TryStatement":this.#As(t);return;case"AssertStatement":this.#he(t.condition),t.message&&this.#tt(t.message);return;case"LocalClass":this.#Es(t.declaration);return}}#Es(t){let e=t.symbol;if(!e)return;let n=this.#L[this.#L.length-1];if(this.#L.some(h=>h.classes?.has(e.name))&&this.#o){this.#e(t.keywordPos,v.alreadyDefined,`class ${e.name} is already defined in ${this.#o.isConstructor?"constructor":"method"} ${this.#Ft(this.#o)}`);return}(n.classes??=new Map).set(e.name,e);let r=this.#le(),a=this.#a,o=this.#t,c=this.#y,u=this.#P;e.declaration.keyword==="class"&&this.#$t.set(e,{scopes:r.scopes});let m=[e,...yr(e,!0)];for(let h of m)h.typeParams&&(this.#a=h,this.#cn(h.typeParams,h.declaration.typeParams));for(let h of m)this.#oe(h);this.#Me(e);for(let h of m)this.#Pe(h);for(let h of m)this.#Ve([...h.methods,...h.constructors]);this.#t=null,this.#P=!1,this.#Re(e),this.#ce(r),this.#a=a,this.#t=o,this.#y=c,this.#P=u}#As(t){this.#vt();for(let n of t.resources)this.#Is(n);this.#De(t.block),this.#wt();let e=[];for(let n of t.catches){let s=[];for(let o of n.types){let c=this.#F(o);if(c.tag==="error")continue;if(!this.#ae(c)){this.#G(o,c,this.#Tt());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.#vt();let r=s.length===1?s[0]:s.length?this.#Os(s):E,a=this.#jt(n.name,r,n.namePos,n.isFinal||n.types.length>1);n.types.length>1&&(a.multiCatch=!0),n.symbol=a,this.#De(n.block),this.#wt()}if(t.finallyBlock){let n=this.#o,s=n.maxSlots,r=this.#k,a=n.locals.length;this.#De(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}}#Is(t){if(t.kind==="variable"){let r=this.#E(t.expression),a=ht(t.expression);a.kind==="Name"&&a.symbol?.kind==="local"&&(t.symbol=a.symbol),r.tag!=="error"&&!this.#sn(r)?this.#rn(t.expression,r):t.closeMethod=this.#nn(r);return}if(t.type.kind==="VarType"){let r=this.#E(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.#jt(t.name,a,t.namePos,!0),a.tag==="error")return;this.#sn(a)?t.closeMethod=this.#nn(a):this.#rn(t.init,a);return}let e=this.#F(t.type),n=this.#jt(t.name,e,t.namePos,!0);t.symbol=n;let s=this.#E(t.init,e);if(!(e.tag==="error"||s.tag==="error")){if(!Yt(e,s,t.init.constant)){this.#G(t.init,s,e);return}this.#sn(e)?t.closeMethod=this.#nn(e):this.#rn(t.type,e)}}#nn(t){if(t.tag==="class")return this.#kt(t.symbol,"close").find(e=>e.params.length===0)}#sn(t){return t.tag==="library"?t.symbol.closeable===!0:H(t,X(this.#b.get("java.lang.AutoCloseable")))}#rn(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)`])}#Os(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.#Tt()}#in(t){this.#vt(),this.#Yt(t),this.#wt()}#Ls(t){if(this.#vt(),t.init&&!Array.isArray(t.init))this.#Mn(t.init);else for(let s of t.init??[])this.#E(s);t.condition&&this.#he(t.condition);let e=t.condition?this.#it(t.condition,!0):[];this.#Bt(e,()=>{for(let s of t.update)this.#E(s);this.#Ge(t,t.body)});let n=t.condition?this.#it(t.condition,!1):[];this.#wt(),de(t.body,t)||this.#je(n)}#an(t){let e=[this.#O,this.#z,this.#v,this.#q,this.#W,this.#D];this.#O=[],this.#z=[],this.#v=new Map,this.#q=0,this.#W=[],this.#D=new Map;let n=this.#Ct(t,Ht(),!0).completes;return[this.#O,this.#z,this.#v,this.#q,this.#W,this.#D]=e,n}#Ge(t,e){this.#$.push({kind:"loop",node:t}),this.#in(e),this.#$.pop()}#Ns(t){let e=this.#E(t.iterable);this.#vt();let n=E,s=c=>c.tag==="library"?[c]:c.tag==="diamond"?[this.#pn(c)]:c.tag==="class"?ze(c):c.tag==="typevar"&&c.symbol?c.symbol.bounds.flatMap(s):[],r=s(e).map(c=>_t(c,le("Iterable"))).find(c=>c!==null)??null;e.tag==="array"?(n=e.element,t.hidden={array:this.#xe(e),length:this.#xe(U),index:this.#xe(U)}):r?(n=Ie(r.args[0]??G),t.element=n,t.iterator=this.#xe(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.#F(t.type),o=this.#jt(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.#G(t.iterable,n,a),this.#Ge(t,t.body),this.#wt()}#$s(t){this.#$.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.#$.push({kind:"label",node:t,label:t.label,loop:n?e:void 0}),this.#Yt(e),this.#$.pop()}#Ms(t){for(let e=this.#$.length-1;e>=0;e--){let n=this.#$[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")}#Ps(t){for(let e=this.#$.length-1;e>=0;e--){let n=this.#$[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")}#Rs(t){let e=[...this.#$].reverse().find(s=>s.kind==="switch-expression");if(!e){this.#e(t.pos,v.syntax,"yield outside of switch expression"),this.#E(t.value);return}t.target=e.node;let n=this.#tt(t.value,e.target);e.results.push({expression:t.value,type:n})}#xe(t){let e=this.#o;if(!e)throw new Error("checker: hidden local outside a method");let n={kind:"local",name:"",type:t,index:e.locals.length,slot:this.#k,isFinal:!1,declPos:-1};return this.#k+=Me(t),e.maxSlots=Math.max(e.maxSlots,this.#k),e.locals.push(n),n}#Ln(t,e){let n=t.kind==="SwitchExpression",s=this.#E(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&&Z(s)))return this.#Js(t,s,e);r&&!a&&!["int","byte","short","char","string"].includes(s.tag)&&(r=!1,yt(s)?this.#l(t.selectorPos,`switching on ${gn(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 ${gn(P(s))}`,!0)),this.#vt(),r&&s.tag==="string"&&(this.#o?t.hidden={copy:this.#xe(ct),index:this.#xe(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.#$.push(c);let u=new Set,m=0,h=!1,f=t.cases[0]?.arrow??!1;for(let p of t.cases){if(p.arrow!==f&&!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 T=this.#Nn(C,a);T!==null&&(u.has(`e:${T}`)&&this.#e(C.pos,v.syntax,"duplicate case label"),u.add(`e:${T}`),p.ordinals.push(T))}this.#on(p,n,c);continue}for(let C of p.labels){let T=this.#E(C,r?s:void 0);if(!r||T.tag==="error")continue;if(!C.constant){this.#e(C.pos,v.syntax,"constant expression required");continue}if(!Yt(s,T,C.constant)){this.#G(C,T,s);continue}let w=C.constant.kind==="string"?`s:${C.constant.value}`:`n:${fn(C.constant)}`;u.has(w)&&this.#e(p.pos,v.syntax,"duplicate case label"),u.add(w)}this.#on(p,n,c)}return this.#$.pop(),this.#wt(),a&&(t.coversAllConstants=a.enumConstants.every(p=>u.has(`e:${p.enumConstant.ordinal}`))),n?this.#$n(t,c.results,e):Tt}#Js(t,e,n){let s=t.kind==="SwitchExpression";t.patternSwitch=!0;let r=e.tag==="class"&&e.symbol.isEnum?e.symbol:null;this.#vt();let a=s?{kind:"switch-expression",node:t,results:[],target:n}:{kind:"switch",node:t};this.#$.push(a);let o=!1,c=0,u=!1,m=t.cases[0]?.arrow??!1,h=[],f=new Set,p=null,C=[],T=!1,w=yt(e);t.cases.forEach((k,I)=>{k.arrow!==m&&!o&&(o=!0,this.#e(k.pos,v.syntax,"different case kinds used in the switch")),k.isDefault&&++c>1&&this.#e(k.pos,v.syntax,"duplicate default label");let L=[];k.nullLabel&&Y(e)&&this.#G({pos:k.pos},ir,e);for(let $ of k.labels){if(r){let R=this.#Nn($,r);if(R===null)continue;f.has(`e:${R}`)&&this.#e($.pos,v.syntax,"duplicate case label"),f.add(`e:${R}`),(k.ordinals??=[]).push(R),C.push({constantOf:r,ordinal:R})}else{let R=this.#E($,w??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)){(k.enumFields??=[]).push(N),C.push({constantOf:R.symbol,ordinal:N.enumConstant.ordinal}),h.some(j=>H(R,j))&&this.#e($.pos,v.syntax,"this case label is dominated by a preceding case label");continue}if(!(e.tag==="string"?R.tag==="string":w!==null&&Y(R)&&$.constant!==void 0&&Yt(w,R,$.constant))){w&&$.constant?this.#G($,R,w):this.#l($.pos,`constant labels in a switch on ${gn(P(e))}`,!0);continue}if(!$.constant){this.#e($.pos,v.syntax,"constant expression required");continue}let J=$.constant.kind==="string"?`s:${$.constant.value}`:`n:${fn($.constant)}`;f.has(J)&&this.#e(k.pos,v.syntax,"duplicate case label"),f.add(J)}let O=r||w?e:ct;h.some(R=>H(O,R))&&this.#e($.pos,v.syntax,"this case label is dominated by a preceding case label")}if(k.pattern){let $=k.pattern;if(!this.#un($,e,!0,L))T=!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=k.guard!==void 0;$.kind==="TypePattern"&&!N&&(h.push(R),$.unconditional&&(p=k)),(!k.guard||Dn(k.guard.constant))&&C.push({pattern:$})}let O=t.cases[I-1];!k.arrow&&O&&!O.arrow&&O.statements.length&&L.length&&this.#an({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)"])}k.isDefault&&(u=!0,C.push({all:!0})),this.#Bt(L,()=>{let $=[];k.guard&&(this.#he(k.guard),ys(k.guard.constant)&&this.#e(k.guard.pos,v.syntax,"this case label has a guard that is a constant expression with value \'false\'"),$=this.#it(k.guard,!0)),this.#Bt($,()=>this.#on(k,s,a))})});let x=t.cases.find(k=>k.isDefault&&!k.nullLabel)??t.cases.find(k=>k.isDefault);return p&&x&&this.#e(x.pos,v.syntax,"switch has both an unconditional pattern and a default label"),this.#$.pop(),this.#wt(),t.exhaustive=Ao(e,C),!t.exhaustive&&!T&&this.#e(t.pos,v.syntax,`the switch ${s?"expression":"statement"} does not cover all possible input values`),s?this.#$n(t,a.results,n):Tt}#Nn(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.#E(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.#G(t,s,X(e)),null)}#on(t,e,n){if(!t.arrow){for(let r of t.statements)this.#Yt(r);return}let s=t.body;s.kind==="Block"?this.#De(s):e?n.results.push({expression:s,type:this.#tt(s,n.target)}):this.#E(s)}#$n(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")?dt:s.every(r=>Ot(r))?s.every(r=>rt(r,s[0]))?s[0]:s.reduce((r,a)=>Gn(r,a)):s.every(r=>Z(r))?s.reduce((r,a)=>sa(r,a)):(this.#l(t.pos,"switch expressions that need boxing"),E):E}#Ds(t){let e=this.#o.returnType;if(this.#o.lambda&&this.#o.returnType===Vn){if(!t.value)return;let s=this.#E(t.value);s.tag!=="error"&&(this.#o.returnType=Wt(s)??(s.tag==="null"?G:s));return}if(this.#o.lambda){let s=`incompatible types: bad return type in ${this.#o.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.#E(t.value),this.#e(t.value.pos,v.incompatibleTypes,"incompatible types: unexpected return value");return}let r=this.#E(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.#E(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.#ze(e,n,t.value)||this.#G(t.value,n,e)}#he(t){let e=this.#E(t);e.tag!=="error"&&(yt(e)??e).tag!=="boolean"&&this.#G(t,e,dt)}#Mn(t){let e=Gt(t.modifiers,"final"),n=this.#bt(t.modifiers,"local");if(this.#g=[...this.#g,n],this.#At(t.modifiers,"Deprecated"))for(let s of t.declarators)this.#Q(s.pos,"deprecation","@Deprecated annotation has no effect on this variable declaration");t.type.kind==="VarType"?this.#js(t,e):this.#Fs(t,e),this.#g=this.#g.slice(0,-1)}#Fs(t,e){let n=this.#F(t.type);for(let s of t.declarators){let r=n;for(let u=0;u<s.extraDims&&r.tag!=="error";u++)r=qt(r);let a=this.#jt(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.#ve(o,r);continue}let c=this.#E(o,r);this.#ze(r,c,o)?e&&o.constant&&(Y(r)||r.tag==="string")&&(a.constant=Tn(o.constant,r)):this.#G(o,c,r)}}#js(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(Mo(a,s.name))r("cannot use \'var\' on self-referencing variable");else{let m=this.#E(a);m.tag==="null"?r("variable initializer is \'null\'"):m.tag==="void"?r("variable initializer is \'void\'"):c=m.tag==="diamond"?this.#pn(m):m,c.tag==="class"&&c.args?.includes(Mn)&&(c=E)}let u=this.#jt(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=Tn(a.constant,c))}#ze(t,e,n){return q(t).tag==="object"&&delete ht(n).genericCast,Yt(t,e,n.constant)?!0:bn(t,e)?(this.#Q(n.pos,"unchecked","unchecked conversion",[` required: ${P(t)}`,` found: ${P(e)}`,...$t([t,e])]),!0):!1}#ve(t,e){if(e.tag==="error"){for(let n of t.elements)n.kind==="ArrayInitializer"?this.#ve(n,E):this.#E(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.#ve(n,e.element);continue}let s=this.#E(n,e.element);Yt(e.element,s,n.constant)||this.#G(n,s,e.element)}}#ln(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.#_++}`,bounds:[],declaredIn:e,pos:r.pos,ofClass:n})}return s}#cn(t,e){this.#I=[...this.#I,t.filter(s=>!s.ofClass)];let n=this.#ft;this.#ft=!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.#F(a);if(o.tag!=="error"){if(!Z(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.#ft=n,this.#I=this.#I.slice(0,-1)}#_s(t,e){for(let s=this.#I.length-1;s>=0;s--){let r=this.#I[s].find(a=>a.name===t);if(r)return xe(r)}let n=this.#K;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}#Fe(t){if(t.kind==="WildcardType"){if(!t.bound)return{tag:"wildcard",bound:null};let e=this.#Fe(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.#F(t)}#Us(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.#Fe(o);if(c.tag==="error")return E;r.push(c)}let a=X(t,r);if(!this.#ft){let o=Ln(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}#F(t,e=!1){switch(t.kind){case"PrimitiveType":return t.name==="int"?U:t.name==="boolean"?dt:t.name==="char"?Se:t.name==="long"?Lt:t.name==="double"?lt:t.name==="float"?St:t.name==="byte"?On:dn;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.#F(t.element);return n.tag==="error"?E:qt(n)}case"ClassType":{let n=t.names.join(".");if((n==="Object"||n==="java.lang.Object")&&!this.#de(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.#_s(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.#de(t.names)??this.#ie(t.names);if(s)return t.hasTypeArguments?this.#Us(s,t):X(s);let r=this.#nt(t.names);if(r)return this.#Bs(r,t,e);let a=t.names.length===1?this.#N.get(n):void 0;return a?(this.#l(t.pos,`the class ${a}`,!0),E):t.names.length===1&&(Fn.has(n)||n===this.#Vs())?(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)}}}#Bs(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}:ft(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.#Fe(a);if(o.tag==="error")return E;r.push(o)}return ft(t,r)}#de(t){let e=this.#ue(t[0]);for(let n of t.slice(1))e=e?.membersByName.get(n)??null;return e}#Vs(){return this.#ot.find(t=>t.declaration.implicit)?.name}#G(t,e,n){e.tag==="error"||n.tag==="error"||this.#e(t.pos,v.incompatibleTypes,`incompatible types: ${$e(n,e)}`,$t([e,n]))}#E(t,e){let n=this.#Hs(t,e);return t.type=n,n}#tt(t,e){let n=this.#E(t,e);return n.tag==="void"?(this.#e(t.pos,v.incompatibleTypes,"\'void\' type not allowed here"),E):n}#Hs(t,e){switch(t.kind){case"Literal":switch(t.literalKind){case"int":return t.constant=Q(t.value),U;case"char":return t.constant=Rn(t.value.charCodeAt(0)),Se;case"boolean":return t.constant=gt(t.value),dt;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=or(t.value),ct;case"null":return ir;default:return this.#l(t.pos,`\'${t.literalKind}\' literals`),E}case"Name":return this.#tr(t);case"Parenthesized":{let n=this.#E(t.expression,e);return t.expression.constant&&(t.constant=t.expression.constant),n}case"FieldAccess":return this.#Dn(t);case"MethodCall":{let n=this.#ar(t,e);return this.#_e(t.args),n}case"Unary":return this.#vr(t);case"IncDec":return this.#kr(t);case"Binary":return this.#Cr(t);case"Assignment":return this.#Er(t);case"ArrayAccess":return this.#Ar(t);case"NewArray":return this.#Ir(t);case"Cast":return this.#Or(t);case"This":return this.#Ys(t);case"NewObject":{let n=this.#dr(t,e);return this.#_e(t.args),n}case"Conditional":return this.#yr(t,e);case"SwitchExpression":return this.#Ln(t,e);case"Lambda":return this.#gn(t,e);case"MethodRef":return t.lambda?.method?e??E:this.#Gn(t,e);case"InstanceOf":return this.#qs(t);case"Super":return this.#Rn(t);case"ClassLiteral":return this.#Gs(t)}}#Gs(t){let e=this.#Ke(t.target);if(!("kind"in e))return e.tag!=="error"&&this.#e(t.target.pos,v.cantResolve,"cannot find symbol",[` symbol: class ${mr(t.target)??"?"}`,` location: class ${this.#a.displayName}`]),E;let n=s=>ft(le("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=le(e.name);return t.className=s.qualifiedName,t.isInterface=s.isInterface,n(ft(s))}return e.name==="Object"||e.name==="System"||e.name==="Math"?(t.className=`java.lang.${e.name}`,ft(le("Class"))):(this.#l(t.pos,`the class literal ${e.name}.class`,!0),E)}#Pn(t,e){if(!e&&(this.#V||this.#P))return this.#te(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=le("Class");return t.libraryCall={native:"Object.getClass",isStatic:!1,params:[],returnsValue:!0,display:"Object.getClass()"},ft(n)}#Rn(t){return t.qualifier?this.#zs(t,t.qualifier):this.#V?(this.#te(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))}#zs(t,e){let n=t.dotPos??t.pos,s=e.length===1?this.#ue(e[0]):this.#fn(this.#Ks(e,t.qualifierPos??t.pos));if(!s){let a=e[e.length-1];return Pt[a]||Fn.has(a)||this.#N.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.#V||!this.#a.interfaces.includes(s))return r();let a=this.#a.interfaces.find(o=>o!==s&&un(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.#Rn(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()}#Ks(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}#qs(t){if(t.recordPattern){let r=this.#tt(t.expression);if(r.tag==="error")return E;if(!this.#o)return this.#l(t.recordPattern.pos,"pattern variables in field initializers"),E;let a=[];return this.#un(t.recordPattern,r,!0,a)?(t.testedType=t.recordPattern.tested,t.patternBindings=a,dt):E}let e=this.#tt(t.expression),n=t.targetType.kind==="ClassType"&&!t.targetType.hasTypeArguments?this.#nt(t.targetType.names):null,s=n&&n.typeParams.length?ft(n):this.#F(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.#G(t.expression,e,s),E;if(t.testedType=s,t.binding){if(!this.#o)return this.#l(t.binding.pos,"pattern variables in field initializers"),E;t.binding.symbol=this.#hn(t.binding.name,s,t.binding.pos,t.binding.isFinal)}return dt}#un(t,e,n,s){let r=this.#Ws(t,e,n,s);return r||this.#Jn(t,s),r}#Jn(t,e){if(t.kind==="RecordPattern")return t.components.forEach(n=>this.#Jn(n,e));t.symbol||t.name==="_"||(t.symbol=this.#hn(t.name,E,t.namePos,t.isFinal),e.push(t.symbol))}#Ws(t,e,n,s){if(t.kind==="TypePattern"){let h;if(t.type===null)h=e;else{let f=t.type.kind==="ClassType"&&!t.type.hasTypeArguments?this.#nt(t.type.names):null;if(h=f&&f.typeParams.length?ft(f):this.#F(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.#G(t,e,h),!1}return t.tested=h,t.unconditional=Y(h)||H(q(e),q(h)),t.name!=="_"&&(t.symbol=this.#hn(t.name,h,t.namePos,t.isFinal),s.push(t.symbol)),!0}let r=this.#F(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"?ne(e,a):null;o=h?.args?.length?h:r}if(!Te(o,e))return this.#G(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(f=>f.kind==="TypePattern"&&f.type===null?"var":P(this.#Xs(f)));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.#kt(a,h.name).find(f=>!f.isStatic&&f.params.length===0));let m=!0;return t.components.forEach((h,f)=>{this.#un(h,u[f],!1,s)||(m=!1)}),m}#Xs(t){return t.type?this.#Kn(t.type):G}#hn(t,e,n,s){let r=this.#o;(this.#pt(t)||this.#bn(t))&&this.#e(n,v.alreadyDefined,`variable ${t} is already defined in ${r.isConstructor?"constructor":"method"} ${this.#Ft(r)}`);let a={kind:"local",name:t,type:e,index:r.locals.length,slot:this.#k,isFinal:s,declPos:n,binding:!0};return this.#k+=Me(e),r.maxSlots=Math.max(r.maxSlots,this.#k),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.#vt();let n=this.#L[this.#L.length-1];for(let a of t)n.names.set(a.name,a);let s=e(),r=this.#k;return this.#wt(),this.#k=r,s}#je(t){let e=this.#L[this.#L.length-1];for(let n of t)e.names.has(n.name)||this.#pt(n.name)||(e.names.set(n.name,n),this.#Et.push(n))}#Ys(t){return t.qualifier?this.#Qs(t,t.qualifier):this.#V?(this.#te(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.#de(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.#V||!this.#He(s)?(this.#te(t.pos,"non-static variable this cannot be referenced from a static context"),E):(this.#Vt(),s&&(t.outerHops=s),ce(n))}#Zs(t,e){let n=t.captures?.find(m=>m.local.name===e);if(n)return n.field;let s=this.#$t.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}#tr(t){let e=this.#pt(t.identifier);if(e)return e.captureOf&&this.#St.push({local:e,pos:t.pos,top:this.#a.topLevel}),t.symbol=e,e.constant&&(t.constant=e.constant),e.type;let n=this.#Xt(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.#ws(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.#V||!this.#He(a))return this.#te(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.#U??this.#Y;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.#St.push({local:r.capturedLocal,pos:t.pos,top:this.#a.topLevel,inner:!0}),this.#dn(t,r,r.isStatic?void 0:ce(o)))}let s=this.#Le(t);if(s==="error")return E;if(s){t.imported=s;let r=this.#Dn(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)}#dn(t,e,n){if(e.isFinal&&e.state==="pending"&&this.#On(e),e.constant&&(t.constant=e.constant),!n)return e.type;let s=Ie(Ce(n,e.owner,e.type));return Zi(t,e.type,s),s}#Ke(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.#pt(t.identifier)&&!this.#Xt(t.identifier)&&this.#B(t.identifier,this.#w).length)return this.#E(t);if(t.kind==="Name"&&!this.#pt(t.identifier)&&!this.#Xt(t.identifier)){let e=t.identifier,n=this.#ue(e);if(n)return t.symbol={kind:"type",name:e,symbol:n},{kind:"type",name:e,symbol:n};let s=this.#ie([e]);if(s)return t.symbol={kind:"type",name:e,symbol:s},{kind:"type",name:e,symbol:s};if(e==="System"||e==="String"||Fn.has(e)||Pt[e]&&this.#qe(e))return t.symbol={kind:"type",name:e},{kind:"type",name:e};if(this.#N.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.#pt(t.target.identifier)&&this.#qe(t.target.identifier))return{kind:"type",name:t.name,qualified:!0};let e=mr(t.target);if((e==="java.util"||e==="java.lang")&&!this.#pt("java")&&!this.#Xt("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.#fn(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.#E(t)}#qe(t){let e=Pt[t];return jt[t]?this.#s.has(t):e==="java.lang"||this.#s.has(t)||e!==void 0&&this.#n.has(e)||this.#A.compact}#fn(t){if(t.kind==="Name"&&!this.#pt(t.identifier)&&!this.#Xt(t.identifier)){let e=this.#ue(t.identifier);return e&&(t.symbol={kind:"type",name:t.identifier,symbol:e}),e}if(t.kind==="FieldAccess"){let e=this.#fn(t.target),n=e?.membersByName.get(t.name);if(e&&n&&!e.fieldsByName.has(t.name))return t.typeSymbol=n,n}return null}#we(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)}`}#fe(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)}#Dn(t){let e=ht(t.target);if(e.kind==="Super"&&e.qualifier){if(this.#E(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.#Ke(t.target);if("kind"in n&&n.kind==="type"){if(n.symbol){let m=n.symbol,h=this.#Je(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.#fe(h,t.pos,h.name)?(t.fieldSymbol=h,this.#dn(t,h)):E:(this.#te(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",Fi):t.name==="in"?(t.field="System.in",ft(ee("InputStream"))):(this.#e(t.pos,v.cantResolve,"cannot find symbol",[` symbol: variable ${t.name}`," location: class System"]),E);let a=Object.hasOwn(gs,n.name)?gs[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.#nt([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.#Je(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.#fe(a,t.pos,a.name)?(t.fieldSymbol=a,this.#dn(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.#we(t.target,s),...$t([s])]),E}#Qt(t){return t.map(e=>{let n=ht(e);if(n.kind==="MethodRef")return{tag:"lambda",arity:this.#Xe(n)?.params.length??-1,text:us(n)};if(n.kind==="Lambda")return{tag:"lambda",arity:n.params.length,text:us(n)};let s=this.#Fn(e);if(s)return this.#J.add(e),{tag:"diamond",symbol:s,fromArgs:null};let r=n.kind==="NewObject"&&n.body&&n.classType.kind==="ClassType"&&n.classType.diamond?this.#nt(n.classType.names):null;if(r)return this.#J.add(e),{tag:"diamond",symbol:r,fromArgs:null};this.#lt=e;let a=this.#tt(e),o=this.#rt.get(n);if(!o||a.tag!=="library"||n.kind!=="MethodCall")return a;let c=new Map;return this.#Zt(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 f=Hn([h],o.symbol,na(o.symbol,o.method,o.types.length));return{tag:"wildcard",bound:u,poly:{name:h.name,lows:c.get(h.name)??[],where:f}}})}})}#Fn(t){if(t.kind!=="MethodCall")return null;let e;if(t.target){let a=Ke(t.target);if(!a||this.#pt(a[0])||this.#Xt(a[0]))return null;e=a.length===2&&jt[a[1]]===a[0]&&this.#qe(a[0])?le(a[1])??null:this.#nt(a)}else{let a=this.#m.size||this.#u.length?this.#B(t.name,this.#mt):[];if(a.length!==1||this.#Jt(t.name))return null;e=this.#xt(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.#Xe(o)||this.#_n(o))||this.#Fn(o)!==null})?s.symbol:null}#_e(t){for(let e of t)this.#J.has(e)&&(this.#J.delete(e),e.type=this.#E(e))}#_t(t,e){return`${t}(${e.map(P).join(",")})`}#er(t,e,n=ce(t)){let s=this.#kt(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,...ta(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}#mn(t,e,n){return!t.builtin||t.constructors.some(s=>s.params.length===e)?!1:(this.#l(n,`this ${t.name} constructor`,!0),!0)}#nr(t,e){if(!this.#ae(X(t)))return null;let n=this.#kt(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}#Ue(t,e){let n=t.isEnum?"enum":t.isRecord?"record":"class",s=e?.tag==="class"?Ln(e):new Map,r=e!==void 0&&Nn(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,...ta(a)?{varargs:!0}:{}}))}#ke(t,e){if(!t.expanded||!t.method)return;let n=t.params[t.params.length-1],s=n.element;return!Sn(n)&&!this.#At(t.method.declaration.modifiers,"SafeVarargs")&&this.#Q(e,"unchecked",`unchecked generic array creation for varargs parameter of type ${P(n)}`,$t([n])),{from:t.params.length-1,element:s}}#sr(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,f)=>u.set(h.key,n[f]))}else{Qi(c,ea(t,e),e,u,m);let h=[...m.keys()].filter(f=>!u.has(f));for(let[f,p]of m)u.has(f)||u.set(f,p.reduce(dr));if(s&&(t.returnType.tag==="library"||t.returnType.tag==="class")){let f=new Map;bt(t.returnType,s,f);for(let p of h){let C=f.get(p);!C||C===Mn||C.tag==="wildcard"||C.tag==="typevar"&&!C.symbol||m.get(p).every(T=>H(T,C))&&u.set(p,C)}}r.forEach((f,p)=>{let C=ht(f),T=C.kind==="MethodRef"&&t.params[p]?Ss(Bt(t.params[p],u)):null;if(!T||C.kind!=="MethodRef")return;let w=this.#Xe(C,T.params[0]&&!re(T.params[0],c)?T.params[0]:void 0);w&&(w.params.forEach((x,k)=>T.params[k]&&bt(T.params[k],Wt(x)??x,u)),w.returnType.tag!=="void"&&bt(T.returnType,Wt(w.returnType)??w.returnType,u))}),a&&o.some(f=>!u.has(f.key))&&this.#rr(t.params,r,u,c),s&&t.returnType.tag!=="void"&&o.some(f=>!u.has(f.key))&&bt(t.returnType,s,u);for(let f of o){let p=u.get(f.key);if(!p||f.bounds.every(x=>H(p,Bt(x,u))))continue;let C=m.get(f.key)??[p],T=`inference variable ${f.name} has incompatible bounds`,w=C.length>1&&f.bounds.some(x=>re(x,[f.key]))?[T,` equality constraints: ${C.map(P).join(",")}`,` lower bounds: ${[...C].reverse().map(P).join(",")}`]:[T,` upper bounds: ${f.bounds.map(P).join(",")}`,` lower bounds: ${C.map(P).join(",")}`];return{...t,shown:t.params,problem:{reason:w.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)}}#rr(t,e,n,s){let r=a=>re(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.#yn(u);if("problem"in m||m.params.some(r)||!r(m.returnType))return;this.#gn(c,u,s.filter(f=>!n.has(f)));let h=c.method?.returnType;h&&h.tag!=="error"&&h.tag!=="void"&&bt(m.returnType,Wt(h)??h,n)})}#ir(t){let e=0;for(let n=this.#a;n;n=n.outer,e++)if(this.#kt(n,t).length||Object.hasOwn(Ee,t))return{owner:n,hops:e};return{owner:this.#a,hops:0}}#ar(t,e){let n=null,s=t.target===null?this.#Qt(t.args):null;if(s&&(this.#m.size||this.#u.length)&&!s.some(f=>f.tag==="error")&&!this.#Z(t,s))return E;t.target&&(n=this.#Ke(t.target));let r=s??this.#Qt(t.args);if(r.some(f=>f.tag==="error")||n&&"tag"in n&&n.tag==="error")return E;let a=t.typeArguments?t.typeArguments.map(f=>this.#Fe(f)):null;if(a?.some(f=>f.tag==="error"))return E;let o=n;if(n&&"tag"in n&&n.tag==="typevar"&&n.symbol){let f=C=>C.tag==="class"&&this.#kt(C.symbol,t.name).length>0||C.tag==="library"&&C.symbol.methods.some(T=>T.name===t.name),p=n.symbol.bounds.find(f)??(Object.hasOwn(Ee,t.name)?G:null);if(!p)return this.#e(t.selectPos,v.cantResolve,"cannot find symbol",[` symbol: method ${this.#_t(t.name,r)}`,this.#we(t.target,n),...$t([n,...r])]),E;n=p}if(t.name==="getClass"&&!r.length&&(n===null||"tag"in n)&&!(n===null&&this.#kt(this.#a,"getClass").length))return this.#Pn(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 f=this.#Pn(t,n);return t.libraryCall&&(t.libraryCall.native="Enum.getDeclaringClass",t.libraryCall.display=`${n?.symbol.binaryName??this.#a.binaryName}.getDeclaringClass()`),f}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 f,p=0;if(n?f=n.symbol:{owner:f,hops:p}=this.#ir(t.name),Ts.has(t.name)&&!this.#kt(f,t.name).length)return this.#l(t.selectPos,`the method Object.${t.name}()`,!0),E;let C=this.#nr(f,t);if(C)return this.#l(t.selectPos,C,!0),E;let T=m?o:ce(f),w=this.#er(f,t.name,T),x=w.map(N=>this.#sr(N,r,a,e,t.args,w.length===1)),k=t.target?ht(t.target):null,I=k?.kind==="Super"?k.interfaceSymbol:void 0;if(!x.length&&I)return this.#e(t.selectPos,v.cantResolve,"cannot find symbol",[` symbol: method ${this.#_t(t.name,r)}`]),E;if(!x.length){let N=this.#ks(f,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 ${f.displayName}`:n?this.#we(t.target,n):` location: class ${this.#a.displayName}`;return this.#e(t.selectPos,v.cantResolve,"cannot find symbol",[` symbol: method ${this.#_t(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.#V||!this.#He(p));if(!$&&O)return this.#te(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.#fe(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.#Ft(L.method)} in ${L.method.owner.displayName} cannot be accessed directly`),E;if(u&&L.method.isStatic&&L.method.owner.isInterface&&L.method.owner!==f)return this.#e(t.selectPos,v.cantResolve,"cannot find symbol",[` symbol: method ${this.#_t(t.name,r)}`,` location: class ${f.displayName}`]),E;this.#me(t.args,L.params),t.method=L.method;let N=this.#ke(L,t.pos);N&&(t.varargs=N);let B=L.method.params;m&&Nn(o)&&B.some(J=>zn([J]).some(j=>j.ofClass))&&this.#Q(t.pos,"unchecked",`unchecked call to ${this.#Ft(L.method)} as a member of the raw type ${P(o)}`,$t(B)),this.#jn(t.pos,`method ${t.name} in ${f.isInterface?"interface":"class"} ${f.displayName}`,B,L.params,r,t.args,$t),this.#We(t.args,B.map(q)),t.qualifier=L.method.isStatic?L.method.owner.binaryName:f.binaryName}else t.objectMethod=L.objectMethod,t.qualifier=f.isInterface&&!R?f.binaryName:"Object";return R&&(t.isSuper=!0),!n&&p>0&&!$&&(t.outerHops=p),L.method&&Zi(t,L.method.returnType,L.returnType),L.returnType}if("kind"in n&&n.name==="IO")return this.#br(t,r);if("kind"in n&&n.name==="Math"&&Object.hasOwn(jn,t.name))return this.#gr(t,r);if("kind"in n&&!n.symbol&&(n.name==="Math"||n.name==="String"))return this.#Be(t,ee(n.name),null,r,e);if("kind"in n&&this.#N.has(n.name))return this.#l(t.target.pos,`the class ${this.#N.get(n.name)}`,!0),E;if("kind"in n&&Pt[n.name]&&(n.qualified||this.#qe(n.name)))return this.#Be(t,le(n.name),null,r,e);if("kind"in n)return n.name==="System"&&!n.symbol?Hi.has(t.name)?this.#Be(t,ee("System"),null,r,e):(this.#e(t.selectPos,v.cantResolve,"cannot find symbol",[` symbol: method ${this.#_t(t.name,r)}`," location: class System"]),E):(this.#l(t.selectPos,`${n.name}.${t.name}()`,!0),E);let h=n.tag==="diamond"?this.#pn(n):n;switch(h.tag){case"null":return this.#e(t.selectPos,v.cantResolve,"<null> cannot be dereferenced"),E;case"printstream":return this.#xr(t,h,r);case"library":return this.#Be(t,h.symbol,h,r,e);case"string":{let f=Object.hasOwn(Un,t.name)?Un[t.name]:void 0;if(f){let p=this.#at({pos:t.selectPos,name:t.name},[f],r,"method");return p?(t.stringMethod=t.name,p.returnType):E}if(mo.has(t.name)){let p=ee("String");return this.#Be(t,p,ft(p),r,e)}break}case"object":case"array":{let f=Object.hasOwn(Ee,t.name)?Ee[t.name]:void 0;if(f){let p=this.#at({pos:t.selectPos,name:t.name},[f],r,"method");return p?(t.objectMethod=p.objectMethod,t.qualifier="Object",ht(t.target).kind==="Super"&&(t.isSuper=!0),p.returnType):E}if(Ts.has(t.name)||h.tag==="array"&&yo.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.#_t(t.name,r)}`,this.#we(t.target,h)]),E}#Be(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)||Ts.has(t.name)))return this.#l(t.selectPos,`the ${e.name} method ${t.name}()`,!0),E;if(!c.length){let N=n?this.#we(t.target,n):` location: class ${e.name}`;return this.#e(t.selectPos,v.cantResolve,"cannot find symbol",[` symbol: method ${this.#_t(t.name,s)}`,N]),E}let u=t.typeArguments?t.typeArguments.map(N=>this.#Fe(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.#lr(N,s),j=[...N.isStatic?[]:a.map(Po),...J],K=[...N.isStatic?[]:a.map(Ie),...J],st=o&&!N.isStatic;return{owner:N.owner,name:N.name,params:N.params.map(Kt=>st?q(Kt):At(Kt,B,j)),returnType:st?q(N.returnType):At(N.returnType,B,K),library:N,...N.varargs?{varargs:!0}:{}}}),f=this.#at({pos:t.selectPos,name:t.name,imported:Gi(t)},h,s,"method");if(!f)return E;let p=f.library,C=this.#Zt(p,s),T=!o&&s.some((N,B)=>p.params[B]!==void 0&&bn(p.params[B],N));if(p.comparableParams&&!T&&p.comparableParams.some(N=>C.has(N)&&!aa(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(xn).join(", ")})`,!0),E;if(!p.isStatic&&!n)return this.#e(t.selectPos,v.cantResolve,`non-static method ${t.name}(${f.params.map(P).join(",")}) cannot be referenced from a static context`),E;let w=!o&&p.typeParams?.length&&!m(p)&&t.args.some(N=>["Lambda","MethodRef"].includes(ht(N).kind)||this.#J.has(N)),x=t.args.filter(N=>this.#J.has(N)),k=w?this.#or(p,e,a,t.args,s,r,f.params):null,I=!w&&p.isStatic&&p.typeParams?.length&&!m(p)&&r?this.#Un(t,e,p,s,r):null;if(!w&&!r&&p.isStatic&&p.typeParams?.length&&!m(p)&&p.returnType.tag==="library"){let N=new Map;this.#Zt(p,s,N);let B=p.returnType.args.map(J=>J.tag==="typevar"&&!J.symbol&&N.has(J.name));B.some(Boolean)&&this.#rt.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&&(f.params=f.params.map((N,B)=>At(p.params[Math.min(B,p.params.length-1)],p.typeParams,L))),this.#me(t.args,k?k.params:f.params),t.libraryCall=this.#Ye(p,n??ft(e),f.params),f.expanded&&(t.libraryCall.varargsFrom=f.params.length-1);let $=N=>Hn(N,e,p);if(o&&!p.isStatic&&p.params.some(N=>re(N,null))&&this.#Q(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,f.params,s,t.args,$),this.#We(t.args,p.params.map(q)),o)return Ie(f.returnType);if(T)return q(p.isStatic?p.returnType:Xt(p.returnType,e.typeParams,a));let O=m(p)?f.returnType:I?At(p.returnType,p.typeParams,L):k?.returnType??this.#Bn(p,e,a,s,r)??f.returnType;if(p.typeParams?.length&&x.length&&!m(p)){let N=new Map(k?.bound??this.#Zt(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((j,K)=>fe(r.args[K])&&bt(j,fe(r.args[K]),N))}t.args.forEach((J,j)=>x.includes(J)&&J.type&&bt(p.params[Math.min(j,p.params.length-1)],J.type,N)),O=this.#Bn(p,e,a,s,r,N)??O}let R=O.tag==="typevar"&&!O.symbol?G:Ie(O);return p.returnType.tag==="typevar"&&$o(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)&&bn(n[m]??s[m],u));c.some(Boolean)&&(this.#Q(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.#Q(a[m].pos,"unchecked","unchecked conversion",[` required: ${P(n[m])}`,` found: ${P(r[m])}`,...o([n[m],r[m]])])}))}#We(t,e){t.forEach((n,s)=>{e[Math.min(s,e.length-1)]?.tag==="object"&&delete ht(n).genericCast})}#or(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.#Zt(t,r),f=O=>re(O,c.filter(R=>!h.has(R))),p=(O,R)=>{let N=R.params[0]&&!f(R.params[0])?R.params[0]:void 0;if(!N&&this.#_n(O))return!1;let B=this.#Xe(O,N);return B&&(B.params.forEach((J,j)=>R.params[j]&&bt(R.params[j],J,h)),B.returnType.tag!=="void"&&bt(R.returnType,Wt(B.returnType)??B.returnType,h)),!0},C=[];s.forEach((O,R)=>{let N=ht(O),B=Ss(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,j)=>{let K=this.#F(J.type);K.tag!=="error"&&B.params[j]&&bt(B.params[j],K,h)}))});let T=u(t.returnType);if(a?.tag==="library"&&T.tag==="library"){let O=_t(T,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=Ss(Xt(m(O),R,R.map(B=>h.get(B))));N&&p(ht(s[O]),N)}let w=()=>c.filter(O=>h.has(O)),x=O=>Xt(m(O),w(),w().map(R=>h.get(R)));s.forEach((O,R)=>{this.#J.has(O)&&(this.#J.delete(O),O.type=this.#E(O,x(R)),O.type.tag!=="error"&&bt(m(R),O.type,h))});let k=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=Ss(B);if(!J||J.params.some(f)||!f(J.returnType))return;let j;N.kind==="Lambda"?(this.#gn(N,B,!0),j=N.method?.returnType):N.kind==="MethodRef"&&(this.#Gn(N,B,!0),j=N.lambda?.method?.returnType),j?.tag==="diamond"&&J.returnType.tag==="typevar"?k.set(J.returnType.name,j):j&&j.tag!=="error"&&j.tag!=="void"&&bt(J.returnType,Wt(j)??j,h)});for(let[O,R]of k){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,j=xs(R.symbol,J);h.set(O,ft(R.symbol,R.symbol.typeParams.map(K=>j.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}}#_n(t){if(!t.target||t.name==="new"||t.arrayType)return!1;let e=Ke(t.target);if(!e||this.#pt(e[0])||this.#Xt(e[0]))return!1;let n=this.#de(e);return n!==null&&(n.typeParams?.length??0)>0&&this.#kt(n,t.name).some(s=>!s.isStatic)}#Xe(t,e){if(t.arrayType){let c=this.#F(t.arrayType);return c.tag==="error"?null:{params:[U],returnType:c}}if(!t.target||t.name==="new")return null;let n=Ke(t.target);if(!n||this.#pt(n[0])||this.#Xt(n[0]))return null;let s=this.#de(n);if(s){let c=this.#kt(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=ne(e,s);if(!m?.args?.length)return null;let h=f=>Ie(Ce(m,u.owner,f));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(Un,t.name))return{params:[ct,...Un[t.name].params],returnType:Un[t.name].returnType};let c=ee("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.#nt(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:[ft(r),...o.params],returnType:o.returnType}}#Zt(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=Z(m)?gr(m):Wt(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"&&Z(m[0].element))bt(u,m[0],s);else for(let f of m)a(u.element,f)}for(let[u,m]of r)s.has(u)||(s.set(u,m.reduce(dr)),n?.set(u,m));return s}#Un(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.#Zt(n,s,u),h=!1;for(let[f,p]of c.args.entries()){let C=r.args[f];if(p.tag!=="typevar"||p.symbol||!u.has(p.name)||!C||C.tag==="wildcard"||C.tag==="typevar"&&!C.symbol)continue;let T=u.get(p.name);if(T.some(w=>!H(w,C))){if(a)return null;let w=T.filter((x,k)=>T.findIndex(I=>rt(I,x))===k);return this.#e(t.pos,v.incompatibleTypes,`incompatible types: inference variable ${p.name} has incompatible bounds`,[` equality constraints: ${P(C)}`,` lower bounds: ${[...w].reverse().map(P).join(",")}`,...Hn([p],e,na(e,n,s.length))]),"error"}rt(m.get(p.name),C)||(m.set(p.name,C),h=!0)}return h?m:null}#lr(t,e){if(!t.typeParams)return[];let n=this.#Zt(t,e);return t.typeParams.map(s=>n.get(s)??G)}#Bn(t,e,n,s,r,a){if(!t.typeParams)return null;let o=a??this.#Zt(t,s),c=t.isStatic?t.returnType:Xt(t.returnType,e.typeParams,n);if(t.typeParams.every(f=>o.has(f)))return a?At(c,t.typeParams,t.typeParams.map(f=>o.get(f))):null;if(r?.tag==="library"&&c.tag==="library"){let f=_t(c,r.symbol);f&&f.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)&&Z(r)&&o.set(c.name,r);let u=t.typeParams.map(f=>o.get(f)??G),m=At(c,t.typeParams,u),h=t.typeParams.filter(f=>!o.has(f));if(!r&&h.length&&c.tag==="library"&&c.args.some(f=>f.tag==="typevar"&&h.includes(f.name))){let f=c.args.every(p=>p.tag==="typevar"&&h.includes(p.name))?null:m.args;return{tag:"diamond",symbol:c.symbol,fromArgs:f}}return m}#Ye(t,e,n){let s=e.tag==="library"?vo(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(xn).join(", ")})`,...t.throws?{throws:t.throws}:{}}}#pn(t){return ft(t.symbol,t.fromArgs??t.symbol.typeParams.map(()=>G))}#me(t,e){t.forEach((n,s)=>{let r=ht(n),a=r.kind==="MethodCall"?this.#rt.get(r):void 0;if(a&&r.kind==="MethodCall"){this.#rt.delete(r);let m=e[Math.min(s,e.length-1)],h=m?this.#Un(r,a.symbol,a.method,a.types,m,!0):null;if(h&&h!=="error"){let f=a.method.typeParams.map(C=>h.get(C)??G),p=At(a.method.returnType,a.method.typeParams,f);r.type=p,n!==r&&(n.type=p),r.libraryCall&&(r.libraryCall.params=r.libraryCall.params.map((C,T)=>At(a.method.params[Math.min(T,a.method.params.length-1)],a.method.typeParams,f)))}return}if(this.#J.has(n)){this.#J.delete(n),n.type=this.#E(n,e[Math.min(s,e.length-1)]);return}let o=ht(n).kind;if(o==="Lambda"||o==="MethodRef"){this.#E(n,e[s]);return}if(n.kind==="NewObject"&&n.openDiamond){let{symbol:m,bound:h}=n.openDiamond;delete n.openDiamond;let f=hr(m,e[Math.min(s,e.length-1)]);n.type=X(m,m.typeParams.map(p=>h.get(p.key)??f.get(p.key)??q(xe(p))));return}let c=n.type;if(c?.tag!=="diamond")return;let u=xs(c.symbol,e[s]);n.type=ft(c.symbol,c.symbol.typeParams.map((m,h)=>u.get(m)??c.fromArgs?.[h]??G))})}#cr(t,e,n){let s=e.tag==="library"||e.tag==="diamond"?e.symbol:null;if(!s)return E;let r=this.#Qt(t.args);if(r.some(T=>T.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 ${gn(s.name)} with \'new\'`,!0),E;let a=e.tag==="diamond";n===Vn&&(n=void 0);let o=a&&n?xs(s,n,!0):new Map,c=T=>{if(!a)return e.args.slice();let w=new Map(o);return T.params.forEach((x,k)=>bt(x,r[k],w)),s.typeParams.map(x=>w.get(x)??G)},u=e.tag==="library"&&!e.args.length&&s.typeParams.length>0,m=s.constructors.map(T=>{let w=c(T);return{owner:s.name,name:s.name,params:T.params.map(x=>u?q(x):At(x,s.typeParams,w)),returnType:Tt,library:T,...T.varargs?{varargs:!0}:{}}}),h=this.#at({pos:t.pos,name:s.name},m,r,"constructor");if(!h)return E;let f=h.library;if(!f.native)return this.#l(t.pos,`the constructor ${s.name}(${f.params.map(xn).join(", ")})`,!0),E;u&&f.params.some(T=>re(T,null))&&this.#Q(t.pos,"unchecked",`unchecked call to ${s.name}(${f.params.map(P).join(",")}) as a member of the raw type ${s.name}`,Hn(f.params,s)),this.#me(t.args,h.params);let p=a&&r.some((T,w)=>f.params[w]!==void 0&&bn(f.params[w],T));p&&this.#Q(t.pos,"unchecked",`unchecked method invocation: constructor <init> in class ${s.name} is applied to given types`,[` required: ${f.params.map(P).join(",")}`,` found: ${r.map(P).join(",")}`,...Hn([...f.params,...r],s)]);let C;if(p)C=ft(s);else if(!a)C=e;else{let T=new Map(o);f.params.forEach((k,I)=>bt(k,r[I],T));let w=s.typeParams.every(k=>T.has(k)),x=s.typeParams.map(k=>T.get(k)??G);C=w||n?ft(s,x):{tag:"diamond",symbol:s,fromArgs:s.typeParams.some(k=>T.has(k))?x:null}}return t.libraryCall=this.#Ye({...f,name:"<init>"},ft(s),h.params),h.expanded&&(t.libraryCall.varargsFrom=h.params.length-1),C}#ur(t,e){if(e.length)return this.#e(t.pos,v.cantResolve,"constructor Object in class Object cannot be applied to given types;",[" required: no arguments",` found: ${e.map(P).join(",")}`," reason: actual and formal argument lists differ in length"]),E;ee("String");let n={name:"<init>",params:[],returnType:G,isStatic:!0,native:"Object.<init>()",owner:"Object"};return t.libraryCall=this.#Ye(n,G,[]),G}#hr(t){let e=this.#Qt(t.args);if(e.some(a=>a.tag==="error"))return E;let s=ee("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.#Ye({...r.library,name:"<init>"},ct,r.params),ct):E}#dr(t,e){if(t.body)return this.#fr(t,t.body,e);let n=this.#lt===t;this.#lt=null;let s=this.#F(t.classType);if(s.tag==="library"||s.tag==="diamond")return this.#cr(t,s,e);if(s.tag==="string")return this.#hr(t);let r=this.#Qt(t.args);if(s.tag==="error"||r.some(f=>f.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==="object")return this.#ur(t,r);if(s.tag!=="class")return this.#l(t.pos,`creating ${gn(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.#mn(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.#Ue(a,c?void 0:s),m=s;if(c){let f=a.typeParams,p=f.map($=>$.key),C=hr(a,e),T=new Map;u=u.map($=>{let O=new Map(C),R=new Map;Qi(p,ea($,r),r,O,R);for(let B of f){let J=R.get(B.key);if(!J)continue;let j=C.get(B.key);if(j&&J.some(K=>!H(K,j))){let K=[`inference variable ${B.name} has incompatible bounds`,` equality constraints: ${P(j)}`,` 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(dr))}let N={...$,shown:$.params,params:$.params.map(B=>Bt(B,O))};return T.set(N,O),N});let w=u.filter($=>$.params.length===r.length),x=w.length===1&&w[0].problem?.diamond?w[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(f.map(xe))]),E}let k=this.#at({pos:t.pos,name:a.name},u,r,"constructor");if(!k)return E;let I=T.get(u.find($=>$.method===k.method))??new Map;return f.filter($=>!I.has($.key)).length&&n&&!e?(t.openDiamond={symbol:a,bound:I},m=X(a,f.map($=>I.get($.key)??Mn))):m=X(a,f.map($=>I.get($.key)??q(xe($)))),this.#Hn(t,a,k,m)}let h=this.#at({pos:t.pos,name:a.name},u,r,"constructor");return h?(Nn(s)&&h.method.params.some(f=>zn([f]).length)&&this.#Q(t.pos,"unchecked",`unchecked call to ${this.#Ft(h.method).replace(/^[^(]*/,a.name)} as a member of the raw type ${a.displayName}`,$t(h.method.params)),this.#We(t.args,h.method.params.map(q)),this.#Hn(t,a,h,m)):E}#fr(t,e,n){this.#lt=null;let s=e.symbol,r=this.#F(t.classType),a=this.#Qt(t.args);if(r.tag==="error"||a.some(x=>x.tag==="error"))return E;if(r.tag==="diamond"){let x=xs(r.symbol,n);r=ft(r.symbol,r.symbol.typeParams.map(k=>x.get(k)??G))}else if(r.tag==="class"&&t.classType.kind==="ClassType"&&t.classType.diamond&&r.symbol.typeParams?.length){let x=hr(r.symbol,n);r=X(r.symbol,r.symbol.typeParams.map(k=>x.get(k.key)??q(xe(k))))}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(!qi(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 ${gn(P(r))} with \'new\'`,!0),E;if(r.tag==="class"&&r.symbol.isSealed)return this.#Me(s),E;let u=null;if(s.superclass){if(this.#mn(s.superclass,a.length,t.pos))return E;if(u=this.#at({pos:t.pos,name:s.superclass.name},this.#Ue(s.superclass,s.superType),a,"constructor"),!u)return E;if(!this.#fe(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.#le(),h=this.#a,f=this.#t,p=this.#y,C=this.#P;this.#Pe(s);let T=this.#Vn(s,u);this.#Ve([...s.methods,...s.constructors]),this.#$t.set(s,{scopes:m.scopes}),this.#t=null,this.#P=!1,this.#Re(s),this.#ce(m),this.#a=h,this.#t=f,this.#y=p,this.#P=C,u&&this.#me(t.args,u.params),this.#_e(t.args);let w=u?this.#ke(u,t.pos):void 0;return w&&(t.varargs=w),s.isInner&&(t.outer=0,this.#Vt()),t.ctor=T,X(s)}#Vn(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.#r.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.#r.push(a),t.constructors.push(a),a}#Hn(t,e,n,s){let r=n.method,a=this.#ke(n,t.pos);if(a&&(t.varargs=a),!this.#fe(r,t.pos,`${e.name}(${r.params.map(P).join(",")})`))return E;if(this.#me(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.#He(o)&&this.#vs(o)===e.outer;if(!this.#V&&!this.#P&&c&&(t.outer=o),t.outer!==void 0)this.#Vt();else return this.#te(t.pos,"non-static variable this cannot be referenced from a static context"),E}return t.ctor=r,s}#yn(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=ds(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}}#gn(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.#yn(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.#F(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"&&!ko(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&&re(s.returnType,Array.isArray(n)?n:null)&&(s.returnType=Vn);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.#pe(t,s,r,[],()=>{for(let a of r.statements)this.#Yt(a)}),e}#pe(t,e,n,s,r){let a=t.reference===!0,o,c=this.#y;if(a)o=`lambda$ref$${this.#r.length}`;else{c=this.#t?this.#y:this.#o?this.#o.isConstructor?"new":this.#o.name:this.#V?"static":"new";let O=this.#f.get(this.#a)??new Map;this.#f.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));vs(n,(O,R)=>{if(m.has(O))return;let N=this.#pt(O)??this.#bn(O)?.local;N&&!u.some(B=>B.outer===N)&&u.push({outer:N,pos:R})});let h={keywords:[],annotations:[]},f={kind:"VoidType",pos:t.pos,start:t.pos,end:t.pos},p=t.params.map(O=>({modifiers:h,type:O.type??f,name:O.name,varargs:!1,pos:O.pos,start:O.pos,end:O.pos})),C={kind:"MethodDeclaration",modifiers:h,returnType:f,name:o,namePos:t.pos,params:p,body:n,pos:t.pos,start:t.start,end:t.end},T={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.#r.length,declaration:C,locals:[],maxSlots:0,lambda:t,throws:[],...a?{hidden:!0}:{}};C.symbol=T,this.#r.push(T),!this.#o&&!this.#t&&this.#Mt.set(this.#a,[...this.#Mt.get(this.#a)??[],T]),t.method=T,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 w=this.#le(),x=this.#t,k=this.#y,I=this.#V;this.#t={scopes:this.#L,method:this.#o,isStatic:I,outer:this.#t},this.#y=c,this.#o=T,this.#U=null,this.#V=I,this.#L=[],this.#k=0,this.#$=[];let L=this.#M.items.length;this.#vt();let $=0;for(let O of s){let R=this.#jt(O.name,O.type,t.pos,!0,!0);R.parameter=++$}for(let O of u){let R=this.#jt(O.outer.name,O.outer.type,O.pos,!1,!0);R.parameter=++$,R.captureOf=O.outer}return p.forEach((O,R)=>{let N=this.#jt(O.name,e.params[R],O.pos,!1);N.parameter=++$,O.symbol=N}),r(),this.#wt(),t.body.kind==="Block"&&e.returnType.tag!=="void"&&this.#M.items.length===L&&this.#pr(T)&&this.#e(t.pos,v.incompatibleTypes,"incompatible types: bad return type in lambda expression",[" missing return value"]),T.usesThis&&(T.isStatic=!1,Co(T,1)),this.#ce(w),this.#t=x,this.#y=k,T}#Vt(){let t=this.#o;for(let e=this.#t;t?.lambda&&e;e=e.outer)t.usesThis=!0,t=e.method}#Gn(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.#yn(e);if("problem"in s)return this.#e(t.start,v.incompatibleTypes,`incompatible types: ${s.problem}`,s.details),E;n&&re(s.returnType,null)&&(s.returnType=Vn);let r=s.params.length,a={kind:"Lambda",params:Array.from({length:r},(x,k)=>({name:`$${k}`,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},(k,I)=>o(x+I)),u={depth:2,pos:t.start,start:t.start,end:t.end},m=(x,k)=>({kind:"MethodCall",target:x,name:t.name,namePos:t.namePos,selectPos:t.start,args:c(k),plainNpe:!0,...u}),h=x=>s.returnType.tag==="void"?{kind:"ExpressionStatement",expression:x,...u}:{kind:"ReturnStatement",value:x,...u},f=a.body;if(t.arrayType){let k={kind:"NewArray",elementType:t.arrayType.kind==="ArrayType"?t.arrayType.element:t.arrayType,dimensions:r?[o(0)]:[],extraDims:0,initializer:null,...u};return f.statements.push(h(k)),this.#pe(a,s,f,[],()=>this.#ye(f)),e}let p=t.target;if(p.kind==="Super"||p.kind==="This")return f.statements.push(h(m(p,0))),this.#pe(a,s,f,[],()=>this.#ye(f)),e;if(p.kind==="FieldAccess"&&p.target.kind==="Name"&&p.target.identifier==="System"&&(p.name==="out"||p.name==="err")&&!this.#pt("System"))return f.statements.push(h(m(p,0))),this.#pe(a,s,f,[],()=>this.#ye(f)),e;if(t.name==="new"){let x=this.#mr(p)?this.#zn(p):null;if(!x)return this.#e(t.start,v.cantResolve,"cannot find symbol",[` symbol: class ${this.#qn(p)}`,` location: class ${this.#a.displayName}`]),E;let k={kind:"NewObject",classType:x,args:c(0),...u};return f.statements.push(h(k)),this.#pe(a,s,f,[],()=>this.#ye(f)),e}let C=this.#Ke(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},k=m(x,0);return f.statements.push(h(k)),this.#pe(a,s,f,[{name:"$recv",type:C}],()=>this.#ye(f)),e}let T=this.#qn(p),w=x=>h(x?m(o(0),1):m(p,0));return this.#pe(a,s,f,[],()=>{let x=B=>{let J=w(B),j=this.#M.items.length;f.statements=[J],this.#ye(f);let K=this.#M.items.splice(j),st=J.kind==="ReturnStatement"?J.value:J.expression,Kt=st.method!==void 0||st.libraryCall!==void 0||st.stringMethod!==void 0||st.mathFunction!==void 0||st.objectMethod!==void 0,Fe=st.method?st.method.isStatic:st.libraryCall?st.libraryCall.isStatic:st.mathFunction!==void 0,kn=st.method?`method ${st.method.name}(${st.method.params.map(P).join(",")}) in ${st.method.owner.displayName}`:st.libraryCall?`method ${t.name}(${st.libraryCall.params.map(P).join(",")}) in ${T}`:void 0;return{ok:Kt&&Fe!==B,...kn?{found:kn}:{},...K[0]?{message:K[0].message}:{}}},k=x(!1),I=this.#zn(p),L=I?this.#Kn(I):null,$=L?.tag==="diamond"?ft(L.symbol):L,O=s.params[0],R=!$||$.tag==="error"||O===void 0||O===Vn||H(Wt(O)??O,$)||O.tag==="typevar",N=r>0&&R?x(!0):{ok:!1};if(k.ok&&N.ok){this.#e(t.start,v.incompatibleTypes,"incompatible types: invalid method reference",[` reference to ${t.name} is ambiguous`,` both ${k.found} and ${N.found} match`]);return}if(!k.ok&&!N.ok){let B=/^non-static method (.*) cannot be referenced from a static context$/.exec(k.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 ${T}`]);return}f.statements=[w(!k.ok)],this.#ye(f)}),e}#ye(t){for(let e of t.statements)this.#Yt(e)}#mr(t){let e=Ke(t);return e!==null&&(this.#de(e)!==null||this.#nt(e)!==null||e.join(".")==="String")}#zn(t){let e=Ke(t);if(!e)return null;let n=this.#de(e)?null:this.#nt(e);return{kind:"ClassType",names:e,hasTypeArguments:!1,...n&&n.typeParams.length?{diamond:!0}:{},pos:t.pos,start:t.start,end:t.end}}#Kn(t){let e=this.#M.items.length,n=this.#F(t,!0);return this.#M.items.splice(e),n}#qn(t){return Ke(t)?.join(".")??us(t)}#pr(t){let e=this.#O,n=this.#z,s=[this.#v,this.#q,this.#W,this.#D];this.#O=[],this.#z=[];let r=this.#be(t.declaration.body.statements,Ht(),!0).completes;return this.#O=e,this.#z=n,[this.#v,this.#q,this.#W,this.#D]=s,r}#bn(t){for(let e=this.#t;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}#te(t,e){this.#e(t,v.cantResolve,e)}#yr(t,e){this.#he(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.#tt(t.whenTrue,s)),a=this.#Bt(this.#it(t.condition,!1),()=>this.#tt(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)&&!(Z(r)&&Z(a)&&s&&Z(s)))if(c.tag==="boolean"&&u.tag==="boolean")o=dt;else if(Ot(c)&&Ot(u))o=Ro(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,f=this.#Wn(h);if(!f)return E;if(o=s&&Z(s)?s:f,s&&!Yt(s,f))return this.#G(Y(r)?t.whenTrue:t.whenFalse,h,s),E}else{if(s){let h=!0;for(let[f,p]of[[t.whenTrue,r],[t.whenFalse,a]])Yt(s,p,f.constant)||(this.#e(f.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&&Z(s)?s:sa(r,a)}let m=t.condition.constant;return m?.kind==="boolean"&&t.whenTrue.constant&&t.whenFalse.constant&&(t.constant=Tn(m.value?t.whenTrue.constant:t.whenFalse.constant,o)),o}#gr(t,e){let n=jn[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:Gi(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)}#Wn(t){let e={int:"Integer",long:"Long",double:"Double",char:"Character",boolean:"Boolean",float:"Float",byte:"Byte",short:"Short"}[t.tag],n=e?le(e):void 0;return n?ft(n):null}#br(t,e){if(t.name==="readln"){ee("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.#_t(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}#Tr(t){let e=ht(t);if(e.kind==="FieldAccess")return e.field;if(e.kind==="Name"&&e.imported)return e.imported.field}#Sr(t,e,n){ee("System");let s={owner:"PrintStream",name:t.name,params:[ct,qt(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}#xr(t,e,n){let s=this.#Tr(t.target)==="System.err"?"err":"out";if(t.name==="printf"||t.name==="format")return this.#Sr(t,s,n);if((t.name==="flush"||t.name==="close"||t.name==="checkError")&&!n.length)return ee("System"),t.libraryCall={native:`PrintStream.${s}.${t.name}()`,isStatic:!0,params:[],returnsValue:t.name==="checkError",display:`java.io.PrintStream.${t.name}()`},t.name==="checkError"?dt:Tt;if(t.name!=="print"&&t.name!=="println")return fo.has(t.name)?this.#l(t.selectPos,`PrintStream.${t.name}()`,!0):this.#e(t.selectPos,v.cantResolve,"cannot find symbol",[` symbol: method ${this.#_t(t.name,n)}`,this.#we(t.target,e)]),E;let r=this.#at({pos:t.selectPos,name:t.name},To(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.#We(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=(T,w)=>{if(T.params.length!==n.length)return"actual and formal argument lists differ in length";if(T.problem)return T.problem.reason;for(let x=0;x<n.length;x++)if(!w(T.params[x],n[x]))return`argument mismatch; ${Eo(T.params[x],n[x])??$e(T.params[x],n[x])}`;return null},a=T=>r(T,(w,x)=>ve(w,x)||bn(w,x)),o=e.filter(T=>r(T,Ge)===null);if(o.length||(o=e.filter(T=>a(T)===null)),!o.length)for(let T of e){if(!T.varargs||n.length<T.params.length-1)continue;let w=T.params[T.params.length-1].element;if([...T.params.slice(0,-1),...n.slice(T.params.length-1).map(()=>w)].every((k,I)=>ve(k,n[I])))return{...T,expanded:!0}}let c=T=>T.length?T.map(P).join(","):"no arguments";if(!o.length){if(e.length===1){let k=e[0],I=k.shown??k.params,L=(Lo(k,n)??a(k)).split(`\n`),$=k.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 ${k.ownerKind??"class"} ${k.owner} cannot be applied to given types;`,[...$,...k.problem?.alone?[]:$t([...I,...n])]),null}let T=[],w=[];for(let k of t.imported?[...e].reverse():e){let I=k.shown??k.params,L=k.method?.typeParams;w.push(...I),T.push(` ${s} ${k.owner}.${L?`<${L.map(O=>O.name).join(",")}>`:""}${k.name}(${I.map(P).join(",")}) is not applicable`);let $=a(k).split(`\n`);T.push(` (${$[0]}${$.length>1?"":")"}`,...$.slice(1).map((O,R,N)=>` ${O}${R===N.length-1?")":""}`))}let x=n.length?this.#_t(t.name,n):`${t.name}(no arguments)`;return this.#e(t.pos,v.cantResolve,`no suitable ${s} found for ${x}`,[...T,...$t([...w,...n])]),null}let u=(T,w)=>T.params.every((x,k)=>Ge(w.params[k],x)),m=o.filter(T=>o.every(w=>T===w||u(T,w)));if(m.length===1)return m[0];let h=o.filter(T=>!o.some(w=>w!==T&&u(w,T)&&!u(T,w))),[f,p]=h,C=T=>`${s} ${T.name}(${T.params.map(P).join(",")}) in ${T.owner}`;return this.#e(t.pos,v.cantResolve,`reference to ${t.name} is ambiguous`,[` both ${C(f)} and ${C(p)} match`]),null}#vr(t){let e=this.#tt(t.operand);if(e.tag==="error")return E;let n=yt(e)??e;if(t.operator==="!")return n.tag!=="boolean"?this.#Tn(t,n):(t.operand.constant?.kind==="boolean"&&(t.constant=gt(!t.operand.constant.value)),dt);if(!Ot(n)||t.operator==="~"&&!_n(n))return this.#Tn(t,n);let s=zi(n),r=t.operand.constant;return r&&(t.constant=Jo(t.operator,r,s)),s}#Tn(t,e){return this.#e(t.pos,v.badOperands,`bad operand type ${P(e)} for unary operator \'${t.operator}\'`),E}#Xn(t){let e=ht(t);this.#Ht=e.kind==="Name";let n=this.#E(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.#wr(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}#wr(t,e){if(e.declarator.init)return!1;let n=this.#o?.initializer;return n&&this.#o.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.#o?.isConstructor||this.#o.owner!==e.owner||this.#o.declaration.compact?!1:t.kind==="Name"?!t.outerHops:t.kind==="FieldAccess"&&ht(t.target).kind==="This"}#kr(t){if(!this.#Xn(t.operand))return E;let n=t.operand.type;return Ot(yt(n)??n)?n:this.#Tn(t,n)}#Yn(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}#Qn(t,e,n){if(t==="+"&&(e.tag==="string"||n.tag==="string"))return ct;if((t==="=="||t==="!=")&&Z(e)&&Z(n))return Te(e,n)?dt: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?Gn(s,r):null;case"-":case"*":case"/":case"%":return a?Gn(s,r):null;case"<<":case">>":case">>>":return _n(s)&&_n(r)?zi(s):null;case"<":case">":case"<=":case">=":return a?dt:null;case"==":case"!=":return a?dt:s.tag==="boolean"&&r.tag==="boolean"?dt:Z(s)&&Z(r)&&(H(s,r)||H(r,s))?dt:null;case"&":case"|":case"^":return _n(s)&&_n(r)?Gn(s,r):s.tag==="boolean"&&r.tag==="boolean"?dt:null;case"&&":case"||":return s.tag==="boolean"&&r.tag==="boolean"?dt:null}return null}#Cr(t){let e=this.#tt(t.left),n=t.operator==="&&"||t.operator==="||"?this.#Bt(this.#it(t.left,t.operator==="&&"),()=>this.#tt(t.right)):this.#tt(t.right);if(e.tag==="error"||n.tag==="error")return E;let s=this.#Qn(t.operator,e,n);if(!s){let o=c=>Y(c)||Z(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.#Yn(t,t.operator,e,n)}let r=t.left.constant,a=t.right.constant;if(r&&a){let o=Do(t.operator,r,a,s);o&&(t.constant=o)}return s}#Er(t){let e=this.#Xn(t.target),n=t.target.type??E,s=this.#tt(t.value,t.operator==="="?n:void 0);if(!e||n.tag==="error"||s.tag==="error")return e?n:E;if(t.operator==="="){if(!this.#ze(n,s,t.value))return this.#G(t.value,s,n),E;let u=ht(t.target);return u.kind==="FieldAccess"&&u.fieldSymbol&&u.target.type&&Nn(u.target.type)&&zn([u.fieldSymbol.type]).length&&this.#Q(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.#Qn(r,n,s);if(!a)return this.#Yn(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)}#Ar(t){let e=this.#tt(t.array),n=this.#tt(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.#G(t.index,n,U),E)}#Ir(t){let e=this.#F(t.elementType,!0);if(e.tag!=="error"&&!Sn(e)){this.#e(t.pos,v.syntax,"generic array creation");for(let s of t.dimensions)this.#tt(s);return E}for(let s of t.dimensions){let r=this.#tt(s);r.tag!=="error"&&!ve(U,r)&&this.#G(s,r,U)}if(e.tag==="error")return t.initializer&&this.#ve(t.initializer,E),E;let n=e;for(let s=0;s<t.dimensions.length+t.extraDims;s++)n=qt(n);return t.initializer&&this.#ve(t.initializer,n),n}#Or(t){let e=this.#F(t.targetType),n=this.#tt(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"||Z(e)&&Z(n)&&Te(e,n)||Z(e)&&Y(n)&&Yt(e,n)||Y(e)&&s!==null&&(rt(s,e)||Ot(s)&&Ot(e)&&ve(e,s));if(!r&&Y(e)&&Z(n)&&!s){let o=this.#Wn(e);o&&Te(o,n)&&(t.checked=o,r=!0)}if(!r)return this.#G(t.expression,n,e),E;if(No(e,n))return this.#G(t.expression,n,e),E;if(Z(e)&&Z(n)&&!Sn(e)&&!H(n,e)){this.#Q(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 Z(e)&&Z(n)&&!H(n,e)&&(t.checked=e);let a=t.expression.constant;return a&&(Y(e)||e.tag==="string")&&(t.constant=Tn(a,e)),e}#ge(t,e,n){!this.#q&&!this.#O.some(([s])=>s===t)&&this.#O.push([t,e,n])}#Ce(t,e){this.#z.some(([n])=>n===t)||this.#z.push([t,e])}#Lr(t){this.#O=[],this.#z=[];let e=yr(t);for(let n of e)this.#es(n);this.#es(t);for(let[n,s,r]of this.#O)this.#e(n,s==="missing return statement"?v.missingReturn:v.unreachable,s,r);for(let[n,s]of this.#z)this.#e(n,v.uninitialized,s);this.#p=[];for(let n of e)this.#Zn(n);this.#Zn(t);for(let[n,s,r]of this.#p)this.#e(n,v.unreported,s,r);for(let n of this.#St)n.top!==t||wo(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`)}#Zn(t){this.#a=t;for(let e of t.fields){let n=e.declarator.init;n&&this.#Ee([],()=>n.kind==="ArrayInitializer"?this.#Qe(n):this.#S(n));let s=e.enumConstant?.node;s&&this.#Ee([],()=>{for(let r of s.args)this.#S(r);if(s.ctor)for(let r of s.ctor.throws)this.#Ot(r,s.pos)})}for(let e of t.declaration.members){if(e.kind==="Initializer"&&e.symbol){this.#Ee(e.isStatic?[]:this.#Nr(t),()=>{for(let s of e.body.statements)this.#ut(s)});continue}if(e.kind!=="MethodDeclaration"||!e.symbol||e.symbol.isAbstract||e.symbol.builtin)continue;let n=e.symbol;this.#Ee(n.throws,()=>{if(n.superConstructor)for(let s of n.superConstructor.throws)this.#Ot(s,n.declaration.synthetic?t.declaration.keywordPos:n.declaration.body.pos);for(let s of n.declaration.body.statements)this.#ut(s)})}for(let e of t.constructors)!e.declaration.synthetic||e.builtin||!e.superConstructor||e.forwardsToSuper||this.#Ee([],()=>{for(let n of e.superConstructor.throws)this.#Ot(n,t.declaration.keywordPos)})}#Nr(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)))):[]}#Ee(t,e){let n=[this.#C,this.#T];this.#C=t,this.#T=[],e(),[this.#C,this.#T]=n}#Ot(t,e,n){if(this.#Ne(t)){for(let s=this.#T.length-1;s>=0;s--){let r=this.#T[s];if(r.thrown.push(t),r.caught.some(a=>H(t,a)))return}this.#C.some(s=>H(t,s))||this.#p.some(([s])=>s===e)||this.#p.push([e,`unreported exception ${P(t)}; must be caught or declared to be thrown`,n])}}#ut(t){switch(t.kind){case"Block":for(let e of t.statements)this.#ut(e);return;case"LocalVariableDeclaration":for(let e of t.declarators)e.init?.kind==="ArrayInitializer"?this.#Qe(e.init):e.init&&this.#S(e.init);return;case"ExpressionStatement":this.#S(t.expression);return;case"IfStatement":this.#S(t.condition),this.#ut(t.then),t.otherwise&&this.#ut(t.otherwise);return;case"WhileStatement":case"DoStatement":this.#S(t.condition),this.#ut(t.body);return;case"ForStatement":if(t.init&&!Array.isArray(t.init))this.#ut(t.init);else for(let e of t.init??[])this.#S(e);t.condition&&this.#S(t.condition);for(let e of t.update)this.#S(e);this.#ut(t.body);return;case"ForEachStatement":this.#S(t.iterable),this.#ut(t.body);return;case"LabeledStatement":this.#ut(t.body);return;case"SwitchStatement":this.#ts(t);return;case"YieldStatement":this.#S(t.value);return;case"ReturnStatement":t.value&&this.#S(t.value);return;case"ConstructorCall":for(let e of t.args)this.#S(e);if(t.target)for(let e of t.target.throws)this.#Ot(e,t.thisPos);return;case"AssertStatement":this.#S(t.condition),t.message&&this.#S(t.message);return;case"LocalClass":return;case"ThrowStatement":{this.#S(t.expression);let e=ht(t.expression),n=e.kind==="Name"&&e.symbol?.kind==="local"&&!e.symbol.reassigned?this.#Gt.get(e.symbol):void 0;if(n)for(let s of n)this.#Ot(s,t.pos);else t.expression.type&&this.#Ot(t.expression.type,t.pos);return}case"TryStatement":this.#$r(t);return;case"BreakStatement":case"ContinueStatement":case"EmptyStatement":return}}#ts(t){this.#S(t.selector);for(let e of t.cases){for(let n of e.statements)this.#ut(n);e.body?.kind==="Block"?this.#ut(e.body):e.body&&this.#S(e.body)}}#$r(t){let n={caught:t.catches.flatMap(r=>r.caught??[]),thrown:[]};this.#T.push(n);for(let r of t.resources)r.kind==="declaration"?this.#S(r.init):this.#S(r.expression);this.#ut(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.#Mr(a))this.#Ot(c,r.pos,[` exception thrown from implicit call to close() on resource variable \'${o}\'`])}this.#T.pop();let s=[];for(let r of t.catches){if(r.types.forEach((a,o)=>{let c=r.caught?.[o];if(!c||!this.#Ne(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.#p.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.#Gt.set(r.symbol,n.thrown.filter(o=>a.some(c=>H(o,c))&&!s.some(c=>H(o,c))))}s.push(...r.caught??[]),this.#ut(r.block)}t.finallyBlock&&this.#ut(t.finallyBlock)}#Mr(t){return t?.tag==="library"?this.#Sn(t.symbol.methods.find(n=>n.name==="close"&&!n.params.length)?.throws):!t||t.tag!=="class"?[]:this.#kt(t.symbol,"close").find(n=>n.params.length===0)?.throws??[]}#Sn(t){return(t??[]).map(e=>X(this.#b.get(e)))}#Qe(t){for(let e of t.elements)e.kind==="ArrayInitializer"?this.#Qe(e):this.#S(e)}#S(t){switch(t.kind){case"MethodCall":t.target&&this.#S(t.target);for(let e of t.args)this.#S(e);if(t.method)for(let e of t.method.throws)this.#Ot(e,t.pos);for(let e of this.#Sn(t.libraryCall?.throws))this.#Ot(e,t.pos);return;case"NewObject":for(let e of t.args)this.#S(e);if(t.ctor)for(let e of t.ctor.throws)this.#Ot(e,t.pos);for(let e of this.#Sn(t.libraryCall?.throws))this.#Ot(e,t.pos);return;case"MethodRef":t.receiver&&this.#S(t.receiver),t.lambda&&this.#S(t.lambda);return;case"Lambda":if(t.method){let e=t.method.declaration.body;this.#Ee([],()=>{for(let n of e.statements)this.#ut(n)})}return;case"SwitchExpression":this.#ts(t);return;case"FieldAccess":this.#S(t.target);return;case"Unary":case"IncDec":this.#S(t.operand);return;case"Binary":this.#S(t.left),this.#S(t.right);return;case"Assignment":this.#S(t.target),this.#S(t.value);return;case"Parenthesized":this.#S(t.expression);return;case"ArrayAccess":this.#S(t.array),this.#S(t.index);return;case"NewArray":for(let e of t.dimensions)this.#S(e);t.initializer&&this.#Qe(t.initializer);return;case"Cast":this.#S(t.expression);return;case"Conditional":this.#S(t.condition),this.#S(t.whenTrue),this.#S(t.whenFalse);return;case"InstanceOf":this.#S(t.expression);return;case"ClassLiteral":case"Literal":case"Name":case"This":case"Super":return}}#es(t){this.#a=t;let e=t.constructors.some(r=>!r.declaration.synthetic),n=this.#ns(t,!0),s=this.#ns(t,!1);this.#Nt.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.#z.push([r.declarator.pos,`variable ${r.name} might not have been initialized`]):!e&&!t.isRecord&&!s.get(r)?.assigned&&this.#z.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.#Ze(r.symbol);for(let r of this.#Mt.get(t)??[])this.#Ze(r)}#ns(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=ur();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.#v=new Map,this.#q=0,this.#W=[],this.#D=n;let o=this.#be(a.body.statements,s,!0);o.completes||this.#ge(a.pos,"initializer must be able to complete normally");let c=ur();for(let u of n.values())yn(o.after,u)&&c.vars.add(u),Bn(o.after,u)&&c.unassigned.add(u);s=c}this.#D=new Map;let r=new Map;for(let[a,o]of n)r.set(a,{assigned:yn(s,o),unassigned:Bn(s,o)});return r}#Ze(t){let e=ur();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.#v=new Map,this.#q=0,this.#W=[],this.#D=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.#Nt.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.#D.size;this.#D.set(c,u);let m=o?.get(c);m?.assigned&&e.vars.add(u),(!m||m.unassigned)&&e.unassigned.add(u)}}let a=this.#be(n.statements,e,!0);if(a.completes&&!a.recovery&&t.returnType.tag!=="void"&&!t.lambda&&this.#ge(t.declaration.closeBracePos??n.end-1,"missing return statement"),r){for(let[o,c]of this.#D)yn(a.after,c)||this.#Ce(t.declaration.closeBracePos??n.end-1,`variable ${o.name} might not have been initialized`);for(let o of this.#W)for(let[c,u]of this.#D)yn(o.state,u)||this.#Ce(o.pos,`variable ${c.name} might not have been initialized`)}this.#D=new Map}#be(t,e,n){let s=e,r=n,a=!1;for(let o of t){r||(this.#ge(Xi(o),"unreachable statement"),r=!0,a=!0,s=Ht());let c=this.#Ct(o,s,r);s=c.after,r=c.completes,c.recovery&&(a=!0)}return{after:s,completes:r,...a&&r?{recovery:!0}:{}}}#Ct(t,e,n){switch(t.kind){case"Block":return this.#be(t.statements,e,n);case"LocalVariableDeclaration":return{after:this.#is(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.#ht(t.condition,e),r=this.#Ct(t.then,s.whenTrue,n);if(!t.otherwise)return{after:xt(r.after,s.whenFalse),completes:n};let a=this.#Ct(t.otherwise,s.whenFalse,n);return{after:xt(r.after,a.after),completes:r.completes||a.completes}}case"WhileStatement":return this.#ss(t,t.condition,t.body,[],e,n);case"ForStatement":{let s=e;if(t.init&&!Array.isArray(t.init))s=this.#is(t.init,s);else for(let r of t.init??[])s=this.#x(r,s);return this.#ss(t,t.condition,t.body,t.update,s,n)}case"DoStatement":return this.#Rr(t,e,n);case"ForEachStatement":return this.#Jr(t,e,n);case"LabeledStatement":{let s=this.#Ae(t),r=this.#Ct(t.body,e,n);return{after:xt(r.after,...s.breaks),completes:r.completes||s.breaks.length>0}}case"SwitchStatement":return this.#Dr(t,e,n);case"YieldStatement":{let s=this.#x(t.value,e);return t.target&&this.#v.get(t.target)?.yields.push(s),{after:Ht(),completes:!1}}case"BreakStatement":return t.target&&this.#v.get(t.target)?.breaks.push(e),{after:Ht(),completes:!1};case"ContinueStatement":return t.target&&this.#v.get(t.target)?.continues.push(e),{after:Ht(),completes:!1};case"ReturnStatement":{let s=t.value?this.#x(t.value,e):e;return this.#D.size&&this.#W.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.#ht(t.condition,e);return t.message&&this.#x(t.message,s.whenFalse),{after:e,completes:n}}case"TryStatement":return this.#Pr(t,e,n);case"LocalClass":return{after:e,completes:n}}}#Pr(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.#Ct(t.block,s,n);t.blockCompletes=r.completes;let a=[r],o=h=>{let f=Pe(e);if(!h.all)for(let p of[...f.unassigned])h.unassigned.has(p)||f.unassigned.delete(p);return f};for(let h of t.catches){let f=o(r.after);h.symbol&&(f=Ae(f,h.symbol.index));let p=this.#Ct(h.block,f,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.#Ct(t.finallyBlock,o(xt(r.after,...a.map(h=>h.after))),n);return{after:So(u,m.after),completes:c.length>0&&m.completes}}#Ae(t){let e={breaks:[],continues:[],yields:[]};return this.#v.set(t,e),e}#xn(t,e){let n=e(t,!0),s=[...t.unassigned].some(o=>!Bn(n.backEdge,o));if(!this.#D.size||t.all||!s)return n.result;let r=Pe(t);for(let o of[...r.unassigned])Bn(n.backEdge,o)||r.unassigned.delete(o);this.#q++;let a=e(r,!1);return this.#q--,a.result}#ss(t,e,n,s,r,a){return this.#xn(r,(o,c)=>{let u=e?this.#ht(e,o):{whenTrue:o,whenFalse:Ht()},m=e?e.constant:gt(!0),h=a&&!ys(m);c&&a&&!h&&this.#ge(Xi(n),"unreachable statement");let f=this.#Ae(t),p=this.#Ct(n,h?u.whenTrue:Ht(),!0),C=xt(p.after,...f.continues);for(let T of s)C=this.#x(T,C);return{backEdge:C,result:{after:xt(u.whenFalse,...f.breaks),completes:a&&(!Dn(m)||f.breaks.length>0)}}})}#Rr(t,e,n){return this.#xn(e,s=>{let r=this.#Ae(t),a=this.#Ct(t.body,s,n),o=xt(a.after,...r.continues),c=this.#ht(t.condition,o),u=a.completes||r.continues.length>0;return{backEdge:c.whenTrue,result:{after:xt(c.whenFalse,...r.breaks),completes:n&&(u&&!Dn(t.condition.constant)||r.breaks.length>0)}}})}#Jr(t,e,n){let s=this.#x(t.iterable,e);return this.#xn(s,r=>{let a=this.#Ae(t),o=t.symbol?Ae(r,t.symbol.index):r,c=this.#Ct(t.body,o,n);return{backEdge:xt(c.after,...a.continues),result:{after:xt(r,...a.breaks),completes:n}}})}#Dr(t,e,n){let s=this.#rs(t,this.#x(t.selector,e)),r=this.#Ae(t),a=[],o=!1;if(t.cases[0]?.arrow)for(let c of t.cases){let u=c.body,m=u.kind==="Block"?this.#Ct(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.#be(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}}#rs(t,e){let n=e;for(let s of t.cases)s.guard&&(n=xt(n,this.#x(s.guard,n)));return n}#Fr(t,e){let n=this.#rs(t,this.#x(t.selector,e)),s=this.#Ae(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.#be(o.statements,n,!0).completes&&this.#ge(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.#be(o.statements,c,!0)}a?.completes&&this.#ge(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.#ge(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()}#vn(t,e){let n=e;for(let s of t.elements)n=s.kind==="ArrayInitializer"?this.#vn(s,n):this.#x(s,n);return n}#is(t,e){let n=e;for(let s of t.declarators){let r=s.symbol;r&&(n=xo(n,r.index));let a=s.init;a&&(n=a.kind==="ArrayInitializer"?this.#vn(a,n):this.#x(a,n),r&&(n=Ae(n,r.index)))}return n}#ht(t,e){if(Dn(t.constant))return{whenTrue:e,whenFalse:Ht()};if(ys(t.constant))return{whenTrue:Ht(),whenFalse:e};if(t.kind==="Parenthesized")return this.#ht(t.expression,e);if(t.kind==="Unary"&&t.operator==="!"){let s=this.#ht(t.operand,e);return{whenTrue:s.whenFalse,whenFalse:s.whenTrue}}if(t.kind==="Binary"&&t.operator==="&&"){let s=this.#ht(t.left,e),r=this.#ht(t.right,s.whenTrue);return{whenTrue:r.whenTrue,whenFalse:xt(s.whenFalse,r.whenFalse)}}if(t.kind==="Binary"&&t.operator==="||"){let s=this.#ht(t.left,e),r=this.#ht(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.#ht(t.condition,e),r=this.#ht(t.whenTrue,s.whenTrue),a=this.#ht(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}}#wn(t,e,n){return t.binding||yn(n,t.index)?n:(this.#Ce(e,`variable ${t.name} might not have been initialized`),Ae(n,t.index))}#tn(t){if(!this.#D.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.#D.get(e);return e&&n!==void 0?{field:e,index:n}:null}#en(t,e,n){if(yn(n,t.index))return n;this.#Ce(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.#wn(r,t.capturedAt[a],n));let s=[this.#v,this.#q,this.#W,this.#D];return t.method&&this.#Ze(t.method),[this.#v,this.#q,this.#W,this.#D]=s,n}case"MethodRef":{let n=t.receiver?this.#x(t.receiver,e):e,s=[this.#v,this.#q,this.#W,this.#D];return t.lambda?.method&&this.#Ze(t.lambda.method),[this.#v,this.#q,this.#W,this.#D]=s,n}case"Name":{if(t.symbol?.kind==="local"&&!t.constant)return this.#wn(t.symbol,t.pos,e);let n=this.#tn(t);return n?this.#en(n,t.pos,e):e}case"Parenthesized":return this.#x(t.expression,e);case"FieldAccess":{let n=this.#tn(t);return n?this.#en(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.#ht(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.#ht(t,e);return xt(n.whenTrue,n.whenFalse)}return this.#x(t.operand,e);case"IncDec":{let n=this.#tn(ht(t.operand));return n?this.#as(n,ht(t.operand).pos,this.#en(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.#vn(t.initializer,n):n}case"SwitchExpression":return this.#Fr(t,e);case"Binary":{if(t.operator==="&&"||t.operator==="||"){let n=this.#ht(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.#wn(n.symbol,n.pos,e);return r=this.#x(t.value,r),n.symbol.isFinal&&n.symbol.forEach&&this.#Ce(n.pos,`variable ${n.symbol.name} might already have been assigned`),Ae(r,n.symbol.index)}let s=this.#tn(n);if(s){let r=t.operator==="="?e:this.#en(s,n.pos,e);return r=this.#x(t.value,r),this.#as(s,n.pos,r)}return this.#x(t.value,this.#x(t.target,e))}}}#as(t,e,n){if(!Bn(n,t.index)){let s=this.#q?"might be assigned in loop":"might already have been assigned";this.#Ce(e,`variable ${t.field.name} ${s}`)}return Ae(n,t.index)}};function he(i,t){return`${i}(${t.map(xn).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 vo(i){return i.qualifiedName==="java.lang.String"?"String":i.qualifiedName}function xn(i){switch(i.tag){case"typevar":return i.symbol?xn(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 xn(i.element)+"[]";default:return P(i)}}function aa(i){return i.tag==="typevar"&&i.symbol?i.symbol.bounds.some(t=>aa(t)||t.tag==="library"&&t.symbol.name==="Comparable"):i.tag==="class"?i.symbol.isEnum||hn(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 mr(i){if(i.kind==="Name")return i.identifier;if(i.kind!=="FieldAccess")return null;let t=mr(i.target);return t===null?null:`${t}.${i.name}`}function gn(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 Vn={tag:"typevar",name:"?return"};function re(i,t){switch(i.tag){case"typevar":return t===null?!i.symbol:t.includes(hs(i));case"class":return i.args?.some(e=>re(e,t))??!1;case"array":return re(i.element,t);case"wildcard":return i.bound!==null&&re(i.bound,t);case"library":return i.args.some(e=>re(e,t));default:return!1}}function Ss(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 wo(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 ko(i){return i.kind==="MethodCall"||i.kind==="Assignment"||i.kind==="IncDec"||i.kind==="NewObject"}function Ke(i){if(i.kind==="Name")return[i.identifier];if(i.kind==="FieldAccess"){let t=Ke(i.target);return t?[...t,i.name]:null}return null}var oa=new Set(["type","symbol","method","constant","libraryCall","ctor","fieldSymbol","captures","functional","caught","finallySlots","lambda","receiver","mathFunction","interfaceSymbol","imported"]);function vs(i,t){if(Array.isArray(i)){for(let n of i)vs(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))oa.has(n)||s===null||typeof s!="object"||vs(s,t)}function Co(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))!oa.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=hs(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:Z(t)?gr(t):t.tag==="wildcard"?t:Wt(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"&&!Z(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"?ze(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"&&!pr(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=ne(t,i.symbol);s?.args&&i.args.forEach((r,a)=>s.args[a]&&bt(r,n(s.args[a]),e))}}function pr(i){return i.tag==="wildcard"&&i.poly!==void 0}function Eo(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 gr(i){return i.tag==="library"&&i.args.some(pr)?{...i,args:i.args.map(t=>pr(t)?t.bound:t)}:i}function xs(i,t,e=!1){let n=new Map;if(t?.tag!=="library")return n;let s=ft(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 hr(i,t){let e=new Map;if(!t)return e;let n=ce(i);if(t.tag==="class"){let s=ne(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=ze(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 Qi(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=Z(o)?gr(o):Wt(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 Zi(i,t,e){if(!zn([t]).length||!Z(e))return;let n=q(e);n.tag!=="object"&&n.tag!=="null"&&!H(q(t),n)&&(i.genericCast=n)}function Ao(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 br(i,e,n,new Set)}function br(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?Oo(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=>br(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 la(c,o.map(u=>u.components),n)}return!1}function la(i,t,e){if(!i.length)return t.length>0;let[n,...s]=i;return ca(n).every(r=>{let a=t.filter(o=>Io(o[0],r,e));return la(s,a.map(o=>o.slice(1)),e)})}function ca(i){return i.tag==="class"&&i.symbol.isSealed&&i.symbol.isAbstract&&i.symbol.permitted?i.symbol.permitted.flatMap(t=>ca(X(t))):[i]}function Io(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"&&br(t,[i],[],e)}function Oo(i){return i.symbol?.bounds[0]??G}function yr(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(...yr(n,t),n);return e}function ta(i){return i.declaration.params[i.declaration.params.length-1]?.varargs===!0}function ea(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 Lo(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 Sn(i){switch(i.tag){case"typevar":return!1;case"array":return Sn(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 No(i,t){let e=n=>n.tag!=="wildcard"&&n.tag!=="typevar"&&Sn(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=ne(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 $o(i){return i.tag==="string"||i.tag==="class"||i.tag==="array"||i.tag==="library"&&i.symbol.box!==void 0}function na(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 Hn(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 bn(i,t){if(i.tag==="array"&&t.tag==="array")return Z(i.element)&&bn(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 Mo(i,t){let e=!1;return vs(i,n=>{n===t&&(e=!0)}),e}function dr(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"?$n(r):r.tag==="library"?ar(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 Po(i){return i.tag==="wildcard"?i.bound??G:i}function Ie(i){return i.tag==="wildcard"?i.isSuper?G:i.bound??G:i}function zn(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=zn(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 Ro(i,t,e,n){if(rt(i,t))return i;if(i.tag==="byte"&&t.tag==="short"||i.tag==="short"&&t.tag==="byte")return dn;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:Gn(i,t)}function sa(i,t){return rt(i,t)?i:i.tag==="null"?t:t.tag==="null"?i:G}function Tn(i,t){return Ot(t)?Ui(i,t.tag)??i:i}function Jo(i,t,e){let n=Tn(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 Do(i,t,e,n){if(i==="+"&&(t.kind==="string"||e.kind==="string"))return or(Pn(t)+Pn(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=mn(t),h=mn(e);if(m===void 0||h===void 0)return;let f=BigInt(Number(BigInt.asUintN(6,h)));return i==="<<"?Nt(m<<f):i===">>"?Nt(m>>f):Nt(BigInt.asUintN(64,m)>>f)}let c=mn(t),u=mn(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?ps(t):Jn(t),m=c?ps(e):Jn(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=fn(t),o=t.kind==="long"||e.kind==="long"?e.kind==="long"?Number(BigInt.asIntN(32,e.value)):fn(e):fn(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},Fo=[[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},Tr=["int","long","double","char","boolean","float","byte","short"],at={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},jo=[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},We={};for(let[i,t]of Object.entries(l))We[t]={name:i,operands:0,pop:0,push:0};var _=(i,t,e,n)=>Object.assign(We[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 Sr={[l.IF_CMP]:2,[l.IF_K]:3,[l.IF_LL]:4,[l.IF_LK]:4,[l.IF_LNULL]:3,[l.IINC_JUMP]:3},_o={[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]},xr=new Set([l.IMUL,l.IDIV,l.IREM,l.IAND,l.IOR,l.IXOR,l.ISHL,l.ISHR,l.IUSHR]),Uo=new Set([l.IF_CMP,l.IF_K,l.IF_LL,l.IF_LK]),Bo=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]),Vo=new Set([l.ALOAD,l.ASTORE,l.INVOKE,l.INVOKE_VIRTUAL,l.GETFIELD,l.PUTFIELD,l.INVOKE_NATIVE,l.UNBOX,l.STR_COMPARETO]),tt=class extends Error{constructor(t){super(`invalid bytecode: ${t}`),this.name="BytecodeError"}};function ua(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=We[s[m]];if(!h)throw new tt(`unknown opcode ${s[m]} at ${m}`);if(r.add(m),m+=1+h.operands,m>s.length)throw new tt("truncated instruction at end")}let a=new Map,o=[[0,0]],c=i.handlers??new Int32Array(0);if(c.length%4!==0)throw new tt("bad handler table");for(let m=0;m<c.length;m+=4){let[h,f,p,C]=[c[m],c[m+1],c[m+2],c[m+3]];if(!r.has(h)||!(r.has(f)||f===s.length)||f<=h||!r.has(p))throw new tt(`bad handler ${m/4}`);if(C<-1||C>=t.strings.length)throw new tt(`bad handler type ${m/4}`);o.push([p,1])}let u=0;for(;o.length;){let[m,h]=o.pop(),f=m,p=h;for(;;){if(!r.has(f))throw new tt(`control reaches non-instruction offset ${f}`);let C=a.get(f);if(C!==void 0){if(C!==p)throw new tt(`stack height ${p} != ${C} at merge ${f}`);break}a.set(f,p);let T=s[f],w=We[T],x=w.pop,k=w.push;if(T===l.PRINT&&(x=s[f+3]===wt.NONE?0:1),T===l.NEWMULTI&&(x=s[f+2]),T===l.MATH){let O=jo[s[f+1]];if(O===void 0)throw new tt(`bad Math function at ${f}`);x=O}if(T===l.INVOKE||T===l.INVOKE_VIRTUAL){let O=t.methods[s[f+1]];if(!O)throw new tt(`call to unknown method ${s[f+1]} at ${f}`);x=O.argCount,k=O.returnsValue?1:0}if(T===l.INVOKE_NATIVE){let O=t.natives?.[s[f+1]];if(!O)throw new tt(`call to unknown native ${s[f+1]} at ${f}`);x=O.argCount,k=O.returnsValue?1:0}if((T===l.BOX||T===l.UNBOX)&&(s[f+1]<0||s[f+1]>=Tr.length))throw new tt(`bad box kind at ${f}`);if(T===l.LAMBDA){let O=t.methods[s[f+1]],R=s[f+2];if(!O||R<0||R>O.argCount)throw new tt(`bad lambda method at ${f}`);if(s[f+3]<0||s[f+3]>=t.strings.length||s[f+5]>=t.strings.length)throw new tt(`bad lambda interface at ${f}`);x=R}if(T===l.NEW&&(s[f+1]<0||s[f+1]>=e.length))throw new tt(`bad class index at ${f}`);if(T===l.INVOKE_VIRTUAL&&t.methods[s[f+1]]?.selector===void 0)throw new tt(`virtual call to a method without a selector at ${f}`);if(T===l.THROWABLE){let O=Fo[s[f+1]];if(!O)throw new tt(`bad Throwable operation at ${f}`);[x,k]=O}if(T===l.OBJ_SUPER){let O=s[f+1];if(O<0||O>2)throw new tt(`bad Object method at ${f}`);x=O===2?2:1}if((T===l.NEWARRAY_REF||T===l.NEWMULTI||T===l.CHECKCAST||T===l.INSTANCEOF)&&(s[f+1]<0||s[f+1]>=t.strings.length))throw new tt(`bad descriptor index at ${f}`);if(T===l.NEWMULTI&&s[f+2]<2)throw new tt(`NEWMULTI needs two or more lengths at ${f}`);if(T===l.NCONST&&(s[f+1]<0||s[f+1]>=(t.numbers?.length??0)))throw new tt(`bad number index at ${f}`);if(p<x)throw new tt(`stack underflow at ${f} (${w.name})`);if(p=p-x+k,u=Math.max(u,p),T===l.LOAD||T===l.STORE||T===l.IINC){let O=s[f+1];if(O<0||O>=i.maxLocals)throw new tt(`bad local slot ${O} at ${f}`)}for(let O of _o[T]??[]){let R=s[f+O];if(R<0||R>=i.maxLocals)throw new tt(`bad local slot ${R} at ${f}`)}if(T===l.IOPK&&!xr.has(s[f+1]))throw new tt(`bad operator at ${f}`);if(T===l.IOPK&&(s[f+1]===l.IDIV||s[f+1]===l.IREM)&&s[f+2]===0)throw new tt(`division by a zero constant at ${f}`);if(Uo.has(T)&&(s[f+1]<0||s[f+1]>11))throw new tt(`bad condition at ${f}`);if(T===l.ALOAD_LL&&(s[f+4]<-1||s[f+4]>=t.messages.length))throw new tt(`bad message index at ${f}`);if(T===l.SCONST&&(s[f+1]<0||s[f+1]>=t.strings.length))throw new tt(`bad string index at ${f}`);if(T===l.GETSTATIC||T===l.PUTSTATIC||T===l.GETFIELD||T===l.PUTFIELD){let O=T<=l.PUTSTATIC?t.staticFieldIsReference?.length??0:n;if(s[f+1]<0||s[f+1]>=O)throw new tt(`bad field index at ${f}`)}let I=Vo.has(T)?s[f+2]:Bo.has(T)?s[f+1]:null;if(I!==null&&(I<-1||I>=t.messages.length))throw new tt(`bad message index at ${f}`);if(T===l.RETURN||T===l.RETURN_VALUE){if(T===l.RETURN_VALUE!==i.returnsValue)throw new tt(`wrong return kind at ${f}`);if(p!==0)throw new tt(`return with non-empty stack at ${f}`);break}if(T===l.ATHROW)break;let L=f+1+w.operands,$=Sr[T];if($!==void 0){let O=s[f+$];if(!r.has(O))throw new tt(`jump to ${O} at ${f}`);if(o.push([O,p]),T===l.IINC_JUMP)break}if(T===l.JUMP||T===l.JUMP_IF_FALSE||T===l.JUMP_IF_TRUE){let O=s[f+1];if(!r.has(O))throw new tt(`jump to ${O} at ${f}`);if(o.push([O,p]),T===l.JUMP)break}if(L>=s.length)throw new tt(`falls off the end at ${f}`);f=L}}return u}function ha(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 Ho=l.ICMPEQ,ws=i=>i!==void 0&&i>=l.ICMPEQ&&i<=l.ICMPGE,ks=(i,t)=>i-Ho+(t===l.JUMP_IF_FALSE?6:0),qn=i=>i===l.JUMP_IF_FALSE||i===l.JUMP_IF_TRUE;function da(i){let t=i.code,e=[];for(let u=0;u<t.length;u+=1+We[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=k=>e[u+k],h=k=>m(k)===void 0?void 0:t[m(k)],f=(k,I=1)=>t[m(k)+I],p=k=>{for(let I=1;I<k;I++)if(m(I)===void 0||n.has(m(I)))return!1;return!0},C=(k,...I)=>{let L=r.length;for(let O=0;O<k;O++)a.set(m(O),L);r.push(...I);let $=Sr[I[0]];$!==void 0&&o.push(L+$),u+=k},T=h(0);if(T===l.LOAD&&h(1)===l.LOAD&&ws(h(2))&&qn(h(3))&&p(4)){C(4,l.IF_LL,ks(h(2),h(3)),f(0),f(1),f(3));continue}if(T===l.LOAD&&h(1)===l.ICONST&&ws(h(2))&&qn(h(3))&&p(4)){C(4,l.IF_LK,ks(h(2),h(3)),f(0),f(1),f(3));continue}if(T===l.LOAD&&h(1)===l.ACONST_NULL&&(h(2)===l.ACMPEQ||h(2)===l.ACMPNE)&&qn(h(3))&&p(4)){let k=h(2)===l.ACMPEQ==(h(3)===l.JUMP_IF_TRUE);C(4,l.IF_LNULL,k?1:0,f(0),f(3));continue}if(T===l.ICONST&&ws(h(1))&&qn(h(2))&&p(3)){C(3,l.IF_K,ks(h(1),h(2)),f(0),f(2));continue}if(ws(T)&&qn(h(1))&&p(2)){C(2,l.IF_CMP,ks(T,h(1)),f(1));continue}if(T===l.LOAD&&h(1)===l.LOAD&&h(2)===l.ALOAD&&p(3)){C(3,l.ALOAD_LL,f(0),f(1),f(2),f(2,2));continue}if(T===l.ICONST&&(h(1)===l.IADD||h(1)===l.ISUB)&&p(2)){C(2,l.IADDK,h(1)===l.IADD?f(0):-f(0)|0);continue}if(T===l.ICONST&&xr.has(h(1))&&p(2)&&!((h(1)===l.IDIV||h(1)===l.IREM)&&f(0)===0)){C(2,l.IOPK,h(1),f(0));continue}if(T===l.IINC&&h(1)===l.JUMP&&p(2)){C(2,l.IINC_JUMP,f(0),f(0,2),f(1));continue}if(T===l.LOAD&&h(1)===l.LOAD&&p(2)){C(2,l.LOAD2,f(0),f(1));continue}if(T===l.LOAD&&h(1)===l.ICONST&&p(2)){C(2,l.LOADK,f(0),f(1));continue}let w=m(0),x=1+We[T].operands;a.set(w,r.length),(T===l.JUMP||T===l.JUMP_IF_FALSE||T===l.JUMP_IF_TRUE)&&o.push(r.length+1);for(let k=0;k<x;k++)r.push(t[w+k]);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 zo=["getMessage","getLocalizedMessage","getCause","toString","fillInStackTrace"];function Cr(i,t){return i.declaration.members.filter(e=>e.kind==="Initializer"&&e.isStatic===t&&e.symbol!==void 0)}function fa(i){return Math.max(i.maxSlots,i.finallySlots??0)}function Ar(i,t,e){let n=new Er(t),s=i.classes.find(f=>f.binaryName==="java.lang.Throwable");n.useThrowable(s);let r=i.methods.map(f=>f.builtin?n.builtin(f):f.isAbstract?n.abstractStub(f):f.isConstructor?n.constructorCode(f):n.method(f)),a=Ko(i),o=f=>i.selectors.get(f)??-1,c=i.classes.map(f=>{let p=f.fields.filter(L=>L.isStatic&&L.declarator.init&&!L.constant),C=Cr(f,!0),T=p.length||f.enumConstants.length||C.length?r.push(n.staticInitializer(f,p))-1:-1,w=new Array(f.instanceCount).fill(!1);for(let L=f;L;L=L.superclass){L.outerField>=0&&(w[L.outerField]=!0);for(let $ of L.fields)$.isStatic||(w[$.index]=As($.type));L===s&&w.fill(!0,ut.message,ut.causeSet)}let x=a.get(f),k=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===f)&&(I[R]=L)}),{name:f.binaryName,instanceFieldIsReference:w,clinit:T,toString:k("toString()"),equals:k("equals(Object)"),hashCode:k("hashCode()"),superclass:f.superclass?.index??-1,isInterface:f.isInterface,types:qo(f),vtable:x,virtuals:I,...f.isEnum?{enumConstants:f.enumConstants.map(L=>L.index),canonicalName:f.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(f=>As(f.type)),staticFieldOwner:i.staticFields.map(f=>f.owner.index),entry:u,uncaught:m};for(let f of r)da(f),f.maxStack=ua(f,h);return h}function Ko(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 qo(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 ma=["int","byte/boolean","char","object","long","double","byte/boolean","short","float"];function ie(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"["+ie(i.element);case"typevar":return ie(q(i));default:throw new Error(`codegen: descriptor of ${P(i)}`)}}function Wn(i){return i.tag==="class"?i.symbol.binaryName:i.tag==="array"?Wn(i.element)+"[]":P(i)}function Le(i){let t=i;for(;t.kind==="Parenthesized";)t=t.expression;return t}function vr(i){let t=Le(i);return t.kind==="Name"&&t.symbol?.kind==="type"||t.kind==="FieldAccess"&&t.typeSymbol!==void 0}function wr(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 Wo=new Set(["int","byte","short","char","long","float","double"]),Xn=i=>i!==void 0&&Wo.has(i.tag),kr=i=>i.tag==="int"||i.tag==="byte"||i.tag==="short"||i.tag==="char",we=i=>Xn(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},Xo={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()"},Yo={"+":{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}},Cs={"<":l.ICMPLT,"<=":l.ICMPLE,">":l.ICMPGT,">=":l.ICMPGE,"==":l.ICMPEQ,"!=":l.ICMPNE},Qo={"abs-int":at.ABS_I,"abs-long":at.ABS_L,"abs-double":at.ABS_D,"max-int":at.MAX_I,"max-long":at.MAX_L,"max-double":at.MAX_D,"min-int":at.MIN_I,"min-long":at.MIN_L,"min-double":at.MIN_D,"abs-float":at.ABS_D,"max-float":at.MAX_D,"min-float":at.MIN_D,"round-float":at.ROUND_F,sqrt:at.SQRT,floor:at.FLOOR,ceil:at.CEIL,"round-double":at.ROUND},Es=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}},Er=class{strings=[];numbers=[];natives=[];#A=new Map;messages=[];#dt=new Map;#Lt=new Map;#M=new Map;#R;get#ot(){return this.#r?.topLevel?.file??this.#R}#r;#h=[];#s=[];#n=-1;#m=new Map;#u=U;#i=0;#j=!1;#N=[];#d=0;#b=0;#et=0;#I=0;#K=[];#_=[];#ft=Object.create(null);constructor(t){this.#R=t}#lt(t){return`${t.owner.binaryName}.${t.name}(${t.params.map(Wn).join(", ")})`}#st(t,e){return`${t.qualifier??e.owner.binaryName}.${e.name}(${e.params.map(Wn).join(", ")})`}#g(t,e,n){this.#r=t,this.#h=[],this.#s=[],this.#n=-1,this.#m=new Map,this.#u=n,this.#i=e,this.#N=[],this.#d=0,this.#b=0,this.#et=0,this.#I=0,this.#K=[],this.#_=[]}useThrowable(t){for(let e of t.methods)zo.includes(e.name)&&(this.#ft[e.name]=e)}#ee(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)])}#yt(t,e){let n={className:t.binaryName,classIndex:t.index,isStatic:e.isStatic,name:e.name,display:e.display,file:this.#ot.name,argCount:e.argCount,returnsValue:e.returnsValue,code:Int32Array.from(this.#h),lines:Int32Array.from(this.#s),maxLocals:Math.max(1,this.#i+this.#I),maxStack:0};return e.hidden&&(n.hidden=!0),this.#K.length&&(n.handlers=Int32Array.from(this.#K)),n}#a(t){return t.parameter!==void 0?`<parameter${t.parameter}>`:`<local${this.#o(t)}>`}#o(t){let e=t.slot;for(let n of this.#N)t.slot>=n.from&&(e+=n.by);return e}#U(){let t=this.#i+this.#et++;return this.#I=Math.max(this.#I,this.#et),t}#Y(){this.#et--}staticInitializer(t,e){this.#g(t,Math.max(1,...Cr(t,!0).map(n=>fa(n.symbol))),U);for(let n of t.enumConstants){let{node:s,ordinal:r}=n.enumConstant;this.#y(s.pos),this.#t(l.NEW,s.ctor.owner.index,l.DUP,l.SCONST,this.#T(s.name),l.ICONST,r),this.#X(s.args,s.ctor.params,s.varargs),this.#t(l.INVOKE,s.ctor.index,-1,l.PUTSTATIC,n.index)}return this.#Nt(t,!0,n=>e.includes(n),0),this.#t(l.RETURN),this.#yt(t,{name:"<clinit>",display:`${t.binaryName}.<clinit>()`,isStatic:!0,argCount:0,returnsValue:!1})}#Nt(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.#V(o)}else r.kind==="Initializer"&&r.isStatic===e&&r.symbol&&(s&&this.#N.push({from:1,by:s}),this.#v(r.body),s&&this.#N.pop())}#V(t){let e=t.declarator.init;this.#y(t.declarator.pos),t.isStatic||this.#t(l.LOAD,0),e.kind==="ArrayInitializer"?this.#qt(e):(this.#c(e,!0),this.#B(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((f,p)=>f+(p.tag==="long"||p.tag==="double"?2:1),0),a=Cr(e,!1).map(f=>r-1+fa(f.symbol));this.#g(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.#y(u.start),this.#t(l.LOAD,0),n&&this.#t(l.LOAD,1),n===2&&this.#t(l.LOAD,2),this.#X(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.#y(u.start),this.#t(l.LOAD,0),this.#X(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.#y(o.pos),this.#t(l.LOAD,0),e.enumBody&&this.#t(l.LOAD,1,l.LOAD,2);let f=1+n;for(let p of t.params)this.#t(l.LOAD,f),f+=p.tag==="long"||p.tag==="double"?2:1;this.#t(l.INVOKE,t.superConstructor.index,-1)}}else t.superConstructor&&(this.#y(o.pos),this.#t(l.LOAD,0),this.#X([],t.superConstructor.params,t.superVarargs),this.#t(l.INVOKE,t.superConstructor.index,-1));this.#Nt(e,!1,f=>f.declarator.init!==void 0&&f.declarator.init!==null,r-1)}for(let f of c)this.#v(f);this.#y(o.end-1),t.declaration.compact&&t.declaration.params.forEach((f,p)=>this.#t(l.LOAD,0,l.LOAD,f.symbol.slot,l.PUTFIELD,e.components[p].index,-1)),this.#t(l.RETURN);let m=this.#yt(e,{name:"<init>",display:`${e.binaryName}.<init>(${t.params.map(Wn).join(", ")})`,isStatic:!1,argCount:s,returnsValue:!1}),h=this.#ee(t);return h&&(m.argSlots=h),m}launcher(t){let e=t.main,n=t.mainClass;return this.#g(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.#s=[],this.#yt(n,{name:"<launch>",display:"<launch>",isStatic:!0,argCount:0,returnsValue:!1,hidden:!0})}practiceLauncher(t){let{method:e}=t,n=e.owner;return this.#g(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.#s=[],this.#yt(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.#g(e,Math.max(n,t.maxSlots,t.finallySlots??0),t.returnType),this.#y(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.#T(`[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.#Mt(\'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.#$(e);break;case"record-hashCode":this.#Ht(e);break;case"record-equals":this.#P(e);break;case"throwable-constructor":this.#L(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.#ft.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.#U();this.#t(l.LOAD,0,l.THROWABLE,Mt.CLASS_NAME,l.LOAD,0,l.INVOKE_VIRTUAL,this.#ft.getLocalizedMessage.index,-1,l.STORE,o),this.#t(l.LOAD,o,l.ACONST_NULL,l.ACMPEQ),this.#f(l.JUMP_IF_TRUE,a),this.#t(l.SCONST,this.#T(": "),l.SCONCAT,l.LOAD,o,l.SCONCAT),this.#C(a),this.#t(l.RETURN_VALUE),this.#Y();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.#yt(e,{name:t.isConstructor?"<init>":t.name,display:t.isConstructor?`${e.binaryName}.<init>(${t.params.map(Wn).join(", ")})`:this.#lt(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}#L(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.#ft.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.#f(l.JUMP_IF_TRUE,n),e(ut.message,()=>this.#t(l.LOAD,1,l.INVOKE_VIRTUAL,this.#ft.toString.index,-1)),this.#C(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.#T(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.#T("Ljava.lang.Throwable;")),this.#f(l.JUMP_IF_FALSE,n),e(ut.cause,()=>this.#t(l.LOAD,1)),e(ut.causeSet,()=>this.#t(l.ICONST,1)),this.#C(n);break}}this.#t(l.RETURN)}uncaughtPrinter(t){return this.#g(t,1,U),this.#t(l.LOAD,0,l.THROWABLE,Mt.PRINT_UNCAUGHT,l.RETURN),this.#yt(t,{name:"<uncaught>",display:"<uncaught>",isStatic:!0,argCount:1,returnsValue:!1,hidden:!0})}#k(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)}#$(t){t.components.forEach((e,n)=>{this.#t(l.SCONST,this.#T(`${n===0?`${t.name}[`:", "}${e.name}=`)),n>0&&this.#t(l.SCONCAT),this.#k(e),this.#t(l.SCONCAT)}),this.#t(l.SCONST,this.#T(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.#f(l.JUMP_IF_TRUE,s),this.#t(l.OBJ_HASHCODE,-1),this.#f(l.JUMP,r),this.#C(s),this.#t(l.POP,l.ICONST,0),this.#C(r)}this.#t(l.IADD)}this.#t(l.RETURN_VALUE)}#P(t){let e=new W,n=new W;this.#t(l.LOAD,0,l.LOAD,1,l.ACMPEQ),this.#f(l.JUMP_IF_TRUE,e),this.#t(l.LOAD,1,l.INSTANCEOF,this.#T(`L${t.binaryName};`)),this.#f(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.#f(l.JUMP_IF_FALSE,n);else if(Zt[s.type.tag]!==void 0)r(0),r(1),this.#t(l.ICMPEQ),this.#f(l.JUMP_IF_FALSE,n);else{let a=new W;r(0),r(1),this.#t(l.ACMPEQ),this.#f(l.JUMP_IF_TRUE,a),r(0),this.#t(l.ACONST_NULL,l.ACMPEQ),this.#f(l.JUMP_IF_TRUE,n),r(0),r(1),this.#t(l.OBJ_EQUALS,-1),this.#f(l.JUMP_IF_FALSE,n),this.#C(a)}}this.#C(e),this.#t(l.ICONST,1,l.RETURN_VALUE),this.#C(n),this.#t(l.ICONST,0,l.RETURN_VALUE)}abstractStub(t){let e=t.params.length+(t.isStatic?0:1);this.#g(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.#yt(t.owner,{name:t.name,display:this.#lt(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.#g(t.owner,Math.max(e,t.maxSlots,t.finallySlots??0),t.returnType);let n=t.declaration.body;this.#j=t.lambda?.reference===!0;for(let a of n.statements)this.#v(a);this.#j=!1,t.returnType.tag==="void"&&(this.#y(n.end-1),this.#t(l.RETURN));let s=this.#yt(t.owner,{name:t.name,display:this.#lt(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.#ee(t);return r&&(s.argSlots=r),s}#t(...t){for(let e of t)this.#h.push(e)}#y(t){let{line:e}=rs(this.#ot,t);e!==this.#n&&(this.#n=e,this.#s.push(this.#h.length,e))}#f(t,e){this.#t(t,-1),e.uses.push(this.#h.length-1),e.pc>=0&&(this.#h[this.#h.length-1]=e.pc)}#p(t){t.pc=this.#h.length;for(let e of t.uses)this.#h[e]=t.pc;this.#n=-1}#C(t){t.pc=this.#h.length;for(let e of t.uses)this.#h[e]=t.pc}#T(t){let e=this.#dt.get(t);return e===void 0&&(e=this.strings.length,this.strings.push(t),this.#dt.set(t,e)),e}#Gt(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.#Lt.get(e);n===void 0&&(n=this.numbers.length,this.numbers.push(t),this.#Lt.set(e,n)),this.#t(l.NCONST,n)}#Et(t){switch(t.kind){case"int":case"byte":case"short":case"char":this.#t(l.ICONST,t.value);return;case"long":this.#Gt(vt(t.value));return;case"double":case"float":this.#Gt(t.value);return;case"boolean":this.#t(l.ICONST,t.value?1:0);return;case"string":this.#t(l.SCONST,this.#T(t.value));return}}#J(t,e,n){let s=`${t}/${n}`,r=this.#A.get(s);return r===void 0&&(r=this.natives.length,this.natives.push({name:t,argCount:e,returnsValue:n}),this.#A.set(s,r)),r}#rt(t,e,n,s){let r=-1;e&&(this.#c(e,!0),r=this.#z(`Cannot invoke "${t.display}"`,e));let a=n.length;if(t.varargsFrom===void 0)this.#X(n,t.params);else{let c=t.varargsFrom;this.#X(n.slice(0,c),t.params);let u=t.params[c].element,m=n.slice(c);this.#t(l.ICONST,m.length),this.#It(u),m.forEach((h,f)=>{this.#t(l.DUP,l.ICONST,f),this.#c(h,!0),this.#B(u,h),this.#t(l.ASTORE,Re(u),-1)}),a=c+1}let o=a+(e?1:0);this.#t(l.INVOKE_NATIVE,this.#J(t.native,o,t.returnsValue),r),!s&&t.returnsValue&&this.#t(l.POP)}#St(t){let e=Le(t);switch(e.kind){case"Name":return e.symbol?.kind==="field"?e.outerHops?`${this.#nt(e.outerHops)}.${e.symbol.name}`:this.#$t(e.symbol):e.symbol?.kind!=="local"?null:this.#a(e.symbol);case"FieldAccess":{let n=e.fieldSymbol;if(!n)return null;if(n.isStatic)return this.#$t(n);if(Le(e.target).kind==="This")return`this.${n.name}`;let s=this.#St(e.target);return s===null?null:`${s}.${n.name}`}case"MethodCall":return e.method?this.#st(e,e.method):e.objectMethod?`${e.qualifier??"Object"}.${pa[e.objectMethod]}`:e.libraryCall?e.libraryCall.display:null;case"ArrayAccess":{let n=this.#St(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.#St(s)??"...":"...";return`${n}[${r}]`}case"Cast":return this.#St(e.expression);default:return null}}#$t(t){return t.isStatic?`${t.owner.binaryName}.${t.name}`:`this.${t.name}`}#Mt(t){let e=this.#M.get(t);return e===void 0&&(e=this.messages.length,this.messages.push(t),this.#M.set(t,e)),e}#O(t,e){if(this.#j)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.#St(r)}" is null`;else{let a=this.#St(e);a!==null&&(n+=` because "${a}" is null`)}}let s=this.#M.get(n);return s===void 0&&(s=this.messages.length,this.messages.push(n),this.#M.set(n,s)),s}#z(t,e){return Le(e).kind==="This"?-1:this.#O(t,e)}#v(t){switch(t.kind){case"Block":for(let e of t.statements)this.#v(e);return;case"EmptyStatement":return;case"LocalVariableDeclaration":for(let e of t.declarators)e.init&&(this.#y(e.pos),e.init.kind==="ArrayInitializer"?this.#qt(e.init):(this.#c(e.init,!0),this.#B(e.symbol.type,e.init)),this.#t(l.STORE,this.#o(e.symbol)));return;case"ExpressionStatement":this.#y(t.start),this.#c(t.expression,!1);return;case"IfStatement":{let e=t.condition.constant;if(e&&e.kind==="boolean"){e.value?this.#v(t.then):t.otherwise&&this.#v(t.otherwise);return}this.#y(t.start);let n=new W;if(this.#ct(t.condition,n,!1),this.#v(t.then),t.otherwise){let s=new W;this.#f(l.JUMP,s),this.#p(n),this.#v(t.otherwise),this.#p(s)}else this.#p(n);return}case"WhileStatement":this.#At(t,t.start,t.condition,t.body,[]);return;case"ForStatement":if(t.init&&!Array.isArray(t.init))this.#v(t.init);else for(let e of t.init??[])this.#y(e.start),this.#c(e,!1);this.#At(t,t.start,t.condition,t.body,t.update);return;case"DoStatement":{let e=new W,n=new W,s=new W;this.#m.set(t,{breakLabel:s,continueLabel:n,tryDepth:this.#_.length}),this.#p(e),this.#v(t.body),this.#p(n),this.#y(t.condition.start),this.#ct(t.condition,e,!0),this.#p(s);return}case"ForEachStatement":this.#l(t);return;case"LabeledStatement":{let e=new W;this.#m.set(t,{breakLabel:e,tryDepth:this.#_.length}),this.#v(t.body),this.#p(e);return}case"SwitchStatement":this.#Pt(t,!1);return;case"YieldStatement":{this.#y(t.start);let e=this.#m.get(t.target);this.#c(t.value,!0),this.#B(e.resultType,t.value),this.#f(l.JUMP,e.breakLabel);return}case"BreakStatement":{this.#y(t.start);let e=this.#m.get(t.target);this.#bt(e.tryDepth??0,t.liveSlots,()=>this.#f(l.JUMP,e.breakLabel));return}case"ContinueStatement":{this.#y(t.start);let e=this.#m.get(t.target);this.#bt(e.tryDepth??0,t.liveSlots,()=>this.#f(l.JUMP,e.continueLabel));return}case"ReturnStatement":if(this.#y(t.start),t.value){if(this.#c(t.value,!0),this.#B(this.#u,t.value),!this.#_.length){this.#t(l.RETURN_VALUE);return}let e=this.#U();this.#t(l.STORE,e),this.#bt(0,t.liveSlots,()=>this.#t(l.LOAD,e,l.RETURN_VALUE)),this.#Y()}else this.#bt(0,t.liveSlots,()=>this.#t(l.RETURN));return;case"ConstructorCall":throw new Error("codegen: this(...) outside a constructor prologue");case"ThrowStatement":this.#y(t.start),this.#c(t.expression,!0),this.#t(l.ATHROW,this.#O("Cannot throw exception",t.expression));return;case"AssertStatement":return;case"LocalClass":return;case"TryStatement":this.#D(t);return}}#D(t){let e=t.catches.map(o=>({types:(o.caught??[]).map(c=>ie(c)),body:()=>{this.#t(l.STORE,this.#o(o.symbol)),this.#v(o.block)}})),n=t.finallyBlock,s=t.resources.length?()=>this.#e(t.resources,0,()=>this.#v(t.block)):()=>this.#v(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.#b;m&&(this.#d=Math.max(this.#d,u+r.extent)),m||this.#b++,this.#N.push({from:r.base,by:u-r.base}),this.#v(n),this.#N.pop(),m||this.#b--},anyAt:()=>Math.max(r.before,this.#d)+1,blockCompletes:t.blockCompletes??!0,handlerCompletes:t.catches.map(o=>o.completes??!0)}:null;this.#W(s,e,a)}#q(t){return{run:()=>t(),anyAt:()=>0,blockCompletes:!0,handlerCompletes:[]}}#W(t,e,n){let s=new Es,r=n?new Es:null,a=new W,o={regions:r?[s,r]:[s],finallyBody:n};this.#_.push(o),s.open(this.#h.length),r?.open(this.#h.length),t(),s.close(this.#h.length),r?.close(this.#h.length),this.#_.pop(),n?.run(void 0,n.blockCompletes),this.#f(l.JUMP,a);let c=[];for(let[u,m]of e.entries()){let h=this.#h.length;this.#n=-1,this.#_.push({regions:r?[r]:[],finallyBody:n}),r?.open(this.#h.length),m.body(),r?.close(this.#h.length),this.#_.pop(),n?.run(void 0,n.handlerCompletes[u]??!0),this.#f(l.JUMP,a);for(let f of m.types){let p=f===null?-1:this.#T(f);for(let[C,T]of s.segments)c.push(C,T,h,p)}}if(r&&n){let u=this.#h.length;this.#n=-1;let m=this.#U();this.#t(l.STORE,m),n.run(n.anyAt(),!0),this.#t(l.LOAD,m,l.ATHROW,-1),this.#Y();for(let[h,f]of r.segments)c.push(h,f,u,-1)}this.#K.push(...c),this.#p(a)}#e(t,e,n){if(e===t.length){n();return}let s=t[e];this.#y(s.start);let r=s.symbol?this.#o(s.symbol):this.#U();s.kind==="declaration"?(this.#c(s.init,!0),this.#B(s.symbol.type,s.init)):this.#c(s.expression,!0),this.#t(l.STORE,r);let a=this.#U();this.#t(l.ACONST_NULL,l.STORE,a);let o=()=>this.#Q(s,r);this.#W(()=>this.#e(t,e+1,n),[{types:[null],body:()=>this.#t(l.DUP,l.STORE,a,l.ATHROW,-1)}],this.#q(()=>{let c=new W,u=new W;this.#t(l.LOAD,r,l.ACONST_NULL,l.ACMPEQ),this.#f(l.JUMP_IF_TRUE,c),this.#t(l.LOAD,a,l.ACONST_NULL,l.ACMPEQ),this.#f(l.JUMP_IF_TRUE,u),this.#W(o,[{types:[null],body:()=>{let m=this.#U();this.#t(l.STORE,m,l.LOAD,a,l.LOAD,m,l.THROWABLE,Mt.ADD_SUPPRESSED),this.#Y()}}],null),this.#f(l.JUMP,c),this.#C(u),o(),this.#C(c)})),s.kind==="declaration"&&!this.#b&&(this.#d=Math.max(this.#d,r+3)),this.#Y(),s.symbol||this.#Y()}#Q(t,e){this.#t(l.LOAD,e),t.closeMethod?this.#t(l.INVOKE_VIRTUAL,t.closeMethod.index,-1):this.#t(l.INVOKE_NATIVE,this.#J("close()",1,!1),-1)}#bt(t,e,n){let s=this.#_.slice(t);if(!s.length){n();return}let r=this.#_;for(let a=s.length-1;a>=0;a--){for(let o of s[a].regions)o.close(this.#h.length);this.#_=r.slice(0,t+a),s[a].finallyBody?.run(e,!0)}this.#_=r,n();for(let a of s)for(let o of a.regions)o.open(this.#h.length)}#At(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.#m.set(t,{breakLabel:u,continueLabel:c,tryDepth:this.#_.length}),this.#p(o),this.#y(e),n&&!a&&this.#ct(n,u,!1),this.#v(s),this.#p(c);for(let m of r)this.#y(m.start),this.#c(m,!1);this.#f(l.JUMP,o),this.#p(u)}#l(t){if(t.iterator){this.#Ie(t);return}let{array:e,length:n,index:s}=t.hidden,r=e.type.element;this.#y(t.start),this.#c(t.iterable,!0),this.#t(l.STORE,this.#o(e),l.LOAD,this.#o(e)),this.#t(l.ARRAYLENGTH,this.#O("Cannot read the array length",this.#a(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.#m.set(t,{breakLabel:c,continueLabel:o,tryDepth:this.#_.length}),this.#p(a),this.#y(t.start),this.#t(l.LOAD,this.#o(s),l.LOAD,this.#o(n),l.ICMPLT),this.#f(l.JUMP_IF_FALSE,c),this.#t(l.LOAD,this.#o(e),l.LOAD,this.#o(s),l.ALOAD,Re(r),-1),this.#Rt(r,t.symbol.type,{description:`${this.#a(e)}[${this.#a(s)}]`}),this.#t(l.STORE,this.#o(t.symbol)),this.#v(t.body),this.#p(o),this.#y(t.start),this.#t(l.IINC,this.#o(s),1),this.#f(l.JUMP,a),this.#p(c)}#Ie(t){let e=t.iterator,n=t.iterable.type,s=n.tag==="library"||n.tag==="diamond"?n.symbol.qualifiedName:"java.lang.Iterable";this.#y(t.start),this.#c(t.iterable,!0),this.#t(l.INVOKE_NATIVE,this.#J("Iterable.iterator",1,!0),this.#O(`Cannot invoke "${s}.iterator()"`,t.iterable)),this.#t(l.STORE,this.#o(e));let r=new W,a=new W;this.#m.set(t,{breakLabel:a,continueLabel:r,tryDepth:this.#_.length}),this.#p(r),this.#y(t.start),this.#t(l.LOAD,this.#o(e),l.INVOKE_NATIVE,this.#J("Iterator.hasNext",1,!0),-1),this.#f(l.JUMP_IF_FALSE,a),this.#t(l.LOAD,this.#o(e),l.INVOKE_NATIVE,this.#J("Iterator.next",1,!0),-1);let o=t.element??ya(n),c=t.symbol.type,u=we(c)?Wt(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.#T(ie(u))),this.#Rt(o,t.symbol.type,{returnValue:"java.util.Iterator.next()"}),this.#t(l.STORE,this.#o(t.symbol)),this.#v(t.body),this.#f(l.JUMP,r),this.#p(a)}#Pt(t,e){if(t.patternSwitch)return this.#Oe(t,e);this.#y(t.start);let n=t.selector.type?.tag==="string",s=t.selector.type,r=s?.tag==="class"&&s.symbol.isEnum?s.symbol:null;this.#c(t.selector,!0);let a;if(r)this.#t(l.GETFIELD,1,this.#O(`Cannot invoke "${r.binaryName}.ordinal()"`,t.selector)),a=this.#U(),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.#O(\'Cannot invoke "String.hashCode()"\',this.#a(h)))}else a=this.#U(),this.#t(l.STORE,a);let o=new W,c=e?t.type:void 0;this.#m.set(t,{breakLabel:o,resultType:c,tryDepth:this.#_.length});let u=t.cases.map(()=>new W),m=o;t.cases.forEach((h,f)=>{if(h.isDefault&&(m=u[f]),r){for(let p of h.ordinals??[])this.#t(l.LOAD,a,l.ICONST,p,l.ICMPEQ),this.#f(l.JUMP_IF_TRUE,u[f]);return}for(let p of h.labels)this.#t(l.LOAD,a),this.#Et(p.constant),this.#t(n?l.STR_EQUALS:l.ICMPEQ,...n?[-1]:[]),this.#f(l.JUMP_IF_TRUE,u[f])}),e&&m===o&&u.length&&(m=u[0]),this.#f(l.JUMP,m),t.cases.forEach((h,f)=>{this.#p(u[f]),this.#Te(h,e,o,c)}),this.#C(o),this.#n=-1,n||this.#Y()}#Oe(t,e){this.#y(t.start);let n=t.selector.type,s=n?.tag==="class"&&n.symbol.isEnum?n.symbol:null;this.#c(t.selector,!0);let r=this.#U();this.#t(l.STORE,r);let a=new W,o=e?t.type:void 0;this.#m.set(t,{breakLabel:a,resultType:o,tryDepth:this.#_.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.#f(l.JUMP_IF_TRUE,c[u])):this.#t(l.CHECKNULL,-1);let m=null;t.cases.forEach((h,f)=>{if(h.isDefault&&(m=c[f]),s)for(let p of h.ordinals??[])this.#t(l.LOAD,r,l.GETFIELD,1,-1,l.ICONST,p,l.ICMPEQ),this.#f(l.JUMP_IF_TRUE,c[f]);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.#f(l.JUMP_IF_TRUE,c[f]);for(let C of h.enumFields?.length?[]:h.labels)this.#t(l.LOAD,r),p&&this.#t(l.UNBOX,Zt[p.tag],-1),this.#Et(C.constant),p&&this.#mt(C.type,p),this.#t(p?l.ICMPEQ:l.STR_EQUALS,...p?[]:[-1]),this.#f(l.JUMP_IF_TRUE,c[f])}if(h.pattern){let p=new W,C=this.#zt(h.pattern,r,p,!1);h.guard&&this.#ct(h.guard,p,!1),this.#f(l.JUMP,c[f]),this.#C(p);for(let T=0;T<C;T++)this.#Y()}}),this.#f(l.JUMP,m??(t.exhaustive&&c.length?c[0]:a)),t.cases.forEach((h,f)=>{this.#p(c[f]),this.#Te(h,e,a,o)}),this.#C(a),this.#n=-1,this.#Y()}#zt(t,e,n,s){if(t.kind==="TypePattern")return!(s&&t.unconditional)&&!we(t.tested)&&(this.#t(l.LOAD,e,l.INSTANCEOF,this.#T(ie(q(t.tested)))),this.#f(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.#T(ie(q(t.tested)))),this.#f(l.JUMP_IF_FALSE,n);let r=0;return t.components.forEach((a,o)=>{let c=t.accessors[o],u=this.#U();r++,this.#t(l.LOAD,e,c.selector!==void 0?l.INVOKE_VIRTUAL:l.INVOKE,c.index,-1,l.STORE,u),r+=this.#zt(a,u,n,!0)}),r}#Te(t,e,n,s){if(!t.arrow){for(let a of t.statements)this.#v(a);return}let r=t.body;if(r.kind==="Block"){this.#v(r),e||this.#f(l.JUMP,n);return}this.#y(r.start),e?(this.#c(r,!0),this.#B(s,r)):this.#c(r,!1),this.#f(l.JUMP,n)}#ct(t,e,n){let s=t.constant;if(s&&s.kind==="boolean"){s.value===n&&this.#f(l.JUMP,e);return}if(t.kind==="Parenthesized")return this.#ct(t.expression,e,n);if(t.kind==="Unary"&&t.operator==="!")return this.#ct(t.operand,e,!n);if(t.kind==="Binary"&&(t.operator==="&&"||t.operator==="||")){if(t.operator==="&&"!==n)this.#ct(t.left,e,n),this.#ct(t.right,e,n);else{let a=new W;this.#ct(t.left,a,!n),this.#ct(t.right,e,n),this.#C(a)}return}if(t.kind==="InstanceOf"){this.#Se(t,e,n);return}this.#Z(t,dt),this.#f(n?l.JUMP_IF_TRUE:l.JUMP_IF_FALSE,e)}#Se(t,e,n){if(t.recordPattern){let c=this.#U();this.#c(t.expression,!0),this.#t(l.STORE,c);let u=new W,m=this.#zt(t.recordPattern,c,n?u:e,!1);n&&this.#f(l.JUMP,e),this.#C(u);for(let h=0;h<=m;h++)this.#Y();return}let s=this.#T(ie(this.#xt(t))),r=t.binding?.symbol;if(!r){this.#c(t.expression,!0),this.#t(l.INSTANCEOF,s),this.#f(n?l.JUMP_IF_TRUE:l.JUMP_IF_FALSE,e);return}let a=this.#U();this.#c(t.expression,!0),this.#t(l.STORE,a,l.LOAD,a,l.INSTANCEOF,s);let o=new W;this.#f(l.JUMP_IF_FALSE,n?o:e),this.#t(l.LOAD,a,l.STORE,this.#o(r)),n&&this.#f(l.JUMP,e),this.#C(o),this.#Y()}#xt(t){return t.binding?.symbol?.type??t.testedType}#mt(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"&&kr(t)&&this.#t(l.I2F))}#w(t,e){if(!Xn(t)||!Xn(e))return;let n=kr(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.#mt(t,e);return;case"double":n==="long"&&this.#t(l.L2D);return}}#B(t,e){this.#Rt(e.type,t,e,e.constant!==void 0)}#Rt(t,e,n,s=!1){let r=yt(t);if(we(e)){if(r&&(this.#t(l.UNBOX,Zt[r.tag],this.#Jt(r,n)),t=r),s){this.#mt(t,e);return}e.tag==="char"&&t.tag!=="char"?this.#t(l.I2C):this.#mt(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])}}#Jt(t,e){let n=`Cannot invoke "${Xo[t.tag]}"`;return"returnValue"in e?this.#Mt(`${n} because the return value of "${e.returnValue}" is null`):"description"in e?this.#O(n,e.description):this.#O(n,e)}#X(t,e,n){if(!n){t.forEach((r,a)=>{this.#c(r,!0),this.#B(e[a],r)});return}this.#X(t.slice(0,n.from),e);let s=t.slice(n.from);this.#t(l.ICONST,s.length),this.#It(n.element),s.forEach((r,a)=>{this.#t(l.DUP,l.ICONST,a),this.#c(r,!0),this.#B(n.element,r),this.#t(l.ASTORE,Re(n.element),-1)})}#Z(t,e){if(this.#c(t,!0),t.constant){this.#mt(t.type,e);return}let n=yt(t.type);if(n){this.#t(l.UNBOX,Zt[n.tag],this.#Jt(n,t)),this.#mt(n,e);return}this.#mt(t.type,e)}#Dt(t,e){let n=Yo[t];return e.tag==="double"?n.double:e.tag==="float"?n.float:e.tag==="long"?n.long:n.int}#c(t,e){if(e&&t.genericCast){let n=t.genericCast;t.genericCast=void 0,this.#c(t,!0),t.genericCast=n,this.#t(l.CHECKCAST,this.#T(ie(n)));return}if(t.constant){e&&this.#Et(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.#c(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.#gt(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.#gt(t.outerHops);return;case"Super":e&&this.#t(l.LOAD,0);return;case"ClassLiteral":e&&this.#t(l.SCONST,this.#T(t.className),l.ICONST,t.isInterface?1:0,l.INVOKE_NATIVE,this.#J("Class.literal",2,!0),-1);return;case"InstanceOf":{let n=new W,s=new W;this.#Se(t,n,!0),this.#t(l.ICONST,0),this.#f(l.JUMP,s),this.#C(n),this.#t(l.ICONST,1),this.#C(s),e||this.#t(l.POP);return}case"Parenthesized":this.#c(t.expression,e);return;case"Unary":{let n=t.type;this.#Z(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.#c(t.expression,!0),this.#t(l.CHECKCAST,this.#T(ie(t.checked)));let r=yt(t.checked);this.#t(l.UNBOX,Zt[r.tag],this.#Jt(r,t.expression)),this.#w(r,t.type),e||this.#t(l.POP);return}let s=we(t.type)?yt(n):null;s?this.#Z(t.expression,s):this.#c(t.expression,!0),we(n)&&!we(t.type)?this.#Rt(n,t.type,t.expression,t.expression.constant!==void 0):this.#w(s??n,t.type),t.checked&&this.#t(l.CHECKCAST,this.#T(ie(t.checked))),e||this.#t(l.POP);return}case"IncDec":this.#ae(t,e);return;case"Binary":this.#Le(t),e||this.#t(l.POP);return;case"Assignment":this.#Ne(t,e);return;case"ArrayAccess":this.#c(t.array,!0),this.#Z(t.index,U),this.#re(t.type,t.array),e||this.#t(l.POP);return;case"NewArray":this.#se(t),e||this.#t(l.POP);return;case"FieldAccess":if(t.fieldSymbol){let n=t.fieldSymbol;n.isStatic?(vr(t.target)||this.#c(t.target,!1),e&&this.#t(l.GETSTATIC,n.index)):(this.#c(t.target,!0),this.#t(l.GETFIELD,n.index,this.#z(`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.#J("System.in",0,!0),-1);return}if(t.field==="System.out"||t.field==="System.err"){e&&this.#t(l.INVOKE_NATIVE,this.#J(t.field,0,!0),-1);return}if(t.libraryField?.includes("#")){this.#c(t.target,!0),this.#t(l.INVOKE_NATIVE,this.#J(t.libraryField,1,!0),this.#z(`Cannot read field "${t.name}"`,t.target)),e||this.#t(l.POP);return}if(t.libraryField){e&&this.#t(l.INVOKE_NATIVE,this.#J(t.libraryField,0,!0),-1);return}if(t.field!=="length")throw new Error("codegen: field access used as a value");this.#c(t.target,!0),this.#t(l.ARRAYLENGTH,this.#O("Cannot read the array length",t.target)),e||this.#t(l.POP);return;case"MethodCall":this.#ie(t,e);return;case"NewObject":{if(t.libraryCall){this.#rt(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=Zo(this.#r,n.owner);r>=0?(this.#gt(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.#gt(t.outer),this.#X(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.#c(a,e),e&&this.#B(t.type,a);return}let s=new W,r=new W;this.#ct(t.condition,s,!1),this.#c(t.whenTrue,!0),this.#B(t.type,t.whenTrue),this.#f(l.JUMP,r),this.#C(s),this.#c(t.whenFalse,!0),this.#B(t.type,t.whenFalse),this.#C(r),e||this.#t(l.POP);return}case"SwitchExpression":this.#Pt(t,!0),e||this.#t(l.POP);return;case"Lambda":this.#ne(t,null,e);return;case"MethodRef":this.#ne(t.lambda,t.receiver??null,e);return}}#ne(t,e,n){let s=t.method,r=0;s.usesThis&&(this.#t(l.LOAD,0),r++),e&&(this.#c(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.#T(a.iface),a.sam?.selector??-1,a.samKey?this.#T(a.samKey):-1),n||this.#t(l.POP)}#Le(t){let e=t.operator;if(e==="&&"||e==="||"){let a=new W,o=new W;this.#ct(t,a,!1),this.#t(l.ICONST,1),this.#f(l.JUMP,o),this.#C(a),this.#t(l.ICONST,0),this.#C(o);return}let n=t.left.type,s=t.right.type;if(t.type?.tag==="string"){this.#Wt(t.left),this.#Wt(t.right),this.#t(l.SCONCAT);return}if(e in Cs){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.#Z(t.left,dt),this.#Z(t.right,dt),this.#t(Cs[e]);return}if(c&&Xn(a)&&Xn(o)){let m=wr(a,o);this.#Z(t.left,m),this.#Z(t.right,m),this.#t(Cs[e]);return}this.#c(t.left,!0),this.#c(t.right,!0);let u=As(n)||As(s);this.#t(e==="=="?u?l.ACMPEQ:l.ICMPEQ:e==="!="?u?l.ACMPNE:l.ICMPNE:Cs[e]);return}let r=t.type;if(e==="<<"||e===">>"||e===">>>"){this.#Z(t.left,r),this.#c(t.right,!0),s.tag==="long"&&this.#t(l.L2I),this.#t(this.#Dt(e,r));return}this.#Z(t.left,r),this.#Z(t.right,r),this.#t(this.#Dt(e,r.tag==="boolean"?U:r))}#gt(t=0){this.#t(l.LOAD,0);let e=this.#r;for(let n=0;n<t&&e;n++,e=e.outer)this.#t(l.GETFIELD,e.outerField,-1)}#nt(t){let e=r=>{let a=0;for(let o=r.outer;o;o=o.outer)a++;return a},n="this",s=this.#r;for(let r=0;r<t&&s?.outer;r++,s=s.outer)n+=`.this$${e(s)-1}`;return n}#It(t){Re(t)===z.REF&&t.tag!=="string"?this.#t(l.NEWARRAY_REF,this.#T("["+ie(t))):this.#t(l.NEWARRAY,Re(t))}#se(t){if(t.initializer){this.#qt(t.initializer);return}let e=t.type;for(let n of t.dimensions)this.#Z(n,U);t.dimensions.length===1?this.#It(e.element):this.#t(l.NEWMULTI,this.#T(ie(e)),t.dimensions.length)}#re(t,e){let n=Re(t);this.#t(l.ALOAD,n,this.#O(`Cannot load from ${ma[n]} array`,e))}#Kt(t,e){let n=Re(t);this.#t(l.ASTORE,n,this.#O(`Cannot store to ${ma[n]} array`,e))}#qt(t){let e=t.elementType,n=Re(e);this.#t(l.ICONST,t.elements.length),this.#It(e),t.elements.forEach((s,r)=>{this.#t(l.DUP,l.ICONST,r),s.kind==="ArrayInitializer"?this.#qt(s):(this.#c(s,!0),this.#B(e,s)),this.#t(l.ASTORE,n,-1)})}#ie(t,e){if(t.print){let s=wt.NONE;if(t.print.argument!=="none"){let r=t.args[0];this.#c(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.#rt(t.libraryCall,s,t.args,e);return}if(t.mathFunction){this.#X(t.args,t.mathFunction.params),this.#t(l.MATH,Qo[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&&!vr(n)&&this.#c(n,!1):n?(this.#c(n,!0),r=this.#z(`Cannot invoke "${this.#st(t,s)}"`,n)):this.#gt(t.outerHops),this.#X(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.#c(n,!0),s=this.#z(`Cannot invoke "${t.qualifier??"Object"}.${pa[t.objectMethod]}"`,n)):this.#gt(),this.#X(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.#c(t.target,!0);for(let s of t.args)this.#c(s,!0);switch(t.stringMethod){case"length":this.#t(l.STR_LENGTH,this.#O(\'Cannot invoke "String.length()"\',t.target));break;case"charAt":this.#t(l.STR_CHARAT,this.#O(\'Cannot invoke "String.charAt(int)"\',t.target));break;case"equals":this.#t(l.STR_EQUALS,this.#O(\'Cannot invoke "String.equals(Object)"\',t.target));break;case"isEmpty":this.#t(l.STR_LENGTH,this.#O(\'Cannot invoke "String.isEmpty()"\',t.target),l.ICONST,0,l.ICMPEQ);break;case"toCharArray":this.#t(l.STR_TOCHARS,this.#O(\'Cannot invoke "String.toCharArray()"\',t.target));break;case"compareTo":this.#t(l.STR_COMPARETO,this.#O(\'Cannot invoke "String.compareTo(String)"\',t.target),this.#Mt(\'Cannot read field "value" because "anotherString" is null\'));break}e||this.#t(l.POP);return}throw new Error(`codegen: unresolved call to ${t.name}`)}#Tt(t,e,n){let s=yt(t);s&&this.#t(l.UNBOX,Zt[s.tag],this.#Jt(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])}#ae(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.#Tt(r,s,n),e&&t.prefix&&this.#t(l.DUP),this.#t(l.STORE,o);return}let a=this.#oe(n);if(a){if(a.isStatic)this.#Me(n),this.#t(l.GETSTATIC,a.index),e&&!t.prefix&&this.#t(l.DUP),this.#Tt(r,s,n),e&&t.prefix&&this.#t(l.DUP),this.#t(l.PUTSTATIC,a.index);else{let o=this.#$e(n,a,"read");this.#t(l.DUP,l.GETFIELD,a.index,o),e&&!t.prefix&&this.#t(l.DUP_X1),this.#Tt(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.#c(n.array,!0),this.#c(n.index,!0),this.#t(l.DUP2),this.#re(r,n.array),e&&!t.prefix&&this.#t(l.DUP_X2),this.#Tt(r,s,n),e&&t.prefix&&this.#t(l.DUP_X2),this.#Kt(r,n.array)}#Ne(t,e){let n=Le(t.target),s=t.target.type,r=()=>{if(t.operator==="="){this.#c(t.value,!0),this.#B(s,t.value);return}if(s.tag==="string"){this.#t(l.TOSTRING_REF),this.#Wt(t.value),this.#t(l.SCONCAT);return}let o=t.operator.slice(0,-1),c=t.value.type;if(o==="<<"||o===">>"||o===">>>"){let h=kr(s)?U:s;this.#c(t.value,!0),c.tag==="long"&&this.#t(l.L2I),this.#t(this.#Dt(o,h)),this.#w(h,s);return}if(s.tag==="boolean"){this.#Z(t.value,dt),this.#t(this.#Dt(o,U));return}let u=yt(s);if(u){this.#t(l.UNBOX,Zt[u.tag],this.#Jt(u,n));let h=wr(u,yt(c)??c);this.#mt(u,h),this.#Z(t.value,h),this.#t(this.#Dt(o,h)),this.#w(h,u),this.#t(l.BOX,Zt[u.tag]);return}let m=wr(s,yt(c)??c);this.#mt(s,m),this.#Z(t.value,m),this.#t(this.#Dt(o,m)),this.#w(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.#oe(n);if(a){if(a.isStatic)this.#Me(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.#$e(n,a,"assign");r(),e&&this.#t(l.DUP_X1),this.#t(l.PUTFIELD,a.index,o)}else{let o=this.#$e(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.#c(n.array,!0),this.#c(n.index,!0),t.operator!=="="&&(this.#t(l.DUP2),this.#re(s,n.array)),r(),e&&this.#t(l.DUP_X2),this.#Kt(s,n.array)}#oe(t){if(t.kind==="Name"&&t.symbol?.kind==="field")return t.symbol;if(t.kind==="FieldAccess")return t.fieldSymbol}#$e(t,e,n){if(t.kind==="FieldAccess"){this.#c(t.target,!0);let s=n==="read"?"Cannot read field":"Cannot assign field";return this.#z(`${s} "${e.name}"`,t.target)}return this.#gt(t.kind==="Name"?t.outerHops:0),-1}#Me(t){t.kind==="FieldAccess"&&!vr(t.target)&&this.#c(t.target,!1)}#Wt(t){if(t.constant){this.#t(l.SCONST,this.#T(Pn(t.constant)));return}switch(this.#c(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}`)}}},pa={toString:"toString()",hashCode:"hashCode()",equals:"equals(Object)"};function Zo(i,t){let e=0;for(let n=i;n;n=n.outer,e++)if(n===t)return e;return-1}function As(i){return i!==void 0&&["string","null","array","class","object","library","diamond","typevar"].includes(i.tag)}function ya(i){if(i.tag==="class"){let n=hn(i.symbol).find(s=>s.symbol.name==="Iterable"||s.symbol.supertypes.some(r=>r.tag==="library"&&r.symbol.name==="Iterable"));return n?ya(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?ga(s,n):null}return t&&t.tag==="library"?t.args[0]??{tag:"object"}:{tag:"object"}}function ga(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=>ga(e,t))}:i}var et=class{value;constructor(t){this.value=t}},Rt=class{kind;data;hash;descriptor;constructor(t,e,n,s=tl[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}},tl=["[I","[Z","[C","[Ljava.lang.String;","[J","[D","[B","[S","[F"];function De(i){return i instanceof Rt?Ir(i):`${i.className}@${i.hash.toString(16)}`}function Ir(i){return`${i.descriptor}@${i.hash.toString(16)}`}var Is=class{#A=new Map;intern(t){let e=this.#A.get(t);return e||(e=new et(t),this.#A.set(t,e)),e}},Os=class{#A=625341585;next(){let t=this.#A;return t^=t<<13,t^=t>>>17,t^=t<<5,this.#A=t>>>0,this.#A&2147483647||1}};var ba=i=>`${i.className}.${i.method}(${i.file}:${i.line})`;var $s=class{className;message;constructor(t,e){this.className=t,this.message=e}},Yn=class{message;constructor(t){this.message=t}},Qn=class{result;constructor(t){this.result=t}},vn=class{thrown;constructor(t){this.thrown=t}},Ms=class{frames;constructor(t){this.frames=t}},Ps=class{message;constructor(t){this.message=t}};function nl(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 Ls(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 sl=Object.getPrototypeOf(Object.getPrototypeOf((function*(){})())),Or=i=>typeof i=="object"&&i!==null&&Object.getPrototypeOf(Object.getPrototypeOf(i))===sl;function Lr(i){switch(i.kind){case"double":return oe(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 Sa={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},rl=0,il=1,Xe=2,xa=3,Mr="\\0launcher",al=Array.from({length:5},(i,t)=>`${Mr}${t}`),va=65536;function Nr(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 Ns=(i,t)=>`Index ${i} out of bounds for length ${t}`;function ol(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 ll(i){let t="";for(let e=0;e<i.length;e+=8192)t+=String.fromCharCode(...i.subarray(e,e+8192));return t}var wa=["java.lang.String","java.lang.Object","java.lang.Comparable","java.lang.CharSequence"],Pr={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"},cl=Object.fromEntries(Object.keys(Pr).map(i=>[i,[Pr[i],"java.lang.Object","java.lang.Comparable",...i==="char"||i==="boolean"?[]:["java.lang.Number"]]])),ul=["java.lang.Object","java.lang.Cloneable","java.io.Serializable"],hl="com.sun.tools.javac.launcher.MemoryClassLoader @6d06d69c";function dl(i){let t=0;for(let e=0;e<i.length;e++)t=Math.imul(t,31)+i.charCodeAt(e)|0;return t}var $r=new DataView(new ArrayBuffer(8));function fl(i){switch(i.kind){case"int":case"char":case"byte":case"short":return i.value;case"float":return cs(i.value);case"long":{let t=BigInt.asUintN(64,BigInt(i.value));return Number(BigInt.asIntN(32,t^t>>32n))}case"double":return $r.setFloat64(0,Number.isNaN(i.value)?NaN:i.value),$r.getInt32(0)^$r.getInt32(4)|0;case"boolean":return i.value?1231:1237}}function ka(i,t,e,n,s,r=""){let a=new Is,o=new Os,c=i.strings.map(d=>a.intern(d)),u=i.numbers,m=cn(),h=i.natives.map(d=>{let b=m?.natives[d.name];if(!b)throw new Error(`interpreter: the library native ${d.name} is not loaded`);return b}),f=i.messages,p=i.methods,C=globalThis.performance,T=e.maxDurationMs>0?C.now()+e.maxDurationMs:1/0,w=(d,b=-1)=>({method:d,code:d.code,locals:new Array(d.maxLocals).fill(0),stack:new Array(d.maxStack+1).fill(0),sp:0,pc:0,returnPc:0,initClass:b}),x=i.staticFieldIsReference.map(d=>d?null:0),k=i.staticFieldOwner,I=i.classes,L=I.map(d=>d.instanceFieldIsReference.map(b=>b?null:0)),$=new Uint8Array(I.length),O=new Int32Array(I.length).fill(-1),R=(i.loadWarnings??[]).map((d,b)=>{for(let A of d.classes)O[A]=b;return!0}),N=new Map(I.map(d=>[d.name,d.types])),B=d=>d instanceof Ut?I[d.classIndex].types:d instanceof et?wa:d instanceof zt?cl[d.kind]:d instanceof Rt?ul:d instanceof pe?N.get(d.iface)??m?.typesOf(d.iface)??[d.iface,"java.lang.Object"]:d instanceof me?m?.typesOf(d.className)??["java.lang.Object"]:["java.lang.Object"],J=(d,b)=>{if(d===b)return!0;let A=d.slice(1),M=b.slice(1);if(M==="Ljava.lang.Object;")return A.startsWith("[")||A.startsWith("L");if(A.startsWith("[")&&M.startsWith("["))return J(A,M);if(A.startsWith("L")&&M.startsWith("L")){let F=A.slice(1,-1);return(N.get(F)??(F==="java.lang.String"?wa:[F,"java.lang.Object"])).includes(M.slice(1,-1))}return!1},j=(d,b)=>d instanceof et?b==="[Ljava.lang.String;"||st(d,b.slice(1)):d instanceof Ut&&b.length===d.className.length+3&&b.slice(2,-1)===d.className?!0:st(d,b.slice(1)),K=new Map,st=(d,b)=>{if(d===null||typeof d!="object")return!1;if(b.charCodeAt(0)===91)return d instanceof Rt&&J(d.descriptor,b);let A=K.get(b);return A===void 0&&K.set(b,A=b.slice(1,-1)),B(d).includes(A)},Kt=d=>d instanceof Ut?d.className:d instanceof et?"java.lang.String":d instanceof zt?Pr[d.kind]:d instanceof Rt?d.descriptor:d.className,Fe=d=>{let b=d.replace(/^\\[+/,"").replace(/^L(.*);$/,"$1");return N.has(b)&&!b.includes(".")?`unnamed module of loader ${hl}`:"module java.base of loader \'bootstrap\'"},kn=(d,b)=>{let A=Kt(d),M=Fe(A),F=Fe(b),V=M===F?`${A} and ${b} are in ${M}`:`${A} is in ${M}; ${b} is in ${F}`;return`class ${A} cannot be cast to class ${b} (${V})`},it=w(p[i.entry]),mt=[it],D=it.code,kt=it.locals,g=it.stack,y=0,S=0,Dt=0,Jr=Math.min(va,e.maxInstructions+1),Ds=0,ge=0,ke=(d,b)=>({outcome:{kind:"resource-limit",limit:d,message:b},instructions:Math.min(Dt,e.maxInstructions)}),Dr=d=>{it.pc=S;let b=[],A=d!==void 0;for(let M=mt.length-1;M>=0&&b.length<1024;M--){let F=mt[M];F.method.hidden||A&&d(F)||(A=!1,b.push({className:F.method.className,method:F.method.name,file:F.method.file,line:ha(F.method,F.pc)}))}return b},Fr=new Map(I.map((d,b)=>[d.name,b])),Fs=(d,b,A=null,M)=>{let F=Fr.get(d)??Fr.get("java.lang.RuntimeException"),V=L[F].slice();return V[ut.message]=b===null?null:new et(b),V[ut.trace]=new Ms(M??Dr()),A&&(V[ut.cause]=A,V[ut.causeSet]=1),new Ut(d,F,V,o.next())},ot=(d,b,A=null)=>{throw new vn(Fs(d,b,A))},jr=[],Ga=d=>{let b=jr[d],A=b.fields[ut.message],M=A===null?b.className:`${b.className}: ${A.value}`,F=b.fields[ut.trace]?.frames??[],V=Fs("java.lang.ExceptionInInitializerError",`Exception ${M} [in thread "main"]`,null,F);return ot("java.lang.NoClassDefFoundError",`Could not initialize class ${I[d].name}`,V)},Cn=null,js="",_r=()=>({outcome:{kind:"exception",className:Cn.className,text:js},instructions:Dt,...Us?{inputExhausted:Us}:{}}),za=d=>{let b=d;for(it.pc=S;mt.length;){let M=mt[mt.length-1],F=M.method.handlers;if(F)for(let V=0;V<F.length;V+=4){if(M.pc<F[V]||M.pc>=F[V+1])continue;let pt=F[V+3];if(!(pt>=0&&!st(b,i.strings[pt])))return it=M,D=M.code,kt=M.locals,g=M.stack,y=0,g[y++]=b,S=F[V+2],null}mt.pop(),M.initClass>=0&&($[M.initClass]=xa,jr[M.initClass]=b,!st(b,"Ljava.lang.Error;")&&mt.length&&(it=mt[mt.length-1],S=it.pc,b=Fs("java.lang.ExceptionInInitializerError",null,b)))}if(Cn)return js+=`\nException: ${b.className} thrown from the UncaughtExceptionHandler in thread "main"\n`,_r();Cn=b;let A=w(p[i.uncaught]);return A.locals[0]=b,mt.push(A),it=A,D=A.code,kt=A.locals,g=A.stack,y=0,S=0,null},Ur=new Map,Br=new Map,_s=(d,b)=>{if(!(d==="boolean"||d==="byte"||(d==="int"||d==="long"||d==="short")&&b>=-128&&b<=127||d==="char"&&b<=127))return new zt(d,b);let M=d+b,F=Br.get(M);return F||Br.set(M,F=new zt(d,b)),F},Us=!1,Bs={stdout:!1,stderr:!1},je={hash:()=>o.next(),intern:d=>a.intern(d),fail:(d,b)=>{throw new $s(d,b)},raise:d=>{throw new vn(d)},limitation:d=>{throw new Ps(d)},charge:d=>{Dt+=d},allocate:d=>{if(ge+d>e.maxArrayElements)throw new Yn(`the program allocated more than ${e.maxArrayElements.toLocaleString("en-US")} array elements`);ge+=d},print:(d,b)=>{let A=Xr(d==="out"?"stdout":"stderr",b);if(A)throw new Qn(A)},closeStream:d=>{Bs[d==="out"?"stdout":"stderr"]=!0},streamClosed:d=>Bs[d==="out"?"stdout":"stderr"],exit:d=>{throw new Qn({outcome:{kind:"exit",status:d},instructions:Dt})},seed:()=>BigInt(Math.floor(Math.random()*2**32))*2n**16n+BigInt(Math.floor(Math.random()*2**16)),stdin:()=>r,inputExhausted:()=>{Us=!0},checkString:d=>{if(d>e.maxStringLength)throw new Yn(`the program built a String longer than ${e.maxStringLength.toLocaleString("en-US")} characters`)},methodOf:(d,b,A)=>I[d.classIndex].virtuals[`${b}/${A}`]??-1,castMessage:kn,storable:(d,b)=>j(d,b),className:d=>Kt(d),toStringMethod:d=>I[d.classIndex].toString,equalsMethod:d=>I[d.classIndex].equals,hashCodeMethod:d=>I[d.classIndex].hashCode,box:_s,staticMethod:(d,b,A)=>p.findIndex(M=>M.isStatic&&M.className===d&&M.name===b&&M.argCount===A)},ns=d=>d instanceof $s?ot(d.className,d.message):d instanceof Ps?{outcome:{kind:"engine-limitation",message:d.message},instructions:Dt}:d instanceof Yn?ke("memory",d.message):d instanceof Qn?d.result:null,Vs=(d,b)=>{let A=p[d];if(mt.length>e.maxCallDepth)return ot("java.lang.StackOverflowError",null);let M=qr(A,-1),F=A.argSlots;for(let V=0;V<b.length;V++)M.locals[F?F[V]:V]=b[V];return mt.push(M),it=M,D=M.code,kt=M.locals,g=M.stack,y=0,S=0,A.isStatic&&$[A.classIndex]!==Xe&&tn(A.classIndex),null},Hs=[],Vr=d=>{let b=it,A;try{let F=b.then;if(F){if(A=F(d),A instanceof Je)return A.resumes?(b.then=null,b.native=A.resumes,b.convert=A.convert):b.then=A.then,Vs(A.invoke,A.args);Or(A)&&(b.then=null,b.native=A,d=void 0)}if(!b.then){let V=b.native.next(d);if(!V.done)return Vs(V.value.invoke,V.value.args);let pt=b.convert;A=pt?pt(V.value):V.value}}catch(F){let V=ns(F);if(V)return V;throw F}mt.pop();let M=b.nativeReturns;return b.native=null,b.then=null,b.convert=null,Hs.length<32&&Hs.push(b),it=mt[mt.length-1],D=it.code,kt=it.locals,g=it.stack,y=it.sp,S=it.returnPc,M&&(g[y++]=A??null),null},Hr=(d,b)=>{if(it.pc=S,it.returnPc=b,it.sp=y,mt.length>e.maxCallDepth)return null;let A=Hs.pop()??w(Sa);return A.nativeReturns=d,mt.push(A),it=A,A},Ze=(d,b,A)=>{let M=Hr(b,A);return M?(M.native=d,Vr(void 0)):ot("java.lang.StackOverflowError",null)},Gr=(d,b,A)=>{let M=Hr(b,A);return M?(d.resumes?(M.native=d.resumes,M.convert=d.convert):M.then=d.then,Vs(d.invoke,d.args)):ot("java.lang.StackOverflowError",null)};function*zr(d){let b=yield*m.toString(je,d);return new et(b)}let Kr=(d,b,A)=>{y-=b.length;let M;try{M=m.natives[d](je,b)}catch(F){let V=ns(F);if(V)return V;throw F}return M instanceof Je?Gr(M,!0,A):Or(M)?Ze(M,!0,A):(g[y++]=M??null,S=A,null)};for(let d of p)d.freeFrames=[];let qr=(d,b)=>{let A=d.freeFrames.pop();if(!A)return w(d,b);let M=A.locals;for(let F=0;F<M.length;F++)M[F]=0;return A.sp=0,A.pc=0,A.returnPc=0,A.initClass=b,A},Ka=d=>{let b=d.method.freeFrames;b&&b.length<32&&b.push(d)},_e=(d,b,A=-1)=>{it.pc=S,it.returnPc=b,y-=d.argCount,it.sp=y;let M=qr(d,A),F=d.argSlots;if(F)for(let V=0;V<d.argCount;V++)M.locals[F[V]]=g[y+V];else for(let V=0;V<d.argCount;V++)M.locals[V]=g[y+V];mt.push(M),it=M,D=M.code,kt=M.locals,g=M.stack,y=0,S=0},tn=d=>{if($[d]!==rl)return $[d]===xa&&Ga(d),!1;let b=O[d];b>=0&&R[b]&&(R[b]=!1,t("stderr",i.loadWarnings[b].text));let A=I[d].superclass;if(A>=0&&tn(A))return!0;let M=I[d].clinit;return M<0?($[d]=Xe,!1):($[d]=il,_e(p[M],S,d),!0)},Ct=d=>ot("java.lang.NullPointerException",d>=0?f[d]:null),Wr=(d,b,A)=>{let M=b[A],F=d.slice(1);if(A===b.length-1){let pt=ol(F);return new Rt(pt,Nr(pt,M),o.next(),d)}let V=new Array(M);for(let pt=0;pt<M;pt++)V[pt]=Wr(F,b,A+1);return new Rt(z.REF,V,o.next(),d)},Xr=(d,b)=>{if(Bs[d])return null;if(Cn&&d==="stderr")return js+=b,null;if(Ds+b.length>e.maxOutputChars){let A=e.maxOutputChars-Ds;return A>0&&t(d,b.slice(0,A)),ke("output",`the program printed more than ${e.maxOutputChars.toLocaleString("en-US")} characters`)}return Ds+=b.length,Dt+=b.length>>>6,b&&t(d,b),null},Yr=[];if(s){let d={string:b=>new et(b),box:_s,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(je,b)},allocate:b=>je.allocate(b)};try{Yr=s.args(d)}catch(b){let A=ns(b);if(A)return A;throw b}}for(;;)try{for(;;){if(++Dt>=Jr){if(Dt>e.maxInstructions)return ke("instructions",`the program ran more than ${e.maxInstructions.toLocaleString("en-US")} steps`);if(T!==1/0&&C.now()>T)return ke("time",`the program ran longer than ${e.maxDurationMs} ms`);Jr=Math.min(Dt+va,e.maxInstructions+1),n?.()}switch(D[S]){case 1:g[y++]=D[S+1],S+=2;break;case 2:g[y++]=c[D[S+1]],S+=2;break;case 3:g[y++]=null,S+=1;break;case 4:g[y++]=kt[D[S+1]],S+=2;break;case 5:kt[D[S+1]]=g[--y],S+=2;break;case 6:y--,S+=1;break;case 7:g[y]=g[y-1],y++,S+=1;break;case 8:{let d=g[y-1];g[y-1]=g[y-2],g[y-2]=d,g[y++]=d,S+=1;break}case 9:{let d=g[y-1];g[y-1]=g[y-2],g[y-2]=g[y-3],g[y-3]=d,g[y++]=d,S+=1;break}case 24:g[y]=g[y-2],g[y+1]=g[y-1],y+=2,S+=1;break;case 10:{let d=g[--y];g[y-1]=g[y-1]+d|0,S+=1;break}case 11:{let d=g[--y];g[y-1]=g[y-1]-d|0,S+=1;break}case 12:{let d=g[--y];g[y-1]=Math.imul(g[y-1],d),S+=1;break}case 13:{let d=g[--y];if(d===0)return ot("java.lang.ArithmeticException","/ by zero");g[y-1]=g[y-1]/d|0,S+=1;break}case 14:{let d=g[--y];if(d===0)return ot("java.lang.ArithmeticException","/ by zero");g[y-1]=g[y-1]%d|0,S+=1;break}case 15:g[y-1]=-g[y-1]|0,S+=1;break;case 16:{let d=g[--y];g[y-1]=g[y-1]<<d,S+=1;break}case 17:{let d=g[--y];g[y-1]=g[y-1]>>d,S+=1;break}case 18:{let d=g[--y];g[y-1]=g[y-1]>>>d|0,S+=1;break}case 19:{let d=g[--y];g[y-1]=g[y-1]&d,S+=1;break}case 20:{let d=g[--y];g[y-1]=g[y-1]|d,S+=1;break}case 21:{let d=g[--y];g[y-1]=g[y-1]^d,S+=1;break}case 22:g[y-1]=~g[y-1],S+=1;break;case 23:g[y-1]=g[y-1]^1,S+=1;break;case 25:g[y-1]=g[y-1]&65535,S+=1;break;case 163:g[y-1]=g[y-1]<<24>>24,S+=1;break;case 164:g[y-1]=g[y-1]<<16>>16,S+=1;break;case 165:case 167:g[y-1]=Math.fround(g[y-1]),S+=1;break;case 166:g[y-1]=an(g[y-1]),S+=1;break;case 168:{let d=g[--y];g[y-1]=Math.fround(g[y-1]+d),S+=1;break}case 169:{let d=g[--y];g[y-1]=Math.fround(g[y-1]-d),S+=1;break}case 170:{let d=g[--y];g[y-1]=Math.fround(g[y-1]*d),S+=1;break}case 171:{let d=g[--y];g[y-1]=Math.fround(g[y-1]/d),S+=1;break}case 172:{let d=g[--y];g[y-1]=Math.fround(g[y-1]%d),S+=1;break}case 173:g[y-1]=new et(Ne(g[y-1])),S+=1;break;case 30:case 36:{let d=g[--y];g[y-1]=g[y-1]===d?1:0,S+=1;break}case 31:case 37:{let d=g[--y];g[y-1]=g[y-1]!==d?1:0,S+=1;break}case 32:{let d=g[--y];g[y-1]=g[y-1]<d?1:0,S+=1;break}case 33:{let d=g[--y];g[y-1]=g[y-1]<=d?1:0,S+=1;break}case 34:{let d=g[--y];g[y-1]=g[y-1]>d?1:0,S+=1;break}case 35:{let d=g[--y];g[y-1]=g[y-1]>=d?1:0,S+=1;break}case 40:S=D[S+1];break;case 41:S=g[--y]===0?D[S+1]:S+2;break;case 180:{let d=g[--y],b=g[--y];S=Ls(D[S+1],b,d)?D[S+2]:S+3;break}case 181:S=Ls(D[S+1],g[--y],D[S+2])?D[S+3]:S+4;break;case 182:S=Ls(D[S+1],kt[D[S+2]],kt[D[S+3]])?D[S+4]:S+5;break;case 183:S=Ls(D[S+1],kt[D[S+2]],D[S+3])?D[S+4]:S+5;break;case 184:S=kt[D[S+2]]===null==(D[S+1]===1)?D[S+3]:S+4;break;case 185:g[y++]=kt[D[S+1]],g[y++]=kt[D[S+2]],S+=3;break;case 186:g[y++]=kt[D[S+1]],g[y++]=D[S+2],S+=3;break;case 187:g[y-1]=g[y-1]+D[S+1]|0,S+=2;break;case 190:g[y-1]=nl(D[S+1],g[y-1],D[S+2]),S+=3;break;case 188:{let d=D[S+1];kt[d]=kt[d]+D[S+2]|0,S=D[S+3];break}case 189:{let d=kt[D[S+1]],b=kt[D[S+2]];if(d===null)return Ct(D[S+4]);if(b<0||b>=d.data.length)return ot("java.lang.ArrayIndexOutOfBoundsException",Ns(b,d.data.length));g[y++]=d.data[b],S+=5;break}case 42:S=g[--y]!==0?D[S+1]:S+2;break;case 43:{let d=D[S+1];kt[d]=kt[d]+D[S+2]|0,S+=3;break}case 50:g[y-1]=new et(String(g[y-1])),S+=1;break;case 54:g[y-1]=new et(String.fromCharCode(g[y-1])),S+=1;break;case 143:g[y-1]=new et(String(g[y-1])),S+=1;break;case 144:g[y-1]=new et(oe(g[y-1])),S+=1;break;case 120:g[y++]=u[D[S+1]],S+=2;break;case 121:{let d=g[--y];g[y-1]=ci(g[y-1],d),S+=1;break}case 122:{let d=g[--y];g[y-1]=ui(g[y-1],d),S+=1;break}case 123:{let d=g[--y];g[y-1]=hi(g[y-1],d),S+=1;break}case 124:{let d=g[--y];if(d===0)return ot("java.lang.ArithmeticException","/ by zero");g[y-1]=di(g[y-1],d),S+=1;break}case 125:{let d=g[--y];if(d===0)return ot("java.lang.ArithmeticException","/ by zero");g[y-1]=fi(g[y-1],d),S+=1;break}case 126:g[y-1]=Zs(g[y-1]),S+=1;break;case 127:{let d=g[--y];g[y-1]=mi(g[y-1],d),S+=1;break}case 128:{let d=g[--y];g[y-1]=pi(g[y-1],d),S+=1;break}case 129:{let d=g[--y];g[y-1]=yi(g[y-1],d),S+=1;break}case 130:{let d=g[--y];g[y-1]=gi(g[y-1],d),S+=1;break}case 131:{let d=g[--y];g[y-1]=bi(g[y-1],d),S+=1;break}case 132:{let d=g[--y];g[y-1]=Ti(g[y-1],d),S+=1;break}case 133:{let d=g[--y];g[y-1]=g[y-1]+d,S+=1;break}case 134:{let d=g[--y];g[y-1]=g[y-1]-d,S+=1;break}case 135:{let d=g[--y];g[y-1]=g[y-1]*d,S+=1;break}case 136:{let d=g[--y];g[y-1]=g[y-1]/d,S+=1;break}case 137:{let d=g[--y];g[y-1]=g[y-1]%d,S+=1;break}case 138:g[y-1]=-g[y-1],S+=1;break;case 139:g[y-1]=os(g[y-1]),S+=1;break;case 140:g[y-1]=ls(g[y-1]),S+=1;break;case 141:g[y-1]=In(g[y-1]),S+=1;break;case 142:g[y-1]=An(g[y-1]),S+=1;break;case 146:if(g[--y]===null)return Ct(D[S+1]);S+=2;break;case 147:{switch(D[S+1]){case at.ABS_I:g[y-1]=Math.abs(g[y-1])|0;break;case at.ABS_L:{let b=g[y-1];g[y-1]=b<0?Zs(b):b;break}case at.ABS_D:g[y-1]=Math.abs(g[y-1]);break;case at.MAX_I:case at.MAX_D:{let b=g[--y];g[y-1]=Math.max(g[y-1],b);break}case at.MIN_I:case at.MIN_D:{let b=g[--y];g[y-1]=Math.min(g[y-1],b);break}case at.MAX_L:{let b=g[--y],A=g[y-1];g[y-1]=A>=b?A:b;break}case at.MIN_L:{let b=g[--y],A=g[y-1];g[y-1]=A<=b?A:b;break}case at.SQRT:g[y-1]=Math.sqrt(g[y-1]);break;case at.FLOOR:g[y-1]=Math.floor(g[y-1]);break;case at.CEIL:g[y-1]=Math.ceil(g[y-1]);break;case at.ROUND:g[y-1]=xi(g[y-1]);break;case at.ROUND_F:g[y-1]=Si(g[y-1]);break}S+=2;break}case 145:{let d=i.strings[D[S+1]],b=D[S+2],A=g.slice(y-b,y);y-=b;for(let V of A)if(V<0)return ot("java.lang.NegativeArraySizeException",String(V));let M=0,F=1;for(let V of A)F*=V,M+=F;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++]=Wr(d,A,0),S+=3;break}case 51:g[y-1]=new et(g[y-1]?"true":"false"),S+=1;break;case 52:{let d=g[y-1];d===null?g[y-1]=new et("null"):d instanceof zt?g[y-1]=new et(Lr(d)):d instanceof et||(g[y-1]=new et(De(d))),S+=1;break}case 53:{let d=g[--y],b=g[y-1],A=b.value.length+d.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 et(b.value+d.value),S+=1;break}case 60:{let d=D[S+3],b="";if(d!==wt.NONE){let M=g[--y];switch(d){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=oe(M);break;case wt.FLOAT:b=Ne(M);break;case wt.CHAR_ARRAY:if(M===null)return ot("java.lang.NullPointerException",\'Cannot read the array length because "cbuf" is null\');b=ll(M.data);break;default:b=M===null?"null":M instanceof et?M.value:De(M)}}D[S+2]===1&&(b+=`\n`);let A=Xr(D[S+1]===1?"stderr":"stdout",b);if(A)return A;S+=4;break}case 72:{let d=p[D[S+1]];if(d.isStatic&&$[d.classIndex]!==Xe&&tn(d.classIndex))break;let b=D[S+2];if(b>=0&&g[y-d.argCount]===null)return Ct(b);if(mt.length>e.maxCallDepth)return ot("java.lang.StackOverflowError",null);_e(d,S+3);break}case 70:case 71:{let d=D[S]===l.RETURN_VALUE?g[--y]:void 0,b=mt.pop();if(b.initClass>=0&&($[b.initClass]=Xe),Ka(b),!mt.length)return Cn?_r():{outcome:{kind:"completed"},instructions:Dt};if(it=mt[mt.length-1],it.method===Sa){let A=Vr(d);if(A)return A;break}D=it.code,kt=it.locals,g=it.stack,y=it.sp,S=it.returnPc,d!==void 0&&(g[y++]=d);break}case 80:{let d=g[y-1];if(d<0)return ot("java.lang.NegativeArraySizeException",String(d));if(ge+d>e.maxArrayElements)return ke("memory",`the program allocated more than ${e.maxArrayElements.toLocaleString("en-US")} array elements`);ge+=d,Dt+=d>>>4,g[y-1]=new Rt(D[S+1],Nr(D[S+1],d),o.next()),S+=2;break}case 84:{let d=g[y-1];if(d<0)return ot("java.lang.NegativeArraySizeException",String(d));if(ge+d>e.maxArrayElements)return ke("memory",`the program allocated more than ${e.maxArrayElements.toLocaleString("en-US")} array elements`);ge+=d,Dt+=d>>>4,g[y-1]=new Rt(z.REF,Nr(z.REF,d),o.next(),i.strings[D[S+1]]),S+=2;break}case 81:{let d=g[--y],b=g[y-1];if(b===null)return Ct(D[S+2]);if(d<0||d>=b.data.length)return ot("java.lang.ArrayIndexOutOfBoundsException",Ns(d,b.data.length));g[y-1]=b.data[d],S+=3;break}case 82:{let d=g[--y],b=g[--y],A=g[--y];if(A===null)return Ct(D[S+2]);if(b<0||b>=A.data.length)return ot("java.lang.ArrayIndexOutOfBoundsException",Ns(b,A.data.length));if(d!==null&&D[S+1]===z.REF&&A.descriptor!=="[Ljava.lang.Object;"&&!j(d,A.descriptor))return ot("java.lang.ArrayStoreException",Kt(d));A.data[b]=d,S+=3;break}case 83:{let d=g[y-1];if(d===null)return Ct(D[S+1]);g[y-1]=d.data.length,S+=2;break}case 90:{let d=g[y-1];if(d===null)return Ct(D[S+1]);g[y-1]=d.value.length,S+=2;break}case 91:{let d=g[--y],b=g[y-1];if(b===null)return Ct(D[S+1]);if(d<0||d>=b.value.length)return ot("java.lang.StringIndexOutOfBoundsException",Ns(d,b.value.length));g[y-1]=b.value.charCodeAt(d),S+=2;break}case 92:{let d=g[--y],b=g[y-1];if(b===null)return Ct(D[S+1]);g[y-1]=d instanceof et&&d.value===b.value?1:0,S+=2;break}case 153:{let d=g[--y],b=g[y-1];if(b===null)return Ct(D[S+1]);if(d===null)return Ct(D[S+2]);let A=b.value,M=d.value,F=Math.min(A.length,M.length),V=A.length-M.length;for(let pt=0;pt<F;pt++){let Ue=A.charCodeAt(pt)-M.charCodeAt(pt);if(Ue!==0){V=Ue;break}}Dt+=F>>>4,g[y-1]=V,S+=3;break}case 100:{let d=D[S+1],b=k[d];if($[b]!==Xe&&tn(b))break;g[y++]=x[d],S+=2;break}case 101:{let d=D[S+1],b=k[d];if($[b]!==Xe&&tn(b))break;x[d]=g[--y],S+=2;break}case 102:{let d=g[y-1];if(d===null)return Ct(D[S+2]);g[y-1]=d.fields[D[S+1]],S+=3;break}case 103:{let d=g[--y],b=g[--y];if(b===null)return Ct(D[S+2]);b.fields[D[S+1]]=d,S+=3;break}case 104:{let d=D[S+1];if($[d]!==Xe&&tn(d))break;g[y++]=new Ut(I[d].name,d,L[d].slice(),o.next()),S+=2;break}case 110:{let d=g[y-1];if(d instanceof Ut){let b=I[d.classIndex].toString;if(b>=0){if(mt.length>e.maxCallDepth)return ot("java.lang.StackOverflowError",null);_e(p[b],S+1);break}g[y-1]=new et(De(d))}else if(d===null)g[y-1]=new et("null");else if(d instanceof Rt)g[y-1]=new et(Ir(d));else if(d instanceof zt)g[y-1]=new et(Lr(d));else if(d instanceof me){y--;let b=Ze(zr(d),!0,S+1);if(b)return b;break}S+=1;break}case 148:{let d=D[S+1],b=i.natives[d],A=D[S+2];if(A>=0&&g[y-b.argCount]===null)return Ct(A);let M=g.slice(y-b.argCount,y);y-=b.argCount;let F;try{F=h[d](je,M)}catch(V){let pt=ns(V);if(pt)return pt;throw V}if(F instanceof Je){let V=Gr(F,b.returnsValue,S+3);if(V)return V;break}if(Or(F)){let V=Ze(F,b.returnsValue,S+3);if(V)return V;break}b.returnsValue&&(g[y++]=F??null),S+=3;break}case 149:g[y-1]=_s(Tr[D[S+1]],g[y-1]),S+=2;break;case 150:{let d=g[y-1];if(d===null)return Ct(D[S+2]);g[y-1]=d.value,S+=3;break}case 154:g[y++]=Yr[D[S+1]],S+=2;break;case 155:s.result(g[--y]),S+=1;break;case 152:{let d=D[S+1],b=D[S+2],A=c[D[S+3]].value,M=D[S+5]>=0?c[D[S+5]].value:null;if(b===0){let F=Ur.get(d);F||Ur.set(d,F=new pe(`${p[d].className}$$Lambda`,d,o.next(),[],A,D[S+4],M)),g[y++]=F}else{let F=g.slice(y-b,y);y-=b,g[y++]=new pe(`${p[d].className}$$Lambda`,d,o.next(),F,A,D[S+4],M)}S+=6;break}case 151:{let d=g[y-1];if(d===null)return Ct(D[S+1]);let b=new Uint16Array(d.value.length);for(let A=0;A<b.length;A++)b[A]=d.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()),S+=2;break}case 111:{let d=g[y-1];if(d===null)return Ct(D[S+1]);if(d instanceof Ut&&I[d.classIndex].toString>=0){if(mt.length>e.maxCallDepth)return ot("java.lang.StackOverflowError",null);_e(p[I[d.classIndex].toString],S+2);break}if(d instanceof me){y--;let b=Ze(zr(d),!0,S+2);if(b)return b;break}d instanceof zt?g[y-1]=new et(Lr(d)):d instanceof et||(g[y-1]=new et(De(d))),S+=2;break}case 112:{let d=g[y-1];if(d===null)return Ct(D[S+1]);if(d instanceof Ut&&I[d.classIndex].hashCode>=0){if(mt.length>e.maxCallDepth)return ot("java.lang.StackOverflowError",null);_e(p[I[d.classIndex].hashCode],S+2);break}if(d instanceof me&&!(d instanceof pe)&&m?.natives["hashCode()"]){let b=Kr("hashCode()",[d],S+2);if(b)return b;break}g[y-1]=d instanceof et?dl(d.value):d instanceof zt?fl(d):d.hash,S+=2;break}case 113:{let d=g[y-1],b=g[y-2];if(b===null)return Ct(D[S+1]);if(b instanceof Ut&&I[b.classIndex].equals>=0){if(mt.length>e.maxCallDepth)return ot("java.lang.StackOverflowError",null);_e(p[I[b.classIndex].equals],S+2);break}if(b instanceof me&&!(b instanceof pe)&&m?.natives["equals(Object)"]){let A=Kr("equals(Object)",[b,d],S+2);if(A)return A;break}y--,b instanceof et?g[y-1]=d instanceof et&&d.value===b.value?1:0:b instanceof zt?g[y-1]=d instanceof zt&&d.kind===b.kind&&Object.is(d.value,b.value)?1:0:g[y-1]=b===d?1:0,S+=2;break}case 159:{let d=D[S+1];if(d===2){let b=g[--y];g[y-1]=g[y-1]===b?1:0}else{let b=g[y-1];g[y-1]=d===0?new et(De(b)):b.hash}S+=2;break}case 156:{let d=p[D[S+1]],b=D[S+2],A=g[y-d.argCount];if(A===null)return Ct(b);let M=d;if(A instanceof Ut){let F=I[A.classIndex].vtable[d.selector];F>=0&&(M=p[F])}else if(A instanceof pe&&A.samSelector===d.selector){let F=y-d.argCount,V=g.slice(F+1,y);y=F;for(let pt of A.captured)g[y++]=pt;for(let pt of V)g[y++]=pt;M=p[A.method]}if(mt.length>e.maxCallDepth)return ot("java.lang.StackOverflowError",null);_e(M,S+3);break}case 157:{let d=g[y-1],b=i.strings[D[S+1]];if(d!==null&&!st(d,b)){let A=b.startsWith("[")?b:b.slice(1,-1);return ot("java.lang.ClassCastException",kn(d,A))}S+=2;break}case 160:{let d=I[D[S+1]],b=g[y-1];if(b===null)return ot("java.lang.NullPointerException","Name is null");let A=d.enumConstants.find(M=>x[M].fields[0].value===b.value);if(A===void 0)return ot("java.lang.IllegalArgumentException",`No enum constant ${d.canonicalName}.${b.value}`);g[y-1]=x[A],S+=2;break}case 158:g[y-1]=st(g[y-1],i.strings[D[S+1]])?1:0,S+=2;break;case 161:{let d=g[--y];if(d===null)return Ct(D[S+1]);throw new vn(d)}case 162:{let d=D[S+1];if(d===Mt.PRINT_TRACE||d===Mt.PRINT_UNCAUGHT){let b=g[--y],A=Ze(Wa(b,d===Mt.PRINT_UNCAUGHT),!1,S+2);if(A)return A;break}if(d===Mt.FILL_TRACE){let b=g[y-1],A=I[b.classIndex].types,M=F=>(F.method.name==="<init>"||F.method.name==="fillInStackTrace")&&A.includes(F.method.className);b.fields[ut.trace]=new Ms(Dr(M))}else if(d===Mt.ADD_SUPPRESSED){let b=g[--y],A=g[--y];if(b===A)return ot("java.lang.IllegalArgumentException","Self-suppression not permitted",b);if(b===null)return ot("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(d===Mt.GET_SUPPRESSED){let b=g[y-1],A=Gs(b);je.allocate(A.length),g[y-1]=new Rt(z.REF,A.slice(),o.next(),"[Ljava.lang.Throwable;")}else if(d===Mt.CLASS_NAME)g[y-1]=new et(g[y-1].className);else if(d===Mt.INIT_CAUSE){let b=g[y-1],A=g[y-2];if(A.fields[ut.causeSet]){y-=2;let M=Ze(qa(A,b),!1,S+2);if(M)return M;break}if(b===A)return ot("java.lang.IllegalArgumentException","Self-causation not permitted",A);A.fields[ut.cause]=b,A.fields[ut.causeSet]=1,y--}S+=2;break}default:throw new Error(`interpreter: unknown opcode ${D[S]} at ${S}`)}}}catch(d){if(!(d instanceof vn))throw d;let b=za(d.thrown);if(b)return b}function Gs(d){return d.fields[ut.suppressed]??[]}function*ss(d){let b=yield{invoke:I[d.classIndex].toString,args:[d]};return b==null?"null":b.value}function*qa(d,b){let A=b===null?"a null":yield*ss(b);return ot("java.lang.IllegalStateException",`Can\'t overwrite cause with ${A}`,d)}function*Wa(d,b){let A=Et=>je.print("err",Et),M=new Set([d]),F=Et=>(Et.fields[ut.trace]?.frames??[]).map(ba),V=Et=>[...F(Et),...al].slice(0,1024);function*pt(Et){return yield{invoke:I[Et.classIndex].virtuals["getCause/0"],args:[Et]}}function*Ue(Et,Zr,ti,en){if(M.has(Et)){A(`${en}${ti}[CIRCULAR REFERENCE: ${yield*ss(Et)}]\n`);return}M.add(Et);let Be=V(Et),En=Be.length-1;for(let be=Zr.length-1;En>=0&&be>=0&&Be[En]===Zr[be];be--)En--;let ei=Be.length-1-En;A(`${en}${ti}${yield*ss(Et)}\n`);for(let be=0;be<=En;be++)Be[be].startsWith(Mr)||A(`${en} at ${Be[be]}\n`);ei&&A(`${en} ... ${ei} more\n`);for(let be of Gs(Et))yield*Ue(be,Be,"Suppressed: ",en+" ");let ni=yield*pt(Et);ni&&(yield*Ue(ni,Be,"Caused by: ",en))}b&&A(\'Exception in thread "main" \'),A(`${yield*ss(d)}\n`);let zs=b?F(d):V(d);for(let Et of zs)Et.startsWith(Mr)||A(` at ${Et}\n`);for(let Et of Gs(d))yield*Ue(Et,zs,"Suppressed: "," ");let Qr=yield*pt(d);Qr&&(yield*Ue(Qr,zs,"Caused by: ",""))}}var Jt=class extends Error{},ye=class extends Error{},Qe=class extends Error{},Ca=i=>i.replace(/\\s+/g,"");function Aa(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(f=>f.name===t.method&&!f.lambda));if(t.params){let h=t.params.map(Ca);n=n.filter(f=>f.params.length===h.length&&f.params.every((p,C)=>Ca(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,f)=>ts(h,t,`parameter ${f+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=ts(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 Ia(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`[${Ia(i.element)}`;default:return"Ljava.lang.Object;"}}var ml={int:z.INT,boolean:z.BOOLEAN,char:z.CHAR,long:z.LONG,double:z.DOUBLE};function ts(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:ts(i.element,t,e),arrayKind:ml[i.element.tag]??z.REF,descriptor:Ia(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:ts(i.args[0],t,e)};break;case"class":return pl(i.symbol,t,e)}throw new Jt(`${e} has type ${P(i)}, which practice cases cannot pass or compare yet`)}function pl(i,t,e){let n=i.fields.filter(C=>!C.isStatic),s=C=>{let T=n.find(w=>w.name===C);if(!T)throw new Jt(`practice.nodes.${i.name}: ${i.name} has no field ${C}`);return T},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=ts(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(T=>T.name===C),f=o?.left?s(o.left):h("left")??r[0],p=o?.right?s(o.right):h("right")??r.find(C=>C!==f);if(!f||!p)throw new Jt(`practice.nodes.${i.name} needs its left and right fields`);return{kind:"tree",cls:i,value:u,valueCodec:m,left:f,right:p}}var yl=-2147483648,gl=2147483647,bl=-(1n<<63n),Tl=(1n<<63n)-1n;function wn(i){return JSON.stringify(i)??"undefined"}function Ea(i,t,e){let n=s=>{throw new ye(`${e}: expected ${s}, got ${wn(i)}`)};switch(t){case"int":return(typeof i!="number"||!Number.isInteger(i)||i<yl||i>gl)&&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<bl||s>Tl)&&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 Zn(i,t,e,n){switch(t.kind){case"int":case"long":case"double":case"char":case"boolean":return Ea(i,t.kind,n);case"string":if(i===null)return null;if(typeof i!="string")throw new ye(`${n}: expected a String, got ${wn(i)}`);return e.string(i);case"box":return i===null?null:e.box(t.box,Ea(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 ${wn(i)}`);e.allocate(i.length);let s=i.map((a,o)=>Zn(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 ${wn(i)}`);return e.list(i.map((s,r)=>Zn(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 ${wn(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]=Zn(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 ${wn(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]=Zn(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 Oa=1e5;function Ye(i,t,e){let n=s=>{if(e.nodes-=s,e.nodes<0)throw new Qe(`the result has more than ${Oa.toLocaleString("en-US")} elements, or is cyclic`)};switch(t.kind){case"int":return i;case"long":return String(i);case"double":return Sl(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:Ye(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=>Ye(r,t.element,e))}case"list":{if(i===null)return null;let s=cn()?.listItems(i);if(!s)throw new Qe("the result is not an ArrayList");return n(s.length),s.map(r=>Ye(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 Qe(`the ${t.cls.name} list has a cycle`);r.add(a),n(1),s.push(Ye(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(Ye(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 Sl(i){return Number.isNaN(i)?"NaN":i===1/0?"Infinity":i===-1/0?"-Infinity":i}function Rs(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)=>Rs(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=>Rs(i[s],t[s],e))}return i===t}function La(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)=>Zn(o,i.params[c],a,`argument ${c+1}`)),result:a=>{n=a}},actual:()=>{let a={nodes:Oa};return i.compareIndex!==null?Ye(e[i.compareIndex],i.params[i.compareIndex],a):Ye(n,i.result,a)}}}function xl(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 Na(i,t){let e=t.flatMap(r=>xl(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 Rr={maxFiles:32,maxSourceChars:5e5,maxTotalSourceChars:1e6,maxNestingDepth:200,maxExpressionDepth:1e3,maxInstructions:2e8,maxOutputChars:1e6,maxStringLength:1e7,maxArrayElements:16e6,maxCallDepth:5e4,maxDurationMs:0},es=()=>globalThis.performance.now();function vl(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 Ma(i,t={}){return Pa(i,t).result}function Pa(i,t,e=!0){let n=es(),s={...Rr,...t.limits},r=vl(i,t.entry),a=i[r]??"",o=Ks(r,a),c=new nn,u=new Map([[r,o]]),m=null,h=w=>({result:{program:w,diagnostics:c.items,entry:r,diagnosticText:c.items.length?qs(c.items,u):"",compileMs:es()-n},checked:m,source:o});if(Object.keys(i).length>s.maxFiles)return c.launchError(r,v.limit,`too many files for this engine (limit ${s.maxFiles})`),h(null);if(!(r in i))return c.launchError(r,v.noMain,`file not found: ${r}`),h(null);let f=new Set(Object.keys(i).filter(w=>w!==r&&w.endsWith(".java")&&!/[\\\\/]/.test(w))),p=[r],C=[],T=0;for(;;){for(let w of p.slice(C.length)){let x=i[w]??"",k=w===r?o:Ks(w,x);if(u.set(w,k),x.length>s.maxSourceChars)return c.launchError(w,v.limit,`${w} is too large for this engine (limit ${s.maxSourceChars.toLocaleString("en-US")} characters)`),h(null);if(T+=x.length,T>s.maxTotalSourceChars)return c.launchError(w,v.limit,`the program\'s files are too large for this engine together (limit ${s.maxTotalSourceChars.toLocaleString("en-US")} characters)`),h(null);let I=oi(x);if(I.errors.length){for(let $ of I.errors)c.error(k,$.offset,"lex",$.code,$.message);return h(null)}let L=Ni(w,I.tokens,s);if(L.error)return L.error.code==="no-class"?w===r?c.launchError(w,v.noMain,L.error.message):c.launchError(r,v.unsupported,`${w} declares no class, so the launcher cannot find ${w.replace(/\\.java$/,"")} there`):c.error(k,L.error.offset,"parse",L.error.code,L.error.message,L.error.details),h(null);C.push({unit:L.unit,file:k})}try{let w=new Set([...f].filter(k=>!p.includes(k))),x=ia(C,c,{launch:e,available:w});return!x||c.hasErrors?h(null):(m=x,h(e?wl(Ar(x,o),x,c.items,u,r):null))}catch(w){if(w instanceof Kn){p.push(w.fileName),C.length=0,T=0,c=new nn,u=new Map([[r,o]]);continue}if(w instanceof qe)return c=new nn,c.launchError(r,v.unsupported,`${w.message}: not supported in this version`),h(null);if(!(w instanceof on))throw w;return{result:{program:null,diagnostics:[],entry:r,diagnosticText:"",compileMs:es()-n,needsLibrary:!0},checked:null,source:o}}}}function wl(i,t,e,n,s){let r=[];for(let a of n.keys()){if(a===s)continue;let o=e.filter(u=>u.severity==="warning"&&u.file===a);if(!o.length)continue;let c=t.classes.filter(u=>u.topLevel.file?.name===a).map(u=>u.index);r.push({classes:c,text:qs(o,n)})}return r.length&&(i.loadWarnings=r),i}var kl={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."},Cl="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 Ra(i,t={}){return Ja(i,t)}var El="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 Ja(i,t,e){let n={...Rr,...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=es(),{outcome:c,instructions:u,inputExhausted:m}=ka(i,a,n,t.onCheckpoint,e,t.stdin??""),h=es()-o,f={stdout:s,diagnostics:[],instructions:u,compileMs:t.compileMs??0,runMs:h};switch(c.kind){case"completed":return{...f,status:"success",stderr:r,exitCode:0};case"exception":{let p=c.text;return m&&c.className==="java.util.NoSuchElementException"?{...f,status:"runtime-error",stderr:r+p,errorText:p,hint:El,hintAbout:"stdin",exitCode:1}:{...f,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{...f,status:"resource-limit",stderr:r+p,errorText:p,hint:kl[c.limit],exitCode:1}}case"engine-limitation":{let p=`Stopped: ${c.message} (limitation of this in-browser Java engine).\n`;return{...f,status:"engine-limitation",stderr:r+p,errorText:p,hint:Cl,exitCode:1}}case"exit":return{...f,status:c.status===0?"success":"exited",stderr:r,exitCode:c.status,exited:!0}}}var $a=500;function Da(i,t,e={}){let n={...Rr,...e.limits},s=Array.isArray(t.cases)?t.cases:[],r=C=>s.map((T,w)=>({id:T.id??String(w+1),status:"not-run",args:T.args??[],expected:T.expected,stdout:"",stderr:"",reason:C,instructions:0,durationMs:0})),{result:a,checked:o,source:c}=Pa(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>$a)return m(`too many cases (limit ${$a})`);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=Aa(o,t)}catch(C){if(C instanceof Jt)return m(C.message);throw C}let f=Ar(o,c,h.target),p=[];for(let[C,T]of s.entries()){let w=Array.isArray(T.args)?T.args:[],x={id:T.id??String(C+1),status:"not-run",args:w,expected:T.expected,stdout:"",stderr:"",instructions:0,durationMs:0};p.push(x);let k,I;try{let L=La(h,w);I=L.actual,k=Ja(f,{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=k.stdout,x.stderr=k.errorText?k.stderr.slice(0,k.stderr.length-k.errorText.length):k.stderr,x.instructions=k.instructions,x.durationMs=Math.round(k.runMs*100)/100,k.exited){x.status="runtime-error",x.error=`System.exit(${k.exitCode}) ended the program before ${t.method}() returned`;continue}if(k.status!=="success"){x.status=k.status==="runtime-error"||k.status==="resource-limit"||k.status==="engine-limitation"?k.status:"runtime-error",x.error=k.errorText,k.hint&&(x.hint=k.hint);continue}try{x.actual=I()}catch(L){if(!(L instanceof Qe))throw L;x.status="runtime-error",x.error=`ResultEncodingError: ${L.message}`;continue}x.status=T.expected===void 0?"completed":Rs(x.actual,T.expected,h.tolerance)?"passed":"failed"}return{...u,status:"completed",cases:p,passed:p.filter(C=>C.status==="passed").length}}var Al={JString:et,JArray:Rt,JObject:Ut,JBox:zt,JLibObject:me,JLambda:pe,NativeThen:Je,doubleToString:oe,objectToString:De,normLong:vt,floatToString:Ne,floatToIntBits:cs,intBitsToFloat:wi,parseDecimalFloat:tr,parseHexFloating:Ei,l2f:an};function Fa(i){Ri(i(Al))}var ja="javaOnlineCompilerLibrary";var _a="0.27.0";var Js="java-library";async function Il(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[ja];if(typeof n!="function")throw new Error("the library script did not define its factory");return n}var Ol=8192,Ba=16;function Va(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 T=n[n.length-1];T&&T.type===p?T.text+=C:n.push({type:p,text:C}),s+=C.length,(s>=Ol||e()-r>=Ba)&&c()},m=p=>{a=p.id,n=[],s=0,r=e();let C=e(),T=p.entry||"Main.java",w=p.files&&Object.keys(p.files).length?{...p.files}:{};T in w||(w[T]=p.code??"");try{let x=()=>{n.length&&e()-r>=Ba&&c()};if(p.practice){h(p,w,T,C);return}let k=Ma(w,{entry:T,limits:t.limits});if(k.needsLibrary){o=p,i({type:"module-request",id:p.id,name:Js});return}let I=k.program?Ra(k.program,{limits:t.limits,stdin:p.stdin??"",onOutput:u,onCheckpoint:x,compileMs:k.compileMs,warnings:k.diagnosticText}):{status:"compile-error",stdout:"",stderr:k.diagnosticText,errorText:k.diagnosticText,diagnostics:k.diagnostics,exitCode:1,instructions:0,compileMs:k.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 k=x instanceof Error?x.message:String(x);i({type:"fatal",id:p.id,message:`Internal error in the Java engine: ${k}`})}},h=(p,C,T,w)=>{let x=p.practice,k=Da(C,x,{entry:T,limits:t.limits});if(k.needsLibrary){o=p,i({type:"module-request",id:p.id,name:Js});return}let I=e()-w;switch(k.status){case"completed":i({type:"stdout",id:p.id,text:Na(x.method,k.cases)}),i({type:"result",id:p.id,durationMs:I,status:"success",cases:k.cases,passed:k.passed,total:k.total});return;case"compile-error":i({type:"error",id:p.id,message:k.diagnosticText.replace(/\\n$/,""),durationMs:I,status:"compile-error",cases:k.cases,...k.diagnostics.length?{diagnostics:k.diagnostics}:{}});return;case"invalid-practice":i({type:"error",id:p.id,message:`Practice: ${k.message}`,durationMs:I,status:"invalid-practice",cases:k.cases});return;case"internal-error":i({type:"fatal",id:p.id,message:k.message??"Internal error in the Java engine"});return}},f=async p=>{let C=o;if(!(!C||p.name!==Js)){o=null;try{if(p.code===void 0)throw new Error(p.error??"the host sent no code");Fa(await(t.evaluateLibrary??Il)(p.code))}catch(T){let w=T instanceof Error?T.message:String(T);i({type:"fatal",id:C.id,message:`Internal error in the Java engine: could not load the Java library (${w})`});return}m(C)}};return p=>{switch(p.type){case"init":i({type:"ready",version:"25",interactiveStdin:!1,java:"25",engine:_a});return;case"run":m(p);return;case"stdin-response":return;case"module":return f(p)}}}var Ha=globalThis,Ll=Va(i=>Ha.postMessage(i));Ha.onmessage=i=>Ll(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-I0MB-4YJ.js`);return t}get label(){return this.version?`Java ${this.version} (subset)`:`Java`}async editorLanguage(){let{java:e}=await import(`./dist-BKRQwpg6.js`);return e()}};export{n as javaRuntime};
|