mirror of
https://github.com/exogen/t2-mapper.git
synced 2026-03-20 04:40:58 +00:00
29 lines
No EOL
105 KiB
JavaScript
29 lines
No EOL
105 KiB
JavaScript
import{r as e,t}from"./chunk-DECur_0Z.js";import{t as n}from"./logger-DePRU8Hm.js";var r,i;function a(e,t){return t.reduce((e,[t,n])=>({type:`BinaryExpression`,operator:t,left:e,right:n}),e)}function o(e,t){return{type:`UnaryExpression`,operator:e,argument:t}}function s(e,t){return e.type===`Identifier`&&e.name.toLowerCase()===`exec`&&(t.length>0&&t[0].type===`StringLiteral`?r.add(t[0].value):i=!0),{type:`CallExpression`,callee:e,arguments:t}}function c(){return Array.from(r)}var l=class extends SyntaxError{constructor(e,t,n,r){super(e),this.expected=t,this.found=n,this.location=r,this.name=`SyntaxError`}format(e){let t=`Error: `+this.message;if(this.location){let n=null,r=e.find(e=>e.source===this.location.source);r&&(n=r.text.split(/\r\n|\n|\r/g));let i=this.location.start,a=this.location.source&&typeof this.location.source.offset==`function`?this.location.source.offset(i):i,o=this.location.source+`:`+a.line+`:`+a.column;if(n){let e=this.location.end,r=``.padEnd(a.line.toString().length,` `),s=n[i.line-1],c=(i.line===e.line?e.column:s.length+1)-i.column||1;t+=`
|
||
--> `+o+`
|
||
`+r+` |
|
||
`+a.line+` | `+s+`
|
||
`+r+` | `+``.padEnd(i.column-1,` `)+``.padEnd(c,`^`)}else t+=`
|
||
at `+o}return t}static buildMessage(e,t){function n(e){return e.codePointAt(0).toString(16).toUpperCase()}let r=Object.prototype.hasOwnProperty.call(RegExp.prototype,`unicode`)?RegExp(`[\\p{C}\\p{Mn}\\p{Mc}]`,`gu`):null;function i(e){return r?e.replace(r,e=>`\\u{`+n(e)+`}`):e}function a(e){return i(e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`).replace(/\0/g,`\\0`).replace(/\t/g,`\\t`).replace(/\n/g,`\\n`).replace(/\r/g,`\\r`).replace(/[\x00-\x0F]/g,e=>`\\x0`+n(e)).replace(/[\x10-\x1F\x7F-\x9F]/g,e=>`\\x`+n(e)))}function o(e){return i(e.replace(/\\/g,`\\\\`).replace(/\]/g,`\\]`).replace(/\^/g,`\\^`).replace(/-/g,`\\-`).replace(/\0/g,`\\0`).replace(/\t/g,`\\t`).replace(/\n/g,`\\n`).replace(/\r/g,`\\r`).replace(/[\x00-\x0F]/g,e=>`\\x0`+n(e)).replace(/[\x10-\x1F\x7F-\x9F]/g,e=>`\\x`+n(e)))}let s={literal(e){return`"`+a(e.text)+`"`},class(e){let t=e.parts.map(e=>Array.isArray(e)?o(e[0])+`-`+o(e[1]):o(e));return`[`+(e.inverted?`^`:``)+t.join(``)+`]`+(e.unicode?`u`:``)},any(){return`any character`},end(){return`end of input`},other(e){return e.description}};function c(e){return s[e.type](e)}function l(e){let t=e.map(c);if(t.sort(),t.length>0){let e=1;for(let n=1;n<t.length;n++)t[n-1]!==t[n]&&(t[e]=t[n],e++);t.length=e}switch(t.length){case 1:return t[0];case 2:return t[0]+` or `+t[1];default:return t.slice(0,-1).join(`, `)+`, or `+t[t.length-1]}}function u(e){return e?`"`+a(e)+`"`:`end of input`}return`Expected `+l(e)+` but `+u(t)+` found.`}};function u(e,t){t=t===void 0?{}:t;let n={},u=t.grammarSource,d={Program:Cr},f=Cr,p=`package`,m=`function`,h=`datablock`,g=`else`,ee=`while`,_=`switch$`,te=`switch`,ne=`case`,v=`default`,y=`return`,b=`break`,x=`continue`,S=`parent`,C=`true`,w=`false`,T=/^[<>]/,re=/^[+\-]/,ie=/^[%*\/]/,ae=/^[!\-~]/,E=/^[a-zA-Z_]/,D=/^[a-zA-Z0-9_]/,oe=/^[ \t]/,O=/^[^"\\\n\r]/,k=/^[^'\\\n\r]/,A=/^[0-9a-fA-F]/,j=/^[0-9]/,M=/^[xX]/,N=/^[^\n\r]/,P=/^[\n\r]/,F=/^[ \t\n\r]/,I=Y(`;`,!1),L=Y(`package`,!1),se=Y(`{`,!1),R=Y(`}`,!1),z=Y(`function`,!1),B=Y(`(`,!1),V=Y(`)`,!1),H=Y(`::`,!1),U=Y(`,`,!1),ce=Y(`datablock`,!1),le=Y(`:`,!1),ue=Y(`new`,!1),de=Y(`[`,!1),W=Y(`]`,!1),fe=Y(`=`,!1),pe=Y(`.`,!1),me=Y(`if`,!1),he=Y(`else`,!1),ge=Y(`for`,!1),_e=Y(`while`,!1),ve=Y(`do`,!1),ye=Y(`switch$`,!1),be=Y(`switch`,!1),xe=Y(`case`,!1),Se=Y(`default`,!1),Ce=Y(`or`,!1),we=Y(`return`,!1),Te=Y(`break`,!1),Ee=Y(`continue`,!1),De=Y(`+=`,!1),Oe=Y(`-=`,!1),ke=Y(`*=`,!1),Ae=Y(`/=`,!1),je=Y(`%=`,!1),Me=Y(`<<=`,!1),Ne=Y(`>>=`,!1),Pe=Y(`&=`,!1),Fe=Y(`|=`,!1),Ie=Y(`^=`,!1),Le=Y(`?`,!1),Re=Y(`||`,!1),ze=Y(`&&`,!1),Be=Y(`|`,!1),Ve=Y(`^`,!1),He=Y(`&`,!1),Ue=Y(`==`,!1),We=Y(`!=`,!1),Ge=Y(`<=`,!1),Ke=Y(`>=`,!1),qe=_r([`<`,`>`],!1,!1,!1),Je=Y(`$=`,!1),Ye=Y(`!$=`,!1),Xe=Y(`@`,!1),Ze=Y(`NL`,!1),G=Y(`TAB`,!1),Qe=Y(`SPC`,!1),$e=Y(`<<`,!1),et=Y(`>>`,!1),tt=_r([`+`,`-`],!1,!1,!1),nt=_r([`%`,`*`,`/`],!1,!1,!1),rt=_r([`!`,`-`,`~`],!1,!1,!1),it=Y(`++`,!1),at=Y(`--`,!1),ot=Y(`*`,!1),st=Y(`%`,!1),ct=_r([[`a`,`z`],[`A`,`Z`],`_`],!1,!1,!1),K=_r([[`a`,`z`],[`A`,`Z`],[`0`,`9`],`_`],!1,!1,!1),lt=Y(`$`,!1),ut=Y(`parent`,!1),dt=_r([` `,` `],!1,!1,!1),ft=Y(`"`,!1),pt=Y(`'`,!1),mt=Y(`\\`,!1),ht=_r([`"`,`\\`,`
|
||
`,`\r`],!0,!1,!1),gt=_r([`'`,`\\`,`
|
||
`,`\r`],!0,!1,!1),_t=Y(`n`,!1),vt=Y(`r`,!1),yt=Y(`t`,!1),bt=Y(`x`,!1),xt=_r([[`0`,`9`],[`a`,`f`],[`A`,`F`]],!1,!1,!1),St=Y(`cr`,!1),Ct=Y(`cp`,!1),wt=Y(`co`,!1),Tt=Y(`c`,!1),Et=_r([[`0`,`9`]],!1,!1,!1),Dt=vr(),Ot=Y(`0`,!1),kt=_r([`x`,`X`],!1,!1,!1),At=Y(`-`,!1),jt=Y(`true`,!1),Mt=Y(`false`,!1),Nt=Y(`//`,!1),Pt=_r([`
|
||
`,`\r`],!0,!1,!1),Ft=_r([`
|
||
`,`\r`],!1,!1,!1),It=Y(`/*`,!1),Lt=Y(`*/`,!1),Rt=_r([` `,` `,`
|
||
`,`\r`],!1,!1,!1);function zt(e){return{type:`Program`,body:e.map(([e])=>e).filter(Boolean),execScriptPaths:c(),hasDynamicExec:i}}function Bt(){return null}function Vt(e){return e}function Ht(e){return e}function Ut(e,t){return{type:`PackageDeclaration`,name:e,body:t.map(([e])=>e).filter(Boolean)}}function Wt(e,t,n){return{type:`FunctionDeclaration`,name:e,params:t||[],body:n}}function Gt(e,t){return{type:`MethodName`,namespace:e,method:t}}function Kt(e,t){return[e,...t.map(([,,,e])=>e)]}function qt(e,t,n,r){return{type:`DatablockDeclaration`,className:e,instanceName:t,parent:n?n[2]:null,body:r?r[2].filter(Boolean):[]}}function Jt(e,t,n){return{type:`ObjectDeclaration`,className:e,instanceName:t,body:n?n[2].filter(Boolean):[]}}function Yt(e){return e}function Xt(e,t){return t.reduce((e,[,,,t])=>({type:`IndexExpression`,object:e,index:t}),e)}function Zt(e){return e}function Qt(e){return e}function $t(e,t){return{type:`Assignment`,target:e,value:t}}function en(e,t){return t.reduce((e,t)=>t.type===`property`?{type:`MemberExpression`,object:e,property:t.value}:{type:`IndexExpression`,object:e,index:t.value},e)}function tn(e){return{type:`property`,value:e}}function nn(e){return{type:`index`,value:e}}function rn(e,t){return t.length>0?[e,...t.map(([,,,e])=>e)]:e}function an(e,t,n){return{type:`IfStatement`,test:e,consequent:t,alternate:n?n[3]:null}}function on(e,t,n,r){return{type:`ForStatement`,init:e,test:t,update:n,body:r}}function sn(e,t){return{type:`WhileStatement`,test:e,body:t}}function cn(e,t){return{type:`DoWhileStatement`,test:t,body:e}}function ln(e,t){return{type:`SwitchStatement`,stringMode:!0,discriminant:e,cases:t.map(([e])=>e).filter(e=>e&&e.type===`SwitchCase`)}}function un(e,t){return{type:`SwitchStatement`,stringMode:!1,discriminant:e,cases:t.map(([e])=>e).filter(e=>e&&e.type===`SwitchCase`)}}function dn(e,t){return{type:`SwitchCase`,test:e,consequent:t.map(([e])=>e).filter(Boolean)}}function fn(e){return{type:`SwitchCase`,test:null,consequent:e.map(([e])=>e).filter(Boolean)}}function pn(e,t){return t.length>0?[e,...t.map(([,,,e])=>e)]:e}function mn(e){return{type:`ReturnStatement`,value:e?e[1]:null}}function hn(){return{type:`BreakStatement`}}function gn(){return{type:`ContinueStatement`}}function _n(e){return{type:`ExpressionStatement`,expression:e}}function vn(e){return{type:`BlockStatement`,body:e.map(([e])=>e).filter(Boolean)}}function yn(e,t,n){return{type:`AssignmentExpression`,operator:t,target:e,value:n}}function bn(e,t,n){return{type:`ConditionalExpression`,test:e,consequent:t,alternate:n}}function xn(e,t){return a(e,t.map(([,e,,t])=>[e,t]))}function Sn(e,t){return a(e,t.map(([,e,,t])=>[e,t]))}function Cn(e,t){return a(e,t.map(([,e,,,t])=>[e,t]))}function wn(e,t){return a(e,t.map(([,e,,t])=>[e,t]))}function Tn(e,t){return a(e,t.map(([,e,,,t])=>[e,t]))}function En(e,t){return a(e,t.map(([,e,,t])=>[e,t]))}function Dn(e,t){return a(e,t.map(([,e,,t])=>[e,t]))}function On(e,t){return a(e,t.map(([,e,,t])=>[e,t]))}function kn(e,t,n){return{type:`AssignmentExpression`,operator:t,target:e,value:n}}function An(e,t){return a(e,t.map(([,e,,t])=>[e,t]))}function jn(e,t){return a(e,t.map(([,e,,t])=>[e,t]))}function Mn(e,t){return a(e,t.map(([,e,,t])=>[e,t]))}function Nn(e,t){return o(e,t)}function Pn(e,t){return o(e,t)}function Fn(e){return{type:`TagDereferenceExpression`,argument:e}}function In(e,t,n){return{type:`AssignmentExpression`,operator:t,target:e,value:n}}function Ln(e,t){return{type:`PostfixExpression`,operator:t,argument:e}}function Rn(e,t){return t.reduce((e,t)=>{if(t[1]===`(`){let[,,,n]=t;return s(e,n||[])}let n=t[1];return n.type===`property`?{type:`MemberExpression`,object:e,property:n.value}:{type:`IndexExpression`,object:e,index:n.value}},e)}function zn(e,t){return t.reduce((e,[,t])=>t.type===`property`?{type:`MemberExpression`,object:e,property:t.value}:{type:`IndexExpression`,object:e,index:t.value},e)}function Bn(e,t){return[e,...t.map(([,,,e])=>e)]}function Vn(e){return e}function Hn(e){return{type:`Variable`,scope:`local`,name:e}}function Un(e){return{type:`Variable`,scope:`global`,name:e}}function Wn(e){return{type:`Identifier`,name:e.replace(/\s+/g,``)}}function Gn(e){return{type:`Identifier`,name:e}}function Kn(e){return{type:`Identifier`,name:e}}function qn(e){return{type:`StringLiteral`,value:e.join(``)}}function Jn(e){return{type:`StringLiteral`,value:e.join(``),tagged:!0}}function Yn(e){return e}function Xn(e){return e}function Zn(){return`
|
||
`}function Qn(){return`\r`}function $n(){return` `}function er(e){return String.fromCharCode(parseInt(e,16))}function tr(){return``}function nr(){return``}function rr(){return``}function ir(e){return String.fromCharCode([2,3,4,5,6,7,8,11,12,14][parseInt(e,10)])}function ar(e){return e}function or(e){return{type:`NumberLiteral`,value:parseInt(e,16)}}function sr(e){return{type:`NumberLiteral`,value:parseFloat(e)}}function cr(e){return{type:`BooleanLiteral`,value:e===`true`}}function lr(e){return{type:`Comment`,value:e}}function ur(e){return{type:`Comment`,value:e}}function dr(){return null}let q=t.peg$currPos|0,fr=[{line:1,column:1}],pr=q,mr=t.peg$maxFailExpected||[],J=t.peg$silentFails|0,hr;if(t.startRule){if(!(t.startRule in d))throw Error(`Can't start parsing from rule "`+t.startRule+`".`);f=d[t.startRule]}function gr(t=q){let n=e.codePointAt(t);return n===void 0?``:String.fromCodePoint(n)}function Y(e,t){return{type:`literal`,text:e,ignoreCase:t}}function _r(e,t,n,r){return{type:`class`,parts:e,inverted:t,ignoreCase:n,unicode:r}}function vr(){return{type:`any`}}function yr(){return{type:`end`}}function br(t){let n=fr[t],r;if(n)return n;if(t>=fr.length)r=fr.length-1;else for(r=t;!fr[--r];);for(n=fr[r],n={line:n.line,column:n.column};r<t;)e.charCodeAt(r)===10?(n.line++,n.column=1):n.column++,r++;return fr[t]=n,n}function xr(e,t,n){let r=br(e),i=br(t),a={source:u,start:{offset:e,line:r.line,column:r.column},end:{offset:t,line:i.line,column:i.column}};return n&&u&&typeof u.offset==`function`&&(a.start=u.offset(a.start),a.end=u.offset(a.end)),a}function X(e){q<pr||(q>pr&&(pr=q,mr=[]),mr.push(e))}function Sr(e,t,n){return new l(l.buildMessage(e,t),e,t,n)}function Cr(){let e,t,r,i,a;for(e=q,$(),t=[],r=q,i=Fi(),i===n&&(i=wr()),i===n?(q=r,r=n):(a=$(),i=[i,a],r=i);r!==n;)t.push(r),r=q,i=Fi(),i===n&&(i=wr()),i===n?(q=r,r=n):(a=$(),i=[i,a],r=i);return e=zt(t),e}function wr(){let t,r;return t=Dr(),t===n&&(t=Or(),t===n&&(t=Tr(),t===n&&(t=Er(),t===n&&(t=Br(),t===n&&(t=Vr(),t===n&&(t=Ur(),t===n&&(t=Hr(),t===n&&(t=Wr(),t===n&&(t=qr(),t===n&&(t=Jr(),t===n&&(t=Yr(),t===n&&(t=Xr(),t===n&&(t=Zr(),t===n&&(t=Fi(),t===n&&(t=q,Q(),e.charCodeAt(q)===59?(r=`;`,q++):(r=n,J===0&&X(I)),r===n?(q=t,t=n):(Q(),t=Bt())))))))))))))))),t}function Tr(){let t,r,i;return t=q,r=jr(),r===n?(q=t,t=n):(Q(),e.charCodeAt(q)===59?(i=`;`,q++):(i=n,J===0&&X(I)),i===n&&(i=null),Q(),t=Vt(r)),t}function Er(){let t,r,i;return t=q,r=Mr(),r===n?(q=t,t=n):(Q(),e.charCodeAt(q)===59?(i=`;`,q++):(i=n,J===0&&X(I)),i===n&&(i=null),Q(),t=Ht(r)),t}function Dr(){let t,r,i,a,o,s,c,l,u;if(t=q,e.substr(q,7)===p?(r=p,q+=7):(r=n,J===0&&X(L)),r!==n)if(i=zi(),i!==n)if(a=Oi(),a!==n)if(Q(),e.charCodeAt(q)===123?(o=`{`,q++):(o=n,J===0&&X(se)),o!==n){for($(),s=[],c=q,l=Fi(),l===n&&(l=wr()),l===n?(q=c,c=n):(u=$(),l=[l,u],c=l);c!==n;)s.push(c),c=q,l=Fi(),l===n&&(l=wr()),l===n?(q=c,c=n):(u=$(),l=[l,u],c=l);e.charCodeAt(q)===125?(c=`}`,q++):(c=n,J===0&&X(R)),c===n?(q=t,t=n):(l=Q(),e.charCodeAt(q)===59?(u=`;`,q++):(u=n,J===0&&X(I)),u===n&&(u=null),t=Ut(a,s))}else q=t,t=n;else q=t,t=n;else q=t,t=n;else q=t,t=n;return t}function Or(){let t,r,i,a,o,s,c,l;return t=q,e.substr(q,8)===m?(r=m,q+=8):(r=n,J===0&&X(z)),r===n?(q=t,t=n):(i=zi(),i===n?(q=t,t=n):(a=kr(),a===n?(q=t,t=n):(Q(),e.charCodeAt(q)===40?(o=`(`,q++):(o=n,J===0&&X(B)),o===n?(q=t,t=n):(Q(),s=Ar(),s===n&&(s=null),Q(),e.charCodeAt(q)===41?(c=`)`,q++):(c=n,J===0&&X(V)),c===n?(q=t,t=n):(Q(),l=Zr(),l===n?(q=t,t=n):t=Wt(a,s,l)))))),t}function kr(){let t,r,i,a;return t=q,r=Oi(),r===n?(q=t,t=n):(e.substr(q,2)===`::`?(i=`::`,q+=2):(i=n,J===0&&X(H)),i===n?(q=t,t=n):(a=Oi(),a===n?(q=t,t=n):t=Gt(r,a))),t===n&&(t=Oi()),t}function Ar(){let t,r,i,a,o,s,c,l;if(t=q,r=Oi(),r!==n){for(i=[],a=q,o=Q(),e.charCodeAt(q)===44?(s=`,`,q++):(s=n,J===0&&X(U)),s===n?(q=a,a=n):(c=Q(),l=Oi(),l===n?(q=a,a=n):(o=[o,s,c,l],a=o));a!==n;)i.push(a),a=q,o=Q(),e.charCodeAt(q)===44?(s=`,`,q++):(s=n,J===0&&X(U)),s===n?(q=a,a=n):(c=Q(),l=Oi(),l===n?(q=a,a=n):(o=[o,s,c,l],a=o));t=Kt(r,i)}else q=t,t=n;return t}function jr(){let t,r,i,a,o,s,c,l,u,d,f,p,m,g,ee,_;if(t=q,e.substr(q,9)===h?(r=h,q+=9):(r=n,J===0&&X(ce)),r!==n)if(i=zi(),i!==n)if(a=Oi(),a!==n)if(Q(),e.charCodeAt(q)===40?(o=`(`,q++):(o=n,J===0&&X(B)),o!==n)if(Q(),s=Fr(),s===n&&(s=null),Q(),e.charCodeAt(q)===41?(c=`)`,q++):(c=n,J===0&&X(V)),c!==n){if(Q(),l=q,e.charCodeAt(q)===58?(u=`:`,q++):(u=n,J===0&&X(le)),u===n?(q=l,l=n):(d=Q(),f=Oi(),f===n?(q=l,l=n):(u=[u,d,f],l=u)),l===n&&(l=null),u=Q(),d=q,e.charCodeAt(q)===123?(f=`{`,q++):(f=n,J===0&&X(se)),f!==n){for(p=Q(),m=[],g=Pr();g!==n;)m.push(g),g=Pr();g=Q(),e.charCodeAt(q)===125?(ee=`}`,q++):(ee=n,J===0&&X(R)),ee===n?(q=d,d=n):(_=Q(),f=[f,p,m,g,ee,_],d=f)}else q=d,d=n;d===n&&(d=null),t=qt(a,s,l,d)}else q=t,t=n;else q=t,t=n;else q=t,t=n;else q=t,t=n;else q=t,t=n;return t}function Mr(){let t,r,i,a,o,s,c,l,u,d,f,p,m,h;if(t=q,e.substr(q,3)===`new`?(r=`new`,q+=3):(r=n,J===0&&X(ue)),r!==n)if(i=zi(),i!==n)if(a=Nr(),a!==n)if(Q(),e.charCodeAt(q)===40?(o=`(`,q++):(o=n,J===0&&X(B)),o!==n)if(Q(),s=Fr(),s===n&&(s=null),Q(),e.charCodeAt(q)===41?(c=`)`,q++):(c=n,J===0&&X(V)),c!==n){if(Q(),l=q,e.charCodeAt(q)===123?(u=`{`,q++):(u=n,J===0&&X(se)),u!==n){for(d=Q(),f=[],p=Pr();p!==n;)f.push(p),p=Pr();p=Q(),e.charCodeAt(q)===125?(m=`}`,q++):(m=n,J===0&&X(R)),m===n?(q=l,l=n):(h=Q(),u=[u,d,f,p,m,h],l=u)}else q=l,l=n;l===n&&(l=null),t=Jt(a,s,l)}else q=t,t=n;else q=t,t=n;else q=t,t=n;else q=t,t=n;else q=t,t=n;return t}function Nr(){let t,r,i,a,o,s,c,l,u,d;if(t=q,e.charCodeAt(q)===40?(r=`(`,q++):(r=n,J===0&&X(B)),r===n?(q=t,t=n):(i=Q(),a=Z(),a===n?(q=t,t=n):(o=Q(),e.charCodeAt(q)===41?(s=`)`,q++):(s=n,J===0&&X(V)),s===n?(q=t,t=n):t=Yt(a))),t===n)if(t=q,r=Oi(),r!==n){for(i=[],a=q,o=Q(),e.charCodeAt(q)===91?(s=`[`,q++):(s=n,J===0&&X(de)),s===n?(q=a,a=n):(c=Q(),l=zr(),l===n?(q=a,a=n):(u=Q(),e.charCodeAt(q)===93?(d=`]`,q++):(d=n,J===0&&X(W)),d===n?(q=a,a=n):(o=[o,s,c,l,u,d],a=o)));a!==n;)i.push(a),a=q,o=Q(),e.charCodeAt(q)===91?(s=`[`,q++):(s=n,J===0&&X(de)),s===n?(q=a,a=n):(c=Q(),l=zr(),l===n?(q=a,a=n):(u=Q(),e.charCodeAt(q)===93?(d=`]`,q++):(d=n,J===0&&X(W)),d===n?(q=a,a=n):(o=[o,s,c,l,u,d],a=o)));t=Xt(r,i)}else q=t,t=n;return t}function Pr(){let t,r,i;return t=q,r=Mr(),r===n?(q=t,t=n):(Q(),e.charCodeAt(q)===59?(i=`;`,q++):(i=n,J===0&&X(I)),i===n&&(i=null),Q(),t=Zt(r)),t===n&&(t=q,r=jr(),r===n?(q=t,t=n):(Q(),e.charCodeAt(q)===59?(i=`;`,q++):(i=n,J===0&&X(I)),i===n&&(i=null),Q(),t=Qt(r)),t===n&&(t=Ir(),t===n&&(t=Fi(),t===n&&(t=Ri())))),t}function Fr(){let e;return e=li(),e===n&&(e=Oi(),e===n&&(e=Ni())),e}function Ir(){let t,r,i,a,o;return t=q,Q(),r=Lr(),r===n?(q=t,t=n):(Q(),e.charCodeAt(q)===61?(i=`=`,q++):(i=n,J===0&&X(fe)),i===n?(q=t,t=n):(Q(),a=Z(),a===n?(q=t,t=n):(Q(),e.charCodeAt(q)===59?(o=`;`,q++):(o=n,J===0&&X(I)),o===n&&(o=null),Q(),t=$t(r,a)))),t}function Lr(){let e,t,r,i;if(e=q,t=yi(),t!==n){for(r=[],i=Rr();i!==n;)r.push(i),i=Rr();e=en(t,r)}else q=e,e=n;return e}function Rr(){let t,r,i,a;return t=q,e.charCodeAt(q)===46?(r=`.`,q++):(r=n,J===0&&X(pe)),r===n?(q=t,t=n):(Q(),i=Oi(),i===n?(q=t,t=n):t=tn(i)),t===n&&(t=q,e.charCodeAt(q)===91?(r=`[`,q++):(r=n,J===0&&X(de)),r===n?(q=t,t=n):(Q(),i=zr(),i===n?(q=t,t=n):(Q(),e.charCodeAt(q)===93?(a=`]`,q++):(a=n,J===0&&X(W)),a===n?(q=t,t=n):t=nn(i)))),t}function zr(){let t,r,i,a,o,s,c,l;if(t=q,r=Z(),r!==n){for(i=[],a=q,o=Q(),e.charCodeAt(q)===44?(s=`,`,q++):(s=n,J===0&&X(U)),s===n?(q=a,a=n):(c=Q(),l=Z(),l===n?(q=a,a=n):(o=[o,s,c,l],a=o));a!==n;)i.push(a),a=q,o=Q(),e.charCodeAt(q)===44?(s=`,`,q++):(s=n,J===0&&X(U)),s===n?(q=a,a=n):(c=Q(),l=Z(),l===n?(q=a,a=n):(o=[o,s,c,l],a=o));t=rn(r,i)}else q=t,t=n;return t}function Br(){let t,r,i,a,o,s,c,l,u,d,f;return t=q,e.substr(q,2)===`if`?(r=`if`,q+=2):(r=n,J===0&&X(me)),r===n?(q=t,t=n):(Q(),e.charCodeAt(q)===40?(i=`(`,q++):(i=n,J===0&&X(B)),i===n?(q=t,t=n):(Q(),a=Z(),a===n?(q=t,t=n):(Q(),e.charCodeAt(q)===41?(o=`)`,q++):(o=n,J===0&&X(V)),o===n?(q=t,t=n):(Q(),s=wr(),s===n?(q=t,t=n):(c=q,l=Q(),e.substr(q,4)===g?(u=g,q+=4):(u=n,J===0&&X(he)),u===n?(q=c,c=n):(d=Q(),f=wr(),f===n?(q=c,c=n):(l=[l,u,d,f],c=l)),c===n&&(c=null),t=an(a,s,c)))))),t}function Vr(){let t,r,i,a,o,s,c,l,u,d;return t=q,e.substr(q,3)===`for`?(r=`for`,q+=3):(r=n,J===0&&X(ge)),r===n?(q=t,t=n):(Q(),e.charCodeAt(q)===40?(i=`(`,q++):(i=n,J===0&&X(B)),i===n?(q=t,t=n):(Q(),a=Z(),a===n&&(a=null),Q(),e.charCodeAt(q)===59?(o=`;`,q++):(o=n,J===0&&X(I)),o===n?(q=t,t=n):(Q(),s=Z(),s===n&&(s=null),Q(),e.charCodeAt(q)===59?(c=`;`,q++):(c=n,J===0&&X(I)),c===n?(q=t,t=n):(Q(),l=Z(),l===n&&(l=null),Q(),e.charCodeAt(q)===41?(u=`)`,q++):(u=n,J===0&&X(V)),u===n?(q=t,t=n):(Q(),d=wr(),d===n?(q=t,t=n):t=on(a,s,l,d)))))),t}function Hr(){let t,r,i,a,o,s;return t=q,e.substr(q,5)===ee?(r=ee,q+=5):(r=n,J===0&&X(_e)),r===n?(q=t,t=n):(Q(),e.charCodeAt(q)===40?(i=`(`,q++):(i=n,J===0&&X(B)),i===n?(q=t,t=n):(Q(),a=Z(),a===n?(q=t,t=n):(Q(),e.charCodeAt(q)===41?(o=`)`,q++):(o=n,J===0&&X(V)),o===n?(q=t,t=n):(Q(),s=wr(),s===n?(q=t,t=n):t=sn(a,s))))),t}function Ur(){let t,r,i,a,o,s,c,l;return t=q,e.substr(q,2)===`do`?(r=`do`,q+=2):(r=n,J===0&&X(ve)),r===n?(q=t,t=n):(Q(),i=wr(),i===n?(q=t,t=n):(Q(),e.substr(q,5)===ee?(a=ee,q+=5):(a=n,J===0&&X(_e)),a===n?(q=t,t=n):(Q(),e.charCodeAt(q)===40?(o=`(`,q++):(o=n,J===0&&X(B)),o===n?(q=t,t=n):(Q(),s=Z(),s===n?(q=t,t=n):(Q(),e.charCodeAt(q)===41?(c=`)`,q++):(c=n,J===0&&X(V)),c===n?(q=t,t=n):(Q(),e.charCodeAt(q)===59?(l=`;`,q++):(l=n,J===0&&X(I)),l===n&&(l=null),t=cn(i,s))))))),t}function Wr(){let t,r,i,a,o,s,c,l,u,d;if(t=q,e.substr(q,7)===_?(r=_,q+=7):(r=n,J===0&&X(ye)),r!==n)if(Q(),e.charCodeAt(q)===40?(i=`(`,q++):(i=n,J===0&&X(B)),i!==n)if(Q(),a=Z(),a!==n)if(Q(),e.charCodeAt(q)===41?(o=`)`,q++):(o=n,J===0&&X(V)),o!==n)if(Q(),e.charCodeAt(q)===123?(s=`{`,q++):(s=n,J===0&&X(se)),s!==n){for($(),c=[],l=q,u=Fi(),u===n&&(u=Gr()),u===n?(q=l,l=n):(d=$(),u=[u,d],l=u);l!==n;)c.push(l),l=q,u=Fi(),u===n&&(u=Gr()),u===n?(q=l,l=n):(d=$(),u=[u,d],l=u);e.charCodeAt(q)===125?(l=`}`,q++):(l=n,J===0&&X(R)),l===n?(q=t,t=n):t=ln(a,c)}else q=t,t=n;else q=t,t=n;else q=t,t=n;else q=t,t=n;else q=t,t=n;if(t===n)if(t=q,e.substr(q,6)===te?(r=te,q+=6):(r=n,J===0&&X(be)),r!==n)if(Q(),e.charCodeAt(q)===40?(i=`(`,q++):(i=n,J===0&&X(B)),i!==n)if(Q(),a=Z(),a!==n)if(Q(),e.charCodeAt(q)===41?(o=`)`,q++):(o=n,J===0&&X(V)),o!==n)if(Q(),e.charCodeAt(q)===123?(s=`{`,q++):(s=n,J===0&&X(se)),s!==n){for($(),c=[],l=q,u=Fi(),u===n&&(u=Gr()),u===n?(q=l,l=n):(d=$(),u=[u,d],l=u);l!==n;)c.push(l),l=q,u=Fi(),u===n&&(u=Gr()),u===n?(q=l,l=n):(d=$(),u=[u,d],l=u);e.charCodeAt(q)===125?(l=`}`,q++):(l=n,J===0&&X(R)),l===n?(q=t,t=n):t=un(a,c)}else q=t,t=n;else q=t,t=n;else q=t,t=n;else q=t,t=n;else q=t,t=n;return t}function Gr(){let t,r,i,a,o,s,c,l,u,d;if(t=q,e.substr(q,4)===ne?(r=ne,q+=4):(r=n,J===0&&X(xe)),r!==n)if(i=zi(),i!==n)if(a=Kr(),a!==n)if(Q(),e.charCodeAt(q)===58?(o=`:`,q++):(o=n,J===0&&X(le)),o!==n){for(s=$(),c=[],l=q,u=Fi(),u===n&&(u=wr()),u===n?(q=l,l=n):(d=$(),u=[u,d],l=u);l!==n;)c.push(l),l=q,u=Fi(),u===n&&(u=wr()),u===n?(q=l,l=n):(d=$(),u=[u,d],l=u);t=dn(a,c)}else q=t,t=n;else q=t,t=n;else q=t,t=n;else q=t,t=n;if(t===n)if(t=q,e.substr(q,7)===v?(r=v,q+=7):(r=n,J===0&&X(Se)),r!==n)if(i=Q(),e.charCodeAt(q)===58?(a=`:`,q++):(a=n,J===0&&X(le)),a!==n){for($(),o=[],s=q,c=Fi(),c===n&&(c=wr()),c===n?(q=s,s=n):(l=$(),c=[c,l],s=c);s!==n;)o.push(s),s=q,c=Fi(),c===n&&(c=wr()),c===n?(q=s,s=n):(l=$(),c=[c,l],s=c);t=fn(o)}else q=t,t=n;else q=t,t=n;return t}function Kr(){let t,r,i,a,o,s,c,l;if(t=q,r=mi(),r!==n){for(i=[],a=q,o=Q(),e.substr(q,2)===`or`?(s=`or`,q+=2):(s=n,J===0&&X(Ce)),s===n?(q=a,a=n):(c=zi(),c===n?(q=a,a=n):(l=mi(),l===n?(q=a,a=n):(o=[o,s,c,l],a=o)));a!==n;)i.push(a),a=q,o=Q(),e.substr(q,2)===`or`?(s=`or`,q+=2):(s=n,J===0&&X(Ce)),s===n?(q=a,a=n):(c=zi(),c===n?(q=a,a=n):(l=mi(),l===n?(q=a,a=n):(o=[o,s,c,l],a=o)));t=pn(r,i)}else q=t,t=n;return t}function qr(){let t,r,i,a,o;return t=q,e.substr(q,6)===y?(r=y,q+=6):(r=n,J===0&&X(we)),r===n?(q=t,t=n):(i=q,a=zi(),a===n?(q=i,i=n):(o=Z(),o===n?(q=i,i=n):(a=[a,o],i=a)),i===n&&(i=null),a=Q(),e.charCodeAt(q)===59?(o=`;`,q++):(o=n,J===0&&X(I)),o===n?(q=t,t=n):t=mn(i)),t}function Jr(){let t,r,i;return t=q,e.substr(q,5)===b?(r=b,q+=5):(r=n,J===0&&X(Te)),r===n?(q=t,t=n):(Q(),e.charCodeAt(q)===59?(i=`;`,q++):(i=n,J===0&&X(I)),i===n?(q=t,t=n):t=hn()),t}function Yr(){let t,r,i;return t=q,e.substr(q,8)===x?(r=x,q+=8):(r=n,J===0&&X(Ee)),r===n?(q=t,t=n):(Q(),e.charCodeAt(q)===59?(i=`;`,q++):(i=n,J===0&&X(I)),i===n?(q=t,t=n):t=gn()),t}function Xr(){let t,r,i;return t=q,r=Z(),r===n?(q=t,t=n):(Q(),e.charCodeAt(q)===59?(i=`;`,q++):(i=n,J===0&&X(I)),i===n?(q=t,t=n):t=_n(r)),t}function Zr(){let t,r,i,a,o,s;if(t=q,e.charCodeAt(q)===123?(r=`{`,q++):(r=n,J===0&&X(se)),r!==n){for($(),i=[],a=q,o=Fi(),o===n&&(o=wr()),o===n?(q=a,a=n):(s=$(),o=[o,s],a=o);a!==n;)i.push(a),a=q,o=Fi(),o===n&&(o=wr()),o===n?(q=a,a=n):(s=$(),o=[o,s],a=o);e.charCodeAt(q)===125?(a=`}`,q++):(a=n,J===0&&X(R)),a===n?(q=t,t=n):t=vn(i)}else q=t,t=n;return t}function Z(){let e,t,r,i;return e=q,t=Lr(),t===n?(q=e,e=n):(Q(),r=Qr(),r===n?(q=e,e=n):(Q(),i=Z(),i===n?(q=e,e=n):e=yn(t,r,i))),e===n&&(e=$r()),e}function Qr(){let t;return e.charCodeAt(q)===61?(t=`=`,q++):(t=n,J===0&&X(fe)),t===n&&(e.substr(q,2)===`+=`?(t=`+=`,q+=2):(t=n,J===0&&X(De)),t===n&&(e.substr(q,2)===`-=`?(t=`-=`,q+=2):(t=n,J===0&&X(Oe)),t===n&&(e.substr(q,2)===`*=`?(t=`*=`,q+=2):(t=n,J===0&&X(ke)),t===n&&(e.substr(q,2)===`/=`?(t=`/=`,q+=2):(t=n,J===0&&X(Ae)),t===n&&(e.substr(q,2)===`%=`?(t=`%=`,q+=2):(t=n,J===0&&X(je)),t===n&&(e.substr(q,3)===`<<=`?(t=`<<=`,q+=3):(t=n,J===0&&X(Me)),t===n&&(e.substr(q,3)===`>>=`?(t=`>>=`,q+=3):(t=n,J===0&&X(Ne)),t===n&&(e.substr(q,2)===`&=`?(t=`&=`,q+=2):(t=n,J===0&&X(Pe)),t===n&&(e.substr(q,2)===`|=`?(t=`|=`,q+=2):(t=n,J===0&&X(Fe)),t===n&&(e.substr(q,2)===`^=`?(t=`^=`,q+=2):(t=n,J===0&&X(Ie)))))))))))),t}function $r(){let t,r,i,a,o,s;return t=q,r=ei(),r===n?(q=t,t=n):(Q(),e.charCodeAt(q)===63?(i=`?`,q++):(i=n,J===0&&X(Le)),i===n?(q=t,t=n):(Q(),a=Z(),a===n?(q=t,t=n):(Q(),e.charCodeAt(q)===58?(o=`:`,q++):(o=n,J===0&&X(le)),o===n?(q=t,t=n):(Q(),s=Z(),s===n?(q=t,t=n):t=bn(r,a,s))))),t===n&&(t=ei()),t}function ei(){let t,r,i,a,o,s,c,l;if(t=q,r=ti(),r!==n){for(i=[],a=q,o=Q(),e.substr(q,2)===`||`?(s=`||`,q+=2):(s=n,J===0&&X(Re)),s===n?(q=a,a=n):(c=Q(),l=ti(),l===n?(q=a,a=n):(o=[o,s,c,l],a=o));a!==n;)i.push(a),a=q,o=Q(),e.substr(q,2)===`||`?(s=`||`,q+=2):(s=n,J===0&&X(Re)),s===n?(q=a,a=n):(c=Q(),l=ti(),l===n?(q=a,a=n):(o=[o,s,c,l],a=o));t=xn(r,i)}else q=t,t=n;return t}function ti(){let t,r,i,a,o,s,c,l;if(t=q,r=ni(),r!==n){for(i=[],a=q,o=Q(),e.substr(q,2)===`&&`?(s=`&&`,q+=2):(s=n,J===0&&X(ze)),s===n?(q=a,a=n):(c=Q(),l=ni(),l===n?(q=a,a=n):(o=[o,s,c,l],a=o));a!==n;)i.push(a),a=q,o=Q(),e.substr(q,2)===`&&`?(s=`&&`,q+=2):(s=n,J===0&&X(ze)),s===n?(q=a,a=n):(c=Q(),l=ni(),l===n?(q=a,a=n):(o=[o,s,c,l],a=o));t=Sn(r,i)}else q=t,t=n;return t}function ni(){let t,r,i,a,o,s,c,l,u;if(t=q,r=ri(),r!==n){for(i=[],a=q,o=Q(),e.charCodeAt(q)===124?(s=`|`,q++):(s=n,J===0&&X(Be)),s===n?(q=a,a=n):(c=q,J++,e.charCodeAt(q)===124?(l=`|`,q++):(l=n,J===0&&X(Be)),J--,l===n?c=void 0:(q=c,c=n),c===n?(q=a,a=n):(l=Q(),u=ri(),u===n?(q=a,a=n):(o=[o,s,c,l,u],a=o)));a!==n;)i.push(a),a=q,o=Q(),e.charCodeAt(q)===124?(s=`|`,q++):(s=n,J===0&&X(Be)),s===n?(q=a,a=n):(c=q,J++,e.charCodeAt(q)===124?(l=`|`,q++):(l=n,J===0&&X(Be)),J--,l===n?c=void 0:(q=c,c=n),c===n?(q=a,a=n):(l=Q(),u=ri(),u===n?(q=a,a=n):(o=[o,s,c,l,u],a=o)));t=Cn(r,i)}else q=t,t=n;return t}function ri(){let t,r,i,a,o,s,c,l;if(t=q,r=ii(),r!==n){for(i=[],a=q,o=Q(),e.charCodeAt(q)===94?(s=`^`,q++):(s=n,J===0&&X(Ve)),s===n?(q=a,a=n):(c=Q(),l=ii(),l===n?(q=a,a=n):(o=[o,s,c,l],a=o));a!==n;)i.push(a),a=q,o=Q(),e.charCodeAt(q)===94?(s=`^`,q++):(s=n,J===0&&X(Ve)),s===n?(q=a,a=n):(c=Q(),l=ii(),l===n?(q=a,a=n):(o=[o,s,c,l],a=o));t=wn(r,i)}else q=t,t=n;return t}function ii(){let t,r,i,a,o,s,c,l,u;if(t=q,r=ai(),r!==n){for(i=[],a=q,o=Q(),e.charCodeAt(q)===38?(s=`&`,q++):(s=n,J===0&&X(He)),s===n?(q=a,a=n):(c=q,J++,e.charCodeAt(q)===38?(l=`&`,q++):(l=n,J===0&&X(He)),J--,l===n?c=void 0:(q=c,c=n),c===n?(q=a,a=n):(l=Q(),u=ai(),u===n?(q=a,a=n):(o=[o,s,c,l,u],a=o)));a!==n;)i.push(a),a=q,o=Q(),e.charCodeAt(q)===38?(s=`&`,q++):(s=n,J===0&&X(He)),s===n?(q=a,a=n):(c=q,J++,e.charCodeAt(q)===38?(l=`&`,q++):(l=n,J===0&&X(He)),J--,l===n?c=void 0:(q=c,c=n),c===n?(q=a,a=n):(l=Q(),u=ai(),u===n?(q=a,a=n):(o=[o,s,c,l,u],a=o)));t=Tn(r,i)}else q=t,t=n;return t}function ai(){let e,t,r,i,a,o,s,c;if(e=q,t=si(),t!==n){for(r=[],i=q,a=Q(),o=oi(),o===n?(q=i,i=n):(s=Q(),c=si(),c===n?(q=i,i=n):(a=[a,o,s,c],i=a));i!==n;)r.push(i),i=q,a=Q(),o=oi(),o===n?(q=i,i=n):(s=Q(),c=si(),c===n?(q=i,i=n):(a=[a,o,s,c],i=a));e=En(t,r)}else q=e,e=n;return e}function oi(){let t;return e.substr(q,2)===`==`?(t=`==`,q+=2):(t=n,J===0&&X(Ue)),t===n&&(e.substr(q,2)===`!=`?(t=`!=`,q+=2):(t=n,J===0&&X(We))),t}function si(){let e,t,r,i,a,o,s,c;if(e=q,t=li(),t!==n){for(r=[],i=q,a=Q(),o=ci(),o===n?(q=i,i=n):(s=Q(),c=li(),c===n?(q=i,i=n):(a=[a,o,s,c],i=a));i!==n;)r.push(i),i=q,a=Q(),o=ci(),o===n?(q=i,i=n):(s=Q(),c=li(),c===n?(q=i,i=n):(a=[a,o,s,c],i=a));e=Dn(t,r)}else q=e,e=n;return e}function ci(){let t;return e.substr(q,2)===`<=`?(t=`<=`,q+=2):(t=n,J===0&&X(Ge)),t===n&&(e.substr(q,2)===`>=`?(t=`>=`,q+=2):(t=n,J===0&&X(Ke)),t===n&&(t=e.charAt(q),T.test(t)?q++:(t=n,J===0&&X(qe)))),t}function li(){let e,t,r,i,a,o,s,c;if(e=q,t=fi(),t!==n){for(r=[],i=q,a=Q(),o=di(),o===n?(q=i,i=n):(s=Q(),c=ui(),c===n?(q=i,i=n):(a=[a,o,s,c],i=a));i!==n;)r.push(i),i=q,a=Q(),o=di(),o===n?(q=i,i=n):(s=Q(),c=ui(),c===n?(q=i,i=n):(a=[a,o,s,c],i=a));e=On(t,r)}else q=e,e=n;return e}function ui(){let e,t,r,i;return e=q,t=Lr(),t===n?(q=e,e=n):(Q(),r=Qr(),r===n?(q=e,e=n):(Q(),i=Z(),i===n?(q=e,e=n):e=kn(t,r,i))),e===n&&(e=fi()),e}function di(){let t;return e.substr(q,2)===`$=`?(t=`$=`,q+=2):(t=n,J===0&&X(Je)),t===n&&(e.substr(q,3)===`!$=`?(t=`!$=`,q+=3):(t=n,J===0&&X(Ye)),t===n&&(e.charCodeAt(q)===64?(t=`@`,q++):(t=n,J===0&&X(Xe)),t===n&&(e.substr(q,2)===`NL`?(t=`NL`,q+=2):(t=n,J===0&&X(Ze)),t===n&&(e.substr(q,3)===`TAB`?(t=`TAB`,q+=3):(t=n,J===0&&X(G)),t===n&&(e.substr(q,3)===`SPC`?(t=`SPC`,q+=3):(t=n,J===0&&X(Qe))))))),t}function fi(){let e,t,r,i,a,o,s,c;if(e=q,t=mi(),t!==n){for(r=[],i=q,a=Q(),o=pi(),o===n?(q=i,i=n):(s=Q(),c=mi(),c===n?(q=i,i=n):(a=[a,o,s,c],i=a));i!==n;)r.push(i),i=q,a=Q(),o=pi(),o===n?(q=i,i=n):(s=Q(),c=mi(),c===n?(q=i,i=n):(a=[a,o,s,c],i=a));e=An(t,r)}else q=e,e=n;return e}function pi(){let t;return e.substr(q,2)===`<<`?(t=`<<`,q+=2):(t=n,J===0&&X($e)),t===n&&(e.substr(q,2)===`>>`?(t=`>>`,q+=2):(t=n,J===0&&X(et))),t}function mi(){let t,r,i,a,o,s,c,l;if(t=q,r=hi(),r!==n){for(i=[],a=q,o=Q(),s=e.charAt(q),re.test(s)?q++:(s=n,J===0&&X(tt)),s===n?(q=a,a=n):(c=Q(),l=hi(),l===n?(q=a,a=n):(o=[o,s,c,l],a=o));a!==n;)i.push(a),a=q,o=Q(),s=e.charAt(q),re.test(s)?q++:(s=n,J===0&&X(tt)),s===n?(q=a,a=n):(c=Q(),l=hi(),l===n?(q=a,a=n):(o=[o,s,c,l],a=o));t=jn(r,i)}else q=t,t=n;return t}function hi(){let t,r,i,a,o,s,c,l;if(t=q,r=gi(),r!==n){for(i=[],a=q,o=Q(),s=e.charAt(q),ie.test(s)?q++:(s=n,J===0&&X(nt)),s===n?(q=a,a=n):(c=Q(),l=gi(),l===n?(q=a,a=n):(o=[o,s,c,l],a=o));a!==n;)i.push(a),a=q,o=Q(),s=e.charAt(q),ie.test(s)?q++:(s=n,J===0&&X(nt)),s===n?(q=a,a=n):(c=Q(),l=gi(),l===n?(q=a,a=n):(o=[o,s,c,l],a=o));t=Mn(r,i)}else q=t,t=n;return t}function gi(){let t,r,i;return t=q,r=e.charAt(q),ae.test(r)?q++:(r=n,J===0&&X(rt)),r===n?(q=t,t=n):(Q(),i=_i(),i===n?(q=t,t=n):t=Nn(r,i)),t===n&&(t=q,e.substr(q,2)===`++`?(r=`++`,q+=2):(r=n,J===0&&X(it)),r===n&&(e.substr(q,2)===`--`?(r=`--`,q+=2):(r=n,J===0&&X(at))),r===n?(q=t,t=n):(Q(),i=_i(),i===n?(q=t,t=n):t=Pn(r,i)),t===n&&(t=q,e.charCodeAt(q)===42?(r=`*`,q++):(r=n,J===0&&X(ot)),r===n?(q=t,t=n):(Q(),i=_i(),i===n?(q=t,t=n):t=Fn(i)),t===n&&(t=vi()))),t}function _i(){let e,t,r,i;return e=q,t=Lr(),t===n?(q=e,e=n):(Q(),r=Qr(),r===n?(q=e,e=n):(Q(),i=Z(),i===n?(q=e,e=n):e=In(t,r,i))),e===n&&(e=gi()),e}function vi(){let t,r,i;return t=q,r=yi(),r===n?(q=t,t=n):(Q(),e.substr(q,2)===`++`?(i=`++`,q+=2):(i=n,J===0&&X(it)),i===n&&(e.substr(q,2)===`--`?(i=`--`,q+=2):(i=n,J===0&&X(at))),i===n?(q=t,t=n):t=Ln(r,i)),t===n&&(t=yi()),t}function yi(){let t,r,i,a,o,s,c,l,u,d;if(t=q,r=bi(),r!==n){for(i=[],a=q,o=Q(),e.charCodeAt(q)===40?(s=`(`,q++):(s=n,J===0&&X(B)),s===n?(q=a,a=n):(c=Q(),l=xi(),l===n&&(l=null),u=Q(),e.charCodeAt(q)===41?(d=`)`,q++):(d=n,J===0&&X(V)),d===n?(q=a,a=n):(o=[o,s,c,l,u,d],a=o)),a===n&&(a=q,o=Q(),s=Rr(),s===n?(q=a,a=n):(o=[o,s],a=o));a!==n;)i.push(a),a=q,o=Q(),e.charCodeAt(q)===40?(s=`(`,q++):(s=n,J===0&&X(B)),s===n?(q=a,a=n):(c=Q(),l=xi(),l===n&&(l=null),u=Q(),e.charCodeAt(q)===41?(d=`)`,q++):(d=n,J===0&&X(V)),d===n?(q=a,a=n):(o=[o,s,c,l,u,d],a=o)),a===n&&(a=q,o=Q(),s=Rr(),s===n?(q=a,a=n):(o=[o,s],a=o));t=Rn(r,i)}else q=t,t=n;return t}function bi(){let e,t,r,i,a,o;if(e=q,t=Si(),t!==n){for(r=[],i=q,a=Q(),o=Rr(),o===n?(q=i,i=n):(a=[a,o],i=a);i!==n;)r.push(i),i=q,a=Q(),o=Rr(),o===n?(q=i,i=n):(a=[a,o],i=a);e=zn(t,r)}else q=e,e=n;return e}function xi(){let t,r,i,a,o,s,c,l;if(t=q,r=Z(),r!==n){for(i=[],a=q,o=Q(),e.charCodeAt(q)===44?(s=`,`,q++):(s=n,J===0&&X(U)),s===n?(q=a,a=n):(c=Q(),l=Z(),l===n?(q=a,a=n):(o=[o,s,c,l],a=o));a!==n;)i.push(a),a=q,o=Q(),e.charCodeAt(q)===44?(s=`,`,q++):(s=n,J===0&&X(U)),s===n?(q=a,a=n):(c=Q(),l=Z(),l===n?(q=a,a=n):(o=[o,s,c,l],a=o));t=Bn(r,i)}else q=t,t=n;return t}function Si(){let e;return e=Mr(),e===n&&(e=jr(),e===n&&(e=ki(),e===n&&(e=Ni(),e===n&&(e=Pi(),e===n&&(e=wi(),e===n&&(e=Ci())))))),e}function Ci(){let t,r,i,a;return t=q,e.charCodeAt(q)===40?(r=`(`,q++):(r=n,J===0&&X(B)),r===n?(q=t,t=n):(Q(),i=Z(),i===n?(q=t,t=n):(Q(),e.charCodeAt(q)===41?(a=`)`,q++):(a=n,J===0&&X(V)),a===n?(q=t,t=n):t=Vn(i))),t}function wi(){let e;return e=Ti(),e===n&&(e=Ei(),e===n&&(e=Di())),e}function Ti(){let t,r,i,a,o,s,c;if(t=q,e.charCodeAt(q)===37?(r=`%`,q++):(r=n,J===0&&X(st)),r!==n){if(i=q,a=q,o=e.charAt(q),E.test(o)?q++:(o=n,J===0&&X(ct)),o!==n){for(s=[],c=e.charAt(q),D.test(c)?q++:(c=n,J===0&&X(K));c!==n;)s.push(c),c=e.charAt(q),D.test(c)?q++:(c=n,J===0&&X(K));o=[o,s],a=o}else q=a,a=n;i=a===n?a:e.substring(i,q),i===n?(q=t,t=n):t=Hn(i)}else q=t,t=n;return t}function Ei(){let t,r,i,a,o,s,c,l,u,d,f,p,m;if(t=q,e.charCodeAt(q)===36?(r=`$`,q++):(r=n,J===0&&X(lt)),r!==n){if(i=q,a=q,e.substr(q,2)===`::`?(o=`::`,q+=2):(o=n,J===0&&X(H)),o===n&&(o=null),s=e.charAt(q),E.test(s)?q++:(s=n,J===0&&X(ct)),s!==n){for(c=[],l=e.charAt(q),D.test(l)?q++:(l=n,J===0&&X(K));l!==n;)c.push(l),l=e.charAt(q),D.test(l)?q++:(l=n,J===0&&X(K));if(l=[],u=q,e.substr(q,2)===`::`?(d=`::`,q+=2):(d=n,J===0&&X(H)),d!==n)if(f=e.charAt(q),E.test(f)?q++:(f=n,J===0&&X(ct)),f!==n){for(p=[],m=e.charAt(q),D.test(m)?q++:(m=n,J===0&&X(K));m!==n;)p.push(m),m=e.charAt(q),D.test(m)?q++:(m=n,J===0&&X(K));d=[d,f,p],u=d}else q=u,u=n;else q=u,u=n;for(;u!==n;)if(l.push(u),u=q,e.substr(q,2)===`::`?(d=`::`,q+=2):(d=n,J===0&&X(H)),d!==n)if(f=e.charAt(q),E.test(f)?q++:(f=n,J===0&&X(ct)),f!==n){for(p=[],m=e.charAt(q),D.test(m)?q++:(m=n,J===0&&X(K));m!==n;)p.push(m),m=e.charAt(q),D.test(m)?q++:(m=n,J===0&&X(K));d=[d,f,p],u=d}else q=u,u=n;else q=u,u=n;o=[o,s,c,l],a=o}else q=a,a=n;i=a===n?a:e.substring(i,q),i===n?(q=t,t=n):t=Un(i)}else q=t,t=n;return t}function Di(){let t,r,i,a,o,s,c,l,u,d,f;if(t=q,r=q,i=q,e.substr(q,6)===S?(a=S,q+=6):(a=n,J===0&&X(ut)),a!==n){for(o=[],s=e.charAt(q),oe.test(s)?q++:(s=n,J===0&&X(dt));s!==n;)o.push(s),s=e.charAt(q),oe.test(s)?q++:(s=n,J===0&&X(dt));if(e.substr(q,2)===`::`?(s=`::`,q+=2):(s=n,J===0&&X(H)),s!==n){for(c=[],l=e.charAt(q),oe.test(l)?q++:(l=n,J===0&&X(dt));l!==n;)c.push(l),l=e.charAt(q),oe.test(l)?q++:(l=n,J===0&&X(dt));if(l=e.charAt(q),E.test(l)?q++:(l=n,J===0&&X(ct)),l!==n){for(u=[],d=e.charAt(q),D.test(d)?q++:(d=n,J===0&&X(K));d!==n;)u.push(d),d=e.charAt(q),D.test(d)?q++:(d=n,J===0&&X(K));a=[a,o,s,c,l,u],i=a}else q=i,i=n}else q=i,i=n}else q=i,i=n;if(r=i===n?i:e.substring(r,q),r!==n&&(r=Wn(r)),t=r,t===n){if(t=q,r=q,i=q,e.substr(q,6)===S?(a=S,q+=6):(a=n,J===0&&X(ut)),a!==n){if(o=[],s=q,e.substr(q,2)===`::`?(c=`::`,q+=2):(c=n,J===0&&X(H)),c!==n)if(l=e.charAt(q),E.test(l)?q++:(l=n,J===0&&X(ct)),l!==n){for(u=[],d=e.charAt(q),D.test(d)?q++:(d=n,J===0&&X(K));d!==n;)u.push(d),d=e.charAt(q),D.test(d)?q++:(d=n,J===0&&X(K));c=[c,l,u],s=c}else q=s,s=n;else q=s,s=n;if(s!==n)for(;s!==n;)if(o.push(s),s=q,e.substr(q,2)===`::`?(c=`::`,q+=2):(c=n,J===0&&X(H)),c!==n)if(l=e.charAt(q),E.test(l)?q++:(l=n,J===0&&X(ct)),l!==n){for(u=[],d=e.charAt(q),D.test(d)?q++:(d=n,J===0&&X(K));d!==n;)u.push(d),d=e.charAt(q),D.test(d)?q++:(d=n,J===0&&X(K));c=[c,l,u],s=c}else q=s,s=n;else q=s,s=n;else o=n;o===n?(q=i,i=n):(a=[a,o],i=a)}else q=i,i=n;if(r=i===n?i:e.substring(r,q),r!==n&&(r=Gn(r)),t=r,t===n){if(t=q,r=q,i=q,a=e.charAt(q),E.test(a)?q++:(a=n,J===0&&X(ct)),a!==n){for(o=[],s=e.charAt(q),D.test(s)?q++:(s=n,J===0&&X(K));s!==n;)o.push(s),s=e.charAt(q),D.test(s)?q++:(s=n,J===0&&X(K));if(s=[],c=q,e.substr(q,2)===`::`?(l=`::`,q+=2):(l=n,J===0&&X(H)),l!==n)if(u=e.charAt(q),E.test(u)?q++:(u=n,J===0&&X(ct)),u!==n){for(d=[],f=e.charAt(q),D.test(f)?q++:(f=n,J===0&&X(K));f!==n;)d.push(f),f=e.charAt(q),D.test(f)?q++:(f=n,J===0&&X(K));l=[l,u,d],c=l}else q=c,c=n;else q=c,c=n;for(;c!==n;)if(s.push(c),c=q,e.substr(q,2)===`::`?(l=`::`,q+=2):(l=n,J===0&&X(H)),l!==n)if(u=e.charAt(q),E.test(u)?q++:(u=n,J===0&&X(ct)),u!==n){for(d=[],f=e.charAt(q),D.test(f)?q++:(f=n,J===0&&X(K));f!==n;)d.push(f),f=e.charAt(q),D.test(f)?q++:(f=n,J===0&&X(K));l=[l,u,d],c=l}else q=c,c=n;else q=c,c=n;a=[a,o,s],i=a}else q=i,i=n;r=i===n?i:e.substring(r,q),r!==n&&(r=Kn(r)),t=r}}return t}function Oi(){let e;return e=Ti(),e===n&&(e=Ei(),e===n&&(e=Di())),e}function ki(){let t,r,i,a;if(t=q,e.charCodeAt(q)===34?(r=`"`,q++):(r=n,J===0&&X(ft)),r!==n){for(i=[],a=Ai();a!==n;)i.push(a),a=Ai();e.charCodeAt(q)===34?(a=`"`,q++):(a=n,J===0&&X(ft)),a===n?(q=t,t=n):t=qn(i)}else q=t,t=n;if(t===n)if(t=q,e.charCodeAt(q)===39?(r=`'`,q++):(r=n,J===0&&X(pt)),r!==n){for(i=[],a=ji();a!==n;)i.push(a),a=ji();e.charCodeAt(q)===39?(a=`'`,q++):(a=n,J===0&&X(pt)),a===n?(q=t,t=n):t=Jn(i)}else q=t,t=n;return t}function Ai(){let t,r,i;return t=q,e.charCodeAt(q)===92?(r=`\\`,q++):(r=n,J===0&&X(mt)),r===n?(q=t,t=n):(i=Mi(),i===n?(q=t,t=n):t=Yn(i)),t===n&&(t=e.charAt(q),O.test(t)?q++:(t=n,J===0&&X(ht))),t}function ji(){let t,r,i;return t=q,e.charCodeAt(q)===92?(r=`\\`,q++):(r=n,J===0&&X(mt)),r===n?(q=t,t=n):(i=Mi(),i===n?(q=t,t=n):t=Xn(i)),t===n&&(t=e.charAt(q),k.test(t)?q++:(t=n,J===0&&X(gt))),t}function Mi(){let t,r,i,a,o,s;return t=q,e.charCodeAt(q)===110?(r=`n`,q++):(r=n,J===0&&X(_t)),r!==n&&(r=Zn()),t=r,t===n&&(t=q,e.charCodeAt(q)===114?(r=`r`,q++):(r=n,J===0&&X(vt)),r!==n&&(r=Qn()),t=r,t===n&&(t=q,e.charCodeAt(q)===116?(r=`t`,q++):(r=n,J===0&&X(yt)),r!==n&&(r=$n()),t=r,t===n&&(t=q,e.charCodeAt(q)===120?(r=`x`,q++):(r=n,J===0&&X(bt)),r===n?(q=t,t=n):(i=q,a=q,o=e.charAt(q),A.test(o)?q++:(o=n,J===0&&X(xt)),o===n?(q=a,a=n):(s=e.charAt(q),A.test(s)?q++:(s=n,J===0&&X(xt)),s===n?(q=a,a=n):(o=[o,s],a=o)),i=a===n?a:e.substring(i,q),i===n?(q=t,t=n):t=er(i)),t===n&&(t=q,e.substr(q,2)===`cr`?(r=`cr`,q+=2):(r=n,J===0&&X(St)),r!==n&&(r=tr()),t=r,t===n&&(t=q,e.substr(q,2)===`cp`?(r=`cp`,q+=2):(r=n,J===0&&X(Ct)),r!==n&&(r=nr()),t=r,t===n&&(t=q,e.substr(q,2)===`co`?(r=`co`,q+=2):(r=n,J===0&&X(wt)),r!==n&&(r=rr()),t=r,t===n&&(t=q,e.charCodeAt(q)===99?(r=`c`,q++):(r=n,J===0&&X(Tt)),r===n?(q=t,t=n):(i=e.charAt(q),j.test(i)?q++:(i=n,J===0&&X(Et)),i===n?(q=t,t=n):t=ir(i)),t===n&&(t=q,e.length>q?(r=e.charAt(q),q++):(r=n,J===0&&X(Dt)),r!==n&&(r=ar(r)),t=r)))))))),t}function Ni(){let t,r,i,a,o,s,c,l,u;if(t=q,r=q,i=q,e.charCodeAt(q)===48?(a=`0`,q++):(a=n,J===0&&X(Ot)),a!==n)if(o=e.charAt(q),M.test(o)?q++:(o=n,J===0&&X(kt)),o!==n){if(s=[],c=e.charAt(q),A.test(c)?q++:(c=n,J===0&&X(xt)),c!==n)for(;c!==n;)s.push(c),c=e.charAt(q),A.test(c)?q++:(c=n,J===0&&X(xt));else s=n;s===n?(q=i,i=n):(a=[a,o,s],i=a)}else q=i,i=n;else q=i,i=n;if(r=i===n?i:e.substring(r,q),r===n?(q=t,t=n):(i=q,J++,a=Vi(),J--,a===n?i=void 0:(q=i,i=n),i===n?(q=t,t=n):t=or(r)),t===n){if(t=q,r=q,i=q,e.charCodeAt(q)===45?(a=`-`,q++):(a=n,J===0&&X(At)),a===n&&(a=null),o=[],s=e.charAt(q),j.test(s)?q++:(s=n,J===0&&X(Et)),s!==n)for(;s!==n;)o.push(s),s=e.charAt(q),j.test(s)?q++:(s=n,J===0&&X(Et));else o=n;if(o!==n){if(s=q,e.charCodeAt(q)===46?(c=`.`,q++):(c=n,J===0&&X(pe)),c!==n){if(l=[],u=e.charAt(q),j.test(u)?q++:(u=n,J===0&&X(Et)),u!==n)for(;u!==n;)l.push(u),u=e.charAt(q),j.test(u)?q++:(u=n,J===0&&X(Et));else l=n;l===n?(q=s,s=n):(c=[c,l],s=c)}else q=s,s=n;s===n&&(s=null),a=[a,o,s],i=a}else q=i,i=n;if(i===n)if(i=q,e.charCodeAt(q)===45?(a=`-`,q++):(a=n,J===0&&X(At)),a===n&&(a=null),e.charCodeAt(q)===46?(o=`.`,q++):(o=n,J===0&&X(pe)),o!==n){if(s=[],c=e.charAt(q),j.test(c)?q++:(c=n,J===0&&X(Et)),c!==n)for(;c!==n;)s.push(c),c=e.charAt(q),j.test(c)?q++:(c=n,J===0&&X(Et));else s=n;s===n?(q=i,i=n):(a=[a,o,s],i=a)}else q=i,i=n;r=i===n?i:e.substring(r,q),r===n?(q=t,t=n):(i=q,J++,a=Vi(),J--,a===n?i=void 0:(q=i,i=n),i===n?(q=t,t=n):t=sr(r))}return t}function Pi(){let t,r,i,a;return t=q,e.substr(q,4)===C?(r=C,q+=4):(r=n,J===0&&X(jt)),r===n&&(e.substr(q,5)===w?(r=w,q+=5):(r=n,J===0&&X(Mt))),r===n?(q=t,t=n):(i=q,J++,a=Vi(),J--,a===n?i=void 0:(q=i,i=n),i===n?(q=t,t=n):t=cr(r)),t}function Fi(){let e;return e=Ii(),e===n&&(e=Li()),e}function Ii(){let t,r,i,a,o;if(t=q,e.substr(q,2)===`//`?(r=`//`,q+=2):(r=n,J===0&&X(Nt)),r!==n){for(i=q,a=[],o=e.charAt(q),N.test(o)?q++:(o=n,J===0&&X(Pt));o!==n;)a.push(o),o=e.charAt(q),N.test(o)?q++:(o=n,J===0&&X(Pt));i=e.substring(i,q),a=e.charAt(q),P.test(a)?q++:(a=n,J===0&&X(Ft)),a===n&&(a=null),t=lr(i)}else q=t,t=n;return t}function Li(){let t,r,i,a,o,s,c;if(t=q,e.substr(q,2)===`/*`?(r=`/*`,q+=2):(r=n,J===0&&X(It)),r!==n){for(i=q,a=[],o=q,s=q,J++,e.substr(q,2)===`*/`?(c=`*/`,q+=2):(c=n,J===0&&X(Lt)),J--,c===n?s=void 0:(q=s,s=n),s===n?(q=o,o=n):(e.length>q?(c=e.charAt(q),q++):(c=n,J===0&&X(Dt)),c===n?(q=o,o=n):(s=[s,c],o=s));o!==n;)a.push(o),o=q,s=q,J++,e.substr(q,2)===`*/`?(c=`*/`,q+=2):(c=n,J===0&&X(Lt)),J--,c===n?s=void 0:(q=s,s=n),s===n?(q=o,o=n):(e.length>q?(c=e.charAt(q),q++):(c=n,J===0&&X(Dt)),c===n?(q=o,o=n):(s=[s,c],o=s));i=e.substring(i,q),e.substr(q,2)===`*/`?(a=`*/`,q+=2):(a=n,J===0&&X(Lt)),a===n?(q=t,t=n):t=ur(i)}else q=t,t=n;return t}function Ri(){let t,r,i;if(t=q,r=[],i=e.charAt(q),F.test(i)?q++:(i=n,J===0&&X(Rt)),i!==n)for(;i!==n;)r.push(i),i=e.charAt(q),F.test(i)?q++:(i=n,J===0&&X(Rt));else r=n;return r!==n&&(r=dr()),t=r,t}function Q(){let t,r;for(t=[],r=e.charAt(q),F.test(r)?q++:(r=n,J===0&&X(Rt)),r===n&&(r=Bi());r!==n;)t.push(r),r=e.charAt(q),F.test(r)?q++:(r=n,J===0&&X(Rt)),r===n&&(r=Bi());return t}function zi(){let t,r,i,a;if(t=q,r=[],i=e.charAt(q),F.test(i)?q++:(i=n,J===0&&X(Rt)),i!==n)for(;i!==n;)r.push(i),i=e.charAt(q),F.test(i)?q++:(i=n,J===0&&X(Rt));else r=n;if(r!==n){for(i=[],a=e.charAt(q),F.test(a)?q++:(a=n,J===0&&X(Rt)),a===n&&(a=Bi());a!==n;)i.push(a),a=e.charAt(q),F.test(a)?q++:(a=n,J===0&&X(Rt)),a===n&&(a=Bi());r=[r,i],t=r}else q=t,t=n;return t}function $(){let t,r;for(t=[],r=e.charAt(q),F.test(r)?q++:(r=n,J===0&&X(Rt));r!==n;)t.push(r),r=e.charAt(q),F.test(r)?q++:(r=n,J===0&&X(Rt));return t}function Bi(){let t,r,i,a,o,s;if(t=q,e.substr(q,2)===`//`?(r=`//`,q+=2):(r=n,J===0&&X(Nt)),r!==n){for(i=[],a=e.charAt(q),N.test(a)?q++:(a=n,J===0&&X(Pt));a!==n;)i.push(a),a=e.charAt(q),N.test(a)?q++:(a=n,J===0&&X(Pt));a=e.charAt(q),P.test(a)?q++:(a=n,J===0&&X(Ft)),a===n&&(a=null),r=[r,i,a],t=r}else q=t,t=n;if(t===n)if(t=q,e.substr(q,2)===`/*`?(r=`/*`,q+=2):(r=n,J===0&&X(It)),r!==n){for(i=[],a=q,o=q,J++,e.substr(q,2)===`*/`?(s=`*/`,q+=2):(s=n,J===0&&X(Lt)),J--,s===n?o=void 0:(q=o,o=n),o===n?(q=a,a=n):(e.length>q?(s=e.charAt(q),q++):(s=n,J===0&&X(Dt)),s===n?(q=a,a=n):(o=[o,s],a=o));a!==n;)i.push(a),a=q,o=q,J++,e.substr(q,2)===`*/`?(s=`*/`,q+=2):(s=n,J===0&&X(Lt)),J--,s===n?o=void 0:(q=o,o=n),o===n?(q=a,a=n):(e.length>q?(s=e.charAt(q),q++):(s=n,J===0&&X(Dt)),s===n?(q=a,a=n):(o=[o,s],a=o));e.substr(q,2)===`*/`?(a=`*/`,q+=2):(a=n,J===0&&X(Lt)),a===n?(q=t,t=n):(r=[r,i,a],t=r)}else q=t,t=n;return t}function Vi(){let t;return t=e.charAt(q),D.test(t)?q++:(t=n,J===0&&X(K)),t}r=new Set,i=!1,hr=f();let Hi=hr!==n&&q===e.length;function Ui(){throw hr!==n&&q<e.length&&X(yr()),Sr(mr,pr<e.length?gr(pr):null,pr<e.length?xr(pr,pr+1):xr(pr,pr))}if(t.peg$library)return{peg$result:hr,peg$currPos:q,peg$FAILED:n,peg$maxFailExpected:mr,peg$maxFailPos:pr,peg$success:Hi,peg$throw:Hi?void 0:Ui};if(Hi)return hr;Ui()}function d(e){let t=e.indexOf(`::`);return t===-1?null:{namespace:e.slice(0,t),method:e.slice(t+2)}}var f={"+":`$.add`,"-":`$.sub`,"*":`$.mul`,"/":`$.div`,"<":`$.lt`,"<=":`$.le`,">":`$.gt`,">=":`$.ge`,"==":`$.eq`,"!=":`$.ne`,"%":`$.mod`,"&":`$.bitand`,"|":`$.bitor`,"^":`$.bitxor`,"<<":`$.shl`,">>":`$.shr`},p=class{indent;runtime;functions;globals;locals;indentLevel=0;currentClass=null;currentFunction=null;constructor(e={}){this.indent=e.indent??` `,this.runtime=e.runtime??`$`,this.functions=e.functions??`$f`,this.globals=e.globals??`$g`,this.locals=e.locals??`$l`}getAccessInfo(e){if(e.type===`Variable`){let t=JSON.stringify(e.name),n=e.scope===`global`?this.globals:this.locals;return{getter:`${n}.get(${t})`,setter:e=>`${n}.set(${t}, ${e})`,postIncHelper:`${n}.postInc(${t})`,postDecHelper:`${n}.postDec(${t})`}}if(e.type===`MemberExpression`){let t=this.expression(e.object),n=e.property.type===`Identifier`?JSON.stringify(e.property.name):this.expression(e.property);return{getter:`${this.runtime}.prop(${t}, ${n})`,setter:e=>`${this.runtime}.setProp(${t}, ${n}, ${e})`,postIncHelper:`${this.runtime}.propPostInc(${t}, ${n})`,postDecHelper:`${this.runtime}.propPostDec(${t}, ${n})`}}if(e.type===`IndexExpression`){let t=Array.isArray(e.index)?e.index.map(e=>this.expression(e)):[this.expression(e.index)];if(e.object.type===`Variable`){let n=JSON.stringify(e.object.name),r=e.object.scope===`global`?this.globals:this.locals,i=t.join(`, `);return{getter:`${r}.get(${n}, ${i})`,setter:e=>`${r}.set(${n}, ${i}, ${e})`,postIncHelper:`${r}.postInc(${n}, ${i})`,postDecHelper:`${r}.postDec(${n}, ${i})`}}if(e.object.type===`MemberExpression`){let n=e.object,r=this.expression(n.object),i=n.property.type===`Identifier`?JSON.stringify(n.property.name):this.expression(n.property),a=`${this.runtime}.key(${i}, ${t.join(`, `)})`;return{getter:`${this.runtime}.prop(${r}, ${a})`,setter:e=>`${this.runtime}.setProp(${r}, ${a}, ${e})`,postIncHelper:`${this.runtime}.propPostInc(${r}, ${a})`,postDecHelper:`${this.runtime}.propPostDec(${r}, ${a})`}}let n=this.expression(e.object),r=t.length===1?t[0]:`${this.runtime}.key(${t.join(`, `)})`;return{getter:`${this.runtime}.getIndex(${n}, ${r})`,setter:e=>`${this.runtime}.setIndex(${n}, ${r}, ${e})`,postIncHelper:`${this.runtime}.indexPostInc(${n}, ${r})`,postDecHelper:`${this.runtime}.indexPostDec(${n}, ${r})`}}return null}generate(e){let t=[];for(let n of e.body){let e=this.statement(n);e&&t.push(e)}return t.join(`
|
||
|
||
`)}statement(e){switch(e.type){case`Comment`:return``;case`ExpressionStatement`:return this.line(`${this.expression(e.expression)};`);case`FunctionDeclaration`:return this.functionDeclaration(e);case`PackageDeclaration`:return this.packageDeclaration(e);case`DatablockDeclaration`:return this.datablockDeclaration(e);case`ObjectDeclaration`:return this.line(`${this.objectDeclaration(e)};`);case`IfStatement`:return this.ifStatement(e);case`ForStatement`:return this.forStatement(e);case`WhileStatement`:return this.whileStatement(e);case`DoWhileStatement`:return this.doWhileStatement(e);case`SwitchStatement`:return this.switchStatement(e);case`ReturnStatement`:return this.returnStatement(e);case`BreakStatement`:return this.line(`break;`);case`ContinueStatement`:return this.line(`continue;`);case`BlockStatement`:return this.blockStatement(e);default:throw Error(`Unknown statement type: ${e.type}`)}}functionDeclaration(e){let t=d(e.name.name);if(t){let n=t.namespace,r=t.method;this.currentClass=n.toLowerCase(),this.currentFunction=r.toLowerCase();let i=this.functionBody(e.body,e.params);return this.currentClass=null,this.currentFunction=null,`${this.line(`${this.runtime}.registerMethod(${JSON.stringify(n)}, ${JSON.stringify(r)}, function() {`)}\n${i}\n${this.line(`});`)}`}else{let t=e.name.name;this.currentFunction=t.toLowerCase();let n=this.functionBody(e.body,e.params);return this.currentFunction=null,`${this.line(`${this.runtime}.registerFunction(${JSON.stringify(t)}, function() {`)}\n${n}\n${this.line(`});`)}`}}functionBody(e,t){this.indentLevel++;let n=[];n.push(this.line(`const ${this.locals} = ${this.runtime}.locals();`));for(let e=0;e<t.length;e++)n.push(this.line(`${this.locals}.set(${JSON.stringify(t[e].name)}, arguments[${e}]);`));for(let t of e.body)n.push(this.statement(t));return this.indentLevel--,n.join(`
|
||
`)}packageDeclaration(e){let t=JSON.stringify(e.name.name);this.indentLevel++;let n=e.body.map(e=>this.statement(e)).join(`
|
||
|
||
`);return this.indentLevel--,`${this.line(`${this.runtime}.package(${t}, function() {`)}\n${n}\n${this.line(`});`)}`}datablockDeclaration(e){let t=JSON.stringify(e.className.name),n=e.instanceName?JSON.stringify(e.instanceName.name):`null`,r=e.parent?JSON.stringify(e.parent.name):`null`,i=this.objectBody(e.body);return this.line(`${this.runtime}.datablock(${t}, ${n}, ${r}, ${i});`)}objectDeclaration(e){let t=e.className.type===`Identifier`?JSON.stringify(e.className.name):this.expression(e.className),n=e.instanceName===null?`null`:e.instanceName.type===`Identifier`?JSON.stringify(e.instanceName.name):this.expression(e.instanceName),r=[],i=[];for(let t of e.body)t.type===`Assignment`?r.push(t):i.push(t);let a=this.objectBody(r);if(i.length>0){let e=i.map(e=>this.objectDeclaration(e)).join(`,
|
||
`);return`${this.runtime}.create(${t}, ${n}, ${a}, [\n${e}\n])`}return`${this.runtime}.create(${t}, ${n}, ${a})`}objectBody(e){if(e.length===0)return`{}`;let t=[];for(let n of e)if(n.type===`Assignment`){let e=this.expression(n.value);if(n.target.type===`Identifier`){let r=n.target.name;/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(r)?t.push(`${r}: ${e}`):t.push(`[${JSON.stringify(r)}]: ${e}`)}else if(n.target.type===`IndexExpression`){let r=this.objectPropertyKey(n.target);t.push(`[${r}]: ${e}`)}else{let r=this.expression(n.target);t.push(`[${r}]: ${e}`)}}if(t.length<=1)return`{ ${t.join(`, `)} }`;let n=this.indent.repeat(this.indentLevel+1),r=this.indent.repeat(this.indentLevel);return`{\n${n}${t.join(`,
|
||
`+n)}\n${r}}`}objectPropertyKey(e){let t=e.object.type===`Identifier`?JSON.stringify(e.object.name):this.expression(e.object),n=Array.isArray(e.index)?e.index.map(e=>this.expression(e)).join(`, `):this.expression(e.index);return`${this.runtime}.key(${t}, ${n})`}ifStatement(e){let t=this.expression(e.test),n=this.statementAsBlock(e.consequent);if(e.alternate)if(e.alternate.type===`IfStatement`){let r=this.ifStatement(e.alternate).replace(/^\s*/,``);return this.line(`if (${t}) ${n} else ${r}`)}else{let r=this.statementAsBlock(e.alternate);return this.line(`if (${t}) ${n} else ${r}`)}return this.line(`if (${t}) ${n}`)}forStatement(e){let t=e.init?this.expression(e.init):``,n=e.test?this.expression(e.test):``,r=e.update?this.expression(e.update):``,i=this.statementAsBlock(e.body);return this.line(`for (${t}; ${n}; ${r}) ${i}`)}whileStatement(e){let t=this.expression(e.test),n=this.statementAsBlock(e.body);return this.line(`while (${t}) ${n}`)}doWhileStatement(e){let t=this.statementAsBlock(e.body),n=this.expression(e.test);return this.line(`do ${t} while (${n});`)}switchStatement(e){if(e.stringMode)return this.switchStringStatement(e);let t=this.expression(e.discriminant);this.indentLevel++;let n=[];for(let t of e.cases)n.push(this.switchCase(t));return this.indentLevel--,`${this.line(`switch (${t}) {`)}\n${n.join(`
|
||
`)}\n${this.line(`}`)}`}switchCase(e){let t=[];if(e.test===null)t.push(this.line(`default:`));else if(Array.isArray(e.test))for(let n of e.test)t.push(this.line(`case ${this.expression(n)}:`));else t.push(this.line(`case ${this.expression(e.test)}:`));this.indentLevel++;for(let n of e.consequent)t.push(this.statement(n));return t.push(this.line(`break;`)),this.indentLevel--,t.join(`
|
||
`)}switchStringStatement(e){let t=this.expression(e.discriminant),n=[];for(let t of e.cases)if(t.test===null)n.push(`default: () => { ${this.blockContent(t.consequent)} }`);else if(Array.isArray(t.test))for(let e of t.test)n.push(`${this.expression(e)}: () => { ${this.blockContent(t.consequent)} }`);else n.push(`${this.expression(t.test)}: () => { ${this.blockContent(t.consequent)} }`);return this.line(`${this.runtime}.switchStr(${t}, { ${n.join(`, `)} });`)}returnStatement(e){return e.value?this.line(`return ${this.expression(e.value)};`):this.line(`return;`)}blockStatement(e){this.indentLevel++;let t=e.body.map(e=>this.statement(e)).join(`
|
||
`);return this.indentLevel--,`{\n${t}\n${this.line(`}`)}`}statementAsBlock(e){if(e.type===`BlockStatement`)return this.blockStatement(e);this.indentLevel++;let t=this.statement(e);return this.indentLevel--,`{\n${t}\n${this.line(`}`)}`}blockContent(e){return e.map(e=>this.statement(e).trim()).join(` `)}expression(e){switch(e.type){case`Identifier`:return this.identifier(e);case`Variable`:return this.variable(e);case`NumberLiteral`:return String(e.value);case`StringLiteral`:return JSON.stringify(e.value);case`BooleanLiteral`:return String(e.value);case`BinaryExpression`:return this.binaryExpression(e);case`UnaryExpression`:return this.unaryExpression(e);case`PostfixExpression`:return this.postfixExpression(e);case`AssignmentExpression`:return this.assignmentExpression(e);case`ConditionalExpression`:return`(${this.expression(e.test)} ? ${this.expression(e.consequent)} : ${this.expression(e.alternate)})`;case`CallExpression`:return this.callExpression(e);case`MemberExpression`:return this.memberExpression(e);case`IndexExpression`:return this.indexExpression(e);case`TagDereferenceExpression`:return`${this.runtime}.deref(${this.expression(e.argument)})`;case`ObjectDeclaration`:return this.objectDeclaration(e);case`DatablockDeclaration`:return`${this.runtime}.datablock(${JSON.stringify(e.className.name)}, ${e.instanceName?JSON.stringify(e.instanceName.name):`null`}, ${e.parent?JSON.stringify(e.parent.name):`null`}, ${this.objectBody(e.body)})`;default:throw Error(`Unknown expression type: ${e.type}`)}}identifier(e){let t=d(e.name);return t&&t.namespace.toLowerCase()===`parent`?e.name:t?`${this.runtime}.nsRef(${JSON.stringify(t.namespace)}, ${JSON.stringify(t.method)})`:JSON.stringify(e.name)}variable(e){return e.scope===`global`?`${this.globals}.get(${JSON.stringify(e.name)})`:`${this.locals}.get(${JSON.stringify(e.name)})`}binaryExpression(e){let t=this.expression(e.left),n=this.expression(e.right),r=e.operator,i=this.concatExpression(t,r,n);if(i)return i;if(r===`$=`)return`${this.runtime}.streq(${t}, ${n})`;if(r===`!$=`)return`!${this.runtime}.streq(${t}, ${n})`;if(r===`&&`||r===`||`)return`(${t} ${r} ${n})`;let a=f[r];return a?`${a}(${t}, ${n})`:`(${t} ${r} ${n})`}unaryExpression(e){if(e.operator===`++`||e.operator===`--`){let t=this.getAccessInfo(e.argument);if(t){let n=e.operator===`++`?1:-1;return t.setter(`${this.runtime}.add(${t.getter}, ${n})`)}}let t=this.expression(e.argument);return e.operator===`~`?`${this.runtime}.bitnot(${t})`:e.operator===`-`?`${this.runtime}.neg(${t})`:`${e.operator}${t}`}postfixExpression(e){let t=this.getAccessInfo(e.argument);if(t){let n=e.operator===`++`?t.postIncHelper:t.postDecHelper;if(n)return n}return`${this.expression(e.argument)}${e.operator}`}assignmentExpression(e){let t=this.expression(e.value),n=e.operator,r=this.getAccessInfo(e.target);if(!r)throw Error(`Unhandled assignment target type: ${e.target.type}`);if(n===`=`)return r.setter(t);{let e=n.slice(0,-1),i=this.compoundAssignmentValue(r.getter,e,t);return r.setter(i)}}callExpression(e){let t=e.arguments.map(e=>this.expression(e)).join(`, `);if(e.callee.type===`Identifier`){let n=e.callee.name,r=d(n);if(r&&r.namespace.toLowerCase()===`parent`){if(this.currentClass)return`${this.runtime}.parent(${JSON.stringify(this.currentClass)}, ${JSON.stringify(r.method)}, arguments[0]${t?`, `+t:``})`;if(this.currentFunction)return`${this.runtime}.parentFunc(${JSON.stringify(this.currentFunction)}${t?`, `+t:``})`;throw Error(`Parent:: call outside of function context`)}return r?`${this.runtime}.nsCall(${JSON.stringify(r.namespace)}, ${JSON.stringify(r.method)}${t?`, `+t:``})`:`${this.functions}.call(${JSON.stringify(n)}${t?`, `+t:``})`}if(e.callee.type===`MemberExpression`){let n=this.expression(e.callee.object),r=e.callee.property.type===`Identifier`?JSON.stringify(e.callee.property.name):this.expression(e.callee.property);return`${this.runtime}.call(${n}, ${r}${t?`, `+t:``})`}return`${this.expression(e.callee)}(${t})`}memberExpression(e){let t=this.expression(e.object);return e.computed||e.property.type!==`Identifier`?`${this.runtime}.prop(${t}, ${this.expression(e.property)})`:`${this.runtime}.prop(${t}, ${JSON.stringify(e.property.name)})`}indexExpression(e){let t=Array.isArray(e.index)?e.index.map(e=>this.expression(e)):[this.expression(e.index)];if(e.object.type===`Variable`){let n=JSON.stringify(e.object.name);return`${e.object.scope===`global`?this.globals:this.locals}.get(${n}, ${t.join(`, `)})`}if(e.object.type===`MemberExpression`){let n=e.object,r=this.expression(n.object),i=n.property.type===`Identifier`?JSON.stringify(n.property.name):this.expression(n.property),a=`${this.runtime}.key(${i}, ${t.join(`, `)})`;return`${this.runtime}.prop(${r}, ${a})`}let n=this.expression(e.object);return t.length===1?`${this.runtime}.getIndex(${n}, ${t[0]})`:`${this.runtime}.getIndex(${n}, ${this.runtime}.key(${t.join(`, `)}))`}line(e){return this.indent.repeat(this.indentLevel)+e}concatExpression(e,t,n){switch(t){case`@`:return`${this.runtime}.concat(${e}, ${n})`;case`SPC`:return`${this.runtime}.concat(${e}, " ", ${n})`;case`TAB`:return`${this.runtime}.concat(${e}, "\\t", ${n})`;case`NL`:return`${this.runtime}.concat(${e}, "\\n", ${n})`;default:return null}}compoundAssignmentValue(e,t,n){let r=this.concatExpression(e,t,n);if(r)return r;let i=f[t];return i?`${i}(${e}, ${n})`:`(${e} ${t} ${n})`}};function m(e,t){return new p(t).generate(e)}var h=t(((e,t)=>{var n=`\\\\/`,r=`[^${n}]`,i=`\\.`,a=`\\+`,o=`\\?`,s=`\\/`,c=`(?=.)`,l=`[^/]`,u=`(?:${s}|$)`,d=`(?:^|${s})`,f=`${i}{1,2}${u}`,p={DOT_LITERAL:i,PLUS_LITERAL:a,QMARK_LITERAL:o,SLASH_LITERAL:s,ONE_CHAR:c,QMARK:l,END_ANCHOR:u,DOTS_SLASH:f,NO_DOT:`(?!${i})`,NO_DOTS:`(?!${d}${f})`,NO_DOT_SLASH:`(?!${i}{0,1}${u})`,NO_DOTS_SLASH:`(?!${f})`,QMARK_NO_DOT:`[^.${s}]`,STAR:`${l}*?`,START_ANCHOR:d,SEP:`/`},m={...p,SLASH_LITERAL:`[${n}]`,QMARK:r,STAR:`${r}*?`,DOTS_SLASH:`${i}{1,2}(?:[${n}]|$)`,NO_DOT:`(?!${i})`,NO_DOTS:`(?!(?:^|[${n}])${i}{1,2}(?:[${n}]|$))`,NO_DOT_SLASH:`(?!${i}{0,1}(?:[${n}]|$))`,NO_DOTS_SLASH:`(?!${i}{1,2}(?:[${n}]|$))`,QMARK_NO_DOT:`[^.${n}]`,START_ANCHOR:`(?:^|[${n}])`,END_ANCHOR:`(?:[${n}]|$)`,SEP:`\\`};t.exports={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:{alnum:`a-zA-Z0-9`,alpha:`a-zA-Z`,ascii:`\\x00-\\x7F`,blank:` \\t`,cntrl:`\\x00-\\x1F\\x7F`,digit:`0-9`,graph:`\\x21-\\x7E`,lower:`a-z`,print:`\\x20-\\x7E `,punct:`\\-!"#$%&'()\\*+,./:;<=>?@[\\]^_\`{|}~`,space:` \\t\\r\\n\\v\\f`,upper:`A-Z`,word:`A-Za-z0-9_`,xdigit:`A-Fa-f0-9`},REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":`*`,"**/**":`**`,"**/**/**":`**`},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(e){return{"!":{type:`negate`,open:`(?:(?!(?:`,close:`))${e.STAR})`},"?":{type:`qmark`,open:`(?:`,close:`)?`},"+":{type:`plus`,open:`(?:`,close:`)+`},"*":{type:`star`,open:`(?:`,close:`)*`},"@":{type:`at`,open:`(?:`,close:`)`}}},globChars(e){return e===!0?m:p}}})),g=t((e=>{var{REGEX_BACKSLASH:t,REGEX_REMOVE_BACKSLASH:n,REGEX_SPECIAL_CHARS:r,REGEX_SPECIAL_CHARS_GLOBAL:i}=h();e.isObject=e=>typeof e==`object`&&!!e&&!Array.isArray(e),e.hasRegexChars=e=>r.test(e),e.isRegexChar=t=>t.length===1&&e.hasRegexChars(t),e.escapeRegex=e=>e.replace(i,`\\$1`),e.toPosixSlashes=e=>e.replace(t,`/`),e.isWindows=()=>{if(typeof navigator<`u`&&navigator.platform){let e=navigator.platform.toLowerCase();return e===`win32`||e===`windows`}return typeof process<`u`&&process.platform?process.platform===`win32`:!1},e.removeBackslashes=e=>e.replace(n,e=>e===`\\`?``:e),e.escapeLast=(t,n,r)=>{let i=t.lastIndexOf(n,r);return i===-1?t:t[i-1]===`\\`?e.escapeLast(t,n,i-1):`${t.slice(0,i)}\\${t.slice(i)}`},e.removePrefix=(e,t={})=>{let n=e;return n.startsWith(`./`)&&(n=n.slice(2),t.prefix=`./`),n},e.wrapOutput=(e,t={},n={})=>{let r=`${n.contains?``:`^`}(?:${e})${n.contains?``:`$`}`;return t.negated===!0&&(r=`(?:^(?!${r}).*$)`),r},e.basename=(e,{windows:t}={})=>{let n=e.split(t?/[\\/]/:`/`),r=n[n.length-1];return r===``?n[n.length-2]:r}})),ee=t(((e,t)=>{var n=g(),{CHAR_ASTERISK:r,CHAR_AT:i,CHAR_BACKWARD_SLASH:a,CHAR_COMMA:o,CHAR_DOT:s,CHAR_EXCLAMATION_MARK:c,CHAR_FORWARD_SLASH:l,CHAR_LEFT_CURLY_BRACE:u,CHAR_LEFT_PARENTHESES:d,CHAR_LEFT_SQUARE_BRACKET:f,CHAR_PLUS:p,CHAR_QUESTION_MARK:m,CHAR_RIGHT_CURLY_BRACE:ee,CHAR_RIGHT_PARENTHESES:_,CHAR_RIGHT_SQUARE_BRACKET:te}=h(),ne=e=>e===l||e===a,v=e=>{e.isPrefix!==!0&&(e.depth=e.isGlobstar?1/0:1)};t.exports=(e,t)=>{let h=t||{},g=e.length-1,y=h.parts===!0||h.scanToEnd===!0,b=[],x=[],S=[],C=e,w=-1,T=0,re=0,ie=!1,ae=!1,E=!1,D=!1,oe=!1,O=!1,k=!1,A=!1,j=!1,M=!1,N=0,P,F,I={value:``,depth:0,isGlob:!1},L=()=>w>=g,se=()=>C.charCodeAt(w+1),R=()=>(P=F,C.charCodeAt(++w));for(;w<g;){F=R();let e;if(F===a){k=I.backslashes=!0,F=R(),F===u&&(O=!0);continue}if(O===!0||F===u){for(N++;L()!==!0&&(F=R());){if(F===a){k=I.backslashes=!0,R();continue}if(F===u){N++;continue}if(O!==!0&&F===s&&(F=R())===s){if(ie=I.isBrace=!0,E=I.isGlob=!0,M=!0,y===!0)continue;break}if(O!==!0&&F===o){if(ie=I.isBrace=!0,E=I.isGlob=!0,M=!0,y===!0)continue;break}if(F===ee&&(N--,N===0)){O=!1,ie=I.isBrace=!0,M=!0;break}}if(y===!0)continue;break}if(F===l){if(b.push(w),x.push(I),I={value:``,depth:0,isGlob:!1},M===!0)continue;if(P===s&&w===T+1){T+=2;continue}re=w+1;continue}if(h.noext!==!0&&(F===p||F===i||F===r||F===m||F===c)&&se()===d){if(E=I.isGlob=!0,D=I.isExtglob=!0,M=!0,F===c&&w===T&&(j=!0),y===!0){for(;L()!==!0&&(F=R());){if(F===a){k=I.backslashes=!0,F=R();continue}if(F===_){E=I.isGlob=!0,M=!0;break}}continue}break}if(F===r){if(P===r&&(oe=I.isGlobstar=!0),E=I.isGlob=!0,M=!0,y===!0)continue;break}if(F===m){if(E=I.isGlob=!0,M=!0,y===!0)continue;break}if(F===f){for(;L()!==!0&&(e=R());){if(e===a){k=I.backslashes=!0,R();continue}if(e===te){ae=I.isBracket=!0,E=I.isGlob=!0,M=!0;break}}if(y===!0)continue;break}if(h.nonegate!==!0&&F===c&&w===T){A=I.negated=!0,T++;continue}if(h.noparen!==!0&&F===d){if(E=I.isGlob=!0,y===!0){for(;L()!==!0&&(F=R());){if(F===d){k=I.backslashes=!0,F=R();continue}if(F===_){M=!0;break}}continue}break}if(E===!0){if(M=!0,y===!0)continue;break}}h.noext===!0&&(D=!1,E=!1);let z=C,B=``,V=``;T>0&&(B=C.slice(0,T),C=C.slice(T),re-=T),z&&E===!0&&re>0?(z=C.slice(0,re),V=C.slice(re)):E===!0?(z=``,V=C):z=C,z&&z!==``&&z!==`/`&&z!==C&&ne(z.charCodeAt(z.length-1))&&(z=z.slice(0,-1)),h.unescape===!0&&(V&&=n.removeBackslashes(V),z&&k===!0&&(z=n.removeBackslashes(z)));let H={prefix:B,input:e,start:T,base:z,glob:V,isBrace:ie,isBracket:ae,isGlob:E,isExtglob:D,isGlobstar:oe,negated:A,negatedExtglob:j};if(h.tokens===!0&&(H.maxDepth=0,ne(F)||x.push(I),H.tokens=x),h.parts===!0||h.tokens===!0){let t;for(let n=0;n<b.length;n++){let r=t?t+1:T,i=b[n],a=e.slice(r,i);h.tokens&&(n===0&&T!==0?(x[n].isPrefix=!0,x[n].value=B):x[n].value=a,v(x[n]),H.maxDepth+=x[n].depth),(n!==0||a!==``)&&S.push(a),t=i}if(t&&t+1<e.length){let n=e.slice(t+1);S.push(n),h.tokens&&(x[x.length-1].value=n,v(x[x.length-1]),H.maxDepth+=x[x.length-1].depth)}H.slashes=b,H.parts=S}return H}})),_=t(((e,t)=>{var n=h(),r=g(),{MAX_LENGTH:i,POSIX_REGEX_SOURCE:a,REGEX_NON_SPECIAL_CHARS:o,REGEX_SPECIAL_CHARS_BACKREF:s,REPLACEMENTS:c}=n,l=(e,t)=>{if(typeof t.expandRange==`function`)return t.expandRange(...e,t);e.sort();let n=`[${e.join(`-`)}]`;try{new RegExp(n)}catch{return e.map(e=>r.escapeRegex(e)).join(`..`)}return n},u=(e,t)=>`Missing ${e}: "${t}" - use "\\\\${t}" to match literal characters`,d=(e,t)=>{if(typeof e!=`string`)throw TypeError(`Expected a string`);e=c[e]||e;let f={...t},p=typeof f.maxLength==`number`?Math.min(i,f.maxLength):i,m=e.length;if(m>p)throw SyntaxError(`Input length: ${m}, exceeds maximum allowed length: ${p}`);let h={type:`bos`,value:``,output:f.prepend||``},g=[h],ee=f.capture?``:`?:`,_=n.globChars(f.windows),te=n.extglobChars(_),{DOT_LITERAL:ne,PLUS_LITERAL:v,SLASH_LITERAL:y,ONE_CHAR:b,DOTS_SLASH:x,NO_DOT:S,NO_DOT_SLASH:C,NO_DOTS_SLASH:w,QMARK:T,QMARK_NO_DOT:re,STAR:ie,START_ANCHOR:ae}=_,E=e=>`(${ee}(?:(?!${ae}${e.dot?x:ne}).)*?)`,D=f.dot?``:S,oe=f.dot?T:re,O=f.bash===!0?E(f):ie;f.capture&&(O=`(${O})`),typeof f.noext==`boolean`&&(f.noextglob=f.noext);let k={input:e,index:-1,start:0,dot:f.dot===!0,consumed:``,output:``,prefix:``,backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:g};e=r.removePrefix(e,k),m=e.length;let A=[],j=[],M=[],N=h,P,F=()=>k.index===m-1,I=k.peek=(t=1)=>e[k.index+t],L=k.advance=()=>e[++k.index]||``,se=()=>e.slice(k.index+1),R=(e=``,t=0)=>{k.consumed+=e,k.index+=t},z=e=>{k.output+=e.output==null?e.value:e.output,R(e.value)},B=()=>{let e=1;for(;I()===`!`&&(I(2)!==`(`||I(3)===`?`);)L(),k.start++,e++;return e%2==0?!1:(k.negated=!0,k.start++,!0)},V=e=>{k[e]++,M.push(e)},H=e=>{k[e]--,M.pop()},U=e=>{if(N.type===`globstar`){let t=k.braces>0&&(e.type===`comma`||e.type===`brace`),n=e.extglob===!0||A.length&&(e.type===`pipe`||e.type===`paren`);e.type!==`slash`&&e.type!==`paren`&&!t&&!n&&(k.output=k.output.slice(0,-N.output.length),N.type=`star`,N.value=`*`,N.output=O,k.output+=N.output)}if(A.length&&e.type!==`paren`&&(A[A.length-1].inner+=e.value),(e.value||e.output)&&z(e),N&&N.type===`text`&&e.type===`text`){N.output=(N.output||N.value)+e.value,N.value+=e.value;return}e.prev=N,g.push(e),N=e},ce=(e,t)=>{let n={...te[t],conditions:1,inner:``};n.prev=N,n.parens=k.parens,n.output=k.output;let r=(f.capture?`(`:``)+n.open;V(`parens`),U({type:e,value:t,output:k.output?``:b}),U({type:`paren`,extglob:!0,value:L(),output:r}),A.push(n)},le=e=>{let n=e.close+(f.capture?`)`:``),r;if(e.type===`negate`){let i=O;e.inner&&e.inner.length>1&&e.inner.includes(`/`)&&(i=E(f)),(i!==O||F()||/^\)+$/.test(se()))&&(n=e.close=`)$))${i}`),e.inner.includes(`*`)&&(r=se())&&/^\.[^\\/.]+$/.test(r)&&(n=e.close=`)${d(r,{...t,fastpaths:!1}).output})${i})`),e.prev.type===`bos`&&(k.negatedExtglob=!0)}U({type:`paren`,extglob:!0,value:P,output:n}),H(`parens`)};if(f.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(e)){let n=!1,i=e.replace(s,(e,t,r,i,a,o)=>i===`\\`?(n=!0,e):i===`?`?t?t+i+(a?T.repeat(a.length):``):o===0?oe+(a?T.repeat(a.length):``):T.repeat(r.length):i===`.`?ne.repeat(r.length):i===`*`?t?t+i+(a?O:``):O:t?e:`\\${e}`);return n===!0&&(i=f.unescape===!0?i.replace(/\\/g,``):i.replace(/\\+/g,e=>e.length%2==0?`\\\\`:e?`\\`:``)),i===e&&f.contains===!0?(k.output=e,k):(k.output=r.wrapOutput(i,k,t),k)}for(;!F();){if(P=L(),P===`\0`)continue;if(P===`\\`){let e=I();if(e===`/`&&f.bash!==!0||e===`.`||e===`;`)continue;if(!e){P+=`\\`,U({type:`text`,value:P});continue}let t=/^\\+/.exec(se()),n=0;if(t&&t[0].length>2&&(n=t[0].length,k.index+=n,n%2!=0&&(P+=`\\`)),f.unescape===!0?P=L():P+=L(),k.brackets===0){U({type:`text`,value:P});continue}}if(k.brackets>0&&(P!==`]`||N.value===`[`||N.value===`[^`)){if(f.posix!==!1&&P===`:`){let e=N.value.slice(1);if(e.includes(`[`)&&(N.posix=!0,e.includes(`:`))){let e=N.value.lastIndexOf(`[`),t=N.value.slice(0,e),n=a[N.value.slice(e+2)];if(n){N.value=t+n,k.backtrack=!0,L(),!h.output&&g.indexOf(N)===1&&(h.output=b);continue}}}(P===`[`&&I()!==`:`||P===`-`&&I()===`]`)&&(P=`\\${P}`),P===`]`&&(N.value===`[`||N.value===`[^`)&&(P=`\\${P}`),f.posix===!0&&P===`!`&&N.value===`[`&&(P=`^`),N.value+=P,z({value:P});continue}if(k.quotes===1&&P!==`"`){P=r.escapeRegex(P),N.value+=P,z({value:P});continue}if(P===`"`){k.quotes=k.quotes===1?0:1,f.keepQuotes===!0&&U({type:`text`,value:P});continue}if(P===`(`){V(`parens`),U({type:`paren`,value:P});continue}if(P===`)`){if(k.parens===0&&f.strictBrackets===!0)throw SyntaxError(u(`opening`,`(`));let e=A[A.length-1];if(e&&k.parens===e.parens+1){le(A.pop());continue}U({type:`paren`,value:P,output:k.parens?`)`:`\\)`}),H(`parens`);continue}if(P===`[`){if(f.nobracket===!0||!se().includes(`]`)){if(f.nobracket!==!0&&f.strictBrackets===!0)throw SyntaxError(u(`closing`,`]`));P=`\\${P}`}else V(`brackets`);U({type:`bracket`,value:P});continue}if(P===`]`){if(f.nobracket===!0||N&&N.type===`bracket`&&N.value.length===1){U({type:`text`,value:P,output:`\\${P}`});continue}if(k.brackets===0){if(f.strictBrackets===!0)throw SyntaxError(u(`opening`,`[`));U({type:`text`,value:P,output:`\\${P}`});continue}H(`brackets`);let e=N.value.slice(1);if(N.posix!==!0&&e[0]===`^`&&!e.includes(`/`)&&(P=`/${P}`),N.value+=P,z({value:P}),f.literalBrackets===!1||r.hasRegexChars(e))continue;let t=r.escapeRegex(N.value);if(k.output=k.output.slice(0,-N.value.length),f.literalBrackets===!0){k.output+=t,N.value=t;continue}N.value=`(${ee}${t}|${N.value})`,k.output+=N.value;continue}if(P===`{`&&f.nobrace!==!0){V(`braces`);let e={type:`brace`,value:P,output:`(`,outputIndex:k.output.length,tokensIndex:k.tokens.length};j.push(e),U(e);continue}if(P===`}`){let e=j[j.length-1];if(f.nobrace===!0||!e){U({type:`text`,value:P,output:P});continue}let t=`)`;if(e.dots===!0){let e=g.slice(),n=[];for(let t=e.length-1;t>=0&&(g.pop(),e[t].type!==`brace`);t--)e[t].type!==`dots`&&n.unshift(e[t].value);t=l(n,f),k.backtrack=!0}if(e.comma!==!0&&e.dots!==!0){let n=k.output.slice(0,e.outputIndex),r=k.tokens.slice(e.tokensIndex);e.value=e.output=`\\{`,P=t=`\\}`,k.output=n;for(let e of r)k.output+=e.output||e.value}U({type:`brace`,value:P,output:t}),H(`braces`),j.pop();continue}if(P===`|`){A.length>0&&A[A.length-1].conditions++,U({type:`text`,value:P});continue}if(P===`,`){let e=P,t=j[j.length-1];t&&M[M.length-1]===`braces`&&(t.comma=!0,e=`|`),U({type:`comma`,value:P,output:e});continue}if(P===`/`){if(N.type===`dot`&&k.index===k.start+1){k.start=k.index+1,k.consumed=``,k.output=``,g.pop(),N=h;continue}U({type:`slash`,value:P,output:y});continue}if(P===`.`){if(k.braces>0&&N.type===`dot`){N.value===`.`&&(N.output=ne);let e=j[j.length-1];N.type=`dots`,N.output+=P,N.value+=P,e.dots=!0;continue}if(k.braces+k.parens===0&&N.type!==`bos`&&N.type!==`slash`){U({type:`text`,value:P,output:ne});continue}U({type:`dot`,value:P,output:ne});continue}if(P===`?`){if(!(N&&N.value===`(`)&&f.noextglob!==!0&&I()===`(`&&I(2)!==`?`){ce(`qmark`,P);continue}if(N&&N.type===`paren`){let e=I(),t=P;(N.value===`(`&&!/[!=<:]/.test(e)||e===`<`&&!/<([!=]|\w+>)/.test(se()))&&(t=`\\${P}`),U({type:`text`,value:P,output:t});continue}if(f.dot!==!0&&(N.type===`slash`||N.type===`bos`)){U({type:`qmark`,value:P,output:re});continue}U({type:`qmark`,value:P,output:T});continue}if(P===`!`){if(f.noextglob!==!0&&I()===`(`&&(I(2)!==`?`||!/[!=<:]/.test(I(3)))){ce(`negate`,P);continue}if(f.nonegate!==!0&&k.index===0){B();continue}}if(P===`+`){if(f.noextglob!==!0&&I()===`(`&&I(2)!==`?`){ce(`plus`,P);continue}if(N&&N.value===`(`||f.regex===!1){U({type:`plus`,value:P,output:v});continue}if(N&&(N.type===`bracket`||N.type===`paren`||N.type===`brace`)||k.parens>0){U({type:`plus`,value:P});continue}U({type:`plus`,value:v});continue}if(P===`@`){if(f.noextglob!==!0&&I()===`(`&&I(2)!==`?`){U({type:`at`,extglob:!0,value:P,output:``});continue}U({type:`text`,value:P});continue}if(P!==`*`){(P===`$`||P===`^`)&&(P=`\\${P}`);let e=o.exec(se());e&&(P+=e[0],k.index+=e[0].length),U({type:`text`,value:P});continue}if(N&&(N.type===`globstar`||N.star===!0)){N.type=`star`,N.star=!0,N.value+=P,N.output=O,k.backtrack=!0,k.globstar=!0,R(P);continue}let t=se();if(f.noextglob!==!0&&/^\([^?]/.test(t)){ce(`star`,P);continue}if(N.type===`star`){if(f.noglobstar===!0){R(P);continue}let n=N.prev,r=n.prev,i=n.type===`slash`||n.type===`bos`,a=r&&(r.type===`star`||r.type===`globstar`);if(f.bash===!0&&(!i||t[0]&&t[0]!==`/`)){U({type:`star`,value:P,output:``});continue}let o=k.braces>0&&(n.type===`comma`||n.type===`brace`),s=A.length&&(n.type===`pipe`||n.type===`paren`);if(!i&&n.type!==`paren`&&!o&&!s){U({type:`star`,value:P,output:``});continue}for(;t.slice(0,3)===`/**`;){let n=e[k.index+4];if(n&&n!==`/`)break;t=t.slice(3),R(`/**`,3)}if(n.type===`bos`&&F()){N.type=`globstar`,N.value+=P,N.output=E(f),k.output=N.output,k.globstar=!0,R(P);continue}if(n.type===`slash`&&n.prev.type!==`bos`&&!a&&F()){k.output=k.output.slice(0,-(n.output+N.output).length),n.output=`(?:${n.output}`,N.type=`globstar`,N.output=E(f)+(f.strictSlashes?`)`:`|$)`),N.value+=P,k.globstar=!0,k.output+=n.output+N.output,R(P);continue}if(n.type===`slash`&&n.prev.type!==`bos`&&t[0]===`/`){let e=t[1]===void 0?``:`|$`;k.output=k.output.slice(0,-(n.output+N.output).length),n.output=`(?:${n.output}`,N.type=`globstar`,N.output=`${E(f)}${y}|${y}${e})`,N.value+=P,k.output+=n.output+N.output,k.globstar=!0,R(P+L()),U({type:`slash`,value:`/`,output:``});continue}if(n.type===`bos`&&t[0]===`/`){N.type=`globstar`,N.value+=P,N.output=`(?:^|${y}|${E(f)}${y})`,k.output=N.output,k.globstar=!0,R(P+L()),U({type:`slash`,value:`/`,output:``});continue}k.output=k.output.slice(0,-N.output.length),N.type=`globstar`,N.output=E(f),N.value+=P,k.output+=N.output,k.globstar=!0,R(P);continue}let n={type:`star`,value:P,output:O};if(f.bash===!0){n.output=`.*?`,(N.type===`bos`||N.type===`slash`)&&(n.output=D+n.output),U(n);continue}if(N&&(N.type===`bracket`||N.type===`paren`)&&f.regex===!0){n.output=P,U(n);continue}(k.index===k.start||N.type===`slash`||N.type===`dot`)&&(N.type===`dot`?(k.output+=C,N.output+=C):f.dot===!0?(k.output+=w,N.output+=w):(k.output+=D,N.output+=D),I()!==`*`&&(k.output+=b,N.output+=b)),U(n)}for(;k.brackets>0;){if(f.strictBrackets===!0)throw SyntaxError(u(`closing`,`]`));k.output=r.escapeLast(k.output,`[`),H(`brackets`)}for(;k.parens>0;){if(f.strictBrackets===!0)throw SyntaxError(u(`closing`,`)`));k.output=r.escapeLast(k.output,`(`),H(`parens`)}for(;k.braces>0;){if(f.strictBrackets===!0)throw SyntaxError(u(`closing`,`}`));k.output=r.escapeLast(k.output,`{`),H(`braces`)}if(f.strictSlashes!==!0&&(N.type===`star`||N.type===`bracket`)&&U({type:`maybe_slash`,value:``,output:`${y}?`}),k.backtrack===!0){k.output=``;for(let e of k.tokens)k.output+=e.output==null?e.value:e.output,e.suffix&&(k.output+=e.suffix)}return k};d.fastpaths=(e,t)=>{let a={...t},o=typeof a.maxLength==`number`?Math.min(i,a.maxLength):i,s=e.length;if(s>o)throw SyntaxError(`Input length: ${s}, exceeds maximum allowed length: ${o}`);e=c[e]||e;let{DOT_LITERAL:l,SLASH_LITERAL:u,ONE_CHAR:d,DOTS_SLASH:f,NO_DOT:p,NO_DOTS:m,NO_DOTS_SLASH:h,STAR:g,START_ANCHOR:ee}=n.globChars(a.windows),_=a.dot?m:p,te=a.dot?h:p,ne=a.capture?``:`?:`,v={negated:!1,prefix:``},y=a.bash===!0?`.*?`:g;a.capture&&(y=`(${y})`);let b=e=>e.noglobstar===!0?y:`(${ne}(?:(?!${ee}${e.dot?f:l}).)*?)`,x=e=>{switch(e){case`*`:return`${_}${d}${y}`;case`.*`:return`${l}${d}${y}`;case`*.*`:return`${_}${y}${l}${d}${y}`;case`*/*`:return`${_}${y}${u}${d}${te}${y}`;case`**`:return _+b(a);case`**/*`:return`(?:${_}${b(a)}${u})?${te}${d}${y}`;case`**/*.*`:return`(?:${_}${b(a)}${u})?${te}${y}${l}${d}${y}`;case`**/.*`:return`(?:${_}${b(a)}${u})?${l}${d}${y}`;default:{let t=/^(.*?)\.(\w+)$/.exec(e);if(!t)return;let n=x(t[1]);return n?n+l+t[2]:void 0}}},S=x(r.removePrefix(e,v));return S&&a.strictSlashes!==!0&&(S+=`${u}?`),S},t.exports=d})),te=t(((e,t)=>{var n=ee(),r=_(),i=g(),a=h(),o=e=>e&&typeof e==`object`&&!Array.isArray(e),s=(e,t,n=!1)=>{if(Array.isArray(e)){let r=e.map(e=>s(e,t,n));return e=>{for(let t of r){let n=t(e);if(n)return n}return!1}}let r=o(e)&&e.tokens&&e.input;if(e===``||typeof e!=`string`&&!r)throw TypeError(`Expected pattern to be a non-empty string`);let i=t||{},a=i.windows,c=r?s.compileRe(e,t):s.makeRe(e,t,!1,!0),l=c.state;delete c.state;let u=()=>!1;if(i.ignore){let e={...t,ignore:null,onMatch:null,onResult:null};u=s(i.ignore,e,n)}let d=(n,r=!1)=>{let{isMatch:o,match:d,output:f}=s.test(n,c,t,{glob:e,posix:a}),p={glob:e,state:l,regex:c,posix:a,input:n,output:f,match:d,isMatch:o};return typeof i.onResult==`function`&&i.onResult(p),o===!1?(p.isMatch=!1,r?p:!1):u(n)?(typeof i.onIgnore==`function`&&i.onIgnore(p),p.isMatch=!1,r?p:!1):(typeof i.onMatch==`function`&&i.onMatch(p),r?p:!0)};return n&&(d.state=l),d};s.test=(e,t,n,{glob:r,posix:a}={})=>{if(typeof e!=`string`)throw TypeError(`Expected input to be a string`);if(e===``)return{isMatch:!1,output:``};let o=n||{},c=o.format||(a?i.toPosixSlashes:null),l=e===r,u=l&&c?c(e):e;return l===!1&&(u=c?c(e):e,l=u===r),(l===!1||o.capture===!0)&&(l=o.matchBase===!0||o.basename===!0?s.matchBase(e,t,n,a):t.exec(u)),{isMatch:!!l,match:l,output:u}},s.matchBase=(e,t,n)=>(t instanceof RegExp?t:s.makeRe(t,n)).test(i.basename(e)),s.isMatch=(e,t,n)=>s(t,n)(e),s.parse=(e,t)=>Array.isArray(e)?e.map(e=>s.parse(e,t)):r(e,{...t,fastpaths:!1}),s.scan=(e,t)=>n(e,t),s.compileRe=(e,t,n=!1,r=!1)=>{if(n===!0)return e.output;let i=t||{},a=i.contains?``:`^`,o=i.contains?``:`$`,c=`${a}(?:${e.output})${o}`;e&&e.negated===!0&&(c=`^(?!${c}).*$`);let l=s.toRegex(c,t);return r===!0&&(l.state=e),l},s.makeRe=(e,t={},n=!1,i=!1)=>{if(!e||typeof e!=`string`)throw TypeError(`Expected a non-empty string`);let a={negated:!1,fastpaths:!0};return t.fastpaths!==!1&&(e[0]===`.`||e[0]===`*`)&&(a.output=r.fastpaths(e,t)),a.output||(a=r(e,t)),s.compileRe(a,t,n,i)},s.toRegex=(e,t)=>{try{let n=t||{};return new RegExp(e,n.flags||(n.nocase?`i`:``))}catch(e){if(t&&t.debug===!0)throw e;return/$^/}},s.constants=a,t.exports=s})),ne=t(((e,t)=>{var n=te(),r=g();function i(e,t,i=!1){return t&&(t.windows===null||t.windows===void 0)&&(t={...t,windows:r.isWindows()}),n(e,t,i)}Object.assign(i,n),t.exports=i})),v=class{map=new Map;keyLookup=new Map;constructor(e){if(e)for(let[t,n]of e)this.set(t,n)}get size(){return this.map.size}get(e){let t=this.keyLookup.get(e.toLowerCase());return t===void 0?void 0:this.map.get(t)}set(e,t){let n=e.toLowerCase(),r=this.keyLookup.get(n);return r===void 0?(this.keyLookup.set(n,e),this.map.set(e,t)):this.map.set(r,t),this}has(e){return this.keyLookup.has(e.toLowerCase())}delete(e){let t=e.toLowerCase(),n=this.keyLookup.get(t);return n===void 0?!1:(this.keyLookup.delete(t),this.map.delete(n))}clear(){this.map.clear(),this.keyLookup.clear()}keys(){return this.map.keys()}values(){return this.map.values()}entries(){return this.map.entries()}[Symbol.iterator](){return this.map[Symbol.iterator]()}forEach(e){for(let[t,n]of this.map)e(n,t,this)}get[Symbol.toStringTag](){return`CaseInsensitiveMap`}getOriginalKey(e){return this.keyLookup.get(e.toLowerCase())}},y=class{set=new Set;constructor(e){if(e)for(let t of e)this.add(t)}get size(){return this.set.size}add(e){return this.set.add(e.toLowerCase()),this}has(e){return this.set.has(e.toLowerCase())}delete(e){return this.set.delete(e.toLowerCase())}clear(){this.set.clear()}[Symbol.iterator](){return this.set[Symbol.iterator]()}get[Symbol.toStringTag](){return`CaseInsensitiveSet`}};function b(e){return e.replace(/\\/g,`/`)}function x(e){return b(e).toLowerCase()}function S(e){return String(e??``)}function C(e){return Number(e)||0}function w(e){let t=S(e||`0 0 0`).split(` `).map(Number);return[t[0]||0,t[1]||0,t[2]||0]}var T=`
|
||
`,re=`
|
||
`,ie=`
|
||
`,ae=` `;function E(e,t,n){let r=0;for(;t+r<e.length&&!n.includes(e[t+r]);)r++;return r}function D(e,t,n){let r=0;for(;t>0;){if(r>=e.length)return``;let i=E(e,r,n);if(r+i>=e.length)return``;r+=i+1,t--}let i=E(e,r,n);return i===0?``:e.substring(r,r+i)}function oe(e,t,n,r){let i=0,a=t;for(;a>0;){if(i>=e.length)return``;let t=E(e,i,r);if(i+t>=e.length)return``;i+=t+1,a--}let o=i,s=n-t+1;for(;s>0;){let t=E(e,i,r);if(i+=t,i>=e.length)break;i++,s--}let c=i;return c>o&&r.includes(e[c-1])&&c--,e.substring(o,c)}function O(e,t){if(e===``)return 0;let n=0;for(let r=0;r<e.length;r++)t.includes(e[r])&&n++;return n+1}function k(e,t,n,r,i){let a=[],o=0,s=0;for(;o<e.length||s<=t;){if(o<e.length){let i=E(e,o,r);s===t?a.push(n):a.push(e.substring(o,o+i)),o+=i,o<e.length&&o++}else s===t?a.push(n):a.push(``);if(s++,s>t&&o>=e.length)break}return a.join(i)}function A(e,t,n,r){let i=[],a=0,o=0;for(;a<e.length;){let r=E(e,a,n);o!==t&&i.push(e.substring(a,a+r)),a+=r,a<e.length&&a++,o++}return i.join(r)}function j(e){let{runtime:t,fileSystem:n}=e,r=[],i=0,a=``;return{echo(...e){console.log(...e.map(S))},warn(...e){console.warn(...e.map(S))},error(...e){console.error(...e.map(S))},call(e,...n){return t().$f.call(S(e),...n)},eval(e){throw Error(`eval() not implemented: requires runtime parsing and execution`)},collapseescape(e){return S(e).replace(/\\([ntr\\])/g,(e,t)=>t===`n`?`
|
||
`:t===`t`?` `:t===`r`?`\r`:`\\`)},expandescape(e){return S(e).replace(/\\/g,`\\\\`).replace(/\n/g,`\\n`).replace(/\t/g,`\\t`).replace(/\r/g,`\\r`)},export(e,t,n){console.warn(`export(${e}): not implemented`)},quit(){console.warn(`quit(): not implemented in browser`)},trace(e){},isobject(e){return t().$.isObject(e)},nametoid(e){return t().$.nameToId(e)},strlen(e){return S(e).length},strchr(e,t){let n=S(e),r=S(t)[0]??``,i=n.indexOf(r);return i>=0?n.substring(i):``},strpos(e,t,n){return S(e).indexOf(S(t),C(n))},strcmp(e,t){let n=S(e),r=S(t);return n<r?-1:n>r?1:0},stricmp(e,t){let n=S(e).toLowerCase(),r=S(t).toLowerCase();return n<r?-1:n>r?1:0},strstr(e,t){return S(e).indexOf(S(t))},getsubstr(e,t,n){let r=S(e),i=C(t);return n===void 0?r.substring(i):r.substring(i,i+C(n))},getword(e,t){return D(S(e),C(t),T)},getwordcount(e){return O(S(e),T)},getfield(e,t){return D(S(e),C(t),re)},getfieldcount(e){return O(S(e),re)},setword(e,t,n){return k(S(e),C(t),S(n),T,` `)},setfield(e,t,n){return k(S(e),C(t),S(n),re,ae)},firstword(e){return D(S(e),0,T)},restwords(e){return oe(S(e),1,1e6,T)},trim(e){return S(e).trim()},ltrim(e){return S(e).replace(/^\s+/,``)},rtrim(e){return S(e).replace(/\s+$/,``)},strupr(e){return S(e).toUpperCase()},strlwr(e){return S(e).toLowerCase()},strreplace(e,t,n){return S(e).split(S(t)).join(S(n))},filterstring(e,t){return S(e)},stripchars(e,t){let n=S(e),r=new Set(S(t).split(``));return n.split(``).filter(e=>!r.has(e)).join(``)},getfields(e,t,n){let r=n===void 0?1e6:Number(n);return oe(S(e),C(t),r,re)},getwords(e,t,n){let r=n===void 0?1e6:Number(n);return oe(S(e),C(t),r,T)},removeword(e,t){return A(S(e),C(t),T,` `)},removefield(e,t){return A(S(e),C(t),re,ae)},getrecord(e,t){return D(S(e),C(t),ie)},getrecordcount(e){return O(S(e),ie)},setrecord(e,t,n){return k(S(e),C(t),S(n),ie,`
|
||
`)},removerecord(e,t){return A(S(e),C(t),ie,`
|
||
`)},nexttoken(e,t,n){throw Error(`nextToken() is not implemented: it requires variable mutation`)},strtoplayername(e){return S(e).replace(/[^\w\s-]/g,``).trim()},mabs(e){return Math.abs(C(e))},mfloor(e){return Math.floor(C(e))},mceil(e){return Math.ceil(C(e))},msqrt(e){return Math.sqrt(C(e))},mpow(e,t){return C(e)**+C(t)},msin(e){return Math.sin(C(e))},mcos(e){return Math.cos(C(e))},mtan(e){return Math.tan(C(e))},masin(e){return Math.asin(C(e))},macos(e){return Math.acos(C(e))},matan(e,t){return Math.atan2(C(e),C(t))},mlog(e){return Math.log(C(e))},getrandom(e,t){if(e===void 0)return Math.random();if(t===void 0)return Math.floor(Math.random()*(C(e)+1));let n=C(e),r=C(t);return Math.floor(Math.random()*(r-n+1))+n},mdegtorad(e){return C(e)*(Math.PI/180)},mradtodeg(e){return C(e)*(180/Math.PI)},mfloatlength(e,t){return C(e).toFixed(C(t))},getboxcenter(e){let t=S(e).split(` `).map(Number),n=t[0]||0,r=t[1]||0,i=t[2]||0,a=t[3]||0,o=t[4]||0,s=t[5]||0;return`${(n+a)/2} ${(r+o)/2} ${(i+s)/2}`},vectoradd(e,t){let[n,r,i]=w(e),[a,o,s]=w(t);return`${n+a} ${r+o} ${i+s}`},vectorsub(e,t){let[n,r,i]=w(e),[a,o,s]=w(t);return`${n-a} ${r-o} ${i-s}`},vectorscale(e,t){let[n,r,i]=w(e),a=C(t);return`${n*a} ${r*a} ${i*a}`},vectordot(e,t){let[n,r,i]=w(e),[a,o,s]=w(t);return n*a+r*o+i*s},vectorcross(e,t){let[n,r,i]=w(e),[a,o,s]=w(t);return`${r*s-i*o} ${i*a-n*s} ${n*o-r*a}`},vectorlen(e){let[t,n,r]=w(e);return Math.sqrt(t*t+n*n+r*r)},vectornormalize(e){let[t,n,r]=w(e),i=Math.sqrt(t*t+n*n+r*r);return i===0?`0 0 0`:`${t/i} ${n/i} ${r/i}`},vectordist(e,t){let[n,r,i]=w(e),[a,o,s]=w(t),c=n-a,l=r-o,u=i-s;return Math.sqrt(c*c+l*l+u*u)},matrixcreate(e,t){throw Error(`MatrixCreate() not implemented: requires axis-angle rotation math`)},matrixcreatefromeuler(e){throw Error(`MatrixCreateFromEuler() not implemented: requires Euler→Quaternion→AxisAngle conversion`)},matrixmultiply(e,t){throw Error(`MatrixMultiply() not implemented: requires full 4x4 matrix multiplication`)},matrixmulpoint(e,t){throw Error(`MatrixMulPoint() not implemented: requires full transform application`)},matrixmulvector(e,t){throw Error(`MatrixMulVector() not implemented: requires rotation matrix application`)},getsimtime(){return Date.now()-t().state.startTime},getrealtime(){return Date.now()},schedule(e,n,r,...i){let a=Number(e)||0,o=t(),s=setTimeout(()=>{o.state.pendingTimeouts.delete(s);try{o.$f.call(String(r),...i)}catch(e){throw console.error(`schedule: error calling ${r}:`,e),e}},a);return o.state.pendingTimeouts.add(s),s},cancel(e){clearTimeout(e),t().state.pendingTimeouts.delete(e)},iseventpending(e){return t().state.pendingTimeouts.has(e)},exec(e){let n=String(e??``);if(console.debug(`exec(${JSON.stringify(n)}): preparing to execute…`),!n.includes(`.`))return console.error(`exec: invalid script file name ${JSON.stringify(n)}.`),!1;let r=x(n),i=t(),{executedScripts:a,scripts:o}=i.state;if(a.has(r))return console.debug(`exec(${JSON.stringify(n)}): skipping (already executed)`),!0;let s=o.get(r);return s==null?(console.warn(`exec(${JSON.stringify(n)}): script not found`),!1):(a.add(r),console.debug(`exec(${JSON.stringify(n)}): executing!`),i.executeAST(s),!0)},compile(e){throw Error(`compile() not implemented: requires DSO bytecode compiler`)},isdemo(){return!1},isfile(e){return n?n.isFile(S(e)):(console.warn(`isFile(): no fileSystem handler configured`),!1)},fileext(e){let t=S(e),n=t.lastIndexOf(`.`);return n>=0?t.substring(n):``},filebase(e){let t=S(e),n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`)),r=t.lastIndexOf(`.`),i=n>=0?n+1:0,a=r>i?r:t.length;return t.substring(i,a)},filepath(e){let t=S(e),n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));return n>=0?t.substring(0,n):``},expandfilename(e){throw Error(`expandFilename() not implemented: requires filesystem path expansion`)},findfirstfile(e){return n?(a=S(e),r=n.findFiles(a),i=0,r[i++]??``):(console.warn(`findFirstFile(): no fileSystem handler configured`),``)},findnextfile(e){let t=S(e);if(t!==a){if(!n)return``;a=t,r=n.findFiles(t)}return r[i++]??``},getfilecrc(e){return S(e)},iswriteablefilename(e){return!1},activatepackage(e){t().$.activatePackage(S(e))},deactivatepackage(e){t().$.deactivatePackage(S(e))},ispackage(e){return t().$.isPackage(S(e))},isactivepackage(e){return t().$.isActivePackage(S(e))},getpackagelist(){return t().$.getPackageList()},addmessagecallback(e,t){},alxcreatesource(...e){return 0},alxgetwavelen(e){return 0},alxlistenerf(e,t){},alxplay(...e){return 0},alxsetchannelvolume(e,t){},alxsourcef(e,t,n){},alxstop(e){},alxstopall(){},activatedirectinput(){},activatekeyboard(){},deactivatedirectinput(){},deactivatekeyboard(){},disablejoystick(){},enablejoystick(){},enablewinconsole(e){},isjoystickdetected(){return!1},lockmouse(e){},addmaterialmapping(e,t){},flushtexturecache(){},getdesktopresolution(){return`1920 1080 32`},getdisplaydevicelist(){return`OpenGL`},getresolutionlist(e){return`640 480 800 600 1024 768 1280 720 1920 1080`},getvideodriverinfo(){return`WebGL`},isdevicefullscreenonly(e){return!1},isfullscreen(){return!1},screenshot(e){},setdisplaydevice(e){return!0},setfov(e){},setinteriorrendermode(e){},setopenglanisotropy(e){},setopenglmipreduction(e){},setopenglskymipreduction(e){},setopengltexturecompressionhint(e){},setscreenmode(e,t,n,r){},setverticalsync(e){},setzoomspeed(e){},togglefullscreen(){},videosetgammacorrection(e){},snaptoggle(){},addtaggedstring(e){return 0},buildtaggedstring(e,...t){return``},detag(e){return S(e)},gettag(e){return 0},gettaggedstring(e){return``},removetaggedstring(e){},commandtoclient(e,t,...n){},commandtoserver(e,...t){},cancelserverquery(){},querymasterserver(...e){},querysingleserver(...e){},setnetport(e){return!0},allowconnections(e){},startheartbeat(){},stopheartbeat(){},gotowebpage(e){},deletedatablocks(){},preloaddatablock(e){return!0},containerboxempty(...e){return!0},containerraycast(...e){return``},containersearchcurrdist(){return 0},containersearchnext(){return 0},initcontainerradiussearch(...e){},calcexplosioncoverage(...e){return 1},getcontrolobjectaltitude(){return 0},getcontrolobjectspeed(){return 0},getterrainheight(e){return 0},lightscene(...e){},pathonmissionloaddone(){}}}function M(e){return e.toLowerCase()}function N(e){let t=e.trim();return M(t.startsWith(`$`)?t.slice(1):t)}function P(e,t){let n=e.get(t);return n||(n=new Set,e.set(t,n)),n}function F(e,t){for(let n of t)e.add(M(n))}function I(e){let t=new Set,n=new Map;for(let r of e)for(let e of r.classNames){let i=M(e);if(i===`*`){F(t,r.fields);continue}F(P(n,i),r.fields)}return{anyClassValues:t,valuesByClass:n}}function L(e){let t=new Set,n=new Map;for(let r of e)for(let e of r.classNames){let i=M(e);if(i===`*`){F(t,r.methods);continue}F(P(n,i),r.methods)}return{anyClassValues:t,valuesByClass:n}}function se(e){let t=new Set;for(let n of e)t.add(N(n));return t}function R(e,t,n){if(e.anyClassValues.has(`*`)||e.anyClassValues.has(n))return!0;for(let r of t){let t=e.valuesByClass.get(M(r));if(t&&(t.has(`*`)||t.has(n)))return!0}return!1}var z=[{classNames:[`SceneObject`,`GameBase`,`ShapeBase`,`Item`,`Player`],fields:`position.rotation.scale.transform.hidden.renderingdistance.datablock.shapename.shapefile.initialbarrel.skin.team.health.energy.energylevel.damagelevel.damageflash.damagepercent.damagestate.mountobject.mountedimage.targetposition.targetrotation.targetscale.missiontypeslist.renderenabled.vis.velocity.name`.split(`.`)},{classNames:[`*`],fields:[`position`,`rotation`,`scale`,`hidden`,`shapefile`,`datablock`]}],B=[{classNames:[`SceneObject`,`GameBase`,`ShapeBase`,`SimObject`],methods:[`settransform`,`setposition`,`setrotation`,`setscale`,`sethidden`,`setdatablock`,`setshapename`,`mountimage`,`unmountimage`,`mountobject`,`unmountobject`,`setdamagelevel`,`setenergylevel`,`schedule`,`delete`,`deleteallobjects`,`add`,`remove`,`playthread`,`stopthread`,`setthreaddir`,`pausethread`]},{classNames:[`*`],methods:[`settransform`,`setscale`,`delete`,`add`,`remove`]}],V=[`missionrunning`,`loadingmission`];function H(e){let t=I(e);return(e,n)=>R(t,e,M(n))}function U(e){let t=L(e);return(e,n)=>R(t,e,M(n))}function ce(e){let t=se(e);return e=>{let n=N(e);return t.has(`*`)||t.has(n)}}var le=e(ne(),1),ue=n(`runtime`);function de(){return{scripts:new Map,generatedCode:new WeakMap}}function W(e){return e.toLowerCase()}function fe(e){return(Number(e)|0)>>>0}function pe(e){return Number(e)|0}function me(e){if(e==null)return null;if(typeof e==`string`)return e||null;if(typeof e==`number`)return String(e);throw Error(`Invalid instance name type: ${typeof e}`)}function he(e={}){let t=e.reactiveFieldRules??z,n=e.reactiveMethodRules??B,r=e.reactiveGlobalNames??V,i=H(t),a=U(n),o=ce(r),s=new v,c=new v,l=new v,u=[],d=new y,f=3,p=1027,h=new Map,g=new v,ee=new v,_=new v,te=new v,ne=new v,b=new Set,S=[],C=!1,w=0;if(e.globals)for(let[t,n]of Object.entries(e.globals)){if(!t.startsWith(`$`))throw Error(`Global variable "${t}" must start with $, e.g. "$${t}"`);_.set(t.slice(1),n)}let T=new Set,re=new Set,ie=e.ignoreScripts&&e.ignoreScripts.length>0?(0,le.default)(e.ignoreScripts,{nocase:!0}):null,ae=e.cache??de(),E=ae.scripts,D=ae.generatedCode,oe=new Map;function O(e,t){let n=oe.get(e);n||(n=[],oe.set(e,n)),n.push(t)}function k(e){let t=oe.get(e);t&&t.pop()}function A(e){let t=oe.get(e);return t&&t.length>0?t[t.length-1]:void 0}function M(e,t,n){O(e,t);try{return n()}finally{k(e)}}function N(e,t){return`${e.toLowerCase()}::${t.toLowerCase()}`}function P(e,t){return s.get(e)?.get(t)??null}function F(e){if(!e)return[];let t=[],n=new Set,r=e.class||e._className||e._class,i=r?W(String(r)):``;for(;i&&!n.has(i);)t.push(i),n.add(i),i=ne.get(i)??``;return e._superClass&&!n.has(e._superClass)&&t.push(e._superClass),t}function I(){if(C=!1,S.length===0)return;let e=S.splice(0,S.length);w+=1;for(let t of b)t({type:`batch.flushed`,tick:w,events:e})}function L(e){S.push(e);for(let t of b)t(e);C||(C=!0,queueMicrotask(I))}function se(e){L({type:`object.created`,objectId:e._id,object:e})}function R(e){L({type:`object.deleted`,objectId:e._id,object:e})}function he(e,t,n,r){let a=W(t);Object.is(n,r)||i(F(e),a)&&L({type:`field.changed`,objectId:e._id,field:a,value:n,previousValue:r,object:e})}function ge(e,t,n,r){let i=F(n);a(i.length?i:[e],t)&&L({type:`method.called`,className:W(e),methodName:W(t),objectId:n._id,args:[...r]})}function _e(e,t,n){let r=W(e.startsWith(`$`)?e.slice(1):e);Object.is(t,n)||o(r)&&L({type:`global.changed`,name:r,value:t,previousValue:n})}let ve=new Set,be=null,xe=null,Se=(e.builtins??j)({runtime:()=>xe,fileSystem:e.fileSystem??null});function Ce(e,t,n){if(be)be.methods.has(e)||be.methods.set(e,new v),be.methods.get(e).set(t,n);else{s.has(e)||s.set(e,new v);let r=s.get(e);r.has(t)||r.set(t,[]),r.get(t).push(n)}}function we(e,t){be?be.functions.set(e,t):(c.has(e)||c.set(e,[]),c.get(e).push(t))}function Te(e){let t=l.get(e);if(!t){d.add(e);return}if(!t.active){t.active=!0,u.push(t.name);for(let[e,n]of t.methods){s.has(e)||s.set(e,new v);let t=s.get(e);for(let[e,r]of n)t.has(e)||t.set(e,[]),t.get(e).push(r)}for(let[e,n]of t.functions)c.has(e)||c.set(e,[]),c.get(e).push(n)}}function Ee(e){let t=l.get(e);if(!t||!t.active)return;t.active=!1;let n=u.findIndex(t=>t.toLowerCase()===e.toLowerCase());n!==-1&&u.splice(n,1);for(let[e,n]of t.methods){let t=s.get(e);if(t)for(let[e,r]of n){let n=t.get(e);if(n){let e=n.indexOf(r);e!==-1&&n.splice(e,1)}}}for(let[e,n]of t.functions){let t=c.get(e);if(t){let e=t.indexOf(n);e!==-1&&t.splice(e,1)}}}function De(e,t){let n=l.get(e);n||(n={name:e,active:!1,methods:new v,functions:new v},l.set(e,n));let r=be;be=n,t(),be=r,d.has(e)&&(d.delete(e),Te(e))}function Oe(){for(;h.has(p);)p+=1;let e=p;return p+=1,e}function ke(){for(;h.has(f);)f+=1;let e=f;return f+=1,e}function Ae(e,t,n,r){let i=W(e),a=Oe(),o={_class:i,_className:e,_id:a};for(let[e,t]of Object.entries(n))o[W(e)]=t;o.superclass&&(o._superClass=W(String(o.superclass)),o.class&&ne.set(W(String(o.class)),o._superClass)),h.set(a,o);let s=me(t);if(s&&(o._name=s,g.set(s,o)),r){for(let e of r)e._parent=o;o._children=r}let c=We(e,`onAdd`);return c&&c(o),se(o),o}function je(e){if(e==null)return!1;let t;if(typeof e==`number`?t=h.get(e):typeof e==`string`?t=g.get(e):typeof e==`object`&&e._id&&(t=e),!t)return!1;let n=We(t._className,`onRemove`);if(n&&n(t),h.delete(t._id),t._name&&g.delete(t._name),t._isDatablock&&t._name&&ee.delete(t._name),t._parent&&t._parent._children){let e=t._parent._children.indexOf(t);e!==-1&&t._parent._children.splice(e,1)}if(t._children)for(let e of[...t._children])je(e);return R(t),!0}function Me(e,t,n,r){let i=W(e),a=ke(),o={_class:i,_className:e,_id:a,_isDatablock:!0},s=me(n);if(s){let e=ee.get(s);if(e){for(let[t,n]of Object.entries(e))t.startsWith(`_`)||(o[t]=n);o._parent=e}}for(let[e,t]of Object.entries(r))o[W(e)]=t;h.set(a,o);let c=me(t);return c&&(o._name=c,g.set(c,o),ee.set(c,o)),se(o),o}function Ne(e){return e==null||e===``?null:typeof e==`object`&&e._id!=null?e:typeof e==`string`?g.get(e)??null:typeof e==`number`?h.get(e)??null:null}function Pe(e,t){let n=Ne(e);return n==null?``:n[W(t)]??``}function Fe(e,t,n){let r=Ne(e);if(r==null)return n;let i=W(t),a=r[i];return r[i]=n,he(r,i,n,a),n}function Ie(e,t){let n=Ne(e);return n==null?``:n[String(t)]??``}function Le(e,t,n){let r=Ne(e);if(r==null)return n;let i=String(t),a=r[i];return r[i]=n,he(r,i,n,a),n}function Re(e,t,n){let r=Ne(e);if(r==null)return 0;let i=G(r[t]);return r[t]=i+n,he(r,t,r[t],i),i}function ze(e,t){return Re(e,W(t),1)}function Be(e,t){return Re(e,W(t),-1)}function Ve(e,t){return Re(e,String(t),1)}function He(e,t){return Re(e,String(t),-1)}function Ue(e,...t){return e+t.join(`_`)}function We(e,t){let n=P(e,t);return n&&n.length>0?n[n.length-1]:null}function Ge(e,t,n,r){let i=P(e,t);return!i||i.length===0?{found:!1}:{found:!0,result:M(N(e,t),i.length-1,()=>i[i.length-1](n,...r))}}function Ke(e,t,n,r){ge(e,t,n,r);let i=te.get(e);if(i){let e=i.get(t);if(e)for(let t of e)t(n,...r)}}function qe(e,t,...n){if(e==null||(typeof e==`string`||typeof e==`number`)&&(e=yt(e),e==null))return``;let r=e.class||e._className||e._class;if(r){let i=Ge(r,t,e,n);if(i.found)return Ke(r,t,e,n),i.result}let i=e._superClass||ne.get(r);for(;i;){let r=Ge(i,t,e,n);if(r.found)return Ke(i,t,e,n),r.result;i=ne.get(i)}return``}function Je(e,t,...n){let r=P(e,t);if(!r||r.length===0)return``;let i=N(e,t),a=r[r.length-1],o=M(i,r.length-1,()=>a(...n)),s=n[0];return s&&typeof s==`object`&&Ke(e,t,s,n.slice(1)),o}function Ye(e,t){let n=P(e,t);if(!n||n.length===0)return null;let r=N(e,t),i=n[n.length-1];return(...e)=>M(r,n.length-1,()=>i(...e))}function Xe(e,t,n,...r){let i=P(e,t),a=N(e,t),o=A(a);if(i&&o!==void 0&&o>=1){let s=o-1,c=M(a,s,()=>i[s](n,...r));return n&&typeof n==`object`&&Ke(e,t,n,r),c}let s=ne.get(e);for(;s;){let e=P(s,t);if(e&&e.length>0){let i=M(N(s,t),e.length-1,()=>e[e.length-1](n,...r));return n&&typeof n==`object`&&Ke(s,t,n,r),i}s=ne.get(s)}return``}function Ze(e,...t){let n=c.get(e);if(!n)return``;let r=e.toLowerCase(),i=A(r);if(i===void 0||i<1)return``;let a=i-1;return M(r,a,()=>n[a](...t))}function G(e){if(e==null||e===``)return 0;let t=Number(e);return isNaN(t)?0:t}function Qe(e,t){return G(e)+G(t)}function $e(e,t){return G(e)-G(t)}function et(e,t){return G(e)*G(t)}function tt(e,t){return G(e)/G(t)}function nt(e){return-G(e)}function rt(e,t){return G(e)<G(t)}function it(e,t){return G(e)<=G(t)}function at(e,t){return G(e)>G(t)}function ot(e,t){return G(e)>=G(t)}function st(e,t){return G(e)===G(t)}function ct(e,t){return G(e)!==G(t)}function K(e,t){let n=pe(t);return n===0?0:pe(e)%n}function lt(e,t){return fe(e)&fe(t)}function ut(e,t){return fe(e)|fe(t)}function dt(e,t){return fe(e)^fe(t)}function ft(e,t){return fe(fe(e)<<(fe(t)&31))}function pt(e,t){return fe(e)>>>(fe(t)&31)}function mt(e){return~fe(e)>>>0}function ht(...e){return e.map(e=>String(e??``)).join(``)}function gt(e,t){return String(e??``).toLowerCase()===String(t??``).toLowerCase()}function _t(e,t){let n=String(e??``).toLowerCase();for(let[e,r]of Object.entries(t))if(e!==`default`&&W(e)===n){r();return}t.default&&t.default()}function vt(e){if(!e||e===``)return null;e.startsWith(`/`)&&(e=e.slice(1));let t=e.split(`/`),n=null;for(let e=0;e<t.length;e++){let r=t[e];if(r){if(e===0)n=/^\d+$/.test(r)?h.get(parseInt(r,10))??null:g.get(r)??null;else{if(!n||!n._children)return null;let e=r.toLowerCase();n=n._children.find(t=>t._name?.toLowerCase()===e)??null}if(!n)return null}}return n}function yt(e){return e==null||e===``?null:vt(String(e))}function bt(e){let t=vt(e);return t?t._id:-1}function xt(e){return e==null?!1:typeof e==`object`&&e._id?!0:typeof e==`number`?h.has(e):typeof e==`string`?g.has(e):!1}function St(e){return c.has(e)||e.toLowerCase()in Se}function Ct(e){return l.has(e)}function wt(e){return l.get(e)?.active??!1}function Tt(){return u.join(` `)}function Et(e,t){function n(e,t){return e+t.join(`_`)}return{get(t,...r){return e.get(n(t,r))??``},set(r,...i){if(i.length===0)throw Error(`set() requires at least a value argument`);if(i.length===1){let n=e.get(r);return e.set(r,i[0]),t?.onSet?.(r,i[0],n),i[0]}let a=i[i.length-1],o=n(r,i.slice(0,-1)),s=e.get(o);return e.set(o,a),t?.onSet?.(o,a,s),a},postInc(r,...i){let a=n(r,i),o=G(e.get(a)),s=o+1;return e.set(a,s),t?.onSet?.(a,s,o),o},postDec(r,...i){let a=n(r,i),o=G(e.get(a)),s=o-1;return e.set(a,s),t?.onSet?.(a,s,o),o}}}function Dt(){return Et(new v)}let Ot={registerMethod:Ce,registerFunction:we,package:De,activatePackage:Te,deactivatePackage:Ee,create:Ae,datablock:Me,deleteObject:je,prop:Pe,setProp:Fe,getIndex:Ie,setIndex:Le,propPostInc:ze,propPostDec:Be,indexPostInc:Ve,indexPostDec:He,key:Ue,call:qe,nsCall:Je,nsRef:Ye,parent:Xe,parentFunc:Ze,add:Qe,sub:$e,mul:et,div:tt,neg:nt,lt:rt,le:it,gt:at,ge:ot,eq:st,ne:ct,mod:K,bitand:lt,bitor:ut,bitxor:dt,shl:ft,shr:pt,bitnot:mt,concat:ht,streq:gt,switchStr:_t,deref:yt,nameToId:bt,isObject:xt,isFunction:St,isPackage:Ct,isActivePackage:wt,getPackageList:Tt,locals:Dt,onMethodCalled(e,t,n){let r=te.get(e);r||(r=new v,te.set(e,r));let i=r.get(t);return i||(i=[],r.set(t,i)),i.push(n),()=>{let e=i.indexOf(n);e!==-1&&i.splice(e,1)}}},kt={call(e,...t){let n=c.get(e);if(n&&n.length>0)return M(e.toLowerCase(),n.length-1,()=>n[n.length-1](...t));let r=Se[e.toLowerCase()];return r?r(...t):(ue.warn(`Unknown function: ${e}(${t.map(e=>JSON.stringify(e)).join(`, `)})`),``)}},At=Et(_,{onSet:_e}),jt={methods:s,functions:c,packages:l,activePackages:u,objectsById:h,objectsByName:g,datablocks:ee,globals:_,executedScripts:T,failedScripts:re,scripts:E,generatedCode:D,pendingTimeouts:ve,startTime:Date.now()};function Mt(){S.length>0&&I();for(let e of jt.pendingTimeouts)clearTimeout(e);jt.pendingTimeouts.clear(),b.clear()}function Nt(e){let t=D.get(e);return t??(t=m(e),D.set(e,t)),t}function Pt(e){let t=Nt(e),n=Dt();Function(`$`,`$f`,`$g`,`$l`,t)(Ot,kt,At,n)}function Ft(e,t){return{execute(){if(t){let e=x(t);jt.executedScripts.add(e)}Pt(e)}}}async function It(t,n,r){let i=e.loadScript;if(!i){t.length>0&&ue.warn(`Script has exec() calls but no loadScript provided: %o`,t);return}async function a(t){e.signal?.throwIfAborted();let a=x(t);if(jt.scripts.has(a)||jt.failedScripts.has(a))return;if(ie&&ie(a)){ue.warn(`Ignoring script: %s`,t),jt.failedScripts.add(a);return}if(r.has(a))return;let o=n.get(a);if(o){await o;return}e.progress?.addItem(t);let s=(async()=>{let o=await i(t);if(o==null){ue.warn(`Script not found: %s`,t),jt.failedScripts.add(a),e.progress?.completeItem();return}let s;try{s=ye(o,{filename:t})}catch(n){ue.warn(`Failed to parse script: %s %o`,t,n),jt.failedScripts.add(a),e.progress?.completeItem();return}let c=new Set(r);c.add(a),await It(s.execScriptPaths,n,c),jt.scripts.set(a,s),e.progress?.completeItem()})();n.set(a,s),await s}await Promise.all(t.map(a))}async function Lt(t){let n=e.loadScript;if(!n)throw Error(`loadFromPath requires loadScript option to be set`);let r=x(t);if(jt.scripts.has(r))return Ft(jt.scripts.get(r),t);e.progress?.addItem(t);let i=await n(t);if(i==null)throw e.progress?.completeItem(),Error(`Script not found: ${t}`);let a=await Rt(i,{path:t});return e.progress?.completeItem(),a}async function Rt(e,t){if(t?.path){let e=x(t.path);if(jt.scripts.has(e))return Ft(jt.scripts.get(e),t.path)}return zt(ye(e,{filename:t?.path}),t)}async function zt(t,n){let r=new Map,i=new Set;if(n?.path){let e=x(n.path);jt.scripts.set(e,t),i.add(e)}return await It([...t.execScriptPaths,...e.preloadScripts??[]],r,i),Ft(t,n?.path)}return xe={$:Ot,$f:kt,$g:At,state:jt,destroy:Mt,executeAST:Pt,loadFromPath:Lt,loadFromSource:Rt,loadFromAST:zt,call:(e,...t)=>kt.call(e,...t),getObjectByName:e=>g.get(e),subscribeRuntimeEvents(e){return b.add(e),()=>{b.delete(e)}}},xe}var ge=n(`engineMethods`);function _e(e){let t=e.$.registerMethod.bind(e.$);t(`ShapeBase`,`playThread`,(e,t,n)=>{e._threads||={},e._threads[Number(t)]={sequence:String(n),playing:!0,direction:!0}}),t(`ShapeBase`,`stopThread`,(e,t)=>{e._threads&&delete e._threads[Number(t)]}),t(`ShapeBase`,`setThreadDir`,(e,t,n)=>{e._threads||={};let r=Number(t);e._threads[r]?e._threads[r].direction=!!Number(n):e._threads[r]={sequence:``,playing:!1,direction:!!Number(n)}}),t(`ShapeBase`,`pauseThread`,(e,t)=>{e._threads?.[Number(t)]&&(e._threads[Number(t)].playing=!1)}),t(`ShapeBase`,`playAudio`,()=>{}),t(`ShapeBase`,`stopAudio`,()=>{}),t(`SimObject`,`getDatablock`,t=>{let n=t.datablock;return n?e.getObjectByName(String(n))??``:``}),t(`SimObject`,`getGroup`,e=>e._parent??``),t(`SimObject`,`getName`,e=>e._name??``),t(`SimObject`,`getType`,()=>16384),t(`SimGroup`,`getCount`,e=>e._children?e._children.length:0),t(`SimGroup`,`getObject`,(e,t)=>{let n=e._children;return n?n[Number(t)]??``:``}),t(`GameBase`,`isEnabled`,()=>!0),t(`GameBase`,`isDisabled`,()=>!1),t(`GameBase`,`setPoweredState`,()=>{}),t(`GameBase`,`setRechargeRate`,()=>{}),t(`GameBase`,`getRechargeRate`,()=>0),t(`GameBase`,`setEnergyLevel`,()=>{}),t(`GameBase`,`getEnergyLevel`,()=>0),t(`ShapeBase`,`getDamageLevel`,()=>0),t(`ShapeBase`,`setDamageLevel`,()=>{}),t(`ShapeBase`,`getRepairRate`,()=>0),t(`ShapeBase`,`setRepairRate`,()=>{}),t(`ShapeBase`,`getDamagePercent`,()=>0),t(`GameBase`,`getControllingClient`,()=>0),t(`SimObject`,`schedule`,(t,n,r,...i)=>{let a=Number(n)||0,o=setTimeout(()=>{e.state.pendingTimeouts.delete(o);try{e.$.call(t,String(r),...i)}catch(e){ge.error(`schedule: error calling %s on %s: %o`,r,t._id,e)}},a);return e.state.pendingTimeouts.add(o),o})}function ve(){let e=new Set,t=0,n=0,r=null;function i(){for(let t of e)t()}return{get total(){return t},get loaded(){return n},get current(){return r},get progress(){return t===0?0:n/t},on(t,n){e.add(n)},off(t,n){e.delete(n)},addItem(e){t++,r=e,i()},completeItem(){n++,r=null,i()},setCurrent(e){r=e,i()}}}function ye(e,t){try{return u(e)}catch(e){throw t?.filename&&e.location?Error(`${t.filename}:${e.location.start.line}:${e.location.start.column}: ${e.message}`,{cause:e}):e}}function be(e){if(typeof e==`boolean`)return e;if(typeof e==`number`)return e!==0;if(typeof e==`string`){let t=e.trim().toLowerCase();return t!==``&&t!==`0`&&t!==`false`}return!!e}function xe(){let e=Error(`Operation aborted`);return e.name=`AbortError`,e}function Se(e,t){let{signal:n,onMissionLoadDone:r}=t;return new Promise((t,i)=>{let a=!1,o=!1,s=()=>e.getObjectByName(`Game`),c=()=>be(e.$g.get(`missionRunning`)),l=()=>{a||(a=!0,m(),t())},u=e=>{a||(a=!0,m(),i(e))},d=e=>{if(!r||o)return;let t=e??s();t&&(o=!0,r(t))},f=()=>u(xe()),p=e.subscribeRuntimeEvents(e=>{if(e.type===`global.changed`&&e.name===`missionrunning`){be(e.value)&&(d(),l());return}e.type===`batch.flushed`&&c()&&(d(),l())});function m(){p(),n?.removeEventListener(`abort`,f)}if(n){if(n.aborted){u(xe());return}n.addEventListener(`abort`,f,{once:!0})}c()&&(d(),l())})}function Ce(e){let{missionName:t,missionType:n,runtimeOptions:r,onMissionLoadDone:i}=e,{signal:a,fileSystem:o,globals:s={},preloadScripts:c=[],reactiveGlobalNames:l}=r??{},u=o?.findFiles(`scripts/*Game.cs`)??[],d=l?Array.from(new Set([...l,`missionRunning`])):void 0,f=he({...r,reactiveGlobalNames:d,globals:{...s,"$Host::Map":t,"$Host::MissionType":n},preloadScripts:[...c,...u]});return _e(f),{runtime:f,ready:async function(){try{let e=await f.loadFromPath(`scripts/server.cs`);a?.throwIfAborted(),await f.loadFromPath(`missions/${t}.mis`),a?.throwIfAborted(),e.execute();let n=Se(f,{signal:a,onMissionLoadDone:i}),r=await f.loadFromSource(`CreateServer($Host::Map, $Host::MissionType);`);a?.throwIfAborted(),r.execute(),await n}catch(e){if(e instanceof Error&&e.name===`AbortError`)return;throw e}}()}}var we=/^[ \t]*(DisplayName|MissionTypes|BriefingWAV|Bitmap|PlanetName)[ \t]*=[ \t]*(.+)$/i,Te=/^[ \t]*-+[ \t]*([A-Z ]+)[ \t]+BEGIN[ \t]*-+$/i,Ee=/^[ \t]*-+[ \t]*([A-Z ]+)[ \t]+END[ \t]*-+$/i,De={arena:`Arena`,bounty:`Bounty`,cnh:`CnH`,ctf:`CTF`,dm:`DM`,dnd:`DnD`,hunters:`Hunters`,lakrabbit:`LakRabbit`,lakzm:`LakZM`,lctf:`LCTF`,none:`None`,rabbit:`Rabbit`,sctf:`SCtF`,siege:`Siege`,singleplayer:`SinglePlayer`,tdm:`TDM`,teamhunters:`TeamHunters`,teamlak:`TeamLak`,tr2:`TR2`};function Oe(e){let t;return t=e.match(Te),t?{type:`sectionBegin`,name:t[1]}:(t=e.match(Ee),t?{type:`sectionEnd`,name:t[1]}:(t=e.match(we),t?{type:`definition`,identifier:t[1],value:t[2]}:null))}function ke(e){let t={},n=[],r={name:null,comments:[]};function i(e){for(let i of e)if(i.type===`Comment`){let e=Oe(i.value);if(e)switch(e.type){case`definition`:r.name===null?t[e.identifier.toLowerCase()]=e.value:r.comments.push(i.value);break;case`sectionBegin`:(r.name!==null||r.comments.length>0)&&n.push(r),r={name:e.name.toUpperCase(),comments:[]};break;case`sectionEnd`:r.name!==null&&n.push(r),r={name:null,comments:[]};break}else r.comments.push(i.value)}}return i(e.body),(r.name!==null||r.comments.length>0)&&n.push(r),{pragma:t,sections:n}}function Ae(e){let t=ye(e),{pragma:n,sections:r}=ke(t);function i(e){return r.find(t=>t.name===e)?.comments.map(e=>e.trimStart()).join(`
|
||
`)??null}return{displayName:n.displayname??null,missionTypes:n.missiontypes?.split(/\s+/).filter(Boolean).map(e=>De[e.toLowerCase()]??e)??[],missionBriefing:i(`MISSION BRIEFING`),briefingWav:n.briefingwav??null,bitmap:n.bitmap??null,planetName:n.planetname??null,missionBlurb:i(`MISSION BLURB`),missionQuote:i(`MISSION QUOTE`),missionString:i(`MISSION STRING`),execScriptPaths:t.execScriptPaths,hasDynamicExec:t.hasDynamicExec,ast:t}}function je(e,t){if(e)return e[t.toLowerCase()]}function Me(e){let[t,n,r]=(e.position??`0 0 0`).split(` `).map(e=>parseFloat(e));return[n||0,r||0,t||0]}function Ne(e){let[t,n,r]=(e.scale??`1 1 1`).split(` `).map(e=>parseFloat(e));return[n||0,r||0,t||0]}export{Ae as a,de as c,De as i,ne as l,je as n,Ce as o,Ne as r,ve as s,Me as t}; |