loreline 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,51 @@
1
+ "use strict";let Js={},Pn={};(function(Ji,Gs){"use strict";Ji.loreline=Ji.loreline||{};var K={},C=function(){return Q.__string_rec(this,"")},Fe=Fe||{},m;class u{static cca(e,t){let i=e.charCodeAt(t);if(i==i)return i}static substr(e,t,i){if(i==null)i=e.length;else if(i<0)if(t==0)i=e.length+i;else return"";return e.substr(t,i)}static remove(e,t){let i=e.indexOf(t);return i==-1?!1:(e.splice(i,1),!0)}static now(){return Date.now()}}K.HxOverrides=u,u.__name__="HxOverrides";class Cs{constructor(e,t){this.min=e,this.max=t}hasNext(){return this.min<this.max}next(){return this.min++}}K.IntIterator=Cs,Cs.__name__="IntIterator",Object.assign(Cs.prototype,{__class__:Cs});class Qs{static exists(e,t){let i=on(e);for(;i.hasNext();){let s=i.next();if(t(s))return!0}return!1}}K.Lambda=Qs,Qs.__name__="Lambda",Math.__name__="Math";class Pe{static field(e,t){try{return e[t]}catch{return null}}static getProperty(e,t){let i;if(e==null)return null;{let s;return e.__properties__?(i=e.__properties__["get_"+t],s=i):s=!1,s?e[i]():e[t]}}static setProperty(e,t,i){let s,n;e.__properties__?(s=e.__properties__["set_"+t],n=s):n=!1,n?e[s](i):e[t]=i}static fields(e){let t=[];if(e!=null){let s=Object.prototype.hasOwnProperty;for(var i in e)i!="__id__"&&i!="hx__closures__"&&s.call(e,i)&&t.push(i)}return t}static isFunction(e){return typeof e=="function"?!(e.__name__||e.__ename__):!1}static compare(e,t){return e==t?0:e>t?1:-1}static isObject(e){if(e==null)return!1;let t=typeof e;return t=="string"||t=="object"&&e.__enum__==null?!0:t=="function"?(e.__name__||e.__ename__)!=null:!1}static isEnumValue(e){return e!=null?e.__enum__!=null:!1}static deleteField(e,t){return Object.prototype.hasOwnProperty.call(e,t)?(delete e[t],!0):!1}static makeVarArgs(e){return function(){let t=Array.prototype.slice,i=arguments,s=t.call(i);return e(s)}}}K.Reflect=Pe,Pe.__name__="Reflect";class Z{static string(e){return Q.__string_rec(e,"")}static parseInt(e){let t=parseInt(e);return isNaN(t)?null:t}}K.Std=Z,Z.__name__="Std";class $t{constructor(){this.b=""}}K.StringBuf=$t,$t.__name__="StringBuf",Object.assign($t.prototype,{__class__:$t});class Te{static htmlEscape(e,t){let i="",s=0,n=e;for(;s<n.length;){let l=n,r=s++,h=l.charCodeAt(r);h>=55296&&h<=56319&&(h=h-55232<<10|l.charCodeAt(r+1)&1023);let a=h;a>=65536&&++s;let o=a;switch(o){case 34:t?i+="&quot;":i+=String.fromCodePoint(o);break;case 38:i+="&amp;";break;case 39:t?i+="&#039;":i+=String.fromCodePoint(o);break;case 60:i+="&lt;";break;case 62:i+="&gt;";break;default:i+=String.fromCodePoint(o)}}return i}static isSpace(e,t){let i=u.cca(e,t);return i>8&&i<14?!0:i==32}static ltrim(e){let t=e.length,i=0;for(;i<t&&Te.isSpace(e,i);)++i;return i>0?u.substr(e,i,t-i):e}static rtrim(e){let t=e.length,i=0;for(;i<t&&Te.isSpace(e,t-i-1);)++i;return i>0?u.substr(e,0,t-i):e}static trim(e){return Te.ltrim(Te.rtrim(e))}static replace(e,t,i){return e.split(t).join(i)}}K.StringTools=Te,Te.__name__="StringTools";var bt=Fe.ValueType={__ename__:"ValueType",__constructs__:null,TNull:{_hx_name:"TNull",_hx_index:0,__enum__:"ValueType",toString:C},TInt:{_hx_name:"TInt",_hx_index:1,__enum__:"ValueType",toString:C},TFloat:{_hx_name:"TFloat",_hx_index:2,__enum__:"ValueType",toString:C},TBool:{_hx_name:"TBool",_hx_index:3,__enum__:"ValueType",toString:C},TObject:{_hx_name:"TObject",_hx_index:4,__enum__:"ValueType",toString:C},TFunction:{_hx_name:"TFunction",_hx_index:5,__enum__:"ValueType",toString:C},TClass:(m=function(w){return{_hx_index:6,c:w,__enum__:"ValueType",toString:C}},m._hx_name="TClass",m.__params__=["c"],m),TEnum:(m=function(w){return{_hx_index:7,e:w,__enum__:"ValueType",toString:C}},m._hx_name="TEnum",m.__params__=["e"],m),TUnknown:{_hx_name:"TUnknown",_hx_index:8,__enum__:"ValueType",toString:C}};bt.__constructs__=[bt.TNull,bt.TInt,bt.TFloat,bt.TBool,bt.TObject,bt.TFunction,bt.TClass,bt.TEnum,bt.TUnknown];class re{static createInstance(e,t){let i=Function.prototype.bind.apply(e,[null].concat(t));return new i}static typeof(e){switch(typeof e){case"boolean":return bt.TBool;case"function":return e.__name__||e.__ename__?bt.TObject:bt.TFunction;case"number":return Math.ceil(e)==e%2147483648?bt.TInt:bt.TFloat;case"object":if(e==null)return bt.TNull;let t=e.__enum__;if(t!=null)return bt.TEnum(Fe[t]);let i=Q.getClass(e);return i!=null?bt.TClass(i):bt.TObject;case"string":return bt.TClass(String);case"undefined":return bt.TNull;default:return bt.TUnknown}}static enumEq(e,t){if(e==t)return!0;try{let i=e.__enum__;if(i==null||i!=t.__enum__||e._hx_index!=t._hx_index)return!1;let n=Fe[i].__constructs__[e._hx_index].__params__,l=0;for(;l<n.length;){let r=n[l];if(++l,!re.enumEq(e[r],t[r]))return!1}}catch{return!1}return!0}static enumParameters(e){let i=Fe[e.__enum__].__constructs__[e._hx_index].__params__;if(i!=null){let s=[],n=0;for(;n<i.length;){let l=i[n];++n,s.push(e[l])}return s}else return[]}}K.Type=re,re.__name__="Type";class ge{static toString(e){switch(e){case 0:return"Element";case 1:return"PCData";case 2:return"CData";case 3:return"Comment";case 4:return"DocType";case 5:return"ProcessingInstruction";case 6:return"Document"}}}class G{constructor(e){this.nodeType=e,this.children=[],this.attributeMap=new me}get(e){if(this.nodeType!=G.Element)throw k.thrown("Bad node type, expected Element but found "+(this.nodeType==null?"null":ge.toString(this.nodeType)));return this.attributeMap.h[e]}exists(e){if(this.nodeType!=G.Element)throw k.thrown("Bad node type, expected Element but found "+(this.nodeType==null?"null":ge.toString(this.nodeType)));return Object.prototype.hasOwnProperty.call(this.attributeMap.h,e)}attributes(){if(this.nodeType!=G.Element)throw k.thrown("Bad node type, expected Element but found "+(this.nodeType==null?"null":ge.toString(this.nodeType)));return new ps(this.attributeMap.h)}elements(){if(this.nodeType!=G.Document&&this.nodeType!=G.Element)throw k.thrown("Bad node type, expected Element or Document but found "+(this.nodeType==null?"null":ge.toString(this.nodeType)));let e=[],t=0,i=this.children;for(;t<i.length;){let n=i[t];++t,n.nodeType==G.Element&&e.push(n)}let s=e;return new bi(s)}elementsNamed(e){if(this.nodeType!=G.Document&&this.nodeType!=G.Element)throw k.thrown("Bad node type, expected Element or Document but found "+(this.nodeType==null?"null":ge.toString(this.nodeType)));let t=[],i=0,s=this.children;for(;i<s.length;){let l=s[i];++i;let r;if(l.nodeType==G.Element){if(l.nodeType!=G.Element)throw k.thrown("Bad node type, expected Element but found "+(l.nodeType==null?"null":ge.toString(l.nodeType)));r=l.nodeName==e}else r=!1;r&&t.push(l)}let n=t;return new bi(n)}firstElement(){if(this.nodeType!=G.Document&&this.nodeType!=G.Element)throw k.thrown("Bad node type, expected Element or Document but found "+(this.nodeType==null?"null":ge.toString(this.nodeType)));let e=0,t=this.children;for(;e<t.length;){let i=t[e];if(++e,i.nodeType==G.Element)return i}return null}toString(){return Qi.print(this)}}K.Xml=G,G.__name__="Xml",Object.assign(G.prototype,{__class__:G});var ki=Fe["haxe.StackItem"]={__ename__:"haxe.StackItem",__constructs__:null,CFunction:{_hx_name:"CFunction",_hx_index:0,__enum__:"haxe.StackItem",toString:C},Module:(m=function(w){return{_hx_index:1,m:w,__enum__:"haxe.StackItem",toString:C}},m._hx_name="Module",m.__params__=["m"],m),FilePos:(m=function(w,e,t,i){return{_hx_index:2,s:w,file:e,line:t,column:i,__enum__:"haxe.StackItem",toString:C}},m._hx_name="FilePos",m.__params__=["s","file","line","column"],m),Method:(m=function(w,e){return{_hx_index:3,classname:w,method:e,__enum__:"haxe.StackItem",toString:C}},m._hx_name="Method",m.__params__=["classname","method"],m),LocalFunction:(m=function(w){return{_hx_index:4,v:w,__enum__:"haxe.StackItem",toString:C}},m._hx_name="LocalFunction",m.__params__=["v"],m)};ki.__constructs__=[ki.CFunction,ki.Module,ki.FilePos,ki.Method,ki.LocalFunction];class cn{static callStack(){return yi.toHaxe(yi.callStack())}}class ft{}K["haxe.IMap"]=ft,ft.__name__="haxe.IMap",ft.__isInterface__=!0,Object.assign(ft.prototype,{__class__:ft});class k extends Error{constructor(e,t,i){super(e),this.message=e,this.__previousException=t,this.__nativeException=i??this}unwrap(){return this.__nativeException}get_native(){return this.__nativeException}static caught(e){return e instanceof k?e:e instanceof Error?new k(e.message,null,e):new is(e,null,e)}static thrown(e){return e instanceof k?e.get_native():e instanceof Error?e:new is(e)}}K["haxe.Exception"]=k,k.__name__="haxe.Exception",k.__super__=Error,Object.assign(k.prototype,{__class__:k,__properties__:{get_native:"get_native"}});class Li{constructor(e,t){this.high=e,this.low=t}}K["haxe._Int64.___Int64"]=Li,Li.__name__="haxe._Int64.___Int64",Object.assign(Li.prototype,{__class__:Li});class Es{static formatOutput(e,t){let i=Z.string(e);if(t==null)return i;let s=t.fileName+":"+t.lineNumber;if(t.customParams!=null){let n=0,l=t.customParams;for(;n<l.length;){let r=l[n];++n,i+=", "+Z.string(r)}}return s+": "+i}static trace(e,t){let i=Es.formatOutput(e,t);typeof console<"u"&&console.log!=null&&console.log(i)}}K["haxe.Log"]=Es,Es.__name__="haxe.Log";class yi{static callStack(){let e=new Error(""),t=yi.tryHaxeStack(e);if(typeof t>"u"){try{throw e}catch{}t=e.stack}return yi.normalize(t,2)}static toHaxe(e,t){if(t==null&&(t=0),e==null)return[];if(typeof e=="string"){let i=e.split(`
2
+ `);i[0]=="Error"&&i.shift();let s=[],n=0,l=i.length;for(;n<l;){let r=n++;if(t>r)continue;let h=i[r],a=h.match(/^ at ([$A-Za-z0-9_. ]+) \(([^)]+):([0-9]+):([0-9]+)\)$/);if(a!=null){let o=a[1].split(".");o[0]=="$hxClasses"&&o.shift();let c=o.pop(),p=a[2],f=Z.parseInt(a[3]),_=Z.parseInt(a[4]);s.push(ki.FilePos(c=="Anonymous function"?ki.LocalFunction():c=="Global code"?null:ki.Method(o.join("."),c),p,f,_))}else s.push(ki.Module(Te.trim(h)))}return s}else return t>0&&Array.isArray(e)?e.slice(t):e}static tryHaxeStack(e){if(e==null)return[];let t=Error.prepareStackTrace;Error.prepareStackTrace=yi.prepareHxStackTrace;let i=e.stack;return Error.prepareStackTrace=t,i}static prepareHxStackTrace(e,t){let i=[],s=0;for(;s<t.length;){let n=t[s];++s,yi.wrapCallSite!=null&&(n=yi.wrapCallSite(n));let l=null,r=n.getFunctionName();if(r!=null){let o=r.lastIndexOf(".");if(o>=0){let c=r.substring(0,o),p=r.substring(o+1);l=ki.Method(c,p)}else l=ki.Method(null,r)}let h=n.getFileName(),a=h==null?-1:h.indexOf("file:");yi.wrapCallSite!=null&&a>0&&(h=h.substring(a+6)),i.push(ki.FilePos(l,h,n.getLineNumber(),n.getColumnNumber()))}return i}static normalize(e,t){if(t==null&&(t=0),Array.isArray(e)&&t>0)return e.slice(t);if(typeof e=="string"){switch(e.substring(0,6)){case`Error
3
+ `:case"Error:":++t;break;default:}return yi.skipLines(e,t)}else return e}static skipLines(e,t,i){return i==null&&(i=0),t>0?(i=e.indexOf(`
4
+ `,i),i<0?"":yi.skipLines(e,--t,i+1)):e.substring(i)}}K["haxe.NativeStackTrace"]=yi,yi.__name__="haxe.NativeStackTrace";class is extends k{constructor(e,t,i){super(String(e),t,i),this.value=e}unwrap(){return this.value}}K["haxe.ValueException"]=is,is.__name__="haxe.ValueException",is.__super__=k,Object.assign(is.prototype,{__class__:is});class ss{constructor(){}set(e,t){this.root=this.setLoop(e,t,this.root)}get(e){let t=this.root;for(;t!=null;){let i=this.compare(e,t.key);if(i==0)return t.value;i<0?t=t.left:t=t.right}return null}keys(){let e=[];return this.keysLoop(this.root,e),new bi(e)}setLoop(e,t,i){if(i==null)return new Qt(null,e,t,null);let s=this.compare(e,i.key);if(s==0)return new Qt(i.left,e,t,i.right,i==null?0:i._height);if(s<0){let n=this.setLoop(e,t,i.left);return this.balance(n,i.key,i.value,i.right)}else{let n=this.setLoop(e,t,i.right);return this.balance(i.left,i.key,i.value,n)}}keysLoop(e,t){e!=null&&(this.keysLoop(e.left,t),t.push(e.key),this.keysLoop(e.right,t))}balance(e,t,i,s){let n=e==null?0:e._height,l=s==null?0:s._height;if(n>l+2){let r=e.left,h=e.right;return(r==null?0:r._height)>=(h==null?0:h._height)?new Qt(e.left,e.key,e.value,new Qt(e.right,t,i,s)):new Qt(new Qt(e.left,e.key,e.value,e.right.left),e.right.key,e.right.value,new Qt(e.right.right,t,i,s))}else if(l>n+2){let r=s.right,h=s.left;return(r==null?0:r._height)>(h==null?0:h._height)?new Qt(new Qt(e,t,i,s.left),s.key,s.value,s.right):new Qt(new Qt(e,t,i,s.left.left),s.left.key,s.left.value,new Qt(s.left.right,s.key,s.value,s.right))}else return new Qt(e,t,i,s,(n>l?n:l)+1)}compare(e,t){return Pe.compare(e,t)}}K["haxe.ds.BalancedTree"]=ss,ss.__name__="haxe.ds.BalancedTree",ss.__interfaces__=[ft],Object.assign(ss.prototype,{__class__:ss});class Qt{constructor(e,t,i,s,n){if(n==null&&(n=-1),this.left=e,this.key=t,this.value=i,this.right=s,n==-1){let l,r=this.left,h=this.right;if((r==null?0:r._height)>(h==null?0:h._height)){let a=this.left;l=a==null?0:a._height}else{let a=this.right;l=a==null?0:a._height}this._height=l+1}else this._height=n}}K["haxe.ds.TreeNode"]=Qt,Qt.__name__="haxe.ds.TreeNode",Object.assign(Qt.prototype,{__class__:Qt});class Gi extends ss{constructor(){super()}compare(e,t){let i=e._hx_index-t._hx_index;if(i!=0)return i;let s=re.enumParameters(e),n=re.enumParameters(t);return s.length==0&&n.length==0?0:this.compareArgs(s,n)}compareArgs(e,t){let i=e.length-t.length;if(i!=0)return i;let s=0,n=e.length;for(;s<n;){let l=s++,r=this.compareArg(e[l],t[l]);if(r!=0)return r}return 0}compareArg(e,t){return Pe.isEnumValue(e)&&Pe.isEnumValue(t)?this.compare(e,t):e instanceof Array&&t instanceof Array?this.compareArgs(e,t):Pe.compare(e,t)}}K["haxe.ds.EnumValueMap"]=Gi,Gi.__name__="haxe.ds.EnumValueMap",Gi.__interfaces__=[ft],Gi.__super__=ss,Object.assign(Gi.prototype,{__class__:Gi});class Ri{constructor(){this.h={}}set(e,t){this.h[e]=t}get(e){return this.h[e]}keys(){let e=[];for(var t in this.h)this.h.hasOwnProperty(t)&&e.push(+t);return new bi(e)}}K["haxe.ds.IntMap"]=Ri,Ri.__name__="haxe.ds.IntMap",Ri.__interfaces__=[ft],Object.assign(Ri.prototype,{__class__:Ri});class Ss{constructor(){this.length=0}add(e){let t=new us(e,null);this.h==null?this.h=t:this.q.next=t,this.q=t,this.length++}push(e){let t=new us(e,this.h);this.h=t,this.q==null&&(this.q=t),this.length++}pop(){if(this.h==null)return null;let e=this.h.item;return this.h=this.h.next,this.h==null&&(this.q=null),this.length--,e}}K["haxe.ds.List"]=Ss,Ss.__name__="haxe.ds.List",Object.assign(Ss.prototype,{__class__:Ss});class us{constructor(e,t){this.item=e,this.next=t}}K["haxe.ds._List.ListNode"]=us,us.__name__="haxe.ds._List.ListNode",Object.assign(us.prototype,{__class__:us});class cs{constructor(){this.h={__keys__:{}}}set(e,t){let i=e.__id__;i==null&&(i=e.__id__=Gs.$haxeUID++),this.h[i]=t,this.h.__keys__[i]=e}get(e){return this.h[e.__id__]}keys(){let e=[];for(var t in this.h.__keys__)this.h.hasOwnProperty(t)&&e.push(this.h.__keys__[t]);return new bi(e)}}K["haxe.ds.ObjectMap"]=cs,cs.__name__="haxe.ds.ObjectMap",cs.__interfaces__=[ft],Object.assign(cs.prototype,{__class__:cs});class me{constructor(){this.h=Object.create(null)}get(e){return this.h[e]}set(e,t){this.h[e]=t}keys(){return new ps(this.h)}}K["haxe.ds.StringMap"]=me,me.__name__="haxe.ds.StringMap",me.__interfaces__=[ft],Object.assign(me.prototype,{__class__:me});class ps{constructor(e){this.h=e,this.keys=Object.keys(e),this.length=this.keys.length,this.current=0}hasNext(){return this.current<this.length}next(){return this.keys[this.current++]}}K["haxe.ds._StringMap.StringMapKeyIterator"]=ps,ps.__name__="haxe.ds._StringMap.StringMapKeyIterator",Object.assign(ps.prototype,{__class__:ps});class Ys{static blit(e,t,i,s,n){if(e==i){if(t<s){let l=t+n,r=s+n,h=0,a=n;for(;h<a;){let o=h++;--l,--r,e[r]=e[l]}}else if(t>s){let l=t,r=s,h=0,a=n;for(;h<a;){let o=h++;e[r]=e[l],++l,++r}}}else{let l=0,r=n;for(;l<r;){let h=l++;i[s+h]=e[t+h]}}}}class vt{constructor(e){switch(e){case".":case"..":this.dir=e,this.file="";return}let t=e.lastIndexOf("/"),i=e.lastIndexOf("\\");t<i?(this.dir=u.substr(e,0,i),e=u.substr(e,i+1,null),this.backslash=!0):i<t?(this.dir=u.substr(e,0,t),e=u.substr(e,t+1,null)):this.dir=null;let s=e.lastIndexOf(".");s!=-1?(this.ext=u.substr(e,s+1,null),this.file=u.substr(e,0,s)):(this.ext=null,this.file=e)}static directory(e){let t=new vt(e);return t.dir==null?"":t.dir}static join(e){let t=[],i=0,s=e;for(;i<s.length;){let a=s[i];++i,a!=null&&a!=""&&t.push(a)}let n=t;if(n.length==0)return"";let l=n[0],r=1,h=n.length;for(;r<h;){let a=r++;l=vt.addTrailingSlash(l),l+=n[a]}return vt.normalize(l)}static normalize(e){let t="/";if(e=e.split("\\").join(t),e==t)return t;let i=[],s=0,n=e.split(t);for(;s<n.length;){let p=n[s];++s,p==".."&&i.length>0&&i[i.length-1]!=".."?i.pop():p==""?(i.length>0||u.cca(e,0)==47)&&i.push(p):p!="."&&i.push(p)}let l=i.join(t),r="",h=!1,a=!1,o=0,c=l;for(;o<c.length;){let p=c,f=o++,_=p.charCodeAt(f);_>=55296&&_<=56319&&(_=_-55232<<10|p.charCodeAt(f+1)&1023);let d=_;d>=65536&&++o;let x=d;switch(x){case 47:if(!h)a=!0;else{let b=x;h=!1,a&&(r+="/",a=!1),r+=String.fromCodePoint(b)}break;case 58:r+=":",h=!0;break;default:let y=x;h=!1,a&&(r+="/",a=!1),r+=String.fromCodePoint(y)}}return r}static addTrailingSlash(e){if(e.length==0)return"/";let t=e.lastIndexOf("/"),i=e.lastIndexOf("\\");return t<i?i!=e.length-1?e+"\\":e:t!=e.length-1?e+"/":e}static isAbsolute(e){return!!(e.startsWith("/")||e.charAt(1)==":"||e.startsWith("\\\\"))}}K["haxe.io.Path"]=vt,vt.__name__="haxe.io.Path",Object.assign(vt.prototype,{__class__:vt});class bi{constructor(e){this.current=0,this.array=e}hasNext(){return this.current<this.array.length}next(){return this.array[this.current++]}}K["haxe.iterators.ArrayIterator"]=bi,bi.__name__="haxe.iterators.ArrayIterator",Object.assign(bi.prototype,{__class__:bi});var zt=Fe["haxe.rtti.CType"]={__ename__:"haxe.rtti.CType",__constructs__:null,CUnknown:{_hx_name:"CUnknown",_hx_index:0,__enum__:"haxe.rtti.CType",toString:C},CEnum:(m=function(w,e){return{_hx_index:1,name:w,params:e,__enum__:"haxe.rtti.CType",toString:C}},m._hx_name="CEnum",m.__params__=["name","params"],m),CClass:(m=function(w,e){return{_hx_index:2,name:w,params:e,__enum__:"haxe.rtti.CType",toString:C}},m._hx_name="CClass",m.__params__=["name","params"],m),CTypedef:(m=function(w,e){return{_hx_index:3,name:w,params:e,__enum__:"haxe.rtti.CType",toString:C}},m._hx_name="CTypedef",m.__params__=["name","params"],m),CFunction:(m=function(w,e){return{_hx_index:4,args:w,ret:e,__enum__:"haxe.rtti.CType",toString:C}},m._hx_name="CFunction",m.__params__=["args","ret"],m),CAnonymous:(m=function(w){return{_hx_index:5,fields:w,__enum__:"haxe.rtti.CType",toString:C}},m._hx_name="CAnonymous",m.__params__=["fields"],m),CDynamic:(m=function(w){return{_hx_index:6,t:w,__enum__:"haxe.rtti.CType",toString:C}},m._hx_name="CDynamic",m.__params__=["t"],m),CAbstract:(m=function(w,e){return{_hx_index:7,name:w,params:e,__enum__:"haxe.rtti.CType",toString:C}},m._hx_name="CAbstract",m.__params__=["name","params"],m)};zt.__constructs__=[zt.CUnknown,zt.CEnum,zt.CClass,zt.CTypedef,zt.CFunction,zt.CAnonymous,zt.CDynamic,zt.CAbstract];var At=Fe["haxe.rtti.Rights"]={__ename__:"haxe.rtti.Rights",__constructs__:null,RNormal:{_hx_name:"RNormal",_hx_index:0,__enum__:"haxe.rtti.Rights",toString:C},RNo:{_hx_name:"RNo",_hx_index:1,__enum__:"haxe.rtti.Rights",toString:C},RCall:(m=function(w){return{_hx_index:2,m:w,__enum__:"haxe.rtti.Rights",toString:C}},m._hx_name="RCall",m.__params__=["m"],m),RMethod:{_hx_name:"RMethod",_hx_index:3,__enum__:"haxe.rtti.Rights",toString:C},RDynamic:{_hx_name:"RDynamic",_hx_index:4,__enum__:"haxe.rtti.Rights",toString:C},RInline:{_hx_name:"RInline",_hx_index:5,__enum__:"haxe.rtti.Rights",toString:C}};At.__constructs__=[At.RNormal,At.RNo,At.RCall,At.RMethod,At.RDynamic,At.RInline];var Bi=Fe["haxe.rtti.TypeTree"]={__ename__:"haxe.rtti.TypeTree",__constructs__:null,TPackage:(m=function(w,e,t){return{_hx_index:0,name:w,full:e,subs:t,__enum__:"haxe.rtti.TypeTree",toString:C}},m._hx_name="TPackage",m.__params__=["name","full","subs"],m),TClassdecl:(m=function(w){return{_hx_index:1,c:w,__enum__:"haxe.rtti.TypeTree",toString:C}},m._hx_name="TClassdecl",m.__params__=["c"],m),TEnumdecl:(m=function(w){return{_hx_index:2,e:w,__enum__:"haxe.rtti.TypeTree",toString:C}},m._hx_name="TEnumdecl",m.__params__=["e"],m),TTypedecl:(m=function(w){return{_hx_index:3,t:w,__enum__:"haxe.rtti.TypeTree",toString:C}},m._hx_name="TTypedecl",m.__params__=["t"],m),TAbstractdecl:(m=function(w){return{_hx_index:4,a:w,__enum__:"haxe.rtti.TypeTree",toString:C}},m._hx_name="TAbstractdecl",m.__params__=["a"],m)};Bi.__constructs__=[Bi.TPackage,Bi.TClassdecl,Bi.TEnumdecl,Bi.TTypedecl,Bi.TAbstractdecl];class Qe{static typeInfos(e){let t;switch(e._hx_index){case 0:let i=e.name,s=e.full,n=e.subs;throw k.thrown("Unexpected Package");case 1:t=e.c;break;case 2:t=e.e;break;case 3:t=e.t;break;case 4:t=e.a;break}return t}static leq(e,t,i){let s=0,n=i,l=0;for(;l<t.length;){let r=t[l];if(++l,s>=n.length)return!1;let h=n[s++];if(!e(r,h))return!1}return!(s<n.length)}static rightsEq(e,t){if(e==t)return!0;if(e._hx_index==2){let i=e.m;if(t._hx_index==2){let s=t.m;return i==s}}return!1}static typeEq(e,t){switch(e._hx_index){case 0:return t==zt.CUnknown;case 1:let i=e.name,s=e.params;if(t._hx_index==1){let d=t.name,x=t.params;return i==d?Qe.leq(Qe.typeEq,s,x):!1}break;case 2:let n=e.name,l=e.params;if(t._hx_index==2){let d=t.name,x=t.params;return n==d?Qe.leq(Qe.typeEq,l,x):!1}break;case 3:let r=e.name,h=e.params;if(t._hx_index==3){let d=t.name,x=t.params;return r==d?Qe.leq(Qe.typeEq,h,x):!1}break;case 4:let a=e.args,o=e.ret;if(t._hx_index==4){let d=t.args,x=t.ret;return Qe.leq(function(y,b){return y.name==b.name&&y.opt==b.opt?Qe.typeEq(y.t,b.t):!1},a,d)?Qe.typeEq(o,x):!1}break;case 5:let c=e.fields;if(t._hx_index==5){let d=t.fields;return Qe.leq(function(x,y){return Qe.fieldEq(x,y)},c,d)}break;case 6:let p=e.t;if(t._hx_index==6){let d=t.t;return p==null!=(d==null)?!1:p!=null?Qe.typeEq(p,d):!0}break;case 7:let f=e.name,_=e.params;if(t._hx_index==7){let d=t.name,x=t.params;return f==d?Qe.leq(Qe.typeEq,_,x):!1}break}return!1}static fieldEq(e,t){return!(e.name!=t.name||!Qe.typeEq(e.type,t.type)||e.isPublic!=t.isPublic||e.doc!=t.doc||!Qe.rightsEq(e.get,t.get)||!Qe.rightsEq(e.set,t.set)||e.params==null!=(t.params==null)||e.params!=null&&e.params.join(":")!=t.params.join(":"))}static constructorEq(e,t){return!(e.name!=t.name||e.doc!=t.doc||e.args==null!=(t.args==null)||e.args!=null&&!Qe.leq(function(i,s){return i.name==s.name&&i.opt==s.opt?Qe.typeEq(i.t,s.t):!1},e.args,t.args))}}K["haxe.rtti.TypeApi"]=Qe,Qe.__name__="haxe.rtti.TypeApi";class vs{constructor(){this.root=[]}process(e,t){if(this.curplatform=t,e.nodeType!=G.Document&&e.nodeType!=G.Element)throw k.thrown("Invalid nodeType "+(e.nodeType==null?"null":ge.toString(e.nodeType)));this.xroot(e)}mergeRights(e,t){return e.get==At.RInline&&e.set==At.RNo&&t.get==At.RNormal&&t.set==At.RMethod?(e.get=At.RNormal,e.set=At.RMethod,!0):re.enumEq(e.get,t.get)?re.enumEq(e.set,t.set):!1}mergeDoc(e,t){return e.doc==null?e.doc=t.doc:t.doc==null&&(t.doc=e.doc),!0}mergeFields(e,t){return Qe.fieldEq(e,t)?!0:e.name==t.name&&(this.mergeRights(e,t)||this.mergeRights(t,e))&&this.mergeDoc(e,t)?Qe.fieldEq(e,t):!1}newField(e,t){}mergeClasses(e,t){if(e.isInterface!=t.isInterface)return!1;this.curplatform!=null&&e.platforms.push(this.curplatform),e.isExtern!=t.isExtern&&(e.isExtern=!1);let i=0,s=t.fields;for(;i<s.length;){let r=s[i];++i;let h=null,a=0,o=e.fields;for(;a<o.length;){let c=o[a];if(++a,this.mergeFields(c,r)){h=c;break}}h==null?(this.newField(e,r),e.fields.push(r)):this.curplatform!=null&&h.platforms.push(this.curplatform)}let n=0,l=t.statics;for(;n<l.length;){let r=l[n];++n;let h=null,a=0,o=e.statics;for(;a<o.length;){let c=o[a];if(++a,this.mergeFields(c,r)){h=c;break}}h==null?(this.newField(e,r),e.statics.push(r)):this.curplatform!=null&&h.platforms.push(this.curplatform)}return!0}mergeEnums(e,t){if(e.isExtern!=t.isExtern)return!1;this.curplatform!=null&&e.platforms.push(this.curplatform);let i=0,s=t.constructors;for(;i<s.length;){let n=s[i];++i;let l=null,r=0,h=e.constructors;for(;r<h.length;){let a=h[r];if(++r,Qe.constructorEq(a,n)){l=a;break}}l==null?e.constructors.push(n):this.curplatform!=null&&l.platforms.push(this.curplatform)}return!0}mergeTypedefs(e,t){return this.curplatform==null?!1:(e.platforms.push(this.curplatform),e.types.h[this.curplatform]=t.type,!0)}mergeAbstracts(e,t){if(this.curplatform==null||e.to.length!=t.to.length||e.from.length!=t.from.length)return!1;let i=0,s=e.to.length;for(;i<s;){let r=i++;if(!Qe.typeEq(e.to[r].t,t.to[r].t))return!1}let n=0,l=e.from.length;for(;n<l;){let r=n++;if(!Qe.typeEq(e.from[r].t,t.from[r].t))return!1}return t.impl!=null&&this.mergeClasses(e.impl,t.impl),e.platforms.push(this.curplatform),!0}merge(e){let t=Qe.typeInfos(e),i=t.path.split("."),s=this.root,n=[];i.pop();let l=0;for(;l<i.length;){let h=i[l];++l;let a=!1,o=0;for(;o<s.length;){let c=s[o];if(++o,c._hx_index==0){let p=c.full,f=c.name,_=c.subs;if(f==h){a=!0,s=_;break}}}if(n.push(h),!a){let c=[];s.push(Bi.TPackage(h,n.join("."),c)),s=c}}let r=0;for(;r<s.length;){let h=s[r];++r;let a;if(h._hx_index==0){let c=h.name,p=h.full,f=h.subs;a=!0}else a=!1;if(a)continue;let o=Qe.typeInfos(h);if(o.path==t.path){let c=!0;if(o.doc==null!=(t.doc==null)&&(t.doc==null?t.doc=o.doc:o.doc=t.doc),o.path=="haxe._Int64.NativeInt64")continue;if(o.module==t.module&&o.doc==t.doc&&o.isPrivate==t.isPrivate)switch(h._hx_index){case 0:let f=h.name,_=h.full,d=h.subs;c=!1;break;case 1:let x=h.c;if(e._hx_index==1){let T=e.c;if(this.mergeClasses(x,T))return}else c=!1;break;case 2:let y=h.e;if(e._hx_index==2){let T=e.e;if(this.mergeEnums(y,T))return}else c=!1;break;case 3:let b=h.t;if(e._hx_index==3){let T=e.t;if(this.mergeTypedefs(b,T))return}break;case 4:let v=h.a;if(e._hx_index==4){let T=e.a;if(this.mergeAbstracts(v,T))return}else c=!1;break}let p=o.module!=t.module?"module "+t.module+" should be "+o.module:o.doc!=t.doc?"documentation is different":o.isPrivate!=t.isPrivate?"private flag is different":c?"could not merge definition":"type kind is different";throw k.thrown("Incompatibilities between "+o.path+" in "+o.platforms.join(",")+" and "+this.curplatform+" ("+p+")")}}s.push(e)}mkPath(e){return e}mkTypeParams(e){let t=e.split(":");return t[0]==""?[]:t}mkRights(e){switch(e){case"dynamic":return At.RDynamic;case"inline":return At.RInline;case"method":return At.RMethod;case"null":return At.RNo;default:return At.RCall(e)}}xerror(e){let t;if(e.nodeType==G.Document)t="Document";else{if(e.nodeType!=G.Element)throw k.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":ge.toString(e.nodeType)));t=e.nodeName}throw k.thrown("Invalid "+t)}xroot(e){let t=e.elements();for(;t.hasNext();){let i=t.next();this.merge(this.processElement(i))}}processElement(e){if(e.nodeType!=G.Document&&e.nodeType!=G.Element)throw k.thrown("Invalid nodeType "+(e.nodeType==null?"null":ge.toString(e.nodeType)));let t=e,i;if(t.nodeType==G.Document)i="Document";else{if(t.nodeType!=G.Element)throw k.thrown("Bad node type, expected Element but found "+(t.nodeType==null?"null":ge.toString(t.nodeType)));i=t.nodeName}switch(i){case"abstract":return Bi.TAbstractdecl(this.xabstract(t));case"class":return Bi.TClassdecl(this.xclass(t));case"enum":return Bi.TEnumdecl(this.xenum(t));case"typedef":return Bi.TTypedecl(this.xtypedef(t));default:return this.xerror(t)}}xmeta(e){let t=[],i=0,s=ln.resolve(e,"m");for(;i<s.length;){let n=s[i];++i;let l=[],r=0,h=ln.resolve(n,"e");for(;r<h.length;){let a=h[r];++r,l.push($i.get_innerHTML(a))}t.push({name:qe.resolve(n,"n"),params:l})}return t}xoverloads(e){let t=[],i=e.elements();for(;i.hasNext();){let s=i.next();t.push(this.xclassfield(s))}return t}xpath(e){let t=this.mkPath(qe.resolve(e,"path")),i=[],s=e.elements();for(;s.hasNext();){let n=s.next();i.push(this.xtype(n))}return{path:t,params:i}}xclass(e){let t=null,i=null,s=null,n=[],l=[],r=[],h=[],a=e.exists("interface"),o=e.elements();for(;o.hasNext();){let c=o.next(),p;if(c.nodeType==G.Document)p="Document";else{if(c.nodeType!=G.Element)throw k.thrown("Bad node type, expected Element but found "+(c.nodeType==null?"null":ge.toString(c.nodeType)));p=c.nodeName}switch(p){case"extends":a?n.push(this.xpath(c)):t=this.xpath(c);break;case"haxe_doc":i=$i.get_innerData(c);break;case"haxe_dynamic":let f=c.firstElement();if(f.nodeType!=G.Document&&f.nodeType!=G.Element)throw k.thrown("Invalid nodeType "+(f.nodeType==null?"null":ge.toString(f.nodeType)));s=this.xtype(f);break;case"implements":n.push(this.xpath(c));break;case"meta":h=this.xmeta(c);break;default:c.exists("static")?r.push(this.xclassfield(c)):l.push(this.xclassfield(c))}}return{file:Yt.resolve(e,"file")?qe.resolve(e,"file"):null,path:this.mkPath(qe.resolve(e,"path")),module:Yt.resolve(e,"module")?this.mkPath(qe.resolve(e,"module")):null,doc:i,isPrivate:e.exists("private"),isExtern:e.exists("extern"),isFinal:e.exists("final"),isInterface:a,params:this.mkTypeParams(qe.resolve(e,"params")),superClass:t,interfaces:n,fields:l,statics:r,tdynamic:s,platforms:this.defplat(),meta:h}}xclassfield(e,t){t==null&&(t=!1);let i=e.elements(),s=this.xtype(i.next()),n=null,l=[],r=null,h=i;for(;h.hasNext();){let o=h.next(),c;if(o.nodeType==G.Document)c="Document";else{if(o.nodeType!=G.Element)throw k.thrown("Bad node type, expected Element but found "+(o.nodeType==null?"null":ge.toString(o.nodeType)));c=o.nodeName}switch(c){case"haxe_doc":n=$i.get_innerData(o);break;case"meta":l=this.xmeta(o);break;case"overloads":r=this.xoverloads(o);break;default:this.xerror(o)}}let a;if(e.nodeType==G.Document)a="Document";else{if(e.nodeType!=G.Element)throw k.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":ge.toString(e.nodeType)));a=e.nodeName}return{name:a,type:s,isPublic:e.exists("public")||t,isFinal:e.exists("final"),isOverride:e.exists("override"),line:Yt.resolve(e,"line")?Z.parseInt(qe.resolve(e,"line")):null,doc:n,get:Yt.resolve(e,"get")?this.mkRights(qe.resolve(e,"get")):At.RNormal,set:Yt.resolve(e,"set")?this.mkRights(qe.resolve(e,"set")):At.RNormal,params:Yt.resolve(e,"params")?this.mkTypeParams(qe.resolve(e,"params")):[],platforms:this.defplat(),meta:l,overloads:r,expr:Yt.resolve(e,"expr")?qe.resolve(e,"expr"):null}}xenum(e){let t=[],i=null,s=[],n=e.elements();for(;n.hasNext();){let l=n.next(),r;if(l.nodeType==G.Document)r="Document";else{if(l.nodeType!=G.Element)throw k.thrown("Bad node type, expected Element but found "+(l.nodeType==null?"null":ge.toString(l.nodeType)));r=l.nodeName}if(r=="haxe_doc")i=$i.get_innerData(l);else{let h;if(l.nodeType==G.Document)h="Document";else{if(l.nodeType!=G.Element)throw k.thrown("Bad node type, expected Element but found "+(l.nodeType==null?"null":ge.toString(l.nodeType)));h=l.nodeName}h=="meta"?s=this.xmeta(l):t.push(this.xenumfield(l))}}return{file:Yt.resolve(e,"file")?qe.resolve(e,"file"):null,path:this.mkPath(qe.resolve(e,"path")),module:Yt.resolve(e,"module")?this.mkPath(qe.resolve(e,"module")):null,doc:i,isPrivate:e.exists("private"),isExtern:e.exists("extern"),params:this.mkTypeParams(qe.resolve(e,"params")),constructors:t,platforms:this.defplat(),meta:s}}xenumfield(e){let t=null,i=e.elementsNamed("haxe_doc"),s=i.hasNext()?i.next():null,n=pn.resolve(e,"meta")?this.xmeta(nn.resolve(e,"meta")):[];if(Yt.resolve(e,"a")){let h=qe.resolve(e,"a").split(":"),a=e.elements();t=[];let o=0;for(;o<h.length;){let c=h[o];++o;let p=!1;c.charAt(0)=="?"&&(p=!0,c=u.substr(c,1,null)),t.push({name:c,opt:p,t:this.xtype(a.next())})}}let l;if(e.nodeType==G.Document)l="Document";else{if(e.nodeType!=G.Element)throw k.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":ge.toString(e.nodeType)));l=e.nodeName}let r;if(s==null)r=null;else{if(s.nodeType!=G.Document&&s.nodeType!=G.Element)throw k.thrown("Invalid nodeType "+(s.nodeType==null?"null":ge.toString(s.nodeType)));r=$i.get_innerData(s)}return{name:l,args:t,doc:r,meta:n,platforms:this.defplat()}}xabstract(e){let t=null,i=null,s=null,n=[],l=[],r=[],h=e.elements();for(;h.hasNext();){let a=h.next(),o;if(a.nodeType==G.Document)o="Document";else{if(a.nodeType!=G.Element)throw k.thrown("Bad node type, expected Element but found "+(a.nodeType==null?"null":ge.toString(a.nodeType)));o=a.nodeName}switch(o){case"from":let c=a.elements();for(;c.hasNext();){let _=c.next(),d=_.firstElement();if(d.nodeType!=G.Document&&d.nodeType!=G.Element)throw k.thrown("Invalid nodeType "+(d.nodeType==null?"null":ge.toString(d.nodeType)));r.push({t:this.xtype(d),field:Yt.resolve(_,"field")?qe.resolve(_,"field"):null})}break;case"haxe_doc":t=$i.get_innerData(a);break;case"impl":i=this.xclass(nn.resolve(a,"class"));break;case"meta":n=this.xmeta(a);break;case"this":let p=a.firstElement();if(p.nodeType!=G.Document&&p.nodeType!=G.Element)throw k.thrown("Invalid nodeType "+(p.nodeType==null?"null":ge.toString(p.nodeType)));s=this.xtype(p);break;case"to":let f=a.elements();for(;f.hasNext();){let _=f.next(),d=_.firstElement();if(d.nodeType!=G.Document&&d.nodeType!=G.Element)throw k.thrown("Invalid nodeType "+(d.nodeType==null?"null":ge.toString(d.nodeType)));l.push({t:this.xtype(d),field:Yt.resolve(_,"field")?qe.resolve(_,"field"):null})}break;default:this.xerror(a)}}return{file:Yt.resolve(e,"file")?qe.resolve(e,"file"):null,path:this.mkPath(qe.resolve(e,"path")),module:Yt.resolve(e,"module")?this.mkPath(qe.resolve(e,"module")):null,doc:t,isPrivate:e.exists("private"),params:this.mkTypeParams(qe.resolve(e,"params")),platforms:this.defplat(),meta:n,athis:s,to:l,from:r,impl:i}}xtypedef(e){let t=null,i=null,s=[],n=e.elements();for(;n.hasNext();){let r=n.next(),h;if(r.nodeType==G.Document)h="Document";else{if(r.nodeType!=G.Element)throw k.thrown("Bad node type, expected Element but found "+(r.nodeType==null?"null":ge.toString(r.nodeType)));h=r.nodeName}if(h=="haxe_doc")t=$i.get_innerData(r);else{let a;if(r.nodeType==G.Document)a="Document";else{if(r.nodeType!=G.Element)throw k.thrown("Bad node type, expected Element but found "+(r.nodeType==null?"null":ge.toString(r.nodeType)));a=r.nodeName}a=="meta"?s=this.xmeta(r):i=this.xtype(r)}}let l=new me;return this.curplatform!=null&&(l.h[this.curplatform]=i),{file:Yt.resolve(e,"file")?qe.resolve(e,"file"):null,path:this.mkPath(qe.resolve(e,"path")),module:Yt.resolve(e,"module")?this.mkPath(qe.resolve(e,"module")):null,doc:t,isPrivate:e.exists("private"),params:this.mkTypeParams(qe.resolve(e,"params")),type:i,types:l,platforms:this.defplat(),meta:s}}xtype(e){let t;if(e.nodeType==G.Document)t="Document";else{if(e.nodeType!=G.Element)throw k.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":ge.toString(e.nodeType)));t=e.nodeName}switch(t){case"a":let i=[],s=e.elements();for(;s.hasNext();){let _=s.next(),d=this.xclassfield(_,!0);d.platforms=[],i.push(d)}return zt.CAnonymous(i);case"c":return zt.CClass(this.mkPath(qe.resolve(e,"path")),this.xtypeparams(e));case"d":let n=null,l=e.firstElement();if(l!=null){if(l.nodeType!=G.Document&&l.nodeType!=G.Element)throw k.thrown("Invalid nodeType "+(l.nodeType==null?"null":ge.toString(l.nodeType)));n=this.xtype(l)}return zt.CDynamic(n);case"e":return zt.CEnum(this.mkPath(qe.resolve(e,"path")),this.xtypeparams(e));case"f":let r=[],h=qe.resolve(e,"a").split(":"),a=0,o=h,c=Yt.resolve(e,"v")?new bi(qe.resolve(e,"v").split(":")):null,p=e.elements();for(;p.hasNext();){let _=p.next(),d=!1,x=a<o.length?o[a++]:null;x==null&&(x=""),x.charAt(0)=="?"&&(d=!0,x=u.substr(x,1,null));let y=c==null||c.current>=c.array.length?null:c.array[c.current++];r.push({name:x,opt:d,t:this.xtype(_),value:y==""?null:y})}let f=r[r.length-1];return u.remove(r,f),zt.CFunction(r,f.t);case"t":return zt.CTypedef(this.mkPath(qe.resolve(e,"path")),this.xtypeparams(e));case"unknown":return zt.CUnknown;case"x":return zt.CAbstract(this.mkPath(qe.resolve(e,"path")),this.xtypeparams(e));default:return this.xerror(e)}}xtypeparams(e){let t=[],i=e.elements();for(;i.hasNext();){let s=i.next();t.push(this.xtype(s))}return t}defplat(){let e=[];return this.curplatform!=null&&e.push(this.curplatform),e}}K["haxe.rtti.XmlParser"]=vs,vs.__name__="haxe.rtti.XmlParser",Object.assign(vs.prototype,{__class__:vs});class nn{static resolve(e,t){let i=e.elementsNamed(t).next();if(i==null){let s;if(e.nodeType==G.Document)s="Document";else{if(e.nodeType!=G.Element)throw k.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":ge.toString(e.nodeType)));s=e.nodeName}throw k.thrown(s+" is missing element "+t)}if(i.nodeType!=G.Document&&i.nodeType!=G.Element)throw k.thrown("Invalid nodeType "+(i.nodeType==null?"null":ge.toString(i.nodeType)));return i}}class qe{static resolve(e,t){if(e.nodeType==G.Document)throw k.thrown("Cannot access document attribute "+t);let i=e.get(t);if(i==null)throw e.nodeType!=G.Element?k.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":ge.toString(e.nodeType))):k.thrown(e.nodeName+" is missing attribute "+t);return i}}class Yt{static resolve(e,t){if(e.nodeType==G.Document)throw k.thrown("Cannot access document attribute "+t);return e.exists(t)}}class pn{static resolve(e,t){return e.elementsNamed(t).hasNext()}}class ln{static resolve(e,t){let i=[],s=e.elementsNamed(t);for(;s.hasNext();){let n=s.next();if(n.nodeType!=G.Document&&n.nodeType!=G.Element)throw k.thrown("Invalid nodeType "+(n.nodeType==null?"null":ge.toString(n.nodeType)));i.push(n)}return i}}class $i{static get_innerData(e){if(e.nodeType!=G.Document&&e.nodeType!=G.Element)throw k.thrown("Bad node type, expected Element or Document but found "+(e.nodeType==null?"null":ge.toString(e.nodeType)));let t=0,i=e.children;if(t>=i.length){let n;if(e.nodeType==G.Document)n="Document";else{if(e.nodeType!=G.Element)throw k.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":ge.toString(e.nodeType)));n=e.nodeName}throw k.thrown(n+" does not have data")}let s=i[t++];if(t<i.length){let n=i[t++],l;if(s.nodeType==G.PCData&&n.nodeType==G.CData){if(s.nodeType==G.Document||s.nodeType==G.Element)throw k.thrown("Bad node type, unexpected "+(s.nodeType==null?"null":ge.toString(s.nodeType)));l=Te.trim(s.nodeValue)==""}else l=!1;if(l){if(t>=i.length){if(n.nodeType==G.Document||n.nodeType==G.Element)throw k.thrown("Bad node type, unexpected "+(n.nodeType==null?"null":ge.toString(n.nodeType)));return n.nodeValue}let h=i[t++],a;if(h.nodeType==G.PCData){if(h.nodeType==G.Document||h.nodeType==G.Element)throw k.thrown("Bad node type, unexpected "+(h.nodeType==null?"null":ge.toString(h.nodeType)));a=Te.trim(h.nodeValue)==""}else a=!1;if(a&&t>=i.length){if(n.nodeType==G.Document||n.nodeType==G.Element)throw k.thrown("Bad node type, unexpected "+(n.nodeType==null?"null":ge.toString(n.nodeType)));return n.nodeValue}}let r;if(e.nodeType==G.Document)r="Document";else{if(e.nodeType!=G.Element)throw k.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":ge.toString(e.nodeType)));r=e.nodeName}throw k.thrown(r+" does not only have data")}if(s.nodeType!=G.PCData&&s.nodeType!=G.CData){let n;if(e.nodeType==G.Document)n="Document";else{if(e.nodeType!=G.Element)throw k.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":ge.toString(e.nodeType)));n=e.nodeName}throw k.thrown(n+" does not have data")}if(s.nodeType==G.Document||s.nodeType==G.Element)throw k.thrown("Bad node type, unexpected "+(s.nodeType==null?"null":ge.toString(s.nodeType)));return s.nodeValue}static get_innerHTML(e){let t="";if(e.nodeType!=G.Document&&e.nodeType!=G.Element)throw k.thrown("Bad node type, expected Element or Document but found "+(e.nodeType==null?"null":ge.toString(e.nodeType)));let i=0,s=e.children;for(;i<s.length;){let n=s[i++];t+=Z.string(Qi.print(n))}return t}}$i.__properties__={get_innerHTML:"get_innerHTML",get_innerData:"get_innerData"};class Qi{constructor(e){this.output=new $t,this.pretty=e}writeNode(e,t){switch(e.nodeType){case 0:if(this.output.b+=Z.string(t+"<"),e.nodeType!=G.Element)throw k.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":ge.toString(e.nodeType)));this.output.b+=Z.string(e.nodeName);let i=e.attributes();for(;i.hasNext();){let o=i.next();this.output.b+=Z.string(" "+o+'="');let c=Te.htmlEscape(e.get(o),!0);this.output.b+=Z.string(c),this.output.b+='"'}if(this.hasChildren(e)){if(this.output.b+=">",this.pretty&&(this.output.b+=`
5
+ `),e.nodeType!=G.Document&&e.nodeType!=G.Element)throw k.thrown("Bad node type, expected Element or Document but found "+(e.nodeType==null?"null":ge.toString(e.nodeType)));let o=0,c=e.children;for(;o<c.length;){let p=c[o++];this.writeNode(p,this.pretty?t+" ":t)}if(this.output.b+=Z.string(t+"</"),e.nodeType!=G.Element)throw k.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":ge.toString(e.nodeType)));this.output.b+=Z.string(e.nodeName),this.output.b+=">",this.pretty&&(this.output.b+=`
6
+ `)}else this.output.b+="/>",this.pretty&&(this.output.b+=`
7
+ `);break;case 1:if(e.nodeType==G.Document||e.nodeType==G.Element)throw k.thrown("Bad node type, unexpected "+(e.nodeType==null?"null":ge.toString(e.nodeType)));let s=e.nodeValue;if(s.length!=0){let o=t+Te.htmlEscape(s);this.output.b+=Z.string(o),this.pretty&&(this.output.b+=`
8
+ `)}break;case 2:if(this.output.b+=Z.string(t+"<![CDATA["),e.nodeType==G.Document||e.nodeType==G.Element)throw k.thrown("Bad node type, unexpected "+(e.nodeType==null?"null":ge.toString(e.nodeType)));this.output.b+=Z.string(e.nodeValue),this.output.b+="]]>",this.pretty&&(this.output.b+=`
9
+ `);break;case 3:if(e.nodeType==G.Document||e.nodeType==G.Element)throw k.thrown("Bad node type, unexpected "+(e.nodeType==null?"null":ge.toString(e.nodeType)));let n=e.nodeValue,l=new RegExp(`[
10
+ \r ]+`,"g".split("u").join(""));n=n.replace(l,""),n="<!--"+n+"-->",this.output.b+=t==null?"null":""+t;let r=Te.trim(n);this.output.b+=Z.string(r),this.pretty&&(this.output.b+=`
11
+ `);break;case 4:if(e.nodeType==G.Document||e.nodeType==G.Element)throw k.thrown("Bad node type, unexpected "+(e.nodeType==null?"null":ge.toString(e.nodeType)));this.output.b+=Z.string("<!DOCTYPE "+e.nodeValue+">"),this.pretty&&(this.output.b+=`
12
+ `);break;case 5:if(e.nodeType==G.Document||e.nodeType==G.Element)throw k.thrown("Bad node type, unexpected "+(e.nodeType==null?"null":ge.toString(e.nodeType)));this.output.b+=Z.string("<?"+e.nodeValue+"?>"),this.pretty&&(this.output.b+=`
13
+ `);break;case 6:if(e.nodeType!=G.Document&&e.nodeType!=G.Element)throw k.thrown("Bad node type, expected Element or Document but found "+(e.nodeType==null?"null":ge.toString(e.nodeType)));let h=0,a=e.children;for(;h<a.length;){let o=a[h++];this.writeNode(o,t)}break}}hasChildren(e){if(e.nodeType!=G.Document&&e.nodeType!=G.Element)throw k.thrown("Bad node type, expected Element or Document but found "+(e.nodeType==null?"null":ge.toString(e.nodeType)));let t=0,i=e.children;for(;t<i.length;){let s=i[t++];switch(s.nodeType){case 0:case 1:return!0;case 2:case 3:if(s.nodeType==G.Document||s.nodeType==G.Element)throw k.thrown("Bad node type, unexpected "+(s.nodeType==null?"null":ge.toString(s.nodeType)));if(Te.ltrim(s.nodeValue).length!=0)return!0;break;default:}}return!1}static print(e,t){t==null&&(t=!1);let i=new Qi(t);return i.writeNode(e,""),i.output.b}}K["haxe.xml.Printer"]=Qi,Qi.__name__="haxe.xml.Printer",Object.assign(Qi.prototype,{__class__:Qi});var j=Fe["hscript.TType"]={__ename__:"hscript.TType",__constructs__:null,TMono:(m=function(w){return{_hx_index:0,r:w,__enum__:"hscript.TType",toString:C}},m._hx_name="TMono",m.__params__=["r"],m),TVoid:{_hx_name:"TVoid",_hx_index:1,__enum__:"hscript.TType",toString:C},TInt:{_hx_name:"TInt",_hx_index:2,__enum__:"hscript.TType",toString:C},TFloat:{_hx_name:"TFloat",_hx_index:3,__enum__:"hscript.TType",toString:C},TBool:{_hx_name:"TBool",_hx_index:4,__enum__:"hscript.TType",toString:C},TDynamic:{_hx_name:"TDynamic",_hx_index:5,__enum__:"hscript.TType",toString:C},TParam:(m=function(w){return{_hx_index:6,name:w,__enum__:"hscript.TType",toString:C}},m._hx_name="TParam",m.__params__=["name"],m),TUnresolved:(m=function(w){return{_hx_index:7,name:w,__enum__:"hscript.TType",toString:C}},m._hx_name="TUnresolved",m.__params__=["name"],m),TNull:(m=function(w){return{_hx_index:8,t:w,__enum__:"hscript.TType",toString:C}},m._hx_name="TNull",m.__params__=["t"],m),TInst:(m=function(w,e){return{_hx_index:9,c:w,args:e,__enum__:"hscript.TType",toString:C}},m._hx_name="TInst",m.__params__=["c","args"],m),TEnum:(m=function(w,e){return{_hx_index:10,e:w,args:e,__enum__:"hscript.TType",toString:C}},m._hx_name="TEnum",m.__params__=["e","args"],m),TType:(m=function(w,e){return{_hx_index:11,t:w,args:e,__enum__:"hscript.TType",toString:C}},m._hx_name="TType",m.__params__=["t","args"],m),TAbstract:(m=function(w,e){return{_hx_index:12,a:w,args:e,__enum__:"hscript.TType",toString:C}},m._hx_name="TAbstract",m.__params__=["a","args"],m),TFun:(m=function(w,e){return{_hx_index:13,args:w,ret:e,__enum__:"hscript.TType",toString:C}},m._hx_name="TFun",m.__params__=["args","ret"],m),TAnon:(m=function(w){return{_hx_index:14,fields:w,__enum__:"hscript.TType",toString:C}},m._hx_name="TAnon",m.__params__=["fields"],m),TLazy:(m=function(w){return{_hx_index:15,f:w,__enum__:"hscript.TType",toString:C}},m._hx_name="TLazy",m.__params__=["f"],m)};j.__constructs__=[j.TMono,j.TVoid,j.TInt,j.TFloat,j.TBool,j.TDynamic,j.TParam,j.TUnresolved,j.TNull,j.TInst,j.TEnum,j.TType,j.TAbstract,j.TFun,j.TAnon,j.TLazy];var pe=Fe["hscript._Checker.WithType"]={__ename__:"hscript._Checker.WithType",__constructs__:null,NoValue:{_hx_name:"NoValue",_hx_index:0,__enum__:"hscript._Checker.WithType",toString:C},Value:{_hx_name:"Value",_hx_index:1,__enum__:"hscript._Checker.WithType",toString:C},WithType:(m=function(w){return{_hx_index:2,t:w,__enum__:"hscript._Checker.WithType",toString:C}},m._hx_name="WithType",m.__params__=["t"],m)};pe.__constructs__=[pe.NoValue,pe.Value,pe.WithType];var ni=Fe["hscript.CTypedecl"]={__ename__:"hscript.CTypedecl",__constructs__:null,CTClass:(m=function(w){return{_hx_index:0,c:w,__enum__:"hscript.CTypedecl",toString:C}},m._hx_name="CTClass",m.__params__=["c"],m),CTEnum:(m=function(w){return{_hx_index:1,e:w,__enum__:"hscript.CTypedecl",toString:C}},m._hx_name="CTEnum",m.__params__=["e"],m),CTTypedef:(m=function(w){return{_hx_index:2,t:w,__enum__:"hscript.CTypedecl",toString:C}},m._hx_name="CTTypedef",m.__params__=["t"],m),CTAlias:(m=function(w){return{_hx_index:3,t:w,__enum__:"hscript.CTypedecl",toString:C}},m._hx_name="CTAlias",m.__params__=["t"],m),CTAbstract:(m=function(w){return{_hx_index:4,a:w,__enum__:"hscript.CTypedecl",toString:C}},m._hx_name="CTAbstract",m.__params__=["a"],m)};ni.__constructs__=[ni.CTClass,ni.CTEnum,ni.CTTypedef,ni.CTAlias,ni.CTAbstract];class _s{constructor(e,t){this.expr=e,this.t=t}}K["hscript.Completion"]=_s,_s.__name__="hscript.Completion",Object.assign(_s.prototype,{__class__:_s});class Is{constructor(){this.types=new me,this.types=new me,this.types.h.Void=ni.CTAlias(j.TVoid),this.types.h.Int=ni.CTAlias(j.TInt),this.types.h.Float=ni.CTAlias(j.TFloat),this.types.h.Bool=ni.CTAlias(j.TBool),this.types.h.Dynamic=ni.CTAlias(j.TDynamic),this.parser=new Yi}addXmlApi(e){let t=new vs;t.process(e,"");let i=[],s=0,n=t.root;for(;s<n.length;){let r=n[s];++s,this.addXmlType(r,i)}let l=0;for(;l<i.length;){let r=i[l];++l,r()}this.t_string=this.getType("String")}defineClass(e,t){return t==null&&(t={name:e,fields:new me,statics:new me,params:[]}),this.types.h[e]=ni.CTClass(t),t}addXmlType(e,t){let i=this;switch(e._hx_index){case 0:let s=e.name,n=e.full,l=e.subs,r=0;for(;r<l.length;){let A=l[r];++r,this.addXmlType(A,t)}break;case 1:let h=e.c;if(Object.prototype.hasOwnProperty.call(this.types.h,h.path))return;let a={name:h.path,params:[],fields:new me,statics:new me};this.addMeta(h,a),h.isInterface&&(a.isInterface=!0);let o=0,c=h.params;for(;o<c.length;){let A=c[o];++o,a.params.push(j.TParam(A))}t.push(function(){let A=new me,B=0,I=a.params;for(;B<I.length;){let $=I[B];++B;let te=h.path+"."+We.typeStr($);A.h[te]=$}if(i.localParams=A,h.superClass!=null){let $=i,te=h.superClass.path,O=[],q=0,S=h.superClass.params;for(;q<S.length;){let W=S[q];++q,O.push(i.makeXmlType(W))}a.superClass=$.getType(te,O)}if(h.interfaces!=null){a.interfaces=[];let $=0,te=h.interfaces;for(;$<te.length;){let O=te[$];++$;let q=a.interfaces,S=i,W=O.path,ve=[],de=0,Ce=O.params;for(;de<Ce.length;){let Se=Ce[de];++de,ve.push(i.makeXmlType(Se))}q.push(S.getType(W,ve))}}let H=[],P=function($,te){if($.isOverride||u.substr($.name,0,4)=="get_"||u.substr($.name,0,4)=="set_")return;let O=!$.name.startsWith("__"),q=0,S=$.meta;for(;q<S.length;){let Ee=S[q];if(++q,Ee.name==":noScript")return;Ee.name==":noCompletion"&&(O=!1)}let W=$.set,ve;switch(W._hx_index){case 2:let Ee=W.m;ve=!0;break;case 0:case 4:ve=!0;break;default:ve=!1}let de={isPublic:$.isPublic,canWrite:ve,complete:O,params:[],name:$.name,t:null},Ce=0,Se=$.params;for(;Ce<Se.length;){let Ee=Se[Ce];++Ce;let J=j.TParam(Ee),se=$.name+"."+Ee;H.push(se),de.params.push(J),i.localParams.h[se]=J}if(de.t=i.makeXmlType($.type),$.meta!=null&&$.meta.length>0){de.meta=[];let Ee=0,J=$.meta;for(;Ee<J.length;){let se=J[Ee];++Ee;let N=de.meta,X=se.name,rt=[],Ve=0,Ye=se.params;for(;Ve<Ye.length;){let Ue=Ye[Ve];++Ve;let He;try{He=i.parser.parseString(Ue)}catch(Je){if(k.caught(Je).unwrap()instanceof ce)He=null;else throw Je}rt.push(He)}N.push({name:X,params:rt})}}for(;H.length>0;){let Ee=i.localParams,J=H.pop(),se=Ee;Object.prototype.hasOwnProperty.call(se.h,J)&&delete se.h[J]}de.name=="new"?a.constructor=de:te.set($.name,de)},M=0,V=h.fields;for(;M<V.length;){let $=V[M];++M,P($,a.fields)}let R=0,Y=h.statics;for(;R<Y.length;){let $=Y[R];++R,P($,a.statics)}i.localParams=null}),this.types.h[a.name]=ni.CTClass(a);break;case 2:let p=e.e;if(Object.prototype.hasOwnProperty.call(this.types.h,p.path))return;let f={name:p.path,params:[],constructors:[]};this.addMeta(p,f);let _=0,d=p.params;for(;_<d.length;){let A=d[_];++_,f.params.push(j.TParam(A))}t.push(function(){let A=new me,B=0,I=f.params;for(;B<I.length;){let M=I[B];++B;let V=p.path+"."+We.typeStr(M);A.h[V]=M}i.localParams=A;let H=0,P=p.constructors;for(;H<P.length;){let M=P[H];++H;let V=f.constructors,R=M.name,Y;if(M.args==null)Y=null;else{let $=[],te=0,O=M.args;for(;te<O.length;){let q=O[te];++te,$.push({name:q.name,opt:q.opt,t:i.makeXmlType(q.t)})}Y=$}V.push({name:R,args:Y})}i.localParams=null}),this.types.h[f.name]=ni.CTEnum(f);break;case 3:let x=e.t;if(Object.prototype.hasOwnProperty.call(this.types.h,x.path))return;let y={name:x.path,params:[],t:null},b=0,v=x.params;for(;b<v.length;){let A=v[b];++b,y.params.push(j.TParam(A))}x.path=="hscript.TypeCheck"&&y.params.reverse(),t.push(function(){let A=new me,B=0,I=y.params;for(;B<I.length;){let H=I[B];++B;let P=x.path+"."+We.typeStr(H);A.h[P]=H}i.localParams=A,y.t=i.makeXmlType(x.type),i.localParams=null}),this.types.h[x.path]=ni.CTTypedef(y);break;case 4:let T=e.a;if(Object.prototype.hasOwnProperty.call(this.types.h,T.path))return;let E={name:T.path,params:[],t:null};this.addMeta(T,E);let F=0,L=T.params;for(;F<L.length;){let A=L[F];++F,E.params.push(j.TParam(A))}t.push(function(){let A=new me,B=0,I=E.params;for(;B<I.length;){let H=I[B];++B;let P=T.path+"."+We.typeStr(H);A.h[P]=H}i.localParams=A,E.t=i.makeXmlType(T.athis),i.localParams=null}),this.types.h[T.path]=ni.CTAbstract(E);break}}addMeta(e,t){if(e.meta==null||e.meta.length==0)return;t.meta=[];let i=0,s=e.meta;for(;i<s.length;){let n=s[i];++i;let l=t.meta,r=n.name,h=[],a=0,o=n.params;for(;a<o.length;){let c=o[a];++a;let p;try{p=this.parser.parseString(c)}catch(f){if(k.caught(f).unwrap()instanceof ce)p=null;else throw f}h.push(p)}l.push({name:r,params:h})}}makeXmlType(e){switch(e._hx_index){case 0:return j.TUnresolved("Unknown");case 1:let t=e.name,i=e.params,s=[],n=0;for(;n<i.length;){let I=i[n];++n,s.push(this.makeXmlType(I))}return this.getType(t,s);case 2:let l=e.name,r=e.params,h=[],a=0;for(;a<r.length;){let I=r[a];++a,h.push(this.makeXmlType(I))}return this.getType(l,h);case 3:let o=e.name,c=e.params,p=[],f=0;for(;f<c.length;){let I=c[f];++f,p.push(this.makeXmlType(I))}return this.getType(o,p);case 4:let _=e.args,d=e.ret,x=[],y=0;for(;y<_.length;){let I=_[y];++y,x.push({name:I.name,opt:I.opt,t:this.makeXmlType(I.t)})}return j.TFun(x,this.makeXmlType(d));case 5:let b=e.fields,v=[],T=0;for(;T<b.length;){let I=b[T];++T;let H=I.name,P=this.makeXmlType(I.type),M=I.meta,V;if(M==null)V=!1;else{let R=!1,Y=0;for(;Y<M.length;){let $=M[Y];if(++Y,$.name==":optional"){R=!0;break}}V=R}v.push({name:H,t:P,opt:V})}return j.TAnon(v);case 6:let E=e.t;return j.TDynamic;case 7:let F=e.name,L=e.params,A=[],B=0;for(;B<L.length;){let I=L[B];++B,A.push(this.makeXmlType(I))}return this.getType(F,A)}}getType(e,t){if(this.localParams!=null){let s=this.localParams.h[e];if(s!=null)return s}let i=this.resolve(e,t);if(i==null){let s=e.split(".");if(s.length>1){let n=s[s.length-2];if(u.cca(n,0)==95)return u.remove(s,n),this.getType(s.join("."),t)}return j.TUnresolved(e)}return i}resolve(e,t){if(e=="Null"){if(t==null||t.length!=1)throw k.thrown("Missing Null<T> parameter");return j.TNull(t[0])}let i=this.types.h[e];if(i==null)return null;switch(t==null&&(t=[]),i._hx_index){case 0:let s=i.c;return j.TInst(s,t);case 1:let n=i.e;return j.TEnum(n,t);case 2:let l=i.t;return j.TType(l,t);case 3:return i.t;case 4:let h=i.a;return j.TAbstract(h,t)}}}K["hscript.CheckerTypes"]=Is,Is.__name__="hscript.CheckerTypes",Object.assign(Is.prototype,{__class__:Is});class We{constructor(e){this.events=new me,this.globals=new me,e==null&&(e=new Is),this.types=e}setGlobals(e,t){t==null&&(t=!1);let i=this;for(;;){let s=e.fields.h,n=s,l=Object.keys(s),r=l.length,h=0;for(;h<r;){let o=n[l[h++]];if(o.isPublic||t){let c=o.params.length==0?o.t:j.TLazy(function(){let p=i,f=o.t,_=o.params,d=[],x=0,y=o.params.length;for(;x<y;){let b=x++;d.push(i.makeMono())}return p.apply(f,_,d)});this.setGlobal(o.name,c)}}if(e.superClass==null)break;let a=e.superClass;if(a==null)throw k.thrown("assert");if(a._hx_index==9){let o=a.args;e=a.c}else throw k.thrown("assert")}}removeGlobal(e){let t=this.globals;Object.prototype.hasOwnProperty.call(t.h,e)&&delete t.h[e]}setGlobal(e,t){this.globals.h[e]=t}setEvent(e,t){this.events.h[e]=t}getGlobals(){return this.globals}onTopDownEnum(e,t){return!1}typeArgs(e,t){let i=[],s=0,n=e.length;for(;s<n;){let l=s++,r=e[l],h=r.t==null?this.makeMono():this.makeType(r.t,t);i.push({name:r.name,opt:r.opt,t:h})}return i}check(e,t,i){i==null&&(i=!1),t==null&&(t=pe.NoValue),this.locals=new me,this.types.t_string==null&&(this.types.t_string=this.types.getType("String")),this.allowDefine=this.allowGlobalsDefine,this.isCompletion=i;let s=e.e,n;if(s._hx_index==14){let h=s.args,a=s.e,o=s.name,c=s.ret;n=!0}else n=!1;n&&(e=this.mk(D.EBlock([e]),e));let l=this,r=e.e;if(r._hx_index==4){let h=r.e,a=[],o=j.TVoid,c=0;for(;c<h.length;){let f=h[c];for(++c;;){let d=f.e;if(d._hx_index==25){let x=d.name,y=d.args;f=d.e}else break}let _=f.e;if(_._hx_index==14){let d=_.e,x=_.args,y=_.name,b=_.ret;if(y!=null){let v=b==null?this.makeMono():this.makeType(b,f),T=j.TFun(this.typeArgs(x,f),v);this.locals.h[y]=T,a.push(function(){return l.currentFunType=T,l.typeExpr(f,pe.NoValue),T})}else{let v=0;for(;v<a.length;){let T=a[v];++v,T()}a=[],h[h.length-1]==f?o=this.typeExpr(f,t):this.typeExpr(f,pe.NoValue)}}else{let d=0;for(;d<a.length;){let x=a[d];++d,x()}a=[],h[h.length-1]==f?o=this.typeExpr(f,t):this.typeExpr(f,pe.NoValue)}}let p=0;for(;p<a.length;){let f=a[p];++p,o=f()}return o}return this.typeExpr(e,t)}edef(e){return e.e}error(e,t){let i=oe.ECustom(e),s=new ce(i,t.pmin,t.pmax,t.origin,t.line);if(!this.isCompletion)throw k.thrown(s)}saveLocals(){let e=new me,t=this.locals.h,i=t,s=Object.keys(t),n=s.length,l=0;for(;l<n;){let r=s[l++];e.h[r]=this.locals.h[r]}return e}makeType(e,t){switch(e._hx_index){case 0:let i=e.path,s=e.params,n=this.types,l=i.join("."),r;if(s==null)r=[];else{let E=[],F=0;for(;F<s.length;){let L=s[F];++F,E.push(this.makeType(L,t))}r=E}let h=n.resolve(l,r);if(h==null){let E=oe.ECustom("Unknown type "+Z.string(i)),F=new ce(E,t.pmin,t.pmax,t.origin,t.line);if(!this.isCompletion)throw k.thrown(F);h=j.TDynamic}return h;case 1:let a=e.args,o=e.ret,c=0,p=[],f=0;for(;f<a.length;){let E=a[f];++f,p.push({name:"p"+c++,opt:!1,t:this.makeType(E,t)})}return j.TFun(p,this.makeType(o,t));case 2:let _=e.fields,d=[],x=0;for(;x<_.length;){let E=_[x];++x,d.push({name:E.name,opt:!1,t:this.makeType(E.t,t)})}return j.TAnon(d);case 3:let y=e.t;return this.makeType(y,t);case 4:let b=e.t;return this.makeType(b,t);case 5:let v=e.n,T=e.t;return this.makeType(T,t)}}linkLoop(e,t){if(t==e)return!0;switch(t._hx_index){case 0:let i=t.r;return i.r==null?!1:this.linkLoop(e,i.r);case 5:return t==j.TDynamic?!1:this.linkLoop(e,j.TDynamic);case 9:let s=t.c,n=t.args,l=0;for(;l<n.length;){let E=n[l];if(++l,this.linkLoop(e,E))return!0}return!1;case 10:let r=t.e,h=t.args,a=0;for(;a<h.length;){let E=h[a];if(++a,this.linkLoop(e,E))return!0}return!1;case 11:let o=t.t,c=t.args,p=0;for(;p<c.length;){let E=c[p];if(++p,this.linkLoop(e,E))return!0}return!1;case 12:let f=t.a,_=t.args,d=0;for(;d<_.length;){let E=_[d];if(++d,this.linkLoop(e,E))return!0}return!1;case 13:let x=t.args,y=t.ret,b=0;for(;b<x.length;){let E=x[b];if(++b,this.linkLoop(e,E.t))return!0}return this.linkLoop(e,y);case 14:let v=t.fields,T=0;for(;T<v.length;){let E=v[T];if(++T,this.linkLoop(e,E.t))return!0}return!1;default:return!1}}link(e,t,i){return this.linkLoop(e,t)?this.follow(t)==e:(t==j.TDynamic||(i.r=t),!0)}typeEq(e,t){if(e==t)return!0;switch(e._hx_index){case 0:let i=e.r;return i.r==null?this.link(e,t,i)?(i.r=t,!0):!1:this.typeEq(i.r,t);case 8:let s=e.t;switch(t._hx_index){case 0:let x=t.r;return x.r==null?this.link(t,e,x)?(x.r=e,!0):!1:this.typeEq(e,x.r);case 8:let y=t.t,b=s;return this.typeEq(b,y);case 11:let v=t.t,T=t.args;return this.typeEq(e,this.apply(v.t,v.params,T));default:let E=s;return this.typeEq(E,t)}break;case 9:let n=e.c,l=e.args;switch(t._hx_index){case 0:let x=t.r;return x.r==null?this.link(t,e,x)?(x.r=e,!0):!1:this.typeEq(e,x.r);case 8:let y=t.t;return this.typeEq(e,y);case 9:let b=t.c,v=t.args,T=l;if(n==b){let A=0,B=T.length;for(;A<B;){let I=A++;if(!this.typeEq(T[I],v[I]))return!1}return!0}break;case 11:let F=t.t,L=t.args;return this.typeEq(e,this.apply(F.t,F.params,L));default:}break;case 10:let r=e.e,h=e.args;switch(t._hx_index){case 0:let x=t.r;return x.r==null?this.link(t,e,x)?(x.r=e,!0):!1:this.typeEq(e,x.r);case 8:let y=t.t;return this.typeEq(e,y);case 10:let b=t.e,v=t.args,T=h;if(r==b){let A=0,B=T.length;for(;A<B;){let I=A++;if(!this.typeEq(T[I],v[I]))return!1}return!0}break;case 11:let F=t.t,L=t.args;return this.typeEq(e,this.apply(F.t,F.params,L));default:}break;case 11:let a=e.t,o=e.args;switch(t._hx_index){case 0:let x=t.r;return x.r==null?this.link(t,e,x)?(x.r=e,!0):!1:this.typeEq(e,x.r);case 8:let y=t.t,b=o,v=a;return this.typeEq(this.apply(v.t,v.params,b),t);case 11:let T=t.t,E=t.args,F=o;if(a==T){let I=0,H=F.length;for(;I<H;){let P=I++;if(!this.typeEq(F[P],E[P]))return!1}return!0}else{let I=o,H=a;return this.typeEq(this.apply(H.t,H.params,I),t)}break;default:let A=o,B=a;return this.typeEq(this.apply(B.t,B.params,A),t)}break;case 12:let c=e.a,p=e.args;switch(t._hx_index){case 0:let x=t.r;return x.r==null?this.link(t,e,x)?(x.r=e,!0):!1:this.typeEq(e,x.r);case 8:let y=t.t;return this.typeEq(e,y);case 11:let b=t.t,v=t.args;return this.typeEq(e,this.apply(b.t,b.params,v));case 12:let T=t.a,E=t.args,F=p;if(c==T){let A=0,B=F.length;for(;A<B;){let I=A++;if(!this.typeEq(F[I],E[I]))return!1}return!0}break;default:}break;case 13:let f=e.args,_=e.ret;switch(t._hx_index){case 0:let x=t.r;return x.r==null?this.link(t,e,x)?(x.r=e,!0):!1:this.typeEq(e,x.r);case 8:let y=t.t;return this.typeEq(e,y);case 11:let b=t.t,v=t.args;return this.typeEq(e,this.apply(b.t,b.params,v));case 13:let T=t.args,E=t.ret,F=_,L=f;if(L.length==T.length){let A=0,B=L.length;for(;A<B;){let I=A++;if(!this.typeEq(L[I].t,T[I].t))return!1}return this.typeEq(F,E)}break;default:}break;case 14:let d=e.fields;switch(t._hx_index){case 0:let x=t.r;return x.r==null?this.link(t,e,x)?(x.r=e,!0):!1:this.typeEq(e,x.r);case 8:let y=t.t;return this.typeEq(e,y);case 11:let b=t.t,v=t.args;return this.typeEq(e,this.apply(b.t,b.params,v));case 14:let T=t.fields,E=d;if(E.length==T.length){let F=Object.create(null),L=0;for(;L<T.length;){let B=T[L];++L,F[B.name]=B}let A=0;for(;A<E.length;){let B=E[A];++A;let I=F[B.name];if(I==null||!this.typeEq(B.t,I.t))return!1}return!0}break;default:}break;default:switch(t._hx_index){case 0:let x=t.r;return x.r==null?this.link(t,e,x)?(x.r=e,!0):!1:this.typeEq(e,x.r);case 8:let y=t.t;return this.typeEq(e,y);case 11:let b=t.t,v=t.args;return this.typeEq(e,this.apply(b.t,b.params,v));default:}}return!1}tryUnify(e,t){if(e==t)return!0;switch(e._hx_index){case 0:let i=e.r;return i.r==null?this.link(e,t,i)?(i.r=t,!0):!1:this.tryUnify(i.r,t);case 2:switch(t._hx_index){case 0:let p=t.r;return p.r==null?this.link(t,e,p)?(p.r=e,!0):!1:this.tryUnify(e,p.r);case 3:return!0;case 5:return!0;case 8:let f=t.t;return this.tryUnify(e,f);case 11:let _=t.t,d=t.args;return this.tryUnify(e,this.apply(_.t,_.params,d));default:}break;case 5:switch(t._hx_index){case 0:let p=t.r;return p.r==null?this.link(t,e,p)?(p.r=e,!0):!1:this.tryUnify(e,p.r);case 5:return!0;case 8:let f=t.t;return this.tryUnify(e,f);case 11:let _=t.t,d=t.args;return this.tryUnify(e,this.apply(_.t,_.params,d));default:return!0}break;case 8:let s=e.t;switch(t._hx_index){case 0:let p=t.r;return p.r==null?this.link(t,e,p)?(p.r=e,!0):!1:this.tryUnify(e,p.r);case 5:let f=s;return this.tryUnify(f,t);case 8:let _=t.t,d=s;return this.tryUnify(d,t);case 11:let x=t.t,y=t.args;return this.tryUnify(e,this.apply(x.t,x.params,y));default:let b=s;return this.tryUnify(b,t)}break;case 9:let n=e.c,l=e.args;switch(t._hx_index){case 0:let p=t.r;return p.r==null?this.link(t,e,p)?(p.r=e,!0):!1:this.tryUnify(e,p.r);case 5:return!0;case 8:let f=t.t;return this.tryUnify(e,f);case 9:let _=t.c,d=t.args,x=l,y=n;for(;y!=_;){if(y.interfaces!=null){let P=0,M=y.interfaces;for(;P<M.length;){let V=M[P];if(++P,V._hx_index==9){let R=V.c,Y=V.args,$=[],te=0;for(;te<Y.length;){let q=Y[te];++te,$.push(this.apply(q,y.params,x))}let O=j.TInst(R,$);if(this.tryUnify(O,t))return!0}else throw k.thrown("assert")}}let H=y.superClass;if(H==null)return!1;if(H._hx_index==9){let P=H.c,M=H.args,V=[],R=0;for(;R<M.length;){let Y=M[R];++R,V.push(this.apply(Y,y.params,x))}x=V,y=P}else throw k.thrown("assert")}let b=0,v=x.length;for(;b<v;){let H=b++;if(!this.typeEq(x[H],d[H]))return!1}return!0;case 11:let T=t.t,E=t.args;return this.tryUnify(e,this.apply(T.t,T.params,E));case 14:let F=t.fields,L=l,A=n,B=0,I=F.length;for(;B<I;){let H=B++,P=F[H],M=null,V=A;for(;M=V.fields.h[P.name],M==null;){if(V.superClass==null)return!1;let R=V.superClass;if(R==null)throw k.thrown("assert");if(R._hx_index==9){let Y=R.args;V=R.c}else throw k.thrown("assert")}if(!this.typeEq(this.apply(M.t,A.params,L),P.t))return!1}return!0;default:}break;case 11:let r=e.t,h=e.args;switch(t._hx_index){case 0:let p=t.r;return p.r==null?this.link(t,e,p)?(p.r=e,!0):!1:this.tryUnify(e,p.r);case 5:let f=h,_=r;return this.tryUnify(this.apply(_.t,_.params,f),t);case 8:let d=t.t,x=h,y=r;return this.tryUnify(this.apply(y.t,y.params,x),t);case 11:let b=t.t,v=t.args,T=h,E=r;return this.tryUnify(this.apply(E.t,E.params,T),t);default:let F=h,L=r;return this.tryUnify(this.apply(L.t,L.params,F),t)}break;case 13:let a=e.args,o=e.ret;switch(t._hx_index){case 0:let p=t.r;return p.r==null?this.link(t,e,p)?(p.r=e,!0):!1:this.tryUnify(e,p.r);case 5:return!0;case 8:let f=t.t;return this.tryUnify(e,f);case 11:let _=t.t,d=t.args;return this.tryUnify(e,this.apply(_.t,_.params,d));case 12:let x=t.a,y=t.args,b=x.meta,v=x.params,T=x.t;if(x.name=="haxe.Function")return!0;break;case 13:let E=t.args,F=t.ret,L=o,A=a;if(A.length==E.length){let B=0,I=A.length;for(;B<I;){let H=B++,P=A[H],M=E[H];if(M.opt&&!P.opt||!this.tryUnify(M.t,P.t))return!1}return this.tryUnify(L,F)}break;default:}break;case 14:let c=e.fields;switch(t._hx_index){case 0:let p=t.r;return p.r==null?this.link(t,e,p)?(p.r=e,!0):!1:this.tryUnify(e,p.r);case 5:return!0;case 8:let f=t.t;return this.tryUnify(e,f);case 11:let _=t.t,d=t.args;return this.tryUnify(e,this.apply(_.t,_.params,d));case 14:let x=t.fields,y=c;if(x.length==0)return!0;let b=Object.create(null),v=0;for(;v<y.length;){let E=y[v];++v,b[E.name]=E}let T=0;for(;T<x.length;){let E=x[T];++T;let F=b[E.name];if(F==null){if(E.opt)continue;return!1}if(!this.typeEq(F.t,E.t))return!1}return!0;default:}break;default:switch(t._hx_index){case 0:let p=t.r;return p.r==null?this.link(t,e,p)?(p.r=e,!0):!1:this.tryUnify(e,p.r);case 5:return!0;case 8:let f=t.t;return this.tryUnify(e,f);case 11:let _=t.t,d=t.args;return this.tryUnify(e,this.apply(_.t,_.params,d));default:}}return this.typeEq(e,t)}unify(e,t,i){if(!this.tryUnify(e,t)){let s=oe.ECustom(We.typeStr(e)+" should be "+We.typeStr(t)),n=new ce(s,i.pmin,i.pmax,i.origin,i.line);if(!this.isCompletion)throw k.thrown(n)}}apply(e,t,i){if(i.length!=t.length)throw k.thrown("Invalid number of type parameters");if(i.length==0)return e;let s=new Gi,n=0,l=t.length;for(;n<l;){let a=n++;s.set(t[a],i[a])}let r=null,h=this;return r=function(a){let o=s.get(a);return o??h.mapType(a,r)},r(e)}mapType(e,t){switch(e._hx_index){case 0:return e.r.r==null?e:t(e);case 1:case 2:case 3:case 4:case 5:return e;case 6:let s=e.name;return e;case 7:let n=e.name;return e;case 8:let l=e.t;return j.TNull(t(l));case 9:let r=e.args;if(r.length==0)return e;{let v=r,T=e.c,E=[],F=0;for(;F<v.length;){let L=v[F];++F,E.push(t(L))}return j.TInst(T,E)}break;case 10:let h=e.args;if(h.length==0)return e;{let v=h,T=e.e,E=[],F=0;for(;F<v.length;){let L=v[F];++F,E.push(t(L))}return j.TEnum(T,E)}break;case 11:let a=e.args;if(a.length==0)return e;{let v=a,T=e.t,E=[],F=0;for(;F<v.length;){let L=v[F];++F,E.push(t(L))}return j.TType(T,E)}break;case 12:let o=e.args;if(o.length==0)return e;{let v=o,T=e.a,E=[],F=0;for(;F<v.length;){let L=v[F];++F,E.push(t(L))}return j.TAbstract(T,E)}break;case 13:let c=e.args,p=e.ret,f=[],_=0;for(;_<c.length;){let v=c[_];++_,f.push({name:v.name,opt:v.opt,t:t(v.t)})}return j.TFun(f,t(p));case 14:let d=e.fields,x=[],y=0;for(;y<d.length;){let v=d[y];++y,x.push({name:v.name,opt:v.opt,t:t(v.t)})}return j.TAnon(x);case 15:let b=e.f;return t(b())}}follow(e){switch(e._hx_index){case 0:let t=e.r;return t.r!=null?this.follow(t.r):e;case 8:let i=e.t;return this.follow(i);case 11:let s=e.t,n=e.args;return this.follow(this.apply(s.t,s.params,n));case 15:let l=e.f;return this.follow(l());default:return e}}getFields(e){let t=[],i=this,s=this.follow(e);switch(s._hx_index){case 9:let n=s.c,l=s.args,r=function(p){return i.apply(p,n.params,l)};for(;n!=null;){let p=n.fields.h,f=p,_=Object.keys(p),d=_.length,x=0;for(;x<d;){let b=_[x++],v=n.fields.h[b];if(!v.isPublic||!v.complete)continue;let T=v.name,E=r(v.t);this.allowAsync&&T.startsWith("a_")&&(E=this.unasync(E),T=u.substr(T,2,null)),t.push({name:T,t:E})}if(n.isInterface&&n.interfaces!=null){let b=0,v=n.interfaces;for(;b<v.length;){let T=v[b];++b;let E=0,F=this.getFields(T);for(;E<F.length;){let L=F[E];++E,t.push({name:L.name,t:r(L.t)})}}}if(n.superClass==null)break;let y=n.superClass;if(y==null)break;if(y._hx_index==9){let b=y.c,v=y.args,T=r;r=function(E){return T(i.apply(E,b.params,v))},n=b}else break}break;case 13:let h=s.args,a=s.ret;this.isCompletion&&t.push({name:"bind",t:j.TFun(h,j.TVoid)});break;case 14:let o=s.fields,c=0;for(;c<o.length;){let p=o[c];++c,t.push({name:p.name,t:p.t})}break;default:}return t}getField(e,t,i,s){s==null&&(s=!1);let n=this.follow(e);switch(n._hx_index){case 5:return this.makeMono();case 9:let l=n.c,r=n.args,h=l.fields.h[t];if(h==null&&this.allowAsync&&(h=l.fields.h["a_"+t],h!=null&&(h={isPublic:!0,canWrite:!1,params:h.params,name:h.name,t:this.unasync(h.t),complete:h.complete},h.t==null&&(h=null))),h==null&&l.isInterface&&l.interfaces!=null){let p=0,f=l.interfaces;for(;p<f.length;){let _=f[p];++p;let d=this.getField(_,t,i,s);if(d!=null)return this.apply(d,l.params,r)}}if(h==null){if(l.superClass==null)return null;let p=this.getField(l.superClass,t,i,s);return p!=null&&(p=this.apply(p,l.params,r)),p}if(!h.isPublic){let p=oe.ECustom("Can't access private field "+t+" on "+l.name),f=new ce(p,i.pmin,i.pmax,i.origin,i.line);if(!this.isCompletion)throw k.thrown(f)}if(s&&!h.canWrite){let p=oe.ECustom("Can't write readonly field "+t+" on "+l.name),f=new ce(p,i.pmin,i.pmax,i.origin,i.line);if(!this.isCompletion)throw k.thrown(f)}let a=h.t;if(h.params!=null){let p=h.params,f=[],_=0,d=h.params.length;for(;_<d;){let x=_++;f.push(this.makeMono())}a=this.apply(a,p,f)}return this.apply(a,l.params,r);case 14:let o=n.fields,c=0;for(;c<o.length;){let p=o[c];if(++c,p.name==t)return p.t}return null;default:return null}}unasync(e){let t=this.follow(e);if(t._hx_index==13){let i=t.args,s=t.ret;if(i.length>0){let n=i.slice(),l=this.follow(n.shift().t);if(l._hx_index==13){let r=l.args,h=l.ret;if(r.length==1){let a=r[0];return j.TFun(n,a.t)}}}}return null}typeExprWith(e,t){let i=this.typeExpr(e,pe.WithType(t));return this.unify(i,t,e),t}makeMono(){return j.TMono({r:null})}makeIterator(e){return j.TAnon([{name:"next",opt:!1,t:j.TFun([],e)},{name:"hasNext",opt:!1,t:j.TFun([],j.TBool)}])}mk(e,t){return{e,pmin:t.pmin,pmax:t.pmax,origin:t.origin,line:t.line}}isString(e){if(e=this.follow(e),e._hx_index==9){let t=e.c,i=e.args,s=t.constructor,n=t.fields,l=t.interfaces,r=t.isInterface,h=t.meta,a=t.params,o=t.statics,c=t.superClass;return t.name=="String"}else return!1}onCompletion(e,t){if(this.isCompletion)throw k.thrown(new _s(e,t))}typeField(e,t,i,s){let n=this.typeExpr(e,pe.Value);t==null&&this.onCompletion(i,n);let l=this.getField(n,t,i,s);if(l==null){let r=oe.ECustom(We.typeStr(n)+" has no field "+t),h=new ce(r,i.pmin,i.pmax,i.origin,i.line);if(!this.isCompletion)throw k.thrown(h);l=j.TDynamic}return l}typeExpr(e,t){if(e==null&&this.isCompletion)return t._hx_index==2?t.t:j.TDynamic;let i=this,s=e.e;switch(s._hx_index){case 0:let h=s.c;switch(h._hx_index){case 0:let ne=h.v;return j.TInt;case 1:let ae=h.f;return j.TFloat;case 2:let ke=h.s;return this.types.t_string}break;case 1:let a=s.v,o=this.locals.h[a];if(o!=null)return o;let c=this.globals.h[a];if(c!=null){if(c==null)return c;if(c._hx_index==15){let ne=c.f;return ne()}else return c}if(this.allowAsync&&(c=this.globals.h["a_"+a],c!=null&&(c=this.unasync(c)),c!=null))return c;switch(a){case"false":case"true":return j.TBool;case"null":return this.makeMono();case"trace":return j.TDynamic;default:if(t._hx_index==2){let ke=t.t;if(ke._hx_index==10){let Ie=ke,Bt=ke.e,St=ke.args,et=0,wi=Bt.constructors;for(;et<wi.length;){let si=wi[et];if(++et,si.name==a){if(this.onTopDownEnum(Bt,a)){let st=si.args==null?Ie:j.TFun(si.args,Ie);return this.apply(st,Bt.params,St)}break}}}}if(this.isCompletion)return j.TDynamic;let ne=oe.ECustom("Unknown identifier "+a),ae=new ce(ne,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw k.thrown(ae)}break;case 2:let p=s.n,f=s.t,_=s.e,d=f==null?this.makeMono():this.makeType(f,e);if(_!=null){let ne=this.typeExpr(_,f==null?pe.Value:pe.WithType(d));f==null?d=ne:this.unify(ne,d,_)}return this.locals.h[p]=d,j.TVoid;case 3:let x=s.e;return this.typeExpr(x,t);case 4:let y=s.e,b=j.TVoid,v=this.saveLocals(),T=0;for(;T<y.length;){let ne=y[T];++T,b=this.typeExpr(ne,ne==y[y.length-1]?t:pe.NoValue)}return this.locals=v,b;case 5:let E=s.e,F=s.f;return this.typeField(E,F,e,!1);case 6:let L=s.op,A=s.e1,B=s.e2;switch(L){case"!=":case"==":let ne=this.typeExpr(A,pe.Value),ae=this.typeExpr(B,pe.WithType(ne));return this.tryUnify(ne,ae)||this.unify(ae,ne,B),j.TBool;case"%":case"*":case"-":case"/":let ke=this.typeExpr(A,pe.WithType(j.TInt)),Ie=this.typeExpr(B,pe.WithType(ke));this.tryUnify(ke,Ie)||this.unify(Ie,ke,B);let Bt=this.follow(ke),St=this.follow(Ie);switch(Bt._hx_index){case 2:switch(St._hx_index){case 2:return L=="/"?j.TFloat:j.TInt;case 3:case 5:return j.TFloat;default:this.unify(ke,j.TFloat,A),this.unify(Ie,j.TFloat,B)}break;case 3:switch(St._hx_index){case 2:case 3:case 5:return j.TFloat;default:this.unify(ke,j.TFloat,A),this.unify(Ie,j.TFloat,B)}break;case 5:switch(St._hx_index){case 2:case 3:case 5:return j.TFloat;default:this.unify(ke,j.TFloat,A),this.unify(Ie,j.TFloat,B)}break;default:this.unify(ke,j.TFloat,A),this.unify(Ie,j.TFloat,B)}break;case"+":let et=this.typeExpr(A,pe.WithType(j.TInt)),wi=this.typeExpr(B,pe.WithType(et));this.tryUnify(et,wi);let si=this.follow(et),st=this.follow(wi);switch(si._hx_index){case 2:switch(st._hx_index){case 2:return j.TInt;case 3:return j.TFloat;case 5:return j.TDynamic;default:let xt=si,pi=st;if(this.isString(xt)||this.isString(pi))return this.types.t_string;this.unify(xt,j.TFloat,A),this.unify(pi,j.TFloat,B)}break;case 3:switch(st._hx_index){case 2:case 3:return j.TFloat;case 5:return j.TDynamic;default:let xt=si,pi=st;if(this.isString(xt)||this.isString(pi))return this.types.t_string;this.unify(xt,j.TFloat,A),this.unify(pi,j.TFloat,B)}break;case 5:return j.TDynamic;default:if(st._hx_index==5)return j.TDynamic;{let xt=si,pi=st;if(this.isString(xt)||this.isString(pi))return this.types.t_string;this.unify(xt,j.TFloat,A),this.unify(pi,j.TFloat,B)}}break;case"...":return this.typeExprWith(A,j.TInt),this.typeExprWith(B,j.TInt),this.makeIterator(j.TInt);case"&":case"<<":case">>":case">>>":case"^":case"|":return this.typeExprWith(A,j.TInt),this.typeExprWith(B,j.TInt),j.TInt;case"<":case"<=":case">":case">=":let Rt=this.typeExpr(A,pe.Value),Mi=this.typeExpr(B,pe.WithType(Rt));this.tryUnify(Rt,Mi)||this.unify(Mi,Rt,B);let ts=this.follow(Rt);switch(ts._hx_index){case 2:case 3:case 4:break;case 9:let xt=ts.c,pi=ts.args,sn=xt.constructor,Nn=xt.fields,Mn=xt.interfaces,Ln=xt.isInterface,Bn=xt.meta,An=xt.params,Fn=xt.statics,Dn=xt.superClass;if(xt.name!="String"){let vn=oe.ECustom("Cannot compare "+We.typeStr(Rt)),In=new ce(vn,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw k.thrown(In)}break;default:let En=oe.ECustom("Cannot compare "+We.typeStr(Rt)),Sn=new ce(En,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw k.thrown(Sn)}return j.TBool;case"=":if(this.allowDefine){let xt=A.e;if(xt._hx_index==1){let pi=xt.v;if(!Object.prototype.hasOwnProperty.call(this.locals.h,pi)&&!Object.prototype.hasOwnProperty.call(this.globals.h,pi)){let sn=this.typeExpr(B,pe.Value);return this.locals.h[pi]=sn,sn}}}let Ts,Hs=A.e;if(Hs._hx_index==5){let xt=Hs.e,pi=Hs.f;Ts=this.typeField(xt,pi,A,!0)}else Ts=this.typeExpr(A,pe.Value);return this.typeExprWith(B,Ts),Ts;case"&&":case"||":return this.typeExprWith(A,j.TBool),this.typeExprWith(B,j.TBool),j.TBool;default:if(u.cca(L,L.length-1)==61){let xt=this.typeExpr(this.mk(D.EBinop(u.substr(L,0,L.length-1),A,B),e),t);return this.typeExpr(this.mk(D.EBinop("=",A,B),e),t)}let Tn=oe.ECustom("Unsupported operation "+L),Cn=new ce(Tn,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw k.thrown(Cn)}break;case 7:let I=s.prefix,H=s.op,P=s.e,M=this.typeExpr(P,pe.Value);switch(H){case"!":return this.unify(M,j.TBool,P),M;case"++":case"-":case"--":return this.unify(M,j.TInt,P),M;default:}break;case 8:let V=s.e,R=s.params,Y=V.e;if(Y._hx_index==5&&Y.f=="bind"){let ne=Y.e,ae=this.typeExpr(ne,pe.Value);if(ae._hx_index==13){let ke=ae.args,Ie=ae.ret,Bt=ke.slice(),St=0;for(;St<R.length;){let et=R[St];++St;let wi=Bt.shift();if(wi==null){let si=oe.ECustom("Too many arguments"),st=new ce(si,et.pmin,et.pmax,et.origin,et.line);if(!this.isCompletion)throw k.thrown(st);return j.TFun([],Ie)}this.typeExprWith(et,wi.t)}return j.TFun(Bt,Ie)}}let $=V.e,te;if($._hx_index==1){let ne=$.v;if(t._hx_index==2){let ae=t.t;if(ae._hx_index==10){let ke=ae.e,Ie=ae.args;te=t}else te=pe.Value}else te=pe.Value}else te=pe.Value;let O=this.typeExpr(V,te),q=this.follow(O);switch(q._hx_index){case 5:let ne=0;for(;ne<R.length;){let st=R[ne];++ne,this.typeExpr(st,pe.Value)}return this.makeMono();case 13:let ae=q.args,ke=q.ret,Ie=0,Bt=R.length;for(;Ie<Bt;){let st=Ie++,Rt=ae[st];if(Rt==null){let ts=R[st],Ts=oe.ECustom("Too many arguments"),Hs=new ce(Ts,ts.pmin,ts.pmax,ts.origin,ts.line);if(!this.isCompletion)throw k.thrown(Hs);break}let Mi=this.typeExpr(R[st],Rt==null?pe.Value:pe.WithType(Rt.t));this.unify(Mi,Rt.t,R[st])}let St=R.length,et=ae.length;for(;St<et;){let st=St++;if(!ae[st].opt){let Rt=oe.ECustom("Missing argument "+ae[st].name+":"+We.typeStr(ae[st].t)),Mi=new ce(Rt,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw k.thrown(Mi)}}return ke;default:let wi=oe.ECustom(We.typeStr(O)+" cannot be called"),si=new ce(wi,V.pmin,V.pmax,V.origin,V.line);if(!this.isCompletion)throw k.thrown(si);return this.makeMono()}break;case 9:let S=s.cond,W=s.e1,ve=s.e2;this.typeExprWith(S,j.TBool);let de=this.typeExpr(W,t);if(ve==null)return de;let Ce=this.typeExpr(ve,t);if(t==pe.NoValue)return j.TVoid;if(this.tryUnify(Ce,de))return de;if(this.tryUnify(de,Ce))return Ce;this.unify(Ce,de,ve);break;case 10:let Se=s.cond,Ee=s.e;return this.typeExprWith(Se,j.TBool),this.typeExpr(Ee,pe.NoValue),j.TVoid;case 11:let J=s.v,se=s.it,N=s.e,X=this.saveLocals(),rt=this.typeExpr(se,pe.Value),Ve=this.getIteratorType(se,rt);return this.locals.h[J]=Ve,this.typeExpr(N,pe.NoValue),this.locals=X,j.TVoid;case 12:case 13:return j.TVoid;case 14:let Ye=s.args,Ue=s.e,He=s.name,Je=s.ret,$e=null,Be=null,Ne=null;if(this.currentFunType!=null){let ne=this.currentFunType;if(ne._hx_index==13){let ae=ne.args,ke=ne.ret;$e=this.currentFunType,Be=ke,Ne=ae}else throw k.thrown("assert");this.currentFunType=null}else Be=Je==null?this.makeMono():this.makeType(Je,e);let mt=this.saveLocals(),gt=this.allowReturn,Nt=this.allowDefine,ut=this.hasReturn;this.allowReturn=Be,this.allowDefine=!1,this.hasReturn=!1;let Xe=null,kt;if(He!=null){let ne;if(t._hx_index==2){let ae=this.follow(t.t);if(ae._hx_index==13){let ke=ae.args,Ie=ae.ret;ne=!0}else ne=!1}else ne=!1;kt=!ne}else kt=!1;if(kt){let ne=this.events.h[He];ne!=null&&(t=pe.WithType(ne))}if(t._hx_index==2){let ne=this.follow(t.t);if(ne._hx_index==13){let ae=ne.args,ke=ne.ret;Xe=ae,this.unify(Be,ke,e)}}Ne==null&&(Ne=this.typeArgs(Ye,e));let Ct=0,ye=Ne.length;for(;Ct<ye;){let ne=Ct++,ae=Ne[ne];if(Xe!=null)if(ne<Xe.length)this.unify(Xe[ne].t,ae.t,e);else{let ke=oe.ECustom("Extra argument "+ae.name),Ie=new ce(ke,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw k.thrown(Ie)}this.locals.h[ae.name]=ae.t}if(Xe!=null&&Ne.length<Xe.length){let ne="Missing "+(Xe.length-Ne.length)+" arguments (",ae=[],ke=Ne.length,Ie=Xe.length;for(;ke<Ie;){let et=ke++;ae.push(We.typeStr(Xe[et].t))}let Bt=oe.ECustom(ne+ae.join(",")+")"),St=new ce(Bt,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw k.thrown(St)}if(this.typeExpr(Ue,pe.NoValue),!this.hasReturn&&!this.tryUnify(Be,j.TVoid)){let ne=oe.ECustom("Missing return "+We.typeStr(Be)),ae=new ce(ne,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw k.thrown(ae)}return this.allowDefine=Nt,this.allowReturn=gt,this.hasReturn=ut,this.locals=mt,$e==null&&($e=j.TFun(Ne,Be),He!=null&&(mt.h[He]=$e)),$e;case 15:let ht=s.e,fe=ht==null?j.TVoid:this.typeExpr(ht,this.allowReturn==null?pe.Value:pe.WithType(this.allowReturn));if(this.hasReturn=!0,this.allowReturn==null){let ne=oe.ECustom("Return not allowed here"),ae=new ce(ne,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw k.thrown(ae)}else this.unify(fe,this.allowReturn,ht??e);return this.makeMono();case 16:let xe=s.e,tt=s.index;this.typeExprWith(tt,j.TInt);let Ke=this.typeExpr(xe,pe.Value),dt=this.follow(Ke);if(dt._hx_index==9){let ne=dt.c,ae=dt.args,ke=ne.constructor,Ie=ne.fields,Bt=ne.interfaces,St=ne.isInterface,et=ne.meta,wi=ne.params,si=ne.statics,st=ne.superClass;if(ne.name=="Array"){if(ae.length==1)return ae[0];{let Rt=oe.ECustom(We.typeStr(Ke)+" is not an Array"),Mi=new ce(Rt,xe.pmin,xe.pmax,xe.origin,xe.line);if(!this.isCompletion)throw k.thrown(Mi)}}else{let Rt=oe.ECustom(We.typeStr(Ke)+" is not an Array"),Mi=new ce(Rt,xe.pmin,xe.pmax,xe.origin,xe.line);if(!this.isCompletion)throw k.thrown(Mi)}}else{let ne=oe.ECustom(We.typeStr(Ke)+" is not an Array"),ae=new ce(ne,xe.pmin,xe.pmax,xe.origin,xe.line);if(!this.isCompletion)throw k.thrown(ae)}break;case 17:let Ut=s.e,at=null,ei=0;for(;ei<Ut.length;){let ne=Ut[ei];++ei;let ae=this.typeExpr(ne,at==null?pe.Value:pe.WithType(at));at==null?at=ae:this.tryUnify(ae,at)||(this.tryUnify(at,ae)?at=ae:this.unify(ae,at,ne))}return at==null&&(at=this.makeMono()),this.types.getType("Array",[at]);case 18:let Ae=s.cl,Mt=s.params;break;case 19:let Et=s.e;return this.typeExpr(Et,pe.Value),this.makeMono();case 20:let Lt=s.e,ot=s.v,Dt=s.t,qt=s.ecatch,jt=this.typeExpr(Lt,t),ti=this.locals.h[ot],ii=this.locals,Wt=this.makeType(Dt,qt);ii.h[ot]=Wt;let ze=this.typeExpr(qt,t);if(ti!=null)this.locals.h[ot]=ti;else{let ne=this.locals;Object.prototype.hasOwnProperty.call(ne.h,ot)&&delete ne.h[ot]}return t==pe.NoValue?j.TVoid:this.tryUnify(jt,ze)?ze:(this.unify(ze,jt,qt),jt);case 21:let xi=s.fl;if(t._hx_index==2){let ne=this.follow(t.t);if(ne._hx_index==14){let ae=ne.fields;if(ae.length>0){let ke=Object.create(null),Ie=0;for(;Ie<ae.length;){let et=ae[Ie];++Ie,ke[et.name]=et}let Bt=[],St=0;for(;St<xi.length;){let et=xi[St];++St;let wi=ke[et.name],si;if(wi==null){let st=et.e,Rt=oe.ECustom("Extra field "+et.name),Mi=new ce(Rt,st.pmin,st.pmax,st.origin,st.line);if(!this.isCompletion)throw k.thrown(Mi);si=j.TDynamic}else si=wi.t;Bt.push({t:this.typeExprWith(et.e,si),opt:!1,name:et.name})}return j.TAnon(Bt)}else{let ke=[],Ie=0;for(;Ie<xi.length;){let Bt=xi[Ie];++Ie,ke.push({t:this.typeExpr(Bt.e,pe.Value),opt:!1,name:Bt.name})}return j.TAnon(ke)}}else{let ae=[],ke=0;for(;ke<xi.length;){let Ie=xi[ke];++ke,ae.push({t:this.typeExpr(Ie.e,pe.Value),opt:!1,name:Ie.name})}return j.TAnon(ae)}}else{let ne=[],ae=0;for(;ae<xi.length;){let ke=xi[ae];++ae,ne.push({t:this.typeExpr(ke.e,pe.Value),opt:!1,name:ke.name})}return j.TAnon(ne)}break;case 22:let ue=s.cond,Ge=s.e1,it=s.e2;this.typeExprWith(ue,j.TBool);let Ze=this.typeExpr(Ge,t);if(it==null)return Ze;let ct=this.typeExpr(it,t);if(t==pe.NoValue)return j.TVoid;if(this.tryUnify(ct,Ze))return Ze;if(this.tryUnify(Ze,ct))return ct;this.unify(ct,Ze,it);break;case 23:let pt=s.e,yt=s.cases,Kt=s.defaultExpr,_t=null,zs=this.typeExpr(pt,pe.Value),os=0;for(;os<yt.length;){let ne=yt[os];++os;let ae=0,ke=ne.values;for(;ae<ke.length;){let St=ke[ae];++ae;let et=this.typeExpr(St,pe.WithType(zs));this.unify(et,zs,St)}let Ie=this.typeExpr(ne.expr,t),Bt=ne.expr;t!=pe.NoValue&&(_t==null?_t=Ie:i.tryUnify(Ie,_t)||(i.unify(_t,Ie,Bt),_t=Ie))}if(Kt!=null){let ne=this.typeExpr(Kt,t);t!=pe.NoValue&&(_t==null?_t=ne:i.tryUnify(ne,_t)||(i.unify(_t,ne,Kt),_t=ne))}return t==pe.NoValue?j.TVoid:_t??this.makeMono();case 24:let bs=s.cond,en=s.e;return this.typeExprWith(bs,j.TBool),this.typeExpr(en,pe.NoValue),j.TVoid;case 25:let On=s.args,wn=s.name,kn=s.e;return wn==":untyped"&&this.allowUntypedMeta?this.makeMono():this.typeExpr(kn,t);case 26:let un=s.e,yn=s.t,tn=this.makeType(yn,e),bn=this.typeExpr(un,pe.WithType(tn));return this.unify(bn,tn,un),tn}let n=e.e,l=oe.ECustom("Don't know how to type "+Fe[n.__enum__].__constructs__[n._hx_index]._hx_name),r=new ce(l,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw k.thrown(r);return j.TDynamic}getIteratorType(e,t){let i=this.follow(t);if(i._hx_index==9){let r=i.c,h=i.args,a=r.constructor,o=r.fields,c=r.interfaces,p=r.isInterface,f=r.meta,_=r.params,d=r.statics,x=r.superClass;if(r.name=="Array"&&h.length==1)return h[0]}let s=this.getField(t,"iterator",e);if(s==null&&t._hx_index==12){let r=t.a,h=t.args,a=this.apply(r.t,r.params,h);return this.getIteratorType(e,a)}s!=null&&(s==null?s=null:s._hx_index==13&&s.args.length==0?s=s.ret:s=null);let n=this.makeMono(),l=this.makeIterator(n);return this.unify(s??t,l,e),n}static typeStr(e){switch(e._hx_index){case 0:let t=e.r;return t.r==null?"Unknown":We.typeStr(t.r);case 6:return e.name;case 7:return"?"+e.name;case 8:let n=e.t;return"Null<"+We.typeStr(n)+">";case 9:let l=e.c,r=e.args,h=l.name,a;if(r.length==0)a="";else{let H=[],P=0;for(;P<r.length;){let M=r[P];++P,H.push(We.typeStr(M))}a="<"+H.join(",")+">"}return h+a;case 10:let o=e.e,c=e.args,p=o.name,f;if(c.length==0)f="";else{let H=[],P=0;for(;P<c.length;){let M=c[P];++P,H.push(We.typeStr(M))}f="<"+H.join(",")+">"}return p+f;case 11:let _=e.t,d=e.args;if(_.name=="hscript.TypeCheck")return We.typeStr(d[1]);{let H=_.name,P;if(d.length==0)P="";else{let M=[],V=0;for(;V<d.length;){let R=d[V];++V,M.push(We.typeStr(R))}P="<"+M.join(",")+">"}return H+P}break;case 12:let x=e.a,y=e.args,b=x.name,v;if(y.length==0)v="";else{let H=[],P=0;for(;P<y.length;){let M=y[P];++P,H.push(We.typeStr(M))}v="<"+H.join(",")+">"}return b+v;case 13:let T=e.args,E=e.ret,F=[],L=0;for(;L<T.length;){let H=T[L];++L,F.push((H.opt?"?":"")+(H.name==""?"":H.name+":")+We.typeStr(H.t))}return"("+F.join(", ")+") -> "+We.typeStr(E);case 14:let A=e.fields,B=[],I=0;for(;I<A.length;){let H=A[I];++I,B.push((H.opt?"?":"")+H.name+":"+We.typeStr(H.t))}return"{"+B.join(", ")+"}";default:return u.substr(Fe[e.__enum__].__constructs__[e._hx_index]._hx_name,1,null)}}static typeIter(e,t){switch(e._hx_index){case 0:let i=e.r;i.r!=null&&t(i.r);break;case 8:let s=e.t;t(s);break;case 9:let n=e.c,l=e.args,r=0;for(;r<l.length;){let L=l[r];++r,t(L)}break;case 10:let h=e.e,a=e.args,o=0;for(;o<a.length;){let L=a[o];++o,t(L)}break;case 11:let c=e.t,p=e.args,f=0;for(;f<p.length;){let L=p[f];++f,t(L)}break;case 12:let _=e.a,d=e.args,x=0;for(;x<d.length;){let L=d[x];++x,t(L)}break;case 13:let y=e.args,b=e.ret,v=0;for(;v<y.length;){let L=y[v];++v,t(L.t)}t(b);break;case 14:let T=e.fields,E=0;for(;E<T.length;){let L=T[E];++E,t(L.t)}break;case 15:let F=e.f;t(F());break;default:}}}K["hscript.Checker"]=We,We.__name__="hscript.Checker",Object.assign(We.prototype,{__class__:We});var ai=Fe["hscript.Const"]={__ename__:"hscript.Const",__constructs__:null,CInt:(m=function(w){return{_hx_index:0,v:w,__enum__:"hscript.Const",toString:C}},m._hx_name="CInt",m.__params__=["v"],m),CFloat:(m=function(w){return{_hx_index:1,f:w,__enum__:"hscript.Const",toString:C}},m._hx_name="CFloat",m.__params__=["f"],m),CString:(m=function(w){return{_hx_index:2,s:w,__enum__:"hscript.Const",toString:C}},m._hx_name="CString",m.__params__=["s"],m)};ai.__constructs__=[ai.CInt,ai.CFloat,ai.CString];var D=Fe["hscript.ExprDef"]={__ename__:"hscript.ExprDef",__constructs__:null,EConst:(m=function(w){return{_hx_index:0,c:w,__enum__:"hscript.ExprDef",toString:C}},m._hx_name="EConst",m.__params__=["c"],m),EIdent:(m=function(w){return{_hx_index:1,v:w,__enum__:"hscript.ExprDef",toString:C}},m._hx_name="EIdent",m.__params__=["v"],m),EVar:(m=function(w,e,t){return{_hx_index:2,n:w,t:e,e:t,__enum__:"hscript.ExprDef",toString:C}},m._hx_name="EVar",m.__params__=["n","t","e"],m),EParent:(m=function(w){return{_hx_index:3,e:w,__enum__:"hscript.ExprDef",toString:C}},m._hx_name="EParent",m.__params__=["e"],m),EBlock:(m=function(w){return{_hx_index:4,e:w,__enum__:"hscript.ExprDef",toString:C}},m._hx_name="EBlock",m.__params__=["e"],m),EField:(m=function(w,e){return{_hx_index:5,e:w,f:e,__enum__:"hscript.ExprDef",toString:C}},m._hx_name="EField",m.__params__=["e","f"],m),EBinop:(m=function(w,e,t){return{_hx_index:6,op:w,e1:e,e2:t,__enum__:"hscript.ExprDef",toString:C}},m._hx_name="EBinop",m.__params__=["op","e1","e2"],m),EUnop:(m=function(w,e,t){return{_hx_index:7,op:w,prefix:e,e:t,__enum__:"hscript.ExprDef",toString:C}},m._hx_name="EUnop",m.__params__=["op","prefix","e"],m),ECall:(m=function(w,e){return{_hx_index:8,e:w,params:e,__enum__:"hscript.ExprDef",toString:C}},m._hx_name="ECall",m.__params__=["e","params"],m),EIf:(m=function(w,e,t){return{_hx_index:9,cond:w,e1:e,e2:t,__enum__:"hscript.ExprDef",toString:C}},m._hx_name="EIf",m.__params__=["cond","e1","e2"],m),EWhile:(m=function(w,e){return{_hx_index:10,cond:w,e,__enum__:"hscript.ExprDef",toString:C}},m._hx_name="EWhile",m.__params__=["cond","e"],m),EFor:(m=function(w,e,t){return{_hx_index:11,v:w,it:e,e:t,__enum__:"hscript.ExprDef",toString:C}},m._hx_name="EFor",m.__params__=["v","it","e"],m),EBreak:{_hx_name:"EBreak",_hx_index:12,__enum__:"hscript.ExprDef",toString:C},EContinue:{_hx_name:"EContinue",_hx_index:13,__enum__:"hscript.ExprDef",toString:C},EFunction:(m=function(w,e,t,i){return{_hx_index:14,args:w,e,name:t,ret:i,__enum__:"hscript.ExprDef",toString:C}},m._hx_name="EFunction",m.__params__=["args","e","name","ret"],m),EReturn:(m=function(w){return{_hx_index:15,e:w,__enum__:"hscript.ExprDef",toString:C}},m._hx_name="EReturn",m.__params__=["e"],m),EArray:(m=function(w,e){return{_hx_index:16,e:w,index:e,__enum__:"hscript.ExprDef",toString:C}},m._hx_name="EArray",m.__params__=["e","index"],m),EArrayDecl:(m=function(w){return{_hx_index:17,e:w,__enum__:"hscript.ExprDef",toString:C}},m._hx_name="EArrayDecl",m.__params__=["e"],m),ENew:(m=function(w,e){return{_hx_index:18,cl:w,params:e,__enum__:"hscript.ExprDef",toString:C}},m._hx_name="ENew",m.__params__=["cl","params"],m),EThrow:(m=function(w){return{_hx_index:19,e:w,__enum__:"hscript.ExprDef",toString:C}},m._hx_name="EThrow",m.__params__=["e"],m),ETry:(m=function(w,e,t,i){return{_hx_index:20,e:w,v:e,t,ecatch:i,__enum__:"hscript.ExprDef",toString:C}},m._hx_name="ETry",m.__params__=["e","v","t","ecatch"],m),EObject:(m=function(w){return{_hx_index:21,fl:w,__enum__:"hscript.ExprDef",toString:C}},m._hx_name="EObject",m.__params__=["fl"],m),ETernary:(m=function(w,e,t){return{_hx_index:22,cond:w,e1:e,e2:t,__enum__:"hscript.ExprDef",toString:C}},m._hx_name="ETernary",m.__params__=["cond","e1","e2"],m),ESwitch:(m=function(w,e,t){return{_hx_index:23,e:w,cases:e,defaultExpr:t,__enum__:"hscript.ExprDef",toString:C}},m._hx_name="ESwitch",m.__params__=["e","cases","defaultExpr"],m),EDoWhile:(m=function(w,e){return{_hx_index:24,cond:w,e,__enum__:"hscript.ExprDef",toString:C}},m._hx_name="EDoWhile",m.__params__=["cond","e"],m),EMeta:(m=function(w,e,t){return{_hx_index:25,name:w,args:e,e:t,__enum__:"hscript.ExprDef",toString:C}},m._hx_name="EMeta",m.__params__=["name","args","e"],m),ECheckType:(m=function(w,e){return{_hx_index:26,e:w,t:e,__enum__:"hscript.ExprDef",toString:C}},m._hx_name="ECheckType",m.__params__=["e","t"],m)};D.__constructs__=[D.EConst,D.EIdent,D.EVar,D.EParent,D.EBlock,D.EField,D.EBinop,D.EUnop,D.ECall,D.EIf,D.EWhile,D.EFor,D.EBreak,D.EContinue,D.EFunction,D.EReturn,D.EArray,D.EArrayDecl,D.ENew,D.EThrow,D.ETry,D.EObject,D.ETernary,D.ESwitch,D.EDoWhile,D.EMeta,D.ECheckType];var Ht=Fe["hscript.CType"]={__ename__:"hscript.CType",__constructs__:null,CTPath:(m=function(w,e){return{_hx_index:0,path:w,params:e,__enum__:"hscript.CType",toString:C}},m._hx_name="CTPath",m.__params__=["path","params"],m),CTFun:(m=function(w,e){return{_hx_index:1,args:w,ret:e,__enum__:"hscript.CType",toString:C}},m._hx_name="CTFun",m.__params__=["args","ret"],m),CTAnon:(m=function(w){return{_hx_index:2,fields:w,__enum__:"hscript.CType",toString:C}},m._hx_name="CTAnon",m.__params__=["fields"],m),CTParent:(m=function(w){return{_hx_index:3,t:w,__enum__:"hscript.CType",toString:C}},m._hx_name="CTParent",m.__params__=["t"],m),CTOpt:(m=function(w){return{_hx_index:4,t:w,__enum__:"hscript.CType",toString:C}},m._hx_name="CTOpt",m.__params__=["t"],m),CTNamed:(m=function(w,e){return{_hx_index:5,n:w,t:e,__enum__:"hscript.CType",toString:C}},m._hx_name="CTNamed",m.__params__=["n","t"],m)};Ht.__constructs__=[Ht.CTPath,Ht.CTFun,Ht.CTAnon,Ht.CTParent,Ht.CTOpt,Ht.CTNamed];class ce{constructor(e,t,i,s,n){this.e=e,this.pmin=t,this.pmax=i,this.origin=s,this.line=n}toString(){return ns.errorToString(this)}}K["hscript.Error"]=ce,ce.__name__="hscript.Error",Object.assign(ce.prototype,{__class__:ce});var oe=Fe["hscript.ErrorDef"]={__ename__:"hscript.ErrorDef",__constructs__:null,EInvalidChar:(m=function(w){return{_hx_index:0,c:w,__enum__:"hscript.ErrorDef",toString:C}},m._hx_name="EInvalidChar",m.__params__=["c"],m),EUnexpected:(m=function(w){return{_hx_index:1,s:w,__enum__:"hscript.ErrorDef",toString:C}},m._hx_name="EUnexpected",m.__params__=["s"],m),EUnterminatedString:{_hx_name:"EUnterminatedString",_hx_index:2,__enum__:"hscript.ErrorDef",toString:C},EUnterminatedComment:{_hx_name:"EUnterminatedComment",_hx_index:3,__enum__:"hscript.ErrorDef",toString:C},EInvalidPreprocessor:(m=function(w){return{_hx_index:4,msg:w,__enum__:"hscript.ErrorDef",toString:C}},m._hx_name="EInvalidPreprocessor",m.__params__=["msg"],m),EUnknownVariable:(m=function(w){return{_hx_index:5,v:w,__enum__:"hscript.ErrorDef",toString:C}},m._hx_name="EUnknownVariable",m.__params__=["v"],m),EInvalidIterator:(m=function(w){return{_hx_index:6,v:w,__enum__:"hscript.ErrorDef",toString:C}},m._hx_name="EInvalidIterator",m.__params__=["v"],m),EInvalidOp:(m=function(w){return{_hx_index:7,op:w,__enum__:"hscript.ErrorDef",toString:C}},m._hx_name="EInvalidOp",m.__params__=["op"],m),EInvalidAccess:(m=function(w){return{_hx_index:8,f:w,__enum__:"hscript.ErrorDef",toString:C}},m._hx_name="EInvalidAccess",m.__params__=["f"],m),ECustom:(m=function(w){return{_hx_index:9,msg:w,__enum__:"hscript.ErrorDef",toString:C}},m._hx_name="ECustom",m.__params__=["msg"],m)};oe.__constructs__=[oe.EInvalidChar,oe.EUnexpected,oe.EUnterminatedString,oe.EUnterminatedComment,oe.EInvalidPreprocessor,oe.EUnknownVariable,oe.EInvalidIterator,oe.EInvalidOp,oe.EInvalidAccess,oe.ECustom];var Ui=Fe["hscript.ModuleDecl"]={__ename__:"hscript.ModuleDecl",__constructs__:null,DPackage:(m=function(w){return{_hx_index:0,path:w,__enum__:"hscript.ModuleDecl",toString:C}},m._hx_name="DPackage",m.__params__=["path"],m),DImport:(m=function(w,e){return{_hx_index:1,path:w,everything:e,__enum__:"hscript.ModuleDecl",toString:C}},m._hx_name="DImport",m.__params__=["path","everything"],m),DClass:(m=function(w){return{_hx_index:2,c:w,__enum__:"hscript.ModuleDecl",toString:C}},m._hx_name="DClass",m.__params__=["c"],m),DTypedef:(m=function(w){return{_hx_index:3,c:w,__enum__:"hscript.ModuleDecl",toString:C}},m._hx_name="DTypedef",m.__params__=["c"],m)};Ui.__constructs__=[Ui.DPackage,Ui.DImport,Ui.DClass,Ui.DTypedef];var Ti=Fe["hscript.FieldAccess"]={__ename__:"hscript.FieldAccess",__constructs__:null,APublic:{_hx_name:"APublic",_hx_index:0,__enum__:"hscript.FieldAccess",toString:C},APrivate:{_hx_name:"APrivate",_hx_index:1,__enum__:"hscript.FieldAccess",toString:C},AInline:{_hx_name:"AInline",_hx_index:2,__enum__:"hscript.FieldAccess",toString:C},AOverride:{_hx_name:"AOverride",_hx_index:3,__enum__:"hscript.FieldAccess",toString:C},AStatic:{_hx_name:"AStatic",_hx_index:4,__enum__:"hscript.FieldAccess",toString:C},AMacro:{_hx_name:"AMacro",_hx_index:5,__enum__:"hscript.FieldAccess",toString:C}};Ti.__constructs__=[Ti.APublic,Ti.APrivate,Ti.AInline,Ti.AOverride,Ti.AStatic,Ti.AMacro];var Ps=Fe["hscript.FieldKind"]={__ename__:"hscript.FieldKind",__constructs__:null,KFunction:(m=function(w){return{_hx_index:0,f:w,__enum__:"hscript.FieldKind",toString:C}},m._hx_name="KFunction",m.__params__=["f"],m),KVar:(m=function(w){return{_hx_index:1,v:w,__enum__:"hscript.FieldKind",toString:C}},m._hx_name="KVar",m.__params__=["v"],m)};Ps.__constructs__=[Ps.KFunction,Ps.KVar];var U=Fe["hscript.Token"]={__ename__:"hscript.Token",__constructs__:null,TEof:{_hx_name:"TEof",_hx_index:0,__enum__:"hscript.Token",toString:C},TConst:(m=function(w){return{_hx_index:1,c:w,__enum__:"hscript.Token",toString:C}},m._hx_name="TConst",m.__params__=["c"],m),TId:(m=function(w){return{_hx_index:2,s:w,__enum__:"hscript.Token",toString:C}},m._hx_name="TId",m.__params__=["s"],m),TOp:(m=function(w){return{_hx_index:3,s:w,__enum__:"hscript.Token",toString:C}},m._hx_name="TOp",m.__params__=["s"],m),TPOpen:{_hx_name:"TPOpen",_hx_index:4,__enum__:"hscript.Token",toString:C},TPClose:{_hx_name:"TPClose",_hx_index:5,__enum__:"hscript.Token",toString:C},TBrOpen:{_hx_name:"TBrOpen",_hx_index:6,__enum__:"hscript.Token",toString:C},TBrClose:{_hx_name:"TBrClose",_hx_index:7,__enum__:"hscript.Token",toString:C},TDot:{_hx_name:"TDot",_hx_index:8,__enum__:"hscript.Token",toString:C},TQuestionDot:{_hx_name:"TQuestionDot",_hx_index:9,__enum__:"hscript.Token",toString:C},TComma:{_hx_name:"TComma",_hx_index:10,__enum__:"hscript.Token",toString:C},TSemicolon:{_hx_name:"TSemicolon",_hx_index:11,__enum__:"hscript.Token",toString:C},TBkOpen:{_hx_name:"TBkOpen",_hx_index:12,__enum__:"hscript.Token",toString:C},TBkClose:{_hx_name:"TBkClose",_hx_index:13,__enum__:"hscript.Token",toString:C},TQuestion:{_hx_name:"TQuestion",_hx_index:14,__enum__:"hscript.Token",toString:C},TDoubleDot:{_hx_name:"TDoubleDot",_hx_index:15,__enum__:"hscript.Token",toString:C},TMeta:(m=function(w){return{_hx_index:16,s:w,__enum__:"hscript.Token",toString:C}},m._hx_name="TMeta",m.__params__=["s"],m),TPrepro:(m=function(w){return{_hx_index:17,s:w,__enum__:"hscript.Token",toString:C}},m._hx_name="TPrepro",m.__params__=["s"],m)};U.__constructs__=[U.TEof,U.TConst,U.TId,U.TOp,U.TPOpen,U.TPClose,U.TBrOpen,U.TBrClose,U.TDot,U.TQuestionDot,U.TComma,U.TSemicolon,U.TBkOpen,U.TBkClose,U.TQuestion,U.TDoubleDot,U.TMeta,U.TPrepro];class Yi{constructor(){this.uid=0,this.preprocesorValues=new me,this.line=1,this.opChars="+*/-=!><&|^%~",this.identChars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_";let e=[["%"],["*","/"],["+","-"],["<<",">>",">>>"],["|","&","^"],["==","!=",">","<",">=","<="],["..."],["&&"],["||"],["=","+=","-=","*=","/=","%=","<<=",">>=",">>>=","|=","&=","^=","=>"],["->"]];this.opPriority=new me,this.opRightAssoc=new me;let t=0,i=e.length;for(;t<i;){let h=t++,a=0,o=e[h];for(;a<o.length;){let c=o[a];++a,this.opPriority.h[c]=h,h==9&&(this.opRightAssoc.h[c]=!0)}}let s="!";this.opPriority.h[s]=s=="++"||s=="--"?-1:-2;let n="++";this.opPriority.h[n]=n=="++"||n=="--"?-1:-2;let l="--";this.opPriority.h[l]=l=="++"||l=="--"?-1:-2;let r="~";this.opPriority.h[r]=r=="++"||r=="--"?-1:-2}get_currentPos(){return this.readPos+this.offset}error(e,t,i){if(!this.resumeErrors)throw k.thrown(new ce(e,t,i,this.origin,this.line))}invalidChar(e){if(!this.resumeErrors)throw k.thrown(new ce(oe.EInvalidChar(e),this.readPos-1,this.readPos-1,this.origin,this.line))}initParser(e,t){this.preprocStack=[],this.origin=e,this.readPos=0,this.tokenMin=this.oldTokenMin=t,this.tokenMax=this.oldTokenMax=t,this.tokens=new Ss,this.offset=t,this.char=-1,this.ops=[],this.idents=[],this.uid=0;let i=0,s=this.opChars.length;for(;i<s;){let r=i++;this.ops[u.cca(this.opChars,r)]=!0}let n=0,l=this.identChars.length;for(;n<l;){let r=n++;this.idents[u.cca(this.identChars,r)]=!0}}parseString(e,t,i){i==null&&(i=0),t==null&&(t="hscript"),this.initParser(t,i),this.input=e,this.readPos=0;let s=[];for(;;){let n=this.token();if(n==U.TEof)break;this.tokens.push({t:n,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,this.parseFullExpr(s)}if(s.length==1)return s[0];{let n=D.EBlock(s),l=0,r=null;return n==null?null:(l==null&&(l=this.tokenMin),r==null&&(r=this.tokenMax),{e:n,pmin:l,pmax:r,origin:this.origin,line:this.line})}}unexpected(e){let t=oe.EUnexpected(this.tokenString(e));if(!this.resumeErrors)throw k.thrown(new ce(t,this.tokenMin,this.tokenMax,this.origin,this.line));return null}push(e){this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax}ensure(e){let t=this.token();t!=e&&this.unexpected(t)}ensureToken(e){let t=this.token();re.enumEq(t,e)||this.unexpected(t)}maybe(e){let t=this.token();return re.enumEq(t,e)?!0:(this.tokens.push({t,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,!1)}getIdent(){let e=this.token();return e._hx_index==2?e.s:(this.unexpected(e),null)}expr(e){return e.e}pmin(e){return e==null?0:e.pmin}pmax(e){return e==null?0:e.pmax}mk(e,t,i){return e==null?null:(t==null&&(t=this.tokenMin),i==null&&(i=this.tokenMax),{e,pmin:t,pmax:i,origin:this.origin,line:this.line})}isBlock(e){if(e==null)return!1;let t=e.e;switch(t._hx_index){case 2:let i=t.n,s=t.t,n=t.e;if(n!=null)return this.isBlock(n);if(s!=null){if(s==null)return!1;if(s._hx_index==2){let ve=s.fields;return!0}else return!1}else return!1;break;case 4:let l=t.e;return!0;case 6:let r=t.op,h=t.e1,a=t.e2;return this.isBlock(a);case 7:let o=t.op,c=t.prefix,p=t.e;return c?!1:this.isBlock(p);case 9:let f=t.cond,_=t.e1,d=t.e2;return d!=null?this.isBlock(d):this.isBlock(_);case 10:let x=t.cond,y=t.e;return this.isBlock(y);case 11:let b=t.v,v=t.it,T=t.e;return this.isBlock(T);case 14:let E=t.args,F=t.name,L=t.ret,A=t.e;return this.isBlock(A);case 15:let B=t.e;return B!=null?this.isBlock(B):!1;case 20:let I=t.e,H=t.v,P=t.t,M=t.ecatch;return this.isBlock(M);case 21:let V=t.fl;return!0;case 23:let R=t.e,Y=t.cases,$=t.defaultExpr;return!0;case 24:let te=t.cond,O=t.e;return this.isBlock(O);case 25:let q=t.name,S=t.args,W=t.e;return this.isBlock(W);default:return!1}}parseFullExpr(e){let t=this.parseExpr();e.push(t);let i=this.token();for(;;){let s;if(i==U.TComma&&t!=null){let n=t.e;if(n._hx_index==2){let l=n.n,r=n.t,h=n.e;s=!0}else s=!1}else s=!1;if(!s)break;t=this.parseStructure("var"),e.push(t),i=this.token()}i!=U.TSemicolon&&i!=U.TEof&&(this.isBlock(t)?(this.tokens.push({t:i,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax):this.unexpected(i))}parseObject(e){let t=[];e:for(;;){let r=this.token(),h=null;switch(r._hx_index){case 1:let o=r.c;this.allowJSON||this.unexpected(r),o._hx_index==2?h=o.s:this.unexpected(r);break;case 2:h=r.s;break;case 7:break e;default:this.unexpected(r);break e}let a=this.token();switch(a!=U.TDoubleDot&&this.unexpected(a),t.push({name:h,e:this.parseExpr()}),r=this.token(),r._hx_index){case 7:break e;case 10:break;default:this.unexpected(r)}}let i=D.EObject(t),s=e,n=null,l;return i==null?l=null:(s==null&&(s=this.tokenMin),n==null&&(n=this.tokenMax),l={e:i,pmin:s,pmax:n,origin:this.origin,line:this.line}),this.parseExprNext(l)}parseExpr(){let e=this.token(),t=this.tokenMin;switch(e._hx_index){case 1:let i=e.c,s=D.EConst(i),n=null,l=null,r;return s==null?r=null:(n==null&&(n=this.tokenMin),l==null&&(l=this.tokenMax),r={e:s,pmin:n,pmax:l,origin:this.origin,line:this.line}),this.parseExprNext(r);case 2:let h=e.s,a=this.parseStructure(h);if(a==null){let L=D.EIdent(h),A=null,B=null;L==null?a=null:(A==null&&(A=this.tokenMin),B==null&&(B=this.tokenMax),a={e:L,pmin:A,pmax:B,origin:this.origin,line:this.line})}return this.parseExprNext(a);case 3:let o=e.s;if(o=="-"){let L=this.tokenMin,A=this.parseExpr();if(A==null)return this.makeUnop(o,A);let B=A.e;if(B._hx_index==0){let I=B.c;switch(I._hx_index){case 0:let H=I.v,P=D.EConst(ai.CInt(-H)),M=L,V=A==null?0:A.pmax;return P==null?null:(M==null&&(M=this.tokenMin),V==null&&(V=this.tokenMax),{e:P,pmin:M,pmax:V,origin:this.origin,line:this.line});case 1:let R=I.f,Y=D.EConst(ai.CFloat(-R)),$=L,te=A==null?0:A.pmax;return Y==null?null:($==null&&($=this.tokenMin),te==null&&(te=this.tokenMax),{e:Y,pmin:$,pmax:te,origin:this.origin,line:this.line});default:return this.makeUnop(o,A)}}else return this.makeUnop(o,A)}return this.opPriority.h[o]<0?this.makeUnop(o,this.parseExpr()):this.unexpected(e);case 4:if(e=this.token(),e==U.TPClose){let L=this.token();re.enumEq(L,U.TOp("->"))||this.unexpected(L);let A=this.parseExpr(),B=D.EReturn(A),I=t,H=null,P;B==null?P=null:(I==null&&(I=this.tokenMin),H==null&&(H=this.tokenMax),P={e:B,pmin:I,pmax:H,origin:this.origin,line:this.line});let M=D.EFunction([],P),V=t,R=null;return M==null?null:(V==null&&(V=this.tokenMin),R==null&&(R=this.tokenMax),{e:M,pmin:V,pmax:R,origin:this.origin,line:this.line})}this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;let c=this.parseExpr();switch(e=this.token(),e._hx_index){case 5:let L=D.EParent(c),A=t,B=this.tokenMax,I;return L==null?I=null:(A==null&&(A=this.tokenMin),B==null&&(B=this.tokenMax),I={e:L,pmin:A,pmax:B,origin:this.origin,line:this.line}),this.parseExprNext(I);case 10:let H=c.e;if(H._hx_index==1){let M=H.v;return this.parseLambda([{name:M}],c==null?0:c.pmin)}break;case 15:let P=this.parseType();switch(e=this.token(),e._hx_index){case 5:let M=D.ECheckType(c,P),V=t,R=this.tokenMax,Y;return M==null?Y=null:(V==null&&(V=this.tokenMin),R==null&&(R=this.tokenMax),Y={e:M,pmin:V,pmax:R,origin:this.origin,line:this.line}),this.parseExprNext(Y);case 10:let $=c.e;if($._hx_index==1){let te=$.v;return this.parseLambda([{name:te,t:P}],c==null?0:c.pmin)}break;default:}break;default:}return this.unexpected(e);case 6:switch(e=this.token(),e._hx_index){case 1:let L=e.c;if(this.allowJSON)if(L._hx_index==2){let V=L.s,R=this.token();if(this.tokens.push({t:R,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,R._hx_index==15)return this.parseExprNext(this.parseObject(t))}else this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;else this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break;case 2:let A=e.s,B=this.token();if(this.tokens.push({t:B,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,B._hx_index==15)return this.parseExprNext(this.parseObject(t));break;case 7:let I=D.EObject([]),H=t,P=null,M;return I==null?M=null:(H==null&&(H=this.tokenMin),P==null&&(P=this.tokenMax),M={e:I,pmin:H,pmax:P,origin:this.origin,line:this.line}),this.parseExprNext(M);default:this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax}let p=[];for(;this.parseFullExpr(p),e=this.token(),!(e==U.TBrClose||this.resumeErrors&&e==U.TEof);)this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;let f=D.EBlock(p),_=t,d=null;return f==null?null:(_==null&&(_=this.tokenMin),d==null&&(d=this.tokenMax),{e:f,pmin:_,pmax:d,origin:this.origin,line:this.line});case 12:let x=[];e=this.token();let y=!0;for(;e!=U.TBkClose&&(!this.resumeErrors||e!=U.TEof);)y||(e!=U.TComma?this.unexpected(e):e=this.token()),y=!1,this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,x.push(this.parseExpr()),e=this.token();if(x.length==1&&x[0]!=null){let L=x[0].e;switch(L._hx_index){case 10:let A=L.cond,B=L.e,I="__a_"+this.uid++,H=D.EArrayDecl([]),P=t,M=null,V;H==null?V=null:(P==null&&(P=this.tokenMin),M==null&&(M=this.tokenMax),V={e:H,pmin:P,pmax:M,origin:this.origin,line:this.line});let R=D.EVar(I,null,V),Y=t,$=null,te;R==null?te=null:(Y==null&&(Y=this.tokenMin),$==null&&($=this.tokenMax),te={e:R,pmin:Y,pmax:$,origin:this.origin,line:this.line});let O=this.mapCompr(I,x[0]),q=D.EIdent(I),S=t,W=null,ve;q==null?ve=null:(S==null&&(S=this.tokenMin),W==null&&(W=this.tokenMax),ve={e:q,pmin:S,pmax:W,origin:this.origin,line:this.line});let de=D.EBlock([te,O,ve]),Ce=t,Se=null,Ee;return de==null?Ee=null:(Ce==null&&(Ce=this.tokenMin),Se==null&&(Se=this.tokenMax),Ee={e:de,pmin:Ce,pmax:Se,origin:this.origin,line:this.line}),this.parseExprNext(Ee);case 11:let J=L.v,se=L.it,N=L.e,X="__a_"+this.uid++,rt=D.EArrayDecl([]),Ve=t,Ye=null,Ue;rt==null?Ue=null:(Ve==null&&(Ve=this.tokenMin),Ye==null&&(Ye=this.tokenMax),Ue={e:rt,pmin:Ve,pmax:Ye,origin:this.origin,line:this.line});let He=D.EVar(X,null,Ue),Je=t,$e=null,Be;He==null?Be=null:(Je==null&&(Je=this.tokenMin),$e==null&&($e=this.tokenMax),Be={e:He,pmin:Je,pmax:$e,origin:this.origin,line:this.line});let Ne=this.mapCompr(X,x[0]),mt=D.EIdent(X),gt=t,Nt=null,ut;mt==null?ut=null:(gt==null&&(gt=this.tokenMin),Nt==null&&(Nt=this.tokenMax),ut={e:mt,pmin:gt,pmax:Nt,origin:this.origin,line:this.line});let Xe=D.EBlock([Be,Ne,ut]),kt=t,Ct=null,ye;return Xe==null?ye=null:(kt==null&&(kt=this.tokenMin),Ct==null&&(Ct=this.tokenMax),ye={e:Xe,pmin:kt,pmax:Ct,origin:this.origin,line:this.line}),this.parseExprNext(ye);case 24:let ht=L.cond,fe=L.e,xe="__a_"+this.uid++,tt=D.EArrayDecl([]),Ke=t,dt=null,Ut;tt==null?Ut=null:(Ke==null&&(Ke=this.tokenMin),dt==null&&(dt=this.tokenMax),Ut={e:tt,pmin:Ke,pmax:dt,origin:this.origin,line:this.line});let at=D.EVar(xe,null,Ut),ei=t,Ae=null,Mt;at==null?Mt=null:(ei==null&&(ei=this.tokenMin),Ae==null&&(Ae=this.tokenMax),Mt={e:at,pmin:ei,pmax:Ae,origin:this.origin,line:this.line});let Et=this.mapCompr(xe,x[0]),Lt=D.EIdent(xe),ot=t,Dt=null,qt;Lt==null?qt=null:(ot==null&&(ot=this.tokenMin),Dt==null&&(Dt=this.tokenMax),qt={e:Lt,pmin:ot,pmax:Dt,origin:this.origin,line:this.line});let jt=D.EBlock([Mt,Et,qt]),ti=t,ii=null,Wt;return jt==null?Wt=null:(ti==null&&(ti=this.tokenMin),ii==null&&(ii=this.tokenMax),Wt={e:jt,pmin:ti,pmax:ii,origin:this.origin,line:this.line}),this.parseExprNext(Wt);default:}}let b=D.EArrayDecl(x),v=t,T=null,E;return b==null?E=null:(v==null&&(v=this.tokenMin),T==null&&(T=this.tokenMax),E={e:b,pmin:v,pmax:T,origin:this.origin,line:this.line}),this.parseExprNext(E);case 16:let F=e.s;if(this.allowMetadata){let L=this.parseMetaArgs(),A=D.EMeta(F,L,this.parseExpr()),B=t,I=null;return A==null?null:(B==null&&(B=this.tokenMin),I==null&&(I=this.tokenMax),{e:A,pmin:B,pmax:I,origin:this.origin,line:this.line})}else return this.unexpected(e);break;default:return this.unexpected(e)}}parseLambda(e,t){e:for(;;){let p=this.getIdent(),f=this.maybe(U.TDoubleDot)?this.parseType():null;e.push({name:p,t:f});let _=this.token();switch(_._hx_index){case 5:break e;case 10:break;default:this.unexpected(_);break e}}let i=this.token();re.enumEq(i,U.TOp("->"))||this.unexpected(i);let s=this.parseExpr(),n=D.EReturn(s),l=t,r=null,h;n==null?h=null:(l==null&&(l=this.tokenMin),r==null&&(r=this.tokenMax),h={e:n,pmin:l,pmax:r,origin:this.origin,line:this.line});let a=D.EFunction(e,h),o=t,c=null;return a==null?null:(o==null&&(o=this.tokenMin),c==null&&(c=this.tokenMax),{e:a,pmin:o,pmax:c,origin:this.origin,line:this.line})}parseMetaArgs(){let e=this.token();if(e!=U.TPOpen)return this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,null;let t=[];if(e=this.token(),e!=U.TPClose){this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;e:for(;;){t.push(this.parseExpr());let i=this.token();switch(i._hx_index){case 5:break e;case 10:break;default:let s=i;this.unexpected(s)}}}return t}mapCompr(e,t){if(t==null)return null;let i,s=t.e;switch(s._hx_index){case 3:let r=s.e;i=D.EParent(this.mapCompr(e,r));break;case 4:let h=s.e;if(h.length==1){let H=h[0];i=D.EBlock([this.mapCompr(e,H)])}else{let H=D.EIdent(e),P=t==null?0:t.pmin,M=t==null?0:t.pmax,V;H==null?V=null:(P==null&&(P=this.tokenMin),M==null&&(M=this.tokenMax),V={e:H,pmin:P,pmax:M,origin:this.origin,line:this.line});let R=D.EField(V,"push"),Y=t==null?0:t.pmin,$=t==null?0:t.pmax,te;R==null?te=null:(Y==null&&(Y=this.tokenMin),$==null&&($=this.tokenMax),te={e:R,pmin:Y,pmax:$,origin:this.origin,line:this.line}),i=D.ECall(te,[t])}break;case 9:let a=s.cond,o=s.e1;if(s.e2==null)i=D.EIf(a,this.mapCompr(e,o),null);else{let H=D.EIdent(e),P=t==null?0:t.pmin,M=t==null?0:t.pmax,V;H==null?V=null:(P==null&&(P=this.tokenMin),M==null&&(M=this.tokenMax),V={e:H,pmin:P,pmax:M,origin:this.origin,line:this.line});let R=D.EField(V,"push"),Y=t==null?0:t.pmin,$=t==null?0:t.pmax,te;R==null?te=null:(Y==null&&(Y=this.tokenMin),$==null&&($=this.tokenMax),te={e:R,pmin:Y,pmax:$,origin:this.origin,line:this.line}),i=D.ECall(te,[t])}break;case 10:let p=s.cond,f=s.e;i=D.EWhile(p,this.mapCompr(e,f));break;case 11:let _=s.v,d=s.it,x=s.e;i=D.EFor(_,d,this.mapCompr(e,x));break;case 24:let y=s.cond,b=s.e;i=D.EDoWhile(y,this.mapCompr(e,b));break;default:let v=D.EIdent(e),T=t==null?0:t.pmin,E=t==null?0:t.pmax,F;v==null?F=null:(T==null&&(T=this.tokenMin),E==null&&(E=this.tokenMax),F={e:v,pmin:T,pmax:E,origin:this.origin,line:this.line});let L=D.EField(F,"push"),A=t==null?0:t.pmin,B=t==null?0:t.pmax,I;L==null?I=null:(A==null&&(A=this.tokenMin),B==null&&(B=this.tokenMax),I={e:L,pmin:A,pmax:B,origin:this.origin,line:this.line}),i=D.ECall(I,[t])}let n=t==null?0:t.pmin,l=t==null?0:t.pmax;return i==null?null:(n==null&&(n=this.tokenMin),l==null&&(l=this.tokenMax),{e:i,pmin:n,pmax:l,origin:this.origin,line:this.line})}makeUnop(e,t){if(t==null&&this.resumeErrors)return null;let i=t.e;switch(i._hx_index){case 6:let s=i.op,n=i.e1,l=i.e2,r=D.EBinop(s,this.makeUnop(e,n),l),h=n==null?0:n.pmin,a=l==null?0:l.pmax;return r==null?null:(h==null&&(h=this.tokenMin),a==null&&(a=this.tokenMax),{e:r,pmin:h,pmax:a,origin:this.origin,line:this.line});case 22:let o=i.cond,c=i.e1,p=i.e2,f=D.ETernary(this.makeUnop(e,o),c,p),_=o==null?0:o.pmin,d=p==null?0:p.pmax;return f==null?null:(_==null&&(_=this.tokenMin),d==null&&(d=this.tokenMax),{e:f,pmin:_,pmax:d,origin:this.origin,line:this.line});default:let x=D.EUnop(e,!0,t),y=t==null?0:t.pmin,b=t==null?0:t.pmax;return x==null?null:(y==null&&(y=this.tokenMin),b==null&&(b=this.tokenMax),{e:x,pmin:y,pmax:b,origin:this.origin,line:this.line})}}makeBinop(e,t,i){if(i==null&&this.resumeErrors){let n=D.EBinop(e,t,i),l=t==null?0:t.pmin,r=t==null?0:t.pmax;return n==null?null:(l==null&&(l=this.tokenMin),r==null&&(r=this.tokenMax),{e:n,pmin:l,pmax:r,origin:this.origin,line:this.line})}let s=i.e;switch(s._hx_index){case 6:let n=s.op,l=s.e1,r=s.e2;if(this.opPriority.h[e]<=this.opPriority.h[n]&&!Object.prototype.hasOwnProperty.call(this.opRightAssoc.h,e)){let _=D.EBinop(n,this.makeBinop(e,t,l),r),d=t==null?0:t.pmin,x=r==null?0:r.pmax;return _==null?null:(d==null&&(d=this.tokenMin),x==null&&(x=this.tokenMax),{e:_,pmin:d,pmax:x,origin:this.origin,line:this.line})}else{let _=D.EBinop(e,t,i),d=t==null?0:t.pmin,x=i==null?0:i.pmax;return _==null?null:(d==null&&(d=this.tokenMin),x==null&&(x=this.tokenMax),{e:_,pmin:d,pmax:x,origin:this.origin,line:this.line})}break;case 22:let h=s.cond,a=s.e1,o=s.e2;if(Object.prototype.hasOwnProperty.call(this.opRightAssoc.h,e)){let _=D.EBinop(e,t,i),d=t==null?0:t.pmin,x=i==null?0:i.pmax;return _==null?null:(d==null&&(d=this.tokenMin),x==null&&(x=this.tokenMax),{e:_,pmin:d,pmax:x,origin:this.origin,line:this.line})}else{let _=D.ETernary(this.makeBinop(e,t,h),a,o),d=t==null?0:t.pmin,x=i==null?0:i.pmax;return _==null?null:(d==null&&(d=this.tokenMin),x==null&&(x=this.tokenMax),{e:_,pmin:d,pmax:x,origin:this.origin,line:this.line})}break;default:let c=D.EBinop(e,t,i),p=t==null?0:t.pmin,f=i==null?0:i.pmax;return c==null?null:(p==null&&(p=this.tokenMin),f==null&&(f=this.tokenMax),{e:c,pmin:p,pmax:f,origin:this.origin,line:this.line})}}parseStructure(e){let t=this.tokenMin;switch(e){case"break":let i=D.EBreak,s=null,n=null;return i==null?null:(s==null&&(s=this.tokenMin),n==null&&(n=this.tokenMax),{e:i,pmin:s,pmax:n,origin:this.origin,line:this.line});case"continue":let l=D.EContinue,r=null,h=null;return l==null?null:(r==null&&(r=this.tokenMin),h==null&&(h=this.tokenMax),{e:l,pmin:r,pmax:h,origin:this.origin,line:this.line});case"do":let a=this.parseExpr(),o=this.token();o._hx_index==2?o.s!="while"&&this.unexpected(o):this.unexpected(o);let c=this.parseExpr(),p=D.EDoWhile(c,a),f=t,_=c==null?0:c.pmax;return p==null?null:(f==null&&(f=this.tokenMin),_==null&&(_=this.tokenMax),{e:p,pmin:f,pmax:_,origin:this.origin,line:this.line});case"else":return this.unexpected(U.TId(e));case"for":let d=this.token();d!=U.TPOpen&&this.unexpected(d);let x=this.getIdent(),y=this.token();re.enumEq(y,U.TId("in"))||this.unexpected(y);let b=this.parseExpr(),v=this.token();v!=U.TPClose&&this.unexpected(v);let T=this.parseExpr(),E=D.EFor(x,b,T),F=t,L=T==null?0:T.pmax;return E==null?null:(F==null&&(F=this.tokenMin),L==null&&(L=this.tokenMax),{e:E,pmin:F,pmax:L,origin:this.origin,line:this.line});case"function":let A=this.token(),B=null;A._hx_index==2?B=A.s:(this.tokens.push({t:A,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax);let I=this.parseFunctionDecl(),H=D.EFunction(I.args,I.body,B,I.ret),P=t,M=I.body,V=M==null?0:M.pmax;return H==null?null:(P==null&&(P=this.tokenMin),V==null&&(V=this.tokenMax),{e:H,pmin:P,pmax:V,origin:this.origin,line:this.line});case"if":let R=this.token();R!=U.TPOpen&&this.unexpected(R);let Y=this.parseExpr(),$=this.token();$!=U.TPClose&&this.unexpected($);let te=this.parseExpr(),O=null,q=!1,S=this.token();S==U.TSemicolon&&(q=!0,S=this.token()),re.enumEq(S,U.TId("else"))?O=this.parseExpr():(this.tokens.push({t:S,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,q&&(this.tokens.push({t:U.TSemicolon,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax));let W=D.EIf(Y,te,O),ve=t,de=O==null?this.tokenMax:O==null?0:O.pmax;return W==null?null:(ve==null&&(ve=this.tokenMin),de==null&&(de=this.tokenMax),{e:W,pmin:ve,pmax:de,origin:this.origin,line:this.line});case"inline":return this.maybe(U.TId("function"))||this.unexpected(U.TId("inline")),this.parseStructure("function");case"new":let Ce=[];Ce.push(this.getIdent());e:for(;;){let ze=this.token();switch(ze._hx_index){case 4:break e;case 8:Ce.push(this.getIdent());break;default:this.unexpected(ze);break e}}let Se=this.parseExprList(U.TPClose),Ee=D.ENew(Ce.join("."),Se),J=t,se=null;return Ee==null?null:(J==null&&(J=this.tokenMin),se==null&&(se=this.tokenMax),{e:Ee,pmin:J,pmax:se,origin:this.origin,line:this.line});case"return":let N=this.token();this.tokens.push({t:N,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;let X=N==U.TSemicolon?null:this.parseExpr(),rt=D.EReturn(X),Ve=t,Ye=X==null?this.tokenMax:X==null?0:X.pmax;return rt==null?null:(Ve==null&&(Ve=this.tokenMin),Ye==null&&(Ye=this.tokenMax),{e:rt,pmin:Ve,pmax:Ye,origin:this.origin,line:this.line});case"switch":let Ue=this.parseExpr(),He=null,Je=[],$e=this.token();$e!=U.TBrOpen&&this.unexpected($e);e:for(;;){let ze=this.token();switch(ze._hx_index){case 2:switch(ze.s){case"case":let xi={values:[],expr:null};Je.push(xi);t:for(;;){let ct=this.parseExpr();switch(xi.values.push(ct),ze=this.token(),ze._hx_index){case 10:break;case 15:break t;default:this.unexpected(ze);break t}}let ue=[];t:for(;;)switch(ze=this.token(),this.tokens.push({t:ze,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,ze._hx_index){case 0:if(this.resumeErrors)break t;this.parseFullExpr(ue);break;case 2:switch(ze.s){case"case":case"default":break t;default:this.parseFullExpr(ue)}break;case 7:break t;default:this.parseFullExpr(ue)}let Ge;if(ue.length==1)Ge=ue[0];else if(ue.length==0){let ct=D.EBlock([]),pt=this.tokenMin,yt=this.tokenMin;ct==null?Ge=null:(pt==null&&(pt=this.tokenMin),yt==null&&(yt=this.tokenMax),Ge={e:ct,pmin:pt,pmax:yt,origin:this.origin,line:this.line})}else{let ct=D.EBlock(ue),pt=ue[0],yt=pt==null?0:pt.pmin,Kt=ue[ue.length-1],_t=Kt==null?0:Kt.pmax;ct==null?Ge=null:(yt==null&&(yt=this.tokenMin),_t==null&&(_t=this.tokenMax),Ge={e:ct,pmin:yt,pmax:_t,origin:this.origin,line:this.line})}xi.expr=Ge;break;case"default":He!=null&&this.unexpected(ze);let it=this.token();it!=U.TDoubleDot&&this.unexpected(it);let Ze=[];t:for(;;)switch(ze=this.token(),this.tokens.push({t:ze,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,ze._hx_index){case 0:if(this.resumeErrors)break t;this.parseFullExpr(Ze);break;case 2:switch(ze.s){case"case":case"default":break t;default:this.parseFullExpr(Ze)}break;case 7:break t;default:this.parseFullExpr(Ze)}if(Ze.length==1)He=Ze[0];else if(Ze.length==0){let ct=D.EBlock([]),pt=this.tokenMin,yt=this.tokenMin;ct==null?He=null:(pt==null&&(pt=this.tokenMin),yt==null&&(yt=this.tokenMax),He={e:ct,pmin:pt,pmax:yt,origin:this.origin,line:this.line})}else{let ct=D.EBlock(Ze),pt=Ze[0],yt=pt==null?0:pt.pmin,Kt=Ze[Ze.length-1],_t=Kt==null?0:Kt.pmax;ct==null?He=null:(yt==null&&(yt=this.tokenMin),_t==null&&(_t=this.tokenMax),He={e:ct,pmin:yt,pmax:_t,origin:this.origin,line:this.line})}break;default:this.unexpected(ze);break e}break;case 7:break e;default:this.unexpected(ze);break e}}let Be=D.ESwitch(Ue,Je,He),Ne=t,mt=this.tokenMax;return Be==null?null:(Ne==null&&(Ne=this.tokenMin),mt==null&&(mt=this.tokenMax),{e:Be,pmin:Ne,pmax:mt,origin:this.origin,line:this.line});case"throw":let gt=this.parseExpr(),Nt=D.EThrow(gt),ut=t,Xe=gt==null?0:gt.pmax;return Nt==null?null:(ut==null&&(ut=this.tokenMin),Xe==null&&(Xe=this.tokenMax),{e:Nt,pmin:ut,pmax:Xe,origin:this.origin,line:this.line});case"try":let kt=this.parseExpr(),Ct=this.token();re.enumEq(Ct,U.TId("catch"))||this.unexpected(Ct);let ye=this.token();ye!=U.TPOpen&&this.unexpected(ye);let ht=this.getIdent(),fe=this.token();fe!=U.TDoubleDot&&this.unexpected(fe);let xe=null;if(this.allowTypes)xe=this.parseType();else{let ze=this.token();re.enumEq(ze,U.TId("Dynamic"))||this.unexpected(ze)}let tt=this.token();tt!=U.TPClose&&this.unexpected(tt);let Ke=this.parseExpr(),dt=D.ETry(kt,ht,xe,Ke),Ut=t,at=Ke==null?0:Ke.pmax;return dt==null?null:(Ut==null&&(Ut=this.tokenMin),at==null&&(at=this.tokenMax),{e:dt,pmin:Ut,pmax:at,origin:this.origin,line:this.line});case"var":let ei=this.getIdent(),Ae=this.token(),Mt=null;Ae==U.TDoubleDot&&this.allowTypes&&(Mt=this.parseType(),Ae=this.token());let Et=null;switch(Ae._hx_index){case 3:Ae.s=="="?Et=this.parseExpr():this.unexpected(Ae);break;case 10:case 11:this.tokens.push({t:Ae,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break;default:Mt!=null?(this.tokens.push({t:Ae,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax):this.unexpected(Ae)}let Lt=D.EVar(ei,Mt,Et),ot=t,Dt=Et==null?this.tokenMax:Et==null?0:Et.pmax;return Lt==null?null:(ot==null&&(ot=this.tokenMin),Dt==null&&(Dt=this.tokenMax),{e:Lt,pmin:ot,pmax:Dt,origin:this.origin,line:this.line});case"while":let qt=this.parseExpr(),jt=this.parseExpr(),ti=D.EWhile(qt,jt),ii=t,Wt=jt==null?0:jt.pmax;return ti==null?null:(ii==null&&(ii=this.tokenMin),Wt==null&&(Wt=this.tokenMax),{e:ti,pmin:ii,pmax:Wt,origin:this.origin,line:this.line});default:return null}}parseExprNext(e){let t=this.token();switch(t._hx_index){case 2:let i=t.s;return i=="is"?this.makeBinop(i,e,this.parseExpr()):(this.tokens.push({t,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,e);case 3:let s=t.s;if(s=="->"){let ye=e.e;switch(ye._hx_index){case 1:let ht=ye.v,fe=this.parseExpr(),xe=D.EReturn(fe),tt=fe==null?0:fe.pmin,Ke=null,dt;xe==null?dt=null:(tt==null&&(tt=this.tokenMin),Ke==null&&(Ke=this.tokenMax),dt={e:xe,pmin:tt,pmax:Ke,origin:this.origin,line:this.line});let Ut=D.EFunction([{name:ht}],dt),at=e==null?0:e.pmin,ei=null;return Ut==null?null:(at==null&&(at=this.tokenMin),ei==null&&(ei=this.tokenMax),{e:Ut,pmin:at,pmax:ei,origin:this.origin,line:this.line});case 3:let Ae=ye.e.e;if(Ae._hx_index==1){let Et=Ae.v,Lt=this.parseExpr(),ot=D.EReturn(Lt),Dt=Lt==null?0:Lt.pmin,qt=null,jt;ot==null?jt=null:(Dt==null&&(Dt=this.tokenMin),qt==null&&(qt=this.tokenMax),jt={e:ot,pmin:Dt,pmax:qt,origin:this.origin,line:this.line});let ti=D.EFunction([{name:Et}],jt),ii=e==null?0:e.pmin,Wt=null;return ti==null?null:(ii==null&&(ii=this.tokenMin),Wt==null&&(Wt=this.tokenMax),{e:ti,pmin:ii,pmax:Wt,origin:this.origin,line:this.line})}break;case 26:let Mt=ye.e.e;if(Mt._hx_index==1){let Et=Mt.v,Lt=ye.t,ot=this.parseExpr(),Dt=D.EReturn(ot),qt=ot==null?0:ot.pmin,jt=null,ti;Dt==null?ti=null:(qt==null&&(qt=this.tokenMin),jt==null&&(jt=this.tokenMax),ti={e:Dt,pmin:qt,pmax:jt,origin:this.origin,line:this.line});let ii=D.EFunction([{name:Et,t:Lt}],ti),Wt=e==null?0:e.pmin,ze=null;return ii==null?null:(Wt==null&&(Wt=this.tokenMin),ze==null&&(ze=this.tokenMax),{e:ii,pmin:Wt,pmax:ze,origin:this.origin,line:this.line})}break;default:}this.unexpected(t)}if(this.opPriority.h[s]==-1){let ye;if(this.isBlock(e))ye=!0;else{let Ke=e.e;if(Ke._hx_index==3){let dt=Ke.e;ye=!0}else ye=!1}if(ye)return this.tokens.push({t,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,e;let ht=D.EUnop(s,!1,e),fe=e==null?0:e.pmin,xe=null,tt;return ht==null?tt=null:(fe==null&&(fe=this.tokenMin),xe==null&&(xe=this.tokenMax),tt={e:ht,pmin:fe,pmax:xe,origin:this.origin,line:this.line}),this.parseExprNext(tt)}return this.makeBinop(s,e,this.parseExpr());case 4:let n=D.ECall(e,this.parseExprList(U.TPClose)),l=e==null?0:e.pmin,r=null,h;return n==null?h=null:(l==null&&(l=this.tokenMin),r==null&&(r=this.tokenMax),h={e:n,pmin:l,pmax:r,origin:this.origin,line:this.line}),this.parseExprNext(h);case 8:let a=this.getIdent(),o=D.EField(e,a),c=e==null?0:e.pmin,p=null,f;return o==null?f=null:(c==null&&(c=this.tokenMin),p==null&&(p=this.tokenMax),f={e:o,pmin:c,pmax:p,origin:this.origin,line:this.line}),this.parseExprNext(f);case 9:let _=this.getIdent(),d="__a_"+this.uid++,x=D.EVar(d,null,e),y=e==null?0:e.pmin,b=e==null?0:e.pmax,v;x==null?v=null:(y==null&&(y=this.tokenMin),b==null&&(b=this.tokenMax),v={e:x,pmin:y,pmax:b,origin:this.origin,line:this.line});let T=D.EIdent(d),E=e==null?0:e.pmin,F=e==null?0:e.pmax,L;T==null?L=null:(E==null&&(E=this.tokenMin),F==null&&(F=this.tokenMax),L={e:T,pmin:E,pmax:F,origin:this.origin,line:this.line});let A=D.EIdent("null"),B=e==null?0:e.pmin,I=e==null?0:e.pmax,H;A==null?H=null:(B==null&&(B=this.tokenMin),I==null&&(I=this.tokenMax),H={e:A,pmin:B,pmax:I,origin:this.origin,line:this.line});let P=D.EBinop("==",L,H),M=null,V=null,R;P==null?R=null:(M==null&&(M=this.tokenMin),V==null&&(V=this.tokenMax),R={e:P,pmin:M,pmax:V,origin:this.origin,line:this.line});let Y=D.EIdent("null"),$=e==null?0:e.pmin,te=e==null?0:e.pmax,O;Y==null?O=null:($==null&&($=this.tokenMin),te==null&&(te=this.tokenMax),O={e:Y,pmin:$,pmax:te,origin:this.origin,line:this.line});let q=D.EIdent(d),S=e==null?0:e.pmin,W=e==null?0:e.pmax,ve;q==null?ve=null:(S==null&&(S=this.tokenMin),W==null&&(W=this.tokenMax),ve={e:q,pmin:S,pmax:W,origin:this.origin,line:this.line});let de=D.EField(ve,_),Ce=e==null?0:e.pmin,Se=null,Ee;de==null?Ee=null:(Ce==null&&(Ce=this.tokenMin),Se==null&&(Se=this.tokenMax),Ee={e:de,pmin:Ce,pmax:Se,origin:this.origin,line:this.line});let J=D.ETernary(R,O,Ee),se=null,N=null,X;J==null?X=null:(se==null&&(se=this.tokenMin),N==null&&(N=this.tokenMax),X={e:J,pmin:se,pmax:N,origin:this.origin,line:this.line});let rt=D.EBlock([v,X]),Ve=e==null?0:e.pmin,Ye=null,Ue;return rt==null?Ue=null:(Ve==null&&(Ve=this.tokenMin),Ye==null&&(Ye=this.tokenMax),Ue={e:rt,pmin:Ve,pmax:Ye,origin:this.origin,line:this.line}),this.parseExprNext(Ue);case 12:let He=this.parseExpr(),Je=this.token();Je!=U.TBkClose&&this.unexpected(Je);let $e=D.EArray(e,He),Be=e==null?0:e.pmin,Ne=null,mt;return $e==null?mt=null:(Be==null&&(Be=this.tokenMin),Ne==null&&(Ne=this.tokenMax),mt={e:$e,pmin:Be,pmax:Ne,origin:this.origin,line:this.line}),this.parseExprNext(mt);case 14:let gt=this.parseExpr(),Nt=this.token();Nt!=U.TDoubleDot&&this.unexpected(Nt);let ut=this.parseExpr(),Xe=D.ETernary(e,gt,ut),kt=e==null?0:e.pmin,Ct=ut==null?0:ut.pmax;return Xe==null?null:(kt==null&&(kt=this.tokenMin),Ct==null&&(Ct=this.tokenMax),{e:Xe,pmin:kt,pmax:Ct,origin:this.origin,line:this.line});default:return this.tokens.push({t,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,e}}parseFunctionArgs(){let e=[],t=this.token();if(t!=U.TPClose){let i=!1;for(;!i;){let s=null,n=!1;if(t._hx_index==14&&(n=!0,t=this.token()),t._hx_index==2)s=t.s;else{this.unexpected(t);break}let l={name:s};switch(e.push(l),n&&(l.opt=!0),this.allowTypes&&(this.maybe(U.TDoubleDot)&&(l.t=this.parseType()),this.maybe(U.TOp("="))&&(l.value=this.parseExpr())),t=this.token(),t._hx_index){case 5:i=!0;break;case 10:t=this.token();break;default:this.unexpected(t)}}}return e}parseFunctionDecl(){let e=this.token();e!=U.TPOpen&&this.unexpected(e);let t=this.parseFunctionArgs(),i=null;if(this.allowTypes){let s=this.token();s!=U.TDoubleDot?(this.tokens.push({t:s,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax):i=this.parseType()}return{args:t,ret:i,body:this.parseExpr()}}parsePath(){let e=[this.getIdent()];for(;;){let t=this.token();if(t!=U.TDot){this.tokens.push({t,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break}e.push(this.getIdent())}return e}parseType(){let e=this.token(),t=this;switch(e._hx_index){case 2:let i=e.s;this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;let s=this.parsePath(),n=null;if(e=this.token(),e._hx_index==3)if(e.s=="<"){n=[];e:for(;;){switch(n.push(this.parseType()),e=this.token(),e._hx_index){case 3:let p=e.s;if(p==">")break e;if(u.cca(p,0)==62){this.tokens.add({t:U.TOp(u.substr(p,1,null)),min:this.tokenMax-p.length-1,max:this.tokenMax});break e}break;case 10:continue;default:}this.unexpected(e);break}}else this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;else this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;return this.parseTypeNext(Ht.CTPath(s,n));case 4:let l=this.token(),r=this.token();this.tokens.push({t:r,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,this.tokens.push({t:l,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;let h=function(c){let p=t.token();if(p._hx_index==3){if(p.s!="->"){let f=p;t.unexpected(f)}}else{let f=p;t.unexpected(f)}return Ht.CTFun(c,t.parseType())};switch(l._hx_index){case 2:let c=l.s;if(r._hx_index==15){let b=[],v=0,T=this.parseFunctionArgs();for(;v<T.length;){let F=T[v];++v;let L=F.value;if(L!=null){let A=L;if(!this.resumeErrors)throw k.thrown(new ce(oe.ECustom("Default values not allowed in function types"),A.pmin,A.pmax,this.origin,this.line))}b.push(Ht.CTNamed(F.name,F.opt?Ht.CTOpt(F.t):F.t))}return h(b)}else{let b=this.parseType(),v=this.token();switch(v._hx_index){case 5:return this.parseTypeNext(Ht.CTParent(b));case 10:let T=[b];do T.push(this.parseType());while(this.maybe(U.TComma));let E=this.token();return E!=U.TPClose&&this.unexpected(E),h(T);default:let F=v;return this.unexpected(F)}}break;case 5:let p=[],f=0,_=this.parseFunctionArgs();for(;f<_.length;){let b=_[f];++f;let v=b.value;if(v!=null){let T=v;if(!this.resumeErrors)throw k.thrown(new ce(oe.ECustom("Default values not allowed in function types"),T.pmin,T.pmax,this.origin,this.line))}p.push(Ht.CTNamed(b.name,b.opt?Ht.CTOpt(b.t):b.t))}return h(p);default:let x=this.parseType(),y=this.token();switch(y._hx_index){case 5:return this.parseTypeNext(Ht.CTParent(x));case 10:let b=[x];do b.push(this.parseType());while(this.maybe(U.TComma));let v=this.token();return v!=U.TPClose&&this.unexpected(v),h(b);default:let T=y;return this.unexpected(T)}}break;case 6:let a=[],o=null;e:for(;;)switch(e=this.token(),e._hx_index){case 2:let c=e.s;if(c=="var"){let f=this.getIdent(),_=this.token();_!=U.TDoubleDot&&this.unexpected(_),a.push({name:f,t:this.parseType(),meta:o}),o=null;let d=this.token();d!=U.TSemicolon&&this.unexpected(d)}else{let f=c,_=this.token();switch(_!=U.TDoubleDot&&this.unexpected(_),a.push({name:f,t:this.parseType(),meta:o}),e=this.token(),e._hx_index){case 7:break e;case 10:break;default:this.unexpected(e)}}break;case 7:break e;case 16:let p=e.s;o==null&&(o=[]),o.push({name:p,params:this.parseMetaArgs()});break;default:this.unexpected(e);break e}return this.parseTypeNext(Ht.CTAnon(a));default:return this.unexpected(e)}}parseTypeNext(e){let t=this.token();if(t._hx_index==3){if(t.s!="->")return this.tokens.push({t,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,e}else return this.tokens.push({t,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,e;let i=this.parseType();if(i._hx_index==1){let s=i.ret;return i.args.unshift(e),i}else return Ht.CTFun([e],i)}parseExprList(e){let t=[],i=this.token();if(i==e)return t;for(this.tokens.push({t:i,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;;)if(t.push(this.parseExpr()),i=this.token(),i._hx_index!=10){if(i==e)break;this.unexpected(i);break}return t}parseModule(e,t,i){i==null&&(i=0),t==null&&(t="hscript"),this.initParser(t,i),this.input=e,this.readPos=0,this.allowTypes=!0,this.allowMetadata=!0;let s=[];for(;;){let n=this.token();if(n==U.TEof)break;this.tokens.push({t:n,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,s.push(this.parseModuleDecl())}return s}parseMetadata(){let e=[];for(;;){let t=this.token();if(t._hx_index==16){let i=t.s;e.push({name:i,params:this.parseMetaArgs()})}else{this.tokens.push({t,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break}}return e}parseParams(){if(this.maybe(U.TOp("<"))&&!this.resumeErrors)throw k.thrown(new ce(oe.EInvalidOp("Unsupported class type parameters"),this.readPos+this.offset,this.readPos+this.offset,this.origin,this.line));return{}}parseModuleDecl(){let e=this.parseMetadata(),t=this.getIdent(),i=!1,s=!1;e:for(;;){switch(t){case"extern":s=!0;break;case"private":i=!0;break;default:break e}t=this.getIdent()}switch(t){case"class":let n=this.getIdent(),l=this.parseParams(),r=null,h=[];e:for(;;){let T=this.token();if(T._hx_index==2)switch(T.s){case"extends":r=this.parseType();break;case"implements":h.push(this.parseType());break;default:this.tokens.push({t:T,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break e}else{this.tokens.push({t:T,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break}}let a=[],o=this.token();for(o!=U.TBrOpen&&this.unexpected(o);!this.maybe(U.TBrClose);)a.push(this.parseField());return Ui.DClass({name:n,meta:e,params:l,extend:r,implement:h,fields:a,isPrivate:i,isExtern:s});case"import":let c=[this.getIdent()],p=!1;for(;;){let T=this.token();if(T!=U.TDot){this.tokens.push({t:T,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break}switch(T=this.token(),T._hx_index){case 2:let E=T.s;c.push(E);break;case 3:T.s=="*"?p=!0:this.unexpected(T);break;default:this.unexpected(T)}}let f=this.token();return f!=U.TSemicolon&&this.unexpected(f),Ui.DImport(c,p);case"package":let _=this.parsePath(),d=this.token();return d!=U.TSemicolon&&this.unexpected(d),Ui.DPackage(_);case"typedef":let x=this.getIdent(),y=this.parseParams(),b=this.token();re.enumEq(b,U.TOp("="))||this.unexpected(b);let v=this.parseType();return Ui.DTypedef({name:x,meta:e,params:y,isPrivate:i,t:v});default:this.unexpected(U.TId(t))}return null}parseField(){let e=this.parseMetadata(),t=[];e:for(;;){let i=this.getIdent();switch(i){case"function":let s=this.getIdent(),n=this.parseFunctionDecl();return{name:s,meta:e,access:t,kind:Ps.KFunction({args:n.args,expr:n.body,ret:n.ret})};case"inline":t.push(Ti.AInline);break;case"macro":t.push(Ti.AMacro);break;case"override":t.push(Ti.AOverride);break;case"private":t.push(Ti.APrivate);break;case"public":t.push(Ti.APublic);break;case"static":t.push(Ti.AStatic);break;case"var":let l=this.getIdent(),r=null,h=null;if(this.maybe(U.TPOpen)){r=this.getIdent();let c=this.token();c!=U.TComma&&this.unexpected(c),h=this.getIdent();let p=this.token();p!=U.TPClose&&this.unexpected(p)}let a=this.maybe(U.TDoubleDot)?this.parseType():null,o=this.maybe(U.TOp("="))?this.parseExpr():null;if(o!=null)if(this.isBlock(o))this.maybe(U.TSemicolon);else{let c=this.token();c!=U.TSemicolon&&this.unexpected(c)}else{let c;if(a!=null)if(a==null)c=!1;else if(a._hx_index==2){let p=a.fields;c=!0}else c=!1;else c=!1;if(c)this.maybe(U.TSemicolon);else{let p=this.token();p!=U.TSemicolon&&this.unexpected(p)}}return{name:l,meta:e,access:t,kind:Ps.KVar({get:r,set:h,type:a,expr:o})};default:this.unexpected(U.TId(i));break e}}return null}readChar(){return this.input.charCodeAt(this.readPos++)}readString(e){let t=0,i="",s=!1,n=this.line,l=this.input,r=this.readPos+this.offset-1;for(;;){let h=this.input.charCodeAt(this.readPos++);if(h!=h){if(this.line=n,!this.resumeErrors)throw k.thrown(new ce(oe.EUnterminatedString,r,r,this.origin,this.line));break}if(s)switch(s=!1,h){case 47:this.allowJSON?i+=String.fromCodePoint(h):this.invalidChar(h);break;case 34:case 39:case 92:i+=String.fromCodePoint(h);break;case 110:i+=String.fromCodePoint(10);break;case 114:i+=String.fromCodePoint(13);break;case 116:i+=String.fromCodePoint(9);break;case 117:this.allowJSON||this.invalidChar(h);let a=0,o=0;for(;o<4;){let c=o++;a<<=4;let p=this.input.charCodeAt(this.readPos++);switch(p){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:a+=p-48;break;case 65:case 66:case 67:case 68:case 69:case 70:a+=p-55;break;case 97:case 98:case 99:case 100:case 101:case 102:a+=p-87;break;default:if(p!=p&&(this.line=n,!this.resumeErrors))throw k.thrown(new ce(oe.EUnterminatedString,r,r,this.origin,this.line));this.invalidChar(p)}}i+=String.fromCodePoint(a);break;default:this.invalidChar(h)}else if(h==92)s=!0;else{if(h==e)break;h==10&&this.line++,i+=String.fromCodePoint(h)}}return i}token(){let e=this.tokens.pop();if(e!=null)return this.tokenMin=e.min,this.tokenMax=e.max,e.t;this.oldTokenMin=this.tokenMin,this.oldTokenMax=this.tokenMax,this.tokenMin=this.char<0?this.readPos+this.offset:this.readPos+this.offset-1;let t=this._token();return this.tokenMax=this.char<0?this.readPos+this.offset-1:this.readPos+this.offset-2,t}_token(){let e;for(this.char<0?e=this.input.charCodeAt(this.readPos++):(e=this.char,this.char=-1);;){if(e!=e)return this.char=e,U.TEof;switch(e){case 0:return U.TEof;case 10:this.line++,this.tokenMin++;break;case 9:case 13:case 32:this.tokenMin++;break;case 34:case 39:return U.TConst(ai.CString(this.readString(e)));case 35:if(e=this.input.charCodeAt(this.readPos++),this.idents[e]){let s=String.fromCodePoint(e);for(;;){if(e=this.input.charCodeAt(this.readPos++),!this.idents[e])return this.char=e,this.preprocess(s);s+=String.fromCodePoint(e)}}this.invalidChar(e);break;case 40:return U.TPOpen;case 41:return U.TPClose;case 44:return U.TComma;case 46:switch(e=this.input.charCodeAt(this.readPos++),e){case 46:return e=this.input.charCodeAt(this.readPos++),e!=46&&this.invalidChar(e),U.TOp("...");case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:let s=e-48,n=1;for(;;)switch(e=this.input.charCodeAt(this.readPos++),n*=10,e){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:s=s*10+(e-48);break;default:return this.char=e,U.TConst(ai.CFloat(s/n))}break;default:return this.char=e,U.TDot}break;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:let t=(e-48)*1,i=0;for(;;)switch(e=this.input.charCodeAt(this.readPos++),i*=10,e){case 46:if(i>0){if(i==10&&this.input.charCodeAt(this.readPos++)==46){this.tokens.push({t:U.TOp("..."),min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;let h=t|0;return U.TConst(h==t?ai.CInt(h):ai.CFloat(t))}this.invalidChar(e)}i=1;break;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:t=t*10+(e-48);break;case 69:case 101:let s=this.token(),n=null;switch(s._hx_index){case 1:let h=s.c;h._hx_index==0?n=h.v:(this.tokens.push({t:s,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax);break;case 3:if(s.s=="-")if(s=this.token(),s._hx_index==1){let a=s.c;a._hx_index==0?n=-a.v:(this.tokens.push({t:s,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax)}else this.tokens.push({t:s,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;else this.tokens.push({t:s,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break;default:this.tokens.push({t:s,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax}return n==null&&this.invalidChar(e),i==0&&(i=10),U.TConst(ai.CFloat(Math.pow(10,n)/i*t*10));case 120:(t>0||i>0)&&this.invalidChar(e);let l=0;for(;;)switch(e=this.input.charCodeAt(this.readPos++),e){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:l=(l<<4)+e-48;break;case 65:case 66:case 67:case 68:case 69:case 70:l=(l<<4)+(e-55);break;case 97:case 98:case 99:case 100:case 101:case 102:l=(l<<4)+(e-87);break;default:return this.char=e,U.TConst(ai.CInt(l))}break;default:this.char=e;let r=t|0;return U.TConst(i>0?ai.CFloat(t*10/i):r==t?ai.CInt(r):ai.CFloat(t))}break;case 58:return U.TDoubleDot;case 59:return U.TSemicolon;case 61:return e=this.input.charCodeAt(this.readPos++),e==61?U.TOp("=="):e==62?U.TOp("=>"):(this.char=e,U.TOp("="));case 63:return e=this.input.charCodeAt(this.readPos++),e==46?U.TQuestionDot:(this.char=e,U.TQuestion);case 64:if(e=this.input.charCodeAt(this.readPos++),this.idents[e]||e==58){let s=String.fromCodePoint(e);for(;;){if(e=this.input.charCodeAt(this.readPos++),!this.idents[e])return this.char=e,U.TMeta(s);s+=String.fromCodePoint(e)}}this.invalidChar(e);break;case 91:return U.TBkOpen;case 93:return U.TBkClose;case 123:return U.TBrOpen;case 125:return U.TBrClose;default:if(this.ops[e]){let s=String.fromCodePoint(e);for(;;){if(e=this.input.charCodeAt(this.readPos++),e!=e&&(e=0),!this.ops[e])return this.char=e,U.TOp(s);let n=s;if(s+=String.fromCodePoint(e),!Object.prototype.hasOwnProperty.call(this.opPriority.h,s)&&Object.prototype.hasOwnProperty.call(this.opPriority.h,n))return s=="//"||s=="/*"?this.tokenComment(s,e):(this.char=e,U.TOp(n))}}if(this.idents[e]){let s=String.fromCodePoint(e);for(;;){if(e=this.input.charCodeAt(this.readPos++),e!=e&&(e=0),!this.idents[e])return this.char=e,U.TId(s);s+=String.fromCodePoint(e)}}this.invalidChar(e)}e=this.input.charCodeAt(this.readPos++)}}preprocValue(e){return this.preprocesorValues.h[e]}parsePreproCond(){let e=this.token();switch(e._hx_index){case 2:let t=e.s,i=D.EIdent(t),s=this.tokenMin,n=this.tokenMax;return i==null?null:(s==null&&(s=this.tokenMin),n==null&&(n=this.tokenMax),{e:i,pmin:s,pmax:n,origin:this.origin,line:this.line});case 3:if(e.s=="!"){let l=D.EUnop("!",!0,this.parsePreproCond()),r=this.tokenMin,h=this.tokenMax;return l==null?null:(r==null&&(r=this.tokenMin),h==null&&(h=this.tokenMax),{e:l,pmin:r,pmax:h,origin:this.origin,line:this.line})}else return this.unexpected(e);break;case 4:return this.tokens.push({t:U.TPOpen,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,this.parseExpr();default:return this.unexpected(e)}}evalPreproCond(e){let t=e.e;switch(t._hx_index){case 1:let i=t.v;return this.preprocValue(i)!=null;case 3:let s=t.e;return this.evalPreproCond(s);case 6:let n=t.e1,l=t.e2;switch(t.op){case"&&":let a=n,o=l;return this.evalPreproCond(a)?this.evalPreproCond(o):!1;case"||":let c=n,p=l;return this.evalPreproCond(c)?!0:this.evalPreproCond(p);default:let f=e.e;if(!this.resumeErrors)throw k.thrown(new ce(oe.EInvalidPreprocessor("Can't eval "+Fe[f.__enum__].__constructs__[f._hx_index]._hx_name),this.readPos+this.offset,this.readPos+this.offset,this.origin,this.line));return!1}break;case 7:let r=t.prefix;if(t.op=="!"){let a=t.e;return!this.evalPreproCond(a)}else{let a=e.e;if(!this.resumeErrors)throw k.thrown(new ce(oe.EInvalidPreprocessor("Can't eval "+Fe[a.__enum__].__constructs__[a._hx_index]._hx_name),this.readPos+this.offset,this.readPos+this.offset,this.origin,this.line));return!1}break;default:let h=e.e;if(!this.resumeErrors)throw k.thrown(new ce(oe.EInvalidPreprocessor("Can't eval "+Fe[h.__enum__].__constructs__[h._hx_index]._hx_name),this.readPos+this.offset,this.readPos+this.offset,this.origin,this.line));return!1}}preprocess(e){switch(e){case"else":case"elseif":return this.preprocStack.length>0?this.preprocStack[this.preprocStack.length-1].r?(this.preprocStack[this.preprocStack.length-1].r=!1,this.skipTokens(),this.token()):e=="else"?(this.preprocStack.pop(),this.preprocStack.push({r:!0}),this.token()):(this.preprocStack.pop(),this.preprocess("if")):U.TPrepro(e);case"end":return this.preprocStack.length>0?(this.preprocStack.pop(),this.token()):U.TPrepro(e);case"if":let t=this.parsePreproCond();return this.evalPreproCond(t)?(this.preprocStack.push({r:!0}),this.token()):(this.preprocStack.push({r:!1}),this.skipTokens(),this.token());default:return U.TPrepro(e)}}skipTokens(){let e=this.preprocStack.length-1,t=this.preprocStack[e],i=this.readPos+this.offset;for(;;){let s=this.token();if(s==U.TEof&&!this.resumeErrors)throw k.thrown(new ce(oe.EInvalidPreprocessor("Unclosed"),i,i,this.origin,this.line));if(this.preprocStack[e]!=t){this.tokens.push({t:s,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break}}}tokenComment(e,t){let i=u.cca(e,1),s=this.input;if(i==47){for(;t!=13&&t!=10&&(t=this.input.charCodeAt(this.readPos++),t==t););return this.char=t,this.token()}if(i==42){let n=this.line;if(e=="/**/")return this.char=t,this.token();do{for(;t!=42;)if(t==10&&this.line++,t=this.input.charCodeAt(this.readPos++),t!=t){if(this.line=n,!this.resumeErrors)throw k.thrown(new ce(oe.EUnterminatedComment,this.tokenMin,this.tokenMin,this.origin,this.line));break}if(t=this.input.charCodeAt(this.readPos++),t!=t){if(this.line=n,!this.resumeErrors)throw k.thrown(new ce(oe.EUnterminatedComment,this.tokenMin,this.tokenMin,this.origin,this.line));break}}while(t!=47);return this.token()}return this.char=t,U.TOp(e)}constString(e){switch(e._hx_index){case 0:let t=e.v;return t==null?"null":""+t;case 1:let i=e.f;return i==null?"null":""+i;case 2:return e.s}}tokenString(e){switch(e._hx_index){case 0:return"<eof>";case 1:let t=e.c;return this.constString(t);case 2:return e.s;case 3:return e.s;case 4:return"(";case 5:return")";case 6:return"{";case 7:return"}";case 8:return".";case 9:return"?.";case 10:return",";case 11:return";";case 12:return"[";case 13:return"]";case 14:return"?";case 15:return":";case 16:return"@"+e.s;case 17:return"#"+e.s}}}K["hscript.Parser"]=Yi,Yi.__name__="hscript.Parser",Object.assign(Yi.prototype,{__class__:Yi,__properties__:{get_currentPos:"get_currentPos"}});class ns{constructor(){}exprToString(e){return this.buf=new $t,this.tabs="",this.expr(e),this.buf.b}typeToString(e){return this.buf=new $t,this.tabs="",this.type(e),this.buf.b}add(e){this.buf.b+=Z.string(e)}type(e){switch(e._hx_index){case 0:let t=e.path,i=e.params,s=t.join(".");if(this.buf.b+=Z.string(s),i!=null){this.buf.b+="<";let x=!0,y=0;for(;y<i.length;){let b=i[y];++y,x?x=!1:this.buf.b+=", ",this.type(b)}this.buf.b+=">"}break;case 1:let n=e.args,l=e.ret,r=n,h=l;if(Qs.exists(r,function(x){if(x._hx_index==5){let y=x.n,b=x.t;return!0}else return!1})){this.buf.b+="(";let x=0;for(;x<r.length;){let y=r[x];if(++x,y._hx_index==5){let b=y.n,v=y.t;this.type(y)}else this.type(Ht.CTNamed("_",y))}this.buf.b+=")->",this.type(h)}else{let x=n,y=l;if(x.length==0)this.buf.b+="Void -> ";else{let b=0;for(;b<x.length;){let v=x[b];++b,this.type(v),this.buf.b+=" -> "}}this.type(y)}break;case 2:let a=e.fields;this.buf.b+="{";let o=!0,c=0;for(;c<a.length;){let x=a[c];++c,o?(o=!1,this.buf.b+=" "):this.buf.b+=", ",this.buf.b+=Z.string(x.name+" : "),this.type(x.t)}this.buf.b+=o?"}":" }";break;case 3:let p=e.t;this.buf.b+="(",this.type(p),this.buf.b+=")";break;case 4:let f=e.t;this.buf.b+="?",this.type(f);break;case 5:let _=e.n,d=e.t;this.buf.b+=_==null?"null":""+_,this.buf.b+=":",this.type(d);break}}addType(e){e!=null&&(this.buf.b+=" : ",this.type(e))}expr(e){if(e==null){this.buf.b+="??NULL??";return}let t=e.e;switch(t._hx_index){case 0:let i=t.c;switch(i._hx_index){case 0:let fe=i.v;this.buf.b+=fe==null?"null":""+fe;break;case 1:let xe=i.f;this.buf.b+=xe==null?"null":""+xe;break;case 2:let tt=i.s;this.buf.b+='"';let Ke=tt.split('"').join('\\"').split(`
14
+ `).join("\\n").split("\r").join("\\r").split(" ").join("\\t");this.buf.b+=Z.string(Ke),this.buf.b+='"';break}break;case 1:let s=t.v;this.buf.b+=s==null?"null":""+s;break;case 2:let n=t.n,l=t.t,r=t.e;this.buf.b+=Z.string("var "+n),this.addType(l),r!=null&&(this.buf.b+=" = ",this.expr(r));break;case 3:let h=t.e;this.buf.b+="(",this.expr(h),this.buf.b+=")";break;case 4:let a=t.e;if(a.length==0)this.buf.b+="{}";else{this.tabs+=" ",this.buf.b+=`{
15
+ `;let fe=0;for(;fe<a.length;){let xe=a[fe];++fe,this.buf.b+=Z.string(this.tabs),this.expr(xe),this.buf.b+=`;
16
+ `}this.tabs=u.substr(this.tabs,1,null),this.buf.b+="}"}break;case 5:let o=t.e,c=t.f;this.expr(o),this.buf.b+=Z.string("."+c);break;case 6:let p=t.op,f=t.e1,_=t.e2;this.expr(f),this.buf.b+=Z.string(" "+p+" "),this.expr(_);break;case 7:let d=t.op,x=t.prefix,y=t.e;x?(this.buf.b+=d==null?"null":""+d,this.expr(y)):(this.expr(y),this.buf.b+=d==null?"null":""+d);break;case 8:let b=t.e,v=t.params;if(b==null)this.expr(b);else{let fe=b.e;switch(fe._hx_index){case 0:let xe=fe.c;this.expr(b);break;case 1:let tt=fe.v;this.expr(b);break;case 5:let Ke=fe.e,dt=fe.f;this.expr(b);break;default:this.buf.b+="(",this.expr(b),this.buf.b+=")"}}this.buf.b+="(";let T=!0,E=0;for(;E<v.length;){let fe=v[E];++E,T?T=!1:this.buf.b+=", ",this.expr(fe)}this.buf.b+=")";break;case 9:let F=t.cond,L=t.e1,A=t.e2;this.buf.b+="if( ",this.expr(F),this.buf.b+=" ) ",this.expr(L),A!=null&&(this.buf.b+=" else ",this.expr(A));break;case 10:let B=t.cond,I=t.e;this.buf.b+="while( ",this.expr(B),this.buf.b+=" ) ",this.expr(I);break;case 11:let H=t.v,P=t.it,M=t.e;this.buf.b+=Z.string("for( "+H+" in "),this.expr(P),this.buf.b+=" ) ",this.expr(M);break;case 12:this.buf.b+="break";break;case 13:this.buf.b+="continue";break;case 14:let V=t.args,R=t.e,Y=t.name,$=t.ret;this.buf.b+="function",Y!=null&&(this.buf.b+=Z.string(" "+Y)),this.buf.b+="(";let te=!0,O=0;for(;O<V.length;){let fe=V[O];++O,te?te=!1:this.buf.b+=", ",fe.opt&&(this.buf.b+="?"),this.buf.b+=Z.string(fe.name),this.addType(fe.t)}this.buf.b+=")",this.addType($),this.buf.b+=" ",this.expr(R);break;case 15:let q=t.e;this.buf.b+="return",q!=null&&(this.buf.b+=" ",this.expr(q));break;case 16:let S=t.e,W=t.index;this.expr(S),this.buf.b+="[",this.expr(W),this.buf.b+="]";break;case 17:let ve=t.e;this.buf.b+="[";let de=!0,Ce=0;for(;Ce<ve.length;){let fe=ve[Ce];++Ce,de?de=!1:this.buf.b+=", ",this.expr(fe)}this.buf.b+="]";break;case 18:let Se=t.cl,Ee=t.params;this.buf.b+=Z.string("new "+Se+"(");let J=!0,se=0;for(;se<Ee.length;){let fe=Ee[se];++se,J?J=!1:this.buf.b+=", ",this.expr(fe)}this.buf.b+=")";break;case 19:let N=t.e;this.buf.b+="throw ",this.expr(N);break;case 20:let X=t.e,rt=t.v,Ve=t.t,Ye=t.ecatch;this.buf.b+="try ",this.expr(X),this.buf.b+=Z.string(" catch( "+rt),this.addType(Ve),this.buf.b+=") ",this.expr(Ye);break;case 21:let Ue=t.fl;if(Ue.length==0)this.buf.b+="{}";else{this.tabs+=" ",this.buf.b+=`{
17
+ `;let fe=0;for(;fe<Ue.length;){let xe=Ue[fe];++fe,this.buf.b+=Z.string(this.tabs),this.buf.b+=Z.string(xe.name+" : "),this.expr(xe.e),this.buf.b+=`,
18
+ `}this.tabs=u.substr(this.tabs,1,null),this.buf.b+="}"}break;case 22:let He=t.cond,Je=t.e1,$e=t.e2;this.expr(He),this.buf.b+=" ? ",this.expr(Je),this.buf.b+=" : ",this.expr($e);break;case 23:let Be=t.e,Ne=t.cases,mt=t.defaultExpr;this.buf.b+="switch( ",this.expr(Be),this.buf.b+=") {";let gt=0;for(;gt<Ne.length;){let fe=Ne[gt];++gt,this.buf.b+="case ";let xe=!0,tt=0,Ke=fe.values;for(;tt<Ke.length;){let dt=Ke[tt];++tt,xe?xe=!1:this.buf.b+=", ",this.expr(dt)}this.buf.b+=": ",this.expr(fe.expr),this.buf.b+=`;
19
+ `}mt!=null&&(this.buf.b+="default: ",this.expr(mt),this.buf.b+=`;
20
+ `),this.buf.b+="}";break;case 24:let Nt=t.cond,ut=t.e;this.buf.b+="do ",this.expr(ut),this.buf.b+=" while ( ",this.expr(Nt),this.buf.b+=" )";break;case 25:let Xe=t.name,kt=t.args,Ct=t.e;if(this.buf.b+="@",this.buf.b+=Xe==null?"null":""+Xe,kt!=null&&kt.length>0){this.buf.b+="(";let fe=!0,xe=0;for(;xe<kt.length;){let tt=kt[xe];++xe,fe?fe=!1:this.buf.b+=", ",this.expr(Ct)}this.buf.b+=")"}this.buf.b+=" ",this.expr(Ct);break;case 26:let ye=t.e,ht=t.t;this.buf.b+="(",this.expr(ye),this.buf.b+=" : ",this.addType(ht),this.buf.b+=")";break}}static toString(e){return new ns().exprToString(e)}static errorToString(e){let t,i=e.e;switch(i._hx_index){case 0:let s=i.c;t="Invalid character: '"+(s!=s?"EOF":String.fromCodePoint(s))+"' ("+s+")";break;case 1:t='Unexpected token: "'+i.s+'"';break;case 2:t="Unterminated string";break;case 3:t="Unterminated comment";break;case 4:t="Invalid preprocessor ("+i.msg+")";break;case 5:t="Unknown variable: "+i.v;break;case 6:t="Invalid iterator: "+i.v;break;case 7:t="Invalid operator: "+i.op;break;case 8:t="Invalid access to field "+i.f;break;case 9:t=i.msg;break}return e.origin+":"+e.line+": "+t}}K["hscript.Printer"]=ns,ns.__name__="hscript.Printer",Object.assign(ns.prototype,{__class__:ns});class $s{static iter(e,t){let i=e.e;switch(i._hx_index){case 0:let s=i.c;break;case 1:let n=i.v;break;case 2:let l=i.n,r=i.t,h=i.e;h!=null&&t(h);break;case 3:let a=i.e;t(a);break;case 4:let o=i.e,c=0;for(;c<o.length;){let ye=o[c];++c,t(ye)}break;case 5:let p=i.f,f=i.e;t(f);break;case 6:let _=i.op,d=i.e1,x=i.e2;t(d),t(x);break;case 7:let y=i.op,b=i.prefix,v=i.e;t(v);break;case 8:let T=i.e,E=i.params;t(T);let F=0;for(;F<E.length;){let ye=E[F];++F,t(ye)}break;case 9:let L=i.cond,A=i.e1,B=i.e2;t(L),t(A),B!=null&&t(B);break;case 10:let I=i.cond,H=i.e;t(I),t(H);break;case 11:let P=i.v,M=i.it,V=i.e;t(M),t(V);break;case 12:case 13:break;case 14:let R=i.args,Y=i.name,$=i.ret,te=i.e;t(te);break;case 15:let O=i.e;O!=null&&t(O);break;case 16:let q=i.e,S=i.index;t(q),t(S);break;case 17:let W=i.e,ve=0;for(;ve<W.length;){let ye=W[ve];++ve,t(ye)}break;case 18:let de=i.cl,Ce=i.params,Se=0;for(;Se<Ce.length;){let ye=Ce[Se];++Se,t(ye)}break;case 19:let Ee=i.e;t(Ee);break;case 20:let J=i.v,se=i.t,N=i.e,X=i.ecatch;t(N),t(X);break;case 21:let rt=i.fl,Ve=0;for(;Ve<rt.length;){let ye=rt[Ve];++Ve,t(ye.e)}break;case 22:let Ye=i.cond,Ue=i.e1,He=i.e2;t(Ye),t(Ue),t(He);break;case 23:let Je=i.e,$e=i.cases,Be=i.defaultExpr;t(Je);let Ne=0;for(;Ne<$e.length;){let ye=$e[Ne];++Ne;let ht=0,fe=ye.values;for(;ht<fe.length;){let xe=fe[ht];++ht,t(xe)}t(ye.expr)}Be!=null&&t(Be);break;case 24:let mt=i.cond,gt=i.e;t(mt),t(gt);break;case 25:let Nt=i.name,ut=i.args,Xe=i.e;if(ut!=null){let ye=0;for(;ye<ut.length;){let ht=ut[ye];++ye,t(ht)}}t(Xe);break;case 26:let kt=i.t,Ct=i.e;t(Ct);break}}static map(e,t){let i,s=e.e;switch(s._hx_index){case 0:let n=s.c;i=e.e;break;case 1:let l=s.v;i=e.e;break;case 2:let r=s.n,h=s.t,a=s.e;i=D.EVar(r,h,a!=null?t(a):null);break;case 3:let o=s.e;i=D.EParent(t(o));break;case 4:let c=s.e,p=[],f=0;for(;f<c.length;){let Ae=c[f];++f,p.push(t(Ae))}i=D.EBlock(p);break;case 5:let _=s.e,d=s.f;i=D.EField(t(_),d);break;case 6:let x=s.op,y=s.e1,b=s.e2;i=D.EBinop(x,t(y),t(b));break;case 7:let v=s.op,T=s.prefix,E=s.e;i=D.EUnop(v,T,t(E));break;case 8:let F=s.e,L=s.params,A=t(F),B=[],I=0;for(;I<L.length;){let Ae=L[I];++I,B.push(t(Ae))}i=D.ECall(A,B);break;case 9:let H=s.cond,P=s.e1,M=s.e2;i=D.EIf(t(H),t(P),M!=null?t(M):null);break;case 10:let V=s.cond,R=s.e;i=D.EWhile(t(V),t(R));break;case 11:let Y=s.v,$=s.it,te=s.e;i=D.EFor(Y,t($),t(te));break;case 12:case 13:i=e.e;break;case 14:let O=s.args,q=s.e,S=s.name,W=s.ret;i=D.EFunction(O,t(q),S,W);break;case 15:let ve=s.e;i=D.EReturn(ve!=null?t(ve):null);break;case 16:let de=s.e,Ce=s.index;i=D.EArray(t(de),t(Ce));break;case 17:let Se=s.e,Ee=[],J=0;for(;J<Se.length;){let Ae=Se[J];++J,Ee.push(t(Ae))}i=D.EArrayDecl(Ee);break;case 18:let se=s.cl,N=s.params,X=[],rt=0;for(;rt<N.length;){let Ae=N[rt];++rt,X.push(t(Ae))}i=D.ENew(se,X);break;case 19:let Ve=s.e;i=D.EThrow(t(Ve));break;case 20:let Ye=s.e,Ue=s.v,He=s.t,Je=s.ecatch;i=D.ETry(t(Ye),Ue,He,t(Je));break;case 21:let $e=s.fl,Be=[],Ne=0;for(;Ne<$e.length;){let Ae=$e[Ne];++Ne,Be.push({name:Ae.name,e:t(Ae.e)})}i=D.EObject(Be);break;case 22:let mt=s.cond,gt=s.e1,Nt=s.e2;i=D.ETernary(t(mt),t(gt),t(Nt));break;case 23:let ut=s.e,Xe=s.cases,kt=s.defaultExpr,Ct=t(ut),ye=[],ht=0;for(;ht<Xe.length;){let Ae=Xe[ht];++ht;let Mt=[],Et=0,Lt=Ae.values;for(;Et<Lt.length;){let ot=Lt[Et];++Et,Mt.push(t(ot))}ye.push({values:Mt,expr:t(Ae.expr)})}i=D.ESwitch(Ct,ye,kt==null?null:t(kt));break;case 24:let fe=s.cond,xe=s.e;i=D.EDoWhile(t(fe),t(xe));break;case 25:let tt=s.name,Ke=s.args,dt=s.e,Ut;if(Ke==null)Ut=null;else{let Ae=[],Mt=0;for(;Mt<Ke.length;){let Et=Ke[Mt];++Mt,Ae.push(t(Et))}Ut=Ae}i=D.EMeta(tt,Ut,t(dt));break;case 26:let at=s.e,ei=s.t;i=D.ECheckType(t(at),ei);break}return{e:i,pmin:e.pmin,pmax:e.pmax,origin:e.origin,line:e.line}}static expr(e){return e.e}static mk(e,t){return{e,pmin:t.pmin,pmax:t.pmax,origin:t.origin,line:t.line}}}K["hscript.Tools"]=$s,$s.__name__="hscript.Tools";class Q{static getClass(e){if(e==null)return null;if(e instanceof Array)return Array;{let t=e.__class__;if(t!=null)return t;let i=Q.__nativeClassName(e);return i!=null?Q.__resolveNativeClass(i):null}}static __string_rec(e,t){if(e==null)return"null";if(t.length>=5)return"<...>";let i=typeof e;switch(i=="function"&&(e.__name__||e.__ename__)&&(i="object"),i){case"function":return"<function>";case"object":if(e.__enum__){let a=Fe[e.__enum__].__constructs__[e._hx_index],o=a._hx_name;return a.__params__?(t=t+" ",o+"("+(function(c){var p;let f=[];{let _=0,d=a.__params__;for(;_<d.length;){let x=d[_];_=_+1,f.push(Q.__string_rec(e[x],t))}}return p=f,p})(this).join(",")+")"):o}if(e instanceof Array){let h="[";t+=" ";let a=0,o=e.length;for(;a<o;){let c=a++;h+=(c>0?",":"")+Q.__string_rec(e[c],t)}return h+="]",h}let s;try{s=e.toString}catch{return"???"}if(s!=null&&s!=Object.toString&&typeof s=="function"){let h=e.toString();if(h!="[object Object]")return h}let n=`{
21
+ `;t+=" ";let l=e.hasOwnProperty!=null,r=null;for(r in e)l&&!e.hasOwnProperty(r)||r=="prototype"||r=="__class__"||r=="__super__"||r=="__interfaces__"||r=="__properties__"||(n.length!=2&&(n+=`,
22
+ `),n+=t+r+" : "+Q.__string_rec(e[r],t));return t=t.substring(1),n+=`
23
+ `+t+"}",n;case"string":return e;default:return String(e)}}static __interfLoop(e,t){if(e==null)return!1;if(e==t)return!0;let i=e.__interfaces__;if(i!=null&&(e.__super__==null||e.__super__.__interfaces__!=i)){let s=0,n=i.length;for(;s<n;){let l=s++,r=i[l];if(r==t||Q.__interfLoop(r,t))return!0}}return Q.__interfLoop(e.__super__,t)}static __instanceof(e,t){if(t==null)return!1;switch(t){case Array:return e instanceof Array;case gn:return typeof e=="boolean";case fn:return e!=null;case mn:return typeof e=="number";case _n:return typeof e=="number"?(e|0)===e:!1;case String:return typeof e=="string";default:if(e!=null){if(typeof t=="function"){if(Q.__downcastCheck(e,t))return!0}else if(typeof t=="object"&&Q.__isNativeObj(t)&&e instanceof t)return!0}else return!1;return t==dn&&e.__name__!=null||t==xn&&e.__ename__!=null?!0:e.__enum__!=null?Fe[e.__enum__]==t:!1}}static __downcastCheck(e,t){return e instanceof t?!0:t.__isInterface__?Q.__interfLoop(Q.getClass(e),t):!1}static __implements(e,t){return Q.__interfLoop(Q.getClass(e),t)}static __cast(e,t){if(e==null||Q.__instanceof(e,t))return e;throw k.thrown("Cannot cast "+Z.string(e)+" to "+Z.string(t))}static __nativeClassName(e){let t=Q.__toStr.call(e).slice(8,-1);return t=="Object"||t=="Function"||t=="Math"||t=="JSON"?null:t}static __isNativeObj(e){return Q.__nativeClassName(e)!=null}static __resolveNativeClass(e){return Gs[e]}}K["js.Boot"]=Q,Q.__name__="js.Boot";class ee{static isArray(e){return e instanceof Array}static arrayLength(e){return e.length}static arrayGet(e,t){let i=t|0,s=e;return i>=0&&i<s.length?s[i]:null}static arraySet(e,t,i){let s=t|0,n=e;n[s]=i}static createArray(){return[]}static arrayPush(e,t){e.push(t)}static arrayPop(e){return e.pop()}static arrayShift(e){return e.shift()}static arrayInsert(e,t,i){e.splice(t,0,i)}static arrayRemoveAt(e,t){e.splice(t,1)}static getIterator(e){return new bi(e)}static arrayCopy(e){let t=ee.arrayLength(e),i=ee.createArray(),s=0,n=t;for(;s<n;){let l=s++;ee.arrayPush(i,ee.arrayGet(e,l))}return i}static arraySort(e,t){let i=ee.arrayLength(e),s=1,n=i;for(;s<n;){let l=s++,r=ee.arrayGet(e,l),h=l-1;for(;h>=0&&t(ee.arrayGet(e,h),r)>0;)ee.arraySet(e,h+1,ee.arrayGet(e,h)),--h;ee.arraySet(e,h+1,r)}}static arrayReverse(e){let t=0,i=ee.arrayLength(e)-1;for(;t<i;){let s=ee.arrayGet(e,t);ee.arraySet(e,t,ee.arrayGet(e,i)),ee.arraySet(e,i,s),++t,--i}}static arrayJoin(e,t){let i=ee.arrayLength(e),s="",n=0,l=i;for(;n<l;){let r=n++;r>0&&(s+=t==null?"null":""+t),s+=Z.string(ee.arrayGet(e,r)==null?"null":Z.string(ee.arrayGet(e,r)))}return s}}K["loreline.Arrays"]=ee,ee.__name__="loreline.Arrays";class It{static addQuotes(e){e.each(function(t,i){if(t instanceof Tt){let s=t;if(s.quotes==0){s.quotes=1;let n=0,l=s.parts.length;for(;n<l;){let r=n++,h=s.parts[r].partType;if(h._hx_index==0){let a=h.text,o=It.unquotedRawToQuotedRaw(a);s.parts[r].partType=Le.Raw(o)}}}}})}static removeQuotes(e){e.each(function(t,i){if(t instanceof Tt){let s=t;if(s.quotes==1){let n="",l=0,r=s.parts;for(;l<r.length;){let h=r[l];++l;let a=h.partType;if(a._hx_index==0){let o=a.text;n+=o}}if(It.canSafelyRemoveQuotes(n)){s.quotes=0;let h=0,a=s.parts.length;for(;h<a;){let o=h++,c=s.parts[o].partType;if(c._hx_index==0){let p=c.text,f=It.quotedRawToUnquotedRaw(p);s.parts[o].partType=Le.Raw(f)}}}}}})}static toBraceStyle(e){e.each(function(t,i){if(t instanceof Jt)Q.__cast(t,Jt).style=1;else if(t instanceof Gt)Q.__cast(t,Gt).style=1;else if(t instanceof De)Q.__cast(t,De).style=1;else if(t instanceof fi)Q.__cast(t,fi).style=1;else if(t instanceof Ot)Q.__cast(t,Ot).style=1;else if(t instanceof mi)Q.__cast(t,mi).style=1;else if(t instanceof Oe){let s=t,n=s.literalType;if(n._hx_index==4){let l=n.style;s.literalType=Re.Object(1)}}})}static toPlainStyle(e){e.each(function(t,i){if(t instanceof Jt)Q.__cast(t,Jt).style=0;else if(t instanceof Gt)Q.__cast(t,Gt).style=0;else if(t instanceof De)Q.__cast(t,De).style=0;else if(t instanceof fi)Q.__cast(t,fi).style=0;else if(t instanceof Ot)Q.__cast(t,Ot).style=0;else if(t instanceof mi)Q.__cast(t,mi).style=0;else if(t instanceof Oe){let s=t,n=s.literalType;if(n._hx_index==4){let l=n.style;s.literalType=Re.Object(0)}}})}static useWordOperators(e){e.each(function(t,i){if(t instanceof Xt){let s=t,n=s.op;switch(n._hx_index){case 36:let l=n.word;s.op=g.OpAnd(!0);break;case 37:let r=n.word;s.op=g.OpOr(!0);break;default:}}})}static useSymbolOperators(e){e.each(function(t,i){if(t instanceof Xt){let s=t,n=s.op;switch(n._hx_index){case 36:let l=n.word;s.op=g.OpAnd(!1);break;case 37:let r=n.word;s.op=g.OpOr(!1);break;default:}}})}static useParenConditions(e){e.each(function(t,i){t instanceof gi?Q.__cast(t,gi).conditionStyle=2:t instanceof Ot&&(Q.__cast(t,Ot).conditionStyle=2)})}static usePlainConditions(e){e.each(function(t,i){t instanceof gi?Q.__cast(t,gi).conditionStyle=0:t instanceof Ot&&(Q.__cast(t,Ot).conditionStyle=0)})}static reindentFunctions(e,t,i){e.each(function(s,n){if(s instanceof Di){let l=s;l.code!=null&&l.code.length>0&&!l.external&&(l.code=It.reindentCode(l.code,t,i))}})}static insertLocalizationKeys(e,t){let i=new as,s=e.split(`
24
+ `),n=Object.create(null);t.each(function(a,o){if(a instanceof be){let c=a;if(c.trailingComments!=null){let p=0,f=c.trailingComments;for(;p<f.length;){let _=f[p];if(++p,_.isHash){let d=Te.trim(_.content);n[d]=!0}}}if(c.leadingComments!=null){let p=0,f=c.leadingComments;for(;p<f.length;){let _=f[p];if(++p,_.isHash){let d=Te.trim(_.content);n[d]=!0}}}}});let l=[];if(t.each(function(a,o){let c=null;if(a instanceof oi?c=Q.__cast(a,oi).content:a instanceof hi?c=Q.__cast(a,hi).content:a instanceof Ot&&(c=Q.__cast(a,Ot).text),c!=null){let f=It.getStringEndLine(c)-1;if(f>=0&&f<s.length&&It.lineHasHashComment(s[f]))return;let _,d=0;do _=It.randomId(i,4+(d*.01|0)),++d;while(Object.prototype.hasOwnProperty.call(n,_));n[_]=!0,l.push({offset:c.pos.offset+c.pos.length,text:" #"+_})}}),l.length==0)return e;l.sort(function(a,o){return o.offset-a.offset});let r=e,h=0;for(;h<l.length;){let a=l[h];++h;let o=a.offset,c=a.offset,p=null;r=(o!=null?u.substr(r,0,o):u.substr(r,0,null))+a.text+(p!=null?u.substr(r,c,p):u.substr(r,c,null))}return r}static removeLocalizationKeys(e,t){let i=[];if(t.each(function(l,r){if(l instanceof be){let h=l,a=h.trailingComments;if(a!=null){let c=0;for(;c<a.length;){let p=a[c];if(++c,p.isHash){let f=p.pos.offset,_=p.pos.offset+p.pos.length;for(;f>0;){let d=u.cca(e,f-1);if(d==32||d==9)--f;else break}i.push({start:f,end:_})}}}let o=h.leadingComments;if(o!=null){let c=0;for(;c<o.length;){let p=o[c];if(++c,p.isHash){let f=p.pos.offset,_=p.pos.offset+p.pos.length;for(;f>0;){let d=u.cca(e,f-1);if(d==32||d==9)--f;else break}i.push({start:f,end:_})}}}}}),i.length==0)return e;i.sort(function(l,r){return r.start-l.start});let s=e,n=0;for(;n<i.length;){let l=i[n];++n;let r=l.start,h=l.end,a=null;s=(r!=null?u.substr(s,0,r):u.substr(s,0,null))+(a!=null?u.substr(s,h,a):u.substr(s,h,null))}return s}static lineHasHashComment(e){let t=0;for(;t<e.length;){if(u.cca(e,t)==35){if(t+1<e.length&&u.cca(e,t+1)==35){t+=2;continue}if(t>0&&u.cca(e,t-1)==92){++t;continue}let i=t+1;for(;i<e.length;){let s=u.cca(e,i);if(s>=97&&s<=122||s>=65&&s<=90||s>=48&&s<=57||s==95||s==45)++i;else break}if(i>t+1)return!0}++t}return!1}static extractTranslations(e){let t=new me;return e.each(function(i,s){let n=null,l=null;if(i instanceof oi?(l=i,n=Q.__cast(i,oi).content):i instanceof hi&&(l=i,n=Q.__cast(i,hi).content),n!=null&&l!=null){let r=It.findHashComment(l,n);r!=null&&(t.h[r]=n)}}),t}static extractTranslatableEntries(e){let t=[];return e.each(function(i,s){let n=null,l=null;if(i instanceof oi)n=i,l=Q.__cast(i,oi).content;else if(i instanceof hi)n=i,l=Q.__cast(i,hi).content;else if(i instanceof Ot){let r=i;r.text!=null&&(n=i,l=r.text)}if(l!=null&&n!=null){let r=It.findHashComment(n,l);r!=null&&t.push({id:r,str:l})}}),t}static generateTranslationFile(e,t,i){let s=It.extractTranslatableEntries(e),n="",l=!0;n+=`
25
+ `;let r=0;for(;r<s.length;){let h=s[r];++r,l||(n+=`
26
+ `),l=!1;let a=i.printStringLiteralAsReference(h.str),o=i.printStringLiteralAsText(h.str);n+="#",n+=Z.string(h.id),n+=" // ",n+=a==null?"null":""+a,n+=`
27
+ `,t!=null&&Object.prototype.hasOwnProperty.call(t.h,h.id)?n+=Z.string(i.printStringLiteralAsText(t.h[h.id])):n+=o==null?"null":""+o,n+=`
28
+ `}return n}static unquotedRawToQuotedRaw(e){let t="",i=0;for(;i<e.length;){let s=u.cca(e,i);if(s==92&&i+1<e.length){let n=u.cca(e,i+1);n==110||n==116||n==114||n==92||n==60?(t+=String.fromCodePoint(s),t+=String.fromCodePoint(n),i+=2):(t+=String.fromCodePoint(n),i+=2)}else s==34?(t+='\\"',++i):(t+=String.fromCodePoint(s),++i)}return t}static quotedRawToUnquotedRaw(e){let t="",i=0;for(;i<e.length;){let s=u.cca(e,i);if(s==92&&i+1<e.length){let n=u.cca(e,i+1);n==34?(t+=String.fromCodePoint(n),i+=2):(t+=String.fromCodePoint(s),t+=String.fromCodePoint(n),i+=2)}else t+=String.fromCodePoint(s),++i}return t}static canSafelyRemoveQuotes(e){if(e.length==0||e.indexOf(`
29
+ `)!=-1||e.indexOf("{")!=-1)return!1;let t=u.cca(e,0);if(t==40||t==91||t==123||t==125||t==93||t==58||t==61)return!1;if(e.length>=2&&t==47){let l=u.cca(e,1);if(l==47||l==42)return!1}if(e.length>=2&&t==45&&u.cca(e,1)==62||t==43&&e.length>=3&&u.cca(e,1)==32)return!1;let i=["beat ","state ","character ","choice ","import ","new ","function ","if ","else "],s=0;for(;s<i.length;){let l=i[s];if(++s,e.startsWith(l))return!1}let n=e.indexOf(":");if(n>0){let l=!0,r=0,h=n;for(;r<h;){let a=r++,o=u.cca(e,a);if(!(o>=97&&o<=122||o>=65&&o<=90||o>=48&&o<=57||o==95)){l=!1;break}}if(l)return!1}return!(e=="null"||e=="true"||e=="false"||It.isNumberLiteral(e)||e.length>=2&&u.cca(e,1)==61&&(t==43||t==45||t==42||t==47))}static isNumberLiteral(e){if(e.length==0)return!1;let t=0;if(u.cca(e,0)==45&&++t,t>=e.length)return!1;let i=!1,s=!1;for(;t<e.length;){let n=u.cca(e,t);if(n>=48&&n<=57)i=!0;else if(n==46&&!s)s=!0;else return!1;++t}return i}static reindentCode(e,t,i){if(t==i)return e;let s=e.split(`
30
+ `),n="",l=0,r=s.length;for(;l<r;){let h=l++;h>0&&(n+=`
31
+ `);let a=s[h],o=0,c=0;for(;u.substr(a,c,null).startsWith(t);)++o,c+=t.length;let p=0,f=o;for(;p<f;){let _=p++;n+=i==null?"null":""+i}n+=Z.string(u.substr(a,c,null))}return n}static getStringEndLine(e){let t=e.pos.line,i=0,s=e.parts;for(;i<s.length;){let n=s[i];if(++i,n.pos!=null){let l=n.pos.line,r=n.partType;if(r._hx_index==0){let h=r.text,a=0;for(;a<h.length;)u.cca(h,a)==10&&++l,++a}l>t&&(t=l)}}return t}static findHashComment(e,t){if(e.trailingComments!=null){let i=0,s=e.trailingComments;for(;i<s.length;){let n=s[i];if(++i,n.isHash)return Te.trim(n.content)}}if(e.leadingComments!=null){let i=0,s=e.leadingComments;for(;i<s.length;){let n=s[i];if(++i,n.isHash)return Te.trim(n.content)}}if(t!=null){if(t.trailingComments!=null){let i=0,s=t.trailingComments;for(;i<s.length;){let n=s[i];if(++i,n.isHash)return Te.trim(n.content)}}if(t.leadingComments!=null){let i=0,s=t.leadingComments;for(;i<s.length;){let n=s[i];if(++i,n.isHash)return Te.trim(n.content)}}}return null}static randomId(e,t){let i="",s=0,n=t;for(;s<n;){let o=s++,c=u.cca(It.randomId_chars,Math.floor(36*((e.seed=e.seed*16807%2147483647)/2147483647+233e-12)));i+=String.fromCodePoint(c)}let l=i,r=!0,h=0,a=l.length;for(;h<a;){let o=h++,c=u.cca(l,o);if(!(c>=48&&c<=57||c>=97&&c<=102)){r=!1;break}}if(r){let o=Math.floor(t*((e.seed=e.seed*16807%2147483647)/2147483647+233e-12)),c=u.cca(It.randomId_nonHexChars,Math.floor(It.randomId_nonHexChars.length*((e.seed=e.seed*16807%2147483647)/2147483647+233e-12)));l=u.substr(l,0,o)+String.fromCodePoint(c)+u.substr(l,o+1,null)}return l}}K["loreline.AstUtils"]=Ji.loreline.AstUtils=It,It.__name__="loreline.AstUtils";class Xi{constructor(e){this.func=e}}K["loreline.Async"]=Xi,Xi.__name__="loreline.Async",Object.assign(Xi.prototype,{__class__:Xi});class ls{static toString(e){switch(e){case 0:return"ObjectBrace";case 1:return"ArrayBracket";case 2:return"Brace";case 3:return"Indent";case 4:return"CaseIndent";case 5:return"Bracket";case 6:return"Paren"}}}class qi{constructor(){this.indentStack=null,this.indentLevel=0,this.inControlWithoutParens=!1,this.inControl=!1,this.currentPosOffset=0,this.posOffsets=null,this.inString=!1,this.inComment=!1,this.indent=0,this.length=0,this.lineOutput=null,this.output=null,this.input=null,this.index=0}process(e){return e=Te.rtrim(e)+`
32
+ //<END>`,this.input=e,this.index=0,this.output=new $t,this.lineOutput=new $t,this.length=e.length,this.indent=0,this.inComment=!1,this.inString=!1,this.posOffsets=[],this.currentPosOffset=0,this.inControl=!1,this.inControlWithoutParens=!1,this.indentStack=[],this.indentLevel=0,this.stack=[],this.processInput(),Te.rtrim(this.output.b)+`
33
+ `}toLorelinePos(e,t,i){let s=this.inputPosFromProcessedPos(t),l=this.inputPosFromProcessedPos(i)+1-s;return e.withOffset(this.input,s,l,e.offset)}inputPosFromProcessedPos(e){return e<0?0:e>=this.posOffsets.length?this.input.length-1-this.posOffsets[this.input.length-1]:e-this.posOffsets[e]}processedPosFromInputPos(e){if(e<0)return 0;if(e>=this.input.length)return this.output.b.length-1;let t=0,i=0,s=this.posOffsets.length;for(;i<s;){let n=i++;if(n-this.posOffsets[n]>e)return n-1;if(n-this.posOffsets[n]==e)return n;t=n}return t}processInput(e){e==null&&(e=-1);let t=0,i=0,s=0;for(;this.index<this.length;){let n=u.cca(this.input,this.index);if(n==34)this.processString();else if(n==39)this.error("Unexpected single quote");else if(n==47){let l=u.cca(this.input,this.index+1);l==47||l==42?this.processComment():this._add(n,!0)}else if(n==13)this._add(n,!0);else if(n==10)this._add(n,!0);else if(n==123)++t,this._add(n,!0);else if(n==125){if(--t,n==e&&t<0)return;this._add(n,!0)}else if(n==91)++i,this._add(n,!0);else if(n==93){if(--i,n==e&&i<0)return;this._add(n,!0)}else if(n==40)++s,this._add(n,!0);else if(n==41){if(--s,n==e&&s<0)return;this._add(n,!0)}else this.isAlphaNumeric(n)&&this.index>0&&!this.isAlphaNumeric(u.cca(this.input,this.index-1))?n==97?u.cca(this.input,this.index+1)==110&&u.cca(this.input,this.index+2)==100&&!this.isAlphaNumeric(u.cca(this.input,this.index+3))?(this._add(38,!0),this._add(38,!0),this._add(32,!0)):this._add(n,!0):n==111?u.cca(this.input,this.index+1)==114&&!this.isAlphaNumeric(u.cca(this.input,this.index+2))?(this._add(124,!0),this._add(124,!0),this._add(32,!0)):this._add(n,!0):this._add(n,!0):this._add(n,!0)}if(e==-1)for(;this.stack.length>0&&(this.stack[this.stack.length-1]==3||this.stack[this.stack.length-1]==4);){let n=this.stack.pop();this.indentStack.pop(),n==3&&(this.currentPosOffset++,this.output.b+=String.fromCodePoint(32),this.posOffsets.push(this.currentPosOffset),this.currentPosOffset++,this.output.b+=String.fromCodePoint(125),this.posOffsets.push(this.currentPosOffset))}}processString(){this.inString=!0,this._add(34,!0);let e=!1;for(;this.index<this.length;){let t=u.cca(this.input,this.index);if(e)this._add(t,!0),e=!1;else if(t==92)e=!0,this._add(92,!0);else if(t==34){this._add(t,!0),this.inString=!1;return}else t==36&&!e?(this.index++,t=u.cca(this.input,this.index),t==123?(this.currentPosOffset--,this._add(34,!1),this._add(43,!1),this._add(40,!0),this.inString=!1,this.processComplexInterpolation(),this.inString=!0,this._add(41,!0),this.currentPosOffset--,this._add(43,!1),this._add(34,!1),this.currentPosOffset++):t>=97&&t<=122||t>=65&&t<=90||t==95?(this.currentPosOffset--,this._add(34,!1),this._add(43,!1),this.processFieldAccessInterpolation(),this.currentPosOffset--,this._add(43,!1),this._add(34,!1),this.currentPosOffset++):t==36?this._add(36,!0):this.error("Expected identifier or { after $")):this._add(t,!0)}this.error("Unterminated string")}processComplexInterpolation(){this.processInput(125)}processFieldAccessInterpolation(){let e=u.cca(this.input,this.index);e>=97&&e<=122||e>=65&&e<=90||e==95||this.error("Expected identifier in field access"),this.processIdentifier();e:for(;this.index<this.length;){let t=u.cca(this.input,this.index);if(t==null)break;switch(t){case 40:this._add(40,!0),this.processInput(41),this._add(41,!0);break;case 46:let i;if(this.index+1<this.length){let s=u.cca(this.input,this.index+1);i=s>=97&&s<=122||s>=65&&s<=90||s==95}else i=!1;if(i)this._add(46,!0),this.processIdentifier();else break e;break;case 91:this._add(91,!0),this.processInput(93);break;default:break e}}}processIdentifier(){for(;this.index<this.length;){let e=u.cca(this.input,this.index);if(!(e>=97&&e<=122||e>=65&&e<=90||e==95||e>=48&&e<=57))break;this._add(e,!0)}}isDigit(e){return e>=48?e<=57:!1}isIdentifierStart(e){return e>=97&&e<=122||e>=65&&e<=90?!0:e==95}isIdentifierPart(e){return e>=97&&e<=122||e>=65&&e<=90||e==95?!0:e>=48?e<=57:!1}processComment(){this.inComment=!0;let e=u.cca(this.input,this.index+1);if(e==47)for(this._add(32,!0),this._add(32,!0);this.index<this.length;){let t=u.cca(this.input,this.index);if(t==13||t==10)break;this._add(32,!0)}else if(e==42)for(this._add(32,!0),this._add(32,!0);this.index<this.length;){let t=u.cca(this.input,this.index);if(t==42&&this.index+1<this.length&&u.cca(this.input,this.index+1)==47){this._add(32,!0),this._add(32,!0);break}else t==13||t==10?this._add(t,!0):this._add(32,!0)}this.inComment=!1}endsWithChar(e,t){if(e.length==0)return!1;let i=Te.rtrim(e),s=i.length;return s>0&&u.cca(i,s-1)==t}followsWithChar(e,t){let i=t,s=!1;for(;i<this.length;){let n=u.cca(this.input,i);if(n==32||n==9||n==10||n==13){++i;continue}if(n==47&&i+1<this.length){let l=u.cca(this.input,i+1);if(l==47){for(i+=2;i<this.length&&u.cca(this.input,i)!=13&&u.cca(this.input,i)!=10;)++i;i<this.length&&++i;continue}if(l==42){for(i+=2;i+1<this.length;){if(u.cca(this.input,i)==42&&u.cca(this.input,i+1)==47){i+=2;break}++i}continue}}s=n==e;break}return s}endsOrFollowsWithChar(e,t,i,s){return this.endsWithChar(e,t)?!0:this.followsWithChar(t,i)}nextLineIndentOffset(e,t){let i=Te.ltrim(e);if(i.length==0)return 0;let s=e.length-i.length,n=-1;for(;t<this.length;){let l=this.input.indexOf(`
34
+ `,t);l==-1&&(l=this.length);let r=this.input,h=l!=null?r.substring(t,l):r.substring(t),a=Te.ltrim(h);if(a.length>0&&(!a.startsWith("//")||a.startsWith("//<END>"))&&!a.startsWith("/*")){let o=h.length-a.length;return a.startsWith("//<END>")&&s==0&&n>0?n-s:o-s}a.length>0&&n==-1&&(n=h.length-a.length),t=l+1}return s==0&&n>0?n-s:0}followsWithIf(e){let t=e;for(;t<this.length;){let i=u.cca(this.input,t);if(i==32||i==9||i==10||i==13){++t;continue}if(i==47&&t+1<this.length){let s=u.cca(this.input,t+1);if(s==47){for(t+=2;t<this.length&&u.cca(this.input,t)!=13&&u.cca(this.input,t)!=10;)++t;continue}if(s==42){for(t+=2;t+1<this.length;){if(u.cca(this.input,t)==42&&u.cca(this.input,t+1)==47){t+=2;break}++t}continue}}return t+1<this.length&&u.cca(this.input,t)==105&&u.cca(this.input,t+1)==102&&(t+2>=this.length||!this.isAlphaNumeric(u.cca(this.input,t+2)))}return!1}endsWithControlKeyword(e,t){let i=Te.rtrim(e);if(i.length==0)return!1;let s=0,n=qi.CONTROL_KEYWORDS;for(;s<n.length;){let l=n[s];if(++s,i.endsWith(l)){let r=e.length-i.length,h=i.length-l.length,a=h==0||!this.isAlphaNumeric(u.cca(i,h-1)),o=t,c=o<this.length&&(r>0||!this.isAlphaNumeric(u.cca(this.input,o)));if(a&&c&&(l!="else"||!this.followsWithIf(t)))return!0}}return!1}endsWithArrayIndexable(e){let t=e.length;if(t==0)return!1;let i=t-1;for(;i>=0;){let n=u.cca(e,i);if(!this.isWhitespace(n))break;--i}if(i<0)return!1;let s=u.cca(e,i);return s==41||s==125||s==93?!0:this.isAlphaNumeric(s)}isWhitespace(e){return e==32||e==10||e==9?!0:e==13}isAlphaNumeric(e){return e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57?!0:e==95}inStatementsBlock(){let e=this.stack.length-1;return e>=0?this.stack[e]==2||this.stack[e]==3?!0:this.stack[e]==4:!0}inObjectBlock(){let e=this.stack.length-1;for(;e>=0;){if(this.stack[e]!=3&&this.stack[e]!=4)return this.stack[e]==0;--e}return!1}inArrayBlock(){let e=this.stack.length-1;for(;e>=0;){if(this.stack[e]!=3&&this.stack[e]!=4)return this.stack[e]==1;--e}return!1}isLabelStart(e){e=this.skipWhitespaceAndComments(e);let t=u.cca(this.input,e);if(!(t>=97&&t<=122||t>=65&&t<=90||t==95))return!1;let i=e;for(++e;;){let r;if(e<this.length){let h=u.cca(this.input,e);r=h>=97&&h<=122||h>=65&&h<=90||h==95||h>=48&&h<=57}else r=!1;if(!r)break;++e}for(;e<this.length&&this.isWhitespace(u.cca(this.input,e));)++e;if(e>=this.length||u.cca(this.input,e)!=58)return!1;let s=this.input,n=e-i;return(n!=null?u.substr(s,i,n):u.substr(s,i,null))!="case"}skipWhitespaceAndComments(e){let t=e,i=!1;for(;e<this.length;){for(;e<this.length&&(u.cca(this.input,e)==32||u.cca(this.input,e)==9||u.cca(this.input,e)==10||u.cca(this.input,e)==13);)++e,i=!0;if(e<this.length-1&&u.cca(this.input,e)==47){if(u.cca(this.input,e+1)==47)return e=t,e;if(u.cca(this.input,e+1)==42){e+=2,i=!0;let s=!1;for(;e<this.length-1;){if(u.cca(this.input,e)==42&&u.cca(this.input,e+1)==47){e+=2,s=!0;break}++e}if(!s)return e=t,e;continue}}break}return i?e:t}stackPush(e){this.stack.push(e)}stackPop(){return this.stack.pop()}_add(e,t){if(t?this.index++:this.currentPosOffset++,this.inString)this.lineOutput.b+=String.fromCodePoint(e==34?e:32),this.output.b+=String.fromCodePoint(e),this.posOffsets.push(this.currentPosOffset);else if(e==13||e==10){this.inControlWithoutParens&&(this.inControlWithoutParens=!1,this.stack.pop()!=6&&this.error("Unexpected end of line"),this.currentPosOffset++,this.lineOutput.b+=String.fromCodePoint(41),this.output.b+=String.fromCodePoint(41),this.posOffsets.push(this.currentPosOffset)),this.inControl=!1;let i=this.lineOutput.b;if(this.lineOutput=new $t,this.inStatementsBlock()||this.inObjectBlock()||this.inArrayBlock()){let s=this.nextLineIndentOffset(i,this.index);if(Te.trim(i).length!=0)if(s>0&&!this.endsOrFollowsWithChar(i,123,this.index,{fileName:"src/loreline/CodeToHscript.hx",lineNumber:1061,className:"loreline.CodeToHscript",methodName:"_add"})&&!this.endsOrFollowsWithChar(i,91,this.index,{fileName:"src/loreline/CodeToHscript.hx",lineNumber:1061,className:"loreline.CodeToHscript",methodName:"_add"})){let n=Te.ltrim(i);n.startsWith("case ")||n.startsWith("case ")||n=="default"||n.startsWith("default ")||n.startsWith("default ")?(this.stack.push(4),this.indentLevel+=s,this.indentStack.push(this.indentLevel),this.currentPosOffset++,this.output.b+=String.fromCodePoint(58),this.posOffsets.push(this.currentPosOffset)):(this.stack.push(3),this.indentLevel+=s,this.indentStack.push(this.indentLevel),this.currentPosOffset++,this.output.b+=String.fromCodePoint(32),this.posOffsets.push(this.currentPosOffset),this.currentPosOffset++,this.output.b+=String.fromCodePoint(123),this.posOffsets.push(this.currentPosOffset))}else if(s<0&&this.stack.length>0&&(this.stack[this.stack.length-1]==3||this.stack[this.stack.length-1]==4)){!this.inObjectBlock()&&!this.endsOrFollowsWithChar(i,59,this.index,{fileName:"src/loreline/CodeToHscript.hx",lineNumber:1090,className:"loreline.CodeToHscript",methodName:"_add"})&&(this.currentPosOffset++,this.output.b+=String.fromCodePoint(59),this.posOffsets.push(this.currentPosOffset)),this.indentLevel+=s;let n=!0;for(;this.indentStack[this.indentStack.length-1]>this.indentLevel&&this.stack.length>0&&(this.stack[this.stack.length-1]==3||this.stack[this.stack.length-1]==4);){let l=this.stack.pop();this.indentStack.pop(),l==3&&(n&&(n=!1,this.currentPosOffset++,this.output.b+=String.fromCodePoint(32),this.posOffsets.push(this.currentPosOffset)),this.currentPosOffset++,this.output.b+=String.fromCodePoint(125),this.posOffsets.push(this.currentPosOffset))}}else s==0&&!this.endsOrFollowsWithChar(i,59,this.index,{fileName:"src/loreline/CodeToHscript.hx",lineNumber:1115,className:"loreline.CodeToHscript",methodName:"_add"})&&!this.endsOrFollowsWithChar(i,44,this.index,{fileName:"src/loreline/CodeToHscript.hx",lineNumber:1115,className:"loreline.CodeToHscript",methodName:"_add"})&&(this.inObjectBlock()?(this.currentPosOffset++,this.output.b+=String.fromCodePoint(44),this.posOffsets.push(this.currentPosOffset)):this.inArrayBlock()?(this.currentPosOffset++,this.output.b+=String.fromCodePoint(44),this.posOffsets.push(this.currentPosOffset)):(this.currentPosOffset++,this.output.b+=String.fromCodePoint(59),this.posOffsets.push(this.currentPosOffset)))}this.output.b+=String.fromCodePoint(e),this.posOffsets.push(this.currentPosOffset)}else if(!this.inControl&&!this.isWhitespace(e)&&this.endsWithControlKeyword(this.lineOutput.b,this.index-1))this.inControl=!0,this.followsWithChar(40,this.index-1)?e==40&&this.stack.push(6):(this.inControlWithoutParens=!0,this.stack.push(6),this.currentPosOffset++,this.lineOutput.b+=String.fromCodePoint(e),this.output.b+=String.fromCodePoint(40),this.posOffsets.push(this.currentPosOffset)),this.lineOutput.b+=String.fromCodePoint(e),this.output.b+=String.fromCodePoint(e),this.posOffsets.push(this.currentPosOffset);else{if(e==40)this.stack.push(6);else if(e==41)this.stack.pop()!=6&&this.error("Unexpected: )");else if(e==91)this.endsWithArrayIndexable(this.lineOutput.b)?this.stack.push(5):this.stack.push(1);else if(e==93){let i=this.stack.pop();i!=5&&i!=1&&this.error("Unexpected: ]")}else if(e==123)this.isLabelStart(this.index)?this.stack.push(0):this.stack.push(2);else if(e==125){let i=this.stack.pop();i!=2&&i!=0&&this.error("Unexpected: }")}this.lineOutput.b+=String.fromCodePoint(e),this.output.b+=String.fromCodePoint(e),this.posOffsets.push(this.currentPosOffset)}}error(e){throw k.thrown(new li(e,z.fromContentAndIndex(this.input,this.index)))}}K["loreline.CodeToHscript"]=qi,qi.__name__="loreline.CodeToHscript",Object.assign(qi.prototype,{__class__:qi});class Ci{static equal(e,t,i){return t==i?!0:ee.isArray(t)?ee.isArray(i)?Ci.arrayEqual(e,t,i):!1:t instanceof me?i instanceof me?Ci.stringMapEqual(e,t,i):!1:t instanceof Ri?i instanceof Ri?Ci.intMapEqual(e,t,i):!1:le.isFields(t)&&le.isFields(i)?Ci.objectFieldsEqual(e,t,i):!1}static objectFieldsEqual(e,t,i){let s=0,n=le.getFields(e,t);for(;s<n.length;){let h=n[s];if(++s,!le.fieldExists(e,i,h)||!Ci.equal(e,le.getField(e,t,h),le.getField(e,i,h)))return!1}let l=0,r=le.getFields(e,i);for(;l<r.length;){let h=r[l];if(++l,!le.fieldExists(e,t,h))return!1}return!0}static arrayEqual(e,t,i){let s=ee.arrayLength(t),n=ee.arrayLength(i);if(s!=n)return!1;let l=0,r=s;for(;l<r;){let h=l++;if(!Ci.equal(e,ee.arrayGet(t,h),ee.arrayGet(i,h)))return!1}return!0}static stringMapEqual(e,t,i){let s=t.h,n=s,l=Object.keys(s),r=l.length,h=0;for(;h<r;){let _=l[h++],d=_,x=n[_],y=d,b=x;if(!Object.prototype.hasOwnProperty.call(i.h,y)||!Ci.equal(e,i.h[y],b))return!1}let a=i.h,o=a,c=Object.keys(a),p=c.length,f=0;for(;f<p;){let _=c[f++];if(!Object.prototype.hasOwnProperty.call(t.h,_))return!1}return!0}static intMapEqual(e,t,i){let s=t,n=s,l=s.keys();for(;l.hasNext();){let h=l.next(),a=n.get(h),c=h,p=a;if(!i.h.hasOwnProperty(c)||!Ci.equal(e,i.h[c],p))return!1}let r=i.keys();for(;r.hasNext();){let h=r.next();if(!t.h.hasOwnProperty(h))return!1}return!0}}K["loreline.Equal"]=Ci,Ci.__name__="loreline.Equal";class li{constructor(e,t){this.message=e,this.pos=t,this.stack=cn.callStack()}toString(){return this.pos!=null?""+this.message+" at "+this.pos.toString():this.message}}K["loreline.Error"]=li,li.__name__="loreline.Error",Object.assign(li.prototype,{__class__:li});class Ei{}K["loreline.Fields"]=Ji.loreline.Fields=Ei,Ei.__name__="loreline.Fields",Ei.__isInterface__=!0,Object.assign(Ei.prototype,{__class__:Ei});class Os{constructor(e){this._random=null,this.interpreter=e}bindAll(e){e.h.floor=_e(this,this.floor),e.h.ceil=_e(this,this.ceil),e.h.round=_e(this,this.round),e.h.abs=_e(this,this.abs),e.h.min=_e(this,this.min),e.h.max=_e(this,this.max),e.h.clamp=_e(this,this.clamp),e.h.pow=_e(this,this.pow),e.h.random=_e(this,this.random),e.h.chance=_e(this,this.chance),e.h.seed_random=_e(this,this.seed_random),e.h.random_float=_e(this,this.random_float),e.h.wait=_e(this,this.wait),e.h.float=_e(this,this.float_),e.h.string=_e(this,this.string_),e.h.bool=_e(this,this.bool),e.h.string_length=_e(this,this.string_length),e.h.string_upper=_e(this,this.string_upper),e.h.string_lower=_e(this,this.string_lower),e.h.string_contains=_e(this,this.string_contains),e.h.string_replace=_e(this,this.string_replace),e.h.string_split=_e(this,this.string_split),e.h.string_trim=_e(this,this.string_trim),e.h.string_index=_e(this,this.string_index),e.h.string_sub=_e(this,this.string_sub),e.h.string_starts=_e(this,this.string_starts),e.h.string_ends=_e(this,this.string_ends),e.h.string_repeat=_e(this,this.string_repeat),e.h.plural=_e(this,this.plural),e.h.array_length=_e(this,this.array_length),e.h.array_add=_e(this,this.array_add),e.h.array_pop=_e(this,this.array_pop),e.h.array_prepend=_e(this,this.array_prepend),e.h.array_shift=_e(this,this.array_shift),e.h.array_remove=_e(this,this.array_remove),e.h.array_index=_e(this,this.array_index),e.h.array_has=_e(this,this.array_has),e.h.array_sort=_e(this,this.array_sort),e.h.array_reverse=_e(this,this.array_reverse),e.h.array_join=_e(this,this.array_join),e.h.array_pick=_e(this,this.array_pick),e.h.array_shuffle=_e(this,this.array_shuffle),e.h.array_copy=_e(this,this.array_copy),e.h.map_length=_e(this,this.map_length),e.h.map_keys=_e(this,this.map_keys),e.h.map_has=_e(this,this.map_has),e.h.map_get=_e(this,this.map_get),e.h.map_set=_e(this,this.map_set),e.h.map_remove=_e(this,this.map_remove),e.h.map_copy=_e(this,this.map_copy),e.h.current_beat=_e(this,this.current_beat),e.h.has_beat=_e(this,this.has_beat)}rng(){this._random==null&&(this._random=new as);let e=this._random;return(e.seed=e.seed*16807%2147483647)/2147483647+233e-12}floor(e){return Math.floor(e)}ceil(e){return Math.ceil(e)}round(e){return Math.round(e)}abs(e){return Math.abs(e)}min(e,t){return Math.min(e,t)}max(e,t){return Math.max(e,t)}clamp(e,t,i){return Math.max(t,Math.min(i,e))}pow(e,t){return Math.pow(e,t)}random(e,t){return Math.floor(e+this.rng()*(t+1-e))}chance(e){return Math.floor(this.rng()*e)==0}seed_random(e){return this._random=new as(e),null}random_float(e,t){return e+this.rng()*(t-e)}wait(e){return new Xi(function(t){t()})}float_(e){return typeof e=="number"?e:typeof e=="number"&&(e|0)===e?e*1:typeof e=="string"?parseFloat(e):typeof e=="boolean"&&e?1:0}string_(e){return e==null?"null":typeof e=="string"?e:e==null?"null":Z.string(e)}bool(e){return typeof e=="boolean"?e:typeof e=="string"||e instanceof Array?e.length>0:typeof e=="number"&&(e|0)===e||typeof e=="number"?e!=0:e!=null}string_length(e){return e.length}string_upper(e){return e.toUpperCase()}string_lower(e){return e.toLowerCase()}string_contains(e,t){return e.includes(t)}string_replace(e,t,i){return Te.replace(e,t,i)}string_split(e,t){return e.split(t)}string_trim(e){return Te.trim(e)}string_index(e,t){return e.indexOf(t)}string_sub(e,t,i){return u.substr(e,t|0,i|0)}string_starts(e,t){return e.startsWith(t)}string_ends(e,t){return e.endsWith(t)}string_repeat(e,t){let i="",s=0;for(;s<t;)i+=e==null?"null":""+e,++s;return i}plural(e,t,i){let s=0;return typeof e=="number"&&(e|0)===e?s=e*1:typeof e=="number"&&(s=e),s==1?t:i}array_length(e){return ee.isArray(e)?ee.arrayLength(e):0}array_add(e,t){return ee.arrayPush(e,t),null}array_pop(e){return ee.isArray(e)?ee.arrayPop(e):null}array_prepend(e,t){return ee.isArray(e)&&ee.arrayInsert(e,0,t),null}array_shift(e){return ee.isArray(e)?ee.arrayShift(e):null}array_remove(e,t){if(ee.isArray(e)){let i=ee.arrayLength(e),s=0,n=i;for(;s<n;){let l=s++;if(ee.arrayGet(e,l)==t)return ee.arrayRemoveAt(e,l),!0}}return!1}array_index(e,t){if(ee.isArray(e)){let i=ee.arrayLength(e),s=0,n=i;for(;s<n;){let l=s++;if(ee.arrayGet(e,l)==t)return l}}return-1}array_has(e,t){if(ee.isArray(e)){let i=ee.arrayLength(e),s=0,n=i;for(;s<n;){let l=s++;if(ee.arrayGet(e,l)==t)return!0}}return!1}array_sort(e){return ee.isArray(e)&&ee.arraySort(e,function(t,i){return typeof t=="number"&&typeof i=="number"||typeof t=="number"&&(t|0)===t&&typeof i=="number"&&(i|0)===i?t<i?-1:t>i?1:0:(t==null?"null":Z.string(t))<(i==null?"null":Z.string(i))?-1:(t==null?"null":Z.string(t))>(i==null?"null":Z.string(i))?1:0}),e}array_reverse(e){return ee.isArray(e)&&ee.arrayReverse(e),e}array_join(e,t){return ee.isArray(e)?ee.arrayJoin(e,t):""}array_pick(e){if(ee.isArray(e)){let t=ee.arrayLength(e);if(t==0)return null;let i=Math.floor(this.rng()*t);return ee.arrayGet(e,i)}return null}array_shuffle(e){if(ee.isArray(e)){let t=ee.arrayLength(e)-1;for(;t>0;){let i=Math.floor(this.rng()*(t+1)),s=ee.arrayGet(e,t);ee.arraySet(e,t,ee.arrayGet(e,i)),ee.arraySet(e,i,s),--t}}return e}array_copy(e){return ee.isArray(e)?ee.arrayCopy(e):e}map_length(e){return le.getFields(this.interpreter,e).length}map_keys(e){let t=le.getFields(this.interpreter,e);return t.sort(function(i,s){return i<s?-1:i>s?1:0}),t}map_has(e,t){return le.fieldExists(this.interpreter,e,t)}map_get(e,t){return le.getField(this.interpreter,e,t)}map_set(e,t,i){return le.setField(this.interpreter,e,t,i),null}map_remove(e,t){return le.fieldExists(this.interpreter,e,t)?le.removeField(this.interpreter,e,t):!1}map_copy(e){let t=le.getFields(this.interpreter,e),i=le.createFields(this.interpreter),s=0;for(;s<t.length;){let n=t[s];++s,le.setField(this.interpreter,i,n,le.getField(this.interpreter,e,n))}return i}current_beat(){let e=this.interpreter.stack.length-1;for(;e>=0;){let t=this.interpreter.stack[e];if(t.beat!=null)return t.beat.name;--e}return null}has_beat(e){let t=this.interpreter.stack.length-1;for(;t>=0;){let i=this.interpreter.stack[t];if(i.beat!=null&&i.beat.body!=null){let s=0,n=i.beat.body;for(;s<n.length;){let l=n[s];if(++s,l instanceof De&&l.name==e)return!0}}--t}return Object.prototype.hasOwnProperty.call(this.interpreter.topLevelBeats.h,e)}}K["loreline.Functions"]=Os,Os.__name__="loreline.Functions",Object.assign(Os.prototype,{__class__:Os});var Si=Fe["loreline._HscriptInterp.Stop"]={__ename__:"loreline._HscriptInterp.Stop",__constructs__:null,SBreak:{_hx_name:"SBreak",_hx_index:0,__enum__:"loreline._HscriptInterp.Stop",toString:C},SContinue:{_hx_name:"SContinue",_hx_index:1,__enum__:"loreline._HscriptInterp.Stop",toString:C},SReturn:{_hx_name:"SReturn",_hx_index:2,__enum__:"loreline._HscriptInterp.Stop",toString:C}};Si.__constructs__=[Si.SBreak,Si.SContinue,Si.SReturn];class Ns{constructor(e){this.interpreter=e,this.locals=new me,this.declared=[],this.resetVariables(),this.initOps()}resetVariables(){this.variables=new me,this.variables.h.null=null,this.variables.h.true=!0,this.variables.h.false=!1;let e=this,t=this.variables,i=Pe.makeVarArgs(function(s){let n=e.posInfos(),l=s.shift();s.length>0&&(n.customParams=s),Es.trace(Z.string(l),n)});t.h.trace=i}posInfos(){return this.curExpr!=null?{fileName:this.curExpr.origin,lineNumber:this.curExpr.line}:{fileName:"hscript",lineNumber:0}}initOps(){let e=this;this.binops=new me,this.binops.h["+"]=function(t,i){return e.expr(t)+e.expr(i)},this.binops.h["-"]=function(t,i){return e.expr(t)-e.expr(i)},this.binops.h["*"]=function(t,i){return e.expr(t)*e.expr(i)},this.binops.h["/"]=function(t,i){return e.expr(t)/e.expr(i)},this.binops.h["%"]=function(t,i){return e.expr(t)%e.expr(i)},this.binops.h["&"]=function(t,i){return e.expr(t)&e.expr(i)},this.binops.h["|"]=function(t,i){return e.expr(t)|e.expr(i)},this.binops.h["^"]=function(t,i){return e.expr(t)^e.expr(i)},this.binops.h["<<"]=function(t,i){return e.expr(t)<<e.expr(i)},this.binops.h[">>"]=function(t,i){return e.expr(t)>>e.expr(i)},this.binops.h[">>>"]=function(t,i){return e.expr(t)>>>e.expr(i)},this.binops.h["=="]=function(t,i){return e.expr(t)==e.expr(i)},this.binops.h["!="]=function(t,i){return e.expr(t)!=e.expr(i)},this.binops.h[">="]=function(t,i){let s=e.expr(t),n=e.expr(i);return s>=n},this.binops.h["<="]=function(t,i){let s=e.expr(t),n=e.expr(i);return s<=n},this.binops.h[">"]=function(t,i){let s=e.expr(t),n=e.expr(i);return s>n},this.binops.h["<"]=function(t,i){let s=e.expr(t),n=e.expr(i);return s<n},this.binops.h["||"]=function(t,i){return e.expr(t)!=!0?e.expr(i)==!0:!0},this.binops.h["&&"]=function(t,i){return e.expr(t)==!0?e.expr(i)==!0:!1},this.binops.h["="]=_e(this,this.assign),this.binops.h["..."]=function(t,i){return new Cs(e.expr(t),e.expr(i))},this.binops.h.is=function(t,i){return Q.__instanceof(e.expr(t),e.expr(i))},this.assignOp("+=",function(t,i){return t+i}),this.assignOp("-=",function(t,i){return t-i}),this.assignOp("*=",function(t,i){return t*i}),this.assignOp("/=",function(t,i){return t/i}),this.assignOp("%=",function(t,i){return t%i}),this.assignOp("&=",function(t,i){return t&i}),this.assignOp("|=",function(t,i){return t|i}),this.assignOp("^=",function(t,i){return t^i}),this.assignOp("<<=",function(t,i){return t<<i}),this.assignOp(">>=",function(t,i){return t>>i}),this.assignOp(">>>=",function(t,i){return t>>>i})}setVar(e,t){if(!Object.prototype.hasOwnProperty.call(this.variables.h,e))le.setField(this.interpreter,this.interpreter.topLevelState.fields,e,t);else throw k.thrown("Invalid assign");return t}assign(e,t){let i=this.expr(t),s=e.e;switch(s._hx_index){case 1:let n=s.v,l=this.locals.h[n];l==null?this.setVar(n,i):l.r=i;break;case 5:let r=s.e,h=s.f;i=this.set(this.expr(r),h,i);break;case 16:let a=s.e,o=s.index,c=this.expr(a),p=this.expr(o);ee.isArray(c)?ee.arraySet(c,p,i):le.isFields(c)?le.setField(this.interpreter,c,p,i):Q.__implements(c,ft)?Q.__cast(c,ft).set(p,i):c[p]=i;break;default:let f=new ce(oe.EInvalidOp("="),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw k.thrown(f)}return i}assignOp(e,t){let i=this;this.binops.h[e]=function(s,n){return i.evalAssignOp(e,t,s,n)}}evalAssignOp(e,t,i,s){let n,l=i.e;switch(l._hx_index){case 1:let r=l.v,h=this.locals.h[r];n=t(this.expr(i),this.expr(s)),h==null?this.setVar(r,n):h.r=n;break;case 5:let a=l.e,o=l.f,c=this.expr(a);n=t(this.get(c,o),this.expr(s)),n=this.set(c,o,n);break;case 16:let p=l.e,f=l.index,_=this.expr(p),d=this.expr(f);ee.isArray(_)?(n=t(ee.arrayGet(_,d),this.expr(s)),ee.arraySet(_,d,n)):le.isFields(_)?(n=t(le.getField(this.interpreter,_,d),this.expr(s)),le.setField(this.interpreter,_,d,n)):Q.__implements(_,ft)?(n=t(Q.__cast(_,ft).get(d),this.expr(s)),Q.__cast(_,ft).set(d,n)):(n=t(_[d],this.expr(s)),_[d]=n);break;default:let x=new ce(oe.EInvalidOp(e),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw k.thrown(x)}return n}increment(e,t,i){this.curExpr=e;let s=e.e;switch(s._hx_index){case 1:let n=s.v,l=this.locals.h[n],r=l==null?this.resolve(n):l.r;return t?(r+=i,l==null?this.setVar(n,r):l.r=r):l==null?this.setVar(n,r+i):l.r=r+i,r;case 5:let h=s.e,a=s.f,o=this.expr(h),c=this.get(o,a);return t?(c+=i,this.set(o,a,c)):this.set(o,a,c+i),c;case 16:let p=s.e,f=s.index,_=this.expr(p),d=this.expr(f);if(ee.isArray(_)){let y=ee.arrayGet(_,d);return t?(y+=i,ee.arraySet(_,d,y)):ee.arraySet(_,d,y+i),y}else if(le.isFields(_)){let y=le.getField(this.interpreter,_,d);return t?(y+=i,le.setField(this.interpreter,_,d,y)):le.setField(this.interpreter,_,d,y+i),y}else if(Q.__implements(_,ft)){let y=Q.__cast(_,ft).get(d);return t?(y+=i,Q.__cast(_,ft).set(d,y)):Q.__cast(_,ft).set(d,y+i),y}else{let y=_[d];return t?(y+=i,_[d]=y):_[d]=y+i,y}break;default:let x=new ce(oe.EInvalidOp(i>0?"++":"--"),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw k.thrown(x)}}execute(e){return this.depth=0,this.locals=new me,this.declared=[],this.exprReturn(e)}exprReturn(e){try{return this.expr(e)}catch(t){let i=k.caught(t).unwrap();if(Q.__instanceof(i,Si))switch(i._hx_index){case 0:throw k.thrown("Invalid break");case 1:throw k.thrown("Invalid continue");case 2:let n=this.returnValue;return this.returnValue=null,n}else throw t}}duplicate(e){let t=new me,i=e.h,s=i,n=Object.keys(i),l=n.length,r=0;for(;r<l;){let h=n[r++];t.h[h]=e.h[h]}return t}restore(e){for(;this.declared.length>e;){let t=this.declared.pop();this.locals.h[t.n]=t.old}}error(e,t){t==null&&(t=!1);let i=new ce(e,this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw k.thrown(i)}rethrow(e){throw k.thrown(e)}resolve(e){let t=this.variables.h[e];if(t==null&&!Object.prototype.hasOwnProperty.call(this.variables.h,e)){if(le.fieldExists(this.interpreter,this.interpreter.topLevelState.fields,e))return le.getField(this.interpreter,this.interpreter.topLevelState.fields,e);if(Object.prototype.hasOwnProperty.call(this.interpreter.topLevelCharacters.h,e))return this.interpreter.topLevelCharacters.h[e].fields;if(Object.prototype.hasOwnProperty.call(this.interpreter.topLevelFunctions.h,e))return this.interpreter.topLevelFunctions.h[e];let i=new ce(oe.EUnknownVariable(e),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw k.thrown(i)}return t}expr(e){this.curExpr=e;let t=e.e,i=this;switch(t._hx_index){case 0:let s=t.c;switch(s._hx_index){case 0:return s.v;case 1:return s.f;case 2:return s.s}break;case 1:let n=t.v,l=this.locals.h[n];return l!=null?l.r:this.resolve(n);case 2:let r=t.t,h=t.n,a=t.e;this.declared.push({n:h,old:this.locals.h[h]});let o=this.locals,c=a==null?null:this.expr(a);return o.h[h]={r:c},null;case 3:let p=t.e;return this.expr(p);case 4:let f=t.e,_=this.declared.length,d=null,x=0;for(;x<f.length;){let ue=f[x];++x,d=this.expr(ue)}return this.restore(_),d;case 5:let y=t.e,b=t.f;return this.get(this.expr(y),b);case 6:let v=t.op,T=t.e1,E=t.e2,F=this.binops.h[v];if(F==null){let ue=new ce(oe.EInvalidOp(v),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw k.thrown(ue)}return F(T,E);case 7:let L=t.op,A=t.prefix,B=t.e;switch(L){case"!":return this.expr(B)!=!0;case"++":return this.increment(B,A,1);case"-":return-this.expr(B);case"--":return this.increment(B,A,-1);case"~":return~this.expr(B);default:let ue=new ce(oe.EInvalidOp(L),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw k.thrown(ue)}break;case 8:let I=t.e,H=t.params,P=[],M=0;for(;M<H.length;){let ue=H[M];++M,P.push(this.expr(ue))}let V=I.e;if(V._hx_index==5){let ue=V.e,Ge=V.f,it=this.expr(ue);if(it==null){let Ze=new ce(oe.EInvalidAccess(Ge),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw k.thrown(Ze)}return this.fcall(it,Ge,P)}else return this.call(null,this.expr(I),P);break;case 9:let R=t.cond,Y=t.e1,$=t.e2;return this.expr(R)==!0?this.expr(Y):$==null?null:this.expr($);case 10:let te=t.cond,O=t.e;return this.whileLoop(te,O),null;case 11:let q=t.v,S=t.it,W=t.e;return this.forLoop(q,S,W),null;case 12:throw k.thrown(Si.SBreak);case 13:throw k.thrown(Si.SContinue);case 14:let ve=t.ret,de=t.args,Ce=t.e,Se=t.name,Ee=this.duplicate(this.locals),J=this,se=!1,N=0,X=0;for(;X<de.length;){let ue=de[X];++X,ue.opt?se=!0:N+=1}let rt=function(ue){if((ue==null?0:ue.length)!=de.length){if(ue.length<N){let bs="Invalid number of parameters. Got "+ue.length+", required "+N;Se!=null&&(bs+=" for function '"+Se+"'");let en=new ce(oe.ECustom(bs),i.curExpr.pmin,i.curExpr.pmax,i.curExpr.origin,i.curExpr.line);throw k.thrown(en)}let Kt=[],_t=ue.length-N,zs=0,os=0;for(;os<de.length;){let bs=de[os];++os,bs.opt?_t>0?(Kt.push(ue[zs++]),--_t):Kt.push(null):Kt.push(ue[zs++])}ue=Kt}let Ge=J.locals,it=J.depth;J.depth++,J.locals=J.duplicate(Ee);let Ze=0,ct=de.length;for(;Ze<ct;){let Kt=Ze++;J.locals.h[de[Kt].name]={r:ue[Kt]}}let pt=null,yt=i.declared.length;if(i.inTry)try{pt=J.exprReturn(Ce)}catch(Kt){let _t=k.caught(Kt).unwrap();throw i.restore(yt),J.locals=Ge,J.depth=it,k.thrown(_t)}else pt=J.exprReturn(Ce);return i.restore(yt),J.locals=Ge,J.depth=it,pt},Ve=Pe.makeVarArgs(rt);if(Se!=null)if(this.depth==0)this.variables.h[Se]=Ve;else{this.declared.push({n:Se,old:this.locals.h[Se]});let ue={r:Ve};this.locals.h[Se]=ue,Ee.h[Se]=ue}return Ve;case 15:let Ye=t.e;throw this.returnValue=Ye==null?null:this.expr(Ye),k.thrown(Si.SReturn);case 16:let Ue=t.e,He=t.index,Je=this.expr(Ue),$e=this.expr(He);return ee.isArray(Je)?ee.arrayGet(Je,$e):le.isFields(Je)?le.getField(this.interpreter,Je,$e):Q.__implements(Je,ft)?Q.__cast(Je,ft).get($e):Je[$e];case 17:let Be=t.e,Ne;if(Be.length>0){let ue=Be[0].e;if(ue._hx_index==6){let Ge=ue.e1,it=ue.e2;Ne=ue.op=="=>"}else Ne=!1}else Ne=!1;if(Ne){let ue=[],Ge=[],it=0;for(;it<Be.length;){let Ze=Be[it];++it;let ct=Ze.e;if(ct._hx_index==6)if(ct.op=="=>"){let pt=ct.e1,yt=ct.e2;ue.push(this.expr(pt)),Ge.push(this.expr(yt))}else{this.curExpr=Ze;let pt=new ce(oe.ECustom("Invalid map key=>value expression"),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw k.thrown(pt)}else{this.curExpr=Ze;let pt=new ce(oe.ECustom("Invalid map key=>value expression"),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw k.thrown(pt)}}return this.makeMap(ue,Ge)}else{let ue=[],Ge=0;for(;Ge<Be.length;){let it=Be[Ge];++Ge,ue.push(this.expr(it))}return ue}break;case 18:let mt=t.cl,gt=t.params,Nt=[],ut=0;for(;ut<gt.length;){let ue=gt[ut];++ut,Nt.push(this.expr(ue))}return this.cnew(mt,Nt);case 19:let Xe=t.e;throw k.thrown(this.expr(Xe));case 20:let kt=t.t,Ct=t.e,ye=t.v,ht=t.ecatch,fe=this.declared.length,xe=this.inTry;try{this.inTry=!0;let ue=this.expr(Ct);return this.restore(fe),this.inTry=xe,ue}catch(ue){let Ge=k.caught(ue).unwrap();if(Q.__instanceof(Ge,Si)){let it=Ge;throw this.inTry=xe,k.thrown(it)}else{let it=Ge;this.restore(fe),this.inTry=xe,this.declared.push({n:ye,old:this.locals.h[ye]}),this.locals.h[ye]={r:it};let Ze=this.expr(ht);return this.restore(fe),Ze}}break;case 21:let tt=t.fl,Ke=le.createFields(this.interpreter),dt=0;for(;dt<tt.length;){let ue=tt[dt];++dt,le.setField(this.interpreter,Ke,ue.name,this.expr(ue.e))}return Ke;case 22:let Ut=t.cond,at=t.e1,ei=t.e2;return this.expr(Ut)==!0?this.expr(at):this.expr(ei);case 23:let Ae=t.e,Mt=t.cases,Et=t.defaultExpr,Lt=this.expr(Ae),ot=!1,Dt=0;for(;Dt<Mt.length;){let ue=Mt[Dt];++Dt;let Ge=0,it=ue.values;for(;Ge<it.length;){let Ze=it[Ge];if(++Ge,this.expr(Ze)==Lt){ot=!0;break}}if(ot){Lt=this.expr(ue.expr);break}}return ot||(Lt=Et==null?null:this.expr(Et)),Lt;case 24:let qt=t.cond,jt=t.e;return this.doWhileLoop(qt,jt),null;case 25:let ti=t.name,ii=t.args,Wt=t.e;return this.expr(Wt);case 26:let ze=t.t,xi=t.e;return this.expr(xi)}}doWhileLoop(e,t){let i=this.declared.length,s=this;do{let n=!0;try{s.expr(t)}catch(l){let r=k.caught(l).unwrap();if(Q.__instanceof(r,Si)){let h=r;switch(h._hx_index){case 0:n=!1;break;case 1:break;case 2:throw k.thrown(h)}}else throw l}if(!n)break}while(this.expr(e)==!0);this.restore(i)}whileLoop(e,t){let i=this.declared.length,s=this;for(;this.expr(e)==!0;){let n=!0;try{s.expr(t)}catch(l){let r=k.caught(l).unwrap();if(Q.__instanceof(r,Si)){let h=r;switch(h._hx_index){case 0:n=!1;break;case 1:break;case 2:throw k.thrown(h)}}else throw l}if(!n)break}this.restore(i)}makeIterator(e){if(e instanceof Array)return new bi(e);if(ee.isArray(e))return ee.getIterator(e);if(e.iterator!=null&&(e=on(e)),e.hasNext==null||e.next==null){let t=new ce(oe.EInvalidIterator(e),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw k.thrown(t)}return e}forLoop(e,t,i){let s=this.declared.length;this.declared.push({n:e,old:this.locals.h[e]});let n=this.makeIterator(this.expr(t)),l=this;for(;n.hasNext();){let r=this.locals,h={r:n.next()};r.h[e]=h;let a=!0;try{l.expr(i)}catch(o){let c=k.caught(o).unwrap();if(Q.__instanceof(c,Si)){let p=c;switch(p._hx_index){case 0:a=!1;break;case 1:break;case 2:throw k.thrown(p)}}else throw o}if(!a)break}this.restore(s)}loopRun(e){let t=!0;try{e()}catch(i){let s=k.caught(i).unwrap();if(Q.__instanceof(s,Si)){let n=s;switch(n._hx_index){case 0:t=!1;break;case 1:break;case 2:throw k.thrown(n)}}else throw i}return t}isMap(e){return Q.__implements(e,ft)}getMapValue(e,t){return Q.__cast(e,ft).get(t)}setMapValue(e,t,i){Q.__cast(e,ft).set(t,i)}makeMap(e,t){let i=!0,s=!0,n=!0,l=!0,r=0;for(;r<e.length;){let a=e[r];++r,i=i&&typeof a=="string",s=s&&typeof a=="number"&&(a|0)===a,n=n&&Pe.isObject(a),l=l&&Pe.isEnumValue(a)}if(s){let a=new Ri,o=0,c=e;for(;o<c.length;){let p=c[o],_=o++,d=p;a.h[d]=t[_]}return a}if(i){let a=new me,o=0,c=e;for(;o<c.length;){let p=c[o],_=o++,d=p;a.h[d]=t[_]}return a}if(l){let a=new Gi,o=0,c=e;for(;o<c.length;){let p=c[o],_=o++,d=p;a.set(d,t[_])}return a}if(n){let a=new cs,o=0,c=e;for(;o<c.length;){let p=c[o],_=o++,d=p;a.set(d,t[_])}return a}let h=new ce(oe.ECustom("Invalid map keys "+Z.string(e)),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw k.thrown(h)}get(e,t){if(e==null){let i=new ce(oe.EInvalidAccess(t),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw k.thrown(i)}return le.isFields(e)?le.getField(this.interpreter,e,t):Pe.getProperty(e,t)}set(e,t,i){if(e==null){let s=new ce(oe.EInvalidAccess(t),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw k.thrown(s)}return le.isFields(e)?(le.setField(this.interpreter,e,t,i),i):(Pe.setProperty(e,t,i),i)}fcall(e,t,i){let s=null;return typeof e=="string"?s=le.getStringHelper(this.interpreter,t):ee.isArray(e)?s=le.getArrayHelper(this.interpreter,t):le.isFields(e)&&(s=le.getMapHelper(this.interpreter,t)),s!=null&&Pe.isFunction(s)?(i.splice(0,0,e),this.call(null,s,i)):this.call(e,this.get(e,t),i)}call(e,t,i){return t.apply(e,i)}cnew(e,t){let i=K[e];return i==null&&(i=this.resolve(e)),re.createInstance(i,t)}}K["loreline.HscriptInterp"]=Ns,Ns.__name__="loreline.HscriptInterp",Object.assign(Ns.prototype,{__class__:Ns});class Ms{constructor(e){this.finished=e}}K["loreline._Imports.ImportsLoopInfo"]=Ms,Ms.__name__="loreline._Imports.ImportsLoopInfo",Object.assign(Ms.prototype,{__class__:Ms});class Ls{constructor(){this.ext=".lor",this.pendingImports=0,this.hasErrors=!1,this.done=null,this.resolvedImports=null,this.autoAddExtension=!0}resolve(e,t,i,s,n){this.rootPath=e,this.tokens=t,this.handleFile=i,this.handleError=s,this.done=n,this.hasErrors=!1,this.pendingImports=0,e!=null&&e.endsWith(".lor.txt")&&(this.ext=".lor.txt");let l=new me,r=[],h=new me,a=vt.directory(e);this.extractImports(a,t,r,h),this.processImports(r,h,l)}processImports(e,t,i){let s=new Ms(!1);for(;e.length>0;){let n=e.shift();this.handleItemInLoop(n,s,e,t,i)}s.finished=!0,this.pendingImports==0&&this.done!=null&&(this.resolvedImports=i,this.done(this.hasErrors,i),this.done=null)}handleItemInLoop(e,t,i,s,n){let l=this;this.handleFile(e,function(r){if(l.pendingImports--,r!=null)try{let h=new wt(r),a=h.tokenize(),o=h.getErrors();o!=null&&o.length>0&&l.handleError(o[0]),n.h[e]=a,l.extractImports(vt.directory(e),a,i,s),t.finished&&l.processImports(i,s,n)}catch(h){let a=k.caught(h).unwrap();if(l.hasErrors=!0,a instanceof li)l.handleError(a);else throw k.thrown(a)}else l.hasErrors=!0;t.finished&&l.pendingImports==0&&l.done!=null&&(l.resolvedImports=n,l.done(l.hasErrors,n),l.done=null)})}extractImports(e,t,i,s){let n=0,l=t.length;for(;n<l-1;){if(t[n].type==g.KwImport){let r=t[n+1].type;if(r._hx_index==15){let h=r.quotes,a=r.attachments,o=r.s,c=o;vt.isAbsolute(o)||(c=vt.join([e,c])),c=vt.normalize(c),c.toLowerCase().endsWith(this.ext)||(c+=this.ext),Object.prototype.hasOwnProperty.call(s.h,c)||(this.pendingImports++,s.h[c]=!0,i.push(c))}}++n}}}K["loreline.Imports"]=Ls,Ls.__name__="loreline.Imports",Object.assign(Ls.prototype,{__class__:Ls});class _i{constructor(){this.mask=0,this.size=0,this._values=null,this._keys2=null,this._keys1=null;let e=this._keys1,t=this._keys2,i=this._values;if(this._keys1=new Array(16),this._keys2=new Array(16),this._values=new Array(16),this.mask=15,e!=null){this.size=0;let s=0,n=e.length;for(;s<n;){let l=s++;i[l]!=null&&this._set(e[l],t[l],i[l])}}}resize(e){let t=this._keys1,i=this._keys2,s=this._values;if(this._keys1=new Array(e),this._keys2=new Array(e),this._values=new Array(e),this.mask=e-1,t!=null){this.size=0;let n=0,l=t.length;for(;n<l;){let r=n++;s[r]!=null&&this._set(t[r],i[r],s[r])}}}hashCoords(e,t){let i=e+(t<<16);return i=(i^i>>>16)*-2048144789,i=(i^i>>>13)*-1028477387,i^i>>>16}clear(){this._keys1=null,this._keys2=null,this._values=null;let e=this._keys1,t=this._keys2,i=this._values;if(this._keys1=new Array(16),this._keys2=new Array(16),this._values=new Array(16),this.mask=15,e!=null){this.size=0;let s=0,n=e.length;for(;s<n;){let l=s++;i[l]!=null&&this._set(e[l],t[l],i[l])}}this.size=0}copy(){let e=new _i,t=this._keys1,i=new Array(t.length);Ys.blit(t,0,i,0,t.length),e._keys1=i;let s=this._keys2,n=new Array(s.length);Ys.blit(s,0,n,0,s.length),e._keys2=n;let l=this._values,r=new Array(l.length);return Ys.blit(l,0,r,0,l.length),e._values=r,e.size=this.size,e.mask=this.mask,e}_set(e,t,i){if(this.size>=(this.mask+1)*.75){let r=this.mask+1<<1,h=this._keys1,a=this._keys2,o=this._values;if(this._keys1=new Array(r),this._keys2=new Array(r),this._values=new Array(r),this.mask=r-1,h!=null){this.size=0;let c=0,p=h.length;for(;c<p;){let f=c++;o[f]!=null&&this._set(h[f],a[f],o[f])}}}let s=e+(t<<16);s=(s^s>>>16)*-2048144789,s=(s^s>>>13)*-1028477387;let l=(s^s>>>16)&this.mask;for(;;){if(this._values[l]==null){this._keys1[l]=e,this._keys2[l]=t,this._values[l]=i,this.size++;return}if(this._keys1[l]==e&&this._keys2[l]==t){this._values[l]=i;return}l=l+1&this.mask}}_get(e,t){let i=e+(t<<16);i=(i^i>>>16)*-2048144789,i=(i^i>>>13)*-1028477387;let n=(i^i>>>16)&this.mask;for(;;){if(this._values[n]==null)return null;if(this._keys1[n]==e&&this._keys2[n]==t)return this._values[n];n=n+1&this.mask}}_exists(e,t){let i=e+(t<<16);i=(i^i>>>16)*-2048144789,i=(i^i>>>13)*-1028477387;let n=(i^i>>>16)&this.mask;for(;;){if(this._values[n]==null)return!1;if(this._keys1[n]==e&&this._keys2[n]==t)return!0;n=n+1&this.mask}}_remove(e,t){let i=e+(t<<16);i=(i^i>>>16)*-2048144789,i=(i^i>>>13)*-1028477387;let n=(i^i>>>16)&this.mask;for(;;){if(this._values[n]==null)return!1;if(this._keys1[n]==e&&this._keys2[n]==t){for(this._values[n]=null,this.size--,n=n+1&this.mask;this._values[n]!=null;){let l=this._keys1[n],r=this._keys2[n],h=this._values[n];this._values[n]=null,this.size--,this._set(l,r,h),n=n+1&this.mask}return!0}n=n+1&this.mask}}iterator(){return new Bs(this)}keyIterator(){return new As(this)}keyValueIterator(){return new Fs(this)}length(){return this.size}}K["loreline.Int64Map"]=_i,_i.__name__="loreline.Int64Map",Object.assign(_i.prototype,{__class__:_i});class Bs{constructor(e){for(this.map=e,this.index=0;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++}skipNulls(){for(;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++}hasNext(){return this.index<this.map._values.length}next(){let e=this.map._values[this.index];for(this.index++;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++;return e}}K["loreline._Int64Map.Int64MapIterator"]=Bs,Bs.__name__="loreline._Int64Map.Int64MapIterator",Object.assign(Bs.prototype,{__class__:Bs});class As{constructor(e){for(this.map=e,this.index=0;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++}skipNulls(){for(;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++}hasNext(){return this.index<this.map._values.length}next(){let e=this.map._keys1[this.index],t=this.map._keys2[this.index];for(this.index++;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++;return{high:e,low:t}}}K["loreline._Int64Map.Int64MapKeyIterator"]=As,As.__name__="loreline._Int64Map.Int64MapKeyIterator",Object.assign(As.prototype,{__class__:As});class Fs{constructor(e){for(this.map=e,this.index=0;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++}skipNulls(){for(;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++}hasNext(){return this.index<this.map._values.length}next(){let e=this.map._keys1[this.index],t=this.map._keys2[this.index],i=this.map._values[this.index];for(this.index++;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++;return{key:{high:e,low:t},value:i}}}K["loreline._Int64Map.Int64MapKeyValueIterator"]=Fs,Fs.__name__="loreline._Int64Map.Int64MapKeyValueIterator",Object.assign(Fs.prototype,{__class__:Fs});class Ai{constructor(e,t,i,s){this.scope=-1,i!=null?this.fields=i:this.clear(e,t),s!=null?this.originalFields=s:this.createOriginalFields()}clear(e,t){this.fields=le.createFields(e,null,t)}createOriginalFields(){this.originalFields=le.createFields()}}K["loreline.RuntimeState"]=Ai,Ai.__name__="loreline.RuntimeState",Object.assign(Ai.prototype,{__class__:Ai});class rs extends Ai{constructor(e,t,i,s){super(e,t,i,s)}}K["loreline.RuntimeCharacter"]=rs,rs.__name__="loreline.RuntimeCharacter",rs.__super__=Ai,Object.assign(rs.prototype,{__class__:rs});var vi=Fe["loreline.RuntimeAccess"]={__ename__:"loreline.RuntimeAccess",__constructs__:null,FieldAccess:(m=function(w,e,t){return{_hx_index:0,pos:w,obj:e,name:t,__enum__:"loreline.RuntimeAccess",toString:C}},m._hx_name="FieldAccess",m.__params__=["pos","obj","name"],m),ArrayAccess:(m=function(w,e,t){return{_hx_index:1,pos:w,array:e,index:t,__enum__:"loreline.RuntimeAccess",toString:C}},m._hx_name="ArrayAccess",m.__params__=["pos","array","index"],m),CharacterAccess:(m=function(w,e){return{_hx_index:2,pos:w,name:e,__enum__:"loreline.RuntimeAccess",toString:C}},m._hx_name="CharacterAccess",m.__params__=["pos","name"],m),FunctionAccess:(m=function(w,e){return{_hx_index:3,pos:w,name:e,__enum__:"loreline.RuntimeAccess",toString:C}},m._hx_name="FunctionAccess",m.__params__=["pos","name"],m)};vi.__constructs__=[vi.FieldAccess,vi.ArrayAccess,vi.CharacterAccess,vi.FunctionAccess];class hs{constructor(e,t,i,s,n,l,r){this.insertion=null,this.head=null,this.state=null,this.beats=null,this.id=-1,e!=null&&(this.id=e),this.beat=t,this.node=i,s!=null&&(this.beats=s),n!=null&&(this.state=n),l!=null&&(this.head=l),r!=null&&(this.insertion=r)}beatByName(e){if(this.beats==null)return null;let t=0,i=this.beats.length;for(;t<i;){let s=t++,n=this.beats[s];if(n.name==e)return n}return null}}K["loreline.RuntimeScope"]=hs,hs.__name__="loreline.RuntimeScope",Object.assign(hs.prototype,{__class__:hs});class fs{constructor(e,t){this.stack=[],this.options=null,this.id=e,this.origin=t}}K["loreline.RuntimeInsertion"]=fs,fs.__name__="loreline.RuntimeInsertion",Object.assign(fs.prototype,{__class__:fs});class ms{constructor(e,t,i){this.closing=e,this.value=t,this.offset=i}}K["loreline.TextTag"]=ms,ms.__name__="loreline.TextTag",Object.assign(ms.prototype,{__class__:ms});class gs{constructor(e,t,i,s,n){this.text=e,this.tags=t,this.enabled=i,this.node=s,this.insertion=n}}K["loreline.ChoiceOption"]=gs,gs.__name__="loreline.ChoiceOption",Object.assign(gs.prototype,{__class__:gs});class he extends li{constructor(e,t){super(e,t)}}K["loreline.RuntimeError"]=he,he.__name__="loreline.RuntimeError",he.__super__=li,Object.assign(he.prototype,{__class__:he});class Ds{constructor(){this.cb=null,this.sync=!0}}K["loreline.EvalNext"]=Ds,Ds.__name__="loreline.EvalNext",Object.assign(Ds.prototype,{__class__:Ds});class ds{constructor(e,t,i,s,n){this.beatToResume=null,this.finishTrigger=null,this.flushing=!1,this.syncCallbacks=[],this.nextInsertionId=1,this.nextScopeId=1,this.stack=[],this.stringLiteralProcessors=[],this.mapHelpers=new me,this.arrayHelpers=new me,this.stringHelpers=new me,this.topLevelFunctions=new me,this.nodeStates=new Wi,this.topLevelBeats=new me,this.topLevelCharacters=new me,this.script=e,this.handleDialogue=t,this.handleChoice=i,this.handleFinish=s,this.lens=new Vs(e);let l=n!=null?n.strictAccess:null;this.strictAccess=l!=null&&l,this.translations=n!=null?n.translations:null,this.topLevelState=new Ai(this,e,null,null),this.initializeTopLevelFunctions(n!=null?n.functions:null),this.initializeStringLiteralProcessors(n!=null?n.stringLiteralProcessors:null);let r=e.iterator();for(;r.hasNext();){let h=r.next();switch(Q.getClass(h)){case De:this.initializeTopLevelBeat(h);break;case Gt:this.initializeTopLevelCharacter(h);break;case Di:this.initializeTopLevelFunction(h);break;case Jt:this.initializeTopLevelState(h);break;default:}}}get_currentScope(){return this.stack.length>0?this.stack[this.stack.length-1]:null}get_currentInsertion(){let e=this.stack.length-1;for(;e>=0;){let t=this.stack[e];if(t.insertion!=null)return t.insertion;--e}return null}removeCurrentInsertion(){let e=this.stack.length-1;for(;e>=0;){let t=this.stack[e];if(t.insertion!=null){t.insertion=null;break}--e}}start(e){let t=null;if(e!=null){if(t=this.topLevelBeats.h[e],t==null)throw k.thrown(new he("Beat "+e+" not found",this.script.pos))}else{let i=this.script.iterator();for(;i.hasNext();){let s=i.next();if(s instanceof De){let n=s;n.name=="_"&&(t=n);break}}if(t==null){let s=this.script.iterator();for(;s.hasNext();){let n=s.next();if(n instanceof De){t=n;break}}}if(t==null)throw k.thrown(new he("No beats found in script",this.script.pos))}this.transitionToBeat(t),this.flush()}save(){let e={},t=[],i=0,s=this.stack;for(;i<s.length;){let l=s[i];++i,t.push(this.serializeScope(l,e))}let n={version:1,stack:t,state:this.serializeState(this.topLevelState),characters:this.serializeCharacters(),nodeStates:this.serializeNodeStates()};return Pe.fields(e).length>0&&(n.insertions=e),n}restore(e){if(e.version!=1)throw k.thrown(new he("Unsupported save version: "+e.version,this.script.pos));this.stack.length=0,this.nodeStates.map.clear(),this.nextScopeId=1,this.nextInsertionId=1,this.restoreState(this.topLevelState,e.state),this.restoreCharacters(e.characters),this.restoreNodeStates(e.nodeStates),this.restoreStack(e.stack,e.insertions)||(this.beatToResume=this.restoreBeatToResume(e.stack))}resume(){if(this.stack.length==0){this.start();return}let e=this.wrapNext(_e(this,this.finish));this.finishTrigger=e,this.resumeNode(this.stack[0].node,0,e.cb),e.sync=!1,this.flush()}resumeFromLevel(e,t){let i=this.wrapNext(t);this.finishTrigger=i,this.resumeNode(this.stack[e].node,e,i.cb),i.sync=!1}getCharacter(e){let t=this.topLevelCharacters.h[e];return t!=null?t.fields:null}getCharacterField(e,t){let i=this.topLevelCharacters.h[e],s=i!=null?i.fields:null;return s!=null?le.getField(this,s,t):null}setCharacterField(e,t,i){let s=this.topLevelCharacters.h[e].fields;le.setField(this,s,t,i)}serializeScope(e,t){let i={id:e.id};if(e.beat!=null&&(i.beat=this.serializeBeatReference(e.beat)),e.node!=null&&(i.node=this.serializeNodeReference(e.node)),e.state!=null&&(i.state=this.serializeState(e.state)),e.beats!=null){let s=[],n=0,l=e.beats;for(;n<l.length;){let r=l[n];++n,s.push(this.serializeBeatReference(r))}i.beats=s}return e.head!=null&&(i.head=this.serializeNodeReference(e.head)),e.insertion!=null&&(i.insertion=this.serializeInsertion(e.insertion,t)),i}serializeInsertion(e,t){let i=e.id==null?"null":""+e.id,s=Pe.field(t,i);if(s==null){if(s={},e.options!=null){let n=[],l=0,r=e.options;for(;l<r.length;){let h=r[l];++l,n.push(this.serializeChoiceOption(h,t))}s.options=n}if(e.origin!=null&&(s.origin=this.serializeNodeReference(e.origin)),e.stack!=null){let n=[],l=0,r=e.stack;for(;l<r.length;){let h=r[l];++l,n.push(this.serializeScope(h,t))}s.stack=n}t[i]=s}return e.id}serializeChoiceOption(e,t){let i={text:e.text};if(e.enabled||(i.disabled=!0),e.tags!=null){let s=[],n=0,l=e.tags;for(;n<l.length;){let r=l[n];++n,s.push(this.serializeTextTag(r))}i.tags=s}return e.node!=null&&(i.node=this.serializeNodeReference(e.node)),e.insertion!=null&&(i.insertion=this.serializeInsertion(e.insertion,t)),i}serializeTextTag(e){let t={value:e.value,offset:e.offset};return e.closing&&(t.closing=!0),t}serializeState(e){return this.serializeFields(e.fields,e.originalFields)}serializeCharacters(){let e={},t=this.topLevelCharacters.h,i=t,s=Object.keys(t),n=s.length,l=0;for(;l<n;){let r=s[l++],h=r,a=i[r],o=h,c=a,p=this.serializeCharacter(c);Pe.fields(p.fields).length>0&&(e[o]=p)}return e}serializeNodeStates(){let e={},t=this.nodeStates.map,i=0;for(;i<t._values.length&&t._values[i]==null;)++i;for(;i<t._values.length;){let s=t._keys1[i],n=t._keys2[i],l=t._values[i];for(++i;i<t._values.length&&t._values[i]==null;)++i;let r=Me.fromTwoInt32(s,n),h=l,a=r,o=h,c=this.serializeState(o);Pe.fields(c.fields).length>0&&(e[a.toString()]=c)}return e}serializeBeatReference(e){let t=e.name,i=e;do i=this.lens.getFirstParentOfType(i,De),i!=null&&(t=i.name+"."+t);while(i!=null);return{id:e.id.toString(),path:t}}serializeNodeReference(e){return{id:e.id.toString(),type:e.type()}}serializeCharacter(e){return this.serializeFields(e.fields,e.originalFields)}serializeFields(e,t){let i=null,s={};if(Q.__implements(e,Ei)){let n=Q.getClass(e);n!=null&&(i=n.__name__);let l=e,r=0,h=l.lorelineFields(this);for(;r<h.length;){let a=h[r];++r,s[a]=this.serializeValue(l.lorelineGet(this,a))}}else if(e instanceof me){let n=e,l=n.h,r=l,h=Object.keys(l),a=h.length,o=0;for(;o<a;){let c=h[o++],p=n.h[c];(t==null||!le.fieldExists(this,t,c)||!Ci.equal(this,le.getField(this,t,c),p))&&(s[c]=this.serializeValue(p))}}else{let n=Q.getClass(e);n!=null&&(i=n.__name__);let l=0,r=Pe.fields(e);for(;l<r.length;){let h=r[l];++l;let a=Pe.getProperty(e,h);(t==null||!le.fieldExists(this,t,h)||!Ci.equal(this,le.getField(this,t,h),a))&&(s[h]=this.serializeValue(a))}}return i!=null?{type:i,fields:s}:{fields:s}}serializeValue(e){if(e==null)return null;if(typeof e=="string"||typeof e=="number"||typeof e=="number"&&(e|0)===e||typeof e=="boolean")return e;if(ee.isArray(e)){let t=[],i=ee.arrayLength(e),s=0,n=i;for(;s<n;){let l=s++;t.push(this.serializeValue(ee.arrayGet(e,l)))}return t}return this.serializeFields(e)}resumeNode(e,t,i){let s=this.stack.length-1;if(t>=this.stack.length)switch(Q.getClass(e)){case Vi:this.evalAlternative(e,i);break;case Vt:if(!this.isBeatCall(e))this.evalCall(e,i);else{let r=Q.getClass(e);throw k.thrown(new he("Resume execution not supported from last node: "+r.__name__,e.pos))}break;case fi:this.evalChoice(e,i);break;case hi:this.evalDialogue(e,i);break;case oi:this.evalText(e,i);break;default:let l=Q.getClass(e);throw k.thrown(new he("Resume execution not supported from last node: "+l.__name__,e.pos))}else switch(Q.getClass(e)){case Vi:this.resumeAlternative(e,t,i);break;case De:this.resumeBeatRun(e,t,i);break;case Vt:if(this.isBeatCall(e,t))this.resumeCall(e,t,i);else{let r=Q.getClass(e);throw k.thrown(new he("Resume execution not supported from node within stack: "+r.__name__,e.pos))}break;case Ot:this.resumeChoiceOption(e,t,i);break;case fi:this.resumeChoice(e,t,i);break;case gi:this.resumeIf(e,t,i);break;default:let l=Q.getClass(e);throw k.thrown(new he("Resume execution not supported from node within stack: "+l.__name__,e.pos))}}resumeNodeBody(e,t,i,s){let n=this.stack[t],l=0,r=-1;if(n.head==null&&t<this.stack.length-1)throw k.thrown(new he("Cannot resume through a body with a no-headed scope that is not at the bottom of the stack",e.pos));if(n.head!=null&&(l=i.indexOf(n.head),r=l,l==-1))throw k.thrown(new he("Failed to resolve head in scope when resuming through body",e.pos));let h=null,a=this;h=function(){if(l!=-1&&l==r){let o=i[l];l+=1;let c=a.wrapNext(h);a.resumeNode(o,t+1,c.cb),c.sync=!1}else if(l<i.length){let o=i[l];n.head=o,l+=1;let c=a.wrapNext(h);a.evalNode(o,c.cb),c.sync=!1}else a.pop(),s()},h()}resumeBeatRun(e,t,i){this.resumeNodeBody(e,t,e.body,i)}resumeChoiceOption(e,t,i){this.resumeNodeBody(e,t,e.body,i)}resumeChoice(e,t,i){let s=this.stack[t];if(s.head==null)this.evalChoice(e,i);else if(s.head instanceof Ot){let n=s.head;this.evalNodeBody(s.beat,n,n.body,null,i)}else if(s.insertion!=null){for(;this.stack.length>t;)this.pop();this.evalChoice(e,i)}else throw k.thrown(new he("Choice head is not a choice option",s.head.pos))}resumeIf(e,t,i){let s=this.stack[t];if(s.head==null)throw k.thrown(new he("Failed to resolve head in scope when resuming through condition",e.pos));let l=e.thenBranch.body.indexOf(s.head)!=-1?e.thenBranch:e.elseBranch;if(l!=null&&l.body.length>0)this.resumeNodeBody(l,t,l.body,i);else throw k.thrown(new he("Failed to resume condition: invalid scope",e.pos))}resumeAlternative(e,t,i){let s=this.stack[t];if(s.head==null)throw k.thrown(new he("Failed to resolve head when resuming alternative",e.pos));let n=0,l=e.items;for(;n<l.length;){let r=l[n];if(++n,r.body.indexOf(s.head)!=-1){this.resumeNodeBody(r,t,r.body,i);return}}throw k.thrown(new he("Failed to resume alternative: head not found in any item",e.pos))}resumeCall(e,t,i){if(e.target instanceof lt){let s=e.target;if(s.target==null){let n=s.name,l=null,r=this.stack.length-1;for(;r>=0;){let a=this.stack[r].beatByName(n);if(a!=null){l=a;break}--r}if(l==null&&Object.prototype.hasOwnProperty.call(this.topLevelBeats.h,n)&&(l=this.topLevelBeats.h[n]),l!=null){this.resumeBeatRun(l,t,i);return}}}throw k.thrown(new he("Cannot resume through a function call that is not at the bottom of the stack",e.pos))}restoreStack(e,t){let i=[],s=new Ri,n=e.length-1;for(;n>=0;){let l=this.restoreScopeItem(e[n],t,s);if(l==null)return!1;i.push(l),--n}for(n=i.length-1;n>=0;)this.push(i[n]),--n;return!0}restoreScopeItem(e,t,i){let s=this.restoreBeat(e.beat);if(s==null)return null;let n=Me.fromString(e.beat.id),l=e.node,r=l!=null?this.restoreNode(l,n,s):null;if(l!=null&&r==null)return null;let h=[];if(e.beats!=null){let _=0,d=e.beats;for(;_<d.length;){let x=d[_];++_;let y=this.restoreBeat(x);if(y==null)return null;h.push(y)}}let o=e.state!=null?this.restoreState(null,e.state):null,c=e.head,p=c!=null?this.restoreNode(c,n,s):null;if(c!=null&&p==null)return null;let f=null;return e.insertion!=null&&t!=null&&(f=this.restoreInsertion(e.insertion,t,i)),new hs(null,s,r,h,o,p,f)}restoreInsertion(e,t,i){if(i.h.hasOwnProperty(e))return i.h[e];let s=e==null?"null":""+e,n=Pe.field(t,s);if(n==null)return null;let l=null;if(n.origin!=null){let h=Me.fromString(n.origin.id),a=this.lens.getNodeById(h);a!=null&&a.type()==n.origin.type&&(l=a)}let r=new fs(e,l);if(i.h[e]=r,e>=this.nextInsertionId&&(this.nextInsertionId=e+1),n.options!=null){r.options=[];let h=0,a=n.options;for(;h<a.length;){let o=a[h];++h;let c=this.restoreChoiceOption(o,t,i);c!=null&&r.options.push(c)}}if(n.stack!=null){r.stack=[];let h=0,a=n.stack;for(;h<a.length;){let o=a[h];++h;let c=this.restoreScopeItem(o,t,i);c!=null&&r.stack.push(c)}}return r}restoreChoiceOption(e,t,i){let s=null;if(e.node!=null){let r=Me.fromString(e.node.id),h=this.lens.getNodeById(r);h!=null&&h.type()==e.node.type&&(s=h)}let n=null;if(e.tags!=null){let r=[],h=0,a=e.tags;for(;h<a.length;){let o=a[h];++h,r.push(new ms(o.closing==!0,o.value,o.offset))}n=r}let l=null;return e.insertion!=null&&t!=null&&(l=this.restoreInsertion(e.insertion,t,i)),new gs(e.text,n,e.disabled!=!0,s,l)}restoreBeatToResume(e){let t=null;if(e.length>0){let i=e[0];if(t=this.restoreBeat(i.beat),t!=null){let s=t;do s=this.lens.getFirstParentOfType(s,De),s!=null&&(t=s);while(s!=null)}}return t}restoreNode(e,t,i){let s=i.id.thisVal.high>>16&65535,n=t.thisVal.high>>16&65535,l=(s>=32768?s-65536:s)+32768-((n>=32768?n-65536:n)+32768),r=Me.fromString(e.id);if(r==t)return i;let h=r.thisVal.high>>16&65535,o=(h>=32768?h-65536:h)+32768+l-32768;o<0&&(o=o+65536&65535),r.thisVal=new Li(r.thisVal.high&65535|o<<16,r.thisVal.low);let c=this.lens.getNodeById(r);return c!=null&&c.type()==e.type?c:null}restoreBeat(e){return this.lens.findBeatByPathFromNode(e.path,this.script)}restoreState(e,t){let i=e!=null?e.fields:null,s=this.restoreFields(i??null,t);return e==null&&(e=new Ai(this,null,s,null)),e}restoreCharacters(e){let t=0,i=Pe.fields(e);for(;t<i.length;){let s=i[t];++t;let n=Pe.field(e,s);if(Object.prototype.hasOwnProperty.call(this.topLevelCharacters.h,s))this.restoreCharacter(this.topLevelCharacters.h[s],n);else{let l=this.restoreCharacter(null,n);this.topLevelCharacters.h[s]=l}}}restoreNodeStates(e){let t=0,i=Pe.fields(e);for(;t<i.length;){let s=i[t];++t;let n=Me.fromString(s),l=Pe.field(e,s),r=this.restoreState(null,l),h=n.thisVal;this.nodeStates.map._set(h.high,h.low,r)}}restoreCharacter(e,t){let i=e!=null?e.fields:null,s=this.restoreFields(i??null,t);return e==null&&(e=new rs(this,null,s,null)),e}restoreFields(e,t){if(t==null||t.fields==null)return e;e==null&&(e=le.createFields(this,t.type));let i=t.fields;if(le.isFields(e)){let s=0,n=Pe.fields(i);for(;s<n.length;){let l=n[s];++s,le.setField(this,e,l,this.restoreValue(Pe.field(i,l)))}}else{let s=0,n=Pe.fields(i);for(;s<n.length;){let l=n[s];++s,e[l]=this.restoreValue(Pe.field(i,l))}}return e}restoreValue(e){if(e==null)return null;if(typeof e=="string"||typeof e=="number"||typeof e=="number"&&(e|0)===e||typeof e=="boolean")return e;if(ee.isArray(e)){let t=ee.arrayLength(e),i=ee.createArray(),s=0,n=t;for(;s<n;){let l=s++;ee.arrayPush(i,this.restoreValue(ee.arrayGet(e,l)))}return i}return this.restoreFields(null,e)}initializeTopLevelFunctions(e){if(this.builtins=new Os(this),this.builtins.bindAll(this.topLevelFunctions),e!=null){let r=e,h=r,a=Pe.fields(r),o=0;for(;o<a.length;){let c=a[o++],p=h[c],_=c,d=p;this.topLevelFunctions.h[_]=d}}let t=this.topLevelFunctions.h,i=t,s=Object.keys(t),n=s.length,l=0;for(;l<n;){let r=s[l++],h=r,a=i[r],o=h,c=a;o.startsWith("string_")?this.stringHelpers.h[u.substr(o,7,null)]=c:o.startsWith("array_")?this.arrayHelpers.h[u.substr(o,6,null)]=c:o.startsWith("map_")&&(this.mapHelpers.h[u.substr(o,4,null)]=c)}}initializeStringLiteralProcessors(e){let t=this;if(this.stringLiteralProcessors.push(function(i){return t.pluralPipeProcess(i)}),e!=null){let i=0;for(;i<e.length;){let s=e[i];++i,this.stringLiteralProcessors.push(s)}}}initializeTopLevelFunction(e){if(e.name!=null){if(!e.external||!Object.prototype.hasOwnProperty.call(this.topLevelFunctions.h,e.name)){let t=new qi;try{let i=t.process(e.code+(e.external?" {}":"")),s=new Yi;s.allowJSON=!0,s.allowTypes=!0;let n=s.parseString(i),r=new Ns(this).execute(n);this.topLevelFunctions.h[e.name]=r}catch(i){let s=k.caught(i).unwrap();throw k.thrown(new he("Failed to parse function code: "+(s==null?"null":Z.string(s)),e.pos))}}}else throw k.thrown(new he("Top level function must have a name",e.pos))}wrapNext(e){let t=new Ds;t.sync=!0;let i=this;return t.cb=function(){t.sync?(i.syncCallbacks==null&&(i.syncCallbacks=[]),i.syncCallbacks.push(t.cb)):(e(),i.flush(),t.cb=null,i.finishTrigger==t&&i.finish())},t}flush(){if(!this.flushing){this.flushing=!0;try{if(this.syncCallbacks!=null)for(;this.syncCallbacks.length>0;){let e=this.syncCallbacks.shift(),t=this.syncCallbacks;if(this.syncCallbacks=null,e(),this.syncCallbacks!=null){let i=this.syncCallbacks.length-1;for(;i>=0;)t.unshift(this.syncCallbacks[i]),--i}this.syncCallbacks=t}}catch(e){let t=k.caught(e).unwrap();throw this.flushing=!1,k.thrown(t)}this.flushing=!1}}pop(){return this.stack.length>0?(this.stack.pop(),!0):!1}push(e){e.id=this.nextScopeId++,this.stack.push(e)}initializeTopLevelState(e){if(e.temporary)throw k.thrown(new he("Top level temporary states are not allowed",e.pos));let t=0,i=e.fields;for(;t<i.length;){let s=i[t];++t;let n=this.evaluateExpression(s.value);le.setField(this,this.topLevelState.fields,s.name,n),this.isOriginalScriptExpression(s.value)&&le.setField(this,this.topLevelState.originalFields,s.name,n)}}initializeTopLevelBeat(e){if(Object.prototype.hasOwnProperty.call(this.topLevelBeats.h,e.name))throw k.thrown(new he("Duplicate top level beat: "+e.name,e.pos));this.topLevelBeats.h[e.name]=e}initializeTopLevelCharacter(e){if(Object.prototype.hasOwnProperty.call(this.topLevelCharacters.h,e.name))throw k.thrown(new he("Duplicate top level character: "+e.name,e.pos));let t=new rs(this,e,null,null);this.topLevelCharacters.h[e.name]=t;let i=0,s=e.fields;for(;i<s.length;){let n=s[i];++i;let l=this.evaluateExpression(n.value);le.setField(this,t.fields,n.name,l),this.isOriginalScriptExpression(n.value)&&le.setField(this,t.originalFields,n.name,l)}}initializeState(e,t){let i=null;if(e.temporary)t.state==null&&(t.state=new Ai(this,e,null,null)),i=t.state;else{let l=t.node.id.thisVal;if(i=this.nodeStates.map._get(l.high,l.low),i==null){i=new Ai(this,e,null,null);let r=t.node.id.thisVal;this.nodeStates.map._set(r.high,r.low,i)}}let s=0,n=e.fields;for(;s<n.length;){let l=n[s];if(++s,!le.fieldExists(this,i.fields,l.name)){let r=this.evaluateExpression(l.value);le.setField(this,i.fields,l.name,r),!e.temporary&&this.isOriginalScriptExpression(l.value)&&le.setField(this,i.originalFields,l.name,r)}}}finish(){this.finishTrigger=null,this.handleFinish!=null&&this.handleFinish(this)}transitionToBeat(e){for(;this.pop(););this.nextScopeId=1,this.nextInsertionId=1;let t=this.wrapNext(_e(this,this.finish));this.finishTrigger=t,this.evalBeatRun(e,t.cb),t.sync=!1}evalNode(e,t){switch(Q.getClass(e)){case Vi:this.evalAlternative(e,t);break;case di:this.evalAssignment(e,t);break;case De:this.evalBeatDecl(e,t);break;case Vt:this.evalCall(e,t);break;case Ot:this.evalChoiceOption(e,t);break;case fi:this.evalChoice(e,t);break;case hi:this.evalDialogue(e,t);break;case gi:this.evalIf(e,t);break;case Jt:this.evalStateDecl(e,t);break;case oi:this.evalText(e,t);break;case Ni:this.evalTransition(e);break;default:let i=Q.getClass(e);throw k.thrown(new he("Unsupported node type: "+i.__name__,e.pos))}}evalBeatDecl(e,t){if(this.get_currentScope().beats==null)this.get_currentScope().beats=[];else if(this.get_currentScope().beatByName(e.name)!=null)throw k.thrown(new he("Duplicate beat with name: "+e.name,e.pos));this.get_currentScope().beats.push(e),t()}evalNodeBody(e,t,i,s,n){this.push(new hs(null,e,t,null,null,null,s));let l=0,r=null,h=this.get_currentInsertion(),a=this;r=function(){if((h!=null?h.options:null)!=null)a.pop(),n();else if(l<i.length){let o=i[l];a.get_currentScope().head=o,l+=1;let c=a.wrapNext(r);a.evalNode(o,c.cb),c.sync=!1}else a.pop(),n()},r()}evalBeatRun(e,t){this.evalNodeBody(e,e,e.body,null,t)}evalStateDecl(e,t){this.initializeState(e,this.get_currentScope()),t()}evalText(e,t){if(e.condition!=null&&!this.evaluateCondition(e.condition)){t();return}let i=this.getTranslatedString(e,e.content),s=this.evaluateString(i);this.handleDialogue(this,null,s.text,s.tags,t)}evalDialogue(e,t){if(e.condition!=null&&!this.evaluateCondition(e.condition)){t();return}let i=this.getTranslatedString(e,e.content),s=this.evaluateString(i);this.handleDialogue(this,e.character,s.text,s.tags,t)}evalChoice(e,t){let i=[],s=this,n=this.wrapNext(function(){let l=s.get_currentInsertion();if(l!=null&&l.options==null){l.stack=[].concat(s.stack),l.options=i,t();return}let r=-1,h=s.wrapNext(function(){if(r>=0&&r<i.length){let a=i[r];if(a.insertion!=null){let o=s.stack.length;for(;s.stack.length>0;)s.stack.pop();let c=0,p=a.insertion.stack;for(;c<p.length;){let _=p[c];++c,_.insertion==a.insertion&&(_.insertion=null),s.stack.push(_)}let f=s.stack[s.stack.length-1];s.push(new hs(null,f.beat,s.lens.getParentNode(a.node),null,null,a.node,null)),s.resumeFromLevel(o,t)}else s.evalChoiceOption(a.node,t)}else t()});s.handleChoice(s,i,function(a){r=a,h.cb()}),h.sync=!1});this.evalChoiceOptionsAndInsertions(this.get_currentScope().beat,e,i,n.cb),n.sync=!1}evalChoiceOptionsAndInsertions(e,t,i,s){let n=t.options,l=0,r=null,h=null,a=this;r=function(){if(h!=null&&h.options!=null){let o=0,c=h.options.length;for(;o<c;){let p=o++,f=h.options[p];i.push(f)}h=null}if(l<n.length){let o=n[l];l+=1;let c=o.condition==null||a.evaluateCondition(o.condition);if(o.text!=null){let p=a.wrapNext(r),f=a.getTranslatedString(o,o.text),_=a.evaluateString(f);i.push(new gs(_.text,_.tags,c,o,a.get_currentInsertion())),p.cb(),p.sync=!1}else if(o.insertion!=null){let p=a.wrapNext(r);h=new fs(a.nextInsertionId++,o.insertion),a.evalInsertion(h,p.cb),p.sync=!1}else throw k.thrown(new he("Invalid choice option",o.pos))}else s()},r()}evalInsertion(e,t){let i=e.origin.target,s=null,n=this.stack.length-1;for(;n>=0;){let r=this.stack[n].beatByName(i);if(r!=null){s=r;break}--n}if(s==null&&Object.prototype.hasOwnProperty.call(this.topLevelBeats.h,i)&&(s=this.topLevelBeats.h[i]),s==null)throw k.thrown(new he("Beat "+i+" not found",this.script.pos));this.evalNodeBody(s,s,s.body,e,t)}evalChoiceOption(e,t){this.evalNodeBody(this.get_currentScope().beat,e,e.body,null,t)}evalIf(e,t){let s=this.evaluateCondition(e.condition)?e.thenBranch:e.elseBranch;s!=null&&s.body.length>0?this.evalNodeBody(this.get_currentScope().beat,s,s.body,null,t):t()}evalAlternative(e,t){if(e.items.length==0){t();return}switch(e.mode){case 0:let i=this.getAlternativeVisitCount(e),s=i<e.items.length?i:e.items.length-1;this.setAlternativeVisitCount(e,i+1);let n=e.items[s];this.evalNodeBody(this.get_currentScope().beat,n,n.body,null,t);break;case 1:let l=this.getAlternativeVisitCount(e),r=l%e.items.length;this.setAlternativeVisitCount(e,l+1);let h=e.items[r];this.evalNodeBody(this.get_currentScope().beat,h,h.body,null,t);break;case 2:let a=this.getAlternativeVisitCount(e);if(a>=e.items.length){t();return}this.setAlternativeVisitCount(e,a+1);let o=e.items[a];this.evalNodeBody(this.get_currentScope().beat,o,o.body,null,t);break;case 3:let c=this.builtins.random(0,e.items.length-1),p=e.items[c];this.evalNodeBody(this.get_currentScope().beat,p,p.body,null,t);break;case 4:let f=[],_=0,d=e.items.length;for(;_<d;){let b=_++;f.push(b)}let x=f,y=x.length-1;for(;y>0;){let b=this.builtins.random(0,y),v=x[y];x[y]=x[b],x[b]=v,--y}this.evalShuffledItems(e,x,0,t);break}}evalShuffledItems(e,t,i,s){if(i>=t.length){s();return}let n=e.items[t[i]],l=this;this.evalNodeBody(this.get_currentScope().beat,n,n.body,null,function(){l.evalShuffledItems(e,t,i+1,s)})}getAlternativeVisitCount(e){let t=e.id.thisVal,i=this.nodeStates.map._get(t.high,t.low);if(i==null)return 0;let s=le.getField(this,i.fields,"_visitCount");return s??0}setAlternativeVisitCount(e,t){let i=e.id.thisVal,s=this.nodeStates.map._get(i.high,i.low);if(s==null){s=new Ai(this,e,null,null);let n=e.id.thisVal;this.nodeStates.map._set(n.high,n.low,s)}le.setField(this,s.fields,"_visitCount",t)}evalAssignment(e,t){let i=this.resolveAssignmentTarget(e.target),s=this.evaluateExpression(e.value),n;switch(e.op._hx_index){case 20:n=s;break;case 21:n=this.performOperation(g.OpPlus,this.readAccess(i),s,e.pos);break;case 22:n=this.performOperation(g.OpMinus,this.readAccess(i),s,e.pos);break;case 23:n=this.performOperation(g.OpMultiply,this.readAccess(i),s,e.pos);break;case 24:n=this.performOperation(g.OpDivide,this.readAccess(i),s,e.pos);break;default:throw k.thrown(new he("Invalid assignment operator",e.pos))}this.writeAccess(i,n),t()}isOriginalScriptExpression(e){switch(Q.getClass(e)){case Xt:let t=e;return this.isOriginalScriptExpression(t.left)?this.isOriginalScriptExpression(t.right):!1;case lt:case ui:case Vt:return!1;case Oe:let i=e,s=i.literalType;switch(s._hx_index){case 0:case 1:case 2:return!0;case 3:let a=i.value,o=0;for(;o<a.length;){let _=a[o];if(++o,_ instanceof nt&&!this.isOriginalScriptExpression(_))return!1}return!0;case 4:let c=s.style,p=i.value,f=0;for(;f<p.length;){let _=p[f];if(++f,!this.isOriginalScriptExpression(_.value))return!1}return!0}break;case Tt:let n=e,l=0,r=n.parts;for(;l<r.length;){let a=r[l];++l;let o=a.partType;switch(o._hx_index){case 0:let c=o.text;continue;case 1:let p=o.expr;return!1;case 2:let f=o.closing,_=o.expr;if(!this.isOriginalScriptExpression(_))return!1;break}}return!0;case Hi:let h=e;return this.isOriginalScriptExpression(h.operand)}return!1}isBeatCall(e,t){return t==null&&(t=-1),e instanceof Vt?this.resolveBeatFromCall(e,t)!=null:!1}resolveBeatFromCall(e,t){if(t==null&&(t=-1),e.target instanceof lt){let i=e.target;if(i.target==null){let s=i.name,n=null,l=t==-1?this.stack.length-1:t;for(;l>=0;){let h=this.stack[l].beatByName(s);if(h!=null){n=h;break}--l}if(n==null&&Object.prototype.hasOwnProperty.call(this.topLevelBeats.h,s)&&(n=this.topLevelBeats.h[s]),n!=null)return n}}return null}evalCall(e,t){let i=this.resolveBeatFromCall(e);if(i!=null){this.evalBeatRun(i,t);return}this.evaluateFunctionCall(e,t)}evalTransition(e){let t=e.target;if(t=="."){this.finish();return}let i=null,s=this.stack.length-1;for(;s>=0;){let l=this.stack[s].beatByName(t);if(l!=null){i=l;break}--s}if(i==null&&Object.prototype.hasOwnProperty.call(this.topLevelBeats.h,t)&&(i=this.topLevelBeats.h[t]),i==null)throw k.thrown(new he("Beat "+t+" not found",this.script.pos));this.transitionToBeat(i)}getTranslatedString(e,t){if(this.translations!=null){let i=this.findHashCommentId(e,t);if(i!=null){let s=this.translations.h[i];if(s!=null)return s}}return t}findHashCommentId(e,t){return It.findHashComment(e,t)}evaluateString(e){let t=0,i=this.stringLiteralProcessors.length;for(;t<i;){let _=t++;e=this.stringLiteralProcessors[_](e)}let s="",n=[],l=0,r=e.parts.length,h=e.quotes!=0,a=e.quotes!=0,o=e.quotes!=0,c=-1;if(!h){let _=r-1;e:for(;_>=0;){let x=e.parts[_].partType;switch(x._hx_index){case 0:let y=x.text;c=_;break e;case 1:let b=x.expr;break e;case 2:let v=x.closing,T=x.expr;--_;break}}}let p=0,f=r;for(;p<f;){let _=p++,x=e.parts[_].partType;switch(x._hx_index){case 0:let y=x.text;h||(y=Te.ltrim(y)),_==c&&(y=Te.rtrim(y)),o||(y=this.stripStringComments(y)),a||(y=this.stripStringIndent(y));let b=y.length;b>0&&(h=!0);let v=!1,T=!1,E=!1,F=0,L=b;for(;F<L;){let P=F++,M=u.cca(y,P);E?(M==110?s+=String.fromCodePoint(10):M==114?s+=String.fromCodePoint(13):M==116?s+=String.fromCodePoint(9):s+=String.fromCodePoint(M),E=!1,v=!1,T=!1):M==92?(E=!0,v=!1,T=!1):M==36?(v?(s+=String.fromCodePoint(M),v=!1):v=!0,T=!1):M==35?(T?(s+=String.fromCodePoint(M),T=!1):T=!0,v=!1):(T&&(s+=String.fromCodePoint(35),T=!1),s+=String.fromCodePoint(M))}T&&(s+=String.fromCodePoint(35)),l+=b;break;case 1:let A=x.expr;if(h=!0,A instanceof lt){let P=A,M=this.resolveAccess(P,P.target,P.name);if(M._hx_index==2){let V=M.pos,R=M.name,Y=this.evaluateExpression(A),$=le.getField(this,Y,"name"),te=$??R,O=this.valueToString(te);l+=O.length,s+=O==null?"null":""+O}else{let V=this.evaluateExpression(A),R=this.valueToString(V);l+=R.length,s+=R==null?"null":""+R}}else{let P=this.evaluateExpression(A),M=this.valueToString(P);l+=M.length,s+=M==null?"null":""+M}break;case 2:let B=x.closing,I=x.expr,H=this.evaluateString(I).text;n.push(new ms(B,H,l));break}}return{text:s,tags:n}}pluralPipeProcess(e){let t=-1,i=!1,s=null,n=0,l=e.parts.length;for(;n<l;){let r=n++,h=e.parts[r],a=h.partType;switch(a._hx_index){case 0:let o=a.text;if(t>=0&&this.rawTextHasUnescapedPipe(o)){let _,d=e.parts[t].partType;if(d._hx_index==1?_=d.expr:_=null,_!=null){if(!i){let x=[],y=0,b=r;for(;y<b;){let v=y++;x.push(e.parts[v])}s=x,i=!0}this.transformPipeRaw(o,_,h.pos,s);continue}}break;case 1:let c=a.expr;t=r;break;case 2:let p=a.closing,f=a.expr;break}i&&s.push(h)}return i?new Tt(e.id,e.pos,e.quotes,s):e}rawTextHasUnescapedPipe(e){let t=e.length,i=0;for(;i<t;){let s=u.cca(e,i);if(s==92){i+=2;continue}if(s==124)return!0;++i}return!1}transformPipeRaw(e,t,i,s){let n=e.length,l=0,r=0;for(;l<n;){let h=u.cca(e,l);if(h==92&&l+1<n){l+=2;continue}if(h==40){let a=-1,o=-1,c=l+1;for(;c<n;){let p=u.cca(e,c);if(p==92&&c+1<n){c+=2;continue}if(p==124&&a==-1)a=c;else if(p==41){o=c;break}++c}if(a!=-1&&o!=-1&&a>l+1&&o>a+1){let p=l+1,f=a-l-1,_=f!=null?u.substr(e,p,f):u.substr(e,p,null),d=a+1,x=o-a-1,y=x!=null?u.substr(e,d,x):u.substr(e,d,null);if(l>r){let b=l-r;s.push(new je(Me.UNDEFINED,i,Le.Raw(b!=null?u.substr(e,r,b):u.substr(e,r,null))))}s.push(new je(Me.UNDEFINED,i,Le.Expr(this.makePluralCall(t,_,y,i)))),l=o+1,r=l;continue}}if(h==124){let a=l;for(;a>r;){let x=u.cca(e,a-1);if(x==32||x==9||x==10||x==124||x==40||x==41)break;--a}let o=l+1;for(;o<n;){let x=u.cca(e,o);if(x==32||x==9||x==10||x==124||x==40||x==41)break;++o}let c=l-a,p=c!=null?u.substr(e,a,c):u.substr(e,a,null),f=l+1,_=o-l-1,d=_!=null?u.substr(e,f,_):u.substr(e,f,null);if(p.length>0&&d.length>0){if(a>r){let x=a-r;s.push(new je(Me.UNDEFINED,i,Le.Raw(x!=null?u.substr(e,r,x):u.substr(e,r,null))))}s.push(new je(Me.UNDEFINED,i,Le.Expr(this.makePluralCall(t,p,d,i)))),l=o,r=l;continue}}++l}if(r<n){let h=n-r;s.push(new je(Me.UNDEFINED,i,Le.Raw(h!=null?u.substr(e,r,h):u.substr(e,r,null))))}}makePluralCall(e,t,i,s){let n=new lt(Me.UNDEFINED,s,null,"plural"),l=new Tt(Me.UNDEFINED,s,1,[new je(Me.UNDEFINED,s,Le.Raw(t))]),r=new Tt(Me.UNDEFINED,s,1,[new je(Me.UNDEFINED,s,Le.Raw(i))]);return new Vt(Me.UNDEFINED,s,n,[e,l,r])}stripStringIndent(e){let t=-1,i=-1,s=e.length,n=0;for(;u.cca(e,n)==32&&n<s;)++n;for(n>0&&(t=n);n<s;){let l=u.cca(e,n);l==10?i=0:i>=0&&l==32?++i:i>=0&&((t==-1||t>i)&&(t=i),i=-1),++n}if(t>0){let l="",r=0,h=t;for(;r<h;){let a=r++;l+=String.fromCodePoint(32)}e=Te.replace(e,`
35
+ `+l,`
36
+ `)}return e}stripStringComments(e){let t="",i=e.length,s=0;for(;s<i;){let n=u.cca(e,s);if(n==47&&s+1<i&&u.cca(e,s+1)==47){for(;s<i&&u.cca(e,s)!=10;)++s;continue}if(n==47&&s+1<i&&u.cca(e,s+1)==42){let l=s>0&&u.cca(e,s-1)==32;for(s+=2;s+1<i&&!(u.cca(e,s)==42&&u.cca(e,s+1)==47);)++s;s+=2;let r=s<i&&u.cca(e,s)==32;l&&r&&++s,!l&&!r&&s<i&&(t+=String.fromCodePoint(32));continue}t+=String.fromCodePoint(n),++s}return t}evaluateCondition(e){let t=this.evaluateExpression(e);return typeof t=="boolean"?t==!0:typeof t=="string"||t instanceof Array?t.length>0:typeof t=="number"&&(t|0)===t||typeof t=="number"?t!=0:t!=null}evaluateFunctionCall(e,t){if(e.target instanceof lt){let n=e.target;if(n.target==null){let l=this.evaluateExpression(e.target);if(l!=null&&Pe.isFunction(l)){let r=[],h=0,a=e.args;for(;h<a.length;){let c=a[h];++h,r.push(this.evaluateExpression(c))}let o=r;try{let c=l.apply(null,o);if(c!=null&&c instanceof Xi){if(t==null)throw k.thrown(new he("Cannot call async function in expression",e.pos));c.func(t)}else t?.();return c}catch(c){let p=k.caught(c).unwrap();if(p instanceof ce){let f=p;throw k.thrown(new he("Error when evaluating function ("+f.pmin+"-"+f.pmax+"): "+Z.string(f.e),e.pos))}throw k.thrown(new he("Error when calling function: "+Z.string(p),e.pos))}}}else{let l=this.evaluateExpression(n.target),r=null;if(typeof l=="string"?r=le.getStringHelper(this,n.name):ee.isArray(l)?r=le.getArrayHelper(this,n.name):le.isFields(l)&&(r=le.getMapHelper(this,n.name)),r!=null&&Pe.isFunction(r)){let h=[],a=0,o=e.args;for(;a<o.length;){let f=o[a];++a,h.push(this.evaluateExpression(f))}let c=h;c.splice(0,0,l);let p=r.apply(null,c);if(p!=null&&p instanceof Xi){if(t==null)throw k.thrown(new he("Cannot call async function in expression",e.pos));p.func(t)}else t?.();return p}else if(r==null&&!(typeof l=="string"||ee.isArray(l)||le.isFields(l))){let h=Pe.getProperty(l,n.name);if(Pe.isFunction(h)){let a=[],o=0,c=e.args;for(;o<c.length;){let _=c[o];++o,a.push(this.evaluateExpression(_))}let p=a,f=h.apply(l,p);if(f!=null&&f instanceof Xi){if(t==null)throw k.thrown(new he("Cannot call async function in expression",e.pos));f.func(t)}else t?.();return f}}}}let i=this.printLoreline(e.target),s;throw i!=null?s=i:s=Q.getClass(e.target).__name__,k.thrown(new he("Invalid call target: "+s,e.pos))}evaluateArrayLiteral(e){let t=[],i=0;for(;i<e.length;){let s=e[i];++i,t.push(this.evaluateExpression(s))}return t}evaluateObjectLiteral(e){let t=new me,i=0;for(;i<e.length;){let s=e[i];++i;let n=s.name,l=this.evaluateExpression(s.value);t.h[n]=l}return t}evaluateExpression(e){switch(Q.getClass(e)){case lt:let t=e,i=this.resolveAccess(t,t.target,t.name);return this.readAccess(i);case ui:let s=e,n=this.evaluateExpression(s.target),l=this.evaluateExpression(s.index);if(ee.isArray(n)&&(typeof l=="number"&&(l|0)===l||typeof l=="number")){let x=l|0;if(x<0||x>=ee.arrayLength(n))throw k.thrown(new he("Array index out of bounds: "+x,s.pos));return ee.arrayGet(n,x)}else if(typeof l=="string"){if(n==null)throw k.thrown(new he("Cannot access field '"+(l==null?"null":Z.string(l))+"' of null",s.pos));return le.getField(this,n,l)}else throw k.thrown(new he("Invalid array access",s.pos));break;case Xt:let r=e,h=this.evaluateExpression(r.left),a=this.evaluateExpression(r.right);return this.performOperation(r.op,h,a,r.pos);case Vt:return this.evaluateFunctionCall(e,null);case Oe:let o=e,c=o.literalType;switch(c._hx_index){case 0:case 1:case 2:return o.value;case 3:return this.evaluateArrayLiteral(o.value);case 4:let x=c.style;return this.evaluateObjectLiteral(o.value)}break;case Tt:let p=e;if(p.parts.length==1&&p.quotes==0){let x=p.parts[0].partType;if(x._hx_index==1){let y=x.expr;return this.evaluateExpression(y)}else return this.evaluateString(p).text}else return this.evaluateString(p).text;break;case Hi:let f=e,_=this.evaluateExpression(f.operand);switch(f.op._hx_index){case 26:if(typeof _=="number"&&(_|0)===_)return-_;if(typeof _=="number")return-_;throw k.thrown(new he("Invalid unary operation",f.pos));break;case 38:if(typeof _=="boolean")return!_;if(typeof _=="string"){let x=_;return x!=null?x.length==0:!0}else if(_ instanceof Array){let x=_;return x!=null?x.length==0:!0}else return typeof _=="number"&&(_|0)===_||typeof _=="number"?_==0:_==null;break;default:throw k.thrown(new he("Invalid unary operation",f.pos))}break;default:let d=Q.getClass(e);throw k.thrown(new he("Unsupported expression type: "+d.__name__,e.pos))}}readAccess(e){switch(e._hx_index){case 0:let t=e.pos,i=e.obj,s=e.name;if(i==null)throw k.thrown(new he("Cannot read field '"+s+"' of null",t));return le.getField(this,i,s);case 1:let n=e.pos,l=e.array,r=e.index;return ee.arrayGet(l,r);case 2:let h=e.pos,a=e.name;if(Object.prototype.hasOwnProperty.call(this.topLevelCharacters.h,a))return this.topLevelCharacters.h[a].fields;throw k.thrown(new he("Character not found: "+a,h));case 3:let o=e.pos,c=e.name;if(Object.prototype.hasOwnProperty.call(this.topLevelFunctions.h,c))return this.topLevelFunctions.h[c];throw k.thrown(new he("Function not found: "+c,o))}}writeAccess(e,t){switch(e._hx_index){case 0:let i=e.pos,s=e.obj,n=e.name;if(s==null)throw k.thrown(new he("Cannot set field '"+n+"' of null",i));le.setField(this,s,n,t);break;case 1:let l=e.pos,r=e.array,h=e.index;ee.arraySet(r,h,t);break;case 2:let a=e.pos,o=e.name;throw k.thrown(new he("Cannot overwrite character: "+o,a));case 3:let c=e.pos,p=e.name;throw k.thrown(new he("Cannot overwrite function: "+p,c))}}resolveAssignmentTarget(e){switch(Q.getClass(e)){case lt:let t=e;return this.resolveAccess(t,t.target,t.name);case ui:let i=e,s=this.evaluateExpression(i.target),n=this.evaluateExpression(i.index);if(ee.isArray(s)&&(typeof n=="number"&&(n|0)===n||typeof n=="number")){let l=n|0;return vi.ArrayAccess(i.pos,s,l)}else throw k.thrown(new he("Invalid array access target",i.pos));break;default:throw k.thrown(new he("Invalid assignment target",e.pos))}}resolveAccess(e,t,i){if(t!=null){let r=this.evaluateExpression(t);if(r==null){let h=Q.getClass(t)==lt?t.name:null;throw k.thrown(new he(h!=null?"Cannot access field '"+i+"' of undefined variable '"+h+"'":"Cannot access field '"+i+"' of null value",t.pos))}return vi.FieldAccess(t.pos,r,i)}let s=this.stack.length-1;for(;s>=0;){let r=this.stack[s];if(r.state!=null&&le.fieldExists(this,r.state.fields,i)){let h=e!=null?e.pos:null,a;if(h!=null)a=h;else{let o=this.get_currentScope(),c=o!=null?o.node:null;a=c!=null?c.pos:null}return vi.FieldAccess(a??this.script.pos,r.state.fields,i)}if(r.node!=null){let h=r.node.id.thisVal,a=this.nodeStates.map._get(h.high,h.low);if(a!=null&&le.fieldExists(this,a.fields,i)){let o=e!=null?e.pos:null,c;if(o!=null)c=o;else{let p=this.get_currentScope(),f=p!=null?p.node:null;c=f!=null?f.pos:null}return vi.FieldAccess(c??this.script.pos,a.fields,i)}}--s}if(le.fieldExists(this,this.topLevelState.fields,i)){let r=e!=null?e.pos:null,h;if(r!=null)h=r;else{let a=this.get_currentScope(),o=a!=null?a.node:null;h=o!=null?o.pos:null}return vi.FieldAccess(h??this.script.pos,this.topLevelState.fields,i)}if(Object.prototype.hasOwnProperty.call(this.topLevelCharacters.h,i)){let r=e!=null?e.pos:null,h;if(r!=null)h=r;else{let a=this.get_currentScope(),o=a!=null?a.node:null;h=o!=null?o.pos:null}return vi.CharacterAccess(h??this.script.pos,i)}if(Object.prototype.hasOwnProperty.call(this.topLevelFunctions.h,i)){let r=e!=null?e.pos:null,h;if(r!=null)h=r;else{let a=this.get_currentScope(),o=a!=null?a.node:null;h=o!=null?o.pos:null}return vi.FunctionAccess(h??this.script.pos,i)}if(!this.strictAccess){let r=e!=null?e.pos:null,h;if(r!=null)h=r;else{let a=this.get_currentScope(),o=a!=null?a.node:null;h=o!=null?o.pos:null}return vi.FieldAccess(h??this.script.pos,this.topLevelState.fields,i)}let n=e!=null?e.pos:null,l;if(n!=null)l=n;else{let r=this.get_currentScope(),h=r!=null?r.node:null;l=h!=null?h.pos:null}throw k.thrown(new he("Undefined variable: "+i,l??this.script.pos))}getTypeName(e){switch(e._hx_index){case 0:return"Null";case 1:return"Int";case 2:return"Float";case 3:return"Bool";case 4:return"Object";case 5:return"Function";case 6:return e.c.__name__;case 7:return e.e.__ename__;case 8:return"Unknown"}}performOperation(e,t,i,s){let n=re.typeof(t),l=re.typeof(i);switch(e._hx_index){case 25:switch(n._hx_index){case 1:switch(l._hx_index){case 1:case 2:return parseFloat(Z.string(t))+parseFloat(Z.string(i));case 6:if(l.c==String)return Z.string(t)+Z.string(i);{let d="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(l),x=s,y;if(x!=null)y=x;else{let b=this.get_currentScope(),v=b!=null?b.node:null;y=v!=null?v.pos:null}throw k.thrown(new he(d,y??this.script.pos))}break;default:let p="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(l),f=s,_;if(f!=null)_=f;else{let d=this.get_currentScope(),x=d!=null?d.node:null;_=x!=null?x.pos:null}throw k.thrown(new he(p,_??this.script.pos))}break;case 2:switch(l._hx_index){case 1:case 2:return parseFloat(Z.string(t))+parseFloat(Z.string(i));case 6:if(l.c==String)return Z.string(t)+Z.string(i);{let d="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(l),x=s,y;if(x!=null)y=x;else{let b=this.get_currentScope(),v=b!=null?b.node:null;y=v!=null?v.pos:null}throw k.thrown(new he(d,y??this.script.pos))}break;default:let p="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(l),f=s,_;if(f!=null)_=f;else{let d=this.get_currentScope(),x=d!=null?d.node:null;_=x!=null?x.pos:null}throw k.thrown(new he(p,_??this.script.pos))}break;case 6:if(n.c==String)return Z.string(t)+Z.string(i);if(l._hx_index==6){if(l.c==String)return Z.string(t)+Z.string(i);{let p="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(l),f=s,_;if(f!=null)_=f;else{let d=this.get_currentScope(),x=d!=null?d.node:null;_=x!=null?x.pos:null}throw k.thrown(new he(p,_??this.script.pos))}}else{let p="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(l),f=s,_;if(f!=null)_=f;else{let d=this.get_currentScope(),x=d!=null?d.node:null;_=x!=null?x.pos:null}throw k.thrown(new he(p,_??this.script.pos))}break;default:if(l._hx_index==6){if(l.c==String)return Z.string(t)+Z.string(i);{let p="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(l),f=s,_;if(f!=null)_=f;else{let d=this.get_currentScope(),x=d!=null?d.node:null;_=x!=null?x.pos:null}throw k.thrown(new he(p,_??this.script.pos))}}else{let p="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(l),f=s,_;if(f!=null)_=f;else{let d=this.get_currentScope(),x=d!=null?d.node:null;_=x!=null?x.pos:null}throw k.thrown(new he(p,_??this.script.pos))}}break;case 26:case 27:case 28:case 29:switch(n._hx_index){case 1:case 2:switch(l._hx_index){case 1:case 2:let x=parseFloat(Z.string(t)),y=parseFloat(Z.string(i));switch(e._hx_index){case 26:return x-y;case 27:return x*y;case 28:if(y==0){let F=s,L;if(F!=null)L=F;else{let A=this.get_currentScope(),B=A!=null?A.node:null;L=B!=null?B.pos:null}throw k.thrown(new he("Division by zero",L??this.script.pos))}return x/y;case 29:if(y==0){let F=s,L;if(F!=null)L=F;else{let A=this.get_currentScope(),B=A!=null?A.node:null;L=B!=null?B.pos:null}throw k.thrown(new he("Modulo by zero",L??this.script.pos))}return x%y;default:throw k.thrown("Unreachable")}break;default:let b;switch(e._hx_index){case 26:b="subtract";break;case 27:b="multiply";break;case 28:b="divide";break;case 29:b="modulo";break;default:b="perform operation on"}let v="Cannot "+b+" "+this.getTypeName(n)+" and "+this.getTypeName(l),T=s,E;if(T!=null)E=T;else{let F=this.get_currentScope(),L=F!=null?F.node:null;E=L!=null?L.pos:null}throw k.thrown(new he(v,E??this.script.pos))}break;default:let p;switch(e._hx_index){case 26:p="subtract";break;case 27:p="multiply";break;case 28:p="divide";break;case 29:p="modulo";break;default:p="perform operation on"}let f="Cannot "+p+" "+this.getTypeName(n)+" and "+this.getTypeName(l),_=s,d;if(_!=null)d=_;else{let x=this.get_currentScope(),y=x!=null?x.node:null;d=y!=null?y.pos:null}throw k.thrown(new he(f,d??this.script.pos))}break;case 30:case 31:switch(e._hx_index){case 30:return t==i;case 31:return t!=i;default:throw k.thrown("Unreachable")}break;case 32:case 33:case 34:case 35:switch(n._hx_index){case 1:case 2:switch(l._hx_index){case 1:case 2:let d=parseFloat(Z.string(t)),x=parseFloat(Z.string(i));switch(e._hx_index){case 32:return d>x;case 33:return d<x;case 34:return d>=x;case 35:return d<=x;default:throw k.thrown("Unreachable")}break;default:let y="Cannot compare "+this.getTypeName(n)+" and "+this.getTypeName(l),b=s,v;if(b!=null)v=b;else{let T=this.get_currentScope(),E=T!=null?T.node:null;v=E!=null?E.pos:null}throw k.thrown(new he(y,v??this.script.pos))}break;default:let p="Cannot compare "+this.getTypeName(n)+" and "+this.getTypeName(l),f=s,_;if(f!=null)_=f;else{let d=this.get_currentScope(),x=d!=null?d.node:null;_=x!=null?x.pos:null}throw k.thrown(new he(p,_??this.script.pos))}break;case 36:let r=e.word;if(n._hx_index==3)if(l._hx_index==3)switch(e._hx_index){case 36:let p=e.word;return t?i:!1;case 37:let f=e.word;return t?!0:i;default:throw k.thrown("Unreachable")}else{let p="Cannot perform logical operation on "+this.getTypeName(n)+" and "+this.getTypeName(l),f=s,_;if(f!=null)_=f;else{let d=this.get_currentScope(),x=d!=null?d.node:null;_=x!=null?x.pos:null}throw k.thrown(new he(p,_??this.script.pos))}else{let p="Cannot perform logical operation on "+this.getTypeName(n)+" and "+this.getTypeName(l),f=s,_;if(f!=null)_=f;else{let d=this.get_currentScope(),x=d!=null?d.node:null;_=x!=null?x.pos:null}throw k.thrown(new he(p,_??this.script.pos))}break;case 37:let h=e.word;if(n._hx_index==3)if(l._hx_index==3)switch(e._hx_index){case 36:let p=e.word;return t?i:!1;case 37:let f=e.word;return t?!0:i;default:throw k.thrown("Unreachable")}else{let p="Cannot perform logical operation on "+this.getTypeName(n)+" and "+this.getTypeName(l),f=s,_;if(f!=null)_=f;else{let d=this.get_currentScope(),x=d!=null?d.node:null;_=x!=null?x.pos:null}throw k.thrown(new he(p,_??this.script.pos))}else{let p="Cannot perform logical operation on "+this.getTypeName(n)+" and "+this.getTypeName(l),f=s,_;if(f!=null)_=f;else{let d=this.get_currentScope(),x=d!=null?d.node:null;_=x!=null?x.pos:null}throw k.thrown(new he(p,_??this.script.pos))}break;default:let a="Invalid operation: "+Z.string(e),o=s,c;if(o!=null)c=o;else{let p=this.get_currentScope(),f=p!=null?p.node:null;c=f!=null?f.pos:null}throw k.thrown(new he(a,c??this.script.pos))}}valueToString(e){return e==null?"null":Z.string(e)}printLoreline(e){try{let t=new es;return t.enableComments=!1,Te.trim(t.print(e))}catch{return null}}}K["loreline.Interpreter"]=Ji.loreline.Interpreter=ds,ds.__name__="loreline.Interpreter",Object.assign(ds.prototype,{__class__:ds,__properties__:{get_currentInsertion:"get_currentInsertion",get_currentScope:"get_currentScope"}});class rn{static stringify(e,t){return t==null&&(t=!1),JSON.stringify(e,null,t?" ":null)}static parse(e){return JSON.parse(e)}}K["loreline.Json"]=rn,rn.__name__="loreline.Json";class ri{constructor(e,t){this.target=e,this.origin=t}}K["loreline.Reference"]=ri,ri.__name__="loreline.Reference",Object.assign(ri.prototype,{__class__:ri});class js{constructor(e){this.error=null,this.expr=null,this.hscript=null,this.func=e,this.codeToHscript=new qi;try{this.hscript=this.codeToHscript.process(e.code)}catch(t){let i=k.caught(t).unwrap();i instanceof li&&(this.error=i,this.error.pos=e.pos.withOffset(this.codeToHscript.input,this.error.pos.offset,this.error.pos.length,e.pos.offset)),this.hscript=this.codeToHscript.output.b}try{let t=new Yi;t.resumeErrors=!1,t.allowJSON=!0,t.allowTypes=!0;let i=e.name;this.expr=t.parseString(this.hscript,i??"?")}catch(t){let i=k.caught(t).unwrap();if(this.error==null)if(i instanceof ce){let s=i,n,l=s.e;switch(l._hx_index){case 0:n="Invalid character: "+l.c;break;case 1:n="Unexpected: "+l.s;break;case 2:n="Unterminated string";break;case 3:n="Unterminated comment";break;case 4:n="Invalid preprocessor: "+l.msg;break;case 5:n="Unknown variable: "+l.v;break;case 6:n="Invalid iterator: "+l.v;break;case 7:n="Invalid operator: "+l.op;break;case 8:n="Invalid access: "+l.f;break;case 9:n=l.msg;break}this.error=new ys(s,n,this.codeToHscript.toLorelinePos(e.pos,s.pmin,s.pmax))}else i instanceof li&&(this.error=i,this.error.pos=e.pos.withOffset(this.codeToHscript.input,this.error.pos.offset,this.error.pos.length,e.pos.offset));try{let s=new Yi;s.resumeErrors=!0,s.allowJSON=!0,s.allowTypes=!0;let n=e.name;this.expr=s.parseString(this.hscript,n??"?")}catch{}}}}K["loreline.FuncHscript"]=js,js.__name__="loreline.FuncHscript",Object.assign(js.prototype,{__class__:js});class Rs{constructor(e,t){this.completion=null,this.locals=null,e!=null&&(this.locals=e),t!=null&&(this.completion=t)}}K["loreline.HscriptCompletion"]=Rs,Rs.__name__="loreline.HscriptCompletion",Object.assign(Rs.prototype,{__class__:Rs});class Vs{constructor(e){this.hscriptFunctions=new Wi,this.childNodes=new Wi,this.parentNodes=new Wi,this.nodesById=new Wi,this.script=e,this.initialize()}initialize(){let e=this;this.script.each(function(t,i){let s=t.id.thisVal;if(e.nodesById.map._set(s.high,s.low,t),i!=null){let n=t.id.thisVal;e.parentNodes.map._set(n.high,n.low,i);let l=i.id.thisVal,r=e.childNodes.map._get(l.high,l.low);if(r==null){r=[];let h=i.id.thisVal;e.childNodes.map._set(h.high,h.low,r)}r.push(t)}})}getNodeById(e){let t=e.thisVal;return this.nodesById.map._get(t.high,t.low)}getNodeAtPosition(e){let t=null;return this.script.eachExcludingImported(function(i,s){let n=i.pos;n.length>0&&n.offset<=e.offset&&n.offset+n.length>=e.offset&&(t=i)}),t}getClosestNodeAtOrBeforePosition(e){let t=null,i=999999999;return this.script.eachExcludingImported(function(s,n){let l=s.pos,r=e.offset-l.offset;r>=0&&r<i&&(i=r,t=s)}),t}getNodesOfType(e,t){t==null&&(t=!1);let i=[],s=this;return this.traverse(this.script,function(n,l){return Q.__instanceof(n,e)&&i.push(n),t||n==s.script?!0:!(n instanceof Zt||n instanceof ci)}),i}getParentNode(e){let t=e.id.thisVal;return this.parentNodes.map._get(t.high,t.low)}getFirstParentOfType(e,t){let i=e;for(;i!=null;)if(i=this.getParentNode(i),i!=null&&Q.getClass(i)==t)return i;return null}getImportedPaths(e){let t=[];return this._getImportedPaths(e,this.script,t,new me),t}_getImportedPaths(e,t,i,s){let n=vt.directory(e);t==null&&(t=this.script);let l=".lor";e!=null&&e.endsWith(".lor.txt")&&(l=".lor.txt");let r=0,h=t.body;for(;r<h.length;){let a=h[r];if(++r,a instanceof Zt){let o=a,c,p=o.path.parts[0].partType;p._hx_index==0?c=p.text:c="",vt.isAbsolute(c)||(c=vt.join([n,c])),c=vt.normalize(c),c.toLowerCase().endsWith(l)||(c+=l),Object.prototype.hasOwnProperty.call(s.h,c)||(s.h[c]=!0,i.push(c),o.script!=null&&this._getImportedPaths(c,o.script,i,s))}}return i}resolveArrayAccess(e){let t=null;if(e.target instanceof lt?t=this.resolveAccess(e.target):e.target instanceof ui&&(t=this.resolveArrayAccess(e.target)),t==null)return null;switch(Q.getClass(t)){case Oe:let i=t;if(i.literalType==Re.Array){let n=i.value;if(e.index instanceof Oe){let l=e.index;if(l.literalType==Re.Number){let r=l.value|0;if(r>=0&&r<n.length){let h=n[r];if(h instanceof Pt)return h}}}}break;case Fi:let s=t;if(s.value instanceof Oe){let n=s.value;if(n.literalType==Re.Array){let l=n.value;if(e.index instanceof Oe){let r=e.index;if(r.literalType==Re.Number){let h=r.value|0;if(h>=0&&h<l.length){let a=l[h];if(a instanceof Pt)return a}}}}}break;default:}return null}resolveAccess(e){if(e.target!=null){let h=e.target instanceof lt?this.resolveAccess(e.target):e.target instanceof ui?this.resolveArrayAccess(e.target):null;if(h!=null)switch(h instanceof Fi&&(h=h.value),Q.getClass(h)){case Gt:let a=h,o=0,c=a.fields;for(;o<c.length;){let _=c[o];if(++o,_.name==e.name)return _}break;case Oe:let p=h,f=p.literalType;if(f._hx_index==4){let _=f.style,d=p.value,x=0;for(;x<d.length;){let y=d[x];if(++x,y.name==e.name)return y}}break;default:}return null}let t=e.name;if(t==null)return null;let i=this.getFirstParentOfType(e,De);for(;i!=null;){let h=null;if(this.traverse(i,function(a,o){if(h!=null)return!1;if(a instanceof Jt){let c=a,p=0,f=c.fields;for(;p<f.length;){let _=f[p];if(++p,_.name==t)return h=_,!1}}return!0}),h!=null)return h;i=this.getFirstParentOfType(i,De)}let s=null;if(this.traverse(this.script,function(h,a){if(s!=null)return!1;if(h instanceof Jt){let o=h,c=0,p=o.fields;for(;c<p.length;){let f=p[c];if(++c,f.name==t)return s=f,!1}}return h instanceof Zt?!0:h instanceof ci}),s!=null)return s;let n=this.findCharacterByNameFromNode(t,e);if(n!=null)return n;let l=this.findBeatByNameFromNode(t,e);if(l!=null)return l;let r=this.findFunctionByNameFromNode(t,e);return r??null}findBeatFromAccess(e){return e.target==null&&e.name!=null?this.findBeatByNameFromNode(e.name,e):null}findBeatFromTransition(e){return this.findBeatByNameFromNode(e.target,e)}findBeatFromInsertion(e){return this.findBeatByNameFromNode(e.target,e)}findBeatByPathFromNode(e,t){let i=e.split("."),s=this.findBeatByNameFromNode(i[0],t),n=1;for(;s!=null&&n<i.length;){let l=i[n],r=null;this.traverse(s,function(h,a){if(h instanceof De){let o=h;return o.name==l&&(r=o),!1}else return r==null}),s=r,++n}return s}isTopLevelNode(e){if(e instanceof be){let t=e;return this.script.body.indexOf(t)!=-1}return!1}findTopLevelBeatFromNode(e){if(this.isTopLevelNode(e))return e instanceof De?e:null;{let t=this.getFirstParentOfType(e,De);for(;t!=null&&!this.isTopLevelNode(t);)t=this.getFirstParentOfType(t,De);if(t!=null&&t instanceof De)return t}return null}findBeatByNameFromNode(e,t){let i=null,s=this.getFirstParentOfType(t,De);for(;s!=null;)this.traverse(s,function(n,l){if(i!=null||n==t)return!1;if(n instanceof De){let r=n;return r.name==e&&(i=r),!1}return!0}),s=this.getFirstParentOfType(s,De);return i==null&&this.traverse(this.script,function(n,l){if(i==null&&n instanceof De){let r=n;r.name==e&&(i=r)}return n instanceof Zt?!0:n instanceof ci}),i}findCharacterFromDialogue(e){return this.findCharacterByNameFromNode(e.character,e)}findCharacterByNameFromNode(e,t){let i=null;return this.traverse(this.script,function(s,n){if(i==null&&s instanceof Gt){let l=s;l.name==e&&(i=l)}return s instanceof Zt?!0:s instanceof ci}),i}findFunctionByNameFromNode(e,t){let i=null;return this.traverse(this.script,function(s,n){if(i==null&&s instanceof Di){let l=s;l.name==e&&(i=l)}return s instanceof Zt?!0:s instanceof ci}),i}getVisibleCharacters(){let e=[],t=this.script.iterator();for(;t.hasNext();){let i=t.next();i instanceof Gt&&e.push(i)}return e}getVisibleFunctions(){let e=[],t=this.script.iterator();for(;t.hasNext();){let i=t.next();i instanceof Di&&e.push(i)}return e}getVisibleStateFields(e){let t=[],i=new _i,s=e;for(;s!=null;){if(Q.getClass(s)==Jt){let l=s,r=0,h=l.fields;for(;r<h.length;){let a=h[r];++r;let o=a.id.thisVal;if(!i._exists(o.high,o.low)){let c=a.id.thisVal;i._set(c.high,c.low,!0),t.push(a)}}}let n=s.id.thisVal;s=this.parentNodes.map._get(n.high,n.low)}return this.script.each(function(n,l){if(Q.getClass(n)==Jt){let r=n;if(l instanceof ci){let h=0,a=r.fields;for(;h<a.length;){let o=a[h];++h;let c=o.id.thisVal;if(!i._exists(c.high,c.low)){let p=o.id.thisVal;i._set(p.high,p.low,!0),t.push(o)}}}}}),t}getVisibleBeats(e){let t=[],i=Object.create(null),s=this.getParentNode(e);for(;s!=null;){if(Q.getClass(s)==De&&this.getParentNode(s)!=null){let l=0,r=this.getNodesOfType(De);for(;l<r.length;){let h=r[l];++l,Object.prototype.hasOwnProperty.call(i,h.name)||(i[h.name]=!0,t.push(h))}}s=this.getParentNode(s)}return this.script.each(function(n,l){if(Q.getClass(n)==De&&l instanceof ci){let r=n;Object.prototype.hasOwnProperty.call(i,r.name)||(i[r.name]=!0,t.push(r))}}),t}getAllTags(){let e=Object.create(null);this.script.each(function(h,a){let o=h instanceof be?h:null;if(o!=null&&o.trailingComments!=null){let c=0,p=o.trailingComments;for(;c<p.length;){let f=p[c];if(++c,f.isHash){let _=Te.trim(f.content);e[_]=!0}}}});let t=[],i=e,s=i,n=Object.keys(i),l=n.length,r=0;for(;r<l;){let h=n[r++];t.push(h)}return t}countTags(){let e=new me;return this.script.each(function(t,i){let s=t instanceof be?t:null;if(s!=null&&s.trailingComments!=null){let n=0,l=s.trailingComments;for(;n<l.length;){let r=l[n];if(++n,r.isHash){let h=Te.trim(r.content),a=e.h[h],o=a??0;e.h[h]=o+1}}}}),e}findStateField(e){if(e.target!=null)return null;let t=this.getVisibleStateFields(e),i=0;for(;i<t.length;){let s=t[i];if(++i,s.name==e.name)return s}return null}findOutboundBeats(e){let t=new _i,i=this;this.traverse(e,function(r,h){switch(Q.getClass(r)){case Vt:let a=r;if(a.target instanceof lt){let _=a.target;if(_.target==null){let d=i.findBeatFromAccess(_);if(d!=null){let x=d.id,y=new ri(d,a),b=x.thisVal;t._set(b.high,b.low,y)}}}break;case zi:let o=r,c=i.findBeatByNameFromNode(o.target,o);if(c!=null){let _=c.id,d=new ri(c,o),x=_.thisVal;t._set(x.high,x.low,d)}break;case Ni:let p=r,f=i.findBeatByNameFromNode(p.target,p);if(f!=null){let _=f.id,d=new ri(f,p),x=_.thisVal;t._set(x.high,x.low,d)}break;default:}return!0});let s=[],n=t,l=0;for(;l<n._values.length&&n._values[l]==null;)++l;for(;l<n._values.length;){let r=n._values[l];for(++l;l<n._values.length&&n._values[l]==null;)++l;let h=r;s.push(h)}return s}findReferencesToBeat(e){let t=[],i=this;return this.script.each(function(s,n){switch(Q.getClass(s)){case Vt:let l=s;if(l.target instanceof lt){let a=l.target;if(a.target==null&&a.name==e.name){let o=i.findBeatFromAccess(a);o!=null&&o.id==e.id&&t.push(new ri(e,l))}}break;case zi:let r=s;r.target==e.name&&t.push(new ri(e,r));break;case Ni:let h=s;h.target==e.name&&t.push(new ri(e,h));break;default:}}),t}findModifiedStateFields(e){let t=Object.create(null),i=this;this.traverse(e,function(c,p){if(Q.getClass(c)==di){let f=c;if(f.target instanceof lt){let _=f.target,d=i.findStateField(_);if(d!=null){let x=d.name,y=new ri(d,f);t[x]=y}}}return!0});let s=[],n=t,l=n,r=Object.keys(n),h=r.length,a=0;for(;a<h;){let c=l[r[a++]];s.push(c)}let o=s;return o.sort(function(c,p){let f=c.target.name.toLowerCase(),_=p.target.name.toLowerCase();return f<_?-1:f>_?1:0}),o}findReadStateFields(e){let t=Object.create(null),i=this;this.traverse(e,function(c,p){if(Q.getClass(c)==lt){let f=c;if(p instanceof di&&p.target==c)return!0;let _=i.findStateField(f);if(_!=null){let d=_.name,x=new ri(_,f);t[d]=x}}return!0});let s=[],n=t,l=n,r=Object.keys(n),h=r.length,a=0;for(;a<h;){let c=l[r[a++]];s.push(c)}let o=s;return o.sort(function(c,p){let f=c.target.name.toLowerCase(),_=p.target.name.toLowerCase();return f<_?-1:f>_?1:0}),o}findBeatCharacters(e){let t=new _i,i=this;this.traverse(e,function(h,a){switch(Q.getClass(h)){case lt:let o=h;if(o.target==null){let f=i.findCharacterByNameFromNode(o.name,o);if(f!=null){let _=f.id,d=new ri(f,o),x=_.thisVal;t._set(x.high,x.low,d)}}break;case hi:let c=h,p=i.findCharacterFromDialogue(c);if(p!=null){let f=p.id,_=new ri(p,c),d=f.thisVal;t._set(d.high,d.low,_)}break;default:}return!0});let s=[],n=t,l=0;for(;l<n._values.length&&n._values[l]==null;)++l;for(;l<n._values.length;){let h=n._values[l];for(++l;l<n._values.length&&n._values[l]==null;)++l;let a=h;s.push(a)}let r=s;return r.sort(function(h,a){let o=h.target.name.toLowerCase(),c=a.target.name.toLowerCase();return o<c?-1:o>c?1:0}),r}findModifiedCharacterFields(e){let t=new _i,i=[],s=this;return this.traverse(e,function(n,l){if(Q.getClass(n)==di){let r=n;if(r.target instanceof lt){let h=r.target,a=s.resolveAccess(h);if(a instanceof Fi){let o=a.id.thisVal;if(!t._exists(o.high,o.low)&&s.getParentNode(a)instanceof Gt){let p=a.id.thisVal;t._set(p.high,p.low,!0),i.push(new ri(a,n))}}}}return!0}),i}findReadCharacterFields(e){let t=new _i,i=[],s=this;return this.traverse(e,function(n,l){if(Q.getClass(n)==lt){let r=n,h=s.getParentNode(r);if(h instanceof di&&h.target==r)return!0;let a=s.resolveAccess(r);if(a instanceof Fi){let o=a.id.thisVal;if(!t._exists(o.high,o.low)&&s.getParentNode(a)instanceof Gt){let p=a.id.thisVal;t._set(p.high,p.low,!0),i.push(new ri(a,n))}}}return!0}),i}traverse(e,t){let i=e.id.thisVal,s=this.childNodes.map._get(i.high,i.low);if(s!=null){let n=0,l=s.length;for(;n<l;){let r=n++,h=s[r];t(h,e)&&this.traverse(h,t)}}}getFuncHscript(e){let t=e.id,i=t.thisVal,s=this.hscriptFunctions.map._get(i.high,i.low);if(s==null){s=new js(e);let n=t.thisVal;this.hscriptFunctions.map._set(n.high,n.low,s)}return s}getHscriptExpr(e,t){let i=this.getFuncHscript(e);if(i.expr==null)return null;let s=t.offset-e.pos.offset,n=null,l=null;return l=function(r){if(r!=null){let h=i.codeToHscript.inputPosFromProcessedPos(r.pmin),a=i.codeToHscript.inputPosFromProcessedPos(r.pmax);s>=h&&s<=a&&(n=r),$s.iter(r,l)}},$s.iter(i.expr,l),n}resolveHscriptAccess(e,t){let i=t.e;switch(i._hx_index){case 1:let s=i.v,n=null;if(this.traverse(this.script,function(f,_){if(n!=null)return!1;if(f instanceof Jt){let d=f,x=0,y=d.fields;for(;x<y.length;){let b=y[x];if(++x,b.name==s)return n=b,!1}}return f instanceof Zt?!0:f instanceof ci}),n!=null)return n;let l=this.findCharacterByNameFromNode(s,e);if(l!=null)return l;let r=this.findBeatByNameFromNode(s,e);if(r!=null)return r;break;case 5:let h=i.e,a=i.f,o=h!=null?this.resolveHscriptAccess(e,h):null;if(o!=null)switch(o instanceof Fi&&(o=o.value),Q.getClass(o)){case Gt:let f=o,_=0,d=f.fields;for(;_<d.length;){let b=d[_];if(++_,b.name==a)return b}break;case Oe:let x=o,y=x.literalType;if(y._hx_index==4){let b=y.style,v=x.value,T=0;for(;T<v.length;){let E=v[T];if(++T,E.name==a)return E}}break;default:}break;case 16:let c=i.e,p=i.index;break;default:}return null}isHscriptExpr(e){return e!=null&&Object.prototype.hasOwnProperty.call(e,"e")?Q.__instanceof(Pe.field(e,"e"),D):!1}getHscriptCompletion(e,t){let i=this.getFuncHscript(e),s=t.offset-e.pos.offset+t.length,n=i.codeToHscript.processedPosFromInputPos(s),l=i.hscript,r=Math.min(n,i.hscript.length)|0,h=r!=null?l.substring(0,r):l.substring(0),a=h.length,o=h.indexOf("{",null)+1;h=a!=null?h.substring(o,a):h.substring(o);let c=h.length,p="",f=0,_=a-c;for(;f<_;){let b=f++;p+=String.fromCodePoint(32)}h=p+h;let d=null,x=new We;try{x.types.parser.allowJSON=!0,x.types.parser.allowTypes=!0,x.types.parser.resumeErrors=!0;let b=x.types.parser.parseString(h);x.check(b,null,!0)}catch(b){let v=k.caught(b).unwrap();v instanceof _s&&(d=v)}let y=x.locals;return new Rs(y,d)}resolveAccessInFunction(e,t){if(this.getFuncHscript(e).expr==null)return null;let s=this.getHscriptExpr(e,t);return s!=null?this.resolveHscriptAccess(e,s):null}}K["loreline.Lens"]=Vs,Vs.__name__="loreline.Lens",Object.assign(Vs.prototype,{__class__:Vs});class Zi extends li{constructor(e,t){super(e,t)}}K["loreline.LexerError"]=Zi,Zi.__name__="loreline.LexerError",Zi.__super__=li,Object.assign(Zi.prototype,{__class__:Zi});var Ii=Fe["loreline.LStringAttachment"]={__ename__:"loreline.LStringAttachment",__constructs__:null,Interpolation:(m=function(w,e,t,i,s){return{_hx_index:0,braces:w,inTag:e,expr:t,start:i,length:s,__enum__:"loreline.LStringAttachment",toString:C}},m._hx_name="Interpolation",m.__params__=["braces","inTag","expr","start","length"],m),Tag:(m=function(w,e,t){return{_hx_index:1,closing:w,start:e,length:t,__enum__:"loreline.LStringAttachment",toString:C}},m._hx_name="Tag",m.__params__=["closing","start","length"],m)};Ii.__constructs__=[Ii.Interpolation,Ii.Tag];class Pi{static toString(e){switch(e){case 0:return"ChoiceBrace";case 1:return"ChoiceIndent";case 2:return"StateBrace";case 3:return"StateIndent";case 4:return"CharacterBrace";case 5:return"CharacterIndent";case 6:return"BeatBrace";case 7:return"BeatIndent";case 8:return"AlternativeBrace";case 9:return"AlternativeIndent";case 10:return"Brace";case 11:return"Indent";case 12:return"Bracket"}}}var g=Fe["loreline.TokenType"]={__ename__:"loreline.TokenType",__constructs__:null,KwImport:{_hx_name:"KwImport",_hx_index:0,__enum__:"loreline.TokenType",toString:C},KwState:{_hx_name:"KwState",_hx_index:1,__enum__:"loreline.TokenType",toString:C},KwBeat:{_hx_name:"KwBeat",_hx_index:2,__enum__:"loreline.TokenType",toString:C},KwCharacter:{_hx_name:"KwCharacter",_hx_index:3,__enum__:"loreline.TokenType",toString:C},KwChoice:{_hx_name:"KwChoice",_hx_index:4,__enum__:"loreline.TokenType",toString:C},KwIf:{_hx_name:"KwIf",_hx_index:5,__enum__:"loreline.TokenType",toString:C},KwElse:{_hx_name:"KwElse",_hx_index:6,__enum__:"loreline.TokenType",toString:C},KwNew:{_hx_name:"KwNew",_hx_index:7,__enum__:"loreline.TokenType",toString:C},KwSequence:{_hx_name:"KwSequence",_hx_index:8,__enum__:"loreline.TokenType",toString:C},KwCycle:{_hx_name:"KwCycle",_hx_index:9,__enum__:"loreline.TokenType",toString:C},KwOnce:{_hx_name:"KwOnce",_hx_index:10,__enum__:"loreline.TokenType",toString:C},KwPick:{_hx_name:"KwPick",_hx_index:11,__enum__:"loreline.TokenType",toString:C},KwShuffle:{_hx_name:"KwShuffle",_hx_index:12,__enum__:"loreline.TokenType",toString:C},Separator:{_hx_name:"Separator",_hx_index:13,__enum__:"loreline.TokenType",toString:C},Function:(m=function(w,e,t,i){return{_hx_index:14,name:w,args:e,code:t,external:i,__enum__:"loreline.TokenType",toString:C}},m._hx_name="Function",m.__params__=["name","args","code","external"],m),LString:(m=function(w,e,t){return{_hx_index:15,quotes:w,s:e,attachments:t,__enum__:"loreline.TokenType",toString:C}},m._hx_name="LString",m.__params__=["quotes","s","attachments"],m),LNumber:(m=function(w){return{_hx_index:16,n:w,__enum__:"loreline.TokenType",toString:C}},m._hx_name="LNumber",m.__params__=["n"],m),LBoolean:(m=function(w){return{_hx_index:17,b:w,__enum__:"loreline.TokenType",toString:C}},m._hx_name="LBoolean",m.__params__=["b"],m),LNull:{_hx_name:"LNull",_hx_index:18,__enum__:"loreline.TokenType",toString:C},Identifier:(m=function(w){return{_hx_index:19,name:w,__enum__:"loreline.TokenType",toString:C}},m._hx_name="Identifier",m.__params__=["name"],m),OpAssign:{_hx_name:"OpAssign",_hx_index:20,__enum__:"loreline.TokenType",toString:C},OpPlusAssign:{_hx_name:"OpPlusAssign",_hx_index:21,__enum__:"loreline.TokenType",toString:C},OpMinusAssign:{_hx_name:"OpMinusAssign",_hx_index:22,__enum__:"loreline.TokenType",toString:C},OpMultiplyAssign:{_hx_name:"OpMultiplyAssign",_hx_index:23,__enum__:"loreline.TokenType",toString:C},OpDivideAssign:{_hx_name:"OpDivideAssign",_hx_index:24,__enum__:"loreline.TokenType",toString:C},OpPlus:{_hx_name:"OpPlus",_hx_index:25,__enum__:"loreline.TokenType",toString:C},OpMinus:{_hx_name:"OpMinus",_hx_index:26,__enum__:"loreline.TokenType",toString:C},OpMultiply:{_hx_name:"OpMultiply",_hx_index:27,__enum__:"loreline.TokenType",toString:C},OpDivide:{_hx_name:"OpDivide",_hx_index:28,__enum__:"loreline.TokenType",toString:C},OpModulo:{_hx_name:"OpModulo",_hx_index:29,__enum__:"loreline.TokenType",toString:C},OpEquals:{_hx_name:"OpEquals",_hx_index:30,__enum__:"loreline.TokenType",toString:C},OpNotEquals:{_hx_name:"OpNotEquals",_hx_index:31,__enum__:"loreline.TokenType",toString:C},OpGreater:{_hx_name:"OpGreater",_hx_index:32,__enum__:"loreline.TokenType",toString:C},OpLess:{_hx_name:"OpLess",_hx_index:33,__enum__:"loreline.TokenType",toString:C},OpGreaterEq:{_hx_name:"OpGreaterEq",_hx_index:34,__enum__:"loreline.TokenType",toString:C},OpLessEq:{_hx_name:"OpLessEq",_hx_index:35,__enum__:"loreline.TokenType",toString:C},OpAnd:(m=function(w){return{_hx_index:36,word:w,__enum__:"loreline.TokenType",toString:C}},m._hx_name="OpAnd",m.__params__=["word"],m),OpOr:(m=function(w){return{_hx_index:37,word:w,__enum__:"loreline.TokenType",toString:C}},m._hx_name="OpOr",m.__params__=["word"],m),OpNot:{_hx_name:"OpNot",_hx_index:38,__enum__:"loreline.TokenType",toString:C},Arrow:{_hx_name:"Arrow",_hx_index:39,__enum__:"loreline.TokenType",toString:C},Colon:{_hx_name:"Colon",_hx_index:40,__enum__:"loreline.TokenType",toString:C},Comma:{_hx_name:"Comma",_hx_index:41,__enum__:"loreline.TokenType",toString:C},Dot:{_hx_name:"Dot",_hx_index:42,__enum__:"loreline.TokenType",toString:C},LBrace:{_hx_name:"LBrace",_hx_index:43,__enum__:"loreline.TokenType",toString:C},RBrace:{_hx_name:"RBrace",_hx_index:44,__enum__:"loreline.TokenType",toString:C},LParen:{_hx_name:"LParen",_hx_index:45,__enum__:"loreline.TokenType",toString:C},RParen:{_hx_name:"RParen",_hx_index:46,__enum__:"loreline.TokenType",toString:C},LBracket:{_hx_name:"LBracket",_hx_index:47,__enum__:"loreline.TokenType",toString:C},RBracket:{_hx_name:"RBracket",_hx_index:48,__enum__:"loreline.TokenType",toString:C},CommentLine:(m=function(w){return{_hx_index:49,content:w,__enum__:"loreline.TokenType",toString:C}},m._hx_name="CommentLine",m.__params__=["content"],m),CommentMultiLine:(m=function(w){return{_hx_index:50,content:w,__enum__:"loreline.TokenType",toString:C}},m._hx_name="CommentMultiLine",m.__params__=["content"],m),CommentHash:(m=function(w){return{_hx_index:51,content:w,__enum__:"loreline.TokenType",toString:C}},m._hx_name="CommentHash",m.__params__=["content"],m),Indent:{_hx_name:"Indent",_hx_index:52,__enum__:"loreline.TokenType",toString:C},Unindent:{_hx_name:"Unindent",_hx_index:53,__enum__:"loreline.TokenType",toString:C},LineBreak:{_hx_name:"LineBreak",_hx_index:54,__enum__:"loreline.TokenType",toString:C},Eof:{_hx_name:"Eof",_hx_index:55,__enum__:"loreline.TokenType",toString:C}};g.__constructs__=[g.KwImport,g.KwState,g.KwBeat,g.KwCharacter,g.KwChoice,g.KwIf,g.KwElse,g.KwNew,g.KwSequence,g.KwCycle,g.KwOnce,g.KwPick,g.KwShuffle,g.Separator,g.Function,g.LString,g.LNumber,g.LBoolean,g.LNull,g.Identifier,g.OpAssign,g.OpPlusAssign,g.OpMinusAssign,g.OpMultiplyAssign,g.OpDivideAssign,g.OpPlus,g.OpMinus,g.OpMultiply,g.OpDivide,g.OpModulo,g.OpEquals,g.OpNotEquals,g.OpGreater,g.OpLess,g.OpGreaterEq,g.OpLessEq,g.OpAnd,g.OpOr,g.OpNot,g.Arrow,g.Colon,g.Comma,g.Dot,g.LBrace,g.RBrace,g.LParen,g.RParen,g.LBracket,g.RBracket,g.CommentLine,g.CommentMultiLine,g.CommentHash,g.Indent,g.Unindent,g.LineBreak,g.Eof];class Ft{static equals(e,t){switch(e._hx_index){case 1:return t._hx_index==1?!0:re.enumEq(e,t);case 2:return t._hx_index==2?!0:re.enumEq(e,t);case 3:return t._hx_index==3?!0:re.enumEq(e,t);case 4:return t._hx_index==4?!0:re.enumEq(e,t);case 5:return t._hx_index==5?!0:re.enumEq(e,t);case 6:return t._hx_index==6?!0:re.enumEq(e,t);case 7:return t._hx_index==7?!0:re.enumEq(e,t);case 8:return t._hx_index==8?!0:re.enumEq(e,t);case 9:return t._hx_index==9?!0:re.enumEq(e,t);case 10:return t._hx_index==10?!0:re.enumEq(e,t);case 11:return t._hx_index==11?!0:re.enumEq(e,t);case 12:return t._hx_index==12?!0:re.enumEq(e,t);case 13:return t._hx_index==13?!0:re.enumEq(e,t);case 15:let i=e.s,s=e.attachments;if(t._hx_index==15){let r=t.s,h=t.attachments,a=t.quotes;return e.quotes==a}else return re.enumEq(e,t);break;case 16:if(t._hx_index==16){let r=t.n;return e.n==r}else return re.enumEq(e,t);break;case 17:if(t._hx_index==17){let r=t.b;return e.b==r}else return re.enumEq(e,t);break;case 18:return t._hx_index==18?!0:re.enumEq(e,t);case 19:if(t._hx_index==19){let r=t.name;return e.name==r}else return re.enumEq(e,t);break;case 20:return t._hx_index==20?!0:re.enumEq(e,t);case 21:return t._hx_index==21?!0:re.enumEq(e,t);case 22:return t._hx_index==22?!0:re.enumEq(e,t);case 23:return t._hx_index==23?!0:re.enumEq(e,t);case 24:return t._hx_index==24?!0:re.enumEq(e,t);case 25:return t._hx_index==25?!0:re.enumEq(e,t);case 26:return t._hx_index==26?!0:re.enumEq(e,t);case 27:return t._hx_index==27?!0:re.enumEq(e,t);case 28:return t._hx_index==28?!0:re.enumEq(e,t);case 29:return t._hx_index==29?!0:re.enumEq(e,t);case 30:return t._hx_index==30?!0:re.enumEq(e,t);case 31:return t._hx_index==31?!0:re.enumEq(e,t);case 32:return t._hx_index==32?!0:re.enumEq(e,t);case 33:return t._hx_index==33?!0:re.enumEq(e,t);case 34:return t._hx_index==34?!0:re.enumEq(e,t);case 35:return t._hx_index==35?!0:re.enumEq(e,t);case 36:let n=e.word;if(t._hx_index==36){let r=t.word;return!0}else return re.enumEq(e,t);break;case 37:let l=e.word;if(t._hx_index==37){let r=t.word;return!0}else return re.enumEq(e,t);break;case 38:return t._hx_index==38?!0:re.enumEq(e,t);case 39:return t._hx_index==39?!0:re.enumEq(e,t);case 40:return t._hx_index==40?!0:re.enumEq(e,t);case 42:return t._hx_index==42?!0:re.enumEq(e,t);case 43:return t._hx_index==43?!0:re.enumEq(e,t);case 44:return t._hx_index==44?!0:re.enumEq(e,t);case 45:return t._hx_index==45?!0:re.enumEq(e,t);case 46:return t._hx_index==46?!0:re.enumEq(e,t);case 47:return t._hx_index==47?!0:re.enumEq(e,t);case 48:return t._hx_index==48?!0:re.enumEq(e,t);case 49:if(t._hx_index==49){let r=t.content;return e.content==r}else return re.enumEq(e,t);break;case 50:if(t._hx_index==50){let r=t.content;return e.content==r}else return re.enumEq(e,t);break;case 51:if(t._hx_index==51){let r=t.content;return e.content==r}else return re.enumEq(e,t);break;case 52:return t._hx_index==52?!0:re.enumEq(e,t);case 53:return t._hx_index==53?!0:re.enumEq(e,t);case 54:return t._hx_index==54?!0:re.enumEq(e,t);case 55:return t._hx_index==55?!0:re.enumEq(e,t);default:return re.enumEq(e,t)}}static isComment(e){switch(e._hx_index){case 49:let t=e.content;return!0;case 50:let i=e.content;return!0;case 51:let s=e.content;return!0;default:return!1}}static isAssignOp(e){switch(e._hx_index){case 20:case 21:case 22:case 23:case 24:return!0;default:return!1}}static isIdentifier(e){if(e._hx_index==19){let t=e.name;return!0}else return!1}static isBlockStart(e){switch(e._hx_index){case 1:case 2:case 3:case 4:case 5:return!0;case 8:case 9:case 10:case 11:case 12:case 13:return!0;default:return!1}}static toCodeString(e){switch(e._hx_index){case 0:return"import";case 1:return"state";case 2:return"beat";case 3:return"character";case 4:return"choice";case 5:return"if";case 6:return"else";case 7:return"new";case 8:return"sequence";case 9:return"cycle";case 10:return"once";case 11:return"pick";case 12:return"shuffle";case 13:return"--";case 14:let t=e.name,i=e.args,s=e.code,n=e.external;return"function";case 15:let l=e.quotes,r=e.s,h=e.attachments;return"string";case 16:let a=e.n;return"number";case 17:let o=e.b;return"boolean";case 18:return"null";case 19:let c=e.name;return"identifier";case 20:return"=";case 21:return"+=";case 22:return"-=";case 23:return"*=";case 24:return"/=";case 25:return"+";case 26:return"-";case 27:return"*";case 28:return"/";case 29:return"%";case 30:return"==";case 31:return"!=";case 32:return">";case 33:return"<";case 34:return">=";case 35:return"<=";case 36:return e.word?"and":"&&";case 37:return e.word?"or":"||";case 38:return"!";case 39:return"->";case 40:return":";case 41:return",";case 42:return".";case 43:return"{";case 44:return"}";case 45:return"(";case 46:return")";case 47:return"[";case 48:return"]";case 49:let _=e.content;return"comment";case 50:let d=e.content;return"multiline comment";case 51:let x=e.content;return"hash comment";case 52:return"indent";case 53:return"unindent";case 54:return"line break";case 55:return"end of file"}}}K["loreline.TokenTypeHelpers"]=Ft,Ft.__name__="loreline.TokenTypeHelpers";class ie{constructor(e,t){this.type=e,this.pos=t}toString(){return""+Z.string(this.type)+" at "+this.pos.toString()}}K["loreline.Token"]=ie,ie.__name__="loreline.Token",Object.assign(ie.prototype,{__class__:ie});class wt{constructor(e){this.errors=null,this.allowTabs=!0,this.detectedIndentSize=2,this.indentSize=4,this.indentTokens=[],this.indentStack=[],this.indentLevel=0,this.input=e,this.length=e.length,this.reset()}reset(){this.pos=0,this.line=1,this.column=1,this.startLine=1,this.startColumn=1,this.previous=null,this.stack=[],this.nextBlock=10,this.tokenized=null,this.strictExprs=[],this.indentLevel=0,this.indentStack=[0],this.indentTokens=[]}tokenize(){let e=[];for(this.tokenized=e;;){let t=this.nextToken();if(t.type==g.Eof){if(this.indentStack.length>1){let i=this.indentStack.length-1,s=0,n=i;for(;s<n;){let l=s++,r=null;r==null&&(r=new z(this.startLine,this.startColumn,this.pos)),r.length=this.pos-r.offset;let h=new ie(g.Unindent,r);this.previous=h,e.push(h)}}break}switch(e.push(t),t.type._hx_index){case 1:this.nextBlock=3;break;case 2:this.nextBlock=7;break;case 3:this.nextBlock=5;break;case 4:this.nextBlock=1;break;case 8:case 9:case 10:case 11:case 12:case 13:this.nextBlock=9;break;case 43:let i;switch(this.nextBlock){case 0:case 1:i=0;break;case 2:case 3:i=2;break;case 4:case 5:i=4;break;case 6:case 7:i=7;break;case 8:case 9:i=8;break;case 10:case 11:case 12:i=10;break}this.stack.push(i),this.nextBlock=10;break;case 47:this.stack.push(12),this.nextBlock=10;break;case 44:case 48:case 53:this.stack.pop(),this.nextBlock=10;break;case 52:let s;switch(this.nextBlock){case 0:case 1:s=1;break;case 2:case 3:s=3;break;case 4:case 5:s=5;break;case 6:case 7:s=7;break;case 8:case 9:s=9;break;case 10:case 11:case 12:s=11;break}this.stack.push(s),this.nextBlock=10;break;default:}}return e}nextToken(){if(this.indentTokens.length>0)return this.indentTokens.shift();if(this.skipWhitespace(),this.pos>=this.length){let i=null;i==null&&(i=new z(this.startLine,this.startColumn,this.pos)),i.length=this.pos-i.offset;let s=new ie(g.Eof,i);return this.previous=s,s}this.startLine=this.line,this.startColumn=this.column;let e=u.cca(this.input,this.pos);if(e==10||e==13){let i=this.readLineBreak(),s=this.countIndentation();if(s>this.indentStack[this.indentStack.length-1]){this.indentStack.length==1&&(this.detectedIndentSize=s-this.indentStack[0]),this.indentStack.push(s);let n=this.indentTokens,l=null;l==null&&(l=new z(this.startLine,this.startColumn,this.pos)),l.length=this.pos-l.offset;let r=new ie(g.Indent,l);this.previous=r,n.push(r)}else if(s<this.indentStack[this.indentStack.length-1])for(;this.indentStack.length>0&&s<this.indentStack[this.indentStack.length-1];){this.indentStack.pop();let n=this.indentTokens,l=null;l==null&&(l=new z(this.startLine,this.startColumn,this.pos)),l.length=this.pos-l.offset;let r=new ie(g.Unindent,l);this.previous=r,n.push(r)}return i}let t=new z(this.startLine,this.startColumn,this.pos);if(this.tokenized.length>0&&this.tokenized[this.tokenized.length-1].type==g.KwImport)return this.readImportValue(e,t);if(e==null){let i=this.tryReadUnquotedString();if(i!=null)return i;if(e==null){let s=e;if(s>=48&&s<=57)return this.readNumber();{let n=e;return n>=97&&n<=122||n>=65&&n<=90||n==95?this.readIdentifier():(this.error("Unexpected character: "+String.fromCodePoint(e),!0),null)}}else switch(e){case 33:let s=e;if(s>=48&&s<=57)return this.readNumber();{let O=e;if(O>=97&&O<=122||O>=65&&O<=90||O==95)return this.readIdentifier();if((this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==61){let q=2;for(;q-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let S=t;S==null&&(S=new z(this.startLine,this.startColumn,this.pos)),S.length=this.pos-S.offset;let W=new ie(g.OpNotEquals,S);return this.previous=W,W}else{let q=1;for(;q-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let S=t;S==null&&(S=new z(this.startLine,this.startColumn,this.pos)),S.length=this.pos-S.offset;let W=new ie(g.OpNot,S);return this.previous=W,W}}break;case 35:let n=e;if(n>=48&&n<=57)return this.readNumber();{let O=e;if(O>=97&&O<=122||O>=65&&O<=90||O==95)return this.readIdentifier();{let q=this.pos+1<this.length?u.cca(this.input,this.pos+1):0;return q>=97&&q<=122||q>=65&&q<=90||q==95||q>=48&&q<=57||q==45?this.readHashComment():(this.error("Unexpected character: #",!0),null)}}break;case 37:let l=e;if(l>=48&&l<=57)return this.readNumber();{let O=e;if(O>=97&&O<=122||O>=65&&O<=90||O==95)return this.readIdentifier();{let q=1;for(;q-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let S=t;S==null&&(S=new z(this.startLine,this.startColumn,this.pos)),S.length=this.pos-S.offset;let W=new ie(g.OpModulo,S);return this.previous=W,W}}break;case 38:let r=e;if(r>=48&&r<=57)return this.readNumber();{let O=e;if(O>=97&&O<=122||O>=65&&O<=90||O==95)return this.readIdentifier();if((this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==38){let q=2;for(;q-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let S=t;S==null&&(S=new z(this.startLine,this.startColumn,this.pos)),S.length=this.pos-S.offset;let W=new ie(g.OpAnd(!1),S);return this.previous=W,W}else{let q=1;for(;q-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;this.error("Expected &",!1);let S=t;S==null&&(S=new z(this.startLine,this.startColumn,this.pos)),S.length=this.pos-S.offset;let W=new ie(g.OpAnd(!1),S);return this.previous=W,W}}break;case 40:let h=1;for(;h-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;this.makeStrictIfFollowingCallable();let a=t;a==null&&(a=new z(this.startLine,this.startColumn,this.pos)),a.length=this.pos-a.offset;let o=new ie(g.LParen,a);return this.previous=o,o;case 41:let c=1;for(;c-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;this.strictExprs.pop();let p=t;p==null&&(p=new z(this.startLine,this.startColumn,this.pos)),p.length=this.pos-p.offset;let f=new ie(g.RParen,p);return this.previous=f,f;case 42:let _=e;if(_>=48&&_<=57)return this.readNumber();{let O=e;if(O>=97&&O<=122||O>=65&&O<=90||O==95)return this.readIdentifier();if((this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==61){let q=2;for(;q-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let S=t;S==null&&(S=new z(this.startLine,this.startColumn,this.pos)),S.length=this.pos-S.offset;let W=new ie(g.OpMultiplyAssign,S);return this.previous=W,W}else{let q=1;for(;q-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let S=t;S==null&&(S=new z(this.startLine,this.startColumn,this.pos)),S.length=this.pos-S.offset;let W=new ie(g.OpMultiply,S);return this.previous=W,W}}break;case 43:let d=e;if(d>=48&&d<=57)return this.readNumber();{let O=e;if(O>=97&&O<=122||O>=65&&O<=90||O==95)return this.readIdentifier();if((this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==61){let q=2;for(;q-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let S=t;S==null&&(S=new z(this.startLine,this.startColumn,this.pos)),S.length=this.pos-S.offset;let W=new ie(g.OpPlusAssign,S);return this.previous=W,W}else{let q=1;for(;q-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let S=t;S==null&&(S=new z(this.startLine,this.startColumn,this.pos)),S.length=this.pos-S.offset;let W=new ie(g.OpPlus,S);return this.previous=W,W}}break;case 44:let x=1;for(;x-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let y=t;y==null&&(y=new z(this.startLine,this.startColumn,this.pos)),y.length=this.pos-y.offset;let b=new ie(g.Comma,y);return this.previous=b,b;case 45:let v=e;if(v>=48&&v<=57)return this.readNumber();{let O=e;if(O>=97&&O<=122||O>=65&&O<=90||O==95)return this.readIdentifier();if((this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==62){let q=2;for(;q-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let S=t;S==null&&(S=new z(this.startLine,this.startColumn,this.pos)),S.length=this.pos-S.offset;let W=new ie(g.Arrow,S);return this.previous=W,W}else if((this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==45&&this.strictExprs.length==0){let q=2;for(;q-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let S=t;S==null&&(S=new z(this.startLine,this.startColumn,this.pos)),S.length=this.pos-S.offset;let W=new ie(g.Separator,S);return this.previous=W,W}else if((this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==61){let q=2;for(;q-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let S=t;S==null&&(S=new z(this.startLine,this.startColumn,this.pos)),S.length=this.pos-S.offset;let W=new ie(g.OpMinusAssign,S);return this.previous=W,W}else{let q=1;for(;q-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let S=t;S==null&&(S=new z(this.startLine,this.startColumn,this.pos)),S.length=this.pos-S.offset;let W=new ie(g.OpMinus,S);return this.previous=W,W}}break;case 46:let T=1;for(;T-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let E=t;E==null&&(E=new z(this.startLine,this.startColumn,this.pos)),E.length=this.pos-E.offset;let F=new ie(g.Dot,E);return this.previous=F,F;case 47:let L=e;if(L>=48&&L<=57)return this.readNumber();{let O=e;if(O>=97&&O<=122||O>=65&&O<=90||O==95)return this.readIdentifier();if((this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==61){let q=2;for(;q-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let S=t;S==null&&(S=new z(this.startLine,this.startColumn,this.pos)),S.length=this.pos-S.offset;let W=new ie(g.OpDivideAssign,S);return this.previous=W,W}else{if((this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==47)return this.readLineComment();if((this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==42)return this.readMultiLineComment();{let q=1;for(;q-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let S=t;S==null&&(S=new z(this.startLine,this.startColumn,this.pos)),S.length=this.pos-S.offset;let W=new ie(g.OpDivide,S);return this.previous=W,W}}}break;case 58:let A=1;for(;A-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let B=t;B==null&&(B=new z(this.startLine,this.startColumn,this.pos)),B.length=this.pos-B.offset;let I=new ie(g.Colon,B);return this.previous=I,I;case 60:let H=e;if(H>=48&&H<=57)return this.readNumber();{let O=e;if(O>=97&&O<=122||O>=65&&O<=90||O==95)return this.readIdentifier();if((this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==61){let q=2;for(;q-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let S=t;S==null&&(S=new z(this.startLine,this.startColumn,this.pos)),S.length=this.pos-S.offset;let W=new ie(g.OpLessEq,S);return this.previous=W,W}else{let q=1;for(;q-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let S=t;S==null&&(S=new z(this.startLine,this.startColumn,this.pos)),S.length=this.pos-S.offset;let W=new ie(g.OpLess,S);return this.previous=W,W}}break;case 61:let P=e;if(P>=48&&P<=57)return this.readNumber();{let O=e;if(O>=97&&O<=122||O>=65&&O<=90||O==95)return this.readIdentifier();if((this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==61){let q=2;for(;q-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let S=t;S==null&&(S=new z(this.startLine,this.startColumn,this.pos)),S.length=this.pos-S.offset;let W=new ie(g.OpEquals,S);return this.previous=W,W}else{let q=1;for(;q-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let S=t;S==null&&(S=new z(this.startLine,this.startColumn,this.pos)),S.length=this.pos-S.offset;let W=new ie(g.OpAssign,S);return this.previous=W,W}}break;case 62:let M=e;if(M>=48&&M<=57)return this.readNumber();{let O=e;if(O>=97&&O<=122||O>=65&&O<=90||O==95)return this.readIdentifier();if((this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==61){let q=2;for(;q-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let S=t;S==null&&(S=new z(this.startLine,this.startColumn,this.pos)),S.length=this.pos-S.offset;let W=new ie(g.OpGreaterEq,S);return this.previous=W,W}else{let q=1;for(;q-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let S=t;S==null&&(S=new z(this.startLine,this.startColumn,this.pos)),S.length=this.pos-S.offset;let W=new ie(g.OpGreater,S);return this.previous=W,W}}break;case 93:let V=1;for(;V-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;this.strictExprs.pop();let R=t;R==null&&(R=new z(this.startLine,this.startColumn,this.pos)),R.length=this.pos-R.offset;let Y=new ie(g.RBracket,R);return this.previous=Y,Y;case 124:let $=e;if($>=48&&$<=57)return this.readNumber();{let O=e;if(O>=97&&O<=122||O>=65&&O<=90||O==95)return this.readIdentifier();if((this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==124){let q=2;for(;q-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let S=t;S==null&&(S=new z(this.startLine,this.startColumn,this.pos)),S.length=this.pos-S.offset;let W=new ie(g.OpOr(!1),S);return this.previous=W,W}else{let q=1;for(;q-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;this.error("Expected |",!1);let S=t;S==null&&(S=new z(this.startLine,this.startColumn,this.pos)),S.length=this.pos-S.offset;let W=new ie(g.OpOr(!1),S);return this.previous=W,W}}break;default:let te=e;if(te>=48&&te<=57)return this.readNumber();{let O=e;return O>=97&&O<=122||O>=65&&O<=90||O==95?this.readIdentifier():(this.error("Unexpected character: "+String.fromCodePoint(e),!0),null)}}}else switch(e){case 34:return this.readString(t);case 91:let i=1;for(;i-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;this.makeLooseOrStrictAfterBracket();let s=t;s==null&&(s=new z(this.startLine,this.startColumn,this.pos)),s.length=this.pos-s.offset;let n=new ie(g.LBracket,s);return this.previous=n,n;case 123:let l=1;for(;l-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let r=t;r==null&&(r=new z(this.startLine,this.startColumn,this.pos)),r.length=this.pos-r.offset;let h=new ie(g.LBrace,r);return this.previous=h,h;case 125:let a=1;for(;a-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let o=t;o==null&&(o=new z(this.startLine,this.startColumn,this.pos)),o.length=this.pos-o.offset;let c=new ie(g.RBrace,o);return this.previous=c,c;default:let p=this.tryReadUnquotedString();if(p!=null)return p;if(e==null){let f=e;if(f>=48&&f<=57)return this.readNumber();{let _=e;return _>=97&&_<=122||_>=65&&_<=90||_==95?this.readIdentifier():(this.error("Unexpected character: "+String.fromCodePoint(e),!0),null)}}else switch(e){case 33:let f=e;if(f>=48&&f<=57)return this.readNumber();{let J=e;if(J>=97&&J<=122||J>=65&&J<=90||J==95)return this.readIdentifier();if((this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==61){let se=2;for(;se-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let N=t;N==null&&(N=new z(this.startLine,this.startColumn,this.pos)),N.length=this.pos-N.offset;let X=new ie(g.OpNotEquals,N);return this.previous=X,X}else{let se=1;for(;se-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let N=t;N==null&&(N=new z(this.startLine,this.startColumn,this.pos)),N.length=this.pos-N.offset;let X=new ie(g.OpNot,N);return this.previous=X,X}}break;case 35:let _=e;if(_>=48&&_<=57)return this.readNumber();{let J=e;if(J>=97&&J<=122||J>=65&&J<=90||J==95)return this.readIdentifier();{let se=this.pos+1<this.length?u.cca(this.input,this.pos+1):0;return se>=97&&se<=122||se>=65&&se<=90||se==95||se>=48&&se<=57||se==45?this.readHashComment():(this.error("Unexpected character: #",!0),null)}}break;case 37:let d=e;if(d>=48&&d<=57)return this.readNumber();{let J=e;if(J>=97&&J<=122||J>=65&&J<=90||J==95)return this.readIdentifier();{let se=1;for(;se-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let N=t;N==null&&(N=new z(this.startLine,this.startColumn,this.pos)),N.length=this.pos-N.offset;let X=new ie(g.OpModulo,N);return this.previous=X,X}}break;case 38:let x=e;if(x>=48&&x<=57)return this.readNumber();{let J=e;if(J>=97&&J<=122||J>=65&&J<=90||J==95)return this.readIdentifier();if((this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==38){let se=2;for(;se-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let N=t;N==null&&(N=new z(this.startLine,this.startColumn,this.pos)),N.length=this.pos-N.offset;let X=new ie(g.OpAnd(!1),N);return this.previous=X,X}else{let se=1;for(;se-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;this.error("Expected &",!1);let N=t;N==null&&(N=new z(this.startLine,this.startColumn,this.pos)),N.length=this.pos-N.offset;let X=new ie(g.OpAnd(!1),N);return this.previous=X,X}}break;case 40:let y=1;for(;y-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;this.makeStrictIfFollowingCallable();let b=t;b==null&&(b=new z(this.startLine,this.startColumn,this.pos)),b.length=this.pos-b.offset;let v=new ie(g.LParen,b);return this.previous=v,v;case 41:let T=1;for(;T-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;this.strictExprs.pop();let E=t;E==null&&(E=new z(this.startLine,this.startColumn,this.pos)),E.length=this.pos-E.offset;let F=new ie(g.RParen,E);return this.previous=F,F;case 42:let L=e;if(L>=48&&L<=57)return this.readNumber();{let J=e;if(J>=97&&J<=122||J>=65&&J<=90||J==95)return this.readIdentifier();if((this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==61){let se=2;for(;se-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let N=t;N==null&&(N=new z(this.startLine,this.startColumn,this.pos)),N.length=this.pos-N.offset;let X=new ie(g.OpMultiplyAssign,N);return this.previous=X,X}else{let se=1;for(;se-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let N=t;N==null&&(N=new z(this.startLine,this.startColumn,this.pos)),N.length=this.pos-N.offset;let X=new ie(g.OpMultiply,N);return this.previous=X,X}}break;case 43:let A=e;if(A>=48&&A<=57)return this.readNumber();{let J=e;if(J>=97&&J<=122||J>=65&&J<=90||J==95)return this.readIdentifier();if((this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==61){let se=2;for(;se-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let N=t;N==null&&(N=new z(this.startLine,this.startColumn,this.pos)),N.length=this.pos-N.offset;let X=new ie(g.OpPlusAssign,N);return this.previous=X,X}else{let se=1;for(;se-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let N=t;N==null&&(N=new z(this.startLine,this.startColumn,this.pos)),N.length=this.pos-N.offset;let X=new ie(g.OpPlus,N);return this.previous=X,X}}break;case 44:let B=1;for(;B-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let I=t;I==null&&(I=new z(this.startLine,this.startColumn,this.pos)),I.length=this.pos-I.offset;let H=new ie(g.Comma,I);return this.previous=H,H;case 45:let P=e;if(P>=48&&P<=57)return this.readNumber();{let J=e;if(J>=97&&J<=122||J>=65&&J<=90||J==95)return this.readIdentifier();if((this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==62){let se=2;for(;se-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let N=t;N==null&&(N=new z(this.startLine,this.startColumn,this.pos)),N.length=this.pos-N.offset;let X=new ie(g.Arrow,N);return this.previous=X,X}else if((this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==45&&this.strictExprs.length==0){let se=2;for(;se-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let N=t;N==null&&(N=new z(this.startLine,this.startColumn,this.pos)),N.length=this.pos-N.offset;let X=new ie(g.Separator,N);return this.previous=X,X}else if((this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==61){let se=2;for(;se-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let N=t;N==null&&(N=new z(this.startLine,this.startColumn,this.pos)),N.length=this.pos-N.offset;let X=new ie(g.OpMinusAssign,N);return this.previous=X,X}else{let se=1;for(;se-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let N=t;N==null&&(N=new z(this.startLine,this.startColumn,this.pos)),N.length=this.pos-N.offset;let X=new ie(g.OpMinus,N);return this.previous=X,X}}break;case 46:let M=1;for(;M-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let V=t;V==null&&(V=new z(this.startLine,this.startColumn,this.pos)),V.length=this.pos-V.offset;let R=new ie(g.Dot,V);return this.previous=R,R;case 47:let Y=e;if(Y>=48&&Y<=57)return this.readNumber();{let J=e;if(J>=97&&J<=122||J>=65&&J<=90||J==95)return this.readIdentifier();if((this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==61){let se=2;for(;se-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let N=t;N==null&&(N=new z(this.startLine,this.startColumn,this.pos)),N.length=this.pos-N.offset;let X=new ie(g.OpDivideAssign,N);return this.previous=X,X}else{if((this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==47)return this.readLineComment();if((this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==42)return this.readMultiLineComment();{let se=1;for(;se-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let N=t;N==null&&(N=new z(this.startLine,this.startColumn,this.pos)),N.length=this.pos-N.offset;let X=new ie(g.OpDivide,N);return this.previous=X,X}}}break;case 58:let $=1;for(;$-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let te=t;te==null&&(te=new z(this.startLine,this.startColumn,this.pos)),te.length=this.pos-te.offset;let O=new ie(g.Colon,te);return this.previous=O,O;case 60:let q=e;if(q>=48&&q<=57)return this.readNumber();{let J=e;if(J>=97&&J<=122||J>=65&&J<=90||J==95)return this.readIdentifier();if((this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==61){let se=2;for(;se-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let N=t;N==null&&(N=new z(this.startLine,this.startColumn,this.pos)),N.length=this.pos-N.offset;let X=new ie(g.OpLessEq,N);return this.previous=X,X}else{let se=1;for(;se-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let N=t;N==null&&(N=new z(this.startLine,this.startColumn,this.pos)),N.length=this.pos-N.offset;let X=new ie(g.OpLess,N);return this.previous=X,X}}break;case 61:let S=e;if(S>=48&&S<=57)return this.readNumber();{let J=e;if(J>=97&&J<=122||J>=65&&J<=90||J==95)return this.readIdentifier();if((this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==61){let se=2;for(;se-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let N=t;N==null&&(N=new z(this.startLine,this.startColumn,this.pos)),N.length=this.pos-N.offset;let X=new ie(g.OpEquals,N);return this.previous=X,X}else{let se=1;for(;se-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let N=t;N==null&&(N=new z(this.startLine,this.startColumn,this.pos)),N.length=this.pos-N.offset;let X=new ie(g.OpAssign,N);return this.previous=X,X}}break;case 62:let W=e;if(W>=48&&W<=57)return this.readNumber();{let J=e;if(J>=97&&J<=122||J>=65&&J<=90||J==95)return this.readIdentifier();if((this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==61){let se=2;for(;se-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let N=t;N==null&&(N=new z(this.startLine,this.startColumn,this.pos)),N.length=this.pos-N.offset;let X=new ie(g.OpGreaterEq,N);return this.previous=X,X}else{let se=1;for(;se-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let N=t;N==null&&(N=new z(this.startLine,this.startColumn,this.pos)),N.length=this.pos-N.offset;let X=new ie(g.OpGreater,N);return this.previous=X,X}}break;case 93:let ve=1;for(;ve-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;this.strictExprs.pop();let de=t;de==null&&(de=new z(this.startLine,this.startColumn,this.pos)),de.length=this.pos-de.offset;let Ce=new ie(g.RBracket,de);return this.previous=Ce,Ce;case 124:let Se=e;if(Se>=48&&Se<=57)return this.readNumber();{let J=e;if(J>=97&&J<=122||J>=65&&J<=90||J==95)return this.readIdentifier();if((this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==124){let se=2;for(;se-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let N=t;N==null&&(N=new z(this.startLine,this.startColumn,this.pos)),N.length=this.pos-N.offset;let X=new ie(g.OpOr(!1),N);return this.previous=X,X}else{let se=1;for(;se-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;this.error("Expected |",!1);let N=t;N==null&&(N=new z(this.startLine,this.startColumn,this.pos)),N.length=this.pos-N.offset;let X=new ie(g.OpOr(!1),N);return this.previous=X,X}}break;default:let Ee=e;if(Ee>=48&&Ee<=57)return this.readNumber();{let J=e;return J>=97&&J<=122||J>=65&&J<=90||J==95?this.readIdentifier():(this.error("Unexpected character: "+String.fromCodePoint(e),!0),null)}}}}countIndentation(){let e=this.pos,t=0;for(;e<this.length;){let i=u.cca(this.input,e);if(i==32)++t;else if(i==9)++t;else break;++e}return e>=this.length||u.cca(this.input,e)==10||u.cca(this.input,e)==13?this.indentStack[this.indentStack.length-1]:t}parentBlockType(){let e=this.stack.length-1;for(;e>=0;){if(this.stack[e]!=10&&this.stack[e]!=11&&this.stack[e]!=12)switch(this.stack[e]){case 0:case 1:return g.KwBeat;case 2:case 3:return g.KwState;case 4:case 5:return g.KwCharacter;case 6:case 7:return g.KwBeat;case 8:case 9:return g.KwBeat;case 10:return g.LBrace;case 11:return g.Indent;case 12:return g.LBracket}--e}return g.KwBeat}inBeat(){return this.parentBlockType()==g.KwBeat}inChoiceRoot(){return this.stack.length>0?this.stack[this.stack.length-1]!=1?this.stack[this.stack.length-1]==0:!0:!1}inStateOrCharacter(){let e=this.parentBlockType();return e!=g.KwState?e==g.KwCharacter:!0}readLineBreak(){let e=new z(this.startLine,this.startColumn,this.pos);if(u.cca(this.input,this.pos)==13){let s=1;for(;s-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;if(this.pos<this.length&&u.cca(this.input,this.pos)==10){let n=1;for(;n-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}}else{let s=1;for(;s-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}let t=e;t==null&&(t=new z(this.startLine,this.startColumn,this.pos)),t.length=this.pos-t.offset;let i=new ie(g.LineBreak,t);return this.previous=i,i}isWhitespace(e){return e!=32?e==9:!0}matchIdentifier(e){if(this.length==0)return null;let t=u.cca(this.input,e);if(!(t>=97&&t<=122||t>=65&&t<=90||t==95))return null;let i=1;for(;i<this.length;){let n=u.cca(this.input,e+i);if(!(n>=97&&n<=122||n>=65&&n<=90||n==95||n>=48&&n<=57))break;++i}let s=this.input;return i!=null?u.substr(s,e,i):u.substr(s,e,null)}_skipWhitespaceAndComments(e,t){if(t==null&&(t=!1),t)return this._skipWhitespaceAndCommentsStopNextLine(e);{let i=e,s=!1;for(;e<this.length;){for(;e<this.length&&(u.cca(this.input,e)==32||u.cca(this.input,e)==9);)++e,s=!0;if(e<this.length-1&&u.cca(this.input,e)==47){if(u.cca(this.input,e+1)==47)return e=i,e;if(u.cca(this.input,e+1)==42){e+=2,s=!0;let n=!1;for(;e<this.length-1;){if(u.cca(this.input,e)==42&&u.cca(this.input,e+1)==47){e+=2,n=!0;break}++e}if(!n)return e=i,e;continue}}break}return s?e:i}}_skipWhitespaceAndCommentsStopNextLine(e){let t=e,i=!1,s=!1;for(;e<this.length;){for(;e<this.length;){let n=u.cca(this.input,e);if(n==32||n==9||n==13||!s&&n==10)n==10&&(s=!0),++e,i=!0;else break}if(e<this.length-1&&!s&&u.cca(this.input,e)==47){if(u.cca(this.input,e+1)==47){for(e+=2,i=!0;e<this.length&&u.cca(this.input,e)!=10&&u.cca(this.input,e)!=13;)++e;continue}else if(u.cca(this.input,e+1)==42){e+=2,i=!0;let n=!1;for(;e<this.length-1;){if(u.cca(this.input,e)==42&&u.cca(this.input,e+1)==47){e+=2,n=!0;break}++e}if(!n)return e=t,e;continue}}break}return i?e:t}isIfStart(e){if(e=this._skipWhitespaceAndComments(e,!1),u.cca(this.input,e)!=105||(++e,u.cca(this.input,e)!=102))return!1;let t=++e;if(e=this._skipWhitespaceAndComments(e,!1),e<this.length&&u.cca(this.input,e)==33&&(++e,e=this._skipWhitespaceAndComments(e,!1)),u.cca(this.input,e)==40)return!0;let i;if(e==t){let l=u.cca(this.input,t);i=l>=97&&l<=122||l>=65&&l<=90||l==95}else i=!1;if(i)return!1;let s;if(e<this.length){let l=u.cca(this.input,e);s=!(l>=97&&l<=122||l>=65&&l<=90||l==95)}else s=!0;if(s)return!1;let n=this;for(;e<this.length;){if(u.cca(this.input,e)==40)return!0;{let a=!0,o=n.length;if(e>=o)a=!1;else{let c;if(e+1<o&&u.cca(n.input,e)==111&&u.cca(n.input,e+1)==114){let p=u.cca(n.input,e+2);c=!(p>=97&&p<=122||p>=65&&p<=90||p==95)}else c=!1;if(c)a=!1;else{let p;if(e+2<o&&u.cca(n.input,e)==97&&u.cca(n.input,e+1)==110&&u.cca(n.input,e+2)==100){let f=u.cca(n.input,e+3);p=!(f>=97&&f<=122||f>=65&&f<=90||f==95)}else p=!1;if(p)a=!1;else{let f=u.cca(n.input,e);if(!(f>=97&&f<=122||f>=65&&f<=90||f==95))a=!1;else for(++e;e<n.length&&(f=u.cca(n.input,e),f>=97&&f<=122||f>=65&&f<=90||f==95||f>=48&&f<=57);)++e}}}if(!a)return!1}if(e=this._skipWhitespaceAndComments(e,!1),e>=this.length)return!0;let l=u.cca(this.input,e);if(l==46){++e,e=this._skipWhitespaceAndComments(e,!1);let a=!0,o=n.length;if(e>=o)a=!1;else{let c;if(e+1<o&&u.cca(n.input,e)==111&&u.cca(n.input,e+1)==114){let p=u.cca(n.input,e+2);c=!(p>=97&&p<=122||p>=65&&p<=90||p==95)}else c=!1;if(c)a=!1;else{let p;if(e+2<o&&u.cca(n.input,e)==97&&u.cca(n.input,e+1)==110&&u.cca(n.input,e+2)==100){let f=u.cca(n.input,e+3);p=!(f>=97&&f<=122||f>=65&&f<=90||f==95)}else p=!1;if(p)a=!1;else{let f=u.cca(n.input,e);if(!(f>=97&&f<=122||f>=65&&f<=90||f==95))a=!1;else for(++e;e<n.length&&(f=u.cca(n.input,e),f>=97&&f<=122||f>=65&&f<=90||f==95||f>=48&&f<=57);)++e}}}if(!a||(e=this._skipWhitespaceAndComments(e,!1),e>=this.length))return!0;l=u.cca(this.input,e)}if(l==91){++e;let a=1;for(;e<this.length&&a>0;)l=u.cca(this.input,e),l==91&&++a,l==93&&--a,++e;if(e=this._skipWhitespaceAndComments(e,!1),e>=this.length)return!0;l=u.cca(this.input,e)}let r;if(l==97&&u.cca(this.input,e+1)==110&&u.cca(this.input,e+2)==100){let a=u.cca(this.input,e+3);r=!(a>=97&&a<=122||a>=65&&a<=90||a==95)}else r=!1;if(r)return!0;let h;if(l==111&&u.cca(this.input,e+1)==114){let a=u.cca(this.input,e+2);h=!(a>=97&&a<=122||a>=65&&a<=90||a==95)}else h=!1;if(h||l==40||l==38||l==124||u.cca(this.input,e+1)==61&&l==61||l==62||l==60||l==33&&u.cca(this.input,e+1)==61||u.cca(this.input,e+1)!=61&&(l==43||l==45||l==42||l==47||l==123))return!0;if(l==10||l==13||e>=this.length)return e=t,!0;if(l==32||l==9){let a=e;for(;;){let o;if(a<this.length){let c=u.cca(this.input,a);o=c==32||c==9}else o=!1;if(!o)break;++a}if(a+1<this.length&&u.cca(this.input,a)==47&&u.cca(this.input,a+1)==47)return!0}return!1}return!0}isIdentifierExpressionStart(e,t){if(e=this._skipWhitespaceAndComments(e,!1),e=this._skipWhitespaceAndComments(e,!1),e>=this.length)return!1;if(u.cca(this.input,e)==40)return!0;let i=this,s=t;s==null&&(s=!1);let n=!0;if(e>=i.length)n=!1;else{let l=!1,r=u.cca(i.input,e);if(l=r==95,!(r>=97&&r<=122||r>=65&&r<=90||r==95)||s&&!l&&!(r>=97&&r<=122))n=!1;else for(++e;e<i.length;){let h=l;if(r=u.cca(i.input,e),l=r==95,!(r>=97&&r<=122||r>=65&&r<=90||r==95||r>=48&&r<=57))break;if(s&&h&&!l&&!(r>=97&&r<=122)){n=!1;break}++e}}if(!n)return!1;for(;e<this.length;){if(e=this._skipWhitespaceAndComments(e,!1),e>=this.length)return!0;let l=u.cca(this.input,e);if(!(l==32||l==9)&&l!=46&&l!=91&&l!=10&&l!=13&&l!=47)return!1;if(l==10||l==13||l==47&&e+1<this.length&&(u.cca(this.input,e+1)==47||u.cca(this.input,e+1)==42))return!0;if(l==46){if(++e,e=this._skipWhitespaceAndComments(e,!1),e>=this.length)return!0;let r=!0;if(e>=i.length)r=!1;else{let h=!1,a=u.cca(i.input,e);if(h=a==95,!(a>=97&&a<=122||a>=65&&a<=90||a==95))r=!1;else for(++e;e<i.length;){let o=h;if(a=u.cca(i.input,e),h=a==95,!(a>=97&&a<=122||a>=65&&a<=90||a==95||a>=48&&a<=57))break;++e}}if(!r)return!0;continue}if(l==91){++e;let r=1;for(;e<this.length&&r>0;)l=u.cca(this.input,e),l==91&&++r,l==93&&--r,++e;continue}if(l==32||l==9){++e;continue}break}return!0}isTransitionStart(e){if(u.cca(this.input,e)!=45||e>=this.length-1||u.cca(this.input,e+1)!=62||(e+=2,e=this._skipWhitespaceAndComments(e,!1),e>=this.length))return!1;if(u.cca(this.input,e)==46)++e;else{let i=u.cca(this.input,e);if(i>=97&&i<=122||i>=65&&i<=90||i==95||i>=48&&i<=57)for(++e;;){let s;if(e<this.length){let n=u.cca(this.input,e);s=n>=97&&n<=122||n>=65&&n<=90||n==95||n>=48&&n<=57}else s=!1;if(!s)break;++e}else return!1}if(e=this._skipWhitespaceAndComments(e,!1),e<this.length){let i=u.cca(this.input,e);if(i!=10&&i!=13&&i!=32&&i!=9&&i!=47&&i!=35)return!1}return!0}isInsertionStart(e){if(u.cca(this.input,e)!=43||(++e,e=this._skipWhitespaceAndComments(e,!1),e>=this.length))return!1;if(u.cca(this.input,e)==46)++e;else{let i=u.cca(this.input,e);if(i>=97&&i<=122||i>=65&&i<=90||i==95||i>=48&&i<=57)for(++e;;){let s;if(e<this.length){let n=u.cca(this.input,e);s=n>=97&&n<=122||n>=65&&n<=90||n==95||n>=48&&n<=57}else s=!1;if(!s)break;++e}else return!1}if(e=this._skipWhitespaceAndComments(e,!1),e<this.length){let i=u.cca(this.input,e);if(i!=10&&i!=13&&i!=32&&i!=9&&i!=47)return!1}return!0}isLabelStart(e){e=this._skipWhitespaceAndComments(e,!1);let t=u.cca(this.input,e);if(!(t>=97&&t<=122||t>=65&&t<=90||t==95))return!1;let i=e;for(++e;;){let r;if(e<this.length){let h=u.cca(this.input,e);r=h>=97&&h<=122||h>=65&&h<=90||h==95||h>=48&&h<=57}else r=!1;if(!r)break;++e}for(;;){let r;if(e<this.length){let h=u.cca(this.input,e);r=h==32||h==9}else r=!1;if(!r)break;++e}if(e>=this.length||u.cca(this.input,e)!=58)return!1;let s=this.input,n=e-i,l=n!=null?u.substr(s,i,n):u.substr(s,i,null);return!Object.prototype.hasOwnProperty.call(wt.KEYWORDS.h,l)}isCallStart(e){let t=e,i=this,s=!0;if(e>=i.length)s=!1;else{let n=u.cca(i.input,e);if(!(n>=97&&n<=122||n>=65&&n<=90||n==95))s=!1;else for(++e;e<i.length&&(n=u.cca(i.input,e),n>=97&&n<=122||n>=65&&n<=90||n==95||n>=48&&n<=57);)++e}if(!s)return e=t,!1;for(;e<this.length;){if(e=this._skipWhitespaceAndComments(e,!1),e>=this.length)return e=t,!1;let n=u.cca(this.input,e);if(n==40)return e=t,!0;if(n==46){++e,e=this._skipWhitespaceAndComments(e,!1);let l=!0;if(e>=i.length)l=!1;else{let r=u.cca(i.input,e);if(!(r>=97&&r<=122||r>=65&&r<=90||r==95))l=!1;else for(++e;e<i.length&&(r=u.cca(i.input,e),r>=97&&r<=122||r>=65&&r<=90||r==95||r>=48&&r<=57);)++e}if(!l)return e=t,!1;continue}if(n==91){for(++e;e<this.length;){if(u.cca(this.input,e)==93){++e;break}++e}continue}return e=t,!1}return e=t,!1}isAssignStart(e,t){let i=this,s;if(t){let l=!0,r=e;if(e>=i.length)l=!1;else{let h=u.cca(i.input,e);if(!(h>=97&&h<=122||h>=65&&h<=90||h==95))l=!1;else for(++e;e<i.length&&(h=u.cca(i.input,e),h>=97&&h<=122||h>=65&&h<=90||h==95||h>=48&&h<=57);)++e}s=!(!(e==r+2&&u.cca(i.input,r)==105&&u.cca(i.input,r+1)==102)&&l)}else s=!1;if(s)return!1;let n=!1;for(;e<this.length;){if(e=this._skipWhitespaceAndComments(e,!1),e>=this.length)return!1;let l=u.cca(this.input,e);if(!n&&(l==61||u.cca(this.input,e+1)==61&&(l==43||l==45||l==42||l==47)))return!0;if(t){if(l==46){++e,e=this._skipWhitespaceAndComments(e,!1);let r=!0,h=e;if(e>=i.length)r=!1;else{let a=u.cca(i.input,e);if(!(a>=97&&a<=122||a>=65&&a<=90||a==95))r=!1;else for(++e;e<i.length&&(a=u.cca(i.input,e),a>=97&&a<=122||a>=65&&a<=90||a==95||a>=48&&a<=57);)++e}if(!(!(e==h+2&&u.cca(i.input,h)==105&&u.cca(i.input,h+1)==102)&&r))return!1;continue}if(l==91){for(++e;e<this.length;){if(u.cca(this.input,e)==93){++e;break}++e}continue}return!1}else if(l==92)n=!0,++e;else{if(l==13||l==10)return!1;if(l>=97&&l<=122||l>=65&&l<=90||l==95){let r=!0,h=e;if(e>=i.length)r=!1;else{let a=u.cca(i.input,e);if(!(a>=97&&a<=122||a>=65&&a<=90||a==95))r=!1;else for(++e;e<i.length&&(a=u.cca(i.input,e),a>=97&&a<=122||a>=65&&a<=90||a==95||a>=48&&a<=57);)++e}if(!(!(e==h+2&&u.cca(i.input,h)==105&&u.cca(i.input,h+1)==102)&&r))return!1}else++e}}return!1}isColon(e,t){if(t==null&&(t=!0),t)for(;e<this.length&&(u.cca(this.input,e)==32||u.cca(this.input,e)==9);)++e;return e<this.length?u.cca(this.input,e)==58:!1}afterLabelIdentifierToken(e){e==null&&(e=!0);let t=this.tokenized.length-1;for(;t>=0;){let i=this.tokenized[t];if(!Ft.isComment(i.type)&&(e||i.type!=g.LineBreak&&i.type!=g.Indent&&i.type!=g.Unindent))return i.type==g.Colon&&t>0&&Ft.isIdentifier(this.tokenized[t-1].type)?t-1:-1;--t}return-1}isStartingMultilineDialogue(e){let t=this.tokenized[e],i=e+1;for(;this.tokenized[i].type!=g.Colon;)++i;let s=this.tokenized[i].pos.offset+1,n=t.pos.column,l=!0,r=!1;for(;s<this.length;){let _=u.cca(this.input,s);if(_==32||_==9)++s;else break}for(;s<this.length;){let _=u.cca(this.input,s);if(_==10||_==13)break;if(_==47&&s+1<this.length){let d=u.cca(this.input,s+1);if(d==47)break;if(d==42){for(s+=2;s<this.length;){if(u.cca(this.input,s)==42&&s+1<this.length&&u.cca(this.input,s+1)==47){s+=2;break}++s}continue}}if(_==60)r=!0;else if(_==62)r=!1;else if(!r&&!(_==32||_==9)){l=!1;break}++s}if(!l)return-1;let h=s,a=!0;if(a==null&&(a=!1),s=this._skipWhitespaceAndComments(s,a),s<=h)return-1;let o=0,c=s;for(;c>0&&(u.cca(this.input,c-1)==32||u.cca(this.input,c-1)==9);)++o,--c;if(o<=n-1)return-1;let p=!1;p==null&&(p=!1),s=this._skipWhitespaceAndComments(s,p);let f=u.cca(this.input,s);return f==32||f==9||u.cca(this.input,s)==47&&u.cca(this.input,s+1)==47?-1:o}isContinuingMultilineText(e,t){if(u.cca(this.input,e)==47&&u.cca(this.input,e+1)==47)for(;e<this.length&&u.cca(this.input,e)!=13&&u.cca(this.input,e)!=10;)++e;if(u.cca(this.input,e)==13&&++e,u.cca(this.input,e)==10)++e;else return!1;let i=0;for(;u.cca(this.input,e)==32||u.cca(this.input,e)==9;)++i,++e;if(i!=t)return!1;let s=!1;s==null&&(s=!1),e=this._skipWhitespaceAndComments(e,s);let n=u.cca(this.input,e);return!(n==32||n==9||u.cca(this.input,e)==13||u.cca(this.input,e)==10||u.cca(this.input,e)==47&&u.cca(this.input,e+1)==47)}isAfterComma(){let e=this.tokenized.length-1;for(;e>=0;){let t=this.tokenized[e];if(!Ft.isComment(t.type)&&t.type!=g.LineBreak&&t.type!=g.Indent&&t.type!=g.Unindent)return t.type==g.Comma;--e}return!1}isAfterLBracket(){let e=this.tokenized.length-1;for(;e>=0;){let t=this.tokenized[e];if(!Ft.isComment(t.type)&&t.type!=g.LineBreak&&t.type!=g.Indent&&t.type!=g.Unindent)return t.type==g.LBracket;--e}return!1}isInsideBrackets(){let e=this.stack.length-1;for(;e>=0&&this.stack[e]==11;)--e;return e>=0?this.stack[e]==12:!1}followsAssignStart(){let e=this.tokenized.length-1;for(;e>=0;){let t=this.tokenized[e];if(Ft.isComment(t.type)||t.type==g.Indent||t.type==g.Unindent)--e;else return!!Ft.isAssignOp(t.type)}return!1}followsOnlyLabelOrCommentsInLine(){let e=!1,t=this.tokenized.length-1;for(;t>=0;){let i=this.tokenized[t];if(Ft.isComment(i.type)||i.type==g.Indent||i.type==g.Unindent)--t;else if(!e&&i.type==g.Colon)if(--t,t>=0)Ft.isIdentifier(this.tokenized[t].type)&&(e=!0,--t);else return!1;else return i.type==g.LineBreak}return!0}followsOnlyWhitespacesOrCommentsInLine(){let e=this.tokenized.length-1;for(;e>=0;){let t=this.tokenized[e];if(Ft.isComment(t.type)||t.type==g.Indent||t.type==g.Unindent)--e;else return t.type==g.LineBreak}return!0}hasNonSpecialChar(e){let t=0,i=e.length;for(;t<i;){let s=t++,n=!1,l=u.cca(e,s),r=0,h=wt.hasNonSpecialChar_specialChars.length;for(;r<h;){let a=r++;if(l==u.cca(wt.hasNonSpecialChar_specialChars,a)){n=!0;break}}if(!n)return!0}return!1}isNumber(e){let t=0,i=e.length;for(;;){let n;if(t<i){let l=u.cca(e,t);n=l>=48&&l<=57}else n=!1;if(!n)break;++t}let s;if(t<i&&u.cca(e,t)==46&&t+1<i){let n=u.cca(e,t+1);s=n>=48&&n<=57}else s=!1;if(s)for(++t;;){let n;if(t<i){let l=u.cca(e,t);n=l>=48&&l<=57}else n=!1;if(!n)break;++t}return t==i}makeLooseOrStrictAfterBracket(){let e=this.tokenized.length-1;for(;e>=0;){let i=this.tokenized[e].type;switch(i._hx_index){case 19:let s=i.name;this.strictExprs.push(1);return;case 46:case 48:this.strictExprs.push(1);return;case 49:let n=i.content;break;case 50:let l=i.content;break;case 51:let r=i.content;break;case 52:case 53:case 54:break;default:this.strictExprs.push(0);return}--e}this.strictExprs.push(2)}makeStrictIfFollowingCallable(){this.followsCallableOrIndexable()?this.strictExprs.push(1):this.strictExprs.push(2)}followsCallableOrIndexable(){let e=this.tokenized.length-1;for(;e>=0;){let i=this.tokenized[e].type;switch(i._hx_index){case 19:let s=i.name;return!0;case 46:case 48:return!0;case 49:let n=i.content;break;case 50:let l=i.content;break;case 51:let r=i.content;break;case 52:case 53:case 54:break;default:return!1}--e}return!1}isStrict(){let e=this.strictExprs.length-1;for(;e>=0&&this.strictExprs[e]==2;)--e;return e>=0?this.strictExprs[e]==1:!1}readImportValue(e,t){if(e==34)return this.readString(t);{let i="";for(;this.pos<this.length;){let r=u.cca(this.input,this.pos);if(r==10)break;i+=String.fromCodePoint(r),this.pos++}let s=Te.rtrim(i),n=new z(t.line,t.column,t.offset,s.length);n==null&&(n=new z(this.startLine,this.startColumn,this.pos)),n.length=this.pos-n.offset;let l=new ie(g.LString(0,s,[]),n);return this.previous=l,l}}tryReadUnquotedString(){if(this.isStrict())return null;let e=u.cca(this.input,this.pos),t=this.pos+1<this.length?u.cca(this.input,this.pos+1):0;if(e==47&&this.pos<this.length-1){let I=u.cca(this.input,this.pos+1);if(I==47||I==42)return null}if(e==123||e==125||e==91||e==93||e==34||e==58||e==35||e==32||e==9)return null;let i=this.parentBlockType();if(i!=g.KwBeat&&i!=g.KwState&&i!=g.KwCharacter)return null;let s=this.isInsideBrackets(),n=!1,l=this.afterLabelIdentifierToken(!1);if(l!=-1&&this.tokenized[l].pos.line<this.line&&(this.tokenized[l].pos.column>=this.column||this.line-this.tokenized[l].pos.line>1))return null;let r=l!=-1?this.isStartingMultilineDialogue(l):-1,h=l!=-1,a=i==g.KwState||i==g.KwCharacter||s||n;if(a){if(this.isCallStart(this.pos)||this.isLabelStart(this.pos))return null}else if(!h&&(this.isIdentifierExpressionStart(this.pos,!0)||this.isIfStart(this.pos)||this.isCallStart(this.pos)||this.isAssignStart(this.pos,!1)))return null;if(!a&&(e==61||t==61&&(e==43||e==45||e==42||e==47))||!a&&!h&&this.isInsertionStart(this.pos))return null;let o=this.matchIdentifier(this.pos);if(o!=null&&(o=="function"||!a&&(o!="if"&&o!="null"&&o!="true"&&o!="false"&&o!="and"&&o!="or"&&Object.prototype.hasOwnProperty.call(wt.KEYWORDS.h,o)||this.isColon(this.pos+o.length))))return null;let c=!a,p=!1;if(a){if(s){if(!h&&!this.followsOnlyWhitespacesOrCommentsInLine()&&!this.isAfterComma()&&!this.isAfterLBracket())return null}else if(!n&&!h)return null}else if(p=this.followsOnlyLabelOrCommentsInLine(),!p&&!this.followsOnlyWhitespacesOrCommentsInLine()||!p&&t==62&&e==45)return null;let f=new z(this.startLine,this.startColumn,this.pos),_="",d=[],x=this.line,y=this.column,b=this.pos,v=!1,T=-1,E=!1,F=this.column,L=this.line,A=!0,B=!1;for(;this.pos<this.length;){let I=u.cca(this.input,this.pos),H=I==32||I==9;if(B||!H&&T==-1&&(I!=60||!c)&&(B=!0),v){_+=String.fromCodePoint(92),_+=String.fromCodePoint(I),v=!1;let P=1;for(;P-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;F+=2}else if(I==92){v=!0;let P=1;for(;P-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}else if(T==-1&&H&&!B&&d.length==0){let P=1;for(;P-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}else{if(T==-1&&I==123)break;if(T==-1&&(I==10||I==13||I==47&&this.pos<this.length-1&&u.cca(this.input,this.pos+1)==47))if(r!=-1)if(this.isContinuingMultilineText(this.pos,r)){_+=String.fromCodePoint(I);let P=1;for(;P-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;if(I==13&&u.cca(this.input,this.pos)==10){_+=String.fromCodePoint(10);let M=1;for(;M-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}F=this.column,L=this.line}else break;else break;else if(T==-1&&I==47&&this.pos<this.length-1&&u.cca(this.input,this.pos+1)==42){_+=String.fromCodePoint(47),_+=String.fromCodePoint(42);let P=2;for(;P-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let M=!1;for(;this.pos<this.length;){if(u.cca(this.input,this.pos)==42&&this.pos+1<this.length&&u.cca(this.input,this.pos+1)==47){_+=String.fromCodePoint(42),_+=String.fromCodePoint(47);let Y=2;for(;Y-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;M=!0;break}let V=u.cca(this.input,this.pos);_+=String.fromCodePoint(V);let R=1;for(;R-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}F=this.column,L=this.line,M||this.error("Unterminated multiline comment",!1)}else{if(T==-1&&!a&&this.isIfStart(this.pos))break;if(T==-1&&I==45&&this.pos<this.length-1&&u.cca(this.input,this.pos+1)==62&&this.isTransitionStart(this.pos))break;if(T==-1&&a&&(I==44||I==93||I==125))break;if(c&&I==60){T!=-1&&this.error("Unexpected < inside tag",!0),E=(this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==47;let M=this.pos+(E?2:1);if(M<this.length){let R=u.cca(this.input,M);(R>=97&&R<=122||R>=65&&R<=90||R==95||R==95||R==36||E&&R==62)&&(T=_.length)}_+=String.fromCodePoint(I);let V=1;for(;V-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;++F}else if(c&&I==62){_+=String.fromCodePoint(I);let P=1;for(;P-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;++F,T!=-1&&(d.push(Ii.Tag(E,T,_.length-T)),T=-1)}else if(T==-1&&I==35&&!v){let P=this.pos+1<this.length?u.cca(this.input,this.pos+1):0;if(P==35){_+=String.fromCodePoint(35),_+=String.fromCodePoint(35);let M=1;for(;M-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let V=1;for(;V-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;F+=2}else{if(P>=97&&P<=122||P>=65&&P<=90||P==95||P>=48&&P<=57||P==45)break;{_+=String.fromCodePoint(I);let M=1;for(;M-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;++F}}}else if(I==36&&!v){let P=_.length,M=L,V=F,R=this.pos;try{let Y=1;for(;Y-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;if(++F,u.cca(this.input,this.pos)==123){let $=1;for(;$-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;++F;let te=new z(M,V+2,this.pos),O=this.readComplexInterpolation(te),q=this.pos-R;d.push(Ii.Interpolation(!0,T!=-1,O,P,q));let S=this.input;_+=Z.string(q!=null?u.substr(S,R,q):u.substr(S,R,null))}else{let $=u.cca(this.input,this.pos);if($>=97&&$<=122||$>=65&&$<=90||$==95){let te=new z(M,V+1,this.pos),O=this.readFieldAccessInterpolation(te),q=this.pos-R;d.push(Ii.Interpolation(!1,T!=-1,O,P,q));let S=this.input;_+=Z.string(q!=null?u.substr(S,R,q):u.substr(S,R,null))}else if(u.cca(this.input,this.pos)==36){_+=String.fromCodePoint(36),_+=String.fromCodePoint(36);let te=1;for(;te-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;++F}else{this.error("Expected identifier or { after $",!1);let te=this.pos-R;d.push(Ii.Interpolation(!1,T!=-1,[],P,te));let O=this.input;_+=Z.string(te!=null?u.substr(O,R,te):u.substr(O,R,null))}}}catch(Y){let $=k.caught(Y).unwrap();if($ instanceof Zi){let te=$;throw te.pos==null&&(te.pos=new z(M,V,this.pos)),k.thrown(te)}else throw Y}F=V+(this.pos-R)}else{I==10?(++L,F=1):++F,_+=String.fromCodePoint(I);let P=1;for(;P-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}}}}if(A){let I=_,H=I.length;I=Te.rtrim(I);let P=I.length,M=H-P;if(P>0&&this.hasNonSpecialChar(I)&&!this.isNumber(I)&&I!="null"&&I!="true"&&I!="false"){if(r==-1&&!h&&!this.inChoiceRoot()){let te=this.line,O=this.column,q=this.pos,S=!0;S==null&&(S=!1);let W=S;W==null&&(W=!1);let ve=this._skipWhitespaceAndComments(this.pos,W);for(;this.pos<ve;){let Ce=1;for(;Ce-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}let de=this.pos;if(this.column==y){let Ce=this.tryReadUnquotedString();if(Ce!=null){let Se=this.input,Ee=q-M,J=de!=null?Se.substring(Ee,de):Se.substring(Ee),se=Ce.type;if(se._hx_index==15){let X=se.quotes,rt=se.s,Ve=se.attachments;if(Ve!=null){let Ye=0;for(;Ye<Ve.length;){let Ue=Ve[Ye];switch(++Ye,Ue._hx_index){case 0:let He=Ue.braces,Je=Ue.inTag,$e=Ue.expr,Be=Ue.start,Ne=Ue.length;d.push(Ii.Interpolation(He,Je,$e,Be+de-b,Ne));break;case 1:let mt=Ue.closing,gt=Ue.start,Nt=Ue.length;d.push(Ii.Tag(mt,gt+de-b,Nt));break}}}I+=J,I+=rt}M=0;let N=this.pos-1;for(;N>=0&&u.cca(this.input,N)==32||u.cca(this.input,N)==9;)++M,--N}else this.line=te,this.column=O,this.pos=q}else this.line=te,this.column=O,this.pos=q}d.sort(function(te,O){return wt.compareAttachments(te,O)});let V=d.length>0?d:null,R=f;R==null&&(R=new z(this.startLine,this.startColumn,this.pos)),R.length=this.pos-R.offset;let Y=new ie(g.LString(0,I,V),R);this.previous=Y;let $=Y;return $.pos.length-=M,$}}return this.line=x,this.column=y,this.pos=b,null}readString(e){let t=1;for(;t-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let i="",s=[],n=!1,l=-1,r=!1,h=e.column+1,a=e.line,o=this.parentBlockType()==g.KwBeat;for(;this.pos<this.length;){let c=u.cca(this.input,this.pos);if(n){i+=String.fromCodePoint(92),i+=String.fromCodePoint(c),n=!1;let p=1;for(;p-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;h+=2}else if(c==92){n=!0;let p=1;for(;p-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}else if(c==34&&l==-1){let p=1;for(;p-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;s.sort(function(x,y){return wt.compareAttachments(x,y)});let f=s.length>0?s:null,_=e;_==null&&(_=new z(this.startLine,this.startColumn,this.pos)),_.length=this.pos-_.offset;let d=new ie(g.LString(1,i,f),_);return this.previous=d,d}else if(o&&c==60){l!=-1&&this.error("Unexpected < inside tag",!0),r=(this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==47;let f=this.pos+(r?2:1);if(f<this.length){let d=u.cca(this.input,f);(d>=97&&d<=122||d>=65&&d<=90||d==95||d==95||d==36||r&&d==62)&&(l=i.length)}i+=String.fromCodePoint(c);let _=1;for(;_-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;++h}else if(c==62){i+=String.fromCodePoint(c);let p=1;for(;p-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;++h,l!=-1&&(s.push(Ii.Tag(r,l,i.length-l)),l=-1)}else if(c==36&&!n){let p=i.length,f=a,_=h,d=this.pos;try{let x=1;for(;x-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;if(++h,u.cca(this.input,this.pos)==123){let y=1;for(;y-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;++h;let b=new z(f,_+2,this.pos),v=this.readComplexInterpolation(b),T=this.pos-d;s.push(Ii.Interpolation(!0,l!=-1,v,p,T));let E=this.input;i+=Z.string(T!=null?u.substr(E,d,T):u.substr(E,d,null))}else{let y=u.cca(this.input,this.pos);if(y>=97&&y<=122||y>=65&&y<=90||y==95){let b=new z(f,_+1,this.pos),v=this.readFieldAccessInterpolation(b),T=this.pos-d;s.push(Ii.Interpolation(!1,l!=-1,v,p,T));let E=this.input;i+=Z.string(T!=null?u.substr(E,d,T):u.substr(E,d,null))}else if(u.cca(this.input,this.pos)==36){i+=String.fromCodePoint(36),i+=String.fromCodePoint(36);let b=1;for(;b-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;++h}else{this.error("Expected identifier or { after $",!1);let b=this.pos-d;s.push(Ii.Interpolation(!1,l!=-1,[],p,b));let v=this.input;i+=Z.string(b!=null?u.substr(v,d,b):u.substr(v,d,null))}}}catch(x){let y=k.caught(x).unwrap();if(y instanceof Zi){let b=y;throw b.pos==null&&(b.pos=new z(f,_,this.pos)),k.thrown(b)}else throw x}h=_+(this.pos-d)}else{c==10?(++a,h=1):++h,i+=String.fromCodePoint(c);let p=1;for(;p-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}}return this.error("Unterminated string",!0),null}readComplexInterpolation(e){this.strictExprs.push(1);let t=[],i=1,s=e.column,n=e.line;for(;this.pos<this.length&&i>0;){if(u.cca(this.input,this.pos)==34){let r=new z(n,s,this.pos);t.push(this.readString(r)),s+=this.pos-r.offset;continue}let l=this.nextToken();if(t.push(l),l.type==g.LineBreak)++n,s=1;else if(!(l.type==g.Indent||l.type==g.Unindent)){let r,h=l.type;switch(h._hx_index){case 15:let a=h.attachments,o=h.quotes;r=h.s.length+(o!=0?2:0);break;case 16:let p=h.n;r=(p==null?"null":""+p).length;break;case 19:r=h.name.length;break;default:r=1}s+=r}switch(l.type._hx_index){case 43:++i;break;case 44:--i;break;default:}l.type==g.Eof&&this.error("Unterminated interpolation expression",!0)}return t.pop(),this.strictExprs.pop(),t}nextTokenWithPosition(e){let t=this.line,i=this.column,s=this.pos,n=this.nextToken(),l=n.pos.length,r=this.pos-s;return n.pos=new z(e.line,e.column+r,e.offset+r,l),this.line=t,this.column=i,n}readFieldAccessInterpolation(e){this.strictExprs.push(1);let t=[],i=u.cca(this.input,this.pos);i>=97&&i<=122||i>=65&&i<=90||i==95||this.error("Expected identifier in field access",!0);let s=this.pos;for(;this.pos<this.length;){let a=u.cca(this.input,this.pos);if(!(a>=97&&a<=122||a>=65&&a<=90||a==95||a>=48&&a<=57))break;let o=1;for(;o-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}let n=this.input,l=this.pos-s,r=l!=null?u.substr(n,s,l):u.substr(n,s,null),h=Object.prototype.hasOwnProperty.call(wt.KEYWORDS.h,r)?wt.KEYWORDS.h[r]:g.Identifier(r);t.push(new ie(h,new z(e.line,e.column,s,this.pos-s)));e:for(;this.pos<this.length;){let a=u.cca(this.input,this.pos);if(a==null)break;switch(a){case 40:t.push(new ie(g.LParen,new z(this.line,this.column,this.pos,1)));let o=1;for(;o-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;this.stack.push(10),this.strictExprs.push(1);let c=1;for(;this.pos<this.length&&c>0;){if(u.cca(this.input,this.pos)==41){if(--c,c==0){t.push(new ie(g.RParen,new z(this.line,this.column,this.pos,1)));let d=1;for(;d-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;this.stack.pop(),this.strictExprs.pop();break}}else u.cca(this.input,this.pos)==40&&++c;if(u.cca(this.input,this.pos)==44){t.push(new ie(g.Comma,new z(this.line,this.column,this.pos,1)));let d=1;for(;d-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}else t.push(this.nextToken())}c>0&&this.error("Unterminated function call in interpolation",!0);break;case 46:let p;if(this.pos+1<this.length){let d=u.cca(this.input,this.pos+1);p=d>=97&&d<=122||d>=65&&d<=90||d==95}else p=!1;if(p){t.push(new ie(g.Dot,new z(this.line,this.column,this.pos,1)));let d=1;for(;d-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let x=this.pos;for(;this.pos<this.length;){let E=u.cca(this.input,this.pos);if(!(E>=97&&E<=122||E>=65&&E<=90||E==95||E>=48&&E<=57))break;let F=1;for(;F-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}let y=this.input,b=this.pos-x,v=b!=null?u.substr(y,x,b):u.substr(y,x,null),T=Object.prototype.hasOwnProperty.call(wt.KEYWORDS.h,v)?wt.KEYWORDS.h[v]:g.Identifier(v);t.push(new ie(T,new z(this.line,this.column-(this.pos-x),x)))}else break e;break;case 91:t.push(new ie(g.LBracket,new z(this.line,this.column,this.pos,1)));let f=1;for(;f-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;this.stack.push(12),this.strictExprs.push(1);let _=1;for(;this.pos<this.length&&_>0;){if(u.cca(this.input,this.pos)==93){if(--_,_==0){t.push(new ie(g.RBracket,new z(this.line,this.column,this.pos,1)));let d=1;for(;d-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;this.stack.pop(),this.strictExprs.pop();break}}else u.cca(this.input,this.pos)==91&&++_;t.push(this.nextToken())}_>0&&this.error("Unterminated array access in interpolation",!0);break;default:break e}}return this.strictExprs.pop(),t}readIdentifierTokenInInterpolation(e){let t=this.makePositionRelativeTo(e),i=this.pos;for(;this.pos<this.length;){let h=u.cca(this.input,this.pos);if(!(h>=97&&h<=122||h>=65&&h<=90||h==95||h>=48&&h<=57))break;let a=1;for(;a-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}let s=this.input,n=this.pos-i,l=n!=null?u.substr(s,i,n):u.substr(s,i,null),r=Object.prototype.hasOwnProperty.call(wt.KEYWORDS.h,l)?wt.KEYWORDS.h[l]:g.Identifier(l);return new ie(r,t)}makePositionRelativeTo(e){let t=e.line,i=e.column,s=e.offset;for(;s<this.pos;)u.cca(this.input,s)==10?(++t,i=1):++i,++s;return new z(t,i,this.pos,e.length)}readLineComment(){let e=new z(this.startLine,this.startColumn,this.pos),t=2;for(;t-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let i=this.pos;for(;this.pos<this.length;){let a=u.cca(this.input,this.pos);if(a==10||a==13)break;let o=1;for(;o-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}let s=this.input,n=this.pos-i,l=n!=null?u.substr(s,i,n):u.substr(s,i,null),r=e;r==null&&(r=new z(this.startLine,this.startColumn,this.pos)),r.length=this.pos-r.offset;let h=new ie(g.CommentLine(l),r);return this.previous=h,h}readMultiLineComment(){let e=new z(this.startLine,this.startColumn,this.pos),t=2;for(;t-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let i=this.pos,s=1;for(;this.pos<this.length&&s>0;)if(u.cca(this.input,this.pos)==42&&(this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==47){if(--s,s==0){let l=this.input,r=this.pos-i,h=r!=null?u.substr(l,i,r):u.substr(l,i,null),a=2;for(;a-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let o=e;o==null&&(o=new z(this.startLine,this.startColumn,this.pos)),o.length=this.pos-o.offset;let c=new ie(g.CommentMultiLine(h),o);return this.previous=c,c}let n=2;for(;n-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}else if(u.cca(this.input,this.pos)==47&&(this.pos+1<this.length?u.cca(this.input,this.pos+1):0)==42){++s;let n=2;for(;n-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}else{let n=1;for(;n-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}return this.error("Unterminated multi-line comment",!0),null}readHashComment(){let e=new z(this.startLine,this.startColumn,this.pos),t=1;for(;t-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let i=this.pos;for(;this.pos<this.length;){let a=u.cca(this.input,this.pos);if(a>=97&&a<=122||a>=65&&a<=90||a==95||a>=48&&a<=57||a==45){let o=1;for(;o-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}else break}let s=this.input,n=this.pos-i,l=n!=null?u.substr(s,i,n):u.substr(s,i,null),r=e;r==null&&(r=new z(this.startLine,this.startColumn,this.pos)),r.length=this.pos-r.offset;let h=new ie(g.CommentHash(l),r);return this.previous=h,h}readNumber(){let e=new z(this.startLine,this.startColumn,this.pos),t=this.pos;for(;;){let o;if(this.pos<this.length){let p=u.cca(this.input,this.pos);o=p>=48&&p<=57}else o=!1;if(!o)break;let c=1;for(;c-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}let i;if(this.pos<this.length&&u.cca(this.input,this.pos)==46&&this.pos+1<this.length){let o=u.cca(this.input,this.pos+1);i=o>=48&&o<=57}else i=!1;if(i){let o=1;for(;o-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;for(;;){let c;if(this.pos<this.length){let f=u.cca(this.input,this.pos);c=f>=48&&f<=57}else c=!1;if(!c)break;let p=1;for(;p-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}}let s=this.input,n=this.pos-t,l=g.LNumber(parseFloat(n!=null?u.substr(s,t,n):u.substr(s,t,null))),r=e;r==null&&(r=new z(this.startLine,this.startColumn,this.pos)),r.length=this.pos-r.offset;let h=new ie(l,r);return this.previous=h,h}readIdentifier(){let e=new z(this.startLine,this.startColumn,this.pos),t=this.pos;for(;this.pos<this.length;){let a=u.cca(this.input,this.pos);if(!(a>=97&&a<=122||a>=65&&a<=90||a==95||a>=48&&a<=57))break;let o=1;for(;o-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}let i=this.input,s=this.pos-t,n=s!=null?u.substr(i,t,s):u.substr(i,t,null);if(n=="function")return this.readFunction(e);let l=Object.prototype.hasOwnProperty.call(wt.KEYWORDS.h,n)?wt.KEYWORDS.h[n]:g.Identifier(n);if(this.previous!=null&&this.previous.type==g.Dot&&l!=null)switch(l._hx_index){case 8:case 9:case 10:case 11:case 12:l=g.Identifier(n);break;default:}let r=e;r==null&&(r=new z(this.startLine,this.startColumn,this.pos)),r.length=this.pos-r.offset;let h=new ie(l,r);return this.previous=h,h}readFunction(e){let t=!1;t==null&&(t=!1);let i=this._skipWhitespaceAndComments(this.pos,t);for(;this.pos<i;){let P=1;for(;P-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}let s=e.column,n=null,l=u.cca(this.input,this.pos);if(l>=97&&l<=122||l>=65&&l<=90||l==95){let P=this.pos;for(;;){let R;if(this.pos<this.length){let $=u.cca(this.input,this.pos);R=$>=97&&$<=122||$>=65&&$<=90||$==95||$>=48&&$<=57}else R=!1;if(!R)break;let Y=1;for(;Y-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}let M=this.input,V=this.pos-P;n=V!=null?u.substr(M,P,V):u.substr(M,P,null)}let r=!1;r==null&&(r=!1);let h=this._skipWhitespaceAndComments(this.pos,r);for(;this.pos<h;){let P=1;for(;P-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}(this.pos>=this.length||u.cca(this.input,this.pos)!=40)&&this.error("Expected opening parenthesis after function name",!0);let a=0,o=[],c=1;for(;c-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;a=1;let p=new $t;for(;this.pos<this.length&&a>0;){let P=u.cca(this.input,this.pos);if(P==47){let M=this.pos,V=!1;V==null&&(V=!1);let R=this._skipWhitespaceAndComments(this.pos,V);for(;this.pos<R;){let Y=1;for(;Y-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}if(this.pos==M){let Y=1;for(;Y-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;this.error('Invalid character "/"',!1)}}else if(P==40){++a,p.b+=String.fromCodePoint(P);let M=1;for(;M-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let V=!1;V==null&&(V=!1);let R=this._skipWhitespaceAndComments(this.pos,V);for(;this.pos<R;){let Y=1;for(;Y-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}}else if(P==41){if(--a,a>0)p.b+=String.fromCodePoint(P);else{let Y=Te.trim(p.b);Y.length>0&&o.push(Y)}let M=1;for(;M-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let V=!1;V==null&&(V=!1);let R=this._skipWhitespaceAndComments(this.pos,V);for(;this.pos<R;){let Y=1;for(;Y-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}}else if(P==44&&a==1){let M=Te.trim(p.b);M.length>0&&o.push(M),p=new $t;let V=1;for(;V-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let R=!1;R==null&&(R=!1);let Y=this._skipWhitespaceAndComments(this.pos,R);for(;this.pos<Y;){let $=1;for(;$-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}}else{p.b+=String.fromCodePoint(P);let M=1;for(;M-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}}a>0&&this.error("Unclosed parentheses in function declaration",!1);let f=!1;f==null&&(f=!1);let _=this._skipWhitespaceAndComments(this.pos,f);for(;this.pos<_;){let P=1;for(;P-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}let d=this.pos<this.length&&u.cca(this.input,this.pos)==123,x=this.pos,y=this.line,b=this.column;if(d){let P=1;for(;P-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let M=1;for(;this.pos<this.length&&M>0;){let V=u.cca(this.input,this.pos);if(V==34){let Y=1;for(;Y-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;this.skipQuotedString();continue}V==123?++M:V==125&&--M;let R=1;for(;R-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}M>0&&this.error("Unclosed braces in function body",!1)}else{let P=-1,M=!0;for(;this.pos<this.length;){let V=u.cca(this.input,this.pos);if(V==10||V==13){x=this.pos,y=this.line,b=this.column;let Y=1;for(;Y-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;M=!0;break}let R=1;for(;R-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}for(;this.pos<this.length;){if(M){let Y=0,$=this.pos;for(;this.pos<this.length;){let te=u.cca(this.input,this.pos);if(te==32)++Y;else if(te==9)++Y;else break;let O=1;for(;O-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}if(P==-1&&this.pos<this.length&&u.cca(this.input,this.pos)!=10&&u.cca(this.input,this.pos)!=13){if(P=Y,P<s){this.pos=$;break}}else if(P!=-1&&Y<P&&(this.pos>=this.length||u.cca(this.input,this.pos)!=10&&u.cca(this.input,this.pos)!=13)){this.pos=$;break}M=!1}let V=u.cca(this.input,this.pos);if(V==34){this.skipQuotedString();continue}(V==10||V==13)&&(x=this.pos,y=this.line,b=this.column,M=!0);let R=1;for(;R-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}}this.pos=x,this.line=y,this.column=b;let v=this.pos,T=this.input,E=e.offset,F=v-e.offset,L=Te.rtrim(F!=null?u.substr(T,E,F):u.substr(T,E,null)),A=L.indexOf(`
37
+ `,null)==-1;A||(L+=`
38
+ `);let B=e;B==null&&(B=new z(this.startLine,this.startColumn,this.pos)),B.length=this.pos-B.offset;let I=new ie(g.Function(n,o,L,A),B);this.previous=I;let H=I;return H.pos.length=L.length,H}skipQuotedString(){let e=!1,t=1;for(;t-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;for(;this.pos<this.length;){let i=u.cca(this.input,this.pos);if(e){e=!1;let s=1;for(;s-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}else if(i==92){e=!0;let s=1;for(;s-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}else if(i==34){let s=1;for(;s-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;break}else if(i==36&&this.pos+1<this.length){let s=1;for(;s-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;if(this.pos<this.length&&u.cca(this.input,this.pos)==123){let n=1;for(;n-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;let l=1;for(;this.pos<this.length&&l>0;){let r=u.cca(this.input,this.pos);if(r==34){this.skipQuotedString();continue}else r==123?++l:r==125&&--l;if(l>0||r!=125){let h=1;for(;h-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}else{let h=1;for(;h-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;break}}}else{let n=u.cca(this.input,this.pos);if(n>=97&&n<=122||n>=65&&n<=90||n==95)for(;;){let l;if(this.pos<this.length){let h=u.cca(this.input,this.pos);l=h>=97&&h<=122||h>=65&&h<=90||h==95||h>=48&&h<=57}else l=!1;if(!l)break;let r=1;for(;r-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}}}else{let s=1;for(;s-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}}}makePosition(){return new z(this.startLine,this.startColumn,this.pos)}makeToken(e,t){t==null&&(t=new z(this.startLine,this.startColumn,this.pos)),t.length=this.pos-t.offset;let i=new ie(e,t);return this.previous=i,i}advance(e){for(e==null&&(e=1);e-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++}peek(e){return e==null&&(e=1),this.pos+e<this.length?u.cca(this.input,this.pos+e):0}error(e,t){let i=new Zi(e,new z(this.startLine,this.startColumn,this.pos));if(this.errors==null&&(this.errors=[]),this.errors.push(i),t)throw k.thrown(i);return i}getErrors(){return this.errors==null&&(this.errors=[]),this.errors}skipWhitespace(){for(;this.pos<this.length;){let e=u.cca(this.input,this.pos);if(e==null)return;switch(e){case 9:case 32:let t=1;for(;t-- >0&&this.pos<this.length;)u.cca(this.input,this.pos)==10?(this.line++,this.column=1):this.column++,this.pos++;break;default:return}}}isDigit(e){return e>=48?e<=57:!1}isIdentifierStart(e){return e>=97&&e<=122||e>=65&&e<=90?!0:e==95}isLowerCase(e){return e>=97?e<=122:!1}isIdentifierPart(e){return e>=97&&e<=122||e>=65&&e<=90||e==95?!0:e>=48?e<=57:!1}static compareAttachments(e,t){let i;switch(e._hx_index){case 0:let n=e.braces,l=e.inTag,r=e.expr,h=e.length;i=e.start;break;case 1:let o=e.closing,c=e.length;i=e.start;break}let s;switch(t._hx_index){case 0:let n=t.braces,l=t.inTag,r=t.expr,h=t.length;s=t.start;break;case 1:let o=t.closing,c=t.length;s=t.start;break}return i-s}}K["loreline.Lexer"]=wt,wt.__name__="loreline.Lexer",Object.assign(wt.prototype,{__class__:wt});class hn{static parse(e,t,i,s){let n=new wt(e),l=n.tokenize(),r=n.getErrors();if(r!=null&&r.length>0)throw k.thrown(r[0]);let h=null;if(t!=null&&i!=null)return new Ls().resolve(t,l,i,function(p){throw k.thrown(p)},function(p,f){let _=new ji(l,new ks(t,t,f,null));h=_.parse(),h.indentSize=n.detectedIndentSize;let d=_.getErrors();if(d!=null&&d.length>0)throw k.thrown(d[0]);s?.(h)}),h;let a=new ji(l);h=a.parse(),h.indentSize=n.detectedIndentSize;let o=a.getErrors();if(o!=null&&o.length>0)throw k.thrown(o[0]);return s?.(h),h}static play(e,t,i,s,n,l){let r=new ds(e,t,i,s,l);return r.start(n),r}static resume(e,t,i,s,n,l,r){let h=new ds(e,t,i,s,r);return h.restore(n),l!=null?h.start(l):h.resume(),h}static extractTranslations(e){return It.extractTranslations(e)}static print(e,t,i){let s=t,n=i;return new es(s??" ",n??`
39
+ `).print(e)}}K["loreline.Loreline"]=Ji.loreline.Loreline=hn,hn.__name__="loreline.Loreline";class Me{constructor(e,t,i,s){if(e<0||e>65535)throw k.thrown("Section value ("+e+") should be between 0 and 65535");if(t<0||t>65535)throw k.thrown("Branch value ("+t+") should be between 0 and 65535");if(i<0||i>65535)throw k.thrown("Block value ("+i+") should be between 0 and 65535");if(s<0||s>65535)throw k.thrown("Node value ("+s+") should be between 0 and 65535");let n=e-32768,l=t-32768;n<0&&(n=n+65536&65535),l<0&&(l=l+65536&65535);let r=i-32768,h=s-32768;r<0&&(r=r+65536&65535),h<0&&(h=h+65536&65535),this.thisVal=new Li(n<<16|l&65535,r<<16|h&65535)}get_section(){let e=this.thisVal.high>>16&65535;return(e>=32768?e-65536:e)+32768}set_section(e){let t=e-32768;return t<0&&(t=t+65536&65535),this.thisVal=new Li(this.thisVal.high&65535|t<<16,this.thisVal.low),e}get_branch(){let e=this.thisVal.high&65535;return(e>=32768?e-65536:e)+32768}set_branch(e){let t=e-32768;return t<0&&(t=t+65536&65535),this.thisVal=new Li(this.thisVal.high&-65536|t,this.thisVal.low),e}get_block(){let e=this.thisVal.low>>16&65535;return(e>=32768?e-65536:e)+32768}set_block(e){let t=e-32768;return t<0&&(t=t+65536&65535),this.thisVal=new Li(this.thisVal.high,this.thisVal.low&65535|t<<16),e}get_node(){let e=this.thisVal.low&65535;return(e>=32768?e-65536:e)+32768}set_node(e){let t=e-32768;return t<0&&(t=t+65536&65535),this.thisVal=new Li(this.thisVal.high,this.thisVal.low&-65536|t),e}nextSection(){let e=this.thisVal.high>>16&65535,t=(e>=32768?e-65536:e)+32768;if(t==65535)throw k.thrown("Node id section overflow");return new Me(t+1,0,0,0)}nextBranch(){let e=this.thisVal.high&65535,t=(e>=32768?e-65536:e)+32768;if(t==65535)return this.nextSection();let i=this.thisVal.high>>16&65535;return new Me((i>=32768?i-65536:i)+32768,t+1,0,0)}nextBlock(){let e=this.thisVal.low>>16&65535,t=(e>=32768?e-65536:e)+32768;if(t==65535)return this.nextBranch();let i=this.thisVal.high>>16&65535,s=this.thisVal.high&65535;return new Me((i>=32768?i-65536:i)+32768,(s>=32768?s-65536:s)+32768,t+1,0)}nextNode(){let e=this.thisVal.low&65535,t=(e>=32768?e-65536:e)+32768;if(t==65535)return this.nextBlock();let i=this.thisVal.high>>16&65535,s=this.thisVal.high&65535,n=this.thisVal.low>>16&65535;return new Me((i>=32768?i-65536:i)+32768,(s>=32768?s-65536:s)+32768,(n>=32768?n-65536:n)+32768,t+1)}toInt64(){return this.thisVal}toString(){let e=this.thisVal.high>>16&65535,t=this.thisVal.high&65535,i=this.thisVal.low>>16&65535,s=this.thisVal.low&65535;return""+((e>=32768?e-65536:e)+32768)+"."+((t>=32768?t-65536:t)+32768)+"."+((i>=32768?i-65536:i)+32768)+"."+((s>=32768?s-65536:s)+32768)}static fromInt64(e){return e}static fromString(e){let t=e.split(".");return new Me(Z.parseInt(t[0]),Z.parseInt(t[1]),Z.parseInt(t[2]),Z.parseInt(t[3]))}static fromTwoInt32(e,t){return Me.fromInt64(new Li(e,t))}static packInt32(e,t){return e<0&&(e=e+65536&65535),t<0&&(t=t+65536&65535),e<<16|t&65535}static int32GetLow(e){let t=e&65535;return t>=32768?t-65536:t}static int32SetLow(e,t){return t<0&&(t=t+65536&65535),e&-65536|t}static int32GetHigh(e){let t=e>>16&65535;return t>=32768?t-65536:t}static int32SetHigh(e,t){return t<0&&(t=t+65536&65535),e&65535|t<<16}static equals(e,t){let i=e.thisVal,s=t.thisVal;return i.high==s.high?i.low==s.low:!1}}K["loreline.NodeId"]=Me,Me.__name__="loreline.NodeId",Object.assign(Me.prototype,{__class__:Me,__properties__:{set_node:"set_node",get_node:"get_node",set_block:"set_block",get_block:"get_block",set_branch:"set_branch",get_branch:"get_branch",set_section:"set_section",get_section:"get_section"}});class Wi{constructor(){this.map=new _i}get(e){let t=e.thisVal;return this.map._get(t.high,t.low)}set(e,t){let i=e.thisVal;this.map._set(i.high,i.low,t)}remove(e){let t=e.thisVal;this.map._remove(t.high,t.low)}exists(e){let t=e.thisVal;return this.map._exists(t.high,t.low)}clear(){this.map.clear()}iterator(){return new Us(this.map)}keys(){return new qs(this.map)}keyValueIterator(){return new Ws(this.map)}}K["loreline.NodeIdMap"]=Wi,Wi.__name__="loreline.NodeIdMap",Object.assign(Wi.prototype,{__class__:Wi});class Us{constructor(e){for(this.map=e,this.index=0;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++}skipNulls(){for(;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++}hasNext(){return this.index<this.map._values.length}next(){let e=this.map._values[this.index];for(this.index++;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++;return e}}K["loreline._Node.NodeIdMapIterator"]=Us,Us.__name__="loreline._Node.NodeIdMapIterator",Object.assign(Us.prototype,{__class__:Us});class qs{constructor(e){for(this.map=e,this.index=0;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++}skipNulls(){for(;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++}hasNext(){return this.index<this.map._values.length}next(){let e=this.map._keys1[this.index],t=this.map._keys2[this.index];for(this.index++;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++;return Me.fromTwoInt32(e,t)}}K["loreline._Node.NodeIdMapKeyIterator"]=qs,qs.__name__="loreline._Node.NodeIdMapKeyIterator",Object.assign(qs.prototype,{__class__:qs});class Ws{constructor(e){for(this.map=e,this.index=0;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++}skipNulls(){for(;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++}hasNext(){return this.index<this.map._values.length}next(){let e=this.map._keys1[this.index],t=this.map._keys2[this.index],i=this.map._values[this.index];for(this.index++;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++;return{key:Me.fromTwoInt32(e,t),value:i}}}K["loreline._Node.NodeIdMapKeyValueIterator"]=Ws,Ws.__name__="loreline._Node.NodeIdMapKeyValueIterator",Object.assign(Ws.prototype,{__class__:Ws});class Pt{constructor(e,t){Pt._hx_skip_constructor||this._hx_constructor(e,t)}_hx_constructor(e,t){this.id=Me.UNDEFINED,this.id=e,this.pos=t}type(){return"Node"}toJson(){return{id:this.id.toString(),type:this.type(),pos:this.pos.toJson()}}each(e){}}K["loreline.Node"]=Ji.loreline.Node=Pt,Pt.__name__="loreline.Node",Object.assign(Pt.prototype,{__class__:Pt});class Ki extends Pt{constructor(e,t,i,s,n){n==null&&(n=!1),super(e,t),this.content=i,this.multiline=s,this.isHash=n}type(){return"Comment"}toJson(){let e=super.toJson();return e.content=this.content,e.multiline=this.multiline,this.isHash&&(e.isHash=!0),e}}K["loreline.Comment"]=Ki,Ki.__name__="loreline.Comment",Ki.__super__=Pt,Object.assign(Ki.prototype,{__class__:Ki});class be extends Pt{constructor(e,t,i,s){if(Pt._hx_skip_constructor){super();return}Pt._hx_skip_constructor=!0,super(),Pt._hx_skip_constructor=!1,this._hx_constructor(e,t,i,s)}_hx_constructor(e,t,i,s){super._hx_constructor(e,t),this.leadingComments=i,this.trailingComments=s}type(){return"AstNode"}eachComment(e){if(this.leadingComments!=null){let i=0,s=this.leadingComments;for(;i<s.length;){let n=s[i];++i,e(this,n)}}if(this.trailingComments!=null){let i=0,s=this.trailingComments;for(;i<s.length;){let n=s[i];++i,e(this,n)}}let t=this;this.each(function(i,s){if(i instanceof be){let n=i;if(n.leadingComments!=null){let l=0,r=n.leadingComments;for(;l<r.length;){let h=r[l];++l,e(t,h)}}if(n.trailingComments!=null){let l=0,r=n.trailingComments;for(;l<r.length;){let h=r[l];++l,e(t,h)}}}})}each(e){if(super.each(e),this.leadingComments!=null){let t=0,i=this.leadingComments;for(;t<i.length;){let s=i[t];++t,e(s,this),s.each(e)}}if(this.trailingComments!=null){let t=0,i=this.trailingComments;for(;t<i.length;){let s=i[t];++t,e(s,this),s.each(e)}}}toJson(){let e=super.toJson();if(this.leadingComments!=null&&this.leadingComments.length>0||this.trailingComments!=null&&this.trailingComments.length>0){let t={};if(this.leadingComments!=null&&this.leadingComments.length>0){let i=[],s=0,n=this.leadingComments;for(;s<n.length;){let l=n[s];++s,i.push(l.toJson())}t.leading=i}if(this.trailingComments!=null&&this.trailingComments.length>0){let i=[],s=0,n=this.trailingComments;for(;s<n.length;){let l=n[s];++s,i.push(l.toJson())}t.trailing=i}e.comments=t}return e}}K["loreline.AstNode"]=be,be.__name__="loreline.AstNode",be.__super__=Pt,Object.assign(be.prototype,{__class__:be});class nt extends be{constructor(e,t,i,s){super(e,t,i,s)}toJson(){return super.toJson()}type(){return"Expr"}}K["loreline.NExpr"]=nt,nt.__name__="loreline.NExpr",nt.__super__=be,Object.assign(nt.prototype,{__class__:nt});class Jt extends be{constructor(e,t,i,s,n,l){super(e,t,n,l),this.temporary=i,this.fields=s,this.style=0}type(){return"State"}get(e){let t=0,i=this.fields;for(;t<i.length;){let s=i[t];if(++t,s.name==e)return s.value}return null}each(e){if(super.each(e),this.fields!=null){let t=0,i=this.fields.length;for(;t<i;){let s=t++,n=this.fields[s];e(n,this),n.each(e)}}}toJson(){let e=super.toJson();e.temporary=this.temporary;let t=[],i=0,s=this.fields;for(;i<s.length;){let n=s[i];++i,t.push(n.toJson())}return e.fields=t,e.style=Oi.toString(this.style),e}}K["loreline.NStateDecl"]=Jt,Jt.__name__="loreline.NStateDecl",Jt.__super__=be,Object.assign(Jt.prototype,{__class__:Jt});class Fi extends be{constructor(e,t,i,s,n,l){super(e,t,n,l),this.name=i,this.value=s}type(){return"Field"}each(e){super.each(e),this.value!=null&&(e(this.value,this),this.value.each(e))}toJson(){let e=super.toJson();return e.name=this.name,e.value=this.value.toJson(),e}}K["loreline.NObjectField"]=Fi,Fi.__name__="loreline.NObjectField",Fi.__super__=be,Object.assign(Fi.prototype,{__class__:Fi});class Gt extends be{constructor(e,t,i,s,n,l,r){super(e,t,l,r),this.name=i,this.namePos=s,this.fields=n,this.style=0}type(){return"Character"}get(e){let t=0,i=this.fields;for(;t<i.length;){let s=i[t];if(++t,s.name==e)return s.value}return null}each(e){if(super.each(e),this.fields!=null){let t=0,i=this.fields.length;for(;t<i;){let s=t++,n=this.fields[s];e(n,this),n.each(e)}}}toJson(){let e=super.toJson();e.name=this.name,e.namePos=this.namePos.toJson();let t=[],i=0,s=this.fields;for(;i<s.length;){let n=s[i];++i,t.push(n.toJson())}return e.fields=t,e.style=Oi.toString(this.style),e}}K["loreline.NCharacterDecl"]=Gt,Gt.__name__="loreline.NCharacterDecl",Gt.__super__=be,Object.assign(Gt.prototype,{__class__:Gt});class De extends be{constructor(e,t,i,s,n,l){super(e,t,n,l),this.name=i,this.body=s,this.style=0}type(){return"Beat"}each(e){if(super.each(e),this.body!=null){let t=0,i=this.body.length;for(;t<i;){let s=t++,n=this.body[s];e(n,this),n.each(e)}}}toJson(){let e=super.toJson();e.name=this.name;let t=[],i=0,s=this.body;for(;i<s.length;){let n=s[i];++i,t.push(n.toJson())}return e.body=t,e.style=Oi.toString(this.style),e}}K["loreline.NBeatDecl"]=De,De.__name__="loreline.NBeatDecl",De.__super__=be,Object.assign(De.prototype,{__class__:De});var Le=Fe["loreline.StringPartType"]={__ename__:"loreline.StringPartType",__constructs__:null,Raw:(m=function(w){return{_hx_index:0,text:w,__enum__:"loreline.StringPartType",toString:C}},m._hx_name="Raw",m.__params__=["text"],m),Expr:(m=function(w){return{_hx_index:1,expr:w,__enum__:"loreline.StringPartType",toString:C}},m._hx_name="Expr",m.__params__=["expr"],m),Tag:(m=function(w,e){return{_hx_index:2,closing:w,expr:e,__enum__:"loreline.StringPartType",toString:C}},m._hx_name="Tag",m.__params__=["closing","expr"],m)};Le.__constructs__=[Le.Raw,Le.Expr,Le.Tag];class Oi{static toString(e){switch(e){case 0:return"Plain";case 1:return"Braces"}}}class xs{static toString(e){switch(e){case 0:return"Plain";case 2:return"Parens"}}}class ws{static toString(e){switch(e){case 0:return"Sequence";case 1:return"Cycle";case 2:return"Once";case 3:return"Pick";case 4:return"Shuffle"}}}class je extends nt{constructor(e,t,i,s,n){super(e,t,s,n),this.partType=i}type(){return"Part"}each(e){super.each(e);let t=this.partType;switch(t._hx_index){case 0:let i=t.text;break;case 1:let s=t.expr;e(s,this),s.each(e);break;case 2:let n=t.closing,l=t.expr;e(l,this),l.each(e);break}}toJson(){let e=super.toJson(),t=this.partType;switch(t._hx_index){case 0:let i=t.text;e.part="Raw",e.text=i;break;case 1:let s=t.expr;e.part="Expr",e.expression=s.toJson();break;case 2:let n=t.closing,l=t.expr;e.part="Tag",e.closing=n,e.content=l.toJson();break}return e}}K["loreline.NStringPart"]=je,je.__name__="loreline.NStringPart",je.__super__=nt,Object.assign(je.prototype,{__class__:je});class Tt extends nt{constructor(e,t,i,s,n,l){super(e,t,n,l),this.parts=s,this.quotes=i}type(){return"String"}each(e){if(super.each(e),this.parts!=null){let t=0,i=this.parts.length;for(;t<i;){let s=t++,n=this.parts[s];e(n,this),n.each(e)}}}toJson(){let e=super.toJson(),t=[],i=0,s=this.parts;for(;i<s.length;){let l=s[i];++i,t.push(l.toJson())}let n=t;return e.parts=n,e.quotes=Xs.toString(this.quotes),e}}K["loreline.NStringLiteral"]=Tt,Tt.__name__="loreline.NStringLiteral",Tt.__super__=nt,Object.assign(Tt.prototype,{__class__:Tt});class oi extends be{constructor(e,t,i,s,n){super(e,t,s,n),this.content=i,this.conditionStyle=0}type(){return"Text"}each(e){super.each(e),this.content!=null&&(e(this.content,this),this.content.each(e)),this.condition!=null&&(e(this.condition,this),this.condition.each(e))}toJson(){let e=super.toJson();return e.content=this.content.toJson(),this.condition!=null&&(e.condition=this.condition.toJson(),e.conditionStyle=xs.toString(this.conditionStyle),e.conditionPos=this.conditionPos.toJson()),e}}K["loreline.NTextStatement"]=oi,oi.__name__="loreline.NTextStatement",oi.__super__=be,Object.assign(oi.prototype,{__class__:oi});class hi extends be{constructor(e,t,i,s,n,l,r){super(e,t,l,r),this.character=i,this.characterPos=s,this.content=n,this.conditionStyle=0}type(){return"Dialogue"}each(e){super.each(e),this.content!=null&&(e(this.content,this),this.content.each(e)),this.condition!=null&&(e(this.condition,this),this.condition.each(e))}toJson(){let e=super.toJson();return e.character=this.character,e.characterPos=this.characterPos.toJson(),e.content=this.content.toJson(),this.condition!=null&&(e.condition=this.condition.toJson(),e.conditionStyle=xs.toString(this.conditionStyle),e.conditionPos=this.conditionPos.toJson()),e}}K["loreline.NDialogueStatement"]=hi,hi.__name__="loreline.NDialogueStatement",hi.__super__=be,Object.assign(hi.prototype,{__class__:hi});class fi extends be{constructor(e,t,i,s,n){super(e,t,s,n),this.options=i,this.style=0}type(){return"Choice"}each(e){if(super.each(e),this.options!=null){let t=0,i=this.options.length;for(;t<i;){let s=t++,n=this.options[s];e(n,this),n.each(e)}}}toJson(){let e=super.toJson(),t=[],i=0,s=this.options;for(;i<s.length;){let n=s[i];++i,t.push(n.toJson())}return e.options=t,e.style=Oi.toString(this.style),e}}K["loreline.NChoiceStatement"]=fi,fi.__name__="loreline.NChoiceStatement",fi.__super__=be,Object.assign(fi.prototype,{__class__:fi});class Ot extends be{constructor(e,t,i,s,n,l,r,h,a){super(e,t,h,a),this.text=i,this.insertion=s,this.condition=n,this.conditionStyle=l,this.body=r,this.style=0}type(){return"Option"}each(e){if(super.each(e),this.body!=null){let t=0,i=this.body.length;for(;t<i;){let s=t++,n=this.body[s];e(n,this),n.each(e)}}this.text!=null&&(e(this.text,this),this.text.each(e)),this.insertion!=null&&(e(this.insertion,this),this.insertion.each(e)),this.condition!=null&&(e(this.condition,this),this.condition.each(e))}toJson(){let e=super.toJson();this.text!=null&&(e.text=this.text.toJson()),this.insertion!=null&&(e.insertion=this.insertion.toJson()),this.condition!=null&&(e.condition=this.condition.toJson(),e.conditionStyle=xs.toString(this.conditionStyle),e.conditionPos=this.conditionPos.toJson());let t=[],i=0,s=this.body;for(;i<s.length;){let n=s[i];++i,t.push(n.toJson())}return e.body=t,e.style=Oi.toString(this.style),e}}K["loreline.NChoiceOption"]=Ot,Ot.__name__="loreline.NChoiceOption",Ot.__super__=be,Object.assign(Ot.prototype,{__class__:Ot});class mi extends be{constructor(e,t,i,s,n){super(e,t,s,n),this.body=i,this.style=0}type(){return"Block"}each(e){if(super.each(e),this.body!=null){let t=0,i=this.body.length;for(;t<i;){let s=t++,n=this.body[s];e(n,this),n.each(e)}}}toJson(){let e=super.toJson(),t=[],i=0,s=this.body;for(;i<s.length;){let n=s[i];++i,t.push(n.toJson())}return e.body=t,e.style=Oi.toString(this.style),e}}K["loreline.NBlock"]=mi,mi.__name__="loreline.NBlock",mi.__super__=be,Object.assign(mi.prototype,{__class__:mi});class gi extends be{constructor(e,t,i,s,n,l,r,h,a,o){super(e,t,r,h),this.condition=i,this.conditionStyle=s,this.thenBranch=n,this.elseBranch=l,this.elseLeadingComments=a,this.elseTrailingComments=o}type(){return"If"}each(e){if(super.each(e),this.condition!=null&&(e(this.condition,this),this.condition.each(e)),this.thenBranch!=null&&(e(this.thenBranch,this),this.thenBranch.each(e)),this.elseBranch!=null&&(e(this.elseBranch,this),this.elseBranch.each(e)),this.elseLeadingComments!=null){let t=0,i=this.elseLeadingComments;for(;t<i.length;){let s=i[t];++t,e(s,this),s.each(e)}}if(this.elseTrailingComments!=null){let t=0,i=this.elseTrailingComments;for(;t<i.length;){let s=i[t];++t,e(s,this),s.each(e)}}}toJson(){let e=super.toJson();e.condition=this.condition.toJson(),e.conditionStyle=xs.toString(this.conditionStyle);let t=[],i=0,s=this.thenBranch.body;for(;i<s.length;){let n=s[i];++i,t.push(n.toJson())}if(e.thenBranch=t,e.thenStyle=Oi.toString(this.thenBranch.style),this.elseBranch!=null){let n=[],l=0,r=this.elseBranch.body;for(;l<r.length;){let h=r[l];++l,n.push(h.toJson())}if(e.elseBranch=n,e.elseStyle=Oi.toString(this.elseBranch.style),this.elseLeadingComments!=null&&this.elseLeadingComments.length>0||this.elseTrailingComments!=null&&this.elseTrailingComments.length>0){let h=e.comments,a=h??{};if(this.elseLeadingComments!=null&&this.elseLeadingComments.length>0){let o=[],c=0,p=this.elseLeadingComments;for(;c<p.length;){let f=p[c];++c,o.push(f.toJson())}a.elseLeading=o}if(this.elseTrailingComments!=null&&this.elseTrailingComments.length>0){let o=[],c=0,p=this.elseTrailingComments;for(;c<p.length;){let f=p[c];++c,o.push(f.toJson())}a.elseTrailing=o}e.comments=a}}return e}}K["loreline.NIfStatement"]=gi,gi.__name__="loreline.NIfStatement",gi.__super__=be,Object.assign(gi.prototype,{__class__:gi});class Vi extends be{constructor(e,t,i,s,n,l){super(e,t,n,l),this.mode=i,this.items=s,this.style=0}type(){return"Alternative"}each(e){if(super.each(e),this.items!=null){let t=0,i=this.items.length;for(;t<i;){let s=t++,n=this.items[s];e(n,this),n.each(e)}}if(this.separatorComments!=null){let t=0,i=this.separatorComments;for(;t<i.length;){let s=i[t];if(++t,s!=null){let n=0;for(;n<s.length;){let l=s[n];++n,e(l,this),l.each(e)}}}}}toJson(){let e=super.toJson();e.mode=ws.toString(this.mode);let t=[],i=0,s=this.items;for(;i<s.length;){let n=s[i];++i,t.push(n.toJson())}return e.items=t,e.style=Oi.toString(this.style),e}}K["loreline.NAlternative"]=Vi,Vi.__name__="loreline.NAlternative",Vi.__super__=be,Object.assign(Vi.prototype,{__class__:Vi});class Vt extends nt{constructor(e,t,i,s,n,l){super(e,t,n,l),this.target=i,this.args=s}type(){return"Call"}each(e){if(super.each(e),this.target!=null&&(e(this.target,this),this.target.each(e)),this.args!=null){let t=0,i=this.args;for(;t<i.length;){let s=i[t];++t,e(s,this),s.each(e)}}}toJson(){let e=super.toJson();e.target=this.target.toJson();let t=[],i=0,s=this.args;for(;i<s.length;){let n=s[i];++i,t.push(n.toJson())}return e.args=t,e}}K["loreline.NCall"]=Vt,Vt.__name__="loreline.NCall",Vt.__super__=nt,Object.assign(Vt.prototype,{__class__:Vt});class Ni extends be{constructor(e,t,i,s,n,l){super(e,t,n,l),this.target=i,this.targetPos=s}type(){return"Transition"}toJson(){let e=super.toJson();return e.target=this.target,e.targetPos=this.targetPos.toJson(),e}}K["loreline.NTransition"]=Ni,Ni.__name__="loreline.NTransition",Ni.__super__=be,Object.assign(Ni.prototype,{__class__:Ni});class zi extends be{constructor(e,t,i,s,n,l){super(e,t,n,l),this.target=i,this.targetPos=s}type(){return"Insertion"}toJson(){let e=super.toJson();return e.target=this.target,e.targetPos=this.targetPos.toJson(),e}}K["loreline.NInsertion"]=zi,zi.__name__="loreline.NInsertion",zi.__super__=be,Object.assign(zi.prototype,{__class__:zi});class Di extends nt{constructor(e,t,i,s,n,l,r,h){super(e,t,r,h),this.name=i,this.args=s,this.code=n,this.external=l}type(){return"Function"}toJson(){let e=super.toJson();return this.name!=null&&(e.name=this.name),e.args=[].concat(this.args),e.code=this.code,e.external=this.external,e}}K["loreline.NFunctionDecl"]=Di,Di.__name__="loreline.NFunctionDecl",Di.__super__=nt,Object.assign(Di.prototype,{__class__:Di});class Oe extends nt{constructor(e,t,i,s,n,l){super(e,t,n,l),this.value=i,this.literalType=s}type(){return"Literal"}each(e){super.each(e);let t=this.literalType;switch(t._hx_index){case 0:case 1:case 2:break;case 3:if(this.value!=null){let s=0,n=this.value;for(;s<n.length;){let l=n[s];if(++s,l instanceof Pt){let r=l;e(r,this),r.each(e)}}}break;case 4:let i=t.style;if(this.value!=null){let s=0,n=this.value;for(;s<n.length;){let l=n[s];if(++s,l.value instanceof Pt){let r=l.value;e(r,this),r.each(e)}}}break}}toJson(){let e=super.toJson(),t=this.literalType;e.literal=Fe[t.__enum__].__constructs__[t._hx_index]._hx_name;let i=this.literalType;switch(i._hx_index){case 0:case 1:case 2:e.value=this.value;break;case 3:if(this.value!=null){let n=[],l=0,r=this.value;for(;l<r.length;){let h=r[l];++l,h instanceof Pt?n.push(h.toJson()):n.push(h)}e.value=n}break;case 4:let s=i.style;if(this.value!=null){let n=[],l=0,r=this.value;for(;l<r.length;){let h=r[l];++l,n.push(h.toJson())}e.value=n}else e.value=[];e.style=Oi.toString(s);break}return e}}K["loreline.NLiteral"]=Oe,Oe.__name__="loreline.NLiteral",Oe.__super__=nt,Object.assign(Oe.prototype,{__class__:Oe});var Re=Fe["loreline.LiteralType"]={__ename__:"loreline.LiteralType",__constructs__:null,Number:{_hx_name:"Number",_hx_index:0,__enum__:"loreline.LiteralType",toString:C},Boolean:{_hx_name:"Boolean",_hx_index:1,__enum__:"loreline.LiteralType",toString:C},Null:{_hx_name:"Null",_hx_index:2,__enum__:"loreline.LiteralType",toString:C},Array:{_hx_name:"Array",_hx_index:3,__enum__:"loreline.LiteralType",toString:C},Object:(m=function(w){return{_hx_index:4,style:w,__enum__:"loreline.LiteralType",toString:C}},m._hx_name="Object",m.__params__=["style"],m)};Re.__constructs__=[Re.Number,Re.Boolean,Re.Null,Re.Array,Re.Object];class lt extends nt{constructor(e,t,i,s,n,l){super(e,t,n,l),this.target=i,this.name=s}type(){return"Access"}each(e){super.each(e),this.target!=null&&(e(this.target,this),this.target.each(e))}toJson(){let e=super.toJson();return this.target!=null&&(e.target=this.target.toJson()),e.name=this.name,e}}K["loreline.NAccess"]=lt,lt.__name__="loreline.NAccess",lt.__super__=nt,Object.assign(lt.prototype,{__class__:lt});class di extends nt{constructor(e,t,i,s,n,l,r){super(e,t,l,r),this.target=i,this.op=s,this.value=n}type(){return"Assign"}each(e){super.each(e),this.target!=null&&(e(this.target,this),this.target.each(e)),this.value!=null&&(e(this.value,this),this.value.each(e))}toJson(){let e=super.toJson();return e.target=this.target.toJson(),e.op=Z.string(this.op),e.value=this.value.toJson(),e}}K["loreline.NAssign"]=di,di.__name__="loreline.NAssign",di.__super__=nt,Object.assign(di.prototype,{__class__:di});class ui extends nt{constructor(e,t,i,s,n,l){super(e,t,n,l),this.target=i,this.index=s}type(){return"ArrayAccess"}each(e){super.each(e),this.target!=null&&(e(this.target,this),this.target.each(e)),this.index!=null&&(e(this.index,this),this.index.each(e))}toJson(){let e=super.toJson();return e.target=this.target.toJson(),e.index=this.index.toJson(),e}}K["loreline.NArrayAccess"]=ui,ui.__name__="loreline.NArrayAccess",ui.__super__=nt,Object.assign(ui.prototype,{__class__:ui});class Xt extends nt{constructor(e,t,i,s,n,l,r){super(e,t,l,r),this.left=i,this.op=s,this.right=n}type(){return"Binary"}each(e){super.each(e),this.left!=null&&(e(this.left,this),this.left.each(e)),this.right!=null&&(e(this.right,this),this.right.each(e))}toJson(){let e=super.toJson();return e.left=this.left.toJson(),e.op=Z.string(this.op),e.right=this.right.toJson(),e}}K["loreline.NBinary"]=Xt,Xt.__name__="loreline.NBinary",Xt.__super__=nt,Object.assign(Xt.prototype,{__class__:Xt});class Hi extends nt{constructor(e,t,i,s,n,l){super(e,t,n,l),this.op=i,this.operand=s}type(){return"Unary"}each(e){super.each(e),this.operand!=null&&(e(this.operand,this),this.operand.each(e))}toJson(){let e=super.toJson();return e.op=Z.string(this.op),e.operand=this.operand.toJson(),e}}K["loreline.NUnary"]=Hi,Hi.__name__="loreline.NUnary",Hi.__super__=nt,Object.assign(Hi.prototype,{__class__:Hi});class Zt extends be{constructor(e,t,i,s,n,l){super(e,t,n,l),this.path=i,this.script=s}each(e){super.each(e),this.script!=null&&(e(this.script,this),this.script.each(e))}type(){return"Import"}toJson(){let e=super.toJson();return e.path=this.path.toJson(),e}}K["loreline.NImportStatement"]=Zt,Zt.__name__="loreline.NImportStatement",Zt.__super__=be,Object.assign(Zt.prototype,{__class__:Zt});class le{static isFields(e){return Q.__implements(e,Ei)||e instanceof me?!0:e instanceof Ri||typeof e=="number"&&(e|0)===e||typeof e=="number"||typeof e=="boolean"||typeof e=="string"?!1:!ee.isArray(e)}static getField(e,t,i){return Q.__implements(t,Ei)?t.lorelineGet(e,i):t instanceof me?t.h[i]:Pe.getProperty(t,i)}static getFields(e,t){if(Q.__implements(t,Ei))return t.lorelineFields(e);if(t instanceof me){let i=[],s=t.h,n=s,l=Object.keys(s),r=l.length,h=0;for(;h<r;){let a=l[h++];i.push(a)}return i}else return Pe.fields(t)}static setField(e,t,i,s){Q.__implements(t,Ei)?t.lorelineSet(e,i,s):t instanceof me?t.h[i]=s:Pe.setProperty(t,i,s)}static removeField(e,t,i){if(Q.__implements(t,Ei))return t.lorelineRemove(e,i);if(t instanceof me){let s=t;return Object.prototype.hasOwnProperty.call(s.h,i)?(delete s.h[i],!0):!1}else return Pe.deleteField(t,i)}static fieldExists(e,t,i){return Q.__implements(t,Ei)?t.lorelineExists(e,i):t instanceof me?Object.prototype.hasOwnProperty.call(t.h,i):Object.prototype.hasOwnProperty.call(t,i)}static getStringHelper(e,t){return e.stringHelpers.h[t]}static getArrayHelper(e,t){return e.arrayHelpers.h[t]}static getMapHelper(e,t){return e.mapHelpers.h[t]}static createFields(e,t,i){if(e!=null&&e.customCreateFields!=null){let s=e.customCreateFields(e,t,i);if(s!=null)return s}if(t!=null){let s=Object.create(K[t].prototype);return Q.__implements(s,Ei)&&s.lorelineCreate(e),s}return new me}}K["loreline.Objects"]=le,le.__name__="loreline.Objects";class we extends li{constructor(e,t){super(e,t)}}K["loreline.ParseError"]=we,we.__name__="loreline.ParseError",we.__super__=li,Object.assign(we.prototype,{__class__:we});class ks{constructor(e,t,i,s){this.imported=new me,this.rootPath=e,this.path=t,this.imports=i,s!=null&&(this.imported=s)}}K["loreline.ParserContext"]=ks,ks.__name__="loreline.ParserContext",Object.assign(ks.prototype,{__class__:ks});class ji{constructor(e,t){this.tokens=e,this.current=0,this.errors=null,this.pendingComments=null,this.lastTokenEnd=new z(1,1,0),this.lastLineBreak=null,this.lineBreakAfterToken=!1,this.currentNodeId=Me.UNDEFINED,this.rootBeat=null,this.context=t}parse(){let e=this.currentPos(),t=[],i=new ci(this.nextNodeId(4),e,t);for(;!this.isAtEnd();)try{let s=this.parseNode(!0);for(s!=null&&t.push(s);this.match(g.LineBreak););}catch(s){let n=k.caught(s).unwrap();if(n instanceof we){let l=n;this.addError(l),this.synchronize()}else throw s}return this.attachComments(i),i}getErrors(){return this.errors==null&&(this.errors=[]),this.errors}nextNodeId(e){let t;switch(e){case 1:t=this.currentNodeId.nextSection();break;case 2:t=this.currentNodeId.nextBranch();break;case 3:t=this.currentNodeId.nextBlock();break;case 4:t=this.currentNodeId.nextNode();break}return this.currentNodeId=t,this.currentNodeId}peek(){let e=this.current+1;for(;e<this.tokens.length;){let t=this.tokens[e].type;switch(t._hx_index){case 49:let i=t.content;++e;break;case 50:let s=t.content;++e;break;case 51:let n=t.content;++e;break;case 54:++e;break;default:return this.tokens[e]}}return this.tokens[this.tokens.length-1]}advance(e){e==null&&(e=!0);let t=this.tokens[this.current];if(!this.isAtEnd()){for(this.lastTokenEnd=t.pos,this.lineBreakAfterToken=!1;!this.isAtEnd()&&this.tokens[this.current+1]!=null&&(this.isComment(this.tokens[this.current+1].type)||e&&this.tokens[this.current+1].type==g.LineBreak);){this.current++;let i=this.tokens[this.current].type;switch(i._hx_index){case 49:let s=i.content;this.pendingComments==null&&(this.pendingComments=[]),this.pendingComments.push(new Ki(this.nextNodeId(4),this.currentPos(),s,!1));break;case 50:let n=i.content;this.pendingComments==null&&(this.pendingComments=[]),this.pendingComments.push(new Ki(this.nextNodeId(4),this.currentPos(),n,!0));break;case 51:let l=i.content;this.pendingComments==null&&(this.pendingComments=[]),this.pendingComments.push(new Ki(this.nextNodeId(4),this.currentPos(),l,!1,!0));break;case 54:this.lastLineBreak=this.currentPos(),this.lineBreakAfterToken=!0;break;default:}}this.current++}return t}previous(){return this.tokens[this.current-1]}prevWithType(e){let t=this.current-1;for(;t>=0;){if(Ft.equals(this.tokens[t].type,e))return this.tokens[t];--t}return null}prevIdentifier(){let e=this.current-1;for(;e>=0;){let t=this.tokens[e].type;if(t._hx_index==19){let i=t.name;return this.tokens[e]}--e}return null}prevNonWhitespaceOrComment(){let e=this.current-1;for(;e>=0;){let t=this.tokens[e].type;switch(t._hx_index){case 49:let i=t.content;break;case 50:let s=t.content;break;case 51:let n=t.content;break;case 52:case 53:case 54:break;default:return this.tokens[e]}--e}return null}nextNonWhitespaceOrComment(){let e=this.current;for(;e<this.tokens.length;){let t=this.tokens[e].type;switch(t._hx_index){case 49:let i=t.content;break;case 50:let s=t.content;break;case 51:let n=t.content;break;case 52:case 53:case 54:break;default:return this.tokens[e]}++e}return null}nextNonLineBreakOrComment(){let e=this.current;for(;e<this.tokens.length;){let t=this.tokens[e].type;switch(t._hx_index){case 49:let i=t.content;break;case 50:let s=t.content;break;case 51:let n=t.content;break;case 54:break;default:return this.tokens[e]}++e}return null}currentPos(){let e=this.tokens[this.current],t=e!=null?e.pos:null;return t??new z(1,1,0,0)}currentTokenTypeToString(){if(this.tokens!=null&&this.current>=0){let e=this.tokens[this.current],t=e!=null?e.type:null;return t!=null?Ft.toCodeString(t):null}return null}check(e){return this.isAtEnd()?!1:e._hx_index==40?this.tokens[this.current].type==g.Colon:Ft.equals(this.tokens[this.current].type,e)}checkString(){let e=this.tokens[this.current].type;if(e._hx_index==15){let t=e.attachments,i=e.quotes,s=e.s;return!0}else return!1}isAtEnd(){return this.current<this.tokens.length?this.tokens[this.current].type==g.Eof:!0}isComment(e){switch(e._hx_index){case 49:let t=e.content;return!0;case 50:let i=e.content;return!0;case 51:let s=e.content;return!0;default:return!1}}parseNode(e){for(e==null&&(e=!1);this.isComment(this.tokens[this.current].type)||this.tokens[this.current].type==g.LineBreak;){if(this.isComment(this.tokens[this.current].type)){this.pendingComments==null&&(this.pendingComments=[]);let s=this.pendingComments,n=this.nextNodeId(4),l=this.currentPos(),r=this.tokens[this.current].type,h;switch(r._hx_index){case 49:h=r.content;break;case 50:h=r.content;break;case 51:h=r.content;break;default:h=""}let a=this.tokens[this.current].type,o;if(a._hx_index==50){let f=a.content;o=!0}else o=!1;let c=this.tokens[this.current].type,p;if(c._hx_index==51){let f=c.content;p=!0}else p=!1;s.push(new Ki(n,l,h,o,p))}if(this.advance(),this.isAtEnd())throw k.thrown(new we("Unexpected end of file",this.currentPos()))}if(this.isAtEnd())throw k.thrown(new we("Unexpected end of file",this.currentPos()));let t=this,i=this.tokens[this.current].type;switch(i._hx_index){case 0:return this.parseImport();case 1:return this.parseStateDecl(!1);case 2:return this.parseBeatDecl();case 3:return e?this.parseCharacterDecl():(this.addError(new we("Unexpected: "+this.currentTokenTypeToString(),this.currentPos())),this.advance(),new Oe(this.nextNodeId(4),this.currentPos(),null,Re.Null));case 4:let s=this.parseChoiceStatement();return e?t.wrapInRootBeat(s):s;case 5:let n=this.parseIfStatement();return e?t.wrapInRootBeat(n):n;case 7:if(this.advance(),!this.check(g.KwState))throw k.thrown(new we("Expected 'state' after 'new'",this.currentPos()));let l=this.parseStateDecl(!0);return e?t.wrapInRootBeat(l):l;case 8:case 9:case 10:case 11:case 12:let r=this.parseAlternative();return e?t.wrapInRootBeat(r):r;case 14:let h=i.name,a=i.args,o=i.code,c=i.external;return e?this.parseFunction():(this.addError(new we("Unexpected: "+this.currentTokenTypeToString(),this.currentPos())),this.advance(),new Oe(this.nextNodeId(4),this.currentPos(),null,Re.Null));case 15:let p=i.quotes,f=i.s,_=i.attachments,d=this.parseTextStatement();return e?t.wrapInRootBeat(d):d;case 16:let x=i.n,y=this.parseExpressionStatement();return e?t.wrapInRootBeat(y):y;case 17:let b=i.b,v=this.parseExpressionStatement();return e?t.wrapInRootBeat(v):v;case 19:let T=i.name;if(this.peek().type==g.Colon){let A=this.parseDialogueStatement();return e?t.wrapInRootBeat(A):A}else{let A=this.parseExpressionStatement();return e?t.wrapInRootBeat(A):A}break;case 25:let E=this.parseInsertion();return e?t.wrapInRootBeat(E):E;case 18:case 26:case 38:case 43:case 45:case 47:let F=this.parseExpressionStatement();return e?t.wrapInRootBeat(F):F;case 39:let L=this.parseTransition();return e?t.wrapInRootBeat(L):L;default:return this.addError(new we("Unexpected: "+this.currentTokenTypeToString(),this.currentPos())),this.advance(),new Oe(this.nextNodeId(4),this.currentPos(),null,Re.Null)}}wrapInRootBeat(e){let t,i=null;if(this.rootBeat==null){let s=this.currentPos();t=[],this.rootBeat=new De(this.nextNodeId(1),s,"_",t),i=this.rootBeat}else t=this.rootBeat.body;return t.push(e),i}parseImport(){let e=this.currentPos();if(this.expect(g.KwImport),this.context==null)throw k.thrown(new we("Cannot import without a context",this.currentPos()));let t=0,i=this.tokens[this.current],s,n=i.type;if(n._hx_index==15){let p=n.attachments,f=n.quotes,_=n.s;t=f,s=_}else throw k.thrown(new we("Expected string literal for import path",this.currentPos()));let l=s;vt.isAbsolute(l)||(l=vt.join([vt.directory(this.context.rootPath),l])),l=vt.normalize(l);let r=".lor";if(this.context.rootPath.endsWith(".lor.txt")&&(r=".lor.txt"),l.toLowerCase().endsWith(r)||(l+=r),Object.prototype.hasOwnProperty.call(this.context.imported.h,l)){this.advance();let p=new Zt(this.nextNodeId(1),e.extendedTo(this.prevNonWhitespaceOrComment().pos),null,null);return p.path=new Tt(this.nextNodeId(4),i.pos,t,[new je(this.nextNodeId(4),i.pos,Le.Raw(s))]),this.attachComments(p)}let h=this.context.imports.h[l];if(h==null)throw k.thrown(new we("Failed to import file at path "+l+" ("+s+")",this.currentPos()));let a=new ji(h,new ks(this.context.rootPath,l,this.context.imports,this.context.imported));a.currentNodeId=this.currentNodeId;let o=a.parse();this.currentNodeId=a.currentNodeId,this.advance();let c=new Zt(this.nextNodeId(1),e.extendedTo(this.prevNonWhitespaceOrComment().pos),null,o);return c.path=new Tt(this.nextNodeId(4),i.pos,t,[new je(this.nextNodeId(4),i.pos,Le.Raw(s))]),this.attachComments(c)}parseDialogueStatement(){let e=this.currentPos(),t=new hi(this.nextNodeId(4),e,null,null,null),i=this.tokens[this.current].type,s;if(i._hx_index==19)s=i.name;else throw k.thrown(new we("Expected character name",this.currentPos()));t.character=s,t.characterPos=this.tokens[this.current].pos,this.advance(),this.expect(g.Colon),this.attachComments(t);let n=!1;if(this.checkBlockStart()){let l=this.parseBlockStart();if(l.type!=g.Indent)throw k.thrown(new we("Expected indent, got "+Ft.toCodeString(l.type),l.pos));n=!0}try{t.content=this.parseStringLiteral()}catch(l){let r=k.caught(l).unwrap();if(r instanceof we){let h=r;this.addError(h),t.content=new Tt(this.nextNodeId(4),this.currentPos(),0,[new je(this.nextNodeId(4),this.currentPos(),Le.Raw("?"))])}else throw l}if(!this.lineBreakAfterToken&&this.match(g.KwIf)){let l=this.previous().pos;this.check(g.LParen)&&(t.conditionStyle=2),t.condition=this.parseConditionExpression(),t.conditionPos=l.extendedTo(this.prevNonWhitespaceOrComment().pos)}if(n){for(;this.match(g.LineBreak););this.expect(g.Unindent)}return t.pos=t.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),t}parseStatementBlock(e){let t=this.parseBlockStart().type==g.Indent?g.Unindent:g.RBrace;for(;!this.check(t)&&!this.isAtEnd();){for(;this.match(g.LineBreak)||t!=g.Unindent&&this.match(g.Unindent););if(this.check(t))break;try{e.push(this.parseNode())}catch(i){let s=k.caught(i).unwrap();if(s instanceof we){let n=s;if(this.errors==null&&(this.errors=[]),this.errors.push(n),this.synchronize(),this.check(t))break}else throw i}for(;this.match(g.LineBreak)||t!=g.Unindent&&this.match(g.Unindent););}return this.expect(t),t==g.RBrace?1:0}parseStateDecl(e){let t=this.currentPos(),i=new Jt(this.nextNodeId(3),t,e,[]);this.expect(g.KwState);let s=this.parseBlockStart().type==g.Indent?g.Unindent:g.RBrace;for(i.style=s==g.RBrace?1:0,this.attachComments(i);!this.check(s)&&!this.isAtEnd();){for(;this.match(g.LineBreak)||s!=g.Unindent&&this.match(g.Unindent););for(i.fields.push(this.parseObjectField());this.match(g.LineBreak)||s!=g.Unindent&&this.match(g.Unindent););}for(;this.match(g.LineBreak)||s!=g.Unindent&&this.match(g.Unindent););return this.expect(s),i.pos=i.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),i}parseObjectField(){let e=this.currentPos(),t=this.expectIdentifier(),i=new Fi(this.nextNodeId(3),e,t,null);return this.expect(g.Colon),this.attachComments(i),this.checkBlockStart()?i.value=this.parseObjectLiteral():i.value=this.parseExpression(),i.pos=i.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),i}parseBeatDecl(){let e=this.currentPos(),t=new De(this.nextNodeId(1),e,null,[],[]);this.expect(g.KwBeat),t.pos=e.extendedTo(this.currentPos()),t.name=this.expectIdentifier();let s=this.parseBlockStart().type==g.Indent?g.Unindent:g.RBrace;for(t.style=s==g.RBrace?1:0,this.attachComments(t);!this.check(s)&&!this.isAtEnd();){for(;this.match(g.LineBreak)||s!=g.Unindent&&this.match(g.Unindent););for(t.body.push(this.parseNode());this.match(g.LineBreak)||s!=g.Unindent&&this.match(g.Unindent););}for(;this.match(g.LineBreak)||s!=g.Unindent&&this.match(g.Unindent););return this.expect(s),t.pos=t.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),t}checkBlockStart(){let e=null,t=null,i=0,s=0;for(;this.current+s<this.tokens.length;){let n=this.tokens[this.current+s];if(++s,n.type!=g.LineBreak){if(n.type==g.Indent){++i,e=n;continue}if(n.type==g.LBrace){t==null&&(t=n);continue}break}}if(t!=null)return!0;if(e!=null){if(i>1)throw k.thrown(new we("Invalid indentation level",e.pos));return!0}else return!1}parseBlockStart(){let e=null,t=null,i=0;for(;!this.isAtEnd();)if(!this.match(g.LineBreak)){if(this.match(g.Indent)){++i,e=this.prevWithType(g.Indent);continue}if(this.match(g.LBrace)){t==null&&(t=this.prevWithType(g.LBrace));continue}break}if(t!=null)return t;if(e!=null){if(i>1)throw k.thrown(new we("Invalid indentation level",e.pos));return e}else return this.addError(new we("Expected "+Ft.toCodeString(g.LBrace)+" or "+Ft.toCodeString(g.Indent)+", got "+this.currentTokenTypeToString(),this.currentPos())),new ie(g.Indent,this.currentPos())}parseCharacterDecl(){let e=this.currentPos(),t=new Gt(this.nextNodeId(3),e,null,null,[]);this.expect(g.KwCharacter),t.name=this.expectIdentifier(),t.namePos=this.prevNonWhitespaceOrComment().pos;let i=this.parseBlockStart().type==g.Indent?g.Unindent:g.RBrace;for(t.style=i==g.RBrace?1:0,this.attachComments(t);!this.check(i)&&!this.isAtEnd();){for(;this.match(g.LineBreak)||i!=g.Unindent&&this.match(g.Unindent););for(t.fields.push(this.parseObjectField());this.match(g.LineBreak)||i!=g.Unindent&&this.match(g.Unindent););}for(;this.match(g.LineBreak)||i!=g.Unindent&&this.match(g.Unindent););return this.expect(i),t.pos=t.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),t}parseTextStatement(){let e=this.currentPos(),t=this.attachComments(new oi(this.nextNodeId(4),e,null));if(t.content=this.parseStringLiteral(),!this.lineBreakAfterToken&&this.match(g.KwIf)){let i=this.previous().pos;this.check(g.LParen)&&(t.conditionStyle=2),t.condition=this.parseConditionExpression(),t.conditionPos=i.extendedTo(this.prevNonWhitespaceOrComment().pos)}return t.pos=t.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),t}parseChoiceStatement(){let e=this.currentPos(),t=new fi(this.nextNodeId(2),e,[]);this.expect(g.KwChoice);let i=this.parseBlockStart().type==g.Indent?g.Unindent:g.RBrace;for(t.style=i==g.RBrace?1:0,this.attachComments(t);!this.check(i)&&!this.isAtEnd();){for(;this.match(g.LineBreak)||i!=g.Unindent&&this.match(g.Unindent););for(t.options.push(this.parseChoiceOption(i));this.match(g.LineBreak)||i!=g.Unindent&&this.match(g.Unindent););}return this.expect(i),t.pos=t.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),t}parseChoiceOption(e){let t=this.currentPos(),i=this.attachComments(new Ot(this.nextNodeId(3),t,null,null,null,0,[])),s=null,n=!1;try{this.check(g.OpPlus)?(n=!0,i.insertion=this.parseInsertion()):i.text=this.parseStringLiteral()}catch(l){let r=k.caught(l).unwrap();if(r instanceof we){let h=r;this.addError(h),s=this.currentPos(),this.currentPos().offset==t.offset&&this.advance(),i.text=new Tt(this.nextNodeId(4),this.currentPos(),0,[new je(this.nextNodeId(4),this.currentPos(),Le.Raw("?"))])}else throw l}if(!n){if(this.match(g.KwIf)){let l=this.previous().pos,r=this.currentPos().offset;try{this.check(g.LParen)&&(i.conditionStyle=2),i.condition=this.parseConditionExpression(),i.conditionPos=l.extendedTo(this.prevNonWhitespaceOrComment().pos)}catch(h){let a=k.caught(h).unwrap();if(a instanceof we){let o=a;this.addError(o),s=this.currentPos(),this.currentPos().offset==r&&this.advance()}else throw h}}if(this.checkBlockStart()){i.body=[];let l=this.currentPos().offset;try{i.style=this.parseStatementBlock(i.body)}catch(r){let h=k.caught(r).unwrap();if(h instanceof we){let a=h;this.addError(a),s=this.currentPos(),this.currentPos().offset==l&&this.advance(),i.body.length==0&&(i.body=[new Oe(this.nextNodeId(4),this.currentPos(),null,Re.Null)])}else throw r}}else if(this.check(g.Arrow)){let l=this.currentPos().offset;try{i.body=[],i.body.push(this.parseNode())}catch(r){let h=k.caught(r).unwrap();if(h instanceof we){let a=h;this.addError(a),s=this.currentPos(),this.currentPos().offset==l&&this.advance(),i.body.length==0&&(i.body=[new Oe(this.nextNodeId(4),this.currentPos(),null,Re.Null)])}else throw r}i.style=0}}if(i.pos=i.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),s!=null)for(;!this.isAtEnd()&&this.currentPos().line<=s.line+1;)this.advance();return i}isExpressionStart(){let e=this.tokens[this.current].type;switch(e._hx_index){case 15:let t=e.quotes,i=e.s,s=e.attachments;return!0;case 16:let n=e.n;return!0;case 17:let l=e.b;return!0;case 19:let r=e.name;return this.peek().type!=g.Colon;case 18:case 26:case 38:case 43:case 45:case 47:return!0;default:return!1}}parseExpressionStatement(){let e=this.parseExpression();if(this.match(g.OpAssign)||this.match(g.OpPlusAssign)||this.match(g.OpMinusAssign)||this.match(g.OpMultiplyAssign)||this.match(g.OpDivideAssign)){let t=this.previous().type,i=this.attachComments(new di(this.nextNodeId(4),e.pos,e,t,null));return i.value=this.parseExpression(),i.pos=i.pos.extendedTo(i.value.pos),i}return this.attachComments(e)}isKnownNodeStart(){let e=this.tokens[this.current].type;switch(e._hx_index){case 15:let t=e.quotes,i=e.s,s=e.attachments;return!0;case 19:let n=e.name;return this.peek().type==g.Colon?!0:this.peek().type==g.Arrow;case 1:case 2:case 3:case 4:case 5:case 39:return!0;default:return!1}}parseIfStatement(){let e=this.currentPos(),t=new gi(this.nextNodeId(4),e,null,0,null,null);for(this.expect(g.KwIf),this.check(g.LParen)&&(t.conditionStyle=2),t.condition=this.parseConditionExpression();this.match(g.LineBreak););this.attachComments(t),t.thenBranch=new mi(this.nextNodeId(3),this.currentPos(),null),t.thenBranch.body=[],t.thenBranch.style=this.parseStatementBlock(t.thenBranch.body);let i=this.tokens[this.current];if(i!=null&&i.type==g.KwElse){for(this.advance();this.match(g.LineBreak););if(this.attachElseComments(t,i),this.check(g.KwIf)){t.elseBranch=new mi(this.nextNodeId(3),this.currentPos(),null);let s=this.parseIfStatement();t.elseBranch.body=[s],t.elseBranch.style=0}else t.elseBranch=new mi(this.nextNodeId(3),this.currentPos(),null),t.elseBranch.body=[],t.elseBranch.style=this.parseStatementBlock(t.elseBranch.body)}return t.pos=t.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),t}parseAlternative(){let e=this.currentPos(),t;switch(this.tokens[this.current].type._hx_index){case 8:t=0;break;case 9:t=1;break;case 10:t=2;break;case 11:t=3;break;case 12:t=4;break;default:throw k.thrown(new we("Expected alternative keyword",this.currentPos()))}let i=new Vi(this.nextNodeId(2),e,t,[]);for(this.advance();this.match(g.LineBreak););this.attachComments(i);let s=new mi(this.nextNodeId(3),this.currentPos(),null);for(s.body=[],s.style=this.parseStatementBlock(s.body),i.items.push(s),i.style=s.style;this.check(g.Separator);){let n=this.tokens[this.current];for(this.advance();this.match(g.LineBreak););if(this.pendingComments!=null&&this.pendingComments.length>0){i.separatorComments==null&&(i.separatorComments=[]);let r=[],h=[],a=0,o=this.pendingComments;for(;a<o.length;){let c=o[a];++a,c.pos.line<=n.pos.line?r.push(c):h.push(c)}i.separatorComments.push(r),this.pendingComments=h}let l=new mi(this.nextNodeId(3),this.currentPos(),null);l.body=[],l.style=this.parseStatementBlock(l.body),i.items.push(l)}return i.pos=i.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),i}parseTransition(){let e=this.currentPos();if(this.expect(g.Arrow),this.match(g.Dot))return this.attachComments(new Ni(this.nextNodeId(4),e.extendedTo(this.prevNonWhitespaceOrComment().pos),".",this.prevNonWhitespaceOrComment().pos));let t=this.expectIdentifier();return this.attachComments(new Ni(this.nextNodeId(4),e.extendedTo(this.prevNonWhitespaceOrComment().pos),t,this.prevNonWhitespaceOrComment().pos))}parseInsertion(){let e=this.currentPos();this.expect(g.OpPlus);let t=this.expectIdentifier();return this.attachComments(new zi(this.nextNodeId(4),e.extendedTo(this.prevNonWhitespaceOrComment().pos),t,this.prevNonWhitespaceOrComment().pos))}parseFunction(){let e=this.currentPos(),t=this.tokens[this.current].type;if(t._hx_index==14){let i=t.name,s=t.args,n=t.code,l=t.external;return this.advance(),this.attachComments(new Di(this.nextNodeId(3),e,i,[].concat(s),n,l))}else throw k.thrown(new we("Unexpected token in expression",this.currentPos()))}parseExpression(){try{let e=this.parseLogicalOr();if(this.check(g.OpAssign)||this.check(g.OpPlusAssign)||this.check(g.OpMinusAssign)||this.check(g.OpMultiplyAssign)||this.check(g.OpDivideAssign)){let t=this.tokens[this.current].type;this.advance();let i=this.attachComments(new di(this.nextNodeId(4),e.pos,e,t,null));return i.value=this.parseExpression(),i.pos=i.pos.extendedTo(i.value.pos),i}return e}catch(e){let t=k.caught(e).unwrap();return t instanceof we&&this.addError(t),new Oe(this.nextNodeId(4),this.currentPos(),null,Re.Null)}}parseLogicalOr(){let e=this.parseLogicalAnd();for(;this.match(g.OpOr(!1));){let t=this.previous().type,i=this.attachComments(new Xt(this.nextNodeId(4),e.pos,e,t,null));i.right=this.parseLogicalAnd(),i.pos=i.pos.extendedTo(i.right.pos),e=i}return e}parseLogicalAnd(){let e=this.parseEquality();for(;this.match(g.OpAnd(!1));){let t=this.previous().type,i=this.attachComments(new Xt(this.nextNodeId(4),e.pos,e,t,null));i.right=this.parseEquality(),i.pos=i.pos.extendedTo(i.right.pos),e=i}return e}parseEquality(){let e=this.parseComparison();for(;this.match(g.OpEquals)||this.match(g.OpNotEquals);){let t=this.previous().type,i=this.attachComments(new Xt(this.nextNodeId(4),e.pos,e,t,null));i.right=this.parseComparison(),i.pos=i.pos.extendedTo(i.right.pos),e=i}return e}parseComparison(){let e=this.parseAdditive();for(;this.match(g.OpGreater)||this.match(g.OpGreaterEq)||this.match(g.OpLess)||this.match(g.OpLessEq);){let t=this.previous().type,i=this.attachComments(new Xt(this.nextNodeId(4),e.pos,e,t,null));i.right=this.parseAdditive(),i.pos=i.pos.extendedTo(i.right.pos),e=i}return e}parseAdditive(){let e=this.parseMultiplicative();for(;this.match(g.OpPlus)||this.match(g.OpMinus);){let t=this.previous().type,i=this.attachComments(new Xt(this.nextNodeId(4),e.pos,e,t,null));i.right=this.parseMultiplicative(),i.pos=i.pos.extendedTo(i.right.pos),e=i}return e}parseMultiplicative(){let e=this.parseUnary();for(;this.match(g.OpMultiply)||this.match(g.OpDivide)||this.match(g.OpModulo);){let t=this.previous().type,i=this.attachComments(new Xt(this.nextNodeId(4),e.pos,e,t,null));i.right=this.parseUnary(),i.pos=i.pos.extendedTo(i.right.pos),e=i}return e}parseUnary(){if(this.match(g.OpNot)||this.match(g.OpMinus)){let e=this.previous().type,t=this.attachComments(new Hi(this.nextNodeId(4),this.previous().pos,e,null));return t.operand=this.parseUnary(),t.pos=t.pos.extendedTo(t.operand.pos),t}return this.parsePrimary()}parsePrimary(){let e=this.currentPos(),t=this.tokens[this.current].type;switch(t._hx_index){case 15:let i=t.quotes,s=t.s,n=t.attachments;return this.parsePostfix(e,this.parseStringLiteral());case 16:let l=t.n;return this.advance(),this.attachComments(new Oe(this.nextNodeId(4),e,l,Re.Number));case 17:let r=t.b;return this.advance(),this.attachComments(new Oe(this.nextNodeId(4),e,r,Re.Boolean));case 18:return this.advance(),this.attachComments(new Oe(this.nextNodeId(4),e,null,Re.Null));case 19:let h=t.name;if(this.peek().type==g.Colon){let o=[this.parseObjectField()];return new Oe(this.nextNodeId(4),e.extendedTo(this.prevNonWhitespaceOrComment().pos),o,Re.Object(0))}else return this.advance(),this.parseIdentifierExpression(e,h);break;case 43:return this.parsePostfix(e,this.parseObjectLiteral());case 45:this.advance();let a=this.parseExpression();return this.expect(g.RParen),this.parsePostfix(e,a);case 47:return this.parsePostfix(e,this.parseArrayLiteral());default:throw k.thrown(new we("Unexpected token in expression",this.currentPos()))}}parseStringLiteral(){let e=this.currentPos(),t=[],i=this.tokens[this.current].type;if(i._hx_index==15){let s=i.quotes,n=i.s,l=i.attachments,r=s!=0?e.withOffset(n,1,e.length-2):e,h=0;if(l==null||l.length==0){let p=this.makeStringPartPosition(r,n,0);p.length=r.length;let f=this.nextNodeId(4),_=this.nextNodeId(4);return t.push(new je(_,p,Le.Raw(n))),this.advance(),this.attachComments(new Tt(f,e,s,t))}let a=this.attachComments(new Tt(this.nextNodeId(4),e,s,t)),o=0,c=l.length;for(;o<c;){let p=o++,f=l[p];switch(f._hx_index){case 0:let _=f.braces,d=f.inTag,x=f.expr,y=f.start,b=f.length;if(h>=y+b)continue;if(y>h){let F=this.makeStringPartPosition(r,n,h);F.length=y-h;let L=y-h;t.push(new je(this.nextNodeId(4),F,Le.Raw(L!=null?u.substr(n,h,L):u.substr(n,h,null))))}t.push(this.parseStringInterpolation(_,d,x,y,b,n)),h=y+b;break;case 1:let v=f.closing,T=f.start,E=f.length;if(h>=T+E)continue;if(T>h){let F=this.makeStringPartPosition(r,n,h);F.length=T-h;let L=T-h;t.push(new je(this.nextNodeId(4),F,Le.Raw(L!=null?u.substr(n,h,L):u.substr(n,h,null))))}t.push(this.parseStringTag(v,T,E,n,s,l)),h=T+E;break}}if(h<n.length){let p=this.makeStringPartPosition(r,n,h);p.length=n.length-h;let f=null;t.push(new je(this.nextNodeId(4),p,Le.Raw(f!=null?u.substr(n,h,f):u.substr(n,h,null))))}if(this.advance(),this.pendingComments!=null){let p=null,f=0,_=this.pendingComments;for(;f<_.length;){let d=_[f];++f,d.pos.line==e.line?(a.trailingComments==null&&(a.trailingComments=[]),a.trailingComments.push(d)):(p==null&&(p=[]),p.push(d))}this.pendingComments=p}return a}else throw k.thrown(new we("Expected text, got "+this.currentTokenTypeToString(),this.currentPos()))}makeStringPartPosition(e,t,i){let s=e.line,n=e.column,l=0,r=i;for(;l<r;){let h=l++;u.cca(t,h)==10?(++s,n=1):++n}return new z(s,n,e.offset+i)}makeAccess(e,t,i,s){if(i!=null){if(i.length==0&&(this.errors==null||this.errors.length==0)&&this.addError(new we("Invalid access: "+(i!=null?"'"+i+"'":"null"),e)),t!=null)if(s!=null)e=new z(t.pos.line,t.pos.column,t.pos.offset,s.offset+i.length-t.pos.offset);else throw k.thrown(new we("Invalid access (missing name position)",e));else if(e.length==0){let n=s!=null?s.length:null;e=new z(e.line,e.column,e.offset,n??i.length)}}return new lt(this.nextNodeId(4),e,t,i)}parseStringInterpolation(e,t,i,s,n,l){let r=i[0],h=r!=null?r.pos:null,a=this.makeStringPartPosition(h??this.currentPos(),l,s);if(a.length=n,i.length==0){let p=i[0],f=p!=null?p.pos:null;this.addError(new we("Empty interpolation",f??this.currentPos()));let _=this.nextNodeId(4),d=this.nextNodeId(4),x=i[0],y=x!=null?x.pos:null;return new je(_,a,Le.Expr(new Oe(d,y??this.currentPos(),null,Re.Null)))}let o=null;if(!e&&i.length>0){let p=null,f=0,_=!1;for(;f<i.length;){let d=i[f];++f;let x=d.type;switch(x._hx_index){case 19:let y=x.name;if(p==null)p=this.attachComments(this.makeAccess(d.pos,null,y,null));else if(_)p=this.attachComments(this.makeAccess(d.pos,p,y,d.pos));else{this.addError(new we("Missing dot in field access",d.pos));let O=this.nextNodeId(4),q=this.nextNodeId(4),S=i[0],W=S!=null?S.pos:null;return new je(O,a,Le.Expr(new Oe(q,W??this.currentPos(),null,Re.Null)))}_=!1;break;case 42:if(p==null){this.addError(new we("Leading dot in field access",d.pos));let O=this.nextNodeId(4),q=this.nextNodeId(4),S=i[0],W=S!=null?S.pos:null;return new je(O,a,Le.Expr(new Oe(q,W??this.currentPos(),null,Re.Null)))}_=!0;break;case 45:if(p==null){this.addError(new we("Function call without target",d.pos));let O=this.nextNodeId(4),q=this.nextNodeId(4),S=i[0],W=S!=null?S.pos:null;return new je(O,a,Le.Expr(new Oe(q,W??this.currentPos(),null,Re.Null)))}let b=d.pos,v=[],T=[],E=1;for(;f<i.length&&E>0;){let O=i[f];switch(++f,O.type._hx_index){case 41:E==1?T.length>0&&(v.push(T),T=[]):T.push(O);break;case 45:++E,T.push(O);break;case 46:--E,E>0?T.push(O):T.length>0&&v.push(T);break;default:T.push(O)}}if(E>0){this.addError(new we("Unterminated function call",b));let O=this.nextNodeId(4),q=this.nextNodeId(4),S=i[0],W=S!=null?S.pos:null;return new je(O,a,Le.Expr(new Oe(q,W??this.currentPos(),null,Re.Null)))}let F=[],L=0;for(;L<v.length;){let O=v[L];++L;let q=new ji(O);q.currentNodeId=this.currentNodeId;let S=q.parseExpression();F.push(S),this.currentNodeId=q.currentNodeId}p=this.attachComments(new Vt(this.nextNodeId(4),b.extendedTo(i[f-1].pos),p,F)),_=!1;break;case 47:if(p==null){this.addError(new we("Array access without target",d.pos));let O=this.nextNodeId(4),q=this.nextNodeId(4),S=i[0],W=S!=null?S.pos:null;return new je(O,a,Le.Expr(new Oe(q,W??this.currentPos(),null,Re.Null)))}let A=d.pos,B=[],I=1,H=null;for(;f<i.length&&I>0;){let O=i[f];switch(++f,O.type._hx_index){case 47:++I,B.push(O);break;case 48:--I,I>0&&B.push(O),H=O;break;default:B.push(O)}}if(I>0){this.addError(new we("Unterminated array access",A));let O=this.nextNodeId(4),q=this.nextNodeId(4),S=i[0],W=S!=null?S.pos:null;return new je(O,a,Le.Expr(new Oe(q,W??this.currentPos(),null,Re.Null)))}let P=new ji(B);P.currentNodeId=this.currentNodeId;let M=P.parseExpression();this.currentNodeId=P.currentNodeId;let V=a.extendedTo(i[f-1].pos);V.length+=1,p=this.attachComments(new ui(this.nextNodeId(4),V,p,M)),_=!1;break;default:this.addError(new we("Unexpected token in field access: "+Ft.toCodeString(d.type),d.pos));let R=this.nextNodeId(4),Y=this.nextNodeId(4),$=i[0],te=$!=null?$.pos:null;return new je(R,a,Le.Expr(new Oe(Y,te??this.currentPos(),null,Re.Null)))}}_&&this.addError(new we("Trailing dot in field access",i[i.length-1].pos)),o=p}else{let p=new ji(i);p.currentNodeId=this.currentNodeId,o=p.parseExpression(),this.currentNodeId=p.currentNodeId,p.isAtEnd()||this.addError(new we("Unexpected tokens after interpolation expression",p.tokens[p.current].pos))}let c=new z(a.line,a.column+(e?1:0),a.offset-(e?2:0),n);return new je(this.nextNodeId(4),c,Le.Expr(o))}parseStringTag(e,t,i,s,n,l){let r=this.currentPos();n!=0&&(r=r.withOffset(s,1,r.length-2));let h=this.makeStringPartPosition(r,s,t);h.length=i;let a=e?2:1,o=t+a,c=i-(e?3:2),p=o+c,f=this.nextNodeId(4),_=!1;if(l!=null){let b=0,v=l.length;e:for(;b<v;){let T=b++,E=l[T];switch(E._hx_index){case 0:let F=E.braces,L=E.inTag,A=E.expr,B=E.start,I=E.length,H=B+I;if(B>=o&&H<=p){_=!0;break e}break;case 1:let P=E.closing,M=E.start,V=E.length;continue}}}if(!_){let b=this.makeStringPartPosition(r,s,o);b.length=c;let v=this.nextNodeId(4),T=this.nextNodeId(4);return new je(f,h,Le.Tag(e,this.attachComments(new Tt(v,b,0,[new je(T,b,Le.Raw(c!=null?u.substr(s,o,c):u.substr(s,o,null)))]))))}let d=[],x=this.attachComments(new Tt(this.nextNodeId(4),h,0,d)),y=o;if(l!=null){let b=0,v=l.length;for(;b<v;){let T=b++,E=l[T];switch(E._hx_index){case 0:let F=E.inTag,L=E.braces,A=E.expr,B=E.start,I=E.length,H=B+I;if(B>=o&&H<=p){if(B>y){let Y=this.makeStringPartPosition(r,s,o);Y.length=B-o;let $=B-y;d.push(new je(this.nextNodeId(4),Y,Le.Raw($!=null?u.substr(s,y,$):u.substr(s,y,null))))}let R=this.parseStringInterpolation(L,!0,A,B,I,s);R.pos=this.makeStringPartPosition(r,s,B),R.pos.length=I,d.push(R),y=H}break;case 1:let P=E.closing,M=E.start,V=E.length;continue}}}if(y<p){let b=null,v=this.makeStringPartPosition(h,b!=null?u.substr(s,t,b):u.substr(s,t,null),y-t+a);v.length=o+p-y;let T=p-y;d.push(new je(this.nextNodeId(4),v,Le.Raw(T!=null?u.substr(s,y,T):u.substr(s,y,null))))}return new je(f,h,Le.Tag(e,x))}parseIdentifierExpression(e,t){let i=this.attachComments(this.makeAccess(e,null,t,null));return this.parsePostfix(e,i)}parsePostfix(e,t){for(;;)if(this.match(g.Dot,!1)){let i=null,s=this.currentPos();this.checkIdentifier()?i=this.expectIdentifier():(this.addError(new we("Expected identifier after '.'",this.currentPos())),i=""),t=this.attachComments(this.makeAccess(e,t,i,s))}else if(this.match(g.LBracket)){let i=this.parseExpression();this.expect(g.RBracket);let s=e.extendedTo(this.previous().pos);t=this.attachComments(new ui(this.nextNodeId(4),s,t,i))}else if(this.match(g.LParen)){let i=this.parseCallArguments();t=this.attachComments(new Vt(this.nextNodeId(4),e.extendedTo(this.previous().pos),t,i))}else break;return t}parseArrayLiteral(){let e=this.currentPos(),t=[],i=new Oe(this.nextNodeId(4),e,t,Re.Array);this.expect(g.LBracket),this.attachComments(i);let s=!1;for(;!this.check(g.RBracket)&&!this.isAtEnd();){if(s){for(;this.match(g.LineBreak);)s=!1;this.match(g.Comma)&&(s=!1)}for(;this.match(g.LineBreak)||this.match(g.Indent)||this.match(g.Unindent);)s=!1;if(!this.check(g.RBracket)&&s)throw k.thrown(new we("Expected comma or line break between elements",this.currentPos()));for(;this.match(g.LineBreak)||this.match(g.Indent)||this.match(g.Unindent););this.check(g.RBracket)||t.push(this.parseExpression());let n=this.previous();s=n.type!=g.Colon&&n.type!=g.LineBreak}for(;this.match(g.LineBreak)||this.match(g.Indent)||this.match(g.Unindent););return this.expect(g.RBracket),i.pos=i.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),i}parseObjectLiteral(){let e=this.currentPos(),t=[],i=this.parseBlockStart().type==g.Indent?g.Unindent:g.RBrace,s=i==g.RBrace?1:0,n=new Oe(this.nextNodeId(4),i!=g.RBrace?this.nextNonWhitespaceOrComment().pos:e,t,Re.Object(s));this.attachComments(n);let l=!1;for(;!this.check(i)&&!this.isAtEnd();){if(l){for(;this.match(g.LineBreak)||i!=g.Unindent&&this.match(g.Unindent);)l=!1;this.match(g.Comma)&&(l=!1)}for(;this.match(g.LineBreak)||i!=g.Unindent&&this.match(g.Unindent);)l=!1;if(!this.check(i)&&l)throw k.thrown(new we("Expected comma or line break between fields",this.currentPos()));for(;this.match(g.LineBreak)||i!=g.Unindent&&this.match(g.Unindent););this.check(i)||t.push(this.parseObjectField());let r=this.previous();l=r.type!=g.Colon&&r.type!=g.LineBreak}for(;this.match(g.LineBreak)||i!=g.Unindent&&this.match(g.Unindent););return this.expect(i),n.pos=n.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),n}parseCallArguments(){let e=[];if(!this.check(g.RParen))do{for(;this.match(g.LineBreak););for(e.push(this.parseExpression());this.match(g.LineBreak););}while(this.match(g.Comma));return this.expect(g.RParen),e}parseConditionExpression(){let e=this.match(g.LParen),t=null;try{t=this.parseExpression(),t!=null&&Q.getClass(t)==di&&this.addError(new we("Invalid condition expression: can't assign a variable here. Did you want to use '==' instead?",t.pos))}catch(i){let s=k.caught(i).unwrap();if(s instanceof we){let n=s;this.addError(n),t=new Oe(this.nextNodeId(4),this.currentPos(),null,Re.Null)}else throw i}return e&&this.expect(g.RParen),t}match(e,t){return t==null&&(t=!0),this.check(e)?(this.advance(t),!0):!1}isAtLineBreak(){return this.lineBreakAfterToken?!0:this.tokens[this.current].type==g.LineBreak}expect(e){if(this.check(e))return this.advance();{let t=new we("Expected "+Ft.toCodeString(e)+", got "+(this.isAtEnd()?"end of file":this.currentTokenTypeToString()),this.tokens[Math.min(this.current,this.tokens.length-1)|0].pos);switch(e._hx_index){case 44:case 46:case 53:return this.addError(t),new ie(e,this.currentPos());default:}throw k.thrown(t)}}checkIdentifier(){let e=this.tokens[this.current].type;if(e._hx_index==19){let t=e.name;return!0}else return!1}expectIdentifier(){let e=this.tokens[this.current].type;if(e._hx_index==19){let t=e.name;return this.advance(),t}else throw k.thrown(new we("Expected identifier, got "+this.currentTokenTypeToString(),this.currentPos()))}attachComments(e){if(this.pendingComments==null||this.pendingComments.length==0)return e;let t=e.pos,i=null,s=0,n=this.pendingComments.length;for(;s<n;){let l=s++,r=this.pendingComments[l];r.pos.line<t.line?(e.leadingComments==null&&(e.leadingComments=[]),e.leadingComments.push(r)):r.pos.line==t.line||this.isAtEnd()?(e.trailingComments==null&&(e.trailingComments=[]),e.trailingComments.push(r)):(i==null&&(i=[]),i.push(r))}return this.pendingComments=i,e}attachElseComments(e,t){if(this.pendingComments!=null){let i=t.pos,s=[],n=0,l=this.pendingComments;for(;n<l.length;){let r=l[n];++n,r.pos.line<i.line?(e.elseLeadingComments==null&&(e.elseLeadingComments=[]),e.elseLeadingComments.push(r)):r.pos.line==i.line?(e.elseTrailingComments==null&&(e.elseTrailingComments=[]),e.elseTrailingComments.push(r)):s.push(r)}this.pendingComments=s}return e}synchronize(){for(this.advance();!this.isAtEnd();){let e=this.tokens[this.current].type;switch(e._hx_index){case 15:let t=e.quotes,i=e.s,s=e.attachments;if(this.previous().type==g.RBrace)return;this.advance();break;case 39:this.advance(),(this.check(g.Dot)||Ft.isIdentifier(this.tokens[this.current].type))&&this.advance();return;case 1:case 2:case 3:case 4:case 5:case 44:case 52:return;default:this.advance()}}}requiresNewLine(){switch(this.tokens[this.current].type._hx_index){case 6:case 39:case 44:return!1;default:return!0}}addError(e){return this.errors==null&&(this.errors=[]),this.errors.includes(e)||this.errors.push(e),e}}K["loreline.Parser"]=ji,ji.__name__="loreline.Parser",Object.assign(ji.prototype,{__class__:ji});class z{constructor(e,t,i,s){s==null&&(s=0),this.line=e,this.column=t,this.offset=i,this.length=s}toString(){return"("+this.line+":"+this.column+":"+this.offset+":"+this.length+")"}toJson(){let e={line:this.line,column:this.column,offset:this.offset};return this.length!=0&&(e.length=this.length),e}withOffset(e,t,i,s){if(s==null&&(s=0),i==null&&(i=0),t==0)return new z(this.line,this.column,this.offset,i);let n=this.line,l=this.column,r=this.offset;if(t>0){let h=0;for(;h<t;)r<s+e.length&&u.cca(e,r-s)==10?(++n,l=1):++l,++h,++r}else{let h=0;for(;h>t;){if(--r,r>=0&&u.cca(e,r-s)==10){--n;let a=1,o=r-1;for(;o>=0&&u.cca(e,o-s)!=10;)++a,--o;l=a}else--l;--h}}return r<0&&(r=0,n=1,l=1),new z(n,l,r,i)}extendedTo(e){return new z(this.line,this.column,this.offset,e.offset+e.length-this.offset)}static fromContentAndIndex(e,t,i){i==null&&(i=0);let s=1,n=1,l=0,r=e.length;for(t>r&&(t=r),t<0&&(t=0);l<t;)u.cca(e,l)==10?(++s,n=1):++n,++l;return new z(s,n,t,i)}}K["loreline.Position"]=z,z.__name__="loreline.Position",Object.assign(z.prototype,{__class__:z});class es{constructor(e,t){t==null&&(t=`
40
+ `),e==null&&(e=" "),this.enableComments=!0,this._indent=e,this._newline=t,this._beginLine=0,this._lastChar=-1,this._noLn=0,this._level=0,this._prevLevel=0,this._numEmptyLines=0,this._buf=new $t}clear(){this._noLn=0,this._level=0,this._prevLevel=0,this._numEmptyLines=0,this._buf=new $t}indent(){this._level++}unindent(){this._level--}write(e){if(e.length>0){this._beginLine>0&&(this.tab(),this._beginLine=0),this._buf.b+=e==null?"null":""+e,this._lastChar=u.cca(e,e.length-1);let t=e.length-1;for(;t>=0;){let i=u.cca(e,t);if(i!=32&&i!=10&&i!=13&&i!=9){this._lastVisibleChar=i;break}--t}}return this}_writeln(e){return e==null&&(e=""),this.write(e),this.newline()}newline(){return this._beginLine<2&&this._noLn==0&&(this._beginLine==1&&this._numEmptyLines++,this._buf.b+=Z.string(this._newline),this._beginLine++),this}tab(){let e=0,t=this._level;for(;e<t;){let i=e++;this._buf.b+=Z.string(this._indent)}return this}_line(e){return this.tab(),this._buf.b+=e==null?"null":""+e,this.newline()}toString(){return this._buf.b}printStringLiteralAsReference(e){let t=this.enableComments;this.enableComments=!1,this._noLn=0,this._level=0,this._prevLevel=0,this._numEmptyLines=0,this._buf=new $t,this._beginLine=1,this.printStringLiteral(e),this.enableComments=t;let i=Te.trim(this.toString());return i=i.split(`
41
+ `).join("\\n"),i}printStringLiteralAsText(e){let t=this.enableComments;this.enableComments=!1,this._noLn=0,this._level=0,this._prevLevel=0,this._numEmptyLines=0,this._buf=new $t,this._beginLine=1;let i=0,s=e.parts;for(;i<s.length;){let l=s[i];++i;let r=l.partType;switch(r._hx_index){case 0:let h=r.text;e.quotes==1?this.writeQuotedRaw(h):this.writeUnquotedRaw(h);break;case 1:let a=r.expr,o=this.isSimpleInterpolationExpr(a);this.write("$"),o||this.write("{"),this.printNode(a),o||this.write("}");break;case 2:let c=r.closing,p=r.expr;this.write(c?"</":"<"),this.printStringLiteral(p),this.write(">");break}}this.enableComments=t;let n=Te.trim(this.toString());return n=n.split(`
42
+ `).join("\\n"),n}print(e){return this._noLn=0,this._level=0,this._prevLevel=0,this._numEmptyLines=0,this._buf=new $t,this._beginLine=1,this.printNode(e),this.toString()}printNode(e,t){if(t==null&&(t=!1),e!=null)switch(Q.getClass(e)){case lt:this.printAccess(e);break;case Vi:this.printAlternative(e);break;case ui:this.printArrayAccess(e);break;case di:this.printAssignment(e);break;case De:this.printBeatDecl(e);break;case Xt:this.printBinary(e);break;case Vt:this.printCall(e);break;case Gt:this.printCharacterDecl(e);break;case Ot:this.printChoiceOption(e);break;case fi:this.printChoiceStatement(e);break;case hi:this.printDialogueStatement(e);break;case Di:this.printFunctionDecl(e);break;case gi:this.printIfStatement(e);break;case Zt:this.printImportStatement(e);break;case zi:this.printInsertion(e);break;case Oe:this.printLiteral(e);break;case Jt:this.printStateDecl(e);break;case Tt:this.printStringLiteral(e);break;case oi:this.printTextStatement(e);break;case Ni:this.printTransition(e,t);break;case Hi:this.printUnary(e);break;case ci:this.printScript(e);break;default:let i=Q.getClass(e);throw k.thrown("Unsupported node type: "+i.__name__)}}printLeadingComments(e){if(this.enableComments&&e.leadingComments!=null){let t=0,i=e.leadingComments;for(;t<i.length;){let s=i[t];++t,s.multiline?(this.write("/*"+s.content+"*/"),this.newline()):s.isHash?(this.write("#"+s.content),this.newline()):(this.write("//"+s.content),this.newline())}}}printHashTrailingComments(e){if(this.enableComments&&e.trailingComments!=null){let t=0,i=e.trailingComments;for(;t<i.length;){let s=i[t];++t,s.isHash&&(this._lastChar!=32&&this._beginLine==0&&this.write(" "),this.write("#"+s.content),this.newline())}}}printTrailingComments(e){if(this.enableComments&&e.trailingComments!=null){let t=0,i=e.trailingComments;for(;t<i.length;){let s=i[t];++t,this._lastChar!=32&&this._beginLine==0&&this.write(" "),s.multiline?this.write("/*"+s.content+"*/ "):s.isHash?(this.write("#"+s.content),this.newline()):(this.write("//"+s.content),this.newline())}}}printImport(e){this.printLeadingComments(e),this.write('import "'+Z.string(e.path)+'"'),this.newline(),this.printTrailingComments(e)}printScript(e){let t=0,i=e.body;for(;t<i.length;){let s=i[t];++t,this._prevLevel=this._level,this.printNode(s)}}printStateDecl(e){this.newline(),this.newline(),this.printLeadingComments(e),e.temporary&&this.write("new "),this.write("state "),this.printTrailingComments(e),e.style==1?(this.write("{"),this.newline()):this.newline(),this._level++;let t=!0,i=0,s=e.fields;for(;i<s.length;){let n=s[i];++i,t||this._beginLine==0&&this.newline(),t=!1,this.printLeadingComments(n),this.write(""+n.name+": "),this.printTrailingComments(n),this.printNode(n.value)}this.newline(),this._level--,e.style==1&&(this.write("}"),this.newline())}printCharacterDecl(e){this.newline(),this.newline(),this.printLeadingComments(e),this.write("character "+e.name+" "),this.printTrailingComments(e),e.style==1?(this.write("{"),this.newline()):this.newline(),this._level++;let t=0,i=e.fields;for(;t<i.length;){let s=i[t];++t,this.printLeadingComments(s),this.write(""+s.name+": "),this.printTrailingComments(s),this.printNode(s.value),this._beginLine==0&&this.newline()}this._level--,e.style==1&&(this.write("}"),this.newline())}printBeatDecl(e){this.newline(),this.newline(),this.printLeadingComments(e),this.write("beat "+e.name+" "),this.printTrailingComments(e),e.style==1&&(this.write("{"),this.newline()),this.newline(),this.newline(),this._level++;let t=0,i=e.body.length;for(;t<i;){let s=t++;this._prevLevel=this._level,this.printNode(e.body[s]),s<e.body.length-1&&this.newline()}this._level--,this._beginLine==0&&this.newline(),this._lastVisibleChar!=125&&this.newline(),e.style==1&&(this.write("}"),this.newline())}printFunctionDecl(e){this.newline(),this.newline(),this.printLeadingComments(e),this.write(e.code),this.printTrailingComments(e)}printTextStatement(e){this._level==this._prevLevel&&this.newline(),this.printLeadingComments(e),this.printNode(e.content),e.condition!=null&&(this.write(" if "),this.printInLineExpression(e.condition,e.conditionStyle==2)),this.printTrailingComments(e)}printDialogueStatement(e){this._level==this._prevLevel&&this.newline(),this.printLeadingComments(e),e.content!=null&&this.hasRealNewlines(e.content)?(this.write(""+e.character+":"),this.printTrailingComments(e),this.newline(),this._level++,this.printNode(e.content),this._level--):(this.write(""+e.character+": "),this.printTrailingComments(e),this.printNode(e.content)),e.condition!=null&&(this.write(" if "),this.printInLineExpression(e.condition,e.conditionStyle==2))}printChoiceStatement(e){if(this.newline(),this.newline(),this.printLeadingComments(e),this.write("choice "),this.printTrailingComments(e),e.style==1?(this.write("{"),this.newline()):this.newline(),this._level++,e.options.length>0){this._noLn++;let t=0,i=e.options;for(;t<i.length;){let s=i[t];++t,this.printNode(s),this.newline()}}this._level--,e.style==1&&(this.write("}"),this.newline())}printImportStatement(e){this.newline(),this.newline(),this.printLeadingComments(e),this.write("import "),this.printStringLiteral(e.path),this.printTrailingComments(e)}printChoiceOption(e){if(this.newline(),this.newline(),this._noLn=0,this.printLeadingComments(e),e.insertion!=null?this.printNode(e.insertion):this.printNode(e.text),this.printTrailingComments(e),e.condition!=null&&(this.write(" if "),this.printInLineExpression(e.condition,e.conditionStyle==2)),e.body.length>0)if(e.condition==null&&e.body.length==1&&e.body[0]instanceof Ni)this._prevLevel=this._level,this.write(" "),this.printNode(e.body[0],!0),this._beginLine==0&&this.newline();else{e.style==1?(this.write(" {"),this.newline()):this.newline(),this._prevLevel=this._level,this._level++;let t=0,i=e.body;for(;t<i.length;){let s=i[t];++t,this.printNode(s),this._beginLine==0&&s!=e.body[e.body.length-1]&&this.newline(),this._prevLevel=this._level}this._level--,this.newline(),e.style==1&&(this.write("}"),this.newline())}else this.newline()}printIfStatement(e,t){t==null&&(t=!1),this._level==this._prevLevel&&this.newline(),this.printLeadingComments(e),this.write("if "),this.printInLineExpression(e.condition,e.conditionStyle==2),this.printTrailingComments(e),e.thenBranch.style==1&&this.write(" {"),this.newline(),this._prevLevel=this._level,this._level++;let i=this._numEmptyLines,s=0,n=e.thenBranch.body;for(;s<n.length;){let l=n[s];++s,this.printNode(l),this.newline(),this._prevLevel=this._level}if(this._level--,e.thenBranch.style==1&&this.write("}"),e.elseBranch!=null)if(e.elseBranch.body.length==1&&e.elseBranch.body[0]instanceof gi){let l=e.elseBranch.body[0];(this._numEmptyLines-i>0||this.needsEmptyLines(l))&&this.newline(),this.write("else "),this.printIfStatement(e.elseBranch.body[0],!0)}else{this._numEmptyLines-i>0&&this.newline(),e.elseBranch.style==1?(this.write("else {"),this.newline()):(this.write("else"),this.newline()),this._prevLevel=this._level,this._level++;let l=0,r=e.elseBranch.body;for(;l<r.length;){let h=r[l];++l,this.printNode(h),this.newline(),this._prevLevel=this._level}this._level--,e.elseBranch.style==1&&(this.write("}"),this.newline())}}printAlternative(e){this._level==this._prevLevel&&this.newline(),this.printLeadingComments(e);let t;switch(e.mode){case 0:t="sequence";break;case 1:t="cycle";break;case 2:t="once";break;case 3:t="pick";break;case 4:t="shuffle";break}this.write(t),this.printTrailingComments(e),e.style==1&&this.write(" {"),this.newline(),this._prevLevel=this._level;let i=0,s=e.items.length;for(;i<s;){let n=i++,l=e.items[n];this._level++;let r=0,h=l.body;for(;r<h.length;){let a=h[r];++r,this.printNode(a),this.newline(),this._prevLevel=this._level}this._level--,e.style==1&&this.write("}"),n<e.items.length-1&&(this.write("--"),this.newline(),e.style==1&&this.write(" {"),this.newline(),this._prevLevel=this._level)}}needsEmptyLines(e){return new es(this._indent,`
43
+ `).print(e).indexOf(`
44
+
45
+ `)!=-1}printTransition(e,t){!t&&this._prevLevel==this._level&&this.newline(),this.printLeadingComments(e),this.write("-> "+e.target),this.printTrailingComments(e)}printInsertion(e){this._prevLevel==this._level&&this.newline(),this.printLeadingComments(e),this.write("+ "+e.target),this.printTrailingComments(e)}printStringLiteral(e){let t=e.quotes==1;t&&(this.printLeadingComments(e),this.write('"'));let i=0,s=e.parts;for(;i<s.length;){let n=s[i];++i;let l=n.partType;switch(l._hx_index){case 0:let r=l.text;t?this.writeQuotedRaw(r):this.writeUnquotedRaw(r);break;case 1:let h=l.expr,a=this.isSimpleInterpolationExpr(h);this.write("$"),a||this.write("{"),this.printNode(h),a||this.write("}");break;case 2:let o=l.closing,c=l.expr;this.write(o?"</":"<"),this.printStringLiteral(c),this.write(">");break}}t?(this.write('"'),this.printTrailingComments(e)):this.printHashTrailingComments(e)}writeUnquotedRaw(e){this.writeRawWithContinuation(e,!0)}writeQuotedRaw(e){if(e.indexOf(`
46
+ `)==-1){this.write(e);return}let t=e.split(`
47
+ `),i=0,s=t.length;for(;i<s;){let n=i++;n>0&&(this._buf.b+=Z.string(this._newline));let l=t[n];if(l.length>0&&u.cca(l,l.length-1)==13){let r=l.length-1;l=r!=null?l.substring(0,r):l.substring(0)}l.length>0&&(this._buf.b+=l==null?"null":""+l,this._lastChar=u.cca(l,l.length-1))}}writeRawWithContinuation(e,t){if(e.indexOf(`
48
+ `)==-1){this.write(e);return}let i=e.split(`
49
+ `),s=0,n=i.length;for(;s<n;){let l=s++;l>0&&(this._buf.b+=Z.string(this._newline),this._beginLine=1);let r=i[l];if(r.length>0&&u.cca(r,r.length-1)==13){let h=r.length-1;r=h!=null?r.substring(0,h):r.substring(0)}if(t&&l>0){let h=0;for(;h<r.length&&(u.cca(r,h)==32||u.cca(r,h)==9);)++h;if(h>0){let a=null;r=a!=null?r.substring(h,a):r.substring(h)}}r.length>0&&this.write(r)}}printLiteral(e){this.printLeadingComments(e);let t=e.literalType;switch(t._hx_index){case 0:this.write(e.value==null?"null":Z.string(e.value));break;case 1:this.write(e.value?"true":"false");break;case 2:this.write("null");break;case 3:let i=!0;this.write("[");let s=0,n=e.value;for(;s<n.length;){let o=n[s];++s,i||this.write(", "),i=!1,this.printNode(o)}this.write("]");break;case 4:let l=t.style;l==1?(this.write("{"),this.newline()):this.newline(),this._level++;let r=!0,h=0,a=e.value;for(;h<a.length;){let o=a[h];++h,r||this._beginLine==0&&this.newline(),r=!1,this.printLeadingComments(o),this.write(""+o.name+": "),this.printTrailingComments(o),this.printNode(o.value)}this.newline(),this._level--,l==1&&this.write("}");break}this.printTrailingComments(e)}printAccess(e){this.printLeadingComments(e),e.target!=null&&(this.printNode(e.target),this.write(".")),this.write(e.name),this.printTrailingComments(e)}printArrayAccess(e){this.printLeadingComments(e),this.printNode(e.target),this.write("["),this.printNode(e.index),this.write("]"),this.printTrailingComments(e)}printCall(e){this.printLeadingComments(e),this.printNode(e.target),this.write("(");let t=!0,i=0,s=e.args;for(;i<s.length;){let n=s[i];++i,t||this.write(", "),t=!1,this.printNode(n)}this.write(")"),this.printTrailingComments(e)}printBinary(e,t){t==null&&(t=!1),this.printLeadingComments(e);let i;if(t)i=!1;else{let s=e.op;switch(s._hx_index){case 36:let n=s.word;i=!0;break;case 37:let l=s.word;i=!0;break;default:i=!1}}i&&this.write("("),this.printNode(e.left),this.write(" "+this.getOperator(e.op)+" "),this.printNode(e.right),i&&this.write(")"),this.printTrailingComments(e)}printUnary(e){this.printLeadingComments(e),this.write(this.getOperator(e.op)),this.printTrailingComments(e),this.printNode(e.operand)}printAssignment(e){this.printLeadingComments(e),this.printNode(e.target),this.printTrailingComments(e),this.write(" "+this.getOperator(e.op)+" "),this.printNode(e.value)}printInLineExpression(e,t){let i=this.enableComments;this.enableComments=!1,t&&this.write("("),e instanceof Xt?this.printBinary(e,!0):this.printNode(e),t&&this.write(")"),this.enableComments=i}isSimpleInterpolationExpr(e){if(e instanceof lt){let t=e;return t.target==null?!0:this.isSimpleInterpolationExpr(t.target)}return e instanceof ui?this.isSimpleInterpolationExpr(Q.__cast(e,ui).target):e instanceof Vt?this.isSimpleInterpolationExpr(Q.__cast(e,Vt).target):!1}hasRealNewlines(e){if(e instanceof Tt){let t=e;if(t.quotes==1)return!1;let i=0,s=t.parts;for(;i<s.length;){let n=s[i];++i;let l=n.partType;if(l._hx_index==0&&l.text.indexOf(`
50
+ `)!=-1)return!0}}return!1}getOperator(e){switch(e._hx_index){case 20:return"=";case 21:return"+=";case 22:return"-=";case 23:return"*=";case 24:return"/=";case 25:return"+";case 26:return"-";case 27:return"*";case 28:return"/";case 29:return"%";case 30:return"==";case 31:return"!=";case 32:return">";case 33:return"<";case 34:return">=";case 35:return"<=";case 36:return e.word?"and":"&&";case 37:return e.word?"or":"||";case 38:return"!";default:throw k.thrown("Unsupported operator: "+Z.string(e))}}}K["loreline.Printer"]=es,es.__name__="loreline.Printer",Object.assign(es.prototype,{__class__:es});class Xs{static toString(e){switch(e){case 0:return"Unquoted";case 1:return"DoubleQuotes"}}}class as{constructor(e){e==null&&(e=-1),e<0&&(e=new Date().getTime()/1e3*1e6,e+=Math.random()*1e5,e%=2147483647),this.seed=e,this.initialSeed=this.seed}next(){return(this.seed=this.seed*16807%2147483647)/2147483647+233e-12}between(e,t){return Math.floor(e+(t-e)*((this.seed=this.seed*16807%2147483647)/2147483647+233e-12))}reset(e){e!=null&&(this.initialSeed=e),this.seed=this.initialSeed}}K["loreline.Random"]=as,as.__name__="loreline.Random",Object.assign(as.prototype,{__class__:as});class ci extends be{constructor(e,t,i){Pt._hx_skip_constructor=!0,super(),Pt._hx_skip_constructor=!1,this._hx_constructor(e,t,i)}_hx_constructor(e,t,i){this.indentSize=2,super._hx_constructor(e,t),this.body=i}toJson(){let e=super.toJson(),t=[],i=0,s=this.body;for(;i<s.length;){let n=s[i];++i,t.push(n.toJson())}return e.body=t,e}type(){return"Script"}eachExcludingImported(e){if(super.each(e),this.body!=null){let t=0,i=this.body;for(;t<i.length;){let s=i[t];++t,e(s,this),s instanceof Zt||s.each(e)}}}each(e){if(super.each(e),this.body!=null){let t=0,i=this.body;for(;t<i.length;){let s=i[t];++t,e(s,this),s.each(e)}}}iterator(){return new Ks(this.body)}}K["loreline.Script"]=Ji.loreline.Script=ci,ci.__name__="loreline.Script",ci.__super__=be,Object.assign(ci.prototype,{__class__:ci});class Ks{constructor(e){this.body=e,this.index=0,this.flatBody=[],this.fillBody(e)}fillBody(e){let t=0,i=e.length;for(;t<i;){let s=t++,n=e[s];if(n instanceof Zt){let l=n;l.script!=null&&this.fillBody(l.script.body)}this.flatBody.push(e[s])}}hasNext(){return this.index<this.flatBody.length}next(){let e=this.flatBody[this.index];return this.index++,e}}K["loreline._Script.ScriptBodyIterator"]=Ks,Ks.__name__="loreline._Script.ScriptBodyIterator",Object.assign(Ks.prototype,{__class__:Ks});class an{static uLength(e){return e.length}static uSubstr(e,t,i){return i!=null?u.substr(e,t,i):u.substr(e,t,null)}static uSubstring(e,t,i){return i!=null?e.substring(t,i):e.substring(t)}static uCharCodeAt(e,t){return u.cca(e,t)}static uIndexOf(e,t,i){return e.indexOf(t,i)}static uLastIndexOf(e,t,i){return e.lastIndexOf(t,i)}static uToChars(e){return e.split("")}static uCharAt(e,t){return e.charAt(t)}}K["loreline.Utf8"]=an,an.__name__="loreline.Utf8";class ys extends li{constructor(e,t,i){super(t,i),this.wrapped=e}}K["loreline.WrappedError"]=ys,ys.__name__="loreline.WrappedError",ys.__super__=li,Object.assign(ys.prototype,{__class__:ys});class Zs{static main(){}}K["loreline.lib.Library"]=Zs,Zs.__name__="loreline.lib.Library";function on(w){return w instanceof Array?new bi(w):w.iterator()}function _e(w,e){if(e==null)return null;e.__id__==null&&(e.__id__=Gs.$haxeUID++);var t;return w.hx__closures__==null?w.hx__closures__={}:t=w.hx__closures__[e.__id__],t==null&&(t=e.bind(w),w.hx__closures__[e.__id__]=t),t}Gs.$haxeUID|=0,typeof performance<"u"&&typeof performance.now=="function"&&(u.now=performance.now.bind(performance)),K.Math=Math,String.fromCodePoint==null&&(String.fromCodePoint=function(w){return w<65536?String.fromCharCode(w):String.fromCharCode((w>>10)+55232)+String.fromCharCode((w&1023)+56320)});{Object.defineProperty(String.prototype,"__class__",{value:K.String=String,enumerable:!1,writable:!0}),String.__name__="String",K.Array=Array,Array.__name__="Array",Date.prototype.__class__=K.Date=Date,Date.__name__="Date";var _n={},fn={},mn=Number,gn=Boolean,dn={},xn={}}Q.__toStr={}.toString,G.Element=0,G.PCData=1,G.CData=2,G.Document=6,It.randomId_nonHexChars="ghijklmnopqrstuvwxyz",It.randomId_chars="0123456789abcdefghijklmnopqrstuvwxyz",ls.ObjectBrace=0,ls.ArrayBracket=1,ls.Brace=2,ls.Indent=3,ls.CaseIndent=4,ls.Bracket=5,ls.Paren=6,qi.CONTROL_KEYWORDS=["for","while","if","else","switch","catch"],_i.INITIAL_SIZE=16,_i.LOAD_FACTOR=.75,Pi.ChoiceBrace=0,Pi.ChoiceIndent=1,Pi.StateBrace=2,Pi.StateIndent=3,Pi.CharacterBrace=4,Pi.CharacterIndent=5,Pi.BeatBrace=6,Pi.BeatIndent=7,Pi.AlternativeBrace=8,Pi.AlternativeIndent=9,Pi.Brace=10,Pi.Indent=11,Pi.Bracket=12,wt.hasNonSpecialChar_specialChars=` "+=*/-(){}[]:
51
+ \r`,wt.KEYWORDS=(function(w){var e;let t=new me;return t.h.import=g.KwImport,t.h.state=g.KwState,t.h.beat=g.KwBeat,t.h.character=g.KwCharacter,t.h.choice=g.KwChoice,t.h.if=g.KwIf,t.h.else=g.KwElse,t.h.new=g.KwNew,t.h.sequence=g.KwSequence,t.h.cycle=g.KwCycle,t.h.once=g.KwOnce,t.h.pick=g.KwPick,t.h.shuffle=g.KwShuffle,t.h.true=g.LBoolean(!0),t.h.false=g.LBoolean(!1),t.h.null=g.LNull,t.h.and=g.OpAnd(!0),t.h.or=g.OpOr(!0),e=t,e})(this),Me.OFFSET=32768,Me.MAX=65535,Me.UNDEFINED=new Me(0,0,0,0),Pt._hx_skip_constructor=!1,Oi.Plain=0,Oi.Braces=1,xs.Plain=0,xs.Parens=2,ws.Sequence=0,ws.Cycle=1,ws.Once=2,ws.Pick=3,ws.Shuffle=4,Xs.Unquoted=0,Xs.DoubleQuotes=1,Zs.main()})(Js,Pn);export const Loreline=Js.loreline.Loreline,Interpreter=Js.loreline.Interpreter,Node=Js.loreline.Node,Script=Js.loreline.Script;