loreline 0.8.0 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,52 +1,52 @@
1
- "use strict";let Xl={},Bn={};(function(Yi,Zl){"use strict";Yi.loreline=Yi.loreline||{};var j={},S=function(){return te.__string_rec(this,"")},Qe=Qe||{},d;class p{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()}}j.HxOverrides=p,p.__name__="HxOverrides";class Ol{constructor(e,t){this.min=e,this.max=t}hasNext(){return this.min<this.max}next(){return this.min++}}j.IntIterator=Ol,Ol.__name__="IntIterator",Object.assign(Ol.prototype,{__class__:Ol});class tn{static exists(e,t){let i=fn(e);for(;i.hasNext();){let l=i.next();if(t(l))return!0}return!1}}j.Lambda=tn,tn.__name__="Lambda",Math.__name__="Math";class We{static field(e,t){try{return e[t]}catch{return null}}static getProperty(e,t){let i;if(e==null)return null;{let l;return e.__properties__?(i=e.__properties__["get_"+t],l=i):l=!1,l?e[i]():e[t]}}static setProperty(e,t,i){let l,n;e.__properties__?(l=e.__properties__["set_"+t],n=l):n=!1,n?e[l](i):e[t]=i}static fields(e){let t=[];if(e!=null){let l=Object.prototype.hasOwnProperty;for(var i in e)i!="__id__"&&i!="hx__closures__"&&l.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,l=t.call(i);return e(l)}}}j.Reflect=We,We.__name__="Reflect";class ne{static string(e){return te.__string_rec(e,"")}static parseInt(e){let t=parseInt(e);return isNaN(t)?null:t}}j.Std=ne,ne.__name__="Std";class Xt{constructor(){this.b=""}}j.StringBuf=Xt,Xt.__name__="StringBuf",Object.assign(Xt.prototype,{__class__:Xt});class Ae{static htmlEscape(e,t){let i="",l=0,n=e;for(;l<n.length;){let s=n,r=l++,h=s.charCodeAt(r);h>=55296&&h<=56319&&(h=h-55232<<10|s.charCodeAt(r+1)&1023);let a=h;a>=65536&&++l;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=p.cca(e,t);return i>8&&i<14?!0:i==32}static ltrim(e){let t=e.length,i=0;for(;i<t&&Ae.isSpace(e,i);)++i;return i>0?p.substr(e,i,t-i):e}static rtrim(e){let t=e.length,i=0;for(;i<t&&Ae.isSpace(e,t-i-1);)++i;return i>0?p.substr(e,0,t-i):e}static trim(e){return Ae.ltrim(Ae.rtrim(e))}static replace(e,t,i){return e.split(t).join(i)}}j.StringTools=Ae,Ae.__name__="StringTools";var vt=Qe.ValueType={__ename__:"ValueType",__constructs__:null,TNull:{_hx_name:"TNull",_hx_index:0,__enum__:"ValueType",toString:S},TInt:{_hx_name:"TInt",_hx_index:1,__enum__:"ValueType",toString:S},TFloat:{_hx_name:"TFloat",_hx_index:2,__enum__:"ValueType",toString:S},TBool:{_hx_name:"TBool",_hx_index:3,__enum__:"ValueType",toString:S},TObject:{_hx_name:"TObject",_hx_index:4,__enum__:"ValueType",toString:S},TFunction:{_hx_name:"TFunction",_hx_index:5,__enum__:"ValueType",toString:S},TClass:(d=function(k){return{_hx_index:6,c:k,__enum__:"ValueType",toString:S}},d._hx_name="TClass",d.__params__=["c"],d),TEnum:(d=function(k){return{_hx_index:7,e:k,__enum__:"ValueType",toString:S}},d._hx_name="TEnum",d.__params__=["e"],d),TUnknown:{_hx_name:"TUnknown",_hx_index:8,__enum__:"ValueType",toString:S}};vt.__constructs__=[vt.TNull,vt.TInt,vt.TFloat,vt.TBool,vt.TObject,vt.TFunction,vt.TClass,vt.TEnum,vt.TUnknown];class pe{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 vt.TBool;case"function":return e.__name__||e.__ename__?vt.TObject:vt.TFunction;case"number":return Math.ceil(e)==e%2147483648?vt.TInt:vt.TFloat;case"object":if(e==null)return vt.TNull;let t=e.__enum__;if(t!=null)return vt.TEnum(Qe[t]);let i=te.getClass(e);return i!=null?vt.TClass(i):vt.TObject;case"string":return vt.TClass(String);case"undefined":return vt.TNull;default:return vt.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=Qe[i].__constructs__[e._hx_index].__params__,s=0;for(;s<n.length;){let r=n[s];if(++s,!pe.enumEq(e[r],t[r]))return!1}}catch{return!1}return!0}static enumParameters(e){let i=Qe[e.__enum__].__constructs__[e._hx_index].__params__;if(i!=null){let l=[],n=0;for(;n<i.length;){let s=i[n];++n,l.push(e[s])}return l}else return[]}}j.Type=pe,pe.__name__="Type";class Ie{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 Z{constructor(e){this.nodeType=e,this.children=[],this.attributeMap=new Ee}get(e){if(this.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(this.nodeType==null?"null":Ie.toString(this.nodeType)));return this.attributeMap.h[e]}exists(e){if(this.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(this.nodeType==null?"null":Ie.toString(this.nodeType)));return Object.prototype.hasOwnProperty.call(this.attributeMap.h,e)}attributes(){if(this.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(this.nodeType==null?"null":Ie.toString(this.nodeType)));return new dl(this.attributeMap.h)}elements(){if(this.nodeType!=Z.Document&&this.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element or Document but found "+(this.nodeType==null?"null":Ie.toString(this.nodeType)));let e=[],t=0,i=this.children;for(;t<i.length;){let n=i[t];++t,n.nodeType==Z.Element&&e.push(n)}let l=e;return new Ti(l)}elementsNamed(e){if(this.nodeType!=Z.Document&&this.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element or Document but found "+(this.nodeType==null?"null":Ie.toString(this.nodeType)));let t=[],i=0,l=this.children;for(;i<l.length;){let s=l[i];++i;let r;if(s.nodeType==Z.Element){if(s.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(s.nodeType==null?"null":Ie.toString(s.nodeType)));r=s.nodeName==e}else r=!1;r&&t.push(s)}let n=t;return new Ti(n)}firstElement(){if(this.nodeType!=Z.Document&&this.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element or Document but found "+(this.nodeType==null?"null":Ie.toString(this.nodeType)));let e=0,t=this.children;for(;e<t.length;){let i=t[e];if(++e,i.nodeType==Z.Element)return i}return null}toString(){return el.print(this)}}j.Xml=Z,Z.__name__="Xml",Object.assign(Z.prototype,{__class__:Z});var bi=Qe["haxe.StackItem"]={__ename__:"haxe.StackItem",__constructs__:null,CFunction:{_hx_name:"CFunction",_hx_index:0,__enum__:"haxe.StackItem",toString:S},Module:(d=function(k){return{_hx_index:1,m:k,__enum__:"haxe.StackItem",toString:S}},d._hx_name="Module",d.__params__=["m"],d),FilePos:(d=function(k,e,t,i){return{_hx_index:2,s:k,file:e,line:t,column:i,__enum__:"haxe.StackItem",toString:S}},d._hx_name="FilePos",d.__params__=["s","file","line","column"],d),Method:(d=function(k,e){return{_hx_index:3,classname:k,method:e,__enum__:"haxe.StackItem",toString:S}},d._hx_name="Method",d.__params__=["classname","method"],d),LocalFunction:(d=function(k){return{_hx_index:4,v:k,__enum__:"haxe.StackItem",toString:S}},d._hx_name="LocalFunction",d.__params__=["v"],d)};bi.__constructs__=[bi.CFunction,bi.Module,bi.FilePos,bi.Method,bi.LocalFunction];class gn{static callStack(){return Ci.toHaxe(Ci.callStack())}}class kt{}j["haxe.IMap"]=kt,kt.__name__="haxe.IMap",kt.__isInterface__=!0,Object.assign(kt.prototype,{__class__:kt});class b 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 b?e:e instanceof Error?new b(e.message,null,e):new hl(e,null,e)}static thrown(e){return e instanceof b?e.get_native():e instanceof Error?e:new hl(e)}}j["haxe.Exception"]=b,b.__name__="haxe.Exception",b.__super__=Error,Object.assign(b.prototype,{__class__:b,__properties__:{get_native:"get_native"}});class Di{constructor(e,t){this.high=e,this.low=t}}j["haxe._Int64.___Int64"]=Di,Di.__name__="haxe._Int64.___Int64",Object.assign(Di.prototype,{__class__:Di});class Il{static formatOutput(e,t){let i=ne.string(e);if(t==null)return i;let l=t.fileName+":"+t.lineNumber;if(t.customParams!=null){let n=0,s=t.customParams;for(;n<s.length;){let r=s[n];++n,i+=", "+ne.string(r)}}return l+": "+i}static trace(e,t){let i=Il.formatOutput(e,t);typeof console<"u"&&console.log!=null&&console.log(i)}}j["haxe.Log"]=Il,Il.__name__="haxe.Log";class Ci{static callStack(){let e=new Error(""),t=Ci.tryHaxeStack(e);if(typeof t>"u"){try{throw e}catch{}t=e.stack}return Ci.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 l=[],n=0,s=i.length;for(;n<s;){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 u=o.pop(),c=a[2],_=ne.parseInt(a[3]),f=ne.parseInt(a[4]);l.push(bi.FilePos(u=="Anonymous function"?bi.LocalFunction():u=="Global code"?null:bi.Method(o.join("."),u),c,_,f))}else l.push(bi.Module(Ae.trim(h)))}return l}else return t>0&&Array.isArray(e)?e.slice(t):e}static tryHaxeStack(e){if(e==null)return[];let t=Error.prepareStackTrace;Error.prepareStackTrace=Ci.prepareHxStackTrace;let i=e.stack;return Error.prepareStackTrace=t,i}static prepareHxStackTrace(e,t){let i=[],l=0;for(;l<t.length;){let n=t[l];++l,Ci.wrapCallSite!=null&&(n=Ci.wrapCallSite(n));let s=null,r=n.getFunctionName();if(r!=null){let o=r.lastIndexOf(".");if(o>=0){let u=r.substring(0,o),c=r.substring(o+1);s=bi.Method(u,c)}else s=bi.Method(null,r)}let h=n.getFileName(),a=h==null?-1:h.indexOf("file:");Ci.wrapCallSite!=null&&a>0&&(h=h.substring(a+6)),i.push(bi.FilePos(s,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
1
+ "use strict";let Xl={},Bn={};(function(Yi,Zl){"use strict";Yi.loreline=Yi.loreline||{};var j={},S=function(){return te.__string_rec(this,"")},Qe=Qe||{},d;class p{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()}}j.HxOverrides=p,p.__name__="HxOverrides";class Ol{constructor(e,t){this.min=e,this.max=t}hasNext(){return this.min<this.max}next(){return this.min++}}j.IntIterator=Ol,Ol.__name__="IntIterator",Object.assign(Ol.prototype,{__class__:Ol});class tn{static exists(e,t){let i=fn(e);for(;i.hasNext();){let l=i.next();if(t(l))return!0}return!1}}j.Lambda=tn,tn.__name__="Lambda",Math.__name__="Math";class We{static field(e,t){try{return e[t]}catch{return null}}static getProperty(e,t){let i;if(e==null)return null;{let l;return e.__properties__?(i=e.__properties__["get_"+t],l=i):l=!1,l?e[i]():e[t]}}static setProperty(e,t,i){let l,n;e.__properties__?(l=e.__properties__["set_"+t],n=l):n=!1,n?e[l](i):e[t]=i}static fields(e){let t=[];if(e!=null){let l=Object.prototype.hasOwnProperty;for(var i in e)i!="__id__"&&i!="hx__closures__"&&l.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,l=t.call(i);return e(l)}}}j.Reflect=We,We.__name__="Reflect";class le{static string(e){return te.__string_rec(e,"")}static parseInt(e){let t=parseInt(e);return isNaN(t)?null:t}}j.Std=le,le.__name__="Std";class Xt{constructor(){this.b=""}}j.StringBuf=Xt,Xt.__name__="StringBuf",Object.assign(Xt.prototype,{__class__:Xt});class Ae{static htmlEscape(e,t){let i="",l=0,n=e;for(;l<n.length;){let s=n,r=l++,h=s.charCodeAt(r);h>=55296&&h<=56319&&(h=h-55232<<10|s.charCodeAt(r+1)&1023);let a=h;a>=65536&&++l;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=p.cca(e,t);return i>8&&i<14?!0:i==32}static ltrim(e){let t=e.length,i=0;for(;i<t&&Ae.isSpace(e,i);)++i;return i>0?p.substr(e,i,t-i):e}static rtrim(e){let t=e.length,i=0;for(;i<t&&Ae.isSpace(e,t-i-1);)++i;return i>0?p.substr(e,0,t-i):e}static trim(e){return Ae.ltrim(Ae.rtrim(e))}static replace(e,t,i){return e.split(t).join(i)}}j.StringTools=Ae,Ae.__name__="StringTools";var vt=Qe.ValueType={__ename__:"ValueType",__constructs__:null,TNull:{_hx_name:"TNull",_hx_index:0,__enum__:"ValueType",toString:S},TInt:{_hx_name:"TInt",_hx_index:1,__enum__:"ValueType",toString:S},TFloat:{_hx_name:"TFloat",_hx_index:2,__enum__:"ValueType",toString:S},TBool:{_hx_name:"TBool",_hx_index:3,__enum__:"ValueType",toString:S},TObject:{_hx_name:"TObject",_hx_index:4,__enum__:"ValueType",toString:S},TFunction:{_hx_name:"TFunction",_hx_index:5,__enum__:"ValueType",toString:S},TClass:(d=function(k){return{_hx_index:6,c:k,__enum__:"ValueType",toString:S}},d._hx_name="TClass",d.__params__=["c"],d),TEnum:(d=function(k){return{_hx_index:7,e:k,__enum__:"ValueType",toString:S}},d._hx_name="TEnum",d.__params__=["e"],d),TUnknown:{_hx_name:"TUnknown",_hx_index:8,__enum__:"ValueType",toString:S}};vt.__constructs__=[vt.TNull,vt.TInt,vt.TFloat,vt.TBool,vt.TObject,vt.TFunction,vt.TClass,vt.TEnum,vt.TUnknown];class pe{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 vt.TBool;case"function":return e.__name__||e.__ename__?vt.TObject:vt.TFunction;case"number":return Math.ceil(e)==e%2147483648?vt.TInt:vt.TFloat;case"object":if(e==null)return vt.TNull;let t=e.__enum__;if(t!=null)return vt.TEnum(Qe[t]);let i=te.getClass(e);return i!=null?vt.TClass(i):vt.TObject;case"string":return vt.TClass(String);case"undefined":return vt.TNull;default:return vt.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=Qe[i].__constructs__[e._hx_index].__params__,s=0;for(;s<n.length;){let r=n[s];if(++s,!pe.enumEq(e[r],t[r]))return!1}}catch{return!1}return!0}static enumParameters(e){let i=Qe[e.__enum__].__constructs__[e._hx_index].__params__;if(i!=null){let l=[],n=0;for(;n<i.length;){let s=i[n];++n,l.push(e[s])}return l}else return[]}}j.Type=pe,pe.__name__="Type";class Ie{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 Z{constructor(e){this.nodeType=e,this.children=[],this.attributeMap=new Ee}get(e){if(this.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(this.nodeType==null?"null":Ie.toString(this.nodeType)));return this.attributeMap.h[e]}exists(e){if(this.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(this.nodeType==null?"null":Ie.toString(this.nodeType)));return Object.prototype.hasOwnProperty.call(this.attributeMap.h,e)}attributes(){if(this.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(this.nodeType==null?"null":Ie.toString(this.nodeType)));return new dl(this.attributeMap.h)}elements(){if(this.nodeType!=Z.Document&&this.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element or Document but found "+(this.nodeType==null?"null":Ie.toString(this.nodeType)));let e=[],t=0,i=this.children;for(;t<i.length;){let n=i[t];++t,n.nodeType==Z.Element&&e.push(n)}let l=e;return new Ti(l)}elementsNamed(e){if(this.nodeType!=Z.Document&&this.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element or Document but found "+(this.nodeType==null?"null":Ie.toString(this.nodeType)));let t=[],i=0,l=this.children;for(;i<l.length;){let s=l[i];++i;let r;if(s.nodeType==Z.Element){if(s.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(s.nodeType==null?"null":Ie.toString(s.nodeType)));r=s.nodeName==e}else r=!1;r&&t.push(s)}let n=t;return new Ti(n)}firstElement(){if(this.nodeType!=Z.Document&&this.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element or Document but found "+(this.nodeType==null?"null":Ie.toString(this.nodeType)));let e=0,t=this.children;for(;e<t.length;){let i=t[e];if(++e,i.nodeType==Z.Element)return i}return null}toString(){return el.print(this)}}j.Xml=Z,Z.__name__="Xml",Object.assign(Z.prototype,{__class__:Z});var bi=Qe["haxe.StackItem"]={__ename__:"haxe.StackItem",__constructs__:null,CFunction:{_hx_name:"CFunction",_hx_index:0,__enum__:"haxe.StackItem",toString:S},Module:(d=function(k){return{_hx_index:1,m:k,__enum__:"haxe.StackItem",toString:S}},d._hx_name="Module",d.__params__=["m"],d),FilePos:(d=function(k,e,t,i){return{_hx_index:2,s:k,file:e,line:t,column:i,__enum__:"haxe.StackItem",toString:S}},d._hx_name="FilePos",d.__params__=["s","file","line","column"],d),Method:(d=function(k,e){return{_hx_index:3,classname:k,method:e,__enum__:"haxe.StackItem",toString:S}},d._hx_name="Method",d.__params__=["classname","method"],d),LocalFunction:(d=function(k){return{_hx_index:4,v:k,__enum__:"haxe.StackItem",toString:S}},d._hx_name="LocalFunction",d.__params__=["v"],d)};bi.__constructs__=[bi.CFunction,bi.Module,bi.FilePos,bi.Method,bi.LocalFunction];class gn{static callStack(){return Ci.toHaxe(Ci.callStack())}}class kt{}j["haxe.IMap"]=kt,kt.__name__="haxe.IMap",kt.__isInterface__=!0,Object.assign(kt.prototype,{__class__:kt});class b 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 b?e:e instanceof Error?new b(e.message,null,e):new hl(e,null,e)}static thrown(e){return e instanceof b?e.get_native():e instanceof Error?e:new hl(e)}}j["haxe.Exception"]=b,b.__name__="haxe.Exception",b.__super__=Error,Object.assign(b.prototype,{__class__:b,__properties__:{get_native:"get_native"}});class Di{constructor(e,t){this.high=e,this.low=t}}j["haxe._Int64.___Int64"]=Di,Di.__name__="haxe._Int64.___Int64",Object.assign(Di.prototype,{__class__:Di});class Il{static formatOutput(e,t){let i=le.string(e);if(t==null)return i;let l=t.fileName+":"+t.lineNumber;if(t.customParams!=null){let n=0,s=t.customParams;for(;n<s.length;){let r=s[n];++n,i+=", "+le.string(r)}}return l+": "+i}static trace(e,t){let i=Il.formatOutput(e,t);typeof console<"u"&&console.log!=null&&console.log(i)}}j["haxe.Log"]=Il,Il.__name__="haxe.Log";class Ci{static callStack(){let e=new Error(""),t=Ci.tryHaxeStack(e);if(typeof t>"u"){try{throw e}catch{}t=e.stack}return Ci.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 l=[],n=0,s=i.length;for(;n<s;){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 u=o.pop(),c=a[2],_=le.parseInt(a[3]),f=le.parseInt(a[4]);l.push(bi.FilePos(u=="Anonymous function"?bi.LocalFunction():u=="Global code"?null:bi.Method(o.join("."),u),c,_,f))}else l.push(bi.Module(Ae.trim(h)))}return l}else return t>0&&Array.isArray(e)?e.slice(t):e}static tryHaxeStack(e){if(e==null)return[];let t=Error.prepareStackTrace;Error.prepareStackTrace=Ci.prepareHxStackTrace;let i=e.stack;return Error.prepareStackTrace=t,i}static prepareHxStackTrace(e,t){let i=[],l=0;for(;l<t.length;){let n=t[l];++l,Ci.wrapCallSite!=null&&(n=Ci.wrapCallSite(n));let s=null,r=n.getFunctionName();if(r!=null){let o=r.lastIndexOf(".");if(o>=0){let u=r.substring(0,o),c=r.substring(o+1);s=bi.Method(u,c)}else s=bi.Method(null,r)}let h=n.getFileName(),a=h==null?-1:h.indexOf("file:");Ci.wrapCallSite!=null&&a>0&&(h=h.substring(a+6)),i.push(bi.FilePos(s,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
3
  `:case"Error:":++t;break;default:}return Ci.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?"":Ci.skipLines(e,--t,i+1)):e.substring(i)}}j["haxe.NativeStackTrace"]=Ci,Ci.__name__="haxe.NativeStackTrace";class rl{constructor(e){let t=this;this.id=setInterval(function(){t.run()},e)}stop(){this.id!=null&&(clearInterval(this.id),this.id=null)}run(){}static delay(e,t){let i=new rl(t);return i.run=function(){i.stop(),e()},i}}j["haxe.Timer"]=rl,rl.__name__="haxe.Timer",Object.assign(rl.prototype,{__class__:rl});class hl extends b{constructor(e,t,i){super(String(e),t,i),this.value=e}unwrap(){return this.value}}j["haxe.ValueException"]=hl,hl.__name__="haxe.ValueException",hl.__super__=b,Object.assign(hl.prototype,{__class__:hl});class al{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 Ti(e)}setLoop(e,t,i){if(i==null)return new Zt(null,e,t,null);let l=this.compare(e,i.key);if(l==0)return new Zt(i.left,e,t,i.right,i==null?0:i._height);if(l<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,l){let n=e==null?0:e._height,s=l==null?0:l._height;if(n>s+2){let r=e.left,h=e.right;return(r==null?0:r._height)>=(h==null?0:h._height)?new Zt(e.left,e.key,e.value,new Zt(e.right,t,i,l)):new Zt(new Zt(e.left,e.key,e.value,e.right.left),e.right.key,e.right.value,new Zt(e.right.right,t,i,l))}else if(s>n+2){let r=l.right,h=l.left;return(r==null?0:r._height)>(h==null?0:h._height)?new Zt(new Zt(e,t,i,l.left),l.key,l.value,l.right):new Zt(new Zt(e,t,i,l.left.left),l.left.key,l.left.value,new Zt(l.left.right,l.key,l.value,l.right))}else return new Zt(e,t,i,l,(n>s?n:s)+1)}compare(e,t){return We.compare(e,t)}}j["haxe.ds.BalancedTree"]=al,al.__name__="haxe.ds.BalancedTree",al.__interfaces__=[kt],Object.assign(al.prototype,{__class__:al});class Zt{constructor(e,t,i,l,n){if(n==null&&(n=-1),this.left=e,this.key=t,this.value=i,this.right=l,n==-1){let s,r=this.left,h=this.right;if((r==null?0:r._height)>(h==null?0:h._height)){let a=this.left;s=a==null?0:a._height}else{let a=this.right;s=a==null?0:a._height}this._height=s+1}else this._height=n}}j["haxe.ds.TreeNode"]=Zt,Zt.__name__="haxe.ds.TreeNode",Object.assign(Zt.prototype,{__class__:Zt});class Xi extends al{constructor(){super()}compare(e,t){let i=e._hx_index-t._hx_index;if(i!=0)return i;let l=pe.enumParameters(e),n=pe.enumParameters(t);return l.length==0&&n.length==0?0:this.compareArgs(l,n)}compareArgs(e,t){let i=e.length-t.length;if(i!=0)return i;let l=0,n=e.length;for(;l<n;){let s=l++,r=this.compareArg(e[s],t[s]);if(r!=0)return r}return 0}compareArg(e,t){return We.isEnumValue(e)&&We.isEnumValue(t)?this.compare(e,t):e instanceof Array&&t instanceof Array?this.compareArgs(e,t):We.compare(e,t)}}j["haxe.ds.EnumValueMap"]=Xi,Xi.__name__="haxe.ds.EnumValueMap",Xi.__interfaces__=[kt],Xi.__super__=al,Object.assign(Xi.prototype,{__class__:Xi});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 Ti(e)}}j["haxe.ds.IntMap"]=Ri,Ri.__name__="haxe.ds.IntMap",Ri.__interfaces__=[kt],Object.assign(Ri.prototype,{__class__:Ri});class Pl{constructor(){this.length=0}add(e){let t=new ml(e,null);this.h==null?this.h=t:this.q.next=t,this.q=t,this.length++}push(e){let t=new ml(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}}j["haxe.ds.List"]=Pl,Pl.__name__="haxe.ds.List",Object.assign(Pl.prototype,{__class__:Pl});class ml{constructor(e,t){this.item=e,this.next=t}}j["haxe.ds._List.ListNode"]=ml,ml.__name__="haxe.ds._List.ListNode",Object.assign(ml.prototype,{__class__:ml});class gl{constructor(){this.h={__keys__:{}}}set(e,t){let i=e.__id__;i==null&&(i=e.__id__=Zl.$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 Ti(e)}}j["haxe.ds.ObjectMap"]=gl,gl.__name__="haxe.ds.ObjectMap",gl.__interfaces__=[kt],Object.assign(gl.prototype,{__class__:gl});class Ee{constructor(){this.h=Object.create(null)}get(e){return this.h[e]}set(e,t){this.h[e]=t}keys(){return new dl(this.h)}}j["haxe.ds.StringMap"]=Ee,Ee.__name__="haxe.ds.StringMap",Ee.__interfaces__=[kt],Object.assign(Ee.prototype,{__class__:Ee});class dl{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++]}}j["haxe.ds._StringMap.StringMapKeyIterator"]=dl,dl.__name__="haxe.ds._StringMap.StringMapKeyIterator",Object.assign(dl.prototype,{__class__:dl});class ln{static blit(e,t,i,l,n){if(e==i){if(t<l){let s=t+n,r=l+n,h=0,a=n;for(;h<a;){let o=h++;--s,--r,e[r]=e[s]}}else if(t>l){let s=t,r=l,h=0,a=n;for(;h<a;){let o=h++;e[r]=e[s],++s,++r}}}else{let s=0,r=n;for(;s<r;){let h=s++;i[l+h]=e[t+h]}}}}class Nt{constructor(e){switch(e){case".":case"..":this.dir=e,this.file="";return}let t=e.lastIndexOf("/"),i=e.lastIndexOf("\\");t<i?(this.dir=p.substr(e,0,i),e=p.substr(e,i+1,null),this.backslash=!0):i<t?(this.dir=p.substr(e,0,t),e=p.substr(e,t+1,null)):this.dir=null;let l=e.lastIndexOf(".");l!=-1?(this.ext=p.substr(e,l+1,null),this.file=p.substr(e,0,l)):(this.ext=null,this.file=e)}static directory(e){let t=new Nt(e);return t.dir==null?"":t.dir}static join(e){let t=[],i=0,l=e;for(;i<l.length;){let a=l[i];++i,a!=null&&a!=""&&t.push(a)}let n=t;if(n.length==0)return"";let s=n[0],r=1,h=n.length;for(;r<h;){let a=r++;s=Nt.addTrailingSlash(s),s+=n[a]}return Nt.normalize(s)}static normalize(e){let t="/";if(e=e.split("\\").join(t),e==t)return t;let i=[],l=0,n=e.split(t);for(;l<n.length;){let c=n[l];++l,c==".."&&i.length>0&&i[i.length-1]!=".."?i.pop():c==""?(i.length>0||p.cca(e,0)==47)&&i.push(c):c!="."&&i.push(c)}let s=i.join(t),r="",h=!1,a=!1,o=0,u=s;for(;o<u.length;){let c=u,_=o++,f=c.charCodeAt(_);f>=55296&&f<=56319&&(f=f-55232<<10|c.charCodeAt(_+1)&1023);let m=f;m>=65536&&++o;let g=m;switch(g){case 47:if(!h)a=!0;else{let y=g;h=!1,a&&(r+="/",a=!1),r+=String.fromCodePoint(y)}break;case 58:r+=":",h=!0;break;default:let w=g;h=!1,a&&(r+="/",a=!1),r+=String.fromCodePoint(w)}}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("\\\\"))}}j["haxe.io.Path"]=Nt,Nt.__name__="haxe.io.Path",Object.assign(Nt.prototype,{__class__:Nt});class Ti{constructor(e){this.current=0,this.array=e}hasNext(){return this.current<this.array.length}next(){return this.array[this.current++]}}j["haxe.iterators.ArrayIterator"]=Ti,Ti.__name__="haxe.iterators.ArrayIterator",Object.assign(Ti.prototype,{__class__:Ti});var Gt=Qe["haxe.rtti.CType"]={__ename__:"haxe.rtti.CType",__constructs__:null,CUnknown:{_hx_name:"CUnknown",_hx_index:0,__enum__:"haxe.rtti.CType",toString:S},CEnum:(d=function(k,e){return{_hx_index:1,name:k,params:e,__enum__:"haxe.rtti.CType",toString:S}},d._hx_name="CEnum",d.__params__=["name","params"],d),CClass:(d=function(k,e){return{_hx_index:2,name:k,params:e,__enum__:"haxe.rtti.CType",toString:S}},d._hx_name="CClass",d.__params__=["name","params"],d),CTypedef:(d=function(k,e){return{_hx_index:3,name:k,params:e,__enum__:"haxe.rtti.CType",toString:S}},d._hx_name="CTypedef",d.__params__=["name","params"],d),CFunction:(d=function(k,e){return{_hx_index:4,args:k,ret:e,__enum__:"haxe.rtti.CType",toString:S}},d._hx_name="CFunction",d.__params__=["args","ret"],d),CAnonymous:(d=function(k){return{_hx_index:5,fields:k,__enum__:"haxe.rtti.CType",toString:S}},d._hx_name="CAnonymous",d.__params__=["fields"],d),CDynamic:(d=function(k){return{_hx_index:6,t:k,__enum__:"haxe.rtti.CType",toString:S}},d._hx_name="CDynamic",d.__params__=["t"],d),CAbstract:(d=function(k,e){return{_hx_index:7,name:k,params:e,__enum__:"haxe.rtti.CType",toString:S}},d._hx_name="CAbstract",d.__params__=["name","params"],d)};Gt.__constructs__=[Gt.CUnknown,Gt.CEnum,Gt.CClass,Gt.CTypedef,Gt.CFunction,Gt.CAnonymous,Gt.CDynamic,Gt.CAbstract];var Dt=Qe["haxe.rtti.Rights"]={__ename__:"haxe.rtti.Rights",__constructs__:null,RNormal:{_hx_name:"RNormal",_hx_index:0,__enum__:"haxe.rtti.Rights",toString:S},RNo:{_hx_name:"RNo",_hx_index:1,__enum__:"haxe.rtti.Rights",toString:S},RCall:(d=function(k){return{_hx_index:2,m:k,__enum__:"haxe.rtti.Rights",toString:S}},d._hx_name="RCall",d.__params__=["m"],d),RMethod:{_hx_name:"RMethod",_hx_index:3,__enum__:"haxe.rtti.Rights",toString:S},RDynamic:{_hx_name:"RDynamic",_hx_index:4,__enum__:"haxe.rtti.Rights",toString:S},RInline:{_hx_name:"RInline",_hx_index:5,__enum__:"haxe.rtti.Rights",toString:S}};Dt.__constructs__=[Dt.RNormal,Dt.RNo,Dt.RCall,Dt.RMethod,Dt.RDynamic,Dt.RInline];var Vi=Qe["haxe.rtti.TypeTree"]={__ename__:"haxe.rtti.TypeTree",__constructs__:null,TPackage:(d=function(k,e,t){return{_hx_index:0,name:k,full:e,subs:t,__enum__:"haxe.rtti.TypeTree",toString:S}},d._hx_name="TPackage",d.__params__=["name","full","subs"],d),TClassdecl:(d=function(k){return{_hx_index:1,c:k,__enum__:"haxe.rtti.TypeTree",toString:S}},d._hx_name="TClassdecl",d.__params__=["c"],d),TEnumdecl:(d=function(k){return{_hx_index:2,e:k,__enum__:"haxe.rtti.TypeTree",toString:S}},d._hx_name="TEnumdecl",d.__params__=["e"],d),TTypedecl:(d=function(k){return{_hx_index:3,t:k,__enum__:"haxe.rtti.TypeTree",toString:S}},d._hx_name="TTypedecl",d.__params__=["t"],d),TAbstractdecl:(d=function(k){return{_hx_index:4,a:k,__enum__:"haxe.rtti.TypeTree",toString:S}},d._hx_name="TAbstractdecl",d.__params__=["a"],d)};Vi.__constructs__=[Vi.TPackage,Vi.TClassdecl,Vi.TEnumdecl,Vi.TTypedecl,Vi.TAbstractdecl];class st{static typeInfos(e){let t;switch(e._hx_index){case 0:let i=e.name,l=e.full,n=e.subs;throw b.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 l=0,n=i,s=0;for(;s<t.length;){let r=t[s];if(++s,l>=n.length)return!1;let h=n[l++];if(!e(r,h))return!1}return!(l<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 l=t.m;return i==l}}return!1}static typeEq(e,t){switch(e._hx_index){case 0:return t==Gt.CUnknown;case 1:let i=e.name,l=e.params;if(t._hx_index==1){let m=t.name,g=t.params;return i==m?st.leq(st.typeEq,l,g):!1}break;case 2:let n=e.name,s=e.params;if(t._hx_index==2){let m=t.name,g=t.params;return n==m?st.leq(st.typeEq,s,g):!1}break;case 3:let r=e.name,h=e.params;if(t._hx_index==3){let m=t.name,g=t.params;return r==m?st.leq(st.typeEq,h,g):!1}break;case 4:let a=e.args,o=e.ret;if(t._hx_index==4){let m=t.args,g=t.ret;return st.leq(function(w,y){return w.name==y.name&&w.opt==y.opt?st.typeEq(w.t,y.t):!1},a,m)?st.typeEq(o,g):!1}break;case 5:let u=e.fields;if(t._hx_index==5){let m=t.fields;return st.leq(function(g,w){return st.fieldEq(g,w)},u,m)}break;case 6:let c=e.t;if(t._hx_index==6){let m=t.t;return c==null!=(m==null)?!1:c!=null?st.typeEq(c,m):!0}break;case 7:let _=e.name,f=e.params;if(t._hx_index==7){let m=t.name,g=t.params;return _==m?st.leq(st.typeEq,f,g):!1}break}return!1}static fieldEq(e,t){return!(e.name!=t.name||!st.typeEq(e.type,t.type)||e.isPublic!=t.isPublic||e.doc!=t.doc||!st.rightsEq(e.get,t.get)||!st.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&&!st.leq(function(i,l){return i.name==l.name&&i.opt==l.opt?st.typeEq(i.t,l.t):!1},e.args,t.args))}}j["haxe.rtti.TypeApi"]=st,st.__name__="haxe.rtti.TypeApi";class Nl{constructor(){this.root=[]}process(e,t){if(this.curplatform=t,e.nodeType!=Z.Document&&e.nodeType!=Z.Element)throw b.thrown("Invalid nodeType "+(e.nodeType==null?"null":Ie.toString(e.nodeType)));this.xroot(e)}mergeRights(e,t){return e.get==Dt.RInline&&e.set==Dt.RNo&&t.get==Dt.RNormal&&t.set==Dt.RMethod?(e.get=Dt.RNormal,e.set=Dt.RMethod,!0):pe.enumEq(e.get,t.get)?pe.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 st.fieldEq(e,t)?!0:e.name==t.name&&(this.mergeRights(e,t)||this.mergeRights(t,e))&&this.mergeDoc(e,t)?st.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,l=t.fields;for(;i<l.length;){let r=l[i];++i;let h=null,a=0,o=e.fields;for(;a<o.length;){let u=o[a];if(++a,this.mergeFields(u,r)){h=u;break}}h==null?(this.newField(e,r),e.fields.push(r)):this.curplatform!=null&&h.platforms.push(this.curplatform)}let n=0,s=t.statics;for(;n<s.length;){let r=s[n];++n;let h=null,a=0,o=e.statics;for(;a<o.length;){let u=o[a];if(++a,this.mergeFields(u,r)){h=u;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,l=t.constructors;for(;i<l.length;){let n=l[i];++i;let s=null,r=0,h=e.constructors;for(;r<h.length;){let a=h[r];if(++r,st.constructorEq(a,n)){s=a;break}}s==null?e.constructors.push(n):this.curplatform!=null&&s.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,l=e.to.length;for(;i<l;){let r=i++;if(!st.typeEq(e.to[r].t,t.to[r].t))return!1}let n=0,s=e.from.length;for(;n<s;){let r=n++;if(!st.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=st.typeInfos(e),i=t.path.split("."),l=this.root,n=[];i.pop();let s=0;for(;s<i.length;){let h=i[s];++s;let a=!1,o=0;for(;o<l.length;){let u=l[o];if(++o,u._hx_index==0){let c=u.full,_=u.name,f=u.subs;if(_==h){a=!0,l=f;break}}}if(n.push(h),!a){let u=[];l.push(Vi.TPackage(h,n.join("."),u)),l=u}}let r=0;for(;r<l.length;){let h=l[r];++r;let a;if(h._hx_index==0){let u=h.name,c=h.full,_=h.subs;a=!0}else a=!1;if(a)continue;let o=st.typeInfos(h);if(o.path==t.path){let u=!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 _=h.name,f=h.full,m=h.subs;u=!1;break;case 1:let g=h.c;if(e._hx_index==1){let E=e.c;if(this.mergeClasses(g,E))return}else u=!1;break;case 2:let w=h.e;if(e._hx_index==2){let E=e.e;if(this.mergeEnums(w,E))return}else u=!1;break;case 3:let y=h.t;if(e._hx_index==3){let E=e.t;if(this.mergeTypedefs(y,E))return}break;case 4:let T=h.a;if(e._hx_index==4){let E=e.a;if(this.mergeAbstracts(T,E))return}else u=!1;break}let c=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":u?"could not merge definition":"type kind is different";throw b.thrown("Incompatibilities between "+o.path+" in "+o.platforms.join(",")+" and "+this.curplatform+" ("+c+")")}}l.push(e)}mkPath(e){return e}mkTypeParams(e){let t=e.split(":");return t[0]==""?[]:t}mkRights(e){switch(e){case"dynamic":return Dt.RDynamic;case"inline":return Dt.RInline;case"method":return Dt.RMethod;case"null":return Dt.RNo;default:return Dt.RCall(e)}}xerror(e){let t;if(e.nodeType==Z.Document)t="Document";else{if(e.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":Ie.toString(e.nodeType)));t=e.nodeName}throw b.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!=Z.Document&&e.nodeType!=Z.Element)throw b.thrown("Invalid nodeType "+(e.nodeType==null?"null":Ie.toString(e.nodeType)));let t=e,i;if(t.nodeType==Z.Document)i="Document";else{if(t.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(t.nodeType==null?"null":Ie.toString(t.nodeType)));i=t.nodeName}switch(i){case"abstract":return Vi.TAbstractdecl(this.xabstract(t));case"class":return Vi.TClassdecl(this.xclass(t));case"enum":return Vi.TEnumdecl(this.xenum(t));case"typedef":return Vi.TTypedecl(this.xtypedef(t));default:return this.xerror(t)}}xmeta(e){let t=[],i=0,l=un.resolve(e,"m");for(;i<l.length;){let n=l[i];++i;let s=[],r=0,h=un.resolve(n,"e");for(;r<h.length;){let a=h[r];++r,s.push(Zi.get_innerHTML(a))}t.push({name:Xe.resolve(n,"n"),params:s})}return t}xoverloads(e){let t=[],i=e.elements();for(;i.hasNext();){let l=i.next();t.push(this.xclassfield(l))}return t}xpath(e){let t=this.mkPath(Xe.resolve(e,"path")),i=[],l=e.elements();for(;l.hasNext();){let n=l.next();i.push(this.xtype(n))}return{path:t,params:i}}xclass(e){let t=null,i=null,l=null,n=[],s=[],r=[],h=[],a=e.exists("interface"),o=e.elements();for(;o.hasNext();){let u=o.next(),c;if(u.nodeType==Z.Document)c="Document";else{if(u.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(u.nodeType==null?"null":Ie.toString(u.nodeType)));c=u.nodeName}switch(c){case"extends":a?n.push(this.xpath(u)):t=this.xpath(u);break;case"haxe_doc":i=Zi.get_innerData(u);break;case"haxe_dynamic":let _=u.firstElement();if(_.nodeType!=Z.Document&&_.nodeType!=Z.Element)throw b.thrown("Invalid nodeType "+(_.nodeType==null?"null":Ie.toString(_.nodeType)));l=this.xtype(_);break;case"implements":n.push(this.xpath(u));break;case"meta":h=this.xmeta(u);break;default:u.exists("static")?r.push(this.xclassfield(u)):s.push(this.xclassfield(u))}}return{file:ei.resolve(e,"file")?Xe.resolve(e,"file"):null,path:this.mkPath(Xe.resolve(e,"path")),module:ei.resolve(e,"module")?this.mkPath(Xe.resolve(e,"module")):null,doc:i,isPrivate:e.exists("private"),isExtern:e.exists("extern"),isFinal:e.exists("final"),isInterface:a,params:this.mkTypeParams(Xe.resolve(e,"params")),superClass:t,interfaces:n,fields:s,statics:r,tdynamic:l,platforms:this.defplat(),meta:h}}xclassfield(e,t){t==null&&(t=!1);let i=e.elements(),l=this.xtype(i.next()),n=null,s=[],r=null,h=i;for(;h.hasNext();){let o=h.next(),u;if(o.nodeType==Z.Document)u="Document";else{if(o.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(o.nodeType==null?"null":Ie.toString(o.nodeType)));u=o.nodeName}switch(u){case"haxe_doc":n=Zi.get_innerData(o);break;case"meta":s=this.xmeta(o);break;case"overloads":r=this.xoverloads(o);break;default:this.xerror(o)}}let a;if(e.nodeType==Z.Document)a="Document";else{if(e.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":Ie.toString(e.nodeType)));a=e.nodeName}return{name:a,type:l,isPublic:e.exists("public")||t,isFinal:e.exists("final"),isOverride:e.exists("override"),line:ei.resolve(e,"line")?ne.parseInt(Xe.resolve(e,"line")):null,doc:n,get:ei.resolve(e,"get")?this.mkRights(Xe.resolve(e,"get")):Dt.RNormal,set:ei.resolve(e,"set")?this.mkRights(Xe.resolve(e,"set")):Dt.RNormal,params:ei.resolve(e,"params")?this.mkTypeParams(Xe.resolve(e,"params")):[],platforms:this.defplat(),meta:s,overloads:r,expr:ei.resolve(e,"expr")?Xe.resolve(e,"expr"):null}}xenum(e){let t=[],i=null,l=[],n=e.elements();for(;n.hasNext();){let s=n.next(),r;if(s.nodeType==Z.Document)r="Document";else{if(s.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(s.nodeType==null?"null":Ie.toString(s.nodeType)));r=s.nodeName}if(r=="haxe_doc")i=Zi.get_innerData(s);else{let h;if(s.nodeType==Z.Document)h="Document";else{if(s.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(s.nodeType==null?"null":Ie.toString(s.nodeType)));h=s.nodeName}h=="meta"?l=this.xmeta(s):t.push(this.xenumfield(s))}}return{file:ei.resolve(e,"file")?Xe.resolve(e,"file"):null,path:this.mkPath(Xe.resolve(e,"path")),module:ei.resolve(e,"module")?this.mkPath(Xe.resolve(e,"module")):null,doc:i,isPrivate:e.exists("private"),isExtern:e.exists("extern"),params:this.mkTypeParams(Xe.resolve(e,"params")),constructors:t,platforms:this.defplat(),meta:l}}xenumfield(e){let t=null,i=e.elementsNamed("haxe_doc"),l=i.hasNext()?i.next():null,n=dn.resolve(e,"meta")?this.xmeta(on.resolve(e,"meta")):[];if(ei.resolve(e,"a")){let h=Xe.resolve(e,"a").split(":"),a=e.elements();t=[];let o=0;for(;o<h.length;){let u=h[o];++o;let c=!1;u.charAt(0)=="?"&&(c=!0,u=p.substr(u,1,null)),t.push({name:u,opt:c,t:this.xtype(a.next())})}}let s;if(e.nodeType==Z.Document)s="Document";else{if(e.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":Ie.toString(e.nodeType)));s=e.nodeName}let r;if(l==null)r=null;else{if(l.nodeType!=Z.Document&&l.nodeType!=Z.Element)throw b.thrown("Invalid nodeType "+(l.nodeType==null?"null":Ie.toString(l.nodeType)));r=Zi.get_innerData(l)}return{name:s,args:t,doc:r,meta:n,platforms:this.defplat()}}xabstract(e){let t=null,i=null,l=null,n=[],s=[],r=[],h=e.elements();for(;h.hasNext();){let a=h.next(),o;if(a.nodeType==Z.Document)o="Document";else{if(a.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(a.nodeType==null?"null":Ie.toString(a.nodeType)));o=a.nodeName}switch(o){case"from":let u=a.elements();for(;u.hasNext();){let f=u.next(),m=f.firstElement();if(m.nodeType!=Z.Document&&m.nodeType!=Z.Element)throw b.thrown("Invalid nodeType "+(m.nodeType==null?"null":Ie.toString(m.nodeType)));r.push({t:this.xtype(m),field:ei.resolve(f,"field")?Xe.resolve(f,"field"):null})}break;case"haxe_doc":t=Zi.get_innerData(a);break;case"impl":i=this.xclass(on.resolve(a,"class"));break;case"meta":n=this.xmeta(a);break;case"this":let c=a.firstElement();if(c.nodeType!=Z.Document&&c.nodeType!=Z.Element)throw b.thrown("Invalid nodeType "+(c.nodeType==null?"null":Ie.toString(c.nodeType)));l=this.xtype(c);break;case"to":let _=a.elements();for(;_.hasNext();){let f=_.next(),m=f.firstElement();if(m.nodeType!=Z.Document&&m.nodeType!=Z.Element)throw b.thrown("Invalid nodeType "+(m.nodeType==null?"null":Ie.toString(m.nodeType)));s.push({t:this.xtype(m),field:ei.resolve(f,"field")?Xe.resolve(f,"field"):null})}break;default:this.xerror(a)}}return{file:ei.resolve(e,"file")?Xe.resolve(e,"file"):null,path:this.mkPath(Xe.resolve(e,"path")),module:ei.resolve(e,"module")?this.mkPath(Xe.resolve(e,"module")):null,doc:t,isPrivate:e.exists("private"),params:this.mkTypeParams(Xe.resolve(e,"params")),platforms:this.defplat(),meta:n,athis:l,to:s,from:r,impl:i}}xtypedef(e){let t=null,i=null,l=[],n=e.elements();for(;n.hasNext();){let r=n.next(),h;if(r.nodeType==Z.Document)h="Document";else{if(r.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(r.nodeType==null?"null":Ie.toString(r.nodeType)));h=r.nodeName}if(h=="haxe_doc")t=Zi.get_innerData(r);else{let a;if(r.nodeType==Z.Document)a="Document";else{if(r.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(r.nodeType==null?"null":Ie.toString(r.nodeType)));a=r.nodeName}a=="meta"?l=this.xmeta(r):i=this.xtype(r)}}let s=new Ee;return this.curplatform!=null&&(s.h[this.curplatform]=i),{file:ei.resolve(e,"file")?Xe.resolve(e,"file"):null,path:this.mkPath(Xe.resolve(e,"path")),module:ei.resolve(e,"module")?this.mkPath(Xe.resolve(e,"module")):null,doc:t,isPrivate:e.exists("private"),params:this.mkTypeParams(Xe.resolve(e,"params")),type:i,types:s,platforms:this.defplat(),meta:l}}xtype(e){let t;if(e.nodeType==Z.Document)t="Document";else{if(e.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":Ie.toString(e.nodeType)));t=e.nodeName}switch(t){case"a":let i=[],l=e.elements();for(;l.hasNext();){let f=l.next(),m=this.xclassfield(f,!0);m.platforms=[],i.push(m)}return Gt.CAnonymous(i);case"c":return Gt.CClass(this.mkPath(Xe.resolve(e,"path")),this.xtypeparams(e));case"d":let n=null,s=e.firstElement();if(s!=null){if(s.nodeType!=Z.Document&&s.nodeType!=Z.Element)throw b.thrown("Invalid nodeType "+(s.nodeType==null?"null":Ie.toString(s.nodeType)));n=this.xtype(s)}return Gt.CDynamic(n);case"e":return Gt.CEnum(this.mkPath(Xe.resolve(e,"path")),this.xtypeparams(e));case"f":let r=[],h=Xe.resolve(e,"a").split(":"),a=0,o=h,u=ei.resolve(e,"v")?new Ti(Xe.resolve(e,"v").split(":")):null,c=e.elements();for(;c.hasNext();){let f=c.next(),m=!1,g=a<o.length?o[a++]:null;g==null&&(g=""),g.charAt(0)=="?"&&(m=!0,g=p.substr(g,1,null));let w=u==null||u.current>=u.array.length?null:u.array[u.current++];r.push({name:g,opt:m,t:this.xtype(f),value:w==""?null:w})}let _=r[r.length-1];return p.remove(r,_),Gt.CFunction(r,_.t);case"t":return Gt.CTypedef(this.mkPath(Xe.resolve(e,"path")),this.xtypeparams(e));case"unknown":return Gt.CUnknown;case"x":return Gt.CAbstract(this.mkPath(Xe.resolve(e,"path")),this.xtypeparams(e));default:return this.xerror(e)}}xtypeparams(e){let t=[],i=e.elements();for(;i.hasNext();){let l=i.next();t.push(this.xtype(l))}return t}defplat(){let e=[];return this.curplatform!=null&&e.push(this.curplatform),e}}j["haxe.rtti.XmlParser"]=Nl,Nl.__name__="haxe.rtti.XmlParser",Object.assign(Nl.prototype,{__class__:Nl});class on{static resolve(e,t){let i=e.elementsNamed(t).next();if(i==null){let l;if(e.nodeType==Z.Document)l="Document";else{if(e.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":Ie.toString(e.nodeType)));l=e.nodeName}throw b.thrown(l+" is missing element "+t)}if(i.nodeType!=Z.Document&&i.nodeType!=Z.Element)throw b.thrown("Invalid nodeType "+(i.nodeType==null?"null":Ie.toString(i.nodeType)));return i}}class Xe{static resolve(e,t){if(e.nodeType==Z.Document)throw b.thrown("Cannot access document attribute "+t);let i=e.get(t);if(i==null)throw e.nodeType!=Z.Element?b.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":Ie.toString(e.nodeType))):b.thrown(e.nodeName+" is missing attribute "+t);return i}}class ei{static resolve(e,t){if(e.nodeType==Z.Document)throw b.thrown("Cannot access document attribute "+t);return e.exists(t)}}class dn{static resolve(e,t){return e.elementsNamed(t).hasNext()}}class un{static resolve(e,t){let i=[],l=e.elementsNamed(t);for(;l.hasNext();){let n=l.next();if(n.nodeType!=Z.Document&&n.nodeType!=Z.Element)throw b.thrown("Invalid nodeType "+(n.nodeType==null?"null":Ie.toString(n.nodeType)));i.push(n)}return i}}class Zi{static get_innerData(e){if(e.nodeType!=Z.Document&&e.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element or Document but found "+(e.nodeType==null?"null":Ie.toString(e.nodeType)));let t=0,i=e.children;if(t>=i.length){let n;if(e.nodeType==Z.Document)n="Document";else{if(e.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":Ie.toString(e.nodeType)));n=e.nodeName}throw b.thrown(n+" does not have data")}let l=i[t++];if(t<i.length){let n=i[t++],s;if(l.nodeType==Z.PCData&&n.nodeType==Z.CData){if(l.nodeType==Z.Document||l.nodeType==Z.Element)throw b.thrown("Bad node type, unexpected "+(l.nodeType==null?"null":Ie.toString(l.nodeType)));s=Ae.trim(l.nodeValue)==""}else s=!1;if(s){if(t>=i.length){if(n.nodeType==Z.Document||n.nodeType==Z.Element)throw b.thrown("Bad node type, unexpected "+(n.nodeType==null?"null":Ie.toString(n.nodeType)));return n.nodeValue}let h=i[t++],a;if(h.nodeType==Z.PCData){if(h.nodeType==Z.Document||h.nodeType==Z.Element)throw b.thrown("Bad node type, unexpected "+(h.nodeType==null?"null":Ie.toString(h.nodeType)));a=Ae.trim(h.nodeValue)==""}else a=!1;if(a&&t>=i.length){if(n.nodeType==Z.Document||n.nodeType==Z.Element)throw b.thrown("Bad node type, unexpected "+(n.nodeType==null?"null":Ie.toString(n.nodeType)));return n.nodeValue}}let r;if(e.nodeType==Z.Document)r="Document";else{if(e.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":Ie.toString(e.nodeType)));r=e.nodeName}throw b.thrown(r+" does not only have data")}if(l.nodeType!=Z.PCData&&l.nodeType!=Z.CData){let n;if(e.nodeType==Z.Document)n="Document";else{if(e.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":Ie.toString(e.nodeType)));n=e.nodeName}throw b.thrown(n+" does not have data")}if(l.nodeType==Z.Document||l.nodeType==Z.Element)throw b.thrown("Bad node type, unexpected "+(l.nodeType==null?"null":Ie.toString(l.nodeType)));return l.nodeValue}static get_innerHTML(e){let t="";if(e.nodeType!=Z.Document&&e.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element or Document but found "+(e.nodeType==null?"null":Ie.toString(e.nodeType)));let i=0,l=e.children;for(;i<l.length;){let n=l[i++];t+=ne.string(el.print(n))}return t}}Zi.__properties__={get_innerHTML:"get_innerHTML",get_innerData:"get_innerData"};class el{constructor(e){this.output=new Xt,this.pretty=e}writeNode(e,t){switch(e.nodeType){case 0:if(this.output.b+=ne.string(t+"<"),e.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":Ie.toString(e.nodeType)));this.output.b+=ne.string(e.nodeName);let i=e.attributes();for(;i.hasNext();){let o=i.next();this.output.b+=ne.string(" "+o+'="');let u=Ae.htmlEscape(e.get(o),!0);this.output.b+=ne.string(u),this.output.b+='"'}if(this.hasChildren(e)){if(this.output.b+=">",this.pretty&&(this.output.b+=`
5
- `),e.nodeType!=Z.Document&&e.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element or Document but found "+(e.nodeType==null?"null":Ie.toString(e.nodeType)));let o=0,u=e.children;for(;o<u.length;){let c=u[o++];this.writeNode(c,this.pretty?t+" ":t)}if(this.output.b+=ne.string(t+"</"),e.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":Ie.toString(e.nodeType)));this.output.b+=ne.string(e.nodeName),this.output.b+=">",this.pretty&&(this.output.b+=`
4
+ `,i),i<0?"":Ci.skipLines(e,--t,i+1)):e.substring(i)}}j["haxe.NativeStackTrace"]=Ci,Ci.__name__="haxe.NativeStackTrace";class rl{constructor(e){let t=this;this.id=setInterval(function(){t.run()},e)}stop(){this.id!=null&&(clearInterval(this.id),this.id=null)}run(){}static delay(e,t){let i=new rl(t);return i.run=function(){i.stop(),e()},i}}j["haxe.Timer"]=rl,rl.__name__="haxe.Timer",Object.assign(rl.prototype,{__class__:rl});class hl extends b{constructor(e,t,i){super(String(e),t,i),this.value=e}unwrap(){return this.value}}j["haxe.ValueException"]=hl,hl.__name__="haxe.ValueException",hl.__super__=b,Object.assign(hl.prototype,{__class__:hl});class al{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 Ti(e)}setLoop(e,t,i){if(i==null)return new Zt(null,e,t,null);let l=this.compare(e,i.key);if(l==0)return new Zt(i.left,e,t,i.right,i==null?0:i._height);if(l<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,l){let n=e==null?0:e._height,s=l==null?0:l._height;if(n>s+2){let r=e.left,h=e.right;return(r==null?0:r._height)>=(h==null?0:h._height)?new Zt(e.left,e.key,e.value,new Zt(e.right,t,i,l)):new Zt(new Zt(e.left,e.key,e.value,e.right.left),e.right.key,e.right.value,new Zt(e.right.right,t,i,l))}else if(s>n+2){let r=l.right,h=l.left;return(r==null?0:r._height)>(h==null?0:h._height)?new Zt(new Zt(e,t,i,l.left),l.key,l.value,l.right):new Zt(new Zt(e,t,i,l.left.left),l.left.key,l.left.value,new Zt(l.left.right,l.key,l.value,l.right))}else return new Zt(e,t,i,l,(n>s?n:s)+1)}compare(e,t){return We.compare(e,t)}}j["haxe.ds.BalancedTree"]=al,al.__name__="haxe.ds.BalancedTree",al.__interfaces__=[kt],Object.assign(al.prototype,{__class__:al});class Zt{constructor(e,t,i,l,n){if(n==null&&(n=-1),this.left=e,this.key=t,this.value=i,this.right=l,n==-1){let s,r=this.left,h=this.right;if((r==null?0:r._height)>(h==null?0:h._height)){let a=this.left;s=a==null?0:a._height}else{let a=this.right;s=a==null?0:a._height}this._height=s+1}else this._height=n}}j["haxe.ds.TreeNode"]=Zt,Zt.__name__="haxe.ds.TreeNode",Object.assign(Zt.prototype,{__class__:Zt});class Xi extends al{constructor(){super()}compare(e,t){let i=e._hx_index-t._hx_index;if(i!=0)return i;let l=pe.enumParameters(e),n=pe.enumParameters(t);return l.length==0&&n.length==0?0:this.compareArgs(l,n)}compareArgs(e,t){let i=e.length-t.length;if(i!=0)return i;let l=0,n=e.length;for(;l<n;){let s=l++,r=this.compareArg(e[s],t[s]);if(r!=0)return r}return 0}compareArg(e,t){return We.isEnumValue(e)&&We.isEnumValue(t)?this.compare(e,t):e instanceof Array&&t instanceof Array?this.compareArgs(e,t):We.compare(e,t)}}j["haxe.ds.EnumValueMap"]=Xi,Xi.__name__="haxe.ds.EnumValueMap",Xi.__interfaces__=[kt],Xi.__super__=al,Object.assign(Xi.prototype,{__class__:Xi});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 Ti(e)}}j["haxe.ds.IntMap"]=Ri,Ri.__name__="haxe.ds.IntMap",Ri.__interfaces__=[kt],Object.assign(Ri.prototype,{__class__:Ri});class Pl{constructor(){this.length=0}add(e){let t=new ml(e,null);this.h==null?this.h=t:this.q.next=t,this.q=t,this.length++}push(e){let t=new ml(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}}j["haxe.ds.List"]=Pl,Pl.__name__="haxe.ds.List",Object.assign(Pl.prototype,{__class__:Pl});class ml{constructor(e,t){this.item=e,this.next=t}}j["haxe.ds._List.ListNode"]=ml,ml.__name__="haxe.ds._List.ListNode",Object.assign(ml.prototype,{__class__:ml});class gl{constructor(){this.h={__keys__:{}}}set(e,t){let i=e.__id__;i==null&&(i=e.__id__=Zl.$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 Ti(e)}}j["haxe.ds.ObjectMap"]=gl,gl.__name__="haxe.ds.ObjectMap",gl.__interfaces__=[kt],Object.assign(gl.prototype,{__class__:gl});class Ee{constructor(){this.h=Object.create(null)}get(e){return this.h[e]}set(e,t){this.h[e]=t}keys(){return new dl(this.h)}}j["haxe.ds.StringMap"]=Ee,Ee.__name__="haxe.ds.StringMap",Ee.__interfaces__=[kt],Object.assign(Ee.prototype,{__class__:Ee});class dl{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++]}}j["haxe.ds._StringMap.StringMapKeyIterator"]=dl,dl.__name__="haxe.ds._StringMap.StringMapKeyIterator",Object.assign(dl.prototype,{__class__:dl});class ln{static blit(e,t,i,l,n){if(e==i){if(t<l){let s=t+n,r=l+n,h=0,a=n;for(;h<a;){let o=h++;--s,--r,e[r]=e[s]}}else if(t>l){let s=t,r=l,h=0,a=n;for(;h<a;){let o=h++;e[r]=e[s],++s,++r}}}else{let s=0,r=n;for(;s<r;){let h=s++;i[l+h]=e[t+h]}}}}class Nt{constructor(e){switch(e){case".":case"..":this.dir=e,this.file="";return}let t=e.lastIndexOf("/"),i=e.lastIndexOf("\\");t<i?(this.dir=p.substr(e,0,i),e=p.substr(e,i+1,null),this.backslash=!0):i<t?(this.dir=p.substr(e,0,t),e=p.substr(e,t+1,null)):this.dir=null;let l=e.lastIndexOf(".");l!=-1?(this.ext=p.substr(e,l+1,null),this.file=p.substr(e,0,l)):(this.ext=null,this.file=e)}static directory(e){let t=new Nt(e);return t.dir==null?"":t.dir}static join(e){let t=[],i=0,l=e;for(;i<l.length;){let a=l[i];++i,a!=null&&a!=""&&t.push(a)}let n=t;if(n.length==0)return"";let s=n[0],r=1,h=n.length;for(;r<h;){let a=r++;s=Nt.addTrailingSlash(s),s+=n[a]}return Nt.normalize(s)}static normalize(e){let t="/";if(e=e.split("\\").join(t),e==t)return t;let i=[],l=0,n=e.split(t);for(;l<n.length;){let c=n[l];++l,c==".."&&i.length>0&&i[i.length-1]!=".."?i.pop():c==""?(i.length>0||p.cca(e,0)==47)&&i.push(c):c!="."&&i.push(c)}let s=i.join(t),r="",h=!1,a=!1,o=0,u=s;for(;o<u.length;){let c=u,_=o++,f=c.charCodeAt(_);f>=55296&&f<=56319&&(f=f-55232<<10|c.charCodeAt(_+1)&1023);let m=f;m>=65536&&++o;let g=m;switch(g){case 47:if(!h)a=!0;else{let y=g;h=!1,a&&(r+="/",a=!1),r+=String.fromCodePoint(y)}break;case 58:r+=":",h=!0;break;default:let w=g;h=!1,a&&(r+="/",a=!1),r+=String.fromCodePoint(w)}}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("\\\\"))}}j["haxe.io.Path"]=Nt,Nt.__name__="haxe.io.Path",Object.assign(Nt.prototype,{__class__:Nt});class Ti{constructor(e){this.current=0,this.array=e}hasNext(){return this.current<this.array.length}next(){return this.array[this.current++]}}j["haxe.iterators.ArrayIterator"]=Ti,Ti.__name__="haxe.iterators.ArrayIterator",Object.assign(Ti.prototype,{__class__:Ti});var Gt=Qe["haxe.rtti.CType"]={__ename__:"haxe.rtti.CType",__constructs__:null,CUnknown:{_hx_name:"CUnknown",_hx_index:0,__enum__:"haxe.rtti.CType",toString:S},CEnum:(d=function(k,e){return{_hx_index:1,name:k,params:e,__enum__:"haxe.rtti.CType",toString:S}},d._hx_name="CEnum",d.__params__=["name","params"],d),CClass:(d=function(k,e){return{_hx_index:2,name:k,params:e,__enum__:"haxe.rtti.CType",toString:S}},d._hx_name="CClass",d.__params__=["name","params"],d),CTypedef:(d=function(k,e){return{_hx_index:3,name:k,params:e,__enum__:"haxe.rtti.CType",toString:S}},d._hx_name="CTypedef",d.__params__=["name","params"],d),CFunction:(d=function(k,e){return{_hx_index:4,args:k,ret:e,__enum__:"haxe.rtti.CType",toString:S}},d._hx_name="CFunction",d.__params__=["args","ret"],d),CAnonymous:(d=function(k){return{_hx_index:5,fields:k,__enum__:"haxe.rtti.CType",toString:S}},d._hx_name="CAnonymous",d.__params__=["fields"],d),CDynamic:(d=function(k){return{_hx_index:6,t:k,__enum__:"haxe.rtti.CType",toString:S}},d._hx_name="CDynamic",d.__params__=["t"],d),CAbstract:(d=function(k,e){return{_hx_index:7,name:k,params:e,__enum__:"haxe.rtti.CType",toString:S}},d._hx_name="CAbstract",d.__params__=["name","params"],d)};Gt.__constructs__=[Gt.CUnknown,Gt.CEnum,Gt.CClass,Gt.CTypedef,Gt.CFunction,Gt.CAnonymous,Gt.CDynamic,Gt.CAbstract];var Dt=Qe["haxe.rtti.Rights"]={__ename__:"haxe.rtti.Rights",__constructs__:null,RNormal:{_hx_name:"RNormal",_hx_index:0,__enum__:"haxe.rtti.Rights",toString:S},RNo:{_hx_name:"RNo",_hx_index:1,__enum__:"haxe.rtti.Rights",toString:S},RCall:(d=function(k){return{_hx_index:2,m:k,__enum__:"haxe.rtti.Rights",toString:S}},d._hx_name="RCall",d.__params__=["m"],d),RMethod:{_hx_name:"RMethod",_hx_index:3,__enum__:"haxe.rtti.Rights",toString:S},RDynamic:{_hx_name:"RDynamic",_hx_index:4,__enum__:"haxe.rtti.Rights",toString:S},RInline:{_hx_name:"RInline",_hx_index:5,__enum__:"haxe.rtti.Rights",toString:S}};Dt.__constructs__=[Dt.RNormal,Dt.RNo,Dt.RCall,Dt.RMethod,Dt.RDynamic,Dt.RInline];var Vi=Qe["haxe.rtti.TypeTree"]={__ename__:"haxe.rtti.TypeTree",__constructs__:null,TPackage:(d=function(k,e,t){return{_hx_index:0,name:k,full:e,subs:t,__enum__:"haxe.rtti.TypeTree",toString:S}},d._hx_name="TPackage",d.__params__=["name","full","subs"],d),TClassdecl:(d=function(k){return{_hx_index:1,c:k,__enum__:"haxe.rtti.TypeTree",toString:S}},d._hx_name="TClassdecl",d.__params__=["c"],d),TEnumdecl:(d=function(k){return{_hx_index:2,e:k,__enum__:"haxe.rtti.TypeTree",toString:S}},d._hx_name="TEnumdecl",d.__params__=["e"],d),TTypedecl:(d=function(k){return{_hx_index:3,t:k,__enum__:"haxe.rtti.TypeTree",toString:S}},d._hx_name="TTypedecl",d.__params__=["t"],d),TAbstractdecl:(d=function(k){return{_hx_index:4,a:k,__enum__:"haxe.rtti.TypeTree",toString:S}},d._hx_name="TAbstractdecl",d.__params__=["a"],d)};Vi.__constructs__=[Vi.TPackage,Vi.TClassdecl,Vi.TEnumdecl,Vi.TTypedecl,Vi.TAbstractdecl];class st{static typeInfos(e){let t;switch(e._hx_index){case 0:let i=e.name,l=e.full,n=e.subs;throw b.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 l=0,n=i,s=0;for(;s<t.length;){let r=t[s];if(++s,l>=n.length)return!1;let h=n[l++];if(!e(r,h))return!1}return!(l<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 l=t.m;return i==l}}return!1}static typeEq(e,t){switch(e._hx_index){case 0:return t==Gt.CUnknown;case 1:let i=e.name,l=e.params;if(t._hx_index==1){let m=t.name,g=t.params;return i==m?st.leq(st.typeEq,l,g):!1}break;case 2:let n=e.name,s=e.params;if(t._hx_index==2){let m=t.name,g=t.params;return n==m?st.leq(st.typeEq,s,g):!1}break;case 3:let r=e.name,h=e.params;if(t._hx_index==3){let m=t.name,g=t.params;return r==m?st.leq(st.typeEq,h,g):!1}break;case 4:let a=e.args,o=e.ret;if(t._hx_index==4){let m=t.args,g=t.ret;return st.leq(function(w,y){return w.name==y.name&&w.opt==y.opt?st.typeEq(w.t,y.t):!1},a,m)?st.typeEq(o,g):!1}break;case 5:let u=e.fields;if(t._hx_index==5){let m=t.fields;return st.leq(function(g,w){return st.fieldEq(g,w)},u,m)}break;case 6:let c=e.t;if(t._hx_index==6){let m=t.t;return c==null!=(m==null)?!1:c!=null?st.typeEq(c,m):!0}break;case 7:let _=e.name,f=e.params;if(t._hx_index==7){let m=t.name,g=t.params;return _==m?st.leq(st.typeEq,f,g):!1}break}return!1}static fieldEq(e,t){return!(e.name!=t.name||!st.typeEq(e.type,t.type)||e.isPublic!=t.isPublic||e.doc!=t.doc||!st.rightsEq(e.get,t.get)||!st.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&&!st.leq(function(i,l){return i.name==l.name&&i.opt==l.opt?st.typeEq(i.t,l.t):!1},e.args,t.args))}}j["haxe.rtti.TypeApi"]=st,st.__name__="haxe.rtti.TypeApi";class Nl{constructor(){this.root=[]}process(e,t){if(this.curplatform=t,e.nodeType!=Z.Document&&e.nodeType!=Z.Element)throw b.thrown("Invalid nodeType "+(e.nodeType==null?"null":Ie.toString(e.nodeType)));this.xroot(e)}mergeRights(e,t){return e.get==Dt.RInline&&e.set==Dt.RNo&&t.get==Dt.RNormal&&t.set==Dt.RMethod?(e.get=Dt.RNormal,e.set=Dt.RMethod,!0):pe.enumEq(e.get,t.get)?pe.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 st.fieldEq(e,t)?!0:e.name==t.name&&(this.mergeRights(e,t)||this.mergeRights(t,e))&&this.mergeDoc(e,t)?st.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,l=t.fields;for(;i<l.length;){let r=l[i];++i;let h=null,a=0,o=e.fields;for(;a<o.length;){let u=o[a];if(++a,this.mergeFields(u,r)){h=u;break}}h==null?(this.newField(e,r),e.fields.push(r)):this.curplatform!=null&&h.platforms.push(this.curplatform)}let n=0,s=t.statics;for(;n<s.length;){let r=s[n];++n;let h=null,a=0,o=e.statics;for(;a<o.length;){let u=o[a];if(++a,this.mergeFields(u,r)){h=u;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,l=t.constructors;for(;i<l.length;){let n=l[i];++i;let s=null,r=0,h=e.constructors;for(;r<h.length;){let a=h[r];if(++r,st.constructorEq(a,n)){s=a;break}}s==null?e.constructors.push(n):this.curplatform!=null&&s.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,l=e.to.length;for(;i<l;){let r=i++;if(!st.typeEq(e.to[r].t,t.to[r].t))return!1}let n=0,s=e.from.length;for(;n<s;){let r=n++;if(!st.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=st.typeInfos(e),i=t.path.split("."),l=this.root,n=[];i.pop();let s=0;for(;s<i.length;){let h=i[s];++s;let a=!1,o=0;for(;o<l.length;){let u=l[o];if(++o,u._hx_index==0){let c=u.full,_=u.name,f=u.subs;if(_==h){a=!0,l=f;break}}}if(n.push(h),!a){let u=[];l.push(Vi.TPackage(h,n.join("."),u)),l=u}}let r=0;for(;r<l.length;){let h=l[r];++r;let a;if(h._hx_index==0){let u=h.name,c=h.full,_=h.subs;a=!0}else a=!1;if(a)continue;let o=st.typeInfos(h);if(o.path==t.path){let u=!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 _=h.name,f=h.full,m=h.subs;u=!1;break;case 1:let g=h.c;if(e._hx_index==1){let E=e.c;if(this.mergeClasses(g,E))return}else u=!1;break;case 2:let w=h.e;if(e._hx_index==2){let E=e.e;if(this.mergeEnums(w,E))return}else u=!1;break;case 3:let y=h.t;if(e._hx_index==3){let E=e.t;if(this.mergeTypedefs(y,E))return}break;case 4:let T=h.a;if(e._hx_index==4){let E=e.a;if(this.mergeAbstracts(T,E))return}else u=!1;break}let c=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":u?"could not merge definition":"type kind is different";throw b.thrown("Incompatibilities between "+o.path+" in "+o.platforms.join(",")+" and "+this.curplatform+" ("+c+")")}}l.push(e)}mkPath(e){return e}mkTypeParams(e){let t=e.split(":");return t[0]==""?[]:t}mkRights(e){switch(e){case"dynamic":return Dt.RDynamic;case"inline":return Dt.RInline;case"method":return Dt.RMethod;case"null":return Dt.RNo;default:return Dt.RCall(e)}}xerror(e){let t;if(e.nodeType==Z.Document)t="Document";else{if(e.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":Ie.toString(e.nodeType)));t=e.nodeName}throw b.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!=Z.Document&&e.nodeType!=Z.Element)throw b.thrown("Invalid nodeType "+(e.nodeType==null?"null":Ie.toString(e.nodeType)));let t=e,i;if(t.nodeType==Z.Document)i="Document";else{if(t.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(t.nodeType==null?"null":Ie.toString(t.nodeType)));i=t.nodeName}switch(i){case"abstract":return Vi.TAbstractdecl(this.xabstract(t));case"class":return Vi.TClassdecl(this.xclass(t));case"enum":return Vi.TEnumdecl(this.xenum(t));case"typedef":return Vi.TTypedecl(this.xtypedef(t));default:return this.xerror(t)}}xmeta(e){let t=[],i=0,l=un.resolve(e,"m");for(;i<l.length;){let n=l[i];++i;let s=[],r=0,h=un.resolve(n,"e");for(;r<h.length;){let a=h[r];++r,s.push(Zi.get_innerHTML(a))}t.push({name:Xe.resolve(n,"n"),params:s})}return t}xoverloads(e){let t=[],i=e.elements();for(;i.hasNext();){let l=i.next();t.push(this.xclassfield(l))}return t}xpath(e){let t=this.mkPath(Xe.resolve(e,"path")),i=[],l=e.elements();for(;l.hasNext();){let n=l.next();i.push(this.xtype(n))}return{path:t,params:i}}xclass(e){let t=null,i=null,l=null,n=[],s=[],r=[],h=[],a=e.exists("interface"),o=e.elements();for(;o.hasNext();){let u=o.next(),c;if(u.nodeType==Z.Document)c="Document";else{if(u.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(u.nodeType==null?"null":Ie.toString(u.nodeType)));c=u.nodeName}switch(c){case"extends":a?n.push(this.xpath(u)):t=this.xpath(u);break;case"haxe_doc":i=Zi.get_innerData(u);break;case"haxe_dynamic":let _=u.firstElement();if(_.nodeType!=Z.Document&&_.nodeType!=Z.Element)throw b.thrown("Invalid nodeType "+(_.nodeType==null?"null":Ie.toString(_.nodeType)));l=this.xtype(_);break;case"implements":n.push(this.xpath(u));break;case"meta":h=this.xmeta(u);break;default:u.exists("static")?r.push(this.xclassfield(u)):s.push(this.xclassfield(u))}}return{file:ei.resolve(e,"file")?Xe.resolve(e,"file"):null,path:this.mkPath(Xe.resolve(e,"path")),module:ei.resolve(e,"module")?this.mkPath(Xe.resolve(e,"module")):null,doc:i,isPrivate:e.exists("private"),isExtern:e.exists("extern"),isFinal:e.exists("final"),isInterface:a,params:this.mkTypeParams(Xe.resolve(e,"params")),superClass:t,interfaces:n,fields:s,statics:r,tdynamic:l,platforms:this.defplat(),meta:h}}xclassfield(e,t){t==null&&(t=!1);let i=e.elements(),l=this.xtype(i.next()),n=null,s=[],r=null,h=i;for(;h.hasNext();){let o=h.next(),u;if(o.nodeType==Z.Document)u="Document";else{if(o.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(o.nodeType==null?"null":Ie.toString(o.nodeType)));u=o.nodeName}switch(u){case"haxe_doc":n=Zi.get_innerData(o);break;case"meta":s=this.xmeta(o);break;case"overloads":r=this.xoverloads(o);break;default:this.xerror(o)}}let a;if(e.nodeType==Z.Document)a="Document";else{if(e.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":Ie.toString(e.nodeType)));a=e.nodeName}return{name:a,type:l,isPublic:e.exists("public")||t,isFinal:e.exists("final"),isOverride:e.exists("override"),line:ei.resolve(e,"line")?le.parseInt(Xe.resolve(e,"line")):null,doc:n,get:ei.resolve(e,"get")?this.mkRights(Xe.resolve(e,"get")):Dt.RNormal,set:ei.resolve(e,"set")?this.mkRights(Xe.resolve(e,"set")):Dt.RNormal,params:ei.resolve(e,"params")?this.mkTypeParams(Xe.resolve(e,"params")):[],platforms:this.defplat(),meta:s,overloads:r,expr:ei.resolve(e,"expr")?Xe.resolve(e,"expr"):null}}xenum(e){let t=[],i=null,l=[],n=e.elements();for(;n.hasNext();){let s=n.next(),r;if(s.nodeType==Z.Document)r="Document";else{if(s.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(s.nodeType==null?"null":Ie.toString(s.nodeType)));r=s.nodeName}if(r=="haxe_doc")i=Zi.get_innerData(s);else{let h;if(s.nodeType==Z.Document)h="Document";else{if(s.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(s.nodeType==null?"null":Ie.toString(s.nodeType)));h=s.nodeName}h=="meta"?l=this.xmeta(s):t.push(this.xenumfield(s))}}return{file:ei.resolve(e,"file")?Xe.resolve(e,"file"):null,path:this.mkPath(Xe.resolve(e,"path")),module:ei.resolve(e,"module")?this.mkPath(Xe.resolve(e,"module")):null,doc:i,isPrivate:e.exists("private"),isExtern:e.exists("extern"),params:this.mkTypeParams(Xe.resolve(e,"params")),constructors:t,platforms:this.defplat(),meta:l}}xenumfield(e){let t=null,i=e.elementsNamed("haxe_doc"),l=i.hasNext()?i.next():null,n=dn.resolve(e,"meta")?this.xmeta(on.resolve(e,"meta")):[];if(ei.resolve(e,"a")){let h=Xe.resolve(e,"a").split(":"),a=e.elements();t=[];let o=0;for(;o<h.length;){let u=h[o];++o;let c=!1;u.charAt(0)=="?"&&(c=!0,u=p.substr(u,1,null)),t.push({name:u,opt:c,t:this.xtype(a.next())})}}let s;if(e.nodeType==Z.Document)s="Document";else{if(e.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":Ie.toString(e.nodeType)));s=e.nodeName}let r;if(l==null)r=null;else{if(l.nodeType!=Z.Document&&l.nodeType!=Z.Element)throw b.thrown("Invalid nodeType "+(l.nodeType==null?"null":Ie.toString(l.nodeType)));r=Zi.get_innerData(l)}return{name:s,args:t,doc:r,meta:n,platforms:this.defplat()}}xabstract(e){let t=null,i=null,l=null,n=[],s=[],r=[],h=e.elements();for(;h.hasNext();){let a=h.next(),o;if(a.nodeType==Z.Document)o="Document";else{if(a.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(a.nodeType==null?"null":Ie.toString(a.nodeType)));o=a.nodeName}switch(o){case"from":let u=a.elements();for(;u.hasNext();){let f=u.next(),m=f.firstElement();if(m.nodeType!=Z.Document&&m.nodeType!=Z.Element)throw b.thrown("Invalid nodeType "+(m.nodeType==null?"null":Ie.toString(m.nodeType)));r.push({t:this.xtype(m),field:ei.resolve(f,"field")?Xe.resolve(f,"field"):null})}break;case"haxe_doc":t=Zi.get_innerData(a);break;case"impl":i=this.xclass(on.resolve(a,"class"));break;case"meta":n=this.xmeta(a);break;case"this":let c=a.firstElement();if(c.nodeType!=Z.Document&&c.nodeType!=Z.Element)throw b.thrown("Invalid nodeType "+(c.nodeType==null?"null":Ie.toString(c.nodeType)));l=this.xtype(c);break;case"to":let _=a.elements();for(;_.hasNext();){let f=_.next(),m=f.firstElement();if(m.nodeType!=Z.Document&&m.nodeType!=Z.Element)throw b.thrown("Invalid nodeType "+(m.nodeType==null?"null":Ie.toString(m.nodeType)));s.push({t:this.xtype(m),field:ei.resolve(f,"field")?Xe.resolve(f,"field"):null})}break;default:this.xerror(a)}}return{file:ei.resolve(e,"file")?Xe.resolve(e,"file"):null,path:this.mkPath(Xe.resolve(e,"path")),module:ei.resolve(e,"module")?this.mkPath(Xe.resolve(e,"module")):null,doc:t,isPrivate:e.exists("private"),params:this.mkTypeParams(Xe.resolve(e,"params")),platforms:this.defplat(),meta:n,athis:l,to:s,from:r,impl:i}}xtypedef(e){let t=null,i=null,l=[],n=e.elements();for(;n.hasNext();){let r=n.next(),h;if(r.nodeType==Z.Document)h="Document";else{if(r.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(r.nodeType==null?"null":Ie.toString(r.nodeType)));h=r.nodeName}if(h=="haxe_doc")t=Zi.get_innerData(r);else{let a;if(r.nodeType==Z.Document)a="Document";else{if(r.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(r.nodeType==null?"null":Ie.toString(r.nodeType)));a=r.nodeName}a=="meta"?l=this.xmeta(r):i=this.xtype(r)}}let s=new Ee;return this.curplatform!=null&&(s.h[this.curplatform]=i),{file:ei.resolve(e,"file")?Xe.resolve(e,"file"):null,path:this.mkPath(Xe.resolve(e,"path")),module:ei.resolve(e,"module")?this.mkPath(Xe.resolve(e,"module")):null,doc:t,isPrivate:e.exists("private"),params:this.mkTypeParams(Xe.resolve(e,"params")),type:i,types:s,platforms:this.defplat(),meta:l}}xtype(e){let t;if(e.nodeType==Z.Document)t="Document";else{if(e.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":Ie.toString(e.nodeType)));t=e.nodeName}switch(t){case"a":let i=[],l=e.elements();for(;l.hasNext();){let f=l.next(),m=this.xclassfield(f,!0);m.platforms=[],i.push(m)}return Gt.CAnonymous(i);case"c":return Gt.CClass(this.mkPath(Xe.resolve(e,"path")),this.xtypeparams(e));case"d":let n=null,s=e.firstElement();if(s!=null){if(s.nodeType!=Z.Document&&s.nodeType!=Z.Element)throw b.thrown("Invalid nodeType "+(s.nodeType==null?"null":Ie.toString(s.nodeType)));n=this.xtype(s)}return Gt.CDynamic(n);case"e":return Gt.CEnum(this.mkPath(Xe.resolve(e,"path")),this.xtypeparams(e));case"f":let r=[],h=Xe.resolve(e,"a").split(":"),a=0,o=h,u=ei.resolve(e,"v")?new Ti(Xe.resolve(e,"v").split(":")):null,c=e.elements();for(;c.hasNext();){let f=c.next(),m=!1,g=a<o.length?o[a++]:null;g==null&&(g=""),g.charAt(0)=="?"&&(m=!0,g=p.substr(g,1,null));let w=u==null||u.current>=u.array.length?null:u.array[u.current++];r.push({name:g,opt:m,t:this.xtype(f),value:w==""?null:w})}let _=r[r.length-1];return p.remove(r,_),Gt.CFunction(r,_.t);case"t":return Gt.CTypedef(this.mkPath(Xe.resolve(e,"path")),this.xtypeparams(e));case"unknown":return Gt.CUnknown;case"x":return Gt.CAbstract(this.mkPath(Xe.resolve(e,"path")),this.xtypeparams(e));default:return this.xerror(e)}}xtypeparams(e){let t=[],i=e.elements();for(;i.hasNext();){let l=i.next();t.push(this.xtype(l))}return t}defplat(){let e=[];return this.curplatform!=null&&e.push(this.curplatform),e}}j["haxe.rtti.XmlParser"]=Nl,Nl.__name__="haxe.rtti.XmlParser",Object.assign(Nl.prototype,{__class__:Nl});class on{static resolve(e,t){let i=e.elementsNamed(t).next();if(i==null){let l;if(e.nodeType==Z.Document)l="Document";else{if(e.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":Ie.toString(e.nodeType)));l=e.nodeName}throw b.thrown(l+" is missing element "+t)}if(i.nodeType!=Z.Document&&i.nodeType!=Z.Element)throw b.thrown("Invalid nodeType "+(i.nodeType==null?"null":Ie.toString(i.nodeType)));return i}}class Xe{static resolve(e,t){if(e.nodeType==Z.Document)throw b.thrown("Cannot access document attribute "+t);let i=e.get(t);if(i==null)throw e.nodeType!=Z.Element?b.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":Ie.toString(e.nodeType))):b.thrown(e.nodeName+" is missing attribute "+t);return i}}class ei{static resolve(e,t){if(e.nodeType==Z.Document)throw b.thrown("Cannot access document attribute "+t);return e.exists(t)}}class dn{static resolve(e,t){return e.elementsNamed(t).hasNext()}}class un{static resolve(e,t){let i=[],l=e.elementsNamed(t);for(;l.hasNext();){let n=l.next();if(n.nodeType!=Z.Document&&n.nodeType!=Z.Element)throw b.thrown("Invalid nodeType "+(n.nodeType==null?"null":Ie.toString(n.nodeType)));i.push(n)}return i}}class Zi{static get_innerData(e){if(e.nodeType!=Z.Document&&e.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element or Document but found "+(e.nodeType==null?"null":Ie.toString(e.nodeType)));let t=0,i=e.children;if(t>=i.length){let n;if(e.nodeType==Z.Document)n="Document";else{if(e.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":Ie.toString(e.nodeType)));n=e.nodeName}throw b.thrown(n+" does not have data")}let l=i[t++];if(t<i.length){let n=i[t++],s;if(l.nodeType==Z.PCData&&n.nodeType==Z.CData){if(l.nodeType==Z.Document||l.nodeType==Z.Element)throw b.thrown("Bad node type, unexpected "+(l.nodeType==null?"null":Ie.toString(l.nodeType)));s=Ae.trim(l.nodeValue)==""}else s=!1;if(s){if(t>=i.length){if(n.nodeType==Z.Document||n.nodeType==Z.Element)throw b.thrown("Bad node type, unexpected "+(n.nodeType==null?"null":Ie.toString(n.nodeType)));return n.nodeValue}let h=i[t++],a;if(h.nodeType==Z.PCData){if(h.nodeType==Z.Document||h.nodeType==Z.Element)throw b.thrown("Bad node type, unexpected "+(h.nodeType==null?"null":Ie.toString(h.nodeType)));a=Ae.trim(h.nodeValue)==""}else a=!1;if(a&&t>=i.length){if(n.nodeType==Z.Document||n.nodeType==Z.Element)throw b.thrown("Bad node type, unexpected "+(n.nodeType==null?"null":Ie.toString(n.nodeType)));return n.nodeValue}}let r;if(e.nodeType==Z.Document)r="Document";else{if(e.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":Ie.toString(e.nodeType)));r=e.nodeName}throw b.thrown(r+" does not only have data")}if(l.nodeType!=Z.PCData&&l.nodeType!=Z.CData){let n;if(e.nodeType==Z.Document)n="Document";else{if(e.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":Ie.toString(e.nodeType)));n=e.nodeName}throw b.thrown(n+" does not have data")}if(l.nodeType==Z.Document||l.nodeType==Z.Element)throw b.thrown("Bad node type, unexpected "+(l.nodeType==null?"null":Ie.toString(l.nodeType)));return l.nodeValue}static get_innerHTML(e){let t="";if(e.nodeType!=Z.Document&&e.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element or Document but found "+(e.nodeType==null?"null":Ie.toString(e.nodeType)));let i=0,l=e.children;for(;i<l.length;){let n=l[i++];t+=le.string(el.print(n))}return t}}Zi.__properties__={get_innerHTML:"get_innerHTML",get_innerData:"get_innerData"};class el{constructor(e){this.output=new Xt,this.pretty=e}writeNode(e,t){switch(e.nodeType){case 0:if(this.output.b+=le.string(t+"<"),e.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":Ie.toString(e.nodeType)));this.output.b+=le.string(e.nodeName);let i=e.attributes();for(;i.hasNext();){let o=i.next();this.output.b+=le.string(" "+o+'="');let u=Ae.htmlEscape(e.get(o),!0);this.output.b+=le.string(u),this.output.b+='"'}if(this.hasChildren(e)){if(this.output.b+=">",this.pretty&&(this.output.b+=`
5
+ `),e.nodeType!=Z.Document&&e.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element or Document but found "+(e.nodeType==null?"null":Ie.toString(e.nodeType)));let o=0,u=e.children;for(;o<u.length;){let c=u[o++];this.writeNode(c,this.pretty?t+" ":t)}if(this.output.b+=le.string(t+"</"),e.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":Ie.toString(e.nodeType)));this.output.b+=le.string(e.nodeName),this.output.b+=">",this.pretty&&(this.output.b+=`
6
6
  `)}else this.output.b+="/>",this.pretty&&(this.output.b+=`
7
- `);break;case 1:if(e.nodeType==Z.Document||e.nodeType==Z.Element)throw b.thrown("Bad node type, unexpected "+(e.nodeType==null?"null":Ie.toString(e.nodeType)));let l=e.nodeValue;if(l.length!=0){let o=t+Ae.htmlEscape(l);this.output.b+=ne.string(o),this.pretty&&(this.output.b+=`
8
- `)}break;case 2:if(this.output.b+=ne.string(t+"<![CDATA["),e.nodeType==Z.Document||e.nodeType==Z.Element)throw b.thrown("Bad node type, unexpected "+(e.nodeType==null?"null":Ie.toString(e.nodeType)));this.output.b+=ne.string(e.nodeValue),this.output.b+="]]>",this.pretty&&(this.output.b+=`
7
+ `);break;case 1:if(e.nodeType==Z.Document||e.nodeType==Z.Element)throw b.thrown("Bad node type, unexpected "+(e.nodeType==null?"null":Ie.toString(e.nodeType)));let l=e.nodeValue;if(l.length!=0){let o=t+Ae.htmlEscape(l);this.output.b+=le.string(o),this.pretty&&(this.output.b+=`
8
+ `)}break;case 2:if(this.output.b+=le.string(t+"<![CDATA["),e.nodeType==Z.Document||e.nodeType==Z.Element)throw b.thrown("Bad node type, unexpected "+(e.nodeType==null?"null":Ie.toString(e.nodeType)));this.output.b+=le.string(e.nodeValue),this.output.b+="]]>",this.pretty&&(this.output.b+=`
9
9
  `);break;case 3:if(e.nodeType==Z.Document||e.nodeType==Z.Element)throw b.thrown("Bad node type, unexpected "+(e.nodeType==null?"null":Ie.toString(e.nodeType)));let n=e.nodeValue,s=new RegExp(`[
10
- \r ]+`,"g".split("u").join(""));n=n.replace(s,""),n="<!--"+n+"-->",this.output.b+=t==null?"null":""+t;let r=Ae.trim(n);this.output.b+=ne.string(r),this.pretty&&(this.output.b+=`
11
- `);break;case 4:if(e.nodeType==Z.Document||e.nodeType==Z.Element)throw b.thrown("Bad node type, unexpected "+(e.nodeType==null?"null":Ie.toString(e.nodeType)));this.output.b+=ne.string("<!DOCTYPE "+e.nodeValue+">"),this.pretty&&(this.output.b+=`
12
- `);break;case 5:if(e.nodeType==Z.Document||e.nodeType==Z.Element)throw b.thrown("Bad node type, unexpected "+(e.nodeType==null?"null":Ie.toString(e.nodeType)));this.output.b+=ne.string("<?"+e.nodeValue+"?>"),this.pretty&&(this.output.b+=`
13
- `);break;case 6:if(e.nodeType!=Z.Document&&e.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element or Document but found "+(e.nodeType==null?"null":Ie.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!=Z.Document&&e.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element or Document but found "+(e.nodeType==null?"null":Ie.toString(e.nodeType)));let t=0,i=e.children;for(;t<i.length;){let l=i[t++];switch(l.nodeType){case 0:case 1:return!0;case 2:case 3:if(l.nodeType==Z.Document||l.nodeType==Z.Element)throw b.thrown("Bad node type, unexpected "+(l.nodeType==null?"null":Ie.toString(l.nodeType)));if(Ae.ltrim(l.nodeValue).length!=0)return!0;break;default:}}return!1}static print(e,t){t==null&&(t=!1);let i=new el(t);return i.writeNode(e,""),i.output.b}}j["haxe.xml.Printer"]=el,el.__name__="haxe.xml.Printer",Object.assign(el.prototype,{__class__:el});var W=Qe["hscript.TType"]={__ename__:"hscript.TType",__constructs__:null,TMono:(d=function(k){return{_hx_index:0,r:k,__enum__:"hscript.TType",toString:S}},d._hx_name="TMono",d.__params__=["r"],d),TVoid:{_hx_name:"TVoid",_hx_index:1,__enum__:"hscript.TType",toString:S},TInt:{_hx_name:"TInt",_hx_index:2,__enum__:"hscript.TType",toString:S},TFloat:{_hx_name:"TFloat",_hx_index:3,__enum__:"hscript.TType",toString:S},TBool:{_hx_name:"TBool",_hx_index:4,__enum__:"hscript.TType",toString:S},TDynamic:{_hx_name:"TDynamic",_hx_index:5,__enum__:"hscript.TType",toString:S},TParam:(d=function(k){return{_hx_index:6,name:k,__enum__:"hscript.TType",toString:S}},d._hx_name="TParam",d.__params__=["name"],d),TUnresolved:(d=function(k){return{_hx_index:7,name:k,__enum__:"hscript.TType",toString:S}},d._hx_name="TUnresolved",d.__params__=["name"],d),TNull:(d=function(k){return{_hx_index:8,t:k,__enum__:"hscript.TType",toString:S}},d._hx_name="TNull",d.__params__=["t"],d),TInst:(d=function(k,e){return{_hx_index:9,c:k,args:e,__enum__:"hscript.TType",toString:S}},d._hx_name="TInst",d.__params__=["c","args"],d),TEnum:(d=function(k,e){return{_hx_index:10,e:k,args:e,__enum__:"hscript.TType",toString:S}},d._hx_name="TEnum",d.__params__=["e","args"],d),TType:(d=function(k,e){return{_hx_index:11,t:k,args:e,__enum__:"hscript.TType",toString:S}},d._hx_name="TType",d.__params__=["t","args"],d),TAbstract:(d=function(k,e){return{_hx_index:12,a:k,args:e,__enum__:"hscript.TType",toString:S}},d._hx_name="TAbstract",d.__params__=["a","args"],d),TFun:(d=function(k,e){return{_hx_index:13,args:k,ret:e,__enum__:"hscript.TType",toString:S}},d._hx_name="TFun",d.__params__=["args","ret"],d),TAnon:(d=function(k){return{_hx_index:14,fields:k,__enum__:"hscript.TType",toString:S}},d._hx_name="TAnon",d.__params__=["fields"],d),TLazy:(d=function(k){return{_hx_index:15,f:k,__enum__:"hscript.TType",toString:S}},d._hx_name="TLazy",d.__params__=["f"],d)};W.__constructs__=[W.TMono,W.TVoid,W.TInt,W.TFloat,W.TBool,W.TDynamic,W.TParam,W.TUnresolved,W.TNull,W.TInst,W.TEnum,W.TType,W.TAbstract,W.TFun,W.TAnon,W.TLazy];var Se=Qe["hscript._Checker.WithType"]={__ename__:"hscript._Checker.WithType",__constructs__:null,NoValue:{_hx_name:"NoValue",_hx_index:0,__enum__:"hscript._Checker.WithType",toString:S},Value:{_hx_name:"Value",_hx_index:1,__enum__:"hscript._Checker.WithType",toString:S},WithType:(d=function(k){return{_hx_index:2,t:k,__enum__:"hscript._Checker.WithType",toString:S}},d._hx_name="WithType",d.__params__=["t"],d)};Se.__constructs__=[Se.NoValue,Se.Value,Se.WithType];var hi=Qe["hscript.CTypedecl"]={__ename__:"hscript.CTypedecl",__constructs__:null,CTClass:(d=function(k){return{_hx_index:0,c:k,__enum__:"hscript.CTypedecl",toString:S}},d._hx_name="CTClass",d.__params__=["c"],d),CTEnum:(d=function(k){return{_hx_index:1,e:k,__enum__:"hscript.CTypedecl",toString:S}},d._hx_name="CTEnum",d.__params__=["e"],d),CTTypedef:(d=function(k){return{_hx_index:2,t:k,__enum__:"hscript.CTypedecl",toString:S}},d._hx_name="CTTypedef",d.__params__=["t"],d),CTAlias:(d=function(k){return{_hx_index:3,t:k,__enum__:"hscript.CTypedecl",toString:S}},d._hx_name="CTAlias",d.__params__=["t"],d),CTAbstract:(d=function(k){return{_hx_index:4,a:k,__enum__:"hscript.CTypedecl",toString:S}},d._hx_name="CTAbstract",d.__params__=["a"],d)};hi.__constructs__=[hi.CTClass,hi.CTEnum,hi.CTTypedef,hi.CTAlias,hi.CTAbstract];class xl{constructor(e,t){this.expr=e,this.t=t}}j["hscript.Completion"]=xl,xl.__name__="hscript.Completion",Object.assign(xl.prototype,{__class__:xl});class Ml{constructor(){this.types=new Ee,this.types=new Ee,this.types.h.Void=hi.CTAlias(W.TVoid),this.types.h.Int=hi.CTAlias(W.TInt),this.types.h.Float=hi.CTAlias(W.TFloat),this.types.h.Bool=hi.CTAlias(W.TBool),this.types.h.Dynamic=hi.CTAlias(W.TDynamic),this.parser=new tl}addXmlApi(e){let t=new Nl;t.process(e,"");let i=[],l=0,n=t.root;for(;l<n.length;){let r=n[l];++l,this.addXmlType(r,i)}let s=0;for(;s<i.length;){let r=i[s];++s,r()}this.t_string=this.getType("String")}defineClass(e,t){return t==null&&(t={name:e,fields:new Ee,statics:new Ee,params:[]}),this.types.h[e]=hi.CTClass(t),t}addXmlType(e,t){let i=this;switch(e._hx_index){case 0:let l=e.name,n=e.full,s=e.subs,r=0;for(;r<s.length;){let v=s[r];++r,this.addXmlType(v,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 Ee,statics:new Ee};this.addMeta(h,a),h.isInterface&&(a.isInterface=!0);let o=0,u=h.params;for(;o<u.length;){let v=u[o];++o,a.params.push(W.TParam(v))}t.push(function(){let v=new Ee,F=0,B=a.params;for(;F<B.length;){let M=B[F];++F;let U=h.path+"."+Ze.typeStr(M);v.h[U]=M}if(i.localParams=v,h.superClass!=null){let M=i,U=h.superClass.path,K=[],G=0,Y=h.superClass.params;for(;G<Y.length;){let $=Y[G];++G,K.push(i.makeXmlType($))}a.superClass=M.getType(U,K)}if(h.interfaces!=null){a.interfaces=[];let M=0,U=h.interfaces;for(;M<U.length;){let K=U[M];++M;let G=a.interfaces,Y=i,$=K.path,se=[],ue=0,oe=K.params;for(;ue<oe.length;){let ge=oe[ue];++ue,se.push(i.makeXmlType(ge))}G.push(Y.getType($,se))}}let A=[],L=function(M,U){if(M.isOverride||p.substr(M.name,0,4)=="get_"||p.substr(M.name,0,4)=="set_")return;let K=!M.name.startsWith("__"),G=0,Y=M.meta;for(;G<Y.length;){let me=Y[G];if(++G,me.name==":noScript")return;me.name==":noCompletion"&&(K=!1)}let $=M.set,se;switch($._hx_index){case 2:let me=$.m;se=!0;break;case 0:case 4:se=!0;break;default:se=!1}let ue={isPublic:M.isPublic,canWrite:se,complete:K,params:[],name:M.name,t:null},oe=0,ge=M.params;for(;oe<ge.length;){let me=ge[oe];++oe;let de=W.TParam(me),Oe=M.name+"."+me;A.push(Oe),ue.params.push(de),i.localParams.h[Oe]=de}if(ue.t=i.makeXmlType(M.type),M.meta!=null&&M.meta.length>0){ue.meta=[];let me=0,de=M.meta;for(;me<de.length;){let Oe=de[me];++me;let Ve=ue.meta,je=Oe.name,et=[],Ue=0,Ge=Oe.params;for(;Ue<Ge.length;){let nt=Ge[Ue];++Ue;let De;try{De=i.parser.parseString(nt)}catch(H){if(b.caught(H).unwrap()instanceof Ce)De=null;else throw H}et.push(De)}Ve.push({name:je,params:et})}}for(;A.length>0;){let me=i.localParams,de=A.pop(),Oe=me;Object.prototype.hasOwnProperty.call(Oe.h,de)&&delete Oe.h[de]}ue.name=="new"?a.constructor=ue:U.set(M.name,ue)},z=0,D=h.fields;for(;z<D.length;){let M=D[z];++z,L(M,a.fields)}let O=0,q=h.statics;for(;O<q.length;){let M=q[O];++O,L(M,a.statics)}i.localParams=null}),this.types.h[a.name]=hi.CTClass(a);break;case 2:let c=e.e;if(Object.prototype.hasOwnProperty.call(this.types.h,c.path))return;let _={name:c.path,params:[],constructors:[]};this.addMeta(c,_);let f=0,m=c.params;for(;f<m.length;){let v=m[f];++f,_.params.push(W.TParam(v))}t.push(function(){let v=new Ee,F=0,B=_.params;for(;F<B.length;){let z=B[F];++F;let D=c.path+"."+Ze.typeStr(z);v.h[D]=z}i.localParams=v;let A=0,L=c.constructors;for(;A<L.length;){let z=L[A];++A;let D=_.constructors,O=z.name,q;if(z.args==null)q=null;else{let M=[],U=0,K=z.args;for(;U<K.length;){let G=K[U];++U,M.push({name:G.name,opt:G.opt,t:i.makeXmlType(G.t)})}q=M}D.push({name:O,args:q})}i.localParams=null}),this.types.h[_.name]=hi.CTEnum(_);break;case 3:let g=e.t;if(Object.prototype.hasOwnProperty.call(this.types.h,g.path))return;let w={name:g.path,params:[],t:null},y=0,T=g.params;for(;y<T.length;){let v=T[y];++y,w.params.push(W.TParam(v))}g.path=="hscript.TypeCheck"&&w.params.reverse(),t.push(function(){let v=new Ee,F=0,B=w.params;for(;F<B.length;){let A=B[F];++F;let L=g.path+"."+Ze.typeStr(A);v.h[L]=A}i.localParams=v,w.t=i.makeXmlType(g.type),i.localParams=null}),this.types.h[g.path]=hi.CTTypedef(w);break;case 4:let E=e.a;if(Object.prototype.hasOwnProperty.call(this.types.h,E.path))return;let C={name:E.path,params:[],t:null};this.addMeta(E,C);let P=0,I=E.params;for(;P<I.length;){let v=I[P];++P,C.params.push(W.TParam(v))}t.push(function(){let v=new Ee,F=0,B=C.params;for(;F<B.length;){let A=B[F];++F;let L=E.path+"."+Ze.typeStr(A);v.h[L]=A}i.localParams=v,C.t=i.makeXmlType(E.athis),i.localParams=null}),this.types.h[E.path]=hi.CTAbstract(C);break}}addMeta(e,t){if(e.meta==null||e.meta.length==0)return;t.meta=[];let i=0,l=e.meta;for(;i<l.length;){let n=l[i];++i;let s=t.meta,r=n.name,h=[],a=0,o=n.params;for(;a<o.length;){let u=o[a];++a;let c;try{c=this.parser.parseString(u)}catch(_){if(b.caught(_).unwrap()instanceof Ce)c=null;else throw _}h.push(c)}s.push({name:r,params:h})}}makeXmlType(e){switch(e._hx_index){case 0:return W.TUnresolved("Unknown");case 1:let t=e.name,i=e.params,l=[],n=0;for(;n<i.length;){let B=i[n];++n,l.push(this.makeXmlType(B))}return this.getType(t,l);case 2:let s=e.name,r=e.params,h=[],a=0;for(;a<r.length;){let B=r[a];++a,h.push(this.makeXmlType(B))}return this.getType(s,h);case 3:let o=e.name,u=e.params,c=[],_=0;for(;_<u.length;){let B=u[_];++_,c.push(this.makeXmlType(B))}return this.getType(o,c);case 4:let f=e.args,m=e.ret,g=[],w=0;for(;w<f.length;){let B=f[w];++w,g.push({name:B.name,opt:B.opt,t:this.makeXmlType(B.t)})}return W.TFun(g,this.makeXmlType(m));case 5:let y=e.fields,T=[],E=0;for(;E<y.length;){let B=y[E];++E;let A=B.name,L=this.makeXmlType(B.type),z=B.meta,D;if(z==null)D=!1;else{let O=!1,q=0;for(;q<z.length;){let M=z[q];if(++q,M.name==":optional"){O=!0;break}}D=O}T.push({name:A,t:L,opt:D})}return W.TAnon(T);case 6:let C=e.t;return W.TDynamic;case 7:let P=e.name,I=e.params,v=[],F=0;for(;F<I.length;){let B=I[F];++F,v.push(this.makeXmlType(B))}return this.getType(P,v)}}getType(e,t){if(this.localParams!=null){let l=this.localParams.h[e];if(l!=null)return l}let i=this.resolve(e,t);if(i==null){let l=e.split(".");if(l.length>1){let n=l[l.length-2];if(p.cca(n,0)==95)return p.remove(l,n),this.getType(l.join("."),t)}return W.TUnresolved(e)}return i}resolve(e,t){if(e=="Null"){if(t==null||t.length!=1)throw b.thrown("Missing Null<T> parameter");return W.TNull(t[0])}let i=this.types.h[e];if(i==null)return null;switch(t==null&&(t=[]),i._hx_index){case 0:let l=i.c;return W.TInst(l,t);case 1:let n=i.e;return W.TEnum(n,t);case 2:let s=i.t;return W.TType(s,t);case 3:return i.t;case 4:let h=i.a;return W.TAbstract(h,t)}}}j["hscript.CheckerTypes"]=Ml,Ml.__name__="hscript.CheckerTypes",Object.assign(Ml.prototype,{__class__:Ml});class Ze{constructor(e){this.events=new Ee,this.globals=new Ee,e==null&&(e=new Ml),this.types=e}setGlobals(e,t){t==null&&(t=!1);let i=this;for(;;){let l=e.fields.h,n=l,s=Object.keys(l),r=s.length,h=0;for(;h<r;){let o=n[s[h++]];if(o.isPublic||t){let u=o.params.length==0?o.t:W.TLazy(function(){let c=i,_=o.t,f=o.params,m=[],g=0,w=o.params.length;for(;g<w;){let y=g++;m.push(i.makeMono())}return c.apply(_,f,m)});this.setGlobal(o.name,u)}}if(e.superClass==null)break;let a=e.superClass;if(a==null)throw b.thrown("assert");if(a._hx_index==9){let o=a.args;e=a.c}else throw b.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=[],l=0,n=e.length;for(;l<n;){let s=l++,r=e[s],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=Se.NoValue),this.locals=new Ee,this.types.t_string==null&&(this.types.t_string=this.types.getType("String")),this.allowDefine=this.allowGlobalsDefine,this.isCompletion=i;let l=e.e,n;if(l._hx_index==14){let h=l.args,a=l.e,o=l.name,u=l.ret;n=!0}else n=!1;n&&(e=this.mk(V.EBlock([e]),e));let s=this,r=e.e;if(r._hx_index==4){let h=r.e,a=[],o=W.TVoid,u=0;for(;u<h.length;){let _=h[u];for(++u;;){let m=_.e;if(m._hx_index==25){let g=m.name,w=m.args;_=m.e}else break}let f=_.e;if(f._hx_index==14){let m=f.e,g=f.args,w=f.name,y=f.ret;if(w!=null){let T=y==null?this.makeMono():this.makeType(y,_),E=W.TFun(this.typeArgs(g,_),T);this.locals.h[w]=E,a.push(function(){return s.currentFunType=E,s.typeExpr(_,Se.NoValue),E})}else{let T=0;for(;T<a.length;){let E=a[T];++T,E()}a=[],h[h.length-1]==_?o=this.typeExpr(_,t):this.typeExpr(_,Se.NoValue)}}else{let m=0;for(;m<a.length;){let g=a[m];++m,g()}a=[],h[h.length-1]==_?o=this.typeExpr(_,t):this.typeExpr(_,Se.NoValue)}}let c=0;for(;c<a.length;){let _=a[c];++c,o=_()}return o}return this.typeExpr(e,t)}edef(e){return e.e}error(e,t){let i=be.ECustom(e),l=new Ce(i,t.pmin,t.pmax,t.origin,t.line);if(!this.isCompletion)throw b.thrown(l)}saveLocals(){let e=new Ee,t=this.locals.h,i=t,l=Object.keys(t),n=l.length,s=0;for(;s<n;){let r=l[s++];e.h[r]=this.locals.h[r]}return e}makeType(e,t){switch(e._hx_index){case 0:let i=e.path,l=e.params,n=this.types,s=i.join("."),r;if(l==null)r=[];else{let C=[],P=0;for(;P<l.length;){let I=l[P];++P,C.push(this.makeType(I,t))}r=C}let h=n.resolve(s,r);if(h==null){let C=be.ECustom("Unknown type "+ne.string(i)),P=new Ce(C,t.pmin,t.pmax,t.origin,t.line);if(!this.isCompletion)throw b.thrown(P);h=W.TDynamic}return h;case 1:let a=e.args,o=e.ret,u=0,c=[],_=0;for(;_<a.length;){let C=a[_];++_,c.push({name:"p"+u++,opt:!1,t:this.makeType(C,t)})}return W.TFun(c,this.makeType(o,t));case 2:let f=e.fields,m=[],g=0;for(;g<f.length;){let C=f[g];++g,m.push({name:C.name,opt:!1,t:this.makeType(C.t,t)})}return W.TAnon(m);case 3:let w=e.t;return this.makeType(w,t);case 4:let y=e.t;return this.makeType(y,t);case 5:let T=e.n,E=e.t;return this.makeType(E,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==W.TDynamic?!1:this.linkLoop(e,W.TDynamic);case 9:let l=t.c,n=t.args,s=0;for(;s<n.length;){let C=n[s];if(++s,this.linkLoop(e,C))return!0}return!1;case 10:let r=t.e,h=t.args,a=0;for(;a<h.length;){let C=h[a];if(++a,this.linkLoop(e,C))return!0}return!1;case 11:let o=t.t,u=t.args,c=0;for(;c<u.length;){let C=u[c];if(++c,this.linkLoop(e,C))return!0}return!1;case 12:let _=t.a,f=t.args,m=0;for(;m<f.length;){let C=f[m];if(++m,this.linkLoop(e,C))return!0}return!1;case 13:let g=t.args,w=t.ret,y=0;for(;y<g.length;){let C=g[y];if(++y,this.linkLoop(e,C.t))return!0}return this.linkLoop(e,w);case 14:let T=t.fields,E=0;for(;E<T.length;){let C=T[E];if(++E,this.linkLoop(e,C.t))return!0}return!1;default:return!1}}link(e,t,i){return this.linkLoop(e,t)?this.follow(t)==e:(t==W.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 l=e.t;switch(t._hx_index){case 0:let g=t.r;return g.r==null?this.link(t,e,g)?(g.r=e,!0):!1:this.typeEq(e,g.r);case 8:let w=t.t,y=l;return this.typeEq(y,w);case 11:let T=t.t,E=t.args;return this.typeEq(e,this.apply(T.t,T.params,E));default:let C=l;return this.typeEq(C,t)}break;case 9:let n=e.c,s=e.args;switch(t._hx_index){case 0:let g=t.r;return g.r==null?this.link(t,e,g)?(g.r=e,!0):!1:this.typeEq(e,g.r);case 8:let w=t.t;return this.typeEq(e,w);case 9:let y=t.c,T=t.args,E=s;if(n==y){let v=0,F=E.length;for(;v<F;){let B=v++;if(!this.typeEq(E[B],T[B]))return!1}return!0}break;case 11:let P=t.t,I=t.args;return this.typeEq(e,this.apply(P.t,P.params,I));default:}break;case 10:let r=e.e,h=e.args;switch(t._hx_index){case 0:let g=t.r;return g.r==null?this.link(t,e,g)?(g.r=e,!0):!1:this.typeEq(e,g.r);case 8:let w=t.t;return this.typeEq(e,w);case 10:let y=t.e,T=t.args,E=h;if(r==y){let v=0,F=E.length;for(;v<F;){let B=v++;if(!this.typeEq(E[B],T[B]))return!1}return!0}break;case 11:let P=t.t,I=t.args;return this.typeEq(e,this.apply(P.t,P.params,I));default:}break;case 11:let a=e.t,o=e.args;switch(t._hx_index){case 0:let g=t.r;return g.r==null?this.link(t,e,g)?(g.r=e,!0):!1:this.typeEq(e,g.r);case 8:let w=t.t,y=o,T=a;return this.typeEq(this.apply(T.t,T.params,y),t);case 11:let E=t.t,C=t.args,P=o;if(a==E){let B=0,A=P.length;for(;B<A;){let L=B++;if(!this.typeEq(P[L],C[L]))return!1}return!0}else{let B=o,A=a;return this.typeEq(this.apply(A.t,A.params,B),t)}break;default:let v=o,F=a;return this.typeEq(this.apply(F.t,F.params,v),t)}break;case 12:let u=e.a,c=e.args;switch(t._hx_index){case 0:let g=t.r;return g.r==null?this.link(t,e,g)?(g.r=e,!0):!1:this.typeEq(e,g.r);case 8:let w=t.t;return this.typeEq(e,w);case 11:let y=t.t,T=t.args;return this.typeEq(e,this.apply(y.t,y.params,T));case 12:let E=t.a,C=t.args,P=c;if(u==E){let v=0,F=P.length;for(;v<F;){let B=v++;if(!this.typeEq(P[B],C[B]))return!1}return!0}break;default:}break;case 13:let _=e.args,f=e.ret;switch(t._hx_index){case 0:let g=t.r;return g.r==null?this.link(t,e,g)?(g.r=e,!0):!1:this.typeEq(e,g.r);case 8:let w=t.t;return this.typeEq(e,w);case 11:let y=t.t,T=t.args;return this.typeEq(e,this.apply(y.t,y.params,T));case 13:let E=t.args,C=t.ret,P=f,I=_;if(I.length==E.length){let v=0,F=I.length;for(;v<F;){let B=v++;if(!this.typeEq(I[B].t,E[B].t))return!1}return this.typeEq(P,C)}break;default:}break;case 14:let m=e.fields;switch(t._hx_index){case 0:let g=t.r;return g.r==null?this.link(t,e,g)?(g.r=e,!0):!1:this.typeEq(e,g.r);case 8:let w=t.t;return this.typeEq(e,w);case 11:let y=t.t,T=t.args;return this.typeEq(e,this.apply(y.t,y.params,T));case 14:let E=t.fields,C=m;if(C.length==E.length){let P=Object.create(null),I=0;for(;I<E.length;){let F=E[I];++I,P[F.name]=F}let v=0;for(;v<C.length;){let F=C[v];++v;let B=P[F.name];if(B==null||!this.typeEq(F.t,B.t))return!1}return!0}break;default:}break;default:switch(t._hx_index){case 0:let g=t.r;return g.r==null?this.link(t,e,g)?(g.r=e,!0):!1:this.typeEq(e,g.r);case 8:let w=t.t;return this.typeEq(e,w);case 11:let y=t.t,T=t.args;return this.typeEq(e,this.apply(y.t,y.params,T));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 c=t.r;return c.r==null?this.link(t,e,c)?(c.r=e,!0):!1:this.tryUnify(e,c.r);case 3:return!0;case 5:return!0;case 8:let _=t.t;return this.tryUnify(e,_);case 11:let f=t.t,m=t.args;return this.tryUnify(e,this.apply(f.t,f.params,m));default:}break;case 5:switch(t._hx_index){case 0:let c=t.r;return c.r==null?this.link(t,e,c)?(c.r=e,!0):!1:this.tryUnify(e,c.r);case 5:return!0;case 8:let _=t.t;return this.tryUnify(e,_);case 11:let f=t.t,m=t.args;return this.tryUnify(e,this.apply(f.t,f.params,m));default:return!0}break;case 8:let l=e.t;switch(t._hx_index){case 0:let c=t.r;return c.r==null?this.link(t,e,c)?(c.r=e,!0):!1:this.tryUnify(e,c.r);case 5:let _=l;return this.tryUnify(_,t);case 8:let f=t.t,m=l;return this.tryUnify(m,t);case 11:let g=t.t,w=t.args;return this.tryUnify(e,this.apply(g.t,g.params,w));default:let y=l;return this.tryUnify(y,t)}break;case 9:let n=e.c,s=e.args;switch(t._hx_index){case 0:let c=t.r;return c.r==null?this.link(t,e,c)?(c.r=e,!0):!1:this.tryUnify(e,c.r);case 5:return!0;case 8:let _=t.t;return this.tryUnify(e,_);case 9:let f=t.c,m=t.args,g=s,w=n;for(;w!=f;){if(w.interfaces!=null){let L=0,z=w.interfaces;for(;L<z.length;){let D=z[L];if(++L,D._hx_index==9){let O=D.c,q=D.args,M=[],U=0;for(;U<q.length;){let G=q[U];++U,M.push(this.apply(G,w.params,g))}let K=W.TInst(O,M);if(this.tryUnify(K,t))return!0}else throw b.thrown("assert")}}let A=w.superClass;if(A==null)return!1;if(A._hx_index==9){let L=A.c,z=A.args,D=[],O=0;for(;O<z.length;){let q=z[O];++O,D.push(this.apply(q,w.params,g))}g=D,w=L}else throw b.thrown("assert")}let y=0,T=g.length;for(;y<T;){let A=y++;if(!this.typeEq(g[A],m[A]))return!1}return!0;case 11:let E=t.t,C=t.args;return this.tryUnify(e,this.apply(E.t,E.params,C));case 14:let P=t.fields,I=s,v=n,F=0,B=P.length;for(;F<B;){let A=F++,L=P[A],z=null,D=v;for(;z=D.fields.h[L.name],z==null;){if(D.superClass==null)return!1;let O=D.superClass;if(O==null)throw b.thrown("assert");if(O._hx_index==9){let q=O.args;D=O.c}else throw b.thrown("assert")}if(!this.typeEq(this.apply(z.t,v.params,I),L.t))return!1}return!0;default:}break;case 11:let r=e.t,h=e.args;switch(t._hx_index){case 0:let c=t.r;return c.r==null?this.link(t,e,c)?(c.r=e,!0):!1:this.tryUnify(e,c.r);case 5:let _=h,f=r;return this.tryUnify(this.apply(f.t,f.params,_),t);case 8:let m=t.t,g=h,w=r;return this.tryUnify(this.apply(w.t,w.params,g),t);case 11:let y=t.t,T=t.args,E=h,C=r;return this.tryUnify(this.apply(C.t,C.params,E),t);default:let P=h,I=r;return this.tryUnify(this.apply(I.t,I.params,P),t)}break;case 13:let a=e.args,o=e.ret;switch(t._hx_index){case 0:let c=t.r;return c.r==null?this.link(t,e,c)?(c.r=e,!0):!1:this.tryUnify(e,c.r);case 5:return!0;case 8:let _=t.t;return this.tryUnify(e,_);case 11:let f=t.t,m=t.args;return this.tryUnify(e,this.apply(f.t,f.params,m));case 12:let g=t.a,w=t.args,y=g.meta,T=g.params,E=g.t;if(g.name=="haxe.Function")return!0;break;case 13:let C=t.args,P=t.ret,I=o,v=a;if(v.length==C.length){let F=0,B=v.length;for(;F<B;){let A=F++,L=v[A],z=C[A];if(z.opt&&!L.opt||!this.tryUnify(z.t,L.t))return!1}return this.tryUnify(I,P)}break;default:}break;case 14:let u=e.fields;switch(t._hx_index){case 0:let c=t.r;return c.r==null?this.link(t,e,c)?(c.r=e,!0):!1:this.tryUnify(e,c.r);case 5:return!0;case 8:let _=t.t;return this.tryUnify(e,_);case 11:let f=t.t,m=t.args;return this.tryUnify(e,this.apply(f.t,f.params,m));case 14:let g=t.fields,w=u;if(g.length==0)return!0;let y=Object.create(null),T=0;for(;T<w.length;){let C=w[T];++T,y[C.name]=C}let E=0;for(;E<g.length;){let C=g[E];++E;let P=y[C.name];if(P==null){if(C.opt)continue;return!1}if(!this.typeEq(P.t,C.t))return!1}return!0;default:}break;default:switch(t._hx_index){case 0:let c=t.r;return c.r==null?this.link(t,e,c)?(c.r=e,!0):!1:this.tryUnify(e,c.r);case 5:return!0;case 8:let _=t.t;return this.tryUnify(e,_);case 11:let f=t.t,m=t.args;return this.tryUnify(e,this.apply(f.t,f.params,m));default:}}return this.typeEq(e,t)}unify(e,t,i){if(!this.tryUnify(e,t)){let l=be.ECustom(Ze.typeStr(e)+" should be "+Ze.typeStr(t)),n=new Ce(l,i.pmin,i.pmax,i.origin,i.line);if(!this.isCompletion)throw b.thrown(n)}}apply(e,t,i){if(i.length!=t.length)throw b.thrown("Invalid number of type parameters");if(i.length==0)return e;let l=new Xi,n=0,s=t.length;for(;n<s;){let a=n++;l.set(t[a],i[a])}let r=null,h=this;return r=function(a){let o=l.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 l=e.name;return e;case 7:let n=e.name;return e;case 8:let s=e.t;return W.TNull(t(s));case 9:let r=e.args;if(r.length==0)return e;{let T=r,E=e.c,C=[],P=0;for(;P<T.length;){let I=T[P];++P,C.push(t(I))}return W.TInst(E,C)}break;case 10:let h=e.args;if(h.length==0)return e;{let T=h,E=e.e,C=[],P=0;for(;P<T.length;){let I=T[P];++P,C.push(t(I))}return W.TEnum(E,C)}break;case 11:let a=e.args;if(a.length==0)return e;{let T=a,E=e.t,C=[],P=0;for(;P<T.length;){let I=T[P];++P,C.push(t(I))}return W.TType(E,C)}break;case 12:let o=e.args;if(o.length==0)return e;{let T=o,E=e.a,C=[],P=0;for(;P<T.length;){let I=T[P];++P,C.push(t(I))}return W.TAbstract(E,C)}break;case 13:let u=e.args,c=e.ret,_=[],f=0;for(;f<u.length;){let T=u[f];++f,_.push({name:T.name,opt:T.opt,t:t(T.t)})}return W.TFun(_,t(c));case 14:let m=e.fields,g=[],w=0;for(;w<m.length;){let T=m[w];++w,g.push({name:T.name,opt:T.opt,t:t(T.t)})}return W.TAnon(g);case 15:let y=e.f;return t(y())}}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 l=e.t,n=e.args;return this.follow(this.apply(l.t,l.params,n));case 15:let s=e.f;return this.follow(s());default:return e}}getFields(e){let t=[],i=this,l=this.follow(e);switch(l._hx_index){case 9:let n=l.c,s=l.args,r=function(c){return i.apply(c,n.params,s)};for(;n!=null;){let c=n.fields.h,_=c,f=Object.keys(c),m=f.length,g=0;for(;g<m;){let y=f[g++],T=n.fields.h[y];if(!T.isPublic||!T.complete)continue;let E=T.name,C=r(T.t);this.allowAsync&&E.startsWith("a_")&&(C=this.unasync(C),E=p.substr(E,2,null)),t.push({name:E,t:C})}if(n.isInterface&&n.interfaces!=null){let y=0,T=n.interfaces;for(;y<T.length;){let E=T[y];++y;let C=0,P=this.getFields(E);for(;C<P.length;){let I=P[C];++C,t.push({name:I.name,t:r(I.t)})}}}if(n.superClass==null)break;let w=n.superClass;if(w==null)break;if(w._hx_index==9){let y=w.c,T=w.args,E=r;r=function(C){return E(i.apply(C,y.params,T))},n=y}else break}break;case 13:let h=l.args,a=l.ret;this.isCompletion&&t.push({name:"bind",t:W.TFun(h,W.TVoid)});break;case 14:let o=l.fields,u=0;for(;u<o.length;){let c=o[u];++u,t.push({name:c.name,t:c.t})}break;default:}return t}getField(e,t,i,l){l==null&&(l=!1);let n=this.follow(e);switch(n._hx_index){case 5:return this.makeMono();case 9:let s=n.c,r=n.args,h=s.fields.h[t];if(h==null&&this.allowAsync&&(h=s.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&&s.isInterface&&s.interfaces!=null){let c=0,_=s.interfaces;for(;c<_.length;){let f=_[c];++c;let m=this.getField(f,t,i,l);if(m!=null)return this.apply(m,s.params,r)}}if(h==null){if(s.superClass==null)return null;let c=this.getField(s.superClass,t,i,l);return c!=null&&(c=this.apply(c,s.params,r)),c}if(!h.isPublic){let c=be.ECustom("Can't access private field "+t+" on "+s.name),_=new Ce(c,i.pmin,i.pmax,i.origin,i.line);if(!this.isCompletion)throw b.thrown(_)}if(l&&!h.canWrite){let c=be.ECustom("Can't write readonly field "+t+" on "+s.name),_=new Ce(c,i.pmin,i.pmax,i.origin,i.line);if(!this.isCompletion)throw b.thrown(_)}let a=h.t;if(h.params!=null){let c=h.params,_=[],f=0,m=h.params.length;for(;f<m;){let g=f++;_.push(this.makeMono())}a=this.apply(a,c,_)}return this.apply(a,s.params,r);case 14:let o=n.fields,u=0;for(;u<o.length;){let c=o[u];if(++u,c.name==t)return c.t}return null;default:return null}}unasync(e){let t=this.follow(e);if(t._hx_index==13){let i=t.args,l=t.ret;if(i.length>0){let n=i.slice(),s=this.follow(n.shift().t);if(s._hx_index==13){let r=s.args,h=s.ret;if(r.length==1){let a=r[0];return W.TFun(n,a.t)}}}}return null}typeExprWith(e,t){let i=this.typeExpr(e,Se.WithType(t));return this.unify(i,t,e),t}makeMono(){return W.TMono({r:null})}makeIterator(e){return W.TAnon([{name:"next",opt:!1,t:W.TFun([],e)},{name:"hasNext",opt:!1,t:W.TFun([],W.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,l=t.constructor,n=t.fields,s=t.interfaces,r=t.isInterface,h=t.meta,a=t.params,o=t.statics,u=t.superClass;return t.name=="String"}else return!1}onCompletion(e,t){if(this.isCompletion)throw b.thrown(new xl(e,t))}typeField(e,t,i,l){let n=this.typeExpr(e,Se.Value);t==null&&this.onCompletion(i,n);let s=this.getField(n,t,i,l);if(s==null){let r=be.ECustom(Ze.typeStr(n)+" has no field "+t),h=new Ce(r,i.pmin,i.pmax,i.origin,i.line);if(!this.isCompletion)throw b.thrown(h);s=W.TDynamic}return s}typeExpr(e,t){if(e==null&&this.isCompletion)return t._hx_index==2?t.t:W.TDynamic;let i=this,l=e.e;switch(l._hx_index){case 0:let h=l.c;switch(h._hx_index){case 0:let ce=h.v;return W.TInt;case 1:let we=h.f;return W.TFloat;case 2:let Fe=h.s;return this.types.t_string}break;case 1:let a=l.v,o=this.locals.h[a];if(o!=null)return o;let u=this.globals.h[a];if(u!=null){if(u==null)return u;if(u._hx_index==15){let ce=u.f;return ce()}else return u}if(this.allowAsync&&(u=this.globals.h["a_"+a],u!=null&&(u=this.unasync(u)),u!=null))return u;switch(a){case"false":case"true":return W.TBool;case"null":return this.makeMono();case"trace":return W.TDynamic;default:if(t._hx_index==2){let Fe=t.t;if(Fe._hx_index==10){let qe=Fe,At=Fe.e,Pt=Fe.args,ht=0,yi=At.constructors;for(;ht<yi.length;){let ri=yi[ht];if(++ht,ri.name==a){if(this.onTopDownEnum(At,a)){let pt=ri.args==null?qe:W.TFun(ri.args,qe);return this.apply(pt,At.params,Pt)}break}}}}if(this.isCompletion)return W.TDynamic;let ce=be.ECustom("Unknown identifier "+a),we=new Ce(ce,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw b.thrown(we)}break;case 2:let c=l.n,_=l.t,f=l.e,m=_==null?this.makeMono():this.makeType(_,e);if(f!=null){let ce=this.typeExpr(f,_==null?Se.Value:Se.WithType(m));_==null?m=ce:this.unify(ce,m,f)}return this.locals.h[c]=m,W.TVoid;case 3:let g=l.e;return this.typeExpr(g,t);case 4:let w=l.e,y=W.TVoid,T=this.saveLocals(),E=0;for(;E<w.length;){let ce=w[E];++E,y=this.typeExpr(ce,ce==w[w.length-1]?t:Se.NoValue)}return this.locals=T,y;case 5:let C=l.e,P=l.f;return this.typeField(C,P,e,!1);case 6:let I=l.op,v=l.e1,F=l.e2;switch(I){case"!=":case"==":let ce=this.typeExpr(v,Se.Value),we=this.typeExpr(F,Se.WithType(ce));return this.tryUnify(ce,we)||this.unify(we,ce,F),W.TBool;case"%":case"*":case"-":case"/":let Fe=this.typeExpr(v,Se.WithType(W.TInt)),qe=this.typeExpr(F,Se.WithType(Fe));this.tryUnify(Fe,qe)||this.unify(qe,Fe,F);let At=this.follow(Fe),Pt=this.follow(qe);switch(At._hx_index){case 2:switch(Pt._hx_index){case 2:return I=="/"?W.TFloat:W.TInt;case 3:case 5:return W.TFloat;default:this.unify(Fe,W.TFloat,v),this.unify(qe,W.TFloat,F)}break;case 3:switch(Pt._hx_index){case 2:case 3:case 5:return W.TFloat;default:this.unify(Fe,W.TFloat,v),this.unify(qe,W.TFloat,F)}break;case 5:switch(Pt._hx_index){case 2:case 3:case 5:return W.TFloat;default:this.unify(Fe,W.TFloat,v),this.unify(qe,W.TFloat,F)}break;default:this.unify(Fe,W.TFloat,v),this.unify(qe,W.TFloat,F)}break;case"+":let ht=this.typeExpr(v,Se.WithType(W.TInt)),yi=this.typeExpr(F,Se.WithType(ht));this.tryUnify(ht,yi);let ri=this.follow(ht),pt=this.follow(yi);switch(ri._hx_index){case 2:switch(pt._hx_index){case 2:return W.TInt;case 3:return W.TFloat;case 5:return W.TDynamic;default:let Ct=ri,xi=pt;if(this.isString(Ct)||this.isString(xi))return this.types.t_string;this.unify(Ct,W.TFloat,v),this.unify(xi,W.TFloat,F)}break;case 3:switch(pt._hx_index){case 2:case 3:return W.TFloat;case 5:return W.TDynamic;default:let Ct=ri,xi=pt;if(this.isString(Ct)||this.isString(xi))return this.types.t_string;this.unify(Ct,W.TFloat,v),this.unify(xi,W.TFloat,F)}break;case 5:return W.TDynamic;default:if(pt._hx_index==5)return W.TDynamic;{let Ct=ri,xi=pt;if(this.isString(Ct)||this.isString(xi))return this.types.t_string;this.unify(Ct,W.TFloat,v),this.unify(xi,W.TFloat,F)}}break;case"...":return this.typeExprWith(v,W.TInt),this.typeExprWith(F,W.TInt),this.makeIterator(W.TInt);case"&":case"<<":case">>":case">>>":case"^":case"|":return this.typeExprWith(v,W.TInt),this.typeExprWith(F,W.TInt),W.TInt;case"<":case"<=":case">":case">=":let qt=this.typeExpr(v,Se.Value),Ai=this.typeExpr(F,Se.WithType(qt));this.tryUnify(qt,Ai)||this.unify(Ai,qt,F);let sl=this.follow(qt);switch(sl._hx_index){case 2:case 3:case 4:break;case 9:let Ct=sl.c,xi=sl.args,an=Ct.constructor,An=Ct.fields,Dn=Ct.interfaces,Rn=Ct.isInterface,Vn=Ct.meta,Un=Ct.params,qn=Ct.statics,Wn=Ct.superClass;if(Ct.name!="String"){let Mn=be.ECustom("Cannot compare "+Ze.typeStr(qt)),Fn=new Ce(Mn,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw b.thrown(Fn)}break;default:let Pn=be.ECustom("Cannot compare "+Ze.typeStr(qt)),Nn=new Ce(Pn,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw b.thrown(Nn)}return W.TBool;case"=":if(this.allowDefine){let Ct=v.e;if(Ct._hx_index==1){let xi=Ct.v;if(!Object.prototype.hasOwnProperty.call(this.locals.h,xi)&&!Object.prototype.hasOwnProperty.call(this.globals.h,xi)){let an=this.typeExpr(F,Se.Value);return this.locals.h[xi]=an,an}}}let vl,Yl=v.e;if(Yl._hx_index==5){let Ct=Yl.e,xi=Yl.f;vl=this.typeField(Ct,xi,v,!0)}else vl=this.typeExpr(v,Se.Value);return this.typeExprWith(F,vl),vl;case"&&":case"||":return this.typeExprWith(v,W.TBool),this.typeExprWith(F,W.TBool),W.TBool;default:if(p.cca(I,I.length-1)==61){let Ct=this.typeExpr(this.mk(V.EBinop(p.substr(I,0,I.length-1),v,F),e),t);return this.typeExpr(this.mk(V.EBinop("=",v,F),e),t)}let On=be.ECustom("Unsupported operation "+I),In=new Ce(On,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw b.thrown(In)}break;case 7:let B=l.prefix,A=l.op,L=l.e,z=this.typeExpr(L,Se.Value);switch(A){case"!":return this.unify(z,W.TBool,L),z;case"++":case"-":case"--":return this.unify(z,W.TInt,L),z;default:}break;case 8:let D=l.e,O=l.params,q=D.e;if(q._hx_index==5&&q.f=="bind"){let ce=q.e,we=this.typeExpr(ce,Se.Value);if(we._hx_index==13){let Fe=we.args,qe=we.ret,At=Fe.slice(),Pt=0;for(;Pt<O.length;){let ht=O[Pt];++Pt;let yi=At.shift();if(yi==null){let ri=be.ECustom("Too many arguments"),pt=new Ce(ri,ht.pmin,ht.pmax,ht.origin,ht.line);if(!this.isCompletion)throw b.thrown(pt);return W.TFun([],qe)}this.typeExprWith(ht,yi.t)}return W.TFun(At,qe)}}let M=D.e,U;if(M._hx_index==1){let ce=M.v;if(t._hx_index==2){let we=t.t;if(we._hx_index==10){let Fe=we.e,qe=we.args;U=t}else U=Se.Value}else U=Se.Value}else U=Se.Value;let K=this.typeExpr(D,U),G=this.follow(K);switch(G._hx_index){case 5:let ce=0;for(;ce<O.length;){let pt=O[ce];++ce,this.typeExpr(pt,Se.Value)}return this.makeMono();case 13:let we=G.args,Fe=G.ret,qe=0,At=O.length;for(;qe<At;){let pt=qe++,qt=we[pt];if(qt==null){let sl=O[pt],vl=be.ECustom("Too many arguments"),Yl=new Ce(vl,sl.pmin,sl.pmax,sl.origin,sl.line);if(!this.isCompletion)throw b.thrown(Yl);break}let Ai=this.typeExpr(O[pt],qt==null?Se.Value:Se.WithType(qt.t));this.unify(Ai,qt.t,O[pt])}let Pt=O.length,ht=we.length;for(;Pt<ht;){let pt=Pt++;if(!we[pt].opt){let qt=be.ECustom("Missing argument "+we[pt].name+":"+Ze.typeStr(we[pt].t)),Ai=new Ce(qt,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw b.thrown(Ai)}}return Fe;default:let yi=be.ECustom(Ze.typeStr(K)+" cannot be called"),ri=new Ce(yi,D.pmin,D.pmax,D.origin,D.line);if(!this.isCompletion)throw b.thrown(ri);return this.makeMono()}break;case 9:let Y=l.cond,$=l.e1,se=l.e2;this.typeExprWith(Y,W.TBool);let ue=this.typeExpr($,t);if(se==null)return ue;let oe=this.typeExpr(se,t);if(t==Se.NoValue)return W.TVoid;if(this.tryUnify(oe,ue))return ue;if(this.tryUnify(ue,oe))return oe;this.unify(oe,ue,se);break;case 10:let ge=l.cond,me=l.e;return this.typeExprWith(ge,W.TBool),this.typeExpr(me,Se.NoValue),W.TVoid;case 11:let de=l.v,Oe=l.it,Ve=l.e,je=this.saveLocals(),et=this.typeExpr(Oe,Se.Value),Ue=this.getIteratorType(Oe,et);return this.locals.h[de]=Ue,this.typeExpr(Ve,Se.NoValue),this.locals=je,W.TVoid;case 12:case 13:return W.TVoid;case 14:let Ge=l.args,nt=l.e,De=l.name,H=l.ret,ie=null,R=null,ee=null;if(this.currentFunType!=null){let ce=this.currentFunType;if(ce._hx_index==13){let we=ce.args,Fe=ce.ret;ie=this.currentFunType,R=Fe,ee=we}else throw b.thrown("assert");this.currentFunType=null}else R=H==null?this.makeMono():this.makeType(H,e);let X=this.saveLocals(),Q=this.allowReturn,ae=this.allowDefine,_e=this.hasReturn;this.allowReturn=R,this.allowDefine=!1,this.hasReturn=!1;let xe=null,Ye;if(De!=null){let ce;if(t._hx_index==2){let we=this.follow(t.t);if(we._hx_index==13){let Fe=we.args,qe=we.ret;ce=!0}else ce=!1}else ce=!1;Ye=!ce}else Ye=!1;if(Ye){let ce=this.events.h[De];ce!=null&&(t=Se.WithType(ce))}if(t._hx_index==2){let ce=this.follow(t.t);if(ce._hx_index==13){let we=ce.args,Fe=ce.ret;xe=we,this.unify(R,Fe,e)}}ee==null&&(ee=this.typeArgs(Ge,e));let gt=0,Be=ee.length;for(;gt<Be;){let ce=gt++,we=ee[ce];if(xe!=null)if(ce<xe.length)this.unify(xe[ce].t,we.t,e);else{let Fe=be.ECustom("Extra argument "+we.name),qe=new Ce(Fe,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw b.thrown(qe)}this.locals.h[we.name]=we.t}if(xe!=null&&ee.length<xe.length){let ce="Missing "+(xe.length-ee.length)+" arguments (",we=[],Fe=ee.length,qe=xe.length;for(;Fe<qe;){let ht=Fe++;we.push(Ze.typeStr(xe[ht].t))}let At=be.ECustom(ce+we.join(",")+")"),Pt=new Ce(At,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw b.thrown(Pt)}if(this.typeExpr(nt,Se.NoValue),!this.hasReturn&&!this.tryUnify(R,W.TVoid)){let ce=be.ECustom("Missing return "+Ze.typeStr(R)),we=new Ce(ce,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw b.thrown(we)}return this.allowDefine=ae,this.allowReturn=Q,this.hasReturn=_e,this.locals=X,ie==null&&(ie=W.TFun(ee,R),De!=null&&(X.h[De]=ie)),ie;case 15:let _t=l.e,ve=_t==null?W.TVoid:this.typeExpr(_t,this.allowReturn==null?Se.Value:Se.WithType(this.allowReturn));if(this.hasReturn=!0,this.allowReturn==null){let ce=be.ECustom("Return not allowed here"),we=new Ce(ce,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw b.thrown(we)}else this.unify(ve,this.allowReturn,_t??e);return this.makeMono();case 16:let Pe=l.e,ot=l.index;this.typeExprWith(ot,W.TInt);let tt=this.typeExpr(Pe,Se.Value),bt=this.follow(tt);if(bt._hx_index==9){let ce=bt.c,we=bt.args,Fe=ce.constructor,qe=ce.fields,At=ce.interfaces,Pt=ce.isInterface,ht=ce.meta,yi=ce.params,ri=ce.statics,pt=ce.superClass;if(ce.name=="Array"){if(we.length==1)return we[0];{let qt=be.ECustom(Ze.typeStr(tt)+" is not an Array"),Ai=new Ce(qt,Pe.pmin,Pe.pmax,Pe.origin,Pe.line);if(!this.isCompletion)throw b.thrown(Ai)}}else{let qt=be.ECustom(Ze.typeStr(tt)+" is not an Array"),Ai=new Ce(qt,Pe.pmin,Pe.pmax,Pe.origin,Pe.line);if(!this.isCompletion)throw b.thrown(Ai)}}else{let ce=be.ECustom(Ze.typeStr(tt)+" is not an Array"),we=new Ce(ce,Pe.pmin,Pe.pmax,Pe.origin,Pe.line);if(!this.isCompletion)throw b.thrown(we)}break;case 17:let Kt=l.e,ft=null,li=0;for(;li<Kt.length;){let ce=Kt[li];++li;let we=this.typeExpr(ce,ft==null?Se.Value:Se.WithType(ft));ft==null?ft=we:this.tryUnify(we,ft)||(this.tryUnify(ft,we)?ft=we:this.unify(we,ft,ce))}return ft==null&&(ft=this.makeMono()),this.types.getType("Array",[ft]);case 18:let $e=l.cl,Bt=l.params;break;case 19:let It=l.e;return this.typeExpr(It,Se.Value),this.makeMono();case 20:let Lt=l.e,mt=l.v,Vt=l.t,Ht=l.ecatch,Ut=this.typeExpr(Lt,t),ni=this.locals.h[mt],si=this.locals,jt=this.makeType(Vt,Ht);si.h[mt]=jt;let it=this.typeExpr(Ht,t);if(ni!=null)this.locals.h[mt]=ni;else{let ce=this.locals;Object.prototype.hasOwnProperty.call(ce.h,mt)&&delete ce.h[mt]}return t==Se.NoValue?W.TVoid:this.tryUnify(Ut,it)?it:(this.unify(it,Ut,Ht),Ut);case 21:let ki=l.fl;if(t._hx_index==2){let ce=this.follow(t.t);if(ce._hx_index==14){let we=ce.fields;if(we.length>0){let Fe=Object.create(null),qe=0;for(;qe<we.length;){let ht=we[qe];++qe,Fe[ht.name]=ht}let At=[],Pt=0;for(;Pt<ki.length;){let ht=ki[Pt];++Pt;let yi=Fe[ht.name],ri;if(yi==null){let pt=ht.e,qt=be.ECustom("Extra field "+ht.name),Ai=new Ce(qt,pt.pmin,pt.pmax,pt.origin,pt.line);if(!this.isCompletion)throw b.thrown(Ai);ri=W.TDynamic}else ri=yi.t;At.push({t:this.typeExprWith(ht.e,ri),opt:!1,name:ht.name})}return W.TAnon(At)}else{let Fe=[],qe=0;for(;qe<ki.length;){let At=ki[qe];++qe,Fe.push({t:this.typeExpr(At.e,Se.Value),opt:!1,name:At.name})}return W.TAnon(Fe)}}else{let we=[],Fe=0;for(;Fe<ki.length;){let qe=ki[Fe];++Fe,we.push({t:this.typeExpr(qe.e,Se.Value),opt:!1,name:qe.name})}return W.TAnon(we)}}else{let ce=[],we=0;for(;we<ki.length;){let Fe=ki[we];++we,ce.push({t:this.typeExpr(Fe.e,Se.Value),opt:!1,name:Fe.name})}return W.TAnon(ce)}break;case 22:let ye=l.cond,lt=l.e1,ct=l.e2;this.typeExprWith(ye,W.TBool);let rt=this.typeExpr(lt,t);if(ct==null)return rt;let dt=this.typeExpr(ct,t);if(t==Se.NoValue)return W.TVoid;if(this.tryUnify(dt,rt))return rt;if(this.tryUnify(rt,dt))return dt;this.unify(dt,rt,ct);break;case 23:let xt=l.e,St=l.cases,Jt=l.defaultExpr,wt=null,Ql=this.typeExpr(xt,Se.Value),fl=0;for(;fl<St.length;){let ce=St[fl];++fl;let we=0,Fe=ce.values;for(;we<Fe.length;){let Pt=Fe[we];++we;let ht=this.typeExpr(Pt,Se.WithType(Ql));this.unify(ht,Ql,Pt)}let qe=this.typeExpr(ce.expr,t),At=ce.expr;t!=Se.NoValue&&(wt==null?wt=qe:i.tryUnify(qe,wt)||(i.unify(wt,qe,At),wt=qe))}if(Jt!=null){let ce=this.typeExpr(Jt,t);t!=Se.NoValue&&(wt==null?wt=ce:i.tryUnify(ce,wt)||(i.unify(wt,ce,Jt),wt=ce))}return t==Se.NoValue?W.TVoid:wt??this.makeMono();case 24:let Qi=l.cond,rn=l.e;return this.typeExprWith(Qi,W.TBool),this.typeExpr(rn,Se.NoValue),W.TVoid;case 25:let Ln=l.args,Tn=l.name,En=l.e;return Tn==":untyped"&&this.allowUntypedMeta?this.makeMono():this.typeExpr(En,t);case 26:let mn=l.e,Sn=l.t,hn=this.makeType(Sn,e),vn=this.typeExpr(mn,Se.WithType(hn));return this.unify(vn,hn,mn),hn}let n=e.e,s=be.ECustom("Don't know how to type "+Qe[n.__enum__].__constructs__[n._hx_index]._hx_name),r=new Ce(s,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw b.thrown(r);return W.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,u=r.interfaces,c=r.isInterface,_=r.meta,f=r.params,m=r.statics,g=r.superClass;if(r.name=="Array"&&h.length==1)return h[0]}let l=this.getField(t,"iterator",e);if(l==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)}l!=null&&(l==null?l=null:l._hx_index==13&&l.args.length==0?l=l.ret:l=null);let n=this.makeMono(),s=this.makeIterator(n);return this.unify(l??t,s,e),n}static typeStr(e){switch(e._hx_index){case 0:let t=e.r;return t.r==null?"Unknown":Ze.typeStr(t.r);case 6:return e.name;case 7:return"?"+e.name;case 8:let n=e.t;return"Null<"+Ze.typeStr(n)+">";case 9:let s=e.c,r=e.args,h=s.name,a;if(r.length==0)a="";else{let A=[],L=0;for(;L<r.length;){let z=r[L];++L,A.push(Ze.typeStr(z))}a="<"+A.join(",")+">"}return h+a;case 10:let o=e.e,u=e.args,c=o.name,_;if(u.length==0)_="";else{let A=[],L=0;for(;L<u.length;){let z=u[L];++L,A.push(Ze.typeStr(z))}_="<"+A.join(",")+">"}return c+_;case 11:let f=e.t,m=e.args;if(f.name=="hscript.TypeCheck")return Ze.typeStr(m[1]);{let A=f.name,L;if(m.length==0)L="";else{let z=[],D=0;for(;D<m.length;){let O=m[D];++D,z.push(Ze.typeStr(O))}L="<"+z.join(",")+">"}return A+L}break;case 12:let g=e.a,w=e.args,y=g.name,T;if(w.length==0)T="";else{let A=[],L=0;for(;L<w.length;){let z=w[L];++L,A.push(Ze.typeStr(z))}T="<"+A.join(",")+">"}return y+T;case 13:let E=e.args,C=e.ret,P=[],I=0;for(;I<E.length;){let A=E[I];++I,P.push((A.opt?"?":"")+(A.name==""?"":A.name+":")+Ze.typeStr(A.t))}return"("+P.join(", ")+") -> "+Ze.typeStr(C);case 14:let v=e.fields,F=[],B=0;for(;B<v.length;){let A=v[B];++B,F.push((A.opt?"?":"")+A.name+":"+Ze.typeStr(A.t))}return"{"+F.join(", ")+"}";default:return p.substr(Qe[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 l=e.t;t(l);break;case 9:let n=e.c,s=e.args,r=0;for(;r<s.length;){let I=s[r];++r,t(I)}break;case 10:let h=e.e,a=e.args,o=0;for(;o<a.length;){let I=a[o];++o,t(I)}break;case 11:let u=e.t,c=e.args,_=0;for(;_<c.length;){let I=c[_];++_,t(I)}break;case 12:let f=e.a,m=e.args,g=0;for(;g<m.length;){let I=m[g];++g,t(I)}break;case 13:let w=e.args,y=e.ret,T=0;for(;T<w.length;){let I=w[T];++T,t(I.t)}t(y);break;case 14:let E=e.fields,C=0;for(;C<E.length;){let I=E[C];++C,t(I.t)}break;case 15:let P=e.f;t(P());break;default:}}}j["hscript.Checker"]=Ze,Ze.__name__="hscript.Checker",Object.assign(Ze.prototype,{__class__:Ze});var _i=Qe["hscript.Const"]={__ename__:"hscript.Const",__constructs__:null,CInt:(d=function(k){return{_hx_index:0,v:k,__enum__:"hscript.Const",toString:S}},d._hx_name="CInt",d.__params__=["v"],d),CFloat:(d=function(k){return{_hx_index:1,f:k,__enum__:"hscript.Const",toString:S}},d._hx_name="CFloat",d.__params__=["f"],d),CString:(d=function(k){return{_hx_index:2,s:k,__enum__:"hscript.Const",toString:S}},d._hx_name="CString",d.__params__=["s"],d)};_i.__constructs__=[_i.CInt,_i.CFloat,_i.CString];var V=Qe["hscript.ExprDef"]={__ename__:"hscript.ExprDef",__constructs__:null,EConst:(d=function(k){return{_hx_index:0,c:k,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="EConst",d.__params__=["c"],d),EIdent:(d=function(k){return{_hx_index:1,v:k,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="EIdent",d.__params__=["v"],d),EVar:(d=function(k,e,t){return{_hx_index:2,n:k,t:e,e:t,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="EVar",d.__params__=["n","t","e"],d),EParent:(d=function(k){return{_hx_index:3,e:k,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="EParent",d.__params__=["e"],d),EBlock:(d=function(k){return{_hx_index:4,e:k,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="EBlock",d.__params__=["e"],d),EField:(d=function(k,e){return{_hx_index:5,e:k,f:e,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="EField",d.__params__=["e","f"],d),EBinop:(d=function(k,e,t){return{_hx_index:6,op:k,e1:e,e2:t,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="EBinop",d.__params__=["op","e1","e2"],d),EUnop:(d=function(k,e,t){return{_hx_index:7,op:k,prefix:e,e:t,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="EUnop",d.__params__=["op","prefix","e"],d),ECall:(d=function(k,e){return{_hx_index:8,e:k,params:e,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="ECall",d.__params__=["e","params"],d),EIf:(d=function(k,e,t){return{_hx_index:9,cond:k,e1:e,e2:t,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="EIf",d.__params__=["cond","e1","e2"],d),EWhile:(d=function(k,e){return{_hx_index:10,cond:k,e,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="EWhile",d.__params__=["cond","e"],d),EFor:(d=function(k,e,t){return{_hx_index:11,v:k,it:e,e:t,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="EFor",d.__params__=["v","it","e"],d),EBreak:{_hx_name:"EBreak",_hx_index:12,__enum__:"hscript.ExprDef",toString:S},EContinue:{_hx_name:"EContinue",_hx_index:13,__enum__:"hscript.ExprDef",toString:S},EFunction:(d=function(k,e,t,i){return{_hx_index:14,args:k,e,name:t,ret:i,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="EFunction",d.__params__=["args","e","name","ret"],d),EReturn:(d=function(k){return{_hx_index:15,e:k,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="EReturn",d.__params__=["e"],d),EArray:(d=function(k,e){return{_hx_index:16,e:k,index:e,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="EArray",d.__params__=["e","index"],d),EArrayDecl:(d=function(k){return{_hx_index:17,e:k,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="EArrayDecl",d.__params__=["e"],d),ENew:(d=function(k,e){return{_hx_index:18,cl:k,params:e,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="ENew",d.__params__=["cl","params"],d),EThrow:(d=function(k){return{_hx_index:19,e:k,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="EThrow",d.__params__=["e"],d),ETry:(d=function(k,e,t,i){return{_hx_index:20,e:k,v:e,t,ecatch:i,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="ETry",d.__params__=["e","v","t","ecatch"],d),EObject:(d=function(k){return{_hx_index:21,fl:k,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="EObject",d.__params__=["fl"],d),ETernary:(d=function(k,e,t){return{_hx_index:22,cond:k,e1:e,e2:t,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="ETernary",d.__params__=["cond","e1","e2"],d),ESwitch:(d=function(k,e,t){return{_hx_index:23,e:k,cases:e,defaultExpr:t,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="ESwitch",d.__params__=["e","cases","defaultExpr"],d),EDoWhile:(d=function(k,e){return{_hx_index:24,cond:k,e,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="EDoWhile",d.__params__=["cond","e"],d),EMeta:(d=function(k,e,t){return{_hx_index:25,name:k,args:e,e:t,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="EMeta",d.__params__=["name","args","e"],d),ECheckType:(d=function(k,e){return{_hx_index:26,e:k,t:e,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="ECheckType",d.__params__=["e","t"],d)};V.__constructs__=[V.EConst,V.EIdent,V.EVar,V.EParent,V.EBlock,V.EField,V.EBinop,V.EUnop,V.ECall,V.EIf,V.EWhile,V.EFor,V.EBreak,V.EContinue,V.EFunction,V.EReturn,V.EArray,V.EArrayDecl,V.ENew,V.EThrow,V.ETry,V.EObject,V.ETernary,V.ESwitch,V.EDoWhile,V.EMeta,V.ECheckType];var $t=Qe["hscript.CType"]={__ename__:"hscript.CType",__constructs__:null,CTPath:(d=function(k,e){return{_hx_index:0,path:k,params:e,__enum__:"hscript.CType",toString:S}},d._hx_name="CTPath",d.__params__=["path","params"],d),CTFun:(d=function(k,e){return{_hx_index:1,args:k,ret:e,__enum__:"hscript.CType",toString:S}},d._hx_name="CTFun",d.__params__=["args","ret"],d),CTAnon:(d=function(k){return{_hx_index:2,fields:k,__enum__:"hscript.CType",toString:S}},d._hx_name="CTAnon",d.__params__=["fields"],d),CTParent:(d=function(k){return{_hx_index:3,t:k,__enum__:"hscript.CType",toString:S}},d._hx_name="CTParent",d.__params__=["t"],d),CTOpt:(d=function(k){return{_hx_index:4,t:k,__enum__:"hscript.CType",toString:S}},d._hx_name="CTOpt",d.__params__=["t"],d),CTNamed:(d=function(k,e){return{_hx_index:5,n:k,t:e,__enum__:"hscript.CType",toString:S}},d._hx_name="CTNamed",d.__params__=["n","t"],d)};$t.__constructs__=[$t.CTPath,$t.CTFun,$t.CTAnon,$t.CTParent,$t.CTOpt,$t.CTNamed];class Ce{constructor(e,t,i,l,n){this.e=e,this.pmin=t,this.pmax=i,this.origin=l,this.line=n}toString(){return ol.errorToString(this)}}j["hscript.Error"]=Ce,Ce.__name__="hscript.Error",Object.assign(Ce.prototype,{__class__:Ce});var be=Qe["hscript.ErrorDef"]={__ename__:"hscript.ErrorDef",__constructs__:null,EInvalidChar:(d=function(k){return{_hx_index:0,c:k,__enum__:"hscript.ErrorDef",toString:S}},d._hx_name="EInvalidChar",d.__params__=["c"],d),EUnexpected:(d=function(k){return{_hx_index:1,s:k,__enum__:"hscript.ErrorDef",toString:S}},d._hx_name="EUnexpected",d.__params__=["s"],d),EUnterminatedString:{_hx_name:"EUnterminatedString",_hx_index:2,__enum__:"hscript.ErrorDef",toString:S},EUnterminatedComment:{_hx_name:"EUnterminatedComment",_hx_index:3,__enum__:"hscript.ErrorDef",toString:S},EInvalidPreprocessor:(d=function(k){return{_hx_index:4,msg:k,__enum__:"hscript.ErrorDef",toString:S}},d._hx_name="EInvalidPreprocessor",d.__params__=["msg"],d),EUnknownVariable:(d=function(k){return{_hx_index:5,v:k,__enum__:"hscript.ErrorDef",toString:S}},d._hx_name="EUnknownVariable",d.__params__=["v"],d),EInvalidIterator:(d=function(k){return{_hx_index:6,v:k,__enum__:"hscript.ErrorDef",toString:S}},d._hx_name="EInvalidIterator",d.__params__=["v"],d),EInvalidOp:(d=function(k){return{_hx_index:7,op:k,__enum__:"hscript.ErrorDef",toString:S}},d._hx_name="EInvalidOp",d.__params__=["op"],d),EInvalidAccess:(d=function(k){return{_hx_index:8,f:k,__enum__:"hscript.ErrorDef",toString:S}},d._hx_name="EInvalidAccess",d.__params__=["f"],d),ECustom:(d=function(k){return{_hx_index:9,msg:k,__enum__:"hscript.ErrorDef",toString:S}},d._hx_name="ECustom",d.__params__=["msg"],d)};be.__constructs__=[be.EInvalidChar,be.EUnexpected,be.EUnterminatedString,be.EUnterminatedComment,be.EInvalidPreprocessor,be.EUnknownVariable,be.EInvalidIterator,be.EInvalidOp,be.EInvalidAccess,be.ECustom];var ji=Qe["hscript.ModuleDecl"]={__ename__:"hscript.ModuleDecl",__constructs__:null,DPackage:(d=function(k){return{_hx_index:0,path:k,__enum__:"hscript.ModuleDecl",toString:S}},d._hx_name="DPackage",d.__params__=["path"],d),DImport:(d=function(k,e){return{_hx_index:1,path:k,everything:e,__enum__:"hscript.ModuleDecl",toString:S}},d._hx_name="DImport",d.__params__=["path","everything"],d),DClass:(d=function(k){return{_hx_index:2,c:k,__enum__:"hscript.ModuleDecl",toString:S}},d._hx_name="DClass",d.__params__=["c"],d),DTypedef:(d=function(k){return{_hx_index:3,c:k,__enum__:"hscript.ModuleDecl",toString:S}},d._hx_name="DTypedef",d.__params__=["c"],d)};ji.__constructs__=[ji.DPackage,ji.DImport,ji.DClass,ji.DTypedef];var Ei=Qe["hscript.FieldAccess"]={__ename__:"hscript.FieldAccess",__constructs__:null,APublic:{_hx_name:"APublic",_hx_index:0,__enum__:"hscript.FieldAccess",toString:S},APrivate:{_hx_name:"APrivate",_hx_index:1,__enum__:"hscript.FieldAccess",toString:S},AInline:{_hx_name:"AInline",_hx_index:2,__enum__:"hscript.FieldAccess",toString:S},AOverride:{_hx_name:"AOverride",_hx_index:3,__enum__:"hscript.FieldAccess",toString:S},AStatic:{_hx_name:"AStatic",_hx_index:4,__enum__:"hscript.FieldAccess",toString:S},AMacro:{_hx_name:"AMacro",_hx_index:5,__enum__:"hscript.FieldAccess",toString:S}};Ei.__constructs__=[Ei.APublic,Ei.APrivate,Ei.AInline,Ei.AOverride,Ei.AStatic,Ei.AMacro];var Fl=Qe["hscript.FieldKind"]={__ename__:"hscript.FieldKind",__constructs__:null,KFunction:(d=function(k){return{_hx_index:0,f:k,__enum__:"hscript.FieldKind",toString:S}},d._hx_name="KFunction",d.__params__=["f"],d),KVar:(d=function(k){return{_hx_index:1,v:k,__enum__:"hscript.FieldKind",toString:S}},d._hx_name="KVar",d.__params__=["v"],d)};Fl.__constructs__=[Fl.KFunction,Fl.KVar];var J=Qe["hscript.Token"]={__ename__:"hscript.Token",__constructs__:null,TEof:{_hx_name:"TEof",_hx_index:0,__enum__:"hscript.Token",toString:S},TConst:(d=function(k){return{_hx_index:1,c:k,__enum__:"hscript.Token",toString:S}},d._hx_name="TConst",d.__params__=["c"],d),TId:(d=function(k){return{_hx_index:2,s:k,__enum__:"hscript.Token",toString:S}},d._hx_name="TId",d.__params__=["s"],d),TOp:(d=function(k){return{_hx_index:3,s:k,__enum__:"hscript.Token",toString:S}},d._hx_name="TOp",d.__params__=["s"],d),TPOpen:{_hx_name:"TPOpen",_hx_index:4,__enum__:"hscript.Token",toString:S},TPClose:{_hx_name:"TPClose",_hx_index:5,__enum__:"hscript.Token",toString:S},TBrOpen:{_hx_name:"TBrOpen",_hx_index:6,__enum__:"hscript.Token",toString:S},TBrClose:{_hx_name:"TBrClose",_hx_index:7,__enum__:"hscript.Token",toString:S},TDot:{_hx_name:"TDot",_hx_index:8,__enum__:"hscript.Token",toString:S},TQuestionDot:{_hx_name:"TQuestionDot",_hx_index:9,__enum__:"hscript.Token",toString:S},TComma:{_hx_name:"TComma",_hx_index:10,__enum__:"hscript.Token",toString:S},TSemicolon:{_hx_name:"TSemicolon",_hx_index:11,__enum__:"hscript.Token",toString:S},TBkOpen:{_hx_name:"TBkOpen",_hx_index:12,__enum__:"hscript.Token",toString:S},TBkClose:{_hx_name:"TBkClose",_hx_index:13,__enum__:"hscript.Token",toString:S},TQuestion:{_hx_name:"TQuestion",_hx_index:14,__enum__:"hscript.Token",toString:S},TDoubleDot:{_hx_name:"TDoubleDot",_hx_index:15,__enum__:"hscript.Token",toString:S},TMeta:(d=function(k){return{_hx_index:16,s:k,__enum__:"hscript.Token",toString:S}},d._hx_name="TMeta",d.__params__=["s"],d),TPrepro:(d=function(k){return{_hx_index:17,s:k,__enum__:"hscript.Token",toString:S}},d._hx_name="TPrepro",d.__params__=["s"],d)};J.__constructs__=[J.TEof,J.TConst,J.TId,J.TOp,J.TPOpen,J.TPClose,J.TBrOpen,J.TBrClose,J.TDot,J.TQuestionDot,J.TComma,J.TSemicolon,J.TBkOpen,J.TBkClose,J.TQuestion,J.TDoubleDot,J.TMeta,J.TPrepro];class tl{constructor(){this.uid=0,this.preprocesorValues=new Ee,this.line=1,this.opChars="+*/-=!><&|^%~",this.identChars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_";let e=[["%"],["*","/"],["+","-"],["<<",">>",">>>"],["|","&","^"],["==","!=",">","<",">=","<="],["..."],["&&"],["||"],["=","+=","-=","*=","/=","%=","<<=",">>=",">>>=","|=","&=","^=","=>"],["->"]];this.opPriority=new Ee,this.opRightAssoc=new Ee;let t=0,i=e.length;for(;t<i;){let h=t++,a=0,o=e[h];for(;a<o.length;){let u=o[a];++a,this.opPriority.h[u]=h,h==9&&(this.opRightAssoc.h[u]=!0)}}let l="!";this.opPriority.h[l]=l=="++"||l=="--"?-1:-2;let n="++";this.opPriority.h[n]=n=="++"||n=="--"?-1:-2;let s="--";this.opPriority.h[s]=s=="++"||s=="--"?-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 b.thrown(new Ce(e,t,i,this.origin,this.line))}invalidChar(e){if(!this.resumeErrors)throw b.thrown(new Ce(be.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 Pl,this.offset=t,this.char=-1,this.ops=[],this.idents=[],this.uid=0;let i=0,l=this.opChars.length;for(;i<l;){let r=i++;this.ops[p.cca(this.opChars,r)]=!0}let n=0,s=this.identChars.length;for(;n<s;){let r=n++;this.idents[p.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 l=[];for(;;){let n=this.token();if(n==J.TEof)break;this.tokens.push({t:n,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,this.parseFullExpr(l)}if(l.length==1)return l[0];{let n=V.EBlock(l),s=0,r=null;return n==null?null:(s==null&&(s=this.tokenMin),r==null&&(r=this.tokenMax),{e:n,pmin:s,pmax:r,origin:this.origin,line:this.line})}}unexpected(e){let t=be.EUnexpected(this.tokenString(e));if(!this.resumeErrors)throw b.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();pe.enumEq(t,e)||this.unexpected(t)}maybe(e){let t=this.token();return pe.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,l=t.t,n=t.e;if(n!=null)return this.isBlock(n);if(l!=null){if(l==null)return!1;if(l._hx_index==2){let se=l.fields;return!0}else return!1}else return!1;break;case 4:let s=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,u=t.prefix,c=t.e;return u?!1:this.isBlock(c);case 9:let _=t.cond,f=t.e1,m=t.e2;return m!=null?this.isBlock(m):this.isBlock(f);case 10:let g=t.cond,w=t.e;return this.isBlock(w);case 11:let y=t.v,T=t.it,E=t.e;return this.isBlock(E);case 14:let C=t.args,P=t.name,I=t.ret,v=t.e;return this.isBlock(v);case 15:let F=t.e;return F!=null?this.isBlock(F):!1;case 20:let B=t.e,A=t.v,L=t.t,z=t.ecatch;return this.isBlock(z);case 21:let D=t.fl;return!0;case 23:let O=t.e,q=t.cases,M=t.defaultExpr;return!0;case 24:let U=t.cond,K=t.e;return this.isBlock(K);case 25:let G=t.name,Y=t.args,$=t.e;return this.isBlock($);default:return!1}}parseFullExpr(e){let t=this.parseExpr();e.push(t);let i=this.token();for(;;){let l;if(i==J.TComma&&t!=null){let n=t.e;if(n._hx_index==2){let s=n.n,r=n.t,h=n.e;l=!0}else l=!1}else l=!1;if(!l)break;t=this.parseStructure("var"),e.push(t),i=this.token()}i!=J.TSemicolon&&i!=J.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!=J.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=V.EObject(t),l=e,n=null,s;return i==null?s=null:(l==null&&(l=this.tokenMin),n==null&&(n=this.tokenMax),s={e:i,pmin:l,pmax:n,origin:this.origin,line:this.line}),this.parseExprNext(s)}parseExpr(){let e=this.token(),t=this.tokenMin;switch(e._hx_index){case 1:let i=e.c,l=V.EConst(i),n=null,s=null,r;return l==null?r=null:(n==null&&(n=this.tokenMin),s==null&&(s=this.tokenMax),r={e:l,pmin:n,pmax:s,origin:this.origin,line:this.line}),this.parseExprNext(r);case 2:let h=e.s,a=this.parseStructure(h);if(a==null){let I=V.EIdent(h),v=null,F=null;I==null?a=null:(v==null&&(v=this.tokenMin),F==null&&(F=this.tokenMax),a={e:I,pmin:v,pmax:F,origin:this.origin,line:this.line})}return this.parseExprNext(a);case 3:let o=e.s;if(o=="-"){let I=this.tokenMin,v=this.parseExpr();if(v==null)return this.makeUnop(o,v);let F=v.e;if(F._hx_index==0){let B=F.c;switch(B._hx_index){case 0:let A=B.v,L=V.EConst(_i.CInt(-A)),z=I,D=v==null?0:v.pmax;return L==null?null:(z==null&&(z=this.tokenMin),D==null&&(D=this.tokenMax),{e:L,pmin:z,pmax:D,origin:this.origin,line:this.line});case 1:let O=B.f,q=V.EConst(_i.CFloat(-O)),M=I,U=v==null?0:v.pmax;return q==null?null:(M==null&&(M=this.tokenMin),U==null&&(U=this.tokenMax),{e:q,pmin:M,pmax:U,origin:this.origin,line:this.line});default:return this.makeUnop(o,v)}}else return this.makeUnop(o,v)}return this.opPriority.h[o]<0?this.makeUnop(o,this.parseExpr()):this.unexpected(e);case 4:if(e=this.token(),e==J.TPClose){let I=this.token();pe.enumEq(I,J.TOp("->"))||this.unexpected(I);let v=this.parseExpr(),F=V.EReturn(v),B=t,A=null,L;F==null?L=null:(B==null&&(B=this.tokenMin),A==null&&(A=this.tokenMax),L={e:F,pmin:B,pmax:A,origin:this.origin,line:this.line});let z=V.EFunction([],L),D=t,O=null;return z==null?null:(D==null&&(D=this.tokenMin),O==null&&(O=this.tokenMax),{e:z,pmin:D,pmax:O,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 u=this.parseExpr();switch(e=this.token(),e._hx_index){case 5:let I=V.EParent(u),v=t,F=this.tokenMax,B;return I==null?B=null:(v==null&&(v=this.tokenMin),F==null&&(F=this.tokenMax),B={e:I,pmin:v,pmax:F,origin:this.origin,line:this.line}),this.parseExprNext(B);case 10:let A=u.e;if(A._hx_index==1){let z=A.v;return this.parseLambda([{name:z}],u==null?0:u.pmin)}break;case 15:let L=this.parseType();switch(e=this.token(),e._hx_index){case 5:let z=V.ECheckType(u,L),D=t,O=this.tokenMax,q;return z==null?q=null:(D==null&&(D=this.tokenMin),O==null&&(O=this.tokenMax),q={e:z,pmin:D,pmax:O,origin:this.origin,line:this.line}),this.parseExprNext(q);case 10:let M=u.e;if(M._hx_index==1){let U=M.v;return this.parseLambda([{name:U,t:L}],u==null?0:u.pmin)}break;default:}break;default:}return this.unexpected(e);case 6:switch(e=this.token(),e._hx_index){case 1:let I=e.c;if(this.allowJSON)if(I._hx_index==2){let D=I.s,O=this.token();if(this.tokens.push({t:O,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,O._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 v=e.s,F=this.token();if(this.tokens.push({t:F,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,F._hx_index==15)return this.parseExprNext(this.parseObject(t));break;case 7:let B=V.EObject([]),A=t,L=null,z;return B==null?z=null:(A==null&&(A=this.tokenMin),L==null&&(L=this.tokenMax),z={e:B,pmin:A,pmax:L,origin:this.origin,line:this.line}),this.parseExprNext(z);default:this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax}let c=[];for(;this.parseFullExpr(c),e=this.token(),!(e==J.TBrClose||this.resumeErrors&&e==J.TEof);)this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;let _=V.EBlock(c),f=t,m=null;return _==null?null:(f==null&&(f=this.tokenMin),m==null&&(m=this.tokenMax),{e:_,pmin:f,pmax:m,origin:this.origin,line:this.line});case 12:let g=[];e=this.token();let w=!0;for(;e!=J.TBkClose&&(!this.resumeErrors||e!=J.TEof);)w||(e!=J.TComma?this.unexpected(e):e=this.token()),w=!1,this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,g.push(this.parseExpr()),e=this.token();if(g.length==1&&g[0]!=null){let I=g[0].e;switch(I._hx_index){case 10:let v=I.cond,F=I.e,B="__a_"+this.uid++,A=V.EArrayDecl([]),L=t,z=null,D;A==null?D=null:(L==null&&(L=this.tokenMin),z==null&&(z=this.tokenMax),D={e:A,pmin:L,pmax:z,origin:this.origin,line:this.line});let O=V.EVar(B,null,D),q=t,M=null,U;O==null?U=null:(q==null&&(q=this.tokenMin),M==null&&(M=this.tokenMax),U={e:O,pmin:q,pmax:M,origin:this.origin,line:this.line});let K=this.mapCompr(B,g[0]),G=V.EIdent(B),Y=t,$=null,se;G==null?se=null:(Y==null&&(Y=this.tokenMin),$==null&&($=this.tokenMax),se={e:G,pmin:Y,pmax:$,origin:this.origin,line:this.line});let ue=V.EBlock([U,K,se]),oe=t,ge=null,me;return ue==null?me=null:(oe==null&&(oe=this.tokenMin),ge==null&&(ge=this.tokenMax),me={e:ue,pmin:oe,pmax:ge,origin:this.origin,line:this.line}),this.parseExprNext(me);case 11:let de=I.v,Oe=I.it,Ve=I.e,je="__a_"+this.uid++,et=V.EArrayDecl([]),Ue=t,Ge=null,nt;et==null?nt=null:(Ue==null&&(Ue=this.tokenMin),Ge==null&&(Ge=this.tokenMax),nt={e:et,pmin:Ue,pmax:Ge,origin:this.origin,line:this.line});let De=V.EVar(je,null,nt),H=t,ie=null,R;De==null?R=null:(H==null&&(H=this.tokenMin),ie==null&&(ie=this.tokenMax),R={e:De,pmin:H,pmax:ie,origin:this.origin,line:this.line});let ee=this.mapCompr(je,g[0]),X=V.EIdent(je),Q=t,ae=null,_e;X==null?_e=null:(Q==null&&(Q=this.tokenMin),ae==null&&(ae=this.tokenMax),_e={e:X,pmin:Q,pmax:ae,origin:this.origin,line:this.line});let xe=V.EBlock([R,ee,_e]),Ye=t,gt=null,Be;return xe==null?Be=null:(Ye==null&&(Ye=this.tokenMin),gt==null&&(gt=this.tokenMax),Be={e:xe,pmin:Ye,pmax:gt,origin:this.origin,line:this.line}),this.parseExprNext(Be);case 24:let _t=I.cond,ve=I.e,Pe="__a_"+this.uid++,ot=V.EArrayDecl([]),tt=t,bt=null,Kt;ot==null?Kt=null:(tt==null&&(tt=this.tokenMin),bt==null&&(bt=this.tokenMax),Kt={e:ot,pmin:tt,pmax:bt,origin:this.origin,line:this.line});let ft=V.EVar(Pe,null,Kt),li=t,$e=null,Bt;ft==null?Bt=null:(li==null&&(li=this.tokenMin),$e==null&&($e=this.tokenMax),Bt={e:ft,pmin:li,pmax:$e,origin:this.origin,line:this.line});let It=this.mapCompr(Pe,g[0]),Lt=V.EIdent(Pe),mt=t,Vt=null,Ht;Lt==null?Ht=null:(mt==null&&(mt=this.tokenMin),Vt==null&&(Vt=this.tokenMax),Ht={e:Lt,pmin:mt,pmax:Vt,origin:this.origin,line:this.line});let Ut=V.EBlock([Bt,It,Ht]),ni=t,si=null,jt;return Ut==null?jt=null:(ni==null&&(ni=this.tokenMin),si==null&&(si=this.tokenMax),jt={e:Ut,pmin:ni,pmax:si,origin:this.origin,line:this.line}),this.parseExprNext(jt);default:}}let y=V.EArrayDecl(g),T=t,E=null,C;return y==null?C=null:(T==null&&(T=this.tokenMin),E==null&&(E=this.tokenMax),C={e:y,pmin:T,pmax:E,origin:this.origin,line:this.line}),this.parseExprNext(C);case 16:let P=e.s;if(this.allowMetadata){let I=this.parseMetaArgs(),v=V.EMeta(P,I,this.parseExpr()),F=t,B=null;return v==null?null:(F==null&&(F=this.tokenMin),B==null&&(B=this.tokenMax),{e:v,pmin:F,pmax:B,origin:this.origin,line:this.line})}else return this.unexpected(e);break;default:return this.unexpected(e)}}parseLambda(e,t){e:for(;;){let c=this.getIdent(),_=this.maybe(J.TDoubleDot)?this.parseType():null;e.push({name:c,t:_});let f=this.token();switch(f._hx_index){case 5:break e;case 10:break;default:this.unexpected(f);break e}}let i=this.token();pe.enumEq(i,J.TOp("->"))||this.unexpected(i);let l=this.parseExpr(),n=V.EReturn(l),s=t,r=null,h;n==null?h=null:(s==null&&(s=this.tokenMin),r==null&&(r=this.tokenMax),h={e:n,pmin:s,pmax:r,origin:this.origin,line:this.line});let a=V.EFunction(e,h),o=t,u=null;return a==null?null:(o==null&&(o=this.tokenMin),u==null&&(u=this.tokenMax),{e:a,pmin:o,pmax:u,origin:this.origin,line:this.line})}parseMetaArgs(){let e=this.token();if(e!=J.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!=J.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 l=i;this.unexpected(l)}}}return t}mapCompr(e,t){if(t==null)return null;let i,l=t.e;switch(l._hx_index){case 3:let r=l.e;i=V.EParent(this.mapCompr(e,r));break;case 4:let h=l.e;if(h.length==1){let A=h[0];i=V.EBlock([this.mapCompr(e,A)])}else{let A=V.EIdent(e),L=t==null?0:t.pmin,z=t==null?0:t.pmax,D;A==null?D=null:(L==null&&(L=this.tokenMin),z==null&&(z=this.tokenMax),D={e:A,pmin:L,pmax:z,origin:this.origin,line:this.line});let O=V.EField(D,"push"),q=t==null?0:t.pmin,M=t==null?0:t.pmax,U;O==null?U=null:(q==null&&(q=this.tokenMin),M==null&&(M=this.tokenMax),U={e:O,pmin:q,pmax:M,origin:this.origin,line:this.line}),i=V.ECall(U,[t])}break;case 9:let a=l.cond,o=l.e1;if(l.e2==null)i=V.EIf(a,this.mapCompr(e,o),null);else{let A=V.EIdent(e),L=t==null?0:t.pmin,z=t==null?0:t.pmax,D;A==null?D=null:(L==null&&(L=this.tokenMin),z==null&&(z=this.tokenMax),D={e:A,pmin:L,pmax:z,origin:this.origin,line:this.line});let O=V.EField(D,"push"),q=t==null?0:t.pmin,M=t==null?0:t.pmax,U;O==null?U=null:(q==null&&(q=this.tokenMin),M==null&&(M=this.tokenMax),U={e:O,pmin:q,pmax:M,origin:this.origin,line:this.line}),i=V.ECall(U,[t])}break;case 10:let c=l.cond,_=l.e;i=V.EWhile(c,this.mapCompr(e,_));break;case 11:let f=l.v,m=l.it,g=l.e;i=V.EFor(f,m,this.mapCompr(e,g));break;case 24:let w=l.cond,y=l.e;i=V.EDoWhile(w,this.mapCompr(e,y));break;default:let T=V.EIdent(e),E=t==null?0:t.pmin,C=t==null?0:t.pmax,P;T==null?P=null:(E==null&&(E=this.tokenMin),C==null&&(C=this.tokenMax),P={e:T,pmin:E,pmax:C,origin:this.origin,line:this.line});let I=V.EField(P,"push"),v=t==null?0:t.pmin,F=t==null?0:t.pmax,B;I==null?B=null:(v==null&&(v=this.tokenMin),F==null&&(F=this.tokenMax),B={e:I,pmin:v,pmax:F,origin:this.origin,line:this.line}),i=V.ECall(B,[t])}let n=t==null?0:t.pmin,s=t==null?0:t.pmax;return i==null?null:(n==null&&(n=this.tokenMin),s==null&&(s=this.tokenMax),{e:i,pmin:n,pmax:s,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 l=i.op,n=i.e1,s=i.e2,r=V.EBinop(l,this.makeUnop(e,n),s),h=n==null?0:n.pmin,a=s==null?0:s.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,u=i.e1,c=i.e2,_=V.ETernary(this.makeUnop(e,o),u,c),f=o==null?0:o.pmin,m=c==null?0:c.pmax;return _==null?null:(f==null&&(f=this.tokenMin),m==null&&(m=this.tokenMax),{e:_,pmin:f,pmax:m,origin:this.origin,line:this.line});default:let g=V.EUnop(e,!0,t),w=t==null?0:t.pmin,y=t==null?0:t.pmax;return g==null?null:(w==null&&(w=this.tokenMin),y==null&&(y=this.tokenMax),{e:g,pmin:w,pmax:y,origin:this.origin,line:this.line})}}makeBinop(e,t,i){if(i==null&&this.resumeErrors){let n=V.EBinop(e,t,i),s=t==null?0:t.pmin,r=t==null?0:t.pmax;return n==null?null:(s==null&&(s=this.tokenMin),r==null&&(r=this.tokenMax),{e:n,pmin:s,pmax:r,origin:this.origin,line:this.line})}let l=i.e;switch(l._hx_index){case 6:let n=l.op,s=l.e1,r=l.e2;if(this.opPriority.h[e]<=this.opPriority.h[n]&&!Object.prototype.hasOwnProperty.call(this.opRightAssoc.h,e)){let f=V.EBinop(n,this.makeBinop(e,t,s),r),m=t==null?0:t.pmin,g=r==null?0:r.pmax;return f==null?null:(m==null&&(m=this.tokenMin),g==null&&(g=this.tokenMax),{e:f,pmin:m,pmax:g,origin:this.origin,line:this.line})}else{let f=V.EBinop(e,t,i),m=t==null?0:t.pmin,g=i==null?0:i.pmax;return f==null?null:(m==null&&(m=this.tokenMin),g==null&&(g=this.tokenMax),{e:f,pmin:m,pmax:g,origin:this.origin,line:this.line})}break;case 22:let h=l.cond,a=l.e1,o=l.e2;if(Object.prototype.hasOwnProperty.call(this.opRightAssoc.h,e)){let f=V.EBinop(e,t,i),m=t==null?0:t.pmin,g=i==null?0:i.pmax;return f==null?null:(m==null&&(m=this.tokenMin),g==null&&(g=this.tokenMax),{e:f,pmin:m,pmax:g,origin:this.origin,line:this.line})}else{let f=V.ETernary(this.makeBinop(e,t,h),a,o),m=t==null?0:t.pmin,g=i==null?0:i.pmax;return f==null?null:(m==null&&(m=this.tokenMin),g==null&&(g=this.tokenMax),{e:f,pmin:m,pmax:g,origin:this.origin,line:this.line})}break;default:let u=V.EBinop(e,t,i),c=t==null?0:t.pmin,_=i==null?0:i.pmax;return u==null?null:(c==null&&(c=this.tokenMin),_==null&&(_=this.tokenMax),{e:u,pmin:c,pmax:_,origin:this.origin,line:this.line})}}parseStructure(e){let t=this.tokenMin;switch(e){case"break":let i=V.EBreak,l=null,n=null;return i==null?null:(l==null&&(l=this.tokenMin),n==null&&(n=this.tokenMax),{e:i,pmin:l,pmax:n,origin:this.origin,line:this.line});case"continue":let s=V.EContinue,r=null,h=null;return s==null?null:(r==null&&(r=this.tokenMin),h==null&&(h=this.tokenMax),{e:s,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 u=this.parseExpr(),c=V.EDoWhile(u,a),_=t,f=u==null?0:u.pmax;return c==null?null:(_==null&&(_=this.tokenMin),f==null&&(f=this.tokenMax),{e:c,pmin:_,pmax:f,origin:this.origin,line:this.line});case"else":return this.unexpected(J.TId(e));case"for":let m=this.token();m!=J.TPOpen&&this.unexpected(m);let g=this.getIdent(),w=this.token();pe.enumEq(w,J.TId("in"))||this.unexpected(w);let y=this.parseExpr(),T=this.token();T!=J.TPClose&&this.unexpected(T);let E=this.parseExpr(),C=V.EFor(g,y,E),P=t,I=E==null?0:E.pmax;return C==null?null:(P==null&&(P=this.tokenMin),I==null&&(I=this.tokenMax),{e:C,pmin:P,pmax:I,origin:this.origin,line:this.line});case"function":let v=this.token(),F=null;v._hx_index==2?F=v.s:(this.tokens.push({t:v,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax);let B=this.parseFunctionDecl(),A=V.EFunction(B.args,B.body,F,B.ret),L=t,z=B.body,D=z==null?0:z.pmax;return A==null?null:(L==null&&(L=this.tokenMin),D==null&&(D=this.tokenMax),{e:A,pmin:L,pmax:D,origin:this.origin,line:this.line});case"if":let O=this.token();O!=J.TPOpen&&this.unexpected(O);let q=this.parseExpr(),M=this.token();M!=J.TPClose&&this.unexpected(M);let U=this.parseExpr(),K=null,G=!1,Y=this.token();Y==J.TSemicolon&&(G=!0,Y=this.token()),pe.enumEq(Y,J.TId("else"))?K=this.parseExpr():(this.tokens.push({t:Y,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,G&&(this.tokens.push({t:J.TSemicolon,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax));let $=V.EIf(q,U,K),se=t,ue=K==null?this.tokenMax:K==null?0:K.pmax;return $==null?null:(se==null&&(se=this.tokenMin),ue==null&&(ue=this.tokenMax),{e:$,pmin:se,pmax:ue,origin:this.origin,line:this.line});case"inline":return this.maybe(J.TId("function"))||this.unexpected(J.TId("inline")),this.parseStructure("function");case"new":let oe=[];oe.push(this.getIdent());e:for(;;){let it=this.token();switch(it._hx_index){case 4:break e;case 8:oe.push(this.getIdent());break;default:this.unexpected(it);break e}}let ge=this.parseExprList(J.TPClose),me=V.ENew(oe.join("."),ge),de=t,Oe=null;return me==null?null:(de==null&&(de=this.tokenMin),Oe==null&&(Oe=this.tokenMax),{e:me,pmin:de,pmax:Oe,origin:this.origin,line:this.line});case"return":let Ve=this.token();this.tokens.push({t:Ve,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;let je=Ve==J.TSemicolon?null:this.parseExpr(),et=V.EReturn(je),Ue=t,Ge=je==null?this.tokenMax:je==null?0:je.pmax;return et==null?null:(Ue==null&&(Ue=this.tokenMin),Ge==null&&(Ge=this.tokenMax),{e:et,pmin:Ue,pmax:Ge,origin:this.origin,line:this.line});case"switch":let nt=this.parseExpr(),De=null,H=[],ie=this.token();ie!=J.TBrOpen&&this.unexpected(ie);e:for(;;){let it=this.token();switch(it._hx_index){case 2:switch(it.s){case"case":let ki={values:[],expr:null};H.push(ki);t:for(;;){let dt=this.parseExpr();switch(ki.values.push(dt),it=this.token(),it._hx_index){case 10:break;case 15:break t;default:this.unexpected(it);break t}}let ye=[];t:for(;;)switch(it=this.token(),this.tokens.push({t:it,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,it._hx_index){case 0:if(this.resumeErrors)break t;this.parseFullExpr(ye);break;case 2:switch(it.s){case"case":case"default":break t;default:this.parseFullExpr(ye)}break;case 7:break t;default:this.parseFullExpr(ye)}let lt;if(ye.length==1)lt=ye[0];else if(ye.length==0){let dt=V.EBlock([]),xt=this.tokenMin,St=this.tokenMin;dt==null?lt=null:(xt==null&&(xt=this.tokenMin),St==null&&(St=this.tokenMax),lt={e:dt,pmin:xt,pmax:St,origin:this.origin,line:this.line})}else{let dt=V.EBlock(ye),xt=ye[0],St=xt==null?0:xt.pmin,Jt=ye[ye.length-1],wt=Jt==null?0:Jt.pmax;dt==null?lt=null:(St==null&&(St=this.tokenMin),wt==null&&(wt=this.tokenMax),lt={e:dt,pmin:St,pmax:wt,origin:this.origin,line:this.line})}ki.expr=lt;break;case"default":De!=null&&this.unexpected(it);let ct=this.token();ct!=J.TDoubleDot&&this.unexpected(ct);let rt=[];t:for(;;)switch(it=this.token(),this.tokens.push({t:it,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,it._hx_index){case 0:if(this.resumeErrors)break t;this.parseFullExpr(rt);break;case 2:switch(it.s){case"case":case"default":break t;default:this.parseFullExpr(rt)}break;case 7:break t;default:this.parseFullExpr(rt)}if(rt.length==1)De=rt[0];else if(rt.length==0){let dt=V.EBlock([]),xt=this.tokenMin,St=this.tokenMin;dt==null?De=null:(xt==null&&(xt=this.tokenMin),St==null&&(St=this.tokenMax),De={e:dt,pmin:xt,pmax:St,origin:this.origin,line:this.line})}else{let dt=V.EBlock(rt),xt=rt[0],St=xt==null?0:xt.pmin,Jt=rt[rt.length-1],wt=Jt==null?0:Jt.pmax;dt==null?De=null:(St==null&&(St=this.tokenMin),wt==null&&(wt=this.tokenMax),De={e:dt,pmin:St,pmax:wt,origin:this.origin,line:this.line})}break;default:this.unexpected(it);break e}break;case 7:break e;default:this.unexpected(it);break e}}let R=V.ESwitch(nt,H,De),ee=t,X=this.tokenMax;return R==null?null:(ee==null&&(ee=this.tokenMin),X==null&&(X=this.tokenMax),{e:R,pmin:ee,pmax:X,origin:this.origin,line:this.line});case"throw":let Q=this.parseExpr(),ae=V.EThrow(Q),_e=t,xe=Q==null?0:Q.pmax;return ae==null?null:(_e==null&&(_e=this.tokenMin),xe==null&&(xe=this.tokenMax),{e:ae,pmin:_e,pmax:xe,origin:this.origin,line:this.line});case"try":let Ye=this.parseExpr(),gt=this.token();pe.enumEq(gt,J.TId("catch"))||this.unexpected(gt);let Be=this.token();Be!=J.TPOpen&&this.unexpected(Be);let _t=this.getIdent(),ve=this.token();ve!=J.TDoubleDot&&this.unexpected(ve);let Pe=null;if(this.allowTypes)Pe=this.parseType();else{let it=this.token();pe.enumEq(it,J.TId("Dynamic"))||this.unexpected(it)}let ot=this.token();ot!=J.TPClose&&this.unexpected(ot);let tt=this.parseExpr(),bt=V.ETry(Ye,_t,Pe,tt),Kt=t,ft=tt==null?0:tt.pmax;return bt==null?null:(Kt==null&&(Kt=this.tokenMin),ft==null&&(ft=this.tokenMax),{e:bt,pmin:Kt,pmax:ft,origin:this.origin,line:this.line});case"var":let li=this.getIdent(),$e=this.token(),Bt=null;$e==J.TDoubleDot&&this.allowTypes&&(Bt=this.parseType(),$e=this.token());let It=null;switch($e._hx_index){case 3:$e.s=="="?It=this.parseExpr():this.unexpected($e);break;case 10:case 11:this.tokens.push({t:$e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break;default:Bt!=null?(this.tokens.push({t:$e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax):this.unexpected($e)}let Lt=V.EVar(li,Bt,It),mt=t,Vt=It==null?this.tokenMax:It==null?0:It.pmax;return Lt==null?null:(mt==null&&(mt=this.tokenMin),Vt==null&&(Vt=this.tokenMax),{e:Lt,pmin:mt,pmax:Vt,origin:this.origin,line:this.line});case"while":let Ht=this.parseExpr(),Ut=this.parseExpr(),ni=V.EWhile(Ht,Ut),si=t,jt=Ut==null?0:Ut.pmax;return ni==null?null:(si==null&&(si=this.tokenMin),jt==null&&(jt=this.tokenMax),{e:ni,pmin:si,pmax:jt,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 l=t.s;if(l=="->"){let Be=e.e;switch(Be._hx_index){case 1:let _t=Be.v,ve=this.parseExpr(),Pe=V.EReturn(ve),ot=ve==null?0:ve.pmin,tt=null,bt;Pe==null?bt=null:(ot==null&&(ot=this.tokenMin),tt==null&&(tt=this.tokenMax),bt={e:Pe,pmin:ot,pmax:tt,origin:this.origin,line:this.line});let Kt=V.EFunction([{name:_t}],bt),ft=e==null?0:e.pmin,li=null;return Kt==null?null:(ft==null&&(ft=this.tokenMin),li==null&&(li=this.tokenMax),{e:Kt,pmin:ft,pmax:li,origin:this.origin,line:this.line});case 3:let $e=Be.e.e;if($e._hx_index==1){let It=$e.v,Lt=this.parseExpr(),mt=V.EReturn(Lt),Vt=Lt==null?0:Lt.pmin,Ht=null,Ut;mt==null?Ut=null:(Vt==null&&(Vt=this.tokenMin),Ht==null&&(Ht=this.tokenMax),Ut={e:mt,pmin:Vt,pmax:Ht,origin:this.origin,line:this.line});let ni=V.EFunction([{name:It}],Ut),si=e==null?0:e.pmin,jt=null;return ni==null?null:(si==null&&(si=this.tokenMin),jt==null&&(jt=this.tokenMax),{e:ni,pmin:si,pmax:jt,origin:this.origin,line:this.line})}break;case 26:let Bt=Be.e.e;if(Bt._hx_index==1){let It=Bt.v,Lt=Be.t,mt=this.parseExpr(),Vt=V.EReturn(mt),Ht=mt==null?0:mt.pmin,Ut=null,ni;Vt==null?ni=null:(Ht==null&&(Ht=this.tokenMin),Ut==null&&(Ut=this.tokenMax),ni={e:Vt,pmin:Ht,pmax:Ut,origin:this.origin,line:this.line});let si=V.EFunction([{name:It,t:Lt}],ni),jt=e==null?0:e.pmin,it=null;return si==null?null:(jt==null&&(jt=this.tokenMin),it==null&&(it=this.tokenMax),{e:si,pmin:jt,pmax:it,origin:this.origin,line:this.line})}break;default:}this.unexpected(t)}if(this.opPriority.h[l]==-1){let Be;if(this.isBlock(e))Be=!0;else{let tt=e.e;if(tt._hx_index==3){let bt=tt.e;Be=!0}else Be=!1}if(Be)return this.tokens.push({t,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,e;let _t=V.EUnop(l,!1,e),ve=e==null?0:e.pmin,Pe=null,ot;return _t==null?ot=null:(ve==null&&(ve=this.tokenMin),Pe==null&&(Pe=this.tokenMax),ot={e:_t,pmin:ve,pmax:Pe,origin:this.origin,line:this.line}),this.parseExprNext(ot)}return this.makeBinop(l,e,this.parseExpr());case 4:let n=V.ECall(e,this.parseExprList(J.TPClose)),s=e==null?0:e.pmin,r=null,h;return n==null?h=null:(s==null&&(s=this.tokenMin),r==null&&(r=this.tokenMax),h={e:n,pmin:s,pmax:r,origin:this.origin,line:this.line}),this.parseExprNext(h);case 8:let a=this.getIdent(),o=V.EField(e,a),u=e==null?0:e.pmin,c=null,_;return o==null?_=null:(u==null&&(u=this.tokenMin),c==null&&(c=this.tokenMax),_={e:o,pmin:u,pmax:c,origin:this.origin,line:this.line}),this.parseExprNext(_);case 9:let f=this.getIdent(),m="__a_"+this.uid++,g=V.EVar(m,null,e),w=e==null?0:e.pmin,y=e==null?0:e.pmax,T;g==null?T=null:(w==null&&(w=this.tokenMin),y==null&&(y=this.tokenMax),T={e:g,pmin:w,pmax:y,origin:this.origin,line:this.line});let E=V.EIdent(m),C=e==null?0:e.pmin,P=e==null?0:e.pmax,I;E==null?I=null:(C==null&&(C=this.tokenMin),P==null&&(P=this.tokenMax),I={e:E,pmin:C,pmax:P,origin:this.origin,line:this.line});let v=V.EIdent("null"),F=e==null?0:e.pmin,B=e==null?0:e.pmax,A;v==null?A=null:(F==null&&(F=this.tokenMin),B==null&&(B=this.tokenMax),A={e:v,pmin:F,pmax:B,origin:this.origin,line:this.line});let L=V.EBinop("==",I,A),z=null,D=null,O;L==null?O=null:(z==null&&(z=this.tokenMin),D==null&&(D=this.tokenMax),O={e:L,pmin:z,pmax:D,origin:this.origin,line:this.line});let q=V.EIdent("null"),M=e==null?0:e.pmin,U=e==null?0:e.pmax,K;q==null?K=null:(M==null&&(M=this.tokenMin),U==null&&(U=this.tokenMax),K={e:q,pmin:M,pmax:U,origin:this.origin,line:this.line});let G=V.EIdent(m),Y=e==null?0:e.pmin,$=e==null?0:e.pmax,se;G==null?se=null:(Y==null&&(Y=this.tokenMin),$==null&&($=this.tokenMax),se={e:G,pmin:Y,pmax:$,origin:this.origin,line:this.line});let ue=V.EField(se,f),oe=e==null?0:e.pmin,ge=null,me;ue==null?me=null:(oe==null&&(oe=this.tokenMin),ge==null&&(ge=this.tokenMax),me={e:ue,pmin:oe,pmax:ge,origin:this.origin,line:this.line});let de=V.ETernary(O,K,me),Oe=null,Ve=null,je;de==null?je=null:(Oe==null&&(Oe=this.tokenMin),Ve==null&&(Ve=this.tokenMax),je={e:de,pmin:Oe,pmax:Ve,origin:this.origin,line:this.line});let et=V.EBlock([T,je]),Ue=e==null?0:e.pmin,Ge=null,nt;return et==null?nt=null:(Ue==null&&(Ue=this.tokenMin),Ge==null&&(Ge=this.tokenMax),nt={e:et,pmin:Ue,pmax:Ge,origin:this.origin,line:this.line}),this.parseExprNext(nt);case 12:let De=this.parseExpr(),H=this.token();H!=J.TBkClose&&this.unexpected(H);let ie=V.EArray(e,De),R=e==null?0:e.pmin,ee=null,X;return ie==null?X=null:(R==null&&(R=this.tokenMin),ee==null&&(ee=this.tokenMax),X={e:ie,pmin:R,pmax:ee,origin:this.origin,line:this.line}),this.parseExprNext(X);case 14:let Q=this.parseExpr(),ae=this.token();ae!=J.TDoubleDot&&this.unexpected(ae);let _e=this.parseExpr(),xe=V.ETernary(e,Q,_e),Ye=e==null?0:e.pmin,gt=_e==null?0:_e.pmax;return xe==null?null:(Ye==null&&(Ye=this.tokenMin),gt==null&&(gt=this.tokenMax),{e:xe,pmin:Ye,pmax:gt,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!=J.TPClose){let i=!1;for(;!i;){let l=null,n=!1;if(t._hx_index==14&&(n=!0,t=this.token()),t._hx_index==2)l=t.s;else{this.unexpected(t);break}let s={name:l};switch(e.push(s),n&&(s.opt=!0),this.allowTypes&&(this.maybe(J.TDoubleDot)&&(s.t=this.parseType()),this.maybe(J.TOp("="))&&(s.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!=J.TPOpen&&this.unexpected(e);let t=this.parseFunctionArgs(),i=null;if(this.allowTypes){let l=this.token();l!=J.TDoubleDot?(this.tokens.push({t:l,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!=J.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 l=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 c=e.s;if(c==">")break e;if(p.cca(c,0)==62){this.tokens.add({t:J.TOp(p.substr(c,1,null)),min:this.tokenMax-c.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($t.CTPath(l,n));case 4:let s=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:s,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;let h=function(u){let c=t.token();if(c._hx_index==3){if(c.s!="->"){let _=c;t.unexpected(_)}}else{let _=c;t.unexpected(_)}return $t.CTFun(u,t.parseType())};switch(s._hx_index){case 2:let u=s.s;if(r._hx_index==15){let y=[],T=0,E=this.parseFunctionArgs();for(;T<E.length;){let P=E[T];++T;let I=P.value;if(I!=null){let v=I;if(!this.resumeErrors)throw b.thrown(new Ce(be.ECustom("Default values not allowed in function types"),v.pmin,v.pmax,this.origin,this.line))}y.push($t.CTNamed(P.name,P.opt?$t.CTOpt(P.t):P.t))}return h(y)}else{let y=this.parseType(),T=this.token();switch(T._hx_index){case 5:return this.parseTypeNext($t.CTParent(y));case 10:let E=[y];do E.push(this.parseType());while(this.maybe(J.TComma));let C=this.token();return C!=J.TPClose&&this.unexpected(C),h(E);default:let P=T;return this.unexpected(P)}}break;case 5:let c=[],_=0,f=this.parseFunctionArgs();for(;_<f.length;){let y=f[_];++_;let T=y.value;if(T!=null){let E=T;if(!this.resumeErrors)throw b.thrown(new Ce(be.ECustom("Default values not allowed in function types"),E.pmin,E.pmax,this.origin,this.line))}c.push($t.CTNamed(y.name,y.opt?$t.CTOpt(y.t):y.t))}return h(c);default:let g=this.parseType(),w=this.token();switch(w._hx_index){case 5:return this.parseTypeNext($t.CTParent(g));case 10:let y=[g];do y.push(this.parseType());while(this.maybe(J.TComma));let T=this.token();return T!=J.TPClose&&this.unexpected(T),h(y);default:let E=w;return this.unexpected(E)}}break;case 6:let a=[],o=null;e:for(;;)switch(e=this.token(),e._hx_index){case 2:let u=e.s;if(u=="var"){let _=this.getIdent(),f=this.token();f!=J.TDoubleDot&&this.unexpected(f),a.push({name:_,t:this.parseType(),meta:o}),o=null;let m=this.token();m!=J.TSemicolon&&this.unexpected(m)}else{let _=u,f=this.token();switch(f!=J.TDoubleDot&&this.unexpected(f),a.push({name:_,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 c=e.s;o==null&&(o=[]),o.push({name:c,params:this.parseMetaArgs()});break;default:this.unexpected(e);break e}return this.parseTypeNext($t.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 l=i.ret;return i.args.unshift(e),i}else return $t.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 l=[];for(;;){let n=this.token();if(n==J.TEof)break;this.tokens.push({t:n,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,l.push(this.parseModuleDecl())}return l}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(J.TOp("<"))&&!this.resumeErrors)throw b.thrown(new Ce(be.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,l=!1;e:for(;;){switch(t){case"extern":l=!0;break;case"private":i=!0;break;default:break e}t=this.getIdent()}switch(t){case"class":let n=this.getIdent(),s=this.parseParams(),r=null,h=[];e:for(;;){let E=this.token();if(E._hx_index==2)switch(E.s){case"extends":r=this.parseType();break;case"implements":h.push(this.parseType());break;default:this.tokens.push({t:E,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break e}else{this.tokens.push({t:E,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break}}let a=[],o=this.token();for(o!=J.TBrOpen&&this.unexpected(o);!this.maybe(J.TBrClose);)a.push(this.parseField());return ji.DClass({name:n,meta:e,params:s,extend:r,implement:h,fields:a,isPrivate:i,isExtern:l});case"import":let u=[this.getIdent()],c=!1;for(;;){let E=this.token();if(E!=J.TDot){this.tokens.push({t:E,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break}switch(E=this.token(),E._hx_index){case 2:let C=E.s;u.push(C);break;case 3:E.s=="*"?c=!0:this.unexpected(E);break;default:this.unexpected(E)}}let _=this.token();return _!=J.TSemicolon&&this.unexpected(_),ji.DImport(u,c);case"package":let f=this.parsePath(),m=this.token();return m!=J.TSemicolon&&this.unexpected(m),ji.DPackage(f);case"typedef":let g=this.getIdent(),w=this.parseParams(),y=this.token();pe.enumEq(y,J.TOp("="))||this.unexpected(y);let T=this.parseType();return ji.DTypedef({name:g,meta:e,params:w,isPrivate:i,t:T});default:this.unexpected(J.TId(t))}return null}parseField(){let e=this.parseMetadata(),t=[];e:for(;;){let i=this.getIdent();switch(i){case"function":let l=this.getIdent(),n=this.parseFunctionDecl();return{name:l,meta:e,access:t,kind:Fl.KFunction({args:n.args,expr:n.body,ret:n.ret})};case"inline":t.push(Ei.AInline);break;case"macro":t.push(Ei.AMacro);break;case"override":t.push(Ei.AOverride);break;case"private":t.push(Ei.APrivate);break;case"public":t.push(Ei.APublic);break;case"static":t.push(Ei.AStatic);break;case"var":let s=this.getIdent(),r=null,h=null;if(this.maybe(J.TPOpen)){r=this.getIdent();let u=this.token();u!=J.TComma&&this.unexpected(u),h=this.getIdent();let c=this.token();c!=J.TPClose&&this.unexpected(c)}let a=this.maybe(J.TDoubleDot)?this.parseType():null,o=this.maybe(J.TOp("="))?this.parseExpr():null;if(o!=null)if(this.isBlock(o))this.maybe(J.TSemicolon);else{let u=this.token();u!=J.TSemicolon&&this.unexpected(u)}else{let u;if(a!=null)if(a==null)u=!1;else if(a._hx_index==2){let c=a.fields;u=!0}else u=!1;else u=!1;if(u)this.maybe(J.TSemicolon);else{let c=this.token();c!=J.TSemicolon&&this.unexpected(c)}}return{name:s,meta:e,access:t,kind:Fl.KVar({get:r,set:h,type:a,expr:o})};default:this.unexpected(J.TId(i));break e}}return null}readChar(){return this.input.charCodeAt(this.readPos++)}readString(e){let t=0,i="",l=!1,n=this.line,s=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 b.thrown(new Ce(be.EUnterminatedString,r,r,this.origin,this.line));break}if(l)switch(l=!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 u=o++;a<<=4;let c=this.input.charCodeAt(this.readPos++);switch(c){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:a+=c-48;break;case 65:case 66:case 67:case 68:case 69:case 70:a+=c-55;break;case 97:case 98:case 99:case 100:case 101:case 102:a+=c-87;break;default:if(c!=c&&(this.line=n,!this.resumeErrors))throw b.thrown(new Ce(be.EUnterminatedString,r,r,this.origin,this.line));this.invalidChar(c)}}i+=String.fromCodePoint(a);break;default:this.invalidChar(h)}else if(h==92)l=!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,J.TEof;switch(e){case 0:return J.TEof;case 10:this.line++,this.tokenMin++;break;case 9:case 13:case 32:this.tokenMin++;break;case 34:case 39:return J.TConst(_i.CString(this.readString(e)));case 35:if(e=this.input.charCodeAt(this.readPos++),this.idents[e]){let l=String.fromCodePoint(e);for(;;){if(e=this.input.charCodeAt(this.readPos++),!this.idents[e])return this.char=e,this.preprocess(l);l+=String.fromCodePoint(e)}}this.invalidChar(e);break;case 40:return J.TPOpen;case 41:return J.TPClose;case 44:return J.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),J.TOp("...");case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:let l=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:l=l*10+(e-48);break;default:return this.char=e,J.TConst(_i.CFloat(l/n))}break;default:return this.char=e,J.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:J.TOp("..."),min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;let h=t|0;return J.TConst(h==t?_i.CInt(h):_i.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 l=this.token(),n=null;switch(l._hx_index){case 1:let h=l.c;h._hx_index==0?n=h.v:(this.tokens.push({t:l,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax);break;case 3:if(l.s=="-")if(l=this.token(),l._hx_index==1){let a=l.c;a._hx_index==0?n=-a.v:(this.tokens.push({t:l,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax)}else this.tokens.push({t:l,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;else this.tokens.push({t:l,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break;default:this.tokens.push({t:l,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax}return n==null&&this.invalidChar(e),i==0&&(i=10),J.TConst(_i.CFloat(Math.pow(10,n)/i*t*10));case 120:(t>0||i>0)&&this.invalidChar(e);let s=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:s=(s<<4)+e-48;break;case 65:case 66:case 67:case 68:case 69:case 70:s=(s<<4)+(e-55);break;case 97:case 98:case 99:case 100:case 101:case 102:s=(s<<4)+(e-87);break;default:return this.char=e,J.TConst(_i.CInt(s))}break;default:this.char=e;let r=t|0;return J.TConst(i>0?_i.CFloat(t*10/i):r==t?_i.CInt(r):_i.CFloat(t))}break;case 58:return J.TDoubleDot;case 59:return J.TSemicolon;case 61:return e=this.input.charCodeAt(this.readPos++),e==61?J.TOp("=="):e==62?J.TOp("=>"):(this.char=e,J.TOp("="));case 63:return e=this.input.charCodeAt(this.readPos++),e==46?J.TQuestionDot:(this.char=e,J.TQuestion);case 64:if(e=this.input.charCodeAt(this.readPos++),this.idents[e]||e==58){let l=String.fromCodePoint(e);for(;;){if(e=this.input.charCodeAt(this.readPos++),!this.idents[e])return this.char=e,J.TMeta(l);l+=String.fromCodePoint(e)}}this.invalidChar(e);break;case 91:return J.TBkOpen;case 93:return J.TBkClose;case 123:return J.TBrOpen;case 125:return J.TBrClose;default:if(this.ops[e]){let l=String.fromCodePoint(e);for(;;){if(e=this.input.charCodeAt(this.readPos++),e!=e&&(e=0),!this.ops[e])return this.char=e,J.TOp(l);let n=l;if(l+=String.fromCodePoint(e),!Object.prototype.hasOwnProperty.call(this.opPriority.h,l)&&Object.prototype.hasOwnProperty.call(this.opPriority.h,n))return l=="//"||l=="/*"?this.tokenComment(l,e):(this.char=e,J.TOp(n))}}if(this.idents[e]){let l=String.fromCodePoint(e);for(;;){if(e=this.input.charCodeAt(this.readPos++),e!=e&&(e=0),!this.idents[e])return this.char=e,J.TId(l);l+=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=V.EIdent(t),l=this.tokenMin,n=this.tokenMax;return i==null?null:(l==null&&(l=this.tokenMin),n==null&&(n=this.tokenMax),{e:i,pmin:l,pmax:n,origin:this.origin,line:this.line});case 3:if(e.s=="!"){let s=V.EUnop("!",!0,this.parsePreproCond()),r=this.tokenMin,h=this.tokenMax;return s==null?null:(r==null&&(r=this.tokenMin),h==null&&(h=this.tokenMax),{e:s,pmin:r,pmax:h,origin:this.origin,line:this.line})}else return this.unexpected(e);break;case 4:return this.tokens.push({t:J.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 l=t.e;return this.evalPreproCond(l);case 6:let n=t.e1,s=t.e2;switch(t.op){case"&&":let a=n,o=s;return this.evalPreproCond(a)?this.evalPreproCond(o):!1;case"||":let u=n,c=s;return this.evalPreproCond(u)?!0:this.evalPreproCond(c);default:let _=e.e;if(!this.resumeErrors)throw b.thrown(new Ce(be.EInvalidPreprocessor("Can't eval "+Qe[_.__enum__].__constructs__[_._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 b.thrown(new Ce(be.EInvalidPreprocessor("Can't eval "+Qe[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 b.thrown(new Ce(be.EInvalidPreprocessor("Can't eval "+Qe[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")):J.TPrepro(e);case"end":return this.preprocStack.length>0?(this.preprocStack.pop(),this.token()):J.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 J.TPrepro(e)}}skipTokens(){let e=this.preprocStack.length-1,t=this.preprocStack[e],i=this.readPos+this.offset;for(;;){let l=this.token();if(l==J.TEof&&!this.resumeErrors)throw b.thrown(new Ce(be.EInvalidPreprocessor("Unclosed"),i,i,this.origin,this.line));if(this.preprocStack[e]!=t){this.tokens.push({t:l,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break}}}tokenComment(e,t){let i=p.cca(e,1),l=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 b.thrown(new Ce(be.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 b.thrown(new Ce(be.EUnterminatedComment,this.tokenMin,this.tokenMin,this.origin,this.line));break}}while(t!=47);return this.token()}return this.char=t,J.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}}}j["hscript.Parser"]=tl,tl.__name__="hscript.Parser",Object.assign(tl.prototype,{__class__:tl,__properties__:{get_currentPos:"get_currentPos"}});class ol{constructor(){}exprToString(e){return this.buf=new Xt,this.tabs="",this.expr(e),this.buf.b}typeToString(e){return this.buf=new Xt,this.tabs="",this.type(e),this.buf.b}add(e){this.buf.b+=ne.string(e)}type(e){switch(e._hx_index){case 0:let t=e.path,i=e.params,l=t.join(".");if(this.buf.b+=ne.string(l),i!=null){this.buf.b+="<";let g=!0,w=0;for(;w<i.length;){let y=i[w];++w,g?g=!1:this.buf.b+=", ",this.type(y)}this.buf.b+=">"}break;case 1:let n=e.args,s=e.ret,r=n,h=s;if(tn.exists(r,function(g){if(g._hx_index==5){let w=g.n,y=g.t;return!0}else return!1})){this.buf.b+="(";let g=0;for(;g<r.length;){let w=r[g];if(++g,w._hx_index==5){let y=w.n,T=w.t;this.type(w)}else this.type($t.CTNamed("_",w))}this.buf.b+=")->",this.type(h)}else{let g=n,w=s;if(g.length==0)this.buf.b+="Void -> ";else{let y=0;for(;y<g.length;){let T=g[y];++y,this.type(T),this.buf.b+=" -> "}}this.type(w)}break;case 2:let a=e.fields;this.buf.b+="{";let o=!0,u=0;for(;u<a.length;){let g=a[u];++u,o?(o=!1,this.buf.b+=" "):this.buf.b+=", ",this.buf.b+=ne.string(g.name+" : "),this.type(g.t)}this.buf.b+=o?"}":" }";break;case 3:let c=e.t;this.buf.b+="(",this.type(c),this.buf.b+=")";break;case 4:let _=e.t;this.buf.b+="?",this.type(_);break;case 5:let f=e.n,m=e.t;this.buf.b+=f==null?"null":""+f,this.buf.b+=":",this.type(m);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 ve=i.v;this.buf.b+=ve==null?"null":""+ve;break;case 1:let Pe=i.f;this.buf.b+=Pe==null?"null":""+Pe;break;case 2:let ot=i.s;this.buf.b+='"';let tt=ot.split('"').join('\\"').split(`
14
- `).join("\\n").split("\r").join("\\r").split(" ").join("\\t");this.buf.b+=ne.string(tt),this.buf.b+='"';break}break;case 1:let l=t.v;this.buf.b+=l==null?"null":""+l;break;case 2:let n=t.n,s=t.t,r=t.e;this.buf.b+=ne.string("var "+n),this.addType(s),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 ve=0;for(;ve<a.length;){let Pe=a[ve];++ve,this.buf.b+=ne.string(this.tabs),this.expr(Pe),this.buf.b+=`;
16
- `}this.tabs=p.substr(this.tabs,1,null),this.buf.b+="}"}break;case 5:let o=t.e,u=t.f;this.expr(o),this.buf.b+=ne.string("."+u);break;case 6:let c=t.op,_=t.e1,f=t.e2;this.expr(_),this.buf.b+=ne.string(" "+c+" "),this.expr(f);break;case 7:let m=t.op,g=t.prefix,w=t.e;g?(this.buf.b+=m==null?"null":""+m,this.expr(w)):(this.expr(w),this.buf.b+=m==null?"null":""+m);break;case 8:let y=t.e,T=t.params;if(y==null)this.expr(y);else{let ve=y.e;switch(ve._hx_index){case 0:let Pe=ve.c;this.expr(y);break;case 1:let ot=ve.v;this.expr(y);break;case 5:let tt=ve.e,bt=ve.f;this.expr(y);break;default:this.buf.b+="(",this.expr(y),this.buf.b+=")"}}this.buf.b+="(";let E=!0,C=0;for(;C<T.length;){let ve=T[C];++C,E?E=!1:this.buf.b+=", ",this.expr(ve)}this.buf.b+=")";break;case 9:let P=t.cond,I=t.e1,v=t.e2;this.buf.b+="if( ",this.expr(P),this.buf.b+=" ) ",this.expr(I),v!=null&&(this.buf.b+=" else ",this.expr(v));break;case 10:let F=t.cond,B=t.e;this.buf.b+="while( ",this.expr(F),this.buf.b+=" ) ",this.expr(B);break;case 11:let A=t.v,L=t.it,z=t.e;this.buf.b+=ne.string("for( "+A+" in "),this.expr(L),this.buf.b+=" ) ",this.expr(z);break;case 12:this.buf.b+="break";break;case 13:this.buf.b+="continue";break;case 14:let D=t.args,O=t.e,q=t.name,M=t.ret;this.buf.b+="function",q!=null&&(this.buf.b+=ne.string(" "+q)),this.buf.b+="(";let U=!0,K=0;for(;K<D.length;){let ve=D[K];++K,U?U=!1:this.buf.b+=", ",ve.opt&&(this.buf.b+="?"),this.buf.b+=ne.string(ve.name),this.addType(ve.t)}this.buf.b+=")",this.addType(M),this.buf.b+=" ",this.expr(O);break;case 15:let G=t.e;this.buf.b+="return",G!=null&&(this.buf.b+=" ",this.expr(G));break;case 16:let Y=t.e,$=t.index;this.expr(Y),this.buf.b+="[",this.expr($),this.buf.b+="]";break;case 17:let se=t.e;this.buf.b+="[";let ue=!0,oe=0;for(;oe<se.length;){let ve=se[oe];++oe,ue?ue=!1:this.buf.b+=", ",this.expr(ve)}this.buf.b+="]";break;case 18:let ge=t.cl,me=t.params;this.buf.b+=ne.string("new "+ge+"(");let de=!0,Oe=0;for(;Oe<me.length;){let ve=me[Oe];++Oe,de?de=!1:this.buf.b+=", ",this.expr(ve)}this.buf.b+=")";break;case 19:let Ve=t.e;this.buf.b+="throw ",this.expr(Ve);break;case 20:let je=t.e,et=t.v,Ue=t.t,Ge=t.ecatch;this.buf.b+="try ",this.expr(je),this.buf.b+=ne.string(" catch( "+et),this.addType(Ue),this.buf.b+=") ",this.expr(Ge);break;case 21:let nt=t.fl;if(nt.length==0)this.buf.b+="{}";else{this.tabs+=" ",this.buf.b+=`{
17
- `;let ve=0;for(;ve<nt.length;){let Pe=nt[ve];++ve,this.buf.b+=ne.string(this.tabs),this.buf.b+=ne.string(Pe.name+" : "),this.expr(Pe.e),this.buf.b+=`,
10
+ \r ]+`,"g".split("u").join(""));n=n.replace(s,""),n="<!--"+n+"-->",this.output.b+=t==null?"null":""+t;let r=Ae.trim(n);this.output.b+=le.string(r),this.pretty&&(this.output.b+=`
11
+ `);break;case 4:if(e.nodeType==Z.Document||e.nodeType==Z.Element)throw b.thrown("Bad node type, unexpected "+(e.nodeType==null?"null":Ie.toString(e.nodeType)));this.output.b+=le.string("<!DOCTYPE "+e.nodeValue+">"),this.pretty&&(this.output.b+=`
12
+ `);break;case 5:if(e.nodeType==Z.Document||e.nodeType==Z.Element)throw b.thrown("Bad node type, unexpected "+(e.nodeType==null?"null":Ie.toString(e.nodeType)));this.output.b+=le.string("<?"+e.nodeValue+"?>"),this.pretty&&(this.output.b+=`
13
+ `);break;case 6:if(e.nodeType!=Z.Document&&e.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element or Document but found "+(e.nodeType==null?"null":Ie.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!=Z.Document&&e.nodeType!=Z.Element)throw b.thrown("Bad node type, expected Element or Document but found "+(e.nodeType==null?"null":Ie.toString(e.nodeType)));let t=0,i=e.children;for(;t<i.length;){let l=i[t++];switch(l.nodeType){case 0:case 1:return!0;case 2:case 3:if(l.nodeType==Z.Document||l.nodeType==Z.Element)throw b.thrown("Bad node type, unexpected "+(l.nodeType==null?"null":Ie.toString(l.nodeType)));if(Ae.ltrim(l.nodeValue).length!=0)return!0;break;default:}}return!1}static print(e,t){t==null&&(t=!1);let i=new el(t);return i.writeNode(e,""),i.output.b}}j["haxe.xml.Printer"]=el,el.__name__="haxe.xml.Printer",Object.assign(el.prototype,{__class__:el});var W=Qe["hscript.TType"]={__ename__:"hscript.TType",__constructs__:null,TMono:(d=function(k){return{_hx_index:0,r:k,__enum__:"hscript.TType",toString:S}},d._hx_name="TMono",d.__params__=["r"],d),TVoid:{_hx_name:"TVoid",_hx_index:1,__enum__:"hscript.TType",toString:S},TInt:{_hx_name:"TInt",_hx_index:2,__enum__:"hscript.TType",toString:S},TFloat:{_hx_name:"TFloat",_hx_index:3,__enum__:"hscript.TType",toString:S},TBool:{_hx_name:"TBool",_hx_index:4,__enum__:"hscript.TType",toString:S},TDynamic:{_hx_name:"TDynamic",_hx_index:5,__enum__:"hscript.TType",toString:S},TParam:(d=function(k){return{_hx_index:6,name:k,__enum__:"hscript.TType",toString:S}},d._hx_name="TParam",d.__params__=["name"],d),TUnresolved:(d=function(k){return{_hx_index:7,name:k,__enum__:"hscript.TType",toString:S}},d._hx_name="TUnresolved",d.__params__=["name"],d),TNull:(d=function(k){return{_hx_index:8,t:k,__enum__:"hscript.TType",toString:S}},d._hx_name="TNull",d.__params__=["t"],d),TInst:(d=function(k,e){return{_hx_index:9,c:k,args:e,__enum__:"hscript.TType",toString:S}},d._hx_name="TInst",d.__params__=["c","args"],d),TEnum:(d=function(k,e){return{_hx_index:10,e:k,args:e,__enum__:"hscript.TType",toString:S}},d._hx_name="TEnum",d.__params__=["e","args"],d),TType:(d=function(k,e){return{_hx_index:11,t:k,args:e,__enum__:"hscript.TType",toString:S}},d._hx_name="TType",d.__params__=["t","args"],d),TAbstract:(d=function(k,e){return{_hx_index:12,a:k,args:e,__enum__:"hscript.TType",toString:S}},d._hx_name="TAbstract",d.__params__=["a","args"],d),TFun:(d=function(k,e){return{_hx_index:13,args:k,ret:e,__enum__:"hscript.TType",toString:S}},d._hx_name="TFun",d.__params__=["args","ret"],d),TAnon:(d=function(k){return{_hx_index:14,fields:k,__enum__:"hscript.TType",toString:S}},d._hx_name="TAnon",d.__params__=["fields"],d),TLazy:(d=function(k){return{_hx_index:15,f:k,__enum__:"hscript.TType",toString:S}},d._hx_name="TLazy",d.__params__=["f"],d)};W.__constructs__=[W.TMono,W.TVoid,W.TInt,W.TFloat,W.TBool,W.TDynamic,W.TParam,W.TUnresolved,W.TNull,W.TInst,W.TEnum,W.TType,W.TAbstract,W.TFun,W.TAnon,W.TLazy];var Se=Qe["hscript._Checker.WithType"]={__ename__:"hscript._Checker.WithType",__constructs__:null,NoValue:{_hx_name:"NoValue",_hx_index:0,__enum__:"hscript._Checker.WithType",toString:S},Value:{_hx_name:"Value",_hx_index:1,__enum__:"hscript._Checker.WithType",toString:S},WithType:(d=function(k){return{_hx_index:2,t:k,__enum__:"hscript._Checker.WithType",toString:S}},d._hx_name="WithType",d.__params__=["t"],d)};Se.__constructs__=[Se.NoValue,Se.Value,Se.WithType];var hi=Qe["hscript.CTypedecl"]={__ename__:"hscript.CTypedecl",__constructs__:null,CTClass:(d=function(k){return{_hx_index:0,c:k,__enum__:"hscript.CTypedecl",toString:S}},d._hx_name="CTClass",d.__params__=["c"],d),CTEnum:(d=function(k){return{_hx_index:1,e:k,__enum__:"hscript.CTypedecl",toString:S}},d._hx_name="CTEnum",d.__params__=["e"],d),CTTypedef:(d=function(k){return{_hx_index:2,t:k,__enum__:"hscript.CTypedecl",toString:S}},d._hx_name="CTTypedef",d.__params__=["t"],d),CTAlias:(d=function(k){return{_hx_index:3,t:k,__enum__:"hscript.CTypedecl",toString:S}},d._hx_name="CTAlias",d.__params__=["t"],d),CTAbstract:(d=function(k){return{_hx_index:4,a:k,__enum__:"hscript.CTypedecl",toString:S}},d._hx_name="CTAbstract",d.__params__=["a"],d)};hi.__constructs__=[hi.CTClass,hi.CTEnum,hi.CTTypedef,hi.CTAlias,hi.CTAbstract];class xl{constructor(e,t){this.expr=e,this.t=t}}j["hscript.Completion"]=xl,xl.__name__="hscript.Completion",Object.assign(xl.prototype,{__class__:xl});class Ml{constructor(){this.types=new Ee,this.types=new Ee,this.types.h.Void=hi.CTAlias(W.TVoid),this.types.h.Int=hi.CTAlias(W.TInt),this.types.h.Float=hi.CTAlias(W.TFloat),this.types.h.Bool=hi.CTAlias(W.TBool),this.types.h.Dynamic=hi.CTAlias(W.TDynamic),this.parser=new tl}addXmlApi(e){let t=new Nl;t.process(e,"");let i=[],l=0,n=t.root;for(;l<n.length;){let r=n[l];++l,this.addXmlType(r,i)}let s=0;for(;s<i.length;){let r=i[s];++s,r()}this.t_string=this.getType("String")}defineClass(e,t){return t==null&&(t={name:e,fields:new Ee,statics:new Ee,params:[]}),this.types.h[e]=hi.CTClass(t),t}addXmlType(e,t){let i=this;switch(e._hx_index){case 0:let l=e.name,n=e.full,s=e.subs,r=0;for(;r<s.length;){let v=s[r];++r,this.addXmlType(v,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 Ee,statics:new Ee};this.addMeta(h,a),h.isInterface&&(a.isInterface=!0);let o=0,u=h.params;for(;o<u.length;){let v=u[o];++o,a.params.push(W.TParam(v))}t.push(function(){let v=new Ee,F=0,B=a.params;for(;F<B.length;){let M=B[F];++F;let U=h.path+"."+Ze.typeStr(M);v.h[U]=M}if(i.localParams=v,h.superClass!=null){let M=i,U=h.superClass.path,K=[],G=0,Y=h.superClass.params;for(;G<Y.length;){let $=Y[G];++G,K.push(i.makeXmlType($))}a.superClass=M.getType(U,K)}if(h.interfaces!=null){a.interfaces=[];let M=0,U=h.interfaces;for(;M<U.length;){let K=U[M];++M;let G=a.interfaces,Y=i,$=K.path,se=[],ue=0,oe=K.params;for(;ue<oe.length;){let ge=oe[ue];++ue,se.push(i.makeXmlType(ge))}G.push(Y.getType($,se))}}let A=[],L=function(M,U){if(M.isOverride||p.substr(M.name,0,4)=="get_"||p.substr(M.name,0,4)=="set_")return;let K=!M.name.startsWith("__"),G=0,Y=M.meta;for(;G<Y.length;){let me=Y[G];if(++G,me.name==":noScript")return;me.name==":noCompletion"&&(K=!1)}let $=M.set,se;switch($._hx_index){case 2:let me=$.m;se=!0;break;case 0:case 4:se=!0;break;default:se=!1}let ue={isPublic:M.isPublic,canWrite:se,complete:K,params:[],name:M.name,t:null},oe=0,ge=M.params;for(;oe<ge.length;){let me=ge[oe];++oe;let de=W.TParam(me),Oe=M.name+"."+me;A.push(Oe),ue.params.push(de),i.localParams.h[Oe]=de}if(ue.t=i.makeXmlType(M.type),M.meta!=null&&M.meta.length>0){ue.meta=[];let me=0,de=M.meta;for(;me<de.length;){let Oe=de[me];++me;let Ve=ue.meta,je=Oe.name,et=[],Ue=0,Ge=Oe.params;for(;Ue<Ge.length;){let nt=Ge[Ue];++Ue;let De;try{De=i.parser.parseString(nt)}catch(H){if(b.caught(H).unwrap()instanceof Ce)De=null;else throw H}et.push(De)}Ve.push({name:je,params:et})}}for(;A.length>0;){let me=i.localParams,de=A.pop(),Oe=me;Object.prototype.hasOwnProperty.call(Oe.h,de)&&delete Oe.h[de]}ue.name=="new"?a.constructor=ue:U.set(M.name,ue)},z=0,D=h.fields;for(;z<D.length;){let M=D[z];++z,L(M,a.fields)}let O=0,q=h.statics;for(;O<q.length;){let M=q[O];++O,L(M,a.statics)}i.localParams=null}),this.types.h[a.name]=hi.CTClass(a);break;case 2:let c=e.e;if(Object.prototype.hasOwnProperty.call(this.types.h,c.path))return;let _={name:c.path,params:[],constructors:[]};this.addMeta(c,_);let f=0,m=c.params;for(;f<m.length;){let v=m[f];++f,_.params.push(W.TParam(v))}t.push(function(){let v=new Ee,F=0,B=_.params;for(;F<B.length;){let z=B[F];++F;let D=c.path+"."+Ze.typeStr(z);v.h[D]=z}i.localParams=v;let A=0,L=c.constructors;for(;A<L.length;){let z=L[A];++A;let D=_.constructors,O=z.name,q;if(z.args==null)q=null;else{let M=[],U=0,K=z.args;for(;U<K.length;){let G=K[U];++U,M.push({name:G.name,opt:G.opt,t:i.makeXmlType(G.t)})}q=M}D.push({name:O,args:q})}i.localParams=null}),this.types.h[_.name]=hi.CTEnum(_);break;case 3:let g=e.t;if(Object.prototype.hasOwnProperty.call(this.types.h,g.path))return;let w={name:g.path,params:[],t:null},y=0,T=g.params;for(;y<T.length;){let v=T[y];++y,w.params.push(W.TParam(v))}g.path=="hscript.TypeCheck"&&w.params.reverse(),t.push(function(){let v=new Ee,F=0,B=w.params;for(;F<B.length;){let A=B[F];++F;let L=g.path+"."+Ze.typeStr(A);v.h[L]=A}i.localParams=v,w.t=i.makeXmlType(g.type),i.localParams=null}),this.types.h[g.path]=hi.CTTypedef(w);break;case 4:let E=e.a;if(Object.prototype.hasOwnProperty.call(this.types.h,E.path))return;let C={name:E.path,params:[],t:null};this.addMeta(E,C);let P=0,I=E.params;for(;P<I.length;){let v=I[P];++P,C.params.push(W.TParam(v))}t.push(function(){let v=new Ee,F=0,B=C.params;for(;F<B.length;){let A=B[F];++F;let L=E.path+"."+Ze.typeStr(A);v.h[L]=A}i.localParams=v,C.t=i.makeXmlType(E.athis),i.localParams=null}),this.types.h[E.path]=hi.CTAbstract(C);break}}addMeta(e,t){if(e.meta==null||e.meta.length==0)return;t.meta=[];let i=0,l=e.meta;for(;i<l.length;){let n=l[i];++i;let s=t.meta,r=n.name,h=[],a=0,o=n.params;for(;a<o.length;){let u=o[a];++a;let c;try{c=this.parser.parseString(u)}catch(_){if(b.caught(_).unwrap()instanceof Ce)c=null;else throw _}h.push(c)}s.push({name:r,params:h})}}makeXmlType(e){switch(e._hx_index){case 0:return W.TUnresolved("Unknown");case 1:let t=e.name,i=e.params,l=[],n=0;for(;n<i.length;){let B=i[n];++n,l.push(this.makeXmlType(B))}return this.getType(t,l);case 2:let s=e.name,r=e.params,h=[],a=0;for(;a<r.length;){let B=r[a];++a,h.push(this.makeXmlType(B))}return this.getType(s,h);case 3:let o=e.name,u=e.params,c=[],_=0;for(;_<u.length;){let B=u[_];++_,c.push(this.makeXmlType(B))}return this.getType(o,c);case 4:let f=e.args,m=e.ret,g=[],w=0;for(;w<f.length;){let B=f[w];++w,g.push({name:B.name,opt:B.opt,t:this.makeXmlType(B.t)})}return W.TFun(g,this.makeXmlType(m));case 5:let y=e.fields,T=[],E=0;for(;E<y.length;){let B=y[E];++E;let A=B.name,L=this.makeXmlType(B.type),z=B.meta,D;if(z==null)D=!1;else{let O=!1,q=0;for(;q<z.length;){let M=z[q];if(++q,M.name==":optional"){O=!0;break}}D=O}T.push({name:A,t:L,opt:D})}return W.TAnon(T);case 6:let C=e.t;return W.TDynamic;case 7:let P=e.name,I=e.params,v=[],F=0;for(;F<I.length;){let B=I[F];++F,v.push(this.makeXmlType(B))}return this.getType(P,v)}}getType(e,t){if(this.localParams!=null){let l=this.localParams.h[e];if(l!=null)return l}let i=this.resolve(e,t);if(i==null){let l=e.split(".");if(l.length>1){let n=l[l.length-2];if(p.cca(n,0)==95)return p.remove(l,n),this.getType(l.join("."),t)}return W.TUnresolved(e)}return i}resolve(e,t){if(e=="Null"){if(t==null||t.length!=1)throw b.thrown("Missing Null<T> parameter");return W.TNull(t[0])}let i=this.types.h[e];if(i==null)return null;switch(t==null&&(t=[]),i._hx_index){case 0:let l=i.c;return W.TInst(l,t);case 1:let n=i.e;return W.TEnum(n,t);case 2:let s=i.t;return W.TType(s,t);case 3:return i.t;case 4:let h=i.a;return W.TAbstract(h,t)}}}j["hscript.CheckerTypes"]=Ml,Ml.__name__="hscript.CheckerTypes",Object.assign(Ml.prototype,{__class__:Ml});class Ze{constructor(e){this.events=new Ee,this.globals=new Ee,e==null&&(e=new Ml),this.types=e}setGlobals(e,t){t==null&&(t=!1);let i=this;for(;;){let l=e.fields.h,n=l,s=Object.keys(l),r=s.length,h=0;for(;h<r;){let o=n[s[h++]];if(o.isPublic||t){let u=o.params.length==0?o.t:W.TLazy(function(){let c=i,_=o.t,f=o.params,m=[],g=0,w=o.params.length;for(;g<w;){let y=g++;m.push(i.makeMono())}return c.apply(_,f,m)});this.setGlobal(o.name,u)}}if(e.superClass==null)break;let a=e.superClass;if(a==null)throw b.thrown("assert");if(a._hx_index==9){let o=a.args;e=a.c}else throw b.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=[],l=0,n=e.length;for(;l<n;){let s=l++,r=e[s],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=Se.NoValue),this.locals=new Ee,this.types.t_string==null&&(this.types.t_string=this.types.getType("String")),this.allowDefine=this.allowGlobalsDefine,this.isCompletion=i;let l=e.e,n;if(l._hx_index==14){let h=l.args,a=l.e,o=l.name,u=l.ret;n=!0}else n=!1;n&&(e=this.mk(V.EBlock([e]),e));let s=this,r=e.e;if(r._hx_index==4){let h=r.e,a=[],o=W.TVoid,u=0;for(;u<h.length;){let _=h[u];for(++u;;){let m=_.e;if(m._hx_index==25){let g=m.name,w=m.args;_=m.e}else break}let f=_.e;if(f._hx_index==14){let m=f.e,g=f.args,w=f.name,y=f.ret;if(w!=null){let T=y==null?this.makeMono():this.makeType(y,_),E=W.TFun(this.typeArgs(g,_),T);this.locals.h[w]=E,a.push(function(){return s.currentFunType=E,s.typeExpr(_,Se.NoValue),E})}else{let T=0;for(;T<a.length;){let E=a[T];++T,E()}a=[],h[h.length-1]==_?o=this.typeExpr(_,t):this.typeExpr(_,Se.NoValue)}}else{let m=0;for(;m<a.length;){let g=a[m];++m,g()}a=[],h[h.length-1]==_?o=this.typeExpr(_,t):this.typeExpr(_,Se.NoValue)}}let c=0;for(;c<a.length;){let _=a[c];++c,o=_()}return o}return this.typeExpr(e,t)}edef(e){return e.e}error(e,t){let i=be.ECustom(e),l=new Ce(i,t.pmin,t.pmax,t.origin,t.line);if(!this.isCompletion)throw b.thrown(l)}saveLocals(){let e=new Ee,t=this.locals.h,i=t,l=Object.keys(t),n=l.length,s=0;for(;s<n;){let r=l[s++];e.h[r]=this.locals.h[r]}return e}makeType(e,t){switch(e._hx_index){case 0:let i=e.path,l=e.params,n=this.types,s=i.join("."),r;if(l==null)r=[];else{let C=[],P=0;for(;P<l.length;){let I=l[P];++P,C.push(this.makeType(I,t))}r=C}let h=n.resolve(s,r);if(h==null){let C=be.ECustom("Unknown type "+le.string(i)),P=new Ce(C,t.pmin,t.pmax,t.origin,t.line);if(!this.isCompletion)throw b.thrown(P);h=W.TDynamic}return h;case 1:let a=e.args,o=e.ret,u=0,c=[],_=0;for(;_<a.length;){let C=a[_];++_,c.push({name:"p"+u++,opt:!1,t:this.makeType(C,t)})}return W.TFun(c,this.makeType(o,t));case 2:let f=e.fields,m=[],g=0;for(;g<f.length;){let C=f[g];++g,m.push({name:C.name,opt:!1,t:this.makeType(C.t,t)})}return W.TAnon(m);case 3:let w=e.t;return this.makeType(w,t);case 4:let y=e.t;return this.makeType(y,t);case 5:let T=e.n,E=e.t;return this.makeType(E,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==W.TDynamic?!1:this.linkLoop(e,W.TDynamic);case 9:let l=t.c,n=t.args,s=0;for(;s<n.length;){let C=n[s];if(++s,this.linkLoop(e,C))return!0}return!1;case 10:let r=t.e,h=t.args,a=0;for(;a<h.length;){let C=h[a];if(++a,this.linkLoop(e,C))return!0}return!1;case 11:let o=t.t,u=t.args,c=0;for(;c<u.length;){let C=u[c];if(++c,this.linkLoop(e,C))return!0}return!1;case 12:let _=t.a,f=t.args,m=0;for(;m<f.length;){let C=f[m];if(++m,this.linkLoop(e,C))return!0}return!1;case 13:let g=t.args,w=t.ret,y=0;for(;y<g.length;){let C=g[y];if(++y,this.linkLoop(e,C.t))return!0}return this.linkLoop(e,w);case 14:let T=t.fields,E=0;for(;E<T.length;){let C=T[E];if(++E,this.linkLoop(e,C.t))return!0}return!1;default:return!1}}link(e,t,i){return this.linkLoop(e,t)?this.follow(t)==e:(t==W.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 l=e.t;switch(t._hx_index){case 0:let g=t.r;return g.r==null?this.link(t,e,g)?(g.r=e,!0):!1:this.typeEq(e,g.r);case 8:let w=t.t,y=l;return this.typeEq(y,w);case 11:let T=t.t,E=t.args;return this.typeEq(e,this.apply(T.t,T.params,E));default:let C=l;return this.typeEq(C,t)}break;case 9:let n=e.c,s=e.args;switch(t._hx_index){case 0:let g=t.r;return g.r==null?this.link(t,e,g)?(g.r=e,!0):!1:this.typeEq(e,g.r);case 8:let w=t.t;return this.typeEq(e,w);case 9:let y=t.c,T=t.args,E=s;if(n==y){let v=0,F=E.length;for(;v<F;){let B=v++;if(!this.typeEq(E[B],T[B]))return!1}return!0}break;case 11:let P=t.t,I=t.args;return this.typeEq(e,this.apply(P.t,P.params,I));default:}break;case 10:let r=e.e,h=e.args;switch(t._hx_index){case 0:let g=t.r;return g.r==null?this.link(t,e,g)?(g.r=e,!0):!1:this.typeEq(e,g.r);case 8:let w=t.t;return this.typeEq(e,w);case 10:let y=t.e,T=t.args,E=h;if(r==y){let v=0,F=E.length;for(;v<F;){let B=v++;if(!this.typeEq(E[B],T[B]))return!1}return!0}break;case 11:let P=t.t,I=t.args;return this.typeEq(e,this.apply(P.t,P.params,I));default:}break;case 11:let a=e.t,o=e.args;switch(t._hx_index){case 0:let g=t.r;return g.r==null?this.link(t,e,g)?(g.r=e,!0):!1:this.typeEq(e,g.r);case 8:let w=t.t,y=o,T=a;return this.typeEq(this.apply(T.t,T.params,y),t);case 11:let E=t.t,C=t.args,P=o;if(a==E){let B=0,A=P.length;for(;B<A;){let L=B++;if(!this.typeEq(P[L],C[L]))return!1}return!0}else{let B=o,A=a;return this.typeEq(this.apply(A.t,A.params,B),t)}break;default:let v=o,F=a;return this.typeEq(this.apply(F.t,F.params,v),t)}break;case 12:let u=e.a,c=e.args;switch(t._hx_index){case 0:let g=t.r;return g.r==null?this.link(t,e,g)?(g.r=e,!0):!1:this.typeEq(e,g.r);case 8:let w=t.t;return this.typeEq(e,w);case 11:let y=t.t,T=t.args;return this.typeEq(e,this.apply(y.t,y.params,T));case 12:let E=t.a,C=t.args,P=c;if(u==E){let v=0,F=P.length;for(;v<F;){let B=v++;if(!this.typeEq(P[B],C[B]))return!1}return!0}break;default:}break;case 13:let _=e.args,f=e.ret;switch(t._hx_index){case 0:let g=t.r;return g.r==null?this.link(t,e,g)?(g.r=e,!0):!1:this.typeEq(e,g.r);case 8:let w=t.t;return this.typeEq(e,w);case 11:let y=t.t,T=t.args;return this.typeEq(e,this.apply(y.t,y.params,T));case 13:let E=t.args,C=t.ret,P=f,I=_;if(I.length==E.length){let v=0,F=I.length;for(;v<F;){let B=v++;if(!this.typeEq(I[B].t,E[B].t))return!1}return this.typeEq(P,C)}break;default:}break;case 14:let m=e.fields;switch(t._hx_index){case 0:let g=t.r;return g.r==null?this.link(t,e,g)?(g.r=e,!0):!1:this.typeEq(e,g.r);case 8:let w=t.t;return this.typeEq(e,w);case 11:let y=t.t,T=t.args;return this.typeEq(e,this.apply(y.t,y.params,T));case 14:let E=t.fields,C=m;if(C.length==E.length){let P=Object.create(null),I=0;for(;I<E.length;){let F=E[I];++I,P[F.name]=F}let v=0;for(;v<C.length;){let F=C[v];++v;let B=P[F.name];if(B==null||!this.typeEq(F.t,B.t))return!1}return!0}break;default:}break;default:switch(t._hx_index){case 0:let g=t.r;return g.r==null?this.link(t,e,g)?(g.r=e,!0):!1:this.typeEq(e,g.r);case 8:let w=t.t;return this.typeEq(e,w);case 11:let y=t.t,T=t.args;return this.typeEq(e,this.apply(y.t,y.params,T));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 c=t.r;return c.r==null?this.link(t,e,c)?(c.r=e,!0):!1:this.tryUnify(e,c.r);case 3:return!0;case 5:return!0;case 8:let _=t.t;return this.tryUnify(e,_);case 11:let f=t.t,m=t.args;return this.tryUnify(e,this.apply(f.t,f.params,m));default:}break;case 5:switch(t._hx_index){case 0:let c=t.r;return c.r==null?this.link(t,e,c)?(c.r=e,!0):!1:this.tryUnify(e,c.r);case 5:return!0;case 8:let _=t.t;return this.tryUnify(e,_);case 11:let f=t.t,m=t.args;return this.tryUnify(e,this.apply(f.t,f.params,m));default:return!0}break;case 8:let l=e.t;switch(t._hx_index){case 0:let c=t.r;return c.r==null?this.link(t,e,c)?(c.r=e,!0):!1:this.tryUnify(e,c.r);case 5:let _=l;return this.tryUnify(_,t);case 8:let f=t.t,m=l;return this.tryUnify(m,t);case 11:let g=t.t,w=t.args;return this.tryUnify(e,this.apply(g.t,g.params,w));default:let y=l;return this.tryUnify(y,t)}break;case 9:let n=e.c,s=e.args;switch(t._hx_index){case 0:let c=t.r;return c.r==null?this.link(t,e,c)?(c.r=e,!0):!1:this.tryUnify(e,c.r);case 5:return!0;case 8:let _=t.t;return this.tryUnify(e,_);case 9:let f=t.c,m=t.args,g=s,w=n;for(;w!=f;){if(w.interfaces!=null){let L=0,z=w.interfaces;for(;L<z.length;){let D=z[L];if(++L,D._hx_index==9){let O=D.c,q=D.args,M=[],U=0;for(;U<q.length;){let G=q[U];++U,M.push(this.apply(G,w.params,g))}let K=W.TInst(O,M);if(this.tryUnify(K,t))return!0}else throw b.thrown("assert")}}let A=w.superClass;if(A==null)return!1;if(A._hx_index==9){let L=A.c,z=A.args,D=[],O=0;for(;O<z.length;){let q=z[O];++O,D.push(this.apply(q,w.params,g))}g=D,w=L}else throw b.thrown("assert")}let y=0,T=g.length;for(;y<T;){let A=y++;if(!this.typeEq(g[A],m[A]))return!1}return!0;case 11:let E=t.t,C=t.args;return this.tryUnify(e,this.apply(E.t,E.params,C));case 14:let P=t.fields,I=s,v=n,F=0,B=P.length;for(;F<B;){let A=F++,L=P[A],z=null,D=v;for(;z=D.fields.h[L.name],z==null;){if(D.superClass==null)return!1;let O=D.superClass;if(O==null)throw b.thrown("assert");if(O._hx_index==9){let q=O.args;D=O.c}else throw b.thrown("assert")}if(!this.typeEq(this.apply(z.t,v.params,I),L.t))return!1}return!0;default:}break;case 11:let r=e.t,h=e.args;switch(t._hx_index){case 0:let c=t.r;return c.r==null?this.link(t,e,c)?(c.r=e,!0):!1:this.tryUnify(e,c.r);case 5:let _=h,f=r;return this.tryUnify(this.apply(f.t,f.params,_),t);case 8:let m=t.t,g=h,w=r;return this.tryUnify(this.apply(w.t,w.params,g),t);case 11:let y=t.t,T=t.args,E=h,C=r;return this.tryUnify(this.apply(C.t,C.params,E),t);default:let P=h,I=r;return this.tryUnify(this.apply(I.t,I.params,P),t)}break;case 13:let a=e.args,o=e.ret;switch(t._hx_index){case 0:let c=t.r;return c.r==null?this.link(t,e,c)?(c.r=e,!0):!1:this.tryUnify(e,c.r);case 5:return!0;case 8:let _=t.t;return this.tryUnify(e,_);case 11:let f=t.t,m=t.args;return this.tryUnify(e,this.apply(f.t,f.params,m));case 12:let g=t.a,w=t.args,y=g.meta,T=g.params,E=g.t;if(g.name=="haxe.Function")return!0;break;case 13:let C=t.args,P=t.ret,I=o,v=a;if(v.length==C.length){let F=0,B=v.length;for(;F<B;){let A=F++,L=v[A],z=C[A];if(z.opt&&!L.opt||!this.tryUnify(z.t,L.t))return!1}return this.tryUnify(I,P)}break;default:}break;case 14:let u=e.fields;switch(t._hx_index){case 0:let c=t.r;return c.r==null?this.link(t,e,c)?(c.r=e,!0):!1:this.tryUnify(e,c.r);case 5:return!0;case 8:let _=t.t;return this.tryUnify(e,_);case 11:let f=t.t,m=t.args;return this.tryUnify(e,this.apply(f.t,f.params,m));case 14:let g=t.fields,w=u;if(g.length==0)return!0;let y=Object.create(null),T=0;for(;T<w.length;){let C=w[T];++T,y[C.name]=C}let E=0;for(;E<g.length;){let C=g[E];++E;let P=y[C.name];if(P==null){if(C.opt)continue;return!1}if(!this.typeEq(P.t,C.t))return!1}return!0;default:}break;default:switch(t._hx_index){case 0:let c=t.r;return c.r==null?this.link(t,e,c)?(c.r=e,!0):!1:this.tryUnify(e,c.r);case 5:return!0;case 8:let _=t.t;return this.tryUnify(e,_);case 11:let f=t.t,m=t.args;return this.tryUnify(e,this.apply(f.t,f.params,m));default:}}return this.typeEq(e,t)}unify(e,t,i){if(!this.tryUnify(e,t)){let l=be.ECustom(Ze.typeStr(e)+" should be "+Ze.typeStr(t)),n=new Ce(l,i.pmin,i.pmax,i.origin,i.line);if(!this.isCompletion)throw b.thrown(n)}}apply(e,t,i){if(i.length!=t.length)throw b.thrown("Invalid number of type parameters");if(i.length==0)return e;let l=new Xi,n=0,s=t.length;for(;n<s;){let a=n++;l.set(t[a],i[a])}let r=null,h=this;return r=function(a){let o=l.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 l=e.name;return e;case 7:let n=e.name;return e;case 8:let s=e.t;return W.TNull(t(s));case 9:let r=e.args;if(r.length==0)return e;{let T=r,E=e.c,C=[],P=0;for(;P<T.length;){let I=T[P];++P,C.push(t(I))}return W.TInst(E,C)}break;case 10:let h=e.args;if(h.length==0)return e;{let T=h,E=e.e,C=[],P=0;for(;P<T.length;){let I=T[P];++P,C.push(t(I))}return W.TEnum(E,C)}break;case 11:let a=e.args;if(a.length==0)return e;{let T=a,E=e.t,C=[],P=0;for(;P<T.length;){let I=T[P];++P,C.push(t(I))}return W.TType(E,C)}break;case 12:let o=e.args;if(o.length==0)return e;{let T=o,E=e.a,C=[],P=0;for(;P<T.length;){let I=T[P];++P,C.push(t(I))}return W.TAbstract(E,C)}break;case 13:let u=e.args,c=e.ret,_=[],f=0;for(;f<u.length;){let T=u[f];++f,_.push({name:T.name,opt:T.opt,t:t(T.t)})}return W.TFun(_,t(c));case 14:let m=e.fields,g=[],w=0;for(;w<m.length;){let T=m[w];++w,g.push({name:T.name,opt:T.opt,t:t(T.t)})}return W.TAnon(g);case 15:let y=e.f;return t(y())}}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 l=e.t,n=e.args;return this.follow(this.apply(l.t,l.params,n));case 15:let s=e.f;return this.follow(s());default:return e}}getFields(e){let t=[],i=this,l=this.follow(e);switch(l._hx_index){case 9:let n=l.c,s=l.args,r=function(c){return i.apply(c,n.params,s)};for(;n!=null;){let c=n.fields.h,_=c,f=Object.keys(c),m=f.length,g=0;for(;g<m;){let y=f[g++],T=n.fields.h[y];if(!T.isPublic||!T.complete)continue;let E=T.name,C=r(T.t);this.allowAsync&&E.startsWith("a_")&&(C=this.unasync(C),E=p.substr(E,2,null)),t.push({name:E,t:C})}if(n.isInterface&&n.interfaces!=null){let y=0,T=n.interfaces;for(;y<T.length;){let E=T[y];++y;let C=0,P=this.getFields(E);for(;C<P.length;){let I=P[C];++C,t.push({name:I.name,t:r(I.t)})}}}if(n.superClass==null)break;let w=n.superClass;if(w==null)break;if(w._hx_index==9){let y=w.c,T=w.args,E=r;r=function(C){return E(i.apply(C,y.params,T))},n=y}else break}break;case 13:let h=l.args,a=l.ret;this.isCompletion&&t.push({name:"bind",t:W.TFun(h,W.TVoid)});break;case 14:let o=l.fields,u=0;for(;u<o.length;){let c=o[u];++u,t.push({name:c.name,t:c.t})}break;default:}return t}getField(e,t,i,l){l==null&&(l=!1);let n=this.follow(e);switch(n._hx_index){case 5:return this.makeMono();case 9:let s=n.c,r=n.args,h=s.fields.h[t];if(h==null&&this.allowAsync&&(h=s.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&&s.isInterface&&s.interfaces!=null){let c=0,_=s.interfaces;for(;c<_.length;){let f=_[c];++c;let m=this.getField(f,t,i,l);if(m!=null)return this.apply(m,s.params,r)}}if(h==null){if(s.superClass==null)return null;let c=this.getField(s.superClass,t,i,l);return c!=null&&(c=this.apply(c,s.params,r)),c}if(!h.isPublic){let c=be.ECustom("Can't access private field "+t+" on "+s.name),_=new Ce(c,i.pmin,i.pmax,i.origin,i.line);if(!this.isCompletion)throw b.thrown(_)}if(l&&!h.canWrite){let c=be.ECustom("Can't write readonly field "+t+" on "+s.name),_=new Ce(c,i.pmin,i.pmax,i.origin,i.line);if(!this.isCompletion)throw b.thrown(_)}let a=h.t;if(h.params!=null){let c=h.params,_=[],f=0,m=h.params.length;for(;f<m;){let g=f++;_.push(this.makeMono())}a=this.apply(a,c,_)}return this.apply(a,s.params,r);case 14:let o=n.fields,u=0;for(;u<o.length;){let c=o[u];if(++u,c.name==t)return c.t}return null;default:return null}}unasync(e){let t=this.follow(e);if(t._hx_index==13){let i=t.args,l=t.ret;if(i.length>0){let n=i.slice(),s=this.follow(n.shift().t);if(s._hx_index==13){let r=s.args,h=s.ret;if(r.length==1){let a=r[0];return W.TFun(n,a.t)}}}}return null}typeExprWith(e,t){let i=this.typeExpr(e,Se.WithType(t));return this.unify(i,t,e),t}makeMono(){return W.TMono({r:null})}makeIterator(e){return W.TAnon([{name:"next",opt:!1,t:W.TFun([],e)},{name:"hasNext",opt:!1,t:W.TFun([],W.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,l=t.constructor,n=t.fields,s=t.interfaces,r=t.isInterface,h=t.meta,a=t.params,o=t.statics,u=t.superClass;return t.name=="String"}else return!1}onCompletion(e,t){if(this.isCompletion)throw b.thrown(new xl(e,t))}typeField(e,t,i,l){let n=this.typeExpr(e,Se.Value);t==null&&this.onCompletion(i,n);let s=this.getField(n,t,i,l);if(s==null){let r=be.ECustom(Ze.typeStr(n)+" has no field "+t),h=new Ce(r,i.pmin,i.pmax,i.origin,i.line);if(!this.isCompletion)throw b.thrown(h);s=W.TDynamic}return s}typeExpr(e,t){if(e==null&&this.isCompletion)return t._hx_index==2?t.t:W.TDynamic;let i=this,l=e.e;switch(l._hx_index){case 0:let h=l.c;switch(h._hx_index){case 0:let ce=h.v;return W.TInt;case 1:let we=h.f;return W.TFloat;case 2:let Fe=h.s;return this.types.t_string}break;case 1:let a=l.v,o=this.locals.h[a];if(o!=null)return o;let u=this.globals.h[a];if(u!=null){if(u==null)return u;if(u._hx_index==15){let ce=u.f;return ce()}else return u}if(this.allowAsync&&(u=this.globals.h["a_"+a],u!=null&&(u=this.unasync(u)),u!=null))return u;switch(a){case"false":case"true":return W.TBool;case"null":return this.makeMono();case"trace":return W.TDynamic;default:if(t._hx_index==2){let Fe=t.t;if(Fe._hx_index==10){let qe=Fe,At=Fe.e,Pt=Fe.args,ht=0,yi=At.constructors;for(;ht<yi.length;){let ri=yi[ht];if(++ht,ri.name==a){if(this.onTopDownEnum(At,a)){let pt=ri.args==null?qe:W.TFun(ri.args,qe);return this.apply(pt,At.params,Pt)}break}}}}if(this.isCompletion)return W.TDynamic;let ce=be.ECustom("Unknown identifier "+a),we=new Ce(ce,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw b.thrown(we)}break;case 2:let c=l.n,_=l.t,f=l.e,m=_==null?this.makeMono():this.makeType(_,e);if(f!=null){let ce=this.typeExpr(f,_==null?Se.Value:Se.WithType(m));_==null?m=ce:this.unify(ce,m,f)}return this.locals.h[c]=m,W.TVoid;case 3:let g=l.e;return this.typeExpr(g,t);case 4:let w=l.e,y=W.TVoid,T=this.saveLocals(),E=0;for(;E<w.length;){let ce=w[E];++E,y=this.typeExpr(ce,ce==w[w.length-1]?t:Se.NoValue)}return this.locals=T,y;case 5:let C=l.e,P=l.f;return this.typeField(C,P,e,!1);case 6:let I=l.op,v=l.e1,F=l.e2;switch(I){case"!=":case"==":let ce=this.typeExpr(v,Se.Value),we=this.typeExpr(F,Se.WithType(ce));return this.tryUnify(ce,we)||this.unify(we,ce,F),W.TBool;case"%":case"*":case"-":case"/":let Fe=this.typeExpr(v,Se.WithType(W.TInt)),qe=this.typeExpr(F,Se.WithType(Fe));this.tryUnify(Fe,qe)||this.unify(qe,Fe,F);let At=this.follow(Fe),Pt=this.follow(qe);switch(At._hx_index){case 2:switch(Pt._hx_index){case 2:return I=="/"?W.TFloat:W.TInt;case 3:case 5:return W.TFloat;default:this.unify(Fe,W.TFloat,v),this.unify(qe,W.TFloat,F)}break;case 3:switch(Pt._hx_index){case 2:case 3:case 5:return W.TFloat;default:this.unify(Fe,W.TFloat,v),this.unify(qe,W.TFloat,F)}break;case 5:switch(Pt._hx_index){case 2:case 3:case 5:return W.TFloat;default:this.unify(Fe,W.TFloat,v),this.unify(qe,W.TFloat,F)}break;default:this.unify(Fe,W.TFloat,v),this.unify(qe,W.TFloat,F)}break;case"+":let ht=this.typeExpr(v,Se.WithType(W.TInt)),yi=this.typeExpr(F,Se.WithType(ht));this.tryUnify(ht,yi);let ri=this.follow(ht),pt=this.follow(yi);switch(ri._hx_index){case 2:switch(pt._hx_index){case 2:return W.TInt;case 3:return W.TFloat;case 5:return W.TDynamic;default:let Ct=ri,xi=pt;if(this.isString(Ct)||this.isString(xi))return this.types.t_string;this.unify(Ct,W.TFloat,v),this.unify(xi,W.TFloat,F)}break;case 3:switch(pt._hx_index){case 2:case 3:return W.TFloat;case 5:return W.TDynamic;default:let Ct=ri,xi=pt;if(this.isString(Ct)||this.isString(xi))return this.types.t_string;this.unify(Ct,W.TFloat,v),this.unify(xi,W.TFloat,F)}break;case 5:return W.TDynamic;default:if(pt._hx_index==5)return W.TDynamic;{let Ct=ri,xi=pt;if(this.isString(Ct)||this.isString(xi))return this.types.t_string;this.unify(Ct,W.TFloat,v),this.unify(xi,W.TFloat,F)}}break;case"...":return this.typeExprWith(v,W.TInt),this.typeExprWith(F,W.TInt),this.makeIterator(W.TInt);case"&":case"<<":case">>":case">>>":case"^":case"|":return this.typeExprWith(v,W.TInt),this.typeExprWith(F,W.TInt),W.TInt;case"<":case"<=":case">":case">=":let qt=this.typeExpr(v,Se.Value),Ai=this.typeExpr(F,Se.WithType(qt));this.tryUnify(qt,Ai)||this.unify(Ai,qt,F);let sl=this.follow(qt);switch(sl._hx_index){case 2:case 3:case 4:break;case 9:let Ct=sl.c,xi=sl.args,an=Ct.constructor,An=Ct.fields,Dn=Ct.interfaces,Rn=Ct.isInterface,Vn=Ct.meta,Un=Ct.params,qn=Ct.statics,Wn=Ct.superClass;if(Ct.name!="String"){let Mn=be.ECustom("Cannot compare "+Ze.typeStr(qt)),Fn=new Ce(Mn,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw b.thrown(Fn)}break;default:let Pn=be.ECustom("Cannot compare "+Ze.typeStr(qt)),Nn=new Ce(Pn,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw b.thrown(Nn)}return W.TBool;case"=":if(this.allowDefine){let Ct=v.e;if(Ct._hx_index==1){let xi=Ct.v;if(!Object.prototype.hasOwnProperty.call(this.locals.h,xi)&&!Object.prototype.hasOwnProperty.call(this.globals.h,xi)){let an=this.typeExpr(F,Se.Value);return this.locals.h[xi]=an,an}}}let vl,Yl=v.e;if(Yl._hx_index==5){let Ct=Yl.e,xi=Yl.f;vl=this.typeField(Ct,xi,v,!0)}else vl=this.typeExpr(v,Se.Value);return this.typeExprWith(F,vl),vl;case"&&":case"||":return this.typeExprWith(v,W.TBool),this.typeExprWith(F,W.TBool),W.TBool;default:if(p.cca(I,I.length-1)==61){let Ct=this.typeExpr(this.mk(V.EBinop(p.substr(I,0,I.length-1),v,F),e),t);return this.typeExpr(this.mk(V.EBinop("=",v,F),e),t)}let On=be.ECustom("Unsupported operation "+I),In=new Ce(On,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw b.thrown(In)}break;case 7:let B=l.prefix,A=l.op,L=l.e,z=this.typeExpr(L,Se.Value);switch(A){case"!":return this.unify(z,W.TBool,L),z;case"++":case"-":case"--":return this.unify(z,W.TInt,L),z;default:}break;case 8:let D=l.e,O=l.params,q=D.e;if(q._hx_index==5&&q.f=="bind"){let ce=q.e,we=this.typeExpr(ce,Se.Value);if(we._hx_index==13){let Fe=we.args,qe=we.ret,At=Fe.slice(),Pt=0;for(;Pt<O.length;){let ht=O[Pt];++Pt;let yi=At.shift();if(yi==null){let ri=be.ECustom("Too many arguments"),pt=new Ce(ri,ht.pmin,ht.pmax,ht.origin,ht.line);if(!this.isCompletion)throw b.thrown(pt);return W.TFun([],qe)}this.typeExprWith(ht,yi.t)}return W.TFun(At,qe)}}let M=D.e,U;if(M._hx_index==1){let ce=M.v;if(t._hx_index==2){let we=t.t;if(we._hx_index==10){let Fe=we.e,qe=we.args;U=t}else U=Se.Value}else U=Se.Value}else U=Se.Value;let K=this.typeExpr(D,U),G=this.follow(K);switch(G._hx_index){case 5:let ce=0;for(;ce<O.length;){let pt=O[ce];++ce,this.typeExpr(pt,Se.Value)}return this.makeMono();case 13:let we=G.args,Fe=G.ret,qe=0,At=O.length;for(;qe<At;){let pt=qe++,qt=we[pt];if(qt==null){let sl=O[pt],vl=be.ECustom("Too many arguments"),Yl=new Ce(vl,sl.pmin,sl.pmax,sl.origin,sl.line);if(!this.isCompletion)throw b.thrown(Yl);break}let Ai=this.typeExpr(O[pt],qt==null?Se.Value:Se.WithType(qt.t));this.unify(Ai,qt.t,O[pt])}let Pt=O.length,ht=we.length;for(;Pt<ht;){let pt=Pt++;if(!we[pt].opt){let qt=be.ECustom("Missing argument "+we[pt].name+":"+Ze.typeStr(we[pt].t)),Ai=new Ce(qt,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw b.thrown(Ai)}}return Fe;default:let yi=be.ECustom(Ze.typeStr(K)+" cannot be called"),ri=new Ce(yi,D.pmin,D.pmax,D.origin,D.line);if(!this.isCompletion)throw b.thrown(ri);return this.makeMono()}break;case 9:let Y=l.cond,$=l.e1,se=l.e2;this.typeExprWith(Y,W.TBool);let ue=this.typeExpr($,t);if(se==null)return ue;let oe=this.typeExpr(se,t);if(t==Se.NoValue)return W.TVoid;if(this.tryUnify(oe,ue))return ue;if(this.tryUnify(ue,oe))return oe;this.unify(oe,ue,se);break;case 10:let ge=l.cond,me=l.e;return this.typeExprWith(ge,W.TBool),this.typeExpr(me,Se.NoValue),W.TVoid;case 11:let de=l.v,Oe=l.it,Ve=l.e,je=this.saveLocals(),et=this.typeExpr(Oe,Se.Value),Ue=this.getIteratorType(Oe,et);return this.locals.h[de]=Ue,this.typeExpr(Ve,Se.NoValue),this.locals=je,W.TVoid;case 12:case 13:return W.TVoid;case 14:let Ge=l.args,nt=l.e,De=l.name,H=l.ret,ie=null,R=null,ee=null;if(this.currentFunType!=null){let ce=this.currentFunType;if(ce._hx_index==13){let we=ce.args,Fe=ce.ret;ie=this.currentFunType,R=Fe,ee=we}else throw b.thrown("assert");this.currentFunType=null}else R=H==null?this.makeMono():this.makeType(H,e);let X=this.saveLocals(),Q=this.allowReturn,ae=this.allowDefine,_e=this.hasReturn;this.allowReturn=R,this.allowDefine=!1,this.hasReturn=!1;let xe=null,Ye;if(De!=null){let ce;if(t._hx_index==2){let we=this.follow(t.t);if(we._hx_index==13){let Fe=we.args,qe=we.ret;ce=!0}else ce=!1}else ce=!1;Ye=!ce}else Ye=!1;if(Ye){let ce=this.events.h[De];ce!=null&&(t=Se.WithType(ce))}if(t._hx_index==2){let ce=this.follow(t.t);if(ce._hx_index==13){let we=ce.args,Fe=ce.ret;xe=we,this.unify(R,Fe,e)}}ee==null&&(ee=this.typeArgs(Ge,e));let gt=0,Be=ee.length;for(;gt<Be;){let ce=gt++,we=ee[ce];if(xe!=null)if(ce<xe.length)this.unify(xe[ce].t,we.t,e);else{let Fe=be.ECustom("Extra argument "+we.name),qe=new Ce(Fe,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw b.thrown(qe)}this.locals.h[we.name]=we.t}if(xe!=null&&ee.length<xe.length){let ce="Missing "+(xe.length-ee.length)+" arguments (",we=[],Fe=ee.length,qe=xe.length;for(;Fe<qe;){let ht=Fe++;we.push(Ze.typeStr(xe[ht].t))}let At=be.ECustom(ce+we.join(",")+")"),Pt=new Ce(At,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw b.thrown(Pt)}if(this.typeExpr(nt,Se.NoValue),!this.hasReturn&&!this.tryUnify(R,W.TVoid)){let ce=be.ECustom("Missing return "+Ze.typeStr(R)),we=new Ce(ce,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw b.thrown(we)}return this.allowDefine=ae,this.allowReturn=Q,this.hasReturn=_e,this.locals=X,ie==null&&(ie=W.TFun(ee,R),De!=null&&(X.h[De]=ie)),ie;case 15:let _t=l.e,ve=_t==null?W.TVoid:this.typeExpr(_t,this.allowReturn==null?Se.Value:Se.WithType(this.allowReturn));if(this.hasReturn=!0,this.allowReturn==null){let ce=be.ECustom("Return not allowed here"),we=new Ce(ce,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw b.thrown(we)}else this.unify(ve,this.allowReturn,_t??e);return this.makeMono();case 16:let Pe=l.e,ot=l.index;this.typeExprWith(ot,W.TInt);let tt=this.typeExpr(Pe,Se.Value),bt=this.follow(tt);if(bt._hx_index==9){let ce=bt.c,we=bt.args,Fe=ce.constructor,qe=ce.fields,At=ce.interfaces,Pt=ce.isInterface,ht=ce.meta,yi=ce.params,ri=ce.statics,pt=ce.superClass;if(ce.name=="Array"){if(we.length==1)return we[0];{let qt=be.ECustom(Ze.typeStr(tt)+" is not an Array"),Ai=new Ce(qt,Pe.pmin,Pe.pmax,Pe.origin,Pe.line);if(!this.isCompletion)throw b.thrown(Ai)}}else{let qt=be.ECustom(Ze.typeStr(tt)+" is not an Array"),Ai=new Ce(qt,Pe.pmin,Pe.pmax,Pe.origin,Pe.line);if(!this.isCompletion)throw b.thrown(Ai)}}else{let ce=be.ECustom(Ze.typeStr(tt)+" is not an Array"),we=new Ce(ce,Pe.pmin,Pe.pmax,Pe.origin,Pe.line);if(!this.isCompletion)throw b.thrown(we)}break;case 17:let Kt=l.e,ft=null,li=0;for(;li<Kt.length;){let ce=Kt[li];++li;let we=this.typeExpr(ce,ft==null?Se.Value:Se.WithType(ft));ft==null?ft=we:this.tryUnify(we,ft)||(this.tryUnify(ft,we)?ft=we:this.unify(we,ft,ce))}return ft==null&&(ft=this.makeMono()),this.types.getType("Array",[ft]);case 18:let $e=l.cl,Bt=l.params;break;case 19:let It=l.e;return this.typeExpr(It,Se.Value),this.makeMono();case 20:let Lt=l.e,mt=l.v,Vt=l.t,Ht=l.ecatch,Ut=this.typeExpr(Lt,t),ni=this.locals.h[mt],si=this.locals,jt=this.makeType(Vt,Ht);si.h[mt]=jt;let it=this.typeExpr(Ht,t);if(ni!=null)this.locals.h[mt]=ni;else{let ce=this.locals;Object.prototype.hasOwnProperty.call(ce.h,mt)&&delete ce.h[mt]}return t==Se.NoValue?W.TVoid:this.tryUnify(Ut,it)?it:(this.unify(it,Ut,Ht),Ut);case 21:let ki=l.fl;if(t._hx_index==2){let ce=this.follow(t.t);if(ce._hx_index==14){let we=ce.fields;if(we.length>0){let Fe=Object.create(null),qe=0;for(;qe<we.length;){let ht=we[qe];++qe,Fe[ht.name]=ht}let At=[],Pt=0;for(;Pt<ki.length;){let ht=ki[Pt];++Pt;let yi=Fe[ht.name],ri;if(yi==null){let pt=ht.e,qt=be.ECustom("Extra field "+ht.name),Ai=new Ce(qt,pt.pmin,pt.pmax,pt.origin,pt.line);if(!this.isCompletion)throw b.thrown(Ai);ri=W.TDynamic}else ri=yi.t;At.push({t:this.typeExprWith(ht.e,ri),opt:!1,name:ht.name})}return W.TAnon(At)}else{let Fe=[],qe=0;for(;qe<ki.length;){let At=ki[qe];++qe,Fe.push({t:this.typeExpr(At.e,Se.Value),opt:!1,name:At.name})}return W.TAnon(Fe)}}else{let we=[],Fe=0;for(;Fe<ki.length;){let qe=ki[Fe];++Fe,we.push({t:this.typeExpr(qe.e,Se.Value),opt:!1,name:qe.name})}return W.TAnon(we)}}else{let ce=[],we=0;for(;we<ki.length;){let Fe=ki[we];++we,ce.push({t:this.typeExpr(Fe.e,Se.Value),opt:!1,name:Fe.name})}return W.TAnon(ce)}break;case 22:let ye=l.cond,lt=l.e1,ct=l.e2;this.typeExprWith(ye,W.TBool);let rt=this.typeExpr(lt,t);if(ct==null)return rt;let dt=this.typeExpr(ct,t);if(t==Se.NoValue)return W.TVoid;if(this.tryUnify(dt,rt))return rt;if(this.tryUnify(rt,dt))return dt;this.unify(dt,rt,ct);break;case 23:let xt=l.e,St=l.cases,Jt=l.defaultExpr,wt=null,Ql=this.typeExpr(xt,Se.Value),fl=0;for(;fl<St.length;){let ce=St[fl];++fl;let we=0,Fe=ce.values;for(;we<Fe.length;){let Pt=Fe[we];++we;let ht=this.typeExpr(Pt,Se.WithType(Ql));this.unify(ht,Ql,Pt)}let qe=this.typeExpr(ce.expr,t),At=ce.expr;t!=Se.NoValue&&(wt==null?wt=qe:i.tryUnify(qe,wt)||(i.unify(wt,qe,At),wt=qe))}if(Jt!=null){let ce=this.typeExpr(Jt,t);t!=Se.NoValue&&(wt==null?wt=ce:i.tryUnify(ce,wt)||(i.unify(wt,ce,Jt),wt=ce))}return t==Se.NoValue?W.TVoid:wt??this.makeMono();case 24:let Qi=l.cond,rn=l.e;return this.typeExprWith(Qi,W.TBool),this.typeExpr(rn,Se.NoValue),W.TVoid;case 25:let Ln=l.args,Tn=l.name,En=l.e;return Tn==":untyped"&&this.allowUntypedMeta?this.makeMono():this.typeExpr(En,t);case 26:let mn=l.e,Sn=l.t,hn=this.makeType(Sn,e),vn=this.typeExpr(mn,Se.WithType(hn));return this.unify(vn,hn,mn),hn}let n=e.e,s=be.ECustom("Don't know how to type "+Qe[n.__enum__].__constructs__[n._hx_index]._hx_name),r=new Ce(s,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw b.thrown(r);return W.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,u=r.interfaces,c=r.isInterface,_=r.meta,f=r.params,m=r.statics,g=r.superClass;if(r.name=="Array"&&h.length==1)return h[0]}let l=this.getField(t,"iterator",e);if(l==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)}l!=null&&(l==null?l=null:l._hx_index==13&&l.args.length==0?l=l.ret:l=null);let n=this.makeMono(),s=this.makeIterator(n);return this.unify(l??t,s,e),n}static typeStr(e){switch(e._hx_index){case 0:let t=e.r;return t.r==null?"Unknown":Ze.typeStr(t.r);case 6:return e.name;case 7:return"?"+e.name;case 8:let n=e.t;return"Null<"+Ze.typeStr(n)+">";case 9:let s=e.c,r=e.args,h=s.name,a;if(r.length==0)a="";else{let A=[],L=0;for(;L<r.length;){let z=r[L];++L,A.push(Ze.typeStr(z))}a="<"+A.join(",")+">"}return h+a;case 10:let o=e.e,u=e.args,c=o.name,_;if(u.length==0)_="";else{let A=[],L=0;for(;L<u.length;){let z=u[L];++L,A.push(Ze.typeStr(z))}_="<"+A.join(",")+">"}return c+_;case 11:let f=e.t,m=e.args;if(f.name=="hscript.TypeCheck")return Ze.typeStr(m[1]);{let A=f.name,L;if(m.length==0)L="";else{let z=[],D=0;for(;D<m.length;){let O=m[D];++D,z.push(Ze.typeStr(O))}L="<"+z.join(",")+">"}return A+L}break;case 12:let g=e.a,w=e.args,y=g.name,T;if(w.length==0)T="";else{let A=[],L=0;for(;L<w.length;){let z=w[L];++L,A.push(Ze.typeStr(z))}T="<"+A.join(",")+">"}return y+T;case 13:let E=e.args,C=e.ret,P=[],I=0;for(;I<E.length;){let A=E[I];++I,P.push((A.opt?"?":"")+(A.name==""?"":A.name+":")+Ze.typeStr(A.t))}return"("+P.join(", ")+") -> "+Ze.typeStr(C);case 14:let v=e.fields,F=[],B=0;for(;B<v.length;){let A=v[B];++B,F.push((A.opt?"?":"")+A.name+":"+Ze.typeStr(A.t))}return"{"+F.join(", ")+"}";default:return p.substr(Qe[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 l=e.t;t(l);break;case 9:let n=e.c,s=e.args,r=0;for(;r<s.length;){let I=s[r];++r,t(I)}break;case 10:let h=e.e,a=e.args,o=0;for(;o<a.length;){let I=a[o];++o,t(I)}break;case 11:let u=e.t,c=e.args,_=0;for(;_<c.length;){let I=c[_];++_,t(I)}break;case 12:let f=e.a,m=e.args,g=0;for(;g<m.length;){let I=m[g];++g,t(I)}break;case 13:let w=e.args,y=e.ret,T=0;for(;T<w.length;){let I=w[T];++T,t(I.t)}t(y);break;case 14:let E=e.fields,C=0;for(;C<E.length;){let I=E[C];++C,t(I.t)}break;case 15:let P=e.f;t(P());break;default:}}}j["hscript.Checker"]=Ze,Ze.__name__="hscript.Checker",Object.assign(Ze.prototype,{__class__:Ze});var fi=Qe["hscript.Const"]={__ename__:"hscript.Const",__constructs__:null,CInt:(d=function(k){return{_hx_index:0,v:k,__enum__:"hscript.Const",toString:S}},d._hx_name="CInt",d.__params__=["v"],d),CFloat:(d=function(k){return{_hx_index:1,f:k,__enum__:"hscript.Const",toString:S}},d._hx_name="CFloat",d.__params__=["f"],d),CString:(d=function(k){return{_hx_index:2,s:k,__enum__:"hscript.Const",toString:S}},d._hx_name="CString",d.__params__=["s"],d)};fi.__constructs__=[fi.CInt,fi.CFloat,fi.CString];var V=Qe["hscript.ExprDef"]={__ename__:"hscript.ExprDef",__constructs__:null,EConst:(d=function(k){return{_hx_index:0,c:k,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="EConst",d.__params__=["c"],d),EIdent:(d=function(k){return{_hx_index:1,v:k,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="EIdent",d.__params__=["v"],d),EVar:(d=function(k,e,t){return{_hx_index:2,n:k,t:e,e:t,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="EVar",d.__params__=["n","t","e"],d),EParent:(d=function(k){return{_hx_index:3,e:k,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="EParent",d.__params__=["e"],d),EBlock:(d=function(k){return{_hx_index:4,e:k,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="EBlock",d.__params__=["e"],d),EField:(d=function(k,e){return{_hx_index:5,e:k,f:e,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="EField",d.__params__=["e","f"],d),EBinop:(d=function(k,e,t){return{_hx_index:6,op:k,e1:e,e2:t,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="EBinop",d.__params__=["op","e1","e2"],d),EUnop:(d=function(k,e,t){return{_hx_index:7,op:k,prefix:e,e:t,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="EUnop",d.__params__=["op","prefix","e"],d),ECall:(d=function(k,e){return{_hx_index:8,e:k,params:e,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="ECall",d.__params__=["e","params"],d),EIf:(d=function(k,e,t){return{_hx_index:9,cond:k,e1:e,e2:t,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="EIf",d.__params__=["cond","e1","e2"],d),EWhile:(d=function(k,e){return{_hx_index:10,cond:k,e,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="EWhile",d.__params__=["cond","e"],d),EFor:(d=function(k,e,t){return{_hx_index:11,v:k,it:e,e:t,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="EFor",d.__params__=["v","it","e"],d),EBreak:{_hx_name:"EBreak",_hx_index:12,__enum__:"hscript.ExprDef",toString:S},EContinue:{_hx_name:"EContinue",_hx_index:13,__enum__:"hscript.ExprDef",toString:S},EFunction:(d=function(k,e,t,i){return{_hx_index:14,args:k,e,name:t,ret:i,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="EFunction",d.__params__=["args","e","name","ret"],d),EReturn:(d=function(k){return{_hx_index:15,e:k,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="EReturn",d.__params__=["e"],d),EArray:(d=function(k,e){return{_hx_index:16,e:k,index:e,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="EArray",d.__params__=["e","index"],d),EArrayDecl:(d=function(k){return{_hx_index:17,e:k,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="EArrayDecl",d.__params__=["e"],d),ENew:(d=function(k,e){return{_hx_index:18,cl:k,params:e,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="ENew",d.__params__=["cl","params"],d),EThrow:(d=function(k){return{_hx_index:19,e:k,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="EThrow",d.__params__=["e"],d),ETry:(d=function(k,e,t,i){return{_hx_index:20,e:k,v:e,t,ecatch:i,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="ETry",d.__params__=["e","v","t","ecatch"],d),EObject:(d=function(k){return{_hx_index:21,fl:k,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="EObject",d.__params__=["fl"],d),ETernary:(d=function(k,e,t){return{_hx_index:22,cond:k,e1:e,e2:t,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="ETernary",d.__params__=["cond","e1","e2"],d),ESwitch:(d=function(k,e,t){return{_hx_index:23,e:k,cases:e,defaultExpr:t,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="ESwitch",d.__params__=["e","cases","defaultExpr"],d),EDoWhile:(d=function(k,e){return{_hx_index:24,cond:k,e,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="EDoWhile",d.__params__=["cond","e"],d),EMeta:(d=function(k,e,t){return{_hx_index:25,name:k,args:e,e:t,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="EMeta",d.__params__=["name","args","e"],d),ECheckType:(d=function(k,e){return{_hx_index:26,e:k,t:e,__enum__:"hscript.ExprDef",toString:S}},d._hx_name="ECheckType",d.__params__=["e","t"],d)};V.__constructs__=[V.EConst,V.EIdent,V.EVar,V.EParent,V.EBlock,V.EField,V.EBinop,V.EUnop,V.ECall,V.EIf,V.EWhile,V.EFor,V.EBreak,V.EContinue,V.EFunction,V.EReturn,V.EArray,V.EArrayDecl,V.ENew,V.EThrow,V.ETry,V.EObject,V.ETernary,V.ESwitch,V.EDoWhile,V.EMeta,V.ECheckType];var $t=Qe["hscript.CType"]={__ename__:"hscript.CType",__constructs__:null,CTPath:(d=function(k,e){return{_hx_index:0,path:k,params:e,__enum__:"hscript.CType",toString:S}},d._hx_name="CTPath",d.__params__=["path","params"],d),CTFun:(d=function(k,e){return{_hx_index:1,args:k,ret:e,__enum__:"hscript.CType",toString:S}},d._hx_name="CTFun",d.__params__=["args","ret"],d),CTAnon:(d=function(k){return{_hx_index:2,fields:k,__enum__:"hscript.CType",toString:S}},d._hx_name="CTAnon",d.__params__=["fields"],d),CTParent:(d=function(k){return{_hx_index:3,t:k,__enum__:"hscript.CType",toString:S}},d._hx_name="CTParent",d.__params__=["t"],d),CTOpt:(d=function(k){return{_hx_index:4,t:k,__enum__:"hscript.CType",toString:S}},d._hx_name="CTOpt",d.__params__=["t"],d),CTNamed:(d=function(k,e){return{_hx_index:5,n:k,t:e,__enum__:"hscript.CType",toString:S}},d._hx_name="CTNamed",d.__params__=["n","t"],d)};$t.__constructs__=[$t.CTPath,$t.CTFun,$t.CTAnon,$t.CTParent,$t.CTOpt,$t.CTNamed];class Ce{constructor(e,t,i,l,n){this.e=e,this.pmin=t,this.pmax=i,this.origin=l,this.line=n}toString(){return ol.errorToString(this)}}j["hscript.Error"]=Ce,Ce.__name__="hscript.Error",Object.assign(Ce.prototype,{__class__:Ce});var be=Qe["hscript.ErrorDef"]={__ename__:"hscript.ErrorDef",__constructs__:null,EInvalidChar:(d=function(k){return{_hx_index:0,c:k,__enum__:"hscript.ErrorDef",toString:S}},d._hx_name="EInvalidChar",d.__params__=["c"],d),EUnexpected:(d=function(k){return{_hx_index:1,s:k,__enum__:"hscript.ErrorDef",toString:S}},d._hx_name="EUnexpected",d.__params__=["s"],d),EUnterminatedString:{_hx_name:"EUnterminatedString",_hx_index:2,__enum__:"hscript.ErrorDef",toString:S},EUnterminatedComment:{_hx_name:"EUnterminatedComment",_hx_index:3,__enum__:"hscript.ErrorDef",toString:S},EInvalidPreprocessor:(d=function(k){return{_hx_index:4,msg:k,__enum__:"hscript.ErrorDef",toString:S}},d._hx_name="EInvalidPreprocessor",d.__params__=["msg"],d),EUnknownVariable:(d=function(k){return{_hx_index:5,v:k,__enum__:"hscript.ErrorDef",toString:S}},d._hx_name="EUnknownVariable",d.__params__=["v"],d),EInvalidIterator:(d=function(k){return{_hx_index:6,v:k,__enum__:"hscript.ErrorDef",toString:S}},d._hx_name="EInvalidIterator",d.__params__=["v"],d),EInvalidOp:(d=function(k){return{_hx_index:7,op:k,__enum__:"hscript.ErrorDef",toString:S}},d._hx_name="EInvalidOp",d.__params__=["op"],d),EInvalidAccess:(d=function(k){return{_hx_index:8,f:k,__enum__:"hscript.ErrorDef",toString:S}},d._hx_name="EInvalidAccess",d.__params__=["f"],d),ECustom:(d=function(k){return{_hx_index:9,msg:k,__enum__:"hscript.ErrorDef",toString:S}},d._hx_name="ECustom",d.__params__=["msg"],d)};be.__constructs__=[be.EInvalidChar,be.EUnexpected,be.EUnterminatedString,be.EUnterminatedComment,be.EInvalidPreprocessor,be.EUnknownVariable,be.EInvalidIterator,be.EInvalidOp,be.EInvalidAccess,be.ECustom];var ji=Qe["hscript.ModuleDecl"]={__ename__:"hscript.ModuleDecl",__constructs__:null,DPackage:(d=function(k){return{_hx_index:0,path:k,__enum__:"hscript.ModuleDecl",toString:S}},d._hx_name="DPackage",d.__params__=["path"],d),DImport:(d=function(k,e){return{_hx_index:1,path:k,everything:e,__enum__:"hscript.ModuleDecl",toString:S}},d._hx_name="DImport",d.__params__=["path","everything"],d),DClass:(d=function(k){return{_hx_index:2,c:k,__enum__:"hscript.ModuleDecl",toString:S}},d._hx_name="DClass",d.__params__=["c"],d),DTypedef:(d=function(k){return{_hx_index:3,c:k,__enum__:"hscript.ModuleDecl",toString:S}},d._hx_name="DTypedef",d.__params__=["c"],d)};ji.__constructs__=[ji.DPackage,ji.DImport,ji.DClass,ji.DTypedef];var Ei=Qe["hscript.FieldAccess"]={__ename__:"hscript.FieldAccess",__constructs__:null,APublic:{_hx_name:"APublic",_hx_index:0,__enum__:"hscript.FieldAccess",toString:S},APrivate:{_hx_name:"APrivate",_hx_index:1,__enum__:"hscript.FieldAccess",toString:S},AInline:{_hx_name:"AInline",_hx_index:2,__enum__:"hscript.FieldAccess",toString:S},AOverride:{_hx_name:"AOverride",_hx_index:3,__enum__:"hscript.FieldAccess",toString:S},AStatic:{_hx_name:"AStatic",_hx_index:4,__enum__:"hscript.FieldAccess",toString:S},AMacro:{_hx_name:"AMacro",_hx_index:5,__enum__:"hscript.FieldAccess",toString:S}};Ei.__constructs__=[Ei.APublic,Ei.APrivate,Ei.AInline,Ei.AOverride,Ei.AStatic,Ei.AMacro];var Fl=Qe["hscript.FieldKind"]={__ename__:"hscript.FieldKind",__constructs__:null,KFunction:(d=function(k){return{_hx_index:0,f:k,__enum__:"hscript.FieldKind",toString:S}},d._hx_name="KFunction",d.__params__=["f"],d),KVar:(d=function(k){return{_hx_index:1,v:k,__enum__:"hscript.FieldKind",toString:S}},d._hx_name="KVar",d.__params__=["v"],d)};Fl.__constructs__=[Fl.KFunction,Fl.KVar];var J=Qe["hscript.Token"]={__ename__:"hscript.Token",__constructs__:null,TEof:{_hx_name:"TEof",_hx_index:0,__enum__:"hscript.Token",toString:S},TConst:(d=function(k){return{_hx_index:1,c:k,__enum__:"hscript.Token",toString:S}},d._hx_name="TConst",d.__params__=["c"],d),TId:(d=function(k){return{_hx_index:2,s:k,__enum__:"hscript.Token",toString:S}},d._hx_name="TId",d.__params__=["s"],d),TOp:(d=function(k){return{_hx_index:3,s:k,__enum__:"hscript.Token",toString:S}},d._hx_name="TOp",d.__params__=["s"],d),TPOpen:{_hx_name:"TPOpen",_hx_index:4,__enum__:"hscript.Token",toString:S},TPClose:{_hx_name:"TPClose",_hx_index:5,__enum__:"hscript.Token",toString:S},TBrOpen:{_hx_name:"TBrOpen",_hx_index:6,__enum__:"hscript.Token",toString:S},TBrClose:{_hx_name:"TBrClose",_hx_index:7,__enum__:"hscript.Token",toString:S},TDot:{_hx_name:"TDot",_hx_index:8,__enum__:"hscript.Token",toString:S},TQuestionDot:{_hx_name:"TQuestionDot",_hx_index:9,__enum__:"hscript.Token",toString:S},TComma:{_hx_name:"TComma",_hx_index:10,__enum__:"hscript.Token",toString:S},TSemicolon:{_hx_name:"TSemicolon",_hx_index:11,__enum__:"hscript.Token",toString:S},TBkOpen:{_hx_name:"TBkOpen",_hx_index:12,__enum__:"hscript.Token",toString:S},TBkClose:{_hx_name:"TBkClose",_hx_index:13,__enum__:"hscript.Token",toString:S},TQuestion:{_hx_name:"TQuestion",_hx_index:14,__enum__:"hscript.Token",toString:S},TDoubleDot:{_hx_name:"TDoubleDot",_hx_index:15,__enum__:"hscript.Token",toString:S},TMeta:(d=function(k){return{_hx_index:16,s:k,__enum__:"hscript.Token",toString:S}},d._hx_name="TMeta",d.__params__=["s"],d),TPrepro:(d=function(k){return{_hx_index:17,s:k,__enum__:"hscript.Token",toString:S}},d._hx_name="TPrepro",d.__params__=["s"],d)};J.__constructs__=[J.TEof,J.TConst,J.TId,J.TOp,J.TPOpen,J.TPClose,J.TBrOpen,J.TBrClose,J.TDot,J.TQuestionDot,J.TComma,J.TSemicolon,J.TBkOpen,J.TBkClose,J.TQuestion,J.TDoubleDot,J.TMeta,J.TPrepro];class tl{constructor(){this.uid=0,this.preprocesorValues=new Ee,this.line=1,this.opChars="+*/-=!><&|^%~",this.identChars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_";let e=[["%"],["*","/"],["+","-"],["<<",">>",">>>"],["|","&","^"],["==","!=",">","<",">=","<="],["..."],["&&"],["||"],["=","+=","-=","*=","/=","%=","<<=",">>=",">>>=","|=","&=","^=","=>"],["->"]];this.opPriority=new Ee,this.opRightAssoc=new Ee;let t=0,i=e.length;for(;t<i;){let h=t++,a=0,o=e[h];for(;a<o.length;){let u=o[a];++a,this.opPriority.h[u]=h,h==9&&(this.opRightAssoc.h[u]=!0)}}let l="!";this.opPriority.h[l]=l=="++"||l=="--"?-1:-2;let n="++";this.opPriority.h[n]=n=="++"||n=="--"?-1:-2;let s="--";this.opPriority.h[s]=s=="++"||s=="--"?-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 b.thrown(new Ce(e,t,i,this.origin,this.line))}invalidChar(e){if(!this.resumeErrors)throw b.thrown(new Ce(be.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 Pl,this.offset=t,this.char=-1,this.ops=[],this.idents=[],this.uid=0;let i=0,l=this.opChars.length;for(;i<l;){let r=i++;this.ops[p.cca(this.opChars,r)]=!0}let n=0,s=this.identChars.length;for(;n<s;){let r=n++;this.idents[p.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 l=[];for(;;){let n=this.token();if(n==J.TEof)break;this.tokens.push({t:n,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,this.parseFullExpr(l)}if(l.length==1)return l[0];{let n=V.EBlock(l),s=0,r=null;return n==null?null:(s==null&&(s=this.tokenMin),r==null&&(r=this.tokenMax),{e:n,pmin:s,pmax:r,origin:this.origin,line:this.line})}}unexpected(e){let t=be.EUnexpected(this.tokenString(e));if(!this.resumeErrors)throw b.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();pe.enumEq(t,e)||this.unexpected(t)}maybe(e){let t=this.token();return pe.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,l=t.t,n=t.e;if(n!=null)return this.isBlock(n);if(l!=null){if(l==null)return!1;if(l._hx_index==2){let se=l.fields;return!0}else return!1}else return!1;break;case 4:let s=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,u=t.prefix,c=t.e;return u?!1:this.isBlock(c);case 9:let _=t.cond,f=t.e1,m=t.e2;return m!=null?this.isBlock(m):this.isBlock(f);case 10:let g=t.cond,w=t.e;return this.isBlock(w);case 11:let y=t.v,T=t.it,E=t.e;return this.isBlock(E);case 14:let C=t.args,P=t.name,I=t.ret,v=t.e;return this.isBlock(v);case 15:let F=t.e;return F!=null?this.isBlock(F):!1;case 20:let B=t.e,A=t.v,L=t.t,z=t.ecatch;return this.isBlock(z);case 21:let D=t.fl;return!0;case 23:let O=t.e,q=t.cases,M=t.defaultExpr;return!0;case 24:let U=t.cond,K=t.e;return this.isBlock(K);case 25:let G=t.name,Y=t.args,$=t.e;return this.isBlock($);default:return!1}}parseFullExpr(e){let t=this.parseExpr();e.push(t);let i=this.token();for(;;){let l;if(i==J.TComma&&t!=null){let n=t.e;if(n._hx_index==2){let s=n.n,r=n.t,h=n.e;l=!0}else l=!1}else l=!1;if(!l)break;t=this.parseStructure("var"),e.push(t),i=this.token()}i!=J.TSemicolon&&i!=J.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!=J.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=V.EObject(t),l=e,n=null,s;return i==null?s=null:(l==null&&(l=this.tokenMin),n==null&&(n=this.tokenMax),s={e:i,pmin:l,pmax:n,origin:this.origin,line:this.line}),this.parseExprNext(s)}parseExpr(){let e=this.token(),t=this.tokenMin;switch(e._hx_index){case 1:let i=e.c,l=V.EConst(i),n=null,s=null,r;return l==null?r=null:(n==null&&(n=this.tokenMin),s==null&&(s=this.tokenMax),r={e:l,pmin:n,pmax:s,origin:this.origin,line:this.line}),this.parseExprNext(r);case 2:let h=e.s,a=this.parseStructure(h);if(a==null){let I=V.EIdent(h),v=null,F=null;I==null?a=null:(v==null&&(v=this.tokenMin),F==null&&(F=this.tokenMax),a={e:I,pmin:v,pmax:F,origin:this.origin,line:this.line})}return this.parseExprNext(a);case 3:let o=e.s;if(o=="-"){let I=this.tokenMin,v=this.parseExpr();if(v==null)return this.makeUnop(o,v);let F=v.e;if(F._hx_index==0){let B=F.c;switch(B._hx_index){case 0:let A=B.v,L=V.EConst(fi.CInt(-A)),z=I,D=v==null?0:v.pmax;return L==null?null:(z==null&&(z=this.tokenMin),D==null&&(D=this.tokenMax),{e:L,pmin:z,pmax:D,origin:this.origin,line:this.line});case 1:let O=B.f,q=V.EConst(fi.CFloat(-O)),M=I,U=v==null?0:v.pmax;return q==null?null:(M==null&&(M=this.tokenMin),U==null&&(U=this.tokenMax),{e:q,pmin:M,pmax:U,origin:this.origin,line:this.line});default:return this.makeUnop(o,v)}}else return this.makeUnop(o,v)}return this.opPriority.h[o]<0?this.makeUnop(o,this.parseExpr()):this.unexpected(e);case 4:if(e=this.token(),e==J.TPClose){let I=this.token();pe.enumEq(I,J.TOp("->"))||this.unexpected(I);let v=this.parseExpr(),F=V.EReturn(v),B=t,A=null,L;F==null?L=null:(B==null&&(B=this.tokenMin),A==null&&(A=this.tokenMax),L={e:F,pmin:B,pmax:A,origin:this.origin,line:this.line});let z=V.EFunction([],L),D=t,O=null;return z==null?null:(D==null&&(D=this.tokenMin),O==null&&(O=this.tokenMax),{e:z,pmin:D,pmax:O,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 u=this.parseExpr();switch(e=this.token(),e._hx_index){case 5:let I=V.EParent(u),v=t,F=this.tokenMax,B;return I==null?B=null:(v==null&&(v=this.tokenMin),F==null&&(F=this.tokenMax),B={e:I,pmin:v,pmax:F,origin:this.origin,line:this.line}),this.parseExprNext(B);case 10:let A=u.e;if(A._hx_index==1){let z=A.v;return this.parseLambda([{name:z}],u==null?0:u.pmin)}break;case 15:let L=this.parseType();switch(e=this.token(),e._hx_index){case 5:let z=V.ECheckType(u,L),D=t,O=this.tokenMax,q;return z==null?q=null:(D==null&&(D=this.tokenMin),O==null&&(O=this.tokenMax),q={e:z,pmin:D,pmax:O,origin:this.origin,line:this.line}),this.parseExprNext(q);case 10:let M=u.e;if(M._hx_index==1){let U=M.v;return this.parseLambda([{name:U,t:L}],u==null?0:u.pmin)}break;default:}break;default:}return this.unexpected(e);case 6:switch(e=this.token(),e._hx_index){case 1:let I=e.c;if(this.allowJSON)if(I._hx_index==2){let D=I.s,O=this.token();if(this.tokens.push({t:O,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,O._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 v=e.s,F=this.token();if(this.tokens.push({t:F,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,F._hx_index==15)return this.parseExprNext(this.parseObject(t));break;case 7:let B=V.EObject([]),A=t,L=null,z;return B==null?z=null:(A==null&&(A=this.tokenMin),L==null&&(L=this.tokenMax),z={e:B,pmin:A,pmax:L,origin:this.origin,line:this.line}),this.parseExprNext(z);default:this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax}let c=[];for(;this.parseFullExpr(c),e=this.token(),!(e==J.TBrClose||this.resumeErrors&&e==J.TEof);)this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;let _=V.EBlock(c),f=t,m=null;return _==null?null:(f==null&&(f=this.tokenMin),m==null&&(m=this.tokenMax),{e:_,pmin:f,pmax:m,origin:this.origin,line:this.line});case 12:let g=[];e=this.token();let w=!0;for(;e!=J.TBkClose&&(!this.resumeErrors||e!=J.TEof);)w||(e!=J.TComma?this.unexpected(e):e=this.token()),w=!1,this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,g.push(this.parseExpr()),e=this.token();if(g.length==1&&g[0]!=null){let I=g[0].e;switch(I._hx_index){case 10:let v=I.cond,F=I.e,B="__a_"+this.uid++,A=V.EArrayDecl([]),L=t,z=null,D;A==null?D=null:(L==null&&(L=this.tokenMin),z==null&&(z=this.tokenMax),D={e:A,pmin:L,pmax:z,origin:this.origin,line:this.line});let O=V.EVar(B,null,D),q=t,M=null,U;O==null?U=null:(q==null&&(q=this.tokenMin),M==null&&(M=this.tokenMax),U={e:O,pmin:q,pmax:M,origin:this.origin,line:this.line});let K=this.mapCompr(B,g[0]),G=V.EIdent(B),Y=t,$=null,se;G==null?se=null:(Y==null&&(Y=this.tokenMin),$==null&&($=this.tokenMax),se={e:G,pmin:Y,pmax:$,origin:this.origin,line:this.line});let ue=V.EBlock([U,K,se]),oe=t,ge=null,me;return ue==null?me=null:(oe==null&&(oe=this.tokenMin),ge==null&&(ge=this.tokenMax),me={e:ue,pmin:oe,pmax:ge,origin:this.origin,line:this.line}),this.parseExprNext(me);case 11:let de=I.v,Oe=I.it,Ve=I.e,je="__a_"+this.uid++,et=V.EArrayDecl([]),Ue=t,Ge=null,nt;et==null?nt=null:(Ue==null&&(Ue=this.tokenMin),Ge==null&&(Ge=this.tokenMax),nt={e:et,pmin:Ue,pmax:Ge,origin:this.origin,line:this.line});let De=V.EVar(je,null,nt),H=t,ie=null,R;De==null?R=null:(H==null&&(H=this.tokenMin),ie==null&&(ie=this.tokenMax),R={e:De,pmin:H,pmax:ie,origin:this.origin,line:this.line});let ee=this.mapCompr(je,g[0]),X=V.EIdent(je),Q=t,ae=null,_e;X==null?_e=null:(Q==null&&(Q=this.tokenMin),ae==null&&(ae=this.tokenMax),_e={e:X,pmin:Q,pmax:ae,origin:this.origin,line:this.line});let xe=V.EBlock([R,ee,_e]),Ye=t,gt=null,Be;return xe==null?Be=null:(Ye==null&&(Ye=this.tokenMin),gt==null&&(gt=this.tokenMax),Be={e:xe,pmin:Ye,pmax:gt,origin:this.origin,line:this.line}),this.parseExprNext(Be);case 24:let _t=I.cond,ve=I.e,Pe="__a_"+this.uid++,ot=V.EArrayDecl([]),tt=t,bt=null,Kt;ot==null?Kt=null:(tt==null&&(tt=this.tokenMin),bt==null&&(bt=this.tokenMax),Kt={e:ot,pmin:tt,pmax:bt,origin:this.origin,line:this.line});let ft=V.EVar(Pe,null,Kt),li=t,$e=null,Bt;ft==null?Bt=null:(li==null&&(li=this.tokenMin),$e==null&&($e=this.tokenMax),Bt={e:ft,pmin:li,pmax:$e,origin:this.origin,line:this.line});let It=this.mapCompr(Pe,g[0]),Lt=V.EIdent(Pe),mt=t,Vt=null,Ht;Lt==null?Ht=null:(mt==null&&(mt=this.tokenMin),Vt==null&&(Vt=this.tokenMax),Ht={e:Lt,pmin:mt,pmax:Vt,origin:this.origin,line:this.line});let Ut=V.EBlock([Bt,It,Ht]),ni=t,si=null,jt;return Ut==null?jt=null:(ni==null&&(ni=this.tokenMin),si==null&&(si=this.tokenMax),jt={e:Ut,pmin:ni,pmax:si,origin:this.origin,line:this.line}),this.parseExprNext(jt);default:}}let y=V.EArrayDecl(g),T=t,E=null,C;return y==null?C=null:(T==null&&(T=this.tokenMin),E==null&&(E=this.tokenMax),C={e:y,pmin:T,pmax:E,origin:this.origin,line:this.line}),this.parseExprNext(C);case 16:let P=e.s;if(this.allowMetadata){let I=this.parseMetaArgs(),v=V.EMeta(P,I,this.parseExpr()),F=t,B=null;return v==null?null:(F==null&&(F=this.tokenMin),B==null&&(B=this.tokenMax),{e:v,pmin:F,pmax:B,origin:this.origin,line:this.line})}else return this.unexpected(e);break;default:return this.unexpected(e)}}parseLambda(e,t){e:for(;;){let c=this.getIdent(),_=this.maybe(J.TDoubleDot)?this.parseType():null;e.push({name:c,t:_});let f=this.token();switch(f._hx_index){case 5:break e;case 10:break;default:this.unexpected(f);break e}}let i=this.token();pe.enumEq(i,J.TOp("->"))||this.unexpected(i);let l=this.parseExpr(),n=V.EReturn(l),s=t,r=null,h;n==null?h=null:(s==null&&(s=this.tokenMin),r==null&&(r=this.tokenMax),h={e:n,pmin:s,pmax:r,origin:this.origin,line:this.line});let a=V.EFunction(e,h),o=t,u=null;return a==null?null:(o==null&&(o=this.tokenMin),u==null&&(u=this.tokenMax),{e:a,pmin:o,pmax:u,origin:this.origin,line:this.line})}parseMetaArgs(){let e=this.token();if(e!=J.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!=J.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 l=i;this.unexpected(l)}}}return t}mapCompr(e,t){if(t==null)return null;let i,l=t.e;switch(l._hx_index){case 3:let r=l.e;i=V.EParent(this.mapCompr(e,r));break;case 4:let h=l.e;if(h.length==1){let A=h[0];i=V.EBlock([this.mapCompr(e,A)])}else{let A=V.EIdent(e),L=t==null?0:t.pmin,z=t==null?0:t.pmax,D;A==null?D=null:(L==null&&(L=this.tokenMin),z==null&&(z=this.tokenMax),D={e:A,pmin:L,pmax:z,origin:this.origin,line:this.line});let O=V.EField(D,"push"),q=t==null?0:t.pmin,M=t==null?0:t.pmax,U;O==null?U=null:(q==null&&(q=this.tokenMin),M==null&&(M=this.tokenMax),U={e:O,pmin:q,pmax:M,origin:this.origin,line:this.line}),i=V.ECall(U,[t])}break;case 9:let a=l.cond,o=l.e1;if(l.e2==null)i=V.EIf(a,this.mapCompr(e,o),null);else{let A=V.EIdent(e),L=t==null?0:t.pmin,z=t==null?0:t.pmax,D;A==null?D=null:(L==null&&(L=this.tokenMin),z==null&&(z=this.tokenMax),D={e:A,pmin:L,pmax:z,origin:this.origin,line:this.line});let O=V.EField(D,"push"),q=t==null?0:t.pmin,M=t==null?0:t.pmax,U;O==null?U=null:(q==null&&(q=this.tokenMin),M==null&&(M=this.tokenMax),U={e:O,pmin:q,pmax:M,origin:this.origin,line:this.line}),i=V.ECall(U,[t])}break;case 10:let c=l.cond,_=l.e;i=V.EWhile(c,this.mapCompr(e,_));break;case 11:let f=l.v,m=l.it,g=l.e;i=V.EFor(f,m,this.mapCompr(e,g));break;case 24:let w=l.cond,y=l.e;i=V.EDoWhile(w,this.mapCompr(e,y));break;default:let T=V.EIdent(e),E=t==null?0:t.pmin,C=t==null?0:t.pmax,P;T==null?P=null:(E==null&&(E=this.tokenMin),C==null&&(C=this.tokenMax),P={e:T,pmin:E,pmax:C,origin:this.origin,line:this.line});let I=V.EField(P,"push"),v=t==null?0:t.pmin,F=t==null?0:t.pmax,B;I==null?B=null:(v==null&&(v=this.tokenMin),F==null&&(F=this.tokenMax),B={e:I,pmin:v,pmax:F,origin:this.origin,line:this.line}),i=V.ECall(B,[t])}let n=t==null?0:t.pmin,s=t==null?0:t.pmax;return i==null?null:(n==null&&(n=this.tokenMin),s==null&&(s=this.tokenMax),{e:i,pmin:n,pmax:s,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 l=i.op,n=i.e1,s=i.e2,r=V.EBinop(l,this.makeUnop(e,n),s),h=n==null?0:n.pmin,a=s==null?0:s.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,u=i.e1,c=i.e2,_=V.ETernary(this.makeUnop(e,o),u,c),f=o==null?0:o.pmin,m=c==null?0:c.pmax;return _==null?null:(f==null&&(f=this.tokenMin),m==null&&(m=this.tokenMax),{e:_,pmin:f,pmax:m,origin:this.origin,line:this.line});default:let g=V.EUnop(e,!0,t),w=t==null?0:t.pmin,y=t==null?0:t.pmax;return g==null?null:(w==null&&(w=this.tokenMin),y==null&&(y=this.tokenMax),{e:g,pmin:w,pmax:y,origin:this.origin,line:this.line})}}makeBinop(e,t,i){if(i==null&&this.resumeErrors){let n=V.EBinop(e,t,i),s=t==null?0:t.pmin,r=t==null?0:t.pmax;return n==null?null:(s==null&&(s=this.tokenMin),r==null&&(r=this.tokenMax),{e:n,pmin:s,pmax:r,origin:this.origin,line:this.line})}let l=i.e;switch(l._hx_index){case 6:let n=l.op,s=l.e1,r=l.e2;if(this.opPriority.h[e]<=this.opPriority.h[n]&&!Object.prototype.hasOwnProperty.call(this.opRightAssoc.h,e)){let f=V.EBinop(n,this.makeBinop(e,t,s),r),m=t==null?0:t.pmin,g=r==null?0:r.pmax;return f==null?null:(m==null&&(m=this.tokenMin),g==null&&(g=this.tokenMax),{e:f,pmin:m,pmax:g,origin:this.origin,line:this.line})}else{let f=V.EBinop(e,t,i),m=t==null?0:t.pmin,g=i==null?0:i.pmax;return f==null?null:(m==null&&(m=this.tokenMin),g==null&&(g=this.tokenMax),{e:f,pmin:m,pmax:g,origin:this.origin,line:this.line})}break;case 22:let h=l.cond,a=l.e1,o=l.e2;if(Object.prototype.hasOwnProperty.call(this.opRightAssoc.h,e)){let f=V.EBinop(e,t,i),m=t==null?0:t.pmin,g=i==null?0:i.pmax;return f==null?null:(m==null&&(m=this.tokenMin),g==null&&(g=this.tokenMax),{e:f,pmin:m,pmax:g,origin:this.origin,line:this.line})}else{let f=V.ETernary(this.makeBinop(e,t,h),a,o),m=t==null?0:t.pmin,g=i==null?0:i.pmax;return f==null?null:(m==null&&(m=this.tokenMin),g==null&&(g=this.tokenMax),{e:f,pmin:m,pmax:g,origin:this.origin,line:this.line})}break;default:let u=V.EBinop(e,t,i),c=t==null?0:t.pmin,_=i==null?0:i.pmax;return u==null?null:(c==null&&(c=this.tokenMin),_==null&&(_=this.tokenMax),{e:u,pmin:c,pmax:_,origin:this.origin,line:this.line})}}parseStructure(e){let t=this.tokenMin;switch(e){case"break":let i=V.EBreak,l=null,n=null;return i==null?null:(l==null&&(l=this.tokenMin),n==null&&(n=this.tokenMax),{e:i,pmin:l,pmax:n,origin:this.origin,line:this.line});case"continue":let s=V.EContinue,r=null,h=null;return s==null?null:(r==null&&(r=this.tokenMin),h==null&&(h=this.tokenMax),{e:s,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 u=this.parseExpr(),c=V.EDoWhile(u,a),_=t,f=u==null?0:u.pmax;return c==null?null:(_==null&&(_=this.tokenMin),f==null&&(f=this.tokenMax),{e:c,pmin:_,pmax:f,origin:this.origin,line:this.line});case"else":return this.unexpected(J.TId(e));case"for":let m=this.token();m!=J.TPOpen&&this.unexpected(m);let g=this.getIdent(),w=this.token();pe.enumEq(w,J.TId("in"))||this.unexpected(w);let y=this.parseExpr(),T=this.token();T!=J.TPClose&&this.unexpected(T);let E=this.parseExpr(),C=V.EFor(g,y,E),P=t,I=E==null?0:E.pmax;return C==null?null:(P==null&&(P=this.tokenMin),I==null&&(I=this.tokenMax),{e:C,pmin:P,pmax:I,origin:this.origin,line:this.line});case"function":let v=this.token(),F=null;v._hx_index==2?F=v.s:(this.tokens.push({t:v,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax);let B=this.parseFunctionDecl(),A=V.EFunction(B.args,B.body,F,B.ret),L=t,z=B.body,D=z==null?0:z.pmax;return A==null?null:(L==null&&(L=this.tokenMin),D==null&&(D=this.tokenMax),{e:A,pmin:L,pmax:D,origin:this.origin,line:this.line});case"if":let O=this.token();O!=J.TPOpen&&this.unexpected(O);let q=this.parseExpr(),M=this.token();M!=J.TPClose&&this.unexpected(M);let U=this.parseExpr(),K=null,G=!1,Y=this.token();Y==J.TSemicolon&&(G=!0,Y=this.token()),pe.enumEq(Y,J.TId("else"))?K=this.parseExpr():(this.tokens.push({t:Y,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,G&&(this.tokens.push({t:J.TSemicolon,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax));let $=V.EIf(q,U,K),se=t,ue=K==null?this.tokenMax:K==null?0:K.pmax;return $==null?null:(se==null&&(se=this.tokenMin),ue==null&&(ue=this.tokenMax),{e:$,pmin:se,pmax:ue,origin:this.origin,line:this.line});case"inline":return this.maybe(J.TId("function"))||this.unexpected(J.TId("inline")),this.parseStructure("function");case"new":let oe=[];oe.push(this.getIdent());e:for(;;){let it=this.token();switch(it._hx_index){case 4:break e;case 8:oe.push(this.getIdent());break;default:this.unexpected(it);break e}}let ge=this.parseExprList(J.TPClose),me=V.ENew(oe.join("."),ge),de=t,Oe=null;return me==null?null:(de==null&&(de=this.tokenMin),Oe==null&&(Oe=this.tokenMax),{e:me,pmin:de,pmax:Oe,origin:this.origin,line:this.line});case"return":let Ve=this.token();this.tokens.push({t:Ve,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;let je=Ve==J.TSemicolon?null:this.parseExpr(),et=V.EReturn(je),Ue=t,Ge=je==null?this.tokenMax:je==null?0:je.pmax;return et==null?null:(Ue==null&&(Ue=this.tokenMin),Ge==null&&(Ge=this.tokenMax),{e:et,pmin:Ue,pmax:Ge,origin:this.origin,line:this.line});case"switch":let nt=this.parseExpr(),De=null,H=[],ie=this.token();ie!=J.TBrOpen&&this.unexpected(ie);e:for(;;){let it=this.token();switch(it._hx_index){case 2:switch(it.s){case"case":let ki={values:[],expr:null};H.push(ki);t:for(;;){let dt=this.parseExpr();switch(ki.values.push(dt),it=this.token(),it._hx_index){case 10:break;case 15:break t;default:this.unexpected(it);break t}}let ye=[];t:for(;;)switch(it=this.token(),this.tokens.push({t:it,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,it._hx_index){case 0:if(this.resumeErrors)break t;this.parseFullExpr(ye);break;case 2:switch(it.s){case"case":case"default":break t;default:this.parseFullExpr(ye)}break;case 7:break t;default:this.parseFullExpr(ye)}let lt;if(ye.length==1)lt=ye[0];else if(ye.length==0){let dt=V.EBlock([]),xt=this.tokenMin,St=this.tokenMin;dt==null?lt=null:(xt==null&&(xt=this.tokenMin),St==null&&(St=this.tokenMax),lt={e:dt,pmin:xt,pmax:St,origin:this.origin,line:this.line})}else{let dt=V.EBlock(ye),xt=ye[0],St=xt==null?0:xt.pmin,Jt=ye[ye.length-1],wt=Jt==null?0:Jt.pmax;dt==null?lt=null:(St==null&&(St=this.tokenMin),wt==null&&(wt=this.tokenMax),lt={e:dt,pmin:St,pmax:wt,origin:this.origin,line:this.line})}ki.expr=lt;break;case"default":De!=null&&this.unexpected(it);let ct=this.token();ct!=J.TDoubleDot&&this.unexpected(ct);let rt=[];t:for(;;)switch(it=this.token(),this.tokens.push({t:it,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,it._hx_index){case 0:if(this.resumeErrors)break t;this.parseFullExpr(rt);break;case 2:switch(it.s){case"case":case"default":break t;default:this.parseFullExpr(rt)}break;case 7:break t;default:this.parseFullExpr(rt)}if(rt.length==1)De=rt[0];else if(rt.length==0){let dt=V.EBlock([]),xt=this.tokenMin,St=this.tokenMin;dt==null?De=null:(xt==null&&(xt=this.tokenMin),St==null&&(St=this.tokenMax),De={e:dt,pmin:xt,pmax:St,origin:this.origin,line:this.line})}else{let dt=V.EBlock(rt),xt=rt[0],St=xt==null?0:xt.pmin,Jt=rt[rt.length-1],wt=Jt==null?0:Jt.pmax;dt==null?De=null:(St==null&&(St=this.tokenMin),wt==null&&(wt=this.tokenMax),De={e:dt,pmin:St,pmax:wt,origin:this.origin,line:this.line})}break;default:this.unexpected(it);break e}break;case 7:break e;default:this.unexpected(it);break e}}let R=V.ESwitch(nt,H,De),ee=t,X=this.tokenMax;return R==null?null:(ee==null&&(ee=this.tokenMin),X==null&&(X=this.tokenMax),{e:R,pmin:ee,pmax:X,origin:this.origin,line:this.line});case"throw":let Q=this.parseExpr(),ae=V.EThrow(Q),_e=t,xe=Q==null?0:Q.pmax;return ae==null?null:(_e==null&&(_e=this.tokenMin),xe==null&&(xe=this.tokenMax),{e:ae,pmin:_e,pmax:xe,origin:this.origin,line:this.line});case"try":let Ye=this.parseExpr(),gt=this.token();pe.enumEq(gt,J.TId("catch"))||this.unexpected(gt);let Be=this.token();Be!=J.TPOpen&&this.unexpected(Be);let _t=this.getIdent(),ve=this.token();ve!=J.TDoubleDot&&this.unexpected(ve);let Pe=null;if(this.allowTypes)Pe=this.parseType();else{let it=this.token();pe.enumEq(it,J.TId("Dynamic"))||this.unexpected(it)}let ot=this.token();ot!=J.TPClose&&this.unexpected(ot);let tt=this.parseExpr(),bt=V.ETry(Ye,_t,Pe,tt),Kt=t,ft=tt==null?0:tt.pmax;return bt==null?null:(Kt==null&&(Kt=this.tokenMin),ft==null&&(ft=this.tokenMax),{e:bt,pmin:Kt,pmax:ft,origin:this.origin,line:this.line});case"var":let li=this.getIdent(),$e=this.token(),Bt=null;$e==J.TDoubleDot&&this.allowTypes&&(Bt=this.parseType(),$e=this.token());let It=null;switch($e._hx_index){case 3:$e.s=="="?It=this.parseExpr():this.unexpected($e);break;case 10:case 11:this.tokens.push({t:$e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break;default:Bt!=null?(this.tokens.push({t:$e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax):this.unexpected($e)}let Lt=V.EVar(li,Bt,It),mt=t,Vt=It==null?this.tokenMax:It==null?0:It.pmax;return Lt==null?null:(mt==null&&(mt=this.tokenMin),Vt==null&&(Vt=this.tokenMax),{e:Lt,pmin:mt,pmax:Vt,origin:this.origin,line:this.line});case"while":let Ht=this.parseExpr(),Ut=this.parseExpr(),ni=V.EWhile(Ht,Ut),si=t,jt=Ut==null?0:Ut.pmax;return ni==null?null:(si==null&&(si=this.tokenMin),jt==null&&(jt=this.tokenMax),{e:ni,pmin:si,pmax:jt,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 l=t.s;if(l=="->"){let Be=e.e;switch(Be._hx_index){case 1:let _t=Be.v,ve=this.parseExpr(),Pe=V.EReturn(ve),ot=ve==null?0:ve.pmin,tt=null,bt;Pe==null?bt=null:(ot==null&&(ot=this.tokenMin),tt==null&&(tt=this.tokenMax),bt={e:Pe,pmin:ot,pmax:tt,origin:this.origin,line:this.line});let Kt=V.EFunction([{name:_t}],bt),ft=e==null?0:e.pmin,li=null;return Kt==null?null:(ft==null&&(ft=this.tokenMin),li==null&&(li=this.tokenMax),{e:Kt,pmin:ft,pmax:li,origin:this.origin,line:this.line});case 3:let $e=Be.e.e;if($e._hx_index==1){let It=$e.v,Lt=this.parseExpr(),mt=V.EReturn(Lt),Vt=Lt==null?0:Lt.pmin,Ht=null,Ut;mt==null?Ut=null:(Vt==null&&(Vt=this.tokenMin),Ht==null&&(Ht=this.tokenMax),Ut={e:mt,pmin:Vt,pmax:Ht,origin:this.origin,line:this.line});let ni=V.EFunction([{name:It}],Ut),si=e==null?0:e.pmin,jt=null;return ni==null?null:(si==null&&(si=this.tokenMin),jt==null&&(jt=this.tokenMax),{e:ni,pmin:si,pmax:jt,origin:this.origin,line:this.line})}break;case 26:let Bt=Be.e.e;if(Bt._hx_index==1){let It=Bt.v,Lt=Be.t,mt=this.parseExpr(),Vt=V.EReturn(mt),Ht=mt==null?0:mt.pmin,Ut=null,ni;Vt==null?ni=null:(Ht==null&&(Ht=this.tokenMin),Ut==null&&(Ut=this.tokenMax),ni={e:Vt,pmin:Ht,pmax:Ut,origin:this.origin,line:this.line});let si=V.EFunction([{name:It,t:Lt}],ni),jt=e==null?0:e.pmin,it=null;return si==null?null:(jt==null&&(jt=this.tokenMin),it==null&&(it=this.tokenMax),{e:si,pmin:jt,pmax:it,origin:this.origin,line:this.line})}break;default:}this.unexpected(t)}if(this.opPriority.h[l]==-1){let Be;if(this.isBlock(e))Be=!0;else{let tt=e.e;if(tt._hx_index==3){let bt=tt.e;Be=!0}else Be=!1}if(Be)return this.tokens.push({t,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,e;let _t=V.EUnop(l,!1,e),ve=e==null?0:e.pmin,Pe=null,ot;return _t==null?ot=null:(ve==null&&(ve=this.tokenMin),Pe==null&&(Pe=this.tokenMax),ot={e:_t,pmin:ve,pmax:Pe,origin:this.origin,line:this.line}),this.parseExprNext(ot)}return this.makeBinop(l,e,this.parseExpr());case 4:let n=V.ECall(e,this.parseExprList(J.TPClose)),s=e==null?0:e.pmin,r=null,h;return n==null?h=null:(s==null&&(s=this.tokenMin),r==null&&(r=this.tokenMax),h={e:n,pmin:s,pmax:r,origin:this.origin,line:this.line}),this.parseExprNext(h);case 8:let a=this.getIdent(),o=V.EField(e,a),u=e==null?0:e.pmin,c=null,_;return o==null?_=null:(u==null&&(u=this.tokenMin),c==null&&(c=this.tokenMax),_={e:o,pmin:u,pmax:c,origin:this.origin,line:this.line}),this.parseExprNext(_);case 9:let f=this.getIdent(),m="__a_"+this.uid++,g=V.EVar(m,null,e),w=e==null?0:e.pmin,y=e==null?0:e.pmax,T;g==null?T=null:(w==null&&(w=this.tokenMin),y==null&&(y=this.tokenMax),T={e:g,pmin:w,pmax:y,origin:this.origin,line:this.line});let E=V.EIdent(m),C=e==null?0:e.pmin,P=e==null?0:e.pmax,I;E==null?I=null:(C==null&&(C=this.tokenMin),P==null&&(P=this.tokenMax),I={e:E,pmin:C,pmax:P,origin:this.origin,line:this.line});let v=V.EIdent("null"),F=e==null?0:e.pmin,B=e==null?0:e.pmax,A;v==null?A=null:(F==null&&(F=this.tokenMin),B==null&&(B=this.tokenMax),A={e:v,pmin:F,pmax:B,origin:this.origin,line:this.line});let L=V.EBinop("==",I,A),z=null,D=null,O;L==null?O=null:(z==null&&(z=this.tokenMin),D==null&&(D=this.tokenMax),O={e:L,pmin:z,pmax:D,origin:this.origin,line:this.line});let q=V.EIdent("null"),M=e==null?0:e.pmin,U=e==null?0:e.pmax,K;q==null?K=null:(M==null&&(M=this.tokenMin),U==null&&(U=this.tokenMax),K={e:q,pmin:M,pmax:U,origin:this.origin,line:this.line});let G=V.EIdent(m),Y=e==null?0:e.pmin,$=e==null?0:e.pmax,se;G==null?se=null:(Y==null&&(Y=this.tokenMin),$==null&&($=this.tokenMax),se={e:G,pmin:Y,pmax:$,origin:this.origin,line:this.line});let ue=V.EField(se,f),oe=e==null?0:e.pmin,ge=null,me;ue==null?me=null:(oe==null&&(oe=this.tokenMin),ge==null&&(ge=this.tokenMax),me={e:ue,pmin:oe,pmax:ge,origin:this.origin,line:this.line});let de=V.ETernary(O,K,me),Oe=null,Ve=null,je;de==null?je=null:(Oe==null&&(Oe=this.tokenMin),Ve==null&&(Ve=this.tokenMax),je={e:de,pmin:Oe,pmax:Ve,origin:this.origin,line:this.line});let et=V.EBlock([T,je]),Ue=e==null?0:e.pmin,Ge=null,nt;return et==null?nt=null:(Ue==null&&(Ue=this.tokenMin),Ge==null&&(Ge=this.tokenMax),nt={e:et,pmin:Ue,pmax:Ge,origin:this.origin,line:this.line}),this.parseExprNext(nt);case 12:let De=this.parseExpr(),H=this.token();H!=J.TBkClose&&this.unexpected(H);let ie=V.EArray(e,De),R=e==null?0:e.pmin,ee=null,X;return ie==null?X=null:(R==null&&(R=this.tokenMin),ee==null&&(ee=this.tokenMax),X={e:ie,pmin:R,pmax:ee,origin:this.origin,line:this.line}),this.parseExprNext(X);case 14:let Q=this.parseExpr(),ae=this.token();ae!=J.TDoubleDot&&this.unexpected(ae);let _e=this.parseExpr(),xe=V.ETernary(e,Q,_e),Ye=e==null?0:e.pmin,gt=_e==null?0:_e.pmax;return xe==null?null:(Ye==null&&(Ye=this.tokenMin),gt==null&&(gt=this.tokenMax),{e:xe,pmin:Ye,pmax:gt,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!=J.TPClose){let i=!1;for(;!i;){let l=null,n=!1;if(t._hx_index==14&&(n=!0,t=this.token()),t._hx_index==2)l=t.s;else{this.unexpected(t);break}let s={name:l};switch(e.push(s),n&&(s.opt=!0),this.allowTypes&&(this.maybe(J.TDoubleDot)&&(s.t=this.parseType()),this.maybe(J.TOp("="))&&(s.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!=J.TPOpen&&this.unexpected(e);let t=this.parseFunctionArgs(),i=null;if(this.allowTypes){let l=this.token();l!=J.TDoubleDot?(this.tokens.push({t:l,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!=J.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 l=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 c=e.s;if(c==">")break e;if(p.cca(c,0)==62){this.tokens.add({t:J.TOp(p.substr(c,1,null)),min:this.tokenMax-c.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($t.CTPath(l,n));case 4:let s=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:s,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;let h=function(u){let c=t.token();if(c._hx_index==3){if(c.s!="->"){let _=c;t.unexpected(_)}}else{let _=c;t.unexpected(_)}return $t.CTFun(u,t.parseType())};switch(s._hx_index){case 2:let u=s.s;if(r._hx_index==15){let y=[],T=0,E=this.parseFunctionArgs();for(;T<E.length;){let P=E[T];++T;let I=P.value;if(I!=null){let v=I;if(!this.resumeErrors)throw b.thrown(new Ce(be.ECustom("Default values not allowed in function types"),v.pmin,v.pmax,this.origin,this.line))}y.push($t.CTNamed(P.name,P.opt?$t.CTOpt(P.t):P.t))}return h(y)}else{let y=this.parseType(),T=this.token();switch(T._hx_index){case 5:return this.parseTypeNext($t.CTParent(y));case 10:let E=[y];do E.push(this.parseType());while(this.maybe(J.TComma));let C=this.token();return C!=J.TPClose&&this.unexpected(C),h(E);default:let P=T;return this.unexpected(P)}}break;case 5:let c=[],_=0,f=this.parseFunctionArgs();for(;_<f.length;){let y=f[_];++_;let T=y.value;if(T!=null){let E=T;if(!this.resumeErrors)throw b.thrown(new Ce(be.ECustom("Default values not allowed in function types"),E.pmin,E.pmax,this.origin,this.line))}c.push($t.CTNamed(y.name,y.opt?$t.CTOpt(y.t):y.t))}return h(c);default:let g=this.parseType(),w=this.token();switch(w._hx_index){case 5:return this.parseTypeNext($t.CTParent(g));case 10:let y=[g];do y.push(this.parseType());while(this.maybe(J.TComma));let T=this.token();return T!=J.TPClose&&this.unexpected(T),h(y);default:let E=w;return this.unexpected(E)}}break;case 6:let a=[],o=null;e:for(;;)switch(e=this.token(),e._hx_index){case 2:let u=e.s;if(u=="var"){let _=this.getIdent(),f=this.token();f!=J.TDoubleDot&&this.unexpected(f),a.push({name:_,t:this.parseType(),meta:o}),o=null;let m=this.token();m!=J.TSemicolon&&this.unexpected(m)}else{let _=u,f=this.token();switch(f!=J.TDoubleDot&&this.unexpected(f),a.push({name:_,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 c=e.s;o==null&&(o=[]),o.push({name:c,params:this.parseMetaArgs()});break;default:this.unexpected(e);break e}return this.parseTypeNext($t.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 l=i.ret;return i.args.unshift(e),i}else return $t.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 l=[];for(;;){let n=this.token();if(n==J.TEof)break;this.tokens.push({t:n,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,l.push(this.parseModuleDecl())}return l}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(J.TOp("<"))&&!this.resumeErrors)throw b.thrown(new Ce(be.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,l=!1;e:for(;;){switch(t){case"extern":l=!0;break;case"private":i=!0;break;default:break e}t=this.getIdent()}switch(t){case"class":let n=this.getIdent(),s=this.parseParams(),r=null,h=[];e:for(;;){let E=this.token();if(E._hx_index==2)switch(E.s){case"extends":r=this.parseType();break;case"implements":h.push(this.parseType());break;default:this.tokens.push({t:E,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break e}else{this.tokens.push({t:E,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break}}let a=[],o=this.token();for(o!=J.TBrOpen&&this.unexpected(o);!this.maybe(J.TBrClose);)a.push(this.parseField());return ji.DClass({name:n,meta:e,params:s,extend:r,implement:h,fields:a,isPrivate:i,isExtern:l});case"import":let u=[this.getIdent()],c=!1;for(;;){let E=this.token();if(E!=J.TDot){this.tokens.push({t:E,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break}switch(E=this.token(),E._hx_index){case 2:let C=E.s;u.push(C);break;case 3:E.s=="*"?c=!0:this.unexpected(E);break;default:this.unexpected(E)}}let _=this.token();return _!=J.TSemicolon&&this.unexpected(_),ji.DImport(u,c);case"package":let f=this.parsePath(),m=this.token();return m!=J.TSemicolon&&this.unexpected(m),ji.DPackage(f);case"typedef":let g=this.getIdent(),w=this.parseParams(),y=this.token();pe.enumEq(y,J.TOp("="))||this.unexpected(y);let T=this.parseType();return ji.DTypedef({name:g,meta:e,params:w,isPrivate:i,t:T});default:this.unexpected(J.TId(t))}return null}parseField(){let e=this.parseMetadata(),t=[];e:for(;;){let i=this.getIdent();switch(i){case"function":let l=this.getIdent(),n=this.parseFunctionDecl();return{name:l,meta:e,access:t,kind:Fl.KFunction({args:n.args,expr:n.body,ret:n.ret})};case"inline":t.push(Ei.AInline);break;case"macro":t.push(Ei.AMacro);break;case"override":t.push(Ei.AOverride);break;case"private":t.push(Ei.APrivate);break;case"public":t.push(Ei.APublic);break;case"static":t.push(Ei.AStatic);break;case"var":let s=this.getIdent(),r=null,h=null;if(this.maybe(J.TPOpen)){r=this.getIdent();let u=this.token();u!=J.TComma&&this.unexpected(u),h=this.getIdent();let c=this.token();c!=J.TPClose&&this.unexpected(c)}let a=this.maybe(J.TDoubleDot)?this.parseType():null,o=this.maybe(J.TOp("="))?this.parseExpr():null;if(o!=null)if(this.isBlock(o))this.maybe(J.TSemicolon);else{let u=this.token();u!=J.TSemicolon&&this.unexpected(u)}else{let u;if(a!=null)if(a==null)u=!1;else if(a._hx_index==2){let c=a.fields;u=!0}else u=!1;else u=!1;if(u)this.maybe(J.TSemicolon);else{let c=this.token();c!=J.TSemicolon&&this.unexpected(c)}}return{name:s,meta:e,access:t,kind:Fl.KVar({get:r,set:h,type:a,expr:o})};default:this.unexpected(J.TId(i));break e}}return null}readChar(){return this.input.charCodeAt(this.readPos++)}readString(e){let t=0,i="",l=!1,n=this.line,s=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 b.thrown(new Ce(be.EUnterminatedString,r,r,this.origin,this.line));break}if(l)switch(l=!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 u=o++;a<<=4;let c=this.input.charCodeAt(this.readPos++);switch(c){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:a+=c-48;break;case 65:case 66:case 67:case 68:case 69:case 70:a+=c-55;break;case 97:case 98:case 99:case 100:case 101:case 102:a+=c-87;break;default:if(c!=c&&(this.line=n,!this.resumeErrors))throw b.thrown(new Ce(be.EUnterminatedString,r,r,this.origin,this.line));this.invalidChar(c)}}i+=String.fromCodePoint(a);break;default:this.invalidChar(h)}else if(h==92)l=!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,J.TEof;switch(e){case 0:return J.TEof;case 10:this.line++,this.tokenMin++;break;case 9:case 13:case 32:this.tokenMin++;break;case 34:case 39:return J.TConst(fi.CString(this.readString(e)));case 35:if(e=this.input.charCodeAt(this.readPos++),this.idents[e]){let l=String.fromCodePoint(e);for(;;){if(e=this.input.charCodeAt(this.readPos++),!this.idents[e])return this.char=e,this.preprocess(l);l+=String.fromCodePoint(e)}}this.invalidChar(e);break;case 40:return J.TPOpen;case 41:return J.TPClose;case 44:return J.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),J.TOp("...");case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:let l=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:l=l*10+(e-48);break;default:return this.char=e,J.TConst(fi.CFloat(l/n))}break;default:return this.char=e,J.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:J.TOp("..."),min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;let h=t|0;return J.TConst(h==t?fi.CInt(h):fi.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 l=this.token(),n=null;switch(l._hx_index){case 1:let h=l.c;h._hx_index==0?n=h.v:(this.tokens.push({t:l,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax);break;case 3:if(l.s=="-")if(l=this.token(),l._hx_index==1){let a=l.c;a._hx_index==0?n=-a.v:(this.tokens.push({t:l,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax)}else this.tokens.push({t:l,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;else this.tokens.push({t:l,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break;default:this.tokens.push({t:l,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax}return n==null&&this.invalidChar(e),i==0&&(i=10),J.TConst(fi.CFloat(Math.pow(10,n)/i*t*10));case 120:(t>0||i>0)&&this.invalidChar(e);let s=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:s=(s<<4)+e-48;break;case 65:case 66:case 67:case 68:case 69:case 70:s=(s<<4)+(e-55);break;case 97:case 98:case 99:case 100:case 101:case 102:s=(s<<4)+(e-87);break;default:return this.char=e,J.TConst(fi.CInt(s))}break;default:this.char=e;let r=t|0;return J.TConst(i>0?fi.CFloat(t*10/i):r==t?fi.CInt(r):fi.CFloat(t))}break;case 58:return J.TDoubleDot;case 59:return J.TSemicolon;case 61:return e=this.input.charCodeAt(this.readPos++),e==61?J.TOp("=="):e==62?J.TOp("=>"):(this.char=e,J.TOp("="));case 63:return e=this.input.charCodeAt(this.readPos++),e==46?J.TQuestionDot:(this.char=e,J.TQuestion);case 64:if(e=this.input.charCodeAt(this.readPos++),this.idents[e]||e==58){let l=String.fromCodePoint(e);for(;;){if(e=this.input.charCodeAt(this.readPos++),!this.idents[e])return this.char=e,J.TMeta(l);l+=String.fromCodePoint(e)}}this.invalidChar(e);break;case 91:return J.TBkOpen;case 93:return J.TBkClose;case 123:return J.TBrOpen;case 125:return J.TBrClose;default:if(this.ops[e]){let l=String.fromCodePoint(e);for(;;){if(e=this.input.charCodeAt(this.readPos++),e!=e&&(e=0),!this.ops[e])return this.char=e,J.TOp(l);let n=l;if(l+=String.fromCodePoint(e),!Object.prototype.hasOwnProperty.call(this.opPriority.h,l)&&Object.prototype.hasOwnProperty.call(this.opPriority.h,n))return l=="//"||l=="/*"?this.tokenComment(l,e):(this.char=e,J.TOp(n))}}if(this.idents[e]){let l=String.fromCodePoint(e);for(;;){if(e=this.input.charCodeAt(this.readPos++),e!=e&&(e=0),!this.idents[e])return this.char=e,J.TId(l);l+=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=V.EIdent(t),l=this.tokenMin,n=this.tokenMax;return i==null?null:(l==null&&(l=this.tokenMin),n==null&&(n=this.tokenMax),{e:i,pmin:l,pmax:n,origin:this.origin,line:this.line});case 3:if(e.s=="!"){let s=V.EUnop("!",!0,this.parsePreproCond()),r=this.tokenMin,h=this.tokenMax;return s==null?null:(r==null&&(r=this.tokenMin),h==null&&(h=this.tokenMax),{e:s,pmin:r,pmax:h,origin:this.origin,line:this.line})}else return this.unexpected(e);break;case 4:return this.tokens.push({t:J.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 l=t.e;return this.evalPreproCond(l);case 6:let n=t.e1,s=t.e2;switch(t.op){case"&&":let a=n,o=s;return this.evalPreproCond(a)?this.evalPreproCond(o):!1;case"||":let u=n,c=s;return this.evalPreproCond(u)?!0:this.evalPreproCond(c);default:let _=e.e;if(!this.resumeErrors)throw b.thrown(new Ce(be.EInvalidPreprocessor("Can't eval "+Qe[_.__enum__].__constructs__[_._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 b.thrown(new Ce(be.EInvalidPreprocessor("Can't eval "+Qe[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 b.thrown(new Ce(be.EInvalidPreprocessor("Can't eval "+Qe[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")):J.TPrepro(e);case"end":return this.preprocStack.length>0?(this.preprocStack.pop(),this.token()):J.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 J.TPrepro(e)}}skipTokens(){let e=this.preprocStack.length-1,t=this.preprocStack[e],i=this.readPos+this.offset;for(;;){let l=this.token();if(l==J.TEof&&!this.resumeErrors)throw b.thrown(new Ce(be.EInvalidPreprocessor("Unclosed"),i,i,this.origin,this.line));if(this.preprocStack[e]!=t){this.tokens.push({t:l,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break}}}tokenComment(e,t){let i=p.cca(e,1),l=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 b.thrown(new Ce(be.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 b.thrown(new Ce(be.EUnterminatedComment,this.tokenMin,this.tokenMin,this.origin,this.line));break}}while(t!=47);return this.token()}return this.char=t,J.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}}}j["hscript.Parser"]=tl,tl.__name__="hscript.Parser",Object.assign(tl.prototype,{__class__:tl,__properties__:{get_currentPos:"get_currentPos"}});class ol{constructor(){}exprToString(e){return this.buf=new Xt,this.tabs="",this.expr(e),this.buf.b}typeToString(e){return this.buf=new Xt,this.tabs="",this.type(e),this.buf.b}add(e){this.buf.b+=le.string(e)}type(e){switch(e._hx_index){case 0:let t=e.path,i=e.params,l=t.join(".");if(this.buf.b+=le.string(l),i!=null){this.buf.b+="<";let g=!0,w=0;for(;w<i.length;){let y=i[w];++w,g?g=!1:this.buf.b+=", ",this.type(y)}this.buf.b+=">"}break;case 1:let n=e.args,s=e.ret,r=n,h=s;if(tn.exists(r,function(g){if(g._hx_index==5){let w=g.n,y=g.t;return!0}else return!1})){this.buf.b+="(";let g=0;for(;g<r.length;){let w=r[g];if(++g,w._hx_index==5){let y=w.n,T=w.t;this.type(w)}else this.type($t.CTNamed("_",w))}this.buf.b+=")->",this.type(h)}else{let g=n,w=s;if(g.length==0)this.buf.b+="Void -> ";else{let y=0;for(;y<g.length;){let T=g[y];++y,this.type(T),this.buf.b+=" -> "}}this.type(w)}break;case 2:let a=e.fields;this.buf.b+="{";let o=!0,u=0;for(;u<a.length;){let g=a[u];++u,o?(o=!1,this.buf.b+=" "):this.buf.b+=", ",this.buf.b+=le.string(g.name+" : "),this.type(g.t)}this.buf.b+=o?"}":" }";break;case 3:let c=e.t;this.buf.b+="(",this.type(c),this.buf.b+=")";break;case 4:let _=e.t;this.buf.b+="?",this.type(_);break;case 5:let f=e.n,m=e.t;this.buf.b+=f==null?"null":""+f,this.buf.b+=":",this.type(m);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 ve=i.v;this.buf.b+=ve==null?"null":""+ve;break;case 1:let Pe=i.f;this.buf.b+=Pe==null?"null":""+Pe;break;case 2:let ot=i.s;this.buf.b+='"';let tt=ot.split('"').join('\\"').split(`
14
+ `).join("\\n").split("\r").join("\\r").split(" ").join("\\t");this.buf.b+=le.string(tt),this.buf.b+='"';break}break;case 1:let l=t.v;this.buf.b+=l==null?"null":""+l;break;case 2:let n=t.n,s=t.t,r=t.e;this.buf.b+=le.string("var "+n),this.addType(s),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 ve=0;for(;ve<a.length;){let Pe=a[ve];++ve,this.buf.b+=le.string(this.tabs),this.expr(Pe),this.buf.b+=`;
16
+ `}this.tabs=p.substr(this.tabs,1,null),this.buf.b+="}"}break;case 5:let o=t.e,u=t.f;this.expr(o),this.buf.b+=le.string("."+u);break;case 6:let c=t.op,_=t.e1,f=t.e2;this.expr(_),this.buf.b+=le.string(" "+c+" "),this.expr(f);break;case 7:let m=t.op,g=t.prefix,w=t.e;g?(this.buf.b+=m==null?"null":""+m,this.expr(w)):(this.expr(w),this.buf.b+=m==null?"null":""+m);break;case 8:let y=t.e,T=t.params;if(y==null)this.expr(y);else{let ve=y.e;switch(ve._hx_index){case 0:let Pe=ve.c;this.expr(y);break;case 1:let ot=ve.v;this.expr(y);break;case 5:let tt=ve.e,bt=ve.f;this.expr(y);break;default:this.buf.b+="(",this.expr(y),this.buf.b+=")"}}this.buf.b+="(";let E=!0,C=0;for(;C<T.length;){let ve=T[C];++C,E?E=!1:this.buf.b+=", ",this.expr(ve)}this.buf.b+=")";break;case 9:let P=t.cond,I=t.e1,v=t.e2;this.buf.b+="if( ",this.expr(P),this.buf.b+=" ) ",this.expr(I),v!=null&&(this.buf.b+=" else ",this.expr(v));break;case 10:let F=t.cond,B=t.e;this.buf.b+="while( ",this.expr(F),this.buf.b+=" ) ",this.expr(B);break;case 11:let A=t.v,L=t.it,z=t.e;this.buf.b+=le.string("for( "+A+" in "),this.expr(L),this.buf.b+=" ) ",this.expr(z);break;case 12:this.buf.b+="break";break;case 13:this.buf.b+="continue";break;case 14:let D=t.args,O=t.e,q=t.name,M=t.ret;this.buf.b+="function",q!=null&&(this.buf.b+=le.string(" "+q)),this.buf.b+="(";let U=!0,K=0;for(;K<D.length;){let ve=D[K];++K,U?U=!1:this.buf.b+=", ",ve.opt&&(this.buf.b+="?"),this.buf.b+=le.string(ve.name),this.addType(ve.t)}this.buf.b+=")",this.addType(M),this.buf.b+=" ",this.expr(O);break;case 15:let G=t.e;this.buf.b+="return",G!=null&&(this.buf.b+=" ",this.expr(G));break;case 16:let Y=t.e,$=t.index;this.expr(Y),this.buf.b+="[",this.expr($),this.buf.b+="]";break;case 17:let se=t.e;this.buf.b+="[";let ue=!0,oe=0;for(;oe<se.length;){let ve=se[oe];++oe,ue?ue=!1:this.buf.b+=", ",this.expr(ve)}this.buf.b+="]";break;case 18:let ge=t.cl,me=t.params;this.buf.b+=le.string("new "+ge+"(");let de=!0,Oe=0;for(;Oe<me.length;){let ve=me[Oe];++Oe,de?de=!1:this.buf.b+=", ",this.expr(ve)}this.buf.b+=")";break;case 19:let Ve=t.e;this.buf.b+="throw ",this.expr(Ve);break;case 20:let je=t.e,et=t.v,Ue=t.t,Ge=t.ecatch;this.buf.b+="try ",this.expr(je),this.buf.b+=le.string(" catch( "+et),this.addType(Ue),this.buf.b+=") ",this.expr(Ge);break;case 21:let nt=t.fl;if(nt.length==0)this.buf.b+="{}";else{this.tabs+=" ",this.buf.b+=`{
17
+ `;let ve=0;for(;ve<nt.length;){let Pe=nt[ve];++ve,this.buf.b+=le.string(this.tabs),this.buf.b+=le.string(Pe.name+" : "),this.expr(Pe.e),this.buf.b+=`,
18
18
  `}this.tabs=p.substr(this.tabs,1,null),this.buf.b+="}"}break;case 22:let De=t.cond,H=t.e1,ie=t.e2;this.expr(De),this.buf.b+=" ? ",this.expr(H),this.buf.b+=" : ",this.expr(ie);break;case 23:let R=t.e,ee=t.cases,X=t.defaultExpr;this.buf.b+="switch( ",this.expr(R),this.buf.b+=") {";let Q=0;for(;Q<ee.length;){let ve=ee[Q];++Q,this.buf.b+="case ";let Pe=!0,ot=0,tt=ve.values;for(;ot<tt.length;){let bt=tt[ot];++ot,Pe?Pe=!1:this.buf.b+=", ",this.expr(bt)}this.buf.b+=": ",this.expr(ve.expr),this.buf.b+=`;
19
19
  `}X!=null&&(this.buf.b+="default: ",this.expr(X),this.buf.b+=`;
20
20
  `),this.buf.b+="}";break;case 24:let ae=t.cond,_e=t.e;this.buf.b+="do ",this.expr(_e),this.buf.b+=" while ( ",this.expr(ae),this.buf.b+=" )";break;case 25:let xe=t.name,Ye=t.args,gt=t.e;if(this.buf.b+="@",this.buf.b+=xe==null?"null":""+xe,Ye!=null&&Ye.length>0){this.buf.b+="(";let ve=!0,Pe=0;for(;Pe<Ye.length;){let ot=Ye[Pe];++Pe,ve?ve=!1:this.buf.b+=", ",this.expr(gt)}this.buf.b+=")"}this.buf.b+=" ",this.expr(gt);break;case 26:let Be=t.e,_t=t.t;this.buf.b+="(",this.expr(Be),this.buf.b+=" : ",this.addType(_t),this.buf.b+=")";break}}static toString(e){return new ol().exprToString(e)}static errorToString(e){let t,i=e.e;switch(i._hx_index){case 0:let l=i.c;t="Invalid character: '"+(l!=l?"EOF":String.fromCodePoint(l))+"' ("+l+")";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}}j["hscript.Printer"]=ol,ol.__name__="hscript.Printer",Object.assign(ol.prototype,{__class__:ol});class en{static iter(e,t){let i=e.e;switch(i._hx_index){case 0:let l=i.c;break;case 1:let n=i.v;break;case 2:let s=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,u=0;for(;u<o.length;){let Be=o[u];++u,t(Be)}break;case 5:let c=i.f,_=i.e;t(_);break;case 6:let f=i.op,m=i.e1,g=i.e2;t(m),t(g);break;case 7:let w=i.op,y=i.prefix,T=i.e;t(T);break;case 8:let E=i.e,C=i.params;t(E);let P=0;for(;P<C.length;){let Be=C[P];++P,t(Be)}break;case 9:let I=i.cond,v=i.e1,F=i.e2;t(I),t(v),F!=null&&t(F);break;case 10:let B=i.cond,A=i.e;t(B),t(A);break;case 11:let L=i.v,z=i.it,D=i.e;t(z),t(D);break;case 12:case 13:break;case 14:let O=i.args,q=i.name,M=i.ret,U=i.e;t(U);break;case 15:let K=i.e;K!=null&&t(K);break;case 16:let G=i.e,Y=i.index;t(G),t(Y);break;case 17:let $=i.e,se=0;for(;se<$.length;){let Be=$[se];++se,t(Be)}break;case 18:let ue=i.cl,oe=i.params,ge=0;for(;ge<oe.length;){let Be=oe[ge];++ge,t(Be)}break;case 19:let me=i.e;t(me);break;case 20:let de=i.v,Oe=i.t,Ve=i.e,je=i.ecatch;t(Ve),t(je);break;case 21:let et=i.fl,Ue=0;for(;Ue<et.length;){let Be=et[Ue];++Ue,t(Be.e)}break;case 22:let Ge=i.cond,nt=i.e1,De=i.e2;t(Ge),t(nt),t(De);break;case 23:let H=i.e,ie=i.cases,R=i.defaultExpr;t(H);let ee=0;for(;ee<ie.length;){let Be=ie[ee];++ee;let _t=0,ve=Be.values;for(;_t<ve.length;){let Pe=ve[_t];++_t,t(Pe)}t(Be.expr)}R!=null&&t(R);break;case 24:let X=i.cond,Q=i.e;t(X),t(Q);break;case 25:let ae=i.name,_e=i.args,xe=i.e;if(_e!=null){let Be=0;for(;Be<_e.length;){let _t=_e[Be];++Be,t(_t)}}t(xe);break;case 26:let Ye=i.t,gt=i.e;t(gt);break}}static map(e,t){let i,l=e.e;switch(l._hx_index){case 0:let n=l.c;i=e.e;break;case 1:let s=l.v;i=e.e;break;case 2:let r=l.n,h=l.t,a=l.e;i=V.EVar(r,h,a!=null?t(a):null);break;case 3:let o=l.e;i=V.EParent(t(o));break;case 4:let u=l.e,c=[],_=0;for(;_<u.length;){let $e=u[_];++_,c.push(t($e))}i=V.EBlock(c);break;case 5:let f=l.e,m=l.f;i=V.EField(t(f),m);break;case 6:let g=l.op,w=l.e1,y=l.e2;i=V.EBinop(g,t(w),t(y));break;case 7:let T=l.op,E=l.prefix,C=l.e;i=V.EUnop(T,E,t(C));break;case 8:let P=l.e,I=l.params,v=t(P),F=[],B=0;for(;B<I.length;){let $e=I[B];++B,F.push(t($e))}i=V.ECall(v,F);break;case 9:let A=l.cond,L=l.e1,z=l.e2;i=V.EIf(t(A),t(L),z!=null?t(z):null);break;case 10:let D=l.cond,O=l.e;i=V.EWhile(t(D),t(O));break;case 11:let q=l.v,M=l.it,U=l.e;i=V.EFor(q,t(M),t(U));break;case 12:case 13:i=e.e;break;case 14:let K=l.args,G=l.e,Y=l.name,$=l.ret;i=V.EFunction(K,t(G),Y,$);break;case 15:let se=l.e;i=V.EReturn(se!=null?t(se):null);break;case 16:let ue=l.e,oe=l.index;i=V.EArray(t(ue),t(oe));break;case 17:let ge=l.e,me=[],de=0;for(;de<ge.length;){let $e=ge[de];++de,me.push(t($e))}i=V.EArrayDecl(me);break;case 18:let Oe=l.cl,Ve=l.params,je=[],et=0;for(;et<Ve.length;){let $e=Ve[et];++et,je.push(t($e))}i=V.ENew(Oe,je);break;case 19:let Ue=l.e;i=V.EThrow(t(Ue));break;case 20:let Ge=l.e,nt=l.v,De=l.t,H=l.ecatch;i=V.ETry(t(Ge),nt,De,t(H));break;case 21:let ie=l.fl,R=[],ee=0;for(;ee<ie.length;){let $e=ie[ee];++ee,R.push({name:$e.name,e:t($e.e)})}i=V.EObject(R);break;case 22:let X=l.cond,Q=l.e1,ae=l.e2;i=V.ETernary(t(X),t(Q),t(ae));break;case 23:let _e=l.e,xe=l.cases,Ye=l.defaultExpr,gt=t(_e),Be=[],_t=0;for(;_t<xe.length;){let $e=xe[_t];++_t;let Bt=[],It=0,Lt=$e.values;for(;It<Lt.length;){let mt=Lt[It];++It,Bt.push(t(mt))}Be.push({values:Bt,expr:t($e.expr)})}i=V.ESwitch(gt,Be,Ye==null?null:t(Ye));break;case 24:let ve=l.cond,Pe=l.e;i=V.EDoWhile(t(ve),t(Pe));break;case 25:let ot=l.name,tt=l.args,bt=l.e,Kt;if(tt==null)Kt=null;else{let $e=[],Bt=0;for(;Bt<tt.length;){let It=tt[Bt];++Bt,$e.push(t(It))}Kt=$e}i=V.EMeta(ot,Kt,t(bt));break;case 26:let ft=l.e,li=l.t;i=V.ECheckType(t(ft),li);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}}}j["hscript.Tools"]=en,en.__name__="hscript.Tools";class te{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=te.__nativeClassName(e);return i!=null?te.__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=Qe[e.__enum__].__constructs__[e._hx_index],o=a._hx_name;return a.__params__?(t=t+" ",o+"("+(function(u){var c;let _=[];{let f=0,m=a.__params__;for(;f<m.length;){let g=m[f];f=f+1,_.push(te.__string_rec(e[g],t))}}return c=_,c})(this).join(",")+")"):o}if(e instanceof Array){let h="[";t+=" ";let a=0,o=e.length;for(;a<o;){let u=a++;h+=(u>0?",":"")+te.__string_rec(e[u],t)}return h+="]",h}let l;try{l=e.toString}catch{return"???"}if(l!=null&&l!=Object.toString&&typeof l=="function"){let h=e.toString();if(h!="[object Object]")return h}let n=`{
21
21
  `;t+=" ";let s=e.hasOwnProperty!=null,r=null;for(r in e)s&&!e.hasOwnProperty(r)||r=="prototype"||r=="__class__"||r=="__super__"||r=="__interfaces__"||r=="__properties__"||(n.length!=2&&(n+=`,
22
22
  `),n+=t+r+" : "+te.__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 l=0,n=i.length;for(;l<n;){let s=l++,r=i[s];if(r==t||te.__interfLoop(r,t))return!0}}return te.__interfLoop(e.__super__,t)}static __instanceof(e,t){if(t==null)return!1;switch(t){case Array:return e instanceof Array;case yn:return typeof e=="boolean";case wn:return e!=null;case kn:return typeof e=="number";case xn:return typeof e=="number"?(e|0)===e:!1;case String:return typeof e=="string";default:if(e!=null){if(typeof t=="function"){if(te.__downcastCheck(e,t))return!0}else if(typeof t=="object"&&te.__isNativeObj(t)&&e instanceof t)return!0}else return!1;return t==bn&&e.__name__!=null||t==Cn&&e.__ename__!=null?!0:e.__enum__!=null?Qe[e.__enum__]==t:!1}}static __downcastCheck(e,t){return e instanceof t?!0:t.__isInterface__?te.__interfLoop(te.getClass(e),t):!1}static __implements(e,t){return te.__interfLoop(te.getClass(e),t)}static __cast(e,t){if(e==null||te.__instanceof(e,t))return e;throw b.thrown("Cannot cast "+ne.string(e)+" to "+ne.string(t))}static __nativeClassName(e){let t=te.__toStr.call(e).slice(8,-1);return t=="Object"||t=="Function"||t=="Math"||t=="JSON"?null:t}static __isNativeObj(e){return te.__nativeClassName(e)!=null}static __resolveNativeClass(e){return Zl[e]}}j["js.Boot"]=te,te.__name__="js.Boot";class re{static isArray(e){return e instanceof Array}static arrayLength(e){return e.length}static arrayGet(e,t){let i=t|0,l=e;return i>=0&&i<l.length?l[i]:null}static arraySet(e,t,i){let l=t|0,n=e;n[l]=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 Ti(e)}static arrayCopy(e){let t=re.arrayLength(e),i=re.createArray(),l=0,n=t;for(;l<n;){let s=l++;re.arrayPush(i,re.arrayGet(e,s))}return i}static arraySort(e,t){let i=re.arrayLength(e),l=1,n=i;for(;l<n;){let s=l++,r=re.arrayGet(e,s),h=s-1;for(;h>=0&&t(re.arrayGet(e,h),r)>0;)re.arraySet(e,h+1,re.arrayGet(e,h)),--h;re.arraySet(e,h+1,r)}}static arrayReverse(e){let t=0,i=re.arrayLength(e)-1;for(;t<i;){let l=re.arrayGet(e,t);re.arraySet(e,t,re.arrayGet(e,i)),re.arraySet(e,i,l),++t,--i}}static arrayJoin(e,t){let i=re.arrayLength(e),l="",n=0,s=i;for(;n<s;){let r=n++;r>0&&(l+=t==null?"null":""+t),l+=ne.string(re.arrayGet(e,r)==null?"null":ne.string(re.arrayGet(e,r)))}return l}}j["loreline.Arrays"]=re,re.__name__="loreline.Arrays";class Mt{static addQuotes(e){e.each(function(t,i){if(t instanceof Tt){let l=t;if(l.quotes==0){l.quotes=1;let n=0,s=l.parts.length;for(;n<s;){let r=n++,h=l.parts[r].partType;if(h._hx_index==0){let a=h.text,o=Mt.unquotedRawToQuotedRaw(a);l.parts[r].partType=ze.Raw(o)}}}}})}static removeQuotes(e){e.each(function(t,i){if(t instanceof Tt){let l=t;if(l.quotes==1){let n="",s=0,r=l.parts;for(;s<r.length;){let h=r[s];++s;let a=h.partType;if(a._hx_index==0){let o=a.text;n+=o}}if(Mt.canSafelyRemoveQuotes(n)){l.quotes=0;let h=0,a=l.parts.length;for(;h<a;){let o=h++,u=l.parts[o].partType;if(u._hx_index==0){let c=u.text,_=Mt.quotedRawToUnquotedRaw(c);l.parts[o].partType=ze.Raw(_)}}}}}})}static toBraceStyle(e){e.each(function(t,i){if(t instanceof Wt)te.__cast(t,Wt).style=1;else if(t instanceof zt)te.__cast(t,zt).style=1;else if(t instanceof Me)te.__cast(t,Me).style=1;else if(t instanceof mi)te.__cast(t,mi).style=1;else if(t instanceof Et)te.__cast(t,Et).style=1;else if(t instanceof ii)te.__cast(t,ii).style=1;else if(t instanceof Ke){let l=t,n=l.literalType;if(n._hx_index==4){let s=n.style;l.literalType=He.Object(1)}}})}static toPlainStyle(e){e.each(function(t,i){if(t instanceof Wt)te.__cast(t,Wt).style=0;else if(t instanceof zt)te.__cast(t,zt).style=0;else if(t instanceof Me)te.__cast(t,Me).style=0;else if(t instanceof mi)te.__cast(t,mi).style=0;else if(t instanceof Et)te.__cast(t,Et).style=0;else if(t instanceof ii)te.__cast(t,ii).style=0;else if(t instanceof Ke){let l=t,n=l.literalType;if(n._hx_index==4){let s=n.style;l.literalType=He.Object(0)}}})}static useWordOperators(e){e.each(function(t,i){if(t instanceof Qt){let l=t,n=l.op;switch(n._hx_index){case 37:let s=n.word;l.op=x.OpAnd(!0);break;case 38:let r=n.word;l.op=x.OpOr(!0);break;default:}}})}static useSymbolOperators(e){e.each(function(t,i){if(t instanceof Qt){let l=t,n=l.op;switch(n._hx_index){case 37:let s=n.word;l.op=x.OpAnd(!1);break;case 38:let r=n.word;l.op=x.OpOr(!1);break;default:}}})}static useParenConditions(e){e.each(function(t,i){t instanceof gi?te.__cast(t,gi).conditionStyle=2:t instanceof Et&&(te.__cast(t,Et).conditionStyle=2)})}static usePlainConditions(e){e.each(function(t,i){t instanceof gi?te.__cast(t,gi).conditionStyle=0:t instanceof Et&&(te.__cast(t,Et).conditionStyle=0)})}static reindentFunctions(e,t,i){e.each(function(l,n){if(l instanceof Li){let s=l;s.code!=null&&s.code.length>0&&!s.external&&(s.code=Mt.reindentCode(s.code,t,i))}})}static insertLocalizationKeys(e,t){let i=new _l,l=e.split(`
24
- `),n=Object.create(null);t.each(function(a,o){if(a instanceof Le){let u=a;if(u.trailingComments!=null){let c=0,_=u.trailingComments;for(;c<_.length;){let f=_[c];if(++c,f.isHash){let m=Ae.trim(f.content);n[m]=!0}}}if(u.leadingComments!=null){let c=0,_=u.leadingComments;for(;c<_.length;){let f=_[c];if(++c,f.isHash){let m=Ae.trim(f.content);n[m]=!0}}}}});let s=[];if(t.each(function(a,o){let u=null;if(a instanceof ui?u=te.__cast(a,ui).content:a instanceof ti?u=te.__cast(a,ti).content:a instanceof Et&&(u=te.__cast(a,Et).text),u!=null){let _=Mt.getStringEndLine(u)-1;if(_>=0&&_<l.length&&Mt.lineHasHashComment(l[_]))return;let f,m=0;do f=Mt.randomId(i,4+(m*.01|0)),++m;while(Object.prototype.hasOwnProperty.call(n,f));n[f]=!0,s.push({offset:u.pos.offset+u.pos.length,text:" #"+f})}}),s.length==0)return e;s.sort(function(a,o){return o.offset-a.offset});let r=e,h=0;for(;h<s.length;){let a=s[h];++h;let o=a.offset,u=a.offset,c=null;r=(o!=null?p.substr(r,0,o):p.substr(r,0,null))+a.text+(c!=null?p.substr(r,u,c):p.substr(r,u,null))}return r}static removeLocalizationKeys(e,t){let i=[];if(t.each(function(s,r){if(s instanceof Le){let h=s,a=h.trailingComments;if(a!=null){let u=0;for(;u<a.length;){let c=a[u];if(++u,c.isHash){let _=c.pos.offset,f=c.pos.offset+c.pos.length;for(;_>0;){let m=p.cca(e,_-1),g=m??-1;if(g==32||g==9)--_;else break}i.push({start:_,end:f})}}}let o=h.leadingComments;if(o!=null){let u=0;for(;u<o.length;){let c=o[u];if(++u,c.isHash){let _=c.pos.offset,f=c.pos.offset+c.pos.length;for(;_>0;){let m=p.cca(e,_-1),g=m??-1;if(g==32||g==9)--_;else break}i.push({start:_,end:f})}}}}}),i.length==0)return e;i.sort(function(s,r){return r.start-s.start});let l=e,n=0;for(;n<i.length;){let s=i[n];++n;let r=s.start,h=s.end,a=null;l=(r!=null?p.substr(l,0,r):p.substr(l,0,null))+(a!=null?p.substr(l,h,a):p.substr(l,h,null))}return l}static lineHasHashComment(e){let t=0;for(;t<e.length;){if(p.cca(e,t)==35){if(t+1<e.length&&p.cca(e,t+1)==35){t+=2;continue}if(t>0&&p.cca(e,t-1)==92){++t;continue}let i=t+1;for(;i<e.length;){let l=p.cca(e,i);if(l>=97&&l<=122||l>=65&&l<=90||l>=48&&l<=57||l==95||l==45)++i;else break}if(i>t+1)return!0}++t}return!1}static extractTranslations(e){let t=new Ee;return e.each(function(i,l){let n=null,s=null;if(i instanceof ui?(s=i,n=te.__cast(i,ui).content):i instanceof ti&&(s=i,n=te.__cast(i,ti).content),n!=null&&s!=null){let r=Mt.findHashComment(s,n);r!=null&&(t.h[r]=n)}}),t}static extractTranslatableEntries(e){let t=[];return e.each(function(i,l){let n=null,s=null;if(i instanceof ui)n=i,s=te.__cast(i,ui).content;else if(i instanceof ti)n=i,s=te.__cast(i,ti).content;else if(i instanceof Et){let r=i;r.text!=null&&(n=i,s=r.text)}if(s!=null&&n!=null){let r=Mt.findHashComment(n,s);r!=null&&t.push({id:r,str:s})}}),t}static generateTranslationFile(e,t,i){let l=Mt.extractTranslatableEntries(e),n="",s=!0;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 l=0,n=i.length;for(;l<n;){let s=l++,r=i[s];if(r==t||te.__interfLoop(r,t))return!0}}return te.__interfLoop(e.__super__,t)}static __instanceof(e,t){if(t==null)return!1;switch(t){case Array:return e instanceof Array;case yn:return typeof e=="boolean";case wn:return e!=null;case kn:return typeof e=="number";case xn:return typeof e=="number"?(e|0)===e:!1;case String:return typeof e=="string";default:if(e!=null){if(typeof t=="function"){if(te.__downcastCheck(e,t))return!0}else if(typeof t=="object"&&te.__isNativeObj(t)&&e instanceof t)return!0}else return!1;return t==bn&&e.__name__!=null||t==Cn&&e.__ename__!=null?!0:e.__enum__!=null?Qe[e.__enum__]==t:!1}}static __downcastCheck(e,t){return e instanceof t?!0:t.__isInterface__?te.__interfLoop(te.getClass(e),t):!1}static __implements(e,t){return te.__interfLoop(te.getClass(e),t)}static __cast(e,t){if(e==null||te.__instanceof(e,t))return e;throw b.thrown("Cannot cast "+le.string(e)+" to "+le.string(t))}static __nativeClassName(e){let t=te.__toStr.call(e).slice(8,-1);return t=="Object"||t=="Function"||t=="Math"||t=="JSON"?null:t}static __isNativeObj(e){return te.__nativeClassName(e)!=null}static __resolveNativeClass(e){return Zl[e]}}j["js.Boot"]=te,te.__name__="js.Boot";class re{static isArray(e){return e instanceof Array}static arrayLength(e){return e.length}static arrayGet(e,t){let i=t|0,l=e;return i>=0&&i<l.length?l[i]:null}static arraySet(e,t,i){let l=t|0,n=e;n[l]=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 Ti(e)}static arrayCopy(e){let t=re.arrayLength(e),i=re.createArray(),l=0,n=t;for(;l<n;){let s=l++;re.arrayPush(i,re.arrayGet(e,s))}return i}static arraySort(e,t){let i=re.arrayLength(e),l=1,n=i;for(;l<n;){let s=l++,r=re.arrayGet(e,s),h=s-1;for(;h>=0&&t(re.arrayGet(e,h),r)>0;)re.arraySet(e,h+1,re.arrayGet(e,h)),--h;re.arraySet(e,h+1,r)}}static arrayReverse(e){let t=0,i=re.arrayLength(e)-1;for(;t<i;){let l=re.arrayGet(e,t);re.arraySet(e,t,re.arrayGet(e,i)),re.arraySet(e,i,l),++t,--i}}static arrayJoin(e,t){let i=re.arrayLength(e),l="",n=0,s=i;for(;n<s;){let r=n++;r>0&&(l+=t==null?"null":""+t),l+=le.string(re.arrayGet(e,r)==null?"null":le.string(re.arrayGet(e,r)))}return l}}j["loreline.Arrays"]=re,re.__name__="loreline.Arrays";class Mt{static addQuotes(e){e.each(function(t,i){if(t instanceof Tt){let l=t;if(l.quotes==0){l.quotes=1;let n=0,s=l.parts.length;for(;n<s;){let r=n++,h=l.parts[r].partType;if(h._hx_index==0){let a=h.text,o=Mt.unquotedRawToQuotedRaw(a);l.parts[r].partType=ze.Raw(o)}}}}})}static removeQuotes(e){e.each(function(t,i){if(t instanceof Tt){let l=t;if(l.quotes==1){let n="",s=0,r=l.parts;for(;s<r.length;){let h=r[s];++s;let a=h.partType;if(a._hx_index==0){let o=a.text;n+=o}}if(Mt.canSafelyRemoveQuotes(n)){l.quotes=0;let h=0,a=l.parts.length;for(;h<a;){let o=h++,u=l.parts[o].partType;if(u._hx_index==0){let c=u.text,_=Mt.quotedRawToUnquotedRaw(c);l.parts[o].partType=ze.Raw(_)}}}}}})}static toBraceStyle(e){e.each(function(t,i){if(t instanceof Wt)te.__cast(t,Wt).style=1;else if(t instanceof zt)te.__cast(t,zt).style=1;else if(t instanceof Me)te.__cast(t,Me).style=1;else if(t instanceof mi)te.__cast(t,mi).style=1;else if(t instanceof Et)te.__cast(t,Et).style=1;else if(t instanceof ii)te.__cast(t,ii).style=1;else if(t instanceof Ke){let l=t,n=l.literalType;if(n._hx_index==4){let s=n.style;l.literalType=He.Object(1)}}})}static toPlainStyle(e){e.each(function(t,i){if(t instanceof Wt)te.__cast(t,Wt).style=0;else if(t instanceof zt)te.__cast(t,zt).style=0;else if(t instanceof Me)te.__cast(t,Me).style=0;else if(t instanceof mi)te.__cast(t,mi).style=0;else if(t instanceof Et)te.__cast(t,Et).style=0;else if(t instanceof ii)te.__cast(t,ii).style=0;else if(t instanceof Ke){let l=t,n=l.literalType;if(n._hx_index==4){let s=n.style;l.literalType=He.Object(0)}}})}static useWordOperators(e){e.each(function(t,i){if(t instanceof Qt){let l=t,n=l.op;switch(n._hx_index){case 37:let s=n.word;l.op=x.OpAnd(!0);break;case 38:let r=n.word;l.op=x.OpOr(!0);break;default:}}})}static useSymbolOperators(e){e.each(function(t,i){if(t instanceof Qt){let l=t,n=l.op;switch(n._hx_index){case 37:let s=n.word;l.op=x.OpAnd(!1);break;case 38:let r=n.word;l.op=x.OpOr(!1);break;default:}}})}static useParenConditions(e){e.each(function(t,i){t instanceof gi?te.__cast(t,gi).conditionStyle=2:t instanceof Et&&(te.__cast(t,Et).conditionStyle=2)})}static usePlainConditions(e){e.each(function(t,i){t instanceof gi?te.__cast(t,gi).conditionStyle=0:t instanceof Et&&(te.__cast(t,Et).conditionStyle=0)})}static reindentFunctions(e,t,i){e.each(function(l,n){if(l instanceof Li){let s=l;s.code!=null&&s.code.length>0&&!s.external&&(s.code=Mt.reindentCode(s.code,t,i))}})}static insertLocalizationKeys(e,t){let i=new _l,l=e.split(`
24
+ `),n=Object.create(null);t.each(function(a,o){if(a instanceof Le){let u=a;if(u.trailingComments!=null){let c=0,_=u.trailingComments;for(;c<_.length;){let f=_[c];if(++c,f.isHash){let m=Ae.trim(f.content);n[m]=!0}}}if(u.leadingComments!=null){let c=0,_=u.leadingComments;for(;c<_.length;){let f=_[c];if(++c,f.isHash){let m=Ae.trim(f.content);n[m]=!0}}}}});let s=[];if(t.each(function(a,o){let u=null;if(a instanceof ci?u=te.__cast(a,ci).content:a instanceof ti?u=te.__cast(a,ti).content:a instanceof Et&&(u=te.__cast(a,Et).text),u!=null){let _=Mt.getStringEndLine(u)-1;if(_>=0&&_<l.length&&Mt.lineHasHashComment(l[_]))return;let f,m=0;do f=Mt.randomId(i,4+(m*.01|0)),++m;while(Object.prototype.hasOwnProperty.call(n,f));n[f]=!0,s.push({offset:u.pos.offset+u.pos.length,text:" #"+f})}}),s.length==0)return e;s.sort(function(a,o){return o.offset-a.offset});let r=e,h=0;for(;h<s.length;){let a=s[h];++h;let o=a.offset,u=a.offset,c=null;r=(o!=null?p.substr(r,0,o):p.substr(r,0,null))+a.text+(c!=null?p.substr(r,u,c):p.substr(r,u,null))}return r}static removeLocalizationKeys(e,t){let i=[];if(t.each(function(s,r){if(s instanceof Le){let h=s,a=h.trailingComments;if(a!=null){let u=0;for(;u<a.length;){let c=a[u];if(++u,c.isHash){let _=c.pos.offset,f=c.pos.offset+c.pos.length;for(;_>0;){let m=p.cca(e,_-1),g=m??-1;if(g==32||g==9)--_;else break}i.push({start:_,end:f})}}}let o=h.leadingComments;if(o!=null){let u=0;for(;u<o.length;){let c=o[u];if(++u,c.isHash){let _=c.pos.offset,f=c.pos.offset+c.pos.length;for(;_>0;){let m=p.cca(e,_-1),g=m??-1;if(g==32||g==9)--_;else break}i.push({start:_,end:f})}}}}}),i.length==0)return e;i.sort(function(s,r){return r.start-s.start});let l=e,n=0;for(;n<i.length;){let s=i[n];++n;let r=s.start,h=s.end,a=null;l=(r!=null?p.substr(l,0,r):p.substr(l,0,null))+(a!=null?p.substr(l,h,a):p.substr(l,h,null))}return l}static lineHasHashComment(e){let t=0;for(;t<e.length;){if(p.cca(e,t)==35){if(t+1<e.length&&p.cca(e,t+1)==35){t+=2;continue}if(t>0&&p.cca(e,t-1)==92){++t;continue}let i=t+1;for(;i<e.length;){let l=p.cca(e,i);if(l>=97&&l<=122||l>=65&&l<=90||l>=48&&l<=57||l==95||l==45)++i;else break}if(i>t+1)return!0}++t}return!1}static extractTranslations(e){let t=new Ee;return e.each(function(i,l){let n=null,s=null;if(i instanceof ci?(s=i,n=te.__cast(i,ci).content):i instanceof ti&&(s=i,n=te.__cast(i,ti).content),n!=null&&s!=null){let r=Mt.findHashComment(s,n);r!=null&&(t.h[r]=n)}}),t}static extractTranslatableEntries(e){let t=[];return e.each(function(i,l){let n=null,s=null;if(i instanceof ci)n=i,s=te.__cast(i,ci).content;else if(i instanceof ti)n=i,s=te.__cast(i,ti).content;else if(i instanceof Et){let r=i;r.text!=null&&(n=i,s=r.text)}if(s!=null&&n!=null){let r=Mt.findHashComment(n,s);r!=null&&t.push({id:r,str:s})}}),t}static generateTranslationFile(e,t,i){let l=Mt.extractTranslatableEntries(e),n="",s=!0;n+=`
25
25
  `;let r=0;for(;r<l.length;){let h=l[r];++r,s||(n+=`
26
- `),s=!1;let a=i.printStringLiteralAsReference(h.str),o=i.printStringLiteralAsText(h.str);n+="#",n+=ne.string(h.id),n+=" // ",n+=a==null?"null":""+a,n+=`
27
- `,t!=null&&Object.prototype.hasOwnProperty.call(t.h,h.id)?n+=ne.string(i.printStringLiteralAsText(t.h[h.id])):n+=o==null?"null":""+o,n+=`
26
+ `),s=!1;let a=i.printStringLiteralAsReference(h.str),o=i.printStringLiteralAsText(h.str);n+="#",n+=le.string(h.id),n+=" // ",n+=a==null?"null":""+a,n+=`
27
+ `,t!=null&&Object.prototype.hasOwnProperty.call(t.h,h.id)?n+=le.string(i.printStringLiteralAsText(t.h[h.id])):n+=o==null?"null":""+o,n+=`
28
28
  `}return n}static unquotedRawToQuotedRaw(e){let t="",i=0;for(;i<e.length;){let l=p.cca(e,i);if(l==92&&i+1<e.length){let n=p.cca(e,i+1);n==110||n==116||n==114||n==92||n==60?(t+=String.fromCodePoint(l),t+=String.fromCodePoint(n),i+=2):(t+=String.fromCodePoint(n),i+=2)}else l==34?(t+='\\"',++i):(t+=String.fromCodePoint(l),++i)}return t}static quotedRawToUnquotedRaw(e){let t="",i=0;for(;i<e.length;){let l=p.cca(e,i);if(l==92&&i+1<e.length){let n=p.cca(e,i+1);n==34?(t+=String.fromCodePoint(n),i+=2):(t+=String.fromCodePoint(l),t+=String.fromCodePoint(n),i+=2)}else t+=String.fromCodePoint(l),++i}return t}static canSafelyRemoveQuotes(e){if(e.length==0||e.indexOf(`
29
29
  `)!=-1||e.indexOf("{")!=-1)return!1;let t=p.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 s=p.cca(e,1);if(s==47||s==42)return!1}if(e.length>=2&&t==45&&p.cca(e,1)==62||t==43&&e.length>=3&&p.cca(e,1)==32)return!1;let i=["beat ","state ","character ","choice ","import ","new ","function ","if ","else "],l=0;for(;l<i.length;){let s=i[l];if(++l,e.startsWith(s))return!1}let n=e.indexOf(":");if(n>0){let s=!0,r=0,h=n;for(;r<h;){let a=r++,o=p.cca(e,a);if(!(o>=97&&o<=122||o>=65&&o<=90||o>=48&&o<=57||o==95)){s=!1;break}}if(s)return!1}return!(e=="null"||e=="true"||e=="false"||Mt.isNumberLiteral(e)||e.length>=2&&p.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(p.cca(e,0)==45&&++t,t>=e.length)return!1;let i=!1,l=!1;for(;t<e.length;){let n=p.cca(e,t);if(n>=48&&n<=57)i=!0;else if(n==46&&!l)l=!0;else return!1;++t}return i}static reindentCode(e,t,i){if(t==i)return e;let l=e.split(`
30
30
  `),n="",s=0,r=l.length;for(;s<r;){let h=s++;h>0&&(n+=`
31
- `);let a=l[h],o=0,u=0;for(;p.substr(a,u,null).startsWith(t);)++o,u+=t.length;let c=0,_=o;for(;c<_;){let f=c++;n+=i==null?"null":""+i}n+=ne.string(p.substr(a,u,null))}return n}static getStringEndLine(e){let t=e.pos.line,i=0,l=e.parts;for(;i<l.length;){let n=l[i];if(++i,n.pos!=null){let s=n.pos.line,r=n.partType;if(r._hx_index==0){let h=r.text,a=0;for(;a<h.length;)p.cca(h,a)==10&&++s,++a}s>t&&(t=s)}}return t}static findHashComment(e,t){if(e.trailingComments!=null){let i=0,l=e.trailingComments;for(;i<l.length;){let n=l[i];if(++i,n.isHash)return Ae.trim(n.content)}}if(e.leadingComments!=null){let i=0,l=e.leadingComments;for(;i<l.length;){let n=l[i];if(++i,n.isHash)return Ae.trim(n.content)}}if(t!=null){if(t.trailingComments!=null){let i=0,l=t.trailingComments;for(;i<l.length;){let n=l[i];if(++i,n.isHash)return Ae.trim(n.content)}}if(t.leadingComments!=null){let i=0,l=t.leadingComments;for(;i<l.length;){let n=l[i];if(++i,n.isHash)return Ae.trim(n.content)}}}return null}static randomId(e,t){let i="",l=0,n=t;for(;l<n;){let o=l++,u=p.cca(Mt.randomId_chars,Math.floor(36*((e.seed=e.seed*16807%2147483647)/2147483647+233e-12)));i+=String.fromCodePoint(u)}let s=i,r=!0,h=0,a=s.length;for(;h<a;){let o=h++,u=p.cca(s,o);if(!(u>=48&&u<=57||u>=97&&u<=102)){r=!1;break}}if(r){let o=Math.floor(t*((e.seed=e.seed*16807%2147483647)/2147483647+233e-12)),u=p.cca(Mt.randomId_nonHexChars,Math.floor(Mt.randomId_nonHexChars.length*((e.seed=e.seed*16807%2147483647)/2147483647+233e-12)));s=p.substr(s,0,o)+String.fromCodePoint(u)+p.substr(s,o+1,null)}return s}}j["loreline.AstUtils"]=Yi.loreline.AstUtils=Mt,Mt.__name__="loreline.AstUtils";class il{constructor(e){this.func=e}}j["loreline.Async"]=il,il.__name__="loreline.Async",Object.assign(il.prototype,{__class__:il});class ul{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 Ji{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=Ae.rtrim(e)+`
31
+ `);let a=l[h],o=0,u=0;for(;p.substr(a,u,null).startsWith(t);)++o,u+=t.length;let c=0,_=o;for(;c<_;){let f=c++;n+=i==null?"null":""+i}n+=le.string(p.substr(a,u,null))}return n}static getStringEndLine(e){let t=e.pos.line,i=0,l=e.parts;for(;i<l.length;){let n=l[i];if(++i,n.pos!=null){let s=n.pos.line,r=n.partType;if(r._hx_index==0){let h=r.text,a=0;for(;a<h.length;)p.cca(h,a)==10&&++s,++a}s>t&&(t=s)}}return t}static findHashComment(e,t){if(e.trailingComments!=null){let i=0,l=e.trailingComments;for(;i<l.length;){let n=l[i];if(++i,n.isHash)return Ae.trim(n.content)}}if(e.leadingComments!=null){let i=0,l=e.leadingComments;for(;i<l.length;){let n=l[i];if(++i,n.isHash)return Ae.trim(n.content)}}if(t!=null){if(t.trailingComments!=null){let i=0,l=t.trailingComments;for(;i<l.length;){let n=l[i];if(++i,n.isHash)return Ae.trim(n.content)}}if(t.leadingComments!=null){let i=0,l=t.leadingComments;for(;i<l.length;){let n=l[i];if(++i,n.isHash)return Ae.trim(n.content)}}}return null}static randomId(e,t){let i="",l=0,n=t;for(;l<n;){let o=l++,u=p.cca(Mt.randomId_chars,Math.floor(36*((e.seed=e.seed*16807%2147483647)/2147483647+233e-12)));i+=String.fromCodePoint(u)}let s=i,r=!0,h=0,a=s.length;for(;h<a;){let o=h++,u=p.cca(s,o);if(!(u>=48&&u<=57||u>=97&&u<=102)){r=!1;break}}if(r){let o=Math.floor(t*((e.seed=e.seed*16807%2147483647)/2147483647+233e-12)),u=p.cca(Mt.randomId_nonHexChars,Math.floor(Mt.randomId_nonHexChars.length*((e.seed=e.seed*16807%2147483647)/2147483647+233e-12)));s=p.substr(s,0,o)+String.fromCodePoint(u)+p.substr(s,o+1,null)}return s}}j["loreline.AstUtils"]=Yi.loreline.AstUtils=Mt,Mt.__name__="loreline.AstUtils";class il{constructor(e){this.func=e}}j["loreline.Async"]=il,il.__name__="loreline.Async",Object.assign(il.prototype,{__class__:il});class ul{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 Ji{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=Ae.rtrim(e)+`
32
32
  //<END>`,this.input=e,this.index=0,this.output=new Xt,this.lineOutput=new Xt,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(),Ae.rtrim(this.output.b)+`
33
33
  `}toLorelinePos(e,t,i){let l=this.inputPosFromProcessedPos(t),s=this.inputPosFromProcessedPos(i)+1-l;return e.withOffset(this.input,l,s,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,l=this.posOffsets.length;for(;i<l;){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,l=0;for(;this.index<this.length;){let n=p.cca(this.input,this.index),s=n??-1;if(s==34)this.processString();else if(s==39)this.error("Unexpected single quote");else if(s==47){let r=p.cca(this.input,this.index+1),h=r??-1;h==47||h==42?this.processComment():this._add(s,!0)}else if(s==13)this._add(s,!0);else if(s==10)this._add(s,!0);else if(s==123)++t,this._add(s,!0);else if(s==125){if(--t,s==e&&t<0)return;this._add(s,!0)}else if(s==91)++i,this._add(s,!0);else if(s==93){if(--i,s==e&&i<0)return;this._add(s,!0)}else if(s==40)++l,this._add(s,!0);else if(s==41){if(--l,s==e&&l<0)return;this._add(s,!0)}else{let r;if(this.isAlphaNumeric(s)&&this.index>0){let h=p.cca(this.input,this.index-1);r=!this.isAlphaNumeric(h??-1)}else r=!1;if(r)if(s==97){let h,a,o=p.cca(this.input,this.index+1);if((o??-1)==110){let u=p.cca(this.input,this.index+2);a=(u??-1)==100}else a=!1;if(a){let u=p.cca(this.input,this.index+3);h=!this.isAlphaNumeric(u??-1)}else h=!1;h?(this._add(38,!0),this._add(38,!0),this._add(32,!0)):this._add(s,!0)}else if(s==111){let h,a=p.cca(this.input,this.index+1);if((a??-1)==114){let o=p.cca(this.input,this.index+2);h=!this.isAlphaNumeric(o??-1)}else h=!1;h?(this._add(124,!0),this._add(124,!0),this._add(32,!0)):this._add(s,!0)}else this._add(s,!0);else this._add(s,!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=p.cca(this.input,this.index),i=t??-1;if(e)this._add(i,!0),e=!1;else if(i==92)e=!0,this._add(92,!0);else if(i==34){this._add(i,!0),this.inString=!1;return}else if(i==36&&!e){this.index++;let l=p.cca(this.input,this.index);i=l??-1,i==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++):i>=97&&i<=122||i>=65&&i<=90||i==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++):i==36?this._add(36,!0):this.error("Expected identifier or { after $")}else this._add(i,!0)}this.error("Unterminated string")}processComplexInterpolation(){this.processInput(125)}processFieldAccessInterpolation(){let e=p.cca(this.input,this.index),t=e??-1;t>=97&&t<=122||t>=65&&t<=90||t==95||this.error("Expected identifier in field access"),this.processIdentifier();e:for(;this.index<this.length;){let i=p.cca(this.input,this.index);switch(i??-1){case 40:this._add(40,!0),this.processInput(41),this._add(41,!0);break;case 46:let l;if(this.index+1<this.length){let n=p.cca(this.input,this.index+1),s=n??-1;l=s>=97&&s<=122||s>=65&&s<=90||s==95}else l=!1;if(l)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=p.cca(this.input,this.index),t=e??-1;if(!(t>=97&&t<=122||t>=65&&t<=90||t==95||t>=48&&t<=57))break;this._add(t,!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=p.cca(this.input,this.index+1),t=e??-1;if(t==47)for(this._add(32,!0),this._add(32,!0);this.index<this.length;){let i=p.cca(this.input,this.index),l=i??-1;if(l==13||l==10)break;this._add(32,!0)}else if(t==42)for(this._add(32,!0),this._add(32,!0);this.index<this.length;){let i=p.cca(this.input,this.index),l=i??-1,n;if(l==42&&this.index+1<this.length){let s=p.cca(this.input,this.index+1);n=(s??-1)==47}else n=!1;if(n){this._add(32,!0),this._add(32,!0);break}else l==13||l==10?this._add(l,!0):this._add(32,!0)}this.inComment=!1}endsWithChar(e,t){if(e.length==0)return!1;let i=Ae.rtrim(e),l=i.length,n;if(l>0){let s=p.cca(i,l-1);n=(s??-1)==t}else n=!1;return n}followsWithChar(e,t){let i=t,l=!1;for(;i<this.length;){let n=p.cca(this.input,i),s=n??-1;if(s==32||s==9||s==10||s==13){++i;continue}if(s==47&&i+1<this.length){let r=p.cca(this.input,i+1),h=r??-1;if(h==47){for(i+=2;;){let a,o;if(i<this.length){let u=p.cca(this.input,i);o=(u??-1)!=13}else o=!1;if(o){let u=p.cca(this.input,i);a=(u??-1)!=10}else a=!1;if(!a)break;++i}i<this.length&&++i;continue}if(h==42){for(i+=2;i+1<this.length;){let a,o=p.cca(this.input,i);if((o??-1)==42){let u=p.cca(this.input,i+1);a=(u??-1)==47}else a=!1;if(a){i+=2;break}++i}continue}}l=s==e;break}return l}endsOrFollowsWithChar(e,t,i,l){return this.endsWithChar(e,t)?!0:this.followsWithChar(t,i)}nextLineIndentOffset(e,t){let i=Ae.ltrim(e);if(i.length==0)return 0;let l=e.length-i.length,n=-1;for(;t<this.length;){let s=this.input.indexOf(`
34
- `,t);s==-1&&(s=this.length);let r=this.input,h=s!=null?r.substring(t,s):r.substring(t),a=Ae.ltrim(h);if(a.length>0&&(!a.startsWith("//")||a.startsWith("//<END>"))&&!a.startsWith("/*")){let o=h.length-a.length;return a.startsWith("//<END>")&&l==0&&n>0?n-l:o-l}a.length>0&&n==-1&&(n=h.length-a.length),t=s+1}return l==0&&n>0?n-l:0}followsWithIf(e){let t=e;for(;t<this.length;){let i=p.cca(this.input,t),l=i??-1;if(l==32||l==9||l==10||l==13){++t;continue}if(l==47&&t+1<this.length){let r=p.cca(this.input,t+1),h=r??-1;if(h==47){for(t+=2;;){let a,o;if(t<this.length){let u=p.cca(this.input,t);o=(u??-1)!=13}else o=!1;if(o){let u=p.cca(this.input,t);a=(u??-1)!=10}else a=!1;if(!a)break;++t}continue}if(h==42){for(t+=2;t+1<this.length;){let a,o=p.cca(this.input,t);if((o??-1)==42){let u=p.cca(this.input,t+1);a=(u??-1)==47}else a=!1;if(a){t+=2;break}++t}continue}}let n,s;if(t+1<this.length){let r=p.cca(this.input,t);s=(r??-1)==105}else s=!1;if(s){let r=p.cca(this.input,t+1);n=(r??-1)==102}else n=!1;if(n){let r;if(t+2<this.length){let h=p.cca(this.input,t+2);r=!this.isAlphaNumeric(h??-1)}else r=!0;if(r)return!0}return!1}return!1}endsWithControlKeyword(e,t){let i=Ae.rtrim(e);if(i.length==0)return!1;let l=0,n=Ji.CONTROL_KEYWORDS;for(;l<n.length;){let s=n[l];if(++l,i.endsWith(s)){let r=e.length-i.length,h=i.length-s.length,a;if(h!=0){let c=p.cca(i,h-1);a=!this.isAlphaNumeric(c??-1)}else a=!0;let o=t,u;if(o<this.length)if(r<=0){let c=p.cca(this.input,o);u=!this.isAlphaNumeric(c??-1)}else u=!0;else u=!1;if(a&&u&&(s!="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 s=p.cca(e,i),r=s??-1;if(!this.isWhitespace(r))break;--i}if(i<0)return!1;let l=p.cca(e,i),n=l??-1;return n==41||n==125||n==93?!0:this.isAlphaNumeric(n)}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=p.cca(this.input,e),i=t??-1;if(!(i>=97&&i<=122||i>=65&&i<=90||i==95))return!1;let l=e;for(++e;;){let a;if(e<this.length){let o=p.cca(this.input,e),u=o??-1;a=u>=97&&u<=122||u>=65&&u<=90||u==95||u>=48&&u<=57}else a=!1;if(!a)break;++e}for(;;){let a;if(e<this.length){let o=p.cca(this.input,e);a=this.isWhitespace(o??-1)}else a=!1;if(!a)break;++e}let n;if(e<this.length){let a=p.cca(this.input,e);n=(a??-1)!=58}else n=!0;if(n)return!1;let s=this.input,r=e-l;return(r!=null?p.substr(s,l,r):p.substr(s,l,null))!="case"}skipWhitespaceAndComments(e){let t=e,i=!1;for(;e<this.length;){for(;;){let l;if(e<this.length){let n,s,r=p.cca(this.input,e);if((r??-1)!=32){let h=p.cca(this.input,e);s=(h??-1)==9}else s=!0;if(s)n=!0;else{let h=p.cca(this.input,e);n=(h??-1)==10}if(n)l=!0;else{let h=p.cca(this.input,e);l=(h??-1)==13}}else l=!1;if(!l)break;++e,i=!0}if(e<this.length-1){let l=p.cca(this.input,e);if((l??-1)==47){let n=p.cca(this.input,e+1);if((n??-1)==47)return e=t,e;{let s=p.cca(this.input,e+1);if((s??-1)==42){e+=2,i=!0;let r=!1;for(;e<this.length-1;){let h,a=p.cca(this.input,e);if((a??-1)==42){let o=p.cca(this.input,e+1);h=(o??-1)==47}else h=!1;if(h){e+=2,r=!0;break}++e}if(!r)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 Xt,this.inStatementsBlock()||this.inObjectBlock()||this.inArrayBlock()){let l=this.nextLineIndentOffset(i,this.index);if(Ae.trim(i).length!=0)if(l>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=Ae.ltrim(i);n.startsWith("case ")||n.startsWith("case ")||n=="default"||n.startsWith("default ")||n.startsWith("default ")?(this.stack.push(4),this.indentLevel+=l,this.indentStack.push(this.indentLevel),this.currentPosOffset++,this.output.b+=String.fromCodePoint(58),this.posOffsets.push(this.currentPosOffset)):(this.stack.push(3),this.indentLevel+=l,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(l<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+=l;let n=!0;for(;this.indentStack.length>0&&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 s=this.stack.pop();this.indentStack.pop(),s==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 l==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 b.thrown(new ai(e,he.fromContentAndIndex(this.input,this.index)))}}j["loreline.CodeToHscript"]=Ji,Ji.__name__="loreline.CodeToHscript",Object.assign(Ji.prototype,{__class__:Ji});class Si{static equal(e,t,i){return t==i?!0:re.isArray(t)?re.isArray(i)?Si.arrayEqual(e,t,i):!1:t instanceof Ee?i instanceof Ee?Si.stringMapEqual(e,t,i):!1:t instanceof Ri?i instanceof Ri?Si.intMapEqual(e,t,i):!1:le.isFields(t)&&le.isFields(i)?Si.objectFieldsEqual(e,t,i):!1}static objectFieldsEqual(e,t,i){let l=0,n=le.getFields(e,t);for(;l<n.length;){let h=n[l];if(++l,!le.fieldExists(e,i,h)||!Si.equal(e,le.getField(e,t,h),le.getField(e,i,h)))return!1}let s=0,r=le.getFields(e,i);for(;s<r.length;){let h=r[s];if(++s,!le.fieldExists(e,t,h))return!1}return!0}static arrayEqual(e,t,i){let l=re.arrayLength(t),n=re.arrayLength(i);if(l!=n)return!1;let s=0,r=l;for(;s<r;){let h=s++;if(!Si.equal(e,re.arrayGet(t,h),re.arrayGet(i,h)))return!1}return!0}static stringMapEqual(e,t,i){let l=t.h,n=l,s=Object.keys(l),r=s.length,h=0;for(;h<r;){let f=s[h++],m=f,g=n[f],w=m,y=g;if(!Object.prototype.hasOwnProperty.call(i.h,w)||!Si.equal(e,i.h[w],y))return!1}let a=i.h,o=a,u=Object.keys(a),c=u.length,_=0;for(;_<c;){let f=u[_++];if(!Object.prototype.hasOwnProperty.call(t.h,f))return!1}return!0}static intMapEqual(e,t,i){let l=t,n=l,s=l.keys();for(;s.hasNext();){let h=s.next(),a=n.get(h),u=h,c=a;if(!i.h.hasOwnProperty(u)||!Si.equal(e,i.h[u],c))return!1}let r=i.keys();for(;r.hasNext();){let h=r.next();if(!t.h.hasOwnProperty(h))return!1}return!0}}j["loreline.Equal"]=Si,Si.__name__="loreline.Equal";class ai{constructor(e,t){this.message=e,this.pos=t,this.stack=gn.callStack()}toString(){return this.pos!=null?""+this.message+" at "+this.pos.toString():this.message}}j["loreline.Error"]=ai,ai.__name__="loreline.Error",Object.assign(ai.prototype,{__class__:ai});class vi{}j["loreline.Fields"]=Yi.loreline.Fields=vi,vi.__name__="loreline.Fields",vi.__isInterface__=!0,Object.assign(vi.prototype,{__class__:vi});class Bl{constructor(e){this._random=null,this.interpreter=e}bindAll(e){e.h.floor=Te(this,this.floor),e.h.ceil=Te(this,this.ceil),e.h.round=Te(this,this.round),e.h.abs=Te(this,this.abs),e.h.min=Te(this,this.min),e.h.max=Te(this,this.max),e.h.clamp=Te(this,this.clamp),e.h.pow=Te(this,this.pow),e.h.random=Te(this,this.random),e.h.chance=Te(this,this.chance),e.h.seed_random=Te(this,this.seed_random),e.h.random_float=Te(this,this.random_float),e.h.wait=Te(this,this.wait),e.h.float=Te(this,this.float_),e.h.string=Te(this,this.string_),e.h.bool=Te(this,this.bool),e.h.string_length=Te(this,this.string_length),e.h.string_upper=Te(this,this.string_upper),e.h.string_lower=Te(this,this.string_lower),e.h.string_contains=Te(this,this.string_contains),e.h.string_replace=Te(this,this.string_replace),e.h.string_split=Te(this,this.string_split),e.h.string_trim=Te(this,this.string_trim),e.h.string_index=Te(this,this.string_index),e.h.string_sub=Te(this,this.string_sub),e.h.string_starts=Te(this,this.string_starts),e.h.string_ends=Te(this,this.string_ends),e.h.string_repeat=Te(this,this.string_repeat),e.h.plural=Te(this,this.plural),e.h.array_length=Te(this,this.array_length),e.h.array_add=Te(this,this.array_add),e.h.array_pop=Te(this,this.array_pop),e.h.array_prepend=Te(this,this.array_prepend),e.h.array_shift=Te(this,this.array_shift),e.h.array_remove=Te(this,this.array_remove),e.h.array_index=Te(this,this.array_index),e.h.array_has=Te(this,this.array_has),e.h.array_sort=Te(this,this.array_sort),e.h.array_reverse=Te(this,this.array_reverse),e.h.array_join=Te(this,this.array_join),e.h.array_pick=Te(this,this.array_pick),e.h.array_shuffle=Te(this,this.array_shuffle),e.h.array_copy=Te(this,this.array_copy),e.h.map_length=Te(this,this.map_length),e.h.map_keys=Te(this,this.map_keys),e.h.map_has=Te(this,this.map_has),e.h.map_get=Te(this,this.map_get),e.h.map_set=Te(this,this.map_set),e.h.map_remove=Te(this,this.map_remove),e.h.map_copy=Te(this,this.map_copy),e.h.current_beat=Te(this,this.current_beat),e.h.has_beat=Te(this,this.has_beat),e.h.beat_visits=Te(this,this.beat_visits),e.h.choices=Te(this,this.choices),e.h.choices_disabled=Te(this,this.choices_disabled),e.h.choices_all=Te(this,this.choices_all)}rng(){this._random==null&&(this._random=new _l);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 _l(e),null}random_float(e,t){return e+this.rng()*(t-e)}wait(e){return new il(function(t){rl.delay(t,e*1e3|0)})}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":ne.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 Ae.replace(e,t,i)}string_split(e,t){return e.split(t)}string_trim(e){return Ae.trim(e)}string_index(e,t){return e.indexOf(t)}string_sub(e,t,i){return p.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="",l=0;for(;l<t;)i+=e==null?"null":""+e,++l;return i}plural(e,t,i){let l=0;return typeof e=="number"&&(e|0)===e?l=e*1:typeof e=="number"&&(l=e),l==1?t:i}array_length(e){return re.isArray(e)?re.arrayLength(e):0}array_add(e,t){return re.arrayPush(e,t),null}array_pop(e){return re.isArray(e)?re.arrayPop(e):null}array_prepend(e,t){return re.isArray(e)&&re.arrayInsert(e,0,t),null}array_shift(e){return re.isArray(e)?re.arrayShift(e):null}array_remove(e,t){if(re.isArray(e)){let i=re.arrayLength(e),l=0,n=i;for(;l<n;){let s=l++;if(re.arrayGet(e,s)==t)return re.arrayRemoveAt(e,s),!0}}return!1}array_index(e,t){if(re.isArray(e)){let i=re.arrayLength(e),l=0,n=i;for(;l<n;){let s=l++;if(re.arrayGet(e,s)==t)return s}}return-1}array_has(e,t){if(re.isArray(e)){let i=re.arrayLength(e),l=0,n=i;for(;l<n;){let s=l++;if(re.arrayGet(e,s)==t)return!0}}return!1}array_sort(e){return re.isArray(e)&&re.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":ne.string(t))<(i==null?"null":ne.string(i))?-1:(t==null?"null":ne.string(t))>(i==null?"null":ne.string(i))?1:0}),e}array_reverse(e){return re.isArray(e)&&re.arrayReverse(e),e}array_join(e,t){return re.isArray(e)?re.arrayJoin(e,t):""}array_pick(e){if(re.isArray(e)){let t=re.arrayLength(e);if(t==0)return null;let i=Math.floor(this.rng()*t);return re.arrayGet(e,i)}return null}array_shuffle(e){if(re.isArray(e)){let t=re.arrayLength(e)-1;for(;t>0;){let i=Math.floor(this.rng()*(t+1)),l=re.arrayGet(e,t);re.arraySet(e,t,re.arrayGet(e,i)),re.arraySet(e,i,l),--t}}return e}array_copy(e){return re.isArray(e)?re.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,l){return i<l?-1:i>l?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),l=0;for(;l<t.length;){let n=t[l];++l,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;--e}return null}has_beat(e){if(e instanceof Me)return!0;let t=e,i=this.interpreter.stack.length-1;for(;i>=0;){let l=this.interpreter.stack[i];if(l.beat!=null&&l.beat.body!=null){let n=0,s=l.beat.body;for(;n<s.length;){let r=s[n];if(++n,r instanceof Me&&r.name==t)return!0}}--i}return Object.prototype.hasOwnProperty.call(this.interpreter.topLevelBeats.h,t)}beat_visits(e){if(e==null){let t=this.interpreter.stack.length-1;for(;t>=0;){let i=this.interpreter.stack[t];if(i.beat!=null)return this.interpreter.getBeatVisitCount(i.beat);--t}return 0}else{if(e instanceof Me)return this.interpreter.getBeatVisitCount(e);{let t=this.interpreter.resolveBeatByName(e);return t==null?0:this.interpreter.getBeatVisitCount(t)}}}choices(){let e=this.interpreter._choiceEvalTexts,t=this.interpreter._choiceEvalEnabled,i=[],l=0,n=e.length;for(;l<n;){let s=l++;t[s]&&i.push(e[s])}return i}choices_disabled(){let e=this.interpreter._choiceEvalTexts,t=this.interpreter._choiceEvalEnabled,i=[],l=0,n=e.length;for(;l<n;){let s=l++;t[s]||i.push(e[s])}return i}choices_all(){let e=this.interpreter._choiceEvalTexts,t=[],i=0,l=e.length;for(;i<l;){let n=i++;t.push(e[n])}return t}}j["loreline.Functions"]=Bl,Bl.__name__="loreline.Functions",Object.assign(Bl.prototype,{__class__:Bl});var Oi=Qe["loreline._HscriptInterp.Stop"]={__ename__:"loreline._HscriptInterp.Stop",__constructs__:null,SBreak:{_hx_name:"SBreak",_hx_index:0,__enum__:"loreline._HscriptInterp.Stop",toString:S},SContinue:{_hx_name:"SContinue",_hx_index:1,__enum__:"loreline._HscriptInterp.Stop",toString:S},SReturn:{_hx_name:"SReturn",_hx_index:2,__enum__:"loreline._HscriptInterp.Stop",toString:S}};Oi.__constructs__=[Oi.SBreak,Oi.SContinue,Oi.SReturn];class Ll{constructor(e){this.interpreter=e,this.locals=new Ee,this.declared=[],this.resetVariables(),this.initOps()}resetVariables(){this.variables=new Ee,this.variables.h.null=null,this.variables.h.true=!0,this.variables.h.false=!1;let e=this,t=this.variables,i=We.makeVarArgs(function(l){let n=e.posInfos(),s=l.shift();l.length>0&&(n.customParams=l),Il.trace(ne.string(s),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 Ee,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 l=e.expr(t),n=e.expr(i);return l>=n},this.binops.h["<="]=function(t,i){let l=e.expr(t),n=e.expr(i);return l<=n},this.binops.h[">"]=function(t,i){let l=e.expr(t),n=e.expr(i);return l>n},this.binops.h["<"]=function(t,i){let l=e.expr(t),n=e.expr(i);return l<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["="]=Te(this,this.assign),this.binops.h["..."]=function(t,i){return new Ol(e.expr(t),e.expr(i))},this.binops.h.is=function(t,i){return te.__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 b.thrown("Invalid assign");return t}assign(e,t){let i=this.expr(t),l=e.e;switch(l._hx_index){case 1:let n=l.v,s=this.locals.h[n];s==null?this.setVar(n,i):s.r=i;break;case 5:let r=l.e,h=l.f;i=this.set(this.expr(r),h,i);break;case 16:let a=l.e,o=l.index,u=this.expr(a),c=this.expr(o);re.isArray(u)?re.arraySet(u,c,i):le.isFields(u)?le.setField(this.interpreter,u,c,i):te.__implements(u,kt)?te.__cast(u,kt).set(c,i):u[c]=i;break;default:let _=new Ce(be.EInvalidOp("="),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw b.thrown(_)}return i}assignOp(e,t){let i=this;this.binops.h[e]=function(l,n){return i.evalAssignOp(e,t,l,n)}}evalAssignOp(e,t,i,l){let n,s=i.e;switch(s._hx_index){case 1:let r=s.v,h=this.locals.h[r];n=t(this.expr(i),this.expr(l)),h==null?this.setVar(r,n):h.r=n;break;case 5:let a=s.e,o=s.f,u=this.expr(a);n=t(this.get(u,o),this.expr(l)),n=this.set(u,o,n);break;case 16:let c=s.e,_=s.index,f=this.expr(c),m=this.expr(_);re.isArray(f)?(n=t(re.arrayGet(f,m),this.expr(l)),re.arraySet(f,m,n)):le.isFields(f)?(n=t(le.getField(this.interpreter,f,m),this.expr(l)),le.setField(this.interpreter,f,m,n)):te.__implements(f,kt)?(n=t(te.__cast(f,kt).get(m),this.expr(l)),te.__cast(f,kt).set(m,n)):(n=t(f[m],this.expr(l)),f[m]=n);break;default:let g=new Ce(be.EInvalidOp(e),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw b.thrown(g)}return n}increment(e,t,i){this.curExpr=e;let l=e.e;switch(l._hx_index){case 1:let n=l.v,s=this.locals.h[n],r=s==null?this.resolve(n):s.r;return t?(r+=i,s==null?this.setVar(n,r):s.r=r):s==null?this.setVar(n,r+i):s.r=r+i,r;case 5:let h=l.e,a=l.f,o=this.expr(h),u=this.get(o,a);return t?(u+=i,this.set(o,a,u)):this.set(o,a,u+i),u;case 16:let c=l.e,_=l.index,f=this.expr(c),m=this.expr(_);if(re.isArray(f)){let w=re.arrayGet(f,m);return t?(w+=i,re.arraySet(f,m,w)):re.arraySet(f,m,w+i),w}else if(le.isFields(f)){let w=le.getField(this.interpreter,f,m);return t?(w+=i,le.setField(this.interpreter,f,m,w)):le.setField(this.interpreter,f,m,w+i),w}else if(te.__implements(f,kt)){let w=te.__cast(f,kt).get(m);return t?(w+=i,te.__cast(f,kt).set(m,w)):te.__cast(f,kt).set(m,w+i),w}else{let w=f[m];return t?(w+=i,f[m]=w):f[m]=w+i,w}break;default:let g=new Ce(be.EInvalidOp(i>0?"++":"--"),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw b.thrown(g)}}execute(e){return this.depth=0,this.locals=new Ee,this.declared=[],this.exprReturn(e)}exprReturn(e){try{return this.expr(e)}catch(t){let i=b.caught(t).unwrap();if(te.__instanceof(i,Oi))switch(i._hx_index){case 0:throw b.thrown("Invalid break");case 1:throw b.thrown("Invalid continue");case 2:let n=this.returnValue;return this.returnValue=null,n}else throw t}}duplicate(e){let t=new Ee,i=e.h,l=i,n=Object.keys(i),s=n.length,r=0;for(;r<s;){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 b.thrown(i)}rethrow(e){throw b.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=this.interpreter.resolveBeatByName(e);if(i!=null)return i;let l=new Ce(be.EUnknownVariable(e),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw b.thrown(l)}return t}expr(e){this.curExpr=e;let t=e.e,i=this;switch(t._hx_index){case 0:let l=t.c;switch(l._hx_index){case 0:return l.v;case 1:return l.f;case 2:return l.s}break;case 1:let n=t.v,s=this.locals.h[n];return s!=null?s.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,u=a==null?null:this.expr(a);return o.h[h]={r:u},null;case 3:let c=t.e;return this.expr(c);case 4:let _=t.e,f=this.declared.length,m=null,g=0;for(;g<_.length;){let ye=_[g];++g,m=this.expr(ye)}return this.restore(f),m;case 5:let w=t.e,y=t.f;return this.get(this.expr(w),y);case 6:let T=t.op,E=t.e1,C=t.e2,P=this.binops.h[T];if(P==null){let ye=new Ce(be.EInvalidOp(T),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw b.thrown(ye)}return P(E,C);case 7:let I=t.op,v=t.prefix,F=t.e;switch(I){case"!":return this.expr(F)!=!0;case"++":return this.increment(F,v,1);case"-":return-this.expr(F);case"--":return this.increment(F,v,-1);case"~":return~this.expr(F);default:let ye=new Ce(be.EInvalidOp(I),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw b.thrown(ye)}break;case 8:let B=t.e,A=t.params,L=[],z=0;for(;z<A.length;){let ye=A[z];++z,L.push(this.expr(ye))}let D=B.e;if(D._hx_index==5){let ye=D.e,lt=D.f,ct=this.expr(ye);if(ct==null){let rt=new Ce(be.EInvalidAccess(lt),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw b.thrown(rt)}return this.fcall(ct,lt,L)}else return this.call(null,this.expr(B),L);break;case 9:let O=t.cond,q=t.e1,M=t.e2;return this.expr(O)==!0?this.expr(q):M==null?null:this.expr(M);case 10:let U=t.cond,K=t.e;return this.whileLoop(U,K),null;case 11:let G=t.v,Y=t.it,$=t.e;return this.forLoop(G,Y,$),null;case 12:throw b.thrown(Oi.SBreak);case 13:throw b.thrown(Oi.SContinue);case 14:let se=t.ret,ue=t.args,oe=t.e,ge=t.name,me=this.duplicate(this.locals),de=this,Oe=!1,Ve=0,je=0;for(;je<ue.length;){let ye=ue[je];++je,ye.opt||ye.value!=null?Oe=!0:Ve+=1}let et=function(ye){if((ye==null?0:ye.length)!=ue.length){if(ye.length<Ve){let Qi="Invalid number of parameters. Got "+ye.length+", required "+Ve;ge!=null&&(Qi+=" for function '"+ge+"'");let rn=new Ce(be.ECustom(Qi),i.curExpr.pmin,i.curExpr.pmax,i.curExpr.origin,i.curExpr.line);throw b.thrown(rn)}let Jt=[],wt=ye.length-Ve,Ql=0,fl=0;for(;fl<ue.length;){let Qi=ue[fl];++fl,Qi.opt||Qi.value!=null?wt>0?(Jt.push(ye[Ql++]),--wt):Jt.push(Qi.value!=null?de.expr(Qi.value):null):Jt.push(ye[Ql++])}ye=Jt}let lt=de.locals,ct=de.depth;de.depth++,de.locals=de.duplicate(me);let rt=0,dt=ue.length;for(;rt<dt;){let Jt=rt++;de.locals.h[ue[Jt].name]={r:ye[Jt]}}let xt=null,St=i.declared.length;if(i.inTry)try{xt=de.exprReturn(oe)}catch(Jt){let wt=b.caught(Jt).unwrap();throw i.restore(St),de.locals=lt,de.depth=ct,b.thrown(wt)}else xt=de.exprReturn(oe);return i.restore(St),de.locals=lt,de.depth=ct,xt},Ue=We.makeVarArgs(et);if(ge!=null)if(this.depth==0)this.variables.h[ge]=Ue;else{this.declared.push({n:ge,old:this.locals.h[ge]});let ye={r:Ue};this.locals.h[ge]=ye,me.h[ge]=ye}return Ue;case 15:let Ge=t.e;throw this.returnValue=Ge==null?null:this.expr(Ge),b.thrown(Oi.SReturn);case 16:let nt=t.e,De=t.index,H=this.expr(nt),ie=this.expr(De);return re.isArray(H)?re.arrayGet(H,ie):le.isFields(H)?le.getField(this.interpreter,H,ie):te.__implements(H,kt)?te.__cast(H,kt).get(ie):H[ie];case 17:let R=t.e,ee;if(R.length>0){let ye=R[0].e;if(ye._hx_index==6){let lt=ye.e1,ct=ye.e2;ee=ye.op=="=>"}else ee=!1}else ee=!1;if(ee){let ye=[],lt=[],ct=0;for(;ct<R.length;){let rt=R[ct];++ct;let dt=rt.e;if(dt._hx_index==6)if(dt.op=="=>"){let xt=dt.e1,St=dt.e2;ye.push(this.expr(xt)),lt.push(this.expr(St))}else{this.curExpr=rt;let xt=new Ce(be.ECustom("Invalid map key=>value expression"),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw b.thrown(xt)}else{this.curExpr=rt;let xt=new Ce(be.ECustom("Invalid map key=>value expression"),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw b.thrown(xt)}}return this.makeMap(ye,lt)}else{let ye=[],lt=0;for(;lt<R.length;){let ct=R[lt];++lt,ye.push(this.expr(ct))}return ye}break;case 18:let X=t.cl,Q=t.params,ae=[],_e=0;for(;_e<Q.length;){let ye=Q[_e];++_e,ae.push(this.expr(ye))}return this.cnew(X,ae);case 19:let xe=t.e;throw b.thrown(this.expr(xe));case 20:let Ye=t.t,gt=t.e,Be=t.v,_t=t.ecatch,ve=this.declared.length,Pe=this.inTry;try{this.inTry=!0;let ye=this.expr(gt);return this.restore(ve),this.inTry=Pe,ye}catch(ye){let lt=b.caught(ye).unwrap();if(te.__instanceof(lt,Oi)){let ct=lt;throw this.inTry=Pe,b.thrown(ct)}else{let ct=lt;this.restore(ve),this.inTry=Pe,this.declared.push({n:Be,old:this.locals.h[Be]}),this.locals.h[Be]={r:ct};let rt=this.expr(_t);return this.restore(ve),rt}}break;case 21:let ot=t.fl,tt=le.createFields(this.interpreter),bt=0;for(;bt<ot.length;){let ye=ot[bt];++bt,le.setField(this.interpreter,tt,ye.name,this.expr(ye.e))}return tt;case 22:let Kt=t.cond,ft=t.e1,li=t.e2;return this.expr(Kt)==!0?this.expr(ft):this.expr(li);case 23:let $e=t.e,Bt=t.cases,It=t.defaultExpr,Lt=this.expr($e),mt=!1,Vt=0;for(;Vt<Bt.length;){let ye=Bt[Vt];++Vt;let lt=0,ct=ye.values;for(;lt<ct.length;){let rt=ct[lt];if(++lt,this.expr(rt)==Lt){mt=!0;break}}if(mt){Lt=this.expr(ye.expr);break}}return mt||(Lt=It==null?null:this.expr(It)),Lt;case 24:let Ht=t.cond,Ut=t.e;return this.doWhileLoop(Ht,Ut),null;case 25:let ni=t.name,si=t.args,jt=t.e;return this.expr(jt);case 26:let it=t.t,ki=t.e;return this.expr(ki)}}doWhileLoop(e,t){let i=this.declared.length,l=this;do{let n=!0;try{l.expr(t)}catch(s){let r=b.caught(s).unwrap();if(te.__instanceof(r,Oi)){let h=r;switch(h._hx_index){case 0:n=!1;break;case 1:break;case 2:throw b.thrown(h)}}else throw s}if(!n)break}while(this.expr(e)==!0);this.restore(i)}whileLoop(e,t){let i=this.declared.length,l=this;for(;this.expr(e)==!0;){let n=!0;try{l.expr(t)}catch(s){let r=b.caught(s).unwrap();if(te.__instanceof(r,Oi)){let h=r;switch(h._hx_index){case 0:n=!1;break;case 1:break;case 2:throw b.thrown(h)}}else throw s}if(!n)break}this.restore(i)}makeIterator(e){if(e instanceof Array)return new Ti(e);if(re.isArray(e))return re.getIterator(e);if(e.iterator!=null&&(e=fn(e)),e.hasNext==null||e.next==null){let t=new Ce(be.EInvalidIterator(e),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw b.thrown(t)}return e}forLoop(e,t,i){let l=this.declared.length;this.declared.push({n:e,old:this.locals.h[e]});let n=this.makeIterator(this.expr(t)),s=this;for(;n.hasNext();){let r=this.locals,h={r:n.next()};r.h[e]=h;let a=!0;try{s.expr(i)}catch(o){let u=b.caught(o).unwrap();if(te.__instanceof(u,Oi)){let c=u;switch(c._hx_index){case 0:a=!1;break;case 1:break;case 2:throw b.thrown(c)}}else throw o}if(!a)break}this.restore(l)}loopRun(e){let t=!0;try{e()}catch(i){let l=b.caught(i).unwrap();if(te.__instanceof(l,Oi)){let n=l;switch(n._hx_index){case 0:t=!1;break;case 1:break;case 2:throw b.thrown(n)}}else throw i}return t}isMap(e){return te.__implements(e,kt)}getMapValue(e,t){return te.__cast(e,kt).get(t)}setMapValue(e,t,i){te.__cast(e,kt).set(t,i)}makeMap(e,t){let i=!0,l=!0,n=!0,s=!0,r=0;for(;r<e.length;){let a=e[r];++r,i=i&&typeof a=="string",l=l&&typeof a=="number"&&(a|0)===a,n=n&&We.isObject(a),s=s&&We.isEnumValue(a)}if(l){let a=new Ri,o=0,u=e;for(;o<u.length;){let c=u[o],f=o++,m=c;a.h[m]=t[f]}return a}if(i){let a=new Ee,o=0,u=e;for(;o<u.length;){let c=u[o],f=o++,m=c;a.h[m]=t[f]}return a}if(s){let a=new Xi,o=0,u=e;for(;o<u.length;){let c=u[o],f=o++,m=c;a.set(m,t[f])}return a}if(n){let a=new gl,o=0,u=e;for(;o<u.length;){let c=u[o],f=o++,m=c;a.set(m,t[f])}return a}let h=new Ce(be.ECustom("Invalid map keys "+ne.string(e)),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw b.thrown(h)}get(e,t){if(e==null){let i=new Ce(be.EInvalidAccess(t),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw b.thrown(i)}return le.isFields(e)?le.getField(this.interpreter,e,t):We.getProperty(e,t)}set(e,t,i){if(e==null){let l=new Ce(be.EInvalidAccess(t),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw b.thrown(l)}return le.isFields(e)?(le.setField(this.interpreter,e,t,i),i):(We.setProperty(e,t,i),i)}fcall(e,t,i){let l=null;return typeof e=="string"?l=le.getStringHelper(this.interpreter,t):re.isArray(e)?l=le.getArrayHelper(this.interpreter,t):e instanceof Me?l=le.getBeatHelper(this.interpreter,t):le.isFields(e)&&(l=le.getMapHelper(this.interpreter,t)),l!=null&&We.isFunction(l)?(i.splice(0,0,e),this.call(null,l,i)):this.call(e,this.get(e,t),i)}call(e,t,i){return t.apply(e,i)}cnew(e,t){let i=j[e];return i==null&&(i=this.resolve(e)),pe.createInstance(i,t)}}j["loreline.HscriptInterp"]=Ll,Ll.__name__="loreline.HscriptInterp",Object.assign(Ll.prototype,{__class__:Ll});class Al{constructor(e){this.finished=e}}j["loreline._Imports.ImportsLoopInfo"]=Al,Al.__name__="loreline._Imports.ImportsLoopInfo",Object.assign(Al.prototype,{__class__:Al});class Dl{constructor(){this.ext=".lor",this.pendingImports=0,this.hasErrors=!1,this.done=null,this.resolvedImports=null,this.autoAddExtension=!0}resolve(e,t,i,l,n){this.rootPath=e,this.tokens=t,this.handleFile=i,this.handleError=l,this.done=n,this.hasErrors=!1,this.pendingImports=0,e!=null&&e.endsWith(".lor.txt")&&(this.ext=".lor.txt");let s=new Ee,r=[],h=new Ee,a=Nt.directory(e);this.extractImports(a,t,r,h),this.processImports(r,h,s)}processImports(e,t,i){let l=new Al(!1);for(;e.length>0;){let n=e.shift();this.handleItemInLoop(n,l,e,t,i)}l.finished=!0,this.pendingImports==0&&this.done!=null&&(this.resolvedImports=i,this.done(this.hasErrors,i),this.done=null)}handleItemInLoop(e,t,i,l,n){let s=this;this.handleFile(e,function(r){if(s.pendingImports--,r!=null)try{let h=new yt(r),a=h.tokenize(),o=h.getErrors();o!=null&&o.length>0&&s.handleError(o[0]),n.h[e]=a,s.extractImports(Nt.directory(e),a,i,l),t.finished&&s.processImports(i,l,n)}catch(h){let a=b.caught(h).unwrap();if(s.hasErrors=!0,a instanceof ai)s.handleError(a);else throw b.thrown(a)}else s.hasErrors=!0;t.finished&&s.pendingImports==0&&s.done!=null&&(s.resolvedImports=n,s.done(s.hasErrors,n),s.done=null)})}extractImports(e,t,i,l){let n=0,s=t.length;for(;n<s-1;){if(t[n].type==x.KwImport){let r=t[n+1].type;if(r._hx_index==15){let h=r.quotes,a=r.attachments,o=r.s,u=o;Nt.isAbsolute(o)||(u=Nt.join([e,u])),u=Nt.normalize(u),u.toLowerCase().endsWith(this.ext)||(u+=this.ext),Object.prototype.hasOwnProperty.call(l.h,u)||(this.pendingImports++,l.h[u]=!0,i.push(u))}}++n}}}j["loreline.Imports"]=Dl,Dl.__name__="loreline.Imports",Object.assign(Dl.prototype,{__class__:Dl});class wi{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 l=0,n=e.length;for(;l<n;){let s=l++;i[s]!=null&&this._set(e[s],t[s],i[s])}}}resize(e){let t=this._keys1,i=this._keys2,l=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,s=t.length;for(;n<s;){let r=n++;l[r]!=null&&this._set(t[r],i[r],l[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 l=0,n=e.length;for(;l<n;){let s=l++;i[s]!=null&&this._set(e[s],t[s],i[s])}}this.size=0}copy(){let e=new wi,t=this._keys1,i=new Array(t.length);ln.blit(t,0,i,0,t.length),e._keys1=i;let l=this._keys2,n=new Array(l.length);ln.blit(l,0,n,0,l.length),e._keys2=n;let s=this._values,r=new Array(s.length);return ln.blit(s,0,r,0,s.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 u=0,c=h.length;for(;u<c;){let _=u++;o[_]!=null&&this._set(h[_],a[_],o[_])}}}let l=e+(t<<16);l=(l^l>>>16)*-2048144789,l=(l^l>>>13)*-1028477387;let s=(l^l>>>16)&this.mask;for(;;){if(this._values[s]==null){this._keys1[s]=e,this._keys2[s]=t,this._values[s]=i,this.size++;return}if(this._keys1[s]==e&&this._keys2[s]==t){this._values[s]=i;return}s=s+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 s=this._keys1[n],r=this._keys2[n],h=this._values[n];this._values[n]=null,this.size--,this._set(s,r,h),n=n+1&this.mask}return!0}n=n+1&this.mask}}iterator(){return new Rl(this)}keyIterator(){return new Vl(this)}keyValueIterator(){return new Ul(this)}length(){return this.size}}j["loreline.Int64Map"]=wi,wi.__name__="loreline.Int64Map",Object.assign(wi.prototype,{__class__:wi});class Rl{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}}j["loreline._Int64Map.Int64MapIterator"]=Rl,Rl.__name__="loreline._Int64Map.Int64MapIterator",Object.assign(Rl.prototype,{__class__:Rl});class Vl{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}}}j["loreline._Int64Map.Int64MapKeyIterator"]=Vl,Vl.__name__="loreline._Int64Map.Int64MapKeyIterator",Object.assign(Vl.prototype,{__class__:Vl});class Ul{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}}}j["loreline._Int64Map.Int64MapKeyValueIterator"]=Ul,Ul.__name__="loreline._Int64Map.Int64MapKeyValueIterator",Object.assign(Ul.prototype,{__class__:Ul});class Ii{constructor(e,t,i,l){this.scope=-1,i!=null?this.fields=i:this.clear(e,t),l!=null?this.originalFields=l:this.createOriginalFields()}clear(e,t){this.fields=le.createFields(e,null,t)}createOriginalFields(){this.originalFields=le.createFields()}}j["loreline.RuntimeState"]=Ii,Ii.__name__="loreline.RuntimeState",Object.assign(Ii.prototype,{__class__:Ii});class cl extends Ii{constructor(e,t,i,l){super(e,t,i,l)}}j["loreline.RuntimeCharacter"]=cl,cl.__name__="loreline.RuntimeCharacter",cl.__super__=Ii,Object.assign(cl.prototype,{__class__:cl});var fi=Qe["loreline.RuntimeAccess"]={__ename__:"loreline.RuntimeAccess",__constructs__:null,FieldAccess:(d=function(k,e,t){return{_hx_index:0,pos:k,obj:e,name:t,__enum__:"loreline.RuntimeAccess",toString:S}},d._hx_name="FieldAccess",d.__params__=["pos","obj","name"],d),ArrayAccess:(d=function(k,e,t){return{_hx_index:1,pos:k,array:e,index:t,__enum__:"loreline.RuntimeAccess",toString:S}},d._hx_name="ArrayAccess",d.__params__=["pos","array","index"],d),CharacterAccess:(d=function(k,e){return{_hx_index:2,pos:k,name:e,__enum__:"loreline.RuntimeAccess",toString:S}},d._hx_name="CharacterAccess",d.__params__=["pos","name"],d),FunctionAccess:(d=function(k,e){return{_hx_index:3,pos:k,name:e,__enum__:"loreline.RuntimeAccess",toString:S}},d._hx_name="FunctionAccess",d.__params__=["pos","name"],d),BeatAccess:(d=function(k,e){return{_hx_index:4,pos:k,beat:e,__enum__:"loreline.RuntimeAccess",toString:S}},d._hx_name="BeatAccess",d.__params__=["pos","beat"],d)};fi.__constructs__=[fi.FieldAccess,fi.ArrayAccess,fi.CharacterAccess,fi.FunctionAccess,fi.BeatAccess];class pl{constructor(e,t,i,l,n,s,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,l!=null&&(this.beats=l),n!=null&&(this.state=n),s!=null&&(this.head=s),r!=null&&(this.insertion=r)}beatByName(e){if(this.beats==null)return null;let t=0,i=this.beats.length;for(;t<i;){let l=t++,n=this.beats[l];if(n.name==e)return n}return null}}j["loreline.RuntimeScope"]=pl,pl.__name__="loreline.RuntimeScope",Object.assign(pl.prototype,{__class__:pl});class wl{constructor(e,t){this.parentNextOptionIndex=0,this.parentPartialOptions=null,this.stack=[],this.options=null,this.id=e,this.origin=t}}j["loreline.RuntimeInsertion"]=wl,wl.__name__="loreline.RuntimeInsertion",Object.assign(wl.prototype,{__class__:wl});class kl{constructor(e,t,i){this.closing=e,this.value=t,this.offset=i}}j["loreline.TextTag"]=kl,kl.__name__="loreline.TextTag",Object.assign(kl.prototype,{__class__:kl});class yl{constructor(e,t,i,l,n){this.text=e,this.tags=t,this.enabled=i,this.node=l,this.insertion=n}}j["loreline.ChoiceOption"]=yl,yl.__name__="loreline.ChoiceOption",Object.assign(yl.prototype,{__class__:yl});class fe extends ai{constructor(e,t){super(e,t)}}j["loreline.RuntimeError"]=fe,fe.__name__="loreline.RuntimeError",fe.__super__=ai,Object.assign(fe.prototype,{__class__:fe});class ql{constructor(){this.cb=null,this.sync=!0}}j["loreline.EvalNext"]=ql,ql.__name__="loreline.EvalNext",Object.assign(ql.prototype,{__class__:ql});class bl{constructor(e,t,i,l,n){this._choiceEvalEnabled=[],this._choiceEvalTexts=[],this.pendingChoiceOptions=null,this.beatToResume=null,this.finishTrigger=null,this.flushing=!1,this.syncCallbacks=[],this.nextInsertionId=1,this.nextScopeId=1,this.stack=[],this.stringLiteralProcessors=[],this.beatHelpers=new Ee,this.mapHelpers=new Ee,this.arrayHelpers=new Ee,this.stringHelpers=new Ee,this.topLevelFunctions=new Ee,this.nodeStates=new Gi,this.topLevelBeats=new Ee,this.topLevelCharacters=new Ee,this.script=e,this.handleDialogue=t,this.handleChoice=i,this.handleFinish=l,this.lens=new Kl(e);let s=n!=null?n.strictAccess:null;this.strictAccess=s!=null&&s,this.translations=n!=null?n.translations:null,this.topLevelState=new Ii(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(te.getClass(h)){case Me:this.initializeTopLevelBeat(h);break;case zt:this.initializeTopLevelCharacter(h);break;case Li:this.initializeTopLevelFunction(h);break;case Wt: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 b.thrown(new fe("Beat "+e+" not found",this.script.pos))}else{let i=0,l=this.script.body;for(;i<l.length;){let n=l[i];if(++i,n instanceof Me){let s=n;if(s.name=="_"){t=s;break}t==null&&(t=s)}}if(t==null){let n=this.script.iterator();for(;n.hasNext();){let s=n.next();if(s instanceof Me){let r=s;if(r.name=="_"){t=r;break}t==null&&(t=r)}}}if(t==null)throw b.thrown(new fe("No beats found in script",this.script.pos))}this.transitionToBeat(t),this.flush()}save(){let e={},t=[],i=0,l=this.stack;for(;i<l.length;){let s=l[i];++i,t.push(this.serializeScope(s,e))}let n={version:1,stack:t,state:this.serializeState(this.topLevelState),characters:this.serializeCharacters(),nodeStates:this.serializeNodeStates()};if(this.pendingChoiceOptions!=null){let s=[],r=0,h=this.pendingChoiceOptions;for(;r<h.length;){let a=h[r];++r,s.push(this.serializeChoiceOption(a,e))}n.pendingChoiceOptions=s}if(this._choiceEvalTexts.length>0){let s=[],r=0,h=this._choiceEvalTexts.length;for(;r<h;){let a=r++,o={text:this._choiceEvalTexts[a]};this._choiceEvalEnabled[a]||(o.disabled=!0),s.push(o)}n.choiceEvalContext=s}return We.fields(e).length>0&&(n.insertions=e),n}restore(e){if(e.version!=1)throw b.thrown(new fe("Unsupported save version: "+e.version,this.script.pos));this.stack.length=0,this.nodeStates.map.clear(),this.nextScopeId=1,this.nextInsertionId=1,this.pendingChoiceOptions=null,this._choiceEvalTexts.length=0,this._choiceEvalEnabled.length=0,this.restoreState(this.topLevelState,e.state),this.restoreCharacters(e.characters),this.restoreNodeStates(e.nodeStates);let t=new Ri;if(this.restoreStack(e.stack,e.insertions,t)||(this.beatToResume=this.restoreBeatToResume(e.stack)),e.pendingChoiceOptions!=null){this.pendingChoiceOptions=[];let i=0,l=e.pendingChoiceOptions;for(;i<l.length;){let n=l[i];++i;let s=this.restoreChoiceOption(n,e.insertions,t);s!=null&&this.pendingChoiceOptions.push(s)}}if(e.choiceEvalContext!=null){this._choiceEvalTexts.length=0,this._choiceEvalEnabled.length=0;let i=0,l=e.choiceEvalContext;for(;i<l.length;){let n=l[i];++i,this._choiceEvalTexts.push(n.text),this._choiceEvalEnabled.push(n.disabled!=!0)}}}resume(){if(this.stack.length==0){this.start();return}let e=this.wrapNext(Te(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.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],l=i!=null?i.fields:null;return l!=null?le.getField(this,l,t):null}setCharacterField(e,t,i){let l=this.topLevelCharacters.h[e].fields;le.setField(this,l,t,i)}getStateField(e){let t=this.stack.length-1;for(;t>=0;){let i=this.stack[t];if(i.state!=null&&le.fieldExists(this,i.state.fields,e))return le.getField(this,i.state.fields,e);if(i.node!=null){let l=i.node.id.thisVal,n=this.nodeStates.map._get(l.high,l.low);if(n!=null&&le.fieldExists(this,n.fields,e))return le.getField(this,n.fields,e)}--t}return le.fieldExists(this,this.topLevelState.fields,e)?le.getField(this,this.topLevelState.fields,e):null}setStateField(e,t){let i=this.stack.length-1;for(;i>=0;){let l=this.stack[i];if(l.state!=null&&le.fieldExists(this,l.state.fields,e)){le.setField(this,l.state.fields,e,t);return}if(l.node!=null){let n=l.node.id.thisVal,s=this.nodeStates.map._get(n.high,n.low);if(s!=null&&le.fieldExists(this,s.fields,e)){le.setField(this,s.fields,e,t);return}}--i}le.setField(this,this.topLevelState.fields,e,t)}getTopLevelStateField(e){return le.getField(this,this.topLevelState.fields,e)}setTopLevelStateField(e,t){le.setField(this,this.topLevelState.fields,e,t)}currentNode(){let e=this.get_currentScope();return e==null?null:e.head!=null?e.head:e.node}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 l=[],n=0,s=e.beats;for(;n<s.length;){let r=s[n];++n,l.push(this.serializeBeatReference(r))}i.beats=l}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,l=We.field(t,i);if(l==null){if(l={},t[i]=l,e.options!=null){let n=[],s=0,r=e.options;for(;s<r.length;){let h=r[s];++s,n.push(this.serializeChoiceOption(h,t))}l.options=n}if(e.origin!=null&&(l.origin=this.serializeNodeReference(e.origin)),e.stack!=null){let n=[],s=0,r=e.stack;for(;s<r.length;){let h=r[s];++s,n.push(this.serializeScope(h,t))}l.stack=n}if(e.parentPartialOptions!=null){let n=[],s=0,r=e.parentPartialOptions;for(;s<r.length;){let h=r[s];++s,n.push(this.serializeChoiceOption(h,t))}l.parentPartialOptions=n,l.parentNextOptionIndex=e.parentNextOptionIndex}}return e.id}serializeChoiceOption(e,t){let i={text:e.text};if(e.enabled||(i.disabled=!0),e.tags!=null){let l=[],n=0,s=e.tags;for(;n<s.length;){let r=s[n];++n,l.push(this.serializeTextTag(r))}i.tags=l}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,l=Object.keys(t),n=l.length,s=0;for(;s<n;){let r=l[s++],h=r,a=i[r],o=h,u=a,c=this.serializeCharacter(u);We.fields(c.fields).length>0&&(e[o]=c)}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 l=t._keys1[i],n=t._keys2[i],s=t._values[i];for(++i;i<t._values.length&&t._values[i]==null;)++i;let r=Re.fromTwoInt32(l,n),h=s,a=r,o=h,u=this.serializeState(o);We.fields(u.fields).length>0&&(e[a.toString()]=u)}return e}serializeBeatReference(e){let t=e.name,i=e;do i=this.lens.getFirstParentOfType(i,Me),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,l={};if(te.__implements(e,vi)){let n=te.getClass(e);n!=null&&(i=n.__name__);let s=e,r=0,h=s.lorelineFields(this);for(;r<h.length;){let a=h[r];++r,l[a]=this.serializeValue(s.lorelineGet(this,a))}}else if(e instanceof Ee){let n=e,s=n.h,r=s,h=Object.keys(s),a=h.length,o=0;for(;o<a;){let u=h[o++],c=n.h[u];(t==null||!le.fieldExists(this,t,u)||!Si.equal(this,le.getField(this,t,u),c))&&(l[u]=this.serializeValue(c))}}else{let n=te.getClass(e);n!=null&&(i=n.__name__);let s=0,r=We.fields(e);for(;s<r.length;){let h=r[s];++s;let a=We.getProperty(e,h);(t==null||!le.fieldExists(this,t,h)||!Si.equal(this,le.getField(this,t,h),a))&&(l[h]=this.serializeValue(a))}}return i!=null?{type:i,fields:l}:{fields:l}}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(re.isArray(e)){let t=[],i=re.arrayLength(e),l=0,n=i;for(;l<n;){let s=l++;t.push(this.serializeValue(re.arrayGet(e,s)))}return t}return this.serializeFields(e)}resumeNode(e,t,i){let l=this.stack.length-1;if(t>=this.stack.length)switch(te.getClass(e)){case Ui:this.evalAlternative(e,i);break;case Rt:if(!this.isBeatCall(e))this.evalCall(e,i);else{let r=te.getClass(e);throw b.thrown(new fe("Resume execution not supported from last node: "+r.__name__,e.pos))}break;case mi:this.evalChoice(e,i);break;case ti:this.evalDialogue(e,i);break;case ui:this.evalText(e,i);break;default:let s=te.getClass(e);throw b.thrown(new fe("Resume execution not supported from last node: "+s.__name__,e.pos))}else switch(te.getClass(e)){case Ui:this.resumeAlternative(e,t,i);break;case Me:this.resumeBeatRun(e,t,i);break;case Rt:if(this.isBeatCall(e,t))this.resumeCall(e,t,i);else{let r=te.getClass(e);throw b.thrown(new fe("Resume execution not supported from node within stack: "+r.__name__,e.pos))}break;case Et:this.resumeChoiceOption(e,t,i);break;case mi:this.resumeChoice(e,t,i);break;case gi:this.resumeIf(e,t,i);break;default:let s=te.getClass(e);throw b.thrown(new fe("Resume execution not supported from node within stack: "+s.__name__,e.pos))}}resumeNodeBody(e,t,i,l){let n=this.stack[t],s=0,r=-1;if(n.head==null&&t<this.stack.length-1)throw b.thrown(new fe("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&&(s=i.indexOf(n.head),r=s,s==-1))throw b.thrown(new fe("Failed to resolve head in scope when resuming through body",e.pos));let h=this.get_currentInsertion(),a=null,o=this;a=function(){if((h!=null?h.options:null)!=null)o.pop(),l();else if(s!=-1&&s==r){let u=i[s];s+=1;let c=o.wrapNext(a);o.resumeNode(u,t+1,c.cb),c.sync=!1}else if(s<i.length){let u=i[s];n.head=u,s+=1;let c=o.wrapNext(a);o.evalNode(u,c.cb),c.sync=!1}else o.pop(),l()},a()}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 l=this.stack[t],n=this;if(l.head==null)this.evalChoice(e,i);else if(l.head instanceof Et){let s=l.head;t+1<this.stack.length?this.resumeNodeBody(s,t+1,s.body,i):this.evalNodeBody(l.beat,s,s.body,null,i)}else if(l.insertion!=null){let s=l.node,r=l.insertion;if(s instanceof Me){let h=s;this.resumeNodeBody(h,t,h.body,function(){let a=r.parentPartialOptions!=null?r.parentPartialOptions:[];if(r.options!=null){let _=0,f=r.options;for(;_<f.length;){let m=f[_];++_,a.push(m)}}let o=r.parentNextOptionIndex,u=l.beat,c=n.wrapNext(function(){n.presentChoice(e,a,i)});n.evalChoiceOptionsAndInsertions(u,e,a,c.cb,o),c.sync=!1})}else{for(;this.stack.length>t;)this.pop();this.evalChoice(e,i)}}else if(l.node instanceof Et){let s=l.node;this.resumeNodeBody(s,t,s.body,i)}else if(l.node instanceof Me){let s=l.node;this.resumeNodeBody(s,t,s.body,i)}else throw b.thrown(new fe("Choice head is not a choice option",l.head.pos))}resumeIf(e,t,i){let l=this.stack[t];if(l.head==null)throw b.thrown(new fe("Failed to resolve head in scope when resuming through condition",e.pos));let s=e.thenBranch.body.indexOf(l.head)!=-1?e.thenBranch:e.elseBranch;if(s!=null&&s.body.length>0)this.resumeNodeBody(s,t,s.body,i);else throw b.thrown(new fe("Failed to resume condition: invalid scope",e.pos))}resumeAlternative(e,t,i){let l=this.stack[t];if(l.head==null)throw b.thrown(new fe("Failed to resolve head when resuming alternative",e.pos));let n=0,s=e.items;for(;n<s.length;){let r=s[n];if(++n,r.body.indexOf(l.head)!=-1){this.resumeNodeBody(r,t,r.body,i);return}}throw b.thrown(new fe("Failed to resume alternative: head not found in any item",e.pos))}resumeCall(e,t,i){if(e.target instanceof ut){let l=e.target;if(l.target==null){let n=l.name,s=null,r=this.stack.length-1;for(;r>=0;){let a=this.stack[r].beatByName(n);if(a!=null){s=a;break}--r}if(s==null&&Object.prototype.hasOwnProperty.call(this.topLevelBeats.h,n)&&(s=this.topLevelBeats.h[n]),s!=null){this.resumeBeatRun(s,t,i);return}}}throw b.thrown(new fe("Cannot resume through a function call that is not at the bottom of the stack",e.pos))}restoreStack(e,t,i){let l=[];i==null&&(i=new Ri);let n=e.length-1;for(;n>=0;){let s=this.restoreScopeItem(e[n],t,i);if(s==null)return!1;l.push(s),--n}for(n=l.length-1;n>=0;)this.push(l[n]),--n;return!0}restoreScopeItem(e,t,i){let l=this.restoreBeat(e.beat);if(l==null)return null;let n=Re.fromString(e.beat.id),s=e.node,r=s!=null?this.restoreNode(s,n,l):null;if(s!=null&&r==null)return null;let h=[];if(e.beats!=null){let f=0,m=e.beats;for(;f<m.length;){let g=m[f];++f;let w=this.restoreBeat(g);if(w==null)return null;h.push(w)}}let o=e.state!=null?this.restoreState(null,e.state):null,u=e.head,c=u!=null?this.restoreNode(u,n,l):null;if(u!=null&&c==null)return null;let _=null;return e.insertion!=null&&t!=null&&(_=this.restoreInsertion(e.insertion,t,i)),new pl(null,l,r,h,o,c,_)}restoreInsertion(e,t,i){if(i.h.hasOwnProperty(e))return i.h[e];let l=e==null?"null":""+e,n=We.field(t,l);if(n==null)return null;let s=null;if(n.origin!=null){let h=Re.fromString(n.origin.id),a=this.lens.getNodeById(h);a!=null&&a.type()==n.origin.type&&(s=a)}let r=new wl(e,s);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 u=this.restoreChoiceOption(o,t,i);u!=null&&r.options.push(u)}}if(n.stack!=null){r.stack=[];let h=0,a=n.stack;for(;h<a.length;){let o=a[h];++h;let u=this.restoreScopeItem(o,t,i);u!=null&&r.stack.push(u)}}if(n.parentPartialOptions!=null){r.parentPartialOptions=[];let h=0,a=n.parentPartialOptions;for(;h<a.length;){let o=a[h];++h;let u=this.restoreChoiceOption(o,t,i);u!=null&&r.parentPartialOptions.push(u)}r.parentNextOptionIndex=n.parentNextOptionIndex!=null?n.parentNextOptionIndex:0}return r}restoreChoiceOption(e,t,i){let l=null;if(e.node!=null){let r=Re.fromString(e.node.id),h=this.lens.getNodeById(r);h!=null&&h.type()==e.node.type&&(l=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 kl(o.closing==!0,o.value,o.offset))}n=r}let s=null;return e.insertion!=null&&t!=null&&(s=this.restoreInsertion(e.insertion,t,i)),new yl(e.text,n,e.disabled!=!0,l,s)}restoreBeatToResume(e){let t=null;if(e.length>0){let i=e[0];if(t=this.restoreBeat(i.beat),t!=null){let l=t;do l=this.lens.getFirstParentOfType(l,Me),l!=null&&(t=l);while(l!=null)}}return t}restoreNode(e,t,i){let l=i.id.thisVal.high>>16&65535,n=t.thisVal.high>>16&65535,s=(l>=32768?l-65536:l)+32768-((n>=32768?n-65536:n)+32768),r=Re.fromString(e.id);if(r==t)return i;let h=r.thisVal.high>>16&65535,o=(h>=32768?h-65536:h)+32768+s-32768;o<0&&(o=o+65536&65535),r.thisVal=new Di(r.thisVal.high&65535|o<<16,r.thisVal.low);let u=this.lens.getNodeById(r);return u!=null&&u.type()==e.type?u:null}restoreBeat(e){return this.lens.findBeatByPathFromNode(e.path,this.script)}restoreState(e,t){let i=e!=null?e.fields:null,l=this.restoreFields(i??null,t);return e==null&&(e=new Ii(this,null,l,null)),e}restoreCharacters(e){let t=0,i=We.fields(e);for(;t<i.length;){let l=i[t];++t;let n=We.field(e,l);if(Object.prototype.hasOwnProperty.call(this.topLevelCharacters.h,l))this.restoreCharacter(this.topLevelCharacters.h[l],n);else{let s=this.restoreCharacter(null,n);this.topLevelCharacters.h[l]=s}}}restoreNodeStates(e){let t=0,i=We.fields(e);for(;t<i.length;){let l=i[t];++t;let n=Re.fromString(l),s=We.field(e,l),r=this.restoreState(null,s),h=n.thisVal;this.nodeStates.map._set(h.high,h.low,r)}}restoreCharacter(e,t){let i=e!=null?e.fields:null,l=this.restoreFields(i??null,t);return e==null&&(e=new cl(this,null,l,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 l=0,n=We.fields(i);for(;l<n.length;){let s=n[l];++l,le.setField(this,e,s,this.restoreValue(We.field(i,s)))}}else{let l=0,n=We.fields(i);for(;l<n.length;){let s=n[l];++l,e[s]=this.restoreValue(We.field(i,s))}}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(re.isArray(e)){let t=re.arrayLength(e),i=re.createArray(),l=0,n=t;for(;l<n;){let s=l++;re.arrayPush(i,this.restoreValue(re.arrayGet(e,s)))}return i}return this.restoreFields(null,e)}initializeTopLevelFunctions(e){if(this.builtins=new Bl(this),this.builtins.bindAll(this.topLevelFunctions),e!=null){let r=e,h=r,a=We.fields(r),o=0;for(;o<a.length;){let u=a[o++],c=h[u],f=u,m=c;this.topLevelFunctions.h[f]=m}}let t=this.topLevelFunctions.h,i=t,l=Object.keys(t),n=l.length,s=0;for(;s<n;){let r=l[s++],h=r,a=i[r],o=h,u=a;o.startsWith("string_")?this.stringHelpers.h[p.substr(o,7,null)]=u:o.startsWith("array_")?this.arrayHelpers.h[p.substr(o,6,null)]=u:o.startsWith("map_")?this.mapHelpers.h[p.substr(o,4,null)]=u:o.startsWith("beat_")&&(this.beatHelpers.h[p.substr(o,5,null)]=u)}}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 l=e[i];++i,this.stringLiteralProcessors.push(l)}}}initializeTopLevelFunction(e){if(e.name!=null){if(!e.external||!Object.prototype.hasOwnProperty.call(this.topLevelFunctions.h,e.name)){let t=new Ji;try{let i=t.process(e.code+(e.external?" {}":"")),l=new tl;l.allowJSON=!0,l.allowTypes=!0;let n=l.parseString(i),r=new Ll(this).execute(n);this.topLevelFunctions.h[e.name]=r}catch(i){let l=b.caught(i).unwrap();throw b.thrown(new fe("Failed to parse function code: "+(l==null?"null":ne.string(l)),e.pos))}}}else throw b.thrown(new fe("Top level function must have a name",e.pos))}wrapNext(e){let t=new ql;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=b.caught(e).unwrap();throw this.flushing=!1,b.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 b.thrown(new fe("Top level temporary states are not allowed",e.pos));let t=0,i=e.fields;for(;t<i.length;){let l=i[t];++t;let n=this.evaluateExpression(l.value);le.setField(this,this.topLevelState.fields,l.name,n),this.isOriginalScriptExpression(l.value)&&le.setField(this,this.topLevelState.originalFields,l.name,n)}}initializeTopLevelBeat(e){if(Object.prototype.hasOwnProperty.call(this.topLevelBeats.h,e.name))throw b.thrown(new fe("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 b.thrown(new fe("Duplicate top level character: "+e.name,e.pos));let t=new cl(this,e,null,null);this.topLevelCharacters.h[e.name]=t;let i=0,l=e.fields;for(;i<l.length;){let n=l[i];++i;let s=this.evaluateExpression(n.value);le.setField(this,t.fields,n.name,s),this.isOriginalScriptExpression(n.value)&&le.setField(this,t.originalFields,n.name,s)}}initializeState(e,t){let i=null;if(e.temporary)t.state==null&&(t.state=new Ii(this,e,null,null)),i=t.state;else{let s=t.node.id.thisVal;if(i=this.nodeStates.map._get(s.high,s.low),i==null){i=new Ii(this,e,null,null);let r=t.node.id.thisVal;this.nodeStates.map._set(r.high,r.low,i)}}let l=0,n=e.fields;for(;l<n.length;){let s=n[l];if(++l,!le.fieldExists(this,i.fields,s.name)){let r=this.evaluateExpression(s.value);le.setField(this,i.fields,s.name,r),!e.temporary&&this.isOriginalScriptExpression(s.value)&&le.setField(this,i.originalFields,s.name,r)}}}finish(){this.finishTrigger=null,this.handleFinish!=null&&this.handleFinish(this)}transitionToBeat(e){for(;this.pop(););this.nextScopeId=1,this.nextInsertionId=1,this.pendingChoiceOptions=null,this._choiceEvalTexts.length=0,this._choiceEvalEnabled.length=0;let t=this.wrapNext(Te(this,this.finish));this.finishTrigger=t,this.evalBeatRun(e,t.cb),t.sync=!1}evalNode(e,t){switch(te.getClass(e)){case Ui:this.evalAlternative(e,t);break;case di:this.evalAssignment(e,t);break;case Me:this.evalBeatDecl(e,t);break;case Rt:this.evalCall(e,t);break;case Et:this.evalChoiceOption(e,t);break;case mi:this.evalChoice(e,t);break;case ti:this.evalDialogue(e,t);break;case gi:this.evalIf(e,t);break;case Wt:this.evalStateDecl(e,t);break;case ui:this.evalText(e,t);break;case Mi:this.evalTransition(e);break;default:let i=te.getClass(e);throw b.thrown(new fe("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 b.thrown(new fe("Duplicate beat with name: "+e.name,e.pos));this.get_currentScope().beats.push(e),t()}evalNodeBody(e,t,i,l,n){this.push(new pl(null,e,t,null,null,null,l));let s=0,r=null,h=this.get_currentInsertion(),a=this;r=function(){if((h!=null?h.options:null)!=null)a.pop(),n();else if(s<i.length){let o=i[s];a.get_currentScope().head=o,s+=1;let u=a.wrapNext(r);a.evalNode(o,u.cb),u.sync=!1}else a.pop(),n()},r()}evalBeatRun(e,t){this.incrementBeatVisitCount(e),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),l=this.evaluateString(i);this.handleDialogue(this,null,l.text,l.tags,t)}evalDialogue(e,t){if(e.condition!=null&&!this.evaluateCondition(e.condition)){t();return}let i=this.getTranslatedString(e,e.content),l=this.evaluateString(i);this.handleDialogue(this,e.character,l.text,l.tags,t)}evalChoice(e,t){let i=this.pendingChoiceOptions;if(i!=null){this.pendingChoiceOptions=null,this._choiceEvalTexts.length=0,this._choiceEvalEnabled.length=0;let r=0;for(;r<i.length;){let h=i[r];++r,this._choiceEvalTexts.push(h.text),this._choiceEvalEnabled.push(h.enabled)}this.presentChoice(e,i,t);return}let l=[],n=this,s=this.wrapNext(function(){n.presentChoice(e,l,t)});this.evalChoiceOptionsAndInsertions(this.get_currentScope().beat,e,l,s.cb),s.sync=!1}presentChoice(e,t,i){let l=this.get_currentInsertion();if(l!=null&&l.options==null){l.stack=[].concat(this.stack),l.options=t,i();return}let n=0,s=e.options;for(;n<s.length;){let u=s[n];if(++n,u.insertion!=null){this.pendingChoiceOptions=t;break}}let r=-1,h=this,a=function(){h._choiceEvalTexts.length=0,h._choiceEvalEnabled.length=0},o=this.wrapNext(function(){if(h.pendingChoiceOptions=null,r>=0&&r<t.length){let u=t[r];u.node.once&&h.setChoiceOptionChosen(u.node);let c=function(){a(),i()};if(u.insertion!=null){let _=h.stack.length;for(;h.stack.length>0;)h.stack.pop();let f=0,m=u.insertion.stack;for(;f<m.length;){let w=m[f];++f,w.insertion!=null&&(w.insertion=null),h.stack.push(w)}let g=h.stack[h.stack.length-1];h.push(new pl(null,g.beat,h.lens.getParentNode(u.node),null,null,u.node,null)),h.resumeFromLevel(_,c)}else h.evalChoiceOption(u.node,c)}else a(),i()});this.handleChoice(this,t,function(u){r=u,o.cb()}),o.sync=!1}evalChoiceOptionsAndInsertions(e,t,i,l,n){let s=t.options;this._choiceEvalTexts.length=0,this._choiceEvalEnabled.length=0;let r=n??0,h=null,a=null,o=this;h=function(){if(a!=null&&a.options!=null){let u=0,c=a.options.length;for(;u<c;){let _=u++,f=a.options[_];i.push(f),o._choiceEvalTexts.push(f.text),o._choiceEvalEnabled.push(f.enabled)}a=null}if(r<s.length){let u=s[r];r+=1;let _=!(u.once&&o.isChoiceOptionChosen(u))&&(u.condition==null||o.evaluateCondition(u.condition));if(u.text!=null){let f=o.wrapNext(h),m=o.getTranslatedString(u,u.text),g=o.evaluateString(m);i.push(new yl(g.text,g.tags,_,u,o.get_currentInsertion())),o._choiceEvalTexts.push(g.text),o._choiceEvalEnabled.push(_),f.cb(),f.sync=!1}else if(u.insertion!=null){let f=o.wrapNext(h);_?(a=new wl(o.nextInsertionId++,u.insertion),a.parentPartialOptions=[].concat(i),a.parentNextOptionIndex=r,o.evalInsertion(a,f.cb)):f.cb(),f.sync=!1}else throw b.thrown(new fe("Invalid choice option",u.pos))}else l()},h()}evalInsertion(e,t){let i=e.origin.target,l=null,n=this.stack.length-1;for(;n>=0;){let r=this.stack[n].beatByName(i);if(r!=null){l=r;break}--n}if(l==null&&Object.prototype.hasOwnProperty.call(this.topLevelBeats.h,i)&&(l=this.topLevelBeats.h[i]),l==null)throw b.thrown(new fe("Beat "+i+" not found",this.script.pos));this.evalNodeBody(l,l,l.body,e,t)}evalChoiceOption(e,t){this.evalNodeBody(this.get_currentScope().beat,e,e.body,null,t)}evalIf(e,t){let l=this.evaluateCondition(e.condition)?e.thenBranch:e.elseBranch;l!=null&&l.body.length>0?this.evalNodeBody(this.get_currentScope().beat,l,l.body,null,t):t()}evalAlternative(e,t){if(e.items.length==0){t();return}switch(e.mode){case 0:let i=this.getAlternativeVisitCount(e),l=i<e.items.length?i:e.items.length-1;this.setAlternativeVisitCount(e,i+1);let n=e.items[l];this.evalNodeBody(this.get_currentScope().beat,n,n.body,null,t);break;case 1:let s=this.getAlternativeVisitCount(e),r=s%e.items.length;this.setAlternativeVisitCount(e,s+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 u=this.builtins.random(0,e.items.length-1),c=e.items[u];this.evalNodeBody(this.get_currentScope().beat,c,c.body,null,t);break;case 4:let _=[],f=0,m=e.items.length;for(;f<m;){let y=f++;_.push(y)}let g=_,w=g.length-1;for(;w>0;){let y=this.builtins.random(0,w),T=g[w];g[w]=g[y],g[y]=T,--w}this.evalShuffledItems(e,g,0,t);break}}evalShuffledItems(e,t,i,l){if(i>=t.length){l();return}let n=e.items[t[i]],s=this;this.evalNodeBody(this.get_currentScope().beat,n,n.body,null,function(){s.evalShuffledItems(e,t,i+1,l)})}getBeatVisitCount(e){let t=e.id.thisVal,i=this.nodeStates.map._get(t.high,t.low);if(i==null)return 0;let l=le.getField(this,i.fields,"_visitCount");return l??0}incrementBeatVisitCount(e){let t=e.id.thisVal,i=this.nodeStates.map._get(t.high,t.low);if(i==null){i=new Ii(this,e,null,null);let s=e.id.thisVal;this.nodeStates.map._set(s.high,s.low,i)}let l=le.getField(this,i.fields,"_visitCount"),n=l??0;le.setField(this,i.fields,"_visitCount",n+1)}getAlternativeVisitCount(e){let t=e.id.thisVal,i=this.nodeStates.map._get(t.high,t.low);if(i==null)return 0;let l=le.getField(this,i.fields,"_visitCount");return l??0}setAlternativeVisitCount(e,t){let i=e.id.thisVal,l=this.nodeStates.map._get(i.high,i.low);if(l==null){l=new Ii(this,e,null,null);let n=e.id.thisVal;this.nodeStates.map._set(n.high,n.low,l)}le.setField(this,l.fields,"_visitCount",t)}isChoiceOptionChosen(e){let t=e.id.thisVal,i=this.nodeStates.map._get(t.high,t.low);if(i==null)return!1;let l=le.getField(this,i.fields,"_chosen");return l??!1}setChoiceOptionChosen(e){let t=e.id.thisVal,i=this.nodeStates.map._get(t.high,t.low);if(i==null){i=new Ii(this,e,null,null);let l=e.id.thisVal;this.nodeStates.map._set(l.high,l.low,i)}le.setField(this,i.fields,"_chosen",!0)}evalAssignment(e,t){let i=this.resolveAssignmentTarget(e.target),l=this.evaluateExpression(e.value),n;switch(e.op._hx_index){case 21:n=this.performOperation(x.OpPlus,this.readAccess(i),l,e.pos);break;case 22:n=this.performOperation(x.OpMinus,this.readAccess(i),l,e.pos);break;case 23:n=this.performOperation(x.OpMultiply,this.readAccess(i),l,e.pos);break;case 24:n=this.performOperation(x.OpDivide,this.readAccess(i),l,e.pos);break;case 20:case 25:n=l;break;default:throw b.thrown(new fe("Invalid assignment operator",e.pos))}this.writeAccess(i,n),t()}isOriginalScriptExpression(e){switch(te.getClass(e)){case Qt:let t=e;return this.isOriginalScriptExpression(t.left)?this.isOriginalScriptExpression(t.right):!1;case ut:case ci:case Rt:return!1;case Ke:let i=e,l=i.literalType;switch(l._hx_index){case 0:case 1:case 2:return!0;case 3:let a=i.value,o=0;for(;o<a.length;){let f=a[o];if(++o,f instanceof at&&!this.isOriginalScriptExpression(f))return!1}return!0;case 4:let u=l.style,c=i.value,_=0;for(;_<c.length;){let f=c[_];if(++_,!this.isOriginalScriptExpression(f.value))return!1}return!0}break;case Tt:let n=e,s=0,r=n.parts;for(;s<r.length;){let a=r[s];++s;let o=a.partType;switch(o._hx_index){case 0:let u=o.text;continue;case 1:let c=o.expr;return!1;case 2:let _=o.closing,f=o.expr;if(!this.isOriginalScriptExpression(f))return!1;break}}return!0;case Ki:let h=e;return this.isOriginalScriptExpression(h.operand)}return!1}isBeatCall(e,t){return t==null&&(t=-1),e instanceof Rt?this.resolveBeatFromCall(e,t)!=null:!1}resolveBeatByName(e,t){t==null&&(t=-1);let i=t==-1?this.stack.length-1:t;for(;i>=0;){let l=this.stack[i].beatByName(e);if(l!=null)return l;--i}return this.topLevelBeats.h[e]}resolveBeatFromCall(e,t){if(t==null&&(t=-1),e.target instanceof ut){let i=e.target;if(i.target==null){let l=this.resolveBeatByName(i.name,t);if(l!=null)return l}}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,l=this.stack.length-1;for(;l>=0;){let s=this.stack[l].beatByName(t);if(s!=null){i=s;break}--l}if(i==null&&Object.prototype.hasOwnProperty.call(this.topLevelBeats.h,t)&&(i=this.topLevelBeats.h[t]),i==null)throw b.thrown(new fe("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 l=this.translations.h[i];if(l!=null)return l}}return t}findHashCommentId(e,t){return Mt.findHashComment(e,t)}evaluateString(e){let t=0,i=this.stringLiteralProcessors.length;for(;t<i;){let f=t++;e=this.stringLiteralProcessors[f](e)}let l="",n=[],s=0,r=e.parts.length,h=e.quotes!=0,a=e.quotes!=0,o=e.quotes!=0,u=-1;if(!h){let f=r-1;e:for(;f>=0;){let g=e.parts[f].partType;switch(g._hx_index){case 0:let w=g.text;u=f;break e;case 1:let y=g.expr;break e;case 2:let T=g.closing,E=g.expr;--f;break}}}let c=0,_=r;for(;c<_;){let f=c++,g=e.parts[f].partType;switch(g._hx_index){case 0:let w=g.text;h||(w=Ae.ltrim(w)),f==u&&(w=Ae.rtrim(w)),o||(w=this.stripStringComments(w)),a||(w=this.stripStringIndent(w));let y=w.length;y>0&&(h=!0);let T=!1,E=!1,C=!1,P=0,I=y;for(;P<I;){let L=P++,z=p.cca(w,L),D=z??-1;C?(D==110?l+=String.fromCodePoint(10):D==114?l+=String.fromCodePoint(13):D==116?l+=String.fromCodePoint(9):l+=String.fromCodePoint(D),C=!1,T=!1,E=!1):D==92?(C=!0,T=!1,E=!1):D==36?(T?(l+=String.fromCodePoint(D),T=!1):T=!0,E=!1):D==35?(E?(l+=String.fromCodePoint(D),E=!1):E=!0,T=!1):(E&&(l+=String.fromCodePoint(35),E=!1),l+=String.fromCodePoint(D))}E&&(l+=String.fromCodePoint(35)),s+=y;break;case 1:let v=g.expr;if(h=!0,v instanceof ut){let L=v,z=this.resolveAccess(L,L.target,L.name);if(z._hx_index==2){let D=z.pos,O=z.name,q=this.evaluateExpression(v),M=le.getField(this,q,"name"),U=M??O,K=this.valueToString(U);s+=K.length,l+=K==null?"null":""+K}else{let D=this.evaluateExpression(v),O=this.valueToString(D);s+=O.length,l+=O==null?"null":""+O}}else{let L=this.evaluateExpression(v),z=this.valueToString(L);s+=z.length,l+=z==null?"null":""+z}break;case 2:let F=g.closing,B=g.expr,A=this.evaluateString(B).text;n.push(new kl(F,A,s));break}}return{text:l,tags:n}}pluralPipeProcess(e){let t=-1,i=!1,l=null,n=0,s=e.parts.length;for(;n<s;){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 f,m=e.parts[t].partType;if(m._hx_index==1?f=m.expr:f=null,f!=null){if(!i){let g=[],w=0,y=r;for(;w<y;){let T=w++;g.push(e.parts[T])}l=g,i=!0}this.transformPipeRaw(o,f,h.pos,l);continue}}break;case 1:let u=a.expr;t=r;break;case 2:let c=a.closing,_=a.expr;break}i&&l.push(h)}return i?new Tt(e.id,e.pos,e.quotes,l):e}rawTextHasUnescapedPipe(e){let t=e.length,i=0;for(;i<t;){let l=p.cca(e,i),n=l??-1;if(n==92){i+=2;continue}if(n==124)return!0;++i}return!1}transformPipeRaw(e,t,i,l){let n=e.length,s=0,r=0;for(;s<n;){let h=p.cca(e,s),a=h??-1;if(a==92&&s+1<n){s+=2;continue}if(a==40){let o=-1,u=-1,c=s+1;for(;c<n;){let _=p.cca(e,c),f=_??-1;if(f==92&&c+1<n){c+=2;continue}if(f==124&&o==-1)o=c;else if(f==41){u=c;break}++c}if(o!=-1&&u!=-1&&o>s+1&&u>o+1){let _=s+1,f=o-s-1,m=f!=null?p.substr(e,_,f):p.substr(e,_,null),g=o+1,w=u-o-1,y=w!=null?p.substr(e,g,w):p.substr(e,g,null);if(s>r){let T=s-r;l.push(new Je(Re.UNDEFINED,i,ze.Raw(T!=null?p.substr(e,r,T):p.substr(e,r,null))))}l.push(new Je(Re.UNDEFINED,i,ze.Expr(this.makePluralCall(t,m,y,i)))),s=u+1,r=s;continue}}if(a==124){let o=s;for(;o>r;){let w=p.cca(e,o-1),y=w??-1;if(y==32||y==9||y==10||y==124||y==40||y==41)break;--o}let u=s+1;for(;u<n;){let w=p.cca(e,u),y=w??-1;if(y==32||y==9||y==10||y==124||y==40||y==41)break;++u}let c=s-o,_=c!=null?p.substr(e,o,c):p.substr(e,o,null),f=s+1,m=u-s-1,g=m!=null?p.substr(e,f,m):p.substr(e,f,null);if(_.length>0&&g.length>0){if(o>r){let w=o-r;l.push(new Je(Re.UNDEFINED,i,ze.Raw(w!=null?p.substr(e,r,w):p.substr(e,r,null))))}l.push(new Je(Re.UNDEFINED,i,ze.Expr(this.makePluralCall(t,_,g,i)))),s=u,r=s;continue}}++s}if(r<n){let h=n-r;l.push(new Je(Re.UNDEFINED,i,ze.Raw(h!=null?p.substr(e,r,h):p.substr(e,r,null))))}}makePluralCall(e,t,i,l){let n=new ut(Re.UNDEFINED,l,null,"plural"),s=new Tt(Re.UNDEFINED,l,1,[new Je(Re.UNDEFINED,l,ze.Raw(t))]),r=new Tt(Re.UNDEFINED,l,1,[new Je(Re.UNDEFINED,l,ze.Raw(i))]);return new Rt(Re.UNDEFINED,l,n,[e,s,r])}stripStringIndent(e){if(e.indexOf(`
34
+ `,t);s==-1&&(s=this.length);let r=this.input,h=s!=null?r.substring(t,s):r.substring(t),a=Ae.ltrim(h);if(a.length>0&&(!a.startsWith("//")||a.startsWith("//<END>"))&&!a.startsWith("/*")){let o=h.length-a.length;return a.startsWith("//<END>")&&l==0&&n>0?n-l:o-l}a.length>0&&n==-1&&(n=h.length-a.length),t=s+1}return l==0&&n>0?n-l:0}followsWithIf(e){let t=e;for(;t<this.length;){let i=p.cca(this.input,t),l=i??-1;if(l==32||l==9||l==10||l==13){++t;continue}if(l==47&&t+1<this.length){let r=p.cca(this.input,t+1),h=r??-1;if(h==47){for(t+=2;;){let a,o;if(t<this.length){let u=p.cca(this.input,t);o=(u??-1)!=13}else o=!1;if(o){let u=p.cca(this.input,t);a=(u??-1)!=10}else a=!1;if(!a)break;++t}continue}if(h==42){for(t+=2;t+1<this.length;){let a,o=p.cca(this.input,t);if((o??-1)==42){let u=p.cca(this.input,t+1);a=(u??-1)==47}else a=!1;if(a){t+=2;break}++t}continue}}let n,s;if(t+1<this.length){let r=p.cca(this.input,t);s=(r??-1)==105}else s=!1;if(s){let r=p.cca(this.input,t+1);n=(r??-1)==102}else n=!1;if(n){let r;if(t+2<this.length){let h=p.cca(this.input,t+2);r=!this.isAlphaNumeric(h??-1)}else r=!0;if(r)return!0}return!1}return!1}endsWithControlKeyword(e,t){let i=Ae.rtrim(e);if(i.length==0)return!1;let l=0,n=Ji.CONTROL_KEYWORDS;for(;l<n.length;){let s=n[l];if(++l,i.endsWith(s)){let r=e.length-i.length,h=i.length-s.length,a;if(h!=0){let c=p.cca(i,h-1);a=!this.isAlphaNumeric(c??-1)}else a=!0;let o=t,u;if(o<this.length)if(r<=0){let c=p.cca(this.input,o);u=!this.isAlphaNumeric(c??-1)}else u=!0;else u=!1;if(a&&u&&(s!="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 s=p.cca(e,i),r=s??-1;if(!this.isWhitespace(r))break;--i}if(i<0)return!1;let l=p.cca(e,i),n=l??-1;return n==41||n==125||n==93?!0:this.isAlphaNumeric(n)}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=p.cca(this.input,e),i=t??-1;if(!(i>=97&&i<=122||i>=65&&i<=90||i==95))return!1;let l=e;for(++e;;){let a;if(e<this.length){let o=p.cca(this.input,e),u=o??-1;a=u>=97&&u<=122||u>=65&&u<=90||u==95||u>=48&&u<=57}else a=!1;if(!a)break;++e}for(;;){let a;if(e<this.length){let o=p.cca(this.input,e);a=this.isWhitespace(o??-1)}else a=!1;if(!a)break;++e}let n;if(e<this.length){let a=p.cca(this.input,e);n=(a??-1)!=58}else n=!0;if(n)return!1;let s=this.input,r=e-l;return(r!=null?p.substr(s,l,r):p.substr(s,l,null))!="case"}skipWhitespaceAndComments(e){let t=e,i=!1;for(;e<this.length;){for(;;){let l;if(e<this.length){let n,s,r=p.cca(this.input,e);if((r??-1)!=32){let h=p.cca(this.input,e);s=(h??-1)==9}else s=!0;if(s)n=!0;else{let h=p.cca(this.input,e);n=(h??-1)==10}if(n)l=!0;else{let h=p.cca(this.input,e);l=(h??-1)==13}}else l=!1;if(!l)break;++e,i=!0}if(e<this.length-1){let l=p.cca(this.input,e);if((l??-1)==47){let n=p.cca(this.input,e+1);if((n??-1)==47)return e=t,e;{let s=p.cca(this.input,e+1);if((s??-1)==42){e+=2,i=!0;let r=!1;for(;e<this.length-1;){let h,a=p.cca(this.input,e);if((a??-1)==42){let o=p.cca(this.input,e+1);h=(o??-1)==47}else h=!1;if(h){e+=2,r=!0;break}++e}if(!r)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 Xt,this.inStatementsBlock()||this.inObjectBlock()||this.inArrayBlock()){let l=this.nextLineIndentOffset(i,this.index);if(Ae.trim(i).length!=0)if(l>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=Ae.ltrim(i);n.startsWith("case ")||n.startsWith("case ")||n=="default"||n.startsWith("default ")||n.startsWith("default ")?(this.stack.push(4),this.indentLevel+=l,this.indentStack.push(this.indentLevel),this.currentPosOffset++,this.output.b+=String.fromCodePoint(58),this.posOffsets.push(this.currentPosOffset)):(this.stack.push(3),this.indentLevel+=l,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(l<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+=l;let n=!0;for(;this.indentStack.length>0&&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 s=this.stack.pop();this.indentStack.pop(),s==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 l==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 b.thrown(new ai(e,he.fromContentAndIndex(this.input,this.index)))}}j["loreline.CodeToHscript"]=Ji,Ji.__name__="loreline.CodeToHscript",Object.assign(Ji.prototype,{__class__:Ji});class Si{static equal(e,t,i){return t==i?!0:re.isArray(t)?re.isArray(i)?Si.arrayEqual(e,t,i):!1:t instanceof Ee?i instanceof Ee?Si.stringMapEqual(e,t,i):!1:t instanceof Ri?i instanceof Ri?Si.intMapEqual(e,t,i):!1:ne.isFields(t)&&ne.isFields(i)?Si.objectFieldsEqual(e,t,i):!1}static objectFieldsEqual(e,t,i){let l=0,n=ne.getFields(e,t);for(;l<n.length;){let h=n[l];if(++l,!ne.fieldExists(e,i,h)||!Si.equal(e,ne.getField(e,t,h),ne.getField(e,i,h)))return!1}let s=0,r=ne.getFields(e,i);for(;s<r.length;){let h=r[s];if(++s,!ne.fieldExists(e,t,h))return!1}return!0}static arrayEqual(e,t,i){let l=re.arrayLength(t),n=re.arrayLength(i);if(l!=n)return!1;let s=0,r=l;for(;s<r;){let h=s++;if(!Si.equal(e,re.arrayGet(t,h),re.arrayGet(i,h)))return!1}return!0}static stringMapEqual(e,t,i){let l=t.h,n=l,s=Object.keys(l),r=s.length,h=0;for(;h<r;){let f=s[h++],m=f,g=n[f],w=m,y=g;if(!Object.prototype.hasOwnProperty.call(i.h,w)||!Si.equal(e,i.h[w],y))return!1}let a=i.h,o=a,u=Object.keys(a),c=u.length,_=0;for(;_<c;){let f=u[_++];if(!Object.prototype.hasOwnProperty.call(t.h,f))return!1}return!0}static intMapEqual(e,t,i){let l=t,n=l,s=l.keys();for(;s.hasNext();){let h=s.next(),a=n.get(h),u=h,c=a;if(!i.h.hasOwnProperty(u)||!Si.equal(e,i.h[u],c))return!1}let r=i.keys();for(;r.hasNext();){let h=r.next();if(!t.h.hasOwnProperty(h))return!1}return!0}}j["loreline.Equal"]=Si,Si.__name__="loreline.Equal";class ai{constructor(e,t){this.message=e,this.pos=t,this.stack=gn.callStack()}toString(){return this.pos!=null?""+this.message+" at "+this.pos.toString():this.message}}j["loreline.Error"]=ai,ai.__name__="loreline.Error",Object.assign(ai.prototype,{__class__:ai});class vi{}j["loreline.Fields"]=Yi.loreline.Fields=vi,vi.__name__="loreline.Fields",vi.__isInterface__=!0,Object.assign(vi.prototype,{__class__:vi});class Bl{constructor(e){this._random=null,this.interpreter=e}bindAll(e){e.h.floor=Te(this,this.floor),e.h.ceil=Te(this,this.ceil),e.h.round=Te(this,this.round),e.h.abs=Te(this,this.abs),e.h.min=Te(this,this.min),e.h.max=Te(this,this.max),e.h.clamp=Te(this,this.clamp),e.h.pow=Te(this,this.pow),e.h.random=Te(this,this.random),e.h.chance=Te(this,this.chance),e.h.seed_random=Te(this,this.seed_random),e.h.random_float=Te(this,this.random_float),e.h.wait=Te(this,this.wait),e.h.float=Te(this,this.float_),e.h.string=Te(this,this.string_),e.h.bool=Te(this,this.bool),e.h.string_length=Te(this,this.string_length),e.h.string_upper=Te(this,this.string_upper),e.h.string_lower=Te(this,this.string_lower),e.h.string_contains=Te(this,this.string_contains),e.h.string_replace=Te(this,this.string_replace),e.h.string_split=Te(this,this.string_split),e.h.string_trim=Te(this,this.string_trim),e.h.string_index=Te(this,this.string_index),e.h.string_sub=Te(this,this.string_sub),e.h.string_starts=Te(this,this.string_starts),e.h.string_ends=Te(this,this.string_ends),e.h.string_repeat=Te(this,this.string_repeat),e.h.plural=Te(this,this.plural),e.h.array_length=Te(this,this.array_length),e.h.array_add=Te(this,this.array_add),e.h.array_pop=Te(this,this.array_pop),e.h.array_prepend=Te(this,this.array_prepend),e.h.array_shift=Te(this,this.array_shift),e.h.array_remove=Te(this,this.array_remove),e.h.array_index=Te(this,this.array_index),e.h.array_has=Te(this,this.array_has),e.h.array_sort=Te(this,this.array_sort),e.h.array_reverse=Te(this,this.array_reverse),e.h.array_join=Te(this,this.array_join),e.h.array_pick=Te(this,this.array_pick),e.h.array_shuffle=Te(this,this.array_shuffle),e.h.array_copy=Te(this,this.array_copy),e.h.map_length=Te(this,this.map_length),e.h.map_keys=Te(this,this.map_keys),e.h.map_has=Te(this,this.map_has),e.h.map_get=Te(this,this.map_get),e.h.map_set=Te(this,this.map_set),e.h.map_remove=Te(this,this.map_remove),e.h.map_copy=Te(this,this.map_copy),e.h.current_beat=Te(this,this.current_beat),e.h.has_beat=Te(this,this.has_beat),e.h.beat_visits=Te(this,this.beat_visits),e.h.choices=Te(this,this.choices),e.h.choices_disabled=Te(this,this.choices_disabled),e.h.choices_all=Te(this,this.choices_all)}rng(){this._random==null&&(this._random=new _l);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 _l(e),null}random_float(e,t){return e+this.rng()*(t-e)}wait(e){return new il(function(t){rl.delay(t,e*1e3|0)})}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":le.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 Ae.replace(e,t,i)}string_split(e,t){return e.split(t)}string_trim(e){return Ae.trim(e)}string_index(e,t){return e.indexOf(t)}string_sub(e,t,i){return p.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="",l=0;for(;l<t;)i+=e==null?"null":""+e,++l;return i}plural(e,t,i){let l=0;return typeof e=="number"&&(e|0)===e?l=e*1:typeof e=="number"&&(l=e),l==1?t:i}array_length(e){return re.isArray(e)?re.arrayLength(e):0}array_add(e,t){return re.arrayPush(e,t),null}array_pop(e){return re.isArray(e)?re.arrayPop(e):null}array_prepend(e,t){return re.isArray(e)&&re.arrayInsert(e,0,t),null}array_shift(e){return re.isArray(e)?re.arrayShift(e):null}array_remove(e,t){if(re.isArray(e)){let i=re.arrayLength(e),l=0,n=i;for(;l<n;){let s=l++;if(re.arrayGet(e,s)==t)return re.arrayRemoveAt(e,s),!0}}return!1}array_index(e,t){if(re.isArray(e)){let i=re.arrayLength(e),l=0,n=i;for(;l<n;){let s=l++;if(re.arrayGet(e,s)==t)return s}}return-1}array_has(e,t){if(re.isArray(e)){let i=re.arrayLength(e),l=0,n=i;for(;l<n;){let s=l++;if(re.arrayGet(e,s)==t)return!0}}return!1}array_sort(e){return re.isArray(e)&&re.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":le.string(t))<(i==null?"null":le.string(i))?-1:(t==null?"null":le.string(t))>(i==null?"null":le.string(i))?1:0}),e}array_reverse(e){return re.isArray(e)&&re.arrayReverse(e),e}array_join(e,t){return re.isArray(e)?re.arrayJoin(e,t):""}array_pick(e){if(re.isArray(e)){let t=re.arrayLength(e);if(t==0)return null;let i=Math.floor(this.rng()*t);return re.arrayGet(e,i)}return null}array_shuffle(e){if(re.isArray(e)){let t=re.arrayLength(e)-1;for(;t>0;){let i=Math.floor(this.rng()*(t+1)),l=re.arrayGet(e,t);re.arraySet(e,t,re.arrayGet(e,i)),re.arraySet(e,i,l),--t}}return e}array_copy(e){return re.isArray(e)?re.arrayCopy(e):e}map_length(e){return ne.getFields(this.interpreter,e).length}map_keys(e){let t=ne.getFields(this.interpreter,e);return t.sort(function(i,l){return i<l?-1:i>l?1:0}),t}map_has(e,t){return ne.fieldExists(this.interpreter,e,t)}map_get(e,t){return ne.getField(this.interpreter,e,t)}map_set(e,t,i){return ne.setField(this.interpreter,e,t,i),null}map_remove(e,t){return ne.fieldExists(this.interpreter,e,t)?ne.removeField(this.interpreter,e,t):!1}map_copy(e){let t=ne.getFields(this.interpreter,e),i=ne.createFields(this.interpreter),l=0;for(;l<t.length;){let n=t[l];++l,ne.setField(this.interpreter,i,n,ne.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;--e}return null}has_beat(e){if(e instanceof Me)return!0;let t=e,i=this.interpreter.stack.length-1;for(;i>=0;){let l=this.interpreter.stack[i];if(l.beat!=null&&l.beat.body!=null){let n=0,s=l.beat.body;for(;n<s.length;){let r=s[n];if(++n,r instanceof Me&&r.name==t)return!0}}--i}return Object.prototype.hasOwnProperty.call(this.interpreter.topLevelBeats.h,t)}beat_visits(e){if(e==null){let t=this.interpreter.stack.length-1;for(;t>=0;){let i=this.interpreter.stack[t];if(i.beat!=null)return this.interpreter.getBeatVisitCount(i.beat);--t}return 0}else{if(e instanceof Me)return this.interpreter.getBeatVisitCount(e);{let t=this.interpreter.resolveBeatByName(e);return t==null?0:this.interpreter.getBeatVisitCount(t)}}}choices(){let e=this.interpreter._choiceEvalTexts,t=this.interpreter._choiceEvalEnabled,i=[],l=0,n=e.length;for(;l<n;){let s=l++;t[s]&&i.push(e[s])}return i}choices_disabled(){let e=this.interpreter._choiceEvalTexts,t=this.interpreter._choiceEvalEnabled,i=[],l=0,n=e.length;for(;l<n;){let s=l++;t[s]||i.push(e[s])}return i}choices_all(){let e=this.interpreter._choiceEvalTexts,t=[],i=0,l=e.length;for(;i<l;){let n=i++;t.push(e[n])}return t}}j["loreline.Functions"]=Bl,Bl.__name__="loreline.Functions",Object.assign(Bl.prototype,{__class__:Bl});var Oi=Qe["loreline._HscriptInterp.Stop"]={__ename__:"loreline._HscriptInterp.Stop",__constructs__:null,SBreak:{_hx_name:"SBreak",_hx_index:0,__enum__:"loreline._HscriptInterp.Stop",toString:S},SContinue:{_hx_name:"SContinue",_hx_index:1,__enum__:"loreline._HscriptInterp.Stop",toString:S},SReturn:{_hx_name:"SReturn",_hx_index:2,__enum__:"loreline._HscriptInterp.Stop",toString:S}};Oi.__constructs__=[Oi.SBreak,Oi.SContinue,Oi.SReturn];class Ll{constructor(e){this.interpreter=e,this.locals=new Ee,this.declared=[],this.resetVariables(),this.initOps()}resetVariables(){this.variables=new Ee,this.variables.h.null=null,this.variables.h.true=!0,this.variables.h.false=!1;let e=this,t=this.variables,i=We.makeVarArgs(function(l){let n=e.posInfos(),s=l.shift();l.length>0&&(n.customParams=l),Il.trace(le.string(s),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 Ee,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 l=e.expr(t),n=e.expr(i);return l>=n},this.binops.h["<="]=function(t,i){let l=e.expr(t),n=e.expr(i);return l<=n},this.binops.h[">"]=function(t,i){let l=e.expr(t),n=e.expr(i);return l>n},this.binops.h["<"]=function(t,i){let l=e.expr(t),n=e.expr(i);return l<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["="]=Te(this,this.assign),this.binops.h["..."]=function(t,i){return new Ol(e.expr(t),e.expr(i))},this.binops.h.is=function(t,i){return te.__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))ne.setField(this.interpreter,this.interpreter.topLevelState.fields,e,t);else throw b.thrown("Invalid assign");return t}assign(e,t){let i=this.expr(t),l=e.e;switch(l._hx_index){case 1:let n=l.v,s=this.locals.h[n];s==null?this.setVar(n,i):s.r=i;break;case 5:let r=l.e,h=l.f;i=this.set(this.expr(r),h,i);break;case 16:let a=l.e,o=l.index,u=this.expr(a),c=this.expr(o);re.isArray(u)?re.arraySet(u,c,i):ne.isFields(u)?ne.setField(this.interpreter,u,c,i):te.__implements(u,kt)?te.__cast(u,kt).set(c,i):u[c]=i;break;default:let _=new Ce(be.EInvalidOp("="),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw b.thrown(_)}return i}assignOp(e,t){let i=this;this.binops.h[e]=function(l,n){return i.evalAssignOp(e,t,l,n)}}evalAssignOp(e,t,i,l){let n,s=i.e;switch(s._hx_index){case 1:let r=s.v,h=this.locals.h[r];n=t(this.expr(i),this.expr(l)),h==null?this.setVar(r,n):h.r=n;break;case 5:let a=s.e,o=s.f,u=this.expr(a);n=t(this.get(u,o),this.expr(l)),n=this.set(u,o,n);break;case 16:let c=s.e,_=s.index,f=this.expr(c),m=this.expr(_);re.isArray(f)?(n=t(re.arrayGet(f,m),this.expr(l)),re.arraySet(f,m,n)):ne.isFields(f)?(n=t(ne.getField(this.interpreter,f,m),this.expr(l)),ne.setField(this.interpreter,f,m,n)):te.__implements(f,kt)?(n=t(te.__cast(f,kt).get(m),this.expr(l)),te.__cast(f,kt).set(m,n)):(n=t(f[m],this.expr(l)),f[m]=n);break;default:let g=new Ce(be.EInvalidOp(e),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw b.thrown(g)}return n}increment(e,t,i){this.curExpr=e;let l=e.e;switch(l._hx_index){case 1:let n=l.v,s=this.locals.h[n],r=s==null?this.resolve(n):s.r;return t?(r+=i,s==null?this.setVar(n,r):s.r=r):s==null?this.setVar(n,r+i):s.r=r+i,r;case 5:let h=l.e,a=l.f,o=this.expr(h),u=this.get(o,a);return t?(u+=i,this.set(o,a,u)):this.set(o,a,u+i),u;case 16:let c=l.e,_=l.index,f=this.expr(c),m=this.expr(_);if(re.isArray(f)){let w=re.arrayGet(f,m);return t?(w+=i,re.arraySet(f,m,w)):re.arraySet(f,m,w+i),w}else if(ne.isFields(f)){let w=ne.getField(this.interpreter,f,m);return t?(w+=i,ne.setField(this.interpreter,f,m,w)):ne.setField(this.interpreter,f,m,w+i),w}else if(te.__implements(f,kt)){let w=te.__cast(f,kt).get(m);return t?(w+=i,te.__cast(f,kt).set(m,w)):te.__cast(f,kt).set(m,w+i),w}else{let w=f[m];return t?(w+=i,f[m]=w):f[m]=w+i,w}break;default:let g=new Ce(be.EInvalidOp(i>0?"++":"--"),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw b.thrown(g)}}execute(e){return this.depth=0,this.locals=new Ee,this.declared=[],this.exprReturn(e)}exprReturn(e){try{return this.expr(e)}catch(t){let i=b.caught(t).unwrap();if(te.__instanceof(i,Oi))switch(i._hx_index){case 0:throw b.thrown("Invalid break");case 1:throw b.thrown("Invalid continue");case 2:let n=this.returnValue;return this.returnValue=null,n}else throw t}}duplicate(e){let t=new Ee,i=e.h,l=i,n=Object.keys(i),s=n.length,r=0;for(;r<s;){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 b.thrown(i)}rethrow(e){throw b.thrown(e)}resolve(e){let t=this.variables.h[e];if(t==null&&!Object.prototype.hasOwnProperty.call(this.variables.h,e)){if(ne.fieldExists(this.interpreter,this.interpreter.topLevelState.fields,e))return ne.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=this.interpreter.resolveBeatByName(e);if(i!=null)return i;let l=new Ce(be.EUnknownVariable(e),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw b.thrown(l)}return t}expr(e){this.curExpr=e;let t=e.e,i=this;switch(t._hx_index){case 0:let l=t.c;switch(l._hx_index){case 0:return l.v;case 1:return l.f;case 2:return l.s}break;case 1:let n=t.v,s=this.locals.h[n];return s!=null?s.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,u=a==null?null:this.expr(a);return o.h[h]={r:u},null;case 3:let c=t.e;return this.expr(c);case 4:let _=t.e,f=this.declared.length,m=null,g=0;for(;g<_.length;){let ye=_[g];++g,m=this.expr(ye)}return this.restore(f),m;case 5:let w=t.e,y=t.f;return this.get(this.expr(w),y);case 6:let T=t.op,E=t.e1,C=t.e2,P=this.binops.h[T];if(P==null){let ye=new Ce(be.EInvalidOp(T),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw b.thrown(ye)}return P(E,C);case 7:let I=t.op,v=t.prefix,F=t.e;switch(I){case"!":return this.expr(F)!=!0;case"++":return this.increment(F,v,1);case"-":return-this.expr(F);case"--":return this.increment(F,v,-1);case"~":return~this.expr(F);default:let ye=new Ce(be.EInvalidOp(I),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw b.thrown(ye)}break;case 8:let B=t.e,A=t.params,L=[],z=0;for(;z<A.length;){let ye=A[z];++z,L.push(this.expr(ye))}let D=B.e;if(D._hx_index==5){let ye=D.e,lt=D.f,ct=this.expr(ye);if(ct==null){let rt=new Ce(be.EInvalidAccess(lt),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw b.thrown(rt)}return this.fcall(ct,lt,L)}else return this.call(null,this.expr(B),L);break;case 9:let O=t.cond,q=t.e1,M=t.e2;return this.expr(O)==!0?this.expr(q):M==null?null:this.expr(M);case 10:let U=t.cond,K=t.e;return this.whileLoop(U,K),null;case 11:let G=t.v,Y=t.it,$=t.e;return this.forLoop(G,Y,$),null;case 12:throw b.thrown(Oi.SBreak);case 13:throw b.thrown(Oi.SContinue);case 14:let se=t.ret,ue=t.args,oe=t.e,ge=t.name,me=this.duplicate(this.locals),de=this,Oe=!1,Ve=0,je=0;for(;je<ue.length;){let ye=ue[je];++je,ye.opt||ye.value!=null?Oe=!0:Ve+=1}let et=function(ye){if((ye==null?0:ye.length)!=ue.length){if(ye.length<Ve){let Qi="Invalid number of parameters. Got "+ye.length+", required "+Ve;ge!=null&&(Qi+=" for function '"+ge+"'");let rn=new Ce(be.ECustom(Qi),i.curExpr.pmin,i.curExpr.pmax,i.curExpr.origin,i.curExpr.line);throw b.thrown(rn)}let Jt=[],wt=ye.length-Ve,Ql=0,fl=0;for(;fl<ue.length;){let Qi=ue[fl];++fl,Qi.opt||Qi.value!=null?wt>0?(Jt.push(ye[Ql++]),--wt):Jt.push(Qi.value!=null?de.expr(Qi.value):null):Jt.push(ye[Ql++])}ye=Jt}let lt=de.locals,ct=de.depth;de.depth++,de.locals=de.duplicate(me);let rt=0,dt=ue.length;for(;rt<dt;){let Jt=rt++;de.locals.h[ue[Jt].name]={r:ye[Jt]}}let xt=null,St=i.declared.length;if(i.inTry)try{xt=de.exprReturn(oe)}catch(Jt){let wt=b.caught(Jt).unwrap();throw i.restore(St),de.locals=lt,de.depth=ct,b.thrown(wt)}else xt=de.exprReturn(oe);return i.restore(St),de.locals=lt,de.depth=ct,xt},Ue=We.makeVarArgs(et);if(ge!=null)if(this.depth==0)this.variables.h[ge]=Ue;else{this.declared.push({n:ge,old:this.locals.h[ge]});let ye={r:Ue};this.locals.h[ge]=ye,me.h[ge]=ye}return Ue;case 15:let Ge=t.e;throw this.returnValue=Ge==null?null:this.expr(Ge),b.thrown(Oi.SReturn);case 16:let nt=t.e,De=t.index,H=this.expr(nt),ie=this.expr(De);return re.isArray(H)?re.arrayGet(H,ie):ne.isFields(H)?ne.getField(this.interpreter,H,ie):te.__implements(H,kt)?te.__cast(H,kt).get(ie):H[ie];case 17:let R=t.e,ee;if(R.length>0){let ye=R[0].e;if(ye._hx_index==6){let lt=ye.e1,ct=ye.e2;ee=ye.op=="=>"}else ee=!1}else ee=!1;if(ee){let ye=[],lt=[],ct=0;for(;ct<R.length;){let rt=R[ct];++ct;let dt=rt.e;if(dt._hx_index==6)if(dt.op=="=>"){let xt=dt.e1,St=dt.e2;ye.push(this.expr(xt)),lt.push(this.expr(St))}else{this.curExpr=rt;let xt=new Ce(be.ECustom("Invalid map key=>value expression"),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw b.thrown(xt)}else{this.curExpr=rt;let xt=new Ce(be.ECustom("Invalid map key=>value expression"),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw b.thrown(xt)}}return this.makeMap(ye,lt)}else{let ye=[],lt=0;for(;lt<R.length;){let ct=R[lt];++lt,ye.push(this.expr(ct))}return ye}break;case 18:let X=t.cl,Q=t.params,ae=[],_e=0;for(;_e<Q.length;){let ye=Q[_e];++_e,ae.push(this.expr(ye))}return this.cnew(X,ae);case 19:let xe=t.e;throw b.thrown(this.expr(xe));case 20:let Ye=t.t,gt=t.e,Be=t.v,_t=t.ecatch,ve=this.declared.length,Pe=this.inTry;try{this.inTry=!0;let ye=this.expr(gt);return this.restore(ve),this.inTry=Pe,ye}catch(ye){let lt=b.caught(ye).unwrap();if(te.__instanceof(lt,Oi)){let ct=lt;throw this.inTry=Pe,b.thrown(ct)}else{let ct=lt;this.restore(ve),this.inTry=Pe,this.declared.push({n:Be,old:this.locals.h[Be]}),this.locals.h[Be]={r:ct};let rt=this.expr(_t);return this.restore(ve),rt}}break;case 21:let ot=t.fl,tt=ne.createFields(this.interpreter),bt=0;for(;bt<ot.length;){let ye=ot[bt];++bt,ne.setField(this.interpreter,tt,ye.name,this.expr(ye.e))}return tt;case 22:let Kt=t.cond,ft=t.e1,li=t.e2;return this.expr(Kt)==!0?this.expr(ft):this.expr(li);case 23:let $e=t.e,Bt=t.cases,It=t.defaultExpr,Lt=this.expr($e),mt=!1,Vt=0;for(;Vt<Bt.length;){let ye=Bt[Vt];++Vt;let lt=0,ct=ye.values;for(;lt<ct.length;){let rt=ct[lt];if(++lt,this.expr(rt)==Lt){mt=!0;break}}if(mt){Lt=this.expr(ye.expr);break}}return mt||(Lt=It==null?null:this.expr(It)),Lt;case 24:let Ht=t.cond,Ut=t.e;return this.doWhileLoop(Ht,Ut),null;case 25:let ni=t.name,si=t.args,jt=t.e;return this.expr(jt);case 26:let it=t.t,ki=t.e;return this.expr(ki)}}doWhileLoop(e,t){let i=this.declared.length,l=this;do{let n=!0;try{l.expr(t)}catch(s){let r=b.caught(s).unwrap();if(te.__instanceof(r,Oi)){let h=r;switch(h._hx_index){case 0:n=!1;break;case 1:break;case 2:throw b.thrown(h)}}else throw s}if(!n)break}while(this.expr(e)==!0);this.restore(i)}whileLoop(e,t){let i=this.declared.length,l=this;for(;this.expr(e)==!0;){let n=!0;try{l.expr(t)}catch(s){let r=b.caught(s).unwrap();if(te.__instanceof(r,Oi)){let h=r;switch(h._hx_index){case 0:n=!1;break;case 1:break;case 2:throw b.thrown(h)}}else throw s}if(!n)break}this.restore(i)}makeIterator(e){if(e instanceof Array)return new Ti(e);if(re.isArray(e))return re.getIterator(e);if(e.iterator!=null&&(e=fn(e)),e.hasNext==null||e.next==null){let t=new Ce(be.EInvalidIterator(e),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw b.thrown(t)}return e}forLoop(e,t,i){let l=this.declared.length;this.declared.push({n:e,old:this.locals.h[e]});let n=this.makeIterator(this.expr(t)),s=this;for(;n.hasNext();){let r=this.locals,h={r:n.next()};r.h[e]=h;let a=!0;try{s.expr(i)}catch(o){let u=b.caught(o).unwrap();if(te.__instanceof(u,Oi)){let c=u;switch(c._hx_index){case 0:a=!1;break;case 1:break;case 2:throw b.thrown(c)}}else throw o}if(!a)break}this.restore(l)}loopRun(e){let t=!0;try{e()}catch(i){let l=b.caught(i).unwrap();if(te.__instanceof(l,Oi)){let n=l;switch(n._hx_index){case 0:t=!1;break;case 1:break;case 2:throw b.thrown(n)}}else throw i}return t}isMap(e){return te.__implements(e,kt)}getMapValue(e,t){return te.__cast(e,kt).get(t)}setMapValue(e,t,i){te.__cast(e,kt).set(t,i)}makeMap(e,t){let i=!0,l=!0,n=!0,s=!0,r=0;for(;r<e.length;){let a=e[r];++r,i=i&&typeof a=="string",l=l&&typeof a=="number"&&(a|0)===a,n=n&&We.isObject(a),s=s&&We.isEnumValue(a)}if(l){let a=new Ri,o=0,u=e;for(;o<u.length;){let c=u[o],f=o++,m=c;a.h[m]=t[f]}return a}if(i){let a=new Ee,o=0,u=e;for(;o<u.length;){let c=u[o],f=o++,m=c;a.h[m]=t[f]}return a}if(s){let a=new Xi,o=0,u=e;for(;o<u.length;){let c=u[o],f=o++,m=c;a.set(m,t[f])}return a}if(n){let a=new gl,o=0,u=e;for(;o<u.length;){let c=u[o],f=o++,m=c;a.set(m,t[f])}return a}let h=new Ce(be.ECustom("Invalid map keys "+le.string(e)),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw b.thrown(h)}get(e,t){if(e==null){let i=new Ce(be.EInvalidAccess(t),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw b.thrown(i)}return ne.isFields(e)?ne.getField(this.interpreter,e,t):We.getProperty(e,t)}set(e,t,i){if(e==null){let l=new Ce(be.EInvalidAccess(t),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw b.thrown(l)}return ne.isFields(e)?(ne.setField(this.interpreter,e,t,i),i):(We.setProperty(e,t,i),i)}fcall(e,t,i){let l=null;return typeof e=="string"?l=ne.getStringHelper(this.interpreter,t):re.isArray(e)?l=ne.getArrayHelper(this.interpreter,t):e instanceof Me?l=ne.getBeatHelper(this.interpreter,t):ne.isFields(e)&&(l=ne.getMapHelper(this.interpreter,t)),l!=null&&We.isFunction(l)?(i.splice(0,0,e),this.call(null,l,i)):this.call(e,this.get(e,t),i)}call(e,t,i){return t.apply(e,i)}cnew(e,t){let i=j[e];return i==null&&(i=this.resolve(e)),pe.createInstance(i,t)}}j["loreline.HscriptInterp"]=Ll,Ll.__name__="loreline.HscriptInterp",Object.assign(Ll.prototype,{__class__:Ll});class Al{constructor(e){this.finished=e}}j["loreline._Imports.ImportsLoopInfo"]=Al,Al.__name__="loreline._Imports.ImportsLoopInfo",Object.assign(Al.prototype,{__class__:Al});class Dl{constructor(){this.ext=".lor",this.pendingImports=0,this.hasErrors=!1,this.done=null,this.resolvedImports=null,this.autoAddExtension=!0}resolve(e,t,i,l,n){this.rootPath=e,this.tokens=t,this.handleFile=i,this.handleError=l,this.done=n,this.hasErrors=!1,this.pendingImports=0,e!=null&&e.endsWith(".lor.txt")&&(this.ext=".lor.txt");let s=new Ee,r=[],h=new Ee,a=Nt.directory(e);this.extractImports(a,t,r,h),this.processImports(r,h,s)}processImports(e,t,i){let l=new Al(!1);for(;e.length>0;){let n=e.shift();this.handleItemInLoop(n,l,e,t,i)}l.finished=!0,this.pendingImports==0&&this.done!=null&&(this.resolvedImports=i,this.done(this.hasErrors,i),this.done=null)}handleItemInLoop(e,t,i,l,n){let s=this;this.handleFile(e,function(r){if(s.pendingImports--,r!=null)try{let h=new yt(r),a=h.tokenize(),o=h.getErrors();o!=null&&o.length>0&&s.handleError(o[0]),n.h[e]=a,s.extractImports(Nt.directory(e),a,i,l),t.finished&&s.processImports(i,l,n)}catch(h){let a=b.caught(h).unwrap();if(s.hasErrors=!0,a instanceof ai)s.handleError(a);else throw b.thrown(a)}else s.hasErrors=!0;t.finished&&s.pendingImports==0&&s.done!=null&&(s.resolvedImports=n,s.done(s.hasErrors,n),s.done=null)})}extractImports(e,t,i,l){let n=0,s=t.length;for(;n<s-1;){if(t[n].type==x.KwImport){let r=t[n+1].type;if(r._hx_index==15){let h=r.quotes,a=r.attachments,o=r.s,u=o;Nt.isAbsolute(o)||(u=Nt.join([e,u])),u=Nt.normalize(u),u.toLowerCase().endsWith(this.ext)||(u+=this.ext),Object.prototype.hasOwnProperty.call(l.h,u)||(this.pendingImports++,l.h[u]=!0,i.push(u))}}++n}}}j["loreline.Imports"]=Dl,Dl.__name__="loreline.Imports",Object.assign(Dl.prototype,{__class__:Dl});class wi{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 l=0,n=e.length;for(;l<n;){let s=l++;i[s]!=null&&this._set(e[s],t[s],i[s])}}}resize(e){let t=this._keys1,i=this._keys2,l=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,s=t.length;for(;n<s;){let r=n++;l[r]!=null&&this._set(t[r],i[r],l[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 l=0,n=e.length;for(;l<n;){let s=l++;i[s]!=null&&this._set(e[s],t[s],i[s])}}this.size=0}copy(){let e=new wi,t=this._keys1,i=new Array(t.length);ln.blit(t,0,i,0,t.length),e._keys1=i;let l=this._keys2,n=new Array(l.length);ln.blit(l,0,n,0,l.length),e._keys2=n;let s=this._values,r=new Array(s.length);return ln.blit(s,0,r,0,s.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 u=0,c=h.length;for(;u<c;){let _=u++;o[_]!=null&&this._set(h[_],a[_],o[_])}}}let l=e+(t<<16);l=(l^l>>>16)*-2048144789,l=(l^l>>>13)*-1028477387;let s=(l^l>>>16)&this.mask;for(;;){if(this._values[s]==null){this._keys1[s]=e,this._keys2[s]=t,this._values[s]=i,this.size++;return}if(this._keys1[s]==e&&this._keys2[s]==t){this._values[s]=i;return}s=s+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 s=this._keys1[n],r=this._keys2[n],h=this._values[n];this._values[n]=null,this.size--,this._set(s,r,h),n=n+1&this.mask}return!0}n=n+1&this.mask}}iterator(){return new Rl(this)}keyIterator(){return new Vl(this)}keyValueIterator(){return new Ul(this)}length(){return this.size}}j["loreline.Int64Map"]=wi,wi.__name__="loreline.Int64Map",Object.assign(wi.prototype,{__class__:wi});class Rl{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}}j["loreline._Int64Map.Int64MapIterator"]=Rl,Rl.__name__="loreline._Int64Map.Int64MapIterator",Object.assign(Rl.prototype,{__class__:Rl});class Vl{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}}}j["loreline._Int64Map.Int64MapKeyIterator"]=Vl,Vl.__name__="loreline._Int64Map.Int64MapKeyIterator",Object.assign(Vl.prototype,{__class__:Vl});class Ul{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}}}j["loreline._Int64Map.Int64MapKeyValueIterator"]=Ul,Ul.__name__="loreline._Int64Map.Int64MapKeyValueIterator",Object.assign(Ul.prototype,{__class__:Ul});class Ii{constructor(e,t,i,l){this.scope=-1,i!=null?this.fields=i:this.clear(e,t),l!=null?this.originalFields=l:this.createOriginalFields()}clear(e,t){this.fields=ne.createFields(e,null,t)}createOriginalFields(){this.originalFields=ne.createFields()}}j["loreline.RuntimeState"]=Ii,Ii.__name__="loreline.RuntimeState",Object.assign(Ii.prototype,{__class__:Ii});class cl extends Ii{constructor(e,t,i,l){super(e,t,i,l)}}j["loreline.RuntimeCharacter"]=cl,cl.__name__="loreline.RuntimeCharacter",cl.__super__=Ii,Object.assign(cl.prototype,{__class__:cl});var oi=Qe["loreline.RuntimeAccess"]={__ename__:"loreline.RuntimeAccess",__constructs__:null,FieldAccess:(d=function(k,e,t){return{_hx_index:0,pos:k,obj:e,name:t,__enum__:"loreline.RuntimeAccess",toString:S}},d._hx_name="FieldAccess",d.__params__=["pos","obj","name"],d),ArrayAccess:(d=function(k,e,t){return{_hx_index:1,pos:k,array:e,index:t,__enum__:"loreline.RuntimeAccess",toString:S}},d._hx_name="ArrayAccess",d.__params__=["pos","array","index"],d),CharacterAccess:(d=function(k,e){return{_hx_index:2,pos:k,name:e,__enum__:"loreline.RuntimeAccess",toString:S}},d._hx_name="CharacterAccess",d.__params__=["pos","name"],d),FunctionAccess:(d=function(k,e){return{_hx_index:3,pos:k,name:e,__enum__:"loreline.RuntimeAccess",toString:S}},d._hx_name="FunctionAccess",d.__params__=["pos","name"],d),BeatAccess:(d=function(k,e){return{_hx_index:4,pos:k,beat:e,__enum__:"loreline.RuntimeAccess",toString:S}},d._hx_name="BeatAccess",d.__params__=["pos","beat"],d)};oi.__constructs__=[oi.FieldAccess,oi.ArrayAccess,oi.CharacterAccess,oi.FunctionAccess,oi.BeatAccess];class pl{constructor(e,t,i,l,n,s,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,l!=null&&(this.beats=l),n!=null&&(this.state=n),s!=null&&(this.head=s),r!=null&&(this.insertion=r)}beatByName(e){if(this.beats==null)return null;let t=0,i=this.beats.length;for(;t<i;){let l=t++,n=this.beats[l];if(n.name==e)return n}return null}}j["loreline.RuntimeScope"]=pl,pl.__name__="loreline.RuntimeScope",Object.assign(pl.prototype,{__class__:pl});class wl{constructor(e,t){this.parentNextOptionIndex=0,this.parentPartialOptions=null,this.stack=[],this.options=null,this.id=e,this.origin=t}}j["loreline.RuntimeInsertion"]=wl,wl.__name__="loreline.RuntimeInsertion",Object.assign(wl.prototype,{__class__:wl});class kl{constructor(e,t,i){this.closing=e,this.value=t,this.offset=i}}j["loreline.TextTag"]=kl,kl.__name__="loreline.TextTag",Object.assign(kl.prototype,{__class__:kl});class yl{constructor(e,t,i,l,n){this.text=e,this.tags=t,this.enabled=i,this.node=l,this.insertion=n}}j["loreline.ChoiceOption"]=yl,yl.__name__="loreline.ChoiceOption",Object.assign(yl.prototype,{__class__:yl});class fe extends ai{constructor(e,t){super(e,t)}}j["loreline.RuntimeError"]=fe,fe.__name__="loreline.RuntimeError",fe.__super__=ai,Object.assign(fe.prototype,{__class__:fe});class ql{constructor(){this.cb=null,this.sync=!0}}j["loreline.EvalNext"]=ql,ql.__name__="loreline.EvalNext",Object.assign(ql.prototype,{__class__:ql});class bl{constructor(e,t,i,l,n){this._choiceEvalEnabled=[],this._choiceEvalTexts=[],this.pendingChoiceOptions=null,this.beatToResume=null,this.finishTrigger=null,this.flushing=!1,this.syncCallbacks=[],this.nextInsertionId=1,this.nextScopeId=1,this.stack=[],this.stringLiteralProcessors=[],this.beatHelpers=new Ee,this.mapHelpers=new Ee,this.arrayHelpers=new Ee,this.stringHelpers=new Ee,this.topLevelFunctions=new Ee,this.nodeStates=new Gi,this.topLevelBeats=new Ee,this.topLevelCharacters=new Ee,this.script=e,this.handleDialogue=t,this.handleChoice=i,this.handleFinish=l,this.lens=new Kl(e);let s=n!=null?n.strictAccess:null;this.strictAccess=s!=null&&s,this.translations=n!=null?n.translations:null,this.topLevelState=new Ii(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(te.getClass(h)){case Me:this.initializeTopLevelBeat(h);break;case zt:this.initializeTopLevelCharacter(h);break;case Li:this.initializeTopLevelFunction(h);break;case Wt: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 b.thrown(new fe("Beat "+e+" not found",this.script.pos))}else{let i=0,l=this.script.body;for(;i<l.length;){let n=l[i];if(++i,n instanceof Me){let s=n;if(s.name=="_"){t=s;break}t==null&&(t=s)}}if(t==null){let n=this.script.iterator();for(;n.hasNext();){let s=n.next();if(s instanceof Me){let r=s;if(r.name=="_"){t=r;break}t==null&&(t=r)}}}if(t==null)throw b.thrown(new fe("No beats found in script",this.script.pos))}this.transitionToBeat(t),this.flush()}save(){let e={},t=[],i=0,l=this.stack;for(;i<l.length;){let s=l[i];++i,t.push(this.serializeScope(s,e))}let n={version:1,stack:t,state:this.serializeState(this.topLevelState),characters:this.serializeCharacters(),nodeStates:this.serializeNodeStates()};if(this.pendingChoiceOptions!=null){let s=[],r=0,h=this.pendingChoiceOptions;for(;r<h.length;){let a=h[r];++r,s.push(this.serializeChoiceOption(a,e))}n.pendingChoiceOptions=s}if(this._choiceEvalTexts.length>0){let s=[],r=0,h=this._choiceEvalTexts.length;for(;r<h;){let a=r++,o={text:this._choiceEvalTexts[a]};this._choiceEvalEnabled[a]||(o.disabled=!0),s.push(o)}n.choiceEvalContext=s}return We.fields(e).length>0&&(n.insertions=e),n}restore(e){if(e.version!=1)throw b.thrown(new fe("Unsupported save version: "+e.version,this.script.pos));this.stack.length=0,this.nodeStates.map.clear(),this.nextScopeId=1,this.nextInsertionId=1,this.pendingChoiceOptions=null,this._choiceEvalTexts.length=0,this._choiceEvalEnabled.length=0,this.restoreState(this.topLevelState,e.state),this.restoreCharacters(e.characters),this.restoreNodeStates(e.nodeStates);let t=new Ri;if(this.restoreStack(e.stack,e.insertions,t)||(this.beatToResume=this.restoreBeatToResume(e.stack)),e.pendingChoiceOptions!=null){this.pendingChoiceOptions=[];let i=0,l=e.pendingChoiceOptions;for(;i<l.length;){let n=l[i];++i;let s=this.restoreChoiceOption(n,e.insertions,t);s!=null&&this.pendingChoiceOptions.push(s)}}if(e.choiceEvalContext!=null){this._choiceEvalTexts.length=0,this._choiceEvalEnabled.length=0;let i=0,l=e.choiceEvalContext;for(;i<l.length;){let n=l[i];++i,this._choiceEvalTexts.push(n.text),this._choiceEvalEnabled.push(n.disabled!=!0)}}}resume(){if(this.stack.length==0){this.start();return}let e=this.wrapNext(Te(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.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],l=i!=null?i.fields:null;return l!=null?ne.getField(this,l,t):null}setCharacterField(e,t,i){let l=this.topLevelCharacters.h[e].fields;ne.setField(this,l,t,i)}getStateField(e){let t=this.stack.length-1;for(;t>=0;){let i=this.stack[t];if(i.state!=null&&ne.fieldExists(this,i.state.fields,e))return ne.getField(this,i.state.fields,e);if(i.node!=null){let l=i.node.id.thisVal,n=this.nodeStates.map._get(l.high,l.low);if(n!=null&&ne.fieldExists(this,n.fields,e))return ne.getField(this,n.fields,e)}--t}return ne.fieldExists(this,this.topLevelState.fields,e)?ne.getField(this,this.topLevelState.fields,e):null}setStateField(e,t){let i=this.stack.length-1;for(;i>=0;){let l=this.stack[i];if(l.state!=null&&ne.fieldExists(this,l.state.fields,e)){ne.setField(this,l.state.fields,e,t);return}if(l.node!=null){let n=l.node.id.thisVal,s=this.nodeStates.map._get(n.high,n.low);if(s!=null&&ne.fieldExists(this,s.fields,e)){ne.setField(this,s.fields,e,t);return}}--i}ne.setField(this,this.topLevelState.fields,e,t)}getTopLevelStateField(e){return ne.getField(this,this.topLevelState.fields,e)}setTopLevelStateField(e,t){ne.setField(this,this.topLevelState.fields,e,t)}currentNode(){let e=this.get_currentScope();return e==null?null:e.head!=null?e.head:e.node}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 l=[],n=0,s=e.beats;for(;n<s.length;){let r=s[n];++n,l.push(this.serializeBeatReference(r))}i.beats=l}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,l=We.field(t,i);if(l==null){if(l={},t[i]=l,e.options!=null){let n=[],s=0,r=e.options;for(;s<r.length;){let h=r[s];++s,n.push(this.serializeChoiceOption(h,t))}l.options=n}if(e.origin!=null&&(l.origin=this.serializeNodeReference(e.origin)),e.stack!=null){let n=[],s=0,r=e.stack;for(;s<r.length;){let h=r[s];++s,n.push(this.serializeScope(h,t))}l.stack=n}if(e.parentPartialOptions!=null){let n=[],s=0,r=e.parentPartialOptions;for(;s<r.length;){let h=r[s];++s,n.push(this.serializeChoiceOption(h,t))}l.parentPartialOptions=n,l.parentNextOptionIndex=e.parentNextOptionIndex}}return e.id}serializeChoiceOption(e,t){let i={text:e.text};if(e.enabled||(i.disabled=!0),e.tags!=null){let l=[],n=0,s=e.tags;for(;n<s.length;){let r=s[n];++n,l.push(this.serializeTextTag(r))}i.tags=l}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,l=Object.keys(t),n=l.length,s=0;for(;s<n;){let r=l[s++],h=r,a=i[r],o=h,u=a,c=this.serializeCharacter(u);We.fields(c.fields).length>0&&(e[o]=c)}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 l=t._keys1[i],n=t._keys2[i],s=t._values[i];for(++i;i<t._values.length&&t._values[i]==null;)++i;let r=Re.fromTwoInt32(l,n),h=s,a=r,o=h,u=this.serializeState(o);We.fields(u.fields).length>0&&(e[a.toString()]=u)}return e}serializeBeatReference(e){let t=e.name,i=e;do i=this.lens.getFirstParentOfType(i,Me),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,l={};if(te.__implements(e,vi)){let n=te.getClass(e);n!=null&&(i=n.__name__);let s=e,r=0,h=s.lorelineFields(this);for(;r<h.length;){let a=h[r];++r,l[a]=this.serializeValue(s.lorelineGet(this,a))}}else if(e instanceof Ee){let n=e,s=n.h,r=s,h=Object.keys(s),a=h.length,o=0;for(;o<a;){let u=h[o++],c=n.h[u];(t==null||!ne.fieldExists(this,t,u)||!Si.equal(this,ne.getField(this,t,u),c))&&(l[u]=this.serializeValue(c))}}else{let n=te.getClass(e);n!=null&&(i=n.__name__);let s=0,r=We.fields(e);for(;s<r.length;){let h=r[s];++s;let a=We.getProperty(e,h);(t==null||!ne.fieldExists(this,t,h)||!Si.equal(this,ne.getField(this,t,h),a))&&(l[h]=this.serializeValue(a))}}return i!=null?{type:i,fields:l}:{fields:l}}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(re.isArray(e)){let t=[],i=re.arrayLength(e),l=0,n=i;for(;l<n;){let s=l++;t.push(this.serializeValue(re.arrayGet(e,s)))}return t}return this.serializeFields(e)}resumeNode(e,t,i){let l=this.stack.length-1;if(t>=this.stack.length)switch(te.getClass(e)){case Ui:this.evalAlternative(e,i);break;case Rt:if(!this.isBeatCall(e))this.evalCall(e,i);else{let r=te.getClass(e);throw b.thrown(new fe("Resume execution not supported from last node: "+r.__name__,e.pos))}break;case mi:this.evalChoice(e,i);break;case ti:this.evalDialogue(e,i);break;case ci:this.evalText(e,i);break;default:let s=te.getClass(e);throw b.thrown(new fe("Resume execution not supported from last node: "+s.__name__,e.pos))}else switch(te.getClass(e)){case Ui:this.resumeAlternative(e,t,i);break;case Me:this.resumeBeatRun(e,t,i);break;case Rt:if(this.isBeatCall(e,t))this.resumeCall(e,t,i);else{let r=te.getClass(e);throw b.thrown(new fe("Resume execution not supported from node within stack: "+r.__name__,e.pos))}break;case Et:this.resumeChoiceOption(e,t,i);break;case mi:this.resumeChoice(e,t,i);break;case gi:this.resumeIf(e,t,i);break;default:let s=te.getClass(e);throw b.thrown(new fe("Resume execution not supported from node within stack: "+s.__name__,e.pos))}}resumeNodeBody(e,t,i,l){let n=this.stack[t],s=0,r=-1;if(n.head==null&&t<this.stack.length-1)throw b.thrown(new fe("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&&(s=i.indexOf(n.head),r=s,s==-1))throw b.thrown(new fe("Failed to resolve head in scope when resuming through body",e.pos));let h=this.get_currentInsertion(),a=null,o=this;a=function(){if((h!=null?h.options:null)!=null)o.pop(),l();else if(s!=-1&&s==r){let u=i[s];s+=1;let c=o.wrapNext(a);o.resumeNode(u,t+1,c.cb),c.sync=!1}else if(s<i.length){let u=i[s];n.head=u,s+=1;let c=o.wrapNext(a);o.evalNode(u,c.cb),c.sync=!1}else o.pop(),l()},a()}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 l=this.stack[t],n=this;if(l.head==null)this.evalChoice(e,i);else if(l.head instanceof Et){let s=l.head;t+1<this.stack.length?this.resumeNodeBody(s,t+1,s.body,i):this.evalNodeBody(l.beat,s,s.body,null,i)}else if(l.insertion!=null){let s=l.node,r=l.insertion;if(s instanceof Me){let h=s;this.resumeNodeBody(h,t,h.body,function(){let a=r.parentPartialOptions!=null?r.parentPartialOptions:[];if(r.options!=null){let _=0,f=r.options;for(;_<f.length;){let m=f[_];++_,a.push(m)}}let o=r.parentNextOptionIndex,u=l.beat,c=n.wrapNext(function(){n.presentChoice(e,a,i)});n.evalChoiceOptionsAndInsertions(u,e,a,c.cb,o),c.sync=!1})}else{for(;this.stack.length>t;)this.pop();this.evalChoice(e,i)}}else if(l.node instanceof Et){let s=l.node;this.resumeNodeBody(s,t,s.body,i)}else if(l.node instanceof Me){let s=l.node;this.resumeNodeBody(s,t,s.body,i)}else throw b.thrown(new fe("Choice head is not a choice option",l.head.pos))}resumeIf(e,t,i){let l=this.stack[t];if(l.head==null)throw b.thrown(new fe("Failed to resolve head in scope when resuming through condition",e.pos));let s=e.thenBranch.body.indexOf(l.head)!=-1?e.thenBranch:e.elseBranch;if(s!=null&&s.body.length>0)this.resumeNodeBody(s,t,s.body,i);else throw b.thrown(new fe("Failed to resume condition: invalid scope",e.pos))}resumeAlternative(e,t,i){let l=this.stack[t];if(l.head==null)throw b.thrown(new fe("Failed to resolve head when resuming alternative",e.pos));let n=0,s=e.items;for(;n<s.length;){let r=s[n];if(++n,r.body.indexOf(l.head)!=-1){this.resumeNodeBody(r,t,r.body,i);return}}throw b.thrown(new fe("Failed to resume alternative: head not found in any item",e.pos))}resumeCall(e,t,i){if(e.target instanceof ut){let l=e.target;if(l.target==null){let n=l.name,s=null,r=this.stack.length-1;for(;r>=0;){let a=this.stack[r].beatByName(n);if(a!=null){s=a;break}--r}if(s==null&&Object.prototype.hasOwnProperty.call(this.topLevelBeats.h,n)&&(s=this.topLevelBeats.h[n]),s!=null){this.resumeBeatRun(s,t,i);return}}}throw b.thrown(new fe("Cannot resume through a function call that is not at the bottom of the stack",e.pos))}restoreStack(e,t,i){let l=[];i==null&&(i=new Ri);let n=e.length-1;for(;n>=0;){let s=this.restoreScopeItem(e[n],t,i);if(s==null)return!1;l.push(s),--n}for(n=l.length-1;n>=0;)this.push(l[n]),--n;return!0}restoreScopeItem(e,t,i){let l=this.restoreBeat(e.beat);if(l==null)return null;let n=Re.fromString(e.beat.id),s=e.node,r=s!=null?this.restoreNode(s,n,l):null;if(s!=null&&r==null)return null;let h=[];if(e.beats!=null){let f=0,m=e.beats;for(;f<m.length;){let g=m[f];++f;let w=this.restoreBeat(g);if(w==null)return null;h.push(w)}}let o=e.state!=null?this.restoreState(null,e.state):null,u=e.head,c=u!=null?this.restoreNode(u,n,l):null;if(u!=null&&c==null)return null;let _=null;return e.insertion!=null&&t!=null&&(_=this.restoreInsertion(e.insertion,t,i)),new pl(null,l,r,h,o,c,_)}restoreInsertion(e,t,i){if(i.h.hasOwnProperty(e))return i.h[e];let l=e==null?"null":""+e,n=We.field(t,l);if(n==null)return null;let s=null;if(n.origin!=null){let h=Re.fromString(n.origin.id),a=this.lens.getNodeById(h);a!=null&&a.type()==n.origin.type&&(s=a)}let r=new wl(e,s);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 u=this.restoreChoiceOption(o,t,i);u!=null&&r.options.push(u)}}if(n.stack!=null){r.stack=[];let h=0,a=n.stack;for(;h<a.length;){let o=a[h];++h;let u=this.restoreScopeItem(o,t,i);u!=null&&r.stack.push(u)}}if(n.parentPartialOptions!=null){r.parentPartialOptions=[];let h=0,a=n.parentPartialOptions;for(;h<a.length;){let o=a[h];++h;let u=this.restoreChoiceOption(o,t,i);u!=null&&r.parentPartialOptions.push(u)}r.parentNextOptionIndex=n.parentNextOptionIndex!=null?n.parentNextOptionIndex:0}return r}restoreChoiceOption(e,t,i){let l=null;if(e.node!=null){let r=Re.fromString(e.node.id),h=this.lens.getNodeById(r);h!=null&&h.type()==e.node.type&&(l=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 kl(o.closing==!0,o.value,o.offset))}n=r}let s=null;return e.insertion!=null&&t!=null&&(s=this.restoreInsertion(e.insertion,t,i)),new yl(e.text,n,e.disabled!=!0,l,s)}restoreBeatToResume(e){let t=null;if(e.length>0){let i=e[0];if(t=this.restoreBeat(i.beat),t!=null){let l=t;do l=this.lens.getFirstParentOfType(l,Me),l!=null&&(t=l);while(l!=null)}}return t}restoreNode(e,t,i){let l=i.id.thisVal.high>>16&65535,n=t.thisVal.high>>16&65535,s=(l>=32768?l-65536:l)+32768-((n>=32768?n-65536:n)+32768),r=Re.fromString(e.id);if(r==t)return i;let h=r.thisVal.high>>16&65535,o=(h>=32768?h-65536:h)+32768+s-32768;o<0&&(o=o+65536&65535),r.thisVal=new Di(r.thisVal.high&65535|o<<16,r.thisVal.low);let u=this.lens.getNodeById(r);return u!=null&&u.type()==e.type?u:null}restoreBeat(e){return this.lens.findBeatByPathFromNode(e.path,this.script)}restoreState(e,t){let i=e!=null?e.fields:null,l=this.restoreFields(i??null,t);return e==null&&(e=new Ii(this,null,l,null)),e}restoreCharacters(e){let t=0,i=We.fields(e);for(;t<i.length;){let l=i[t];++t;let n=We.field(e,l);if(Object.prototype.hasOwnProperty.call(this.topLevelCharacters.h,l))this.restoreCharacter(this.topLevelCharacters.h[l],n);else{let s=this.restoreCharacter(null,n);this.topLevelCharacters.h[l]=s}}}restoreNodeStates(e){let t=0,i=We.fields(e);for(;t<i.length;){let l=i[t];++t;let n=Re.fromString(l),s=We.field(e,l),r=this.restoreState(null,s),h=n.thisVal;this.nodeStates.map._set(h.high,h.low,r)}}restoreCharacter(e,t){let i=e!=null?e.fields:null,l=this.restoreFields(i??null,t);return e==null&&(e=new cl(this,null,l,null)),e}restoreFields(e,t){if(t==null||t.fields==null)return e;e==null&&(e=ne.createFields(this,t.type));let i=t.fields;if(ne.isFields(e)){let l=0,n=We.fields(i);for(;l<n.length;){let s=n[l];++l,ne.setField(this,e,s,this.restoreValue(We.field(i,s)))}}else{let l=0,n=We.fields(i);for(;l<n.length;){let s=n[l];++l,e[s]=this.restoreValue(We.field(i,s))}}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(re.isArray(e)){let t=re.arrayLength(e),i=re.createArray(),l=0,n=t;for(;l<n;){let s=l++;re.arrayPush(i,this.restoreValue(re.arrayGet(e,s)))}return i}return this.restoreFields(null,e)}initializeTopLevelFunctions(e){if(this.builtins=new Bl(this),this.builtins.bindAll(this.topLevelFunctions),e!=null){let r=e,h=r,a=We.fields(r),o=0;for(;o<a.length;){let u=a[o++],c=h[u],f=u,m=c;this.topLevelFunctions.h[f]=m}}let t=this.topLevelFunctions.h,i=t,l=Object.keys(t),n=l.length,s=0;for(;s<n;){let r=l[s++],h=r,a=i[r],o=h,u=a;o.startsWith("string_")?this.stringHelpers.h[p.substr(o,7,null)]=u:o.startsWith("array_")?this.arrayHelpers.h[p.substr(o,6,null)]=u:o.startsWith("map_")?this.mapHelpers.h[p.substr(o,4,null)]=u:o.startsWith("beat_")&&(this.beatHelpers.h[p.substr(o,5,null)]=u)}}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 l=e[i];++i,this.stringLiteralProcessors.push(l)}}}initializeTopLevelFunction(e){if(e.name!=null){if(!e.external||!Object.prototype.hasOwnProperty.call(this.topLevelFunctions.h,e.name)){let t=new Ji;try{let i=t.process(e.code+(e.external?" {}":"")),l=new tl;l.allowJSON=!0,l.allowTypes=!0;let n=l.parseString(i),r=new Ll(this).execute(n);this.topLevelFunctions.h[e.name]=r}catch(i){let l=b.caught(i).unwrap();throw b.thrown(new fe("Failed to parse function code: "+(l==null?"null":le.string(l)),e.pos))}}}else throw b.thrown(new fe("Top level function must have a name",e.pos))}wrapNext(e){let t=new ql;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=b.caught(e).unwrap();throw this.flushing=!1,b.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 b.thrown(new fe("Top level temporary states are not allowed",e.pos));let t=0,i=e.fields;for(;t<i.length;){let l=i[t];++t;let n=this.evaluateExpression(l.value);ne.setField(this,this.topLevelState.fields,l.name,n),this.isOriginalScriptExpression(l.value)&&ne.setField(this,this.topLevelState.originalFields,l.name,n)}}initializeTopLevelBeat(e){if(Object.prototype.hasOwnProperty.call(this.topLevelBeats.h,e.name))throw b.thrown(new fe("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 b.thrown(new fe("Duplicate top level character: "+e.name,e.pos));let t=new cl(this,e,null,null);this.topLevelCharacters.h[e.name]=t;let i=0,l=e.fields;for(;i<l.length;){let n=l[i];++i;let s=this.evaluateExpression(n.value);ne.setField(this,t.fields,n.name,s),this.isOriginalScriptExpression(n.value)&&ne.setField(this,t.originalFields,n.name,s)}}initializeState(e,t){let i=null;if(e.temporary)t.state==null&&(t.state=new Ii(this,e,null,null)),i=t.state;else{let s=t.node.id.thisVal;if(i=this.nodeStates.map._get(s.high,s.low),i==null){i=new Ii(this,e,null,null);let r=t.node.id.thisVal;this.nodeStates.map._set(r.high,r.low,i)}}let l=0,n=e.fields;for(;l<n.length;){let s=n[l];if(++l,!ne.fieldExists(this,i.fields,s.name)){let r=this.evaluateExpression(s.value);ne.setField(this,i.fields,s.name,r),!e.temporary&&this.isOriginalScriptExpression(s.value)&&ne.setField(this,i.originalFields,s.name,r)}}}finish(){this.finishTrigger=null,this.handleFinish!=null&&this.handleFinish(this)}transitionToBeat(e){for(;this.pop(););this.nextScopeId=1,this.nextInsertionId=1,this.pendingChoiceOptions=null,this._choiceEvalTexts.length=0,this._choiceEvalEnabled.length=0;let t=this.wrapNext(Te(this,this.finish));this.finishTrigger=t,this.evalBeatRun(e,t.cb),t.sync=!1}evalNode(e,t){switch(te.getClass(e)){case Ui:this.evalAlternative(e,t);break;case di:this.evalAssignment(e,t);break;case Me:this.evalBeatDecl(e,t);break;case Rt:this.evalCall(e,t);break;case Et:this.evalChoiceOption(e,t);break;case mi:this.evalChoice(e,t);break;case ti:this.evalDialogue(e,t);break;case gi:this.evalIf(e,t);break;case Wt:this.evalStateDecl(e,t);break;case ci:this.evalText(e,t);break;case Mi:this.evalTransition(e);break;default:let i=te.getClass(e);throw b.thrown(new fe("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 b.thrown(new fe("Duplicate beat with name: "+e.name,e.pos));this.get_currentScope().beats.push(e),t()}evalNodeBody(e,t,i,l,n){this.push(new pl(null,e,t,null,null,null,l));let s=0,r=null,h=this.get_currentInsertion(),a=this;r=function(){if((h!=null?h.options:null)!=null)a.pop(),n();else if(s<i.length){let o=i[s];a.get_currentScope().head=o,s+=1;let u=a.wrapNext(r);a.evalNode(o,u.cb),u.sync=!1}else a.pop(),n()},r()}evalBeatRun(e,t){this.incrementBeatVisitCount(e),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),l=this.evaluateString(i);this.handleDialogue(this,null,l.text,l.tags,t)}evalDialogue(e,t){if(e.condition!=null&&!this.evaluateCondition(e.condition)){t();return}let i=this.getTranslatedString(e,e.content),l=this.evaluateString(i);this.handleDialogue(this,e.character,l.text,l.tags,t)}evalChoice(e,t){let i=this.pendingChoiceOptions;if(i!=null){this.pendingChoiceOptions=null,this._choiceEvalTexts.length=0,this._choiceEvalEnabled.length=0;let r=0;for(;r<i.length;){let h=i[r];++r,this._choiceEvalTexts.push(h.text),this._choiceEvalEnabled.push(h.enabled)}this.presentChoice(e,i,t);return}let l=[],n=this,s=this.wrapNext(function(){n.presentChoice(e,l,t)});this.evalChoiceOptionsAndInsertions(this.get_currentScope().beat,e,l,s.cb),s.sync=!1}presentChoice(e,t,i){let l=this.get_currentInsertion();if(l!=null&&l.options==null){l.stack=[].concat(this.stack),l.options=t,i();return}let n=0,s=e.options;for(;n<s.length;){let u=s[n];if(++n,u.insertion!=null){this.pendingChoiceOptions=t;break}}let r=-1,h=this,a=function(){h._choiceEvalTexts.length=0,h._choiceEvalEnabled.length=0},o=this.wrapNext(function(){if(h.pendingChoiceOptions=null,r>=0&&r<t.length){let u=t[r];u.node.once&&h.setChoiceOptionChosen(u.node);let c=function(){a(),i()};if(u.insertion!=null){let _=h.stack.length;for(;h.stack.length>0;)h.stack.pop();let f=0,m=u.insertion.stack;for(;f<m.length;){let w=m[f];++f,w.insertion!=null&&(w.insertion=null),h.stack.push(w)}let g=h.stack[h.stack.length-1];h.push(new pl(null,g.beat,h.lens.getParentNode(u.node),null,null,u.node,null)),h.resumeFromLevel(_,c)}else h.evalChoiceOption(u.node,c)}else a(),i()});this.handleChoice(this,t,function(u){r=u,o.cb()}),o.sync=!1}evalChoiceOptionsAndInsertions(e,t,i,l,n){let s=t.options;this._choiceEvalTexts.length=0,this._choiceEvalEnabled.length=0;let r=n??0,h=null,a=null,o=this;h=function(){if(a!=null&&a.options!=null){let u=0,c=a.options.length;for(;u<c;){let _=u++,f=a.options[_];i.push(f),o._choiceEvalTexts.push(f.text),o._choiceEvalEnabled.push(f.enabled)}a=null}if(r<s.length){let u=s[r];r+=1;let _=!(u.once&&o.isChoiceOptionChosen(u))&&(u.condition==null||o.evaluateCondition(u.condition));if(u.text!=null){let f=o.wrapNext(h),m=o.getTranslatedString(u,u.text),g=o.evaluateString(m);i.push(new yl(g.text,g.tags,_,u,o.get_currentInsertion())),o._choiceEvalTexts.push(g.text),o._choiceEvalEnabled.push(_),f.cb(),f.sync=!1}else if(u.insertion!=null){let f=o.wrapNext(h);_?(a=new wl(o.nextInsertionId++,u.insertion),a.parentPartialOptions=[].concat(i),a.parentNextOptionIndex=r,o.evalInsertion(a,f.cb)):f.cb(),f.sync=!1}else throw b.thrown(new fe("Invalid choice option",u.pos))}else l()},h()}evalInsertion(e,t){let i=e.origin.target,l=null,n=this.stack.length-1;for(;n>=0;){let r=this.stack[n].beatByName(i);if(r!=null){l=r;break}--n}if(l==null&&Object.prototype.hasOwnProperty.call(this.topLevelBeats.h,i)&&(l=this.topLevelBeats.h[i]),l==null)throw b.thrown(new fe("Beat "+i+" not found",this.script.pos));this.evalNodeBody(l,l,l.body,e,t)}evalChoiceOption(e,t){this.evalNodeBody(this.get_currentScope().beat,e,e.body,null,t)}evalIf(e,t){let l=this.evaluateCondition(e.condition)?e.thenBranch:e.elseBranch;l!=null&&l.body.length>0?this.evalNodeBody(this.get_currentScope().beat,l,l.body,null,t):t()}evalAlternative(e,t){if(e.items.length==0){t();return}switch(e.mode){case 0:let i=this.getAlternativeVisitCount(e),l=i<e.items.length?i:e.items.length-1;this.setAlternativeVisitCount(e,i+1);let n=e.items[l];this.evalNodeBody(this.get_currentScope().beat,n,n.body,null,t);break;case 1:let s=this.getAlternativeVisitCount(e),r=s%e.items.length;this.setAlternativeVisitCount(e,s+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 u=this.builtins.random(0,e.items.length-1),c=e.items[u];this.evalNodeBody(this.get_currentScope().beat,c,c.body,null,t);break;case 4:let _=[],f=0,m=e.items.length;for(;f<m;){let y=f++;_.push(y)}let g=_,w=g.length-1;for(;w>0;){let y=this.builtins.random(0,w),T=g[w];g[w]=g[y],g[y]=T,--w}this.evalShuffledItems(e,g,0,t);break}}evalShuffledItems(e,t,i,l){if(i>=t.length){l();return}let n=e.items[t[i]],s=this;this.evalNodeBody(this.get_currentScope().beat,n,n.body,null,function(){s.evalShuffledItems(e,t,i+1,l)})}getBeatVisitCount(e){let t=e.id.thisVal,i=this.nodeStates.map._get(t.high,t.low);if(i==null)return 0;let l=ne.getField(this,i.fields,"_visitCount");return l??0}incrementBeatVisitCount(e){let t=e.id.thisVal,i=this.nodeStates.map._get(t.high,t.low);if(i==null){i=new Ii(this,e,null,null);let s=e.id.thisVal;this.nodeStates.map._set(s.high,s.low,i)}let l=ne.getField(this,i.fields,"_visitCount"),n=l??0;ne.setField(this,i.fields,"_visitCount",n+1)}getAlternativeVisitCount(e){let t=e.id.thisVal,i=this.nodeStates.map._get(t.high,t.low);if(i==null)return 0;let l=ne.getField(this,i.fields,"_visitCount");return l??0}setAlternativeVisitCount(e,t){let i=e.id.thisVal,l=this.nodeStates.map._get(i.high,i.low);if(l==null){l=new Ii(this,e,null,null);let n=e.id.thisVal;this.nodeStates.map._set(n.high,n.low,l)}ne.setField(this,l.fields,"_visitCount",t)}isChoiceOptionChosen(e){let t=e.id.thisVal,i=this.nodeStates.map._get(t.high,t.low);if(i==null)return!1;let l=ne.getField(this,i.fields,"_chosen");return l??!1}setChoiceOptionChosen(e){let t=e.id.thisVal,i=this.nodeStates.map._get(t.high,t.low);if(i==null){i=new Ii(this,e,null,null);let l=e.id.thisVal;this.nodeStates.map._set(l.high,l.low,i)}ne.setField(this,i.fields,"_chosen",!0)}evalAssignment(e,t){let i=this.resolveAssignmentTarget(e.target),l=this.evaluateExpression(e.value),n;switch(e.op._hx_index){case 21:n=this.performOperation(x.OpPlus,this.readAccess(i),l,e.pos);break;case 22:n=this.performOperation(x.OpMinus,this.readAccess(i),l,e.pos);break;case 23:n=this.performOperation(x.OpMultiply,this.readAccess(i),l,e.pos);break;case 24:n=this.performOperation(x.OpDivide,this.readAccess(i),l,e.pos);break;case 20:case 25:n=l;break;default:throw b.thrown(new fe("Invalid assignment operator",e.pos))}this.writeAccess(i,n),t()}isOriginalScriptExpression(e){switch(te.getClass(e)){case Qt:let t=e;return this.isOriginalScriptExpression(t.left)?this.isOriginalScriptExpression(t.right):!1;case ut:case pi:case Rt:return!1;case Ke:let i=e,l=i.literalType;switch(l._hx_index){case 0:case 1:case 2:return!0;case 3:let a=i.value,o=0;for(;o<a.length;){let f=a[o];if(++o,f instanceof at&&!this.isOriginalScriptExpression(f))return!1}return!0;case 4:let u=l.style,c=i.value,_=0;for(;_<c.length;){let f=c[_];if(++_,!this.isOriginalScriptExpression(f.value))return!1}return!0}break;case Tt:let n=e,s=0,r=n.parts;for(;s<r.length;){let a=r[s];++s;let o=a.partType;switch(o._hx_index){case 0:let u=o.text;continue;case 1:let c=o.expr;return!1;case 2:let _=o.closing,f=o.expr;if(!this.isOriginalScriptExpression(f))return!1;break}}return!0;case Ki:let h=e;return this.isOriginalScriptExpression(h.operand)}return!1}isBeatCall(e,t){return t==null&&(t=-1),e instanceof Rt?this.resolveBeatFromCall(e,t)!=null:!1}resolveBeatByName(e,t){t==null&&(t=-1);let i=t==-1?this.stack.length-1:t;for(;i>=0;){let l=this.stack[i].beatByName(e);if(l!=null)return l;--i}return this.topLevelBeats.h[e]}resolveBeatFromCall(e,t){if(t==null&&(t=-1),e.target instanceof ut){let i=e.target;if(i.target==null){let l=this.resolveBeatByName(i.name,t);if(l!=null)return l}}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,l=this.stack.length-1;for(;l>=0;){let s=this.stack[l].beatByName(t);if(s!=null){i=s;break}--l}if(i==null&&Object.prototype.hasOwnProperty.call(this.topLevelBeats.h,t)&&(i=this.topLevelBeats.h[t]),i==null)throw b.thrown(new fe("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 l=this.translations.h[i];if(l!=null)return l}}return t}findHashCommentId(e,t){return Mt.findHashComment(e,t)}evaluateString(e){let t=0,i=this.stringLiteralProcessors.length;for(;t<i;){let f=t++;e=this.stringLiteralProcessors[f](e)}let l="",n=[],s=0,r=e.parts.length,h=e.quotes!=0,a=e.quotes!=0,o=e.quotes!=0,u=-1;if(!h){let f=r-1;e:for(;f>=0;){let g=e.parts[f].partType;switch(g._hx_index){case 0:let w=g.text;u=f;break e;case 1:let y=g.expr;break e;case 2:let T=g.closing,E=g.expr;--f;break}}}let c=0,_=r;for(;c<_;){let f=c++,g=e.parts[f].partType;switch(g._hx_index){case 0:let w=g.text;h||(w=Ae.ltrim(w)),f==u&&(w=Ae.rtrim(w)),o||(w=this.stripStringComments(w)),a||(w=this.stripStringIndent(w));let y=w.length;y>0&&(h=!0);let T=!1,E=!1,C=!1,P=0,I=y;for(;P<I;){let L=P++,z=p.cca(w,L),D=z??-1;C?(D==110?l+=String.fromCodePoint(10):D==114?l+=String.fromCodePoint(13):D==116?l+=String.fromCodePoint(9):l+=String.fromCodePoint(D),C=!1,T=!1,E=!1):D==92?(C=!0,T=!1,E=!1):D==36?(T?(l+=String.fromCodePoint(D),T=!1):T=!0,E=!1):D==35?(E?(l+=String.fromCodePoint(D),E=!1):E=!0,T=!1):(E&&(l+=String.fromCodePoint(35),E=!1),l+=String.fromCodePoint(D))}E&&(l+=String.fromCodePoint(35)),s+=y;break;case 1:let v=g.expr;if(h=!0,v instanceof ut){let L=v,z=this.resolveAccess(L,L.target,L.name);if(z._hx_index==2){let D=z.pos,O=z.name,q=this.evaluateExpression(v),M=ne.getField(this,q,"name"),U=M??O,K=this.valueToString(U);s+=K.length,l+=K==null?"null":""+K}else{let D=this.evaluateExpression(v),O=this.valueToString(D);s+=O.length,l+=O==null?"null":""+O}}else{let L=this.evaluateExpression(v),z=this.valueToString(L);s+=z.length,l+=z==null?"null":""+z}break;case 2:let F=g.closing,B=g.expr,A=this.evaluateString(B).text;n.push(new kl(F,A,s));break}}return{text:l,tags:n}}pluralPipeProcess(e){let t=-1,i=!1,l=null,n=0,s=e.parts.length;for(;n<s;){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 f,m=e.parts[t].partType;if(m._hx_index==1?f=m.expr:f=null,f!=null){if(!i){let g=[],w=0,y=r;for(;w<y;){let T=w++;g.push(e.parts[T])}l=g,i=!0}this.transformPipeRaw(o,f,h.pos,l);continue}}break;case 1:let u=a.expr;t=r;break;case 2:let c=a.closing,_=a.expr;break}i&&l.push(h)}return i?new Tt(e.id,e.pos,e.quotes,l):e}rawTextHasUnescapedPipe(e){let t=e.length,i=0;for(;i<t;){let l=p.cca(e,i),n=l??-1;if(n==92){i+=2;continue}if(n==124)return!0;++i}return!1}transformPipeRaw(e,t,i,l){let n=e.length,s=0,r=0;for(;s<n;){let h=p.cca(e,s),a=h??-1;if(a==92&&s+1<n){s+=2;continue}if(a==40){let o=-1,u=-1,c=s+1;for(;c<n;){let _=p.cca(e,c),f=_??-1;if(f==92&&c+1<n){c+=2;continue}if(f==124&&o==-1)o=c;else if(f==41){u=c;break}++c}if(o!=-1&&u!=-1&&o>s+1&&u>o+1){let _=s+1,f=o-s-1,m=f!=null?p.substr(e,_,f):p.substr(e,_,null),g=o+1,w=u-o-1,y=w!=null?p.substr(e,g,w):p.substr(e,g,null);if(s>r){let T=s-r;l.push(new Je(Re.UNDEFINED,i,ze.Raw(T!=null?p.substr(e,r,T):p.substr(e,r,null))))}l.push(new Je(Re.UNDEFINED,i,ze.Expr(this.makePluralCall(t,m,y,i)))),s=u+1,r=s;continue}}if(a==124){let o=s;for(;o>r;){let w=p.cca(e,o-1),y=w??-1;if(y==32||y==9||y==10||y==124||y==40||y==41)break;--o}let u=s+1;for(;u<n;){let w=p.cca(e,u),y=w??-1;if(y==32||y==9||y==10||y==124||y==40||y==41)break;++u}let c=s-o,_=c!=null?p.substr(e,o,c):p.substr(e,o,null),f=s+1,m=u-s-1,g=m!=null?p.substr(e,f,m):p.substr(e,f,null);if(_.length>0&&g.length>0){if(o>r){let w=o-r;l.push(new Je(Re.UNDEFINED,i,ze.Raw(w!=null?p.substr(e,r,w):p.substr(e,r,null))))}l.push(new Je(Re.UNDEFINED,i,ze.Expr(this.makePluralCall(t,_,g,i)))),s=u,r=s;continue}}++s}if(r<n){let h=n-r;l.push(new Je(Re.UNDEFINED,i,ze.Raw(h!=null?p.substr(e,r,h):p.substr(e,r,null))))}}makePluralCall(e,t,i,l){let n=new ut(Re.UNDEFINED,l,null,"plural"),s=new Tt(Re.UNDEFINED,l,1,[new Je(Re.UNDEFINED,l,ze.Raw(t))]),r=new Tt(Re.UNDEFINED,l,1,[new Je(Re.UNDEFINED,l,ze.Raw(i))]);return new Rt(Re.UNDEFINED,l,n,[e,s,r])}stripStringIndent(e){if(e.indexOf(`
35
35
  `)==-1)return e;let t=e.split(`
36
36
  `),i=-1;if(t[0].length>0){let s=0;for(;s<t[0].length;){let r=p.cca(t[0],s),h=r??-1;if(h!=32&&h!=9)break;++s}s>0&&s<t[0].length&&(i=s)}let l=1,n=t.length;for(;l<n;){let s=l++,r=t[s];if(r.length==0)continue;let h=0;for(;h<r.length;){let a=p.cca(r,h),o=a??-1;if(o!=32&&o!=9)break;++h}h<r.length&&(i==-1||h<i)&&(i=h)}if(i>0){let s=1,r=t.length;for(;s<r;){let h=s++;if(t[h].length>0){let a=t[h],o=null;t[h]=o!=null?a.substring(i,o):a.substring(i)}}e=t.join(`
37
- `)}return e}stripStringComments(e){let t="",i=e.length,l=0;for(;l<i;){let n=p.cca(e,l),s=n??-1,r;if(s==47&&l+1<i){let a=p.cca(e,l+1);r=(a??-1)==47}else r=!1;if(r){for(;;){let a;if(l<i){let o=p.cca(e,l);a=(o??-1)!=10}else a=!1;if(!a)break;++l}continue}let h;if(s==47&&l+1<i){let a=p.cca(e,l+1);h=(a??-1)==42}else h=!1;if(h){let a;if(l>0){let u=p.cca(e,l-1);a=(u??-1)==32}else a=!1;for(l+=2;;){let u;if(l+1<i){let c,_=p.cca(e,l);if((_??-1)==42){let f=p.cca(e,l+1);c=(f??-1)==47}else c=!1;u=!c}else u=!1;if(!u)break;++l}l+=2;let o;if(l<i){let u=p.cca(e,l);o=(u??-1)==32}else o=!1;a&&o&&++l,!a&&!o&&l<i&&(t+=String.fromCodePoint(32));continue}t+=String.fromCodePoint(s),++l}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 ut){let n=e.target;if(n.target==null){let s=this.evaluateExpression(e.target);if(s!=null&&We.isFunction(s)){let r=[],h=0,a=e.args;for(;h<a.length;){let u=a[h];++h,r.push(this.evaluateExpression(u))}let o=r;try{let u=s.apply(null,o);if(u!=null&&u instanceof il){if(t==null)throw b.thrown(new fe("Cannot call async function in expression",e.pos));u.func(t)}else t?.();return u}catch(u){let c=b.caught(u).unwrap();if(c instanceof Ce){let _=c;throw b.thrown(new fe("Error when evaluating function ("+_.pmin+"-"+_.pmax+"): "+ne.string(_.e),e.pos))}throw b.thrown(new fe("Error when calling function: "+ne.string(c),e.pos))}}}else{let s=this.evaluateExpression(n.target),r=null;if(typeof s=="string"?r=le.getStringHelper(this,n.name):re.isArray(s)?r=le.getArrayHelper(this,n.name):s instanceof Me?r=le.getBeatHelper(this,n.name):le.isFields(s)&&(r=le.getMapHelper(this,n.name)),r!=null&&We.isFunction(r)){let h=[],a=0,o=e.args;for(;a<o.length;){let _=o[a];++a,h.push(this.evaluateExpression(_))}let u=h;u.splice(0,0,s);let c=r.apply(null,u);if(c!=null&&c instanceof il){if(t==null)throw b.thrown(new fe("Cannot call async function in expression",e.pos));c.func(t)}else t?.();return c}else if(r==null&&!(typeof s=="string"||re.isArray(s)||le.isFields(s))){let h=We.getProperty(s,n.name);if(We.isFunction(h)){let a=[],o=0,u=e.args;for(;o<u.length;){let f=u[o];++o,a.push(this.evaluateExpression(f))}let c=a,_=h.apply(s,c);if(_!=null&&_ instanceof il){if(t==null)throw b.thrown(new fe("Cannot call async function in expression",e.pos));_.func(t)}else t?.();return _}}}}let i=this.printLoreline(e.target),l;throw i!=null?l=i:l=te.getClass(e.target).__name__,b.thrown(new fe("Invalid call target: "+l,e.pos))}evaluateArrayLiteral(e){let t=[],i=0;for(;i<e.length;){let l=e[i];++i,t.push(this.evaluateExpression(l))}return t}evaluateObjectLiteral(e){let t=new Ee,i=0;for(;i<e.length;){let l=e[i];++i;let n=l.name,s=this.evaluateExpression(l.value);t.h[n]=s}return t}evaluateExpression(e){switch(te.getClass(e)){case ut:let t=e,i=this.resolveAccess(t,t.target,t.name);return this.readAccess(i);case ci:let l=e,n=this.evaluateExpression(l.target),s=this.evaluateExpression(l.index);if(re.isArray(n)&&(typeof s=="number"&&(s|0)===s||typeof s=="number")){let y=s|0;if(y<0||y>=re.arrayLength(n))throw b.thrown(new fe("Array index out of bounds: "+y,l.pos));return re.arrayGet(n,y)}else if(typeof s=="string"){if(n==null)throw b.thrown(new fe("Cannot access field '"+(s==null?"null":ne.string(s))+"' of null",l.pos));return le.getField(this,n,s)}else throw b.thrown(new fe("Invalid array access",l.pos));break;case Qt:let r=e,h=this.evaluateExpression(r.left),a=this.evaluateExpression(r.right);return this.performOperation(r.op,h,a,r.pos);case Rt:return this.evaluateFunctionCall(e,null);case Ke:let o=e,u=o.literalType;switch(u._hx_index){case 0:case 1:case 2:return o.value;case 3:return this.evaluateArrayLiteral(o.value);case 4:let y=u.style;return this.evaluateObjectLiteral(o.value)}break;case Tt:let c=e;if(c.parts.length==1&&c.quotes==0){let y=c.parts[0].partType;if(y._hx_index==1){let T=y.expr;return this.evaluateExpression(T)}else return this.evaluateString(c).text}else return this.evaluateString(c).text;break;case $i:let _=e;return this.evaluateCondition(_.condition)?this.evaluateExpression(_.trueExpr):this.evaluateExpression(_.falseExpr);case Ki:let m=e,g=this.evaluateExpression(m.operand);switch(m.op._hx_index){case 27:if(typeof g=="number"&&(g|0)===g)return-g;if(typeof g=="number")return-g;throw b.thrown(new fe("Invalid unary operation",m.pos));break;case 39:if(typeof g=="boolean")return!g;if(typeof g=="string"){let y=g;return y!=null?y.length==0:!0}else if(g instanceof Array){let y=g;return y!=null?y.length==0:!0}else return typeof g=="number"&&(g|0)===g||typeof g=="number"?g==0:g==null;break;default:throw b.thrown(new fe("Invalid unary operation",m.pos))}break;default:let w=te.getClass(e);throw b.thrown(new fe("Unsupported expression type: "+w.__name__,e.pos))}}readAccess(e){switch(e._hx_index){case 0:let t=e.pos,i=e.obj,l=e.name;if(i==null)throw b.thrown(new fe("Cannot read field '"+l+"' of null",t));return le.getField(this,i,l);case 1:let n=e.pos,s=e.array,r=e.index;return re.arrayGet(s,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 b.thrown(new fe("Character not found: "+a,h));case 3:let o=e.pos,u=e.name;if(Object.prototype.hasOwnProperty.call(this.topLevelFunctions.h,u))return this.topLevelFunctions.h[u];throw b.thrown(new fe("Function not found: "+u,o));case 4:let c=e.pos;return e.beat}}writeAccess(e,t){switch(e._hx_index){case 0:let i=e.pos,l=e.obj,n=e.name;if(l==null)throw b.thrown(new fe("Cannot set field '"+n+"' of null",i));le.setField(this,l,n,t);break;case 1:let s=e.pos,r=e.array,h=e.index;re.arraySet(r,h,t);break;case 2:let a=e.pos,o=e.name;throw b.thrown(new fe("Cannot overwrite character: "+o,a));case 3:let u=e.pos,c=e.name;throw b.thrown(new fe("Cannot overwrite function: "+c,u));case 4:let _=e.pos,f=e.beat;throw b.thrown(new fe("Cannot overwrite beat: "+f.name,_))}}resolveAssignmentTarget(e){switch(te.getClass(e)){case ut:let t=e;return this.resolveAccess(t,t.target,t.name);case ci:let i=e,l=this.evaluateExpression(i.target),n=this.evaluateExpression(i.index);if(re.isArray(l)&&(typeof n=="number"&&(n|0)===n||typeof n=="number")){let s=n|0;return fi.ArrayAccess(i.pos,l,s)}else throw b.thrown(new fe("Invalid array access target",i.pos));break;default:throw b.thrown(new fe("Invalid assignment target",e.pos))}}resolveAccess(e,t,i){if(t!=null){let h=this.evaluateExpression(t);if(h==null){let a=te.getClass(t)==ut?t.name:null;throw b.thrown(new fe(a!=null?"Cannot access field '"+i+"' of undefined variable '"+a+"'":"Cannot access field '"+i+"' of null value",t.pos))}return fi.FieldAccess(t.pos,h,i)}let l=this.stack.length-1;for(;l>=0;){let h=this.stack[l];if(h.state!=null&&le.fieldExists(this,h.state.fields,i)){let a=e!=null?e.pos:null,o;if(a!=null)o=a;else{let u=this.get_currentScope(),c=u!=null?u.node:null;o=c!=null?c.pos:null}return fi.FieldAccess(o??this.script.pos,h.state.fields,i)}if(h.node!=null){let a=h.node.id.thisVal,o=this.nodeStates.map._get(a.high,a.low);if(o!=null&&le.fieldExists(this,o.fields,i)){let u=e!=null?e.pos:null,c;if(u!=null)c=u;else{let _=this.get_currentScope(),f=_!=null?_.node:null;c=f!=null?f.pos:null}return fi.FieldAccess(c??this.script.pos,o.fields,i)}}--l}if(le.fieldExists(this,this.topLevelState.fields,i)){let h=e!=null?e.pos:null,a;if(h!=null)a=h;else{let o=this.get_currentScope(),u=o!=null?o.node:null;a=u!=null?u.pos:null}return fi.FieldAccess(a??this.script.pos,this.topLevelState.fields,i)}if(Object.prototype.hasOwnProperty.call(this.topLevelCharacters.h,i)){let h=e!=null?e.pos:null,a;if(h!=null)a=h;else{let o=this.get_currentScope(),u=o!=null?o.node:null;a=u!=null?u.pos:null}return fi.CharacterAccess(a??this.script.pos,i)}if(Object.prototype.hasOwnProperty.call(this.topLevelFunctions.h,i)){let h=e!=null?e.pos:null,a;if(h!=null)a=h;else{let o=this.get_currentScope(),u=o!=null?o.node:null;a=u!=null?u.pos:null}return fi.FunctionAccess(a??this.script.pos,i)}let n=this.resolveBeatByName(i);if(n!=null){let h=e!=null?e.pos:null,a;if(h!=null)a=h;else{let o=this.get_currentScope(),u=o!=null?o.node:null;a=u!=null?u.pos:null}return fi.BeatAccess(a??this.script.pos,n)}if(!this.strictAccess){let h=e!=null?e.pos:null,a;if(h!=null)a=h;else{let o=this.get_currentScope(),u=o!=null?o.node:null;a=u!=null?u.pos:null}return fi.FieldAccess(a??this.script.pos,this.topLevelState.fields,i)}let s=e!=null?e.pos:null,r;if(s!=null)r=s;else{let h=this.get_currentScope(),a=h!=null?h.node:null;r=a!=null?a.pos:null}throw b.thrown(new fe("Undefined variable: "+i,r??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,l){let n=pe.typeof(t),s=pe.typeof(i);switch(e._hx_index){case 26:switch(n._hx_index){case 1:switch(s._hx_index){case 1:case 2:return parseFloat(ne.string(t))+parseFloat(ne.string(i));case 6:if(s.c==String)return ne.string(t)+ne.string(i);{let g="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(s),w=l,y;if(w!=null)y=w;else{let T=this.get_currentScope(),E=T!=null?T.node:null;y=E!=null?E.pos:null}throw b.thrown(new fe(g,y??this.script.pos))}break;default:let _="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(s),f=l,m;if(f!=null)m=f;else{let g=this.get_currentScope(),w=g!=null?g.node:null;m=w!=null?w.pos:null}throw b.thrown(new fe(_,m??this.script.pos))}break;case 2:switch(s._hx_index){case 1:case 2:return parseFloat(ne.string(t))+parseFloat(ne.string(i));case 6:if(s.c==String)return ne.string(t)+ne.string(i);{let g="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(s),w=l,y;if(w!=null)y=w;else{let T=this.get_currentScope(),E=T!=null?T.node:null;y=E!=null?E.pos:null}throw b.thrown(new fe(g,y??this.script.pos))}break;default:let _="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(s),f=l,m;if(f!=null)m=f;else{let g=this.get_currentScope(),w=g!=null?g.node:null;m=w!=null?w.pos:null}throw b.thrown(new fe(_,m??this.script.pos))}break;case 6:if(n.c==String)return ne.string(t)+ne.string(i);if(s._hx_index==6){if(s.c==String)return ne.string(t)+ne.string(i);{let _="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(s),f=l,m;if(f!=null)m=f;else{let g=this.get_currentScope(),w=g!=null?g.node:null;m=w!=null?w.pos:null}throw b.thrown(new fe(_,m??this.script.pos))}}else{let _="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(s),f=l,m;if(f!=null)m=f;else{let g=this.get_currentScope(),w=g!=null?g.node:null;m=w!=null?w.pos:null}throw b.thrown(new fe(_,m??this.script.pos))}break;default:if(s._hx_index==6){if(s.c==String)return ne.string(t)+ne.string(i);{let _="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(s),f=l,m;if(f!=null)m=f;else{let g=this.get_currentScope(),w=g!=null?g.node:null;m=w!=null?w.pos:null}throw b.thrown(new fe(_,m??this.script.pos))}}else{let _="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(s),f=l,m;if(f!=null)m=f;else{let g=this.get_currentScope(),w=g!=null?g.node:null;m=w!=null?w.pos:null}throw b.thrown(new fe(_,m??this.script.pos))}}break;case 27:case 28:case 29:case 30:switch(n._hx_index){case 1:case 2:switch(s._hx_index){case 1:case 2:let w=parseFloat(ne.string(t)),y=parseFloat(ne.string(i));switch(e._hx_index){case 27:return w-y;case 28:return w*y;case 29:if(y==0){let I=l,v;if(I!=null)v=I;else{let F=this.get_currentScope(),B=F!=null?F.node:null;v=B!=null?B.pos:null}throw b.thrown(new fe("Division by zero",v??this.script.pos))}return w/y;case 30:if(y==0){let I=l,v;if(I!=null)v=I;else{let F=this.get_currentScope(),B=F!=null?F.node:null;v=B!=null?B.pos:null}throw b.thrown(new fe("Modulo by zero",v??this.script.pos))}return w%y;default:throw b.thrown("Unreachable")}break;default:let T;switch(e._hx_index){case 27:T="subtract";break;case 28:T="multiply";break;case 29:T="divide";break;case 30:T="modulo";break;default:T="perform operation on"}let E="Cannot "+T+" "+this.getTypeName(n)+" and "+this.getTypeName(s),C=l,P;if(C!=null)P=C;else{let I=this.get_currentScope(),v=I!=null?I.node:null;P=v!=null?v.pos:null}throw b.thrown(new fe(E,P??this.script.pos))}break;default:let _;switch(e._hx_index){case 27:_="subtract";break;case 28:_="multiply";break;case 29:_="divide";break;case 30:_="modulo";break;default:_="perform operation on"}let f="Cannot "+_+" "+this.getTypeName(n)+" and "+this.getTypeName(s),m=l,g;if(m!=null)g=m;else{let w=this.get_currentScope(),y=w!=null?w.node:null;g=y!=null?y.pos:null}throw b.thrown(new fe(f,g??this.script.pos))}break;case 31:case 32:let r=t instanceof Me&&typeof i=="string"?t.name==i:typeof t=="string"&&i instanceof Me?t==i.name:t instanceof Me&&i instanceof Me?t.name==i.name:t==i;switch(e._hx_index){case 31:return r;case 32:return!r;default:throw b.thrown("Unreachable")}break;case 33:case 34:case 35:case 36:switch(n._hx_index){case 1:case 2:switch(s._hx_index){case 1:case 2:let g=parseFloat(ne.string(t)),w=parseFloat(ne.string(i));switch(e._hx_index){case 33:return g>w;case 34:return g<w;case 35:return g>=w;case 36:return g<=w;default:throw b.thrown("Unreachable")}break;default:let y="Cannot compare "+this.getTypeName(n)+" and "+this.getTypeName(s),T=l,E;if(T!=null)E=T;else{let C=this.get_currentScope(),P=C!=null?C.node:null;E=P!=null?P.pos:null}throw b.thrown(new fe(y,E??this.script.pos))}break;default:let _="Cannot compare "+this.getTypeName(n)+" and "+this.getTypeName(s),f=l,m;if(f!=null)m=f;else{let g=this.get_currentScope(),w=g!=null?g.node:null;m=w!=null?w.pos:null}throw b.thrown(new fe(_,m??this.script.pos))}break;case 37:let h=e.word;if(n._hx_index==3)if(s._hx_index==3)switch(e._hx_index){case 37:let _=e.word;return t?i:!1;case 38:let f=e.word;return t?!0:i;default:throw b.thrown("Unreachable")}else{let _="Cannot perform logical operation on "+this.getTypeName(n)+" and "+this.getTypeName(s),f=l,m;if(f!=null)m=f;else{let g=this.get_currentScope(),w=g!=null?g.node:null;m=w!=null?w.pos:null}throw b.thrown(new fe(_,m??this.script.pos))}else{let _="Cannot perform logical operation on "+this.getTypeName(n)+" and "+this.getTypeName(s),f=l,m;if(f!=null)m=f;else{let g=this.get_currentScope(),w=g!=null?g.node:null;m=w!=null?w.pos:null}throw b.thrown(new fe(_,m??this.script.pos))}break;case 38:let a=e.word;if(n._hx_index==3)if(s._hx_index==3)switch(e._hx_index){case 37:let _=e.word;return t?i:!1;case 38:let f=e.word;return t?!0:i;default:throw b.thrown("Unreachable")}else{let _="Cannot perform logical operation on "+this.getTypeName(n)+" and "+this.getTypeName(s),f=l,m;if(f!=null)m=f;else{let g=this.get_currentScope(),w=g!=null?g.node:null;m=w!=null?w.pos:null}throw b.thrown(new fe(_,m??this.script.pos))}else{let _="Cannot perform logical operation on "+this.getTypeName(n)+" and "+this.getTypeName(s),f=l,m;if(f!=null)m=f;else{let g=this.get_currentScope(),w=g!=null?g.node:null;m=w!=null?w.pos:null}throw b.thrown(new fe(_,m??this.script.pos))}break;default:let o="Invalid operation: "+ne.string(e),u=l,c;if(u!=null)c=u;else{let _=this.get_currentScope(),f=_!=null?_.node:null;c=f!=null?f.pos:null}throw b.thrown(new fe(o,c??this.script.pos))}}valueToString(e){return this.valueToStringImpl(e,null)}valueToStringImpl(e,t){if(e==null)return"null";if(typeof e=="string")return e;if(typeof e=="boolean"||typeof e=="number"&&(e|0)===e||typeof e=="number")return e==null?"null":ne.string(e);t==null&&(t=[]);let i=0;for(;i<t.length;){let l=t[i];if(++i,l==e)return"..."}if(t.push(e),re.isArray(e)){let l=re.arrayLength(e),n="";n+="[";let s=0,r=l;for(;s<r;){let h=s++;h>0&&(n+=", "),n+=ne.string(this.valueToStringImpl(re.arrayGet(e,h),t))}return n+="]",t.pop(),n}if(e instanceof Me)return t.pop(),e.name;if(le.isFields(e)){let l=le.getFields(this,e);l.sort(function(h,a){return h<a?-1:h>a?1:0});let n="";n+="{";let s=0,r=l.length;for(;s<r;){let h=s++;h>0&&(n+=", "),n+=ne.string(l[h]),n+=": ",n+=ne.string(this.valueToStringImpl(le.getField(this,e,l[h]),t))}return n+="}",t.pop(),n}return t.pop(),e==null?"null":ne.string(e)}printLoreline(e){try{let t=new nl;return t.enableComments=!1,Ae.trim(t.print(e))}catch{return null}}}j["loreline.Interpreter"]=Yi.loreline.Interpreter=bl,bl.__name__="loreline.Interpreter",Object.assign(bl.prototype,{__class__:bl,__properties__:{get_currentInsertion:"get_currentInsertion",get_currentScope:"get_currentScope"}});class cn{static stringify(e,t){return t==null&&(t=!1),JSON.stringify(e,null,t?" ":null)}static parse(e){return JSON.parse(e)}}j["loreline.Json"]=cn,cn.__name__="loreline.Json";class N{static scriptFromJson(e){if(e==null)throw b.thrown("Cannot create Script from null JSON");let t=e.type;if(t!="Script")throw b.thrown("Expected Script node, got: "+t);let i=N.idFromJson(e),l=N.positionFromJson(e.pos),n=e.body,s=[],r=0;for(;r<n.length;){let o=n[r];++r,s.push(N.nodeFromJson(o))}let h=s,a=new pi(i,l,h);return a.indentSize=e.indentSize!=null?e.indentSize:2,N.applyComments(a,e),a}static nodeFromJson(e){if(e==null)return null;let t=e.type;switch(t){case"Access":return N.accessFromJson(e);case"Alternative":return N.alternativeFromJson(e);case"ArrayAccess":return N.arrayAccessFromJson(e);case"Assign":return N.assignFromJson(e);case"Beat":return N.beatFromJson(e);case"Binary":return N.binaryFromJson(e);case"Block":return N.blockFromJson(e);case"Call":return N.callFromJson(e);case"Character":return N.characterFromJson(e);case"Choice":return N.choiceStatementFromJson(e);case"Comment":return N.commentFromJson(e);case"Dialogue":return N.dialogueStatementFromJson(e);case"Field":return N.objectFieldFromJson(e);case"Function":return N.functionDeclFromJson(e);case"If":return N.ifStatementFromJson(e);case"Import":return N.importStatementFromJson(e);case"Insertion":return N.insertionFromJson(e);case"Literal":return N.literalFromJson(e);case"Option":return N.choiceOptionFromJson(e);case"Part":return N.stringPartFromJson(e);case"Script":return N.scriptFromJson(e);case"State":return N.stateFromJson(e);case"String":return N.stringLiteralFromJson(e);case"Ternary":return N.ternaryFromJson(e);case"Text":return N.textStatementFromJson(e);case"Transition":return N.transitionFromJson(e);case"Unary":return N.unaryFromJson(e);default:throw b.thrown("Unknown node type: "+t)}}static commentFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=e.isHash!=null&&e.isHash;return new Wi(t,i,e.content,e.multiline,l)}static stateFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=e.fields,n=[],s=0;for(;s<l.length;){let o=l[s];++s,n.push(N.nodeFromJson(o))}let r=n,h=N.extractComments(e),a=new Wt(t,i,e.temporary,r,h.leading,h.trailing);return a.style=N.blockStyleFromString(e.style),a}static objectFieldFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=N.extractComments(e);return new Fi(t,i,e.name,N.nodeFromJson(e.value),l.leading,l.trailing)}static characterFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=N.positionFromJson(e.namePos),n=e.fields,s=[],r=0;for(;r<n.length;){let u=n[r];++r,s.push(N.nodeFromJson(u))}let h=s,a=N.extractComments(e),o=new zt(t,i,e.name,l,h,a.leading,a.trailing);return o.style=N.blockStyleFromString(e.style),o}static beatFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=e.body,n=[],s=0;for(;s<l.length;){let o=l[s];++s,n.push(N.nodeFromJson(o))}let r=n,h=N.extractComments(e),a=new Me(t,i,e.name,r,h.leading,h.trailing);return a.style=N.blockStyleFromString(e.style),a}static stringPartFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=e.part,n;switch(l){case"Expr":n=ze.Expr(N.nodeFromJson(e.expression));break;case"Raw":n=ze.Raw(e.text);break;case"Tag":n=ze.Tag(e.closing,N.nodeFromJson(e.content));break;default:throw b.thrown("Unknown string part type: "+l)}let s=N.extractComments(e);return new Je(t,i,n,s.leading,s.trailing)}static stringLiteralFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=N.quotesFromString(e.quotes),n=e.parts,s=[],r=0;for(;r<n.length;){let o=n[r];++r,s.push(N.nodeFromJson(o))}let h=s,a=N.extractComments(e);return new Tt(t,i,l,h,a.leading,a.trailing)}static textStatementFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=N.nodeFromJson(e.content),n=N.extractComments(e),s=new ui(t,i,l,n.leading,n.trailing);return e.condition!=null&&(s.condition=N.nodeFromJson(e.condition),s.conditionStyle=N.conditionStyleFromString(e.conditionStyle),s.conditionPos=N.positionFromJson(e.conditionPos)),s}static dialogueStatementFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=N.positionFromJson(e.characterPos),n=N.nodeFromJson(e.content),s=N.extractComments(e),r=new ti(t,i,e.character,l,n,s.leading,s.trailing);return e.condition!=null&&(r.condition=N.nodeFromJson(e.condition),r.conditionStyle=N.conditionStyleFromString(e.conditionStyle),r.conditionPos=N.positionFromJson(e.conditionPos)),r}static choiceStatementFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=e.options,n=[],s=0;for(;s<l.length;){let o=l[s];++s,n.push(N.nodeFromJson(o))}let r=n,h=N.extractComments(e),a=new mi(t,i,r,h.leading,h.trailing);return a.style=N.blockStyleFromString(e.style),a}static choiceOptionFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=e.text!=null?N.nodeFromJson(e.text):null,n=e.insertion!=null?N.nodeFromJson(e.insertion):null,s=e.condition!=null?N.nodeFromJson(e.condition):null,r=e.conditionStyle!=null?N.conditionStyleFromString(e.conditionStyle):0,h=e.body,a=[],o=0;for(;o<h.length;){let f=h[o];++o,a.push(N.nodeFromJson(f))}let u=a,c=N.extractComments(e),_=new Et(t,i,l,n,s,r,u,c.leading,c.trailing);return _.style=N.blockStyleFromString(e.style),e.once!=null&&e.once&&(_.once=!0),e.conditionPos!=null&&(_.conditionPos=N.positionFromJson(e.conditionPos)),_}static blockFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=e.body,n=[],s=0;for(;s<l.length;){let o=l[s];++s,n.push(N.nodeFromJson(o))}let r=n,h=N.extractComments(e),a=new ii(t,i,r,h.leading,h.trailing);return a.style=N.blockStyleFromString(e.style),a}static ifStatementFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=N.nodeFromJson(e.condition),n=N.conditionStyleFromString(e.conditionStyle),s=e.thenBranch,r=[],h=0;for(;h<s.length;){let m=s[h];++h,r.push(N.nodeFromJson(m))}let a=r,o=new ii(Re.UNDEFINED,i,a);o.style=N.blockStyleFromString(e.thenStyle);let u=null;if(e.elseBranch!=null){let m=e.elseBranch,g=[],w=0;for(;w<m.length;){let T=m[w];++w,g.push(N.nodeFromJson(T))}let y=g;u=new ii(Re.UNDEFINED,i,y),u.style=N.blockStyleFromString(e.elseStyle)}let c=N.extractComments(e),_=null,f=null;if(e.comments!=null){if(e.comments.elseLeading!=null){let m=e.comments.elseLeading,g=[],w=0;for(;w<m.length;){let y=m[w];++w,g.push(N.commentFromJson(y))}_=g}if(e.comments.elseTrailing!=null){let m=e.comments.elseTrailing,g=[],w=0;for(;w<m.length;){let y=m[w];++w,g.push(N.commentFromJson(y))}f=g}}return new gi(t,i,l,n,o,u,c.leading,c.trailing,_,f)}static alternativeFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=N.alternativeModeFromString(e.mode),n=e.items,s=[],r=0;for(;r<n.length;){let u=n[r];++r,s.push(N.nodeFromJson(u))}let h=s,a=N.extractComments(e),o=new Ui(t,i,l,h,a.leading,a.trailing);if(o.style=N.blockStyleFromString(e.style),e.separatorComments!=null){let u=e.separatorComments,c=[],_=0;for(;_<u.length;){let f=u[_];if(++_,f!=null){let m=f,g=[],w=0;for(;w<m.length;){let y=m[w];++w,g.push(N.commentFromJson(y))}c.push(g)}else c.push(null)}o.separatorComments=c}return o}static callFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=N.nodeFromJson(e.target),n=e.args,s=[],r=0;for(;r<n.length;){let o=n[r];++r,s.push(N.nodeFromJson(o))}let h=s,a=N.extractComments(e);return new Rt(t,i,l,h,a.leading,a.trailing)}static transitionFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=N.positionFromJson(e.targetPos),n=N.extractComments(e);return new Mi(t,i,e.target,l,n.leading,n.trailing)}static insertionFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=N.positionFromJson(e.targetPos),n=N.extractComments(e);return new zi(t,i,e.target,l,n.leading,n.trailing)}static functionDeclFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=e.name,n=e.args,s=[],r=0;for(;r<n.length;){let o=n[r];++r,s.push(o)}let h=s,a=N.extractComments(e);return new Li(t,i,l,h,e.code,e.external,a.leading,a.trailing)}static literalFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=e.literal,n=N.extractComments(e),s,r;switch(l){case"Array":if(s=He.Array,e.value!=null){let a=e.value,o=[],u=0;for(;u<a.length;){let c=a[u];++u,Object.prototype.hasOwnProperty.call(c,"type")?o.push(N.nodeFromJson(c)):o.push(c)}r=o}else r=null;break;case"Boolean":s=He.Boolean,r=e.value;break;case"Null":s=He.Null,r=null;break;case"Number":s=He.Number,r=e.value;break;case"Object":let h=N.blockStyleFromString(e.style);if(s=He.Object(h),e.value!=null){let a=e.value,o=[],u=0;for(;u<a.length;){let c=a[u];++u,o.push(N.nodeFromJson(c))}r=o}else r=[];break;default:throw b.thrown("Unknown literal type: "+l)}return new Ke(t,i,r,s,n.leading,n.trailing)}static accessFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=e.target!=null?N.nodeFromJson(e.target):null,n=N.extractComments(e);return new ut(t,i,l,e.name,n.leading,n.trailing)}static assignFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=N.nodeFromJson(e.target),n=N.tokenTypeFromString(e.op),s=N.nodeFromJson(e.value),r=N.extractComments(e);return new di(t,i,l,n,s,r.leading,r.trailing)}static arrayAccessFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=N.nodeFromJson(e.target),n=N.nodeFromJson(e.index),s=N.extractComments(e);return new ci(t,i,l,n,s.leading,s.trailing)}static binaryFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=N.nodeFromJson(e.left),n=N.tokenTypeFromString(e.op),s=N.nodeFromJson(e.right),r=N.extractComments(e);return new Qt(t,i,l,n,s,r.leading,r.trailing)}static unaryFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=N.tokenTypeFromString(e.op),n=N.nodeFromJson(e.operand),s=N.extractComments(e);return new Ki(t,i,l,n,s.leading,s.trailing)}static ternaryFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=N.nodeFromJson(e.condition),n=N.nodeFromJson(e.trueExpr),s=N.nodeFromJson(e.falseExpr),r=N.extractComments(e);return new $i(t,i,l,n,s,r.leading,r.trailing)}static importStatementFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=N.nodeFromJson(e.path),n=e.script!=null?N.scriptFromJson(e.script):null,s=N.extractComments(e);return new Yt(t,i,l,n,s.leading,s.trailing)}static idFromJson(e){let t=e.id;return t!=null?Re.fromString(t):Re.UNDEFINED}static positionFromJson(e){if(e==null)return new he(0,0,0,0);let t=e.length!=null?e.length:0;return new he(e.line,e.column,e.offset,t)}static extractComments(e){if(e.comments==null)return{leading:null,trailing:null};let t=null,i=null;if(e.comments.leading!=null){let l=e.comments.leading,n=[],s=0;for(;s<l.length;){let r=l[s];++s,n.push(N.commentFromJson(r))}t=n}if(e.comments.trailing!=null){let l=e.comments.trailing,n=[],s=0;for(;s<l.length;){let r=l[s];++s,n.push(N.commentFromJson(r))}i=n}return{leading:t,trailing:i}}static applyComments(e,t){let i=N.extractComments(t);e.leadingComments=i.leading,e.trailingComments=i.trailing}static blockStyleFromString(e){return e=="Braces"?1:0}static conditionStyleFromString(e){return e=="Parens"?2:0}static alternativeModeFromString(e){switch(e){case"Cycle":return 1;case"Once":return 2;case"Pick":return 3;case"Shuffle":return 4;default:return 0}}static quotesFromString(e){return e=="DoubleQuotes"?1:0}static tokenTypeFromString(e){switch(e){case"OpAssign":return x.OpAssign;case"OpDivide":return x.OpDivide;case"OpDivideAssign":return x.OpDivideAssign;case"OpEquals":return x.OpEquals;case"OpGreater":return x.OpGreater;case"OpGreaterEq":return x.OpGreaterEq;case"OpLess":return x.OpLess;case"OpLessEq":return x.OpLessEq;case"OpMinus":return x.OpMinus;case"OpMinusAssign":return x.OpMinusAssign;case"OpModulo":return x.OpModulo;case"OpMultiply":return x.OpMultiply;case"OpMultiplyAssign":return x.OpMultiplyAssign;case"OpNot":return x.OpNot;case"OpNotEquals":return x.OpNotEquals;case"OpPlus":return x.OpPlus;case"OpPlusAssign":return x.OpPlusAssign;case"OpUnquotedAssign":return x.OpUnquotedAssign;default:if(e.startsWith("OpAnd"))return x.OpAnd(e.indexOf("true")!=-1);if(e.startsWith("OpOr"))return x.OpOr(e.indexOf("true")!=-1);throw b.thrown("Unknown operator: "+e)}}}j["loreline.JsonToAst"]=N,N.__name__="loreline.JsonToAst";class oi{constructor(e,t){this.target=e,this.origin=t}}j["loreline.Reference"]=oi,oi.__name__="loreline.Reference",Object.assign(oi.prototype,{__class__:oi});class Wl{constructor(e){this.error=null,this.expr=null,this.hscript=null,this.func=e,this.codeToHscript=new Ji;try{this.hscript=this.codeToHscript.process(e.code)}catch(t){let i=b.caught(t).unwrap();i instanceof ai&&(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 tl;t.resumeErrors=!1,t.allowJSON=!0,t.allowTypes=!0;let i=e.name;this.expr=t.parseString(this.hscript,i??"?")}catch(t){let i=b.caught(t).unwrap();if(this.error==null)if(i instanceof Ce){let l=i,n,s=l.e;switch(s._hx_index){case 0:n="Invalid character: "+s.c;break;case 1:n="Unexpected: "+s.s;break;case 2:n="Unterminated string";break;case 3:n="Unterminated comment";break;case 4:n="Invalid preprocessor: "+s.msg;break;case 5:n="Unknown variable: "+s.v;break;case 6:n="Invalid iterator: "+s.v;break;case 7:n="Invalid operator: "+s.op;break;case 8:n="Invalid access: "+s.f;break;case 9:n=s.msg;break}this.error=new Sl(l,n,this.codeToHscript.toLorelinePos(e.pos,l.pmin,l.pmax))}else i instanceof ai&&(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 l=new tl;l.resumeErrors=!0,l.allowJSON=!0,l.allowTypes=!0;let n=e.name;this.expr=l.parseString(this.hscript,n??"?")}catch{}}}}j["loreline.FuncHscript"]=Wl,Wl.__name__="loreline.FuncHscript",Object.assign(Wl.prototype,{__class__:Wl});class zl{constructor(e,t){this.completion=null,this.locals=null,e!=null&&(this.locals=e),t!=null&&(this.completion=t)}}j["loreline.HscriptCompletion"]=zl,zl.__name__="loreline.HscriptCompletion",Object.assign(zl.prototype,{__class__:zl});class Kl{constructor(e){this.hscriptFunctions=new Gi,this.childNodes=new Gi,this.parentNodes=new Gi,this.nodesById=new Gi,this.script=e,this.initialize()}initialize(){let e=this;this.script.each(function(t,i){let l=t.id.thisVal;if(e.nodesById.map._set(l.high,l.low,t),i!=null){let n=t.id.thisVal;e.parentNodes.map._set(n.high,n.low,i);let s=i.id.thisVal,r=e.childNodes.map._get(s.high,s.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,l){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(l,n){let s=l.pos,r=e.offset-s.offset;r>=0&&r<i&&(i=r,t=l)}),t}getNodesOfType(e,t){t==null&&(t=!1);let i=[],l=this;return this.traverse(this.script,function(n,s){return te.__instanceof(n,e)&&i.push(n),t||n==l.script?!0:!(n instanceof Yt||n instanceof pi)}),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&&te.getClass(i)==t)return i;return null}getImportedPaths(e){let t=[];return this._getImportedPaths(e,this.script,t,new Ee),t}_getImportedPaths(e,t,i,l){let n=Nt.directory(e);t==null&&(t=this.script);let s=".lor";e!=null&&e.endsWith(".lor.txt")&&(s=".lor.txt");let r=0,h=t.body;for(;r<h.length;){let a=h[r];if(++r,a instanceof Yt){let o=a,u,c=o.path.parts[0].partType;c._hx_index==0?u=c.text:u="",Nt.isAbsolute(u)||(u=Nt.join([n,u])),u=Nt.normalize(u),u.toLowerCase().endsWith(s)||(u+=s),Object.prototype.hasOwnProperty.call(l.h,u)||(l.h[u]=!0,i.push(u),o.script!=null&&this._getImportedPaths(u,o.script,i,l))}}return i}resolveArrayAccess(e){let t=null;if(e.target instanceof ut?t=this.resolveAccess(e.target):e.target instanceof ci&&(t=this.resolveArrayAccess(e.target)),t==null)return null;switch(te.getClass(t)){case Ke:let i=t;if(i.literalType==He.Array){let n=i.value;if(e.index instanceof Ke){let s=e.index;if(s.literalType==He.Number){let r=s.value|0;if(r>=0&&r<n.length){let h=n[r];if(h instanceof Ft)return h}}}}break;case Fi:let l=t;if(l.value instanceof Ke){let n=l.value;if(n.literalType==He.Array){let s=n.value;if(e.index instanceof Ke){let r=e.index;if(r.literalType==He.Number){let h=r.value|0;if(h>=0&&h<s.length){let a=s[h];if(a instanceof Ft)return a}}}}}break;default:}return null}resolveAccess(e){if(e.target!=null){let h=e.target instanceof ut?this.resolveAccess(e.target):e.target instanceof ci?this.resolveArrayAccess(e.target):null;if(h!=null)switch(h instanceof Fi&&(h=h.value),te.getClass(h)){case zt:let a=h,o=0,u=a.fields;for(;o<u.length;){let f=u[o];if(++o,f.name==e.name)return f}break;case Ke:let c=h,_=c.literalType;if(_._hx_index==4){let f=_.style,m=c.value,g=0;for(;g<m.length;){let w=m[g];if(++g,w.name==e.name)return w}}break;default:}return null}let t=e.name;if(t==null)return null;let i=this.getFirstParentOfType(e,Me);for(;i!=null;){let h=null;if(this.traverse(i,function(a,o){if(h!=null)return!1;if(a instanceof Wt){let u=a,c=0,_=u.fields;for(;c<_.length;){let f=_[c];if(++c,f.name==t)return h=f,!1}}return!0}),h!=null)return h;i=this.getFirstParentOfType(i,Me)}let l=null;if(this.traverse(this.script,function(h,a){if(l!=null)return!1;if(h instanceof Wt){let o=h,u=0,c=o.fields;for(;u<c.length;){let _=c[u];if(++u,_.name==t)return l=_,!1}}return h instanceof Yt?!0:h instanceof pi}),l!=null)return l;let n=this.findCharacterByNameFromNode(t,e);if(n!=null)return n;let s=this.findBeatByNameFromNode(t,e);if(s!=null)return s;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("."),l=this.findBeatByNameFromNode(i[0],t),n=1;for(;l!=null&&n<i.length;){let s=i[n],r=null;this.traverse(l,function(h,a){if(h instanceof Me){let o=h;return o.name==s&&(r=o),!1}else return r==null}),l=r,++n}return l}isTopLevelNode(e){if(e instanceof Le){let t=e;return this.script.body.indexOf(t)!=-1}return!1}findTopLevelBeatFromNode(e){if(this.isTopLevelNode(e))return e instanceof Me?e:null;{let t=this.getFirstParentOfType(e,Me);for(;t!=null&&!this.isTopLevelNode(t);)t=this.getFirstParentOfType(t,Me);if(t!=null&&t instanceof Me)return t}return null}findBeatByNameFromNode(e,t){let i=null,l=this.getFirstParentOfType(t,Me);for(;l!=null;)this.traverse(l,function(n,s){if(i!=null||n==t)return!1;if(n instanceof Me){let r=n;return r.name==e&&(i=r),!1}return!0}),l=this.getFirstParentOfType(l,Me);return i==null&&this.traverse(this.script,function(n,s){if(i==null&&n instanceof Me){let r=n;r.name==e&&(i=r)}return n instanceof Yt?!0:n instanceof pi}),i}findCharacterFromDialogue(e){return this.findCharacterByNameFromNode(e.character,e)}findCharacterByNameFromNode(e,t){let i=null;return this.traverse(this.script,function(l,n){if(i==null&&l instanceof zt){let s=l;s.name==e&&(i=s)}return l instanceof Yt?!0:l instanceof pi}),i}findFunctionByNameFromNode(e,t){let i=null;return this.traverse(this.script,function(l,n){if(i==null&&l instanceof Li){let s=l;s.name==e&&(i=s)}return l instanceof Yt?!0:l instanceof pi}),i}getVisibleCharacters(){let e=[],t=this.script.iterator();for(;t.hasNext();){let i=t.next();i instanceof zt&&e.push(i)}return e}getVisibleFunctions(){let e=[],t=this.script.iterator();for(;t.hasNext();){let i=t.next();i instanceof Li&&e.push(i)}return e}getVisibleStateFields(e){let t=[],i=new wi,l=e;for(;l!=null;){if(te.getClass(l)==Wt){let s=l,r=0,h=s.fields;for(;r<h.length;){let a=h[r];++r;let o=a.id.thisVal;if(!i._exists(o.high,o.low)){let u=a.id.thisVal;i._set(u.high,u.low,!0),t.push(a)}}}let n=l.id.thisVal;l=this.parentNodes.map._get(n.high,n.low)}return this.script.each(function(n,s){if(te.getClass(n)==Wt){let r=n;if(s instanceof pi){let h=0,a=r.fields;for(;h<a.length;){let o=a[h];++h;let u=o.id.thisVal;if(!i._exists(u.high,u.low)){let c=o.id.thisVal;i._set(c.high,c.low,!0),t.push(o)}}}}}),t}getVisibleBeats(e){let t=[],i=Object.create(null),l=this.getParentNode(e);for(;l!=null;){if(te.getClass(l)==Me&&this.getParentNode(l)!=null){let s=0,r=this.getNodesOfType(Me);for(;s<r.length;){let h=r[s];++s,Object.prototype.hasOwnProperty.call(i,h.name)||(i[h.name]=!0,t.push(h))}}l=this.getParentNode(l)}return this.script.each(function(n,s){if(te.getClass(n)==Me&&s instanceof pi){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 Le?h:null;if(o!=null&&o.trailingComments!=null){let u=0,c=o.trailingComments;for(;u<c.length;){let _=c[u];if(++u,_.isHash){let f=Ae.trim(_.content);e[f]=!0}}}});let t=[],i=e,l=i,n=Object.keys(i),s=n.length,r=0;for(;r<s;){let h=n[r++];t.push(h)}return t}countTags(){let e=new Ee;return this.script.each(function(t,i){let l=t instanceof Le?t:null;if(l!=null&&l.trailingComments!=null){let n=0,s=l.trailingComments;for(;n<s.length;){let r=s[n];if(++n,r.isHash){let h=Ae.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 l=t[i];if(++i,l.name==e.name)return l}return null}findOutboundBeats(e){let t=new wi,i=this;this.traverse(e,function(r,h){switch(te.getClass(r)){case Rt:let a=r;if(a.target instanceof ut){let f=a.target;if(f.target==null){let m=i.findBeatFromAccess(f);if(m!=null){let g=m.id,w=new oi(m,a),y=g.thisVal;t._set(y.high,y.low,w)}}}break;case zi:let o=r,u=i.findBeatByNameFromNode(o.target,o);if(u!=null){let f=u.id,m=new oi(u,o),g=f.thisVal;t._set(g.high,g.low,m)}break;case Mi:let c=r,_=i.findBeatByNameFromNode(c.target,c);if(_!=null){let f=_.id,m=new oi(_,c),g=f.thisVal;t._set(g.high,g.low,m)}break;default:}return!0});let l=[],n=t,s=0;for(;s<n._values.length&&n._values[s]==null;)++s;for(;s<n._values.length;){let r=n._values[s];for(++s;s<n._values.length&&n._values[s]==null;)++s;let h=r;l.push(h)}return l}findReferencesToBeat(e){let t=[],i=this;return this.script.each(function(l,n){switch(te.getClass(l)){case Rt:let s=l;if(s.target instanceof ut){let a=s.target;if(a.target==null&&a.name==e.name){let o=i.findBeatFromAccess(a);o!=null&&o.id==e.id&&t.push(new oi(e,s))}}break;case zi:let r=l;r.target==e.name&&t.push(new oi(e,r));break;case Mi:let h=l;h.target==e.name&&t.push(new oi(e,h));break;default:}}),t}findModifiedStateFields(e){let t=Object.create(null),i=this;this.traverse(e,function(u,c){if(te.getClass(u)==di){let _=u;if(_.target instanceof ut){let f=_.target,m=i.findStateField(f);if(m!=null){let g=m.name,w=new oi(m,_);t[g]=w}}}return!0});let l=[],n=t,s=n,r=Object.keys(n),h=r.length,a=0;for(;a<h;){let u=s[r[a++]];l.push(u)}let o=l;return o.sort(function(u,c){let _=u.target.name.toLowerCase(),f=c.target.name.toLowerCase();return _<f?-1:_>f?1:0}),o}findReadStateFields(e){let t=Object.create(null),i=this;this.traverse(e,function(u,c){if(te.getClass(u)==ut){let _=u;if(c instanceof di&&c.target==u)return!0;let f=i.findStateField(_);if(f!=null){let m=f.name,g=new oi(f,_);t[m]=g}}return!0});let l=[],n=t,s=n,r=Object.keys(n),h=r.length,a=0;for(;a<h;){let u=s[r[a++]];l.push(u)}let o=l;return o.sort(function(u,c){let _=u.target.name.toLowerCase(),f=c.target.name.toLowerCase();return _<f?-1:_>f?1:0}),o}findBeatCharacters(e){let t=new wi,i=this;this.traverse(e,function(h,a){switch(te.getClass(h)){case ut:let o=h;if(o.target==null){let _=i.findCharacterByNameFromNode(o.name,o);if(_!=null){let f=_.id,m=new oi(_,o),g=f.thisVal;t._set(g.high,g.low,m)}}break;case ti:let u=h,c=i.findCharacterFromDialogue(u);if(c!=null){let _=c.id,f=new oi(c,u),m=_.thisVal;t._set(m.high,m.low,f)}break;default:}return!0});let l=[],n=t,s=0;for(;s<n._values.length&&n._values[s]==null;)++s;for(;s<n._values.length;){let h=n._values[s];for(++s;s<n._values.length&&n._values[s]==null;)++s;let a=h;l.push(a)}let r=l;return r.sort(function(h,a){let o=h.target.name.toLowerCase(),u=a.target.name.toLowerCase();return o<u?-1:o>u?1:0}),r}findModifiedCharacterFields(e){let t=new wi,i=[],l=this;return this.traverse(e,function(n,s){if(te.getClass(n)==di){let r=n;if(r.target instanceof ut){let h=r.target,a=l.resolveAccess(h);if(a instanceof Fi){let o=a.id.thisVal;if(!t._exists(o.high,o.low)&&l.getParentNode(a)instanceof zt){let c=a.id.thisVal;t._set(c.high,c.low,!0),i.push(new oi(a,n))}}}}return!0}),i}findReadCharacterFields(e){let t=new wi,i=[],l=this;return this.traverse(e,function(n,s){if(te.getClass(n)==ut){let r=n,h=l.getParentNode(r);if(h instanceof di&&h.target==r)return!0;let a=l.resolveAccess(r);if(a instanceof Fi){let o=a.id.thisVal;if(!t._exists(o.high,o.low)&&l.getParentNode(a)instanceof zt){let c=a.id.thisVal;t._set(c.high,c.low,!0),i.push(new oi(a,n))}}}return!0}),i}traverse(e,t){let i=e.id.thisVal,l=this.childNodes.map._get(i.high,i.low);if(l!=null){let n=0,s=l.length;for(;n<s;){let r=n++,h=l[r];t(h,e)&&this.traverse(h,t)}}}getFuncHscript(e){let t=e.id,i=t.thisVal,l=this.hscriptFunctions.map._get(i.high,i.low);if(l==null){l=new Wl(e);let n=t.thisVal;this.hscriptFunctions.map._set(n.high,n.low,l)}return l}getHscriptExpr(e,t){let i=this.getFuncHscript(e);if(i.expr==null)return null;let l=t.offset-e.pos.offset,n=null,s=null;return s=function(r){if(r!=null){let h=i.codeToHscript.inputPosFromProcessedPos(r.pmin),a=i.codeToHscript.inputPosFromProcessedPos(r.pmax);l>=h&&l<=a&&(n=r),en.iter(r,s)}},en.iter(i.expr,s),n}resolveHscriptAccess(e,t){let i=t.e;switch(i._hx_index){case 1:let l=i.v,n=null;if(this.traverse(this.script,function(_,f){if(n!=null)return!1;if(_ instanceof Wt){let m=_,g=0,w=m.fields;for(;g<w.length;){let y=w[g];if(++g,y.name==l)return n=y,!1}}return _ instanceof Yt?!0:_ instanceof pi}),n!=null)return n;let s=this.findCharacterByNameFromNode(l,e);if(s!=null)return s;let r=this.findBeatByNameFromNode(l,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),te.getClass(o)){case zt:let _=o,f=0,m=_.fields;for(;f<m.length;){let y=m[f];if(++f,y.name==a)return y}break;case Ke:let g=o,w=g.literalType;if(w._hx_index==4){let y=w.style,T=g.value,E=0;for(;E<T.length;){let C=T[E];if(++E,C.name==a)return C}}break;default:}break;case 16:let u=i.e,c=i.index;break;default:}return null}isHscriptExpr(e){return e!=null&&Object.prototype.hasOwnProperty.call(e,"e")?te.__instanceof(We.field(e,"e"),V):!1}getHscriptCompletion(e,t){let i=this.getFuncHscript(e),l=t.offset-e.pos.offset+t.length,n=i.codeToHscript.processedPosFromInputPos(l),s=i.hscript,r=Math.min(n,i.hscript.length)|0,h=r!=null?s.substring(0,r):s.substring(0),a=h.length,o=h.indexOf("{",null)+1;h=a!=null?h.substring(o,a):h.substring(o);let u=h.length,c="",_=0,f=a-u;for(;_<f;){let y=_++;c+=String.fromCodePoint(32)}h=c+h;let m=null,g=new Ze;try{g.types.parser.allowJSON=!0,g.types.parser.allowTypes=!0,g.types.parser.resumeErrors=!0;let y=g.types.parser.parseString(h);g.check(y,null,!0)}catch(y){let T=b.caught(y).unwrap();T instanceof xl&&(m=T)}let w=g.locals;return new zl(w,m)}resolveAccessInFunction(e,t){if(this.getFuncHscript(e).expr==null)return null;let l=this.getHscriptExpr(e,t);return l!=null?this.resolveHscriptAccess(e,l):null}}j["loreline.Lens"]=Kl,Kl.__name__="loreline.Lens",Object.assign(Kl.prototype,{__class__:Kl});class ll extends ai{constructor(e,t){super(e,t)}}j["loreline.LexerError"]=ll,ll.__name__="loreline.LexerError",ll.__super__=ai,Object.assign(ll.prototype,{__class__:ll});var Pi=Qe["loreline.LStringAttachment"]={__ename__:"loreline.LStringAttachment",__constructs__:null,Interpolation:(d=function(k,e,t,i,l){return{_hx_index:0,braces:k,inTag:e,expr:t,start:i,length:l,__enum__:"loreline.LStringAttachment",toString:S}},d._hx_name="Interpolation",d.__params__=["braces","inTag","expr","start","length"],d),Tag:(d=function(k,e,t){return{_hx_index:1,closing:k,start:e,length:t,__enum__:"loreline.LStringAttachment",toString:S}},d._hx_name="Tag",d.__params__=["closing","start","length"],d)};Pi.__constructs__=[Pi.Interpolation,Pi.Tag];class Ni{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 x=Qe["loreline.TokenType"]={__ename__:"loreline.TokenType",__constructs__:null,KwImport:{_hx_name:"KwImport",_hx_index:0,__enum__:"loreline.TokenType",toString:S},KwState:{_hx_name:"KwState",_hx_index:1,__enum__:"loreline.TokenType",toString:S},KwBeat:{_hx_name:"KwBeat",_hx_index:2,__enum__:"loreline.TokenType",toString:S},KwCharacter:{_hx_name:"KwCharacter",_hx_index:3,__enum__:"loreline.TokenType",toString:S},KwChoice:{_hx_name:"KwChoice",_hx_index:4,__enum__:"loreline.TokenType",toString:S},KwIf:{_hx_name:"KwIf",_hx_index:5,__enum__:"loreline.TokenType",toString:S},KwElse:{_hx_name:"KwElse",_hx_index:6,__enum__:"loreline.TokenType",toString:S},KwNew:{_hx_name:"KwNew",_hx_index:7,__enum__:"loreline.TokenType",toString:S},KwSequence:{_hx_name:"KwSequence",_hx_index:8,__enum__:"loreline.TokenType",toString:S},KwCycle:{_hx_name:"KwCycle",_hx_index:9,__enum__:"loreline.TokenType",toString:S},KwOnce:{_hx_name:"KwOnce",_hx_index:10,__enum__:"loreline.TokenType",toString:S},KwPick:{_hx_name:"KwPick",_hx_index:11,__enum__:"loreline.TokenType",toString:S},KwShuffle:{_hx_name:"KwShuffle",_hx_index:12,__enum__:"loreline.TokenType",toString:S},Separator:{_hx_name:"Separator",_hx_index:13,__enum__:"loreline.TokenType",toString:S},Function:(d=function(k,e,t,i){return{_hx_index:14,name:k,args:e,code:t,external:i,__enum__:"loreline.TokenType",toString:S}},d._hx_name="Function",d.__params__=["name","args","code","external"],d),LString:(d=function(k,e,t){return{_hx_index:15,quotes:k,s:e,attachments:t,__enum__:"loreline.TokenType",toString:S}},d._hx_name="LString",d.__params__=["quotes","s","attachments"],d),LNumber:(d=function(k){return{_hx_index:16,n:k,__enum__:"loreline.TokenType",toString:S}},d._hx_name="LNumber",d.__params__=["n"],d),LBoolean:(d=function(k){return{_hx_index:17,b:k,__enum__:"loreline.TokenType",toString:S}},d._hx_name="LBoolean",d.__params__=["b"],d),LNull:{_hx_name:"LNull",_hx_index:18,__enum__:"loreline.TokenType",toString:S},Identifier:(d=function(k){return{_hx_index:19,name:k,__enum__:"loreline.TokenType",toString:S}},d._hx_name="Identifier",d.__params__=["name"],d),OpAssign:{_hx_name:"OpAssign",_hx_index:20,__enum__:"loreline.TokenType",toString:S},OpPlusAssign:{_hx_name:"OpPlusAssign",_hx_index:21,__enum__:"loreline.TokenType",toString:S},OpMinusAssign:{_hx_name:"OpMinusAssign",_hx_index:22,__enum__:"loreline.TokenType",toString:S},OpMultiplyAssign:{_hx_name:"OpMultiplyAssign",_hx_index:23,__enum__:"loreline.TokenType",toString:S},OpDivideAssign:{_hx_name:"OpDivideAssign",_hx_index:24,__enum__:"loreline.TokenType",toString:S},OpUnquotedAssign:{_hx_name:"OpUnquotedAssign",_hx_index:25,__enum__:"loreline.TokenType",toString:S},OpPlus:{_hx_name:"OpPlus",_hx_index:26,__enum__:"loreline.TokenType",toString:S},OpMinus:{_hx_name:"OpMinus",_hx_index:27,__enum__:"loreline.TokenType",toString:S},OpMultiply:{_hx_name:"OpMultiply",_hx_index:28,__enum__:"loreline.TokenType",toString:S},OpDivide:{_hx_name:"OpDivide",_hx_index:29,__enum__:"loreline.TokenType",toString:S},OpModulo:{_hx_name:"OpModulo",_hx_index:30,__enum__:"loreline.TokenType",toString:S},OpEquals:{_hx_name:"OpEquals",_hx_index:31,__enum__:"loreline.TokenType",toString:S},OpNotEquals:{_hx_name:"OpNotEquals",_hx_index:32,__enum__:"loreline.TokenType",toString:S},OpGreater:{_hx_name:"OpGreater",_hx_index:33,__enum__:"loreline.TokenType",toString:S},OpLess:{_hx_name:"OpLess",_hx_index:34,__enum__:"loreline.TokenType",toString:S},OpGreaterEq:{_hx_name:"OpGreaterEq",_hx_index:35,__enum__:"loreline.TokenType",toString:S},OpLessEq:{_hx_name:"OpLessEq",_hx_index:36,__enum__:"loreline.TokenType",toString:S},OpAnd:(d=function(k){return{_hx_index:37,word:k,__enum__:"loreline.TokenType",toString:S}},d._hx_name="OpAnd",d.__params__=["word"],d),OpOr:(d=function(k){return{_hx_index:38,word:k,__enum__:"loreline.TokenType",toString:S}},d._hx_name="OpOr",d.__params__=["word"],d),OpNot:{_hx_name:"OpNot",_hx_index:39,__enum__:"loreline.TokenType",toString:S},Arrow:{_hx_name:"Arrow",_hx_index:40,__enum__:"loreline.TokenType",toString:S},Colon:{_hx_name:"Colon",_hx_index:41,__enum__:"loreline.TokenType",toString:S},Question:{_hx_name:"Question",_hx_index:42,__enum__:"loreline.TokenType",toString:S},Comma:{_hx_name:"Comma",_hx_index:43,__enum__:"loreline.TokenType",toString:S},Dot:{_hx_name:"Dot",_hx_index:44,__enum__:"loreline.TokenType",toString:S},LBrace:{_hx_name:"LBrace",_hx_index:45,__enum__:"loreline.TokenType",toString:S},RBrace:{_hx_name:"RBrace",_hx_index:46,__enum__:"loreline.TokenType",toString:S},LParen:{_hx_name:"LParen",_hx_index:47,__enum__:"loreline.TokenType",toString:S},RParen:{_hx_name:"RParen",_hx_index:48,__enum__:"loreline.TokenType",toString:S},LBracket:{_hx_name:"LBracket",_hx_index:49,__enum__:"loreline.TokenType",toString:S},RBracket:{_hx_name:"RBracket",_hx_index:50,__enum__:"loreline.TokenType",toString:S},CommentLine:(d=function(k){return{_hx_index:51,content:k,__enum__:"loreline.TokenType",toString:S}},d._hx_name="CommentLine",d.__params__=["content"],d),CommentMultiLine:(d=function(k){return{_hx_index:52,content:k,__enum__:"loreline.TokenType",toString:S}},d._hx_name="CommentMultiLine",d.__params__=["content"],d),CommentHash:(d=function(k){return{_hx_index:53,content:k,__enum__:"loreline.TokenType",toString:S}},d._hx_name="CommentHash",d.__params__=["content"],d),Indent:{_hx_name:"Indent",_hx_index:54,__enum__:"loreline.TokenType",toString:S},Unindent:{_hx_name:"Unindent",_hx_index:55,__enum__:"loreline.TokenType",toString:S},LineBreak:{_hx_name:"LineBreak",_hx_index:56,__enum__:"loreline.TokenType",toString:S},Eof:{_hx_name:"Eof",_hx_index:57,__enum__:"loreline.TokenType",toString:S}};x.__constructs__=[x.KwImport,x.KwState,x.KwBeat,x.KwCharacter,x.KwChoice,x.KwIf,x.KwElse,x.KwNew,x.KwSequence,x.KwCycle,x.KwOnce,x.KwPick,x.KwShuffle,x.Separator,x.Function,x.LString,x.LNumber,x.LBoolean,x.LNull,x.Identifier,x.OpAssign,x.OpPlusAssign,x.OpMinusAssign,x.OpMultiplyAssign,x.OpDivideAssign,x.OpUnquotedAssign,x.OpPlus,x.OpMinus,x.OpMultiply,x.OpDivide,x.OpModulo,x.OpEquals,x.OpNotEquals,x.OpGreater,x.OpLess,x.OpGreaterEq,x.OpLessEq,x.OpAnd,x.OpOr,x.OpNot,x.Arrow,x.Colon,x.Question,x.Comma,x.Dot,x.LBrace,x.RBrace,x.LParen,x.RParen,x.LBracket,x.RBracket,x.CommentLine,x.CommentMultiLine,x.CommentHash,x.Indent,x.Unindent,x.LineBreak,x.Eof];class Ot{static equals(e,t){switch(e._hx_index){case 1:return t._hx_index==1?!0:pe.enumEq(e,t);case 2:return t._hx_index==2?!0:pe.enumEq(e,t);case 3:return t._hx_index==3?!0:pe.enumEq(e,t);case 4:return t._hx_index==4?!0:pe.enumEq(e,t);case 5:return t._hx_index==5?!0:pe.enumEq(e,t);case 6:return t._hx_index==6?!0:pe.enumEq(e,t);case 7:return t._hx_index==7?!0:pe.enumEq(e,t);case 8:return t._hx_index==8?!0:pe.enumEq(e,t);case 9:return t._hx_index==9?!0:pe.enumEq(e,t);case 10:return t._hx_index==10?!0:pe.enumEq(e,t);case 11:return t._hx_index==11?!0:pe.enumEq(e,t);case 12:return t._hx_index==12?!0:pe.enumEq(e,t);case 13:return t._hx_index==13?!0:pe.enumEq(e,t);case 15:let i=e.s,l=e.attachments;if(t._hx_index==15){let r=t.s,h=t.attachments,a=t.quotes;return e.quotes==a}else return pe.enumEq(e,t);break;case 16:if(t._hx_index==16){let r=t.n;return e.n==r}else return pe.enumEq(e,t);break;case 17:if(t._hx_index==17){let r=t.b;return e.b==r}else return pe.enumEq(e,t);break;case 18:return t._hx_index==18?!0:pe.enumEq(e,t);case 19:if(t._hx_index==19){let r=t.name;return e.name==r}else return pe.enumEq(e,t);break;case 20:return t._hx_index==20?!0:pe.enumEq(e,t);case 21:return t._hx_index==21?!0:pe.enumEq(e,t);case 22:return t._hx_index==22?!0:pe.enumEq(e,t);case 23:return t._hx_index==23?!0:pe.enumEq(e,t);case 24:return t._hx_index==24?!0:pe.enumEq(e,t);case 25:return t._hx_index==25?!0:pe.enumEq(e,t);case 26:return t._hx_index==26?!0:pe.enumEq(e,t);case 27:return t._hx_index==27?!0:pe.enumEq(e,t);case 28:return t._hx_index==28?!0:pe.enumEq(e,t);case 29:return t._hx_index==29?!0:pe.enumEq(e,t);case 30:return t._hx_index==30?!0:pe.enumEq(e,t);case 31:return t._hx_index==31?!0:pe.enumEq(e,t);case 32:return t._hx_index==32?!0:pe.enumEq(e,t);case 33:return t._hx_index==33?!0:pe.enumEq(e,t);case 34:return t._hx_index==34?!0:pe.enumEq(e,t);case 35:return t._hx_index==35?!0:pe.enumEq(e,t);case 36:return t._hx_index==36?!0:pe.enumEq(e,t);case 37:let n=e.word;if(t._hx_index==37){let r=t.word;return!0}else return pe.enumEq(e,t);break;case 38:let s=e.word;if(t._hx_index==38){let r=t.word;return!0}else return pe.enumEq(e,t);break;case 39:return t._hx_index==39?!0:pe.enumEq(e,t);case 40:return t._hx_index==40?!0:pe.enumEq(e,t);case 41:return t._hx_index==41?!0:pe.enumEq(e,t);case 42:return t._hx_index==42?!0:pe.enumEq(e,t);case 44:return t._hx_index==44?!0:pe.enumEq(e,t);case 45:return t._hx_index==45?!0:pe.enumEq(e,t);case 46:return t._hx_index==46?!0:pe.enumEq(e,t);case 47:return t._hx_index==47?!0:pe.enumEq(e,t);case 48:return t._hx_index==48?!0:pe.enumEq(e,t);case 49:return t._hx_index==49?!0:pe.enumEq(e,t);case 50:return t._hx_index==50?!0:pe.enumEq(e,t);case 51:if(t._hx_index==51){let r=t.content;return e.content==r}else return pe.enumEq(e,t);break;case 52:if(t._hx_index==52){let r=t.content;return e.content==r}else return pe.enumEq(e,t);break;case 53:if(t._hx_index==53){let r=t.content;return e.content==r}else return pe.enumEq(e,t);break;case 54:return t._hx_index==54?!0:pe.enumEq(e,t);case 55:return t._hx_index==55?!0:pe.enumEq(e,t);case 56:return t._hx_index==56?!0:pe.enumEq(e,t);case 57:return t._hx_index==57?!0:pe.enumEq(e,t);default:return pe.enumEq(e,t)}}static isComment(e){switch(e._hx_index){case 51:let t=e.content;return!0;case 52:let i=e.content;return!0;case 53:let l=e.content;return!0;default:return!1}}static isAssignOp(e){switch(e._hx_index){case 20:case 21:case 22:case 23:case 24:case 25: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,l=e.code,n=e.external;return"function";case 15:let s=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 u=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"<=";case 37:return e.word?"and":"&&";case 38:return e.word?"or":"||";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:return"[";case 50:return"]";case 51:let f=e.content;return"comment";case 52:let m=e.content;return"multiline comment";case 53:let g=e.content;return"hash comment";case 54:return"indent";case 55:return"unindent";case 56:return"line break";case 57:return"end of file"}}}j["loreline.TokenTypeHelpers"]=Ot,Ot.__name__="loreline.TokenTypeHelpers";class ke{constructor(e,t){this.type=e,this.pos=t}toString(){return""+ne.string(this.type)+" at "+this.pos.toString()}}j["loreline.Token"]=ke,ke.__name__="loreline.Token",Object.assign(ke.prototype,{__class__:ke});class yt{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==x.Eof){if(this.indentStack.length>1){let i=this.indentStack.length-1,l=0,n=i;for(;l<n;){let s=l++,r=null;r==null&&(r=new he(this.startLine,this.startColumn,this.pos)),r.length=this.pos-r.offset;let h=new ke(x.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 45: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 49:this.stack.push(12),this.nextBlock=10;break;case 46:case 50:case 55:this.stack.pop(),this.nextBlock=10;break;case 54:let l;switch(this.nextBlock){case 0:case 1:l=1;break;case 2:case 3:l=3;break;case 4:case 5:l=5;break;case 6:case 7:l=7;break;case 8:case 9:l=9;break;case 10:case 11:case 12:l=11;break}this.stack.push(l),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 l=null;l==null&&(l=new he(this.startLine,this.startColumn,this.pos)),l.length=this.pos-l.offset;let n=new ke(x.Eof,l);return this.previous=n,n}this.startLine=this.line,this.startColumn=this.column;let e=p.cca(this.input,this.pos),t=e??-1;if(t==10||t==13){let l=this.readLineBreak(),n=this.countIndentation();if(n>this.indentStack[this.indentStack.length-1]){this.indentStack.length==1&&(this.detectedIndentSize=n-this.indentStack[0]),this.indentStack.push(n);let s=this.indentTokens,r=null;r==null&&(r=new he(this.startLine,this.startColumn,this.pos)),r.length=this.pos-r.offset;let h=new ke(x.Indent,r);this.previous=h,s.push(h)}else if(n<this.indentStack[this.indentStack.length-1])for(;this.indentStack.length>0&&n<this.indentStack[this.indentStack.length-1];){this.indentStack.pop();let s=this.indentTokens,r=null;r==null&&(r=new he(this.startLine,this.startColumn,this.pos)),r.length=this.pos-r.offset;let h=new ke(x.Unindent,r);this.previous=h,s.push(h)}return l}let i=new he(this.startLine,this.startColumn,this.pos);if(this.tokenized.length>0&&this.tokenized[this.tokenized.length-1].type==x.KwImport)return this.readImportValue(t,i);switch(t){case 34:let l=this.tryReadUnquotedString();return l??this.readString(i);case 91:let n=0,s=1;for(;n<s;){let y=n++;if(this.pos>=this.length)break;let T=p.cca(this.input,this.pos);(T??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.makeLooseOrStrictAfterBracket();let r=i;r==null&&(r=new he(this.startLine,this.startColumn,this.pos)),r.length=this.pos-r.offset;let h=new ke(x.LBracket,r);return this.previous=h,h;case 123:let a=0,o=1;for(;a<o;){let y=a++;if(this.pos>=this.length)break;let T=p.cca(this.input,this.pos);(T??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let u=i;u==null&&(u=new he(this.startLine,this.startColumn,this.pos)),u.length=this.pos-u.offset;let c=new ke(x.LBrace,u);return this.previous=c,c;case 125:let _=0,f=1;for(;_<f;){let y=_++;if(this.pos>=this.length)break;let T=p.cca(this.input,this.pos);(T??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let m=i;m==null&&(m=new he(this.startLine,this.startColumn,this.pos)),m.length=this.pos-m.offset;let g=new ke(x.RBrace,m);return this.previous=g,g;default:let w=this.tryReadUnquotedString();if(w!=null)return w;switch(t){case 33:let y=t;if(y>=48&&y<=57)return this.readNumber();{let H=t;if(H>=97&&H<=122||H>=65&&H<=90||H==95)return this.readIdentifier();{let ie;if(this.pos+1<this.length){let R=p.cca(this.input,this.pos+1);ie=R??-1}else ie=0;if(ie==61){let R=2;R==null&&(R=1);let ee=0,X=R;for(;ee<X;){let _e=ee++;if(this.pos>=this.length)break;let xe=p.cca(this.input,this.pos);(xe??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let Q=i;Q==null&&(Q=new he(this.startLine,this.startColumn,this.pos)),Q.length=this.pos-Q.offset;let ae=new ke(x.OpNotEquals,Q);return this.previous=ae,ae}else{let R=0,ee=1;for(;R<ee;){let ae=R++;if(this.pos>=this.length)break;let _e=p.cca(this.input,this.pos);(_e??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let X=i;X==null&&(X=new he(this.startLine,this.startColumn,this.pos)),X.length=this.pos-X.offset;let Q=new ke(x.OpNot,X);return this.previous=Q,Q}}}break;case 35:let T=t;if(T>=48&&T<=57)return this.readNumber();{let H=t;if(H>=97&&H<=122||H>=65&&H<=90||H==95)return this.readIdentifier();{let ie;if(this.pos+1<this.length){let R=p.cca(this.input,this.pos+1);ie=R??-1}else ie=0;return ie>=97&&ie<=122||ie>=65&&ie<=90||ie==95||ie>=48&&ie<=57||ie==45?this.readHashComment():(this.error("Unexpected character: #",!0),null)}}break;case 37:let E=t;if(E>=48&&E<=57)return this.readNumber();{let H=t;if(H>=97&&H<=122||H>=65&&H<=90||H==95)return this.readIdentifier();{let ie=0,R=1;for(;ie<R;){let Q=ie++;if(this.pos>=this.length)break;let ae=p.cca(this.input,this.pos);(ae??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ee=i;ee==null&&(ee=new he(this.startLine,this.startColumn,this.pos)),ee.length=this.pos-ee.offset;let X=new ke(x.OpModulo,ee);return this.previous=X,X}}break;case 38:let C=t;if(C>=48&&C<=57)return this.readNumber();{let H=t;if(H>=97&&H<=122||H>=65&&H<=90||H==95)return this.readIdentifier();{let ie;if(this.pos+1<this.length){let R=p.cca(this.input,this.pos+1);ie=R??-1}else ie=0;if(ie==38){let R=2;R==null&&(R=1);let ee=0,X=R;for(;ee<X;){let _e=ee++;if(this.pos>=this.length)break;let xe=p.cca(this.input,this.pos);(xe??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let Q=i;Q==null&&(Q=new he(this.startLine,this.startColumn,this.pos)),Q.length=this.pos-Q.offset;let ae=new ke(x.OpAnd(!1),Q);return this.previous=ae,ae}else{let R=0,ee=1;for(;R<ee;){let ae=R++;if(this.pos>=this.length)break;let _e=p.cca(this.input,this.pos);(_e??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.error("Expected &",!1);let X=i;X==null&&(X=new he(this.startLine,this.startColumn,this.pos)),X.length=this.pos-X.offset;let Q=new ke(x.OpAnd(!1),X);return this.previous=Q,Q}}}break;case 40:let P=0,I=1;for(;P<I;){let H=P++;if(this.pos>=this.length)break;let ie=p.cca(this.input,this.pos);(ie??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.makeStrictIfFollowingCallable();let v=i;v==null&&(v=new he(this.startLine,this.startColumn,this.pos)),v.length=this.pos-v.offset;let F=new ke(x.LParen,v);return this.previous=F,F;case 41:let B=0,A=1;for(;B<A;){let H=B++;if(this.pos>=this.length)break;let ie=p.cca(this.input,this.pos);(ie??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.strictExprs.pop();let L=i;L==null&&(L=new he(this.startLine,this.startColumn,this.pos)),L.length=this.pos-L.offset;let z=new ke(x.RParen,L);return this.previous=z,z;case 42:let D=t;if(D>=48&&D<=57)return this.readNumber();{let H=t;if(H>=97&&H<=122||H>=65&&H<=90||H==95)return this.readIdentifier();{let ie;if(this.pos+1<this.length){let R=p.cca(this.input,this.pos+1);ie=R??-1}else ie=0;if(ie==61){let R=2;R==null&&(R=1);let ee=0,X=R;for(;ee<X;){let _e=ee++;if(this.pos>=this.length)break;let xe=p.cca(this.input,this.pos);(xe??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let Q=i;Q==null&&(Q=new he(this.startLine,this.startColumn,this.pos)),Q.length=this.pos-Q.offset;let ae=new ke(x.OpMultiplyAssign,Q);return this.previous=ae,ae}else{let R=0,ee=1;for(;R<ee;){let ae=R++;if(this.pos>=this.length)break;let _e=p.cca(this.input,this.pos);(_e??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let X=i;X==null&&(X=new he(this.startLine,this.startColumn,this.pos)),X.length=this.pos-X.offset;let Q=new ke(x.OpMultiply,X);return this.previous=Q,Q}}}break;case 43:let O=t;if(O>=48&&O<=57)return this.readNumber();{let H=t;if(H>=97&&H<=122||H>=65&&H<=90||H==95)return this.readIdentifier();{let ie;if(this.pos+1<this.length){let R=p.cca(this.input,this.pos+1);ie=R??-1}else ie=0;if(ie==61){let R=2;R==null&&(R=1);let ee=0,X=R;for(;ee<X;){let _e=ee++;if(this.pos>=this.length)break;let xe=p.cca(this.input,this.pos);(xe??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let Q=i;Q==null&&(Q=new he(this.startLine,this.startColumn,this.pos)),Q.length=this.pos-Q.offset;let ae=new ke(x.OpPlusAssign,Q);return this.previous=ae,ae}else{let R=0,ee=1;for(;R<ee;){let ae=R++;if(this.pos>=this.length)break;let _e=p.cca(this.input,this.pos);(_e??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let X=i;X==null&&(X=new he(this.startLine,this.startColumn,this.pos)),X.length=this.pos-X.offset;let Q=new ke(x.OpPlus,X);return this.previous=Q,Q}}}break;case 44:let q=0,M=1;for(;q<M;){let H=q++;if(this.pos>=this.length)break;let ie=p.cca(this.input,this.pos);(ie??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let U=i;U==null&&(U=new he(this.startLine,this.startColumn,this.pos)),U.length=this.pos-U.offset;let K=new ke(x.Comma,U);return this.previous=K,K;case 45:let G=t;if(G>=48&&G<=57)return this.readNumber();{let H=t;if(H>=97&&H<=122||H>=65&&H<=90||H==95)return this.readIdentifier();{let ie;if(this.pos+1<this.length){let R=p.cca(this.input,this.pos+1);ie=R??-1}else ie=0;if(ie==62){let R=2;R==null&&(R=1);let ee=0,X=R;for(;ee<X;){let _e=ee++;if(this.pos>=this.length)break;let xe=p.cca(this.input,this.pos);(xe??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let Q=i;Q==null&&(Q=new he(this.startLine,this.startColumn,this.pos)),Q.length=this.pos-Q.offset;let ae=new ke(x.Arrow,Q);return this.previous=ae,ae}else{let R;if(this.pos+1<this.length){let ee=p.cca(this.input,this.pos+1);R=ee??-1}else R=0;if(R==45&&this.strictExprs.length==0){let ee=2;ee==null&&(ee=1);let X=0,Q=ee;for(;X<Q;){let xe=X++;if(this.pos>=this.length)break;let Ye=p.cca(this.input,this.pos);(Ye??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ae=i;ae==null&&(ae=new he(this.startLine,this.startColumn,this.pos)),ae.length=this.pos-ae.offset;let _e=new ke(x.Separator,ae);return this.previous=_e,_e}else{let ee;if(this.pos+1<this.length){let X=p.cca(this.input,this.pos+1);ee=X??-1}else ee=0;if(ee==61){let X=2;X==null&&(X=1);let Q=0,ae=X;for(;Q<ae;){let Ye=Q++;if(this.pos>=this.length)break;let gt=p.cca(this.input,this.pos);(gt??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let _e=i;_e==null&&(_e=new he(this.startLine,this.startColumn,this.pos)),_e.length=this.pos-_e.offset;let xe=new ke(x.OpMinusAssign,_e);return this.previous=xe,xe}else{let X=0,Q=1;for(;X<Q;){let xe=X++;if(this.pos>=this.length)break;let Ye=p.cca(this.input,this.pos);(Ye??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ae=i;ae==null&&(ae=new he(this.startLine,this.startColumn,this.pos)),ae.length=this.pos-ae.offset;let _e=new ke(x.OpMinus,ae);return this.previous=_e,_e}}}}}break;case 46:let Y=0,$=1;for(;Y<$;){let H=Y++;if(this.pos>=this.length)break;let ie=p.cca(this.input,this.pos);(ie??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let se=i;se==null&&(se=new he(this.startLine,this.startColumn,this.pos)),se.length=this.pos-se.offset;let ue=new ke(x.Dot,se);return this.previous=ue,ue;case 47:let oe=t;if(oe>=48&&oe<=57)return this.readNumber();{let H=t;if(H>=97&&H<=122||H>=65&&H<=90||H==95)return this.readIdentifier();{let ie;if(this.pos+1<this.length){let R=p.cca(this.input,this.pos+1);ie=R??-1}else ie=0;if(ie==61){let R=2;R==null&&(R=1);let ee=0,X=R;for(;ee<X;){let _e=ee++;if(this.pos>=this.length)break;let xe=p.cca(this.input,this.pos);(xe??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let Q=i;Q==null&&(Q=new he(this.startLine,this.startColumn,this.pos)),Q.length=this.pos-Q.offset;let ae=new ke(x.OpDivideAssign,Q);return this.previous=ae,ae}else{let R;if(this.pos+1<this.length){let ee=p.cca(this.input,this.pos+1);R=ee??-1}else R=0;if(R==47)return this.readLineComment();{let ee;if(this.pos+1<this.length){let X=p.cca(this.input,this.pos+1);ee=X??-1}else ee=0;if(ee==42)return this.readMultiLineComment();{let X=0,Q=1;for(;X<Q;){let xe=X++;if(this.pos>=this.length)break;let Ye=p.cca(this.input,this.pos);(Ye??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ae=i;ae==null&&(ae=new he(this.startLine,this.startColumn,this.pos)),ae.length=this.pos-ae.offset;let _e=new ke(x.OpDivide,ae);return this.previous=_e,_e}}}}}break;case 58:let ge;if(this.pos+1<this.length){let H=p.cca(this.input,this.pos+1);ge=H??-1}else ge=0;if(ge==61){let H=2;H==null&&(H=1);let ie=0,R=H;for(;ie<R;){let Q=ie++;if(this.pos>=this.length)break;let ae=p.cca(this.input,this.pos);(ae??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ee=i;ee==null&&(ee=new he(this.startLine,this.startColumn,this.pos)),ee.length=this.pos-ee.offset;let X=new ke(x.OpUnquotedAssign,ee);return this.previous=X,X}else{let H=0,ie=1;for(;H<ie;){let X=H++;if(this.pos>=this.length)break;let Q=p.cca(this.input,this.pos);(Q??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let R=i;R==null&&(R=new he(this.startLine,this.startColumn,this.pos)),R.length=this.pos-R.offset;let ee=new ke(x.Colon,R);return this.previous=ee,ee}break;case 60:let me=t;if(me>=48&&me<=57)return this.readNumber();{let H=t;if(H>=97&&H<=122||H>=65&&H<=90||H==95)return this.readIdentifier();{let ie;if(this.pos+1<this.length){let R=p.cca(this.input,this.pos+1);ie=R??-1}else ie=0;if(ie==61){let R=2;R==null&&(R=1);let ee=0,X=R;for(;ee<X;){let _e=ee++;if(this.pos>=this.length)break;let xe=p.cca(this.input,this.pos);(xe??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let Q=i;Q==null&&(Q=new he(this.startLine,this.startColumn,this.pos)),Q.length=this.pos-Q.offset;let ae=new ke(x.OpLessEq,Q);return this.previous=ae,ae}else{let R=0,ee=1;for(;R<ee;){let ae=R++;if(this.pos>=this.length)break;let _e=p.cca(this.input,this.pos);(_e??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let X=i;X==null&&(X=new he(this.startLine,this.startColumn,this.pos)),X.length=this.pos-X.offset;let Q=new ke(x.OpLess,X);return this.previous=Q,Q}}}break;case 61:let de=t;if(de>=48&&de<=57)return this.readNumber();{let H=t;if(H>=97&&H<=122||H>=65&&H<=90||H==95)return this.readIdentifier();{let ie;if(this.pos+1<this.length){let R=p.cca(this.input,this.pos+1);ie=R??-1}else ie=0;if(ie==61){let R=2;R==null&&(R=1);let ee=0,X=R;for(;ee<X;){let _e=ee++;if(this.pos>=this.length)break;let xe=p.cca(this.input,this.pos);(xe??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let Q=i;Q==null&&(Q=new he(this.startLine,this.startColumn,this.pos)),Q.length=this.pos-Q.offset;let ae=new ke(x.OpEquals,Q);return this.previous=ae,ae}else{let R=0,ee=1;for(;R<ee;){let ae=R++;if(this.pos>=this.length)break;let _e=p.cca(this.input,this.pos);(_e??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let X=i;X==null&&(X=new he(this.startLine,this.startColumn,this.pos)),X.length=this.pos-X.offset;let Q=new ke(x.OpAssign,X);return this.previous=Q,Q}}}break;case 62:let Oe=t;if(Oe>=48&&Oe<=57)return this.readNumber();{let H=t;if(H>=97&&H<=122||H>=65&&H<=90||H==95)return this.readIdentifier();{let ie;if(this.pos+1<this.length){let R=p.cca(this.input,this.pos+1);ie=R??-1}else ie=0;if(ie==61){let R=2;R==null&&(R=1);let ee=0,X=R;for(;ee<X;){let _e=ee++;if(this.pos>=this.length)break;let xe=p.cca(this.input,this.pos);(xe??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let Q=i;Q==null&&(Q=new he(this.startLine,this.startColumn,this.pos)),Q.length=this.pos-Q.offset;let ae=new ke(x.OpGreaterEq,Q);return this.previous=ae,ae}else{let R=0,ee=1;for(;R<ee;){let ae=R++;if(this.pos>=this.length)break;let _e=p.cca(this.input,this.pos);(_e??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let X=i;X==null&&(X=new he(this.startLine,this.startColumn,this.pos)),X.length=this.pos-X.offset;let Q=new ke(x.OpGreater,X);return this.previous=Q,Q}}}break;case 63:let Ve=t;if(Ve>=48&&Ve<=57)return this.readNumber();{let H=t;if(H>=97&&H<=122||H>=65&&H<=90||H==95)return this.readIdentifier();{this.pos++;let ie=null;ie==null&&(ie=new he(this.startLine,this.startColumn,this.pos)),ie.length=this.pos-ie.offset;let R=new ke(x.Question,ie);return this.previous=R,R}}break;case 93:let je=0,et=1;for(;je<et;){let H=je++;if(this.pos>=this.length)break;let ie=p.cca(this.input,this.pos);(ie??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.strictExprs.pop();let Ue=i;Ue==null&&(Ue=new he(this.startLine,this.startColumn,this.pos)),Ue.length=this.pos-Ue.offset;let Ge=new ke(x.RBracket,Ue);return this.previous=Ge,Ge;case 124:let nt=t;if(nt>=48&&nt<=57)return this.readNumber();{let H=t;if(H>=97&&H<=122||H>=65&&H<=90||H==95)return this.readIdentifier();{let ie;if(this.pos+1<this.length){let R=p.cca(this.input,this.pos+1);ie=R??-1}else ie=0;if(ie==124){let R=2;R==null&&(R=1);let ee=0,X=R;for(;ee<X;){let _e=ee++;if(this.pos>=this.length)break;let xe=p.cca(this.input,this.pos);(xe??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let Q=i;Q==null&&(Q=new he(this.startLine,this.startColumn,this.pos)),Q.length=this.pos-Q.offset;let ae=new ke(x.OpOr(!1),Q);return this.previous=ae,ae}else{let R=0,ee=1;for(;R<ee;){let ae=R++;if(this.pos>=this.length)break;let _e=p.cca(this.input,this.pos);(_e??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.error("Expected |",!1);let X=i;X==null&&(X=new he(this.startLine,this.startColumn,this.pos)),X.length=this.pos-X.offset;let Q=new ke(x.OpOr(!1),X);return this.previous=Q,Q}}}break;default:let De=t;if(De>=48&&De<=57)return this.readNumber();{let H=t;return H>=97&&H<=122||H>=65&&H<=90||H==95?this.readIdentifier():(this.error("Unexpected character: "+String.fromCodePoint(t),!0),null)}}}}countIndentation(){let e=this.pos,t=0;for(;e<this.length;){let n=p.cca(this.input,e),s=n??-1;if(s==32)++t;else if(s==9)++t;else break;++e}let i,l;if(e<this.length){let n=p.cca(this.input,e);l=(n??-1)==10}else l=!0;if(l)i=!0;else{let n=p.cca(this.input,e);i=(n??-1)==13}return i?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 x.KwBeat;case 2:case 3:return x.KwState;case 4:case 5:return x.KwCharacter;case 6:case 7:return x.KwBeat;case 8:case 9:return x.KwBeat;case 10:return x.LBrace;case 11:return x.Indent;case 12:return x.LBracket}--e}return x.KwBeat}inBeat(){return this.parentBlockType()==x.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!=x.KwState?e==x.KwCharacter:!0}readLineBreak(){let e=new he(this.startLine,this.startColumn,this.pos),t=p.cca(this.input,this.pos);if((t??-1)==13){let n=0,s=1;for(;n<s;){let h=n++;if(this.pos>=this.length)break;let a=p.cca(this.input,this.pos);(a??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let r;if(this.pos<this.length){let h=p.cca(this.input,this.pos);r=(h??-1)==10}else r=!1;if(r){let h=0,a=1;for(;h<a;){let o=h++;if(this.pos>=this.length)break;let u=p.cca(this.input,this.pos);(u??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}else{let n=0,s=1;for(;n<s;){let r=n++;if(this.pos>=this.length)break;let h=p.cca(this.input,this.pos);(h??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let i=e;i==null&&(i=new he(this.startLine,this.startColumn,this.pos)),i.length=this.pos-i.offset;let l=new ke(x.LineBreak,i);return this.previous=l,l}isWhitespace(e){return e!=32?e==9:!0}matchIdentifier(e){if(this.length==0)return null;let t=p.cca(this.input,e),i=t??-1;if(!(i>=97&&i<=122||i>=65&&i<=90||i==95))return null;let l=1;for(;l<this.length;){let s=p.cca(this.input,e+l),r=s??-1;if(!(r>=97&&r<=122||r>=65&&r<=90||r==95||r>=48&&r<=57))break;++l}let n=this.input;return l!=null?p.substr(n,e,l):p.substr(n,e,null)}_skipWhitespaceAndComments(e,t){if(t==null&&(t=!1),t)return this._skipWhitespaceAndCommentsStopNextLine(e);{let i=e,l=!1;for(;e<this.length;){for(;;){let n;if(e<this.length){let s=p.cca(this.input,e);if((s??-1)!=32){let r=p.cca(this.input,e);n=(r??-1)==9}else n=!0}else n=!1;if(!n)break;++e,l=!0}if(e<this.length-1){let n=p.cca(this.input,e);if((n??-1)==47){let s=p.cca(this.input,e+1);if((s??-1)==47)return e=i,e;{let r=p.cca(this.input,e+1);if((r??-1)==42){e+=2,l=!0;let h=!1;for(;e<this.length-1;){let a,o=p.cca(this.input,e);if((o??-1)==42){let u=p.cca(this.input,e+1);a=(u??-1)==47}else a=!1;if(a){e+=2,h=!0;break}++e}if(!h)return e=i,e;continue}}}}break}return l?e:i}}_skipWhitespaceAndCommentsStopNextLine(e){let t=e,i=!1,l=!1;for(;e<this.length;){for(;e<this.length;){let n=p.cca(this.input,e),s=n??-1;if(s==32||s==9||s==13||!l&&s==10)s==10&&(l=!0),++e,i=!0;else break}if(e<this.length-1&&!l){let n=p.cca(this.input,e);if((n??-1)==47){let s=p.cca(this.input,e+1);if((s??-1)==47){for(e+=2,i=!0;;){let r,h;if(e<this.length){let a=p.cca(this.input,e);h=(a??-1)!=10}else h=!1;if(h){let a=p.cca(this.input,e);r=(a??-1)!=13}else r=!1;if(!r)break;++e}continue}else{let r=p.cca(this.input,e+1);if((r??-1)==42){e+=2,i=!0;let h=!1;for(;e<this.length-1;){let a,o=p.cca(this.input,e);if((o??-1)==42){let u=p.cca(this.input,e+1);a=(u??-1)==47}else a=!1;if(a){e+=2,h=!0;break}++e}if(!h)return e=t,e;continue}}}}break}return i?e:t}isIfStart(e){e=this._skipWhitespaceAndComments(e,!1);let t=p.cca(this.input,e);if((t??-1)!=105)return!1;++e;let i=p.cca(this.input,e);if((i??-1)!=102)return!1;let l=++e;e=this._skipWhitespaceAndComments(e,!1);let n;if(e<this.length){let o=p.cca(this.input,e);n=(o??-1)==33}else n=!1;n&&(++e,e=this._skipWhitespaceAndComments(e,!1));let s=p.cca(this.input,e);if((s??-1)==40)return!0;let r;if(e==l&&l<this.length){let o=p.cca(this.input,l),u=o??-1;r=u>=97&&u<=122||u>=65&&u<=90||u==95}else r=!1;if(r)return!1;let h;if(e<this.length){let o=p.cca(this.input,e),u=o??-1;h=!(u>=97&&u<=122||u>=65&&u<=90||u==95)}else h=!0;if(h)return!1;let a=this;for(;e<this.length;){let o=p.cca(this.input,e);if((o??-1)==40)return!0;{let C=!0,P=a.length;if(e>=P)C=!1;else{let I,v,F;if(e+1<P){let B=p.cca(a.input,e);F=(B??-1)==111}else F=!1;if(F){let B=p.cca(a.input,e+1);v=(B??-1)==114}else v=!1;if(v)if(e+2<P){let B=p.cca(a.input,e+2),A=B??-1;I=!(A>=97&&A<=122||A>=65&&A<=90||A==95)}else I=!0;else I=!1;if(I)C=!1;else{let B,A,L,z;if(e+2<P){let D=p.cca(a.input,e);z=(D??-1)==97}else z=!1;if(z){let D=p.cca(a.input,e+1);L=(D??-1)==110}else L=!1;if(L){let D=p.cca(a.input,e+2);A=(D??-1)==100}else A=!1;if(A)if(e+3<P){let D=p.cca(a.input,e+3),O=D??-1;B=!(O>=97&&O<=122||O>=65&&O<=90||O==95)}else B=!0;else B=!1;if(B)C=!1;else{let D=p.cca(a.input,e),O=D??-1;if(!(O>=97&&O<=122||O>=65&&O<=90||O==95))C=!1;else for(++e;e<a.length;){let q=p.cca(a.input,e);if(O=q??-1,!(O>=97&&O<=122||O>=65&&O<=90||O==95||O>=48&&O<=57))break;++e}}}}if(!C)return!1}if(e=this._skipWhitespaceAndComments(e,!1),e>=this.length)return!0;let u=p.cca(this.input,e),c=u??-1;if(c==46){++e,e=this._skipWhitespaceAndComments(e,!1);let C=!0,P=a.length;if(e>=P)C=!1;else{let v,F,B;if(e+1<P){let A=p.cca(a.input,e);B=(A??-1)==111}else B=!1;if(B){let A=p.cca(a.input,e+1);F=(A??-1)==114}else F=!1;if(F)if(e+2<P){let A=p.cca(a.input,e+2),L=A??-1;v=!(L>=97&&L<=122||L>=65&&L<=90||L==95)}else v=!0;else v=!1;if(v)C=!1;else{let A,L,z,D;if(e+2<P){let O=p.cca(a.input,e);D=(O??-1)==97}else D=!1;if(D){let O=p.cca(a.input,e+1);z=(O??-1)==110}else z=!1;if(z){let O=p.cca(a.input,e+2);L=(O??-1)==100}else L=!1;if(L)if(e+3<P){let O=p.cca(a.input,e+3),q=O??-1;A=!(q>=97&&q<=122||q>=65&&q<=90||q==95)}else A=!0;else A=!1;if(A)C=!1;else{let O=p.cca(a.input,e),q=O??-1;if(!(q>=97&&q<=122||q>=65&&q<=90||q==95))C=!1;else for(++e;e<a.length;){let M=p.cca(a.input,e);if(q=M??-1,!(q>=97&&q<=122||q>=65&&q<=90||q==95||q>=48&&q<=57))break;++e}}}}if(!C||(e=this._skipWhitespaceAndComments(e,!1),e>=this.length))return!0;let I=p.cca(this.input,e);c=I??-1}if(c==91){++e;let C=1;for(;e<this.length&&C>0;){let I=p.cca(this.input,e);c=I??-1,c==91&&++C,c==93&&--C,++e}if(e=this._skipWhitespaceAndComments(e,!1),e>=this.length)return!0;let P=p.cca(this.input,e);c=P??-1}let _,f,m;if(c==97){let C=p.cca(this.input,e+1);m=(C??-1)==110}else m=!1;if(m){let C=p.cca(this.input,e+2);f=(C??-1)==100}else f=!1;if(f)if(e+3<this.length){let C=p.cca(this.input,e+3),P=C??-1;_=!(P>=97&&P<=122||P>=65&&P<=90||P==95)}else _=!0;else _=!1;if(_)return!0;let g,w;if(c==111){let C=p.cca(this.input,e+1);w=(C??-1)==114}else w=!1;if(w)if(e+2<this.length){let C=p.cca(this.input,e+2),P=C??-1;g=!(P>=97&&P<=122||P>=65&&P<=90||P==95)}else g=!0;else g=!1;if(g)return!0;let y,T,E;if(c==40||c==38||c==124)E=!0;else{let C=p.cca(this.input,e+1);E=(C??-1)==61&&c==61}if(E||c==62||c==60)T=!0;else if(c==33){let C=p.cca(this.input,e+1);T=(C??-1)==61}else T=!1;if(T)y=!0;else{let C=p.cca(this.input,e+1);y=(C??-1)!=61&&(c==43||c==45||c==42||c==47||c==123)}if(y)return!0;if(c==10||c==13||e>=this.length)return e=l,!0;if(c==32||c==9){let C=e;for(;;){let v;if(C<this.length){let F=p.cca(this.input,C),B=F??-1;v=B==32||B==9}else v=!1;if(!v)break;++C}let P,I;if(C+1<this.length){let v=p.cca(this.input,C);I=(v??-1)==47}else I=!1;if(I){let v=p.cca(this.input,C+1);P=(v??-1)==47}else P=!1;if(P)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;let i=p.cca(this.input,e);if((i??-1)==40)return!0;let l=this,n=t;n==null&&(n=!1);let s=!0;if(e>=l.length)s=!1;else{let r=!1,h=p.cca(l.input,e),a=h??-1;if(r=a==95,!(a>=97&&a<=122||a>=65&&a<=90||a==95)||n&&!r&&!(a>=97&&a<=122))s=!1;else for(++e;e<l.length;){let o=r,u=p.cca(l.input,e);if(a=u??-1,r=a==95,!(a>=97&&a<=122||a>=65&&a<=90||a==95||a>=48&&a<=57))break;if(n&&o&&!r&&!(a>=97&&a<=122)){s=!1;break}++e}}if(!s)return!1;for(;e<this.length;){if(e=this._skipWhitespaceAndComments(e,!1),e>=this.length)return!0;let r=p.cca(this.input,e),h=r??-1;if(!(h==32||h==9)&&h!=46&&h!=91&&h!=10&&h!=13&&h!=47)return!1;let a;if(h==10||h==13)a=!0;else if(h==47&&e+1<this.length){let o=p.cca(this.input,e+1);if((o??-1)!=47){let u=p.cca(this.input,e+1);a=(u??-1)==42}else a=!0}else a=!1;if(a)return!0;if(h==46){if(++e,e=this._skipWhitespaceAndComments(e,!1),e>=this.length)return!0;let o=!0;if(e>=l.length)o=!1;else{let u=!1,c=p.cca(l.input,e),_=c??-1;if(u=_==95,!(_>=97&&_<=122||_>=65&&_<=90||_==95))o=!1;else for(++e;e<l.length;){let f=u,m=p.cca(l.input,e);if(_=m??-1,u=_==95,!(_>=97&&_<=122||_>=65&&_<=90||_==95||_>=48&&_<=57))break;++e}}if(!o)return!0;continue}if(h==91){++e;let o=1;for(;e<this.length&&o>0;){let u=p.cca(this.input,e);h=u??-1,h==91&&++o,h==93&&--o,++e}continue}if(h==32||h==9){++e;continue}break}return!0}isTransitionStart(e){let t,i=p.cca(this.input,e);if((i??-1)!=45||e>=this.length-1)t=!0;else{let s=p.cca(this.input,e+1);t=(s??-1)!=62}if(t||(e+=2,e=this._skipWhitespaceAndComments(e,!1),e>=this.length))return!1;let l=p.cca(this.input,e);if((l??-1)==46)++e;else{let s=p.cca(this.input,e),r=s??-1;if(r>=97&&r<=122||r>=65&&r<=90||r==95||r>=48&&r<=57)for(++e;;){let h;if(e<this.length){let a=p.cca(this.input,e),o=a??-1;h=o>=97&&o<=122||o>=65&&o<=90||o==95||o>=48&&o<=57}else h=!1;if(!h)break;++e}else return!1}if(e=this._skipWhitespaceAndComments(e,!1),e<this.length){let s=p.cca(this.input,e),r=s??-1;if(r!=10&&r!=13&&r!=32&&r!=9&&r!=47&&r!=35)return!1}return!0}isInsertionStart(e){let t=p.cca(this.input,e);if((t??-1)!=43||(++e,e=this._skipWhitespaceAndComments(e,!1),e>=this.length))return!1;let i=p.cca(this.input,e);if((i??-1)==46)++e;else{let n=p.cca(this.input,e),s=n??-1;if(s>=97&&s<=122||s>=65&&s<=90||s==95||s>=48&&s<=57)for(++e;;){let r;if(e<this.length){let h=p.cca(this.input,e),a=h??-1;r=a>=97&&a<=122||a>=65&&a<=90||a==95||a>=48&&a<=57}else r=!1;if(!r)break;++e}else return!1}if(e=this._skipWhitespaceAndComments(e,!1),e<this.length){let n=p.cca(this.input,e),s=n??-1,r;if(s==105&&e+1<this.length){let h=p.cca(this.input,e+1);r=(h??-1)==102}else r=!1;if(r){let h;if(e+2<this.length){let a=p.cca(this.input,e+2),o=a??-1;h=!(o>=97&&o<=122||o>=65&&o<=90||o==95||o>=48&&o<=57)}else h=!0;if(h)return!0}if(s!=10&&s!=13&&s!=32&&s!=9&&s!=47)return!1}return!0}isChoiceOnceStart(e){if(!this.inChoiceRoot())return!1;let t=p.cca(this.input,e);if((t??-1)!=45||(++e,e>=this.length))return!1;let i=p.cca(this.input,e);return(i??-1)==32}isLabelStart(e){e=this._skipWhitespaceAndComments(e,!1);let t=p.cca(this.input,e),i=t??-1;if(!(i>=97&&i<=122||i>=65&&i<=90||i==95))return!1;let l=e;for(++e;;){let a;if(e<this.length){let o=p.cca(this.input,e),u=o??-1;a=u>=97&&u<=122||u>=65&&u<=90||u==95||u>=48&&u<=57}else a=!1;if(!a)break;++e}for(;;){let a;if(e<this.length){let o=p.cca(this.input,e),u=o??-1;a=u==32||u==9}else a=!1;if(!a)break;++e}let n;if(e<this.length){let a=p.cca(this.input,e);n=(a??-1)!=58}else n=!0;if(n)return!1;let s=this.input,r=e-l,h=r!=null?p.substr(s,l,r):p.substr(s,l,null);return!Object.prototype.hasOwnProperty.call(yt.KEYWORDS.h,h)}isCallStart(e){let t=e,i=this,l=!0;if(e>=i.length)l=!1;else{let n=p.cca(i.input,e),s=n??-1;if(!(s>=97&&s<=122||s>=65&&s<=90||s==95))l=!1;else for(++e;e<i.length;){let r=p.cca(i.input,e);if(s=r??-1,!(s>=97&&s<=122||s>=65&&s<=90||s==95||s>=48&&s<=57))break;++e}}if(!l)return e=t,!1;for(;e<this.length;){if(e=this._skipWhitespaceAndComments(e,!1),e>=this.length)return e=t,!1;let n=p.cca(this.input,e),s=n??-1;if(s==40)return e=t,!0;if(s==46){++e,e=this._skipWhitespaceAndComments(e,!1);let r=!0;if(e>=i.length)r=!1;else{let h=p.cca(i.input,e),a=h??-1;if(!(a>=97&&a<=122||a>=65&&a<=90||a==95))r=!1;else for(++e;e<i.length;){let o=p.cca(i.input,e);if(a=o??-1,!(a>=97&&a<=122||a>=65&&a<=90||a==95||a>=48&&a<=57))break;++e}}if(!r)return e=t,!1;continue}if(s==91){for(++e;e<this.length;){let r=p.cca(this.input,e);if((r??-1)==93){++e;break}++e}continue}return e=t,!1}return e=t,!1}isAssignStart(e,t){let i=this,l;if(t){let s=!0,r=e;if(e>=i.length)s=!1;else{let o=p.cca(i.input,e),u=o??-1;if(!(u>=97&&u<=122||u>=65&&u<=90||u==95))s=!1;else for(++e;e<i.length;){let c=p.cca(i.input,e);if(u=c??-1,!(u>=97&&u<=122||u>=65&&u<=90||u==95||u>=48&&u<=57))break;++e}}let h,a;if(e==r+2){let o=p.cca(i.input,r);a=(o??-1)==105}else a=!1;if(a){let o=p.cca(i.input,r+1);h=(o??-1)==102}else h=!1;l=!(!h&&s)}else l=!1;if(l)return!1;let n=!1;for(;e<this.length;){if(e=this._skipWhitespaceAndComments(e,!1),e>=this.length)return!1;let s=p.cca(this.input,e),r=s??-1,h;if(n)h=!1;else if(r!=61){let a=p.cca(this.input,e+1);h=(a??-1)==61&&(r==43||r==45||r==42||r==47||r==58)}else h=!0;if(h)return!0;if(t){if(r==46){++e,e=this._skipWhitespaceAndComments(e,!1);let a=!0,o=e;if(e>=i.length)a=!1;else{let _=p.cca(i.input,e),f=_??-1;if(!(f>=97&&f<=122||f>=65&&f<=90||f==95))a=!1;else for(++e;e<i.length;){let m=p.cca(i.input,e);if(f=m??-1,!(f>=97&&f<=122||f>=65&&f<=90||f==95||f>=48&&f<=57))break;++e}}let u,c;if(e==o+2){let _=p.cca(i.input,o);c=(_??-1)==105}else c=!1;if(c){let _=p.cca(i.input,o+1);u=(_??-1)==102}else u=!1;if(!(!u&&a))return!1;continue}if(r==91){for(++e;e<this.length;){let a=p.cca(this.input,e);if((a??-1)==93){++e;break}++e}continue}return!1}else if(r==92)n=!0,++e;else{if(r==13||r==10)return!1;if(r>=97&&r<=122||r>=65&&r<=90||r==95){let a=!0,o=e;if(e>=i.length)a=!1;else{let _=p.cca(i.input,e),f=_??-1;if(!(f>=97&&f<=122||f>=65&&f<=90||f==95))a=!1;else for(++e;e<i.length;){let m=p.cca(i.input,e);if(f=m??-1,!(f>=97&&f<=122||f>=65&&f<=90||f==95||f>=48&&f<=57))break;++e}}let u,c;if(e==o+2){let _=p.cca(i.input,o);c=(_??-1)==105}else c=!1;if(c){let _=p.cca(i.input,o+1);u=(_??-1)==102}else u=!1;if(!(!u&&a))return!1}else++e}}return!1}isColon(e,t){if(t==null&&(t=!0),t)for(;;){let i;if(e<this.length){let l=p.cca(this.input,e);if((l??-1)!=32){let n=p.cca(this.input,e);i=(n??-1)==9}else i=!0}else i=!1;if(!i)break;++e}if(e<this.length){let i=p.cca(this.input,e);return(i??-1)==58}else return!1}afterLabelIdentifierToken(e){e==null&&(e=!0);let t=this.tokenized.length-1;for(;t>=0;){let i=this.tokenized[t];if(!Ot.isComment(i.type)&&(e||i.type!=x.LineBreak&&i.type!=x.Indent&&i.type!=x.Unindent))return i.type==x.Colon&&t>0&&Ot.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!=x.Colon;)++i;let l=this.tokenized[i].pos.offset+1,n=t.pos.column,s=!0,r=!1;for(;l<this.length;){let g=p.cca(this.input,l),w=g??-1;if(w==32||w==9)++l;else break}for(;l<this.length;){let g=p.cca(this.input,l),w=g??-1;if(w==10||w==13)break;if(w==47&&l+1<this.length){let y=p.cca(this.input,l+1),T=y??-1;if(T==47)break;if(T==42){for(l+=2;l<this.length;){let E,C=p.cca(this.input,l);if((C??-1)==42&&l+1<this.length){let P=p.cca(this.input,l+1);E=(P??-1)==47}else E=!1;if(E){l+=2;break}++l}continue}}if(w==60)r=!0;else if(w==62)r=!1;else if(!r&&!(w==32||w==9)){s=!1;break}++l}if(!s)for(;;){let g,w;if(l<this.length){let y=p.cca(this.input,l);w=(y??-1)!=10}else w=!1;if(w){let y=p.cca(this.input,l);g=(y??-1)!=13}else g=!1;if(!g)break;++l}let h=l,a=!0;if(a==null&&(a=!1),l=this._skipWhitespaceAndComments(l,a),l<=h)return-1;let o=0,u=l;for(;;){let g;if(u>0){let w=p.cca(this.input,u-1);if((w??-1)!=32){let y=p.cca(this.input,u-1);g=(y??-1)==9}else g=!0}else g=!1;if(!g)break;++o,--u}if(o<=n-1)return-1;let c=!1;c==null&&(c=!1),l=this._skipWhitespaceAndComments(l,c);let _,f=p.cca(this.input,l),m=f??-1;if(m==32||m==9)_=!0;else{let g=p.cca(this.input,l);if((g??-1)==47){let w=p.cca(this.input,l+1);_=(w??-1)==47}else _=!1}return _?-1:o}isContinuingMultilineText(e,t){let i,l=p.cca(this.input,e);if((l??-1)==47){let f=p.cca(this.input,e+1);i=(f??-1)==47}else i=!1;if(i)for(;;){let f,m;if(e<this.length){let g=p.cca(this.input,e);m=(g??-1)!=13}else m=!1;if(m){let g=p.cca(this.input,e);f=(g??-1)!=10}else f=!1;if(!f)break;++e}let n=p.cca(this.input,e);(n??-1)==13&&++e;let s=p.cca(this.input,e);if((s??-1)==10)++e;else return!1;let r=0;for(;;){let f,m=p.cca(this.input,e);if((m??-1)!=32){let g=p.cca(this.input,e);f=(g??-1)==9}else f=!0;if(!f)break;++r,++e}if(r!=t)return!1;let h=!1;h==null&&(h=!1),e=this._skipWhitespaceAndComments(e,h);let a,o,u,c=p.cca(this.input,e),_=c??-1;if(_==32||_==9)u=!0;else{let f=p.cca(this.input,e);u=(f??-1)==13}if(u)o=!0;else{let f=p.cca(this.input,e);o=(f??-1)==10}if(o)a=!0;else{let f=p.cca(this.input,e);if((f??-1)==47){let m=p.cca(this.input,e+1);a=(m??-1)==47}else a=!1}return!a}isAfterComma(){let e=this.tokenized.length-1;for(;e>=0;){let t=this.tokenized[e];if(!Ot.isComment(t.type)&&t.type!=x.LineBreak&&t.type!=x.Indent&&t.type!=x.Unindent)return t.type==x.Comma;--e}return!1}isAfterLBracket(){let e=this.tokenized.length-1;for(;e>=0;){let t=this.tokenized[e];if(!Ot.isComment(t.type)&&t.type!=x.LineBreak&&t.type!=x.Indent&&t.type!=x.Unindent)return t.type==x.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(Ot.isComment(t.type)||t.type==x.Indent||t.type==x.Unindent)--e;else return!!Ot.isAssignOp(t.type)}return!1}followsUnquotedAssign(){let e=this.tokenized.length-1;for(;e>=0;){let t=this.tokenized[e];if(Ot.isComment(t.type)||t.type==x.Indent||t.type==x.Unindent)--e;else return t.type==x.OpUnquotedAssign}return!1}followsOnlyLabelOrCommentsInLine(){let e=!1,t=this.tokenized.length-1;for(;t>=0;){let i=this.tokenized[t];if(Ot.isComment(i.type)||i.type==x.Indent||i.type==x.Unindent)--t;else if(!e&&i.type==x.Colon)if(--t,t>=0)Ot.isIdentifier(this.tokenized[t].type)&&(e=!0,--t);else return!1;else return i.type==x.LineBreak}return!0}followsOnlyWhitespacesOrCommentsInLine(){let e=this.tokenized.length-1;for(;e>=0;){let t=this.tokenized[e];if(Ot.isComment(t.type)||t.type==x.Indent||t.type==x.Unindent)--e;else return t.type==x.LineBreak}return!0}followsChoiceOncePrefix(){if(!this.inChoiceRoot())return!1;let e=this.tokenized.length-1;for(;e>=0;){let t=this.tokenized[e];if(Ot.isComment(t.type)||t.type==x.Indent||t.type==x.Unindent)--e;else return t.type==x.OpMinus}return!1}hasNonSpecialChar(e){let t=0,i=e.length;for(;t<i;){let l=t++,n=!1,s=p.cca(e,l),r=s??-1,h=0,a=yt.hasNonSpecialChar_specialChars.length;for(;h<a;){let o=h++,u=p.cca(yt.hasNonSpecialChar_specialChars,o);if(r==(u??-1)){n=!0;break}}if(!n)return!0}return!1}isNumber(e){let t=0,i=e.length,l;if(t<i){let h=p.cca(e,t);l=(h??-1)==45}else l=!1;l&&++t;let n=t;for(;;){let h;if(t<i){let a=p.cca(e,t),o=a??-1;h=o>=48&&o<=57}else h=!1;if(!h)break;++t}if(t==n)return!1;let s,r;if(t<i){let h=p.cca(e,t);r=(h??-1)==46}else r=!1;if(r&&t+1<i){let h=p.cca(e,t+1),a=h??-1;s=a>=48&&a<=57}else s=!1;if(s)for(++t;;){let h;if(t<i){let a=p.cca(e,t),o=a??-1;h=o>=48&&o<=57}else h=!1;if(!h)break;++t}return t==i}makeLooseOrStrictAfterBracket(){if(this.isStrict()){this.strictExprs.push(1);return}let e=this.tokenized.length-1;for(;e>=0;){let i=this.tokenized[e].type;switch(i._hx_index){case 19:let l=i.name;this.strictExprs.push(1);return;case 48:case 50:this.strictExprs.push(1);return;case 51:let n=i.content;break;case 52:let s=i.content;break;case 53:let r=i.content;break;case 54:case 55:case 56: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 l=i.name;return!0;case 48:case 50:return!0;case 51:let n=i.content;break;case 52:let s=i.content;break;case 53:let r=i.content;break;case 54:case 55:case 56: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=p.cca(this.input,this.pos),h=r??-1;if(h==10)break;if(h==47&&this.pos+1<this.length){let a=p.cca(this.input,this.pos+1),o=a??-1;if(o==47||o==42)break}if(h==35&&this.pos+1<this.length){let a=p.cca(this.input,this.pos+1),o=a??-1;if(o>=97&&o<=122||o>=65&&o<=90||o==95||o>=48&&o<=57||o==45)break}i+=String.fromCodePoint(h),this.pos++}let l=Ae.rtrim(i),n=new he(t.line,t.column,t.offset,l.length);n==null&&(n=new he(this.startLine,this.startColumn,this.pos)),n.length=this.pos-n.offset;let s=new ke(x.LString(0,l,[]),n);return this.previous=s,s}}scanStringEnd(e,t){let i=e+1,l=!1;for(;i<this.length;){let n=p.cca(this.input,i),s=n??-1;if(s==92){i+=2;continue}if(s==10)return-1;if(s==34&&!l)return i+1;if(t&&s==60&&!l){let r;if(i+1<this.length){let o=p.cca(this.input,i+1);r=o??-1}else r=0;let h=r==47,a=i+(h?2:1);if(a<this.length){let o=p.cca(this.input,a),u=o??-1;(u>=97&&u<=122||u>=65&&u<=90||u==95||u==95||u==36||h&&u==62)&&(l=!0)}}if(s==62&&l&&(l=!1),s==36&&i+1<this.length){let r=p.cca(this.input,i+1),h=r??-1;if(h==123){i+=2;let a=1;for(;i<this.length&&a>0;){let o=p.cca(this.input,i),u=o??-1;if(u==92){i+=2;continue}if(u==10)return-1;let c;if(u==47&&i+1<this.length){let f=p.cca(this.input,i+1);c=(f??-1)==47}else c=!1;if(c)return-1;let _;if(u==47&&i+1<this.length){let f=p.cca(this.input,i+1);_=(f??-1)==42}else _=!1;if(_){for(i+=2;;){if(i>=this.length)return-1;let f=p.cca(this.input,i);if((f??-1)==10)return-1;let m,g;if(i+1<this.length){let w=p.cca(this.input,i);g=(w??-1)==42}else g=!1;if(g){let w=p.cca(this.input,i+1);m=(w??-1)==47}else m=!1;if(m){i+=2;break}++i}continue}if(u==34){if(i=this.scanStringEnd(i,t),i==-1)return-1;continue}u==123?++a:u==125&&--a,++i}if(a!=0)return-1;continue}if(h==36){i+=2;continue}if(h>=97&&h<=122||h>=65&&h<=90||h==95){for(++i;;){let a;if(i<this.length){let o=p.cca(this.input,i),u=o??-1;a=u>=97&&u<=122||u>=65&&u<=90||u==95||u>=48&&u<=57}else a=!1;if(!a)break;++i}if(i=this.scanAccessorChain(i,t),i==-1)return-1;continue}}++i}return-1}scanAccessorChain(e,t){for(;e<this.length;){let i=p.cca(this.input,e),l=i??-1,n;if(l==46&&e+1<this.length){let s=p.cca(this.input,e+1),r=s??-1;n=r>=97&&r<=122||r>=65&&r<=90||r==95}else n=!1;if(n)for(++e;;){let s;if(e<this.length){let r=p.cca(this.input,e),h=r??-1;s=h>=97&&h<=122||h>=65&&h<=90||h==95||h>=48&&h<=57}else s=!1;if(!s)break;++e}else if(l==91||l==40){let s=l==91?93:41;++e;let r=1;for(;e<this.length&&r>0;){let h=p.cca(this.input,e),a=h??-1;if(a==92){e+=2;continue}if(a==10)return-1;let o;if(a==47&&e+1<this.length){let c=p.cca(this.input,e+1);o=(c??-1)==47}else o=!1;if(o)return-1;let u;if(a==47&&e+1<this.length){let c=p.cca(this.input,e+1);u=(c??-1)==42}else u=!1;if(u){for(e+=2;;){if(e>=this.length)return-1;let c=p.cca(this.input,e);if((c??-1)==10)return-1;let _,f;if(e+1<this.length){let m=p.cca(this.input,e);f=(m??-1)==42}else f=!1;if(f){let m=p.cca(this.input,e+1);_=(m??-1)==47}else _=!1;if(_){e+=2;break}++e}continue}if(a==34){if(e=this.scanStringEnd(e,t),e==-1)return-1;continue}a==l?++r:a==s&&--r,++e}if(r!=0)return-1}else break}return e}tryReadUnquotedString(){if(this.isStrict())return null;let e=p.cca(this.input,this.pos),t=e??-1,i;if(this.pos+1<this.length){let A=p.cca(this.input,this.pos+1);i=A??-1}else i=0;if(t==47&&this.pos<this.length-1){let A=p.cca(this.input,this.pos+1),L=A??-1;if(L==47||L==42)return null}if(t==123||t==125||t==91||t==93||t==58||t==35||t==32||t==9)return null;let l=this.parentBlockType();if(l!=x.KwBeat&&l!=x.KwState&&l!=x.KwCharacter)return null;let n=this.isInsideBrackets(),s=this.followsUnquotedAssign(),r=this.afterLabelIdentifierToken(!1);if(r!=-1&&this.tokenized[r].pos.line<this.line&&(this.tokenized[r].pos.column>=this.column||this.line-this.tokenized[r].pos.line>1))return null;let h=r!=-1?this.isStartingMultilineDialogue(r):-1,a=r!=-1,o=l==x.KwState||l==x.KwCharacter||n||s,u=this.matchIdentifier(this.pos);if(o){if(this.isCallStart(this.pos)||this.isLabelStart(this.pos))return null}else if(!a&&u!="true"&&u!="false"&&u!="null"&&(this.isIdentifierExpressionStart(this.pos,!0)||this.isIfStart(this.pos)||this.isCallStart(this.pos)||this.isAssignStart(this.pos,!1)))return null;if(!o&&(t==61||i==61&&(t==43||t==45||t==42||t==47))||!o&&!a&&(this.isInsertionStart(this.pos)||this.isChoiceOnceStart(this.pos))||u!=null&&(u=="function"||!o&&(u!="if"&&u!="null"&&u!="true"&&u!="false"&&u!="and"&&u!="or"&&Object.prototype.hasOwnProperty.call(yt.KEYWORDS.h,u)||this.isColon(this.pos+u.length))))return null;let c=!o,_=!1;if(o){if(n){if(!a&&!this.followsOnlyWhitespacesOrCommentsInLine()&&!this.isAfterComma()&&!this.isAfterLBracket())return null}else if(!s&&!a)return null}else if(_=this.followsOnlyLabelOrCommentsInLine(),!_&&!this.followsOnlyWhitespacesOrCommentsInLine()&&!this.followsChoiceOncePrefix()||!_&&i==62&&t==45)return null;if(t==34){let A=this.scanStringEnd(this.pos,l==x.KwBeat);if(A==-1)return null;let L=!1,z=A;for(;z<this.length;){let D=p.cca(this.input,z),O=D??-1;if(O==32||O==9){++z;continue}if(O==10||O==13)break;let q;if(O==47&&z+1<this.length){let M=p.cca(this.input,z+1);if((M??-1)!=47){let U=p.cca(this.input,z+1);q=(U??-1)==42}else q=!0}else q=!1;if(q||O==93||O==125||O==41||O==44||O==35)break;L=!0;break}if(!L&&!o){let D=!0;D==null&&(D=!1);let O=this._skipWhitespaceAndComments(z,D);if(O<=z||O>=this.length)return null;let q=p.cca(this.input,O),M=q??-1,U;if(M==10||M==13||M==34)U=!0;else if(M==47&&O+1<this.length){let se=p.cca(this.input,O+1);if((se??-1)!=47){let ue=p.cca(this.input,O+1);U=(ue??-1)==42}else U=!0}else U=!1;if(U)return null;let K=0,G=O;for(;;){let se;if(G>0){let ue=p.cca(this.input,G-1);if((ue??-1)!=32){let oe=p.cca(this.input,G-1);se=(oe??-1)==9}else se=!0}else se=!1;if(!se)break;++K,--G}let Y=h!=-1?h:this.column-1;if(K!=Y)return null;let $;if(M==45&&O+1<this.length){let se=p.cca(this.input,O+1);$=(se??-1)==62}else $=!1;if($||M==43||this.isAssignStart(O,!1)||this.isCallStart(O)||this.isLabelStart(O)||this.isIfStart(O)||this.isIdentifierExpressionStart(O,!0))return null;if(M>=97&&M<=122||M>=65&&M<=90||M==95){let se=O;for(;;){let me;if(se<this.length){let de=p.cca(this.input,se),Oe=de??-1;me=Oe>=97&&Oe<=122||Oe>=65&&Oe<=90||Oe==95||Oe>=48&&Oe<=57}else me=!1;if(!me)break;++se}let ue=this.input,oe=se-O,ge=oe!=null?p.substr(ue,O,oe):p.substr(ue,O,null);if(ge!="null"&&ge!="true"&&ge!="false"&&Object.prototype.hasOwnProperty.call(yt.KEYWORDS.h,ge))return null}}else if(!L)return null}let f=new he(this.startLine,this.startColumn,this.pos),m="",g=[],w=this.line,y=this.column,T=this.pos,E=!1,C=-1,P=!1,I=this.column,v=this.line,F=!0,B=!1;for(;this.pos<this.length;){let A=p.cca(this.input,this.pos),L=A??-1,z=L==32||L==9;if(B||!z&&C==-1&&(L!=60||!c)&&(B=!0),E){m+=String.fromCodePoint(92),m+=String.fromCodePoint(L),E=!1;let D=0,O=1;for(;D<O;){let q=D++;if(this.pos>=this.length)break;let M=p.cca(this.input,this.pos);(M??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}I+=2}else if(L==92){E=!0;let D=0,O=1;for(;D<O;){let q=D++;if(this.pos>=this.length)break;let M=p.cca(this.input,this.pos);(M??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else if(C==-1&&z&&!B&&g.length==0){let D=0,O=1;for(;D<O;){let q=D++;if(this.pos>=this.length)break;let M=p.cca(this.input,this.pos);(M??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else{if(C==-1&&L==123)break;{let D;if(C==-1)if(L==10||L==13)D=!0;else if(L==47&&this.pos<this.length-1){let O=p.cca(this.input,this.pos+1);D=(O??-1)==47}else D=!1;else D=!1;if(D)if(h!=-1)if(this.isContinuingMultilineText(this.pos,h)){m+=String.fromCodePoint(L);let O=0,q=1;for(;O<q;){let U=O++;if(this.pos>=this.length)break;let K=p.cca(this.input,this.pos);(K??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let M;if(L==13){let U=p.cca(this.input,this.pos);M=(U??-1)==10}else M=!1;if(M){m+=String.fromCodePoint(10);let U=0,K=1;for(;U<K;){let G=U++;if(this.pos>=this.length)break;let Y=p.cca(this.input,this.pos);(Y??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}I=this.column,v=this.line}else break;else break;else{let O;if(C==-1)if(L==47&&this.pos<this.length-1){let q=p.cca(this.input,this.pos+1);O=(q??-1)==42}else O=!1;else O=!1;if(O){m+=String.fromCodePoint(47),m+=String.fromCodePoint(42);let q=2;q==null&&(q=1);let M=0,U=q;for(;M<U;){let G=M++;if(this.pos>=this.length)break;let Y=p.cca(this.input,this.pos);(Y??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let K=!1;for(;this.pos<this.length;){let G,Y=p.cca(this.input,this.pos);if((Y??-1)==42&&this.pos+1<this.length){let ge=p.cca(this.input,this.pos+1);G=(ge??-1)==47}else G=!1;if(G){m+=String.fromCodePoint(42),m+=String.fromCodePoint(47);let ge=2;ge==null&&(ge=1);let me=0,de=ge;for(;me<de;){let Oe=me++;if(this.pos>=this.length)break;let Ve=p.cca(this.input,this.pos);(Ve??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}K=!0;break}let $=p.cca(this.input,this.pos),se=$??-1;m+=String.fromCodePoint(se);let ue=0,oe=1;for(;ue<oe;){let ge=ue++;if(this.pos>=this.length)break;let me=p.cca(this.input,this.pos);(me??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}I=this.column,v=this.line,K||this.error("Unterminated multiline comment",!1)}else{if(C==-1&&!o&&this.isIfStart(this.pos))break;{let q;if(C==-1&&L==45&&this.pos<this.length-1){let M=p.cca(this.input,this.pos+1);q=(M??-1)==62}else q=!1;if(q&&this.isTransitionStart(this.pos))break;if(C==-1&&o&&(L==44||L==93||L==125))break;if(c&&L==60){C!=-1&&this.error("Unexpected < inside tag",!0);let M;if(this.pos+1<this.length){let Y=p.cca(this.input,this.pos+1);M=Y??-1}else M=0;P=M==47;let U=this.pos+(P?2:1);if(U<this.length){let Y=p.cca(this.input,U),$=Y??-1;($>=97&&$<=122||$>=65&&$<=90||$==95||$==95||$==36||P&&$==62)&&(C=m.length)}m+=String.fromCodePoint(L);let K=0,G=1;for(;K<G;){let Y=K++;if(this.pos>=this.length)break;let $=p.cca(this.input,this.pos);($??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++I}else if(c&&L==62){m+=String.fromCodePoint(L);let M=0,U=1;for(;M<U;){let K=M++;if(this.pos>=this.length)break;let G=p.cca(this.input,this.pos);(G??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++I,C!=-1&&(g.push(Pi.Tag(P,C,m.length-C)),C=-1)}else if(C==-1&&L==35&&!E){let M;if(this.pos+1<this.length){let U=p.cca(this.input,this.pos+1);M=U??-1}else M=0;if(M==35){m+=String.fromCodePoint(35),m+=String.fromCodePoint(35);let U=0,K=1;for(;U<K;){let $=U++;if(this.pos>=this.length)break;let se=p.cca(this.input,this.pos);(se??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let G=0,Y=1;for(;G<Y;){let $=G++;if(this.pos>=this.length)break;let se=p.cca(this.input,this.pos);(se??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}I+=2}else{if(M>=97&&M<=122||M>=65&&M<=90||M==95||M>=48&&M<=57||M==45)break;{m+=String.fromCodePoint(L);let U=0,K=1;for(;U<K;){let G=U++;if(this.pos>=this.length)break;let Y=p.cca(this.input,this.pos);(Y??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++I}}}else if(L==36&&!E){let M=m.length,U=v,K=I,G=this.pos;try{let Y=0,$=1;for(;Y<$;){let ue=Y++;if(this.pos>=this.length)break;let oe=p.cca(this.input,this.pos);(oe??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++I;let se=p.cca(this.input,this.pos);if((se??-1)==123){let ue=0,oe=1;for(;ue<oe;){let Ve=ue++;if(this.pos>=this.length)break;let je=p.cca(this.input,this.pos);(je??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++I;let ge=new he(U,K+2,this.pos),me=this.readComplexInterpolation(ge),de=this.pos-G;g.push(Pi.Interpolation(!0,C!=-1,me,M,de));let Oe=this.input;m+=ne.string(de!=null?p.substr(Oe,G,de):p.substr(Oe,G,null))}else{let ue=p.cca(this.input,this.pos),oe=ue??-1;if(oe>=97&&oe<=122||oe>=65&&oe<=90||oe==95){let ge=new he(U,K+1,this.pos),me=this.readFieldAccessInterpolation(ge),de=this.pos-G;g.push(Pi.Interpolation(!1,C!=-1,me,M,de));let Oe=this.input;m+=ne.string(de!=null?p.substr(Oe,G,de):p.substr(Oe,G,null))}else{let ge=p.cca(this.input,this.pos);if((ge??-1)==36){m+=String.fromCodePoint(36),m+=String.fromCodePoint(36);let me=0,de=1;for(;me<de;){let Oe=me++;if(this.pos>=this.length)break;let Ve=p.cca(this.input,this.pos);(Ve??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++I}else{this.error("Expected identifier or { after $",!1);let me=this.pos-G;g.push(Pi.Interpolation(!1,C!=-1,[],M,me));let de=this.input;m+=ne.string(me!=null?p.substr(de,G,me):p.substr(de,G,null))}}}}catch(Y){let $=b.caught(Y).unwrap();if($ instanceof ll){let se=$;throw se.pos==null&&(se.pos=new he(U,K,this.pos)),b.thrown(se)}else throw Y}I=K+(this.pos-G)}else{L==10?(++v,I=1):++I,m+=String.fromCodePoint(L);let M=0,U=1;for(;M<U;){let K=M++;if(this.pos>=this.length)break;let G=p.cca(this.input,this.pos);(G??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}}}}}}if(F){let A=m,L=A.length;A=Ae.rtrim(A);let z=A.length,D=L-z;if(z>0&&this.hasNonSpecialChar(A)&&(!o||!this.isNumber(A)&&A!="null"&&A!="true"&&A!="false")){if(h==-1&&!a&&!this.inChoiceRoot()){let K=this.line,G=this.column,Y=this.pos,$=!0;$==null&&($=!1);let se=$;se==null&&(se=!1);let ue=this._skipWhitespaceAndComments(this.pos,se);for(;this.pos<ue;){let ge=0,me=1;for(;ge<me;){let de=ge++;if(this.pos>=this.length)break;let Oe=p.cca(this.input,this.pos);(Oe??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let oe=this.pos;if(this.column==y){let ge=this.tryReadUnquotedString();if(ge!=null){let me=this.input,de=Y-D,Oe=oe!=null?me.substring(de,oe):me.substring(de),Ve=ge.type;if(Ve._hx_index==15){let et=Ve.quotes,Ue=Ve.s,Ge=Ve.attachments;if(Ge!=null){let nt=0;for(;nt<Ge.length;){let De=Ge[nt];switch(++nt,De._hx_index){case 0:let H=De.braces,ie=De.inTag,R=De.expr,ee=De.start,X=De.length;g.push(Pi.Interpolation(H,ie,R,ee+oe-T,X));break;case 1:let Q=De.closing,ae=De.start,_e=De.length;g.push(Pi.Tag(Q,ae+oe-T,_e));break}}}A+=Oe,A+=Ue}D=0;let je=this.pos-1;for(;;){let et;if(je>=0){let Ue=p.cca(this.input,je);if((Ue??-1)!=32){let Ge=p.cca(this.input,je);et=(Ge??-1)==9}else et=!0}else et=!1;if(!et)break;++D,--je}}else this.line=K,this.column=G,this.pos=Y}else this.line=K,this.column=G,this.pos=Y}g.sort(function(K,G){return yt.compareAttachments(K,G)});let O=g.length>0?g:null,q=f;q==null&&(q=new he(this.startLine,this.startColumn,this.pos)),q.length=this.pos-q.offset;let M=new ke(x.LString(0,A,O),q);this.previous=M;let U=M;return U.pos.length-=D,U}}return this.line=w,this.column=y,this.pos=T,null}readString(e){let t=0,i=1;for(;t<i;){let c=t++;if(this.pos>=this.length)break;let _=p.cca(this.input,this.pos);(_??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let l="",n=[],s=!1,r=-1,h=!1,a=e.column+1,o=e.line,u=this.parentBlockType()==x.KwBeat;for(;this.pos<this.length;){let c=p.cca(this.input,this.pos),_=c??-1;if(s){l+=String.fromCodePoint(92),l+=String.fromCodePoint(_),s=!1;let f=0,m=1;for(;f<m;){let g=f++;if(this.pos>=this.length)break;let w=p.cca(this.input,this.pos);(w??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}a+=2}else if(_==92){s=!0;let f=0,m=1;for(;f<m;){let g=f++;if(this.pos>=this.length)break;let w=p.cca(this.input,this.pos);(w??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else if(_==34&&r==-1){let f=0,m=1;for(;f<m;){let T=f++;if(this.pos>=this.length)break;let E=p.cca(this.input,this.pos);(E??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}n.sort(function(T,E){return yt.compareAttachments(T,E)});let g=n.length>0?n:null,w=e;w==null&&(w=new he(this.startLine,this.startColumn,this.pos)),w.length=this.pos-w.offset;let y=new ke(x.LString(1,l,g),w);return this.previous=y,y}else if(u&&_==60){r!=-1&&this.error("Unexpected < inside tag",!0);let f;if(this.pos+1<this.length){let y=p.cca(this.input,this.pos+1);f=y??-1}else f=0;h=f==47;let m=this.pos+(h?2:1);if(m<this.length){let y=p.cca(this.input,m),T=y??-1;(T>=97&&T<=122||T>=65&&T<=90||T==95||T==95||T==36||h&&T==62)&&(r=l.length)}l+=String.fromCodePoint(_);let g=0,w=1;for(;g<w;){let y=g++;if(this.pos>=this.length)break;let T=p.cca(this.input,this.pos);(T??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++a}else if(_==62){l+=String.fromCodePoint(_);let f=0,m=1;for(;f<m;){let g=f++;if(this.pos>=this.length)break;let w=p.cca(this.input,this.pos);(w??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++a,r!=-1&&(n.push(Pi.Tag(h,r,l.length-r)),r=-1)}else if(_==36&&!s){let f=l.length,m=o,g=a,w=this.pos;try{let y=0,T=1;for(;y<T;){let C=y++;if(this.pos>=this.length)break;let P=p.cca(this.input,this.pos);(P??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++a;let E=p.cca(this.input,this.pos);if((E??-1)==123){let C=0,P=1;for(;C<P;){let A=C++;if(this.pos>=this.length)break;let L=p.cca(this.input,this.pos);(L??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++a;let I=new he(m,g+2,this.pos),v=this.readComplexInterpolation(I),F=this.pos-w;n.push(Pi.Interpolation(!0,r!=-1,v,f,F));let B=this.input;l+=ne.string(F!=null?p.substr(B,w,F):p.substr(B,w,null))}else{let C=p.cca(this.input,this.pos),P=C??-1;if(P>=97&&P<=122||P>=65&&P<=90||P==95){let I=new he(m,g+1,this.pos),v=this.readFieldAccessInterpolation(I),F=this.pos-w;n.push(Pi.Interpolation(!1,r!=-1,v,f,F));let B=this.input;l+=ne.string(F!=null?p.substr(B,w,F):p.substr(B,w,null))}else{let I=p.cca(this.input,this.pos);if((I??-1)==36){l+=String.fromCodePoint(36),l+=String.fromCodePoint(36);let v=0,F=1;for(;v<F;){let B=v++;if(this.pos>=this.length)break;let A=p.cca(this.input,this.pos);(A??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++a}else{this.error("Expected identifier or { after $",!1);let v=this.pos-w;n.push(Pi.Interpolation(!1,r!=-1,[],f,v));let F=this.input;l+=ne.string(v!=null?p.substr(F,w,v):p.substr(F,w,null))}}}}catch(y){let T=b.caught(y).unwrap();if(T instanceof ll){let E=T;throw E.pos==null&&(E.pos=new he(m,g,this.pos)),b.thrown(E)}else throw y}a=g+(this.pos-w)}else{_==10?(++o,a=1):++a,l+=String.fromCodePoint(_);let f=0,m=1;for(;f<m;){let g=f++;if(this.pos>=this.length)break;let w=p.cca(this.input,this.pos);(w??-1)==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,l=e.column,n=e.line;for(;this.pos<this.length&&i>0;){let s=p.cca(this.input,this.pos);if((s??-1)==34){let h=new he(n,l,this.pos);t.push(this.readString(h)),l+=this.pos-h.offset;continue}let r=this.nextToken();if(t.push(r),r.type==x.LineBreak)++n,l=1;else if(!(r.type==x.Indent||r.type==x.Unindent)){let h,a=r.type;switch(a._hx_index){case 15:let o=a.attachments,u=a.quotes;h=a.s.length+(u!=0?2:0);break;case 16:let _=a.n;h=(_==null?"null":""+_).length;break;case 19:h=a.name.length;break;default:h=1}l+=h}switch(r.type._hx_index){case 45:++i;break;case 46:--i;break;default:}r.type==x.Eof&&this.error("Unterminated interpolation expression",!0)}return t.pop(),this.strictExprs.pop(),t}nextTokenWithPosition(e){let t=this.line,i=this.column,l=this.pos,n=this.nextToken(),s=n.pos.length,r=this.pos-l;return n.pos=new he(e.line,e.column+r,e.offset+r,s),this.line=t,this.column=i,n}readFieldAccessInterpolation(e){this.strictExprs.push(1);let t=[],i=p.cca(this.input,this.pos),l=i??-1;l>=97&&l<=122||l>=65&&l<=90||l==95||this.error("Expected identifier in field access",!0);let n=this.pos;for(;this.pos<this.length;){let o=p.cca(this.input,this.pos),u=o??-1;if(!(u>=97&&u<=122||u>=65&&u<=90||u==95||u>=48&&u<=57))break;let c=0,_=1;for(;c<_;){let f=c++;if(this.pos>=this.length)break;let m=p.cca(this.input,this.pos);(m??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let s=this.input,r=this.pos-n,h=r!=null?p.substr(s,n,r):p.substr(s,n,null),a=Object.prototype.hasOwnProperty.call(yt.KEYWORDS.h,h)?yt.KEYWORDS.h[h]:x.Identifier(h);t.push(new ke(a,new he(e.line,e.column,n,this.pos-n)));e:for(;this.pos<this.length;){let o=p.cca(this.input,this.pos);switch(o??-1){case 40:t.push(new ke(x.LParen,new he(this.line,this.column,this.pos,1)));let u=0,c=1;for(;u<c;){let y=u++;if(this.pos>=this.length)break;let T=p.cca(this.input,this.pos);(T??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.stack.push(10),this.strictExprs.push(1);let _=1;for(;this.pos<this.length&&_>0;){let y=p.cca(this.input,this.pos);if((y??-1)==41){if(--_,_==0){t.push(new ke(x.RParen,new he(this.line,this.column,this.pos,1)));let E=0,C=1;for(;E<C;){let P=E++;if(this.pos>=this.length)break;let I=p.cca(this.input,this.pos);(I??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.stack.pop(),this.strictExprs.pop();break}}else{let E=p.cca(this.input,this.pos);(E??-1)==40&&++_}let T=p.cca(this.input,this.pos);if((T??-1)==44){t.push(new ke(x.Comma,new he(this.line,this.column,this.pos,1)));let E=0,C=1;for(;E<C;){let P=E++;if(this.pos>=this.length)break;let I=p.cca(this.input,this.pos);(I??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else t.push(this.nextToken())}_>0&&this.error("Unterminated function call in interpolation",!0);break;case 46:let f;if(this.pos+1<this.length){let y=p.cca(this.input,this.pos+1),T=y??-1;f=T>=97&&T<=122||T>=65&&T<=90||T==95}else f=!1;if(f){t.push(new ke(x.Dot,new he(this.line,this.column,this.pos,1)));let y=0,T=1;for(;y<T;){let F=y++;if(this.pos>=this.length)break;let B=p.cca(this.input,this.pos);(B??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let E=this.pos;for(;this.pos<this.length;){let F=p.cca(this.input,this.pos),B=F??-1;if(!(B>=97&&B<=122||B>=65&&B<=90||B==95||B>=48&&B<=57))break;let A=0,L=1;for(;A<L;){let z=A++;if(this.pos>=this.length)break;let D=p.cca(this.input,this.pos);(D??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let C=this.input,P=this.pos-E,I=P!=null?p.substr(C,E,P):p.substr(C,E,null),v=Object.prototype.hasOwnProperty.call(yt.KEYWORDS.h,I)?yt.KEYWORDS.h[I]:x.Identifier(I);t.push(new ke(v,new he(this.line,this.column-(this.pos-E),E)))}else break e;break;case 91:t.push(new ke(x.LBracket,new he(this.line,this.column,this.pos,1)));let m=0,g=1;for(;m<g;){let y=m++;if(this.pos>=this.length)break;let T=p.cca(this.input,this.pos);(T??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.stack.push(12),this.strictExprs.push(1);let w=1;for(;this.pos<this.length&&w>0;){let y=p.cca(this.input,this.pos);if((y??-1)==93){if(--w,w==0){t.push(new ke(x.RBracket,new he(this.line,this.column,this.pos,1)));let T=0,E=1;for(;T<E;){let C=T++;if(this.pos>=this.length)break;let P=p.cca(this.input,this.pos);(P??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.stack.pop(),this.strictExprs.pop();break}}else{let T=p.cca(this.input,this.pos);(T??-1)==91&&++w}t.push(this.nextToken())}w>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=p.cca(this.input,this.pos),a=h??-1;if(!(a>=97&&a<=122||a>=65&&a<=90||a==95||a>=48&&a<=57))break;let o=0,u=1;for(;o<u;){let c=o++;if(this.pos>=this.length)break;let _=p.cca(this.input,this.pos);(_??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let l=this.input,n=this.pos-i,s=n!=null?p.substr(l,i,n):p.substr(l,i,null),r=Object.prototype.hasOwnProperty.call(yt.KEYWORDS.h,s)?yt.KEYWORDS.h[s]:x.Identifier(s);return new ke(r,t)}makePositionRelativeTo(e){let t=e.line,i=e.column,l=e.offset;for(;l<this.pos;){let n=p.cca(this.input,l);(n??-1)==10?(++t,i=1):++i,++l}return new he(t,i,this.pos,e.length)}readLineComment(){let e=new he(this.startLine,this.startColumn,this.pos),t=2;t==null&&(t=1);let i=0,l=t;for(;i<l;){let u=i++;if(this.pos>=this.length)break;let c=p.cca(this.input,this.pos);(c??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let n=this.pos;for(;this.pos<this.length;){let u=p.cca(this.input,this.pos),c=u??-1;if(c==10||c==13)break;let _=0,f=1;for(;_<f;){let m=_++;if(this.pos>=this.length)break;let g=p.cca(this.input,this.pos);(g??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let s=this.input,r=this.pos-n,h=r!=null?p.substr(s,n,r):p.substr(s,n,null),a=e;a==null&&(a=new he(this.startLine,this.startColumn,this.pos)),a.length=this.pos-a.offset;let o=new ke(x.CommentLine(h),a);return this.previous=o,o}readMultiLineComment(){let e=new he(this.startLine,this.startColumn,this.pos),t=2;t==null&&(t=1);let i=0,l=t;for(;i<l;){let r=i++;if(this.pos>=this.length)break;let h=p.cca(this.input,this.pos);(h??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let n=this.pos,s=1;for(;this.pos<this.length&&s>0;){let r,h=p.cca(this.input,this.pos);if((h??-1)==42){let a;if(this.pos+1<this.length){let o=p.cca(this.input,this.pos+1);a=o??-1}else a=0;r=a==47}else r=!1;if(r){if(--s,s==0){let c=this.input,_=this.pos-n,f=_!=null?p.substr(c,n,_):p.substr(c,n,null),m=2;m==null&&(m=1);let g=0,w=m;for(;g<w;){let E=g++;if(this.pos>=this.length)break;let C=p.cca(this.input,this.pos);(C??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let y=e;y==null&&(y=new he(this.startLine,this.startColumn,this.pos)),y.length=this.pos-y.offset;let T=new ke(x.CommentMultiLine(f),y);return this.previous=T,T}let a=2;a==null&&(a=1);let o=0,u=a;for(;o<u;){let c=o++;if(this.pos>=this.length)break;let _=p.cca(this.input,this.pos);(_??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else{let a,o=p.cca(this.input,this.pos);if((o??-1)==47){let u;if(this.pos+1<this.length){let c=p.cca(this.input,this.pos+1);u=c??-1}else u=0;a=u==42}else a=!1;if(a){++s;let u=2;u==null&&(u=1);let c=0,_=u;for(;c<_;){let f=c++;if(this.pos>=this.length)break;let m=p.cca(this.input,this.pos);(m??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else{let u=0,c=1;for(;u<c;){let _=u++;if(this.pos>=this.length)break;let f=p.cca(this.input,this.pos);(f??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}}return this.error("Unterminated multi-line comment",!0),null}readHashComment(){let e=new he(this.startLine,this.startColumn,this.pos),t=0,i=1;for(;t<i;){let o=t++;if(this.pos>=this.length)break;let u=p.cca(this.input,this.pos);(u??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let l=this.pos;for(;this.pos<this.length;){let o=p.cca(this.input,this.pos),u=o??-1;if(u>=97&&u<=122||u>=65&&u<=90||u==95||u>=48&&u<=57||u==45){let c=0,_=1;for(;c<_;){let f=c++;if(this.pos>=this.length)break;let m=p.cca(this.input,this.pos);(m??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else break}let n=this.input,s=this.pos-l,r=s!=null?p.substr(n,l,s):p.substr(n,l,null),h=e;h==null&&(h=new he(this.startLine,this.startColumn,this.pos)),h.length=this.pos-h.offset;let a=new ke(x.CommentHash(r),h);return this.previous=a,a}readNumber(){let e=new he(this.startLine,this.startColumn,this.pos),t=this.pos;for(;;){let u;if(this.pos<this.length){let f=p.cca(this.input,this.pos),m=f??-1;u=m>=48&&m<=57}else u=!1;if(!u)break;let c=0,_=1;for(;c<_;){let f=c++;if(this.pos>=this.length)break;let m=p.cca(this.input,this.pos);(m??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let i,l;if(this.pos<this.length){let u=p.cca(this.input,this.pos);l=(u??-1)==46}else l=!1;if(l&&this.pos+1<this.length){let u=p.cca(this.input,this.pos+1),c=u??-1;i=c>=48&&c<=57}else i=!1;if(i){let u=0,c=1;for(;u<c;){let _=u++;if(this.pos>=this.length)break;let f=p.cca(this.input,this.pos);(f??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}for(;;){let _;if(this.pos<this.length){let g=p.cca(this.input,this.pos),w=g??-1;_=w>=48&&w<=57}else _=!1;if(!_)break;let f=0,m=1;for(;f<m;){let g=f++;if(this.pos>=this.length)break;let w=p.cca(this.input,this.pos);(w??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}let n=this.input,s=this.pos-t,r=x.LNumber(parseFloat(s!=null?p.substr(n,t,s):p.substr(n,t,null))),h=e;h==null&&(h=new he(this.startLine,this.startColumn,this.pos)),h.length=this.pos-h.offset;let a=new ke(r,h);return this.previous=a,a}readIdentifier(){let e=new he(this.startLine,this.startColumn,this.pos),t=this.pos;for(;this.pos<this.length;){let a=p.cca(this.input,this.pos),o=a??-1;if(!(o>=97&&o<=122||o>=65&&o<=90||o==95||o>=48&&o<=57))break;let u=0,c=1;for(;u<c;){let _=u++;if(this.pos>=this.length)break;let f=p.cca(this.input,this.pos);(f??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let i=this.input,l=this.pos-t,n=l!=null?p.substr(i,t,l):p.substr(i,t,null);if(n=="function")return this.readFunction(e);let s=Object.prototype.hasOwnProperty.call(yt.KEYWORDS.h,n)?yt.KEYWORDS.h[n]:x.Identifier(n);if(this.previous!=null&&this.previous.type==x.Dot&&s!=null)switch(s._hx_index){case 8:case 9:case 10:case 11:case 12:s=x.Identifier(n);break;default:}let r=e;r==null&&(r=new he(this.startLine,this.startColumn,this.pos)),r.length=this.pos-r.offset;let h=new ke(s,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 O=0,q=1;for(;O<q;){let M=O++;if(this.pos>=this.length)break;let U=p.cca(this.input,this.pos);(U??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let l=e.column,n=null,s=p.cca(this.input,this.pos),r=s??-1;if(r>=97&&r<=122||r>=65&&r<=90||r==95){let O=this.pos;for(;;){let U;if(this.pos<this.length){let Y=p.cca(this.input,this.pos),$=Y??-1;U=$>=97&&$<=122||$>=65&&$<=90||$==95||$>=48&&$<=57}else U=!1;if(!U)break;let K=0,G=1;for(;K<G;){let Y=K++;if(this.pos>=this.length)break;let $=p.cca(this.input,this.pos);($??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let q=this.input,M=this.pos-O;n=M!=null?p.substr(q,O,M):p.substr(q,O,null)}let h=!1;h==null&&(h=!1);let a=this._skipWhitespaceAndComments(this.pos,h);for(;this.pos<a;){let O=0,q=1;for(;O<q;){let M=O++;if(this.pos>=this.length)break;let U=p.cca(this.input,this.pos);(U??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let o;if(this.pos<this.length){let O=p.cca(this.input,this.pos);o=(O??-1)!=40}else o=!0;o&&this.error("Expected opening parenthesis after function name",!0);let u=0,c=[],_=0,f=1;for(;_<f;){let O=_++;if(this.pos>=this.length)break;let q=p.cca(this.input,this.pos);(q??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}u=1;let m=new Xt;for(;this.pos<this.length&&u>0;){let O=p.cca(this.input,this.pos),q=O??-1;if(q==47){let M=this.pos,U=!1;U==null&&(U=!1);let K=this._skipWhitespaceAndComments(this.pos,U);for(;this.pos<K;){let G=0,Y=1;for(;G<Y;){let $=G++;if(this.pos>=this.length)break;let se=p.cca(this.input,this.pos);(se??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}if(this.pos==M){let G=0,Y=1;for(;G<Y;){let $=G++;if(this.pos>=this.length)break;let se=p.cca(this.input,this.pos);(se??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.error('Invalid character "/"',!1)}}else if(q==40){++u,m.b+=String.fromCodePoint(q);let M=0,U=1;for(;M<U;){let Y=M++;if(this.pos>=this.length)break;let $=p.cca(this.input,this.pos);($??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let K=!1;K==null&&(K=!1);let G=this._skipWhitespaceAndComments(this.pos,K);for(;this.pos<G;){let Y=0,$=1;for(;Y<$;){let se=Y++;if(this.pos>=this.length)break;let ue=p.cca(this.input,this.pos);(ue??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}else if(q==41){if(--u,u>0)m.b+=String.fromCodePoint(q);else{let Y=Ae.trim(m.b);Y.length>0&&c.push(Y)}let M=0,U=1;for(;M<U;){let Y=M++;if(this.pos>=this.length)break;let $=p.cca(this.input,this.pos);($??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let K=!1;K==null&&(K=!1);let G=this._skipWhitespaceAndComments(this.pos,K);for(;this.pos<G;){let Y=0,$=1;for(;Y<$;){let se=Y++;if(this.pos>=this.length)break;let ue=p.cca(this.input,this.pos);(ue??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}else if(q==44&&u==1){let M=Ae.trim(m.b);M.length>0&&c.push(M),m=new Xt;let U=0,K=1;for(;U<K;){let $=U++;if(this.pos>=this.length)break;let se=p.cca(this.input,this.pos);(se??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let G=!1;G==null&&(G=!1);let Y=this._skipWhitespaceAndComments(this.pos,G);for(;this.pos<Y;){let $=0,se=1;for(;$<se;){let ue=$++;if(this.pos>=this.length)break;let oe=p.cca(this.input,this.pos);(oe??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}else{m.b+=String.fromCodePoint(q);let M=0,U=1;for(;M<U;){let K=M++;if(this.pos>=this.length)break;let G=p.cca(this.input,this.pos);(G??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}u>0&&this.error("Unclosed parentheses in function declaration",!1);let g=!1;g==null&&(g=!1);let w=this._skipWhitespaceAndComments(this.pos,g);for(;this.pos<w;){let O=0,q=1;for(;O<q;){let M=O++;if(this.pos>=this.length)break;let U=p.cca(this.input,this.pos);(U??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let y;if(this.pos<this.length){let O=p.cca(this.input,this.pos);y=(O??-1)==123}else y=!1;let T=this.pos,E=this.line,C=this.column;if(y){let O=0,q=1;for(;O<q;){let U=O++;if(this.pos>=this.length)break;let K=p.cca(this.input,this.pos);(K??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let M=1;for(;this.pos<this.length&&M>0;){let U=p.cca(this.input,this.pos),K=U??-1;if(K==34){let $=0,se=1;for(;$<se;){let ue=$++;if(this.pos>=this.length)break;let oe=p.cca(this.input,this.pos);(oe??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.skipQuotedString();continue}K==123?++M:K==125&&--M;let G=0,Y=1;for(;G<Y;){let $=G++;if(this.pos>=this.length)break;let se=p.cca(this.input,this.pos);(se??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}M>0&&this.error("Unclosed braces in function body",!1)}else{let O=-1,q=!0;for(;this.pos<this.length;){let M=p.cca(this.input,this.pos),U=M??-1;if(U==10||U==13){T=this.pos,E=this.line,C=this.column;let Y=0,$=1;for(;Y<$;){let se=Y++;if(this.pos>=this.length)break;let ue=p.cca(this.input,this.pos);(ue??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}q=!0;break}let K=0,G=1;for(;K<G;){let Y=K++;if(this.pos>=this.length)break;let $=p.cca(this.input,this.pos);($??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}for(;this.pos<this.length;){if(q){let Y=0,$=this.pos;for(;this.pos<this.length;){let oe=p.cca(this.input,this.pos),ge=oe??-1;if(ge==32)++Y;else if(ge==9)++Y;else break;let me=0,de=1;for(;me<de;){let Oe=me++;if(this.pos>=this.length)break;let Ve=p.cca(this.input,this.pos);(Ve??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let se,ue;if(O==-1&&this.pos<this.length){let oe=p.cca(this.input,this.pos);ue=(oe??-1)!=10}else ue=!1;if(ue){let oe=p.cca(this.input,this.pos);se=(oe??-1)!=13}else se=!1;if(se){if(O=Y,O<l){this.pos=$;break}}else{let oe;if(O!=-1&&Y<O)if(this.pos<this.length){let ge=p.cca(this.input,this.pos);if((ge??-1)!=10){let me=p.cca(this.input,this.pos);oe=(me??-1)!=13}else oe=!1}else oe=!0;else oe=!1;if(oe){this.pos=$;break}}q=!1}let M=p.cca(this.input,this.pos),U=M??-1;if(U==34){this.skipQuotedString();continue}(U==10||U==13)&&(T=this.pos,E=this.line,C=this.column,q=!0);let K=0,G=1;for(;K<G;){let Y=K++;if(this.pos>=this.length)break;let $=p.cca(this.input,this.pos);($??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}this.pos=T,this.line=E,this.column=C;let P=this.pos,I=this.input,v=e.offset,F=P-e.offset,B=Ae.rtrim(F!=null?p.substr(I,v,F):p.substr(I,v,null)),A=B.indexOf(`
37
+ `)}return e}stripStringComments(e){let t="",i=e.length,l=0;for(;l<i;){let n=p.cca(e,l),s=n??-1,r;if(s==47&&l+1<i){let a=p.cca(e,l+1);r=(a??-1)==47}else r=!1;if(r){for(;;){let a;if(l<i){let o=p.cca(e,l);a=(o??-1)!=10}else a=!1;if(!a)break;++l}continue}let h;if(s==47&&l+1<i){let a=p.cca(e,l+1);h=(a??-1)==42}else h=!1;if(h){let a;if(l>0){let u=p.cca(e,l-1);a=(u??-1)==32}else a=!1;for(l+=2;;){let u;if(l+1<i){let c,_=p.cca(e,l);if((_??-1)==42){let f=p.cca(e,l+1);c=(f??-1)==47}else c=!1;u=!c}else u=!1;if(!u)break;++l}l+=2;let o;if(l<i){let u=p.cca(e,l);o=(u??-1)==32}else o=!1;a&&o&&++l,!a&&!o&&l<i&&(t+=String.fromCodePoint(32));continue}t+=String.fromCodePoint(s),++l}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 ut){let n=e.target;if(n.target==null){let s=this.evaluateExpression(e.target);if(s!=null&&We.isFunction(s)){let r=[],h=0,a=e.args;for(;h<a.length;){let u=a[h];++h,r.push(this.evaluateExpression(u))}let o=r;try{let u=s.apply(null,o);if(u!=null&&u instanceof il){if(t==null)throw b.thrown(new fe("Cannot call async function in expression",e.pos));u.func(t)}else t?.();return u}catch(u){let c=b.caught(u).unwrap();if(c instanceof Ce){let _=c;throw b.thrown(new fe("Error when evaluating function ("+_.pmin+"-"+_.pmax+"): "+le.string(_.e),e.pos))}throw b.thrown(new fe("Error when calling function: "+le.string(c),e.pos))}}}else{let s=this.evaluateExpression(n.target),r=null;if(typeof s=="string"?r=ne.getStringHelper(this,n.name):re.isArray(s)?r=ne.getArrayHelper(this,n.name):s instanceof Me?r=ne.getBeatHelper(this,n.name):ne.isFields(s)&&(r=ne.getMapHelper(this,n.name)),r!=null&&We.isFunction(r)){let h=[],a=0,o=e.args;for(;a<o.length;){let _=o[a];++a,h.push(this.evaluateExpression(_))}let u=h;u.splice(0,0,s);let c=r.apply(null,u);if(c!=null&&c instanceof il){if(t==null)throw b.thrown(new fe("Cannot call async function in expression",e.pos));c.func(t)}else t?.();return c}else if(r==null&&!(typeof s=="string"||re.isArray(s)||ne.isFields(s))){let h=We.getProperty(s,n.name);if(We.isFunction(h)){let a=[],o=0,u=e.args;for(;o<u.length;){let f=u[o];++o,a.push(this.evaluateExpression(f))}let c=a,_=h.apply(s,c);if(_!=null&&_ instanceof il){if(t==null)throw b.thrown(new fe("Cannot call async function in expression",e.pos));_.func(t)}else t?.();return _}}}}let i=this.printLoreline(e.target),l;throw i!=null?l=i:l=te.getClass(e.target).__name__,b.thrown(new fe("Invalid call target: "+l,e.pos))}evaluateArrayLiteral(e){let t=[],i=0;for(;i<e.length;){let l=e[i];++i,t.push(this.evaluateExpression(l))}return t}evaluateObjectLiteral(e){let t=new Ee,i=0;for(;i<e.length;){let l=e[i];++i;let n=l.name,s=this.evaluateExpression(l.value);t.h[n]=s}return t}evaluateExpression(e){switch(te.getClass(e)){case ut:let t=e,i=this.resolveAccess(t,t.target,t.name);return this.readAccess(i);case pi:let l=e,n=this.evaluateExpression(l.target),s=this.evaluateExpression(l.index);if(re.isArray(n)&&(typeof s=="number"&&(s|0)===s||typeof s=="number")){let y=s|0;if(y<0||y>=re.arrayLength(n))throw b.thrown(new fe("Array index out of bounds: "+y,l.pos));return re.arrayGet(n,y)}else if(typeof s=="string"){if(n==null)throw b.thrown(new fe("Cannot access field '"+(s==null?"null":le.string(s))+"' of null",l.pos));return ne.getField(this,n,s)}else throw b.thrown(new fe("Invalid array access",l.pos));break;case Qt:let r=e,h=this.evaluateExpression(r.left),a=this.evaluateExpression(r.right);return this.performOperation(r.op,h,a,r.pos);case Rt:return this.evaluateFunctionCall(e,null);case Ke:let o=e,u=o.literalType;switch(u._hx_index){case 0:case 1:case 2:return o.value;case 3:return this.evaluateArrayLiteral(o.value);case 4:let y=u.style;return this.evaluateObjectLiteral(o.value)}break;case Tt:let c=e;if(c.parts.length==1&&c.quotes==0){let y=c.parts[0].partType;if(y._hx_index==1){let T=y.expr;return this.evaluateExpression(T)}else return this.evaluateString(c).text}else return this.evaluateString(c).text;break;case $i:let _=e;return this.evaluateCondition(_.condition)?this.evaluateExpression(_.trueExpr):this.evaluateExpression(_.falseExpr);case Ki:let m=e,g=this.evaluateExpression(m.operand);switch(m.op._hx_index){case 27:if(typeof g=="number"&&(g|0)===g)return-g;if(typeof g=="number")return-g;throw b.thrown(new fe("Invalid unary operation",m.pos));break;case 39:if(typeof g=="boolean")return!g;if(typeof g=="string"){let y=g;return y!=null?y.length==0:!0}else if(g instanceof Array){let y=g;return y!=null?y.length==0:!0}else return typeof g=="number"&&(g|0)===g||typeof g=="number"?g==0:g==null;break;default:throw b.thrown(new fe("Invalid unary operation",m.pos))}break;default:let w=te.getClass(e);throw b.thrown(new fe("Unsupported expression type: "+w.__name__,e.pos))}}readAccess(e){switch(e._hx_index){case 0:let t=e.pos,i=e.obj,l=e.name;if(i==null)throw b.thrown(new fe("Cannot read field '"+l+"' of null",t));return ne.getField(this,i,l);case 1:let n=e.pos,s=e.array,r=e.index;return re.arrayGet(s,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 b.thrown(new fe("Character not found: "+a,h));case 3:let o=e.pos,u=e.name;if(Object.prototype.hasOwnProperty.call(this.topLevelFunctions.h,u))return this.topLevelFunctions.h[u];throw b.thrown(new fe("Function not found: "+u,o));case 4:let c=e.pos;return e.beat}}writeAccess(e,t){switch(e._hx_index){case 0:let i=e.pos,l=e.obj,n=e.name;if(l==null)throw b.thrown(new fe("Cannot set field '"+n+"' of null",i));ne.setField(this,l,n,t);break;case 1:let s=e.pos,r=e.array,h=e.index;re.arraySet(r,h,t);break;case 2:let a=e.pos,o=e.name;throw b.thrown(new fe("Cannot overwrite character: "+o,a));case 3:let u=e.pos,c=e.name;throw b.thrown(new fe("Cannot overwrite function: "+c,u));case 4:let _=e.pos,f=e.beat;throw b.thrown(new fe("Cannot overwrite beat: "+f.name,_))}}resolveAssignmentTarget(e){switch(te.getClass(e)){case ut:let t=e;return this.resolveAccess(t,t.target,t.name);case pi:let i=e,l=this.evaluateExpression(i.target),n=this.evaluateExpression(i.index);if(re.isArray(l)&&(typeof n=="number"&&(n|0)===n||typeof n=="number")){let s=n|0;return oi.ArrayAccess(i.pos,l,s)}else if(typeof n=="string"){if(l==null)throw b.thrown(new fe("Cannot access field '"+(n==null?"null":le.string(n))+"' of null",i.pos));return oi.FieldAccess(i.pos,l,n)}else throw b.thrown(new fe("Invalid array access target",i.pos));break;default:throw b.thrown(new fe("Invalid assignment target",e.pos))}}resolveAccess(e,t,i){if(t!=null){let h=this.evaluateExpression(t);if(h==null){let a=te.getClass(t)==ut?t.name:null;throw b.thrown(new fe(a!=null?"Cannot access field '"+i+"' of undefined variable '"+a+"'":"Cannot access field '"+i+"' of null value",t.pos))}return oi.FieldAccess(t.pos,h,i)}let l=this.stack.length-1;for(;l>=0;){let h=this.stack[l];if(h.state!=null&&ne.fieldExists(this,h.state.fields,i)){let a=e!=null?e.pos:null,o;if(a!=null)o=a;else{let u=this.get_currentScope(),c=u!=null?u.node:null;o=c!=null?c.pos:null}return oi.FieldAccess(o??this.script.pos,h.state.fields,i)}if(h.node!=null){let a=h.node.id.thisVal,o=this.nodeStates.map._get(a.high,a.low);if(o!=null&&ne.fieldExists(this,o.fields,i)){let u=e!=null?e.pos:null,c;if(u!=null)c=u;else{let _=this.get_currentScope(),f=_!=null?_.node:null;c=f!=null?f.pos:null}return oi.FieldAccess(c??this.script.pos,o.fields,i)}}--l}if(ne.fieldExists(this,this.topLevelState.fields,i)){let h=e!=null?e.pos:null,a;if(h!=null)a=h;else{let o=this.get_currentScope(),u=o!=null?o.node:null;a=u!=null?u.pos:null}return oi.FieldAccess(a??this.script.pos,this.topLevelState.fields,i)}if(Object.prototype.hasOwnProperty.call(this.topLevelCharacters.h,i)){let h=e!=null?e.pos:null,a;if(h!=null)a=h;else{let o=this.get_currentScope(),u=o!=null?o.node:null;a=u!=null?u.pos:null}return oi.CharacterAccess(a??this.script.pos,i)}if(Object.prototype.hasOwnProperty.call(this.topLevelFunctions.h,i)){let h=e!=null?e.pos:null,a;if(h!=null)a=h;else{let o=this.get_currentScope(),u=o!=null?o.node:null;a=u!=null?u.pos:null}return oi.FunctionAccess(a??this.script.pos,i)}let n=this.resolveBeatByName(i);if(n!=null){let h=e!=null?e.pos:null,a;if(h!=null)a=h;else{let o=this.get_currentScope(),u=o!=null?o.node:null;a=u!=null?u.pos:null}return oi.BeatAccess(a??this.script.pos,n)}if(!this.strictAccess){let h=e!=null?e.pos:null,a;if(h!=null)a=h;else{let o=this.get_currentScope(),u=o!=null?o.node:null;a=u!=null?u.pos:null}return oi.FieldAccess(a??this.script.pos,this.topLevelState.fields,i)}let s=e!=null?e.pos:null,r;if(s!=null)r=s;else{let h=this.get_currentScope(),a=h!=null?h.node:null;r=a!=null?a.pos:null}throw b.thrown(new fe("Undefined variable: "+i,r??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,l){let n=pe.typeof(t),s=pe.typeof(i);switch(e._hx_index){case 26:switch(n._hx_index){case 1:switch(s._hx_index){case 1:case 2:return parseFloat(le.string(t))+parseFloat(le.string(i));case 6:if(s.c==String)return le.string(t)+le.string(i);{let g="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(s),w=l,y;if(w!=null)y=w;else{let T=this.get_currentScope(),E=T!=null?T.node:null;y=E!=null?E.pos:null}throw b.thrown(new fe(g,y??this.script.pos))}break;default:let _="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(s),f=l,m;if(f!=null)m=f;else{let g=this.get_currentScope(),w=g!=null?g.node:null;m=w!=null?w.pos:null}throw b.thrown(new fe(_,m??this.script.pos))}break;case 2:switch(s._hx_index){case 1:case 2:return parseFloat(le.string(t))+parseFloat(le.string(i));case 6:if(s.c==String)return le.string(t)+le.string(i);{let g="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(s),w=l,y;if(w!=null)y=w;else{let T=this.get_currentScope(),E=T!=null?T.node:null;y=E!=null?E.pos:null}throw b.thrown(new fe(g,y??this.script.pos))}break;default:let _="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(s),f=l,m;if(f!=null)m=f;else{let g=this.get_currentScope(),w=g!=null?g.node:null;m=w!=null?w.pos:null}throw b.thrown(new fe(_,m??this.script.pos))}break;case 6:if(n.c==String)return le.string(t)+le.string(i);if(s._hx_index==6){if(s.c==String)return le.string(t)+le.string(i);{let _="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(s),f=l,m;if(f!=null)m=f;else{let g=this.get_currentScope(),w=g!=null?g.node:null;m=w!=null?w.pos:null}throw b.thrown(new fe(_,m??this.script.pos))}}else{let _="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(s),f=l,m;if(f!=null)m=f;else{let g=this.get_currentScope(),w=g!=null?g.node:null;m=w!=null?w.pos:null}throw b.thrown(new fe(_,m??this.script.pos))}break;default:if(s._hx_index==6){if(s.c==String)return le.string(t)+le.string(i);{let _="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(s),f=l,m;if(f!=null)m=f;else{let g=this.get_currentScope(),w=g!=null?g.node:null;m=w!=null?w.pos:null}throw b.thrown(new fe(_,m??this.script.pos))}}else{let _="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(s),f=l,m;if(f!=null)m=f;else{let g=this.get_currentScope(),w=g!=null?g.node:null;m=w!=null?w.pos:null}throw b.thrown(new fe(_,m??this.script.pos))}}break;case 27:case 28:case 29:case 30:switch(n._hx_index){case 1:case 2:switch(s._hx_index){case 1:case 2:let w=parseFloat(le.string(t)),y=parseFloat(le.string(i));switch(e._hx_index){case 27:return w-y;case 28:return w*y;case 29:if(y==0){let I=l,v;if(I!=null)v=I;else{let F=this.get_currentScope(),B=F!=null?F.node:null;v=B!=null?B.pos:null}throw b.thrown(new fe("Division by zero",v??this.script.pos))}return w/y;case 30:if(y==0){let I=l,v;if(I!=null)v=I;else{let F=this.get_currentScope(),B=F!=null?F.node:null;v=B!=null?B.pos:null}throw b.thrown(new fe("Modulo by zero",v??this.script.pos))}return w%y;default:throw b.thrown("Unreachable")}break;default:let T;switch(e._hx_index){case 27:T="subtract";break;case 28:T="multiply";break;case 29:T="divide";break;case 30:T="modulo";break;default:T="perform operation on"}let E="Cannot "+T+" "+this.getTypeName(n)+" and "+this.getTypeName(s),C=l,P;if(C!=null)P=C;else{let I=this.get_currentScope(),v=I!=null?I.node:null;P=v!=null?v.pos:null}throw b.thrown(new fe(E,P??this.script.pos))}break;default:let _;switch(e._hx_index){case 27:_="subtract";break;case 28:_="multiply";break;case 29:_="divide";break;case 30:_="modulo";break;default:_="perform operation on"}let f="Cannot "+_+" "+this.getTypeName(n)+" and "+this.getTypeName(s),m=l,g;if(m!=null)g=m;else{let w=this.get_currentScope(),y=w!=null?w.node:null;g=y!=null?y.pos:null}throw b.thrown(new fe(f,g??this.script.pos))}break;case 31:case 32:let r=t instanceof Me&&typeof i=="string"?t.name==i:typeof t=="string"&&i instanceof Me?t==i.name:t instanceof Me&&i instanceof Me?t.name==i.name:t==i;switch(e._hx_index){case 31:return r;case 32:return!r;default:throw b.thrown("Unreachable")}break;case 33:case 34:case 35:case 36:switch(n._hx_index){case 1:case 2:switch(s._hx_index){case 1:case 2:let g=parseFloat(le.string(t)),w=parseFloat(le.string(i));switch(e._hx_index){case 33:return g>w;case 34:return g<w;case 35:return g>=w;case 36:return g<=w;default:throw b.thrown("Unreachable")}break;default:let y="Cannot compare "+this.getTypeName(n)+" and "+this.getTypeName(s),T=l,E;if(T!=null)E=T;else{let C=this.get_currentScope(),P=C!=null?C.node:null;E=P!=null?P.pos:null}throw b.thrown(new fe(y,E??this.script.pos))}break;default:let _="Cannot compare "+this.getTypeName(n)+" and "+this.getTypeName(s),f=l,m;if(f!=null)m=f;else{let g=this.get_currentScope(),w=g!=null?g.node:null;m=w!=null?w.pos:null}throw b.thrown(new fe(_,m??this.script.pos))}break;case 37:let h=e.word;if(n._hx_index==3)if(s._hx_index==3)switch(e._hx_index){case 37:let _=e.word;return t?i:!1;case 38:let f=e.word;return t?!0:i;default:throw b.thrown("Unreachable")}else{let _="Cannot perform logical operation on "+this.getTypeName(n)+" and "+this.getTypeName(s),f=l,m;if(f!=null)m=f;else{let g=this.get_currentScope(),w=g!=null?g.node:null;m=w!=null?w.pos:null}throw b.thrown(new fe(_,m??this.script.pos))}else{let _="Cannot perform logical operation on "+this.getTypeName(n)+" and "+this.getTypeName(s),f=l,m;if(f!=null)m=f;else{let g=this.get_currentScope(),w=g!=null?g.node:null;m=w!=null?w.pos:null}throw b.thrown(new fe(_,m??this.script.pos))}break;case 38:let a=e.word;if(n._hx_index==3)if(s._hx_index==3)switch(e._hx_index){case 37:let _=e.word;return t?i:!1;case 38:let f=e.word;return t?!0:i;default:throw b.thrown("Unreachable")}else{let _="Cannot perform logical operation on "+this.getTypeName(n)+" and "+this.getTypeName(s),f=l,m;if(f!=null)m=f;else{let g=this.get_currentScope(),w=g!=null?g.node:null;m=w!=null?w.pos:null}throw b.thrown(new fe(_,m??this.script.pos))}else{let _="Cannot perform logical operation on "+this.getTypeName(n)+" and "+this.getTypeName(s),f=l,m;if(f!=null)m=f;else{let g=this.get_currentScope(),w=g!=null?g.node:null;m=w!=null?w.pos:null}throw b.thrown(new fe(_,m??this.script.pos))}break;default:let o="Invalid operation: "+le.string(e),u=l,c;if(u!=null)c=u;else{let _=this.get_currentScope(),f=_!=null?_.node:null;c=f!=null?f.pos:null}throw b.thrown(new fe(o,c??this.script.pos))}}valueToString(e){return this.valueToStringImpl(e,null)}valueToStringImpl(e,t){if(e==null)return"null";if(typeof e=="string")return e;if(typeof e=="boolean"||typeof e=="number"&&(e|0)===e||typeof e=="number")return e==null?"null":le.string(e);t==null&&(t=[]);let i=0;for(;i<t.length;){let l=t[i];if(++i,l==e)return"..."}if(t.push(e),re.isArray(e)){let l=re.arrayLength(e),n="";n+="[";let s=0,r=l;for(;s<r;){let h=s++;h>0&&(n+=", "),n+=le.string(this.valueToStringImpl(re.arrayGet(e,h),t))}return n+="]",t.pop(),n}if(e instanceof Me)return t.pop(),e.name;if(ne.isFields(e)){let l=ne.getFields(this,e);l.sort(function(h,a){return h<a?-1:h>a?1:0});let n="";n+="{";let s=0,r=l.length;for(;s<r;){let h=s++;h>0&&(n+=", "),n+=le.string(l[h]),n+=": ",n+=le.string(this.valueToStringImpl(ne.getField(this,e,l[h]),t))}return n+="}",t.pop(),n}return t.pop(),e==null?"null":le.string(e)}printLoreline(e){try{let t=new nl;return t.enableComments=!1,Ae.trim(t.print(e))}catch{return null}}}j["loreline.Interpreter"]=Yi.loreline.Interpreter=bl,bl.__name__="loreline.Interpreter",Object.assign(bl.prototype,{__class__:bl,__properties__:{get_currentInsertion:"get_currentInsertion",get_currentScope:"get_currentScope"}});class cn{static stringify(e,t){return t==null&&(t=!1),JSON.stringify(e,null,t?" ":null)}static parse(e){return JSON.parse(e)}}j["loreline.Json"]=cn,cn.__name__="loreline.Json";class N{static scriptFromJson(e){if(e==null)throw b.thrown("Cannot create Script from null JSON");let t=e.type;if(t!="Script")throw b.thrown("Expected Script node, got: "+t);let i=N.idFromJson(e),l=N.positionFromJson(e.pos),n=e.body,s=[],r=0;for(;r<n.length;){let o=n[r];++r,s.push(N.nodeFromJson(o))}let h=s,a=new _i(i,l,h);return a.indentSize=e.indentSize!=null?e.indentSize:2,N.applyComments(a,e),a}static nodeFromJson(e){if(e==null)return null;let t=e.type;switch(t){case"Access":return N.accessFromJson(e);case"Alternative":return N.alternativeFromJson(e);case"ArrayAccess":return N.arrayAccessFromJson(e);case"Assign":return N.assignFromJson(e);case"Beat":return N.beatFromJson(e);case"Binary":return N.binaryFromJson(e);case"Block":return N.blockFromJson(e);case"Call":return N.callFromJson(e);case"Character":return N.characterFromJson(e);case"Choice":return N.choiceStatementFromJson(e);case"Comment":return N.commentFromJson(e);case"Dialogue":return N.dialogueStatementFromJson(e);case"Field":return N.objectFieldFromJson(e);case"Function":return N.functionDeclFromJson(e);case"If":return N.ifStatementFromJson(e);case"Import":return N.importStatementFromJson(e);case"Insertion":return N.insertionFromJson(e);case"Literal":return N.literalFromJson(e);case"Option":return N.choiceOptionFromJson(e);case"Part":return N.stringPartFromJson(e);case"Script":return N.scriptFromJson(e);case"State":return N.stateFromJson(e);case"String":return N.stringLiteralFromJson(e);case"Ternary":return N.ternaryFromJson(e);case"Text":return N.textStatementFromJson(e);case"Transition":return N.transitionFromJson(e);case"Unary":return N.unaryFromJson(e);default:throw b.thrown("Unknown node type: "+t)}}static commentFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=e.isHash!=null&&e.isHash;return new Wi(t,i,e.content,e.multiline,l)}static stateFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=e.fields,n=[],s=0;for(;s<l.length;){let o=l[s];++s,n.push(N.nodeFromJson(o))}let r=n,h=N.extractComments(e),a=new Wt(t,i,e.temporary,r,h.leading,h.trailing);return a.style=N.blockStyleFromString(e.style),a}static objectFieldFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=N.extractComments(e);return new Fi(t,i,e.name,N.nodeFromJson(e.value),l.leading,l.trailing)}static characterFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=N.positionFromJson(e.namePos),n=e.fields,s=[],r=0;for(;r<n.length;){let u=n[r];++r,s.push(N.nodeFromJson(u))}let h=s,a=N.extractComments(e),o=new zt(t,i,e.name,l,h,a.leading,a.trailing);return o.style=N.blockStyleFromString(e.style),o}static beatFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=e.body,n=[],s=0;for(;s<l.length;){let o=l[s];++s,n.push(N.nodeFromJson(o))}let r=n,h=N.extractComments(e),a=new Me(t,i,e.name,r,h.leading,h.trailing);return a.style=N.blockStyleFromString(e.style),a}static stringPartFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=e.part,n;switch(l){case"Expr":n=ze.Expr(N.nodeFromJson(e.expression));break;case"Raw":n=ze.Raw(e.text);break;case"Tag":n=ze.Tag(e.closing,N.nodeFromJson(e.content));break;default:throw b.thrown("Unknown string part type: "+l)}let s=N.extractComments(e);return new Je(t,i,n,s.leading,s.trailing)}static stringLiteralFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=N.quotesFromString(e.quotes),n=e.parts,s=[],r=0;for(;r<n.length;){let o=n[r];++r,s.push(N.nodeFromJson(o))}let h=s,a=N.extractComments(e);return new Tt(t,i,l,h,a.leading,a.trailing)}static textStatementFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=N.nodeFromJson(e.content),n=N.extractComments(e),s=new ci(t,i,l,n.leading,n.trailing);return e.condition!=null&&(s.condition=N.nodeFromJson(e.condition),s.conditionStyle=N.conditionStyleFromString(e.conditionStyle),s.conditionPos=N.positionFromJson(e.conditionPos)),s}static dialogueStatementFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=N.positionFromJson(e.characterPos),n=N.nodeFromJson(e.content),s=N.extractComments(e),r=new ti(t,i,e.character,l,n,s.leading,s.trailing);return e.condition!=null&&(r.condition=N.nodeFromJson(e.condition),r.conditionStyle=N.conditionStyleFromString(e.conditionStyle),r.conditionPos=N.positionFromJson(e.conditionPos)),r}static choiceStatementFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=e.options,n=[],s=0;for(;s<l.length;){let o=l[s];++s,n.push(N.nodeFromJson(o))}let r=n,h=N.extractComments(e),a=new mi(t,i,r,h.leading,h.trailing);return a.style=N.blockStyleFromString(e.style),a}static choiceOptionFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=e.text!=null?N.nodeFromJson(e.text):null,n=e.insertion!=null?N.nodeFromJson(e.insertion):null,s=e.condition!=null?N.nodeFromJson(e.condition):null,r=e.conditionStyle!=null?N.conditionStyleFromString(e.conditionStyle):0,h=e.body,a=[],o=0;for(;o<h.length;){let f=h[o];++o,a.push(N.nodeFromJson(f))}let u=a,c=N.extractComments(e),_=new Et(t,i,l,n,s,r,u,c.leading,c.trailing);return _.style=N.blockStyleFromString(e.style),e.once!=null&&e.once&&(_.once=!0),e.conditionPos!=null&&(_.conditionPos=N.positionFromJson(e.conditionPos)),_}static blockFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=e.body,n=[],s=0;for(;s<l.length;){let o=l[s];++s,n.push(N.nodeFromJson(o))}let r=n,h=N.extractComments(e),a=new ii(t,i,r,h.leading,h.trailing);return a.style=N.blockStyleFromString(e.style),a}static ifStatementFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=N.nodeFromJson(e.condition),n=N.conditionStyleFromString(e.conditionStyle),s=e.thenBranch,r=[],h=0;for(;h<s.length;){let m=s[h];++h,r.push(N.nodeFromJson(m))}let a=r,o=new ii(Re.UNDEFINED,i,a);o.style=N.blockStyleFromString(e.thenStyle);let u=null;if(e.elseBranch!=null){let m=e.elseBranch,g=[],w=0;for(;w<m.length;){let T=m[w];++w,g.push(N.nodeFromJson(T))}let y=g;u=new ii(Re.UNDEFINED,i,y),u.style=N.blockStyleFromString(e.elseStyle)}let c=N.extractComments(e),_=null,f=null;if(e.comments!=null){if(e.comments.elseLeading!=null){let m=e.comments.elseLeading,g=[],w=0;for(;w<m.length;){let y=m[w];++w,g.push(N.commentFromJson(y))}_=g}if(e.comments.elseTrailing!=null){let m=e.comments.elseTrailing,g=[],w=0;for(;w<m.length;){let y=m[w];++w,g.push(N.commentFromJson(y))}f=g}}return new gi(t,i,l,n,o,u,c.leading,c.trailing,_,f)}static alternativeFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=N.alternativeModeFromString(e.mode),n=e.items,s=[],r=0;for(;r<n.length;){let u=n[r];++r,s.push(N.nodeFromJson(u))}let h=s,a=N.extractComments(e),o=new Ui(t,i,l,h,a.leading,a.trailing);if(o.style=N.blockStyleFromString(e.style),e.separatorComments!=null){let u=e.separatorComments,c=[],_=0;for(;_<u.length;){let f=u[_];if(++_,f!=null){let m=f,g=[],w=0;for(;w<m.length;){let y=m[w];++w,g.push(N.commentFromJson(y))}c.push(g)}else c.push(null)}o.separatorComments=c}return o}static callFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=N.nodeFromJson(e.target),n=e.args,s=[],r=0;for(;r<n.length;){let o=n[r];++r,s.push(N.nodeFromJson(o))}let h=s,a=N.extractComments(e);return new Rt(t,i,l,h,a.leading,a.trailing)}static transitionFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=N.positionFromJson(e.targetPos),n=N.extractComments(e);return new Mi(t,i,e.target,l,n.leading,n.trailing)}static insertionFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=N.positionFromJson(e.targetPos),n=N.extractComments(e);return new zi(t,i,e.target,l,n.leading,n.trailing)}static functionDeclFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=e.name,n=e.args,s=[],r=0;for(;r<n.length;){let o=n[r];++r,s.push(o)}let h=s,a=N.extractComments(e);return new Li(t,i,l,h,e.code,e.external,a.leading,a.trailing)}static literalFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=e.literal,n=N.extractComments(e),s,r;switch(l){case"Array":if(s=He.Array,e.value!=null){let a=e.value,o=[],u=0;for(;u<a.length;){let c=a[u];++u,Object.prototype.hasOwnProperty.call(c,"type")?o.push(N.nodeFromJson(c)):o.push(c)}r=o}else r=null;break;case"Boolean":s=He.Boolean,r=e.value;break;case"Null":s=He.Null,r=null;break;case"Number":s=He.Number,r=e.value;break;case"Object":let h=N.blockStyleFromString(e.style);if(s=He.Object(h),e.value!=null){let a=e.value,o=[],u=0;for(;u<a.length;){let c=a[u];++u,o.push(N.nodeFromJson(c))}r=o}else r=[];break;default:throw b.thrown("Unknown literal type: "+l)}return new Ke(t,i,r,s,n.leading,n.trailing)}static accessFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=e.target!=null?N.nodeFromJson(e.target):null,n=N.extractComments(e);return new ut(t,i,l,e.name,n.leading,n.trailing)}static assignFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=N.nodeFromJson(e.target),n=N.tokenTypeFromString(e.op),s=N.nodeFromJson(e.value),r=N.extractComments(e);return new di(t,i,l,n,s,r.leading,r.trailing)}static arrayAccessFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=N.nodeFromJson(e.target),n=N.nodeFromJson(e.index),s=N.extractComments(e);return new pi(t,i,l,n,s.leading,s.trailing)}static binaryFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=N.nodeFromJson(e.left),n=N.tokenTypeFromString(e.op),s=N.nodeFromJson(e.right),r=N.extractComments(e);return new Qt(t,i,l,n,s,r.leading,r.trailing)}static unaryFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=N.tokenTypeFromString(e.op),n=N.nodeFromJson(e.operand),s=N.extractComments(e);return new Ki(t,i,l,n,s.leading,s.trailing)}static ternaryFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=N.nodeFromJson(e.condition),n=N.nodeFromJson(e.trueExpr),s=N.nodeFromJson(e.falseExpr),r=N.extractComments(e);return new $i(t,i,l,n,s,r.leading,r.trailing)}static importStatementFromJson(e){let t=N.idFromJson(e),i=N.positionFromJson(e.pos),l=N.nodeFromJson(e.path),n=e.script!=null?N.scriptFromJson(e.script):null,s=N.extractComments(e);return new Yt(t,i,l,n,s.leading,s.trailing)}static idFromJson(e){let t=e.id;return t!=null?Re.fromString(t):Re.UNDEFINED}static positionFromJson(e){if(e==null)return new he(0,0,0,0);let t=e.length!=null?e.length:0;return new he(e.line,e.column,e.offset,t)}static extractComments(e){if(e.comments==null)return{leading:null,trailing:null};let t=null,i=null;if(e.comments.leading!=null){let l=e.comments.leading,n=[],s=0;for(;s<l.length;){let r=l[s];++s,n.push(N.commentFromJson(r))}t=n}if(e.comments.trailing!=null){let l=e.comments.trailing,n=[],s=0;for(;s<l.length;){let r=l[s];++s,n.push(N.commentFromJson(r))}i=n}return{leading:t,trailing:i}}static applyComments(e,t){let i=N.extractComments(t);e.leadingComments=i.leading,e.trailingComments=i.trailing}static blockStyleFromString(e){return e=="Braces"?1:0}static conditionStyleFromString(e){return e=="Parens"?2:0}static alternativeModeFromString(e){switch(e){case"Cycle":return 1;case"Once":return 2;case"Pick":return 3;case"Shuffle":return 4;default:return 0}}static quotesFromString(e){return e=="DoubleQuotes"?1:0}static tokenTypeFromString(e){switch(e){case"OpAssign":return x.OpAssign;case"OpDivide":return x.OpDivide;case"OpDivideAssign":return x.OpDivideAssign;case"OpEquals":return x.OpEquals;case"OpGreater":return x.OpGreater;case"OpGreaterEq":return x.OpGreaterEq;case"OpLess":return x.OpLess;case"OpLessEq":return x.OpLessEq;case"OpMinus":return x.OpMinus;case"OpMinusAssign":return x.OpMinusAssign;case"OpModulo":return x.OpModulo;case"OpMultiply":return x.OpMultiply;case"OpMultiplyAssign":return x.OpMultiplyAssign;case"OpNot":return x.OpNot;case"OpNotEquals":return x.OpNotEquals;case"OpPlus":return x.OpPlus;case"OpPlusAssign":return x.OpPlusAssign;case"OpUnquotedAssign":return x.OpUnquotedAssign;default:if(e.startsWith("OpAnd"))return x.OpAnd(e.indexOf("true")!=-1);if(e.startsWith("OpOr"))return x.OpOr(e.indexOf("true")!=-1);throw b.thrown("Unknown operator: "+e)}}}j["loreline.JsonToAst"]=N,N.__name__="loreline.JsonToAst";class ui{constructor(e,t){this.target=e,this.origin=t}}j["loreline.Reference"]=ui,ui.__name__="loreline.Reference",Object.assign(ui.prototype,{__class__:ui});class Wl{constructor(e){this.error=null,this.expr=null,this.hscript=null,this.func=e,this.codeToHscript=new Ji;try{this.hscript=this.codeToHscript.process(e.code)}catch(t){let i=b.caught(t).unwrap();i instanceof ai&&(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 tl;t.resumeErrors=!1,t.allowJSON=!0,t.allowTypes=!0;let i=e.name;this.expr=t.parseString(this.hscript,i??"?")}catch(t){let i=b.caught(t).unwrap();if(this.error==null)if(i instanceof Ce){let l=i,n,s=l.e;switch(s._hx_index){case 0:n="Invalid character: "+s.c;break;case 1:n="Unexpected: "+s.s;break;case 2:n="Unterminated string";break;case 3:n="Unterminated comment";break;case 4:n="Invalid preprocessor: "+s.msg;break;case 5:n="Unknown variable: "+s.v;break;case 6:n="Invalid iterator: "+s.v;break;case 7:n="Invalid operator: "+s.op;break;case 8:n="Invalid access: "+s.f;break;case 9:n=s.msg;break}this.error=new Sl(l,n,this.codeToHscript.toLorelinePos(e.pos,l.pmin,l.pmax))}else i instanceof ai&&(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 l=new tl;l.resumeErrors=!0,l.allowJSON=!0,l.allowTypes=!0;let n=e.name;this.expr=l.parseString(this.hscript,n??"?")}catch{}}}}j["loreline.FuncHscript"]=Wl,Wl.__name__="loreline.FuncHscript",Object.assign(Wl.prototype,{__class__:Wl});class zl{constructor(e,t){this.completion=null,this.locals=null,e!=null&&(this.locals=e),t!=null&&(this.completion=t)}}j["loreline.HscriptCompletion"]=zl,zl.__name__="loreline.HscriptCompletion",Object.assign(zl.prototype,{__class__:zl});class Kl{constructor(e){this.hscriptFunctions=new Gi,this.childNodes=new Gi,this.parentNodes=new Gi,this.nodesById=new Gi,this.script=e,this.initialize()}initialize(){let e=this;this.script.each(function(t,i){let l=t.id.thisVal;if(e.nodesById.map._set(l.high,l.low,t),i!=null){let n=t.id.thisVal;e.parentNodes.map._set(n.high,n.low,i);let s=i.id.thisVal,r=e.childNodes.map._get(s.high,s.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,l){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(l,n){let s=l.pos,r=e.offset-s.offset;r>=0&&r<i&&(i=r,t=l)}),t}getNodesOfType(e,t){t==null&&(t=!1);let i=[],l=this;return this.traverse(this.script,function(n,s){return te.__instanceof(n,e)&&i.push(n),t||n==l.script?!0:!(n instanceof Yt||n instanceof _i)}),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&&te.getClass(i)==t)return i;return null}getImportedPaths(e){let t=[];return this._getImportedPaths(e,this.script,t,new Ee),t}_getImportedPaths(e,t,i,l){let n=Nt.directory(e);t==null&&(t=this.script);let s=".lor";e!=null&&e.endsWith(".lor.txt")&&(s=".lor.txt");let r=0,h=t.body;for(;r<h.length;){let a=h[r];if(++r,a instanceof Yt){let o=a,u,c=o.path.parts[0].partType;c._hx_index==0?u=c.text:u="",Nt.isAbsolute(u)||(u=Nt.join([n,u])),u=Nt.normalize(u),u.toLowerCase().endsWith(s)||(u+=s),Object.prototype.hasOwnProperty.call(l.h,u)||(l.h[u]=!0,i.push(u),o.script!=null&&this._getImportedPaths(u,o.script,i,l))}}return i}resolveArrayAccess(e){let t=null;if(e.target instanceof ut?t=this.resolveAccess(e.target):e.target instanceof pi&&(t=this.resolveArrayAccess(e.target)),t==null)return null;switch(te.getClass(t)){case Ke:let i=t;if(i.literalType==He.Array){let n=i.value;if(e.index instanceof Ke){let s=e.index;if(s.literalType==He.Number){let r=s.value|0;if(r>=0&&r<n.length){let h=n[r];if(h instanceof Ft)return h}}}}break;case Fi:let l=t;if(l.value instanceof Ke){let n=l.value;if(n.literalType==He.Array){let s=n.value;if(e.index instanceof Ke){let r=e.index;if(r.literalType==He.Number){let h=r.value|0;if(h>=0&&h<s.length){let a=s[h];if(a instanceof Ft)return a}}}}}break;default:}return null}resolveAccess(e){if(e.target!=null){let h=e.target instanceof ut?this.resolveAccess(e.target):e.target instanceof pi?this.resolveArrayAccess(e.target):null;if(h!=null)switch(h instanceof Fi&&(h=h.value),te.getClass(h)){case zt:let a=h,o=0,u=a.fields;for(;o<u.length;){let f=u[o];if(++o,f.name==e.name)return f}break;case Ke:let c=h,_=c.literalType;if(_._hx_index==4){let f=_.style,m=c.value,g=0;for(;g<m.length;){let w=m[g];if(++g,w.name==e.name)return w}}break;default:}return null}let t=e.name;if(t==null)return null;let i=this.getFirstParentOfType(e,Me);for(;i!=null;){let h=null;if(this.traverse(i,function(a,o){if(h!=null)return!1;if(a instanceof Wt){let u=a,c=0,_=u.fields;for(;c<_.length;){let f=_[c];if(++c,f.name==t)return h=f,!1}}return!0}),h!=null)return h;i=this.getFirstParentOfType(i,Me)}let l=null;if(this.traverse(this.script,function(h,a){if(l!=null)return!1;if(h instanceof Wt){let o=h,u=0,c=o.fields;for(;u<c.length;){let _=c[u];if(++u,_.name==t)return l=_,!1}}return h instanceof Yt?!0:h instanceof _i}),l!=null)return l;let n=this.findCharacterByNameFromNode(t,e);if(n!=null)return n;let s=this.findBeatByNameFromNode(t,e);if(s!=null)return s;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("."),l=this.findBeatByNameFromNode(i[0],t),n=1;for(;l!=null&&n<i.length;){let s=i[n],r=null;this.traverse(l,function(h,a){if(h instanceof Me){let o=h;return o.name==s&&(r=o),!1}else return r==null}),l=r,++n}return l}isTopLevelNode(e){if(e instanceof Le){let t=e;return this.script.body.indexOf(t)!=-1}return!1}findTopLevelBeatFromNode(e){if(this.isTopLevelNode(e))return e instanceof Me?e:null;{let t=this.getFirstParentOfType(e,Me);for(;t!=null&&!this.isTopLevelNode(t);)t=this.getFirstParentOfType(t,Me);if(t!=null&&t instanceof Me)return t}return null}findBeatByNameFromNode(e,t){let i=null,l=this.getFirstParentOfType(t,Me);for(;l!=null;)this.traverse(l,function(n,s){if(i!=null||n==t)return!1;if(n instanceof Me){let r=n;return r.name==e&&(i=r),!1}return!0}),l=this.getFirstParentOfType(l,Me);return i==null&&this.traverse(this.script,function(n,s){if(i==null&&n instanceof Me){let r=n;r.name==e&&(i=r)}return n instanceof Yt?!0:n instanceof _i}),i}findCharacterFromDialogue(e){return this.findCharacterByNameFromNode(e.character,e)}findCharacterByNameFromNode(e,t){let i=null;return this.traverse(this.script,function(l,n){if(i==null&&l instanceof zt){let s=l;s.name==e&&(i=s)}return l instanceof Yt?!0:l instanceof _i}),i}findFunctionByNameFromNode(e,t){let i=null;return this.traverse(this.script,function(l,n){if(i==null&&l instanceof Li){let s=l;s.name==e&&(i=s)}return l instanceof Yt?!0:l instanceof _i}),i}getVisibleCharacters(){let e=[],t=this.script.iterator();for(;t.hasNext();){let i=t.next();i instanceof zt&&e.push(i)}return e}getVisibleFunctions(){let e=[],t=this.script.iterator();for(;t.hasNext();){let i=t.next();i instanceof Li&&e.push(i)}return e}getVisibleStateFields(e){let t=[],i=new wi,l=e;for(;l!=null;){if(te.getClass(l)==Wt){let s=l,r=0,h=s.fields;for(;r<h.length;){let a=h[r];++r;let o=a.id.thisVal;if(!i._exists(o.high,o.low)){let u=a.id.thisVal;i._set(u.high,u.low,!0),t.push(a)}}}let n=l.id.thisVal;l=this.parentNodes.map._get(n.high,n.low)}return this.script.each(function(n,s){if(te.getClass(n)==Wt){let r=n;if(s instanceof _i){let h=0,a=r.fields;for(;h<a.length;){let o=a[h];++h;let u=o.id.thisVal;if(!i._exists(u.high,u.low)){let c=o.id.thisVal;i._set(c.high,c.low,!0),t.push(o)}}}}}),t}getVisibleBeats(e){let t=[],i=Object.create(null),l=this.getParentNode(e);for(;l!=null;){if(te.getClass(l)==Me&&this.getParentNode(l)!=null){let s=0,r=this.getNodesOfType(Me);for(;s<r.length;){let h=r[s];++s,Object.prototype.hasOwnProperty.call(i,h.name)||(i[h.name]=!0,t.push(h))}}l=this.getParentNode(l)}return this.script.each(function(n,s){if(te.getClass(n)==Me&&s instanceof _i){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 Le?h:null;if(o!=null&&o.trailingComments!=null){let u=0,c=o.trailingComments;for(;u<c.length;){let _=c[u];if(++u,_.isHash){let f=Ae.trim(_.content);e[f]=!0}}}});let t=[],i=e,l=i,n=Object.keys(i),s=n.length,r=0;for(;r<s;){let h=n[r++];t.push(h)}return t}countTags(){let e=new Ee;return this.script.each(function(t,i){let l=t instanceof Le?t:null;if(l!=null&&l.trailingComments!=null){let n=0,s=l.trailingComments;for(;n<s.length;){let r=s[n];if(++n,r.isHash){let h=Ae.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 l=t[i];if(++i,l.name==e.name)return l}return null}findOutboundBeats(e){let t=new wi,i=this;this.traverse(e,function(r,h){switch(te.getClass(r)){case Rt:let a=r;if(a.target instanceof ut){let f=a.target;if(f.target==null){let m=i.findBeatFromAccess(f);if(m!=null){let g=m.id,w=new ui(m,a),y=g.thisVal;t._set(y.high,y.low,w)}}}break;case zi:let o=r,u=i.findBeatByNameFromNode(o.target,o);if(u!=null){let f=u.id,m=new ui(u,o),g=f.thisVal;t._set(g.high,g.low,m)}break;case Mi:let c=r,_=i.findBeatByNameFromNode(c.target,c);if(_!=null){let f=_.id,m=new ui(_,c),g=f.thisVal;t._set(g.high,g.low,m)}break;default:}return!0});let l=[],n=t,s=0;for(;s<n._values.length&&n._values[s]==null;)++s;for(;s<n._values.length;){let r=n._values[s];for(++s;s<n._values.length&&n._values[s]==null;)++s;let h=r;l.push(h)}return l}findReferencesToBeat(e){let t=[],i=this;return this.script.each(function(l,n){switch(te.getClass(l)){case Rt:let s=l;if(s.target instanceof ut){let a=s.target;if(a.target==null&&a.name==e.name){let o=i.findBeatFromAccess(a);o!=null&&o.id==e.id&&t.push(new ui(e,s))}}break;case zi:let r=l;r.target==e.name&&t.push(new ui(e,r));break;case Mi:let h=l;h.target==e.name&&t.push(new ui(e,h));break;default:}}),t}findModifiedStateFields(e){let t=Object.create(null),i=this;this.traverse(e,function(u,c){if(te.getClass(u)==di){let _=u;if(_.target instanceof ut){let f=_.target,m=i.findStateField(f);if(m!=null){let g=m.name,w=new ui(m,_);t[g]=w}}}return!0});let l=[],n=t,s=n,r=Object.keys(n),h=r.length,a=0;for(;a<h;){let u=s[r[a++]];l.push(u)}let o=l;return o.sort(function(u,c){let _=u.target.name.toLowerCase(),f=c.target.name.toLowerCase();return _<f?-1:_>f?1:0}),o}findReadStateFields(e){let t=Object.create(null),i=this;this.traverse(e,function(u,c){if(te.getClass(u)==ut){let _=u;if(c instanceof di&&c.target==u)return!0;let f=i.findStateField(_);if(f!=null){let m=f.name,g=new ui(f,_);t[m]=g}}return!0});let l=[],n=t,s=n,r=Object.keys(n),h=r.length,a=0;for(;a<h;){let u=s[r[a++]];l.push(u)}let o=l;return o.sort(function(u,c){let _=u.target.name.toLowerCase(),f=c.target.name.toLowerCase();return _<f?-1:_>f?1:0}),o}findBeatCharacters(e){let t=new wi,i=this;this.traverse(e,function(h,a){switch(te.getClass(h)){case ut:let o=h;if(o.target==null){let _=i.findCharacterByNameFromNode(o.name,o);if(_!=null){let f=_.id,m=new ui(_,o),g=f.thisVal;t._set(g.high,g.low,m)}}break;case ti:let u=h,c=i.findCharacterFromDialogue(u);if(c!=null){let _=c.id,f=new ui(c,u),m=_.thisVal;t._set(m.high,m.low,f)}break;default:}return!0});let l=[],n=t,s=0;for(;s<n._values.length&&n._values[s]==null;)++s;for(;s<n._values.length;){let h=n._values[s];for(++s;s<n._values.length&&n._values[s]==null;)++s;let a=h;l.push(a)}let r=l;return r.sort(function(h,a){let o=h.target.name.toLowerCase(),u=a.target.name.toLowerCase();return o<u?-1:o>u?1:0}),r}findModifiedCharacterFields(e){let t=new wi,i=[],l=this;return this.traverse(e,function(n,s){if(te.getClass(n)==di){let r=n;if(r.target instanceof ut){let h=r.target,a=l.resolveAccess(h);if(a instanceof Fi){let o=a.id.thisVal;if(!t._exists(o.high,o.low)&&l.getParentNode(a)instanceof zt){let c=a.id.thisVal;t._set(c.high,c.low,!0),i.push(new ui(a,n))}}}}return!0}),i}findReadCharacterFields(e){let t=new wi,i=[],l=this;return this.traverse(e,function(n,s){if(te.getClass(n)==ut){let r=n,h=l.getParentNode(r);if(h instanceof di&&h.target==r)return!0;let a=l.resolveAccess(r);if(a instanceof Fi){let o=a.id.thisVal;if(!t._exists(o.high,o.low)&&l.getParentNode(a)instanceof zt){let c=a.id.thisVal;t._set(c.high,c.low,!0),i.push(new ui(a,n))}}}return!0}),i}traverse(e,t){let i=e.id.thisVal,l=this.childNodes.map._get(i.high,i.low);if(l!=null){let n=0,s=l.length;for(;n<s;){let r=n++,h=l[r];t(h,e)&&this.traverse(h,t)}}}getFuncHscript(e){let t=e.id,i=t.thisVal,l=this.hscriptFunctions.map._get(i.high,i.low);if(l==null){l=new Wl(e);let n=t.thisVal;this.hscriptFunctions.map._set(n.high,n.low,l)}return l}getHscriptExpr(e,t){let i=this.getFuncHscript(e);if(i.expr==null)return null;let l=t.offset-e.pos.offset,n=null,s=null;return s=function(r){if(r!=null){let h=i.codeToHscript.inputPosFromProcessedPos(r.pmin),a=i.codeToHscript.inputPosFromProcessedPos(r.pmax);l>=h&&l<=a&&(n=r),en.iter(r,s)}},en.iter(i.expr,s),n}resolveHscriptAccess(e,t){let i=t.e;switch(i._hx_index){case 1:let l=i.v,n=null;if(this.traverse(this.script,function(_,f){if(n!=null)return!1;if(_ instanceof Wt){let m=_,g=0,w=m.fields;for(;g<w.length;){let y=w[g];if(++g,y.name==l)return n=y,!1}}return _ instanceof Yt?!0:_ instanceof _i}),n!=null)return n;let s=this.findCharacterByNameFromNode(l,e);if(s!=null)return s;let r=this.findBeatByNameFromNode(l,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),te.getClass(o)){case zt:let _=o,f=0,m=_.fields;for(;f<m.length;){let y=m[f];if(++f,y.name==a)return y}break;case Ke:let g=o,w=g.literalType;if(w._hx_index==4){let y=w.style,T=g.value,E=0;for(;E<T.length;){let C=T[E];if(++E,C.name==a)return C}}break;default:}break;case 16:let u=i.e,c=i.index;break;default:}return null}isHscriptExpr(e){return e!=null&&Object.prototype.hasOwnProperty.call(e,"e")?te.__instanceof(We.field(e,"e"),V):!1}getHscriptCompletion(e,t){let i=this.getFuncHscript(e),l=t.offset-e.pos.offset+t.length,n=i.codeToHscript.processedPosFromInputPos(l),s=i.hscript,r=Math.min(n,i.hscript.length)|0,h=r!=null?s.substring(0,r):s.substring(0),a=h.length,o=h.indexOf("{",null)+1;h=a!=null?h.substring(o,a):h.substring(o);let u=h.length,c="",_=0,f=a-u;for(;_<f;){let y=_++;c+=String.fromCodePoint(32)}h=c+h;let m=null,g=new Ze;try{g.types.parser.allowJSON=!0,g.types.parser.allowTypes=!0,g.types.parser.resumeErrors=!0;let y=g.types.parser.parseString(h);g.check(y,null,!0)}catch(y){let T=b.caught(y).unwrap();T instanceof xl&&(m=T)}let w=g.locals;return new zl(w,m)}resolveAccessInFunction(e,t){if(this.getFuncHscript(e).expr==null)return null;let l=this.getHscriptExpr(e,t);return l!=null?this.resolveHscriptAccess(e,l):null}}j["loreline.Lens"]=Kl,Kl.__name__="loreline.Lens",Object.assign(Kl.prototype,{__class__:Kl});class ll extends ai{constructor(e,t){super(e,t)}}j["loreline.LexerError"]=ll,ll.__name__="loreline.LexerError",ll.__super__=ai,Object.assign(ll.prototype,{__class__:ll});var Pi=Qe["loreline.LStringAttachment"]={__ename__:"loreline.LStringAttachment",__constructs__:null,Interpolation:(d=function(k,e,t,i,l){return{_hx_index:0,braces:k,inTag:e,expr:t,start:i,length:l,__enum__:"loreline.LStringAttachment",toString:S}},d._hx_name="Interpolation",d.__params__=["braces","inTag","expr","start","length"],d),Tag:(d=function(k,e,t){return{_hx_index:1,closing:k,start:e,length:t,__enum__:"loreline.LStringAttachment",toString:S}},d._hx_name="Tag",d.__params__=["closing","start","length"],d)};Pi.__constructs__=[Pi.Interpolation,Pi.Tag];class Ni{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 x=Qe["loreline.TokenType"]={__ename__:"loreline.TokenType",__constructs__:null,KwImport:{_hx_name:"KwImport",_hx_index:0,__enum__:"loreline.TokenType",toString:S},KwState:{_hx_name:"KwState",_hx_index:1,__enum__:"loreline.TokenType",toString:S},KwBeat:{_hx_name:"KwBeat",_hx_index:2,__enum__:"loreline.TokenType",toString:S},KwCharacter:{_hx_name:"KwCharacter",_hx_index:3,__enum__:"loreline.TokenType",toString:S},KwChoice:{_hx_name:"KwChoice",_hx_index:4,__enum__:"loreline.TokenType",toString:S},KwIf:{_hx_name:"KwIf",_hx_index:5,__enum__:"loreline.TokenType",toString:S},KwElse:{_hx_name:"KwElse",_hx_index:6,__enum__:"loreline.TokenType",toString:S},KwNew:{_hx_name:"KwNew",_hx_index:7,__enum__:"loreline.TokenType",toString:S},KwSequence:{_hx_name:"KwSequence",_hx_index:8,__enum__:"loreline.TokenType",toString:S},KwCycle:{_hx_name:"KwCycle",_hx_index:9,__enum__:"loreline.TokenType",toString:S},KwOnce:{_hx_name:"KwOnce",_hx_index:10,__enum__:"loreline.TokenType",toString:S},KwPick:{_hx_name:"KwPick",_hx_index:11,__enum__:"loreline.TokenType",toString:S},KwShuffle:{_hx_name:"KwShuffle",_hx_index:12,__enum__:"loreline.TokenType",toString:S},Separator:{_hx_name:"Separator",_hx_index:13,__enum__:"loreline.TokenType",toString:S},Function:(d=function(k,e,t,i){return{_hx_index:14,name:k,args:e,code:t,external:i,__enum__:"loreline.TokenType",toString:S}},d._hx_name="Function",d.__params__=["name","args","code","external"],d),LString:(d=function(k,e,t){return{_hx_index:15,quotes:k,s:e,attachments:t,__enum__:"loreline.TokenType",toString:S}},d._hx_name="LString",d.__params__=["quotes","s","attachments"],d),LNumber:(d=function(k){return{_hx_index:16,n:k,__enum__:"loreline.TokenType",toString:S}},d._hx_name="LNumber",d.__params__=["n"],d),LBoolean:(d=function(k){return{_hx_index:17,b:k,__enum__:"loreline.TokenType",toString:S}},d._hx_name="LBoolean",d.__params__=["b"],d),LNull:{_hx_name:"LNull",_hx_index:18,__enum__:"loreline.TokenType",toString:S},Identifier:(d=function(k){return{_hx_index:19,name:k,__enum__:"loreline.TokenType",toString:S}},d._hx_name="Identifier",d.__params__=["name"],d),OpAssign:{_hx_name:"OpAssign",_hx_index:20,__enum__:"loreline.TokenType",toString:S},OpPlusAssign:{_hx_name:"OpPlusAssign",_hx_index:21,__enum__:"loreline.TokenType",toString:S},OpMinusAssign:{_hx_name:"OpMinusAssign",_hx_index:22,__enum__:"loreline.TokenType",toString:S},OpMultiplyAssign:{_hx_name:"OpMultiplyAssign",_hx_index:23,__enum__:"loreline.TokenType",toString:S},OpDivideAssign:{_hx_name:"OpDivideAssign",_hx_index:24,__enum__:"loreline.TokenType",toString:S},OpUnquotedAssign:{_hx_name:"OpUnquotedAssign",_hx_index:25,__enum__:"loreline.TokenType",toString:S},OpPlus:{_hx_name:"OpPlus",_hx_index:26,__enum__:"loreline.TokenType",toString:S},OpMinus:{_hx_name:"OpMinus",_hx_index:27,__enum__:"loreline.TokenType",toString:S},OpMultiply:{_hx_name:"OpMultiply",_hx_index:28,__enum__:"loreline.TokenType",toString:S},OpDivide:{_hx_name:"OpDivide",_hx_index:29,__enum__:"loreline.TokenType",toString:S},OpModulo:{_hx_name:"OpModulo",_hx_index:30,__enum__:"loreline.TokenType",toString:S},OpEquals:{_hx_name:"OpEquals",_hx_index:31,__enum__:"loreline.TokenType",toString:S},OpNotEquals:{_hx_name:"OpNotEquals",_hx_index:32,__enum__:"loreline.TokenType",toString:S},OpGreater:{_hx_name:"OpGreater",_hx_index:33,__enum__:"loreline.TokenType",toString:S},OpLess:{_hx_name:"OpLess",_hx_index:34,__enum__:"loreline.TokenType",toString:S},OpGreaterEq:{_hx_name:"OpGreaterEq",_hx_index:35,__enum__:"loreline.TokenType",toString:S},OpLessEq:{_hx_name:"OpLessEq",_hx_index:36,__enum__:"loreline.TokenType",toString:S},OpAnd:(d=function(k){return{_hx_index:37,word:k,__enum__:"loreline.TokenType",toString:S}},d._hx_name="OpAnd",d.__params__=["word"],d),OpOr:(d=function(k){return{_hx_index:38,word:k,__enum__:"loreline.TokenType",toString:S}},d._hx_name="OpOr",d.__params__=["word"],d),OpNot:{_hx_name:"OpNot",_hx_index:39,__enum__:"loreline.TokenType",toString:S},Arrow:{_hx_name:"Arrow",_hx_index:40,__enum__:"loreline.TokenType",toString:S},Colon:{_hx_name:"Colon",_hx_index:41,__enum__:"loreline.TokenType",toString:S},Question:{_hx_name:"Question",_hx_index:42,__enum__:"loreline.TokenType",toString:S},Comma:{_hx_name:"Comma",_hx_index:43,__enum__:"loreline.TokenType",toString:S},Dot:{_hx_name:"Dot",_hx_index:44,__enum__:"loreline.TokenType",toString:S},LBrace:{_hx_name:"LBrace",_hx_index:45,__enum__:"loreline.TokenType",toString:S},RBrace:{_hx_name:"RBrace",_hx_index:46,__enum__:"loreline.TokenType",toString:S},LParen:{_hx_name:"LParen",_hx_index:47,__enum__:"loreline.TokenType",toString:S},RParen:{_hx_name:"RParen",_hx_index:48,__enum__:"loreline.TokenType",toString:S},LBracket:{_hx_name:"LBracket",_hx_index:49,__enum__:"loreline.TokenType",toString:S},RBracket:{_hx_name:"RBracket",_hx_index:50,__enum__:"loreline.TokenType",toString:S},CommentLine:(d=function(k){return{_hx_index:51,content:k,__enum__:"loreline.TokenType",toString:S}},d._hx_name="CommentLine",d.__params__=["content"],d),CommentMultiLine:(d=function(k){return{_hx_index:52,content:k,__enum__:"loreline.TokenType",toString:S}},d._hx_name="CommentMultiLine",d.__params__=["content"],d),CommentHash:(d=function(k){return{_hx_index:53,content:k,__enum__:"loreline.TokenType",toString:S}},d._hx_name="CommentHash",d.__params__=["content"],d),Indent:{_hx_name:"Indent",_hx_index:54,__enum__:"loreline.TokenType",toString:S},Unindent:{_hx_name:"Unindent",_hx_index:55,__enum__:"loreline.TokenType",toString:S},LineBreak:{_hx_name:"LineBreak",_hx_index:56,__enum__:"loreline.TokenType",toString:S},Eof:{_hx_name:"Eof",_hx_index:57,__enum__:"loreline.TokenType",toString:S}};x.__constructs__=[x.KwImport,x.KwState,x.KwBeat,x.KwCharacter,x.KwChoice,x.KwIf,x.KwElse,x.KwNew,x.KwSequence,x.KwCycle,x.KwOnce,x.KwPick,x.KwShuffle,x.Separator,x.Function,x.LString,x.LNumber,x.LBoolean,x.LNull,x.Identifier,x.OpAssign,x.OpPlusAssign,x.OpMinusAssign,x.OpMultiplyAssign,x.OpDivideAssign,x.OpUnquotedAssign,x.OpPlus,x.OpMinus,x.OpMultiply,x.OpDivide,x.OpModulo,x.OpEquals,x.OpNotEquals,x.OpGreater,x.OpLess,x.OpGreaterEq,x.OpLessEq,x.OpAnd,x.OpOr,x.OpNot,x.Arrow,x.Colon,x.Question,x.Comma,x.Dot,x.LBrace,x.RBrace,x.LParen,x.RParen,x.LBracket,x.RBracket,x.CommentLine,x.CommentMultiLine,x.CommentHash,x.Indent,x.Unindent,x.LineBreak,x.Eof];class Ot{static equals(e,t){switch(e._hx_index){case 1:return t._hx_index==1?!0:pe.enumEq(e,t);case 2:return t._hx_index==2?!0:pe.enumEq(e,t);case 3:return t._hx_index==3?!0:pe.enumEq(e,t);case 4:return t._hx_index==4?!0:pe.enumEq(e,t);case 5:return t._hx_index==5?!0:pe.enumEq(e,t);case 6:return t._hx_index==6?!0:pe.enumEq(e,t);case 7:return t._hx_index==7?!0:pe.enumEq(e,t);case 8:return t._hx_index==8?!0:pe.enumEq(e,t);case 9:return t._hx_index==9?!0:pe.enumEq(e,t);case 10:return t._hx_index==10?!0:pe.enumEq(e,t);case 11:return t._hx_index==11?!0:pe.enumEq(e,t);case 12:return t._hx_index==12?!0:pe.enumEq(e,t);case 13:return t._hx_index==13?!0:pe.enumEq(e,t);case 15:let i=e.s,l=e.attachments;if(t._hx_index==15){let r=t.s,h=t.attachments,a=t.quotes;return e.quotes==a}else return pe.enumEq(e,t);break;case 16:if(t._hx_index==16){let r=t.n;return e.n==r}else return pe.enumEq(e,t);break;case 17:if(t._hx_index==17){let r=t.b;return e.b==r}else return pe.enumEq(e,t);break;case 18:return t._hx_index==18?!0:pe.enumEq(e,t);case 19:if(t._hx_index==19){let r=t.name;return e.name==r}else return pe.enumEq(e,t);break;case 20:return t._hx_index==20?!0:pe.enumEq(e,t);case 21:return t._hx_index==21?!0:pe.enumEq(e,t);case 22:return t._hx_index==22?!0:pe.enumEq(e,t);case 23:return t._hx_index==23?!0:pe.enumEq(e,t);case 24:return t._hx_index==24?!0:pe.enumEq(e,t);case 25:return t._hx_index==25?!0:pe.enumEq(e,t);case 26:return t._hx_index==26?!0:pe.enumEq(e,t);case 27:return t._hx_index==27?!0:pe.enumEq(e,t);case 28:return t._hx_index==28?!0:pe.enumEq(e,t);case 29:return t._hx_index==29?!0:pe.enumEq(e,t);case 30:return t._hx_index==30?!0:pe.enumEq(e,t);case 31:return t._hx_index==31?!0:pe.enumEq(e,t);case 32:return t._hx_index==32?!0:pe.enumEq(e,t);case 33:return t._hx_index==33?!0:pe.enumEq(e,t);case 34:return t._hx_index==34?!0:pe.enumEq(e,t);case 35:return t._hx_index==35?!0:pe.enumEq(e,t);case 36:return t._hx_index==36?!0:pe.enumEq(e,t);case 37:let n=e.word;if(t._hx_index==37){let r=t.word;return!0}else return pe.enumEq(e,t);break;case 38:let s=e.word;if(t._hx_index==38){let r=t.word;return!0}else return pe.enumEq(e,t);break;case 39:return t._hx_index==39?!0:pe.enumEq(e,t);case 40:return t._hx_index==40?!0:pe.enumEq(e,t);case 41:return t._hx_index==41?!0:pe.enumEq(e,t);case 42:return t._hx_index==42?!0:pe.enumEq(e,t);case 44:return t._hx_index==44?!0:pe.enumEq(e,t);case 45:return t._hx_index==45?!0:pe.enumEq(e,t);case 46:return t._hx_index==46?!0:pe.enumEq(e,t);case 47:return t._hx_index==47?!0:pe.enumEq(e,t);case 48:return t._hx_index==48?!0:pe.enumEq(e,t);case 49:return t._hx_index==49?!0:pe.enumEq(e,t);case 50:return t._hx_index==50?!0:pe.enumEq(e,t);case 51:if(t._hx_index==51){let r=t.content;return e.content==r}else return pe.enumEq(e,t);break;case 52:if(t._hx_index==52){let r=t.content;return e.content==r}else return pe.enumEq(e,t);break;case 53:if(t._hx_index==53){let r=t.content;return e.content==r}else return pe.enumEq(e,t);break;case 54:return t._hx_index==54?!0:pe.enumEq(e,t);case 55:return t._hx_index==55?!0:pe.enumEq(e,t);case 56:return t._hx_index==56?!0:pe.enumEq(e,t);case 57:return t._hx_index==57?!0:pe.enumEq(e,t);default:return pe.enumEq(e,t)}}static isComment(e){switch(e._hx_index){case 51:let t=e.content;return!0;case 52:let i=e.content;return!0;case 53:let l=e.content;return!0;default:return!1}}static isAssignOp(e){switch(e._hx_index){case 20:case 21:case 22:case 23:case 24:case 25: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,l=e.code,n=e.external;return"function";case 15:let s=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 u=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"<=";case 37:return e.word?"and":"&&";case 38:return e.word?"or":"||";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:return"[";case 50:return"]";case 51:let f=e.content;return"comment";case 52:let m=e.content;return"multiline comment";case 53:let g=e.content;return"hash comment";case 54:return"indent";case 55:return"unindent";case 56:return"line break";case 57:return"end of file"}}}j["loreline.TokenTypeHelpers"]=Ot,Ot.__name__="loreline.TokenTypeHelpers";class ke{constructor(e,t){this.type=e,this.pos=t}toString(){return""+le.string(this.type)+" at "+this.pos.toString()}}j["loreline.Token"]=ke,ke.__name__="loreline.Token",Object.assign(ke.prototype,{__class__:ke});class yt{constructor(e){this.keepOrphanExpressions=!1,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==x.Eof){if(this.indentStack.length>1){let i=this.indentStack.length-1,l=0,n=i;for(;l<n;){let s=l++,r=null;r==null&&(r=new he(this.startLine,this.startColumn,this.pos)),r.length=this.pos-r.offset;let h=new ke(x.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 45: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 49:this.stack.push(12),this.nextBlock=10;break;case 46:case 50:case 55:this.stack.pop(),this.nextBlock=10;break;case 54:let l;switch(this.nextBlock){case 0:case 1:l=1;break;case 2:case 3:l=3;break;case 4:case 5:l=5;break;case 6:case 7:l=7;break;case 8:case 9:l=9;break;case 10:case 11:case 12:l=11;break}this.stack.push(l),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 l=null;l==null&&(l=new he(this.startLine,this.startColumn,this.pos)),l.length=this.pos-l.offset;let n=new ke(x.Eof,l);return this.previous=n,n}this.startLine=this.line,this.startColumn=this.column;let e=p.cca(this.input,this.pos),t=e??-1;if(t==10||t==13){let l=this.readLineBreak(),n=this.countIndentation();if(n>this.indentStack[this.indentStack.length-1]){this.indentStack.length==1&&(this.detectedIndentSize=n-this.indentStack[0]),this.indentStack.push(n);let s=this.indentTokens,r=null;r==null&&(r=new he(this.startLine,this.startColumn,this.pos)),r.length=this.pos-r.offset;let h=new ke(x.Indent,r);this.previous=h,s.push(h)}else if(n<this.indentStack[this.indentStack.length-1])for(;this.indentStack.length>0&&n<this.indentStack[this.indentStack.length-1];){this.indentStack.pop();let s=this.indentTokens,r=null;r==null&&(r=new he(this.startLine,this.startColumn,this.pos)),r.length=this.pos-r.offset;let h=new ke(x.Unindent,r);this.previous=h,s.push(h)}return l}let i=new he(this.startLine,this.startColumn,this.pos);if(this.tokenized.length>0&&this.tokenized[this.tokenized.length-1].type==x.KwImport)return this.readImportValue(t,i);switch(t){case 34:let l=this.tryReadUnquotedString();return l??this.readString(i);case 91:let n=0,s=1;for(;n<s;){let y=n++;if(this.pos>=this.length)break;let T=p.cca(this.input,this.pos);(T??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.makeLooseOrStrictAfterBracket();let r=i;r==null&&(r=new he(this.startLine,this.startColumn,this.pos)),r.length=this.pos-r.offset;let h=new ke(x.LBracket,r);return this.previous=h,h;case 123:let a=0,o=1;for(;a<o;){let y=a++;if(this.pos>=this.length)break;let T=p.cca(this.input,this.pos);(T??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let u=i;u==null&&(u=new he(this.startLine,this.startColumn,this.pos)),u.length=this.pos-u.offset;let c=new ke(x.LBrace,u);return this.previous=c,c;case 125:let _=0,f=1;for(;_<f;){let y=_++;if(this.pos>=this.length)break;let T=p.cca(this.input,this.pos);(T??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let m=i;m==null&&(m=new he(this.startLine,this.startColumn,this.pos)),m.length=this.pos-m.offset;let g=new ke(x.RBrace,m);return this.previous=g,g;default:let w=this.tryReadUnquotedString();if(w!=null)return w;switch(t){case 33:let y=t;if(y>=48&&y<=57)return this.readNumber();{let H=t;if(H>=97&&H<=122||H>=65&&H<=90||H==95)return this.readIdentifier();{let ie;if(this.pos+1<this.length){let R=p.cca(this.input,this.pos+1);ie=R??-1}else ie=0;if(ie==61){let R=2;R==null&&(R=1);let ee=0,X=R;for(;ee<X;){let _e=ee++;if(this.pos>=this.length)break;let xe=p.cca(this.input,this.pos);(xe??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let Q=i;Q==null&&(Q=new he(this.startLine,this.startColumn,this.pos)),Q.length=this.pos-Q.offset;let ae=new ke(x.OpNotEquals,Q);return this.previous=ae,ae}else{let R=0,ee=1;for(;R<ee;){let ae=R++;if(this.pos>=this.length)break;let _e=p.cca(this.input,this.pos);(_e??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let X=i;X==null&&(X=new he(this.startLine,this.startColumn,this.pos)),X.length=this.pos-X.offset;let Q=new ke(x.OpNot,X);return this.previous=Q,Q}}}break;case 35:let T=t;if(T>=48&&T<=57)return this.readNumber();{let H=t;if(H>=97&&H<=122||H>=65&&H<=90||H==95)return this.readIdentifier();{let ie;if(this.pos+1<this.length){let R=p.cca(this.input,this.pos+1);ie=R??-1}else ie=0;return ie>=97&&ie<=122||ie>=65&&ie<=90||ie==95||ie>=48&&ie<=57||ie==45?this.readHashComment():(this.error("Unexpected character: #",!0),null)}}break;case 37:let E=t;if(E>=48&&E<=57)return this.readNumber();{let H=t;if(H>=97&&H<=122||H>=65&&H<=90||H==95)return this.readIdentifier();{let ie=0,R=1;for(;ie<R;){let Q=ie++;if(this.pos>=this.length)break;let ae=p.cca(this.input,this.pos);(ae??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ee=i;ee==null&&(ee=new he(this.startLine,this.startColumn,this.pos)),ee.length=this.pos-ee.offset;let X=new ke(x.OpModulo,ee);return this.previous=X,X}}break;case 38:let C=t;if(C>=48&&C<=57)return this.readNumber();{let H=t;if(H>=97&&H<=122||H>=65&&H<=90||H==95)return this.readIdentifier();{let ie;if(this.pos+1<this.length){let R=p.cca(this.input,this.pos+1);ie=R??-1}else ie=0;if(ie==38){let R=2;R==null&&(R=1);let ee=0,X=R;for(;ee<X;){let _e=ee++;if(this.pos>=this.length)break;let xe=p.cca(this.input,this.pos);(xe??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let Q=i;Q==null&&(Q=new he(this.startLine,this.startColumn,this.pos)),Q.length=this.pos-Q.offset;let ae=new ke(x.OpAnd(!1),Q);return this.previous=ae,ae}else{let R=0,ee=1;for(;R<ee;){let ae=R++;if(this.pos>=this.length)break;let _e=p.cca(this.input,this.pos);(_e??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.error("Expected &",!1);let X=i;X==null&&(X=new he(this.startLine,this.startColumn,this.pos)),X.length=this.pos-X.offset;let Q=new ke(x.OpAnd(!1),X);return this.previous=Q,Q}}}break;case 40:let P=0,I=1;for(;P<I;){let H=P++;if(this.pos>=this.length)break;let ie=p.cca(this.input,this.pos);(ie??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.makeStrictIfFollowingCallable();let v=i;v==null&&(v=new he(this.startLine,this.startColumn,this.pos)),v.length=this.pos-v.offset;let F=new ke(x.LParen,v);return this.previous=F,F;case 41:let B=0,A=1;for(;B<A;){let H=B++;if(this.pos>=this.length)break;let ie=p.cca(this.input,this.pos);(ie??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.strictExprs.pop();let L=i;L==null&&(L=new he(this.startLine,this.startColumn,this.pos)),L.length=this.pos-L.offset;let z=new ke(x.RParen,L);return this.previous=z,z;case 42:let D=t;if(D>=48&&D<=57)return this.readNumber();{let H=t;if(H>=97&&H<=122||H>=65&&H<=90||H==95)return this.readIdentifier();{let ie;if(this.pos+1<this.length){let R=p.cca(this.input,this.pos+1);ie=R??-1}else ie=0;if(ie==61){let R=2;R==null&&(R=1);let ee=0,X=R;for(;ee<X;){let _e=ee++;if(this.pos>=this.length)break;let xe=p.cca(this.input,this.pos);(xe??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let Q=i;Q==null&&(Q=new he(this.startLine,this.startColumn,this.pos)),Q.length=this.pos-Q.offset;let ae=new ke(x.OpMultiplyAssign,Q);return this.previous=ae,ae}else{let R=0,ee=1;for(;R<ee;){let ae=R++;if(this.pos>=this.length)break;let _e=p.cca(this.input,this.pos);(_e??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let X=i;X==null&&(X=new he(this.startLine,this.startColumn,this.pos)),X.length=this.pos-X.offset;let Q=new ke(x.OpMultiply,X);return this.previous=Q,Q}}}break;case 43:let O=t;if(O>=48&&O<=57)return this.readNumber();{let H=t;if(H>=97&&H<=122||H>=65&&H<=90||H==95)return this.readIdentifier();{let ie;if(this.pos+1<this.length){let R=p.cca(this.input,this.pos+1);ie=R??-1}else ie=0;if(ie==61){let R=2;R==null&&(R=1);let ee=0,X=R;for(;ee<X;){let _e=ee++;if(this.pos>=this.length)break;let xe=p.cca(this.input,this.pos);(xe??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let Q=i;Q==null&&(Q=new he(this.startLine,this.startColumn,this.pos)),Q.length=this.pos-Q.offset;let ae=new ke(x.OpPlusAssign,Q);return this.previous=ae,ae}else{let R=0,ee=1;for(;R<ee;){let ae=R++;if(this.pos>=this.length)break;let _e=p.cca(this.input,this.pos);(_e??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let X=i;X==null&&(X=new he(this.startLine,this.startColumn,this.pos)),X.length=this.pos-X.offset;let Q=new ke(x.OpPlus,X);return this.previous=Q,Q}}}break;case 44:let q=0,M=1;for(;q<M;){let H=q++;if(this.pos>=this.length)break;let ie=p.cca(this.input,this.pos);(ie??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let U=i;U==null&&(U=new he(this.startLine,this.startColumn,this.pos)),U.length=this.pos-U.offset;let K=new ke(x.Comma,U);return this.previous=K,K;case 45:let G=t;if(G>=48&&G<=57)return this.readNumber();{let H=t;if(H>=97&&H<=122||H>=65&&H<=90||H==95)return this.readIdentifier();{let ie;if(this.pos+1<this.length){let R=p.cca(this.input,this.pos+1);ie=R??-1}else ie=0;if(ie==62){let R=2;R==null&&(R=1);let ee=0,X=R;for(;ee<X;){let _e=ee++;if(this.pos>=this.length)break;let xe=p.cca(this.input,this.pos);(xe??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let Q=i;Q==null&&(Q=new he(this.startLine,this.startColumn,this.pos)),Q.length=this.pos-Q.offset;let ae=new ke(x.Arrow,Q);return this.previous=ae,ae}else{let R;if(this.pos+1<this.length){let ee=p.cca(this.input,this.pos+1);R=ee??-1}else R=0;if(R==45&&this.strictExprs.length==0){let ee=2;ee==null&&(ee=1);let X=0,Q=ee;for(;X<Q;){let xe=X++;if(this.pos>=this.length)break;let Ye=p.cca(this.input,this.pos);(Ye??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ae=i;ae==null&&(ae=new he(this.startLine,this.startColumn,this.pos)),ae.length=this.pos-ae.offset;let _e=new ke(x.Separator,ae);return this.previous=_e,_e}else{let ee;if(this.pos+1<this.length){let X=p.cca(this.input,this.pos+1);ee=X??-1}else ee=0;if(ee==61){let X=2;X==null&&(X=1);let Q=0,ae=X;for(;Q<ae;){let Ye=Q++;if(this.pos>=this.length)break;let gt=p.cca(this.input,this.pos);(gt??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let _e=i;_e==null&&(_e=new he(this.startLine,this.startColumn,this.pos)),_e.length=this.pos-_e.offset;let xe=new ke(x.OpMinusAssign,_e);return this.previous=xe,xe}else{let X=0,Q=1;for(;X<Q;){let xe=X++;if(this.pos>=this.length)break;let Ye=p.cca(this.input,this.pos);(Ye??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ae=i;ae==null&&(ae=new he(this.startLine,this.startColumn,this.pos)),ae.length=this.pos-ae.offset;let _e=new ke(x.OpMinus,ae);return this.previous=_e,_e}}}}}break;case 46:let Y=0,$=1;for(;Y<$;){let H=Y++;if(this.pos>=this.length)break;let ie=p.cca(this.input,this.pos);(ie??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let se=i;se==null&&(se=new he(this.startLine,this.startColumn,this.pos)),se.length=this.pos-se.offset;let ue=new ke(x.Dot,se);return this.previous=ue,ue;case 47:let oe=t;if(oe>=48&&oe<=57)return this.readNumber();{let H=t;if(H>=97&&H<=122||H>=65&&H<=90||H==95)return this.readIdentifier();{let ie;if(this.pos+1<this.length){let R=p.cca(this.input,this.pos+1);ie=R??-1}else ie=0;if(ie==61){let R=2;R==null&&(R=1);let ee=0,X=R;for(;ee<X;){let _e=ee++;if(this.pos>=this.length)break;let xe=p.cca(this.input,this.pos);(xe??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let Q=i;Q==null&&(Q=new he(this.startLine,this.startColumn,this.pos)),Q.length=this.pos-Q.offset;let ae=new ke(x.OpDivideAssign,Q);return this.previous=ae,ae}else{let R;if(this.pos+1<this.length){let ee=p.cca(this.input,this.pos+1);R=ee??-1}else R=0;if(R==47)return this.readLineComment();{let ee;if(this.pos+1<this.length){let X=p.cca(this.input,this.pos+1);ee=X??-1}else ee=0;if(ee==42)return this.readMultiLineComment();{let X=0,Q=1;for(;X<Q;){let xe=X++;if(this.pos>=this.length)break;let Ye=p.cca(this.input,this.pos);(Ye??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ae=i;ae==null&&(ae=new he(this.startLine,this.startColumn,this.pos)),ae.length=this.pos-ae.offset;let _e=new ke(x.OpDivide,ae);return this.previous=_e,_e}}}}}break;case 58:let ge;if(this.pos+1<this.length){let H=p.cca(this.input,this.pos+1);ge=H??-1}else ge=0;if(ge==61){let H=2;H==null&&(H=1);let ie=0,R=H;for(;ie<R;){let Q=ie++;if(this.pos>=this.length)break;let ae=p.cca(this.input,this.pos);(ae??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ee=i;ee==null&&(ee=new he(this.startLine,this.startColumn,this.pos)),ee.length=this.pos-ee.offset;let X=new ke(x.OpUnquotedAssign,ee);return this.previous=X,X}else{let H=0,ie=1;for(;H<ie;){let X=H++;if(this.pos>=this.length)break;let Q=p.cca(this.input,this.pos);(Q??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let R=i;R==null&&(R=new he(this.startLine,this.startColumn,this.pos)),R.length=this.pos-R.offset;let ee=new ke(x.Colon,R);return this.previous=ee,ee}break;case 60:let me=t;if(me>=48&&me<=57)return this.readNumber();{let H=t;if(H>=97&&H<=122||H>=65&&H<=90||H==95)return this.readIdentifier();{let ie;if(this.pos+1<this.length){let R=p.cca(this.input,this.pos+1);ie=R??-1}else ie=0;if(ie==61){let R=2;R==null&&(R=1);let ee=0,X=R;for(;ee<X;){let _e=ee++;if(this.pos>=this.length)break;let xe=p.cca(this.input,this.pos);(xe??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let Q=i;Q==null&&(Q=new he(this.startLine,this.startColumn,this.pos)),Q.length=this.pos-Q.offset;let ae=new ke(x.OpLessEq,Q);return this.previous=ae,ae}else{let R=0,ee=1;for(;R<ee;){let ae=R++;if(this.pos>=this.length)break;let _e=p.cca(this.input,this.pos);(_e??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let X=i;X==null&&(X=new he(this.startLine,this.startColumn,this.pos)),X.length=this.pos-X.offset;let Q=new ke(x.OpLess,X);return this.previous=Q,Q}}}break;case 61:let de=t;if(de>=48&&de<=57)return this.readNumber();{let H=t;if(H>=97&&H<=122||H>=65&&H<=90||H==95)return this.readIdentifier();{let ie;if(this.pos+1<this.length){let R=p.cca(this.input,this.pos+1);ie=R??-1}else ie=0;if(ie==61){let R=2;R==null&&(R=1);let ee=0,X=R;for(;ee<X;){let _e=ee++;if(this.pos>=this.length)break;let xe=p.cca(this.input,this.pos);(xe??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let Q=i;Q==null&&(Q=new he(this.startLine,this.startColumn,this.pos)),Q.length=this.pos-Q.offset;let ae=new ke(x.OpEquals,Q);return this.previous=ae,ae}else{let R=0,ee=1;for(;R<ee;){let ae=R++;if(this.pos>=this.length)break;let _e=p.cca(this.input,this.pos);(_e??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let X=i;X==null&&(X=new he(this.startLine,this.startColumn,this.pos)),X.length=this.pos-X.offset;let Q=new ke(x.OpAssign,X);return this.previous=Q,Q}}}break;case 62:let Oe=t;if(Oe>=48&&Oe<=57)return this.readNumber();{let H=t;if(H>=97&&H<=122||H>=65&&H<=90||H==95)return this.readIdentifier();{let ie;if(this.pos+1<this.length){let R=p.cca(this.input,this.pos+1);ie=R??-1}else ie=0;if(ie==61){let R=2;R==null&&(R=1);let ee=0,X=R;for(;ee<X;){let _e=ee++;if(this.pos>=this.length)break;let xe=p.cca(this.input,this.pos);(xe??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let Q=i;Q==null&&(Q=new he(this.startLine,this.startColumn,this.pos)),Q.length=this.pos-Q.offset;let ae=new ke(x.OpGreaterEq,Q);return this.previous=ae,ae}else{let R=0,ee=1;for(;R<ee;){let ae=R++;if(this.pos>=this.length)break;let _e=p.cca(this.input,this.pos);(_e??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let X=i;X==null&&(X=new he(this.startLine,this.startColumn,this.pos)),X.length=this.pos-X.offset;let Q=new ke(x.OpGreater,X);return this.previous=Q,Q}}}break;case 63:let Ve=t;if(Ve>=48&&Ve<=57)return this.readNumber();{let H=t;if(H>=97&&H<=122||H>=65&&H<=90||H==95)return this.readIdentifier();{this.pos++;let ie=null;ie==null&&(ie=new he(this.startLine,this.startColumn,this.pos)),ie.length=this.pos-ie.offset;let R=new ke(x.Question,ie);return this.previous=R,R}}break;case 93:let je=0,et=1;for(;je<et;){let H=je++;if(this.pos>=this.length)break;let ie=p.cca(this.input,this.pos);(ie??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.strictExprs.pop();let Ue=i;Ue==null&&(Ue=new he(this.startLine,this.startColumn,this.pos)),Ue.length=this.pos-Ue.offset;let Ge=new ke(x.RBracket,Ue);return this.previous=Ge,Ge;case 124:let nt=t;if(nt>=48&&nt<=57)return this.readNumber();{let H=t;if(H>=97&&H<=122||H>=65&&H<=90||H==95)return this.readIdentifier();{let ie;if(this.pos+1<this.length){let R=p.cca(this.input,this.pos+1);ie=R??-1}else ie=0;if(ie==124){let R=2;R==null&&(R=1);let ee=0,X=R;for(;ee<X;){let _e=ee++;if(this.pos>=this.length)break;let xe=p.cca(this.input,this.pos);(xe??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let Q=i;Q==null&&(Q=new he(this.startLine,this.startColumn,this.pos)),Q.length=this.pos-Q.offset;let ae=new ke(x.OpOr(!1),Q);return this.previous=ae,ae}else{let R=0,ee=1;for(;R<ee;){let ae=R++;if(this.pos>=this.length)break;let _e=p.cca(this.input,this.pos);(_e??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.error("Expected |",!1);let X=i;X==null&&(X=new he(this.startLine,this.startColumn,this.pos)),X.length=this.pos-X.offset;let Q=new ke(x.OpOr(!1),X);return this.previous=Q,Q}}}break;default:let De=t;if(De>=48&&De<=57)return this.readNumber();{let H=t;return H>=97&&H<=122||H>=65&&H<=90||H==95?this.readIdentifier():(this.error("Unexpected character: "+String.fromCodePoint(t),!0),null)}}}}countIndentation(){let e=this.pos,t=0;for(;e<this.length;){let n=p.cca(this.input,e),s=n??-1;if(s==32)++t;else if(s==9)++t;else break;++e}let i,l;if(e<this.length){let n=p.cca(this.input,e);l=(n??-1)==10}else l=!0;if(l)i=!0;else{let n=p.cca(this.input,e);i=(n??-1)==13}return i?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 x.KwBeat;case 2:case 3:return x.KwState;case 4:case 5:return x.KwCharacter;case 6:case 7:return x.KwBeat;case 8:case 9:return x.KwBeat;case 10:return x.LBrace;case 11:return x.Indent;case 12:return x.LBracket}--e}return x.KwBeat}inBeat(){return this.parentBlockType()==x.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!=x.KwState?e==x.KwCharacter:!0}readLineBreak(){let e=new he(this.startLine,this.startColumn,this.pos),t=p.cca(this.input,this.pos);if((t??-1)==13){let n=0,s=1;for(;n<s;){let h=n++;if(this.pos>=this.length)break;let a=p.cca(this.input,this.pos);(a??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let r;if(this.pos<this.length){let h=p.cca(this.input,this.pos);r=(h??-1)==10}else r=!1;if(r){let h=0,a=1;for(;h<a;){let o=h++;if(this.pos>=this.length)break;let u=p.cca(this.input,this.pos);(u??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}else{let n=0,s=1;for(;n<s;){let r=n++;if(this.pos>=this.length)break;let h=p.cca(this.input,this.pos);(h??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let i=e;i==null&&(i=new he(this.startLine,this.startColumn,this.pos)),i.length=this.pos-i.offset;let l=new ke(x.LineBreak,i);return this.previous=l,l}isWhitespace(e){return e!=32?e==9:!0}matchIdentifier(e){if(this.length==0)return null;let t=p.cca(this.input,e),i=t??-1;if(!(i>=97&&i<=122||i>=65&&i<=90||i==95))return null;let l=1;for(;l<this.length;){let s=p.cca(this.input,e+l),r=s??-1;if(!(r>=97&&r<=122||r>=65&&r<=90||r==95||r>=48&&r<=57))break;++l}let n=this.input;return l!=null?p.substr(n,e,l):p.substr(n,e,null)}_skipWhitespaceAndComments(e,t){if(t==null&&(t=!1),t)return this._skipWhitespaceAndCommentsStopNextLine(e);{let i=e,l=!1;for(;e<this.length;){for(;;){let n;if(e<this.length){let s=p.cca(this.input,e);if((s??-1)!=32){let r=p.cca(this.input,e);n=(r??-1)==9}else n=!0}else n=!1;if(!n)break;++e,l=!0}if(e<this.length-1){let n=p.cca(this.input,e);if((n??-1)==47){let s=p.cca(this.input,e+1);if((s??-1)==47)return e=i,e;{let r=p.cca(this.input,e+1);if((r??-1)==42){e+=2,l=!0;let h=!1;for(;e<this.length-1;){let a,o=p.cca(this.input,e);if((o??-1)==42){let u=p.cca(this.input,e+1);a=(u??-1)==47}else a=!1;if(a){e+=2,h=!0;break}++e}if(!h)return e=i,e;continue}}}}break}return l?e:i}}_skipWhitespaceAndCommentsStopNextLine(e){let t=e,i=!1,l=!1;for(;e<this.length;){for(;e<this.length;){let n=p.cca(this.input,e),s=n??-1;if(s==32||s==9||s==13||!l&&s==10)s==10&&(l=!0),++e,i=!0;else break}if(e<this.length-1&&!l){let n=p.cca(this.input,e);if((n??-1)==47){let s=p.cca(this.input,e+1);if((s??-1)==47){for(e+=2,i=!0;;){let r,h;if(e<this.length){let a=p.cca(this.input,e);h=(a??-1)!=10}else h=!1;if(h){let a=p.cca(this.input,e);r=(a??-1)!=13}else r=!1;if(!r)break;++e}continue}else{let r=p.cca(this.input,e+1);if((r??-1)==42){e+=2,i=!0;let h=!1;for(;e<this.length-1;){let a,o=p.cca(this.input,e);if((o??-1)==42){let u=p.cca(this.input,e+1);a=(u??-1)==47}else a=!1;if(a){e+=2,h=!0;break}++e}if(!h)return e=t,e;continue}}}}break}return i?e:t}isIfStart(e){e=this._skipWhitespaceAndComments(e,!1);let t=p.cca(this.input,e);if((t??-1)!=105)return!1;++e;let i=p.cca(this.input,e);if((i??-1)!=102)return!1;let l=++e;e=this._skipWhitespaceAndComments(e,!1);let n;if(e<this.length){let o=p.cca(this.input,e);n=(o??-1)==33}else n=!1;n&&(++e,e=this._skipWhitespaceAndComments(e,!1));let s=p.cca(this.input,e);if((s??-1)==40)return!0;let r;if(e==l&&l<this.length){let o=p.cca(this.input,l),u=o??-1;r=u>=97&&u<=122||u>=65&&u<=90||u==95}else r=!1;if(r)return!1;let h;if(e<this.length){let o=p.cca(this.input,e),u=o??-1;h=!(u>=97&&u<=122||u>=65&&u<=90||u==95)}else h=!0;if(h)return!1;let a=this;for(;e<this.length;){let o=p.cca(this.input,e);if((o??-1)==40)return!0;{let C=!0,P=a.length;if(e>=P)C=!1;else{let I,v,F;if(e+1<P){let B=p.cca(a.input,e);F=(B??-1)==111}else F=!1;if(F){let B=p.cca(a.input,e+1);v=(B??-1)==114}else v=!1;if(v)if(e+2<P){let B=p.cca(a.input,e+2),A=B??-1;I=!(A>=97&&A<=122||A>=65&&A<=90||A==95)}else I=!0;else I=!1;if(I)C=!1;else{let B,A,L,z;if(e+2<P){let D=p.cca(a.input,e);z=(D??-1)==97}else z=!1;if(z){let D=p.cca(a.input,e+1);L=(D??-1)==110}else L=!1;if(L){let D=p.cca(a.input,e+2);A=(D??-1)==100}else A=!1;if(A)if(e+3<P){let D=p.cca(a.input,e+3),O=D??-1;B=!(O>=97&&O<=122||O>=65&&O<=90||O==95)}else B=!0;else B=!1;if(B)C=!1;else{let D=p.cca(a.input,e),O=D??-1;if(!(O>=97&&O<=122||O>=65&&O<=90||O==95))C=!1;else for(++e;e<a.length;){let q=p.cca(a.input,e);if(O=q??-1,!(O>=97&&O<=122||O>=65&&O<=90||O==95||O>=48&&O<=57))break;++e}}}}if(!C)return!1}if(e=this._skipWhitespaceAndComments(e,!1),e>=this.length)return!0;let u=p.cca(this.input,e),c=u??-1;if(c==46){++e,e=this._skipWhitespaceAndComments(e,!1);let C=!0,P=a.length;if(e>=P)C=!1;else{let v,F,B;if(e+1<P){let A=p.cca(a.input,e);B=(A??-1)==111}else B=!1;if(B){let A=p.cca(a.input,e+1);F=(A??-1)==114}else F=!1;if(F)if(e+2<P){let A=p.cca(a.input,e+2),L=A??-1;v=!(L>=97&&L<=122||L>=65&&L<=90||L==95)}else v=!0;else v=!1;if(v)C=!1;else{let A,L,z,D;if(e+2<P){let O=p.cca(a.input,e);D=(O??-1)==97}else D=!1;if(D){let O=p.cca(a.input,e+1);z=(O??-1)==110}else z=!1;if(z){let O=p.cca(a.input,e+2);L=(O??-1)==100}else L=!1;if(L)if(e+3<P){let O=p.cca(a.input,e+3),q=O??-1;A=!(q>=97&&q<=122||q>=65&&q<=90||q==95)}else A=!0;else A=!1;if(A)C=!1;else{let O=p.cca(a.input,e),q=O??-1;if(!(q>=97&&q<=122||q>=65&&q<=90||q==95))C=!1;else for(++e;e<a.length;){let M=p.cca(a.input,e);if(q=M??-1,!(q>=97&&q<=122||q>=65&&q<=90||q==95||q>=48&&q<=57))break;++e}}}}if(!C||(e=this._skipWhitespaceAndComments(e,!1),e>=this.length))return!0;let I=p.cca(this.input,e);c=I??-1}if(c==91){++e;let C=1;for(;e<this.length&&C>0;){let I=p.cca(this.input,e);c=I??-1,c==91&&++C,c==93&&--C,++e}if(e=this._skipWhitespaceAndComments(e,!1),e>=this.length)return!0;let P=p.cca(this.input,e);c=P??-1}let _,f,m;if(c==97){let C=p.cca(this.input,e+1);m=(C??-1)==110}else m=!1;if(m){let C=p.cca(this.input,e+2);f=(C??-1)==100}else f=!1;if(f)if(e+3<this.length){let C=p.cca(this.input,e+3),P=C??-1;_=!(P>=97&&P<=122||P>=65&&P<=90||P==95)}else _=!0;else _=!1;if(_)return!0;let g,w;if(c==111){let C=p.cca(this.input,e+1);w=(C??-1)==114}else w=!1;if(w)if(e+2<this.length){let C=p.cca(this.input,e+2),P=C??-1;g=!(P>=97&&P<=122||P>=65&&P<=90||P==95)}else g=!0;else g=!1;if(g)return!0;let y,T,E;if(c==40||c==38||c==124)E=!0;else{let C=p.cca(this.input,e+1);E=(C??-1)==61&&c==61}if(E||c==62||c==60)T=!0;else if(c==33){let C=p.cca(this.input,e+1);T=(C??-1)==61}else T=!1;if(T)y=!0;else{let C=p.cca(this.input,e+1);y=(C??-1)!=61&&(c==43||c==45||c==42||c==47||c==123)}if(y)return!0;if(c==10||c==13||e>=this.length)return e=l,!0;if(c==32||c==9){let C=e;for(;;){let v;if(C<this.length){let F=p.cca(this.input,C),B=F??-1;v=B==32||B==9}else v=!1;if(!v)break;++C}let P,I;if(C+1<this.length){let v=p.cca(this.input,C);I=(v??-1)==47}else I=!1;if(I){let v=p.cca(this.input,C+1);P=(v??-1)==47}else P=!1;if(P)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;let i=p.cca(this.input,e);if((i??-1)==40)return!0;let l=this,n=t;n==null&&(n=!1);let s=!0;if(e>=l.length)s=!1;else{let r=!1,h=p.cca(l.input,e),a=h??-1;if(r=a==95,!(a>=97&&a<=122||a>=65&&a<=90||a==95)||n&&!r&&!(a>=97&&a<=122))s=!1;else for(++e;e<l.length;){let o=r,u=p.cca(l.input,e);if(a=u??-1,r=a==95,!(a>=97&&a<=122||a>=65&&a<=90||a==95||a>=48&&a<=57))break;if(n&&o&&!r&&!(a>=97&&a<=122)){s=!1;break}++e}}if(!s)return!1;for(;e<this.length;){if(e=this._skipWhitespaceAndComments(e,!1),e>=this.length)return!0;let r=p.cca(this.input,e),h=r??-1;if(!(h==32||h==9)&&h!=46&&h!=91&&h!=10&&h!=13&&h!=47)return!1;let a;if(h==10||h==13)a=!0;else if(h==47&&e+1<this.length){let o=p.cca(this.input,e+1);if((o??-1)!=47){let u=p.cca(this.input,e+1);a=(u??-1)==42}else a=!0}else a=!1;if(a)return!0;if(h==46){if(++e,e=this._skipWhitespaceAndComments(e,!1),e>=this.length)return!0;let o=!0;if(e>=l.length)o=!1;else{let u=!1,c=p.cca(l.input,e),_=c??-1;if(u=_==95,!(_>=97&&_<=122||_>=65&&_<=90||_==95))o=!1;else for(++e;e<l.length;){let f=u,m=p.cca(l.input,e);if(_=m??-1,u=_==95,!(_>=97&&_<=122||_>=65&&_<=90||_==95||_>=48&&_<=57))break;++e}}if(!o)return!0;continue}if(h==91){++e;let o=1;for(;e<this.length&&o>0;){let u=p.cca(this.input,e);if(h=u??-1,h==34){if(e=this.scanStringEnd(e,!1),e==-1)return!1;continue}h==91&&++o,h==93&&--o,++e}continue}if(h==32||h==9){++e;continue}break}return!0}isTransitionStart(e){let t,i=p.cca(this.input,e);if((i??-1)!=45||e>=this.length-1)t=!0;else{let s=p.cca(this.input,e+1);t=(s??-1)!=62}if(t||(e+=2,e=this._skipWhitespaceAndComments(e,!1),e>=this.length))return!1;let l=p.cca(this.input,e);if((l??-1)==46)++e;else{let s=p.cca(this.input,e),r=s??-1;if(r>=97&&r<=122||r>=65&&r<=90||r==95||r>=48&&r<=57)for(++e;;){let h;if(e<this.length){let a=p.cca(this.input,e),o=a??-1;h=o>=97&&o<=122||o>=65&&o<=90||o==95||o>=48&&o<=57}else h=!1;if(!h)break;++e}else return!1}if(e=this._skipWhitespaceAndComments(e,!1),e<this.length){let s=p.cca(this.input,e),r=s??-1;if(r!=10&&r!=13&&r!=32&&r!=9&&r!=47&&r!=35)return!1}return!0}isInsertionStart(e){let t=p.cca(this.input,e);if((t??-1)!=43||(++e,e=this._skipWhitespaceAndComments(e,!1),e>=this.length))return!1;let i=p.cca(this.input,e);if((i??-1)==46)++e;else{let n=p.cca(this.input,e),s=n??-1;if(s>=97&&s<=122||s>=65&&s<=90||s==95||s>=48&&s<=57)for(++e;;){let r;if(e<this.length){let h=p.cca(this.input,e),a=h??-1;r=a>=97&&a<=122||a>=65&&a<=90||a==95||a>=48&&a<=57}else r=!1;if(!r)break;++e}else return!1}if(e=this._skipWhitespaceAndComments(e,!1),e<this.length){let n=p.cca(this.input,e),s=n??-1,r;if(s==105&&e+1<this.length){let h=p.cca(this.input,e+1);r=(h??-1)==102}else r=!1;if(r){let h;if(e+2<this.length){let a=p.cca(this.input,e+2),o=a??-1;h=!(o>=97&&o<=122||o>=65&&o<=90||o==95||o>=48&&o<=57)}else h=!0;if(h)return!0}if(s!=10&&s!=13&&s!=32&&s!=9&&s!=47)return!1}return!0}isChoiceOnceStart(e){if(!this.inChoiceRoot())return!1;let t=p.cca(this.input,e);if((t??-1)!=45||(++e,e>=this.length))return!1;let i=p.cca(this.input,e);return(i??-1)==32}isLabelStart(e){e=this._skipWhitespaceAndComments(e,!1);let t=p.cca(this.input,e),i=t??-1;if(!(i>=97&&i<=122||i>=65&&i<=90||i==95))return!1;let l=e;for(++e;;){let a;if(e<this.length){let o=p.cca(this.input,e),u=o??-1;a=u>=97&&u<=122||u>=65&&u<=90||u==95||u>=48&&u<=57}else a=!1;if(!a)break;++e}for(;;){let a;if(e<this.length){let o=p.cca(this.input,e),u=o??-1;a=u==32||u==9}else a=!1;if(!a)break;++e}let n;if(e<this.length){let a=p.cca(this.input,e);n=(a??-1)!=58}else n=!0;if(n)return!1;let s=this.input,r=e-l,h=r!=null?p.substr(s,l,r):p.substr(s,l,null);return!Object.prototype.hasOwnProperty.call(yt.KEYWORDS.h,h)}isCallStart(e){let t=e,i=this,l=!0;if(e>=i.length)l=!1;else{let n=p.cca(i.input,e),s=n??-1;if(!(s>=97&&s<=122||s>=65&&s<=90||s==95))l=!1;else for(++e;e<i.length;){let r=p.cca(i.input,e);if(s=r??-1,!(s>=97&&s<=122||s>=65&&s<=90||s==95||s>=48&&s<=57))break;++e}}if(!l)return e=t,!1;for(;e<this.length;){if(e=this._skipWhitespaceAndComments(e,!1),e>=this.length)return e=t,!1;let n=p.cca(this.input,e),s=n??-1;if(s==40)return e=t,!0;if(s==46){++e,e=this._skipWhitespaceAndComments(e,!1);let r=!0;if(e>=i.length)r=!1;else{let h=p.cca(i.input,e),a=h??-1;if(!(a>=97&&a<=122||a>=65&&a<=90||a==95))r=!1;else for(++e;e<i.length;){let o=p.cca(i.input,e);if(a=o??-1,!(a>=97&&a<=122||a>=65&&a<=90||a==95||a>=48&&a<=57))break;++e}}if(!r)return e=t,!1;continue}if(s==91){for(++e;e<this.length;){let r=p.cca(this.input,e),h=r??-1;if(h==34){if(e=this.scanStringEnd(e,!1),e==-1)return e=t,!1;continue}if(h==93){++e;break}++e}continue}return e=t,!1}return e=t,!1}isAssignStart(e,t){let i=this,l;if(t){let s=!0,r=e;if(e>=i.length)s=!1;else{let o=p.cca(i.input,e),u=o??-1;if(!(u>=97&&u<=122||u>=65&&u<=90||u==95))s=!1;else for(++e;e<i.length;){let c=p.cca(i.input,e);if(u=c??-1,!(u>=97&&u<=122||u>=65&&u<=90||u==95||u>=48&&u<=57))break;++e}}let h,a;if(e==r+2){let o=p.cca(i.input,r);a=(o??-1)==105}else a=!1;if(a){let o=p.cca(i.input,r+1);h=(o??-1)==102}else h=!1;l=!(!h&&s)}else l=!1;if(l)return!1;let n=!1;for(;e<this.length;){if(e=this._skipWhitespaceAndComments(e,!1),e>=this.length)return!1;let s=p.cca(this.input,e),r=s??-1,h;if(n)h=!1;else{let a;if(r==61)if(e+1<this.length){let o=p.cca(this.input,e+1);a=(o??-1)!=61}else a=!0;else a=!1;if(a)h=!0;else{let o=p.cca(this.input,e+1);h=(o??-1)==61&&(r==43||r==45||r==42||r==47||r==58)}}if(h)return!0;if(t){if(r==46){++e,e=this._skipWhitespaceAndComments(e,!1);let a=!0,o=e;if(e>=i.length)a=!1;else{let _=p.cca(i.input,e),f=_??-1;if(!(f>=97&&f<=122||f>=65&&f<=90||f==95))a=!1;else for(++e;e<i.length;){let m=p.cca(i.input,e);if(f=m??-1,!(f>=97&&f<=122||f>=65&&f<=90||f==95||f>=48&&f<=57))break;++e}}let u,c;if(e==o+2){let _=p.cca(i.input,o);c=(_??-1)==105}else c=!1;if(c){let _=p.cca(i.input,o+1);u=(_??-1)==102}else u=!1;if(!(!u&&a))return!1;continue}if(r==91){for(++e;e<this.length;){let a=p.cca(this.input,e),o=a??-1;if(o==34){if(e=this.scanStringEnd(e,!1),e==-1)return!1;continue}if(o==93){++e;break}++e}continue}return!1}else if(r==92)n=!0,++e;else{if(r==13||r==10)return!1;if(r==34){if(e=this.scanStringEnd(e,!1),e==-1)return!1}else if(r>=97&&r<=122||r>=65&&r<=90||r==95){let a=!0,o=e;if(e>=i.length)a=!1;else{let _=p.cca(i.input,e),f=_??-1;if(!(f>=97&&f<=122||f>=65&&f<=90||f==95))a=!1;else for(++e;e<i.length;){let m=p.cca(i.input,e);if(f=m??-1,!(f>=97&&f<=122||f>=65&&f<=90||f==95||f>=48&&f<=57))break;++e}}let u,c;if(e==o+2){let _=p.cca(i.input,o);c=(_??-1)==105}else c=!1;if(c){let _=p.cca(i.input,o+1);u=(_??-1)==102}else u=!1;if(!(!u&&a))return!1}else{let a;if((r==61||r==33||r==60||r==62)&&e+1<this.length){let o=p.cca(this.input,e+1);a=(o??-1)==61}else a=!1;a?e+=2:++e}}}return!1}isColon(e,t){if(t==null&&(t=!0),t)for(;;){let i;if(e<this.length){let l=p.cca(this.input,e);if((l??-1)!=32){let n=p.cca(this.input,e);i=(n??-1)==9}else i=!0}else i=!1;if(!i)break;++e}if(e<this.length){let i=p.cca(this.input,e);return(i??-1)==58}else return!1}afterLabelIdentifierToken(e){e==null&&(e=!0);let t=this.tokenized.length-1;for(;t>=0;){let i=this.tokenized[t];if(!Ot.isComment(i.type)&&(e||i.type!=x.LineBreak&&i.type!=x.Indent&&i.type!=x.Unindent))return i.type==x.Colon&&t>0&&Ot.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!=x.Colon;)++i;let l=this.tokenized[i].pos.offset+1,n=t.pos.column,s=!0,r=!1;for(;l<this.length;){let g=p.cca(this.input,l),w=g??-1;if(w==32||w==9)++l;else break}for(;l<this.length;){let g=p.cca(this.input,l),w=g??-1;if(w==10||w==13)break;if(w==47&&l+1<this.length){let y=p.cca(this.input,l+1),T=y??-1;if(T==47)break;if(T==42){for(l+=2;l<this.length;){let E,C=p.cca(this.input,l);if((C??-1)==42&&l+1<this.length){let P=p.cca(this.input,l+1);E=(P??-1)==47}else E=!1;if(E){l+=2;break}++l}continue}}if(w==60)r=!0;else if(w==62)r=!1;else if(!r&&!(w==32||w==9)){s=!1;break}++l}if(!s)for(;;){let g,w;if(l<this.length){let y=p.cca(this.input,l);w=(y??-1)!=10}else w=!1;if(w){let y=p.cca(this.input,l);g=(y??-1)!=13}else g=!1;if(!g)break;++l}let h=l,a=!0;if(a==null&&(a=!1),l=this._skipWhitespaceAndComments(l,a),l<=h)return-1;let o=0,u=l;for(;;){let g;if(u>0){let w=p.cca(this.input,u-1);if((w??-1)!=32){let y=p.cca(this.input,u-1);g=(y??-1)==9}else g=!0}else g=!1;if(!g)break;++o,--u}if(o<=n-1)return-1;let c=!1;c==null&&(c=!1),l=this._skipWhitespaceAndComments(l,c);let _,f=p.cca(this.input,l),m=f??-1;if(m==32||m==9)_=!0;else{let g=p.cca(this.input,l);if((g??-1)==47){let w=p.cca(this.input,l+1);_=(w??-1)==47}else _=!1}return _?-1:o}isContinuingMultilineText(e,t){let i,l=p.cca(this.input,e);if((l??-1)==47){let f=p.cca(this.input,e+1);i=(f??-1)==47}else i=!1;if(i)for(;;){let f,m;if(e<this.length){let g=p.cca(this.input,e);m=(g??-1)!=13}else m=!1;if(m){let g=p.cca(this.input,e);f=(g??-1)!=10}else f=!1;if(!f)break;++e}let n=p.cca(this.input,e);(n??-1)==13&&++e;let s=p.cca(this.input,e);if((s??-1)==10)++e;else return!1;let r=0;for(;;){let f,m=p.cca(this.input,e);if((m??-1)!=32){let g=p.cca(this.input,e);f=(g??-1)==9}else f=!0;if(!f)break;++r,++e}if(r!=t)return!1;let h=!1;h==null&&(h=!1),e=this._skipWhitespaceAndComments(e,h);let a,o,u,c=p.cca(this.input,e),_=c??-1;if(_==32||_==9)u=!0;else{let f=p.cca(this.input,e);u=(f??-1)==13}if(u)o=!0;else{let f=p.cca(this.input,e);o=(f??-1)==10}if(o)a=!0;else{let f=p.cca(this.input,e);if((f??-1)==47){let m=p.cca(this.input,e+1);a=(m??-1)==47}else a=!1}return!a}isAfterComma(){let e=this.tokenized.length-1;for(;e>=0;){let t=this.tokenized[e];if(!Ot.isComment(t.type)&&t.type!=x.LineBreak&&t.type!=x.Indent&&t.type!=x.Unindent)return t.type==x.Comma;--e}return!1}isAfterLBracket(){let e=this.tokenized.length-1;for(;e>=0;){let t=this.tokenized[e];if(!Ot.isComment(t.type)&&t.type!=x.LineBreak&&t.type!=x.Indent&&t.type!=x.Unindent)return t.type==x.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(Ot.isComment(t.type)||t.type==x.Indent||t.type==x.Unindent)--e;else return!!Ot.isAssignOp(t.type)}return!1}followsUnquotedAssign(){let e=this.tokenized.length-1;for(;e>=0;){let t=this.tokenized[e];if(Ot.isComment(t.type)||t.type==x.Indent||t.type==x.Unindent)--e;else return t.type==x.OpUnquotedAssign}return!1}followsOnlyLabelOrCommentsInLine(){let e=!1,t=this.tokenized.length-1;for(;t>=0;){let i=this.tokenized[t];if(Ot.isComment(i.type)||i.type==x.Indent||i.type==x.Unindent)--t;else if(!e&&i.type==x.Colon)if(--t,t>=0)Ot.isIdentifier(this.tokenized[t].type)&&(e=!0,--t);else return!1;else return i.type==x.LineBreak}return!0}followsOnlyWhitespacesOrCommentsInLine(){let e=this.tokenized.length-1;for(;e>=0;){let t=this.tokenized[e];if(Ot.isComment(t.type)||t.type==x.Indent||t.type==x.Unindent)--e;else return t.type==x.LineBreak}return!0}followsChoiceOncePrefix(){if(!this.inChoiceRoot())return!1;let e=this.tokenized.length-1;for(;e>=0;){let t=this.tokenized[e];if(Ot.isComment(t.type)||t.type==x.Indent||t.type==x.Unindent)--e;else return t.type==x.OpMinus}return!1}hasNonSpecialChar(e){let t=0,i=e.length;for(;t<i;){let l=t++,n=!1,s=p.cca(e,l),r=s??-1,h=0,a=yt.hasNonSpecialChar_specialChars.length;for(;h<a;){let o=h++,u=p.cca(yt.hasNonSpecialChar_specialChars,o);if(r==(u??-1)){n=!0;break}}if(!n)return!0}return!1}isNumber(e){let t=0,i=e.length,l;if(t<i){let h=p.cca(e,t);l=(h??-1)==45}else l=!1;l&&++t;let n=t;for(;;){let h;if(t<i){let a=p.cca(e,t),o=a??-1;h=o>=48&&o<=57}else h=!1;if(!h)break;++t}if(t==n)return!1;let s,r;if(t<i){let h=p.cca(e,t);r=(h??-1)==46}else r=!1;if(r&&t+1<i){let h=p.cca(e,t+1),a=h??-1;s=a>=48&&a<=57}else s=!1;if(s)for(++t;;){let h;if(t<i){let a=p.cca(e,t),o=a??-1;h=o>=48&&o<=57}else h=!1;if(!h)break;++t}return t==i}makeLooseOrStrictAfterBracket(){if(this.isStrict()){this.strictExprs.push(1);return}let e=this.tokenized.length-1;for(;e>=0;){let i=this.tokenized[e].type;switch(i._hx_index){case 19:let l=i.name;this.strictExprs.push(1);return;case 48:case 50:this.strictExprs.push(1);return;case 51:let n=i.content;break;case 52:let s=i.content;break;case 53:let r=i.content;break;case 54:case 55:case 56: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 l=i.name;return!0;case 48:case 50:return!0;case 51:let n=i.content;break;case 52:let s=i.content;break;case 53:let r=i.content;break;case 54:case 55:case 56: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=p.cca(this.input,this.pos),h=r??-1;if(h==10)break;if(h==47&&this.pos+1<this.length){let a=p.cca(this.input,this.pos+1),o=a??-1;if(o==47||o==42)break}if(h==35&&this.pos+1<this.length){let a=p.cca(this.input,this.pos+1),o=a??-1;if(o>=97&&o<=122||o>=65&&o<=90||o==95||o>=48&&o<=57||o==45)break}i+=String.fromCodePoint(h),this.pos++}let l=Ae.rtrim(i),n=new he(t.line,t.column,t.offset,l.length);n==null&&(n=new he(this.startLine,this.startColumn,this.pos)),n.length=this.pos-n.offset;let s=new ke(x.LString(0,l,[]),n);return this.previous=s,s}}scanStringEnd(e,t){let i=e+1,l=!1;for(;i<this.length;){let n=p.cca(this.input,i),s=n??-1;if(s==92){i+=2;continue}if(s==10)return-1;if(s==34&&!l)return i+1;if(t&&s==60&&!l){let r;if(i+1<this.length){let o=p.cca(this.input,i+1);r=o??-1}else r=0;let h=r==47,a=i+(h?2:1);if(a<this.length){let o=p.cca(this.input,a),u=o??-1;(u>=97&&u<=122||u>=65&&u<=90||u==95||u==95||u==36||h&&u==62)&&(l=!0)}}if(s==62&&l&&(l=!1),s==36&&i+1<this.length){let r=p.cca(this.input,i+1),h=r??-1;if(h==123){i+=2;let a=1;for(;i<this.length&&a>0;){let o=p.cca(this.input,i),u=o??-1;if(u==92){i+=2;continue}if(u==10)return-1;let c;if(u==47&&i+1<this.length){let f=p.cca(this.input,i+1);c=(f??-1)==47}else c=!1;if(c)return-1;let _;if(u==47&&i+1<this.length){let f=p.cca(this.input,i+1);_=(f??-1)==42}else _=!1;if(_){for(i+=2;;){if(i>=this.length)return-1;let f=p.cca(this.input,i);if((f??-1)==10)return-1;let m,g;if(i+1<this.length){let w=p.cca(this.input,i);g=(w??-1)==42}else g=!1;if(g){let w=p.cca(this.input,i+1);m=(w??-1)==47}else m=!1;if(m){i+=2;break}++i}continue}if(u==34){if(i=this.scanStringEnd(i,t),i==-1)return-1;continue}u==123?++a:u==125&&--a,++i}if(a!=0)return-1;continue}if(h==36){i+=2;continue}if(h>=97&&h<=122||h>=65&&h<=90||h==95){for(++i;;){let a;if(i<this.length){let o=p.cca(this.input,i),u=o??-1;a=u>=97&&u<=122||u>=65&&u<=90||u==95||u>=48&&u<=57}else a=!1;if(!a)break;++i}if(i=this.scanAccessorChain(i,t),i==-1)return-1;continue}}++i}return-1}scanAccessorChain(e,t){for(;e<this.length;){let i=p.cca(this.input,e),l=i??-1,n;if(l==46&&e+1<this.length){let s=p.cca(this.input,e+1),r=s??-1;n=r>=97&&r<=122||r>=65&&r<=90||r==95}else n=!1;if(n)for(++e;;){let s;if(e<this.length){let r=p.cca(this.input,e),h=r??-1;s=h>=97&&h<=122||h>=65&&h<=90||h==95||h>=48&&h<=57}else s=!1;if(!s)break;++e}else if(l==91||l==40){let s=l==91?93:41;++e;let r=1;for(;e<this.length&&r>0;){let h=p.cca(this.input,e),a=h??-1;if(a==92){e+=2;continue}if(a==10)return-1;let o;if(a==47&&e+1<this.length){let c=p.cca(this.input,e+1);o=(c??-1)==47}else o=!1;if(o)return-1;let u;if(a==47&&e+1<this.length){let c=p.cca(this.input,e+1);u=(c??-1)==42}else u=!1;if(u){for(e+=2;;){if(e>=this.length)return-1;let c=p.cca(this.input,e);if((c??-1)==10)return-1;let _,f;if(e+1<this.length){let m=p.cca(this.input,e);f=(m??-1)==42}else f=!1;if(f){let m=p.cca(this.input,e+1);_=(m??-1)==47}else _=!1;if(_){e+=2;break}++e}continue}if(a==34){if(e=this.scanStringEnd(e,t),e==-1)return-1;continue}a==l?++r:a==s&&--r,++e}if(r!=0)return-1}else break}return e}tryReadUnquotedString(){if(this.isStrict())return null;let e=p.cca(this.input,this.pos),t=e??-1,i;if(this.pos+1<this.length){let A=p.cca(this.input,this.pos+1);i=A??-1}else i=0;if(t==47&&this.pos<this.length-1){let A=p.cca(this.input,this.pos+1),L=A??-1;if(L==47||L==42)return null}if(t==123||t==125||t==91||t==93||t==58||t==35||t==32||t==9)return null;let l=this.parentBlockType();if(l!=x.KwBeat&&l!=x.KwState&&l!=x.KwCharacter)return null;let n=this.isInsideBrackets(),s=this.followsUnquotedAssign(),r=this.afterLabelIdentifierToken(!1);if(r!=-1&&this.tokenized[r].pos.line<this.line&&(this.tokenized[r].pos.column>=this.column||this.line-this.tokenized[r].pos.line>1))return null;let h=r!=-1?this.isStartingMultilineDialogue(r):-1,a=r!=-1,o=l==x.KwState||l==x.KwCharacter||n||s,u=this.matchIdentifier(this.pos);if(o){if(this.isCallStart(this.pos)||this.isLabelStart(this.pos))return null}else if(!a&&u!="true"&&u!="false"&&u!="null"&&(this.keepOrphanExpressions&&this.isIdentifierExpressionStart(this.pos,!0)||this.isIfStart(this.pos)||this.isCallStart(this.pos)||this.isAssignStart(this.pos,!1)))return null;if(!o&&(t==61||i==61&&(t==43||t==45||t==42||t==47))||!o&&!a&&(this.isInsertionStart(this.pos)||this.isChoiceOnceStart(this.pos))||u!=null&&(u=="function"||!o&&(u!="if"&&u!="null"&&u!="true"&&u!="false"&&u!="and"&&u!="or"&&Object.prototype.hasOwnProperty.call(yt.KEYWORDS.h,u)||this.isColon(this.pos+u.length))))return null;let c=!o,_=!1;if(o){if(n){if(!a&&!this.followsOnlyWhitespacesOrCommentsInLine()&&!this.isAfterComma()&&!this.isAfterLBracket())return null}else if(!s&&!a)return null}else if(_=this.followsOnlyLabelOrCommentsInLine(),!_&&!this.followsOnlyWhitespacesOrCommentsInLine()&&!this.followsChoiceOncePrefix()||!_&&i==62&&t==45)return null;if(t==34){let A=this.scanStringEnd(this.pos,l==x.KwBeat);if(A==-1)return null;let L=!1,z=A;for(;z<this.length;){let D=p.cca(this.input,z),O=D??-1;if(O==32||O==9){++z;continue}if(O==10||O==13)break;let q;if(O==47&&z+1<this.length){let M=p.cca(this.input,z+1);if((M??-1)!=47){let U=p.cca(this.input,z+1);q=(U??-1)==42}else q=!0}else q=!1;if(q||O==93||O==125||O==41||O==44||O==35)break;L=!0;break}if(!L&&!o){let D=!0;D==null&&(D=!1);let O=this._skipWhitespaceAndComments(z,D);if(O<=z||O>=this.length)return null;let q=p.cca(this.input,O),M=q??-1,U;if(M==10||M==13||M==34)U=!0;else if(M==47&&O+1<this.length){let se=p.cca(this.input,O+1);if((se??-1)!=47){let ue=p.cca(this.input,O+1);U=(ue??-1)==42}else U=!0}else U=!1;if(U)return null;let K=0,G=O;for(;;){let se;if(G>0){let ue=p.cca(this.input,G-1);if((ue??-1)!=32){let oe=p.cca(this.input,G-1);se=(oe??-1)==9}else se=!0}else se=!1;if(!se)break;++K,--G}let Y=h!=-1?h:this.column-1;if(K!=Y)return null;let $;if(M==45&&O+1<this.length){let se=p.cca(this.input,O+1);$=(se??-1)==62}else $=!1;if($||M==43||this.isAssignStart(O,!1)||this.isCallStart(O)||this.isLabelStart(O)||this.isIfStart(O)||this.isIdentifierExpressionStart(O,!0))return null;if(M>=97&&M<=122||M>=65&&M<=90||M==95){let se=O;for(;;){let me;if(se<this.length){let de=p.cca(this.input,se),Oe=de??-1;me=Oe>=97&&Oe<=122||Oe>=65&&Oe<=90||Oe==95||Oe>=48&&Oe<=57}else me=!1;if(!me)break;++se}let ue=this.input,oe=se-O,ge=oe!=null?p.substr(ue,O,oe):p.substr(ue,O,null);if(ge!="null"&&ge!="true"&&ge!="false"&&Object.prototype.hasOwnProperty.call(yt.KEYWORDS.h,ge))return null}}else if(!L)return null}let f=new he(this.startLine,this.startColumn,this.pos),m="",g=[],w=this.line,y=this.column,T=this.pos,E=!1,C=-1,P=!1,I=this.column,v=this.line,F=!0,B=!1;for(;this.pos<this.length;){let A=p.cca(this.input,this.pos),L=A??-1,z=L==32||L==9;if(B||!z&&C==-1&&(L!=60||!c)&&(B=!0),E){m+=String.fromCodePoint(92),m+=String.fromCodePoint(L),E=!1;let D=0,O=1;for(;D<O;){let q=D++;if(this.pos>=this.length)break;let M=p.cca(this.input,this.pos);(M??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}I+=2}else if(L==92){E=!0;let D=0,O=1;for(;D<O;){let q=D++;if(this.pos>=this.length)break;let M=p.cca(this.input,this.pos);(M??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else if(C==-1&&z&&!B&&g.length==0){let D=0,O=1;for(;D<O;){let q=D++;if(this.pos>=this.length)break;let M=p.cca(this.input,this.pos);(M??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else{if(C==-1&&L==123)break;{let D;if(C==-1)if(L==10||L==13)D=!0;else if(L==47&&this.pos<this.length-1){let O=p.cca(this.input,this.pos+1);D=(O??-1)==47}else D=!1;else D=!1;if(D)if(h!=-1)if(this.isContinuingMultilineText(this.pos,h)){m+=String.fromCodePoint(L);let O=0,q=1;for(;O<q;){let U=O++;if(this.pos>=this.length)break;let K=p.cca(this.input,this.pos);(K??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let M;if(L==13){let U=p.cca(this.input,this.pos);M=(U??-1)==10}else M=!1;if(M){m+=String.fromCodePoint(10);let U=0,K=1;for(;U<K;){let G=U++;if(this.pos>=this.length)break;let Y=p.cca(this.input,this.pos);(Y??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}I=this.column,v=this.line}else break;else break;else{let O;if(C==-1)if(L==47&&this.pos<this.length-1){let q=p.cca(this.input,this.pos+1);O=(q??-1)==42}else O=!1;else O=!1;if(O){m+=String.fromCodePoint(47),m+=String.fromCodePoint(42);let q=2;q==null&&(q=1);let M=0,U=q;for(;M<U;){let G=M++;if(this.pos>=this.length)break;let Y=p.cca(this.input,this.pos);(Y??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let K=!1;for(;this.pos<this.length;){let G,Y=p.cca(this.input,this.pos);if((Y??-1)==42&&this.pos+1<this.length){let ge=p.cca(this.input,this.pos+1);G=(ge??-1)==47}else G=!1;if(G){m+=String.fromCodePoint(42),m+=String.fromCodePoint(47);let ge=2;ge==null&&(ge=1);let me=0,de=ge;for(;me<de;){let Oe=me++;if(this.pos>=this.length)break;let Ve=p.cca(this.input,this.pos);(Ve??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}K=!0;break}let $=p.cca(this.input,this.pos),se=$??-1;m+=String.fromCodePoint(se);let ue=0,oe=1;for(;ue<oe;){let ge=ue++;if(this.pos>=this.length)break;let me=p.cca(this.input,this.pos);(me??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}I=this.column,v=this.line,K||this.error("Unterminated multiline comment",!1)}else{if(C==-1&&!o&&this.isIfStart(this.pos))break;{let q;if(C==-1&&L==45&&this.pos<this.length-1){let M=p.cca(this.input,this.pos+1);q=(M??-1)==62}else q=!1;if(q&&this.isTransitionStart(this.pos))break;if(C==-1&&o&&(L==44||L==93||L==125))break;if(c&&L==60){C!=-1&&this.error("Unexpected < inside tag",!0);let M;if(this.pos+1<this.length){let Y=p.cca(this.input,this.pos+1);M=Y??-1}else M=0;P=M==47;let U=this.pos+(P?2:1);if(U<this.length){let Y=p.cca(this.input,U),$=Y??-1;($>=97&&$<=122||$>=65&&$<=90||$==95||$==95||$==36||P&&$==62)&&(C=m.length)}m+=String.fromCodePoint(L);let K=0,G=1;for(;K<G;){let Y=K++;if(this.pos>=this.length)break;let $=p.cca(this.input,this.pos);($??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++I}else if(c&&L==62){m+=String.fromCodePoint(L);let M=0,U=1;for(;M<U;){let K=M++;if(this.pos>=this.length)break;let G=p.cca(this.input,this.pos);(G??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++I,C!=-1&&(g.push(Pi.Tag(P,C,m.length-C)),C=-1)}else if(C==-1&&L==35&&!E){let M;if(this.pos+1<this.length){let U=p.cca(this.input,this.pos+1);M=U??-1}else M=0;if(M==35){m+=String.fromCodePoint(35),m+=String.fromCodePoint(35);let U=0,K=1;for(;U<K;){let $=U++;if(this.pos>=this.length)break;let se=p.cca(this.input,this.pos);(se??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let G=0,Y=1;for(;G<Y;){let $=G++;if(this.pos>=this.length)break;let se=p.cca(this.input,this.pos);(se??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}I+=2}else{if(M>=97&&M<=122||M>=65&&M<=90||M==95||M>=48&&M<=57||M==45)break;{m+=String.fromCodePoint(L);let U=0,K=1;for(;U<K;){let G=U++;if(this.pos>=this.length)break;let Y=p.cca(this.input,this.pos);(Y??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++I}}}else if(L==36&&!E){let M=m.length,U=v,K=I,G=this.pos;try{let Y=0,$=1;for(;Y<$;){let ue=Y++;if(this.pos>=this.length)break;let oe=p.cca(this.input,this.pos);(oe??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++I;let se=p.cca(this.input,this.pos);if((se??-1)==123){let ue=0,oe=1;for(;ue<oe;){let Ve=ue++;if(this.pos>=this.length)break;let je=p.cca(this.input,this.pos);(je??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++I;let ge=new he(U,K+2,this.pos),me=this.readComplexInterpolation(ge),de=this.pos-G;g.push(Pi.Interpolation(!0,C!=-1,me,M,de));let Oe=this.input;m+=le.string(de!=null?p.substr(Oe,G,de):p.substr(Oe,G,null))}else{let ue=p.cca(this.input,this.pos),oe=ue??-1;if(oe>=97&&oe<=122||oe>=65&&oe<=90||oe==95){let ge=new he(U,K+1,this.pos),me=this.readFieldAccessInterpolation(ge),de=this.pos-G;g.push(Pi.Interpolation(!1,C!=-1,me,M,de));let Oe=this.input;m+=le.string(de!=null?p.substr(Oe,G,de):p.substr(Oe,G,null))}else{let ge=p.cca(this.input,this.pos);if((ge??-1)==36){m+=String.fromCodePoint(36),m+=String.fromCodePoint(36);let me=0,de=1;for(;me<de;){let Oe=me++;if(this.pos>=this.length)break;let Ve=p.cca(this.input,this.pos);(Ve??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++I}else{this.error("Expected identifier or { after $",!1);let me=this.pos-G;g.push(Pi.Interpolation(!1,C!=-1,[],M,me));let de=this.input;m+=le.string(me!=null?p.substr(de,G,me):p.substr(de,G,null))}}}}catch(Y){let $=b.caught(Y).unwrap();if($ instanceof ll){let se=$;throw se.pos==null&&(se.pos=new he(U,K,this.pos)),b.thrown(se)}else throw Y}I=K+(this.pos-G)}else{L==10?(++v,I=1):++I,m+=String.fromCodePoint(L);let M=0,U=1;for(;M<U;){let K=M++;if(this.pos>=this.length)break;let G=p.cca(this.input,this.pos);(G??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}}}}}}if(F){let A=m,L=A.length;A=Ae.rtrim(A);let z=A.length,D=L-z;if(z>0&&this.hasNonSpecialChar(A)&&(!o||!this.isNumber(A)&&A!="null"&&A!="true"&&A!="false")){if(h==-1&&!a&&!this.inChoiceRoot()){let K=this.line,G=this.column,Y=this.pos,$=!0;$==null&&($=!1);let se=$;se==null&&(se=!1);let ue=this._skipWhitespaceAndComments(this.pos,se);for(;this.pos<ue;){let ge=0,me=1;for(;ge<me;){let de=ge++;if(this.pos>=this.length)break;let Oe=p.cca(this.input,this.pos);(Oe??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let oe=this.pos;if(this.column==y){let ge=this.tryReadUnquotedString();if(ge!=null){let me=this.input,de=Y-D,Oe=oe!=null?me.substring(de,oe):me.substring(de),Ve=ge.type;if(Ve._hx_index==15){let et=Ve.quotes,Ue=Ve.s,Ge=Ve.attachments;if(Ge!=null){let nt=0;for(;nt<Ge.length;){let De=Ge[nt];switch(++nt,De._hx_index){case 0:let H=De.braces,ie=De.inTag,R=De.expr,ee=De.start,X=De.length;g.push(Pi.Interpolation(H,ie,R,ee+oe-T,X));break;case 1:let Q=De.closing,ae=De.start,_e=De.length;g.push(Pi.Tag(Q,ae+oe-T,_e));break}}}A+=Oe,A+=Ue}D=0;let je=this.pos-1;for(;;){let et;if(je>=0){let Ue=p.cca(this.input,je);if((Ue??-1)!=32){let Ge=p.cca(this.input,je);et=(Ge??-1)==9}else et=!0}else et=!1;if(!et)break;++D,--je}}else this.line=K,this.column=G,this.pos=Y}else this.line=K,this.column=G,this.pos=Y}g.sort(function(K,G){return yt.compareAttachments(K,G)});let O=g.length>0?g:null,q=f;q==null&&(q=new he(this.startLine,this.startColumn,this.pos)),q.length=this.pos-q.offset;let M=new ke(x.LString(0,A,O),q);this.previous=M;let U=M;return U.pos.length-=D,U}}return this.line=w,this.column=y,this.pos=T,null}readString(e){let t=0,i=1;for(;t<i;){let c=t++;if(this.pos>=this.length)break;let _=p.cca(this.input,this.pos);(_??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let l="",n=[],s=!1,r=-1,h=!1,a=e.column+1,o=e.line,u=this.parentBlockType()==x.KwBeat;for(;this.pos<this.length;){let c=p.cca(this.input,this.pos),_=c??-1;if(s){l+=String.fromCodePoint(92),l+=String.fromCodePoint(_),s=!1;let f=0,m=1;for(;f<m;){let g=f++;if(this.pos>=this.length)break;let w=p.cca(this.input,this.pos);(w??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}a+=2}else if(_==92){s=!0;let f=0,m=1;for(;f<m;){let g=f++;if(this.pos>=this.length)break;let w=p.cca(this.input,this.pos);(w??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else if(_==34&&r==-1){let f=0,m=1;for(;f<m;){let T=f++;if(this.pos>=this.length)break;let E=p.cca(this.input,this.pos);(E??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}n.sort(function(T,E){return yt.compareAttachments(T,E)});let g=n.length>0?n:null,w=e;w==null&&(w=new he(this.startLine,this.startColumn,this.pos)),w.length=this.pos-w.offset;let y=new ke(x.LString(1,l,g),w);return this.previous=y,y}else if(u&&_==60){r!=-1&&this.error("Unexpected < inside tag",!0);let f;if(this.pos+1<this.length){let y=p.cca(this.input,this.pos+1);f=y??-1}else f=0;h=f==47;let m=this.pos+(h?2:1);if(m<this.length){let y=p.cca(this.input,m),T=y??-1;(T>=97&&T<=122||T>=65&&T<=90||T==95||T==95||T==36||h&&T==62)&&(r=l.length)}l+=String.fromCodePoint(_);let g=0,w=1;for(;g<w;){let y=g++;if(this.pos>=this.length)break;let T=p.cca(this.input,this.pos);(T??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++a}else if(_==62){l+=String.fromCodePoint(_);let f=0,m=1;for(;f<m;){let g=f++;if(this.pos>=this.length)break;let w=p.cca(this.input,this.pos);(w??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++a,r!=-1&&(n.push(Pi.Tag(h,r,l.length-r)),r=-1)}else if(_==36&&!s){let f=l.length,m=o,g=a,w=this.pos;try{let y=0,T=1;for(;y<T;){let C=y++;if(this.pos>=this.length)break;let P=p.cca(this.input,this.pos);(P??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++a;let E=p.cca(this.input,this.pos);if((E??-1)==123){let C=0,P=1;for(;C<P;){let A=C++;if(this.pos>=this.length)break;let L=p.cca(this.input,this.pos);(L??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++a;let I=new he(m,g+2,this.pos),v=this.readComplexInterpolation(I),F=this.pos-w;n.push(Pi.Interpolation(!0,r!=-1,v,f,F));let B=this.input;l+=le.string(F!=null?p.substr(B,w,F):p.substr(B,w,null))}else{let C=p.cca(this.input,this.pos),P=C??-1;if(P>=97&&P<=122||P>=65&&P<=90||P==95){let I=new he(m,g+1,this.pos),v=this.readFieldAccessInterpolation(I),F=this.pos-w;n.push(Pi.Interpolation(!1,r!=-1,v,f,F));let B=this.input;l+=le.string(F!=null?p.substr(B,w,F):p.substr(B,w,null))}else{let I=p.cca(this.input,this.pos);if((I??-1)==36){l+=String.fromCodePoint(36),l+=String.fromCodePoint(36);let v=0,F=1;for(;v<F;){let B=v++;if(this.pos>=this.length)break;let A=p.cca(this.input,this.pos);(A??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++a}else{this.error("Expected identifier or { after $",!1);let v=this.pos-w;n.push(Pi.Interpolation(!1,r!=-1,[],f,v));let F=this.input;l+=le.string(v!=null?p.substr(F,w,v):p.substr(F,w,null))}}}}catch(y){let T=b.caught(y).unwrap();if(T instanceof ll){let E=T;throw E.pos==null&&(E.pos=new he(m,g,this.pos)),b.thrown(E)}else throw y}a=g+(this.pos-w)}else{_==10?(++o,a=1):++a,l+=String.fromCodePoint(_);let f=0,m=1;for(;f<m;){let g=f++;if(this.pos>=this.length)break;let w=p.cca(this.input,this.pos);(w??-1)==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,l=e.column,n=e.line;for(;this.pos<this.length&&i>0;){let s=p.cca(this.input,this.pos);if((s??-1)==34){let h=new he(n,l,this.pos);t.push(this.readString(h)),l+=this.pos-h.offset;continue}let r=this.nextToken();if(t.push(r),r.type==x.LineBreak)++n,l=1;else if(!(r.type==x.Indent||r.type==x.Unindent)){let h,a=r.type;switch(a._hx_index){case 15:let o=a.attachments,u=a.quotes;h=a.s.length+(u!=0?2:0);break;case 16:let _=a.n;h=(_==null?"null":""+_).length;break;case 19:h=a.name.length;break;default:h=1}l+=h}switch(r.type._hx_index){case 45:++i;break;case 46:--i;break;default:}r.type==x.Eof&&this.error("Unterminated interpolation expression",!0)}return t.pop(),this.strictExprs.pop(),t}nextTokenWithPosition(e){let t=this.line,i=this.column,l=this.pos,n=this.nextToken(),s=n.pos.length,r=this.pos-l;return n.pos=new he(e.line,e.column+r,e.offset+r,s),this.line=t,this.column=i,n}readFieldAccessInterpolation(e){this.strictExprs.push(1);let t=[],i=p.cca(this.input,this.pos),l=i??-1;l>=97&&l<=122||l>=65&&l<=90||l==95||this.error("Expected identifier in field access",!0);let n=this.pos;for(;this.pos<this.length;){let o=p.cca(this.input,this.pos),u=o??-1;if(!(u>=97&&u<=122||u>=65&&u<=90||u==95||u>=48&&u<=57))break;let c=0,_=1;for(;c<_;){let f=c++;if(this.pos>=this.length)break;let m=p.cca(this.input,this.pos);(m??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let s=this.input,r=this.pos-n,h=r!=null?p.substr(s,n,r):p.substr(s,n,null),a=Object.prototype.hasOwnProperty.call(yt.KEYWORDS.h,h)?yt.KEYWORDS.h[h]:x.Identifier(h);t.push(new ke(a,new he(e.line,e.column,n,this.pos-n)));e:for(;this.pos<this.length;){let o=p.cca(this.input,this.pos);switch(o??-1){case 40:t.push(new ke(x.LParen,new he(this.line,this.column,this.pos,1)));let u=0,c=1;for(;u<c;){let y=u++;if(this.pos>=this.length)break;let T=p.cca(this.input,this.pos);(T??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.stack.push(10),this.strictExprs.push(1);let _=1;for(;this.pos<this.length&&_>0;){let y=p.cca(this.input,this.pos);if((y??-1)==41){if(--_,_==0){t.push(new ke(x.RParen,new he(this.line,this.column,this.pos,1)));let E=0,C=1;for(;E<C;){let P=E++;if(this.pos>=this.length)break;let I=p.cca(this.input,this.pos);(I??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.stack.pop(),this.strictExprs.pop();break}}else{let E=p.cca(this.input,this.pos);(E??-1)==40&&++_}let T=p.cca(this.input,this.pos);if((T??-1)==44){t.push(new ke(x.Comma,new he(this.line,this.column,this.pos,1)));let E=0,C=1;for(;E<C;){let P=E++;if(this.pos>=this.length)break;let I=p.cca(this.input,this.pos);(I??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else t.push(this.nextToken())}_>0&&this.error("Unterminated function call in interpolation",!0);break;case 46:let f;if(this.pos+1<this.length){let y=p.cca(this.input,this.pos+1),T=y??-1;f=T>=97&&T<=122||T>=65&&T<=90||T==95}else f=!1;if(f){t.push(new ke(x.Dot,new he(this.line,this.column,this.pos,1)));let y=0,T=1;for(;y<T;){let F=y++;if(this.pos>=this.length)break;let B=p.cca(this.input,this.pos);(B??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let E=this.pos;for(;this.pos<this.length;){let F=p.cca(this.input,this.pos),B=F??-1;if(!(B>=97&&B<=122||B>=65&&B<=90||B==95||B>=48&&B<=57))break;let A=0,L=1;for(;A<L;){let z=A++;if(this.pos>=this.length)break;let D=p.cca(this.input,this.pos);(D??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let C=this.input,P=this.pos-E,I=P!=null?p.substr(C,E,P):p.substr(C,E,null),v=Object.prototype.hasOwnProperty.call(yt.KEYWORDS.h,I)?yt.KEYWORDS.h[I]:x.Identifier(I);t.push(new ke(v,new he(this.line,this.column-(this.pos-E),E)))}else break e;break;case 91:t.push(new ke(x.LBracket,new he(this.line,this.column,this.pos,1)));let m=0,g=1;for(;m<g;){let y=m++;if(this.pos>=this.length)break;let T=p.cca(this.input,this.pos);(T??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.stack.push(12),this.strictExprs.push(1);let w=1;for(;this.pos<this.length&&w>0;){let y=p.cca(this.input,this.pos);if((y??-1)==93){if(--w,w==0){t.push(new ke(x.RBracket,new he(this.line,this.column,this.pos,1)));let T=0,E=1;for(;T<E;){let C=T++;if(this.pos>=this.length)break;let P=p.cca(this.input,this.pos);(P??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.stack.pop(),this.strictExprs.pop();break}}else{let T=p.cca(this.input,this.pos);(T??-1)==91&&++w}t.push(this.nextToken())}w>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=p.cca(this.input,this.pos),a=h??-1;if(!(a>=97&&a<=122||a>=65&&a<=90||a==95||a>=48&&a<=57))break;let o=0,u=1;for(;o<u;){let c=o++;if(this.pos>=this.length)break;let _=p.cca(this.input,this.pos);(_??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let l=this.input,n=this.pos-i,s=n!=null?p.substr(l,i,n):p.substr(l,i,null),r=Object.prototype.hasOwnProperty.call(yt.KEYWORDS.h,s)?yt.KEYWORDS.h[s]:x.Identifier(s);return new ke(r,t)}makePositionRelativeTo(e){let t=e.line,i=e.column,l=e.offset;for(;l<this.pos;){let n=p.cca(this.input,l);(n??-1)==10?(++t,i=1):++i,++l}return new he(t,i,this.pos,e.length)}readLineComment(){let e=new he(this.startLine,this.startColumn,this.pos),t=2;t==null&&(t=1);let i=0,l=t;for(;i<l;){let u=i++;if(this.pos>=this.length)break;let c=p.cca(this.input,this.pos);(c??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let n=this.pos;for(;this.pos<this.length;){let u=p.cca(this.input,this.pos),c=u??-1;if(c==10||c==13)break;let _=0,f=1;for(;_<f;){let m=_++;if(this.pos>=this.length)break;let g=p.cca(this.input,this.pos);(g??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let s=this.input,r=this.pos-n,h=r!=null?p.substr(s,n,r):p.substr(s,n,null),a=e;a==null&&(a=new he(this.startLine,this.startColumn,this.pos)),a.length=this.pos-a.offset;let o=new ke(x.CommentLine(h),a);return this.previous=o,o}readMultiLineComment(){let e=new he(this.startLine,this.startColumn,this.pos),t=2;t==null&&(t=1);let i=0,l=t;for(;i<l;){let r=i++;if(this.pos>=this.length)break;let h=p.cca(this.input,this.pos);(h??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let n=this.pos,s=1;for(;this.pos<this.length&&s>0;){let r,h=p.cca(this.input,this.pos);if((h??-1)==42){let a;if(this.pos+1<this.length){let o=p.cca(this.input,this.pos+1);a=o??-1}else a=0;r=a==47}else r=!1;if(r){if(--s,s==0){let c=this.input,_=this.pos-n,f=_!=null?p.substr(c,n,_):p.substr(c,n,null),m=2;m==null&&(m=1);let g=0,w=m;for(;g<w;){let E=g++;if(this.pos>=this.length)break;let C=p.cca(this.input,this.pos);(C??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let y=e;y==null&&(y=new he(this.startLine,this.startColumn,this.pos)),y.length=this.pos-y.offset;let T=new ke(x.CommentMultiLine(f),y);return this.previous=T,T}let a=2;a==null&&(a=1);let o=0,u=a;for(;o<u;){let c=o++;if(this.pos>=this.length)break;let _=p.cca(this.input,this.pos);(_??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else{let a,o=p.cca(this.input,this.pos);if((o??-1)==47){let u;if(this.pos+1<this.length){let c=p.cca(this.input,this.pos+1);u=c??-1}else u=0;a=u==42}else a=!1;if(a){++s;let u=2;u==null&&(u=1);let c=0,_=u;for(;c<_;){let f=c++;if(this.pos>=this.length)break;let m=p.cca(this.input,this.pos);(m??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else{let u=0,c=1;for(;u<c;){let _=u++;if(this.pos>=this.length)break;let f=p.cca(this.input,this.pos);(f??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}}return this.error("Unterminated multi-line comment",!0),null}readHashComment(){let e=new he(this.startLine,this.startColumn,this.pos),t=0,i=1;for(;t<i;){let o=t++;if(this.pos>=this.length)break;let u=p.cca(this.input,this.pos);(u??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let l=this.pos;for(;this.pos<this.length;){let o=p.cca(this.input,this.pos),u=o??-1;if(u>=97&&u<=122||u>=65&&u<=90||u==95||u>=48&&u<=57||u==45){let c=0,_=1;for(;c<_;){let f=c++;if(this.pos>=this.length)break;let m=p.cca(this.input,this.pos);(m??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else break}let n=this.input,s=this.pos-l,r=s!=null?p.substr(n,l,s):p.substr(n,l,null),h=e;h==null&&(h=new he(this.startLine,this.startColumn,this.pos)),h.length=this.pos-h.offset;let a=new ke(x.CommentHash(r),h);return this.previous=a,a}readNumber(){let e=new he(this.startLine,this.startColumn,this.pos),t=this.pos;for(;;){let u;if(this.pos<this.length){let f=p.cca(this.input,this.pos),m=f??-1;u=m>=48&&m<=57}else u=!1;if(!u)break;let c=0,_=1;for(;c<_;){let f=c++;if(this.pos>=this.length)break;let m=p.cca(this.input,this.pos);(m??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let i,l;if(this.pos<this.length){let u=p.cca(this.input,this.pos);l=(u??-1)==46}else l=!1;if(l&&this.pos+1<this.length){let u=p.cca(this.input,this.pos+1),c=u??-1;i=c>=48&&c<=57}else i=!1;if(i){let u=0,c=1;for(;u<c;){let _=u++;if(this.pos>=this.length)break;let f=p.cca(this.input,this.pos);(f??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}for(;;){let _;if(this.pos<this.length){let g=p.cca(this.input,this.pos),w=g??-1;_=w>=48&&w<=57}else _=!1;if(!_)break;let f=0,m=1;for(;f<m;){let g=f++;if(this.pos>=this.length)break;let w=p.cca(this.input,this.pos);(w??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}let n=this.input,s=this.pos-t,r=x.LNumber(parseFloat(s!=null?p.substr(n,t,s):p.substr(n,t,null))),h=e;h==null&&(h=new he(this.startLine,this.startColumn,this.pos)),h.length=this.pos-h.offset;let a=new ke(r,h);return this.previous=a,a}readIdentifier(){let e=new he(this.startLine,this.startColumn,this.pos),t=this.pos;for(;this.pos<this.length;){let a=p.cca(this.input,this.pos),o=a??-1;if(!(o>=97&&o<=122||o>=65&&o<=90||o==95||o>=48&&o<=57))break;let u=0,c=1;for(;u<c;){let _=u++;if(this.pos>=this.length)break;let f=p.cca(this.input,this.pos);(f??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let i=this.input,l=this.pos-t,n=l!=null?p.substr(i,t,l):p.substr(i,t,null);if(n=="function")return this.readFunction(e);let s=Object.prototype.hasOwnProperty.call(yt.KEYWORDS.h,n)?yt.KEYWORDS.h[n]:x.Identifier(n);if(this.previous!=null&&this.previous.type==x.Dot&&s!=null)switch(s._hx_index){case 8:case 9:case 10:case 11:case 12:s=x.Identifier(n);break;default:}let r=e;r==null&&(r=new he(this.startLine,this.startColumn,this.pos)),r.length=this.pos-r.offset;let h=new ke(s,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 O=0,q=1;for(;O<q;){let M=O++;if(this.pos>=this.length)break;let U=p.cca(this.input,this.pos);(U??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let l=e.column,n=null,s=p.cca(this.input,this.pos),r=s??-1;if(r>=97&&r<=122||r>=65&&r<=90||r==95){let O=this.pos;for(;;){let U;if(this.pos<this.length){let Y=p.cca(this.input,this.pos),$=Y??-1;U=$>=97&&$<=122||$>=65&&$<=90||$==95||$>=48&&$<=57}else U=!1;if(!U)break;let K=0,G=1;for(;K<G;){let Y=K++;if(this.pos>=this.length)break;let $=p.cca(this.input,this.pos);($??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let q=this.input,M=this.pos-O;n=M!=null?p.substr(q,O,M):p.substr(q,O,null)}let h=!1;h==null&&(h=!1);let a=this._skipWhitespaceAndComments(this.pos,h);for(;this.pos<a;){let O=0,q=1;for(;O<q;){let M=O++;if(this.pos>=this.length)break;let U=p.cca(this.input,this.pos);(U??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let o;if(this.pos<this.length){let O=p.cca(this.input,this.pos);o=(O??-1)!=40}else o=!0;o&&this.error("Expected opening parenthesis after function name",!0);let u=0,c=[],_=0,f=1;for(;_<f;){let O=_++;if(this.pos>=this.length)break;let q=p.cca(this.input,this.pos);(q??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}u=1;let m=new Xt;for(;this.pos<this.length&&u>0;){let O=p.cca(this.input,this.pos),q=O??-1;if(q==47){let M=this.pos,U=!1;U==null&&(U=!1);let K=this._skipWhitespaceAndComments(this.pos,U);for(;this.pos<K;){let G=0,Y=1;for(;G<Y;){let $=G++;if(this.pos>=this.length)break;let se=p.cca(this.input,this.pos);(se??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}if(this.pos==M){let G=0,Y=1;for(;G<Y;){let $=G++;if(this.pos>=this.length)break;let se=p.cca(this.input,this.pos);(se??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.error('Invalid character "/"',!1)}}else if(q==40){++u,m.b+=String.fromCodePoint(q);let M=0,U=1;for(;M<U;){let Y=M++;if(this.pos>=this.length)break;let $=p.cca(this.input,this.pos);($??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let K=!1;K==null&&(K=!1);let G=this._skipWhitespaceAndComments(this.pos,K);for(;this.pos<G;){let Y=0,$=1;for(;Y<$;){let se=Y++;if(this.pos>=this.length)break;let ue=p.cca(this.input,this.pos);(ue??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}else if(q==41){if(--u,u>0)m.b+=String.fromCodePoint(q);else{let Y=Ae.trim(m.b);Y.length>0&&c.push(Y)}let M=0,U=1;for(;M<U;){let Y=M++;if(this.pos>=this.length)break;let $=p.cca(this.input,this.pos);($??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let K=!1;K==null&&(K=!1);let G=this._skipWhitespaceAndComments(this.pos,K);for(;this.pos<G;){let Y=0,$=1;for(;Y<$;){let se=Y++;if(this.pos>=this.length)break;let ue=p.cca(this.input,this.pos);(ue??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}else if(q==44&&u==1){let M=Ae.trim(m.b);M.length>0&&c.push(M),m=new Xt;let U=0,K=1;for(;U<K;){let $=U++;if(this.pos>=this.length)break;let se=p.cca(this.input,this.pos);(se??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let G=!1;G==null&&(G=!1);let Y=this._skipWhitespaceAndComments(this.pos,G);for(;this.pos<Y;){let $=0,se=1;for(;$<se;){let ue=$++;if(this.pos>=this.length)break;let oe=p.cca(this.input,this.pos);(oe??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}else{m.b+=String.fromCodePoint(q);let M=0,U=1;for(;M<U;){let K=M++;if(this.pos>=this.length)break;let G=p.cca(this.input,this.pos);(G??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}u>0&&this.error("Unclosed parentheses in function declaration",!1);let g=!1;g==null&&(g=!1);let w=this._skipWhitespaceAndComments(this.pos,g);for(;this.pos<w;){let O=0,q=1;for(;O<q;){let M=O++;if(this.pos>=this.length)break;let U=p.cca(this.input,this.pos);(U??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let y;if(this.pos<this.length){let O=p.cca(this.input,this.pos);y=(O??-1)==123}else y=!1;let T=this.pos,E=this.line,C=this.column;if(y){let O=0,q=1;for(;O<q;){let U=O++;if(this.pos>=this.length)break;let K=p.cca(this.input,this.pos);(K??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let M=1;for(;this.pos<this.length&&M>0;){let U=p.cca(this.input,this.pos),K=U??-1;if(K==34){let $=0,se=1;for(;$<se;){let ue=$++;if(this.pos>=this.length)break;let oe=p.cca(this.input,this.pos);(oe??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.skipQuotedString();continue}K==123?++M:K==125&&--M;let G=0,Y=1;for(;G<Y;){let $=G++;if(this.pos>=this.length)break;let se=p.cca(this.input,this.pos);(se??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}M>0&&this.error("Unclosed braces in function body",!1)}else{let O=-1,q=!0;for(;this.pos<this.length;){let M=p.cca(this.input,this.pos),U=M??-1;if(U==10||U==13){T=this.pos,E=this.line,C=this.column;let Y=0,$=1;for(;Y<$;){let se=Y++;if(this.pos>=this.length)break;let ue=p.cca(this.input,this.pos);(ue??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}q=!0;break}let K=0,G=1;for(;K<G;){let Y=K++;if(this.pos>=this.length)break;let $=p.cca(this.input,this.pos);($??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}for(;this.pos<this.length;){if(q){let Y=0,$=this.pos;for(;this.pos<this.length;){let oe=p.cca(this.input,this.pos),ge=oe??-1;if(ge==32)++Y;else if(ge==9)++Y;else break;let me=0,de=1;for(;me<de;){let Oe=me++;if(this.pos>=this.length)break;let Ve=p.cca(this.input,this.pos);(Ve??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let se,ue;if(O==-1&&this.pos<this.length){let oe=p.cca(this.input,this.pos);ue=(oe??-1)!=10}else ue=!1;if(ue){let oe=p.cca(this.input,this.pos);se=(oe??-1)!=13}else se=!1;if(se){if(O=Y,O<l){this.pos=$;break}}else{let oe;if(O!=-1&&Y<O)if(this.pos<this.length){let ge=p.cca(this.input,this.pos);if((ge??-1)!=10){let me=p.cca(this.input,this.pos);oe=(me??-1)!=13}else oe=!1}else oe=!0;else oe=!1;if(oe){this.pos=$;break}}q=!1}let M=p.cca(this.input,this.pos),U=M??-1;if(U==34){this.skipQuotedString();continue}(U==10||U==13)&&(T=this.pos,E=this.line,C=this.column,q=!0);let K=0,G=1;for(;K<G;){let Y=K++;if(this.pos>=this.length)break;let $=p.cca(this.input,this.pos);($??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}this.pos=T,this.line=E,this.column=C;let P=this.pos,I=this.input,v=e.offset,F=P-e.offset,B=Ae.rtrim(F!=null?p.substr(I,v,F):p.substr(I,v,null)),A=B.indexOf(`
38
38
  `,null)==-1;A||(B+=`
39
39
  `);let L=e;L==null&&(L=new he(this.startLine,this.startColumn,this.pos)),L.length=this.pos-L.offset;let z=new ke(x.Function(n,c,B,A),L);this.previous=z;let D=z;return D.pos.length=B.length,D}skipQuotedString(){let e=!1,t=0,i=1;for(;t<i;){let l=t++;if(this.pos>=this.length)break;let n=p.cca(this.input,this.pos);(n??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}for(;this.pos<this.length;){let l=p.cca(this.input,this.pos),n=l??-1;if(e){e=!1;let s=0,r=1;for(;s<r;){let h=s++;if(this.pos>=this.length)break;let a=p.cca(this.input,this.pos);(a??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else if(n==92){e=!0;let s=0,r=1;for(;s<r;){let h=s++;if(this.pos>=this.length)break;let a=p.cca(this.input,this.pos);(a??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else if(n==34){let s=0,r=1;for(;s<r;){let h=s++;if(this.pos>=this.length)break;let a=p.cca(this.input,this.pos);(a??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}break}else if(n==36&&this.pos+1<this.length){let s=0,r=1;for(;s<r;){let a=s++;if(this.pos>=this.length)break;let o=p.cca(this.input,this.pos);(o??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let h;if(this.pos<this.length){let a=p.cca(this.input,this.pos);h=(a??-1)==123}else h=!1;if(h){let a=0,o=1;for(;a<o;){let c=a++;if(this.pos>=this.length)break;let _=p.cca(this.input,this.pos);(_??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let u=1;for(;this.pos<this.length&&u>0;){let c=p.cca(this.input,this.pos),_=c??-1;if(_==34){this.skipQuotedString();continue}else _==123?++u:_==125&&--u;if(u>0||_!=125){let f=0,m=1;for(;f<m;){let g=f++;if(this.pos>=this.length)break;let w=p.cca(this.input,this.pos);(w??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else{let f=0,m=1;for(;f<m;){let g=f++;if(this.pos>=this.length)break;let w=p.cca(this.input,this.pos);(w??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}break}}}else{let a=p.cca(this.input,this.pos),o=a??-1;if(o>=97&&o<=122||o>=65&&o<=90||o==95)for(;;){let u;if(this.pos<this.length){let f=p.cca(this.input,this.pos),m=f??-1;u=m>=97&&m<=122||m>=65&&m<=90||m==95||m>=48&&m<=57}else u=!1;if(!u)break;let c=0,_=1;for(;c<_;){let f=c++;if(this.pos>=this.length)break;let m=p.cca(this.input,this.pos);(m??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}}else{let s=0,r=1;for(;s<r;){let h=s++;if(this.pos>=this.length)break;let a=p.cca(this.input,this.pos);(a??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}}makePosition(){return new he(this.startLine,this.startColumn,this.pos)}makeToken(e,t){t==null&&(t=new he(this.startLine,this.startColumn,this.pos)),t.length=this.pos-t.offset;let i=new ke(e,t);return this.previous=i,i}advance(e){e==null&&(e=1);let t=0,i=e;for(;t<i;){let l=t++;if(this.pos>=this.length)break;let n=p.cca(this.input,this.pos);(n??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}peek(e){if(e==null&&(e=1),this.pos+e<this.length){let t=p.cca(this.input,this.pos+e);return t??-1}else return 0}error(e,t){let i=new ll(e,new he(this.startLine,this.startColumn,this.pos));if(this.errors==null&&(this.errors=[]),this.errors.push(i),t)throw b.thrown(i);return i}getErrors(){return this.errors==null&&(this.errors=[]),this.errors}skipWhitespace(){for(;this.pos<this.length;){let e=p.cca(this.input,this.pos);switch(e??-1){case 9:case 32:let t=0,i=1;for(;t<i;){let l=t++;if(this.pos>=this.length)break;let n=p.cca(this.input,this.pos);(n??-1)==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,s=e.inTag,r=e.expr,h=e.length;i=e.start;break;case 1:let o=e.closing,u=e.length;i=e.start;break}let l;switch(t._hx_index){case 0:let n=t.braces,s=t.inTag,r=t.expr,h=t.length;l=t.start;break;case 1:let o=t.closing,u=t.length;l=t.start;break}return i-l}}j["loreline.Lexer"]=yt,yt.__name__="loreline.Lexer",Object.assign(yt.prototype,{__class__:yt});class pn{static parse(e,t,i,l){let n=new yt(e),s=n.tokenize(),r=n.getErrors();if(r!=null&&r.length>0)throw b.thrown(r[0]);let h=null;if(t!=null&&i!=null)return new Dl().resolve(t,s,i,function(c){throw b.thrown(c)},function(c,_){let f=new qi(s,new El(t,t,_,null));h=f.parse(),h.indentSize=n.detectedIndentSize;let m=f.getErrors();if(m!=null&&m.length>0)throw b.thrown(m[0]);l?.(h)}),h;let a=new qi(s);h=a.parse(),h.indentSize=n.detectedIndentSize;let o=a.getErrors();if(o!=null&&o.length>0)throw b.thrown(o[0]);return l?.(h),h}static play(e,t,i,l,n,s){let r=new bl(e,t,i,l,s);return r.start(n),r}static resume(e,t,i,l,n,s,r){let h=new bl(e,t,i,l,r);return h.restore(n),s!=null?h.start(s):h.resume(),h}static extractTranslations(e){return Mt.extractTranslations(e)}static print(e,t,i){let l=t,n=i;return new nl(l??" ",n??`
40
- `).print(e)}static update(e){Hi.update(e)}}j["loreline.Loreline"]=Yi.loreline.Loreline=pn,pn.__name__="loreline.Loreline";class Re{constructor(e,t,i,l){if(e<0||e>65535)throw b.thrown("Section value ("+e+") should be between 0 and 65535");if(t<0||t>65535)throw b.thrown("Branch value ("+t+") should be between 0 and 65535");if(i<0||i>65535)throw b.thrown("Block value ("+i+") should be between 0 and 65535");if(l<0||l>65535)throw b.thrown("Node value ("+l+") should be between 0 and 65535");let n=e-32768,s=t-32768;n<0&&(n=n+65536&65535),s<0&&(s=s+65536&65535);let r=i-32768,h=l-32768;r<0&&(r=r+65536&65535),h<0&&(h=h+65536&65535),this.thisVal=new Di(n<<16|s&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 Di(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 Di(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 Di(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 Di(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 b.thrown("Node id section overflow");return new Re(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 Re((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,l=this.thisVal.high&65535;return new Re((i>=32768?i-65536:i)+32768,(l>=32768?l-65536:l)+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,l=this.thisVal.high&65535,n=this.thisVal.low>>16&65535;return new Re((i>=32768?i-65536:i)+32768,(l>=32768?l-65536:l)+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,l=this.thisVal.low&65535;return""+((e>=32768?e-65536:e)+32768)+"."+((t>=32768?t-65536:t)+32768)+"."+((i>=32768?i-65536:i)+32768)+"."+((l>=32768?l-65536:l)+32768)}static fromInt64(e){let t=new Re(32768,32768,32768,32768);return t.thisVal=e,t}static fromString(e){let t=e.split(".");return new Re(ne.parseInt(t[0]),ne.parseInt(t[1]),ne.parseInt(t[2]),ne.parseInt(t[3]))}static fromTwoInt32(e,t){return Re.fromInt64(new Di(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,l=t.thisVal;return i.high==l.high?i.low==l.low:!1}}j["loreline.NodeId"]=Re,Re.__name__="loreline.NodeId",Object.assign(Re.prototype,{__class__:Re,__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 Gi{constructor(){this.map=new wi}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 Hl(this.map)}keys(){return new jl(this.map)}keyValueIterator(){return new Jl(this.map)}}j["loreline.NodeIdMap"]=Gi,Gi.__name__="loreline.NodeIdMap",Object.assign(Gi.prototype,{__class__:Gi});class Hl{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}}j["loreline._Node.NodeIdMapIterator"]=Hl,Hl.__name__="loreline._Node.NodeIdMapIterator",Object.assign(Hl.prototype,{__class__:Hl});class jl{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 Re.fromTwoInt32(e,t)}}j["loreline._Node.NodeIdMapKeyIterator"]=jl,jl.__name__="loreline._Node.NodeIdMapKeyIterator",Object.assign(jl.prototype,{__class__:jl});class Jl{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:Re.fromTwoInt32(e,t),value:i}}}j["loreline._Node.NodeIdMapKeyValueIterator"]=Jl,Jl.__name__="loreline._Node.NodeIdMapKeyValueIterator",Object.assign(Jl.prototype,{__class__:Jl});class Ft{constructor(e,t){Ft._hx_skip_constructor||this._hx_constructor(e,t)}_hx_constructor(e,t){this.id=Re.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){}static fromJson(e){return N.nodeFromJson(e)}}j["loreline.Node"]=Yi.loreline.Node=Ft,Ft.__name__="loreline.Node",Object.assign(Ft.prototype,{__class__:Ft});class Wi extends Ft{constructor(e,t,i,l,n){n==null&&(n=!1),super(e,t),this.content=i,this.multiline=l,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}}j["loreline.Comment"]=Wi,Wi.__name__="loreline.Comment",Wi.__super__=Ft,Object.assign(Wi.prototype,{__class__:Wi});class Le extends Ft{constructor(e,t,i,l){if(Ft._hx_skip_constructor){super();return}Ft._hx_skip_constructor=!0,super(),Ft._hx_skip_constructor=!1,this._hx_constructor(e,t,i,l)}_hx_constructor(e,t,i,l){super._hx_constructor(e,t),this.leadingComments=i,this.trailingComments=l}type(){return"AstNode"}eachComment(e){if(this.leadingComments!=null){let i=0,l=this.leadingComments;for(;i<l.length;){let n=l[i];++i,e(this,n)}}if(this.trailingComments!=null){let i=0,l=this.trailingComments;for(;i<l.length;){let n=l[i];++i,e(this,n)}}let t=this;this.each(function(i,l){if(i instanceof Le){let n=i;if(n.leadingComments!=null){let s=0,r=n.leadingComments;for(;s<r.length;){let h=r[s];++s,e(t,h)}}if(n.trailingComments!=null){let s=0,r=n.trailingComments;for(;s<r.length;){let h=r[s];++s,e(t,h)}}}})}each(e){if(super.each(e),this.leadingComments!=null){let t=0,i=this.leadingComments;for(;t<i.length;){let l=i[t];++t,e(l,this),l.each(e)}}if(this.trailingComments!=null){let t=0,i=this.trailingComments;for(;t<i.length;){let l=i[t];++t,e(l,this),l.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=[],l=0,n=this.leadingComments;for(;l<n.length;){let s=n[l];++l,i.push(s.toJson())}t.leading=i}if(this.trailingComments!=null&&this.trailingComments.length>0){let i=[],l=0,n=this.trailingComments;for(;l<n.length;){let s=n[l];++l,i.push(s.toJson())}t.trailing=i}e.comments=t}return e}}j["loreline.AstNode"]=Le,Le.__name__="loreline.AstNode",Le.__super__=Ft,Object.assign(Le.prototype,{__class__:Le});class at extends Le{constructor(e,t,i,l){super(e,t,i,l)}toJson(){return super.toJson()}type(){return"Expr"}}j["loreline.NExpr"]=at,at.__name__="loreline.NExpr",at.__super__=Le,Object.assign(at.prototype,{__class__:at});class Wt extends Le{constructor(e,t,i,l,n,s){super(e,t,n,s),this.temporary=i,this.fields=l,this.style=0}type(){return"State"}get(e){let t=0,i=this.fields;for(;t<i.length;){let l=i[t];if(++t,l.name==e)return l.value}return null}each(e){if(super.each(e),this.fields!=null){let t=0,i=this.fields.length;for(;t<i;){let l=t++,n=this.fields[l];e(n,this),n.each(e)}}}toJson(){let e=super.toJson();e.temporary=this.temporary;let t=[],i=0,l=this.fields;for(;i<l.length;){let n=l[i];++i,t.push(n.toJson())}return e.fields=t,e.style=Bi.toString(this.style),e}}j["loreline.NStateDecl"]=Wt,Wt.__name__="loreline.NStateDecl",Wt.__super__=Le,Object.assign(Wt.prototype,{__class__:Wt});class Fi extends Le{constructor(e,t,i,l,n,s){super(e,t,n,s),this.name=i,this.value=l}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}}j["loreline.NObjectField"]=Fi,Fi.__name__="loreline.NObjectField",Fi.__super__=Le,Object.assign(Fi.prototype,{__class__:Fi});class zt extends Le{constructor(e,t,i,l,n,s,r){super(e,t,s,r),this.name=i,this.namePos=l,this.fields=n,this.style=0}type(){return"Character"}get(e){let t=0,i=this.fields;for(;t<i.length;){let l=i[t];if(++t,l.name==e)return l.value}return null}each(e){if(super.each(e),this.fields!=null){let t=0,i=this.fields.length;for(;t<i;){let l=t++,n=this.fields[l];e(n,this),n.each(e)}}}toJson(){let e=super.toJson();e.name=this.name,e.namePos=this.namePos.toJson();let t=[],i=0,l=this.fields;for(;i<l.length;){let n=l[i];++i,t.push(n.toJson())}return e.fields=t,e.style=Bi.toString(this.style),e}}j["loreline.NCharacterDecl"]=zt,zt.__name__="loreline.NCharacterDecl",zt.__super__=Le,Object.assign(zt.prototype,{__class__:zt});class Me extends Le{constructor(e,t,i,l,n,s){super(e,t,n,s),this.name=i,this.body=l,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 l=t++,n=this.body[l];e(n,this),n.each(e)}}}toJson(){let e=super.toJson();e.name=this.name;let t=[],i=0,l=this.body;for(;i<l.length;){let n=l[i];++i,t.push(n.toJson())}return e.body=t,e.style=Bi.toString(this.style),e}}j["loreline.NBeatDecl"]=Me,Me.__name__="loreline.NBeatDecl",Me.__super__=Le,Object.assign(Me.prototype,{__class__:Me});var ze=Qe["loreline.StringPartType"]={__ename__:"loreline.StringPartType",__constructs__:null,Raw:(d=function(k){return{_hx_index:0,text:k,__enum__:"loreline.StringPartType",toString:S}},d._hx_name="Raw",d.__params__=["text"],d),Expr:(d=function(k){return{_hx_index:1,expr:k,__enum__:"loreline.StringPartType",toString:S}},d._hx_name="Expr",d.__params__=["expr"],d),Tag:(d=function(k,e){return{_hx_index:2,closing:k,expr:e,__enum__:"loreline.StringPartType",toString:S}},d._hx_name="Tag",d.__params__=["closing","expr"],d)};ze.__constructs__=[ze.Raw,ze.Expr,ze.Tag];class Bi{static toString(e){switch(e){case 0:return"Plain";case 1:return"Braces"}}}class Cl{static toString(e){switch(e){case 0:return"Plain";case 2:return"Parens"}}}class Tl{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 at{constructor(e,t,i,l,n){super(e,t,l,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 l=t.expr;e(l,this),l.each(e);break;case 2:let n=t.closing,s=t.expr;e(s,this),s.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 l=t.expr;e.part="Expr",e.expression=l.toJson();break;case 2:let n=t.closing,s=t.expr;e.part="Tag",e.closing=n,e.content=s.toJson();break}return e}}j["loreline.NStringPart"]=Je,Je.__name__="loreline.NStringPart",Je.__super__=at,Object.assign(Je.prototype,{__class__:Je});class Tt extends at{constructor(e,t,i,l,n,s){super(e,t,n,s),this.parts=l,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 l=t++,n=this.parts[l];e(n,this),n.each(e)}}}toJson(){let e=super.toJson(),t=[],i=0,l=this.parts;for(;i<l.length;){let s=l[i];++i,t.push(s.toJson())}let n=t;return e.parts=n,e.quotes=nn.toString(this.quotes),e}}j["loreline.NStringLiteral"]=Tt,Tt.__name__="loreline.NStringLiteral",Tt.__super__=at,Object.assign(Tt.prototype,{__class__:Tt});class ui extends Le{constructor(e,t,i,l,n){super(e,t,l,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=Cl.toString(this.conditionStyle),e.conditionPos=this.conditionPos.toJson()),e}}j["loreline.NTextStatement"]=ui,ui.__name__="loreline.NTextStatement",ui.__super__=Le,Object.assign(ui.prototype,{__class__:ui});class ti extends Le{constructor(e,t,i,l,n,s,r){super(e,t,s,r),this.character=i,this.characterPos=l,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=Cl.toString(this.conditionStyle),e.conditionPos=this.conditionPos.toJson()),e}}j["loreline.NDialogueStatement"]=ti,ti.__name__="loreline.NDialogueStatement",ti.__super__=Le,Object.assign(ti.prototype,{__class__:ti});class mi extends Le{constructor(e,t,i,l,n){super(e,t,l,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 l=t++,n=this.options[l];e(n,this),n.each(e)}}}toJson(){let e=super.toJson(),t=[],i=0,l=this.options;for(;i<l.length;){let n=l[i];++i,t.push(n.toJson())}return e.options=t,e.style=Bi.toString(this.style),e}}j["loreline.NChoiceStatement"]=mi,mi.__name__="loreline.NChoiceStatement",mi.__super__=Le,Object.assign(mi.prototype,{__class__:mi});class Et extends Le{constructor(e,t,i,l,n,s,r,h,a){super(e,t,h,a),this.text=i,this.insertion=l,this.condition=n,this.conditionStyle=s,this.body=r,this.style=0,this.once=!1}type(){return"Option"}each(e){if(super.each(e),this.body!=null){let t=0,i=this.body.length;for(;t<i;){let l=t++,n=this.body[l];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=Cl.toString(this.conditionStyle),e.conditionPos=this.conditionPos.toJson());let t=[],i=0,l=this.body;for(;i<l.length;){let n=l[i];++i,t.push(n.toJson())}return e.body=t,e.style=Bi.toString(this.style),this.once&&(e.once=!0),e}}j["loreline.NChoiceOption"]=Et,Et.__name__="loreline.NChoiceOption",Et.__super__=Le,Object.assign(Et.prototype,{__class__:Et});class ii extends Le{constructor(e,t,i,l,n){super(e,t,l,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 l=t++,n=this.body[l];e(n,this),n.each(e)}}}toJson(){let e=super.toJson(),t=[],i=0,l=this.body;for(;i<l.length;){let n=l[i];++i,t.push(n.toJson())}return e.body=t,e.style=Bi.toString(this.style),e}}j["loreline.NBlock"]=ii,ii.__name__="loreline.NBlock",ii.__super__=Le,Object.assign(ii.prototype,{__class__:ii});class gi extends Le{constructor(e,t,i,l,n,s,r,h,a,o){super(e,t,r,h),this.condition=i,this.conditionStyle=l,this.thenBranch=n,this.elseBranch=s,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 l=i[t];++t,e(l,this),l.each(e)}}if(this.elseTrailingComments!=null){let t=0,i=this.elseTrailingComments;for(;t<i.length;){let l=i[t];++t,e(l,this),l.each(e)}}}toJson(){let e=super.toJson();e.condition=this.condition.toJson(),e.conditionStyle=Cl.toString(this.conditionStyle);let t=[],i=0,l=this.thenBranch.body;for(;i<l.length;){let n=l[i];++i,t.push(n.toJson())}if(e.thenBranch=t,e.thenStyle=Bi.toString(this.thenBranch.style),this.elseBranch!=null){let n=[],s=0,r=this.elseBranch.body;for(;s<r.length;){let h=r[s];++s,n.push(h.toJson())}if(e.elseBranch=n,e.elseStyle=Bi.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=[],u=0,c=this.elseLeadingComments;for(;u<c.length;){let _=c[u];++u,o.push(_.toJson())}a.elseLeading=o}if(this.elseTrailingComments!=null&&this.elseTrailingComments.length>0){let o=[],u=0,c=this.elseTrailingComments;for(;u<c.length;){let _=c[u];++u,o.push(_.toJson())}a.elseTrailing=o}e.comments=a}}return e}}j["loreline.NIfStatement"]=gi,gi.__name__="loreline.NIfStatement",gi.__super__=Le,Object.assign(gi.prototype,{__class__:gi});class Ui extends Le{constructor(e,t,i,l,n,s){super(e,t,n,s),this.mode=i,this.items=l,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 l=t++,n=this.items[l];e(n,this),n.each(e)}}if(this.separatorComments!=null){let t=0,i=this.separatorComments;for(;t<i.length;){let l=i[t];if(++t,l!=null){let n=0;for(;n<l.length;){let s=l[n];++n,e(s,this),s.each(e)}}}}}toJson(){let e=super.toJson();e.mode=Tl.toString(this.mode);let t=[],i=0,l=this.items;for(;i<l.length;){let n=l[i];++i,t.push(n.toJson())}if(e.items=t,e.style=Bi.toString(this.style),this.separatorComments!=null){let n=[],s=0,r=this.separatorComments;for(;s<r.length;){let h=r[s];++s;let a;if(h!=null){let o=[],u=0;for(;u<h.length;){let c=h[u];++u,o.push(c.toJson())}a=o}else a=null;n.push(a)}e.separatorComments=n}return e}}j["loreline.NAlternative"]=Ui,Ui.__name__="loreline.NAlternative",Ui.__super__=Le,Object.assign(Ui.prototype,{__class__:Ui});class Rt extends at{constructor(e,t,i,l,n,s){super(e,t,n,s),this.target=i,this.args=l}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 l=i[t];++t,e(l,this),l.each(e)}}}toJson(){let e=super.toJson();e.target=this.target.toJson();let t=[],i=0,l=this.args;for(;i<l.length;){let n=l[i];++i,t.push(n.toJson())}return e.args=t,e}}j["loreline.NCall"]=Rt,Rt.__name__="loreline.NCall",Rt.__super__=at,Object.assign(Rt.prototype,{__class__:Rt});class Mi extends Le{constructor(e,t,i,l,n,s){super(e,t,n,s),this.target=i,this.targetPos=l}type(){return"Transition"}toJson(){let e=super.toJson();return e.target=this.target,e.targetPos=this.targetPos.toJson(),e}}j["loreline.NTransition"]=Mi,Mi.__name__="loreline.NTransition",Mi.__super__=Le,Object.assign(Mi.prototype,{__class__:Mi});class zi extends Le{constructor(e,t,i,l,n,s){super(e,t,n,s),this.target=i,this.targetPos=l}type(){return"Insertion"}toJson(){let e=super.toJson();return e.target=this.target,e.targetPos=this.targetPos.toJson(),e}}j["loreline.NInsertion"]=zi,zi.__name__="loreline.NInsertion",zi.__super__=Le,Object.assign(zi.prototype,{__class__:zi});class Li extends at{constructor(e,t,i,l,n,s,r,h){super(e,t,r,h),this.name=i,this.args=l,this.code=n,this.external=s}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}}j["loreline.NFunctionDecl"]=Li,Li.__name__="loreline.NFunctionDecl",Li.__super__=at,Object.assign(Li.prototype,{__class__:Li});class Ke extends at{constructor(e,t,i,l,n,s){super(e,t,n,s),this.value=i,this.literalType=l}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 l=0,n=this.value;for(;l<n.length;){let s=n[l];if(++l,s instanceof Ft){let r=s;e(r,this),r.each(e)}}}break;case 4:let i=t.style;if(this.value!=null){let l=0,n=this.value;for(;l<n.length;){let s=n[l];if(++l,s.value instanceof Ft){let r=s.value;e(r,this),r.each(e)}}}break}}toJson(){let e=super.toJson(),t=this.literalType;e.literal=Qe[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=[],s=0,r=this.value;for(;s<r.length;){let h=r[s];++s,h instanceof Ft?n.push(h.toJson()):n.push(h)}e.value=n}break;case 4:let l=i.style;if(this.value!=null){let n=[],s=0,r=this.value;for(;s<r.length;){let h=r[s];++s,n.push(h.toJson())}e.value=n}else e.value=[];e.style=Bi.toString(l);break}return e}}j["loreline.NLiteral"]=Ke,Ke.__name__="loreline.NLiteral",Ke.__super__=at,Object.assign(Ke.prototype,{__class__:Ke});var He=Qe["loreline.LiteralType"]={__ename__:"loreline.LiteralType",__constructs__:null,Number:{_hx_name:"Number",_hx_index:0,__enum__:"loreline.LiteralType",toString:S},Boolean:{_hx_name:"Boolean",_hx_index:1,__enum__:"loreline.LiteralType",toString:S},Null:{_hx_name:"Null",_hx_index:2,__enum__:"loreline.LiteralType",toString:S},Array:{_hx_name:"Array",_hx_index:3,__enum__:"loreline.LiteralType",toString:S},Object:(d=function(k){return{_hx_index:4,style:k,__enum__:"loreline.LiteralType",toString:S}},d._hx_name="Object",d.__params__=["style"],d)};He.__constructs__=[He.Number,He.Boolean,He.Null,He.Array,He.Object];class ut extends at{constructor(e,t,i,l,n,s){super(e,t,n,s),this.target=i,this.name=l}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}}j["loreline.NAccess"]=ut,ut.__name__="loreline.NAccess",ut.__super__=at,Object.assign(ut.prototype,{__class__:ut});class di extends at{constructor(e,t,i,l,n,s,r){super(e,t,s,r),this.target=i,this.op=l,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=ne.string(this.op),e.value=this.value.toJson(),e}}j["loreline.NAssign"]=di,di.__name__="loreline.NAssign",di.__super__=at,Object.assign(di.prototype,{__class__:di});class ci extends at{constructor(e,t,i,l,n,s){super(e,t,n,s),this.target=i,this.index=l}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}}j["loreline.NArrayAccess"]=ci,ci.__name__="loreline.NArrayAccess",ci.__super__=at,Object.assign(ci.prototype,{__class__:ci});class Qt extends at{constructor(e,t,i,l,n,s,r){super(e,t,s,r),this.left=i,this.op=l,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=ne.string(this.op),e.right=this.right.toJson(),e}}j["loreline.NBinary"]=Qt,Qt.__name__="loreline.NBinary",Qt.__super__=at,Object.assign(Qt.prototype,{__class__:Qt});class Ki extends at{constructor(e,t,i,l,n,s){super(e,t,n,s),this.op=i,this.operand=l}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=ne.string(this.op),e.operand=this.operand.toJson(),e}}j["loreline.NUnary"]=Ki,Ki.__name__="loreline.NUnary",Ki.__super__=at,Object.assign(Ki.prototype,{__class__:Ki});class $i extends at{constructor(e,t,i,l,n,s,r){super(e,t,s,r),this.condition=i,this.trueExpr=l,this.falseExpr=n}type(){return"Ternary"}each(e){super.each(e),this.condition!=null&&(e(this.condition,this),this.condition.each(e)),this.trueExpr!=null&&(e(this.trueExpr,this),this.trueExpr.each(e)),this.falseExpr!=null&&(e(this.falseExpr,this),this.falseExpr.each(e))}toJson(){let e=super.toJson();return e.condition=this.condition.toJson(),e.trueExpr=this.trueExpr.toJson(),e.falseExpr=this.falseExpr.toJson(),e}}j["loreline.NTernary"]=$i,$i.__name__="loreline.NTernary",$i.__super__=at,Object.assign($i.prototype,{__class__:$i});class Yt extends Le{constructor(e,t,i,l,n,s){super(e,t,n,s),this.path=i,this.script=l}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(),this.script!=null&&(e.script=this.script.toJson()),e}}j["loreline.NImportStatement"]=Yt,Yt.__name__="loreline.NImportStatement",Yt.__super__=Le,Object.assign(Yt.prototype,{__class__:Yt});class le{static isFields(e){return te.__implements(e,vi)||e instanceof Ee?!0:e instanceof Ri||typeof e=="number"&&(e|0)===e||typeof e=="number"||typeof e=="boolean"||typeof e=="string"?!1:!re.isArray(e)}static getField(e,t,i){return te.__implements(t,vi)?t.lorelineGet(e,i):t instanceof Ee?t.h[i]:We.getProperty(t,i)}static getFields(e,t){if(te.__implements(t,vi))return t.lorelineFields(e);if(t instanceof Ee){let i=[],l=t.h,n=l,s=Object.keys(l),r=s.length,h=0;for(;h<r;){let a=s[h++];i.push(a)}return i}else return We.fields(t)}static setField(e,t,i,l){te.__implements(t,vi)?t.lorelineSet(e,i,l):t instanceof Ee?t.h[i]=l:We.setProperty(t,i,l)}static removeField(e,t,i){if(te.__implements(t,vi))return t.lorelineRemove(e,i);if(t instanceof Ee){let l=t;return Object.prototype.hasOwnProperty.call(l.h,i)?(delete l.h[i],!0):!1}else return We.deleteField(t,i)}static fieldExists(e,t,i){return te.__implements(t,vi)?t.lorelineExists(e,i):t instanceof Ee?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 getBeatHelper(e,t){return e.beatHelpers.h[t]}static createFields(e,t,i){if(e!=null&&e.customCreateFields!=null){let l=e.customCreateFields(e,t,i);if(l!=null)return l}if(t!=null){let l=Object.create(j[t].prototype);return te.__implements(l,vi)&&l.lorelineCreate(e),l}return new Ee}}j["loreline.Objects"]=le,le.__name__="loreline.Objects";class Ne extends ai{constructor(e,t){super(e,t)}}j["loreline.ParseError"]=Ne,Ne.__name__="loreline.ParseError",Ne.__super__=ai,Object.assign(Ne.prototype,{__class__:Ne});class El{constructor(e,t,i,l){this.imported=new Ee,this.rootPath=e,this.path=t,this.imports=i,l!=null&&(this.imported=l)}}j["loreline.ParserContext"]=El,El.__name__="loreline.ParserContext",Object.assign(El.prototype,{__class__:El});class qi{constructor(e,t){this.tokens=e,this.current=0,this.errors=null,this.pendingComments=null,this.lastTokenEnd=new he(1,1,0),this.lastLineBreak=null,this.lineBreakAfterToken=!1,this.currentNodeId=Re.UNDEFINED,this.rootBeat=null,this.context=t}parse(){let e=this.currentPos(),t=[],i=new pi(this.nextNodeId(4),e,t);for(;!this.isAtEnd();)try{let l=this.parseNode(!0);for(l!=null&&t.push(l);this.match(x.LineBreak););}catch(l){let n=b.caught(l).unwrap();if(n instanceof Ne){let s=n;this.addError(s),this.synchronize()}else throw l}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 51:let i=t.content;++e;break;case 52:let l=t.content;++e;break;case 53:let n=t.content;++e;break;case 56:++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==x.LineBreak);){this.current++;let i=this.tokens[this.current].type;switch(i._hx_index){case 51:let l=i.content;this.pendingComments==null&&(this.pendingComments=[]),this.pendingComments.push(new Wi(this.nextNodeId(4),this.currentPos(),l,!1));break;case 52:let n=i.content;this.pendingComments==null&&(this.pendingComments=[]),this.pendingComments.push(new Wi(this.nextNodeId(4),this.currentPos(),n,!0));break;case 53:let s=i.content;this.pendingComments==null&&(this.pendingComments=[]),this.pendingComments.push(new Wi(this.nextNodeId(4),this.currentPos(),s,!1,!0));break;case 56: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(Ot.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 51:let i=t.content;break;case 52:let l=t.content;break;case 53:let n=t.content;break;case 54:case 55:case 56: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 51:let i=t.content;break;case 52:let l=t.content;break;case 53:let n=t.content;break;case 54:case 55:case 56: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 51:let i=t.content;break;case 52:let l=t.content;break;case 53:let n=t.content;break;case 56: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 he(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?Ot.toCodeString(t):null}return null}check(e){return this.isAtEnd()?!1:e._hx_index==41?this.tokens[this.current].type==x.Colon:Ot.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,l=e.s;return!0}else return!1}isAtEnd(){return this.current<this.tokens.length?this.tokens[this.current].type==x.Eof:!0}isComment(e){switch(e._hx_index){case 51:let t=e.content;return!0;case 52:let i=e.content;return!0;case 53:let l=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==x.LineBreak;){if(this.isComment(this.tokens[this.current].type)){this.pendingComments==null&&(this.pendingComments=[]);let l=this.pendingComments,n=this.nextNodeId(4),s=this.currentPos(),r=this.tokens[this.current].type,h;switch(r._hx_index){case 51:h=r.content;break;case 52:h=r.content;break;case 53:h=r.content;break;default:h=""}let a=this.tokens[this.current].type,o;if(a._hx_index==52){let _=a.content;o=!0}else o=!1;let u=this.tokens[this.current].type,c;if(u._hx_index==53){let _=u.content;c=!0}else c=!1;l.push(new Wi(n,s,h,o,c))}if(this.advance(),this.isAtEnd())throw b.thrown(new Ne("Unexpected end of file",this.currentPos()))}if(this.isAtEnd())throw b.thrown(new Ne("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 Ne("Unexpected: "+this.currentTokenTypeToString(),this.currentPos())),this.advance(),new Ke(this.nextNodeId(4),this.currentPos(),null,He.Null));case 4:let l=this.parseChoiceStatement();return e?t.wrapInRootBeat(l):l;case 5:let n=this.parseIfStatement();return e?t.wrapInRootBeat(n):n;case 7:if(this.advance(),!this.check(x.KwState))throw b.thrown(new Ne("Expected 'state' after 'new'",this.currentPos()));let s=this.parseStateDecl(!0);return e?t.wrapInRootBeat(s):s;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,u=i.external;return e?this.parseFunction():(this.addError(new Ne("Unexpected: "+this.currentTokenTypeToString(),this.currentPos())),this.advance(),new Ke(this.nextNodeId(4),this.currentPos(),null,He.Null));case 15:let c=i.quotes,_=i.s,f=i.attachments,m=this.parseTextStatement();return e?t.wrapInRootBeat(m):m;case 16:let g=i.n,w=this.parseExpressionStatement();return e?t.wrapInRootBeat(w):w;case 17:let y=i.b,T=this.parseExpressionStatement();return e?t.wrapInRootBeat(T):T;case 19:let E=i.name;if(this.peek().type==x.Colon){let v=this.parseDialogueStatement();return e?t.wrapInRootBeat(v):v}else{let v=this.parseExpressionStatement();return e?t.wrapInRootBeat(v):v}break;case 26:let C=this.parseInsertion();return e?t.wrapInRootBeat(C):C;case 18:case 27:case 39:case 45:case 47:case 49:let P=this.parseExpressionStatement();return e?t.wrapInRootBeat(P):P;case 40:let I=this.parseTransition();return e?t.wrapInRootBeat(I):I;default:return this.addError(new Ne("Unexpected: "+this.currentTokenTypeToString(),this.currentPos())),this.advance(),new Ke(this.nextNodeId(4),this.currentPos(),null,He.Null)}}wrapInRootBeat(e){let t,i=null;if(this.rootBeat==null){let l=this.currentPos();t=[],this.rootBeat=new Me(this.nextNodeId(1),l,"_",t),i=this.rootBeat}else t=this.rootBeat.body;return t.push(e),i}parseImport(){let e=this.currentPos();if(this.expect(x.KwImport),this.context==null)throw b.thrown(new Ne("Cannot import without a context",this.currentPos()));let t=0,i=this.tokens[this.current],l,n=i.type;if(n._hx_index==15){let c=n.attachments,_=n.quotes,f=n.s;t=_,l=f}else throw b.thrown(new Ne("Expected string literal for import path",this.currentPos()));let s=l;Nt.isAbsolute(s)||(s=Nt.join([Nt.directory(this.context.rootPath),s])),s=Nt.normalize(s);let r=".lor";if(this.context.rootPath.endsWith(".lor.txt")&&(r=".lor.txt"),s.toLowerCase().endsWith(r)||(s+=r),Object.prototype.hasOwnProperty.call(this.context.imported.h,s)){this.advance();let c=new Yt(this.nextNodeId(1),e.extendedTo(this.prevNonWhitespaceOrComment().pos),null,null);return c.path=new Tt(this.nextNodeId(4),i.pos,t,[new Je(this.nextNodeId(4),i.pos,ze.Raw(l))]),this.attachComments(c)}let h=this.context.imports.h[s];if(h==null)throw b.thrown(new Ne("Failed to import file at path "+s+" ("+l+")",this.currentPos()));let a=new qi(h,new El(this.context.rootPath,s,this.context.imports,this.context.imported));a.currentNodeId=this.currentNodeId;let o=a.parse();this.currentNodeId=a.currentNodeId,this.advance();let u=new Yt(this.nextNodeId(1),e.extendedTo(this.prevNonWhitespaceOrComment().pos),null,o);return u.path=new Tt(this.nextNodeId(4),i.pos,t,[new Je(this.nextNodeId(4),i.pos,ze.Raw(l))]),this.attachComments(u)}parseDialogueStatement(){let e=this.currentPos(),t=new ti(this.nextNodeId(4),e,null,null,null),i=this.tokens[this.current].type,l;if(i._hx_index==19)l=i.name;else throw b.thrown(new Ne("Expected character name",this.currentPos()));t.character=l,t.characterPos=this.tokens[this.current].pos,this.advance(),this.expect(x.Colon),this.attachComments(t);let n=!1;if(this.checkBlockStart()){let s=this.parseBlockStart();if(s.type!=x.Indent)throw b.thrown(new Ne("Expected indent, got "+Ot.toCodeString(s.type),s.pos));n=!0}try{t.content=this.parseStringLiteral()}catch(s){let r=b.caught(s).unwrap();if(r instanceof Ne){let h=r;this.addError(h),t.content=new Tt(this.nextNodeId(4),this.currentPos(),0,[new Je(this.nextNodeId(4),this.currentPos(),ze.Raw("?"))])}else throw s}if(!this.lineBreakAfterToken&&this.match(x.KwIf)){let s=this.previous().pos;this.check(x.LParen)&&(t.conditionStyle=2),t.condition=this.parseConditionExpression(),t.conditionPos=s.extendedTo(this.prevNonWhitespaceOrComment().pos)}if(n){for(;this.match(x.LineBreak););this.expect(x.Unindent)}return t.pos=t.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),t}parseStatementBlock(e){let t=this.parseBlockStart().type==x.Indent?x.Unindent:x.RBrace;for(;!this.check(t)&&!this.isAtEnd();){for(;this.match(x.LineBreak)||t!=x.Unindent&&this.match(x.Unindent););if(this.check(t))break;try{e.push(this.parseNode())}catch(i){let l=b.caught(i).unwrap();if(l instanceof Ne){let n=l;if(this.errors==null&&(this.errors=[]),this.errors.push(n),this.synchronize(),this.check(t))break}else throw i}for(;this.match(x.LineBreak)||t!=x.Unindent&&this.match(x.Unindent););}return this.expect(t),t==x.RBrace?1:0}parseStateDecl(e){let t=this.currentPos(),i=new Wt(this.nextNodeId(3),t,e,[]);this.expect(x.KwState);let l=this.parseBlockStart().type==x.Indent?x.Unindent:x.RBrace;for(i.style=l==x.RBrace?1:0,this.attachComments(i);!this.check(l)&&!this.isAtEnd();){for(;this.match(x.LineBreak)||l!=x.Unindent&&this.match(x.Unindent););for(i.fields.push(this.parseObjectField());this.match(x.LineBreak)||l!=x.Unindent&&this.match(x.Unindent););}for(;this.match(x.LineBreak)||l!=x.Unindent&&this.match(x.Unindent););return this.expect(l),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(x.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 Me(this.nextNodeId(1),e,null,[],[]);this.expect(x.KwBeat),t.pos=e.extendedTo(this.currentPos()),t.name=this.expectIdentifier();let l=this.parseBlockStart().type==x.Indent?x.Unindent:x.RBrace;for(t.style=l==x.RBrace?1:0,this.attachComments(t);!this.check(l)&&!this.isAtEnd();){for(;this.match(x.LineBreak)||l!=x.Unindent&&this.match(x.Unindent););for(t.body.push(this.parseNode());this.match(x.LineBreak)||l!=x.Unindent&&this.match(x.Unindent););}for(;this.match(x.LineBreak)||l!=x.Unindent&&this.match(x.Unindent););return this.expect(l),t.pos=t.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),t}checkBlockStart(){let e=null,t=null,i=0,l=0;for(;this.current+l<this.tokens.length;){let n=this.tokens[this.current+l];if(++l,n.type!=x.LineBreak){if(n.type==x.Indent){++i,e=n;continue}if(n.type==x.LBrace){t==null&&(t=n);continue}break}}if(t!=null)return!0;if(e!=null){if(i>1)throw b.thrown(new Ne("Invalid indentation level",e.pos));return!0}else return!1}parseBlockStart(){let e=null,t=null,i=0;for(;!this.isAtEnd();)if(!this.match(x.LineBreak)){if(this.match(x.Indent)){++i,e=this.prevWithType(x.Indent);continue}if(this.match(x.LBrace)){t==null&&(t=this.prevWithType(x.LBrace));continue}break}if(t!=null)return t;if(e!=null){if(i>1)throw b.thrown(new Ne("Invalid indentation level",e.pos));return e}else return this.addError(new Ne("Expected "+Ot.toCodeString(x.LBrace)+" or "+Ot.toCodeString(x.Indent)+", got "+this.currentTokenTypeToString(),this.currentPos())),new ke(x.Indent,this.currentPos())}parseCharacterDecl(){let e=this.currentPos(),t=new zt(this.nextNodeId(3),e,null,null,[]);this.expect(x.KwCharacter),t.name=this.expectIdentifier(),t.namePos=this.prevNonWhitespaceOrComment().pos;let i=this.parseBlockStart().type==x.Indent?x.Unindent:x.RBrace;for(t.style=i==x.RBrace?1:0,this.attachComments(t);!this.check(i)&&!this.isAtEnd();){for(;this.match(x.LineBreak)||i!=x.Unindent&&this.match(x.Unindent););for(t.fields.push(this.parseObjectField());this.match(x.LineBreak)||i!=x.Unindent&&this.match(x.Unindent););}for(;this.match(x.LineBreak)||i!=x.Unindent&&this.match(x.Unindent););return this.expect(i),t.pos=t.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),t}parseTextStatement(){let e=this.currentPos(),t=this.attachComments(new ui(this.nextNodeId(4),e,null));if(t.content=this.parseStringLiteral(),!this.lineBreakAfterToken&&this.match(x.KwIf)){let i=this.previous().pos;this.check(x.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 mi(this.nextNodeId(2),e,[]);this.expect(x.KwChoice);let i=this.parseBlockStart().type==x.Indent?x.Unindent:x.RBrace;for(t.style=i==x.RBrace?1:0,this.attachComments(t);!this.check(i)&&!this.isAtEnd();){for(;this.match(x.LineBreak)||i!=x.Unindent&&this.match(x.Unindent););for(t.options.push(this.parseChoiceOption(i));this.match(x.LineBreak)||i!=x.Unindent&&this.match(x.Unindent););}return this.expect(i),t.pos=t.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),t}parseChoiceOption(e){let t=this.currentPos(),i=this.attachComments(new Et(this.nextNodeId(3),t,null,null,null,0,[])),l=null,n=!1;try{this.check(x.OpPlus)?(n=!0,i.insertion=this.parseInsertion()):(this.match(x.OpMinus)&&(i.once=!0),i.text=this.parseStringLiteral())}catch(s){let r=b.caught(s).unwrap();if(r instanceof Ne){let h=r;this.addError(h),l=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(),ze.Raw("?"))])}else throw s}if(this.match(x.KwIf)){let s=this.previous().pos,r=this.currentPos().offset;try{this.check(x.LParen)&&(i.conditionStyle=2),i.condition=this.parseConditionExpression(),i.conditionPos=s.extendedTo(this.prevNonWhitespaceOrComment().pos)}catch(h){let a=b.caught(h).unwrap();if(a instanceof Ne){let o=a;this.addError(o),l=this.currentPos(),this.currentPos().offset==r&&this.advance()}else throw h}}if(!n){if(this.checkBlockStart()){i.body=[];let s=this.currentPos().offset;try{i.style=this.parseStatementBlock(i.body)}catch(r){let h=b.caught(r).unwrap();if(h instanceof Ne){let a=h;this.addError(a),l=this.currentPos(),this.currentPos().offset==s&&this.advance(),i.body.length==0&&(i.body=[new Ke(this.nextNodeId(4),this.currentPos(),null,He.Null)])}else throw r}}else if(this.check(x.Arrow)){let s=this.currentPos().offset;try{i.body=[],i.body.push(this.parseNode())}catch(r){let h=b.caught(r).unwrap();if(h instanceof Ne){let a=h;this.addError(a),l=this.currentPos(),this.currentPos().offset==s&&this.advance(),i.body.length==0&&(i.body=[new Ke(this.nextNodeId(4),this.currentPos(),null,He.Null)])}else throw r}i.style=0}}if(i.pos=i.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),l!=null)for(;!this.isAtEnd()&&this.currentPos().line<=l.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,l=e.attachments;return!0;case 16:let n=e.n;return!0;case 17:let s=e.b;return!0;case 19:let r=e.name;return this.peek().type!=x.Colon;case 18:case 27:case 39:case 45:case 47:case 49:return!0;default:return!1}}parseExpressionStatement(){let e=this.parseExpression();if(this.match(x.OpAssign)||this.match(x.OpPlusAssign)||this.match(x.OpMinusAssign)||this.match(x.OpMultiplyAssign)||this.match(x.OpDivideAssign)||this.match(x.OpUnquotedAssign)){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,l=e.attachments;return!0;case 19:let n=e.name;return this.peek().type==x.Colon?!0:this.peek().type==x.Arrow;case 1:case 2:case 3:case 4:case 5:case 40:return!0;default:return!1}}parseIfStatement(){let e=this.currentPos(),t=new gi(this.nextNodeId(4),e,null,0,null,null);for(this.expect(x.KwIf),this.check(x.LParen)&&(t.conditionStyle=2),t.condition=this.parseConditionExpression();this.match(x.LineBreak););this.attachComments(t),t.thenBranch=new ii(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==x.KwElse){for(this.advance();this.match(x.LineBreak););if(this.attachElseComments(t,i),this.check(x.KwIf)){t.elseBranch=new ii(this.nextNodeId(3),this.currentPos(),null);let l=this.parseIfStatement();t.elseBranch.body=[l],t.elseBranch.style=0}else t.elseBranch=new ii(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 b.thrown(new Ne("Expected alternative keyword",this.currentPos()))}let i=new Ui(this.nextNodeId(2),e,t,[]);for(this.advance();this.match(x.LineBreak););this.attachComments(i);let l=new ii(this.nextNodeId(3),this.currentPos(),null);for(l.body=[],l.style=this.parseStatementBlock(l.body),i.items.push(l),i.style=l.style;this.check(x.Separator);){let n=this.tokens[this.current];for(this.advance();this.match(x.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 u=o[a];++a,u.pos.line<=n.pos.line?r.push(u):h.push(u)}i.separatorComments.push(r),this.pendingComments=h}let s=new ii(this.nextNodeId(3),this.currentPos(),null);s.body=[],s.style=this.parseStatementBlock(s.body),i.items.push(s)}return i.pos=i.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),i}parseTransition(){let e=this.currentPos();if(this.expect(x.Arrow),this.match(x.Dot))return this.attachComments(new Mi(this.nextNodeId(4),e.extendedTo(this.prevNonWhitespaceOrComment().pos),".",this.prevNonWhitespaceOrComment().pos));let t=this.expectIdentifier();return this.attachComments(new Mi(this.nextNodeId(4),e.extendedTo(this.prevNonWhitespaceOrComment().pos),t,this.prevNonWhitespaceOrComment().pos))}parseInsertion(){let e=this.currentPos();this.expect(x.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,l=t.args,n=t.code,s=t.external;return this.advance(),this.attachComments(new Li(this.nextNodeId(3),e,i,[].concat(l),n,s))}else throw b.thrown(new Ne("Unexpected token in expression",this.currentPos()))}parseExpression(){try{let e=this.parseTernary();if(this.check(x.OpAssign)||this.check(x.OpPlusAssign)||this.check(x.OpMinusAssign)||this.check(x.OpMultiplyAssign)||this.check(x.OpDivideAssign)||this.check(x.OpUnquotedAssign)){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=b.caught(e).unwrap();return t instanceof Ne&&this.addError(t),new Ke(this.nextNodeId(4),this.currentPos(),null,He.Null)}}parseTernary(){let e=this.parseLogicalOr();if(this.match(x.Question)){let t=this.parseTernary();this.expect(x.Colon);let i=this.parseTernary();e=this.attachComments(new $i(this.nextNodeId(4),e.pos,e,t,i)),e.pos=e.pos.extendedTo(i.pos)}return e}parseLogicalOr(){let e=this.parseLogicalAnd();for(;this.match(x.OpOr(!1));){let t=this.previous().type,i=this.attachComments(new Qt(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(x.OpAnd(!1));){let t=this.previous().type,i=this.attachComments(new Qt(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(x.OpEquals)||this.match(x.OpNotEquals);){let t=this.previous().type,i=this.attachComments(new Qt(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(x.OpGreater)||this.match(x.OpGreaterEq)||this.match(x.OpLess)||this.match(x.OpLessEq);){let t=this.previous().type,i=this.attachComments(new Qt(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(x.OpPlus)||this.match(x.OpMinus);){let t=this.previous().type,i=this.attachComments(new Qt(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(x.OpMultiply)||this.match(x.OpDivide)||this.match(x.OpModulo);){let t=this.previous().type,i=this.attachComments(new Qt(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(x.OpNot)||this.match(x.OpMinus)){let e=this.previous().type,t=this.attachComments(new Ki(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,l=t.s,n=t.attachments;return this.parsePostfix(e,this.parseStringLiteral());case 16:let s=t.n;return this.advance(),this.attachComments(new Ke(this.nextNodeId(4),e,s,He.Number));case 17:let r=t.b;return this.advance(),this.attachComments(new Ke(this.nextNodeId(4),e,r,He.Boolean));case 18:return this.advance(),this.attachComments(new Ke(this.nextNodeId(4),e,null,He.Null));case 19:let h=t.name;if(this.peek().type==x.Colon){let o=[this.parseObjectField()];return new Ke(this.nextNodeId(4),e.extendedTo(this.prevNonWhitespaceOrComment().pos),o,He.Object(0))}else return this.advance(),this.parseIdentifierExpression(e,h);break;case 45:return this.parsePostfix(e,this.parseObjectLiteral());case 47:this.advance();let a=this.parseExpression();return this.expect(x.RParen),this.parsePostfix(e,a);case 49:return this.parsePostfix(e,this.parseArrayLiteral());default:throw b.thrown(new Ne("Unexpected token in expression",this.currentPos()))}}parseStringLiteral(){let e=this.currentPos(),t=[],i=this.tokens[this.current].type;if(i._hx_index==15){let l=i.quotes,n=i.s,s=i.attachments,r=l!=0?e.withOffset(n,1,e.length-2):e,h=0;if(s==null||s.length==0){let c=this.makeStringPartPosition(r,n,0);c.length=r.length;let _=this.nextNodeId(4),f=this.nextNodeId(4);return t.push(new Je(f,c,ze.Raw(n))),this.advance(),this.attachComments(new Tt(_,e,l,t))}let a=this.attachComments(new Tt(this.nextNodeId(4),e,l,t)),o=0,u=s.length;for(;o<u;){let c=o++,_=s[c];switch(_._hx_index){case 0:let f=_.braces,m=_.inTag,g=_.expr,w=_.start,y=_.length;if(h>=w+y)continue;if(w>h){let P=this.makeStringPartPosition(r,n,h);P.length=w-h;let I=w-h;t.push(new Je(this.nextNodeId(4),P,ze.Raw(I!=null?p.substr(n,h,I):p.substr(n,h,null))))}t.push(this.parseStringInterpolation(f,m,g,w,y,n)),h=w+y;break;case 1:let T=_.closing,E=_.start,C=_.length;if(h>=E+C)continue;if(E>h){let P=this.makeStringPartPosition(r,n,h);P.length=E-h;let I=E-h;t.push(new Je(this.nextNodeId(4),P,ze.Raw(I!=null?p.substr(n,h,I):p.substr(n,h,null))))}t.push(this.parseStringTag(T,E,C,n,l,s)),h=E+C;break}}if(h<n.length){let c=this.makeStringPartPosition(r,n,h);c.length=n.length-h;let _=null;t.push(new Je(this.nextNodeId(4),c,ze.Raw(_!=null?p.substr(n,h,_):p.substr(n,h,null))))}if(this.advance(),this.pendingComments!=null){let c=null,_=0,f=this.pendingComments;for(;_<f.length;){let m=f[_];++_,m.pos.line==e.line?(a.trailingComments==null&&(a.trailingComments=[]),a.trailingComments.push(m)):(c==null&&(c=[]),c.push(m))}this.pendingComments=c}return a}else throw b.thrown(new Ne("Expected text, got "+this.currentTokenTypeToString(),this.currentPos()))}makeStringPartPosition(e,t,i){let l=e.line,n=e.column,s=0,r=i;for(;s<r;){let h=s++,a=p.cca(t,h);(a??-1)==10?(++l,n=1):++n}return new he(l,n,e.offset+i)}makeAccess(e,t,i,l){if(i!=null){if(i.length==0&&(this.errors==null||this.errors.length==0)&&this.addError(new Ne("Invalid access: "+(i!=null?"'"+i+"'":"null"),e)),t!=null)if(l!=null)e=new he(t.pos.line,t.pos.column,t.pos.offset,l.offset+i.length-t.pos.offset);else throw b.thrown(new Ne("Invalid access (missing name position)",e));else if(e.length==0){let n=l!=null?l.length:null;e=new he(e.line,e.column,e.offset,n??i.length)}}return new ut(this.nextNodeId(4),e,t,i)}parseStringInterpolation(e,t,i,l,n,s){let r=i[0],h=r!=null?r.pos:null,a=this.makeStringPartPosition(h??this.currentPos(),s,l);if(a.length=n,i.length==0){let c=i[0],_=c!=null?c.pos:null;this.addError(new Ne("Empty interpolation",_??this.currentPos()));let f=this.nextNodeId(4),m=this.nextNodeId(4),g=i[0],w=g!=null?g.pos:null;return new Je(f,a,ze.Expr(new Ke(m,w??this.currentPos(),null,He.Null)))}let o=null;if(!e&&i.length>0){let c=null,_=0,f=!1;for(;_<i.length;){let m=i[_];++_;let g=m.type;switch(g._hx_index){case 19:let w=g.name;if(c==null)c=this.attachComments(this.makeAccess(m.pos,null,w,null));else if(f)c=this.attachComments(this.makeAccess(m.pos,c,w,m.pos));else{this.addError(new Ne("Missing dot in field access",m.pos));let K=this.nextNodeId(4),G=this.nextNodeId(4),Y=i[0],$=Y!=null?Y.pos:null;return new Je(K,a,ze.Expr(new Ke(G,$??this.currentPos(),null,He.Null)))}f=!1;break;case 44:if(c==null){this.addError(new Ne("Leading dot in field access",m.pos));let K=this.nextNodeId(4),G=this.nextNodeId(4),Y=i[0],$=Y!=null?Y.pos:null;return new Je(K,a,ze.Expr(new Ke(G,$??this.currentPos(),null,He.Null)))}f=!0;break;case 47:if(c==null){this.addError(new Ne("Function call without target",m.pos));let K=this.nextNodeId(4),G=this.nextNodeId(4),Y=i[0],$=Y!=null?Y.pos:null;return new Je(K,a,ze.Expr(new Ke(G,$??this.currentPos(),null,He.Null)))}let y=m.pos,T=[],E=[],C=1;for(;_<i.length&&C>0;){let K=i[_];switch(++_,K.type._hx_index){case 43:C==1?E.length>0&&(T.push(E),E=[]):E.push(K);break;case 47:++C,E.push(K);break;case 48:--C,C>0?E.push(K):E.length>0&&T.push(E);break;default:E.push(K)}}if(C>0){this.addError(new Ne("Unterminated function call",y));let K=this.nextNodeId(4),G=this.nextNodeId(4),Y=i[0],$=Y!=null?Y.pos:null;return new Je(K,a,ze.Expr(new Ke(G,$??this.currentPos(),null,He.Null)))}let P=[],I=0;for(;I<T.length;){let K=T[I];++I;let G=new qi(K);G.currentNodeId=this.currentNodeId;let Y=G.parseExpression();P.push(Y),this.currentNodeId=G.currentNodeId}c=this.attachComments(new Rt(this.nextNodeId(4),y.extendedTo(i[_-1].pos),c,P)),f=!1;break;case 49:if(c==null){this.addError(new Ne("Array access without target",m.pos));let K=this.nextNodeId(4),G=this.nextNodeId(4),Y=i[0],$=Y!=null?Y.pos:null;return new Je(K,a,ze.Expr(new Ke(G,$??this.currentPos(),null,He.Null)))}let v=m.pos,F=[],B=1,A=null;for(;_<i.length&&B>0;){let K=i[_];switch(++_,K.type._hx_index){case 49:++B,F.push(K);break;case 50:--B,B>0&&F.push(K),A=K;break;default:F.push(K)}}if(B>0){this.addError(new Ne("Unterminated array access",v));let K=this.nextNodeId(4),G=this.nextNodeId(4),Y=i[0],$=Y!=null?Y.pos:null;return new Je(K,a,ze.Expr(new Ke(G,$??this.currentPos(),null,He.Null)))}let L=new qi(F);L.currentNodeId=this.currentNodeId;let z=L.parseExpression();this.currentNodeId=L.currentNodeId;let D=a.extendedTo(i[_-1].pos);D.length+=1,c=this.attachComments(new ci(this.nextNodeId(4),D,c,z)),f=!1;break;default:this.addError(new Ne("Unexpected token in field access: "+Ot.toCodeString(m.type),m.pos));let O=this.nextNodeId(4),q=this.nextNodeId(4),M=i[0],U=M!=null?M.pos:null;return new Je(O,a,ze.Expr(new Ke(q,U??this.currentPos(),null,He.Null)))}}f&&this.addError(new Ne("Trailing dot in field access",i[i.length-1].pos)),o=c}else{let c=new qi(i);c.currentNodeId=this.currentNodeId,o=c.parseExpression(),this.currentNodeId=c.currentNodeId,c.isAtEnd()||this.addError(new Ne("Unexpected tokens after interpolation expression",c.tokens[c.current].pos))}let u=new he(a.line,a.column+(e?1:0),a.offset-(e?2:0),n);return new Je(this.nextNodeId(4),u,ze.Expr(o))}parseStringTag(e,t,i,l,n,s){let r=this.currentPos();n!=0&&(r=r.withOffset(l,1,r.length-2));let h=this.makeStringPartPosition(r,l,t);h.length=i;let a=e?2:1,o=t+a,u=i-(e?3:2),c=o+u,_=this.nextNodeId(4),f=!1;if(s!=null){let y=0,T=s.length;e:for(;y<T;){let E=y++,C=s[E];switch(C._hx_index){case 0:let P=C.braces,I=C.inTag,v=C.expr,F=C.start,B=C.length,A=F+B;if(F>=o&&A<=c){f=!0;break e}break;case 1:let L=C.closing,z=C.start,D=C.length;continue}}}if(!f){let y=this.makeStringPartPosition(r,l,o);y.length=u;let T=this.nextNodeId(4),E=this.nextNodeId(4);return new Je(_,h,ze.Tag(e,this.attachComments(new Tt(T,y,0,[new Je(E,y,ze.Raw(u!=null?p.substr(l,o,u):p.substr(l,o,null)))]))))}let m=[],g=this.attachComments(new Tt(this.nextNodeId(4),h,0,m)),w=o;if(s!=null){let y=0,T=s.length;for(;y<T;){let E=y++,C=s[E];switch(C._hx_index){case 0:let P=C.inTag,I=C.braces,v=C.expr,F=C.start,B=C.length,A=F+B;if(F>=o&&A<=c){if(F>w){let q=this.makeStringPartPosition(r,l,o);q.length=F-o;let M=F-w;m.push(new Je(this.nextNodeId(4),q,ze.Raw(M!=null?p.substr(l,w,M):p.substr(l,w,null))))}let O=this.parseStringInterpolation(I,!0,v,F,B,l);O.pos=this.makeStringPartPosition(r,l,F),O.pos.length=B,m.push(O),w=A}break;case 1:let L=C.closing,z=C.start,D=C.length;continue}}}if(w<c){let y=null,T=this.makeStringPartPosition(h,y!=null?p.substr(l,t,y):p.substr(l,t,null),w-t+a);T.length=o+c-w;let E=c-w;m.push(new Je(this.nextNodeId(4),T,ze.Raw(E!=null?p.substr(l,w,E):p.substr(l,w,null))))}return new Je(_,h,ze.Tag(e,g))}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(x.Dot,!1)){let i=null,l=this.currentPos();this.checkIdentifier()?i=this.expectIdentifier():(this.addError(new Ne("Expected identifier after '.'",this.currentPos())),i=""),t=this.attachComments(this.makeAccess(e,t,i,l))}else if(this.match(x.LBracket)){let i=this.parseExpression();this.expect(x.RBracket);let l=e.extendedTo(this.previous().pos);t=this.attachComments(new ci(this.nextNodeId(4),l,t,i))}else if(this.match(x.LParen)){let i=this.parseCallArguments();t=this.attachComments(new Rt(this.nextNodeId(4),e.extendedTo(this.previous().pos),t,i))}else break;return t}parseArrayLiteral(){let e=this.currentPos(),t=[],i=new Ke(this.nextNodeId(4),e,t,He.Array);this.expect(x.LBracket),this.attachComments(i);let l=!1;for(;!this.check(x.RBracket)&&!this.isAtEnd();){if(l){for(;this.match(x.LineBreak);)l=!1;this.match(x.Comma)&&(l=!1)}for(;this.match(x.LineBreak)||this.match(x.Indent)||this.match(x.Unindent);)l=!1;if(!this.check(x.RBracket)&&l)throw b.thrown(new Ne("Expected comma or line break between elements",this.currentPos()));for(;this.match(x.LineBreak)||this.match(x.Indent)||this.match(x.Unindent););this.check(x.RBracket)||t.push(this.parseExpression());let n=this.previous();l=n.type!=x.Colon&&n.type!=x.LineBreak}for(;this.match(x.LineBreak)||this.match(x.Indent)||this.match(x.Unindent););return this.expect(x.RBracket),i.pos=i.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),i}parseObjectLiteral(){let e=this.currentPos(),t=[],i=this.parseBlockStart().type==x.Indent?x.Unindent:x.RBrace,l=i==x.RBrace?1:0,n=new Ke(this.nextNodeId(4),i!=x.RBrace?this.nextNonWhitespaceOrComment().pos:e,t,He.Object(l));this.attachComments(n);let s=!1;for(;!this.check(i)&&!this.isAtEnd();){if(s){for(;this.match(x.LineBreak)||i!=x.Unindent&&this.match(x.Unindent);)s=!1;this.match(x.Comma)&&(s=!1)}for(;this.match(x.LineBreak)||i!=x.Unindent&&this.match(x.Unindent);)s=!1;if(!this.check(i)&&s)throw b.thrown(new Ne("Expected comma or line break between fields",this.currentPos()));for(;this.match(x.LineBreak)||i!=x.Unindent&&this.match(x.Unindent););this.check(i)||t.push(this.parseObjectField());let r=this.previous();s=r.type!=x.Colon&&r.type!=x.LineBreak}for(;this.match(x.LineBreak)||i!=x.Unindent&&this.match(x.Unindent););return this.expect(i),n.pos=n.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),n}parseCallArguments(){let e=[];if(!this.check(x.RParen))do{for(;this.match(x.LineBreak););for(e.push(this.parseExpression());this.match(x.LineBreak););}while(this.match(x.Comma));return this.expect(x.RParen),e}parseConditionExpression(){let e=this.match(x.LParen),t=null;try{t=this.parseExpression(),t!=null&&te.getClass(t)==di&&this.addError(new Ne("Invalid condition expression: can't assign a variable here. Did you want to use '==' instead?",t.pos))}catch(i){let l=b.caught(i).unwrap();if(l instanceof Ne){let n=l;this.addError(n),t=new Ke(this.nextNodeId(4),this.currentPos(),null,He.Null)}else throw i}return e&&this.expect(x.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==x.LineBreak}expect(e){if(this.check(e))return this.advance();{let t=new Ne("Expected "+Ot.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 46:case 48:case 55:return this.addError(t),new ke(e,this.currentPos());default:}throw b.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 b.thrown(new Ne("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,l=0,n=this.pendingComments.length;for(;l<n;){let s=l++,r=this.pendingComments[s];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,l=[],n=0,s=this.pendingComments;for(;n<s.length;){let r=s[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)):l.push(r)}this.pendingComments=l}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,l=e.attachments;if(this.previous().type==x.RBrace)return;this.advance();break;case 40:this.advance(),(this.check(x.Dot)||Ot.isIdentifier(this.tokens[this.current].type))&&this.advance();return;case 1:case 2:case 3:case 4:case 5:case 46:case 54:return;default:this.advance()}}}requiresNewLine(){switch(this.tokens[this.current].type._hx_index){case 6:case 40:case 46:return!1;default:return!0}}addError(e){return this.errors==null&&(this.errors=[]),this.errors.includes(e)||this.errors.push(e),e}}j["loreline.Parser"]=qi,qi.__name__="loreline.Parser",Object.assign(qi.prototype,{__class__:qi});class he{constructor(e,t,i,l){l==null&&(l=0),this.line=e,this.column=t,this.offset=i,this.length=l}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,l){if(l==null&&(l=0),i==null&&(i=0),t==0)return new he(this.line,this.column,this.offset,i);let n=this.line,s=this.column,r=this.offset;if(t>0){let h=0;for(;h<t;){let a;if(r<l+e.length){let o=p.cca(e,r-l);a=(o??-1)==10}else a=!1;a?(++n,s=1):++s,++h,++r}}else{let h=0;for(;h>t;){--r;let a;if(r>=0){let o=p.cca(e,r-l);a=(o??-1)==10}else a=!1;if(a){--n;let o=1,u=r-1;for(;u>=0;){let c=p.cca(e,u-l);if((c??-1)==10)break;++o,--u}s=o}else--s;--h}}return r<0&&(r=0,n=1,s=1),new he(n,s,r,i)}extendedTo(e){return new he(this.line,this.column,this.offset,e.offset+e.length-this.offset)}static fromContentAndIndex(e,t,i){i==null&&(i=0);let l=1,n=1,s=0,r=e.length;for(t>r&&(t=r),t<0&&(t=0);s<t;){let h=p.cca(e,s);(h??-1)==10?(++l,n=1):++n,++s}return new he(l,n,t,i)}}j["loreline.Position"]=he,he.__name__="loreline.Position",Object.assign(he.prototype,{__class__:he});class nl{constructor(e,t){t==null&&(t=`
41
- `),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 Xt}clear(){this._noLn=0,this._level=0,this._prevLevel=0,this._numEmptyLines=0,this._buf=new Xt}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;let t=p.cca(e,e.length-1);this._lastChar=t??-1;let i=e.length-1;for(;i>=0;){let l=p.cca(e,i),n=l??-1;if(n!=32&&n!=10&&n!=13&&n!=9){this._lastVisibleChar=n;break}--i}}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+=ne.string(this._newline),this._beginLine++),this}tab(){let e=0,t=this._level;for(;e<t;){let i=e++;this._buf.b+=ne.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 Xt,this._beginLine=1,this.printStringLiteral(e),this.enableComments=t;let i=Ae.trim(this.toString());return i=i.split(`
40
+ `).print(e)}static update(e){Hi.update(e)}}j["loreline.Loreline"]=Yi.loreline.Loreline=pn,pn.__name__="loreline.Loreline";class Re{constructor(e,t,i,l){if(e<0||e>65535)throw b.thrown("Section value ("+e+") should be between 0 and 65535");if(t<0||t>65535)throw b.thrown("Branch value ("+t+") should be between 0 and 65535");if(i<0||i>65535)throw b.thrown("Block value ("+i+") should be between 0 and 65535");if(l<0||l>65535)throw b.thrown("Node value ("+l+") should be between 0 and 65535");let n=e-32768,s=t-32768;n<0&&(n=n+65536&65535),s<0&&(s=s+65536&65535);let r=i-32768,h=l-32768;r<0&&(r=r+65536&65535),h<0&&(h=h+65536&65535),this.thisVal=new Di(n<<16|s&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 Di(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 Di(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 Di(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 Di(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 b.thrown("Node id section overflow");return new Re(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 Re((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,l=this.thisVal.high&65535;return new Re((i>=32768?i-65536:i)+32768,(l>=32768?l-65536:l)+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,l=this.thisVal.high&65535,n=this.thisVal.low>>16&65535;return new Re((i>=32768?i-65536:i)+32768,(l>=32768?l-65536:l)+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,l=this.thisVal.low&65535;return""+((e>=32768?e-65536:e)+32768)+"."+((t>=32768?t-65536:t)+32768)+"."+((i>=32768?i-65536:i)+32768)+"."+((l>=32768?l-65536:l)+32768)}static fromInt64(e){let t=new Re(32768,32768,32768,32768);return t.thisVal=e,t}static fromString(e){let t=e.split(".");return new Re(le.parseInt(t[0]),le.parseInt(t[1]),le.parseInt(t[2]),le.parseInt(t[3]))}static fromTwoInt32(e,t){return Re.fromInt64(new Di(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,l=t.thisVal;return i.high==l.high?i.low==l.low:!1}}j["loreline.NodeId"]=Re,Re.__name__="loreline.NodeId",Object.assign(Re.prototype,{__class__:Re,__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 Gi{constructor(){this.map=new wi}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 Hl(this.map)}keys(){return new jl(this.map)}keyValueIterator(){return new Jl(this.map)}}j["loreline.NodeIdMap"]=Gi,Gi.__name__="loreline.NodeIdMap",Object.assign(Gi.prototype,{__class__:Gi});class Hl{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}}j["loreline._Node.NodeIdMapIterator"]=Hl,Hl.__name__="loreline._Node.NodeIdMapIterator",Object.assign(Hl.prototype,{__class__:Hl});class jl{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 Re.fromTwoInt32(e,t)}}j["loreline._Node.NodeIdMapKeyIterator"]=jl,jl.__name__="loreline._Node.NodeIdMapKeyIterator",Object.assign(jl.prototype,{__class__:jl});class Jl{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:Re.fromTwoInt32(e,t),value:i}}}j["loreline._Node.NodeIdMapKeyValueIterator"]=Jl,Jl.__name__="loreline._Node.NodeIdMapKeyValueIterator",Object.assign(Jl.prototype,{__class__:Jl});class Ft{constructor(e,t){Ft._hx_skip_constructor||this._hx_constructor(e,t)}_hx_constructor(e,t){this.id=Re.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){}static fromJson(e){return N.nodeFromJson(e)}}j["loreline.Node"]=Yi.loreline.Node=Ft,Ft.__name__="loreline.Node",Object.assign(Ft.prototype,{__class__:Ft});class Wi extends Ft{constructor(e,t,i,l,n){n==null&&(n=!1),super(e,t),this.content=i,this.multiline=l,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}}j["loreline.Comment"]=Wi,Wi.__name__="loreline.Comment",Wi.__super__=Ft,Object.assign(Wi.prototype,{__class__:Wi});class Le extends Ft{constructor(e,t,i,l){if(Ft._hx_skip_constructor){super();return}Ft._hx_skip_constructor=!0,super(),Ft._hx_skip_constructor=!1,this._hx_constructor(e,t,i,l)}_hx_constructor(e,t,i,l){super._hx_constructor(e,t),this.leadingComments=i,this.trailingComments=l}type(){return"AstNode"}eachComment(e){if(this.leadingComments!=null){let i=0,l=this.leadingComments;for(;i<l.length;){let n=l[i];++i,e(this,n)}}if(this.trailingComments!=null){let i=0,l=this.trailingComments;for(;i<l.length;){let n=l[i];++i,e(this,n)}}let t=this;this.each(function(i,l){if(i instanceof Le){let n=i;if(n.leadingComments!=null){let s=0,r=n.leadingComments;for(;s<r.length;){let h=r[s];++s,e(t,h)}}if(n.trailingComments!=null){let s=0,r=n.trailingComments;for(;s<r.length;){let h=r[s];++s,e(t,h)}}}})}each(e){if(super.each(e),this.leadingComments!=null){let t=0,i=this.leadingComments;for(;t<i.length;){let l=i[t];++t,e(l,this),l.each(e)}}if(this.trailingComments!=null){let t=0,i=this.trailingComments;for(;t<i.length;){let l=i[t];++t,e(l,this),l.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=[],l=0,n=this.leadingComments;for(;l<n.length;){let s=n[l];++l,i.push(s.toJson())}t.leading=i}if(this.trailingComments!=null&&this.trailingComments.length>0){let i=[],l=0,n=this.trailingComments;for(;l<n.length;){let s=n[l];++l,i.push(s.toJson())}t.trailing=i}e.comments=t}return e}}j["loreline.AstNode"]=Le,Le.__name__="loreline.AstNode",Le.__super__=Ft,Object.assign(Le.prototype,{__class__:Le});class at extends Le{constructor(e,t,i,l){super(e,t,i,l)}toJson(){return super.toJson()}type(){return"Expr"}}j["loreline.NExpr"]=at,at.__name__="loreline.NExpr",at.__super__=Le,Object.assign(at.prototype,{__class__:at});class Wt extends Le{constructor(e,t,i,l,n,s){super(e,t,n,s),this.temporary=i,this.fields=l,this.style=0}type(){return"State"}get(e){let t=0,i=this.fields;for(;t<i.length;){let l=i[t];if(++t,l.name==e)return l.value}return null}each(e){if(super.each(e),this.fields!=null){let t=0,i=this.fields.length;for(;t<i;){let l=t++,n=this.fields[l];e(n,this),n.each(e)}}}toJson(){let e=super.toJson();e.temporary=this.temporary;let t=[],i=0,l=this.fields;for(;i<l.length;){let n=l[i];++i,t.push(n.toJson())}return e.fields=t,e.style=Bi.toString(this.style),e}}j["loreline.NStateDecl"]=Wt,Wt.__name__="loreline.NStateDecl",Wt.__super__=Le,Object.assign(Wt.prototype,{__class__:Wt});class Fi extends Le{constructor(e,t,i,l,n,s){super(e,t,n,s),this.name=i,this.value=l}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}}j["loreline.NObjectField"]=Fi,Fi.__name__="loreline.NObjectField",Fi.__super__=Le,Object.assign(Fi.prototype,{__class__:Fi});class zt extends Le{constructor(e,t,i,l,n,s,r){super(e,t,s,r),this.name=i,this.namePos=l,this.fields=n,this.style=0}type(){return"Character"}get(e){let t=0,i=this.fields;for(;t<i.length;){let l=i[t];if(++t,l.name==e)return l.value}return null}each(e){if(super.each(e),this.fields!=null){let t=0,i=this.fields.length;for(;t<i;){let l=t++,n=this.fields[l];e(n,this),n.each(e)}}}toJson(){let e=super.toJson();e.name=this.name,e.namePos=this.namePos.toJson();let t=[],i=0,l=this.fields;for(;i<l.length;){let n=l[i];++i,t.push(n.toJson())}return e.fields=t,e.style=Bi.toString(this.style),e}}j["loreline.NCharacterDecl"]=zt,zt.__name__="loreline.NCharacterDecl",zt.__super__=Le,Object.assign(zt.prototype,{__class__:zt});class Me extends Le{constructor(e,t,i,l,n,s){super(e,t,n,s),this.name=i,this.body=l,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 l=t++,n=this.body[l];e(n,this),n.each(e)}}}toJson(){let e=super.toJson();e.name=this.name;let t=[],i=0,l=this.body;for(;i<l.length;){let n=l[i];++i,t.push(n.toJson())}return e.body=t,e.style=Bi.toString(this.style),e}}j["loreline.NBeatDecl"]=Me,Me.__name__="loreline.NBeatDecl",Me.__super__=Le,Object.assign(Me.prototype,{__class__:Me});var ze=Qe["loreline.StringPartType"]={__ename__:"loreline.StringPartType",__constructs__:null,Raw:(d=function(k){return{_hx_index:0,text:k,__enum__:"loreline.StringPartType",toString:S}},d._hx_name="Raw",d.__params__=["text"],d),Expr:(d=function(k){return{_hx_index:1,expr:k,__enum__:"loreline.StringPartType",toString:S}},d._hx_name="Expr",d.__params__=["expr"],d),Tag:(d=function(k,e){return{_hx_index:2,closing:k,expr:e,__enum__:"loreline.StringPartType",toString:S}},d._hx_name="Tag",d.__params__=["closing","expr"],d)};ze.__constructs__=[ze.Raw,ze.Expr,ze.Tag];class Bi{static toString(e){switch(e){case 0:return"Plain";case 1:return"Braces"}}}class Cl{static toString(e){switch(e){case 0:return"Plain";case 2:return"Parens"}}}class Tl{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 at{constructor(e,t,i,l,n){super(e,t,l,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 l=t.expr;e(l,this),l.each(e);break;case 2:let n=t.closing,s=t.expr;e(s,this),s.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 l=t.expr;e.part="Expr",e.expression=l.toJson();break;case 2:let n=t.closing,s=t.expr;e.part="Tag",e.closing=n,e.content=s.toJson();break}return e}}j["loreline.NStringPart"]=Je,Je.__name__="loreline.NStringPart",Je.__super__=at,Object.assign(Je.prototype,{__class__:Je});class Tt extends at{constructor(e,t,i,l,n,s){super(e,t,n,s),this.parts=l,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 l=t++,n=this.parts[l];e(n,this),n.each(e)}}}toJson(){let e=super.toJson(),t=[],i=0,l=this.parts;for(;i<l.length;){let s=l[i];++i,t.push(s.toJson())}let n=t;return e.parts=n,e.quotes=nn.toString(this.quotes),e}}j["loreline.NStringLiteral"]=Tt,Tt.__name__="loreline.NStringLiteral",Tt.__super__=at,Object.assign(Tt.prototype,{__class__:Tt});class ci extends Le{constructor(e,t,i,l,n){super(e,t,l,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=Cl.toString(this.conditionStyle),e.conditionPos=this.conditionPos.toJson()),e}}j["loreline.NTextStatement"]=ci,ci.__name__="loreline.NTextStatement",ci.__super__=Le,Object.assign(ci.prototype,{__class__:ci});class ti extends Le{constructor(e,t,i,l,n,s,r){super(e,t,s,r),this.character=i,this.characterPos=l,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=Cl.toString(this.conditionStyle),e.conditionPos=this.conditionPos.toJson()),e}}j["loreline.NDialogueStatement"]=ti,ti.__name__="loreline.NDialogueStatement",ti.__super__=Le,Object.assign(ti.prototype,{__class__:ti});class mi extends Le{constructor(e,t,i,l,n){super(e,t,l,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 l=t++,n=this.options[l];e(n,this),n.each(e)}}}toJson(){let e=super.toJson(),t=[],i=0,l=this.options;for(;i<l.length;){let n=l[i];++i,t.push(n.toJson())}return e.options=t,e.style=Bi.toString(this.style),e}}j["loreline.NChoiceStatement"]=mi,mi.__name__="loreline.NChoiceStatement",mi.__super__=Le,Object.assign(mi.prototype,{__class__:mi});class Et extends Le{constructor(e,t,i,l,n,s,r,h,a){super(e,t,h,a),this.text=i,this.insertion=l,this.condition=n,this.conditionStyle=s,this.body=r,this.style=0,this.once=!1}type(){return"Option"}each(e){if(super.each(e),this.body!=null){let t=0,i=this.body.length;for(;t<i;){let l=t++,n=this.body[l];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=Cl.toString(this.conditionStyle),e.conditionPos=this.conditionPos.toJson());let t=[],i=0,l=this.body;for(;i<l.length;){let n=l[i];++i,t.push(n.toJson())}return e.body=t,e.style=Bi.toString(this.style),this.once&&(e.once=!0),e}}j["loreline.NChoiceOption"]=Et,Et.__name__="loreline.NChoiceOption",Et.__super__=Le,Object.assign(Et.prototype,{__class__:Et});class ii extends Le{constructor(e,t,i,l,n){super(e,t,l,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 l=t++,n=this.body[l];e(n,this),n.each(e)}}}toJson(){let e=super.toJson(),t=[],i=0,l=this.body;for(;i<l.length;){let n=l[i];++i,t.push(n.toJson())}return e.body=t,e.style=Bi.toString(this.style),e}}j["loreline.NBlock"]=ii,ii.__name__="loreline.NBlock",ii.__super__=Le,Object.assign(ii.prototype,{__class__:ii});class gi extends Le{constructor(e,t,i,l,n,s,r,h,a,o){super(e,t,r,h),this.condition=i,this.conditionStyle=l,this.thenBranch=n,this.elseBranch=s,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 l=i[t];++t,e(l,this),l.each(e)}}if(this.elseTrailingComments!=null){let t=0,i=this.elseTrailingComments;for(;t<i.length;){let l=i[t];++t,e(l,this),l.each(e)}}}toJson(){let e=super.toJson();e.condition=this.condition.toJson(),e.conditionStyle=Cl.toString(this.conditionStyle);let t=[],i=0,l=this.thenBranch.body;for(;i<l.length;){let n=l[i];++i,t.push(n.toJson())}if(e.thenBranch=t,e.thenStyle=Bi.toString(this.thenBranch.style),this.elseBranch!=null){let n=[],s=0,r=this.elseBranch.body;for(;s<r.length;){let h=r[s];++s,n.push(h.toJson())}if(e.elseBranch=n,e.elseStyle=Bi.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=[],u=0,c=this.elseLeadingComments;for(;u<c.length;){let _=c[u];++u,o.push(_.toJson())}a.elseLeading=o}if(this.elseTrailingComments!=null&&this.elseTrailingComments.length>0){let o=[],u=0,c=this.elseTrailingComments;for(;u<c.length;){let _=c[u];++u,o.push(_.toJson())}a.elseTrailing=o}e.comments=a}}return e}}j["loreline.NIfStatement"]=gi,gi.__name__="loreline.NIfStatement",gi.__super__=Le,Object.assign(gi.prototype,{__class__:gi});class Ui extends Le{constructor(e,t,i,l,n,s){super(e,t,n,s),this.mode=i,this.items=l,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 l=t++,n=this.items[l];e(n,this),n.each(e)}}if(this.separatorComments!=null){let t=0,i=this.separatorComments;for(;t<i.length;){let l=i[t];if(++t,l!=null){let n=0;for(;n<l.length;){let s=l[n];++n,e(s,this),s.each(e)}}}}}toJson(){let e=super.toJson();e.mode=Tl.toString(this.mode);let t=[],i=0,l=this.items;for(;i<l.length;){let n=l[i];++i,t.push(n.toJson())}if(e.items=t,e.style=Bi.toString(this.style),this.separatorComments!=null){let n=[],s=0,r=this.separatorComments;for(;s<r.length;){let h=r[s];++s;let a;if(h!=null){let o=[],u=0;for(;u<h.length;){let c=h[u];++u,o.push(c.toJson())}a=o}else a=null;n.push(a)}e.separatorComments=n}return e}}j["loreline.NAlternative"]=Ui,Ui.__name__="loreline.NAlternative",Ui.__super__=Le,Object.assign(Ui.prototype,{__class__:Ui});class Rt extends at{constructor(e,t,i,l,n,s){super(e,t,n,s),this.target=i,this.args=l}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 l=i[t];++t,e(l,this),l.each(e)}}}toJson(){let e=super.toJson();e.target=this.target.toJson();let t=[],i=0,l=this.args;for(;i<l.length;){let n=l[i];++i,t.push(n.toJson())}return e.args=t,e}}j["loreline.NCall"]=Rt,Rt.__name__="loreline.NCall",Rt.__super__=at,Object.assign(Rt.prototype,{__class__:Rt});class Mi extends Le{constructor(e,t,i,l,n,s){super(e,t,n,s),this.target=i,this.targetPos=l}type(){return"Transition"}toJson(){let e=super.toJson();return e.target=this.target,e.targetPos=this.targetPos.toJson(),e}}j["loreline.NTransition"]=Mi,Mi.__name__="loreline.NTransition",Mi.__super__=Le,Object.assign(Mi.prototype,{__class__:Mi});class zi extends Le{constructor(e,t,i,l,n,s){super(e,t,n,s),this.target=i,this.targetPos=l}type(){return"Insertion"}toJson(){let e=super.toJson();return e.target=this.target,e.targetPos=this.targetPos.toJson(),e}}j["loreline.NInsertion"]=zi,zi.__name__="loreline.NInsertion",zi.__super__=Le,Object.assign(zi.prototype,{__class__:zi});class Li extends at{constructor(e,t,i,l,n,s,r,h){super(e,t,r,h),this.name=i,this.args=l,this.code=n,this.external=s}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}}j["loreline.NFunctionDecl"]=Li,Li.__name__="loreline.NFunctionDecl",Li.__super__=at,Object.assign(Li.prototype,{__class__:Li});class Ke extends at{constructor(e,t,i,l,n,s){super(e,t,n,s),this.value=i,this.literalType=l}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 l=0,n=this.value;for(;l<n.length;){let s=n[l];if(++l,s instanceof Ft){let r=s;e(r,this),r.each(e)}}}break;case 4:let i=t.style;if(this.value!=null){let l=0,n=this.value;for(;l<n.length;){let s=n[l];if(++l,s.value instanceof Ft){let r=s.value;e(r,this),r.each(e)}}}break}}toJson(){let e=super.toJson(),t=this.literalType;e.literal=Qe[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=[],s=0,r=this.value;for(;s<r.length;){let h=r[s];++s,h instanceof Ft?n.push(h.toJson()):n.push(h)}e.value=n}break;case 4:let l=i.style;if(this.value!=null){let n=[],s=0,r=this.value;for(;s<r.length;){let h=r[s];++s,n.push(h.toJson())}e.value=n}else e.value=[];e.style=Bi.toString(l);break}return e}}j["loreline.NLiteral"]=Ke,Ke.__name__="loreline.NLiteral",Ke.__super__=at,Object.assign(Ke.prototype,{__class__:Ke});var He=Qe["loreline.LiteralType"]={__ename__:"loreline.LiteralType",__constructs__:null,Number:{_hx_name:"Number",_hx_index:0,__enum__:"loreline.LiteralType",toString:S},Boolean:{_hx_name:"Boolean",_hx_index:1,__enum__:"loreline.LiteralType",toString:S},Null:{_hx_name:"Null",_hx_index:2,__enum__:"loreline.LiteralType",toString:S},Array:{_hx_name:"Array",_hx_index:3,__enum__:"loreline.LiteralType",toString:S},Object:(d=function(k){return{_hx_index:4,style:k,__enum__:"loreline.LiteralType",toString:S}},d._hx_name="Object",d.__params__=["style"],d)};He.__constructs__=[He.Number,He.Boolean,He.Null,He.Array,He.Object];class ut extends at{constructor(e,t,i,l,n,s){super(e,t,n,s),this.target=i,this.name=l}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}}j["loreline.NAccess"]=ut,ut.__name__="loreline.NAccess",ut.__super__=at,Object.assign(ut.prototype,{__class__:ut});class di extends at{constructor(e,t,i,l,n,s,r){super(e,t,s,r),this.target=i,this.op=l,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=le.string(this.op),e.value=this.value.toJson(),e}}j["loreline.NAssign"]=di,di.__name__="loreline.NAssign",di.__super__=at,Object.assign(di.prototype,{__class__:di});class pi extends at{constructor(e,t,i,l,n,s){super(e,t,n,s),this.target=i,this.index=l}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}}j["loreline.NArrayAccess"]=pi,pi.__name__="loreline.NArrayAccess",pi.__super__=at,Object.assign(pi.prototype,{__class__:pi});class Qt extends at{constructor(e,t,i,l,n,s,r){super(e,t,s,r),this.left=i,this.op=l,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=le.string(this.op),e.right=this.right.toJson(),e}}j["loreline.NBinary"]=Qt,Qt.__name__="loreline.NBinary",Qt.__super__=at,Object.assign(Qt.prototype,{__class__:Qt});class Ki extends at{constructor(e,t,i,l,n,s){super(e,t,n,s),this.op=i,this.operand=l}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=le.string(this.op),e.operand=this.operand.toJson(),e}}j["loreline.NUnary"]=Ki,Ki.__name__="loreline.NUnary",Ki.__super__=at,Object.assign(Ki.prototype,{__class__:Ki});class $i extends at{constructor(e,t,i,l,n,s,r){super(e,t,s,r),this.condition=i,this.trueExpr=l,this.falseExpr=n}type(){return"Ternary"}each(e){super.each(e),this.condition!=null&&(e(this.condition,this),this.condition.each(e)),this.trueExpr!=null&&(e(this.trueExpr,this),this.trueExpr.each(e)),this.falseExpr!=null&&(e(this.falseExpr,this),this.falseExpr.each(e))}toJson(){let e=super.toJson();return e.condition=this.condition.toJson(),e.trueExpr=this.trueExpr.toJson(),e.falseExpr=this.falseExpr.toJson(),e}}j["loreline.NTernary"]=$i,$i.__name__="loreline.NTernary",$i.__super__=at,Object.assign($i.prototype,{__class__:$i});class Yt extends Le{constructor(e,t,i,l,n,s){super(e,t,n,s),this.path=i,this.script=l}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(),this.script!=null&&(e.script=this.script.toJson()),e}}j["loreline.NImportStatement"]=Yt,Yt.__name__="loreline.NImportStatement",Yt.__super__=Le,Object.assign(Yt.prototype,{__class__:Yt});class ne{static isFields(e){return te.__implements(e,vi)||e instanceof Ee?!0:e instanceof Ri||typeof e=="number"&&(e|0)===e||typeof e=="number"||typeof e=="boolean"||typeof e=="string"?!1:!re.isArray(e)}static getField(e,t,i){return te.__implements(t,vi)?t.lorelineGet(e,i):t instanceof Ee?t.h[i]:We.getProperty(t,i)}static getFields(e,t){if(te.__implements(t,vi))return t.lorelineFields(e);if(t instanceof Ee){let i=[],l=t.h,n=l,s=Object.keys(l),r=s.length,h=0;for(;h<r;){let a=s[h++];i.push(a)}return i}else return We.fields(t)}static setField(e,t,i,l){te.__implements(t,vi)?t.lorelineSet(e,i,l):t instanceof Ee?t.h[i]=l:We.setProperty(t,i,l)}static removeField(e,t,i){if(te.__implements(t,vi))return t.lorelineRemove(e,i);if(t instanceof Ee){let l=t;return Object.prototype.hasOwnProperty.call(l.h,i)?(delete l.h[i],!0):!1}else return We.deleteField(t,i)}static fieldExists(e,t,i){return te.__implements(t,vi)?t.lorelineExists(e,i):t instanceof Ee?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 getBeatHelper(e,t){return e.beatHelpers.h[t]}static createFields(e,t,i){if(e!=null&&e.customCreateFields!=null){let l=e.customCreateFields(e,t,i);if(l!=null)return l}if(t!=null){let l=Object.create(j[t].prototype);return te.__implements(l,vi)&&l.lorelineCreate(e),l}return new Ee}}j["loreline.Objects"]=ne,ne.__name__="loreline.Objects";class Ne extends ai{constructor(e,t){super(e,t)}}j["loreline.ParseError"]=Ne,Ne.__name__="loreline.ParseError",Ne.__super__=ai,Object.assign(Ne.prototype,{__class__:Ne});class El{constructor(e,t,i,l){this.imported=new Ee,this.rootPath=e,this.path=t,this.imports=i,l!=null&&(this.imported=l)}}j["loreline.ParserContext"]=El,El.__name__="loreline.ParserContext",Object.assign(El.prototype,{__class__:El});class qi{constructor(e,t){this.tokens=e,this.current=0,this.errors=null,this.pendingComments=null,this.lastTokenEnd=new he(1,1,0),this.lastLineBreak=null,this.lineBreakAfterToken=!1,this.currentNodeId=Re.UNDEFINED,this.rootBeat=null,this.context=t}parse(){let e=this.currentPos(),t=[],i=new _i(this.nextNodeId(4),e,t);for(;!this.isAtEnd();)try{let l=this.parseNode(!0);for(l!=null&&t.push(l);this.match(x.LineBreak););}catch(l){let n=b.caught(l).unwrap();if(n instanceof Ne){let s=n;this.addError(s),this.synchronize()}else throw l}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 51:let i=t.content;++e;break;case 52:let l=t.content;++e;break;case 53:let n=t.content;++e;break;case 56:++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==x.LineBreak);){this.current++;let i=this.tokens[this.current].type;switch(i._hx_index){case 51:let l=i.content;this.pendingComments==null&&(this.pendingComments=[]),this.pendingComments.push(new Wi(this.nextNodeId(4),this.currentPos(),l,!1));break;case 52:let n=i.content;this.pendingComments==null&&(this.pendingComments=[]),this.pendingComments.push(new Wi(this.nextNodeId(4),this.currentPos(),n,!0));break;case 53:let s=i.content;this.pendingComments==null&&(this.pendingComments=[]),this.pendingComments.push(new Wi(this.nextNodeId(4),this.currentPos(),s,!1,!0));break;case 56: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(Ot.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 51:let i=t.content;break;case 52:let l=t.content;break;case 53:let n=t.content;break;case 54:case 55:case 56: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 51:let i=t.content;break;case 52:let l=t.content;break;case 53:let n=t.content;break;case 54:case 55:case 56: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 51:let i=t.content;break;case 52:let l=t.content;break;case 53:let n=t.content;break;case 56: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 he(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?Ot.toCodeString(t):null}return null}check(e){return this.isAtEnd()?!1:e._hx_index==41?this.tokens[this.current].type==x.Colon:Ot.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,l=e.s;return!0}else return!1}isAtEnd(){return this.current<this.tokens.length?this.tokens[this.current].type==x.Eof:!0}isComment(e){switch(e._hx_index){case 51:let t=e.content;return!0;case 52:let i=e.content;return!0;case 53:let l=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==x.LineBreak;){if(this.isComment(this.tokens[this.current].type)){this.pendingComments==null&&(this.pendingComments=[]);let l=this.pendingComments,n=this.nextNodeId(4),s=this.currentPos(),r=this.tokens[this.current].type,h;switch(r._hx_index){case 51:h=r.content;break;case 52:h=r.content;break;case 53:h=r.content;break;default:h=""}let a=this.tokens[this.current].type,o;if(a._hx_index==52){let _=a.content;o=!0}else o=!1;let u=this.tokens[this.current].type,c;if(u._hx_index==53){let _=u.content;c=!0}else c=!1;l.push(new Wi(n,s,h,o,c))}if(this.advance(),this.isAtEnd())throw b.thrown(new Ne("Unexpected end of file",this.currentPos()))}if(this.isAtEnd())throw b.thrown(new Ne("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 Ne("Unexpected: "+this.currentTokenTypeToString(),this.currentPos())),this.advance(),new Ke(this.nextNodeId(4),this.currentPos(),null,He.Null));case 4:let l=this.parseChoiceStatement();return e?t.wrapInRootBeat(l):l;case 5:let n=this.parseIfStatement();return e?t.wrapInRootBeat(n):n;case 7:if(this.advance(),!this.check(x.KwState))throw b.thrown(new Ne("Expected 'state' after 'new'",this.currentPos()));let s=this.parseStateDecl(!0);return e?t.wrapInRootBeat(s):s;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,u=i.external;return e?this.parseFunction():(this.addError(new Ne("Unexpected: "+this.currentTokenTypeToString(),this.currentPos())),this.advance(),new Ke(this.nextNodeId(4),this.currentPos(),null,He.Null));case 15:let c=i.quotes,_=i.s,f=i.attachments,m=this.parseTextStatement();return e?t.wrapInRootBeat(m):m;case 16:let g=i.n,w=this.parseExpressionStatement();return e?t.wrapInRootBeat(w):w;case 17:let y=i.b,T=this.parseExpressionStatement();return e?t.wrapInRootBeat(T):T;case 19:let E=i.name;if(this.peek().type==x.Colon){let v=this.parseDialogueStatement();return e?t.wrapInRootBeat(v):v}else{let v=this.parseExpressionStatement();return e?t.wrapInRootBeat(v):v}break;case 26:let C=this.parseInsertion();return e?t.wrapInRootBeat(C):C;case 18:case 27:case 39:case 45:case 47:case 49:let P=this.parseExpressionStatement();return e?t.wrapInRootBeat(P):P;case 40:let I=this.parseTransition();return e?t.wrapInRootBeat(I):I;default:return this.addError(new Ne("Unexpected: "+this.currentTokenTypeToString(),this.currentPos())),this.advance(),new Ke(this.nextNodeId(4),this.currentPos(),null,He.Null)}}wrapInRootBeat(e){let t,i=null;if(this.rootBeat==null){let l=this.currentPos();t=[],this.rootBeat=new Me(this.nextNodeId(1),l,"_",t),i=this.rootBeat}else t=this.rootBeat.body;return t.push(e),i}parseImport(){let e=this.currentPos();if(this.expect(x.KwImport),this.context==null)throw b.thrown(new Ne("Cannot import without a context",this.currentPos()));let t=0,i=this.tokens[this.current],l,n=i.type;if(n._hx_index==15){let c=n.attachments,_=n.quotes,f=n.s;t=_,l=f}else throw b.thrown(new Ne("Expected string literal for import path",this.currentPos()));let s=l;Nt.isAbsolute(s)||(s=Nt.join([Nt.directory(this.context.rootPath),s])),s=Nt.normalize(s);let r=".lor";if(this.context.rootPath.endsWith(".lor.txt")&&(r=".lor.txt"),s.toLowerCase().endsWith(r)||(s+=r),Object.prototype.hasOwnProperty.call(this.context.imported.h,s)){this.advance();let c=new Yt(this.nextNodeId(1),e.extendedTo(this.prevNonWhitespaceOrComment().pos),null,null);return c.path=new Tt(this.nextNodeId(4),i.pos,t,[new Je(this.nextNodeId(4),i.pos,ze.Raw(l))]),this.attachComments(c)}let h=this.context.imports.h[s];if(h==null)throw b.thrown(new Ne("Failed to import file at path "+s+" ("+l+")",this.currentPos()));let a=new qi(h,new El(this.context.rootPath,s,this.context.imports,this.context.imported));a.currentNodeId=this.currentNodeId;let o=a.parse();this.currentNodeId=a.currentNodeId,this.advance();let u=new Yt(this.nextNodeId(1),e.extendedTo(this.prevNonWhitespaceOrComment().pos),null,o);return u.path=new Tt(this.nextNodeId(4),i.pos,t,[new Je(this.nextNodeId(4),i.pos,ze.Raw(l))]),this.attachComments(u)}parseDialogueStatement(){let e=this.currentPos(),t=new ti(this.nextNodeId(4),e,null,null,null),i=this.tokens[this.current].type,l;if(i._hx_index==19)l=i.name;else throw b.thrown(new Ne("Expected character name",this.currentPos()));t.character=l,t.characterPos=this.tokens[this.current].pos,this.advance(),this.expect(x.Colon),this.attachComments(t);let n=!1;if(this.checkBlockStart()){let s=this.parseBlockStart();if(s.type!=x.Indent)throw b.thrown(new Ne("Expected indent, got "+Ot.toCodeString(s.type),s.pos));n=!0}try{t.content=this.parseStringLiteral()}catch(s){let r=b.caught(s).unwrap();if(r instanceof Ne){let h=r;this.addError(h),t.content=new Tt(this.nextNodeId(4),this.currentPos(),0,[new Je(this.nextNodeId(4),this.currentPos(),ze.Raw("?"))])}else throw s}if(!this.lineBreakAfterToken&&this.match(x.KwIf)){let s=this.previous().pos;this.check(x.LParen)&&(t.conditionStyle=2),t.condition=this.parseConditionExpression(),t.conditionPos=s.extendedTo(this.prevNonWhitespaceOrComment().pos)}if(n){for(;this.match(x.LineBreak););this.expect(x.Unindent)}return t.pos=t.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),t}parseStatementBlock(e){let t=this.parseBlockStart().type==x.Indent?x.Unindent:x.RBrace;for(;!this.check(t)&&!this.isAtEnd();){for(;this.match(x.LineBreak)||t!=x.Unindent&&this.match(x.Unindent););if(this.check(t))break;try{e.push(this.parseNode())}catch(i){let l=b.caught(i).unwrap();if(l instanceof Ne){let n=l;if(this.errors==null&&(this.errors=[]),this.errors.push(n),this.synchronize(),this.check(t))break}else throw i}for(;this.match(x.LineBreak)||t!=x.Unindent&&this.match(x.Unindent););}return this.expect(t),t==x.RBrace?1:0}parseStateDecl(e){let t=this.currentPos(),i=new Wt(this.nextNodeId(3),t,e,[]);this.expect(x.KwState);let l=this.parseBlockStart().type==x.Indent?x.Unindent:x.RBrace;for(i.style=l==x.RBrace?1:0,this.attachComments(i);!this.check(l)&&!this.isAtEnd();){for(;this.match(x.LineBreak)||l!=x.Unindent&&this.match(x.Unindent););for(i.fields.push(this.parseObjectField());this.match(x.LineBreak)||l!=x.Unindent&&this.match(x.Unindent););}for(;this.match(x.LineBreak)||l!=x.Unindent&&this.match(x.Unindent););return this.expect(l),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(x.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 Me(this.nextNodeId(1),e,null,[],[]);this.expect(x.KwBeat),t.pos=e.extendedTo(this.currentPos()),t.name=this.expectIdentifier();let l=this.parseBlockStart().type==x.Indent?x.Unindent:x.RBrace;for(t.style=l==x.RBrace?1:0,this.attachComments(t);!this.check(l)&&!this.isAtEnd();){for(;this.match(x.LineBreak)||l!=x.Unindent&&this.match(x.Unindent););for(t.body.push(this.parseNode());this.match(x.LineBreak)||l!=x.Unindent&&this.match(x.Unindent););}for(;this.match(x.LineBreak)||l!=x.Unindent&&this.match(x.Unindent););return this.expect(l),t.pos=t.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),t}checkBlockStart(){let e=null,t=null,i=0,l=0;for(;this.current+l<this.tokens.length;){let n=this.tokens[this.current+l];if(++l,n.type!=x.LineBreak){if(n.type==x.Indent){++i,e=n;continue}if(n.type==x.LBrace){t==null&&(t=n);continue}break}}if(t!=null)return!0;if(e!=null){if(i>1)throw b.thrown(new Ne("Invalid indentation level",e.pos));return!0}else return!1}parseBlockStart(){let e=null,t=null,i=0;for(;!this.isAtEnd();)if(!this.match(x.LineBreak)){if(this.match(x.Indent)){++i,e=this.prevWithType(x.Indent);continue}if(this.match(x.LBrace)){t==null&&(t=this.prevWithType(x.LBrace));continue}break}if(t!=null)return t;if(e!=null){if(i>1)throw b.thrown(new Ne("Invalid indentation level",e.pos));return e}else return this.addError(new Ne("Expected "+Ot.toCodeString(x.LBrace)+" or "+Ot.toCodeString(x.Indent)+", got "+this.currentTokenTypeToString(),this.currentPos())),new ke(x.Indent,this.currentPos())}parseCharacterDecl(){let e=this.currentPos(),t=new zt(this.nextNodeId(3),e,null,null,[]);this.expect(x.KwCharacter),t.name=this.expectIdentifier(),t.namePos=this.prevNonWhitespaceOrComment().pos;let i=this.parseBlockStart().type==x.Indent?x.Unindent:x.RBrace;for(t.style=i==x.RBrace?1:0,this.attachComments(t);!this.check(i)&&!this.isAtEnd();){for(;this.match(x.LineBreak)||i!=x.Unindent&&this.match(x.Unindent););for(t.fields.push(this.parseObjectField());this.match(x.LineBreak)||i!=x.Unindent&&this.match(x.Unindent););}for(;this.match(x.LineBreak)||i!=x.Unindent&&this.match(x.Unindent););return this.expect(i),t.pos=t.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),t}parseTextStatement(){let e=this.currentPos(),t=this.attachComments(new ci(this.nextNodeId(4),e,null));if(t.content=this.parseStringLiteral(),!this.lineBreakAfterToken&&this.match(x.KwIf)){let i=this.previous().pos;this.check(x.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 mi(this.nextNodeId(2),e,[]);this.expect(x.KwChoice);let i=this.parseBlockStart().type==x.Indent?x.Unindent:x.RBrace;for(t.style=i==x.RBrace?1:0,this.attachComments(t);!this.check(i)&&!this.isAtEnd();){for(;this.match(x.LineBreak)||i!=x.Unindent&&this.match(x.Unindent););for(t.options.push(this.parseChoiceOption(i));this.match(x.LineBreak)||i!=x.Unindent&&this.match(x.Unindent););}return this.expect(i),t.pos=t.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),t}parseChoiceOption(e){let t=this.currentPos(),i=this.attachComments(new Et(this.nextNodeId(3),t,null,null,null,0,[])),l=null,n=!1;try{this.check(x.OpPlus)?(n=!0,i.insertion=this.parseInsertion()):(this.match(x.OpMinus)&&(i.once=!0),i.text=this.parseStringLiteral())}catch(s){let r=b.caught(s).unwrap();if(r instanceof Ne){let h=r;this.addError(h),l=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(),ze.Raw("?"))])}else throw s}if(this.match(x.KwIf)){let s=this.previous().pos,r=this.currentPos().offset;try{this.check(x.LParen)&&(i.conditionStyle=2),i.condition=this.parseConditionExpression(),i.conditionPos=s.extendedTo(this.prevNonWhitespaceOrComment().pos)}catch(h){let a=b.caught(h).unwrap();if(a instanceof Ne){let o=a;this.addError(o),l=this.currentPos(),this.currentPos().offset==r&&this.advance()}else throw h}}if(!n){if(this.checkBlockStart()){i.body=[];let s=this.currentPos().offset;try{i.style=this.parseStatementBlock(i.body)}catch(r){let h=b.caught(r).unwrap();if(h instanceof Ne){let a=h;this.addError(a),l=this.currentPos(),this.currentPos().offset==s&&this.advance(),i.body.length==0&&(i.body=[new Ke(this.nextNodeId(4),this.currentPos(),null,He.Null)])}else throw r}}else if(this.check(x.Arrow)){let s=this.currentPos().offset;try{i.body=[],i.body.push(this.parseNode())}catch(r){let h=b.caught(r).unwrap();if(h instanceof Ne){let a=h;this.addError(a),l=this.currentPos(),this.currentPos().offset==s&&this.advance(),i.body.length==0&&(i.body=[new Ke(this.nextNodeId(4),this.currentPos(),null,He.Null)])}else throw r}i.style=0}}if(i.pos=i.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),l!=null)for(;!this.isAtEnd()&&this.currentPos().line<=l.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,l=e.attachments;return!0;case 16:let n=e.n;return!0;case 17:let s=e.b;return!0;case 19:let r=e.name;return this.peek().type!=x.Colon;case 18:case 27:case 39:case 45:case 47:case 49:return!0;default:return!1}}parseExpressionStatement(){let e=this.parseExpression();if(this.match(x.OpAssign)||this.match(x.OpPlusAssign)||this.match(x.OpMinusAssign)||this.match(x.OpMultiplyAssign)||this.match(x.OpDivideAssign)||this.match(x.OpUnquotedAssign)){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,l=e.attachments;return!0;case 19:let n=e.name;return this.peek().type==x.Colon?!0:this.peek().type==x.Arrow;case 1:case 2:case 3:case 4:case 5:case 40:return!0;default:return!1}}parseIfStatement(){let e=this.currentPos(),t=new gi(this.nextNodeId(4),e,null,0,null,null);for(this.expect(x.KwIf),this.check(x.LParen)&&(t.conditionStyle=2),t.condition=this.parseConditionExpression();this.match(x.LineBreak););this.attachComments(t),t.thenBranch=new ii(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==x.KwElse){for(this.advance();this.match(x.LineBreak););if(this.attachElseComments(t,i),this.check(x.KwIf)){t.elseBranch=new ii(this.nextNodeId(3),this.currentPos(),null);let l=this.parseIfStatement();t.elseBranch.body=[l],t.elseBranch.style=0}else t.elseBranch=new ii(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 b.thrown(new Ne("Expected alternative keyword",this.currentPos()))}let i=new Ui(this.nextNodeId(2),e,t,[]);for(this.advance();this.match(x.LineBreak););this.attachComments(i);let l=new ii(this.nextNodeId(3),this.currentPos(),null);for(l.body=[],l.style=this.parseStatementBlock(l.body),i.items.push(l),i.style=l.style;this.check(x.Separator);){let n=this.tokens[this.current];for(this.advance();this.match(x.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 u=o[a];++a,u.pos.line<=n.pos.line?r.push(u):h.push(u)}i.separatorComments.push(r),this.pendingComments=h}let s=new ii(this.nextNodeId(3),this.currentPos(),null);s.body=[],s.style=this.parseStatementBlock(s.body),i.items.push(s)}return i.pos=i.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),i}parseTransition(){let e=this.currentPos();if(this.expect(x.Arrow),this.match(x.Dot))return this.attachComments(new Mi(this.nextNodeId(4),e.extendedTo(this.prevNonWhitespaceOrComment().pos),".",this.prevNonWhitespaceOrComment().pos));let t=this.expectIdentifier();return this.attachComments(new Mi(this.nextNodeId(4),e.extendedTo(this.prevNonWhitespaceOrComment().pos),t,this.prevNonWhitespaceOrComment().pos))}parseInsertion(){let e=this.currentPos();this.expect(x.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,l=t.args,n=t.code,s=t.external;return this.advance(),this.attachComments(new Li(this.nextNodeId(3),e,i,[].concat(l),n,s))}else throw b.thrown(new Ne("Unexpected token in expression",this.currentPos()))}parseExpression(){try{let e=this.parseTernary();if(this.check(x.OpAssign)||this.check(x.OpPlusAssign)||this.check(x.OpMinusAssign)||this.check(x.OpMultiplyAssign)||this.check(x.OpDivideAssign)||this.check(x.OpUnquotedAssign)){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=b.caught(e).unwrap();return t instanceof Ne&&this.addError(t),new Ke(this.nextNodeId(4),this.currentPos(),null,He.Null)}}parseTernary(){let e=this.parseLogicalOr();if(this.match(x.Question)){let t=this.parseTernary();this.expect(x.Colon);let i=this.parseTernary();e=this.attachComments(new $i(this.nextNodeId(4),e.pos,e,t,i)),e.pos=e.pos.extendedTo(i.pos)}return e}parseLogicalOr(){let e=this.parseLogicalAnd();for(;this.match(x.OpOr(!1));){let t=this.previous().type,i=this.attachComments(new Qt(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(x.OpAnd(!1));){let t=this.previous().type,i=this.attachComments(new Qt(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(x.OpEquals)||this.match(x.OpNotEquals);){let t=this.previous().type,i=this.attachComments(new Qt(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(x.OpGreater)||this.match(x.OpGreaterEq)||this.match(x.OpLess)||this.match(x.OpLessEq);){let t=this.previous().type,i=this.attachComments(new Qt(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(x.OpPlus)||this.match(x.OpMinus);){let t=this.previous().type,i=this.attachComments(new Qt(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(x.OpMultiply)||this.match(x.OpDivide)||this.match(x.OpModulo);){let t=this.previous().type,i=this.attachComments(new Qt(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(x.OpNot)||this.match(x.OpMinus)){let e=this.previous().type,t=this.attachComments(new Ki(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,l=t.s,n=t.attachments;return this.parsePostfix(e,this.parseStringLiteral());case 16:let s=t.n;return this.advance(),this.attachComments(new Ke(this.nextNodeId(4),e,s,He.Number));case 17:let r=t.b;return this.advance(),this.attachComments(new Ke(this.nextNodeId(4),e,r,He.Boolean));case 18:return this.advance(),this.attachComments(new Ke(this.nextNodeId(4),e,null,He.Null));case 19:let h=t.name;if(this.peek().type==x.Colon){let o=[this.parseObjectField()];return new Ke(this.nextNodeId(4),e.extendedTo(this.prevNonWhitespaceOrComment().pos),o,He.Object(0))}else return this.advance(),this.parseIdentifierExpression(e,h);break;case 45:return this.parsePostfix(e,this.parseObjectLiteral());case 47:this.advance();let a=this.parseExpression();return this.expect(x.RParen),this.parsePostfix(e,a);case 49:return this.parsePostfix(e,this.parseArrayLiteral());default:throw b.thrown(new Ne("Unexpected token in expression",this.currentPos()))}}parseStringLiteral(){let e=this.currentPos(),t=[],i=this.tokens[this.current].type;if(i._hx_index==15){let l=i.quotes,n=i.s,s=i.attachments,r=l!=0?e.withOffset(n,1,e.length-2):e,h=0;if(s==null||s.length==0){let c=this.makeStringPartPosition(r,n,0);c.length=r.length;let _=this.nextNodeId(4),f=this.nextNodeId(4);return t.push(new Je(f,c,ze.Raw(n))),this.advance(),this.attachComments(new Tt(_,e,l,t))}let a=this.attachComments(new Tt(this.nextNodeId(4),e,l,t)),o=0,u=s.length;for(;o<u;){let c=o++,_=s[c];switch(_._hx_index){case 0:let f=_.braces,m=_.inTag,g=_.expr,w=_.start,y=_.length;if(h>=w+y)continue;if(w>h){let P=this.makeStringPartPosition(r,n,h);P.length=w-h;let I=w-h;t.push(new Je(this.nextNodeId(4),P,ze.Raw(I!=null?p.substr(n,h,I):p.substr(n,h,null))))}t.push(this.parseStringInterpolation(f,m,g,w,y,n)),h=w+y;break;case 1:let T=_.closing,E=_.start,C=_.length;if(h>=E+C)continue;if(E>h){let P=this.makeStringPartPosition(r,n,h);P.length=E-h;let I=E-h;t.push(new Je(this.nextNodeId(4),P,ze.Raw(I!=null?p.substr(n,h,I):p.substr(n,h,null))))}t.push(this.parseStringTag(T,E,C,n,l,s)),h=E+C;break}}if(h<n.length){let c=this.makeStringPartPosition(r,n,h);c.length=n.length-h;let _=null;t.push(new Je(this.nextNodeId(4),c,ze.Raw(_!=null?p.substr(n,h,_):p.substr(n,h,null))))}if(this.advance(),this.pendingComments!=null){let c=null,_=0,f=this.pendingComments;for(;_<f.length;){let m=f[_];++_,m.pos.line==e.line?(a.trailingComments==null&&(a.trailingComments=[]),a.trailingComments.push(m)):(c==null&&(c=[]),c.push(m))}this.pendingComments=c}return a}else throw b.thrown(new Ne("Expected text, got "+this.currentTokenTypeToString(),this.currentPos()))}makeStringPartPosition(e,t,i){let l=e.line,n=e.column,s=0,r=i;for(;s<r;){let h=s++,a=p.cca(t,h);(a??-1)==10?(++l,n=1):++n}return new he(l,n,e.offset+i)}makeAccess(e,t,i,l){if(i!=null){if(i.length==0&&(this.errors==null||this.errors.length==0)&&this.addError(new Ne("Invalid access: "+(i!=null?"'"+i+"'":"null"),e)),t!=null)if(l!=null)e=new he(t.pos.line,t.pos.column,t.pos.offset,l.offset+i.length-t.pos.offset);else throw b.thrown(new Ne("Invalid access (missing name position)",e));else if(e.length==0){let n=l!=null?l.length:null;e=new he(e.line,e.column,e.offset,n??i.length)}}return new ut(this.nextNodeId(4),e,t,i)}parseStringInterpolation(e,t,i,l,n,s){let r=i[0],h=r!=null?r.pos:null,a=this.makeStringPartPosition(h??this.currentPos(),s,l);if(a.length=n,i.length==0){let c=i[0],_=c!=null?c.pos:null;this.addError(new Ne("Empty interpolation",_??this.currentPos()));let f=this.nextNodeId(4),m=this.nextNodeId(4),g=i[0],w=g!=null?g.pos:null;return new Je(f,a,ze.Expr(new Ke(m,w??this.currentPos(),null,He.Null)))}let o=null;if(!e&&i.length>0){let c=null,_=0,f=!1;for(;_<i.length;){let m=i[_];++_;let g=m.type;switch(g._hx_index){case 19:let w=g.name;if(c==null)c=this.attachComments(this.makeAccess(m.pos,null,w,null));else if(f)c=this.attachComments(this.makeAccess(m.pos,c,w,m.pos));else{this.addError(new Ne("Missing dot in field access",m.pos));let K=this.nextNodeId(4),G=this.nextNodeId(4),Y=i[0],$=Y!=null?Y.pos:null;return new Je(K,a,ze.Expr(new Ke(G,$??this.currentPos(),null,He.Null)))}f=!1;break;case 44:if(c==null){this.addError(new Ne("Leading dot in field access",m.pos));let K=this.nextNodeId(4),G=this.nextNodeId(4),Y=i[0],$=Y!=null?Y.pos:null;return new Je(K,a,ze.Expr(new Ke(G,$??this.currentPos(),null,He.Null)))}f=!0;break;case 47:if(c==null){this.addError(new Ne("Function call without target",m.pos));let K=this.nextNodeId(4),G=this.nextNodeId(4),Y=i[0],$=Y!=null?Y.pos:null;return new Je(K,a,ze.Expr(new Ke(G,$??this.currentPos(),null,He.Null)))}let y=m.pos,T=[],E=[],C=1;for(;_<i.length&&C>0;){let K=i[_];switch(++_,K.type._hx_index){case 43:C==1?E.length>0&&(T.push(E),E=[]):E.push(K);break;case 47:++C,E.push(K);break;case 48:--C,C>0?E.push(K):E.length>0&&T.push(E);break;default:E.push(K)}}if(C>0){this.addError(new Ne("Unterminated function call",y));let K=this.nextNodeId(4),G=this.nextNodeId(4),Y=i[0],$=Y!=null?Y.pos:null;return new Je(K,a,ze.Expr(new Ke(G,$??this.currentPos(),null,He.Null)))}let P=[],I=0;for(;I<T.length;){let K=T[I];++I;let G=new qi(K);G.currentNodeId=this.currentNodeId;let Y=G.parseExpression();P.push(Y),this.currentNodeId=G.currentNodeId}c=this.attachComments(new Rt(this.nextNodeId(4),y.extendedTo(i[_-1].pos),c,P)),f=!1;break;case 49:if(c==null){this.addError(new Ne("Array access without target",m.pos));let K=this.nextNodeId(4),G=this.nextNodeId(4),Y=i[0],$=Y!=null?Y.pos:null;return new Je(K,a,ze.Expr(new Ke(G,$??this.currentPos(),null,He.Null)))}let v=m.pos,F=[],B=1,A=null;for(;_<i.length&&B>0;){let K=i[_];switch(++_,K.type._hx_index){case 49:++B,F.push(K);break;case 50:--B,B>0&&F.push(K),A=K;break;default:F.push(K)}}if(B>0){this.addError(new Ne("Unterminated array access",v));let K=this.nextNodeId(4),G=this.nextNodeId(4),Y=i[0],$=Y!=null?Y.pos:null;return new Je(K,a,ze.Expr(new Ke(G,$??this.currentPos(),null,He.Null)))}let L=new qi(F);L.currentNodeId=this.currentNodeId;let z=L.parseExpression();this.currentNodeId=L.currentNodeId;let D=a.extendedTo(i[_-1].pos);D.length+=1,c=this.attachComments(new pi(this.nextNodeId(4),D,c,z)),f=!1;break;default:this.addError(new Ne("Unexpected token in field access: "+Ot.toCodeString(m.type),m.pos));let O=this.nextNodeId(4),q=this.nextNodeId(4),M=i[0],U=M!=null?M.pos:null;return new Je(O,a,ze.Expr(new Ke(q,U??this.currentPos(),null,He.Null)))}}f&&this.addError(new Ne("Trailing dot in field access",i[i.length-1].pos)),o=c}else{let c=new qi(i);c.currentNodeId=this.currentNodeId,o=c.parseExpression(),this.currentNodeId=c.currentNodeId,c.isAtEnd()||this.addError(new Ne("Unexpected tokens after interpolation expression",c.tokens[c.current].pos))}let u=new he(a.line,a.column+(e?1:0),a.offset-(e?2:0),n);return new Je(this.nextNodeId(4),u,ze.Expr(o))}parseStringTag(e,t,i,l,n,s){let r=this.currentPos();n!=0&&(r=r.withOffset(l,1,r.length-2));let h=this.makeStringPartPosition(r,l,t);h.length=i;let a=e?2:1,o=t+a,u=i-(e?3:2),c=o+u,_=this.nextNodeId(4),f=!1;if(s!=null){let y=0,T=s.length;e:for(;y<T;){let E=y++,C=s[E];switch(C._hx_index){case 0:let P=C.braces,I=C.inTag,v=C.expr,F=C.start,B=C.length,A=F+B;if(F>=o&&A<=c){f=!0;break e}break;case 1:let L=C.closing,z=C.start,D=C.length;continue}}}if(!f){let y=this.makeStringPartPosition(r,l,o);y.length=u;let T=this.nextNodeId(4),E=this.nextNodeId(4);return new Je(_,h,ze.Tag(e,this.attachComments(new Tt(T,y,0,[new Je(E,y,ze.Raw(u!=null?p.substr(l,o,u):p.substr(l,o,null)))]))))}let m=[],g=this.attachComments(new Tt(this.nextNodeId(4),h,0,m)),w=o;if(s!=null){let y=0,T=s.length;for(;y<T;){let E=y++,C=s[E];switch(C._hx_index){case 0:let P=C.inTag,I=C.braces,v=C.expr,F=C.start,B=C.length,A=F+B;if(F>=o&&A<=c){if(F>w){let q=this.makeStringPartPosition(r,l,o);q.length=F-o;let M=F-w;m.push(new Je(this.nextNodeId(4),q,ze.Raw(M!=null?p.substr(l,w,M):p.substr(l,w,null))))}let O=this.parseStringInterpolation(I,!0,v,F,B,l);O.pos=this.makeStringPartPosition(r,l,F),O.pos.length=B,m.push(O),w=A}break;case 1:let L=C.closing,z=C.start,D=C.length;continue}}}if(w<c){let y=null,T=this.makeStringPartPosition(h,y!=null?p.substr(l,t,y):p.substr(l,t,null),w-t+a);T.length=o+c-w;let E=c-w;m.push(new Je(this.nextNodeId(4),T,ze.Raw(E!=null?p.substr(l,w,E):p.substr(l,w,null))))}return new Je(_,h,ze.Tag(e,g))}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(x.Dot,!1)){let i=null,l=this.currentPos();this.checkIdentifier()?i=this.expectIdentifier():(this.addError(new Ne("Expected identifier after '.'",this.currentPos())),i=""),t=this.attachComments(this.makeAccess(e,t,i,l))}else if(this.match(x.LBracket)){let i=this.parseExpression();this.expect(x.RBracket);let l=e.extendedTo(this.previous().pos);t=this.attachComments(new pi(this.nextNodeId(4),l,t,i))}else if(this.match(x.LParen)){let i=this.parseCallArguments();t=this.attachComments(new Rt(this.nextNodeId(4),e.extendedTo(this.previous().pos),t,i))}else break;return t}parseArrayLiteral(){let e=this.currentPos(),t=[],i=new Ke(this.nextNodeId(4),e,t,He.Array);this.expect(x.LBracket),this.attachComments(i);let l=!1;for(;!this.check(x.RBracket)&&!this.isAtEnd();){if(l){for(;this.match(x.LineBreak);)l=!1;this.match(x.Comma)&&(l=!1)}for(;this.match(x.LineBreak)||this.match(x.Indent)||this.match(x.Unindent);)l=!1;if(!this.check(x.RBracket)&&l)throw b.thrown(new Ne("Expected comma or line break between elements",this.currentPos()));for(;this.match(x.LineBreak)||this.match(x.Indent)||this.match(x.Unindent););this.check(x.RBracket)||t.push(this.parseExpression());let n=this.previous();l=n.type!=x.Colon&&n.type!=x.LineBreak}for(;this.match(x.LineBreak)||this.match(x.Indent)||this.match(x.Unindent););return this.expect(x.RBracket),i.pos=i.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),i}parseObjectLiteral(){let e=this.currentPos(),t=[],i=this.parseBlockStart().type==x.Indent?x.Unindent:x.RBrace,l=i==x.RBrace?1:0,n=new Ke(this.nextNodeId(4),i!=x.RBrace?this.nextNonWhitespaceOrComment().pos:e,t,He.Object(l));this.attachComments(n);let s=!1;for(;!this.check(i)&&!this.isAtEnd();){if(s){for(;this.match(x.LineBreak)||i!=x.Unindent&&this.match(x.Unindent);)s=!1;this.match(x.Comma)&&(s=!1)}for(;this.match(x.LineBreak)||i!=x.Unindent&&this.match(x.Unindent);)s=!1;if(!this.check(i)&&s)throw b.thrown(new Ne("Expected comma or line break between fields",this.currentPos()));for(;this.match(x.LineBreak)||i!=x.Unindent&&this.match(x.Unindent););this.check(i)||t.push(this.parseObjectField());let r=this.previous();s=r.type!=x.Colon&&r.type!=x.LineBreak}for(;this.match(x.LineBreak)||i!=x.Unindent&&this.match(x.Unindent););return this.expect(i),n.pos=n.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),n}parseCallArguments(){let e=[];if(!this.check(x.RParen))do{for(;this.match(x.LineBreak););for(e.push(this.parseExpression());this.match(x.LineBreak););}while(this.match(x.Comma));return this.expect(x.RParen),e}parseConditionExpression(){let e=this.match(x.LParen),t=null;try{t=this.parseExpression(),t!=null&&te.getClass(t)==di&&this.addError(new Ne("Invalid condition expression: can't assign a variable here. Did you want to use '==' instead?",t.pos))}catch(i){let l=b.caught(i).unwrap();if(l instanceof Ne){let n=l;this.addError(n),t=new Ke(this.nextNodeId(4),this.currentPos(),null,He.Null)}else throw i}return e&&this.expect(x.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==x.LineBreak}expect(e){if(this.check(e))return this.advance();{let t=new Ne("Expected "+Ot.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 46:case 48:case 55:return this.addError(t),new ke(e,this.currentPos());default:}throw b.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 b.thrown(new Ne("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,l=0,n=this.pendingComments.length;for(;l<n;){let s=l++,r=this.pendingComments[s];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,l=[],n=0,s=this.pendingComments;for(;n<s.length;){let r=s[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)):l.push(r)}this.pendingComments=l}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,l=e.attachments;if(this.previous().type==x.RBrace)return;this.advance();break;case 40:this.advance(),(this.check(x.Dot)||Ot.isIdentifier(this.tokens[this.current].type))&&this.advance();return;case 1:case 2:case 3:case 4:case 5:case 46:case 54:return;default:this.advance()}}}requiresNewLine(){switch(this.tokens[this.current].type._hx_index){case 6:case 40:case 46:return!1;default:return!0}}addError(e){return this.errors==null&&(this.errors=[]),this.errors.includes(e)||this.errors.push(e),e}}j["loreline.Parser"]=qi,qi.__name__="loreline.Parser",Object.assign(qi.prototype,{__class__:qi});class he{constructor(e,t,i,l){l==null&&(l=0),this.line=e,this.column=t,this.offset=i,this.length=l}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,l){if(l==null&&(l=0),i==null&&(i=0),t==0)return new he(this.line,this.column,this.offset,i);let n=this.line,s=this.column,r=this.offset;if(t>0){let h=0;for(;h<t;){let a;if(r<l+e.length){let o=p.cca(e,r-l);a=(o??-1)==10}else a=!1;a?(++n,s=1):++s,++h,++r}}else{let h=0;for(;h>t;){--r;let a;if(r>=0){let o=p.cca(e,r-l);a=(o??-1)==10}else a=!1;if(a){--n;let o=1,u=r-1;for(;u>=0;){let c=p.cca(e,u-l);if((c??-1)==10)break;++o,--u}s=o}else--s;--h}}return r<0&&(r=0,n=1,s=1),new he(n,s,r,i)}extendedTo(e){return new he(this.line,this.column,this.offset,e.offset+e.length-this.offset)}static fromContentAndIndex(e,t,i){i==null&&(i=0);let l=1,n=1,s=0,r=e.length;for(t>r&&(t=r),t<0&&(t=0);s<t;){let h=p.cca(e,s);(h??-1)==10?(++l,n=1):++n,++s}return new he(l,n,t,i)}}j["loreline.Position"]=he,he.__name__="loreline.Position",Object.assign(he.prototype,{__class__:he});class nl{constructor(e,t){t==null&&(t=`
41
+ `),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 Xt}clear(){this._noLn=0,this._level=0,this._prevLevel=0,this._numEmptyLines=0,this._buf=new Xt}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;let t=p.cca(e,e.length-1);this._lastChar=t??-1;let i=e.length-1;for(;i>=0;){let l=p.cca(e,i),n=l??-1;if(n!=32&&n!=10&&n!=13&&n!=9){this._lastVisibleChar=n;break}--i}}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+=le.string(this._newline),this._beginLine++),this}tab(){let e=0,t=this._level;for(;e<t;){let i=e++;this._buf.b+=le.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 Xt,this._beginLine=1,this.printStringLiteral(e),this.enableComments=t;let i=Ae.trim(this.toString());return i=i.split(`
42
42
  `).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 Xt,this._beginLine=1;let i=0,l=e.parts;for(;i<l.length;){let s=l[i];++i;let r=s.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 u=r.closing,c=r.expr;this.write(u?"</":"<"),this.printStringLiteral(c),this.write(">");break}}this.enableComments=t;let n=Ae.trim(this.toString());return n=n.split(`
43
- `).join("\\n"),n}print(e){return this._noLn=0,this._level=0,this._prevLevel=0,this._numEmptyLines=0,this._buf=new Xt,this._beginLine=1,this.printNode(e),this.toString()}printNode(e,t){if(t==null&&(t=!1),e!=null)switch(te.getClass(e)){case ut:this.printAccess(e);break;case Ui:this.printAlternative(e);break;case ci:this.printArrayAccess(e);break;case di:this.printAssignment(e);break;case Me:this.printBeatDecl(e);break;case Qt:this.printBinary(e);break;case Rt:this.printCall(e);break;case zt:this.printCharacterDecl(e);break;case Et:this.printChoiceOption(e);break;case mi:this.printChoiceStatement(e);break;case ti:this.printDialogueStatement(e);break;case Li:this.printFunctionDecl(e);break;case gi:this.printIfStatement(e);break;case Yt:this.printImportStatement(e);break;case zi:this.printInsertion(e);break;case Ke:this.printLiteral(e);break;case Wt:this.printStateDecl(e);break;case Tt:this.printStringLiteral(e);break;case $i:this.printTernary(e);break;case ui:this.printTextStatement(e);break;case Mi:this.printTransition(e,t);break;case Ki:this.printUnary(e);break;case pi:this.printScript(e);break;default:let i=te.getClass(e);throw b.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 l=i[t];++t,l.multiline?(this.write("/*"+l.content+"*/"),this.newline()):l.isHash?(this.write("#"+l.content),this.newline()):(this.write("//"+l.content),this.newline())}}}printHashTrailingComments(e){if(this.enableComments&&e.trailingComments!=null){let t=0,i=e.trailingComments;for(;t<i.length;){let l=i[t];++t,l.isHash&&(this._lastChar!=32&&this._beginLine==0&&this.write(" "),this.write("#"+l.content),this.newline())}}}printTrailingComments(e){if(this.enableComments&&e.trailingComments!=null){let t=0,i=e.trailingComments;for(;t<i.length;){let l=i[t];++t,this._lastChar!=32&&this._beginLine==0&&this.write(" "),l.multiline?this.write("/*"+l.content+"*/ "):l.isHash?(this.write("#"+l.content),this.newline()):(this.write("//"+l.content),this.newline())}}}printImport(e){this.printLeadingComments(e),this.write('import "'+ne.string(e.path)+'"'),this.newline(),this.printTrailingComments(e)}printScript(e){let t=0,i=e.body;for(;t<i.length;){let l=i[t];++t,this._prevLevel=this._level,this.printNode(l)}}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,l=e.fields;for(;i<l.length;){let n=l[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 l=i[t];++t,this.printLeadingComments(l),this.write(""+l.name+": "),this.printTrailingComments(l),this.printNode(l.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 l=t++;this._prevLevel=this._level,this.printNode(e.body[l]),l<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 l=i[t];++t,this.printNode(l),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.once&&this.write("- "),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 Mi)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 l=i[t];++t,this.printNode(l),this._beginLine==0&&l!=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,l=0,n=e.thenBranch.body;for(;l<n.length;){let s=n[l];++l,this.printNode(s),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 s=e.elseBranch.body[0];(this._numEmptyLines-i>0||this.needsEmptyLines(s))&&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 s=0,r=e.elseBranch.body;for(;s<r.length;){let h=r[s];++s,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,l=e.items.length;for(;i<l;){let n=i++,s=e.items[n];this._level++;let r=0,h=s.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 nl(this._indent,`
43
+ `).join("\\n"),n}print(e){return this._noLn=0,this._level=0,this._prevLevel=0,this._numEmptyLines=0,this._buf=new Xt,this._beginLine=1,this.printNode(e),this.toString()}printNode(e,t){if(t==null&&(t=!1),e!=null)switch(te.getClass(e)){case ut:this.printAccess(e);break;case Ui:this.printAlternative(e);break;case pi:this.printArrayAccess(e);break;case di:this.printAssignment(e);break;case Me:this.printBeatDecl(e);break;case Qt:this.printBinary(e);break;case Rt:this.printCall(e);break;case zt:this.printCharacterDecl(e);break;case Et:this.printChoiceOption(e);break;case mi:this.printChoiceStatement(e);break;case ti:this.printDialogueStatement(e);break;case Li:this.printFunctionDecl(e);break;case gi:this.printIfStatement(e);break;case Yt:this.printImportStatement(e);break;case zi:this.printInsertion(e);break;case Ke:this.printLiteral(e);break;case Wt:this.printStateDecl(e);break;case Tt:this.printStringLiteral(e);break;case $i:this.printTernary(e);break;case ci:this.printTextStatement(e);break;case Mi:this.printTransition(e,t);break;case Ki:this.printUnary(e);break;case _i:this.printScript(e);break;default:let i=te.getClass(e);throw b.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 l=i[t];++t,l.multiline?(this.write("/*"+l.content+"*/"),this.newline()):l.isHash?(this.write("#"+l.content),this.newline()):(this.write("//"+l.content),this.newline())}}}printHashTrailingComments(e){if(this.enableComments&&e.trailingComments!=null){let t=0,i=e.trailingComments;for(;t<i.length;){let l=i[t];++t,l.isHash&&(this._lastChar!=32&&this._beginLine==0&&this.write(" "),this.write("#"+l.content),this.newline())}}}printTrailingComments(e){if(this.enableComments&&e.trailingComments!=null){let t=0,i=e.trailingComments;for(;t<i.length;){let l=i[t];++t,this._lastChar!=32&&this._beginLine==0&&this.write(" "),l.multiline?this.write("/*"+l.content+"*/ "):l.isHash?(this.write("#"+l.content),this.newline()):(this.write("//"+l.content),this.newline())}}}printImport(e){this.printLeadingComments(e),this.write('import "'+le.string(e.path)+'"'),this.newline(),this.printTrailingComments(e)}printScript(e){let t=0,i=e.body;for(;t<i.length;){let l=i[t];++t,this._prevLevel=this._level,this.printNode(l)}}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,l=e.fields;for(;i<l.length;){let n=l[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 l=i[t];++t,this.printLeadingComments(l),this.write(""+l.name+": "),this.printTrailingComments(l),this.printNode(l.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 l=t++;this._prevLevel=this._level,this.printNode(e.body[l]),l<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 l=i[t];++t,this.printNode(l),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.once&&this.write("- "),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 Mi)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 l=i[t];++t,this.printNode(l),this._beginLine==0&&l!=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,l=0,n=e.thenBranch.body;for(;l<n.length;){let s=n[l];++l,this.printNode(s),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 s=e.elseBranch.body[0];(this._numEmptyLines-i>0||this.needsEmptyLines(s))&&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 s=0,r=e.elseBranch.body;for(;s<r.length;){let h=r[s];++s,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,l=e.items.length;for(;i<l;){let n=i++,s=e.items[n];this._level++;let r=0,h=s.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 nl(this._indent,`
44
44
  `).print(e).indexOf(`
45
45
 
46
46
  `)!=-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,l=e.parts;for(;i<l.length;){let n=l[i];++i;let s=n.partType;switch(s._hx_index){case 0:let r=s.text;t?this.writeQuotedRaw(r):this.writeUnquotedRaw(r);break;case 1:let h=s.expr,a=this.isSimpleInterpolationExpr(h);this.write("$"),a||this.write("{"),this.printNode(h),a||this.write("}");break;case 2:let o=s.closing,u=s.expr;this.write(o?"</":"<"),this.printStringLiteral(u),this.write(">");break}}t?(this.write('"'),this.printTrailingComments(e)):this.printHashTrailingComments(e)}writeUnquotedRaw(e){this.writeRawWithContinuation(e,!0)}writeQuotedRaw(e){if(e.indexOf(`
47
47
  `)==-1){this.write(e);return}let t=e.split(`
48
- `),i=0,l=t.length;for(;i<l;){let n=i++;n>0&&(this._buf.b+=ne.string(this._newline));let s=t[n],r;if(s.length>0){let h=p.cca(s,s.length-1);r=(h??-1)==13}else r=!1;if(r){let h=s.length-1;s=h!=null?s.substring(0,h):s.substring(0)}if(s.length>0){this._buf.b+=s==null?"null":""+s;let h=p.cca(s,s.length-1);this._lastChar=h??-1}}}writeRawWithContinuation(e,t){if(e.indexOf(`
48
+ `),i=0,l=t.length;for(;i<l;){let n=i++;n>0&&(this._buf.b+=le.string(this._newline));let s=t[n],r;if(s.length>0){let h=p.cca(s,s.length-1);r=(h??-1)==13}else r=!1;if(r){let h=s.length-1;s=h!=null?s.substring(0,h):s.substring(0)}if(s.length>0){this._buf.b+=s==null?"null":""+s;let h=p.cca(s,s.length-1);this._lastChar=h??-1}}}writeRawWithContinuation(e,t){if(e.indexOf(`
49
49
  `)==-1){this.write(e);return}let i=e.split(`
50
- `),l=0,n=i.length;for(;l<n;){let s=l++;s>0&&(this._buf.b+=ne.string(this._newline),this._beginLine=1);let r=i[s],h;if(r.length>0){let a=p.cca(r,r.length-1);h=(a??-1)==13}else h=!1;if(h){let a=r.length-1;r=a!=null?r.substring(0,a):r.substring(0)}if(t&&s>0){let a=0;for(;;){let o;if(a<r.length){let u=p.cca(r,a);if((u??-1)!=32){let c=p.cca(r,a);o=(c??-1)==9}else o=!0}else o=!1;if(!o)break;++a}if(a>0){let o=null;r=o!=null?r.substring(a,o):r.substring(a)}}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":ne.string(e.value));break;case 1:this.write(e.value?"true":"false");break;case 2:this.write("null");break;case 3:let i=!1,l=0,n=e.value;for(;l<n.length;){let o=n[l];if(++l,this.hasRealNewlines(o)){i=!0;break}}if(i){this.write("["),this.newline(),this._level++;let o=!0,u=0,c=e.value;for(;u<c.length;){let _=c[u];++u,o||(this.write(","),this.newline()),o=!1,this.printNode(_)}this.newline(),this._level--,this.write("]")}else{let o=!0;this.write("[");let u=0,c=e.value;for(;u<c.length;){let _=c[u];++u,o||this.write(", "),o=!1,this.printNode(_)}this.write("]")}break;case 4:let s=t.style;s==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--,s==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,l=e.args;for(;i<l.length;){let n=l[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 l=e.op;switch(l._hx_index){case 37:let n=l.word;i=!0;break;case 38:let s=l.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)}printTernary(e){this.printLeadingComments(e),this.printNode(e.condition),this.write(" ? "),this.printNode(e.trueExpr),this.write(" : "),this.printNode(e.falseExpr),this.printTrailingComments(e)}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 Qt?this.printBinary(e,!0):this.printNode(e),t&&this.write(")"),this.enableComments=i}isSimpleInterpolationExpr(e){if(e instanceof ut){let t=e;return t.target==null?!0:this.isSimpleInterpolationExpr(t.target)}return e instanceof ci?this.isSimpleInterpolationExpr(te.__cast(e,ci).target):e instanceof Rt?this.isSimpleInterpolationExpr(te.__cast(e,Rt).target):!1}hasRealNewlines(e){if(e instanceof Tt){let t=e;if(t.quotes==1)return!1;let i=0,l=t.parts;for(;i<l.length;){let n=l[i];++i;let s=n.partType;if(s._hx_index==0&&s.text.indexOf(`
51
- `)!=-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"<=";case 37:return e.word?"and":"&&";case 38:return e.word?"or":"||";case 39:return"!";default:throw b.thrown("Unsupported operator: "+ne.string(e))}}}j["loreline.Printer"]=nl,nl.__name__="loreline.Printer",Object.assign(nl.prototype,{__class__:nl});class nn{static toString(e){switch(e){case 0:return"Unquoted";case 1:return"DoubleQuotes"}}}class _l{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}}j["loreline.Random"]=_l,_l.__name__="loreline.Random",Object.assign(_l.prototype,{__class__:_l});class pi extends Le{constructor(e,t,i){Ft._hx_skip_constructor=!0,super(),Ft._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,l=this.body;for(;i<l.length;){let n=l[i];++i,t.push(n.toJson())}return e.body=t,e.indentSize=this.indentSize,e}type(){return"Script"}eachExcludingImported(e){if(super.each(e),this.body!=null){let t=0,i=this.body;for(;t<i.length;){let l=i[t];++t,e(l,this),l instanceof Yt||l.each(e)}}}each(e){if(super.each(e),this.body!=null){let t=0,i=this.body;for(;t<i.length;){let l=i[t];++t,e(l,this),l.each(e)}}}iterator(){return new Gl(this.body)}static fromJson(e){return N.scriptFromJson(e)}}j["loreline.Script"]=Yi.loreline.Script=pi,pi.__name__="loreline.Script",pi.__super__=Le,Object.assign(pi.prototype,{__class__:pi});class Gl{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 l=t++,n=e[l];if(n instanceof Yt){let s=n;s.script!=null&&this.fillBody(s.script.body)}this.flatBody.push(e[l])}}hasNext(){return this.index<this.flatBody.length}next(){let e=this.flatBody[this.index];return this.index++,e}}j["loreline._Script.ScriptBodyIterator"]=Gl,Gl.__name__="loreline._Script.ScriptBodyIterator",Object.assign(Gl.prototype,{__class__:Gl});class $l{constructor(e,t){this.remaining=e,this.done=t}}j["loreline._Timer.PendingTimer"]=$l,$l.__name__="loreline._Timer.PendingTimer",Object.assign($l.prototype,{__class__:$l});class Hi{static register(e,t){Hi.timers.push(new $l(e,t))}static update(e){if(Hi.timers.length==0)return;let t=Hi.timers.length;for(;--t>=0;){let i=Hi.timers[t];i.remaining-=e,i.remaining<=0&&(Hi.timers.splice(t,1),i.done())}}}j["loreline.Timer"]=Hi,Hi.__name__="loreline.Timer";class _n{static uLength(e){return e.length}static uSubstr(e,t,i){return i!=null?p.substr(e,t,i):p.substr(e,t,null)}static uSubstring(e,t,i){return i!=null?e.substring(t,i):e.substring(t)}static uCharCodeAt(e,t){let i=p.cca(e,t);return i??-1}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)}}j["loreline.Utf8"]=_n,_n.__name__="loreline.Utf8";class Sl extends ai{constructor(e,t,i){super(t,i),this.wrapped=e}}j["loreline.WrappedError"]=Sl,Sl.__name__="loreline.WrappedError",Sl.__super__=ai,Object.assign(Sl.prototype,{__class__:Sl});class sn{static main(){}}j["loreline.lib.Library"]=sn,sn.__name__="loreline.lib.Library";function fn(k){return k instanceof Array?new Ti(k):k.iterator()}function Te(k,e){if(e==null)return null;e.__id__==null&&(e.__id__=Zl.$haxeUID++);var t;return k.hx__closures__==null?k.hx__closures__={}:t=k.hx__closures__[e.__id__],t==null&&(t=e.bind(k),k.hx__closures__[e.__id__]=t),t}Zl.$haxeUID|=0,typeof performance<"u"&&typeof performance.now=="function"&&(p.now=performance.now.bind(performance)),j.Math=Math,String.fromCodePoint==null&&(String.fromCodePoint=function(k){return k<65536?String.fromCharCode(k):String.fromCharCode((k>>10)+55232)+String.fromCharCode((k&1023)+56320)});{Object.defineProperty(String.prototype,"__class__",{value:j.String=String,enumerable:!1,writable:!0}),String.__name__="String",j.Array=Array,Array.__name__="Array",Date.prototype.__class__=j.Date=Date,Date.__name__="Date";var xn={},wn={},kn=Number,yn=Boolean,bn={},Cn={}}te.__toStr={}.toString,Z.Element=0,Z.PCData=1,Z.CData=2,Z.Document=6,Mt.randomId_nonHexChars="ghijklmnopqrstuvwxyz",Mt.randomId_chars="0123456789abcdefghijklmnopqrstuvwxyz",ul.ObjectBrace=0,ul.ArrayBracket=1,ul.Brace=2,ul.Indent=3,ul.CaseIndent=4,ul.Bracket=5,ul.Paren=6,Ji.CONTROL_KEYWORDS=["for","while","if","else","switch","catch"],wi.INITIAL_SIZE=16,wi.LOAD_FACTOR=.75,Ni.ChoiceBrace=0,Ni.ChoiceIndent=1,Ni.StateBrace=2,Ni.StateIndent=3,Ni.CharacterBrace=4,Ni.CharacterIndent=5,Ni.BeatBrace=6,Ni.BeatIndent=7,Ni.AlternativeBrace=8,Ni.AlternativeIndent=9,Ni.Brace=10,Ni.Indent=11,Ni.Bracket=12,yt.hasNonSpecialChar_specialChars=` "+=*/-(){}[]:
50
+ `),l=0,n=i.length;for(;l<n;){let s=l++;s>0&&(this._buf.b+=le.string(this._newline),this._beginLine=1);let r=i[s],h;if(r.length>0){let a=p.cca(r,r.length-1);h=(a??-1)==13}else h=!1;if(h){let a=r.length-1;r=a!=null?r.substring(0,a):r.substring(0)}if(t&&s>0){let a=0;for(;;){let o;if(a<r.length){let u=p.cca(r,a);if((u??-1)!=32){let c=p.cca(r,a);o=(c??-1)==9}else o=!0}else o=!1;if(!o)break;++a}if(a>0){let o=null;r=o!=null?r.substring(a,o):r.substring(a)}}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":le.string(e.value));break;case 1:this.write(e.value?"true":"false");break;case 2:this.write("null");break;case 3:let i=!1,l=0,n=e.value;for(;l<n.length;){let o=n[l];if(++l,this.hasRealNewlines(o)){i=!0;break}}if(i){this.write("["),this.newline(),this._level++;let o=!0,u=0,c=e.value;for(;u<c.length;){let _=c[u];++u,o||(this.write(","),this.newline()),o=!1,this.printNode(_)}this.newline(),this._level--,this.write("]")}else{let o=!0;this.write("[");let u=0,c=e.value;for(;u<c.length;){let _=c[u];++u,o||this.write(", "),o=!1,this.printNode(_)}this.write("]")}break;case 4:let s=t.style;s==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--,s==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,l=e.args;for(;i<l.length;){let n=l[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 l=e.op;switch(l._hx_index){case 37:let n=l.word;i=!0;break;case 38:let s=l.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)}printTernary(e){this.printLeadingComments(e),this.printNode(e.condition),this.write(" ? "),this.printNode(e.trueExpr),this.write(" : "),this.printNode(e.falseExpr),this.printTrailingComments(e)}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 Qt?this.printBinary(e,!0):this.printNode(e),t&&this.write(")"),this.enableComments=i}isSimpleInterpolationExpr(e){if(e instanceof ut){let t=e;return t.target==null?!0:this.isSimpleInterpolationExpr(t.target)}return e instanceof pi?this.isSimpleInterpolationExpr(te.__cast(e,pi).target):e instanceof Rt?this.isSimpleInterpolationExpr(te.__cast(e,Rt).target):!1}hasRealNewlines(e){if(e instanceof Tt){let t=e;if(t.quotes==1)return!1;let i=0,l=t.parts;for(;i<l.length;){let n=l[i];++i;let s=n.partType;if(s._hx_index==0&&s.text.indexOf(`
51
+ `)!=-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"<=";case 37:return e.word?"and":"&&";case 38:return e.word?"or":"||";case 39:return"!";default:throw b.thrown("Unsupported operator: "+le.string(e))}}}j["loreline.Printer"]=nl,nl.__name__="loreline.Printer",Object.assign(nl.prototype,{__class__:nl});class nn{static toString(e){switch(e){case 0:return"Unquoted";case 1:return"DoubleQuotes"}}}class _l{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}}j["loreline.Random"]=_l,_l.__name__="loreline.Random",Object.assign(_l.prototype,{__class__:_l});class _i extends Le{constructor(e,t,i){Ft._hx_skip_constructor=!0,super(),Ft._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,l=this.body;for(;i<l.length;){let n=l[i];++i,t.push(n.toJson())}return e.body=t,e.indentSize=this.indentSize,e}type(){return"Script"}eachExcludingImported(e){if(super.each(e),this.body!=null){let t=0,i=this.body;for(;t<i.length;){let l=i[t];++t,e(l,this),l instanceof Yt||l.each(e)}}}each(e){if(super.each(e),this.body!=null){let t=0,i=this.body;for(;t<i.length;){let l=i[t];++t,e(l,this),l.each(e)}}}iterator(){return new Gl(this.body)}static fromJson(e){return N.scriptFromJson(e)}}j["loreline.Script"]=Yi.loreline.Script=_i,_i.__name__="loreline.Script",_i.__super__=Le,Object.assign(_i.prototype,{__class__:_i});class Gl{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 l=t++,n=e[l];if(n instanceof Yt){let s=n;s.script!=null&&this.fillBody(s.script.body)}this.flatBody.push(e[l])}}hasNext(){return this.index<this.flatBody.length}next(){let e=this.flatBody[this.index];return this.index++,e}}j["loreline._Script.ScriptBodyIterator"]=Gl,Gl.__name__="loreline._Script.ScriptBodyIterator",Object.assign(Gl.prototype,{__class__:Gl});class $l{constructor(e,t){this.remaining=e,this.done=t}}j["loreline._Timer.PendingTimer"]=$l,$l.__name__="loreline._Timer.PendingTimer",Object.assign($l.prototype,{__class__:$l});class Hi{static register(e,t){Hi.timers.push(new $l(e,t))}static update(e){if(Hi.timers.length==0)return;let t=Hi.timers.length;for(;--t>=0;){let i=Hi.timers[t];i.remaining-=e,i.remaining<=0&&(Hi.timers.splice(t,1),i.done())}}}j["loreline.Timer"]=Hi,Hi.__name__="loreline.Timer";class _n{static uLength(e){return e.length}static uSubstr(e,t,i){return i!=null?p.substr(e,t,i):p.substr(e,t,null)}static uSubstring(e,t,i){return i!=null?e.substring(t,i):e.substring(t)}static uCharCodeAt(e,t){let i=p.cca(e,t);return i??-1}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)}}j["loreline.Utf8"]=_n,_n.__name__="loreline.Utf8";class Sl extends ai{constructor(e,t,i){super(t,i),this.wrapped=e}}j["loreline.WrappedError"]=Sl,Sl.__name__="loreline.WrappedError",Sl.__super__=ai,Object.assign(Sl.prototype,{__class__:Sl});class sn{static main(){}}j["loreline.lib.Library"]=sn,sn.__name__="loreline.lib.Library";function fn(k){return k instanceof Array?new Ti(k):k.iterator()}function Te(k,e){if(e==null)return null;e.__id__==null&&(e.__id__=Zl.$haxeUID++);var t;return k.hx__closures__==null?k.hx__closures__={}:t=k.hx__closures__[e.__id__],t==null&&(t=e.bind(k),k.hx__closures__[e.__id__]=t),t}Zl.$haxeUID|=0,typeof performance<"u"&&typeof performance.now=="function"&&(p.now=performance.now.bind(performance)),j.Math=Math,String.fromCodePoint==null&&(String.fromCodePoint=function(k){return k<65536?String.fromCharCode(k):String.fromCharCode((k>>10)+55232)+String.fromCharCode((k&1023)+56320)});{Object.defineProperty(String.prototype,"__class__",{value:j.String=String,enumerable:!1,writable:!0}),String.__name__="String",j.Array=Array,Array.__name__="Array",Date.prototype.__class__=j.Date=Date,Date.__name__="Date";var xn={},wn={},kn=Number,yn=Boolean,bn={},Cn={}}te.__toStr={}.toString,Z.Element=0,Z.PCData=1,Z.CData=2,Z.Document=6,Mt.randomId_nonHexChars="ghijklmnopqrstuvwxyz",Mt.randomId_chars="0123456789abcdefghijklmnopqrstuvwxyz",ul.ObjectBrace=0,ul.ArrayBracket=1,ul.Brace=2,ul.Indent=3,ul.CaseIndent=4,ul.Bracket=5,ul.Paren=6,Ji.CONTROL_KEYWORDS=["for","while","if","else","switch","catch"],wi.INITIAL_SIZE=16,wi.LOAD_FACTOR=.75,Ni.ChoiceBrace=0,Ni.ChoiceIndent=1,Ni.StateBrace=2,Ni.StateIndent=3,Ni.CharacterBrace=4,Ni.CharacterIndent=5,Ni.BeatBrace=6,Ni.BeatIndent=7,Ni.AlternativeBrace=8,Ni.AlternativeIndent=9,Ni.Brace=10,Ni.Indent=11,Ni.Bracket=12,yt.hasNonSpecialChar_specialChars=` "+=*/-(){}[]:
52
52
  \r`,yt.KEYWORDS=(function(k){var e;let t=new Ee;return t.h.import=x.KwImport,t.h.state=x.KwState,t.h.beat=x.KwBeat,t.h.character=x.KwCharacter,t.h.choice=x.KwChoice,t.h.if=x.KwIf,t.h.else=x.KwElse,t.h.new=x.KwNew,t.h.sequence=x.KwSequence,t.h.cycle=x.KwCycle,t.h.once=x.KwOnce,t.h.pick=x.KwPick,t.h.shuffle=x.KwShuffle,t.h.true=x.LBoolean(!0),t.h.false=x.LBoolean(!1),t.h.null=x.LNull,t.h.and=x.OpAnd(!0),t.h.or=x.OpOr(!0),e=t,e})(this),Re.OFFSET=32768,Re.MAX=65535,Re.UNDEFINED=new Re(0,0,0,0),Ft._hx_skip_constructor=!1,Bi.Plain=0,Bi.Braces=1,Cl.Plain=0,Cl.Parens=2,Tl.Sequence=0,Tl.Cycle=1,Tl.Once=2,Tl.Pick=3,Tl.Shuffle=4,nn.Unquoted=0,nn.DoubleQuotes=1,Hi.timers=[],sn.main()})(Xl,Bn);export const Loreline=Xl.loreline.Loreline,Interpreter=Xl.loreline.Interpreter,Node=Xl.loreline.Node,Script=Xl.loreline.Script;