SOURCE / PINNED RELEASE
Made of little things.
Sketch Loop
- Release
- 14966bba4a2a…
- Author-recorded commit
- e68361295d81…
- License
- LICENSE
- Author’s source reference
- nostr://npub1n8ga89w8h6tvwamxusfyzexw8gjy84yxu9rxgnmk955cxtml4ujswzxydd/wss%3A%2F%2Fgit.napplet.soy%2F/n-929bc2a88cb
Archive hash verified: 5e0385e3c08f944f…. The source-to-build association is the author’s claim; it has not been independently rebuilt.
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Paste a 2D creative-code sketch, explore it live, and make a timed GIF." />
<title>Sketch Loop</title>
<script type="module" crossorigin>var Yi=Object.defineProperty;var Xi=(e,t,i)=>t in e?Yi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i;var I=(e,t,i)=>Xi(e,typeof t!="symbol"?t+"":t,i);function Zi(){const e=new Map;function t(s,a){if(e.has(s))throw new Error(`NAP domain "${s}" is already registered`);e.set(s,a)}function i(s){const a=s.type.indexOf(".");if(a<=0)return!1;const o=s.type.slice(0,a),u=e.get(o);return u?(u(s),!0):!1}function r(){return Array.from(e.keys())}return{registerNap:t,dispatch:i,getRegisteredDomains:r}}var Ji=Zi(),er=Ji.registerNap,tr="theme";function Zt(){var t;const e=window;if(!((t=e.napplet)!=null&&t.theme))throw new Error("window.napplet.theme is unavailable -- runtime did not inject this domain");return e.napplet.theme}function ir(){return Zt().get()}function rr(e){return Zt().onChanged(e)}er(tr,e=>{});function sr(){const e=window;if(!e.napplet)throw new Error("window.napplet is unavailable -- runtime did not inject the napplet namespace");return e.napplet}function A(e){const i=sr()[e];if(!i)throw new Error(`window.napplet.${String(e)} is unavailable -- runtime did not inject this domain`);return i}var Jt={getItem(e){return A("storage").getItem(e)},setItem(e,t){return A("storage").setItem(e,t)},removeItem(e){return A("storage").removeItem(e)},keys(){return A("storage").keys()},instance:{getItem(e){return A("storage").instance.getItem(e)},setItem(e,t){return A("storage").instance.setItem(e,t)},removeItem(e){return A("storage").instance.removeItem(e)},keys(){return A("storage").instance.keys()}}},kt={get(){return A("config").get()},subscribe(e){return A("config").subscribe(e)},openSettings(e){A("config").openSettings(e)},registerSchema(e,t){return A("config").registerSchema(e,t)},onSchemaError(e){return A("config").onSchemaError(e)},get schema(){return A("config").schema}},mt={info(){return A("fs").info()},pickFile(e){return A("fs").pickFile(e)},pickFiles(e){return A("fs").pickFiles(e)},pickDirectory(e){return A("fs").pickDirectory(e)},pickSaveFile(e){return A("fs").pickSaveFile(e)},stat(e){return A("fs").stat(e)},list(e){return A("fs").list(e)},read(e,t){return A("fs").read(e,t)},write(e,t,i){return A("fs").write(e,t,i)},mkdir(e,t){return A("fs").mkdir(e,t)},remove(e,t){return A("fs").remove(e,t)},move(e,t){return A("fs").move(e,t)},watch(e,t){return A("fs").watch(e,t)},unwatch(e){return A("fs").unwatch(e)},onChanged(e){return A("fs").onChanged(e)}};function ar(e,t){return!!(e!=null&&e[t])}function ie(e){return ar(window.napplet,e)}var nr=[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,78,5,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,199,7,137,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,55,9,266,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,233,0,3,0,8,1,6,0,475,6,110,6,6,9,4759,9,787719,239],ei=[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,7,25,39,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,5,57,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,24,43,261,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,33,24,3,24,45,74,6,0,67,12,65,1,2,0,15,4,10,7381,42,31,98,114,8702,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,208,30,2,2,2,1,2,6,3,4,10,1,225,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,4381,3,5773,3,7472,16,621,2467,541,1507,4938,6,8489],or="·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ--ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・",ti="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽ-ೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-Ა-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ--ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",xt={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"},gt="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",ur={5:gt,"5module":gt+" export import",6:gt+" const class extends export import super"},ii=/^in(stanceof)?$/,hr=new RegExp("["+ti+"]"),cr=new RegExp("["+ti+or+"]");function St(e,t){for(var i=65536,r=0;r<t.length;r+=2){if(i+=t[r],i>e)return!1;if(i+=t[r+1],i>=e)return!0}return!1}function re(e,t){return e<65?e===36:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&hr.test(String.fromCharCode(e)):t===!1?!1:St(e,ei)}function de(e,t){return e<48?e===36:e<58?!0:e<65?!1:e<91?!0:e<97?e===95:e<123?!0:e<=65535?e>=170&&cr.test(String.fromCharCode(e)):t===!1?!1:St(e,ei)||St(e,nr)}var _=function(t,i){i===void 0&&(i={}),this.label=t,this.keyword=i.keyword,this.beforeExpr=!!i.beforeExpr,this.startsExpr=!!i.startsExpr,this.isLoop=!!i.isLoop,this.isAssign=!!i.isAssign,this.prefix=!!i.prefix,this.postfix=!!i.postfix,this.binop=i.binop||null,this.updateContext=null};function G(e,t){return new _(e,{beforeExpr:!0,binop:t})}var W={beforeExpr:!0},U={startsExpr:!0},At={};function C(e,t){return t===void 0&&(t={}),t.keyword=e,At[e]=new _(e,t)}var n={num:new _("num",U),regexp:new _("regexp",U),string:new _("string",U),name:new _("name",U),privateId:new _("privateId",U),eof:new _("eof"),bracketL:new _("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new _("]"),braceL:new _("{",{beforeExpr:!0,startsExpr:!0}),braceR:new _("}"),parenL:new _("(",{beforeExpr:!0,startsExpr:!0}),parenR:new _(")"),comma:new _(",",W),semi:new _(";",W),colon:new _(":",W),dot:new _("."),question:new _("?",W),questionDot:new _("?."),arrow:new _("=>",W),template:new _("template"),invalidTemplate:new _("invalidTemplate"),ellipsis:new _("...",W),backQuote:new _("`",U),dollarBraceL:new _("${",{beforeExpr:!0,startsExpr:!0}),eq:new _("=",{beforeExpr:!0,isAssign:!0}),assign:new _("_=",{beforeExpr:!0,isAssign:!0}),incDec:new _("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new _("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:G("||",1),logicalAND:G("&&",2),bitwiseOR:G("|",3),bitwiseXOR:G("^",4),bitwiseAND:G("&",5),equality:G("==/!=/===/!==",6),relational:G("</>/<=/>=",7),bitShift:G("<</>>/>>>",8),plusMin:new _("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:G("%",10),star:G("*",10),slash:G("/",10),starstar:new _("**",{beforeExpr:!0}),coalesce:G("??",1),_break:C("break"),_case:C("case",W),_catch:C("catch"),_continue:C("continue"),_debugger:C("debugger"),_default:C("default",W),_do:C("do",{isLoop:!0,beforeExpr:!0}),_else:C("else",W),_finally:C("finally"),_for:C("for",{isLoop:!0}),_function:C("function",U),_if:C("if"),_return:C("return",W),_switch:C("switch"),_throw:C("throw",W),_try:C("try"),_var:C("var"),_const:C("const"),_while:C("while",{isLoop:!0}),_with:C("with"),_new:C("new",{beforeExpr:!0,startsExpr:!0}),_this:C("this",U),_super:C("super",U),_class:C("class",U),_extends:C("extends",W),_export:C("export"),_import:C("import",U),_null:C("null",U),_true:C("true",U),_false:C("false",U),_in:C("in",{beforeExpr:!0,binop:7}),_instanceof:C("instanceof",{beforeExpr:!0,binop:7}),_typeof:C("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:C("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:C("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},j=/\r\n?|\n|\u2028|\u2029/,lr=new RegExp(j.source,"g");function Ae(e){return e===10||e===13||e===8232||e===8233}function ri(e,t,i){i===void 0&&(i=e.length);for(var r=t;r<i;r++){var s=e.charCodeAt(r);if(Ae(s))return r<i-1&&s===13&&e.charCodeAt(r+1)===10?r+2:r+1}return-1}var si=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,B=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,ai=Object.prototype,pr=ai.hasOwnProperty,fr=ai.toString,Ie=Object.hasOwn||(function(e,t){return pr.call(e,t)}),Ut=Array.isArray||(function(e){return fr.call(e)==="[object Array]"}),jt=Object.create(null);function le(e){return jt[e]||(jt[e]=new RegExp("^(?:"+e.replace(/ /g,"|")+")$"))}function oe(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}var dr=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,Be=function(t,i){this.line=t,this.column=i};Be.prototype.offset=function(t){return new Be(this.line,this.column+t)};var et=function(t,i,r){this.start=i,this.end=r,t.sourceFile!==null&&(this.source=t.sourceFile)};function ni(e,t){for(var i=1,r=0;;){var s=ri(e,r,t);if(s<0)return new Be(i,t-r);++i,r=s}}var Ct={ecmaVersion:null,sourceType:"script",strict:!1,onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,startLocation:null,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},qt=!1;function mr(e){var t={};for(var i in Ct)t[i]=e&&Ie(e,i)?e[i]:Ct[i];if(t.ecmaVersion==="latest"?t.ecmaVersion=1e8:t.ecmaVersion==null?(!qt&&typeof console=="object"&&console.warn&&(qt=!0,console.warn(`Since Acorn 8.0.0, options.ecmaVersion is required.
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),Ut(t.onToken)){var r=t.onToken;t.onToken=function(s){return r.push(s)}}if(Ut(t.onComment)&&(t.onComment=xr(t,t.onComment)),t.sourceType==="commonjs"&&t.allowAwaitOutsideFunction)throw new Error("Cannot use allowAwaitOutsideFunction with sourceType: commonjs");return t}function xr(e,t){return function(i,r,s,a,o,u){var h={type:i?"Block":"Line",value:r,start:s,end:a};e.locations&&(h.loc=new et(this,o,u)),e.ranges&&(h.range=[s,a]),t.push(h)}}var ve=1,be=2,It=4,oi=8,Pt=16,ui=32,tt=64,hi=128,ye=256,De=512,ci=1024,it=ve|be|ye;function Nt(e,t){return be|(e?It:0)|(t?oi:0)}var ze=0,Vt=1,he=2,li=3,pi=4,fi=5,M=function(t,i,r){this.options=t=mr(t),this.sourceFile=t.sourceFile,this.keywords=le(ur[t.ecmaVersion>=6?6:t.sourceType==="module"?"5module":5]);var s="";t.allowReserved!==!0&&(s=xt[t.ecmaVersion>=6?6:t.ecmaVersion===5?5:3],t.sourceType==="module"&&(s+=" await")),this.reservedWords=le(s);var a=(s?s+" ":"")+xt.strict;this.reservedWordsStrict=le(a),this.reservedWordsStrictBind=le(a+" "+xt.strictBind),this.input=String(i),this.containsEsc=!1,this.pos=r||0,this.curLine=1,t.startLocation?(this.lineStart=this.pos-t.startLocation.column,this.curLine=t.startLocation.line):r?(this.lineStart=this.input.lastIndexOf(`
`,r-1)+1,this.options.locations&&(this.curLine=this.input.slice(0,this.lineStart).split(j).length)):this.lineStart=0,this.type=n.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=!0,this.inModule=t.sourceType==="module",this.strict=this.inModule||t.strict===!0||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,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(this.options.sourceType==="commonjs"?be:ve),this.regexpState=null,this.privateNameStack=[]},K={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowReturn:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},allowUsing:{configurable:!0},inClassStaticBlock:{configurable:!0}};M.prototype.parse=function(){var t=this,i=this.options.program||this.startNode();return this.nextToken(),this.catchStackOverflow(function(){return t.parseTopLevel(i)})};K.inFunction.get=function(){return(this.currentVarScope().flags&be)>0};K.inGenerator.get=function(){return(this.currentVarScope().flags&oi)>0};K.inAsync.get=function(){return(this.currentVarScope().flags&It)>0};K.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e],i=t.flags;if(i&(ye|De))return!1;if(i&be)return(i&It)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction};K.allowReturn.get=function(){return!!(this.inFunction||this.options.allowReturnOutsideFunction&&this.currentVarScope().flags&ve)};K.allowSuper.get=function(){var e=this.currentThisScope(),t=e.flags;return(t&tt)>0||this.options.allowSuperOutsideMethod};K.allowDirectSuper.get=function(){return(this.currentThisScope().flags&hi)>0};K.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())};K.allowNewDotTarget.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e],i=t.flags;if(i&(ye|De)||i&be&&!(i&Pt))return!0}return!1};K.allowUsing.get=function(){var e=this.currentScope(),t=e.flags;return!(t&ci||!this.inModule&&t&ve)};K.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&ye)>0};M.extend=function(){for(var t=[],i=arguments.length;i--;)t[i]=arguments[i];for(var r=this,s=0;s<t.length;s++)r=t[s](r);return r};M.parse=function(t,i){return new this(i,t).parse()};M.parseExpressionAt=function(t,i,r){var s=new this(r,t,i);return s.nextToken(),s.parseExpression()};M.tokenizer=function(t,i){return new this(i,t)};Object.defineProperties(M.prototype,K);var F=M.prototype,gr=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;F.strictDirective=function(e){if(this.options.ecmaVersion<5)return!1;for(;;){B.lastIndex=e,e+=B.exec(this.input)[0].length;var t=gr.exec(this.input.slice(e));if(!t)return!1;if((t[1]||t[2])==="use strict"){B.lastIndex=e+t[0].length;var i=B.exec(this.input),r=i.index+i[0].length,s=this.input.charAt(r);return s===";"||s==="}"||j.test(i[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(s)||s==="!"&&this.input.charAt(r+1)==="=")}e+=t[0].length,B.lastIndex=e,e+=B.exec(this.input)[0].length,this.input[e]===";"&&e++}};F.eat=function(e){return this.type===e?(this.next(),!0):!1};F.isContextual=function(e){return this.type===n.name&&this.value===e&&!this.containsEsc};F.eatContextual=function(e){return this.isContextual(e)?(this.next(),!0):!1};F.catchStackOverflow=function(e){try{return e()}catch(t){if(t instanceof Error&&(/\bstack\b.*\b(exceeded|overflow)\b/i.test(t.message)||/\btoo much recursion\b/i.test(t.message)))this.raise(this.start,"Not enough stack space to parse input");else throw t}};F.expectContextual=function(e){this.eatContextual(e)||this.unexpected()};F.canInsertSemicolon=function(){return this.type===n.eof||this.type===n.braceR||j.test(this.input.slice(this.lastTokEnd,this.start))};F.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0};F.semicolon=function(){!this.eat(n.semi)&&!this.insertSemicolon()&&this.unexpected()};F.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0};F.expect=function(e){this.eat(e)||this.unexpected()};F.unexpected=function(e){this.raise(e??this.start,"Unexpected token")};var rt=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};F.checkPatternErrors=function(e,t){if(e){e.trailingComma>-1&&this.raiseRecoverable(e.trailingComma,"Comma is not permitted after the rest element");var i=t?e.parenthesizedAssign:e.parenthesizedBind;i>-1&&this.raiseRecoverable(i,t?"Assigning to rvalue":"Parenthesized pattern")}};F.checkExpressionErrors=function(e,t){if(!e)return!1;var i=e.shorthandAssign,r=e.doubleProto;if(!t)return i>=0||r>=0;i>=0&&this.raise(i,"Shorthand property assignments are valid only in destructuring patterns"),r>=0&&this.raiseRecoverable(r,"Redefinition of __proto__ property")};F.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")};F.isSimpleAssignTarget=function(e){return e.type==="ParenthesizedExpression"?this.isSimpleAssignTarget(e.expression):e.type==="Identifier"||e.type==="MemberExpression"};var m=M.prototype;m.parseTopLevel=function(e){var t=Object.create(null);for(e.body||(e.body=[]);this.type!==n.eof;){var i=this.parseStatement(null,!0,t);e.body.push(i)}if(this.inModule)for(var r=0,s=Object.keys(this.undefinedExports);r<s.length;r+=1){var a=s[r];this.raiseRecoverable(this.undefinedExports[a].start,"Export '"+a+"' is not defined")}return this.adaptDirectivePrologue(e.body),this.next(),e.sourceType=this.options.sourceType==="commonjs"?"script":this.options.sourceType,this.finishNode(e,"Program")};var Tt={kind:"loop"},vr={kind:"switch"};m.isLet=function(e){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;B.lastIndex=this.pos;var t=B.exec(this.input),i=this.pos+t[0].length,r=this.fullCharCodeAt(i);if(r===91||r===92)return!0;if(e)return!1;if(r===123)return!0;if(re(r)){var s=i;do i+=r<=65535?1:2;while(de(r=this.fullCharCodeAt(i)));if(r===92)return!0;var a=this.input.slice(s,i);if(!ii.test(a))return!0}return!1};m.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;B.lastIndex=this.pos;var e=B.exec(this.input),t=this.pos+e[0].length,i;return!j.test(this.input.slice(this.pos,t))&&this.input.slice(t,t+8)==="function"&&(t+8===this.input.length||!(de(i=this.fullCharCodeAt(t+8))||i===92))};m.isUsingKeyword=function(e,t){if(this.options.ecmaVersion<17||!this.isContextual(e?"await":"using"))return!1;B.lastIndex=this.pos;var i=B.exec(this.input),r=this.pos+i[0].length;if(j.test(this.input.slice(this.pos,r)))return!1;if(e){var s=r+5,a;if(this.input.slice(r,s)!=="using"||s===this.input.length||de(a=this.fullCharCodeAt(s))||a===92)return!1;B.lastIndex=s;var o=B.exec(this.input);if(r=s+o[0].length,o&&j.test(this.input.slice(s,r)))return!1}var u=this.fullCharCodeAt(r);if(!re(u)&&u!==92)return!1;var h=r;do r+=u<=65535?1:2;while(de(u=this.fullCharCodeAt(r)));if(u===92)return!0;var c=this.input.slice(h,r);if(ii.test(c))return!1;if(t&&!e&&c==="of"){B.lastIndex=r;var p=B.exec(this.input);if(r=r+p[0].length,this.input.charCodeAt(r)!==61||(u=this.input.charCodeAt(r+1))===61||u===62)return!1}return!0};m.isAwaitUsing=function(e){return this.isUsingKeyword(!0,e)};m.isUsing=function(e){return this.isUsingKeyword(!1,e)};m.parseStatement=function(e,t,i){var r=this.type,s=this.startNode(),a;switch(this.isLet(e)&&(r=n._var,a="let"),r){case n._break:case n._continue:return this.parseBreakContinueStatement(s,r.keyword);case n._debugger:return this.parseDebuggerStatement(s);case n._do:return this.parseDoStatement(s);case n._for:return this.parseForStatement(s);case n._function:return e&&(this.strict||e!=="if"&&e!=="label")&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(s,!1,!e);case n._class:return e&&this.unexpected(),this.parseClass(s,!0);case n._if:return this.parseIfStatement(s);case n._return:return this.parseReturnStatement(s);case n._switch:return this.parseSwitchStatement(s);case n._throw:return this.parseThrowStatement(s);case n._try:return this.parseTryStatement(s);case n._const:case n._var:return a=a||this.value,e&&a!=="var"&&this.unexpected(),this.parseVarStatement(s,a);case n._while:return this.parseWhileStatement(s);case n._with:return this.parseWithStatement(s);case n.braceL:return this.parseBlock(!0,s);case n.semi:return this.parseEmptyStatement(s);case n._export:case n._import:if(this.options.ecmaVersion>10&&r===n._import){B.lastIndex=this.pos;var o=B.exec(this.input),u=this.pos+o[0].length,h=this.input.charCodeAt(u);if(h===40||h===46)return this.parseExpressionStatement(s,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'")),r===n._import?this.parseImport(s):this.parseExport(s,i);default:if(this.isAsyncFunction())return e&&this.unexpected(),this.next(),this.parseFunctionStatement(s,!0,!e);var c=this.isAwaitUsing(!1)?"await using":this.isUsing(!1)?"using":null;if(c)return this.allowUsing||this.raise(this.start,"Using declaration cannot appear in the top level when source type is `script` or in the bare case statement"),e&&this.raise(this.start,"Using declaration is not allowed in single-statement positions"),c==="await using"&&(this.canAwait||this.raise(this.start,"Await using cannot appear outside of async function"),this.next()),this.next(),this.parseVar(s,!1,c),this.semicolon(),this.finishNode(s,"VariableDeclaration");var p=this.value,l=this.parseExpression();return r===n.name&&l.type==="Identifier"&&this.eat(n.colon)?this.parseLabeledStatement(s,p,l,e):this.parseExpressionStatement(s,l)}};m.parseBreakContinueStatement=function(e,t){var i=t==="break";this.next(),this.eat(n.semi)||this.insertSemicolon()?e.label=null:this.type!==n.name?this.unexpected():(e.label=this.parseIdent(),this.semicolon());for(var r=0;r<this.labels.length;++r){var s=this.labels[r];if((e.label==null||s.name===e.label.name)&&(s.kind!=null&&(i||s.kind==="loop")||e.label&&i))break}return r===this.labels.length&&this.raise(e.start,"Unsyntactic "+t),this.finishNode(e,i?"BreakStatement":"ContinueStatement")};m.parseDebuggerStatement=function(e){return this.next(),this.semicolon(),this.finishNode(e,"DebuggerStatement")};m.parseDoStatement=function(e){return this.next(),this.labels.push(Tt),e.body=this.parseStatement("do"),this.labels.pop(),this.expect(n._while),e.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(n.semi):this.semicolon(),this.finishNode(e,"DoWhileStatement")};m.parseForStatement=function(e){this.next();var t=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(Tt),this.enterScope(0),this.expect(n.parenL),this.type===n.semi)return t>-1&&this.unexpected(t),this.parseFor(e,null);var i=this.isLet();if(this.type===n._var||this.type===n._const||i){var r=this.startNode(),s=i?"let":this.value;return this.next(),this.parseVar(r,!0,s),this.finishNode(r,"VariableDeclaration"),this.parseForAfterInit(e,r,t)}var a=this.isContextual("let"),o=!1,u=this.isUsing(!0)?"using":this.isAwaitUsing(!0)?"await using":null;if(u){var h=this.startNode();return this.next(),u==="await using"&&(this.canAwait||this.raise(this.start,"Await using cannot appear outside of async function"),this.next()),this.parseVar(h,!0,u),this.finishNode(h,"VariableDeclaration"),this.parseForAfterInit(e,h,t)}var c=this.containsEsc,p=new rt,l=this.start,x=t>-1?this.parseExprSubscripts(p,"await"):this.parseExpression(!0,p);return this.type===n._in||(o=this.options.ecmaVersion>=6&&this.isContextual("of"))?(t>-1?(this.type===n._in&&this.unexpected(t),e.await=!0):o&&this.options.ecmaVersion>=8&&(x.start===l&&!c&&x.type==="Identifier"&&x.name==="async"?this.unexpected():this.options.ecmaVersion>=9&&(e.await=!1)),a&&o&&this.raise(x.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(x,!1,p),this.checkLValPattern(x),this.parseForIn(e,x)):(this.checkExpressionErrors(p,!0),t>-1&&this.unexpected(t),this.parseFor(e,x))};m.parseForAfterInit=function(e,t,i){return(this.type===n._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&t.declarations.length===1?(this.type===n._in?((t.kind==="using"||t.kind==="await using")&&!t.declarations[0].init&&this.raise(this.start,"Using declaration is not allowed in for-in loops"),this.options.ecmaVersion>=9&&i>-1&&this.unexpected(i)):this.options.ecmaVersion>=9&&(e.await=i>-1),this.parseForIn(e,t)):(i>-1&&this.unexpected(i),this.parseFor(e,t))};m.parseFunctionStatement=function(e,t,i){return this.next(),this.parseFunction(e,Le|(i?0:_t),!1,t)};m.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement("if"),e.alternate=this.eat(n._else)?this.parseStatement("if"):null,this.finishNode(e,"IfStatement")};m.parseReturnStatement=function(e){return this.allowReturn||this.raise(this.start,"'return' outside of function"),this.next(),this.eat(n.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,"ReturnStatement")};m.parseSwitchStatement=function(e){this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(n.braceL),this.labels.push(vr),this.enterScope(ci);for(var t,i=!1;this.type!==n.braceR;)if(this.type===n._case||this.type===n._default){var r=this.type===n._case;t&&this.finishNode(t,"SwitchCase"),e.cases.push(t=this.startNode()),t.consequent=[],this.next(),r?t.test=this.parseExpression():(i&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),i=!0,t.test=null),this.expect(n.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")};m.parseThrowStatement=function(e){return this.next(),j.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 br=[];m.parseCatchClauseParam=function(){var e=this.parseBindingAtom(),t=e.type==="Identifier";return this.enterScope(t?ui:0),this.checkLValPattern(e,t?pi:he),this.expect(n.parenR),e};m.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===n._catch){var t=this.startNode();this.next(),this.eat(n.parenL)?t.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),t.param=null,this.enterScope(0)),t.body=this.parseBlock(!1),this.exitScope(),e.handler=this.finishNode(t,"CatchClause")}return e.finalizer=this.eat(n._finally)?this.parseBlock():null,!e.handler&&!e.finalizer&&this.raise(e.start,"Missing catch or finally clause"),this.finishNode(e,"TryStatement")};m.parseVarStatement=function(e,t,i){return this.next(),this.parseVar(e,!1,t,i),this.semicolon(),this.finishNode(e,"VariableDeclaration")};m.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(Tt),e.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(e,"WhileStatement")};m.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")};m.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,"EmptyStatement")};m.parseLabeledStatement=function(e,t,i,r){for(var s=0,a=this.labels;s<a.length;s+=1){var o=a[s];o.name===t&&this.raise(i.start,"Label '"+t+"' is already declared")}for(var u=this.type.isLoop?"loop":this.type===n._switch?"switch":null,h=this.labels.length-1;h>=0;h--){var c=this.labels[h];if(c.statementStart===e.start)c.statementStart=this.start,c.kind=u;else break}return this.labels.push({name:t,kind:u,statementStart:this.start}),e.body=this.parseStatement(r?r.indexOf("label")===-1?r+"label":r:"label"),this.labels.pop(),e.label=i,this.finishNode(e,"LabeledStatement")};m.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,"ExpressionStatement")};m.parseBlock=function(e,t,i){for(e===void 0&&(e=!0),t===void 0&&(t=this.startNode()),t.body=[],this.expect(n.braceL),e&&this.enterScope(0);this.type!==n.braceR;){var r=this.parseStatement(null);t.body.push(r)}return i&&(this.strict=!1),this.next(),e&&this.exitScope(),this.finishNode(t,"BlockStatement")};m.parseFor=function(e,t){return e.init=t,this.expect(n.semi),e.test=this.type===n.semi?null:this.parseExpression(),this.expect(n.semi),e.update=this.type===n.parenR?null:this.parseExpression(),this.expect(n.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,"ForStatement")};m.parseForIn=function(e,t){var i=this.type===n._in;return this.next(),t.type==="VariableDeclaration"&&t.declarations[0].init!=null&&(!i||this.options.ecmaVersion<8||this.strict||t.kind!=="var"||t.declarations[0].id.type!=="Identifier")&&this.raise(t.start,(i?"for-in":"for-of")+" loop variable declaration may not have an initializer"),e.left=t,e.right=i?this.parseExpression():this.parseMaybeAssign(),this.expect(n.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,i?"ForInStatement":"ForOfStatement")};m.parseVar=function(e,t,i,r){for(e.declarations=[],e.kind=i;;){var s=this.startNode();if(this.parseVarId(s,i),this.eat(n.eq)?s.init=this.parseMaybeAssign(t):!r&&i==="const"&&!(this.type===n._in||this.options.ecmaVersion>=6&&this.isContextual("of"))?this.unexpected():!r&&(i==="using"||i==="await using")&&this.options.ecmaVersion>=17&&this.type!==n._in&&!this.isContextual("of")?this.raise(this.lastTokEnd,"Missing initializer in "+i+" declaration"):!r&&s.id.type!=="Identifier"&&!(t&&(this.type===n._in||this.isContextual("of")))?this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):s.init=null,e.declarations.push(this.finishNode(s,"VariableDeclarator")),!this.eat(n.comma))break}return e};m.parseVarId=function(e,t){e.id=t==="using"||t==="await using"?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(e.id,t==="var"?Vt:he,!1)};var Le=1,_t=2,di=4;m.parseFunction=function(e,t,i,r,s){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!r)&&(this.type===n.star&&t&_t&&this.unexpected(),e.generator=this.eat(n.star)),this.options.ecmaVersion>=8&&(e.async=!!r),t&Le&&(e.id=t&di&&this.type!==n.name?null:this.parseIdent(),e.id&&!(t&_t)&&this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?Vt:he:li));var a=this.yieldPos,o=this.awaitPos,u=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Nt(e.async,e.generator)),t&Le||(e.id=this.type===n.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,i,!1,s),this.yieldPos=a,this.awaitPos=o,this.awaitIdentPos=u,this.finishNode(e,t&Le?"FunctionDeclaration":"FunctionExpression")};m.parseFunctionParams=function(e){this.expect(n.parenL),e.params=this.parseBindingList(n.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()};m.parseClass=function(e,t){this.next();var i=this.strict;this.strict=!0,this.parseClassId(e,t),this.parseClassSuper(e);var r=this.enterClassBody(),s=this.startNode(),a=!1;for(s.body=[],this.expect(n.braceL);this.type!==n.braceR;){var o=this.parseClassElement(e.superClass!==null);o&&(s.body.push(o),o.type==="MethodDefinition"&&o.kind==="constructor"?(a&&this.raiseRecoverable(o.start,"Duplicate constructor in the same class"),a=!0):o.key&&o.key.type==="PrivateIdentifier"&&yr(r,o)&&this.raiseRecoverable(o.key.start,"Identifier '#"+o.key.name+"' has already been declared"))}return this.strict=i,this.next(),e.body=this.finishNode(s,"ClassBody"),this.exitClassBody(),this.finishNode(e,t?"ClassDeclaration":"ClassExpression")};m.parseClassElement=function(e){if(this.eat(n.semi))return null;var t=this.options.ecmaVersion,i=this.startNode(),r="",s=!1,a=!1,o="method",u=!1;if(this.eatContextual("static")){if(t>=13&&this.eat(n.braceL))return this.parseClassStaticBlock(i),i;this.isClassElementNameStart()||this.type===n.star?u=!0:r="static"}if(i.static=u,!r&&t>=8&&this.eatContextual("async")&&((this.isClassElementNameStart()||this.type===n.star)&&!this.canInsertSemicolon()?a=!0:r="async"),!r&&(t>=9||!a)&&this.eat(n.star)&&(s=!0),!r&&!a&&!s){var h=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?o=h:r=h)}if(r?(i.computed=!1,i.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),i.key.name=r,this.finishNode(i.key,"Identifier")):this.parseClassElementName(i),t<13||this.type===n.parenL||o!=="method"||s||a){var c=!i.static&&Ke(i,"constructor"),p=c&&e;c&&o!=="method"&&this.raise(i.key.start,"Constructor can't have get/set modifier"),i.kind=c?"constructor":o,this.parseClassMethod(i,s,a,p)}else this.parseClassField(i);return i};m.isClassElementNameStart=function(){return this.type===n.name||this.type===n.privateId||this.type===n.num||this.type===n.string||this.type===n.bracketL||this.type.keyword};m.parseClassElementName=function(e){this.type===n.privateId?(this.value==="constructor"&&this.raise(this.start,"Classes can't have an element named '#constructor'"),e.computed=!1,e.key=this.parsePrivateIdent()):this.parsePropertyName(e)};m.parseClassMethod=function(e,t,i,r){var s=e.key;e.kind==="constructor"?(t&&this.raise(s.start,"Constructor can't be a generator"),i&&this.raise(s.start,"Constructor can't be an async method")):e.static&&Ke(e,"prototype")&&this.raise(s.start,"Classes may not have a static property named prototype");var a=e.value=this.parseMethod(t,i,r);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")};m.parseClassField=function(e){return Ke(e,"constructor")?this.raise(e.key.start,"Classes can't have a field named 'constructor'"):e.static&&Ke(e,"prototype")&&this.raise(e.key.start,"Classes can't have a static field named 'prototype'"),this.eat(n.eq)?(this.enterScope(De|tt),e.value=this.parseMaybeAssign(),this.exitScope()):e.value=null,this.semicolon(),this.finishNode(e,"PropertyDefinition")};m.parseClassStaticBlock=function(e){e.body=[];var t=this.labels;for(this.labels=[],this.enterScope(ye|tt);this.type!==n.braceR;){var i=this.parseStatement(null);e.body.push(i)}return this.next(),this.exitScope(),this.labels=t,this.finishNode(e,"StaticBlock")};m.parseClassId=function(e,t){this.type===n.name?(e.id=this.parseIdent(),t&&this.checkLValSimple(e.id,he,!1)):(t===!0&&this.unexpected(),e.id=null)};m.parseClassSuper=function(e){e.superClass=this.eat(n._extends)?this.parseExprSubscripts(null,!1):null};m.enterClassBody=function(){var e={declared:Object.create(null),used:[]};return this.privateNameStack.push(e),e.declared};m.exitClassBody=function(){var e=this.privateNameStack.pop(),t=e.declared,i=e.used;if(this.options.checkPrivateFields)for(var r=this.privateNameStack.length,s=r===0?null:this.privateNameStack[r-1],a=0;a<i.length;++a){var o=i[a];Ie(t,o.name)||(s?s.used.push(o):this.raiseRecoverable(o.start,"Private field '#"+o.name+"' must be declared in an enclosing class"))}};function yr(e,t){var i=t.key.name,r=e[i],s="true";return t.type==="MethodDefinition"&&(t.kind==="get"||t.kind==="set")&&(s=(t.static?"s":"i")+t.kind),r==="iget"&&s==="iset"||r==="iset"&&s==="iget"||r==="sget"&&s==="sset"||r==="sset"&&s==="sget"?(e[i]="true",!1):r?!0:(e[i]=s,!1)}function Ke(e,t){var i=e.computed,r=e.key;return!i&&(r.type==="Identifier"&&r.name===t||r.type==="Literal"&&r.value===t)}m.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!==n.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ExportAllDeclaration")};m.parseExport=function(e,t){if(this.next(),this.eat(n.star))return this.parseExportAllDeclaration(e,t);if(this.eat(n._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!==n.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause());else{for(var i=0,r=e.specifiers;i<r.length;i+=1){var s=r[i];this.checkUnreserved(s.local),this.checkLocalExport(s.local),s.local.type==="Literal"&&this.raise(s.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")};m.parseExportDeclaration=function(e){return this.parseStatement(null)};m.parseExportDefaultDeclaration=function(){var e;if(this.type===n._function||(e=this.isAsyncFunction())){var t=this.startNode();return this.next(),e&&this.next(),this.parseFunction(t,Le|di,!1,e)}else if(this.type===n._class){var i=this.startNode();return this.parseClass(i,"nullableID")}else{var r=this.parseMaybeAssign();return this.semicolon(),r}};m.checkExport=function(e,t,i){e&&(typeof t!="string"&&(t=t.type==="Identifier"?t.name:t.value),Ie(e,t)&&this.raiseRecoverable(i,"Duplicate export '"+t+"'"),e[t]=!0)};m.checkPatternExport=function(e,t){var i=t.type;if(i==="Identifier")this.checkExport(e,t,t.start);else if(i==="ObjectPattern")for(var r=0,s=t.properties;r<s.length;r+=1){var a=s[r];this.checkPatternExport(e,a)}else if(i==="ArrayPattern")for(var o=0,u=t.elements;o<u.length;o+=1){var h=u[o];h&&this.checkPatternExport(e,h)}else i==="Property"?this.checkPatternExport(e,t.value):i==="AssignmentPattern"?this.checkPatternExport(e,t.left):i==="RestElement"&&this.checkPatternExport(e,t.argument)};m.checkVariableExport=function(e,t){if(e)for(var i=0,r=t;i<r.length;i+=1){var s=r[i];this.checkPatternExport(e,s.id)}};m.shouldParseExportStatement=function(){return this.type.keyword==="var"||this.type.keyword==="const"||this.type.keyword==="class"||this.type.keyword==="function"||this.isLet()||this.isAsyncFunction()};m.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")};m.parseExportSpecifiers=function(e){var t=[],i=!0;for(this.expect(n.braceL);!this.eat(n.braceR);){if(i)i=!1;else if(this.expect(n.comma),this.afterTrailingComma(n.braceR))break;t.push(this.parseExportSpecifier(e))}return t};m.parseImport=function(e){return this.next(),this.type===n.string?(e.specifiers=br,e.source=this.parseExprAtom()):(e.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),e.source=this.type===n.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ImportDeclaration")};m.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,he),this.finishNode(e,"ImportSpecifier")};m.parseImportDefaultSpecifier=function(){var e=this.startNode();return e.local=this.parseIdent(),this.checkLValSimple(e.local,he),this.finishNode(e,"ImportDefaultSpecifier")};m.parseImportNamespaceSpecifier=function(){var e=this.startNode();return this.next(),this.expectContextual("as"),e.local=this.parseIdent(),this.checkLValSimple(e.local,he),this.finishNode(e,"ImportNamespaceSpecifier")};m.parseImportSpecifiers=function(){var e=[],t=!0;if(this.type===n.name&&(e.push(this.parseImportDefaultSpecifier()),!this.eat(n.comma)))return e;if(this.type===n.star)return e.push(this.parseImportNamespaceSpecifier()),e;for(this.expect(n.braceL);!this.eat(n.braceR);){if(t)t=!1;else if(this.expect(n.comma),this.afterTrailingComma(n.braceR))break;e.push(this.parseImportSpecifier())}return e};m.parseWithClause=function(){var e=[];if(!this.eat(n._with))return e;this.expect(n.braceL);for(var t={},i=!0;!this.eat(n.braceR);){if(i)i=!1;else if(this.expect(n.comma),this.afterTrailingComma(n.braceR))break;var r=this.parseImportAttribute(),s=r.key.type==="Identifier"?r.key.name:r.key.value;Ie(t,s)&&this.raiseRecoverable(r.key.start,"Duplicate attribute key '"+s+"'"),t[s]=!0,e.push(r)}return e};m.parseImportAttribute=function(){var e=this.startNode();return e.key=this.type===n.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never"),this.expect(n.colon),this.type!==n.string&&this.unexpected(),e.value=this.parseExprAtom(),this.finishNode(e,"ImportAttribute")};m.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===n.string){var e=this.parseLiteral(this.value);return dr.test(e.value)&&this.raise(e.start,"An export name cannot include a lone surrogate."),e}return this.parseIdent(!0)};m.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)};m.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 Q=M.prototype;Q.toAssignable=function(e,t,i){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",i&&this.checkPatternErrors(i,!0);for(var r=0,s=e.properties;r<s.length;r+=1){var a=s[r];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",i&&this.checkPatternErrors(i,!0),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,i);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 i&&this.checkPatternErrors(i,!0);return e};Q.toAssignableList=function(e,t){for(var i=e.length,r=0;r<i;r++){var s=e[r];s&&this.toAssignable(s,t)}if(i){var a=e[i-1];this.options.ecmaVersion===6&&t&&a&&a.type==="RestElement"&&a.argument.type!=="Identifier"&&this.unexpected(a.argument.start)}return e};Q.parseSpread=function(e){var t=this.startNode();return this.next(),t.argument=this.parseMaybeAssign(!1,e),this.finishNode(t,"SpreadElement")};Q.parseRestBinding=function(){var e=this.startNode();return this.next(),this.options.ecmaVersion===6&&this.type!==n.name&&this.unexpected(),e.argument=this.parseBindingAtom(),this.finishNode(e,"RestElement")};Q.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case n.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(n.bracketR,!0,!0),this.finishNode(e,"ArrayPattern");case n.braceL:return this.parseObj(!0)}return this.parseIdent()};Q.parseBindingList=function(e,t,i,r){for(var s=[],a=!0;!this.eat(e);)if(a?a=!1:this.expect(n.comma),t&&this.type===n.comma)s.push(null);else{if(i&&this.afterTrailingComma(e))break;if(this.type===n.ellipsis){var o=this.parseRestBinding();this.parseBindingListItem(o),s.push(o),this.type===n.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(e);break}else s.push(this.parseAssignableListItem(r))}return s};Q.parseAssignableListItem=function(e){var t=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(t),t};Q.parseBindingListItem=function(e){return e};Q.parseMaybeDefault=function(e,t,i){if(i=i||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(n.eq))return i;var r=this.startNodeAt(e,t);return r.left=i,r.right=this.parseMaybeAssign(),this.finishNode(r,"AssignmentPattern")};Q.checkLValSimple=function(e,t,i){t===void 0&&(t=ze);var r=t!==ze;switch(e.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(e.name)&&this.raiseRecoverable(e.start,(r?"Binding ":"Assigning to ")+e.name+" in strict mode"),r&&(t===he&&e.name==="let"&&this.raiseRecoverable(e.start,"let is disallowed as a lexically bound name"),i&&(Ie(i,e.name)&&this.raiseRecoverable(e.start,"Argument name clash"),i[e.name]=!0),t!==fi&&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":r&&this.raiseRecoverable(e.start,"Binding member expression");break;case"ParenthesizedExpression":return r&&this.raiseRecoverable(e.start,"Binding parenthesized expression"),this.checkLValSimple(e.expression,t,i);default:this.raise(e.start,(r?"Binding":"Assigning to")+" rvalue")}};Q.checkLValPattern=function(e,t,i){switch(t===void 0&&(t=ze),e.type){case"ObjectPattern":for(var r=0,s=e.properties;r<s.length;r+=1){var a=s[r];this.checkLValInnerPattern(a,t,i)}break;case"ArrayPattern":for(var o=0,u=e.elements;o<u.length;o+=1){var h=u[o];h&&this.checkLValInnerPattern(h,t,i)}break;default:this.checkLValSimple(e,t,i)}};Q.checkLValInnerPattern=function(e,t,i){switch(t===void 0&&(t=ze),e.type){case"Property":this.checkLValInnerPattern(e.value,t,i);break;case"AssignmentPattern":this.checkLValPattern(e.left,t,i);break;case"RestElement":this.checkLValPattern(e.argument,t,i);break;default:this.checkLValPattern(e,t,i)}};var Z=function(t,i,r,s,a){this.token=t,this.isExpr=!!i,this.preserveSpace=!!r,this.override=s,this.generator=!!a},V={b_stat:new Z("{",!1),b_expr:new Z("{",!0),b_tmpl:new Z("${",!1),p_stat:new Z("(",!1),p_expr:new Z("(",!0),q_tmpl:new Z("`",!0,!0,function(e){return e.tryReadTemplateToken()}),f_stat:new Z("function",!1),f_expr:new Z("function",!0),f_expr_gen:new Z("function",!0,!1,null,!0),f_gen:new Z("function",!1,!1,null,!0)},Pe=M.prototype;Pe.initialContext=function(){return[V.b_stat]};Pe.curContext=function(){return this.context[this.context.length-1]};Pe.braceIsBlock=function(e){var t=this.curContext();return t===V.f_expr||t===V.f_stat?!0:e===n.colon&&(t===V.b_stat||t===V.b_expr)?!t.isExpr:e===n._return||e===n.name&&this.exprAllowed?j.test(this.input.slice(this.lastTokEnd,this.start)):e===n._else||e===n.semi||e===n.eof||e===n.parenR||e===n.arrow?!0:e===n.braceL?t===V.b_stat:e===n._var||e===n._const||e===n.name?!1:!this.exprAllowed};Pe.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!1};Pe.updateContext=function(e){var t,i=this.type;i.keyword&&e===n.dot?this.exprAllowed=!1:(t=i.updateContext)?t.call(this,e):this.exprAllowed=i.beforeExpr};Pe.overrideContext=function(e){this.curContext()!==e&&(this.context[this.context.length-1]=e)};n.parenR.updateContext=n.braceR.updateContext=function(){if(this.context.length===1){this.exprAllowed=!0;return}var e=this.context.pop();e===V.b_stat&&this.curContext().token==="function"&&(e=this.context.pop()),this.exprAllowed=!e.isExpr};n.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?V.b_stat:V.b_expr),this.exprAllowed=!0};n.dollarBraceL.updateContext=function(){this.context.push(V.b_tmpl),this.exprAllowed=!0};n.parenL.updateContext=function(e){var t=e===n._if||e===n._for||e===n._with||e===n._while;this.context.push(t?V.p_stat:V.p_expr),this.exprAllowed=!0};n.incDec.updateContext=function(){};n._function.updateContext=n._class.updateContext=function(e){e.beforeExpr&&e!==n._else&&!(e===n.semi&&this.curContext()!==V.p_stat)&&!(e===n._return&&j.test(this.input.slice(this.lastTokEnd,this.start)))&&!((e===n.colon||e===n.braceL)&&this.curContext()===V.b_stat)?this.context.push(V.f_expr):this.context.push(V.f_stat),this.exprAllowed=!1};n.colon.updateContext=function(){this.curContext().token==="function"&&this.context.pop(),this.exprAllowed=!0};n.backQuote.updateContext=function(){this.curContext()===V.q_tmpl?this.context.pop():this.context.push(V.q_tmpl),this.exprAllowed=!1};n.star.updateContext=function(e){if(e===n._function){var t=this.context.length-1;this.context[t]===V.f_expr?this.context[t]=V.f_expr_gen:this.context[t]=V.f_gen}this.exprAllowed=!0};n.name.updateContext=function(e){var t=!1;this.options.ecmaVersion>=6&&e!==n.dot&&(this.value==="of"&&!this.exprAllowed||this.value==="yield"&&this.inGeneratorContext())&&(t=!0),this.exprAllowed=t};var b=M.prototype;b.checkPropClash=function(e,t,i){if(!(this.options.ecmaVersion>=9&&e.type==="SpreadElement")&&!(this.options.ecmaVersion>=6&&(e.computed||e.method||e.shorthand))){var r=e.key,s;switch(r.type){case"Identifier":s=r.name;break;case"Literal":s=String(r.value);break;default:return}var a=e.kind;if(this.options.ecmaVersion>=6){s==="__proto__"&&a==="init"&&(t.proto&&(i?i.doubleProto<0&&(i.doubleProto=r.start):this.raiseRecoverable(r.start,"Redefinition of __proto__ property")),t.proto=!0);return}s="$"+s;var o=t[s];if(o){var u;a==="init"?u=this.strict&&o.init||o.get||o.set:u=o.init||o[a],u&&this.raiseRecoverable(r.start,"Redefinition of property")}else o=t[s]={init:!1,get:!1,set:!1};o[a]=!0}};b.parseExpression=function(e,t){var i=this;return this.catchStackOverflow(function(){var r=i.start,s=i.startLoc,a=i.parseMaybeAssign(e,t);if(i.type===n.comma){var o=i.startNodeAt(r,s);for(o.expressions=[a];i.eat(n.comma);)o.expressions.push(i.parseMaybeAssign(e,t));return i.finishNode(o,"SequenceExpression")}return a})};b.parseMaybeAssign=function(e,t,i){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(e);this.exprAllowed=!1}var r=!1,s=-1,a=-1,o=-1;t?(s=t.parenthesizedAssign,a=t.trailingComma,o=t.doubleProto,t.parenthesizedAssign=t.trailingComma=-1):(t=new rt,r=!0);var u=this.start,h=this.startLoc;(this.type===n.parenL||this.type===n.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait=e==="await");var c=this.parseMaybeConditional(e,t);if(i&&(c=i.call(this,c,u,h)),this.type.isAssign){var p=this.startNodeAt(u,h);return p.operator=this.value,this.type===n.eq&&(c=this.toAssignable(c,!1,t)),r||(t.parenthesizedAssign=t.trailingComma=t.doubleProto=-1),t.shorthandAssign>=c.start&&(t.shorthandAssign=-1),this.type===n.eq?this.checkLValPattern(c):this.checkLValSimple(c),p.left=c,this.next(),p.right=this.parseMaybeAssign(e),o>-1&&(t.doubleProto=o),this.finishNode(p,"AssignmentExpression")}else r&&this.checkExpressionErrors(t,!0);return s>-1&&(t.parenthesizedAssign=s),a>-1&&(t.trailingComma=a),c};b.parseMaybeConditional=function(e,t){var i=this.start,r=this.startLoc,s=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))return s;if(!(s.type==="ArrowFunctionExpression"&&s.start===i)&&this.eat(n.question)){var a=this.startNodeAt(i,r);return a.test=s,a.consequent=this.parseMaybeAssign(),this.expect(n.colon),a.alternate=this.parseMaybeAssign(e),this.finishNode(a,"ConditionalExpression")}return s};b.parseExprOps=function(e,t){var i=this.start,r=this.startLoc,s=this.parseMaybeUnary(t,!1,!1,e);return this.checkExpressionErrors(t)||s.start===i&&s.type==="ArrowFunctionExpression"?s:this.parseExprOp(s,i,r,-1,e)};b.parseExprOp=function(e,t,i,r,s){var a=this.type.binop;if(a!=null&&(!s||this.type!==n._in)&&a>r){var o=this.type===n.logicalOR||this.type===n.logicalAND,u=this.type===n.coalesce;u&&(a=n.logicalAND.binop);var h=this.value;this.next();var c=this.start,p=this.startLoc,l=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,s),c,p,a,s),x=this.buildBinary(t,i,e,l,h,o||u);return(o&&this.type===n.coalesce||u&&(this.type===n.logicalOR||this.type===n.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(x,t,i,r,s)}return e};b.buildBinary=function(e,t,i,r,s,a){r.type==="PrivateIdentifier"&&this.raise(r.start,"Private identifier can only be left side of binary expression");var o=this.startNodeAt(e,t);return o.left=i,o.operator=s,o.right=r,this.finishNode(o,a?"LogicalExpression":"BinaryExpression")};b.parseMaybeUnary=function(e,t,i,r){var s=this.start,a=this.startLoc,o;if(this.isContextual("await")&&this.canAwait)o=this.parseAwait(r),t=!0;else if(this.type.prefix){var u=this.startNode(),h=this.type===n.incDec;u.operator=this.value,u.prefix=!0,this.next(),u.argument=this.parseMaybeUnary(null,!0,h,r),this.checkExpressionErrors(e,!0),h?this.checkLValSimple(u.argument):this.strict&&u.operator==="delete"&&mi(u.argument)?this.raiseRecoverable(u.start,"Deleting local variable in strict mode"):u.operator==="delete"&&Et(u.argument)?this.raiseRecoverable(u.start,"Private fields can not be deleted"):t=!0,o=this.finishNode(u,h?"UpdateExpression":"UnaryExpression")}else if(!t&&this.type===n.privateId)(r||this.privateNameStack.length===0)&&this.options.checkPrivateFields&&this.unexpected(),o=this.parsePrivateIdent(),this.type!==n._in&&this.unexpected();else{if(o=this.parseExprSubscripts(e,r),this.checkExpressionErrors(e))return o;for(;this.type.postfix&&!this.canInsertSemicolon();){var c=this.startNodeAt(s,a);c.operator=this.value,c.prefix=!1,c.argument=o,this.checkLValSimple(o),this.next(),o=this.finishNode(c,"UpdateExpression")}}if(!i&&!(o.type==="ArrowFunctionExpression"&&o.start===s)&&this.eat(n.starstar))if(t)this.unexpected(this.lastTokStart);else return this.buildBinary(s,a,o,this.parseMaybeUnary(null,!1,!1,r),"**",!1);else return o};function mi(e){return e.type==="Identifier"||e.type==="ParenthesizedExpression"&&mi(e.expression)}function Et(e){return e.type==="MemberExpression"&&e.property.type==="PrivateIdentifier"||e.type==="ChainExpression"&&Et(e.expression)||e.type==="ParenthesizedExpression"&&Et(e.expression)}b.parseExprSubscripts=function(e,t){var i=this.start,r=this.startLoc,s=this.parseExprAtom(e,t);if(s.type==="ArrowFunctionExpression"&&this.input.slice(this.lastTokStart,this.lastTokEnd)!==")")return s;var a=this.parseSubscripts(s,i,r,!1,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};b.parseSubscripts=function(e,t,i,r,s){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=!1;;){var u=this.parseSubscript(e,t,i,r,a,o,s);if(u.optional&&(o=!0),u===e||u.type==="ArrowFunctionExpression"){if(o){var h=this.startNodeAt(t,i);h.expression=u,u=this.finishNode(h,"ChainExpression")}return u}e=u}};b.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(n.arrow)};b.parseSubscriptAsyncArrow=function(e,t,i,r){return this.parseArrowExpression(this.startNodeAt(e,t),i,!0,r)};b.parseSubscript=function(e,t,i,r,s,a,o){var u=this.options.ecmaVersion>=11,h=u&&this.eat(n.questionDot);r&&h&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var c=this.eat(n.bracketL);if(c||h&&this.type!==n.parenL&&this.type!==n.backQuote||this.eat(n.dot)){var p=this.startNodeAt(t,i);p.object=e,c?(p.property=this.parseExpression(),this.expect(n.bracketR)):this.type===n.privateId&&e.type!=="Super"?p.property=this.parsePrivateIdent():p.property=this.parseIdent(this.options.allowReserved!=="never"),p.computed=!!c,u&&(p.optional=h),e=this.finishNode(p,"MemberExpression")}else if(!r&&this.eat(n.parenL)){var l=new rt,x=this.yieldPos,E=this.awaitPos,f=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var w=this.parseExprList(n.parenR,this.options.ecmaVersion>=8,!1,l);if(s&&!h&&this.shouldParseAsyncArrow())return this.checkPatternErrors(l,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=x,this.awaitPos=E,this.awaitIdentPos=f,this.parseSubscriptAsyncArrow(t,i,w,o);this.checkExpressionErrors(l,!0),this.yieldPos=x||this.yieldPos,this.awaitPos=E||this.awaitPos,this.awaitIdentPos=f||this.awaitIdentPos;var g=this.startNodeAt(t,i);g.callee=e,g.arguments=w,u&&(g.optional=h),e=this.finishNode(g,"CallExpression")}else if(this.type===n.backQuote){(h||a)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var y=this.startNodeAt(t,i);y.tag=e,y.quasi=this.parseTemplate({isTagged:!0}),e=this.finishNode(y,"TaggedTemplateExpression")}return e};b.parseExprAtom=function(e,t,i){this.type===n.slash&&this.readRegexp();var r,s=this.potentialArrowAt===this.start;switch(this.type){case n._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),r=this.startNode(),this.next(),this.type===n.parenL&&!this.allowDirectSuper&&this.raise(r.start,"super() call outside constructor of a subclass"),this.type!==n.dot&&this.type!==n.bracketL&&this.type!==n.parenL&&this.unexpected(),this.finishNode(r,"Super");case n._this:return r=this.startNode(),this.next(),this.finishNode(r,"ThisExpression");case n.name:var a=this.start,o=this.startLoc,u=this.containsEsc,h=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!u&&h.name==="async"&&!this.canInsertSemicolon()&&this.eat(n._function))return this.overrideContext(V.f_expr),this.parseFunction(this.startNodeAt(a,o),0,!1,!0,t);if(s&&!this.canInsertSemicolon()){if(this.eat(n.arrow))return this.parseArrowExpression(this.startNodeAt(a,o),[h],!1,t);if(this.options.ecmaVersion>=8&&h.name==="async"&&this.type===n.name&&!u&&(!this.potentialArrowInForAwait||this.value!=="of"||this.containsEsc))return h=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(n.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(a,o),[h],!0,t)}return h;case n.regexp:var c=this.value;return r=this.parseLiteral(c.value),r.regex={pattern:c.pattern,flags:c.flags},r;case n.num:case n.string:return this.parseLiteral(this.value);case n._null:case n._true:case n._false:return r=this.startNode(),r.value=this.type===n._null?null:this.type===n._true,r.raw=this.type.keyword,this.next(),this.finishNode(r,"Literal");case n.parenL:var p=this.start,l=this.parseParenAndDistinguishExpression(s,t);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(l)&&(e.parenthesizedAssign=p),e.parenthesizedBind<0&&(e.parenthesizedBind=p)),l;case n.bracketL:return r=this.startNode(),this.next(),r.elements=this.parseExprList(n.bracketR,!0,!0,e),this.finishNode(r,"ArrayExpression");case n.braceL:return this.overrideContext(V.b_expr),this.parseObj(!1,e);case n._function:return r=this.startNode(),this.next(),this.parseFunction(r,0);case n._class:return this.parseClass(this.startNode(),!1);case n._new:return this.parseNew();case n.backQuote:return this.parseTemplate();case n._import:return this.options.ecmaVersion>=11?this.parseExprImport(i):this.unexpected();default:return this.parseExprAtomDefault()}};b.parseExprAtomDefault=function(){this.unexpected()};b.parseExprImport=function(e){var t=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===n.parenL&&!e)return this.parseDynamicImport(t);if(this.type===n.dot){var i=this.startNodeAt(t.start,t.loc&&t.loc.start);return i.name="import",t.meta=this.finishNode(i,"Identifier"),this.parseImportMeta(t)}else this.unexpected()};b.parseDynamicImport=function(e){if(this.next(),e.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(n.parenR)?e.options=null:(this.expect(n.comma),this.afterTrailingComma(n.parenR)?e.options=null:(e.options=this.parseMaybeAssign(),this.eat(n.parenR)||(this.expect(n.comma),this.afterTrailingComma(n.parenR)||this.unexpected())));else if(!this.eat(n.parenR)){var t=this.start;this.eat(n.comma)&&this.eat(n.parenR)?this.raiseRecoverable(t,"Trailing comma is not allowed in import()"):this.unexpected(t)}return this.finishNode(e,"ImportExpression")};b.parseImportMeta=function(e){this.next();var t=this.containsEsc;return e.property=this.parseIdent(!0),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")};b.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")};b.parseParenExpression=function(){this.expect(n.parenL);var e=this.parseExpression();return this.expect(n.parenR),e};b.shouldParseArrow=function(e){return!this.canInsertSemicolon()};b.parseParenAndDistinguishExpression=function(e,t){var i=this.start,r=this.startLoc,s,a=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var o=this.start,u=this.startLoc,h=[],c=!0,p=!1,l=new rt,x=this.yieldPos,E=this.awaitPos,f;for(this.yieldPos=0,this.awaitPos=0;this.type!==n.parenR;)if(c?c=!1:this.expect(n.comma),a&&this.afterTrailingComma(n.parenR,!0)){p=!0;break}else if(this.type===n.ellipsis){f=this.start,h.push(this.parseParenItem(this.parseRestBinding())),this.type===n.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}else h.push(this.parseMaybeAssign(!1,l,this.parseParenItem));var w=this.lastTokEnd,g=this.lastTokEndLoc;if(this.expect(n.parenR),e&&this.shouldParseArrow(h)&&this.eat(n.arrow))return this.checkPatternErrors(l,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=x,this.awaitPos=E,this.parseParenArrowList(i,r,h,t);(!h.length||p)&&this.unexpected(this.lastTokStart),f&&this.unexpected(f),this.checkExpressionErrors(l,!0),this.yieldPos=x||this.yieldPos,this.awaitPos=E||this.awaitPos,h.length>1?(s=this.startNodeAt(o,u),s.expressions=h,this.finishNodeAt(s,"SequenceExpression",w,g)):s=h[0]}else s=this.parseParenExpression();if(this.options.preserveParens){var y=this.startNodeAt(i,r);return y.expression=s,this.finishNode(y,"ParenthesizedExpression")}else return s};b.parseParenItem=function(e){return e};b.parseParenArrowList=function(e,t,i,r){return this.parseArrowExpression(this.startNodeAt(e,t),i,!1,r)};var wr=[];b.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===n.dot){var t=this.startNodeAt(e.start,e.loc&&e.loc.start);t.name="new",e.meta=this.finishNode(t,"Identifier"),this.next();var i=this.containsEsc;return e.property=this.parseIdent(!0),e.property.name!=="target"&&this.raiseRecoverable(e.property.start,"The only valid meta property for new is 'new.target'"),i&&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 r=this.start,s=this.startLoc;return e.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),r,s,!0,!1),e.callee.type==="Super"&&this.raiseRecoverable(r,"Invalid use of 'super'"),this.eat(n.parenL)?e.arguments=this.parseExprList(n.parenR,this.options.ecmaVersion>=8,!1):e.arguments=wr,this.finishNode(e,"NewExpression")};b.parseTemplateElement=function(e){var t=e.isTagged,i=this.startNode();return this.type===n.invalidTemplate?(t||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),i.value={raw:this.value.replace(/\r\n?/g,`
`),cooked:null}):i.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,`
`),cooked:this.value},this.next(),i.tail=this.type===n.backQuote,this.finishNode(i,"TemplateElement")};b.parseTemplate=function(e){e===void 0&&(e={});var t=e.isTagged;t===void 0&&(t=!1);var i=this.startNode();this.next(),i.expressions=[];var r=this.parseTemplateElement({isTagged:t});for(i.quasis=[r];!r.tail;)this.type===n.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(n.dollarBraceL),i.expressions.push(this.parseExpression()),this.expect(n.braceR),i.quasis.push(r=this.parseTemplateElement({isTagged:t}));return this.next(),this.finishNode(i,"TemplateLiteral")};b.isAsyncProp=function(e){return!e.computed&&e.key.type==="Identifier"&&e.key.name==="async"&&(this.type===n.name||this.type===n.num||this.type===n.string||this.type===n.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===n.star)&&!j.test(this.input.slice(this.lastTokEnd,this.start))};b.parseObj=function(e,t){var i=this.startNode(),r=!0,s={};for(i.properties=[],this.next();!this.eat(n.braceR);){if(r)r=!1;else if(this.expect(n.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(n.braceR))break;var a=this.parseProperty(e,t);e||this.checkPropClash(a,s,t),i.properties.push(a)}return this.finishNode(i,e?"ObjectPattern":"ObjectExpression")};b.parseProperty=function(e,t){var i=this.startNode(),r,s,a,o;if(this.options.ecmaVersion>=9&&this.eat(n.ellipsis))return e?(i.argument=this.parseIdent(!1),this.type===n.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.finishNode(i,"RestElement")):(i.argument=this.parseMaybeAssign(!1,t),this.type===n.comma&&t&&t.trailingComma<0&&(t.trailingComma=this.start),this.finishNode(i,"SpreadElement"));this.options.ecmaVersion>=6&&(i.method=!1,i.shorthand=!1,(e||t)&&(a=this.start,o=this.startLoc),e||(r=this.eat(n.star)));var u=this.containsEsc;return this.parsePropertyName(i),!e&&!u&&this.options.ecmaVersion>=8&&!r&&this.isAsyncProp(i)?(s=!0,r=this.options.ecmaVersion>=9&&this.eat(n.star),this.parsePropertyName(i)):s=!1,this.parsePropertyValue(i,e,r,s,a,o,t,u),this.finishNode(i,"Property")};b.parseGetterSetter=function(e){var t=e.key.name;this.parsePropertyName(e),e.value=this.parseMethod(!1),e.kind=t;var i=e.kind==="get"?0:1;if(e.value.params.length!==i){var r=e.value.start;e.kind==="get"?this.raiseRecoverable(r,"getter should have no params"):this.raiseRecoverable(r,"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")};b.parsePropertyValue=function(e,t,i,r,s,a,o,u){(i||r)&&this.type===n.colon&&this.unexpected(),this.eat(n.colon)?(e.value=t?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,o),e.kind="init"):this.options.ecmaVersion>=6&&this.type===n.parenL?(t&&this.unexpected(),e.method=!0,e.value=this.parseMethod(i,r),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!==n.comma&&this.type!==n.braceR&&this.type!==n.eq?((i||r)&&this.unexpected(),this.parseGetterSetter(e)):this.options.ecmaVersion>=6&&!e.computed&&e.key.type==="Identifier"?((i||r)&&this.unexpected(),this.checkUnreserved(e.key),e.key.name==="await"&&!this.awaitIdentPos&&(this.awaitIdentPos=s),t?e.value=this.parseMaybeDefault(s,a,this.copyNode(e.key)):this.type===n.eq&&o?(o.shorthandAssign<0&&(o.shorthandAssign=this.start),e.value=this.parseMaybeDefault(s,a,this.copyNode(e.key))):e.value=this.copyNode(e.key),e.kind="init",e.shorthand=!0):this.unexpected()};b.parsePropertyName=function(e){if(this.options.ecmaVersion>=6){if(this.eat(n.bracketL))return e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(n.bracketR),e.key;e.computed=!1}return e.key=this.type===n.num||this.type===n.string?this.parseExprAtom():this.parseIdent(this.options.allowReserved!=="never")};b.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=e.expression=!1),this.options.ecmaVersion>=8&&(e.async=!1)};b.parseMethod=function(e,t,i){var r=this.startNode(),s=this.yieldPos,a=this.awaitPos,o=this.awaitIdentPos;return this.initFunction(r),this.options.ecmaVersion>=6&&(r.generator=e),this.options.ecmaVersion>=8&&(r.async=!!t),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Nt(t,r.generator)|tt|(i?hi:0)),this.expect(n.parenL),r.params=this.parseBindingList(n.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(r,!1,!0,!1),this.yieldPos=s,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(r,"FunctionExpression")};b.parseArrowExpression=function(e,t,i,r){var s=this.yieldPos,a=this.awaitPos,o=this.awaitIdentPos;return this.enterScope(Nt(i,!1)|Pt),this.initFunction(e),this.options.ecmaVersion>=8&&(e.async=!!i),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,e.params=this.toAssignableList(t,!0),this.parseFunctionBody(e,!0,!1,r),this.yieldPos=s,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(e,"ArrowFunctionExpression")};b.parseFunctionBody=function(e,t,i,r){var s=t&&this.type!==n.braceL,a=this.strict,o=!1;if(s)e.body=this.parseMaybeAssign(r),e.expression=!0,this.checkParams(e,!1);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 h=this.labels;this.labels=[],o&&(this.strict=!0),this.checkParams(e,!a&&!o&&!t&&!i&&this.isSimpleParamList(e.params)),this.strict&&e.id&&this.checkLValSimple(e.id,fi),e.body=this.parseBlock(!1,void 0,o&&!a),e.expression=!1,this.adaptDirectivePrologue(e.body.body),this.labels=h}this.exitScope()};b.isSimpleParamList=function(e){for(var t=0,i=e;t<i.length;t+=1){var r=i[t];if(r.type!=="Identifier")return!1}return!0};b.checkParams=function(e,t){for(var i=Object.create(null),r=0,s=e.params;r<s.length;r+=1){var a=s[r];this.checkLValInnerPattern(a,Vt,t?null:i)}};b.parseExprList=function(e,t,i,r){for(var s=[],a=!0;!this.eat(e);){if(a)a=!1;else if(this.expect(n.comma),t&&this.afterTrailingComma(e))break;var o=void 0;i&&this.type===n.comma?o=null:this.type===n.ellipsis?(o=this.parseSpread(r),r&&this.type===n.comma&&r.trailingComma<0&&(r.trailingComma=this.start)):o=this.parseMaybeAssign(!1,r),s.push(o)}return s};b.checkUnreserved=function(e){var t=e.start,i=e.end,r=e.name;if(this.inGenerator&&r==="yield"&&this.raiseRecoverable(t,"Cannot use 'yield' as identifier inside a generator"),this.inAsync&&r==="await"&&this.raiseRecoverable(t,"Cannot use 'await' as identifier inside an async function"),!(this.currentThisScope().flags&it)&&r==="arguments"&&this.raiseRecoverable(t,"Cannot use 'arguments' in class field initializer"),this.inClassStaticBlock&&(r==="arguments"||r==="await")&&this.raise(t,"Cannot use "+r+" in class static initialization block"),this.keywords.test(r)&&this.raise(t,"Unexpected keyword '"+r+"'"),!(this.options.ecmaVersion<6&&this.input.slice(t,i).indexOf("\\")!==-1)){var s=this.strict?this.reservedWordsStrict:this.reservedWords;s.test(r)&&(!this.inAsync&&r==="await"&&this.raiseRecoverable(t,"Cannot use keyword 'await' outside an async function"),this.raiseRecoverable(t,"The keyword '"+r+"' is reserved"))}};b.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};b.parseIdentNode=function(){var e=this.startNode();return this.type===n.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=n.name):this.unexpected(),e};b.parsePrivateIdent=function(){var e=this.startNode();return this.type===n.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};b.parseYield=function(e){this.yieldPos||(this.yieldPos=this.start);var t=this.startNode();return this.next(),this.type===n.semi||this.canInsertSemicolon()||this.type!==n.star&&!this.type.startsExpr?(t.delegate=!1,t.argument=null):(t.delegate=this.eat(n.star),t.argument=this.parseMaybeAssign(e)),this.finishNode(t,"YieldExpression")};b.parseAwait=function(e){this.awaitPos||(this.awaitPos=this.start);var t=this.startNode();return this.next(),t.argument=this.parseMaybeUnary(null,!0,!1,e),this.finishNode(t,"AwaitExpression")};var Qe=M.prototype;Qe.raise=function(e,t){var i=ni(this.input,e);t+=" ("+i.line+":"+i.column+")",this.sourceFile&&(t+=" in "+this.sourceFile);var r=new SyntaxError(t);throw r.pos=e,r.loc=i,r.raisedAt=this.pos,r};Qe.raiseRecoverable=Qe.raise;Qe.curPosition=function(){if(this.options.locations)return new Be(this.curLine,this.pos-this.lineStart)};var me=M.prototype,kr=function(t){this.flags=t,this.var=[],this.lexical=[],this.functions=[]};me.enterScope=function(e){this.scopeStack.push(new kr(e))};me.exitScope=function(){this.scopeStack.pop()};me.treatFunctionsAsVarInScope=function(e){return e.flags&be||!this.inModule&&e.flags&ve};me.declareName=function(e,t,i){var r=!1;if(t===he){var s=this.currentScope();r=s.lexical.indexOf(e)>-1||s.functions.indexOf(e)>-1||s.var.indexOf(e)>-1,s.lexical.push(e),this.inModule&&s.flags&ve&&delete this.undefinedExports[e]}else if(t===pi){var a=this.currentScope();a.lexical.push(e)}else if(t===li){var o=this.currentScope();this.treatFunctionsAsVar?r=o.lexical.indexOf(e)>-1:r=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 h=this.scopeStack[u];if(h.lexical.indexOf(e)>-1&&!(h.flags&ui&&h.lexical[0]===e)||!this.treatFunctionsAsVarInScope(h)&&h.functions.indexOf(e)>-1){r=!0;break}if(h.var.push(e),this.inModule&&h.flags&ve&&delete this.undefinedExports[e],h.flags&it)break}r&&this.raiseRecoverable(i,"Identifier '"+e+"' has already been declared")};me.checkLocalExport=function(e){this.scopeStack[0].lexical.indexOf(e.name)===-1&&this.scopeStack[0].var.indexOf(e.name)===-1&&(this.undefinedExports[e.name]=e)};me.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]};me.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&(it|De|ye))return t}};me.currentThisScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&(it|De|ye)&&!(t.flags&Pt))return t}};var st=function(t,i,r){this.type="",this.start=i,this.end=0,t.options.locations&&(this.loc=new et(t,r)),t.options.directSourceFile&&(this.sourceFile=t.options.directSourceFile),t.options.ranges&&(this.range=[i,0])},Ue=M.prototype;Ue.startNode=function(){return new st(this,this.start,this.startLoc)};Ue.startNodeAt=function(e,t){return new st(this,e,t)};function xi(e,t,i,r){return e.type=t,e.end=i,this.options.locations&&(e.loc.end=r),this.options.ranges&&(e.range[1]=i),e}Ue.finishNode=function(e,t){return xi.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)};Ue.finishNodeAt=function(e,t,i,r){return xi.call(this,e,t,i,r)};Ue.copyNode=function(e){var t=new st(this,e.start,this.startLoc);for(var i in e)t[i]=e[i];return t};var Sr="Berf Beria_Erfe Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sidetic Sidt Sunu Sunuwar Tai_Yo Tayo Todhri Todr Tolong_Siki Tols Tulu_Tigalari Tutg Unknown Zzzz",gi="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",vi=gi+" Extended_Pictographic",bi=vi,yi=bi+" EBase EComp EMod EPres ExtPict",wi=yi,Cr=wi,_r={9:gi,10:vi,11:bi,12:yi,13:wi,14:Cr},Er="Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji",Ar={9:"",10:"",11:"",12:"",13:"",14:Er},Gt="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",ki="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",Si=ki+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",Ci=Si+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",_i=Ci+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",Ei=_i+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",Ir=Ei+" "+Sr,Pr={9:ki,10:Si,11:Ci,12:_i,13:Ei,14:Ir},Ai={};function Nr(e){var t=Ai[e]={binary:le(_r[e]+" "+Gt),binaryOfStrings:le(Ar[e]),nonBinary:{General_Category:le(Gt),Script:le(Pr[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 vt=0,Wt=[9,10,11,12,13,14];vt<Wt.length;vt+=1){var Vr=Wt[vt];Nr(Vr)}var d=M.prototype,$e=function(t,i){this.parent=t,this.base=i||this};$e.prototype.separatedFrom=function(t){for(var i=this;i;i=i.parent)for(var r=t;r;r=r.parent)if(i.base===r.base&&i!==r)return!0;return!1};$e.prototype.sibling=function(){return new $e(this.parent,this.base)};var se=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=Ai[t.options.ecmaVersion>=14?14:t.options.ecmaVersion],this.source="",this.flags="",this.start=0,this.switchU=!1,this.switchV=!1,this.switchN=!1,this.pos=0,this.lastIntValue=0,this.lastStringValue="",this.lastAssertionIsQuantifiable=!1,this.numCapturingParens=0,this.maxBackReference=0,this.groupNames=Object.create(null),this.backReferenceNames=[],this.branchID=null};se.prototype.reset=function(t,i,r){var s=r.indexOf("v")!==-1,a=r.indexOf("u")!==-1;this.start=t|0,this.source=i+"",this.flags=r,s&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=a&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=a&&this.parser.options.ecmaVersion>=9)};se.prototype.raise=function(t){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+t)};se.prototype.at=function(t,i){i===void 0&&(i=!1);var r=this.source,s=r.length;if(t>=s)return-1;var a=r.charCodeAt(t);if(!(i||this.switchU)||a<=55295||a>=57344||t+1>=s)return a;var o=r.charCodeAt(t+1);return o>=56320&&o<=57343?(a<<10)+o-56613888:a};se.prototype.nextIndex=function(t,i){i===void 0&&(i=!1);var r=this.source,s=r.length;if(t>=s)return s;var a=r.charCodeAt(t),o;return!(i||this.switchU)||a<=55295||a>=57344||t+1>=s||(o=r.charCodeAt(t+1))<56320||o>57343?t+1:t+2};se.prototype.current=function(t){return t===void 0&&(t=!1),this.at(this.pos,t)};se.prototype.lookahead=function(t){return t===void 0&&(t=!1),this.at(this.nextIndex(this.pos,t),t)};se.prototype.advance=function(t){t===void 0&&(t=!1),this.pos=this.nextIndex(this.pos,t)};se.prototype.eat=function(t,i){return i===void 0&&(i=!1),this.current(i)===t?(this.advance(i),!0):!1};se.prototype.eatChars=function(t,i){i===void 0&&(i=!1);for(var r=this.pos,s=0,a=t;s<a.length;s+=1){var o=a[s],u=this.at(r,i);if(u===-1||u!==o)return!1;r=this.nextIndex(r,i)}return this.pos=r,!0};d.validateRegExpFlags=function(e){for(var t=e.validFlags,i=e.flags,r=!1,s=!1,a=0;a<i.length;a++){var o=i.charAt(a);t.indexOf(o)===-1&&this.raise(e.start,"Invalid regular expression flag"),i.indexOf(o,a+1)>-1&&this.raise(e.start,"Duplicate regular expression flag"),o==="u"&&(r=!0),o==="v"&&(s=!0)}this.options.ecmaVersion>=15&&r&&s&&this.raise(e.start,"Invalid regular expression flag")};function Tr(e){for(var t in e)return!0;return!1}d.validateRegExpPattern=function(e){this.regexp_pattern(e),!e.switchN&&this.options.ecmaVersion>=9&&Tr(e.groupNames)&&(e.switchN=!0,this.regexp_pattern(e))};d.regexp_pattern=function(e){e.pos=0,e.lastIntValue=0,e.lastStringValue="",e.lastAssertionIsQuantifiable=!1,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,i=e.backReferenceNames;t<i.length;t+=1){var r=i[t];e.groupNames[r]||e.raise("Invalid named capture referenced")}};d.regexp_disjunction=function(e){var t=this.options.ecmaVersion>=16;for(t&&(e.branchID=new $e(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,!0)&&e.raise("Nothing to repeat"),e.eat(123)&&e.raise("Lone quantifier brackets")};d.regexp_alternative=function(e){for(;e.pos<e.source.length&&this.regexp_eatTerm(e););};d.regexp_eatTerm=function(e){return this.regexp_eatAssertion(e)?(e.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(e)&&e.switchU&&e.raise("Invalid quantifier"),!0):(e.switchU?this.regexp_eatAtom(e):this.regexp_eatExtendedAtom(e))?(this.regexp_eatQuantifier(e),!0):!1};d.regexp_eatAssertion=function(e){var t=e.pos;if(e.lastAssertionIsQuantifiable=!1,e.eat(94)||e.eat(36))return!0;if(e.eat(92)){if(e.eat(66)||e.eat(98))return!0;e.pos=t}if(e.eat(40)&&e.eat(63)){var i=!1;if(this.options.ecmaVersion>=9&&(i=e.eat(60)),e.eat(61)||e.eat(33))return this.regexp_disjunction(e),e.eat(41)||e.raise("Unterminated group"),e.lastAssertionIsQuantifiable=!i,!0}return e.pos=t,!1};d.regexp_eatQuantifier=function(e,t){return t===void 0&&(t=!1),this.regexp_eatQuantifierPrefix(e,t)?(e.eat(63),!0):!1};d.regexp_eatQuantifierPrefix=function(e,t){return e.eat(42)||e.eat(43)||e.eat(63)||this.regexp_eatBracedQuantifier(e,t)};d.regexp_eatBracedQuantifier=function(e,t){var i=e.pos;if(e.eat(123)){var r=0,s=-1;if(this.regexp_eatDecimalDigits(e)&&(r=e.lastIntValue,e.eat(44)&&this.regexp_eatDecimalDigits(e)&&(s=e.lastIntValue),e.eat(125)))return s!==-1&&s<r&&!t&&e.raise("numbers out of order in {} quantifier"),!0;e.switchU&&!t&&e.raise("Incomplete quantifier"),e.pos=i}return!1};d.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)};d.regexp_eatReverseSolidusAtomEscape=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatAtomEscape(e))return!0;e.pos=t}return!1};d.regexp_eatUncapturingGroup=function(e){var t=e.pos;if(e.eat(40)){if(e.eat(63)){if(this.options.ecmaVersion>=16){var i=this.regexp_eatModifiers(e),r=e.eat(45);if(i||r){for(var s=0;s<i.length;s++){var a=i.charAt(s);i.indexOf(a,s+1)>-1&&e.raise("Duplicate regular expression modifiers")}if(r){var o=this.regexp_eatModifiers(e);!i&&!o&&e.current()===58&&e.raise("Invalid regular expression modifiers");for(var u=0;u<o.length;u++){var h=o.charAt(u);(o.indexOf(h,u+1)>-1||i.indexOf(h)>-1)&&e.raise("Duplicate regular expression modifiers")}}}}if(e.eat(58)){if(this.regexp_disjunction(e),e.eat(41))return!0;e.raise("Unterminated group")}}e.pos=t}return!1};d.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,!0;e.raise("Unterminated group")}return!1};d.regexp_eatModifiers=function(e){for(var t="",i=0;(i=e.current())!==-1&&Lr(i);)t+=oe(i),e.advance();return t};function Lr(e){return e===105||e===109||e===115}d.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)};d.regexp_eatInvalidBracedQuantifier=function(e){return this.regexp_eatBracedQuantifier(e,!0)&&e.raise("Nothing to repeat"),!1};d.regexp_eatSyntaxCharacter=function(e){var t=e.current();return Ii(t)?(e.lastIntValue=t,e.advance(),!0):!1};function Ii(e){return e===36||e>=40&&e<=43||e===46||e===63||e>=91&&e<=94||e>=123&&e<=125}d.regexp_eatPatternCharacters=function(e){for(var t=e.pos,i=0;(i=e.current())!==-1&&!Ii(i);)e.advance();return e.pos!==t};d.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(),!0):!1};d.regexp_groupSpecifier=function(e){if(e.eat(63)){this.regexp_eatGroupName(e)||e.raise("Invalid group");var t=this.options.ecmaVersion>=16,i=e.groupNames[e.lastStringValue];if(i)if(t)for(var r=0,s=i;r<s.length;r+=1){var a=s[r];a.separatedFrom(e.branchID)||e.raise("Duplicate capture group name")}else e.raise("Duplicate capture group name");t?(i||(e.groupNames[e.lastStringValue]=[])).push(e.branchID):e.groupNames[e.lastStringValue]=!0}};d.regexp_eatGroupName=function(e){if(e.lastStringValue="",e.eat(60)){if(this.regexp_eatRegExpIdentifierName(e)&&e.eat(62))return!0;e.raise("Invalid capture group name")}return!1};d.regexp_eatRegExpIdentifierName=function(e){if(e.lastStringValue="",this.regexp_eatRegExpIdentifierStart(e)){for(e.lastStringValue+=oe(e.lastIntValue);this.regexp_eatRegExpIdentifierPart(e);)e.lastStringValue+=oe(e.lastIntValue);return!0}return!1};d.regexp_eatRegExpIdentifierStart=function(e){var t=e.pos,i=this.options.ecmaVersion>=11,r=e.current(i);return e.advance(i),r===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,i)&&(r=e.lastIntValue),Rr(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)};function Rr(e){return re(e,!0)||e===36||e===95}d.regexp_eatRegExpIdentifierPart=function(e){var t=e.pos,i=this.options.ecmaVersion>=11,r=e.current(i);return e.advance(i),r===92&&this.regexp_eatRegExpUnicodeEscapeSequence(e,i)&&(r=e.lastIntValue),Mr(r)?(e.lastIntValue=r,!0):(e.pos=t,!1)};function Mr(e){return de(e,!0)||e===36||e===95||e===8204||e===8205}d.regexp_eatAtomEscape=function(e){return this.regexp_eatBackReference(e)||this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)||e.switchN&&this.regexp_eatKGroupName(e)?!0:(e.switchU&&(e.current()===99&&e.raise("Invalid unicode escape"),e.raise("Invalid escape")),!1)};d.regexp_eatBackReference=function(e){var t=e.pos;if(this.regexp_eatDecimalEscape(e)){var i=e.lastIntValue;if(e.switchU)return i>e.maxBackReference&&(e.maxBackReference=i),!0;if(i<=e.numCapturingParens)return!0;e.pos=t}return!1};d.regexp_eatKGroupName=function(e){if(e.eat(107)){if(this.regexp_eatGroupName(e))return e.backReferenceNames.push(e.lastStringValue),!0;e.raise("Invalid named reference")}return!1};d.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,!1)||!e.switchU&&this.regexp_eatLegacyOctalEscapeSequence(e)||this.regexp_eatIdentityEscape(e)};d.regexp_eatCControlLetter=function(e){var t=e.pos;if(e.eat(99)){if(this.regexp_eatControlLetter(e))return!0;e.pos=t}return!1};d.regexp_eatZero=function(e){return e.current()===48&&!at(e.lookahead())?(e.lastIntValue=0,e.advance(),!0):!1};d.regexp_eatControlEscape=function(e){var t=e.current();return t===116?(e.lastIntValue=9,e.advance(),!0):t===110?(e.lastIntValue=10,e.advance(),!0):t===118?(e.lastIntValue=11,e.advance(),!0):t===102?(e.lastIntValue=12,e.advance(),!0):t===114?(e.lastIntValue=13,e.advance(),!0):!1};d.regexp_eatControlLetter=function(e){var t=e.current();return Pi(t)?(e.lastIntValue=t%32,e.advance(),!0):!1};function Pi(e){return e>=65&&e<=90||e>=97&&e<=122}d.regexp_eatRegExpUnicodeEscapeSequence=function(e,t){t===void 0&&(t=!1);var i=e.pos,r=t||e.switchU;if(e.eat(117)){if(this.regexp_eatFixedHexDigits(e,4)){var s=e.lastIntValue;if(r&&s>=55296&&s<=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=(s-55296)*1024+(o-56320)+65536,!0}e.pos=a,e.lastIntValue=s}return!0}if(r&&e.eat(123)&&this.regexp_eatHexDigits(e)&&e.eat(125)&&Br(e.lastIntValue))return!0;r&&e.raise("Invalid unicode escape"),e.pos=i}return!1};function Br(e){return e>=0&&e<=1114111}d.regexp_eatIdentityEscape=function(e){if(e.switchU)return this.regexp_eatSyntaxCharacter(e)?!0:e.eat(47)?(e.lastIntValue=47,!0):!1;var t=e.current();return t!==99&&(!e.switchN||t!==107)?(e.lastIntValue=t,e.advance(),!0):!1};d.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!0}return!1};var Ni=0,ue=1,z=2;d.regexp_eatCharacterClassEscape=function(e){var t=e.current();if(Or(t))return e.lastIntValue=-1,e.advance(),ue;var i=!1;if(e.switchU&&this.options.ecmaVersion>=9&&((i=t===80)||t===112)){e.lastIntValue=-1,e.advance();var r;if(e.eat(123)&&(r=this.regexp_eatUnicodePropertyValueExpression(e))&&e.eat(125))return i&&r===z&&e.raise("Invalid property name"),r;e.raise("Invalid property name")}return Ni};function Or(e){return e===100||e===68||e===115||e===83||e===119||e===87}d.regexp_eatUnicodePropertyValueExpression=function(e){var t=e.pos;if(this.regexp_eatUnicodePropertyName(e)&&e.eat(61)){var i=e.lastStringValue;if(this.regexp_eatUnicodePropertyValue(e)){var r=e.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(e,i,r),ue}}if(e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)){var s=e.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(e,s)}return Ni};d.regexp_validateUnicodePropertyNameAndValue=function(e,t,i){Ie(e.unicodeProperties.nonBinary,t)||e.raise("Invalid property name"),e.unicodeProperties.nonBinary[t].test(i)||e.raise("Invalid property value")};d.regexp_validateUnicodePropertyNameOrValue=function(e,t){if(e.unicodeProperties.binary.test(t))return ue;if(e.switchV&&e.unicodeProperties.binaryOfStrings.test(t))return z;e.raise("Invalid property name")};d.regexp_eatUnicodePropertyName=function(e){var t=0;for(e.lastStringValue="";Vi(t=e.current());)e.lastStringValue+=oe(t),e.advance();return e.lastStringValue!==""};function Vi(e){return Pi(e)||e===95}d.regexp_eatUnicodePropertyValue=function(e){var t=0;for(e.lastStringValue="";Fr(t=e.current());)e.lastStringValue+=oe(t),e.advance();return e.lastStringValue!==""};function Fr(e){return Vi(e)||at(e)}d.regexp_eatLoneUnicodePropertyNameOrValue=function(e){return this.regexp_eatUnicodePropertyValue(e)};d.regexp_eatCharacterClass=function(e){if(e.eat(91)){var t=e.eat(94),i=this.regexp_classContents(e);return e.eat(93)||e.raise("Unterminated character class"),t&&i===z&&e.raise("Negated character class may contain strings"),!0}return!1};d.regexp_classContents=function(e){return e.current()===93?ue:e.switchV?this.regexp_classSetExpression(e):(this.regexp_nonEmptyClassRanges(e),ue)};d.regexp_nonEmptyClassRanges=function(e){for(;this.regexp_eatClassAtom(e);){var t=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassAtom(e)){var i=e.lastIntValue;e.switchU&&(t===-1||i===-1)&&e.raise("Invalid character class"),t!==-1&&i!==-1&&t>i&&e.raise("Range out of order in character class")}}};d.regexp_eatClassAtom=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatClassEscape(e))return!0;if(e.switchU){var i=e.current();(i===99||Ri(i))&&e.raise("Invalid class escape"),e.raise("Invalid escape")}e.pos=t}var r=e.current();return r!==93?(e.lastIntValue=r,e.advance(),!0):!1};d.regexp_eatClassEscape=function(e){var t=e.pos;if(e.eat(98))return e.lastIntValue=8,!0;if(e.switchU&&e.eat(45))return e.lastIntValue=45,!0;if(!e.switchU&&e.eat(99)){if(this.regexp_eatClassControlLetter(e))return!0;e.pos=t}return this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)};d.regexp_classSetExpression=function(e){var t=ue,i;if(!this.regexp_eatClassSetRange(e))if(i=this.regexp_eatClassSetOperand(e)){i===z&&(t=z);for(var r=e.pos;e.eatChars([38,38]);){if(e.current()!==38&&(i=this.regexp_eatClassSetOperand(e))){i!==z&&(t=ue);continue}e.raise("Invalid character in character class")}if(r!==e.pos)return t;for(;e.eatChars([45,45]);)this.regexp_eatClassSetOperand(e)||e.raise("Invalid character in character class");if(r!==e.pos)return t}else e.raise("Invalid character in character class");for(;;)if(!this.regexp_eatClassSetRange(e)){if(i=this.regexp_eatClassSetOperand(e),!i)return t;i===z&&(t=z)}};d.regexp_eatClassSetRange=function(e){var t=e.pos;if(this.regexp_eatClassSetCharacter(e)){var i=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassSetCharacter(e)){var r=e.lastIntValue;return i!==-1&&r!==-1&&i>r&&e.raise("Range out of order in character class"),!0}e.pos=t}return!1};d.regexp_eatClassSetOperand=function(e){return this.regexp_eatClassSetCharacter(e)?ue:this.regexp_eatClassStringDisjunction(e)||this.regexp_eatNestedClass(e)};d.regexp_eatNestedClass=function(e){var t=e.pos;if(e.eat(91)){var i=e.eat(94),r=this.regexp_classContents(e);if(e.eat(93))return i&&r===z&&e.raise("Negated character class may contain strings"),r;e.pos=t}if(e.eat(92)){var s=this.regexp_eatCharacterClassEscape(e);if(s)return s;e.pos=t}return null};d.regexp_eatClassStringDisjunction=function(e){var t=e.pos;if(e.eatChars([92,113])){if(e.eat(123)){var i=this.regexp_classStringDisjunctionContents(e);if(e.eat(125))return i}else e.raise("Invalid escape");e.pos=t}return null};d.regexp_classStringDisjunctionContents=function(e){for(var t=this.regexp_classString(e);e.eat(124);)this.regexp_classString(e)===z&&(t=z);return t};d.regexp_classString=function(e){for(var t=0;this.regexp_eatClassSetCharacter(e);)t++;return t===1?ue:z};d.regexp_eatClassSetCharacter=function(e){var t=e.pos;if(e.eat(92))return this.regexp_eatCharacterEscape(e)||this.regexp_eatClassSetReservedPunctuator(e)?!0:e.eat(98)?(e.lastIntValue=8,!0):(e.pos=t,!1);var i=e.current();return i<0||i===e.lookahead()&&Dr(i)||Ur(i)?!1:(e.advance(),e.lastIntValue=i,!0)};function Dr(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 Ur(e){return e===40||e===41||e===45||e===47||e>=91&&e<=93||e>=123&&e<=125}d.regexp_eatClassSetReservedPunctuator=function(e){var t=e.current();return jr(t)?(e.lastIntValue=t,e.advance(),!0):!1};function jr(e){return e===33||e===35||e===37||e===38||e===44||e===45||e>=58&&e<=62||e===64||e===96||e===126}d.regexp_eatClassControlLetter=function(e){var t=e.current();return at(t)||t===95?(e.lastIntValue=t%32,e.advance(),!0):!1};d.regexp_eatHexEscapeSequence=function(e){var t=e.pos;if(e.eat(120)){if(this.regexp_eatFixedHexDigits(e,2))return!0;e.switchU&&e.raise("Invalid escape"),e.pos=t}return!1};d.regexp_eatDecimalDigits=function(e){var t=e.pos,i=0;for(e.lastIntValue=0;at(i=e.current());)e.lastIntValue=10*e.lastIntValue+(i-48),e.advance();return e.pos!==t};function at(e){return e>=48&&e<=57}d.regexp_eatHexDigits=function(e){var t=e.pos,i=0;for(e.lastIntValue=0;Ti(i=e.current());)e.lastIntValue=16*e.lastIntValue+Li(i),e.advance();return e.pos!==t};function Ti(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function Li(e){return e>=65&&e<=70?10+(e-65):e>=97&&e<=102?10+(e-97):e-48}d.regexp_eatLegacyOctalEscapeSequence=function(e){if(this.regexp_eatOctalDigit(e)){var t=e.lastIntValue;if(this.regexp_eatOctalDigit(e)){var i=e.lastIntValue;t<=3&&this.regexp_eatOctalDigit(e)?e.lastIntValue=t*64+i*8+e.lastIntValue:e.lastIntValue=t*8+i}else e.lastIntValue=t;return!0}return!1};d.regexp_eatOctalDigit=function(e){var t=e.current();return Ri(t)?(e.lastIntValue=t-48,e.advance(),!0):(e.lastIntValue=0,!1)};function Ri(e){return e>=48&&e<=55}d.regexp_eatFixedHexDigits=function(e,t){var i=e.pos;e.lastIntValue=0;for(var r=0;r<t;++r){var s=e.current();if(!Ti(s))return e.pos=i,!1;e.lastIntValue=16*e.lastIntValue+Li(s),e.advance()}return!0};var Lt=function(t){this.type=t.type,this.value=t.value,this.start=t.start,this.end=t.end,t.options.locations&&(this.loc=new et(t,t.startLoc,t.endLoc)),t.options.ranges&&(this.range=[t.start,t.end])},k=M.prototype;k.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 Lt(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()};k.getToken=function(){return this.next(),new Lt(this)};typeof Symbol<"u"&&(k[Symbol.iterator]=function(){var e=this;return{next:function(){var t=e.getToken();return{done:t.type===n.eof,value:t}}}});k.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(n.eof);if(e.override)return e.override(this);this.readToken(this.fullCharCodeAtPos())};k.readToken=function(e){return re(e,this.options.ecmaVersion>=6)||e===92?this.readWord():this.getTokenFromCode(e)};k.fullCharCodeAt=function(e){var t=this.input.charCodeAt(e);if(t<=55295||t>=56320)return t;var i=this.input.charCodeAt(e+1);return i<=56319||i>=57344?t:(t<<10)+i-56613888};k.fullCharCodeAtPos=function(){return this.fullCharCodeAt(this.pos)};k.skipBlockComment=function(){var e=this.options.onComment&&this.curPosition(),t=this.pos,i=this.input.indexOf("*/",this.pos+=2);if(i===-1&&this.raise(this.pos-2,"Unterminated comment"),this.pos=i+2,this.options.locations)for(var r=void 0,s=t;(r=ri(this.input,s,this.pos))>-1;)++this.curLine,s=this.lineStart=r;this.options.onComment&&this.options.onComment(!0,this.input.slice(t+2,i),t,this.pos,e,this.curPosition())};k.skipLineComment=function(e){for(var t=this.pos,i=this.options.onComment&&this.curPosition(),r=this.input.charCodeAt(this.pos+=e);this.pos<this.input.length&&!Ae(r);)r=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(t+e,this.pos),t,this.pos,i,this.curPosition())};k.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&&si.test(String.fromCharCode(e)))++this.pos;else break e}}};k.finishToken=function(e,t){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var i=this.type;this.type=e,this.value=t,this.updateContext(i)};k.readToken_dot=function(){var e=this.input.charCodeAt(this.pos+1);if(e>=48&&e<=57)return this.readNumber(!0);var t=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&e===46&&t===46?(this.pos+=3,this.finishToken(n.ellipsis)):(++this.pos,this.finishToken(n.dot))};k.readToken_slash=function(){var e=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):e===61?this.finishOp(n.assign,2):this.finishOp(n.slash,1)};k.readToken_mult_modulo_exp=function(e){var t=this.input.charCodeAt(this.pos+1),i=1,r=e===42?n.star:n.modulo;return this.options.ecmaVersion>=7&&e===42&&t===42&&(++i,r=n.starstar,t=this.input.charCodeAt(this.pos+2)),t===61?this.finishOp(n.assign,i+1):this.finishOp(r,i)};k.readToken_pipe_amp=function(e){var t=this.input.charCodeAt(this.pos+1);if(t===e){if(this.options.ecmaVersion>=12){var i=this.input.charCodeAt(this.pos+2);if(i===61)return this.finishOp(n.assign,3)}return this.finishOp(e===124?n.logicalOR:n.logicalAND,2)}return t===61?this.finishOp(n.assign,2):this.finishOp(e===124?n.bitwiseOR:n.bitwiseAND,1)};k.readToken_caret=function(){var e=this.input.charCodeAt(this.pos+1);return e===61?this.finishOp(n.assign,2):this.finishOp(n.bitwiseXOR,1)};k.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||j.test(this.input.slice(this.lastTokEnd,this.pos)))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(n.incDec,2):t===61?this.finishOp(n.assign,2):this.finishOp(n.plusMin,1)};k.readToken_lt_gt=function(e){var t=this.input.charCodeAt(this.pos+1),i=1;return t===e?(i=e===62&&this.input.charCodeAt(this.pos+2)===62?3:2,this.input.charCodeAt(this.pos+i)===61?this.finishOp(n.assign,i+1):this.finishOp(n.bitShift,i)):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&&(i=2),this.finishOp(n.relational,i))};k.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.pos+1);return t===61?this.finishOp(n.equality,this.input.charCodeAt(this.pos+2)===61?3:2):e===61&&t===62&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(n.arrow)):this.finishOp(e===61?n.eq:n.prefix,1)};k.readToken_question=function(){var e=this.options.ecmaVersion;if(e>=11){var t=this.input.charCodeAt(this.pos+1);if(t===46){var i=this.input.charCodeAt(this.pos+2);if(i<48||i>57)return this.finishOp(n.questionDot,2)}if(t===63){if(e>=12){var r=this.input.charCodeAt(this.pos+2);if(r===61)return this.finishOp(n.assign,3)}return this.finishOp(n.coalesce,2)}}return this.finishOp(n.question,1)};k.readToken_numberSign=function(){var e=this.options.ecmaVersion,t=35;if(e>=13&&(++this.pos,t=this.fullCharCodeAtPos(),re(t,!0)||t===92))return this.finishToken(n.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+oe(t)+"'")};k.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(n.parenL);case 41:return++this.pos,this.finishToken(n.parenR);case 59:return++this.pos,this.finishToken(n.semi);case 44:return++this.pos,this.finishToken(n.comma);case 91:return++this.pos,this.finishToken(n.bracketL);case 93:return++this.pos,this.finishToken(n.bracketR);case 123:return++this.pos,this.finishToken(n.braceL);case 125:return++this.pos,this.finishToken(n.braceR);case 58:return++this.pos,this.finishToken(n.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(n.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(!1);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(n.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+oe(e)+"'")};k.finishOp=function(e,t){var i=this.input.slice(this.pos,this.pos+t);return this.pos+=t,this.finishToken(e,i)};k.readRegexp=function(){for(var e,t,i=this.pos;;){this.pos>=this.input.length&&this.raise(i,"Unterminated regular expression");var r=this.input.charAt(this.pos);if(j.test(r)&&this.raise(i,"Unterminated regular expression"),e)e=!1;else{if(r==="[")t=!0;else if(r==="]"&&t)t=!1;else if(r==="/"&&!t)break;e=r==="\\"}++this.pos}var s=this.input.slice(i,this.pos);++this.pos;var a=this.pos,o=this.readWord1();this.containsEsc&&this.unexpected(a);var u=this.regexpState||(this.regexpState=new se(this));u.reset(i,s,o),this.validateRegExpFlags(u),this.validateRegExpPattern(u);var h=null;try{h=new RegExp(s,o)}catch{}return this.finishToken(n.regexp,{pattern:s,flags:o,value:h})};k.readInt=function(e,t,i){for(var r=this.options.ecmaVersion>=12&&t===void 0,s=i&&this.input.charCodeAt(this.pos)===48,a=this.pos,o=0,u=0,h=0,c=t??1/0;h<c;++h,++this.pos){var p=this.input.charCodeAt(this.pos),l=void 0;if(r&&p===95){s&&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"),h===0&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits"),u=p;continue}if(p>=97?l=p-97+10:p>=65?l=p-65+10:p>=48&&p<=57?l=p-48:l=1/0,l>=e)break;u=p,o=o*e+l}return r&&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 qr(e,t){return t?parseInt(e,8):parseFloat(e.replace(/_/g,""))}function Mi(e){return typeof BigInt!="function"?null:BigInt(e.replace(/_/g,""))}k.readRadixNumber=function(e){var t=this.pos;this.pos+=2;var i=this.readInt(e);return i==null&&this.raise(this.start+2,"Expected number in radix "+e),this.options.ecmaVersion>=11&&this.input.charCodeAt(this.pos)===110?(i=Mi(this.input.slice(t,this.pos)),++this.pos):re(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(n.num,i)};k.readNumber=function(e){var t=this.pos;!e&&this.readInt(10,void 0,!0)===null&&this.raise(t,"Invalid number");var i=this.pos-t>=2&&this.input.charCodeAt(t)===48;i&&this.strict&&this.raise(t,"Invalid number");var r=this.input.charCodeAt(this.pos);if(!i&&!e&&this.options.ecmaVersion>=11&&r===110){var s=Mi(this.input.slice(t,this.pos));return++this.pos,re(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(n.num,s)}i&&/[89]/.test(this.input.slice(t,this.pos))&&(i=!1),r===46&&!i&&(++this.pos,this.readInt(10),r=this.input.charCodeAt(this.pos)),(r===69||r===101)&&!i&&(r=this.input.charCodeAt(++this.pos),(r===43||r===45)&&++this.pos,this.readInt(10)===null&&this.raise(t,"Invalid number")),re(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var a=qr(this.input.slice(t,this.pos),i);return this.finishToken(n.num,a)};k.readCodePoint=function(){var e=this.input.charCodeAt(this.pos),t;if(e===123){this.options.ecmaVersion<6&&this.unexpected();var i=++this.pos;t=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,t>1114111&&this.invalidStringToken(i,"Code point out of bounds")}else t=this.readHexChar(4);return t};k.readString=function(e){for(var t="",i=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var r=this.input.charCodeAt(this.pos);if(r===e)break;r===92?(t+=this.input.slice(i,this.pos),t+=this.readEscapedChar(!1),i=this.pos):r===8232||r===8233?(this.options.ecmaVersion<10&&this.raise(this.start,"Unterminated string constant"),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(Ae(r)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return t+=this.input.slice(i,this.pos++),this.finishToken(n.string,t)};var Bi={};k.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(e){if(e===Bi)this.readInvalidTemplateToken();else throw e}this.inTemplateElement=!1};k.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw Bi;this.raise(e,t)};k.readTmplToken=function(){for(var e="",t=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var i=this.input.charCodeAt(this.pos);if(i===96||i===36&&this.input.charCodeAt(this.pos+1)===123)return this.pos===this.start&&(this.type===n.template||this.type===n.invalidTemplate)?i===36?(this.pos+=2,this.finishToken(n.dollarBraceL)):(++this.pos,this.finishToken(n.backQuote)):(e+=this.input.slice(t,this.pos),this.finishToken(n.template,e));if(i===92)e+=this.input.slice(t,this.pos),e+=this.readEscapedChar(!0),t=this.pos;else if(Ae(i)){switch(e+=this.input.slice(t,this.pos),++this.pos,i){case 13:this.input.charCodeAt(this.pos)===10&&++this.pos;case 10:e+=`
`;break;default:e+=String.fromCharCode(i);break}this.options.locations&&(++this.curLine,this.lineStart=this.pos),t=this.pos}else++this.pos}};k.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(n.invalidTemplate,this.input.slice(this.start,this.pos));case"\r":this.input[this.pos+1]===`
`&&++this.pos;case`
`:case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1;break}this.raise(this.start,"Unterminated template")};k.readEscapedChar=function(e){var t=this.input.charCodeAt(++this.pos);switch(++this.pos,t){case 110:return`
`;case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return oe(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 i=this.pos-1;this.invalidStringToken(i,"Invalid escape sequence in template string")}default:if(t>=48&&t<=55){var r=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],s=parseInt(r,8);return s>255&&(r=r.slice(0,-1),s=parseInt(r,8)),this.pos+=r.length-1,t=this.input.charCodeAt(this.pos),(r!=="0"||t===56||t===57)&&(this.strict||e)&&this.invalidStringToken(this.pos-1-r.length,e?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(s)}return Ae(t)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(t)}};k.readHexChar=function(e){var t=this.pos,i=this.readInt(16,e);return i===null&&this.invalidStringToken(t,"Bad character escape sequence"),i};k.readWord1=function(){this.containsEsc=!1;for(var e="",t=!0,i=this.pos,r=this.options.ecmaVersion>=6;this.pos<this.input.length;){var s=this.fullCharCodeAtPos();if(de(s,r))this.pos+=s<=65535?1:2;else if(s===92){this.containsEsc=!0,e+=this.input.slice(i,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?re:de)(o,r)||this.invalidStringToken(a,"Invalid Unicode escape"),e+=oe(o),i=this.pos}else break;t=!1}return e+this.input.slice(i,this.pos)};k.readWord=function(){var e=this.readWord1(),t=n.name;return this.keywords.test(e)&&(t=At[e]),this.finishToken(t,e)};var Gr="8.18.0";M.acorn={Parser:M,version:Gr,defaultOptions:Ct,Position:Be,SourceLocation:et,getLineInfo:ni,Node:st,TokenType:_,tokTypes:n,keywordTypes:At,TokContext:Z,tokContexts:V,isIdentifierChar:de,isIdentifierStart:re,Token:Lt,isNewLine:Ae,lineBreak:j,lineBreakG:lr,nonASCIIwhitespace:si};function Ht(e,t){return M.parse(e,t)}class qe{constructor(t){I(this,"values",new Map);this.parent=t}find(t){var i;return this.values.has(t)?this:(i=this.parent)==null?void 0:i.find(t)}get(t){const i=this.find(t);if(!i)throw new Error(`${t} is not available. See the supported drawing API in Help.`);return i.values.get(t)}}class ke{constructor(t,i){this.node=t,this.scope=i}}class xe{constructor(t,i){this.kind=t,this.value=i}}const Wr=new Set(["constructor","prototype","__proto__","caller","callee","arguments"]);function Hr(e){return e.trim().replace(/^```(?:javascript|js)?\s*\n?/i,"").replace(/\n?```$/,"").replace(/\\([_*~])/g,"$1").replace(/\[(#[^\]]+)\]\(https?:\/\/[^)]+\)/g,"$1")}function zr(e){if(e.length>24e3)throw new Error("Keep sketches under 24,000 characters.");let t=Hr(e);t=t.replace(/(\/\/[^\n]*?)\s+(?=(?:draw|setup)\s*=)/,`$1
`);try{return{source:t,ast:Ht(t,{ecmaVersion:2022,locations:!0})}}catch{return t=t.replace(/([)\]}])\s+(?=(?:for\s*\(|[\w$]+\s*=(?!=)))/g,`$1;
`),{source:t,ast:Ht(t,{ecmaVersion:2022,locations:!0})}}}class Kr{constructor(t){I(this,"root",new qe);I(this,"natives",new Set);I(this,"owned",new WeakSet);I(this,"steps",0);I(this,"deadline",0);I(this,"depth",0);for(const[i,r]of Object.entries(t))this.expose(i,r);this.expose("undefined",void 0),this.expose("NaN",NaN),this.expose("Infinity",1/0)}expose(t,i){if(this.root.values.set(t,i),typeof i=="function")this.natives.add(i);else if(i&&typeof i=="object"){this.owned.add(i);for(const r of Object.values(i))typeof r=="function"&&this.natives.add(r)}}has(t){return!!this.root.find(t)}value(t){return this.root.get(t)}run(t){this.reset(),this.evaluate(t,this.root)}invoke(t){this.reset(),this.has(t)&&this.call(this.value(t),[])}reset(){this.steps=0,this.depth=0,this.deadline=performance.now()+90}tick(t){var i;if(++this.steps>18e4||this.steps%256===0&&performance.now()>this.deadline)throw new Error(`Line ${((i=t.loc)==null?void 0:i.start.line)??"?"}: sketch exceeded its frame budget. Reduce the loop or drawing count.`)}data(t){return this.owned.add(t),t}key(t){if(typeof t!="string"&&typeof t!="number")throw new Error("Use a string or number as a property.");const i=String(t);if(Wr.has(i))throw new Error(`Property ${i} is not available.`);return i}member(t,i){if(t==null)throw new Error(`Cannot read ${i} on an empty value.`);if((typeof t!="object"||!this.owned.has(t))&&typeof t!="string")throw new Error("Only sketch data has accessible properties.");if(i==="length"&&(Array.isArray(t)||typeof t=="string"))return t.length;if(Object.hasOwn(t,i))return t[i];throw new Error(`Property or method ${i} is not supported.`)}reference(t,i){if(t.type==="Identifier"){const r=i.find(t.name)??this.root;return{get:()=>r.values.get(t.name),set:s=>(r.values.set(t.name,s),s)}}if(t.type==="MemberExpression"){const r=this.evaluate(t.object,i),s=this.key(t.computed?this.evaluate(t.property,i):t.property.name);if(!r||!this.owned.has(r))throw new Error("Cannot modify this value.");return{get:()=>this.member(r,s),set:a=>{if(Array.isArray(r)&&(!/^\d+$/.test(s)||Number(s)>2e4))throw new Error("Array index must be between 0 and 20,000.");return r[s]=a,a}}}throw new Error("Unsupported assignment target.")}call(t,i){if(++this.depth>64)throw this.depth--,new Error("Sketch recursion limit reached.");try{if(t instanceof ke){const r=new qe(t.scope);t.node.params.forEach((a,o)=>{if(a.type!=="Identifier")throw new Error("Use simple named function parameters.");r.values.set(a.name,i[o])});const s=this.evaluate(t.node.body,r);return s instanceof xe?s.value:t.node.body.type!=="BlockStatement"?s:void 0}if(typeof t=="function"&&this.natives.has(t)){if(i.some(s=>s instanceof ke||typeof s=="function"))throw new Error("Drawing functions accept data, not callbacks.");const r=t(...i);return r&&typeof r=="object"&&this.owned.add(r),r}throw new Error("This value is not a supported function.")}finally{this.depth--}}binary(t,i,r){if(i instanceof ke||r instanceof ke||i&&typeof i=="object"||r&&typeof r=="object")throw new Error("Arithmetic requires simple values.");switch(t){case"+":{const s=i+r;if(typeof s=="string"&&s.length>24e3)throw new Error("String size limit reached.");return s}case"-":return i-r;case"*":return i*r;case"/":return i/r;case"%":return i%r;case"**":return i**r;case"^":return i^r;case"&":return i&r;case"|":return i|r;case"<<":return i<<r;case">>":return i>>r;case">>>":return i>>>r;case"<":return i<r;case">":return i>r;case"<=":return i<=r;case">=":return i>=r;case"==":return i==r;case"!=":return i!=r;case"===":return i===r;case"!==":return i!==r;default:throw new Error(`Operator ${t} is not supported.`)}}block(t,i){for(const r of t)r.type==="FunctionDeclaration"&&i.values.set(r.id.name,new ke(r,i));for(const r of t){const s=this.evaluate(r,i);if(s instanceof xe)return s}}evaluate(t,i){var s;if(!t)return;this.tick(t);const r=a=>this.evaluate(a,i);switch(t.type){case"Program":return this.block(t.body,i);case"BlockStatement":return this.block(t.body,new qe(i));case"EmptyStatement":return;case"ExpressionStatement":return r(t.expression);case"Literal":if(t.regex||typeof t.value=="bigint")throw new Error("Regular expressions and BigInt are not supported.");return t.value;case"Identifier":return i.get(t.name);case"VariableDeclaration":for(const a of t.declarations){if(a.id.type!=="Identifier")throw new Error("Use simple variable names.");i.values.set(a.id.name,a.init?r(a.init):void 0)}return;case"FunctionDeclaration":return;case"ArrowFunctionExpression":case"FunctionExpression":if(t.async||t.generator)throw new Error("Async sketches are not supported.");return new ke(t,i);case"CallExpression":return this.call(r(t.callee),t.arguments.map(r));case"MemberExpression":return this.member(r(t.object),this.key(t.computed?r(t.property):t.property.name));case"ArrayExpression":return this.data(t.elements.map(r));case"ObjectExpression":{const a=Object.create(null);for(const o of t.properties){if(o.type!=="Property"||o.kind!=="init"||o.method)throw new Error("Use plain object properties.");a[this.key(o.computed?r(o.key):o.key.name??o.key.value)]=r(o.value)}return this.data(a)}case"SequenceExpression":{let a;for(const o of t.expressions)a=r(o);return a}case"BinaryExpression":return this.binary(t.operator,r(t.left),r(t.right));case"LogicalExpression":{const a=r(t.left);return t.operator==="&&"?a&&r(t.right):t.operator==="||"?a||r(t.right):a??r(t.right)}case"ConditionalExpression":return r(t.test)?r(t.consequent):r(t.alternate);case"AssignmentExpression":{const a=this.reference(t.left,i);return a.set(t.operator==="="?r(t.right):this.binary(t.operator.slice(0,-1),a.get(),r(t.right)))}case"UpdateExpression":{const a=this.reference(t.argument,i),o=Number(a.get()),u=a.set(o+(t.operator==="++"?1:-1));return t.prefix?u:o}case"UnaryExpression":{if(t.operator==="typeof"&&t.argument.type==="Identifier"&&!i.find(t.argument.name))return"undefined";const a=r(t.argument);switch(t.operator){case"+":return+a;case"-":return-a;case"~":return~a;case"!":return!a;case"typeof":return typeof a;case"void":return;default:throw new Error("Unsupported unary operator.")}}case"IfStatement":return r(t.test)?r(t.consequent):r(t.alternate);case"ReturnStatement":return new xe("return",r(t.argument));case"BreakStatement":return new xe("break");case"ContinueStatement":return new xe("continue");case"ForStatement":{const a=new qe(i);for(this.evaluate(t.init,a);!t.test||this.evaluate(t.test,a);){this.tick(t);const o=this.evaluate(t.body,a);if(o instanceof xe){if(o.kind==="return")return o;if(o.kind==="break")break}this.evaluate(t.update,a)}return}case"WhileStatement":case"DoWhileStatement":{let a=t.type==="DoWhileStatement";for(;a||r(t.test);){a=!1,this.tick(t);const o=r(t.body);if(o instanceof xe){if(o.kind==="return")return o;if(o.kind==="break")break}}return}default:throw new Error(`Line ${((s=t.loc)==null?void 0:s.start.line)??"?"}: ${t.type} is not supported in 2D sketches.`)}}}const Rt=[{name:"BusyMozaic",credit:"BusyMozaic · Kurt Moerman (@KurtMoerman4)",code:`// BusyMozaic — Kurt Moerman (@KurtMoerman4)
s=6; t=0;
draw=_=>{
t++ || createCanvas(2*(W=225),2*(H=150))+background(0);
for(x=0;x<2*W;x+=s){
y=(x^t)%(2*H); y=s*~~(y/s);
u=1.7*(x-W); v=1.7*(y-H)+150;
d=~~abs(u**3/4E4-u+3*v-v**2/1E2);
p=(d/s)%(s&t);
fill(d%256,(d%128)*2,(d%32)*8);
rect(x-p,y-p,2*p);
}
}`},{name:"Orbit study",credit:"Orbit study · built-in example",code:`function setup() {
createCanvas(450, 450);
colorMode(HSB, 360, 100, 100, 100);
noStroke();
}
function draw() {
background(230, 40, 7, 12);
translate(width/2, height/2);
for (let i=0; i<36; i++) {
let a = frameCount/70 + i*TWO_PI/36;
let r = 110 + 55*sin(frameCount/90 + i/5);
fill((i*10 + frameCount/3)%360, 65, 100);
circle(cos(a)*r, sin(a)*r, 5 + 4*sin(a));
}
}`},{name:"Ribbon field",credit:"Ribbon field · built-in example",code:`function setup() {
createCanvas(540, 360);
noFill();
strokeWeight(2);
}
function draw() {
background(12, 20, 25);
for (let j=0; j<24; j++) {
stroke(65+j*7, 220-j*4, 175+j*3);
beginShape();
for (let x=0; x<=width; x+=6) {
let wave = sin(x/85 + frameCount/50 + j/9);
vertex(x, 30+j*13 + wave*26);
}
endShape();
}
}`}],ee=(e,t,i)=>Math.min(i,Math.max(t,e));class Oi{constructor(t){I(this,"canvas");I(this,"source");I(this,"ctx");I(this,"vm");I(this,"frame",0);I(this,"fps",60);I(this,"looping",!0);I(this,"filled",!0);I(this,"stroked",!0);I(this,"degrees",!1);I(this,"rectangleMode","corner");I(this,"ellipseModeValue","center");I(this,"mode","rgb");I(this,"ranges",[255,255,255,255]);I(this,"seed",123456789);I(this,"noiseSeedValue",42);I(this,"shapeStarted",!1);I(this,"states",[]);I(this,"elapsed",0);const i=zr(t);this.source=i.source,this.canvas=document.createElement("canvas"),this.canvas.width=450,this.canvas.height=300;const r=this.canvas.getContext("2d",{willReadFrequently:!0});if(!r)throw new Error("Canvas drawing is unavailable in this browser.");if(this.ctx=r,this.defaults(),this.vm=new Kr(this.api()),this.vm.run(i.ast),this.vm.invoke("setup"),!this.vm.has("draw")&&!this.vm.has("setup"))throw new Error("Add a draw function or a setup function to your sketch.")}defaults(){this.ctx.fillStyle="#fff",this.ctx.strokeStyle="#000",this.ctx.lineWidth=1,this.ctx.lineCap="round"}angle(t){return this.degrees?t*Math.PI/180:t}paint(){this.filled&&this.ctx.fill(),this.stroked&&this.ctx.stroke()}color(t){if(Array.isArray(t[0])&&(t=t[0]),typeof t[0]=="string")return t[0];if(t.length<=2){const h=ee(Number(t[0])/(this.mode==="rgb"?this.ranges[0]:this.ranges[2])*255,0,255);return`rgba(${h},${h},${h},${t[1]===void 0?1:ee(t[1]/this.ranges[3],0,1)})`}const i=t[3]===void 0?1:ee(t[3]/this.ranges[3],0,1);if(this.mode==="rgb")return`rgba(${t.slice(0,3).map((h,c)=>ee(h/this.ranges[c]*255,0,255)).join(",")},${i})`;const r=(t[0]/this.ranges[0]*360%360+360)%360,s=ee(t[1]/this.ranges[1],0,1),a=ee(t[2]/this.ranges[2],0,1),o=this.mode==="hsb"?a*(1-s/2):a,u=this.mode==="hsb"?o===0||o===1?0:(a-o)/Math.min(o,1-o):s;return`hsla(${r},${u*100}%,${o*100}%,${i})`}random(){return this.seed=Math.imul(1664525,this.seed)+1013904223>>>0,this.seed/4294967296}noise(t,i=0,r=0){const s=f=>f*f*(3-2*f),a=(f,w,g)=>{let y=Math.imul(f,374761393)^Math.imul(w,668265263)^Math.imul(g,2147483647)^this.noiseSeedValue;return y=Math.imul(y^y>>>13,1274126177),((y^y>>>16)>>>0)/4294967296},o=Math.floor(t),u=Math.floor(i),h=Math.floor(r),c=s(t-o),p=s(i-u),l=s(r-h),x=(f,w,g)=>f+(w-f)*g,E=f=>x(x(a(o,u,f),a(o+1,u,f),c),x(a(o,u+1,f),a(o+1,u+1,f),c),p);return x(E(h),E(h+1),l)}api(){const t=this.ctx,i={width:this.canvas.width,height:this.canvas.height,windowWidth:450,windowHeight:300,frameCount:0,deltaTime:1e3/60,mouseX:0,mouseY:0,mouseIsPressed:!1,PI:Math.PI,TWO_PI:Math.PI*2,TAU:Math.PI*2,HALF_PI:Math.PI/2,QUARTER_PI:Math.PI/4,RGB:"rgb",HSB:"hsb",HSL:"hsl",CENTER:"center",CORNER:"corner",CORNERS:"corners",RADIUS:"radius",CLOSE:"close",DEGREES:"degrees",RADIANS:"radians",ROUND:"round",SQUARE:"butt",PROJECT:"square",createCanvas:(s,a,o)=>{var u,h;if(o)throw new Error("Only the default 2D canvas is supported.");if(![s,a].every(c=>Number.isFinite(c)&&c>=1&&c<=1024))throw new Error("Canvas dimensions must be between 1 and 1,024 pixels.");return this.canvas.width=Math.floor(s),this.canvas.height=Math.floor(a),this.defaults(),(u=this.vm)==null||u.expose("width",this.canvas.width),(h=this.vm)==null||h.expose("height",this.canvas.height),0},background:(...s)=>(t.save(),t.resetTransform(),t.fillStyle=this.color(s),t.fillRect(0,0,this.canvas.width,this.canvas.height),t.restore(),0),clear:()=>{t.save(),t.resetTransform(),t.clearRect(0,0,this.canvas.width,this.canvas.height),t.restore()},fill:(...s)=>{t.fillStyle=this.color(s),this.filled=!0},stroke:(...s)=>{t.strokeStyle=this.color(s),this.stroked=!0},noFill:()=>{this.filled=!1},noStroke:()=>{this.stroked=!1},strokeWeight:s=>{t.lineWidth=ee(s,.01,1024)},strokeCap:s=>{["round","butt","square"].includes(s)&&(t.lineCap=s)},rectMode:s=>{this.rectangleMode=s},ellipseMode:s=>{this.ellipseModeValue=s},rect:(s,a,o,u=o)=>{[s,a,o,u].every(Number.isFinite)&&(this.rectangleMode==="center"?(s-=o/2,a-=u/2):this.rectangleMode==="radius"?(s-=o,a-=u,o*=2,u*=2):this.rectangleMode==="corners"&&(o-=s,u-=a),t.beginPath(),t.rect(s,a,o,u),this.paint())},ellipse:(s,a,o,u=o)=>{[s,a,o,u].every(Number.isFinite)&&(this.ellipseModeValue==="corner"&&(s+=o/2,a+=u/2),this.ellipseModeValue==="radius"&&(o*=2,u*=2),t.beginPath(),t.ellipse(s,a,Math.abs(o/2),Math.abs(u/2),0,0,Math.PI*2),this.paint())},line:(s,a,o,u)=>{[s,a,o,u].every(Number.isFinite)&&(t.beginPath(),t.moveTo(s,a),t.lineTo(o,u),this.stroked&&t.stroke())},point:(s,a)=>{!this.stroked||![s,a].every(Number.isFinite)||(t.save(),t.fillStyle=t.strokeStyle,t.beginPath(),t.arc(s,a,t.lineWidth/2,0,Math.PI*2),t.fill(),t.restore())},triangle:(...s)=>{t.beginPath(),t.moveTo(s[0],s[1]),t.lineTo(s[2],s[3]),t.lineTo(s[4],s[5]),t.closePath(),this.paint()},beginShape:()=>{this.shapeStarted=!1,t.beginPath()},vertex:(s,a)=>{this.shapeStarted?t.lineTo(s,a):t.moveTo(s,a),this.shapeStarted=!0},bezierVertex:(...s)=>t.bezierCurveTo(s[0],s[1],s[2],s[3],s[4],s[5]),endShape:s=>{s==="close"&&t.closePath(),this.paint()},translate:(s,a)=>t.translate(s,a),rotate:s=>t.rotate(this.angle(s)),scale:(s,a=s)=>t.scale(s,a),resetMatrix:()=>t.resetTransform(),push:()=>{if(this.states.length>=64)throw new Error("Too many push() calls. Pair each push() with pop().");t.save(),this.states.push([this.filled,this.stroked,this.rectangleMode,this.ellipseModeValue,this.mode,[...this.ranges]])},pop:()=>{const s=this.states.pop();if(!s)throw new Error("pop() needs a matching push().");t.restore(),[this.filled,this.stroked,this.rectangleMode,this.ellipseModeValue,this.mode,this.ranges]=s},colorMode:(s,...a)=>{if(!["rgb","hsb","hsl"].includes(s))throw new Error("Use RGB, HSB or HSL.");this.mode=s,this.ranges=a.length===1?[a[0],a[0],a[0],a[0]]:a.length>=3?[a[0],a[1],a[2],a[3]??255]:s==="rgb"?[255,255,255,255]:[360,100,100,1]},color:(...s)=>this.color(s),angleMode:s=>{this.degrees=s==="degrees"},frameRate:s=>{if(s!==void 0){if(!Number.isFinite(s)||s<1||s>60)throw new Error("Sketch frame rate must be 1–60 fps.");this.fps=s}return this.fps},noLoop:()=>{this.looping=!1},loop:()=>{this.looping=!0},pixelDensity:()=>1,millis:()=>this.elapsed*1e3,randomSeed:s=>{this.seed=s>>>0},random:(s,a)=>{const o=this.random();return Array.isArray(s)?s[Math.floor(o*s.length)]:s===void 0?o:a===void 0?o*s:s+o*(a-s)},noiseSeed:s=>{this.noiseSeedValue=s>>>0},noise:(s,a,o)=>this.noise(s,a,o),map:(s,a,o,u,h,c=!1)=>{const p=u+(s-a)/(o-a)*(h-u);return c?ee(p,Math.min(u,h),Math.max(u,h)):p},constrain:ee,lerp:(s,a,o)=>s+(a-s)*o,dist:(s,a,o,u)=>Math.hypot(o-s,u-a),mag:(s,a)=>Math.hypot(s,a),norm:(s,a,o)=>(s-a)/(o-a),sq:s=>s*s,radians:s=>s*Math.PI/180,degrees:s=>s*180/Math.PI,int:s=>Math.trunc(s),float:s=>parseFloat(s),str:s=>String(s),textSize:s=>{t.font=`${ee(s,1,512)}px sans-serif`},text:(s,a,o)=>{this.filled&&t.fillText(String(s).slice(0,2e3),a,o),this.stroked&&t.strokeText(String(s).slice(0,2e3),a,o)}};for(const s of["abs","ceil","floor","round","sqrt","pow","exp","log","min","max","sign","hypot","trunc"])i[s]=Math[s];for(const s of["sin","cos","tan"])i[s]=a=>Math[s](this.angle(a));for(const s of["asin","acos","atan"])i[s]=a=>{const o=Math[s](a);return this.degrees?o*180/Math.PI:o};i.atan2=(s,a)=>{const o=Math.atan2(s,a);return this.degrees?o*180/Math.PI:o},i.circle=i.ellipse,i.square=i.rect;const r=Object.create(null);for(const s of Object.getOwnPropertyNames(Math))r[s]=Math[s];return r.random=()=>this.random(),i.Math=r,i}step(){if(!(this.frame>0&&!this.looping)&&(this.frame++,this.elapsed+=1/this.fps,this.vm.expose("frameCount",this.frame),this.vm.expose("deltaTime",1e3/this.fps),this.ctx.resetTransform(),this.vm.invoke("draw"),this.states.length))throw new Error("Pair every push() with pop() before the end of draw().")}}var Qr={trailer:59};function Fi(e=256){let t=0,i=new Uint8Array(e);return{get buffer(){return i.buffer},reset(){t=0},bytesView(){return i.subarray(0,t)},bytes(){return i.slice(0,t)},writeByte(s){r(t+1),i[t]=s,t++},writeBytes(s,a=0,o=s.length){r(t+o);for(let u=0;u<o;u++)i[t++]=s[u+a]},writeBytesView(s,a=0,o=s.byteLength){r(t+o),i.set(s.subarray(a,a+o),t),t+=o}};function r(s){var a=i.length;if(a>=s)return;var o=1024*1024;s=Math.max(s,a*(a<o?2:1.125)>>>0),a!=0&&(s=Math.max(s,256));let u=i;i=new Uint8Array(s),t>0&&i.set(u.subarray(0,t),0)}}var bt=12,zt=5003,$r=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535];function Yr(e,t,i,r,s=Fi(512),a=new Uint8Array(256),o=new Int32Array(zt),u=new Int32Array(zt)){let h=o.length,c=Math.max(2,r);a.fill(0),u.fill(0),o.fill(-1);let p=0,l=0,x=c+1,E=x,f=!1,w=E,g=(1<<w)-1,y=1<<x-1,D=y+1,P=y+2,S=0,R=i[0],$=0;for(let T=h;T<65536;T*=2)++$;$=8-$,s.writeByte(c),Y(y);let N=i.length;for(let T=1;T<N;T++)e:{let ae=i[T],ne=(ae<<bt)+R,O=ae<<$^R;if(o[O]===ne){R=u[O];break e}let pt=O===0?1:h-O;for(;o[O]>=0;)if(O-=pt,O<0&&(O+=h),o[O]===ne){R=u[O];break e}Y(R),R=ae,P<1<<bt?(u[O]=P++,o[O]=ne):(o.fill(-1),P=y+2,f=!0,Y(y))}return Y(R),Y(D),s.writeByte(0),s.bytesView();function Y(T){for(p&=$r[l],l>0?p|=T<<l:p=T,l+=w;l>=8;)a[S++]=p&255,S>=254&&(s.writeByte(S),s.writeBytesView(a,0,S),S=0),p>>=8,l-=8;if((P>g||f)&&(f?(w=E,g=(1<<w)-1,f=!1):(++w,g=w===bt?1<<w:(1<<w)-1)),T==D){for(;l>0;)a[S++]=p&255,S>=254&&(s.writeByte(S),s.writeBytesView(a,0,S),S=0),p>>=8,l-=8;S>0&&(s.writeByte(S),s.writeBytesView(a,0,S),S=0)}}}var Xr=Yr;function Di(e,t,i){return e<<8&63488|t<<2&992|i>>3}function Ui(e,t,i,r){return e>>4|t&240|(i&240)<<4|(r&240)<<8}function ji(e,t,i){return e>>4<<8|t&240|i>>4}function Ge(e,t,i){return e<t?t:e>i?i:e}function We(e){return e*e}function Kt(e,t,i){var r=0,s=1e100;let a=e[t],o=a.cnt;a.ac;let u=a.rc,h=a.gc,c=a.bc;for(var p=a.fw;p!=0;p=e[p].fw){let x=e[p],E=x.cnt,f=o*E/(o+E);if(!(f>=s)){var l=0;l+=f*We(x.rc-u),!(l>=s)&&(l+=f*We(x.gc-h),!(l>=s)&&(l+=f*We(x.bc-c),!(l>=s)&&(s=l,r=p)))}}a.err=s,a.nn=r}function yt(){return{ac:0,rc:0,gc:0,bc:0,cnt:0,nn:0,fw:0,bk:0,tm:0,mtm:0,err:0}}function Zr(e,t){let i=t==="rgb444"?4096:65536,r=new Array(i),s=e.length;if(t==="rgba4444")for(let a=0;a<s;++a){let o=e[a],u=o>>24&255,h=o>>16&255,c=o>>8&255,p=o&255,l=Ui(p,c,h,u),x=l in r?r[l]:r[l]=yt();x.rc+=p,x.gc+=c,x.bc+=h,x.ac+=u,x.cnt++}else if(t==="rgb444")for(let a=0;a<s;++a){let o=e[a],u=o>>16&255,h=o>>8&255,c=o&255,p=ji(c,h,u),l=p in r?r[p]:r[p]=yt();l.rc+=c,l.gc+=h,l.bc+=u,l.cnt++}else for(let a=0;a<s;++a){let o=e[a],u=o>>16&255,h=o>>8&255,c=o&255,p=Di(c,h,u),l=p in r?r[p]:r[p]=yt();l.rc+=c,l.gc+=h,l.bc+=u,l.cnt++}return r}function Jr(e,t,i={}){let{format:r="rgb565",clearAlpha:s=!0,clearAlphaColor:a=0,clearAlphaThreshold:o=0,oneBitAlpha:u=!1}=i;if(!e||!e.buffer)throw new Error("quantize() expected RGBA Uint8Array data");if(!(e instanceof Uint8Array)&&!(e instanceof Uint8ClampedArray))throw new Error("quantize() expected RGBA Uint8Array data");let h=new Uint32Array(e.buffer),c=i.useSqrt!==!1,p=r==="rgba4444",l=Zr(h,r),x=l.length,E=x-1,f=new Uint32Array(x+1);for(var w=0,g=0;g<x;++g){let X=l[g];if(X!=null){var y=1/X.cnt;p&&(X.ac*=y),X.rc*=y,X.gc*=y,X.bc*=y,l[w++]=X}}We(t)/w<.022&&(c=!1);for(var g=0;g<w-1;++g)l[g].fw=g+1,l[g+1].bk=g,c&&(l[g].cnt=Math.sqrt(l[g].cnt));c&&(l[g].cnt=Math.sqrt(l[g].cnt));var D,P,S;for(g=0;g<w;++g){Kt(l,g);var R=l[g].err;for(P=++f[0];P>1&&(S=P>>1,!(l[D=f[S]].err<=R));P=S)f[P]=D;f[P]=g}var $=w-t;for(g=0;g<$;){for(var N;;){var Y=f[1];if(N=l[Y],N.tm>=N.mtm&&l[N.nn].mtm<=N.tm)break;N.mtm==E?Y=f[1]=f[f[0]--]:(Kt(l,Y),N.tm=g);var R=l[Y].err;for(P=1;(S=P+P)<=f[0]&&(S<f[0]&&l[f[S]].err>l[f[S+1]].err&&S++,!(R<=l[D=f[S]].err));P=S)f[P]=D;f[P]=Y}var T=l[N.nn],ae=N.cnt,ne=T.cnt,y=1/(ae+ne);p&&(N.ac=y*(ae*N.ac+ne*T.ac)),N.rc=y*(ae*N.rc+ne*T.rc),N.gc=y*(ae*N.gc+ne*T.gc),N.bc=y*(ae*N.bc+ne*T.bc),N.cnt+=T.cnt,N.mtm=++g,l[T.bk].fw=T.fw,l[T.fw].bk=T.bk,T.mtm=E}let O=[];var pt=0;for(g=0;;++pt){let X=Ge(Math.round(l[g].rc),0,255),ft=Ge(Math.round(l[g].gc),0,255),dt=Ge(Math.round(l[g].bc),0,255),we=255;p&&(we=Ge(Math.round(l[g].ac),0,255),u&&(we=we<=(typeof u=="number"?u:127)?0:255),s&&we<=o&&(X=ft=dt=a,we=0));let Dt=p?[X,ft,dt,we]:[X,ft,dt];if(es(O,Dt)||O.push(Dt),(g=l[g].fw)==0)break}return O}function es(e,t){for(let i=0;i<e.length;i++){let r=e[i],s=r[0]===t[0]&&r[1]===t[1]&&r[2]===t[2],a=r.length>=4&&t.length>=4?r[3]===t[3]:!0;if(s&&a)return!0}return!1}function ts(e,t,i="rgb565"){if(!e||!e.buffer)throw new Error("quantize() expected RGBA Uint8Array data");if(!(e instanceof Uint8Array)&&!(e instanceof Uint8ClampedArray))throw new Error("quantize() expected RGBA Uint8Array data");if(t.length>256)throw new Error("applyPalette() only works with 256 colors or less");let r=new Uint32Array(e.buffer),s=r.length,a=i==="rgb444"?4096:65536,o=new Uint8Array(s),u=new Array(a);if(i==="rgba4444")for(let h=0;h<s;h++){let c=r[h],p=c>>24&255,l=c>>16&255,x=c>>8&255,E=c&255,f=Ui(E,x,l,p),w=f in u?u[f]:u[f]=is(E,x,l,p,t);o[h]=w}else{let h=i==="rgb444"?ji:Di;for(let c=0;c<s;c++){let p=r[c],l=p>>16&255,x=p>>8&255,E=p&255,f=h(E,x,l),w=f in u?u[f]:u[f]=rs(E,x,l,t);o[c]=w}}return o}function is(e,t,i,r,s){let a=0,o=1e100;for(let u=0;u<s.length;u++){let h=s[u],c=h[3],p=ge(c-r);if(p>o)continue;let l=h[0];if(p+=ge(l-e),p>o)continue;let x=h[1];if(p+=ge(x-t),p>o)continue;let E=h[2];p+=ge(E-i),!(p>o)&&(o=p,a=u)}return a}function rs(e,t,i,r){let s=0,a=1e100;for(let o=0;o<r.length;o++){let u=r[o],h=u[0],c=ge(h-e);if(c>a)continue;let p=u[1];if(c+=ge(p-t),c>a)continue;let l=u[2];c+=ge(l-i),!(c>a)&&(a=c,s=o)}return s}function ge(e){return e*e}function ss(e={}){let{initialCapacity:t=4096,auto:i=!0}=e,r=Fi(t),s=5003,a=new Uint8Array(256),o=new Int32Array(s),u=new Int32Array(s),h=!1;return{reset(){r.reset(),h=!1},finish(){r.writeByte(Qr.trailer)},bytes(){return r.bytes()},bytesView(){return r.bytesView()},get buffer(){return r.buffer},get stream(){return r},writeHeader:c,writeFrame(p,l,x,E={}){let{transparent:f=!1,transparentIndex:w=0,delay:g=0,palette:y=null,repeat:D=0,colorDepth:P=8,dispose:S=-1}=E,R=!1;if(i?h||(R=!0,c(),h=!0):R=!!E.first,l=Math.max(0,Math.floor(l)),x=Math.max(0,Math.floor(x)),R){if(!y)throw new Error("First frame must include a { palette } option");ns(r,l,x,y,P),Qt(r,y),D>=0&&os(r,D)}let $=Math.round(g/10);as(r,S,$,f,w);let N=!!y&&!R;us(r,l,x,N?y:null),N&&Qt(r,y),hs(r,p,l,x,P,a,o,u)}};function c(){qi(r,"GIF89a")}}function as(e,t,i,r,s){e.writeByte(33),e.writeByte(249),e.writeByte(4),s<0&&(s=0,r=!1);var a,o;r?(a=1,o=2):(a=0,o=0),t>=0&&(o=t&7),o<<=2,e.writeByte(0|o|0|a),pe(e,i),e.writeByte(s||0),e.writeByte(0)}function ns(e,t,i,r,s=8){let a=1,o=0,u=Mt(r.length)-1,h=a<<7|s-1<<4|o<<3|u;pe(e,t),pe(e,i),e.writeBytes([h,0,0])}function os(e,t){e.writeByte(33),e.writeByte(255),e.writeByte(11),qi(e,"NETSCAPE2.0"),e.writeByte(3),e.writeByte(1),pe(e,t),e.writeByte(0)}function Qt(e,t){let i=1<<Mt(t.length);for(let r=0;r<i;r++){let s=[0,0,0];r<t.length&&(s=t[r]),e.writeByte(s[0]),e.writeByte(s[1]),e.writeByte(s[2])}}function us(e,t,i,r){if(e.writeByte(44),pe(e,0),pe(e,0),pe(e,t),pe(e,i),r){let s=0,a=0,o=Mt(r.length)-1;e.writeByte(128|s|a|0|o)}else e.writeByte(0)}function hs(e,t,i,r,s=8,a,o,u){Xr(i,r,t,s,e,a,o,u)}function pe(e,t){e.writeByte(t&255),e.writeByte(t>>8&255)}function qi(e,t){for(var i=0;i<t.length;i++)e.writeByte(t.charCodeAt(i))}function Mt(e){return Math.max(Math.ceil(Math.log2(e)),1)}const wt=()=>new Promise(e=>setTimeout(e,0));function cs(e,t){const i=Math.round(e*t);return Array.from({length:i},(r,s)=>(Math.round((s+1)*e*100/i)-Math.round(s*e*100/i))*10)}async function ls(e,t,i,r){const{duration:s,fps:a,start:o,scale:u,loop:h}=t;if(!Number.isFinite(s)||s<1||s>30||!Number.isInteger(s*10))throw new Error("Choose a duration from 1 to 30 seconds in 0.1-second steps.");if(![10,15,20,25,30].includes(a)||!Number.isFinite(o)||o<0||o>30||![.5,1].includes(u))throw new Error("Choose valid export settings.");const c=new Oi(e);let p=0,l=performance.now();const x=()=>{if(i.aborted)throw new DOMException("Export cancelled.","AbortError")},E=async S=>{for(;p<=S+1e-8;)x(),c.step(),p+=1/c.fps,performance.now()-l>12&&(r(Math.min(.15,p/Math.max(o,.1)*.15),"Preparing sketch"),await wt(),l=performance.now())};r(0,"Preparing sketch"),await wt(),await E(o);const f=Math.max(1,Math.round(c.canvas.width*u)),w=Math.max(1,Math.round(c.canvas.height*u));if(f*w*s*a>16e7)throw new Error("This export is too large. Reduce duration, FPS, or choose half size.");const g=document.createElement("canvas");g.width=f,g.height=w;const y=g.getContext("2d",{willReadFrequently:!0});y.imageSmoothingEnabled=!1;const D=ss(),P=cs(s,a);for(let S=0;S<P.length;S++){x(),await E(o+S/a),y.fillStyle="#000",y.fillRect(0,0,f,w),y.drawImage(c.canvas,0,0,f,w);const R=y.getImageData(0,0,f,w).data,$=Jr(R,256),N=ts(R,$);if(D.writeFrame(N,f,w,{palette:$,delay:P[S],repeat:h?0:-1}),D.bytesView().length>24*1024*1024)throw new Error("GIF exceeds 24 MB. Try half size, fewer frames, or a shorter duration.");r(.15+(S+1)/P.length*.85,`Rendering frame ${S+1} of ${P.length}`),await wt(),l=performance.now()}return x(),D.finish(),{bytes:D.bytes(),width:f,height:w,frames:P.length,duration:s}}const v=e=>document.getElementById(e),Gi=v("app"),L=v("code"),Oe=v("example"),Ne=v("duration"),Ve=v("start"),je=v("fps"),nt=v("scale"),ot=v("loop"),Wi=v("run"),Re=v("pause"),Hi=v("restart"),Ye=v("export"),Ce=v("save-gif"),fe=v("save-draft"),Bt=[];let H=null,ce=!1,Ot=0,Xe=0,Se=0,_e=!1,Ze=0,zi="",q=null,te=null,Me=null,Ki=!1,Je=!1,He=!1,ut=Rt[0].credit;function J(e,t="idle"){v("status").textContent=e,v("status").dataset.kind=t}function Te(e){J(e instanceof Error?e.message:String(e),"error")}function ht(e){Gi.dataset.view=e,document.querySelectorAll(".view-tabs button").forEach(t=>t.setAttribute("aria-pressed",String(t.dataset.view===e)))}function Ee(){v("line-numbers").textContent=Array.from({length:L.value.split(`
`).length},(e,t)=>t+1).join(`
`),v("code-count").textContent=`${L.value.length.toLocaleString()} chars`,v("edit-state").textContent=_e?"Edited · press Run":"Ready to edit"}function Ft(){return{duration:Ne.valueAsNumber,start:Ve.valueAsNumber,fps:Number(je.value),scale:Number(nt.value),loop:ot.checked}}function ct(){const e=Ft();v("export-summary").textContent=Number.isFinite(e.duration)?`${Math.round(e.duration*e.fps)} frames`:""}function Fe(e){ce=e,Re.textContent=ce?"Ⅱ":"▶",Re.setAttribute("aria-label",ce?"Pause preview":"Resume preview"),Re.title=ce?"Pause preview":"Resume preview",v("play-state").textContent=ce?"Live preview":"Paused",v("live-dot").classList.toggle("paused",!ce)}function lt(e,t=!1){try{const i=new Oi(e);return i.step(),H=i,zi=e,Se=t?599:0,v("canvas-slot").replaceChildren(i.canvas),v("dimensions").textContent=`${i.canvas.width} × ${i.canvas.height}`,v("credit").textContent=ut,Xe=performance.now(),Fe(i.looping),_e=L.value!==e,Ee(),J("Preview running. Edit the code, then press Run.","ok"),!0}catch(i){return Fe(!1),Te(i),!1}}function Qi(e){if(Ot=requestAnimationFrame(Qi),!(!ce||!H||document.hidden||q)&&!(e-Xe<1e3/H.fps)){Xe=e;try{const t=Se>0?Math.min(6,Se):1;for(let i=0;i<t;i++)H.step();Se=Math.max(0,Se-t),v("frame-label").textContent=`FRAME ${String(H.frame).padStart(5,"0")}`,v("dimensions").textContent=`${H.canvas.width} × ${H.canvas.height}`,v("fps-label").textContent=`${H.fps} fps`,H.looping||Fe(!1)}catch(t){Fe(!1),Te(t)}}}function $t(e){var o;if(!(e!=null&&e.colors)||!["background","text","primary"].every(u=>typeof e.colors[u]=="string"))return;const t=document.documentElement.style;t.setProperty("--bg",e.colors.background),t.setProperty("--fg",e.colors.text),t.setProperty("--primary",e.colors.primary);const i=document.createElement("span");i.style.color=e.colors.primary,document.body.append(i);const r=(o=getComputedStyle(i).color.match(/[\d.]+/g))==null?void 0:o.slice(0,3).map(Number);i.remove();const s=r?r.reduce((u,h,c)=>u+(h/255<=.04045?h/255/12.92:((h/255+.055)/1.055)**2.4)*[.2126,.7152,.0722][c],0):1;t.setProperty("--accent-ink",s>.179?"#111111":"#ffffff");const a=e.colors.background.replace("#","");/^[\da-f]{6}$/i.test(a)&&(t.colorScheme=parseInt(a.slice(0,2),16)+parseInt(a.slice(2,4),16)+parseInt(a.slice(4,6),16)>400?"light":"dark")}function Yt(e){Je||(typeof e.duration=="number"&&(Ne.value=String(Math.min(30,Math.max(1,e.duration)))),typeof e.start=="number"&&(Ve.value=String(Math.min(30,Math.max(0,e.start)))),[10,15,20,25,30].includes(Number(e.fps))&&(je.value=String(e.fps)),ct()),Gi.classList.toggle("smooth",e.pixelated===!1),document.documentElement.style.setProperty("--pixel-rendering",e.pixelated===!1?"auto":"pixelated"),Ki=!0}function Xt(e){for(const t of[Wi,Re,Hi,Ye,fe])t.disabled=e;Oe.disabled=e,L.readOnly=e;for(const t of[Ne,Ve,je,nt,ot])t.disabled=e;v("cancel").hidden=!e,v("progress-area").hidden=!e}function $i(){Me&&URL.revokeObjectURL(Me),Me=null,te=null,v("gif-preview").removeAttribute("src"),v("result").hidden=!0}L.value=Rt[0].code;Ee();ct();document.querySelectorAll(".view-tabs button").forEach(e=>e.addEventListener("click",()=>ht(e.dataset.view)));L.addEventListener("input",()=>{_e=!0,Ze++,Oe.value="custom",ut="Custom sketch",Ee()});L.addEventListener("scroll",()=>{v("line-numbers").scrollTop=L.scrollTop});L.addEventListener("keydown",e=>{e.key==="Tab"&&(e.preventDefault(),L.setRangeText(" ",L.selectionStart,L.selectionEnd,"end"),L.dispatchEvent(new Event("input")))});Wi.addEventListener("click",()=>{lt(L.value)&&ht("preview")});Re.addEventListener("click",()=>{if(H){if(!H.looping){J("This sketch called noLoop(). Press Run to restart it.");return}Se=0,Fe(!ce)}});Hi.addEventListener("click",()=>{H&<(zi)});Oe.addEventListener("change",()=>{const e=Rt[Number(Oe.value)];e&&(L.value=e.code,ut=e.credit,Ze++,_e=!1,Ee(),lt(L.value,!0),ht("preview"))});for(const e of[Ne,Ve,je,nt,ot])e.addEventListener("input",()=>{Je=!0,ct()});v("help-toggle").addEventListener("click",()=>{v("help").hidden=!1,v("help-toggle").setAttribute("aria-expanded","true"),v("close-help").focus()});v("close-help").addEventListener("click",()=>{v("help").hidden=!0,v("help-toggle").setAttribute("aria-expanded","false"),v("help-toggle").focus()});v("help").addEventListener("keydown",e=>{e.key==="Escape"&&v("close-help").click()});v("settings").addEventListener("click",()=>{try{kt.openSettings()}catch(e){Te(e)}});fe.disabled=!ie("storage");fe.disabled&&(fe.title="Draft saving is unavailable in this host.");fe.addEventListener("click",async()=>{fe.disabled=!0;try{await Jt.setItem("sketch-loop:draft",JSON.stringify({code:L.value,options:Ft()})),J("Draft and export settings saved.","ok")}catch(e){Te(e)}finally{fe.disabled=!ie("storage")||!!q}});Ye.addEventListener("click",async()=>{if(!Ne.reportValidity()||!Ve.reportValidity()||q||He)return;const e=L.value,t=Ft();q=new AbortController,Xt(!0),$i(),ht("export"),J("Rendering your GIF. You can cancel at any time.");try{te=await ls(e,t,q.signal,(i,r)=>{v("progress").value=i,v("progress-label").textContent=`${r} · ${Math.round(i*100)}%`}),Me=URL.createObjectURL(new Blob([new Uint8Array(te.bytes)],{type:"image/gif"})),v("gif-preview").src=Me,v("result").hidden=!1,v("result-details").textContent=`${te.width} × ${te.height} · ${te.duration}s · ${(te.bytes.length/1024/1024).toFixed(2)} MB`,Ce.disabled=!ie("fs"),Ce.title=Ce.disabled?"This host does not support saving files.":"",J(ie("fs")?"GIF ready. Save it using the host’s file controls.":"GIF ready to preview. File saving is unavailable in this host.","ok")}catch(i){i instanceof DOMException&&i.name==="AbortError"?J("Export cancelled. Your sketch is unchanged."):Te(i)}finally{q=null,Xt(!1),fe.disabled=!ie("storage"),Xe=performance.now()}});v("cancel").addEventListener("click",()=>q==null?void 0:q.abort());Ce.addEventListener("click",async()=>{if(!(!te||He)){He=!0,Ce.disabled=!0,Ye.disabled=!0;try{const e=await mt.info();if(!Number.isFinite(e.limits.maxWriteBytes)||e.limits.maxWriteBytes<1)throw new Error("This host cannot write file bytes.");const i=(await mt.pickSaveFile({suggestedName:`sketch-${te.duration}s.gif`,description:"Save rendered GIF",permissions:["write"],accept:[{mime:"image/gif",extension:".gif"}]})).entries[0];if(!i||i.kind!=="file"||!i.permissions.includes("write"))throw new Error("The host did not grant a writable file.");const r=Math.min(e.limits.maxWriteBytes,256*1024),s=te.bytes;for(let a=0;a<s.length;a+=r){const o=s.subarray(a,Math.min(a+r,s.length));let u="";for(let c=0;c<o.length;c+=8192)u+=String.fromCharCode(...o.subarray(c,c+8192));if((await mt.write(i.path,btoa(u),{mode:a===0?"replace":"append"})).bytesWritten!==o.length)throw new Error("The host wrote only part of the GIF. Please save again.");J(`Saving GIF · ${Math.round((a+o.length)/s.length*100)}%`)}J(`Saved ${i.name}. Use the host’s file controls to download it.`,"ok")}catch(e){Te(e)}finally{He=!1,Ce.disabled=!1,Ye.disabled=!1}}});v("settings").hidden=!ie("config");v("capabilities").textContent=`Host features · ${["theme","storage","config","fs"].map(e=>`${e}: ${ie(e)?"available":"unavailable"}`).join(" · ")}`;if(ie("theme")){Promise.resolve().then(()=>ir()).then($t).catch(()=>{});try{Bt.push(rr($t))}catch{}}if(ie("config")){Promise.resolve().then(()=>kt.get()).then(e=>{Ki||Yt(e)}).catch(()=>{});try{Bt.push(kt.subscribe(Yt))}catch{}}lt(L.value,!0);Ot=requestAnimationFrame(Qi);if(ie("storage")){const e=Ze;Promise.resolve().then(()=>Jt.getItem("sketch-loop:draft")).then(t=>{if(!t||Ze!==e||q)return;const i=JSON.parse(t);if(!(typeof i.code!="string"||i.code.length>24e3)){if(L.value=i.code,Oe.value="custom",ut="Saved sketch",_e=!1,Ee(),i.options&&!Je){const r=i.options;Number.isFinite(r.duration)&&r.duration>=1&&r.duration<=30&&(Ne.value=String(r.duration)),Number.isFinite(r.start)&&r.start>=0&&r.start<=30&&(Ve.value=String(r.start)),[10,15,20,25,30].includes(r.fps)&&(je.value=String(r.fps)),[.5,1].includes(r.scale)&&(nt.value=String(r.scale)),typeof r.loop=="boolean"&&(ot.checked=r.loop),Je=!0,ct()}J("Saved draft restored. Press Run to preview it.","ok"),_e=!0,Ee()}}).catch(()=>{J("Draft restore unavailable. The example is ready to use.")})}window.addEventListener("pagehide",()=>{cancelAnimationFrame(Ot),q==null||q.abort(),Bt.forEach(e=>e.close()),$i()},{once:!0});
</script>
<style>:root{--bg: #141b1c;--fg: #edf2e9;--primary: #b9ed80;--surface: color-mix(in srgb, var(--bg) 94%, var(--fg));--raised: color-mix(in srgb, var(--bg) 89%, var(--fg));--border: color-mix(in srgb, var(--fg) 16%, var(--bg));--muted: color-mix(in srgb, var(--fg) 57%, var(--bg));--accent-ink: #111c17;--control-h: 28px;font:13px/1.45 Avenir Next,Segoe UI,sans-serif;color-scheme:dark}*{box-sizing:border-box}html,body,#app{height:100%;margin:0;background:var(--bg);color:var(--fg)}body{overflow:hidden}button,input,select,textarea{font:inherit;color:inherit}button,select,input{min-width:0;border:1px solid var(--border);border-radius:4px;background:var(--surface)}button,select{height:var(--control-h)}button{cursor:pointer;padding:0 9px;white-space:nowrap;display:inline-flex;align-items:center;justify-content:center;gap:6px}button:hover{background:var(--raised);border-color:var(--muted)}button:disabled{opacity:.45;cursor:default}button.primary{background:var(--primary);color:var(--accent-ink);border-color:transparent;font-weight:650}button.primary:hover{filter:brightness(1.08)}button:focus-visible,select:focus-visible,input:focus-visible,textarea:focus-visible{outline:2px solid var(--primary);outline-offset:-2px}[hidden]{display:none!important}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}#app{display:grid;grid-template-rows:auto minmax(0,1fr) auto;container-type:inline-size;position:relative}.toolbar{display:flex;justify-content:space-between;gap:8px;padding:8px;border-bottom:1px solid var(--border)}.toolbar-actions,.view-tabs{display:flex;align-items:center;gap:4px}.view-tabs{gap:0}.view-tabs button{border-color:transparent;background:transparent;color:var(--muted);border-radius:3px}.view-tabs button[aria-pressed=true]{color:var(--fg);background:var(--raised)}.toolbar-actions>button:not(.primary){min-width:28px;padding:0 6px}.workspace{min-height:0;min-width:0;display:grid;grid-template-columns:minmax(0,.95fr) minmax(0,1.3fr);grid-template-rows:minmax(100px,1fr) auto}.editor-pane{grid-row:1 / 3;display:flex;flex-direction:column;min-height:0;min-width:0;border-right:1px solid var(--border)}.pane-bar{display:flex;align-items:center;gap:8px;padding:8px 12px;min-width:0;min-height:44px;border-bottom:1px solid var(--border);font-size:12px}.pane-bar select{flex:1;border:0;padding:0;background:transparent}.pane-bar select option{background:var(--bg);color:var(--fg)}.pane-bar button{font-size:11px}.badge{font:10px/1.5 SFMono-Regular,Consolas,monospace;border:1px solid var(--border);color:var(--muted);padding:0 4px;border-radius:3px}.code-wrap{display:flex;flex:1;min-height:0;min-width:0;padding:12px 0;overflow:hidden;background:var(--surface)}#line-numbers{width:38px;flex-shrink:0;text-align:right;padding-right:9px;color:var(--muted);opacity:.65;overflow:hidden;-webkit-user-select:none;user-select:none;white-space:pre}textarea{flex:1;resize:none;min-width:0;width:100%;border:0;border-radius:0;background:transparent;padding:0 12px 8px 0;-moz-tab-size:2;tab-size:2}textarea,#line-numbers{font:12px/1.85 SFMono-Regular,Consolas,Liberation Mono,monospace}.editor-meta,.preview-meta{display:flex;justify-content:space-between;gap:8px;padding:6px 12px;color:var(--muted);font-size:10px;border-top:1px solid var(--border)}.preview-pane{display:flex;flex-direction:column;min-height:0;min-width:0}.live-dot{width:6px;height:6px;border-radius:50%;background:var(--primary);flex-shrink:0}.live-dot.paused{background:var(--muted)}.spacer{flex:1}.mono{font-family:SFMono-Regular,Consolas,monospace;font-size:10px}.stage{position:relative;flex:1;min-height:0;display:grid;place-items:center;overflow:hidden;padding:24px;background:var(--bg);background-image:radial-gradient(var(--border) .6px,transparent .6px);background-size:12px 12px}#canvas-slot{width:100%;height:100%;min-height:0;display:flex;justify-content:center;align-items:center}#canvas-slot canvas{display:block;width:100%;height:100%;object-fit:contain;image-rendering:var(--pixel-rendering, pixelated)}.frame-label{position:absolute;bottom:7px;right:10px;color:var(--muted);font-size:9px;letter-spacing:.06em}.preview-meta>span:first-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.preview-meta>span:last-child{flex-shrink:0}.export-pane{padding:12px;border-top:1px solid var(--border);min-width:0;overflow-y:auto;max-height:48vh}.export-top{display:flex;gap:8px;align-items:center;margin-bottom:12px}.section-label{font-weight:650}.export-description{color:var(--muted);font-size:11px;flex:1}.export-top button{margin-left:auto}.export-fields{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}.export-fields label{display:flex;flex-direction:column;gap:4px;font-size:11px;color:var(--muted)}.export-fields select{width:100%;padding:0 6px;color:var(--fg)}.input-unit{display:flex;align-items:center;position:relative}.input-unit input{width:100%;height:var(--control-h);padding:0 24px 0 8px;color:var(--fg);-webkit-appearance:textfield;-moz-appearance:textfield;appearance:textfield}.input-unit input::-webkit-inner-spin-button{-webkit-appearance:none;-moz-appearance:none;appearance:none}.input-unit span{position:absolute;right:7px;font-size:10px;color:var(--muted);pointer-events:none}.export-actions{display:flex;align-items:center;gap:8px;margin-top:12px;flex-wrap:wrap}.check-label{display:flex;align-items:center;gap:4px;font-size:11px}input[type=checkbox]{accent-color:var(--primary);margin:0}#export-summary{flex:1;color:var(--muted);text-align:right}.export-hint{font-size:10px;color:var(--muted);margin:10px 0 0;line-height:1.5}#status{font-size:11px;padding:5px 8px;border-top:1px solid var(--border);overflow-wrap:anywhere;max-height:80px;overflow-y:auto;color:var(--muted)}#status[data-kind=error]{color:var(--fg);background:color-mix(in srgb,#d85240 18%,var(--bg))}#status[data-kind=ok]{color:var(--fg)}#progress-area{margin-top:12px}progress{width:100%;height:5px;border:0;accent-color:var(--primary);display:block;margin-bottom:5px}#progress-label{color:var(--muted)}#result{display:flex;gap:12px;margin-top:12px;padding-top:12px;border-top:1px solid var(--border)}#gif-preview{width:35%;height:85px;object-fit:contain;background:#000}.result-info{display:flex;flex-direction:column;align-items:flex-start;justify-content:center;gap:4px;min-width:0}#result-details{color:var(--muted)}#help{position:absolute;top:0;right:0;bottom:0;left:0;background:var(--bg);z-index:4;display:flex;flex-direction:column}#help .pane-bar{justify-content:space-between}.help-content{padding:0 12px 12px;overflow-y:auto;font-size:12px}.help-content p{margin:12px 0}.help-content code{font-size:11px}@media(min-width:1100px){.workspace{grid-template-columns:minmax(0,.85fr) minmax(0,1.5fr)}.stage{padding:32px}textarea,#line-numbers{font-size:13px}}@media(max-width:639px),(max-height:399px){.workspace{display:block}.editor-pane,.preview-pane,.export-pane{height:100%;max-height:none;border-right:0}#app[data-view=preview] .editor-pane,#app[data-view=preview] .export-pane,#app[data-view=editor] .preview-pane,#app[data-view=editor] .export-pane,#app[data-view=export] .editor-pane,#app[data-view=export] .preview-pane{display:none}.stage{padding:12px}.export-fields{grid-template-columns:repeat(2,minmax(0,1fr))}.export-pane{border-top:0}}@media(max-width:479px){.toolbar .label{display:none}.toolbar{gap:4px}.toolbar button{min-width:28px;padding:0 7px}}@media(max-width:239px){.toolbar{padding:4px}.toolbar-actions,.view-tabs{gap:1px}.toolbar button{padding:0 4px;min-width:24px}#help-toggle{display:none}.pane-bar{padding:4px 8px;min-height:32px}.badge,.editor-meta,.preview-meta,.export-description,#export-summary{display:none}.export-pane{padding:8px}.export-actions{justify-content:space-between}#status{font-size:10px;padding:2px 4px;max-height:28px}}@media(max-height:249px){.pane-bar,.preview-meta,.editor-meta{display:none}.stage{padding:4px 8px}.toolbar{padding-top:4px;padding-bottom:4px}.frame-label{display:none}#status{max-height:25px}}
</style>
<meta name="napplet-type" content="sketch-loop">
<meta name="napplet-config-schema" content="{"$schema":"http://json-schema.org/draft-07/schema#","$version":1,"type":"object","additionalProperties":false,"properties":{"duration":{"type":"number","title":"Default GIF duration (seconds)","minimum":1,"maximum":30,"default":5,"x-napplet-section":"GIF defaults","x-napplet-order":1},"start":{"type":"number","title":"Default start time (seconds)","description":"Let accumulating sketches develop before recording.","minimum":0,"maximum":30,"default":5,"x-napplet-section":"GIF defaults","x-napplet-order":2},"fps":{"type":"integer","title":"Default GIF frame rate","enum":[10,15,20,25,30],"default":15,"x-napplet-section":"GIF defaults","x-napplet-order":3},"pixelated":{"type":"boolean","title":"Crisp pixel preview","description":"Disable to smooth enlarged artwork.","default":true,"x-napplet-section":"Preview"}}}">
</head>
<body>
<div id="app" data-view="preview">
<nav class="toolbar" aria-label="Sketch controls">
<div class="view-tabs" aria-label="Workspace view">
<button data-view="editor" title="Edit sketch" aria-label="Edit sketch"><span aria-hidden="true">{ }</span><span class="label">Code</span></button>
<button data-view="preview" title="Live preview" aria-label="Live preview" aria-pressed="true"><span aria-hidden="true">◉</span><span class="label">Preview</span></button>
<button data-view="export" title="GIF export" aria-label="GIF export"><span aria-hidden="true">▤</span><span class="label">GIF</span></button>
</div>
<div class="toolbar-actions">
<button id="run" class="primary" title="Run edited sketch" aria-label="Run edited sketch"><span aria-hidden="true">▶</span><span class="label">Run</span></button>
<button id="pause" title="Pause preview" aria-label="Pause preview">Ⅱ</button>
<button id="restart" title="Restart at frame 1" aria-label="Restart at frame 1">↺</button>
<button id="help-toggle" title="Help and supported APIs" aria-label="Help and supported APIs" aria-expanded="false">?</button>
</div>
</nav>
<main class="workspace">
<section class="editor-pane" aria-label="Sketch editor">
<div class="pane-bar">
<label class="sr-only" for="example">Example sketch</label>
<select id="example"><option value="0">BusyMozaic</option><option value="1">Orbit study</option><option value="2">Ribbon field</option><option value="custom" hidden>Custom sketch</option></select>
<span class="badge">2D</span>
<button id="save-draft" title="Save code and export settings">Save draft</button>
</div>
<div class="code-wrap"><div id="line-numbers" aria-hidden="true"></div><textarea id="code" aria-label="Sketch source code" spellcheck="false" autocapitalize="off" autocomplete="off" autocorrect="off" wrap="off" maxlength="24000"></textarea></div>
<div class="editor-meta"><span id="edit-state">Ready to edit</span><span id="code-count"></span></div>
</section>
<section class="preview-pane" aria-label="Artwork preview">
<div class="pane-bar"><span class="live-dot" id="live-dot"></span><span id="play-state">Live preview</span><span class="spacer"></span><span id="dimensions" class="mono">450 × 300</span></div>
<div id="stage" class="stage"><div id="canvas-slot"></div><div id="frame-label" class="frame-label mono">FRAME 00000</div></div>
<div class="preview-meta"><span id="credit"></span><span id="fps-label" class="mono">60 fps</span></div>
</section>
<section class="export-pane" aria-label="GIF export settings">
<div class="export-top"><span class="section-label">Make a GIF</span><span class="export-description">Your code, frame by frame.</span><button id="settings" title="Open export defaults" aria-label="Open export defaults">⚙</button></div>
<div class="export-fields">
<label>Duration<div class="input-unit"><input id="duration" type="number" min="1" max="30" step="0.1" value="5" required /><span>sec</span></div></label>
<label>Start at<div class="input-unit"><input id="start" type="number" min="0" max="30" step="0.1" value="5" required /><span>sec</span></div></label>
<label>Frame rate<select id="fps"><option>10</option><option selected>15</option><option>20</option><option>25</option><option>30</option></select></label>
<label>Size<select id="scale"><option value="1">Original</option><option value="0.5">Half size</option></select></label>
</div>
<div class="export-actions"><label class="check-label"><input id="loop" type="checkbox" checked />Repeat GIF</label><span id="export-summary" class="mono"></span><button id="export" class="primary">Render GIF <span aria-hidden="true">↗</span></button><button id="cancel" hidden>Cancel</button></div>
<div id="progress-area" hidden><progress id="progress" max="1" value="0"></progress><span id="progress-label" class="mono"></span></div>
<div id="result" hidden><img id="gif-preview" alt="Rendered animated GIF" /><div class="result-info"><strong>GIF ready</strong><span id="result-details" class="mono"></span><button id="save-gif" class="primary">Save GIF ↓</button></div></div>
<p class="export-hint">Start at 0 for the first frame. Use a later start to let accumulating sketches fill in. Repeating does not guarantee a seamless loop.</p>
</section>
</main>
<output id="status" role="status" aria-live="polite">Loading sketch…</output>
<aside id="help" hidden aria-label="Sketch help">
<div class="pane-bar"><strong>Sketch guide</strong><button id="close-help" aria-label="Close help">×</button></div>
<div class="help-content">
<p>Paste a self-contained 2D p5-style sketch, then press <strong>Run</strong>. The editor accepts <code>draw = _ => { … }</code> and <code>function setup() / draw()</code>. Code runs only when you press Run; edits are used by the next GIF export.</p>
<p><strong>Drawing</strong><br>createCanvas, background, clear, fill, stroke, noFill, noStroke, strokeWeight, strokeCap, rect, square, ellipse, circle, line, point, triangle, beginShape, vertex, bezierVertex, endShape, text, textSize.</p>
<p><strong>Color & motion</strong><br>color, colorMode (RGB / HSB / HSL), translate, rotate, scale, push, pop, resetMatrix, rectMode, ellipseMode (CENTER / CORNER / RADIUS), angleMode, frameCount, frameRate, millis, noLoop, loop.</p>
<p><strong>Math</strong><br>sin, cos, tan, abs, floor, ceil, round, sqrt, pow, min, max, map, constrain, lerp, dist, random, randomSeed, noise, noiseSeed, PI, TWO_PI and Math. Noise is deterministic value noise.</p>
<p>This is a bounded 2D subset, not the full p5.js library. Assets, WebGL, DOM, imports, async code, classes, array methods and browser APIs are unavailable. Errors stop the sketch so you can edit it. Canvas size is limited to 1,024 × 1,024.</p>
<p>GIF export starts from fresh code with a fixed random seed. The sketch runs at 60 fps unless it sets frameRate(); export FPS samples that animation. Transparent pixels are exported on black.</p>
<p id="capabilities"></p><p>BusyMozaic example by Kurt Moerman (@KurtMoerman4), supplied with the project brief.</p>
</div>
</aside>
</div>
</body>
</html>