@viji-dev/core 0.14.0 → 0.16.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.
@@ -1,587 +0,0 @@
1
- function vn(e){if(typeof e=="string")return Jl(e);if(e&&typeof e=="object"){const t=e,s="r"in t&&"g"in t&&"b"in t;if("h"in t&&"s"in t&&"b"in t&&!("r"in t)&&!("g"in t))return a1(t);if(s)return n1(t);throw new Error(`Invalid color object: expected {r,g,b} or {h,s,b} keys, got ${JSON.stringify(e)}`)}throw new Error(`Invalid color input: expected string or object, got ${typeof e}`)}function _i(e){const t=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);if(!t)throw new Error(`Expected canonical hex '#rrggbb', got: ${e}`);return{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}}function qa(e){const{r:t,g:s,b:i}=_i(e),n=t/255,a=s/255,o=i/255,u=Math.max(n,a,o),l=Math.min(n,a,o),h=u-l;let d=0;h>0&&(u===n?d=(a-o)/h%6:u===a?d=(o-n)/h+2:d=(n-a)/h+4,d*=60,d<0&&(d+=360));const m=u===0?0:h/u*100,_=u*100;return{h:en(d,4),s:en(m,4),b:en(_,4)}}function Ql(e){const{r:t,g:s,b:i}=_i(e);return[t/255,s/255,i/255]}function ei(e,t,s){const i=Qr(e,"r"),n=Qr(t,"g"),a=Qr(s,"b");return"#"+Jr(i)+Jr(n)+Jr(a)}function rc(e,t,s){if(typeof e!="number"||typeof t!="number"||typeof s!="number"||!isFinite(e)||!isFinite(t)||!isFinite(s))throw new Error(`Invalid HSB: h=${e}, s=${t}, b=${s}`);if(t<0||t>100)throw new Error(`HSB saturation must be 0..100, got: ${t}`);if(s<0||s>100)throw new Error(`HSB brightness must be 0..100, got: ${s}`);const i=(e%360+360)%360,n=t/100,a=s/100,o=a*n,u=i/60,l=o*(1-Math.abs(u%2-1));let h=0,d=0,m=0;u<1?(h=o,d=l,m=0):u<2?(h=l,d=o,m=0):u<3?(h=0,d=o,m=l):u<4?(h=0,d=l,m=o):u<5?(h=l,d=0,m=o):(h=o,d=0,m=l);const _=a-o;return ei(Math.round((h+_)*255),Math.round((d+_)*255),Math.round((m+_)*255))}function Jl(e){const t=e.trim();if(t.startsWith("#"))return e1(t);const s=t.match(/^(rgb|hsl|hsb|vec3)\s*\(([^)]*)\)$/i);if(s){const i=s[1].toLowerCase(),n=s[2];switch(i){case"rgb":return t1(n);case"hsl":return s1(n);case"hsb":return i1(n);case"vec3":return r1(n)}}throw new Error(`Invalid color string: '${e}'. Expected #rrggbb, #rgb, rgb(...), hsl(...), hsb(...), or vec3(...)`)}function e1(e){if(/^#[0-9a-fA-F]{6}$/.test(e))return e.toLowerCase();if(/^#[0-9a-fA-F]{3}$/.test(e)){const t=e[1],s=e[2],i=e[3];return("#"+t+t+s+s+i+i).toLowerCase()}throw new Error(`Invalid hex color: '${e}'. Expected #rrggbb or #rgb`)}function t1(e){const t=$i(e);if(t.length!==3)throw new Error(`rgb() requires 3 arguments, got ${t.length}: rgb(${e})`);const s=dt(t[0],"r"),i=dt(t[1],"g"),n=dt(t[2],"b");return ei(s,i,n)}function s1(e){const t=$i(e);if(t.length!==3)throw new Error(`hsl() requires 3 arguments, got ${t.length}: hsl(${e})`);const s=dt(t[0],"h"),i=Ha(t[1],"s"),n=Ha(t[2],"l");return o1(s,i,n)}function i1(e){const t=$i(e);if(t.length!==3)throw new Error(`hsb() requires 3 arguments, got ${t.length}: hsb(${e})`);const s=dt(t[0],"h"),i=dt(t[1],"s"),n=dt(t[2],"b");return rc(s,i,n)}function r1(e){const t=$i(e);if(t.length!==3)throw new Error(`vec3() requires 3 arguments, got ${t.length}: vec3(${e})`);const s=dt(t[0],"r"),i=dt(t[1],"g"),n=dt(t[2],"b");if(s<0||s>1||i<0||i>1||n<0||n>1)throw new Error(`vec3() components must be in 0..1, got: vec3(${s}, ${i}, ${n})`);return ei(Math.round(s*255),Math.round(i*255),Math.round(n*255))}function n1(e){const t=_s(e.r,"r"),s=_s(e.g,"g"),i=_s(e.b,"b");return ei(t,s,i)}function a1(e){const t=_s(e.h,"h"),s=_s(e.s,"s"),i=_s(e.b,"b");return rc(t,s,i)}function o1(e,t,s){if(t<0||t>100)throw new Error(`HSL saturation must be 0..100%, got: ${t}%`);if(s<0||s>100)throw new Error(`HSL lightness must be 0..100%, got: ${s}%`);const i=(e%360+360)%360,n=t/100,a=s/100,o=(1-Math.abs(2*a-1))*n,u=i/60,l=o*(1-Math.abs(u%2-1));let h=0,d=0,m=0;u<1?(h=o,d=l,m=0):u<2?(h=l,d=o,m=0):u<3?(h=0,d=o,m=l):u<4?(h=0,d=l,m=o):u<5?(h=l,d=0,m=o):(h=o,d=0,m=l);const _=a-o/2;return ei(Math.round((h+_)*255),Math.round((d+_)*255),Math.round((m+_)*255))}function $i(e){return e.split(",").map(t=>t.trim()).filter(t=>t.length>0)}function dt(e,t){const s=parseFloat(e);if(!isFinite(s))throw new Error(`Invalid number for '${t}': '${e}'`);return s}function Ha(e,t){if(!e.endsWith("%"))throw new Error(`Field '${t}' must use percent notation (e.g., 50%), got: '${e}'`);return dt(e.slice(0,-1),t)}function _s(e,t){if(typeof e!="number"||!isFinite(e))throw new Error(`Invalid color field '${t}': expected finite number, got ${e}`);return e}function Qr(e,t){if(typeof e!="number"||!isFinite(e))throw new Error(`RGB component '${t}' must be a finite number, got: ${e}`);if(e<0||e>255)throw new Error(`RGB component '${t}' must be 0..255, got: ${e}`);return Math.round(e)}function Jr(e){return e.toString(16).padStart(2,"0")}function en(e,t){const s=10**t;return Math.round(e*s)/s}var c1=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,80,3,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,343,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,726,6,110,6,6,9,4759,9,787719,239],nc=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,2,60,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,42,9,8936,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,496,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4153,7,221,3,5761,15,7472,16,621,2467,541,1507,4938,6,4191],u1="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࢗ-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ-ᫎᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‌‍‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・",ac="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢎࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೝೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲊᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꟍꟐꟑꟓꟕ-Ƛꟲ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",tn={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},sn="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",l1={5:sn,"5module":sn+" export import",6:sn+" const class extends export import super"},h1=/^in(stanceof)?$/,f1=new RegExp("["+ac+"]"),p1=new RegExp("["+ac+u1+"]");function kn(e,t){for(var s=65536,i=0;i<t.length;i+=2){if(s+=t[i],s>e)return false;if(s+=t[i+1],s>=e)return true}return false}function Tt(e,t){return e<65?e===36:e<91?true:e<97?e===95:e<123?true:e<=65535?e>=170&&f1.test(String.fromCharCode(e)):t===false?false:kn(e,nc)}function Zt(e,t){return e<48?e===36:e<58?true:e<65?false:e<91?true:e<97?e===95:e<123?true:e<=65535?e>=170&&p1.test(String.fromCharCode(e)):t===false?false:kn(e,nc)||kn(e,c1)}var ye=function(t,s){s===void 0&&(s={}),this.label=t,this.keyword=s.keyword,this.beforeExpr=!!s.beforeExpr,this.startsExpr=!!s.startsExpr,this.isLoop=!!s.isLoop,this.isAssign=!!s.isAssign,this.prefix=!!s.prefix,this.postfix=!!s.postfix,this.binop=s.binop||null,this.updateContext=null};function it(e,t){return new ye(e,{beforeExpr:true,binop:t})}var rt={beforeExpr:true},Ye={startsExpr:true},Yn={};function be(e,t){return t===void 0&&(t={}),t.keyword=e,Yn[e]=new ye(e,t)}var f={num:new ye("num",Ye),regexp:new ye("regexp",Ye),string:new ye("string",Ye),name:new ye("name",Ye),privateId:new ye("privateId",Ye),eof:new ye("eof"),bracketL:new ye("[",{beforeExpr:true,startsExpr:true}),bracketR:new ye("]"),braceL:new ye("{",{beforeExpr:true,startsExpr:true}),braceR:new ye("}"),parenL:new ye("(",{beforeExpr:true,startsExpr:true}),parenR:new ye(")"),comma:new ye(",",rt),semi:new ye(";",rt),colon:new ye(":",rt),dot:new ye("."),question:new ye("?",rt),questionDot:new ye("?."),arrow:new ye("=>",rt),template:new ye("template"),invalidTemplate:new ye("invalidTemplate"),ellipsis:new ye("...",rt),backQuote:new ye("`",Ye),dollarBraceL:new ye("${",{beforeExpr:true,startsExpr:true}),eq:new ye("=",{beforeExpr:true,isAssign:true}),assign:new ye("_=",{beforeExpr:true,isAssign:true}),incDec:new ye("++/--",{prefix:true,postfix:true,startsExpr:true}),prefix:new ye("!/~",{beforeExpr:true,prefix:true,startsExpr:true}),logicalOR:it("||",1),logicalAND:it("&&",2),bitwiseOR:it("|",3),bitwiseXOR:it("^",4),bitwiseAND:it("&",5),equality:it("==/!=/===/!==",6),relational:it("</>/<=/>=",7),bitShift:it("<</>>/>>>",8),plusMin:new ye("+/-",{beforeExpr:true,binop:9,prefix:true,startsExpr:true}),modulo:it("%",10),star:it("*",10),slash:it("/",10),starstar:new ye("**",{beforeExpr:true}),coalesce:it("??",1),_break:be("break"),_case:be("case",rt),_catch:be("catch"),_continue:be("continue"),_debugger:be("debugger"),_default:be("default",rt),_do:be("do",{isLoop:true,beforeExpr:true}),_else:be("else",rt),_finally:be("finally"),_for:be("for",{isLoop:true}),_function:be("function",Ye),_if:be("if"),_return:be("return",rt),_switch:be("switch"),_throw:be("throw",rt),_try:be("try"),_var:be("var"),_const:be("const"),_while:be("while",{isLoop:true}),_with:be("with"),_new:be("new",{beforeExpr:true,startsExpr:true}),_this:be("this",Ye),_super:be("super",Ye),_class:be("class",Ye),_extends:be("extends",rt),_export:be("export"),_import:be("import",Ye),_null:be("null",Ye),_true:be("true",Ye),_false:be("false",Ye),_in:be("in",{beforeExpr:true,binop:7}),_instanceof:be("instanceof",{beforeExpr:true,binop:7}),_typeof:be("typeof",{beforeExpr:true,prefix:true,startsExpr:true}),_void:be("void",{beforeExpr:true,prefix:true,startsExpr:true}),_delete:be("delete",{beforeExpr:true,prefix:true,startsExpr:true})},Je=/\r\n?|\n|\u2028|\u2029/,d1=new RegExp(Je.source,"g");function ws(e){return e===10||e===13||e===8232||e===8233}function oc(e,t,s){s===void 0&&(s=e.length);for(var i=t;i<s;i++){var n=e.charCodeAt(i);if(ws(n))return i<s-1&&n===13&&e.charCodeAt(i+1)===10?i+2:i+1}return-1}var cc=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,qe=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,uc=Object.prototype,m1=uc.hasOwnProperty,g1=uc.toString,Ss=Object.hasOwn||function(e,t){return m1.call(e,t)},Wa=Array.isArray||function(e){return g1.call(e)==="[object Array]"},Ga=Object.create(null);function Ht(e){return Ga[e]||(Ga[e]=new RegExp("^(?:"+e.replace(/ /g,"|")+")$"))}function Ut(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}var b1=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,qs=function(t,s){this.line=t,this.column=s};qs.prototype.offset=function(t){return new qs(this.line,this.column+t)};var qi=function(t,s,i){this.start=s,this.end=i,t.sourceFile!==null&&(this.source=t.sourceFile)};function lc(e,t){for(var s=1,i=0;;){var n=oc(e,i,t);if(n<0)return new qs(s,t-i);++s,i=n}}var wn={ecmaVersion:null,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:false,allowImportExportEverywhere:false,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:false,checkPrivateFields:true,locations:false,onToken:null,onComment:null,ranges:false,program:null,sourceFile:null,directSourceFile:null,preserveParens:false},Xa=false;function y1(e){var t={};for(var s in wn)t[s]=e&&Ss(e,s)?e[s]:wn[s];if(t.ecmaVersion==="latest"?t.ecmaVersion=1e8:t.ecmaVersion==null?(!Xa&&typeof console=="object"&&console.warn&&(Xa=true,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
2
- Defaulting to 2020, but this will stop working in the future.`)),t.ecmaVersion=11):t.ecmaVersion>=2015&&(t.ecmaVersion-=2009),t.allowReserved==null&&(t.allowReserved=t.ecmaVersion<5),(!e||e.allowHashBang==null)&&(t.allowHashBang=t.ecmaVersion>=14),Wa(t.onToken)){var i=t.onToken;t.onToken=function(n){return i.push(n)}}return Wa(t.onComment)&&(t.onComment=_1(t,t.onComment)),t}function _1(e,t){return function(s,i,n,a,o,u){var l={type:s?"Block":"Line",value:i,start:n,end:a};e.locations&&(l.loc=new qi(this,o,u)),e.ranges&&(l.range=[n,a]),t.push(l)}}var Hs=1,Es=2,zn=4,hc=8,Kn=16,fc=32,Hi=64,pc=128,hs=256,ti=512,Wi=Hs|Es|hs;function Zn(e,t){return Es|(e?zn:0)|(t?hc:0)}var xi=0,Qn=1,Vt=2,dc=3,mc=4,gc=5,Ne=function(t,s,i){this.options=t=y1(t),this.sourceFile=t.sourceFile,this.keywords=Ht(l1[t.ecmaVersion>=6?6:t.sourceType==="module"?"5module":5]);var n="";t.allowReserved!==true&&(n=tn[t.ecmaVersion>=6?6:t.ecmaVersion===5?5:3],t.sourceType==="module"&&(n+=" await")),this.reservedWords=Ht(n);var a=(n?n+" ":"")+tn.strict;this.reservedWordsStrict=Ht(a),this.reservedWordsStrictBind=Ht(a+" "+tn.strictBind),this.input=String(s),this.containsEsc=false,i?(this.pos=i,this.lineStart=this.input.lastIndexOf(`
3
- `,i-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(Je).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=f.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=true,this.inModule=t.sourceType==="module",this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=false,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),this.pos===0&&t.allowHashBang&&this.input.slice(0,2)==="#!"&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(Hs),this.regexpState=null,this.privateNameStack=[]},Ct={inFunction:{configurable:true},inGenerator:{configurable:true},inAsync:{configurable:true},canAwait:{configurable:true},allowSuper:{configurable:true},allowDirectSuper:{configurable:true},treatFunctionsAsVar:{configurable:true},allowNewDotTarget:{configurable:true},inClassStaticBlock:{configurable:true}};Ne.prototype.parse=function(){var t=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(t)};Ct.inFunction.get=function(){return(this.currentVarScope().flags&Es)>0};Ct.inGenerator.get=function(){return(this.currentVarScope().flags&hc)>0};Ct.inAsync.get=function(){return(this.currentVarScope().flags&zn)>0};Ct.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e],s=t.flags;if(s&(hs|ti))return false;if(s&Es)return(s&zn)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction};Ct.allowSuper.get=function(){var e=this.currentThisScope(),t=e.flags;return(t&Hi)>0||this.options.allowSuperOutsideMethod};Ct.allowDirectSuper.get=function(){return(this.currentThisScope().flags&pc)>0};Ct.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())};Ct.allowNewDotTarget.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e],s=t.flags;if(s&(hs|ti)||s&Es&&!(s&Kn))return true}return false};Ct.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&hs)>0};Ne.extend=function(){for(var t=[],s=arguments.length;s--;)t[s]=arguments[s];for(var i=this,n=0;n<t.length;n++)i=t[n](i);return i};Ne.parse=function(t,s){return new this(s,t).parse()};Ne.parseExpressionAt=function(t,s,i){var n=new this(i,t,s);return n.nextToken(),n.parseExpression()};Ne.tokenizer=function(t,s){return new this(s,t)};Object.defineProperties(Ne.prototype,Ct);var Ge=Ne.prototype,x1=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;Ge.strictDirective=function(e){if(this.options.ecmaVersion<5)return false;for(;;){qe.lastIndex=e,e+=qe.exec(this.input)[0].length;var t=x1.exec(this.input.slice(e));if(!t)return false;if((t[1]||t[2])==="use strict"){qe.lastIndex=e+t[0].length;var s=qe.exec(this.input),i=s.index+s[0].length,n=this.input.charAt(i);return n===";"||n==="}"||Je.test(s[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(n)||n==="!"&&this.input.charAt(i+1)==="=")}e+=t[0].length,qe.lastIndex=e,e+=qe.exec(this.input)[0].length,this.input[e]===";"&&e++}};Ge.eat=function(e){return this.type===e?(this.next(),true):false};Ge.isContextual=function(e){return this.type===f.name&&this.value===e&&!this.containsEsc};Ge.eatContextual=function(e){return this.isContextual(e)?(this.next(),true):false};Ge.expectContextual=function(e){this.eatContextual(e)||this.unexpected()};Ge.canInsertSemicolon=function(){return this.type===f.eof||this.type===f.braceR||Je.test(this.input.slice(this.lastTokEnd,this.start))};Ge.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),true};Ge.semicolon=function(){!this.eat(f.semi)&&!this.insertSemicolon()&&this.unexpected()};Ge.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),true};Ge.expect=function(e){this.eat(e)||this.unexpected()};Ge.unexpected=function(e){this.raise(e??this.start,"Unexpected token")};var Gi=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};Ge.checkPatternErrors=function(e,t){if(e){e.trailingComma>-1&&this.raiseRecoverable(e.trailingComma,"Comma is not permitted after the rest element");var s=t?e.parenthesizedAssign:e.parenthesizedBind;s>-1&&this.raiseRecoverable(s,t?"Assigning to rvalue":"Parenthesized pattern")}};Ge.checkExpressionErrors=function(e,t){if(!e)return false;var s=e.shorthandAssign,i=e.doubleProto;if(!t)return s>=0||i>=0;s>=0&&this.raise(s,"Shorthand property assignments are valid only in destructuring patterns"),i>=0&&this.raiseRecoverable(i,"Redefinition of __proto__ property")};Ge.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,"Yield expression cannot be a default value"),this.awaitPos&&this.raise(this.awaitPos,"Await expression cannot be a default value")};Ge.isSimpleAssignTarget=function(e){return e.type==="ParenthesizedExpression"?this.isSimpleAssignTarget(e.expression):e.type==="Identifier"||e.type==="MemberExpression"};var Q=Ne.prototype;Q.parseTopLevel=function(e){var t=Object.create(null);for(e.body||(e.body=[]);this.type!==f.eof;){var s=this.parseStatement(null,true,t);e.body.push(s)}if(this.inModule)for(var i=0,n=Object.keys(this.undefinedExports);i<n.length;i+=1){var a=n[i];this.raiseRecoverable(this.undefinedExports[a].start,"Export '"+a+"' is not defined")}return this.adaptDirectivePrologue(e.body),this.next(),e.sourceType=this.options.sourceType,this.finishNode(e,"Program")};var Jn={kind:"loop"},v1={kind:"switch"};Q.isLet=function(e){if(this.options.ecmaVersion<6||!this.isContextual("let"))return false;qe.lastIndex=this.pos;var t=qe.exec(this.input),s=this.pos+t[0].length,i=this.input.charCodeAt(s);if(i===91||i===92)return true;if(e)return false;if(i===123||i>55295&&i<56320)return true;if(Tt(i,true)){for(var n=s+1;Zt(i=this.input.charCodeAt(n),true);)++n;if(i===92||i>55295&&i<56320)return true;var a=this.input.slice(s,n);if(!h1.test(a))return true}return false};Q.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return false;qe.lastIndex=this.pos;var e=qe.exec(this.input),t=this.pos+e[0].length,s;return!Je.test(this.input.slice(this.pos,t))&&this.input.slice(t,t+8)==="function"&&(t+8===this.input.length||!(Zt(s=this.input.charCodeAt(t+8))||s>55295&&s<56320))};Q.isUsingKeyword=function(e,t){if(this.options.ecmaVersion<17||!this.isContextual(e?"await":"using"))return false;qe.lastIndex=this.pos;var s=qe.exec(this.input),i=this.pos+s[0].length;if(Je.test(this.input.slice(this.pos,i)))return false;if(e){var n=i+5,a;if(this.input.slice(i,n)!=="using"||n===this.input.length||Zt(a=this.input.charCodeAt(n))||a>55295&&a<56320)return false;qe.lastIndex=n;var o=qe.exec(this.input);if(o&&Je.test(this.input.slice(n,n+o[0].length)))return false}if(t){var u=i+2,l;if(this.input.slice(i,u)==="of"&&(u===this.input.length||!Zt(l=this.input.charCodeAt(u))&&!(l>55295&&l<56320)))return false}var h=this.input.charCodeAt(i);return Tt(h,true)||h===92};Q.isAwaitUsing=function(e){return this.isUsingKeyword(true,e)};Q.isUsing=function(e){return this.isUsingKeyword(false,e)};Q.parseStatement=function(e,t,s){var i=this.type,n=this.startNode(),a;switch(this.isLet(e)&&(i=f._var,a="let"),i){case f._break:case f._continue:return this.parseBreakContinueStatement(n,i.keyword);case f._debugger:return this.parseDebuggerStatement(n);case f._do:return this.parseDoStatement(n);case f._for:return this.parseForStatement(n);case f._function:return e&&(this.strict||e!=="if"&&e!=="label")&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(n,false,!e);case f._class:return e&&this.unexpected(),this.parseClass(n,true);case f._if:return this.parseIfStatement(n);case f._return:return this.parseReturnStatement(n);case f._switch:return this.parseSwitchStatement(n);case f._throw:return this.parseThrowStatement(n);case f._try:return this.parseTryStatement(n);case f._const:case f._var:return a=a||this.value,e&&a!=="var"&&this.unexpected(),this.parseVarStatement(n,a);case f._while:return this.parseWhileStatement(n);case f._with:return this.parseWithStatement(n);case f.braceL:return this.parseBlock(true,n);case f.semi:return this.parseEmptyStatement(n);case f._export:case f._import:if(this.options.ecmaVersion>10&&i===f._import){qe.lastIndex=this.pos;var o=qe.exec(this.input),u=this.pos+o[0].length,l=this.input.charCodeAt(u);if(l===40||l===46)return this.parseExpressionStatement(n,this.parseExpression())}return this.options.allowImportExportEverywhere||(t||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),i===f._import?this.parseImport(n):this.parseExport(n,s);default:if(this.isAsyncFunction())return e&&this.unexpected(),this.next(),this.parseFunctionStatement(n,true,!e);var h=this.isAwaitUsing(false)?"await using":this.isUsing(false)?"using":null;if(h)return t&&this.options.sourceType==="script"&&this.raise(this.start,"Using declaration cannot appear in the top level when source type is `script`"),h==="await using"&&(this.canAwait||this.raise(this.start,"Await using cannot appear outside of async function"),this.next()),this.next(),this.parseVar(n,false,h),this.semicolon(),this.finishNode(n,"VariableDeclaration");var d=this.value,m=this.parseExpression();return i===f.name&&m.type==="Identifier"&&this.eat(f.colon)?this.parseLabeledStatement(n,d,m,e):this.parseExpressionStatement(n,m)}};Q.parseBreakContinueStatement=function(e,t){var s=t==="break";this.next(),this.eat(f.semi)||this.insertSemicolon()?e.label=null:this.type!==f.name?this.unexpected():(e.label=this.parseIdent(),this.semicolon());for(var i=0;i<this.labels.length;++i){var n=this.labels[i];if((e.label==null||n.name===e.label.name)&&(n.kind!=null&&(s||n.kind==="loop")||e.label&&s))break}return i===this.labels.length&&this.raise(e.start,"Unsyntactic "+t),this.finishNode(e,s?"BreakStatement":"ContinueStatement")};Q.parseDebuggerStatement=function(e){return this.next(),this.semicolon(),this.finishNode(e,"DebuggerStatement")};Q.parseDoStatement=function(e){return this.next(),this.labels.push(Jn),e.body=this.parseStatement("do"),this.labels.pop(),this.expect(f._while),e.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(f.semi):this.semicolon(),this.finishNode(e,"DoWhileStatement")};Q.parseForStatement=function(e){this.next();var t=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(Jn),this.enterScope(0),this.expect(f.parenL),this.type===f.semi)return t>-1&&this.unexpected(t),this.parseFor(e,null);var s=this.isLet();if(this.type===f._var||this.type===f._const||s){var i=this.startNode(),n=s?"let":this.value;return this.next(),this.parseVar(i,true,n),this.finishNode(i,"VariableDeclaration"),this.parseForAfterInit(e,i,t)}var a=this.isContextual("let"),o=false,u=this.isUsing(true)?"using":this.isAwaitUsing(true)?"await using":null;if(u){var l=this.startNode();return this.next(),u==="await using"&&this.next(),this.parseVar(l,true,u),this.finishNode(l,"VariableDeclaration"),this.parseForAfterInit(e,l,t)}var h=this.containsEsc,d=new Gi,m=this.start,_=t>-1?this.parseExprSubscripts(d,"await"):this.parseExpression(true,d);return this.type===f._in||(o=this.options.ecmaVersion>=6&&this.isContextual("of"))?(t>-1?(this.type===f._in&&this.unexpected(t),e.await=true):o&&this.options.ecmaVersion>=8&&(_.start===m&&!h&&_.type==="Identifier"&&_.name==="async"?this.unexpected():this.options.ecmaVersion>=9&&(e.await=false)),a&&o&&this.raise(_.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(_,false,d),this.checkLValPattern(_),this.parseForIn(e,_)):(this.checkExpressionErrors(d,true),t>-1&&this.unexpected(t),this.parseFor(e,_))};Q.parseForAfterInit=function(e,t,s){return(this.type===f._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&t.declarations.length===1?(this.options.ecmaVersion>=9&&(this.type===f._in?s>-1&&this.unexpected(s):e.await=s>-1),this.parseForIn(e,t)):(s>-1&&this.unexpected(s),this.parseFor(e,t))};Q.parseFunctionStatement=function(e,t,s){return this.next(),this.parseFunction(e,Bs|(s?0:Sn),false,t)};Q.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement("if"),e.alternate=this.eat(f._else)?this.parseStatement("if"):null,this.finishNode(e,"IfStatement")};Q.parseReturnStatement=function(e){return!this.inFunction&&!this.options.allowReturnOutsideFunction&&this.raise(this.start,"'return' outside of function"),this.next(),this.eat(f.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,"ReturnStatement")};Q.parseSwitchStatement=function(e){this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(f.braceL),this.labels.push(v1),this.enterScope(0);for(var t,s=false;this.type!==f.braceR;)if(this.type===f._case||this.type===f._default){var i=this.type===f._case;t&&this.finishNode(t,"SwitchCase"),e.cases.push(t=this.startNode()),t.consequent=[],this.next(),i?t.test=this.parseExpression():(s&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),s=true,t.test=null),this.expect(f.colon)}else t||this.unexpected(),t.consequent.push(this.parseStatement(null));return this.exitScope(),t&&this.finishNode(t,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(e,"SwitchStatement")};Q.parseThrowStatement=function(e){return this.next(),Je.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),e.argument=this.parseExpression(),this.semicolon(),this.finishNode(e,"ThrowStatement")};var k1=[];Q.parseCatchClauseParam=function(){var e=this.parseBindingAtom(),t=e.type==="Identifier";return this.enterScope(t?fc:0),this.checkLValPattern(e,t?mc:Vt),this.expect(f.parenR),e};Q.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===f._catch){var t=this.startNode();this.next(),this.eat(f.parenL)?t.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),t.param=null,this.enterScope(0)),t.body=this.parseBlock(false),this.exitScope(),e.handler=this.finishNode(t,"CatchClause")}return e.finalizer=this.eat(f._finally)?this.parseBlock():null,!e.handler&&!e.finalizer&&this.raise(e.start,"Missing catch or finally clause"),this.finishNode(e,"TryStatement")};Q.parseVarStatement=function(e,t,s){return this.next(),this.parseVar(e,false,t,s),this.semicolon(),this.finishNode(e,"VariableDeclaration")};Q.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(Jn),e.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(e,"WhileStatement")};Q.parseWithStatement=function(e){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),e.object=this.parseParenExpression(),e.body=this.parseStatement("with"),this.finishNode(e,"WithStatement")};Q.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,"EmptyStatement")};Q.parseLabeledStatement=function(e,t,s,i){for(var n=0,a=this.labels;n<a.length;n+=1){var o=a[n];o.name===t&&this.raise(s.start,"Label '"+t+"' is already declared")}for(var u=this.type.isLoop?"loop":this.type===f._switch?"switch":null,l=this.labels.length-1;l>=0;l--){var h=this.labels[l];if(h.statementStart===e.start)h.statementStart=this.start,h.kind=u;else break}return this.labels.push({name:t,kind:u,statementStart:this.start}),e.body=this.parseStatement(i?i.indexOf("label")===-1?i+"label":i:"label"),this.labels.pop(),e.label=s,this.finishNode(e,"LabeledStatement")};Q.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,"ExpressionStatement")};Q.parseBlock=function(e,t,s){for(e===void 0&&(e=true),t===void 0&&(t=this.startNode()),t.body=[],this.expect(f.braceL),e&&this.enterScope(0);this.type!==f.braceR;){var i=this.parseStatement(null);t.body.push(i)}return s&&(this.strict=false),this.next(),e&&this.exitScope(),this.finishNode(t,"BlockStatement")};Q.parseFor=function(e,t){return e.init=t,this.expect(f.semi),e.test=this.type===f.semi?null:this.parseExpression(),this.expect(f.semi),e.update=this.type===f.parenR?null:this.parseExpression(),this.expect(f.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,"ForStatement")};Q.parseForIn=function(e,t){var s=this.type===f._in;return this.next(),t.type==="VariableDeclaration"&&t.declarations[0].init!=null&&(!s||this.options.ecmaVersion<8||this.strict||t.kind!=="var"||t.declarations[0].id.type!=="Identifier")&&this.raise(t.start,(s?"for-in":"for-of")+" loop variable declaration may not have an initializer"),e.left=t,e.right=s?this.parseExpression():this.parseMaybeAssign(),this.expect(f.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,s?"ForInStatement":"ForOfStatement")};Q.parseVar=function(e,t,s,i){for(e.declarations=[],e.kind=s;;){var n=this.startNode();if(this.parseVarId(n,s),this.eat(f.eq)?n.init=this.parseMaybeAssign(t):!i&&s==="const"&&!(this.type===f._in||this.options.ecmaVersion>=6&&this.isContextual("of"))?this.unexpected():!i&&(s==="using"||s==="await using")&&this.options.ecmaVersion>=17&&this.type!==f._in&&!this.isContextual("of")?this.raise(this.lastTokEnd,"Missing initializer in "+s+" declaration"):!i&&n.id.type!=="Identifier"&&!(t&&(this.type===f._in||this.isContextual("of")))?this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):n.init=null,e.declarations.push(this.finishNode(n,"VariableDeclarator")),!this.eat(f.comma))break}return e};Q.parseVarId=function(e,t){e.id=t==="using"||t==="await using"?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(e.id,t==="var"?Qn:Vt,false)};var Bs=1,Sn=2,bc=4;Q.parseFunction=function(e,t,s,i,n){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!i)&&(this.type===f.star&&t&Sn&&this.unexpected(),e.generator=this.eat(f.star)),this.options.ecmaVersion>=8&&(e.async=!!i),t&Bs&&(e.id=t&bc&&this.type!==f.name?null:this.parseIdent(),e.id&&!(t&Sn)&&this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?Qn:Vt:dc));var a=this.yieldPos,o=this.awaitPos,u=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Zn(e.async,e.generator)),t&Bs||(e.id=this.type===f.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,s,false,n),this.yieldPos=a,this.awaitPos=o,this.awaitIdentPos=u,this.finishNode(e,t&Bs?"FunctionDeclaration":"FunctionExpression")};Q.parseFunctionParams=function(e){this.expect(f.parenL),e.params=this.parseBindingList(f.parenR,false,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()};Q.parseClass=function(e,t){this.next();var s=this.strict;this.strict=true,this.parseClassId(e,t),this.parseClassSuper(e);var i=this.enterClassBody(),n=this.startNode(),a=false;for(n.body=[],this.expect(f.braceL);this.type!==f.braceR;){var o=this.parseClassElement(e.superClass!==null);o&&(n.body.push(o),o.type==="MethodDefinition"&&o.kind==="constructor"?(a&&this.raiseRecoverable(o.start,"Duplicate constructor in the same class"),a=true):o.key&&o.key.type==="PrivateIdentifier"&&w1(i,o)&&this.raiseRecoverable(o.key.start,"Identifier '#"+o.key.name+"' has already been declared"))}return this.strict=s,this.next(),e.body=this.finishNode(n,"ClassBody"),this.exitClassBody(),this.finishNode(e,t?"ClassDeclaration":"ClassExpression")};Q.parseClassElement=function(e){if(this.eat(f.semi))return null;var t=this.options.ecmaVersion,s=this.startNode(),i="",n=false,a=false,o="method",u=false;if(this.eatContextual("static")){if(t>=13&&this.eat(f.braceL))return this.parseClassStaticBlock(s),s;this.isClassElementNameStart()||this.type===f.star?u=true:i="static"}if(s.static=u,!i&&t>=8&&this.eatContextual("async")&&((this.isClassElementNameStart()||this.type===f.star)&&!this.canInsertSemicolon()?a=true:i="async"),!i&&(t>=9||!a)&&this.eat(f.star)&&(n=true),!i&&!a&&!n){var l=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?o=l:i=l)}if(i?(s.computed=false,s.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),s.key.name=i,this.finishNode(s.key,"Identifier")):this.parseClassElementName(s),t<13||this.type===f.parenL||o!=="method"||n||a){var h=!s.static&&vi(s,"constructor"),d=h&&e;h&&o!=="method"&&this.raise(s.key.start,"Constructor can't have get/set modifier"),s.kind=h?"constructor":o,this.parseClassMethod(s,n,a,d)}else this.parseClassField(s);return s};Q.isClassElementNameStart=function(){return this.type===f.name||this.type===f.privateId||this.type===f.num||this.type===f.string||this.type===f.bracketL||this.type.keyword};Q.parseClassElementName=function(e){this.type===f.privateId?(this.value==="constructor"&&this.raise(this.start,"Classes can't have an element named '#constructor'"),e.computed=false,e.key=this.parsePrivateIdent()):this.parsePropertyName(e)};Q.parseClassMethod=function(e,t,s,i){var n=e.key;e.kind==="constructor"?(t&&this.raise(n.start,"Constructor can't be a generator"),s&&this.raise(n.start,"Constructor can't be an async method")):e.static&&vi(e,"prototype")&&this.raise(n.start,"Classes may not have a static property named prototype");var a=e.value=this.parseMethod(t,s,i);return e.kind==="get"&&a.params.length!==0&&this.raiseRecoverable(a.start,"getter should have no params"),e.kind==="set"&&a.params.length!==1&&this.raiseRecoverable(a.start,"setter should have exactly one param"),e.kind==="set"&&a.params[0].type==="RestElement"&&this.raiseRecoverable(a.params[0].start,"Setter cannot use rest params"),this.finishNode(e,"MethodDefinition")};Q.parseClassField=function(e){return vi(e,"constructor")?this.raise(e.key.start,"Classes can't have a field named 'constructor'"):e.static&&vi(e,"prototype")&&this.raise(e.key.start,"Classes can't have a static field named 'prototype'"),this.eat(f.eq)?(this.enterScope(ti|Hi),e.value=this.parseMaybeAssign(),this.exitScope()):e.value=null,this.semicolon(),this.finishNode(e,"PropertyDefinition")};Q.parseClassStaticBlock=function(e){e.body=[];var t=this.labels;for(this.labels=[],this.enterScope(hs|Hi);this.type!==f.braceR;){var s=this.parseStatement(null);e.body.push(s)}return this.next(),this.exitScope(),this.labels=t,this.finishNode(e,"StaticBlock")};Q.parseClassId=function(e,t){this.type===f.name?(e.id=this.parseIdent(),t&&this.checkLValSimple(e.id,Vt,false)):(t===true&&this.unexpected(),e.id=null)};Q.parseClassSuper=function(e){e.superClass=this.eat(f._extends)?this.parseExprSubscripts(null,false):null};Q.enterClassBody=function(){var e={declared:Object.create(null),used:[]};return this.privateNameStack.push(e),e.declared};Q.exitClassBody=function(){var e=this.privateNameStack.pop(),t=e.declared,s=e.used;if(this.options.checkPrivateFields)for(var i=this.privateNameStack.length,n=i===0?null:this.privateNameStack[i-1],a=0;a<s.length;++a){var o=s[a];Ss(t,o.name)||(n?n.used.push(o):this.raiseRecoverable(o.start,"Private field '#"+o.name+"' must be declared in an enclosing class"))}};function w1(e,t){var s=t.key.name,i=e[s],n="true";return t.type==="MethodDefinition"&&(t.kind==="get"||t.kind==="set")&&(n=(t.static?"s":"i")+t.kind),i==="iget"&&n==="iset"||i==="iset"&&n==="iget"||i==="sget"&&n==="sset"||i==="sset"&&n==="sget"?(e[s]="true",false):i?true:(e[s]=n,false)}function vi(e,t){var s=e.computed,i=e.key;return!s&&(i.type==="Identifier"&&i.name===t||i.type==="Literal"&&i.value===t)}Q.parseExportAllDeclaration=function(e,t){return this.options.ecmaVersion>=11&&(this.eatContextual("as")?(e.exported=this.parseModuleExportName(),this.checkExport(t,e.exported,this.lastTokStart)):e.exported=null),this.expectContextual("from"),this.type!==f.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ExportAllDeclaration")};Q.parseExport=function(e,t){if(this.next(),this.eat(f.star))return this.parseExportAllDeclaration(e,t);if(this.eat(f._default))return this.checkExport(t,"default",this.lastTokStart),e.declaration=this.parseExportDefaultDeclaration(),this.finishNode(e,"ExportDefaultDeclaration");if(this.shouldParseExportStatement())e.declaration=this.parseExportDeclaration(e),e.declaration.type==="VariableDeclaration"?this.checkVariableExport(t,e.declaration.declarations):this.checkExport(t,e.declaration.id,e.declaration.id.start),e.specifiers=[],e.source=null,this.options.ecmaVersion>=16&&(e.attributes=[]);else{if(e.declaration=null,e.specifiers=this.parseExportSpecifiers(t),this.eatContextual("from"))this.type!==f.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause());else{for(var s=0,i=e.specifiers;s<i.length;s+=1){var n=i[s];this.checkUnreserved(n.local),this.checkLocalExport(n.local),n.local.type==="Literal"&&this.raise(n.local.start,"A string literal cannot be used as an exported binding without `from`.")}e.source=null,this.options.ecmaVersion>=16&&(e.attributes=[])}this.semicolon()}return this.finishNode(e,"ExportNamedDeclaration")};Q.parseExportDeclaration=function(e){return this.parseStatement(null)};Q.parseExportDefaultDeclaration=function(){var e;if(this.type===f._function||(e=this.isAsyncFunction())){var t=this.startNode();return this.next(),e&&this.next(),this.parseFunction(t,Bs|bc,false,e)}else if(this.type===f._class){var s=this.startNode();return this.parseClass(s,"nullableID")}else{var i=this.parseMaybeAssign();return this.semicolon(),i}};Q.checkExport=function(e,t,s){e&&(typeof t!="string"&&(t=t.type==="Identifier"?t.name:t.value),Ss(e,t)&&this.raiseRecoverable(s,"Duplicate export '"+t+"'"),e[t]=true)};Q.checkPatternExport=function(e,t){var s=t.type;if(s==="Identifier")this.checkExport(e,t,t.start);else if(s==="ObjectPattern")for(var i=0,n=t.properties;i<n.length;i+=1){var a=n[i];this.checkPatternExport(e,a)}else if(s==="ArrayPattern")for(var o=0,u=t.elements;o<u.length;o+=1){var l=u[o];l&&this.checkPatternExport(e,l)}else s==="Property"?this.checkPatternExport(e,t.value):s==="AssignmentPattern"?this.checkPatternExport(e,t.left):s==="RestElement"&&this.checkPatternExport(e,t.argument)};Q.checkVariableExport=function(e,t){if(e)for(var s=0,i=t;s<i.length;s+=1){var n=i[s];this.checkPatternExport(e,n.id)}};Q.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()};Q.parseExportSpecifier=function(e){var t=this.startNode();return t.local=this.parseModuleExportName(),t.exported=this.eatContextual("as")?this.parseModuleExportName():t.local,this.checkExport(e,t.exported,t.exported.start),this.finishNode(t,"ExportSpecifier")};Q.parseExportSpecifiers=function(e){var t=[],s=true;for(this.expect(f.braceL);!this.eat(f.braceR);){if(s)s=false;else if(this.expect(f.comma),this.afterTrailingComma(f.braceR))break;t.push(this.parseExportSpecifier(e))}return t};Q.parseImport=function(e){return this.next(),this.type===f.string?(e.specifiers=k1,e.source=this.parseExprAtom()):(e.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),e.source=this.type===f.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ImportDeclaration")};Q.parseImportSpecifier=function(){var e=this.startNode();return e.imported=this.parseModuleExportName(),this.eatContextual("as")?e.local=this.parseIdent():(this.checkUnreserved(e.imported),e.local=e.imported),this.checkLValSimple(e.local,Vt),this.finishNode(e,"ImportSpecifier")};Q.parseImportDefaultSpecifier=function(){var e=this.startNode();return e.local=this.parseIdent(),this.checkLValSimple(e.local,Vt),this.finishNode(e,"ImportDefaultSpecifier")};Q.parseImportNamespaceSpecifier=function(){var e=this.startNode();return this.next(),this.expectContextual("as"),e.local=this.parseIdent(),this.checkLValSimple(e.local,Vt),this.finishNode(e,"ImportNamespaceSpecifier")};Q.parseImportSpecifiers=function(){var e=[],t=true;if(this.type===f.name&&(e.push(this.parseImportDefaultSpecifier()),!this.eat(f.comma)))return e;if(this.type===f.star)return e.push(this.parseImportNamespaceSpecifier()),e;for(this.expect(f.braceL);!this.eat(f.braceR);){if(t)t=false;else if(this.expect(f.comma),this.afterTrailingComma(f.braceR))break;e.push(this.parseImportSpecifier())}return e};Q.parseWithClause=function(){var e=[];if(!this.eat(f._with))return e;this.expect(f.braceL);for(var t={},s=true;!this.eat(f.braceR);){if(s)s=false;else if(this.expect(f.comma),this.afterTrailingComma(f.braceR))break;var i=this.parseImportAttribute(),n=i.key.type==="Identifier"?i.key.name:i.key.value;Ss(t,n)&&this.raiseRecoverable(i.key.start,"Duplicate attribute key '"+n+"'"),t[n]=true,e.push(i)}return e};Q.parseImportAttribute=function(){var e=this.startNode();return e.key=this.type===f.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never"),this.expect(f.colon),this.type!==f.string&&this.unexpected(),e.value=this.parseExprAtom(),this.finishNode(e,"ImportAttribute")};Q.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===f.string){var e=this.parseLiteral(this.value);return b1.test(e.value)&&this.raise(e.start,"An export name cannot include a lone surrogate."),e}return this.parseIdent(true)};Q.adaptDirectivePrologue=function(e){for(var t=0;t<e.length&&this.isDirectiveCandidate(e[t]);++t)e[t].directive=e[t].expression.raw.slice(1,-1)};Q.isDirectiveCandidate=function(e){return this.options.ecmaVersion>=5&&e.type==="ExpressionStatement"&&e.expression.type==="Literal"&&typeof e.expression.value=="string"&&(this.input[e.start]==='"'||this.input[e.start]==="'")};var ot=Ne.prototype;ot.toAssignable=function(e,t,s){if(this.options.ecmaVersion>=6&&e)switch(e.type){case"Identifier":this.inAsync&&e.name==="await"&&this.raise(e.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":e.type="ObjectPattern",s&&this.checkPatternErrors(s,true);for(var i=0,n=e.properties;i<n.length;i+=1){var a=n[i];this.toAssignable(a,t),a.type==="RestElement"&&(a.argument.type==="ArrayPattern"||a.argument.type==="ObjectPattern")&&this.raise(a.argument.start,"Unexpected token")}break;case"Property":e.kind!=="init"&&this.raise(e.key.start,"Object pattern can't contain getter or setter"),this.toAssignable(e.value,t);break;case"ArrayExpression":e.type="ArrayPattern",s&&this.checkPatternErrors(s,true),this.toAssignableList(e.elements,t);break;case"SpreadElement":e.type="RestElement",this.toAssignable(e.argument,t),e.argument.type==="AssignmentPattern"&&this.raise(e.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":e.operator!=="="&&this.raise(e.left.end,"Only '=' operator can be used for specifying default value."),e.type="AssignmentPattern",delete e.operator,this.toAssignable(e.left,t);break;case"ParenthesizedExpression":this.toAssignable(e.expression,t,s);break;case"ChainExpression":this.raiseRecoverable(e.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!t)break;default:this.raise(e.start,"Assigning to rvalue")}else s&&this.checkPatternErrors(s,true);return e};ot.toAssignableList=function(e,t){for(var s=e.length,i=0;i<s;i++){var n=e[i];n&&this.toAssignable(n,t)}if(s){var a=e[s-1];this.options.ecmaVersion===6&&t&&a&&a.type==="RestElement"&&a.argument.type!=="Identifier"&&this.unexpected(a.argument.start)}return e};ot.parseSpread=function(e){var t=this.startNode();return this.next(),t.argument=this.parseMaybeAssign(false,e),this.finishNode(t,"SpreadElement")};ot.parseRestBinding=function(){var e=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==f.name&&this.unexpected(),e.argument=this.parseBindingAtom(),this.finishNode(e,"RestElement")};ot.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case f.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(f.bracketR,true,true),this.finishNode(e,"ArrayPattern");case f.braceL:return this.parseObj(true)}return this.parseIdent()};ot.parseBindingList=function(e,t,s,i){for(var n=[],a=true;!this.eat(e);)if(a?a=false:this.expect(f.comma),t&&this.type===f.comma)n.push(null);else{if(s&&this.afterTrailingComma(e))break;if(this.type===f.ellipsis){var o=this.parseRestBinding();this.parseBindingListItem(o),n.push(o),this.type===f.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(e);break}else n.push(this.parseAssignableListItem(i))}return n};ot.parseAssignableListItem=function(e){var t=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(t),t};ot.parseBindingListItem=function(e){return e};ot.parseMaybeDefault=function(e,t,s){if(s=s||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(f.eq))return s;var i=this.startNodeAt(e,t);return i.left=s,i.right=this.parseMaybeAssign(),this.finishNode(i,"AssignmentPattern")};ot.checkLValSimple=function(e,t,s){t===void 0&&(t=xi);var i=t!==xi;switch(e.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(e.name)&&this.raiseRecoverable(e.start,(i?"Binding ":"Assigning to ")+e.name+" in strict mode"),i&&(t===Vt&&e.name==="let"&&this.raiseRecoverable(e.start,"let is disallowed as a lexically bound name"),s&&(Ss(s,e.name)&&this.raiseRecoverable(e.start,"Argument name clash"),s[e.name]=true),t!==gc&&this.declareName(e.name,t,e.start));break;case"ChainExpression":this.raiseRecoverable(e.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":i&&this.raiseRecoverable(e.start,"Binding member expression");break;case"ParenthesizedExpression":return i&&this.raiseRecoverable(e.start,"Binding parenthesized expression"),this.checkLValSimple(e.expression,t,s);default:this.raise(e.start,(i?"Binding":"Assigning to")+" rvalue")}};ot.checkLValPattern=function(e,t,s){switch(t===void 0&&(t=xi),e.type){case"ObjectPattern":for(var i=0,n=e.properties;i<n.length;i+=1){var a=n[i];this.checkLValInnerPattern(a,t,s)}break;case"ArrayPattern":for(var o=0,u=e.elements;o<u.length;o+=1){var l=u[o];l&&this.checkLValInnerPattern(l,t,s)}break;default:this.checkLValSimple(e,t,s)}};ot.checkLValInnerPattern=function(e,t,s){switch(t===void 0&&(t=xi),e.type){case"Property":this.checkLValInnerPattern(e.value,t,s);break;case"AssignmentPattern":this.checkLValPattern(e.left,t,s);break;case"RestElement":this.checkLValPattern(e.argument,t,s);break;default:this.checkLValPattern(e,t,s)}};var ct=function(t,s,i,n,a){this.token=t,this.isExpr=!!s,this.preserveSpace=!!i,this.override=n,this.generator=!!a},Te={b_stat:new ct("{",false),b_expr:new ct("{",true),b_tmpl:new ct("${",false),p_stat:new ct("(",false),p_expr:new ct("(",true),q_tmpl:new ct("`",true,true,function(e){return e.tryReadTemplateToken()}),f_stat:new ct("function",false),f_expr:new ct("function",true),f_expr_gen:new ct("function",true,false,null,true),f_gen:new ct("function",false,false,null,true)},Ts=Ne.prototype;Ts.initialContext=function(){return[Te.b_stat]};Ts.curContext=function(){return this.context[this.context.length-1]};Ts.braceIsBlock=function(e){var t=this.curContext();return t===Te.f_expr||t===Te.f_stat?true:e===f.colon&&(t===Te.b_stat||t===Te.b_expr)?!t.isExpr:e===f._return||e===f.name&&this.exprAllowed?Je.test(this.input.slice(this.lastTokEnd,this.start)):e===f._else||e===f.semi||e===f.eof||e===f.parenR||e===f.arrow?true:e===f.braceL?t===Te.b_stat:e===f._var||e===f._const||e===f.name?false:!this.exprAllowed};Ts.inGeneratorContext=function(){for(var e=this.context.length-1;e>=1;e--){var t=this.context[e];if(t.token==="function")return t.generator}return false};Ts.updateContext=function(e){var t,s=this.type;s.keyword&&e===f.dot?this.exprAllowed=false:(t=s.updateContext)?t.call(this,e):this.exprAllowed=s.beforeExpr};Ts.overrideContext=function(e){this.curContext()!==e&&(this.context[this.context.length-1]=e)};f.parenR.updateContext=f.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=true;return}var e=this.context.pop();e===Te.b_stat&&this.curContext().token==="function"&&(e=this.context.pop()),this.exprAllowed=!e.isExpr};f.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?Te.b_stat:Te.b_expr),this.exprAllowed=true};f.dollarBraceL.updateContext=function(){this.context.push(Te.b_tmpl),this.exprAllowed=true};f.parenL.updateContext=function(e){var t=e===f._if||e===f._for||e===f._with||e===f._while;this.context.push(t?Te.p_stat:Te.p_expr),this.exprAllowed=true};f.incDec.updateContext=function(){};f._function.updateContext=f._class.updateContext=function(e){e.beforeExpr&&e!==f._else&&!(e===f.semi&&this.curContext()!==Te.p_stat)&&!(e===f._return&&Je.test(this.input.slice(this.lastTokEnd,this.start)))&&!((e===f.colon||e===f.braceL)&&this.curContext()===Te.b_stat)?this.context.push(Te.f_expr):this.context.push(Te.f_stat),this.exprAllowed=false};f.colon.updateContext=function(){this.curContext().token==="function"&&this.context.pop(),this.exprAllowed=true};f.backQuote.updateContext=function(){this.curContext()===Te.q_tmpl?this.context.pop():this.context.push(Te.q_tmpl),this.exprAllowed=false};f.star.updateContext=function(e){if(e===f._function){var t=this.context.length-1;this.context[t]===Te.f_expr?this.context[t]=Te.f_expr_gen:this.context[t]=Te.f_gen}this.exprAllowed=true};f.name.updateContext=function(e){var t=false;this.options.ecmaVersion>=6&&e!==f.dot&&(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())&&(t=true),this.exprAllowed=t};var he=Ne.prototype;he.checkPropClash=function(e,t,s){if(!(this.options.ecmaVersion>=9&&e.type==="SpreadElement")&&!(this.options.ecmaVersion>=6&&(e.computed||e.method||e.shorthand))){var i=e.key,n;switch(i.type){case"Identifier":n=i.name;break;case"Literal":n=String(i.value);break;default:return}var a=e.kind;if(this.options.ecmaVersion>=6){n==="__proto__"&&a==="init"&&(t.proto&&(s?s.doubleProto<0&&(s.doubleProto=i.start):this.raiseRecoverable(i.start,"Redefinition of __proto__ property")),t.proto=true);return}n="$"+n;var o=t[n];if(o){var u;a==="init"?u=this.strict&&o.init||o.get||o.set:u=o.init||o[a],u&&this.raiseRecoverable(i.start,"Redefinition of property")}else o=t[n]={init:false,get:false,set:false};o[a]=true}};he.parseExpression=function(e,t){var s=this.start,i=this.startLoc,n=this.parseMaybeAssign(e,t);if(this.type===f.comma){var a=this.startNodeAt(s,i);for(a.expressions=[n];this.eat(f.comma);)a.expressions.push(this.parseMaybeAssign(e,t));return this.finishNode(a,"SequenceExpression")}return n};he.parseMaybeAssign=function(e,t,s){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(e);this.exprAllowed=false}var i=false,n=-1,a=-1,o=-1;t?(n=t.parenthesizedAssign,a=t.trailingComma,o=t.doubleProto,t.parenthesizedAssign=t.trailingComma=-1):(t=new Gi,i=true);var u=this.start,l=this.startLoc;(this.type===f.parenL||this.type===f.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=e==="await");var h=this.parseMaybeConditional(e,t);if(s&&(h=s.call(this,h,u,l)),this.type.isAssign){var d=this.startNodeAt(u,l);return d.operator=this.value,this.type===f.eq&&(h=this.toAssignable(h,false,t)),i||(t.parenthesizedAssign=t.trailingComma=t.doubleProto=-1),t.shorthandAssign>=h.start&&(t.shorthandAssign=-1),this.type===f.eq?this.checkLValPattern(h):this.checkLValSimple(h),d.left=h,this.next(),d.right=this.parseMaybeAssign(e),o>-1&&(t.doubleProto=o),this.finishNode(d,"AssignmentExpression")}else i&&this.checkExpressionErrors(t,true);return n>-1&&(t.parenthesizedAssign=n),a>-1&&(t.trailingComma=a),h};he.parseMaybeConditional=function(e,t){var s=this.start,i=this.startLoc,n=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))return n;if(this.eat(f.question)){var a=this.startNodeAt(s,i);return a.test=n,a.consequent=this.parseMaybeAssign(),this.expect(f.colon),a.alternate=this.parseMaybeAssign(e),this.finishNode(a,"ConditionalExpression")}return n};he.parseExprOps=function(e,t){var s=this.start,i=this.startLoc,n=this.parseMaybeUnary(t,false,false,e);return this.checkExpressionErrors(t)||n.start===s&&n.type==="ArrowFunctionExpression"?n:this.parseExprOp(n,s,i,-1,e)};he.parseExprOp=function(e,t,s,i,n){var a=this.type.binop;if(a!=null&&(!n||this.type!==f._in)&&a>i){var o=this.type===f.logicalOR||this.type===f.logicalAND,u=this.type===f.coalesce;u&&(a=f.logicalAND.binop);var l=this.value;this.next();var h=this.start,d=this.startLoc,m=this.parseExprOp(this.parseMaybeUnary(null,false,false,n),h,d,a,n),_=this.buildBinary(t,s,e,m,l,o||u);return(o&&this.type===f.coalesce||u&&(this.type===f.logicalOR||this.type===f.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(_,t,s,i,n)}return e};he.buildBinary=function(e,t,s,i,n,a){i.type==="PrivateIdentifier"&&this.raise(i.start,"Private identifier can only be left side of binary expression");var o=this.startNodeAt(e,t);return o.left=s,o.operator=n,o.right=i,this.finishNode(o,a?"LogicalExpression":"BinaryExpression")};he.parseMaybeUnary=function(e,t,s,i){var n=this.start,a=this.startLoc,o;if(this.isContextual("await")&&this.canAwait)o=this.parseAwait(i),t=true;else if(this.type.prefix){var u=this.startNode(),l=this.type===f.incDec;u.operator=this.value,u.prefix=true,this.next(),u.argument=this.parseMaybeUnary(null,true,l,i),this.checkExpressionErrors(e,true),l?this.checkLValSimple(u.argument):this.strict&&u.operator==="delete"&&yc(u.argument)?this.raiseRecoverable(u.start,"Deleting local variable in strict mode"):u.operator==="delete"&&En(u.argument)?this.raiseRecoverable(u.start,"Private fields can not be deleted"):t=true,o=this.finishNode(u,l?"UpdateExpression":"UnaryExpression")}else if(!t&&this.type===f.privateId)(i||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),o=this.parsePrivateIdent(),this.type!==f._in&&this.unexpected();else{if(o=this.parseExprSubscripts(e,i),this.checkExpressionErrors(e))return o;for(;this.type.postfix&&!this.canInsertSemicolon();){var h=this.startNodeAt(n,a);h.operator=this.value,h.prefix=false,h.argument=o,this.checkLValSimple(o),this.next(),o=this.finishNode(h,"UpdateExpression")}}if(!s&&this.eat(f.starstar))if(t)this.unexpected(this.lastTokStart);else return this.buildBinary(n,a,o,this.parseMaybeUnary(null,false,false,i),"**",false);else return o};function yc(e){return e.type==="Identifier"||e.type==="ParenthesizedExpression"&&yc(e.expression)}function En(e){return e.type==="MemberExpression"&&e.property.type==="PrivateIdentifier"||e.type==="ChainExpression"&&En(e.expression)||e.type==="ParenthesizedExpression"&&En(e.expression)}he.parseExprSubscripts=function(e,t){var s=this.start,i=this.startLoc,n=this.parseExprAtom(e,t);if(n.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return n;var a=this.parseSubscripts(n,s,i,false,t);return e&&a.type==="MemberExpression"&&(e.parenthesizedAssign>=a.start&&(e.parenthesizedAssign=-1),e.parenthesizedBind>=a.start&&(e.parenthesizedBind=-1),e.trailingComma>=a.start&&(e.trailingComma=-1)),a};he.parseSubscripts=function(e,t,s,i,n){for(var a=this.options.ecmaVersion>=8&&e.type==="Identifier"&&e.name==="async"&&this.lastTokEnd===e.end&&!this.canInsertSemicolon()&&e.end-e.start===5&&this.potentialArrowAt===e.start,o=false;;){var u=this.parseSubscript(e,t,s,i,a,o,n);if(u.optional&&(o=true),u===e||u.type==="ArrowFunctionExpression"){if(o){var l=this.startNodeAt(t,s);l.expression=u,u=this.finishNode(l,"ChainExpression")}return u}e=u}};he.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(f.arrow)};he.parseSubscriptAsyncArrow=function(e,t,s,i){return this.parseArrowExpression(this.startNodeAt(e,t),s,true,i)};he.parseSubscript=function(e,t,s,i,n,a,o){var u=this.options.ecmaVersion>=11,l=u&&this.eat(f.questionDot);i&&l&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var h=this.eat(f.bracketL);if(h||l&&this.type!==f.parenL&&this.type!==f.backQuote||this.eat(f.dot)){var d=this.startNodeAt(t,s);d.object=e,h?(d.property=this.parseExpression(),this.expect(f.bracketR)):this.type===f.privateId&&e.type!=="Super"?d.property=this.parsePrivateIdent():d.property=this.parseIdent(this.options.allowReserved!=="never"),d.computed=!!h,u&&(d.optional=l),e=this.finishNode(d,"MemberExpression")}else if(!i&&this.eat(f.parenL)){var m=new Gi,_=this.yieldPos,k=this.awaitPos,T=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var P=this.parseExprList(f.parenR,this.options.ecmaVersion>=8,false,m);if(n&&!l&&this.shouldParseAsyncArrow())return this.checkPatternErrors(m,false),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=_,this.awaitPos=k,this.awaitIdentPos=T,this.parseSubscriptAsyncArrow(t,s,P,o);this.checkExpressionErrors(m,true),this.yieldPos=_||this.yieldPos,this.awaitPos=k||this.awaitPos,this.awaitIdentPos=T||this.awaitIdentPos;var F=this.startNodeAt(t,s);F.callee=e,F.arguments=P,u&&(F.optional=l),e=this.finishNode(F,"CallExpression")}else if(this.type===f.backQuote){(l||a)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var B=this.startNodeAt(t,s);B.tag=e,B.quasi=this.parseTemplate({isTagged:true}),e=this.finishNode(B,"TaggedTemplateExpression")}return e};he.parseExprAtom=function(e,t,s){this.type===f.slash&&this.readRegexp();var i,n=this.potentialArrowAt===this.start;switch(this.type){case f._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),i=this.startNode(),this.next(),this.type===f.parenL&&!this.allowDirectSuper&&this.raise(i.start,"super() call outside constructor of a subclass"),this.type!==f.dot&&this.type!==f.bracketL&&this.type!==f.parenL&&this.unexpected(),this.finishNode(i,"Super");case f._this:return i=this.startNode(),this.next(),this.finishNode(i,"ThisExpression");case f.name:var a=this.start,o=this.startLoc,u=this.containsEsc,l=this.parseIdent(false);if(this.options.ecmaVersion>=8&&!u&&l.name==="async"&&!this.canInsertSemicolon()&&this.eat(f._function))return this.overrideContext(Te.f_expr),this.parseFunction(this.startNodeAt(a,o),0,false,true,t);if(n&&!this.canInsertSemicolon()){if(this.eat(f.arrow))return this.parseArrowExpression(this.startNodeAt(a,o),[l],false,t);if(this.options.ecmaVersion>=8&&l.name==="async"&&this.type===f.name&&!u&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc))return l=this.parseIdent(false),(this.canInsertSemicolon()||!this.eat(f.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(a,o),[l],true,t)}return l;case f.regexp:var h=this.value;return i=this.parseLiteral(h.value),i.regex={pattern:h.pattern,flags:h.flags},i;case f.num:case f.string:return this.parseLiteral(this.value);case f._null:case f._true:case f._false:return i=this.startNode(),i.value=this.type===f._null?null:this.type===f._true,i.raw=this.type.keyword,this.next(),this.finishNode(i,"Literal");case f.parenL:var d=this.start,m=this.parseParenAndDistinguishExpression(n,t);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(m)&&(e.parenthesizedAssign=d),e.parenthesizedBind<0&&(e.parenthesizedBind=d)),m;case f.bracketL:return i=this.startNode(),this.next(),i.elements=this.parseExprList(f.bracketR,true,true,e),this.finishNode(i,"ArrayExpression");case f.braceL:return this.overrideContext(Te.b_expr),this.parseObj(false,e);case f._function:return i=this.startNode(),this.next(),this.parseFunction(i,0);case f._class:return this.parseClass(this.startNode(),false);case f._new:return this.parseNew();case f.backQuote:return this.parseTemplate();case f._import:return this.options.ecmaVersion>=11?this.parseExprImport(s):this.unexpected();default:return this.parseExprAtomDefault()}};he.parseExprAtomDefault=function(){this.unexpected()};he.parseExprImport=function(e){var t=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===f.parenL&&!e)return this.parseDynamicImport(t);if(this.type===f.dot){var s=this.startNodeAt(t.start,t.loc&&t.loc.start);return s.name="import",t.meta=this.finishNode(s,"Identifier"),this.parseImportMeta(t)}else this.unexpected()};he.parseDynamicImport=function(e){if(this.next(),e.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(f.parenR)?e.options=null:(this.expect(f.comma),this.afterTrailingComma(f.parenR)?e.options=null:(e.options=this.parseMaybeAssign(),this.eat(f.parenR)||(this.expect(f.comma),this.afterTrailingComma(f.parenR)||this.unexpected())));else if(!this.eat(f.parenR)){var t=this.start;this.eat(f.comma)&&this.eat(f.parenR)?this.raiseRecoverable(t,"Trailing comma is not allowed in import()"):this.unexpected(t)}return this.finishNode(e,"ImportExpression")};he.parseImportMeta=function(e){this.next();var t=this.containsEsc;return e.property=this.parseIdent(true),e.property.name!=="meta"&&this.raiseRecoverable(e.property.start,"The only valid meta property for import is 'import.meta'"),t&&this.raiseRecoverable(e.start,"'import.meta' must not contain escaped characters"),this.options.sourceType!=="module"&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(e.start,"Cannot use 'import.meta' outside a module"),this.finishNode(e,"MetaProperty")};he.parseLiteral=function(e){var t=this.startNode();return t.value=e,t.raw=this.input.slice(this.start,this.end),t.raw.charCodeAt(t.raw.length-1)===110&&(t.bigint=t.value!=null?t.value.toString():t.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(t,"Literal")};he.parseParenExpression=function(){this.expect(f.parenL);var e=this.parseExpression();return this.expect(f.parenR),e};he.shouldParseArrow=function(e){return!this.canInsertSemicolon()};he.parseParenAndDistinguishExpression=function(e,t){var s=this.start,i=this.startLoc,n,a=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var o=this.start,u=this.startLoc,l=[],h=true,d=false,m=new Gi,_=this.yieldPos,k=this.awaitPos,T;for(this.yieldPos=0,this.awaitPos=0;this.type!==f.parenR;)if(h?h=false:this.expect(f.comma),a&&this.afterTrailingComma(f.parenR,true)){d=true;break}else if(this.type===f.ellipsis){T=this.start,l.push(this.parseParenItem(this.parseRestBinding())),this.type===f.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else l.push(this.parseMaybeAssign(false,m,this.parseParenItem));var P=this.lastTokEnd,F=this.lastTokEndLoc;if(this.expect(f.parenR),e&&this.shouldParseArrow(l)&&this.eat(f.arrow))return this.checkPatternErrors(m,false),this.checkYieldAwaitInDefaultParams(),this.yieldPos=_,this.awaitPos=k,this.parseParenArrowList(s,i,l,t);(!l.length||d)&&this.unexpected(this.lastTokStart),T&&this.unexpected(T),this.checkExpressionErrors(m,true),this.yieldPos=_||this.yieldPos,this.awaitPos=k||this.awaitPos,l.length>1?(n=this.startNodeAt(o,u),n.expressions=l,this.finishNodeAt(n,"SequenceExpression",P,F)):n=l[0]}else n=this.parseParenExpression();if(this.options.preserveParens){var B=this.startNodeAt(s,i);return B.expression=n,this.finishNode(B,"ParenthesizedExpression")}else return n};he.parseParenItem=function(e){return e};he.parseParenArrowList=function(e,t,s,i){return this.parseArrowExpression(this.startNodeAt(e,t),s,false,i)};var S1=[];he.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword new");var e=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===f.dot){var t=this.startNodeAt(e.start,e.loc&&e.loc.start);t.name="new",e.meta=this.finishNode(t,"Identifier"),this.next();var s=this.containsEsc;return e.property=this.parseIdent(true),e.property.name!=="target"&&this.raiseRecoverable(e.property.start,"The only valid meta property for new is 'new.target'"),s&&this.raiseRecoverable(e.start,"'new.target' must not contain escaped characters"),this.allowNewDotTarget||this.raiseRecoverable(e.start,"'new.target' can only be used in functions and class static block"),this.finishNode(e,"MetaProperty")}var i=this.start,n=this.startLoc;return e.callee=this.parseSubscripts(this.parseExprAtom(null,false,true),i,n,true,false),this.eat(f.parenL)?e.arguments=this.parseExprList(f.parenR,this.options.ecmaVersion>=8,false):e.arguments=S1,this.finishNode(e,"NewExpression")};he.parseTemplateElement=function(e){var t=e.isTagged,s=this.startNode();return this.type===f.invalidTemplate?(t||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),s.value={raw:this.value.replace(/\r\n?/g,`
4
- `),cooked:null}):s.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,`
5
- `),cooked:this.value},this.next(),s.tail=this.type===f.backQuote,this.finishNode(s,"TemplateElement")};he.parseTemplate=function(e){e===void 0&&(e={});var t=e.isTagged;t===void 0&&(t=false);var s=this.startNode();this.next(),s.expressions=[];var i=this.parseTemplateElement({isTagged:t});for(s.quasis=[i];!i.tail;)this.type===f.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(f.dollarBraceL),s.expressions.push(this.parseExpression()),this.expect(f.braceR),s.quasis.push(i=this.parseTemplateElement({isTagged:t}));return this.next(),this.finishNode(s,"TemplateLiteral")};he.isAsyncProp=function(e){return!e.computed&&e.key.type==="Identifier"&&e.key.name==="async"&&(this.type===f.name||this.type===f.num||this.type===f.string||this.type===f.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===f.star)&&!Je.test(this.input.slice(this.lastTokEnd,this.start))};he.parseObj=function(e,t){var s=this.startNode(),i=true,n={};for(s.properties=[],this.next();!this.eat(f.braceR);){if(i)i=false;else if(this.expect(f.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(f.braceR))break;var a=this.parseProperty(e,t);e||this.checkPropClash(a,n,t),s.properties.push(a)}return this.finishNode(s,e?"ObjectPattern":"ObjectExpression")};he.parseProperty=function(e,t){var s=this.startNode(),i,n,a,o;if(this.options.ecmaVersion>=9&&this.eat(f.ellipsis))return e?(s.argument=this.parseIdent(false),this.type===f.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.finishNode(s,"RestElement")):(s.argument=this.parseMaybeAssign(false,t),this.type===f.comma&&t&&t.trailingComma<0&&(t.trailingComma=this.start),this.finishNode(s,"SpreadElement"));this.options.ecmaVersion>=6&&(s.method=false,s.shorthand=false,(e||t)&&(a=this.start,o=this.startLoc),e||(i=this.eat(f.star)));var u=this.containsEsc;return this.parsePropertyName(s),!e&&!u&&this.options.ecmaVersion>=8&&!i&&this.isAsyncProp(s)?(n=true,i=this.options.ecmaVersion>=9&&this.eat(f.star),this.parsePropertyName(s)):n=false,this.parsePropertyValue(s,e,i,n,a,o,t,u),this.finishNode(s,"Property")};he.parseGetterSetter=function(e){var t=e.key.name;this.parsePropertyName(e),e.value=this.parseMethod(false),e.kind=t;var s=e.kind==="get"?0:1;if(e.value.params.length!==s){var i=e.value.start;e.kind==="get"?this.raiseRecoverable(i,"getter should have no params"):this.raiseRecoverable(i,"setter should have exactly one param")}else e.kind==="set"&&e.value.params[0].type==="RestElement"&&this.raiseRecoverable(e.value.params[0].start,"Setter cannot use rest params")};he.parsePropertyValue=function(e,t,s,i,n,a,o,u){(s||i)&&this.type===f.colon&&this.unexpected(),this.eat(f.colon)?(e.value=t?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(false,o),e.kind="init"):this.options.ecmaVersion>=6&&this.type===f.parenL?(t&&this.unexpected(),e.method=true,e.value=this.parseMethod(s,i),e.kind="init"):!t&&!u&&this.options.ecmaVersion>=5&&!e.computed&&e.key.type==="Identifier"&&(e.key.name==="get"||e.key.name==="set")&&this.type!==f.comma&&this.type!==f.braceR&&this.type!==f.eq?((s||i)&&this.unexpected(),this.parseGetterSetter(e)):this.options.ecmaVersion>=6&&!e.computed&&e.key.type==="Identifier"?((s||i)&&this.unexpected(),this.checkUnreserved(e.key),e.key.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=n),t?e.value=this.parseMaybeDefault(n,a,this.copyNode(e.key)):this.type===f.eq&&o?(o.shorthandAssign<0&&(o.shorthandAssign=this.start),e.value=this.parseMaybeDefault(n,a,this.copyNode(e.key))):e.value=this.copyNode(e.key),e.kind="init",e.shorthand=true):this.unexpected()};he.parsePropertyName=function(e){if(this.options.ecmaVersion>=6){if(this.eat(f.bracketL))return e.computed=true,e.key=this.parseMaybeAssign(),this.expect(f.bracketR),e.key;e.computed=false}return e.key=this.type===f.num||this.type===f.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")};he.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=e.expression=false),this.options.ecmaVersion>=8&&(e.async=false)};he.parseMethod=function(e,t,s){var i=this.startNode(),n=this.yieldPos,a=this.awaitPos,o=this.awaitIdentPos;return this.initFunction(i),this.options.ecmaVersion>=6&&(i.generator=e),this.options.ecmaVersion>=8&&(i.async=!!t),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Zn(t,i.generator)|Hi|(s?pc:0)),this.expect(f.parenL),i.params=this.parseBindingList(f.parenR,false,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(i,false,true,false),this.yieldPos=n,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(i,"FunctionExpression")};he.parseArrowExpression=function(e,t,s,i){var n=this.yieldPos,a=this.awaitPos,o=this.awaitIdentPos;return this.enterScope(Zn(s,false)|Kn),this.initFunction(e),this.options.ecmaVersion>=8&&(e.async=!!s),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,e.params=this.toAssignableList(t,true),this.parseFunctionBody(e,true,false,i),this.yieldPos=n,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(e,"ArrowFunctionExpression")};he.parseFunctionBody=function(e,t,s,i){var n=t&&this.type!==f.braceL,a=this.strict,o=false;if(n)e.body=this.parseMaybeAssign(i),e.expression=true,this.checkParams(e,false);else{var u=this.options.ecmaVersion>=7&&!this.isSimpleParamList(e.params);(!a||u)&&(o=this.strictDirective(this.end),o&&u&&this.raiseRecoverable(e.start,"Illegal 'use strict' directive in function with non-simple parameter list"));var l=this.labels;this.labels=[],o&&(this.strict=true),this.checkParams(e,!a&&!o&&!t&&!s&&this.isSimpleParamList(e.params)),this.strict&&e.id&&this.checkLValSimple(e.id,gc),e.body=this.parseBlock(false,void 0,o&&!a),e.expression=false,this.adaptDirectivePrologue(e.body.body),this.labels=l}this.exitScope()};he.isSimpleParamList=function(e){for(var t=0,s=e;t<s.length;t+=1){var i=s[t];if(i.type!=="Identifier")return false}return true};he.checkParams=function(e,t){for(var s=Object.create(null),i=0,n=e.params;i<n.length;i+=1){var a=n[i];this.checkLValInnerPattern(a,Qn,t?null:s)}};he.parseExprList=function(e,t,s,i){for(var n=[],a=true;!this.eat(e);){if(a)a=false;else if(this.expect(f.comma),t&&this.afterTrailingComma(e))break;var o=void 0;s&&this.type===f.comma?o=null:this.type===f.ellipsis?(o=this.parseSpread(i),i&&this.type===f.comma&&i.trailingComma<0&&(i.trailingComma=this.start)):o=this.parseMaybeAssign(false,i),n.push(o)}return n};he.checkUnreserved=function(e){var t=e.start,s=e.end,i=e.name;if(this.inGenerator&&i==="yield"&&this.raiseRecoverable(t,"Cannot use 'yield' as identifier inside a generator"),this.inAsync&&i==="await"&&this.raiseRecoverable(t,"Cannot use 'await' as identifier inside an async function"),!(this.currentThisScope().flags&Wi)&&i==="arguments"&&this.raiseRecoverable(t,"Cannot use 'arguments' in class field initializer"),this.inClassStaticBlock&&(i==="arguments"||i==="await")&&this.raise(t,"Cannot use "+i+" in class static initialization block"),this.keywords.test(i)&&this.raise(t,"Unexpected keyword '"+i+"'"),!(this.options.ecmaVersion<6&&this.input.slice(t,s).indexOf("\\")!==-1)){var n=this.strict?this.reservedWordsStrict:this.reservedWords;n.test(i)&&(!this.inAsync&&i==="await"&&this.raiseRecoverable(t,"Cannot use keyword 'await' outside an async function"),this.raiseRecoverable(t,"The keyword '"+i+"' is reserved"))}};he.parseIdent=function(e){var t=this.parseIdentNode();return this.next(!!e),this.finishNode(t,"Identifier"),e||(this.checkUnreserved(t),t.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=t.start)),t};he.parseIdentNode=function(){var e=this.startNode();return this.type===f.name?e.name=this.value:this.type.keyword?(e.name=this.type.keyword,(e.name==="class"||e.name==="function")&&(this.lastTokEnd!==this.lastTokStart+1||this.input.charCodeAt(this.lastTokStart)!==46)&&this.context.pop(),this.type=f.name):this.unexpected(),e};he.parsePrivateIdent=function(){var e=this.startNode();return this.type===f.privateId?e.name=this.value:this.unexpected(),this.next(),this.finishNode(e,"PrivateIdentifier"),this.options.checkPrivateFields&&(this.privateNameStack.length===0?this.raise(e.start,"Private field '#"+e.name+"' must be declared in an enclosing class"):this.privateNameStack[this.privateNameStack.length-1].used.push(e)),e};he.parseYield=function(e){this.yieldPos||(this.yieldPos=this.start);var t=this.startNode();return this.next(),this.type===f.semi||this.canInsertSemicolon()||this.type!==f.star&&!this.type.startsExpr?(t.delegate=false,t.argument=null):(t.delegate=this.eat(f.star),t.argument=this.parseMaybeAssign(e)),this.finishNode(t,"YieldExpression")};he.parseAwait=function(e){this.awaitPos||(this.awaitPos=this.start);var t=this.startNode();return this.next(),t.argument=this.parseMaybeUnary(null,true,false,e),this.finishNode(t,"AwaitExpression")};var ki=Ne.prototype;ki.raise=function(e,t){var s=lc(this.input,e);t+=" ("+s.line+":"+s.column+")",this.sourceFile&&(t+=" in "+this.sourceFile);var i=new SyntaxError(t);throw i.pos=e,i.loc=s,i.raisedAt=this.pos,i};ki.raiseRecoverable=ki.raise;ki.curPosition=function(){if(this.options.locations)return new qs(this.curLine,this.pos-this.lineStart)};var Jt=Ne.prototype,E1=function(t){this.flags=t,this.var=[],this.lexical=[],this.functions=[]};Jt.enterScope=function(e){this.scopeStack.push(new E1(e))};Jt.exitScope=function(){this.scopeStack.pop()};Jt.treatFunctionsAsVarInScope=function(e){return e.flags&Es||!this.inModule&&e.flags&Hs};Jt.declareName=function(e,t,s){var i=false;if(t===Vt){var n=this.currentScope();i=n.lexical.indexOf(e)>-1||n.functions.indexOf(e)>-1||n.var.indexOf(e)>-1,n.lexical.push(e),this.inModule&&n.flags&Hs&&delete this.undefinedExports[e]}else if(t===mc){var a=this.currentScope();a.lexical.push(e)}else if(t===dc){var o=this.currentScope();this.treatFunctionsAsVar?i=o.lexical.indexOf(e)>-1:i=o.lexical.indexOf(e)>-1||o.var.indexOf(e)>-1,o.functions.push(e)}else for(var u=this.scopeStack.length-1;u>=0;--u){var l=this.scopeStack[u];if(l.lexical.indexOf(e)>-1&&!(l.flags&fc&&l.lexical[0]===e)||!this.treatFunctionsAsVarInScope(l)&&l.functions.indexOf(e)>-1){i=true;break}if(l.var.push(e),this.inModule&&l.flags&Hs&&delete this.undefinedExports[e],l.flags&Wi)break}i&&this.raiseRecoverable(s,"Identifier '"+e+"' has already been declared")};Jt.checkLocalExport=function(e){this.scopeStack[0].lexical.indexOf(e.name)===-1&&this.scopeStack[0].var.indexOf(e.name)===-1&&(this.undefinedExports[e.name]=e)};Jt.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]};Jt.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&(Wi|ti|hs))return t}};Jt.currentThisScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&(Wi|ti|hs)&&!(t.flags&Kn))return t}};var Xi=function(t,s,i){this.type="",this.start=s,this.end=0,t.options.locations&&(this.loc=new qi(t,i)),t.options.directSourceFile&&(this.sourceFile=t.options.directSourceFile),t.options.ranges&&(this.range=[s,0])},si=Ne.prototype;si.startNode=function(){return new Xi(this,this.start,this.startLoc)};si.startNodeAt=function(e,t){return new Xi(this,e,t)};function _c(e,t,s,i){return e.type=t,e.end=s,this.options.locations&&(e.loc.end=i),this.options.ranges&&(e.range[1]=s),e}si.finishNode=function(e,t){return _c.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)};si.finishNodeAt=function(e,t,s,i){return _c.call(this,e,t,s,i)};si.copyNode=function(e){var t=new Xi(this,e.start,this.startLoc);for(var s in e)t[s]=e[s];return t};var T1="Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sunu Sunuwar Todhri Todr Tulu_Tigalari Tutg Unknown Zzzz",xc="ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS",vc=xc+" Extended_Pictographic",kc=vc,wc=kc+" EBase EComp EMod EPres ExtPict",Sc=wc,A1=Sc,I1={9:xc,10:vc,11:kc,12:wc,13:Sc,14:A1},C1="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",R1={9:"",10:"",11:"",12:"",13:"",14:C1},Ya="Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu",Ec="Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb",Tc=Ec+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",Ac=Tc+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",Ic=Ac+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",Cc=Ic+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",P1=Cc+" "+T1,L1={9:Ec,10:Tc,11:Ac,12:Ic,13:Cc,14:P1},Rc={};function D1(e){var t=Rc[e]={binary:Ht(I1[e]+" "+Ya),binaryOfStrings:Ht(R1[e]),nonBinary:{General_Category:Ht(Ya),Script:Ht(L1[e])}};t.nonBinary.Script_Extensions=t.nonBinary.Script,t.nonBinary.gc=t.nonBinary.General_Category,t.nonBinary.sc=t.nonBinary.Script,t.nonBinary.scx=t.nonBinary.Script_Extensions}for(var rn=0,za=[9,10,11,12,13,14];rn<za.length;rn+=1){var N1=za[rn];D1(N1)}var Z=Ne.prototype,wi=function(t,s){this.parent=t,this.base=s||this};wi.prototype.separatedFrom=function(t){for(var s=this;s;s=s.parent)for(var i=t;i;i=i.parent)if(s.base===i.base&&s!==i)return true;return false};wi.prototype.sibling=function(){return new wi(this.parent,this.base)};var Rt=function(t){this.parser=t,this.validFlags="gim"+(t.options.ecmaVersion>=6?"uy":"")+(t.options.ecmaVersion>=9?"s":"")+(t.options.ecmaVersion>=13?"d":"")+(t.options.ecmaVersion>=15?"v":""),this.unicodeProperties=Rc[t.options.ecmaVersion>=14?14:t.options.ecmaVersion],this.source="",this.flags="",this.start=0,this.switchU=false,this.switchV=false,this.switchN=false,this.pos=0,this.lastIntValue=0,this.lastStringValue="",this.lastAssertionIsQuantifiable=false,this.numCapturingParens=0,this.maxBackReference=0,this.groupNames=Object.create(null),this.backReferenceNames=[],this.branchID=null};Rt.prototype.reset=function(t,s,i){var n=i.indexOf("v")!==-1,a=i.indexOf("u")!==-1;this.start=t|0,this.source=s+"",this.flags=i,n&&this.parser.options.ecmaVersion>=15?(this.switchU=true,this.switchV=true,this.switchN=true):(this.switchU=a&&this.parser.options.ecmaVersion>=6,this.switchV=false,this.switchN=a&&this.parser.options.ecmaVersion>=9)};Rt.prototype.raise=function(t){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+t)};Rt.prototype.at=function(t,s){s===void 0&&(s=false);var i=this.source,n=i.length;if(t>=n)return-1;var a=i.charCodeAt(t);if(!(s||this.switchU)||a<=55295||a>=57344||t+1>=n)return a;var o=i.charCodeAt(t+1);return o>=56320&&o<=57343?(a<<10)+o-56613888:a};Rt.prototype.nextIndex=function(t,s){s===void 0&&(s=false);var i=this.source,n=i.length;if(t>=n)return n;var a=i.charCodeAt(t),o;return!(s||this.switchU)||a<=55295||a>=57344||t+1>=n||(o=i.charCodeAt(t+1))<56320||o>57343?t+1:t+2};Rt.prototype.current=function(t){return t===void 0&&(t=false),this.at(this.pos,t)};Rt.prototype.lookahead=function(t){return t===void 0&&(t=false),this.at(this.nextIndex(this.pos,t),t)};Rt.prototype.advance=function(t){t===void 0&&(t=false),this.pos=this.nextIndex(this.pos,t)};Rt.prototype.eat=function(t,s){return s===void 0&&(s=false),this.current(s)===t?(this.advance(s),true):false};Rt.prototype.eatChars=function(t,s){s===void 0&&(s=false);for(var i=this.pos,n=0,a=t;n<a.length;n+=1){var o=a[n],u=this.at(i,s);if(u===-1||u!==o)return false;i=this.nextIndex(i,s)}return this.pos=i,true};Z.validateRegExpFlags=function(e){for(var t=e.validFlags,s=e.flags,i=false,n=false,a=0;a<s.length;a++){var o=s.charAt(a);t.indexOf(o)===-1&&this.raise(e.start,"Invalid regular expression flag"),s.indexOf(o,a+1)>-1&&this.raise(e.start,"Duplicate regular expression flag"),o==="u"&&(i=true),o==="v"&&(n=true)}this.options.ecmaVersion>=15&&i&&n&&this.raise(e.start,"Invalid regular expression flag")};function F1(e){for(var t in e)return true;return false}Z.validateRegExpPattern=function(e){this.regexp_pattern(e),!e.switchN&&this.options.ecmaVersion>=9&&F1(e.groupNames)&&(e.switchN=true,this.regexp_pattern(e))};Z.regexp_pattern=function(e){e.pos=0,e.lastIntValue=0,e.lastStringValue="",e.lastAssertionIsQuantifiable=false,e.numCapturingParens=0,e.maxBackReference=0,e.groupNames=Object.create(null),e.backReferenceNames.length=0,e.branchID=null,this.regexp_disjunction(e),e.pos!==e.source.length&&(e.eat(41)&&e.raise("Unmatched ')'"),(e.eat(93)||e.eat(125))&&e.raise("Lone quantifier brackets")),e.maxBackReference>e.numCapturingParens&&e.raise("Invalid escape");for(var t=0,s=e.backReferenceNames;t<s.length;t+=1){var i=s[t];e.groupNames[i]||e.raise("Invalid named capture referenced")}};Z.regexp_disjunction=function(e){var t=this.options.ecmaVersion>=16;for(t&&(e.branchID=new wi(e.branchID,null)),this.regexp_alternative(e);e.eat(124);)t&&(e.branchID=e.branchID.sibling()),this.regexp_alternative(e);t&&(e.branchID=e.branchID.parent),this.regexp_eatQuantifier(e,true)&&e.raise("Nothing to repeat"),e.eat(123)&&e.raise("Lone quantifier brackets")};Z.regexp_alternative=function(e){for(;e.pos<e.source.length&&this.regexp_eatTerm(e););};Z.regexp_eatTerm=function(e){return this.regexp_eatAssertion(e)?(e.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(e)&&e.switchU&&e.raise("Invalid quantifier"),true):(e.switchU?this.regexp_eatAtom(e):this.regexp_eatExtendedAtom(e))?(this.regexp_eatQuantifier(e),true):false};Z.regexp_eatAssertion=function(e){var t=e.pos;if(e.lastAssertionIsQuantifiable=false,e.eat(94)||e.eat(36))return true;if(e.eat(92)){if(e.eat(66)||e.eat(98))return true;e.pos=t}if(e.eat(40)&&e.eat(63)){var s=false;if(this.options.ecmaVersion>=9&&(s=e.eat(60)),e.eat(61)||e.eat(33))return this.regexp_disjunction(e),e.eat(41)||e.raise("Unterminated group"),e.lastAssertionIsQuantifiable=!s,true}return e.pos=t,false};Z.regexp_eatQuantifier=function(e,t){return t===void 0&&(t=false),this.regexp_eatQuantifierPrefix(e,t)?(e.eat(63),true):false};Z.regexp_eatQuantifierPrefix=function(e,t){return e.eat(42)||e.eat(43)||e.eat(63)||this.regexp_eatBracedQuantifier(e,t)};Z.regexp_eatBracedQuantifier=function(e,t){var s=e.pos;if(e.eat(123)){var i=0,n=-1;if(this.regexp_eatDecimalDigits(e)&&(i=e.lastIntValue,e.eat(44)&&this.regexp_eatDecimalDigits(e)&&(n=e.lastIntValue),e.eat(125)))return n!==-1&&n<i&&!t&&e.raise("numbers out of order in {} quantifier"),true;e.switchU&&!t&&e.raise("Incomplete quantifier"),e.pos=s}return false};Z.regexp_eatAtom=function(e){return this.regexp_eatPatternCharacters(e)||e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)};Z.regexp_eatReverseSolidusAtomEscape=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatAtomEscape(e))return true;e.pos=t}return false};Z.regexp_eatUncapturingGroup=function(e){var t=e.pos;if(e.eat(40)){if(e.eat(63)){if(this.options.ecmaVersion>=16){var s=this.regexp_eatModifiers(e),i=e.eat(45);if(s||i){for(var n=0;n<s.length;n++){var a=s.charAt(n);s.indexOf(a,n+1)>-1&&e.raise("Duplicate regular expression modifiers")}if(i){var o=this.regexp_eatModifiers(e);!s&&!o&&e.current()===58&&e.raise("Invalid regular expression modifiers");for(var u=0;u<o.length;u++){var l=o.charAt(u);(o.indexOf(l,u+1)>-1||s.indexOf(l)>-1)&&e.raise("Duplicate regular expression modifiers")}}}}if(e.eat(58)){if(this.regexp_disjunction(e),e.eat(41))return true;e.raise("Unterminated group")}}e.pos=t}return false};Z.regexp_eatCapturingGroup=function(e){if(e.eat(40)){if(this.options.ecmaVersion>=9?this.regexp_groupSpecifier(e):e.current()===63&&e.raise("Invalid group"),this.regexp_disjunction(e),e.eat(41))return e.numCapturingParens+=1,true;e.raise("Unterminated group")}return false};Z.regexp_eatModifiers=function(e){for(var t="",s=0;(s=e.current())!==-1&&U1(s);)t+=Ut(s),e.advance();return t};function U1(e){return e===105||e===109||e===115}Z.regexp_eatExtendedAtom=function(e){return e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)||this.regexp_eatInvalidBracedQuantifier(e)||this.regexp_eatExtendedPatternCharacter(e)};Z.regexp_eatInvalidBracedQuantifier=function(e){return this.regexp_eatBracedQuantifier(e,true)&&e.raise("Nothing to repeat"),false};Z.regexp_eatSyntaxCharacter=function(e){var t=e.current();return Pc(t)?(e.lastIntValue=t,e.advance(),true):false};function Pc(e){return e===36||e>=40&&e<=43||e===46||e===63||e>=91&&e<=94||e>=123&&e<=125}Z.regexp_eatPatternCharacters=function(e){for(var t=e.pos,s=0;(s=e.current())!==-1&&!Pc(s);)e.advance();return e.pos!==t};Z.regexp_eatExtendedPatternCharacter=function(e){var t=e.current();return t!==-1&&t!==36&&!(t>=40&&t<=43)&&t!==46&&t!==63&&t!==91&&t!==94&&t!==124?(e.advance(),true):false};Z.regexp_groupSpecifier=function(e){if(e.eat(63)){this.regexp_eatGroupName(e)||e.raise("Invalid group");var t=this.options.ecmaVersion>=16,s=e.groupNames[e.lastStringValue];if(s)if(t)for(var i=0,n=s;i<n.length;i+=1){var a=n[i];a.separatedFrom(e.branchID)||e.raise("Duplicate capture group name")}else e.raise("Duplicate capture group name");t?(s||(e.groupNames[e.lastStringValue]=[])).push(e.branchID):e.groupNames[e.lastStringValue]=true}};Z.regexp_eatGroupName=function(e){if(e.lastStringValue="",e.eat(60)){if(this.regexp_eatRegExpIdentifierName(e)&&e.eat(62))return true;e.raise("Invalid capture group name")}return false};Z.regexp_eatRegExpIdentifierName=function(e){if(e.lastStringValue="",this.regexp_eatRegExpIdentifierStart(e)){for(e.lastStringValue+=Ut(e.lastIntValue);this.regexp_eatRegExpIdentifierPart(e);)e.lastStringValue+=Ut(e.lastIntValue);return true}return false};Z.regexp_eatRegExpIdentifierStart=function(e){var t=e.pos,s=this.options.ecmaVersion>=11,i=e.current(s);return e.advance(s),i===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,s)&&(i=e.lastIntValue),M1(i)?(e.lastIntValue=i,true):(e.pos=t,false)};function M1(e){return Tt(e,true)||e===36||e===95}Z.regexp_eatRegExpIdentifierPart=function(e){var t=e.pos,s=this.options.ecmaVersion>=11,i=e.current(s);return e.advance(s),i===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,s)&&(i=e.lastIntValue),O1(i)?(e.lastIntValue=i,true):(e.pos=t,false)};function O1(e){return Zt(e,true)||e===36||e===95||e===8204||e===8205}Z.regexp_eatAtomEscape=function(e){return this.regexp_eatBackReference(e)||this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)||e.switchN&&this.regexp_eatKGroupName(e)?true:(e.switchU&&(e.current()===99&&e.raise("Invalid unicode escape"),e.raise("Invalid escape")),false)};Z.regexp_eatBackReference=function(e){var t=e.pos;if(this.regexp_eatDecimalEscape(e)){var s=e.lastIntValue;if(e.switchU)return s>e.maxBackReference&&(e.maxBackReference=s),true;if(s<=e.numCapturingParens)return true;e.pos=t}return false};Z.regexp_eatKGroupName=function(e){if(e.eat(107)){if(this.regexp_eatGroupName(e))return e.backReferenceNames.push(e.lastStringValue),true;e.raise("Invalid named reference")}return false};Z.regexp_eatCharacterEscape=function(e){return this.regexp_eatControlEscape(e)||this.regexp_eatCControlLetter(e)||this.regexp_eatZero(e)||this.regexp_eatHexEscapeSequence(e)||this.regexp_eatRegExpUnicodeEscapeSequence(e,false)||!e.switchU&&this.regexp_eatLegacyOctalEscapeSequence(e)||this.regexp_eatIdentityEscape(e)};Z.regexp_eatCControlLetter=function(e){var t=e.pos;if(e.eat(99)){if(this.regexp_eatControlLetter(e))return true;e.pos=t}return false};Z.regexp_eatZero=function(e){return e.current()===48&&!Yi(e.lookahead())?(e.lastIntValue=0,e.advance(),true):false};Z.regexp_eatControlEscape=function(e){var t=e.current();return t===116?(e.lastIntValue=9,e.advance(),true):t===110?(e.lastIntValue=10,e.advance(),true):t===118?(e.lastIntValue=11,e.advance(),true):t===102?(e.lastIntValue=12,e.advance(),true):t===114?(e.lastIntValue=13,e.advance(),true):false};Z.regexp_eatControlLetter=function(e){var t=e.current();return Lc(t)?(e.lastIntValue=t%32,e.advance(),true):false};function Lc(e){return e>=65&&e<=90||e>=97&&e<=122}Z.regexp_eatRegExpUnicodeEscapeSequence=function(e,t){t===void 0&&(t=false);var s=e.pos,i=t||e.switchU;if(e.eat(117)){if(this.regexp_eatFixedHexDigits(e,4)){var n=e.lastIntValue;if(i&&n>=55296&&n<=56319){var a=e.pos;if(e.eat(92)&&e.eat(117)&&this.regexp_eatFixedHexDigits(e,4)){var o=e.lastIntValue;if(o>=56320&&o<=57343)return e.lastIntValue=(n-55296)*1024+(o-56320)+65536,true}e.pos=a,e.lastIntValue=n}return true}if(i&&e.eat(123)&&this.regexp_eatHexDigits(e)&&e.eat(125)&&B1(e.lastIntValue))return true;i&&e.raise("Invalid unicode escape"),e.pos=s}return false};function B1(e){return e>=0&&e<=1114111}Z.regexp_eatIdentityEscape=function(e){if(e.switchU)return this.regexp_eatSyntaxCharacter(e)?true:e.eat(47)?(e.lastIntValue=47,true):false;var t=e.current();return t!==99&&(!e.switchN||t!==107)?(e.lastIntValue=t,e.advance(),true):false};Z.regexp_eatDecimalEscape=function(e){e.lastIntValue=0;var t=e.current();if(t>=49&&t<=57){do e.lastIntValue=10*e.lastIntValue+(t-48),e.advance();while((t=e.current())>=48&&t<=57);return true}return false};var Dc=0,Mt=1,nt=2;Z.regexp_eatCharacterClassEscape=function(e){var t=e.current();if(V1(t))return e.lastIntValue=-1,e.advance(),Mt;var s=false;if(e.switchU&&this.options.ecmaVersion>=9&&((s=t===80)||t===112)){e.lastIntValue=-1,e.advance();var i;if(e.eat(123)&&(i=this.regexp_eatUnicodePropertyValueExpression(e))&&e.eat(125))return s&&i===nt&&e.raise("Invalid property name"),i;e.raise("Invalid property name")}return Dc};function V1(e){return e===100||e===68||e===115||e===83||e===119||e===87}Z.regexp_eatUnicodePropertyValueExpression=function(e){var t=e.pos;if(this.regexp_eatUnicodePropertyName(e)&&e.eat(61)){var s=e.lastStringValue;if(this.regexp_eatUnicodePropertyValue(e)){var i=e.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(e,s,i),Mt}}if(e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)){var n=e.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(e,n)}return Dc};Z.regexp_validateUnicodePropertyNameAndValue=function(e,t,s){Ss(e.unicodeProperties.nonBinary,t)||e.raise("Invalid property name"),e.unicodeProperties.nonBinary[t].test(s)||e.raise("Invalid property value")};Z.regexp_validateUnicodePropertyNameOrValue=function(e,t){if(e.unicodeProperties.binary.test(t))return Mt;if(e.switchV&&e.unicodeProperties.binaryOfStrings.test(t))return nt;e.raise("Invalid property name")};Z.regexp_eatUnicodePropertyName=function(e){var t=0;for(e.lastStringValue="";Nc(t=e.current());)e.lastStringValue+=Ut(t),e.advance();return e.lastStringValue!==""};function Nc(e){return Lc(e)||e===95}Z.regexp_eatUnicodePropertyValue=function(e){var t=0;for(e.lastStringValue="";j1(t=e.current());)e.lastStringValue+=Ut(t),e.advance();return e.lastStringValue!==""};function j1(e){return Nc(e)||Yi(e)}Z.regexp_eatLoneUnicodePropertyNameOrValue=function(e){return this.regexp_eatUnicodePropertyValue(e)};Z.regexp_eatCharacterClass=function(e){if(e.eat(91)){var t=e.eat(94),s=this.regexp_classContents(e);return e.eat(93)||e.raise("Unterminated character class"),t&&s===nt&&e.raise("Negated character class may contain strings"),true}return false};Z.regexp_classContents=function(e){return e.current()===93?Mt:e.switchV?this.regexp_classSetExpression(e):(this.regexp_nonEmptyClassRanges(e),Mt)};Z.regexp_nonEmptyClassRanges=function(e){for(;this.regexp_eatClassAtom(e);){var t=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassAtom(e)){var s=e.lastIntValue;e.switchU&&(t===-1||s===-1)&&e.raise("Invalid character class"),t!==-1&&s!==-1&&t>s&&e.raise("Range out of order in character class")}}};Z.regexp_eatClassAtom=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatClassEscape(e))return true;if(e.switchU){var s=e.current();(s===99||Mc(s))&&e.raise("Invalid class escape"),e.raise("Invalid escape")}e.pos=t}var i=e.current();return i!==93?(e.lastIntValue=i,e.advance(),true):false};Z.regexp_eatClassEscape=function(e){var t=e.pos;if(e.eat(98))return e.lastIntValue=8,true;if(e.switchU&&e.eat(45))return e.lastIntValue=45,true;if(!e.switchU&&e.eat(99)){if(this.regexp_eatClassControlLetter(e))return true;e.pos=t}return this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)};Z.regexp_classSetExpression=function(e){var t=Mt,s;if(!this.regexp_eatClassSetRange(e))if(s=this.regexp_eatClassSetOperand(e)){s===nt&&(t=nt);for(var i=e.pos;e.eatChars([38,38]);){if(e.current()!==38&&(s=this.regexp_eatClassSetOperand(e))){s!==nt&&(t=Mt);continue}e.raise("Invalid character in character class")}if(i!==e.pos)return t;for(;e.eatChars([45,45]);)this.regexp_eatClassSetOperand(e)||e.raise("Invalid character in character class");if(i!==e.pos)return t}else e.raise("Invalid character in character class");for(;;)if(!this.regexp_eatClassSetRange(e)){if(s=this.regexp_eatClassSetOperand(e),!s)return t;s===nt&&(t=nt)}};Z.regexp_eatClassSetRange=function(e){var t=e.pos;if(this.regexp_eatClassSetCharacter(e)){var s=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassSetCharacter(e)){var i=e.lastIntValue;return s!==-1&&i!==-1&&s>i&&e.raise("Range out of order in character class"),true}e.pos=t}return false};Z.regexp_eatClassSetOperand=function(e){return this.regexp_eatClassSetCharacter(e)?Mt:this.regexp_eatClassStringDisjunction(e)||this.regexp_eatNestedClass(e)};Z.regexp_eatNestedClass=function(e){var t=e.pos;if(e.eat(91)){var s=e.eat(94),i=this.regexp_classContents(e);if(e.eat(93))return s&&i===nt&&e.raise("Negated character class may contain strings"),i;e.pos=t}if(e.eat(92)){var n=this.regexp_eatCharacterClassEscape(e);if(n)return n;e.pos=t}return null};Z.regexp_eatClassStringDisjunction=function(e){var t=e.pos;if(e.eatChars([92,113])){if(e.eat(123)){var s=this.regexp_classStringDisjunctionContents(e);if(e.eat(125))return s}else e.raise("Invalid escape");e.pos=t}return null};Z.regexp_classStringDisjunctionContents=function(e){for(var t=this.regexp_classString(e);e.eat(124);)this.regexp_classString(e)===nt&&(t=nt);return t};Z.regexp_classString=function(e){for(var t=0;this.regexp_eatClassSetCharacter(e);)t++;return t===1?Mt:nt};Z.regexp_eatClassSetCharacter=function(e){var t=e.pos;if(e.eat(92))return this.regexp_eatCharacterEscape(e)||this.regexp_eatClassSetReservedPunctuator(e)?true:e.eat(98)?(e.lastIntValue=8,true):(e.pos=t,false);var s=e.current();return s<0||s===e.lookahead()&&$1(s)||q1(s)?false:(e.advance(),e.lastIntValue=s,true)};function $1(e){return e===33||e>=35&&e<=38||e>=42&&e<=44||e===46||e>=58&&e<=64||e===94||e===96||e===126}function q1(e){return e===40||e===41||e===45||e===47||e>=91&&e<=93||e>=123&&e<=125}Z.regexp_eatClassSetReservedPunctuator=function(e){var t=e.current();return H1(t)?(e.lastIntValue=t,e.advance(),true):false};function H1(e){return e===33||e===35||e===37||e===38||e===44||e===45||e>=58&&e<=62||e===64||e===96||e===126}Z.regexp_eatClassControlLetter=function(e){var t=e.current();return Yi(t)||t===95?(e.lastIntValue=t%32,e.advance(),true):false};Z.regexp_eatHexEscapeSequence=function(e){var t=e.pos;if(e.eat(120)){if(this.regexp_eatFixedHexDigits(e,2))return true;e.switchU&&e.raise("Invalid escape"),e.pos=t}return false};Z.regexp_eatDecimalDigits=function(e){var t=e.pos,s=0;for(e.lastIntValue=0;Yi(s=e.current());)e.lastIntValue=10*e.lastIntValue+(s-48),e.advance();return e.pos!==t};function Yi(e){return e>=48&&e<=57}Z.regexp_eatHexDigits=function(e){var t=e.pos,s=0;for(e.lastIntValue=0;Fc(s=e.current());)e.lastIntValue=16*e.lastIntValue+Uc(s),e.advance();return e.pos!==t};function Fc(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function Uc(e){return e>=65&&e<=70?10+(e-65):e>=97&&e<=102?10+(e-97):e-48}Z.regexp_eatLegacyOctalEscapeSequence=function(e){if(this.regexp_eatOctalDigit(e)){var t=e.lastIntValue;if(this.regexp_eatOctalDigit(e)){var s=e.lastIntValue;t<=3&&this.regexp_eatOctalDigit(e)?e.lastIntValue=t*64+s*8+e.lastIntValue:e.lastIntValue=t*8+s}else e.lastIntValue=t;return true}return false};Z.regexp_eatOctalDigit=function(e){var t=e.current();return Mc(t)?(e.lastIntValue=t-48,e.advance(),true):(e.lastIntValue=0,false)};function Mc(e){return e>=48&&e<=55}Z.regexp_eatFixedHexDigits=function(e,t){var s=e.pos;e.lastIntValue=0;for(var i=0;i<t;++i){var n=e.current();if(!Fc(n))return e.pos=s,false;e.lastIntValue=16*e.lastIntValue+Uc(n),e.advance()}return true};var ea=function(t){this.type=t.type,this.value=t.value,this.start=t.start,this.end=t.end,t.options.locations&&(this.loc=new qi(t,t.startLoc,t.endLoc)),t.options.ranges&&(this.range=[t.start,t.end])},ge=Ne.prototype;ge.next=function(e){!e&&this.type.keyword&&this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword "+this.type.keyword),this.options.onToken&&this.options.onToken(new ea(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()};ge.getToken=function(){return this.next(),new ea(this)};typeof Symbol<"u"&&(ge[Symbol.iterator]=function(){var e=this;return{next:function(){var t=e.getToken();return{done:t.type===f.eof,value:t}}}});ge.nextToken=function(){var e=this.curContext();if((!e||!e.preserveSpace)&&this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length)return this.finishToken(f.eof);if(e.override)return e.override(this);this.readToken(this.fullCharCodeAtPos())};ge.readToken=function(e){return Tt(e,this.options.ecmaVersion>=6)||e===92?this.readWord():this.getTokenFromCode(e)};ge.fullCharCodeAtPos=function(){var e=this.input.charCodeAt(this.pos);if(e<=55295||e>=56320)return e;var t=this.input.charCodeAt(this.pos+1);return t<=56319||t>=57344?e:(e<<10)+t-56613888};ge.skipBlockComment=function(){var e=this.options.onComment&&this.curPosition(),t=this.pos,s=this.input.indexOf("*/",this.pos+=2);if(s===-1&&this.raise(this.pos-2,"Unterminated comment"),this.pos=s+2,this.options.locations)for(var i=void 0,n=t;(i=oc(this.input,n,this.pos))>-1;)++this.curLine,n=this.lineStart=i;this.options.onComment&&this.options.onComment(true,this.input.slice(t+2,s),t,this.pos,e,this.curPosition())};ge.skipLineComment=function(e){for(var t=this.pos,s=this.options.onComment&&this.curPosition(),i=this.input.charCodeAt(this.pos+=e);this.pos<this.input.length&&!ws(i);)i=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(false,this.input.slice(t+e,this.pos),t,this.pos,s,this.curPosition())};ge.skipSpace=function(){e:for(;this.pos<this.input.length;){var e=this.input.charCodeAt(this.pos);switch(e){case 32:case 160:++this.pos;break;case 13:this.input.charCodeAt(this.pos+1)===10&&++this.pos;case 10:case 8232:case 8233:++this.pos,this.options.locations&&(++this.curLine,this.lineStart=this.pos);break;case 47:switch(this.input.charCodeAt(this.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break e}break;default:if(e>8&&e<14||e>=5760&&cc.test(String.fromCharCode(e)))++this.pos;else break e}}};ge.finishToken=function(e,t){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var s=this.type;this.type=e,this.value=t,this.updateContext(s)};ge.readToken_dot=function(){var e=this.input.charCodeAt(this.pos+1);if(e>=48&&e<=57)return this.readNumber(true);var t=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&e===46&&t===46?(this.pos+=3,this.finishToken(f.ellipsis)):(++this.pos,this.finishToken(f.dot))};ge.readToken_slash=function(){var e=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):e===61?this.finishOp(f.assign,2):this.finishOp(f.slash,1)};ge.readToken_mult_modulo_exp=function(e){var t=this.input.charCodeAt(this.pos+1),s=1,i=e===42?f.star:f.modulo;return this.options.ecmaVersion>=7&&e===42&&t===42&&(++s,i=f.starstar,t=this.input.charCodeAt(this.pos+2)),t===61?this.finishOp(f.assign,s+1):this.finishOp(i,s)};ge.readToken_pipe_amp=function(e){var t=this.input.charCodeAt(this.pos+1);if(t===e){if(this.options.ecmaVersion>=12){var s=this.input.charCodeAt(this.pos+2);if(s===61)return this.finishOp(f.assign,3)}return this.finishOp(e===124?f.logicalOR:f.logicalAND,2)}return t===61?this.finishOp(f.assign,2):this.finishOp(e===124?f.bitwiseOR:f.bitwiseAND,1)};ge.readToken_caret=function(){var e=this.input.charCodeAt(this.pos+1);return e===61?this.finishOp(f.assign,2):this.finishOp(f.bitwiseXOR,1)};ge.readToken_plus_min=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?t===45&&!this.inModule&&this.input.charCodeAt(this.pos+2)===62&&(this.lastTokEnd===0||Je.test(this.input.slice(this.lastTokEnd,this.pos)))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(f.incDec,2):t===61?this.finishOp(f.assign,2):this.finishOp(f.plusMin,1)};ge.readToken_lt_gt=function(e){var t=this.input.charCodeAt(this.pos+1),s=1;return t===e?(s=e===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+s)===61?this.finishOp(f.assign,s+1):this.finishOp(f.bitShift,s)):t===33&&e===60&&!this.inModule&&this.input.charCodeAt(this.pos+2)===45&&this.input.charCodeAt(this.pos+3)===45?(this.skipLineComment(4),this.skipSpace(),this.nextToken()):(t===61&&(s=2),this.finishOp(f.relational,s))};ge.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.pos+1);return t===61?this.finishOp(f.equality,this.input.charCodeAt(this.pos+2)===61?3:2):e===61&&t===62&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(f.arrow)):this.finishOp(e===61?f.eq:f.prefix,1)};ge.readToken_question=function(){var e=this.options.ecmaVersion;if(e>=11){var t=this.input.charCodeAt(this.pos+1);if(t===46){var s=this.input.charCodeAt(this.pos+2);if(s<48||s>57)return this.finishOp(f.questionDot,2)}if(t===63){if(e>=12){var i=this.input.charCodeAt(this.pos+2);if(i===61)return this.finishOp(f.assign,3)}return this.finishOp(f.coalesce,2)}}return this.finishOp(f.question,1)};ge.readToken_numberSign=function(){var e=this.options.ecmaVersion,t=35;if(e>=13&&(++this.pos,t=this.fullCharCodeAtPos(),Tt(t,true)||t===92))return this.finishToken(f.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+Ut(t)+"'")};ge.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(f.parenL);case 41:return++this.pos,this.finishToken(f.parenR);case 59:return++this.pos,this.finishToken(f.semi);case 44:return++this.pos,this.finishToken(f.comma);case 91:return++this.pos,this.finishToken(f.bracketL);case 93:return++this.pos,this.finishToken(f.bracketR);case 123:return++this.pos,this.finishToken(f.braceL);case 125:return++this.pos,this.finishToken(f.braceR);case 58:return++this.pos,this.finishToken(f.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(f.backQuote);case 48:var t=this.input.charCodeAt(this.pos+1);if(t===120||t===88)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(t===111||t===79)return this.readRadixNumber(8);if(t===98||t===66)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(false);case 34:case 39:return this.readString(e);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(e);case 124:case 38:return this.readToken_pipe_amp(e);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(e);case 60:case 62:return this.readToken_lt_gt(e);case 61:case 33:return this.readToken_eq_excl(e);case 63:return this.readToken_question();case 126:return this.finishOp(f.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+Ut(e)+"'")};ge.finishOp=function(e,t){var s=this.input.slice(this.pos,this.pos+t);return this.pos+=t,this.finishToken(e,s)};ge.readRegexp=function(){for(var e,t,s=this.pos;;){this.pos>=this.input.length&&this.raise(s,"Unterminated regular expression");var i=this.input.charAt(this.pos);if(Je.test(i)&&this.raise(s,"Unterminated regular expression"),e)e=false;else{if(i==="[")t=true;else if(i==="]"&&t)t=false;else if(i==="/"&&!t)break;e=i==="\\"}++this.pos}var n=this.input.slice(s,this.pos);++this.pos;var a=this.pos,o=this.readWord1();this.containsEsc&&this.unexpected(a);var u=this.regexpState||(this.regexpState=new Rt(this));u.reset(s,n,o),this.validateRegExpFlags(u),this.validateRegExpPattern(u);var l=null;try{l=new RegExp(n,o)}catch{}return this.finishToken(f.regexp,{pattern:n,flags:o,value:l})};ge.readInt=function(e,t,s){for(var i=this.options.ecmaVersion>=12&&t===void 0,n=s&&this.input.charCodeAt(this.pos)===48,a=this.pos,o=0,u=0,l=0,h=t??1/0;l<h;++l,++this.pos){var d=this.input.charCodeAt(this.pos),m=void 0;if(i&&d===95){n&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals"),u===95&&this.raiseRecoverable(this.pos,"Numeric separator must be exactly one underscore"),l===0&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits"),u=d;continue}if(d>=97?m=d-97+10:d>=65?m=d-65+10:d>=48&&d<=57?m=d-48:m=1/0,m>=e)break;u=d,o=o*e+m}return i&&u===95&&this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits"),this.pos===a||t!=null&&this.pos-a!==t?null:o};function W1(e,t){return t?parseInt(e,8):parseFloat(e.replace(/_/g,""))}function Oc(e){return typeof BigInt!="function"?null:BigInt(e.replace(/_/g,""))}ge.readRadixNumber=function(e){var t=this.pos;this.pos+=2;var s=this.readInt(e);return s==null&&this.raise(this.start+2,"Expected number in radix "+e),this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110?(s=Oc(this.input.slice(t,this.pos)),++this.pos):Tt(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(f.num,s)};ge.readNumber=function(e){var t=this.pos;!e&&this.readInt(10,void 0,true)===null&&this.raise(t,"Invalid number");var s=this.pos-t>=2&&this.input.charCodeAt(t)===48;s&&this.strict&&this.raise(t,"Invalid number");var i=this.input.charCodeAt(this.pos);if(!s&&!e&&this.options.ecmaVersion>=11&&i===110){var n=Oc(this.input.slice(t,this.pos));return++this.pos,Tt(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(f.num,n)}s&&/[89]/.test(this.input.slice(t,this.pos))&&(s=false),i===46&&!s&&(++this.pos,this.readInt(10),i=this.input.charCodeAt(this.pos)),(i===69||i===101)&&!s&&(i=this.input.charCodeAt(++this.pos),(i===43||i===45)&&++this.pos,this.readInt(10)===null&&this.raise(t,"Invalid number")),Tt(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var a=W1(this.input.slice(t,this.pos),s);return this.finishToken(f.num,a)};ge.readCodePoint=function(){var e=this.input.charCodeAt(this.pos),t;if(e===123){this.options.ecmaVersion<6&&this.unexpected();var s=++this.pos;t=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,t>1114111&&this.invalidStringToken(s,"Code point out of bounds")}else t=this.readHexChar(4);return t};ge.readString=function(e){for(var t="",s=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var i=this.input.charCodeAt(this.pos);if(i===e)break;i===92?(t+=this.input.slice(s,this.pos),t+=this.readEscapedChar(false),s=this.pos):i===8232||i===8233?(this.options.ecmaVersion<10&&this.raise(this.start,"Unterminated string constant"),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(ws(i)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return t+=this.input.slice(s,this.pos++),this.finishToken(f.string,t)};var Bc={};ge.tryReadTemplateToken=function(){this.inTemplateElement=true;try{this.readTmplToken()}catch(e){if(e===Bc)this.readInvalidTemplateToken();else throw e}this.inTemplateElement=false};ge.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw Bc;this.raise(e,t)};ge.readTmplToken=function(){for(var e="",t=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var s=this.input.charCodeAt(this.pos);if(s===96||s===36&&this.input.charCodeAt(this.pos+1)===123)return this.pos===this.start&&(this.type===f.template||this.type===f.invalidTemplate)?s===36?(this.pos+=2,this.finishToken(f.dollarBraceL)):(++this.pos,this.finishToken(f.backQuote)):(e+=this.input.slice(t,this.pos),this.finishToken(f.template,e));if(s===92)e+=this.input.slice(t,this.pos),e+=this.readEscapedChar(true),t=this.pos;else if(ws(s)){switch(e+=this.input.slice(t,this.pos),++this.pos,s){case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:e+=`
6
- `;break;default:e+=String.fromCharCode(s);break}this.options.locations&&(++this.curLine,this.lineStart=this.pos),t=this.pos}else++this.pos}};ge.readInvalidTemplateToken=function(){for(;this.pos<this.input.length;this.pos++)switch(this.input[this.pos]){case"\\":++this.pos;break;case"$":if(this.input[this.pos+1]!=="{")break;case"`":return this.finishToken(f.invalidTemplate,this.input.slice(this.start,this.pos));case"\r":this.input[this.pos+1]===`
7
- `&&++this.pos;case`
8
- `:case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1;break}this.raise(this.start,"Unterminated template")};ge.readEscapedChar=function(e){var t=this.input.charCodeAt(++this.pos);switch(++this.pos,t){case 110:return`
9
- `;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return Ut(this.readCodePoint());case 116:return" ";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),"";case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,"Invalid escape sequence"),e){var s=this.pos-1;this.invalidStringToken(s,"Invalid escape sequence in template string")}default:if(t>=48&&t<=55){var i=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],n=parseInt(i,8);return n>255&&(i=i.slice(0,-1),n=parseInt(i,8)),this.pos+=i.length-1,t=this.input.charCodeAt(this.pos),(i!=="0"||t===56||t===57)&&(this.strict||e)&&this.invalidStringToken(this.pos-1-i.length,e?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(n)}return ws(t)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(t)}};ge.readHexChar=function(e){var t=this.pos,s=this.readInt(16,e);return s===null&&this.invalidStringToken(t,"Bad character escape sequence"),s};ge.readWord1=function(){this.containsEsc=false;for(var e="",t=true,s=this.pos,i=this.options.ecmaVersion>=6;this.pos<this.input.length;){var n=this.fullCharCodeAtPos();if(Zt(n,i))this.pos+=n<=65535?1:2;else if(n===92){this.containsEsc=true,e+=this.input.slice(s,this.pos);var a=this.pos;this.input.charCodeAt(++this.pos)!==117&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var o=this.readCodePoint();(t?Tt:Zt)(o,i)||this.invalidStringToken(a,"Invalid Unicode escape"),e+=Ut(o),s=this.pos}else break;t=false}return e+this.input.slice(s,this.pos)};ge.readWord=function(){var e=this.readWord1(),t=f.name;return this.keywords.test(e)&&(t=Yn[e]),this.finishToken(t,e)};var G1="8.15.0";Ne.acorn={Parser:Ne,version:G1,defaultOptions:wn,Position:qs,SourceLocation:qi,getLineInfo:lc,Node:Xi,TokenType:ye,tokTypes:f,keywordTypes:Yn,TokContext:ct,tokContexts:Te,isIdentifierChar:Zt,isIdentifierStart:Tt,Token:ea,isNewLine:ws,lineBreak:Je,lineBreakG:d1,nonASCIIwhitespace:cc};function X1(e,t){return Ne.parse(e,t)}const Y1=new Set(["slider","color","toggle","select","number","text","image","button","coordinate"]);function z1(e){return e==="button"?0:1}const ta="__vijiNameMissingLine";function K1(e){if(e.type!=="CallExpression")return null;const t=e.callee;if(!t||t.type!=="MemberExpression"||t.computed)return null;const s=t.object,i=t.property;if(!s||s.type!=="Identifier"||s.name!=="viji"||!i||i.type!=="Identifier")return null;const n=i.name;return Y1.has(n)?n:null}function Z1(e,t){if(!e)return null;if(e.type==="VariableDeclarator"&&e.init===t){const s=e.id;return s?.type==="Identifier"?s.name:null}if(e.type==="Property"&&e.value===t&&!e.computed){const s=e.key;return s?.type==="Identifier"?s.name:null}if(e.type==="AssignmentExpression"&&e.right===t&&e.operator==="="){const s=e.left;if(s?.type==="MemberExpression"&&!s.computed){const i=s.property;if(i?.type==="Identifier")return i.name}return null}return null}function Q1(e){for(const t of e.properties){if(t.type!=="Property"||t.computed)continue;const s=t.key;if((s.type==="Identifier"?s.name:s.type==="Literal"&&typeof s.value=="string"?s.value:null)!=="name")continue;const n=t.value;return n.type==="Literal"&&typeof n.value=="string"?n.value:null}return null}function Tn(e,t,s){s(e,t);for(const i of Object.keys(e)){if(i==="loc")continue;const n=e[i];if(Array.isArray(n))for(const a of n)a&&typeof a.type=="string"&&Tn(a,e,s);else n&&typeof n.type=="string"&&Tn(n,e,s)}}function J1(e){let t;const s=[];try{t=X1(e,{ecmaVersion:"latest",allowReturnOutsideFunction:true,allowAwaitOutsideFunction:true,locations:true,onComment:(u,l,h,d)=>s.push({start:h,end:d})})}catch(u){return{code:e,error:{code:"SCENE_PARSE_ERROR",message:`Scene code could not be parsed: ${u.message}`}}}const i=[],n=new Map,a=[];if(Tn(t,null,(u,l)=>{const h=K1(u);if(!h)return;const d=u.loc?.start.line??0,m=Z1(l,u),_=u.arguments,k=z1(h);if(_.some(N=>N.type==="SpreadElement"))return;const T=_.length>k?_[k]:null,P=T?.type==="ObjectExpression"?Q1(T):null,F=P??m;if(F!==null){const N=n.get(F);N!==void 0?a.push({name:F,firstLine:N,line:d}):n.set(F,d)}let B;if(m!==null)B=`name:${JSON.stringify(m)},`;else{if(P!==null)return;B=`${ta}:${d},`}if(T)T.type==="ObjectExpression"?i.push({pos:T.start+1,text:B}):(i.push({pos:T.start,text:`{ ${B} ...`}),i.push({pos:T.end,text:" }"}));else{let N="";if(_.length>0){const Y=_[_.length-1].end,q=u.end-1;let z=false;for(let J=Y;J<q;J++)if(e[J]===","&&!s.some(K=>J>=K.start&&J<K.end)){z=true;break}N=z?" ":", "}i.push({pos:u.end-1,text:`${N}{ ${B} }`})}}),a.length>0){const u=a[0];return{code:e,error:{code:"PARAM_NAME_DUPLICATE",message:`Duplicate parameter name '${u.name}' (line ${u.firstLine} and line ${u.line}). Parameter names are scene-global — rename one, or pass name:'...' to distinguish them.`+(a.length>1?` (${a.length-1} more duplicate${a.length>2?"s":""} after this one.)`:"")}}}if(i.length===0)return{code:e,error:null};i.sort((u,l)=>l.pos-u.pos);let o=e;for(const u of i)o=o.slice(0,u.pos)+u.text+o.slice(u.pos);return{code:o,error:null}}function Ka(e,t){const s=Math.abs(t-e);if(s<=0)return 1;const i=Math.pow(10,Math.floor(Math.log10(s/100)));return Math.max(i,Number.EPSILON)}const eh=/^[A-Za-z_$][A-Za-z0-9_$]*$/,th=new Set(["__proto__","constructor","prototype",ta]);function Pt(e){const t=e?.name;if(typeof t=="string"&&t.length>0)return t;const s=e?.[ta];throw new Error("[PARAM_NAME_MISSING] Parameter created without a name"+(typeof s=="number"?` (line ${s})`:"")+": assign it to a variable or object key, or pass name:'...'.")}class sh{parameterDefinitions=new Map;parameterGroups=new Map;parameterValues=new Map;parameterObjects=new Map;parametersDefined=false;initialValuesSynced=false;debugMode=false;setDebugMode(t){this.debugMode=t}debugLog(t,...s){this.debugMode&&console.log(t,...s)}postMessageCallback;constructor(t){this.postMessageCallback=t}createSliderParameter(t,s){const i=Pt(s),n=s.min??0,a=s.max??100,o={value:t,min:n,max:a,step:s.step??Ka(n,a),...s.label!==void 0&&{label:s.label},description:s.description??"",group:s.group??"general",category:s.category??"general"},u={type:"slider",defaultValue:t,...o.label!==void 0&&{label:o.label},description:o.description,group:o.group,category:o.category,config:{min:o.min,max:o.max,step:o.step}};return this.storeParameterDefinition(i,u),this.parameterObjects.set(i,o),o}createColorParameter(t,s){const i=Pt(s),n=vn(t),a={value:n,rgb:Object.freeze(_i(n)),hsb:Object.freeze(qa(n)),...s.label!==void 0&&{label:s.label},description:s.description??"",group:s.group??"general",category:s.category??"general"},o={type:"color",defaultValue:n,...a.label!==void 0&&{label:a.label},description:a.description,group:a.group,category:a.category};return this.storeParameterDefinition(i,o),this.parameterObjects.set(i,a),a}createToggleParameter(t,s){const i=Pt(s),n={value:t,...s.label!==void 0&&{label:s.label},description:s.description??"",group:s.group??"general",category:s.category??"general"},a={type:"toggle",defaultValue:t,...n.label!==void 0&&{label:n.label},description:n.description,group:n.group,category:n.category};return this.storeParameterDefinition(i,a),this.parameterObjects.set(i,n),n}createSelectParameter(t,s){const i=Pt(s),n={value:t,options:s.options,...s.label!==void 0&&{label:s.label},description:s.description??"",group:s.group??"general",category:s.category??"general"},a={type:"select",defaultValue:t,...n.label!==void 0&&{label:n.label},description:n.description,group:n.group,category:n.category,config:{options:n.options}};return this.storeParameterDefinition(i,a),this.parameterObjects.set(i,n),n}createTextParameter(t,s){const i=Pt(s),n={value:t,maxLength:s.maxLength??1e3,...s.label!==void 0&&{label:s.label},description:s.description??"",group:s.group??"general",category:s.category??"general"},a={type:"text",defaultValue:t,...n.label!==void 0&&{label:n.label},description:n.description,group:n.group,category:n.category,config:{maxLength:n.maxLength}};return this.storeParameterDefinition(i,a),this.parameterObjects.set(i,n),n}createNumberParameter(t,s){const i=Pt(s),n=s.min??0,a=s.max??100,o={value:t,min:n,max:a,step:s.step??Ka(n,a),...s.label!==void 0&&{label:s.label},description:s.description??"",group:s.group??"general",category:s.category??"general"},u={type:"number",defaultValue:t,...o.label!==void 0&&{label:o.label},description:o.description,group:o.group,category:o.category,config:{min:o.min,max:o.max,step:o.step}};return this.storeParameterDefinition(i,u),this.parameterObjects.set(i,o),o}createImageParameter(t,s){const i=Pt(s),n={value:t,...s.label!==void 0&&{label:s.label},description:s.description??"",group:s.group??"general",category:s.category??"general"},a={type:"image",defaultValue:t,...n.label!==void 0&&{label:n.label},description:n.description,group:n.group,category:n.category};return this.storeParameterDefinition(i,a),this.parameterObjects.set(i,n),n}createButtonParameter(t){const s=Pt(t),i={value:false,...t.label!==void 0&&{label:t.label},description:t.description??"",group:t.group??"general",category:t.category??"general"},n={type:"button",defaultValue:false,...i.label!==void 0&&{label:i.label},description:i.description,group:i.group,category:i.category};return this.storeParameterDefinition(s,n),this.parameterObjects.set(s,i),i}createCoordinateParameter(t,s){const i=Pt(s),n={value:{x:t.x,y:t.y},step:s.step??.01,...s.label!==void 0&&{label:s.label},description:s.description??"",group:s.group??"general",category:s.category??"general"},a={type:"coordinate",defaultValue:{x:t.x,y:t.y},...n.label!==void 0&&{label:n.label},description:n.description,group:n.group,category:n.category,config:{min:-1,max:1,step:n.step}};return this.storeParameterDefinition(i,a),this.parameterObjects.set(i,n),n}storeParameterDefinition(t,s){if(!eh.test(t))throw new Error(`[PARAM_NAME_INVALID] Parameter name "${t}" is not a valid identifier (letters, digits, _ and $, not starting with a digit).`);if(th.has(t))throw new Error(`[PARAM_NAME_INVALID] Parameter name "${t}" is reserved.`);if(this.parameterDefinitions.has(t))throw new Error(`[PARAM_NAME_DUPLICATE] Duplicate parameter name "${t}". Parameter names are scene-global — rename one, or pass name:'...' to distinguish them.`);const i={name:t,...s};this.parameterDefinitions.set(t,i),this.parameterValues.set(t,i.defaultValue)}updateParameterValue(t,s){const i=this.parameterDefinitions.get(t);if(!i)return console.warn(`Unknown parameter: ${t}. Available parameters:`,Array.from(this.parameterDefinitions.keys())),false;if(i.type==="color")try{s=vn(s)}catch(l){return console.error(`Parameter '${t}' invalid color: ${l.message}`),false}if(!this.validateParameterValue(t,s,i))return console.warn(`Validation failed for parameter ${t} = ${s}`),false;const n=this.parameterValues.get(t),a=!this.initialValuesSynced;if((i.type==="coordinate"?n&&s&&typeof n=="object"&&typeof s=="object"&&"x"in n&&"x"in s&&n.x===s.x&&n.y===s.y:n===s)&&!a)return false;this.parameterValues.set(t,s);const u=this.parameterObjects.get(t);if(u&&(u.value=s,i.type==="color")){const l=s;u.rgb=Object.freeze(_i(l)),u.hsb=Object.freeze(qa(l))}return true}validateParameterValue(t,s,i){if(i.validate&&!i.validate(s))return console.error(`Custom validation failed for parameter '${t}': ${s}`),false;switch(i.type){case"slider":case"number":if(typeof s!="number"||isNaN(s))return console.error(`Parameter '${t}' must be a number, got: ${s}`),false;if(i.config?.min!==void 0&&s<i.config.min)return console.error(`Parameter '${t}' value ${s} is below minimum ${i.config.min}`),false;if(i.config?.max!==void 0&&s>i.config.max)return console.error(`Parameter '${t}' value ${s} is above maximum ${i.config.max}`),false;break;case"color":if(typeof s!="string"||!/^#[0-9a-f]{6}$/.test(s))return console.error(`Parameter '${t}' must be normalized lowercase hex '#rrggbb', got: ${s}`),false;break;case"toggle":if(typeof s!="boolean")return console.error(`Parameter '${t}' must be a boolean, got: ${s}`),false;break;case"select":if(!i.config?.options||!i.config.options.includes(s))return console.error(`Parameter '${t}' value ${s} is not in options: ${i.config?.options}`),false;break;case"text":if(typeof s!="string")return console.error(`Parameter '${t}' must be a string, got: ${s}`),false;if(i.config?.maxLength&&s.length>i.config.maxLength)return console.error(`Parameter '${t}' text too long: ${s.length} > ${i.config.maxLength}`),false;break;case"image":if(s!==null&&!(s instanceof ImageBitmap))return console.error(`Parameter '${t}' must be null or ImageBitmap, got: ${s}`),false;break;case"button":if(typeof s!="boolean")return console.error(`Parameter '${t}' must be a boolean, got: ${s}`),false;break;case"coordinate":{if(!s||typeof s!="object"||!("x"in s)||!("y"in s))return console.error(`Parameter '${t}' must be an object with x and y properties, got: ${s}`),false;const n=s;if(typeof n.x!="number"||isNaN(n.x)||typeof n.y!="number"||isNaN(n.y))return console.error(`Parameter '${t}' x and y must be numbers, got: x=${n.x}, y=${n.y}`),false;if(n.x<-1||n.x>1||n.y<-1||n.y>1)return console.error(`Parameter '${t}' x and y must be between -1 and 1, got: x=${n.x}, y=${n.y}`),false;break}}return true}resetParameterState(){this.parametersDefined=false,this.initialValuesSynced=false,this.parameterDefinitions.clear(),this.parameterGroups.clear(),this.parameterValues.clear(),this.parameterObjects.clear()}sendAllParametersToHost(){if(!this.parametersDefined)try{const t=new Map;for(const[s,i]of this.parameterDefinitions){const n=i.group||"general";if(!t.has(n)){const o=i.category||"general";t.set(n,{groupName:n,category:o,parameters:{}})}const a=t.get(n);a.parameters[s]=i}this.parametersDefined=true,this.postMessageCallback("parameters-defined",{groups:Array.from(t.values())}),this.debugLog(`All parameters sent to host: ${this.parameterDefinitions.size} parameters in ${t.size} groups`)}catch(t){this.postMessageCallback("parameter-validation-error",{message:`Failed to send parameters to host: ${t.message}`,code:"PARAMETER_SENDING_ERROR"})}}markInitialValuesSynced(){this.initialValuesSynced=true}seedInitialValues(t){for(const[s,i]of Object.entries(t)){if(!this.parameterDefinitions.has(s)){this.debugLog(`Skipping initial value for undefined parameter: ${s}`);continue}this.updateParameterValue(s,i)}this.markInitialValuesSynced()}getParameterCount(){return this.parameterDefinitions.size}getAllParameterObjects(){return this.parameterObjects}resetButtonParameters(){for(const[t,s]of this.parameterDefinitions)if(s.type==="button"){const i=this.parameterObjects.get(t);i&&i.value===true&&(i.value=false,this.parameterValues.set(t,false))}}}class ih{isEnabled=true;previousButtons=0;previousTouchPositions=new Map;mouseState={x:0,y:0,isInCanvas:false,isPressed:false,leftButton:false,rightButton:false,middleButton:false,deltaX:0,deltaY:0,wheelDelta:0,wheelX:0,wheelY:0,wasPressed:false,wasReleased:false,wasMoved:false};keyboardState={isPressed:t=>this.keyboardState.activeKeys.has(t.toLowerCase()),wasPressed:t=>this.keyboardState.pressedThisFrame.has(t.toLowerCase()),wasReleased:t=>this.keyboardState.releasedThisFrame.has(t.toLowerCase()),activeKeys:new Set,pressedThisFrame:new Set,releasedThisFrame:new Set,lastKeyPressed:"",lastKeyReleased:"",shift:false,ctrl:false,alt:false,meta:false,textureData:null};touchState={points:[],count:0,started:[],moved:[],ended:[],primary:null};keyboardTextureData=new Uint8Array(256*3);pointerState={x:0,y:0,deltaX:0,deltaY:0,isDown:false,wasPressed:false,wasReleased:false,isInCanvas:false,type:"none"};previousPointerDown=false;keyboardConsumedThisFrame=false;constructor(){this.keyboardState.textureData=this.keyboardTextureData;const t=this.keyboardState.isPressed,s=this.keyboardState.wasPressed,i=this.keyboardState.wasReleased;this.keyboardState.isPressed=n=>{const a=t(n);return a&&(this.keyboardConsumedThisFrame=true),a},this.keyboardState.wasPressed=n=>{const a=s(n);return a&&(this.keyboardConsumedThisFrame=true),a},this.keyboardState.wasReleased=n=>{const a=i(n);return a&&(this.keyboardConsumedThisFrame=true),a},this.handleMouseUpdate=this.handleMouseUpdate.bind(this),this.handleKeyboardUpdate=this.handleKeyboardUpdate.bind(this),this.handleTouchUpdate=this.handleTouchUpdate.bind(this),this.frameStart=this.frameStart.bind(this)}getKeyboardConsumed(){return this.keyboardConsumedThisFrame}getMouseState(){return this.mouseState}getPointerState(){return this.pointerState}getTouchCount(){return this.touchState.count}getInteractionAPIs(){return{mouse:this.mouseState,keyboard:this.keyboardState,touches:this.touchState,pointer:this.pointerState}}frameStart(){this.mouseState.wasPressed=false,this.mouseState.wasReleased=false,this.mouseState.wasMoved=false,this.mouseState.deltaX=0,this.mouseState.deltaY=0,this.mouseState.wheelDelta=0,this.mouseState.wheelX=0,this.mouseState.wheelY=0,this.keyboardState.pressedThisFrame.clear(),this.keyboardState.releasedThisFrame.clear(),this.keyboardTextureData.fill(0,256,512),this.touchState.started=[],this.touchState.moved=[],this.touchState.ended=[],this.keyboardConsumedThisFrame=false}handleMouseUpdate(t){if(!this.isEnabled)return;this.mouseState.x=t.x,this.mouseState.y=t.y,this.mouseState.isInCanvas=t.isInCanvas!==void 0?t.isInCanvas:true,this.mouseState.leftButton=(t.buttons&1)!==0,this.mouseState.rightButton=(t.buttons&2)!==0,this.mouseState.middleButton=(t.buttons&4)!==0,this.mouseState.isPressed=t.buttons>0,this.mouseState.deltaX+=t.deltaX||0,this.mouseState.deltaY+=t.deltaY||0,this.mouseState.wheelDelta+=t.wheelDeltaY||0,this.mouseState.wheelX+=t.wheelDeltaX||0,this.mouseState.wheelY+=t.wheelDeltaY||0;const s=t.buttons&~this.previousButtons,i=this.previousButtons&~t.buttons;this.mouseState.wasPressed=this.mouseState.wasPressed||s!==0,this.mouseState.wasReleased=this.mouseState.wasReleased||i!==0,this.mouseState.wasMoved=this.mouseState.wasMoved||t.deltaX!==0||t.deltaY!==0,this.previousButtons=t.buttons}handleKeyboardUpdate(t){if(!this.isEnabled)return;const s=t.key.toLowerCase();if(t.type==="keydown"){if(!this.keyboardState.activeKeys.has(s)){this.keyboardState.activeKeys.add(s),this.keyboardState.pressedThisFrame.add(s),this.keyboardState.lastKeyPressed=t.key;const i=t.keyCode;i!==void 0&&i>=0&&i<=255&&(this.keyboardTextureData[i]=255,this.keyboardTextureData[256+i]=255,this.keyboardTextureData[512+i]^=255)}}else if(t.type==="keyup"){this.keyboardState.activeKeys.delete(s),this.keyboardState.releasedThisFrame.add(s),this.keyboardState.lastKeyReleased=t.key;const i=t.keyCode;i!==void 0&&i>=0&&i<=255&&(this.keyboardTextureData[i]=0)}this.keyboardState.shift=t.shiftKey,this.keyboardState.ctrl=t.ctrlKey,this.keyboardState.alt=t.altKey,this.keyboardState.meta=t.metaKey}handleTouchUpdate(t){if(!this.isEnabled)return;const s=t.touches.map(a=>{const o=a.identifier,u=!!a.ended;let l=0,h=0,d=0,m=0;const _=this.previousTouchPositions.get(o);if(_){l=a.clientX-_.x,h=a.clientY-_.y;const k=(t.timestamp-_.timestamp)/1e3;k>0&&(d=l/k,m=h/k)}return u?this.previousTouchPositions.delete(o):this.previousTouchPositions.set(o,{x:a.clientX,y:a.clientY,timestamp:t.timestamp}),{id:o,x:a.clientX,y:a.clientY,pressure:a.force,radius:Math.max(a.radiusX,a.radiusY),radiusX:a.radiusX,radiusY:a.radiusY,rotationAngle:a.rotationAngle,force:a.force,isInCanvas:a.isInCanvas,deltaX:l,deltaY:h,velocity:{x:d,y:m},isNew:t.type==="touchstart"&&!_,isActive:!u,isEnding:u}}),i=s.filter(a=>a.isActive),n=s.filter(a=>a.isEnding);this.touchState.points=i,this.touchState.count=i.length,this.touchState.primary=i[0]||null,t.type==="touchstart"?this.touchState.started.push(...s.filter(a=>a.isNew)):t.type==="touchmove"?this.touchState.moved=i:(t.type==="touchend"||t.type==="touchcancel")&&this.touchState.ended.push(...n)}updatePointerState(){const t=this.touchState,s=this.mouseState;if(t.count>0&&t.primary){const i=t.primary;this.pointerState.x=i.x,this.pointerState.y=i.y,this.pointerState.deltaX=i.deltaX,this.pointerState.deltaY=i.deltaY,this.pointerState.isDown=true,this.pointerState.isInCanvas=i.isInCanvas,this.pointerState.type="touch"}else this.pointerState.x=s.x,this.pointerState.y=s.y,this.pointerState.deltaX=s.deltaX,this.pointerState.deltaY=s.deltaY,this.pointerState.isDown=s.leftButton,this.pointerState.isInCanvas=s.isInCanvas,this.pointerState.type=s.isInCanvas?"mouse":"none";this.pointerState.wasPressed=this.pointerState.isDown&&!this.previousPointerDown,this.pointerState.wasReleased=!this.pointerState.isDown&&this.previousPointerDown,this.previousPointerDown=this.pointerState.isDown}resetInteractionState(){Object.assign(this.mouseState,{x:0,y:0,isInCanvas:false,isPressed:false,leftButton:false,rightButton:false,middleButton:false,deltaX:0,deltaY:0,wheelDelta:0,wheelX:0,wheelY:0,wasPressed:false,wasReleased:false,wasMoved:false}),this.keyboardState.activeKeys.clear(),this.keyboardState.pressedThisFrame.clear(),this.keyboardState.releasedThisFrame.clear(),this.keyboardState.lastKeyPressed="",this.keyboardState.lastKeyReleased="",this.keyboardState.shift=false,this.keyboardState.ctrl=false,this.keyboardState.alt=false,this.keyboardState.meta=false,this.keyboardTextureData.fill(0),this.touchState.points=[],this.touchState.count=0,this.touchState.started=[],this.touchState.moved=[],this.touchState.ended=[],this.touchState.primary=null,this.previousTouchPositions.clear(),Object.assign(this.pointerState,{x:0,y:0,deltaX:0,deltaY:0,isDown:false,wasPressed:false,wasReleased:false,isInCanvas:false,type:"none"}),this.previousPointerDown=false}setInteractionEnabled(t){this.isEnabled=t,t||this.resetInteractionStates()}getInteractionEnabled(){return this.isEnabled}resetInteractionStates(){this.mouseState.x=0,this.mouseState.y=0,this.mouseState.isInCanvas=false,this.mouseState.isPressed=false,this.mouseState.leftButton=false,this.mouseState.rightButton=false,this.mouseState.middleButton=false,this.mouseState.deltaX=0,this.mouseState.deltaY=0,this.mouseState.wheelDelta=0,this.mouseState.wheelX=0,this.mouseState.wheelY=0,this.mouseState.wasPressed=false,this.mouseState.wasReleased=false,this.mouseState.wasMoved=false,this.keyboardState.activeKeys.clear(),this.keyboardState.pressedThisFrame.clear(),this.keyboardState.releasedThisFrame.clear(),this.keyboardState.lastKeyPressed="",this.keyboardState.lastKeyReleased="",this.keyboardState.shift=false,this.keyboardState.ctrl=false,this.keyboardState.alt=false,this.keyboardState.meta=false,this.keyboardTextureData.fill(0),this.touchState.points=[],this.touchState.count=0,this.touchState.started=[],this.touchState.moved=[],this.touchState.ended=[],this.touchState.primary=null,this.previousTouchPositions.clear(),this.pointerState.x=0,this.pointerState.y=0,this.pointerState.deltaX=0,this.pointerState.deltaY=0,this.pointerState.isDown=false,this.pointerState.wasPressed=false,this.pointerState.wasReleased=false,this.pointerState.isInCanvas=false,this.pointerState.type="none",this.previousPointerDown=false}}const Za={activeFeatures:[],processingTime:0,targetFPS:0,actualFPS:0,isProcessing:false},Qa={faceDetection:{active:false,meaningful:false},faceMesh:{active:false,meaningful:false},emotion:{active:false,meaningful:false},handTracking:{active:false,meaningful:false},poseDetection:{active:false,meaningful:false},segmentation:{active:false,meaningful:false}},rh={faceDetection:"faceDetection",faceMesh:"faceMesh",emotionDetection:"emotion",handTracking:"handTracking",poseDetection:"poseDetection",bodySegmentation:"segmentation"};class nh{desired=new Set;results={faces:[],hands:[],pose:null,segmentation:null};stats={...Za};activity=structuredClone(Qa);analysedCanvas=null;analysedCtx=null;analysedFrameValid=false;analysedFrameData=null;analysedFrameDataDirty=false;streamIndex=0;sendRequest=null;debugMode=false;setMessaging(t,s){this.streamIndex=t,this.sendRequest=s,this.desired.size>0&&this.sendRequest(this.streamIndex,[...this.desired])}setDebugMode(t){this.debugMode=t}handleResultsUpdate(t){this.results.faces=t.results.faces??[],this.results.hands=t.results.hands??[],this.results.pose=t.results.pose??null,this.results.segmentation=t.results.segmentation??null,this.stats=t.stats,this.activity=t.activity,t.analysedFrame&&this.acceptAnalysedFrame(t.analysedFrame),this.debugLog(`cv-results-update applied (stream ${t.streamIndex})`)}getResults(){return this.results}getAnalysedFrame(){return this.analysedFrameValid?this.analysedCanvas:null}getAnalysedFrameData(){return!this.analysedFrameValid||!this.analysedCanvas||!this.analysedCtx?null:((this.analysedFrameDataDirty||!this.analysedFrameData)&&(this.analysedFrameData=this.analysedCtx.getImageData(0,0,this.analysedCanvas.width,this.analysedCanvas.height),this.analysedFrameDataDirty=false),this.analysedFrameData)}getStats(){return{...this.stats}}getCVActivity(){const t=new Set([...this.desired].map(i=>rh[i])),s=i=>({active:t.has(i)&&this.activity[i].active,meaningful:this.activity[i].meaningful});return{faceDetection:s("faceDetection"),faceMesh:s("faceMesh"),emotion:s("emotion"),handTracking:s("handTracking"),poseDetection:s("poseDetection"),segmentation:s("segmentation")}}hasActiveFeatures(){return this.desired.size>0}reset(){const t=this.desired.size>0;this.desired.clear(),this.clearResults(),t&&this.sendRequest?.(this.streamIndex,[])}clearResults(){this.results.faces=[],this.results.hands=[],this.results.pose=null,this.results.segmentation=null,this.stats={...Za},this.activity=structuredClone(Qa),this.analysedFrameValid&&this.analysedCtx&&this.analysedCanvas&&this.analysedCtx.clearRect(0,0,this.analysedCanvas.width,this.analysedCanvas.height),this.analysedFrameValid=false,this.analysedFrameData=null,this.analysedFrameDataDirty=false}getControlInterface(){const t=i=>n=>this.setFeature(i,n!==false),s=i=>()=>this.setFeature(i,false);return{enableFaceDetection:t("faceDetection"),disableFaceDetection:s("faceDetection"),enableFaceMesh:t("faceMesh"),disableFaceMesh:s("faceMesh"),enableEmotionDetection:t("emotionDetection"),disableEmotionDetection:s("emotionDetection"),enableHandTracking:t("handTracking"),disableHandTracking:s("handTracking"),enablePoseDetection:t("poseDetection"),disablePoseDetection:s("poseDetection"),enableBodySegmentation:t("bodySegmentation"),disableBodySegmentation:s("bodySegmentation"),getActiveFeatures:()=>Array.from(this.desired),isProcessing:()=>this.stats.isProcessing,getStats:()=>this.getStats(),getWorkerStatus:()=>({healthy:true,restartCount:0,maxRestarts:3}),restartWorker:()=>Promise.resolve(),checkWebGLAvailability:()=>this.checkWebGLContextAvailability(),getResourceUsage:()=>({activeFeatures:this.desired.size,estimatedWebGLContexts:this.desired.size*2,webglAvailable:this.checkWebGLContextAvailability()})}}setFeature(t,s){const i=this.desired.has(t);return s===i||(s?this.desired.add(t):(this.desired.delete(t),this.clearFamilyLocally(t),this.desired.size===0&&(this.analysedFrameValid=false,this.analysedFrameData=null,this.analysedFrameDataDirty=false)),this.sendRequest?.(this.streamIndex,[...this.desired])),Promise.resolve()}clearFamilyLocally(t){const s=["faceDetection","faceMesh","emotionDetection"];s.includes(t)?s.some(i=>this.desired.has(i))||(this.results.faces=[]):t==="handTracking"?this.results.hands=[]:t==="poseDetection"?this.results.pose=null:t==="bodySegmentation"&&(this.results.segmentation=null)}acceptAnalysedFrame(t){try{if(this.analysedCanvas||(this.analysedCanvas=new OffscreenCanvas(t.width,t.height),this.analysedCtx=this.analysedCanvas.getContext("2d",{willReadFrequently:true})),!this.analysedCtx)return;(this.analysedCanvas.width!==t.width||this.analysedCanvas.height!==t.height)&&(this.analysedCanvas.width=t.width,this.analysedCanvas.height=t.height),this.analysedCtx.drawImage(t,0,0),this.analysedFrameValid=true,this.analysedFrameDataDirty=true}finally{try{t.close()}catch{}}}checkWebGLContextAvailability(){try{const t=new OffscreenCanvas(1,1);return(t.getContext("webgl2")??t.getContext("webgl"))!==null}catch{return false}}debugLog(t,...s){this.debugMode&&console.log(`[CVSurfaceState] ${t}`,...s)}}class ui{offscreenCanvas=null;ctx=null;gl=null;debugMode=false;directGPUMode=false;deviceId;setDebugMode(t){this.debugMode=t,this.cvSurfaceState&&this.cvSurfaceState.setDebugMode(t)}debugLog(t,...s){this.debugMode&&console.log(t,...s)}targetFrameRate=30;lastFrameTime=0;frameInterval=1e3/this.targetFrameRate;hasLoggedFirstFrame=false;frameCount=0;videoState={isConnected:false,currentFrame:null,frameWidth:0,frameHeight:0,frameRate:0,frameData:null};frameDataDirty=false;cvSurfaceState;cvSurface;constructor(){this.cvSurfaceState=new nh;const t=this,s=this.cvSurfaceState.getControlInterface();this.cvSurface={analysedFrame:null,getAnalysedFrameData:()=>t.cvSurfaceState.getAnalysedFrameData(),faces:[],hands:[],pose:null,segmentation:null,...s}}getCvSurface(){return this.cvSurface}setCVMessaging(t,s){this.cvSurfaceState.setMessaging(t,s)}handleCVResultsUpdate(t){this.cvSurfaceState.handleResultsUpdate(t)}setDeviceId(t){this.deviceId=t}getDeviceId(){return this.deviceId}peekDebugState(){return{isConnected:this.videoState.isConnected,hasFrame:this.videoState.currentFrame!==null}}getVideoAPI(){const t=this.videoState.currentFrame;this.directGPUMode&&t instanceof ImageBitmap&&(this.videoState.currentFrame=null);const s=this.cvSurfaceState.getResults();return this.cvSurface.analysedFrame=this.cvSurfaceState.getAnalysedFrame(),this.cvSurface.faces=s.faces,this.cvSurface.hands=s.hands,this.cvSurface.pose=s.pose,this.cvSurface.segmentation=s.segmentation,{isConnected:this.videoState.isConnected,currentFrame:t,frameWidth:this.videoState.frameWidth,frameHeight:this.videoState.frameHeight,frameRate:this.videoState.frameRate,getFrameData:()=>this.extractFrameDataIfNeeded(),cv:this.cvSurface}}extractFrameDataIfNeeded(){return!this.offscreenCanvas||!this.ctx?null:((this.frameDataDirty||!this.videoState.frameData)&&(this.videoState.frameData=this.ctx.getImageData(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),this.frameDataDirty=false),this.videoState.frameData)}handleCanvasSetup(t){try{if(this.disconnectVideo(),this.offscreenCanvas=t.offscreenCanvas,this.ctx=this.offscreenCanvas.getContext("2d",{willReadFrequently:true}),!this.ctx)throw new Error("Failed to get 2D context from transferred OffscreenCanvas");try{this.gl=this.offscreenCanvas.getContext("webgl2")||this.offscreenCanvas.getContext("webgl")}catch{this.debugLog("WebGL not available, using 2D context only")}this.videoState.isConnected=true,this.videoState.currentFrame=this.offscreenCanvas,this.videoState.frameWidth=t.width,this.videoState.frameHeight=t.height,this.frameCount=0,this.hasLoggedFirstFrame=false,this.debugLog("✅ OffscreenCanvas received and setup completed (worker-side)",{width:t.width,height:t.height,hasWebGL:!!this.gl,targetFrameRate:this.targetFrameRate}),this.debugLog("🎬 CORRECT OffscreenCanvas approach - Worker has full GPU access!")}catch(s){console.error("Failed to setup OffscreenCanvas in worker:",s),this.disconnectVideo()}}handleFrameUpdate(t){if(!this.offscreenCanvas||!this.ctx){console.warn("🔴 Received frame but OffscreenCanvas not setup"),t.imageBitmap.close();return}try{this.frameCount%150===0&&this.debugLog("✅ Worker received ImageBitmap frame:",{bitmapSize:`${t.imageBitmap.width}x${t.imageBitmap.height}`,canvasSize:`${this.offscreenCanvas.width}x${this.offscreenCanvas.height}`,frameCount:this.frameCount,timestamp:t.timestamp}),this.ctx.drawImage(t.imageBitmap,0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),this.frameDataDirty=true,this.processCurrentFrame(t.timestamp),t.imageBitmap.close(),this.frameCount++}catch(s){console.error("🔴 Error processing video frame (worker-side):",s);try{t.imageBitmap.close()}catch{}}}processCurrentFrame(t){if(!(!this.offscreenCanvas||!this.ctx))try{const s=t-this.lastFrameTime;this.videoState.frameRate=s>0?1e3/s:0,this.hasLoggedFirstFrame||(this.debugLog(`🎯 Worker-side OffscreenCanvas processing active: ${this.videoState.frameRate.toFixed(1)} FPS (${this.offscreenCanvas.width}x${this.offscreenCanvas.height})`),this.debugLog("✅ Full GPU access available for custom effects and CV analysis"),this.hasLoggedFirstFrame=true),this.lastFrameTime=t}catch(s){console.error("Error processing video frame (worker-side):",s)}}handleVideoConfigUpdate(t){try{if(t.disconnect){this.disconnectVideo();return}t.width&&t.height&&this.offscreenCanvas&&this.resizeCanvas(t.width,t.height),t.targetFrameRate&&this.updateProcessingConfig(t.targetFrameRate)}catch(s){console.error("Error handling video config update:",s)}}resizeCanvas(t,s){if(this.offscreenCanvas)try{this.offscreenCanvas.width=t,this.offscreenCanvas.height=s,this.videoState.frameWidth=t,this.videoState.frameHeight=s,this.gl&&this.gl.viewport(0,0,t,s),this.debugLog(`📐 OffscreenCanvas resized to ${t}x${s} (worker-side)`)}catch(i){console.error("Error resizing OffscreenCanvas:",i)}}disconnectVideo(){this.offscreenCanvas&&this.ctx&&(this.ctx.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),this.debugLog("🧹 Cleared OffscreenCanvas on disconnect")),this.offscreenCanvas=null,this.ctx=null,this.gl=null,this.videoState.isConnected=false,this.videoState.currentFrame=null,this.videoState.frameWidth=0,this.videoState.frameHeight=0,this.videoState.frameRate=0,this.videoState.frameData=null,this.frameDataDirty=false,this.lastFrameTime=0,this.cvSurfaceState.clearResults(),this.hasLoggedFirstFrame=false,this.frameCount=0,this.debugLog("Video disconnected (worker-side)")}updateProcessingConfig(t){this.targetFrameRate=Math.max(1,Math.min(60,t)),this.frameInterval=1e3/this.targetFrameRate,this.debugLog(`Video processing frame rate updated to ${this.targetFrameRate} FPS (worker-side)`)}resetVideoState(){this.disconnectVideo(),this.cvSurfaceState.reset()}getProcessingConfig(){return{targetFrameRate:this.targetFrameRate,frameInterval:this.frameInterval,frameCount:this.frameCount}}getWebGLContext(){return this.gl}getCanvasForArtistEffects(){return this.offscreenCanvas}getCVStats(){return this.cvSurfaceState.getStats()}getCVActivity(){return this.cvSurfaceState.getCVActivity()}initializeForDirectFrames(t){if(this.disconnectVideo(),this.directGPUMode=t==="shader",this.directGPUMode)this.debugLog("VideoSystem initialized in direct GPU mode (zero-copy, pre-flipped ImageBitmaps)");else{if(this.offscreenCanvas=new OffscreenCanvas(1920,1080),this.ctx=this.offscreenCanvas.getContext("2d",{willReadFrequently:true}),!this.ctx)throw new Error("Failed to get 2D context for direct frames");this.videoState.currentFrame=this.offscreenCanvas,this.debugLog("VideoSystem initialized with canvas (P5/Canvas consumer)")}this.videoState.isConnected=false}handleDirectFrame(t){this.directGPUMode?(this.videoState.currentFrame instanceof ImageBitmap&&this.videoState.currentFrame.close(),this.videoState.currentFrame=t.imageBitmap,this.videoState.frameWidth=t.imageBitmap.width,this.videoState.frameHeight=t.imageBitmap.height,this.videoState.isConnected=true):((!this.offscreenCanvas||!this.ctx)&&(this.debugLog("[Compositor] Initializing canvas for direct frames"),this.offscreenCanvas=new OffscreenCanvas(t.imageBitmap.width,t.imageBitmap.height),this.ctx=this.offscreenCanvas.getContext("2d",{willReadFrequently:true})),(this.offscreenCanvas.width!==t.imageBitmap.width||this.offscreenCanvas.height!==t.imageBitmap.height)&&(this.offscreenCanvas.width=t.imageBitmap.width,this.offscreenCanvas.height=t.imageBitmap.height),this.ctx.drawImage(t.imageBitmap,0,0),this.videoState.currentFrame=this.offscreenCanvas,this.videoState.frameWidth=t.imageBitmap.width,this.videoState.frameHeight=t.imageBitmap.height,this.videoState.isConnected=true,this.frameDataDirty=true,this.processCurrentFrame(t.timestamp),t.imageBitmap.close())}}const ah=0,oh=100,ch=200,uh=1,Ja=100;function Ps(e){return e===ah?"main":e<oh?"additional":e<ch?"device":"directFrame"}const eo=["faceDetection","faceMesh","emotion","handTracking","poseDetection","segmentation"];function Pe(){return{trueCount:0,falseCount:0}}function nn(){return{audio:Pe(),video:Pe(),mouse:Pe(),keyboard:Pe(),pointer:Pe(),touch:Pe(),sensors:Pe(),devices:Pe(),cv:{faceDetection:{active:Pe(),meaningful:Pe()},faceMesh:{active:Pe(),meaningful:Pe()},emotion:{active:Pe(),meaningful:Pe()},handTracking:{active:Pe(),meaningful:Pe()},poseDetection:{active:Pe(),meaningful:Pe()},segmentation:{active:Pe(),meaningful:Pe()}}}}class lh{enabled=false;usageMask={mouse:{position:false,left:false,right:false,middle:false},pointer:{position:false,down:false},touch:false};frames=[];counts=nn();prev=null;onTransition=null;setEnabled(t){this.enabled=t,t||(this.frames=[],this.counts=nn(),this.prev=null)}isEnabled(){return this.enabled}setUsageMask(t){this.usageMask=t}setTransitionCallback(t){this.onTransition=t}evaluate(t){const s=this.usageMask,i=s.mouse.position&&t.mouse.isInCanvas||s.mouse.left&&t.mouse.leftButton||s.mouse.right&&t.mouse.rightButton||s.mouse.middle&&t.mouse.middleButton,n=s.pointer.position&&t.pointer.isInCanvas&&t.pointer.active||s.pointer.down&&t.pointer.isDown,a=s.touch&&t.touchCount>0;return{audio:t.audioConnected,video:t.videoConnected,mouse:i,keyboard:t.keyboardConsumed,pointer:n,touch:a,sensors:t.sensorsConnected,devices:t.devicesConnected,cv:t.cv}}recordFrame(t){const s=this.evaluate(t);this.frames.push({frameIndex:t.frameIndex,timestamp:t.timestamp,cpuMs:t.cpuMs,gpuMs:null,frameIntervalMs:t.frameIntervalMs,capabilities:s}),this.tally(s),this.emitEdges(s,t.frameIndex,t.timestamp),this.prev=s}flush(){if(this.frames.length===0)return null;const t=this.frames,s=this.counts;return this.frames=[],this.counts=nn(),{frames:t,timing:{cpuMs:to(t,i=>i.cpuMs),frameIntervalMs:to(t,i=>i.frameIntervalMs)},capabilities:s}}tally(t){const s=this.counts;yt(s.audio,t.audio),yt(s.video,t.video),yt(s.mouse,t.mouse),yt(s.keyboard,t.keyboard),yt(s.pointer,t.pointer),yt(s.touch,t.touch),yt(s.sensors,t.sensors),yt(s.devices,t.devices);for(const i of eo)yt(s.cv[i].active,t.cv[i].active),yt(s.cv[i].meaningful,t.cv[i].meaningful)}emitEdges(t,s,i){if(!this.onTransition)return;const n=this.prev,a=[["audio",t.audio,n?n.audio:false],["video",t.video,n?n.video:false],["mouse",t.mouse,n?n.mouse:false],["keyboard",t.keyboard,n?n.keyboard:false],["pointer",t.pointer,n?n.pointer:false],["touch",t.touch,n?n.touch:false],["sensors",t.sensors,n?n.sensors:false],["devices",t.devices,n?n.devices:false]];for(const[o,u,l]of a)u!==l&&this.onTransition({capability:o,active:u,frameIndex:s,timestamp:i});for(const o of eo){const u=t.cv[o].active,l=n?n.cv[o].active:false;u!==l&&this.onTransition({capability:"cv",cvType:o,level:"active",active:u,frameIndex:s,timestamp:i});const h=t.cv[o].meaningful,d=n?n.cv[o].meaningful:false;h!==d&&this.onTransition({capability:"cv",cvType:o,level:"meaningful",active:h,frameIndex:s,timestamp:i})}}}function yt(e,t){t?e.trueCount++:e.falseCount++}function to(e,t){let s=1/0,i=-1/0,n=0;for(const a of e){const o=t(a);o<s&&(s=o),o>i&&(i=o),n+=o}return{min:s,avg:n/e.length,max:i}}class hh{constructor(t,s,i){this.offscreenCanvas=t,this.setupFn=i.setup||null,this.renderFn=i.render,this.p5CanvasMode=i.canvasMode==="webgl"?"webgl":"2d",this.installMinimalShims()}p5Instance=null;setupFn=null;renderFn=null;p5InternalSetupComplete=false;artistSetupComplete=false;p5Class=null;imageParameterCache=new Map;mainCanvasCreated=false;p5CanvasMode;async init(){try{const t=await import("https://esm.sh/p5@1.9.4");this.p5Class=t.default||t,await new Promise(i=>{new this.p5Class(n=>{this.p5Instance=n,n.setup=()=>{this.p5CanvasMode==="webgl"?n.createCanvas(this.offscreenCanvas.width,this.offscreenCanvas.height,n.WEBGL):n.createCanvas(this.offscreenCanvas.width,this.offscreenCanvas.height),n.noLoop(),this.p5InternalSetupComplete=true,i()},n.draw=()=>{},setTimeout(()=>{if(n.setup&&typeof n.setup=="function")try{n.setup()}catch(a){console.error("P5 setup failed:",a),i()}},0)})})}catch(t){throw console.error("Failed to initialize P5.js:",t),t}}installMinimalShims(){const t=globalThis;if(typeof t.document>"u"){const s=()=>new Proxy({},{get:()=>"",set:()=>true}),i={style:s(),appendChild:()=>{},removeChild:()=>{},children:[],childNodes:[],firstChild:null,lastChild:null,parentNode:null,ownerDocument:void 0,setAttribute:()=>{},getAttribute:()=>null,addEventListener:()=>{},removeEventListener:()=>{},tagName:"BODY"};t.document={createElement:n=>{if(n==="canvas"){let a;return this.mainCanvasCreated?a=new OffscreenCanvas(300,300):(a=this.offscreenCanvas,this.mainCanvasCreated=true),a.style=s(),a.dataset=new Proxy({},{get:()=>{},set:()=>true}),a.classList={add:()=>{},remove:()=>{},contains:()=>false,toggle:()=>false},a.getBoundingClientRect=()=>({left:0,top:0,width:a.width,height:a.height}),a}return{style:s(),appendChild:()=>{},removeChild:()=>{},setAttribute:()=>{},getAttribute:()=>null,tagName:n.toUpperCase(),addEventListener:()=>{},removeEventListener:()=>{}}},createElementNS:(n,a)=>t.document.createElement(a),body:i,documentElement:{style:s(),children:[],childNodes:[]},getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],getElementsByTagName:n=>n.toLowerCase()==="main"?[i]:[],addEventListener:()=>{},removeEventListener:()=>{},hasFocus:()=>true},i.ownerDocument=t.document}typeof t.window>"u"&&(t.window={devicePixelRatio:1,innerWidth:this.offscreenCanvas.width,innerHeight:this.offscreenCanvas.height,addEventListener:()=>{},removeEventListener:()=>{},requestAnimationFrame:s=>0,cancelAnimationFrame:()=>{},setTimeout:t.setTimeout.bind(t),clearTimeout:t.clearTimeout.bind(t),setInterval:t.setInterval.bind(t),clearInterval:t.clearInterval.bind(t),performance:t.performance,console:t.console,Math:t.Math,Date:t.Date,Array:t.Array,Object:t.Object}),typeof t.navigator>"u"&&(t.navigator={userAgent:"Viji-Worker-P5",platform:"Worker",language:"en-US"}),typeof t.screen>"u"&&(t.screen={width:this.offscreenCanvas.width,height:this.offscreenCanvas.height,availWidth:this.offscreenCanvas.width,availHeight:this.offscreenCanvas.height,colorDepth:24,pixelDepth:24}),typeof t.HTMLCanvasElement>"u"&&(t.HTMLCanvasElement=function(){},Object.setPrototypeOf(OffscreenCanvas.prototype,t.HTMLCanvasElement.prototype))}getOrCreateP5Image(t,s){if(!this.p5Instance)return null;const i=this.imageParameterCache.get(t);if(i&&i.source===s)return i.p5Image;try{const n=new OffscreenCanvas(s.width,s.height),a=n.getContext("2d");if(!a)throw new Error("Failed to get 2d context from OffscreenCanvas");a.drawImage(s,0,0);const o={canvas:n,elt:n,width:s.width,height:s.height};return this.imageParameterCache.set(t,{source:s,p5Image:o}),o}catch(n){return console.warn("Failed to convert image to P5-compatible object:",n),null}}wrapVideoFramesForP5(t){if(t.video?.currentFrame instanceof OffscreenCanvas){const s=t.video.currentFrame;t.video.currentFrame={canvas:s,elt:s,width:s.width,height:s.height}}else if(t.video?.currentFrame instanceof ImageBitmap){const s=t.video.currentFrame;t.video.currentFrame={elt:s,width:s.width,height:s.height}}if(t.video?.cv?.analysedFrame instanceof OffscreenCanvas){const s=t.video.cv.analysedFrame;t.video.cv.analysedFrame={canvas:s,elt:s,width:s.width,height:s.height}}if(Array.isArray(t.videoStreams)){for(const s of t.videoStreams)if(s?.currentFrame instanceof OffscreenCanvas){const i=s.currentFrame;s.currentFrame={canvas:i,elt:i,width:i.width,height:i.height}}else if(s?.currentFrame instanceof ImageBitmap){const i=s.currentFrame;s.currentFrame={elt:i,width:i.width,height:i.height}}}}addP5PropertyToImageParameters(t){if(!this.p5Instance)return;const s=i=>i instanceof ImageBitmap||i&&typeof i=="object"&&"width"in i&&"height"in i;for(const[i,n]of t)try{if(n&&typeof n=="object"&&"value"in n){const a=n.value;a&&s(a)&&!("p5"in n)&&Object.defineProperty(n,"p5",{get:()=>this.getOrCreateP5Image(i,n.value),enumerable:true,configurable:true})}}catch(a){console.warn(`Failed to add .p5 property to parameter '${i}':`,a);continue}}tick(t,s){if(!this.p5Instance||!this.p5InternalSetupComplete)return false;try{return this.addP5PropertyToImageParameters(s),this.wrapVideoFramesForP5(t),!this.artistSetupComplete&&this.setupFn&&(this.setupFn(t,this.p5Instance),this.artistSetupComplete=true),this.p5Instance._setProperty&&this.p5Instance._setProperty("frameCount",this.p5Instance.frameCount+1),this.renderFn?(this.renderFn(t,this.p5Instance),true):false}catch(i){throw console.error("P5 render error:",i),i}}resize(t,s){if(this.p5Instance){if(this.p5Instance._setProperty("width",t),this.p5Instance._setProperty("height",s),this.p5Instance._setProperty("_width",t),this.p5Instance._setProperty("_height",s),this.p5Instance._renderer&&(this.p5Instance._renderer.width=t,this.p5Instance._renderer.height=s),typeof this.p5Instance.resizeCanvas=="function")try{this.p5Instance.resizeCanvas(t,s,true)}catch(i){console.warn("P5 resize warning:",i)}this.p5Instance._renderer&&(this.p5Instance._renderer._cachedFillStyle=void 0,this.p5Instance._renderer._cachedStrokeStyle=void 0)}}destroy(){if(this.p5Instance){try{typeof this.p5Instance.remove=="function"&&this.p5Instance.remove()}catch(t){console.warn("P5 cleanup warning:",t)}this.p5Instance=null}this.setupFn=null,this.renderFn=null,this.p5InternalSetupComplete=false,this.artistSetupComplete=false}}const An=["faceDetection","faceMesh","emotionDetection","handTracking","poseDetection","bodySegmentation"];class so{static parseParameters(t){const s=[],i=t.split(`
10
- `);for(const n of i){const a=n.trim(),o=a.match(/\/\/\s*@viji-(\w+):(\w+)\s+(.+)/);if(o){const[,l,h,d]=o;try{const m=this.parseKeyValuePairs(d),_={type:l,uniformName:h,label:m.label||h,default:m.default,config:m};this.validateParameter(_),s.push(_)}catch(m){console.warn(`Failed to parse shader parameter: ${n}`,m)}continue}const u=a.match(/^\/\/\s*@viji-cv:(\w+)\s*$/);if(u){const[,l]=u;try{const h={type:"cv",uniformName:l,label:l,default:void 0,config:{}};this.validateParameter(h),s.push(h)}catch(h){console.warn(`Failed to parse shader parameter: ${n}`,h)}}}return this.crossValidateAccumulators(s),s}static parseKeyValuePairs(t){const s={},i=/(\w+):((?:"[^"]*"|\[[^\]]*\]|#[0-9a-fA-F]{6}|#[0-9a-fA-F]{3}|(?:rgb|hsl|hsb|vec3)\s*\([^)]*\)|[^\s]+))/g;let n;for(;(n=i.exec(t))!==null;){const[,a,o]=n;s[a]=this.parseValue(o)}return s}static parseValue(t){if(t.startsWith('"')&&t.endsWith('"'))return t.slice(1,-1);if(t.startsWith("[")&&t.endsWith("]"))try{return JSON.parse(t)}catch{return t.slice(1,-1).split(",").map(n=>n.trim()).map(n=>{if(n.startsWith('"')&&n.endsWith('"'))return n.slice(1,-1);const a=parseFloat(n);return isNaN(a)?n:a})}if(t.startsWith("#")||/^(?:rgb|hsl|hsb|vec3)\s*\(/i.test(t))return t;if(t==="true")return true;if(t==="false")return false;const s=parseFloat(t);return isNaN(s)?t:s}static validateParameter(t){if(!t.type)throw new Error("Parameter type is required");if(!t.uniformName)throw new Error("Parameter uniformName is required");switch(t.type){case"slider":case"number":if(t.config.default===void 0)throw new Error(`Parameter ${t.uniformName} of type ${t.type} missing required 'default' key`);break;case"color":if(t.config.default===void 0)throw new Error(`Parameter ${t.uniformName} of type 'color' missing required 'default' key`);try{t.config.default=vn(t.config.default)}catch(s){throw new Error(`Parameter ${t.uniformName} of type 'color' has invalid default: ${s.message}`)}break;case"toggle":if(t.config.default===void 0)throw new Error(`Parameter ${t.uniformName} of type 'toggle' missing required 'default' key`);if(typeof t.config.default!="boolean")throw new Error(`Parameter ${t.uniformName} of type 'toggle' default must be boolean (true or false)`);break;case"select":if(t.config.default===void 0)throw new Error(`Parameter ${t.uniformName} of type 'select' missing required 'default' key`);if(!t.config.options||!Array.isArray(t.config.options))throw new Error(`Parameter ${t.uniformName} of type 'select' missing required 'options' key (array)`);break;case"image":break;case"button":t.config.default!==void 0&&console.warn(`Parameter ${t.uniformName} of type 'button' ignores 'default' — buttons always start as false`);break;case"coordinate":if(t.config.default===void 0)throw new Error(`Parameter ${t.uniformName} of type 'coordinate' missing required 'default' key (e.g., default:[0,0])`);if(!Array.isArray(t.config.default)||t.config.default.length!==2||typeof t.config.default[0]!="number"||typeof t.config.default[1]!="number")throw new Error(`Parameter ${t.uniformName} of type 'coordinate' default must be an array of 2 numbers (e.g., [0,0])`);break;case"accumulator":if(t.config.rate===void 0)throw new Error(`Accumulator '${t.uniformName}' requires a 'rate' config key (parameter name or numeric constant)`);if(typeof t.config.rate!="string"&&typeof t.config.rate!="number")throw new Error(`Accumulator '${t.uniformName}' rate must be a parameter name or numeric constant`);break;case"cv":{if(!An.includes(t.uniformName))throw new Error(`Unknown CV feature '${t.uniformName}'. Expected one of: ${An.join(", ")}`);if(Object.keys(t.config).length>0){if(t.config.default===void 0)throw new Error(`Toggleable CV directive '${t.uniformName}' missing required 'default' key`);if(typeof t.config.default!="boolean")throw new Error(`Toggleable CV directive '${t.uniformName}' default must be boolean (true or false)`)}break}default:console.warn(`Unknown parameter type: ${t.type}`)}t.uniformName.startsWith("u_")&&console.warn(`Parameter name "${t.uniformName}" uses reserved prefix "u_". Consider renaming to avoid conflicts with built-in uniforms.`)}static generateUniformDeclaration(t){switch(t.type){case"slider":case"number":return`uniform float ${t.uniformName};`;case"color":return`uniform vec3 ${t.uniformName};`;case"toggle":return`uniform bool ${t.uniformName};`;case"select":return`uniform int ${t.uniformName};`;case"image":return`uniform sampler2D ${t.uniformName};`;case"button":return`uniform bool ${t.uniformName};`;case"coordinate":return`uniform vec2 ${t.uniformName};`;case"accumulator":return`uniform float ${t.uniformName}; // accumulator (rate: ${t.config.rate})`;case"cv":return Object.keys(t.config).length>0?`uniform bool ${t.uniformName};`:`// @viji-cv:${t.uniformName} (bare — no uniform)`;default:return`// Unknown parameter type: ${t.type}`}}static crossValidateAccumulators(t){const s=new Set(t.filter(i=>i.type!=="accumulator").map(i=>i.uniformName));for(const i of t){if(i.type!=="accumulator")continue;const n=i.config.rate;if(typeof n=="string"&&!s.has(n))if(n.startsWith("u_"))i.config._rateIsBuiltIn=true;else{const a=[...s].join(", ");console.warn(`Accumulator '${i.uniformName}' references parameter '${n}' which does not exist.`+(a?` Available parameters: ${a}`:" No parameters declared.")),i.config._rateInvalid=true}}}}function fh(e){const t=e.match(/^\s*ERROR:\s*0:(\d+)/m);if(!t)return null;const s=parseInt(t[1],10);return Number.isFinite(s)&&s>0?s:null}class ze{constructor(t,s,i,n=false){if(this.shaderCode=i,this.redactDriverInfoLogs=n,this.glslVersion=this.detectGLSLVersion(i),this.backbufferEnabled=i.includes("backbuffer"),this.glslVersion==="glsl300"){const a=t.getContext("webgl2");if(!a)throw new Error("WebGL 2 not supported. Use GLSL ES 1.00 syntax instead.");this.gl=a}else{const a=t.getContext("webgl");if(!a)throw new Error("WebGL not supported");this.gl=a}}static MAX_VIDEO_STREAMS=8;static MAX_EXTERNAL_DEVICES=8;static MAX_DEVICE_VIDEOS=8;static MAX_AUDIO_STREAMS=8;gl;program=null;uniformLocations=new Map;textureUnits=new Map;nextTextureUnit=0;textures=new Map;quadBuffer=null;parameters=[];glslVersion="glsl100";audioFFTTexture=null;audioWaveformTexture=null;videoTexture=null;analysedFrameTexture=null;analysedFrameFallbackTexture=null;segmentationTexture=null;keyboardTexture=null;videoStreamTextures=[];deviceTextures=new Array(ze.MAX_DEVICE_VIDEOS).fill(null);accumulatorValues=new Map;accumulatorWarned=new Set;scalarUniformCache=new Map;colorVec3Cache=new Map;colorVec3CacheKey=new Map;backbufferFramebuffer=null;backbufferTexture=null;currentFramebuffer=null;currentTexture=null;backbufferEnabled=false;cvDirectives=new Map;visibleFeatures=new Set;destroyed=false;async init(){try{this.parameters=so.parseParameters(this.shaderCode);for(const i of this.parameters)i.type==="accumulator"&&this.accumulatorValues.set(i.uniformName,i.config.default??0);for(const i of this.parameters){if(i.type!=="cv")continue;const n=i.uniformName,a=Object.keys(i.config).length>0,o={toggleable:a,inFlight:false};a&&(o.paramName=n),this.cvDirectives.set(n,o),(a?!!i.config.default:true)&&this.visibleFeatures.add(n)}this.createFullscreenQuad();const{code:t,artistLineOffset:s}=this.injectUniformsWithOffset(this.shaderCode);this.compileAndLinkShader(t,s),this.cacheUniformLocations(),this.reserveTextureUnits(),this.backbufferEnabled&&this.createBackbufferFramebuffers()}catch(t){throw console.error("Failed to initialize ShaderWorkerAdapter:",t),t}}detectGLSLVersion(t){return t.includes("#version 300")?"glsl300":"glsl100"}createFullscreenQuad(){const t=new Float32Array([-1,-1,1,-1,-1,1,1,1]);this.quadBuffer=this.gl.createBuffer(),this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.quadBuffer),this.gl.bufferData(this.gl.ARRAY_BUFFER,t,this.gl.STATIC_DRAW)}injectUniformsWithOffset(t){const s=this.injectUniforms(t),n=s.indexOf("// ===== ARTIST CODE =====");if(n===-1)return{code:s,artistLineOffset:0};const o=(s.slice(0,n).match(/\n/g)||[]).length;return{code:s,artistLineOffset:o+1}}injectUniforms(t){let s="",i=t;const n=t.split(`
11
- `);for(let k=0;k<n.length;k++){const T=n[k].trim();if(T.startsWith("#version")){s=T,n[k]="",i=n.join(`
12
- `);break}}const a=this.findInjectionPoint(i),o=this.getBuiltInUniforms(),u=this.parameters.map(k=>so.generateUniformDeclaration(k)).join(`
13
- `),l=t.includes("fwidth");l&&this.glslVersion==="glsl100"&&(this.gl.getExtension("OES_standard_derivatives")||console.warn("Shader uses fwidth() but OES_standard_derivatives extension is not supported. Shader may not compile."));const h=[];l&&this.glslVersion==="glsl100"&&h.push("#extension GL_OES_standard_derivatives : enable"),this.glslVersion==="glsl100"?(h.push(""),h.push("#ifdef GL_ES"),h.push("precision mediump float;"),h.push("#endif")):(h.push(""),h.push("precision mediump float;")),h.push(""),h.push("// ===== VIJI AUTO-INJECTED UNIFORMS ====="),h.push("// Built-in uniforms (auto-provided)"),h.push(o),h.push(""),h.push("// Parameter uniforms (from @viji-* declarations)"),h.push(u),h.push(""),h.push("// ===== ARTIST CODE =====");const d=h.join(`
14
- `),m=i.slice(0,a)+`
15
- `+d+`
16
- `+i.slice(a),_=s?s+`
17
- `+m:m;return this.redactDriverInfoLogs||(console.log("=== INJECTED SHADER CODE (first 50 lines) ==="),console.log(_.split(`
18
- `).slice(0,50).join(`
19
- `)),console.log("=== END INJECTED CODE ===")),_}findInjectionPoint(t){const s=t.split(`
20
- `);for(let a=0;a<s.length;a++)if(s[a].trim().startsWith("#version"))return this.getLineEndPosition(t,a);let i=false,n=0;for(let a=0;a<s.length;a++){const o=s[a].trim();if(o.includes("/*")&&(i=true),o.includes("*/")){i=false,n=a+1;continue}if(!i){if(o===""||o.startsWith("//")){n=a+1;continue}break}}return n>0&&n<s.length?this.getLineEndPosition(t,n-1):0}getLineEndPosition(t,s){const i=t.split(`
21
- `);let n=0;for(let a=0;a<=s&&a<i.length;a++)n+=i[a].length+1;return n}getBuiltInUniforms(){return`// Core - Canvas & Timing
22
- uniform vec2 u_resolution; // Canvas width and height in pixels
23
- uniform float u_time; // Elapsed time in seconds since scene start
24
- uniform float u_deltaTime; // Time elapsed since last frame in seconds
25
- uniform int u_frame; // Current frame number
26
- uniform float u_fps; // Target frame rate (based on host frame-rate mode)
27
-
28
- // Mouse API
29
- uniform vec2 u_mouse; // Mouse position in pixels (WebGL coords: bottom-left origin)
30
- uniform bool u_mouseInCanvas; // True if mouse is inside canvas bounds
31
- uniform bool u_mousePressed; // True if any mouse button is pressed
32
- uniform bool u_mouseLeft; // True if left mouse button is pressed
33
- uniform bool u_mouseRight; // True if right mouse button is pressed
34
- uniform bool u_mouseMiddle; // True if middle mouse button is pressed
35
- uniform vec2 u_mouseDelta; // Mouse movement delta in pixels (per frame)
36
- uniform float u_mouseWheel; // Mouse wheel scroll delta (per frame)
37
- uniform bool u_mouseWasPressed; // True on the frame a mouse button was pressed
38
- uniform bool u_mouseWasReleased; // True on the frame a mouse button was released
39
-
40
- // Keyboard API - Common keys
41
- uniform bool u_keySpace; // True if spacebar is pressed
42
- uniform bool u_keyShift; // True if Shift key is pressed
43
- uniform bool u_keyCtrl; // True if Ctrl/Cmd key is pressed
44
- uniform bool u_keyAlt; // True if Alt/Option key is pressed
45
- uniform bool u_keyW; // True if W key is pressed
46
- uniform bool u_keyA; // True if A key is pressed
47
- uniform bool u_keyS; // True if S key is pressed
48
- uniform bool u_keyD; // True if D key is pressed
49
- uniform bool u_keyUp; // True if Up arrow key is pressed
50
- uniform bool u_keyDown; // True if Down arrow key is pressed
51
- uniform bool u_keyLeft; // True if Left arrow key is pressed
52
- uniform bool u_keyRight; // True if Right arrow key is pressed
53
-
54
- // Keyboard Texture (Shadertoy-compatible 256x3)
55
- // Row 0: held state, Row 1: pressed this frame, Row 2: toggle
56
- uniform sampler2D u_keyboard; // Keyboard state texture (256x3, LUMINANCE)
57
-
58
- // Touch API
59
- uniform int u_touchCount; // Number of active touch points (0-5)
60
- uniform vec2 u_touch0; // First touch point position in pixels
61
- uniform vec2 u_touch1; // Second touch point position in pixels
62
- uniform vec2 u_touch2; // Third touch point position in pixels
63
- uniform vec2 u_touch3; // Fourth touch point position in pixels
64
- uniform vec2 u_touch4; // Fifth touch point position in pixels
65
-
66
- // Pointer API (unified mouse/touch)
67
- uniform vec2 u_pointer; // Primary input position in pixels (WebGL coords)
68
- uniform vec2 u_pointerDelta; // Primary input movement delta (per frame)
69
- uniform bool u_pointerDown; // True if primary input is active (left-click or touch)
70
- uniform bool u_pointerWasPressed; // True on the frame primary input became active
71
- uniform bool u_pointerWasReleased; // True on the frame primary input was released
72
- uniform bool u_pointerInCanvas; // True if primary input is inside canvas bounds
73
-
74
- // Audio - Volume
75
- uniform float u_audioVolume; // RMS volume level (0-1)
76
- uniform float u_audioPeak; // Peak amplitude (0-1)
77
- uniform float u_audioVolumeSmoothed; // Smoothed volume for animation (200ms decay)
78
-
79
- // Audio - Frequency Bands (instant)
80
- uniform float u_audioLow; // Low 20-120 Hz (0-1)
81
- uniform float u_audioLowMid; // Low-mid 120-400 Hz (0-1)
82
- uniform float u_audioMid; // Mid 400-1600 Hz (0-1)
83
- uniform float u_audioHighMid; // High-mid 1600-6000 Hz (0-1)
84
- uniform float u_audioHigh; // High 6000-16000 Hz (0-1)
85
-
86
- // Audio - Frequency Bands (smoothed, 150ms decay)
87
- uniform float u_audioLowSmoothed; // Smoothed low band (0-1)
88
- uniform float u_audioLowMidSmoothed; // Smoothed low-mid band (0-1)
89
- uniform float u_audioMidSmoothed; // Smoothed mid band (0-1)
90
- uniform float u_audioHighMidSmoothed; // Smoothed high-mid band (0-1)
91
- uniform float u_audioHighSmoothed; // Smoothed high band (0-1)
92
-
93
- // Audio - Beat Energy (fast 300ms decay)
94
- uniform float u_audioKick; // Kick energy (0-1)
95
- uniform float u_audioSnare; // Snare energy (0-1)
96
- uniform float u_audioHat; // Hi-hat energy (0-1)
97
- uniform float u_audioAny; // Any beat energy (0-1)
98
-
99
- // Audio - Beat Energy (smoothed 500ms decay)
100
- uniform float u_audioKickSmoothed; // Smoothed kick energy (0-1)
101
- uniform float u_audioSnareSmoothed; // Smoothed snare energy (0-1)
102
- uniform float u_audioHatSmoothed; // Smoothed hi-hat energy (0-1)
103
- uniform float u_audioAnySmoothed; // Smoothed any-beat energy (0-1)
104
-
105
- // Audio - Beat Triggers (true for one frame on beat)
106
- uniform bool u_audioKickTrigger; // True on kick beat frame
107
- uniform bool u_audioSnareTrigger; // True on snare beat frame
108
- uniform bool u_audioHatTrigger; // True on hi-hat beat frame
109
- uniform bool u_audioAnyTrigger; // True on any beat frame
110
-
111
- // Audio - Tempo & Tracking
112
- uniform float u_audioBPM; // Current BPM (60-240)
113
- uniform float u_audioConfidence; // Beat tracking confidence (0-1)
114
- uniform bool u_audioIsLocked; // True when beat tracking is locked
115
-
116
- // Audio - Spectral Features
117
- uniform float u_audioBrightness; // Spectral brightness / centroid (0-1)
118
- uniform float u_audioFlatness; // Spectral flatness / noisiness (0-1)
119
-
120
- // Audio - Textures
121
- uniform sampler2D u_audioFFT; // FFT frequency spectrum (1024 bins, 0-255)
122
- uniform sampler2D u_audioWaveform; // Time-domain waveform (fftSize samples, -1 to 1)
123
-
124
- // Video
125
- uniform sampler2D u_video; // Current video frame as texture
126
- uniform vec2 u_videoResolution; // Video frame width and height in pixels
127
- uniform float u_videoFrameRate; // Video frame rate in frames per second
128
- uniform sampler2D u_videoAnalysed; // The exact frame MediaPipe analysed; pair with u_face*/u_hand*/u_pose* uniforms for pixel-precise CV-driven effects (face mesh masks, segmentation overlays). Shares u_videoResolution.
129
- uniform bool u_videoAnalysedAvailable; // True after the first CV result lands; before that, u_videoAnalysed samples a 1x1 black fallback. Use to gate effects that require valid analysed pixels.
130
-
131
- // Multi-Stream Compositor Support (using individual uniforms due to WebGL 1.0 limitations)
132
- uniform int u_videoStreamCount; // Number of available compositor input streams (0-8)
133
- uniform sampler2D u_videoStream0; // Video stream 0 texture
134
- uniform sampler2D u_videoStream1; // Video stream 1 texture
135
- uniform sampler2D u_videoStream2; // Video stream 2 texture
136
- uniform sampler2D u_videoStream3; // Video stream 3 texture
137
- uniform sampler2D u_videoStream4; // Video stream 4 texture
138
- uniform sampler2D u_videoStream5; // Video stream 5 texture
139
- uniform sampler2D u_videoStream6; // Video stream 6 texture
140
- uniform sampler2D u_videoStream7; // Video stream 7 texture
141
- uniform vec2 u_videoStream0Resolution; // Video stream 0 resolution
142
- uniform vec2 u_videoStream1Resolution; // Video stream 1 resolution
143
- uniform vec2 u_videoStream2Resolution; // Video stream 2 resolution
144
- uniform vec2 u_videoStream3Resolution; // Video stream 3 resolution
145
- uniform vec2 u_videoStream4Resolution; // Video stream 4 resolution
146
- uniform vec2 u_videoStream5Resolution; // Video stream 5 resolution
147
- uniform vec2 u_videoStream6Resolution; // Video stream 6 resolution
148
- uniform vec2 u_videoStream7Resolution; // Video stream 7 resolution
149
- uniform bool u_videoStream0Connected; // Video stream 0 connection status
150
- uniform bool u_videoStream1Connected; // Video stream 1 connection status
151
- uniform bool u_videoStream2Connected; // Video stream 2 connection status
152
- uniform bool u_videoStream3Connected; // Video stream 3 connection status
153
- uniform bool u_videoStream4Connected; // Video stream 4 connection status
154
- uniform bool u_videoStream5Connected; // Video stream 5 connection status
155
- uniform bool u_videoStream6Connected; // Video stream 6 connection status
156
- uniform bool u_videoStream7Connected; // Video stream 7 connection status
157
-
158
- // Device Video Support (device cameras)
159
- uniform int u_deviceCount; // Number of device videos (0-8)
160
- uniform sampler2D u_device0; // Device 0 camera texture
161
- uniform sampler2D u_device1; // Device 1 camera texture
162
- uniform sampler2D u_device2; // Device 2 camera texture
163
- uniform sampler2D u_device3; // Device 3 camera texture
164
- uniform sampler2D u_device4; // Device 4 camera texture
165
- uniform sampler2D u_device5; // Device 5 camera texture
166
- uniform sampler2D u_device6; // Device 6 camera texture
167
- uniform sampler2D u_device7; // Device 7 camera texture
168
- uniform vec2 u_device0Resolution; // Device 0 resolution
169
- uniform vec2 u_device1Resolution; // Device 1 resolution
170
- uniform vec2 u_device2Resolution; // Device 2 resolution
171
- uniform vec2 u_device3Resolution; // Device 3 resolution
172
- uniform vec2 u_device4Resolution; // Device 4 resolution
173
- uniform vec2 u_device5Resolution; // Device 5 resolution
174
- uniform vec2 u_device6Resolution; // Device 6 resolution
175
- uniform vec2 u_device7Resolution; // Device 7 resolution
176
- uniform bool u_device0Connected; // Device 0 connection status
177
- uniform bool u_device1Connected; // Device 1 connection status
178
- uniform bool u_device2Connected; // Device 2 connection status
179
- uniform bool u_device3Connected; // Device 3 connection status
180
- uniform bool u_device4Connected; // Device 4 connection status
181
- uniform bool u_device5Connected; // Device 5 connection status
182
- uniform bool u_device6Connected; // Device 6 connection status
183
- uniform bool u_device7Connected; // Device 7 connection status
184
-
185
- // Additional Audio Streams (lightweight analysis, no beat/FFT)
186
- uniform int u_audioStreamCount; // Number of additional audio streams (0-8)
187
- uniform bool u_audioStream0Connected; // Stream 0 connection status
188
- uniform float u_audioStream0Volume; // Stream 0 volume (0-1)
189
- uniform float u_audioStream0Low; // Stream 0 low band (0-1)
190
- uniform float u_audioStream0LowMid; // Stream 0 low-mid band (0-1)
191
- uniform float u_audioStream0Mid; // Stream 0 mid band (0-1)
192
- uniform float u_audioStream0HighMid; // Stream 0 high-mid band (0-1)
193
- uniform float u_audioStream0High; // Stream 0 high band (0-1)
194
- uniform float u_audioStream0Brightness; // Stream 0 spectral brightness (0-1)
195
- uniform float u_audioStream0Flatness; // Stream 0 spectral flatness (0-1)
196
- uniform bool u_audioStream1Connected;
197
- uniform float u_audioStream1Volume;
198
- uniform float u_audioStream1Low;
199
- uniform float u_audioStream1LowMid;
200
- uniform float u_audioStream1Mid;
201
- uniform float u_audioStream1HighMid;
202
- uniform float u_audioStream1High;
203
- uniform float u_audioStream1Brightness;
204
- uniform float u_audioStream1Flatness;
205
- uniform bool u_audioStream2Connected;
206
- uniform float u_audioStream2Volume;
207
- uniform float u_audioStream2Low;
208
- uniform float u_audioStream2LowMid;
209
- uniform float u_audioStream2Mid;
210
- uniform float u_audioStream2HighMid;
211
- uniform float u_audioStream2High;
212
- uniform float u_audioStream2Brightness;
213
- uniform float u_audioStream2Flatness;
214
- uniform bool u_audioStream3Connected;
215
- uniform float u_audioStream3Volume;
216
- uniform float u_audioStream3Low;
217
- uniform float u_audioStream3LowMid;
218
- uniform float u_audioStream3Mid;
219
- uniform float u_audioStream3HighMid;
220
- uniform float u_audioStream3High;
221
- uniform float u_audioStream3Brightness;
222
- uniform float u_audioStream3Flatness;
223
- uniform bool u_audioStream4Connected;
224
- uniform float u_audioStream4Volume;
225
- uniform float u_audioStream4Low;
226
- uniform float u_audioStream4LowMid;
227
- uniform float u_audioStream4Mid;
228
- uniform float u_audioStream4HighMid;
229
- uniform float u_audioStream4High;
230
- uniform float u_audioStream4Brightness;
231
- uniform float u_audioStream4Flatness;
232
- uniform bool u_audioStream5Connected;
233
- uniform float u_audioStream5Volume;
234
- uniform float u_audioStream5Low;
235
- uniform float u_audioStream5LowMid;
236
- uniform float u_audioStream5Mid;
237
- uniform float u_audioStream5HighMid;
238
- uniform float u_audioStream5High;
239
- uniform float u_audioStream5Brightness;
240
- uniform float u_audioStream5Flatness;
241
- uniform bool u_audioStream6Connected;
242
- uniform float u_audioStream6Volume;
243
- uniform float u_audioStream6Low;
244
- uniform float u_audioStream6LowMid;
245
- uniform float u_audioStream6Mid;
246
- uniform float u_audioStream6HighMid;
247
- uniform float u_audioStream6High;
248
- uniform float u_audioStream6Brightness;
249
- uniform float u_audioStream6Flatness;
250
- uniform bool u_audioStream7Connected;
251
- uniform float u_audioStream7Volume;
252
- uniform float u_audioStream7Low;
253
- uniform float u_audioStream7LowMid;
254
- uniform float u_audioStream7Mid;
255
- uniform float u_audioStream7HighMid;
256
- uniform float u_audioStream7High;
257
- uniform float u_audioStream7Brightness;
258
- uniform float u_audioStream7Flatness;
259
-
260
- // CV - Face Detection & Expressions
261
- uniform int u_faceCount; // Number of detected faces (0-1)
262
- uniform vec4 u_face0Bounds; // First face bounding box (x, y, width, height) normalized 0-1
263
- uniform vec2 u_face0Center; // First face bounding box center (x, y) normalized 0-1
264
- uniform vec3 u_face0HeadPose; // First face head rotation (pitch, yaw, roll) in degrees
265
- uniform float u_face0Confidence; // First face detection confidence (0-1)
266
- uniform float u_face0Neutral; // First face neutral expression (0-1)
267
- uniform float u_face0Happy; // First face happy expression (0-1)
268
- uniform float u_face0Sad; // First face sad expression (0-1)
269
- uniform float u_face0Angry; // First face angry expression (0-1)
270
- uniform float u_face0Surprised; // First face surprised expression (0-1)
271
- uniform float u_face0Disgusted; // First face disgusted expression (0-1)
272
- uniform float u_face0Fearful; // First face fearful expression (0-1)
273
-
274
- // CV - Face Blendshapes (52 ARKit-compatible coefficients, 0-1 each)
275
- // Brow
276
- uniform float u_face0BrowDownLeft;
277
- uniform float u_face0BrowDownRight;
278
- uniform float u_face0BrowInnerUp;
279
- uniform float u_face0BrowOuterUpLeft;
280
- uniform float u_face0BrowOuterUpRight;
281
- // Cheek
282
- uniform float u_face0CheekPuff;
283
- uniform float u_face0CheekSquintLeft;
284
- uniform float u_face0CheekSquintRight;
285
- // Eye
286
- uniform float u_face0EyeBlinkLeft;
287
- uniform float u_face0EyeBlinkRight;
288
- uniform float u_face0EyeLookDownLeft;
289
- uniform float u_face0EyeLookDownRight;
290
- uniform float u_face0EyeLookInLeft;
291
- uniform float u_face0EyeLookInRight;
292
- uniform float u_face0EyeLookOutLeft;
293
- uniform float u_face0EyeLookOutRight;
294
- uniform float u_face0EyeLookUpLeft;
295
- uniform float u_face0EyeLookUpRight;
296
- uniform float u_face0EyeSquintLeft;
297
- uniform float u_face0EyeSquintRight;
298
- uniform float u_face0EyeWideLeft;
299
- uniform float u_face0EyeWideRight;
300
- // Jaw
301
- uniform float u_face0JawForward;
302
- uniform float u_face0JawLeft;
303
- uniform float u_face0JawOpen;
304
- uniform float u_face0JawRight;
305
- // Mouth
306
- uniform float u_face0MouthClose;
307
- uniform float u_face0MouthDimpleLeft;
308
- uniform float u_face0MouthDimpleRight;
309
- uniform float u_face0MouthFrownLeft;
310
- uniform float u_face0MouthFrownRight;
311
- uniform float u_face0MouthFunnel;
312
- uniform float u_face0MouthLeft;
313
- uniform float u_face0MouthLowerDownLeft;
314
- uniform float u_face0MouthLowerDownRight;
315
- uniform float u_face0MouthPressLeft;
316
- uniform float u_face0MouthPressRight;
317
- uniform float u_face0MouthPucker;
318
- uniform float u_face0MouthRight;
319
- uniform float u_face0MouthRollLower;
320
- uniform float u_face0MouthRollUpper;
321
- uniform float u_face0MouthShrugLower;
322
- uniform float u_face0MouthShrugUpper;
323
- uniform float u_face0MouthSmileLeft;
324
- uniform float u_face0MouthSmileRight;
325
- uniform float u_face0MouthStretchLeft;
326
- uniform float u_face0MouthStretchRight;
327
- uniform float u_face0MouthUpperUpLeft;
328
- uniform float u_face0MouthUpperUpRight;
329
- // Nose & Tongue
330
- uniform float u_face0NoseSneerLeft;
331
- uniform float u_face0NoseSneerRight;
332
- uniform float u_face0TongueOut;
333
-
334
- // CV - Hand Tracking
335
- uniform int u_handCount; // Number of detected hands (0-2)
336
- uniform vec3 u_leftHandPalm; // Left hand palm position (x, y, z)
337
- uniform vec3 u_rightHandPalm; // Right hand palm position (x, y, z)
338
- uniform float u_leftHandConfidence; // Left hand detection confidence (0-1)
339
- uniform float u_rightHandConfidence; // Right hand detection confidence (0-1)
340
- uniform vec4 u_leftHandBounds; // Left hand bounding box (x, y, width, height) normalized 0-1
341
- uniform vec4 u_rightHandBounds; // Right hand bounding box (x, y, width, height) normalized 0-1
342
- uniform float u_leftHandFist; // Left hand fist gesture confidence (0-1)
343
- uniform float u_leftHandOpen; // Left hand open palm gesture confidence (0-1)
344
- uniform float u_leftHandPeace; // Left hand peace/victory gesture confidence (0-1)
345
- uniform float u_leftHandThumbsUp; // Left hand thumbs up gesture confidence (0-1)
346
- uniform float u_leftHandThumbsDown; // Left hand thumbs down gesture confidence (0-1)
347
- uniform float u_leftHandPointing; // Left hand pointing gesture confidence (0-1)
348
- uniform float u_leftHandILoveYou; // Left hand I-love-you gesture confidence (0-1)
349
- uniform float u_rightHandFist; // Right hand fist gesture confidence (0-1)
350
- uniform float u_rightHandOpen; // Right hand open palm gesture confidence (0-1)
351
- uniform float u_rightHandPeace; // Right hand peace/victory gesture confidence (0-1)
352
- uniform float u_rightHandThumbsUp; // Right hand thumbs up gesture confidence (0-1)
353
- uniform float u_rightHandThumbsDown; // Right hand thumbs down gesture confidence (0-1)
354
- uniform float u_rightHandPointing; // Right hand pointing gesture confidence (0-1)
355
- uniform float u_rightHandILoveYou; // Right hand I-love-you gesture confidence (0-1)
356
-
357
- // CV - Pose Detection
358
- uniform bool u_poseDetected; // True if a pose is currently detected
359
- uniform float u_poseConfidence; // Pose detection confidence (0-1)
360
- uniform vec2 u_nosePosition; // Nose landmark position (normalized 0-1)
361
- uniform vec2 u_leftShoulderPosition; // Left shoulder position (normalized 0-1)
362
- uniform vec2 u_rightShoulderPosition; // Right shoulder position (normalized 0-1)
363
- uniform vec2 u_leftElbowPosition; // Left elbow position (normalized 0-1)
364
- uniform vec2 u_rightElbowPosition; // Right elbow position (normalized 0-1)
365
- uniform vec2 u_leftWristPosition; // Left wrist position (normalized 0-1)
366
- uniform vec2 u_rightWristPosition; // Right wrist position (normalized 0-1)
367
- uniform vec2 u_leftHipPosition; // Left hip position (normalized 0-1)
368
- uniform vec2 u_rightHipPosition; // Right hip position (normalized 0-1)
369
- uniform vec2 u_leftKneePosition; // Left knee position (normalized 0-1)
370
- uniform vec2 u_rightKneePosition; // Right knee position (normalized 0-1)
371
- uniform vec2 u_leftAnklePosition; // Left ankle position (normalized 0-1)
372
- uniform vec2 u_rightAnklePosition; // Right ankle position (normalized 0-1)
373
-
374
- // CV - Segmentation
375
- uniform sampler2D u_segmentationMask; // Body segmentation mask texture (0=background, 1=person)
376
- uniform vec2 u_segmentationRes; // Segmentation mask resolution in pixels
377
-
378
- // Device Sensors - Internal Device (viji.device)
379
- uniform vec3 u_deviceAcceleration; // Acceleration without gravity (m/s²) - x, y, z
380
- uniform vec3 u_deviceAccelerationGravity; // Acceleration with gravity (m/s²) - x, y, z
381
- uniform vec3 u_deviceRotationRate; // Rotation rate (deg/s) - alpha, beta, gamma
382
- uniform vec3 u_deviceOrientation; // Device orientation (degrees) - alpha, beta, gamma
383
- uniform bool u_deviceOrientationAbsolute; // True if orientation uses magnetometer (compass)
384
-
385
- // Device Sensors - External Devices (viji.devices[0-7])
386
- uniform int u_externalDeviceCount; // Number of connected external devices (0-8)
387
- uniform vec3 u_device0Acceleration; // Device 0 acceleration without gravity (m/s²)
388
- uniform vec3 u_device0AccelerationGravity; // Device 0 acceleration with gravity (m/s²)
389
- uniform vec3 u_device0RotationRate; // Device 0 rotation rate (deg/s)
390
- uniform vec3 u_device0Orientation; // Device 0 orientation (degrees) - alpha, beta, gamma
391
- uniform vec3 u_device1Acceleration; // Device 1 acceleration without gravity (m/s²)
392
- uniform vec3 u_device1AccelerationGravity; // Device 1 acceleration with gravity (m/s²)
393
- uniform vec3 u_device1RotationRate; // Device 1 rotation rate (deg/s)
394
- uniform vec3 u_device1Orientation; // Device 1 orientation (degrees) - alpha, beta, gamma
395
- uniform vec3 u_device2Acceleration; // Device 2 acceleration without gravity (m/s²)
396
- uniform vec3 u_device2AccelerationGravity; // Device 2 acceleration with gravity (m/s²)
397
- uniform vec3 u_device2RotationRate; // Device 2 rotation rate (deg/s)
398
- uniform vec3 u_device2Orientation; // Device 2 orientation (degrees) - alpha, beta, gamma
399
- uniform vec3 u_device3Acceleration; // Device 3 acceleration without gravity (m/s²)
400
- uniform vec3 u_device3AccelerationGravity; // Device 3 acceleration with gravity (m/s²)
401
- uniform vec3 u_device3RotationRate; // Device 3 rotation rate (deg/s)
402
- uniform vec3 u_device3Orientation; // Device 3 orientation (degrees) - alpha, beta, gamma
403
- uniform vec3 u_device4Acceleration; // Device 4 acceleration without gravity (m/s²)
404
- uniform vec3 u_device4AccelerationGravity; // Device 4 acceleration with gravity (m/s²)
405
- uniform vec3 u_device4RotationRate; // Device 4 rotation rate (deg/s)
406
- uniform vec3 u_device4Orientation; // Device 4 orientation (degrees) - alpha, beta, gamma
407
- uniform vec3 u_device5Acceleration; // Device 5 acceleration without gravity (m/s²)
408
- uniform vec3 u_device5AccelerationGravity; // Device 5 acceleration with gravity (m/s²)
409
- uniform vec3 u_device5RotationRate; // Device 5 rotation rate (deg/s)
410
- uniform vec3 u_device5Orientation; // Device 5 orientation (degrees) - alpha, beta, gamma
411
- uniform vec3 u_device6Acceleration; // Device 6 acceleration without gravity (m/s²)
412
- uniform vec3 u_device6AccelerationGravity; // Device 6 acceleration with gravity (m/s²)
413
- uniform vec3 u_device6RotationRate; // Device 6 rotation rate (deg/s)
414
- uniform vec3 u_device6Orientation; // Device 6 orientation (degrees) - alpha, beta, gamma
415
- uniform vec3 u_device7Acceleration; // Device 7 acceleration without gravity (m/s²)
416
- uniform vec3 u_device7AccelerationGravity; // Device 7 acceleration with gravity (m/s²)
417
- uniform vec3 u_device7RotationRate; // Device 7 rotation rate (deg/s)
418
- uniform vec3 u_device7Orientation; // Device 7 orientation (degrees) - alpha, beta, gamma
419
-
420
- // Backbuffer (previous frame feedback)
421
- ${this.backbufferEnabled?"uniform sampler2D backbuffer; // Previous frame texture for feedback effects":"// backbuffer not enabled"}
422
- `}compileAndLinkShader(t,s=0){const i=this.gl,n=this.glslVersion==="glsl300"?`#version 300 es
423
- precision mediump float;
424
- in vec2 a_position;
425
- void main() {
426
- gl_Position = vec4(a_position, 0.0, 1.0);
427
- }`:`attribute vec2 a_position;
428
- void main() {
429
- gl_Position = vec4(a_position, 0.0, 1.0);
430
- }`,a=this.compileShader(i.VERTEX_SHADER,n,0),o=this.compileShader(i.FRAGMENT_SHADER,t,s),u=i.createProgram();if(!u)throw new Error("Failed to create WebGL program");if(i.attachShader(u,a),i.attachShader(u,o),i.linkProgram(u),!i.getProgramParameter(u,i.LINK_STATUS)){const l=this.redactDriverInfoLogs?"(diagnostics unavailable)":i.getProgramInfoLog(u);throw new Error(`Shader program link failed: ${l}`)}this.program=u,i.useProgram(u),i.deleteShader(a),i.deleteShader(o)}compileShader(t,s,i=0){const n=this.gl,a=n.createShader(t);if(!a)throw new Error("Failed to create shader");if(n.shaderSource(a,s),n.compileShader(a),!n.getShaderParameter(a,n.COMPILE_STATUS)){const o=n.getShaderInfoLog(a),u=t===n.VERTEX_SHADER?"vertex":"fragment",l=this.redactDriverInfoLogs?"(diagnostics unavailable)":o,h=new Error(`${u} shader compilation failed:
431
- ${l}`);if(t===n.FRAGMENT_SHADER){h.__isShaderCompileError=true;const d=fh(o||"");if(d!==null){const m=d-i;m>=1&&(h.__sourceLocation={line:m})}}throw h}return a}cacheUniformLocations(){if(!this.program)return;const t=this.gl,s=t.getProgramParameter(this.program,t.ACTIVE_UNIFORMS),i=[];for(let n=0;n<s;n++){const a=t.getActiveUniform(this.program,n);if(a){const o=t.getUniformLocation(this.program,a.name);this.uniformLocations.set(a.name,o),(a.name.includes("Stream")||a.name.includes("stream"))&&i.push(a.name)}}i.length>0?console.log("[ShaderAdapter] Stream-related uniforms found:",i):console.log("[ShaderAdapter] NO stream-related uniforms found in shader!")}reserveTextureUnits(){this.textureUnits.set("u_audioFFT",this.nextTextureUnit++),this.textureUnits.set("u_audioWaveform",this.nextTextureUnit++),this.textureUnits.set("u_video",this.nextTextureUnit++),this.textureUnits.set("u_videoAnalysed",this.nextTextureUnit++),this.textureUnits.set("u_segmentationMask",this.nextTextureUnit++),this.textureUnits.set("u_keyboard",this.nextTextureUnit++);for(let t=0;t<ze.MAX_VIDEO_STREAMS;t++)this.textureUnits.set(`u_videoStream${t}`,this.nextTextureUnit++);for(let t=0;t<ze.MAX_DEVICE_VIDEOS;t++)this.textureUnits.set(`u_device${t}`,this.nextTextureUnit++);this.backbufferEnabled&&this.textureUnits.set("backbuffer",this.nextTextureUnit++)}createBackbufferFramebuffers(){const t=this.gl,s=t.canvas.width,i=t.canvas.height,n=()=>{const u=t.createTexture();t.bindTexture(t.TEXTURE_2D,u),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,s,i,0,t.RGBA,t.UNSIGNED_BYTE,null),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE);const l=t.createFramebuffer();return t.bindFramebuffer(t.FRAMEBUFFER,l),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,u,0),{framebuffer:l,texture:u}},a=n(),o=n();this.backbufferFramebuffer=a.framebuffer,this.backbufferTexture=a.texture,this.currentFramebuffer=o.framebuffer,this.currentTexture=o.texture,t.bindFramebuffer(t.FRAMEBUFFER,null),t.bindTexture(t.TEXTURE_2D,null)}render(t,s){const i=this.gl;if(!this.program||!this.quadBuffer)return console.warn("Shader not initialized"),false;if(i.useProgram(this.program),this.syncCvVisibility(t,s),this.updateBuiltInUniforms(t),this.updateAccumulators(t,s),this.updateParameterUniforms(s),this.backbufferEnabled&&this.backbufferTexture){const a=this.textureUnits.get("backbuffer");a!==void 0&&(i.activeTexture(i.TEXTURE0+a),i.bindTexture(i.TEXTURE_2D,this.backbufferTexture),this.setUniform("backbuffer","sampler2D",a)),i.bindFramebuffer(i.FRAMEBUFFER,this.currentFramebuffer)}const n=i.getAttribLocation(this.program,"a_position");if(i.bindBuffer(i.ARRAY_BUFFER,this.quadBuffer),i.enableVertexAttribArray(n),i.vertexAttribPointer(n,2,i.FLOAT,false,0,0),i.drawArrays(i.TRIANGLE_STRIP,0,4),this.backbufferEnabled){i.bindFramebuffer(i.FRAMEBUFFER,null),i.activeTexture(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,this.currentTexture),i.drawArrays(i.TRIANGLE_STRIP,0,4);const a=this.backbufferFramebuffer,o=this.backbufferTexture;this.backbufferFramebuffer=this.currentFramebuffer,this.backbufferTexture=this.currentTexture,this.currentFramebuffer=a,this.currentTexture=o}return true}syncCvVisibility(t,s){if(!t.video?.isConnected)return;const i=t.video.cv,n=typeof i.getActiveFeatures=="function"?i.getActiveFeatures():[];for(const[a,o]of this.cvDirectives){let u;if(o.toggleable&&o.paramName){const h=s.get(o.paramName);if(!h)continue;u=h.value===true}else u=true;u?this.visibleFeatures.add(a):this.visibleFeatures.delete(a);const l=n.includes(a);if(u===l){o.lastValue=u;continue}if(o.inFlight){o.pendingValue=u;continue}this.dispatchCvEnable(i,a,u,o)}for(const a of An)this.cvDirectives.has(a)||(n.includes(a)?this.visibleFeatures.add(a):this.visibleFeatures.delete(a))}dispatchCvEnable(t,s,i,n){const a=`enable${s.charAt(0).toUpperCase()}${s.slice(1)}`,o=t[a];typeof o=="function"&&(n.inFlight=true,n.lastValue=i,Promise.resolve(o.call(t,i)).catch(u=>{console.warn(`[ShaderAdapter] ${a}(${i}) failed:`,u)}).finally(()=>{this.destroyed||(n.inFlight=false,delete n.pendingValue)}))}updateBuiltInUniforms(t){this.setUniform("u_resolution","vec2",[t.width,t.height]),this.setUniform("u_time","float",t.time),this.setUniform("u_deltaTime","float",t.deltaTime),this.setUniform("u_frame","int",t.frameCount),this.setUniform("u_fps","float",t.fps),this.setUniform("u_mouse","vec2",[t.mouse.x,t.height-t.mouse.y]),this.setUniform("u_mouseInCanvas","bool",t.mouse.isInCanvas),this.setUniform("u_mousePressed","bool",t.mouse.isPressed),this.setUniform("u_mouseLeft","bool",t.mouse.leftButton),this.setUniform("u_mouseRight","bool",t.mouse.rightButton),this.setUniform("u_mouseMiddle","bool",t.mouse.middleButton),this.setUniform("u_mouseDelta","vec2",[t.mouse.deltaX,-t.mouse.deltaY]),this.setUniform("u_mouseWheel","float",t.mouse.wheelDelta),this.setUniform("u_mouseWasPressed","bool",t.mouse.wasPressed),this.setUniform("u_mouseWasReleased","bool",t.mouse.wasReleased),this.setUniform("u_keySpace","bool",t.keyboard.isPressed(" ")||t.keyboard.isPressed("space")),this.setUniform("u_keyShift","bool",t.keyboard.shift),this.setUniform("u_keyCtrl","bool",t.keyboard.ctrl),this.setUniform("u_keyAlt","bool",t.keyboard.alt),this.setUniform("u_keyW","bool",t.keyboard.isPressed("w")||t.keyboard.isPressed("W")),this.setUniform("u_keyA","bool",t.keyboard.isPressed("a")||t.keyboard.isPressed("A")),this.setUniform("u_keyS","bool",t.keyboard.isPressed("s")||t.keyboard.isPressed("S")),this.setUniform("u_keyD","bool",t.keyboard.isPressed("d")||t.keyboard.isPressed("D")),this.setUniform("u_keyUp","bool",t.keyboard.isPressed("ArrowUp")),this.setUniform("u_keyDown","bool",t.keyboard.isPressed("ArrowDown")),this.setUniform("u_keyLeft","bool",t.keyboard.isPressed("ArrowLeft")),this.setUniform("u_keyRight","bool",t.keyboard.isPressed("ArrowRight")),t.keyboard.textureData&&this.updateKeyboardTexture(t.keyboard.textureData),this.setUniform("u_touchCount","int",t.touches.count);for(let x=0;x<5;x++){const b=t.touches.points[x];b?this.setUniform(`u_touch${x}`,"vec2",[b.x,t.height-b.y]):this.setUniform(`u_touch${x}`,"vec2",[0,0])}this.setUniform("u_pointer","vec2",[t.pointer.x,t.height-t.pointer.y]),this.setUniform("u_pointerDelta","vec2",[t.pointer.deltaX,-t.pointer.deltaY]),this.setUniform("u_pointerDown","bool",t.pointer.isDown),this.setUniform("u_pointerWasPressed","bool",t.pointer.wasPressed),this.setUniform("u_pointerWasReleased","bool",t.pointer.wasReleased),this.setUniform("u_pointerInCanvas","bool",t.pointer.isInCanvas);const s=t.audio;if(this.setUniform("u_audioVolume","float",s.volume?.current||0),this.setUniform("u_audioPeak","float",s.volume?.peak||0),this.setUniform("u_audioVolumeSmoothed","float",s.volume?.smoothed||0),this.setUniform("u_audioLow","float",s.bands?.low||0),this.setUniform("u_audioLowMid","float",s.bands?.lowMid||0),this.setUniform("u_audioMid","float",s.bands?.mid||0),this.setUniform("u_audioHighMid","float",s.bands?.highMid||0),this.setUniform("u_audioHigh","float",s.bands?.high||0),this.setUniform("u_audioLowSmoothed","float",s.bands?.lowSmoothed||0),this.setUniform("u_audioLowMidSmoothed","float",s.bands?.lowMidSmoothed||0),this.setUniform("u_audioMidSmoothed","float",s.bands?.midSmoothed||0),this.setUniform("u_audioHighMidSmoothed","float",s.bands?.highMidSmoothed||0),this.setUniform("u_audioHighSmoothed","float",s.bands?.highSmoothed||0),this.setUniform("u_audioKick","float",s.beat?.kick||0),this.setUniform("u_audioSnare","float",s.beat?.snare||0),this.setUniform("u_audioHat","float",s.beat?.hat||0),this.setUniform("u_audioAny","float",s.beat?.any||0),this.setUniform("u_audioKickSmoothed","float",s.beat?.kickSmoothed||0),this.setUniform("u_audioSnareSmoothed","float",s.beat?.snareSmoothed||0),this.setUniform("u_audioHatSmoothed","float",s.beat?.hatSmoothed||0),this.setUniform("u_audioAnySmoothed","float",s.beat?.anySmoothed||0),this.setUniform("u_audioKickTrigger","bool",s.beat?.triggers?.kick||false),this.setUniform("u_audioSnareTrigger","bool",s.beat?.triggers?.snare||false),this.setUniform("u_audioHatTrigger","bool",s.beat?.triggers?.hat||false),this.setUniform("u_audioAnyTrigger","bool",s.beat?.triggers?.any||false),this.setUniform("u_audioBPM","float",s.beat?.bpm||120),this.setUniform("u_audioConfidence","float",s.beat?.confidence||0),this.setUniform("u_audioIsLocked","bool",s.beat?.isLocked||false),this.setUniform("u_audioBrightness","float",s.spectral?.brightness||0),this.setUniform("u_audioFlatness","float",s.spectral?.flatness||0),s.isConnected){this.updateAudioFFTTexture(s.getFrequencyData());const x=s.getWaveform();x.length>0&&this.updateAudioWaveformTexture(x)}const i=t.video;i.isConnected&&i.currentFrame?(this.updateVideoTexture(i.currentFrame),this.setUniform("u_videoResolution","vec2",[i.frameWidth,i.frameHeight]),this.setUniform("u_videoFrameRate","float",i.frameRate)):(this.setUniform("u_videoResolution","vec2",[0,0]),this.setUniform("u_videoFrameRate","float",0)),i.cv?.analysedFrame instanceof OffscreenCanvas?(this.updateAnalysedFrameTexture(i.cv.analysedFrame),this.setUniform("u_videoAnalysedAvailable","bool",true)):(this.bindAnalysedFrameFallback(),this.setUniform("u_videoAnalysedAvailable","bool",false));const n=t.videoStreams||[],a=Math.min(n.length,ze.MAX_VIDEO_STREAMS);this.setUniform("u_videoStreamCount","int",a);for(let x=0;x<ze.MAX_VIDEO_STREAMS;x++){const b=`u_videoStream${x}Connected`,v=`u_videoStream${x}Resolution`;x<a&&n[x]?.isConnected&&n[x]?.currentFrame?(this.updateVideoStreamTexture(x,n[x].currentFrame),this.setUniform(v,"vec2",[n[x].frameWidth,n[x].frameHeight]),this.setUniform(b,"bool",true)):(this.setUniform(v,"vec2",[0,0]),this.setUniform(b,"bool",false))}const o=t.devices||[],u=Math.min(o.length,ze.MAX_DEVICE_VIDEOS);this.setUniform("u_deviceCount","int",u);for(let x=0;x<ze.MAX_DEVICE_VIDEOS;x++){const b=`u_device${x}Connected`,v=`u_device${x}Resolution`;x<u&&o[x]?.video?.isConnected&&o[x].video.currentFrame?(this.updateDeviceTexture(x,o[x].video.currentFrame),this.setUniform(v,"vec2",[o[x].video.frameWidth,o[x].video.frameHeight]),this.setUniform(b,"bool",true)):(this.setUniform(v,"vec2",[0,0]),this.setUniform(b,"bool",false))}const l=t.audioStreams||[],h=Math.min(l.length,ze.MAX_AUDIO_STREAMS);this.setUniform("u_audioStreamCount","int",h);for(let x=0;x<ze.MAX_AUDIO_STREAMS;x++){const b=`u_audioStream${x}`;if(x<h&&l[x]?.isConnected){const v=l[x];this.setUniform(`${b}Connected`,"bool",true),this.setUniform(`${b}Volume`,"float",v.volume?.current||0),this.setUniform(`${b}Low`,"float",v.bands?.low||0),this.setUniform(`${b}LowMid`,"float",v.bands?.lowMid||0),this.setUniform(`${b}Mid`,"float",v.bands?.mid||0),this.setUniform(`${b}HighMid`,"float",v.bands?.highMid||0),this.setUniform(`${b}High`,"float",v.bands?.high||0),this.setUniform(`${b}Brightness`,"float",v.spectral?.brightness||0),this.setUniform(`${b}Flatness`,"float",v.spectral?.flatness||0)}else this.setUniform(`${b}Connected`,"bool",false),this.setUniform(`${b}Volume`,"float",0),this.setUniform(`${b}Low`,"float",0),this.setUniform(`${b}LowMid`,"float",0),this.setUniform(`${b}Mid`,"float",0),this.setUniform(`${b}HighMid`,"float",0),this.setUniform(`${b}High`,"float",0),this.setUniform(`${b}Brightness`,"float",0),this.setUniform(`${b}Flatness`,"float",0)}const d=i.cv?.faces||[],m=d[0],_=this.visibleFeatures.has("faceDetection")&&!!m,k=this.visibleFeatures.has("faceMesh")&&!!m,T=this.visibleFeatures.has("emotionDetection")&&!!m;if(this.setUniform("u_faceCount","int",this.visibleFeatures.has("faceDetection")?d.length:0),_){const x=m.bounds,b=m.center?.x||0,v=m.center?.y||0;this.setUniform("u_face0Bounds","vec4",[x?.x||0,1-(x?.y||0)-(x?.height||0),x?.width||0,x?.height||0]),this.setUniform("u_face0Center","vec2",[b,1-v]),this.setUniform("u_face0Confidence","float",m.confidence||0)}else this.setUniform("u_face0Bounds","vec4",[0,0,0,0]),this.setUniform("u_face0Center","vec2",[0,0]),this.setUniform("u_face0Confidence","float",0);if(k){const x=m.headPose||{};this.setUniform("u_face0HeadPose","vec3",[x.pitch||0,x.yaw||0,-(x.roll||0)])}else this.setUniform("u_face0HeadPose","vec3",[0,0,0]);if(T){const x=m.expressions||{},b=m.blendshapes||{};this.setUniform("u_face0Neutral","float",x.neutral||0),this.setUniform("u_face0Happy","float",x.happy||0),this.setUniform("u_face0Sad","float",x.sad||0),this.setUniform("u_face0Angry","float",x.angry||0),this.setUniform("u_face0Surprised","float",x.surprised||0),this.setUniform("u_face0Disgusted","float",x.disgusted||0),this.setUniform("u_face0Fearful","float",x.fearful||0),this.setUniform("u_face0BrowDownLeft","float",b.browDownLeft||0),this.setUniform("u_face0BrowDownRight","float",b.browDownRight||0),this.setUniform("u_face0BrowInnerUp","float",b.browInnerUp||0),this.setUniform("u_face0BrowOuterUpLeft","float",b.browOuterUpLeft||0),this.setUniform("u_face0BrowOuterUpRight","float",b.browOuterUpRight||0),this.setUniform("u_face0CheekPuff","float",b.cheekPuff||0),this.setUniform("u_face0CheekSquintLeft","float",b.cheekSquintLeft||0),this.setUniform("u_face0CheekSquintRight","float",b.cheekSquintRight||0),this.setUniform("u_face0EyeBlinkLeft","float",b.eyeBlinkLeft||0),this.setUniform("u_face0EyeBlinkRight","float",b.eyeBlinkRight||0),this.setUniform("u_face0EyeLookDownLeft","float",b.eyeLookDownLeft||0),this.setUniform("u_face0EyeLookDownRight","float",b.eyeLookDownRight||0),this.setUniform("u_face0EyeLookInLeft","float",b.eyeLookInLeft||0),this.setUniform("u_face0EyeLookInRight","float",b.eyeLookInRight||0),this.setUniform("u_face0EyeLookOutLeft","float",b.eyeLookOutLeft||0),this.setUniform("u_face0EyeLookOutRight","float",b.eyeLookOutRight||0),this.setUniform("u_face0EyeLookUpLeft","float",b.eyeLookUpLeft||0),this.setUniform("u_face0EyeLookUpRight","float",b.eyeLookUpRight||0),this.setUniform("u_face0EyeSquintLeft","float",b.eyeSquintLeft||0),this.setUniform("u_face0EyeSquintRight","float",b.eyeSquintRight||0),this.setUniform("u_face0EyeWideLeft","float",b.eyeWideLeft||0),this.setUniform("u_face0EyeWideRight","float",b.eyeWideRight||0),this.setUniform("u_face0JawForward","float",b.jawForward||0),this.setUniform("u_face0JawLeft","float",b.jawLeft||0),this.setUniform("u_face0JawOpen","float",b.jawOpen||0),this.setUniform("u_face0JawRight","float",b.jawRight||0),this.setUniform("u_face0MouthClose","float",b.mouthClose||0),this.setUniform("u_face0MouthDimpleLeft","float",b.mouthDimpleLeft||0),this.setUniform("u_face0MouthDimpleRight","float",b.mouthDimpleRight||0),this.setUniform("u_face0MouthFrownLeft","float",b.mouthFrownLeft||0),this.setUniform("u_face0MouthFrownRight","float",b.mouthFrownRight||0),this.setUniform("u_face0MouthFunnel","float",b.mouthFunnel||0),this.setUniform("u_face0MouthLeft","float",b.mouthLeft||0),this.setUniform("u_face0MouthLowerDownLeft","float",b.mouthLowerDownLeft||0),this.setUniform("u_face0MouthLowerDownRight","float",b.mouthLowerDownRight||0),this.setUniform("u_face0MouthPressLeft","float",b.mouthPressLeft||0),this.setUniform("u_face0MouthPressRight","float",b.mouthPressRight||0),this.setUniform("u_face0MouthPucker","float",b.mouthPucker||0),this.setUniform("u_face0MouthRight","float",b.mouthRight||0),this.setUniform("u_face0MouthRollLower","float",b.mouthRollLower||0),this.setUniform("u_face0MouthRollUpper","float",b.mouthRollUpper||0),this.setUniform("u_face0MouthShrugLower","float",b.mouthShrugLower||0),this.setUniform("u_face0MouthShrugUpper","float",b.mouthShrugUpper||0),this.setUniform("u_face0MouthSmileLeft","float",b.mouthSmileLeft||0),this.setUniform("u_face0MouthSmileRight","float",b.mouthSmileRight||0),this.setUniform("u_face0MouthStretchLeft","float",b.mouthStretchLeft||0),this.setUniform("u_face0MouthStretchRight","float",b.mouthStretchRight||0),this.setUniform("u_face0MouthUpperUpLeft","float",b.mouthUpperUpLeft||0),this.setUniform("u_face0MouthUpperUpRight","float",b.mouthUpperUpRight||0),this.setUniform("u_face0NoseSneerLeft","float",b.noseSneerLeft||0),this.setUniform("u_face0NoseSneerRight","float",b.noseSneerRight||0),this.setUniform("u_face0TongueOut","float",b.tongueOut||0)}else this.setUniform("u_face0Neutral","float",0),this.setUniform("u_face0Happy","float",0),this.setUniform("u_face0Sad","float",0),this.setUniform("u_face0Angry","float",0),this.setUniform("u_face0Surprised","float",0),this.setUniform("u_face0Disgusted","float",0),this.setUniform("u_face0Fearful","float",0),this.setUniform("u_face0BrowDownLeft","float",0),this.setUniform("u_face0BrowDownRight","float",0),this.setUniform("u_face0BrowInnerUp","float",0),this.setUniform("u_face0BrowOuterUpLeft","float",0),this.setUniform("u_face0BrowOuterUpRight","float",0),this.setUniform("u_face0CheekPuff","float",0),this.setUniform("u_face0CheekSquintLeft","float",0),this.setUniform("u_face0CheekSquintRight","float",0),this.setUniform("u_face0EyeBlinkLeft","float",0),this.setUniform("u_face0EyeBlinkRight","float",0),this.setUniform("u_face0EyeLookDownLeft","float",0),this.setUniform("u_face0EyeLookDownRight","float",0),this.setUniform("u_face0EyeLookInLeft","float",0),this.setUniform("u_face0EyeLookInRight","float",0),this.setUniform("u_face0EyeLookOutLeft","float",0),this.setUniform("u_face0EyeLookOutRight","float",0),this.setUniform("u_face0EyeLookUpLeft","float",0),this.setUniform("u_face0EyeLookUpRight","float",0),this.setUniform("u_face0EyeSquintLeft","float",0),this.setUniform("u_face0EyeSquintRight","float",0),this.setUniform("u_face0EyeWideLeft","float",0),this.setUniform("u_face0EyeWideRight","float",0),this.setUniform("u_face0JawForward","float",0),this.setUniform("u_face0JawLeft","float",0),this.setUniform("u_face0JawOpen","float",0),this.setUniform("u_face0JawRight","float",0),this.setUniform("u_face0MouthClose","float",0),this.setUniform("u_face0MouthDimpleLeft","float",0),this.setUniform("u_face0MouthDimpleRight","float",0),this.setUniform("u_face0MouthFrownLeft","float",0),this.setUniform("u_face0MouthFrownRight","float",0),this.setUniform("u_face0MouthFunnel","float",0),this.setUniform("u_face0MouthLeft","float",0),this.setUniform("u_face0MouthLowerDownLeft","float",0),this.setUniform("u_face0MouthLowerDownRight","float",0),this.setUniform("u_face0MouthPressLeft","float",0),this.setUniform("u_face0MouthPressRight","float",0),this.setUniform("u_face0MouthPucker","float",0),this.setUniform("u_face0MouthRight","float",0),this.setUniform("u_face0MouthRollLower","float",0),this.setUniform("u_face0MouthRollUpper","float",0),this.setUniform("u_face0MouthShrugLower","float",0),this.setUniform("u_face0MouthShrugUpper","float",0),this.setUniform("u_face0MouthSmileLeft","float",0),this.setUniform("u_face0MouthSmileRight","float",0),this.setUniform("u_face0MouthStretchLeft","float",0),this.setUniform("u_face0MouthStretchRight","float",0),this.setUniform("u_face0MouthUpperUpLeft","float",0),this.setUniform("u_face0MouthUpperUpRight","float",0),this.setUniform("u_face0NoseSneerLeft","float",0),this.setUniform("u_face0NoseSneerRight","float",0),this.setUniform("u_face0TongueOut","float",0);const P=i.cv?.hands||[],F=this.visibleFeatures.has("handTracking");this.setUniform("u_handCount","int",F?P.length:0);const B=F?P.find(x=>x.handedness==="left"):void 0,N=F?P.find(x=>x.handedness==="right"):void 0;if(B){const x=B.palm||B.landmarks?.[9],b=B.gestures||{},v=B.bounds;this.setUniform("u_leftHandPalm","vec3",[x?.x||0,1-(x?.y||0),x?.z||0]),this.setUniform("u_leftHandConfidence","float",B.confidence||0),this.setUniform("u_leftHandBounds","vec4",[v?.x||0,1-(v?.y||0)-(v?.height||0),v?.width||0,v?.height||0]),this.setUniform("u_leftHandFist","float",b.fist||0),this.setUniform("u_leftHandOpen","float",b.openPalm||0),this.setUniform("u_leftHandPeace","float",b.peace||0),this.setUniform("u_leftHandThumbsUp","float",b.thumbsUp||0),this.setUniform("u_leftHandThumbsDown","float",b.thumbsDown||0),this.setUniform("u_leftHandPointing","float",b.pointing||0),this.setUniform("u_leftHandILoveYou","float",b.iLoveYou||0)}else this.setUniform("u_leftHandPalm","vec3",[0,0,0]),this.setUniform("u_leftHandConfidence","float",0),this.setUniform("u_leftHandBounds","vec4",[0,0,0,0]),this.setUniform("u_leftHandFist","float",0),this.setUniform("u_leftHandOpen","float",0),this.setUniform("u_leftHandPeace","float",0),this.setUniform("u_leftHandThumbsUp","float",0),this.setUniform("u_leftHandThumbsDown","float",0),this.setUniform("u_leftHandPointing","float",0),this.setUniform("u_leftHandILoveYou","float",0);if(N){const x=N.palm||N.landmarks?.[9],b=N.gestures||{},v=N.bounds;this.setUniform("u_rightHandPalm","vec3",[x?.x||0,1-(x?.y||0),x?.z||0]),this.setUniform("u_rightHandConfidence","float",N.confidence||0),this.setUniform("u_rightHandBounds","vec4",[v?.x||0,1-(v?.y||0)-(v?.height||0),v?.width||0,v?.height||0]),this.setUniform("u_rightHandFist","float",b.fist||0),this.setUniform("u_rightHandOpen","float",b.openPalm||0),this.setUniform("u_rightHandPeace","float",b.peace||0),this.setUniform("u_rightHandThumbsUp","float",b.thumbsUp||0),this.setUniform("u_rightHandThumbsDown","float",b.thumbsDown||0),this.setUniform("u_rightHandPointing","float",b.pointing||0),this.setUniform("u_rightHandILoveYou","float",b.iLoveYou||0)}else this.setUniform("u_rightHandPalm","vec3",[0,0,0]),this.setUniform("u_rightHandConfidence","float",0),this.setUniform("u_rightHandBounds","vec4",[0,0,0,0]),this.setUniform("u_rightHandFist","float",0),this.setUniform("u_rightHandOpen","float",0),this.setUniform("u_rightHandPeace","float",0),this.setUniform("u_rightHandThumbsUp","float",0),this.setUniform("u_rightHandThumbsDown","float",0),this.setUniform("u_rightHandPointing","float",0),this.setUniform("u_rightHandILoveYou","float",0);const q=this.visibleFeatures.has("poseDetection")?i.cv?.pose??null:null;if(this.setUniform("u_poseDetected","bool",q!==null),q&&q.landmarks){const x=q.landmarks,b=v=>1-(x[v]?.y||0);this.setUniform("u_poseConfidence","float",q.confidence||0),this.setUniform("u_nosePosition","vec2",[x[0]?.x||0,b(0)]),this.setUniform("u_leftShoulderPosition","vec2",[x[11]?.x||0,b(11)]),this.setUniform("u_rightShoulderPosition","vec2",[x[12]?.x||0,b(12)]),this.setUniform("u_leftElbowPosition","vec2",[x[13]?.x||0,b(13)]),this.setUniform("u_rightElbowPosition","vec2",[x[14]?.x||0,b(14)]),this.setUniform("u_leftWristPosition","vec2",[x[15]?.x||0,b(15)]),this.setUniform("u_rightWristPosition","vec2",[x[16]?.x||0,b(16)]),this.setUniform("u_leftHipPosition","vec2",[x[23]?.x||0,b(23)]),this.setUniform("u_rightHipPosition","vec2",[x[24]?.x||0,b(24)]),this.setUniform("u_leftKneePosition","vec2",[x[25]?.x||0,b(25)]),this.setUniform("u_rightKneePosition","vec2",[x[26]?.x||0,b(26)]),this.setUniform("u_leftAnklePosition","vec2",[x[27]?.x||0,b(27)]),this.setUniform("u_rightAnklePosition","vec2",[x[28]?.x||0,b(28)])}else this.setUniform("u_poseConfidence","float",0),this.setUniform("u_nosePosition","vec2",[0,0]),this.setUniform("u_leftShoulderPosition","vec2",[0,0]),this.setUniform("u_rightShoulderPosition","vec2",[0,0]),this.setUniform("u_leftElbowPosition","vec2",[0,0]),this.setUniform("u_rightElbowPosition","vec2",[0,0]),this.setUniform("u_leftWristPosition","vec2",[0,0]),this.setUniform("u_rightWristPosition","vec2",[0,0]),this.setUniform("u_leftHipPosition","vec2",[0,0]),this.setUniform("u_rightHipPosition","vec2",[0,0]),this.setUniform("u_leftKneePosition","vec2",[0,0]),this.setUniform("u_rightKneePosition","vec2",[0,0]),this.setUniform("u_leftAnklePosition","vec2",[0,0]),this.setUniform("u_rightAnklePosition","vec2",[0,0]);const J=this.visibleFeatures.has("bodySegmentation")?i.cv?.segmentation??null:null;J?(this.updateSegmentationTexture(J.mask,J.width,J.height),this.setUniform("u_segmentationRes","vec2",[J.width,J.height])):this.setUniform("u_segmentationRes","vec2",[0,0]);const K=t.device;if(K){const x=K.motion;x?.acceleration?this.setUniform("u_deviceAcceleration","vec3",[x.acceleration.x??0,x.acceleration.y??0,x.acceleration.z??0]):this.setUniform("u_deviceAcceleration","vec3",[0,0,0]),x?.accelerationIncludingGravity?this.setUniform("u_deviceAccelerationGravity","vec3",[x.accelerationIncludingGravity.x??0,x.accelerationIncludingGravity.y??0,x.accelerationIncludingGravity.z??0]):this.setUniform("u_deviceAccelerationGravity","vec3",[0,0,0]),x?.rotationRate?this.setUniform("u_deviceRotationRate","vec3",[x.rotationRate.alpha??0,x.rotationRate.beta??0,x.rotationRate.gamma??0]):this.setUniform("u_deviceRotationRate","vec3",[0,0,0]);const b=K.orientation;b?(this.setUniform("u_deviceOrientation","vec3",[b.alpha??0,b.beta??0,b.gamma??0]),this.setUniform("u_deviceOrientationAbsolute","bool",b.absolute)):(this.setUniform("u_deviceOrientation","vec3",[0,0,0]),this.setUniform("u_deviceOrientationAbsolute","bool",false))}else this.setUniform("u_deviceAcceleration","vec3",[0,0,0]),this.setUniform("u_deviceAccelerationGravity","vec3",[0,0,0]),this.setUniform("u_deviceRotationRate","vec3",[0,0,0]),this.setUniform("u_deviceOrientation","vec3",[0,0,0]),this.setUniform("u_deviceOrientationAbsolute","bool",false);const X=t.devices||[],re=Math.min(X.length,ze.MAX_EXTERNAL_DEVICES);this.setUniform("u_externalDeviceCount","int",re);for(let x=0;x<ze.MAX_EXTERNAL_DEVICES;x++)if(x<re){const b=X[x],v=b.motion;v?.acceleration?this.setUniform(`u_device${x}Acceleration`,"vec3",[v.acceleration.x??0,v.acceleration.y??0,v.acceleration.z??0]):this.setUniform(`u_device${x}Acceleration`,"vec3",[0,0,0]),v?.accelerationIncludingGravity?this.setUniform(`u_device${x}AccelerationGravity`,"vec3",[v.accelerationIncludingGravity.x??0,v.accelerationIncludingGravity.y??0,v.accelerationIncludingGravity.z??0]):this.setUniform(`u_device${x}AccelerationGravity`,"vec3",[0,0,0]),v?.rotationRate?this.setUniform(`u_device${x}RotationRate`,"vec3",[v.rotationRate.alpha??0,v.rotationRate.beta??0,v.rotationRate.gamma??0]):this.setUniform(`u_device${x}RotationRate`,"vec3",[0,0,0]);const V=b.orientation;V?this.setUniform(`u_device${x}Orientation`,"vec3",[V.alpha??0,V.beta??0,V.gamma??0]):this.setUniform(`u_device${x}Orientation`,"vec3",[0,0,0])}else this.setUniform(`u_device${x}Acceleration`,"vec3",[0,0,0]),this.setUniform(`u_device${x}AccelerationGravity`,"vec3",[0,0,0]),this.setUniform(`u_device${x}RotationRate`,"vec3",[0,0,0]),this.setUniform(`u_device${x}Orientation`,"vec3",[0,0,0])}updateAccumulators(t,s){const i=t.deltaTime||0;for(const n of this.parameters){if(n.type!=="accumulator")continue;const a=n.config.rate;let o;if(typeof a=="number")o=a;else{const h=s.get(a);h!==void 0?o=h.value??0:this.scalarUniformCache.has(a)?o=this.scalarUniformCache.get(a):(this.accumulatorWarned.has(n.uniformName)||(console.warn(`Accumulator '${n.uniformName}': rate source '${a}' not found, using 0`),this.accumulatorWarned.add(n.uniformName)),o=0)}const l=(this.accumulatorValues.get(n.uniformName)??0)+o*i;this.accumulatorValues.set(n.uniformName,l),this.setUniform(n.uniformName,"float",l)}}updateParameterUniforms(t){for(const s of this.parameters){if(s.type==="accumulator")continue;const i=t.get(s.uniformName);if(!i){s.type!=="cv"&&Math.random()<.01&&console.log(`[ShaderAdapter] Parameter '${s.uniformName}' not found in parameterObjects`);continue}const n=i.value;switch(s.type){case"slider":case"number":this.setUniform(s.uniformName,"float",n);break;case"color":{const a=n;this.colorVec3CacheKey.get(s.uniformName)!==a&&(this.colorVec3Cache.set(s.uniformName,Ql(a)),this.colorVec3CacheKey.set(s.uniformName,a)),this.setUniform(s.uniformName,"vec3",this.colorVec3Cache.get(s.uniformName));break}case"toggle":case"cv":this.setUniform(s.uniformName,"bool",n);break;case"select":{const a=s.config.options?.indexOf(n)||0;this.setUniform(s.uniformName,"int",a);break}case"image":n&&this.updateImageTexture(s.uniformName,n);break;case"button":this.setUniform(s.uniformName,"bool",n);break;case"coordinate":n&&typeof n=="object"&&"x"in n&&"y"in n&&this.setUniform(s.uniformName,"vec2",[n.x,n.y]);break}}}setUniform(t,s,i){switch(s){case"float":this.scalarUniformCache.set(t,i);break;case"int":this.scalarUniformCache.set(t,i);break;case"bool":this.scalarUniformCache.set(t,i?1:0);break;case"vec2":this.scalarUniformCache.set(t+".x",i[0]),this.scalarUniformCache.set(t+".y",i[1]);break;case"vec3":this.scalarUniformCache.set(t+".x",i[0]),this.scalarUniformCache.set(t+".y",i[1]),this.scalarUniformCache.set(t+".z",i[2]);break;case"vec4":this.scalarUniformCache.set(t+".x",i[0]),this.scalarUniformCache.set(t+".y",i[1]),this.scalarUniformCache.set(t+".z",i[2]),this.scalarUniformCache.set(t+".w",i[3]);break}const n=this.uniformLocations.get(t);if(n==null)return;const a=this.gl;switch(s){case"float":a.uniform1f(n,i);break;case"int":a.uniform1i(n,i);break;case"bool":a.uniform1i(n,i?1:0);break;case"vec2":a.uniform2f(n,i[0],i[1]);break;case"vec3":a.uniform3f(n,i[0],i[1],i[2]);break;case"vec4":a.uniform4f(n,i[0],i[1],i[2],i[3]);break}}updateAudioFFTTexture(t){const s=this.gl,i=this.textureUnits.get("u_audioFFT");this.audioFFTTexture||(this.audioFFTTexture=s.createTexture()),s.activeTexture(s.TEXTURE0+i),s.bindTexture(s.TEXTURE_2D,this.audioFFTTexture),s.texImage2D(s.TEXTURE_2D,0,s.LUMINANCE,t.length,1,0,s.LUMINANCE,s.UNSIGNED_BYTE,t),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.NEAREST),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.NEAREST),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE);const n=this.uniformLocations.get("u_audioFFT");n&&s.uniform1i(n,i)}updateAudioWaveformTexture(t){const s=this.gl,i=this.textureUnits.get("u_audioWaveform");this.audioWaveformTexture||(this.audioWaveformTexture=s.createTexture());const n=new Uint8Array(t.length);for(let o=0;o<t.length;o++)n[o]=Math.round((t[o]*.5+.5)*255);s.activeTexture(s.TEXTURE0+i),s.bindTexture(s.TEXTURE_2D,this.audioWaveformTexture),s.texImage2D(s.TEXTURE_2D,0,s.LUMINANCE,n.length,1,0,s.LUMINANCE,s.UNSIGNED_BYTE,n),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.NEAREST),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.NEAREST),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE);const a=this.uniformLocations.get("u_audioWaveform");a&&s.uniform1i(a,i)}updateVideoTexture(t){const s=this.gl,i=this.textureUnits.get("u_video");this.videoTexture||(this.videoTexture=s.createTexture()),s.activeTexture(s.TEXTURE0+i),s.bindTexture(s.TEXTURE_2D,this.videoTexture);const n=t instanceof OffscreenCanvas;n&&s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,true),s.texImage2D(s.TEXTURE_2D,0,s.RGBA,s.RGBA,s.UNSIGNED_BYTE,t),n&&s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,false),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE);const a=this.uniformLocations.get("u_video");a&&s.uniform1i(a,i),t instanceof ImageBitmap&&t.close()}updateAnalysedFrameTexture(t){const s=this.gl,i=this.textureUnits.get("u_videoAnalysed");this.analysedFrameTexture||(this.analysedFrameTexture=s.createTexture()),s.activeTexture(s.TEXTURE0+i),s.bindTexture(s.TEXTURE_2D,this.analysedFrameTexture),s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,true),s.texImage2D(s.TEXTURE_2D,0,s.RGBA,s.RGBA,s.UNSIGNED_BYTE,t),s.pixelStorei(s.UNPACK_FLIP_Y_WEBGL,false),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.LINEAR),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE);const n=this.uniformLocations.get("u_videoAnalysed");n&&s.uniform1i(n,i)}bindAnalysedFrameFallback(){const t=this.gl,s=this.textureUnits.get("u_videoAnalysed");if(this.analysedFrameFallbackTexture)t.activeTexture(t.TEXTURE0+s),t.bindTexture(t.TEXTURE_2D,this.analysedFrameFallbackTexture);else{this.analysedFrameFallbackTexture=t.createTexture(),t.activeTexture(t.TEXTURE0+s),t.bindTexture(t.TEXTURE_2D,this.analysedFrameFallbackTexture);const n=new Uint8Array([0,0,0,255]);t.texImage2D(t.TEXTURE_2D,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,n),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE)}const i=this.uniformLocations.get("u_videoAnalysed");i&&t.uniform1i(i,s)}updateVideoStreamTexture(t,s){const i=this.gl,n=`u_videoStream${t}`,a=this.textureUnits.get(n);this.videoStreamTextures[t]||(this.videoStreamTextures[t]=i.createTexture()),i.activeTexture(i.TEXTURE0+a),i.bindTexture(i.TEXTURE_2D,this.videoStreamTextures[t]);const o=s instanceof OffscreenCanvas;o&&i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,true),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,s),o&&i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,false),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE);const u=this.uniformLocations.get(n);u&&i.uniform1i(u,a),s instanceof ImageBitmap&&s.close()}updateDeviceTexture(t,s){if(!this.gl||t>=ze.MAX_DEVICE_VIDEOS)return;this.deviceTextures[t]||(this.deviceTextures[t]=this.gl.createTexture());const i=this.deviceTextures[t];if(!i)return;const n=this.textureUnits.get(`u_device${t}`);if(n===void 0)return;this.gl.activeTexture(this.gl.TEXTURE0+n),this.gl.bindTexture(this.gl.TEXTURE_2D,i);const a=s instanceof OffscreenCanvas;a&&this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,true),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,s),a&&this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,false),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE);const o=`u_device${t}`,u=this.uniformLocations.get(o);u&&this.gl.uniform1i(u,n),s instanceof ImageBitmap&&s.close()}updateSegmentationTexture(t,s,i){const n=this.gl,a=this.textureUnits.get("u_segmentationMask");this.segmentationTexture||(this.segmentationTexture=n.createTexture()),n.activeTexture(n.TEXTURE0+a),n.bindTexture(n.TEXTURE_2D,this.segmentationTexture),n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,true),n.texImage2D(n.TEXTURE_2D,0,n.LUMINANCE,s,i,0,n.LUMINANCE,n.UNSIGNED_BYTE,t),n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,false),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,n.NEAREST),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,n.CLAMP_TO_EDGE),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,n.CLAMP_TO_EDGE);const o=this.uniformLocations.get("u_segmentationMask");o&&n.uniform1i(o,a)}updateKeyboardTexture(t){const s=this.gl,i=this.textureUnits.get("u_keyboard");this.keyboardTexture||(this.keyboardTexture=s.createTexture()),s.activeTexture(s.TEXTURE0+i),s.bindTexture(s.TEXTURE_2D,this.keyboardTexture),s.texImage2D(s.TEXTURE_2D,0,s.LUMINANCE,256,3,0,s.LUMINANCE,s.UNSIGNED_BYTE,t),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.NEAREST),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.NEAREST),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE);const n=this.uniformLocations.get("u_keyboard");n&&s.uniform1i(n,i)}updateImageTexture(t,s){const i=this.gl;this.textureUnits.has(t)||this.textureUnits.set(t,this.nextTextureUnit++);const n=this.textureUnits.get(t);if(!this.textures.has(t)){const u=i.createTexture();u&&this.textures.set(t,u)}const a=this.textures.get(t);if(!a)return;i.activeTexture(i.TEXTURE0+n),i.bindTexture(i.TEXTURE_2D,a),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,s),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE);const o=this.uniformLocations.get(t);o&&i.uniform1i(o,n)}resize(t,s){this.gl.viewport(0,0,t,s),this.backbufferEnabled&&this.createBackbufferFramebuffers()}getParameterDefinitions(){return this.parameters}destroy(){this.destroyed=true;const t=this.gl;this.program&&(t.deleteProgram(this.program),this.program=null),this.audioFFTTexture&&t.deleteTexture(this.audioFFTTexture),this.audioWaveformTexture&&t.deleteTexture(this.audioWaveformTexture),this.videoTexture&&t.deleteTexture(this.videoTexture),this.analysedFrameTexture&&t.deleteTexture(this.analysedFrameTexture),this.analysedFrameFallbackTexture&&t.deleteTexture(this.analysedFrameFallbackTexture),this.segmentationTexture&&t.deleteTexture(this.segmentationTexture);for(const s of this.videoStreamTextures)s&&t.deleteTexture(s);this.videoStreamTextures=[];for(const s of this.deviceTextures)s&&t.deleteTexture(s);this.deviceTextures=[];for(const s of this.textures.values())s&&t.deleteTexture(s);this.textures.clear(),this.backbufferFramebuffer&&t.deleteFramebuffer(this.backbufferFramebuffer),this.backbufferTexture&&t.deleteTexture(this.backbufferTexture),this.currentFramebuffer&&t.deleteFramebuffer(this.currentFramebuffer),this.currentTexture&&t.deleteTexture(this.currentTexture),this.quadBuffer&&t.deleteBuffer(this.quadBuffer)}}function Vc(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}function Qt(e,t=""){if(typeof e!="number"){const s=t&&`"${t}" `;throw new TypeError(`${s}expected number, got ${typeof e}`)}if(!Number.isSafeInteger(e)||e<0){const s=t&&`"${t}" `;throw new RangeError(`${s}expected integer >= 0, got ${e}`)}}function Ot(e,t,s=""){const i=Vc(e),n=e?.length,a=t!==void 0;if(!i||a&&n!==t){const o=s&&`"${s}" `,u=a?` of length ${t}`:"",l=i?`length=${n}`:`type=${typeof e}`,h=o+"expected Uint8Array"+u+", got "+l;throw i?new RangeError(h):new TypeError(h)}return e}function zi(e){if(typeof e!="function"||typeof e.create!="function")throw new TypeError("Hash must wrapped by utils.createHasher");if(Qt(e.outputLen),Qt(e.blockLen),e.outputLen<1)throw new Error('"outputLen" must be >= 1');if(e.blockLen<1)throw new Error('"blockLen" must be >= 1')}function Si(e,t=true){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function jc(e,t){Ot(e,void 0,"digestInto() output");const s=t.outputLen;if(e.length<s)throw new RangeError('"digestInto() output" expected to be of length >='+s)}function Ws(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function an(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function _t(e,t){return e<<32-t|e>>>t}const $c=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",ph=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function sa(e){if(Ot(e),$c)return e.toHex();let t="";for(let s=0;s<e.length;s++)t+=ph[e[s]];return t}const Lt={_0:48,_9:57,A:65,F:70,a:97,f:102};function io(e){if(e>=Lt._0&&e<=Lt._9)return e-Lt._0;if(e>=Lt.A&&e<=Lt.F)return e-(Lt.A-10);if(e>=Lt.a&&e<=Lt.f)return e-(Lt.a-10)}function qc(e){if(typeof e!="string")throw new TypeError("hex string expected, got "+typeof e);if($c)try{return Uint8Array.fromHex(e)}catch(n){throw n instanceof SyntaxError?new RangeError(n.message):n}const t=e.length,s=t/2;if(t%2)throw new RangeError("hex string expected, got unpadded hex of length "+t);const i=new Uint8Array(s);for(let n=0,a=0;n<s;n++,a+=2){const o=io(e.charCodeAt(a)),u=io(e.charCodeAt(a+1));if(o===void 0||u===void 0){const l=e[a]+e[a+1];throw new RangeError('hex string expected, got non-hex character "'+l+'" at index '+a)}i[n]=o*16+u}return i}function dh(...e){let t=0;for(let i=0;i<e.length;i++){const n=e[i];Ot(n),t+=n.length}const s=new Uint8Array(t);for(let i=0,n=0;i<e.length;i++){const a=e[i];s.set(a,n),n+=a.length}return s}function mh(e,t={}){const s=(n,a)=>e(a).update(n).digest(),i=e(void 0);return s.outputLen=i.outputLen,s.blockLen=i.blockLen,s.canXOF=i.canXOF,s.create=n=>e(n),Object.assign(s,t),Object.freeze(s)}function gh(e=32){Qt(e,"bytesLength");const t=typeof globalThis=="object"?globalThis.crypto:null;if(typeof t?.getRandomValues!="function")throw new Error("crypto.getRandomValues must be defined");if(e>65536)throw new RangeError(`"bytesLength" expected <= 65536, got ${e}`);return t.getRandomValues(new Uint8Array(e))}const bh=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});function yh(e,t,s){return e&t^~e&s}function _h(e,t,s){return e&t^e&s^t&s}class xh{blockLen;outputLen;canXOF=false;padOffset;isLE;buffer;view;finished=false;length=0;pos=0;destroyed=false;constructor(t,s,i,n){this.blockLen=t,this.outputLen=s,this.padOffset=i,this.isLE=n,this.buffer=new Uint8Array(t),this.view=an(this.buffer)}update(t){Si(this),Ot(t);const{view:s,buffer:i,blockLen:n}=this,a=t.length;for(let o=0;o<a;){const u=Math.min(n-this.pos,a-o);if(u===n){const l=an(t);for(;n<=a-o;o+=n)this.process(l,o);continue}i.set(t.subarray(o,o+u),this.pos),this.pos+=u,o+=u,this.pos===n&&(this.process(s,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){Si(this),jc(t,this),this.finished=true;const{buffer:s,view:i,blockLen:n,isLE:a}=this;let{pos:o}=this;s[o++]=128,Ws(this.buffer.subarray(o)),this.padOffset>n-o&&(this.process(i,0),o=0);for(let m=o;m<n;m++)s[m]=0;i.setBigUint64(n-8,BigInt(this.length*8),a),this.process(i,0);const u=an(t),l=this.outputLen;if(l%4)throw new Error("_sha2: outputLen must be aligned to 32bit");const h=l/4,d=this.get();if(h>d.length)throw new Error("_sha2: outputLen bigger than state");for(let m=0;m<h;m++)u.setUint32(4*m,d[m],a)}digest(){const{buffer:t,outputLen:s}=this;this.digestInto(t);const i=t.slice(0,s);return this.destroy(),i}_cloneInto(t){t||=new this.constructor,t.set(...this.get());const{blockLen:s,buffer:i,length:n,finished:a,destroyed:o,pos:u}=this;return t.destroyed=o,t.finished=a,t.length=n,t.pos=u,n%s&&t.buffer.set(i),t}clone(){return this._cloneInto()}}const jt=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),vh=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),$t=new Uint32Array(64);class kh extends xh{constructor(t){super(64,t,8,false)}get(){const{A:t,B:s,C:i,D:n,E:a,F:o,G:u,H:l}=this;return[t,s,i,n,a,o,u,l]}set(t,s,i,n,a,o,u,l){this.A=t|0,this.B=s|0,this.C=i|0,this.D=n|0,this.E=a|0,this.F=o|0,this.G=u|0,this.H=l|0}process(t,s){for(let m=0;m<16;m++,s+=4)$t[m]=t.getUint32(s,false);for(let m=16;m<64;m++){const _=$t[m-15],k=$t[m-2],T=_t(_,7)^_t(_,18)^_>>>3,P=_t(k,17)^_t(k,19)^k>>>10;$t[m]=P+$t[m-7]+T+$t[m-16]|0}let{A:i,B:n,C:a,D:o,E:u,F:l,G:h,H:d}=this;for(let m=0;m<64;m++){const _=_t(u,6)^_t(u,11)^_t(u,25),k=d+_+yh(u,l,h)+vh[m]+$t[m]|0,P=(_t(i,2)^_t(i,13)^_t(i,22))+_h(i,n,a)|0;d=h,h=l,l=u,u=o+k|0,o=a,a=n,n=i,i=k+P|0}i=i+this.A|0,n=n+this.B|0,a=a+this.C|0,o=o+this.D|0,u=u+this.E|0,l=l+this.F|0,h=h+this.G|0,d=d+this.H|0,this.set(i,n,a,o,u,l,h,d)}roundClean(){Ws($t)}destroy(){this.destroyed=true,this.set(0,0,0,0,0,0,0,0),Ws(this.buffer)}}class wh extends kh{A=jt[0]|0;B=jt[1]|0;C=jt[2]|0;D=jt[3]|0;E=jt[4]|0;F=jt[5]|0;G=jt[6]|0;H=jt[7]|0;constructor(){super(32)}}const Hc=mh(()=>new wh,bh(1));const $e=(e,t,s)=>Ot(e,t,s),Wc=Qt,Gc=sa,Wt=(...e)=>dh(...e),In=e=>qc(e),Xc=Vc,Yc=e=>gh(e),Ei=BigInt(0),Cn=BigInt(1);function Gs(e,t=""){if(typeof e!="boolean"){const s=t&&`"${t}" `;throw new TypeError(s+"expected boolean, got type="+typeof e)}return e}function ia(e){if(typeof e=="bigint"){if(!di(e))throw new RangeError("positive bigint expected, got "+e)}else Wc(e);return e}function Rn(e,t=""){if(typeof e!="number"){const s=t&&`"${t}" `;throw new TypeError(s+"expected number, got type="+typeof e)}if(!Number.isSafeInteger(e)){const s=t&&`"${t}" `;throw new RangeError(s+"expected safe integer, got "+e)}}function li(e){const t=ia(e).toString(16);return t.length&1?"0"+t:t}function zc(e){if(typeof e!="string")throw new TypeError("hex string expected, got "+typeof e);return e===""?Ei:BigInt("0x"+e)}function Ki(e){return zc(sa(e))}function Kc(e){return zc(sa(Sh(Ot(e)).reverse()))}function ra(e,t){if(Qt(t),t===0)throw new RangeError("zero length");e=ia(e);const s=e.toString(16);if(s.length>t*2)throw new RangeError("number too large");return qc(s.padStart(t*2,"0"))}function Zc(e,t){return ra(e,t).reverse()}function Sh(e){return Uint8Array.from($e(e))}const di=e=>typeof e=="bigint"&&Ei<=e;function Eh(e,t,s){return di(e)&&di(t)&&di(s)&&t<=e&&e<s}function Qc(e,t,s,i){if(!Eh(t,s,i))throw new RangeError("expected valid "+e+": "+s+" <= n < "+i+", got "+t)}function na(e){if(e<Ei)throw new Error("expected non-negative bigint, got "+e);let t;for(t=0;e>Ei;e>>=Cn,t+=1);return t}const aa=e=>(Cn<<BigInt(e))-Cn;function Th(e,t,s){if(Qt(e,"hashLen"),Qt(t,"qByteLen"),typeof s!="function")throw new TypeError("hmacFn must be a function");const i=F=>new Uint8Array(F),n=Uint8Array.of(),a=Uint8Array.of(0),o=Uint8Array.of(1),u=1e3;let l=i(e),h=i(e),d=0;const m=()=>{l.fill(1),h.fill(0),d=0},_=(...F)=>s(h,Wt(l,...F)),k=(F=n)=>{h=_(a,F),l=_(),F.length!==0&&(h=_(o,F),l=_())},T=()=>{if(d++>=u)throw new Error("drbg: tried max amount of iterations");let F=0;const B=[];for(;F<t;){l=_();const N=l.slice();B.push(N),F+=l.length}return Wt(...B)};return(F,B)=>{m(),k(F);let N;for(;(N=B(T()))===void 0;)k();return m(),N}}function Zi(e,t={},s={}){if(Object.prototype.toString.call(e)!=="[object Object]")throw new TypeError("expected valid options object");function i(a,o,u){if(!u&&o!=="function"&&!Object.hasOwn(e,a))throw new TypeError(`param "${a}" is invalid: expected own property`);const l=e[a];if(u&&l===void 0)return;const h=typeof l;if(h!==o||l===null)throw new TypeError(`param "${a}" is invalid: expected ${o}, got ${h}`)}const n=(a,o)=>Object.entries(a).forEach(([u,l])=>i(u,l,o));n(t,false),n(s,true)}const Ze=BigInt(0),De=BigInt(1),rs=BigInt(2),Jc=BigInt(3),eu=BigInt(4),tu=BigInt(5),Ah=BigInt(7),su=BigInt(8),Ih=BigInt(9),iu=BigInt(16);function lt(e,t){if(t<=Ze)throw new Error("mod: expected positive modulus, got "+t);const s=e%t;return s>=Ze?s:t+s}function ro(e,t){if(e===Ze)throw new Error("invert: expected non-zero number");if(t<=Ze)throw new Error("invert: expected positive modulus, got "+t);let s=lt(e,t),i=t,n=Ze,a=De;for(;s!==Ze;){const u=i/s,l=i-s*u,h=n-a*u;i=s,s=l,n=a,a=h}if(i!==De)throw new Error("invert: does not exist");return lt(n,t)}function oa(e,t,s){const i=e;if(!i.eql(i.sqr(t),s))throw new Error("Cannot find square root")}function ru(e,t){const s=e,i=(s.ORDER+De)/eu,n=s.pow(t,i);return oa(s,n,t),n}function Ch(e,t){const s=e,i=(s.ORDER-tu)/su,n=s.mul(t,rs),a=s.pow(n,i),o=s.mul(t,a),u=s.mul(s.mul(o,rs),a),l=s.mul(o,s.sub(u,s.ONE));return oa(s,l,t),l}function Rh(e){const t=ca(e),s=nu(e),i=s(t,t.neg(t.ONE)),n=s(t,i),a=s(t,t.neg(i)),o=(e+Ah)/iu;return(u,l)=>{const h=u;let d=h.pow(l,o),m=h.mul(d,i);const _=h.mul(d,n),k=h.mul(d,a),T=h.eql(h.sqr(m),l),P=h.eql(h.sqr(_),l);d=h.cmov(d,m,T),m=h.cmov(k,_,P);const F=h.eql(h.sqr(m),l),B=h.cmov(d,m,F);return oa(h,B,l),B}}function nu(e){if(e<Jc)throw new Error("sqrt is not defined for small field");let t=e-De,s=0;for(;t%rs===Ze;)t/=rs,s++;let i=rs;const n=ca(e);for(;no(n,i)===1;)if(i++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(s===1)return ru;let a=n.pow(i,t);const o=(t+De)/rs;return function(l,h){const d=l;if(d.is0(h))return h;if(no(d,h)!==1)throw new Error("Cannot find square root");let m=s,_=d.mul(d.ONE,a),k=d.pow(h,t),T=d.pow(h,o);for(;!d.eql(k,d.ONE);){if(d.is0(k))return d.ZERO;let P=1,F=d.sqr(k);for(;!d.eql(F,d.ONE);)if(P++,F=d.sqr(F),P===m)throw new Error("Cannot find square root");const B=De<<BigInt(m-P-1),N=d.pow(_,B);m=P,_=d.sqr(N),k=d.mul(k,_),T=d.mul(T,N)}return T}}function Ph(e){return e%eu===Jc?ru:e%su===tu?Ch:e%iu===Ih?Rh(e):nu(e)}const Lh=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Dh(e){const t={ORDER:"bigint",BYTES:"number",BITS:"number"},s=Lh.reduce((i,n)=>(i[n]="function",i),t);if(Zi(e,s),Rn(e.BYTES,"BYTES"),Rn(e.BITS,"BITS"),e.BYTES<1||e.BITS<1)throw new Error("invalid field: expected BYTES/BITS > 0");if(e.ORDER<=De)throw new Error("invalid field: expected ORDER > 1, got "+e.ORDER);return e}function Nh(e,t,s){const i=e;if(s<Ze)throw new Error("invalid exponent, negatives unsupported");if(s===Ze)return i.ONE;if(s===De)return t;let n=i.ONE,a=t;for(;s>Ze;)s&De&&(n=i.mul(n,a)),a=i.sqr(a),s>>=De;return n}function au(e,t,s=false){const i=e,n=new Array(t.length).fill(s?i.ZERO:void 0),a=t.reduce((u,l,h)=>i.is0(l)?u:(n[h]=u,i.mul(u,l)),i.ONE),o=i.inv(a);return t.reduceRight((u,l,h)=>i.is0(l)?u:(n[h]=i.mul(u,n[h]),i.mul(u,l)),o),n}function no(e,t){const s=e,i=(s.ORDER-De)/rs,n=s.pow(t,i),a=s.eql(n,s.ONE),o=s.eql(n,s.ZERO),u=s.eql(n,s.neg(s.ONE));if(!a&&!o&&!u)throw new Error("invalid Legendre symbol result");return a?1:o?0:-1}function Fh(e,t){if(t!==void 0&&Wc(t),e<=Ze)throw new Error("invalid n length: expected positive n, got "+e);if(t!==void 0&&t<1)throw new Error("invalid n length: expected positive bit length, got "+t);const s=na(e);if(t!==void 0&&t<s)throw new Error(`invalid n length: expected bit length (${s}) >= n.length (${t})`);const i=t!==void 0?t:s,n=Math.ceil(i/8);return{nBitLength:i,nByteLength:n}}const ao=new WeakMap;class ou{ORDER;BITS;BYTES;isLE;ZERO=Ze;ONE=De;_lengths;_mod;constructor(t,s={}){if(t<=De)throw new Error("invalid field: expected ORDER > 1, got "+t);let i;this.isLE=false,s!=null&&typeof s=="object"&&(typeof s.BITS=="number"&&(i=s.BITS),typeof s.sqrt=="function"&&Object.defineProperty(this,"sqrt",{value:s.sqrt,enumerable:true}),typeof s.isLE=="boolean"&&(this.isLE=s.isLE),s.allowedLengths&&(this._lengths=Object.freeze(s.allowedLengths.slice())),typeof s.modFromBytes=="boolean"&&(this._mod=s.modFromBytes));const{nBitLength:n,nByteLength:a}=Fh(t,i);if(a>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");this.ORDER=t,this.BITS=n,this.BYTES=a,Object.freeze(this)}create(t){return lt(t,this.ORDER)}isValid(t){if(typeof t!="bigint")throw new TypeError("invalid field element: expected bigint, got "+typeof t);return Ze<=t&&t<this.ORDER}is0(t){return t===Ze}isValidNot0(t){return!this.is0(t)&&this.isValid(t)}isOdd(t){return(t&De)===De}neg(t){return lt(-t,this.ORDER)}eql(t,s){return t===s}sqr(t){return lt(t*t,this.ORDER)}add(t,s){return lt(t+s,this.ORDER)}sub(t,s){return lt(t-s,this.ORDER)}mul(t,s){return lt(t*s,this.ORDER)}pow(t,s){return Nh(this,t,s)}div(t,s){return lt(t*ro(s,this.ORDER),this.ORDER)}sqrN(t){return t*t}addN(t,s){return t+s}subN(t,s){return t-s}mulN(t,s){return t*s}inv(t){return ro(t,this.ORDER)}sqrt(t){let s=ao.get(this);return s||ao.set(this,s=Ph(this.ORDER)),s(this,t)}toBytes(t){return this.isLE?Zc(t,this.BYTES):ra(t,this.BYTES)}fromBytes(t,s=false){$e(t);const{_lengths:i,BYTES:n,isLE:a,ORDER:o,_mod:u}=this;if(i){if(t.length<1||!i.includes(t.length)||t.length>n)throw new Error("Field.fromBytes: expected "+i+" bytes, got "+t.length);const h=new Uint8Array(n);h.set(t,a?0:h.length-t.length),t=h}if(t.length!==n)throw new Error("Field.fromBytes: expected "+n+" bytes, got "+t.length);let l=a?Kc(t):Ki(t);if(u&&(l=lt(l,o)),!s&&!this.isValid(l))throw new Error("invalid field element: outside of range 0..ORDER");return l}invertBatch(t){return au(this,t)}cmov(t,s,i){return Gs(i,"condition"),i?s:t}}Object.freeze(ou.prototype);function ca(e,t={}){return new ou(e,t)}function cu(e){if(typeof e!="bigint")throw new Error("field order must be bigint");if(e<=De)throw new Error("field order must be greater than 1");const t=na(e-De);return Math.ceil(t/8)}function uu(e){const t=cu(e);return t+Math.ceil(t/2)}function Uh(e,t,s=false){$e(e);const i=e.length,n=cu(t),a=Math.max(uu(t),16);if(i<a||i>1024)throw new Error("expected "+a+"-1024 bytes of input, got "+i);const o=s?Kc(e):Ki(e),u=lt(o,t-De)+De;return s?Zc(u,n):ra(u,n)}const vs=BigInt(0),ns=BigInt(1);function Ti(e,t){const s=t.negate();return e?s:t}function oo(e,t){const s=au(e.Fp,t.map(i=>i.Z));return t.map((i,n)=>e.fromAffine(i.toAffine(s[n])))}function lu(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function on(e,t){lu(e,t);const s=Math.ceil(t/e)+1,i=2**(e-1),n=2**e,a=aa(e),o=BigInt(e);return{windows:s,windowSize:i,mask:a,maxNumber:n,shiftBy:o}}function co(e,t,s){const{windowSize:i,mask:n,maxNumber:a,shiftBy:o}=s;let u=Number(e&n),l=e>>o;u>i&&(u-=a,l+=ns);const h=t*i,d=h+Math.abs(u)-1,m=u===0,_=u<0,k=t%2!==0;return{nextN:l,offset:d,isZero:m,isNeg:_,isNegF:k,offsetF:h}}const cn=new WeakMap,hu=new WeakMap;function un(e){return hu.get(e)||1}function uo(e){if(e!==vs)throw new Error("invalid wNAF")}class Mh{BASE;ZERO;Fn;bits;constructor(t,s){this.BASE=t.BASE,this.ZERO=t.ZERO,this.Fn=t.Fn,this.bits=s}_unsafeLadder(t,s,i=this.ZERO){let n=t;for(;s>vs;)s&ns&&(i=i.add(n)),n=n.double(),s>>=ns;return i}precomputeWindow(t,s){const{windows:i,windowSize:n}=on(s,this.bits),a=[];let o=t,u=o;for(let l=0;l<i;l++){u=o,a.push(u);for(let h=1;h<n;h++)u=u.add(o),a.push(u);o=u.double()}return a}wNAF(t,s,i){if(!this.Fn.isValid(i))throw new Error("invalid scalar");let n=this.ZERO,a=this.BASE;const o=on(t,this.bits);for(let u=0;u<o.windows;u++){const{nextN:l,offset:h,isZero:d,isNeg:m,isNegF:_,offsetF:k}=co(i,u,o);i=l,d?a=a.add(Ti(_,s[k])):n=n.add(Ti(m,s[h]))}return uo(i),{p:n,f:a}}wNAFUnsafe(t,s,i,n=this.ZERO){const a=on(t,this.bits);for(let o=0;o<a.windows&&i!==vs;o++){const{nextN:u,offset:l,isZero:h,isNeg:d}=co(i,o,a);if(i=u,!h){const m=s[l];n=n.add(d?m.negate():m)}}return uo(i),n}getPrecomputes(t,s,i){let n=cn.get(s);return n||(n=this.precomputeWindow(s,t),t!==1&&(typeof i=="function"&&(n=i(n)),cn.set(s,n))),n}cached(t,s,i){const n=un(t);return this.wNAF(n,this.getPrecomputes(n,t,i),s)}unsafe(t,s,i,n){const a=un(t);return a===1?this._unsafeLadder(t,s,n):this.wNAFUnsafe(a,this.getPrecomputes(a,t,i),s,n)}createCache(t,s){lu(s,this.bits),hu.set(t,s),cn.delete(t)}hasCache(t){return un(t)!==1}}function Oh(e,t,s,i){let n=t,a=e.ZERO,o=e.ZERO;for(;s>vs||i>vs;)s&ns&&(a=a.add(n)),i&ns&&(o=o.add(n)),n=n.double(),s>>=ns,i>>=ns;return{p1:a,p2:o}}function lo(e,t,s){if(t){if(t.ORDER!==e)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return Dh(t),t}else return ca(e,{isLE:s})}function Bh(e,t,s={},i){if(i===void 0&&(i=e==="edwards"),!t||typeof t!="object")throw new Error(`expected valid ${e} CURVE object`);for(const l of["p","n","h"]){const h=t[l];if(!(typeof h=="bigint"&&h>vs))throw new Error(`CURVE.${l} must be positive bigint`)}const n=lo(t.p,s.Fp,i),a=lo(t.n,s.Fn,i),u=["Gx","Gy","a","b"];for(const l of u)if(!n.isValid(t[l]))throw new Error(`CURVE.${l} must be valid field element of CURVE.Fp`);return t=Object.freeze(Object.assign({},t)),{CURVE:t,Fp:n,Fn:a}}function Vh(e,t){return function(i){const n=e(i);return{secretKey:n,publicKey:t(n)}}}class ho{oHash;iHash;blockLen;outputLen;canXOF=false;finished=false;destroyed=false;constructor(t,s){if(zi(t),Ot(s,void 0,"key"),this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const i=this.blockLen,n=new Uint8Array(i);n.set(s.length>i?t.create().update(s).digest():s);for(let a=0;a<n.length;a++)n[a]^=54;this.iHash.update(n),this.oHash=t.create();for(let a=0;a<n.length;a++)n[a]^=106;this.oHash.update(n),Ws(n)}update(t){return Si(this),this.iHash.update(t),this}digestInto(t){Si(this),jc(t,this),this.finished=true;const s=t.subarray(0,this.outputLen);this.iHash.digestInto(s),this.oHash.update(s),this.oHash.digestInto(s),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||=Object.create(Object.getPrototypeOf(this),{});const{oHash:s,iHash:i,finished:n,destroyed:a,blockLen:o,outputLen:u}=this;return t=t,t.finished=n,t.destroyed=a,t.blockLen=o,t.outputLen=u,t.oHash=s._cloneInto(t.oHash),t.iHash=i._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=true,this.oHash.destroy(),this.iHash.destroy()}}const ua=(()=>{const e=(t,s,i)=>new ho(t,s).update(i).digest();return e.create=(t,s)=>new ho(t,s),e})();const fo=(e,t)=>(e+(e>=0?t:-t)/fu)/t;function jh(e,t,s){Qc("scalar",e,xt,s);const[[i,n],[a,o]]=t,u=fo(o*e,s),l=fo(-n*e,s);let h=e-u*i-l*a,d=-u*n-l*o;const m=h<xt,_=d<xt;m&&(h=-h),_&&(d=-d);const k=aa(Math.ceil(na(s)/2))+Gt;if(h<xt||h>=k||d<xt||d>=k)throw new Error("splitScalar (endomorphism): failed for k");return{k1neg:m,k1:h,k2neg:_,k2:d}}function Pn(e){if(!["compact","recovered","der"].includes(e))throw new Error('Signature format must be "compact", "recovered", or "der"');return e}function ln(e,t){Zi(e);const s={};for(let i of Object.keys(t))s[i]=e[i]===void 0?t[i]:e[i];return Gs(s.lowS,"lowS"),Gs(s.prehash,"prehash"),s.format!==void 0&&Pn(s.format),s}class $h extends Error{constructor(t=""){super(t)}}const ht={Err:$h,_tlv:{encode:(e,t)=>{const{Err:s}=ht;if(Rn(e,"tag"),e<0||e>255)throw new s("tlv.encode: wrong tag");if(typeof t!="string")throw new TypeError('"data" expected string, got type='+typeof t);if(t.length&1)throw new s("tlv.encode: unpadded data");const i=t.length/2,n=li(i);if(n.length/2&128)throw new s("tlv.encode: long form length too big");const a=i>127?li(n.length/2|128):"";return li(e)+a+n+t},decode(e,t){const{Err:s}=ht;t=$e(t,void 0,"DER data");let i=0;if(e<0||e>255)throw new s("tlv.encode: wrong tag");if(t.length<2||t[i++]!==e)throw new s("tlv.decode: wrong tlv");const n=t[i++],a=!!(n&128);let o=0;if(!a)o=n;else{const l=n&127;if(!l)throw new s("tlv.decode(long): indefinite length not supported");if(l>4)throw new s("tlv.decode(long): byte length is too big");const h=t.subarray(i,i+l);if(h.length!==l)throw new s("tlv.decode: length bytes not complete");if(h[0]===0)throw new s("tlv.decode(long): zero leftmost byte");for(const d of h)o=o<<8|d;if(i+=l,o<128)throw new s("tlv.decode(long): not minimal encoding")}const u=t.subarray(i,i+o);if(u.length!==o)throw new s("tlv.decode: wrong value length");return{v:u,l:t.subarray(i+o)}}},_int:{encode(e){const{Err:t}=ht;if(ia(e),e<xt)throw new t("integer: negative integers are not allowed");let s=li(e);if(Number.parseInt(s[0],16)&8&&(s="00"+s),s.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return s},decode(e){const{Err:t}=ht;if(e.length<1)throw new t("invalid signature integer: empty");if(e[0]&128)throw new t("invalid signature integer: negative");if(e.length>1&&e[0]===0&&!(e[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return Ki(e)}},toSig(e){const{Err:t,_int:s,_tlv:i}=ht,n=$e(e,void 0,"signature"),{v:a,l:o}=i.decode(48,n);if(o.length)throw new t("invalid signature: left bytes after parsing");const{v:u,l}=i.decode(2,a),{v:h,l:d}=i.decode(2,l);if(d.length)throw new t("invalid signature: left bytes after parsing");return{r:s.decode(u),s:s.decode(h)}},hexFromSig(e){const{_tlv:t,_int:s}=ht,i=t.encode(2,s.encode(e.r)),n=t.encode(2,s.encode(e.s)),a=i+n;return t.encode(48,a)}};Object.freeze(ht._tlv);Object.freeze(ht._int);Object.freeze(ht);const xt=BigInt(0),Gt=BigInt(1),fu=BigInt(2),hi=BigInt(3),qh=BigInt(4);function Hh(e,t={}){const s=Bh("weierstrass",e,t),i=s.Fp,n=s.Fn;let a=s.CURVE;const{h:o,n:u}=a;Zi(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object"});const{endo:l,allowInfinityPoint:h}=t;if(l&&(!i.is0(a.a)||typeof l.beta!="bigint"||!Array.isArray(l.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');const d=du(i,n);function m(){if(!i.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function _(b,v,V){if(h&&v.is0())return Uint8Array.of(0);const{x:W,y:M}=v.toAffine(),R=i.toBytes(W);if(Gs(V,"isCompressed"),V){m();const O=!i.isOdd(M);return Wt(pu(O),R)}else return Wt(Uint8Array.of(4),R,i.toBytes(M))}function k(b){$e(b,void 0,"Point");const{publicKey:v,publicKeyUncompressed:V}=d,W=b.length,M=b[0],R=b.subarray(1);if(h&&W===1&&M===0)return{x:i.ZERO,y:i.ZERO};if(W===v&&(M===2||M===3)){const O=i.fromBytes(R);if(!i.isValid(O))throw new Error("bad point: is not on curve, wrong x");const U=F(O);let I;try{I=i.sqrt(U)}catch(te){const ce=te instanceof Error?": "+te.message:"";throw new Error("bad point: is not on curve, sqrt error"+ce)}m();const H=i.isOdd(I);return(M&1)===1!==H&&(I=i.neg(I)),{x:O,y:I}}else if(W===V&&M===4){const O=i.BYTES,U=i.fromBytes(R.subarray(0,O)),I=i.fromBytes(R.subarray(O,O*2));if(!B(U,I))throw new Error("bad point: is not on curve");return{x:U,y:I}}else throw new Error(`bad point: got length ${W}, expected compressed=${v} or uncompressed=${V}`)}const T=t.toBytes===void 0?_:t.toBytes,P=t.fromBytes===void 0?k:t.fromBytes;function F(b){const v=i.sqr(b),V=i.mul(v,b);return i.add(i.add(V,i.mul(b,a.a)),a.b)}function B(b,v){const V=i.sqr(v),W=F(b);return i.eql(V,W)}if(!B(a.Gx,a.Gy))throw new Error("bad curve params: generator point");const N=i.mul(i.pow(a.a,hi),qh),Y=i.mul(i.sqr(a.b),BigInt(27));if(i.is0(i.add(N,Y)))throw new Error("bad curve params: a or b");function q(b,v,V=false){if(!i.isValid(v)||V&&i.is0(v))throw new Error(`bad point coordinate ${b}`);return v}function z(b){if(!(b instanceof X))throw new Error("Weierstrass Point expected")}function J(b){if(!l||!l.basises)throw new Error("no endo");return jh(b,l.basises,n.ORDER)}function K(b,v,V,W,M){return V=new X(i.mul(V.X,b),V.Y,V.Z),v=Ti(W,v),V=Ti(M,V),v.add(V)}class X{static BASE=new X(a.Gx,a.Gy,i.ONE);static ZERO=new X(i.ZERO,i.ONE,i.ZERO);static Fp=i;static Fn=n;X;Y;Z;constructor(v,V,W){this.X=q("x",v),this.Y=q("y",V,true),this.Z=q("z",W),Object.freeze(this)}static CURVE(){return a}static fromAffine(v){const{x:V,y:W}=v||{};if(!v||!i.isValid(V)||!i.isValid(W))throw new Error("invalid affine point");if(v instanceof X)throw new Error("projective point not allowed");return i.is0(V)&&i.is0(W)?X.ZERO:new X(V,W,i.ONE)}static fromBytes(v){const V=X.fromAffine(P($e(v,void 0,"point")));return V.assertValidity(),V}static fromHex(v){return X.fromBytes(In(v))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(v=8,V=true){return x.createCache(this,v),V||this.multiply(hi),this}assertValidity(){const v=this;if(v.is0()){if(t.allowInfinityPoint&&i.is0(v.X)&&i.eql(v.Y,i.ONE)&&i.is0(v.Z))return;throw new Error("bad point: ZERO")}const{x:V,y:W}=v.toAffine();if(!i.isValid(V)||!i.isValid(W))throw new Error("bad point: x or y not field elements");if(!B(V,W))throw new Error("bad point: equation left != right");if(!v.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:v}=this.toAffine();if(!i.isOdd)throw new Error("Field doesn't support isOdd");return!i.isOdd(v)}equals(v){z(v);const{X:V,Y:W,Z:M}=this,{X:R,Y:O,Z:U}=v,I=i.eql(i.mul(V,U),i.mul(R,M)),H=i.eql(i.mul(W,U),i.mul(O,M));return I&&H}negate(){return new X(this.X,i.neg(this.Y),this.Z)}double(){const{a:v,b:V}=a,W=i.mul(V,hi),{X:M,Y:R,Z:O}=this;let U=i.ZERO,I=i.ZERO,H=i.ZERO,G=i.mul(M,M),te=i.mul(R,R),ce=i.mul(O,O),oe=i.mul(M,R);return oe=i.add(oe,oe),H=i.mul(M,O),H=i.add(H,H),U=i.mul(v,H),I=i.mul(W,ce),I=i.add(U,I),U=i.sub(te,I),I=i.add(te,I),I=i.mul(U,I),U=i.mul(oe,U),H=i.mul(W,H),ce=i.mul(v,ce),oe=i.sub(G,ce),oe=i.mul(v,oe),oe=i.add(oe,H),H=i.add(G,G),G=i.add(H,G),G=i.add(G,ce),G=i.mul(G,oe),I=i.add(I,G),ce=i.mul(R,O),ce=i.add(ce,ce),G=i.mul(ce,oe),U=i.sub(U,G),H=i.mul(ce,te),H=i.add(H,H),H=i.add(H,H),new X(U,I,H)}add(v){z(v);const{X:V,Y:W,Z:M}=this,{X:R,Y:O,Z:U}=v;let I=i.ZERO,H=i.ZERO,G=i.ZERO;const te=a.a,ce=i.mul(a.b,hi);let oe=i.mul(V,R),w=i.mul(W,O),E=i.mul(M,U),D=i.add(V,W),L=i.add(R,O);D=i.mul(D,L),L=i.add(oe,w),D=i.sub(D,L),L=i.add(V,M);let j=i.add(R,U);return L=i.mul(L,j),j=i.add(oe,E),L=i.sub(L,j),j=i.add(W,M),I=i.add(O,U),j=i.mul(j,I),I=i.add(w,E),j=i.sub(j,I),G=i.mul(te,L),I=i.mul(ce,E),G=i.add(I,G),I=i.sub(w,G),G=i.add(w,G),H=i.mul(I,G),w=i.add(oe,oe),w=i.add(w,oe),E=i.mul(te,E),L=i.mul(ce,L),w=i.add(w,E),E=i.sub(oe,E),E=i.mul(te,E),L=i.add(L,E),oe=i.mul(w,L),H=i.add(H,oe),oe=i.mul(j,L),I=i.mul(D,I),I=i.sub(I,oe),oe=i.mul(D,w),G=i.mul(j,G),G=i.add(G,oe),new X(I,H,G)}subtract(v){return z(v),this.add(v.negate())}is0(){return this.equals(X.ZERO)}multiply(v){const{endo:V}=t;if(!n.isValidNot0(v))throw new RangeError("invalid scalar: out of range");let W,M;const R=O=>x.cached(this,O,U=>oo(X,U));if(V){const{k1neg:O,k1:U,k2neg:I,k2:H}=J(v),{p:G,f:te}=R(U),{p:ce,f:oe}=R(H);M=te.add(oe),W=K(V.beta,G,ce,O,I)}else{const{p:O,f:U}=R(v);W=O,M=U}return oo(X,[W,M])[0]}multiplyUnsafe(v){const{endo:V}=t,W=this,M=v;if(!n.isValid(M))throw new RangeError("invalid scalar: out of range");if(M===xt||W.is0())return X.ZERO;if(M===Gt)return W;if(x.hasCache(this))return this.multiply(M);if(V){const{k1neg:R,k1:O,k2neg:U,k2:I}=J(M),{p1:H,p2:G}=Oh(X,W,O,I);return K(V.beta,H,G,R,U)}else return x.unsafe(W,M)}toAffine(v){const V=this;let W=v;const{X:M,Y:R,Z:O}=V;if(i.eql(O,i.ONE))return{x:M,y:R};const U=V.is0();W==null&&(W=U?i.ONE:i.inv(O));const I=i.mul(M,W),H=i.mul(R,W),G=i.mul(O,W);if(U)return{x:i.ZERO,y:i.ZERO};if(!i.eql(G,i.ONE))throw new Error("invZ was invalid");return{x:I,y:H}}isTorsionFree(){const{isTorsionFree:v}=t;return o===Gt?true:v?v(X,this):x.unsafe(this,u).is0()}clearCofactor(){const{clearCofactor:v}=t;return o===Gt?this:v?v(X,this):this.multiplyUnsafe(o)}isSmallOrder(){return o===Gt?this.is0():this.clearCofactor().is0()}toBytes(v=true){return Gs(v,"isCompressed"),this.assertValidity(),T(X,this,v)}toHex(v=true){return Gc(this.toBytes(v))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}const re=n.BITS,x=new Mh(X,t.endo?Math.ceil(re/2):re);return re>=8&&X.BASE.precompute(8),Object.freeze(X.prototype),Object.freeze(X),X}function pu(e){return Uint8Array.of(e?2:3)}function du(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:true,signature:2*t.BYTES}}function Wh(e,t={}){const{Fn:s}=e,i=t.randomBytes===void 0?Yc:t.randomBytes,n=Object.assign(du(e.Fp,s),{seed:Math.max(uu(s.ORDER),16)});function a(k){try{const T=s.fromBytes(k);return s.isValidNot0(T)}catch{return false}}function o(k,T){const{publicKey:P,publicKeyUncompressed:F}=n;try{const B=k.length;return T===true&&B!==P||T===false&&B!==F?false:!!e.fromBytes(k)}catch{return false}}function u(k){return k=k===void 0?i(n.seed):k,Uh($e(k,n.seed,"seed"),s.ORDER)}function l(k,T=true){return e.BASE.multiply(s.fromBytes(k)).toBytes(T)}function h(k){const{secretKey:T,publicKey:P,publicKeyUncompressed:F}=n,B=s._lengths;if(!Xc(k))return;const N=$e(k,void 0,"key").length,Y=N===P||N===F,q=N===T||!!B?.includes(N);if(!(Y&&q))return Y}function d(k,T,P=true){if(h(k)===true)throw new Error("first arg must be private key");if(h(T)===false)throw new Error("second arg must be public key");const F=s.fromBytes(k);return e.fromBytes(T).multiply(F).toBytes(P)}const m={isValidSecretKey:a,isValidPublicKey:o,randomSecretKey:u},_=Vh(u,l);return Object.freeze(m),Object.freeze(n),Object.freeze({getPublicKey:l,getSharedSecret:d,keygen:_,Point:e,utils:m,lengths:n})}function Gh(e,t,s={}){const i=t;zi(i),Zi(s,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"}),s=Object.assign({},s);const n=s.randomBytes===void 0?Yc:s.randomBytes,a=s.hmac===void 0?(M,R)=>ua(i,M,R):s.hmac,{Fp:o,Fn:u}=e,{ORDER:l,BITS:h}=u,{keygen:d,getPublicKey:m,getSharedSecret:_,utils:k,lengths:T}=Wh(e,s),P={prehash:true,lowS:typeof s.lowS=="boolean"?s.lowS:true,format:"compact",extraEntropy:false},F=l*fu+Gt<o.ORDER;function B(M){const R=l>>Gt;return M>R}function N(M,R){if(!u.isValidNot0(R))throw new Error(`invalid signature ${M}: out of range 1..Point.Fn.ORDER`);return R}function Y(){if(F)throw new Error('"recovered" sig type is not supported for cofactor >2 curves')}function q(M,R){Pn(R);const O=T.signature,U=R==="compact"?O:R==="recovered"?O+1:void 0;return $e(M,U)}class z{r;s;recovery;constructor(R,O,U){if(this.r=N("r",R),this.s=N("s",O),U!=null){if(Y(),![0,1,2,3].includes(U))throw new Error("invalid recovery id");this.recovery=U}Object.freeze(this)}static fromBytes(R,O=P.format){q(R,O);let U;if(O==="der"){const{r:te,s:ce}=ht.toSig($e(R));return new z(te,ce)}O==="recovered"&&(U=R[0],O="compact",R=R.subarray(1));const I=T.signature/2,H=R.subarray(0,I),G=R.subarray(I,I*2);return new z(u.fromBytes(H),u.fromBytes(G),U)}static fromHex(R,O){return this.fromBytes(In(R),O)}assertRecovery(){const{recovery:R}=this;if(R==null)throw new Error("invalid recovery id: must be present");return R}addRecoveryBit(R){return new z(this.r,this.s,R)}recoverPublicKey(R){const{r:O,s:U}=this,I=this.assertRecovery(),H=I===2||I===3?O+l:O;if(!o.isValid(H))throw new Error("invalid recovery id: sig.r+curve.n != R.x");const G=o.toBytes(H),te=e.fromBytes(Wt(pu((I&1)===0),G)),ce=u.inv(H),oe=K($e(R,void 0,"msgHash")),w=u.create(-oe*ce),E=u.create(U*ce),D=e.BASE.multiplyUnsafe(w).add(te.multiplyUnsafe(E));if(D.is0())throw new Error("invalid recovery: point at infinify");return D.assertValidity(),D}hasHighS(){return B(this.s)}toBytes(R=P.format){if(Pn(R),R==="der")return In(ht.hexFromSig(this));const{r:O,s:U}=this,I=u.toBytes(O),H=u.toBytes(U);return R==="recovered"?(Y(),Wt(Uint8Array.of(this.assertRecovery()),I,H)):Wt(I,H)}toHex(R){return Gc(this.toBytes(R))}}Object.freeze(z.prototype),Object.freeze(z);const J=s.bits2int===void 0?function(R){if(R.length>8192)throw new Error("input is too large");const O=Ki(R),U=R.length*8-h;return U>0?O>>BigInt(U):O}:s.bits2int,K=s.bits2int_modN===void 0?function(R){return u.create(J(R))}:s.bits2int_modN,X=aa(h);function re(M){return Qc("num < 2^"+h,M,xt,X),u.toBytes(M)}function x(M,R){return $e(M,void 0,"message"),R?$e(i(M),void 0,"prehashed message"):M}function b(M,R,O){const{lowS:U,prehash:I,extraEntropy:H}=ln(O,P);M=x(M,I);const G=K(M),te=u.fromBytes(R);if(!u.isValidNot0(te))throw new Error("invalid private key");const ce=[re(te),re(G)];if(H!=null&&H!==false){const D=H===true?n(T.secretKey):H;ce.push($e(D,void 0,"extraEntropy"))}const oe=Wt(...ce),w=G;function E(D){const L=J(D);if(!u.isValidNot0(L))return;const j=u.inv(L),se=e.BASE.multiply(L).toAffine(),ne=u.create(se.x);if(ne===xt)return;const de=u.create(j*u.create(w+ne*te));if(de===xt)return;let Se=(se.x===ne?0:2)|Number(se.y&Gt),ke=de;return U&&B(de)&&(ke=u.neg(de),Se^=1),new z(ne,ke,F?void 0:Se)}return{seed:oe,k2sig:E}}function v(M,R,O={}){const{seed:U,k2sig:I}=b(M,R,O);return Th(i.outputLen,u.BYTES,a)(U,I).toBytes(O.format)}function V(M,R,O,U={}){const{lowS:I,prehash:H,format:G}=ln(U,P);if(O=$e(O,void 0,"publicKey"),R=x(R,H),!Xc(M)){const te=M instanceof z?", use sig.toBytes()":"";throw new Error("verify expects Uint8Array signature"+te)}q(M,G);try{const te=z.fromBytes(M,G),ce=e.fromBytes(O);if(I&&te.hasHighS())return false;const{r:oe,s:w}=te,E=K(R),D=u.inv(w),L=u.create(E*D),j=u.create(oe*D),se=e.BASE.multiplyUnsafe(L).add(ce.multiplyUnsafe(j));return se.is0()?false:u.create(se.x)===oe}catch{return false}}function W(M,R,O={}){const{prehash:U}=ln(O,P);return R=x(R,U),z.fromBytes(M,"recovered").recoverPublicKey(R).toBytes()}return Object.freeze({keygen:d,getPublicKey:m,getSharedSecret:_,utils:k,lengths:T,Point:e,sign:v,verify:V,recoverPublicKey:W,Signature:z,hash:i})}const Xh={p:BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff"),n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),h:BigInt(1),a:BigInt("0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc"),b:BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5")},Yh=Hh(Xh),zh=Gh(Yh,Hc),po={x:"6bkPbVZXx-c08blVs6qIwm0gfSRLS2nnf2Tsz19ggtM",y:"lhi486ASKQkS8TGbVee-FpdAu7qKaO3gad_4ScX8qJI"},Kh=60;let Ai=null,la=false,Us=null,Ln=0;function Ii(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),s=atob(t),i=new Uint8Array(s.length);for(let n=0;n<s.length;n++)i[n]=s.charCodeAt(n);return i}function Zh(e,t){try{const s=Ii(e),i=Ii(t);if(s.length!==32||i.length!==32)return null;const n=new Uint8Array(65);return n[0]=4,n.set(s,1),n.set(i,33),n}catch{return null}}function Qh(e,t){try{const s=e.split(".");if(s.length!==3)return null;const i=new TextEncoder().encode(s[0]+"."+s[1]),n=Ii(s[2]);if(n.length!==64||!zh.verify(n,i,t,{lowS:false}))return null;const a=JSON.parse(new TextDecoder().decode(Ii(s[1])));return{c:a.c??{},e:a.e??0}}catch{return null}}function Jh(e,t){return!(e>0&&e+Kh<t)}async function ef(){Ai=Zh(po.x,po.y),Ai||(la=true,console.warn("[Viji] _SC: key import failed — restricted mode active"))}async function mo(e){const t=la||!Ai?null:Qh(e,Ai);Us=t?.c??null,Ln=t?.e??0}function tf(e,t){return la||!Us?t:Jh(Ln,Math.floor(Date.now()/1e3))?typeof Us[e]=="number"?Us[e]:t:(Us=null,Ln=0,t)}const sf="#F1F1F1",ys=28,hn=40,go=24,rf={paths:["M37.5801 32.0859L32.248 40.084C31.9699 40.5012 31.5015 40.7519 31 40.752C30.4985 40.7519 30.0302 40.5012 29.752 40.084L24.4199 32.0859L26.916 30.4219L31 36.5479L35.084 30.4219L37.5801 32.0859Z","M43.0059 39.25C43.0059 40.0784 43.6774 40.75 44.5059 40.75C45.3343 40.75 46.0059 40.0784 46.0059 39.25V31H43.0059V39.25Z","M61.0059 39.25C61.0059 40.0784 61.6774 40.75 62.5059 40.75C63.3343 40.75 64.0059 40.0784 64.0059 39.25V31H61.0059V39.25Z","M55.001 39.5C55.001 42.1883 53.9879 44.6433 52.3262 46.5C52.0009 46.8635 51.6509 47.2044 51.2783 47.5195L49.3408 45.2295C49.6074 45.004 49.858 44.7601 50.0908 44.5C51.2793 43.1721 52.001 41.4218 52.001 39.5H52.0059V31H55.0059V39.5H55.001Z"],dots:[[44.5,26.5],[53.5,26.5],[62.5,26.5]],minX:24.4199,minY:24.625,maxX:64.375,maxY:47.5195,shadowStd:11},nf={paths:["M77.6895 41.1893C78.2752 40.6036 79.2248 40.6036 79.8106 41.1893C80.3963 41.7751 80.3963 42.7246 79.8106 43.3104L43.8106 79.3104C43.2248 79.8962 42.2752 79.8962 41.6895 79.3104C41.1037 78.7246 41.1037 77.7751 41.6895 77.1893L77.6895 41.1893Z","M76.875 78.25C76.875 77.2145 77.7145 76.375 78.75 76.375C79.7855 76.375 80.625 77.2145 80.625 78.25C80.625 79.2855 79.7855 80.125 78.75 80.125C77.7145 80.125 76.875 79.2855 76.875 78.25Z","M77.6895 59.1893C78.2752 58.6036 79.2248 58.6036 79.8106 59.1893C80.3963 59.7751 80.3963 60.7246 79.8106 61.3104L61.8106 79.3104C61.2248 79.8962 60.2752 79.8962 59.6895 79.3104C59.1037 78.7246 59.1037 77.7751 59.6895 77.1893L77.6895 59.1893Z","M44.625 42.25C44.625 43.2855 43.7855 44.125 42.75 44.125C41.7145 44.125 40.875 43.2855 40.875 42.25C40.875 41.2145 41.7145 40.375 42.75 40.375C43.7855 40.375 44.625 41.2145 44.625 42.25Z","M43.8105 61.3107C43.2248 61.8964 42.2752 61.8964 41.6894 61.3107C41.1037 60.7249 41.1037 59.7754 41.6894 59.1896L59.6894 41.1896C60.2752 40.6038 61.2248 40.6038 61.8105 41.1896C62.3963 41.7754 62.3963 42.7249 61.8105 43.3107L43.8105 61.3107Z","M70.9911 99.5C70.9911 102.188 69.978 104.643 68.3163 106.5C67.991 106.863 67.6409 107.204 67.2684 107.52L65.3309 105.229C65.5974 105.004 65.8482 104.76 66.0809 104.5C67.2694 103.172 67.9911 101.422 67.9911 99.5H67.9969V91H70.9969V99.5H70.9911Z","M53.5702 92.2109L48.2382 100.209C47.96 100.626 47.4916 100.877 46.9901 100.877C46.4886 100.877 46.0203 100.626 45.7421 100.209L40.41 92.2109L42.9061 90.5469L46.9901 96.6729L51.0741 90.5469L53.5702 92.2109Z","M76.996 99.375C76.996 100.203 77.6675 100.875 78.496 100.875C79.3244 100.875 79.996 100.203 79.996 99.375V91.125H76.996V99.375Z","M58.9969 99.375C58.9969 100.203 59.6685 100.875 60.4969 100.875C61.3254 100.875 61.9969 100.203 61.9969 99.375V91.125H58.9969V99.375Z"],dots:[],minX:40.41,minY:40.375,maxX:80.625,maxY:107.52,shadowStd:12};let ha=null,fa=null,mu=null,gu=null,Ke=null,Vs=null,Ci=null,qt=null,Dt=-1,Nt=-1,bo=null,bu=0;const af=`
432
- attribute vec2 a_pos;
433
- attribute vec2 a_uv;
434
- varying vec2 v_uv;
435
- void main() {
436
- v_uv = a_uv;
437
- gl_Position = vec4(a_pos, 0.0, 1.0);
438
- }`,of=`
439
- precision mediump float;
440
- uniform sampler2D u_tex;
441
- uniform float u_alpha;
442
- varying vec2 v_uv;
443
- void main() {
444
- gl_FragColor = texture2D(u_tex, v_uv) * u_alpha;
445
- }`;function cf(e){const t=new Path2D;for(const[s,i]of e.dots){const n=new Path2D;n.arc(s,i,1.875,0,Math.PI*2),t.addPath(n)}for(const s of e.paths)t.addPath(new Path2D(s));return t}function yo(e){const t=e.maxX-e.minX,s=e.maxY-e.minY,i=Math.ceil(t+ys*2),n=Math.ceil(s+ys*2),a=new OffscreenCanvas(i,n),o=a.getContext("2d");if(!o)return null;const u=cf(e);o.translate(ys-e.minX,ys-e.minY),o.fillStyle=sf;const l=[[e.shadowStd*2,.5],[8,.2],[2,.1]];for(const[h,d]of l)o.save(),o.shadowColor=`rgba(0,0,0,${d})`,o.shadowBlur=h,o.fill(u),o.restore();return o.fill(u),{canvas:a,bufW:i,bufH:n,contentW:t,contentH:s}}function uf(e){try{ha=yo(rf),fa=yo(nf)}catch(t){console.warn("[Viji] overlay: init failed",t)}}function _o(e){bu=e}function lf(e,t,s,i){const n=e===0,a=n?fa:ha;if(!a)return null;const o=a.contentW*i,u=a.contentH*i;let l,h;return e===0?(l=hn*i,h=hn*i):e===2?(l=go*i,h=s-u-go*i):(l=(t-o)/2,h=hn*i),{buffer:a,vertical:n,px:Math.round(l-ys*i),py:Math.round(h-ys*i),w:a.bufW*i,h:a.bufH*i}}function hf(e,t,s,i,n=1){if(i>=1)return;const a=lf(bu,e.width,e.height,n||1);a&&(t?df(t,a):s&&mf(s,e,a))}const yu=34229;function ff(e){const t=e;if(typeof t.createVertexArray=="function")return{create:()=>t.createVertexArray(),bind:i=>t.bindVertexArray(i)};const s=e.getExtension("OES_vertex_array_object");return s?{create:()=>s.createVertexArrayOES(),bind:i=>s.bindVertexArrayOES(i)}:null}function xo(e,t){if(!t)return null;const s=e.getParameter(e.TEXTURE_BINDING_2D),i=e.getParameter(e.UNPACK_FLIP_Y_WEBGL),n=e.getParameter(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL);e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,1),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,0);const a=e.createTexture();return e.bindTexture(e.TEXTURE_2D,a),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t),e.bindTexture(e.TEXTURE_2D,s),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,i?1:0),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n?1:0),a}function pf(e){if(bo===e)return;bo=e,mu=xo(e,ha?.canvas??null),gu=xo(e,fa?.canvas??null);const t=e.createShader(e.VERTEX_SHADER);e.shaderSource(t,af),e.compileShader(t);const s=e.createShader(e.FRAGMENT_SHADER);if(e.shaderSource(s,of),e.compileShader(s),Ke=e.createProgram(),e.attachShader(Ke,t),e.attachShader(Ke,s),e.bindAttribLocation(Ke,0,"a_pos"),e.bindAttribLocation(Ke,1,"a_uv"),e.linkProgram(Ke),e.deleteShader(t),e.deleteShader(s),!e.getProgramParameter(Ke,e.LINK_STATUS)){console.warn("[Viji] overlay: shader link failed"),Ke=null;return}if(Vs=e.createBuffer(),Dt=e.getAttribLocation(Ke,"a_pos"),Nt=e.getAttribLocation(Ke,"a_uv"),qt=ff(e),qt){const i=e.getParameter(yu),n=e.getParameter(e.ARRAY_BUFFER_BINDING);Ci=qt.create(),qt.bind(Ci),e.bindBuffer(e.ARRAY_BUFFER,Vs),Dt>=0&&(e.enableVertexAttribArray(Dt),e.vertexAttribPointer(Dt,2,e.FLOAT,false,16,0)),Nt>=0&&(e.enableVertexAttribArray(Nt),e.vertexAttribPointer(Nt,2,e.FLOAT,false,16,8)),qt.bind(i),e.bindBuffer(e.ARRAY_BUFFER,n)}}function vo(e,t){return{index:t,buffer:e.getVertexAttrib(t,e.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING),enabled:e.getVertexAttrib(t,e.VERTEX_ATTRIB_ARRAY_ENABLED),size:e.getVertexAttrib(t,e.VERTEX_ATTRIB_ARRAY_SIZE),type:e.getVertexAttrib(t,e.VERTEX_ATTRIB_ARRAY_TYPE),normalized:e.getVertexAttrib(t,e.VERTEX_ATTRIB_ARRAY_NORMALIZED),stride:e.getVertexAttrib(t,e.VERTEX_ATTRIB_ARRAY_STRIDE),offset:e.getVertexAttribOffset(t,e.VERTEX_ATTRIB_ARRAY_POINTER),currentValue:e.getVertexAttrib(t,e.CURRENT_VERTEX_ATTRIB)}}function ko(e,t){t.buffer&&(e.bindBuffer(e.ARRAY_BUFFER,t.buffer),e.vertexAttribPointer(t.index,t.size,t.type,t.normalized,t.stride,t.offset)),t.enabled?e.enableVertexAttribArray(t.index):e.disableVertexAttribArray(t.index),e.vertexAttrib4f(t.index,t.currentValue[0],t.currentValue[1],t.currentValue[2],t.currentValue[3])}function df(e,t){e.save(),e.globalAlpha=1,e.drawImage(t.buffer.canvas,t.px,t.py,t.w,t.h),e.restore()}function mf(e,t,s){if(pf(e),!Ke||!Vs)return;const i=s.vertical?gu:mu;if(!i)return;const n=t.width,a=t.height,o=s.px,u=s.py,l=s.w,h=s.h,d=o/n*2-1,m=1-(u+h)/a*2,_=(o+l)/n*2-1,k=1-u/a*2,T=!!(qt&&Ci),P=e.getParameter(e.CURRENT_PROGRAM),F=e.getParameter(e.ACTIVE_TEXTURE);e.activeTexture(e.TEXTURE0);const B=e.getParameter(e.TEXTURE_BINDING_2D),N=e.getParameter(e.ARRAY_BUFFER_BINDING),Y=e.getParameter(e.FRAMEBUFFER_BINDING),q=e.getParameter(e.VIEWPORT),z=e.isEnabled(e.BLEND),J=e.getParameter(e.BLEND_SRC_RGB),K=e.getParameter(e.BLEND_DST_RGB),X=e.getParameter(e.BLEND_SRC_ALPHA),re=e.getParameter(e.BLEND_DST_ALPHA),x=e.getParameter(e.BLEND_EQUATION_RGB),b=e.getParameter(e.BLEND_EQUATION_ALPHA),v=e.isEnabled(e.DEPTH_TEST),V=e.isEnabled(e.SCISSOR_TEST),W=e.isEnabled(e.STENCIL_TEST),M=e.isEnabled(e.CULL_FACE),R=e.getParameter(e.COLOR_WRITEMASK),O=e.getParameter(e.UNPACK_FLIP_Y_WEBGL),U=T?e.getParameter(yu):null,I=!T&&Dt>=0?vo(e,Dt):null,H=!T&&Nt>=0?vo(e,Nt):null;e.bindFramebuffer(e.FRAMEBUFFER,null),e.viewport(0,0,n,a),e.useProgram(Ke),e.enable(e.BLEND),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA),e.disable(e.DEPTH_TEST),e.disable(e.SCISSOR_TEST),e.disable(e.STENCIL_TEST),e.disable(e.CULL_FACE),e.colorMask(true,true,true,true),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,0),e.bindTexture(e.TEXTURE_2D,i),e.uniform1i(e.getUniformLocation(Ke,"u_tex"),0),e.uniform1f(e.getUniformLocation(Ke,"u_alpha"),1);const G=new Float32Array([d,m,0,0,_,m,1,0,d,k,0,1,d,k,0,1,_,m,1,0,_,k,1,1]);T?(qt.bind(Ci),e.bindBuffer(e.ARRAY_BUFFER,Vs),e.bufferData(e.ARRAY_BUFFER,G,e.DYNAMIC_DRAW)):(e.bindBuffer(e.ARRAY_BUFFER,Vs),e.bufferData(e.ARRAY_BUFFER,G,e.DYNAMIC_DRAW),Dt>=0&&(e.enableVertexAttribArray(Dt),e.vertexAttribPointer(Dt,2,e.FLOAT,false,16,0)),Nt>=0&&(e.enableVertexAttribArray(Nt),e.vertexAttribPointer(Nt,2,e.FLOAT,false,16,8))),e.drawArrays(e.TRIANGLES,0,6),T?qt.bind(U):(H&&ko(e,H),I&&ko(e,I)),e.bindFramebuffer(e.FRAMEBUFFER,Y),e.viewport(q[0],q[1],q[2],q[3]),e.bindBuffer(e.ARRAY_BUFFER,N),e.colorMask(R[0],R[1],R[2],R[3]),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,O?1:0),V?e.enable(e.SCISSOR_TEST):e.disable(e.SCISSOR_TEST),W?e.enable(e.STENCIL_TEST):e.disable(e.STENCIL_TEST),M?e.enable(e.CULL_FACE):e.disable(e.CULL_FACE),v?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),z?e.enable(e.BLEND):e.disable(e.BLEND),e.blendFuncSeparate(J,K,X,re),e.blendEquationSeparate(x,b),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,B),e.activeTexture(F),e.useProgram(P)}class pa{canvas=null;ctx=null;gl=null;contextAcquired=false;isRunning=false;renderLoopPaused=false;rafScheduled=false;frameCount=0;lastTime=0;startTime=0;frameRateMode="full";frameSkipCounter=0;screenRefreshRate=60;debugMode=false;p5Adapter=null;shaderAdapter=null;rendererType="native";_isHeadless=false;_displayScale=1;sceneErrorReporter=null;controlPort=null;pendingCaptures=[];static CAPTURE_QUEUE_TTL_MS=1e4;setSceneErrorReporter(t){this.sceneErrorReporter=t}getSceneErrorReporter(){return this.sceneErrorReporter}setDebugMode(t){this.debugMode=t,this.videoSystems.forEach(s=>s?.setDebugMode(t)),this.parameterSystem&&"setDebugMode"in this.parameterSystem&&this.parameterSystem.setDebugMode(t),this.interactionSystem&&"setDebugMode"in this.interactionSystem&&this.interactionSystem.setDebugMode(t)}debugLog(t,...s){this.debugMode&&console.log(t,...s)}effectiveFrameTimes=[];lastEffectiveRateReport=0;effectiveRateReportInterval=1e3;parameterSystem;interactionSystem;capabilityMonitor=new lh;benchmark=null;videoSystems=[];autoCaptureEnabled=false;autoCaptureFormat={flipY:true,frame:"plate"};audioFrequencyData=new Uint8Array(0);audioWaveformData=new Float32Array(0);deviceState={device:{motion:null,orientation:null},devices:[]};deviceVideoMap=new Map;audioStreamStates=new Map;deviceAudioMap=new Map;viji={canvas:null,ctx:null,gl:null,width:0,height:0,time:0,deltaTime:0,frameCount:0,fps:60,audio:{isConnected:false,volume:{current:0,peak:0,smoothed:0},bands:{low:0,lowMid:0,mid:0,highMid:0,high:0,lowSmoothed:0,lowMidSmoothed:0,midSmoothed:0,highMidSmoothed:0,highSmoothed:0},beat:{kick:0,snare:0,hat:0,any:0,kickSmoothed:0,snareSmoothed:0,hatSmoothed:0,anySmoothed:0,triggers:{any:false,kick:false,snare:false,hat:false},events:[],bpm:0,confidence:0,isLocked:false},spectral:{brightness:0,flatness:0},getFrequencyData:()=>new Uint8Array(0),getWaveform:()=>new Float32Array(0)},video:{isConnected:false,currentFrame:null,frameWidth:0,frameHeight:0,frameRate:0,getFrameData:()=>null,cv:null},videoStreams:[],audioStreams:[],mouse:{},keyboard:{},touches:{},device:{motion:null,orientation:null},devices:[],slider:(t,s)=>this.parameterSystem.createSliderParameter(t,s),color:(t,s)=>this.parameterSystem.createColorParameter(t,s),toggle:(t,s)=>this.parameterSystem.createToggleParameter(t,s),select:(t,s)=>this.parameterSystem.createSelectParameter(t,s),text:(t,s)=>this.parameterSystem.createTextParameter(t,s),number:(t,s)=>this.parameterSystem.createNumberParameter(t,s),image:(t,s)=>this.parameterSystem.createImageParameter(t,s),button:t=>this.parameterSystem.createButtonParameter(t),coordinate:(t,s)=>this.parameterSystem.createCoordinateParameter(t,s),useContext:t=>t==="2d"?(!this.ctx&&this.canvas&&(this.ctx=this.canvas.getContext("2d"),this.viji.ctx=this.ctx),this.ctx):t==="webgl"||t==="webgl2"?(!this.gl&&this.canvas&&(this.gl=t==="webgl2"?this.canvas.getContext("webgl2"):this.canvas.getContext("webgl"),this.viji.gl=this.gl,this.gl&&this.gl.viewport(0,0,this.viji.width,this.viji.height)),this.gl):null};constructor(){this.parameterSystem=new sh((t,s)=>{this.postMessage(t,s)}),this.interactionSystem=new ih,this.videoSystems[0]=new ui,this.videoSystems[0].setCVMessaging(0,(t,s)=>{this.postMessage("cv-feature-request",{streamIndex:t,desired:s})}),this.viji.video.cv=this.videoSystems[0].getCvSurface(),Object.assign(this.viji,this.interactionSystem.getInteractionAPIs()),this.viji.audio.getFrequencyData=()=>this.audioFrequencyData,this.viji.audio.getWaveform=()=>this.audioWaveformData,this.capabilityMonitor.setTransitionCallback(t=>{this.postMessage("capability-transition",t)}),this.setupMessageHandling()}setCapabilityUsageMask(t){this.capabilityMonitor.setUsageMask(t)}gatherCapabilityInput(t,s,i){const n=this.interactionSystem.getMouseState(),a=this.interactionSystem.getPointerState(),o=this.videoSystems[0]?this.videoSystems[0].getCVActivity():{faceDetection:{active:false,meaningful:false},faceMesh:{active:false,meaningful:false},emotion:{active:false,meaningful:false},handTracking:{active:false,meaningful:false},poseDetection:{active:false,meaningful:false},segmentation:{active:false,meaningful:false}};return{frameIndex:this.frameCount,timestamp:t,cpuMs:s,frameIntervalMs:i,audioConnected:this.viji.audio.isConnected,videoConnected:this.viji.video.isConnected,sensorsConnected:this.deviceState.device.motion!==null||this.deviceState.device.orientation!==null,devicesConnected:this.deviceState.devices.length>0,mouse:{isInCanvas:n.isInCanvas,leftButton:n.leftButton,rightButton:n.rightButton,middleButton:n.middleButton},pointer:{isDown:a.isDown,isInCanvas:a.isInCanvas,active:a.type!=="none"},touchCount:this.interactionSystem.getTouchCount(),keyboardConsumed:this.interactionSystem.getKeyboardConsumed(),cv:o}}recordCapabilityFrame(t,s,i){this.capabilityMonitor.recordFrame(this.gatherCapabilityInput(t,s,i))}getContextAndFinish(){const t=this.gl;return t&&t.finish(),t}detectContextType(){if(this.gl)return typeof WebGL2RenderingContext<"u"&&this.gl instanceof WebGL2RenderingContext?"webgl2":"webgl";if(this.ctx)return"2d"}fence2dCanvas(){const t=this.ctx;if(!t)return null;try{const s=performance.now();return t.getImageData(0,0,1,1),performance.now()-s}catch{return null}}fenceWebGLReadback(t){try{t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array(4))}catch{}}handleRunFencedBenchmark(t){const s=Math.max(1,Math.floor(t.data.frameCount));if(this.benchmark){this.postMessage("error",{id:t.id,message:"A fenced benchmark is already running",code:"BENCHMARK_BUSY"});return}this.benchmark={id:t.id,remaining:s,samples:[],lastTimestamp:null}}recordBenchmarkFrame(t,s){const i=this.benchmark;if(!i)return;const n=performance.now(),a=this.getContextAndFinish();a&&this.fenceWebGLReadback(a);const o=a?performance.now()-n:this.fence2dCanvas(),u=i.lastTimestamp===null?0:t-i.lastTimestamp;i.lastTimestamp=t;const l=this.capabilityMonitor.evaluate(this.gatherCapabilityInput(t,s,u));i.samples.push({frameIndex:this.frameCount,timestamp:t,cpuMs:s,gpuMs:o,frameIntervalMs:u,capabilities:l}),i.remaining--,i.remaining<=0&&(this.postMessage("run-fenced-benchmark-result",{id:i.id,frames:i.samples}),this.benchmark=null)}async initP5Mode(t,s,i){try{this.rendererType="p5",this.debugLog("🎨 Initializing P5.js mode..."),this.p5Adapter=new hh(this.canvas,this.viji,{setup:t,render:s,canvasMode:i?.canvasMode==="webgl"?"webgl":"2d"}),await this.p5Adapter.init(),this.debugLog("✅ P5.js mode initialized successfully")}catch(n){console.error("❌ Failed to initialize P5.js mode:",n),this.postMessage("error",{message:`P5.js initialization failed: ${n.message}`,code:"P5_INIT_ERROR"}),this.rendererType="native",this.p5Adapter=null}}async initShaderMode(t,s){try{this.rendererType="shader",this.debugLog("🎨 Initializing Shader mode..."),this.shaderAdapter=new ze(this.canvas,this.viji,t,s?.redactDriverInfoLogs??false),await this.shaderAdapter.init();const i=this.shaderAdapter.getParameterDefinitions();for(const n of i)this.registerShaderParameter(n);this.debugLog("✅ Shader mode initialized successfully")}catch(i){console.error("❌ Failed to initialize Shader mode:",i),this.postMessage("error",{message:`Shader initialization failed: ${i.message}`,code:"SHADER_INIT_ERROR"}),this.rendererType="native",this.shaderAdapter=null}}registerShaderParameter(t){if(t.type==="accumulator")return;const s=t.config,i={...s,name:t.uniformName,label:t.label,description:s.description??""};switch(i.name!==t.uniformName&&(console.error(`[viji] Shader parameter identity mismatch for uniform "${t.uniformName}" — forcing name = uniformName.`),i.name=t.uniformName),t.type){case"slider":this.viji.slider(s.default,i);break;case"number":this.viji.number(s.default,i);break;case"color":this.viji.color(s.default,i);break;case"toggle":this.viji.toggle(s.default,i);break;case"select":this.viji.select(s.default,{...i,options:s.options});break;case"image":this.viji.image(null,i);break;case"button":this.viji.button(i);break;case"coordinate":{const n=Array.isArray(s.default)?s.default:[0,0];this.viji.coordinate({x:n[0],y:n[1]},i);break}case"cv":{if(Object.keys(s).length===0)break;this.viji.toggle(s.default,i);break}}}resetParameterState(){this.parameterSystem.resetParameterState(),this.interactionSystem.resetInteractionState(),this.resetAudioState(),this.videoSystems.forEach(t=>t?.resetVideoState()),this.videoSystems[0]&&Object.assign(this.viji.video,this.videoSystems[0].getVideoAPI()),this.updateVijiVideoStreams()}updateVijiVideoStreams(){const t=[],s=[];this.videoSystems.forEach((n,a)=>{if(!n)return;const o=Ps(a);o==="additional"?t.push(n):o==="directFrame"&&s.push(n)});const i=[...t,...s].map(n=>n.getVideoAPI());this.viji.videoStreams.length=i.length;for(let n=0;n<i.length;n++)this.viji.videoStreams[n]=i[n];this.debugLogStreamTable()}lastStreamTableSignature="";debugLogStreamTable(){if(!this.debugMode)return;const t=[];this.videoSystems.forEach((i,n)=>{if(!i)return;const a=i.peekDebugState();t.push(`${n}:${Ps(n)}${a.isConnected?" connected":""}${a.hasFrame?" frame":""}`)});const s=`[${t.join(", ")}] → videoStreams(${this.viji.videoStreams.length})`;s!==this.lastStreamTableSignature&&(this.lastStreamTableSignature=s,this.debugLog(`[Streams] ${s}`))}updateVijiAudioStreams(){const t=[];for(const[s,i]of this.audioStreamStates)s>=uh&&s<Ja&&t.push({index:s,...i});t.sort((s,i)=>s.index-i.index),this.viji.audioStreams.length=t.length;for(let s=0;s<t.length;s++){const i=t[s],n=i.frequencyData,a=i.waveformData;this.viji.audioStreams[s]={isConnected:i.isConnected,volume:i.volume,bands:i.bands,spectral:i.spectral,getFrequencyData:()=>n,getWaveform:()=>a}}}sendAllParametersToHost(){this.parameterSystem.sendAllParametersToHost()}seedInitialValues(t){this.parameterSystem.seedInitialValues(t)}setupMessageHandling(){self.onmessage=t=>{this.dispatchMessage(t.data)}}dispatchMessage(t){switch(t.type){case"init":this.handleInit(t).catch(s=>console.error("[Viji] handleInit failed:",s));break;case"frame-rate-update":this.handleFrameRateUpdate(t);break;case"refresh-rate-update":this.handleRefreshRateUpdate(t);break;case"cv-results-update":this.handleCVResultsUpdate(t);break;case"resolution-update":this.handleResolutionUpdate(t);break;case"set-scene-code":this.handleSetSceneCode(t);break;case"debug-mode":this.setDebugMode(t.data.enabled);break;case"parameter-update":this.handleParameterUpdate(t);break;case"parameter-batch-update":this.handleParameterBatchUpdate(t);break;case"audio-analysis-update":this.handleAudioAnalysisUpdate(t);break;case"audio-stream-setup":this.handleAudioStreamSetup(t);break;case"video-canvas-setup":this.handleVideoCanvasSetup(t);break;case"video-frame-update":this.handleVideoFrameUpdate(t);break;case"video-config-update":this.handleVideoConfigUpdate(t);break;case"video-streams-prepare":this.handleVideoStreamsPrepare(t);break;case"video-frame-direct":this.handleVideoFrameDirect(t);break;case"enable-auto-capture":this.autoCaptureEnabled=t.data.enabled,t.data.flipY!==void 0&&(this.autoCaptureFormat.flipY=t.data.flipY),t.data.frame!==void 0&&(this.autoCaptureFormat.frame=t.data.frame==="display"?"display":"plate"),this.debugLog(`[AutoCapture] ${t.data.enabled?"ENABLED":"DISABLED"} (flipY=${this.autoCaptureFormat.flipY}, frame=${this.autoCaptureFormat.frame})`);break;case"enable-capability-reporting":this.capabilityMonitor.setEnabled(t.data.enabled);break;case"set-render-loop-paused":this.setRenderLoopPaused(t.data.paused);break;case"run-fenced-benchmark":this.handleRunFencedBenchmark(t);break;case"mouse-update":this.handleMouseUpdate(t);break;case"keyboard-update":this.handleKeyboardUpdate(t);break;case"touch-update":this.handleTouchUpdate(t);break;case"interaction-enabled":this.handleInteractionEnabled(t);break;case"device-state-update":this.handleDeviceStateUpdate(t);break;case"performance-update":this.handlePerformanceUpdate(t);break;case"capture-frame":this.handleCaptureFrame(t);break;case"sc-update":mo(t.data.t);break;case"rh-update":_o(t.data.h);break}}async handleInit(t){try{this.canvas=t.data.canvas,this.viji.canvas=this.canvas,this._isHeadless=!!t.data.isHeadless,t.data.reporterConfig&&this.sceneErrorReporter&&this.sceneErrorReporter.applyConfig(t.data.reporterConfig);const s=this.canvas.getContext.bind(this.canvas);this.canvas.getContext=(i,n)=>{const a=s(i,n);return a&&(this.contextAcquired=true,i==="2d"?(this.ctx=a,this.viji.ctx=this.ctx):(i==="webgl"||i==="webgl2")&&(this.gl=a,this.viji.gl=this.gl)),a},this.viji.width=this.canvas.width,this.viji.height=this.canvas.height,await ef(),t.data.sc&&await mo(t.data.sc),uf(this.canvas),t.data.rh!==void 0&&_o(t.data.rh),t.data.controlPort&&(this.controlPort=t.data.controlPort,this.controlPort.onmessage=i=>{this.dispatchMessage(i.data)}),this.startRenderLoop(),self.postMessage({type:"init-response",id:t.id,timestamp:Date.now(),data:{id:t.id}})}catch(s){this.postMessage("error",{id:t.id,message:s.message,code:"INIT_ERROR"})}}handleFrameRateUpdate(t){t.data&&t.data.mode&&(this.frameRateMode=t.data.mode,this.frameSkipCounter=0,this.debugLog("Frame rate mode updated to:",t.data.mode))}getFrameRateDivisor(){switch(this.frameRateMode){case"full":return 1;case"half":return 2;case"quarter":return 4;case"eighth":return 8;default:return 1}}handleRefreshRateUpdate(t){t.data&&t.data.screenRefreshRate&&(this.screenRefreshRate=t.data.screenRefreshRate,this.debugLog("Screen refresh rate updated to:",t.data.screenRefreshRate+"Hz"))}trackEffectiveFrameTime(t){this.effectiveFrameTimes.push(t),this.effectiveFrameTimes.length>60&&this.effectiveFrameTimes.shift()}reportPerformanceStats(t){if(t-this.lastEffectiveRateReport>=this.effectiveRateReportInterval){if(this.effectiveFrameTimes.length>=2){const s=this.effectiveFrameTimes[this.effectiveFrameTimes.length-1]-this.effectiveFrameTimes[0],i=this.effectiveFrameTimes.length-1,n=Math.round(i/s*1e3),a=this.capabilityMonitor.flush();this.postMessage("performance-update",{effectiveRefreshRate:n,frameRateMode:this.frameRateMode,screenRefreshRate:this.screenRefreshRate,contextType:this.detectContextType(),...a&&{frames:a.frames,timing:a.timing,capabilities:a.capabilities}})}this.lastEffectiveRateReport=t}}handleResolutionUpdate(t){t.data&&(this.canvas&&(this.canvas.width=Math.round(t.data.effectiveWidth),this.canvas.height=Math.round(t.data.effectiveHeight)),this.viji.width=Math.round(t.data.effectiveWidth),this.viji.height=Math.round(t.data.effectiveHeight),this._displayScale=t.data.displayScale??1,this.gl&&this.gl.viewport(0,0,this.viji.width,this.viji.height),this.p5Adapter&&this.rendererType==="p5"&&this.p5Adapter.resize(this.viji.width,this.viji.height),this.shaderAdapter&&this.rendererType==="shader"&&this.shaderAdapter.resize(this.viji.width,this.viji.height),this.debugLog("Canvas resolution updated to:",this.viji.width+"x"+this.viji.height))}handleParameterUpdate(t){t.data&&t.data.name!==void 0&&t.data.value!==void 0&&this.parameterSystem.updateParameterValue(t.data.name,t.data.value)}handleParameterBatchUpdate(t){if(t.data&&t.data.updates){for(const s of t.data.updates)this.parameterSystem.updateParameterValue(s.name,s.value);this.parameterSystem.markInitialValuesSynced(),this.debugLog("Parameter system initialized successfully")}}handleCVResultsUpdate(t){const s=this.videoSystems[t.data.streamIndex];if(s)s.handleCVResultsUpdate(t.data);else if(t.data.analysedFrame)try{t.data.analysedFrame.close()}catch{}}handleAudioAnalysisUpdate(t){const s=t.data,i=s.streamIndex??0;i===0?this.handleMainAudioUpdate(s):this.handleAdditionalAudioUpdate(i,s)}handleMainAudioUpdate(t){const s=this.viji.audio;if(s.isConnected=t.isConnected,s.volume.current=t.volume.current,s.volume.peak=t.volume.peak,s.volume.smoothed=t.volume.smoothed,s.bands.low=t.bands.low,s.bands.lowMid=t.bands.lowMid,s.bands.mid=t.bands.mid,s.bands.highMid=t.bands.highMid,s.bands.high=t.bands.high,s.bands.lowSmoothed=t.bands.lowSmoothed,s.bands.lowMidSmoothed=t.bands.lowMidSmoothed,s.bands.midSmoothed=t.bands.midSmoothed,s.bands.highMidSmoothed=t.bands.highMidSmoothed,s.bands.highSmoothed=t.bands.highSmoothed,t.beat){s.beat.kick=t.beat.kick,s.beat.snare=t.beat.snare,s.beat.hat=t.beat.hat,s.beat.any=t.beat.any,s.beat.kickSmoothed=t.beat.kickSmoothed,s.beat.snareSmoothed=t.beat.snareSmoothed,s.beat.hatSmoothed=t.beat.hatSmoothed,s.beat.anySmoothed=t.beat.anySmoothed;const i=t.beat.events||[];i.length>0&&(s.beat.triggers.kick=s.beat.triggers.kick||i.some(n=>n.type==="kick"),s.beat.triggers.snare=s.beat.triggers.snare||i.some(n=>n.type==="snare"),s.beat.triggers.hat=s.beat.triggers.hat||i.some(n=>n.type==="hat"),s.beat.triggers.any=true,s.beat.events.push(...i)),s.beat.bpm=t.beat.bpm,s.beat.confidence=t.beat.confidence,s.beat.isLocked=t.beat.isLocked}s.spectral.brightness=t.spectral.brightness,s.spectral.flatness=t.spectral.flatness,this.audioFrequencyData=new Uint8Array(t.frequencyData),this.audioWaveformData=t.waveformData?new Float32Array(t.waveformData):new Float32Array(0)}handleAdditionalAudioUpdate(t,s){const i=new Uint8Array(s.frequencyData),n=s.waveformData?new Float32Array(s.waveformData):new Float32Array(0),a=this.audioStreamStates.get(t);a?(a.isConnected=s.isConnected,Object.assign(a.volume,s.volume),Object.assign(a.bands,s.bands),Object.assign(a.spectral,s.spectral),a.frequencyData=i,a.waveformData=n):this.audioStreamStates.set(t,{isConnected:s.isConnected,volume:{...s.volume},bands:{...s.bands},spectral:{...s.spectral},frequencyData:i,waveformData:n}),this.updateVijiAudioStreams(),t>=Ja&&this.wireDeviceAudio(t)}wireDeviceAudio(t){const s=this.audioStreamStates.get(t);if(!s)return;let i;for(const[a,o]of this.deviceAudioMap)if(o===t){i=a;break}if(!i)return;const n=this.viji.devices.find(a=>a.id===i);n&&(n.audio?n.audio.isConnected=s.isConnected:n.audio={isConnected:s.isConnected,volume:s.volume,bands:s.bands,spectral:s.spectral,getFrequencyData:()=>s.frequencyData,getWaveform:()=>s.waveformData})}handleAudioStreamSetup(t){const{streamIndex:s,streamType:i,deviceId:n}=t.data;switch(i){case"additional":this.updateVijiAudioStreams();break;case"device":n&&(this.deviceAudioMap.set(n,s),this.wireDeviceAudio(s));break}this.debugLog(`Audio stream setup at index ${s}, type: ${i}${n?`, deviceId: ${n}`:""}`)}resetAudioFrameEvents(){const t=this.viji.audio.beat.triggers;t.kick=false,t.snare=false,t.hat=false,t.any=false,this.viji.audio.beat.events.length=0}resetAudioState(){const t=this.viji.audio;t.isConnected=false,t.volume.current=0,t.volume.peak=0,t.volume.smoothed=0,t.bands.low=0,t.bands.lowMid=0,t.bands.mid=0,t.bands.highMid=0,t.bands.high=0,t.bands.lowSmoothed=0,t.bands.lowMidSmoothed=0,t.bands.midSmoothed=0,t.bands.highMidSmoothed=0,t.bands.highSmoothed=0,t.beat.kick=0,t.beat.snare=0,t.beat.hat=0,t.beat.any=0,t.beat.kickSmoothed=0,t.beat.snareSmoothed=0,t.beat.hatSmoothed=0,t.beat.anySmoothed=0,t.beat.triggers.kick=false,t.beat.triggers.snare=false,t.beat.triggers.hat=false,t.beat.triggers.any=false,t.beat.events.length=0,t.beat.bpm=0,t.beat.confidence=0,t.beat.isLocked=false,t.spectral.brightness=0,t.spectral.flatness=0,this.audioFrequencyData=new Uint8Array(0),this.audioWaveformData=new Float32Array(0),this.audioStreamStates.clear(),this.deviceAudioMap.clear(),this.viji.audioStreams.length=0}handleVideoCanvasSetup(t){const{streamIndex:s,deviceId:i}=t.data,n=s||0,a=Ps(n);let o=this.videoSystems[n];const u=!!o;switch(o||(o=new ui,o.setDebugMode(this.debugMode),o.setCVMessaging(n,(l,h)=>{this.postMessage("cv-feature-request",{streamIndex:l,desired:h})}),this.videoSystems[n]=o),o.setDeviceId(i),o.handleCanvasSetup({offscreenCanvas:t.data.offscreenCanvas,width:t.data.width,height:t.data.height,timestamp:t.data.timestamp}),this.debugLog(`Video system ${u?"reused":"created"} at index ${n}, role: ${a}${i?`, deviceId: ${i}`:""}`),a){case"main":Object.assign(this.viji.video,o.getVideoAPI());break;case"additional":this.updateVijiVideoStreams();break;case"device":if(i){this.deviceVideoMap.set(i,n);const l=this.viji.devices.find(h=>h.id===i);l&&(l.video?Object.assign(l.video,o.getVideoAPI()):l.video=o.getVideoAPI())}break}}handleVideoFrameUpdate(t){const s=t.data.streamIndex||0,i=this.videoSystems[s];if(i){i.handleFrameUpdate({imageBitmap:t.data.imageBitmap,timestamp:t.data.timestamp});const n=Ps(s);if(n==="main")Object.assign(this.viji.video,i.getVideoAPI());else if(n==="device"){const a=i.getDeviceId();if(a){const o=this.viji.devices.find(u=>u.id===a);o&&(o.video?Object.assign(o.video,i.getVideoAPI()):o.video=i.getVideoAPI())}}}}handleVideoConfigUpdate(t){const s=t.data.streamIndex||0,i=this.videoSystems[s];if(i){const n=Ps(s),a=i.getDeviceId();if(t.data.disconnect&&n==="device"&&a){this.deviceVideoMap.delete(a);const o=this.viji.devices.find(u=>u.id===a);o&&(o.video=null)}if(i.handleVideoConfigUpdate({...t.data.targetFrameRate&&{targetFrameRate:t.data.targetFrameRate},...t.data.cvConfig&&{cvConfig:t.data.cvConfig},...t.data.width&&{width:t.data.width},...t.data.height&&{height:t.data.height},...t.data.disconnect&&{disconnect:t.data.disconnect},timestamp:t.data.timestamp}),n==="main")Object.assign(this.viji.video,i.getVideoAPI());else if(n==="device"&&a&&!t.data.disconnect){const o=this.viji.devices.find(u=>u.id===a);o&&(o.video?Object.assign(o.video,i.getVideoAPI()):o.video=i.getVideoAPI())}}}handleVideoStreamsPrepare(t){const{directFrameBaseIndex:s,directFrameCount:i}=t.data;this.debugLog(`[Compositor] Preparing ${i} direct frame slot(s) at base index ${s}`);for(let n=0;n<i;n++){const a=s+n;this.videoSystems[a]||(this.videoSystems[a]=new ui),this.videoSystems[a].setDebugMode(this.debugMode),this.videoSystems[a].initializeForDirectFrames(this.rendererType)}this.updateVijiVideoStreams(),this.debugLog(`[Compositor] Prepared ${i} direct frame slot(s)`)}handleVideoFrameDirect(t){const s=t.data.streamIndex||0;this.videoSystems[s]||(this.debugLog(`[Compositor] Creating new VideoSystem at index ${s} for direct frames`),this.videoSystems[s]=new ui,this.videoSystems[s].setDebugMode(this.debugMode),this.videoSystems[s].initializeForDirectFrames(this.rendererType)),this.videoSystems[s].handleDirectFrame(t.data)}handlePerformanceUpdate(t){this.debugLog("Performance update:",t.data)}async handleCaptureFrame(t){this.pendingCaptures.push({queuedAt:performance.now(),message:t}),this.debugLog(`Capture queued: ${t.data.format||"blob"} (${this.pendingCaptures.length} pending)`)}async executeCaptureFrame(t){try{if(!this.canvas)throw new Error("Canvas not initialized");if((t.data.format||"blob")==="bitmap"){const z=this.canvas.transferToImageBitmap();this.postMessage("capture-frame-result",{id:t.id,bitmap:z},[z]);return}const i=t.data.type||"image/jpeg",n=this.canvas.width,a=this.canvas.height;let o=n,u=a;if(typeof t.data.resolution=="number"){const z=t.data.resolution>0?t.data.resolution:1;o=Math.max(1,Math.floor(n*z)),u=Math.max(1,Math.floor(a*z))}else t.data.resolution&&typeof t.data.resolution=="object"&&(o=Math.max(1,Math.floor(t.data.resolution.width)),u=Math.max(1,Math.floor(t.data.resolution.height)));const l=n/a,h=o/u;let d=0,m=0,_=n,k=a;Math.abs(l-h)>1e-6&&(h>l?(k=Math.floor(n/h),m=Math.floor((a-k)/2)):(_=Math.floor(a*h),d=Math.floor((n-_)/2)));let T;const P=this.getContextAndFinish();if(P){const z=t.data.frame==="display",J=z?P.getParameter(P.FRAMEBUFFER_BINDING):null;z&&P.bindFramebuffer(P.FRAMEBUFFER,null);const K=new Uint8Array(n*a*4);P.readPixels(0,0,n,a,P.RGBA,P.UNSIGNED_BYTE,K),z&&P.bindFramebuffer(P.FRAMEBUFFER,J);const X=new Uint8ClampedArray(n*a*4);for(let b=0;b<a;b++){const v=(a-1-b)*n*4,V=b*n*4;X.set(K.subarray(v,v+n*4),V)}T=new OffscreenCanvas(n,a);const re=T.getContext("2d");if(!re)throw new Error("Failed to create source context");const x=new ImageData(X,n,a);re.putImageData(x,0,0),this.debugLog("Captured frame from WebGL using readPixels (post-render)")}else T=this.canvas,this.debugLog("Captured frame from 2D canvas (post-render)");const F=new OffscreenCanvas(o,u),B=F.getContext("2d");if(!B)throw new Error("Failed to get 2D context");B.drawImage(T,d,m,_,k,0,0,o,u);const N=t.data.quality,Y=typeof N=="number"&&Number.isFinite(N)?Math.min(1,Math.max(0,N)):void 0,q=await F.convertToBlob(Y!==void 0?{type:i,quality:Y}:{type:i});this.postMessage("capture-frame-result",{id:t.id,blob:q})}catch(s){this.postMessage("error",{id:t.id,message:s.message,code:"CAPTURE_FRAME_ERROR"})}}handleSetSceneCode(t){let s=false;const i={resolve:u=>{s||(s=true,this.postMessage("scene-analysis",{id:t.id,...u}))},reject:u=>{s||(s=true,this.postMessage("error",{id:t.id,...u}))}},n=t.data?.sceneCode;if(typeof n!="string"){i.reject({message:"set-scene-code carried no scene code",code:"SCENE_ANALYSIS_ERROR"});return}const a={...t.data?.initialParameters&&{initialParameters:t.data.initialParameters},...t.data?.sk&&{keyComponent:t.data.sk}},o=self.setSceneCode;o(n,a,i).catch(u=>{const l=u;i.reject({message:`Scene load failed before analysis ack: ${l?.message??String(u)}`,code:"SCENE_ANALYSIS_ERROR"})})}startRenderLoop(){this.isRunning=true,this.startTime=performance.now(),this.lastTime=this.startTime,this.renderFrame()}runCaptures(t){for(const{message:s}of t)this.executeCaptureFrame(s).catch(i=>{console.error("Capture execution error:",i)})}runAutoCapture(){if(!(!this.autoCaptureEnabled||!this.canvas))try{const t=this.autoCaptureFormat.flipY?{imageOrientation:"flipY"}:{};createImageBitmap(this.canvas,t).then(s=>{this.postMessage("auto-capture-result",{bitmap:s,timestamp:performance.now()},[s])}).catch(s=>{console.warn("[AutoCapture] ImageBitmap creation failed:",s)})}catch(t){console.warn("[AutoCapture] Failed:",t)}}renderFrame(){if(!this.isRunning)return;const t=performance.now();this.updateVijiVideoStreams(),this.updateVijiAudioStreams();const s=this.getFrameRateDivisor();this.viji.fps=this.screenRefreshRate/s;const i=this.frameSkipCounter%s===0;if(this.frameSkipCounter++,i){const n=t-this.lastTime;this.viji.deltaTime=(t-this.lastTime)/1e3,this.viji.time=(t-this.startTime)/1e3,this.viji.frameCount=++this.frameCount,this.trackEffectiveFrameTime(t),this.lastTime=t,this.interactionSystem.updatePointerState();const a=performance.now();let o=false;try{if(this.shaderAdapter&&this.rendererType==="shader"){const d=this.parameterSystem.getAllParameterObjects();o=this.shaderAdapter.render(this.viji,d)}else if(this.p5Adapter&&this.rendererType==="p5"){const d=this.parameterSystem.getAllParameterObjects();o=this.p5Adapter.tick(this.viji,d)}else{const d=self.renderFunction;d&&typeof d=="function"&&(d(this.viji),o=true)}}catch(d){const m=d;console.error("Render error:",m),this.sceneErrorReporter?this.sceneErrorReporter.reportSceneError({message:m.message,...m.stack!==void 0&&{stack:m.stack},code:"RENDER_ERROR"}):this.postMessage("error",{message:m.message,code:"RENDER_ERROR",stack:m.stack})}const u=o&&this.contextAcquired;if(u&&this.sceneErrorReporter&&this.sceneErrorReporter.markFirstFrameProduced(),this.benchmark){const d=performance.now()-a;this.recordBenchmarkFrame(t,d)}else if(this.capabilityMonitor.isEnabled()){const d=performance.now()-a;this.recordCapabilityFrame(t,d,n)}if(this.parameterSystem.resetButtonParameters(),this.pendingCaptures.length>0){const d=performance.now()-pa.CAPTURE_QUEUE_TTL_MS;this.pendingCaptures=this.pendingCaptures.filter(m=>m.queuedAt>=d)}let l=[],h=[];if(u){const d=this.pendingCaptures;this.pendingCaptures=[],h=d.filter(m=>m.message.data.frame==="display"),l=d.filter(m=>m.message.data.frame!=="display")}if(this.runCaptures(l),u&&this.autoCaptureFormat.frame!=="display"&&this.runAutoCapture(),!this._isHeadless&&this.canvas){const d=tf("b",0);hf(this.canvas,this.ctx,this.gl,d,this._displayScale)}this.runCaptures(h),u&&this.autoCaptureFormat.frame==="display"&&this.runAutoCapture()}this.benchmark||this.reportPerformanceStats(t),this.interactionSystem.frameStart(),this.resetAudioFrameEvents(),this.scheduleNextFrame()}scheduleNextFrame(){this.rafScheduled||!this.isRunning||(this.rafScheduled=true,requestAnimationFrame(()=>{this.rafScheduled=false,this.renderFrame()}))}setRenderLoopPaused(t){t!==this.renderLoopPaused&&(this.renderLoopPaused=t,t?this.isRunning=false:(this.isRunning=true,this.scheduleNextFrame()))}postMessage(t,s,i){const n={type:t,id:s?.id||`${t}_${Date.now()}`,timestamp:Date.now(),data:s};this.controlPort?this.controlPort.postMessage(n,i??[]):self.postMessage(n,i??[])}handleMouseUpdate(t){this.interactionSystem.handleMouseUpdate(t.data)}handleKeyboardUpdate(t){this.interactionSystem.handleKeyboardUpdate(t.data)}handleTouchUpdate(t){this.interactionSystem.handleTouchUpdate(t.data)}handleInteractionEnabled(t){this.interactionSystem.setInteractionEnabled(t.data.enabled)}handleDeviceStateUpdate(t){this.deviceState=t.data,this.viji.device=this.deviceState.device;const s=this.deviceState.devices.map(i=>{const n=this.viji.devices.find(d=>d.id===i.id),a=this.deviceVideoMap.get(i.id),o=a!==void 0?this.videoSystems[a]:void 0,u=this.deviceAudioMap.get(i.id),l=u!==void 0?this.audioStreamStates.get(u):void 0,h=l?{isConnected:l.isConnected,volume:l.volume,bands:l.bands,spectral:l.spectral,getFrequencyData:()=>l.frequencyData,getWaveform:()=>l.waveformData}:null;return n?(n.name=i.name,n.motion=i.motion,n.orientation=i.orientation,h&&(n.audio=h),n):{...i,video:o?o.getVideoAPI():null,audio:h}});this.viji.devices=s}}class Ms{static detectRendererType(t){return/\/\/\s*@renderer\s+shader|\/\*\s*@renderer\s+shader\s*\*\//.test(t)?"shader":/\/\/\s*@renderer\s+p5|\/\*\s*@renderer\s+p5\s*\*\//.test(t)?"p5":"native"}static detectP5CanvasMode(t){return/\/\/\s*@renderer\s+p5\s+webgl\b|\/\*\s*@renderer\s+p5\s+webgl\s*\*\//i.test(t)?"webgl":"2d"}static detectCapabilities(t,s){const i=this.stripCommentsAndStrings(t),n={audio:false,video:false,mouse:false,keyboard:false,pointer:false,touch:false,parameters:false,sensors:false,devices:false,cv:{faceDetection:false,faceMesh:false,emotion:false,handTracking:false,poseDetection:false,segmentation:false}};return s==="shader"?this.detectShaderCapabilities(i,n):this.detectScriptCapabilities(i,n),n}static stripCommentsAndStrings(t){let s="";const i=t.length;let n=0;for(;n<i;){const a=t[n],o=n+1<i?t[n+1]:"";if(a==="/"&&o==="/"){for(n+=2;n<i&&t[n]!==`
446
- `;)n++;continue}if(a==="/"&&o==="*"){for(n+=2;n<i&&!(t[n]==="*"&&t[n+1]==="/");)n++;n+=2,s+=" ";continue}if(a==='"'||a==="'"||a==="`"){const u=a;for(n++;n<i;){if(t[n]==="\\"){n+=2;continue}if(t[n]===u){n++;break}n++}s+=" ";continue}s+=a,n++}return s}static detectShaderCapabilities(t,s){/\bu_audio\w*/.test(t)&&(s.audio=true),/\bu_video\w*/.test(t)&&(s.video=true),/\bu_mouse\w*/.test(t)&&(s.mouse=true),/\bu_key\w*/.test(t)&&(s.keyboard=true),/\bu_touch\w*/.test(t)&&(s.touch=true),/\bu_pointer\w*/.test(t)&&(s.pointer=true),/\bu_device(Acceleration|AccelerationGravity|RotationRate|OrientationAbsolute|Orientation)\b/.test(t)&&(s.sensors=true),/\bu_device[0-7](AccelerationGravity|Acceleration|RotationRate|Orientation)\b/.test(t)&&(s.sensors=true,s.devices=true),/\bu_externalDeviceCount\b/.test(t)&&(s.devices=true,s.sensors=true),(/\bu_deviceCount\b/.test(t)||/\bu_device[0-7](Resolution|Connected)?\b/.test(t))&&(s.video=true,s.devices=true),/\bu_face\w*/.test(t)&&(s.cv.faceDetection=true),/\bu_face0(Neutral|Happy|Sad|Angry|Surprised|Disgusted|Fearful)\b/.test(t)&&(s.cv.emotion=true),(/\bu_face0HeadPose\b/.test(t)||/\bu_videoAnalysed\w*/.test(t)||/\bu_face0(Brow|Cheek|Eye|Jaw|Mouth|Nose|Tongue)\w*/.test(t))&&(s.cv.faceMesh=true),(/\bu_handCount\b/.test(t)||/\bu_(left|right)Hand\w*/.test(t))&&(s.cv.handTracking=true),(/\bu_pose\w*/.test(t)||/\bu_(nose|leftShoulder|rightShoulder|leftElbow|rightElbow|leftWrist|rightWrist|leftHip|rightHip|leftKnee|rightKnee|leftAnkle|rightAnkle)Position\b/.test(t))&&(s.cv.poseDetection=true),/\bu_segmentation\w*/.test(t)&&(s.cv.segmentation=true)}static detectScriptCapabilities(t,s){/\bviji\.audio/.test(t)&&(s.audio=true),/\bviji\.video/.test(t)&&(s.video=true),/\bviji\.mouse/.test(t)&&(s.mouse=true),/\bviji\.keyboard/.test(t)&&(s.keyboard=true),/\bviji\.touches/.test(t)&&(s.touch=true),/\bviji\.pointer/.test(t)&&(s.pointer=true),/\bviji\.device\b/.test(t)&&(s.sensors=true),/\bviji\.devices/.test(t)&&(s.devices=true),/\bviji\.(slider|color|toggle|select|text|number|image|button|coordinate)\s*\(/.test(t)&&(s.parameters=true),/\benableFaceDetection\b/.test(t)&&(s.cv.faceDetection=true),/\benableFaceMesh\b/.test(t)&&(s.cv.faceMesh=true),/\benableEmotionDetection\b/.test(t)&&(s.cv.emotion=true),/\benableHandTracking\b/.test(t)&&(s.cv.handTracking=true),/\benablePoseDetection\b/.test(t)&&(s.cv.poseDetection=true),/\benableBodySegmentation\b/.test(t)&&(s.cv.segmentation=true)}static detectAnalysedFrameUse(t){const s=this.stripCommentsAndStrings(t);return/\b(analysedFrame|getAnalysedFrameData)\b/.test(s)||/\bu_videoAnalysed\w*/.test(s)}static detectUsage(t,s){const i=this.stripCommentsAndStrings(t),n={mouse:{position:false,left:false,right:false,middle:false},pointer:{position:false,down:false},touch:false};return s==="shader"?(n.mouse.position=/\bu_mouse(\b|InCanvas|Delta|Wheel)/.test(i),n.mouse.left=/\bu_mouse(Left|Pressed|WasPressed|WasReleased)\b/.test(i),n.mouse.right=/\bu_mouseRight\b/.test(i),n.mouse.middle=/\bu_mouseMiddle\b/.test(i),n.pointer.position=/\bu_pointer(\b|Delta|InCanvas)/.test(i),n.pointer.down=/\bu_pointer(Down|WasPressed|WasReleased)\b/.test(i),n.touch=/\bu_touch/.test(i)):(n.mouse.position=/\bmouse\.(x|y|deltaX|deltaY|wheelDelta|wheelX|wheelY|wasMoved)\b/.test(i),n.mouse.left=/\bmouse\.(leftButton|isPressed|wasPressed|wasReleased)\b/.test(i),n.mouse.right=/\bmouse\.rightButton\b/.test(i),n.mouse.middle=/\bmouse\.middleButton\b/.test(i),n.pointer.position=/\bpointer\.(x|y|deltaX|deltaY)\b/.test(i),n.pointer.down=/\bpointer\.(isDown|wasPressed|wasReleased)\b/.test(i),n.touch=/\btouches\./.test(i)),n}}function gf(e){const t=Ms.detectRendererType(e),s=t==="p5"?Ms.detectP5CanvasMode(e):void 0;return{renderer:t,...s!==void 0&&{p5CanvasMode:s},capabilities:Ms.detectCapabilities(e,t),consumesAnalysedFrame:Ms.detectAnalysedFrameUse(e)}}const da=5,bf=(1<<da)-1,yf=1<<da,_f=(()=>{const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=new Int8Array(128).fill(-1);for(let s=0;s<e.length;s++)t[e.charCodeAt(s)]=s;return t})();function Ls(e,t){let s=0,i=0,n;do{if(t.index>=e.length)throw new Error("VLQ decode: unexpected end of input");const o=e.charCodeAt(t.index++),u=o<128?_f[o]:-1;if(u<0)throw new Error(`VLQ decode: invalid base64 character '${e[t.index-1]}'`);n=u&yf,s+=(u&bf)<<i,i+=da}while(n);const a=s&1;return s>>>=1,a?-s:s}function xf(e,t){const s=[];if(e.length===0)return s;let i=0;const n=e.split(",");for(const a of n){if(a.length===0)continue;const o={index:0};i+=Ls(a,o);const u={generatedColumn:i};o.index<a.length&&(t.sourceIndex+=Ls(a,o),t.sourceLine+=Ls(a,o),t.sourceColumn+=Ls(a,o),u.sourceLine=t.sourceLine,u.sourceColumn=t.sourceColumn,o.index<a.length&&(t.nameIndex+=Ls(a,o))),s.push(u)}return s}function vf(e){const t=e.split(";"),s=[],i={sourceIndex:0,sourceLine:0,sourceColumn:0,nameIndex:0};for(const n of t){const a=xf(n,i);s.push(a)}return{lines:s}}function kf(e,t,s){if(t<1||t>e.lines.length)return null;const i=e.lines[t-1];if(i.length===0)return null;const n=s-1;let a=0,o=i.length-1,u=-1;for(;a<=o;){const h=a+o>>>1;i[h].generatedColumn<=n?(u=h,a=h+1):o=h-1}if(u<0)return null;const l=i[u];return l.sourceLine===void 0||l.sourceColumn===void 0?null:{line:l.sourceLine+1,column:l.sourceColumn+1}}const wf={errorCoalescingWindowMs:1e3,consoleCoalescingWindowMs:1e3,consoleArgMaxBytes:512,consoleMaxArgsPerCall:8,consoleMaxUniqueSignaturesPerSecond:32};class Sf{config;post;errorChannel;consoleChannel;rateCapWindowMs=1e3;rateCapWindowStart=0;rateCapSignaturesInWindow=0;rateCapSuppressionFiredInWindow=false;functionBodyLineOffset=0;functionBodySourceId="<anonymous>";currentSourceMap=null;hasProducedFirstFrame=false;envelopeSeq=0;constructor(t,s={}){this.config={...wf,...s},this.post=t,this.errorChannel=new wo(this.config.errorCoalescingWindowMs,i=>this.postEnvelope("scene-error",i)),this.consoleChannel=new wo(this.config.consoleCoalescingWindowMs,i=>this.postEnvelope("scene-console",i)),this.detectFunctionBodyOffset()}applyConfig(t){t.errorCoalescingWindowMs!==void 0&&(this.config.errorCoalescingWindowMs=t.errorCoalescingWindowMs,this.errorChannel.setWindowMs(t.errorCoalescingWindowMs)),t.consoleCoalescingWindowMs!==void 0&&(this.config.consoleCoalescingWindowMs=t.consoleCoalescingWindowMs,this.consoleChannel.setWindowMs(t.consoleCoalescingWindowMs)),t.consoleArgMaxBytes!==void 0&&(this.config.consoleArgMaxBytes=t.consoleArgMaxBytes),t.consoleMaxArgsPerCall!==void 0&&(this.config.consoleMaxArgsPerCall=t.consoleMaxArgsPerCall),t.consoleMaxUniqueSignaturesPerSecond!==void 0&&(this.config.consoleMaxUniqueSignaturesPerSecond=t.consoleMaxUniqueSignaturesPerSecond)}markFirstFrameProduced(){this.hasProducedFirstFrame=true}resetForSceneReload(){this.hasProducedFirstFrame=false,this.currentSourceMap=null,this.errorChannel.flushAndClear(),this.consoleChannel.flushAndClear()}destroy(){this.errorChannel.destroy(),this.consoleChannel.destroy(),this.currentSourceMap=null}setCurrentSourceMap(t){if(t===null){this.currentSourceMap=null;return}try{this.currentSourceMap=vf(t)}catch{this.currentSourceMap=null}}reportSceneError(t){const s=t.stack,i=t.sourceOverride?{source:t.sourceOverride,sourceLocation:t.sourceLocationOverride}:this.attributeFromStack(s),n=t.sourceLocationOverride??i.sourceLocation,a=this.hasProducedFirstFrame?"render":"init",o=So([t.message,t.code,n?`${n.line}:${n.column??"?"}`:"no-loc"]),u={message:t.message,...s!==void 0&&{stack:s},source:i.source,phase:a,code:t.code,signatureHash:o,count:1,firstSeenAt:0,lastSeenAt:0,...n!==void 0&&{sourceLocation:n}};this.errorChannel.emit(o,u)}makeArtistConsole(t){const s=Object.create(t),i=["log","info","warn","error"];for(const n of i)s[n]=(...a)=>{try{t[n](...a)}catch{}this.forwardConsoleCall(n,a)};return s}forwardConsoleCall(t,s){const n=(s.length>this.config.consoleMaxArgsPerCall?[...s.slice(0,this.config.consoleMaxArgsPerCall),"…[truncated args]"]:s).map(d=>Ef(d,this.config.consoleArgMaxBytes)),a=So([t,...n]),o=Date.now();if(o-this.rateCapWindowStart>=this.rateCapWindowMs&&(this.rateCapWindowStart=o,this.rateCapSignaturesInWindow=0,this.rateCapSuppressionFiredInWindow=false),!this.consoleChannel.hasPending(a)){if(this.rateCapSignaturesInWindow>=this.config.consoleMaxUniqueSignaturesPerSecond){this.rateCapSuppressionFiredInWindow||(this.rateCapSuppressionFiredInWindow=true,this.emitSuppressionNotice());return}this.rateCapSignaturesInWindow++}const l=this.resolveCallSiteLocation(),h={level:t,args:n,signatureHash:a,count:1,firstSeenAt:0,lastSeenAt:0,...l!==void 0&&{sourceLocation:l}};this.consoleChannel.emit(a,h)}emitSuppressionNotice(){const s={level:"warn",args:["[viji] console output suppressed: too many distinct signatures this second"],signatureHash:"__console_suppressed__",count:1,firstSeenAt:0,lastSeenAt:0};this.postEnvelope("scene-console",s)}resolveCallSiteLocation(){const t=new Error().stack;if(t)return this.attributeFromStack(t).sourceLocation}attributeFromStack(t){if(!t)return{source:"engine"};const s=t.split(`
447
- `);for(const i of s){const n=i.match(/\(?(<anonymous>):(\d+):(\d+)\)?$/);if(!n||n[1]!==this.functionBodySourceId)continue;const a=parseInt(n[2],10),o=parseInt(n[3],10),u=this.resolveLocation(a,o);return u?{source:"scene",sourceLocation:u}:{source:"scene"}}return{source:"engine"}}resolveLocation(t,s){const i=t-this.functionBodyLineOffset;if(!(i<1)){if(this.currentSourceMap){const n=kf(this.currentSourceMap,i,s);if(n)return{line:n.line,column:n.column}}return{line:i}}}detectFunctionBodyOffset(){const t="__viji_offset_probe__";try{new Function("viji","console",`throw new Error(${JSON.stringify(t)});`)(null,null)}catch(s){const n=s?.stack;if(!n)return;const a=n.split(`
448
- `);for(const o of a){const u=o.match(/\(?(<anonymous>):(\d+):(\d+)\)?$/);if(!u)continue;const l=parseInt(u[2],10);this.functionBodyLineOffset=l-1,this.functionBodySourceId=u[1];return}}}postEnvelope(t,s){this.post({type:t,id:`${t}_${s.signatureHash}_${++this.envelopeSeq}`,timestamp:Date.now(),data:s})}}class wo{windowMs;emitFn;pending=new Map;constructor(t,s){this.windowMs=t,this.emitFn=s}setWindowMs(t){this.windowMs=t}hasPending(t){return this.pending.has(t)}emit(t,s){const i=Date.now(),n=this.pending.get(t);if(n){if(n.payload.count++,n.payload.lastSeenAt=i,n.timer!==null)return;this.emitFn(n.payload),n.lastEmittedCount=n.payload.count,n.timer=setTimeout(()=>this.flush(t),this.windowMs);return}s.count=1,s.firstSeenAt=i,s.lastSeenAt=i,this.emitFn(s);const a=setTimeout(()=>this.flush(t),this.windowMs);this.pending.set(t,{payload:s,timer:a,lastEmittedCount:1})}flush(t){const s=this.pending.get(t);!s||s.timer===null||(clearTimeout(s.timer),s.timer=null,s.payload.count>s.lastEmittedCount&&(this.emitFn(s.payload),s.lastEmittedCount=s.payload.count))}flushAndClear(){for(const t of this.pending.values())t.timer!==null&&(clearTimeout(t.timer),t.timer=null,t.payload.count>t.lastEmittedCount&&this.emitFn(t.payload));this.pending.clear()}destroy(){for(const t of this.pending.values())t.timer!==null&&clearTimeout(t.timer);this.pending.clear()}}function Ef(e,t){const s="…[truncated]";let i;try{e===void 0?i="undefined":e===null?i="null":typeof e=="string"?i=e:typeof e=="number"||typeof e=="boolean"||typeof e=="bigint"?i=String(e):typeof e=="function"?i=`[Function: ${e.name||"anonymous"}]`:typeof e=="symbol"?i=e.toString():e instanceof Error?i=`${e.name}: ${e.message}`:i=Tf(e)}catch{i="[unstringifiable]"}return i.length>t?i.slice(0,Math.max(0,t-s.length))+s:i}function Tf(e){const t=new WeakSet;try{return JSON.stringify(e,function(s,i){if(typeof i=="object"&&i!==null){if(t.has(i))return"[Circular]";if(t.add(i),i instanceof Map||i instanceof Set)return Array.from(i.entries?i.entries():i)}return typeof i=="function"?`[Function: ${i.name||"anonymous"}]`:typeof i=="bigint"?`${i.toString()}n`:i})??"undefined"}catch{return"[unstringifiable]"}}function So(e){let i=2166136261;const a=e.join("");for(let o=0;o<a.length;o++)i^=a.charCodeAt(o),i=Math.imul(i,16777619);return(i>>>0).toString(16).padStart(8,"0")}var g;(function(e){e[e.NONE=0]="NONE";const s=1;e[e._abstract=s]="_abstract";const i=s+1;e[e._accessor=i]="_accessor";const n=i+1;e[e._as=n]="_as";const a=n+1;e[e._assert=a]="_assert";const o=a+1;e[e._asserts=o]="_asserts";const u=o+1;e[e._async=u]="_async";const l=u+1;e[e._await=l]="_await";const h=l+1;e[e._checks=h]="_checks";const d=h+1;e[e._constructor=d]="_constructor";const m=d+1;e[e._declare=m]="_declare";const _=m+1;e[e._enum=_]="_enum";const k=_+1;e[e._exports=k]="_exports";const T=k+1;e[e._from=T]="_from";const P=T+1;e[e._get=P]="_get";const F=P+1;e[e._global=F]="_global";const B=F+1;e[e._implements=B]="_implements";const N=B+1;e[e._infer=N]="_infer";const Y=N+1;e[e._interface=Y]="_interface";const q=Y+1;e[e._is=q]="_is";const z=q+1;e[e._keyof=z]="_keyof";const J=z+1;e[e._mixins=J]="_mixins";const K=J+1;e[e._module=K]="_module";const X=K+1;e[e._namespace=X]="_namespace";const re=X+1;e[e._of=re]="_of";const x=re+1;e[e._opaque=x]="_opaque";const b=x+1;e[e._out=b]="_out";const v=b+1;e[e._override=v]="_override";const V=v+1;e[e._private=V]="_private";const W=V+1;e[e._protected=W]="_protected";const M=W+1;e[e._proto=M]="_proto";const R=M+1;e[e._public=R]="_public";const O=R+1;e[e._readonly=O]="_readonly";const U=O+1;e[e._require=U]="_require";const I=U+1;e[e._satisfies=I]="_satisfies";const H=I+1;e[e._set=H]="_set";const G=H+1;e[e._static=G]="_static";const te=G+1;e[e._symbol=te]="_symbol";const ce=te+1;e[e._type=ce]="_type";const oe=ce+1;e[e._unique=oe]="_unique";const w=oe+1;e[e._using=w]="_using"})(g||(g={}));var r;(function(e){e[e.PRECEDENCE_MASK=15]="PRECEDENCE_MASK";const s=16;e[e.IS_KEYWORD=s]="IS_KEYWORD";const i=32;e[e.IS_ASSIGN=i]="IS_ASSIGN";const n=64;e[e.IS_RIGHT_ASSOCIATIVE=n]="IS_RIGHT_ASSOCIATIVE";const a=128;e[e.IS_PREFIX=a]="IS_PREFIX";const o=256;e[e.IS_POSTFIX=o]="IS_POSTFIX";const u=512;e[e.IS_EXPRESSION_START=u]="IS_EXPRESSION_START";const l=512;e[e.num=l]="num";const h=1536;e[e.bigint=h]="bigint";const d=2560;e[e.decimal=d]="decimal";const m=3584;e[e.regexp=m]="regexp";const _=4608;e[e.string=_]="string";const k=5632;e[e.name=k]="name";const T=6144;e[e.eof=T]="eof";const P=7680;e[e.bracketL=P]="bracketL";const F=8192;e[e.bracketR=F]="bracketR";const B=9728;e[e.braceL=B]="braceL";const N=10752;e[e.braceBarL=N]="braceBarL";const Y=11264;e[e.braceR=Y]="braceR";const q=12288;e[e.braceBarR=q]="braceBarR";const z=13824;e[e.parenL=z]="parenL";const J=14336;e[e.parenR=J]="parenR";const K=15360;e[e.comma=K]="comma";const X=16384;e[e.semi=X]="semi";const re=17408;e[e.colon=re]="colon";const x=18432;e[e.doubleColon=x]="doubleColon";const b=19456;e[e.dot=b]="dot";const v=20480;e[e.question=v]="question";const V=21504;e[e.questionDot=V]="questionDot";const W=22528;e[e.arrow=W]="arrow";const M=23552;e[e.template=M]="template";const R=24576;e[e.ellipsis=R]="ellipsis";const O=25600;e[e.backQuote=O]="backQuote";const U=27136;e[e.dollarBraceL=U]="dollarBraceL";const I=27648;e[e.at=I]="at";const H=29184;e[e.hash=H]="hash";const G=29728;e[e.eq=G]="eq";const te=30752;e[e.assign=te]="assign";const ce=32640;e[e.preIncDec=ce]="preIncDec";const oe=33664;e[e.postIncDec=oe]="postIncDec";const w=34432;e[e.bang=w]="bang";const E=35456;e[e.tilde=E]="tilde";const D=35841;e[e.pipeline=D]="pipeline";const L=36866;e[e.nullishCoalescing=L]="nullishCoalescing";const j=37890;e[e.logicalOR=j]="logicalOR";const se=38915;e[e.logicalAND=se]="logicalAND";const ne=39940;e[e.bitwiseOR=ne]="bitwiseOR";const de=40965;e[e.bitwiseXOR=de]="bitwiseXOR";const Se=41990;e[e.bitwiseAND=Se]="bitwiseAND";const ke=43015;e[e.equality=ke]="equality";const Fe=44040;e[e.lessThan=Fe]="lessThan";const Xe=45064;e[e.greaterThan=Xe]="greaterThan";const Ce=46088;e[e.relationalOrEqual=Ce]="relationalOrEqual";const Ve=47113;e[e.bitShiftL=Ve]="bitShiftL";const je=48137;e[e.bitShiftR=je]="bitShiftR";const ts=49802;e[e.plus=ts]="plus";const ds=50826;e[e.minus=ds]="minus";const Rs=51723;e[e.modulo=Rs]="modulo";const ar=52235;e[e.star=ar]="star";const or=53259;e[e.slash=or]="slash";const cr=54348;e[e.exponent=cr]="exponent";const ur=55296;e[e.jsxName=ur]="jsxName";const lr=56320;e[e.jsxText=lr]="jsxText";const hr=57344;e[e.jsxEmptyText=hr]="jsxEmptyText";const fr=58880;e[e.jsxTagStart=fr]="jsxTagStart";const pr=59392;e[e.jsxTagEnd=pr]="jsxTagEnd";const dr=60928;e[e.typeParameterStart=dr]="typeParameterStart";const mr=61440;e[e.nonNullAssertion=mr]="nonNullAssertion";const gr=62480;e[e._break=gr]="_break";const br=63504;e[e._case=br]="_case";const yr=64528;e[e._catch=yr]="_catch";const _r=65552;e[e._continue=_r]="_continue";const xr=66576;e[e._debugger=xr]="_debugger";const vr=67600;e[e._default=vr]="_default";const kr=68624;e[e._do=kr]="_do";const wr=69648;e[e._else=wr]="_else";const Sr=70672;e[e._finally=Sr]="_finally";const Er=71696;e[e._for=Er]="_for";const Tr=73232;e[e._function=Tr]="_function";const Ar=73744;e[e._if=Ar]="_if";const Ir=74768;e[e._return=Ir]="_return";const Cr=75792;e[e._switch=Cr]="_switch";const Rr=77456;e[e._throw=Rr]="_throw";const Pr=77840;e[e._try=Pr]="_try";const Lr=78864;e[e._var=Lr]="_var";const Dr=79888;e[e._let=Dr]="_let";const Nr=80912;e[e._const=Nr]="_const";const Fr=81936;e[e._while=Fr]="_while";const Ur=82960;e[e._with=Ur]="_with";const Mr=84496;e[e._new=Mr]="_new";const Or=85520;e[e._this=Or]="_this";const Br=86544;e[e._super=Br]="_super";const Vr=87568;e[e._class=Vr]="_class";const jr=88080;e[e._extends=jr]="_extends";const $r=89104;e[e._export=$r]="_export";const qr=90640;e[e._import=qr]="_import";const Hr=91664;e[e._yield=Hr]="_yield";const Wr=92688;e[e._null=Wr]="_null";const Gr=93712;e[e._true=Gr]="_true";const Xr=94736;e[e._false=Xr]="_false";const Yr=95256;e[e._in=Yr]="_in";const zr=96280;e[e._instanceof=zr]="_instanceof";const Kr=97936;e[e._typeof=Kr]="_typeof";const Zr=98960;e[e._void=Zr]="_void";const Ul=99984;e[e._delete=Ul]="_delete";const Ml=100880;e[e._async=Ml]="_async";const Ol=101904;e[e._get=Ol]="_get";const Bl=102928;e[e._set=Bl]="_set";const Vl=103952;e[e._declare=Vl]="_declare";const jl=104976;e[e._readonly=jl]="_readonly";const $l=106e3;e[e._abstract=$l]="_abstract";const ql=107024;e[e._static=ql]="_static";const Hl=107536;e[e._public=Hl]="_public";const Wl=108560;e[e._private=Wl]="_private";const Gl=109584;e[e._protected=Gl]="_protected";const Xl=110608;e[e._override=Xl]="_override";const Yl=112144;e[e._as=Yl]="_as";const zl=113168;e[e._enum=zl]="_enum";const Kl=114192;e[e._type=Kl]="_type";const Zl=115216;e[e._implements=Zl]="_implements"})(r||(r={}));function Af(e){switch(e){case r.num:return"num";case r.bigint:return"bigint";case r.decimal:return"decimal";case r.regexp:return"regexp";case r.string:return"string";case r.name:return"name";case r.eof:return"eof";case r.bracketL:return"[";case r.bracketR:return"]";case r.braceL:return"{";case r.braceBarL:return"{|";case r.braceR:return"}";case r.braceBarR:return"|}";case r.parenL:return"(";case r.parenR:return")";case r.comma:return",";case r.semi:return";";case r.colon:return":";case r.doubleColon:return"::";case r.dot:return".";case r.question:return"?";case r.questionDot:return"?.";case r.arrow:return"=>";case r.template:return"template";case r.ellipsis:return"...";case r.backQuote:return"`";case r.dollarBraceL:return"${";case r.at:return"@";case r.hash:return"#";case r.eq:return"=";case r.assign:return"_=";case r.preIncDec:return"++/--";case r.postIncDec:return"++/--";case r.bang:return"!";case r.tilde:return"~";case r.pipeline:return"|>";case r.nullishCoalescing:return"??";case r.logicalOR:return"||";case r.logicalAND:return"&&";case r.bitwiseOR:return"|";case r.bitwiseXOR:return"^";case r.bitwiseAND:return"&";case r.equality:return"==/!=";case r.lessThan:return"<";case r.greaterThan:return">";case r.relationalOrEqual:return"<=/>=";case r.bitShiftL:return"<<";case r.bitShiftR:return">>/>>>";case r.plus:return"+";case r.minus:return"-";case r.modulo:return"%";case r.star:return"*";case r.slash:return"/";case r.exponent:return"**";case r.jsxName:return"jsxName";case r.jsxText:return"jsxText";case r.jsxEmptyText:return"jsxEmptyText";case r.jsxTagStart:return"jsxTagStart";case r.jsxTagEnd:return"jsxTagEnd";case r.typeParameterStart:return"typeParameterStart";case r.nonNullAssertion:return"nonNullAssertion";case r._break:return"break";case r._case:return"case";case r._catch:return"catch";case r._continue:return"continue";case r._debugger:return"debugger";case r._default:return"default";case r._do:return"do";case r._else:return"else";case r._finally:return"finally";case r._for:return"for";case r._function:return"function";case r._if:return"if";case r._return:return"return";case r._switch:return"switch";case r._throw:return"throw";case r._try:return"try";case r._var:return"var";case r._let:return"let";case r._const:return"const";case r._while:return"while";case r._with:return"with";case r._new:return"new";case r._this:return"this";case r._super:return"super";case r._class:return"class";case r._extends:return"extends";case r._export:return"export";case r._import:return"import";case r._yield:return"yield";case r._null:return"null";case r._true:return"true";case r._false:return"false";case r._in:return"in";case r._instanceof:return"instanceof";case r._typeof:return"typeof";case r._void:return"void";case r._delete:return"delete";case r._async:return"async";case r._get:return"get";case r._set:return"set";case r._declare:return"declare";case r._readonly:return"readonly";case r._abstract:return"abstract";case r._static:return"static";case r._public:return"public";case r._private:return"private";case r._protected:return"protected";case r._override:return"override";case r._as:return"as";case r._enum:return"enum";case r._type:return"type";case r._implements:return"implements";default:return""}}class At{constructor(t,s,i){this.startTokenIndex=t,this.endTokenIndex=s,this.isFunctionScope=i}}class If{constructor(t,s,i,n,a,o,u,l,h,d,m,_,k){this.potentialArrowAt=t,this.noAnonFunctionType=s,this.inDisallowConditionalTypesContext=i,this.tokensLength=n,this.scopesLength=a,this.pos=o,this.type=u,this.contextualKeyword=l,this.start=h,this.end=d,this.isType=m,this.scopeDepth=_,this.error=k}}class He{constructor(){He.prototype.__init.call(this),He.prototype.__init2.call(this),He.prototype.__init3.call(this),He.prototype.__init4.call(this),He.prototype.__init5.call(this),He.prototype.__init6.call(this),He.prototype.__init7.call(this),He.prototype.__init8.call(this),He.prototype.__init9.call(this),He.prototype.__init10.call(this),He.prototype.__init11.call(this),He.prototype.__init12.call(this),He.prototype.__init13.call(this)}__init(){this.potentialArrowAt=-1}__init2(){this.noAnonFunctionType=false}__init3(){this.inDisallowConditionalTypesContext=false}__init4(){this.tokens=[]}__init5(){this.scopes=[]}__init6(){this.pos=0}__init7(){this.type=r.eof}__init8(){this.contextualKeyword=g.NONE}__init9(){this.start=0}__init10(){this.end=0}__init11(){this.isType=false}__init12(){this.scopeDepth=0}__init13(){this.error=null}snapshot(){return new If(this.potentialArrowAt,this.noAnonFunctionType,this.inDisallowConditionalTypesContext,this.tokens.length,this.scopes.length,this.pos,this.type,this.contextualKeyword,this.start,this.end,this.isType,this.scopeDepth,this.error)}restoreFromSnapshot(t){this.potentialArrowAt=t.potentialArrowAt,this.noAnonFunctionType=t.noAnonFunctionType,this.inDisallowConditionalTypesContext=t.inDisallowConditionalTypesContext,this.tokens.length=t.tokensLength,this.scopes.length=t.scopesLength,this.pos=t.pos,this.type=t.type,this.contextualKeyword=t.contextualKeyword,this.start=t.start,this.end=t.end,this.isType=t.isType,this.scopeDepth=t.scopeDepth,this.error=t.error}}var y;(function(e){e[e.backSpace=8]="backSpace";const s=10;e[e.lineFeed=s]="lineFeed";const i=9;e[e.tab=i]="tab";const n=13;e[e.carriageReturn=n]="carriageReturn";const a=14;e[e.shiftOut=a]="shiftOut";const o=32;e[e.space=o]="space";const u=33;e[e.exclamationMark=u]="exclamationMark";const l=34;e[e.quotationMark=l]="quotationMark";const h=35;e[e.numberSign=h]="numberSign";const d=36;e[e.dollarSign=d]="dollarSign";const m=37;e[e.percentSign=m]="percentSign";const _=38;e[e.ampersand=_]="ampersand";const k=39;e[e.apostrophe=k]="apostrophe";const T=40;e[e.leftParenthesis=T]="leftParenthesis";const P=41;e[e.rightParenthesis=P]="rightParenthesis";const F=42;e[e.asterisk=F]="asterisk";const B=43;e[e.plusSign=B]="plusSign";const N=44;e[e.comma=N]="comma";const Y=45;e[e.dash=Y]="dash";const q=46;e[e.dot=q]="dot";const z=47;e[e.slash=z]="slash";const J=48;e[e.digit0=J]="digit0";const K=49;e[e.digit1=K]="digit1";const X=50;e[e.digit2=X]="digit2";const re=51;e[e.digit3=re]="digit3";const x=52;e[e.digit4=x]="digit4";const b=53;e[e.digit5=b]="digit5";const v=54;e[e.digit6=v]="digit6";const V=55;e[e.digit7=V]="digit7";const W=56;e[e.digit8=W]="digit8";const M=57;e[e.digit9=M]="digit9";const R=58;e[e.colon=R]="colon";const O=59;e[e.semicolon=O]="semicolon";const U=60;e[e.lessThan=U]="lessThan";const I=61;e[e.equalsTo=I]="equalsTo";const H=62;e[e.greaterThan=H]="greaterThan";const G=63;e[e.questionMark=G]="questionMark";const te=64;e[e.atSign=te]="atSign";const ce=65;e[e.uppercaseA=ce]="uppercaseA";const oe=66;e[e.uppercaseB=oe]="uppercaseB";const w=67;e[e.uppercaseC=w]="uppercaseC";const E=68;e[e.uppercaseD=E]="uppercaseD";const D=69;e[e.uppercaseE=D]="uppercaseE";const L=70;e[e.uppercaseF=L]="uppercaseF";const j=71;e[e.uppercaseG=j]="uppercaseG";const se=72;e[e.uppercaseH=se]="uppercaseH";const ne=73;e[e.uppercaseI=ne]="uppercaseI";const de=74;e[e.uppercaseJ=de]="uppercaseJ";const Se=75;e[e.uppercaseK=Se]="uppercaseK";const ke=76;e[e.uppercaseL=ke]="uppercaseL";const Fe=77;e[e.uppercaseM=Fe]="uppercaseM";const Xe=78;e[e.uppercaseN=Xe]="uppercaseN";const Ce=79;e[e.uppercaseO=Ce]="uppercaseO";const Ve=80;e[e.uppercaseP=Ve]="uppercaseP";const je=81;e[e.uppercaseQ=je]="uppercaseQ";const ts=82;e[e.uppercaseR=ts]="uppercaseR";const ds=83;e[e.uppercaseS=ds]="uppercaseS";const Rs=84;e[e.uppercaseT=Rs]="uppercaseT";const ar=85;e[e.uppercaseU=ar]="uppercaseU";const or=86;e[e.uppercaseV=or]="uppercaseV";const cr=87;e[e.uppercaseW=cr]="uppercaseW";const ur=88;e[e.uppercaseX=ur]="uppercaseX";const lr=89;e[e.uppercaseY=lr]="uppercaseY";const hr=90;e[e.uppercaseZ=hr]="uppercaseZ";const fr=91;e[e.leftSquareBracket=fr]="leftSquareBracket";const pr=92;e[e.backslash=pr]="backslash";const dr=93;e[e.rightSquareBracket=dr]="rightSquareBracket";const mr=94;e[e.caret=mr]="caret";const gr=95;e[e.underscore=gr]="underscore";const br=96;e[e.graveAccent=br]="graveAccent";const yr=97;e[e.lowercaseA=yr]="lowercaseA";const _r=98;e[e.lowercaseB=_r]="lowercaseB";const xr=99;e[e.lowercaseC=xr]="lowercaseC";const vr=100;e[e.lowercaseD=vr]="lowercaseD";const kr=101;e[e.lowercaseE=kr]="lowercaseE";const wr=102;e[e.lowercaseF=wr]="lowercaseF";const Sr=103;e[e.lowercaseG=Sr]="lowercaseG";const Er=104;e[e.lowercaseH=Er]="lowercaseH";const Tr=105;e[e.lowercaseI=Tr]="lowercaseI";const Ar=106;e[e.lowercaseJ=Ar]="lowercaseJ";const Ir=107;e[e.lowercaseK=Ir]="lowercaseK";const Cr=108;e[e.lowercaseL=Cr]="lowercaseL";const Rr=109;e[e.lowercaseM=Rr]="lowercaseM";const Pr=110;e[e.lowercaseN=Pr]="lowercaseN";const Lr=111;e[e.lowercaseO=Lr]="lowercaseO";const Dr=112;e[e.lowercaseP=Dr]="lowercaseP";const Nr=113;e[e.lowercaseQ=Nr]="lowercaseQ";const Fr=114;e[e.lowercaseR=Fr]="lowercaseR";const Ur=115;e[e.lowercaseS=Ur]="lowercaseS";const Mr=116;e[e.lowercaseT=Mr]="lowercaseT";const Or=117;e[e.lowercaseU=Or]="lowercaseU";const Br=118;e[e.lowercaseV=Br]="lowercaseV";const Vr=119;e[e.lowercaseW=Vr]="lowercaseW";const jr=120;e[e.lowercaseX=jr]="lowercaseX";const $r=121;e[e.lowercaseY=$r]="lowercaseY";const qr=122;e[e.lowercaseZ=qr]="lowercaseZ";const Hr=123;e[e.leftCurlyBrace=Hr]="leftCurlyBrace";const Wr=124;e[e.verticalBar=Wr]="verticalBar";const Gr=125;e[e.rightCurlyBrace=Gr]="rightCurlyBrace";const Xr=126;e[e.tilde=Xr]="tilde";const Yr=160;e[e.nonBreakingSpace=Yr]="nonBreakingSpace";const zr=5760;e[e.oghamSpaceMark=zr]="oghamSpaceMark";const Kr=8232;e[e.lineSeparator=Kr]="lineSeparator";const Zr=8233;e[e.paragraphSeparator=Zr]="paragraphSeparator"})(y||(y={}));let Qi,me,_e,c,$,_u;function Xs(){return _u++}function Cf(e){if("pos"in e){const t=Pf(e.pos);e.message+=` (${t.line}:${t.column})`,e.loc=t}return e}class Rf{constructor(t,s){this.line=t,this.column=s}}function Pf(e){let t=1,s=1;for(let i=0;i<e;i++)$.charCodeAt(i)===y.lineFeed?(t++,s=1):s++;return new Rf(t,s)}function Lf(e,t,s,i){$=e,c=new He,_u=1,Qi=t,me=s,_e=i}function ee(e){return c.contextualKeyword===e}function ma(e){const t=ri();return t.type===r.name&&t.contextualKeyword===e}function Le(e){return c.contextualKeyword===e&&S(r.name)}function Re(e){Le(e)||le()}function tt(){return p(r.eof)||p(r.braceR)||We()}function We(){const e=c.tokens[c.tokens.length-1],t=e?e.end:0;for(let s=t;s<c.start;s++){const i=$.charCodeAt(s);if(i===y.lineFeed||i===y.carriageReturn||i===8232||i===8233)return true}return false}function xu(){const e=ga();for(let t=c.end;t<e;t++){const s=$.charCodeAt(t);if(s===y.lineFeed||s===y.carriageReturn||s===8232||s===8233)return true}return false}function vt(){return S(r.semi)||tt()}function Ee(){vt()||le('Unexpected token, expected ";"')}function A(e){S(e)||le(`Unexpected token, expected "${Af(e)}"`)}function le(e="Unexpected token",t=c.start){if(c.error)return;const s=new SyntaxError(e);s.pos=t,c.error=s,c.pos=$.length,ue(r.eof)}const vu=[9,11,12,y.space,y.nonBreakingSpace,y.oghamSpaceMark,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279],Eo=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,ku=new Uint8Array(65536);for(const e of vu)ku[e]=1;function Df(e){if(e<48)return e===36;if(e<58)return true;if(e<65)return false;if(e<91)return true;if(e<97)return e===95;if(e<123)return true;if(e<128)return false;throw new Error("Should not be called with non-ASCII char code.")}const mt=new Uint8Array(65536);for(let e=0;e<128;e++)mt[e]=Df(e)?1:0;for(let e=128;e<65536;e++)mt[e]=1;for(const e of vu)mt[e]=0;mt[8232]=0;mt[8233]=0;const ii=mt.slice();for(let e=y.digit0;e<=y.digit9;e++)ii[e]=0;const To=new Int32Array([-1,27,783,918,1755,2376,2862,3483,-1,3699,-1,4617,4752,4833,5130,5508,5940,-1,6480,6939,7749,8181,8451,8613,-1,8829,-1,-1,-1,54,243,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,432,-1,-1,-1,675,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,81,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,108,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,135,-1,-1,-1,-1,-1,-1,-1,-1,-1,162,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,189,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,216,-1,-1,-1,-1,-1,-1,g._abstract<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,270,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,297,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,324,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,351,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,378,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,405,-1,-1,-1,-1,-1,-1,-1,-1,g._accessor<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._as<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,459,-1,-1,-1,-1,-1,594,-1,-1,-1,-1,-1,-1,486,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,513,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,540,-1,-1,-1,-1,-1,-1,g._assert<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,567,-1,-1,-1,-1,-1,-1,-1,g._asserts<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,621,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,648,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._async<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,702,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,729,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,756,-1,-1,-1,-1,-1,-1,g._await<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,810,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,837,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,864,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,891,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(r._break<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,945,-1,-1,-1,-1,-1,-1,1107,-1,-1,-1,1242,-1,-1,1350,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,972,1026,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,999,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(r._case<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1053,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1080,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(r._catch<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1134,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1161,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1188,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1215,-1,-1,-1,-1,-1,-1,-1,g._checks<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1269,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1296,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1323,-1,-1,-1,-1,-1,-1,-1,(r._class<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1377,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1404,1620,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1431,-1,-1,-1,-1,-1,-1,(r._const<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1458,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1485,-1,-1,-1,-1,-1,-1,-1,-1,1512,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1539,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1566,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1593,-1,-1,-1,-1,-1,-1,-1,-1,g._constructor<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1647,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1674,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1701,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1728,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(r._continue<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1782,-1,-1,-1,-1,-1,-1,-1,-1,-1,2349,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1809,1971,-1,-1,2106,-1,-1,-1,-1,-1,2241,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1836,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1863,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1890,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1917,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1944,-1,-1,-1,-1,-1,-1,-1,-1,(r._debugger<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,1998,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2025,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2052,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2079,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._declare<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2133,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2160,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2187,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2214,-1,-1,-1,-1,-1,-1,(r._default<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2268,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2295,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2322,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(r._delete<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(r._do<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2403,-1,2484,-1,-1,-1,-1,-1,-1,-1,-1,-1,2565,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2430,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2457,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(r._else<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2511,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2538,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._enum<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2592,-1,-1,-1,2727,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2619,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2646,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2673,-1,-1,-1,-1,-1,-1,(r._export<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2700,-1,-1,-1,-1,-1,-1,-1,g._exports<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2754,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2781,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2808,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2835,-1,-1,-1,-1,-1,-1,-1,(r._extends<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2889,-1,-1,-1,-1,-1,-1,-1,2997,-1,-1,-1,-1,-1,3159,-1,-1,3213,-1,-1,3294,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2916,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2943,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2970,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(r._false<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3024,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3051,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3078,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3105,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3132,-1,(r._finally<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3186,-1,-1,-1,-1,-1,-1,-1,-1,(r._for<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3240,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3267,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._from<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3321,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3348,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3375,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3402,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3429,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3456,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(r._function<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3510,-1,-1,-1,-1,-1,-1,3564,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3537,-1,-1,-1,-1,-1,-1,g._get<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3591,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3618,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3645,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3672,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._global<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3726,-1,-1,-1,-1,-1,-1,3753,4077,-1,-1,-1,-1,4590,-1,-1,-1,-1,-1,-1,-1,(r._if<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3780,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3807,-1,-1,3996,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3834,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3861,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3888,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3915,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3942,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,3969,-1,-1,-1,-1,-1,-1,-1,g._implements<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4023,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4050,-1,-1,-1,-1,-1,-1,(r._import<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(r._in<<1)+1,-1,-1,-1,-1,-1,4104,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4185,4401,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4131,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4158,-1,-1,-1,-1,-1,-1,-1,-1,g._infer<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4212,-1,-1,-1,-1,-1,-1,-1,4239,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4266,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4293,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4320,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4347,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4374,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(r._instanceof<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4428,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4455,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4482,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4509,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4536,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4563,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._interface<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._is<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4644,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4671,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4698,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4725,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._keyof<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4779,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4806,-1,-1,-1,-1,-1,-1,(r._let<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4860,-1,-1,-1,-1,-1,4995,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4887,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4914,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4941,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,4968,-1,-1,-1,-1,-1,-1,-1,g._mixins<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5022,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5049,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5076,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5103,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._module<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5157,-1,-1,-1,5373,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5427,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5184,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5211,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5238,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5265,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5292,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5319,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5346,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._namespace<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5400,-1,-1,-1,(r._new<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5454,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5481,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(r._null<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5535,-1,-1,-1,-1,-1,-1,-1,-1,-1,5562,-1,-1,-1,-1,5697,5751,-1,-1,-1,-1,g._of<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5589,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5616,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5643,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5670,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._opaque<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5724,-1,-1,-1,-1,-1,-1,g._out<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5778,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5805,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5832,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5859,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5886,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5913,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._override<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5967,-1,-1,6345,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,5994,-1,-1,-1,-1,-1,6129,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6021,-1,-1,-1,-1,-1,6048,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6075,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6102,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._private<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6156,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6183,-1,-1,-1,-1,-1,-1,-1,-1,-1,6318,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6210,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6237,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6264,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6291,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._protected<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._proto<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6372,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6399,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6426,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6453,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._public<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6507,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6534,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6696,-1,-1,6831,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6561,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6588,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6615,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6642,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6669,-1,g._readonly<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6723,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6750,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6777,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6804,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._require<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6858,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6885,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6912,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(r._return<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6966,-1,-1,-1,7182,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7236,7371,-1,7479,-1,7614,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,6993,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7020,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7047,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7074,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7101,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7128,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7155,-1,-1,-1,-1,-1,-1,-1,g._satisfies<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7209,-1,-1,-1,-1,-1,-1,g._set<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7263,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7290,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7317,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7344,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._static<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7398,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7425,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7452,-1,-1,-1,-1,-1,-1,-1,-1,(r._super<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7506,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7533,-1,-1,-1,-1,-1,-1,-1,-1,-1,7560,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7587,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(r._switch<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7641,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7668,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7695,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7722,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._symbol<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7776,-1,-1,-1,-1,-1,-1,-1,-1,-1,7938,-1,-1,-1,-1,-1,-1,8046,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7803,-1,-1,-1,-1,-1,-1,-1,-1,7857,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7830,-1,-1,-1,-1,-1,-1,-1,(r._this<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7884,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7911,-1,-1,-1,(r._throw<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,7965,-1,-1,-1,8019,-1,-1,-1,-1,-1,-1,7992,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(r._true<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(r._try<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8073,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8100,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._type<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8127,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8154,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(r._typeof<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8208,-1,-1,-1,-1,8343,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8235,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8262,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8289,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8316,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._unique<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8370,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8397,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8424,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,g._using<<1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8478,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8532,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8505,-1,-1,-1,-1,-1,-1,-1,-1,(r._var<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8559,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8586,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(r._void<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8640,8748,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8667,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8694,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8721,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(r._while<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8775,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8802,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(r._with<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8856,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8883,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8910,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,8937,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,(r._yield<<1)+1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1]);function Nf(){let e=0,t=0,s=c.pos;for(;s<$.length&&(t=$.charCodeAt(s),!(t<y.lowercaseA||t>y.lowercaseZ));){const n=To[e+(t-y.lowercaseA)+1];if(n===-1)break;e=n,s++}const i=To[e];if(i>-1&&!mt[t]){c.pos=s,i&1?ue(i>>>1):ue(r.name,i>>>1);return}for(;s<$.length;){const n=$.charCodeAt(s);if(mt[n])s++;else if(n===y.backslash){if(s+=2,$.charCodeAt(s)===y.leftCurlyBrace){for(;s<$.length&&$.charCodeAt(s)!==y.rightCurlyBrace;)s++;s++}}else if(n===y.atSign&&$.charCodeAt(s+1)===y.atSign)s+=2;else break}c.pos=s,ue(r.name)}var ie;(function(e){e[e.Access=0]="Access";const s=1;e[e.ExportAccess=s]="ExportAccess";const i=s+1;e[e.TopLevelDeclaration=i]="TopLevelDeclaration";const n=i+1;e[e.FunctionScopedDeclaration=n]="FunctionScopedDeclaration";const a=n+1;e[e.BlockScopedDeclaration=a]="BlockScopedDeclaration";const o=a+1;e[e.ObjectShorthandTopLevelDeclaration=o]="ObjectShorthandTopLevelDeclaration";const u=o+1;e[e.ObjectShorthandFunctionScopedDeclaration=u]="ObjectShorthandFunctionScopedDeclaration";const l=u+1;e[e.ObjectShorthandBlockScopedDeclaration=l]="ObjectShorthandBlockScopedDeclaration";const h=l+1;e[e.ObjectShorthand=h]="ObjectShorthand";const d=h+1;e[e.ImportDeclaration=d]="ImportDeclaration";const m=d+1;e[e.ObjectKey=m]="ObjectKey";const _=m+1;e[e.ImportAccess=_]="ImportAccess"})(ie||(ie={}));var ft;(function(e){e[e.NoChildren=0]="NoChildren";const s=1;e[e.OneChild=s]="OneChild";const i=s+1;e[e.StaticChildren=i]="StaticChildren";const n=i+1;e[e.KeyAfterPropSpread=n]="KeyAfterPropSpread"})(ft||(ft={}));function wu(e){const t=e.identifierRole;return t===ie.TopLevelDeclaration||t===ie.FunctionScopedDeclaration||t===ie.BlockScopedDeclaration||t===ie.ObjectShorthandTopLevelDeclaration||t===ie.ObjectShorthandFunctionScopedDeclaration||t===ie.ObjectShorthandBlockScopedDeclaration}function Ff(e){const t=e.identifierRole;return t===ie.FunctionScopedDeclaration||t===ie.BlockScopedDeclaration||t===ie.ObjectShorthandFunctionScopedDeclaration||t===ie.ObjectShorthandBlockScopedDeclaration}function Su(e){const t=e.identifierRole;return t===ie.TopLevelDeclaration||t===ie.ObjectShorthandTopLevelDeclaration||t===ie.ImportDeclaration}function Uf(e){const t=e.identifierRole;return t===ie.TopLevelDeclaration||t===ie.BlockScopedDeclaration||t===ie.ObjectShorthandTopLevelDeclaration||t===ie.ObjectShorthandBlockScopedDeclaration}function Mf(e){const t=e.identifierRole;return t===ie.FunctionScopedDeclaration||t===ie.ObjectShorthandFunctionScopedDeclaration}function Of(e){return e.identifierRole===ie.ObjectShorthandTopLevelDeclaration||e.identifierRole===ie.ObjectShorthandBlockScopedDeclaration||e.identifierRole===ie.ObjectShorthandFunctionScopedDeclaration}class Ji{constructor(){this.type=c.type,this.contextualKeyword=c.contextualKeyword,this.start=c.start,this.end=c.end,this.scopeDepth=c.scopeDepth,this.isType=c.isType,this.identifierRole=null,this.jsxRole=null,this.shadowsGlobal=false,this.isAsyncOperation=false,this.contextId=null,this.rhsEndIndex=null,this.isExpression=false,this.numNullishCoalesceStarts=0,this.numNullishCoalesceEnds=0,this.isOptionalChainStart=false,this.isOptionalChainEnd=false,this.subscriptStartIndex=null,this.nullishStartIndex=null}}function C(){c.tokens.push(new Ji),Iu()}function Xt(){c.tokens.push(new Ji),c.start=c.pos,tp()}function Bf(){c.type===r.assign&&--c.pos,Qf()}function pe(e){for(let s=c.tokens.length-e;s<c.tokens.length;s++)c.tokens[s].isType=true;const t=c.isType;return c.isType=true,t}function fe(e){c.isType=e}function S(e){return p(e)?(C(),true):false}function Eu(e){const t=c.isType;c.isType=true,S(e),c.isType=t}function p(e){return c.type===e}function Ae(){const e=c.snapshot();C();const t=c.type;return c.restoreFromSnapshot(e),t}class Vf{constructor(t,s){this.type=t,this.contextualKeyword=s}}function ri(){const e=c.snapshot();C();const t=c.type,s=c.contextualKeyword;return c.restoreFromSnapshot(e),new Vf(t,s)}function ga(){return Tu(c.pos)}function Tu(e){Eo.lastIndex=e;const t=Eo.exec($);return e+t[0].length}function Au(){return $.charCodeAt(ga())}function Iu(){if(Ru(),c.start=c.pos,c.pos>=$.length){const e=c.tokens;e.length>=2&&e[e.length-1].start>=$.length&&e[e.length-2].start>=$.length&&le("Unexpectedly reached the end of input."),ue(r.eof);return}jf($.charCodeAt(c.pos))}function jf(e){ii[e]||e===y.backslash||e===y.atSign&&$.charCodeAt(c.pos+1)===y.atSign?Nf():Du(e)}function $f(){for(;$.charCodeAt(c.pos)!==y.asterisk||$.charCodeAt(c.pos+1)!==y.slash;)if(c.pos++,c.pos>$.length){le("Unterminated comment",c.pos-2);return}c.pos+=2}function Cu(e){let t=$.charCodeAt(c.pos+=e);if(c.pos<$.length)for(;t!==y.lineFeed&&t!==y.carriageReturn&&t!==y.lineSeparator&&t!==y.paragraphSeparator&&++c.pos<$.length;)t=$.charCodeAt(c.pos)}function Ru(){for(;c.pos<$.length;){const e=$.charCodeAt(c.pos);switch(e){case y.carriageReturn:$.charCodeAt(c.pos+1)===y.lineFeed&&++c.pos;case y.lineFeed:case y.lineSeparator:case y.paragraphSeparator:++c.pos;break;case y.slash:switch($.charCodeAt(c.pos+1)){case y.asterisk:c.pos+=2,$f();break;case y.slash:Cu(2);break;default:return}break;default:if(ku[e])++c.pos;else return}}}function ue(e,t=g.NONE){c.end=c.pos,c.type=e,c.contextualKeyword=t}function qf(){const e=$.charCodeAt(c.pos+1);if(e>=y.digit0&&e<=y.digit9){Nu(true);return}e===y.dot&&$.charCodeAt(c.pos+2)===y.dot?(c.pos+=3,ue(r.ellipsis)):(++c.pos,ue(r.dot))}function Hf(){$.charCodeAt(c.pos+1)===y.equalsTo?ve(r.assign,2):ve(r.slash,1)}function Wf(e){let t=e===y.asterisk?r.star:r.modulo,s=1,i=$.charCodeAt(c.pos+1);e===y.asterisk&&i===y.asterisk&&(s++,i=$.charCodeAt(c.pos+2),t=r.exponent),i===y.equalsTo&&$.charCodeAt(c.pos+2)!==y.greaterThan&&(s++,t=r.assign),ve(t,s)}function Gf(e){const t=$.charCodeAt(c.pos+1);if(t===e){$.charCodeAt(c.pos+2)===y.equalsTo?ve(r.assign,3):ve(e===y.verticalBar?r.logicalOR:r.logicalAND,2);return}if(e===y.verticalBar){if(t===y.greaterThan){ve(r.pipeline,2);return}else if(t===y.rightCurlyBrace&&_e){ve(r.braceBarR,2);return}}if(t===y.equalsTo){ve(r.assign,2);return}ve(e===y.verticalBar?r.bitwiseOR:r.bitwiseAND,1)}function Xf(){$.charCodeAt(c.pos+1)===y.equalsTo?ve(r.assign,2):ve(r.bitwiseXOR,1)}function Yf(e){const t=$.charCodeAt(c.pos+1);if(t===e){ve(r.preIncDec,2);return}t===y.equalsTo?ve(r.assign,2):e===y.plusSign?ve(r.plus,1):ve(r.minus,1)}function zf(){const e=$.charCodeAt(c.pos+1);if(e===y.lessThan){if($.charCodeAt(c.pos+2)===y.equalsTo){ve(r.assign,3);return}c.isType?ve(r.lessThan,1):ve(r.bitShiftL,2);return}e===y.equalsTo?ve(r.relationalOrEqual,2):ve(r.lessThan,1)}function Pu(){if(c.isType){ve(r.greaterThan,1);return}const e=$.charCodeAt(c.pos+1);if(e===y.greaterThan){const t=$.charCodeAt(c.pos+2)===y.greaterThan?3:2;if($.charCodeAt(c.pos+t)===y.equalsTo){ve(r.assign,t+1);return}ve(r.bitShiftR,t);return}e===y.equalsTo?ve(r.relationalOrEqual,2):ve(r.greaterThan,1)}function Lu(){c.type===r.greaterThan&&(c.pos-=1,Pu())}function Kf(e){const t=$.charCodeAt(c.pos+1);if(t===y.equalsTo){ve(r.equality,$.charCodeAt(c.pos+2)===y.equalsTo?3:2);return}if(e===y.equalsTo&&t===y.greaterThan){c.pos+=2,ue(r.arrow);return}ve(e===y.equalsTo?r.eq:r.bang,1)}function Zf(){const e=$.charCodeAt(c.pos+1),t=$.charCodeAt(c.pos+2);e===y.questionMark&&!(_e&&c.isType)?t===y.equalsTo?ve(r.assign,3):ve(r.nullishCoalescing,2):e===y.dot&&!(t>=y.digit0&&t<=y.digit9)?(c.pos+=2,ue(r.questionDot)):(++c.pos,ue(r.question))}function Du(e){switch(e){case y.numberSign:++c.pos,ue(r.hash);return;case y.dot:qf();return;case y.leftParenthesis:++c.pos,ue(r.parenL);return;case y.rightParenthesis:++c.pos,ue(r.parenR);return;case y.semicolon:++c.pos,ue(r.semi);return;case y.comma:++c.pos,ue(r.comma);return;case y.leftSquareBracket:++c.pos,ue(r.bracketL);return;case y.rightSquareBracket:++c.pos,ue(r.bracketR);return;case y.leftCurlyBrace:_e&&$.charCodeAt(c.pos+1)===y.verticalBar?ve(r.braceBarL,2):(++c.pos,ue(r.braceL));return;case y.rightCurlyBrace:++c.pos,ue(r.braceR);return;case y.colon:$.charCodeAt(c.pos+1)===y.colon?ve(r.doubleColon,2):(++c.pos,ue(r.colon));return;case y.questionMark:Zf();return;case y.atSign:++c.pos,ue(r.at);return;case y.graveAccent:++c.pos,ue(r.backQuote);return;case y.digit0:{const t=$.charCodeAt(c.pos+1);if(t===y.lowercaseX||t===y.uppercaseX||t===y.lowercaseO||t===y.uppercaseO||t===y.lowercaseB||t===y.uppercaseB){Jf();return}}case y.digit1:case y.digit2:case y.digit3:case y.digit4:case y.digit5:case y.digit6:case y.digit7:case y.digit8:case y.digit9:Nu(false);return;case y.quotationMark:case y.apostrophe:ep(e);return;case y.slash:Hf();return;case y.percentSign:case y.asterisk:Wf(e);return;case y.verticalBar:case y.ampersand:Gf(e);return;case y.caret:Xf();return;case y.plusSign:case y.dash:Yf(e);return;case y.lessThan:zf();return;case y.greaterThan:Pu();return;case y.equalsTo:case y.exclamationMark:Kf(e);return;case y.tilde:ve(r.tilde,1);return}le(`Unexpected character '${String.fromCharCode(e)}'`,c.pos)}function ve(e,t){c.pos+=t,ue(e)}function Qf(){const e=c.pos;let t=false,s=false;for(;;){if(c.pos>=$.length){le("Unterminated regular expression",e);return}const i=$.charCodeAt(c.pos);if(t)t=false;else{if(i===y.leftSquareBracket)s=true;else if(i===y.rightSquareBracket&&s)s=false;else if(i===y.slash&&!s)break;t=i===y.backslash}++c.pos}++c.pos,sp(),ue(r.regexp)}function fn(){for(;;){const e=$.charCodeAt(c.pos);if(e>=y.digit0&&e<=y.digit9||e===y.underscore)c.pos++;else break}}function Jf(){for(c.pos+=2;;){const t=$.charCodeAt(c.pos);if(t>=y.digit0&&t<=y.digit9||t>=y.lowercaseA&&t<=y.lowercaseF||t>=y.uppercaseA&&t<=y.uppercaseF||t===y.underscore)c.pos++;else break}$.charCodeAt(c.pos)===y.lowercaseN?(++c.pos,ue(r.bigint)):ue(r.num)}function Nu(e){let t=false,s=false;e||fn();let i=$.charCodeAt(c.pos);if(i===y.dot&&(++c.pos,fn(),i=$.charCodeAt(c.pos)),(i===y.uppercaseE||i===y.lowercaseE)&&(i=$.charCodeAt(++c.pos),(i===y.plusSign||i===y.dash)&&++c.pos,fn(),i=$.charCodeAt(c.pos)),i===y.lowercaseN?(++c.pos,t=true):i===y.lowercaseM&&(++c.pos,s=true),t){ue(r.bigint);return}if(s){ue(r.decimal);return}ue(r.num)}function ep(e){for(c.pos++;;){if(c.pos>=$.length){le("Unterminated string constant");return}const t=$.charCodeAt(c.pos);if(t===y.backslash)c.pos++;else if(t===e)break;c.pos++}c.pos++,ue(r.string)}function tp(){for(;;){if(c.pos>=$.length){le("Unterminated template");return}const e=$.charCodeAt(c.pos);if(e===y.graveAccent||e===y.dollarSign&&$.charCodeAt(c.pos+1)===y.leftCurlyBrace){if(c.pos===c.start&&p(r.template))if(e===y.dollarSign){c.pos+=2,ue(r.dollarBraceL);return}else{++c.pos,ue(r.backQuote);return}ue(r.template);return}e===y.backslash&&c.pos++,c.pos++}}function sp(){for(;c.pos<$.length;){const e=$.charCodeAt(c.pos);if(mt[e])c.pos++;else if(e===y.backslash){if(c.pos+=2,$.charCodeAt(c.pos)===y.leftCurlyBrace){for(;c.pos<$.length&&$.charCodeAt(c.pos)!==y.rightCurlyBrace;)c.pos++;c.pos++}}else break}}function Ys(e,t=e.currentIndex()){let s=t+1;if(fi(e,s)){const i=e.identifierNameAtIndex(t);return{isType:false,leftName:i,rightName:i,endIndex:s}}if(s++,fi(e,s))return{isType:true,leftName:null,rightName:null,endIndex:s};if(s++,fi(e,s))return{isType:false,leftName:e.identifierNameAtIndex(t),rightName:e.identifierNameAtIndex(t+2),endIndex:s};if(s++,fi(e,s))return{isType:true,leftName:null,rightName:null,endIndex:s};throw new Error(`Unexpected import/export specifier at ${t}`)}function fi(e,t){const s=e.tokens[t];return s.type===r.braceR||s.type===r.comma}var ip=new Map([["quot",'"'],["amp","&"],["apos","'"],["lt","<"],["gt",">"],["nbsp"," "],["iexcl","¡"],["cent","¢"],["pound","£"],["curren","¤"],["yen","¥"],["brvbar","¦"],["sect","§"],["uml","¨"],["copy","©"],["ordf","ª"],["laquo","«"],["not","¬"],["shy","­"],["reg","®"],["macr","¯"],["deg","°"],["plusmn","±"],["sup2","²"],["sup3","³"],["acute","´"],["micro","µ"],["para","¶"],["middot","·"],["cedil","¸"],["sup1","¹"],["ordm","º"],["raquo","»"],["frac14","¼"],["frac12","½"],["frac34","¾"],["iquest","¿"],["Agrave","À"],["Aacute","Á"],["Acirc","Â"],["Atilde","Ã"],["Auml","Ä"],["Aring","Å"],["AElig","Æ"],["Ccedil","Ç"],["Egrave","È"],["Eacute","É"],["Ecirc","Ê"],["Euml","Ë"],["Igrave","Ì"],["Iacute","Í"],["Icirc","Î"],["Iuml","Ï"],["ETH","Ð"],["Ntilde","Ñ"],["Ograve","Ò"],["Oacute","Ó"],["Ocirc","Ô"],["Otilde","Õ"],["Ouml","Ö"],["times","×"],["Oslash","Ø"],["Ugrave","Ù"],["Uacute","Ú"],["Ucirc","Û"],["Uuml","Ü"],["Yacute","Ý"],["THORN","Þ"],["szlig","ß"],["agrave","à"],["aacute","á"],["acirc","â"],["atilde","ã"],["auml","ä"],["aring","å"],["aelig","æ"],["ccedil","ç"],["egrave","è"],["eacute","é"],["ecirc","ê"],["euml","ë"],["igrave","ì"],["iacute","í"],["icirc","î"],["iuml","ï"],["eth","ð"],["ntilde","ñ"],["ograve","ò"],["oacute","ó"],["ocirc","ô"],["otilde","õ"],["ouml","ö"],["divide","÷"],["oslash","ø"],["ugrave","ù"],["uacute","ú"],["ucirc","û"],["uuml","ü"],["yacute","ý"],["thorn","þ"],["yuml","ÿ"],["OElig","Œ"],["oelig","œ"],["Scaron","Š"],["scaron","š"],["Yuml","Ÿ"],["fnof","ƒ"],["circ","ˆ"],["tilde","˜"],["Alpha","Α"],["Beta","Β"],["Gamma","Γ"],["Delta","Δ"],["Epsilon","Ε"],["Zeta","Ζ"],["Eta","Η"],["Theta","Θ"],["Iota","Ι"],["Kappa","Κ"],["Lambda","Λ"],["Mu","Μ"],["Nu","Ν"],["Xi","Ξ"],["Omicron","Ο"],["Pi","Π"],["Rho","Ρ"],["Sigma","Σ"],["Tau","Τ"],["Upsilon","Υ"],["Phi","Φ"],["Chi","Χ"],["Psi","Ψ"],["Omega","Ω"],["alpha","α"],["beta","β"],["gamma","γ"],["delta","δ"],["epsilon","ε"],["zeta","ζ"],["eta","η"],["theta","θ"],["iota","ι"],["kappa","κ"],["lambda","λ"],["mu","μ"],["nu","ν"],["xi","ξ"],["omicron","ο"],["pi","π"],["rho","ρ"],["sigmaf","ς"],["sigma","σ"],["tau","τ"],["upsilon","υ"],["phi","φ"],["chi","χ"],["psi","ψ"],["omega","ω"],["thetasym","ϑ"],["upsih","ϒ"],["piv","ϖ"],["ensp"," "],["emsp"," "],["thinsp"," "],["zwnj","‌"],["zwj","‍"],["lrm","‎"],["rlm","‏"],["ndash","–"],["mdash","—"],["lsquo","‘"],["rsquo","’"],["sbquo","‚"],["ldquo","“"],["rdquo","”"],["bdquo","„"],["dagger","†"],["Dagger","‡"],["bull","•"],["hellip","…"],["permil","‰"],["prime","′"],["Prime","″"],["lsaquo","‹"],["rsaquo","›"],["oline","‾"],["frasl","⁄"],["euro","€"],["image","ℑ"],["weierp","℘"],["real","ℜ"],["trade","™"],["alefsym","ℵ"],["larr","←"],["uarr","↑"],["rarr","→"],["darr","↓"],["harr","↔"],["crarr","↵"],["lArr","⇐"],["uArr","⇑"],["rArr","⇒"],["dArr","⇓"],["hArr","⇔"],["forall","∀"],["part","∂"],["exist","∃"],["empty","∅"],["nabla","∇"],["isin","∈"],["notin","∉"],["ni","∋"],["prod","∏"],["sum","∑"],["minus","−"],["lowast","∗"],["radic","√"],["prop","∝"],["infin","∞"],["ang","∠"],["and","∧"],["or","∨"],["cap","∩"],["cup","∪"],["int","∫"],["there4","∴"],["sim","∼"],["cong","≅"],["asymp","≈"],["ne","≠"],["equiv","≡"],["le","≤"],["ge","≥"],["sub","⊂"],["sup","⊃"],["nsub","⊄"],["sube","⊆"],["supe","⊇"],["oplus","⊕"],["otimes","⊗"],["perp","⊥"],["sdot","⋅"],["lceil","⌈"],["rceil","⌉"],["lfloor","⌊"],["rfloor","⌋"],["lang","〈"],["rang","〉"],["loz","◊"],["spades","♠"],["clubs","♣"],["hearts","♥"],["diams","♦"]]);function Fu(e){const[t,s]=Ao(e.jsxPragma||"React.createElement"),[i,n]=Ao(e.jsxFragmentPragma||"React.Fragment");return{base:t,suffix:s,fragmentBase:i,fragmentSuffix:n}}function Ao(e){let t=e.indexOf(".");return t===-1&&(t=e.length),[e.slice(0,t),e.slice(t)]}class gt{getPrefixCode(){return""}getHoistedCode(){return""}getSuffixCode(){return""}}class ss extends gt{__init(){this.lastLineNumber=1}__init2(){this.lastIndex=0}__init3(){this.filenameVarName=null}__init4(){this.esmAutomaticImportNameResolutions={}}__init5(){this.cjsAutomaticModuleNameResolutions={}}constructor(t,s,i,n,a){super(),this.rootTransformer=t,this.tokens=s,this.importProcessor=i,this.nameManager=n,this.options=a,ss.prototype.__init.call(this),ss.prototype.__init2.call(this),ss.prototype.__init3.call(this),ss.prototype.__init4.call(this),ss.prototype.__init5.call(this),this.jsxPragmaInfo=Fu(a),this.isAutomaticRuntime=a.jsxRuntime==="automatic",this.jsxImportSource=a.jsxImportSource||"react"}process(){return this.tokens.matches1(r.jsxTagStart)?(this.processJSXTag(),true):false}getPrefixCode(){let t="";if(this.filenameVarName&&(t+=`const ${this.filenameVarName} = ${JSON.stringify(this.options.filePath||"")};`),this.isAutomaticRuntime)if(this.importProcessor)for(const[s,i]of Object.entries(this.cjsAutomaticModuleNameResolutions))t+=`var ${i} = require("${s}");`;else{const{createElement:s,...i}=this.esmAutomaticImportNameResolutions;s&&(t+=`import {createElement as ${s}} from "${this.jsxImportSource}";`);const n=Object.entries(i).map(([a,o])=>`${a} as ${o}`).join(", ");if(n){const a=this.jsxImportSource+(this.options.production?"/jsx-runtime":"/jsx-dev-runtime");t+=`import {${n}} from "${a}";`}}return t}processJSXTag(){const{jsxRole:t,start:s}=this.tokens.currentToken(),i=this.options.production?null:this.getElementLocationCode(s);this.isAutomaticRuntime&&t!==ft.KeyAfterPropSpread?this.transformTagToJSXFunc(i,t):this.transformTagToCreateElement(i)}getElementLocationCode(t){return`lineNumber: ${this.getLineNumberForIndex(t)}`}getLineNumberForIndex(t){const s=this.tokens.code;for(;this.lastIndex<t&&this.lastIndex<s.length;)s[this.lastIndex]===`
449
- `&&this.lastLineNumber++,this.lastIndex++;return this.lastLineNumber}transformTagToJSXFunc(t,s){const i=s===ft.StaticChildren;this.tokens.replaceToken(this.getJSXFuncInvocationCode(i));let n=null;if(this.tokens.matches1(r.jsxTagEnd))this.tokens.replaceToken(`${this.getFragmentCode()}, {`),this.processAutomaticChildrenAndEndProps(s);else{if(this.processTagIntro(),this.tokens.appendCode(", {"),n=this.processProps(true),this.tokens.matches2(r.slash,r.jsxTagEnd))this.tokens.appendCode("}");else if(this.tokens.matches1(r.jsxTagEnd))this.tokens.removeToken(),this.processAutomaticChildrenAndEndProps(s);else throw new Error("Expected either /> or > at the end of the tag.");n&&this.tokens.appendCode(`, ${n}`)}for(this.options.production||(n===null&&this.tokens.appendCode(", void 0"),this.tokens.appendCode(`, ${i}, ${this.getDevSource(t)}, this`)),this.tokens.removeInitialToken();!this.tokens.matches1(r.jsxTagEnd);)this.tokens.removeToken();this.tokens.replaceToken(")")}transformTagToCreateElement(t){if(this.tokens.replaceToken(this.getCreateElementInvocationCode()),this.tokens.matches1(r.jsxTagEnd))this.tokens.replaceToken(`${this.getFragmentCode()}, null`),this.processChildren(true);else if(this.processTagIntro(),this.processPropsObjectWithDevInfo(t),!this.tokens.matches2(r.slash,r.jsxTagEnd))if(this.tokens.matches1(r.jsxTagEnd))this.tokens.removeToken(),this.processChildren(true);else throw new Error("Expected either /> or > at the end of the tag.");for(this.tokens.removeInitialToken();!this.tokens.matches1(r.jsxTagEnd);)this.tokens.removeToken();this.tokens.replaceToken(")")}getJSXFuncInvocationCode(t){return this.options.production?t?this.claimAutoImportedFuncInvocation("jsxs","/jsx-runtime"):this.claimAutoImportedFuncInvocation("jsx","/jsx-runtime"):this.claimAutoImportedFuncInvocation("jsxDEV","/jsx-dev-runtime")}getCreateElementInvocationCode(){if(this.isAutomaticRuntime)return this.claimAutoImportedFuncInvocation("createElement","");{const{jsxPragmaInfo:t}=this;return`${this.importProcessor&&this.importProcessor.getIdentifierReplacement(t.base)||t.base}${t.suffix}(`}}getFragmentCode(){if(this.isAutomaticRuntime)return this.claimAutoImportedName("Fragment",this.options.production?"/jsx-runtime":"/jsx-dev-runtime");{const{jsxPragmaInfo:t}=this;return(this.importProcessor&&this.importProcessor.getIdentifierReplacement(t.fragmentBase)||t.fragmentBase)+t.fragmentSuffix}}claimAutoImportedFuncInvocation(t,s){const i=this.claimAutoImportedName(t,s);return this.importProcessor?`${i}.call(void 0, `:`${i}(`}claimAutoImportedName(t,s){if(this.importProcessor){const i=this.jsxImportSource+s;return this.cjsAutomaticModuleNameResolutions[i]||(this.cjsAutomaticModuleNameResolutions[i]=this.importProcessor.getFreeIdentifierForPath(i)),`${this.cjsAutomaticModuleNameResolutions[i]}.${t}`}else return this.esmAutomaticImportNameResolutions[t]||(this.esmAutomaticImportNameResolutions[t]=this.nameManager.claimFreeName(`_${t}`)),this.esmAutomaticImportNameResolutions[t]}processTagIntro(){let t=this.tokens.currentIndex()+1;for(;this.tokens.tokens[t].isType||!this.tokens.matches2AtIndex(t-1,r.jsxName,r.jsxName)&&!this.tokens.matches2AtIndex(t-1,r.greaterThan,r.jsxName)&&!this.tokens.matches1AtIndex(t,r.braceL)&&!this.tokens.matches1AtIndex(t,r.jsxTagEnd)&&!this.tokens.matches2AtIndex(t,r.slash,r.jsxTagEnd);)t++;if(t===this.tokens.currentIndex()+1){const s=this.tokens.identifierName();Uu(s)&&this.tokens.replaceToken(`'${s}'`)}for(;this.tokens.currentIndex()<t;)this.rootTransformer.processToken()}processPropsObjectWithDevInfo(t){const s=this.options.production?"":`__self: this, __source: ${this.getDevSource(t)}`;if(!this.tokens.matches1(r.jsxName)&&!this.tokens.matches1(r.braceL)){s?this.tokens.appendCode(`, {${s}}`):this.tokens.appendCode(", null");return}this.tokens.appendCode(", {"),this.processProps(false),s?this.tokens.appendCode(` ${s}}`):this.tokens.appendCode("}")}processProps(t){let s=null;for(;;){if(this.tokens.matches2(r.jsxName,r.eq)){const i=this.tokens.identifierName();if(t&&i==="key"){s!==null&&this.tokens.appendCode(s.replace(/[^\n]/g,"")),this.tokens.removeToken(),this.tokens.removeToken();const n=this.tokens.snapshot();this.processPropValue(),s=this.tokens.dangerouslyGetAndRemoveCodeSinceSnapshot(n);continue}else this.processPropName(i),this.tokens.replaceToken(": "),this.processPropValue()}else if(this.tokens.matches1(r.jsxName)){const i=this.tokens.identifierName();this.processPropName(i),this.tokens.appendCode(": true")}else if(this.tokens.matches1(r.braceL))this.tokens.replaceToken(""),this.rootTransformer.processBalancedCode(),this.tokens.replaceToken("");else break;this.tokens.appendCode(",")}return s}processPropName(t){t.includes("-")?this.tokens.replaceToken(`'${t}'`):this.tokens.copyToken()}processPropValue(){this.tokens.matches1(r.braceL)?(this.tokens.replaceToken(""),this.rootTransformer.processBalancedCode(),this.tokens.replaceToken("")):this.tokens.matches1(r.jsxTagStart)?this.processJSXTag():this.processStringPropValue()}processStringPropValue(){const t=this.tokens.currentToken(),s=this.tokens.code.slice(t.start+1,t.end-1),i=Io(s),n=np(s);this.tokens.replaceToken(n+i)}processAutomaticChildrenAndEndProps(t){t===ft.StaticChildren?(this.tokens.appendCode(" children: ["),this.processChildren(false),this.tokens.appendCode("]}")):(t===ft.OneChild&&this.tokens.appendCode(" children: "),this.processChildren(false),this.tokens.appendCode("}"))}processChildren(t){let s=t;for(;;){if(this.tokens.matches2(r.jsxTagStart,r.slash))return;let i=false;if(this.tokens.matches1(r.braceL))this.tokens.matches2(r.braceL,r.braceR)?(this.tokens.replaceToken(""),this.tokens.replaceToken("")):(this.tokens.replaceToken(s?", ":""),this.rootTransformer.processBalancedCode(),this.tokens.replaceToken(""),i=true);else if(this.tokens.matches1(r.jsxTagStart))this.tokens.appendCode(s?", ":""),this.processJSXTag(),i=true;else if(this.tokens.matches1(r.jsxText)||this.tokens.matches1(r.jsxEmptyText))i=this.processChildTextElement(s);else throw new Error("Unexpected token when processing JSX children.");i&&(s=true)}}processChildTextElement(t){const s=this.tokens.currentToken(),i=this.tokens.code.slice(s.start,s.end),n=Io(i),a=rp(i);return a==='""'?(this.tokens.replaceToken(n),false):(this.tokens.replaceToken(`${t?", ":""}${a}${n}`),true)}getDevSource(t){return`{fileName: ${this.getFilenameVarName()}, ${t}}`}getFilenameVarName(){return this.filenameVarName||(this.filenameVarName=this.nameManager.claimFreeName("_jsxFileName")),this.filenameVarName}}function Uu(e){const t=e.charCodeAt(0);return t>=y.lowercaseA&&t<=y.lowercaseZ}function rp(e){let t="",s="",i=false,n=false;for(let a=0;a<e.length;a++){const o=e[a];if(o===" "||o===" "||o==="\r")i||(s+=o);else if(o===`
450
- `)s="",i=true;else{if(n&&i&&(t+=" "),t+=s,s="",o==="&"){const{entity:u,newI:l}=Mu(e,a+1);a=l-1,t+=u}else t+=o;n=true,i=false}}return i||(t+=s),JSON.stringify(t)}function Io(e){let t=0,s=0;for(const i of e)i===`
451
- `?(t++,s=0):i===" "&&s++;return`
452
- `.repeat(t)+" ".repeat(s)}function np(e){let t="";for(let s=0;s<e.length;s++){const i=e[s];if(i===`
453
- `)if(/\s/.test(e[s+1]))for(t+=" ";s<e.length&&/\s/.test(e[s+1]);)s++;else t+=`
454
- `;else if(i==="&"){const{entity:n,newI:a}=Mu(e,s+1);t+=n,s=a-1}else t+=i}return JSON.stringify(t)}function Mu(e,t){let s="",i=0,n,a=t;if(e[a]==="#"){let o=10;a++;let u;if(e[a]==="x")for(o=16,a++,u=a;a<e.length&&op(e.charCodeAt(a));)a++;else for(u=a;a<e.length&&ap(e.charCodeAt(a));)a++;if(e[a]===";"){const l=e.slice(u,a);l&&(a++,n=String.fromCodePoint(parseInt(l,o)))}}else for(;a<e.length&&i++<10;){const o=e[a];if(a++,o===";"){n=ip.get(s);break}s+=o}return n?{entity:n,newI:a}:{entity:"&",newI:t}}function ap(e){return e>=y.digit0&&e<=y.digit9}function op(e){return e>=y.digit0&&e<=y.digit9||e>=y.lowercaseA&&e<=y.lowercaseF||e>=y.uppercaseA&&e<=y.uppercaseF}function Ou(e,t){const s=Fu(t),i=new Set;for(let n=0;n<e.tokens.length;n++){const a=e.tokens[n];if(a.type===r.name&&!a.isType&&(a.identifierRole===ie.Access||a.identifierRole===ie.ObjectShorthand||a.identifierRole===ie.ExportAccess)&&!a.shadowsGlobal&&i.add(e.identifierNameForToken(a)),a.type===r.jsxTagStart&&i.add(s.base),a.type===r.jsxTagStart&&n+1<e.tokens.length&&e.tokens[n+1].type===r.jsxTagEnd&&(i.add(s.base),i.add(s.fragmentBase)),a.type===r.jsxName&&a.identifierRole===ie.Access){const o=e.identifierNameForToken(a);(!Uu(o)||e.tokens[n+1].type===r.dot)&&i.add(e.identifierNameForToken(a))}}return i}class is{__init(){this.nonTypeIdentifiers=new Set}__init2(){this.importInfoByPath=new Map}__init3(){this.importsToReplace=new Map}__init4(){this.identifierReplacements=new Map}__init5(){this.exportBindingsByLocalName=new Map}constructor(t,s,i,n,a,o,u){this.nameManager=t,this.tokens=s,this.enableLegacyTypeScriptModuleInterop=i,this.options=n,this.isTypeScriptTransformEnabled=a,this.keepUnusedImports=o,this.helperManager=u,is.prototype.__init.call(this),is.prototype.__init2.call(this),is.prototype.__init3.call(this),is.prototype.__init4.call(this),is.prototype.__init5.call(this)}preprocessTokens(){for(let t=0;t<this.tokens.tokens.length;t++)this.tokens.matches1AtIndex(t,r._import)&&!this.tokens.matches3AtIndex(t,r._import,r.name,r.eq)&&this.preprocessImportAtIndex(t),this.tokens.matches1AtIndex(t,r._export)&&!this.tokens.matches2AtIndex(t,r._export,r.eq)&&this.preprocessExportAtIndex(t);this.generateImportReplacements()}pruneTypeOnlyImports(){this.nonTypeIdentifiers=Ou(this.tokens,this.options);for(const[t,s]of this.importInfoByPath.entries()){if(s.hasBareImport||s.hasStarExport||s.exportStarNames.length>0||s.namedExports.length>0)continue;[...s.defaultNames,...s.wildcardNames,...s.namedImports.map(({localName:n})=>n)].every(n=>this.shouldAutomaticallyElideImportedName(n))&&this.importsToReplace.set(t,"")}}shouldAutomaticallyElideImportedName(t){return this.isTypeScriptTransformEnabled&&!this.keepUnusedImports&&!this.nonTypeIdentifiers.has(t)}generateImportReplacements(){for(const[t,s]of this.importInfoByPath.entries()){const{defaultNames:i,wildcardNames:n,namedImports:a,namedExports:o,exportStarNames:u,hasStarExport:l}=s;if(i.length===0&&n.length===0&&a.length===0&&o.length===0&&u.length===0&&!l){this.importsToReplace.set(t,`require('${t}');`);continue}const h=this.getFreeIdentifierForPath(t);let d;this.enableLegacyTypeScriptModuleInterop?d=h:d=n.length>0?n[0]:this.getFreeIdentifierForPath(t);let m=`var ${h} = require('${t}');`;if(n.length>0)for(const _ of n){const k=this.enableLegacyTypeScriptModuleInterop?h:`${this.helperManager.getHelperName("interopRequireWildcard")}(${h})`;m+=` var ${_} = ${k};`}else u.length>0&&d!==h?m+=` var ${d} = ${this.helperManager.getHelperName("interopRequireWildcard")}(${h});`:i.length>0&&d!==h&&(m+=` var ${d} = ${this.helperManager.getHelperName("interopRequireDefault")}(${h});`);for(const{importedName:_,localName:k}of o)m+=` ${this.helperManager.getHelperName("createNamedExportFrom")}(${h}, '${k}', '${_}');`;for(const _ of u)m+=` exports.${_} = ${d};`;l&&(m+=` ${this.helperManager.getHelperName("createStarExport")}(${h});`),this.importsToReplace.set(t,m);for(const _ of i)this.identifierReplacements.set(_,`${d}.default`);for(const{importedName:_,localName:k}of a)this.identifierReplacements.set(k,`${h}.${_}`)}}getFreeIdentifierForPath(t){const s=t.split("/"),n=s[s.length-1].replace(/\W/g,"");return this.nameManager.claimFreeName(`_${n}`)}preprocessImportAtIndex(t){const s=[],i=[],n=[];if(t++,(this.tokens.matchesContextualAtIndex(t,g._type)||this.tokens.matches1AtIndex(t,r._typeof))&&!this.tokens.matches1AtIndex(t+1,r.comma)&&!this.tokens.matchesContextualAtIndex(t+1,g._from)||this.tokens.matches1AtIndex(t,r.parenL))return;if(this.tokens.matches1AtIndex(t,r.name)&&(s.push(this.tokens.identifierNameAtIndex(t)),t++,this.tokens.matches1AtIndex(t,r.comma)&&t++),this.tokens.matches1AtIndex(t,r.star)&&(t+=2,i.push(this.tokens.identifierNameAtIndex(t)),t++),this.tokens.matches1AtIndex(t,r.braceL)){const u=this.getNamedImports(t+1);t=u.newIndex;for(const l of u.namedImports)l.importedName==="default"?s.push(l.localName):n.push(l)}if(this.tokens.matchesContextualAtIndex(t,g._from)&&t++,!this.tokens.matches1AtIndex(t,r.string))throw new Error("Expected string token at the end of import statement.");const a=this.tokens.stringValueAtIndex(t),o=this.getImportInfo(a);o.defaultNames.push(...s),o.wildcardNames.push(...i),o.namedImports.push(...n),s.length===0&&i.length===0&&n.length===0&&(o.hasBareImport=true)}preprocessExportAtIndex(t){if(this.tokens.matches2AtIndex(t,r._export,r._var)||this.tokens.matches2AtIndex(t,r._export,r._let)||this.tokens.matches2AtIndex(t,r._export,r._const))this.preprocessVarExportAtIndex(t);else if(this.tokens.matches2AtIndex(t,r._export,r._function)||this.tokens.matches2AtIndex(t,r._export,r._class)){const s=this.tokens.identifierNameAtIndex(t+2);this.addExportBinding(s,s)}else if(this.tokens.matches3AtIndex(t,r._export,r.name,r._function)){const s=this.tokens.identifierNameAtIndex(t+3);this.addExportBinding(s,s)}else this.tokens.matches2AtIndex(t,r._export,r.braceL)?this.preprocessNamedExportAtIndex(t):this.tokens.matches2AtIndex(t,r._export,r.star)&&this.preprocessExportStarAtIndex(t)}preprocessVarExportAtIndex(t){let s=0;for(let i=t+2;;i++)if(this.tokens.matches1AtIndex(i,r.braceL)||this.tokens.matches1AtIndex(i,r.dollarBraceL)||this.tokens.matches1AtIndex(i,r.bracketL))s++;else if(this.tokens.matches1AtIndex(i,r.braceR)||this.tokens.matches1AtIndex(i,r.bracketR))s--;else{if(s===0&&!this.tokens.matches1AtIndex(i,r.name))break;if(this.tokens.matches1AtIndex(1,r.eq)){const n=this.tokens.currentToken().rhsEndIndex;if(n==null)throw new Error("Expected = token with an end index.");i=n-1}else{const n=this.tokens.tokens[i];if(wu(n)){const a=this.tokens.identifierNameAtIndex(i);this.identifierReplacements.set(a,`exports.${a}`)}}}}preprocessNamedExportAtIndex(t){t+=2;const{newIndex:s,namedImports:i}=this.getNamedImports(t);if(t=s,this.tokens.matchesContextualAtIndex(t,g._from))t++;else{for(const{importedName:o,localName:u}of i)this.addExportBinding(o,u);return}if(!this.tokens.matches1AtIndex(t,r.string))throw new Error("Expected string token at the end of import statement.");const n=this.tokens.stringValueAtIndex(t);this.getImportInfo(n).namedExports.push(...i)}preprocessExportStarAtIndex(t){let s=null;if(this.tokens.matches3AtIndex(t,r._export,r.star,r._as)?(t+=3,s=this.tokens.identifierNameAtIndex(t),t+=2):t+=3,!this.tokens.matches1AtIndex(t,r.string))throw new Error("Expected string token at the end of star export statement.");const i=this.tokens.stringValueAtIndex(t),n=this.getImportInfo(i);s!==null?n.exportStarNames.push(s):n.hasStarExport=true}getNamedImports(t){const s=[];for(;;){if(this.tokens.matches1AtIndex(t,r.braceR)){t++;break}const i=Ys(this.tokens,t);if(t=i.endIndex,i.isType||s.push({importedName:i.leftName,localName:i.rightName}),this.tokens.matches2AtIndex(t,r.comma,r.braceR)){t+=2;break}else if(this.tokens.matches1AtIndex(t,r.braceR)){t++;break}else if(this.tokens.matches1AtIndex(t,r.comma))t++;else throw new Error(`Unexpected token: ${JSON.stringify(this.tokens.tokens[t])}`)}return{newIndex:t,namedImports:s}}getImportInfo(t){const s=this.importInfoByPath.get(t);if(s)return s;const i={defaultNames:[],wildcardNames:[],namedImports:[],namedExports:[],hasBareImport:false,exportStarNames:[],hasStarExport:false};return this.importInfoByPath.set(t,i),i}addExportBinding(t,s){this.exportBindingsByLocalName.has(t)||this.exportBindingsByLocalName.set(t,[]),this.exportBindingsByLocalName.get(t).push(s)}claimImportCode(t){const s=this.importsToReplace.get(t);return this.importsToReplace.set(t,""),s||""}getIdentifierReplacement(t){return this.identifierReplacements.get(t)||null}resolveExportBinding(t){const s=this.exportBindingsByLocalName.get(t);return!s||s.length===0?null:s.map(i=>`exports.${i}`).join(" = ")}getGlobalNames(){return new Set([...this.identifierReplacements.keys(),...this.exportBindingsByLocalName.keys()])}}var cp=44,up=59,Co="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Bu=new Uint8Array(64),lp=new Uint8Array(128);for(let e=0;e<Co.length;e++){const t=Co.charCodeAt(e);Bu[e]=t,lp[t]=e}function Ds(e,t,s){let i=t-s;i=i<0?-i<<1|1:i<<1;do{let n=i&31;i>>>=5,i>0&&(n|=32),e.write(Bu[n])}while(i>0);return t}var Ro=1024*16,Po=typeof TextDecoder<"u"?new TextDecoder:typeof Buffer<"u"?{decode(e){return Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString()}}:{decode(e){let t="";for(let s=0;s<e.length;s++)t+=String.fromCharCode(e[s]);return t}},hp=class{constructor(){this.pos=0,this.out="",this.buffer=new Uint8Array(Ro)}write(e){const{buffer:t}=this;t[this.pos++]=e,this.pos===Ro&&(this.out+=Po.decode(t),this.pos=0)}flush(){const{buffer:e,out:t,pos:s}=this;return s>0?t+Po.decode(e.subarray(0,s)):t}};function fp(e){const t=new hp;let s=0,i=0,n=0,a=0;for(let o=0;o<e.length;o++){const u=e[o];if(o>0&&t.write(up),u.length===0)continue;let l=0;for(let h=0;h<u.length;h++){const d=u[h];h>0&&t.write(cp),l=Ds(t,d[0],l),d.length!==1&&(s=Ds(t,d[1],s),i=Ds(t,d[2],i),n=Ds(t,d[3],n),d.length!==4&&(a=Ds(t,d[4],a)))}}return t.flush()}var os=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},pp={exports:{}};(function(e,t){(function(s,i){e.exports=i()})(os,function(){const s=/^[\w+.-]+:\/\//,i=/^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/,n=/^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;function a(N){return s.test(N)}function o(N){return N.startsWith("//")}function u(N){return N.startsWith("/")}function l(N){return N.startsWith("file:")}function h(N){return/^[.?#]/.test(N)}function d(N){const Y=i.exec(N);return _(Y[1],Y[2]||"",Y[3],Y[4]||"",Y[5]||"/",Y[6]||"",Y[7]||"")}function m(N){const Y=n.exec(N),q=Y[2];return _("file:","",Y[1]||"","",u(q)?q:"/"+q,Y[3]||"",Y[4]||"")}function _(N,Y,q,z,J,K,X){return{scheme:N,user:Y,host:q,port:z,path:J,query:K,hash:X,type:7}}function k(N){if(o(N)){const q=d("http:"+N);return q.scheme="",q.type=6,q}if(u(N)){const q=d("http://foo.com"+N);return q.scheme="",q.host="",q.type=5,q}if(l(N))return m(N);if(a(N))return d(N);const Y=d("http://foo.com/"+N);return Y.scheme="",Y.host="",Y.type=N?N.startsWith("?")?3:N.startsWith("#")?2:4:1,Y}function T(N){if(N.endsWith("/.."))return N;const Y=N.lastIndexOf("/");return N.slice(0,Y+1)}function P(N,Y){F(Y,Y.type),N.path==="/"?N.path=Y.path:N.path=T(Y.path)+N.path}function F(N,Y){const q=Y<=4,z=N.path.split("/");let J=1,K=0,X=false;for(let x=1;x<z.length;x++){const b=z[x];if(!b){X=true;continue}if(X=false,b!=="."){if(b===".."){K?(X=true,K--,J--):q&&(z[J++]=b);continue}z[J++]=b,K++}}let re="";for(let x=1;x<J;x++)re+="/"+z[x];(!re||X&&!re.endsWith("/.."))&&(re+="/"),N.path=re}function B(N,Y){if(!N&&!Y)return"";const q=k(N);let z=q.type;if(Y&&z!==7){const K=k(Y),X=K.type;switch(z){case 1:q.hash=K.hash;case 2:q.query=K.query;case 3:case 4:P(q,K);case 5:q.user=K.user,q.host=K.host,q.port=K.port;case 6:q.scheme=K.scheme}X>z&&(z=X)}F(q,z);const J=q.query+q.hash;switch(z){case 2:case 3:return J;case 4:{const K=q.path.slice(1);return K?h(Y||N)&&!h(K)?"./"+K+J:K+J:J||"."}case 5:return q.path+J;default:return q.scheme+"//"+q.user+q.host+q.port+q.path+J}}return B})})(pp);var pn=class{constructor(){this._indexes={__proto__:null},this.array=[]}};function dp(e,t){return e._indexes[t]}function mp(e,t){const s=dp(e,t);if(s!==void 0)return s;const{array:i,_indexes:n}=e,a=i.push(t);return n[t]=a-1}var gp=0,bp=1,yp=2,_p=3,xp=4,Vu=-1,vp=class{constructor({file:e,sourceRoot:t}={}){this._names=new pn,this._sources=new pn,this._sourcesContent=[],this._mappings=[],this.file=e,this.sourceRoot=t,this._ignoreList=new pn}};var dn=(e,t,s,i,n,a,o,u)=>Sp(true,e,t,s,i,n,a);function kp(e){const{_mappings:t,_sources:s,_sourcesContent:i,_names:n,_ignoreList:a}=e;return Ap(t),{version:3,file:e.file||void 0,names:n.array,sourceRoot:e.sourceRoot||void 0,sources:s.array,sourcesContent:i,mappings:t,ignoreList:a.array}}function wp(e){const t=kp(e);return Object.assign({},t,{mappings:fp(t.mappings)})}function Sp(e,t,s,i,n,a,o,u,l){const{_mappings:h,_sources:d,_sourcesContent:m,_names:_}=t,k=Ep(h,s),T=Tp(k,i);if(!n)return Ip(k,T)?void 0:Lo(k,T,[i]);const P=mp(d,n),F=Vu;if(P===m.length&&(m[P]=null),!Cp(k,T,P,a,o,F))return Lo(k,T,[i,P,a,o])}function Ep(e,t){for(let s=e.length;s<=t;s++)e[s]=[];return e[t]}function Tp(e,t){let s=e.length;for(let i=s-1;i>=0;s=i--){const n=e[i];if(t>=n[gp])break}return s}function Lo(e,t,s){for(let i=e.length;i>t;i--)e[i]=e[i-1];e[t]=s}function Ap(e){const{length:t}=e;let s=t;for(let i=s-1;i>=0&&!(e[i].length>0);s=i,i--);s<t&&(e.length=s)}function Ip(e,t){return t===0?true:e[t-1].length===1}function Cp(e,t,s,i,n,a){if(t===0)return false;const o=e[t-1];return o.length===1?false:s===o[bp]&&i===o[yp]&&n===o[_p]&&a===(o.length===5?o[xp]:Vu)}function Rp({code:e,mappings:t},s,i,n,a){const o=Pp(n,a),u=new vp({file:i.compiledFilename});let l=0,h=t[0];for(;h===void 0&&l<t.length-1;)l++,h=t[l];let d=0,m=0;h!==m&&dn(u,d,0,s,d,0);for(let P=0;P<e.length;P++){if(P===h){const F=h-m,B=o[l];for(dn(u,d,F,s,d,B);(h===P||h===void 0)&&l<t.length-1;)l++,h=t[l]}e.charCodeAt(P)===y.lineFeed&&(d++,m=P+1,h!==m&&dn(u,d,0,s,d,0))}const{sourceRoot:_,sourcesContent:k,...T}=wp(u);return T}function Pp(e,t){const s=new Array(t.length);let i=0,n=t[i].start,a=0;for(let o=0;o<e.length;o++)o===n&&(s[i]=n-a,i++,n=t[i].start),e.charCodeAt(o)===y.lineFeed&&(a=o+1);return s}const Lp={require:`
455
- import {createRequire as CREATE_REQUIRE_NAME} from "module";
456
- const require = CREATE_REQUIRE_NAME(import.meta.url);
457
- `,interopRequireWildcard:`
458
- function interopRequireWildcard(obj) {
459
- if (obj && obj.__esModule) {
460
- return obj;
461
- } else {
462
- var newObj = {};
463
- if (obj != null) {
464
- for (var key in obj) {
465
- if (Object.prototype.hasOwnProperty.call(obj, key)) {
466
- newObj[key] = obj[key];
467
- }
468
- }
469
- }
470
- newObj.default = obj;
471
- return newObj;
472
- }
473
- }
474
- `,interopRequireDefault:`
475
- function interopRequireDefault(obj) {
476
- return obj && obj.__esModule ? obj : { default: obj };
477
- }
478
- `,createNamedExportFrom:`
479
- function createNamedExportFrom(obj, localName, importedName) {
480
- Object.defineProperty(exports, localName, {enumerable: true, configurable: true, get: () => obj[importedName]});
481
- }
482
- `,createStarExport:`
483
- function createStarExport(obj) {
484
- Object.keys(obj)
485
- .filter((key) => key !== "default" && key !== "__esModule")
486
- .forEach((key) => {
487
- if (exports.hasOwnProperty(key)) {
488
- return;
489
- }
490
- Object.defineProperty(exports, key, {enumerable: true, configurable: true, get: () => obj[key]});
491
- });
492
- }
493
- `,nullishCoalesce:`
494
- function nullishCoalesce(lhs, rhsFn) {
495
- if (lhs != null) {
496
- return lhs;
497
- } else {
498
- return rhsFn();
499
- }
500
- }
501
- `,asyncNullishCoalesce:`
502
- async function asyncNullishCoalesce(lhs, rhsFn) {
503
- if (lhs != null) {
504
- return lhs;
505
- } else {
506
- return await rhsFn();
507
- }
508
- }
509
- `,optionalChain:`
510
- function optionalChain(ops) {
511
- let lastAccessLHS = undefined;
512
- let value = ops[0];
513
- let i = 1;
514
- while (i < ops.length) {
515
- const op = ops[i];
516
- const fn = ops[i + 1];
517
- i += 2;
518
- if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) {
519
- return undefined;
520
- }
521
- if (op === 'access' || op === 'optionalAccess') {
522
- lastAccessLHS = value;
523
- value = fn(value);
524
- } else if (op === 'call' || op === 'optionalCall') {
525
- value = fn((...args) => value.call(lastAccessLHS, ...args));
526
- lastAccessLHS = undefined;
527
- }
528
- }
529
- return value;
530
- }
531
- `,asyncOptionalChain:`
532
- async function asyncOptionalChain(ops) {
533
- let lastAccessLHS = undefined;
534
- let value = ops[0];
535
- let i = 1;
536
- while (i < ops.length) {
537
- const op = ops[i];
538
- const fn = ops[i + 1];
539
- i += 2;
540
- if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) {
541
- return undefined;
542
- }
543
- if (op === 'access' || op === 'optionalAccess') {
544
- lastAccessLHS = value;
545
- value = await fn(value);
546
- } else if (op === 'call' || op === 'optionalCall') {
547
- value = await fn((...args) => value.call(lastAccessLHS, ...args));
548
- lastAccessLHS = undefined;
549
- }
550
- }
551
- return value;
552
- }
553
- `,optionalChainDelete:`
554
- function optionalChainDelete(ops) {
555
- const result = OPTIONAL_CHAIN_NAME(ops);
556
- return result == null ? true : result;
557
- }
558
- `,asyncOptionalChainDelete:`
559
- async function asyncOptionalChainDelete(ops) {
560
- const result = await ASYNC_OPTIONAL_CHAIN_NAME(ops);
561
- return result == null ? true : result;
562
- }
563
- `};class Ri{__init(){this.helperNames={}}__init2(){this.createRequireName=null}constructor(t){this.nameManager=t,Ri.prototype.__init.call(this),Ri.prototype.__init2.call(this)}getHelperName(t){let s=this.helperNames[t];return s||(s=this.nameManager.claimFreeName(`_${t}`),this.helperNames[t]=s,s)}emitHelpers(){let t="";this.helperNames.optionalChainDelete&&this.getHelperName("optionalChain"),this.helperNames.asyncOptionalChainDelete&&this.getHelperName("asyncOptionalChain");for(const[s,i]of Object.entries(Lp)){const n=this.helperNames[s];let a=i;s==="optionalChainDelete"?a=a.replace("OPTIONAL_CHAIN_NAME",this.helperNames.optionalChain):s==="asyncOptionalChainDelete"?a=a.replace("ASYNC_OPTIONAL_CHAIN_NAME",this.helperNames.asyncOptionalChain):s==="require"&&(this.createRequireName===null&&(this.createRequireName=this.nameManager.claimFreeName("_createRequire")),a=a.replace(/CREATE_REQUIRE_NAME/g,this.createRequireName)),n&&(t+=" ",t+=a.replace(s,n).replace(/\s+/g," ").trim())}return t}}function Do(e,t,s){Dp(e,s)&&Np(e,t,s)}function Dp(e,t){for(const s of e.tokens)if(s.type===r.name&&!s.isType&&Ff(s)&&t.has(e.identifierNameForToken(s)))return true;return false}function Np(e,t,s){const i=[];let n=t.length-1;for(let a=e.tokens.length-1;;a--){for(;i.length>0&&i[i.length-1].startTokenIndex===a+1;)i.pop();for(;n>=0&&t[n].endTokenIndex===a+1;)i.push(t[n]),n--;if(a<0)break;const o=e.tokens[a],u=e.identifierNameForToken(o);if(i.length>1&&!o.isType&&o.type===r.name&&s.has(u)){if(Uf(o))No(i[i.length-1],e,u);else if(Mf(o)){let l=i.length-1;for(;l>0&&!i[l].isFunctionScope;)l--;if(l<0)throw new Error("Did not find parent function scope.");No(i[l],e,u)}}}if(i.length>0)throw new Error("Expected empty scope stack after processing file.")}function No(e,t,s){for(let i=e.startTokenIndex;i<e.endTokenIndex;i++){const n=t.tokens[i];(n.type===r.name||n.type===r.jsxName)&&t.identifierNameForToken(n)===s&&(n.shadowsGlobal=true)}}function Fp(e,t){const s=[];for(const i of t)i.type===r.name&&s.push(e.slice(i.start,i.end));return s}class ba{__init(){this.usedNames=new Set}constructor(t,s){ba.prototype.__init.call(this),this.usedNames=new Set(Fp(t,s))}claimFreeName(t){const s=this.findFreeName(t);return this.usedNames.add(s),s}findFreeName(t){if(!this.usedNames.has(t))return t;let s=2;for(;this.usedNames.has(t+String(s));)s++;return t+String(s)}}var we={},Dn={},wt={},Up=os&&os.__extends||function(){var e=function(t,s){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,n){i.__proto__=n}||function(i,n){for(var a in n)n.hasOwnProperty(a)&&(i[a]=n[a])},e(t,s)};return function(t,s){e(t,s);function i(){this.constructor=t}t.prototype=s===null?Object.create(s):(i.prototype=s.prototype,new i)}}();Object.defineProperty(wt,"__esModule",{value:true});wt.DetailContext=wt.NoopContext=wt.VError=void 0;var ju=function(e){Up(t,e);function t(s,i){var n=e.call(this,i)||this;return n.path=s,Object.setPrototypeOf(n,t.prototype),n}return t}(Error);wt.VError=ju;var Mp=function(){function e(){}return e.prototype.fail=function(t,s,i){return false},e.prototype.unionResolver=function(){return this},e.prototype.createContext=function(){return this},e.prototype.resolveUnion=function(t){},e}();wt.NoopContext=Mp;var $u=function(){function e(){this._propNames=[""],this._messages=[null],this._score=0}return e.prototype.fail=function(t,s,i){return this._propNames.push(t),this._messages.push(s),this._score+=i,false},e.prototype.unionResolver=function(){return new Op},e.prototype.resolveUnion=function(t){for(var s,i,n=t,a=null,o=0,u=n.contexts;o<u.length;o++){var l=u[o];(!a||l._score>=a._score)&&(a=l)}a&&a._score>0&&((s=this._propNames).push.apply(s,a._propNames),(i=this._messages).push.apply(i,a._messages))},e.prototype.getError=function(t){for(var s=[],i=this._propNames.length-1;i>=0;i--){var n=this._propNames[i];t+=typeof n=="number"?"["+n+"]":n?"."+n:"";var a=this._messages[i];a&&s.push(t+" "+a)}return new ju(t,s.join("; "))},e.prototype.getErrorDetail=function(t){for(var s=[],i=this._propNames.length-1;i>=0;i--){var n=this._propNames[i];t+=typeof n=="number"?"["+n+"]":n?"."+n:"";var a=this._messages[i];a&&s.push({path:t,message:a})}for(var o=null,i=s.length-1;i>=0;i--)o&&(s[i].nested=[o]),o=s[i];return o},e}();wt.DetailContext=$u;var Op=function(){function e(){this.contexts=[]}return e.prototype.createContext=function(){var t=new $u;return this.contexts.push(t),t},e}();(function(e){var t=os&&os.__extends||function(){var w=function(E,D){return w=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(L,j){L.__proto__=j}||function(L,j){for(var se in j)j.hasOwnProperty(se)&&(L[se]=j[se])},w(E,D)};return function(E,D){w(E,D);function L(){this.constructor=E}E.prototype=D===null?Object.create(D):(L.prototype=D.prototype,new L)}}();Object.defineProperty(e,"__esModule",{value:true}),e.basicTypes=e.BasicType=e.TParamList=e.TParam=e.param=e.TFunc=e.func=e.TProp=e.TOptional=e.opt=e.TIface=e.iface=e.TEnumLiteral=e.enumlit=e.TEnumType=e.enumtype=e.TIntersection=e.intersection=e.TUnion=e.union=e.TTuple=e.tuple=e.TArray=e.array=e.TLiteral=e.lit=e.TName=e.name=e.TType=void 0;var s=wt,i=function(){function w(){}return w}();e.TType=i;function n(w){return typeof w=="string"?o(w):w}function a(w,E){var D=w[E];if(!D)throw new Error("Unknown type "+E);return D}function o(w){return new u(w)}e.name=o;var u=function(w){t(E,w);function E(D){var L=w.call(this)||this;return L.name=D,L._failMsg="is not a "+D,L}return E.prototype.getChecker=function(D,L,j){var se=this,ne=a(D,this.name),de=ne.getChecker(D,L,j);return ne instanceof U||ne instanceof E?de:function(Se,ke){return de(Se,ke)?true:ke.fail(null,se._failMsg,0)}},E}(i);e.TName=u;function l(w){return new h(w)}e.lit=l;var h=function(w){t(E,w);function E(D){var L=w.call(this)||this;return L.value=D,L.name=JSON.stringify(D),L._failMsg="is not "+L.name,L}return E.prototype.getChecker=function(D,L){var j=this;return function(se,ne){return se===j.value?true:ne.fail(null,j._failMsg,-1)}},E}(i);e.TLiteral=h;function d(w){return new m(n(w))}e.array=d;var m=function(w){t(E,w);function E(D){var L=w.call(this)||this;return L.ttype=D,L}return E.prototype.getChecker=function(D,L){var j=this.ttype.getChecker(D,L);return function(se,ne){if(!Array.isArray(se))return ne.fail(null,"is not an array",0);for(var de=0;de<se.length;de++){var Se=j(se[de],ne);if(!Se)return ne.fail(de,null,1)}return true}},E}(i);e.TArray=m;function _(){for(var w=[],E=0;E<arguments.length;E++)w[E]=arguments[E];return new k(w.map(function(D){return n(D)}))}e.tuple=_;var k=function(w){t(E,w);function E(D){var L=w.call(this)||this;return L.ttypes=D,L}return E.prototype.getChecker=function(D,L){var j=this.ttypes.map(function(ne){return ne.getChecker(D,L)}),se=function(ne,de){if(!Array.isArray(ne))return de.fail(null,"is not an array",0);for(var Se=0;Se<j.length;Se++){var ke=j[Se](ne[Se],de);if(!ke)return de.fail(Se,null,1)}return true};return L?function(ne,de){return se(ne,de)?ne.length<=j.length?true:de.fail(j.length,"is extraneous",2):false}:se},E}(i);e.TTuple=k;function T(){for(var w=[],E=0;E<arguments.length;E++)w[E]=arguments[E];return new P(w.map(function(D){return n(D)}))}e.union=T;var P=function(w){t(E,w);function E(D){var L=w.call(this)||this;L.ttypes=D;var j=D.map(function(ne){return ne instanceof u||ne instanceof h?ne.name:null}).filter(function(ne){return ne}),se=D.length-j.length;return j.length?(se>0&&j.push(se+" more"),L._failMsg="is none of "+j.join(", ")):L._failMsg="is none of "+se+" types",L}return E.prototype.getChecker=function(D,L){var j=this,se=this.ttypes.map(function(ne){return ne.getChecker(D,L)});return function(ne,de){for(var Se=de.unionResolver(),ke=0;ke<se.length;ke++){var Fe=se[ke](ne,Se.createContext());if(Fe)return true}return de.resolveUnion(Se),de.fail(null,j._failMsg,0)}},E}(i);e.TUnion=P;function F(){for(var w=[],E=0;E<arguments.length;E++)w[E]=arguments[E];return new B(w.map(function(D){return n(D)}))}e.intersection=F;var B=function(w){t(E,w);function E(D){var L=w.call(this)||this;return L.ttypes=D,L}return E.prototype.getChecker=function(D,L){var j=new Set,se=this.ttypes.map(function(ne){return ne.getChecker(D,L,j)});return function(ne,de){var Se=se.every(function(ke){return ke(ne,de)});return Se?true:de.fail(null,null,0)}},E}(i);e.TIntersection=B;function N(w){return new Y(w)}e.enumtype=N;var Y=function(w){t(E,w);function E(D){var L=w.call(this)||this;return L.members=D,L.validValues=new Set,L._failMsg="is not a valid enum value",L.validValues=new Set(Object.keys(D).map(function(j){return D[j]})),L}return E.prototype.getChecker=function(D,L){var j=this;return function(se,ne){return j.validValues.has(se)?true:ne.fail(null,j._failMsg,0)}},E}(i);e.TEnumType=Y;function q(w,E){return new z(w,E)}e.enumlit=q;var z=function(w){t(E,w);function E(D,L){var j=w.call(this)||this;return j.enumName=D,j.prop=L,j._failMsg="is not "+D+"."+L,j}return E.prototype.getChecker=function(D,L){var j=this,se=a(D,this.enumName);if(!(se instanceof Y))throw new Error("Type "+this.enumName+" used in enumlit is not an enum type");var ne=se.members[this.prop];if(!se.members.hasOwnProperty(this.prop))throw new Error("Unknown value "+this.enumName+"."+this.prop+" used in enumlit");return function(de,Se){return de===ne?true:Se.fail(null,j._failMsg,-1)}},E}(i);e.TEnumLiteral=z;function J(w){return Object.keys(w).map(function(E){return K(E,w[E])})}function K(w,E){return E instanceof b?new v(w,E.ttype,true):new v(w,n(E),false)}function X(w,E){return new re(w,J(E))}e.iface=X;var re=function(w){t(E,w);function E(D,L){var j=w.call(this)||this;return j.bases=D,j.props=L,j.propSet=new Set(L.map(function(se){return se.name})),j}return E.prototype.getChecker=function(D,L,j){var se=this,ne=this.bases.map(function(Ce){return a(D,Ce).getChecker(D,L)}),de=this.props.map(function(Ce){return Ce.ttype.getChecker(D,L)}),Se=new s.NoopContext,ke=this.props.map(function(Ce,Ve){return!Ce.isOpt&&!de[Ve](void 0,Se)}),Fe=function(Ce,Ve){if(typeof Ce!="object"||Ce===null)return Ve.fail(null,"is not an object",0);for(var je=0;je<ne.length;je++)if(!ne[je](Ce,Ve))return false;for(var je=0;je<de.length;je++){var ts=se.props[je].name,ds=Ce[ts];if(ds===void 0){if(ke[je])return Ve.fail(ts,"is missing",1)}else{var Rs=de[je](ds,Ve);if(!Rs)return Ve.fail(ts,null,1)}}return true};if(!L)return Fe;var Xe=this.propSet;return j&&(this.propSet.forEach(function(Ce){return j.add(Ce)}),Xe=j),function(Ce,Ve){if(!Fe(Ce,Ve))return false;for(var je in Ce)if(!Xe.has(je))return Ve.fail(je,"is extraneous",2);return true}},E}(i);e.TIface=re;function x(w){return new b(n(w))}e.opt=x;var b=function(w){t(E,w);function E(D){var L=w.call(this)||this;return L.ttype=D,L}return E.prototype.getChecker=function(D,L){var j=this.ttype.getChecker(D,L);return function(se,ne){return se===void 0||j(se,ne)}},E}(i);e.TOptional=b;var v=function(){function w(E,D,L){this.name=E,this.ttype=D,this.isOpt=L}return w}();e.TProp=v;function V(w){for(var E=[],D=1;D<arguments.length;D++)E[D-1]=arguments[D];return new W(new O(E),n(w))}e.func=V;var W=function(w){t(E,w);function E(D,L){var j=w.call(this)||this;return j.paramList=D,j.result=L,j}return E.prototype.getChecker=function(D,L){return function(j,se){return typeof j=="function"?true:se.fail(null,"is not a function",0)}},E}(i);e.TFunc=W;function M(w,E,D){return new R(w,n(E),!!D)}e.param=M;var R=function(){function w(E,D,L){this.name=E,this.ttype=D,this.isOpt=L}return w}();e.TParam=R;var O=function(w){t(E,w);function E(D){var L=w.call(this)||this;return L.params=D,L}return E.prototype.getChecker=function(D,L){var j=this,se=this.params.map(function(ke){return ke.ttype.getChecker(D,L)}),ne=new s.NoopContext,de=this.params.map(function(ke,Fe){return!ke.isOpt&&!se[Fe](void 0,ne)}),Se=function(ke,Fe){if(!Array.isArray(ke))return Fe.fail(null,"is not an array",0);for(var Xe=0;Xe<se.length;Xe++){var Ce=j.params[Xe];if(ke[Xe]===void 0){if(de[Xe])return Fe.fail(Ce.name,"is missing",1)}else{var Ve=se[Xe](ke[Xe],Fe);if(!Ve)return Fe.fail(Ce.name,null,1)}}return true};return L?function(ke,Fe){return Se(ke,Fe)?ke.length<=se.length?true:Fe.fail(se.length,"is extraneous",2):false}:Se},E}(i);e.TParamList=O;var U=function(w){t(E,w);function E(D,L){var j=w.call(this)||this;return j.validator=D,j.message=L,j}return E.prototype.getChecker=function(D,L){var j=this;return function(se,ne){return j.validator(se)?true:ne.fail(null,j.message,0)}},E}(i);e.BasicType=U,e.basicTypes={any:new U(function(w){return true},"is invalid"),number:new U(function(w){return typeof w=="number"},"is not a number"),object:new U(function(w){return typeof w=="object"&&w},"is not an object"),boolean:new U(function(w){return typeof w=="boolean"},"is not a boolean"),string:new U(function(w){return typeof w=="string"},"is not a string"),symbol:new U(function(w){return typeof w=="symbol"},"is not a symbol"),void:new U(function(w){return w==null},"is not void"),undefined:new U(function(w){return w===void 0},"is not undefined"),null:new U(function(w){return w===null},"is not null"),never:new U(function(w){return false},"is unexpected"),Date:new U(H("[object Date]"),"is not a Date"),RegExp:new U(H("[object RegExp]"),"is not a RegExp")};var I=Object.prototype.toString;function H(w){return function(E){return typeof E=="object"&&E&&I.call(E)===w}}typeof Buffer<"u"&&(e.basicTypes.Buffer=new U(function(w){return Buffer.isBuffer(w)},"is not a Buffer"));for(var G=function(w){e.basicTypes[w.name]=new U(function(E){return E instanceof w},"is not a "+w.name)},te=0,ce=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,ArrayBuffer];te<ce.length;te++){var oe=ce[te];G(oe)}})(Dn);(function(e){var t=os&&os.__spreadArrays||function(){for(var l=0,h=0,d=arguments.length;h<d;h++)l+=arguments[h].length;for(var m=Array(l),_=0,h=0;h<d;h++)for(var k=arguments[h],T=0,P=k.length;T<P;T++,_++)m[_]=k[T];return m};Object.defineProperty(e,"__esModule",{value:true}),e.Checker=e.createCheckers=void 0;var s=Dn,i=wt,n=Dn;Object.defineProperty(e,"TArray",{enumerable:true,get:function(){return n.TArray}}),Object.defineProperty(e,"TEnumType",{enumerable:true,get:function(){return n.TEnumType}}),Object.defineProperty(e,"TEnumLiteral",{enumerable:true,get:function(){return n.TEnumLiteral}}),Object.defineProperty(e,"TFunc",{enumerable:true,get:function(){return n.TFunc}}),Object.defineProperty(e,"TIface",{enumerable:true,get:function(){return n.TIface}}),Object.defineProperty(e,"TLiteral",{enumerable:true,get:function(){return n.TLiteral}}),Object.defineProperty(e,"TName",{enumerable:true,get:function(){return n.TName}}),Object.defineProperty(e,"TOptional",{enumerable:true,get:function(){return n.TOptional}}),Object.defineProperty(e,"TParam",{enumerable:true,get:function(){return n.TParam}}),Object.defineProperty(e,"TParamList",{enumerable:true,get:function(){return n.TParamList}}),Object.defineProperty(e,"TProp",{enumerable:true,get:function(){return n.TProp}}),Object.defineProperty(e,"TTuple",{enumerable:true,get:function(){return n.TTuple}}),Object.defineProperty(e,"TType",{enumerable:true,get:function(){return n.TType}}),Object.defineProperty(e,"TUnion",{enumerable:true,get:function(){return n.TUnion}}),Object.defineProperty(e,"TIntersection",{enumerable:true,get:function(){return n.TIntersection}}),Object.defineProperty(e,"array",{enumerable:true,get:function(){return n.array}}),Object.defineProperty(e,"enumlit",{enumerable:true,get:function(){return n.enumlit}}),Object.defineProperty(e,"enumtype",{enumerable:true,get:function(){return n.enumtype}}),Object.defineProperty(e,"func",{enumerable:true,get:function(){return n.func}}),Object.defineProperty(e,"iface",{enumerable:true,get:function(){return n.iface}}),Object.defineProperty(e,"lit",{enumerable:true,get:function(){return n.lit}}),Object.defineProperty(e,"name",{enumerable:true,get:function(){return n.name}}),Object.defineProperty(e,"opt",{enumerable:true,get:function(){return n.opt}}),Object.defineProperty(e,"param",{enumerable:true,get:function(){return n.param}}),Object.defineProperty(e,"tuple",{enumerable:true,get:function(){return n.tuple}}),Object.defineProperty(e,"union",{enumerable:true,get:function(){return n.union}}),Object.defineProperty(e,"intersection",{enumerable:true,get:function(){return n.intersection}}),Object.defineProperty(e,"BasicType",{enumerable:true,get:function(){return n.BasicType}});var a=wt;Object.defineProperty(e,"VError",{enumerable:true,get:function(){return a.VError}});function o(){for(var l=[],h=0;h<arguments.length;h++)l[h]=arguments[h];for(var d=Object.assign.apply(Object,t([{},s.basicTypes],l)),m={},_=0,k=l;_<k.length;_++)for(var T=k[_],P=0,F=Object.keys(T);P<F.length;P++){var B=F[P];m[B]=new u(d,T[B])}return m}e.createCheckers=o;var u=function(){function l(h,d,m){if(m===void 0&&(m="value"),this.suite=h,this.ttype=d,this._path=m,this.props=new Map,d instanceof s.TIface)for(var _=0,k=d.props;_<k.length;_++){var T=k[_];this.props.set(T.name,T.ttype)}this.checkerPlain=this.ttype.getChecker(h,false),this.checkerStrict=this.ttype.getChecker(h,true)}return l.prototype.setReportedPath=function(h){this._path=h},l.prototype.check=function(h){return this._doCheck(this.checkerPlain,h)},l.prototype.test=function(h){return this.checkerPlain(h,new i.NoopContext)},l.prototype.validate=function(h){return this._doValidate(this.checkerPlain,h)},l.prototype.strictCheck=function(h){return this._doCheck(this.checkerStrict,h)},l.prototype.strictTest=function(h){return this.checkerStrict(h,new i.NoopContext)},l.prototype.strictValidate=function(h){return this._doValidate(this.checkerStrict,h)},l.prototype.getProp=function(h){var d=this.props.get(h);if(!d)throw new Error("Type has no property "+h);return new l(this.suite,d,this._path+"."+h)},l.prototype.methodArgs=function(h){var d=this._getMethod(h);return new l(this.suite,d.paramList)},l.prototype.methodResult=function(h){var d=this._getMethod(h);return new l(this.suite,d.result)},l.prototype.getArgs=function(){if(!(this.ttype instanceof s.TFunc))throw new Error("getArgs() applied to non-function");return new l(this.suite,this.ttype.paramList)},l.prototype.getResult=function(){if(!(this.ttype instanceof s.TFunc))throw new Error("getResult() applied to non-function");return new l(this.suite,this.ttype.result)},l.prototype.getType=function(){return this.ttype},l.prototype._doCheck=function(h,d){var m=new i.NoopContext;if(!h(d,m)){var _=new i.DetailContext;throw h(d,_),_.getError(this._path)}},l.prototype._doValidate=function(h,d){var m=new i.NoopContext;if(h(d,m))return null;var _=new i.DetailContext;return h(d,_),_.getErrorDetail(this._path)},l.prototype._getMethod=function(h){var d=this.props.get(h);if(!d)throw new Error("Type has no property "+h);if(!(d instanceof s.TFunc))throw new Error("Property "+h+" is not a method");return d},l}();e.Checker=u})(we);const Bp=we.union(we.lit("jsx"),we.lit("typescript"),we.lit("flow"),we.lit("imports"),we.lit("react-hot-loader"),we.lit("jest")),Vp=we.iface([],{compiledFilename:"string"}),jp=we.iface([],{transforms:we.array("Transform"),disableESTransforms:we.opt("boolean"),jsxRuntime:we.opt(we.union(we.lit("classic"),we.lit("automatic"),we.lit("preserve"))),production:we.opt("boolean"),jsxImportSource:we.opt("string"),jsxPragma:we.opt("string"),jsxFragmentPragma:we.opt("string"),keepUnusedImports:we.opt("boolean"),preserveDynamicImport:we.opt("boolean"),injectCreateRequireForImportRequire:we.opt("boolean"),enableLegacyTypeScriptModuleInterop:we.opt("boolean"),enableLegacyBabel5ModuleInterop:we.opt("boolean"),sourceMapOptions:we.opt("SourceMapOptions"),filePath:we.opt("string")}),$p={Transform:Bp,SourceMapOptions:Vp,Options:jp},{Options:qp}=we.createCheckers($p);function Hp(e){qp.strictCheck(e)}function qu(){C(),Oe(false)}function Hu(e){C(),er(e)}function es(e){ae(),ya(e)}function Pi(){ae(),c.tokens[c.tokens.length-1].identifierRole=ie.ImportDeclaration}function ya(e){let t;c.scopeDepth===0?t=ie.TopLevelDeclaration:e?t=ie.BlockScopedDeclaration:t=ie.FunctionScopedDeclaration,c.tokens[c.tokens.length-1].identifierRole=t}function er(e){switch(c.type){case r._this:{const t=pe(0);C(),fe(t);return}case r._yield:case r.name:{c.type=r.name,es(e);return}case r.bracketL:{C(),_a(r.bracketR,e,true);return}case r.braceL:Ra(true,e);return;default:le()}}function _a(e,t,s=false,i=false,n=0){let a=true,o=false;const u=c.tokens.length;for(;!S(e)&&!c.error;)if(a?a=false:(A(r.comma),c.tokens[c.tokens.length-1].contextId=n,!o&&c.tokens[u].isType&&(c.tokens[c.tokens.length-1].isType=true,o=true)),!(s&&p(r.comma))){if(S(e))break;if(p(r.ellipsis)){Hu(t),Wu(),S(r.comma),A(e);break}else Wp(i,t)}}function Wp(e,t){e&&xa([g._public,g._protected,g._private,g._readonly,g._override]),Li(t),Wu(),Li(t,true)}function Wu(){_e?u0():me&&Jd()}function Li(e,t=false){if(t||er(e),!S(r.eq))return;const s=c.tokens.length-1;Oe(),c.tokens[s].rhsEndIndex=c.tokens.length}function Nn(){return p(r.name)}function Gp(){return p(r.name)||!!(c.type&r.IS_KEYWORD)||p(r.string)||p(r.num)||p(r.bigint)||p(r.decimal)}function Gu(){const e=c.snapshot();return C(),(p(r.bracketL)||p(r.braceL)||p(r.star)||p(r.ellipsis)||p(r.hash)||Gp())&&!We()?true:(c.restoreFromSnapshot(e),false)}function xa(e){for(;Xu(e)!==null;);}function Xu(e){if(!p(r.name))return null;const t=c.contextualKeyword;if(e.indexOf(t)!==-1&&Gu()){switch(t){case g._readonly:c.tokens[c.tokens.length-1].type=r._readonly;break;case g._abstract:c.tokens[c.tokens.length-1].type=r._abstract;break;case g._static:c.tokens[c.tokens.length-1].type=r._static;break;case g._public:c.tokens[c.tokens.length-1].type=r._public;break;case g._private:c.tokens[c.tokens.length-1].type=r._private;break;case g._protected:c.tokens[c.tokens.length-1].type=r._protected;break;case g._override:c.tokens[c.tokens.length-1].type=r._override;break;case g._declare:c.tokens[c.tokens.length-1].type=r._declare;break}return t}return null}function ni(){for(ae();S(r.dot);)ae()}function Xp(){ni(),!We()&&p(r.lessThan)&&Is()}function Yp(){C(),ai()}function zp(){C()}function Kp(){A(r._typeof),p(r._import)?Yu():ni(),!We()&&p(r.lessThan)&&Is()}function Yu(){A(r._import),A(r.parenL),A(r.string),A(r.parenR),S(r.dot)&&ni(),p(r.lessThan)&&Is()}function Zp(){S(r._const);const e=S(r._in),t=Le(g._out);S(r._const),(e||t)&&!p(r.name)?c.tokens[c.tokens.length-1].type=r.name:ae(),S(r._extends)&&Ie(),S(r.eq)&&Ie()}function fs(){p(r.lessThan)&&tr()}function tr(){const e=pe(0);for(p(r.lessThan)||p(r.typeParameterStart)?C():le();!S(r.greaterThan)&&!c.error;)Zp(),S(r.comma);fe(e)}function va(e){const t=e===r.arrow;fs(),A(r.parenL),c.scopeDepth++,Qp(false),c.scopeDepth--,(t||p(e))&&zs(e)}function Qp(e){_a(r.parenR,e)}function Di(){S(r.comma)||Ee()}function Fo(){va(r.colon),Di()}function Jp(){const e=c.snapshot();C();const t=S(r.name)&&p(r.colon);return c.restoreFromSnapshot(e),t}function zu(){if(!(p(r.bracketL)&&Jp()))return false;const e=pe(0);return A(r.bracketL),ae(),ai(),A(r.bracketR),As(),Di(),fe(e),true}function Uo(e){S(r.question),!e&&(p(r.parenL)||p(r.lessThan))?(va(r.colon),Di()):(As(),Di())}function ed(){if(p(r.parenL)||p(r.lessThan)){Fo();return}if(p(r._new)){C(),p(r.parenL)||p(r.lessThan)?Fo():Uo(false);return}const e=!!Xu([g._readonly]);zu()||((ee(g._get)||ee(g._set))&&Gu(),Ks(-1),Uo(e))}function td(){Ku()}function Ku(){for(A(r.braceL);!S(r.braceR)&&!c.error;)ed()}function sd(){const e=c.snapshot(),t=id();return c.restoreFromSnapshot(e),t}function id(){return C(),S(r.plus)||S(r.minus)?ee(g._readonly):(ee(g._readonly)&&C(),!p(r.bracketL)||(C(),!Nn())?false:(C(),p(r._in)))}function rd(){ae(),A(r._in),Ie()}function nd(){A(r.braceL),p(r.plus)||p(r.minus)?(C(),Re(g._readonly)):Le(g._readonly),A(r.bracketL),rd(),Le(g._as)&&Ie(),A(r.bracketR),p(r.plus)||p(r.minus)?(C(),A(r.question)):S(r.question),_d(),Ee(),A(r.braceR)}function ad(){for(A(r.bracketL);!S(r.bracketR)&&!c.error;)od(),S(r.comma)}function od(){S(r.ellipsis)?Ie():(Ie(),S(r.question)),S(r.colon)&&Ie()}function cd(){A(r.parenL),Ie(),A(r.parenR)}function ud(){for(Xt(),Xt();!p(r.backQuote)&&!c.error;)A(r.dollarBraceL),Ie(),Xt(),Xt();C()}var Yt;(function(e){e[e.TSFunctionType=0]="TSFunctionType";const s=1;e[e.TSConstructorType=s]="TSConstructorType";const i=s+1;e[e.TSAbstractConstructorType=i]="TSAbstractConstructorType"})(Yt||(Yt={}));function mn(e){e===Yt.TSAbstractConstructorType&&Re(g._abstract),(e===Yt.TSConstructorType||e===Yt.TSAbstractConstructorType)&&A(r._new);const t=c.inDisallowConditionalTypesContext;c.inDisallowConditionalTypesContext=false,va(r.arrow),c.inDisallowConditionalTypesContext=t}function ld(){switch(c.type){case r.name:Xp();return;case r._void:case r._null:C();return;case r.string:case r.num:case r.bigint:case r.decimal:case r._true:case r._false:ks();return;case r.minus:C(),ks();return;case r._this:{zp(),ee(g._is)&&!We()&&Yp();return}case r._typeof:Kp();return;case r._import:Yu();return;case r.braceL:sd()?nd():td();return;case r.bracketL:ad();return;case r.parenL:cd();return;case r.backQuote:ud();return;default:if(c.type&r.IS_KEYWORD){C(),c.tokens[c.tokens.length-1].type=r.name;return}break}le()}function hd(){for(ld();!We()&&S(r.bracketL);)S(r.bracketR)||(Ie(),A(r.bracketR))}function fd(){if(Re(g._infer),ae(),p(r._extends)){const e=c.snapshot();A(r._extends);const t=c.inDisallowConditionalTypesContext;c.inDisallowConditionalTypesContext=true,Ie(),c.inDisallowConditionalTypesContext=t,(c.error||!c.inDisallowConditionalTypesContext&&p(r.question))&&c.restoreFromSnapshot(e)}}function Fn(){if(ee(g._keyof)||ee(g._unique)||ee(g._readonly))C(),Fn();else if(ee(g._infer))fd();else{const e=c.inDisallowConditionalTypesContext;c.inDisallowConditionalTypesContext=false,hd(),c.inDisallowConditionalTypesContext=e}}function Mo(){if(S(r.bitwiseAND),Fn(),p(r.bitwiseAND))for(;S(r.bitwiseAND);)Fn()}function pd(){if(S(r.bitwiseOR),Mo(),p(r.bitwiseOR))for(;S(r.bitwiseOR);)Mo()}function dd(){return p(r.lessThan)?true:p(r.parenL)&&gd()}function md(){if(p(r.name)||p(r._this))return C(),true;if(p(r.braceL)||p(r.bracketL)){let e=1;for(C();e>0&&!c.error;)p(r.braceL)||p(r.bracketL)?e++:(p(r.braceR)||p(r.bracketR))&&e--,C();return true}return false}function gd(){const e=c.snapshot(),t=bd();return c.restoreFromSnapshot(e),t}function bd(){return C(),!!(p(r.parenR)||p(r.ellipsis)||md()&&(p(r.colon)||p(r.comma)||p(r.question)||p(r.eq)||p(r.parenR)&&(C(),p(r.arrow))))}function zs(e){const t=pe(0);A(e),xd()||Ie(),fe(t)}function yd(){p(r.colon)&&zs(r.colon)}function As(){p(r.colon)&&ai()}function _d(){S(r.colon)&&Ie()}function xd(){const e=c.snapshot();return ee(g._asserts)?(C(),Le(g._is)?(Ie(),true):Nn()||p(r._this)?(C(),Le(g._is)&&Ie(),true):(c.restoreFromSnapshot(e),false)):Nn()||p(r._this)?(C(),ee(g._is)&&!We()?(C(),Ie(),true):(c.restoreFromSnapshot(e),false)):false}function ai(){const e=pe(0);A(r.colon),Ie(),fe(e)}function Ie(){if(Oo(),c.inDisallowConditionalTypesContext||We()||!S(r._extends))return;const e=c.inDisallowConditionalTypesContext;c.inDisallowConditionalTypesContext=true,Oo(),c.inDisallowConditionalTypesContext=e,A(r.question),Ie(),A(r.colon),Ie()}function vd(){return ee(g._abstract)&&Ae()===r._new}function Oo(){if(dd()){mn(Yt.TSFunctionType);return}if(p(r._new)){mn(Yt.TSConstructorType);return}else if(vd()){mn(Yt.TSAbstractConstructorType);return}pd()}function kd(){const e=pe(1);Ie(),A(r.greaterThan),fe(e),oi()}function wd(){if(S(r.jsxTagStart)){c.tokens[c.tokens.length-1].type=r.typeParameterStart;const e=pe(1);for(;!p(r.greaterThan)&&!c.error;)Ie(),S(r.comma);at(),fe(e)}}function Zu(){for(;!p(r.braceL)&&!c.error;)Sd(),S(r.comma)}function Sd(){ni(),p(r.lessThan)&&Is()}function Ed(){es(false),fs(),S(r._extends)&&Zu(),Ku()}function Td(){es(false),fs(),A(r.eq),Ie(),Ee()}function Ad(){if(p(r.string)?ks():ae(),S(r.eq)){const e=c.tokens.length-1;Oe(),c.tokens[e].rhsEndIndex=c.tokens.length}}function ka(){for(es(false),A(r.braceL);!S(r.braceR)&&!c.error;)Ad(),S(r.comma)}function wa(){A(r.braceL),nr(r.braceR)}function Un(){es(false),S(r.dot)?Un():wa()}function Qu(){ee(g._global)?ae():p(r.string)?Bt():le(),p(r.braceL)?wa():Ee()}function Mn(){Pi(),A(r.eq),Cd(),Ee()}function Id(){return ee(g._require)&&Ae()===r.parenL}function Cd(){Id()?Rd():ni()}function Rd(){Re(g._require),A(r.parenL),p(r.string)||le(),ks(),A(r.parenR)}function Pd(){if(vt())return false;switch(c.type){case r._function:{const e=pe(1);C();const t=c.start;return us(t,true),fe(e),true}case r._class:{const e=pe(1);return ls(true,false),fe(e),true}case r._const:if(p(r._const)&&ma(g._enum)){const e=pe(1);return A(r._const),Re(g._enum),c.tokens[c.tokens.length-1].type=r._enum,ka(),fe(e),true}case r._var:case r._let:{const e=pe(1);return bi(c.type!==r._var),fe(e),true}case r.name:{const e=pe(1),t=c.contextualKeyword;let s=false;return t===g._global?(Qu(),s=true):s=sr(t,true),fe(e),s}default:return false}}function Bo(){return sr(c.contextualKeyword,true)}function Ld(e){switch(e){case g._declare:{const t=c.tokens.length-1;if(Pd())return c.tokens[t].type=r._declare,true;break}case g._global:if(p(r.braceL))return wa(),true;break;default:return sr(e,false)}return false}function sr(e,t){switch(e){case g._abstract:if(ms(t)&&p(r._class))return c.tokens[c.tokens.length-1].type=r._abstract,ls(true,false),true;break;case g._enum:if(ms(t)&&p(r.name))return c.tokens[c.tokens.length-1].type=r._enum,ka(),true;break;case g._interface:if(ms(t)&&p(r.name)){const s=pe(t?2:1);return Ed(),fe(s),true}break;case g._module:if(ms(t)){if(p(r.string)){const s=pe(t?2:1);return Qu(),fe(s),true}else if(p(r.name)){const s=pe(t?2:1);return Un(),fe(s),true}}break;case g._namespace:if(ms(t)&&p(r.name)){const s=pe(t?2:1);return Un(),fe(s),true}break;case g._type:if(ms(t)&&p(r.name)){const s=pe(t?2:1);return Td(),fe(s),true}break}return false}function ms(e){return e?(C(),true):!vt()}function Dd(){const e=c.snapshot();return tr(),Cs(),yd(),A(r.arrow),c.error?(c.restoreFromSnapshot(e),false):(ci(true),true)}function Sa(){c.type===r.bitShiftL&&(c.pos-=1,ue(r.lessThan)),Is()}function Is(){const e=pe(0);for(A(r.lessThan);!p(r.greaterThan)&&!c.error;)Ie(),S(r.comma);e?(A(r.greaterThan),fe(e)):(fe(e),Lu(),A(r.greaterThan),c.tokens[c.tokens.length-1].isType=true)}function Ju(){if(p(r.name))switch(c.contextualKeyword){case g._abstract:case g._declare:case g._enum:case g._interface:case g._module:case g._namespace:case g._type:return true}return false}function Nd(e,t){if(p(r.colon)&&zs(r.colon),!p(r.braceL)&&vt()){let s=c.tokens.length-1;for(;s>=0&&(c.tokens[s].start>=e||c.tokens[s].type===r._default||c.tokens[s].type===r._export);)c.tokens[s].isType=true,s--;return}ci(false,t)}function Fd(e,t,s){if(!We()&&S(r.bang)){c.tokens[c.tokens.length-1].type=r.nonNullAssertion;return}if(p(r.lessThan)||p(r.bitShiftL)){const i=c.snapshot();if(!t&&ol()&&Dd())return;if(Sa(),!t&&S(r.parenL)?(c.tokens[c.tokens.length-1].subscriptStartIndex=e,zt()):p(r.backQuote)?Ca():(c.type===r.greaterThan||c.type!==r.parenL&&c.type&r.IS_EXPRESSION_START&&!We())&&le(),c.error)c.restoreFromSnapshot(i);else return}else!t&&p(r.questionDot)&&Ae()===r.lessThan&&(C(),c.tokens[e].isOptionalChainStart=true,c.tokens[c.tokens.length-1].subscriptStartIndex=e,Is(),A(r.parenL),zt());Ta(e,t,s)}function Ud(){if(S(r._import))return ee(g._type)&&Ae()!==r.eq&&Re(g._type),Mn(),true;if(S(r.eq))return Me(),Ee(),true;if(Le(g._as))return Re(g._namespace),ae(),Ee(),true;if(ee(g._type)){const e=Ae();(e===r.braceL||e===r.star)&&C()}return false}function Md(){if(ae(),p(r.comma)||p(r.braceR)){c.tokens[c.tokens.length-1].identifierRole=ie.ImportDeclaration;return}if(ae(),p(r.comma)||p(r.braceR)){c.tokens[c.tokens.length-1].identifierRole=ie.ImportDeclaration,c.tokens[c.tokens.length-2].isType=true,c.tokens[c.tokens.length-1].isType=true;return}if(ae(),p(r.comma)||p(r.braceR)){c.tokens[c.tokens.length-3].identifierRole=ie.ImportAccess,c.tokens[c.tokens.length-1].identifierRole=ie.ImportDeclaration;return}ae(),c.tokens[c.tokens.length-3].identifierRole=ie.ImportAccess,c.tokens[c.tokens.length-1].identifierRole=ie.ImportDeclaration,c.tokens[c.tokens.length-4].isType=true,c.tokens[c.tokens.length-3].isType=true,c.tokens[c.tokens.length-2].isType=true,c.tokens[c.tokens.length-1].isType=true}function Od(){if(ae(),p(r.comma)||p(r.braceR)){c.tokens[c.tokens.length-1].identifierRole=ie.ExportAccess;return}if(ae(),p(r.comma)||p(r.braceR)){c.tokens[c.tokens.length-1].identifierRole=ie.ExportAccess,c.tokens[c.tokens.length-2].isType=true,c.tokens[c.tokens.length-1].isType=true;return}if(ae(),p(r.comma)||p(r.braceR)){c.tokens[c.tokens.length-3].identifierRole=ie.ExportAccess;return}ae(),c.tokens[c.tokens.length-3].identifierRole=ie.ExportAccess,c.tokens[c.tokens.length-4].isType=true,c.tokens[c.tokens.length-3].isType=true,c.tokens[c.tokens.length-2].isType=true,c.tokens[c.tokens.length-1].isType=true}function Bd(){if(ee(g._abstract)&&Ae()===r._class)return c.type=r._abstract,C(),ls(true,true),true;if(ee(g._interface)){const e=pe(2);return sr(g._interface,true),fe(e),true}return false}function Vd(){if(c.type===r._const){const e=ri();if(e.type===r.name&&e.contextualKeyword===g._enum)return A(r._const),Re(g._enum),c.tokens[c.tokens.length-1].type=r._enum,ka(),true}return false}function jd(e){const t=c.tokens.length;xa([g._abstract,g._readonly,g._declare,g._static,g._override]);const s=c.tokens.length;if(zu()){const n=e?t-1:t;for(let a=n;a<s;a++)c.tokens[a].isType=true;return true}return false}function $d(e){Ld(e)||Ee()}function qd(){const e=Le(g._declare);e&&(c.tokens[c.tokens.length-1].type=r._declare);let t=false;if(p(r.name))if(e){const s=pe(2);t=Bo(),fe(s)}else t=Bo();if(!t)if(e){const s=pe(2);st(true),fe(s)}else st(true)}function Hd(e){if(e&&(p(r.lessThan)||p(r.bitShiftL))&&Sa(),Le(g._implements)){c.tokens[c.tokens.length-1].type=r._implements;const t=pe(1);Zu(),fe(t)}}function Wd(){fs()}function Gd(){fs()}function Xd(){const e=pe(0);We()||S(r.bang),As(),fe(e)}function Yd(){p(r.colon)&&ai()}function zd(e,t){return Qi?Kd(e,t):Zd(e,t)}function Kd(e,t){if(!p(r.lessThan))return St(e,t);const s=c.snapshot();let i=St(e,t);if(c.error)c.restoreFromSnapshot(s);else return i;return c.type=r.typeParameterStart,tr(),i=St(e,t),i||le(),i}function Zd(e,t){if(!p(r.lessThan))return St(e,t);const s=c.snapshot();tr();const i=St(e,t);if(i||le(),c.error)c.restoreFromSnapshot(s);else return i;return St(e,t)}function Qd(){if(p(r.colon)){const e=c.snapshot();zs(r.colon),tt()&&le(),p(r.arrow)||le(),c.error&&c.restoreFromSnapshot(e)}return S(r.arrow)}function Jd(){const e=pe(0);S(r.question),As(),fe(e)}function em(){(p(r.lessThan)||p(r.bitShiftL))&&Sa(),_l()}function tm(){let e=false,t=false;for(;;){if(c.pos>=$.length){le("Unterminated JSX contents");return}const s=$.charCodeAt(c.pos);if(s===y.lessThan||s===y.leftCurlyBrace){if(c.pos===c.start){if(s===y.lessThan){c.pos++,ue(r.jsxTagStart);return}Du(s);return}ue(e&&!t?r.jsxEmptyText:r.jsxText);return}s===y.lineFeed?e=true:s!==y.space&&s!==y.carriageReturn&&s!==y.tab&&(t=true),c.pos++}}function sm(e){for(c.pos++;;){if(c.pos>=$.length){le("Unterminated string constant");return}if($.charCodeAt(c.pos)===e){c.pos++;break}c.pos++}ue(r.string)}function im(){let e;do{if(c.pos>$.length){le("Unexpectedly reached the end of input.");return}e=$.charCodeAt(++c.pos)}while(mt[e]||e===y.dash);ue(r.jsxName)}function On(){at()}function el(e){if(On(),!S(r.colon)){c.tokens[c.tokens.length-1].identifierRole=e;return}On()}function tl(){const e=c.tokens.length;el(ie.Access);let t=false;for(;p(r.dot);)t=true,at(),On();if(!t){const s=c.tokens[e],i=$.charCodeAt(s.start);i>=y.lowercaseA&&i<=y.lowercaseZ&&(s.identifierRole=null)}}function rm(){switch(c.type){case r.braceL:C(),Me(),at();return;case r.jsxTagStart:il(),at();return;case r.string:at();return;default:le("JSX value should be either an expression or a quoted JSX text")}}function nm(){A(r.ellipsis),Me()}function am(e){if(p(r.jsxTagEnd))return false;tl(),me&&wd();let t=false;for(;!p(r.slash)&&!p(r.jsxTagEnd)&&!c.error;){if(S(r.braceL)){t=true,A(r.ellipsis),Oe(),at();continue}t&&c.end-c.start===3&&$.charCodeAt(c.start)===y.lowercaseK&&$.charCodeAt(c.start+1)===y.lowercaseE&&$.charCodeAt(c.start+2)===y.lowercaseY&&(c.tokens[e].jsxRole=ft.KeyAfterPropSpread),el(ie.ObjectKey),p(r.eq)&&(at(),rm())}const s=p(r.slash);return s&&at(),s}function om(){p(r.jsxTagEnd)||tl()}function sl(){const e=c.tokens.length-1;c.tokens[e].jsxRole=ft.NoChildren;let t=0;if(!am(e))for(gs();;)switch(c.type){case r.jsxTagStart:if(at(),p(r.slash)){at(),om(),c.tokens[e].jsxRole!==ft.KeyAfterPropSpread&&(t===1?c.tokens[e].jsxRole=ft.OneChild:t>1&&(c.tokens[e].jsxRole=ft.StaticChildren));return}t++,sl(),gs();break;case r.jsxText:t++,gs();break;case r.jsxEmptyText:gs();break;case r.braceL:C(),p(r.ellipsis)?(nm(),gs(),t+=2):(p(r.braceR)||(t++,Me()),gs());break;default:le();return}}function il(){at(),sl()}function at(){c.tokens.push(new Ji),Ru(),c.start=c.pos;const e=$.charCodeAt(c.pos);if(ii[e])im();else if(e===y.quotationMark||e===y.apostrophe)sm(e);else switch(++c.pos,e){case y.greaterThan:ue(r.jsxTagEnd);break;case y.lessThan:ue(r.jsxTagStart);break;case y.slash:ue(r.slash);break;case y.equalsTo:ue(r.eq);break;case y.leftCurlyBrace:ue(r.braceL);break;case y.dot:ue(r.dot);break;case y.colon:ue(r.colon);break;default:le()}}function gs(){c.tokens.push(new Ji),c.start=c.pos,tm()}function cm(e){if(p(r.question)){const t=Ae();if(t===r.colon||t===r.comma||t===r.parenR)return}rl(e)}function um(){Eu(r.question),p(r.colon)&&(me?ai():_e&&ps())}class lm{constructor(t){this.stop=t}}function Me(e=false){if(Oe(e),p(r.comma))for(;S(r.comma);)Oe(e)}function Oe(e=false,t=false){return me?zd(e,t):_e?m0(e,t):St(e,t)}function St(e,t){if(p(r._yield))return Tm(),false;(p(r.parenL)||p(r.name)||p(r._yield))&&(c.potentialArrowAt=c.start);const s=hm(e);return t&&Ia(),c.type&r.IS_ASSIGN?(C(),Oe(e),false):s}function hm(e){return pm(e)?true:(fm(e),false)}function fm(e){me||_e?cm(e):rl(e)}function rl(e){S(r.question)&&(Oe(),A(r.colon),Oe(e))}function pm(e){const t=c.tokens.length;return oi()?true:(mi(t,-1,e),false)}function mi(e,t,s){if(me&&(r._in&r.PRECEDENCE_MASK)>t&&!We()&&(Le(g._as)||Le(g._satisfies))){const n=pe(1);Ie(),fe(n),Lu(),mi(e,t,s);return}const i=c.type&r.PRECEDENCE_MASK;if(i>0&&(!s||!p(r._in))&&i>t){const n=c.type;C(),n===r.nullishCoalescing&&(c.tokens[c.tokens.length-1].nullishStartIndex=e);const a=c.tokens.length;oi(),mi(a,n&r.IS_RIGHT_ASSOCIATIVE?i-1:i,s),n===r.nullishCoalescing&&(c.tokens[e].numNullishCoalesceStarts++,c.tokens[c.tokens.length-1].numNullishCoalesceEnds++),mi(e,t,s)}}function oi(){if(me&&!Qi&&S(r.lessThan))return kd(),false;if(ee(g._module)&&Au()===y.leftCurlyBrace&&!xu())return Am(),false;if(c.type&r.IS_PREFIX)return C(),oi(),false;if(nl())return true;for(;c.type&r.IS_POSTFIX&&!tt();)c.type===r.preIncDec&&(c.type=r.postIncDec),C();return false}function nl(){const e=c.tokens.length;return Bt()?true:(Ea(e),c.tokens.length>e&&c.tokens[e].isOptionalChainStart&&(c.tokens[c.tokens.length-1].isOptionalChainEnd=true),false)}function Ea(e,t=false){_e?b0(e,t):al(e,t)}function al(e,t=false){const s=new lm(false);do dm(e,t,s);while(!s.stop&&!c.error)}function dm(e,t,s){me?Fd(e,t,s):_e?Zm(e,t,s):Ta(e,t,s)}function Ta(e,t,s){if(!t&&S(r.doubleColon))Aa(),s.stop=true,Ea(e,t);else if(p(r.questionDot)){if(c.tokens[e].isOptionalChainStart=true,t&&Ae()===r.parenL){s.stop=true;return}C(),c.tokens[c.tokens.length-1].subscriptStartIndex=e,S(r.bracketL)?(Me(),A(r.bracketR)):S(r.parenL)?zt():Ni()}else if(S(r.dot))c.tokens[c.tokens.length-1].subscriptStartIndex=e,Ni();else if(S(r.bracketL))c.tokens[c.tokens.length-1].subscriptStartIndex=e,Me(),A(r.bracketR);else if(!t&&p(r.parenL))if(ol()){const i=c.snapshot(),n=c.tokens.length;C(),c.tokens[c.tokens.length-1].subscriptStartIndex=e;const a=Xs();c.tokens[c.tokens.length-1].contextId=a,zt(),c.tokens[c.tokens.length-1].contextId=a,mm()&&(c.restoreFromSnapshot(i),s.stop=true,c.scopeDepth++,Cs(),gm(n))}else{C(),c.tokens[c.tokens.length-1].subscriptStartIndex=e;const i=Xs();c.tokens[c.tokens.length-1].contextId=i,zt(),c.tokens[c.tokens.length-1].contextId=i}else p(r.backQuote)?Ca():s.stop=true}function ol(){return c.tokens[c.tokens.length-1].contextualKeyword===g._async&&!tt()}function zt(){let e=true;for(;!S(r.parenR)&&!c.error;){if(e)e=false;else if(A(r.comma),S(r.parenR))break;hl(false)}}function mm(){return p(r.colon)||p(r.arrow)}function gm(e){me?Yd():_e&&d0(),A(r.arrow),Zs(e)}function Aa(){const e=c.tokens.length;Bt(),Ea(e,true)}function Bt(){if(S(r.modulo))return ae(),false;if(p(r.jsxText)||p(r.jsxEmptyText))return ks(),false;if(p(r.lessThan)&&Qi)return c.type=r.jsxTagStart,il(),C(),false;const e=c.potentialArrowAt===c.start;switch(c.type){case r.slash:case r.assign:Bf();case r._super:case r._this:case r.regexp:case r.num:case r.bigint:case r.decimal:case r.string:case r._null:case r._true:case r._false:return C(),false;case r._import:return C(),p(r.dot)&&(c.tokens[c.tokens.length-1].type=r.name,C(),ae()),false;case r.name:{const t=c.tokens.length,s=c.start,i=c.contextualKeyword;return ae(),i===g._await?(Em(),false):i===g._async&&p(r._function)&&!tt()?(C(),us(s,false),false):e&&i===g._async&&!tt()&&p(r.name)?(c.scopeDepth++,es(false),A(r.arrow),Zs(t),true):p(r._do)&&!tt()?(C(),Kt(),false):e&&!tt()&&p(r.arrow)?(c.scopeDepth++,ya(false),A(r.arrow),Zs(t),true):(c.tokens[c.tokens.length-1].identifierRole=ie.Access,false)}case r._do:return C(),Kt(),false;case r.parenL:return cl(e);case r.bracketL:return C(),ll(r.bracketR,true),false;case r.braceL:return Ra(false,false),false;case r._function:return bm(),false;case r.at:Ba();case r._class:return ls(false),false;case r._new:return _m(),false;case r.backQuote:return Ca(),false;case r.doubleColon:return C(),Aa(),false;case r.hash:{const t=Au();return ii[t]||t===y.backslash?Ni():C(),false}default:return le(),false}}function Ni(){S(r.hash),ae()}function bm(){const e=c.start;ae(),S(r.dot)&&ae(),us(e,false)}function ks(){C()}function ir(){A(r.parenL),Me(),A(r.parenR)}function cl(e){const t=c.snapshot(),s=c.tokens.length;A(r.parenL);let i=true;for(;!p(r.parenR)&&!c.error;){if(i)i=false;else if(A(r.comma),p(r.parenR))break;if(p(r.ellipsis)){Hu(false),Ia();break}else Oe(false,true)}return A(r.parenR),e&&ym()&&Bn()?(c.restoreFromSnapshot(t),c.scopeDepth++,Cs(),Bn(),Zs(s),c.error?(c.restoreFromSnapshot(t),cl(false),false):true):false}function ym(){return p(r.colon)||!tt()}function Bn(){return me?Qd():_e?g0():S(r.arrow)}function Ia(){(me||_e)&&um()}function _m(){if(A(r._new),S(r.dot)){ae();return}xm(),_e&&Qm(),S(r.parenL)&&ll(r.parenR)}function xm(){Aa(),S(r.questionDot)}function Ca(){for(Xt(),Xt();!p(r.backQuote)&&!c.error;)A(r.dollarBraceL),Me(),Xt(),Xt();C()}function Ra(e,t){const s=Xs();let i=true;for(C(),c.tokens[c.tokens.length-1].contextId=s;!S(r.braceR)&&!c.error;){if(i)i=false;else if(A(r.comma),S(r.braceR))break;let n=false;if(p(r.ellipsis)){const a=c.tokens.length;if(qu(),e&&(c.tokens.length===a+2&&ya(t),S(r.braceR)))break;continue}e||(n=S(r.star)),!e&&ee(g._async)?(n&&le(),ae(),p(r.colon)||p(r.parenL)||p(r.braceR)||p(r.eq)||p(r.comma)||(p(r.star)&&(C(),n=true),Ks(s))):Ks(s),Sm(e,t,s)}c.tokens[c.tokens.length-1].contextId=s}function vm(e){return!e&&(p(r.string)||p(r.num)||p(r.bracketL)||p(r.name)||!!(c.type&r.IS_KEYWORD))}function km(e,t){const s=c.start;return p(r.parenL)?(e&&le(),Vn(s,false),true):vm(e)?(Ks(t),Vn(s,false),true):false}function wm(e,t){if(S(r.colon)){e?Li(t):Oe(false);return}let s;e?c.scopeDepth===0?s=ie.ObjectShorthandTopLevelDeclaration:t?s=ie.ObjectShorthandBlockScopedDeclaration:s=ie.ObjectShorthandFunctionScopedDeclaration:s=ie.ObjectShorthand,c.tokens[c.tokens.length-1].identifierRole=s,Li(t,true)}function Sm(e,t,s){me?Wd():_e&&c0(),km(e,s)||wm(e,t)}function Ks(e){_e&&Oa(),S(r.bracketL)?(c.tokens[c.tokens.length-1].contextId=e,Oe(),A(r.bracketR),c.tokens[c.tokens.length-1].contextId=e):(p(r.num)||p(r.string)||p(r.bigint)||p(r.decimal)?Bt():Ni(),c.tokens[c.tokens.length-1].identifierRole=ie.ObjectKey,c.tokens[c.tokens.length-1].contextId=e)}function Vn(e,t){const s=Xs();c.scopeDepth++;const i=c.tokens.length;Cs(t,s),ul(e,s);const a=c.tokens.length;c.scopes.push(new At(i,a,true)),c.scopeDepth--}function Zs(e){ci(true);const t=c.tokens.length;c.scopes.push(new At(e,t,true)),c.scopeDepth--}function ul(e,t=0){me?Nd(e,t):_e?Km(t):ci(false,t)}function ci(e,t=0){e&&!p(r.braceL)?Oe():Kt(true,t)}function ll(e,t=false){let s=true;for(;!S(e)&&!c.error;){if(s)s=false;else if(A(r.comma),S(e))break;hl(t)}}function hl(e){e&&p(r.comma)||(p(r.ellipsis)?(qu(),Ia()):p(r.question)?C():Oe(false,true))}function ae(){C(),c.tokens[c.tokens.length-1].type=r.name}function Em(){oi()}function Tm(){C(),!p(r.semi)&&!tt()&&(S(r.star),Oe())}function Am(){Re(g._module),A(r.braceL),nr(r.braceR)}function Im(e){return(e.type===r.name||!!(e.type&r.IS_KEYWORD))&&e.contextualKeyword!==g._from}function It(e){const t=pe(0);A(e||r.colon),Qe(),fe(t)}function Vo(){A(r.modulo),Re(g._checks),S(r.parenL)&&(Me(),A(r.parenR))}function Pa(){const e=pe(0);A(r.colon),p(r.modulo)?Vo():(Qe(),p(r.modulo)&&Vo()),fe(e)}function Cm(){C(),La(true)}function Rm(){C(),ae(),p(r.lessThan)&&bt(),A(r.parenL),$n(),A(r.parenR),Pa(),Ee()}function jn(){p(r._class)?Cm():p(r._function)?Rm():p(r._var)?Pm():Le(g._module)?S(r.dot)?Nm():Lm():ee(g._type)?Fm():ee(g._opaque)?Um():ee(g._interface)?Mm():p(r._export)?Dm():le()}function Pm(){C(),ml(),Ee()}function Lm(){for(p(r.string)?Bt():ae(),A(r.braceL);!p(r.braceR)&&!c.error;)p(r._import)?(C(),El()):le();A(r.braceR)}function Dm(){A(r._export),S(r._default)?p(r._function)||p(r._class)?jn():(Qe(),Ee()):p(r._var)||p(r._function)||p(r._class)||ee(g._opaque)?jn():p(r.star)||p(r.braceL)||ee(g._interface)||ee(g._type)||ee(g._opaque)?wl():le()}function Nm(){Re(g._exports),ps(),Ee()}function Fm(){C(),Na()}function Um(){C(),Fa(true)}function Mm(){C(),La()}function La(e=false){if(rr(),p(r.lessThan)&&bt(),S(r._extends))do gi();while(!e&&S(r.comma));if(ee(g._mixins)){C();do gi();while(S(r.comma))}if(ee(g._implements)){C();do gi();while(S(r.comma))}Fi(e,false,e)}function gi(){fl(false),p(r.lessThan)&&cs()}function Da(){La()}function rr(){ae()}function Na(){rr(),p(r.lessThan)&&bt(),It(r.eq),Ee()}function Fa(e){Re(g._type),rr(),p(r.lessThan)&&bt(),p(r.colon)&&It(r.colon),e||It(r.eq),Ee()}function Om(){Oa(),ml(),S(r.eq)&&Qe()}function bt(){const e=pe(0);p(r.lessThan)||p(r.typeParameterStart)?C():le();do Om(),p(r.greaterThan)||A(r.comma);while(!p(r.greaterThan)&&!c.error);A(r.greaterThan),fe(e)}function cs(){const e=pe(0);for(A(r.lessThan);!p(r.greaterThan)&&!c.error;)Qe(),p(r.greaterThan)||A(r.comma);A(r.greaterThan),fe(e)}function Bm(){if(Re(g._interface),S(r._extends))do gi();while(S(r.comma));Fi(false,false,false)}function Ua(){p(r.num)||p(r.string)?Bt():ae()}function Vm(){Ae()===r.colon?(Ua(),It()):Qe(),A(r.bracketR),It()}function jm(){Ua(),A(r.bracketR),A(r.bracketR),p(r.lessThan)||p(r.parenL)?Ma():(S(r.question),It())}function Ma(){for(p(r.lessThan)&&bt(),A(r.parenL);!p(r.parenR)&&!p(r.ellipsis)&&!c.error;)Ui(),p(r.parenR)||A(r.comma);S(r.ellipsis)&&Ui(),A(r.parenR),It()}function $m(){Ma()}function Fi(e,t,s){let i;for(t&&p(r.braceBarL)?(A(r.braceBarL),i=r.braceBarR):(A(r.braceL),i=r.braceR);!p(i)&&!c.error;){if(s&&ee(g._proto)){const n=Ae();n!==r.colon&&n!==r.question&&(C(),e=false)}if(e&&ee(g._static)){const n=Ae();n!==r.colon&&n!==r.question&&C()}if(Oa(),S(r.bracketL))S(r.bracketL)?jm():Vm();else if(p(r.parenL)||p(r.lessThan))$m();else{if(ee(g._get)||ee(g._set)){const n=Ae();(n===r.name||n===r.string||n===r.num)&&C()}qm()}Hm()}A(i)}function qm(){if(p(r.ellipsis)){if(A(r.ellipsis),S(r.comma)||S(r.semi),p(r.braceR))return;Qe()}else Ua(),p(r.lessThan)||p(r.parenL)?Ma():(S(r.question),It())}function Hm(){!S(r.semi)&&!S(r.comma)&&!p(r.braceR)&&!p(r.braceBarR)&&le()}function fl(e){for(e||ae();S(r.dot);)ae()}function Wm(){fl(true),p(r.lessThan)&&cs()}function Gm(){A(r._typeof),pl()}function Xm(){for(A(r.bracketL);c.pos<$.length&&!p(r.bracketR)&&(Qe(),!p(r.bracketR));)A(r.comma);A(r.bracketR)}function Ui(){const e=Ae();e===r.colon||e===r.question?(ae(),S(r.question),It()):Qe()}function $n(){for(;!p(r.parenR)&&!p(r.ellipsis)&&!c.error;)Ui(),p(r.parenR)||A(r.comma);S(r.ellipsis)&&Ui()}function pl(){let e=false;const t=c.noAnonFunctionType;switch(c.type){case r.name:{if(ee(g._interface)){Bm();return}ae(),Wm();return}case r.braceL:Fi(false,false,false);return;case r.braceBarL:Fi(false,true,false);return;case r.bracketL:Xm();return;case r.lessThan:bt(),A(r.parenL),$n(),A(r.parenR),A(r.arrow),Qe();return;case r.parenL:if(C(),!p(r.parenR)&&!p(r.ellipsis))if(p(r.name)){const s=Ae();e=s!==r.question&&s!==r.colon}else e=true;if(e)if(c.noAnonFunctionType=false,Qe(),c.noAnonFunctionType=t,c.noAnonFunctionType||!(p(r.comma)||p(r.parenR)&&Ae()===r.arrow)){A(r.parenR);return}else S(r.comma);$n(),A(r.parenR),A(r.arrow),Qe();return;case r.minus:C(),ks();return;case r.string:case r.num:case r._true:case r._false:case r._null:case r._this:case r._void:case r.star:C();return;default:if(c.type===r._typeof){Gm();return}else if(c.type&r.IS_KEYWORD){C(),c.tokens[c.tokens.length-1].type=r.name;return}}le()}function Ym(){for(pl();!tt()&&(p(r.bracketL)||p(r.questionDot));)S(r.questionDot),A(r.bracketL),S(r.bracketR)||(Qe(),A(r.bracketR))}function dl(){S(r.question)?dl():Ym()}function jo(){dl(),!c.noAnonFunctionType&&S(r.arrow)&&Qe()}function $o(){for(S(r.bitwiseAND),jo();S(r.bitwiseAND);)jo()}function zm(){for(S(r.bitwiseOR),$o();S(r.bitwiseOR);)$o()}function Qe(){zm()}function ps(){It()}function ml(){ae(),p(r.colon)&&ps()}function Oa(){(p(r.plus)||p(r.minus))&&(C(),c.tokens[c.tokens.length-1].isType=true)}function Km(e){p(r.colon)&&Pa(),ci(false,e)}function Zm(e,t,s){if(p(r.questionDot)&&Ae()===r.lessThan){if(t){s.stop=true;return}C(),cs(),A(r.parenL),zt();return}else if(!t&&p(r.lessThan)){const i=c.snapshot();if(cs(),A(r.parenL),zt(),c.error)c.restoreFromSnapshot(i);else return}Ta(e,t,s)}function Qm(){if(p(r.lessThan)){const e=c.snapshot();cs(),c.error&&c.restoreFromSnapshot(e)}}function Jm(){if(p(r.name)&&c.contextualKeyword===g._interface){const e=pe(0);return C(),Da(),fe(e),true}else if(ee(g._enum))return gl(),true;return false}function e0(){return ee(g._enum)?(gl(),true):false}function t0(e){if(e===g._declare){if(p(r._class)||p(r.name)||p(r._function)||p(r._var)||p(r._export)){const t=pe(1);jn(),fe(t)}}else if(p(r.name)){if(e===g._interface){const t=pe(1);Da(),fe(t)}else if(e===g._type){const t=pe(1);Na(),fe(t)}else if(e===g._opaque){const t=pe(1);Fa(false),fe(t)}}Ee()}function s0(){return ee(g._type)||ee(g._interface)||ee(g._opaque)||ee(g._enum)}function i0(){return p(r.name)&&(c.contextualKeyword===g._type||c.contextualKeyword===g._interface||c.contextualKeyword===g._opaque||c.contextualKeyword===g._enum)}function r0(){if(ee(g._type)){const e=pe(1);C(),p(r.braceL)?(Va(),Qs()):Na(),fe(e)}else if(ee(g._opaque)){const e=pe(1);C(),Fa(false),fe(e)}else if(ee(g._interface)){const e=pe(1);C(),Da(),fe(e)}else st(true)}function n0(){return p(r.star)||ee(g._type)&&Ae()===r.star}function a0(){if(Le(g._type)){const e=pe(2);qn(),fe(e)}else qn()}function o0(e){if(e&&p(r.lessThan)&&cs(),ee(g._implements)){const t=pe(0);C(),c.tokens[c.tokens.length-1].type=r._implements;do rr(),p(r.lessThan)&&cs();while(S(r.comma));fe(t)}}function c0(){p(r.lessThan)&&(bt(),p(r.parenL)||le())}function u0(){const e=pe(0);S(r.question),p(r.colon)&&ps(),fe(e)}function l0(){if(p(r._typeof)||ee(g._type)){const e=ri();(Im(e)||e.type===r.braceL||e.type===r.star)&&C()}}function h0(){const e=c.contextualKeyword===g._type||c.type===r._typeof;e?C():ae(),ee(g._as)&&!ma(g._as)?(ae(),e&&!p(r.name)&&!(c.type&r.IS_KEYWORD)||ae()):(e&&(p(r.name)||c.type&r.IS_KEYWORD)&&ae(),Le(g._as)&&ae())}function f0(){if(p(r.lessThan)){const e=pe(0);bt(),fe(e)}}function p0(){p(r.colon)&&ps()}function d0(){if(p(r.colon)){const e=c.noAnonFunctionType;c.noAnonFunctionType=true,ps(),c.noAnonFunctionType=e}}function m0(e,t){if(p(r.lessThan)){const s=c.snapshot();let i=St(e,t);if(c.error)c.restoreFromSnapshot(s),c.type=r.typeParameterStart;else return i;const n=pe(0);if(bt(),fe(n),i=St(e,t),i)return true;le()}return St(e,t)}function g0(){if(p(r.colon)){const e=pe(0),t=c.snapshot(),s=c.noAnonFunctionType;c.noAnonFunctionType=true,Pa(),c.noAnonFunctionType=s,tt()&&le(),p(r.arrow)||le(),c.error&&c.restoreFromSnapshot(t),fe(e)}return S(r.arrow)}function b0(e,t=false){if(c.tokens[c.tokens.length-1].contextualKeyword===g._async&&p(r.lessThan)){const s=c.snapshot();if(y0()&&!c.error)return;c.restoreFromSnapshot(s)}al(e,t)}function y0(){c.scopeDepth++;const e=c.tokens.length;return Cs(),Bn()?(Zs(e),true):false}function gl(){Re(g._enum),c.tokens[c.tokens.length-1].type=r._enum,ae(),_0()}function _0(){Le(g._of)&&C(),A(r.braceL),x0(),A(r.braceR)}function x0(){for(;!p(r.braceR)&&!c.error&&!S(r.ellipsis);)v0(),p(r.braceR)||A(r.comma)}function v0(){ae(),S(r.eq)&&C()}function k0(){if(nr(r.eof),c.scopes.push(new At(0,c.tokens.length,true)),c.scopeDepth!==0)throw new Error(`Invalid scope depth at end of file: ${c.scopeDepth}`);return new cg(c.tokens,c.scopes)}function st(e){_e&&Jm()||(p(r.at)&&Ba(),w0(e))}function w0(e){if(me&&Vd())return;const t=c.type;switch(t){case r._break:case r._continue:E0();return;case r._debugger:T0();return;case r._do:A0();return;case r._for:I0();return;case r._function:if(Ae()===r.dot)break;e||le(),P0();return;case r._class:e||le(),ls(true);return;case r._if:L0();return;case r._return:D0();return;case r._switch:N0();return;case r._throw:F0();return;case r._try:M0();return;case r._let:case r._const:e||le();case r._var:bi(t!==r._var);return;case r._while:O0();return;case r.braceL:Kt();return;case r.semi:B0();return;case r._export:case r._import:{const n=Ae();if(n===r.parenL||n===r.dot)break;C(),t===r._import?El():wl();return}case r.name:if(c.contextualKeyword===g._async){const n=c.start,a=c.snapshot();if(C(),p(r._function)&&!tt()){A(r._function),us(n,true);return}else c.restoreFromSnapshot(a)}else if(c.contextualKeyword===g._using&&!xu()&&Ae()===r.name){bi(true);return}else if(bl()){Re(g._await),bi(true);return}}const s=c.tokens.length;Me();let i=null;if(c.tokens.length===s+1){const n=c.tokens[c.tokens.length-1];n.type===r.name&&(i=n.contextualKeyword)}if(i==null){Ee();return}S(r.colon)?V0():j0(i)}function bl(){if(!ee(g._await))return false;const e=c.snapshot();return C(),!ee(g._using)||We()||(C(),!p(r.name)||We())?(c.restoreFromSnapshot(e),false):(c.restoreFromSnapshot(e),true)}function Ba(){for(;p(r.at);)yl()}function yl(){if(C(),S(r.parenL))Me(),A(r.parenR);else{for(ae();S(r.dot);)ae();S0()}}function S0(){me?em():_l()}function _l(){S(r.parenL)&&zt()}function E0(){C(),vt()||(ae(),Ee())}function T0(){C(),Ee()}function A0(){C(),st(false),A(r._while),ir(),S(r.semi)}function I0(){c.scopeDepth++;const e=c.tokens.length;R0();const t=c.tokens.length;c.scopes.push(new At(e,t,false)),c.scopeDepth--}function C0(){return!(!ee(g._using)||ma(g._of))}function R0(){C();let e=false;if(ee(g._await)&&(e=true,C()),A(r.parenL),p(r.semi)){e&&le(),gn();return}const t=bl();if(t||p(r._var)||p(r._let)||p(r._const)||C0()){if(t&&Re(g._await),C(),xl(true,c.type!==r._var),p(r._in)||ee(g._of)){qo(e);return}gn();return}if(Me(true),p(r._in)||ee(g._of)){qo(e);return}e&&le(),gn()}function P0(){const e=c.start;C(),us(e,true)}function L0(){C(),ir(),st(false),S(r._else)&&st(false)}function D0(){C(),vt()||(Me(),Ee())}function N0(){C(),ir(),c.scopeDepth++;const e=c.tokens.length;for(A(r.braceL);!p(r.braceR)&&!c.error;)if(p(r._case)||p(r._default)){const s=p(r._case);C(),s&&Me(),A(r.colon)}else st(true);C();const t=c.tokens.length;c.scopes.push(new At(e,t,false)),c.scopeDepth--}function F0(){C(),Me(),Ee()}function U0(){er(true),me&&As()}function M0(){if(C(),Kt(),p(r._catch)){C();let e=null;if(p(r.parenL)&&(c.scopeDepth++,e=c.tokens.length,A(r.parenL),U0(),A(r.parenR)),Kt(),e!=null){const t=c.tokens.length;c.scopes.push(new At(e,t,false)),c.scopeDepth--}}S(r._finally)&&Kt()}function bi(e){C(),xl(false,e),Ee()}function O0(){C(),ir(),st(false)}function B0(){C()}function V0(){st(true)}function j0(e){me?$d(e):_e?t0(e):Ee()}function Kt(e=false,t=0){const s=c.tokens.length;c.scopeDepth++,A(r.braceL),t&&(c.tokens[c.tokens.length-1].contextId=t),nr(r.braceR),t&&(c.tokens[c.tokens.length-1].contextId=t);const i=c.tokens.length;c.scopes.push(new At(s,i,e)),c.scopeDepth--}function nr(e){for(;!S(e)&&!c.error;)st(true)}function gn(){A(r.semi),p(r.semi)||Me(),A(r.semi),p(r.parenR)||Me(),A(r.parenR),st(false)}function qo(e){e?Le(g._of):C(),Me(),A(r.parenR),st(false)}function xl(e,t){for(;;){if($0(t),S(r.eq)){const s=c.tokens.length-1;Oe(e),c.tokens[s].rhsEndIndex=c.tokens.length}if(!S(r.comma))break}}function $0(e){er(e),me?Xd():_e&&p0()}function us(e,t,s=false){p(r.star)&&C(),t&&!s&&!p(r.name)&&!p(r._yield)&&le();let i=null;p(r.name)&&(t||(i=c.tokens.length,c.scopeDepth++),es(false));const n=c.tokens.length;c.scopeDepth++,Cs(),ul(e);const a=c.tokens.length;c.scopes.push(new At(n,a,true)),c.scopeDepth--,i!==null&&(c.scopes.push(new At(i,a,true)),c.scopeDepth--)}function Cs(e=false,t=0){me?Gd():_e&&f0(),A(r.parenL),t&&(c.tokens[c.tokens.length-1].contextId=t),_a(r.parenR,false,false,e,t),t&&(c.tokens[c.tokens.length-1].contextId=t)}function ls(e,t=false){const s=Xs();C(),c.tokens[c.tokens.length-1].contextId=s,c.tokens[c.tokens.length-1].isExpression=!e;let i=null;e||(i=c.tokens.length,c.scopeDepth++),G0(e,t),X0();const n=c.tokens.length;if(q0(s),!c.error&&(c.tokens[n].contextId=s,c.tokens[c.tokens.length-1].contextId=s,i!==null)){const a=c.tokens.length;c.scopes.push(new At(i,a,false)),c.scopeDepth--}}function vl(){return p(r.eq)||p(r.semi)||p(r.braceR)||p(r.bang)||p(r.colon)}function kl(){return p(r.parenL)||p(r.lessThan)}function q0(e){for(A(r.braceL);!S(r.braceR)&&!c.error;){if(S(r.semi))continue;if(p(r.at)){yl();continue}const t=c.start;H0(t,e)}}function H0(e,t){me&&xa([g._declare,g._public,g._protected,g._private,g._override]);let s=false;if(p(r.name)&&c.contextualKeyword===g._static){if(ae(),kl()){Os(e,false);return}else if(vl()){yi();return}if(c.tokens[c.tokens.length-1].type=r._static,s=true,p(r.braceL)){c.tokens[c.tokens.length-1].contextId=t,Kt();return}}W0(e,s,t)}function W0(e,t,s){if(me&&jd(t))return;if(S(r.star)){Ns(s),Os(e,false);return}Ns(s);let i=false;const n=c.tokens[c.tokens.length-1];n.contextualKeyword===g._constructor&&(i=true),Ho(),kl()?Os(e,i):vl()?yi():n.contextualKeyword===g._async&&!vt()?(c.tokens[c.tokens.length-1].type=r._async,p(r.star)&&C(),Ns(s),Ho(),Os(e,false)):(n.contextualKeyword===g._get||n.contextualKeyword===g._set)&&!(vt()&&p(r.star))?(n.contextualKeyword===g._get?c.tokens[c.tokens.length-1].type=r._get:c.tokens[c.tokens.length-1].type=r._set,Ns(s),Os(e,false)):n.contextualKeyword===g._accessor&&!vt()?(Ns(s),yi()):vt()?yi():le()}function Os(e,t){me?fs():_e&&p(r.lessThan)&&bt(),Vn(e,t)}function Ns(e){Ks(e)}function Ho(){if(me){const e=pe(0);S(r.question),fe(e)}}function yi(){if(me?(Eu(r.bang),As()):_e&&p(r.colon)&&ps(),p(r.eq)){const e=c.tokens.length;C(),Oe(),c.tokens[e].rhsEndIndex=c.tokens.length}Ee()}function G0(e,t=false){me&&(!e||t)&&ee(g._implements)||(p(r.name)&&es(true),me?fs():_e&&p(r.lessThan)&&bt())}function X0(){let e=false;S(r._extends)?(nl(),e=true):e=false,me?Hd(e):_e&&o0(e)}function wl(){const e=c.tokens.length-1;me&&Ud()||(Z0()?Q0():K0()?(ae(),p(r.comma)&&Ae()===r.star?(A(r.comma),A(r.star),Re(g._as),ae()):Sl(),Qs()):S(r._default)?Y0():eg()?z0():(Va(),Qs()),c.tokens[e].rhsEndIndex=c.tokens.length)}function Y0(){if(me&&Bd()||_e&&e0())return;const e=c.start;S(r._function)?us(e,true,true):ee(g._async)&&Ae()===r._function?(Le(g._async),S(r._function),us(e,true,true)):p(r._class)?ls(true,true):p(r.at)?(Ba(),ls(true,true)):(Oe(),Ee())}function z0(){me?qd():_e?r0():st(true)}function K0(){if(me&&Ju())return false;if(_e&&i0())return false;if(p(r.name))return c.contextualKeyword!==g._async;if(!p(r._default))return false;const e=ga(),t=ri(),s=t.type===r.name&&t.contextualKeyword===g._from;if(t.type===r.comma)return true;if(s){const i=$.charCodeAt(Tu(e+4));return i===y.quotationMark||i===y.apostrophe}return false}function Sl(){S(r.comma)&&Va()}function Qs(){Le(g._from)&&(Bt(),Tl()),Ee()}function Z0(){return _e?n0():p(r.star)}function Q0(){_e?a0():qn()}function qn(){A(r.star),ee(g._as)?J0():Qs()}function J0(){C(),c.tokens[c.tokens.length-1].type=r._as,ae(),Sl(),Qs()}function eg(){return me&&Ju()||_e&&s0()||c.type===r._var||c.type===r._const||c.type===r._let||c.type===r._function||c.type===r._class||ee(g._async)||p(r.at)}function Va(){let e=true;for(A(r.braceL);!S(r.braceR)&&!c.error;){if(e)e=false;else if(A(r.comma),S(r.braceR))break;tg()}}function tg(){if(me){Od();return}ae(),c.tokens[c.tokens.length-1].identifierRole=ie.ExportAccess,Le(g._as)&&ae()}function sg(){const e=c.snapshot();return Re(g._module),Le(g._from)?ee(g._from)?(c.restoreFromSnapshot(e),true):(c.restoreFromSnapshot(e),false):p(r.comma)?(c.restoreFromSnapshot(e),false):(c.restoreFromSnapshot(e),true)}function ig(){ee(g._module)&&sg()&&C()}function El(){if(me&&p(r.name)&&Ae()===r.eq){Mn();return}if(me&&ee(g._type)){const e=ri();if(e.type===r.name&&e.contextualKeyword!==g._from){if(Re(g._type),Ae()===r.eq){Mn();return}}else(e.type===r.star||e.type===r.braceL)&&Re(g._type)}p(r.string)||(ig(),ng(),Re(g._from)),Bt(),Tl(),Ee()}function rg(){return p(r.name)}function Wo(){Pi()}function ng(){_e&&l0();let e=true;if(!(rg()&&(Wo(),!S(r.comma)))){if(p(r.star)){C(),Re(g._as),Wo();return}for(A(r.braceL);!S(r.braceR)&&!c.error;){if(e)e=false;else if(S(r.colon)&&le("ES2015 named imports do not destructure. Use another statement for destructuring after the import."),A(r.comma),S(r.braceR))break;ag()}}}function ag(){if(me){Md();return}if(_e){h0();return}Pi(),ee(g._as)&&(c.tokens[c.tokens.length-1].identifierRole=ie.ImportAccess,C(),Pi())}function Tl(){(p(r._with)||ee(g._assert)&&!We())&&(C(),Ra(false,false))}function og(){return c.pos===0&&$.charCodeAt(0)===y.numberSign&&$.charCodeAt(1)===y.exclamationMark&&Cu(2),Iu(),k0()}class cg{constructor(t,s){this.tokens=t,this.scopes=s}}function ug(e,t,s,i){if(i&&s)throw new Error("Cannot combine flow and typescript plugins.");Lf(e,t,s,i);const n=og();if(c.error)throw Cf(c.error);return n}function lg(e){let t=e.currentIndex(),s=0;const i=e.currentToken();do{const n=e.tokens[t];if(n.isOptionalChainStart&&s++,n.isOptionalChainEnd&&s--,s+=n.numNullishCoalesceStarts,s-=n.numNullishCoalesceEnds,n.contextualKeyword===g._await&&n.identifierRole==null&&n.scopeDepth===i.scopeDepth)return true;t+=1}while(s>0&&t<e.tokens.length);return false}class js{__init(){this.resultCode=""}__init2(){this.resultMappings=new Array(this.tokens.length)}__init3(){this.tokenIndex=0}constructor(t,s,i,n,a){this.code=t,this.tokens=s,this.isFlowEnabled=i,this.disableESTransforms=n,this.helperManager=a,js.prototype.__init.call(this),js.prototype.__init2.call(this),js.prototype.__init3.call(this)}snapshot(){return{resultCode:this.resultCode,tokenIndex:this.tokenIndex}}restoreToSnapshot(t){this.resultCode=t.resultCode,this.tokenIndex=t.tokenIndex}dangerouslyGetAndRemoveCodeSinceSnapshot(t){const s=this.resultCode.slice(t.resultCode.length);return this.resultCode=t.resultCode,s}reset(){this.resultCode="",this.resultMappings=new Array(this.tokens.length),this.tokenIndex=0}matchesContextualAtIndex(t,s){return this.matches1AtIndex(t,r.name)&&this.tokens[t].contextualKeyword===s}identifierNameAtIndex(t){return this.identifierNameForToken(this.tokens[t])}identifierNameAtRelativeIndex(t){return this.identifierNameForToken(this.tokenAtRelativeIndex(t))}identifierName(){return this.identifierNameForToken(this.currentToken())}identifierNameForToken(t){return this.code.slice(t.start,t.end)}rawCodeForToken(t){return this.code.slice(t.start,t.end)}stringValueAtIndex(t){return this.stringValueForToken(this.tokens[t])}stringValue(){return this.stringValueForToken(this.currentToken())}stringValueForToken(t){return this.code.slice(t.start+1,t.end-1)}matches1AtIndex(t,s){return this.tokens[t].type===s}matches2AtIndex(t,s,i){return this.tokens[t].type===s&&this.tokens[t+1].type===i}matches3AtIndex(t,s,i,n){return this.tokens[t].type===s&&this.tokens[t+1].type===i&&this.tokens[t+2].type===n}matches1(t){return this.tokens[this.tokenIndex].type===t}matches2(t,s){return this.tokens[this.tokenIndex].type===t&&this.tokens[this.tokenIndex+1].type===s}matches3(t,s,i){return this.tokens[this.tokenIndex].type===t&&this.tokens[this.tokenIndex+1].type===s&&this.tokens[this.tokenIndex+2].type===i}matches4(t,s,i,n){return this.tokens[this.tokenIndex].type===t&&this.tokens[this.tokenIndex+1].type===s&&this.tokens[this.tokenIndex+2].type===i&&this.tokens[this.tokenIndex+3].type===n}matches5(t,s,i,n,a){return this.tokens[this.tokenIndex].type===t&&this.tokens[this.tokenIndex+1].type===s&&this.tokens[this.tokenIndex+2].type===i&&this.tokens[this.tokenIndex+3].type===n&&this.tokens[this.tokenIndex+4].type===a}matchesContextual(t){return this.matchesContextualAtIndex(this.tokenIndex,t)}matchesContextIdAndLabel(t,s){return this.matches1(t)&&this.currentToken().contextId===s}previousWhitespaceAndComments(){let t=this.code.slice(this.tokenIndex>0?this.tokens[this.tokenIndex-1].end:0,this.tokenIndex<this.tokens.length?this.tokens[this.tokenIndex].start:this.code.length);return this.isFlowEnabled&&(t=t.replace(/@flow/g,"")),t}replaceToken(t){this.resultCode+=this.previousWhitespaceAndComments(),this.appendTokenPrefix(),this.resultMappings[this.tokenIndex]=this.resultCode.length,this.resultCode+=t,this.appendTokenSuffix(),this.tokenIndex++}replaceTokenTrimmingLeftWhitespace(t){this.resultCode+=this.previousWhitespaceAndComments().replace(/[^\r\n]/g,""),this.appendTokenPrefix(),this.resultMappings[this.tokenIndex]=this.resultCode.length,this.resultCode+=t,this.appendTokenSuffix(),this.tokenIndex++}removeInitialToken(){this.replaceToken("")}removeToken(){this.replaceTokenTrimmingLeftWhitespace("")}removeBalancedCode(){let t=0;for(;!this.isAtEnd();){if(this.matches1(r.braceL))t++;else if(this.matches1(r.braceR)){if(t===0)return;t--}this.removeToken()}}copyExpectedToken(t){if(this.tokens[this.tokenIndex].type!==t)throw new Error(`Expected token ${t}`);this.copyToken()}copyToken(){this.resultCode+=this.previousWhitespaceAndComments(),this.appendTokenPrefix(),this.resultMappings[this.tokenIndex]=this.resultCode.length,this.resultCode+=this.code.slice(this.tokens[this.tokenIndex].start,this.tokens[this.tokenIndex].end),this.appendTokenSuffix(),this.tokenIndex++}copyTokenWithPrefix(t){this.resultCode+=this.previousWhitespaceAndComments(),this.appendTokenPrefix(),this.resultCode+=t,this.resultMappings[this.tokenIndex]=this.resultCode.length,this.resultCode+=this.code.slice(this.tokens[this.tokenIndex].start,this.tokens[this.tokenIndex].end),this.appendTokenSuffix(),this.tokenIndex++}appendTokenPrefix(){const t=this.currentToken();if((t.numNullishCoalesceStarts||t.isOptionalChainStart)&&(t.isAsyncOperation=lg(this)),!this.disableESTransforms){if(t.numNullishCoalesceStarts)for(let s=0;s<t.numNullishCoalesceStarts;s++)t.isAsyncOperation?(this.resultCode+="await ",this.resultCode+=this.helperManager.getHelperName("asyncNullishCoalesce")):this.resultCode+=this.helperManager.getHelperName("nullishCoalesce"),this.resultCode+="(";t.isOptionalChainStart&&(t.isAsyncOperation&&(this.resultCode+="await "),this.tokenIndex>0&&this.tokenAtRelativeIndex(-1).type===r._delete?t.isAsyncOperation?this.resultCode+=this.helperManager.getHelperName("asyncOptionalChainDelete"):this.resultCode+=this.helperManager.getHelperName("optionalChainDelete"):t.isAsyncOperation?this.resultCode+=this.helperManager.getHelperName("asyncOptionalChain"):this.resultCode+=this.helperManager.getHelperName("optionalChain"),this.resultCode+="([")}}appendTokenSuffix(){const t=this.currentToken();if(t.isOptionalChainEnd&&!this.disableESTransforms&&(this.resultCode+="])"),t.numNullishCoalesceEnds&&!this.disableESTransforms)for(let s=0;s<t.numNullishCoalesceEnds;s++)this.resultCode+="))"}appendCode(t){this.resultCode+=t}currentToken(){return this.tokens[this.tokenIndex]}currentTokenCode(){const t=this.currentToken();return this.code.slice(t.start,t.end)}tokenAtRelativeIndex(t){return this.tokens[this.tokenIndex+t]}currentIndex(){return this.tokenIndex}nextToken(){if(this.tokenIndex===this.tokens.length)throw new Error("Unexpectedly reached end of input.");this.tokenIndex++}previousToken(){this.tokenIndex--}finish(){if(this.tokenIndex!==this.tokens.length)throw new Error("Tried to finish processing tokens before reaching the end.");return this.resultCode+=this.previousWhitespaceAndComments(),{code:this.resultCode,mappings:this.resultMappings}}isAtEnd(){return this.tokenIndex===this.tokens.length}}function hg(e,t,s,i){const n=t.snapshot(),a=fg(t);let o=[];const u=[],l=[];let h=null;const d=[],m=[],_=t.currentToken().contextId;if(_==null)throw new Error("Expected non-null class context ID on class open-brace.");for(t.nextToken();!t.matchesContextIdAndLabel(r.braceR,_);)if(t.matchesContextual(g._constructor)&&!t.currentToken().isType)({constructorInitializerStatements:o,constructorInsertPos:h}=Go(t));else if(t.matches1(r.semi))i||m.push({start:t.currentIndex(),end:t.currentIndex()+1}),t.nextToken();else if(t.currentToken().isType)t.nextToken();else{const k=t.currentIndex();let T=false,P=false,F=false;for(;Mi(t.currentToken());)t.matches1(r._static)&&(T=true),t.matches1(r.hash)&&(P=true),(t.matches1(r._declare)||t.matches1(r._abstract))&&(F=true),t.nextToken();if(T&&t.matches1(r.braceL)){bn(t,_);continue}if(P){bn(t,_);continue}if(t.matchesContextual(g._constructor)&&!t.currentToken().isType){({constructorInitializerStatements:o,constructorInsertPos:h}=Go(t));continue}const B=t.currentIndex();if(pg(t),t.matches1(r.lessThan)||t.matches1(r.parenL)){bn(t,_);continue}for(;t.currentToken().isType;)t.nextToken();if(t.matches1(r.eq)){const N=t.currentIndex(),Y=t.currentToken().rhsEndIndex;if(Y==null)throw new Error("Expected rhsEndIndex on class field assignment.");for(t.nextToken();t.currentIndex()<Y;)e.processToken();let q;T?(q=s.claimFreeName("__initStatic"),l.push(q)):(q=s.claimFreeName("__init"),u.push(q)),d.push({initializerName:q,equalsIndex:N,start:B,end:t.currentIndex()})}else(!i||F)&&m.push({start:k,end:t.currentIndex()})}return t.restoreToSnapshot(n),i?{headerInfo:a,constructorInitializerStatements:o,instanceInitializerNames:[],staticInitializerNames:[],constructorInsertPos:h,fields:[],rangesToRemove:m}:{headerInfo:a,constructorInitializerStatements:o,instanceInitializerNames:u,staticInitializerNames:l,constructorInsertPos:h,fields:d,rangesToRemove:m}}function bn(e,t){for(e.nextToken();e.currentToken().contextId!==t;)e.nextToken();for(;Mi(e.tokenAtRelativeIndex(-1));)e.previousToken()}function fg(e){const t=e.currentToken(),s=t.contextId;if(s==null)throw new Error("Expected context ID on class token.");const i=t.isExpression;if(i==null)throw new Error("Expected isExpression on class token.");let n=null,a=false;for(e.nextToken(),e.matches1(r.name)&&(n=e.identifierName());!e.matchesContextIdAndLabel(r.braceL,s);)e.matches1(r._extends)&&!e.currentToken().isType&&(a=true),e.nextToken();return{isExpression:i,className:n,hasSuperclass:a}}function Go(e){const t=[];e.nextToken();const s=e.currentToken().contextId;if(s==null)throw new Error("Expected context ID on open-paren starting constructor params.");for(;!e.matchesContextIdAndLabel(r.parenR,s);)if(e.currentToken().contextId===s){if(e.nextToken(),Mi(e.currentToken())){for(e.nextToken();Mi(e.currentToken());)e.nextToken();const a=e.currentToken();if(a.type!==r.name)throw new Error("Expected identifier after access modifiers in constructor arg.");const o=e.identifierNameForToken(a);t.push(`this.${o} = ${o}`)}}else e.nextToken();for(e.nextToken();e.currentToken().isType;)e.nextToken();let i=e.currentIndex(),n=false;for(;!e.matchesContextIdAndLabel(r.braceR,s);){if(!n&&e.matches2(r._super,r.parenL)){e.nextToken();const a=e.currentToken().contextId;if(a==null)throw new Error("Expected a context ID on the super call");for(;!e.matchesContextIdAndLabel(r.parenR,a);)e.nextToken();i=e.currentIndex(),n=true}e.nextToken()}return e.nextToken(),{constructorInitializerStatements:t,constructorInsertPos:i}}function Mi(e){return[r._async,r._get,r._set,r.plus,r.minus,r._readonly,r._static,r._public,r._private,r._protected,r._override,r._abstract,r.star,r._declare,r.hash].includes(e.type)}function pg(e){if(e.matches1(r.bracketL)){const s=e.currentToken().contextId;if(s==null)throw new Error("Expected class context ID on computed name open bracket.");for(;!e.matchesContextIdAndLabel(r.bracketR,s);)e.nextToken();e.nextToken()}else e.nextToken()}function Al(e){if(e.removeInitialToken(),e.removeToken(),e.removeToken(),e.removeToken(),e.matches1(r.parenL))e.removeToken(),e.removeToken(),e.removeToken();else for(;e.matches1(r.dot);)e.removeToken(),e.removeToken()}const Il={typeDeclarations:new Set,valueDeclarations:new Set};function Cl(e){const t=new Set,s=new Set;for(let i=0;i<e.tokens.length;i++){const n=e.tokens[i];n.type===r.name&&Su(n)&&(n.isType?t.add(e.identifierNameForToken(n)):s.add(e.identifierNameForToken(n)))}return{typeDeclarations:t,valueDeclarations:s}}function Rl(e){let t=e.currentIndex();for(;!e.matches1AtIndex(t,r.braceR);)t++;return e.matchesContextualAtIndex(t+1,g._from)&&e.matches1AtIndex(t+2,r.string)}function as(e){(e.matches2(r._with,r.braceL)||e.matches2(r.name,r.braceL)&&e.matchesContextual(g._assert))&&(e.removeToken(),e.removeToken(),e.removeBalancedCode(),e.removeToken())}function Pl(e,t,s,i){if(!e||t)return false;const n=s.currentToken();if(n.rhsEndIndex==null)throw new Error("Expected non-null rhsEndIndex on export token.");const a=n.rhsEndIndex-s.currentIndex();if(a!==3&&!(a===4&&s.matches1AtIndex(n.rhsEndIndex-1,r.semi)))return false;const o=s.tokenAtRelativeIndex(2);if(o.type!==r.name)return false;const u=s.identifierNameForToken(o);return i.typeDeclarations.has(u)&&!i.valueDeclarations.has(u)}class $s extends gt{__init(){this.hadExport=false}__init2(){this.hadNamedExport=false}__init3(){this.hadDefaultExport=false}constructor(t,s,i,n,a,o,u,l,h,d,m,_){super(),this.rootTransformer=t,this.tokens=s,this.importProcessor=i,this.nameManager=n,this.helperManager=a,this.reactHotLoaderTransformer=o,this.enableLegacyBabel5ModuleInterop=u,this.enableLegacyTypeScriptModuleInterop=l,this.isTypeScriptTransformEnabled=h,this.isFlowTransformEnabled=d,this.preserveDynamicImport=m,this.keepUnusedImports=_,$s.prototype.__init.call(this),$s.prototype.__init2.call(this),$s.prototype.__init3.call(this),this.declarationInfo=h?Cl(s):Il}getPrefixCode(){let t="";return this.hadExport&&(t+='Object.defineProperty(exports, "__esModule", {value: true});'),t}getSuffixCode(){return this.enableLegacyBabel5ModuleInterop&&this.hadDefaultExport&&!this.hadNamedExport?`
564
- module.exports = exports.default;
565
- `:""}process(){return this.tokens.matches3(r._import,r.name,r.eq)?this.processImportEquals():this.tokens.matches1(r._import)?(this.processImport(),true):this.tokens.matches2(r._export,r.eq)?(this.tokens.replaceToken("module.exports"),true):this.tokens.matches1(r._export)&&!this.tokens.currentToken().isType?(this.hadExport=true,this.processExport()):this.tokens.matches2(r.name,r.postIncDec)&&this.processPostIncDec()?true:this.tokens.matches1(r.name)||this.tokens.matches1(r.jsxName)?this.processIdentifier():this.tokens.matches1(r.eq)?this.processAssignment():this.tokens.matches1(r.assign)?this.processComplexAssignment():this.tokens.matches1(r.preIncDec)?this.processPreIncDec():false}processImportEquals(){const t=this.tokens.identifierNameAtIndex(this.tokens.currentIndex()+1);return this.importProcessor.shouldAutomaticallyElideImportedName(t)?Al(this.tokens):this.tokens.replaceToken("const"),true}processImport(){if(this.tokens.matches2(r._import,r.parenL)){if(this.preserveDynamicImport){this.tokens.copyToken();return}const s=this.enableLegacyTypeScriptModuleInterop?"":`${this.helperManager.getHelperName("interopRequireWildcard")}(`;this.tokens.replaceToken(`Promise.resolve().then(() => ${s}require`);const i=this.tokens.currentToken().contextId;if(i==null)throw new Error("Expected context ID on dynamic import invocation.");for(this.tokens.copyToken();!this.tokens.matchesContextIdAndLabel(r.parenR,i);)this.rootTransformer.processToken();this.tokens.replaceToken(s?")))":"))");return}if(this.removeImportAndDetectIfShouldElide())this.tokens.removeToken();else{const s=this.tokens.stringValue();this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(s)),this.tokens.appendCode(this.importProcessor.claimImportCode(s))}as(this.tokens),this.tokens.matches1(r.semi)&&this.tokens.removeToken()}removeImportAndDetectIfShouldElide(){if(this.tokens.removeInitialToken(),this.tokens.matchesContextual(g._type)&&!this.tokens.matches1AtIndex(this.tokens.currentIndex()+1,r.comma)&&!this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+1,g._from))return this.removeRemainingImport(),true;if(this.tokens.matches1(r.name)||this.tokens.matches1(r.star))return this.removeRemainingImport(),false;if(this.tokens.matches1(r.string))return false;let t=false,s=false;for(;!this.tokens.matches1(r.string);)(!t&&this.tokens.matches1(r.braceL)||this.tokens.matches1(r.comma))&&(this.tokens.removeToken(),this.tokens.matches1(r.braceR)||(s=true),(this.tokens.matches2(r.name,r.comma)||this.tokens.matches2(r.name,r.braceR)||this.tokens.matches4(r.name,r.name,r.name,r.comma)||this.tokens.matches4(r.name,r.name,r.name,r.braceR))&&(t=true)),this.tokens.removeToken();return this.keepUnusedImports?false:this.isTypeScriptTransformEnabled?!t:this.isFlowTransformEnabled?s&&!t:false}removeRemainingImport(){for(;!this.tokens.matches1(r.string);)this.tokens.removeToken()}processIdentifier(){const t=this.tokens.currentToken();if(t.shadowsGlobal)return false;if(t.identifierRole===ie.ObjectShorthand)return this.processObjectShorthand();if(t.identifierRole!==ie.Access)return false;const s=this.importProcessor.getIdentifierReplacement(this.tokens.identifierNameForToken(t));if(!s)return false;let i=this.tokens.currentIndex()+1;for(;i<this.tokens.tokens.length&&this.tokens.tokens[i].type===r.parenR;)i++;return this.tokens.tokens[i].type===r.parenL?this.tokens.tokenAtRelativeIndex(1).type===r.parenL&&this.tokens.tokenAtRelativeIndex(-1).type!==r._new?(this.tokens.replaceToken(`${s}.call(void 0, `),this.tokens.removeToken(),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(r.parenR)):this.tokens.replaceToken(`(0, ${s})`):this.tokens.replaceToken(s),true}processObjectShorthand(){const t=this.tokens.identifierName(),s=this.importProcessor.getIdentifierReplacement(t);return s?(this.tokens.replaceToken(`${t}: ${s}`),true):false}processExport(){if(this.tokens.matches2(r._export,r._enum)||this.tokens.matches3(r._export,r._const,r._enum))return this.hadNamedExport=true,false;if(this.tokens.matches2(r._export,r._default))return this.tokens.matches3(r._export,r._default,r._enum)?(this.hadDefaultExport=true,false):(this.processExportDefault(),true);if(this.tokens.matches2(r._export,r.braceL))return this.processExportBindings(),true;if(this.tokens.matches2(r._export,r.name)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+1,g._type)){if(this.tokens.removeInitialToken(),this.tokens.removeToken(),this.tokens.matches1(r.braceL)){for(;!this.tokens.matches1(r.braceR);)this.tokens.removeToken();this.tokens.removeToken()}else this.tokens.removeToken(),this.tokens.matches1(r._as)&&(this.tokens.removeToken(),this.tokens.removeToken());return this.tokens.matchesContextual(g._from)&&this.tokens.matches1AtIndex(this.tokens.currentIndex()+1,r.string)&&(this.tokens.removeToken(),this.tokens.removeToken(),as(this.tokens)),true}if(this.hadNamedExport=true,this.tokens.matches2(r._export,r._var)||this.tokens.matches2(r._export,r._let)||this.tokens.matches2(r._export,r._const))return this.processExportVar(),true;if(this.tokens.matches2(r._export,r._function)||this.tokens.matches3(r._export,r.name,r._function))return this.processExportFunction(),true;if(this.tokens.matches2(r._export,r._class)||this.tokens.matches3(r._export,r._abstract,r._class)||this.tokens.matches2(r._export,r.at))return this.processExportClass(),true;if(this.tokens.matches2(r._export,r.star))return this.processExportStar(),true;throw new Error("Unrecognized export syntax.")}processAssignment(){const t=this.tokens.currentIndex(),s=this.tokens.tokens[t-1];if(s.isType||s.type!==r.name||s.shadowsGlobal||t>=2&&this.tokens.matches1AtIndex(t-2,r.dot)||t>=2&&[r._var,r._let,r._const].includes(this.tokens.tokens[t-2].type))return false;const i=this.importProcessor.resolveExportBinding(this.tokens.identifierNameForToken(s));return i?(this.tokens.copyToken(),this.tokens.appendCode(` ${i} =`),true):false}processComplexAssignment(){const t=this.tokens.currentIndex(),s=this.tokens.tokens[t-1];if(s.type!==r.name||s.shadowsGlobal||t>=2&&this.tokens.matches1AtIndex(t-2,r.dot))return false;const i=this.importProcessor.resolveExportBinding(this.tokens.identifierNameForToken(s));return i?(this.tokens.appendCode(` = ${i}`),this.tokens.copyToken(),true):false}processPreIncDec(){const t=this.tokens.currentIndex(),s=this.tokens.tokens[t+1];if(s.type!==r.name||s.shadowsGlobal||t+2<this.tokens.tokens.length&&(this.tokens.matches1AtIndex(t+2,r.dot)||this.tokens.matches1AtIndex(t+2,r.bracketL)||this.tokens.matches1AtIndex(t+2,r.parenL)))return false;const i=this.tokens.identifierNameForToken(s),n=this.importProcessor.resolveExportBinding(i);return n?(this.tokens.appendCode(`${n} = `),this.tokens.copyToken(),true):false}processPostIncDec(){const t=this.tokens.currentIndex(),s=this.tokens.tokens[t],i=this.tokens.tokens[t+1];if(s.type!==r.name||s.shadowsGlobal||t>=1&&this.tokens.matches1AtIndex(t-1,r.dot))return false;const n=this.tokens.identifierNameForToken(s),a=this.importProcessor.resolveExportBinding(n);if(!a)return false;const o=this.tokens.rawCodeForToken(i),u=this.importProcessor.getIdentifierReplacement(n)||n;if(o==="++")this.tokens.replaceToken(`(${u} = ${a} = ${u} + 1, ${u} - 1)`);else if(o==="--")this.tokens.replaceToken(`(${u} = ${a} = ${u} - 1, ${u} + 1)`);else throw new Error(`Unexpected operator: ${o}`);return this.tokens.removeToken(),true}processExportDefault(){let t=true;if(this.tokens.matches4(r._export,r._default,r._function,r.name)||this.tokens.matches5(r._export,r._default,r.name,r._function,r.name)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+2,g._async)){this.tokens.removeInitialToken(),this.tokens.removeToken();const s=this.processNamedFunction();this.tokens.appendCode(` exports.default = ${s};`)}else if(this.tokens.matches4(r._export,r._default,r._class,r.name)||this.tokens.matches5(r._export,r._default,r._abstract,r._class,r.name)||this.tokens.matches3(r._export,r._default,r.at)){this.tokens.removeInitialToken(),this.tokens.removeToken(),this.copyDecorators(),this.tokens.matches1(r._abstract)&&this.tokens.removeToken();const s=this.rootTransformer.processNamedClass();this.tokens.appendCode(` exports.default = ${s};`)}else if(Pl(this.isTypeScriptTransformEnabled,this.keepUnusedImports,this.tokens,this.declarationInfo))t=false,this.tokens.removeInitialToken(),this.tokens.removeToken(),this.tokens.removeToken();else if(this.reactHotLoaderTransformer){const s=this.nameManager.claimFreeName("_default");this.tokens.replaceToken(`let ${s}; exports.`),this.tokens.copyToken(),this.tokens.appendCode(` = ${s} =`),this.reactHotLoaderTransformer.setExtractedDefaultExportName(s)}else this.tokens.replaceToken("exports."),this.tokens.copyToken(),this.tokens.appendCode(" =");t&&(this.hadDefaultExport=true)}copyDecorators(){for(;this.tokens.matches1(r.at);)if(this.tokens.copyToken(),this.tokens.matches1(r.parenL))this.tokens.copyExpectedToken(r.parenL),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(r.parenR);else{for(this.tokens.copyExpectedToken(r.name);this.tokens.matches1(r.dot);)this.tokens.copyExpectedToken(r.dot),this.tokens.copyExpectedToken(r.name);this.tokens.matches1(r.parenL)&&(this.tokens.copyExpectedToken(r.parenL),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(r.parenR))}}processExportVar(){this.isSimpleExportVar()?this.processSimpleExportVar():this.processComplexExportVar()}isSimpleExportVar(){let t=this.tokens.currentIndex();if(t++,t++,!this.tokens.matches1AtIndex(t,r.name))return false;for(t++;t<this.tokens.tokens.length&&this.tokens.tokens[t].isType;)t++;return!!this.tokens.matches1AtIndex(t,r.eq)}processSimpleExportVar(){this.tokens.removeInitialToken(),this.tokens.copyToken();const t=this.tokens.identifierName();for(;!this.tokens.matches1(r.eq);)this.rootTransformer.processToken();const s=this.tokens.currentToken().rhsEndIndex;if(s==null)throw new Error("Expected = token with an end index.");for(;this.tokens.currentIndex()<s;)this.rootTransformer.processToken();this.tokens.appendCode(`; exports.${t} = ${t}`)}processComplexExportVar(){this.tokens.removeInitialToken(),this.tokens.removeToken();const t=this.tokens.matches1(r.braceL);t&&this.tokens.appendCode("(");let s=0;for(;;)if(this.tokens.matches1(r.braceL)||this.tokens.matches1(r.dollarBraceL)||this.tokens.matches1(r.bracketL))s++,this.tokens.copyToken();else if(this.tokens.matches1(r.braceR)||this.tokens.matches1(r.bracketR))s--,this.tokens.copyToken();else{if(s===0&&!this.tokens.matches1(r.name)&&!this.tokens.currentToken().isType)break;if(this.tokens.matches1(r.eq)){const i=this.tokens.currentToken().rhsEndIndex;if(i==null)throw new Error("Expected = token with an end index.");for(;this.tokens.currentIndex()<i;)this.rootTransformer.processToken()}else{const i=this.tokens.currentToken();if(wu(i)){const n=this.tokens.identifierName();let a=this.importProcessor.getIdentifierReplacement(n);if(a===null)throw new Error(`Expected a replacement for ${n} in \`export var\` syntax.`);Of(i)&&(a=`${n}: ${a}`),this.tokens.replaceToken(a)}else this.rootTransformer.processToken()}}if(t){const i=this.tokens.currentToken().rhsEndIndex;if(i==null)throw new Error("Expected = token with an end index.");for(;this.tokens.currentIndex()<i;)this.rootTransformer.processToken();this.tokens.appendCode(")")}}processExportFunction(){this.tokens.replaceToken("");const t=this.processNamedFunction();this.tokens.appendCode(` exports.${t} = ${t};`)}processNamedFunction(){if(this.tokens.matches1(r._function))this.tokens.copyToken();else if(this.tokens.matches2(r.name,r._function)){if(!this.tokens.matchesContextual(g._async))throw new Error("Expected async keyword in function export.");this.tokens.copyToken(),this.tokens.copyToken()}if(this.tokens.matches1(r.star)&&this.tokens.copyToken(),!this.tokens.matches1(r.name))throw new Error("Expected identifier for exported function name.");const t=this.tokens.identifierName();if(this.tokens.copyToken(),this.tokens.currentToken().isType)for(this.tokens.removeInitialToken();this.tokens.currentToken().isType;)this.tokens.removeToken();return this.tokens.copyExpectedToken(r.parenL),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(r.parenR),this.rootTransformer.processPossibleTypeRange(),this.tokens.copyExpectedToken(r.braceL),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(r.braceR),t}processExportClass(){this.tokens.removeInitialToken(),this.copyDecorators(),this.tokens.matches1(r._abstract)&&this.tokens.removeToken();const t=this.rootTransformer.processNamedClass();this.tokens.appendCode(` exports.${t} = ${t};`)}processExportBindings(){this.tokens.removeInitialToken(),this.tokens.removeToken();const t=Rl(this.tokens),s=[];for(;;){if(this.tokens.matches1(r.braceR)){this.tokens.removeToken();break}const i=Ys(this.tokens);for(;this.tokens.currentIndex()<i.endIndex;)this.tokens.removeToken();if(!(i.isType||!t&&this.shouldElideExportedIdentifier(i.leftName))){const a=i.rightName;a==="default"?this.hadDefaultExport=true:this.hadNamedExport=true;const o=i.leftName,u=this.importProcessor.getIdentifierReplacement(o);s.push(`exports.${a} = ${u||o};`)}if(this.tokens.matches1(r.braceR)){this.tokens.removeToken();break}if(this.tokens.matches2(r.comma,r.braceR)){this.tokens.removeToken(),this.tokens.removeToken();break}else if(this.tokens.matches1(r.comma))this.tokens.removeToken();else throw new Error(`Unexpected token: ${JSON.stringify(this.tokens.currentToken())}`)}if(this.tokens.matchesContextual(g._from)){this.tokens.removeToken();const i=this.tokens.stringValue();this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(i)),as(this.tokens)}else this.tokens.appendCode(s.join(" "));this.tokens.matches1(r.semi)&&this.tokens.removeToken()}processExportStar(){for(this.tokens.removeInitialToken();!this.tokens.matches1(r.string);)this.tokens.removeToken();const t=this.tokens.stringValue();this.tokens.replaceTokenTrimmingLeftWhitespace(this.importProcessor.claimImportCode(t)),as(this.tokens),this.tokens.matches1(r.semi)&&this.tokens.removeToken()}shouldElideExportedIdentifier(t){return this.isTypeScriptTransformEnabled&&!this.keepUnusedImports&&!this.declarationInfo.valueDeclarations.has(t)}}class dg extends gt{constructor(t,s,i,n,a,o,u,l){super(),this.tokens=t,this.nameManager=s,this.helperManager=i,this.reactHotLoaderTransformer=n,this.isTypeScriptTransformEnabled=a,this.isFlowTransformEnabled=o,this.keepUnusedImports=u,this.nonTypeIdentifiers=a&&!u?Ou(t,l):new Set,this.declarationInfo=a&&!u?Cl(t):Il,this.injectCreateRequireForImportRequire=!!l.injectCreateRequireForImportRequire}process(){if(this.tokens.matches3(r._import,r.name,r.eq))return this.processImportEquals();if(this.tokens.matches4(r._import,r.name,r.name,r.eq)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+1,g._type)){this.tokens.removeInitialToken();for(let t=0;t<7;t++)this.tokens.removeToken();return true}if(this.tokens.matches2(r._export,r.eq))return this.tokens.replaceToken("module.exports"),true;if(this.tokens.matches5(r._export,r._import,r.name,r.name,r.eq)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+2,g._type)){this.tokens.removeInitialToken();for(let t=0;t<8;t++)this.tokens.removeToken();return true}if(this.tokens.matches1(r._import))return this.processImport();if(this.tokens.matches2(r._export,r._default))return this.processExportDefault();if(this.tokens.matches2(r._export,r.braceL))return this.processNamedExports();if(this.tokens.matches2(r._export,r.name)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+1,g._type)){if(this.tokens.removeInitialToken(),this.tokens.removeToken(),this.tokens.matches1(r.braceL)){for(;!this.tokens.matches1(r.braceR);)this.tokens.removeToken();this.tokens.removeToken()}else this.tokens.removeToken(),this.tokens.matches1(r._as)&&(this.tokens.removeToken(),this.tokens.removeToken());return this.tokens.matchesContextual(g._from)&&this.tokens.matches1AtIndex(this.tokens.currentIndex()+1,r.string)&&(this.tokens.removeToken(),this.tokens.removeToken(),as(this.tokens)),true}return false}processImportEquals(){const t=this.tokens.identifierNameAtIndex(this.tokens.currentIndex()+1);return this.shouldAutomaticallyElideImportedName(t)?Al(this.tokens):this.injectCreateRequireForImportRequire?(this.tokens.replaceToken("const"),this.tokens.copyToken(),this.tokens.copyToken(),this.tokens.replaceToken(this.helperManager.getHelperName("require"))):this.tokens.replaceToken("const"),true}processImport(){if(this.tokens.matches2(r._import,r.parenL))return false;const t=this.tokens.snapshot();if(this.removeImportTypeBindings()){for(this.tokens.restoreToSnapshot(t);!this.tokens.matches1(r.string);)this.tokens.removeToken();this.tokens.removeToken(),as(this.tokens),this.tokens.matches1(r.semi)&&this.tokens.removeToken()}return true}removeImportTypeBindings(){if(this.tokens.copyExpectedToken(r._import),this.tokens.matchesContextual(g._type)&&!this.tokens.matches1AtIndex(this.tokens.currentIndex()+1,r.comma)&&!this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+1,g._from))return true;if(this.tokens.matches1(r.string))return this.tokens.copyToken(),false;this.tokens.matchesContextual(g._module)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+2,g._from)&&this.tokens.copyToken();let t=false,s=false,i=false;if(this.tokens.matches1(r.name)&&(this.shouldAutomaticallyElideImportedName(this.tokens.identifierName())?(this.tokens.removeToken(),this.tokens.matches1(r.comma)&&this.tokens.removeToken()):(t=true,this.tokens.copyToken(),this.tokens.matches1(r.comma)&&(i=true,this.tokens.removeToken()))),this.tokens.matches1(r.star))this.shouldAutomaticallyElideImportedName(this.tokens.identifierNameAtRelativeIndex(2))?(this.tokens.removeToken(),this.tokens.removeToken(),this.tokens.removeToken()):(i&&this.tokens.appendCode(","),t=true,this.tokens.copyExpectedToken(r.star),this.tokens.copyExpectedToken(r.name),this.tokens.copyExpectedToken(r.name));else if(this.tokens.matches1(r.braceL)){for(i&&this.tokens.appendCode(","),this.tokens.copyToken();!this.tokens.matches1(r.braceR);){s=true;const n=Ys(this.tokens);if(n.isType||this.shouldAutomaticallyElideImportedName(n.rightName)){for(;this.tokens.currentIndex()<n.endIndex;)this.tokens.removeToken();this.tokens.matches1(r.comma)&&this.tokens.removeToken()}else{for(t=true;this.tokens.currentIndex()<n.endIndex;)this.tokens.copyToken();this.tokens.matches1(r.comma)&&this.tokens.copyToken()}}this.tokens.copyExpectedToken(r.braceR)}return this.keepUnusedImports?false:this.isTypeScriptTransformEnabled?!t:this.isFlowTransformEnabled?s&&!t:false}shouldAutomaticallyElideImportedName(t){return this.isTypeScriptTransformEnabled&&!this.keepUnusedImports&&!this.nonTypeIdentifiers.has(t)}processExportDefault(){if(Pl(this.isTypeScriptTransformEnabled,this.keepUnusedImports,this.tokens,this.declarationInfo))return this.tokens.removeInitialToken(),this.tokens.removeToken(),this.tokens.removeToken(),true;if(!(this.tokens.matches4(r._export,r._default,r._function,r.name)||this.tokens.matches5(r._export,r._default,r.name,r._function,r.name)&&this.tokens.matchesContextualAtIndex(this.tokens.currentIndex()+2,g._async)||this.tokens.matches4(r._export,r._default,r._class,r.name)||this.tokens.matches5(r._export,r._default,r._abstract,r._class,r.name))&&this.reactHotLoaderTransformer){const s=this.nameManager.claimFreeName("_default");return this.tokens.replaceToken(`let ${s}; export`),this.tokens.copyToken(),this.tokens.appendCode(` ${s} =`),this.reactHotLoaderTransformer.setExtractedDefaultExportName(s),true}return false}processNamedExports(){if(!this.isTypeScriptTransformEnabled)return false;this.tokens.copyExpectedToken(r._export),this.tokens.copyExpectedToken(r.braceL);const t=Rl(this.tokens);let s=false;for(;!this.tokens.matches1(r.braceR);){const i=Ys(this.tokens);if(i.isType||!t&&this.shouldElideExportedName(i.leftName)){for(;this.tokens.currentIndex()<i.endIndex;)this.tokens.removeToken();this.tokens.matches1(r.comma)&&this.tokens.removeToken()}else{for(s=true;this.tokens.currentIndex()<i.endIndex;)this.tokens.copyToken();this.tokens.matches1(r.comma)&&this.tokens.copyToken()}}return this.tokens.copyExpectedToken(r.braceR),!this.keepUnusedImports&&t&&!s&&(this.tokens.removeToken(),this.tokens.removeToken(),as(this.tokens)),true}shouldElideExportedName(t){return this.isTypeScriptTransformEnabled&&!this.keepUnusedImports&&this.declarationInfo.typeDeclarations.has(t)&&!this.declarationInfo.valueDeclarations.has(t)}}class mg extends gt{constructor(t,s,i){super(),this.rootTransformer=t,this.tokens=s,this.isImportsTransformEnabled=i}process(){return this.rootTransformer.processPossibleArrowParamEnd()||this.rootTransformer.processPossibleAsyncArrowWithTypeParams()||this.rootTransformer.processPossibleTypeRange()?true:this.tokens.matches1(r._enum)?(this.processEnum(),true):this.tokens.matches2(r._export,r._enum)?(this.processNamedExportEnum(),true):this.tokens.matches3(r._export,r._default,r._enum)?(this.processDefaultExportEnum(),true):false}processNamedExportEnum(){if(this.isImportsTransformEnabled){this.tokens.removeInitialToken();const t=this.tokens.identifierNameAtRelativeIndex(1);this.processEnum(),this.tokens.appendCode(` exports.${t} = ${t};`)}else this.tokens.copyToken(),this.processEnum()}processDefaultExportEnum(){this.tokens.removeInitialToken(),this.tokens.removeToken();const t=this.tokens.identifierNameAtRelativeIndex(1);this.processEnum(),this.isImportsTransformEnabled?this.tokens.appendCode(` exports.default = ${t};`):this.tokens.appendCode(` export default ${t};`)}processEnum(){this.tokens.replaceToken("const"),this.tokens.copyExpectedToken(r.name);let t=false;this.tokens.matchesContextual(g._of)&&(this.tokens.removeToken(),t=this.tokens.matchesContextual(g._symbol),this.tokens.removeToken());const s=this.tokens.matches3(r.braceL,r.name,r.eq);this.tokens.appendCode(' = require("flow-enums-runtime")');const i=!t&&!s;for(this.tokens.replaceTokenTrimmingLeftWhitespace(i?".Mirrored([":"({");!this.tokens.matches1(r.braceR);){if(this.tokens.matches1(r.ellipsis)){this.tokens.removeToken();break}this.processEnumElement(t,s),this.tokens.matches1(r.comma)&&this.tokens.copyToken()}this.tokens.replaceToken(i?"]);":"});")}processEnumElement(t,s){if(t){const i=this.tokens.identifierName();this.tokens.copyToken(),this.tokens.appendCode(`: Symbol("${i}")`)}else s?(this.tokens.copyToken(),this.tokens.replaceTokenTrimmingLeftWhitespace(":"),this.tokens.copyToken()):this.tokens.replaceToken(`"${this.tokens.identifierName()}"`)}}function gg(e){let t,s=e[0],i=1;for(;i<e.length;){const n=e[i],a=e[i+1];if(i+=2,(n==="optionalAccess"||n==="optionalCall")&&s==null)return;n==="access"||n==="optionalAccess"?(t=s,s=a(s)):(n==="call"||n==="optionalCall")&&(s=a((...o)=>s.call(t,...o)),t=void 0)}return s}const pi="jest",bg=["mock","unmock","enableAutomock","disableAutomock"];class ja extends gt{__init(){this.hoistedFunctionNames=[]}constructor(t,s,i,n){super(),this.rootTransformer=t,this.tokens=s,this.nameManager=i,this.importProcessor=n,ja.prototype.__init.call(this)}process(){return this.tokens.currentToken().scopeDepth===0&&this.tokens.matches4(r.name,r.dot,r.name,r.parenL)&&this.tokens.identifierName()===pi?gg([this,"access",t=>t.importProcessor,"optionalAccess",t=>t.getGlobalNames,"call",t=>t(),"optionalAccess",t=>t.has,"call",t=>t(pi)])?false:this.extractHoistedCalls():false}getHoistedCode(){return this.hoistedFunctionNames.length>0?this.hoistedFunctionNames.map(t=>`${t}();`).join(""):""}extractHoistedCalls(){this.tokens.removeToken();let t=false;for(;this.tokens.matches3(r.dot,r.name,r.parenL);){const s=this.tokens.identifierNameAtIndex(this.tokens.currentIndex()+1);if(bg.includes(s)){const n=this.nameManager.claimFreeName("__jestHoist");this.hoistedFunctionNames.push(n),this.tokens.replaceToken(`function ${n}(){${pi}.`),this.tokens.copyToken(),this.tokens.copyToken(),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(r.parenR),this.tokens.appendCode(";}"),t=false}else t?this.tokens.copyToken():this.tokens.replaceToken(`${pi}.`),this.tokens.copyToken(),this.tokens.copyToken(),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(r.parenR),t=true}return true}}class yg extends gt{constructor(t){super(),this.tokens=t}process(){if(this.tokens.matches1(r.num)){const t=this.tokens.currentTokenCode();if(t.includes("_"))return this.tokens.replaceToken(t.replace(/_/g,"")),true}return false}}class _g extends gt{constructor(t,s){super(),this.tokens=t,this.nameManager=s}process(){return this.tokens.matches2(r._catch,r.braceL)?(this.tokens.copyToken(),this.tokens.appendCode(` (${this.nameManager.claimFreeName("e")})`),true):false}}class xg extends gt{constructor(t,s){super(),this.tokens=t,this.nameManager=s}process(){if(this.tokens.matches1(r.nullishCoalescing)){const i=this.tokens.currentToken();return this.tokens.tokens[i.nullishStartIndex].isAsyncOperation?this.tokens.replaceTokenTrimmingLeftWhitespace(", async () => ("):this.tokens.replaceTokenTrimmingLeftWhitespace(", () => ("),true}if(this.tokens.matches1(r._delete)&&this.tokens.tokenAtRelativeIndex(1).isOptionalChainStart)return this.tokens.removeInitialToken(),true;const s=this.tokens.currentToken().subscriptStartIndex;if(s!=null&&this.tokens.tokens[s].isOptionalChainStart&&this.tokens.tokenAtRelativeIndex(-1).type!==r._super){const i=this.nameManager.claimFreeName("_");let n;if(s>0&&this.tokens.matches1AtIndex(s-1,r._delete)&&this.isLastSubscriptInChain()?n=`${i} => delete ${i}`:n=`${i} => ${i}`,this.tokens.tokens[s].isAsyncOperation&&(n=`async ${n}`),this.tokens.matches2(r.questionDot,r.parenL)||this.tokens.matches2(r.questionDot,r.lessThan))this.justSkippedSuper()&&this.tokens.appendCode(".bind(this)"),this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'optionalCall', ${n}`);else if(this.tokens.matches2(r.questionDot,r.bracketL))this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'optionalAccess', ${n}`);else if(this.tokens.matches1(r.questionDot))this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'optionalAccess', ${n}.`);else if(this.tokens.matches1(r.dot))this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'access', ${n}.`);else if(this.tokens.matches1(r.bracketL))this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'access', ${n}[`);else if(this.tokens.matches1(r.parenL))this.justSkippedSuper()&&this.tokens.appendCode(".bind(this)"),this.tokens.replaceTokenTrimmingLeftWhitespace(`, 'call', ${n}(`);else throw new Error("Unexpected subscript operator in optional chain.");return true}return false}isLastSubscriptInChain(){let t=0;for(let s=this.tokens.currentIndex()+1;;s++){if(s>=this.tokens.tokens.length)throw new Error("Reached the end of the code while finding the end of the access chain.");if(this.tokens.tokens[s].isOptionalChainStart?t++:this.tokens.tokens[s].isOptionalChainEnd&&t--,t<0)return true;if(t===0&&this.tokens.tokens[s].subscriptStartIndex!=null)return false}}justSkippedSuper(){let t=0,s=this.tokens.currentIndex()-1;for(;;){if(s<0)throw new Error("Reached the start of the code while finding the start of the access chain.");if(this.tokens.tokens[s].isOptionalChainStart?t--:this.tokens.tokens[s].isOptionalChainEnd&&t++,t<0)return false;if(t===0&&this.tokens.tokens[s].subscriptStartIndex!=null)return this.tokens.tokens[s-1].type===r._super;s--}}}class vg extends gt{constructor(t,s,i,n){super(),this.rootTransformer=t,this.tokens=s,this.importProcessor=i,this.options=n}process(){const t=this.tokens.currentIndex();if(this.tokens.identifierName()==="createReactClass"){const s=this.importProcessor&&this.importProcessor.getIdentifierReplacement("createReactClass");return s?this.tokens.replaceToken(`(0, ${s})`):this.tokens.copyToken(),this.tryProcessCreateClassCall(t),true}if(this.tokens.matches3(r.name,r.dot,r.name)&&this.tokens.identifierName()==="React"&&this.tokens.identifierNameAtIndex(this.tokens.currentIndex()+2)==="createClass"){const s=this.importProcessor&&this.importProcessor.getIdentifierReplacement("React")||"React";return s?(this.tokens.replaceToken(s),this.tokens.copyToken(),this.tokens.copyToken()):(this.tokens.copyToken(),this.tokens.copyToken(),this.tokens.copyToken()),this.tryProcessCreateClassCall(t),true}return false}tryProcessCreateClassCall(t){const s=this.findDisplayName(t);s&&this.classNeedsDisplayName()&&(this.tokens.copyExpectedToken(r.parenL),this.tokens.copyExpectedToken(r.braceL),this.tokens.appendCode(`displayName: '${s}',`),this.rootTransformer.processBalancedCode(),this.tokens.copyExpectedToken(r.braceR),this.tokens.copyExpectedToken(r.parenR))}findDisplayName(t){return t<2?null:this.tokens.matches2AtIndex(t-2,r.name,r.eq)?this.tokens.identifierNameAtIndex(t-2):t>=2&&this.tokens.tokens[t-2].identifierRole===ie.ObjectKey?this.tokens.identifierNameAtIndex(t-2):this.tokens.matches2AtIndex(t-2,r._export,r._default)?this.getDisplayNameFromFilename():null}getDisplayNameFromFilename(){const s=(this.options.filePath||"unknown").split("/"),i=s[s.length-1],n=i.lastIndexOf("."),a=n===-1?i:i.slice(0,n);return a==="index"&&s[s.length-2]?s[s.length-2]:a}classNeedsDisplayName(){let t=this.tokens.currentIndex();if(!this.tokens.matches2(r.parenL,r.braceL))return false;const s=t+1,i=this.tokens.tokens[s].contextId;if(i==null)throw new Error("Expected non-null context ID on object open-brace.");for(;t<this.tokens.tokens.length;t++){const n=this.tokens.tokens[t];if(n.type===r.braceR&&n.contextId===i){t++;break}if(this.tokens.identifierNameAtIndex(t)==="displayName"&&this.tokens.tokens[t].identifierRole===ie.ObjectKey&&n.contextId===i)return false}if(t===this.tokens.tokens.length)throw new Error("Unexpected end of input when processing React class.");return this.tokens.matches1AtIndex(t,r.parenR)||this.tokens.matches2AtIndex(t,r.comma,r.parenR)}}class $a extends gt{__init(){this.extractedDefaultExportName=null}constructor(t,s){super(),this.tokens=t,this.filePath=s,$a.prototype.__init.call(this)}setExtractedDefaultExportName(t){this.extractedDefaultExportName=t}getPrefixCode(){return`
566
- (function () {
567
- var enterModule = require('react-hot-loader').enterModule;
568
- enterModule && enterModule(module);
569
- })();`.replace(/\s+/g," ").trim()}getSuffixCode(){const t=new Set;for(const i of this.tokens.tokens)!i.isType&&Su(i)&&i.identifierRole!==ie.ImportDeclaration&&t.add(this.tokens.identifierNameForToken(i));const s=Array.from(t).map(i=>({variableName:i,uniqueLocalName:i}));return this.extractedDefaultExportName&&s.push({variableName:this.extractedDefaultExportName,uniqueLocalName:"default"}),`
570
- ;(function () {
571
- var reactHotLoader = require('react-hot-loader').default;
572
- var leaveModule = require('react-hot-loader').leaveModule;
573
- if (!reactHotLoader) {
574
- return;
575
- }
576
- ${s.map(({variableName:i,uniqueLocalName:n})=>` reactHotLoader.register(${i}, "${n}", ${JSON.stringify(this.filePath||"")});`).join(`
577
- `)}
578
- leaveModule(module);
579
- })();`}process(){return false}}const kg=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","function","if","import","in","instanceof","new","return","super","switch","this","throw","try","typeof","var","void","while","with","yield","enum","implements","interface","let","package","private","protected","public","static","await","false","null","true"]);function Xo(e){if(e.length===0||!ii[e.charCodeAt(0)])return false;for(let t=1;t<e.length;t++)if(!mt[e.charCodeAt(t)])return false;return!kg.has(e)}class wg extends gt{constructor(t,s,i){super(),this.rootTransformer=t,this.tokens=s,this.isImportsTransformEnabled=i}process(){return this.rootTransformer.processPossibleArrowParamEnd()||this.rootTransformer.processPossibleAsyncArrowWithTypeParams()||this.rootTransformer.processPossibleTypeRange()?true:this.tokens.matches1(r._public)||this.tokens.matches1(r._protected)||this.tokens.matches1(r._private)||this.tokens.matches1(r._abstract)||this.tokens.matches1(r._readonly)||this.tokens.matches1(r._override)||this.tokens.matches1(r.nonNullAssertion)?(this.tokens.removeInitialToken(),true):this.tokens.matches1(r._enum)||this.tokens.matches2(r._const,r._enum)?(this.processEnum(),true):this.tokens.matches2(r._export,r._enum)||this.tokens.matches3(r._export,r._const,r._enum)?(this.processEnum(true),true):false}processEnum(t=false){for(this.tokens.removeInitialToken();this.tokens.matches1(r._const)||this.tokens.matches1(r._enum);)this.tokens.removeToken();const s=this.tokens.identifierName();this.tokens.removeToken(),t&&!this.isImportsTransformEnabled&&this.tokens.appendCode("export "),this.tokens.appendCode(`var ${s}; (function (${s})`),this.tokens.copyExpectedToken(r.braceL),this.processEnumBody(s),this.tokens.copyExpectedToken(r.braceR),t&&this.isImportsTransformEnabled?this.tokens.appendCode(`)(${s} || (exports.${s} = ${s} = {}));`):this.tokens.appendCode(`)(${s} || (${s} = {}));`)}processEnumBody(t){let s=null;for(;!this.tokens.matches1(r.braceR);){const{nameStringCode:i,variableName:n}=this.extractEnumKeyInfo(this.tokens.currentToken());this.tokens.removeInitialToken(),this.tokens.matches3(r.eq,r.string,r.comma)||this.tokens.matches3(r.eq,r.string,r.braceR)?this.processStringLiteralEnumMember(t,i,n):this.tokens.matches1(r.eq)?this.processExplicitValueEnumMember(t,i,n):this.processImplicitValueEnumMember(t,i,n,s),this.tokens.matches1(r.comma)&&this.tokens.removeToken(),n!=null?s=n:s=`${t}[${i}]`}}extractEnumKeyInfo(t){if(t.type===r.name){const s=this.tokens.identifierNameForToken(t);return{nameStringCode:`"${s}"`,variableName:Xo(s)?s:null}}else if(t.type===r.string){const s=this.tokens.stringValueForToken(t);return{nameStringCode:this.tokens.code.slice(t.start,t.end),variableName:Xo(s)?s:null}}else throw new Error("Expected name or string at beginning of enum element.")}processStringLiteralEnumMember(t,s,i){i!=null?(this.tokens.appendCode(`const ${i}`),this.tokens.copyToken(),this.tokens.copyToken(),this.tokens.appendCode(`; ${t}[${s}] = ${i};`)):(this.tokens.appendCode(`${t}[${s}]`),this.tokens.copyToken(),this.tokens.copyToken(),this.tokens.appendCode(";"))}processExplicitValueEnumMember(t,s,i){const n=this.tokens.currentToken().rhsEndIndex;if(n==null)throw new Error("Expected rhsEndIndex on enum assign.");if(i!=null){for(this.tokens.appendCode(`const ${i}`),this.tokens.copyToken();this.tokens.currentIndex()<n;)this.rootTransformer.processToken();this.tokens.appendCode(`; ${t}[${t}[${s}] = ${i}] = ${s};`)}else{for(this.tokens.appendCode(`${t}[${t}[${s}]`),this.tokens.copyToken();this.tokens.currentIndex()<n;)this.rootTransformer.processToken();this.tokens.appendCode(`] = ${s};`)}}processImplicitValueEnumMember(t,s,i,n){let a=n!=null?`${n} + 1`:"0";i!=null&&(this.tokens.appendCode(`const ${i} = ${a}; `),a=i),this.tokens.appendCode(`${t}[${t}[${s}] = ${a}] = ${s};`)}}class Oi{__init(){this.transformers=[]}__init2(){this.generatedVariables=[]}constructor(t,s,i,n){Oi.prototype.__init.call(this),Oi.prototype.__init2.call(this),this.nameManager=t.nameManager,this.helperManager=t.helperManager;const{tokenProcessor:a,importProcessor:o}=t;this.tokens=a,this.isImportsTransformEnabled=s.includes("imports"),this.isReactHotLoaderTransformEnabled=s.includes("react-hot-loader"),this.disableESTransforms=!!n.disableESTransforms,n.disableESTransforms||(this.transformers.push(new xg(a,this.nameManager)),this.transformers.push(new yg(a)),this.transformers.push(new _g(a,this.nameManager))),s.includes("jsx")&&(n.jsxRuntime!=="preserve"&&this.transformers.push(new ss(this,a,o,this.nameManager,n)),this.transformers.push(new vg(this,a,o,n)));let u=null;if(s.includes("react-hot-loader")){if(!n.filePath)throw new Error("filePath is required when using the react-hot-loader transform.");u=new $a(a,n.filePath),this.transformers.push(u)}if(s.includes("imports")){if(o===null)throw new Error("Expected non-null importProcessor with imports transform enabled.");this.transformers.push(new $s(this,a,o,this.nameManager,this.helperManager,u,i,!!n.enableLegacyTypeScriptModuleInterop,s.includes("typescript"),s.includes("flow"),!!n.preserveDynamicImport,!!n.keepUnusedImports))}else this.transformers.push(new dg(a,this.nameManager,this.helperManager,u,s.includes("typescript"),s.includes("flow"),!!n.keepUnusedImports,n));s.includes("flow")&&this.transformers.push(new mg(this,a,s.includes("imports"))),s.includes("typescript")&&this.transformers.push(new wg(this,a,s.includes("imports"))),s.includes("jest")&&this.transformers.push(new ja(this,a,this.nameManager,o))}transform(){this.tokens.reset(),this.processBalancedCode();let s=this.isImportsTransformEnabled?'"use strict";':"";for(const o of this.transformers)s+=o.getPrefixCode();s+=this.helperManager.emitHelpers(),s+=this.generatedVariables.map(o=>` var ${o};`).join("");for(const o of this.transformers)s+=o.getHoistedCode();let i="";for(const o of this.transformers)i+=o.getSuffixCode();const n=this.tokens.finish();let{code:a}=n;if(a.startsWith("#!")){let o=a.indexOf(`
580
- `);return o===-1&&(o=a.length,a+=`
581
- `),{code:a.slice(0,o+1)+s+a.slice(o+1)+i,mappings:this.shiftMappings(n.mappings,s.length)}}else return{code:s+a+i,mappings:this.shiftMappings(n.mappings,s.length)}}processBalancedCode(){let t=0,s=0;for(;!this.tokens.isAtEnd();){if(this.tokens.matches1(r.braceL)||this.tokens.matches1(r.dollarBraceL))t++;else if(this.tokens.matches1(r.braceR)){if(t===0)return;t--}if(this.tokens.matches1(r.parenL))s++;else if(this.tokens.matches1(r.parenR)){if(s===0)return;s--}this.processToken()}}processToken(){if(this.tokens.matches1(r._class)){this.processClass();return}for(const t of this.transformers)if(t.process())return;this.tokens.copyToken()}processNamedClass(){if(!this.tokens.matches2(r._class,r.name))throw new Error("Expected identifier for exported class name.");const t=this.tokens.identifierNameAtIndex(this.tokens.currentIndex()+1);return this.processClass(),t}processClass(){const t=hg(this,this.tokens,this.nameManager,this.disableESTransforms),s=(t.headerInfo.isExpression||!t.headerInfo.className)&&t.staticInitializerNames.length+t.instanceInitializerNames.length>0;let i=t.headerInfo.className;s&&(i=this.nameManager.claimFreeName("_class"),this.generatedVariables.push(i),this.tokens.appendCode(` (${i} =`));const a=this.tokens.currentToken().contextId;if(a==null)throw new Error("Expected class to have a context ID.");for(this.tokens.copyExpectedToken(r._class);!this.tokens.matchesContextIdAndLabel(r.braceL,a);)this.processToken();this.processClassBody(t,i);const o=t.staticInitializerNames.map(u=>`${i}.${u}()`);s?this.tokens.appendCode(`, ${o.map(u=>`${u}, `).join("")}${i})`):t.staticInitializerNames.length>0&&this.tokens.appendCode(` ${o.map(u=>`${u};`).join(" ")}`)}processClassBody(t,s){const{headerInfo:i,constructorInsertPos:n,constructorInitializerStatements:a,fields:o,instanceInitializerNames:u,rangesToRemove:l}=t;let h=0,d=0;const m=this.tokens.currentToken().contextId;if(m==null)throw new Error("Expected non-null context ID on class.");this.tokens.copyExpectedToken(r.braceL),this.isReactHotLoaderTransformEnabled&&this.tokens.appendCode("__reactstandin__regenerateByEval(key, code) {this[key] = eval(code);}");const _=a.length+u.length>0;if(n===null&&_){const k=this.makeConstructorInitCode(a,u,s);if(i.hasSuperclass){const T=this.nameManager.claimFreeName("args");this.tokens.appendCode(`constructor(...${T}) { super(...${T}); ${k}; }`)}else this.tokens.appendCode(`constructor() { ${k}; }`)}for(;!this.tokens.matchesContextIdAndLabel(r.braceR,m);)if(h<o.length&&this.tokens.currentIndex()===o[h].start){let k=false;for(this.tokens.matches1(r.bracketL)?this.tokens.copyTokenWithPrefix(`${o[h].initializerName}() {this`):this.tokens.matches1(r.string)||this.tokens.matches1(r.num)?(this.tokens.copyTokenWithPrefix(`${o[h].initializerName}() {this[`),k=true):this.tokens.copyTokenWithPrefix(`${o[h].initializerName}() {this.`);this.tokens.currentIndex()<o[h].end;)k&&this.tokens.currentIndex()===o[h].equalsIndex&&this.tokens.appendCode("]"),this.processToken();this.tokens.appendCode("}"),h++}else if(d<l.length&&this.tokens.currentIndex()>=l[d].start){for(this.tokens.currentIndex()<l[d].end&&this.tokens.removeInitialToken();this.tokens.currentIndex()<l[d].end;)this.tokens.removeToken();d++}else this.tokens.currentIndex()===n?(this.tokens.copyToken(),_&&this.tokens.appendCode(`;${this.makeConstructorInitCode(a,u,s)};`),this.processToken()):this.processToken();this.tokens.copyExpectedToken(r.braceR)}makeConstructorInitCode(t,s,i){return[...t,...s.map(n=>`${i}.prototype.${n}.call(this)`)].join(";")}processPossibleArrowParamEnd(){if(this.tokens.matches2(r.parenR,r.colon)&&this.tokens.tokenAtRelativeIndex(1).isType){let t=this.tokens.currentIndex()+1;for(;this.tokens.tokens[t].isType;)t++;if(this.tokens.matches1AtIndex(t,r.arrow)){for(this.tokens.removeInitialToken();this.tokens.currentIndex()<t;)this.tokens.removeToken();return this.tokens.replaceTokenTrimmingLeftWhitespace(") =>"),true}}return false}processPossibleAsyncArrowWithTypeParams(){if(!this.tokens.matchesContextual(g._async)&&!this.tokens.matches1(r._async))return false;const t=this.tokens.tokenAtRelativeIndex(1);if(t.type!==r.lessThan||!t.isType)return false;let s=this.tokens.currentIndex()+1;for(;this.tokens.tokens[s].isType;)s++;if(this.tokens.matches1AtIndex(s,r.parenL)){for(this.tokens.replaceToken("async ("),this.tokens.removeInitialToken();this.tokens.currentIndex()<s;)this.tokens.removeToken();return this.tokens.removeToken(),this.processBalancedCode(),this.processToken(),true}return false}processPossibleTypeRange(){if(this.tokens.currentToken().isType){for(this.tokens.removeInitialToken();this.tokens.currentToken().isType;)this.tokens.removeToken();return true}return false}shiftMappings(t,s){for(let i=0;i<t.length;i++){const n=t[i];n!==void 0&&(t[i]=n+s)}return t}}var Sg={};(function(e){e.__esModule=true,e.LinesAndColumns=void 0;var t=`
582
- `,s="\r",i=function(){function n(a){this.string=a;for(var o=[0],u=0;u<a.length;)switch(a[u]){case t:u+=t.length,o.push(u);break;case s:u+=s.length,a[u]===t&&(u+=t.length),o.push(u);break;default:u++;break}this.offsets=o}return n.prototype.locationForIndex=function(a){if(a<0||a>this.string.length)return null;for(var o=0,u=this.offsets;u[o+1]<=a;)o++;var l=a-u[o];return{line:o,column:l}},n.prototype.indexForLocation=function(a){var o=a.line,u=a.column;return o<0||o>=this.offsets.length||u<0||u>this.lengthOfLine(o)?null:this.offsets[o]+u},n.prototype.lengthOfLine=function(a){var o=this.offsets[a],u=a===this.offsets.length-1?this.string.length:this.offsets[a+1];return u-o},n}();e.LinesAndColumns=i,e.default=i})(Sg);function Eg(e){const t=new Set;for(let s=0;s<e.tokens.length;s++)e.matches1AtIndex(s,r._import)&&!e.matches3AtIndex(s,r._import,r.name,r.eq)&&Tg(e,s,t);return t}function Tg(e,t,s){t++,!e.matches1AtIndex(t,r.parenL)&&(e.matches1AtIndex(t,r.name)&&(s.add(e.identifierNameAtIndex(t)),t++,e.matches1AtIndex(t,r.comma)&&t++),e.matches1AtIndex(t,r.star)&&(t+=2,s.add(e.identifierNameAtIndex(t)),t++),e.matches1AtIndex(t,r.braceL)&&(t++,Ag(e,t,s)))}function Ag(e,t,s){for(;;){if(e.matches1AtIndex(t,r.braceR))return;const i=Ys(e,t);if(t=i.endIndex,i.isType||s.add(i.rightName),e.matches2AtIndex(t,r.comma,r.braceR))return;if(e.matches1AtIndex(t,r.braceR))return;if(e.matches1AtIndex(t,r.comma))t++;else throw new Error(`Unexpected token: ${JSON.stringify(e.tokens[t])}`)}}function Ig(e,t){Hp(t);try{const s=Cg(e,t),n=new Oi(s,t.transforms,!!t.enableLegacyBabel5ModuleInterop,t).transform();let a={code:n.code};if(t.sourceMapOptions){if(!t.filePath)throw new Error("filePath must be specified when generating a source map.");a={...a,sourceMap:Rp(n,t.filePath,t.sourceMapOptions,e,s.tokenProcessor.tokens)}}return a}catch(s){throw t.filePath&&(s.message=`Error transforming ${t.filePath}: ${s.message}`),s}}function Cg(e,t){const s=t.transforms.includes("jsx"),i=t.transforms.includes("typescript"),n=t.transforms.includes("flow"),a=t.disableESTransforms===true,o=ug(e,s,i,n),u=o.tokens,l=o.scopes,h=new ba(e,u),d=new Ri(h),m=new js(e,u,n,a,d),_=!!t.enableLegacyTypeScriptModuleInterop;let k=null;return t.transforms.includes("imports")?(k=new is(h,m,_,t,t.transforms.includes("typescript"),!!t.keepUnusedImports,d),k.preprocessTokens(),Do(m,l,k.getGlobalNames()),t.transforms.includes("typescript")&&!t.keepUnusedImports&&k.pruneTypeOnlyImports()):t.transforms.includes("typescript")&&!t.keepUnusedImports&&Do(m,l,Eg(m)),{tokenProcessor:m,scopes:l,nameManager:h,importProcessor:k,helperManager:d}}function Hn(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}const Bi=e=>e?`"${e}" `:"";function Wn(e,t=""){if(typeof e!="boolean")throw new TypeError(Bi(t)+"expected boolean, got type="+typeof e);return e}function xs(e,t=""){if(typeof e!="number")throw new TypeError(Bi(t)+"expected number, got "+typeof e);if(!Number.isSafeInteger(e)||e<0)throw new RangeError(Bi(t)+"expected integer >= 0, got "+e);return e}function Ue(e,t,s=""){if(Hn(e)&&(t===void 0||e.length===t))return e;t!==void 0&&xs(t,"length");const i=Hn(e),n=t!==void 0?` of length ${t}`:"",a=i?`length=${e.length}`:`type=${typeof e}`,o=Bi(s)+"expected Uint8Array"+n+", got "+a;throw i?new RangeError(o):new TypeError(o)}const Yo=(e,t)=>{if(e===null||typeof e!="object"||Array.isArray(e))throw new TypeError(t==="object"?"expected valid options object":`"${t}" expected object, got type=${typeof e}`)};function zo(e,t=true){if(e.destroyed)throw new Error("hash was destroyed");if(t&&e.finished)throw new Error("digest() was already called")}function Rg(e,t){Ue(e,void 0,"output");const s=t.outputLen;if(!(e.length>=s))throw new RangeError('"output" expected length >= '+s)}function Ft(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function Et(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Pg(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}const kt=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Lg(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function Dg(e){for(let t=0;t<e.length;t++)e[t]=Lg(e[t]);return e}const pt=kt?e=>e:Dg;function Ng(e,t){return Yo(e,"defaults"),Yo(t,"opts"),Object.assign(e,t)}function Fg(e,t){if(e=Ue(e),t=Ue(t),e.length!==t.length)return false;let s=0;for(let i=0;i<e.length;i++)s|=e[i]^t[i];return s===0}function Ug(e,t,s){const i=t,n=()=>[],a=(u,l)=>i(l,...n(u)).update(u).digest(),o=i(new Uint8Array(e),...n(new Uint8Array(0)));return a.outputLen=o.outputLen,a.blockLen=o.blockLen,a.create=(u,...l)=>i(u,...l),a}const Mg=(e,t)=>{function s(i,...n){if(Ue(i,void 0,"key"),e.nonceLength!==void 0){const m=n[0];Ue(m,e.varSizeNonce?void 0:e.nonceLength,"nonce")}const a=e.tagLength,o=e.nonceLength!==void 0?1:0;if(!e.withAAD){for(let m=o;m<n.length;m++)if(Hn(n[m]))throw new Error("AAD not supported")}e.withAAD&&n[o]!==void 0&&Ue(n[o],void 0,"AAD");const u=t(i,...n),l=(m,_)=>{if(_!==void 0){if(m!==2)throw new Error("cipher output not supported");Ue(_,void 0,"output")}};let h=false;return{encrypt(m,_){if(h)throw new Error("cannot encrypt() twice with same key + nonce");return h=true,Ue(m,void 0,"data"),l(u.encrypt.length,_),u.encrypt(m,_)},decrypt(m,_){if(Ue(m,void 0,"data"),a&&m.length<a)throw new Error('"ciphertext" expected length >= tagLength='+a);return l(u.decrypt.length,_),u.decrypt(m,_)}}}return Object.assign(s,e),s};function Gn(e,t,s=true){if(t===void 0)return new Uint8Array(e);if(Ue(t,e,"output"),s&&!Vi(t))throw new Error("invalid output, must be aligned");return t}function Og(e,t,s){xs(e),xs(t),Wn(s);const i=new Uint8Array(16),n=Pg(i);return n.setBigUint64(0,BigInt(t),s),n.setBigUint64(8,BigInt(e),s),i}function Vi(e){return e.byteOffset%4===0}function ji(e){return Uint8Array.from(Ue(e))}const Ll=e=>Uint8Array.from(e.split(""),t=>t.charCodeAt(0)),Bg=pt(Ft(Ll("expand 16-byte k"))),Vg=pt(Ft(Ll("expand 32-byte k")));function xe(e,t){return e<<t|e>>>32-t}const Fs=64,jg=16,Xn=2**32-1,Ko=Uint32Array.of();function $g(e,t,s,i,n,a,o,u){const l=n.length,h=new Uint8Array(Fs),d=Ft(h),m=kt&&Vi(n)&&Vi(a),_=m?Ft(n):Ko,k=m?Ft(a):Ko;if(!kt){for(let T=0;T<l;o++){if(e(t,s,i,d,o,u),pt(d),o>=Xn)throw new Error("arx: counter overflow");const P=Math.min(Fs,l-T);for(let F=0,B;F<P;F++)B=T+F,a[B]=n[B]^h[F];T+=P}return}for(let T=0;T<l;o++){if(e(t,s,i,d,o,u),o>=Xn)throw new Error("arx: counter overflow");const P=Math.min(Fs,l-T);if(m&&P===Fs){const F=T/4;if(T%4!==0)throw new Error("arx: invalid block position");for(let B=0,N;B<jg;B++)N=F+B,k[N]=_[N]^d[B];T+=Fs;continue}for(let F=0,B;F<P;F++)B=T+F,a[B]=n[B]^h[F];T+=P}}function qg(e,t){const{allowShortKeys:s,extendNonceFn:i,counterLength:n,counterRight:a,rounds:o}=Ng({allowShortKeys:false,counterLength:8,counterRight:false,rounds:20},t);if(typeof e!="function")throw new Error("core must be a function");return xs(n),xs(o),Wn(a),Wn(s),(u,l,h,d,m=0)=>{Ue(u,void 0,"key"),Ue(l,void 0,"nonce"),Ue(h,void 0,"data");const _=h.length;if(d=Gn(_,d,false),xs(m),m<0||m>=Xn)throw new Error("arx: counter overflow");const k=[];let T=u.length,P,F;if(T===32)k.push(P=ji(u)),F=Vg;else if(T===16&&s)P=new Uint8Array(32),P.set(u),P.set(u,16),F=Bg,k.push(P);else throw Ue(u,32,"arx key"),new Error("invalid key size");(!kt||!Vi(l))&&k.push(l=ji(l));let B=Ft(P);if(i){if(l.length!==24)throw new Error("arx: extended nonce must be 24 bytes");const q=l.subarray(0,16);if(kt)i(F,B,Ft(q),B);else{const z=pt(Uint32Array.from(F));i(z,B,Ft(q),B),Et(z),pt(B)}l=l.subarray(16)}else kt||pt(B);const N=16-n;if(N!==l.length)throw new Error(`arx: nonce must be ${N} or 16 bytes`);if(N!==12){const q=new Uint8Array(12);q.set(l,a?0:12-l.length),l=q,k.push(l)}const Y=pt(Ft(l));try{return $g(e,F,B,Y,h,d,m,o),d}finally{Et(...k)}}}function Be(e,t){return e[t++]&255|(e[t++]&255)<<8}class Hg{blockLen=16;outputLen=16;buffer=new Uint8Array(16);r=new Uint16Array(10);h=new Uint16Array(10);pad=new Uint16Array(8);pos=0;finished=false;destroyed=false;constructor(t){t=ji(Ue(t,32,"key"));const s=Be(t,0),i=Be(t,2),n=Be(t,4),a=Be(t,6),o=Be(t,8),u=Be(t,10),l=Be(t,12),h=Be(t,14);this.r[0]=s&8191,this.r[1]=(s>>>13|i<<3)&8191,this.r[2]=(i>>>10|n<<6)&7939,this.r[3]=(n>>>7|a<<9)&8191,this.r[4]=(a>>>4|o<<12)&255,this.r[5]=o>>>1&8190,this.r[6]=(o>>>14|u<<2)&8191,this.r[7]=(u>>>11|l<<5)&8065,this.r[8]=(l>>>8|h<<8)&8191,this.r[9]=h>>>5&127;for(let d=0;d<8;d++)this.pad[d]=Be(t,16+2*d)}process(t,s,i=false){const n=i?0:2048,{h:a,r:o}=this,u=o[0],l=o[1],h=o[2],d=o[3],m=o[4],_=o[5],k=o[6],T=o[7],P=o[8],F=o[9],B=Be(t,s+0),N=Be(t,s+2),Y=Be(t,s+4),q=Be(t,s+6),z=Be(t,s+8),J=Be(t,s+10),K=Be(t,s+12),X=Be(t,s+14);let re=a[0]+(B&8191),x=a[1]+((B>>>13|N<<3)&8191),b=a[2]+((N>>>10|Y<<6)&8191),v=a[3]+((Y>>>7|q<<9)&8191),V=a[4]+((q>>>4|z<<12)&8191),W=a[5]+(z>>>1&8191),M=a[6]+((z>>>14|J<<2)&8191),R=a[7]+((J>>>11|K<<5)&8191),O=a[8]+((K>>>8|X<<8)&8191),U=a[9]+(X>>>5|n),I=0,H=I+re*u+x*(5*F)+b*(5*P)+v*(5*T)+V*(5*k);I=H>>>13,H&=8191,H+=W*(5*_)+M*(5*m)+R*(5*d)+O*(5*h)+U*(5*l),I+=H>>>13,H&=8191;let G=I+re*l+x*u+b*(5*F)+v*(5*P)+V*(5*T);I=G>>>13,G&=8191,G+=W*(5*k)+M*(5*_)+R*(5*m)+O*(5*d)+U*(5*h),I+=G>>>13,G&=8191;let te=I+re*h+x*l+b*u+v*(5*F)+V*(5*P);I=te>>>13,te&=8191,te+=W*(5*T)+M*(5*k)+R*(5*_)+O*(5*m)+U*(5*d),I+=te>>>13,te&=8191;let ce=I+re*d+x*h+b*l+v*u+V*(5*F);I=ce>>>13,ce&=8191,ce+=W*(5*P)+M*(5*T)+R*(5*k)+O*(5*_)+U*(5*m),I+=ce>>>13,ce&=8191;let oe=I+re*m+x*d+b*h+v*l+V*u;I=oe>>>13,oe&=8191,oe+=W*(5*F)+M*(5*P)+R*(5*T)+O*(5*k)+U*(5*_),I+=oe>>>13,oe&=8191;let w=I+re*_+x*m+b*d+v*h+V*l;I=w>>>13,w&=8191,w+=W*u+M*(5*F)+R*(5*P)+O*(5*T)+U*(5*k),I+=w>>>13,w&=8191;let E=I+re*k+x*_+b*m+v*d+V*h;I=E>>>13,E&=8191,E+=W*l+M*u+R*(5*F)+O*(5*P)+U*(5*T),I+=E>>>13,E&=8191;let D=I+re*T+x*k+b*_+v*m+V*d;I=D>>>13,D&=8191,D+=W*h+M*l+R*u+O*(5*F)+U*(5*P),I+=D>>>13,D&=8191;let L=I+re*P+x*T+b*k+v*_+V*m;I=L>>>13,L&=8191,L+=W*d+M*h+R*l+O*u+U*(5*F),I+=L>>>13,L&=8191;let j=I+re*F+x*P+b*T+v*k+V*_;I=j>>>13,j&=8191,j+=W*m+M*d+R*h+O*l+U*u,I+=j>>>13,j&=8191,I=(I<<2)+I|0,I=I+H|0,H=I&8191,I=I>>>13,G+=I,a[0]=H,a[1]=G,a[2]=te,a[3]=ce,a[4]=oe,a[5]=w,a[6]=E,a[7]=D,a[8]=L,a[9]=j}finalize(){const{h:t,pad:s}=this,i=new Uint16Array(10);let n=t[1]>>>13;t[1]&=8191;for(let u=2;u<10;u++)t[u]+=n,n=t[u]>>>13,t[u]&=8191;t[0]+=n*5,n=t[0]>>>13,t[0]&=8191,t[1]+=n,n=t[1]>>>13,t[1]&=8191,t[2]+=n,i[0]=t[0]+5,n=i[0]>>>13,i[0]&=8191;for(let u=1;u<10;u++)i[u]=t[u]+n,n=i[u]>>>13,i[u]&=8191;i[9]-=8192;let a=(n^1)-1;for(let u=0;u<10;u++)i[u]&=a;a=~a;for(let u=0;u<10;u++)t[u]=t[u]&a|i[u];t[0]=(t[0]|t[1]<<13)&65535,t[1]=(t[1]>>>3|t[2]<<10)&65535,t[2]=(t[2]>>>6|t[3]<<7)&65535,t[3]=(t[3]>>>9|t[4]<<4)&65535,t[4]=(t[4]>>>12|t[5]<<1|t[6]<<14)&65535,t[5]=(t[6]>>>2|t[7]<<11)&65535,t[6]=(t[7]>>>5|t[8]<<8)&65535,t[7]=(t[8]>>>8|t[9]<<5)&65535;let o=t[0]+s[0];t[0]=o&65535;for(let u=1;u<8;u++)o=(t[u]+s[u]|0)+(o>>>16)|0,t[u]=o&65535;Et(i)}update(t){zo(this),Ue(t),t=ji(t);const{buffer:s,blockLen:i}=this,n=t.length;for(let a=0;a<n;){const o=Math.min(i-this.pos,n-a);if(o===i){for(;i<=n-a;a+=i)this.process(t,a);continue}s.set(t.subarray(a,a+o),this.pos),this.pos+=o,a+=o,this.pos===i&&(this.process(s,0,false),this.pos=0)}return this}destroy(){this.destroyed=true,Et(this.h,this.r,this.buffer,this.pad)}digestInto(t){zo(this),Rg(t,this),this.finished=true;const{buffer:s,h:i}=this;let{pos:n}=this;if(n){for(s[n++]=1;n<16;n++)s[n]=0;this.process(s,0,true)}this.finalize();let a=0;for(let o=0;o<8;o++)t[a++]=i[o]>>>0,t[a++]=i[o]>>>8}digest(){const{buffer:t,outputLen:s}=this;this.digestInto(t);const i=t.slice(0,s);return this.destroy(),i}}const Wg=Ug(32,e=>new Hg(e));function Dl(e,t,s,i,n,a=20){let o=e[0],u=e[1],l=e[2],h=e[3],d=t[0],m=t[1],_=t[2],k=t[3],T=t[4],P=t[5],F=t[6],B=t[7],N=n,Y=s[0],q=s[1],z=s[2],J=o,K=u,X=l,re=h,x=d,b=m,v=_,V=k,W=T,M=P,R=F,O=B,U=N,I=Y,H=q,G=z;for(let ce=0;ce<a;ce+=2)J=J+x|0,U=xe(U^J,16),W=W+U|0,x=xe(x^W,12),J=J+x|0,U=xe(U^J,8),W=W+U|0,x=xe(x^W,7),K=K+b|0,I=xe(I^K,16),M=M+I|0,b=xe(b^M,12),K=K+b|0,I=xe(I^K,8),M=M+I|0,b=xe(b^M,7),X=X+v|0,H=xe(H^X,16),R=R+H|0,v=xe(v^R,12),X=X+v|0,H=xe(H^X,8),R=R+H|0,v=xe(v^R,7),re=re+V|0,G=xe(G^re,16),O=O+G|0,V=xe(V^O,12),re=re+V|0,G=xe(G^re,8),O=O+G|0,V=xe(V^O,7),J=J+b|0,G=xe(G^J,16),R=R+G|0,b=xe(b^R,12),J=J+b|0,G=xe(G^J,8),R=R+G|0,b=xe(b^R,7),K=K+v|0,U=xe(U^K,16),O=O+U|0,v=xe(v^O,12),K=K+v|0,U=xe(U^K,8),O=O+U|0,v=xe(v^O,7),X=X+V|0,I=xe(I^X,16),W=W+I|0,V=xe(V^W,12),X=X+V|0,I=xe(I^X,8),W=W+I|0,V=xe(V^W,7),re=re+x|0,H=xe(H^re,16),M=M+H|0,x=xe(x^M,12),re=re+x|0,H=xe(H^re,8),M=M+H|0,x=xe(x^M,7);let te=0;i[te++]=o+J|0,i[te++]=u+K|0,i[te++]=l+X|0,i[te++]=h+re|0,i[te++]=d+x|0,i[te++]=m+b|0,i[te++]=_+v|0,i[te++]=k+V|0,i[te++]=T+W|0,i[te++]=P+M|0,i[te++]=F+R|0,i[te++]=B+O|0,i[te++]=N+U|0,i[te++]=Y+I|0,i[te++]=q+H|0,i[te++]=z+G|0}function Gg(e,t,s,i){const n=kt?e:pt(e.slice(0,4)),a=kt?t:pt(t.slice(0,8)),o=kt?s:pt(s.slice(0,4)),u=new Uint32Array(16);Dl(n,a,o.subarray(1),u,o[0]);let l=0;i[l++]=u[0]-n[0]|0,i[l++]=u[1]-n[1]|0,i[l++]=u[2]-n[2]|0,i[l++]=u[3]-n[3]|0,i[l++]=u[12]-o[0]|0,i[l++]=u[13]-o[1]|0,i[l++]=u[14]-o[2]|0,i[l++]=u[15]-o[3]|0,pt(i),kt||Et(n,a,o),Et(u)}const Xg=qg(Dl,{counterRight:false,counterLength:8,extendNonceFn:Gg,allowShortKeys:false}),Yg=new Uint8Array(16),Zo=(e,t)=>{e.update(t);const s=t.length%16;s&&e.update(Yg.subarray(s))},zg=new Uint8Array(32);function Qo(e,t,s,i,n){n!==void 0&&Ue(n,void 0,"AAD");const a=e(t,s,zg),o=Og(i.length,n?n.length:0,true),u=Wg.create(a);n&&Zo(u,n),Zo(u,i),u.update(o);const l=u.digest();return Et(a,o),l}const Kg=e=>(t,s,i)=>({encrypt(a,o){const u=a.length;o=Gn(u+16,o,false),o.set(a);const l=o.subarray(0,-16);e(t,s,l,l,1);const h=Qo(e,t,s,l,i);return o.set(h,u),Et(h),o},decrypt(a,o){o=Gn(a.length-16,o,false);const u=a.subarray(0,-16),l=a.subarray(-16),h=Qo(e,t,s,u,i);if(!Fg(l,h))throw Et(h),new Error("invalid tag");return o.set(a.subarray(0,-16)),e(t,s,o,o,1),Et(h),o}}),Zg=Mg({blockSize:64,nonceLength:24,tagLength:16,withAAD:true},Kg(Xg));function Qg(e,t,s){return zi(e),s===void 0&&(s=new Uint8Array(e.outputLen)),ua(e,s,t)}const yn=Uint8Array.of(0),Jo=Uint8Array.of();function Jg(e,t,s,i=32){zi(e),Qt(i,"length"),Ot(t,void 0,"prk");const n=e.outputLen;if(t.length<n)throw new Error('"prk" must be at least HashLen octets');if(i>255*n)throw new Error("Length must be <= 255*HashLen");const a=Math.ceil(i/n);s===void 0?s=Jo:Ot(s,void 0,"info");const o=new Uint8Array(a*n),u=ua.create(e,t),l=u._cloneInto(),h=new Uint8Array(u.outputLen);for(let d=0;d<a;d++)yn[0]=d+1,l.update(d===0?Jo:h).update(s).update(yn).digestInto(h),o.set(h,n*d),u._cloneInto(l);return u.destroy(),l.destroy(),Ws(h,yn),o.slice(0,i)}const eb=(e,t,s,i,n)=>Jg(e,Qg(e,t,s),i,n),tb="viji-enc:",ec="viji-enc:v1:",sb="viji-enc:v1",_n=24,ib=16,tc=new Uint8Array([224,50,225,138,167,25,229,194,14,250,248,86,248,204,11,44,195,247,74,184,14,218,196,108,241,52,118,61,221,57,106,31]),rb=new Uint8Array([82,90,117,206,53,86,209,181,176,177,126,23,140,253,33,242,212,132,84,23,243,195,189,90,217,131,25,10,37,241,167,245]);function nb(){const e=new Uint8Array(tc.length);for(let t=0;t<e.length;t++)e[t]=tc[t]^rb[t];return e}class bs extends Error{constructor(t,s){super(t),this.reason=s,this.name="SceneEnvelopeError"}}function ab(e){return e.startsWith(tb)}function Nl(e){const t=atob(e),s=new Uint8Array(t.length);for(let i=0;i<t.length;i++)s[i]=t.charCodeAt(i);return s}function ob(e){return Nl(e.replace(/-/g,"+").replace(/_/g,"/"))}function cb(e){return eb(Hc,nb(),new TextEncoder().encode(sb),ob(e),32)}function ub(e,t){if(!e.startsWith(ec))throw new bs("Unsupported scene envelope version (this core supports viji-enc:v1)","UNSUPPORTED_VERSION");if(!t)throw new bs("Encrypted scene received without a key component","MISSING_KEY_COMPONENT");let s,i;try{s=Nl(e.slice(ec.length)),i=cb(t)}catch{throw new bs("Malformed scene envelope","MALFORMED_ENVELOPE")}if(s.length<_n+ib)throw new bs("Truncated scene envelope","MALFORMED_ENVELOPE");const n=s.subarray(0,_n),a=s.subarray(_n);try{const o=Zg(i,n).decrypt(a);return new TextDecoder().decode(o)}catch{throw new bs("Scene envelope authentication failed","DECRYPT_FAILED")}}function Fl(e){self.postMessage({type:"error",id:`${e.code.toLowerCase()}_${Date.now()}`,timestamp:Date.now(),data:e})}const Js={current:null};self.addEventListener("error",e=>{const t=e.error,s=t?.stack,i=t?.message??e.message??String(e);Js.current?Js.current.reportSceneError({message:i,...s!==void 0&&{stack:s},code:"UNCAUGHT_ERROR"}):Fl({message:i,code:"UNCAUGHT_ERROR",...s!==void 0&&{stack:s}}),e.preventDefault()});self.addEventListener("unhandledrejection",e=>{const t=e.reason,s=t?.stack,i=t?.message??String(e.reason);Js.current?Js.current.reportSceneError({message:i,...s!==void 0&&{stack:s},code:"UNHANDLED_REJECTION"}):Fl({message:i,code:"UNHANDLED_REJECTION",...s!==void 0&&{stack:s}}),e.preventDefault()});const ut=new pa,et=new Sf(e=>self.postMessage(e));Js.current=et;ut.setSceneErrorReporter(et);let xn=null;function sc(e){const t=Ig(e,{transforms:["typescript"],disableESTransforms:true,sourceMapOptions:{compiledFilename:"scene.js"},filePath:"scene.ts"});return{code:t.code,mappings:t.sourceMap?.mappings??null}}function ic(e){const{code:t,error:s}=J1(e);return s?(et.reportSceneError({message:s.message,code:s.code,sourceOverride:"scene"}),null):t}async function lb(e,t,s){const i=t.initialParameters;let n,a,o=false;try{ab(e)&&(o=true,e=ub(e,t.keyComponent)),et.resetForSceneReload(),xn=null,self.renderFunction=null,ut.resetParameterState();const u=gf(e);n=u.renderer,a=u.p5CanvasMode,ut.setCapabilityUsageMask(Ms.detectUsage(e,n)),s.resolve(u)}catch(u){if(u instanceof bs){s.reject({message:`Scene decrypt failed: ${u.message}`,code:"SCENE_DECRYPT_ERROR"});return}const l=u;s.reject({message:`Scene analysis failed: ${l.message}`,code:"SCENE_ANALYSIS_ERROR"});return}try{if(n==="shader"){et.setCurrentSourceMap(null);try{await ut.initShaderMode(e,{redactDriverInfoLogs:o})}catch(u){const l=u;if(l.__isShaderCompileError)throw l;et.reportSceneError({message:`Scene code error: ${l.message}`,...l.stack!==void 0&&{stack:l.stack},code:"SCENE_CODE_ERROR",sourceOverride:"scene"});return}ut.sendAllParametersToHost()}else if(n==="p5"){const u=sc(e),{code:l,mappings:h}=u;et.setCurrentSourceMap(h);const d=ic(l);if(d===null)return;const m=d+`
583
- return { setup: typeof setup !== "undefined" ? setup : null, render: typeof render !== "undefined" ? render : null };`,_=new Function("viji","p5","console",m),k=et.makeArtistConsole(globalThis.console),{setup:T,render:P}=_(ut.viji,null,k);if(!P){et.reportSceneError({message:"P5 mode requires a render(viji, p5) function",code:"P5_INIT_ERROR",sourceOverride:"scene"});return}try{await ut.initP5Mode(T,P,{...a!==void 0&&{canvasMode:a}})}catch(F){const B=F;et.reportSceneError({message:`P5 init error: ${B.message}`,...B.stack!==void 0&&{stack:B.stack},code:"P5_INIT_ERROR",sourceOverride:"scene"});return}ut.sendAllParametersToHost()}else{const{code:u,mappings:l}=sc(e);et.setCurrentSourceMap(l);const h=ic(u);if(h===null)return;const d=h+`
584
- if (typeof render === "function") {
585
- return render;
586
- }
587
- throw new Error("Scene code must define a render function");`,m=Object.getPrototypeOf(async function(){}).constructor,_=new m("viji","console",d),k=et.makeArtistConsole(globalThis.console);xn=await _(ut.viji,k),self.renderFunction=xn,ut.sendAllParametersToHost()}i&&ut.seedInitialValues(i)}catch(u){const l=u;console.error("Failed to load scene code:",l),et.reportSceneError({message:`Scene code error: ${l.message}`,...l.stack!==void 0&&{stack:l.stack},code:l.__isShaderCompileError?"SHADER_COMPILE_ERROR":"SCENE_CODE_ERROR",sourceOverride:"scene",...l.__sourceLocation&&{sourceLocationOverride:l.__sourceLocation}})}}self.setSceneCode=lb;