coffee-ahk
Version:
coffeescript -> ahk
30 lines • 86.2 kB
JavaScript
import{glob as Qr}from"fire-keeper";var U="0.0.98";import{compile as br}from"coffeescript";var Gn=t=>{let{content:e,type:n}=t;return n==="@"?(e.push({type:"this",value:"this"}),!0):n==="::"?(e.at(-1)?.is(".")&&e.pop(),e.push({type:".",value:"."},{type:"prototype",value:"::"}),!0):!1},ye=Gn;var Rn=t=>{let{content:e,scope:n,type:o}=t;return o==="["?(n.push("array"),e.push({type:"edge",value:"array-start"}),!0):o==="]"?(n.pop(),e.push({type:"edge",value:"array-end"}),!0):!1},he=Rn;var $n=t=>{let{content:e,type:n,value:o}=t;return n==="bool"?(e.push({type:"boolean",value:o}),!0):!1},ge=$n;var On=t=>{let{content:e,type:n,value:o}=t;return n==="("||n===")"?(e.push({type:"bracket",value:o}),!0):!1},Ae=On;var jn=t=>{let{content:e,scope:n,type:o,value:r}=t;return o==="class"?(n.next="class",e.push({type:"class",value:r}),!0):o==="super"?(e.push({type:"super",value:"super"}),!0):!1},Se=jn;import{trim as Nn}from"radash";var Hn=t=>{let{content:e,token:n}=t;if(n.comments){let o=[],i=n[2]?.first_line;n.comments.forEach(a=>{let p=a.locationData?.first_line,f=typeof i=="number"&&typeof p=="number"&&p!==i?"STANDALONE:":"INLINE:",u=a.content;u&&Nn(u,`
`).split(`
`).forEach(m=>o.push(f+m))});let s=e.at(-1);return s&&(s.comment=o),!0}return!1},Ce=Hn;var Bn=t=>{let{content:e,type:n}=t;return n==="do"||n==="do_iife"?(e.push({type:"native",value:"__mark:do__"}),!0):!1},ve=Bn;var E="\u2113type";var b="\u2113this",Y="\u2113array",_e="\u2113object";var d=class extends Error{constructor(e,n,o){let r=e.token[2].first_line+1;super(`Coffee-AHK/${n} (line ${r}): ${o}`),this.name="TranspileError"}},_=(t,e)=>new Error(`Coffee-AHK/${t}: ${e}`);var Kn=t=>{let{content:e,scope:n,type:o,value:r}=t;if(o==="for")return n.push("for"),e.push({type:"for",value:"for"}),!0;if(["forin","forof"].includes(o)){let i=[],s=e.pop();if(s?.is("edge","array-end"))throw new d(t,"unsupported","for loop destructuring 'for [a, b] in arr' is not supported. Use 'for item in arr' then '[a, b] = item'.");if(s&&i.push(s.value),e.at(-1)?.is("sign",",")){e.pop();let p=e.pop();p&&i.unshift(p.value)}return o==="forin"&&i.reverse(),i.length===1&&i.unshift(o==="forin"?"\u2113i":"\u2113k"),e.push({type:"identifier",value:i[0]??""},{type:"sign",value:","},{type:"identifier",value:i[1]??""},{type:"for-in",value:r}),!0}return!1},xe=Kn;var Vn=["..","?","?.","bin?","from","func_exist","import",">>>"],Un=t=>{let{type:e}=t;if(Vn.includes(e))throw new d(t,"forbidden",`token type '${e}' is not supported in CoffeeScript\u2192AHK transpilation.`);if(e==="post_if")throw new d(t,"forbidden","post-if syntax is not supported. Use standard if/else.");if(e==="relation"){let{value:n}=t;if(n==="in")throw new d(t,"forbidden","'in' operator is not supported. Use 'for...in' for iteration.")}if(e==="await")throw new d(t,"unsupported","'await' is not supported. AHK v1 has no async/await support.");if(e==="yield")throw new d(t,"unsupported","'yield' is not supported. AHK v1 has no generator support.");return!1},be=Un;var z=class t{#e=[];next="";constructor(...e){this.reload(...e)}get first(){return this.at(0)??""}get last(){return this.at(-1)??""}get length(){return this.#e.length}toArray(){return[...this.#e]}at(e){return this.#e.at(e)}isEqual(e){return e instanceof t?this.#e.length!==e.length?!1:this.#e.every((n,o)=>n===e.at(o)):this.#e.length===e.length&&this.#e.every((n,o)=>n===e[o])}includes(e){return this.#e.includes(e)}pop(){return this.#e.pop()}push(...e){return this.#e.push(...e)}reload(e=[]){this.#e=e instanceof t?e.toArray():[...e]}shift(){return this.#e.shift()}slice(...e){return this.#e.slice(...e)}unshift(...e){return this.#e.unshift(...e)}},I=z;var q=class t{comment;scope;type;value;constructor(e){if(e instanceof t){this.type=e.type,this.value=e.value,this.scope=new I(e.scope),e.comment&&(this.comment=[...e.comment]);return}this.type=e.type,this.value=e.value,this.scope=new I(e.scope),e.comment&&(this.comment=[...e.comment])}clone(){return new t(this)}is(e,n){return e!==this.type?!1:typeof n>"u"?!0:n===this.value}},c=q;var Ie=(t,e=t.content.length-1)=>{let{content:n}=t,o=n.at(e);return o?o.is("edge","parameter-start")?e:Ie(t,e-1):0},we=(t,e)=>{let{content:n,scope:o,token:r,warnings:i}=t;if(e==="=>"&&!o.includes("class")){let a=r[2].first_line+1;i.push(`line ${a}: '=>' outside class has no meaningful 'this' binding in AHK`)}if(e==="=>")for(let a=n.length-1;a>=0;a--){let p=n.at(a);if(p?.is("native","__mark:do__")){p.value="__mark:do-fat__";break}if(p?.is("new-line")||p?.is("edge"))break}let s=o.at(-1)==="class"||o.at(-1)==="parameter"&&o.at(-2)==="class";if(!n.at(-1)?.is("edge","parameter-end"))n.at(-2)?.is("property","constructor")||n.push({type:"identifier",value:"anonymous"}),o.push("parameter"),e==="=>"&&!s?n.push({type:"edge",value:"parameter-start"},{type:"identifier",value:b},{type:"edge",value:"parameter-end"}):n.push({type:"edge",value:"parameter-start"},{type:"edge",value:"parameter-end"}),o.pop();else if(e==="=>"&&!s){let a=[...o.toArray(),"parameter"];n.toArray().splice(Ie(t)+1,0,new c({type:"identifier",value:b,scope:a}),new c({type:"sign",value:",",scope:a}))}return o.push("function"),!0};var Te=t=>{let{scope:e}=t,{next:n}=e;return e.next="",e.push("call"),e.next=n,t.content.push({type:"edge",value:"call-start"}),!0},Me=t=>{let{content:e,scope:n}=t,o=[e.at(-3),e.at(-2),e.at(-1)];if(o[0]?.is("identifier","Native")&&o[1]?.is("edge","call-start")&&o[2]?.is("string")){e.pop(),e.pop(),e.pop(),o[2].scope.pop(),o[2].type="native";let{value:r}=o[2];return o[2].value=r.substring(1,r.length-1).replace(/`%/g,"%").replace(/""/g,'"'),e.push(o[2]),n.pop(),!0}return e.push({type:"edge",value:"call-end"}),n.pop(),!0};var ke=t=>{let{content:e,scope:n}=t;return e.at(-2)?.is("property","constructor")||e.push({type:"identifier",value:"anonymous"}),n.push("parameter"),e.push({type:"edge",value:"parameter-start"}),!0},Fe=t=>(t.content.push({type:"edge",value:"parameter-end"}),t.scope.pop(),!0);var Yn=t=>{let{type:e}=t;return["->","=>"].includes(e)?we(t,e):e==="call_start"?Te(t):e==="call_end"?Me(t):e==="param_start"?ke(t):e==="param_end"?Fe(t):!1},De=Yn;var zn=t=>{let{content:e,type:n,value:o}=t;if(n==="identifier"){if(e.at(-1)?.type==="class"){if(!/^[A-Z]/.test(o))throw new d(t,"class-case",`class name '${o}' must start with an uppercase letter.`);if(o.length===1)throw new d(t,"class-single-letter",`class name '${o}' is a single letter, which is forbidden in AHK v1. Class names must be at least 2 characters.`);return t.cache.classNames.add(o),e.push({type:"identifier",value:o}),!0}return t.cache.identifiers.add(o),e.push({type:"identifier",value:o}),!0}return!1},Ee=zn;var qn=t=>{let{content:e,scope:n,type:o,value:r}=t;return o==="if"?(n.next="if",e.push({type:"if",value:"if"}),r==="unless"&&e.push({type:"logical-operator",value:"!"}),e.push({type:"edge",value:"expression-start"}),!0):o==="else"?n.last==="switch"?(n.push("case"),e.push({type:"new-line",value:t.indent.toString()},{type:"if",value:"default"}),!0):(n.next="else",e.push({type:"if",value:"else"}),!0):!1},Le=qn;var Xn=t=>{let{content:e,scope:n}=t;return!!(e.at(-1)?.is("sign","=")||["array","call","object","parameter"].includes(n.last))},Jn=t=>{let{content:e,scope:n}=t,{last:o}=n;["case","for","function","switch"].includes(o)&&(["catch","class","else","if","while"].includes(n.next)||(o==="case"&&e.push({type:"sign",value:":"}),e.push({type:"edge",value:"block-start"})))},Zn=t=>{let{content:e,scope:n}=t;if(["catch","class","else"].includes(n.next)){let o=n.next;n.next="",n.push(o),e.push({type:"edge",value:"block-start"})}if(["if","while"].includes(n.next)){let o=n.next;n.next="",n.push(o),e.push({type:"edge",value:"expression-end"},{type:"edge",value:"block-start"})}},Qn=t=>{Xn(t)||(t.indent++,Jn(t),Zn(t),t.content.push({type:"new-line",value:t.indent.toString()}))},eo=t=>{let{content:e,scope:n}=t,o=e.at(-1);if(o?.is("bracket","}-")){o.value="}";return}["array","call","object","parameter"].includes(n.last)||(t.indent--,n.length&&(e.push({type:"new-line",value:t.indent.toString()},{type:"edge",value:"block-end"}),n.pop()))},to=t=>{let{type:e}=t;return e==="indent"?(Qn(t),!0):e==="outdent"?(eo(t),!0):!1},We=to;var no=t=>{let{content:e,type:n}=t;return n==="export"?(e.push({type:"statement",value:"export"}),!0):!1},Pe=no;var oo=t=>{let{content:e,type:n,value:o}=t;return n==="js"?(e.push({type:"native",value:o}),!0):!1},Ge=oo;var Re=t=>{let e=t.at(-1);e?.is("bracket","}-")&&(e.value="}")},ro=(t,e)=>["array","call","object","parameter"].includes(e.last)?(t.at(-1)?.is("sign",",")||(t.at(-1)?.is("new-line")&&t.pop(),t.push({type:"sign",value:","})),!0):!1,io=t=>{let{content:e,scope:n}=t;return Re(e),ro(e,n)||e.push({type:"new-line",value:t.indent.toString()}),!0},so=t=>{let{content:e}=t;return Re(e),e.push({type:"new-line",value:t.indent.toString()}),!0},ao=t=>{let{type:e,value:n}=t;if(e==="terminator"){if(n===`
`)return io(t);if(n===";")return so(t)}return!1},$e=ao;var po=t=>{let{content:e,type:n}=t;return["nan","null","undefined"].includes(n)?(e.push({type:"string",value:'""'}),!0):!1},Oe=po;var lo=t=>{let{content:e,type:n,value:o}=t;if(n==="number"){let r=o;if(o.includes("n"))throw new d(t,"forbidden",`'BigInt' literal is not supported in AHK v1. Offending value: '${o}'`);if(o.includes("_")&&(r=r.replace(/_/g,"")),o.includes("e")){let i=r.split("e"),s=i.at(0),a=i.at(1);s&&a&&(r=`${s}${"0".repeat(parseInt(a,10))}`)}return e.push({type:"number",value:r}),!0}return!1},je=lo;var co=t=>{let{content:e,scope:n,token:o,type:r}=t;return r==="{"?(n.last==="class"&&!e.at(-1)?.is("sign","=")||(e.at(-1)?.is("new-line")&&o.generated&&e.pop(),n.push("object"),e.push({type:"bracket",value:"{"})),!0):r==="}"?(n.last==="class"||(o.generated&&typeof o.origin?.indentSize=="number"?e.push({type:"bracket",value:"}-"}):e.push({type:"bracket",value:"}"}),n.pop()),!0):!1},Ne=co;var uo=t=>{let{content:e,token:n}=t;if(!n.spaced){let o=e.at(-1);if(o?.type==="math"||o?.type==="negative")return o.type==="negative"&&(o.type="math"),e.push({type:"negative",value:"+"}),!0}return e.push({type:"math",value:"+"}),!0},fo=t=>{let{content:e,token:n}=t;if(!n.spaced){let o=e.at(-1);if(o&&!["identifier","math"].includes(o.type))return o.type==="negative"&&(o.type="math"),e.push({type:"negative",value:"-"}),!0}return e.push({type:"math",value:"-"}),!0},mo=t=>{let{content:e,type:n,value:o}=t;if(n==="unary"&&o==="typeof")return t.flag.isTypeofUsed=!0,e.push({type:"identifier",value:`${E}_${t.options.salt}`},{type:"edge",value:"typeof-start"}),!0;if(n==="unary"&&o==="delete")throw new d(t,"forbidden","'delete' is not supported in AHK.");return n==="unary"&&o==="!"?(e.push({type:"logical-operator",value:"!"}),!0):n==="unary_math"?(o==="~"?e.push({type:"math",value:"~"}):o==="!"&&e.push({type:"logical-operator",value:"!"}),!0):!1},yo=t=>{let{content:e,type:n,value:o}=t;if(n==="+")return uo(t);if(n==="-")return fo(t);if(n==="++")return e.push({type:"++",value:"++"}),!0;if(n==="--")return e.push({type:"--",value:"--"}),!0;if(n==="**")return e.push({type:"math",value:"**"}),!0;if(n==="&&"||n==="||")return e.push({type:"logical-operator",value:o}),!0;if(n==="unary"||n==="unary_math")return mo(t);if(n==="compare")return e.push({type:"compare",value:o}),!0;if(n==="compound_assign"){if(o==="||="||o==="?="||o==="&&=")throw new d(t,"forbidden",`compound assignment '${o}' is not supported. Only standard assignments are allowed.`);if(o==="//=")throw new d(t,"forbidden","floor division assignment '//=' is not supported (conflicts with AHK comments).");if(o==="%%=")throw new d(t,"forbidden","modulo assignment '%%=' is not supported. Use 'x := Mod(x, b)' instead.");return e.push({type:"math",value:o}),!0}if(n==="math"){if(o==="//")throw new d(t,"forbidden","floor division '//' is not supported (conflicts with AHK comments). Use 'Math.floor(a / b)' instead.");if(o==="%")throw new d(t,"forbidden","modulo '%' is not supported (conflicts with AHK variable syntax). Use 'Mod(a, b)' instead.");if(o==="%%")throw new d(t,"forbidden","modulo '%%' is not supported. Use 'Mod(a, b)' instead.");return e.push({type:"math",value:o}),!0}if(n==="&"||n==="|"||n==="^"||n==="shift"){if(o===">>>"||o===">>>=")throw new d(t,"unsupported",`unsigned right shift '${o}' is not supported in AHK. Use '>>' instead.`);return e.push({type:"math",value:o}),!0}return n==="relation"&&o==="instanceof"?(e.push({type:".",value:"."},{type:"property",value:"__Class"},{type:"compare",value:"=="},{type:"edge",value:"instanceof-class"}),!0):!1},He=yo;var ho=t=>{let{content:e,type:n,value:o,scope:r}=t;if(n===".")return e.push({type:".",value:"."}),!0;if(n==="index_start")return e.at(-1)?.type==="."&&e.pop(),e.push({type:"edge",value:"index-start"}),!0;if(n==="index_end")return e.push({type:"edge",value:"index-end"}),!0;if(n==="property"){let i=e.at(-1)?.type;if(i==="this"&&r.includes("class")&&r.includes("parameter"))throw new d(t,"invalid-syntax",`Using 'this.${o}' in constructor parameters creates invalid AHK syntax. AHK function parameters must be simple variable names, not property accesses. Solution: Use constructor: (name) -> @name = name instead.`);return i&&["prototype","this"].includes(i)&&e.push({type:".",value:"."}),e.push({type:"property",value:o}),!0}return!1},Be=ho;var go=t=>{let{content:e,scope:n,type:o}=t;if(o==="..."){if(!["call","parameter"].includes(n.last))throw new d(t,"forbidden",`spread operator '...' is only allowed in function calls or parameter lists. Context: ${n.last}`);e.push({type:"sign",value:"..."})}if(o==="="){let r=e.at(-1);if(r?.type==="identifier"&&t.cache.classNames.has(r.value))throw new d(t,"class-case",`cannot assign to class name '${r.value}'. Please use a different identifier for variables.`);return e.push({type:"sign",value:"="}),!0}return o===","?(e.push({type:"sign",value:","}),!0):o===":"?n.last==="class"?(e.push({type:"sign",value:"="}),!0):(e.push({type:"sign",value:":"}),!0):!1},Ke=go;var Ao=t=>{let{content:e,type:n,value:o}=t;return n==="extends"?(e.push({type:"statement",value:"extends"}),!0):n==="return"?(e.push({type:"statement",value:"return"}),!0):n==="this"?(e.push({type:"this",value:"this"}),!0):n==="throw"?(e.push({type:"statement",value:"throw"}),!0):n==="statement"&&(o==="break"||o==="continue")?(e.push({type:"statement",value:o}),!0):n==="unary"&&o==="new"?(e.push({type:"statement",value:"new"}),!0):!1},Ve=Ao;var So=t=>{let{content:e,token:n,type:o,value:r}=t;return o==="string"?(e.push({type:"string",value:Co(r,n[1].quote??"")}),!0):o==="interpolation_start"?(e.push({type:"edge",value:"interpolation-start"}),!0):o==="interpolation_end"?(e.push({type:"edge",value:"interpolation-end"}),!0):!1},Co=(t,e)=>{let n=t.substring(1,t.length-1);return n=n.replace(/%/g,"`%").replace(/\\b/g,"`b").replace(/\\n/g,"`n").replace(/\\r/g,"`r").replace(/\\t/g,"`t"),n=`"${n.replace(/"/g,'""')}"`,n=e.length===3?n.replace(/\s*\n\s*/g,""):n.replace(/\s*\n\s*/g," "),n},Ue=So;var vo=t=>{let{content:e,scope:n,type:o}=t;return o==="switch"?(n.push("switch"),e.push({type:"if",value:"switch"}),!0):o==="leading_when"?(n.push("case"),e.push({type:"if",value:"case"}),!0):!1},Ye=vo;var _o=t=>{let{content:e,scope:n,type:o}=t;return o==="catch"?(n.next="catch",e.push({type:"try",value:"catch"}),!0):o==="finally"?(e.push({type:"try",value:"finally"}),n.push("finally"),e.push({type:"edge",value:"block-start"}),!0):o==="try"?(e.push({type:"try",value:"try"}),n.push("try"),e.push({type:"edge",value:"block-start"}),!0):!1},ze=_o;var xo=t=>{let{content:e,scope:n,type:o}=t;return o==="loop"?(n.next="while",e.push({type:"while",value:"while"},{type:"edge",value:"expression-start"},{type:"boolean",value:"true"}),!0):o==="while"?(n.next="while",e.push({type:"while",value:"while"},{type:"edge",value:"expression-start"}),!0):o==="until"?(n.next="while",e.push({type:"while",value:"while"},{type:"logical-operator",value:"!"},{type:"edge",value:"expression-start"}),!0):!1},qe=xo;var X={"new-line":$e,alias:ye,array:he,boolean:ge,bracket:Ae,class:Se,comment:Ce,do:ve,for:xe,forbidden:be,function:De,if:Le,indent:We,identifier:Ee,module:Pe,native:Ge,nil:Oe,number:je,object:Ne,operator:He,property:Be,sign:Ke,statement:Ve,string:Ue,switch:Ye,try:ze,while:qe},bo=t=>{for(let e of Object.keys(X))if(e!=="comment"&&X[e](t))break;X.comment(t)},Xe=bo;var J=class{#e=[];scope;constructor(e){this.scope=e}get length(){return this.#e.length}*[Symbol.iterator](){yield*this.#e}toArray(){return[...this.#e]}at(e){return this.#e.at(e)}pop(){return this.#e.pop()}push(...e){for(let n of e){let o=n instanceof c?n:new c(n);o.scope.length||o.scope.reload(this.scope),this.#e.push(o)}return this}reload(e=this.#e){return this.#e=e.filter(n=>!n.is("void")),this}shift(){return this.#e.shift()}unshift(...e){for(let n of e.reverse()){let o=n instanceof c?n:new c(n);o.scope.length||o.scope.reload(this.scope),this.#e.unshift(o)}return this}slice(e,n){return this.#e.slice(e,n)}splice(e,n=0,...o){let r=o.map(i=>{let s=i instanceof c?i:new c(i);return s.scope.length||s.scope.reload(this.scope),s});return this.#e.splice(e,n,...r)}},Je=J;var W=(t,e,n,o,r=[])=>{let{content:i}=t,s=i.at(n);return s?(r.push(s),s.is("edge","index-start")&&s.scope.isEqual(e.scope)?(o.value++,W(t,e,n+1,o,r)):s.is("edge","index-end")&&s.scope.isEqual(e.scope)?(o.value--,o.value===0?[n,r]:W(t,e,n+1,o,r)):W(t,e,n+1,o,r)):(o.value=0,[n,r])};var Ze=t=>{if(t.length!==1)return null;let e=t.at(0);if(e?.type!=="number")return null;let n=Number(e.value);return!Number.isInteger(n)||n<0?null:n},Qe=(t,e,n,o)=>{o(t,[new c({type:"number",value:String(e+1),scope:n})])},et=(t,e,n,o,r)=>{t.flag.isChangeIndexUsed=!0;let i=[...n],s=i.at(0);if(!s)return;let a=s.scope,p=new I([...a.toArray(),"call"]);r(e,[new c({type:"identifier",value:`${"\u2113ci"}_${t.options.salt}`,scope:a}),new c({type:"edge",value:"call-start",scope:p}),...o.map(l=>l.clone()),new c({type:"sign",value:",",scope:p}),...i,new c({type:"edge",value:"call-end",scope:p})])};var tt=(t,e,n)=>{let{content:o}=t,r=o.toArray();r.splice(e[0],e[1]-e[0]+1,...n),o.reload(r)};var Io=(t,e)=>{let n=[],o=e;for(;o>=0;){let r=t.at(o);if(!r)break;if(r.type==="identifier"||r.type==="property"||r.type===".")n.unshift(r),o--;else if(r.is("edge","index-end")){let i=1,s=o-1;for(;s>=0&&i>0;){let a=t.at(s);a?.is("edge","index-end")?i++:a?.is("edge","index-start")&&i--,s--}for(let a=o;a>=s+1;a--){let p=t.at(a);p&&n.unshift(p)}o=s}else break}return n},wo=t=>t.some(e=>e.type==="string"),nt=t=>{let e=[];for(let n=0;n<t.length;n++)t.at(n)?.is("edge","index-start")&&e.push(n);return e},To=t=>{let{content:e}=t,n=`${"\u2113ci"}_${t.options.salt}`,o={value:0},r=new WeakSet,i=(a,p)=>{tt(t,a,p)},s=nt(e);for(;s.length>0;){let a=s.pop();if(a===void 0)break;let p=e.at(a);if(!p?.is("edge","index-start")||r.has(p))continue;let l=e.at(a+1);if(!l||l.is("identifier",n)||l.is("edge","index-end"))continue;let[f,u]=W(t,p,a,o),m=u.slice(1,u.length-1);if(wo(m))continue;let y=Ze(m);if(y!==null){let A=m.at(0);A&&(Qe([a+1,f-1],y,A.scope,i),r.add(p));continue}let C=Io(e,a-1);C.length!==0&&(et(t,[a+1,f-1],m,C,i),s=nt(e))}},ot=To;var rt=["abstract","arguments","async","await","boolean","break","byte","case","catch","char","class","const","continue","debugger","default","delete","do","double","else","enum","eval","export","extends",!1,"final","finally","float","for","function","goto","if","implements","import","in","instanceof","int","interface","let","long","native","new",null,"package","private","promise","protected","public","return","short","static","super","switch","synchronized","this","throw","throws","transient",!0,"try","typeof","var","void","volatile","while","with","yield","any","as","bigint","keyof","never","number","object","readonly","string","symbol","type","undefined","unique","unknown","and","or","not","is","isnt","of","then","unless","until","when","yes","no","on","off","A_AhkPath","A_AhkVersion","A_AppData","A_AppDataCommon","A_AutoTrim","A_BatchLines","A_CaretX","A_CaretY","A_ComputerName","A_ControlDelay","A_Cursor","A_DD","A_DDD","A_DDDD","A_DefaultMouseSpeed","A_Desktop","A_DesktopCommon","A_DetectHiddenText","A_DetectHiddenWindows","A_EndChar","A_EventInfo","A_ExitReason","A_FormatFloat","A_FormatInteger","A_Gui","A_GuiEvent","A_GuiControl","A_GuiControlEvent","A_GuiHeight","A_GuiWidth","A_GuiX","A_GuiY","A_Hour","A_IconFile","A_IconHidden","A_IconNumber","A_IconTip","A_Index","A_IPAddress1","A_IPAddress2","A_IPAddress3","A_IPAddress4","A_Is64bitOS","A_IsAdmin","A_IsCompiled","A_IsCritical","A_IsPaused","A_IsSuspended","A_IsUnicode","A_KeyDelay","A_Language","A_LastError","A_LineFile","A_LineNumber","A_LoopField","A_LoopFileAttrib","A_LoopFileDir","A_LoopFileExt","A_LoopFileFullPath","A_LoopFileLongPath","A_LoopFileName","A_LoopFileShortName","A_LoopFileShortPath","A_LoopFileSize","A_LoopFileSizeKB","A_LoopFileSizeMB","A_LoopFileTimeAccessed","A_LoopFileTimeCreated","A_LoopFileTimeModified","A_LoopReadLine","A_LoopRegKey","A_LoopRegName","A_LoopRegSubkey","A_LoopRegTimeModified","A_LoopRegType","A_LoopRegValue","A_MDAY","A_Min","A_MM","A_MMM","A_MMMM","A_Mon","A_MouseDelay","A_MSec","A_MyDocuments","A_Now","A_NowUTC","A_NumBatchLines","A_OSType","A_OSVersion","A_PriorHotkey","A_PriorKey","A_ProgramFiles","A_Programs","A_ProgramsCommon","A_ScreenHeight","A_ScreenWidth","A_ScriptDir","A_ScriptFullPath","A_ScriptName","A_Sec","A_Space","A_StartMenu","A_StartMenuCommon","A_Startup","A_StartupCommon","A_StringCaseSense","A_Tab","A_Temp","A_ThisFunc","A_ThisHotkey","A_ThisLabel","A_ThisMenu","A_ThisMenuItem","A_ThisMenuItemPos","A_TickCount","A_TimeIdle","A_TimeIdlePhysical","A_TimeSincePriorHotkey","A_TimeSinceThisHotkey","A_TitleMatchMode","A_TitleMatchModeSpeed","A_UserName","A_WDay","A_WinDelay","A_WinDir","A_WorkingDir","A_YDay","A_YEAR","A_YWeek","A_YYYY","Abs","ACos","Asc","ASin","ATan","Ceil","Chr","Cos","Exp","Floor","GetKeyName","GetKeySC","GetKeyState","GetKeyVK","InStr","IsFunc","IsLabel","Ln","Log","LTrim","Max","Min","Mod","NumGet","NumPut","Ord","RegExMatch","RegExReplace","Round","RTrim","Sin","Sqrt","StrGet","StrLen","StrPut","StrReplace","StrSplit","SubStr","Tan","Trim","VarSetCapacity","AutoTrim","BlockInput","Break","Click","ClipWait","ComObjActive","ComObjArray","ComObjConnect","ComObjCreate","ComObjError","ComObjFlags","ComObjGet","ComObjQuery","ComObjType","ComObjValue","Continue","Control","ControlClick","ControlFocus","ControlGet","ControlGetFocus","ControlGetPos","ControlGetText","ControlMove","ControlSend","ControlSendRaw","ControlSetText","CoordMode","Critical","DetectHiddenText","DetectHiddenWindows","DllCall","Drive","DriveGet","DriveSpaceFree","Edit","Else","EnvAdd","EnvDiv","EnvGet","EnvMult","EnvSet","EnvSub","EnvUpdate","Exit","ExitApp","File","FileAppend","FileCopy","FileCopyDir","FileCreateDir","FileCreateShortcut","FileDelete","FileEncoding","FileExist","FileGetAttrib","FileGetShortcut","FileGetSize","FileGetTime","FileGetVersion","FileInstall","FileMove","FileMoveDir","FileOpen","FileRead","FileReadLine","FileRecycle","FileRecycleEmpty","FileRemoveDir","FileSelectFile","FileSelectFolder","FileSetAttrib","FileSetTime","FormatTime","Gosub","Goto","GroupActivate","GroupAdd","GroupClose","GroupDeactivate","Gui","GuiControl","GuiControlGet","Hotkey","Hotstring","If","IfEqual","IfExist","IfGreater","IfGreaterOrEqual","IfInString","IfLess","IfLessOrEqual","IfMsgBox","IfNotEqual","IfNotExist","IfNotInString","IfWinActive","IfWinExist","IfWinNotActive","IfWinNotExist","ImageSearch","IniDelete","IniRead","IniWrite","Input","InputBox","KeyHistory","KeyWait","ListHotkeys","ListLines","ListVars","Loop","Menu","MouseClick","MouseClickDrag","MouseGetPos","MouseMove","MsgBox","OnExit","OnMessage","OutputDebug","Pause","PixelGetColor","PixelSearch","PostMessage","Process","Progress","Random","RegDelete","RegRead","RegWrite","Reload","Return","Run","RunAs","RunWait","Send","SendEvent","SendInput","SendLevel","SendMessage","SendMode","SendPlay","SendRaw","SetBatchLines","SetCapsLockState","SetControlDelay","SetDefaultMouseSpeed","SetEnv","SetFormat","SetKeyDelay","SetMouseDelay","SetNumLockState","SetRegView","SetScrollLockState","SetStoreCapslockMode","SetTimer","SetTitleMatchMode","SetWinDelay","SetWorkingDir","Shutdown","Sleep","Sort","SoundBeep","SoundGet","SoundGetWaveVolume","SoundPlay","SoundSet","SoundSetWaveVolume","SplashImage","SplashTextOff","SplashTextOn","SplitPath","StatusBarGetText","StatusBarWait","StringCaseSense","StringGetPos","StringLeft","StringLen","StringLower","StringMid","StringReplace","StringRight","StringSplit","StringTrimLeft","StringTrimRight","StringUpper","Suspend","SysGet","Thread","ToolTip","Transform","TrayTip","URLDownloadToFile","WinActivate","WinActivateBottom","WinClose","WinGet","WinGetActiveStats","WinGetActiveTitle","WinGetClass","WinGetPos","WinGetText","WinGetTitle","WinHide","WinKill","WinMaximize","WinMenuSelectItem","WinMinimize","WinMinimizeAll","WinMinimizeAllUndo","WinMove","WinRestore","WinSet","WinSetTitle","WinShow","WinWait","WinWaitActive","WinWaitClose","WinWaitNotActive","Array","Buffer","Clipboard","ComObject","ComObjArray","ComObjConnect","ComObjCreate","ComObjFromPtr","ComObjQuery","ComObjType","ComObjValue","ComValue","Error","Exception","File","FileObject","Func","Gui","GuiControl","InputHook","Map","Menu","MenuBar","Object","Prototype","RegExMatchObject","String","Throw","Try","Catch","Finally","Until","While","Loop","For","Break","Continue","Return","Local","Global","Static","Super","This","Unset","Abs","ACos","ASin","ATan","ATan2","Ceil","Chr","Cos","DateAdd","DateDiff","DirCopy","DirCreate","DirDelete","DirExist","DirMove","DirSelect","DllCall","Download","DriveEject","DriveGetCapacity","DriveGetFileSystem","DriveGetLabel","DriveGetList","DriveGetSerial","DriveGetSpaceFree","DriveGetStatus","DriveGetType","DriveRetract","DriveSetLabel","EditGetCurrentCol","EditGetCurrentLine","EditGetLine","EditGetLineCount","EditGetSelectedText","EditPaste","Exp","FileAppend","FileCopy","FileCreateShortcut","FileDelete","FileEncoding","FileExist","FileGetAttrib","FileGetShortcut","FileGetSize","FileGetTime","FileGetVersion","FileInstall","FileMove","FileOpen","FileRead","FileRecycle","FileSelect","FileSetAttrib","FileSetTime","Float","Floor","Format","FormatTime","GetKeyName","GetKeySC","GetKeyState","GetKeyVK","GroupActivate","GroupAdd","GroupClose","GroupDeactivate","GuiFromHwnd","Hotkey","Hotstring","IL_Add","IL_Create","IL_Destroy","ImageSearch","IniDelete","IniRead","IniWrite","Input","InputBox","InStr","Integer","IsAlnum","IsAlpha","IsDigit","IsFloat","IsInteger","IsLabel","IsLower","IsNumber","IsObject","IsSet","IsSpace","IsTime","IsUpper","IsXDigit","KeyHistory","KeyWait","ListHotkeys","ListLines","ListVars","Ln","LoadPicture","Log","LTrim","Max","MenuFromHandle","MenuSelect","Min","Mod","MonitorGet","MonitorGetCount","MonitorGetName","MonitorGetPrimary","MonitorGetWorkArea","MouseClick","MouseClickDrag","MouseGetPos","MouseMove","MsgBox","Number","NumGet","NumPut","ObjAddRef","ObjRelease","OnClipboardChange","OnError","OnExit","OnMessage","Ord","OutputDebug","Pause","PixelGetColor","PixelSearch","PostMessage","ProcessClose","ProcessExist","ProcessGetName","ProcessGetParent","ProcessGetPath","ProcessSetPriority","ProcessWait","ProcessWaitClose","Random","RegDelete","RegDeleteKey","RegExMatch","RegExReplace","RegRead","RegWrite","Reload","Round","RTrim","Run","RunAs","RunWait","Send","SendEvent","SendInput","SendLevel","SendMessage","SendMode","SendPlay","SendText","SetCapsLockState","SetControlDelay","SetDefaultMouseSpeed","SetKeyDelay","SetMouseDelay","SetNumLockState","SetRegView","SetScrollLockState","SetStoreCapsLockMode","SetTimer","SetTitleMatchMode","SetWinDelay","SetWorkingDir","Shutdown","Sin","Sleep","Sort","SoundBeep","SoundGetInterface","SoundGetMute","SoundGetName","SoundGetVolume","SoundPlay","SoundSetMute","SoundSetVolume","SplitPath","Sqrt","StatusBarGetText","StatusBarWait","StrCompare","StrGet","StrLen","StrLower","StrPtr","StrPut","StrReplace","StrSplit","StrUpper","SubStr","Suspend","SysGet","SysGetIPAddresses","Tan","Thread","ToolTip","TraySetIcon","TrayTip","Trim","Type","VarSetStrCapacity","VerCompare","WinActivate","WinActivateBottom","WinClose","WinExist","WinGetClass","WinGetClientPos","WinGetControls","WinGetControlsHwnd","WinGetCount","WinGetExStyle","WinGetID","WinGetIDLast","WinGetList","WinGetMinMax","WinGetPID","WinGetPos","WinGetProcessName","WinGetProcessPath","WinGetStyle","WinGetText","WinGetTitle","WinGetTransColor","WinGetTransparent","WinHide","WinKill","WinMaximize","WinMinimize","WinMinimizeAll","WinMinimizeAllUndo","WinMove","WinMoveBottom","WinMoveTop","WinRedraw","WinRestore","WinSetAlwaysOnTop","WinSetEnabled","WinSetExStyle","WinSetRegion","WinSetStyle","WinSetTitle","WinSetTransColor","WinSetTransparent","WinShow","WinWait","WinWaitActive","WinWaitClose","WinWaitNotActive","If","Else","Switch","Case","Default","Include","IncludeAgain","NoEnv","NoTrayIcon","Requires","SingleInstance","UseHook","Warn","WorkingDir","A_Args","A_AhkPath","A_AhkVersion","A_AppData","A_AppDataCommon","A_CaretX","A_CaretY","A_Clipboard","A_ComputerName","A_ControlDelay","A_CoordModeCaret","A_CoordModeMenu","A_CoordModeMouse","A_CoordModePixel","A_CoordModeToolTip","A_Cursor","A_DD","A_DDD","A_DDDD","A_DefaultMouseSpeed","A_Desktop","A_DesktopCommon","A_DetectHiddenText","A_DetectHiddenWindows","A_EndChar","A_EventInfo","A_FileEncoding","A_Hour","A_IconFile","A_IconHidden","A_IconNumber","A_IconTip","A_Index","A_InitialWorkingDir","A_IPAddress1","A_IPAddress2","A_IPAddress3","A_IPAddress4","A_Is64bitOS","A_IsAdmin","A_IsCompiled","A_IsCritical","A_IsPaused","A_IsSuspended","A_KeyDelay","A_KeyDelayPlay","A_KeyDuration","A_KeyDurationPlay","A_Language","A_LastError","A_LineFile","A_LineNumber","A_LoopField","A_LoopFileAttrib","A_LoopFileDir","A_LoopFileExt","A_LoopFileFullPath","A_LoopFileName","A_LoopFileShortName","A_LoopFileShortPath","A_LoopFileSize","A_LoopFileSizeKB","A_LoopFileSizeMB","A_LoopFileTimeAccessed","A_LoopFileTimeCreated","A_LoopFileTimeModified","A_LoopReadLine","A_LoopRegKey","A_LoopRegName","A_LoopRegSubKey","A_LoopRegTimeModified","A_LoopRegType","A_LoopRegValue","A_MDAY","A_Min","A_MM","A_MMM","A_MMMM","A_Mon","A_MouseDelay","A_MouseDelayPlay","A_MSec","A_MyDocuments","A_Now","A_NowUTC","A_OSVersion","A_PriorHotkey","A_PriorKey","A_ProgramFiles","A_Programs","A_ProgramsCommon","A_PtrSize","A_RegView","A_ScreenDPI","A_ScreenHeight","A_ScreenWidth","A_ScriptDir","A_ScriptFullPath","A_ScriptHwnd","A_ScriptName","A_Sec","A_SendLevel","A_SendMode","A_Space","A_StartMenu","A_StartMenuCommon","A_Startup","A_StartupCommon","A_Tab","A_Temp","A_ThisFunc","A_ThisHotkey","A_TickCount","A_TimeIdle","A_TimeIdleKeyboard","A_TimeIdleMouse","A_TimeIdlePhysical","A_TimeSincePriorHotkey","A_TimeSinceThisHotkey","A_TitleMatchMode","A_TitleMatchModeSpeed","A_UserName","A_WDay","A_WinDelay","A_WinDir","A_WorkingDir","A_YDay","A_Year","A_YWeek","A_YYYY"];var Z=rt.filter(t=>typeof t=="string").map(t=>t.toLowerCase()),M=t=>{let e=t.toLowerCase();return e.startsWith("a_")||Z.includes(e)},k=t=>t.toLowerCase().startsWith("a_")?"A_ prefix is reserved for AHK built-in variables":"name is in forbidden list";var Q=(t,e)=>{let{content:n}=t,o=n.at(e);return o?o.type==="new-line"?parseInt(o.value,10):Q(t,e-1):0};import{at as ko}from"fire-keeper";var ee=(t,e,n,o=[[]])=>{let{content:r}=t,i=r.at(e);if(!i)return o;let s=ko(o,-1);if(!s||i.is("edge","array-start"))return o;if(i.is("edge","array-end"))throw new d(t,"unsupported","nested array destructuring '[a, [b, c]] = x' is not supported. Flatten the destructuring manually.");return i.is("sign",",")?o.push([]):s.unshift(i),n.pop(),ee(t,e-1,n,o)};var Fo=(t,e,n,o)=>{let r=t.map(i=>{let s=i.clone();return s.scope.reload(o),s});return[new c({type:"new-line",value:n,scope:o}),...r,new c({type:"sign",value:"=",scope:o}),new c({type:"identifier",value:Y,scope:o}),new c({type:"edge",value:"index-start",scope:o}),new c({type:"number",value:(e+1).toString(),scope:o}),new c({type:"edge",value:"index-end",scope:o})]},Do=t=>{let{content:e}=t,n=[],o=[];e.toArray().forEach((r,i)=>{if(n.length&&r.type==="new-line"){let s=Q(t,i-1).toString();n.forEach((a,p)=>{let l=n[n.length-p-1]??[];o=[...o,...Fo(l,p,s,r.scope)]}),n.length=0,o.push(r);return}if(!r.is("sign","=")){o.push(r);return}if(!e.at(i-1)?.is("edge","array-end")){o.push(r);return}n=ee(t,i-2,o),n.forEach(s=>{s.forEach(a=>{if(a.type==="identifier"&&M(a.value))throw new d(t,"forbidden",`array destructuring target '${a.value}' cannot be used (${k(a.value)}).`)})}),o=o.slice(0,o.length-2),o=[...o,new c({type:"identifier",value:Y,scope:r.scope}),new c({type:"sign",value:"=",scope:r.scope})]}),e.reload(o)},it=Do;var Eo=t=>{ot(t),it(t)},st=Eo;var at=`global \u2113ci_SALT_PLACEHOLDER := Func("salt_1").Bind({})
salt_1(\u03BB, \u2113arr, \u2113idx) {
if \u2113idx is Number
{
if (\u2113idx < 0) {
return \u2113arr.Length() + \u2113idx + 1
}
return \u2113idx + 1
}
return \u2113idx
}`,pt=`global \u2113type_SALT_PLACEHOLDER := Func("salt_1").Bind({})
salt_1(\u03BB, \u2113v) {
if (\u2113v == "") {
return "undefined"
}
if \u2113v is Number
{
return "number"
}
if (IsObject(\u2113v)) {
if (IsFunc(\u2113v)) {
return "function"
}
return "object"
}
return "string"
}`;var Lo=t=>t==="changeIndex"?[new c({type:"native",value:at,scope:[]}),new c({type:"new-line",value:"0",scope:[]})]:t==="typeof"?[new c({type:"native",value:pt,scope:[]}),new c({type:"new-line",value:"0",scope:[]})]:[],lt=(t,e,n)=>{let{content:o}=t;if(t.flag[e]){let r=Lo(n);r.length>0&&(r.forEach(i=>{if(typeof i.value=="string"){let{value:s}=i,a=s,p=t.options.salt??"salt";a.includes(`${"\u2113ci"}_SALT_PLACEHOLDER`)&&(a=a.replace(new RegExp(`${"\u2113ci"}_SALT_PLACEHOLDER`,"g"),`${"\u2113ci"}_${p}`)),a.includes(`${E}_SALT_PLACEHOLDER`)&&(a=a.replace(new RegExp(`${E}_SALT_PLACEHOLDER`,"g"),`${E}_${p}`),a=a.replace(/salt_1/g,`${p}_typeof`)),i.value=a}}),o.reload([...r,...o.toArray()]))}},Wo=t=>{lt(t,"isChangeIndexUsed","changeIndex"),lt(t,"isTypeofUsed","typeof")},ct=Wo;var Po=t=>{let{content:e}=t,n=[],o=-1,r=null;e.toArray().forEach((i,s)=>{i.type==="compare"&&o!==-1&&r&&(n.push(new c({type:"logical-operator",value:"&&",scope:i.scope})),n.push(r.clone())),n.push(i),i.type==="compare"?(o=s,r=null):o!==-1&&!r?i.type==="identifier"||i.type==="number"||i.type==="string"?r=i:(o=-1,r=null):(i.type==="logical-operator"||i.is("new-line"))&&(o=-1,r=null)}),e.reload(n)},ut=Po;var Go=t=>{let{content:e}=t,n=new Set;return e.toArray().forEach((o,r)=>{if(o.type!=="class")return;let i=e.at(r+1);if(!i)throw new d(t,"internal","class/count: missing identifier after class keyword");i.type==="identifier"&&n.add(i.value)}),n},ft=Go;var Ro=t=>Z.includes(t.toLowerCase()),$o=(t,e)=>{t.forEach(n=>{if(Ro(n))throw new d(e,"forbidden",`class name '${n}' is reserved or forbidden (name is in forbidden list).`)})},mt=$o;var Oo=t=>{let e=ft(t);mt(e,t)},dt=Oo;var jo=t=>{let{content:e}=t,n=i=>{let s=e.at(i);return s?s.is("edge","block-start")&&s.scope.at(-1)==="for"?i:n(i+1):0},o=i=>{let s=e.at(i);if(!s)return"";if(s.is("for","for")){let a=e.at(i+1);if(!a)throw new d(t,"internal","for: missing variable name after for/in keyword");return a.value}return o(i-1)},r=[];if(e.toArray().forEach((i,s)=>{if(!i.is("for-in","in"))return;let a=o(s);if(a.startsWith("__")&&a.endsWith("__"))return;let p=n(s),l=e.at(p+1);if(!l)throw new d(t,"internal","for: missing block-start after for/in statement");let f=l.value,{scope:u}=l;r.unshift([p+1,[new c({type:"new-line",value:f,scope:u}),new c({type:"identifier",value:a,scope:u}),new c({type:"sign",value:"=",scope:u}),new c({type:"identifier",value:a,scope:u}),new c({type:"math",value:"-",scope:u}),new c({type:"number",value:"1",scope:u})]])}),r.length){let i=e.toArray();for(let s of r)i.splice(s[0],0,...s[1]);e.reload(i)}},yt=jo;var ht=(t,e,n=" ")=>{if(t.length>=e)return t;let o=e-t.length,r=Math.floor(o/2),i=o-r;return n.repeat(r)+t+n.repeat(i)},gt=(t,e)=>{if(!Array.isArray(t))return-1;let o=typeof e=="function"?e:typeof e=="string"||typeof e=="number"?r=>!!r[e]:typeof e=="object"?r=>{for(let i in e)if(r[i]!==e[i])return!1;return!0}:null;if(!o)return-1;for(let r=0;r<t.length;r++){let i=t.at(r);if(i!==void 0&&o(i,r,t))return r}return-1},At=(t,e)=>{if(!Array.isArray(t))return-1;let o=typeof e=="function"?e:typeof e=="string"||typeof e=="number"?r=>!!r[e]:typeof e=="object"?r=>{for(let i in e)if(r[i]!==e[i])return!1;return!0}:null;if(!o)return-1;for(let r=t.length-1;r>=0;r--){let i=t.at(r);if(i!==void 0&&o(i,r,t))return r}return-1};var te=(t,e,n,o,r=[])=>{let{content:i}=t,s=i.at(n);if(!s)return r;let a=s.clone();for(let u=0;u<o.length-1;u++)a.scope.shift();if(r.push(a),!s.is("edge","block-end")||!s.scope.isEqual(o))return s.type="void",te(t,e,n+1,o,r);s.type="native",s.value=`Func("${t.options.salt}_${e}")`,r.push(new c({type:"new-line",value:"0",scope:o}));let p=gt(r,{type:"new-line"}),l=r.at(p),f=(l?parseInt(l.value,10):1)-1;return f>0&&r.forEach(u=>{if(u.type!=="new-line")return;let m=parseInt(u.value,10)-f;m<0&&(m=0),u.value=m.toString()}),r};var ne=(t,e=1)=>{let{content:n}=t;n.reload();let o=At(n.toArray(),{type:"function",value:"anonymous"});if(!~o)return;let r=n.at(o);if(!r)throw new d(t,"internal",`function/anonymous: missing anonymous function at expected index (content length: ${n.length})`);r.value=`${t.options.salt}_${e}`,te(t,e,o,[...r.scope.toArray(),"function"]).forEach(i=>{i.type!=="void"&&n.push(i)}),ne(t,e+1)};var St=t=>{let{content:e}=t,n=[];e.toArray().forEach(o=>{if(!(o.type==="native"&&o.value.startsWith("Func(")&&o.value.endsWith(")"))){n.push(o);return}let r=o.scope.slice(0,-1);n.push(new c({type:"identifier",value:"Func",scope:r})),n.push(new c({type:"edge",value:"call-start",scope:[...r,"call"]})),n.push(new c({type:"string",value:o.value.slice(5,o.value.length-1),scope:[...r,"call"]})),n.push(new c({type:"edge",value:"call-end",scope:[...r,"call"]}))}),e.reload(n)};var No=t=>{ne(t),St(t)},Ct=No;var vt=(t,e,n)=>{let{content:o}=t,r=o.at(e);return r?r.is("edge","parameter-start")&&n.scope.isEqual([...r.scope.slice(0,r.scope.length-1),"function"])?e:vt(t,e-1,n):0},_t=t=>{let{content:e}=t,n=[];e.toArray().forEach((o,r)=>{if(n.push(o),!o.is("edge","block-end")||o.scope.at(-1)!=="function"||o.scope.at(-2)!=="class")return;let i=vt(t,r,o);if(e.at(i-1)?.is("property","constructor"))return;let s=o.scope.toArray(),a=[s,[...s,"call"]];n.push(new c({type:".",value:".",scope:a[0]})),n.push(new c({type:"identifier",value:"Bind",scope:a[0]})),n.push(new c({type:"edge",value:"call-start",scope:a[1]})),n.push(new c({type:"edge",value:"object-start",scope:a[1]})),n.push(new c({type:"edge",value:"object-end",scope:a[1]})),n.push(new c({type:"sign",value:",",scope:a[1]})),n.push(new c({type:"this",value:"this",scope:a[1]})),n.push(new c({type:"edge",value:"call-end",scope:a[1]}))}),e.reload(n)};var xt=t=>{let{content:e}=t,n=[];e.toArray().forEach((o,r)=>{if(n.push(o),!o.is("super"))return;let i=e.at(r+1);if(!i?.is("edge","call-start"))return;let s=i.scope.toArray();n.push(new c({type:".",value:".",scope:s}),new c({type:"property",value:"__New",scope:s}))}),e.reload(n)};import{at as Ho}from"fire-keeper";var bt=t=>{let{content:e}=t,n=[];e.toArray().forEach((o,r,i)=>{if(!o.is("edge","parameter-start")){n.push(o);return}if(Ho(n,-2)?.is("property","constructor")){n.pop(),n.push(o);return}if(!(o.scope.at(-1)==="class"||o.scope.at(-1)==="parameter"&&o.scope.at(-2)==="class")){n.push(o);return}n.push(o);let a=o.scope.toArray();n.push(new c({type:"identifier",value:b,scope:a})),!i.at(r+1)?.is("edge","parameter-end")&&n.push(new c({type:"sign",value:",",scope:a}))}),e.reload(n)};var It=t=>{let{content:e}=t;e.toArray().forEach(n=>{n.is("property","constructor")&&(n.value="__New")})};var Bo=t=>{bt(t),_t(t),It(t),xt(t)},wt=Bo;var Ko=t=>{let{content:e}=t,n=new Set;return e.toArray().forEach(o=>{o.is("function")&&n.add(o.value)}),n},Tt=Ko;var Mt=t=>{let{content:e}=t,n=[];for(let o=0;o<e.length;o++){let r=e.at(o);if(!r||(n.push(r),!r.is("edge","call-end")))continue;let i=e.at(o-1),s=e.at(o-2),a=e.at(o-3);if(i?.type!=="string"||!s?.is("edge","call-start")||!a?.is("identifier","Func")||e.at(o+1)?.is(".",".")&&e.at(o+2)?.is("identifier","Bind"))continue;let l=r.scope.toArray(),f=r.scope.includes("function"),u=[...l,"call"];n.push(new c({type:".",value:".",scope:l})),n.push(new c({type:"identifier",value:"Bind",scope:l})),n.push(new c({type:"edge",value:"call-start",scope:u})),f?n.push(new c({type:"identifier",value:"\u03BB",scope:u})):(n.push(new c({type:"edge",value:"object-start",scope:u})),n.push(new c({type:"edge",value:"object-end",scope:u}))),n.push(new c({type:"edge",value:"call-end",scope:u}))}e.reload(n)};var kt=["abstract","arguments","async","await","boolean","break","byte","case","catch","char","class","const","continue","debugger","default","delete","do","double","else","enum","eval","export","extends",!1,"final","finally","float","for","function","goto","if","implements","import","in","instanceof","int","interface","let","long","native","new",null,"package","private","promise","protected","public","return","short","static","super","switch","synchronized","this","throw","throws","transient",!0,"try","typeof","var","void","volatile","while","with","yield","any","as","bigint","keyof","never","number","object","readonly","string","symbol","type","undefined","unique","unknown","and","or","not","is","isnt","of","then","unless","until","when","yes","no","on","off","A_AhkPath","A_AhkVersion","A_AppData","A_AppDataCommon","A_AutoTrim","A_BatchLines","A_CaretX","A_CaretY","A_ComputerName","A_ControlDelay","A_Cursor","A_DD","A_DDD","A_DDDD","A_DefaultMouseSpeed","A_Desktop","A_DesktopCommon","A_DetectHiddenText","A_DetectHiddenWindows","A_EndChar","A_EventInfo","A_ExitReason","A_FormatFloat","A_FormatInteger","A_Gui","A_GuiEvent","A_GuiControl","A_GuiControlEvent","A_GuiHeight","A_GuiWidth","A_GuiX","A_GuiY","A_Hour","A_IconFile","A_IconHidden","A_IconNumber","A_IconTip","A_Index","A_IPAddress1","A_IPAddress2","A_IPAddress3","A_IPAddress4","A_Is64bitOS","A_IsAdmin","A_IsCompiled","A_IsCritical","A_IsPaused","A_IsSuspended","A_IsUnicode","A_KeyDelay","A_Language","A_LastError","A_LineFile","A_LineNumber","A_LoopField","A_LoopFileAttrib","A_LoopFileDir","A_LoopFileExt","A_LoopFileFullPath","A_LoopFileLongPath","A_LoopFileName","A_LoopFileShortName","A_LoopFileShortPath","A_LoopFileSize","A_LoopFileSizeKB","A_LoopFileSizeMB","A_LoopFileTimeAccessed","A_LoopFileTimeCreated","A_LoopFileTimeModified","A_LoopReadLine","A_LoopRegKey","A_LoopRegName","A_LoopRegSubkey","A_LoopRegTimeModified","A_LoopRegType","A_LoopRegValue","A_MDAY","A_Min","A_MM","A_MMM","A_MMMM","A_Mon","A_MouseDelay","A_MSec","A_MyDocuments","A_Now","A_NowUTC","A_NumBatchLines","A_OSType","A_OSVersion","A_PriorHotkey","A_PriorKey","A_ProgramFiles","A_Programs","A_ProgramsCommon","A_ScreenHeight","A_ScreenWidth","A_ScriptDir","A_ScriptFullPath","A_ScriptName","A_Sec","A_Space","A_StartMenu","A_StartMenuCommon","A_Startup","A_StartupCommon","A_StringCaseSense","A_Tab","A_Temp","A_ThisFunc","A_ThisHotkey","A_ThisLabel","A_ThisMenu","A_ThisMenuItem","A_ThisMenuItemPos","A_TickCount","A_TimeIdle","A_TimeIdlePhysical","A_TimeSincePriorHotkey","A_TimeSinceThisHotkey","A_TitleMatchMode","A_TitleMatchModeSpeed","A_UserName","A_WDay","A_WinDelay","A_WinDir","A_WorkingDir","A_YDay","A_YEAR","A_YWeek","A_YYYY","Abs","ACos","Asc","ASin","ATan","Ceil","Chr","Cos","Exp","Floor","GetKeyName","GetKeySC","GetKeyState","GetKeyVK","InStr","IsFunc","IsLabel","Ln","Log","LTrim","Max","Min","Mod","NumGet","NumPut","Ord","RegExMatch","RegExReplace","Round","RTrim","Sin","Sqrt","StrGet","StrLen","StrPut","StrReplace","StrSplit","SubStr","Tan","Trim","VarSetCapacity","AutoTrim","BlockInput","Break","Click","ClipWait","ComObjActive","ComObjArray","ComObjConnect","ComObjCreate","ComObjError","ComObjFlags","ComObjGet","ComObjQuery","ComObjType","ComObjValue","Continue","Control","ControlClick","ControlFocus","ControlGet","ControlGetFocus","ControlGetPos","ControlGetText","ControlMove","ControlSend","ControlSendRaw","ControlSetText","CoordMode","Critical","DetectHiddenText","DetectHiddenWindows","DllCall","Drive","DriveGet","DriveSpaceFree","Edit","Else","EnvAdd","EnvDiv","EnvGet","EnvMult","EnvSet","EnvSub","EnvUpdate","Exit","ExitApp","File","FileAppend","FileCopy","FileCopyDir","FileCreateDir","FileCreateShortcut","FileDelete","FileEncoding","FileExist","FileGetAttrib","FileGetShortcut","FileGetSize","FileGetTime","FileGetVersion","FileInstall","FileMove","FileMoveDir","FileOpen","FileRead","FileReadLine","FileRecycle","FileRecycleEmpty","FileRemoveDir","FileSelectFile","FileSelectFolder","FileSetAttrib","FileSetTime","FormatTime","Gosub","Goto","GroupActivate","GroupAdd","GroupClose","GroupDeactivate","Gui","GuiControl","GuiControlGet","Hotkey","Hotstring","If","IfEqual","IfExist","IfGreater","IfGreaterOrEqual","IfInString","IfLess","IfLessOrEqual","IfMsgBox","IfNotEqual","IfNotExist","IfNotInString","IfWinActive","IfWinExist","IfWinNotActive","IfWinNotExist","ImageSearch","IniDelete","IniRead","IniWrite","Input","InputBox","KeyHistory","KeyWait","ListHotkeys","ListLines","ListVars","Loop","Menu","MouseClick","MouseClickDrag","MouseGetPos","MouseMove","MsgBox","OnExit","OnMessage","OutputDebug","Pause","PixelGetColor","PixelSearch","PostMessage","Process","Progress","Random","RegDelete","RegRead","RegWrite","Reload","Return","Run","RunAs","RunWait","Send","SendEvent","SendInput","SendLevel","SendMessage","SendMode","SendPlay","SendRaw","SetBatchLines","SetCapsLockState","SetControlDelay","SetDefaultMouseSpeed","SetEnv","SetFormat","SetKeyDelay","SetMouseDelay","SetNumLockState","SetRegView","SetScrollLockState","SetStoreCapslockMode","SetTimer","SetTitleMatchMode","SetWinDelay","SetWorkingDir","Shutdown","Sleep","Sort","SoundBeep","SoundGet","SoundGetWaveVolume","SoundPlay","SoundSet","SoundSetWaveVolume","SplashImage","SplashTextOff","SplashTextOn","SplitPath","StatusBarGetText","StatusBarWait","StringCaseSense","StringGetPos","StringLeft","StringLen","StringLower","StringMid","StringReplace","StringRight","StringSplit","StringTrimLeft","StringTrimRight","StringUpper","Suspend","SysGet","Thread","ToolTip","Transform","TrayTip","URLDownloadToFile","WinActivate","WinActivateBottom","WinClose","WinGet","WinGetActiveStats","WinGetActiveTitle","WinGetClass","WinGetPos","WinGetText","WinGetTitle","WinHide","WinKill","WinMaximize","WinMenuSelectItem","WinMinimize","WinMinimizeAll","WinMinimizeAllUndo","WinMove","WinRestore","WinSet","WinSetTitle","WinShow","WinWait","WinWaitActive","WinWaitClose","WinWaitNotActive","Array","Buffer","Clipboard","ComObject","ComObjArray","ComObjConnect","ComObjCreate","ComObjFromPtr","ComObjQuery","ComObjType","ComObjValue","ComValue","Error","Exception","File","FileObject","Func","Gui","GuiControl","InputHook","Map","Menu","MenuBar","Object","Prototype","RegExMatchObject","String","Throw","Try","Catch","Finally","Until","While","Loop","For","Break","Continue","Return","Local","Global","Static","Super","This","Unset","Abs","ACos","ASin","ATan","ATan2","Ceil","Chr","Cos","DateAdd","DateDiff","DirCopy","DirCreate","DirDelete","DirExist","DirMove","DirSelect","DllCall","Download","DriveEject","DriveGetCapacity","DriveGetFileSystem","DriveGetLabel","DriveGetList","DriveGetSerial","DriveGetSpaceFree","DriveGetStatus","DriveGetType","DriveRetract","DriveSetLabel","EditGetCurrentCol","EditGetCurrentLine","EditGetLine","EditGetLineCount","EditGetSelectedText","EditPaste","Exp","FileAppend","FileCopy","FileCreateShortcut","FileDelete","FileEncoding","FileExist","FileGetAttrib","FileGetShortcut","FileGetSize","FileGetTime","FileGetVersion","FileInstall","FileMove","FileOpen","FileRead","FileRecycle","FileSelect","FileSetAttrib","FileSetTime","Float","Floor","Format","FormatTime","GetKeyName","GetKeySC","GetKeyState","GetKeyVK","GroupActivate","GroupAdd","GroupClose","GroupDeactivate","GuiFromHwnd","Hotkey","Hotstring","IL_Add","IL_Create","IL_Destroy","ImageSearch","IniDelete","IniRead","IniWrite","Input","InputBox","InStr","Integer","IsAlnum","IsAlpha","IsDigit","IsFloat","IsInteger","IsLabel","IsLower","IsNumber","IsObject","IsSet","IsSpace","IsTime","IsUpper","IsXDigit","KeyHistory","KeyWait","ListHotkeys","ListLines","ListVars","Ln","LoadPicture","Log","LTrim","Max","MenuFromHandle","MenuSelect","Min","Mod","MonitorGet","MonitorGetCount","MonitorGetName","MonitorGetPrimary","MonitorGetWorkArea","MouseClick","MouseClickDrag","MouseGetPos","MouseMove","MsgBox","Number","NumGet","NumPut","ObjAddRef","ObjRelease","OnClipboardChange","OnError","OnExit","OnMessage","Ord","OutputDebug","Pause","PixelGetColor","PixelSearch","PostMessage","ProcessClose","ProcessExist","ProcessGetName","ProcessGetParent","ProcessGetPath","ProcessSetPriority","ProcessWait","ProcessWaitClose","Random","RegDelete","RegDeleteKey","RegExMatch","RegExReplace","RegRead","RegWrite","Reload","Round","RTrim","Run","RunAs","RunWait","Send","SendEvent","SendInput","SendLevel","SendMessage","SendMode","SendPlay","SendText","SetCapsLockState","SetControlDelay","SetDefaultMouseSpeed","SetKeyDelay","SetMouseDelay","SetNumLockState","SetRegView","SetScrollLockState","SetStoreCapsLockMode","SetTimer","SetTitleMatchMode","SetWinDelay","SetWorkingDir","Shutdown","Sin","Sleep","Sort","SoundBeep","SoundGetInterface","SoundGetMute","SoundGetName","SoundGetVolume","SoundPlay","SoundSetMute","SoundSetVolume","SplitPath","Sqrt","StatusBarGetText","StatusBarWait","StrCompare","StrGet","StrLen","StrLower","StrPtr","StrPut","StrReplace","StrSplit","StrUpper","SubStr","Suspend","SysGet","SysGetIPAddresses","Tan","Thread","ToolTip","TraySetIcon","TrayTip","Trim","Type","VarSetStrCapacity","VerCompare","WinActivate","WinActivateBottom","WinClose","WinExist","WinGetClass","WinGetClientPos","WinGetControls","WinGetControlsHwnd","WinGetCount","WinGetExStyle","WinGetID","WinGetIDLast","WinGetList","WinGetMinMax","WinGetPID","WinGetPos","WinGetProcessName","