loreline 0.9.0 → 0.9.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,20 +1,20 @@
1
- "use strict";let hn={},Wn={};(function(Xl,on){"use strict";Xl.loreline=Xl.loreline||{};var Q={},F=function(){return te.__string_rec(this,"")},Ye=Ye||{},w;class c{static cca(e,t){let l=e.charCodeAt(t);if(l==l)return l}static substr(e,t,l){if(l==null)l=e.length;else if(l<0)if(t==0)l=e.length+l;else return"";return e.substr(t,l)}static remove(e,t){let l=e.indexOf(t);return l==-1?!1:(e.splice(l,1),!0)}static now(){return Date.now()}}Q.HxOverrides=c,c.__name__="HxOverrides";class bi{constructor(e,t){this.min=e,this.max=t}hasNext(){return this.min<this.max}next(){return this.min++}}Q.IntIterator=bi,bi.__name__="IntIterator",Object.assign(bi.prototype,{__class__:bi});class cn{static exists(e,t){let l=bn(e);for(;l.hasNext();){let i=l.next();if(t(i))return!0}return!1}}Q.Lambda=cn,cn.__name__="Lambda",Math.__name__="Math";class We{static field(e,t){try{return e[t]}catch{return null}}static getProperty(e,t){let l;if(e==null)return null;{let i;return e.__properties__?(l=e.__properties__["get_"+t],i=l):i=!1,i?e[l]():e[t]}}static setProperty(e,t,l){let i,n;e.__properties__?(i=e.__properties__["set_"+t],n=i):n=!1,n?e[i](l):e[t]=l}static fields(e){let t=[];if(e!=null){let i=Object.prototype.hasOwnProperty;for(var l in e)l!="__id__"&&l!="hx__closures__"&&i.call(e,l)&&t.push(l)}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,l=arguments,i=t.call(l);return e(i)}}}Q.Reflect=We,We.__name__="Reflect";class Y{static string(e){return te.__string_rec(e,"")}static parseInt(e){let t=parseInt(e);return isNaN(t)?null:t}}Q.Std=Y,Y.__name__="Std";class gt{constructor(){this.b=""}}Q.StringBuf=gt,gt.__name__="StringBuf",Object.assign(gt.prototype,{__class__:gt});class He{static htmlEscape(e,t){let l="",i=0,n=e;for(;i<n.length;){let s=n,r=i++,a=s.charCodeAt(r);a>=55296&&a<=56319&&(a=a-55232<<10|s.charCodeAt(r+1)&1023);let h=a;h>=65536&&++i;let o=h;switch(o){case 34:t?l+="&quot;":l+=String.fromCodePoint(o);break;case 38:l+="&amp;";break;case 39:t?l+="&#039;":l+=String.fromCodePoint(o);break;case 60:l+="&lt;";break;case 62:l+="&gt;";break;default:l+=String.fromCodePoint(o)}}return l}static isSpace(e,t){let l=c.cca(e,t);return l>8&&l<14?!0:l==32}static ltrim(e){let t=e.length,l=0;for(;l<t&&He.isSpace(e,l);)++l;return l>0?c.substr(e,l,t-l):e}static rtrim(e){let t=e.length,l=0;for(;l<t&&He.isSpace(e,t-l-1);)++l;return l>0?c.substr(e,0,t-l):e}static trim(e){return He.ltrim(He.rtrim(e))}static replace(e,t,l){return e.split(t).join(l)}}Q.StringTools=He,He.__name__="StringTools";var Ft=Ye.ValueType={__ename__:"ValueType",__constructs__:null,TNull:{_hx_name:"TNull",_hx_index:0,__enum__:"ValueType",toString:F},TInt:{_hx_name:"TInt",_hx_index:1,__enum__:"ValueType",toString:F},TFloat:{_hx_name:"TFloat",_hx_index:2,__enum__:"ValueType",toString:F},TBool:{_hx_name:"TBool",_hx_index:3,__enum__:"ValueType",toString:F},TObject:{_hx_name:"TObject",_hx_index:4,__enum__:"ValueType",toString:F},TFunction:{_hx_name:"TFunction",_hx_index:5,__enum__:"ValueType",toString:F},TClass:(w=function(b){return{_hx_index:6,c:b,__enum__:"ValueType",toString:F}},w._hx_name="TClass",w.__params__=["c"],w),TEnum:(w=function(b){return{_hx_index:7,e:b,__enum__:"ValueType",toString:F}},w._hx_name="TEnum",w.__params__=["e"],w),TUnknown:{_hx_name:"TUnknown",_hx_index:8,__enum__:"ValueType",toString:F}};Ft.__constructs__=[Ft.TNull,Ft.TInt,Ft.TFloat,Ft.TBool,Ft.TObject,Ft.TFunction,Ft.TClass,Ft.TEnum,Ft.TUnknown];class _e{static createInstance(e,t){let l=Function.prototype.bind.apply(e,[null].concat(t));return new l}static typeof(e){switch(typeof e){case"boolean":return Ft.TBool;case"function":return e.__name__||e.__ename__?Ft.TObject:Ft.TFunction;case"number":return Math.ceil(e)==e%2147483648?Ft.TInt:Ft.TFloat;case"object":if(e==null)return Ft.TNull;let t=e.__enum__;if(t!=null)return Ft.TEnum(Ye[t]);let l=te.getClass(e);return l!=null?Ft.TClass(l):Ft.TObject;case"string":return Ft.TClass(String);case"undefined":return Ft.TNull;default:return Ft.TUnknown}}static enumEq(e,t){if(e==t)return!0;try{let l=e.__enum__;if(l==null||l!=t.__enum__||e._hx_index!=t._hx_index)return!1;let n=Ye[l].__constructs__[e._hx_index].__params__,s=0;for(;s<n.length;){let r=n[s];if(++s,!_e.enumEq(e[r],t[r]))return!1}}catch{return!1}return!0}static enumParameters(e){let l=Ye[e.__enum__].__constructs__[e._hx_index].__params__;if(l!=null){let i=[],n=0;for(;n<l.length;){let s=l[n];++n,i.push(e[s])}return i}else return[]}}Q.Type=_e,_e.__name__="Type";class de{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 V{constructor(e){this.nodeType=e,this.children=[],this.attributeMap=new Ee}get(e){if(this.nodeType!=V.Element)throw T.thrown("Bad node type, expected Element but found "+(this.nodeType==null?"null":de.toString(this.nodeType)));return this.attributeMap.h[e]}set(e,t){if(this.nodeType!=V.Element)throw T.thrown("Bad node type, expected Element but found "+(this.nodeType==null?"null":de.toString(this.nodeType)));this.attributeMap.h[e]=t}exists(e){if(this.nodeType!=V.Element)throw T.thrown("Bad node type, expected Element but found "+(this.nodeType==null?"null":de.toString(this.nodeType)));return Object.prototype.hasOwnProperty.call(this.attributeMap.h,e)}attributes(){if(this.nodeType!=V.Element)throw T.thrown("Bad node type, expected Element but found "+(this.nodeType==null?"null":de.toString(this.nodeType)));return new Ei(this.attributeMap.h)}elements(){if(this.nodeType!=V.Document&&this.nodeType!=V.Element)throw T.thrown("Bad node type, expected Element or Document but found "+(this.nodeType==null?"null":de.toString(this.nodeType)));let e=[],t=0,l=this.children;for(;t<l.length;){let n=l[t];++t,n.nodeType==V.Element&&e.push(n)}let i=e;return new Il(i)}elementsNamed(e){if(this.nodeType!=V.Document&&this.nodeType!=V.Element)throw T.thrown("Bad node type, expected Element or Document but found "+(this.nodeType==null?"null":de.toString(this.nodeType)));let t=[],l=0,i=this.children;for(;l<i.length;){let s=i[l];++l;let r;if(s.nodeType==V.Element){if(s.nodeType!=V.Element)throw T.thrown("Bad node type, expected Element but found "+(s.nodeType==null?"null":de.toString(s.nodeType)));r=s.nodeName==e}else r=!1;r&&t.push(s)}let n=t;return new Il(n)}firstElement(){if(this.nodeType!=V.Document&&this.nodeType!=V.Element)throw T.thrown("Bad node type, expected Element or Document but found "+(this.nodeType==null?"null":de.toString(this.nodeType)));let e=0,t=this.children;for(;e<t.length;){let l=t[e];if(++e,l.nodeType==V.Element)return l}return null}addChild(e){if(this.nodeType!=V.Document&&this.nodeType!=V.Element)throw T.thrown("Bad node type, expected Element or Document but found "+(this.nodeType==null?"null":de.toString(this.nodeType)));e.parent!=null&&e.parent.removeChild(e),this.children.push(e),e.parent=this}removeChild(e){if(this.nodeType!=V.Document&&this.nodeType!=V.Element)throw T.thrown("Bad node type, expected Element or Document but found "+(this.nodeType==null?"null":de.toString(this.nodeType)));return c.remove(this.children,e)?(e.parent=null,!0):!1}toString(){return hi.print(this)}static createElement(e){let t=new V(V.Element);if(t.nodeType!=V.Element)throw T.thrown("Bad node type, expected Element but found "+(t.nodeType==null?"null":de.toString(t.nodeType)));return t.nodeName=e,t}static createPCData(e){let t=new V(V.PCData);if(t.nodeType==V.Document||t.nodeType==V.Element)throw T.thrown("Bad node type, unexpected "+(t.nodeType==null?"null":de.toString(t.nodeType)));return t.nodeValue=e,t}static createCData(e){let t=new V(V.CData);if(t.nodeType==V.Document||t.nodeType==V.Element)throw T.thrown("Bad node type, unexpected "+(t.nodeType==null?"null":de.toString(t.nodeType)));return t.nodeValue=e,t}static createComment(e){let t=new V(V.Comment);if(t.nodeType==V.Document||t.nodeType==V.Element)throw T.thrown("Bad node type, unexpected "+(t.nodeType==null?"null":de.toString(t.nodeType)));return t.nodeValue=e,t}static createDocType(e){let t=new V(V.DocType);if(t.nodeType==V.Document||t.nodeType==V.Element)throw T.thrown("Bad node type, unexpected "+(t.nodeType==null?"null":de.toString(t.nodeType)));return t.nodeValue=e,t}static createProcessingInstruction(e){let t=new V(V.ProcessingInstruction);if(t.nodeType==V.Document||t.nodeType==V.Element)throw T.thrown("Bad node type, unexpected "+(t.nodeType==null?"null":de.toString(t.nodeType)));return t.nodeValue=e,t}static createDocument(){return new V(V.Document)}}Q.Xml=V,V.__name__="Xml",Object.assign(V.prototype,{__class__:V});var Ol=Ye["haxe.StackItem"]={__ename__:"haxe.StackItem",__constructs__:null,CFunction:{_hx_name:"CFunction",_hx_index:0,__enum__:"haxe.StackItem",toString:F},Module:(w=function(b){return{_hx_index:1,m:b,__enum__:"haxe.StackItem",toString:F}},w._hx_name="Module",w.__params__=["m"],w),FilePos:(w=function(b,e,t,l){return{_hx_index:2,s:b,file:e,line:t,column:l,__enum__:"haxe.StackItem",toString:F}},w._hx_name="FilePos",w.__params__=["s","file","line","column"],w),Method:(w=function(b,e){return{_hx_index:3,classname:b,method:e,__enum__:"haxe.StackItem",toString:F}},w._hx_name="Method",w.__params__=["classname","method"],w),LocalFunction:(w=function(b){return{_hx_index:4,v:b,__enum__:"haxe.StackItem",toString:F}},w._hx_name="LocalFunction",w.__params__=["v"],w)};Ol.__constructs__=[Ol.CFunction,Ol.Module,Ol.FilePos,Ol.Method,Ol.LocalFunction];class Tn{static callStack(){return Pl.toHaxe(Pl.callStack())}}class Et{}Q["haxe.IMap"]=Et,Et.__name__="haxe.IMap",Et.__isInterface__=!0,Object.assign(Et.prototype,{__class__:Et});class T extends Error{constructor(e,t,l){super(e),this.message=e,this.__previousException=t,this.__nativeException=l??this}unwrap(){return this.__nativeException}toString(){return this.get_message()}get_message(){return this.message}get_native(){return this.__nativeException}static caught(e){return e instanceof T?e:e instanceof Error?new T(e.message,null,e):new _i(e,null,e)}static thrown(e){return e instanceof T?e.get_native():e instanceof Error?e:new _i(e)}}Q["haxe.Exception"]=T,T.__name__="haxe.Exception",T.__super__=Error,Object.assign(T.prototype,{__class__:T,__properties__:{get_native:"get_native",get_message:"get_message"}});class jl{constructor(e,t){this.high=e,this.low=t}}Q["haxe._Int64.___Int64"]=jl,jl.__name__="haxe._Int64.___Int64",Object.assign(jl.prototype,{__class__:jl});class Ri{static formatOutput(e,t){let l=Y.string(e);if(t==null)return l;let i=t.fileName+":"+t.lineNumber;if(t.customParams!=null){let n=0,s=t.customParams;for(;n<s.length;){let r=s[n];++n,l+=", "+Y.string(r)}}return i+": "+l}static trace(e,t){let l=Ri.formatOutput(e,t);typeof console<"u"&&console.log!=null&&console.log(l)}}Q["haxe.Log"]=Ri,Ri.__name__="haxe.Log";class Pl{static callStack(){let e=new Error(""),t=Pl.tryHaxeStack(e);if(typeof t>"u"){try{throw e}catch{}t=e.stack}return Pl.normalize(t,2)}static toHaxe(e,t){if(t==null&&(t=0),e==null)return[];if(typeof e=="string"){let l=e.split(`
1
+ "use strict";let hn={},Wn={};(function(Xl,on){"use strict";Xl.loreline=Xl.loreline||{};var Q={},F=function(){return te.__string_rec(this,"")},Ye=Ye||{},x;class c{static cca(e,t){let l=e.charCodeAt(t);if(l==l)return l}static substr(e,t,l){if(l==null)l=e.length;else if(l<0)if(t==0)l=e.length+l;else return"";return e.substr(t,l)}static remove(e,t){let l=e.indexOf(t);return l==-1?!1:(e.splice(l,1),!0)}static now(){return Date.now()}}Q.HxOverrides=c,c.__name__="HxOverrides";class bi{constructor(e,t){this.min=e,this.max=t}hasNext(){return this.min<this.max}next(){return this.min++}}Q.IntIterator=bi,bi.__name__="IntIterator",Object.assign(bi.prototype,{__class__:bi});class cn{static exists(e,t){let l=bn(e);for(;l.hasNext();){let i=l.next();if(t(i))return!0}return!1}}Q.Lambda=cn,cn.__name__="Lambda",Math.__name__="Math";class qe{static field(e,t){try{return e[t]}catch{return null}}static getProperty(e,t){let l;if(e==null)return null;{let i;return e.__properties__?(l=e.__properties__["get_"+t],i=l):i=!1,i?e[l]():e[t]}}static setProperty(e,t,l){let i,n;e.__properties__?(i=e.__properties__["set_"+t],n=i):n=!1,n?e[i](l):e[t]=l}static fields(e){let t=[];if(e!=null){let i=Object.prototype.hasOwnProperty;for(var l in e)l!="__id__"&&l!="hx__closures__"&&i.call(e,l)&&t.push(l)}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,l=arguments,i=t.call(l);return e(i)}}}Q.Reflect=qe,qe.__name__="Reflect";class Y{static string(e){return te.__string_rec(e,"")}static parseInt(e){let t=parseInt(e);return isNaN(t)?null:t}}Q.Std=Y,Y.__name__="Std";class gt{constructor(){this.b=""}}Q.StringBuf=gt,gt.__name__="StringBuf",Object.assign(gt.prototype,{__class__:gt});class He{static htmlEscape(e,t){let l="",i=0,n=e;for(;i<n.length;){let s=n,r=i++,a=s.charCodeAt(r);a>=55296&&a<=56319&&(a=a-55232<<10|s.charCodeAt(r+1)&1023);let h=a;h>=65536&&++i;let o=h;switch(o){case 34:t?l+="&quot;":l+=String.fromCodePoint(o);break;case 38:l+="&amp;";break;case 39:t?l+="&#039;":l+=String.fromCodePoint(o);break;case 60:l+="&lt;";break;case 62:l+="&gt;";break;default:l+=String.fromCodePoint(o)}}return l}static isSpace(e,t){let l=c.cca(e,t);return l>8&&l<14?!0:l==32}static ltrim(e){let t=e.length,l=0;for(;l<t&&He.isSpace(e,l);)++l;return l>0?c.substr(e,l,t-l):e}static rtrim(e){let t=e.length,l=0;for(;l<t&&He.isSpace(e,t-l-1);)++l;return l>0?c.substr(e,0,t-l):e}static trim(e){return He.ltrim(He.rtrim(e))}static replace(e,t,l){return e.split(t).join(l)}}Q.StringTools=He,He.__name__="StringTools";var Lt=Ye.ValueType={__ename__:"ValueType",__constructs__:null,TNull:{_hx_name:"TNull",_hx_index:0,__enum__:"ValueType",toString:F},TInt:{_hx_name:"TInt",_hx_index:1,__enum__:"ValueType",toString:F},TFloat:{_hx_name:"TFloat",_hx_index:2,__enum__:"ValueType",toString:F},TBool:{_hx_name:"TBool",_hx_index:3,__enum__:"ValueType",toString:F},TObject:{_hx_name:"TObject",_hx_index:4,__enum__:"ValueType",toString:F},TFunction:{_hx_name:"TFunction",_hx_index:5,__enum__:"ValueType",toString:F},TClass:(x=function(b){return{_hx_index:6,c:b,__enum__:"ValueType",toString:F}},x._hx_name="TClass",x.__params__=["c"],x),TEnum:(x=function(b){return{_hx_index:7,e:b,__enum__:"ValueType",toString:F}},x._hx_name="TEnum",x.__params__=["e"],x),TUnknown:{_hx_name:"TUnknown",_hx_index:8,__enum__:"ValueType",toString:F}};Lt.__constructs__=[Lt.TNull,Lt.TInt,Lt.TFloat,Lt.TBool,Lt.TObject,Lt.TFunction,Lt.TClass,Lt.TEnum,Lt.TUnknown];class _e{static createInstance(e,t){let l=Function.prototype.bind.apply(e,[null].concat(t));return new l}static typeof(e){switch(typeof e){case"boolean":return Lt.TBool;case"function":return e.__name__||e.__ename__?Lt.TObject:Lt.TFunction;case"number":return Math.ceil(e)==e%2147483648?Lt.TInt:Lt.TFloat;case"object":if(e==null)return Lt.TNull;let t=e.__enum__;if(t!=null)return Lt.TEnum(Ye[t]);let l=te.getClass(e);return l!=null?Lt.TClass(l):Lt.TObject;case"string":return Lt.TClass(String);case"undefined":return Lt.TNull;default:return Lt.TUnknown}}static enumEq(e,t){if(e==t)return!0;try{let l=e.__enum__;if(l==null||l!=t.__enum__||e._hx_index!=t._hx_index)return!1;let n=Ye[l].__constructs__[e._hx_index].__params__,s=0;for(;s<n.length;){let r=n[s];if(++s,!_e.enumEq(e[r],t[r]))return!1}}catch{return!1}return!0}static enumParameters(e){let l=Ye[e.__enum__].__constructs__[e._hx_index].__params__;if(l!=null){let i=[],n=0;for(;n<l.length;){let s=l[n];++n,i.push(e[s])}return i}else return[]}}Q.Type=_e,_e.__name__="Type";class de{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 V{constructor(e){this.nodeType=e,this.children=[],this.attributeMap=new Ee}get(e){if(this.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element but found "+(this.nodeType==null?"null":de.toString(this.nodeType)));return this.attributeMap.h[e]}set(e,t){if(this.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element but found "+(this.nodeType==null?"null":de.toString(this.nodeType)));this.attributeMap.h[e]=t}exists(e){if(this.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element but found "+(this.nodeType==null?"null":de.toString(this.nodeType)));return Object.prototype.hasOwnProperty.call(this.attributeMap.h,e)}attributes(){if(this.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element but found "+(this.nodeType==null?"null":de.toString(this.nodeType)));return new Ei(this.attributeMap.h)}elements(){if(this.nodeType!=V.Document&&this.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element or Document but found "+(this.nodeType==null?"null":de.toString(this.nodeType)));let e=[],t=0,l=this.children;for(;t<l.length;){let n=l[t];++t,n.nodeType==V.Element&&e.push(n)}let i=e;return new Il(i)}elementsNamed(e){if(this.nodeType!=V.Document&&this.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element or Document but found "+(this.nodeType==null?"null":de.toString(this.nodeType)));let t=[],l=0,i=this.children;for(;l<i.length;){let s=i[l];++l;let r;if(s.nodeType==V.Element){if(s.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element but found "+(s.nodeType==null?"null":de.toString(s.nodeType)));r=s.nodeName==e}else r=!1;r&&t.push(s)}let n=t;return new Il(n)}firstElement(){if(this.nodeType!=V.Document&&this.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element or Document but found "+(this.nodeType==null?"null":de.toString(this.nodeType)));let e=0,t=this.children;for(;e<t.length;){let l=t[e];if(++e,l.nodeType==V.Element)return l}return null}addChild(e){if(this.nodeType!=V.Document&&this.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element or Document but found "+(this.nodeType==null?"null":de.toString(this.nodeType)));e.parent!=null&&e.parent.removeChild(e),this.children.push(e),e.parent=this}removeChild(e){if(this.nodeType!=V.Document&&this.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element or Document but found "+(this.nodeType==null?"null":de.toString(this.nodeType)));return c.remove(this.children,e)?(e.parent=null,!0):!1}toString(){return hi.print(this)}static createElement(e){let t=new V(V.Element);if(t.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element but found "+(t.nodeType==null?"null":de.toString(t.nodeType)));return t.nodeName=e,t}static createPCData(e){let t=new V(V.PCData);if(t.nodeType==V.Document||t.nodeType==V.Element)throw C.thrown("Bad node type, unexpected "+(t.nodeType==null?"null":de.toString(t.nodeType)));return t.nodeValue=e,t}static createCData(e){let t=new V(V.CData);if(t.nodeType==V.Document||t.nodeType==V.Element)throw C.thrown("Bad node type, unexpected "+(t.nodeType==null?"null":de.toString(t.nodeType)));return t.nodeValue=e,t}static createComment(e){let t=new V(V.Comment);if(t.nodeType==V.Document||t.nodeType==V.Element)throw C.thrown("Bad node type, unexpected "+(t.nodeType==null?"null":de.toString(t.nodeType)));return t.nodeValue=e,t}static createDocType(e){let t=new V(V.DocType);if(t.nodeType==V.Document||t.nodeType==V.Element)throw C.thrown("Bad node type, unexpected "+(t.nodeType==null?"null":de.toString(t.nodeType)));return t.nodeValue=e,t}static createProcessingInstruction(e){let t=new V(V.ProcessingInstruction);if(t.nodeType==V.Document||t.nodeType==V.Element)throw C.thrown("Bad node type, unexpected "+(t.nodeType==null?"null":de.toString(t.nodeType)));return t.nodeValue=e,t}static createDocument(){return new V(V.Document)}}Q.Xml=V,V.__name__="Xml",Object.assign(V.prototype,{__class__:V});var Ol=Ye["haxe.StackItem"]={__ename__:"haxe.StackItem",__constructs__:null,CFunction:{_hx_name:"CFunction",_hx_index:0,__enum__:"haxe.StackItem",toString:F},Module:(x=function(b){return{_hx_index:1,m:b,__enum__:"haxe.StackItem",toString:F}},x._hx_name="Module",x.__params__=["m"],x),FilePos:(x=function(b,e,t,l){return{_hx_index:2,s:b,file:e,line:t,column:l,__enum__:"haxe.StackItem",toString:F}},x._hx_name="FilePos",x.__params__=["s","file","line","column"],x),Method:(x=function(b,e){return{_hx_index:3,classname:b,method:e,__enum__:"haxe.StackItem",toString:F}},x._hx_name="Method",x.__params__=["classname","method"],x),LocalFunction:(x=function(b){return{_hx_index:4,v:b,__enum__:"haxe.StackItem",toString:F}},x._hx_name="LocalFunction",x.__params__=["v"],x)};Ol.__constructs__=[Ol.CFunction,Ol.Module,Ol.FilePos,Ol.Method,Ol.LocalFunction];class Tn{static callStack(){return Pl.toHaxe(Pl.callStack())}}class Et{}Q["haxe.IMap"]=Et,Et.__name__="haxe.IMap",Et.__isInterface__=!0,Object.assign(Et.prototype,{__class__:Et});class C extends Error{constructor(e,t,l){super(e),this.message=e,this.__previousException=t,this.__nativeException=l??this}unwrap(){return this.__nativeException}toString(){return this.get_message()}get_message(){return this.message}get_native(){return this.__nativeException}static caught(e){return e instanceof C?e:e instanceof Error?new C(e.message,null,e):new _i(e,null,e)}static thrown(e){return e instanceof C?e.get_native():e instanceof Error?e:new _i(e)}}Q["haxe.Exception"]=C,C.__name__="haxe.Exception",C.__super__=Error,Object.assign(C.prototype,{__class__:C,__properties__:{get_native:"get_native",get_message:"get_message"}});class jl{constructor(e,t){this.high=e,this.low=t}}Q["haxe._Int64.___Int64"]=jl,jl.__name__="haxe._Int64.___Int64",Object.assign(jl.prototype,{__class__:jl});class Ri{static formatOutput(e,t){let l=Y.string(e);if(t==null)return l;let i=t.fileName+":"+t.lineNumber;if(t.customParams!=null){let n=0,s=t.customParams;for(;n<s.length;){let r=s[n];++n,l+=", "+Y.string(r)}}return i+": "+l}static trace(e,t){let l=Ri.formatOutput(e,t);typeof console<"u"&&console.log!=null&&console.log(l)}}Q["haxe.Log"]=Ri,Ri.__name__="haxe.Log";class Pl{static callStack(){let e=new Error(""),t=Pl.tryHaxeStack(e);if(typeof t>"u"){try{throw e}catch{}t=e.stack}return Pl.normalize(t,2)}static toHaxe(e,t){if(t==null&&(t=0),e==null)return[];if(typeof e=="string"){let l=e.split(`
2
2
  `);l[0]=="Error"&&l.shift();let i=[],n=0,s=l.length;for(;n<s;){let r=n++;if(t>r)continue;let a=l[r],h=a.match(/^ at ([$A-Za-z0-9_. ]+) \(([^)]+):([0-9]+):([0-9]+)\)$/);if(h!=null){let o=h[1].split(".");o[0]=="$hxClasses"&&o.shift();let u=o.pop(),p=h[2],_=Y.parseInt(h[3]),m=Y.parseInt(h[4]);i.push(Ol.FilePos(u=="Anonymous function"?Ol.LocalFunction():u=="Global code"?null:Ol.Method(o.join("."),u),p,_,m))}else i.push(Ol.Module(He.trim(a)))}return i}else return t>0&&Array.isArray(e)?e.slice(t):e}static tryHaxeStack(e){if(e==null)return[];let t=Error.prepareStackTrace;Error.prepareStackTrace=Pl.prepareHxStackTrace;let l=e.stack;return Error.prepareStackTrace=t,l}static prepareHxStackTrace(e,t){let l=[],i=0;for(;i<t.length;){let n=t[i];++i,Pl.wrapCallSite!=null&&(n=Pl.wrapCallSite(n));let s=null,r=n.getFunctionName();if(r!=null){let o=r.lastIndexOf(".");if(o>=0){let u=r.substring(0,o),p=r.substring(o+1);s=Ol.Method(u,p)}else s=Ol.Method(null,r)}let a=n.getFileName(),h=a==null?-1:a.indexOf("file:");Pl.wrapCallSite!=null&&h>0&&(a=a.substring(h+6)),l.push(Ol.FilePos(s,a,n.getLineNumber(),n.getColumnNumber()))}return l}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 Pl.skipLines(e,t)}else return e}static skipLines(e,t,l){return l==null&&(l=0),t>0?(l=e.indexOf(`
4
- `,l),l<0?"":Pl.skipLines(e,--t,l+1)):e.substring(l)}}Q["haxe.NativeStackTrace"]=Pl,Pl.__name__="haxe.NativeStackTrace";class fi{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 l=new fi(t);return l.run=function(){l.stop(),e()},l}}Q["haxe.Timer"]=fi,fi.__name__="haxe.Timer",Object.assign(fi.prototype,{__class__:fi});class _i extends T{constructor(e,t,l){super(String(e),t,l),this.value=e}unwrap(){return this.value}}Q["haxe.ValueException"]=_i,_i.__name__="haxe.ValueException",_i.__super__=T,Object.assign(_i.prototype,{__class__:_i});class mi{constructor(){}set(e,t){this.root=this.setLoop(e,t,this.root)}get(e){let t=this.root;for(;t!=null;){let l=this.compare(e,t.key);if(l==0)return t.value;l<0?t=t.left:t=t.right}return null}keys(){let e=[];return this.keysLoop(this.root,e),new Il(e)}setLoop(e,t,l){if(l==null)return new rl(null,e,t,null);let i=this.compare(e,l.key);if(i==0)return new rl(l.left,e,t,l.right,l==null?0:l._height);if(i<0){let n=this.setLoop(e,t,l.left);return this.balance(n,l.key,l.value,l.right)}else{let n=this.setLoop(e,t,l.right);return this.balance(l.left,l.key,l.value,n)}}keysLoop(e,t){e!=null&&(this.keysLoop(e.left,t),t.push(e.key),this.keysLoop(e.right,t))}balance(e,t,l,i){let n=e==null?0:e._height,s=i==null?0:i._height;if(n>s+2){let r=e.left,a=e.right;return(r==null?0:r._height)>=(a==null?0:a._height)?new rl(e.left,e.key,e.value,new rl(e.right,t,l,i)):new rl(new rl(e.left,e.key,e.value,e.right.left),e.right.key,e.right.value,new rl(e.right.right,t,l,i))}else if(s>n+2){let r=i.right,a=i.left;return(r==null?0:r._height)>(a==null?0:a._height)?new rl(new rl(e,t,l,i.left),i.key,i.value,i.right):new rl(new rl(e,t,l,i.left.left),i.left.key,i.left.value,new rl(i.left.right,i.key,i.value,i.right))}else return new rl(e,t,l,i,(n>s?n:s)+1)}compare(e,t){return We.compare(e,t)}}Q["haxe.ds.BalancedTree"]=mi,mi.__name__="haxe.ds.BalancedTree",mi.__interfaces__=[Et],Object.assign(mi.prototype,{__class__:mi});class rl{constructor(e,t,l,i,n){if(n==null&&(n=-1),this.left=e,this.key=t,this.value=l,this.right=i,n==-1){let s,r=this.left,a=this.right;if((r==null?0:r._height)>(a==null?0:a._height)){let h=this.left;s=h==null?0:h._height}else{let h=this.right;s=h==null?0:h._height}this._height=s+1}else this._height=n}}Q["haxe.ds.TreeNode"]=rl,rl.__name__="haxe.ds.TreeNode",Object.assign(rl.prototype,{__class__:rl});class ri extends mi{constructor(){super()}compare(e,t){let l=e._hx_index-t._hx_index;if(l!=0)return l;let i=_e.enumParameters(e),n=_e.enumParameters(t);return i.length==0&&n.length==0?0:this.compareArgs(i,n)}compareArgs(e,t){let l=e.length-t.length;if(l!=0)return l;let i=0,n=e.length;for(;i<n;){let s=i++,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)}}Q["haxe.ds.EnumValueMap"]=ri,ri.__name__="haxe.ds.EnumValueMap",ri.__interfaces__=[Et],ri.__super__=mi,Object.assign(ri.prototype,{__class__:ri});class Kl{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 Il(e)}}Q["haxe.ds.IntMap"]=Kl,Kl.__name__="haxe.ds.IntMap",Kl.__interfaces__=[Et],Object.assign(Kl.prototype,{__class__:Kl});class Ui{constructor(){this.length=0}add(e){let t=new Ci(e,null);this.h==null?this.h=t:this.q.next=t,this.q=t,this.length++}push(e){let t=new Ci(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}}Q["haxe.ds.List"]=Ui,Ui.__name__="haxe.ds.List",Object.assign(Ui.prototype,{__class__:Ui});class Ci{constructor(e,t){this.item=e,this.next=t}}Q["haxe.ds._List.ListNode"]=Ci,Ci.__name__="haxe.ds._List.ListNode",Object.assign(Ci.prototype,{__class__:Ci});class Ti{constructor(){this.h={__keys__:{}}}set(e,t){let l=e.__id__;l==null&&(l=e.__id__=on.$haxeUID++),this.h[l]=t,this.h.__keys__[l]=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 Il(e)}}Q["haxe.ds.ObjectMap"]=Ti,Ti.__name__="haxe.ds.ObjectMap",Ti.__interfaces__=[Et],Object.assign(Ti.prototype,{__class__:Ti});class Ee{constructor(){this.h=Object.create(null)}get(e){return this.h[e]}set(e,t){this.h[e]=t}keys(){return new Ei(this.h)}}Q["haxe.ds.StringMap"]=Ee,Ee.__name__="haxe.ds.StringMap",Ee.__interfaces__=[Et],Object.assign(Ee.prototype,{__class__:Ee});class Ei{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++]}}Q["haxe.ds._StringMap.StringMapKeyIterator"]=Ei,Ei.__name__="haxe.ds._StringMap.StringMapKeyIterator",Object.assign(Ei.prototype,{__class__:Ei});class pn{static blit(e,t,l,i,n){if(e==l){if(t<i){let s=t+n,r=i+n,a=0,h=n;for(;a<h;){let o=a++;--s,--r,e[r]=e[s]}}else if(t>i){let s=t,r=i,a=0,h=n;for(;a<h;){let o=a++;e[r]=e[s],++s,++r}}}else{let s=0,r=n;for(;s<r;){let a=s++;l[i+a]=e[t+a]}}}}class De{constructor(e){switch(e){case".":case"..":this.dir=e,this.file="";return}let t=e.lastIndexOf("/"),l=e.lastIndexOf("\\");t<l?(this.dir=c.substr(e,0,l),e=c.substr(e,l+1,null),this.backslash=!0):l<t?(this.dir=c.substr(e,0,t),e=c.substr(e,t+1,null)):this.dir=null;let i=e.lastIndexOf(".");i!=-1?(this.ext=c.substr(e,i+1,null),this.file=c.substr(e,0,i)):(this.ext=null,this.file=e)}toString(){return(this.dir==null?"":this.dir+(this.backslash?"\\":"/"))+this.file+(this.ext==null?"":"."+this.ext)}static withoutDirectory(e){let t=new De(e);return t.dir=null,t.toString()}static directory(e){let t=new De(e);return t.dir==null?"":t.dir}static join(e){let t=[],l=0,i=e;for(;l<i.length;){let h=i[l];++l,h!=null&&h!=""&&t.push(h)}let n=t;if(n.length==0)return"";let s=n[0],r=1,a=n.length;for(;r<a;){let h=r++;s=De.addTrailingSlash(s),s+=n[h]}return De.normalize(s)}static normalize(e){let t="/";if(e=e.split("\\").join(t),e==t)return t;let l=[],i=0,n=e.split(t);for(;i<n.length;){let p=n[i];++i,p==".."&&l.length>0&&l[l.length-1]!=".."?l.pop():p==""?(l.length>0||c.cca(e,0)==47)&&l.push(p):p!="."&&l.push(p)}let s=l.join(t),r="",a=!1,h=!1,o=0,u=s;for(;o<u.length;){let p=u,_=o++,m=p.charCodeAt(_);m>=55296&&m<=56319&&(m=m-55232<<10|p.charCodeAt(_+1)&1023);let f=m;f>=65536&&++o;let g=f;switch(g){case 47:if(!a)h=!0;else{let x=g;a=!1,h&&(r+="/",h=!1),r+=String.fromCodePoint(x)}break;case 58:r+=":",a=!0;break;default:let d=g;a=!1,h&&(r+="/",h=!1),r+=String.fromCodePoint(d)}}return r}static addTrailingSlash(e){if(e.length==0)return"/";let t=e.lastIndexOf("/"),l=e.lastIndexOf("\\");return t<l?l!=e.length-1?e+"\\":e:t!=e.length-1?e+"/":e}static isAbsolute(e){return!!(e.startsWith("/")||e.charAt(1)==":"||e.startsWith("\\\\"))}}Q["haxe.io.Path"]=De,De.__name__="haxe.io.Path",Object.assign(De.prototype,{__class__:De});class Il{constructor(e){this.current=0,this.array=e}hasNext(){return this.current<this.array.length}next(){return this.array[this.current++]}}Q["haxe.iterators.ArrayIterator"]=Il,Il.__name__="haxe.iterators.ArrayIterator",Object.assign(Il.prototype,{__class__:Il});var tl=Ye["haxe.rtti.CType"]={__ename__:"haxe.rtti.CType",__constructs__:null,CUnknown:{_hx_name:"CUnknown",_hx_index:0,__enum__:"haxe.rtti.CType",toString:F},CEnum:(w=function(b,e){return{_hx_index:1,name:b,params:e,__enum__:"haxe.rtti.CType",toString:F}},w._hx_name="CEnum",w.__params__=["name","params"],w),CClass:(w=function(b,e){return{_hx_index:2,name:b,params:e,__enum__:"haxe.rtti.CType",toString:F}},w._hx_name="CClass",w.__params__=["name","params"],w),CTypedef:(w=function(b,e){return{_hx_index:3,name:b,params:e,__enum__:"haxe.rtti.CType",toString:F}},w._hx_name="CTypedef",w.__params__=["name","params"],w),CFunction:(w=function(b,e){return{_hx_index:4,args:b,ret:e,__enum__:"haxe.rtti.CType",toString:F}},w._hx_name="CFunction",w.__params__=["args","ret"],w),CAnonymous:(w=function(b){return{_hx_index:5,fields:b,__enum__:"haxe.rtti.CType",toString:F}},w._hx_name="CAnonymous",w.__params__=["fields"],w),CDynamic:(w=function(b){return{_hx_index:6,t:b,__enum__:"haxe.rtti.CType",toString:F}},w._hx_name="CDynamic",w.__params__=["t"],w),CAbstract:(w=function(b,e){return{_hx_index:7,name:b,params:e,__enum__:"haxe.rtti.CType",toString:F}},w._hx_name="CAbstract",w.__params__=["name","params"],w)};tl.__constructs__=[tl.CUnknown,tl.CEnum,tl.CClass,tl.CTypedef,tl.CFunction,tl.CAnonymous,tl.CDynamic,tl.CAbstract];var zt=Ye["haxe.rtti.Rights"]={__ename__:"haxe.rtti.Rights",__constructs__:null,RNormal:{_hx_name:"RNormal",_hx_index:0,__enum__:"haxe.rtti.Rights",toString:F},RNo:{_hx_name:"RNo",_hx_index:1,__enum__:"haxe.rtti.Rights",toString:F},RCall:(w=function(b){return{_hx_index:2,m:b,__enum__:"haxe.rtti.Rights",toString:F}},w._hx_name="RCall",w.__params__=["m"],w),RMethod:{_hx_name:"RMethod",_hx_index:3,__enum__:"haxe.rtti.Rights",toString:F},RDynamic:{_hx_name:"RDynamic",_hx_index:4,__enum__:"haxe.rtti.Rights",toString:F},RInline:{_hx_name:"RInline",_hx_index:5,__enum__:"haxe.rtti.Rights",toString:F}};zt.__constructs__=[zt.RNormal,zt.RNo,zt.RCall,zt.RMethod,zt.RDynamic,zt.RInline];var Jl=Ye["haxe.rtti.TypeTree"]={__ename__:"haxe.rtti.TypeTree",__constructs__:null,TPackage:(w=function(b,e,t){return{_hx_index:0,name:b,full:e,subs:t,__enum__:"haxe.rtti.TypeTree",toString:F}},w._hx_name="TPackage",w.__params__=["name","full","subs"],w),TClassdecl:(w=function(b){return{_hx_index:1,c:b,__enum__:"haxe.rtti.TypeTree",toString:F}},w._hx_name="TClassdecl",w.__params__=["c"],w),TEnumdecl:(w=function(b){return{_hx_index:2,e:b,__enum__:"haxe.rtti.TypeTree",toString:F}},w._hx_name="TEnumdecl",w.__params__=["e"],w),TTypedecl:(w=function(b){return{_hx_index:3,t:b,__enum__:"haxe.rtti.TypeTree",toString:F}},w._hx_name="TTypedecl",w.__params__=["t"],w),TAbstractdecl:(w=function(b){return{_hx_index:4,a:b,__enum__:"haxe.rtti.TypeTree",toString:F}},w._hx_name="TAbstractdecl",w.__params__=["a"],w)};Jl.__constructs__=[Jl.TPackage,Jl.TClassdecl,Jl.TEnumdecl,Jl.TTypedecl,Jl.TAbstractdecl];class ht{static typeInfos(e){let t;switch(e._hx_index){case 0:let l=e.name,i=e.full,n=e.subs;throw T.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,l){let i=0,n=l,s=0;for(;s<t.length;){let r=t[s];if(++s,i>=n.length)return!1;let a=n[i++];if(!e(r,a))return!1}return!(i<n.length)}static rightsEq(e,t){if(e==t)return!0;if(e._hx_index==2){let l=e.m;if(t._hx_index==2){let i=t.m;return l==i}}return!1}static typeEq(e,t){switch(e._hx_index){case 0:return t==tl.CUnknown;case 1:let l=e.name,i=e.params;if(t._hx_index==1){let f=t.name,g=t.params;return l==f?ht.leq(ht.typeEq,i,g):!1}break;case 2:let n=e.name,s=e.params;if(t._hx_index==2){let f=t.name,g=t.params;return n==f?ht.leq(ht.typeEq,s,g):!1}break;case 3:let r=e.name,a=e.params;if(t._hx_index==3){let f=t.name,g=t.params;return r==f?ht.leq(ht.typeEq,a,g):!1}break;case 4:let h=e.args,o=e.ret;if(t._hx_index==4){let f=t.args,g=t.ret;return ht.leq(function(d,x){return d.name==x.name&&d.opt==x.opt?ht.typeEq(d.t,x.t):!1},h,f)?ht.typeEq(o,g):!1}break;case 5:let u=e.fields;if(t._hx_index==5){let f=t.fields;return ht.leq(function(g,d){return ht.fieldEq(g,d)},u,f)}break;case 6:let p=e.t;if(t._hx_index==6){let f=t.t;return p==null!=(f==null)?!1:p!=null?ht.typeEq(p,f):!0}break;case 7:let _=e.name,m=e.params;if(t._hx_index==7){let f=t.name,g=t.params;return _==f?ht.leq(ht.typeEq,m,g):!1}break}return!1}static fieldEq(e,t){return!(e.name!=t.name||!ht.typeEq(e.type,t.type)||e.isPublic!=t.isPublic||e.doc!=t.doc||!ht.rightsEq(e.get,t.get)||!ht.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&&!ht.leq(function(l,i){return l.name==i.name&&l.opt==i.opt?ht.typeEq(l.t,i.t):!1},e.args,t.args))}}Q["haxe.rtti.TypeApi"]=ht,ht.__name__="haxe.rtti.TypeApi";class Vi{constructor(){this.root=[]}process(e,t){if(this.curplatform=t,e.nodeType!=V.Document&&e.nodeType!=V.Element)throw T.thrown("Invalid nodeType "+(e.nodeType==null?"null":de.toString(e.nodeType)));this.xroot(e)}mergeRights(e,t){return e.get==zt.RInline&&e.set==zt.RNo&&t.get==zt.RNormal&&t.set==zt.RMethod?(e.get=zt.RNormal,e.set=zt.RMethod,!0):_e.enumEq(e.get,t.get)?_e.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 ht.fieldEq(e,t)?!0:e.name==t.name&&(this.mergeRights(e,t)||this.mergeRights(t,e))&&this.mergeDoc(e,t)?ht.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 l=0,i=t.fields;for(;l<i.length;){let r=i[l];++l;let a=null,h=0,o=e.fields;for(;h<o.length;){let u=o[h];if(++h,this.mergeFields(u,r)){a=u;break}}a==null?(this.newField(e,r),e.fields.push(r)):this.curplatform!=null&&a.platforms.push(this.curplatform)}let n=0,s=t.statics;for(;n<s.length;){let r=s[n];++n;let a=null,h=0,o=e.statics;for(;h<o.length;){let u=o[h];if(++h,this.mergeFields(u,r)){a=u;break}}a==null?(this.newField(e,r),e.statics.push(r)):this.curplatform!=null&&a.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 l=0,i=t.constructors;for(;l<i.length;){let n=i[l];++l;let s=null,r=0,a=e.constructors;for(;r<a.length;){let h=a[r];if(++r,ht.constructorEq(h,n)){s=h;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 l=0,i=e.to.length;for(;l<i;){let r=l++;if(!ht.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(!ht.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=ht.typeInfos(e),l=t.path.split("."),i=this.root,n=[];l.pop();let s=0;for(;s<l.length;){let a=l[s];++s;let h=!1,o=0;for(;o<i.length;){let u=i[o];if(++o,u._hx_index==0){let p=u.full,_=u.name,m=u.subs;if(_==a){h=!0,i=m;break}}}if(n.push(a),!h){let u=[];i.push(Jl.TPackage(a,n.join("."),u)),i=u}}let r=0;for(;r<i.length;){let a=i[r];++r;let h;if(a._hx_index==0){let u=a.name,p=a.full,_=a.subs;h=!0}else h=!1;if(h)continue;let o=ht.typeInfos(a);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(a._hx_index){case 0:let _=a.name,m=a.full,f=a.subs;u=!1;break;case 1:let g=a.c;if(e._hx_index==1){let S=e.c;if(this.mergeClasses(g,S))return}else u=!1;break;case 2:let d=a.e;if(e._hx_index==2){let S=e.e;if(this.mergeEnums(d,S))return}else u=!1;break;case 3:let x=a.t;if(e._hx_index==3){let S=e.t;if(this.mergeTypedefs(x,S))return}break;case 4:let y=a.a;if(e._hx_index==4){let S=e.a;if(this.mergeAbstracts(y,S))return}else u=!1;break}let p=o.module!=t.module?"module "+t.module+" should be "+o.module:o.doc!=t.doc?"documentation is different":o.isPrivate!=t.isPrivate?"private flag is different":u?"could not merge definition":"type kind is different";throw T.thrown("Incompatibilities between "+o.path+" in "+o.platforms.join(",")+" and "+this.curplatform+" ("+p+")")}}i.push(e)}mkPath(e){return e}mkTypeParams(e){let t=e.split(":");return t[0]==""?[]:t}mkRights(e){switch(e){case"dynamic":return zt.RDynamic;case"inline":return zt.RInline;case"method":return zt.RMethod;case"null":return zt.RNo;default:return zt.RCall(e)}}xerror(e){let t;if(e.nodeType==V.Document)t="Document";else{if(e.nodeType!=V.Element)throw T.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":de.toString(e.nodeType)));t=e.nodeName}throw T.thrown("Invalid "+t)}xroot(e){let t=e.elements();for(;t.hasNext();){let l=t.next();this.merge(this.processElement(l))}}processElement(e){if(e.nodeType!=V.Document&&e.nodeType!=V.Element)throw T.thrown("Invalid nodeType "+(e.nodeType==null?"null":de.toString(e.nodeType)));let t=e,l;if(t.nodeType==V.Document)l="Document";else{if(t.nodeType!=V.Element)throw T.thrown("Bad node type, expected Element but found "+(t.nodeType==null?"null":de.toString(t.nodeType)));l=t.nodeName}switch(l){case"abstract":return Jl.TAbstractdecl(this.xabstract(t));case"class":return Jl.TClassdecl(this.xclass(t));case"enum":return Jl.TEnumdecl(this.xenum(t));case"typedef":return Jl.TTypedecl(this.xtypedef(t));default:return this.xerror(t)}}xmeta(e){let t=[],l=0,i=wn.resolve(e,"m");for(;l<i.length;){let n=i[l];++l;let s=[],r=0,a=wn.resolve(n,"e");for(;r<a.length;){let h=a[r];++r,s.push(ai.get_innerHTML(h))}t.push({name:Xe.resolve(n,"n"),params:s})}return t}xoverloads(e){let t=[],l=e.elements();for(;l.hasNext();){let i=l.next();t.push(this.xclassfield(i))}return t}xpath(e){let t=this.mkPath(Xe.resolve(e,"path")),l=[],i=e.elements();for(;i.hasNext();){let n=i.next();l.push(this.xtype(n))}return{path:t,params:l}}xclass(e){let t=null,l=null,i=null,n=[],s=[],r=[],a=[],h=e.exists("interface"),o=e.elements();for(;o.hasNext();){let u=o.next(),p;if(u.nodeType==V.Document)p="Document";else{if(u.nodeType!=V.Element)throw T.thrown("Bad node type, expected Element but found "+(u.nodeType==null?"null":de.toString(u.nodeType)));p=u.nodeName}switch(p){case"extends":h?n.push(this.xpath(u)):t=this.xpath(u);break;case"haxe_doc":l=ai.get_innerData(u);break;case"haxe_dynamic":let _=u.firstElement();if(_.nodeType!=V.Document&&_.nodeType!=V.Element)throw T.thrown("Invalid nodeType "+(_.nodeType==null?"null":de.toString(_.nodeType)));i=this.xtype(_);break;case"implements":n.push(this.xpath(u));break;case"meta":a=this.xmeta(u);break;default:u.exists("static")?r.push(this.xclassfield(u)):s.push(this.xclassfield(u))}}return{file:al.resolve(e,"file")?Xe.resolve(e,"file"):null,path:this.mkPath(Xe.resolve(e,"path")),module:al.resolve(e,"module")?this.mkPath(Xe.resolve(e,"module")):null,doc:l,isPrivate:e.exists("private"),isExtern:e.exists("extern"),isFinal:e.exists("final"),isInterface:h,params:this.mkTypeParams(Xe.resolve(e,"params")),superClass:t,interfaces:n,fields:s,statics:r,tdynamic:i,platforms:this.defplat(),meta:a}}xclassfield(e,t){t==null&&(t=!1);let l=e.elements(),i=this.xtype(l.next()),n=null,s=[],r=null,a=l;for(;a.hasNext();){let o=a.next(),u;if(o.nodeType==V.Document)u="Document";else{if(o.nodeType!=V.Element)throw T.thrown("Bad node type, expected Element but found "+(o.nodeType==null?"null":de.toString(o.nodeType)));u=o.nodeName}switch(u){case"haxe_doc":n=ai.get_innerData(o);break;case"meta":s=this.xmeta(o);break;case"overloads":r=this.xoverloads(o);break;default:this.xerror(o)}}let h;if(e.nodeType==V.Document)h="Document";else{if(e.nodeType!=V.Element)throw T.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":de.toString(e.nodeType)));h=e.nodeName}return{name:h,type:i,isPublic:e.exists("public")||t,isFinal:e.exists("final"),isOverride:e.exists("override"),line:al.resolve(e,"line")?Y.parseInt(Xe.resolve(e,"line")):null,doc:n,get:al.resolve(e,"get")?this.mkRights(Xe.resolve(e,"get")):zt.RNormal,set:al.resolve(e,"set")?this.mkRights(Xe.resolve(e,"set")):zt.RNormal,params:al.resolve(e,"params")?this.mkTypeParams(Xe.resolve(e,"params")):[],platforms:this.defplat(),meta:s,overloads:r,expr:al.resolve(e,"expr")?Xe.resolve(e,"expr"):null}}xenum(e){let t=[],l=null,i=[],n=e.elements();for(;n.hasNext();){let s=n.next(),r;if(s.nodeType==V.Document)r="Document";else{if(s.nodeType!=V.Element)throw T.thrown("Bad node type, expected Element but found "+(s.nodeType==null?"null":de.toString(s.nodeType)));r=s.nodeName}if(r=="haxe_doc")l=ai.get_innerData(s);else{let a;if(s.nodeType==V.Document)a="Document";else{if(s.nodeType!=V.Element)throw T.thrown("Bad node type, expected Element but found "+(s.nodeType==null?"null":de.toString(s.nodeType)));a=s.nodeName}a=="meta"?i=this.xmeta(s):t.push(this.xenumfield(s))}}return{file:al.resolve(e,"file")?Xe.resolve(e,"file"):null,path:this.mkPath(Xe.resolve(e,"path")),module:al.resolve(e,"module")?this.mkPath(Xe.resolve(e,"module")):null,doc:l,isPrivate:e.exists("private"),isExtern:e.exists("extern"),params:this.mkTypeParams(Xe.resolve(e,"params")),constructors:t,platforms:this.defplat(),meta:i}}xenumfield(e){let t=null,l=e.elementsNamed("haxe_doc"),i=l.hasNext()?l.next():null,n=En.resolve(e,"meta")?this.xmeta(xn.resolve(e,"meta")):[];if(al.resolve(e,"a")){let a=Xe.resolve(e,"a").split(":"),h=e.elements();t=[];let o=0;for(;o<a.length;){let u=a[o];++o;let p=!1;u.charAt(0)=="?"&&(p=!0,u=c.substr(u,1,null)),t.push({name:u,opt:p,t:this.xtype(h.next())})}}let s;if(e.nodeType==V.Document)s="Document";else{if(e.nodeType!=V.Element)throw T.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":de.toString(e.nodeType)));s=e.nodeName}let r;if(i==null)r=null;else{if(i.nodeType!=V.Document&&i.nodeType!=V.Element)throw T.thrown("Invalid nodeType "+(i.nodeType==null?"null":de.toString(i.nodeType)));r=ai.get_innerData(i)}return{name:s,args:t,doc:r,meta:n,platforms:this.defplat()}}xabstract(e){let t=null,l=null,i=null,n=[],s=[],r=[],a=e.elements();for(;a.hasNext();){let h=a.next(),o;if(h.nodeType==V.Document)o="Document";else{if(h.nodeType!=V.Element)throw T.thrown("Bad node type, expected Element but found "+(h.nodeType==null?"null":de.toString(h.nodeType)));o=h.nodeName}switch(o){case"from":let u=h.elements();for(;u.hasNext();){let m=u.next(),f=m.firstElement();if(f.nodeType!=V.Document&&f.nodeType!=V.Element)throw T.thrown("Invalid nodeType "+(f.nodeType==null?"null":de.toString(f.nodeType)));r.push({t:this.xtype(f),field:al.resolve(m,"field")?Xe.resolve(m,"field"):null})}break;case"haxe_doc":t=ai.get_innerData(h);break;case"impl":l=this.xclass(xn.resolve(h,"class"));break;case"meta":n=this.xmeta(h);break;case"this":let p=h.firstElement();if(p.nodeType!=V.Document&&p.nodeType!=V.Element)throw T.thrown("Invalid nodeType "+(p.nodeType==null?"null":de.toString(p.nodeType)));i=this.xtype(p);break;case"to":let _=h.elements();for(;_.hasNext();){let m=_.next(),f=m.firstElement();if(f.nodeType!=V.Document&&f.nodeType!=V.Element)throw T.thrown("Invalid nodeType "+(f.nodeType==null?"null":de.toString(f.nodeType)));s.push({t:this.xtype(f),field:al.resolve(m,"field")?Xe.resolve(m,"field"):null})}break;default:this.xerror(h)}}return{file:al.resolve(e,"file")?Xe.resolve(e,"file"):null,path:this.mkPath(Xe.resolve(e,"path")),module:al.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:i,to:s,from:r,impl:l}}xtypedef(e){let t=null,l=null,i=[],n=e.elements();for(;n.hasNext();){let r=n.next(),a;if(r.nodeType==V.Document)a="Document";else{if(r.nodeType!=V.Element)throw T.thrown("Bad node type, expected Element but found "+(r.nodeType==null?"null":de.toString(r.nodeType)));a=r.nodeName}if(a=="haxe_doc")t=ai.get_innerData(r);else{let h;if(r.nodeType==V.Document)h="Document";else{if(r.nodeType!=V.Element)throw T.thrown("Bad node type, expected Element but found "+(r.nodeType==null?"null":de.toString(r.nodeType)));h=r.nodeName}h=="meta"?i=this.xmeta(r):l=this.xtype(r)}}let s=new Ee;return this.curplatform!=null&&(s.h[this.curplatform]=l),{file:al.resolve(e,"file")?Xe.resolve(e,"file"):null,path:this.mkPath(Xe.resolve(e,"path")),module:al.resolve(e,"module")?this.mkPath(Xe.resolve(e,"module")):null,doc:t,isPrivate:e.exists("private"),params:this.mkTypeParams(Xe.resolve(e,"params")),type:l,types:s,platforms:this.defplat(),meta:i}}xtype(e){let t;if(e.nodeType==V.Document)t="Document";else{if(e.nodeType!=V.Element)throw T.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":de.toString(e.nodeType)));t=e.nodeName}switch(t){case"a":let l=[],i=e.elements();for(;i.hasNext();){let m=i.next(),f=this.xclassfield(m,!0);f.platforms=[],l.push(f)}return tl.CAnonymous(l);case"c":return tl.CClass(this.mkPath(Xe.resolve(e,"path")),this.xtypeparams(e));case"d":let n=null,s=e.firstElement();if(s!=null){if(s.nodeType!=V.Document&&s.nodeType!=V.Element)throw T.thrown("Invalid nodeType "+(s.nodeType==null?"null":de.toString(s.nodeType)));n=this.xtype(s)}return tl.CDynamic(n);case"e":return tl.CEnum(this.mkPath(Xe.resolve(e,"path")),this.xtypeparams(e));case"f":let r=[],a=Xe.resolve(e,"a").split(":"),h=0,o=a,u=al.resolve(e,"v")?new Il(Xe.resolve(e,"v").split(":")):null,p=e.elements();for(;p.hasNext();){let m=p.next(),f=!1,g=h<o.length?o[h++]:null;g==null&&(g=""),g.charAt(0)=="?"&&(f=!0,g=c.substr(g,1,null));let d=u==null||u.current>=u.array.length?null:u.array[u.current++];r.push({name:g,opt:f,t:this.xtype(m),value:d==""?null:d})}let _=r[r.length-1];return c.remove(r,_),tl.CFunction(r,_.t);case"t":return tl.CTypedef(this.mkPath(Xe.resolve(e,"path")),this.xtypeparams(e));case"unknown":return tl.CUnknown;case"x":return tl.CAbstract(this.mkPath(Xe.resolve(e,"path")),this.xtypeparams(e));default:return this.xerror(e)}}xtypeparams(e){let t=[],l=e.elements();for(;l.hasNext();){let i=l.next();t.push(this.xtype(i))}return t}defplat(){let e=[];return this.curplatform!=null&&e.push(this.curplatform),e}}Q["haxe.rtti.XmlParser"]=Vi,Vi.__name__="haxe.rtti.XmlParser",Object.assign(Vi.prototype,{__class__:Vi});class xn{static resolve(e,t){let l=e.elementsNamed(t).next();if(l==null){let i;if(e.nodeType==V.Document)i="Document";else{if(e.nodeType!=V.Element)throw T.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":de.toString(e.nodeType)));i=e.nodeName}throw T.thrown(i+" is missing element "+t)}if(l.nodeType!=V.Document&&l.nodeType!=V.Element)throw T.thrown("Invalid nodeType "+(l.nodeType==null?"null":de.toString(l.nodeType)));return l}}class Xe{static resolve(e,t){if(e.nodeType==V.Document)throw T.thrown("Cannot access document attribute "+t);let l=e.get(t);if(l==null)throw e.nodeType!=V.Element?T.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":de.toString(e.nodeType))):T.thrown(e.nodeName+" is missing attribute "+t);return l}}class al{static resolve(e,t){if(e.nodeType==V.Document)throw T.thrown("Cannot access document attribute "+t);return e.exists(t)}}class En{static resolve(e,t){return e.elementsNamed(t).hasNext()}}class wn{static resolve(e,t){let l=[],i=e.elementsNamed(t);for(;i.hasNext();){let n=i.next();if(n.nodeType!=V.Document&&n.nodeType!=V.Element)throw T.thrown("Invalid nodeType "+(n.nodeType==null?"null":de.toString(n.nodeType)));l.push(n)}return l}}class ai{static get_innerData(e){if(e.nodeType!=V.Document&&e.nodeType!=V.Element)throw T.thrown("Bad node type, expected Element or Document but found "+(e.nodeType==null?"null":de.toString(e.nodeType)));let t=0,l=e.children;if(t>=l.length){let n;if(e.nodeType==V.Document)n="Document";else{if(e.nodeType!=V.Element)throw T.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":de.toString(e.nodeType)));n=e.nodeName}throw T.thrown(n+" does not have data")}let i=l[t++];if(t<l.length){let n=l[t++],s;if(i.nodeType==V.PCData&&n.nodeType==V.CData){if(i.nodeType==V.Document||i.nodeType==V.Element)throw T.thrown("Bad node type, unexpected "+(i.nodeType==null?"null":de.toString(i.nodeType)));s=He.trim(i.nodeValue)==""}else s=!1;if(s){if(t>=l.length){if(n.nodeType==V.Document||n.nodeType==V.Element)throw T.thrown("Bad node type, unexpected "+(n.nodeType==null?"null":de.toString(n.nodeType)));return n.nodeValue}let a=l[t++],h;if(a.nodeType==V.PCData){if(a.nodeType==V.Document||a.nodeType==V.Element)throw T.thrown("Bad node type, unexpected "+(a.nodeType==null?"null":de.toString(a.nodeType)));h=He.trim(a.nodeValue)==""}else h=!1;if(h&&t>=l.length){if(n.nodeType==V.Document||n.nodeType==V.Element)throw T.thrown("Bad node type, unexpected "+(n.nodeType==null?"null":de.toString(n.nodeType)));return n.nodeValue}}let r;if(e.nodeType==V.Document)r="Document";else{if(e.nodeType!=V.Element)throw T.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":de.toString(e.nodeType)));r=e.nodeName}throw T.thrown(r+" does not only have data")}if(i.nodeType!=V.PCData&&i.nodeType!=V.CData){let n;if(e.nodeType==V.Document)n="Document";else{if(e.nodeType!=V.Element)throw T.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":de.toString(e.nodeType)));n=e.nodeName}throw T.thrown(n+" does not have data")}if(i.nodeType==V.Document||i.nodeType==V.Element)throw T.thrown("Bad node type, unexpected "+(i.nodeType==null?"null":de.toString(i.nodeType)));return i.nodeValue}static get_innerHTML(e){let t="";if(e.nodeType!=V.Document&&e.nodeType!=V.Element)throw T.thrown("Bad node type, expected Element or Document but found "+(e.nodeType==null?"null":de.toString(e.nodeType)));let l=0,i=e.children;for(;l<i.length;){let n=i[l++];t+=Y.string(hi.print(n))}return t}}ai.__properties__={get_innerHTML:"get_innerHTML",get_innerData:"get_innerData"};class It{constructor(e,t,l){this.xml=t,this.message=e,this.position=l,this.lineNumber=1,this.positionAtLine=0;let i=0,n=l;for(;i<n;){let s=i++,r=t.charCodeAt(s);r==10?(this.lineNumber++,this.positionAtLine=0):r!=13&&this.positionAtLine++}}toString(){return te.getClass(this).__name__+": "+this.message+" at line "+this.lineNumber+" char "+this.positionAtLine}}Q["haxe.xml.XmlParserException"]=It,It.__name__="haxe.xml.XmlParserException",Object.assign(It.prototype,{__class__:It});class ei{static parse(e,t){t==null&&(t=!1);let l=V.createDocument();return ei.doParse(e,t,0,l),l}static doParse(e,t,l,i){l==null&&(l=0);let n=null,s=1,r=1,a=null,h=0,o=0,u=0,p=new gt,_=1,m=-1;for(;l<e.length;){let f=e.charCodeAt(l);switch(s){case 0:switch(f){case 9:case 10:case 13:case 32:break;default:s=r;continue}break;case 1:if(f==60)s=0,r=2;else{h=l,s=13;continue}break;case 2:switch(f){case 33:if(e.charCodeAt(l+1)==91){if(l+=2,c.substr(e,l,6).toUpperCase()!="CDATA[")throw T.thrown(new It("Expected <![CDATA[",e,l));l+=5,s=17,h=l+1}else if(e.charCodeAt(l+1)==68||e.charCodeAt(l+1)==100){if(c.substr(e,l+2,6).toUpperCase()!="OCTYPE")throw T.thrown(new It("Expected <!DOCTYPE",e,l));l+=8,s=16,h=l+1}else{if(e.charCodeAt(l+1)!=45||e.charCodeAt(l+2)!=45)throw T.thrown(new It("Expected <!--",e,l));l+=2,s=15,h=l+1}break;case 47:if(i==null)throw T.thrown(new It("Expected node name",e,l));h=l+1,s=0,r=10;break;case 63:s=14,h=l;break;default:s=3,h=l;continue}break;case 3:if(!(f>=97&&f<=122||f>=65&&f<=90||f>=48&&f<=57||f==58||f==46||f==95||f==45)){if(l==h)throw T.thrown(new It("Expected node name",e,l));n=V.createElement(c.substr(e,h,l-h)),i.addChild(n),++o,s=0,r=4;continue}break;case 4:switch(f){case 47:s=11;break;case 62:s=9;break;default:s=5,h=l;continue}break;case 5:if(!(f>=97&&f<=122||f>=65&&f<=90||f>=48&&f<=57||f==58||f==46||f==95||f==45)){if(h==l)throw T.thrown(new It("Expected attribute name",e,l));if(a=c.substr(e,h,l-h),n.exists(a))throw T.thrown(new It("Duplicate attribute ["+a+"]",e,l));s=0,r=6;continue}break;case 6:if(f==61)s=0,r=7;else throw T.thrown(new It("Expected =",e,l));break;case 7:switch(f){case 34:case 39:p=new gt,s=8,h=l+1,m=f;break;default:throw T.thrown(new It('Expected "',e,l))}break;case 8:switch(f){case 38:let g=l-h;p.b+=g==null?c.substr(e,h,null):c.substr(e,h,g),s=18,_=8,h=l+1;break;case 60:case 62:if(t)throw T.thrown(new It("Invalid unescaped "+String.fromCodePoint(f)+" in attribute value",e,l));if(f==m){let d=l-h;p.b+=d==null?c.substr(e,h,null):c.substr(e,h,d);let x=p.b;p=new gt,n.set(a,x),s=0,r=4}break;default:if(f==m){let d=l-h;p.b+=d==null?c.substr(e,h,null):c.substr(e,h,d);let x=p.b;p=new gt,n.set(a,x),s=0,r=4}}break;case 9:l=ei.doParse(e,t,l,n),h=l,s=1;break;case 10:if(!(f>=97&&f<=122||f>=65&&f<=90||f>=48&&f<=57||f==58||f==46||f==95||f==45)){if(h==l)throw T.thrown(new It("Expected node name",e,l));let g=c.substr(e,h,l-h);if(i==null||i.nodeType!=0)throw T.thrown(new It("Unexpected </"+g+">, tag is not open",e,l));if(i.nodeType!=V.Element)throw T.thrown("Bad node type, expected Element but found "+(i.nodeType==null?"null":de.toString(i.nodeType)));if(g!=i.nodeName)throw i.nodeType!=V.Element?T.thrown("Bad node type, expected Element but found "+(i.nodeType==null?"null":de.toString(i.nodeType))):T.thrown(new It("Expected </"+i.nodeName+">",e,l));s=0,r=12;continue}break;case 11:if(f==62)s=1;else throw T.thrown(new It("Expected >",e,l));break;case 12:if(f==62)return o==0&&i.addChild(V.createPCData("")),l;throw T.thrown(new It("Expected >",e,l));case 13:if(f==60){let g=l-h;p.b+=g==null?c.substr(e,h,null):c.substr(e,h,g);let d=V.createPCData(p.b);p=new gt,i.addChild(d),++o,s=0,r=2}else if(f==38){let g=l-h;p.b+=g==null?c.substr(e,h,null):c.substr(e,h,g),s=18,_=13,h=l+1}break;case 14:if(f==63&&e.charCodeAt(l+1)==62){++l;let g=c.substr(e,h+1,l-h-2);i.addChild(V.createProcessingInstruction(g)),++o,s=1}break;case 15:f==45&&e.charCodeAt(l+1)==45&&e.charCodeAt(l+2)==62&&(i.addChild(V.createComment(c.substr(e,h,l-h))),++o,l+=2,s=1);break;case 16:f==91?++u:f==93?--u:f==62&&u==0&&(i.addChild(V.createDocType(c.substr(e,h,l-h))),++o,s=1);break;case 17:if(f==93&&e.charCodeAt(l+1)==93&&e.charCodeAt(l+2)==62){let g=V.createCData(c.substr(e,h,l-h));i.addChild(g),++o,l+=2,s=1}break;case 18:if(f==59){let g=c.substr(e,h,l-h);if(g.charCodeAt(0)==35){let d=g.charCodeAt(1)==120?Y.parseInt("0"+c.substr(g,1,g.length-1)):Y.parseInt(c.substr(g,1,g.length-1));p.b+=String.fromCodePoint(d)}else if(Object.prototype.hasOwnProperty.call(ei.escapes.h,g))p.b+=Y.string(ei.escapes.h[g]);else{if(t)throw T.thrown(new It("Undefined entity: "+g,e,l));p.b+=Y.string("&"+g+";")}h=l+1,s=_}else if(!(f>=97&&f<=122||f>=65&&f<=90||f>=48&&f<=57||f==58||f==46||f==95||f==45)&&f!=35){if(t)throw T.thrown(new It("Invalid character in entity: "+String.fromCodePoint(f),e,l));p.b+=String.fromCodePoint(38);let g=l-h;p.b+=g==null?c.substr(e,h,null):c.substr(e,h,g),--l,h=l+1,s=_}break}++l}if(s==1&&(h=l,s=13),s==13){if(i.nodeType==0)throw i.nodeType!=V.Element?T.thrown("Bad node type, expected Element but found "+(i.nodeType==null?"null":de.toString(i.nodeType))):T.thrown(new It("Unclosed node <"+i.nodeName+">",e,l));if(l!=h||o==0){let f=l-h;p.b+=f==null?c.substr(e,h,null):c.substr(e,h,f),i.addChild(V.createPCData(p.b)),++o}return l}if(!t&&s==18&&_==13){p.b+=String.fromCodePoint(38);let f=l-h;return p.b+=f==null?c.substr(e,h,null):c.substr(e,h,f),i.addChild(V.createPCData(p.b)),++o,l}throw T.thrown(new It("Unexpected end",e,l))}}Q["haxe.xml.Parser"]=ei,ei.__name__="haxe.xml.Parser";class hi{constructor(e){this.output=new gt,this.pretty=e}writeNode(e,t){switch(e.nodeType){case 0:if(this.output.b+=Y.string(t+"<"),e.nodeType!=V.Element)throw T.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":de.toString(e.nodeType)));this.output.b+=Y.string(e.nodeName);let l=e.attributes();for(;l.hasNext();){let o=l.next();this.output.b+=Y.string(" "+o+'="');let u=He.htmlEscape(e.get(o),!0);this.output.b+=Y.string(u),this.output.b+='"'}if(this.hasChildren(e)){if(this.output.b+=">",this.pretty&&(this.output.b+=`
5
- `),e.nodeType!=V.Document&&e.nodeType!=V.Element)throw T.thrown("Bad node type, expected Element or Document but found "+(e.nodeType==null?"null":de.toString(e.nodeType)));let o=0,u=e.children;for(;o<u.length;){let p=u[o++];this.writeNode(p,this.pretty?t+" ":t)}if(this.output.b+=Y.string(t+"</"),e.nodeType!=V.Element)throw T.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":de.toString(e.nodeType)));this.output.b+=Y.string(e.nodeName),this.output.b+=">",this.pretty&&(this.output.b+=`
4
+ `,l),l<0?"":Pl.skipLines(e,--t,l+1)):e.substring(l)}}Q["haxe.NativeStackTrace"]=Pl,Pl.__name__="haxe.NativeStackTrace";class fi{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 l=new fi(t);return l.run=function(){l.stop(),e()},l}}Q["haxe.Timer"]=fi,fi.__name__="haxe.Timer",Object.assign(fi.prototype,{__class__:fi});class _i extends C{constructor(e,t,l){super(String(e),t,l),this.value=e}unwrap(){return this.value}}Q["haxe.ValueException"]=_i,_i.__name__="haxe.ValueException",_i.__super__=C,Object.assign(_i.prototype,{__class__:_i});class mi{constructor(){}set(e,t){this.root=this.setLoop(e,t,this.root)}get(e){let t=this.root;for(;t!=null;){let l=this.compare(e,t.key);if(l==0)return t.value;l<0?t=t.left:t=t.right}return null}keys(){let e=[];return this.keysLoop(this.root,e),new Il(e)}setLoop(e,t,l){if(l==null)return new rl(null,e,t,null);let i=this.compare(e,l.key);if(i==0)return new rl(l.left,e,t,l.right,l==null?0:l._height);if(i<0){let n=this.setLoop(e,t,l.left);return this.balance(n,l.key,l.value,l.right)}else{let n=this.setLoop(e,t,l.right);return this.balance(l.left,l.key,l.value,n)}}keysLoop(e,t){e!=null&&(this.keysLoop(e.left,t),t.push(e.key),this.keysLoop(e.right,t))}balance(e,t,l,i){let n=e==null?0:e._height,s=i==null?0:i._height;if(n>s+2){let r=e.left,a=e.right;return(r==null?0:r._height)>=(a==null?0:a._height)?new rl(e.left,e.key,e.value,new rl(e.right,t,l,i)):new rl(new rl(e.left,e.key,e.value,e.right.left),e.right.key,e.right.value,new rl(e.right.right,t,l,i))}else if(s>n+2){let r=i.right,a=i.left;return(r==null?0:r._height)>(a==null?0:a._height)?new rl(new rl(e,t,l,i.left),i.key,i.value,i.right):new rl(new rl(e,t,l,i.left.left),i.left.key,i.left.value,new rl(i.left.right,i.key,i.value,i.right))}else return new rl(e,t,l,i,(n>s?n:s)+1)}compare(e,t){return qe.compare(e,t)}}Q["haxe.ds.BalancedTree"]=mi,mi.__name__="haxe.ds.BalancedTree",mi.__interfaces__=[Et],Object.assign(mi.prototype,{__class__:mi});class rl{constructor(e,t,l,i,n){if(n==null&&(n=-1),this.left=e,this.key=t,this.value=l,this.right=i,n==-1){let s,r=this.left,a=this.right;if((r==null?0:r._height)>(a==null?0:a._height)){let h=this.left;s=h==null?0:h._height}else{let h=this.right;s=h==null?0:h._height}this._height=s+1}else this._height=n}}Q["haxe.ds.TreeNode"]=rl,rl.__name__="haxe.ds.TreeNode",Object.assign(rl.prototype,{__class__:rl});class ri extends mi{constructor(){super()}compare(e,t){let l=e._hx_index-t._hx_index;if(l!=0)return l;let i=_e.enumParameters(e),n=_e.enumParameters(t);return i.length==0&&n.length==0?0:this.compareArgs(i,n)}compareArgs(e,t){let l=e.length-t.length;if(l!=0)return l;let i=0,n=e.length;for(;i<n;){let s=i++,r=this.compareArg(e[s],t[s]);if(r!=0)return r}return 0}compareArg(e,t){return qe.isEnumValue(e)&&qe.isEnumValue(t)?this.compare(e,t):e instanceof Array&&t instanceof Array?this.compareArgs(e,t):qe.compare(e,t)}}Q["haxe.ds.EnumValueMap"]=ri,ri.__name__="haxe.ds.EnumValueMap",ri.__interfaces__=[Et],ri.__super__=mi,Object.assign(ri.prototype,{__class__:ri});class Kl{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 Il(e)}}Q["haxe.ds.IntMap"]=Kl,Kl.__name__="haxe.ds.IntMap",Kl.__interfaces__=[Et],Object.assign(Kl.prototype,{__class__:Kl});class Ui{constructor(){this.length=0}add(e){let t=new Ci(e,null);this.h==null?this.h=t:this.q.next=t,this.q=t,this.length++}push(e){let t=new Ci(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}}Q["haxe.ds.List"]=Ui,Ui.__name__="haxe.ds.List",Object.assign(Ui.prototype,{__class__:Ui});class Ci{constructor(e,t){this.item=e,this.next=t}}Q["haxe.ds._List.ListNode"]=Ci,Ci.__name__="haxe.ds._List.ListNode",Object.assign(Ci.prototype,{__class__:Ci});class Ti{constructor(){this.h={__keys__:{}}}set(e,t){let l=e.__id__;l==null&&(l=e.__id__=on.$haxeUID++),this.h[l]=t,this.h.__keys__[l]=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 Il(e)}}Q["haxe.ds.ObjectMap"]=Ti,Ti.__name__="haxe.ds.ObjectMap",Ti.__interfaces__=[Et],Object.assign(Ti.prototype,{__class__:Ti});class Ee{constructor(){this.h=Object.create(null)}get(e){return this.h[e]}set(e,t){this.h[e]=t}keys(){return new Ei(this.h)}}Q["haxe.ds.StringMap"]=Ee,Ee.__name__="haxe.ds.StringMap",Ee.__interfaces__=[Et],Object.assign(Ee.prototype,{__class__:Ee});class Ei{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++]}}Q["haxe.ds._StringMap.StringMapKeyIterator"]=Ei,Ei.__name__="haxe.ds._StringMap.StringMapKeyIterator",Object.assign(Ei.prototype,{__class__:Ei});class pn{static blit(e,t,l,i,n){if(e==l){if(t<i){let s=t+n,r=i+n,a=0,h=n;for(;a<h;){let o=a++;--s,--r,e[r]=e[s]}}else if(t>i){let s=t,r=i,a=0,h=n;for(;a<h;){let o=a++;e[r]=e[s],++s,++r}}}else{let s=0,r=n;for(;s<r;){let a=s++;l[i+a]=e[t+a]}}}}class De{constructor(e){switch(e){case".":case"..":this.dir=e,this.file="";return}let t=e.lastIndexOf("/"),l=e.lastIndexOf("\\");t<l?(this.dir=c.substr(e,0,l),e=c.substr(e,l+1,null),this.backslash=!0):l<t?(this.dir=c.substr(e,0,t),e=c.substr(e,t+1,null)):this.dir=null;let i=e.lastIndexOf(".");i!=-1?(this.ext=c.substr(e,i+1,null),this.file=c.substr(e,0,i)):(this.ext=null,this.file=e)}toString(){return(this.dir==null?"":this.dir+(this.backslash?"\\":"/"))+this.file+(this.ext==null?"":"."+this.ext)}static withoutDirectory(e){let t=new De(e);return t.dir=null,t.toString()}static directory(e){let t=new De(e);return t.dir==null?"":t.dir}static join(e){let t=[],l=0,i=e;for(;l<i.length;){let h=i[l];++l,h!=null&&h!=""&&t.push(h)}let n=t;if(n.length==0)return"";let s=n[0],r=1,a=n.length;for(;r<a;){let h=r++;s=De.addTrailingSlash(s),s+=n[h]}return De.normalize(s)}static normalize(e){let t="/";if(e=e.split("\\").join(t),e==t)return t;let l=[],i=0,n=e.split(t);for(;i<n.length;){let p=n[i];++i,p==".."&&l.length>0&&l[l.length-1]!=".."?l.pop():p==""?(l.length>0||c.cca(e,0)==47)&&l.push(p):p!="."&&l.push(p)}let s=l.join(t),r="",a=!1,h=!1,o=0,u=s;for(;o<u.length;){let p=u,_=o++,m=p.charCodeAt(_);m>=55296&&m<=56319&&(m=m-55232<<10|p.charCodeAt(_+1)&1023);let f=m;f>=65536&&++o;let g=f;switch(g){case 47:if(!a)h=!0;else{let w=g;a=!1,h&&(r+="/",h=!1),r+=String.fromCodePoint(w)}break;case 58:r+=":",a=!0;break;default:let d=g;a=!1,h&&(r+="/",h=!1),r+=String.fromCodePoint(d)}}return r}static addTrailingSlash(e){if(e.length==0)return"/";let t=e.lastIndexOf("/"),l=e.lastIndexOf("\\");return t<l?l!=e.length-1?e+"\\":e:t!=e.length-1?e+"/":e}static isAbsolute(e){return!!(e.startsWith("/")||e.charAt(1)==":"||e.startsWith("\\\\"))}}Q["haxe.io.Path"]=De,De.__name__="haxe.io.Path",Object.assign(De.prototype,{__class__:De});class Il{constructor(e){this.current=0,this.array=e}hasNext(){return this.current<this.array.length}next(){return this.array[this.current++]}}Q["haxe.iterators.ArrayIterator"]=Il,Il.__name__="haxe.iterators.ArrayIterator",Object.assign(Il.prototype,{__class__:Il});var tl=Ye["haxe.rtti.CType"]={__ename__:"haxe.rtti.CType",__constructs__:null,CUnknown:{_hx_name:"CUnknown",_hx_index:0,__enum__:"haxe.rtti.CType",toString:F},CEnum:(x=function(b,e){return{_hx_index:1,name:b,params:e,__enum__:"haxe.rtti.CType",toString:F}},x._hx_name="CEnum",x.__params__=["name","params"],x),CClass:(x=function(b,e){return{_hx_index:2,name:b,params:e,__enum__:"haxe.rtti.CType",toString:F}},x._hx_name="CClass",x.__params__=["name","params"],x),CTypedef:(x=function(b,e){return{_hx_index:3,name:b,params:e,__enum__:"haxe.rtti.CType",toString:F}},x._hx_name="CTypedef",x.__params__=["name","params"],x),CFunction:(x=function(b,e){return{_hx_index:4,args:b,ret:e,__enum__:"haxe.rtti.CType",toString:F}},x._hx_name="CFunction",x.__params__=["args","ret"],x),CAnonymous:(x=function(b){return{_hx_index:5,fields:b,__enum__:"haxe.rtti.CType",toString:F}},x._hx_name="CAnonymous",x.__params__=["fields"],x),CDynamic:(x=function(b){return{_hx_index:6,t:b,__enum__:"haxe.rtti.CType",toString:F}},x._hx_name="CDynamic",x.__params__=["t"],x),CAbstract:(x=function(b,e){return{_hx_index:7,name:b,params:e,__enum__:"haxe.rtti.CType",toString:F}},x._hx_name="CAbstract",x.__params__=["name","params"],x)};tl.__constructs__=[tl.CUnknown,tl.CEnum,tl.CClass,tl.CTypedef,tl.CFunction,tl.CAnonymous,tl.CDynamic,tl.CAbstract];var zt=Ye["haxe.rtti.Rights"]={__ename__:"haxe.rtti.Rights",__constructs__:null,RNormal:{_hx_name:"RNormal",_hx_index:0,__enum__:"haxe.rtti.Rights",toString:F},RNo:{_hx_name:"RNo",_hx_index:1,__enum__:"haxe.rtti.Rights",toString:F},RCall:(x=function(b){return{_hx_index:2,m:b,__enum__:"haxe.rtti.Rights",toString:F}},x._hx_name="RCall",x.__params__=["m"],x),RMethod:{_hx_name:"RMethod",_hx_index:3,__enum__:"haxe.rtti.Rights",toString:F},RDynamic:{_hx_name:"RDynamic",_hx_index:4,__enum__:"haxe.rtti.Rights",toString:F},RInline:{_hx_name:"RInline",_hx_index:5,__enum__:"haxe.rtti.Rights",toString:F}};zt.__constructs__=[zt.RNormal,zt.RNo,zt.RCall,zt.RMethod,zt.RDynamic,zt.RInline];var Jl=Ye["haxe.rtti.TypeTree"]={__ename__:"haxe.rtti.TypeTree",__constructs__:null,TPackage:(x=function(b,e,t){return{_hx_index:0,name:b,full:e,subs:t,__enum__:"haxe.rtti.TypeTree",toString:F}},x._hx_name="TPackage",x.__params__=["name","full","subs"],x),TClassdecl:(x=function(b){return{_hx_index:1,c:b,__enum__:"haxe.rtti.TypeTree",toString:F}},x._hx_name="TClassdecl",x.__params__=["c"],x),TEnumdecl:(x=function(b){return{_hx_index:2,e:b,__enum__:"haxe.rtti.TypeTree",toString:F}},x._hx_name="TEnumdecl",x.__params__=["e"],x),TTypedecl:(x=function(b){return{_hx_index:3,t:b,__enum__:"haxe.rtti.TypeTree",toString:F}},x._hx_name="TTypedecl",x.__params__=["t"],x),TAbstractdecl:(x=function(b){return{_hx_index:4,a:b,__enum__:"haxe.rtti.TypeTree",toString:F}},x._hx_name="TAbstractdecl",x.__params__=["a"],x)};Jl.__constructs__=[Jl.TPackage,Jl.TClassdecl,Jl.TEnumdecl,Jl.TTypedecl,Jl.TAbstractdecl];class ht{static typeInfos(e){let t;switch(e._hx_index){case 0:let l=e.name,i=e.full,n=e.subs;throw C.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,l){let i=0,n=l,s=0;for(;s<t.length;){let r=t[s];if(++s,i>=n.length)return!1;let a=n[i++];if(!e(r,a))return!1}return!(i<n.length)}static rightsEq(e,t){if(e==t)return!0;if(e._hx_index==2){let l=e.m;if(t._hx_index==2){let i=t.m;return l==i}}return!1}static typeEq(e,t){switch(e._hx_index){case 0:return t==tl.CUnknown;case 1:let l=e.name,i=e.params;if(t._hx_index==1){let f=t.name,g=t.params;return l==f?ht.leq(ht.typeEq,i,g):!1}break;case 2:let n=e.name,s=e.params;if(t._hx_index==2){let f=t.name,g=t.params;return n==f?ht.leq(ht.typeEq,s,g):!1}break;case 3:let r=e.name,a=e.params;if(t._hx_index==3){let f=t.name,g=t.params;return r==f?ht.leq(ht.typeEq,a,g):!1}break;case 4:let h=e.args,o=e.ret;if(t._hx_index==4){let f=t.args,g=t.ret;return ht.leq(function(d,w){return d.name==w.name&&d.opt==w.opt?ht.typeEq(d.t,w.t):!1},h,f)?ht.typeEq(o,g):!1}break;case 5:let u=e.fields;if(t._hx_index==5){let f=t.fields;return ht.leq(function(g,d){return ht.fieldEq(g,d)},u,f)}break;case 6:let p=e.t;if(t._hx_index==6){let f=t.t;return p==null!=(f==null)?!1:p!=null?ht.typeEq(p,f):!0}break;case 7:let _=e.name,m=e.params;if(t._hx_index==7){let f=t.name,g=t.params;return _==f?ht.leq(ht.typeEq,m,g):!1}break}return!1}static fieldEq(e,t){return!(e.name!=t.name||!ht.typeEq(e.type,t.type)||e.isPublic!=t.isPublic||e.doc!=t.doc||!ht.rightsEq(e.get,t.get)||!ht.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&&!ht.leq(function(l,i){return l.name==i.name&&l.opt==i.opt?ht.typeEq(l.t,i.t):!1},e.args,t.args))}}Q["haxe.rtti.TypeApi"]=ht,ht.__name__="haxe.rtti.TypeApi";class Vi{constructor(){this.root=[]}process(e,t){if(this.curplatform=t,e.nodeType!=V.Document&&e.nodeType!=V.Element)throw C.thrown("Invalid nodeType "+(e.nodeType==null?"null":de.toString(e.nodeType)));this.xroot(e)}mergeRights(e,t){return e.get==zt.RInline&&e.set==zt.RNo&&t.get==zt.RNormal&&t.set==zt.RMethod?(e.get=zt.RNormal,e.set=zt.RMethod,!0):_e.enumEq(e.get,t.get)?_e.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 ht.fieldEq(e,t)?!0:e.name==t.name&&(this.mergeRights(e,t)||this.mergeRights(t,e))&&this.mergeDoc(e,t)?ht.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 l=0,i=t.fields;for(;l<i.length;){let r=i[l];++l;let a=null,h=0,o=e.fields;for(;h<o.length;){let u=o[h];if(++h,this.mergeFields(u,r)){a=u;break}}a==null?(this.newField(e,r),e.fields.push(r)):this.curplatform!=null&&a.platforms.push(this.curplatform)}let n=0,s=t.statics;for(;n<s.length;){let r=s[n];++n;let a=null,h=0,o=e.statics;for(;h<o.length;){let u=o[h];if(++h,this.mergeFields(u,r)){a=u;break}}a==null?(this.newField(e,r),e.statics.push(r)):this.curplatform!=null&&a.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 l=0,i=t.constructors;for(;l<i.length;){let n=i[l];++l;let s=null,r=0,a=e.constructors;for(;r<a.length;){let h=a[r];if(++r,ht.constructorEq(h,n)){s=h;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 l=0,i=e.to.length;for(;l<i;){let r=l++;if(!ht.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(!ht.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=ht.typeInfos(e),l=t.path.split("."),i=this.root,n=[];l.pop();let s=0;for(;s<l.length;){let a=l[s];++s;let h=!1,o=0;for(;o<i.length;){let u=i[o];if(++o,u._hx_index==0){let p=u.full,_=u.name,m=u.subs;if(_==a){h=!0,i=m;break}}}if(n.push(a),!h){let u=[];i.push(Jl.TPackage(a,n.join("."),u)),i=u}}let r=0;for(;r<i.length;){let a=i[r];++r;let h;if(a._hx_index==0){let u=a.name,p=a.full,_=a.subs;h=!0}else h=!1;if(h)continue;let o=ht.typeInfos(a);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(a._hx_index){case 0:let _=a.name,m=a.full,f=a.subs;u=!1;break;case 1:let g=a.c;if(e._hx_index==1){let S=e.c;if(this.mergeClasses(g,S))return}else u=!1;break;case 2:let d=a.e;if(e._hx_index==2){let S=e.e;if(this.mergeEnums(d,S))return}else u=!1;break;case 3:let w=a.t;if(e._hx_index==3){let S=e.t;if(this.mergeTypedefs(w,S))return}break;case 4:let y=a.a;if(e._hx_index==4){let S=e.a;if(this.mergeAbstracts(y,S))return}else u=!1;break}let p=o.module!=t.module?"module "+t.module+" should be "+o.module:o.doc!=t.doc?"documentation is different":o.isPrivate!=t.isPrivate?"private flag is different":u?"could not merge definition":"type kind is different";throw C.thrown("Incompatibilities between "+o.path+" in "+o.platforms.join(",")+" and "+this.curplatform+" ("+p+")")}}i.push(e)}mkPath(e){return e}mkTypeParams(e){let t=e.split(":");return t[0]==""?[]:t}mkRights(e){switch(e){case"dynamic":return zt.RDynamic;case"inline":return zt.RInline;case"method":return zt.RMethod;case"null":return zt.RNo;default:return zt.RCall(e)}}xerror(e){let t;if(e.nodeType==V.Document)t="Document";else{if(e.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":de.toString(e.nodeType)));t=e.nodeName}throw C.thrown("Invalid "+t)}xroot(e){let t=e.elements();for(;t.hasNext();){let l=t.next();this.merge(this.processElement(l))}}processElement(e){if(e.nodeType!=V.Document&&e.nodeType!=V.Element)throw C.thrown("Invalid nodeType "+(e.nodeType==null?"null":de.toString(e.nodeType)));let t=e,l;if(t.nodeType==V.Document)l="Document";else{if(t.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element but found "+(t.nodeType==null?"null":de.toString(t.nodeType)));l=t.nodeName}switch(l){case"abstract":return Jl.TAbstractdecl(this.xabstract(t));case"class":return Jl.TClassdecl(this.xclass(t));case"enum":return Jl.TEnumdecl(this.xenum(t));case"typedef":return Jl.TTypedecl(this.xtypedef(t));default:return this.xerror(t)}}xmeta(e){let t=[],l=0,i=wn.resolve(e,"m");for(;l<i.length;){let n=i[l];++l;let s=[],r=0,a=wn.resolve(n,"e");for(;r<a.length;){let h=a[r];++r,s.push(ai.get_innerHTML(h))}t.push({name:Xe.resolve(n,"n"),params:s})}return t}xoverloads(e){let t=[],l=e.elements();for(;l.hasNext();){let i=l.next();t.push(this.xclassfield(i))}return t}xpath(e){let t=this.mkPath(Xe.resolve(e,"path")),l=[],i=e.elements();for(;i.hasNext();){let n=i.next();l.push(this.xtype(n))}return{path:t,params:l}}xclass(e){let t=null,l=null,i=null,n=[],s=[],r=[],a=[],h=e.exists("interface"),o=e.elements();for(;o.hasNext();){let u=o.next(),p;if(u.nodeType==V.Document)p="Document";else{if(u.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element but found "+(u.nodeType==null?"null":de.toString(u.nodeType)));p=u.nodeName}switch(p){case"extends":h?n.push(this.xpath(u)):t=this.xpath(u);break;case"haxe_doc":l=ai.get_innerData(u);break;case"haxe_dynamic":let _=u.firstElement();if(_.nodeType!=V.Document&&_.nodeType!=V.Element)throw C.thrown("Invalid nodeType "+(_.nodeType==null?"null":de.toString(_.nodeType)));i=this.xtype(_);break;case"implements":n.push(this.xpath(u));break;case"meta":a=this.xmeta(u);break;default:u.exists("static")?r.push(this.xclassfield(u)):s.push(this.xclassfield(u))}}return{file:al.resolve(e,"file")?Xe.resolve(e,"file"):null,path:this.mkPath(Xe.resolve(e,"path")),module:al.resolve(e,"module")?this.mkPath(Xe.resolve(e,"module")):null,doc:l,isPrivate:e.exists("private"),isExtern:e.exists("extern"),isFinal:e.exists("final"),isInterface:h,params:this.mkTypeParams(Xe.resolve(e,"params")),superClass:t,interfaces:n,fields:s,statics:r,tdynamic:i,platforms:this.defplat(),meta:a}}xclassfield(e,t){t==null&&(t=!1);let l=e.elements(),i=this.xtype(l.next()),n=null,s=[],r=null,a=l;for(;a.hasNext();){let o=a.next(),u;if(o.nodeType==V.Document)u="Document";else{if(o.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element but found "+(o.nodeType==null?"null":de.toString(o.nodeType)));u=o.nodeName}switch(u){case"haxe_doc":n=ai.get_innerData(o);break;case"meta":s=this.xmeta(o);break;case"overloads":r=this.xoverloads(o);break;default:this.xerror(o)}}let h;if(e.nodeType==V.Document)h="Document";else{if(e.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":de.toString(e.nodeType)));h=e.nodeName}return{name:h,type:i,isPublic:e.exists("public")||t,isFinal:e.exists("final"),isOverride:e.exists("override"),line:al.resolve(e,"line")?Y.parseInt(Xe.resolve(e,"line")):null,doc:n,get:al.resolve(e,"get")?this.mkRights(Xe.resolve(e,"get")):zt.RNormal,set:al.resolve(e,"set")?this.mkRights(Xe.resolve(e,"set")):zt.RNormal,params:al.resolve(e,"params")?this.mkTypeParams(Xe.resolve(e,"params")):[],platforms:this.defplat(),meta:s,overloads:r,expr:al.resolve(e,"expr")?Xe.resolve(e,"expr"):null}}xenum(e){let t=[],l=null,i=[],n=e.elements();for(;n.hasNext();){let s=n.next(),r;if(s.nodeType==V.Document)r="Document";else{if(s.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element but found "+(s.nodeType==null?"null":de.toString(s.nodeType)));r=s.nodeName}if(r=="haxe_doc")l=ai.get_innerData(s);else{let a;if(s.nodeType==V.Document)a="Document";else{if(s.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element but found "+(s.nodeType==null?"null":de.toString(s.nodeType)));a=s.nodeName}a=="meta"?i=this.xmeta(s):t.push(this.xenumfield(s))}}return{file:al.resolve(e,"file")?Xe.resolve(e,"file"):null,path:this.mkPath(Xe.resolve(e,"path")),module:al.resolve(e,"module")?this.mkPath(Xe.resolve(e,"module")):null,doc:l,isPrivate:e.exists("private"),isExtern:e.exists("extern"),params:this.mkTypeParams(Xe.resolve(e,"params")),constructors:t,platforms:this.defplat(),meta:i}}xenumfield(e){let t=null,l=e.elementsNamed("haxe_doc"),i=l.hasNext()?l.next():null,n=En.resolve(e,"meta")?this.xmeta(xn.resolve(e,"meta")):[];if(al.resolve(e,"a")){let a=Xe.resolve(e,"a").split(":"),h=e.elements();t=[];let o=0;for(;o<a.length;){let u=a[o];++o;let p=!1;u.charAt(0)=="?"&&(p=!0,u=c.substr(u,1,null)),t.push({name:u,opt:p,t:this.xtype(h.next())})}}let s;if(e.nodeType==V.Document)s="Document";else{if(e.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":de.toString(e.nodeType)));s=e.nodeName}let r;if(i==null)r=null;else{if(i.nodeType!=V.Document&&i.nodeType!=V.Element)throw C.thrown("Invalid nodeType "+(i.nodeType==null?"null":de.toString(i.nodeType)));r=ai.get_innerData(i)}return{name:s,args:t,doc:r,meta:n,platforms:this.defplat()}}xabstract(e){let t=null,l=null,i=null,n=[],s=[],r=[],a=e.elements();for(;a.hasNext();){let h=a.next(),o;if(h.nodeType==V.Document)o="Document";else{if(h.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element but found "+(h.nodeType==null?"null":de.toString(h.nodeType)));o=h.nodeName}switch(o){case"from":let u=h.elements();for(;u.hasNext();){let m=u.next(),f=m.firstElement();if(f.nodeType!=V.Document&&f.nodeType!=V.Element)throw C.thrown("Invalid nodeType "+(f.nodeType==null?"null":de.toString(f.nodeType)));r.push({t:this.xtype(f),field:al.resolve(m,"field")?Xe.resolve(m,"field"):null})}break;case"haxe_doc":t=ai.get_innerData(h);break;case"impl":l=this.xclass(xn.resolve(h,"class"));break;case"meta":n=this.xmeta(h);break;case"this":let p=h.firstElement();if(p.nodeType!=V.Document&&p.nodeType!=V.Element)throw C.thrown("Invalid nodeType "+(p.nodeType==null?"null":de.toString(p.nodeType)));i=this.xtype(p);break;case"to":let _=h.elements();for(;_.hasNext();){let m=_.next(),f=m.firstElement();if(f.nodeType!=V.Document&&f.nodeType!=V.Element)throw C.thrown("Invalid nodeType "+(f.nodeType==null?"null":de.toString(f.nodeType)));s.push({t:this.xtype(f),field:al.resolve(m,"field")?Xe.resolve(m,"field"):null})}break;default:this.xerror(h)}}return{file:al.resolve(e,"file")?Xe.resolve(e,"file"):null,path:this.mkPath(Xe.resolve(e,"path")),module:al.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:i,to:s,from:r,impl:l}}xtypedef(e){let t=null,l=null,i=[],n=e.elements();for(;n.hasNext();){let r=n.next(),a;if(r.nodeType==V.Document)a="Document";else{if(r.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element but found "+(r.nodeType==null?"null":de.toString(r.nodeType)));a=r.nodeName}if(a=="haxe_doc")t=ai.get_innerData(r);else{let h;if(r.nodeType==V.Document)h="Document";else{if(r.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element but found "+(r.nodeType==null?"null":de.toString(r.nodeType)));h=r.nodeName}h=="meta"?i=this.xmeta(r):l=this.xtype(r)}}let s=new Ee;return this.curplatform!=null&&(s.h[this.curplatform]=l),{file:al.resolve(e,"file")?Xe.resolve(e,"file"):null,path:this.mkPath(Xe.resolve(e,"path")),module:al.resolve(e,"module")?this.mkPath(Xe.resolve(e,"module")):null,doc:t,isPrivate:e.exists("private"),params:this.mkTypeParams(Xe.resolve(e,"params")),type:l,types:s,platforms:this.defplat(),meta:i}}xtype(e){let t;if(e.nodeType==V.Document)t="Document";else{if(e.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":de.toString(e.nodeType)));t=e.nodeName}switch(t){case"a":let l=[],i=e.elements();for(;i.hasNext();){let m=i.next(),f=this.xclassfield(m,!0);f.platforms=[],l.push(f)}return tl.CAnonymous(l);case"c":return tl.CClass(this.mkPath(Xe.resolve(e,"path")),this.xtypeparams(e));case"d":let n=null,s=e.firstElement();if(s!=null){if(s.nodeType!=V.Document&&s.nodeType!=V.Element)throw C.thrown("Invalid nodeType "+(s.nodeType==null?"null":de.toString(s.nodeType)));n=this.xtype(s)}return tl.CDynamic(n);case"e":return tl.CEnum(this.mkPath(Xe.resolve(e,"path")),this.xtypeparams(e));case"f":let r=[],a=Xe.resolve(e,"a").split(":"),h=0,o=a,u=al.resolve(e,"v")?new Il(Xe.resolve(e,"v").split(":")):null,p=e.elements();for(;p.hasNext();){let m=p.next(),f=!1,g=h<o.length?o[h++]:null;g==null&&(g=""),g.charAt(0)=="?"&&(f=!0,g=c.substr(g,1,null));let d=u==null||u.current>=u.array.length?null:u.array[u.current++];r.push({name:g,opt:f,t:this.xtype(m),value:d==""?null:d})}let _=r[r.length-1];return c.remove(r,_),tl.CFunction(r,_.t);case"t":return tl.CTypedef(this.mkPath(Xe.resolve(e,"path")),this.xtypeparams(e));case"unknown":return tl.CUnknown;case"x":return tl.CAbstract(this.mkPath(Xe.resolve(e,"path")),this.xtypeparams(e));default:return this.xerror(e)}}xtypeparams(e){let t=[],l=e.elements();for(;l.hasNext();){let i=l.next();t.push(this.xtype(i))}return t}defplat(){let e=[];return this.curplatform!=null&&e.push(this.curplatform),e}}Q["haxe.rtti.XmlParser"]=Vi,Vi.__name__="haxe.rtti.XmlParser",Object.assign(Vi.prototype,{__class__:Vi});class xn{static resolve(e,t){let l=e.elementsNamed(t).next();if(l==null){let i;if(e.nodeType==V.Document)i="Document";else{if(e.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":de.toString(e.nodeType)));i=e.nodeName}throw C.thrown(i+" is missing element "+t)}if(l.nodeType!=V.Document&&l.nodeType!=V.Element)throw C.thrown("Invalid nodeType "+(l.nodeType==null?"null":de.toString(l.nodeType)));return l}}class Xe{static resolve(e,t){if(e.nodeType==V.Document)throw C.thrown("Cannot access document attribute "+t);let l=e.get(t);if(l==null)throw e.nodeType!=V.Element?C.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":de.toString(e.nodeType))):C.thrown(e.nodeName+" is missing attribute "+t);return l}}class al{static resolve(e,t){if(e.nodeType==V.Document)throw C.thrown("Cannot access document attribute "+t);return e.exists(t)}}class En{static resolve(e,t){return e.elementsNamed(t).hasNext()}}class wn{static resolve(e,t){let l=[],i=e.elementsNamed(t);for(;i.hasNext();){let n=i.next();if(n.nodeType!=V.Document&&n.nodeType!=V.Element)throw C.thrown("Invalid nodeType "+(n.nodeType==null?"null":de.toString(n.nodeType)));l.push(n)}return l}}class ai{static get_innerData(e){if(e.nodeType!=V.Document&&e.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element or Document but found "+(e.nodeType==null?"null":de.toString(e.nodeType)));let t=0,l=e.children;if(t>=l.length){let n;if(e.nodeType==V.Document)n="Document";else{if(e.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":de.toString(e.nodeType)));n=e.nodeName}throw C.thrown(n+" does not have data")}let i=l[t++];if(t<l.length){let n=l[t++],s;if(i.nodeType==V.PCData&&n.nodeType==V.CData){if(i.nodeType==V.Document||i.nodeType==V.Element)throw C.thrown("Bad node type, unexpected "+(i.nodeType==null?"null":de.toString(i.nodeType)));s=He.trim(i.nodeValue)==""}else s=!1;if(s){if(t>=l.length){if(n.nodeType==V.Document||n.nodeType==V.Element)throw C.thrown("Bad node type, unexpected "+(n.nodeType==null?"null":de.toString(n.nodeType)));return n.nodeValue}let a=l[t++],h;if(a.nodeType==V.PCData){if(a.nodeType==V.Document||a.nodeType==V.Element)throw C.thrown("Bad node type, unexpected "+(a.nodeType==null?"null":de.toString(a.nodeType)));h=He.trim(a.nodeValue)==""}else h=!1;if(h&&t>=l.length){if(n.nodeType==V.Document||n.nodeType==V.Element)throw C.thrown("Bad node type, unexpected "+(n.nodeType==null?"null":de.toString(n.nodeType)));return n.nodeValue}}let r;if(e.nodeType==V.Document)r="Document";else{if(e.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":de.toString(e.nodeType)));r=e.nodeName}throw C.thrown(r+" does not only have data")}if(i.nodeType!=V.PCData&&i.nodeType!=V.CData){let n;if(e.nodeType==V.Document)n="Document";else{if(e.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":de.toString(e.nodeType)));n=e.nodeName}throw C.thrown(n+" does not have data")}if(i.nodeType==V.Document||i.nodeType==V.Element)throw C.thrown("Bad node type, unexpected "+(i.nodeType==null?"null":de.toString(i.nodeType)));return i.nodeValue}static get_innerHTML(e){let t="";if(e.nodeType!=V.Document&&e.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element or Document but found "+(e.nodeType==null?"null":de.toString(e.nodeType)));let l=0,i=e.children;for(;l<i.length;){let n=i[l++];t+=Y.string(hi.print(n))}return t}}ai.__properties__={get_innerHTML:"get_innerHTML",get_innerData:"get_innerData"};class It{constructor(e,t,l){this.xml=t,this.message=e,this.position=l,this.lineNumber=1,this.positionAtLine=0;let i=0,n=l;for(;i<n;){let s=i++,r=t.charCodeAt(s);r==10?(this.lineNumber++,this.positionAtLine=0):r!=13&&this.positionAtLine++}}toString(){return te.getClass(this).__name__+": "+this.message+" at line "+this.lineNumber+" char "+this.positionAtLine}}Q["haxe.xml.XmlParserException"]=It,It.__name__="haxe.xml.XmlParserException",Object.assign(It.prototype,{__class__:It});class ei{static parse(e,t){t==null&&(t=!1);let l=V.createDocument();return ei.doParse(e,t,0,l),l}static doParse(e,t,l,i){l==null&&(l=0);let n=null,s=1,r=1,a=null,h=0,o=0,u=0,p=new gt,_=1,m=-1;for(;l<e.length;){let f=e.charCodeAt(l);switch(s){case 0:switch(f){case 9:case 10:case 13:case 32:break;default:s=r;continue}break;case 1:if(f==60)s=0,r=2;else{h=l,s=13;continue}break;case 2:switch(f){case 33:if(e.charCodeAt(l+1)==91){if(l+=2,c.substr(e,l,6).toUpperCase()!="CDATA[")throw C.thrown(new It("Expected <![CDATA[",e,l));l+=5,s=17,h=l+1}else if(e.charCodeAt(l+1)==68||e.charCodeAt(l+1)==100){if(c.substr(e,l+2,6).toUpperCase()!="OCTYPE")throw C.thrown(new It("Expected <!DOCTYPE",e,l));l+=8,s=16,h=l+1}else{if(e.charCodeAt(l+1)!=45||e.charCodeAt(l+2)!=45)throw C.thrown(new It("Expected <!--",e,l));l+=2,s=15,h=l+1}break;case 47:if(i==null)throw C.thrown(new It("Expected node name",e,l));h=l+1,s=0,r=10;break;case 63:s=14,h=l;break;default:s=3,h=l;continue}break;case 3:if(!(f>=97&&f<=122||f>=65&&f<=90||f>=48&&f<=57||f==58||f==46||f==95||f==45)){if(l==h)throw C.thrown(new It("Expected node name",e,l));n=V.createElement(c.substr(e,h,l-h)),i.addChild(n),++o,s=0,r=4;continue}break;case 4:switch(f){case 47:s=11;break;case 62:s=9;break;default:s=5,h=l;continue}break;case 5:if(!(f>=97&&f<=122||f>=65&&f<=90||f>=48&&f<=57||f==58||f==46||f==95||f==45)){if(h==l)throw C.thrown(new It("Expected attribute name",e,l));if(a=c.substr(e,h,l-h),n.exists(a))throw C.thrown(new It("Duplicate attribute ["+a+"]",e,l));s=0,r=6;continue}break;case 6:if(f==61)s=0,r=7;else throw C.thrown(new It("Expected =",e,l));break;case 7:switch(f){case 34:case 39:p=new gt,s=8,h=l+1,m=f;break;default:throw C.thrown(new It('Expected "',e,l))}break;case 8:switch(f){case 38:let g=l-h;p.b+=g==null?c.substr(e,h,null):c.substr(e,h,g),s=18,_=8,h=l+1;break;case 60:case 62:if(t)throw C.thrown(new It("Invalid unescaped "+String.fromCodePoint(f)+" in attribute value",e,l));if(f==m){let d=l-h;p.b+=d==null?c.substr(e,h,null):c.substr(e,h,d);let w=p.b;p=new gt,n.set(a,w),s=0,r=4}break;default:if(f==m){let d=l-h;p.b+=d==null?c.substr(e,h,null):c.substr(e,h,d);let w=p.b;p=new gt,n.set(a,w),s=0,r=4}}break;case 9:l=ei.doParse(e,t,l,n),h=l,s=1;break;case 10:if(!(f>=97&&f<=122||f>=65&&f<=90||f>=48&&f<=57||f==58||f==46||f==95||f==45)){if(h==l)throw C.thrown(new It("Expected node name",e,l));let g=c.substr(e,h,l-h);if(i==null||i.nodeType!=0)throw C.thrown(new It("Unexpected </"+g+">, tag is not open",e,l));if(i.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element but found "+(i.nodeType==null?"null":de.toString(i.nodeType)));if(g!=i.nodeName)throw i.nodeType!=V.Element?C.thrown("Bad node type, expected Element but found "+(i.nodeType==null?"null":de.toString(i.nodeType))):C.thrown(new It("Expected </"+i.nodeName+">",e,l));s=0,r=12;continue}break;case 11:if(f==62)s=1;else throw C.thrown(new It("Expected >",e,l));break;case 12:if(f==62)return o==0&&i.addChild(V.createPCData("")),l;throw C.thrown(new It("Expected >",e,l));case 13:if(f==60){let g=l-h;p.b+=g==null?c.substr(e,h,null):c.substr(e,h,g);let d=V.createPCData(p.b);p=new gt,i.addChild(d),++o,s=0,r=2}else if(f==38){let g=l-h;p.b+=g==null?c.substr(e,h,null):c.substr(e,h,g),s=18,_=13,h=l+1}break;case 14:if(f==63&&e.charCodeAt(l+1)==62){++l;let g=c.substr(e,h+1,l-h-2);i.addChild(V.createProcessingInstruction(g)),++o,s=1}break;case 15:f==45&&e.charCodeAt(l+1)==45&&e.charCodeAt(l+2)==62&&(i.addChild(V.createComment(c.substr(e,h,l-h))),++o,l+=2,s=1);break;case 16:f==91?++u:f==93?--u:f==62&&u==0&&(i.addChild(V.createDocType(c.substr(e,h,l-h))),++o,s=1);break;case 17:if(f==93&&e.charCodeAt(l+1)==93&&e.charCodeAt(l+2)==62){let g=V.createCData(c.substr(e,h,l-h));i.addChild(g),++o,l+=2,s=1}break;case 18:if(f==59){let g=c.substr(e,h,l-h);if(g.charCodeAt(0)==35){let d=g.charCodeAt(1)==120?Y.parseInt("0"+c.substr(g,1,g.length-1)):Y.parseInt(c.substr(g,1,g.length-1));p.b+=String.fromCodePoint(d)}else if(Object.prototype.hasOwnProperty.call(ei.escapes.h,g))p.b+=Y.string(ei.escapes.h[g]);else{if(t)throw C.thrown(new It("Undefined entity: "+g,e,l));p.b+=Y.string("&"+g+";")}h=l+1,s=_}else if(!(f>=97&&f<=122||f>=65&&f<=90||f>=48&&f<=57||f==58||f==46||f==95||f==45)&&f!=35){if(t)throw C.thrown(new It("Invalid character in entity: "+String.fromCodePoint(f),e,l));p.b+=String.fromCodePoint(38);let g=l-h;p.b+=g==null?c.substr(e,h,null):c.substr(e,h,g),--l,h=l+1,s=_}break}++l}if(s==1&&(h=l,s=13),s==13){if(i.nodeType==0)throw i.nodeType!=V.Element?C.thrown("Bad node type, expected Element but found "+(i.nodeType==null?"null":de.toString(i.nodeType))):C.thrown(new It("Unclosed node <"+i.nodeName+">",e,l));if(l!=h||o==0){let f=l-h;p.b+=f==null?c.substr(e,h,null):c.substr(e,h,f),i.addChild(V.createPCData(p.b)),++o}return l}if(!t&&s==18&&_==13){p.b+=String.fromCodePoint(38);let f=l-h;return p.b+=f==null?c.substr(e,h,null):c.substr(e,h,f),i.addChild(V.createPCData(p.b)),++o,l}throw C.thrown(new It("Unexpected end",e,l))}}Q["haxe.xml.Parser"]=ei,ei.__name__="haxe.xml.Parser";class hi{constructor(e){this.output=new gt,this.pretty=e}writeNode(e,t){switch(e.nodeType){case 0:if(this.output.b+=Y.string(t+"<"),e.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":de.toString(e.nodeType)));this.output.b+=Y.string(e.nodeName);let l=e.attributes();for(;l.hasNext();){let o=l.next();this.output.b+=Y.string(" "+o+'="');let u=He.htmlEscape(e.get(o),!0);this.output.b+=Y.string(u),this.output.b+='"'}if(this.hasChildren(e)){if(this.output.b+=">",this.pretty&&(this.output.b+=`
5
+ `),e.nodeType!=V.Document&&e.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element or Document but found "+(e.nodeType==null?"null":de.toString(e.nodeType)));let o=0,u=e.children;for(;o<u.length;){let p=u[o++];this.writeNode(p,this.pretty?t+" ":t)}if(this.output.b+=Y.string(t+"</"),e.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":de.toString(e.nodeType)));this.output.b+=Y.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==V.Document||e.nodeType==V.Element)throw T.thrown("Bad node type, unexpected "+(e.nodeType==null?"null":de.toString(e.nodeType)));let i=e.nodeValue;if(i.length!=0){let o=t+He.htmlEscape(i);this.output.b+=Y.string(o),this.pretty&&(this.output.b+=`
8
- `)}break;case 2:if(this.output.b+=Y.string(t+"<![CDATA["),e.nodeType==V.Document||e.nodeType==V.Element)throw T.thrown("Bad node type, unexpected "+(e.nodeType==null?"null":de.toString(e.nodeType)));this.output.b+=Y.string(e.nodeValue),this.output.b+="]]>",this.pretty&&(this.output.b+=`
9
- `);break;case 3:if(e.nodeType==V.Document||e.nodeType==V.Element)throw T.thrown("Bad node type, unexpected "+(e.nodeType==null?"null":de.toString(e.nodeType)));let n=e.nodeValue,s=new RegExp(`[
7
+ `);break;case 1:if(e.nodeType==V.Document||e.nodeType==V.Element)throw C.thrown("Bad node type, unexpected "+(e.nodeType==null?"null":de.toString(e.nodeType)));let i=e.nodeValue;if(i.length!=0){let o=t+He.htmlEscape(i);this.output.b+=Y.string(o),this.pretty&&(this.output.b+=`
8
+ `)}break;case 2:if(this.output.b+=Y.string(t+"<![CDATA["),e.nodeType==V.Document||e.nodeType==V.Element)throw C.thrown("Bad node type, unexpected "+(e.nodeType==null?"null":de.toString(e.nodeType)));this.output.b+=Y.string(e.nodeValue),this.output.b+="]]>",this.pretty&&(this.output.b+=`
9
+ `);break;case 3:if(e.nodeType==V.Document||e.nodeType==V.Element)throw C.thrown("Bad node type, unexpected "+(e.nodeType==null?"null":de.toString(e.nodeType)));let n=e.nodeValue,s=new RegExp(`[
10
10
  \r ]+`,"g".split("u").join(""));n=n.replace(s,""),n="<!--"+n+"-->",this.output.b+=t==null?"null":""+t;let r=He.trim(n);this.output.b+=Y.string(r),this.pretty&&(this.output.b+=`
11
- `);break;case 4:if(e.nodeType==V.Document||e.nodeType==V.Element)throw T.thrown("Bad node type, unexpected "+(e.nodeType==null?"null":de.toString(e.nodeType)));this.output.b+=Y.string("<!DOCTYPE "+e.nodeValue+">"),this.pretty&&(this.output.b+=`
12
- `);break;case 5:if(e.nodeType==V.Document||e.nodeType==V.Element)throw T.thrown("Bad node type, unexpected "+(e.nodeType==null?"null":de.toString(e.nodeType)));this.output.b+=Y.string("<?"+e.nodeValue+"?>"),this.pretty&&(this.output.b+=`
13
- `);break;case 6:if(e.nodeType!=V.Document&&e.nodeType!=V.Element)throw T.thrown("Bad node type, expected Element or Document but found "+(e.nodeType==null?"null":de.toString(e.nodeType)));let a=0,h=e.children;for(;a<h.length;){let o=h[a++];this.writeNode(o,t)}break}}hasChildren(e){if(e.nodeType!=V.Document&&e.nodeType!=V.Element)throw T.thrown("Bad node type, expected Element or Document but found "+(e.nodeType==null?"null":de.toString(e.nodeType)));let t=0,l=e.children;for(;t<l.length;){let i=l[t++];switch(i.nodeType){case 0:case 1:return!0;case 2:case 3:if(i.nodeType==V.Document||i.nodeType==V.Element)throw T.thrown("Bad node type, unexpected "+(i.nodeType==null?"null":de.toString(i.nodeType)));if(He.ltrim(i.nodeValue).length!=0)return!0;break;default:}}return!1}static print(e,t){t==null&&(t=!1);let l=new hi(t);return l.writeNode(e,""),l.output.b}}Q["haxe.xml.Printer"]=hi,hi.__name__="haxe.xml.Printer",Object.assign(hi.prototype,{__class__:hi});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 l=te.__nativeClassName(e);return l!=null?te.__resolveNativeClass(l):null}}static __string_rec(e,t){if(e==null)return"null";if(t.length>=5)return"<...>";let l=typeof e;switch(l=="function"&&(e.__name__||e.__ename__)&&(l="object"),l){case"function":return"<function>";case"object":if(e.__enum__){let h=Ye[e.__enum__].__constructs__[e._hx_index],o=h._hx_name;return h.__params__?(t=t+" ",o+"("+(function(u){var p;let _=[];{let m=0,f=h.__params__;for(;m<f.length;){let g=f[m];m=m+1,_.push(te.__string_rec(e[g],t))}}return p=_,p})(this).join(",")+")"):o}if(e instanceof Array){let a="[";t+=" ";let h=0,o=e.length;for(;h<o;){let u=h++;a+=(u>0?",":"")+te.__string_rec(e[u],t)}return a+="]",a}let i;try{i=e.toString}catch{return"???"}if(i!=null&&i!=Object.toString&&typeof i=="function"){let a=e.toString();if(a!="[object Object]")return a}let n=`{
11
+ `);break;case 4:if(e.nodeType==V.Document||e.nodeType==V.Element)throw C.thrown("Bad node type, unexpected "+(e.nodeType==null?"null":de.toString(e.nodeType)));this.output.b+=Y.string("<!DOCTYPE "+e.nodeValue+">"),this.pretty&&(this.output.b+=`
12
+ `);break;case 5:if(e.nodeType==V.Document||e.nodeType==V.Element)throw C.thrown("Bad node type, unexpected "+(e.nodeType==null?"null":de.toString(e.nodeType)));this.output.b+=Y.string("<?"+e.nodeValue+"?>"),this.pretty&&(this.output.b+=`
13
+ `);break;case 6:if(e.nodeType!=V.Document&&e.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element or Document but found "+(e.nodeType==null?"null":de.toString(e.nodeType)));let a=0,h=e.children;for(;a<h.length;){let o=h[a++];this.writeNode(o,t)}break}}hasChildren(e){if(e.nodeType!=V.Document&&e.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element or Document but found "+(e.nodeType==null?"null":de.toString(e.nodeType)));let t=0,l=e.children;for(;t<l.length;){let i=l[t++];switch(i.nodeType){case 0:case 1:return!0;case 2:case 3:if(i.nodeType==V.Document||i.nodeType==V.Element)throw C.thrown("Bad node type, unexpected "+(i.nodeType==null?"null":de.toString(i.nodeType)));if(He.ltrim(i.nodeValue).length!=0)return!0;break;default:}}return!1}static print(e,t){t==null&&(t=!1);let l=new hi(t);return l.writeNode(e,""),l.output.b}}Q["haxe.xml.Printer"]=hi,hi.__name__="haxe.xml.Printer",Object.assign(hi.prototype,{__class__:hi});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 l=te.__nativeClassName(e);return l!=null?te.__resolveNativeClass(l):null}}static __string_rec(e,t){if(e==null)return"null";if(t.length>=5)return"<...>";let l=typeof e;switch(l=="function"&&(e.__name__||e.__ename__)&&(l="object"),l){case"function":return"<function>";case"object":if(e.__enum__){let h=Ye[e.__enum__].__constructs__[e._hx_index],o=h._hx_name;return h.__params__?(t=t+" ",o+"("+(function(u){var p;let _=[];{let m=0,f=h.__params__;for(;m<f.length;){let g=f[m];m=m+1,_.push(te.__string_rec(e[g],t))}}return p=_,p})(this).join(",")+")"):o}if(e instanceof Array){let a="[";t+=" ";let h=0,o=e.length;for(;h<o;){let u=h++;a+=(u>0?",":"")+te.__string_rec(e[u],t)}return a+="]",a}let i;try{i=e.toString}catch{return"???"}if(i!=null&&i!=Object.toString&&typeof i=="function"){let a=e.toString();if(a!="[object Object]")return a}let n=`{
14
14
  `;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+=`,
15
15
  `),n+=t+r+" : "+te.__string_rec(e[r],t));return t=t.substring(1),n+=`
16
- `+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 l=e.__interfaces__;if(l!=null&&(e.__super__==null||e.__super__.__interfaces__!=l)){let i=0,n=l.length;for(;i<n;){let s=i++,r=l[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 Pn:return typeof e=="boolean";case vn:return e!=null;case On:return typeof e=="number";case Sn: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==In&&e.__name__!=null||t==Nn&&e.__ename__!=null?!0:e.__enum__!=null?Ye[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 T.thrown("Cannot cast "+Y.string(e)+" to "+Y.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 on[e]}}Q["js.Boot"]=te,te.__name__="js.Boot";class oe{static isArray(e){return e instanceof Array}static arrayLength(e){return e.length}static arrayGet(e,t){let l=t|0,i=e;return l>=0&&l<i.length?i[l]:null}static arraySet(e,t,l){let i=t|0,n=e;n[i]=l}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,l){e.splice(t,0,l)}static arrayRemoveAt(e,t){e.splice(t,1)}static getIterator(e){return new Il(e)}static arrayCopy(e){let t=oe.arrayLength(e),l=oe.createArray(),i=0,n=t;for(;i<n;){let s=i++;oe.arrayPush(l,oe.arrayGet(e,s))}return l}static arraySort(e,t){let l=oe.arrayLength(e),i=1,n=l;for(;i<n;){let s=i++,r=oe.arrayGet(e,s),a=s-1;for(;a>=0&&t(oe.arrayGet(e,a),r)>0;)oe.arraySet(e,a+1,oe.arrayGet(e,a)),--a;oe.arraySet(e,a+1,r)}}static arrayReverse(e){let t=0,l=oe.arrayLength(e)-1;for(;t<l;){let i=oe.arrayGet(e,t);oe.arraySet(e,t,oe.arrayGet(e,l)),oe.arraySet(e,l,i),++t,--l}}static arrayJoin(e,t){let l=oe.arrayLength(e),i="",n=0,s=l;for(;n<s;){let r=n++;r>0&&(i+=t==null?"null":""+t),i+=Y.string(oe.arrayGet(e,r)==null?"null":Y.string(oe.arrayGet(e,r)))}return i}}Q["loreline.Arrays"]=oe,oe.__name__="loreline.Arrays";class et{static addQuotes(e){e.each(function(t,l){if(t instanceof Nt){let i=t;if(i.quotes==0){i.quotes=1;let n=0,s=i.parts.length;for(;n<s;){let r=n++,a=i.parts[r].partType;if(a._hx_index==0){let h=a.text,o=et.unquotedRawToQuotedRaw(h);i.parts[r].partType=ze.Raw(o)}}}}})}static removeQuotes(e){e.each(function(t,l){if(t instanceof Nt){let i=t;if(i.quotes==1){let n="",s=0,r=i.parts;for(;s<r.length;){let a=r[s];++s;let h=a.partType;if(h._hx_index==0){let o=h.text;n+=o}}if(et.canSafelyRemoveQuotes(n)){i.quotes=0;let a=0,h=i.parts.length;for(;a<h;){let o=a++,u=i.parts[o].partType;if(u._hx_index==0){let p=u.text,_=et.quotedRawToUnquotedRaw(p);i.parts[o].partType=ze.Raw(_)}}}}}})}static toBraceStyle(e){e.each(function(t,l){if(t instanceof $t)te.__cast(t,$t).style=1;else if(t instanceof jt)te.__cast(t,jt).style=1;else if(t instanceof Me)te.__cast(t,Me).style=1;else if(t instanceof xl)te.__cast(t,xl).style=1;else if(t instanceof St)te.__cast(t,St).style=1;else if(t instanceof hl)te.__cast(t,hl).style=1;else if(t instanceof je){let i=t,n=i.literalType;if(n._hx_index==4){let s=n.style;i.literalType=Ke.Object(1)}}})}static toPlainStyle(e){e.each(function(t,l){if(t instanceof $t)te.__cast(t,$t).style=0;else if(t instanceof jt)te.__cast(t,jt).style=0;else if(t instanceof Me)te.__cast(t,Me).style=0;else if(t instanceof xl)te.__cast(t,xl).style=0;else if(t instanceof St)te.__cast(t,St).style=0;else if(t instanceof hl)te.__cast(t,hl).style=0;else if(t instanceof je){let i=t,n=i.literalType;if(n._hx_index==4){let s=n.style;i.literalType=Ke.Object(0)}}})}static useWordOperators(e){e.each(function(t,l){if(t instanceof il){let i=t,n=i.op;switch(n._hx_index){case 37:let s=n.word;i.op=k.OpAnd(!0);break;case 38:let r=n.word;i.op=k.OpOr(!0);break;default:}}})}static useSymbolOperators(e){e.each(function(t,l){if(t instanceof il){let i=t,n=i.op;switch(n._hx_index){case 37:let s=n.word;i.op=k.OpAnd(!1);break;case 38:let r=n.word;i.op=k.OpOr(!1);break;default:}}})}static useParenConditions(e){e.each(function(t,l){t instanceof wl?te.__cast(t,wl).conditionStyle=2:t instanceof St&&(te.__cast(t,St).conditionStyle=2)})}static usePlainConditions(e){e.each(function(t,l){t instanceof wl?te.__cast(t,wl).conditionStyle=0:t instanceof St&&(te.__cast(t,St).conditionStyle=0)})}static reindentFunctions(e,t,l){e.each(function(i,n){if(i instanceof ql){let s=i;s.code!=null&&s.code.length>0&&!s.external&&(s.code=et.reindentCode(s.code,t,l))}})}static insertLocalizationKeys(e,t,l,i,n){l==null&&(l=!0),n==null&&(n=new wi);let s=e.split(`
17
- `),r=!l&&t instanceof nl?(w=te.__cast(t,nl),be(w,w.eachExcludingImported)):be(t,t.each),a=i??new Ee;r(function(p,_){if(p instanceof Be){let m=p;if(m.trailingComments!=null){let f=0,g=m.trailingComments;for(;f<g.length;){let d=g[f];++f,d.isHash&&(a.h[d.content]=!0)}}if(m.leadingComments!=null){let f=0,g=m.leadingComments;for(;f<g.length;){let d=g[f];++f,d.isHash&&(a.h[d.content]=!0)}}}});let h=[];if(r(function(p,_){let m=null;if(p instanceof ll?m=te.__cast(p,ll).content:p instanceof Kt?m=te.__cast(p,Kt).content:p instanceof St&&(m=te.__cast(p,St).text),m!=null){let g=et.getStringEndLine(m)-1;if(g>=0&&g<s.length&&et.lineHasHashComment(s[g]))return;let d,x=0;do d=et.randomId(n,7+(x*.01|0)),++x;while(Object.prototype.hasOwnProperty.call(a.h,d));a.h[d]=!0,h.push({offset:m.pos.offset+m.pos.length,text:" #"+d})}}),h.length==0)return e;h.sort(function(p,_){return _.offset-p.offset});let o=e,u=0;for(;u<h.length;){let p=h[u];++u;let _=p.offset,m=p.offset,f=null;o=(_!=null?c.substr(o,0,_):c.substr(o,0,null))+p.text+(f!=null?c.substr(o,m,f):c.substr(o,m,null))}return o}static removeLocalizationKeys(e,t){let l=[];if(t.each(function(s,r){if(s instanceof Be){let a=s,h=a.trailingComments;if(h!=null){let u=0;for(;u<h.length;){let p=h[u];if(++u,p.isHash){let _=p.pos.offset,m=p.pos.offset+p.pos.length;for(;_>0;){let f=c.cca(e,_-1),g=f??-1;if(g==32||g==9)--_;else break}l.push({start:_,end:m})}}}let o=a.leadingComments;if(o!=null){let u=0;for(;u<o.length;){let p=o[u];if(++u,p.isHash){let _=p.pos.offset,m=p.pos.offset+p.pos.length;for(;_>0;){let f=c.cca(e,_-1),g=f??-1;if(g==32||g==9)--_;else break}l.push({start:_,end:m})}}}}}),l.length==0)return e;l.sort(function(s,r){return r.start-s.start});let i=e,n=0;for(;n<l.length;){let s=l[n];++n;let r=s.start,a=s.end,h=null;i=(r!=null?c.substr(i,0,r):c.substr(i,0,null))+(h!=null?c.substr(i,a,h):c.substr(i,a,null))}return i}static lineHasHashComment(e){let t=0;for(;t<e.length;){if(c.cca(e,t)==35){if(t+1<e.length&&c.cca(e,t+1)==35){t+=2;continue}if(t>0&&c.cca(e,t-1)==92){++t;continue}let l=t+1;for(;l<e.length;){let i=c.cca(e,l);if(i>=97&&i<=122||i>=65&&i<=90||i>=48&&i<=57||i==95||i==45)++l;else break}if(l>t+1)return!0}++t}return!1}static extractTranslations(e){let t=new Ee;return e.each(function(l,i){let n=null,s=null;if(l instanceof ll?(s=l,n=te.__cast(l,ll).content):l instanceof Kt&&(s=l,n=te.__cast(l,Kt).content),n!=null&&s!=null){let r=et.findHashComment(s,n);r!=null&&(t.h[r]=n)}}),t}static extractTranslatableEntries(e){let t=[];return e.each(function(l,i){let n=null,s=null;if(l instanceof ll)n=l,s=te.__cast(l,ll).content;else if(l instanceof Kt)n=l,s=te.__cast(l,Kt).content;else if(l instanceof St){let r=l;r.text!=null&&(n=l,s=r.text)}if(s!=null&&n!=null){let r=et.findHashComment(n,s);r!=null&&t.push({id:r,str:s})}}),t}static hasUntaggedTranslatableStrings(e){let t=!1;return e.each(function(l,i){if(t)return;let n=null,s=null;if(l instanceof ll)n=l,s=te.__cast(l,ll).content;else if(l instanceof Kt)n=l,s=te.__cast(l,Kt).content;else if(l instanceof St){let r=l;r.text!=null&&(n=l,s=r.text)}s!=null&&n!=null&&et.findHashComment(n,s)==null&&(t=!0)}),t}static collectHashIds(e,t){if(t==null&&(t=new Ee),e==null)return t;let i=new kt(e).tokenize(),n=0;for(;n<i.length;){let s=i[n];++n;let r=s.type;if(r._hx_index==53){let a=r.content;t.h[a]=!0}}return t}static generateTranslationFile(e,t,l){let i=et.extractTranslatableEntries(e),n="",s=!0;n+=`
16
+ `+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 l=e.__interfaces__;if(l!=null&&(e.__super__==null||e.__super__.__interfaces__!=l)){let i=0,n=l.length;for(;i<n;){let s=i++,r=l[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 Pn:return typeof e=="boolean";case vn:return e!=null;case On:return typeof e=="number";case Sn: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==In&&e.__name__!=null||t==Nn&&e.__ename__!=null?!0:e.__enum__!=null?Ye[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 C.thrown("Cannot cast "+Y.string(e)+" to "+Y.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 on[e]}}Q["js.Boot"]=te,te.__name__="js.Boot";class he{static isArray(e){return e instanceof Array}static arrayLength(e){return e.length}static arrayGet(e,t){let l=t|0,i=e;return l>=0&&l<i.length?i[l]:null}static arraySet(e,t,l){let i=t|0,n=e;n[i]=l}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,l){e.splice(t,0,l)}static arrayRemoveAt(e,t){e.splice(t,1)}static getIterator(e){return new Il(e)}static arrayCopy(e){let t=he.arrayLength(e),l=he.createArray(),i=0,n=t;for(;i<n;){let s=i++;he.arrayPush(l,he.arrayGet(e,s))}return l}static arraySort(e,t){let l=he.arrayLength(e),i=1,n=l;for(;i<n;){let s=i++,r=he.arrayGet(e,s),a=s-1;for(;a>=0&&t(he.arrayGet(e,a),r)>0;)he.arraySet(e,a+1,he.arrayGet(e,a)),--a;he.arraySet(e,a+1,r)}}static arrayReverse(e){let t=0,l=he.arrayLength(e)-1;for(;t<l;){let i=he.arrayGet(e,t);he.arraySet(e,t,he.arrayGet(e,l)),he.arraySet(e,l,i),++t,--l}}static arrayJoin(e,t){let l=he.arrayLength(e),i="",n=0,s=l;for(;n<s;){let r=n++;r>0&&(i+=t==null?"null":""+t),i+=Y.string(he.arrayGet(e,r)==null?"null":Y.string(he.arrayGet(e,r)))}return i}}Q["loreline.Arrays"]=he,he.__name__="loreline.Arrays";class et{static addQuotes(e){e.each(function(t,l){if(t instanceof Mt){let i=t;if(i.quotes==0){i.quotes=1;let n=0,s=i.parts.length;for(;n<s;){let r=n++,a=i.parts[r].partType;if(a._hx_index==0){let h=a.text,o=et.unquotedRawToQuotedRaw(h);i.parts[r].partType=ze.Raw(o)}}}}})}static removeQuotes(e){e.each(function(t,l){if(t instanceof Mt){let i=t;if(i.quotes==1){let n="",s=0,r=i.parts;for(;s<r.length;){let a=r[s];++s;let h=a.partType;if(h._hx_index==0){let o=h.text;n+=o}}if(et.canSafelyRemoveQuotes(n)){i.quotes=0;let a=0,h=i.parts.length;for(;a<h;){let o=a++,u=i.parts[o].partType;if(u._hx_index==0){let p=u.text,_=et.quotedRawToUnquotedRaw(p);i.parts[o].partType=ze.Raw(_)}}}}}})}static toBraceStyle(e){e.each(function(t,l){if(t instanceof $t)te.__cast(t,$t).style=1;else if(t instanceof jt)te.__cast(t,jt).style=1;else if(t instanceof Me)te.__cast(t,Me).style=1;else if(t instanceof xl)te.__cast(t,xl).style=1;else if(t instanceof St)te.__cast(t,St).style=1;else if(t instanceof hl)te.__cast(t,hl).style=1;else if(t instanceof je){let i=t,n=i.literalType;if(n._hx_index==4){let s=n.style;i.literalType=Ke.Object(1)}}})}static toPlainStyle(e){e.each(function(t,l){if(t instanceof $t)te.__cast(t,$t).style=0;else if(t instanceof jt)te.__cast(t,jt).style=0;else if(t instanceof Me)te.__cast(t,Me).style=0;else if(t instanceof xl)te.__cast(t,xl).style=0;else if(t instanceof St)te.__cast(t,St).style=0;else if(t instanceof hl)te.__cast(t,hl).style=0;else if(t instanceof je){let i=t,n=i.literalType;if(n._hx_index==4){let s=n.style;i.literalType=Ke.Object(0)}}})}static useWordOperators(e){e.each(function(t,l){if(t instanceof il){let i=t,n=i.op;switch(n._hx_index){case 37:let s=n.word;i.op=k.OpAnd(!0);break;case 38:let r=n.word;i.op=k.OpOr(!0);break;default:}}})}static useSymbolOperators(e){e.each(function(t,l){if(t instanceof il){let i=t,n=i.op;switch(n._hx_index){case 37:let s=n.word;i.op=k.OpAnd(!1);break;case 38:let r=n.word;i.op=k.OpOr(!1);break;default:}}})}static useParenConditions(e){e.each(function(t,l){t instanceof wl?te.__cast(t,wl).conditionStyle=2:t instanceof St&&(te.__cast(t,St).conditionStyle=2)})}static usePlainConditions(e){e.each(function(t,l){t instanceof wl?te.__cast(t,wl).conditionStyle=0:t instanceof St&&(te.__cast(t,St).conditionStyle=0)})}static reindentFunctions(e,t,l){e.each(function(i,n){if(i instanceof ql){let s=i;s.code!=null&&s.code.length>0&&!s.external&&(s.code=et.reindentCode(s.code,t,l))}})}static insertLocalizationKeys(e,t,l,i,n){l==null&&(l=!0),n==null&&(n=new wi);let s=e.split(`
17
+ `),r=!l&&t instanceof nl?(x=te.__cast(t,nl),be(x,x.eachExcludingImported)):be(t,t.each),a=i??new Ee;r(function(p,_){if(p instanceof Be){let m=p;if(m.trailingComments!=null){let f=0,g=m.trailingComments;for(;f<g.length;){let d=g[f];++f,d.isHash&&(a.h[d.content]=!0)}}if(m.leadingComments!=null){let f=0,g=m.leadingComments;for(;f<g.length;){let d=g[f];++f,d.isHash&&(a.h[d.content]=!0)}}}});let h=[];if(r(function(p,_){let m=null;if(p instanceof ll?m=te.__cast(p,ll).content:p instanceof Kt?m=te.__cast(p,Kt).content:p instanceof St&&(m=te.__cast(p,St).text),m!=null){let g=et.getStringEndLine(m)-1;if(g>=0&&g<s.length&&et.lineHasHashComment(s[g]))return;let d,w=0;do d=et.randomId(n,7+(w*.01|0)),++w;while(Object.prototype.hasOwnProperty.call(a.h,d));a.h[d]=!0,h.push({offset:m.pos.offset+m.pos.length,text:" #"+d})}}),h.length==0)return e;h.sort(function(p,_){return _.offset-p.offset});let o=e,u=0;for(;u<h.length;){let p=h[u];++u;let _=p.offset,m=p.offset,f=null;o=(_!=null?c.substr(o,0,_):c.substr(o,0,null))+p.text+(f!=null?c.substr(o,m,f):c.substr(o,m,null))}return o}static removeLocalizationKeys(e,t){let l=[];if(t.each(function(s,r){if(s instanceof Be){let a=s,h=a.trailingComments;if(h!=null){let u=0;for(;u<h.length;){let p=h[u];if(++u,p.isHash){let _=p.pos.offset,m=p.pos.offset+p.pos.length;for(;_>0;){let f=c.cca(e,_-1),g=f??-1;if(g==32||g==9)--_;else break}l.push({start:_,end:m})}}}let o=a.leadingComments;if(o!=null){let u=0;for(;u<o.length;){let p=o[u];if(++u,p.isHash){let _=p.pos.offset,m=p.pos.offset+p.pos.length;for(;_>0;){let f=c.cca(e,_-1),g=f??-1;if(g==32||g==9)--_;else break}l.push({start:_,end:m})}}}}}),l.length==0)return e;l.sort(function(s,r){return r.start-s.start});let i=e,n=0;for(;n<l.length;){let s=l[n];++n;let r=s.start,a=s.end,h=null;i=(r!=null?c.substr(i,0,r):c.substr(i,0,null))+(h!=null?c.substr(i,a,h):c.substr(i,a,null))}return i}static lineHasHashComment(e){let t=0;for(;t<e.length;){if(c.cca(e,t)==35){if(t+1<e.length&&c.cca(e,t+1)==35){t+=2;continue}if(t>0&&c.cca(e,t-1)==92){++t;continue}let l=t+1;for(;l<e.length;){let i=c.cca(e,l);if(i>=97&&i<=122||i>=65&&i<=90||i>=48&&i<=57||i==95||i==45)++l;else break}if(l>t+1)return!0}++t}return!1}static extractTranslations(e){let t=new Ee;return e.each(function(l,i){let n=null,s=null;if(l instanceof ll?(s=l,n=te.__cast(l,ll).content):l instanceof Kt&&(s=l,n=te.__cast(l,Kt).content),n!=null&&s!=null){let r=et.findHashComment(s,n);r!=null&&(t.h[r]=n)}}),t}static extractTranslatableEntries(e){let t=[];return e.each(function(l,i){let n=null,s=null;if(l instanceof ll)n=l,s=te.__cast(l,ll).content;else if(l instanceof Kt)n=l,s=te.__cast(l,Kt).content;else if(l instanceof St){let r=l;r.text!=null&&(n=l,s=r.text)}if(s!=null&&n!=null){let r=et.findHashComment(n,s);r!=null&&t.push({id:r,str:s})}}),t}static hasUntaggedTranslatableStrings(e){let t=!1;return e.each(function(l,i){if(t)return;let n=null,s=null;if(l instanceof ll)n=l,s=te.__cast(l,ll).content;else if(l instanceof Kt)n=l,s=te.__cast(l,Kt).content;else if(l instanceof St){let r=l;r.text!=null&&(n=l,s=r.text)}s!=null&&n!=null&&et.findHashComment(n,s)==null&&(t=!0)}),t}static collectHashIds(e,t){if(t==null&&(t=new Ee),e==null)return t;let i=new kt(e).tokenize(),n=0;for(;n<i.length;){let s=i[n];++n;let r=s.type;if(r._hx_index==53){let a=r.content;t.h[a]=!0}}return t}static generateTranslationFile(e,t,l){let i=et.extractTranslatableEntries(e),n="",s=!0;n+=`
18
18
  `;let r=0;for(;r<i.length;){let a=i[r];++r,s||(n+=`
19
19
  `),s=!1;let h=l.printStringLiteralAsReference(a.str),o=l.printStringLiteralAsText(a.str);n+="#",n+=Y.string(a.id),n+=" // ",n+=h==null?"null":""+h,n+=`
20
20
  `,t!=null&&Object.prototype.hasOwnProperty.call(t.h,a.id)?n+=Y.string(l.printStringLiteralAsText(t.h[a.id])):n+=o==null?"null":""+o,n+=`
@@ -24,31 +24,31 @@
24
24
  `);let h=i[a],o=0,u=0;for(;c.substr(h,u,null).startsWith(t);)++o,u+=t.length;let p=0,_=o;for(;p<_;){let m=p++;n+=l==null?"null":""+l}n+=Y.string(c.substr(h,u,null))}return n}static getStringEndLine(e){let t=e.pos.line,l=0,i=e.parts;for(;l<i.length;){let n=i[l];if(++l,n.pos!=null){let s=n.pos.line,r=n.partType;if(r._hx_index==0){let a=r.text,h=0;for(;h<a.length;)c.cca(a,h)==10&&++s,++h}s>t&&(t=s)}}return t}static findHashComment(e,t){if(e.trailingComments!=null){let l=0,i=e.trailingComments;for(;l<i.length;){let n=i[l];if(++l,n.isHash)return n.content}}if(e.leadingComments!=null){let l=0,i=e.leadingComments;for(;l<i.length;){let n=i[l];if(++l,n.isHash)return n.content}}if(t!=null){if(t.trailingComments!=null){let l=0,i=t.trailingComments;for(;l<i.length;){let n=i[l];if(++l,n.isHash)return n.content}}if(t.leadingComments!=null){let l=0,i=t.leadingComments;for(;l<i.length;){let n=i[l];if(++l,n.isHash)return n.content}}}return null}static randomId(e,t){let l="",i=0,n=t;for(;i<n;){let o=i++,u=c.cca(et.randomId_chars,Math.floor(36*((e.seed=e.seed*16807%2147483647)/2147483647+233e-12)));l+=String.fromCodePoint(u)}let s=l,r=!0,a=0,h=s.length;for(;a<h;){let o=a++,u=c.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=c.cca(et.randomId_nonHexChars,Math.floor(et.randomId_nonHexChars.length*((e.seed=e.seed*16807%2147483647)/2147483647+233e-12)));s=c.substr(s,0,o)+String.fromCodePoint(u)+c.substr(s,o+1,null)}return s}}Q["loreline.AstUtils"]=Xl.loreline.AstUtils=et,et.__name__="loreline.AstUtils";class oi{constructor(e){this.func=e}}Q["loreline.Async"]=Xl.loreline.Async=oi,oi.__name__="loreline.Async",Object.assign(oi.prototype,{__class__:oi});class gi{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 ti{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=He.rtrim(e)+`
25
25
  //<END>`,this.input=e,this.index=0,this.output=new gt,this.lineOutput=new gt,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(),He.rtrim(this.output.b)+`
26
26
  `}toLorelinePos(e,t,l){let i=this.inputPosFromProcessedPos(t),s=this.inputPosFromProcessedPos(l)+1-i;return e.withOffset(this.input,i,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,l=0,i=this.posOffsets.length;for(;l<i;){let n=l++;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,l=0,i=0;for(;this.index<this.length;){let n=c.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=c.cca(this.input,this.index+1),a=r??-1;a==47||a==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)++l,this._add(s,!0);else if(s==93){if(--l,s==e&&l<0)return;this._add(s,!0)}else if(s==40)++i,this._add(s,!0);else if(s==41){if(--i,s==e&&i<0)return;this._add(s,!0)}else{let r;if(this.isAlphaNumeric(s)&&this.index>0){let a=c.cca(this.input,this.index-1);r=!this.isAlphaNumeric(a??-1)}else r=!1;if(r)if(s==97){let a,h,o=c.cca(this.input,this.index+1);if((o??-1)==110){let u=c.cca(this.input,this.index+2);h=(u??-1)==100}else h=!1;if(h){let u=c.cca(this.input,this.index+3);a=!this.isAlphaNumeric(u??-1)}else a=!1;a?(this._add(38,!0),this._add(38,!0),this._add(32,!0)):this._add(s,!0)}else if(s==111){let a,h=c.cca(this.input,this.index+1);if((h??-1)==114){let o=c.cca(this.input,this.index+2);a=!this.isAlphaNumeric(o??-1)}else a=!1;a?(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=c.cca(this.input,this.index),l=t??-1;if(e)this._add(l,!0),e=!1;else if(l==92)e=!0,this._add(92,!0);else if(l==34){this._add(l,!0),this.inString=!1;return}else if(l==36&&!e){this.index++;let i=c.cca(this.input,this.index);l=i??-1,l==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++):l>=97&&l<=122||l>=65&&l<=90||l==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++):l==36?this._add(36,!0):this.error("Expected identifier or { after $")}else this._add(l,!0)}this.error("Unterminated string")}processComplexInterpolation(){this.processInput(125)}processFieldAccessInterpolation(){let e=c.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 l=c.cca(this.input,this.index);switch(l??-1){case 40:this._add(40,!0),this.processInput(41),this._add(41,!0);break;case 46:let i;if(this.index+1<this.length){let n=c.cca(this.input,this.index+1),s=n??-1;i=s>=97&&s<=122||s>=65&&s<=90||s==95}else i=!1;if(i)this._add(46,!0),this.processIdentifier();else break e;break;case 91:this._add(91,!0),this.processInput(93);break;default:break e}}}processIdentifier(){for(;this.index<this.length;){let e=c.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=c.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 l=c.cca(this.input,this.index),i=l??-1;if(i==13||i==10)break;this._add(32,!0)}else if(t==42)for(this._add(32,!0),this._add(32,!0);this.index<this.length;){let l=c.cca(this.input,this.index),i=l??-1,n;if(i==42&&this.index+1<this.length){let s=c.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 i==13||i==10?this._add(i,!0):this._add(32,!0)}this.inComment=!1}endsWithChar(e,t){if(e.length==0)return!1;let l=He.rtrim(e),i=l.length,n;if(i>0){let s=c.cca(l,i-1);n=(s??-1)==t}else n=!1;return n}followsWithChar(e,t){let l=t,i=!1;for(;l<this.length;){let n=c.cca(this.input,l),s=n??-1;if(s==32||s==9||s==10||s==13){++l;continue}if(s==47&&l+1<this.length){let r=c.cca(this.input,l+1),a=r??-1;if(a==47){for(l+=2;;){let h,o;if(l<this.length){let u=c.cca(this.input,l);o=(u??-1)!=13}else o=!1;if(o){let u=c.cca(this.input,l);h=(u??-1)!=10}else h=!1;if(!h)break;++l}l<this.length&&++l;continue}if(a==42){for(l+=2;l+1<this.length;){let h,o=c.cca(this.input,l);if((o??-1)==42){let u=c.cca(this.input,l+1);h=(u??-1)==47}else h=!1;if(h){l+=2;break}++l}continue}}i=s==e;break}return i}endsOrFollowsWithChar(e,t,l,i){return this.endsWithChar(e,t)?!0:this.followsWithChar(t,l)}nextLineIndentOffset(e,t){let l=He.ltrim(e);if(l.length==0)return 0;let i=e.length-l.length,n=-1;for(;t<this.length;){let s=this.input.indexOf(`
27
- `,t);s==-1&&(s=this.length);let r=this.input,a=s!=null?r.substring(t,s):r.substring(t),h=He.ltrim(a);if(h.length>0&&(!h.startsWith("//")||h.startsWith("//<END>"))&&!h.startsWith("/*")){let o=a.length-h.length;return h.startsWith("//<END>")&&i==0&&n>0?n-i:o-i}h.length>0&&n==-1&&(n=a.length-h.length),t=s+1}return i==0&&n>0?n-i:0}followsWithIf(e){let t=e;for(;t<this.length;){let l=c.cca(this.input,t),i=l??-1;if(i==32||i==9||i==10||i==13){++t;continue}if(i==47&&t+1<this.length){let r=c.cca(this.input,t+1),a=r??-1;if(a==47){for(t+=2;;){let h,o;if(t<this.length){let u=c.cca(this.input,t);o=(u??-1)!=13}else o=!1;if(o){let u=c.cca(this.input,t);h=(u??-1)!=10}else h=!1;if(!h)break;++t}continue}if(a==42){for(t+=2;t+1<this.length;){let h,o=c.cca(this.input,t);if((o??-1)==42){let u=c.cca(this.input,t+1);h=(u??-1)==47}else h=!1;if(h){t+=2;break}++t}continue}}let n,s;if(t+1<this.length){let r=c.cca(this.input,t);s=(r??-1)==105}else s=!1;if(s){let r=c.cca(this.input,t+1);n=(r??-1)==102}else n=!1;if(n){let r;if(t+2<this.length){let a=c.cca(this.input,t+2);r=!this.isAlphaNumeric(a??-1)}else r=!0;if(r)return!0}return!1}return!1}endsWithControlKeyword(e,t){let l=He.rtrim(e);if(l.length==0)return!1;let i=0,n=ti.CONTROL_KEYWORDS;for(;i<n.length;){let s=n[i];if(++i,l.endsWith(s)){let r=e.length-l.length,a=l.length-s.length,h;if(a!=0){let p=c.cca(l,a-1);h=!this.isAlphaNumeric(p??-1)}else h=!0;let o=t,u;if(o<this.length)if(r<=0){let p=c.cca(this.input,o);u=!this.isAlphaNumeric(p??-1)}else u=!0;else u=!1;if(h&&u&&(s!="else"||!this.followsWithIf(t)))return!0}}return!1}endsWithArrayIndexable(e){let t=e.length;if(t==0)return!1;let l=t-1;for(;l>=0;){let s=c.cca(e,l),r=s??-1;if(!this.isWhitespace(r))break;--l}if(l<0)return!1;let i=c.cca(e,l),n=i??-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=c.cca(this.input,e),l=t??-1;if(!(l>=97&&l<=122||l>=65&&l<=90||l==95))return!1;let i=e;for(++e;;){let h;if(e<this.length){let o=c.cca(this.input,e),u=o??-1;h=u>=97&&u<=122||u>=65&&u<=90||u==95||u>=48&&u<=57}else h=!1;if(!h)break;++e}for(;;){let h;if(e<this.length){let o=c.cca(this.input,e);h=this.isWhitespace(o??-1)}else h=!1;if(!h)break;++e}let n;if(e<this.length){let h=c.cca(this.input,e);n=(h??-1)!=58}else n=!0;if(n)return!1;let s=this.input,r=e-i;return(r!=null?c.substr(s,i,r):c.substr(s,i,null))!="case"}skipWhitespaceAndComments(e){let t=e,l=!1;for(;e<this.length;){for(;;){let i;if(e<this.length){let n,s,r=c.cca(this.input,e);if((r??-1)!=32){let a=c.cca(this.input,e);s=(a??-1)==9}else s=!0;if(s)n=!0;else{let a=c.cca(this.input,e);n=(a??-1)==10}if(n)i=!0;else{let a=c.cca(this.input,e);i=(a??-1)==13}}else i=!1;if(!i)break;++e,l=!0}if(e<this.length-1){let i=c.cca(this.input,e);if((i??-1)==47){let n=c.cca(this.input,e+1);if((n??-1)==47)return e=t,e;{let s=c.cca(this.input,e+1);if((s??-1)==42){e+=2,l=!0;let r=!1;for(;e<this.length-1;){let a,h=c.cca(this.input,e);if((h??-1)==42){let o=c.cca(this.input,e+1);a=(o??-1)==47}else a=!1;if(a){e+=2,r=!0;break}++e}if(!r)return e=t,e;continue}}}}break}return l?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 l=this.lineOutput.b;if(this.lineOutput=new gt,this.inStatementsBlock()||this.inObjectBlock()||this.inArrayBlock()){let i=this.nextLineIndentOffset(l,this.index);if(He.trim(l).length!=0)if(i>0&&!this.endsOrFollowsWithChar(l,123,this.index,{fileName:"src/loreline/CodeToLorscript.hx",lineNumber:1061,className:"loreline.CodeToLorscript",methodName:"_add"})&&!this.endsOrFollowsWithChar(l,91,this.index,{fileName:"src/loreline/CodeToLorscript.hx",lineNumber:1061,className:"loreline.CodeToLorscript",methodName:"_add"})){let n=He.ltrim(l);n.startsWith("case ")||n.startsWith("case ")||n=="default"||n.startsWith("default ")||n.startsWith("default ")?(this.stack.push(4),this.indentLevel+=i,this.indentStack.push(this.indentLevel),this.currentPosOffset++,this.output.b+=String.fromCodePoint(58),this.posOffsets.push(this.currentPosOffset)):(this.stack.push(3),this.indentLevel+=i,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(i<0&&this.stack.length>0&&(this.stack[this.stack.length-1]==3||this.stack[this.stack.length-1]==4)){!this.inObjectBlock()&&!this.endsOrFollowsWithChar(l,59,this.index,{fileName:"src/loreline/CodeToLorscript.hx",lineNumber:1090,className:"loreline.CodeToLorscript",methodName:"_add"})&&(this.currentPosOffset++,this.output.b+=String.fromCodePoint(59),this.posOffsets.push(this.currentPosOffset)),this.indentLevel+=i;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 i==0&&!this.endsOrFollowsWithChar(l,59,this.index,{fileName:"src/loreline/CodeToLorscript.hx",lineNumber:1115,className:"loreline.CodeToLorscript",methodName:"_add"})&&!this.endsOrFollowsWithChar(l,44,this.index,{fileName:"src/loreline/CodeToLorscript.hx",lineNumber:1115,className:"loreline.CodeToLorscript",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 l=this.stack.pop();l!=5&&l!=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 l=this.stack.pop();l!=2&&l!=0&&this.error("Unexpected: }")}this.lineOutput.b+=String.fromCodePoint(e),this.output.b+=String.fromCodePoint(e),this.posOffsets.push(this.currentPosOffset)}}error(e){throw T.thrown(new st(e,ue.fromContentAndIndex(this.input,this.index)))}}Q["loreline.CodeToLorscript"]=ti,ti.__name__="loreline.CodeToLorscript",Object.assign(ti.prototype,{__class__:ti});class Nl{static equal(e,t,l){return t==l?!0:oe.isArray(t)?oe.isArray(l)?Nl.arrayEqual(e,t,l):!1:t instanceof Ee?l instanceof Ee?Nl.stringMapEqual(e,t,l):!1:t instanceof Kl?l instanceof Kl?Nl.intMapEqual(e,t,l):!1:he.isFields(t)&&he.isFields(l)?Nl.objectFieldsEqual(e,t,l):!1}static objectFieldsEqual(e,t,l){let i=0,n=he.getFields(e,t);for(;i<n.length;){let a=n[i];if(++i,!he.fieldExists(e,l,a)||!Nl.equal(e,he.getField(e,t,a),he.getField(e,l,a)))return!1}let s=0,r=he.getFields(e,l);for(;s<r.length;){let a=r[s];if(++s,!he.fieldExists(e,t,a))return!1}return!0}static arrayEqual(e,t,l){let i=oe.arrayLength(t),n=oe.arrayLength(l);if(i!=n)return!1;let s=0,r=i;for(;s<r;){let a=s++;if(!Nl.equal(e,oe.arrayGet(t,a),oe.arrayGet(l,a)))return!1}return!0}static stringMapEqual(e,t,l){let i=t.h,n=i,s=Object.keys(i),r=s.length,a=0;for(;a<r;){let m=s[a++],f=m,g=n[m],d=f,x=g;if(!Object.prototype.hasOwnProperty.call(l.h,d)||!Nl.equal(e,l.h[d],x))return!1}let h=l.h,o=h,u=Object.keys(h),p=u.length,_=0;for(;_<p;){let m=u[_++];if(!Object.prototype.hasOwnProperty.call(t.h,m))return!1}return!0}static intMapEqual(e,t,l){let i=t,n=i,s=i.keys();for(;s.hasNext();){let a=s.next(),h=n.get(a),u=a,p=h;if(!l.h.hasOwnProperty(u)||!Nl.equal(e,l.h[u],p))return!1}let r=l.keys();for(;r.hasNext();){let a=r.next();if(!t.h.hasOwnProperty(a))return!1}return!0}}Q["loreline.Equal"]=Nl,Nl.__name__="loreline.Equal";class st{constructor(e,t){this.message=e,this.pos=t,this.stack=Tn.callStack()}toString(){return this.pos!=null?""+this.message+" at "+this.pos.toString():this.message}}Q["loreline.Error"]=st,st.__name__="loreline.Error",Object.assign(st.prototype,{__class__:st});class Ml{}Q["loreline.Fields"]=Xl.loreline.Fields=Ml,Ml.__name__="loreline.Fields",Ml.__isInterface__=!0,Object.assign(Ml.prototype,{__class__:Ml});class qi{constructor(e){this._random=null,this.interpreter=e}bindAll(e){e.h.floor=be(this,this.floor),e.h.ceil=be(this,this.ceil),e.h.round=be(this,this.round),e.h.abs=be(this,this.abs),e.h.min=be(this,this.min),e.h.max=be(this,this.max),e.h.clamp=be(this,this.clamp),e.h.pow=be(this,this.pow),e.h.random=be(this,this.random),e.h.chance=be(this,this.chance),e.h.seed_random=be(this,this.seed_random),e.h.random_float=be(this,this.random_float),e.h.wait=be(this,this.wait),e.h.float=be(this,this.float_),e.h.string=be(this,this.string_),e.h.bool=be(this,this.bool),e.h.string_length=be(this,this.string_length),e.h.string_upper=be(this,this.string_upper),e.h.string_lower=be(this,this.string_lower),e.h.string_contains=be(this,this.string_contains),e.h.string_replace=be(this,this.string_replace),e.h.string_split=be(this,this.string_split),e.h.string_trim=be(this,this.string_trim),e.h.string_index=be(this,this.string_index),e.h.string_sub=be(this,this.string_sub),e.h.string_starts=be(this,this.string_starts),e.h.string_ends=be(this,this.string_ends),e.h.string_repeat=be(this,this.string_repeat),e.h.plural=be(this,this.plural),e.h.array_length=be(this,this.array_length),e.h.array_add=be(this,this.array_add),e.h.array_pop=be(this,this.array_pop),e.h.array_prepend=be(this,this.array_prepend),e.h.array_shift=be(this,this.array_shift),e.h.array_remove=be(this,this.array_remove),e.h.array_index=be(this,this.array_index),e.h.array_has=be(this,this.array_has),e.h.array_sort=be(this,this.array_sort),e.h.array_reverse=be(this,this.array_reverse),e.h.array_join=be(this,this.array_join),e.h.array_pick=be(this,this.array_pick),e.h.array_shuffle=be(this,this.array_shuffle),e.h.array_copy=be(this,this.array_copy),e.h.map_length=be(this,this.map_length),e.h.map_keys=be(this,this.map_keys),e.h.map_has=be(this,this.map_has),e.h.map_get=be(this,this.map_get),e.h.map_set=be(this,this.map_set),e.h.map_remove=be(this,this.map_remove),e.h.map_copy=be(this,this.map_copy),e.h.current_beat=be(this,this.current_beat),e.h.has_beat=be(this,this.has_beat),e.h.beat_visits=be(this,this.beat_visits),e.h.choices=be(this,this.choices),e.h.choices_disabled=be(this,this.choices_disabled),e.h.choices_all=be(this,this.choices_all)}rng(){this._random==null&&(this._random=new wi);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,l){return Math.max(t,Math.min(l,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 wi(e),null}random_float(e,t){return e+this.rng()*(t-e)}wait(e){return new oi(function(t){fi.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":Y.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,l){return He.replace(e,t,l)}string_split(e,t){return e.split(t)}string_trim(e){return He.trim(e)}string_index(e,t){return e.indexOf(t)}string_sub(e,t,l){return c.substr(e,t|0,l|0)}string_starts(e,t){return e.startsWith(t)}string_ends(e,t){return e.endsWith(t)}string_repeat(e,t){let l="",i=0;for(;i<t;)l+=e==null?"null":""+e,++i;return l}plural(e,t,l){let i=0;return typeof e=="number"&&(e|0)===e?i=e*1:typeof e=="number"&&(i=e),i==1?t:l}array_length(e){return oe.isArray(e)?oe.arrayLength(e):0}array_add(e,t){return oe.arrayPush(e,t),null}array_pop(e){return oe.isArray(e)?oe.arrayPop(e):null}array_prepend(e,t){return oe.isArray(e)&&oe.arrayInsert(e,0,t),null}array_shift(e){return oe.isArray(e)?oe.arrayShift(e):null}array_remove(e,t){if(oe.isArray(e)){let l=oe.arrayLength(e),i=0,n=l;for(;i<n;){let s=i++;if(oe.arrayGet(e,s)==t)return oe.arrayRemoveAt(e,s),!0}}return!1}array_index(e,t){if(oe.isArray(e)){let l=oe.arrayLength(e),i=0,n=l;for(;i<n;){let s=i++;if(oe.arrayGet(e,s)==t)return s}}return-1}array_has(e,t){if(oe.isArray(e)){let l=oe.arrayLength(e),i=0,n=l;for(;i<n;){let s=i++;if(oe.arrayGet(e,s)==t)return!0}}return!1}array_sort(e){return oe.isArray(e)&&oe.arraySort(e,function(t,l){return typeof t=="number"&&typeof l=="number"||typeof t=="number"&&(t|0)===t&&typeof l=="number"&&(l|0)===l?t<l?-1:t>l?1:0:(t==null?"null":Y.string(t))<(l==null?"null":Y.string(l))?-1:(t==null?"null":Y.string(t))>(l==null?"null":Y.string(l))?1:0}),e}array_reverse(e){return oe.isArray(e)&&oe.arrayReverse(e),e}array_join(e,t){return oe.isArray(e)?oe.arrayJoin(e,t):""}array_pick(e){if(oe.isArray(e)){let t=oe.arrayLength(e);if(t==0)return null;let l=Math.floor(this.rng()*t);return oe.arrayGet(e,l)}return null}array_shuffle(e){if(oe.isArray(e)){let t=oe.arrayLength(e)-1;for(;t>0;){let l=Math.floor(this.rng()*(t+1)),i=oe.arrayGet(e,t);oe.arraySet(e,t,oe.arrayGet(e,l)),oe.arraySet(e,l,i),--t}}return e}array_copy(e){return oe.isArray(e)?oe.arrayCopy(e):e}map_length(e){return he.getFields(this.interpreter,e).length}map_keys(e){let t=he.getFields(this.interpreter,e);return t.sort(function(l,i){return l<i?-1:l>i?1:0}),t}map_has(e,t){return he.fieldExists(this.interpreter,e,t)}map_get(e,t){return he.getField(this.interpreter,e,t)}map_set(e,t,l){return he.setField(this.interpreter,e,t,l),null}map_remove(e,t){return he.fieldExists(this.interpreter,e,t)?he.removeField(this.interpreter,e,t):!1}map_copy(e){let t=he.getFields(this.interpreter,e),l=he.createFields(this.interpreter),i=0;for(;i<t.length;){let n=t[i];++i,he.setField(this.interpreter,l,n,he.getField(this.interpreter,e,n))}return l}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,l=this.interpreter.stack.length-1;for(;l>=0;){let i=this.interpreter.stack[l];if(i.beat!=null&&i.beat.body!=null){let n=0,s=i.beat.body;for(;n<s.length;){let r=s[n];if(++n,r instanceof Me&&r.name==t)return!0}}--l}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 l=this.interpreter.stack[t];if(l.beat!=null)return this.interpreter.getBeatVisitCount(l.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,l=[],i=0,n=e.length;for(;i<n;){let s=i++;t[s]&&l.push(e[s])}return l}choices_disabled(){let e=this.interpreter._choiceEvalTexts,t=this.interpreter._choiceEvalEnabled,l=[],i=0,n=e.length;for(;i<n;){let s=i++;t[s]||l.push(e[s])}return l}choices_all(){let e=this.interpreter._choiceEvalTexts,t=[],l=0,i=e.length;for(;l<i;){let n=l++;t.push(e[n])}return t}}Q["loreline.Functions"]=qi,qi.__name__="loreline.Functions",Object.assign(qi.prototype,{__class__:qi});class Wi{constructor(e){this.finished=e}}Q["loreline._Imports.ImportsLoopInfo"]=Wi,Wi.__name__="loreline._Imports.ImportsLoopInfo",Object.assign(Wi.prototype,{__class__:Wi});class zi{constructor(){this.ext=".lor",this.pendingImports=0,this.hasErrors=!1,this.done=null,this.resolvedImports=null,this.autoAddExtension=!0}resolve(e,t,l,i,n){this.rootPath=e,this.tokens=t,this.handleFile=l,this.handleError=i,this.done=n,this.hasErrors=!1,this.pendingImports=0;let s;if(e==null)s=!1;else{let u=e.length;if(u<8)s=!1;else{let p,_,m,f,g,d,x=c.cca(e,u-8);if((x??-1)==46){let y=c.cca(e,u-7),S=y??-1;d=S==108||S==76}else d=!1;if(d){let y=c.cca(e,u-6),S=y??-1;g=S==111||S==79}else g=!1;if(g){let y=c.cca(e,u-5),S=y??-1;f=S==114||S==82}else f=!1;if(f){let y=c.cca(e,u-4);m=(y??-1)==46}else m=!1;if(m){let y=c.cca(e,u-3),S=y??-1;_=S==116||S==84}else _=!1;if(_){let y=c.cca(e,u-2),S=y??-1;p=S==120||S==88}else p=!1;if(p){let y=c.cca(e,u-1),S=y??-1;s=S==116||S==84}else s=!1}}this.ext=s?".lor.txt":".lor";let r=new Ee,a=[],h=new Ee,o=De.directory(e);this.extractImports(o,t,a,h),this.processImports(a,h,r)}processImports(e,t,l){let i=new Wi(!1);for(;e.length>0;){let n=e.shift();this.handleItemInLoop(n,i,e,t,l)}i.finished=!0,this.pendingImports==0&&this.done!=null&&(this.resolvedImports=l,this.done(this.hasErrors,l),this.done=null)}handleItemInLoop(e,t,l,i,n){let s=this;this.handleFile(e,function(r){if(s.pendingImports--,r!=null)try{let a=new kt(r),h=a.tokenize(),o=a.getErrors();o!=null&&o.length>0&&s.handleError(o[0]),n.h[e]=h,s.extractImports(De.directory(e),h,l,i),t.finished&&s.processImports(l,i,n)}catch(a){let h=T.caught(a).unwrap();if(s.hasErrors=!0,h instanceof st)s.handleError(h);else throw T.thrown(h)}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,l,i){let n=0,s=t.length;for(;n<s-1;){if(t[n].type==k.KwImport){let r=t[n+1].type;if(r._hx_index==15){let a=r.quotes,h=r.attachments,o=r.s,u=o;De.isAbsolute(o)||(u=De.join([e,u])),u=De.normalize(u);let p,_;if(u==null)_=!1;else{let m=u.length;if(m<8)_=!1;else{let f,g,d,x,y,S,C=c.cca(u,m-8);if((C??-1)==46){let O=c.cca(u,m-7),E=O??-1;S=E==108||E==76}else S=!1;if(S){let O=c.cca(u,m-6),E=O??-1;y=E==111||E==79}else y=!1;if(y){let O=c.cca(u,m-5),E=O??-1;x=E==114||E==82}else x=!1;if(x){let O=c.cca(u,m-4);d=(O??-1)==46}else d=!1;if(d){let O=c.cca(u,m-3),E=O??-1;g=E==116||E==84}else g=!1;if(g){let O=c.cca(u,m-2),E=O??-1;f=E==120||E==88}else f=!1;if(f){let O=c.cca(u,m-1),E=O??-1;_=E==116||E==84}else _=!1}}if(_)p=!0;else if(u==null)p=!1;else{let m=u.length;if(m<4)p=!1;else{let f,g,d=c.cca(u,m-4);if((d??-1)==46){let x=c.cca(u,m-3),y=x??-1;g=y==108||y==76}else g=!1;if(g){let x=c.cca(u,m-2),y=x??-1;f=y==111||y==79}else f=!1;if(f){let x=c.cca(u,m-1),y=x??-1;p=y==114||y==82}else p=!1}}p||(u+=this.ext),Object.prototype.hasOwnProperty.call(i.h,u)||(this.pendingImports++,i.h[u]=!0,l.push(u))}}++n}}static sameLetterCi(e,t){return e!=t?e==t-32:!0}static endsWithLorTxt(e){if(e==null)return!1;let t=e.length;if(t<8)return!1;let l,i,n,s,r,a,h=c.cca(e,t-8);if((h??-1)==46){let o=c.cca(e,t-7),u=o??-1;a=u==108||u==76}else a=!1;if(a){let o=c.cca(e,t-6),u=o??-1;r=u==111||u==79}else r=!1;if(r){let o=c.cca(e,t-5),u=o??-1;s=u==114||u==82}else s=!1;if(s){let o=c.cca(e,t-4);n=(o??-1)==46}else n=!1;if(n){let o=c.cca(e,t-3),u=o??-1;i=u==116||u==84}else i=!1;if(i){let o=c.cca(e,t-2),u=o??-1;l=u==120||u==88}else l=!1;if(l){let o=c.cca(e,t-1),u=o??-1;return u!=116?u==84:!0}else return!1}static endsWithLor(e){if(e==null)return!1;let t=e.length;if(t<4)return!1;let l,i,n=c.cca(e,t-4);if((n??-1)==46){let s=c.cca(e,t-3),r=s??-1;i=r==108||r==76}else i=!1;if(i){let s=c.cca(e,t-2),r=s??-1;l=r==111||r==79}else l=!1;if(l){let s=c.cca(e,t-1),r=s??-1;return r!=114?r==82:!0}else return!1}static lorExtension(e){let t;if(e==null)t=!1;else{let l=e.length;if(l<8)t=!1;else{let i,n,s,r,a,h,o=c.cca(e,l-8);if((o??-1)==46){let u=c.cca(e,l-7),p=u??-1;h=p==108||p==76}else h=!1;if(h){let u=c.cca(e,l-6),p=u??-1;a=p==111||p==79}else a=!1;if(a){let u=c.cca(e,l-5),p=u??-1;r=p==114||p==82}else r=!1;if(r){let u=c.cca(e,l-4);s=(u??-1)==46}else s=!1;if(s){let u=c.cca(e,l-3),p=u??-1;n=p==116||p==84}else n=!1;if(n){let u=c.cca(e,l-2),p=u??-1;i=p==120||p==88}else i=!1;if(i){let u=c.cca(e,l-1),p=u??-1;t=p==116||p==84}else t=!1}}return t?".lor.txt":".lor"}static isLorFilePath(e){let t;if(e==null)t=!1;else{let l=e.length;if(l<8)t=!1;else{let i,n,s,r,a,h,o=c.cca(e,l-8);if((o??-1)==46){let u=c.cca(e,l-7),p=u??-1;h=p==108||p==76}else h=!1;if(h){let u=c.cca(e,l-6),p=u??-1;a=p==111||p==79}else a=!1;if(a){let u=c.cca(e,l-5),p=u??-1;r=p==114||p==82}else r=!1;if(r){let u=c.cca(e,l-4);s=(u??-1)==46}else s=!1;if(s){let u=c.cca(e,l-3),p=u??-1;n=p==116||p==84}else n=!1;if(n){let u=c.cca(e,l-2),p=u??-1;i=p==120||p==88}else i=!1;if(i){let u=c.cca(e,l-1),p=u??-1;t=p==116||p==84}else t=!1}}if(t)return!0;if(e==null)return!1;{let l=e.length;if(l<4)return!1;{let i,n,s=c.cca(e,l-4);if((s??-1)==46){let r=c.cca(e,l-3),a=r??-1;n=a==108||a==76}else n=!1;if(n){let r=c.cca(e,l-2),a=r??-1;i=a==111||a==79}else i=!1;if(i){let r=c.cca(e,l-1),a=r??-1;return a!=114?a==82:!0}else return!1}}}static stripLorExtension(e){if(e==null)return null;let t;if(e==null)t=!1;else{let i=e.length;if(i<8)t=!1;else{let n,s,r,a,h,o,u=c.cca(e,i-8);if((u??-1)==46){let p=c.cca(e,i-7),_=p??-1;o=_==108||_==76}else o=!1;if(o){let p=c.cca(e,i-6),_=p??-1;h=_==111||_==79}else h=!1;if(h){let p=c.cca(e,i-5),_=p??-1;a=_==114||_==82}else a=!1;if(a){let p=c.cca(e,i-4);r=(p??-1)==46}else r=!1;if(r){let p=c.cca(e,i-3),_=p??-1;s=_==116||_==84}else s=!1;if(s){let p=c.cca(e,i-2),_=p??-1;n=_==120||_==88}else n=!1;if(n){let p=c.cca(e,i-1),_=p??-1;t=_==116||_==84}else t=!1}}if(t){let i=e.length-8;return i!=null?c.substr(e,0,i):c.substr(e,0,null)}let l;if(e==null)l=!1;else{let i=e.length;if(i<4)l=!1;else{let n,s,r=c.cca(e,i-4);if((r??-1)==46){let a=c.cca(e,i-3),h=a??-1;s=h==108||h==76}else s=!1;if(s){let a=c.cca(e,i-2),h=a??-1;n=h==111||h==79}else n=!1;if(n){let a=c.cca(e,i-1),h=a??-1;l=h==114||h==82}else l=!1}}if(l){let i=e.length-4;return i!=null?c.substr(e,0,i):c.substr(e,0,null)}return e}}Q["loreline.Imports"]=zi,zi.__name__="loreline.Imports",Object.assign(zi.prototype,{__class__:zi});class El{constructor(){this.mask=0,this.size=0,this._values=null,this._keys2=null,this._keys1=null;let e=this._keys1,t=this._keys2,l=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 i=0,n=e.length;for(;i<n;){let s=i++;l[s]!=null&&this._set(e[s],t[s],l[s])}}}resize(e){let t=this._keys1,l=this._keys2,i=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++;i[r]!=null&&this._set(t[r],l[r],i[r])}}}hashCoords(e,t){let l=e+(t<<16);return l=(l^l>>>16)*-2048144789,l=(l^l>>>13)*-1028477387,l^l>>>16}clear(){this._keys1=null,this._keys2=null,this._values=null;let e=this._keys1,t=this._keys2,l=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 i=0,n=e.length;for(;i<n;){let s=i++;l[s]!=null&&this._set(e[s],t[s],l[s])}}this.size=0}copy(){let e=new El,t=this._keys1,l=new Array(t.length);pn.blit(t,0,l,0,t.length),e._keys1=l;let i=this._keys2,n=new Array(i.length);pn.blit(i,0,n,0,i.length),e._keys2=n;let s=this._values,r=new Array(s.length);return pn.blit(s,0,r,0,s.length),e._values=r,e.size=this.size,e.mask=this.mask,e}_set(e,t,l){if(this.size>=(this.mask+1)*.75){let r=this.mask+1<<1,a=this._keys1,h=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,a!=null){this.size=0;let u=0,p=a.length;for(;u<p;){let _=u++;o[_]!=null&&this._set(a[_],h[_],o[_])}}}let i=e+(t<<16);i=(i^i>>>16)*-2048144789,i=(i^i>>>13)*-1028477387;let s=(i^i>>>16)&this.mask;for(;;){if(this._values[s]==null){this._keys1[s]=e,this._keys2[s]=t,this._values[s]=l,this.size++;return}if(this._keys1[s]==e&&this._keys2[s]==t){this._values[s]=l;return}s=s+1&this.mask}}_get(e,t){let l=e+(t<<16);l=(l^l>>>16)*-2048144789,l=(l^l>>>13)*-1028477387;let n=(l^l>>>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 l=e+(t<<16);l=(l^l>>>16)*-2048144789,l=(l^l>>>13)*-1028477387;let n=(l^l>>>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 l=e+(t<<16);l=(l^l>>>16)*-2048144789,l=(l^l>>>13)*-1028477387;let n=(l^l>>>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],a=this._values[n];this._values[n]=null,this.size--,this._set(s,r,a),n=n+1&this.mask}return!0}n=n+1&this.mask}}iterator(){return new ji(this)}keyIterator(){return new Ki(this)}keyValueIterator(){return new Ji(this)}length(){return this.size}}Q["loreline.Int64Map"]=El,El.__name__="loreline.Int64Map",Object.assign(El.prototype,{__class__:El});class ji{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}}Q["loreline._Int64Map.Int64MapIterator"]=ji,ji.__name__="loreline._Int64Map.Int64MapIterator",Object.assign(ji.prototype,{__class__:ji});class Ki{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}}}Q["loreline._Int64Map.Int64MapKeyIterator"]=Ki,Ki.__name__="loreline._Int64Map.Int64MapKeyIterator",Object.assign(Ki.prototype,{__class__:Ki});class Ji{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],l=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:l}}}Q["loreline._Int64Map.Int64MapKeyValueIterator"]=Ji,Ji.__name__="loreline._Int64Map.Int64MapKeyValueIterator",Object.assign(Ji.prototype,{__class__:Ji});class Fl{constructor(e,t,l,i){this.scope=-1,l!=null?this.fields=l:this.clear(e,t),i!=null?this.originalFields=i:this.createOriginalFields()}clear(e,t){this.fields=he.createFields(e,null,t)}createOriginalFields(){this.originalFields=he.createFields()}}Q["loreline.RuntimeState"]=Fl,Fl.__name__="loreline.RuntimeState",Object.assign(Fl.prototype,{__class__:Fl});class di extends Fl{constructor(e,t,l,i){super(e,t,l,i)}}Q["loreline.RuntimeCharacter"]=di,di.__name__="loreline.RuntimeCharacter",di.__super__=Fl,Object.assign(di.prototype,{__class__:di});var fl=Ye["loreline.RuntimeAccess"]={__ename__:"loreline.RuntimeAccess",__constructs__:null,FieldAccess:(w=function(b,e,t){return{_hx_index:0,pos:b,obj:e,name:t,__enum__:"loreline.RuntimeAccess",toString:F}},w._hx_name="FieldAccess",w.__params__=["pos","obj","name"],w),ArrayAccess:(w=function(b,e,t){return{_hx_index:1,pos:b,array:e,index:t,__enum__:"loreline.RuntimeAccess",toString:F}},w._hx_name="ArrayAccess",w.__params__=["pos","array","index"],w),CharacterAccess:(w=function(b,e){return{_hx_index:2,pos:b,name:e,__enum__:"loreline.RuntimeAccess",toString:F}},w._hx_name="CharacterAccess",w.__params__=["pos","name"],w),FunctionAccess:(w=function(b,e){return{_hx_index:3,pos:b,name:e,__enum__:"loreline.RuntimeAccess",toString:F}},w._hx_name="FunctionAccess",w.__params__=["pos","name"],w),BeatAccess:(w=function(b,e){return{_hx_index:4,pos:b,beat:e,__enum__:"loreline.RuntimeAccess",toString:F}},w._hx_name="BeatAccess",w.__params__=["pos","beat"],w)};fl.__constructs__=[fl.FieldAccess,fl.ArrayAccess,fl.CharacterAccess,fl.FunctionAccess,fl.BeatAccess];class xi{constructor(e,t,l,i,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=l,i!=null&&(this.beats=i),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,l=this.beats.length;for(;t<l;){let i=t++,n=this.beats[i];if(n.name==e)return n}return null}}Q["loreline.RuntimeScope"]=xi,xi.__name__="loreline.RuntimeScope",Object.assign(xi.prototype,{__class__:xi});class Si{constructor(e,t){this.parentNextOptionIndex=0,this.parentPartialOptions=null,this.stack=[],this.options=null,this.id=e,this.origin=t}}Q["loreline.RuntimeInsertion"]=Si,Si.__name__="loreline.RuntimeInsertion",Object.assign(Si.prototype,{__class__:Si});class vi{constructor(e,t,l){this.closing=e,this.value=t,this.offset=l}}Q["loreline.TextTag"]=vi,vi.__name__="loreline.TextTag",Object.assign(vi.prototype,{__class__:vi});class Oi{constructor(e,t,l,i,n){this.text=e,this.tags=t,this.enabled=l,this.node=i,this.insertion=n}}Q["loreline.ChoiceOption"]=Oi,Oi.__name__="loreline.ChoiceOption",Object.assign(Oi.prototype,{__class__:Oi});class ge extends st{constructor(e,t){super(e,t)}}Q["loreline.RuntimeError"]=ge,ge.__name__="loreline.RuntimeError",ge.__super__=st,Object.assign(ge.prototype,{__class__:ge});class Hi{constructor(){this.cb=null,this.sync=!0}}Q["loreline.EvalNext"]=Hi,Hi.__name__="loreline.EvalNext",Object.assign(Hi.prototype,{__class__:Hi});class Pi{constructor(e,t,l,i,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 li,this.topLevelBeats=new Ee,this.topLevelCharacters=new Ee,this.script=e,this.handleDialogue=t,this.handleChoice=l,this.handleFinish=i,this.lens=new Ii(e);let s=n!=null?n.strictAccess:null;this.strictAccess=s!=null&&s,this.translations=n!=null?n.translations:null,this.topLevelState=new Fl(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 a=r.next();switch(te.getClass(a)){case Me:this.initializeTopLevelBeat(a);break;case jt:this.initializeTopLevelCharacter(a);break;case ql:this.initializeTopLevelFunction(a);break;case $t:this.initializeTopLevelState(a);break;default:}}this.inferImplicitCharactersFromRootBeat()}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}}inferImplicitCharactersFromRootBeat(){let e=0,t=this.lens.getNodesOfType(Me);for(;e<t.length;){let l=t[e];if(++e,l.name!="_")continue;let i=0,n=this.lens.getDialogueSpeakers(l);for(;i<n.length;){let s=n[i];++i,!Object.prototype.hasOwnProperty.call(this.topLevelCharacters.h,s)&&(he.fieldExists(this,this.topLevelState.fields,s)||this.initializeTopLevelCharacter(new jt(Ae.UNDEFINED,l.pos,s,l.pos,[])))}}}start(e){let t=null;if(e!=null){if(t=this.topLevelBeats.h[e],t==null)throw T.thrown(new ge("Beat "+e+" not found",this.script.pos))}else{let l=0,i=this.script.body;for(;l<i.length;){let n=i[l];if(++l,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 T.thrown(new ge("No beats found in script",this.script.pos))}this.transitionToBeat(t),this.flush()}save(){let e={},t=[],l=0,i=this.stack;for(;l<i.length;){let s=i[l];++l,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,a=this.pendingChoiceOptions;for(;r<a.length;){let h=a[r];++r,s.push(this.serializeChoiceOption(h,e))}n.pendingChoiceOptions=s}if(this._choiceEvalTexts.length>0){let s=[],r=0,a=this._choiceEvalTexts.length;for(;r<a;){let h=r++,o={text:this._choiceEvalTexts[h]};this._choiceEvalEnabled[h]||(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 T.thrown(new ge("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 Kl;if(this.restoreStack(e.stack,e.insertions,t)||(this.beatToResume=this.restoreBeatToResume(e.stack)),e.pendingChoiceOptions!=null){this.pendingChoiceOptions=[];let l=0,i=e.pendingChoiceOptions;for(;l<i.length;){let n=i[l];++l;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 l=0,i=e.choiceEvalContext;for(;l<i.length;){let n=i[l];++l,this._choiceEvalTexts.push(n.text),this._choiceEvalEnabled.push(n.disabled!=!0)}}}resume(){if(this.stack.length==0){this.start();return}let e=this.wrapNext(be(this,this.finish));this.finishTrigger=e,this.resumeNode(this.stack[0].node,0,e.cb),e.sync=!1,this.flush()}resumeFromLevel(e,t){let l=this.wrapNext(t);this.resumeNode(this.stack[e].node,e,l.cb),l.sync=!1}getCharacter(e){let t=this.topLevelCharacters.h[e];return t!=null?t.fields:null}getCharacterField(e,t){let l=this.topLevelCharacters.h[e],i=l!=null?l.fields:null;return i!=null?he.getField(this,i,t):null}setCharacterField(e,t,l){let i=this.topLevelCharacters.h[e].fields;he.setField(this,i,t,l)}getStateField(e){let t=this.stack.length-1;for(;t>=0;){let l=this.stack[t];if(l.state!=null&&he.fieldExists(this,l.state.fields,e))return he.getField(this,l.state.fields,e);if(l.node!=null){let i=l.node.id.thisVal,n=this.nodeStates.map._get(i.high,i.low);if(n!=null&&he.fieldExists(this,n.fields,e))return he.getField(this,n.fields,e)}--t}return he.fieldExists(this,this.topLevelState.fields,e)?he.getField(this,this.topLevelState.fields,e):null}setStateField(e,t){let l=this.stack.length-1;for(;l>=0;){let i=this.stack[l];if(i.state!=null&&he.fieldExists(this,i.state.fields,e)){he.setField(this,i.state.fields,e,t);return}if(i.node!=null){let n=i.node.id.thisVal,s=this.nodeStates.map._get(n.high,n.low);if(s!=null&&he.fieldExists(this,s.fields,e)){he.setField(this,s.fields,e,t);return}}--l}he.setField(this,this.topLevelState.fields,e,t)}getTopLevelStateField(e){return he.getField(this,this.topLevelState.fields,e)}setTopLevelStateField(e,t){he.setField(this,this.topLevelState.fields,e,t)}currentNode(){let e=this.get_currentScope();return e==null?null:e.head!=null?e.head:e.node}currentNodeFilePath(e){let t=this.currentNode();return t==null||e==null?e:this.lens.getNodeFilePath(t,e)}serializeScope(e,t){let l={id:e.id};if(e.beat!=null&&(l.beat=this.serializeBeatReference(e.beat)),e.node!=null&&(l.node=this.serializeNodeReference(e.node)),e.state!=null&&(l.state=this.serializeState(e.state)),e.beats!=null){let i=[],n=0,s=e.beats;for(;n<s.length;){let r=s[n];++n,i.push(this.serializeBeatReference(r))}l.beats=i}return e.head!=null&&(l.head=this.serializeNodeReference(e.head)),e.insertion!=null&&(l.insertion=this.serializeInsertion(e.insertion,t)),l}serializeInsertion(e,t){let l=e.id==null?"null":""+e.id,i=We.field(t,l);if(i==null){if(i={},t[l]=i,e.options!=null){let n=[],s=0,r=e.options;for(;s<r.length;){let a=r[s];++s,n.push(this.serializeChoiceOption(a,t))}i.options=n}if(e.origin!=null&&(i.origin=this.serializeNodeReference(e.origin)),e.stack!=null){let n=[],s=0,r=e.stack;for(;s<r.length;){let a=r[s];++s,n.push(this.serializeScope(a,t))}i.stack=n}if(e.parentPartialOptions!=null){let n=[],s=0,r=e.parentPartialOptions;for(;s<r.length;){let a=r[s];++s,n.push(this.serializeChoiceOption(a,t))}i.parentPartialOptions=n,i.parentNextOptionIndex=e.parentNextOptionIndex}}return e.id}serializeChoiceOption(e,t){let l={text:e.text};if(e.enabled||(l.disabled=!0),e.tags!=null){let i=[],n=0,s=e.tags;for(;n<s.length;){let r=s[n];++n,i.push(this.serializeTextTag(r))}l.tags=i}return e.node!=null&&(l.node=this.serializeNodeReference(e.node)),e.insertion!=null&&(l.insertion=this.serializeInsertion(e.insertion,t)),l}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,l=t,i=Object.keys(t),n=i.length,s=0;for(;s<n;){let r=i[s++],a=r,h=l[r],o=a,u=h,p=this.serializeCharacter(u);We.fields(p.fields).length>0&&(e[o]=p)}return e}serializeNodeStates(){let e={},t=this.nodeStates.map,l=0;for(;l<t._values.length&&t._values[l]==null;)++l;for(;l<t._values.length;){let i=t._keys1[l],n=t._keys2[l],s=t._values[l];for(++l;l<t._values.length&&t._values[l]==null;)++l;let r=Ae.fromTwoInt32(i,n),a=s,h=r,o=a,u=this.serializeState(o);We.fields(u.fields).length>0&&(e[h.toString()]=u)}return e}serializeBeatReference(e){let t=e.name,l=e;do l=this.lens.getFirstParentOfType(l,Me),l!=null&&(t=l.name+"."+t);while(l!=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 l=null,i={};if(te.__implements(e,Ml)){let n=te.getClass(e);n!=null&&(l=n.__name__);let s=e,r=0,a=s.lorelineFields(this);for(;r<a.length;){let h=a[r];++r,i[h]=this.serializeValue(s.lorelineGet(this,h))}}else if(e instanceof Ee){let n=e,s=n.h,r=s,a=Object.keys(s),h=a.length,o=0;for(;o<h;){let u=a[o++],p=n.h[u];(t==null||!he.fieldExists(this,t,u)||!Nl.equal(this,he.getField(this,t,u),p))&&(i[u]=this.serializeValue(p))}}else{let n=te.getClass(e);n!=null&&(l=n.__name__);let s=0,r=We.fields(e);for(;s<r.length;){let a=r[s];++s;let h=We.getProperty(e,a);(t==null||!he.fieldExists(this,t,a)||!Nl.equal(this,he.getField(this,t,a),h))&&(i[a]=this.serializeValue(h))}}return l!=null?{type:l,fields:i}:{fields:i}}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(oe.isArray(e)){let t=[],l=oe.arrayLength(e),i=0,n=l;for(;i<n;){let s=i++;t.push(this.serializeValue(oe.arrayGet(e,s)))}return t}return this.serializeFields(e)}resumeNode(e,t,l){let i=this.stack.length-1;if(t>=this.stack.length)switch(te.getClass(e)){case Hl:this.evalAlternative(e,l);break;case Jt:if(!this.isBeatCall(e))this.evalCall(e,l);else{let r=te.getClass(e);throw T.thrown(new ge("Resume execution not supported from last node: "+r.__name__,e.pos))}break;case xl:this.evalChoice(e,l);break;case Kt:this.evalDialogue(e,l);break;case ll:this.evalText(e,l);break;default:let s=te.getClass(e);throw T.thrown(new ge("Resume execution not supported from last node: "+s.__name__,e.pos))}else switch(te.getClass(e)){case Hl:this.resumeAlternative(e,t,l);break;case Me:this.resumeBeatRun(e,t,l);break;case Jt:if(this.isBeatCall(e,t))this.resumeCall(e,t,l);else{let r=te.getClass(e);throw T.thrown(new ge("Resume execution not supported from node within stack: "+r.__name__,e.pos))}break;case St:this.resumeChoiceOption(e,t,l);break;case xl:this.resumeChoice(e,t,l);break;case wl:this.resumeIf(e,t,l);break;default:let s=te.getClass(e);throw T.thrown(new ge("Resume execution not supported from node within stack: "+s.__name__,e.pos))}}resumeNodeBody(e,t,l,i){let n=this.stack[t],s=0,r=-1;if(n.head==null&&t<this.stack.length-1)throw T.thrown(new ge("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=l.indexOf(n.head),r=s,s==-1))throw T.thrown(new ge("Failed to resolve head in scope when resuming through body",e.pos));let a=this.get_currentInsertion(),h=null,o=this;h=function(){if((a!=null?a.options:null)!=null)o.pop(),i();else if(s!=-1&&s==r){let u=l[s];s+=1;let p=o.wrapNext(h);o.resumeNode(u,t+1,p.cb),p.sync=!1}else if(s<l.length){let u=l[s];n.head=u,s+=1;let p=o.wrapNext(h);o.evalNode(u,p.cb),p.sync=!1}else o.pop(),i()},h()}resumeBeatRun(e,t,l){this.resumeNodeBody(e,t,e.body,l)}resumeChoiceOption(e,t,l){this.resumeNodeBody(e,t,e.body,l)}resumeChoice(e,t,l){let i=this.stack[t],n=this;if(i.head==null)this.evalChoice(e,l);else if(i.head instanceof St){let s=i.head;t+1<this.stack.length?this.resumeNodeBody(s,t+1,s.body,l):this.evalNodeBody(i.beat,s,s.body,null,l)}else if(i.insertion!=null){let s=i.node,r=i.insertion;if(s instanceof Me){let a=s;this.resumeNodeBody(a,t,a.body,function(){let h=r.parentPartialOptions!=null?r.parentPartialOptions:[];if(r.options!=null){let _=0,m=r.options;for(;_<m.length;){let f=m[_];++_,h.push(f)}}let o=r.parentNextOptionIndex,u=i.beat,p=n.wrapNext(function(){n.presentChoice(e,h,l)});n.evalChoiceOptionsAndInsertions(u,e,h,p.cb,o),p.sync=!1})}else{for(;this.stack.length>t;)this.pop();this.evalChoice(e,l)}}else if(i.node instanceof St){let s=i.node;this.resumeNodeBody(s,t,s.body,l)}else if(i.node instanceof Me){let s=i.node;this.resumeNodeBody(s,t,s.body,l)}else throw T.thrown(new ge("Choice head is not a choice option",i.head.pos))}resumeIf(e,t,l){let i=this.stack[t];if(i.head==null)throw T.thrown(new ge("Failed to resolve head in scope when resuming through condition",e.pos));let s=e.thenBranch.body.indexOf(i.head)!=-1?e.thenBranch:e.elseBranch;if(s!=null&&s.body.length>0)this.resumeNodeBody(s,t,s.body,l);else throw T.thrown(new ge("Failed to resume condition: invalid scope",e.pos))}resumeAlternative(e,t,l){let i=this.stack[t];if(i.head==null)throw T.thrown(new ge("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(i.head)!=-1){this.resumeNodeBody(r,t,r.body,l);return}}throw T.thrown(new ge("Failed to resume alternative: head not found in any item",e.pos))}resumeCall(e,t,l){if(e.target instanceof ft){let i=e.target;if(i.target==null){let n=i.name,s=null,r=this.stack.length-1;for(;r>=0;){let h=this.stack[r].beatByName(n);if(h!=null){s=h;break}--r}if(s==null&&Object.prototype.hasOwnProperty.call(this.topLevelBeats.h,n)&&(s=this.topLevelBeats.h[n]),s!=null){this.resumeBeatRun(s,t,l);return}}}throw T.thrown(new ge("Cannot resume through a function call that is not at the bottom of the stack",e.pos))}restoreStack(e,t,l){let i=[];l==null&&(l=new Kl);let n=e.length-1;for(;n>=0;){let s=this.restoreScopeItem(e[n],t,l);if(s==null)return!1;i.push(s),--n}for(n=i.length-1;n>=0;)this.push(i[n]),--n;return!0}restoreScopeItem(e,t,l){let i=this.restoreBeat(e.beat);if(i==null)return null;let n=Ae.fromString(e.beat.id),s=e.node,r=s!=null?this.restoreNode(s,n,i):null;if(s!=null&&r==null)return null;let a=[];if(e.beats!=null){let m=0,f=e.beats;for(;m<f.length;){let g=f[m];++m;let d=this.restoreBeat(g);if(d==null)return null;a.push(d)}}let o=e.state!=null?this.restoreState(null,e.state):null,u=e.head,p=u!=null?this.restoreNode(u,n,i):null;if(u!=null&&p==null)return null;let _=null;return e.insertion!=null&&t!=null&&(_=this.restoreInsertion(e.insertion,t,l)),new xi(null,i,r,a,o,p,_)}restoreInsertion(e,t,l){if(l.h.hasOwnProperty(e))return l.h[e];let i=e==null?"null":""+e,n=We.field(t,i);if(n==null)return null;let s=null;if(n.origin!=null){let a=Ae.fromString(n.origin.id),h=this.lens.getNodeById(a);h!=null&&h.type()==n.origin.type&&(s=h)}let r=new Si(e,s);if(l.h[e]=r,e>=this.nextInsertionId&&(this.nextInsertionId=e+1),n.options!=null){r.options=[];let a=0,h=n.options;for(;a<h.length;){let o=h[a];++a;let u=this.restoreChoiceOption(o,t,l);u!=null&&r.options.push(u)}}if(n.stack!=null){r.stack=[];let a=0,h=n.stack;for(;a<h.length;){let o=h[a];++a;let u=this.restoreScopeItem(o,t,l);u!=null&&r.stack.push(u)}}if(n.parentPartialOptions!=null){r.parentPartialOptions=[];let a=0,h=n.parentPartialOptions;for(;a<h.length;){let o=h[a];++a;let u=this.restoreChoiceOption(o,t,l);u!=null&&r.parentPartialOptions.push(u)}r.parentNextOptionIndex=n.parentNextOptionIndex!=null?n.parentNextOptionIndex:0}return r}restoreChoiceOption(e,t,l){let i=null;if(e.node!=null){let r=Ae.fromString(e.node.id),a=this.lens.getNodeById(r);a!=null&&a.type()==e.node.type&&(i=a)}let n=null;if(e.tags!=null){let r=[],a=0,h=e.tags;for(;a<h.length;){let o=h[a];++a,r.push(new vi(o.closing==!0,o.value,o.offset))}n=r}let s=null;return e.insertion!=null&&t!=null&&(s=this.restoreInsertion(e.insertion,t,l)),new Oi(e.text,n,e.disabled!=!0,i,s)}restoreBeatToResume(e){let t=null;if(e.length>0){let l=e[0];if(t=this.restoreBeat(l.beat),t!=null){let i=t;do i=this.lens.getFirstParentOfType(i,Me),i!=null&&(t=i);while(i!=null)}}return t}restoreNode(e,t,l){let i=l.id.thisVal.high>>16&65535,n=t.thisVal.high>>16&65535,s=(i>=32768?i-65536:i)+32768-((n>=32768?n-65536:n)+32768),r=Ae.fromString(e.id);if(r==t)return l;let a=r.thisVal.high>>16&65535,o=(a>=32768?a-65536:a)+32768+s-32768;o<0&&(o=o+65536&65535),r.thisVal=new jl(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 l=e!=null?e.fields:null,i=this.restoreFields(l??null,t);return e==null&&(e=new Fl(this,null,i,null)),e}restoreCharacters(e){let t=0,l=We.fields(e);for(;t<l.length;){let i=l[t];++t;let n=We.field(e,i);if(Object.prototype.hasOwnProperty.call(this.topLevelCharacters.h,i))this.restoreCharacter(this.topLevelCharacters.h[i],n);else{let s=this.restoreCharacter(null,n);this.topLevelCharacters.h[i]=s}}}restoreNodeStates(e){let t=0,l=We.fields(e);for(;t<l.length;){let i=l[t];++t;let n=Ae.fromString(i),s=We.field(e,i),r=this.restoreState(null,s),a=n.thisVal;this.nodeStates.map._set(a.high,a.low,r)}}restoreCharacter(e,t){let l=e!=null?e.fields:null,i=this.restoreFields(l??null,t);return e==null&&(e=new di(this,null,i,null)),e}restoreFields(e,t){if(t==null||t.fields==null)return e;e==null&&(e=he.createFields(this,t.type));let l=t.fields;if(he.isFields(e)){let i=0,n=We.fields(l);for(;i<n.length;){let s=n[i];++i,he.setField(this,e,s,this.restoreValue(We.field(l,s)))}}else{let i=0,n=We.fields(l);for(;i<n.length;){let s=n[i];++i,e[s]=this.restoreValue(We.field(l,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(oe.isArray(e)){let t=oe.arrayLength(e),l=oe.createArray(),i=0,n=t;for(;i<n;){let s=i++;oe.arrayPush(l,this.restoreValue(oe.arrayGet(e,s)))}return l}return this.restoreFields(null,e)}initializeTopLevelFunctions(e){if(this.builtins=new qi(this),this.builtins.bindAll(this.topLevelFunctions),e!=null){let r=e,a=r,h=We.fields(r),o=0;for(;o<h.length;){let u=h[o++],p=a[u],m=u,f=p;this.topLevelFunctions.h[m]=f}}let t=this.topLevelFunctions.h,l=t,i=Object.keys(t),n=i.length,s=0;for(;s<n;){let r=i[s++],a=r,h=l[r],o=a,u=h;o.startsWith("string_")?this.stringHelpers.h[c.substr(o,7,null)]=u:o.startsWith("array_")?this.arrayHelpers.h[c.substr(o,6,null)]=u:o.startsWith("map_")?this.mapHelpers.h[c.substr(o,4,null)]=u:o.startsWith("beat_")&&(this.beatHelpers.h[c.substr(o,5,null)]=u)}}initializeStringLiteralProcessors(e){let t=this;if(this.stringLiteralProcessors.push(function(l){return t.pluralPipeProcess(l)}),e!=null){let l=0;for(;l<e.length;){let i=e[l];++l,this.stringLiteralProcessors.push(i)}}}initializeTopLevelFunction(e){if(e.name!=null){if(!e.external||!Object.prototype.hasOwnProperty.call(this.topLevelFunctions.h,e.name)){let t=new ti;try{let l=t.process(e.code+(e.external?" {}":"")),i=new ci;i.allowJSON=!0,i.allowTypes=!0;let n=i.parseString(l),r=new nn(this).execute(n);this.topLevelFunctions.h[e.name]=r}catch(l){let i=T.caught(l).unwrap();throw T.thrown(new ge("Failed to parse function code: "+(i==null?"null":Y.string(i)),e.pos))}}}else throw T.thrown(new ge("Top level function must have a name",e.pos))}wrapNext(e){let t=new Hi;t.sync=!0;let l=this;return t.cb=function(){t.sync?(l.syncCallbacks==null&&(l.syncCallbacks=[]),l.syncCallbacks.push(t.cb)):(e(),l.flush(),t.cb=null,l.finishTrigger==t&&l.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 l=this.syncCallbacks.length-1;for(;l>=0;)t.unshift(this.syncCallbacks[l]),--l}this.syncCallbacks=t}}catch(e){let t=T.caught(e).unwrap();throw this.flushing=!1,T.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 T.thrown(new ge("Top level temporary states are not allowed",e.pos));let t=0,l=e.fields;for(;t<l.length;){let i=l[t];++t;let n=this.evaluateExpression(i.value);he.setField(this,this.topLevelState.fields,i.name,n),this.isOriginalScriptExpression(i.value)&&he.setField(this,this.topLevelState.originalFields,i.name,n)}}initializeTopLevelBeat(e){if(Object.prototype.hasOwnProperty.call(this.topLevelBeats.h,e.name))throw T.thrown(new ge("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 T.thrown(new ge("Duplicate top level character: "+e.name,e.pos));let t=new di(this,e,null,null);this.topLevelCharacters.h[e.name]=t;let l=0,i=e.fields;for(;l<i.length;){let n=i[l];++l;let s=this.evaluateExpression(n.value);he.setField(this,t.fields,n.name,s),this.isOriginalScriptExpression(n.value)&&he.setField(this,t.originalFields,n.name,s)}}initializeState(e,t){let l=null;if(e.temporary)t.state==null&&(t.state=new Fl(this,e,null,null)),l=t.state;else{let s=t.node.id.thisVal;if(l=this.nodeStates.map._get(s.high,s.low),l==null){l=new Fl(this,e,null,null);let r=t.node.id.thisVal;this.nodeStates.map._set(r.high,r.low,l)}}let i=0,n=e.fields;for(;i<n.length;){let s=n[i];if(++i,!he.fieldExists(this,l.fields,s.name)){let r=this.evaluateExpression(s.value);he.setField(this,l.fields,s.name,r),!e.temporary&&this.isOriginalScriptExpression(s.value)&&he.setField(this,l.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(be(this,this.finish));this.finishTrigger=t,this.evalBeatRun(e,t.cb),t.sync=!1}evalNode(e,t){switch(te.getClass(e)){case Hl:this.evalAlternative(e,t);break;case kl:this.evalAssignment(e,t);break;case Me:this.evalBeatDecl(e,t);break;case Jt:this.evalCall(e,t);break;case St:this.evalChoiceOption(e,t);break;case xl:this.evalChoice(e,t);break;case Kt:this.evalDialogue(e,t);break;case wl:this.evalIf(e,t);break;case $t:this.evalStateDecl(e,t);break;case ll:this.evalText(e,t);break;case Dl:this.evalTransition(e);break;default:let l=te.getClass(e);throw T.thrown(new ge("Unsupported node type: "+l.__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 T.thrown(new ge("Duplicate beat with name: "+e.name,e.pos));this.get_currentScope().beats.push(e),t()}evalNodeBody(e,t,l,i,n){this.push(new xi(null,e,t,null,null,null,i));let s=0,r=null,a=this.get_currentInsertion(),h=this;r=function(){if((a!=null?a.options:null)!=null)h.pop(),n();else if(s<l.length){let o=l[s];h.get_currentScope().head=o,s+=1;let u=h.wrapNext(r);h.evalNode(o,u.cb),u.sync=!1}else h.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 l=this.getTranslatedString(e,e.content),i=this.evaluateString(l);this.handleDialogue(this,null,i.text,i.tags,t)}evalDialogue(e,t){if(e.condition!=null&&!this.evaluateCondition(e.condition)){t();return}let l=this.getTranslatedString(e,e.content),i=this.evaluateString(l);this.handleDialogue(this,e.character,i.text,i.tags,t)}evalChoice(e,t){let l=this.pendingChoiceOptions;if(l!=null){this.pendingChoiceOptions=null,this._choiceEvalTexts.length=0,this._choiceEvalEnabled.length=0;let r=0;for(;r<l.length;){let a=l[r];++r,this._choiceEvalTexts.push(a.text),this._choiceEvalEnabled.push(a.enabled)}this.presentChoice(e,l,t);return}let i=[],n=this,s=this.wrapNext(function(){n.presentChoice(e,i,t)});this.evalChoiceOptionsAndInsertions(this.get_currentScope().beat,e,i,s.cb),s.sync=!1}presentChoice(e,t,l){let i=this.get_currentInsertion();if(i!=null&&i.options==null){i.stack=[].concat(this.stack),i.options=t,l();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,a=this,h=function(){a._choiceEvalTexts.length=0,a._choiceEvalEnabled.length=0},o=this.wrapNext(function(){if(a.pendingChoiceOptions=null,r>=0&&r<t.length){let u=t[r];u.node.once&&a.setChoiceOptionChosen(u.node);let p=function(){h(),l()};if(u.insertion!=null){let _=a.stack.length;for(;a.stack.length>0;)a.stack.pop();let m=0,f=u.insertion.stack;for(;m<f.length;){let d=f[m];++m,d.insertion!=null&&(d.insertion=null),a.stack.push(d)}let g=a.stack[a.stack.length-1];a.push(new xi(null,g.beat,a.lens.getParentNode(u.node),null,null,u.node,null)),a.resumeFromLevel(_,p)}else a.evalChoiceOption(u.node,p)}else h(),l()});this.handleChoice(this,t,function(u){r=u,o.cb()}),o.sync=!1}evalChoiceOptionsAndInsertions(e,t,l,i,n){let s=t.options;this._choiceEvalTexts.length=0,this._choiceEvalEnabled.length=0;let r=n??0,a=null,h=null,o=this;a=function(){if(h!=null&&h.options!=null){let u=0,p=h.options.length;for(;u<p;){let _=u++,m=h.options[_];l.push(m),o._choiceEvalTexts.push(m.text),o._choiceEvalEnabled.push(m.enabled)}h=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 m=o.wrapNext(a),f=o.getTranslatedString(u,u.text),g=o.evaluateString(f);l.push(new Oi(g.text,g.tags,_,u,o.get_currentInsertion())),o._choiceEvalTexts.push(g.text),o._choiceEvalEnabled.push(_),m.cb(),m.sync=!1}else if(u.insertion!=null){let m=o.wrapNext(a);_?(h=new Si(o.nextInsertionId++,u.insertion),h.parentPartialOptions=[].concat(l),h.parentNextOptionIndex=r,o.evalInsertion(h,m.cb)):m.cb(),m.sync=!1}else throw T.thrown(new ge("Invalid choice option",u.pos))}else i()},a()}evalInsertion(e,t){let l=e.origin.target,i=null,n=this.stack.length-1;for(;n>=0;){let r=this.stack[n].beatByName(l);if(r!=null){i=r;break}--n}if(i==null&&Object.prototype.hasOwnProperty.call(this.topLevelBeats.h,l)&&(i=this.topLevelBeats.h[l]),i==null)throw T.thrown(new ge("Beat "+l+" not found",this.script.pos));this.evalNodeBody(i,i,i.body,e,t)}evalChoiceOption(e,t){this.evalNodeBody(this.get_currentScope().beat,e,e.body,null,t)}evalIf(e,t){let i=this.evaluateCondition(e.condition)?e.thenBranch:e.elseBranch;i!=null&&i.body.length>0?this.evalNodeBody(this.get_currentScope().beat,i,i.body,null,t):t()}evalAlternative(e,t){if(e.items.length==0){t();return}switch(e.mode){case 0:let l=this.getAlternativeVisitCount(e),i=l<e.items.length?l:e.items.length-1;this.setAlternativeVisitCount(e,l+1);let n=e.items[i];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 a=e.items[r];this.evalNodeBody(this.get_currentScope().beat,a,a.body,null,t);break;case 2:let h=this.getAlternativeVisitCount(e);if(h>=e.items.length){t();return}this.setAlternativeVisitCount(e,h+1);let o=e.items[h];this.evalNodeBody(this.get_currentScope().beat,o,o.body,null,t);break;case 3:let u=this.builtins.random(0,e.items.length-1),p=e.items[u];this.evalNodeBody(this.get_currentScope().beat,p,p.body,null,t);break;case 4:let _=[],m=0,f=e.items.length;for(;m<f;){let x=m++;_.push(x)}let g=_,d=g.length-1;for(;d>0;){let x=this.builtins.random(0,d),y=g[d];g[d]=g[x],g[x]=y,--d}this.evalShuffledItems(e,g,0,t);break}}evalShuffledItems(e,t,l,i){if(l>=t.length){i();return}let n=e.items[t[l]],s=this;this.evalNodeBody(this.get_currentScope().beat,n,n.body,null,function(){s.evalShuffledItems(e,t,l+1,i)})}getBeatVisitCount(e){let t=e.id.thisVal,l=this.nodeStates.map._get(t.high,t.low);if(l==null)return 0;let i=he.getField(this,l.fields,"_visitCount");return i??0}incrementBeatVisitCount(e){let t=e.id.thisVal,l=this.nodeStates.map._get(t.high,t.low);if(l==null){l=new Fl(this,e,null,null);let s=e.id.thisVal;this.nodeStates.map._set(s.high,s.low,l)}let i=he.getField(this,l.fields,"_visitCount"),n=i??0;he.setField(this,l.fields,"_visitCount",n+1)}getAlternativeVisitCount(e){let t=e.id.thisVal,l=this.nodeStates.map._get(t.high,t.low);if(l==null)return 0;let i=he.getField(this,l.fields,"_visitCount");return i??0}setAlternativeVisitCount(e,t){let l=e.id.thisVal,i=this.nodeStates.map._get(l.high,l.low);if(i==null){i=new Fl(this,e,null,null);let n=e.id.thisVal;this.nodeStates.map._set(n.high,n.low,i)}he.setField(this,i.fields,"_visitCount",t)}isChoiceOptionChosen(e){let t=e.id.thisVal,l=this.nodeStates.map._get(t.high,t.low);if(l==null)return!1;let i=he.getField(this,l.fields,"_chosen");return i??!1}setChoiceOptionChosen(e){let t=e.id.thisVal,l=this.nodeStates.map._get(t.high,t.low);if(l==null){l=new Fl(this,e,null,null);let i=e.id.thisVal;this.nodeStates.map._set(i.high,i.low,l)}he.setField(this,l.fields,"_chosen",!0)}evalAssignment(e,t){let l=this.resolveAssignmentTarget(e.target),i=this.evaluateExpression(e.value),n;switch(e.op._hx_index){case 21:n=this.performOperation(k.OpPlus,this.readAccess(l),i,e.pos);break;case 22:n=this.performOperation(k.OpMinus,this.readAccess(l),i,e.pos);break;case 23:n=this.performOperation(k.OpMultiply,this.readAccess(l),i,e.pos);break;case 24:n=this.performOperation(k.OpDivide,this.readAccess(l),i,e.pos);break;case 20:case 25:n=i;break;default:throw T.thrown(new ge("Invalid assignment operator",e.pos))}this.writeAccess(l,n),t()}isOriginalScriptExpression(e){switch(te.getClass(e)){case il:let t=e;return this.isOriginalScriptExpression(t.left)?this.isOriginalScriptExpression(t.right):!1;case ft:case gl:case Jt:return!1;case je:let l=e,i=l.literalType;switch(i._hx_index){case 0:case 1:case 2:return!0;case 3:let h=l.value,o=0;for(;o<h.length;){let m=h[o];if(++o,m instanceof ct&&!this.isOriginalScriptExpression(m))return!1}return!0;case 4:let u=i.style,p=l.value,_=0;for(;_<p.length;){let m=p[_];if(++_,!this.isOriginalScriptExpression(m.value))return!1}return!0}break;case Nt:let n=e,s=0,r=n.parts;for(;s<r.length;){let h=r[s];++s;let o=h.partType;switch(o._hx_index){case 0:let u=o.text;continue;case 1:let p=o.expr;return!1;case 2:let _=o.closing,m=o.expr;if(!this.isOriginalScriptExpression(m))return!1;break}}return!0;case Yl:let a=e;return this.isOriginalScriptExpression(a.operand)}return!1}isBeatCall(e,t){return t==null&&(t=-1),e instanceof Jt?this.resolveBeatFromCall(e,t)!=null:!1}resolveBeatByName(e,t){t==null&&(t=-1);let l=t==-1?this.stack.length-1:t;for(;l>=0;){let i=this.stack[l].beatByName(e);if(i!=null)return i;--l}return this.topLevelBeats.h[e]}resolveBeatFromCall(e,t){if(t==null&&(t=-1),e.target instanceof ft){let l=e.target;if(l.target==null){let i=this.resolveBeatByName(l.name,t);if(i!=null)return i}}return null}evalCall(e,t){let l=this.resolveBeatFromCall(e);if(l!=null){this.evalBeatRun(l,t);return}this.evaluateFunctionCall(e,t)}evalTransition(e){let t=e.target;if(t=="."){this.finish();return}let l=null,i=this.stack.length-1;for(;i>=0;){let s=this.stack[i].beatByName(t);if(s!=null){l=s;break}--i}if(l==null&&Object.prototype.hasOwnProperty.call(this.topLevelBeats.h,t)&&(l=this.topLevelBeats.h[t]),l==null)throw T.thrown(new ge("Beat "+t+" not found",this.script.pos));this.transitionToBeat(l)}getTranslatedString(e,t){if(this.translations!=null){let l=this.findHashCommentId(e,t);if(l!=null&&this.script.filePath!=null){let i=0,n=this.lens.getNodeAncestorFilePaths(e);for(;i<n.length;){let s=n[i];++i;let r=this.translations.h[s+"#"+l];if(r!=null)return r}}}return t}findHashCommentId(e,t){return et.findHashComment(e,t)}evaluateString(e){let t=0,l=this.stringLiteralProcessors.length;for(;t<l;){let m=t++;e=this.stringLiteralProcessors[m](e)}let i="",n=[],s=0,r=e.parts.length,a=e.quotes!=0,h=e.quotes!=0,o=e.quotes!=0,u=-1;if(!a){let m=r-1;e:for(;m>=0;){let g=e.parts[m].partType;switch(g._hx_index){case 0:let d=g.text;u=m;break e;case 1:let x=g.expr;break e;case 2:let y=g.closing,S=g.expr;--m;break}}}let p=0,_=r;for(;p<_;){let m=p++,g=e.parts[m].partType;switch(g._hx_index){case 0:let d=g.text;a||(d=He.ltrim(d)),m==u&&(d=He.rtrim(d)),o||(d=this.stripStringComments(d)),h||(d=this.stripStringIndent(d));let x=d.length;x>0&&(a=!0);let y=!1,S=!1,C=!1,O=0,E=x;for(;O<E;){let I=O++,W=c.cca(d,I),q=W??-1;C?(q==110?i+=String.fromCodePoint(10):q==114?i+=String.fromCodePoint(13):q==116?i+=String.fromCodePoint(9):i+=String.fromCodePoint(q),C=!1,y=!1,S=!1):q==92?(C=!0,y=!1,S=!1):q==36?(y?(i+=String.fromCodePoint(q),y=!1):y=!0,S=!1):q==35?(S?(i+=String.fromCodePoint(q),S=!1):S=!0,y=!1):(S&&(i+=String.fromCodePoint(35),S=!1),i+=String.fromCodePoint(q))}S&&(i+=String.fromCodePoint(35)),s+=x;break;case 1:let v=g.expr;if(a=!0,v instanceof ft){let I=v,W=this.resolveAccess(I,I.target,I.name);if(W._hx_index==2){let q=W.pos,P=W.name,R=this.evaluateExpression(v),M=he.getField(this,R,"name"),D=M??P,U=this.valueToString(D);s+=U.length,i+=U==null?"null":""+U}else{let q=this.evaluateExpression(v),P=this.valueToString(q);s+=P.length,i+=P==null?"null":""+P}}else{let I=this.evaluateExpression(v),W=this.valueToString(I);s+=W.length,i+=W==null?"null":""+W}break;case 2:let N=g.closing,B=g.expr,L=this.evaluateString(B).text;n.push(new vi(N,L,s));break}}return{text:i,tags:n}}pluralPipeProcess(e){let t=-1,l=!1,i=null,n=0,s=e.parts.length;for(;n<s;){let r=n++,a=e.parts[r],h=a.partType;switch(h._hx_index){case 0:let o=h.text;if(t>=0&&this.rawTextHasUnescapedPipe(o)){let m,f=e.parts[t].partType;if(f._hx_index==1?m=f.expr:m=null,m!=null){if(!l){let g=[],d=0,x=r;for(;d<x;){let y=d++;g.push(e.parts[y])}i=g,l=!0}this.transformPipeRaw(o,m,a.pos,i);continue}}break;case 1:let u=h.expr;t=r;break;case 2:let p=h.closing,_=h.expr;break}l&&i.push(a)}return l?new Nt(e.id,e.pos,e.quotes,i):e}rawTextHasUnescapedPipe(e){let t=e.length,l=0;for(;l<t;){let i=c.cca(e,l),n=i??-1;if(n==92){l+=2;continue}if(n==124)return!0;++l}return!1}transformPipeRaw(e,t,l,i){let n=e.length,s=0,r=0;for(;s<n;){let a=c.cca(e,s),h=a??-1;if(h==92&&s+1<n){s+=2;continue}if(h==40){let o=-1,u=-1,p=s+1;for(;p<n;){let _=c.cca(e,p),m=_??-1;if(m==92&&p+1<n){p+=2;continue}if(m==124&&o==-1)o=p;else if(m==41){u=p;break}++p}if(o!=-1&&u!=-1&&o>s+1&&u>o+1){let _=s+1,m=o-s-1,f=m!=null?c.substr(e,_,m):c.substr(e,_,null),g=o+1,d=u-o-1,x=d!=null?c.substr(e,g,d):c.substr(e,g,null);if(s>r){let y=s-r;i.push(new Ge(Ae.UNDEFINED,l,ze.Raw(y!=null?c.substr(e,r,y):c.substr(e,r,null))))}i.push(new Ge(Ae.UNDEFINED,l,ze.Expr(this.makePluralCall(t,f,x,l)))),s=u+1,r=s;continue}}if(h==124){let o=s;for(;o>r;){let d=c.cca(e,o-1),x=d??-1;if(x==32||x==9||x==10||x==124||x==40||x==41)break;--o}let u=s+1;for(;u<n;){let d=c.cca(e,u),x=d??-1;if(x==32||x==9||x==10||x==124||x==40||x==41)break;++u}let p=s-o,_=p!=null?c.substr(e,o,p):c.substr(e,o,null),m=s+1,f=u-s-1,g=f!=null?c.substr(e,m,f):c.substr(e,m,null);if(_.length>0&&g.length>0){if(o>r){let d=o-r;i.push(new Ge(Ae.UNDEFINED,l,ze.Raw(d!=null?c.substr(e,r,d):c.substr(e,r,null))))}i.push(new Ge(Ae.UNDEFINED,l,ze.Expr(this.makePluralCall(t,_,g,l)))),s=u,r=s;continue}}++s}if(r<n){let a=n-r;i.push(new Ge(Ae.UNDEFINED,l,ze.Raw(a!=null?c.substr(e,r,a):c.substr(e,r,null))))}}makePluralCall(e,t,l,i){let n=new ft(Ae.UNDEFINED,i,null,"plural"),s=new Nt(Ae.UNDEFINED,i,1,[new Ge(Ae.UNDEFINED,i,ze.Raw(t))]),r=new Nt(Ae.UNDEFINED,i,1,[new Ge(Ae.UNDEFINED,i,ze.Raw(l))]);return new Jt(Ae.UNDEFINED,i,n,[e,s,r])}stripStringIndent(e){if(e.indexOf(`
27
+ `,t);s==-1&&(s=this.length);let r=this.input,a=s!=null?r.substring(t,s):r.substring(t),h=He.ltrim(a);if(h.length>0&&(!h.startsWith("//")||h.startsWith("//<END>"))&&!h.startsWith("/*")){let o=a.length-h.length;return h.startsWith("//<END>")&&i==0&&n>0?n-i:o-i}h.length>0&&n==-1&&(n=a.length-h.length),t=s+1}return i==0&&n>0?n-i:0}followsWithIf(e){let t=e;for(;t<this.length;){let l=c.cca(this.input,t),i=l??-1;if(i==32||i==9||i==10||i==13){++t;continue}if(i==47&&t+1<this.length){let r=c.cca(this.input,t+1),a=r??-1;if(a==47){for(t+=2;;){let h,o;if(t<this.length){let u=c.cca(this.input,t);o=(u??-1)!=13}else o=!1;if(o){let u=c.cca(this.input,t);h=(u??-1)!=10}else h=!1;if(!h)break;++t}continue}if(a==42){for(t+=2;t+1<this.length;){let h,o=c.cca(this.input,t);if((o??-1)==42){let u=c.cca(this.input,t+1);h=(u??-1)==47}else h=!1;if(h){t+=2;break}++t}continue}}let n,s;if(t+1<this.length){let r=c.cca(this.input,t);s=(r??-1)==105}else s=!1;if(s){let r=c.cca(this.input,t+1);n=(r??-1)==102}else n=!1;if(n){let r;if(t+2<this.length){let a=c.cca(this.input,t+2);r=!this.isAlphaNumeric(a??-1)}else r=!0;if(r)return!0}return!1}return!1}endsWithControlKeyword(e,t){let l=He.rtrim(e);if(l.length==0)return!1;let i=0,n=ti.CONTROL_KEYWORDS;for(;i<n.length;){let s=n[i];if(++i,l.endsWith(s)){let r=e.length-l.length,a=l.length-s.length,h;if(a!=0){let p=c.cca(l,a-1);h=!this.isAlphaNumeric(p??-1)}else h=!0;let o=t,u;if(o<this.length)if(r<=0){let p=c.cca(this.input,o);u=!this.isAlphaNumeric(p??-1)}else u=!0;else u=!1;if(h&&u&&(s!="else"||!this.followsWithIf(t)))return!0}}return!1}endsWithArrayIndexable(e){let t=e.length;if(t==0)return!1;let l=t-1;for(;l>=0;){let s=c.cca(e,l),r=s??-1;if(!this.isWhitespace(r))break;--l}if(l<0)return!1;let i=c.cca(e,l),n=i??-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=c.cca(this.input,e),l=t??-1;if(!(l>=97&&l<=122||l>=65&&l<=90||l==95))return!1;let i=e;for(++e;;){let h;if(e<this.length){let o=c.cca(this.input,e),u=o??-1;h=u>=97&&u<=122||u>=65&&u<=90||u==95||u>=48&&u<=57}else h=!1;if(!h)break;++e}for(;;){let h;if(e<this.length){let o=c.cca(this.input,e);h=this.isWhitespace(o??-1)}else h=!1;if(!h)break;++e}let n;if(e<this.length){let h=c.cca(this.input,e);n=(h??-1)!=58}else n=!0;if(n)return!1;let s=this.input,r=e-i;return(r!=null?c.substr(s,i,r):c.substr(s,i,null))!="case"}skipWhitespaceAndComments(e){let t=e,l=!1;for(;e<this.length;){for(;;){let i;if(e<this.length){let n,s,r=c.cca(this.input,e);if((r??-1)!=32){let a=c.cca(this.input,e);s=(a??-1)==9}else s=!0;if(s)n=!0;else{let a=c.cca(this.input,e);n=(a??-1)==10}if(n)i=!0;else{let a=c.cca(this.input,e);i=(a??-1)==13}}else i=!1;if(!i)break;++e,l=!0}if(e<this.length-1){let i=c.cca(this.input,e);if((i??-1)==47){let n=c.cca(this.input,e+1);if((n??-1)==47)return e=t,e;{let s=c.cca(this.input,e+1);if((s??-1)==42){e+=2,l=!0;let r=!1;for(;e<this.length-1;){let a,h=c.cca(this.input,e);if((h??-1)==42){let o=c.cca(this.input,e+1);a=(o??-1)==47}else a=!1;if(a){e+=2,r=!0;break}++e}if(!r)return e=t,e;continue}}}}break}return l?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 l=this.lineOutput.b;if(this.lineOutput=new gt,this.inStatementsBlock()||this.inObjectBlock()||this.inArrayBlock()){let i=this.nextLineIndentOffset(l,this.index);if(He.trim(l).length!=0)if(i>0&&!this.endsOrFollowsWithChar(l,123,this.index,{fileName:"src/loreline/CodeToLorscript.hx",lineNumber:1061,className:"loreline.CodeToLorscript",methodName:"_add"})&&!this.endsOrFollowsWithChar(l,91,this.index,{fileName:"src/loreline/CodeToLorscript.hx",lineNumber:1061,className:"loreline.CodeToLorscript",methodName:"_add"})){let n=He.ltrim(l);n.startsWith("case ")||n.startsWith("case ")||n=="default"||n.startsWith("default ")||n.startsWith("default ")?(this.stack.push(4),this.indentLevel+=i,this.indentStack.push(this.indentLevel),this.currentPosOffset++,this.output.b+=String.fromCodePoint(58),this.posOffsets.push(this.currentPosOffset)):(this.stack.push(3),this.indentLevel+=i,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(i<0&&this.stack.length>0&&(this.stack[this.stack.length-1]==3||this.stack[this.stack.length-1]==4)){!this.inObjectBlock()&&!this.endsOrFollowsWithChar(l,59,this.index,{fileName:"src/loreline/CodeToLorscript.hx",lineNumber:1090,className:"loreline.CodeToLorscript",methodName:"_add"})&&(this.currentPosOffset++,this.output.b+=String.fromCodePoint(59),this.posOffsets.push(this.currentPosOffset)),this.indentLevel+=i;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 i==0&&!this.endsOrFollowsWithChar(l,59,this.index,{fileName:"src/loreline/CodeToLorscript.hx",lineNumber:1115,className:"loreline.CodeToLorscript",methodName:"_add"})&&!this.endsOrFollowsWithChar(l,44,this.index,{fileName:"src/loreline/CodeToLorscript.hx",lineNumber:1115,className:"loreline.CodeToLorscript",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 l=this.stack.pop();l!=5&&l!=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 l=this.stack.pop();l!=2&&l!=0&&this.error("Unexpected: }")}this.lineOutput.b+=String.fromCodePoint(e),this.output.b+=String.fromCodePoint(e),this.posOffsets.push(this.currentPosOffset)}}error(e){throw C.thrown(new st(e,ue.fromContentAndIndex(this.input,this.index)))}}Q["loreline.CodeToLorscript"]=ti,ti.__name__="loreline.CodeToLorscript",Object.assign(ti.prototype,{__class__:ti});class Nl{static equal(e,t,l){return t==l?!0:he.isArray(t)?he.isArray(l)?Nl.arrayEqual(e,t,l):!1:t instanceof Ee?l instanceof Ee?Nl.stringMapEqual(e,t,l):!1:t instanceof Kl?l instanceof Kl?Nl.intMapEqual(e,t,l):!1:oe.isFields(t)&&oe.isFields(l)?Nl.objectFieldsEqual(e,t,l):!1}static objectFieldsEqual(e,t,l){let i=0,n=oe.getFields(e,t);for(;i<n.length;){let a=n[i];if(++i,!oe.fieldExists(e,l,a)||!Nl.equal(e,oe.getField(e,t,a),oe.getField(e,l,a)))return!1}let s=0,r=oe.getFields(e,l);for(;s<r.length;){let a=r[s];if(++s,!oe.fieldExists(e,t,a))return!1}return!0}static arrayEqual(e,t,l){let i=he.arrayLength(t),n=he.arrayLength(l);if(i!=n)return!1;let s=0,r=i;for(;s<r;){let a=s++;if(!Nl.equal(e,he.arrayGet(t,a),he.arrayGet(l,a)))return!1}return!0}static stringMapEqual(e,t,l){let i=t.h,n=i,s=Object.keys(i),r=s.length,a=0;for(;a<r;){let m=s[a++],f=m,g=n[m],d=f,w=g;if(!Object.prototype.hasOwnProperty.call(l.h,d)||!Nl.equal(e,l.h[d],w))return!1}let h=l.h,o=h,u=Object.keys(h),p=u.length,_=0;for(;_<p;){let m=u[_++];if(!Object.prototype.hasOwnProperty.call(t.h,m))return!1}return!0}static intMapEqual(e,t,l){let i=t,n=i,s=i.keys();for(;s.hasNext();){let a=s.next(),h=n.get(a),u=a,p=h;if(!l.h.hasOwnProperty(u)||!Nl.equal(e,l.h[u],p))return!1}let r=l.keys();for(;r.hasNext();){let a=r.next();if(!t.h.hasOwnProperty(a))return!1}return!0}}Q["loreline.Equal"]=Nl,Nl.__name__="loreline.Equal";class st{constructor(e,t){this.message=e,this.pos=t,this.stack=Tn.callStack()}toString(){return this.pos!=null?""+this.message+" at "+this.pos.toString():this.message}}Q["loreline.Error"]=st,st.__name__="loreline.Error",Object.assign(st.prototype,{__class__:st});class Ml{}Q["loreline.Fields"]=Xl.loreline.Fields=Ml,Ml.__name__="loreline.Fields",Ml.__isInterface__=!0,Object.assign(Ml.prototype,{__class__:Ml});class qi{constructor(e){this._random=null,this.interpreter=e}bindAll(e){e.h.floor=be(this,this.floor),e.h.ceil=be(this,this.ceil),e.h.round=be(this,this.round),e.h.abs=be(this,this.abs),e.h.min=be(this,this.min),e.h.max=be(this,this.max),e.h.clamp=be(this,this.clamp),e.h.pow=be(this,this.pow),e.h.random=be(this,this.random),e.h.chance=be(this,this.chance),e.h.seed_random=be(this,this.seed_random),e.h.random_float=be(this,this.random_float),e.h.wait=be(this,this.wait),e.h.float=be(this,this.float_),e.h.string=be(this,this.string_),e.h.bool=be(this,this.bool),e.h.string_length=be(this,this.string_length),e.h.string_upper=be(this,this.string_upper),e.h.string_lower=be(this,this.string_lower),e.h.string_contains=be(this,this.string_contains),e.h.string_replace=be(this,this.string_replace),e.h.string_split=be(this,this.string_split),e.h.string_trim=be(this,this.string_trim),e.h.string_index=be(this,this.string_index),e.h.string_sub=be(this,this.string_sub),e.h.string_starts=be(this,this.string_starts),e.h.string_ends=be(this,this.string_ends),e.h.string_repeat=be(this,this.string_repeat),e.h.plural=be(this,this.plural),e.h.array_length=be(this,this.array_length),e.h.array_add=be(this,this.array_add),e.h.array_pop=be(this,this.array_pop),e.h.array_prepend=be(this,this.array_prepend),e.h.array_shift=be(this,this.array_shift),e.h.array_remove=be(this,this.array_remove),e.h.array_index=be(this,this.array_index),e.h.array_has=be(this,this.array_has),e.h.array_sort=be(this,this.array_sort),e.h.array_reverse=be(this,this.array_reverse),e.h.array_join=be(this,this.array_join),e.h.array_pick=be(this,this.array_pick),e.h.array_shuffle=be(this,this.array_shuffle),e.h.array_copy=be(this,this.array_copy),e.h.map_length=be(this,this.map_length),e.h.map_keys=be(this,this.map_keys),e.h.map_has=be(this,this.map_has),e.h.map_get=be(this,this.map_get),e.h.map_set=be(this,this.map_set),e.h.map_remove=be(this,this.map_remove),e.h.map_copy=be(this,this.map_copy),e.h.current_beat=be(this,this.current_beat),e.h.has_beat=be(this,this.has_beat),e.h.beat_visits=be(this,this.beat_visits),e.h.choices=be(this,this.choices),e.h.choices_disabled=be(this,this.choices_disabled),e.h.choices_all=be(this,this.choices_all)}rng(){this._random==null&&(this._random=new wi);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,l){return Math.max(t,Math.min(l,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 wi(e),null}random_float(e,t){return e+this.rng()*(t-e)}wait(e){return new oi(function(t){fi.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":Y.string(e)}bool(e){return typeof e=="boolean"?e:typeof e=="string"?e.length>0:he.isArray(e)?he.arrayLength(e)>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,l){return He.replace(e,t,l)}string_split(e,t){return e.split(t)}string_trim(e){return He.trim(e)}string_index(e,t){return e.indexOf(t)}string_sub(e,t,l){return c.substr(e,t|0,l|0)}string_starts(e,t){return e.startsWith(t)}string_ends(e,t){return e.endsWith(t)}string_repeat(e,t){let l="",i=0;for(;i<t;)l+=e==null?"null":""+e,++i;return l}plural(e,t,l){let i=0;return typeof e=="number"&&(e|0)===e?i=e*1:typeof e=="number"&&(i=e),i==1?t:l}array_length(e){return he.isArray(e)?he.arrayLength(e):0}array_add(e,t){return he.arrayPush(e,t),null}array_pop(e){return he.isArray(e)?he.arrayPop(e):null}array_prepend(e,t){return he.isArray(e)&&he.arrayInsert(e,0,t),null}array_shift(e){return he.isArray(e)?he.arrayShift(e):null}array_remove(e,t){if(he.isArray(e)){let l=he.arrayLength(e),i=0,n=l;for(;i<n;){let s=i++;if(he.arrayGet(e,s)==t)return he.arrayRemoveAt(e,s),!0}}return!1}array_index(e,t){if(he.isArray(e)){let l=he.arrayLength(e),i=0,n=l;for(;i<n;){let s=i++;if(he.arrayGet(e,s)==t)return s}}return-1}array_has(e,t){if(he.isArray(e)){let l=he.arrayLength(e),i=0,n=l;for(;i<n;){let s=i++;if(he.arrayGet(e,s)==t)return!0}}return!1}array_sort(e){return he.isArray(e)&&he.arraySort(e,function(t,l){return typeof t=="number"&&typeof l=="number"||typeof t=="number"&&(t|0)===t&&typeof l=="number"&&(l|0)===l?t<l?-1:t>l?1:0:(t==null?"null":Y.string(t))<(l==null?"null":Y.string(l))?-1:(t==null?"null":Y.string(t))>(l==null?"null":Y.string(l))?1:0}),e}array_reverse(e){return he.isArray(e)&&he.arrayReverse(e),e}array_join(e,t){return he.isArray(e)?he.arrayJoin(e,t):""}array_pick(e){if(he.isArray(e)){let t=he.arrayLength(e);if(t==0)return null;let l=Math.floor(this.rng()*t);return he.arrayGet(e,l)}return null}array_shuffle(e){if(he.isArray(e)){let t=he.arrayLength(e)-1;for(;t>0;){let l=Math.floor(this.rng()*(t+1)),i=he.arrayGet(e,t);he.arraySet(e,t,he.arrayGet(e,l)),he.arraySet(e,l,i),--t}}return e}array_copy(e){return he.isArray(e)?he.arrayCopy(e):e}map_length(e){return oe.getFields(this.interpreter,e).length}map_keys(e){let t=oe.getFields(this.interpreter,e);return t.sort(function(l,i){return l<i?-1:l>i?1:0}),t}map_has(e,t){return oe.fieldExists(this.interpreter,e,t)}map_get(e,t){return oe.getField(this.interpreter,e,t)}map_set(e,t,l){return oe.setField(this.interpreter,e,t,l),null}map_remove(e,t){return oe.fieldExists(this.interpreter,e,t)?oe.removeField(this.interpreter,e,t):!1}map_copy(e){let t=oe.getFields(this.interpreter,e),l=oe.createFields(this.interpreter),i=0;for(;i<t.length;){let n=t[i];++i,oe.setField(this.interpreter,l,n,oe.getField(this.interpreter,e,n))}return l}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,l=this.interpreter.stack.length-1;for(;l>=0;){let i=this.interpreter.stack[l];if(i.beat!=null&&i.beat.body!=null){let n=0,s=i.beat.body;for(;n<s.length;){let r=s[n];if(++n,r instanceof Me&&r.name==t)return!0}}--l}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 l=this.interpreter.stack[t];if(l.beat!=null)return this.interpreter.getBeatVisitCount(l.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,l=[],i=0,n=e.length;for(;i<n;){let s=i++;t[s]&&l.push(e[s])}return l}choices_disabled(){let e=this.interpreter._choiceEvalTexts,t=this.interpreter._choiceEvalEnabled,l=[],i=0,n=e.length;for(;i<n;){let s=i++;t[s]||l.push(e[s])}return l}choices_all(){let e=this.interpreter._choiceEvalTexts,t=[],l=0,i=e.length;for(;l<i;){let n=l++;t.push(e[n])}return t}}Q["loreline.Functions"]=qi,qi.__name__="loreline.Functions",Object.assign(qi.prototype,{__class__:qi});class Wi{constructor(e){this.finished=e}}Q["loreline._Imports.ImportsLoopInfo"]=Wi,Wi.__name__="loreline._Imports.ImportsLoopInfo",Object.assign(Wi.prototype,{__class__:Wi});class zi{constructor(){this.ext=".lor",this.pendingImports=0,this.hasErrors=!1,this.done=null,this.resolvedImports=null,this.autoAddExtension=!0}resolve(e,t,l,i,n){this.rootPath=e,this.tokens=t,this.handleFile=l,this.handleError=i,this.done=n,this.hasErrors=!1,this.pendingImports=0;let s;if(e==null)s=!1;else{let u=e.length;if(u<8)s=!1;else{let p,_,m,f,g,d,w=c.cca(e,u-8);if((w??-1)==46){let y=c.cca(e,u-7),S=y??-1;d=S==108||S==76}else d=!1;if(d){let y=c.cca(e,u-6),S=y??-1;g=S==111||S==79}else g=!1;if(g){let y=c.cca(e,u-5),S=y??-1;f=S==114||S==82}else f=!1;if(f){let y=c.cca(e,u-4);m=(y??-1)==46}else m=!1;if(m){let y=c.cca(e,u-3),S=y??-1;_=S==116||S==84}else _=!1;if(_){let y=c.cca(e,u-2),S=y??-1;p=S==120||S==88}else p=!1;if(p){let y=c.cca(e,u-1),S=y??-1;s=S==116||S==84}else s=!1}}this.ext=s?".lor.txt":".lor";let r=new Ee,a=[],h=new Ee,o=De.directory(e);this.extractImports(o,t,a,h),this.processImports(a,h,r)}processImports(e,t,l){let i=new Wi(!1);for(;e.length>0;){let n=e.shift();this.handleItemInLoop(n,i,e,t,l)}i.finished=!0,this.pendingImports==0&&this.done!=null&&(this.resolvedImports=l,this.done(this.hasErrors,l),this.done=null)}handleItemInLoop(e,t,l,i,n){let s=this;this.handleFile(e,function(r){if(s.pendingImports--,r!=null)try{let a=new kt(r),h=a.tokenize(),o=a.getErrors();o!=null&&o.length>0&&s.handleError(o[0]),n.h[e]=h,s.extractImports(De.directory(e),h,l,i),t.finished&&s.processImports(l,i,n)}catch(a){let h=C.caught(a).unwrap();if(s.hasErrors=!0,h instanceof st)s.handleError(h);else throw C.thrown(h)}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,l,i){let n=0,s=t.length;for(;n<s-1;){if(t[n].type==k.KwImport){let r=t[n+1].type;if(r._hx_index==15){let a=r.quotes,h=r.attachments,o=r.s,u=o;De.isAbsolute(o)||(u=De.join([e,u])),u=De.normalize(u);let p,_;if(u==null)_=!1;else{let m=u.length;if(m<8)_=!1;else{let f,g,d,w,y,S,T=c.cca(u,m-8);if((T??-1)==46){let O=c.cca(u,m-7),E=O??-1;S=E==108||E==76}else S=!1;if(S){let O=c.cca(u,m-6),E=O??-1;y=E==111||E==79}else y=!1;if(y){let O=c.cca(u,m-5),E=O??-1;w=E==114||E==82}else w=!1;if(w){let O=c.cca(u,m-4);d=(O??-1)==46}else d=!1;if(d){let O=c.cca(u,m-3),E=O??-1;g=E==116||E==84}else g=!1;if(g){let O=c.cca(u,m-2),E=O??-1;f=E==120||E==88}else f=!1;if(f){let O=c.cca(u,m-1),E=O??-1;_=E==116||E==84}else _=!1}}if(_)p=!0;else if(u==null)p=!1;else{let m=u.length;if(m<4)p=!1;else{let f,g,d=c.cca(u,m-4);if((d??-1)==46){let w=c.cca(u,m-3),y=w??-1;g=y==108||y==76}else g=!1;if(g){let w=c.cca(u,m-2),y=w??-1;f=y==111||y==79}else f=!1;if(f){let w=c.cca(u,m-1),y=w??-1;p=y==114||y==82}else p=!1}}p||(u+=this.ext),Object.prototype.hasOwnProperty.call(i.h,u)||(this.pendingImports++,i.h[u]=!0,l.push(u))}}++n}}static sameLetterCi(e,t){return e!=t?e==t-32:!0}static endsWithLorTxt(e){if(e==null)return!1;let t=e.length;if(t<8)return!1;let l,i,n,s,r,a,h=c.cca(e,t-8);if((h??-1)==46){let o=c.cca(e,t-7),u=o??-1;a=u==108||u==76}else a=!1;if(a){let o=c.cca(e,t-6),u=o??-1;r=u==111||u==79}else r=!1;if(r){let o=c.cca(e,t-5),u=o??-1;s=u==114||u==82}else s=!1;if(s){let o=c.cca(e,t-4);n=(o??-1)==46}else n=!1;if(n){let o=c.cca(e,t-3),u=o??-1;i=u==116||u==84}else i=!1;if(i){let o=c.cca(e,t-2),u=o??-1;l=u==120||u==88}else l=!1;if(l){let o=c.cca(e,t-1),u=o??-1;return u!=116?u==84:!0}else return!1}static endsWithLor(e){if(e==null)return!1;let t=e.length;if(t<4)return!1;let l,i,n=c.cca(e,t-4);if((n??-1)==46){let s=c.cca(e,t-3),r=s??-1;i=r==108||r==76}else i=!1;if(i){let s=c.cca(e,t-2),r=s??-1;l=r==111||r==79}else l=!1;if(l){let s=c.cca(e,t-1),r=s??-1;return r!=114?r==82:!0}else return!1}static lorExtension(e){let t;if(e==null)t=!1;else{let l=e.length;if(l<8)t=!1;else{let i,n,s,r,a,h,o=c.cca(e,l-8);if((o??-1)==46){let u=c.cca(e,l-7),p=u??-1;h=p==108||p==76}else h=!1;if(h){let u=c.cca(e,l-6),p=u??-1;a=p==111||p==79}else a=!1;if(a){let u=c.cca(e,l-5),p=u??-1;r=p==114||p==82}else r=!1;if(r){let u=c.cca(e,l-4);s=(u??-1)==46}else s=!1;if(s){let u=c.cca(e,l-3),p=u??-1;n=p==116||p==84}else n=!1;if(n){let u=c.cca(e,l-2),p=u??-1;i=p==120||p==88}else i=!1;if(i){let u=c.cca(e,l-1),p=u??-1;t=p==116||p==84}else t=!1}}return t?".lor.txt":".lor"}static isLorFilePath(e){let t;if(e==null)t=!1;else{let l=e.length;if(l<8)t=!1;else{let i,n,s,r,a,h,o=c.cca(e,l-8);if((o??-1)==46){let u=c.cca(e,l-7),p=u??-1;h=p==108||p==76}else h=!1;if(h){let u=c.cca(e,l-6),p=u??-1;a=p==111||p==79}else a=!1;if(a){let u=c.cca(e,l-5),p=u??-1;r=p==114||p==82}else r=!1;if(r){let u=c.cca(e,l-4);s=(u??-1)==46}else s=!1;if(s){let u=c.cca(e,l-3),p=u??-1;n=p==116||p==84}else n=!1;if(n){let u=c.cca(e,l-2),p=u??-1;i=p==120||p==88}else i=!1;if(i){let u=c.cca(e,l-1),p=u??-1;t=p==116||p==84}else t=!1}}if(t)return!0;if(e==null)return!1;{let l=e.length;if(l<4)return!1;{let i,n,s=c.cca(e,l-4);if((s??-1)==46){let r=c.cca(e,l-3),a=r??-1;n=a==108||a==76}else n=!1;if(n){let r=c.cca(e,l-2),a=r??-1;i=a==111||a==79}else i=!1;if(i){let r=c.cca(e,l-1),a=r??-1;return a!=114?a==82:!0}else return!1}}}static stripLorExtension(e){if(e==null)return null;let t;if(e==null)t=!1;else{let i=e.length;if(i<8)t=!1;else{let n,s,r,a,h,o,u=c.cca(e,i-8);if((u??-1)==46){let p=c.cca(e,i-7),_=p??-1;o=_==108||_==76}else o=!1;if(o){let p=c.cca(e,i-6),_=p??-1;h=_==111||_==79}else h=!1;if(h){let p=c.cca(e,i-5),_=p??-1;a=_==114||_==82}else a=!1;if(a){let p=c.cca(e,i-4);r=(p??-1)==46}else r=!1;if(r){let p=c.cca(e,i-3),_=p??-1;s=_==116||_==84}else s=!1;if(s){let p=c.cca(e,i-2),_=p??-1;n=_==120||_==88}else n=!1;if(n){let p=c.cca(e,i-1),_=p??-1;t=_==116||_==84}else t=!1}}if(t){let i=e.length-8;return i!=null?c.substr(e,0,i):c.substr(e,0,null)}let l;if(e==null)l=!1;else{let i=e.length;if(i<4)l=!1;else{let n,s,r=c.cca(e,i-4);if((r??-1)==46){let a=c.cca(e,i-3),h=a??-1;s=h==108||h==76}else s=!1;if(s){let a=c.cca(e,i-2),h=a??-1;n=h==111||h==79}else n=!1;if(n){let a=c.cca(e,i-1),h=a??-1;l=h==114||h==82}else l=!1}}if(l){let i=e.length-4;return i!=null?c.substr(e,0,i):c.substr(e,0,null)}return e}}Q["loreline.Imports"]=zi,zi.__name__="loreline.Imports",Object.assign(zi.prototype,{__class__:zi});class El{constructor(){this.mask=0,this.size=0,this._values=null,this._keys2=null,this._keys1=null;let e=this._keys1,t=this._keys2,l=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 i=0,n=e.length;for(;i<n;){let s=i++;l[s]!=null&&this._set(e[s],t[s],l[s])}}}resize(e){let t=this._keys1,l=this._keys2,i=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++;i[r]!=null&&this._set(t[r],l[r],i[r])}}}hashCoords(e,t){let l=e+(t<<16);return l=(l^l>>>16)*-2048144789,l=(l^l>>>13)*-1028477387,l^l>>>16}clear(){this._keys1=null,this._keys2=null,this._values=null;let e=this._keys1,t=this._keys2,l=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 i=0,n=e.length;for(;i<n;){let s=i++;l[s]!=null&&this._set(e[s],t[s],l[s])}}this.size=0}copy(){let e=new El,t=this._keys1,l=new Array(t.length);pn.blit(t,0,l,0,t.length),e._keys1=l;let i=this._keys2,n=new Array(i.length);pn.blit(i,0,n,0,i.length),e._keys2=n;let s=this._values,r=new Array(s.length);return pn.blit(s,0,r,0,s.length),e._values=r,e.size=this.size,e.mask=this.mask,e}_set(e,t,l){if(this.size>=(this.mask+1)*.75){let r=this.mask+1<<1,a=this._keys1,h=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,a!=null){this.size=0;let u=0,p=a.length;for(;u<p;){let _=u++;o[_]!=null&&this._set(a[_],h[_],o[_])}}}let i=e+(t<<16);i=(i^i>>>16)*-2048144789,i=(i^i>>>13)*-1028477387;let s=(i^i>>>16)&this.mask;for(;;){if(this._values[s]==null){this._keys1[s]=e,this._keys2[s]=t,this._values[s]=l,this.size++;return}if(this._keys1[s]==e&&this._keys2[s]==t){this._values[s]=l;return}s=s+1&this.mask}}_get(e,t){let l=e+(t<<16);l=(l^l>>>16)*-2048144789,l=(l^l>>>13)*-1028477387;let n=(l^l>>>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 l=e+(t<<16);l=(l^l>>>16)*-2048144789,l=(l^l>>>13)*-1028477387;let n=(l^l>>>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 l=e+(t<<16);l=(l^l>>>16)*-2048144789,l=(l^l>>>13)*-1028477387;let n=(l^l>>>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],a=this._values[n];this._values[n]=null,this.size--,this._set(s,r,a),n=n+1&this.mask}return!0}n=n+1&this.mask}}iterator(){return new ji(this)}keyIterator(){return new Ki(this)}keyValueIterator(){return new Ji(this)}length(){return this.size}}Q["loreline.Int64Map"]=El,El.__name__="loreline.Int64Map",Object.assign(El.prototype,{__class__:El});class ji{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}}Q["loreline._Int64Map.Int64MapIterator"]=ji,ji.__name__="loreline._Int64Map.Int64MapIterator",Object.assign(ji.prototype,{__class__:ji});class Ki{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}}}Q["loreline._Int64Map.Int64MapKeyIterator"]=Ki,Ki.__name__="loreline._Int64Map.Int64MapKeyIterator",Object.assign(Ki.prototype,{__class__:Ki});class Ji{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],l=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:l}}}Q["loreline._Int64Map.Int64MapKeyValueIterator"]=Ji,Ji.__name__="loreline._Int64Map.Int64MapKeyValueIterator",Object.assign(Ji.prototype,{__class__:Ji});class Fl{constructor(e,t,l,i){this.scope=-1,l!=null?this.fields=l:this.clear(e,t),i!=null?this.originalFields=i:this.createOriginalFields()}clear(e,t){this.fields=oe.createFields(e,null,t)}createOriginalFields(){this.originalFields=oe.createFields()}}Q["loreline.RuntimeState"]=Fl,Fl.__name__="loreline.RuntimeState",Object.assign(Fl.prototype,{__class__:Fl});class di extends Fl{constructor(e,t,l,i){super(e,t,l,i)}}Q["loreline.RuntimeCharacter"]=di,di.__name__="loreline.RuntimeCharacter",di.__super__=Fl,Object.assign(di.prototype,{__class__:di});var fl=Ye["loreline.RuntimeAccess"]={__ename__:"loreline.RuntimeAccess",__constructs__:null,FieldAccess:(x=function(b,e,t){return{_hx_index:0,pos:b,obj:e,name:t,__enum__:"loreline.RuntimeAccess",toString:F}},x._hx_name="FieldAccess",x.__params__=["pos","obj","name"],x),ArrayAccess:(x=function(b,e,t){return{_hx_index:1,pos:b,array:e,index:t,__enum__:"loreline.RuntimeAccess",toString:F}},x._hx_name="ArrayAccess",x.__params__=["pos","array","index"],x),CharacterAccess:(x=function(b,e){return{_hx_index:2,pos:b,name:e,__enum__:"loreline.RuntimeAccess",toString:F}},x._hx_name="CharacterAccess",x.__params__=["pos","name"],x),FunctionAccess:(x=function(b,e){return{_hx_index:3,pos:b,name:e,__enum__:"loreline.RuntimeAccess",toString:F}},x._hx_name="FunctionAccess",x.__params__=["pos","name"],x),BeatAccess:(x=function(b,e){return{_hx_index:4,pos:b,beat:e,__enum__:"loreline.RuntimeAccess",toString:F}},x._hx_name="BeatAccess",x.__params__=["pos","beat"],x)};fl.__constructs__=[fl.FieldAccess,fl.ArrayAccess,fl.CharacterAccess,fl.FunctionAccess,fl.BeatAccess];class xi{constructor(e,t,l,i,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=l,i!=null&&(this.beats=i),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,l=this.beats.length;for(;t<l;){let i=t++,n=this.beats[i];if(n.name==e)return n}return null}}Q["loreline.RuntimeScope"]=xi,xi.__name__="loreline.RuntimeScope",Object.assign(xi.prototype,{__class__:xi});class Si{constructor(e,t){this.parentNextOptionIndex=0,this.parentPartialOptions=null,this.stack=[],this.options=null,this.id=e,this.origin=t}}Q["loreline.RuntimeInsertion"]=Si,Si.__name__="loreline.RuntimeInsertion",Object.assign(Si.prototype,{__class__:Si});class vi{constructor(e,t,l){this.closing=e,this.value=t,this.offset=l}}Q["loreline.TextTag"]=vi,vi.__name__="loreline.TextTag",Object.assign(vi.prototype,{__class__:vi});class Oi{constructor(e,t,l,i,n){this.text=e,this.tags=t,this.enabled=l,this.node=i,this.insertion=n}}Q["loreline.ChoiceOption"]=Oi,Oi.__name__="loreline.ChoiceOption",Object.assign(Oi.prototype,{__class__:Oi});class ge extends st{constructor(e,t){super(e,t)}}Q["loreline.RuntimeError"]=ge,ge.__name__="loreline.RuntimeError",ge.__super__=st,Object.assign(ge.prototype,{__class__:ge});class Hi{constructor(){this.cb=null,this.sync=!0}}Q["loreline.EvalNext"]=Hi,Hi.__name__="loreline.EvalNext",Object.assign(Hi.prototype,{__class__:Hi});class Pi{constructor(e,t,l,i,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 li,this.topLevelBeats=new Ee,this.topLevelCharacters=new Ee,this.script=e,this.handleDialogue=t,this.handleChoice=l,this.handleFinish=i,this.lens=new Ii(e);let s=n!=null?n.strictAccess:null;this.strictAccess=s!=null&&s,this.translations=n!=null?n.translations:null,this.topLevelState=new Fl(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 a=r.next();switch(te.getClass(a)){case Me:this.initializeTopLevelBeat(a);break;case jt:this.initializeTopLevelCharacter(a);break;case ql:this.initializeTopLevelFunction(a);break;case $t:this.initializeTopLevelState(a);break;default:}}this.inferImplicitCharactersFromRootBeat()}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}}inferImplicitCharactersFromRootBeat(){let e=0,t=this.lens.getNodesOfType(Me);for(;e<t.length;){let l=t[e];if(++e,l.name!="_")continue;let i=0,n=this.lens.getDialogueSpeakers(l);for(;i<n.length;){let s=n[i];++i,!Object.prototype.hasOwnProperty.call(this.topLevelCharacters.h,s)&&(oe.fieldExists(this,this.topLevelState.fields,s)||this.initializeTopLevelCharacter(new jt(Ae.UNDEFINED,l.pos,s,l.pos,[])))}}}start(e){let t=null;if(e!=null){if(t=this.topLevelBeats.h[e],t==null)throw C.thrown(new ge("Beat "+e+" not found",this.script.pos))}else{let l=0,i=this.script.body;for(;l<i.length;){let n=i[l];if(++l,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 C.thrown(new ge("No beats found in script",this.script.pos))}this.transitionToBeat(t),this.flush()}save(){let e={},t=[],l=0,i=this.stack;for(;l<i.length;){let s=i[l];++l,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,a=this.pendingChoiceOptions;for(;r<a.length;){let h=a[r];++r,s.push(this.serializeChoiceOption(h,e))}n.pendingChoiceOptions=s}if(this._choiceEvalTexts.length>0){let s=[],r=0,a=this._choiceEvalTexts.length;for(;r<a;){let h=r++,o={text:this._choiceEvalTexts[h]};this._choiceEvalEnabled[h]||(o.disabled=!0),s.push(o)}n.choiceEvalContext=s}return qe.fields(e).length>0&&(n.insertions=e),n}restore(e){if(e.version!=1)throw C.thrown(new ge("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 Kl;if(this.restoreStack(e.stack,e.insertions,t)||(this.beatToResume=this.restoreBeatToResume(e.stack)),e.pendingChoiceOptions!=null){this.pendingChoiceOptions=[];let l=0,i=e.pendingChoiceOptions;for(;l<i.length;){let n=i[l];++l;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 l=0,i=e.choiceEvalContext;for(;l<i.length;){let n=i[l];++l,this._choiceEvalTexts.push(n.text),this._choiceEvalEnabled.push(n.disabled!=!0)}}}resume(){if(this.stack.length==0){this.start();return}let e=this.wrapNext(be(this,this.finish));this.finishTrigger=e,this.resumeNode(this.stack[0].node,0,e.cb),e.sync=!1,this.flush()}resumeFromLevel(e,t){let l=this.wrapNext(t);this.resumeNode(this.stack[e].node,e,l.cb),l.sync=!1}getCharacter(e){let t=this.topLevelCharacters.h[e];return t!=null?t.fields:null}getCharacterField(e,t){let l=this.topLevelCharacters.h[e],i=l!=null?l.fields:null;return i!=null?oe.getField(this,i,t):null}setCharacterField(e,t,l){let i=this.topLevelCharacters.h[e].fields;oe.setField(this,i,t,l)}getStateField(e){let t=this.stack.length-1;for(;t>=0;){let l=this.stack[t];if(l.state!=null&&oe.fieldExists(this,l.state.fields,e))return oe.getField(this,l.state.fields,e);if(l.node!=null){let i=l.node.id.thisVal,n=this.nodeStates.map._get(i.high,i.low);if(n!=null&&oe.fieldExists(this,n.fields,e))return oe.getField(this,n.fields,e)}--t}return oe.fieldExists(this,this.topLevelState.fields,e)?oe.getField(this,this.topLevelState.fields,e):null}setStateField(e,t){let l=this.stack.length-1;for(;l>=0;){let i=this.stack[l];if(i.state!=null&&oe.fieldExists(this,i.state.fields,e)){oe.setField(this,i.state.fields,e,t);return}if(i.node!=null){let n=i.node.id.thisVal,s=this.nodeStates.map._get(n.high,n.low);if(s!=null&&oe.fieldExists(this,s.fields,e)){oe.setField(this,s.fields,e,t);return}}--l}oe.setField(this,this.topLevelState.fields,e,t)}getTopLevelStateField(e){return oe.getField(this,this.topLevelState.fields,e)}setTopLevelStateField(e,t){oe.setField(this,this.topLevelState.fields,e,t)}currentNode(){let e=this.get_currentScope();return e==null?null:e.head!=null?e.head:e.node}currentNodeFilePath(e){let t=this.currentNode();return t==null||e==null?e:this.lens.getNodeFilePath(t,e)}serializeScope(e,t){let l={id:e.id};if(e.beat!=null&&(l.beat=this.serializeBeatReference(e.beat)),e.node!=null&&(l.node=this.serializeNodeReference(e.node)),e.state!=null&&(l.state=this.serializeState(e.state)),e.beats!=null){let i=[],n=0,s=e.beats;for(;n<s.length;){let r=s[n];++n,i.push(this.serializeBeatReference(r))}l.beats=i}return e.head!=null&&(l.head=this.serializeNodeReference(e.head)),e.insertion!=null&&(l.insertion=this.serializeInsertion(e.insertion,t)),l}serializeInsertion(e,t){let l=e.id==null?"null":""+e.id,i=qe.field(t,l);if(i==null){if(i={},t[l]=i,e.options!=null){let n=[],s=0,r=e.options;for(;s<r.length;){let a=r[s];++s,n.push(this.serializeChoiceOption(a,t))}i.options=n}if(e.origin!=null&&(i.origin=this.serializeNodeReference(e.origin)),e.stack!=null){let n=[],s=0,r=e.stack;for(;s<r.length;){let a=r[s];++s,n.push(this.serializeScope(a,t))}i.stack=n}if(e.parentPartialOptions!=null){let n=[],s=0,r=e.parentPartialOptions;for(;s<r.length;){let a=r[s];++s,n.push(this.serializeChoiceOption(a,t))}i.parentPartialOptions=n,i.parentNextOptionIndex=e.parentNextOptionIndex}}return e.id}serializeChoiceOption(e,t){let l={text:e.text};if(e.enabled||(l.disabled=!0),e.tags!=null){let i=[],n=0,s=e.tags;for(;n<s.length;){let r=s[n];++n,i.push(this.serializeTextTag(r))}l.tags=i}return e.node!=null&&(l.node=this.serializeNodeReference(e.node)),e.insertion!=null&&(l.insertion=this.serializeInsertion(e.insertion,t)),l}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,l=t,i=Object.keys(t),n=i.length,s=0;for(;s<n;){let r=i[s++],a=r,h=l[r],o=a,u=h,p=this.serializeCharacter(u);qe.fields(p.fields).length>0&&(e[o]=p)}return e}serializeNodeStates(){let e={},t=this.nodeStates.map,l=0;for(;l<t._values.length&&t._values[l]==null;)++l;for(;l<t._values.length;){let i=t._keys1[l],n=t._keys2[l],s=t._values[l];for(++l;l<t._values.length&&t._values[l]==null;)++l;let r=Ae.fromTwoInt32(i,n),a=s,h=r,o=a,u=this.serializeState(o);qe.fields(u.fields).length>0&&(e[h.toString()]=u)}return e}serializeBeatReference(e){let t=e.name,l=e;do l=this.lens.getFirstParentOfType(l,Me),l!=null&&(t=l.name+"."+t);while(l!=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 l=null,i={};if(te.__implements(e,Ml)){let n=te.getClass(e);n!=null&&(l=n.__name__);let s=e,r=0,a=s.lorelineFields(this);for(;r<a.length;){let h=a[r];++r,i[h]=this.serializeValue(s.lorelineGet(this,h))}}else if(e instanceof Ee){let n=e,s=n.h,r=s,a=Object.keys(s),h=a.length,o=0;for(;o<h;){let u=a[o++],p=n.h[u];(t==null||!oe.fieldExists(this,t,u)||!Nl.equal(this,oe.getField(this,t,u),p))&&(i[u]=this.serializeValue(p))}}else{let n=te.getClass(e);n!=null&&(l=n.__name__);let s=0,r=qe.fields(e);for(;s<r.length;){let a=r[s];++s;let h=qe.getProperty(e,a);(t==null||!oe.fieldExists(this,t,a)||!Nl.equal(this,oe.getField(this,t,a),h))&&(i[a]=this.serializeValue(h))}}return l!=null?{type:l,fields:i}:{fields:i}}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(he.isArray(e)){let t=[],l=he.arrayLength(e),i=0,n=l;for(;i<n;){let s=i++;t.push(this.serializeValue(he.arrayGet(e,s)))}return t}return this.serializeFields(e)}resumeNode(e,t,l){let i=this.stack.length-1;if(t>=this.stack.length)switch(te.getClass(e)){case Hl:this.evalAlternative(e,l);break;case Jt:if(!this.isBeatCall(e))this.evalCall(e,l);else{let r=te.getClass(e);throw C.thrown(new ge("Resume execution not supported from last node: "+r.__name__,e.pos))}break;case xl:this.evalChoice(e,l);break;case Kt:this.evalDialogue(e,l);break;case ll:this.evalText(e,l);break;default:let s=te.getClass(e);throw C.thrown(new ge("Resume execution not supported from last node: "+s.__name__,e.pos))}else switch(te.getClass(e)){case Hl:this.resumeAlternative(e,t,l);break;case Me:this.resumeBeatRun(e,t,l);break;case Jt:if(this.isBeatCall(e,t))this.resumeCall(e,t,l);else{let r=te.getClass(e);throw C.thrown(new ge("Resume execution not supported from node within stack: "+r.__name__,e.pos))}break;case St:this.resumeChoiceOption(e,t,l);break;case xl:this.resumeChoice(e,t,l);break;case wl:this.resumeIf(e,t,l);break;default:let s=te.getClass(e);throw C.thrown(new ge("Resume execution not supported from node within stack: "+s.__name__,e.pos))}}resumeNodeBody(e,t,l,i){let n=this.stack[t],s=0,r=-1;if(n.head==null&&t<this.stack.length-1)throw C.thrown(new ge("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=l.indexOf(n.head),r=s,s==-1))throw C.thrown(new ge("Failed to resolve head in scope when resuming through body",e.pos));let a=this.get_currentInsertion(),h=null,o=this;h=function(){if((a!=null?a.options:null)!=null)o.pop(),i();else if(s!=-1&&s==r){let u=l[s];s+=1;let p=o.wrapNext(h);o.resumeNode(u,t+1,p.cb),p.sync=!1}else if(s<l.length){let u=l[s];n.head=u,s+=1;let p=o.wrapNext(h);o.evalNode(u,p.cb),p.sync=!1}else o.pop(),i()},h()}resumeBeatRun(e,t,l){this.resumeNodeBody(e,t,e.body,l)}resumeChoiceOption(e,t,l){this.resumeNodeBody(e,t,e.body,l)}resumeChoice(e,t,l){let i=this.stack[t],n=this;if(i.head==null)this.evalChoice(e,l);else if(i.head instanceof St){let s=i.head;t+1<this.stack.length?this.resumeNodeBody(s,t+1,s.body,l):this.evalNodeBody(i.beat,s,s.body,null,l)}else if(i.insertion!=null){let s=i.node,r=i.insertion;if(s instanceof Me){let a=s;this.resumeNodeBody(a,t,a.body,function(){let h=r.parentPartialOptions!=null?r.parentPartialOptions:[];if(r.options!=null){let _=0,m=r.options;for(;_<m.length;){let f=m[_];++_,h.push(f)}}let o=r.parentNextOptionIndex,u=i.beat,p=n.wrapNext(function(){n.presentChoice(e,h,l)});n.evalChoiceOptionsAndInsertions(u,e,h,p.cb,o,!0),p.sync=!1})}else{for(;this.stack.length>t;)this.pop();this.evalChoice(e,l)}}else if(i.node instanceof St){let s=i.node;this.resumeNodeBody(s,t,s.body,l)}else if(i.node instanceof Me){let s=i.node;this.resumeNodeBody(s,t,s.body,l)}else throw C.thrown(new ge("Choice head is not a choice option",i.head.pos))}resumeIf(e,t,l){let i=this.stack[t];if(i.head==null)throw C.thrown(new ge("Failed to resolve head in scope when resuming through condition",e.pos));let s=e.thenBranch.body.indexOf(i.head)!=-1?e.thenBranch:e.elseBranch;if(s!=null&&s.body.length>0)this.resumeNodeBody(s,t,s.body,l);else throw C.thrown(new ge("Failed to resume condition: invalid scope",e.pos))}resumeAlternative(e,t,l){let i=this.stack[t];if(i.head==null)throw C.thrown(new ge("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(i.head)!=-1){this.resumeNodeBody(r,t,r.body,l);return}}throw C.thrown(new ge("Failed to resume alternative: head not found in any item",e.pos))}resumeCall(e,t,l){if(e.target instanceof ft){let i=e.target;if(i.target==null){let n=i.name,s=null,r=this.stack.length-1;for(;r>=0;){let h=this.stack[r].beatByName(n);if(h!=null){s=h;break}--r}if(s==null&&Object.prototype.hasOwnProperty.call(this.topLevelBeats.h,n)&&(s=this.topLevelBeats.h[n]),s!=null){this.resumeBeatRun(s,t,l);return}}}throw C.thrown(new ge("Cannot resume through a function call that is not at the bottom of the stack",e.pos))}restoreStack(e,t,l){let i=[];l==null&&(l=new Kl);let n=e.length-1;for(;n>=0;){let s=this.restoreScopeItem(e[n],t,l);if(s==null)return!1;i.push(s),--n}for(n=i.length-1;n>=0;)this.push(i[n]),--n;return!0}restoreScopeItem(e,t,l){let i=this.restoreBeat(e.beat);if(i==null)return null;let n=Ae.fromString(e.beat.id),s=e.node,r=s!=null?this.restoreNode(s,n,i):null;if(s!=null&&r==null)return null;let a=[];if(e.beats!=null){let m=0,f=e.beats;for(;m<f.length;){let g=f[m];++m;let d=this.restoreBeat(g);if(d==null)return null;a.push(d)}}let o=e.state!=null?this.restoreState(null,e.state):null,u=e.head,p=u!=null?this.restoreNode(u,n,i):null;if(u!=null&&p==null)return null;let _=null;return e.insertion!=null&&t!=null&&(_=this.restoreInsertion(e.insertion,t,l)),new xi(null,i,r,a,o,p,_)}restoreInsertion(e,t,l){if(l.h.hasOwnProperty(e))return l.h[e];let i=e==null?"null":""+e,n=qe.field(t,i);if(n==null)return null;let s=null;if(n.origin!=null){let a=Ae.fromString(n.origin.id),h=this.lens.getNodeById(a);h!=null&&h.type()==n.origin.type&&(s=h)}let r=new Si(e,s);if(l.h[e]=r,e>=this.nextInsertionId&&(this.nextInsertionId=e+1),n.options!=null){r.options=[];let a=0,h=n.options;for(;a<h.length;){let o=h[a];++a;let u=this.restoreChoiceOption(o,t,l);u!=null&&r.options.push(u)}}if(n.stack!=null){r.stack=[];let a=0,h=n.stack;for(;a<h.length;){let o=h[a];++a;let u=this.restoreScopeItem(o,t,l);u!=null&&r.stack.push(u)}}if(n.parentPartialOptions!=null){r.parentPartialOptions=[];let a=0,h=n.parentPartialOptions;for(;a<h.length;){let o=h[a];++a;let u=this.restoreChoiceOption(o,t,l);u!=null&&r.parentPartialOptions.push(u)}r.parentNextOptionIndex=n.parentNextOptionIndex!=null?n.parentNextOptionIndex:0}return r}restoreChoiceOption(e,t,l){let i=null;if(e.node!=null){let r=Ae.fromString(e.node.id),a=this.lens.getNodeById(r);a!=null&&a.type()==e.node.type&&(i=a)}let n=null;if(e.tags!=null){let r=[],a=0,h=e.tags;for(;a<h.length;){let o=h[a];++a,r.push(new vi(o.closing==!0,o.value,o.offset))}n=r}let s=null;return e.insertion!=null&&t!=null&&(s=this.restoreInsertion(e.insertion,t,l)),new Oi(e.text,n,e.disabled!=!0,i,s)}restoreBeatToResume(e){let t=null;if(e.length>0){let l=e[0];if(t=this.restoreBeat(l.beat),t!=null){let i=t;do i=this.lens.getFirstParentOfType(i,Me),i!=null&&(t=i);while(i!=null)}}return t}restoreNode(e,t,l){let i=l.id.thisVal.high>>16&65535,n=t.thisVal.high>>16&65535,s=(i>=32768?i-65536:i)+32768-((n>=32768?n-65536:n)+32768),r=Ae.fromString(e.id);if(r==t)return l;let a=r.thisVal.high>>16&65535,o=(a>=32768?a-65536:a)+32768+s-32768;o<0&&(o=o+65536&65535),r.thisVal=new jl(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 l=e!=null?e.fields:null,i=this.restoreFields(l??null,t);return e==null&&(e=new Fl(this,null,i,null)),e}restoreCharacters(e){let t=0,l=qe.fields(e);for(;t<l.length;){let i=l[t];++t;let n=qe.field(e,i);if(Object.prototype.hasOwnProperty.call(this.topLevelCharacters.h,i))this.restoreCharacter(this.topLevelCharacters.h[i],n);else{let s=this.restoreCharacter(null,n);this.topLevelCharacters.h[i]=s}}}restoreNodeStates(e){let t=0,l=qe.fields(e);for(;t<l.length;){let i=l[t];++t;let n=Ae.fromString(i),s=qe.field(e,i),r=this.restoreState(null,s),a=n.thisVal;this.nodeStates.map._set(a.high,a.low,r)}}restoreCharacter(e,t){let l=e!=null?e.fields:null,i=this.restoreFields(l??null,t);return e==null&&(e=new di(this,null,i,null)),e}restoreFields(e,t){if(t==null||t.fields==null)return e;e==null&&(e=oe.createFields(this,t.type));let l=t.fields;if(oe.isFields(e)){let i=0,n=qe.fields(l);for(;i<n.length;){let s=n[i];++i,oe.setField(this,e,s,this.restoreValue(qe.field(l,s)))}}else{let i=0,n=qe.fields(l);for(;i<n.length;){let s=n[i];++i,e[s]=this.restoreValue(qe.field(l,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(he.isArray(e)){let t=he.arrayLength(e),l=he.createArray(),i=0,n=t;for(;i<n;){let s=i++;he.arrayPush(l,this.restoreValue(he.arrayGet(e,s)))}return l}return this.restoreFields(null,e)}initializeTopLevelFunctions(e){if(this.builtins=new qi(this),this.builtins.bindAll(this.topLevelFunctions),e!=null){let r=e,a=r,h=qe.fields(r),o=0;for(;o<h.length;){let u=h[o++],p=a[u],m=u,f=p;this.registerTopLevelFunction(m,f)}}let t=this.topLevelFunctions.h,l=t,i=Object.keys(t),n=i.length,s=0;for(;s<n;){let r=i[s++],a=r,h=l[r],o=a,u=h;o.startsWith("string_")?this.stringHelpers.h[c.substr(o,7,null)]=u:o.startsWith("array_")?this.arrayHelpers.h[c.substr(o,6,null)]=u:o.startsWith("map_")?this.mapHelpers.h[c.substr(o,4,null)]=u:o.startsWith("beat_")&&(this.beatHelpers.h[c.substr(o,5,null)]=u)}}registerTopLevelFunction(e,t){let l=t,i=this,n=this.topLevelFunctions,s=qe.makeVarArgs(function(r){return l.apply(null,[i,r])});n.h[e]=s}initializeStringLiteralProcessors(e){let t=this;if(this.stringLiteralProcessors.push(function(l){return t.pluralPipeProcess(l)}),e!=null){let l=0;for(;l<e.length;){let i=e[l];++l,this.stringLiteralProcessors.push(i)}}}initializeTopLevelFunction(e){if(e.name!=null){if(!e.external||!Object.prototype.hasOwnProperty.call(this.topLevelFunctions.h,e.name)){let t=new ti;try{let l=t.process(e.code+(e.external?" {}":"")),i=new ci;i.allowJSON=!0,i.allowTypes=!0;let n=i.parseString(l),r=new nn(this).execute(n);this.topLevelFunctions.h[e.name]=r}catch(l){let i=C.caught(l).unwrap();throw C.thrown(new ge("Failed to parse function code: "+(i==null?"null":Y.string(i)),e.pos))}}}else throw C.thrown(new ge("Top level function must have a name",e.pos))}wrapNext(e){let t=new Hi;t.sync=!0;let l=this;return t.cb=function(){t.sync?(l.syncCallbacks==null&&(l.syncCallbacks=[]),l.syncCallbacks.push(t.cb)):(e(),l.flush(),t.cb=null,l.finishTrigger==t&&l.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 l=this.syncCallbacks.length-1;for(;l>=0;)t.unshift(this.syncCallbacks[l]),--l}this.syncCallbacks=t}}catch(e){let t=C.caught(e).unwrap();throw this.flushing=!1,C.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 C.thrown(new ge("Top level temporary states are not allowed",e.pos));let t=0,l=e.fields;for(;t<l.length;){let i=l[t];++t;let n=this.evaluateExpression(i.value);oe.setField(this,this.topLevelState.fields,i.name,n),this.isOriginalScriptExpression(i.value)&&oe.setField(this,this.topLevelState.originalFields,i.name,n)}}initializeTopLevelBeat(e){if(Object.prototype.hasOwnProperty.call(this.topLevelBeats.h,e.name))throw C.thrown(new ge("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 C.thrown(new ge("Duplicate top level character: "+e.name,e.pos));let t=new di(this,e,null,null);this.topLevelCharacters.h[e.name]=t;let l=0,i=e.fields;for(;l<i.length;){let n=i[l];++l;let s=this.evaluateExpression(n.value);oe.setField(this,t.fields,n.name,s),this.isOriginalScriptExpression(n.value)&&oe.setField(this,t.originalFields,n.name,s)}}initializeState(e,t){let l=null;if(e.temporary)t.state==null&&(t.state=new Fl(this,e,null,null)),l=t.state;else{let s=t.node.id.thisVal;if(l=this.nodeStates.map._get(s.high,s.low),l==null){l=new Fl(this,e,null,null);let r=t.node.id.thisVal;this.nodeStates.map._set(r.high,r.low,l)}}let i=0,n=e.fields;for(;i<n.length;){let s=n[i];if(++i,!oe.fieldExists(this,l.fields,s.name)){let r=this.evaluateExpression(s.value);oe.setField(this,l.fields,s.name,r),!e.temporary&&this.isOriginalScriptExpression(s.value)&&oe.setField(this,l.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(be(this,this.finish));this.finishTrigger=t,this.evalBeatRun(e,t.cb),t.sync=!1}evalNode(e,t){switch(te.getClass(e)){case Hl:this.evalAlternative(e,t);break;case kl:this.evalAssignment(e,t);break;case Me:this.evalBeatDecl(e,t);break;case Jt:this.evalCall(e,t);break;case St:this.evalChoiceOption(e,t);break;case xl:this.evalChoice(e,t);break;case Kt:this.evalDialogue(e,t);break;case wl:this.evalIf(e,t);break;case $t:this.evalStateDecl(e,t);break;case ll:this.evalText(e,t);break;case Dl:this.evalTransition(e);break;default:let l=te.getClass(e);throw C.thrown(new ge("Unsupported node type: "+l.__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 C.thrown(new ge("Duplicate beat with name: "+e.name,e.pos));this.get_currentScope().beats.push(e),t()}evalNodeBody(e,t,l,i,n){this.push(new xi(null,e,t,null,null,null,i));let s=0,r=null,a=this.get_currentInsertion(),h=this;r=function(){if((a!=null?a.options:null)!=null)h.pop(),n();else if(s<l.length){let o=l[s];h.get_currentScope().head=o,s+=1;let u=h.wrapNext(r);h.evalNode(o,u.cb),u.sync=!1}else h.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 l=this.getTranslatedString(e,e.content),i=this.evaluateString(l);this.handleDialogue(this,null,i.text,i.tags,t)}evalDialogue(e,t){if(e.condition!=null&&!this.evaluateCondition(e.condition)){t();return}let l=this.getTranslatedString(e,e.content),i=this.evaluateString(l);this.handleDialogue(this,e.character,i.text,i.tags,t)}evalChoice(e,t){let l=this.pendingChoiceOptions;if(l!=null){this.pendingChoiceOptions=null,this._choiceEvalTexts.length=0,this._choiceEvalEnabled.length=0;let r=0;for(;r<l.length;){let a=l[r];++r,this._choiceEvalTexts.push(a.text),this._choiceEvalEnabled.push(a.enabled)}this.presentChoice(e,l,t);return}let i=[],n=this,s=this.wrapNext(function(){n.presentChoice(e,i,t)});this.evalChoiceOptionsAndInsertions(this.get_currentScope().beat,e,i,s.cb,null,this.get_currentInsertion()==null),s.sync=!1}presentChoice(e,t,l){let i=this.get_currentInsertion();if(i!=null&&i.options==null){i.stack=[].concat(this.stack),i.options=t,l();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,a=this,h=function(){a._choiceEvalTexts.length=0,a._choiceEvalEnabled.length=0},o=this.wrapNext(function(){if(a.pendingChoiceOptions=null,r>=0&&r<t.length){let u=t[r];u.node.once&&a.setChoiceOptionChosen(u.node);let p=function(){h(),l()};if(u.insertion!=null){let _=a.stack.length;for(;a.stack.length>0;)a.stack.pop();let m=0,f=u.insertion.stack;for(;m<f.length;){let d=f[m];++m,d.insertion!=null&&(d.insertion=null),a.stack.push(d)}let g=a.stack[a.stack.length-1];a.push(new xi(null,g.beat,a.lens.getParentNode(u.node),null,null,u.node,null)),a.resumeFromLevel(_,p)}else a.evalChoiceOption(u.node,p)}else h(),l()});this.handleChoice(this,t,function(u){r=u,o.cb()}),o.sync=!1}evalChoiceOptionsAndInsertions(e,t,l,i,n,s){s==null&&(s=!0);let r=t.options;if(s){this._choiceEvalTexts.length=0,this._choiceEvalEnabled.length=0;let p=0;for(;p<l.length;){let _=l[p];++p,this._choiceEvalTexts.push(_.text),this._choiceEvalEnabled.push(_.enabled)}}let a=n??0,h=null,o=null,u=this;h=function(){if(o!=null&&o.options!=null){let p=0,_=o.options.length;for(;p<_;){let m=p++,f=o.options[m];l.push(f),s&&(u._choiceEvalTexts.push(f.text),u._choiceEvalEnabled.push(f.enabled))}o=null}if(a<r.length){let p=r[a];a+=1;let m=!(p.once&&u.isChoiceOptionChosen(p))&&(p.condition==null||u.evaluateCondition(p.condition));if(p.text!=null){let f=u.wrapNext(h),g=u.getTranslatedString(p,p.text),d=u.evaluateString(g);l.push(new Oi(d.text,d.tags,m,p,u.get_currentInsertion())),s&&(u._choiceEvalTexts.push(d.text),u._choiceEvalEnabled.push(m)),f.cb(),f.sync=!1}else if(p.insertion!=null){let f=u.wrapNext(h);m?(o=new Si(u.nextInsertionId++,p.insertion),o.parentPartialOptions=[].concat(l),o.parentNextOptionIndex=a,u.evalInsertion(o,f.cb)):f.cb(),f.sync=!1}else throw C.thrown(new ge("Invalid choice option",p.pos))}else i()},h()}evalInsertion(e,t){let l=e.origin.target,i=null,n=this.stack.length-1;for(;n>=0;){let r=this.stack[n].beatByName(l);if(r!=null){i=r;break}--n}if(i==null&&Object.prototype.hasOwnProperty.call(this.topLevelBeats.h,l)&&(i=this.topLevelBeats.h[l]),i==null)throw C.thrown(new ge("Beat "+l+" not found",this.script.pos));this.evalNodeBody(i,i,i.body,e,t)}evalChoiceOption(e,t){this.evalNodeBody(this.get_currentScope().beat,e,e.body,null,t)}evalIf(e,t){let i=this.evaluateCondition(e.condition)?e.thenBranch:e.elseBranch;i!=null&&i.body.length>0?this.evalNodeBody(this.get_currentScope().beat,i,i.body,null,t):t()}evalAlternative(e,t){if(e.items.length==0){t();return}switch(e.mode){case 0:let l=this.getAlternativeVisitCount(e),i=l<e.items.length?l:e.items.length-1;this.setAlternativeVisitCount(e,l+1);let n=e.items[i];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 a=e.items[r];this.evalNodeBody(this.get_currentScope().beat,a,a.body,null,t);break;case 2:let h=this.getAlternativeVisitCount(e);if(h>=e.items.length){t();return}this.setAlternativeVisitCount(e,h+1);let o=e.items[h];this.evalNodeBody(this.get_currentScope().beat,o,o.body,null,t);break;case 3:let u=this.builtins.random(0,e.items.length-1),p=e.items[u];this.evalNodeBody(this.get_currentScope().beat,p,p.body,null,t);break;case 4:let _=[],m=0,f=e.items.length;for(;m<f;){let w=m++;_.push(w)}let g=_,d=g.length-1;for(;d>0;){let w=this.builtins.random(0,d),y=g[d];g[d]=g[w],g[w]=y,--d}this.evalShuffledItems(e,g,0,t);break}}evalShuffledItems(e,t,l,i){if(l>=t.length){i();return}let n=e.items[t[l]],s=this;this.evalNodeBody(this.get_currentScope().beat,n,n.body,null,function(){s.evalShuffledItems(e,t,l+1,i)})}getBeatVisitCount(e){let t=e.id.thisVal,l=this.nodeStates.map._get(t.high,t.low);if(l==null)return 0;let i=oe.getField(this,l.fields,"_visitCount");return i??0}incrementBeatVisitCount(e){let t=e.id.thisVal,l=this.nodeStates.map._get(t.high,t.low);if(l==null){l=new Fl(this,e,null,null);let s=e.id.thisVal;this.nodeStates.map._set(s.high,s.low,l)}let i=oe.getField(this,l.fields,"_visitCount"),n=i??0;oe.setField(this,l.fields,"_visitCount",n+1)}getAlternativeVisitCount(e){let t=e.id.thisVal,l=this.nodeStates.map._get(t.high,t.low);if(l==null)return 0;let i=oe.getField(this,l.fields,"_visitCount");return i??0}setAlternativeVisitCount(e,t){let l=e.id.thisVal,i=this.nodeStates.map._get(l.high,l.low);if(i==null){i=new Fl(this,e,null,null);let n=e.id.thisVal;this.nodeStates.map._set(n.high,n.low,i)}oe.setField(this,i.fields,"_visitCount",t)}isChoiceOptionChosen(e){let t=e.id.thisVal,l=this.nodeStates.map._get(t.high,t.low);if(l==null)return!1;let i=oe.getField(this,l.fields,"_chosen");return i??!1}setChoiceOptionChosen(e){let t=e.id.thisVal,l=this.nodeStates.map._get(t.high,t.low);if(l==null){l=new Fl(this,e,null,null);let i=e.id.thisVal;this.nodeStates.map._set(i.high,i.low,l)}oe.setField(this,l.fields,"_chosen",!0)}evalAssignment(e,t){let l=this.resolveAssignmentTarget(e.target),i=this.evaluateExpression(e.value),n;switch(e.op._hx_index){case 21:n=this.performOperation(k.OpPlus,this.readAccess(l),i,e.pos);break;case 22:n=this.performOperation(k.OpMinus,this.readAccess(l),i,e.pos);break;case 23:n=this.performOperation(k.OpMultiply,this.readAccess(l),i,e.pos);break;case 24:n=this.performOperation(k.OpDivide,this.readAccess(l),i,e.pos);break;case 20:case 25:n=i;break;default:throw C.thrown(new ge("Invalid assignment operator",e.pos))}this.writeAccess(l,n),t()}isOriginalScriptExpression(e){switch(te.getClass(e)){case il:let t=e;return this.isOriginalScriptExpression(t.left)?this.isOriginalScriptExpression(t.right):!1;case ft:case gl:case Jt:return!1;case je:let l=e,i=l.literalType;switch(i._hx_index){case 0:case 1:case 2:return!0;case 3:let h=l.value,o=0;for(;o<h.length;){let m=h[o];if(++o,m instanceof ct&&!this.isOriginalScriptExpression(m))return!1}return!0;case 4:let u=i.style,p=l.value,_=0;for(;_<p.length;){let m=p[_];if(++_,!this.isOriginalScriptExpression(m.value))return!1}return!0}break;case Mt:let n=e,s=0,r=n.parts;for(;s<r.length;){let h=r[s];++s;let o=h.partType;switch(o._hx_index){case 0:let u=o.text;continue;case 1:let p=o.expr;return!1;case 2:let _=o.closing,m=o.expr;if(!this.isOriginalScriptExpression(m))return!1;break}}return!0;case Yl:let a=e;return this.isOriginalScriptExpression(a.operand)}return!1}isBeatCall(e,t){return t==null&&(t=-1),e instanceof Jt?this.resolveBeatFromCall(e,t)!=null:!1}resolveBeatByName(e,t){t==null&&(t=-1);let l=t==-1?this.stack.length-1:t;for(;l>=0;){let i=this.stack[l].beatByName(e);if(i!=null)return i;--l}return this.topLevelBeats.h[e]}resolveBeatFromCall(e,t){if(t==null&&(t=-1),e.target instanceof ft){let l=e.target;if(l.target==null){let i=this.resolveBeatByName(l.name,t);if(i!=null)return i}}return null}evalCall(e,t){let l=this.resolveBeatFromCall(e);if(l!=null){this.evalBeatRun(l,t);return}this.evaluateFunctionCall(e,t)}evalTransition(e){let t=e.target;if(t=="."){this.finish();return}let l=null,i=this.stack.length-1;for(;i>=0;){let s=this.stack[i].beatByName(t);if(s!=null){l=s;break}--i}if(l==null&&Object.prototype.hasOwnProperty.call(this.topLevelBeats.h,t)&&(l=this.topLevelBeats.h[t]),l==null)throw C.thrown(new ge("Beat "+t+" not found",this.script.pos));this.transitionToBeat(l)}getTranslatedString(e,t){if(this.translations!=null){let l=this.findHashCommentId(e,t);if(l!=null&&this.script.filePath!=null){let i=0,n=this.lens.getNodeAncestorFilePaths(e);for(;i<n.length;){let s=n[i];++i;let r=this.translations.h[s+"#"+l];if(r!=null)return r}}}return t}findHashCommentId(e,t){return et.findHashComment(e,t)}evaluateString(e){let t=0,l=this.stringLiteralProcessors.length;for(;t<l;){let m=t++;e=this.stringLiteralProcessors[m](e)}let i="",n=[],s=0,r=e.parts.length,a=e.quotes!=0,h=e.quotes!=0,o=e.quotes!=0,u=-1;if(!a){let m=r-1;e:for(;m>=0;){let g=e.parts[m].partType;switch(g._hx_index){case 0:let d=g.text;u=m;break e;case 1:let w=g.expr;break e;case 2:let y=g.closing,S=g.expr;--m;break}}}let p=0,_=r;for(;p<_;){let m=p++,g=e.parts[m].partType;switch(g._hx_index){case 0:let d=g.text;a||(d=He.ltrim(d)),m==u&&(d=He.rtrim(d)),o||(d=this.stripStringComments(d)),h||(d=this.stripStringIndent(d));let w=d.length;w>0&&(a=!0);let y=!1,S=!1,T=!1,O=0,E=w;for(;O<E;){let I=O++,q=c.cca(d,I),z=q??-1;T?(z==110?i+=String.fromCodePoint(10):z==114?i+=String.fromCodePoint(13):z==116?i+=String.fromCodePoint(9):i+=String.fromCodePoint(z),T=!1,y=!1,S=!1):z==92?(T=!0,y=!1,S=!1):z==36?(y?(i+=String.fromCodePoint(z),y=!1):y=!0,S=!1):z==35?(S?(i+=String.fromCodePoint(z),S=!1):S=!0,y=!1):(S&&(i+=String.fromCodePoint(35),S=!1),i+=String.fromCodePoint(z))}S&&(i+=String.fromCodePoint(35)),s+=w;break;case 1:let v=g.expr;if(a=!0,v instanceof ft){let I=v,q=this.resolveAccess(I,I.target,I.name);if(q._hx_index==2){let z=q.pos,P=q.name,B=this.evaluateExpression(v),N=oe.getField(this,B,"name"),D=N??P,U=this.valueToString(D);s+=U.length,i+=U==null?"null":""+U}else{let z=this.evaluateExpression(v),P=this.valueToString(z);s+=P.length,i+=P==null?"null":""+P}}else{let I=this.evaluateExpression(v),q=this.valueToString(I);s+=q.length,i+=q==null?"null":""+q}break;case 2:let M=g.closing,A=g.expr,L=this.evaluateString(A).text;n.push(new vi(M,L,s));break}}return{text:i,tags:n}}pluralPipeProcess(e){let t=-1,l=!1,i=null,n=0,s=e.parts.length;for(;n<s;){let r=n++,a=e.parts[r],h=a.partType;switch(h._hx_index){case 0:let o=h.text;if(t>=0&&this.rawTextHasUnescapedPipe(o)){let m,f=e.parts[t].partType;if(f._hx_index==1?m=f.expr:m=null,m!=null){if(!l){let g=[],d=0,w=r;for(;d<w;){let y=d++;g.push(e.parts[y])}i=g,l=!0}this.transformPipeRaw(o,m,a.pos,i);continue}}break;case 1:let u=h.expr;t=r;break;case 2:let p=h.closing,_=h.expr;break}l&&i.push(a)}return l?new Mt(e.id,e.pos,e.quotes,i):e}rawTextHasUnescapedPipe(e){let t=e.length,l=0;for(;l<t;){let i=c.cca(e,l),n=i??-1;if(n==92){l+=2;continue}if(n==124)return!0;++l}return!1}transformPipeRaw(e,t,l,i){let n=e.length,s=0,r=0;for(;s<n;){let a=c.cca(e,s),h=a??-1;if(h==92&&s+1<n){s+=2;continue}if(h==40){let o=-1,u=-1,p=s+1;for(;p<n;){let _=c.cca(e,p),m=_??-1;if(m==92&&p+1<n){p+=2;continue}if(m==124&&o==-1)o=p;else if(m==41){u=p;break}++p}if(o!=-1&&u!=-1&&o>s+1&&u>o+1){let _=s+1,m=o-s-1,f=m!=null?c.substr(e,_,m):c.substr(e,_,null),g=o+1,d=u-o-1,w=d!=null?c.substr(e,g,d):c.substr(e,g,null);if(s>r){let y=s-r;i.push(new Ge(Ae.UNDEFINED,l,ze.Raw(y!=null?c.substr(e,r,y):c.substr(e,r,null))))}i.push(new Ge(Ae.UNDEFINED,l,ze.Expr(this.makePluralCall(t,f,w,l)))),s=u+1,r=s;continue}}if(h==124){let o=s;for(;o>r;){let d=c.cca(e,o-1),w=d??-1;if(w==32||w==9||w==10||w==124||w==40||w==41)break;--o}let u=s+1;for(;u<n;){let d=c.cca(e,u),w=d??-1;if(w==32||w==9||w==10||w==124||w==40||w==41)break;++u}let p=s-o,_=p!=null?c.substr(e,o,p):c.substr(e,o,null),m=s+1,f=u-s-1,g=f!=null?c.substr(e,m,f):c.substr(e,m,null);if(_.length>0&&g.length>0){if(o>r){let d=o-r;i.push(new Ge(Ae.UNDEFINED,l,ze.Raw(d!=null?c.substr(e,r,d):c.substr(e,r,null))))}i.push(new Ge(Ae.UNDEFINED,l,ze.Expr(this.makePluralCall(t,_,g,l)))),s=u,r=s;continue}}++s}if(r<n){let a=n-r;i.push(new Ge(Ae.UNDEFINED,l,ze.Raw(a!=null?c.substr(e,r,a):c.substr(e,r,null))))}}makePluralCall(e,t,l,i){let n=new ft(Ae.UNDEFINED,i,null,"plural"),s=new Mt(Ae.UNDEFINED,i,1,[new Ge(Ae.UNDEFINED,i,ze.Raw(t))]),r=new Mt(Ae.UNDEFINED,i,1,[new Ge(Ae.UNDEFINED,i,ze.Raw(l))]);return new Jt(Ae.UNDEFINED,i,n,[e,s,r])}stripStringIndent(e){if(e.indexOf(`
28
28
  `)==-1)return e;let t=e.split(`
29
29
  `),l=-1;if(t[0].length>0){let s=0;for(;s<t[0].length;){let r=c.cca(t[0],s),a=r??-1;if(a!=32&&a!=9)break;++s}s>0&&s<t[0].length&&(l=s)}let i=1,n=t.length;for(;i<n;){let s=i++,r=t[s];if(r.length==0)continue;let a=0;for(;a<r.length;){let h=c.cca(r,a),o=h??-1;if(o!=32&&o!=9)break;++a}a>0&&(l==-1||a<l)&&(l=a)}if(l>0){let s=1,r=t.length;for(;s<r;){let a=s++;if(t[a].length>0){let h=t[a],o=null;t[a]=o!=null?h.substring(l,o):h.substring(l)}}e=t.join(`
30
- `)}return e}stripStringComments(e){let t="",l=e.length,i=0;for(;i<l;){let n=c.cca(e,i),s=n??-1,r;if(s==47&&i+1<l){let h=c.cca(e,i+1);r=(h??-1)==47}else r=!1;if(r){for(;;){let h;if(i<l){let o=c.cca(e,i);h=(o??-1)!=10}else h=!1;if(!h)break;++i}continue}let a;if(s==47&&i+1<l){let h=c.cca(e,i+1);a=(h??-1)==42}else a=!1;if(a){let h;if(i>0){let u=c.cca(e,i-1);h=(u??-1)==32}else h=!1;for(i+=2;;){let u;if(i+1<l){let p,_=c.cca(e,i);if((_??-1)==42){let m=c.cca(e,i+1);p=(m??-1)==47}else p=!1;u=!p}else u=!1;if(!u)break;++i}i+=2;let o;if(i<l){let u=c.cca(e,i);o=(u??-1)==32}else o=!1;h&&o&&++i,!h&&!o&&i<l&&(t+=String.fromCodePoint(32));continue}t+=String.fromCodePoint(s),++i}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 ft){let n=e.target;if(n.target==null){let s=this.evaluateExpression(e.target);if(s!=null&&We.isFunction(s)){let r=[],a=0,h=e.args;for(;a<h.length;){let u=h[a];++a,r.push(this.evaluateExpression(u))}let o=r;try{let u=s.apply(null,o);if(u!=null&&u instanceof oi){if(t==null)throw T.thrown(new ge("Cannot call async function in expression",e.pos));u.func(t)}else t?.();return u}catch(u){let p=T.caught(u).unwrap();if(p instanceof Se){let _=p;throw T.thrown(new ge("Error when evaluating function ("+_.pmin+"-"+_.pmax+"): "+Y.string(_.e),e.pos))}throw T.thrown(new ge("Error when calling function: "+Y.string(p),e.pos))}}}else{let s=this.evaluateExpression(n.target),r=null;if(typeof s=="string"?r=he.getStringHelper(this,n.name):oe.isArray(s)?r=he.getArrayHelper(this,n.name):s instanceof Me?r=he.getBeatHelper(this,n.name):he.isFields(s)&&(r=he.getMapHelper(this,n.name)),r!=null&&We.isFunction(r)){let a=[],h=0,o=e.args;for(;h<o.length;){let _=o[h];++h,a.push(this.evaluateExpression(_))}let u=a;u.splice(0,0,s);let p=r.apply(null,u);if(p!=null&&p instanceof oi){if(t==null)throw T.thrown(new ge("Cannot call async function in expression",e.pos));p.func(t)}else t?.();return p}else if(r==null&&!(typeof s=="string"||oe.isArray(s)||he.isFields(s))){let a=We.getProperty(s,n.name);if(We.isFunction(a)){let h=[],o=0,u=e.args;for(;o<u.length;){let m=u[o];++o,h.push(this.evaluateExpression(m))}let p=h,_=a.apply(s,p);if(_!=null&&_ instanceof oi){if(t==null)throw T.thrown(new ge("Cannot call async function in expression",e.pos));_.func(t)}else t?.();return _}}}}let l=this.printLoreline(e.target),i;throw l!=null?i=l:i=te.getClass(e.target).__name__,T.thrown(new ge("Invalid call target: "+i,e.pos))}evaluateArrayLiteral(e){let t=[],l=0;for(;l<e.length;){let i=e[l];++l,t.push(this.evaluateExpression(i))}return t}evaluateObjectLiteral(e){let t=new Ee,l=0;for(;l<e.length;){let i=e[l];++l;let n=i.name,s=this.evaluateExpression(i.value);t.h[n]=s}return t}evaluateExpression(e){switch(te.getClass(e)){case ft:let t=e,l=this.resolveAccess(t,t.target,t.name);return this.readAccess(l);case gl:let i=e,n=this.evaluateExpression(i.target),s=this.evaluateExpression(i.index);if(oe.isArray(n)&&(typeof s=="number"&&(s|0)===s||typeof s=="number")){let x=s|0;if(x<0||x>=oe.arrayLength(n))throw T.thrown(new ge("Array index out of bounds: "+x,i.pos));return oe.arrayGet(n,x)}else if(typeof s=="string"){if(n==null)throw T.thrown(new ge("Cannot access field '"+(s==null?"null":Y.string(s))+"' of null",i.pos));return he.getField(this,n,s)}else throw T.thrown(new ge("Invalid array access",i.pos));break;case il:let r=e,a=this.evaluateExpression(r.left),h=this.evaluateExpression(r.right);return this.performOperation(r.op,a,h,r.pos);case Jt:return this.evaluateFunctionCall(e,null);case je: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 x=u.style;return this.evaluateObjectLiteral(o.value)}break;case Nt:let p=e;if(p.parts.length==1&&p.quotes==0){let x=p.parts[0].partType;if(x._hx_index==1){let y=x.expr;return this.evaluateExpression(y)}else return this.evaluateString(p).text}else return this.evaluateString(p).text;break;case ii:let _=e;return this.evaluateCondition(_.condition)?this.evaluateExpression(_.trueExpr):this.evaluateExpression(_.falseExpr);case Yl:let f=e,g=this.evaluateExpression(f.operand);switch(f.op._hx_index){case 27:if(typeof g=="number"&&(g|0)===g)return-g;if(typeof g=="number")return-g;throw T.thrown(new ge("Invalid unary operation",f.pos));break;case 39:if(typeof g=="boolean")return!g;if(typeof g=="string"){let x=g;return x!=null?x.length==0:!0}else if(g instanceof Array){let x=g;return x!=null?x.length==0:!0}else return typeof g=="number"&&(g|0)===g||typeof g=="number"?g==0:g==null;break;default:throw T.thrown(new ge("Invalid unary operation",f.pos))}break;default:let d=te.getClass(e);throw T.thrown(new ge("Unsupported expression type: "+d.__name__,e.pos))}}readAccess(e){switch(e._hx_index){case 0:let t=e.pos,l=e.obj,i=e.name;if(l==null)throw T.thrown(new ge("Cannot read field '"+i+"' of null",t));return he.getField(this,l,i);case 1:let n=e.pos,s=e.array,r=e.index;return oe.arrayGet(s,r);case 2:let a=e.pos,h=e.name;if(Object.prototype.hasOwnProperty.call(this.topLevelCharacters.h,h))return this.topLevelCharacters.h[h].fields;throw T.thrown(new ge("Character not found: "+h,a));case 3:let o=e.pos,u=e.name;if(Object.prototype.hasOwnProperty.call(this.topLevelFunctions.h,u))return this.topLevelFunctions.h[u];throw T.thrown(new ge("Function not found: "+u,o));case 4:let p=e.pos;return e.beat}}writeAccess(e,t){switch(e._hx_index){case 0:let l=e.pos,i=e.obj,n=e.name;if(i==null)throw T.thrown(new ge("Cannot set field '"+n+"' of null",l));he.setField(this,i,n,t);break;case 1:let s=e.pos,r=e.array,a=e.index;oe.arraySet(r,a,t);break;case 2:let h=e.pos,o=e.name;throw T.thrown(new ge("Cannot overwrite character: "+o,h));case 3:let u=e.pos,p=e.name;throw T.thrown(new ge("Cannot overwrite function: "+p,u));case 4:let _=e.pos,m=e.beat;throw T.thrown(new ge("Cannot overwrite beat: "+m.name,_))}}resolveAssignmentTarget(e){switch(te.getClass(e)){case ft:let t=e;return this.resolveAccess(t,t.target,t.name);case gl:let l=e,i=this.evaluateExpression(l.target),n=this.evaluateExpression(l.index);if(oe.isArray(i)&&(typeof n=="number"&&(n|0)===n||typeof n=="number")){let s=n|0;return fl.ArrayAccess(l.pos,i,s)}else if(typeof n=="string"){if(i==null)throw T.thrown(new ge("Cannot access field '"+(n==null?"null":Y.string(n))+"' of null",l.pos));return fl.FieldAccess(l.pos,i,n)}else throw T.thrown(new ge("Invalid array access target",l.pos));break;default:throw T.thrown(new ge("Invalid assignment target",e.pos))}}resolveAccess(e,t,l){if(t!=null){let a=this.evaluateExpression(t);if(a==null){let h=te.getClass(t)==ft?t.name:null;throw T.thrown(new ge(h!=null?"Cannot access field '"+l+"' of undefined variable '"+h+"'":"Cannot access field '"+l+"' of null value",t.pos))}return fl.FieldAccess(t.pos,a,l)}let i=this.stack.length-1;for(;i>=0;){let a=this.stack[i];if(a.state!=null&&he.fieldExists(this,a.state.fields,l)){let h=e!=null?e.pos:null,o;if(h!=null)o=h;else{let u=this.get_currentScope(),p=u!=null?u.node:null;o=p!=null?p.pos:null}return fl.FieldAccess(o??this.script.pos,a.state.fields,l)}if(a.node!=null){let h=a.node.id.thisVal,o=this.nodeStates.map._get(h.high,h.low);if(o!=null&&he.fieldExists(this,o.fields,l)){let u=e!=null?e.pos:null,p;if(u!=null)p=u;else{let _=this.get_currentScope(),m=_!=null?_.node:null;p=m!=null?m.pos:null}return fl.FieldAccess(p??this.script.pos,o.fields,l)}}--i}if(he.fieldExists(this,this.topLevelState.fields,l)){let a=e!=null?e.pos:null,h;if(a!=null)h=a;else{let o=this.get_currentScope(),u=o!=null?o.node:null;h=u!=null?u.pos:null}return fl.FieldAccess(h??this.script.pos,this.topLevelState.fields,l)}if(Object.prototype.hasOwnProperty.call(this.topLevelCharacters.h,l)){let a=e!=null?e.pos:null,h;if(a!=null)h=a;else{let o=this.get_currentScope(),u=o!=null?o.node:null;h=u!=null?u.pos:null}return fl.CharacterAccess(h??this.script.pos,l)}if(Object.prototype.hasOwnProperty.call(this.topLevelFunctions.h,l)){let a=e!=null?e.pos:null,h;if(a!=null)h=a;else{let o=this.get_currentScope(),u=o!=null?o.node:null;h=u!=null?u.pos:null}return fl.FunctionAccess(h??this.script.pos,l)}let n=this.resolveBeatByName(l);if(n!=null){let a=e!=null?e.pos:null,h;if(a!=null)h=a;else{let o=this.get_currentScope(),u=o!=null?o.node:null;h=u!=null?u.pos:null}return fl.BeatAccess(h??this.script.pos,n)}if(!this.strictAccess){let a=e!=null?e.pos:null,h;if(a!=null)h=a;else{let o=this.get_currentScope(),u=o!=null?o.node:null;h=u!=null?u.pos:null}return fl.FieldAccess(h??this.script.pos,this.topLevelState.fields,l)}let s=e!=null?e.pos:null,r;if(s!=null)r=s;else{let a=this.get_currentScope(),h=a!=null?a.node:null;r=h!=null?h.pos:null}throw T.thrown(new ge("Undefined variable: "+l,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,l,i){let n=_e.typeof(t),s=_e.typeof(l);switch(e._hx_index){case 26:switch(n._hx_index){case 1:switch(s._hx_index){case 1:case 2:return parseFloat(Y.string(t))+parseFloat(Y.string(l));case 6:if(s.c==String)return Y.string(t)+Y.string(l);{let g="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(s),d=i,x;if(d!=null)x=d;else{let y=this.get_currentScope(),S=y!=null?y.node:null;x=S!=null?S.pos:null}throw T.thrown(new ge(g,x??this.script.pos))}break;default:let _="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(s),m=i,f;if(m!=null)f=m;else{let g=this.get_currentScope(),d=g!=null?g.node:null;f=d!=null?d.pos:null}throw T.thrown(new ge(_,f??this.script.pos))}break;case 2:switch(s._hx_index){case 1:case 2:return parseFloat(Y.string(t))+parseFloat(Y.string(l));case 6:if(s.c==String)return Y.string(t)+Y.string(l);{let g="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(s),d=i,x;if(d!=null)x=d;else{let y=this.get_currentScope(),S=y!=null?y.node:null;x=S!=null?S.pos:null}throw T.thrown(new ge(g,x??this.script.pos))}break;default:let _="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(s),m=i,f;if(m!=null)f=m;else{let g=this.get_currentScope(),d=g!=null?g.node:null;f=d!=null?d.pos:null}throw T.thrown(new ge(_,f??this.script.pos))}break;case 6:if(n.c==String)return Y.string(t)+Y.string(l);if(s._hx_index==6){if(s.c==String)return Y.string(t)+Y.string(l);{let _="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(s),m=i,f;if(m!=null)f=m;else{let g=this.get_currentScope(),d=g!=null?g.node:null;f=d!=null?d.pos:null}throw T.thrown(new ge(_,f??this.script.pos))}}else{let _="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(s),m=i,f;if(m!=null)f=m;else{let g=this.get_currentScope(),d=g!=null?g.node:null;f=d!=null?d.pos:null}throw T.thrown(new ge(_,f??this.script.pos))}break;default:if(s._hx_index==6){if(s.c==String)return Y.string(t)+Y.string(l);{let _="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(s),m=i,f;if(m!=null)f=m;else{let g=this.get_currentScope(),d=g!=null?g.node:null;f=d!=null?d.pos:null}throw T.thrown(new ge(_,f??this.script.pos))}}else{let _="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(s),m=i,f;if(m!=null)f=m;else{let g=this.get_currentScope(),d=g!=null?g.node:null;f=d!=null?d.pos:null}throw T.thrown(new ge(_,f??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 d=parseFloat(Y.string(t)),x=parseFloat(Y.string(l));switch(e._hx_index){case 27:return d-x;case 28:return d*x;case 29:if(x==0){let E=i,v;if(E!=null)v=E;else{let N=this.get_currentScope(),B=N!=null?N.node:null;v=B!=null?B.pos:null}throw T.thrown(new ge("Division by zero",v??this.script.pos))}return d/x;case 30:if(x==0){let E=i,v;if(E!=null)v=E;else{let N=this.get_currentScope(),B=N!=null?N.node:null;v=B!=null?B.pos:null}throw T.thrown(new ge("Modulo by zero",v??this.script.pos))}return d%x;default:throw T.thrown("Unreachable")}break;default:let y;switch(e._hx_index){case 27:y="subtract";break;case 28:y="multiply";break;case 29:y="divide";break;case 30:y="modulo";break;default:y="perform operation on"}let S="Cannot "+y+" "+this.getTypeName(n)+" and "+this.getTypeName(s),C=i,O;if(C!=null)O=C;else{let E=this.get_currentScope(),v=E!=null?E.node:null;O=v!=null?v.pos:null}throw T.thrown(new ge(S,O??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 m="Cannot "+_+" "+this.getTypeName(n)+" and "+this.getTypeName(s),f=i,g;if(f!=null)g=f;else{let d=this.get_currentScope(),x=d!=null?d.node:null;g=x!=null?x.pos:null}throw T.thrown(new ge(m,g??this.script.pos))}break;case 31:case 32:let r=t instanceof Me&&typeof l=="string"?t.name==l:typeof t=="string"&&l instanceof Me?t==l.name:t instanceof Me&&l instanceof Me?t.name==l.name:t==l;switch(e._hx_index){case 31:return r;case 32:return!r;default:throw T.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(Y.string(t)),d=parseFloat(Y.string(l));switch(e._hx_index){case 33:return g>d;case 34:return g<d;case 35:return g>=d;case 36:return g<=d;default:throw T.thrown("Unreachable")}break;default:let x="Cannot compare "+this.getTypeName(n)+" and "+this.getTypeName(s),y=i,S;if(y!=null)S=y;else{let C=this.get_currentScope(),O=C!=null?C.node:null;S=O!=null?O.pos:null}throw T.thrown(new ge(x,S??this.script.pos))}break;default:let _="Cannot compare "+this.getTypeName(n)+" and "+this.getTypeName(s),m=i,f;if(m!=null)f=m;else{let g=this.get_currentScope(),d=g!=null?g.node:null;f=d!=null?d.pos:null}throw T.thrown(new ge(_,f??this.script.pos))}break;case 37: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?l:!1;case 38:let m=e.word;return t?!0:l;default:throw T.thrown("Unreachable")}else{let _="Cannot perform logical operation on "+this.getTypeName(n)+" and "+this.getTypeName(s),m=i,f;if(m!=null)f=m;else{let g=this.get_currentScope(),d=g!=null?g.node:null;f=d!=null?d.pos:null}throw T.thrown(new ge(_,f??this.script.pos))}else{let _="Cannot perform logical operation on "+this.getTypeName(n)+" and "+this.getTypeName(s),m=i,f;if(m!=null)f=m;else{let g=this.get_currentScope(),d=g!=null?g.node:null;f=d!=null?d.pos:null}throw T.thrown(new ge(_,f??this.script.pos))}break;case 38: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?l:!1;case 38:let m=e.word;return t?!0:l;default:throw T.thrown("Unreachable")}else{let _="Cannot perform logical operation on "+this.getTypeName(n)+" and "+this.getTypeName(s),m=i,f;if(m!=null)f=m;else{let g=this.get_currentScope(),d=g!=null?g.node:null;f=d!=null?d.pos:null}throw T.thrown(new ge(_,f??this.script.pos))}else{let _="Cannot perform logical operation on "+this.getTypeName(n)+" and "+this.getTypeName(s),m=i,f;if(m!=null)f=m;else{let g=this.get_currentScope(),d=g!=null?g.node:null;f=d!=null?d.pos:null}throw T.thrown(new ge(_,f??this.script.pos))}break;default:let o="Invalid operation: "+Y.string(e),u=i,p;if(u!=null)p=u;else{let _=this.get_currentScope(),m=_!=null?_.node:null;p=m!=null?m.pos:null}throw T.thrown(new ge(o,p??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":Y.string(e);t==null&&(t=[]);let l=0;for(;l<t.length;){let i=t[l];if(++l,i==e)return"..."}if(t.push(e),oe.isArray(e)){let i=oe.arrayLength(e),n="";n+="[";let s=0,r=i;for(;s<r;){let a=s++;a>0&&(n+=", "),n+=Y.string(this.valueToStringImpl(oe.arrayGet(e,a),t))}return n+="]",t.pop(),n}if(e instanceof Me)return t.pop(),e.name;if(he.isFields(e)){let i=he.getFields(this,e);i.sort(function(a,h){return a<h?-1:a>h?1:0});let n="";n+="{";let s=0,r=i.length;for(;s<r;){let a=s++;a>0&&(n+=", "),n+=Y.string(i[a]),n+=": ",n+=Y.string(this.valueToStringImpl(he.getField(this,e,i[a]),t))}return n+="}",t.pop(),n}return t.pop(),e==null?"null":Y.string(e)}printLoreline(e){try{let t=new Wl;return t.enableComments=!1,He.trim(t.print(e))}catch{return null}}}Q["loreline.Interpreter"]=Xl.loreline.Interpreter=Pi,Pi.__name__="loreline.Interpreter",Object.assign(Pi.prototype,{__class__:Pi,__properties__:{get_currentInsertion:"get_currentInsertion",get_currentScope:"get_currentScope"}});class kn{static stringify(e,t){return t==null&&(t=!1),JSON.stringify(e,null,t?" ":null)}static parse(e){return JSON.parse(e)}}Q["loreline.Json"]=kn,kn.__name__="loreline.Json";class A{static scriptFromJson(e){if(e==null)throw T.thrown("Cannot create Script from null JSON");let t=e.type;if(t!="Script")throw T.thrown("Expected Script node, got: "+t);let l=A.idFromJson(e),i=A.positionFromJson(e.pos),n=e.body,s=[],r=0;for(;r<n.length;){let o=n[r];++r,s.push(A.nodeFromJson(o))}let a=s,h=new nl(l,i,a);return h.indentSize=e.indentSize!=null?e.indentSize:2,e.filePath!=null&&(h.filePath=e.filePath),A.applyComments(h,e),h}static nodeFromJson(e){if(e==null)return null;let t=e.type;switch(t){case"Access":return A.accessFromJson(e);case"Alternative":return A.alternativeFromJson(e);case"ArrayAccess":return A.arrayAccessFromJson(e);case"Assign":return A.assignFromJson(e);case"Beat":return A.beatFromJson(e);case"Binary":return A.binaryFromJson(e);case"Block":return A.blockFromJson(e);case"Call":return A.callFromJson(e);case"Character":return A.characterFromJson(e);case"Choice":return A.choiceStatementFromJson(e);case"Comment":return A.commentFromJson(e);case"Dialogue":return A.dialogueStatementFromJson(e);case"Field":return A.objectFieldFromJson(e);case"Function":return A.functionDeclFromJson(e);case"If":return A.ifStatementFromJson(e);case"Import":return A.importStatementFromJson(e);case"Insertion":return A.insertionFromJson(e);case"Literal":return A.literalFromJson(e);case"Option":return A.choiceOptionFromJson(e);case"Part":return A.stringPartFromJson(e);case"Script":return A.scriptFromJson(e);case"State":return A.stateFromJson(e);case"String":return A.stringLiteralFromJson(e);case"Ternary":return A.ternaryFromJson(e);case"Text":return A.textStatementFromJson(e);case"Transition":return A.transitionFromJson(e);case"Unary":return A.unaryFromJson(e);default:throw T.thrown("Unknown node type: "+t)}}static commentFromJson(e){let t=A.idFromJson(e),l=A.positionFromJson(e.pos),i=e.isHash!=null&&e.isHash;return new Ql(t,l,e.content,e.multiline,i)}static stateFromJson(e){let t=A.idFromJson(e),l=A.positionFromJson(e.pos),i=e.fields,n=[],s=0;for(;s<i.length;){let o=i[s];++s,n.push(A.nodeFromJson(o))}let r=n,a=A.extractComments(e),h=new $t(t,l,e.temporary,r,a.leading,a.trailing);return h.style=A.blockStyleFromString(e.style),h}static objectFieldFromJson(e){let t=A.idFromJson(e),l=A.positionFromJson(e.pos),i=A.extractComments(e);return new Ul(t,l,e.name,A.nodeFromJson(e.value),i.leading,i.trailing)}static characterFromJson(e){let t=A.idFromJson(e),l=A.positionFromJson(e.pos),i=A.positionFromJson(e.namePos),n=e.fields,s=[],r=0;for(;r<n.length;){let u=n[r];++r,s.push(A.nodeFromJson(u))}let a=s,h=A.extractComments(e),o=new jt(t,l,e.name,i,a,h.leading,h.trailing);return o.style=A.blockStyleFromString(e.style),o}static beatFromJson(e){let t=A.idFromJson(e),l=A.positionFromJson(e.pos),i=e.body,n=[],s=0;for(;s<i.length;){let o=i[s];++s,n.push(A.nodeFromJson(o))}let r=n,a=A.extractComments(e),h=new Me(t,l,e.name,r,a.leading,a.trailing);return h.style=A.blockStyleFromString(e.style),h}static stringPartFromJson(e){let t=A.idFromJson(e),l=A.positionFromJson(e.pos),i=e.part,n;switch(i){case"Expr":n=ze.Expr(A.nodeFromJson(e.expression));break;case"Raw":n=ze.Raw(e.text);break;case"Tag":n=ze.Tag(e.closing,A.nodeFromJson(e.content));break;default:throw T.thrown("Unknown string part type: "+i)}let s=A.extractComments(e);return new Ge(t,l,n,s.leading,s.trailing)}static stringLiteralFromJson(e){let t=A.idFromJson(e),l=A.positionFromJson(e.pos),i=A.quotesFromString(e.quotes),n=e.parts,s=[],r=0;for(;r<n.length;){let o=n[r];++r,s.push(A.nodeFromJson(o))}let a=s,h=A.extractComments(e);return new Nt(t,l,i,a,h.leading,h.trailing)}static textStatementFromJson(e){let t=A.idFromJson(e),l=A.positionFromJson(e.pos),i=A.nodeFromJson(e.content),n=A.extractComments(e),s=new ll(t,l,i,n.leading,n.trailing);return e.condition!=null&&(s.condition=A.nodeFromJson(e.condition),s.conditionStyle=A.conditionStyleFromString(e.conditionStyle),s.conditionPos=A.positionFromJson(e.conditionPos)),s}static dialogueStatementFromJson(e){let t=A.idFromJson(e),l=A.positionFromJson(e.pos),i=A.positionFromJson(e.characterPos),n=A.nodeFromJson(e.content),s=A.extractComments(e),r=new Kt(t,l,e.character,i,n,s.leading,s.trailing);return e.condition!=null&&(r.condition=A.nodeFromJson(e.condition),r.conditionStyle=A.conditionStyleFromString(e.conditionStyle),r.conditionPos=A.positionFromJson(e.conditionPos)),r}static choiceStatementFromJson(e){let t=A.idFromJson(e),l=A.positionFromJson(e.pos),i=e.options,n=[],s=0;for(;s<i.length;){let o=i[s];++s,n.push(A.nodeFromJson(o))}let r=n,a=A.extractComments(e),h=new xl(t,l,r,a.leading,a.trailing);return h.style=A.blockStyleFromString(e.style),h}static choiceOptionFromJson(e){let t=A.idFromJson(e),l=A.positionFromJson(e.pos),i=e.text!=null?A.nodeFromJson(e.text):null,n=e.insertion!=null?A.nodeFromJson(e.insertion):null,s=e.condition!=null?A.nodeFromJson(e.condition):null,r=e.conditionStyle!=null?A.conditionStyleFromString(e.conditionStyle):0,a=e.body,h=[],o=0;for(;o<a.length;){let m=a[o];++o,h.push(A.nodeFromJson(m))}let u=h,p=A.extractComments(e),_=new St(t,l,i,n,s,r,u,p.leading,p.trailing);return _.style=A.blockStyleFromString(e.style),e.once!=null&&e.once&&(_.once=!0),e.conditionPos!=null&&(_.conditionPos=A.positionFromJson(e.conditionPos)),_}static blockFromJson(e){let t=A.idFromJson(e),l=A.positionFromJson(e.pos),i=e.body,n=[],s=0;for(;s<i.length;){let o=i[s];++s,n.push(A.nodeFromJson(o))}let r=n,a=A.extractComments(e),h=new hl(t,l,r,a.leading,a.trailing);return h.style=A.blockStyleFromString(e.style),h}static ifStatementFromJson(e){let t=A.idFromJson(e),l=A.positionFromJson(e.pos),i=A.nodeFromJson(e.condition),n=A.conditionStyleFromString(e.conditionStyle),s=e.thenBranch,r=[],a=0;for(;a<s.length;){let f=s[a];++a,r.push(A.nodeFromJson(f))}let h=r,o=new hl(Ae.UNDEFINED,l,h);o.style=A.blockStyleFromString(e.thenStyle);let u=null;if(e.elseBranch!=null){let f=e.elseBranch,g=[],d=0;for(;d<f.length;){let y=f[d];++d,g.push(A.nodeFromJson(y))}let x=g;u=new hl(Ae.UNDEFINED,l,x),u.style=A.blockStyleFromString(e.elseStyle)}let p=A.extractComments(e),_=null,m=null;if(e.comments!=null){if(e.comments.elseLeading!=null){let f=e.comments.elseLeading,g=[],d=0;for(;d<f.length;){let x=f[d];++d,g.push(A.commentFromJson(x))}_=g}if(e.comments.elseTrailing!=null){let f=e.comments.elseTrailing,g=[],d=0;for(;d<f.length;){let x=f[d];++d,g.push(A.commentFromJson(x))}m=g}}return new wl(t,l,i,n,o,u,p.leading,p.trailing,_,m)}static alternativeFromJson(e){let t=A.idFromJson(e),l=A.positionFromJson(e.pos),i=A.alternativeModeFromString(e.mode),n=e.items,s=[],r=0;for(;r<n.length;){let u=n[r];++r,s.push(A.nodeFromJson(u))}let a=s,h=A.extractComments(e),o=new Hl(t,l,i,a,h.leading,h.trailing);if(o.style=A.blockStyleFromString(e.style),e.separatorComments!=null){let u=e.separatorComments,p=[],_=0;for(;_<u.length;){let m=u[_];if(++_,m!=null){let f=m,g=[],d=0;for(;d<f.length;){let x=f[d];++d,g.push(A.commentFromJson(x))}p.push(g)}else p.push(null)}o.separatorComments=p}return o}static callFromJson(e){let t=A.idFromJson(e),l=A.positionFromJson(e.pos),i=A.nodeFromJson(e.target),n=e.args,s=[],r=0;for(;r<n.length;){let o=n[r];++r,s.push(A.nodeFromJson(o))}let a=s,h=A.extractComments(e);return new Jt(t,l,i,a,h.leading,h.trailing)}static transitionFromJson(e){let t=A.idFromJson(e),l=A.positionFromJson(e.pos),i=A.positionFromJson(e.targetPos),n=A.extractComments(e);return new Dl(t,l,e.target,i,n.leading,n.trailing)}static insertionFromJson(e){let t=A.idFromJson(e),l=A.positionFromJson(e.pos),i=A.positionFromJson(e.targetPos),n=A.extractComments(e);return new $l(t,l,e.target,i,n.leading,n.trailing)}static functionDeclFromJson(e){let t=A.idFromJson(e),l=A.positionFromJson(e.pos),i=e.name,n=e.args,s=[],r=0;for(;r<n.length;){let o=n[r];++r,s.push(o)}let a=s,h=A.extractComments(e);return new ql(t,l,i,a,e.code,e.external,h.leading,h.trailing)}static literalFromJson(e){let t=A.idFromJson(e),l=A.positionFromJson(e.pos),i=e.literal,n=A.extractComments(e),s,r;switch(i){case"Array":if(s=Ke.Array,e.value!=null){let h=e.value,o=[],u=0;for(;u<h.length;){let p=h[u];++u,Object.prototype.hasOwnProperty.call(p,"type")?o.push(A.nodeFromJson(p)):o.push(p)}r=o}else r=null;break;case"Boolean":s=Ke.Boolean,r=e.value;break;case"Null":s=Ke.Null,r=null;break;case"Number":s=Ke.Number,r=e.value;break;case"Object":let a=A.blockStyleFromString(e.style);if(s=Ke.Object(a),e.value!=null){let h=e.value,o=[],u=0;for(;u<h.length;){let p=h[u];++u,o.push(A.nodeFromJson(p))}r=o}else r=[];break;default:throw T.thrown("Unknown literal type: "+i)}return new je(t,l,r,s,n.leading,n.trailing)}static accessFromJson(e){let t=A.idFromJson(e),l=A.positionFromJson(e.pos),i=e.target!=null?A.nodeFromJson(e.target):null,n=A.extractComments(e);return new ft(t,l,i,e.name,n.leading,n.trailing)}static assignFromJson(e){let t=A.idFromJson(e),l=A.positionFromJson(e.pos),i=A.nodeFromJson(e.target),n=A.tokenTypeFromString(e.op),s=A.nodeFromJson(e.value),r=A.extractComments(e);return new kl(t,l,i,n,s,r.leading,r.trailing)}static arrayAccessFromJson(e){let t=A.idFromJson(e),l=A.positionFromJson(e.pos),i=A.nodeFromJson(e.target),n=A.nodeFromJson(e.index),s=A.extractComments(e);return new gl(t,l,i,n,s.leading,s.trailing)}static binaryFromJson(e){let t=A.idFromJson(e),l=A.positionFromJson(e.pos),i=A.nodeFromJson(e.left),n=A.tokenTypeFromString(e.op),s=A.nodeFromJson(e.right),r=A.extractComments(e);return new il(t,l,i,n,s,r.leading,r.trailing)}static unaryFromJson(e){let t=A.idFromJson(e),l=A.positionFromJson(e.pos),i=A.tokenTypeFromString(e.op),n=A.nodeFromJson(e.operand),s=A.extractComments(e);return new Yl(t,l,i,n,s.leading,s.trailing)}static ternaryFromJson(e){let t=A.idFromJson(e),l=A.positionFromJson(e.pos),i=A.nodeFromJson(e.condition),n=A.nodeFromJson(e.trueExpr),s=A.nodeFromJson(e.falseExpr),r=A.extractComments(e);return new ii(t,l,i,n,s,r.leading,r.trailing)}static importStatementFromJson(e){let t=A.idFromJson(e),l=A.positionFromJson(e.pos),i=A.nodeFromJson(e.path),n=e.script!=null?A.scriptFromJson(e.script):null,s=A.extractComments(e);return new Rt(t,l,i,n,s.leading,s.trailing)}static idFromJson(e){let t=e.id;return t!=null?Ae.fromString(t):Ae.UNDEFINED}static positionFromJson(e){if(e==null)return new ue(0,0,0,0);let t=e.length!=null?e.length:0;return new ue(e.line,e.column,e.offset,t)}static extractComments(e){if(e.comments==null)return{leading:null,trailing:null};let t=null,l=null;if(e.comments.leading!=null){let i=e.comments.leading,n=[],s=0;for(;s<i.length;){let r=i[s];++s,n.push(A.commentFromJson(r))}t=n}if(e.comments.trailing!=null){let i=e.comments.trailing,n=[],s=0;for(;s<i.length;){let r=i[s];++s,n.push(A.commentFromJson(r))}l=n}return{leading:t,trailing:l}}static applyComments(e,t){let l=A.extractComments(t);e.leadingComments=l.leading,e.trailingComments=l.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 k.OpAssign;case"OpDivide":return k.OpDivide;case"OpDivideAssign":return k.OpDivideAssign;case"OpEquals":return k.OpEquals;case"OpGreater":return k.OpGreater;case"OpGreaterEq":return k.OpGreaterEq;case"OpLess":return k.OpLess;case"OpLessEq":return k.OpLessEq;case"OpMinus":return k.OpMinus;case"OpMinusAssign":return k.OpMinusAssign;case"OpModulo":return k.OpModulo;case"OpMultiply":return k.OpMultiply;case"OpMultiplyAssign":return k.OpMultiplyAssign;case"OpNot":return k.OpNot;case"OpNotEquals":return k.OpNotEquals;case"OpPlus":return k.OpPlus;case"OpPlusAssign":return k.OpPlusAssign;case"OpUnquotedAssign":return k.OpUnquotedAssign;default:if(e.startsWith("OpAnd"))return k.OpAnd(e.indexOf("true")!=-1);if(e.startsWith("OpOr"))return k.OpOr(e.indexOf("true")!=-1);throw T.thrown("Unknown operator: "+e)}}}Q["loreline.JsonToAst"]=A,A.__name__="loreline.JsonToAst";class _l{constructor(e,t){this.target=e,this.origin=t}}Q["loreline.Reference"]=_l,_l.__name__="loreline.Reference",Object.assign(_l.prototype,{__class__:_l});class Gi{constructor(e){this.error=null,this.expr=null,this.lorscript=null,this.func=e,this.codeToLorscript=new ti;try{this.lorscript=this.codeToLorscript.process(e.code)}catch(t){let l=T.caught(t).unwrap();l instanceof st&&(this.error=l,this.error.pos=e.pos.withOffset(this.codeToLorscript.input,this.error.pos.offset,this.error.pos.length,e.pos.offset)),this.lorscript=this.codeToLorscript.output.b}try{let t=new ci;t.resumeErrors=!1,t.allowJSON=!0,t.allowTypes=!0;let l=e.name;this.expr=t.parseString(this.lorscript,l??"?")}catch(t){let l=T.caught(t).unwrap();if(this.error==null)if(l instanceof Se){let i=l,n,s=i.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 Li(i,n,this.codeToLorscript.toLorelinePos(e.pos,i.pmin,i.pmax))}else l instanceof st&&(this.error=l,this.error.pos=e.pos.withOffset(this.codeToLorscript.input,this.error.pos.offset,this.error.pos.length,e.pos.offset));try{let i=new ci;i.resumeErrors=!0,i.allowJSON=!0,i.allowTypes=!0;let n=e.name;this.expr=i.parseString(this.lorscript,n??"?")}catch{}}}}Q["loreline.FuncLorscript"]=Gi,Gi.__name__="loreline.FuncLorscript",Object.assign(Gi.prototype,{__class__:Gi});class Qi{constructor(e,t){this.completion=null,this.locals=null,e!=null&&(this.locals=e),t!=null&&(this.completion=t)}}Q["loreline.LorscriptCompletion"]=Qi,Qi.__name__="loreline.LorscriptCompletion",Object.assign(Qi.prototype,{__class__:Qi});class Ii{constructor(e){this.lorscriptFunctions=new li,this.childNodes=new li,this.parentNodes=new li,this.nodesById=new li,this.script=e,this.initialize()}initialize(){let e=this;this.script.each(function(t,l){let i=t.id.thisVal;if(e.nodesById.map._set(i.high,i.low,t),l!=null){let n=t.id.thisVal;e.parentNodes.map._set(n.high,n.low,l);let s=l.id.thisVal,r=e.childNodes.map._get(s.high,s.low);if(r==null){r=[];let a=l.id.thisVal;e.childNodes.map._set(a.high,a.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(l,i){let n=l.pos;n.length>0&&n.offset<=e.offset&&n.offset+n.length>=e.offset&&(t=l)}),t}getClosestNodeAtOrBeforePosition(e){let t=null,l=999999999;return this.script.eachExcludingImported(function(i,n){let s=i.pos,r=e.offset-s.offset;r>=0&&r<l&&(l=r,t=i)}),t}getNodesOfType(e,t){t==null&&(t=!1);let l=[],i=this;return this.traverse(this.script,function(n,s){return te.__instanceof(n,e)&&l.push(n),t||n==i.script?!0:!(n instanceof Rt||n instanceof nl)}),l}getDialogueSpeakers(e){let t=[],l=Object.create(null);return this.traverse(e,function(i,n){if(i instanceof Kt){let s=i;s.character!=null&&!Object.prototype.hasOwnProperty.call(l,s.character)&&(l[s.character]=!0,t.push(s.character))}return!0}),t}getParentNode(e){let t=e.id.thisVal;return this.parentNodes.map._get(t.high,t.low)}getFirstParentOfType(e,t){let l=e;for(;l!=null;)if(l=this.getParentNode(l),l!=null&&te.getClass(l)==t)return l;return null}getNodeFilePath(e,t){let l=[],i=e;for(;i!=null;){let o=this.getFirstParentOfType(i,Rt);if(o!=null)l.push(o),i=o;else break}if(l.length==0)return t;let n=De.directory(t),s;if(t==null)s=!1;else{let o=t.length;if(o<8)s=!1;else{let u,p,_,m,f,g,d=c.cca(t,o-8);if((d??-1)==46){let x=c.cca(t,o-7),y=x??-1;g=y==108||y==76}else g=!1;if(g){let x=c.cca(t,o-6),y=x??-1;f=y==111||y==79}else f=!1;if(f){let x=c.cca(t,o-5),y=x??-1;m=y==114||y==82}else m=!1;if(m){let x=c.cca(t,o-4);_=(x??-1)==46}else _=!1;if(_){let x=c.cca(t,o-3),y=x??-1;p=y==116||y==84}else p=!1;if(p){let x=c.cca(t,o-2),y=x??-1;u=y==120||y==88}else u=!1;if(u){let x=c.cca(t,o-1),y=x??-1;s=y==116||y==84}else s=!1}}let r=s?".lor.txt":".lor",a=t,h=l.length-1;for(;h>=0;){let o=l[h],u,p=o.path.parts[0].partType;p._hx_index==0?u=p.text:u="",De.isAbsolute(u)||(u=De.join([n,u])),u=De.normalize(u);let _,m;if(u==null)m=!1;else{let f=u.length;if(f<8)m=!1;else{let g,d,x,y,S,C,O=c.cca(u,f-8);if((O??-1)==46){let E=c.cca(u,f-7),v=E??-1;C=v==108||v==76}else C=!1;if(C){let E=c.cca(u,f-6),v=E??-1;S=v==111||v==79}else S=!1;if(S){let E=c.cca(u,f-5),v=E??-1;y=v==114||v==82}else y=!1;if(y){let E=c.cca(u,f-4);x=(E??-1)==46}else x=!1;if(x){let E=c.cca(u,f-3),v=E??-1;d=v==116||v==84}else d=!1;if(d){let E=c.cca(u,f-2),v=E??-1;g=v==120||v==88}else g=!1;if(g){let E=c.cca(u,f-1),v=E??-1;m=v==116||v==84}else m=!1}}if(m)_=!0;else if(u==null)_=!1;else{let f=u.length;if(f<4)_=!1;else{let g,d,x=c.cca(u,f-4);if((x??-1)==46){let y=c.cca(u,f-3),S=y??-1;d=S==108||S==76}else d=!1;if(d){let y=c.cca(u,f-2),S=y??-1;g=S==111||S==79}else g=!1;if(g){let y=c.cca(u,f-1),S=y??-1;_=S==114||S==82}else _=!1}}_||(u+=r),a=u,n=De.directory(a),--h}return a}getNodeAncestorFilePaths(e){let t=[],l=e;for(;l!=null;){let r=this.getFirstParentOfType(l,Rt);if(r!=null)t.push(r),l=r;else break}let i=[],n=null,s=t.length-1;for(;s>=0;){let r=t[s],a,h=r.path.parts[0].partType;h._hx_index==0?a=h.text:a="",n==null?n=a:n=De.join([De.directory(n),a]);let o=De.normalize(n),u;if(o==null)u=null;else{let p;if(o==null)p=!1;else{let _=o.length;if(_<8)p=!1;else{let m,f,g,d,x,y,S=c.cca(o,_-8);if((S??-1)==46){let C=c.cca(o,_-7),O=C??-1;y=O==108||O==76}else y=!1;if(y){let C=c.cca(o,_-6),O=C??-1;x=O==111||O==79}else x=!1;if(x){let C=c.cca(o,_-5),O=C??-1;d=O==114||O==82}else d=!1;if(d){let C=c.cca(o,_-4);g=(C??-1)==46}else g=!1;if(g){let C=c.cca(o,_-3),O=C??-1;f=O==116||O==84}else f=!1;if(f){let C=c.cca(o,_-2),O=C??-1;m=O==120||O==88}else m=!1;if(m){let C=c.cca(o,_-1),O=C??-1;p=O==116||O==84}else p=!1}}if(p){let _=o.length-8;u=_!=null?c.substr(o,0,_):c.substr(o,0,null)}else{let _;if(o==null)_=!1;else{let m=o.length;if(m<4)_=!1;else{let f,g,d=c.cca(o,m-4);if((d??-1)==46){let x=c.cca(o,m-3),y=x??-1;g=y==108||y==76}else g=!1;if(g){let x=c.cca(o,m-2),y=x??-1;f=y==111||y==79}else f=!1;if(f){let x=c.cca(o,m-1),y=x??-1;_=y==114||y==82}else _=!1}}if(_){let m=o.length-4;u=m!=null?c.substr(o,0,m):c.substr(o,0,null)}else u=o}}i.push(u),--s}return i.reverse(),i.push("."),i}getNodeRelativeFilePath(e){let t=null,l=e;for(;l!=null;){let r=this.getFirstParentOfType(l,Rt);if(r!=null)t==null&&(t=[]),t.push(r),l=r;else break}if(t==null||t.length==0)return".";let i=null,n=t.length-1;for(;n>=0;){let r=t[n],a,h=r.path.parts[0].partType;h._hx_index==0?a=h.text:a="",i==null?i=a:i=De.join([De.directory(i),a]),--n}let s=De.normalize(i);if(s==null)return null;{let r;if(s==null)r=!1;else{let a=s.length;if(a<8)r=!1;else{let h,o,u,p,_,m,f=c.cca(s,a-8);if((f??-1)==46){let g=c.cca(s,a-7),d=g??-1;m=d==108||d==76}else m=!1;if(m){let g=c.cca(s,a-6),d=g??-1;_=d==111||d==79}else _=!1;if(_){let g=c.cca(s,a-5),d=g??-1;p=d==114||d==82}else p=!1;if(p){let g=c.cca(s,a-4);u=(g??-1)==46}else u=!1;if(u){let g=c.cca(s,a-3),d=g??-1;o=d==116||d==84}else o=!1;if(o){let g=c.cca(s,a-2),d=g??-1;h=d==120||d==88}else h=!1;if(h){let g=c.cca(s,a-1),d=g??-1;r=d==116||d==84}else r=!1}}if(r){let a=s.length-8;return a!=null?c.substr(s,0,a):c.substr(s,0,null)}else{let a;if(s==null)a=!1;else{let h=s.length;if(h<4)a=!1;else{let o,u,p=c.cca(s,h-4);if((p??-1)==46){let _=c.cca(s,h-3),m=_??-1;u=m==108||m==76}else u=!1;if(u){let _=c.cca(s,h-2),m=_??-1;o=m==111||m==79}else o=!1;if(o){let _=c.cca(s,h-1),m=_??-1;a=m==114||m==82}else a=!1}}if(a){let h=s.length-4;return h!=null?c.substr(s,0,h):c.substr(s,0,null)}else return s}}}getImportedPaths(e){let t=[];return this._getImportedPaths(e,this.script,t,new Ee),t}_getImportedPaths(e,t,l,i){let n=De.directory(e);t==null&&(t=this.script);let s;if(e==null)s=!1;else{let o=e.length;if(o<8)s=!1;else{let u,p,_,m,f,g,d=c.cca(e,o-8);if((d??-1)==46){let x=c.cca(e,o-7),y=x??-1;g=y==108||y==76}else g=!1;if(g){let x=c.cca(e,o-6),y=x??-1;f=y==111||y==79}else f=!1;if(f){let x=c.cca(e,o-5),y=x??-1;m=y==114||y==82}else m=!1;if(m){let x=c.cca(e,o-4);_=(x??-1)==46}else _=!1;if(_){let x=c.cca(e,o-3),y=x??-1;p=y==116||y==84}else p=!1;if(p){let x=c.cca(e,o-2),y=x??-1;u=y==120||y==88}else u=!1;if(u){let x=c.cca(e,o-1),y=x??-1;s=y==116||y==84}else s=!1}}let r=s?".lor.txt":".lor",a=0,h=t.body;for(;a<h.length;){let o=h[a];if(++a,o instanceof Rt){let u=o,p,_=u.path.parts[0].partType;_._hx_index==0?p=_.text:p="",De.isAbsolute(p)||(p=De.join([n,p])),p=De.normalize(p);let m,f;if(p==null)f=!1;else{let g=p.length;if(g<8)f=!1;else{let d,x,y,S,C,O,E=c.cca(p,g-8);if((E??-1)==46){let v=c.cca(p,g-7),N=v??-1;O=N==108||N==76}else O=!1;if(O){let v=c.cca(p,g-6),N=v??-1;C=N==111||N==79}else C=!1;if(C){let v=c.cca(p,g-5),N=v??-1;S=N==114||N==82}else S=!1;if(S){let v=c.cca(p,g-4);y=(v??-1)==46}else y=!1;if(y){let v=c.cca(p,g-3),N=v??-1;x=N==116||N==84}else x=!1;if(x){let v=c.cca(p,g-2),N=v??-1;d=N==120||N==88}else d=!1;if(d){let v=c.cca(p,g-1),N=v??-1;f=N==116||N==84}else f=!1}}if(f)m=!0;else if(p==null)m=!1;else{let g=p.length;if(g<4)m=!1;else{let d,x,y=c.cca(p,g-4);if((y??-1)==46){let S=c.cca(p,g-3),C=S??-1;x=C==108||C==76}else x=!1;if(x){let S=c.cca(p,g-2),C=S??-1;d=C==111||C==79}else d=!1;if(d){let S=c.cca(p,g-1),C=S??-1;m=C==114||C==82}else m=!1}}m||(p+=r),Object.prototype.hasOwnProperty.call(i.h,p)||(i.h[p]=!0,l.push(p),u.script!=null&&this._getImportedPaths(p,u.script,l,i))}}return l}resolveArrayAccess(e){let t=null;if(e.target instanceof ft?t=this.resolveAccess(e.target):e.target instanceof gl&&(t=this.resolveArrayAccess(e.target)),t==null)return null;switch(te.getClass(t)){case je:let l=t;if(l.literalType==Ke.Array){let n=l.value;if(e.index instanceof je){let s=e.index;if(s.literalType==Ke.Number){let r=s.value|0;if(r>=0&&r<n.length){let a=n[r];if(a instanceof At)return a}}}}break;case Ul:let i=t;if(i.value instanceof je){let n=i.value;if(n.literalType==Ke.Array){let s=n.value;if(e.index instanceof je){let r=e.index;if(r.literalType==Ke.Number){let a=r.value|0;if(a>=0&&a<s.length){let h=s[a];if(h instanceof At)return h}}}}}break;default:}return null}resolveAccess(e){if(e.target!=null){let a=e.target instanceof ft?this.resolveAccess(e.target):e.target instanceof gl?this.resolveArrayAccess(e.target):null;if(a!=null)switch(a instanceof Ul&&(a=a.value),te.getClass(a)){case jt:let h=a,o=0,u=h.fields;for(;o<u.length;){let m=u[o];if(++o,m.name==e.name)return m}break;case je:let p=a,_=p.literalType;if(_._hx_index==4){let m=_.style,f=p.value,g=0;for(;g<f.length;){let d=f[g];if(++g,d.name==e.name)return d}}break;default:}return null}let t=e.name;if(t==null)return null;let l=this.getFirstParentOfType(e,Me);for(;l!=null;){let a=null;if(this.traverse(l,function(h,o){if(a!=null)return!1;if(h instanceof $t){let u=h,p=0,_=u.fields;for(;p<_.length;){let m=_[p];if(++p,m.name==t)return a=m,!1}}return!0}),a!=null)return a;l=this.getFirstParentOfType(l,Me)}let i=null;if(this.traverse(this.script,function(a,h){if(i!=null)return!1;if(a instanceof $t){let o=a,u=0,p=o.fields;for(;u<p.length;){let _=p[u];if(++u,_.name==t)return i=_,!1}}return a instanceof Rt?!0:a instanceof nl}),i!=null)return i;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 l=e.split("."),i=this.findBeatByNameFromNode(l[0],t),n=1;for(;i!=null&&n<l.length;){let s=l[n],r=null;this.traverse(i,function(a,h){if(a instanceof Me){let o=a;return o.name==s&&(r=o),!1}else return r==null}),i=r,++n}return i}isTopLevelNode(e){if(e instanceof Be){let t=e;return this.script.body.indexOf(t)!=-1}return!1}findTopLevelBeatFromNode(e){if(this.isTopLevelNode(e))return e instanceof 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 l=null,i=this.getFirstParentOfType(t,Me);for(;i!=null;)this.traverse(i,function(n,s){if(l!=null||n==t)return!1;if(n instanceof Me){let r=n;return r.name==e&&(l=r),!1}return!0}),i=this.getFirstParentOfType(i,Me);return l==null&&this.traverse(this.script,function(n,s){if(l==null&&n instanceof Me){let r=n;r.name==e&&(l=r)}return n instanceof Rt?!0:n instanceof nl}),l}findCharacterFromDialogue(e){return this.findCharacterByNameFromNode(e.character,e)}findCharacterByNameFromNode(e,t){let l=null;return this.traverse(this.script,function(i,n){if(l==null&&i instanceof jt){let s=i;s.name==e&&(l=s)}return i instanceof Rt?!0:i instanceof nl}),l}findFunctionByNameFromNode(e,t){let l=null;return this.traverse(this.script,function(i,n){if(l==null&&i instanceof ql){let s=i;s.name==e&&(l=s)}return i instanceof Rt?!0:i instanceof nl}),l}getVisibleCharacters(){let e=[],t=this.script.iterator();for(;t.hasNext();){let l=t.next();l instanceof jt&&e.push(l)}return e}getVisibleFunctions(){let e=[],t=this.script.iterator();for(;t.hasNext();){let l=t.next();l instanceof ql&&e.push(l)}return e}getVisibleStateFields(e){let t=[],l=new El,i=e;for(;i!=null;){if(te.getClass(i)==$t){let s=i,r=0,a=s.fields;for(;r<a.length;){let h=a[r];++r;let o=h.id.thisVal;if(!l._exists(o.high,o.low)){let u=h.id.thisVal;l._set(u.high,u.low,!0),t.push(h)}}}let n=i.id.thisVal;i=this.parentNodes.map._get(n.high,n.low)}return this.script.each(function(n,s){if(te.getClass(n)==$t){let r=n;if(s instanceof nl){let a=0,h=r.fields;for(;a<h.length;){let o=h[a];++a;let u=o.id.thisVal;if(!l._exists(u.high,u.low)){let p=o.id.thisVal;l._set(p.high,p.low,!0),t.push(o)}}}}}),t}getVisibleBeats(e){let t=[],l=Object.create(null),i=this.getParentNode(e);for(;i!=null;){if(te.getClass(i)==Me&&this.getParentNode(i)!=null){let s=0,r=this.getNodesOfType(Me);for(;s<r.length;){let a=r[s];++s,Object.prototype.hasOwnProperty.call(l,a.name)||(l[a.name]=!0,t.push(a))}}i=this.getParentNode(i)}return this.script.each(function(n,s){if(te.getClass(n)==Me&&s instanceof nl){let r=n;Object.prototype.hasOwnProperty.call(l,r.name)||(l[r.name]=!0,t.push(r))}}),t}getAllTags(){let e=Object.create(null);this.script.each(function(a,h){let o=a instanceof Be?a:null;if(o!=null&&o.trailingComments!=null){let u=0,p=o.trailingComments;for(;u<p.length;){let _=p[u];if(++u,_.isHash){let m=He.trim(_.content);e[m]=!0}}}});let t=[],l=e,i=l,n=Object.keys(l),s=n.length,r=0;for(;r<s;){let a=n[r++];t.push(a)}return t}countTags(){let e=new Ee;return this.script.each(function(t,l){let i=t instanceof Be?t:null;if(i!=null&&i.trailingComments!=null){let n=0,s=i.trailingComments;for(;n<s.length;){let r=s[n];if(++n,r.isHash){let a=He.trim(r.content),h=e.h[a],o=h??0;e.h[a]=o+1}}}}),e}findStateField(e){if(e.target!=null)return null;let t=this.getVisibleStateFields(e),l=0;for(;l<t.length;){let i=t[l];if(++l,i.name==e.name)return i}return null}findOutboundBeats(e){let t=new El,l=this;this.traverse(e,function(r,a){switch(te.getClass(r)){case Jt:let h=r;if(h.target instanceof ft){let m=h.target;if(m.target==null){let f=l.findBeatFromAccess(m);if(f!=null){let g=f.id,d=new _l(f,h),x=g.thisVal;t._set(x.high,x.low,d)}}}break;case $l:let o=r,u=l.findBeatByNameFromNode(o.target,o);if(u!=null){let m=u.id,f=new _l(u,o),g=m.thisVal;t._set(g.high,g.low,f)}break;case Dl:let p=r,_=l.findBeatByNameFromNode(p.target,p);if(_!=null){let m=_.id,f=new _l(_,p),g=m.thisVal;t._set(g.high,g.low,f)}break;default:}return!0});let i=[],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 a=r;i.push(a)}return i}findReferencesToBeat(e){let t=[],l=this;return this.script.each(function(i,n){switch(te.getClass(i)){case Jt:let s=i;if(s.target instanceof ft){let h=s.target;if(h.target==null&&h.name==e.name){let o=l.findBeatFromAccess(h);o!=null&&o.id==e.id&&t.push(new _l(e,s))}}break;case $l:let r=i;r.target==e.name&&t.push(new _l(e,r));break;case Dl:let a=i;a.target==e.name&&t.push(new _l(e,a));break;default:}}),t}findModifiedStateFields(e){let t=Object.create(null),l=this;this.traverse(e,function(u,p){if(te.getClass(u)==kl){let _=u;if(_.target instanceof ft){let m=_.target,f=l.findStateField(m);if(f!=null){let g=f.name,d=new _l(f,_);t[g]=d}}}return!0});let i=[],n=t,s=n,r=Object.keys(n),a=r.length,h=0;for(;h<a;){let u=s[r[h++]];i.push(u)}let o=i;return o.sort(function(u,p){let _=u.target.name.toLowerCase(),m=p.target.name.toLowerCase();return _<m?-1:_>m?1:0}),o}findReadStateFields(e){let t=Object.create(null),l=this;this.traverse(e,function(u,p){if(te.getClass(u)==ft){let _=u;if(p instanceof kl&&p.target==u)return!0;let m=l.findStateField(_);if(m!=null){let f=m.name,g=new _l(m,_);t[f]=g}}return!0});let i=[],n=t,s=n,r=Object.keys(n),a=r.length,h=0;for(;h<a;){let u=s[r[h++]];i.push(u)}let o=i;return o.sort(function(u,p){let _=u.target.name.toLowerCase(),m=p.target.name.toLowerCase();return _<m?-1:_>m?1:0}),o}findBeatCharacters(e){let t=new El,l=this;this.traverse(e,function(a,h){switch(te.getClass(a)){case ft:let o=a;if(o.target==null){let _=l.findCharacterByNameFromNode(o.name,o);if(_!=null){let m=_.id,f=new _l(_,o),g=m.thisVal;t._set(g.high,g.low,f)}}break;case Kt:let u=a,p=l.findCharacterFromDialogue(u);if(p!=null){let _=p.id,m=new _l(p,u),f=_.thisVal;t._set(f.high,f.low,m)}break;default:}return!0});let i=[],n=t,s=0;for(;s<n._values.length&&n._values[s]==null;)++s;for(;s<n._values.length;){let a=n._values[s];for(++s;s<n._values.length&&n._values[s]==null;)++s;let h=a;i.push(h)}let r=i;return r.sort(function(a,h){let o=a.target.name.toLowerCase(),u=h.target.name.toLowerCase();return o<u?-1:o>u?1:0}),r}findModifiedCharacterFields(e){let t=new El,l=[],i=this;return this.traverse(e,function(n,s){if(te.getClass(n)==kl){let r=n;if(r.target instanceof ft){let a=r.target,h=i.resolveAccess(a);if(h instanceof Ul){let o=h.id.thisVal;if(!t._exists(o.high,o.low)&&i.getParentNode(h)instanceof jt){let p=h.id.thisVal;t._set(p.high,p.low,!0),l.push(new _l(h,n))}}}}return!0}),l}findReadCharacterFields(e){let t=new El,l=[],i=this;return this.traverse(e,function(n,s){if(te.getClass(n)==ft){let r=n,a=i.getParentNode(r);if(a instanceof kl&&a.target==r)return!0;let h=i.resolveAccess(r);if(h instanceof Ul){let o=h.id.thisVal;if(!t._exists(o.high,o.low)&&i.getParentNode(h)instanceof jt){let p=h.id.thisVal;t._set(p.high,p.low,!0),l.push(new _l(h,n))}}}return!0}),l}traverse(e,t){let l=e.id.thisVal,i=this.childNodes.map._get(l.high,l.low);if(i!=null){let n=0,s=i.length;for(;n<s;){let r=n++,a=i[r];t(a,e)&&this.traverse(a,t)}}}getFuncLorscript(e){let t=e.id,l=t.thisVal,i=this.lorscriptFunctions.map._get(l.high,l.low);if(i==null){i=new Gi(e);let n=t.thisVal;this.lorscriptFunctions.map._set(n.high,n.low,i)}return i}getLorscriptExpr(e,t){let l=this.getFuncLorscript(e);if(l.expr==null)return null;let i=t.offset-e.pos.offset,n=null,s=null;return s=function(r){if(r!=null){let a=l.codeToLorscript.inputPosFromProcessedPos(r.pmin),h=l.codeToLorscript.inputPosFromProcessedPos(r.pmax);i>=a&&i<=h&&(n=r),un.iter(r,s)}},un.iter(l.expr,s),n}resolveLorscriptAccess(e,t){let l=t.e;switch(l._hx_index){case 1:let i=l.v,n=null;if(this.traverse(this.script,function(_,m){if(n!=null)return!1;if(_ instanceof $t){let f=_,g=0,d=f.fields;for(;g<d.length;){let x=d[g];if(++g,x.name==i)return n=x,!1}}return _ instanceof Rt?!0:_ instanceof nl}),n!=null)return n;let s=this.findCharacterByNameFromNode(i,e);if(s!=null)return s;let r=this.findBeatByNameFromNode(i,e);if(r!=null)return r;break;case 5:let a=l.e,h=l.f,o=a!=null?this.resolveLorscriptAccess(e,a):null;if(o!=null)switch(o instanceof Ul&&(o=o.value),te.getClass(o)){case jt:let _=o,m=0,f=_.fields;for(;m<f.length;){let x=f[m];if(++m,x.name==h)return x}break;case je:let g=o,d=g.literalType;if(d._hx_index==4){let x=d.style,y=g.value,S=0;for(;S<y.length;){let C=y[S];if(++S,C.name==h)return C}}break;default:}break;case 16:let u=l.e,p=l.index;break;default:}return null}isLorscriptExpr(e){return e!=null&&Object.prototype.hasOwnProperty.call(e,"e")?te.__instanceof(We.field(e,"e"),K):!1}getLorscriptCompletion(e,t){let l=this.getFuncLorscript(e),i=t.offset-e.pos.offset+t.length,n=l.codeToLorscript.processedPosFromInputPos(i),s=l.lorscript,r=Math.min(n,l.lorscript.length)|0,a=r!=null?s.substring(0,r):s.substring(0),h=a.length,o=a.indexOf("{",null)+1;a=h!=null?a.substring(o,h):a.substring(o);let u=a.length,p="",_=0,m=h-u;for(;_<m;){let x=_++;p+=String.fromCodePoint(32)}a=p+a;let f=null,g=new tt;try{g.types.parser.allowJSON=!0,g.types.parser.allowTypes=!0,g.types.parser.resumeErrors=!0;let x=g.types.parser.parseString(a);g.check(x,null,!0)}catch(x){let y=T.caught(x).unwrap();y instanceof Bi&&(f=y)}let d=g.locals;return new Qi(d,f)}resolveAccessInFunction(e,t){if(this.getFuncLorscript(e).expr==null)return null;let i=this.getLorscriptExpr(e,t);return i!=null?this.resolveLorscriptAccess(e,i):null}}Q["loreline.Lens"]=Ii,Ii.__name__="loreline.Lens",Object.assign(Ii.prototype,{__class__:Ii});class ui extends st{constructor(e,t){super(e,t)}}Q["loreline.LexerError"]=ui,ui.__name__="loreline.LexerError",ui.__super__=st,Object.assign(ui.prototype,{__class__:ui});var Ll=Ye["loreline.LStringAttachment"]={__ename__:"loreline.LStringAttachment",__constructs__:null,Interpolation:(w=function(b,e,t,l,i){return{_hx_index:0,braces:b,inTag:e,expr:t,start:l,length:i,__enum__:"loreline.LStringAttachment",toString:F}},w._hx_name="Interpolation",w.__params__=["braces","inTag","expr","start","length"],w),Tag:(w=function(b,e,t){return{_hx_index:1,closing:b,start:e,length:t,__enum__:"loreline.LStringAttachment",toString:F}},w._hx_name="Tag",w.__params__=["closing","start","length"],w)};Ll.__constructs__=[Ll.Interpolation,Ll.Tag];class Bl{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 k=Ye["loreline.TokenType"]={__ename__:"loreline.TokenType",__constructs__:null,KwImport:{_hx_name:"KwImport",_hx_index:0,__enum__:"loreline.TokenType",toString:F},KwState:{_hx_name:"KwState",_hx_index:1,__enum__:"loreline.TokenType",toString:F},KwBeat:{_hx_name:"KwBeat",_hx_index:2,__enum__:"loreline.TokenType",toString:F},KwCharacter:{_hx_name:"KwCharacter",_hx_index:3,__enum__:"loreline.TokenType",toString:F},KwChoice:{_hx_name:"KwChoice",_hx_index:4,__enum__:"loreline.TokenType",toString:F},KwIf:{_hx_name:"KwIf",_hx_index:5,__enum__:"loreline.TokenType",toString:F},KwElse:{_hx_name:"KwElse",_hx_index:6,__enum__:"loreline.TokenType",toString:F},KwNew:{_hx_name:"KwNew",_hx_index:7,__enum__:"loreline.TokenType",toString:F},KwSequence:{_hx_name:"KwSequence",_hx_index:8,__enum__:"loreline.TokenType",toString:F},KwCycle:{_hx_name:"KwCycle",_hx_index:9,__enum__:"loreline.TokenType",toString:F},KwOnce:{_hx_name:"KwOnce",_hx_index:10,__enum__:"loreline.TokenType",toString:F},KwPick:{_hx_name:"KwPick",_hx_index:11,__enum__:"loreline.TokenType",toString:F},KwShuffle:{_hx_name:"KwShuffle",_hx_index:12,__enum__:"loreline.TokenType",toString:F},Separator:{_hx_name:"Separator",_hx_index:13,__enum__:"loreline.TokenType",toString:F},Function:(w=function(b,e,t,l){return{_hx_index:14,name:b,args:e,code:t,external:l,__enum__:"loreline.TokenType",toString:F}},w._hx_name="Function",w.__params__=["name","args","code","external"],w),LString:(w=function(b,e,t){return{_hx_index:15,quotes:b,s:e,attachments:t,__enum__:"loreline.TokenType",toString:F}},w._hx_name="LString",w.__params__=["quotes","s","attachments"],w),LNumber:(w=function(b){return{_hx_index:16,n:b,__enum__:"loreline.TokenType",toString:F}},w._hx_name="LNumber",w.__params__=["n"],w),LBoolean:(w=function(b){return{_hx_index:17,b,__enum__:"loreline.TokenType",toString:F}},w._hx_name="LBoolean",w.__params__=["b"],w),LNull:{_hx_name:"LNull",_hx_index:18,__enum__:"loreline.TokenType",toString:F},Identifier:(w=function(b){return{_hx_index:19,name:b,__enum__:"loreline.TokenType",toString:F}},w._hx_name="Identifier",w.__params__=["name"],w),OpAssign:{_hx_name:"OpAssign",_hx_index:20,__enum__:"loreline.TokenType",toString:F},OpPlusAssign:{_hx_name:"OpPlusAssign",_hx_index:21,__enum__:"loreline.TokenType",toString:F},OpMinusAssign:{_hx_name:"OpMinusAssign",_hx_index:22,__enum__:"loreline.TokenType",toString:F},OpMultiplyAssign:{_hx_name:"OpMultiplyAssign",_hx_index:23,__enum__:"loreline.TokenType",toString:F},OpDivideAssign:{_hx_name:"OpDivideAssign",_hx_index:24,__enum__:"loreline.TokenType",toString:F},OpUnquotedAssign:{_hx_name:"OpUnquotedAssign",_hx_index:25,__enum__:"loreline.TokenType",toString:F},OpPlus:{_hx_name:"OpPlus",_hx_index:26,__enum__:"loreline.TokenType",toString:F},OpMinus:{_hx_name:"OpMinus",_hx_index:27,__enum__:"loreline.TokenType",toString:F},OpMultiply:{_hx_name:"OpMultiply",_hx_index:28,__enum__:"loreline.TokenType",toString:F},OpDivide:{_hx_name:"OpDivide",_hx_index:29,__enum__:"loreline.TokenType",toString:F},OpModulo:{_hx_name:"OpModulo",_hx_index:30,__enum__:"loreline.TokenType",toString:F},OpEquals:{_hx_name:"OpEquals",_hx_index:31,__enum__:"loreline.TokenType",toString:F},OpNotEquals:{_hx_name:"OpNotEquals",_hx_index:32,__enum__:"loreline.TokenType",toString:F},OpGreater:{_hx_name:"OpGreater",_hx_index:33,__enum__:"loreline.TokenType",toString:F},OpLess:{_hx_name:"OpLess",_hx_index:34,__enum__:"loreline.TokenType",toString:F},OpGreaterEq:{_hx_name:"OpGreaterEq",_hx_index:35,__enum__:"loreline.TokenType",toString:F},OpLessEq:{_hx_name:"OpLessEq",_hx_index:36,__enum__:"loreline.TokenType",toString:F},OpAnd:(w=function(b){return{_hx_index:37,word:b,__enum__:"loreline.TokenType",toString:F}},w._hx_name="OpAnd",w.__params__=["word"],w),OpOr:(w=function(b){return{_hx_index:38,word:b,__enum__:"loreline.TokenType",toString:F}},w._hx_name="OpOr",w.__params__=["word"],w),OpNot:{_hx_name:"OpNot",_hx_index:39,__enum__:"loreline.TokenType",toString:F},Arrow:{_hx_name:"Arrow",_hx_index:40,__enum__:"loreline.TokenType",toString:F},Colon:{_hx_name:"Colon",_hx_index:41,__enum__:"loreline.TokenType",toString:F},Question:{_hx_name:"Question",_hx_index:42,__enum__:"loreline.TokenType",toString:F},Comma:{_hx_name:"Comma",_hx_index:43,__enum__:"loreline.TokenType",toString:F},Dot:{_hx_name:"Dot",_hx_index:44,__enum__:"loreline.TokenType",toString:F},LBrace:{_hx_name:"LBrace",_hx_index:45,__enum__:"loreline.TokenType",toString:F},RBrace:{_hx_name:"RBrace",_hx_index:46,__enum__:"loreline.TokenType",toString:F},LParen:{_hx_name:"LParen",_hx_index:47,__enum__:"loreline.TokenType",toString:F},RParen:{_hx_name:"RParen",_hx_index:48,__enum__:"loreline.TokenType",toString:F},LBracket:{_hx_name:"LBracket",_hx_index:49,__enum__:"loreline.TokenType",toString:F},RBracket:{_hx_name:"RBracket",_hx_index:50,__enum__:"loreline.TokenType",toString:F},CommentLine:(w=function(b){return{_hx_index:51,content:b,__enum__:"loreline.TokenType",toString:F}},w._hx_name="CommentLine",w.__params__=["content"],w),CommentMultiLine:(w=function(b){return{_hx_index:52,content:b,__enum__:"loreline.TokenType",toString:F}},w._hx_name="CommentMultiLine",w.__params__=["content"],w),CommentHash:(w=function(b){return{_hx_index:53,content:b,__enum__:"loreline.TokenType",toString:F}},w._hx_name="CommentHash",w.__params__=["content"],w),Indent:{_hx_name:"Indent",_hx_index:54,__enum__:"loreline.TokenType",toString:F},Unindent:{_hx_name:"Unindent",_hx_index:55,__enum__:"loreline.TokenType",toString:F},LineBreak:{_hx_name:"LineBreak",_hx_index:56,__enum__:"loreline.TokenType",toString:F},Eof:{_hx_name:"Eof",_hx_index:57,__enum__:"loreline.TokenType",toString:F}};k.__constructs__=[k.KwImport,k.KwState,k.KwBeat,k.KwCharacter,k.KwChoice,k.KwIf,k.KwElse,k.KwNew,k.KwSequence,k.KwCycle,k.KwOnce,k.KwPick,k.KwShuffle,k.Separator,k.Function,k.LString,k.LNumber,k.LBoolean,k.LNull,k.Identifier,k.OpAssign,k.OpPlusAssign,k.OpMinusAssign,k.OpMultiplyAssign,k.OpDivideAssign,k.OpUnquotedAssign,k.OpPlus,k.OpMinus,k.OpMultiply,k.OpDivide,k.OpModulo,k.OpEquals,k.OpNotEquals,k.OpGreater,k.OpLess,k.OpGreaterEq,k.OpLessEq,k.OpAnd,k.OpOr,k.OpNot,k.Arrow,k.Colon,k.Question,k.Comma,k.Dot,k.LBrace,k.RBrace,k.LParen,k.RParen,k.LBracket,k.RBracket,k.CommentLine,k.CommentMultiLine,k.CommentHash,k.Indent,k.Unindent,k.LineBreak,k.Eof];class Lt{static equals(e,t){switch(e._hx_index){case 1:return t._hx_index==1?!0:_e.enumEq(e,t);case 2:return t._hx_index==2?!0:_e.enumEq(e,t);case 3:return t._hx_index==3?!0:_e.enumEq(e,t);case 4:return t._hx_index==4?!0:_e.enumEq(e,t);case 5:return t._hx_index==5?!0:_e.enumEq(e,t);case 6:return t._hx_index==6?!0:_e.enumEq(e,t);case 7:return t._hx_index==7?!0:_e.enumEq(e,t);case 8:return t._hx_index==8?!0:_e.enumEq(e,t);case 9:return t._hx_index==9?!0:_e.enumEq(e,t);case 10:return t._hx_index==10?!0:_e.enumEq(e,t);case 11:return t._hx_index==11?!0:_e.enumEq(e,t);case 12:return t._hx_index==12?!0:_e.enumEq(e,t);case 13:return t._hx_index==13?!0:_e.enumEq(e,t);case 15:let l=e.s,i=e.attachments;if(t._hx_index==15){let r=t.s,a=t.attachments,h=t.quotes;return e.quotes==h}else return _e.enumEq(e,t);break;case 16:if(t._hx_index==16){let r=t.n;return e.n==r}else return _e.enumEq(e,t);break;case 17:if(t._hx_index==17){let r=t.b;return e.b==r}else return _e.enumEq(e,t);break;case 18:return t._hx_index==18?!0:_e.enumEq(e,t);case 19:if(t._hx_index==19){let r=t.name;return e.name==r}else return _e.enumEq(e,t);break;case 20:return t._hx_index==20?!0:_e.enumEq(e,t);case 21:return t._hx_index==21?!0:_e.enumEq(e,t);case 22:return t._hx_index==22?!0:_e.enumEq(e,t);case 23:return t._hx_index==23?!0:_e.enumEq(e,t);case 24:return t._hx_index==24?!0:_e.enumEq(e,t);case 25:return t._hx_index==25?!0:_e.enumEq(e,t);case 26:return t._hx_index==26?!0:_e.enumEq(e,t);case 27:return t._hx_index==27?!0:_e.enumEq(e,t);case 28:return t._hx_index==28?!0:_e.enumEq(e,t);case 29:return t._hx_index==29?!0:_e.enumEq(e,t);case 30:return t._hx_index==30?!0:_e.enumEq(e,t);case 31:return t._hx_index==31?!0:_e.enumEq(e,t);case 32:return t._hx_index==32?!0:_e.enumEq(e,t);case 33:return t._hx_index==33?!0:_e.enumEq(e,t);case 34:return t._hx_index==34?!0:_e.enumEq(e,t);case 35:return t._hx_index==35?!0:_e.enumEq(e,t);case 36:return t._hx_index==36?!0:_e.enumEq(e,t);case 37:let n=e.word;if(t._hx_index==37){let r=t.word;return!0}else return _e.enumEq(e,t);break;case 38:let s=e.word;if(t._hx_index==38){let r=t.word;return!0}else return _e.enumEq(e,t);break;case 39:return t._hx_index==39?!0:_e.enumEq(e,t);case 40:return t._hx_index==40?!0:_e.enumEq(e,t);case 41:return t._hx_index==41?!0:_e.enumEq(e,t);case 42:return t._hx_index==42?!0:_e.enumEq(e,t);case 44:return t._hx_index==44?!0:_e.enumEq(e,t);case 45:return t._hx_index==45?!0:_e.enumEq(e,t);case 46:return t._hx_index==46?!0:_e.enumEq(e,t);case 47:return t._hx_index==47?!0:_e.enumEq(e,t);case 48:return t._hx_index==48?!0:_e.enumEq(e,t);case 49:return t._hx_index==49?!0:_e.enumEq(e,t);case 50:return t._hx_index==50?!0:_e.enumEq(e,t);case 51:if(t._hx_index==51){let r=t.content;return e.content==r}else return _e.enumEq(e,t);break;case 52:if(t._hx_index==52){let r=t.content;return e.content==r}else return _e.enumEq(e,t);break;case 53:if(t._hx_index==53){let r=t.content;return e.content==r}else return _e.enumEq(e,t);break;case 54:return t._hx_index==54?!0:_e.enumEq(e,t);case 55:return t._hx_index==55?!0:_e.enumEq(e,t);case 56:return t._hx_index==56?!0:_e.enumEq(e,t);case 57:return t._hx_index==57?!0:_e.enumEq(e,t);default:return _e.enumEq(e,t)}}static isComment(e){switch(e._hx_index){case 51:let t=e.content;return!0;case 52:let l=e.content;return!0;case 53:let i=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,l=e.args,i=e.code,n=e.external;return"function";case 15:let s=e.quotes,r=e.s,a=e.attachments;return"string";case 16:let h=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 m=e.content;return"comment";case 52:let f=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"}}}Q["loreline.TokenTypeHelpers"]=Lt,Lt.__name__="loreline.TokenTypeHelpers";class ye{constructor(e,t){this.type=e,this.pos=t}toString(){return""+Y.string(this.type)+" at "+this.pos.toString()}}Q["loreline.Token"]=ye,ye.__name__="loreline.Token",Object.assign(ye.prototype,{__class__:ye});class kt{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==k.Eof){if(this.indentStack.length>1){let l=this.indentStack.length-1,i=0,n=l;for(;i<n;){let s=i++,r=null;r==null&&(r=new ue(this.startLine,this.startColumn,this.pos)),r.length=this.pos-r.offset;let a=new ye(k.Unindent,r);this.previous=a,e.push(a)}}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 l;switch(this.nextBlock){case 0:case 1:l=0;break;case 2:case 3:l=2;break;case 4:case 5:l=4;break;case 6:case 7:l=7;break;case 8:case 9:l=8;break;case 10:case 11:case 12:l=10;break}this.stack.push(l),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 i;switch(this.nextBlock){case 0:case 1:i=1;break;case 2:case 3:i=3;break;case 4:case 5:i=5;break;case 6:case 7:i=7;break;case 8:case 9:i=9;break;case 10:case 11:case 12:i=11;break}this.stack.push(i),this.nextBlock=10;break;default:}}return e}nextToken(){if(this.indentTokens.length>0)return this.indentTokens.shift();if(this.skipWhitespace(),this.pos>=this.length){let i=null;i==null&&(i=new ue(this.startLine,this.startColumn,this.pos)),i.length=this.pos-i.offset;let n=new ye(k.Eof,i);return this.previous=n,n}this.startLine=this.line,this.startColumn=this.column;let e=c.cca(this.input,this.pos),t=e??-1;if(t==10||t==13){let i=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 ue(this.startLine,this.startColumn,this.pos)),r.length=this.pos-r.offset;let a=new ye(k.Indent,r);this.previous=a,s.push(a)}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 ue(this.startLine,this.startColumn,this.pos)),r.length=this.pos-r.offset;let a=new ye(k.Unindent,r);this.previous=a,s.push(a)}return i}let l=new ue(this.startLine,this.startColumn,this.pos);if(this.tokenized.length>0&&this.tokenized[this.tokenized.length-1].type==k.KwImport)return this.readImportValue(t,l);switch(t){case 34:let i=this.tryReadUnquotedString();return i??this.readString(l);case 91:let n=0,s=1;for(;n<s;){let x=n++;if(this.pos>=this.length)break;let y=c.cca(this.input,this.pos);(y??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.makeLooseOrStrictAfterBracket();let r=l;r==null&&(r=new ue(this.startLine,this.startColumn,this.pos)),r.length=this.pos-r.offset;let a=new ye(k.LBracket,r);return this.previous=a,a;case 123:let h=0,o=1;for(;h<o;){let x=h++;if(this.pos>=this.length)break;let y=c.cca(this.input,this.pos);(y??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let u=l;u==null&&(u=new ue(this.startLine,this.startColumn,this.pos)),u.length=this.pos-u.offset;let p=new ye(k.LBrace,u);return this.previous=p,p;case 125:let _=0,m=1;for(;_<m;){let x=_++;if(this.pos>=this.length)break;let y=c.cca(this.input,this.pos);(y??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let f=l;f==null&&(f=new ue(this.startLine,this.startColumn,this.pos)),f.length=this.pos-f.offset;let g=new ye(k.RBrace,f);return this.previous=g,g;default:let d=this.tryReadUnquotedString();if(d!=null)return d;switch(t){case 33:let x=t;if(x>=48&&x<=57)return this.readNumber();{let $=t;if($>=97&&$<=122||$>=65&&$<=90||$==95)return this.readIdentifier();{let se;if(this.pos+1<this.length){let j=c.cca(this.input,this.pos+1);se=j??-1}else se=0;if(se==61){let j=2;j==null&&(j=1);let ie=0,le=j;for(;ie<le;){let me=ie++;if(this.pos>=this.length)break;let we=c.cca(this.input,this.pos);(we??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ee=l;ee==null&&(ee=new ue(this.startLine,this.startColumn,this.pos)),ee.length=this.pos-ee.offset;let pe=new ye(k.OpNotEquals,ee);return this.previous=pe,pe}else{let j=0,ie=1;for(;j<ie;){let pe=j++;if(this.pos>=this.length)break;let me=c.cca(this.input,this.pos);(me??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let le=l;le==null&&(le=new ue(this.startLine,this.startColumn,this.pos)),le.length=this.pos-le.offset;let ee=new ye(k.OpNot,le);return this.previous=ee,ee}}}break;case 35:let y=t;if(y>=48&&y<=57)return this.readNumber();{let $=t;if($>=97&&$<=122||$>=65&&$<=90||$==95)return this.readIdentifier();{let se;if(this.pos+1<this.length){let j=c.cca(this.input,this.pos+1);se=j??-1}else se=0;return se>=97&&se<=122||se>=65&&se<=90||se==95||se>=48&&se<=57||se==45?this.readHashComment():(this.error("Unexpected character: #",!0),null)}}break;case 37:let S=t;if(S>=48&&S<=57)return this.readNumber();{let $=t;if($>=97&&$<=122||$>=65&&$<=90||$==95)return this.readIdentifier();{let se=0,j=1;for(;se<j;){let ee=se++;if(this.pos>=this.length)break;let pe=c.cca(this.input,this.pos);(pe??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ie=l;ie==null&&(ie=new ue(this.startLine,this.startColumn,this.pos)),ie.length=this.pos-ie.offset;let le=new ye(k.OpModulo,ie);return this.previous=le,le}}break;case 38:let C=t;if(C>=48&&C<=57)return this.readNumber();{let $=t;if($>=97&&$<=122||$>=65&&$<=90||$==95)return this.readIdentifier();{let se;if(this.pos+1<this.length){let j=c.cca(this.input,this.pos+1);se=j??-1}else se=0;if(se==38){let j=2;j==null&&(j=1);let ie=0,le=j;for(;ie<le;){let me=ie++;if(this.pos>=this.length)break;let we=c.cca(this.input,this.pos);(we??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ee=l;ee==null&&(ee=new ue(this.startLine,this.startColumn,this.pos)),ee.length=this.pos-ee.offset;let pe=new ye(k.OpAnd(!1),ee);return this.previous=pe,pe}else{let j=0,ie=1;for(;j<ie;){let pe=j++;if(this.pos>=this.length)break;let me=c.cca(this.input,this.pos);(me??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.error("Expected &",!1);let le=l;le==null&&(le=new ue(this.startLine,this.startColumn,this.pos)),le.length=this.pos-le.offset;let ee=new ye(k.OpAnd(!1),le);return this.previous=ee,ee}}}break;case 40:let O=0,E=1;for(;O<E;){let $=O++;if(this.pos>=this.length)break;let se=c.cca(this.input,this.pos);(se??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.makeStrictIfFollowingCallable();let v=l;v==null&&(v=new ue(this.startLine,this.startColumn,this.pos)),v.length=this.pos-v.offset;let N=new ye(k.LParen,v);return this.previous=N,N;case 41:let B=0,L=1;for(;B<L;){let $=B++;if(this.pos>=this.length)break;let se=c.cca(this.input,this.pos);(se??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.strictExprs.pop();let I=l;I==null&&(I=new ue(this.startLine,this.startColumn,this.pos)),I.length=this.pos-I.offset;let W=new ye(k.RParen,I);return this.previous=W,W;case 42:let q=t;if(q>=48&&q<=57)return this.readNumber();{let $=t;if($>=97&&$<=122||$>=65&&$<=90||$==95)return this.readIdentifier();{let se;if(this.pos+1<this.length){let j=c.cca(this.input,this.pos+1);se=j??-1}else se=0;if(se==61){let j=2;j==null&&(j=1);let ie=0,le=j;for(;ie<le;){let me=ie++;if(this.pos>=this.length)break;let we=c.cca(this.input,this.pos);(we??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ee=l;ee==null&&(ee=new ue(this.startLine,this.startColumn,this.pos)),ee.length=this.pos-ee.offset;let pe=new ye(k.OpMultiplyAssign,ee);return this.previous=pe,pe}else{let j=0,ie=1;for(;j<ie;){let pe=j++;if(this.pos>=this.length)break;let me=c.cca(this.input,this.pos);(me??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let le=l;le==null&&(le=new ue(this.startLine,this.startColumn,this.pos)),le.length=this.pos-le.offset;let ee=new ye(k.OpMultiply,le);return this.previous=ee,ee}}}break;case 43:let P=t;if(P>=48&&P<=57)return this.readNumber();{let $=t;if($>=97&&$<=122||$>=65&&$<=90||$==95)return this.readIdentifier();{let se;if(this.pos+1<this.length){let j=c.cca(this.input,this.pos+1);se=j??-1}else se=0;if(se==61){let j=2;j==null&&(j=1);let ie=0,le=j;for(;ie<le;){let me=ie++;if(this.pos>=this.length)break;let we=c.cca(this.input,this.pos);(we??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ee=l;ee==null&&(ee=new ue(this.startLine,this.startColumn,this.pos)),ee.length=this.pos-ee.offset;let pe=new ye(k.OpPlusAssign,ee);return this.previous=pe,pe}else{let j=0,ie=1;for(;j<ie;){let pe=j++;if(this.pos>=this.length)break;let me=c.cca(this.input,this.pos);(me??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let le=l;le==null&&(le=new ue(this.startLine,this.startColumn,this.pos)),le.length=this.pos-le.offset;let ee=new ye(k.OpPlus,le);return this.previous=ee,ee}}}break;case 44:let R=0,M=1;for(;R<M;){let $=R++;if(this.pos>=this.length)break;let se=c.cca(this.input,this.pos);(se??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let D=l;D==null&&(D=new ue(this.startLine,this.startColumn,this.pos)),D.length=this.pos-D.offset;let U=new ye(k.Comma,D);return this.previous=U,U;case 45:let z=t;if(z>=48&&z<=57)return this.readNumber();{let $=t;if($>=97&&$<=122||$>=65&&$<=90||$==95)return this.readIdentifier();{let se;if(this.pos+1<this.length){let j=c.cca(this.input,this.pos+1);se=j??-1}else se=0;if(se==62){let j=2;j==null&&(j=1);let ie=0,le=j;for(;ie<le;){let me=ie++;if(this.pos>=this.length)break;let we=c.cca(this.input,this.pos);(we??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ee=l;ee==null&&(ee=new ue(this.startLine,this.startColumn,this.pos)),ee.length=this.pos-ee.offset;let pe=new ye(k.Arrow,ee);return this.previous=pe,pe}else{let j;if(this.pos+1<this.length){let ie=c.cca(this.input,this.pos+1);j=ie??-1}else j=0;if(j==45&&this.strictExprs.length==0){let ie=2;ie==null&&(ie=1);let le=0,ee=ie;for(;le<ee;){let we=le++;if(this.pos>=this.length)break;let Ze=c.cca(this.input,this.pos);(Ze??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let pe=l;pe==null&&(pe=new ue(this.startLine,this.startColumn,this.pos)),pe.length=this.pos-pe.offset;let me=new ye(k.Separator,pe);return this.previous=me,me}else{let ie;if(this.pos+1<this.length){let le=c.cca(this.input,this.pos+1);ie=le??-1}else ie=0;if(ie==61){let le=2;le==null&&(le=1);let ee=0,pe=le;for(;ee<pe;){let Ze=ee++;if(this.pos>=this.length)break;let yt=c.cca(this.input,this.pos);(yt??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let me=l;me==null&&(me=new ue(this.startLine,this.startColumn,this.pos)),me.length=this.pos-me.offset;let we=new ye(k.OpMinusAssign,me);return this.previous=we,we}else{let le=0,ee=1;for(;le<ee;){let we=le++;if(this.pos>=this.length)break;let Ze=c.cca(this.input,this.pos);(Ze??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let pe=l;pe==null&&(pe=new ue(this.startLine,this.startColumn,this.pos)),pe.length=this.pos-pe.offset;let me=new ye(k.OpMinus,pe);return this.previous=me,me}}}}}break;case 46:let J=0,H=1;for(;J<H;){let $=J++;if(this.pos>=this.length)break;let se=c.cca(this.input,this.pos);(se??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let X=l;X==null&&(X=new ue(this.startLine,this.startColumn,this.pos)),X.length=this.pos-X.offset;let ae=new ye(k.Dot,X);return this.previous=ae,ae;case 47:let ce=t;if(ce>=48&&ce<=57)return this.readNumber();{let $=t;if($>=97&&$<=122||$>=65&&$<=90||$==95)return this.readIdentifier();{let se;if(this.pos+1<this.length){let j=c.cca(this.input,this.pos+1);se=j??-1}else se=0;if(se==61){let j=2;j==null&&(j=1);let ie=0,le=j;for(;ie<le;){let me=ie++;if(this.pos>=this.length)break;let we=c.cca(this.input,this.pos);(we??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ee=l;ee==null&&(ee=new ue(this.startLine,this.startColumn,this.pos)),ee.length=this.pos-ee.offset;let pe=new ye(k.OpDivideAssign,ee);return this.previous=pe,pe}else{let j;if(this.pos+1<this.length){let ie=c.cca(this.input,this.pos+1);j=ie??-1}else j=0;if(j==47)return this.readLineComment();{let ie;if(this.pos+1<this.length){let le=c.cca(this.input,this.pos+1);ie=le??-1}else ie=0;if(ie==42)return this.readMultiLineComment();{let le=0,ee=1;for(;le<ee;){let we=le++;if(this.pos>=this.length)break;let Ze=c.cca(this.input,this.pos);(Ze??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let pe=l;pe==null&&(pe=new ue(this.startLine,this.startColumn,this.pos)),pe.length=this.pos-pe.offset;let me=new ye(k.OpDivide,pe);return this.previous=me,me}}}}}break;case 58:let ne;if(this.pos+1<this.length){let $=c.cca(this.input,this.pos+1);ne=$??-1}else ne=0;if(ne==61){let $=2;$==null&&($=1);let se=0,j=$;for(;se<j;){let ee=se++;if(this.pos>=this.length)break;let pe=c.cca(this.input,this.pos);(pe??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ie=l;ie==null&&(ie=new ue(this.startLine,this.startColumn,this.pos)),ie.length=this.pos-ie.offset;let le=new ye(k.OpUnquotedAssign,ie);return this.previous=le,le}else{let $=0,se=1;for(;$<se;){let le=$++;if(this.pos>=this.length)break;let ee=c.cca(this.input,this.pos);(ee??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let j=l;j==null&&(j=new ue(this.startLine,this.startColumn,this.pos)),j.length=this.pos-j.offset;let ie=new ye(k.Colon,j);return this.previous=ie,ie}break;case 60:let re=t;if(re>=48&&re<=57)return this.readNumber();{let $=t;if($>=97&&$<=122||$>=65&&$<=90||$==95)return this.readIdentifier();{let se;if(this.pos+1<this.length){let j=c.cca(this.input,this.pos+1);se=j??-1}else se=0;if(se==61){let j=2;j==null&&(j=1);let ie=0,le=j;for(;ie<le;){let me=ie++;if(this.pos>=this.length)break;let we=c.cca(this.input,this.pos);(we??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ee=l;ee==null&&(ee=new ue(this.startLine,this.startColumn,this.pos)),ee.length=this.pos-ee.offset;let pe=new ye(k.OpLessEq,ee);return this.previous=pe,pe}else{let j=0,ie=1;for(;j<ie;){let pe=j++;if(this.pos>=this.length)break;let me=c.cca(this.input,this.pos);(me??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let le=l;le==null&&(le=new ue(this.startLine,this.startColumn,this.pos)),le.length=this.pos-le.offset;let ee=new ye(k.OpLess,le);return this.previous=ee,ee}}}break;case 61:let xe=t;if(xe>=48&&xe<=57)return this.readNumber();{let $=t;if($>=97&&$<=122||$>=65&&$<=90||$==95)return this.readIdentifier();{let se;if(this.pos+1<this.length){let j=c.cca(this.input,this.pos+1);se=j??-1}else se=0;if(se==61){let j=2;j==null&&(j=1);let ie=0,le=j;for(;ie<le;){let me=ie++;if(this.pos>=this.length)break;let we=c.cca(this.input,this.pos);(we??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ee=l;ee==null&&(ee=new ue(this.startLine,this.startColumn,this.pos)),ee.length=this.pos-ee.offset;let pe=new ye(k.OpEquals,ee);return this.previous=pe,pe}else{let j=0,ie=1;for(;j<ie;){let pe=j++;if(this.pos>=this.length)break;let me=c.cca(this.input,this.pos);(me??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let le=l;le==null&&(le=new ue(this.startLine,this.startColumn,this.pos)),le.length=this.pos-le.offset;let ee=new ye(k.OpAssign,le);return this.previous=ee,ee}}}break;case 62:let Pe=t;if(Pe>=48&&Pe<=57)return this.readNumber();{let $=t;if($>=97&&$<=122||$>=65&&$<=90||$==95)return this.readIdentifier();{let se;if(this.pos+1<this.length){let j=c.cca(this.input,this.pos+1);se=j??-1}else se=0;if(se==61){let j=2;j==null&&(j=1);let ie=0,le=j;for(;ie<le;){let me=ie++;if(this.pos>=this.length)break;let we=c.cca(this.input,this.pos);(we??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ee=l;ee==null&&(ee=new ue(this.startLine,this.startColumn,this.pos)),ee.length=this.pos-ee.offset;let pe=new ye(k.OpGreaterEq,ee);return this.previous=pe,pe}else{let j=0,ie=1;for(;j<ie;){let pe=j++;if(this.pos>=this.length)break;let me=c.cca(this.input,this.pos);(me??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let le=l;le==null&&(le=new ue(this.startLine,this.startColumn,this.pos)),le.length=this.pos-le.offset;let ee=new ye(k.OpGreater,le);return this.previous=ee,ee}}}break;case 63:let Ue=t;if(Ue>=48&&Ue<=57)return this.readNumber();{let $=t;if($>=97&&$<=122||$>=65&&$<=90||$==95)return this.readIdentifier();{this.pos++;let se=null;se==null&&(se=new ue(this.startLine,this.startColumn,this.pos)),se.length=this.pos-se.offset;let j=new ye(k.Question,se);return this.previous=j,j}}break;case 93:let Je=0,lt=1;for(;Je<lt;){let $=Je++;if(this.pos>=this.length)break;let se=c.cca(this.input,this.pos);(se??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.strictExprs.pop();let Ve=l;Ve==null&&(Ve=new ue(this.startLine,this.startColumn,this.pos)),Ve.length=this.pos-Ve.offset;let Qe=new ye(k.RBracket,Ve);return this.previous=Qe,Qe;case 124:let at=t;if(at>=48&&at<=57)return this.readNumber();{let $=t;if($>=97&&$<=122||$>=65&&$<=90||$==95)return this.readIdentifier();{let se;if(this.pos+1<this.length){let j=c.cca(this.input,this.pos+1);se=j??-1}else se=0;if(se==124){let j=2;j==null&&(j=1);let ie=0,le=j;for(;ie<le;){let me=ie++;if(this.pos>=this.length)break;let we=c.cca(this.input,this.pos);(we??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ee=l;ee==null&&(ee=new ue(this.startLine,this.startColumn,this.pos)),ee.length=this.pos-ee.offset;let pe=new ye(k.OpOr(!1),ee);return this.previous=pe,pe}else{let j=0,ie=1;for(;j<ie;){let pe=j++;if(this.pos>=this.length)break;let me=c.cca(this.input,this.pos);(me??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.error("Expected |",!1);let le=l;le==null&&(le=new ue(this.startLine,this.startColumn,this.pos)),le.length=this.pos-le.offset;let ee=new ye(k.OpOr(!1),le);return this.previous=ee,ee}}}break;default:let Re=t;if(Re>=48&&Re<=57)return this.readNumber();{let $=t;return $>=97&&$<=122||$>=65&&$<=90||$==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=c.cca(this.input,e),s=n??-1;if(s==32)++t;else if(s==9)++t;else break;++e}let l,i;if(e<this.length){let n=c.cca(this.input,e);i=(n??-1)==10}else i=!0;if(i)l=!0;else{let n=c.cca(this.input,e);l=(n??-1)==13}return l?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 k.KwBeat;case 2:case 3:return k.KwState;case 4:case 5:return k.KwCharacter;case 6:case 7:return k.KwBeat;case 8:case 9:return k.KwBeat;case 10:return k.LBrace;case 11:return k.Indent;case 12:return k.LBracket}--e}return k.KwBeat}inBeat(){return this.parentBlockType()==k.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!=k.KwState?e==k.KwCharacter:!0}readLineBreak(){let e=new ue(this.startLine,this.startColumn,this.pos),t=c.cca(this.input,this.pos);if((t??-1)==13){let n=0,s=1;for(;n<s;){let a=n++;if(this.pos>=this.length)break;let h=c.cca(this.input,this.pos);(h??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let r;if(this.pos<this.length){let a=c.cca(this.input,this.pos);r=(a??-1)==10}else r=!1;if(r){let a=0,h=1;for(;a<h;){let o=a++;if(this.pos>=this.length)break;let u=c.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 a=c.cca(this.input,this.pos);(a??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let l=e;l==null&&(l=new ue(this.startLine,this.startColumn,this.pos)),l.length=this.pos-l.offset;let i=new ye(k.LineBreak,l);return this.previous=i,i}isWhitespace(e){return e!=32?e==9:!0}matchIdentifier(e){if(this.length==0)return null;let t=c.cca(this.input,e),l=t??-1;if(!(l>=97&&l<=122||l>=65&&l<=90||l==95))return null;let i=1;for(;i<this.length;){let s=c.cca(this.input,e+i),r=s??-1;if(!(r>=97&&r<=122||r>=65&&r<=90||r==95||r>=48&&r<=57))break;++i}let n=this.input;return i!=null?c.substr(n,e,i):c.substr(n,e,null)}_skipWhitespaceAndComments(e,t){if(t==null&&(t=!1),t)return this._skipWhitespaceAndCommentsStopNextLine(e);{let l=e,i=!1;for(;e<this.length;){for(;;){let n;if(e<this.length){let s=c.cca(this.input,e);if((s??-1)!=32){let r=c.cca(this.input,e);n=(r??-1)==9}else n=!0}else n=!1;if(!n)break;++e,i=!0}if(e<this.length-1){let n=c.cca(this.input,e);if((n??-1)==47){let s=c.cca(this.input,e+1);if((s??-1)==47)return e=l,e;{let r=c.cca(this.input,e+1);if((r??-1)==42){e+=2,i=!0;let a=!1;for(;e<this.length-1;){let h,o=c.cca(this.input,e);if((o??-1)==42){let u=c.cca(this.input,e+1);h=(u??-1)==47}else h=!1;if(h){e+=2,a=!0;break}++e}if(!a)return e=l,e;continue}}}}break}return i?e:l}}_skipWhitespaceAndCommentsStopNextLine(e){let t=e,l=!1,i=!1;for(;e<this.length;){for(;e<this.length;){let n=c.cca(this.input,e),s=n??-1;if(s==32||s==9||s==13||!i&&s==10)s==10&&(i=!0),++e,l=!0;else break}if(e<this.length-1&&!i){let n=c.cca(this.input,e);if((n??-1)==47){let s=c.cca(this.input,e+1);if((s??-1)==47){for(e+=2,l=!0;;){let r,a;if(e<this.length){let h=c.cca(this.input,e);a=(h??-1)!=10}else a=!1;if(a){let h=c.cca(this.input,e);r=(h??-1)!=13}else r=!1;if(!r)break;++e}continue}else{let r=c.cca(this.input,e+1);if((r??-1)==42){e+=2,l=!0;let a=!1;for(;e<this.length-1;){let h,o=c.cca(this.input,e);if((o??-1)==42){let u=c.cca(this.input,e+1);h=(u??-1)==47}else h=!1;if(h){e+=2,a=!0;break}++e}if(!a)return e=t,e;continue}}}}break}return l?e:t}isIfStart(e){e=this._skipWhitespaceAndComments(e,!1);let t=c.cca(this.input,e);if((t??-1)!=105)return!1;++e;let l=c.cca(this.input,e);if((l??-1)!=102)return!1;let i=++e;e=this._skipWhitespaceAndComments(e,!1);let n;if(e<this.length){let o=c.cca(this.input,e);n=(o??-1)==33}else n=!1;n&&(++e,e=this._skipWhitespaceAndComments(e,!1));let s=c.cca(this.input,e);if((s??-1)==40)return!0;let r;if(e==i&&i<this.length){let o=c.cca(this.input,i),u=o??-1;r=u>=97&&u<=122||u>=65&&u<=90||u==95}else r=!1;if(r)return!1;let a;if(e<this.length){let o=c.cca(this.input,e),u=o??-1;a=!(u>=97&&u<=122||u>=65&&u<=90||u==95)}else a=!0;if(a)return!1;let h=this;for(;e<this.length;){let o=c.cca(this.input,e);if((o??-1)==40)return!0;{let C=!0,O=h.length;if(e>=O)C=!1;else{let E,v,N;if(e+1<O){let B=c.cca(h.input,e);N=(B??-1)==111}else N=!1;if(N){let B=c.cca(h.input,e+1);v=(B??-1)==114}else v=!1;if(v)if(e+2<O){let B=c.cca(h.input,e+2),L=B??-1;E=!(L>=97&&L<=122||L>=65&&L<=90||L==95)}else E=!0;else E=!1;if(E)C=!1;else{let B,L,I,W;if(e+2<O){let q=c.cca(h.input,e);W=(q??-1)==97}else W=!1;if(W){let q=c.cca(h.input,e+1);I=(q??-1)==110}else I=!1;if(I){let q=c.cca(h.input,e+2);L=(q??-1)==100}else L=!1;if(L)if(e+3<O){let q=c.cca(h.input,e+3),P=q??-1;B=!(P>=97&&P<=122||P>=65&&P<=90||P==95)}else B=!0;else B=!1;if(B)C=!1;else{let q=c.cca(h.input,e),P=q??-1;if(!(P>=97&&P<=122||P>=65&&P<=90||P==95))C=!1;else for(++e;e<h.length;){let R=c.cca(h.input,e);if(P=R??-1,!(P>=97&&P<=122||P>=65&&P<=90||P==95||P>=48&&P<=57))break;++e}}}}if(!C)return!1}if(e=this._skipWhitespaceAndComments(e,!1),e>=this.length)return!0;let u=c.cca(this.input,e),p=u??-1;if(p==46){++e,e=this._skipWhitespaceAndComments(e,!1);let C=!0,O=h.length;if(e>=O)C=!1;else{let v,N,B;if(e+1<O){let L=c.cca(h.input,e);B=(L??-1)==111}else B=!1;if(B){let L=c.cca(h.input,e+1);N=(L??-1)==114}else N=!1;if(N)if(e+2<O){let L=c.cca(h.input,e+2),I=L??-1;v=!(I>=97&&I<=122||I>=65&&I<=90||I==95)}else v=!0;else v=!1;if(v)C=!1;else{let L,I,W,q;if(e+2<O){let P=c.cca(h.input,e);q=(P??-1)==97}else q=!1;if(q){let P=c.cca(h.input,e+1);W=(P??-1)==110}else W=!1;if(W){let P=c.cca(h.input,e+2);I=(P??-1)==100}else I=!1;if(I)if(e+3<O){let P=c.cca(h.input,e+3),R=P??-1;L=!(R>=97&&R<=122||R>=65&&R<=90||R==95)}else L=!0;else L=!1;if(L)C=!1;else{let P=c.cca(h.input,e),R=P??-1;if(!(R>=97&&R<=122||R>=65&&R<=90||R==95))C=!1;else for(++e;e<h.length;){let M=c.cca(h.input,e);if(R=M??-1,!(R>=97&&R<=122||R>=65&&R<=90||R==95||R>=48&&R<=57))break;++e}}}}if(!C||(e=this._skipWhitespaceAndComments(e,!1),e>=this.length))return!0;let E=c.cca(this.input,e);p=E??-1}if(p==91){++e;let C=1;for(;e<this.length&&C>0;){let E=c.cca(this.input,e);p=E??-1,p==91&&++C,p==93&&--C,++e}if(e=this._skipWhitespaceAndComments(e,!1),e>=this.length)return!0;let O=c.cca(this.input,e);p=O??-1}let _,m,f;if(p==97){let C=c.cca(this.input,e+1);f=(C??-1)==110}else f=!1;if(f){let C=c.cca(this.input,e+2);m=(C??-1)==100}else m=!1;if(m)if(e+3<this.length){let C=c.cca(this.input,e+3),O=C??-1;_=!(O>=97&&O<=122||O>=65&&O<=90||O==95)}else _=!0;else _=!1;if(_)return!0;let g,d;if(p==111){let C=c.cca(this.input,e+1);d=(C??-1)==114}else d=!1;if(d)if(e+2<this.length){let C=c.cca(this.input,e+2),O=C??-1;g=!(O>=97&&O<=122||O>=65&&O<=90||O==95)}else g=!0;else g=!1;if(g)return!0;let x,y,S;if(p==40||p==38||p==124)S=!0;else{let C=c.cca(this.input,e+1);S=(C??-1)==61&&p==61}if(S||p==62||p==60)y=!0;else if(p==33){let C=c.cca(this.input,e+1);y=(C??-1)==61}else y=!1;if(y)x=!0;else{let C=c.cca(this.input,e+1);x=(C??-1)!=61&&(p==43||p==45||p==42||p==47||p==123)}if(x)return!0;if(p==10||p==13||e>=this.length)return e=i,!0;if(p==32||p==9){let C=e;for(;;){let v;if(C<this.length){let N=c.cca(this.input,C),B=N??-1;v=B==32||B==9}else v=!1;if(!v)break;++C}let O,E;if(C+1<this.length){let v=c.cca(this.input,C);E=(v??-1)==47}else E=!1;if(E){let v=c.cca(this.input,C+1);O=(v??-1)==47}else O=!1;if(O)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 l=c.cca(this.input,e);if((l??-1)==40)return!0;let i=this,n=t;n==null&&(n=!1);let s=!0;if(e>=i.length)s=!1;else{let r=!1,a=c.cca(i.input,e),h=a??-1;if(r=h==95,!(h>=97&&h<=122||h>=65&&h<=90||h==95)||n&&!r&&!(h>=97&&h<=122))s=!1;else for(++e;e<i.length;){let o=r,u=c.cca(i.input,e);if(h=u??-1,r=h==95,!(h>=97&&h<=122||h>=65&&h<=90||h==95||h>=48&&h<=57))break;if(n&&o&&!r&&!(h>=97&&h<=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=c.cca(this.input,e),a=r??-1;if(!(a==32||a==9)&&a!=46&&a!=91&&a!=10&&a!=13&&a!=47)return!1;let h;if(a==10||a==13)h=!0;else if(a==47&&e+1<this.length){let o=c.cca(this.input,e+1);if((o??-1)!=47){let u=c.cca(this.input,e+1);h=(u??-1)==42}else h=!0}else h=!1;if(h)return!0;if(a==46){if(++e,e=this._skipWhitespaceAndComments(e,!1),e>=this.length)return!0;let o=!0;if(e>=i.length)o=!1;else{let u=!1,p=c.cca(i.input,e),_=p??-1;if(u=_==95,!(_>=97&&_<=122||_>=65&&_<=90||_==95))o=!1;else for(++e;e<i.length;){let m=u,f=c.cca(i.input,e);if(_=f??-1,u=_==95,!(_>=97&&_<=122||_>=65&&_<=90||_==95||_>=48&&_<=57))break;++e}}if(!o)return!0;continue}if(a==91){++e;let o=1;for(;e<this.length&&o>0;){let u=c.cca(this.input,e);if(a=u??-1,a==34){if(e=this.scanStringEnd(e,!1),e==-1)return!1;continue}a==91&&++o,a==93&&--o,++e}continue}if(a==32||a==9){++e;continue}break}return!0}isTransitionStart(e){let t,l=c.cca(this.input,e);if((l??-1)!=45||e>=this.length-1)t=!0;else{let s=c.cca(this.input,e+1);t=(s??-1)!=62}if(t||(e+=2,e=this._skipWhitespaceAndComments(e,!1),e>=this.length))return!1;let i=c.cca(this.input,e);if((i??-1)==46)++e;else{let s=c.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 a;if(e<this.length){let h=c.cca(this.input,e),o=h??-1;a=o>=97&&o<=122||o>=65&&o<=90||o==95||o>=48&&o<=57}else a=!1;if(!a)break;++e}else return!1}if(e=this._skipWhitespaceAndComments(e,!1),e<this.length){let s=c.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=c.cca(this.input,e);if((t??-1)!=43||(++e,e=this._skipWhitespaceAndComments(e,!1),e>=this.length))return!1;let l=c.cca(this.input,e);if((l??-1)==46)++e;else{let n=c.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 a=c.cca(this.input,e),h=a??-1;r=h>=97&&h<=122||h>=65&&h<=90||h==95||h>=48&&h<=57}else r=!1;if(!r)break;++e}else return!1}if(e=this._skipWhitespaceAndComments(e,!1),e<this.length){let n=c.cca(this.input,e),s=n??-1,r;if(s==105&&e+1<this.length){let a=c.cca(this.input,e+1);r=(a??-1)==102}else r=!1;if(r){let a;if(e+2<this.length){let h=c.cca(this.input,e+2),o=h??-1;a=!(o>=97&&o<=122||o>=65&&o<=90||o==95||o>=48&&o<=57)}else a=!0;if(a)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=c.cca(this.input,e);if((t??-1)!=45||(++e,e>=this.length))return!1;let l=c.cca(this.input,e);return(l??-1)==32}isLabelStart(e){e=this._skipWhitespaceAndComments(e,!1);let t=c.cca(this.input,e),l=t??-1;if(!(l>=97&&l<=122||l>=65&&l<=90||l==95))return!1;let i=e;for(++e;;){let h;if(e<this.length){let o=c.cca(this.input,e),u=o??-1;h=u>=97&&u<=122||u>=65&&u<=90||u==95||u>=48&&u<=57}else h=!1;if(!h)break;++e}for(;;){let h;if(e<this.length){let o=c.cca(this.input,e),u=o??-1;h=u==32||u==9}else h=!1;if(!h)break;++e}let n;if(e<this.length){let h=c.cca(this.input,e);n=(h??-1)!=58}else n=!0;if(n)return!1;let s=this.input,r=e-i,a=r!=null?c.substr(s,i,r):c.substr(s,i,null);return!Object.prototype.hasOwnProperty.call(kt.KEYWORDS.h,a)}isCallStart(e){let t=e,l=this,i=!0;if(e>=l.length)i=!1;else{let n=c.cca(l.input,e),s=n??-1;if(!(s>=97&&s<=122||s>=65&&s<=90||s==95))i=!1;else for(++e;e<l.length;){let r=c.cca(l.input,e);if(s=r??-1,!(s>=97&&s<=122||s>=65&&s<=90||s==95||s>=48&&s<=57))break;++e}}if(!i)return e=t,!1;for(;e<this.length;){if(e=this._skipWhitespaceAndComments(e,!1),e>=this.length)return e=t,!1;let n=c.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>=l.length)r=!1;else{let a=c.cca(l.input,e),h=a??-1;if(!(h>=97&&h<=122||h>=65&&h<=90||h==95))r=!1;else for(++e;e<l.length;){let o=c.cca(l.input,e);if(h=o??-1,!(h>=97&&h<=122||h>=65&&h<=90||h==95||h>=48&&h<=57))break;++e}}if(!r)return e=t,!1;continue}if(s==91){for(++e;e<this.length;){let r=c.cca(this.input,e),a=r??-1;if(a==34){if(e=this.scanStringEnd(e,!1),e==-1)return e=t,!1;continue}if(a==93){++e;break}++e}continue}return e=t,!1}return e=t,!1}isAssignStart(e,t){let l=this,i;if(t){let s=!0,r=e;if(e>=l.length)s=!1;else{let o=c.cca(l.input,e),u=o??-1;if(!(u>=97&&u<=122||u>=65&&u<=90||u==95))s=!1;else for(++e;e<l.length;){let p=c.cca(l.input,e);if(u=p??-1,!(u>=97&&u<=122||u>=65&&u<=90||u==95||u>=48&&u<=57))break;++e}}let a,h;if(e==r+2){let o=c.cca(l.input,r);h=(o??-1)==105}else h=!1;if(h){let o=c.cca(l.input,r+1);a=(o??-1)==102}else a=!1;i=!(!a&&s)}else i=!1;if(i)return!1;let n=!1;for(;e<this.length;){if(e=this._skipWhitespaceAndComments(e,!1),e>=this.length)return!1;let s=c.cca(this.input,e),r=s??-1,a;if(n)a=!1;else{let h;if(r==61)if(e+1<this.length){let o=c.cca(this.input,e+1);h=(o??-1)!=61}else h=!0;else h=!1;if(h)a=!0;else{let o=c.cca(this.input,e+1);a=(o??-1)==61&&(r==43||r==45||r==42||r==47||r==58)}}if(a)return!0;if(t){if(r==46){++e,e=this._skipWhitespaceAndComments(e,!1);let h=!0,o=e;if(e>=l.length)h=!1;else{let _=c.cca(l.input,e),m=_??-1;if(!(m>=97&&m<=122||m>=65&&m<=90||m==95))h=!1;else for(++e;e<l.length;){let f=c.cca(l.input,e);if(m=f??-1,!(m>=97&&m<=122||m>=65&&m<=90||m==95||m>=48&&m<=57))break;++e}}let u,p;if(e==o+2){let _=c.cca(l.input,o);p=(_??-1)==105}else p=!1;if(p){let _=c.cca(l.input,o+1);u=(_??-1)==102}else u=!1;if(!(!u&&h))return!1;continue}if(r==91){for(++e;e<this.length;){let h=c.cca(this.input,e),o=h??-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 h=!0,o=e;if(e>=l.length)h=!1;else{let _=c.cca(l.input,e),m=_??-1;if(!(m>=97&&m<=122||m>=65&&m<=90||m==95))h=!1;else for(++e;e<l.length;){let f=c.cca(l.input,e);if(m=f??-1,!(m>=97&&m<=122||m>=65&&m<=90||m==95||m>=48&&m<=57))break;++e}}let u,p;if(e==o+2){let _=c.cca(l.input,o);p=(_??-1)==105}else p=!1;if(p){let _=c.cca(l.input,o+1);u=(_??-1)==102}else u=!1;if(!(!u&&h))return!1}else{let h;if((r==61||r==33||r==60||r==62)&&e+1<this.length){let o=c.cca(this.input,e+1);h=(o??-1)==61}else h=!1;h?e+=2:++e}}}return!1}isColon(e,t){if(t==null&&(t=!0),t)for(;;){let l;if(e<this.length){let i=c.cca(this.input,e);if((i??-1)!=32){let n=c.cca(this.input,e);l=(n??-1)==9}else l=!0}else l=!1;if(!l)break;++e}if(e<this.length){let l=c.cca(this.input,e);return(l??-1)==58}else return!1}afterLabelIdentifierToken(e){e==null&&(e=!0);let t=this.tokenized.length-1;for(;t>=0;){let l=this.tokenized[t];if(!Lt.isComment(l.type)&&(e||l.type!=k.LineBreak&&l.type!=k.Indent&&l.type!=k.Unindent))return l.type==k.Colon&&t>0&&Lt.isIdentifier(this.tokenized[t-1].type)?t-1:-1;--t}return-1}isStartingMultilineDialogue(e){let t=this.tokenized[e],l=e+1;for(;this.tokenized[l].type!=k.Colon;)++l;let i=this.tokenized[l].pos.offset+1,n=t.pos.column,s=!0,r=!1;for(;i<this.length;){let g=c.cca(this.input,i),d=g??-1;if(d==32||d==9)++i;else break}for(;i<this.length;){let g=c.cca(this.input,i),d=g??-1;if(d==10||d==13)break;if(d==47&&i+1<this.length){let x=c.cca(this.input,i+1),y=x??-1;if(y==47)break;if(y==42){for(i+=2;i<this.length;){let S,C=c.cca(this.input,i);if((C??-1)==42&&i+1<this.length){let O=c.cca(this.input,i+1);S=(O??-1)==47}else S=!1;if(S){i+=2;break}++i}continue}}if(d==60)r=!0;else if(d==62)r=!1;else if(!r&&!(d==32||d==9)){s=!1;break}++i}if(!s)for(;;){let g,d;if(i<this.length){let x=c.cca(this.input,i);d=(x??-1)!=10}else d=!1;if(d){let x=c.cca(this.input,i);g=(x??-1)!=13}else g=!1;if(!g)break;++i}let a=i,h=!0;if(h==null&&(h=!1),i=this._skipWhitespaceAndComments(i,h),i<=a)return-1;let o=0,u=i;for(;;){let g;if(u>0){let d=c.cca(this.input,u-1);if((d??-1)!=32){let x=c.cca(this.input,u-1);g=(x??-1)==9}else g=!0}else g=!1;if(!g)break;++o,--u}if(o<=n-1)return-1;let p=!1;p==null&&(p=!1),i=this._skipWhitespaceAndComments(i,p);let _,m=c.cca(this.input,i),f=m??-1;if(f==32||f==9)_=!0;else{let g=c.cca(this.input,i);if((g??-1)==47){let d=c.cca(this.input,i+1);_=(d??-1)==47}else _=!1}return _?-1:o}isContinuingMultilineText(e,t){let l,i=c.cca(this.input,e);if((i??-1)==47){let m=c.cca(this.input,e+1);l=(m??-1)==47}else l=!1;if(l)for(;;){let m,f;if(e<this.length){let g=c.cca(this.input,e);f=(g??-1)!=13}else f=!1;if(f){let g=c.cca(this.input,e);m=(g??-1)!=10}else m=!1;if(!m)break;++e}let n=c.cca(this.input,e);(n??-1)==13&&++e;let s=c.cca(this.input,e);if((s??-1)==10)++e;else return!1;let r=0;for(;;){let m,f=c.cca(this.input,e);if((f??-1)!=32){let g=c.cca(this.input,e);m=(g??-1)==9}else m=!0;if(!m)break;++r,++e}if(r!=t)return!1;let a=!1;a==null&&(a=!1),e=this._skipWhitespaceAndComments(e,a);let h,o,u,p=c.cca(this.input,e),_=p??-1;if(_==32||_==9)u=!0;else{let m=c.cca(this.input,e);u=(m??-1)==13}if(u)o=!0;else{let m=c.cca(this.input,e);o=(m??-1)==10}if(o)h=!0;else{let m=c.cca(this.input,e);if((m??-1)==47){let f=c.cca(this.input,e+1);h=(f??-1)==47}else h=!1}return!h}isAfterComma(){let e=this.tokenized.length-1;for(;e>=0;){let t=this.tokenized[e];if(!Lt.isComment(t.type)&&t.type!=k.LineBreak&&t.type!=k.Indent&&t.type!=k.Unindent)return t.type==k.Comma;--e}return!1}isAfterLBracket(){let e=this.tokenized.length-1;for(;e>=0;){let t=this.tokenized[e];if(!Lt.isComment(t.type)&&t.type!=k.LineBreak&&t.type!=k.Indent&&t.type!=k.Unindent)return t.type==k.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(Lt.isComment(t.type)||t.type==k.Indent||t.type==k.Unindent)--e;else return!!Lt.isAssignOp(t.type)}return!1}followsUnquotedAssign(){let e=this.tokenized.length-1;for(;e>=0;){let t=this.tokenized[e];if(Lt.isComment(t.type)||t.type==k.Indent||t.type==k.Unindent)--e;else return t.type==k.OpUnquotedAssign}return!1}followsOnlyLabelOrCommentsInLine(){let e=!1,t=this.tokenized.length-1;for(;t>=0;){let l=this.tokenized[t];if(Lt.isComment(l.type)||l.type==k.Indent||l.type==k.Unindent)--t;else if(!e&&l.type==k.Colon)if(--t,t>=0)Lt.isIdentifier(this.tokenized[t].type)&&(e=!0,--t);else return!1;else return l.type==k.LineBreak}return!0}followsOnlyWhitespacesOrCommentsInLine(){let e=this.tokenized.length-1;for(;e>=0;){let t=this.tokenized[e];if(Lt.isComment(t.type)||t.type==k.Indent||t.type==k.Unindent)--e;else return t.type==k.LineBreak}return!0}followsChoiceOncePrefix(){if(!this.inChoiceRoot())return!1;let e=this.tokenized.length-1;for(;e>=0;){let t=this.tokenized[e];if(Lt.isComment(t.type)||t.type==k.Indent||t.type==k.Unindent)--e;else return t.type==k.OpMinus}return!1}hasNonSpecialChar(e){let t=0,l=e.length;for(;t<l;){let i=t++,n=!1,s=c.cca(e,i),r=s??-1,a=0,h=kt.hasNonSpecialChar_specialChars.length;for(;a<h;){let o=a++,u=c.cca(kt.hasNonSpecialChar_specialChars,o);if(r==(u??-1)){n=!0;break}}if(!n)return!0}return!1}isNumber(e){let t=0,l=e.length,i;if(t<l){let a=c.cca(e,t);i=(a??-1)==45}else i=!1;i&&++t;let n=t;for(;;){let a;if(t<l){let h=c.cca(e,t),o=h??-1;a=o>=48&&o<=57}else a=!1;if(!a)break;++t}if(t==n)return!1;let s,r;if(t<l){let a=c.cca(e,t);r=(a??-1)==46}else r=!1;if(r&&t+1<l){let a=c.cca(e,t+1),h=a??-1;s=h>=48&&h<=57}else s=!1;if(s)for(++t;;){let a;if(t<l){let h=c.cca(e,t),o=h??-1;a=o>=48&&o<=57}else a=!1;if(!a)break;++t}return t==l}makeLooseOrStrictAfterBracket(){if(this.isStrict()){this.strictExprs.push(1);return}let e=this.tokenized.length-1;for(;e>=0;){let l=this.tokenized[e].type;switch(l._hx_index){case 19:let i=l.name;this.strictExprs.push(1);return;case 48:case 50:this.strictExprs.push(1);return;case 51:let n=l.content;break;case 52:let s=l.content;break;case 53:let r=l.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 l=this.tokenized[e].type;switch(l._hx_index){case 19:let i=l.name;return!0;case 48:case 50:return!0;case 51:let n=l.content;break;case 52:let s=l.content;break;case 53:let r=l.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 l="";for(;this.pos<this.length;){let r=c.cca(this.input,this.pos),a=r??-1;if(a==10)break;if(a==47&&this.pos+1<this.length){let h=c.cca(this.input,this.pos+1),o=h??-1;if(o==47||o==42)break}if(a==35&&this.pos+1<this.length){let h=c.cca(this.input,this.pos+1),o=h??-1;if(o>=97&&o<=122||o>=65&&o<=90||o==95||o>=48&&o<=57||o==45)break}l+=String.fromCodePoint(a),this.pos++}let i=He.rtrim(l),n=new ue(t.line,t.column,t.offset,i.length);n==null&&(n=new ue(this.startLine,this.startColumn,this.pos)),n.length=this.pos-n.offset;let s=new ye(k.LString(0,i,[]),n);return this.previous=s,s}}scanStringEnd(e,t){let l=e+1,i=!1;for(;l<this.length;){let n=c.cca(this.input,l),s=n??-1;if(s==92){l+=2;continue}if(s==10)return-1;if(s==34&&!i)return l+1;if(t&&s==60&&!i){let r;if(l+1<this.length){let o=c.cca(this.input,l+1);r=o??-1}else r=0;let a=r==47,h=l+(a?2:1);if(h<this.length){let o=c.cca(this.input,h),u=o??-1;(u>=97&&u<=122||u>=65&&u<=90||u==95||u==95||u==36||a&&u==62)&&(i=!0)}}if(s==62&&i&&(i=!1),s==36&&l+1<this.length){let r=c.cca(this.input,l+1),a=r??-1;if(a==123){l+=2;let h=1;for(;l<this.length&&h>0;){let o=c.cca(this.input,l),u=o??-1;if(u==92){l+=2;continue}if(u==10)return-1;let p;if(u==47&&l+1<this.length){let m=c.cca(this.input,l+1);p=(m??-1)==47}else p=!1;if(p)return-1;let _;if(u==47&&l+1<this.length){let m=c.cca(this.input,l+1);_=(m??-1)==42}else _=!1;if(_){for(l+=2;;){if(l>=this.length)return-1;let m=c.cca(this.input,l);if((m??-1)==10)return-1;let f,g;if(l+1<this.length){let d=c.cca(this.input,l);g=(d??-1)==42}else g=!1;if(g){let d=c.cca(this.input,l+1);f=(d??-1)==47}else f=!1;if(f){l+=2;break}++l}continue}if(u==34){if(l=this.scanStringEnd(l,t),l==-1)return-1;continue}u==123?++h:u==125&&--h,++l}if(h!=0)return-1;continue}if(a==36){l+=2;continue}if(a>=97&&a<=122||a>=65&&a<=90||a==95){for(++l;;){let h;if(l<this.length){let o=c.cca(this.input,l),u=o??-1;h=u>=97&&u<=122||u>=65&&u<=90||u==95||u>=48&&u<=57}else h=!1;if(!h)break;++l}if(l=this.scanAccessorChain(l,t),l==-1)return-1;continue}}++l}return-1}scanAccessorChain(e,t){for(;e<this.length;){let l=c.cca(this.input,e),i=l??-1,n;if(i==46&&e+1<this.length){let s=c.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=c.cca(this.input,e),a=r??-1;s=a>=97&&a<=122||a>=65&&a<=90||a==95||a>=48&&a<=57}else s=!1;if(!s)break;++e}else if(i==91||i==40){let s=i==91?93:41;++e;let r=1;for(;e<this.length&&r>0;){let a=c.cca(this.input,e),h=a??-1;if(h==92){e+=2;continue}if(h==10)return-1;let o;if(h==47&&e+1<this.length){let p=c.cca(this.input,e+1);o=(p??-1)==47}else o=!1;if(o)return-1;let u;if(h==47&&e+1<this.length){let p=c.cca(this.input,e+1);u=(p??-1)==42}else u=!1;if(u){for(e+=2;;){if(e>=this.length)return-1;let p=c.cca(this.input,e);if((p??-1)==10)return-1;let _,m;if(e+1<this.length){let f=c.cca(this.input,e);m=(f??-1)==42}else m=!1;if(m){let f=c.cca(this.input,e+1);_=(f??-1)==47}else _=!1;if(_){e+=2;break}++e}continue}if(h==34){if(e=this.scanStringEnd(e,t),e==-1)return-1;continue}h==i?++r:h==s&&--r,++e}if(r!=0)return-1}else break}return e}tryReadUnquotedString(){if(this.isStrict())return null;let e=c.cca(this.input,this.pos),t=e??-1,l;if(this.pos+1<this.length){let L=c.cca(this.input,this.pos+1);l=L??-1}else l=0;if(t==47&&this.pos<this.length-1){let L=c.cca(this.input,this.pos+1),I=L??-1;if(I==47||I==42)return null}if(t==123||t==125||t==91||t==93||t==58||t==35||t==32||t==9)return null;let i=this.parentBlockType();if(i!=k.KwBeat&&i!=k.KwState&&i!=k.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 a=r!=-1?this.isStartingMultilineDialogue(r):-1,h=r!=-1,o=i==k.KwState||i==k.KwCharacter||n||s,u=this.matchIdentifier(this.pos);if(o){if(this.isCallStart(this.pos)||this.isLabelStart(this.pos))return null}else if(!h&&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||l==61&&(t==43||t==45||t==42||t==47))||!o&&!h&&(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(kt.KEYWORDS.h,u)||this.isColon(this.pos+u.length))))return null;let p=!o,_=!1;if(o){if(n){if(!h&&!this.followsOnlyWhitespacesOrCommentsInLine()&&!this.isAfterComma()&&!this.isAfterLBracket())return null}else if(!s&&!h)return null}else if(_=this.followsOnlyLabelOrCommentsInLine(),!_&&!this.followsOnlyWhitespacesOrCommentsInLine()&&!this.followsChoiceOncePrefix()||!_&&l==62&&t==45)return null;if(t==34){let L=this.scanStringEnd(this.pos,i==k.KwBeat);if(L==-1)return null;let I=!1,W=L;for(;W<this.length;){let q=c.cca(this.input,W),P=q??-1;if(P==32||P==9){++W;continue}if(P==10||P==13)break;let R;if(P==47&&W+1<this.length){let M=c.cca(this.input,W+1);if((M??-1)!=47){let D=c.cca(this.input,W+1);R=(D??-1)==42}else R=!0}else R=!1;if(R||P==93||P==125||P==41||P==44||P==35)break;I=!0;break}if(!I&&!o){let q=!0;q==null&&(q=!1);let P=this._skipWhitespaceAndComments(W,q);if(P<=W||P>=this.length)return null;let R=c.cca(this.input,P),M=R??-1,D;if(M==10||M==13||M==34)D=!0;else if(M==47&&P+1<this.length){let X=c.cca(this.input,P+1);if((X??-1)!=47){let ae=c.cca(this.input,P+1);D=(ae??-1)==42}else D=!0}else D=!1;if(D)return null;let U=0,z=P;for(;;){let X;if(z>0){let ae=c.cca(this.input,z-1);if((ae??-1)!=32){let ce=c.cca(this.input,z-1);X=(ce??-1)==9}else X=!0}else X=!1;if(!X)break;++U,--z}let J=a!=-1?a:this.column-1;if(U!=J)return null;let H;if(M==45&&P+1<this.length){let X=c.cca(this.input,P+1);H=(X??-1)==62}else H=!1;if(H||M==43||this.isAssignStart(P,!1)||this.isCallStart(P)||this.isLabelStart(P)||this.isIfStart(P)||this.isIdentifierExpressionStart(P,!0))return null;if(M>=97&&M<=122||M>=65&&M<=90||M==95){let X=P;for(;;){let re;if(X<this.length){let xe=c.cca(this.input,X),Pe=xe??-1;re=Pe>=97&&Pe<=122||Pe>=65&&Pe<=90||Pe==95||Pe>=48&&Pe<=57}else re=!1;if(!re)break;++X}let ae=this.input,ce=X-P,ne=ce!=null?c.substr(ae,P,ce):c.substr(ae,P,null);if(ne!="null"&&ne!="true"&&ne!="false"&&Object.prototype.hasOwnProperty.call(kt.KEYWORDS.h,ne))return null}}else if(!I)return null}let m=new ue(this.startLine,this.startColumn,this.pos),f="",g=[],d=this.line,x=this.column,y=this.pos,S=!1,C=-1,O=!1,E=this.column,v=this.line,N=!0,B=!1;for(;this.pos<this.length;){let L=c.cca(this.input,this.pos),I=L??-1,W=I==32||I==9;if(B||!W&&C==-1&&(I!=60||!p)&&(B=!0),S){f+=String.fromCodePoint(92),f+=String.fromCodePoint(I),S=!1;let q=0,P=1;for(;q<P;){let R=q++;if(this.pos>=this.length)break;let M=c.cca(this.input,this.pos);(M??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}E+=2}else if(I==92){S=!0;let q=0,P=1;for(;q<P;){let R=q++;if(this.pos>=this.length)break;let M=c.cca(this.input,this.pos);(M??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else if(C==-1&&W&&!B&&g.length==0){let q=0,P=1;for(;q<P;){let R=q++;if(this.pos>=this.length)break;let M=c.cca(this.input,this.pos);(M??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else{if(C==-1&&I==123)break;{let q;if(C==-1)if(I==10||I==13)q=!0;else if(I==47&&this.pos<this.length-1){let P=c.cca(this.input,this.pos+1);q=(P??-1)==47}else q=!1;else q=!1;if(q)if(a!=-1)if(this.isContinuingMultilineText(this.pos,a)){f+=String.fromCodePoint(I);let P=0,R=1;for(;P<R;){let D=P++;if(this.pos>=this.length)break;let U=c.cca(this.input,this.pos);(U??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let M;if(I==13){let D=c.cca(this.input,this.pos);M=(D??-1)==10}else M=!1;if(M){f+=String.fromCodePoint(10);let D=0,U=1;for(;D<U;){let z=D++;if(this.pos>=this.length)break;let J=c.cca(this.input,this.pos);(J??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}E=this.column,v=this.line}else break;else break;else{let P;if(C==-1)if(I==47&&this.pos<this.length-1){let R=c.cca(this.input,this.pos+1);P=(R??-1)==42}else P=!1;else P=!1;if(P){f+=String.fromCodePoint(47),f+=String.fromCodePoint(42);let R=2;R==null&&(R=1);let M=0,D=R;for(;M<D;){let z=M++;if(this.pos>=this.length)break;let J=c.cca(this.input,this.pos);(J??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let U=!1;for(;this.pos<this.length;){let z,J=c.cca(this.input,this.pos);if((J??-1)==42&&this.pos+1<this.length){let ne=c.cca(this.input,this.pos+1);z=(ne??-1)==47}else z=!1;if(z){f+=String.fromCodePoint(42),f+=String.fromCodePoint(47);let ne=2;ne==null&&(ne=1);let re=0,xe=ne;for(;re<xe;){let Pe=re++;if(this.pos>=this.length)break;let Ue=c.cca(this.input,this.pos);(Ue??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}U=!0;break}let H=c.cca(this.input,this.pos),X=H??-1;f+=String.fromCodePoint(X);let ae=0,ce=1;for(;ae<ce;){let ne=ae++;if(this.pos>=this.length)break;let re=c.cca(this.input,this.pos);(re??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}E=this.column,v=this.line,U||this.error("Unterminated multiline comment",!1)}else{if(C==-1&&!o&&this.isIfStart(this.pos))break;{let R;if(C==-1&&I==45&&this.pos<this.length-1){let M=c.cca(this.input,this.pos+1);R=(M??-1)==62}else R=!1;if(R&&this.isTransitionStart(this.pos))break;if(C==-1&&o&&(I==44||I==93||I==125))break;if(p&&I==60){C!=-1&&this.error("Unexpected < inside tag",!0);let M;if(this.pos+1<this.length){let J=c.cca(this.input,this.pos+1);M=J??-1}else M=0;O=M==47;let D=this.pos+(O?2:1);if(D<this.length){let J=c.cca(this.input,D),H=J??-1;(H>=97&&H<=122||H>=65&&H<=90||H==95||H==95||H==36||O&&H==62)&&(C=f.length)}f+=String.fromCodePoint(I);let U=0,z=1;for(;U<z;){let J=U++;if(this.pos>=this.length)break;let H=c.cca(this.input,this.pos);(H??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++E}else if(p&&I==62){f+=String.fromCodePoint(I);let M=0,D=1;for(;M<D;){let U=M++;if(this.pos>=this.length)break;let z=c.cca(this.input,this.pos);(z??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++E,C!=-1&&(g.push(Ll.Tag(O,C,f.length-C)),C=-1)}else if(C==-1&&I==35&&!S){let M;if(this.pos+1<this.length){let D=c.cca(this.input,this.pos+1);M=D??-1}else M=0;if(M==35){f+=String.fromCodePoint(35),f+=String.fromCodePoint(35);let D=0,U=1;for(;D<U;){let H=D++;if(this.pos>=this.length)break;let X=c.cca(this.input,this.pos);(X??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let z=0,J=1;for(;z<J;){let H=z++;if(this.pos>=this.length)break;let X=c.cca(this.input,this.pos);(X??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}E+=2}else{if(M>=97&&M<=122||M>=65&&M<=90||M==95||M>=48&&M<=57||M==45)break;{f+=String.fromCodePoint(I);let D=0,U=1;for(;D<U;){let z=D++;if(this.pos>=this.length)break;let J=c.cca(this.input,this.pos);(J??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++E}}}else if(I==36&&!S){let M=f.length,D=v,U=E,z=this.pos;try{let J=0,H=1;for(;J<H;){let ae=J++;if(this.pos>=this.length)break;let ce=c.cca(this.input,this.pos);(ce??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++E;let X=c.cca(this.input,this.pos);if((X??-1)==123){let ae=0,ce=1;for(;ae<ce;){let Ue=ae++;if(this.pos>=this.length)break;let Je=c.cca(this.input,this.pos);(Je??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++E;let ne=new ue(D,U+2,this.pos),re=this.readComplexInterpolation(ne),xe=this.pos-z;g.push(Ll.Interpolation(!0,C!=-1,re,M,xe));let Pe=this.input;f+=Y.string(xe!=null?c.substr(Pe,z,xe):c.substr(Pe,z,null))}else{let ae=c.cca(this.input,this.pos),ce=ae??-1;if(ce>=97&&ce<=122||ce>=65&&ce<=90||ce==95){let ne=new ue(D,U+1,this.pos),re=this.readFieldAccessInterpolation(ne),xe=this.pos-z;g.push(Ll.Interpolation(!1,C!=-1,re,M,xe));let Pe=this.input;f+=Y.string(xe!=null?c.substr(Pe,z,xe):c.substr(Pe,z,null))}else{let ne=c.cca(this.input,this.pos);if((ne??-1)==36){f+=String.fromCodePoint(36),f+=String.fromCodePoint(36);let re=0,xe=1;for(;re<xe;){let Pe=re++;if(this.pos>=this.length)break;let Ue=c.cca(this.input,this.pos);(Ue??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++E}else{this.error("Expected identifier or { after $",!1);let re=this.pos-z;g.push(Ll.Interpolation(!1,C!=-1,[],M,re));let xe=this.input;f+=Y.string(re!=null?c.substr(xe,z,re):c.substr(xe,z,null))}}}}catch(J){let H=T.caught(J).unwrap();if(H instanceof ui){let X=H;throw X.pos==null&&(X.pos=new ue(D,U,this.pos)),T.thrown(X)}else throw J}E=U+(this.pos-z)}else{I==10?(++v,E=1):++E,f+=String.fromCodePoint(I);let M=0,D=1;for(;M<D;){let U=M++;if(this.pos>=this.length)break;let z=c.cca(this.input,this.pos);(z??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}}}}}}if(N){let L=f,I=L.length;L=He.rtrim(L);let W=L.length,q=I-W;if(W>0&&this.hasNonSpecialChar(L)&&(!o||!this.isNumber(L)&&L!="null"&&L!="true"&&L!="false")){if(a==-1&&!h&&!this.inChoiceRoot()){let U=this.line,z=this.column,J=this.pos,H=!0;H==null&&(H=!1);let X=H;X==null&&(X=!1);let ae=this._skipWhitespaceAndComments(this.pos,X);for(;this.pos<ae;){let ne=0,re=1;for(;ne<re;){let xe=ne++;if(this.pos>=this.length)break;let Pe=c.cca(this.input,this.pos);(Pe??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let ce=this.pos;if(this.column==x){let ne=this.tryReadUnquotedString();if(ne!=null){let re=this.input,xe=J-q,Pe=ce!=null?re.substring(xe,ce):re.substring(xe),Ue=ne.type;if(Ue._hx_index==15){let lt=Ue.quotes,Ve=Ue.s,Qe=Ue.attachments;if(Qe!=null){let at=0;for(;at<Qe.length;){let Re=Qe[at];switch(++at,Re._hx_index){case 0:let $=Re.braces,se=Re.inTag,j=Re.expr,ie=Re.start,le=Re.length;g.push(Ll.Interpolation($,se,j,ie+ce-y,le));break;case 1:let ee=Re.closing,pe=Re.start,me=Re.length;g.push(Ll.Tag(ee,pe+ce-y,me));break}}}L+=Pe,L+=Ve}q=0;let Je=this.pos-1;for(;;){let lt;if(Je>=0){let Ve=c.cca(this.input,Je);if((Ve??-1)!=32){let Qe=c.cca(this.input,Je);lt=(Qe??-1)==9}else lt=!0}else lt=!1;if(!lt)break;++q,--Je}}else this.line=U,this.column=z,this.pos=J}else this.line=U,this.column=z,this.pos=J}g.sort(function(U,z){return kt.compareAttachments(U,z)});let P=g.length>0?g:null,R=m;R==null&&(R=new ue(this.startLine,this.startColumn,this.pos)),R.length=this.pos-R.offset;let M=new ye(k.LString(0,L,P),R);this.previous=M;let D=M;return D.pos.length-=q,D}}return this.line=d,this.column=x,this.pos=y,null}readString(e){let t=0,l=1;for(;t<l;){let p=t++;if(this.pos>=this.length)break;let _=c.cca(this.input,this.pos);(_??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let i="",n=[],s=!1,r=-1,a=!1,h=e.column+1,o=e.line,u=this.parentBlockType()==k.KwBeat;for(;this.pos<this.length;){let p=c.cca(this.input,this.pos),_=p??-1;if(s){i+=String.fromCodePoint(92),i+=String.fromCodePoint(_),s=!1;let m=0,f=1;for(;m<f;){let g=m++;if(this.pos>=this.length)break;let d=c.cca(this.input,this.pos);(d??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}h+=2}else if(_==92){s=!0;let m=0,f=1;for(;m<f;){let g=m++;if(this.pos>=this.length)break;let d=c.cca(this.input,this.pos);(d??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else if(_==34&&r==-1){let m=0,f=1;for(;m<f;){let y=m++;if(this.pos>=this.length)break;let S=c.cca(this.input,this.pos);(S??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}n.sort(function(y,S){return kt.compareAttachments(y,S)});let g=n.length>0?n:null,d=e;d==null&&(d=new ue(this.startLine,this.startColumn,this.pos)),d.length=this.pos-d.offset;let x=new ye(k.LString(1,i,g),d);return this.previous=x,x}else if(u&&_==60){r!=-1&&this.error("Unexpected < inside tag",!0);let m;if(this.pos+1<this.length){let x=c.cca(this.input,this.pos+1);m=x??-1}else m=0;a=m==47;let f=this.pos+(a?2:1);if(f<this.length){let x=c.cca(this.input,f),y=x??-1;(y>=97&&y<=122||y>=65&&y<=90||y==95||y==95||y==36||a&&y==62)&&(r=i.length)}i+=String.fromCodePoint(_);let g=0,d=1;for(;g<d;){let x=g++;if(this.pos>=this.length)break;let y=c.cca(this.input,this.pos);(y??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++h}else if(_==62){i+=String.fromCodePoint(_);let m=0,f=1;for(;m<f;){let g=m++;if(this.pos>=this.length)break;let d=c.cca(this.input,this.pos);(d??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++h,r!=-1&&(n.push(Ll.Tag(a,r,i.length-r)),r=-1)}else if(_==36&&!s){let m=i.length,f=o,g=h,d=this.pos;try{let x=0,y=1;for(;x<y;){let C=x++;if(this.pos>=this.length)break;let O=c.cca(this.input,this.pos);(O??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++h;let S=c.cca(this.input,this.pos);if((S??-1)==123){let C=0,O=1;for(;C<O;){let L=C++;if(this.pos>=this.length)break;let I=c.cca(this.input,this.pos);(I??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++h;let E=new ue(f,g+2,this.pos),v=this.readComplexInterpolation(E),N=this.pos-d;n.push(Ll.Interpolation(!0,r!=-1,v,m,N));let B=this.input;i+=Y.string(N!=null?c.substr(B,d,N):c.substr(B,d,null))}else{let C=c.cca(this.input,this.pos),O=C??-1;if(O>=97&&O<=122||O>=65&&O<=90||O==95){let E=new ue(f,g+1,this.pos),v=this.readFieldAccessInterpolation(E),N=this.pos-d;n.push(Ll.Interpolation(!1,r!=-1,v,m,N));let B=this.input;i+=Y.string(N!=null?c.substr(B,d,N):c.substr(B,d,null))}else{let E=c.cca(this.input,this.pos);if((E??-1)==36){i+=String.fromCodePoint(36),i+=String.fromCodePoint(36);let v=0,N=1;for(;v<N;){let B=v++;if(this.pos>=this.length)break;let L=c.cca(this.input,this.pos);(L??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++h}else{this.error("Expected identifier or { after $",!1);let v=this.pos-d;n.push(Ll.Interpolation(!1,r!=-1,[],m,v));let N=this.input;i+=Y.string(v!=null?c.substr(N,d,v):c.substr(N,d,null))}}}}catch(x){let y=T.caught(x).unwrap();if(y instanceof ui){let S=y;throw S.pos==null&&(S.pos=new ue(f,g,this.pos)),T.thrown(S)}else throw x}h=g+(this.pos-d)}else{_==10?(++o,h=1):++h,i+=String.fromCodePoint(_);let m=0,f=1;for(;m<f;){let g=m++;if(this.pos>=this.length)break;let d=c.cca(this.input,this.pos);(d??-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=[],l=1,i=e.column,n=e.line;for(;this.pos<this.length&&l>0;){let s=c.cca(this.input,this.pos);if((s??-1)==34){let a=new ue(n,i,this.pos);t.push(this.readString(a)),i+=this.pos-a.offset;continue}let r=this.nextToken();if(t.push(r),r.type==k.LineBreak)++n,i=1;else if(!(r.type==k.Indent||r.type==k.Unindent)){let a,h=r.type;switch(h._hx_index){case 15:let o=h.attachments,u=h.quotes;a=h.s.length+(u!=0?2:0);break;case 16:let _=h.n;a=(_==null?"null":""+_).length;break;case 19:a=h.name.length;break;default:a=1}i+=a}switch(r.type._hx_index){case 45:++l;break;case 46:--l;break;default:}r.type==k.Eof&&this.error("Unterminated interpolation expression",!0)}return t.pop(),this.strictExprs.pop(),t}nextTokenWithPosition(e){let t=this.line,l=this.column,i=this.pos,n=this.nextToken(),s=n.pos.length,r=this.pos-i;return n.pos=new ue(e.line,e.column+r,e.offset+r,s),this.line=t,this.column=l,n}readFieldAccessInterpolation(e){this.strictExprs.push(1);let t=[],l=c.cca(this.input,this.pos),i=l??-1;i>=97&&i<=122||i>=65&&i<=90||i==95||this.error("Expected identifier in field access",!0);let n=this.pos;for(;this.pos<this.length;){let o=c.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 p=0,_=1;for(;p<_;){let m=p++;if(this.pos>=this.length)break;let f=c.cca(this.input,this.pos);(f??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let s=this.input,r=this.pos-n,a=r!=null?c.substr(s,n,r):c.substr(s,n,null),h=Object.prototype.hasOwnProperty.call(kt.KEYWORDS.h,a)?kt.KEYWORDS.h[a]:k.Identifier(a);t.push(new ye(h,new ue(e.line,e.column,n,this.pos-n)));e:for(;this.pos<this.length;){let o=c.cca(this.input,this.pos);switch(o??-1){case 40:t.push(new ye(k.LParen,new ue(this.line,this.column,this.pos,1)));let u=0,p=1;for(;u<p;){let x=u++;if(this.pos>=this.length)break;let y=c.cca(this.input,this.pos);(y??-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 x=c.cca(this.input,this.pos);if((x??-1)==41){if(--_,_==0){t.push(new ye(k.RParen,new ue(this.line,this.column,this.pos,1)));let S=0,C=1;for(;S<C;){let O=S++;if(this.pos>=this.length)break;let E=c.cca(this.input,this.pos);(E??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.stack.pop(),this.strictExprs.pop();break}}else{let S=c.cca(this.input,this.pos);(S??-1)==40&&++_}let y=c.cca(this.input,this.pos);if((y??-1)==44){t.push(new ye(k.Comma,new ue(this.line,this.column,this.pos,1)));let S=0,C=1;for(;S<C;){let O=S++;if(this.pos>=this.length)break;let E=c.cca(this.input,this.pos);(E??-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 m;if(this.pos+1<this.length){let x=c.cca(this.input,this.pos+1),y=x??-1;m=y>=97&&y<=122||y>=65&&y<=90||y==95}else m=!1;if(m){t.push(new ye(k.Dot,new ue(this.line,this.column,this.pos,1)));let x=0,y=1;for(;x<y;){let N=x++;if(this.pos>=this.length)break;let B=c.cca(this.input,this.pos);(B??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let S=this.pos;for(;this.pos<this.length;){let N=c.cca(this.input,this.pos),B=N??-1;if(!(B>=97&&B<=122||B>=65&&B<=90||B==95||B>=48&&B<=57))break;let L=0,I=1;for(;L<I;){let W=L++;if(this.pos>=this.length)break;let q=c.cca(this.input,this.pos);(q??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let C=this.input,O=this.pos-S,E=O!=null?c.substr(C,S,O):c.substr(C,S,null),v=Object.prototype.hasOwnProperty.call(kt.KEYWORDS.h,E)?kt.KEYWORDS.h[E]:k.Identifier(E);t.push(new ye(v,new ue(this.line,this.column-(this.pos-S),S)))}else break e;break;case 91:t.push(new ye(k.LBracket,new ue(this.line,this.column,this.pos,1)));let f=0,g=1;for(;f<g;){let x=f++;if(this.pos>=this.length)break;let y=c.cca(this.input,this.pos);(y??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.stack.push(12),this.strictExprs.push(1);let d=1;for(;this.pos<this.length&&d>0;){let x=c.cca(this.input,this.pos);if((x??-1)==93){if(--d,d==0){t.push(new ye(k.RBracket,new ue(this.line,this.column,this.pos,1)));let y=0,S=1;for(;y<S;){let C=y++;if(this.pos>=this.length)break;let O=c.cca(this.input,this.pos);(O??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.stack.pop(),this.strictExprs.pop();break}}else{let y=c.cca(this.input,this.pos);(y??-1)==91&&++d}t.push(this.nextToken())}d>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),l=this.pos;for(;this.pos<this.length;){let a=c.cca(this.input,this.pos),h=a??-1;if(!(h>=97&&h<=122||h>=65&&h<=90||h==95||h>=48&&h<=57))break;let o=0,u=1;for(;o<u;){let p=o++;if(this.pos>=this.length)break;let _=c.cca(this.input,this.pos);(_??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let i=this.input,n=this.pos-l,s=n!=null?c.substr(i,l,n):c.substr(i,l,null),r=Object.prototype.hasOwnProperty.call(kt.KEYWORDS.h,s)?kt.KEYWORDS.h[s]:k.Identifier(s);return new ye(r,t)}makePositionRelativeTo(e){let t=e.line,l=e.column,i=e.offset;for(;i<this.pos;){let n=c.cca(this.input,i);(n??-1)==10?(++t,l=1):++l,++i}return new ue(t,l,this.pos,e.length)}readLineComment(){let e=new ue(this.startLine,this.startColumn,this.pos),t=2;t==null&&(t=1);let l=0,i=t;for(;l<i;){let u=l++;if(this.pos>=this.length)break;let p=c.cca(this.input,this.pos);(p??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let n=this.pos;for(;this.pos<this.length;){let u=c.cca(this.input,this.pos),p=u??-1;if(p==10||p==13)break;let _=0,m=1;for(;_<m;){let f=_++;if(this.pos>=this.length)break;let g=c.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,a=r!=null?c.substr(s,n,r):c.substr(s,n,null),h=e;h==null&&(h=new ue(this.startLine,this.startColumn,this.pos)),h.length=this.pos-h.offset;let o=new ye(k.CommentLine(a),h);return this.previous=o,o}readMultiLineComment(){let e=new ue(this.startLine,this.startColumn,this.pos),t=2;t==null&&(t=1);let l=0,i=t;for(;l<i;){let r=l++;if(this.pos>=this.length)break;let a=c.cca(this.input,this.pos);(a??-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,a=c.cca(this.input,this.pos);if((a??-1)==42){let h;if(this.pos+1<this.length){let o=c.cca(this.input,this.pos+1);h=o??-1}else h=0;r=h==47}else r=!1;if(r){if(--s,s==0){let p=this.input,_=this.pos-n,m=_!=null?c.substr(p,n,_):c.substr(p,n,null),f=2;f==null&&(f=1);let g=0,d=f;for(;g<d;){let S=g++;if(this.pos>=this.length)break;let C=c.cca(this.input,this.pos);(C??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let x=e;x==null&&(x=new ue(this.startLine,this.startColumn,this.pos)),x.length=this.pos-x.offset;let y=new ye(k.CommentMultiLine(m),x);return this.previous=y,y}let h=2;h==null&&(h=1);let o=0,u=h;for(;o<u;){let p=o++;if(this.pos>=this.length)break;let _=c.cca(this.input,this.pos);(_??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else{let h,o=c.cca(this.input,this.pos);if((o??-1)==47){let u;if(this.pos+1<this.length){let p=c.cca(this.input,this.pos+1);u=p??-1}else u=0;h=u==42}else h=!1;if(h){++s;let u=2;u==null&&(u=1);let p=0,_=u;for(;p<_;){let m=p++;if(this.pos>=this.length)break;let f=c.cca(this.input,this.pos);(f??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else{let u=0,p=1;for(;u<p;){let _=u++;if(this.pos>=this.length)break;let m=c.cca(this.input,this.pos);(m??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}}return this.error("Unterminated multi-line comment",!0),null}readHashComment(){let e=new ue(this.startLine,this.startColumn,this.pos),t=0,l=1;for(;t<l;){let o=t++;if(this.pos>=this.length)break;let u=c.cca(this.input,this.pos);(u??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let i=this.pos;for(;this.pos<this.length;){let o=c.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 p=0,_=1;for(;p<_;){let m=p++;if(this.pos>=this.length)break;let f=c.cca(this.input,this.pos);(f??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else break}let n=this.input,s=this.pos-i,r=s!=null?c.substr(n,i,s):c.substr(n,i,null),a=e;a==null&&(a=new ue(this.startLine,this.startColumn,this.pos)),a.length=this.pos-a.offset;let h=new ye(k.CommentHash(r),a);return this.previous=h,h}readNumber(){let e=new ue(this.startLine,this.startColumn,this.pos),t=this.pos;for(;;){let u;if(this.pos<this.length){let m=c.cca(this.input,this.pos),f=m??-1;u=f>=48&&f<=57}else u=!1;if(!u)break;let p=0,_=1;for(;p<_;){let m=p++;if(this.pos>=this.length)break;let f=c.cca(this.input,this.pos);(f??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let l,i;if(this.pos<this.length){let u=c.cca(this.input,this.pos);i=(u??-1)==46}else i=!1;if(i&&this.pos+1<this.length){let u=c.cca(this.input,this.pos+1),p=u??-1;l=p>=48&&p<=57}else l=!1;if(l){let u=0,p=1;for(;u<p;){let _=u++;if(this.pos>=this.length)break;let m=c.cca(this.input,this.pos);(m??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}for(;;){let _;if(this.pos<this.length){let g=c.cca(this.input,this.pos),d=g??-1;_=d>=48&&d<=57}else _=!1;if(!_)break;let m=0,f=1;for(;m<f;){let g=m++;if(this.pos>=this.length)break;let d=c.cca(this.input,this.pos);(d??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}let n=this.input,s=this.pos-t,r=k.LNumber(parseFloat(s!=null?c.substr(n,t,s):c.substr(n,t,null))),a=e;a==null&&(a=new ue(this.startLine,this.startColumn,this.pos)),a.length=this.pos-a.offset;let h=new ye(r,a);return this.previous=h,h}readIdentifier(){let e=new ue(this.startLine,this.startColumn,this.pos),t=this.pos;for(;this.pos<this.length;){let h=c.cca(this.input,this.pos),o=h??-1;if(!(o>=97&&o<=122||o>=65&&o<=90||o==95||o>=48&&o<=57))break;let u=0,p=1;for(;u<p;){let _=u++;if(this.pos>=this.length)break;let m=c.cca(this.input,this.pos);(m??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let l=this.input,i=this.pos-t,n=i!=null?c.substr(l,t,i):c.substr(l,t,null);if(n=="function")return this.readFunction(e);let s=Object.prototype.hasOwnProperty.call(kt.KEYWORDS.h,n)?kt.KEYWORDS.h[n]:k.Identifier(n);if(this.previous!=null&&this.previous.type==k.Dot&&s!=null)switch(s._hx_index){case 8:case 9:case 10:case 11:case 12:s=k.Identifier(n);break;default:}let r=e;r==null&&(r=new ue(this.startLine,this.startColumn,this.pos)),r.length=this.pos-r.offset;let a=new ye(s,r);return this.previous=a,a}readFunction(e){let t=!1;t==null&&(t=!1);let l=this._skipWhitespaceAndComments(this.pos,t);for(;this.pos<l;){let P=0,R=1;for(;P<R;){let M=P++;if(this.pos>=this.length)break;let D=c.cca(this.input,this.pos);(D??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let i=e.column,n=null,s=c.cca(this.input,this.pos),r=s??-1;if(r>=97&&r<=122||r>=65&&r<=90||r==95){let P=this.pos;for(;;){let D;if(this.pos<this.length){let J=c.cca(this.input,this.pos),H=J??-1;D=H>=97&&H<=122||H>=65&&H<=90||H==95||H>=48&&H<=57}else D=!1;if(!D)break;let U=0,z=1;for(;U<z;){let J=U++;if(this.pos>=this.length)break;let H=c.cca(this.input,this.pos);(H??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let R=this.input,M=this.pos-P;n=M!=null?c.substr(R,P,M):c.substr(R,P,null)}let a=!1;a==null&&(a=!1);let h=this._skipWhitespaceAndComments(this.pos,a);for(;this.pos<h;){let P=0,R=1;for(;P<R;){let M=P++;if(this.pos>=this.length)break;let D=c.cca(this.input,this.pos);(D??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let o;if(this.pos<this.length){let P=c.cca(this.input,this.pos);o=(P??-1)!=40}else o=!0;o&&this.error("Expected opening parenthesis after function name",!0);let u=0,p=[],_=0,m=1;for(;_<m;){let P=_++;if(this.pos>=this.length)break;let R=c.cca(this.input,this.pos);(R??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}u=1;let f=new gt;for(;this.pos<this.length&&u>0;){let P=c.cca(this.input,this.pos),R=P??-1;if(R==47){let M=this.pos,D=!1;D==null&&(D=!1);let U=this._skipWhitespaceAndComments(this.pos,D);for(;this.pos<U;){let z=0,J=1;for(;z<J;){let H=z++;if(this.pos>=this.length)break;let X=c.cca(this.input,this.pos);(X??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}if(this.pos==M){let z=0,J=1;for(;z<J;){let H=z++;if(this.pos>=this.length)break;let X=c.cca(this.input,this.pos);(X??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.error('Invalid character "/"',!1)}}else if(R==40){++u,f.b+=String.fromCodePoint(R);let M=0,D=1;for(;M<D;){let J=M++;if(this.pos>=this.length)break;let H=c.cca(this.input,this.pos);(H??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let U=!1;U==null&&(U=!1);let z=this._skipWhitespaceAndComments(this.pos,U);for(;this.pos<z;){let J=0,H=1;for(;J<H;){let X=J++;if(this.pos>=this.length)break;let ae=c.cca(this.input,this.pos);(ae??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}else if(R==41){if(--u,u>0)f.b+=String.fromCodePoint(R);else{let J=He.trim(f.b);J.length>0&&p.push(J)}let M=0,D=1;for(;M<D;){let J=M++;if(this.pos>=this.length)break;let H=c.cca(this.input,this.pos);(H??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let U=!1;U==null&&(U=!1);let z=this._skipWhitespaceAndComments(this.pos,U);for(;this.pos<z;){let J=0,H=1;for(;J<H;){let X=J++;if(this.pos>=this.length)break;let ae=c.cca(this.input,this.pos);(ae??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}else if(R==44&&u==1){let M=He.trim(f.b);M.length>0&&p.push(M),f=new gt;let D=0,U=1;for(;D<U;){let H=D++;if(this.pos>=this.length)break;let X=c.cca(this.input,this.pos);(X??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let z=!1;z==null&&(z=!1);let J=this._skipWhitespaceAndComments(this.pos,z);for(;this.pos<J;){let H=0,X=1;for(;H<X;){let ae=H++;if(this.pos>=this.length)break;let ce=c.cca(this.input,this.pos);(ce??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}else{f.b+=String.fromCodePoint(R);let M=0,D=1;for(;M<D;){let U=M++;if(this.pos>=this.length)break;let z=c.cca(this.input,this.pos);(z??-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 d=this._skipWhitespaceAndComments(this.pos,g);for(;this.pos<d;){let P=0,R=1;for(;P<R;){let M=P++;if(this.pos>=this.length)break;let D=c.cca(this.input,this.pos);(D??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let x;if(this.pos<this.length){let P=c.cca(this.input,this.pos);x=(P??-1)==123}else x=!1;let y=this.pos,S=this.line,C=this.column;if(x){let P=0,R=1;for(;P<R;){let D=P++;if(this.pos>=this.length)break;let U=c.cca(this.input,this.pos);(U??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let M=1;for(;this.pos<this.length&&M>0;){let D=c.cca(this.input,this.pos),U=D??-1;if(U==34){let H=0,X=1;for(;H<X;){let ae=H++;if(this.pos>=this.length)break;let ce=c.cca(this.input,this.pos);(ce??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.skipQuotedString();continue}U==123?++M:U==125&&--M;let z=0,J=1;for(;z<J;){let H=z++;if(this.pos>=this.length)break;let X=c.cca(this.input,this.pos);(X??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}M>0&&this.error("Unclosed braces in function body",!1)}else{let P=-1,R=!0;for(;this.pos<this.length;){let M=c.cca(this.input,this.pos),D=M??-1;if(D==10||D==13){y=this.pos,S=this.line,C=this.column;let J=0,H=1;for(;J<H;){let X=J++;if(this.pos>=this.length)break;let ae=c.cca(this.input,this.pos);(ae??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}R=!0;break}let U=0,z=1;for(;U<z;){let J=U++;if(this.pos>=this.length)break;let H=c.cca(this.input,this.pos);(H??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}for(;this.pos<this.length;){if(R){let J=0,H=this.pos;for(;this.pos<this.length;){let ce=c.cca(this.input,this.pos),ne=ce??-1;if(ne==32)++J;else if(ne==9)++J;else break;let re=0,xe=1;for(;re<xe;){let Pe=re++;if(this.pos>=this.length)break;let Ue=c.cca(this.input,this.pos);(Ue??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let X,ae;if(P==-1&&this.pos<this.length){let ce=c.cca(this.input,this.pos);ae=(ce??-1)!=10}else ae=!1;if(ae){let ce=c.cca(this.input,this.pos);X=(ce??-1)!=13}else X=!1;if(X){if(P=J,P<i){this.pos=H;break}}else{let ce;if(P!=-1&&J<P)if(this.pos<this.length){let ne=c.cca(this.input,this.pos);if((ne??-1)!=10){let re=c.cca(this.input,this.pos);ce=(re??-1)!=13}else ce=!1}else ce=!0;else ce=!1;if(ce){this.pos=H;break}}R=!1}let M=c.cca(this.input,this.pos),D=M??-1;if(D==34){this.skipQuotedString();continue}(D==10||D==13)&&(y=this.pos,S=this.line,C=this.column,R=!0);let U=0,z=1;for(;U<z;){let J=U++;if(this.pos>=this.length)break;let H=c.cca(this.input,this.pos);(H??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}this.pos=y,this.line=S,this.column=C;let O=this.pos,E=this.input,v=e.offset,N=O-e.offset,B=He.rtrim(N!=null?c.substr(E,v,N):c.substr(E,v,null)),L=B.indexOf(`
31
- `,null)==-1;L||(B+=`
32
- `);let I=e;I==null&&(I=new ue(this.startLine,this.startColumn,this.pos)),I.length=this.pos-I.offset;let W=new ye(k.Function(n,p,B,L),I);this.previous=W;let q=W;return q.pos.length=B.length,q}skipQuotedString(){let e=!1,t=0,l=1;for(;t<l;){let i=t++;if(this.pos>=this.length)break;let n=c.cca(this.input,this.pos);(n??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}for(;this.pos<this.length;){let i=c.cca(this.input,this.pos),n=i??-1;if(e){e=!1;let s=0,r=1;for(;s<r;){let a=s++;if(this.pos>=this.length)break;let h=c.cca(this.input,this.pos);(h??-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 a=s++;if(this.pos>=this.length)break;let h=c.cca(this.input,this.pos);(h??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else if(n==34){let s=0,r=1;for(;s<r;){let a=s++;if(this.pos>=this.length)break;let h=c.cca(this.input,this.pos);(h??-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 h=s++;if(this.pos>=this.length)break;let o=c.cca(this.input,this.pos);(o??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let a;if(this.pos<this.length){let h=c.cca(this.input,this.pos);a=(h??-1)==123}else a=!1;if(a){let h=0,o=1;for(;h<o;){let p=h++;if(this.pos>=this.length)break;let _=c.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 p=c.cca(this.input,this.pos),_=p??-1;if(_==34){this.skipQuotedString();continue}else _==123?++u:_==125&&--u;if(u>0||_!=125){let m=0,f=1;for(;m<f;){let g=m++;if(this.pos>=this.length)break;let d=c.cca(this.input,this.pos);(d??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else{let m=0,f=1;for(;m<f;){let g=m++;if(this.pos>=this.length)break;let d=c.cca(this.input,this.pos);(d??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}break}}}else{let h=c.cca(this.input,this.pos),o=h??-1;if(o>=97&&o<=122||o>=65&&o<=90||o==95)for(;;){let u;if(this.pos<this.length){let m=c.cca(this.input,this.pos),f=m??-1;u=f>=97&&f<=122||f>=65&&f<=90||f==95||f>=48&&f<=57}else u=!1;if(!u)break;let p=0,_=1;for(;p<_;){let m=p++;if(this.pos>=this.length)break;let f=c.cca(this.input,this.pos);(f??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}}else{let s=0,r=1;for(;s<r;){let a=s++;if(this.pos>=this.length)break;let h=c.cca(this.input,this.pos);(h??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}}makePosition(){return new ue(this.startLine,this.startColumn,this.pos)}makeToken(e,t){t==null&&(t=new ue(this.startLine,this.startColumn,this.pos)),t.length=this.pos-t.offset;let l=new ye(e,t);return this.previous=l,l}advance(e){e==null&&(e=1);let t=0,l=e;for(;t<l;){let i=t++;if(this.pos>=this.length)break;let n=c.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=c.cca(this.input,this.pos+e);return t??-1}else return 0}error(e,t){let l=new ui(e,new ue(this.startLine,this.startColumn,this.pos));if(this.errors==null&&(this.errors=[]),this.errors.push(l),t)throw T.thrown(l);return l}getErrors(){return this.errors==null&&(this.errors=[]),this.errors}skipWhitespace(){for(;this.pos<this.length;){let e=c.cca(this.input,this.pos);switch(e??-1){case 9:case 32:let t=0,l=1;for(;t<l;){let i=t++;if(this.pos>=this.length)break;let n=c.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 l;switch(e._hx_index){case 0:let n=e.braces,s=e.inTag,r=e.expr,a=e.length;l=e.start;break;case 1:let o=e.closing,u=e.length;l=e.start;break}let i;switch(t._hx_index){case 0:let n=t.braces,s=t.inTag,r=t.expr,a=t.length;i=t.start;break;case 1:let o=t.closing,u=t.length;i=t.start;break}return l-i}}Q["loreline.Lexer"]=kt,kt.__name__="loreline.Lexer",Object.assign(kt.prototype,{__class__:kt});class ml{static lastError(){return ml._lastError}static parse(e,t,l,i){ml._lastError=null;let n=new kt(e),s=n.tokenize(),r=n.getErrors();if(r!=null&&r.length>0)return ml._reportParseError(r[0],i);let a=null;if(t!=null&&l!=null)return new zi().resolve(t,s,l,function(p){ml._reportParseError(p,i)},function(p,_){if(ml._lastError!=null)return;let m=new Gl(s,new Fi(t,t,_,null));a=m.parse(),a.indentSize=n.detectedIndentSize;let f=m.getErrors();if(f!=null&&f.length>0){a=null,ml._reportParseError(f[0],i);return}i?.(a)}),a;let h=new Gl(s);a=h.parse(),a.indentSize=n.detectedIndentSize;let o=h.getErrors();return o!=null&&o.length>0?ml._reportParseError(o[0],i):(i?.(a),a)}static _reportParseError(e,t){if(ml._lastError=e,t!=null)return t(null),null;throw T.thrown(e)}static loadLocale(e,t,l,i,n){if(ml._lastError=null,l==null&&(l=t.filePath),l==null)throw T.thrown(new st("Cannot load locale: no filePath provided and script.filePath is null"));if(i==null)throw T.thrown(new st("Cannot load locale: handleFile is required"));let s=Cl.wrap(i,e);i=s.handler;let r=s.lastError,a=".lor",h,o,u;if(l==null)u=!1;else{let E=l.length;if(E<8)u=!1;else{let v,N,B,L,I,W,q=c.cca(l,E-8);if((q??-1)==46){let P=c.cca(l,E-7),R=P??-1;W=R==108||R==76}else W=!1;if(W){let P=c.cca(l,E-6),R=P??-1;I=R==111||R==79}else I=!1;if(I){let P=c.cca(l,E-5),R=P??-1;L=R==114||R==82}else L=!1;if(L){let P=c.cca(l,E-4);B=(P??-1)==46}else B=!1;if(B){let P=c.cca(l,E-3),R=P??-1;N=R==116||R==84}else N=!1;if(N){let P=c.cca(l,E-2),R=P??-1;v=R==120||R==88}else v=!1;if(v){let P=c.cca(l,E-1),R=P??-1;u=R==116||R==84}else u=!1}}if(u)o=!0;else if(l==null)o=!1;else{let E=l.length;if(E<4)o=!1;else{let v,N,B=c.cca(l,E-4);if((B??-1)==46){let L=c.cca(l,E-3),I=L??-1;N=I==108||I==76}else N=!1;if(N){let L=c.cca(l,E-2),I=L??-1;v=I==111||I==79}else v=!1;if(v){let L=c.cca(l,E-1),I=L??-1;o=I==114||I==82}else o=!1}}if(o)h=De.directory(l);else{let E=l.length,v;if(E>0){let N=c.cca(l,E-1);v=N??-1}else v=0;if(v==47||v==92){let N=E-1;h=N!=null?c.substr(l,0,N):c.substr(l,0,null)}else h=l}let p=t.filePath,_=[],m=[];if(p!=null){let E=De.withoutDirectory(p),v;if(E==null)v=null;else{let B;if(E==null)B=!1;else{let L=E.length;if(L<8)B=!1;else{let I,W,q,P,R,M,D=c.cca(E,L-8);if((D??-1)==46){let U=c.cca(E,L-7),z=U??-1;M=z==108||z==76}else M=!1;if(M){let U=c.cca(E,L-6),z=U??-1;R=z==111||z==79}else R=!1;if(R){let U=c.cca(E,L-5),z=U??-1;P=z==114||z==82}else P=!1;if(P){let U=c.cca(E,L-4);q=(U??-1)==46}else q=!1;if(q){let U=c.cca(E,L-3),z=U??-1;W=z==116||z==84}else W=!1;if(W){let U=c.cca(E,L-2),z=U??-1;I=z==120||z==88}else I=!1;if(I){let U=c.cca(E,L-1),z=U??-1;B=z==116||z==84}else B=!1}}if(B){let L=E.length-8;v=L!=null?c.substr(E,0,L):c.substr(E,0,null)}else{let L;if(E==null)L=!1;else{let I=E.length;if(I<4)L=!1;else{let W,q,P=c.cca(E,I-4);if((P??-1)==46){let R=c.cca(E,I-3),M=R??-1;q=M==108||M==76}else q=!1;if(q){let R=c.cca(E,I-2),M=R??-1;W=M==111||M==79}else W=!1;if(W){let R=c.cca(E,I-1),M=R??-1;L=M==114||M==82}else L=!1}}if(L){let I=E.length-4;v=I!=null?c.substr(E,0,I):c.substr(E,0,null)}else v=E}}let N=v+"."+e+a;_.push("."),m.push(De.normalize(De.join([h,N])))}if(p!=null){let E=new Ii(t),v=De.directory(p),N=E.getImportedPaths(p),B=0;for(;B<N.length;){let L=N[B];++B;let I=ml.relativePath(v,L),W;if(I==null)W=null;else{let M;if(I==null)M=!1;else{let D=I.length;if(D<8)M=!1;else{let U,z,J,H,X,ae,ce=c.cca(I,D-8);if((ce??-1)==46){let ne=c.cca(I,D-7),re=ne??-1;ae=re==108||re==76}else ae=!1;if(ae){let ne=c.cca(I,D-6),re=ne??-1;X=re==111||re==79}else X=!1;if(X){let ne=c.cca(I,D-5),re=ne??-1;H=re==114||re==82}else H=!1;if(H){let ne=c.cca(I,D-4);J=(ne??-1)==46}else J=!1;if(J){let ne=c.cca(I,D-3),re=ne??-1;z=re==116||re==84}else z=!1;if(z){let ne=c.cca(I,D-2),re=ne??-1;U=re==120||re==88}else U=!1;if(U){let ne=c.cca(I,D-1),re=ne??-1;M=re==116||re==84}else M=!1}}if(M){let D=I.length-8;W=D!=null?c.substr(I,0,D):c.substr(I,0,null)}else{let D;if(I==null)D=!1;else{let U=I.length;if(U<4)D=!1;else{let z,J,H=c.cca(I,U-4);if((H??-1)==46){let X=c.cca(I,U-3),ae=X??-1;J=ae==108||ae==76}else J=!1;if(J){let X=c.cca(I,U-2),ae=X??-1;z=ae==111||ae==79}else z=!1;if(z){let X=c.cca(I,U-1),ae=X??-1;D=ae==114||ae==82}else D=!1}}if(D){let U=I.length-4;W=U!=null?c.substr(I,0,U):c.substr(I,0,null)}else W=I}}let q=W+"."+e+a,P=De.normalize(I),R;if(P==null)R=null;else{let M;if(P==null)M=!1;else{let D=P.length;if(D<8)M=!1;else{let U,z,J,H,X,ae,ce=c.cca(P,D-8);if((ce??-1)==46){let ne=c.cca(P,D-7),re=ne??-1;ae=re==108||re==76}else ae=!1;if(ae){let ne=c.cca(P,D-6),re=ne??-1;X=re==111||re==79}else X=!1;if(X){let ne=c.cca(P,D-5),re=ne??-1;H=re==114||re==82}else H=!1;if(H){let ne=c.cca(P,D-4);J=(ne??-1)==46}else J=!1;if(J){let ne=c.cca(P,D-3),re=ne??-1;z=re==116||re==84}else z=!1;if(z){let ne=c.cca(P,D-2),re=ne??-1;U=re==120||re==88}else U=!1;if(U){let ne=c.cca(P,D-1),re=ne??-1;M=re==116||re==84}else M=!1}}if(M){let D=P.length-8;R=D!=null?c.substr(P,0,D):c.substr(P,0,null)}else{let D;if(P==null)D=!1;else{let U=P.length;if(U<4)D=!1;else{let z,J,H=c.cca(P,U-4);if((H??-1)==46){let X=c.cca(P,U-3),ae=X??-1;J=ae==108||ae==76}else J=!1;if(J){let X=c.cca(P,U-2),ae=X??-1;z=ae==111||ae==79}else z=!1;if(z){let X=c.cca(P,U-1),ae=X??-1;D=ae==114||ae==82}else D=!1}}if(D){let U=P.length-4;R=U!=null?c.substr(P,0,U):c.substr(P,0,null)}else R=P}}_.push(R),m.push(De.normalize(De.join([h,q])))}}let f=new Ee,g=_.length,d=!1,x=null,y=function(E,v){v(null)},S=function(){let E=x??r();if(E!=null){if(ml._lastError=E,n!=null){n(null);return}throw T.thrown(E)}n?.(f)},C=0,O=_.length;for(;C<O;){let E=C++,v=_[E],N=m[E];i(N,function(B){if(g-=1,B!=null)try{let L=ml.parse(B,N,y);if(L!=null){let W=et.extractTranslations(L).h,q=W,P=Object.keys(W),R=P.length,M=0;for(;M<R;){let D=P[M++],U=D,z=q[D],J=U,H=z;f.h[v+"#"+J]=H}}}catch(L){let I=T.caught(L).unwrap();if(I instanceof st){let W=I;x==null&&(x=new st('Failed to load translation file "'+N+'": '+W.message))}else{let W=I;x==null&&(x=new st('Failed to load translation file "'+N+'": '+(W==null?"null":Y.string(W))))}}g==0&&d&&S()})}return d=!0,g==0&&S(),ml._lastError!=null?null:f}static relativePath(e,t){let l=De.normalize(e),i=De.normalize(t),n=l.split("/"),s=i.split("/"),r=0;for(;r<n.length&&r<s.length&&n[r]==s[r];)++r;let a=n.length-r,h=[],o=0,u=a;for(;o<u;){let m=o++;h.push("..")}let p=r,_=s.length;for(;p<_;){let m=p++;h.push(s[m])}return h.length==0?".":h.join("/")}static play(e,t,l,i,n,s){let r=new Pi(e,t,l,i,s);return r.start(n),r}static resume(e,t,l,i,n,s,r){let a=new Pi(e,t,l,i,r);return a.restore(n),s!=null?a.start(s):a.resume(),a}static extractTranslations(e){return et.extractTranslations(e)}static translationFormat(e,t){Cl.translationFormat(e,t)}static generateTranslationFile(e,t,l,i){if(l==null||l=="lor")return et.generateTranslationFile(e,t,new Wl);if(i==null||i=="")throw T.thrown(new st("A locale is required when generating a translation file in format '"+l+"'"));if(l==null)throw T.thrown(new st("Unknown translation file format: '"+l+"'"));switch(l){case"csv":return Ut.fromScript(e,t,i);case"po":return bl.fromScript(e,t,i);case"tsv":return Ut.tsvFromScript(e,t,i);case"xliff":return vt.fromScript(e,t,i);default:throw T.thrown(new st("Unknown translation file format: '"+l+"'"))}}static insertLocalizationKeys(e,t,l,i){return l==null&&(l=!0),et.insertLocalizationKeys(e,t,l,i)}static collectHashIds(e,t){return et.collectHashIds(e,t)}static removeLocalizationKeys(e,t){return et.removeLocalizationKeys(e,t)}static extractTranslatableEntries(e){return et.extractTranslatableEntries(e)}static hasUntaggedTranslatableStrings(e){return et.hasUntaggedTranslatableStrings(e)}static print(e,t,l){let i=t,n=l;return new Wl(i??" ",n??`
33
- `).print(e)}static update(e){Zl.update(e)}}Q["loreline.Loreline"]=Xl.loreline.Loreline=ml,ml.__name__="loreline.Loreline";class Ae{constructor(e,t,l,i){if(e<0||e>65535)throw T.thrown("Section value ("+e+") should be between 0 and 65535");if(t<0||t>65535)throw T.thrown("Branch value ("+t+") should be between 0 and 65535");if(l<0||l>65535)throw T.thrown("Block value ("+l+") should be between 0 and 65535");if(i<0||i>65535)throw T.thrown("Node value ("+i+") 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=l-32768,a=i-32768;r<0&&(r=r+65536&65535),a<0&&(a=a+65536&65535),this.thisVal=new jl(n<<16|s&65535,r<<16|a&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 jl(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 jl(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 jl(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 jl(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 T.thrown("Node id section overflow");return new Ae(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 l=this.thisVal.high>>16&65535;return new Ae((l>=32768?l-65536:l)+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 l=this.thisVal.high>>16&65535,i=this.thisVal.high&65535;return new Ae((l>=32768?l-65536:l)+32768,(i>=32768?i-65536:i)+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 l=this.thisVal.high>>16&65535,i=this.thisVal.high&65535,n=this.thisVal.low>>16&65535;return new Ae((l>=32768?l-65536:l)+32768,(i>=32768?i-65536:i)+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,l=this.thisVal.low>>16&65535,i=this.thisVal.low&65535;return""+((e>=32768?e-65536:e)+32768)+"."+((t>=32768?t-65536:t)+32768)+"."+((l>=32768?l-65536:l)+32768)+"."+((i>=32768?i-65536:i)+32768)}static fromInt64(e){let t=new Ae(32768,32768,32768,32768);return t.thisVal=e,t}static fromString(e){let t=e.split(".");return new Ae(Y.parseInt(t[0]),Y.parseInt(t[1]),Y.parseInt(t[2]),Y.parseInt(t[3]))}static fromTwoInt32(e,t){return Ae.fromInt64(new jl(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 l=e.thisVal,i=t.thisVal;return l.high==i.high?l.low==i.low:!1}}Q["loreline.NodeId"]=Ae,Ae.__name__="loreline.NodeId",Object.assign(Ae.prototype,{__class__:Ae,__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 li{constructor(){this.map=new El}get(e){let t=e.thisVal;return this.map._get(t.high,t.low)}set(e,t){let l=e.thisVal;this.map._set(l.high,l.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 $i(this.map)}keys(){return new Yi(this.map)}keyValueIterator(){return new Zi(this.map)}}Q["loreline.NodeIdMap"]=li,li.__name__="loreline.NodeIdMap",Object.assign(li.prototype,{__class__:li});class $i{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}}Q["loreline._Node.NodeIdMapIterator"]=$i,$i.__name__="loreline._Node.NodeIdMapIterator",Object.assign($i.prototype,{__class__:$i});class Yi{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 Ae.fromTwoInt32(e,t)}}Q["loreline._Node.NodeIdMapKeyIterator"]=Yi,Yi.__name__="loreline._Node.NodeIdMapKeyIterator",Object.assign(Yi.prototype,{__class__:Yi});class Zi{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],l=this.map._values[this.index];for(this.index++;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++;return{key:Ae.fromTwoInt32(e,t),value:l}}}Q["loreline._Node.NodeIdMapKeyValueIterator"]=Zi,Zi.__name__="loreline._Node.NodeIdMapKeyValueIterator",Object.assign(Zi.prototype,{__class__:Zi});class At{constructor(e,t){At._hx_skip_constructor||this._hx_constructor(e,t)}_hx_constructor(e,t){this.id=Ae.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 A.nodeFromJson(e)}}Q["loreline.Node"]=Xl.loreline.Node=At,At.__name__="loreline.Node",Object.assign(At.prototype,{__class__:At});class Ql extends At{constructor(e,t,l,i,n){n==null&&(n=!1),super(e,t),this.content=l,this.multiline=i,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}}Q["loreline.Comment"]=Ql,Ql.__name__="loreline.Comment",Ql.__super__=At,Object.assign(Ql.prototype,{__class__:Ql});class Be extends At{constructor(e,t,l,i){if(At._hx_skip_constructor){super();return}At._hx_skip_constructor=!0,super(),At._hx_skip_constructor=!1,this._hx_constructor(e,t,l,i)}_hx_constructor(e,t,l,i){super._hx_constructor(e,t),this.leadingComments=l,this.trailingComments=i}type(){return"AstNode"}eachComment(e){if(this.leadingComments!=null){let l=0,i=this.leadingComments;for(;l<i.length;){let n=i[l];++l,e(this,n)}}if(this.trailingComments!=null){let l=0,i=this.trailingComments;for(;l<i.length;){let n=i[l];++l,e(this,n)}}let t=this;this.each(function(l,i){if(l instanceof Be){let n=l;if(n.leadingComments!=null){let s=0,r=n.leadingComments;for(;s<r.length;){let a=r[s];++s,e(t,a)}}if(n.trailingComments!=null){let s=0,r=n.trailingComments;for(;s<r.length;){let a=r[s];++s,e(t,a)}}}})}each(e){if(super.each(e),this.leadingComments!=null){let t=0,l=this.leadingComments;for(;t<l.length;){let i=l[t];++t,e(i,this),i.each(e)}}if(this.trailingComments!=null){let t=0,l=this.trailingComments;for(;t<l.length;){let i=l[t];++t,e(i,this),i.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 l=[],i=0,n=this.leadingComments;for(;i<n.length;){let s=n[i];++i,l.push(s.toJson())}t.leading=l}if(this.trailingComments!=null&&this.trailingComments.length>0){let l=[],i=0,n=this.trailingComments;for(;i<n.length;){let s=n[i];++i,l.push(s.toJson())}t.trailing=l}e.comments=t}return e}}Q["loreline.AstNode"]=Be,Be.__name__="loreline.AstNode",Be.__super__=At,Object.assign(Be.prototype,{__class__:Be});class ct extends Be{constructor(e,t,l,i){super(e,t,l,i)}toJson(){return super.toJson()}type(){return"Expr"}}Q["loreline.NExpr"]=ct,ct.__name__="loreline.NExpr",ct.__super__=Be,Object.assign(ct.prototype,{__class__:ct});class $t extends Be{constructor(e,t,l,i,n,s){super(e,t,n,s),this.temporary=l,this.fields=i,this.style=0}type(){return"State"}get(e){let t=0,l=this.fields;for(;t<l.length;){let i=l[t];if(++t,i.name==e)return i.value}return null}each(e){if(super.each(e),this.fields!=null){let t=0,l=this.fields.length;for(;t<l;){let i=t++,n=this.fields[i];e(n,this),n.each(e)}}}toJson(){let e=super.toJson();e.temporary=this.temporary;let t=[],l=0,i=this.fields;for(;l<i.length;){let n=i[l];++l,t.push(n.toJson())}return e.fields=t,e.style=Vl.toString(this.style),e}}Q["loreline.NStateDecl"]=$t,$t.__name__="loreline.NStateDecl",$t.__super__=Be,Object.assign($t.prototype,{__class__:$t});class Ul extends Be{constructor(e,t,l,i,n,s){super(e,t,n,s),this.name=l,this.value=i}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}}Q["loreline.NObjectField"]=Ul,Ul.__name__="loreline.NObjectField",Ul.__super__=Be,Object.assign(Ul.prototype,{__class__:Ul});class jt extends Be{constructor(e,t,l,i,n,s,r){super(e,t,s,r),this.name=l,this.namePos=i,this.fields=n,this.style=0}type(){return"Character"}get(e){let t=0,l=this.fields;for(;t<l.length;){let i=l[t];if(++t,i.name==e)return i.value}return null}each(e){if(super.each(e),this.fields!=null){let t=0,l=this.fields.length;for(;t<l;){let i=t++,n=this.fields[i];e(n,this),n.each(e)}}}toJson(){let e=super.toJson();e.name=this.name,e.namePos=this.namePos.toJson();let t=[],l=0,i=this.fields;for(;l<i.length;){let n=i[l];++l,t.push(n.toJson())}return e.fields=t,e.style=Vl.toString(this.style),e}}Q["loreline.NCharacterDecl"]=jt,jt.__name__="loreline.NCharacterDecl",jt.__super__=Be,Object.assign(jt.prototype,{__class__:jt});class Me extends Be{constructor(e,t,l,i,n,s){super(e,t,n,s),this.name=l,this.body=i,this.style=0}type(){return"Beat"}each(e){if(super.each(e),this.body!=null){let t=0,l=this.body.length;for(;t<l;){let i=t++,n=this.body[i];e(n,this),n.each(e)}}}toJson(){let e=super.toJson();e.name=this.name;let t=[],l=0,i=this.body;for(;l<i.length;){let n=i[l];++l,t.push(n.toJson())}return e.body=t,e.style=Vl.toString(this.style),e}}Q["loreline.NBeatDecl"]=Me,Me.__name__="loreline.NBeatDecl",Me.__super__=Be,Object.assign(Me.prototype,{__class__:Me});var ze=Ye["loreline.StringPartType"]={__ename__:"loreline.StringPartType",__constructs__:null,Raw:(w=function(b){return{_hx_index:0,text:b,__enum__:"loreline.StringPartType",toString:F}},w._hx_name="Raw",w.__params__=["text"],w),Expr:(w=function(b){return{_hx_index:1,expr:b,__enum__:"loreline.StringPartType",toString:F}},w._hx_name="Expr",w.__params__=["expr"],w),Tag:(w=function(b,e){return{_hx_index:2,closing:b,expr:e,__enum__:"loreline.StringPartType",toString:F}},w._hx_name="Tag",w.__params__=["closing","expr"],w)};ze.__constructs__=[ze.Raw,ze.Expr,ze.Tag];class Vl{static toString(e){switch(e){case 0:return"Plain";case 1:return"Braces"}}}class Ni{static toString(e){switch(e){case 0:return"Plain";case 2:return"Parens"}}}class Mi{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 Ge extends ct{constructor(e,t,l,i,n){super(e,t,i,n),this.partType=l}type(){return"Part"}each(e){super.each(e);let t=this.partType;switch(t._hx_index){case 0:let l=t.text;break;case 1:let i=t.expr;e(i,this),i.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 l=t.text;e.part="Raw",e.text=l;break;case 1:let i=t.expr;e.part="Expr",e.expression=i.toJson();break;case 2:let n=t.closing,s=t.expr;e.part="Tag",e.closing=n,e.content=s.toJson();break}return e}}Q["loreline.NStringPart"]=Ge,Ge.__name__="loreline.NStringPart",Ge.__super__=ct,Object.assign(Ge.prototype,{__class__:Ge});class Nt extends ct{constructor(e,t,l,i,n,s){super(e,t,n,s),this.parts=i,this.quotes=l}type(){return"String"}each(e){if(super.each(e),this.parts!=null){let t=0,l=this.parts.length;for(;t<l;){let i=t++,n=this.parts[i];e(n,this),n.each(e)}}}toJson(){let e=super.toJson(),t=[],l=0,i=this.parts;for(;l<i.length;){let s=i[l];++l,t.push(s.toJson())}let n=t;return e.parts=n,e.quotes=fn.toString(this.quotes),e}}Q["loreline.NStringLiteral"]=Nt,Nt.__name__="loreline.NStringLiteral",Nt.__super__=ct,Object.assign(Nt.prototype,{__class__:Nt});class ll extends Be{constructor(e,t,l,i,n){super(e,t,i,n),this.content=l,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=Ni.toString(this.conditionStyle),e.conditionPos=this.conditionPos.toJson()),e}}Q["loreline.NTextStatement"]=ll,ll.__name__="loreline.NTextStatement",ll.__super__=Be,Object.assign(ll.prototype,{__class__:ll});class Kt extends Be{constructor(e,t,l,i,n,s,r){super(e,t,s,r),this.character=l,this.characterPos=i,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=Ni.toString(this.conditionStyle),e.conditionPos=this.conditionPos.toJson()),e}}Q["loreline.NDialogueStatement"]=Kt,Kt.__name__="loreline.NDialogueStatement",Kt.__super__=Be,Object.assign(Kt.prototype,{__class__:Kt});class xl extends Be{constructor(e,t,l,i,n){super(e,t,i,n),this.options=l,this.style=0}type(){return"Choice"}each(e){if(super.each(e),this.options!=null){let t=0,l=this.options.length;for(;t<l;){let i=t++,n=this.options[i];e(n,this),n.each(e)}}}toJson(){let e=super.toJson(),t=[],l=0,i=this.options;for(;l<i.length;){let n=i[l];++l,t.push(n.toJson())}return e.options=t,e.style=Vl.toString(this.style),e}}Q["loreline.NChoiceStatement"]=xl,xl.__name__="loreline.NChoiceStatement",xl.__super__=Be,Object.assign(xl.prototype,{__class__:xl});class St extends Be{constructor(e,t,l,i,n,s,r,a,h){super(e,t,a,h),this.text=l,this.insertion=i,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,l=this.body.length;for(;t<l;){let i=t++,n=this.body[i];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=Ni.toString(this.conditionStyle),e.conditionPos=this.conditionPos.toJson());let t=[],l=0,i=this.body;for(;l<i.length;){let n=i[l];++l,t.push(n.toJson())}return e.body=t,e.style=Vl.toString(this.style),this.once&&(e.once=!0),e}}Q["loreline.NChoiceOption"]=St,St.__name__="loreline.NChoiceOption",St.__super__=Be,Object.assign(St.prototype,{__class__:St});class hl extends Be{constructor(e,t,l,i,n){super(e,t,i,n),this.body=l,this.style=0}type(){return"Block"}each(e){if(super.each(e),this.body!=null){let t=0,l=this.body.length;for(;t<l;){let i=t++,n=this.body[i];e(n,this),n.each(e)}}}toJson(){let e=super.toJson(),t=[],l=0,i=this.body;for(;l<i.length;){let n=i[l];++l,t.push(n.toJson())}return e.body=t,e.style=Vl.toString(this.style),e}}Q["loreline.NBlock"]=hl,hl.__name__="loreline.NBlock",hl.__super__=Be,Object.assign(hl.prototype,{__class__:hl});class wl extends Be{constructor(e,t,l,i,n,s,r,a,h,o){super(e,t,r,a),this.condition=l,this.conditionStyle=i,this.thenBranch=n,this.elseBranch=s,this.elseLeadingComments=h,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,l=this.elseLeadingComments;for(;t<l.length;){let i=l[t];++t,e(i,this),i.each(e)}}if(this.elseTrailingComments!=null){let t=0,l=this.elseTrailingComments;for(;t<l.length;){let i=l[t];++t,e(i,this),i.each(e)}}}toJson(){let e=super.toJson();e.condition=this.condition.toJson(),e.conditionStyle=Ni.toString(this.conditionStyle);let t=[],l=0,i=this.thenBranch.body;for(;l<i.length;){let n=i[l];++l,t.push(n.toJson())}if(e.thenBranch=t,e.thenStyle=Vl.toString(this.thenBranch.style),this.elseBranch!=null){let n=[],s=0,r=this.elseBranch.body;for(;s<r.length;){let a=r[s];++s,n.push(a.toJson())}if(e.elseBranch=n,e.elseStyle=Vl.toString(this.elseBranch.style),this.elseLeadingComments!=null&&this.elseLeadingComments.length>0||this.elseTrailingComments!=null&&this.elseTrailingComments.length>0){let a=e.comments,h=a??{};if(this.elseLeadingComments!=null&&this.elseLeadingComments.length>0){let o=[],u=0,p=this.elseLeadingComments;for(;u<p.length;){let _=p[u];++u,o.push(_.toJson())}h.elseLeading=o}if(this.elseTrailingComments!=null&&this.elseTrailingComments.length>0){let o=[],u=0,p=this.elseTrailingComments;for(;u<p.length;){let _=p[u];++u,o.push(_.toJson())}h.elseTrailing=o}e.comments=h}}return e}}Q["loreline.NIfStatement"]=wl,wl.__name__="loreline.NIfStatement",wl.__super__=Be,Object.assign(wl.prototype,{__class__:wl});class Hl extends Be{constructor(e,t,l,i,n,s){super(e,t,n,s),this.mode=l,this.items=i,this.style=0}type(){return"Alternative"}each(e){if(super.each(e),this.items!=null){let t=0,l=this.items.length;for(;t<l;){let i=t++,n=this.items[i];e(n,this),n.each(e)}}if(this.separatorComments!=null){let t=0,l=this.separatorComments;for(;t<l.length;){let i=l[t];if(++t,i!=null){let n=0;for(;n<i.length;){let s=i[n];++n,e(s,this),s.each(e)}}}}}toJson(){let e=super.toJson();e.mode=Mi.toString(this.mode);let t=[],l=0,i=this.items;for(;l<i.length;){let n=i[l];++l,t.push(n.toJson())}if(e.items=t,e.style=Vl.toString(this.style),this.separatorComments!=null){let n=[],s=0,r=this.separatorComments;for(;s<r.length;){let a=r[s];++s;let h;if(a!=null){let o=[],u=0;for(;u<a.length;){let p=a[u];++u,o.push(p.toJson())}h=o}else h=null;n.push(h)}e.separatorComments=n}return e}}Q["loreline.NAlternative"]=Hl,Hl.__name__="loreline.NAlternative",Hl.__super__=Be,Object.assign(Hl.prototype,{__class__:Hl});class Jt extends ct{constructor(e,t,l,i,n,s){super(e,t,n,s),this.target=l,this.args=i}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,l=this.args;for(;t<l.length;){let i=l[t];++t,e(i,this),i.each(e)}}}toJson(){let e=super.toJson();e.target=this.target.toJson();let t=[],l=0,i=this.args;for(;l<i.length;){let n=i[l];++l,t.push(n.toJson())}return e.args=t,e}}Q["loreline.NCall"]=Jt,Jt.__name__="loreline.NCall",Jt.__super__=ct,Object.assign(Jt.prototype,{__class__:Jt});class Dl extends Be{constructor(e,t,l,i,n,s){super(e,t,n,s),this.target=l,this.targetPos=i}type(){return"Transition"}toJson(){let e=super.toJson();return e.target=this.target,e.targetPos=this.targetPos.toJson(),e}}Q["loreline.NTransition"]=Dl,Dl.__name__="loreline.NTransition",Dl.__super__=Be,Object.assign(Dl.prototype,{__class__:Dl});class $l extends Be{constructor(e,t,l,i,n,s){super(e,t,n,s),this.target=l,this.targetPos=i}type(){return"Insertion"}toJson(){let e=super.toJson();return e.target=this.target,e.targetPos=this.targetPos.toJson(),e}}Q["loreline.NInsertion"]=$l,$l.__name__="loreline.NInsertion",$l.__super__=Be,Object.assign($l.prototype,{__class__:$l});class ql extends ct{constructor(e,t,l,i,n,s,r,a){super(e,t,r,a),this.name=l,this.args=i,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}}Q["loreline.NFunctionDecl"]=ql,ql.__name__="loreline.NFunctionDecl",ql.__super__=ct,Object.assign(ql.prototype,{__class__:ql});class je extends ct{constructor(e,t,l,i,n,s){super(e,t,n,s),this.value=l,this.literalType=i}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 i=0,n=this.value;for(;i<n.length;){let s=n[i];if(++i,s instanceof At){let r=s;e(r,this),r.each(e)}}}break;case 4:let l=t.style;if(this.value!=null){let i=0,n=this.value;for(;i<n.length;){let s=n[i];if(++i,s.value instanceof At){let r=s.value;e(r,this),r.each(e)}}}break}}toJson(){let e=super.toJson(),t=this.literalType;e.literal=Ye[t.__enum__].__constructs__[t._hx_index]._hx_name;let l=this.literalType;switch(l._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 a=r[s];++s,a instanceof At?n.push(a.toJson()):n.push(a)}e.value=n}break;case 4:let i=l.style;if(this.value!=null){let n=[],s=0,r=this.value;for(;s<r.length;){let a=r[s];++s,n.push(a.toJson())}e.value=n}else e.value=[];e.style=Vl.toString(i);break}return e}}Q["loreline.NLiteral"]=je,je.__name__="loreline.NLiteral",je.__super__=ct,Object.assign(je.prototype,{__class__:je});var Ke=Ye["loreline.LiteralType"]={__ename__:"loreline.LiteralType",__constructs__:null,Number:{_hx_name:"Number",_hx_index:0,__enum__:"loreline.LiteralType",toString:F},Boolean:{_hx_name:"Boolean",_hx_index:1,__enum__:"loreline.LiteralType",toString:F},Null:{_hx_name:"Null",_hx_index:2,__enum__:"loreline.LiteralType",toString:F},Array:{_hx_name:"Array",_hx_index:3,__enum__:"loreline.LiteralType",toString:F},Object:(w=function(b){return{_hx_index:4,style:b,__enum__:"loreline.LiteralType",toString:F}},w._hx_name="Object",w.__params__=["style"],w)};Ke.__constructs__=[Ke.Number,Ke.Boolean,Ke.Null,Ke.Array,Ke.Object];class ft extends ct{constructor(e,t,l,i,n,s){super(e,t,n,s),this.target=l,this.name=i}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}}Q["loreline.NAccess"]=ft,ft.__name__="loreline.NAccess",ft.__super__=ct,Object.assign(ft.prototype,{__class__:ft});class kl extends ct{constructor(e,t,l,i,n,s,r){super(e,t,s,r),this.target=l,this.op=i,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=Y.string(this.op),e.value=this.value.toJson(),e}}Q["loreline.NAssign"]=kl,kl.__name__="loreline.NAssign",kl.__super__=ct,Object.assign(kl.prototype,{__class__:kl});class gl extends ct{constructor(e,t,l,i,n,s){super(e,t,n,s),this.target=l,this.index=i}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}}Q["loreline.NArrayAccess"]=gl,gl.__name__="loreline.NArrayAccess",gl.__super__=ct,Object.assign(gl.prototype,{__class__:gl});class il extends ct{constructor(e,t,l,i,n,s,r){super(e,t,s,r),this.left=l,this.op=i,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=Y.string(this.op),e.right=this.right.toJson(),e}}Q["loreline.NBinary"]=il,il.__name__="loreline.NBinary",il.__super__=ct,Object.assign(il.prototype,{__class__:il});class Yl extends ct{constructor(e,t,l,i,n,s){super(e,t,n,s),this.op=l,this.operand=i}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=Y.string(this.op),e.operand=this.operand.toJson(),e}}Q["loreline.NUnary"]=Yl,Yl.__name__="loreline.NUnary",Yl.__super__=ct,Object.assign(Yl.prototype,{__class__:Yl});class ii extends ct{constructor(e,t,l,i,n,s,r){super(e,t,s,r),this.condition=l,this.trueExpr=i,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}}Q["loreline.NTernary"]=ii,ii.__name__="loreline.NTernary",ii.__super__=ct,Object.assign(ii.prototype,{__class__:ii});class Rt extends Be{constructor(e,t,l,i,n,s){super(e,t,n,s),this.path=l,this.script=i}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}}Q["loreline.NImportStatement"]=Rt,Rt.__name__="loreline.NImportStatement",Rt.__super__=Be,Object.assign(Rt.prototype,{__class__:Rt});class he{static isFields(e){return te.__implements(e,Ml)||e instanceof Ee?!0:e instanceof Kl||typeof e=="number"&&(e|0)===e||typeof e=="number"||typeof e=="boolean"||typeof e=="string"?!1:!oe.isArray(e)}static getField(e,t,l){return te.__implements(t,Ml)?t.lorelineGet(e,l):t instanceof Ee?t.h[l]:We.getProperty(t,l)}static getFields(e,t){if(te.__implements(t,Ml))return t.lorelineFields(e);if(t instanceof Ee){let l=[],i=t.h,n=i,s=Object.keys(i),r=s.length,a=0;for(;a<r;){let h=s[a++];l.push(h)}return l}else return We.fields(t)}static setField(e,t,l,i){te.__implements(t,Ml)?t.lorelineSet(e,l,i):t instanceof Ee?t.h[l]=i:We.setProperty(t,l,i)}static removeField(e,t,l){if(te.__implements(t,Ml))return t.lorelineRemove(e,l);if(t instanceof Ee){let i=t;return Object.prototype.hasOwnProperty.call(i.h,l)?(delete i.h[l],!0):!1}else return We.deleteField(t,l)}static fieldExists(e,t,l){return te.__implements(t,Ml)?t.lorelineExists(e,l):t instanceof Ee?Object.prototype.hasOwnProperty.call(t.h,l):Object.prototype.hasOwnProperty.call(t,l)}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,l){if(e!=null&&e.customCreateFields!=null){let i=e.customCreateFields(e,t,l);if(i!=null)return i}if(t!=null){let i=Object.create(Q[t].prototype);return te.__implements(i,Ml)&&i.lorelineCreate(e),i}return new Ee}}Q["loreline.Objects"]=he,he.__name__="loreline.Objects";class Ne extends st{constructor(e,t){super(e,t)}}Q["loreline.ParseError"]=Ne,Ne.__name__="loreline.ParseError",Ne.__super__=st,Object.assign(Ne.prototype,{__class__:Ne});class Fi{constructor(e,t,l,i){this.imported=new Ee,this.rootPath=e,this.path=t,this.imports=l,i!=null&&(this.imported=i)}}Q["loreline.ParserContext"]=Fi,Fi.__name__="loreline.ParserContext",Object.assign(Fi.prototype,{__class__:Fi});class Gl{constructor(e,t){this.tokens=e,this.current=0,this.errors=null,this.pendingComments=null,this.lastTokenEnd=new ue(1,1,0),this.lastLineBreak=null,this.lineBreakAfterToken=!1,this.currentNodeId=Ae.UNDEFINED,this.rootBeat=null,this.context=t}parse(){let e=this.currentPos(),t=[],l=new nl(this.nextNodeId(4),e,t);for(this.context!=null&&(l.filePath=this.context.path);!this.isAtEnd();)try{let i=this.parseNode(!0);for(i!=null&&t.push(i);this.match(k.LineBreak););}catch(i){let n=T.caught(i).unwrap();if(n instanceof Ne){let s=n;this.addError(s),this.synchronize()}else throw i}return this.attachComments(l),l}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 l=t.content;++e;break;case 52:let i=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==k.LineBreak);){this.current++;let l=this.tokens[this.current].type;switch(l._hx_index){case 51:let i=l.content;this.pendingComments==null&&(this.pendingComments=[]),this.pendingComments.push(new Ql(this.nextNodeId(4),this.currentPos(),i,!1));break;case 52:let n=l.content;this.pendingComments==null&&(this.pendingComments=[]),this.pendingComments.push(new Ql(this.nextNodeId(4),this.currentPos(),n,!0));break;case 53:let s=l.content;this.pendingComments==null&&(this.pendingComments=[]),this.pendingComments.push(new Ql(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(Lt.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 l=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 l=t.content;break;case 52:let i=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 l=t.content;break;case 52:let i=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 l=t.content;break;case 52:let i=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 ue(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?Lt.toCodeString(t):null}return null}check(e){return this.isAtEnd()?!1:e._hx_index==41?this.tokens[this.current].type==k.Colon:Lt.equals(this.tokens[this.current].type,e)}checkString(){let e=this.tokens[this.current].type;if(e._hx_index==15){let t=e.attachments,l=e.quotes,i=e.s;return!0}else return!1}isAtEnd(){return this.current<this.tokens.length?this.tokens[this.current].type==k.Eof:!0}isComment(e){switch(e._hx_index){case 51:let t=e.content;return!0;case 52:let l=e.content;return!0;case 53:let i=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==k.LineBreak;){if(this.isComment(this.tokens[this.current].type)){this.pendingComments==null&&(this.pendingComments=[]);let i=this.pendingComments,n=this.nextNodeId(4),s=this.currentPos(),r=this.tokens[this.current].type,a;switch(r._hx_index){case 51:a=r.content;break;case 52:a=r.content;break;case 53:a=r.content;break;default:a=""}let h=this.tokens[this.current].type,o;if(h._hx_index==52){let _=h.content;o=!0}else o=!1;let u=this.tokens[this.current].type,p;if(u._hx_index==53){let _=u.content;p=!0}else p=!1;i.push(new Ql(n,s,a,o,p))}if(this.advance(),this.isAtEnd())throw T.thrown(new Ne("Unexpected end of file",this.currentPos()))}if(this.isAtEnd())throw T.thrown(new Ne("Unexpected end of file",this.currentPos()));let t=this,l=this.tokens[this.current].type;switch(l._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 je(this.nextNodeId(4),this.currentPos(),null,Ke.Null));case 4:let i=this.parseChoiceStatement();return e?t.wrapInRootBeat(i):i;case 5:let n=this.parseIfStatement();return e?t.wrapInRootBeat(n):n;case 7:if(this.advance(),!this.check(k.KwState))throw T.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 a=l.name,h=l.args,o=l.code,u=l.external;return e?this.parseFunction():(this.addError(new Ne("Unexpected: "+this.currentTokenTypeToString(),this.currentPos())),this.advance(),new je(this.nextNodeId(4),this.currentPos(),null,Ke.Null));case 15:let p=l.quotes,_=l.s,m=l.attachments,f=this.parseTextStatement();return e?t.wrapInRootBeat(f):f;case 16:let g=l.n,d=this.parseExpressionStatement();return e?t.wrapInRootBeat(d):d;case 17:let x=l.b,y=this.parseExpressionStatement();return e?t.wrapInRootBeat(y):y;case 19:let S=l.name;if(this.peek().type==k.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 O=this.parseExpressionStatement();return e?t.wrapInRootBeat(O):O;case 40:let E=this.parseTransition();return e?t.wrapInRootBeat(E):E;default:return this.addError(new Ne("Unexpected: "+this.currentTokenTypeToString(),this.currentPos())),this.advance(),new je(this.nextNodeId(4),this.currentPos(),null,Ke.Null)}}wrapInRootBeat(e){let t,l=null;if(this.rootBeat==null){let i=this.currentPos();t=[],this.rootBeat=new Me(this.nextNodeId(1),i,"_",t),l=this.rootBeat}else t=this.rootBeat.body;return t.push(e),l}parseImport(){let e=this.currentPos();if(this.expect(k.KwImport),this.context==null)throw T.thrown(new Ne("Cannot import without a context",this.currentPos()));let t=0,l=this.tokens[this.current],i,n=l.type;if(n._hx_index==15){let _=n.attachments,m=n.quotes,f=n.s;t=m,i=f}else throw T.thrown(new Ne("Expected string literal for import path",this.currentPos()));let s=i;De.isAbsolute(s)||(s=De.join([De.directory(this.context.path),s])),s=De.normalize(s);let r,a;if(s==null)a=!1;else{let _=s.length;if(_<8)a=!1;else{let m,f,g,d,x,y,S=c.cca(s,_-8);if((S??-1)==46){let C=c.cca(s,_-7),O=C??-1;y=O==108||O==76}else y=!1;if(y){let C=c.cca(s,_-6),O=C??-1;x=O==111||O==79}else x=!1;if(x){let C=c.cca(s,_-5),O=C??-1;d=O==114||O==82}else d=!1;if(d){let C=c.cca(s,_-4);g=(C??-1)==46}else g=!1;if(g){let C=c.cca(s,_-3),O=C??-1;f=O==116||O==84}else f=!1;if(f){let C=c.cca(s,_-2),O=C??-1;m=O==120||O==88}else m=!1;if(m){let C=c.cca(s,_-1),O=C??-1;a=O==116||O==84}else a=!1}}if(a)r=!0;else if(s==null)r=!1;else{let _=s.length;if(_<4)r=!1;else{let m,f,g=c.cca(s,_-4);if((g??-1)==46){let d=c.cca(s,_-3),x=d??-1;f=x==108||x==76}else f=!1;if(f){let d=c.cca(s,_-2),x=d??-1;m=x==111||x==79}else m=!1;if(m){let d=c.cca(s,_-1),x=d??-1;r=x==114||x==82}else r=!1}}if(!r){let _=this.context.rootPath,m;if(_==null)m=!1;else{let f=_.length;if(f<8)m=!1;else{let g,d,x,y,S,C,O=c.cca(_,f-8);if((O??-1)==46){let E=c.cca(_,f-7),v=E??-1;C=v==108||v==76}else C=!1;if(C){let E=c.cca(_,f-6),v=E??-1;S=v==111||v==79}else S=!1;if(S){let E=c.cca(_,f-5),v=E??-1;y=v==114||v==82}else y=!1;if(y){let E=c.cca(_,f-4);x=(E??-1)==46}else x=!1;if(x){let E=c.cca(_,f-3),v=E??-1;d=v==116||v==84}else d=!1;if(d){let E=c.cca(_,f-2),v=E??-1;g=v==120||v==88}else g=!1;if(g){let E=c.cca(_,f-1),v=E??-1;m=v==116||v==84}else m=!1}}s+=m?".lor.txt":".lor"}if(Object.prototype.hasOwnProperty.call(this.context.imported.h,s)){this.advance();let _=new Rt(this.nextNodeId(1),e.extendedTo(this.prevNonWhitespaceOrComment().pos),null,null);return _.path=new Nt(this.nextNodeId(4),l.pos,t,[new Ge(this.nextNodeId(4),l.pos,ze.Raw(i))]),this.attachComments(_)}let h=this.context.imports.h[s];if(h==null)throw T.thrown(new Ne("Failed to import file at path "+s+" ("+i+")",this.currentPos()));this.context.imported.h[s]=!0;let o=new Gl(h,new Fi(this.context.rootPath,s,this.context.imports,this.context.imported));o.currentNodeId=this.currentNodeId;let u=o.parse();this.currentNodeId=o.currentNodeId,this.advance();let p=new Rt(this.nextNodeId(1),e.extendedTo(this.prevNonWhitespaceOrComment().pos),null,u);return p.path=new Nt(this.nextNodeId(4),l.pos,t,[new Ge(this.nextNodeId(4),l.pos,ze.Raw(i))]),this.attachComments(p)}parseDialogueStatement(){let e=this.currentPos(),t=new Kt(this.nextNodeId(4),e,null,null,null),l=this.tokens[this.current].type,i;if(l._hx_index==19)i=l.name;else throw T.thrown(new Ne("Expected character name",this.currentPos()));t.character=i,t.characterPos=this.tokens[this.current].pos,this.advance(),this.expect(k.Colon),this.attachComments(t);let n=!1;if(this.checkBlockStart()){let s=this.parseBlockStart();if(s.type!=k.Indent)throw T.thrown(new Ne("Expected indent, got "+Lt.toCodeString(s.type),s.pos));n=!0}try{t.content=this.parseStringLiteral()}catch(s){let r=T.caught(s).unwrap();if(r instanceof Ne){let a=r;this.addError(a),t.content=new Nt(this.nextNodeId(4),this.currentPos(),0,[new Ge(this.nextNodeId(4),this.currentPos(),ze.Raw("?"))])}else throw s}if(!this.lineBreakAfterToken&&this.match(k.KwIf)){let s=this.previous().pos;this.check(k.LParen)&&(t.conditionStyle=2),t.condition=this.parseConditionExpression(),t.conditionPos=s.extendedTo(this.prevNonWhitespaceOrComment().pos)}if(n){for(;this.match(k.LineBreak););this.expect(k.Unindent)}return t.pos=t.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),t}parseStatementBlock(e){let t=this.parseBlockStart().type==k.Indent?k.Unindent:k.RBrace;for(;!this.check(t)&&!this.isAtEnd();){for(;this.match(k.LineBreak)||t!=k.Unindent&&this.match(k.Unindent););if(this.check(t))break;try{e.push(this.parseNode())}catch(l){let i=T.caught(l).unwrap();if(i instanceof Ne){let n=i;if(this.errors==null&&(this.errors=[]),this.errors.push(n),this.synchronize(),this.check(t))break}else throw l}for(;this.match(k.LineBreak)||t!=k.Unindent&&this.match(k.Unindent););}return this.expect(t),t==k.RBrace?1:0}parseStateDecl(e){let t=this.currentPos(),l=new $t(this.nextNodeId(3),t,e,[]);this.expect(k.KwState);let i=this.parseBlockStart().type==k.Indent?k.Unindent:k.RBrace;for(l.style=i==k.RBrace?1:0,this.attachComments(l);!this.check(i)&&!this.isAtEnd();){for(;this.match(k.LineBreak)||i!=k.Unindent&&this.match(k.Unindent););for(l.fields.push(this.parseObjectField());this.match(k.LineBreak)||i!=k.Unindent&&this.match(k.Unindent););}for(;this.match(k.LineBreak)||i!=k.Unindent&&this.match(k.Unindent););return this.expect(i),l.pos=l.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),l}parseObjectField(){let e=this.currentPos(),t=this.expectIdentifier(),l=new Ul(this.nextNodeId(3),e,t,null);return this.expect(k.Colon),this.attachComments(l),this.checkBlockStart()?l.value=this.parseObjectLiteral():l.value=this.parseExpression(),l.pos=l.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),l}parseBeatDecl(){let e=this.currentPos(),t=new Me(this.nextNodeId(1),e,null,[],[]);this.expect(k.KwBeat),t.pos=e.extendedTo(this.currentPos()),t.name=this.expectIdentifier();let i=this.parseBlockStart().type==k.Indent?k.Unindent:k.RBrace;for(t.style=i==k.RBrace?1:0,this.attachComments(t);!this.check(i)&&!this.isAtEnd();){for(;this.match(k.LineBreak)||i!=k.Unindent&&this.match(k.Unindent););for(t.body.push(this.parseNode());this.match(k.LineBreak)||i!=k.Unindent&&this.match(k.Unindent););}for(;this.match(k.LineBreak)||i!=k.Unindent&&this.match(k.Unindent););return this.expect(i),t.pos=t.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),t}checkBlockStart(){let e=null,t=null,l=0,i=0;for(;this.current+i<this.tokens.length;){let n=this.tokens[this.current+i];if(++i,n.type!=k.LineBreak){if(n.type==k.Indent){++l,e=n;continue}if(n.type==k.LBrace){t==null&&(t=n);continue}break}}if(t!=null)return!0;if(e!=null){if(l>1)throw T.thrown(new Ne("Invalid indentation level",e.pos));return!0}else return!1}parseBlockStart(){let e=null,t=null,l=0;for(;!this.isAtEnd();)if(!this.match(k.LineBreak)){if(this.match(k.Indent)){++l,e=this.prevWithType(k.Indent);continue}if(this.match(k.LBrace)){t==null&&(t=this.prevWithType(k.LBrace));continue}break}if(t!=null)return t;if(e!=null){if(l>1)throw T.thrown(new Ne("Invalid indentation level",e.pos));return e}else return this.addError(new Ne("Expected "+Lt.toCodeString(k.LBrace)+" or "+Lt.toCodeString(k.Indent)+", got "+this.currentTokenTypeToString(),this.currentPos())),new ye(k.Indent,this.currentPos())}parseCharacterDecl(){let e=this.currentPos(),t=new jt(this.nextNodeId(3),e,null,null,[]);this.expect(k.KwCharacter),t.name=this.expectIdentifier(),t.namePos=this.prevNonWhitespaceOrComment().pos;let l=this.parseBlockStart().type==k.Indent?k.Unindent:k.RBrace;for(t.style=l==k.RBrace?1:0,this.attachComments(t);!this.check(l)&&!this.isAtEnd();){for(;this.match(k.LineBreak)||l!=k.Unindent&&this.match(k.Unindent););for(t.fields.push(this.parseObjectField());this.match(k.LineBreak)||l!=k.Unindent&&this.match(k.Unindent););}for(;this.match(k.LineBreak)||l!=k.Unindent&&this.match(k.Unindent););return this.expect(l),t.pos=t.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),t}parseTextStatement(){let e=this.currentPos(),t=this.attachComments(new ll(this.nextNodeId(4),e,null));if(t.content=this.parseStringLiteral(),!this.lineBreakAfterToken&&this.match(k.KwIf)){let l=this.previous().pos;this.check(k.LParen)&&(t.conditionStyle=2),t.condition=this.parseConditionExpression(),t.conditionPos=l.extendedTo(this.prevNonWhitespaceOrComment().pos)}return t.pos=t.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),t}parseChoiceStatement(){let e=this.currentPos(),t=new xl(this.nextNodeId(2),e,[]);this.expect(k.KwChoice);let l=this.parseBlockStart().type==k.Indent?k.Unindent:k.RBrace;for(t.style=l==k.RBrace?1:0,this.attachComments(t);!this.check(l)&&!this.isAtEnd();){for(;this.match(k.LineBreak)||l!=k.Unindent&&this.match(k.Unindent););for(t.options.push(this.parseChoiceOption(l));this.match(k.LineBreak)||l!=k.Unindent&&this.match(k.Unindent););}return this.expect(l),t.pos=t.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),t}parseChoiceOption(e){let t=this.currentPos(),l=this.attachComments(new St(this.nextNodeId(3),t,null,null,null,0,[])),i=null,n=!1;try{this.check(k.OpPlus)?(n=!0,l.insertion=this.parseInsertion()):(this.match(k.OpMinus)&&(l.once=!0),l.text=this.parseStringLiteral())}catch(s){let r=T.caught(s).unwrap();if(r instanceof Ne){let a=r;this.addError(a),i=this.currentPos(),this.currentPos().offset==t.offset&&this.advance(),l.text=new Nt(this.nextNodeId(4),this.currentPos(),0,[new Ge(this.nextNodeId(4),this.currentPos(),ze.Raw("?"))])}else throw s}if(this.match(k.KwIf)){let s=this.previous().pos,r=this.currentPos().offset;try{this.check(k.LParen)&&(l.conditionStyle=2),l.condition=this.parseConditionExpression(),l.conditionPos=s.extendedTo(this.prevNonWhitespaceOrComment().pos)}catch(a){let h=T.caught(a).unwrap();if(h instanceof Ne){let o=h;this.addError(o),i=this.currentPos(),this.currentPos().offset==r&&this.advance()}else throw a}}if(!n){if(this.checkBlockStart()){l.body=[];let s=this.currentPos().offset;try{l.style=this.parseStatementBlock(l.body)}catch(r){let a=T.caught(r).unwrap();if(a instanceof Ne){let h=a;this.addError(h),i=this.currentPos(),this.currentPos().offset==s&&this.advance(),l.body.length==0&&(l.body=[new je(this.nextNodeId(4),this.currentPos(),null,Ke.Null)])}else throw r}}else if(this.check(k.Arrow)){let s=this.currentPos().offset;try{l.body=[],l.body.push(this.parseNode())}catch(r){let a=T.caught(r).unwrap();if(a instanceof Ne){let h=a;this.addError(h),i=this.currentPos(),this.currentPos().offset==s&&this.advance(),l.body.length==0&&(l.body=[new je(this.nextNodeId(4),this.currentPos(),null,Ke.Null)])}else throw r}l.style=0}}if(l.pos=l.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),i!=null)for(;!this.isAtEnd()&&this.currentPos().line<=i.line+1;)this.advance();return l}isExpressionStart(){let e=this.tokens[this.current].type;switch(e._hx_index){case 15:let t=e.quotes,l=e.s,i=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!=k.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(k.OpAssign)||this.match(k.OpPlusAssign)||this.match(k.OpMinusAssign)||this.match(k.OpMultiplyAssign)||this.match(k.OpDivideAssign)||this.match(k.OpUnquotedAssign)){let t=this.previous().type,l=this.attachComments(new kl(this.nextNodeId(4),e.pos,e,t,null));return l.value=this.parseExpression(),l.pos=l.pos.extendedTo(l.value.pos),l}return this.attachComments(e)}isKnownNodeStart(){let e=this.tokens[this.current].type;switch(e._hx_index){case 15:let t=e.quotes,l=e.s,i=e.attachments;return!0;case 19:let n=e.name;return this.peek().type==k.Colon?!0:this.peek().type==k.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 wl(this.nextNodeId(4),e,null,0,null,null);for(this.expect(k.KwIf),this.check(k.LParen)&&(t.conditionStyle=2),t.condition=this.parseConditionExpression();this.match(k.LineBreak););this.attachComments(t),t.thenBranch=new hl(this.nextNodeId(3),this.currentPos(),null),t.thenBranch.body=[],t.thenBranch.style=this.parseStatementBlock(t.thenBranch.body);let l=this.tokens[this.current];if(l!=null&&l.type==k.KwElse){for(this.advance();this.match(k.LineBreak););if(this.attachElseComments(t,l),this.check(k.KwIf)){t.elseBranch=new hl(this.nextNodeId(3),this.currentPos(),null);let i=this.parseIfStatement();t.elseBranch.body=[i],t.elseBranch.style=0}else t.elseBranch=new hl(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 T.thrown(new Ne("Expected alternative keyword",this.currentPos()))}let l=new Hl(this.nextNodeId(2),e,t,[]);for(this.advance();this.match(k.LineBreak););this.attachComments(l);let i=new hl(this.nextNodeId(3),this.currentPos(),null);for(i.body=[],i.style=this.parseStatementBlock(i.body),l.items.push(i),l.style=i.style;this.check(k.Separator);){let n=this.tokens[this.current];for(this.advance();this.match(k.LineBreak););if(this.pendingComments!=null&&this.pendingComments.length>0){l.separatorComments==null&&(l.separatorComments=[]);let r=[],a=[],h=0,o=this.pendingComments;for(;h<o.length;){let u=o[h];++h,u.pos.line<=n.pos.line?r.push(u):a.push(u)}l.separatorComments.push(r),this.pendingComments=a}let s=new hl(this.nextNodeId(3),this.currentPos(),null);s.body=[],s.style=this.parseStatementBlock(s.body),l.items.push(s)}return l.pos=l.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),l}parseTransition(){let e=this.currentPos();if(this.expect(k.Arrow),this.match(k.Dot))return this.attachComments(new Dl(this.nextNodeId(4),e.extendedTo(this.prevNonWhitespaceOrComment().pos),".",this.prevNonWhitespaceOrComment().pos));let t=this.expectIdentifier();return this.attachComments(new Dl(this.nextNodeId(4),e.extendedTo(this.prevNonWhitespaceOrComment().pos),t,this.prevNonWhitespaceOrComment().pos))}parseInsertion(){let e=this.currentPos();this.expect(k.OpPlus);let t=this.expectIdentifier();return this.attachComments(new $l(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 l=t.name,i=t.args,n=t.code,s=t.external;return this.advance(),this.attachComments(new ql(this.nextNodeId(3),e,l,[].concat(i),n,s))}else throw T.thrown(new Ne("Unexpected token in expression",this.currentPos()))}parseExpression(){try{let e=this.parseTernary();if(this.check(k.OpAssign)||this.check(k.OpPlusAssign)||this.check(k.OpMinusAssign)||this.check(k.OpMultiplyAssign)||this.check(k.OpDivideAssign)||this.check(k.OpUnquotedAssign)){let t=this.tokens[this.current].type;this.advance();let l=this.attachComments(new kl(this.nextNodeId(4),e.pos,e,t,null));return l.value=this.parseExpression(),l.pos=l.pos.extendedTo(l.value.pos),l}return e}catch(e){let t=T.caught(e).unwrap();return t instanceof Ne&&this.addError(t),new je(this.nextNodeId(4),this.currentPos(),null,Ke.Null)}}parseTernary(){let e=this.parseLogicalOr();if(this.match(k.Question)){let t=this.parseTernary();this.expect(k.Colon);let l=this.parseTernary();e=this.attachComments(new ii(this.nextNodeId(4),e.pos,e,t,l)),e.pos=e.pos.extendedTo(l.pos)}return e}parseLogicalOr(){let e=this.parseLogicalAnd();for(;this.match(k.OpOr(!1));){let t=this.previous().type,l=this.attachComments(new il(this.nextNodeId(4),e.pos,e,t,null));l.right=this.parseLogicalAnd(),l.pos=l.pos.extendedTo(l.right.pos),e=l}return e}parseLogicalAnd(){let e=this.parseEquality();for(;this.match(k.OpAnd(!1));){let t=this.previous().type,l=this.attachComments(new il(this.nextNodeId(4),e.pos,e,t,null));l.right=this.parseEquality(),l.pos=l.pos.extendedTo(l.right.pos),e=l}return e}parseEquality(){let e=this.parseComparison();for(;this.match(k.OpEquals)||this.match(k.OpNotEquals);){let t=this.previous().type,l=this.attachComments(new il(this.nextNodeId(4),e.pos,e,t,null));l.right=this.parseComparison(),l.pos=l.pos.extendedTo(l.right.pos),e=l}return e}parseComparison(){let e=this.parseAdditive();for(;this.match(k.OpGreater)||this.match(k.OpGreaterEq)||this.match(k.OpLess)||this.match(k.OpLessEq);){let t=this.previous().type,l=this.attachComments(new il(this.nextNodeId(4),e.pos,e,t,null));l.right=this.parseAdditive(),l.pos=l.pos.extendedTo(l.right.pos),e=l}return e}parseAdditive(){let e=this.parseMultiplicative();for(;this.match(k.OpPlus)||this.match(k.OpMinus);){let t=this.previous().type,l=this.attachComments(new il(this.nextNodeId(4),e.pos,e,t,null));l.right=this.parseMultiplicative(),l.pos=l.pos.extendedTo(l.right.pos),e=l}return e}parseMultiplicative(){let e=this.parseUnary();for(;this.match(k.OpMultiply)||this.match(k.OpDivide)||this.match(k.OpModulo);){let t=this.previous().type,l=this.attachComments(new il(this.nextNodeId(4),e.pos,e,t,null));l.right=this.parseUnary(),l.pos=l.pos.extendedTo(l.right.pos),e=l}return e}parseUnary(){if(this.match(k.OpNot)||this.match(k.OpMinus)){let e=this.previous().type,t=this.attachComments(new Yl(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 l=t.quotes,i=t.s,n=t.attachments;return this.parsePostfix(e,this.parseStringLiteral());case 16:let s=t.n;return this.advance(),this.attachComments(new je(this.nextNodeId(4),e,s,Ke.Number));case 17:let r=t.b;return this.advance(),this.attachComments(new je(this.nextNodeId(4),e,r,Ke.Boolean));case 18:return this.advance(),this.attachComments(new je(this.nextNodeId(4),e,null,Ke.Null));case 19:let a=t.name;if(this.peek().type==k.Colon){let o=[this.parseObjectField()];return new je(this.nextNodeId(4),e.extendedTo(this.prevNonWhitespaceOrComment().pos),o,Ke.Object(0))}else return this.advance(),this.parseIdentifierExpression(e,a);break;case 45:return this.parsePostfix(e,this.parseObjectLiteral());case 47:this.advance();let h=this.parseExpression();return this.expect(k.RParen),this.parsePostfix(e,h);case 49:return this.parsePostfix(e,this.parseArrayLiteral());default:throw T.thrown(new Ne("Unexpected token in expression",this.currentPos()))}}parseStringLiteral(){let e=this.currentPos(),t=[],l=this.tokens[this.current].type;if(l._hx_index==15){let i=l.quotes,n=l.s,s=l.attachments,r=i!=0?e.withOffset(n,1,e.length-2):e,a=0;if(s==null||s.length==0){let p=this.makeStringPartPosition(r,n,0);p.length=r.length;let _=this.nextNodeId(4),m=this.nextNodeId(4);return t.push(new Ge(m,p,ze.Raw(n))),this.advance(),this.attachComments(new Nt(_,e,i,t))}let h=this.attachComments(new Nt(this.nextNodeId(4),e,i,t)),o=0,u=s.length;for(;o<u;){let p=o++,_=s[p];switch(_._hx_index){case 0:let m=_.braces,f=_.inTag,g=_.expr,d=_.start,x=_.length;if(a>=d+x)continue;if(d>a){let O=this.makeStringPartPosition(r,n,a);O.length=d-a;let E=d-a;t.push(new Ge(this.nextNodeId(4),O,ze.Raw(E!=null?c.substr(n,a,E):c.substr(n,a,null))))}t.push(this.parseStringInterpolation(m,f,g,d,x,n)),a=d+x;break;case 1:let y=_.closing,S=_.start,C=_.length;if(a>=S+C)continue;if(S>a){let O=this.makeStringPartPosition(r,n,a);O.length=S-a;let E=S-a;t.push(new Ge(this.nextNodeId(4),O,ze.Raw(E!=null?c.substr(n,a,E):c.substr(n,a,null))))}t.push(this.parseStringTag(y,S,C,n,i,s)),a=S+C;break}}if(a<n.length){let p=this.makeStringPartPosition(r,n,a);p.length=n.length-a;let _=null;t.push(new Ge(this.nextNodeId(4),p,ze.Raw(_!=null?c.substr(n,a,_):c.substr(n,a,null))))}if(this.advance(),this.pendingComments!=null){let p=null,_=0,m=this.pendingComments;for(;_<m.length;){let f=m[_];++_,f.pos.line==e.line?(h.trailingComments==null&&(h.trailingComments=[]),h.trailingComments.push(f)):(p==null&&(p=[]),p.push(f))}this.pendingComments=p}return h}else throw T.thrown(new Ne("Expected text, got "+this.currentTokenTypeToString(),this.currentPos()))}makeStringPartPosition(e,t,l){let i=e.line,n=e.column,s=0,r=l;for(;s<r;){let a=s++,h=c.cca(t,a);(h??-1)==10?(++i,n=1):++n}return new ue(i,n,e.offset+l)}makeAccess(e,t,l,i){if(l!=null){if(l.length==0&&(this.errors==null||this.errors.length==0)&&this.addError(new Ne("Invalid access: "+(l!=null?"'"+l+"'":"null"),e)),t!=null)if(i!=null)e=new ue(t.pos.line,t.pos.column,t.pos.offset,i.offset+l.length-t.pos.offset);else throw T.thrown(new Ne("Invalid access (missing name position)",e));else if(e.length==0){let n=i!=null?i.length:null;e=new ue(e.line,e.column,e.offset,n??l.length)}}return new ft(this.nextNodeId(4),e,t,l)}parseStringInterpolation(e,t,l,i,n,s){let r=l[0],a=r!=null?r.pos:null,h=this.makeStringPartPosition(a??this.currentPos(),s,i);if(h.length=n,l.length==0){let p=l[0],_=p!=null?p.pos:null;this.addError(new Ne("Empty interpolation",_??this.currentPos()));let m=this.nextNodeId(4),f=this.nextNodeId(4),g=l[0],d=g!=null?g.pos:null;return new Ge(m,h,ze.Expr(new je(f,d??this.currentPos(),null,Ke.Null)))}let o=null;if(!e&&l.length>0){let p=null,_=0,m=!1;for(;_<l.length;){let f=l[_];++_;let g=f.type;switch(g._hx_index){case 19:let d=g.name;if(p==null)p=this.attachComments(this.makeAccess(f.pos,null,d,null));else if(m)p=this.attachComments(this.makeAccess(f.pos,p,d,f.pos));else{this.addError(new Ne("Missing dot in field access",f.pos));let U=this.nextNodeId(4),z=this.nextNodeId(4),J=l[0],H=J!=null?J.pos:null;return new Ge(U,h,ze.Expr(new je(z,H??this.currentPos(),null,Ke.Null)))}m=!1;break;case 44:if(p==null){this.addError(new Ne("Leading dot in field access",f.pos));let U=this.nextNodeId(4),z=this.nextNodeId(4),J=l[0],H=J!=null?J.pos:null;return new Ge(U,h,ze.Expr(new je(z,H??this.currentPos(),null,Ke.Null)))}m=!0;break;case 47:if(p==null){this.addError(new Ne("Function call without target",f.pos));let U=this.nextNodeId(4),z=this.nextNodeId(4),J=l[0],H=J!=null?J.pos:null;return new Ge(U,h,ze.Expr(new je(z,H??this.currentPos(),null,Ke.Null)))}let x=f.pos,y=[],S=[],C=1;for(;_<l.length&&C>0;){let U=l[_];switch(++_,U.type._hx_index){case 43:C==1?S.length>0&&(y.push(S),S=[]):S.push(U);break;case 47:++C,S.push(U);break;case 48:--C,C>0?S.push(U):S.length>0&&y.push(S);break;default:S.push(U)}}if(C>0){this.addError(new Ne("Unterminated function call",x));let U=this.nextNodeId(4),z=this.nextNodeId(4),J=l[0],H=J!=null?J.pos:null;return new Ge(U,h,ze.Expr(new je(z,H??this.currentPos(),null,Ke.Null)))}let O=[],E=0;for(;E<y.length;){let U=y[E];++E;let z=new Gl(U);z.currentNodeId=this.currentNodeId;let J=z.parseExpression();O.push(J),this.currentNodeId=z.currentNodeId}p=this.attachComments(new Jt(this.nextNodeId(4),x.extendedTo(l[_-1].pos),p,O)),m=!1;break;case 49:if(p==null){this.addError(new Ne("Array access without target",f.pos));let U=this.nextNodeId(4),z=this.nextNodeId(4),J=l[0],H=J!=null?J.pos:null;return new Ge(U,h,ze.Expr(new je(z,H??this.currentPos(),null,Ke.Null)))}let v=f.pos,N=[],B=1,L=null;for(;_<l.length&&B>0;){let U=l[_];switch(++_,U.type._hx_index){case 49:++B,N.push(U);break;case 50:--B,B>0&&N.push(U),L=U;break;default:N.push(U)}}if(B>0){this.addError(new Ne("Unterminated array access",v));let U=this.nextNodeId(4),z=this.nextNodeId(4),J=l[0],H=J!=null?J.pos:null;return new Ge(U,h,ze.Expr(new je(z,H??this.currentPos(),null,Ke.Null)))}let I=new Gl(N);I.currentNodeId=this.currentNodeId;let W=I.parseExpression();this.currentNodeId=I.currentNodeId;let q=h.extendedTo(l[_-1].pos);q.length+=1,p=this.attachComments(new gl(this.nextNodeId(4),q,p,W)),m=!1;break;default:this.addError(new Ne("Unexpected token in field access: "+Lt.toCodeString(f.type),f.pos));let P=this.nextNodeId(4),R=this.nextNodeId(4),M=l[0],D=M!=null?M.pos:null;return new Ge(P,h,ze.Expr(new je(R,D??this.currentPos(),null,Ke.Null)))}}m&&this.addError(new Ne("Trailing dot in field access",l[l.length-1].pos)),o=p}else{let p=new Gl(l);p.currentNodeId=this.currentNodeId,o=p.parseExpression(),this.currentNodeId=p.currentNodeId,p.isAtEnd()||this.addError(new Ne("Unexpected tokens after interpolation expression",p.tokens[p.current].pos))}let u=new ue(h.line,h.column+(e?1:0),h.offset-(e?2:0),n);return new Ge(this.nextNodeId(4),u,ze.Expr(o))}parseStringTag(e,t,l,i,n,s){let r=this.currentPos();n!=0&&(r=r.withOffset(i,1,r.length-2));let a=this.makeStringPartPosition(r,i,t);a.length=l;let h=e?2:1,o=t+h,u=l-(e?3:2),p=o+u,_=this.nextNodeId(4),m=!1;if(s!=null){let x=0,y=s.length;e:for(;x<y;){let S=x++,C=s[S];switch(C._hx_index){case 0:let O=C.braces,E=C.inTag,v=C.expr,N=C.start,B=C.length,L=N+B;if(N>=o&&L<=p){m=!0;break e}break;case 1:let I=C.closing,W=C.start,q=C.length;continue}}}if(!m){let x=this.makeStringPartPosition(r,i,o);x.length=u;let y=this.nextNodeId(4),S=this.nextNodeId(4);return new Ge(_,a,ze.Tag(e,this.attachComments(new Nt(y,x,0,[new Ge(S,x,ze.Raw(u!=null?c.substr(i,o,u):c.substr(i,o,null)))]))))}let f=[],g=this.attachComments(new Nt(this.nextNodeId(4),a,0,f)),d=o;if(s!=null){let x=0,y=s.length;for(;x<y;){let S=x++,C=s[S];switch(C._hx_index){case 0:let O=C.inTag,E=C.braces,v=C.expr,N=C.start,B=C.length,L=N+B;if(N>=o&&L<=p){if(N>d){let R=this.makeStringPartPosition(r,i,o);R.length=N-o;let M=N-d;f.push(new Ge(this.nextNodeId(4),R,ze.Raw(M!=null?c.substr(i,d,M):c.substr(i,d,null))))}let P=this.parseStringInterpolation(E,!0,v,N,B,i);P.pos=this.makeStringPartPosition(r,i,N),P.pos.length=B,f.push(P),d=L}break;case 1:let I=C.closing,W=C.start,q=C.length;continue}}}if(d<p){let x=null,y=this.makeStringPartPosition(a,x!=null?c.substr(i,t,x):c.substr(i,t,null),d-t+h);y.length=o+p-d;let S=p-d;f.push(new Ge(this.nextNodeId(4),y,ze.Raw(S!=null?c.substr(i,d,S):c.substr(i,d,null))))}return new Ge(_,a,ze.Tag(e,g))}parseIdentifierExpression(e,t){let l=this.attachComments(this.makeAccess(e,null,t,null));return this.parsePostfix(e,l)}parsePostfix(e,t){for(;;)if(this.match(k.Dot,!1)){let l=null,i=this.currentPos();this.checkIdentifier()?l=this.expectIdentifier():(this.addError(new Ne("Expected identifier after '.'",this.currentPos())),l=""),t=this.attachComments(this.makeAccess(e,t,l,i))}else if(this.match(k.LBracket)){let l=this.parseExpression();this.expect(k.RBracket);let i=e.extendedTo(this.previous().pos);t=this.attachComments(new gl(this.nextNodeId(4),i,t,l))}else if(this.match(k.LParen)){let l=this.parseCallArguments();t=this.attachComments(new Jt(this.nextNodeId(4),e.extendedTo(this.previous().pos),t,l))}else break;return t}parseArrayLiteral(){let e=this.currentPos(),t=[],l=new je(this.nextNodeId(4),e,t,Ke.Array);this.expect(k.LBracket),this.attachComments(l);let i=!1;for(;!this.check(k.RBracket)&&!this.isAtEnd();){if(i){for(;this.match(k.LineBreak);)i=!1;this.match(k.Comma)&&(i=!1)}for(;this.match(k.LineBreak)||this.match(k.Indent)||this.match(k.Unindent);)i=!1;if(!this.check(k.RBracket)&&i)throw T.thrown(new Ne("Expected comma or line break between elements",this.currentPos()));for(;this.match(k.LineBreak)||this.match(k.Indent)||this.match(k.Unindent););this.check(k.RBracket)||t.push(this.parseExpression());let n=this.previous();i=n.type!=k.Colon&&n.type!=k.LineBreak}for(;this.match(k.LineBreak)||this.match(k.Indent)||this.match(k.Unindent););return this.expect(k.RBracket),l.pos=l.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),l}parseObjectLiteral(){let e=this.currentPos(),t=[],l=this.parseBlockStart().type==k.Indent?k.Unindent:k.RBrace,i=l==k.RBrace?1:0,n=new je(this.nextNodeId(4),l!=k.RBrace?this.nextNonWhitespaceOrComment().pos:e,t,Ke.Object(i));this.attachComments(n);let s=!1;for(;!this.check(l)&&!this.isAtEnd();){if(s){for(;this.match(k.LineBreak)||l!=k.Unindent&&this.match(k.Unindent);)s=!1;this.match(k.Comma)&&(s=!1)}for(;this.match(k.LineBreak)||l!=k.Unindent&&this.match(k.Unindent);)s=!1;if(!this.check(l)&&s)throw T.thrown(new Ne("Expected comma or line break between fields",this.currentPos()));for(;this.match(k.LineBreak)||l!=k.Unindent&&this.match(k.Unindent););this.check(l)||t.push(this.parseObjectField());let r=this.previous();s=r.type!=k.Colon&&r.type!=k.LineBreak}for(;this.match(k.LineBreak)||l!=k.Unindent&&this.match(k.Unindent););return this.expect(l),n.pos=n.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),n}parseCallArguments(){let e=[];if(!this.check(k.RParen))do{for(;this.match(k.LineBreak););for(e.push(this.parseExpression());this.match(k.LineBreak););}while(this.match(k.Comma));return this.expect(k.RParen),e}parseConditionExpression(){let e=this.match(k.LParen),t=null;try{t=this.parseExpression(),t!=null&&te.getClass(t)==kl&&this.addError(new Ne("Invalid condition expression: can't assign a variable here. Did you want to use '==' instead?",t.pos))}catch(l){let i=T.caught(l).unwrap();if(i instanceof Ne){let n=i;this.addError(n),t=new je(this.nextNodeId(4),this.currentPos(),null,Ke.Null)}else throw l}return e&&this.expect(k.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==k.LineBreak}expect(e){if(this.check(e))return this.advance();{let t=new Ne("Expected "+Lt.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 ye(e,this.currentPos());default:}throw T.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 T.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,l=null,i=0,n=this.pendingComments.length;for(;i<n;){let s=i++,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)):(l==null&&(l=[]),l.push(r))}return this.pendingComments=l,e}attachElseComments(e,t){if(this.pendingComments!=null){let l=t.pos,i=[],n=0,s=this.pendingComments;for(;n<s.length;){let r=s[n];++n,r.pos.line<l.line?(e.elseLeadingComments==null&&(e.elseLeadingComments=[]),e.elseLeadingComments.push(r)):r.pos.line==l.line?(e.elseTrailingComments==null&&(e.elseTrailingComments=[]),e.elseTrailingComments.push(r)):i.push(r)}this.pendingComments=i}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,l=e.s,i=e.attachments;if(this.previous().type==k.RBrace)return;this.advance();break;case 40:this.advance(),(this.check(k.Dot)||Lt.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}}Q["loreline.Parser"]=Gl,Gl.__name__="loreline.Parser",Object.assign(Gl.prototype,{__class__:Gl});class ue{constructor(e,t,l,i){i==null&&(i=0),this.line=e,this.column=t,this.offset=l,this.length=i}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,l,i){if(i==null&&(i=0),l==null&&(l=0),t==0)return new ue(this.line,this.column,this.offset,l);let n=this.line,s=this.column,r=this.offset;if(t>0){let a=0;for(;a<t;){let h;if(r<i+e.length){let o=c.cca(e,r-i);h=(o??-1)==10}else h=!1;h?(++n,s=1):++s,++a,++r}}else{let a=0;for(;a>t;){--r;let h;if(r>=0){let o=c.cca(e,r-i);h=(o??-1)==10}else h=!1;if(h){--n;let o=1,u=r-1;for(;u>=0;){let p=c.cca(e,u-i);if((p??-1)==10)break;++o,--u}s=o}else--s;--a}}return r<0&&(r=0,n=1,s=1),new ue(n,s,r,l)}extendedTo(e){return new ue(this.line,this.column,this.offset,e.offset+e.length-this.offset)}static fromContentAndIndex(e,t,l){l==null&&(l=0);let i=1,n=1,s=0,r=e.length;for(t>r&&(t=r),t<0&&(t=0);s<t;){let a=c.cca(e,s);(a??-1)==10?(++i,n=1):++n,++s}return new ue(i,n,t,l)}}Q["loreline.Position"]=ue,ue.__name__="loreline.Position",Object.assign(ue.prototype,{__class__:ue});class Wl{constructor(e,t){t==null&&(t=`
30
+ `)}return e}stripStringComments(e){let t="",l=e.length,i=0;for(;i<l;){let n=c.cca(e,i),s=n??-1,r;if(s==47&&i+1<l){let h=c.cca(e,i+1);r=(h??-1)==47}else r=!1;if(r){for(;;){let h;if(i<l){let o=c.cca(e,i);h=(o??-1)!=10}else h=!1;if(!h)break;++i}continue}let a;if(s==47&&i+1<l){let h=c.cca(e,i+1);a=(h??-1)==42}else a=!1;if(a){let h;if(i>0){let u=c.cca(e,i-1);h=(u??-1)==32}else h=!1;for(i+=2;;){let u;if(i+1<l){let p,_=c.cca(e,i);if((_??-1)==42){let m=c.cca(e,i+1);p=(m??-1)==47}else p=!1;u=!p}else u=!1;if(!u)break;++i}i+=2;let o;if(i<l){let u=c.cca(e,i);o=(u??-1)==32}else o=!1;h&&o&&++i,!h&&!o&&i<l&&(t+=String.fromCodePoint(32));continue}t+=String.fromCodePoint(s),++i}return t}evaluateCondition(e){let t=this.evaluateExpression(e);return typeof t=="boolean"?t==!0:typeof t=="string"?t.length>0:he.isArray(t)?he.arrayLength(t)>0:typeof t=="number"&&(t|0)===t||typeof t=="number"?t!=0:t!=null}evaluateFunctionCall(e,t){if(e.target instanceof ft){let n=e.target;if(n.target==null){let s=this.evaluateExpression(e.target);if(s!=null&&qe.isFunction(s)){let r=[],a=0,h=e.args;for(;a<h.length;){let u=h[a];++a,r.push(this.evaluateExpression(u))}let o=r;try{let u=s.apply(null,o);if(u!=null&&u instanceof oi){if(t==null)throw C.thrown(new ge("Cannot call async function in expression",e.pos));u.func(t)}else t?.();return u}catch(u){let p=C.caught(u).unwrap();if(p instanceof Se){let _=p;throw C.thrown(new ge("Error when evaluating function ("+_.pmin+"-"+_.pmax+"): "+Y.string(_.e),e.pos))}throw C.thrown(new ge("Error when calling function: "+Y.string(p),e.pos))}}}else{let s=this.evaluateExpression(n.target),r=null;if(typeof s=="string"?r=oe.getStringHelper(this,n.name):he.isArray(s)?r=oe.getArrayHelper(this,n.name):s instanceof Me?r=oe.getBeatHelper(this,n.name):oe.isFields(s)&&(r=oe.getMapHelper(this,n.name)),r!=null&&qe.isFunction(r)){let a=[],h=0,o=e.args;for(;h<o.length;){let _=o[h];++h,a.push(this.evaluateExpression(_))}let u=a;u.splice(0,0,s);let p=r.apply(null,u);if(p!=null&&p instanceof oi){if(t==null)throw C.thrown(new ge("Cannot call async function in expression",e.pos));p.func(t)}else t?.();return p}else if(r==null&&!(typeof s=="string"||he.isArray(s)||oe.isFields(s))){let a=qe.getProperty(s,n.name);if(qe.isFunction(a)){let h=[],o=0,u=e.args;for(;o<u.length;){let m=u[o];++o,h.push(this.evaluateExpression(m))}let p=h,_=a.apply(s,p);if(_!=null&&_ instanceof oi){if(t==null)throw C.thrown(new ge("Cannot call async function in expression",e.pos));_.func(t)}else t?.();return _}}}}let l=this.printLoreline(e.target),i;throw l!=null?i=l:i=te.getClass(e.target).__name__,C.thrown(new ge("Invalid call target: "+i,e.pos))}evaluateArrayLiteral(e){let t=[],l=0;for(;l<e.length;){let i=e[l];++l,t.push(this.evaluateExpression(i))}return t}evaluateObjectLiteral(e){let t=new Ee,l=0;for(;l<e.length;){let i=e[l];++l;let n=i.name,s=this.evaluateExpression(i.value);t.h[n]=s}return t}evaluateExpression(e){switch(te.getClass(e)){case ft:let t=e,l=this.resolveAccess(t,t.target,t.name);return this.readAccess(l);case gl:let i=e,n=this.evaluateExpression(i.target),s=this.evaluateExpression(i.index);if(he.isArray(n)&&(typeof s=="number"&&(s|0)===s||typeof s=="number")){let w=s|0;if(w<0||w>=he.arrayLength(n))throw C.thrown(new ge("Array index out of bounds: "+w,i.pos));return he.arrayGet(n,w)}else if(typeof s=="string"){if(n==null)throw C.thrown(new ge("Cannot access field '"+(s==null?"null":Y.string(s))+"' of null",i.pos));return oe.getField(this,n,s)}else throw C.thrown(new ge("Invalid array access",i.pos));break;case il:let r=e,a=this.evaluateExpression(r.left),h=this.evaluateExpression(r.right);return this.performOperation(r.op,a,h,r.pos);case Jt:return this.evaluateFunctionCall(e,null);case je: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 w=u.style;return this.evaluateObjectLiteral(o.value)}break;case Mt:let p=e;if(p.parts.length==1&&p.quotes==0){let w=p.parts[0].partType;if(w._hx_index==1){let y=w.expr;return this.evaluateExpression(y)}else return this.evaluateString(p).text}else return this.evaluateString(p).text;break;case ii:let _=e;return this.evaluateCondition(_.condition)?this.evaluateExpression(_.trueExpr):this.evaluateExpression(_.falseExpr);case Yl:let f=e,g=this.evaluateExpression(f.operand);switch(f.op._hx_index){case 27:if(typeof g=="number"&&(g|0)===g)return-g;if(typeof g=="number")return-g;throw C.thrown(new ge("Invalid unary operation",f.pos));break;case 39:if(typeof g=="boolean")return!g;if(typeof g=="string"){let w=g;return w!=null?w.length==0:!0}else return he.isArray(g)?he.arrayLength(g)==0:typeof g=="number"&&(g|0)===g||typeof g=="number"?g==0:g==null;break;default:throw C.thrown(new ge("Invalid unary operation",f.pos))}break;default:let d=te.getClass(e);throw C.thrown(new ge("Unsupported expression type: "+d.__name__,e.pos))}}readAccess(e){switch(e._hx_index){case 0:let t=e.pos,l=e.obj,i=e.name;if(l==null)throw C.thrown(new ge("Cannot read field '"+i+"' of null",t));return oe.getField(this,l,i);case 1:let n=e.pos,s=e.array,r=e.index;return he.arrayGet(s,r);case 2:let a=e.pos,h=e.name;if(Object.prototype.hasOwnProperty.call(this.topLevelCharacters.h,h))return this.topLevelCharacters.h[h].fields;throw C.thrown(new ge("Character not found: "+h,a));case 3:let o=e.pos,u=e.name;if(Object.prototype.hasOwnProperty.call(this.topLevelFunctions.h,u))return this.topLevelFunctions.h[u];throw C.thrown(new ge("Function not found: "+u,o));case 4:let p=e.pos;return e.beat}}writeAccess(e,t){switch(e._hx_index){case 0:let l=e.pos,i=e.obj,n=e.name;if(i==null)throw C.thrown(new ge("Cannot set field '"+n+"' of null",l));oe.setField(this,i,n,t);break;case 1:let s=e.pos,r=e.array,a=e.index;he.arraySet(r,a,t);break;case 2:let h=e.pos,o=e.name;throw C.thrown(new ge("Cannot overwrite character: "+o,h));case 3:let u=e.pos,p=e.name;throw C.thrown(new ge("Cannot overwrite function: "+p,u));case 4:let _=e.pos,m=e.beat;throw C.thrown(new ge("Cannot overwrite beat: "+m.name,_))}}resolveAssignmentTarget(e){switch(te.getClass(e)){case ft:let t=e;return this.resolveAccess(t,t.target,t.name);case gl:let l=e,i=this.evaluateExpression(l.target),n=this.evaluateExpression(l.index);if(he.isArray(i)&&(typeof n=="number"&&(n|0)===n||typeof n=="number")){let s=n|0;return fl.ArrayAccess(l.pos,i,s)}else if(typeof n=="string"){if(i==null)throw C.thrown(new ge("Cannot access field '"+(n==null?"null":Y.string(n))+"' of null",l.pos));return fl.FieldAccess(l.pos,i,n)}else throw C.thrown(new ge("Invalid array access target",l.pos));break;default:throw C.thrown(new ge("Invalid assignment target",e.pos))}}resolveAccess(e,t,l){if(t!=null){let a=this.evaluateExpression(t);if(a==null){let h=te.getClass(t)==ft?t.name:null;throw C.thrown(new ge(h!=null?"Cannot access field '"+l+"' of undefined variable '"+h+"'":"Cannot access field '"+l+"' of null value",t.pos))}return fl.FieldAccess(t.pos,a,l)}let i=this.stack.length-1;for(;i>=0;){let a=this.stack[i];if(a.state!=null&&oe.fieldExists(this,a.state.fields,l)){let h=e!=null?e.pos:null,o;if(h!=null)o=h;else{let u=this.get_currentScope(),p=u!=null?u.node:null;o=p!=null?p.pos:null}return fl.FieldAccess(o??this.script.pos,a.state.fields,l)}if(a.node!=null){let h=a.node.id.thisVal,o=this.nodeStates.map._get(h.high,h.low);if(o!=null&&oe.fieldExists(this,o.fields,l)){let u=e!=null?e.pos:null,p;if(u!=null)p=u;else{let _=this.get_currentScope(),m=_!=null?_.node:null;p=m!=null?m.pos:null}return fl.FieldAccess(p??this.script.pos,o.fields,l)}}--i}if(oe.fieldExists(this,this.topLevelState.fields,l)){let a=e!=null?e.pos:null,h;if(a!=null)h=a;else{let o=this.get_currentScope(),u=o!=null?o.node:null;h=u!=null?u.pos:null}return fl.FieldAccess(h??this.script.pos,this.topLevelState.fields,l)}if(Object.prototype.hasOwnProperty.call(this.topLevelCharacters.h,l)){let a=e!=null?e.pos:null,h;if(a!=null)h=a;else{let o=this.get_currentScope(),u=o!=null?o.node:null;h=u!=null?u.pos:null}return fl.CharacterAccess(h??this.script.pos,l)}if(Object.prototype.hasOwnProperty.call(this.topLevelFunctions.h,l)){let a=e!=null?e.pos:null,h;if(a!=null)h=a;else{let o=this.get_currentScope(),u=o!=null?o.node:null;h=u!=null?u.pos:null}return fl.FunctionAccess(h??this.script.pos,l)}let n=this.resolveBeatByName(l);if(n!=null){let a=e!=null?e.pos:null,h;if(a!=null)h=a;else{let o=this.get_currentScope(),u=o!=null?o.node:null;h=u!=null?u.pos:null}return fl.BeatAccess(h??this.script.pos,n)}if(!this.strictAccess){let a=e!=null?e.pos:null,h;if(a!=null)h=a;else{let o=this.get_currentScope(),u=o!=null?o.node:null;h=u!=null?u.pos:null}return fl.FieldAccess(h??this.script.pos,this.topLevelState.fields,l)}let s=e!=null?e.pos:null,r;if(s!=null)r=s;else{let a=this.get_currentScope(),h=a!=null?a.node:null;r=h!=null?h.pos:null}throw C.thrown(new ge("Undefined variable: "+l,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,l,i){let n=_e.typeof(t),s=_e.typeof(l);switch(e._hx_index){case 26:switch(n._hx_index){case 1:switch(s._hx_index){case 1:case 2:return parseFloat(Y.string(t))+parseFloat(Y.string(l));case 6:if(s.c==String)return Y.string(t)+Y.string(l);{let g="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(s),d=i,w;if(d!=null)w=d;else{let y=this.get_currentScope(),S=y!=null?y.node:null;w=S!=null?S.pos:null}throw C.thrown(new ge(g,w??this.script.pos))}break;default:let _="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(s),m=i,f;if(m!=null)f=m;else{let g=this.get_currentScope(),d=g!=null?g.node:null;f=d!=null?d.pos:null}throw C.thrown(new ge(_,f??this.script.pos))}break;case 2:switch(s._hx_index){case 1:case 2:return parseFloat(Y.string(t))+parseFloat(Y.string(l));case 6:if(s.c==String)return Y.string(t)+Y.string(l);{let g="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(s),d=i,w;if(d!=null)w=d;else{let y=this.get_currentScope(),S=y!=null?y.node:null;w=S!=null?S.pos:null}throw C.thrown(new ge(g,w??this.script.pos))}break;default:let _="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(s),m=i,f;if(m!=null)f=m;else{let g=this.get_currentScope(),d=g!=null?g.node:null;f=d!=null?d.pos:null}throw C.thrown(new ge(_,f??this.script.pos))}break;case 6:if(n.c==String)return Y.string(t)+Y.string(l);if(s._hx_index==6){if(s.c==String)return Y.string(t)+Y.string(l);{let _="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(s),m=i,f;if(m!=null)f=m;else{let g=this.get_currentScope(),d=g!=null?g.node:null;f=d!=null?d.pos:null}throw C.thrown(new ge(_,f??this.script.pos))}}else{let _="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(s),m=i,f;if(m!=null)f=m;else{let g=this.get_currentScope(),d=g!=null?g.node:null;f=d!=null?d.pos:null}throw C.thrown(new ge(_,f??this.script.pos))}break;default:if(s._hx_index==6){if(s.c==String)return Y.string(t)+Y.string(l);{let _="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(s),m=i,f;if(m!=null)f=m;else{let g=this.get_currentScope(),d=g!=null?g.node:null;f=d!=null?d.pos:null}throw C.thrown(new ge(_,f??this.script.pos))}}else{let _="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(s),m=i,f;if(m!=null)f=m;else{let g=this.get_currentScope(),d=g!=null?g.node:null;f=d!=null?d.pos:null}throw C.thrown(new ge(_,f??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 d=parseFloat(Y.string(t)),w=parseFloat(Y.string(l));switch(e._hx_index){case 27:return d-w;case 28:return d*w;case 29:if(w==0){let E=i,v;if(E!=null)v=E;else{let M=this.get_currentScope(),A=M!=null?M.node:null;v=A!=null?A.pos:null}throw C.thrown(new ge("Division by zero",v??this.script.pos))}return d/w;case 30:if(w==0){let E=i,v;if(E!=null)v=E;else{let M=this.get_currentScope(),A=M!=null?M.node:null;v=A!=null?A.pos:null}throw C.thrown(new ge("Modulo by zero",v??this.script.pos))}return d%w;default:throw C.thrown("Unreachable")}break;default:let y;switch(e._hx_index){case 27:y="subtract";break;case 28:y="multiply";break;case 29:y="divide";break;case 30:y="modulo";break;default:y="perform operation on"}let S="Cannot "+y+" "+this.getTypeName(n)+" and "+this.getTypeName(s),T=i,O;if(T!=null)O=T;else{let E=this.get_currentScope(),v=E!=null?E.node:null;O=v!=null?v.pos:null}throw C.thrown(new ge(S,O??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 m="Cannot "+_+" "+this.getTypeName(n)+" and "+this.getTypeName(s),f=i,g;if(f!=null)g=f;else{let d=this.get_currentScope(),w=d!=null?d.node:null;g=w!=null?w.pos:null}throw C.thrown(new ge(m,g??this.script.pos))}break;case 31:case 32:let r=t instanceof Me&&typeof l=="string"?t.name==l:typeof t=="string"&&l instanceof Me?t==l.name:t instanceof Me&&l instanceof Me?t.name==l.name:t==l;switch(e._hx_index){case 31:return r;case 32:return!r;default:throw C.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(Y.string(t)),d=parseFloat(Y.string(l));switch(e._hx_index){case 33:return g>d;case 34:return g<d;case 35:return g>=d;case 36:return g<=d;default:throw C.thrown("Unreachable")}break;default:let w="Cannot compare "+this.getTypeName(n)+" and "+this.getTypeName(s),y=i,S;if(y!=null)S=y;else{let T=this.get_currentScope(),O=T!=null?T.node:null;S=O!=null?O.pos:null}throw C.thrown(new ge(w,S??this.script.pos))}break;default:let _="Cannot compare "+this.getTypeName(n)+" and "+this.getTypeName(s),m=i,f;if(m!=null)f=m;else{let g=this.get_currentScope(),d=g!=null?g.node:null;f=d!=null?d.pos:null}throw C.thrown(new ge(_,f??this.script.pos))}break;case 37: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?l:!1;case 38:let m=e.word;return t?!0:l;default:throw C.thrown("Unreachable")}else{let _="Cannot perform logical operation on "+this.getTypeName(n)+" and "+this.getTypeName(s),m=i,f;if(m!=null)f=m;else{let g=this.get_currentScope(),d=g!=null?g.node:null;f=d!=null?d.pos:null}throw C.thrown(new ge(_,f??this.script.pos))}else{let _="Cannot perform logical operation on "+this.getTypeName(n)+" and "+this.getTypeName(s),m=i,f;if(m!=null)f=m;else{let g=this.get_currentScope(),d=g!=null?g.node:null;f=d!=null?d.pos:null}throw C.thrown(new ge(_,f??this.script.pos))}break;case 38: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?l:!1;case 38:let m=e.word;return t?!0:l;default:throw C.thrown("Unreachable")}else{let _="Cannot perform logical operation on "+this.getTypeName(n)+" and "+this.getTypeName(s),m=i,f;if(m!=null)f=m;else{let g=this.get_currentScope(),d=g!=null?g.node:null;f=d!=null?d.pos:null}throw C.thrown(new ge(_,f??this.script.pos))}else{let _="Cannot perform logical operation on "+this.getTypeName(n)+" and "+this.getTypeName(s),m=i,f;if(m!=null)f=m;else{let g=this.get_currentScope(),d=g!=null?g.node:null;f=d!=null?d.pos:null}throw C.thrown(new ge(_,f??this.script.pos))}break;default:let o="Invalid operation: "+Y.string(e),u=i,p;if(u!=null)p=u;else{let _=this.get_currentScope(),m=_!=null?_.node:null;p=m!=null?m.pos:null}throw C.thrown(new ge(o,p??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":Y.string(e);t==null&&(t=[]);let l=0;for(;l<t.length;){let i=t[l];if(++l,i==e)return"..."}if(t.push(e),he.isArray(e)){let i=he.arrayLength(e),n="";n+="[";let s=0,r=i;for(;s<r;){let a=s++;a>0&&(n+=", "),n+=Y.string(this.valueToStringImpl(he.arrayGet(e,a),t))}return n+="]",t.pop(),n}if(e instanceof Me)return t.pop(),e.name;if(oe.isFields(e)){let i=oe.getFields(this,e);i.sort(function(a,h){return a<h?-1:a>h?1:0});let n="";n+="{";let s=0,r=i.length;for(;s<r;){let a=s++;a>0&&(n+=", "),n+=Y.string(i[a]),n+=": ",n+=Y.string(this.valueToStringImpl(oe.getField(this,e,i[a]),t))}return n+="}",t.pop(),n}return t.pop(),e==null?"null":Y.string(e)}printLoreline(e){try{let t=new Wl;return t.enableComments=!1,He.trim(t.print(e))}catch{return null}}}Q["loreline.Interpreter"]=Xl.loreline.Interpreter=Pi,Pi.__name__="loreline.Interpreter",Object.assign(Pi.prototype,{__class__:Pi,__properties__:{get_currentInsertion:"get_currentInsertion",get_currentScope:"get_currentScope"}});class kn{static stringify(e,t){return t==null&&(t=!1),JSON.stringify(e,null,t?" ":null)}static parse(e){return JSON.parse(e)}}Q["loreline.Json"]=kn,kn.__name__="loreline.Json";class R{static scriptFromJson(e){if(e==null)throw C.thrown("Cannot create Script from null JSON");let t=e.type;if(t!="Script")throw C.thrown("Expected Script node, got: "+t);let l=R.idFromJson(e),i=R.positionFromJson(e.pos),n=e.body,s=[],r=0;for(;r<n.length;){let o=n[r];++r,s.push(R.nodeFromJson(o))}let a=s,h=new nl(l,i,a);return h.indentSize=e.indentSize!=null?e.indentSize:2,e.filePath!=null&&(h.filePath=e.filePath),R.applyComments(h,e),h}static nodeFromJson(e){if(e==null)return null;let t=e.type;switch(t){case"Access":return R.accessFromJson(e);case"Alternative":return R.alternativeFromJson(e);case"ArrayAccess":return R.arrayAccessFromJson(e);case"Assign":return R.assignFromJson(e);case"Beat":return R.beatFromJson(e);case"Binary":return R.binaryFromJson(e);case"Block":return R.blockFromJson(e);case"Call":return R.callFromJson(e);case"Character":return R.characterFromJson(e);case"Choice":return R.choiceStatementFromJson(e);case"Comment":return R.commentFromJson(e);case"Dialogue":return R.dialogueStatementFromJson(e);case"Field":return R.objectFieldFromJson(e);case"Function":return R.functionDeclFromJson(e);case"If":return R.ifStatementFromJson(e);case"Import":return R.importStatementFromJson(e);case"Insertion":return R.insertionFromJson(e);case"Literal":return R.literalFromJson(e);case"Option":return R.choiceOptionFromJson(e);case"Part":return R.stringPartFromJson(e);case"Script":return R.scriptFromJson(e);case"State":return R.stateFromJson(e);case"String":return R.stringLiteralFromJson(e);case"Ternary":return R.ternaryFromJson(e);case"Text":return R.textStatementFromJson(e);case"Transition":return R.transitionFromJson(e);case"Unary":return R.unaryFromJson(e);default:throw C.thrown("Unknown node type: "+t)}}static commentFromJson(e){let t=R.idFromJson(e),l=R.positionFromJson(e.pos),i=e.isHash!=null&&e.isHash;return new Ql(t,l,e.content,e.multiline,i)}static stateFromJson(e){let t=R.idFromJson(e),l=R.positionFromJson(e.pos),i=e.fields,n=[],s=0;for(;s<i.length;){let o=i[s];++s,n.push(R.nodeFromJson(o))}let r=n,a=R.extractComments(e),h=new $t(t,l,e.temporary,r,a.leading,a.trailing);return h.style=R.blockStyleFromString(e.style),h}static objectFieldFromJson(e){let t=R.idFromJson(e),l=R.positionFromJson(e.pos),i=R.extractComments(e);return new Ul(t,l,e.name,R.nodeFromJson(e.value),i.leading,i.trailing)}static characterFromJson(e){let t=R.idFromJson(e),l=R.positionFromJson(e.pos),i=R.positionFromJson(e.namePos),n=e.fields,s=[],r=0;for(;r<n.length;){let u=n[r];++r,s.push(R.nodeFromJson(u))}let a=s,h=R.extractComments(e),o=new jt(t,l,e.name,i,a,h.leading,h.trailing);return o.style=R.blockStyleFromString(e.style),o}static beatFromJson(e){let t=R.idFromJson(e),l=R.positionFromJson(e.pos),i=e.body,n=[],s=0;for(;s<i.length;){let o=i[s];++s,n.push(R.nodeFromJson(o))}let r=n,a=R.extractComments(e),h=new Me(t,l,e.name,r,a.leading,a.trailing);return h.style=R.blockStyleFromString(e.style),h}static stringPartFromJson(e){let t=R.idFromJson(e),l=R.positionFromJson(e.pos),i=e.part,n;switch(i){case"Expr":n=ze.Expr(R.nodeFromJson(e.expression));break;case"Raw":n=ze.Raw(e.text);break;case"Tag":n=ze.Tag(e.closing,R.nodeFromJson(e.content));break;default:throw C.thrown("Unknown string part type: "+i)}let s=R.extractComments(e);return new Ge(t,l,n,s.leading,s.trailing)}static stringLiteralFromJson(e){let t=R.idFromJson(e),l=R.positionFromJson(e.pos),i=R.quotesFromString(e.quotes),n=e.parts,s=[],r=0;for(;r<n.length;){let o=n[r];++r,s.push(R.nodeFromJson(o))}let a=s,h=R.extractComments(e);return new Mt(t,l,i,a,h.leading,h.trailing)}static textStatementFromJson(e){let t=R.idFromJson(e),l=R.positionFromJson(e.pos),i=R.nodeFromJson(e.content),n=R.extractComments(e),s=new ll(t,l,i,n.leading,n.trailing);return e.condition!=null&&(s.condition=R.nodeFromJson(e.condition),s.conditionStyle=R.conditionStyleFromString(e.conditionStyle),s.conditionPos=R.positionFromJson(e.conditionPos)),s}static dialogueStatementFromJson(e){let t=R.idFromJson(e),l=R.positionFromJson(e.pos),i=R.positionFromJson(e.characterPos),n=R.nodeFromJson(e.content),s=R.extractComments(e),r=new Kt(t,l,e.character,i,n,s.leading,s.trailing);return e.condition!=null&&(r.condition=R.nodeFromJson(e.condition),r.conditionStyle=R.conditionStyleFromString(e.conditionStyle),r.conditionPos=R.positionFromJson(e.conditionPos)),r}static choiceStatementFromJson(e){let t=R.idFromJson(e),l=R.positionFromJson(e.pos),i=e.options,n=[],s=0;for(;s<i.length;){let o=i[s];++s,n.push(R.nodeFromJson(o))}let r=n,a=R.extractComments(e),h=new xl(t,l,r,a.leading,a.trailing);return h.style=R.blockStyleFromString(e.style),h}static choiceOptionFromJson(e){let t=R.idFromJson(e),l=R.positionFromJson(e.pos),i=e.text!=null?R.nodeFromJson(e.text):null,n=e.insertion!=null?R.nodeFromJson(e.insertion):null,s=e.condition!=null?R.nodeFromJson(e.condition):null,r=e.conditionStyle!=null?R.conditionStyleFromString(e.conditionStyle):0,a=e.body,h=[],o=0;for(;o<a.length;){let m=a[o];++o,h.push(R.nodeFromJson(m))}let u=h,p=R.extractComments(e),_=new St(t,l,i,n,s,r,u,p.leading,p.trailing);return _.style=R.blockStyleFromString(e.style),e.once!=null&&e.once&&(_.once=!0),e.conditionPos!=null&&(_.conditionPos=R.positionFromJson(e.conditionPos)),_}static blockFromJson(e){let t=R.idFromJson(e),l=R.positionFromJson(e.pos),i=e.body,n=[],s=0;for(;s<i.length;){let o=i[s];++s,n.push(R.nodeFromJson(o))}let r=n,a=R.extractComments(e),h=new hl(t,l,r,a.leading,a.trailing);return h.style=R.blockStyleFromString(e.style),h}static ifStatementFromJson(e){let t=R.idFromJson(e),l=R.positionFromJson(e.pos),i=R.nodeFromJson(e.condition),n=R.conditionStyleFromString(e.conditionStyle),s=e.thenBranch,r=[],a=0;for(;a<s.length;){let f=s[a];++a,r.push(R.nodeFromJson(f))}let h=r,o=new hl(Ae.UNDEFINED,l,h);o.style=R.blockStyleFromString(e.thenStyle);let u=null;if(e.elseBranch!=null){let f=e.elseBranch,g=[],d=0;for(;d<f.length;){let y=f[d];++d,g.push(R.nodeFromJson(y))}let w=g;u=new hl(Ae.UNDEFINED,l,w),u.style=R.blockStyleFromString(e.elseStyle)}let p=R.extractComments(e),_=null,m=null;if(e.comments!=null){if(e.comments.elseLeading!=null){let f=e.comments.elseLeading,g=[],d=0;for(;d<f.length;){let w=f[d];++d,g.push(R.commentFromJson(w))}_=g}if(e.comments.elseTrailing!=null){let f=e.comments.elseTrailing,g=[],d=0;for(;d<f.length;){let w=f[d];++d,g.push(R.commentFromJson(w))}m=g}}return new wl(t,l,i,n,o,u,p.leading,p.trailing,_,m)}static alternativeFromJson(e){let t=R.idFromJson(e),l=R.positionFromJson(e.pos),i=R.alternativeModeFromString(e.mode),n=e.items,s=[],r=0;for(;r<n.length;){let u=n[r];++r,s.push(R.nodeFromJson(u))}let a=s,h=R.extractComments(e),o=new Hl(t,l,i,a,h.leading,h.trailing);if(o.style=R.blockStyleFromString(e.style),e.separatorComments!=null){let u=e.separatorComments,p=[],_=0;for(;_<u.length;){let m=u[_];if(++_,m!=null){let f=m,g=[],d=0;for(;d<f.length;){let w=f[d];++d,g.push(R.commentFromJson(w))}p.push(g)}else p.push(null)}o.separatorComments=p}return o}static callFromJson(e){let t=R.idFromJson(e),l=R.positionFromJson(e.pos),i=R.nodeFromJson(e.target),n=e.args,s=[],r=0;for(;r<n.length;){let o=n[r];++r,s.push(R.nodeFromJson(o))}let a=s,h=R.extractComments(e);return new Jt(t,l,i,a,h.leading,h.trailing)}static transitionFromJson(e){let t=R.idFromJson(e),l=R.positionFromJson(e.pos),i=R.positionFromJson(e.targetPos),n=R.extractComments(e);return new Dl(t,l,e.target,i,n.leading,n.trailing)}static insertionFromJson(e){let t=R.idFromJson(e),l=R.positionFromJson(e.pos),i=R.positionFromJson(e.targetPos),n=R.extractComments(e);return new $l(t,l,e.target,i,n.leading,n.trailing)}static functionDeclFromJson(e){let t=R.idFromJson(e),l=R.positionFromJson(e.pos),i=e.name,n=e.args,s=[],r=0;for(;r<n.length;){let o=n[r];++r,s.push(o)}let a=s,h=R.extractComments(e);return new ql(t,l,i,a,e.code,e.external,h.leading,h.trailing)}static literalFromJson(e){let t=R.idFromJson(e),l=R.positionFromJson(e.pos),i=e.literal,n=R.extractComments(e),s,r;switch(i){case"Array":if(s=Ke.Array,e.value!=null){let h=e.value,o=[],u=0;for(;u<h.length;){let p=h[u];++u,Object.prototype.hasOwnProperty.call(p,"type")?o.push(R.nodeFromJson(p)):o.push(p)}r=o}else r=null;break;case"Boolean":s=Ke.Boolean,r=e.value;break;case"Null":s=Ke.Null,r=null;break;case"Number":s=Ke.Number,r=e.value;break;case"Object":let a=R.blockStyleFromString(e.style);if(s=Ke.Object(a),e.value!=null){let h=e.value,o=[],u=0;for(;u<h.length;){let p=h[u];++u,o.push(R.nodeFromJson(p))}r=o}else r=[];break;default:throw C.thrown("Unknown literal type: "+i)}return new je(t,l,r,s,n.leading,n.trailing)}static accessFromJson(e){let t=R.idFromJson(e),l=R.positionFromJson(e.pos),i=e.target!=null?R.nodeFromJson(e.target):null,n=R.extractComments(e);return new ft(t,l,i,e.name,n.leading,n.trailing)}static assignFromJson(e){let t=R.idFromJson(e),l=R.positionFromJson(e.pos),i=R.nodeFromJson(e.target),n=R.tokenTypeFromString(e.op),s=R.nodeFromJson(e.value),r=R.extractComments(e);return new kl(t,l,i,n,s,r.leading,r.trailing)}static arrayAccessFromJson(e){let t=R.idFromJson(e),l=R.positionFromJson(e.pos),i=R.nodeFromJson(e.target),n=R.nodeFromJson(e.index),s=R.extractComments(e);return new gl(t,l,i,n,s.leading,s.trailing)}static binaryFromJson(e){let t=R.idFromJson(e),l=R.positionFromJson(e.pos),i=R.nodeFromJson(e.left),n=R.tokenTypeFromString(e.op),s=R.nodeFromJson(e.right),r=R.extractComments(e);return new il(t,l,i,n,s,r.leading,r.trailing)}static unaryFromJson(e){let t=R.idFromJson(e),l=R.positionFromJson(e.pos),i=R.tokenTypeFromString(e.op),n=R.nodeFromJson(e.operand),s=R.extractComments(e);return new Yl(t,l,i,n,s.leading,s.trailing)}static ternaryFromJson(e){let t=R.idFromJson(e),l=R.positionFromJson(e.pos),i=R.nodeFromJson(e.condition),n=R.nodeFromJson(e.trueExpr),s=R.nodeFromJson(e.falseExpr),r=R.extractComments(e);return new ii(t,l,i,n,s,r.leading,r.trailing)}static importStatementFromJson(e){let t=R.idFromJson(e),l=R.positionFromJson(e.pos),i=R.nodeFromJson(e.path),n=e.script!=null?R.scriptFromJson(e.script):null,s=R.extractComments(e);return new Rt(t,l,i,n,s.leading,s.trailing)}static idFromJson(e){let t=e.id;return t!=null?Ae.fromString(t):Ae.UNDEFINED}static positionFromJson(e){if(e==null)return new ue(0,0,0,0);let t=e.length!=null?e.length:0;return new ue(e.line,e.column,e.offset,t)}static extractComments(e){if(e.comments==null)return{leading:null,trailing:null};let t=null,l=null;if(e.comments.leading!=null){let i=e.comments.leading,n=[],s=0;for(;s<i.length;){let r=i[s];++s,n.push(R.commentFromJson(r))}t=n}if(e.comments.trailing!=null){let i=e.comments.trailing,n=[],s=0;for(;s<i.length;){let r=i[s];++s,n.push(R.commentFromJson(r))}l=n}return{leading:t,trailing:l}}static applyComments(e,t){let l=R.extractComments(t);e.leadingComments=l.leading,e.trailingComments=l.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 k.OpAssign;case"OpDivide":return k.OpDivide;case"OpDivideAssign":return k.OpDivideAssign;case"OpEquals":return k.OpEquals;case"OpGreater":return k.OpGreater;case"OpGreaterEq":return k.OpGreaterEq;case"OpLess":return k.OpLess;case"OpLessEq":return k.OpLessEq;case"OpMinus":return k.OpMinus;case"OpMinusAssign":return k.OpMinusAssign;case"OpModulo":return k.OpModulo;case"OpMultiply":return k.OpMultiply;case"OpMultiplyAssign":return k.OpMultiplyAssign;case"OpNot":return k.OpNot;case"OpNotEquals":return k.OpNotEquals;case"OpPlus":return k.OpPlus;case"OpPlusAssign":return k.OpPlusAssign;case"OpUnquotedAssign":return k.OpUnquotedAssign;default:if(e.startsWith("OpAnd"))return k.OpAnd(e.indexOf("true")!=-1);if(e.startsWith("OpOr"))return k.OpOr(e.indexOf("true")!=-1);throw C.thrown("Unknown operator: "+e)}}}Q["loreline.JsonToAst"]=R,R.__name__="loreline.JsonToAst";class _l{constructor(e,t){this.target=e,this.origin=t}}Q["loreline.Reference"]=_l,_l.__name__="loreline.Reference",Object.assign(_l.prototype,{__class__:_l});class Gi{constructor(e){this.error=null,this.expr=null,this.lorscript=null,this.func=e,this.codeToLorscript=new ti;try{this.lorscript=this.codeToLorscript.process(e.code)}catch(t){let l=C.caught(t).unwrap();l instanceof st&&(this.error=l,this.error.pos=e.pos.withOffset(this.codeToLorscript.input,this.error.pos.offset,this.error.pos.length,e.pos.offset)),this.lorscript=this.codeToLorscript.output.b}try{let t=new ci;t.resumeErrors=!1,t.allowJSON=!0,t.allowTypes=!0;let l=e.name;this.expr=t.parseString(this.lorscript,l??"?")}catch(t){let l=C.caught(t).unwrap();if(this.error==null)if(l instanceof Se){let i=l,n,s=i.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 Li(i,n,this.codeToLorscript.toLorelinePos(e.pos,i.pmin,i.pmax))}else l instanceof st&&(this.error=l,this.error.pos=e.pos.withOffset(this.codeToLorscript.input,this.error.pos.offset,this.error.pos.length,e.pos.offset));try{let i=new ci;i.resumeErrors=!0,i.allowJSON=!0,i.allowTypes=!0;let n=e.name;this.expr=i.parseString(this.lorscript,n??"?")}catch{}}}}Q["loreline.FuncLorscript"]=Gi,Gi.__name__="loreline.FuncLorscript",Object.assign(Gi.prototype,{__class__:Gi});class Qi{constructor(e,t){this.completion=null,this.locals=null,e!=null&&(this.locals=e),t!=null&&(this.completion=t)}}Q["loreline.LorscriptCompletion"]=Qi,Qi.__name__="loreline.LorscriptCompletion",Object.assign(Qi.prototype,{__class__:Qi});class Ii{constructor(e){this.lorscriptFunctions=new li,this.childNodes=new li,this.parentNodes=new li,this.nodesById=new li,this.script=e,this.initialize()}initialize(){let e=this;this.script.each(function(t,l){let i=t.id.thisVal;if(e.nodesById.map._set(i.high,i.low,t),l!=null){let n=t.id.thisVal;e.parentNodes.map._set(n.high,n.low,l);let s=l.id.thisVal,r=e.childNodes.map._get(s.high,s.low);if(r==null){r=[];let a=l.id.thisVal;e.childNodes.map._set(a.high,a.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(l,i){let n=l.pos;n.length>0&&n.offset<=e.offset&&n.offset+n.length>=e.offset&&(t=l)}),t}getClosestNodeAtOrBeforePosition(e){let t=null,l=999999999;return this.script.eachExcludingImported(function(i,n){let s=i.pos,r=e.offset-s.offset;r>=0&&r<l&&(l=r,t=i)}),t}getNodesOfType(e,t){t==null&&(t=!1);let l=[],i=this;return this.traverse(this.script,function(n,s){return te.__instanceof(n,e)&&l.push(n),t||n==i.script?!0:!(n instanceof Rt||n instanceof nl)}),l}getDialogueSpeakers(e){let t=[],l=Object.create(null);return this.traverse(e,function(i,n){if(i instanceof Kt){let s=i;s.character!=null&&!Object.prototype.hasOwnProperty.call(l,s.character)&&(l[s.character]=!0,t.push(s.character))}return!0}),t}getParentNode(e){let t=e.id.thisVal;return this.parentNodes.map._get(t.high,t.low)}getFirstParentOfType(e,t){let l=e;for(;l!=null;)if(l=this.getParentNode(l),l!=null&&te.getClass(l)==t)return l;return null}getNodeFilePath(e,t){let l=[],i=e;for(;i!=null;){let o=this.getFirstParentOfType(i,Rt);if(o!=null)l.push(o),i=o;else break}if(l.length==0)return t;let n=De.directory(t),s;if(t==null)s=!1;else{let o=t.length;if(o<8)s=!1;else{let u,p,_,m,f,g,d=c.cca(t,o-8);if((d??-1)==46){let w=c.cca(t,o-7),y=w??-1;g=y==108||y==76}else g=!1;if(g){let w=c.cca(t,o-6),y=w??-1;f=y==111||y==79}else f=!1;if(f){let w=c.cca(t,o-5),y=w??-1;m=y==114||y==82}else m=!1;if(m){let w=c.cca(t,o-4);_=(w??-1)==46}else _=!1;if(_){let w=c.cca(t,o-3),y=w??-1;p=y==116||y==84}else p=!1;if(p){let w=c.cca(t,o-2),y=w??-1;u=y==120||y==88}else u=!1;if(u){let w=c.cca(t,o-1),y=w??-1;s=y==116||y==84}else s=!1}}let r=s?".lor.txt":".lor",a=t,h=l.length-1;for(;h>=0;){let o=l[h],u,p=o.path.parts[0].partType;p._hx_index==0?u=p.text:u="",De.isAbsolute(u)||(u=De.join([n,u])),u=De.normalize(u);let _,m;if(u==null)m=!1;else{let f=u.length;if(f<8)m=!1;else{let g,d,w,y,S,T,O=c.cca(u,f-8);if((O??-1)==46){let E=c.cca(u,f-7),v=E??-1;T=v==108||v==76}else T=!1;if(T){let E=c.cca(u,f-6),v=E??-1;S=v==111||v==79}else S=!1;if(S){let E=c.cca(u,f-5),v=E??-1;y=v==114||v==82}else y=!1;if(y){let E=c.cca(u,f-4);w=(E??-1)==46}else w=!1;if(w){let E=c.cca(u,f-3),v=E??-1;d=v==116||v==84}else d=!1;if(d){let E=c.cca(u,f-2),v=E??-1;g=v==120||v==88}else g=!1;if(g){let E=c.cca(u,f-1),v=E??-1;m=v==116||v==84}else m=!1}}if(m)_=!0;else if(u==null)_=!1;else{let f=u.length;if(f<4)_=!1;else{let g,d,w=c.cca(u,f-4);if((w??-1)==46){let y=c.cca(u,f-3),S=y??-1;d=S==108||S==76}else d=!1;if(d){let y=c.cca(u,f-2),S=y??-1;g=S==111||S==79}else g=!1;if(g){let y=c.cca(u,f-1),S=y??-1;_=S==114||S==82}else _=!1}}_||(u+=r),a=u,n=De.directory(a),--h}return a}getNodeAncestorFilePaths(e){let t=[],l=e;for(;l!=null;){let r=this.getFirstParentOfType(l,Rt);if(r!=null)t.push(r),l=r;else break}let i=[],n=null,s=t.length-1;for(;s>=0;){let r=t[s],a,h=r.path.parts[0].partType;h._hx_index==0?a=h.text:a="",n==null?n=a:n=De.join([De.directory(n),a]);let o=De.normalize(n),u;if(o==null)u=null;else{let p;if(o==null)p=!1;else{let _=o.length;if(_<8)p=!1;else{let m,f,g,d,w,y,S=c.cca(o,_-8);if((S??-1)==46){let T=c.cca(o,_-7),O=T??-1;y=O==108||O==76}else y=!1;if(y){let T=c.cca(o,_-6),O=T??-1;w=O==111||O==79}else w=!1;if(w){let T=c.cca(o,_-5),O=T??-1;d=O==114||O==82}else d=!1;if(d){let T=c.cca(o,_-4);g=(T??-1)==46}else g=!1;if(g){let T=c.cca(o,_-3),O=T??-1;f=O==116||O==84}else f=!1;if(f){let T=c.cca(o,_-2),O=T??-1;m=O==120||O==88}else m=!1;if(m){let T=c.cca(o,_-1),O=T??-1;p=O==116||O==84}else p=!1}}if(p){let _=o.length-8;u=_!=null?c.substr(o,0,_):c.substr(o,0,null)}else{let _;if(o==null)_=!1;else{let m=o.length;if(m<4)_=!1;else{let f,g,d=c.cca(o,m-4);if((d??-1)==46){let w=c.cca(o,m-3),y=w??-1;g=y==108||y==76}else g=!1;if(g){let w=c.cca(o,m-2),y=w??-1;f=y==111||y==79}else f=!1;if(f){let w=c.cca(o,m-1),y=w??-1;_=y==114||y==82}else _=!1}}if(_){let m=o.length-4;u=m!=null?c.substr(o,0,m):c.substr(o,0,null)}else u=o}}i.push(u),--s}return i.reverse(),i.push("."),i}getNodeRelativeFilePath(e){let t=null,l=e;for(;l!=null;){let r=this.getFirstParentOfType(l,Rt);if(r!=null)t==null&&(t=[]),t.push(r),l=r;else break}if(t==null||t.length==0)return".";let i=null,n=t.length-1;for(;n>=0;){let r=t[n],a,h=r.path.parts[0].partType;h._hx_index==0?a=h.text:a="",i==null?i=a:i=De.join([De.directory(i),a]),--n}let s=De.normalize(i);if(s==null)return null;{let r;if(s==null)r=!1;else{let a=s.length;if(a<8)r=!1;else{let h,o,u,p,_,m,f=c.cca(s,a-8);if((f??-1)==46){let g=c.cca(s,a-7),d=g??-1;m=d==108||d==76}else m=!1;if(m){let g=c.cca(s,a-6),d=g??-1;_=d==111||d==79}else _=!1;if(_){let g=c.cca(s,a-5),d=g??-1;p=d==114||d==82}else p=!1;if(p){let g=c.cca(s,a-4);u=(g??-1)==46}else u=!1;if(u){let g=c.cca(s,a-3),d=g??-1;o=d==116||d==84}else o=!1;if(o){let g=c.cca(s,a-2),d=g??-1;h=d==120||d==88}else h=!1;if(h){let g=c.cca(s,a-1),d=g??-1;r=d==116||d==84}else r=!1}}if(r){let a=s.length-8;return a!=null?c.substr(s,0,a):c.substr(s,0,null)}else{let a;if(s==null)a=!1;else{let h=s.length;if(h<4)a=!1;else{let o,u,p=c.cca(s,h-4);if((p??-1)==46){let _=c.cca(s,h-3),m=_??-1;u=m==108||m==76}else u=!1;if(u){let _=c.cca(s,h-2),m=_??-1;o=m==111||m==79}else o=!1;if(o){let _=c.cca(s,h-1),m=_??-1;a=m==114||m==82}else a=!1}}if(a){let h=s.length-4;return h!=null?c.substr(s,0,h):c.substr(s,0,null)}else return s}}}getImportedPaths(e){let t=[];return this._getImportedPaths(e,this.script,t,new Ee),t}_getImportedPaths(e,t,l,i){let n=De.directory(e);t==null&&(t=this.script);let s;if(e==null)s=!1;else{let o=e.length;if(o<8)s=!1;else{let u,p,_,m,f,g,d=c.cca(e,o-8);if((d??-1)==46){let w=c.cca(e,o-7),y=w??-1;g=y==108||y==76}else g=!1;if(g){let w=c.cca(e,o-6),y=w??-1;f=y==111||y==79}else f=!1;if(f){let w=c.cca(e,o-5),y=w??-1;m=y==114||y==82}else m=!1;if(m){let w=c.cca(e,o-4);_=(w??-1)==46}else _=!1;if(_){let w=c.cca(e,o-3),y=w??-1;p=y==116||y==84}else p=!1;if(p){let w=c.cca(e,o-2),y=w??-1;u=y==120||y==88}else u=!1;if(u){let w=c.cca(e,o-1),y=w??-1;s=y==116||y==84}else s=!1}}let r=s?".lor.txt":".lor",a=0,h=t.body;for(;a<h.length;){let o=h[a];if(++a,o instanceof Rt){let u=o,p,_=u.path.parts[0].partType;_._hx_index==0?p=_.text:p="",De.isAbsolute(p)||(p=De.join([n,p])),p=De.normalize(p);let m,f;if(p==null)f=!1;else{let g=p.length;if(g<8)f=!1;else{let d,w,y,S,T,O,E=c.cca(p,g-8);if((E??-1)==46){let v=c.cca(p,g-7),M=v??-1;O=M==108||M==76}else O=!1;if(O){let v=c.cca(p,g-6),M=v??-1;T=M==111||M==79}else T=!1;if(T){let v=c.cca(p,g-5),M=v??-1;S=M==114||M==82}else S=!1;if(S){let v=c.cca(p,g-4);y=(v??-1)==46}else y=!1;if(y){let v=c.cca(p,g-3),M=v??-1;w=M==116||M==84}else w=!1;if(w){let v=c.cca(p,g-2),M=v??-1;d=M==120||M==88}else d=!1;if(d){let v=c.cca(p,g-1),M=v??-1;f=M==116||M==84}else f=!1}}if(f)m=!0;else if(p==null)m=!1;else{let g=p.length;if(g<4)m=!1;else{let d,w,y=c.cca(p,g-4);if((y??-1)==46){let S=c.cca(p,g-3),T=S??-1;w=T==108||T==76}else w=!1;if(w){let S=c.cca(p,g-2),T=S??-1;d=T==111||T==79}else d=!1;if(d){let S=c.cca(p,g-1),T=S??-1;m=T==114||T==82}else m=!1}}m||(p+=r),Object.prototype.hasOwnProperty.call(i.h,p)||(i.h[p]=!0,l.push(p),u.script!=null&&this._getImportedPaths(p,u.script,l,i))}}return l}resolveArrayAccess(e){let t=null;if(e.target instanceof ft?t=this.resolveAccess(e.target):e.target instanceof gl&&(t=this.resolveArrayAccess(e.target)),t==null)return null;switch(te.getClass(t)){case je:let l=t;if(l.literalType==Ke.Array){let n=l.value;if(e.index instanceof je){let s=e.index;if(s.literalType==Ke.Number){let r=s.value|0;if(r>=0&&r<n.length){let a=n[r];if(a instanceof At)return a}}}}break;case Ul:let i=t;if(i.value instanceof je){let n=i.value;if(n.literalType==Ke.Array){let s=n.value;if(e.index instanceof je){let r=e.index;if(r.literalType==Ke.Number){let a=r.value|0;if(a>=0&&a<s.length){let h=s[a];if(h instanceof At)return h}}}}}break;default:}return null}resolveAccess(e){if(e.target!=null){let a=e.target instanceof ft?this.resolveAccess(e.target):e.target instanceof gl?this.resolveArrayAccess(e.target):null;if(a!=null)switch(a instanceof Ul&&(a=a.value),te.getClass(a)){case jt:let h=a,o=0,u=h.fields;for(;o<u.length;){let m=u[o];if(++o,m.name==e.name)return m}break;case je:let p=a,_=p.literalType;if(_._hx_index==4){let m=_.style,f=p.value,g=0;for(;g<f.length;){let d=f[g];if(++g,d.name==e.name)return d}}break;default:}return null}let t=e.name;if(t==null)return null;let l=this.getFirstParentOfType(e,Me);for(;l!=null;){let a=null;if(this.traverse(l,function(h,o){if(a!=null)return!1;if(h instanceof $t){let u=h,p=0,_=u.fields;for(;p<_.length;){let m=_[p];if(++p,m.name==t)return a=m,!1}}return!0}),a!=null)return a;l=this.getFirstParentOfType(l,Me)}let i=null;if(this.traverse(this.script,function(a,h){if(i!=null)return!1;if(a instanceof $t){let o=a,u=0,p=o.fields;for(;u<p.length;){let _=p[u];if(++u,_.name==t)return i=_,!1}}return a instanceof Rt?!0:a instanceof nl}),i!=null)return i;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 l=e.split("."),i=this.findBeatByNameFromNode(l[0],t),n=1;for(;i!=null&&n<l.length;){let s=l[n],r=null;this.traverse(i,function(a,h){if(a instanceof Me){let o=a;return o.name==s&&(r=o),!1}else return r==null}),i=r,++n}return i}isTopLevelNode(e){if(e instanceof Be){let t=e;return this.script.body.indexOf(t)!=-1}return!1}findTopLevelBeatFromNode(e){if(this.isTopLevelNode(e))return e instanceof 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 l=null,i=this.getFirstParentOfType(t,Me);for(;i!=null;)this.traverse(i,function(n,s){if(l!=null||n==t)return!1;if(n instanceof Me){let r=n;return r.name==e&&(l=r),!1}return!0}),i=this.getFirstParentOfType(i,Me);return l==null&&this.traverse(this.script,function(n,s){if(l==null&&n instanceof Me){let r=n;r.name==e&&(l=r)}return n instanceof Rt?!0:n instanceof nl}),l}findCharacterFromDialogue(e){return this.findCharacterByNameFromNode(e.character,e)}findCharacterByNameFromNode(e,t){let l=null;return this.traverse(this.script,function(i,n){if(l==null&&i instanceof jt){let s=i;s.name==e&&(l=s)}return i instanceof Rt?!0:i instanceof nl}),l}findFunctionByNameFromNode(e,t){let l=null;return this.traverse(this.script,function(i,n){if(l==null&&i instanceof ql){let s=i;s.name==e&&(l=s)}return i instanceof Rt?!0:i instanceof nl}),l}getVisibleCharacters(){let e=[],t=this.script.iterator();for(;t.hasNext();){let l=t.next();l instanceof jt&&e.push(l)}return e}getVisibleFunctions(){let e=[],t=this.script.iterator();for(;t.hasNext();){let l=t.next();l instanceof ql&&e.push(l)}return e}getVisibleStateFields(e){let t=[],l=new El,i=e;for(;i!=null;){if(te.getClass(i)==$t){let s=i,r=0,a=s.fields;for(;r<a.length;){let h=a[r];++r;let o=h.id.thisVal;if(!l._exists(o.high,o.low)){let u=h.id.thisVal;l._set(u.high,u.low,!0),t.push(h)}}}let n=i.id.thisVal;i=this.parentNodes.map._get(n.high,n.low)}return this.script.each(function(n,s){if(te.getClass(n)==$t){let r=n;if(s instanceof nl){let a=0,h=r.fields;for(;a<h.length;){let o=h[a];++a;let u=o.id.thisVal;if(!l._exists(u.high,u.low)){let p=o.id.thisVal;l._set(p.high,p.low,!0),t.push(o)}}}}}),t}getVisibleBeats(e){let t=[],l=Object.create(null),i=this.getParentNode(e);for(;i!=null;){if(te.getClass(i)==Me&&this.getParentNode(i)!=null){let s=0,r=this.getNodesOfType(Me);for(;s<r.length;){let a=r[s];++s,Object.prototype.hasOwnProperty.call(l,a.name)||(l[a.name]=!0,t.push(a))}}i=this.getParentNode(i)}return this.script.each(function(n,s){if(te.getClass(n)==Me&&s instanceof nl){let r=n;Object.prototype.hasOwnProperty.call(l,r.name)||(l[r.name]=!0,t.push(r))}}),t}getAllTags(){let e=Object.create(null);this.script.each(function(a,h){let o=a instanceof Be?a:null;if(o!=null&&o.trailingComments!=null){let u=0,p=o.trailingComments;for(;u<p.length;){let _=p[u];if(++u,_.isHash){let m=He.trim(_.content);e[m]=!0}}}});let t=[],l=e,i=l,n=Object.keys(l),s=n.length,r=0;for(;r<s;){let a=n[r++];t.push(a)}return t}countTags(){let e=new Ee;return this.script.each(function(t,l){let i=t instanceof Be?t:null;if(i!=null&&i.trailingComments!=null){let n=0,s=i.trailingComments;for(;n<s.length;){let r=s[n];if(++n,r.isHash){let a=He.trim(r.content),h=e.h[a],o=h??0;e.h[a]=o+1}}}}),e}findStateField(e){if(e.target!=null)return null;let t=this.getVisibleStateFields(e),l=0;for(;l<t.length;){let i=t[l];if(++l,i.name==e.name)return i}return null}findOutboundBeats(e){let t=new El,l=this;this.traverse(e,function(r,a){switch(te.getClass(r)){case Jt:let h=r;if(h.target instanceof ft){let m=h.target;if(m.target==null){let f=l.findBeatFromAccess(m);if(f!=null){let g=f.id,d=new _l(f,h),w=g.thisVal;t._set(w.high,w.low,d)}}}break;case $l:let o=r,u=l.findBeatByNameFromNode(o.target,o);if(u!=null){let m=u.id,f=new _l(u,o),g=m.thisVal;t._set(g.high,g.low,f)}break;case Dl:let p=r,_=l.findBeatByNameFromNode(p.target,p);if(_!=null){let m=_.id,f=new _l(_,p),g=m.thisVal;t._set(g.high,g.low,f)}break;default:}return!0});let i=[],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 a=r;i.push(a)}return i}findReferencesToBeat(e){let t=[],l=this;return this.script.each(function(i,n){switch(te.getClass(i)){case Jt:let s=i;if(s.target instanceof ft){let h=s.target;if(h.target==null&&h.name==e.name){let o=l.findBeatFromAccess(h);o!=null&&o.id==e.id&&t.push(new _l(e,s))}}break;case $l:let r=i;r.target==e.name&&t.push(new _l(e,r));break;case Dl:let a=i;a.target==e.name&&t.push(new _l(e,a));break;default:}}),t}findModifiedStateFields(e){let t=Object.create(null),l=this;this.traverse(e,function(u,p){if(te.getClass(u)==kl){let _=u;if(_.target instanceof ft){let m=_.target,f=l.findStateField(m);if(f!=null){let g=f.name,d=new _l(f,_);t[g]=d}}}return!0});let i=[],n=t,s=n,r=Object.keys(n),a=r.length,h=0;for(;h<a;){let u=s[r[h++]];i.push(u)}let o=i;return o.sort(function(u,p){let _=u.target.name.toLowerCase(),m=p.target.name.toLowerCase();return _<m?-1:_>m?1:0}),o}findReadStateFields(e){let t=Object.create(null),l=this;this.traverse(e,function(u,p){if(te.getClass(u)==ft){let _=u;if(p instanceof kl&&p.target==u)return!0;let m=l.findStateField(_);if(m!=null){let f=m.name,g=new _l(m,_);t[f]=g}}return!0});let i=[],n=t,s=n,r=Object.keys(n),a=r.length,h=0;for(;h<a;){let u=s[r[h++]];i.push(u)}let o=i;return o.sort(function(u,p){let _=u.target.name.toLowerCase(),m=p.target.name.toLowerCase();return _<m?-1:_>m?1:0}),o}findBeatCharacters(e){let t=new El,l=this;this.traverse(e,function(a,h){switch(te.getClass(a)){case ft:let o=a;if(o.target==null){let _=l.findCharacterByNameFromNode(o.name,o);if(_!=null){let m=_.id,f=new _l(_,o),g=m.thisVal;t._set(g.high,g.low,f)}}break;case Kt:let u=a,p=l.findCharacterFromDialogue(u);if(p!=null){let _=p.id,m=new _l(p,u),f=_.thisVal;t._set(f.high,f.low,m)}break;default:}return!0});let i=[],n=t,s=0;for(;s<n._values.length&&n._values[s]==null;)++s;for(;s<n._values.length;){let a=n._values[s];for(++s;s<n._values.length&&n._values[s]==null;)++s;let h=a;i.push(h)}let r=i;return r.sort(function(a,h){let o=a.target.name.toLowerCase(),u=h.target.name.toLowerCase();return o<u?-1:o>u?1:0}),r}findModifiedCharacterFields(e){let t=new El,l=[],i=this;return this.traverse(e,function(n,s){if(te.getClass(n)==kl){let r=n;if(r.target instanceof ft){let a=r.target,h=i.resolveAccess(a);if(h instanceof Ul){let o=h.id.thisVal;if(!t._exists(o.high,o.low)&&i.getParentNode(h)instanceof jt){let p=h.id.thisVal;t._set(p.high,p.low,!0),l.push(new _l(h,n))}}}}return!0}),l}findReadCharacterFields(e){let t=new El,l=[],i=this;return this.traverse(e,function(n,s){if(te.getClass(n)==ft){let r=n,a=i.getParentNode(r);if(a instanceof kl&&a.target==r)return!0;let h=i.resolveAccess(r);if(h instanceof Ul){let o=h.id.thisVal;if(!t._exists(o.high,o.low)&&i.getParentNode(h)instanceof jt){let p=h.id.thisVal;t._set(p.high,p.low,!0),l.push(new _l(h,n))}}}return!0}),l}traverse(e,t){let l=e.id.thisVal,i=this.childNodes.map._get(l.high,l.low);if(i!=null){let n=0,s=i.length;for(;n<s;){let r=n++,a=i[r];t(a,e)&&this.traverse(a,t)}}}getFuncLorscript(e){let t=e.id,l=t.thisVal,i=this.lorscriptFunctions.map._get(l.high,l.low);if(i==null){i=new Gi(e);let n=t.thisVal;this.lorscriptFunctions.map._set(n.high,n.low,i)}return i}getLorscriptExpr(e,t){let l=this.getFuncLorscript(e);if(l.expr==null)return null;let i=t.offset-e.pos.offset,n=null,s=null;return s=function(r){if(r!=null){let a=l.codeToLorscript.inputPosFromProcessedPos(r.pmin),h=l.codeToLorscript.inputPosFromProcessedPos(r.pmax);i>=a&&i<=h&&(n=r),un.iter(r,s)}},un.iter(l.expr,s),n}resolveLorscriptAccess(e,t){let l=t.e;switch(l._hx_index){case 1:let i=l.v,n=null;if(this.traverse(this.script,function(_,m){if(n!=null)return!1;if(_ instanceof $t){let f=_,g=0,d=f.fields;for(;g<d.length;){let w=d[g];if(++g,w.name==i)return n=w,!1}}return _ instanceof Rt?!0:_ instanceof nl}),n!=null)return n;let s=this.findCharacterByNameFromNode(i,e);if(s!=null)return s;let r=this.findBeatByNameFromNode(i,e);if(r!=null)return r;break;case 5:let a=l.e,h=l.f,o=a!=null?this.resolveLorscriptAccess(e,a):null;if(o!=null)switch(o instanceof Ul&&(o=o.value),te.getClass(o)){case jt:let _=o,m=0,f=_.fields;for(;m<f.length;){let w=f[m];if(++m,w.name==h)return w}break;case je:let g=o,d=g.literalType;if(d._hx_index==4){let w=d.style,y=g.value,S=0;for(;S<y.length;){let T=y[S];if(++S,T.name==h)return T}}break;default:}break;case 16:let u=l.e,p=l.index;break;default:}return null}isLorscriptExpr(e){return e!=null&&Object.prototype.hasOwnProperty.call(e,"e")?te.__instanceof(qe.field(e,"e"),K):!1}getLorscriptCompletion(e,t){let l=this.getFuncLorscript(e),i=t.offset-e.pos.offset+t.length,n=l.codeToLorscript.processedPosFromInputPos(i),s=l.lorscript,r=Math.min(n,l.lorscript.length)|0,a=r!=null?s.substring(0,r):s.substring(0),h=a.length,o=a.indexOf("{",null)+1;a=h!=null?a.substring(o,h):a.substring(o);let u=a.length,p="",_=0,m=h-u;for(;_<m;){let w=_++;p+=String.fromCodePoint(32)}a=p+a;let f=null,g=new tt;try{g.types.parser.allowJSON=!0,g.types.parser.allowTypes=!0,g.types.parser.resumeErrors=!0;let w=g.types.parser.parseString(a);g.check(w,null,!0)}catch(w){let y=C.caught(w).unwrap();y instanceof Bi&&(f=y)}let d=g.locals;return new Qi(d,f)}resolveAccessInFunction(e,t){if(this.getFuncLorscript(e).expr==null)return null;let i=this.getLorscriptExpr(e,t);return i!=null?this.resolveLorscriptAccess(e,i):null}}Q["loreline.Lens"]=Ii,Ii.__name__="loreline.Lens",Object.assign(Ii.prototype,{__class__:Ii});class ui extends st{constructor(e,t){super(e,t)}}Q["loreline.LexerError"]=ui,ui.__name__="loreline.LexerError",ui.__super__=st,Object.assign(ui.prototype,{__class__:ui});var Ll=Ye["loreline.LStringAttachment"]={__ename__:"loreline.LStringAttachment",__constructs__:null,Interpolation:(x=function(b,e,t,l,i){return{_hx_index:0,braces:b,inTag:e,expr:t,start:l,length:i,__enum__:"loreline.LStringAttachment",toString:F}},x._hx_name="Interpolation",x.__params__=["braces","inTag","expr","start","length"],x),Tag:(x=function(b,e,t){return{_hx_index:1,closing:b,start:e,length:t,__enum__:"loreline.LStringAttachment",toString:F}},x._hx_name="Tag",x.__params__=["closing","start","length"],x)};Ll.__constructs__=[Ll.Interpolation,Ll.Tag];class Bl{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 k=Ye["loreline.TokenType"]={__ename__:"loreline.TokenType",__constructs__:null,KwImport:{_hx_name:"KwImport",_hx_index:0,__enum__:"loreline.TokenType",toString:F},KwState:{_hx_name:"KwState",_hx_index:1,__enum__:"loreline.TokenType",toString:F},KwBeat:{_hx_name:"KwBeat",_hx_index:2,__enum__:"loreline.TokenType",toString:F},KwCharacter:{_hx_name:"KwCharacter",_hx_index:3,__enum__:"loreline.TokenType",toString:F},KwChoice:{_hx_name:"KwChoice",_hx_index:4,__enum__:"loreline.TokenType",toString:F},KwIf:{_hx_name:"KwIf",_hx_index:5,__enum__:"loreline.TokenType",toString:F},KwElse:{_hx_name:"KwElse",_hx_index:6,__enum__:"loreline.TokenType",toString:F},KwNew:{_hx_name:"KwNew",_hx_index:7,__enum__:"loreline.TokenType",toString:F},KwSequence:{_hx_name:"KwSequence",_hx_index:8,__enum__:"loreline.TokenType",toString:F},KwCycle:{_hx_name:"KwCycle",_hx_index:9,__enum__:"loreline.TokenType",toString:F},KwOnce:{_hx_name:"KwOnce",_hx_index:10,__enum__:"loreline.TokenType",toString:F},KwPick:{_hx_name:"KwPick",_hx_index:11,__enum__:"loreline.TokenType",toString:F},KwShuffle:{_hx_name:"KwShuffle",_hx_index:12,__enum__:"loreline.TokenType",toString:F},Separator:{_hx_name:"Separator",_hx_index:13,__enum__:"loreline.TokenType",toString:F},Function:(x=function(b,e,t,l){return{_hx_index:14,name:b,args:e,code:t,external:l,__enum__:"loreline.TokenType",toString:F}},x._hx_name="Function",x.__params__=["name","args","code","external"],x),LString:(x=function(b,e,t){return{_hx_index:15,quotes:b,s:e,attachments:t,__enum__:"loreline.TokenType",toString:F}},x._hx_name="LString",x.__params__=["quotes","s","attachments"],x),LNumber:(x=function(b){return{_hx_index:16,n:b,__enum__:"loreline.TokenType",toString:F}},x._hx_name="LNumber",x.__params__=["n"],x),LBoolean:(x=function(b){return{_hx_index:17,b,__enum__:"loreline.TokenType",toString:F}},x._hx_name="LBoolean",x.__params__=["b"],x),LNull:{_hx_name:"LNull",_hx_index:18,__enum__:"loreline.TokenType",toString:F},Identifier:(x=function(b){return{_hx_index:19,name:b,__enum__:"loreline.TokenType",toString:F}},x._hx_name="Identifier",x.__params__=["name"],x),OpAssign:{_hx_name:"OpAssign",_hx_index:20,__enum__:"loreline.TokenType",toString:F},OpPlusAssign:{_hx_name:"OpPlusAssign",_hx_index:21,__enum__:"loreline.TokenType",toString:F},OpMinusAssign:{_hx_name:"OpMinusAssign",_hx_index:22,__enum__:"loreline.TokenType",toString:F},OpMultiplyAssign:{_hx_name:"OpMultiplyAssign",_hx_index:23,__enum__:"loreline.TokenType",toString:F},OpDivideAssign:{_hx_name:"OpDivideAssign",_hx_index:24,__enum__:"loreline.TokenType",toString:F},OpUnquotedAssign:{_hx_name:"OpUnquotedAssign",_hx_index:25,__enum__:"loreline.TokenType",toString:F},OpPlus:{_hx_name:"OpPlus",_hx_index:26,__enum__:"loreline.TokenType",toString:F},OpMinus:{_hx_name:"OpMinus",_hx_index:27,__enum__:"loreline.TokenType",toString:F},OpMultiply:{_hx_name:"OpMultiply",_hx_index:28,__enum__:"loreline.TokenType",toString:F},OpDivide:{_hx_name:"OpDivide",_hx_index:29,__enum__:"loreline.TokenType",toString:F},OpModulo:{_hx_name:"OpModulo",_hx_index:30,__enum__:"loreline.TokenType",toString:F},OpEquals:{_hx_name:"OpEquals",_hx_index:31,__enum__:"loreline.TokenType",toString:F},OpNotEquals:{_hx_name:"OpNotEquals",_hx_index:32,__enum__:"loreline.TokenType",toString:F},OpGreater:{_hx_name:"OpGreater",_hx_index:33,__enum__:"loreline.TokenType",toString:F},OpLess:{_hx_name:"OpLess",_hx_index:34,__enum__:"loreline.TokenType",toString:F},OpGreaterEq:{_hx_name:"OpGreaterEq",_hx_index:35,__enum__:"loreline.TokenType",toString:F},OpLessEq:{_hx_name:"OpLessEq",_hx_index:36,__enum__:"loreline.TokenType",toString:F},OpAnd:(x=function(b){return{_hx_index:37,word:b,__enum__:"loreline.TokenType",toString:F}},x._hx_name="OpAnd",x.__params__=["word"],x),OpOr:(x=function(b){return{_hx_index:38,word:b,__enum__:"loreline.TokenType",toString:F}},x._hx_name="OpOr",x.__params__=["word"],x),OpNot:{_hx_name:"OpNot",_hx_index:39,__enum__:"loreline.TokenType",toString:F},Arrow:{_hx_name:"Arrow",_hx_index:40,__enum__:"loreline.TokenType",toString:F},Colon:{_hx_name:"Colon",_hx_index:41,__enum__:"loreline.TokenType",toString:F},Question:{_hx_name:"Question",_hx_index:42,__enum__:"loreline.TokenType",toString:F},Comma:{_hx_name:"Comma",_hx_index:43,__enum__:"loreline.TokenType",toString:F},Dot:{_hx_name:"Dot",_hx_index:44,__enum__:"loreline.TokenType",toString:F},LBrace:{_hx_name:"LBrace",_hx_index:45,__enum__:"loreline.TokenType",toString:F},RBrace:{_hx_name:"RBrace",_hx_index:46,__enum__:"loreline.TokenType",toString:F},LParen:{_hx_name:"LParen",_hx_index:47,__enum__:"loreline.TokenType",toString:F},RParen:{_hx_name:"RParen",_hx_index:48,__enum__:"loreline.TokenType",toString:F},LBracket:{_hx_name:"LBracket",_hx_index:49,__enum__:"loreline.TokenType",toString:F},RBracket:{_hx_name:"RBracket",_hx_index:50,__enum__:"loreline.TokenType",toString:F},CommentLine:(x=function(b){return{_hx_index:51,content:b,__enum__:"loreline.TokenType",toString:F}},x._hx_name="CommentLine",x.__params__=["content"],x),CommentMultiLine:(x=function(b){return{_hx_index:52,content:b,__enum__:"loreline.TokenType",toString:F}},x._hx_name="CommentMultiLine",x.__params__=["content"],x),CommentHash:(x=function(b){return{_hx_index:53,content:b,__enum__:"loreline.TokenType",toString:F}},x._hx_name="CommentHash",x.__params__=["content"],x),Indent:{_hx_name:"Indent",_hx_index:54,__enum__:"loreline.TokenType",toString:F},Unindent:{_hx_name:"Unindent",_hx_index:55,__enum__:"loreline.TokenType",toString:F},LineBreak:{_hx_name:"LineBreak",_hx_index:56,__enum__:"loreline.TokenType",toString:F},Eof:{_hx_name:"Eof",_hx_index:57,__enum__:"loreline.TokenType",toString:F}};k.__constructs__=[k.KwImport,k.KwState,k.KwBeat,k.KwCharacter,k.KwChoice,k.KwIf,k.KwElse,k.KwNew,k.KwSequence,k.KwCycle,k.KwOnce,k.KwPick,k.KwShuffle,k.Separator,k.Function,k.LString,k.LNumber,k.LBoolean,k.LNull,k.Identifier,k.OpAssign,k.OpPlusAssign,k.OpMinusAssign,k.OpMultiplyAssign,k.OpDivideAssign,k.OpUnquotedAssign,k.OpPlus,k.OpMinus,k.OpMultiply,k.OpDivide,k.OpModulo,k.OpEquals,k.OpNotEquals,k.OpGreater,k.OpLess,k.OpGreaterEq,k.OpLessEq,k.OpAnd,k.OpOr,k.OpNot,k.Arrow,k.Colon,k.Question,k.Comma,k.Dot,k.LBrace,k.RBrace,k.LParen,k.RParen,k.LBracket,k.RBracket,k.CommentLine,k.CommentMultiLine,k.CommentHash,k.Indent,k.Unindent,k.LineBreak,k.Eof];class Nt{static equals(e,t){switch(e._hx_index){case 1:return t._hx_index==1?!0:_e.enumEq(e,t);case 2:return t._hx_index==2?!0:_e.enumEq(e,t);case 3:return t._hx_index==3?!0:_e.enumEq(e,t);case 4:return t._hx_index==4?!0:_e.enumEq(e,t);case 5:return t._hx_index==5?!0:_e.enumEq(e,t);case 6:return t._hx_index==6?!0:_e.enumEq(e,t);case 7:return t._hx_index==7?!0:_e.enumEq(e,t);case 8:return t._hx_index==8?!0:_e.enumEq(e,t);case 9:return t._hx_index==9?!0:_e.enumEq(e,t);case 10:return t._hx_index==10?!0:_e.enumEq(e,t);case 11:return t._hx_index==11?!0:_e.enumEq(e,t);case 12:return t._hx_index==12?!0:_e.enumEq(e,t);case 13:return t._hx_index==13?!0:_e.enumEq(e,t);case 15:let l=e.s,i=e.attachments;if(t._hx_index==15){let r=t.s,a=t.attachments,h=t.quotes;return e.quotes==h}else return _e.enumEq(e,t);break;case 16:if(t._hx_index==16){let r=t.n;return e.n==r}else return _e.enumEq(e,t);break;case 17:if(t._hx_index==17){let r=t.b;return e.b==r}else return _e.enumEq(e,t);break;case 18:return t._hx_index==18?!0:_e.enumEq(e,t);case 19:if(t._hx_index==19){let r=t.name;return e.name==r}else return _e.enumEq(e,t);break;case 20:return t._hx_index==20?!0:_e.enumEq(e,t);case 21:return t._hx_index==21?!0:_e.enumEq(e,t);case 22:return t._hx_index==22?!0:_e.enumEq(e,t);case 23:return t._hx_index==23?!0:_e.enumEq(e,t);case 24:return t._hx_index==24?!0:_e.enumEq(e,t);case 25:return t._hx_index==25?!0:_e.enumEq(e,t);case 26:return t._hx_index==26?!0:_e.enumEq(e,t);case 27:return t._hx_index==27?!0:_e.enumEq(e,t);case 28:return t._hx_index==28?!0:_e.enumEq(e,t);case 29:return t._hx_index==29?!0:_e.enumEq(e,t);case 30:return t._hx_index==30?!0:_e.enumEq(e,t);case 31:return t._hx_index==31?!0:_e.enumEq(e,t);case 32:return t._hx_index==32?!0:_e.enumEq(e,t);case 33:return t._hx_index==33?!0:_e.enumEq(e,t);case 34:return t._hx_index==34?!0:_e.enumEq(e,t);case 35:return t._hx_index==35?!0:_e.enumEq(e,t);case 36:return t._hx_index==36?!0:_e.enumEq(e,t);case 37:let n=e.word;if(t._hx_index==37){let r=t.word;return!0}else return _e.enumEq(e,t);break;case 38:let s=e.word;if(t._hx_index==38){let r=t.word;return!0}else return _e.enumEq(e,t);break;case 39:return t._hx_index==39?!0:_e.enumEq(e,t);case 40:return t._hx_index==40?!0:_e.enumEq(e,t);case 41:return t._hx_index==41?!0:_e.enumEq(e,t);case 42:return t._hx_index==42?!0:_e.enumEq(e,t);case 44:return t._hx_index==44?!0:_e.enumEq(e,t);case 45:return t._hx_index==45?!0:_e.enumEq(e,t);case 46:return t._hx_index==46?!0:_e.enumEq(e,t);case 47:return t._hx_index==47?!0:_e.enumEq(e,t);case 48:return t._hx_index==48?!0:_e.enumEq(e,t);case 49:return t._hx_index==49?!0:_e.enumEq(e,t);case 50:return t._hx_index==50?!0:_e.enumEq(e,t);case 51:if(t._hx_index==51){let r=t.content;return e.content==r}else return _e.enumEq(e,t);break;case 52:if(t._hx_index==52){let r=t.content;return e.content==r}else return _e.enumEq(e,t);break;case 53:if(t._hx_index==53){let r=t.content;return e.content==r}else return _e.enumEq(e,t);break;case 54:return t._hx_index==54?!0:_e.enumEq(e,t);case 55:return t._hx_index==55?!0:_e.enumEq(e,t);case 56:return t._hx_index==56?!0:_e.enumEq(e,t);case 57:return t._hx_index==57?!0:_e.enumEq(e,t);default:return _e.enumEq(e,t)}}static isComment(e){switch(e._hx_index){case 51:let t=e.content;return!0;case 52:let l=e.content;return!0;case 53:let i=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,l=e.args,i=e.code,n=e.external;return"function";case 15:let s=e.quotes,r=e.s,a=e.attachments;return"string";case 16:let h=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 m=e.content;return"comment";case 52:let f=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"}}}Q["loreline.TokenTypeHelpers"]=Nt,Nt.__name__="loreline.TokenTypeHelpers";class ye{constructor(e,t){this.type=e,this.pos=t}toString(){return""+Y.string(this.type)+" at "+this.pos.toString()}}Q["loreline.Token"]=ye,ye.__name__="loreline.Token",Object.assign(ye.prototype,{__class__:ye});class kt{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==k.Eof){if(this.indentStack.length>1){let l=this.indentStack.length-1,i=0,n=l;for(;i<n;){let s=i++,r=null;r==null&&(r=new ue(this.startLine,this.startColumn,this.pos)),r.length=this.pos-r.offset;let a=new ye(k.Unindent,r);this.previous=a,e.push(a)}}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 l;switch(this.nextBlock){case 0:case 1:l=0;break;case 2:case 3:l=2;break;case 4:case 5:l=4;break;case 6:case 7:l=7;break;case 8:case 9:l=8;break;case 10:case 11:case 12:l=10;break}this.stack.push(l),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 i;switch(this.nextBlock){case 0:case 1:i=1;break;case 2:case 3:i=3;break;case 4:case 5:i=5;break;case 6:case 7:i=7;break;case 8:case 9:i=9;break;case 10:case 11:case 12:i=11;break}this.stack.push(i),this.nextBlock=10;break;default:}}return e}nextToken(){if(this.indentTokens.length>0)return this.indentTokens.shift();if(this.skipWhitespace(),this.pos>=this.length){let i=null;i==null&&(i=new ue(this.startLine,this.startColumn,this.pos)),i.length=this.pos-i.offset;let n=new ye(k.Eof,i);return this.previous=n,n}this.startLine=this.line,this.startColumn=this.column;let e=c.cca(this.input,this.pos),t=e??-1;if(t==10||t==13){let i=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 ue(this.startLine,this.startColumn,this.pos)),r.length=this.pos-r.offset;let a=new ye(k.Indent,r);this.previous=a,s.push(a)}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 ue(this.startLine,this.startColumn,this.pos)),r.length=this.pos-r.offset;let a=new ye(k.Unindent,r);this.previous=a,s.push(a)}return i}let l=new ue(this.startLine,this.startColumn,this.pos);if(this.tokenized.length>0&&this.tokenized[this.tokenized.length-1].type==k.KwImport)return this.readImportValue(t,l);switch(t){case 34:let i=this.tryReadUnquotedString();return i??this.readString(l);case 91:let n=0,s=1;for(;n<s;){let w=n++;if(this.pos>=this.length)break;let y=c.cca(this.input,this.pos);(y??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.makeLooseOrStrictAfterBracket();let r=l;r==null&&(r=new ue(this.startLine,this.startColumn,this.pos)),r.length=this.pos-r.offset;let a=new ye(k.LBracket,r);return this.previous=a,a;case 123:let h=0,o=1;for(;h<o;){let w=h++;if(this.pos>=this.length)break;let y=c.cca(this.input,this.pos);(y??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let u=l;u==null&&(u=new ue(this.startLine,this.startColumn,this.pos)),u.length=this.pos-u.offset;let p=new ye(k.LBrace,u);return this.previous=p,p;case 125:let _=0,m=1;for(;_<m;){let w=_++;if(this.pos>=this.length)break;let y=c.cca(this.input,this.pos);(y??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let f=l;f==null&&(f=new ue(this.startLine,this.startColumn,this.pos)),f.length=this.pos-f.offset;let g=new ye(k.RBrace,f);return this.previous=g,g;default:let d=this.tryReadUnquotedString();if(d!=null)return d;switch(t){case 33:let w=t;if(w>=48&&w<=57)return this.readNumber();{let $=t;if($>=97&&$<=122||$>=65&&$<=90||$==95)return this.readIdentifier();{let se;if(this.pos+1<this.length){let j=c.cca(this.input,this.pos+1);se=j??-1}else se=0;if(se==61){let j=2;j==null&&(j=1);let ie=0,le=j;for(;ie<le;){let me=ie++;if(this.pos>=this.length)break;let we=c.cca(this.input,this.pos);(we??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ee=l;ee==null&&(ee=new ue(this.startLine,this.startColumn,this.pos)),ee.length=this.pos-ee.offset;let pe=new ye(k.OpNotEquals,ee);return this.previous=pe,pe}else{let j=0,ie=1;for(;j<ie;){let pe=j++;if(this.pos>=this.length)break;let me=c.cca(this.input,this.pos);(me??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let le=l;le==null&&(le=new ue(this.startLine,this.startColumn,this.pos)),le.length=this.pos-le.offset;let ee=new ye(k.OpNot,le);return this.previous=ee,ee}}}break;case 35:let y=t;if(y>=48&&y<=57)return this.readNumber();{let $=t;if($>=97&&$<=122||$>=65&&$<=90||$==95)return this.readIdentifier();{let se;if(this.pos+1<this.length){let j=c.cca(this.input,this.pos+1);se=j??-1}else se=0;return se>=97&&se<=122||se>=65&&se<=90||se==95||se>=48&&se<=57||se==45?this.readHashComment():(this.error("Unexpected character: #",!0),null)}}break;case 37:let S=t;if(S>=48&&S<=57)return this.readNumber();{let $=t;if($>=97&&$<=122||$>=65&&$<=90||$==95)return this.readIdentifier();{let se=0,j=1;for(;se<j;){let ee=se++;if(this.pos>=this.length)break;let pe=c.cca(this.input,this.pos);(pe??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ie=l;ie==null&&(ie=new ue(this.startLine,this.startColumn,this.pos)),ie.length=this.pos-ie.offset;let le=new ye(k.OpModulo,ie);return this.previous=le,le}}break;case 38:let T=t;if(T>=48&&T<=57)return this.readNumber();{let $=t;if($>=97&&$<=122||$>=65&&$<=90||$==95)return this.readIdentifier();{let se;if(this.pos+1<this.length){let j=c.cca(this.input,this.pos+1);se=j??-1}else se=0;if(se==38){let j=2;j==null&&(j=1);let ie=0,le=j;for(;ie<le;){let me=ie++;if(this.pos>=this.length)break;let we=c.cca(this.input,this.pos);(we??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ee=l;ee==null&&(ee=new ue(this.startLine,this.startColumn,this.pos)),ee.length=this.pos-ee.offset;let pe=new ye(k.OpAnd(!1),ee);return this.previous=pe,pe}else{let j=0,ie=1;for(;j<ie;){let pe=j++;if(this.pos>=this.length)break;let me=c.cca(this.input,this.pos);(me??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.error("Expected &",!1);let le=l;le==null&&(le=new ue(this.startLine,this.startColumn,this.pos)),le.length=this.pos-le.offset;let ee=new ye(k.OpAnd(!1),le);return this.previous=ee,ee}}}break;case 40:let O=0,E=1;for(;O<E;){let $=O++;if(this.pos>=this.length)break;let se=c.cca(this.input,this.pos);(se??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.makeStrictIfFollowingCallable();let v=l;v==null&&(v=new ue(this.startLine,this.startColumn,this.pos)),v.length=this.pos-v.offset;let M=new ye(k.LParen,v);return this.previous=M,M;case 41:let A=0,L=1;for(;A<L;){let $=A++;if(this.pos>=this.length)break;let se=c.cca(this.input,this.pos);(se??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.strictExprs.pop();let I=l;I==null&&(I=new ue(this.startLine,this.startColumn,this.pos)),I.length=this.pos-I.offset;let q=new ye(k.RParen,I);return this.previous=q,q;case 42:let z=t;if(z>=48&&z<=57)return this.readNumber();{let $=t;if($>=97&&$<=122||$>=65&&$<=90||$==95)return this.readIdentifier();{let se;if(this.pos+1<this.length){let j=c.cca(this.input,this.pos+1);se=j??-1}else se=0;if(se==61){let j=2;j==null&&(j=1);let ie=0,le=j;for(;ie<le;){let me=ie++;if(this.pos>=this.length)break;let we=c.cca(this.input,this.pos);(we??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ee=l;ee==null&&(ee=new ue(this.startLine,this.startColumn,this.pos)),ee.length=this.pos-ee.offset;let pe=new ye(k.OpMultiplyAssign,ee);return this.previous=pe,pe}else{let j=0,ie=1;for(;j<ie;){let pe=j++;if(this.pos>=this.length)break;let me=c.cca(this.input,this.pos);(me??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let le=l;le==null&&(le=new ue(this.startLine,this.startColumn,this.pos)),le.length=this.pos-le.offset;let ee=new ye(k.OpMultiply,le);return this.previous=ee,ee}}}break;case 43:let P=t;if(P>=48&&P<=57)return this.readNumber();{let $=t;if($>=97&&$<=122||$>=65&&$<=90||$==95)return this.readIdentifier();{let se;if(this.pos+1<this.length){let j=c.cca(this.input,this.pos+1);se=j??-1}else se=0;if(se==61){let j=2;j==null&&(j=1);let ie=0,le=j;for(;ie<le;){let me=ie++;if(this.pos>=this.length)break;let we=c.cca(this.input,this.pos);(we??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ee=l;ee==null&&(ee=new ue(this.startLine,this.startColumn,this.pos)),ee.length=this.pos-ee.offset;let pe=new ye(k.OpPlusAssign,ee);return this.previous=pe,pe}else{let j=0,ie=1;for(;j<ie;){let pe=j++;if(this.pos>=this.length)break;let me=c.cca(this.input,this.pos);(me??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let le=l;le==null&&(le=new ue(this.startLine,this.startColumn,this.pos)),le.length=this.pos-le.offset;let ee=new ye(k.OpPlus,le);return this.previous=ee,ee}}}break;case 44:let B=0,N=1;for(;B<N;){let $=B++;if(this.pos>=this.length)break;let se=c.cca(this.input,this.pos);(se??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let D=l;D==null&&(D=new ue(this.startLine,this.startColumn,this.pos)),D.length=this.pos-D.offset;let U=new ye(k.Comma,D);return this.previous=U,U;case 45:let W=t;if(W>=48&&W<=57)return this.readNumber();{let $=t;if($>=97&&$<=122||$>=65&&$<=90||$==95)return this.readIdentifier();{let se;if(this.pos+1<this.length){let j=c.cca(this.input,this.pos+1);se=j??-1}else se=0;if(se==62){let j=2;j==null&&(j=1);let ie=0,le=j;for(;ie<le;){let me=ie++;if(this.pos>=this.length)break;let we=c.cca(this.input,this.pos);(we??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ee=l;ee==null&&(ee=new ue(this.startLine,this.startColumn,this.pos)),ee.length=this.pos-ee.offset;let pe=new ye(k.Arrow,ee);return this.previous=pe,pe}else{let j;if(this.pos+1<this.length){let ie=c.cca(this.input,this.pos+1);j=ie??-1}else j=0;if(j==45&&this.strictExprs.length==0){let ie=2;ie==null&&(ie=1);let le=0,ee=ie;for(;le<ee;){let we=le++;if(this.pos>=this.length)break;let Ze=c.cca(this.input,this.pos);(Ze??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let pe=l;pe==null&&(pe=new ue(this.startLine,this.startColumn,this.pos)),pe.length=this.pos-pe.offset;let me=new ye(k.Separator,pe);return this.previous=me,me}else{let ie;if(this.pos+1<this.length){let le=c.cca(this.input,this.pos+1);ie=le??-1}else ie=0;if(ie==61){let le=2;le==null&&(le=1);let ee=0,pe=le;for(;ee<pe;){let Ze=ee++;if(this.pos>=this.length)break;let yt=c.cca(this.input,this.pos);(yt??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let me=l;me==null&&(me=new ue(this.startLine,this.startColumn,this.pos)),me.length=this.pos-me.offset;let we=new ye(k.OpMinusAssign,me);return this.previous=we,we}else{let le=0,ee=1;for(;le<ee;){let we=le++;if(this.pos>=this.length)break;let Ze=c.cca(this.input,this.pos);(Ze??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let pe=l;pe==null&&(pe=new ue(this.startLine,this.startColumn,this.pos)),pe.length=this.pos-pe.offset;let me=new ye(k.OpMinus,pe);return this.previous=me,me}}}}}break;case 46:let J=0,H=1;for(;J<H;){let $=J++;if(this.pos>=this.length)break;let se=c.cca(this.input,this.pos);(se??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let X=l;X==null&&(X=new ue(this.startLine,this.startColumn,this.pos)),X.length=this.pos-X.offset;let ae=new ye(k.Dot,X);return this.previous=ae,ae;case 47:let ce=t;if(ce>=48&&ce<=57)return this.readNumber();{let $=t;if($>=97&&$<=122||$>=65&&$<=90||$==95)return this.readIdentifier();{let se;if(this.pos+1<this.length){let j=c.cca(this.input,this.pos+1);se=j??-1}else se=0;if(se==61){let j=2;j==null&&(j=1);let ie=0,le=j;for(;ie<le;){let me=ie++;if(this.pos>=this.length)break;let we=c.cca(this.input,this.pos);(we??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ee=l;ee==null&&(ee=new ue(this.startLine,this.startColumn,this.pos)),ee.length=this.pos-ee.offset;let pe=new ye(k.OpDivideAssign,ee);return this.previous=pe,pe}else{let j;if(this.pos+1<this.length){let ie=c.cca(this.input,this.pos+1);j=ie??-1}else j=0;if(j==47)return this.readLineComment();{let ie;if(this.pos+1<this.length){let le=c.cca(this.input,this.pos+1);ie=le??-1}else ie=0;if(ie==42)return this.readMultiLineComment();{let le=0,ee=1;for(;le<ee;){let we=le++;if(this.pos>=this.length)break;let Ze=c.cca(this.input,this.pos);(Ze??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let pe=l;pe==null&&(pe=new ue(this.startLine,this.startColumn,this.pos)),pe.length=this.pos-pe.offset;let me=new ye(k.OpDivide,pe);return this.previous=me,me}}}}}break;case 58:let ne;if(this.pos+1<this.length){let $=c.cca(this.input,this.pos+1);ne=$??-1}else ne=0;if(ne==61){let $=2;$==null&&($=1);let se=0,j=$;for(;se<j;){let ee=se++;if(this.pos>=this.length)break;let pe=c.cca(this.input,this.pos);(pe??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ie=l;ie==null&&(ie=new ue(this.startLine,this.startColumn,this.pos)),ie.length=this.pos-ie.offset;let le=new ye(k.OpUnquotedAssign,ie);return this.previous=le,le}else{let $=0,se=1;for(;$<se;){let le=$++;if(this.pos>=this.length)break;let ee=c.cca(this.input,this.pos);(ee??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let j=l;j==null&&(j=new ue(this.startLine,this.startColumn,this.pos)),j.length=this.pos-j.offset;let ie=new ye(k.Colon,j);return this.previous=ie,ie}break;case 60:let re=t;if(re>=48&&re<=57)return this.readNumber();{let $=t;if($>=97&&$<=122||$>=65&&$<=90||$==95)return this.readIdentifier();{let se;if(this.pos+1<this.length){let j=c.cca(this.input,this.pos+1);se=j??-1}else se=0;if(se==61){let j=2;j==null&&(j=1);let ie=0,le=j;for(;ie<le;){let me=ie++;if(this.pos>=this.length)break;let we=c.cca(this.input,this.pos);(we??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ee=l;ee==null&&(ee=new ue(this.startLine,this.startColumn,this.pos)),ee.length=this.pos-ee.offset;let pe=new ye(k.OpLessEq,ee);return this.previous=pe,pe}else{let j=0,ie=1;for(;j<ie;){let pe=j++;if(this.pos>=this.length)break;let me=c.cca(this.input,this.pos);(me??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let le=l;le==null&&(le=new ue(this.startLine,this.startColumn,this.pos)),le.length=this.pos-le.offset;let ee=new ye(k.OpLess,le);return this.previous=ee,ee}}}break;case 61:let xe=t;if(xe>=48&&xe<=57)return this.readNumber();{let $=t;if($>=97&&$<=122||$>=65&&$<=90||$==95)return this.readIdentifier();{let se;if(this.pos+1<this.length){let j=c.cca(this.input,this.pos+1);se=j??-1}else se=0;if(se==61){let j=2;j==null&&(j=1);let ie=0,le=j;for(;ie<le;){let me=ie++;if(this.pos>=this.length)break;let we=c.cca(this.input,this.pos);(we??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ee=l;ee==null&&(ee=new ue(this.startLine,this.startColumn,this.pos)),ee.length=this.pos-ee.offset;let pe=new ye(k.OpEquals,ee);return this.previous=pe,pe}else{let j=0,ie=1;for(;j<ie;){let pe=j++;if(this.pos>=this.length)break;let me=c.cca(this.input,this.pos);(me??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let le=l;le==null&&(le=new ue(this.startLine,this.startColumn,this.pos)),le.length=this.pos-le.offset;let ee=new ye(k.OpAssign,le);return this.previous=ee,ee}}}break;case 62:let Pe=t;if(Pe>=48&&Pe<=57)return this.readNumber();{let $=t;if($>=97&&$<=122||$>=65&&$<=90||$==95)return this.readIdentifier();{let se;if(this.pos+1<this.length){let j=c.cca(this.input,this.pos+1);se=j??-1}else se=0;if(se==61){let j=2;j==null&&(j=1);let ie=0,le=j;for(;ie<le;){let me=ie++;if(this.pos>=this.length)break;let we=c.cca(this.input,this.pos);(we??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ee=l;ee==null&&(ee=new ue(this.startLine,this.startColumn,this.pos)),ee.length=this.pos-ee.offset;let pe=new ye(k.OpGreaterEq,ee);return this.previous=pe,pe}else{let j=0,ie=1;for(;j<ie;){let pe=j++;if(this.pos>=this.length)break;let me=c.cca(this.input,this.pos);(me??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let le=l;le==null&&(le=new ue(this.startLine,this.startColumn,this.pos)),le.length=this.pos-le.offset;let ee=new ye(k.OpGreater,le);return this.previous=ee,ee}}}break;case 63:let Ue=t;if(Ue>=48&&Ue<=57)return this.readNumber();{let $=t;if($>=97&&$<=122||$>=65&&$<=90||$==95)return this.readIdentifier();{this.pos++;let se=null;se==null&&(se=new ue(this.startLine,this.startColumn,this.pos)),se.length=this.pos-se.offset;let j=new ye(k.Question,se);return this.previous=j,j}}break;case 93:let Je=0,lt=1;for(;Je<lt;){let $=Je++;if(this.pos>=this.length)break;let se=c.cca(this.input,this.pos);(se??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.strictExprs.pop();let Ve=l;Ve==null&&(Ve=new ue(this.startLine,this.startColumn,this.pos)),Ve.length=this.pos-Ve.offset;let Qe=new ye(k.RBracket,Ve);return this.previous=Qe,Qe;case 124:let at=t;if(at>=48&&at<=57)return this.readNumber();{let $=t;if($>=97&&$<=122||$>=65&&$<=90||$==95)return this.readIdentifier();{let se;if(this.pos+1<this.length){let j=c.cca(this.input,this.pos+1);se=j??-1}else se=0;if(se==124){let j=2;j==null&&(j=1);let ie=0,le=j;for(;ie<le;){let me=ie++;if(this.pos>=this.length)break;let we=c.cca(this.input,this.pos);(we??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ee=l;ee==null&&(ee=new ue(this.startLine,this.startColumn,this.pos)),ee.length=this.pos-ee.offset;let pe=new ye(k.OpOr(!1),ee);return this.previous=pe,pe}else{let j=0,ie=1;for(;j<ie;){let pe=j++;if(this.pos>=this.length)break;let me=c.cca(this.input,this.pos);(me??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.error("Expected |",!1);let le=l;le==null&&(le=new ue(this.startLine,this.startColumn,this.pos)),le.length=this.pos-le.offset;let ee=new ye(k.OpOr(!1),le);return this.previous=ee,ee}}}break;default:let Re=t;if(Re>=48&&Re<=57)return this.readNumber();{let $=t;return $>=97&&$<=122||$>=65&&$<=90||$==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=c.cca(this.input,e),s=n??-1;if(s==32)++t;else if(s==9)++t;else break;++e}let l,i;if(e<this.length){let n=c.cca(this.input,e);i=(n??-1)==10}else i=!0;if(i)l=!0;else{let n=c.cca(this.input,e);l=(n??-1)==13}return l?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 k.KwBeat;case 2:case 3:return k.KwState;case 4:case 5:return k.KwCharacter;case 6:case 7:return k.KwBeat;case 8:case 9:return k.KwBeat;case 10:return k.LBrace;case 11:return k.Indent;case 12:return k.LBracket}--e}return k.KwBeat}inBeat(){return this.parentBlockType()==k.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!=k.KwState?e==k.KwCharacter:!0}readLineBreak(){let e=new ue(this.startLine,this.startColumn,this.pos),t=c.cca(this.input,this.pos);if((t??-1)==13){let n=0,s=1;for(;n<s;){let a=n++;if(this.pos>=this.length)break;let h=c.cca(this.input,this.pos);(h??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let r;if(this.pos<this.length){let a=c.cca(this.input,this.pos);r=(a??-1)==10}else r=!1;if(r){let a=0,h=1;for(;a<h;){let o=a++;if(this.pos>=this.length)break;let u=c.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 a=c.cca(this.input,this.pos);(a??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let l=e;l==null&&(l=new ue(this.startLine,this.startColumn,this.pos)),l.length=this.pos-l.offset;let i=new ye(k.LineBreak,l);return this.previous=i,i}isWhitespace(e){return e!=32?e==9:!0}matchIdentifier(e){if(this.length==0)return null;let t=c.cca(this.input,e),l=t??-1;if(!(l>=97&&l<=122||l>=65&&l<=90||l==95))return null;let i=1;for(;i<this.length;){let s=c.cca(this.input,e+i),r=s??-1;if(!(r>=97&&r<=122||r>=65&&r<=90||r==95||r>=48&&r<=57))break;++i}let n=this.input;return i!=null?c.substr(n,e,i):c.substr(n,e,null)}_skipWhitespaceAndComments(e,t){if(t==null&&(t=!1),t)return this._skipWhitespaceAndCommentsStopNextLine(e);{let l=e,i=!1;for(;e<this.length;){for(;;){let n;if(e<this.length){let s=c.cca(this.input,e);if((s??-1)!=32){let r=c.cca(this.input,e);n=(r??-1)==9}else n=!0}else n=!1;if(!n)break;++e,i=!0}if(e<this.length-1){let n=c.cca(this.input,e);if((n??-1)==47){let s=c.cca(this.input,e+1);if((s??-1)==47)return e=l,e;{let r=c.cca(this.input,e+1);if((r??-1)==42){e+=2,i=!0;let a=!1;for(;e<this.length-1;){let h,o=c.cca(this.input,e);if((o??-1)==42){let u=c.cca(this.input,e+1);h=(u??-1)==47}else h=!1;if(h){e+=2,a=!0;break}++e}if(!a)return e=l,e;continue}}}}break}return i?e:l}}_skipWhitespaceAndCommentsStopNextLine(e){let t=e,l=!1,i=!1;for(;e<this.length;){for(;e<this.length;){let n=c.cca(this.input,e),s=n??-1;if(s==32||s==9||s==13||!i&&s==10)s==10&&(i=!0),++e,l=!0;else break}if(e<this.length-1&&!i){let n=c.cca(this.input,e);if((n??-1)==47){let s=c.cca(this.input,e+1);if((s??-1)==47){for(e+=2,l=!0;;){let r,a;if(e<this.length){let h=c.cca(this.input,e);a=(h??-1)!=10}else a=!1;if(a){let h=c.cca(this.input,e);r=(h??-1)!=13}else r=!1;if(!r)break;++e}continue}else{let r=c.cca(this.input,e+1);if((r??-1)==42){e+=2,l=!0;let a=!1;for(;e<this.length-1;){let h,o=c.cca(this.input,e);if((o??-1)==42){let u=c.cca(this.input,e+1);h=(u??-1)==47}else h=!1;if(h){e+=2,a=!0;break}++e}if(!a)return e=t,e;continue}}}}break}return l?e:t}isIfStart(e){e=this._skipWhitespaceAndComments(e,!1);let t=c.cca(this.input,e);if((t??-1)!=105)return!1;++e;let l=c.cca(this.input,e);if((l??-1)!=102)return!1;let i=++e;e=this._skipWhitespaceAndComments(e,!1);let n;if(e<this.length){let o=c.cca(this.input,e);n=(o??-1)==33}else n=!1;n&&(++e,e=this._skipWhitespaceAndComments(e,!1));let s=c.cca(this.input,e);if((s??-1)==40)return!0;let r;if(e==i&&i<this.length){let o=c.cca(this.input,i),u=o??-1;if(u>=97&&u<=122||u>=65&&u<=90||u==95)r=!0;else{let p=c.cca(this.input,i),_=p??-1;r=_>=48&&_<=57}}else r=!1;if(r)return!1;let a;if(e<this.length){let o=c.cca(this.input,e),u=o??-1;if(u>=97&&u<=122||u>=65&&u<=90||u==95)a=!1;else{let p=c.cca(this.input,e),_=p??-1;a=!(_>=48&&_<=57)}}else a=!0;if(a)return!1;let h=this;for(;e<this.length;){let o=c.cca(this.input,e);if((o??-1)==40)return!0;{let T=c.cca(this.input,e),O=T??-1;if(O>=48&&O<=57)for(;;){let E;if(e<this.length){let v=c.cca(this.input,e),M=v??-1;if(M>=48&&M<=57)E=!0;else{let A=c.cca(this.input,e);E=(A??-1)==46}}else E=!1;if(!E)break;++e}else{let E=!0,v=h.length;if(e>=v)E=!1;else{let M,A,L;if(e+1<v){let I=c.cca(h.input,e);L=(I??-1)==111}else L=!1;if(L){let I=c.cca(h.input,e+1);A=(I??-1)==114}else A=!1;if(A)if(e+2<v){let I=c.cca(h.input,e+2),q=I??-1;M=!(q>=97&&q<=122||q>=65&&q<=90||q==95)}else M=!0;else M=!1;if(M)E=!1;else{let I,q,z,P;if(e+2<v){let B=c.cca(h.input,e);P=(B??-1)==97}else P=!1;if(P){let B=c.cca(h.input,e+1);z=(B??-1)==110}else z=!1;if(z){let B=c.cca(h.input,e+2);q=(B??-1)==100}else q=!1;if(q)if(e+3<v){let B=c.cca(h.input,e+3),N=B??-1;I=!(N>=97&&N<=122||N>=65&&N<=90||N==95)}else I=!0;else I=!1;if(I)E=!1;else{let B=c.cca(h.input,e),N=B??-1;if(!(N>=97&&N<=122||N>=65&&N<=90||N==95))E=!1;else for(++e;e<h.length;){let D=c.cca(h.input,e);if(N=D??-1,!(N>=97&&N<=122||N>=65&&N<=90||N==95||N>=48&&N<=57))break;++e}}}}if(!E)return!1}}if(e=this._skipWhitespaceAndComments(e,!1),e>=this.length)return!0;let u=c.cca(this.input,e),p=u??-1;if(p==46){++e,e=this._skipWhitespaceAndComments(e,!1);let T=!0,O=h.length;if(e>=O)T=!1;else{let v,M,A;if(e+1<O){let L=c.cca(h.input,e);A=(L??-1)==111}else A=!1;if(A){let L=c.cca(h.input,e+1);M=(L??-1)==114}else M=!1;if(M)if(e+2<O){let L=c.cca(h.input,e+2),I=L??-1;v=!(I>=97&&I<=122||I>=65&&I<=90||I==95)}else v=!0;else v=!1;if(v)T=!1;else{let L,I,q,z;if(e+2<O){let P=c.cca(h.input,e);z=(P??-1)==97}else z=!1;if(z){let P=c.cca(h.input,e+1);q=(P??-1)==110}else q=!1;if(q){let P=c.cca(h.input,e+2);I=(P??-1)==100}else I=!1;if(I)if(e+3<O){let P=c.cca(h.input,e+3),B=P??-1;L=!(B>=97&&B<=122||B>=65&&B<=90||B==95)}else L=!0;else L=!1;if(L)T=!1;else{let P=c.cca(h.input,e),B=P??-1;if(!(B>=97&&B<=122||B>=65&&B<=90||B==95))T=!1;else for(++e;e<h.length;){let N=c.cca(h.input,e);if(B=N??-1,!(B>=97&&B<=122||B>=65&&B<=90||B==95||B>=48&&B<=57))break;++e}}}}if(!T||(e=this._skipWhitespaceAndComments(e,!1),e>=this.length))return!0;let E=c.cca(this.input,e);p=E??-1}if(p==91){++e;let T=1;for(;e<this.length&&T>0;){let E=c.cca(this.input,e);p=E??-1,p==91&&++T,p==93&&--T,++e}if(e=this._skipWhitespaceAndComments(e,!1),e>=this.length)return!0;let O=c.cca(this.input,e);p=O??-1}let _,m,f;if(p==97){let T=c.cca(this.input,e+1);f=(T??-1)==110}else f=!1;if(f){let T=c.cca(this.input,e+2);m=(T??-1)==100}else m=!1;if(m)if(e+3<this.length){let T=c.cca(this.input,e+3),O=T??-1;_=!(O>=97&&O<=122||O>=65&&O<=90||O==95)}else _=!0;else _=!1;if(_)return!0;let g,d;if(p==111){let T=c.cca(this.input,e+1);d=(T??-1)==114}else d=!1;if(d)if(e+2<this.length){let T=c.cca(this.input,e+2),O=T??-1;g=!(O>=97&&O<=122||O>=65&&O<=90||O==95)}else g=!0;else g=!1;if(g)return!0;let w,y,S;if(p==40||p==38||p==124)S=!0;else{let T=c.cca(this.input,e+1);S=(T??-1)==61&&p==61}if(S||p==62||p==60)y=!0;else if(p==33){let T=c.cca(this.input,e+1);y=(T??-1)==61}else y=!1;if(y)w=!0;else{let T=c.cca(this.input,e+1);w=(T??-1)!=61&&(p==43||p==45||p==42||p==47||p==123)}if(w)return!0;if(p==10||p==13||e>=this.length)return e=i,!0;if(p==32||p==9){let T=e;for(;;){let v;if(T<this.length){let M=c.cca(this.input,T),A=M??-1;v=A==32||A==9}else v=!1;if(!v)break;++T}let O,E;if(T+1<this.length){let v=c.cca(this.input,T);E=(v??-1)==47}else E=!1;if(E){let v=c.cca(this.input,T+1);O=(v??-1)==47}else O=!1;if(O)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 l=c.cca(this.input,e);if((l??-1)==40)return!0;let i=this,n=t;n==null&&(n=!1);let s=!0;if(e>=i.length)s=!1;else{let r=!1,a=c.cca(i.input,e),h=a??-1;if(r=h==95,!(h>=97&&h<=122||h>=65&&h<=90||h==95)||n&&!r&&!(h>=97&&h<=122))s=!1;else for(++e;e<i.length;){let o=r,u=c.cca(i.input,e);if(h=u??-1,r=h==95,!(h>=97&&h<=122||h>=65&&h<=90||h==95||h>=48&&h<=57))break;if(n&&o&&!r&&!(h>=97&&h<=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=c.cca(this.input,e),a=r??-1;if(!(a==32||a==9)&&a!=46&&a!=91&&a!=10&&a!=13&&a!=47)return!1;let h;if(a==10||a==13)h=!0;else if(a==47&&e+1<this.length){let o=c.cca(this.input,e+1);if((o??-1)!=47){let u=c.cca(this.input,e+1);h=(u??-1)==42}else h=!0}else h=!1;if(h)return!0;if(a==46){if(++e,e=this._skipWhitespaceAndComments(e,!1),e>=this.length)return!0;let o=!0;if(e>=i.length)o=!1;else{let u=!1,p=c.cca(i.input,e),_=p??-1;if(u=_==95,!(_>=97&&_<=122||_>=65&&_<=90||_==95))o=!1;else for(++e;e<i.length;){let m=u,f=c.cca(i.input,e);if(_=f??-1,u=_==95,!(_>=97&&_<=122||_>=65&&_<=90||_==95||_>=48&&_<=57))break;++e}}if(!o)return!0;continue}if(a==91){++e;let o=1;for(;e<this.length&&o>0;){let u=c.cca(this.input,e);if(a=u??-1,a==34){if(e=this.scanStringEnd(e,!1),e==-1)return!1;continue}a==91&&++o,a==93&&--o,++e}continue}if(a==32||a==9){++e;continue}break}return!0}isTransitionStart(e){let t,l=c.cca(this.input,e);if((l??-1)!=45||e>=this.length-1)t=!0;else{let s=c.cca(this.input,e+1);t=(s??-1)!=62}if(t||(e+=2,e=this._skipWhitespaceAndComments(e,!1),e>=this.length))return!1;let i=c.cca(this.input,e);if((i??-1)==46)++e;else{let s=c.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 a;if(e<this.length){let h=c.cca(this.input,e),o=h??-1;a=o>=97&&o<=122||o>=65&&o<=90||o==95||o>=48&&o<=57}else a=!1;if(!a)break;++e}else return!1}if(e=this._skipWhitespaceAndComments(e,!1),e<this.length){let s=c.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=c.cca(this.input,e);if((t??-1)!=43||(++e,e=this._skipWhitespaceAndComments(e,!1),e>=this.length))return!1;let l=c.cca(this.input,e);if((l??-1)==46)++e;else{let n=c.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 a=c.cca(this.input,e),h=a??-1;r=h>=97&&h<=122||h>=65&&h<=90||h==95||h>=48&&h<=57}else r=!1;if(!r)break;++e}else return!1}if(e=this._skipWhitespaceAndComments(e,!1),e<this.length){let n=c.cca(this.input,e),s=n??-1,r;if(s==105&&e+1<this.length){let a=c.cca(this.input,e+1);r=(a??-1)==102}else r=!1;if(r){let a;if(e+2<this.length){let h=c.cca(this.input,e+2),o=h??-1;a=!(o>=97&&o<=122||o>=65&&o<=90||o==95||o>=48&&o<=57)}else a=!0;if(a)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=c.cca(this.input,e);if((t??-1)!=45||(++e,e>=this.length))return!1;let l=c.cca(this.input,e);return(l??-1)==32}isLabelStart(e){e=this._skipWhitespaceAndComments(e,!1);let t=c.cca(this.input,e),l=t??-1;if(!(l>=97&&l<=122||l>=65&&l<=90||l==95))return!1;let i=e;for(++e;;){let h;if(e<this.length){let o=c.cca(this.input,e),u=o??-1;h=u>=97&&u<=122||u>=65&&u<=90||u==95||u>=48&&u<=57}else h=!1;if(!h)break;++e}for(;;){let h;if(e<this.length){let o=c.cca(this.input,e),u=o??-1;h=u==32||u==9}else h=!1;if(!h)break;++e}let n;if(e<this.length){let h=c.cca(this.input,e);n=(h??-1)!=58}else n=!0;if(n)return!1;let s=this.input,r=e-i,a=r!=null?c.substr(s,i,r):c.substr(s,i,null);return!Object.prototype.hasOwnProperty.call(kt.KEYWORDS.h,a)}isCallStart(e){let t=e,l=this,i=!0;if(e>=l.length)i=!1;else{let n=c.cca(l.input,e),s=n??-1;if(!(s>=97&&s<=122||s>=65&&s<=90||s==95))i=!1;else for(++e;e<l.length;){let r=c.cca(l.input,e);if(s=r??-1,!(s>=97&&s<=122||s>=65&&s<=90||s==95||s>=48&&s<=57))break;++e}}if(!i)return e=t,!1;for(;e<this.length;){if(e=this._skipWhitespaceAndComments(e,!1),e>=this.length)return e=t,!1;let n=c.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>=l.length)r=!1;else{let a=c.cca(l.input,e),h=a??-1;if(!(h>=97&&h<=122||h>=65&&h<=90||h==95))r=!1;else for(++e;e<l.length;){let o=c.cca(l.input,e);if(h=o??-1,!(h>=97&&h<=122||h>=65&&h<=90||h==95||h>=48&&h<=57))break;++e}}if(!r)return e=t,!1;continue}if(s==91){for(++e;e<this.length;){let r=c.cca(this.input,e),a=r??-1;if(a==34){if(e=this.scanStringEnd(e,!1),e==-1)return e=t,!1;continue}if(a==93){++e;break}++e}continue}return e=t,!1}return e=t,!1}isAssignStart(e,t){let l=this,i;if(t){let s=!0,r=e;if(e>=l.length)s=!1;else{let o=c.cca(l.input,e),u=o??-1;if(!(u>=97&&u<=122||u>=65&&u<=90||u==95))s=!1;else for(++e;e<l.length;){let p=c.cca(l.input,e);if(u=p??-1,!(u>=97&&u<=122||u>=65&&u<=90||u==95||u>=48&&u<=57))break;++e}}let a,h;if(e==r+2){let o=c.cca(l.input,r);h=(o??-1)==105}else h=!1;if(h){let o=c.cca(l.input,r+1);a=(o??-1)==102}else a=!1;i=!(!a&&s)}else i=!1;if(i)return!1;let n=!1;for(;e<this.length;){if(e=this._skipWhitespaceAndComments(e,!1),e>=this.length)return!1;let s=c.cca(this.input,e),r=s??-1,a;if(n)a=!1;else{let h;if(r==61)if(e+1<this.length){let o=c.cca(this.input,e+1);h=(o??-1)!=61}else h=!0;else h=!1;if(h)a=!0;else{let o=c.cca(this.input,e+1);a=(o??-1)==61&&(r==43||r==45||r==42||r==47||r==58)}}if(a)return!0;if(t){if(r==46){++e,e=this._skipWhitespaceAndComments(e,!1);let h=!0,o=e;if(e>=l.length)h=!1;else{let _=c.cca(l.input,e),m=_??-1;if(!(m>=97&&m<=122||m>=65&&m<=90||m==95))h=!1;else for(++e;e<l.length;){let f=c.cca(l.input,e);if(m=f??-1,!(m>=97&&m<=122||m>=65&&m<=90||m==95||m>=48&&m<=57))break;++e}}let u,p;if(e==o+2){let _=c.cca(l.input,o);p=(_??-1)==105}else p=!1;if(p){let _=c.cca(l.input,o+1);u=(_??-1)==102}else u=!1;if(!(!u&&h))return!1;continue}if(r==91){for(++e;e<this.length;){let h=c.cca(this.input,e),o=h??-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 h=!0,o=e;if(e>=l.length)h=!1;else{let _=c.cca(l.input,e),m=_??-1;if(!(m>=97&&m<=122||m>=65&&m<=90||m==95))h=!1;else for(++e;e<l.length;){let f=c.cca(l.input,e);if(m=f??-1,!(m>=97&&m<=122||m>=65&&m<=90||m==95||m>=48&&m<=57))break;++e}}let u,p;if(e==o+2){let _=c.cca(l.input,o);p=(_??-1)==105}else p=!1;if(p){let _=c.cca(l.input,o+1);u=(_??-1)==102}else u=!1;if(!(!u&&h))return!1}else{let h;if((r==61||r==33||r==60||r==62)&&e+1<this.length){let o=c.cca(this.input,e+1);h=(o??-1)==61}else h=!1;h?e+=2:++e}}}return!1}isColon(e,t){if(t==null&&(t=!0),t)for(;;){let l;if(e<this.length){let i=c.cca(this.input,e);if((i??-1)!=32){let n=c.cca(this.input,e);l=(n??-1)==9}else l=!0}else l=!1;if(!l)break;++e}if(e<this.length){let l=c.cca(this.input,e);return(l??-1)==58}else return!1}afterLabelIdentifierToken(e){e==null&&(e=!0);let t=this.tokenized.length-1;for(;t>=0;){let l=this.tokenized[t];if(!Nt.isComment(l.type)&&(e||l.type!=k.LineBreak&&l.type!=k.Indent&&l.type!=k.Unindent))return l.type==k.Colon&&t>0&&Nt.isIdentifier(this.tokenized[t-1].type)?t-1:-1;--t}return-1}isStartingMultilineDialogue(e){let t=this.tokenized[e],l=e+1;for(;this.tokenized[l].type!=k.Colon;)++l;let i=this.tokenized[l].pos.offset+1,n=t.pos.column,s=!0,r=!1;for(;i<this.length;){let g=c.cca(this.input,i),d=g??-1;if(d==32||d==9)++i;else break}for(;i<this.length;){let g=c.cca(this.input,i),d=g??-1;if(d==10||d==13)break;if(d==47&&i+1<this.length){let w=c.cca(this.input,i+1),y=w??-1;if(y==47)break;if(y==42){for(i+=2;i<this.length;){let S,T=c.cca(this.input,i);if((T??-1)==42&&i+1<this.length){let O=c.cca(this.input,i+1);S=(O??-1)==47}else S=!1;if(S){i+=2;break}++i}continue}}if(d==60)r=!0;else if(d==62)r=!1;else if(!r&&!(d==32||d==9)){s=!1;break}++i}if(!s)for(;;){let g,d;if(i<this.length){let w=c.cca(this.input,i);d=(w??-1)!=10}else d=!1;if(d){let w=c.cca(this.input,i);g=(w??-1)!=13}else g=!1;if(!g)break;++i}let a=i,h=!0;if(h==null&&(h=!1),i=this._skipWhitespaceAndComments(i,h),i<=a)return-1;let o=0,u=i;for(;;){let g;if(u>0){let d=c.cca(this.input,u-1);if((d??-1)!=32){let w=c.cca(this.input,u-1);g=(w??-1)==9}else g=!0}else g=!1;if(!g)break;++o,--u}if(o<=n-1)return-1;let p=!1;p==null&&(p=!1),i=this._skipWhitespaceAndComments(i,p);let _,m=c.cca(this.input,i),f=m??-1;if(f==32||f==9)_=!0;else{let g=c.cca(this.input,i);if((g??-1)==47){let d=c.cca(this.input,i+1);_=(d??-1)==47}else _=!1}return _?-1:o}isContinuingMultilineText(e,t){let l,i=c.cca(this.input,e);if((i??-1)==47){let m=c.cca(this.input,e+1);l=(m??-1)==47}else l=!1;if(l)for(;;){let m,f;if(e<this.length){let g=c.cca(this.input,e);f=(g??-1)!=13}else f=!1;if(f){let g=c.cca(this.input,e);m=(g??-1)!=10}else m=!1;if(!m)break;++e}let n=c.cca(this.input,e);(n??-1)==13&&++e;let s=c.cca(this.input,e);if((s??-1)==10)++e;else return!1;let r=0;for(;;){let m,f=c.cca(this.input,e);if((f??-1)!=32){let g=c.cca(this.input,e);m=(g??-1)==9}else m=!0;if(!m)break;++r,++e}if(r!=t)return!1;let a=!1;a==null&&(a=!1),e=this._skipWhitespaceAndComments(e,a);let h,o,u,p=c.cca(this.input,e),_=p??-1;if(_==32||_==9)u=!0;else{let m=c.cca(this.input,e);u=(m??-1)==13}if(u)o=!0;else{let m=c.cca(this.input,e);o=(m??-1)==10}if(o)h=!0;else{let m=c.cca(this.input,e);if((m??-1)==47){let f=c.cca(this.input,e+1);h=(f??-1)==47}else h=!1}return!h}isAfterComma(){let e=this.tokenized.length-1;for(;e>=0;){let t=this.tokenized[e];if(!Nt.isComment(t.type)&&t.type!=k.LineBreak&&t.type!=k.Indent&&t.type!=k.Unindent)return t.type==k.Comma;--e}return!1}isAfterLBracket(){let e=this.tokenized.length-1;for(;e>=0;){let t=this.tokenized[e];if(!Nt.isComment(t.type)&&t.type!=k.LineBreak&&t.type!=k.Indent&&t.type!=k.Unindent)return t.type==k.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(Nt.isComment(t.type)||t.type==k.Indent||t.type==k.Unindent)--e;else return!!Nt.isAssignOp(t.type)}return!1}followsUnquotedAssign(){let e=this.tokenized.length-1;for(;e>=0;){let t=this.tokenized[e];if(Nt.isComment(t.type)||t.type==k.Indent||t.type==k.Unindent)--e;else return t.type==k.OpUnquotedAssign}return!1}followsOnlyLabelOrCommentsInLine(){let e=!1,t=this.tokenized.length-1;for(;t>=0;){let l=this.tokenized[t];if(Nt.isComment(l.type)||l.type==k.Indent||l.type==k.Unindent)--t;else if(!e&&l.type==k.Colon)if(--t,t>=0)Nt.isIdentifier(this.tokenized[t].type)&&(e=!0,--t);else return!1;else return l.type==k.LineBreak}return!0}followsOnlyWhitespacesOrCommentsInLine(){let e=this.tokenized.length-1;for(;e>=0;){let t=this.tokenized[e];if(Nt.isComment(t.type)||t.type==k.Indent||t.type==k.Unindent)--e;else return t.type==k.LineBreak}return!0}followsChoiceOncePrefix(){if(!this.inChoiceRoot())return!1;let e=this.tokenized.length-1;for(;e>=0;){let t=this.tokenized[e];if(Nt.isComment(t.type)||t.type==k.Indent||t.type==k.Unindent)--e;else if(t.type==k.OpMinus){for(--e;e>=0&&(Nt.isComment(this.tokenized[e].type)||this.tokenized[e].type==k.Indent||this.tokenized[e].type==k.Unindent);)--e;return e>=0?this.tokenized[e].type==k.LineBreak:!0}else return!1}return!1}hasNonSpecialChar(e){let t=0,l=e.length;for(;t<l;){let i=t++,n=!1,s=c.cca(e,i),r=s??-1,a=0,h=kt.hasNonSpecialChar_specialChars.length;for(;a<h;){let o=a++,u=c.cca(kt.hasNonSpecialChar_specialChars,o);if(r==(u??-1)){n=!0;break}}if(!n)return!0}return!1}isNumber(e){let t=0,l=e.length,i;if(t<l){let a=c.cca(e,t);i=(a??-1)==45}else i=!1;i&&++t;let n=t;for(;;){let a;if(t<l){let h=c.cca(e,t),o=h??-1;a=o>=48&&o<=57}else a=!1;if(!a)break;++t}if(t==n)return!1;let s,r;if(t<l){let a=c.cca(e,t);r=(a??-1)==46}else r=!1;if(r&&t+1<l){let a=c.cca(e,t+1),h=a??-1;s=h>=48&&h<=57}else s=!1;if(s)for(++t;;){let a;if(t<l){let h=c.cca(e,t),o=h??-1;a=o>=48&&o<=57}else a=!1;if(!a)break;++t}return t==l}makeLooseOrStrictAfterBracket(){if(this.isStrict()){this.strictExprs.push(1);return}let e=this.tokenized.length-1;for(;e>=0;){let l=this.tokenized[e].type;switch(l._hx_index){case 19:let i=l.name;this.strictExprs.push(1);return;case 48:case 50:this.strictExprs.push(1);return;case 51:let n=l.content;break;case 52:let s=l.content;break;case 53:let r=l.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 l=this.tokenized[e].type;switch(l._hx_index){case 19:let i=l.name;return!0;case 48:case 50:return!0;case 51:let n=l.content;break;case 52:let s=l.content;break;case 53:let r=l.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 l="";for(;this.pos<this.length;){let r=c.cca(this.input,this.pos),a=r??-1;if(a==10)break;if(a==47&&this.pos+1<this.length){let h=c.cca(this.input,this.pos+1),o=h??-1;if(o==47||o==42)break}if(a==35&&this.pos+1<this.length){let h=c.cca(this.input,this.pos+1),o=h??-1;if(o>=97&&o<=122||o>=65&&o<=90||o==95||o>=48&&o<=57||o==45)break}l+=String.fromCodePoint(a),this.pos++}let i=He.rtrim(l),n=new ue(t.line,t.column,t.offset,i.length);n==null&&(n=new ue(this.startLine,this.startColumn,this.pos)),n.length=this.pos-n.offset;let s=new ye(k.LString(0,i,[]),n);return this.previous=s,s}}scanStringEnd(e,t){let l=e+1,i=!1;for(;l<this.length;){let n=c.cca(this.input,l),s=n??-1;if(s==92){l+=2;continue}if(s==10)return-1;if(s==34&&!i)return l+1;if(t&&s==60&&!i){let r;if(l+1<this.length){let o=c.cca(this.input,l+1);r=o??-1}else r=0;let a=r==47,h=l+(a?2:1);if(h<this.length){let o=c.cca(this.input,h),u=o??-1;(u>=97&&u<=122||u>=65&&u<=90||u==95||u==95||u==36||a&&u==62)&&(i=!0)}}if(s==62&&i&&(i=!1),s==36&&l+1<this.length){let r=c.cca(this.input,l+1),a=r??-1;if(a==123){l+=2;let h=1;for(;l<this.length&&h>0;){let o=c.cca(this.input,l),u=o??-1;if(u==92){l+=2;continue}if(u==10)return-1;let p;if(u==47&&l+1<this.length){let m=c.cca(this.input,l+1);p=(m??-1)==47}else p=!1;if(p)return-1;let _;if(u==47&&l+1<this.length){let m=c.cca(this.input,l+1);_=(m??-1)==42}else _=!1;if(_){for(l+=2;;){if(l>=this.length)return-1;let m=c.cca(this.input,l);if((m??-1)==10)return-1;let f,g;if(l+1<this.length){let d=c.cca(this.input,l);g=(d??-1)==42}else g=!1;if(g){let d=c.cca(this.input,l+1);f=(d??-1)==47}else f=!1;if(f){l+=2;break}++l}continue}if(u==34){if(l=this.scanStringEnd(l,t),l==-1)return-1;continue}u==123?++h:u==125&&--h,++l}if(h!=0)return-1;continue}if(a==36){l+=2;continue}if(a>=97&&a<=122||a>=65&&a<=90||a==95){for(++l;;){let h;if(l<this.length){let o=c.cca(this.input,l),u=o??-1;h=u>=97&&u<=122||u>=65&&u<=90||u==95||u>=48&&u<=57}else h=!1;if(!h)break;++l}if(l=this.scanAccessorChain(l,t),l==-1)return-1;continue}}++l}return-1}scanAccessorChain(e,t){for(;e<this.length;){let l=c.cca(this.input,e),i=l??-1,n;if(i==46&&e+1<this.length){let s=c.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=c.cca(this.input,e),a=r??-1;s=a>=97&&a<=122||a>=65&&a<=90||a==95||a>=48&&a<=57}else s=!1;if(!s)break;++e}else if(i==91||i==40){let s=i==91?93:41;++e;let r=1;for(;e<this.length&&r>0;){let a=c.cca(this.input,e),h=a??-1;if(h==92){e+=2;continue}if(h==10)return-1;let o;if(h==47&&e+1<this.length){let p=c.cca(this.input,e+1);o=(p??-1)==47}else o=!1;if(o)return-1;let u;if(h==47&&e+1<this.length){let p=c.cca(this.input,e+1);u=(p??-1)==42}else u=!1;if(u){for(e+=2;;){if(e>=this.length)return-1;let p=c.cca(this.input,e);if((p??-1)==10)return-1;let _,m;if(e+1<this.length){let f=c.cca(this.input,e);m=(f??-1)==42}else m=!1;if(m){let f=c.cca(this.input,e+1);_=(f??-1)==47}else _=!1;if(_){e+=2;break}++e}continue}if(h==34){if(e=this.scanStringEnd(e,t),e==-1)return-1;continue}h==i?++r:h==s&&--r,++e}if(r!=0)return-1}else break}return e}tryReadUnquotedString(){if(this.isStrict())return null;let e=c.cca(this.input,this.pos),t=e??-1,l;if(this.pos+1<this.length){let L=c.cca(this.input,this.pos+1);l=L??-1}else l=0;if(t==47&&this.pos<this.length-1){let L=c.cca(this.input,this.pos+1),I=L??-1;if(I==47||I==42)return null}if(t==123||t==125||t==91||t==93||t==58||t==35||t==32||t==9)return null;let i=this.parentBlockType();if(i!=k.KwBeat&&i!=k.KwState&&i!=k.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 a=r!=-1?this.isStartingMultilineDialogue(r):-1,h=r!=-1,o=i==k.KwState||i==k.KwCharacter||n||s,u=this.matchIdentifier(this.pos);if(o){if(this.isCallStart(this.pos)||this.isLabelStart(this.pos))return null}else if(!h&&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||l==61&&(t==43||t==45||t==42||t==47))||!o&&!h&&(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(kt.KEYWORDS.h,u)||this.isColon(this.pos+u.length))))return null;let p=!o,_=!1;if(o){if(n){if(!h&&!this.followsOnlyWhitespacesOrCommentsInLine()&&!this.isAfterComma()&&!this.isAfterLBracket())return null}else if(!s&&!h)return null}else if(_=this.followsOnlyLabelOrCommentsInLine(),!_&&!this.followsOnlyWhitespacesOrCommentsInLine()&&!this.followsChoiceOncePrefix()||!_&&l==62&&t==45)return null;if(t==34){let L=this.scanStringEnd(this.pos,i==k.KwBeat);if(L==-1)return null;let I=!1,q=L;for(;q<this.length;){let z=c.cca(this.input,q),P=z??-1;if(P==32||P==9){++q;continue}if(P==10||P==13)break;let B;if(P==47&&q+1<this.length){let N=c.cca(this.input,q+1);if((N??-1)!=47){let D=c.cca(this.input,q+1);B=(D??-1)==42}else B=!0}else B=!1;if(B||P==93||P==125||P==41||P==44||P==35)break;I=!0;break}if(!I&&!o){let z=!0;z==null&&(z=!1);let P=this._skipWhitespaceAndComments(q,z);if(P<=q||P>=this.length)return null;let B=c.cca(this.input,P),N=B??-1,D;if(N==10||N==13||N==34)D=!0;else if(N==47&&P+1<this.length){let X=c.cca(this.input,P+1);if((X??-1)!=47){let ae=c.cca(this.input,P+1);D=(ae??-1)==42}else D=!0}else D=!1;if(D)return null;let U=0,W=P;for(;;){let X;if(W>0){let ae=c.cca(this.input,W-1);if((ae??-1)!=32){let ce=c.cca(this.input,W-1);X=(ce??-1)==9}else X=!0}else X=!1;if(!X)break;++U,--W}let J=a!=-1?a:this.column-1;if(U!=J)return null;let H;if(N==45&&P+1<this.length){let X=c.cca(this.input,P+1);H=(X??-1)==62}else H=!1;if(H||N==43||this.isAssignStart(P,!1)||this.isCallStart(P)||this.isLabelStart(P)||this.isIfStart(P)||this.isIdentifierExpressionStart(P,!0))return null;if(N>=97&&N<=122||N>=65&&N<=90||N==95){let X=P;for(;;){let re;if(X<this.length){let xe=c.cca(this.input,X),Pe=xe??-1;re=Pe>=97&&Pe<=122||Pe>=65&&Pe<=90||Pe==95||Pe>=48&&Pe<=57}else re=!1;if(!re)break;++X}let ae=this.input,ce=X-P,ne=ce!=null?c.substr(ae,P,ce):c.substr(ae,P,null);if(ne!="null"&&ne!="true"&&ne!="false"&&Object.prototype.hasOwnProperty.call(kt.KEYWORDS.h,ne))return null}}else if(!I)return null}let m=new ue(this.startLine,this.startColumn,this.pos),f="",g=[],d=this.line,w=this.column,y=this.pos,S=!1,T=-1,O=!1,E=this.column,v=this.line,M=!0,A=!1;for(;this.pos<this.length;){let L=c.cca(this.input,this.pos),I=L??-1,q=I==32||I==9;if(A||!q&&T==-1&&(I!=60||!p)&&(A=!0),S){f+=String.fromCodePoint(92),f+=String.fromCodePoint(I),S=!1;let z=0,P=1;for(;z<P;){let B=z++;if(this.pos>=this.length)break;let N=c.cca(this.input,this.pos);(N??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}E+=2}else if(I==92){S=!0;let z=0,P=1;for(;z<P;){let B=z++;if(this.pos>=this.length)break;let N=c.cca(this.input,this.pos);(N??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else if(T==-1&&q&&!A&&g.length==0){let z=0,P=1;for(;z<P;){let B=z++;if(this.pos>=this.length)break;let N=c.cca(this.input,this.pos);(N??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else{if(T==-1&&I==123)break;{let z;if(T==-1)if(I==10||I==13)z=!0;else if(I==47&&this.pos<this.length-1){let P=c.cca(this.input,this.pos+1);z=(P??-1)==47}else z=!1;else z=!1;if(z)if(a!=-1)if(this.isContinuingMultilineText(this.pos,a)){f+=String.fromCodePoint(I);let P=0,B=1;for(;P<B;){let D=P++;if(this.pos>=this.length)break;let U=c.cca(this.input,this.pos);(U??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let N;if(I==13){let D=c.cca(this.input,this.pos);N=(D??-1)==10}else N=!1;if(N){f+=String.fromCodePoint(10);let D=0,U=1;for(;D<U;){let W=D++;if(this.pos>=this.length)break;let J=c.cca(this.input,this.pos);(J??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}E=this.column,v=this.line}else break;else break;else{let P;if(T==-1)if(I==47&&this.pos<this.length-1){let B=c.cca(this.input,this.pos+1);P=(B??-1)==42}else P=!1;else P=!1;if(P){f+=String.fromCodePoint(47),f+=String.fromCodePoint(42);let B=2;B==null&&(B=1);let N=0,D=B;for(;N<D;){let W=N++;if(this.pos>=this.length)break;let J=c.cca(this.input,this.pos);(J??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let U=!1;for(;this.pos<this.length;){let W,J=c.cca(this.input,this.pos);if((J??-1)==42&&this.pos+1<this.length){let ne=c.cca(this.input,this.pos+1);W=(ne??-1)==47}else W=!1;if(W){f+=String.fromCodePoint(42),f+=String.fromCodePoint(47);let ne=2;ne==null&&(ne=1);let re=0,xe=ne;for(;re<xe;){let Pe=re++;if(this.pos>=this.length)break;let Ue=c.cca(this.input,this.pos);(Ue??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}U=!0;break}let H=c.cca(this.input,this.pos),X=H??-1;f+=String.fromCodePoint(X);let ae=0,ce=1;for(;ae<ce;){let ne=ae++;if(this.pos>=this.length)break;let re=c.cca(this.input,this.pos);(re??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}E=this.column,v=this.line,U||this.error("Unterminated multiline comment",!1)}else{if(T==-1&&!o&&this.isIfStart(this.pos))break;{let B;if(T==-1&&I==45&&this.pos<this.length-1){let N=c.cca(this.input,this.pos+1);B=(N??-1)==62}else B=!1;if(B&&this.isTransitionStart(this.pos))break;if(T==-1&&o&&(I==44||I==93||I==125))break;if(p&&I==60){T!=-1&&this.error("Unexpected < inside tag",!0);let N;if(this.pos+1<this.length){let J=c.cca(this.input,this.pos+1);N=J??-1}else N=0;O=N==47;let D=this.pos+(O?2:1);if(D<this.length){let J=c.cca(this.input,D),H=J??-1;(H>=97&&H<=122||H>=65&&H<=90||H==95||H==95||H==36||O&&H==62)&&(T=f.length)}f+=String.fromCodePoint(I);let U=0,W=1;for(;U<W;){let J=U++;if(this.pos>=this.length)break;let H=c.cca(this.input,this.pos);(H??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++E}else if(p&&I==62){f+=String.fromCodePoint(I);let N=0,D=1;for(;N<D;){let U=N++;if(this.pos>=this.length)break;let W=c.cca(this.input,this.pos);(W??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++E,T!=-1&&(g.push(Ll.Tag(O,T,f.length-T)),T=-1)}else if(T==-1&&I==35&&!S){let N;if(this.pos+1<this.length){let D=c.cca(this.input,this.pos+1);N=D??-1}else N=0;if(N==35){f+=String.fromCodePoint(35),f+=String.fromCodePoint(35);let D=0,U=1;for(;D<U;){let H=D++;if(this.pos>=this.length)break;let X=c.cca(this.input,this.pos);(X??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let W=0,J=1;for(;W<J;){let H=W++;if(this.pos>=this.length)break;let X=c.cca(this.input,this.pos);(X??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}E+=2}else{if(N>=97&&N<=122||N>=65&&N<=90||N==95||N>=48&&N<=57||N==45)break;{f+=String.fromCodePoint(I);let D=0,U=1;for(;D<U;){let W=D++;if(this.pos>=this.length)break;let J=c.cca(this.input,this.pos);(J??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++E}}}else if(I==36&&!S){let N=f.length,D=v,U=E,W=this.pos;try{let J=0,H=1;for(;J<H;){let ae=J++;if(this.pos>=this.length)break;let ce=c.cca(this.input,this.pos);(ce??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++E;let X=c.cca(this.input,this.pos);if((X??-1)==123){let ae=0,ce=1;for(;ae<ce;){let Ue=ae++;if(this.pos>=this.length)break;let Je=c.cca(this.input,this.pos);(Je??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++E;let ne=new ue(D,U+2,this.pos),re=this.readComplexInterpolation(ne),xe=this.pos-W;g.push(Ll.Interpolation(!0,T!=-1,re,N,xe));let Pe=this.input;f+=Y.string(xe!=null?c.substr(Pe,W,xe):c.substr(Pe,W,null))}else{let ae=c.cca(this.input,this.pos),ce=ae??-1;if(ce>=97&&ce<=122||ce>=65&&ce<=90||ce==95){let ne=new ue(D,U+1,this.pos),re=this.readFieldAccessInterpolation(ne),xe=this.pos-W;g.push(Ll.Interpolation(!1,T!=-1,re,N,xe));let Pe=this.input;f+=Y.string(xe!=null?c.substr(Pe,W,xe):c.substr(Pe,W,null))}else{let ne=c.cca(this.input,this.pos);if((ne??-1)==36){f+=String.fromCodePoint(36),f+=String.fromCodePoint(36);let re=0,xe=1;for(;re<xe;){let Pe=re++;if(this.pos>=this.length)break;let Ue=c.cca(this.input,this.pos);(Ue??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++E}else{this.error("Expected identifier or { after $",!1);let re=this.pos-W;g.push(Ll.Interpolation(!1,T!=-1,[],N,re));let xe=this.input;f+=Y.string(re!=null?c.substr(xe,W,re):c.substr(xe,W,null))}}}}catch(J){let H=C.caught(J).unwrap();if(H instanceof ui){let X=H;throw X.pos==null&&(X.pos=new ue(D,U,this.pos)),C.thrown(X)}else throw J}E=U+(this.pos-W)}else{I==10?(++v,E=1):++E,f+=String.fromCodePoint(I);let N=0,D=1;for(;N<D;){let U=N++;if(this.pos>=this.length)break;let W=c.cca(this.input,this.pos);(W??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}}}}}}if(M){let L=f,I=L.length;L=He.rtrim(L);let q=L.length,z=I-q;if(q>0&&this.hasNonSpecialChar(L)&&(!o||!this.isNumber(L)&&L!="null"&&L!="true"&&L!="false")){if(a==-1&&!h&&!this.inChoiceRoot()){let U=this.line,W=this.column,J=this.pos,H=!0;H==null&&(H=!1);let X=H;X==null&&(X=!1);let ae=this._skipWhitespaceAndComments(this.pos,X);for(;this.pos<ae;){let ne=0,re=1;for(;ne<re;){let xe=ne++;if(this.pos>=this.length)break;let Pe=c.cca(this.input,this.pos);(Pe??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let ce=this.pos;if(this.column==w){let ne=this.tryReadUnquotedString();if(ne!=null){let re=this.input,xe=J-z,Pe=ce!=null?re.substring(xe,ce):re.substring(xe),Ue=ne.type;if(Ue._hx_index==15){let lt=Ue.quotes,Ve=Ue.s,Qe=Ue.attachments;if(Qe!=null){let at=0;for(;at<Qe.length;){let Re=Qe[at];switch(++at,Re._hx_index){case 0:let $=Re.braces,se=Re.inTag,j=Re.expr,ie=Re.start,le=Re.length;g.push(Ll.Interpolation($,se,j,ie+ce-y,le));break;case 1:let ee=Re.closing,pe=Re.start,me=Re.length;g.push(Ll.Tag(ee,pe+ce-y,me));break}}}L+=Pe,L+=Ve}z=0;let Je=this.pos-1;for(;;){let lt;if(Je>=0){let Ve=c.cca(this.input,Je);if((Ve??-1)!=32){let Qe=c.cca(this.input,Je);lt=(Qe??-1)==9}else lt=!0}else lt=!1;if(!lt)break;++z,--Je}}else this.line=U,this.column=W,this.pos=J}else this.line=U,this.column=W,this.pos=J}g.sort(function(U,W){return kt.compareAttachments(U,W)});let P=g.length>0?g:null,B=m;B==null&&(B=new ue(this.startLine,this.startColumn,this.pos)),B.length=this.pos-B.offset;let N=new ye(k.LString(0,L,P),B);this.previous=N;let D=N;return D.pos.length-=z,D}}return this.line=d,this.column=w,this.pos=y,null}readString(e){let t=0,l=1;for(;t<l;){let p=t++;if(this.pos>=this.length)break;let _=c.cca(this.input,this.pos);(_??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let i="",n=[],s=!1,r=-1,a=!1,h=e.column+1,o=e.line,u=this.parentBlockType()==k.KwBeat;for(;this.pos<this.length;){let p=c.cca(this.input,this.pos),_=p??-1;if(s){i+=String.fromCodePoint(92),i+=String.fromCodePoint(_),s=!1;let m=0,f=1;for(;m<f;){let g=m++;if(this.pos>=this.length)break;let d=c.cca(this.input,this.pos);(d??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}h+=2}else if(_==92){s=!0;let m=0,f=1;for(;m<f;){let g=m++;if(this.pos>=this.length)break;let d=c.cca(this.input,this.pos);(d??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else if(_==34&&r==-1){let m=0,f=1;for(;m<f;){let y=m++;if(this.pos>=this.length)break;let S=c.cca(this.input,this.pos);(S??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}n.sort(function(y,S){return kt.compareAttachments(y,S)});let g=n.length>0?n:null,d=e;d==null&&(d=new ue(this.startLine,this.startColumn,this.pos)),d.length=this.pos-d.offset;let w=new ye(k.LString(1,i,g),d);return this.previous=w,w}else if(u&&_==60){r!=-1&&this.error("Unexpected < inside tag",!0);let m;if(this.pos+1<this.length){let w=c.cca(this.input,this.pos+1);m=w??-1}else m=0;a=m==47;let f=this.pos+(a?2:1);if(f<this.length){let w=c.cca(this.input,f),y=w??-1;(y>=97&&y<=122||y>=65&&y<=90||y==95||y==95||y==36||a&&y==62)&&(r=i.length)}i+=String.fromCodePoint(_);let g=0,d=1;for(;g<d;){let w=g++;if(this.pos>=this.length)break;let y=c.cca(this.input,this.pos);(y??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++h}else if(_==62){i+=String.fromCodePoint(_);let m=0,f=1;for(;m<f;){let g=m++;if(this.pos>=this.length)break;let d=c.cca(this.input,this.pos);(d??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++h,r!=-1&&(n.push(Ll.Tag(a,r,i.length-r)),r=-1)}else if(_==36&&!s){let m=i.length,f=o,g=h,d=this.pos;try{let w=0,y=1;for(;w<y;){let T=w++;if(this.pos>=this.length)break;let O=c.cca(this.input,this.pos);(O??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++h;let S=c.cca(this.input,this.pos);if((S??-1)==123){let T=0,O=1;for(;T<O;){let L=T++;if(this.pos>=this.length)break;let I=c.cca(this.input,this.pos);(I??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++h;let E=new ue(f,g+2,this.pos),v=this.readComplexInterpolation(E),M=this.pos-d;n.push(Ll.Interpolation(!0,r!=-1,v,m,M));let A=this.input;i+=Y.string(M!=null?c.substr(A,d,M):c.substr(A,d,null))}else{let T=c.cca(this.input,this.pos),O=T??-1;if(O>=97&&O<=122||O>=65&&O<=90||O==95){let E=new ue(f,g+1,this.pos),v=this.readFieldAccessInterpolation(E),M=this.pos-d;n.push(Ll.Interpolation(!1,r!=-1,v,m,M));let A=this.input;i+=Y.string(M!=null?c.substr(A,d,M):c.substr(A,d,null))}else{let E=c.cca(this.input,this.pos);if((E??-1)==36){i+=String.fromCodePoint(36),i+=String.fromCodePoint(36);let v=0,M=1;for(;v<M;){let A=v++;if(this.pos>=this.length)break;let L=c.cca(this.input,this.pos);(L??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++h}else{this.error("Expected identifier or { after $",!1);let v=this.pos-d;n.push(Ll.Interpolation(!1,r!=-1,[],m,v));let M=this.input;i+=Y.string(v!=null?c.substr(M,d,v):c.substr(M,d,null))}}}}catch(w){let y=C.caught(w).unwrap();if(y instanceof ui){let S=y;throw S.pos==null&&(S.pos=new ue(f,g,this.pos)),C.thrown(S)}else throw w}h=g+(this.pos-d)}else{_==10?(++o,h=1):++h,i+=String.fromCodePoint(_);let m=0,f=1;for(;m<f;){let g=m++;if(this.pos>=this.length)break;let d=c.cca(this.input,this.pos);(d??-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=[],l=1,i=e.column,n=e.line;for(;this.pos<this.length&&l>0;){let s=c.cca(this.input,this.pos);if((s??-1)==34){let a=new ue(n,i,this.pos);t.push(this.readString(a)),i+=this.pos-a.offset;continue}let r=this.nextToken();if(t.push(r),r.type==k.LineBreak)++n,i=1;else if(!(r.type==k.Indent||r.type==k.Unindent)){let a,h=r.type;switch(h._hx_index){case 15:let o=h.attachments,u=h.quotes;a=h.s.length+(u!=0?2:0);break;case 16:let _=h.n;a=(_==null?"null":""+_).length;break;case 19:a=h.name.length;break;default:a=1}i+=a}switch(r.type._hx_index){case 45:++l;break;case 46:--l;break;default:}r.type==k.Eof&&this.error("Unterminated interpolation expression",!0)}return t.pop(),this.strictExprs.pop(),t}nextTokenWithPosition(e){let t=this.line,l=this.column,i=this.pos,n=this.nextToken(),s=n.pos.length,r=this.pos-i;return n.pos=new ue(e.line,e.column+r,e.offset+r,s),this.line=t,this.column=l,n}readFieldAccessInterpolation(e){this.strictExprs.push(1);let t=[],l=c.cca(this.input,this.pos),i=l??-1;i>=97&&i<=122||i>=65&&i<=90||i==95||this.error("Expected identifier in field access",!0);let n=this.pos;for(;this.pos<this.length;){let o=c.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 p=0,_=1;for(;p<_;){let m=p++;if(this.pos>=this.length)break;let f=c.cca(this.input,this.pos);(f??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let s=this.input,r=this.pos-n,a=r!=null?c.substr(s,n,r):c.substr(s,n,null),h=Object.prototype.hasOwnProperty.call(kt.KEYWORDS.h,a)?kt.KEYWORDS.h[a]:k.Identifier(a);t.push(new ye(h,new ue(e.line,e.column,n,this.pos-n)));e:for(;this.pos<this.length;){let o=c.cca(this.input,this.pos);switch(o??-1){case 40:t.push(new ye(k.LParen,new ue(this.line,this.column,this.pos,1)));let u=0,p=1;for(;u<p;){let w=u++;if(this.pos>=this.length)break;let y=c.cca(this.input,this.pos);(y??-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 w=c.cca(this.input,this.pos);if((w??-1)==41){if(--_,_==0){t.push(new ye(k.RParen,new ue(this.line,this.column,this.pos,1)));let S=0,T=1;for(;S<T;){let O=S++;if(this.pos>=this.length)break;let E=c.cca(this.input,this.pos);(E??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.stack.pop(),this.strictExprs.pop();break}}else{let S=c.cca(this.input,this.pos);(S??-1)==40&&++_}let y=c.cca(this.input,this.pos);if((y??-1)==44){t.push(new ye(k.Comma,new ue(this.line,this.column,this.pos,1)));let S=0,T=1;for(;S<T;){let O=S++;if(this.pos>=this.length)break;let E=c.cca(this.input,this.pos);(E??-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 m;if(this.pos+1<this.length){let w=c.cca(this.input,this.pos+1),y=w??-1;m=y>=97&&y<=122||y>=65&&y<=90||y==95}else m=!1;if(m){t.push(new ye(k.Dot,new ue(this.line,this.column,this.pos,1)));let w=0,y=1;for(;w<y;){let M=w++;if(this.pos>=this.length)break;let A=c.cca(this.input,this.pos);(A??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let S=this.pos;for(;this.pos<this.length;){let M=c.cca(this.input,this.pos),A=M??-1;if(!(A>=97&&A<=122||A>=65&&A<=90||A==95||A>=48&&A<=57))break;let L=0,I=1;for(;L<I;){let q=L++;if(this.pos>=this.length)break;let z=c.cca(this.input,this.pos);(z??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let T=this.input,O=this.pos-S,E=O!=null?c.substr(T,S,O):c.substr(T,S,null),v=Object.prototype.hasOwnProperty.call(kt.KEYWORDS.h,E)?kt.KEYWORDS.h[E]:k.Identifier(E);t.push(new ye(v,new ue(this.line,this.column-(this.pos-S),S)))}else break e;break;case 91:t.push(new ye(k.LBracket,new ue(this.line,this.column,this.pos,1)));let f=0,g=1;for(;f<g;){let w=f++;if(this.pos>=this.length)break;let y=c.cca(this.input,this.pos);(y??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.stack.push(12),this.strictExprs.push(1);let d=1;for(;this.pos<this.length&&d>0;){let w=c.cca(this.input,this.pos);if((w??-1)==93){if(--d,d==0){t.push(new ye(k.RBracket,new ue(this.line,this.column,this.pos,1)));let y=0,S=1;for(;y<S;){let T=y++;if(this.pos>=this.length)break;let O=c.cca(this.input,this.pos);(O??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.stack.pop(),this.strictExprs.pop();break}}else{let y=c.cca(this.input,this.pos);(y??-1)==91&&++d}t.push(this.nextToken())}d>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),l=this.pos;for(;this.pos<this.length;){let a=c.cca(this.input,this.pos),h=a??-1;if(!(h>=97&&h<=122||h>=65&&h<=90||h==95||h>=48&&h<=57))break;let o=0,u=1;for(;o<u;){let p=o++;if(this.pos>=this.length)break;let _=c.cca(this.input,this.pos);(_??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let i=this.input,n=this.pos-l,s=n!=null?c.substr(i,l,n):c.substr(i,l,null),r=Object.prototype.hasOwnProperty.call(kt.KEYWORDS.h,s)?kt.KEYWORDS.h[s]:k.Identifier(s);return new ye(r,t)}makePositionRelativeTo(e){let t=e.line,l=e.column,i=e.offset;for(;i<this.pos;){let n=c.cca(this.input,i);(n??-1)==10?(++t,l=1):++l,++i}return new ue(t,l,this.pos,e.length)}readLineComment(){let e=new ue(this.startLine,this.startColumn,this.pos),t=2;t==null&&(t=1);let l=0,i=t;for(;l<i;){let u=l++;if(this.pos>=this.length)break;let p=c.cca(this.input,this.pos);(p??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let n=this.pos;for(;this.pos<this.length;){let u=c.cca(this.input,this.pos),p=u??-1;if(p==10||p==13)break;let _=0,m=1;for(;_<m;){let f=_++;if(this.pos>=this.length)break;let g=c.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,a=r!=null?c.substr(s,n,r):c.substr(s,n,null),h=e;h==null&&(h=new ue(this.startLine,this.startColumn,this.pos)),h.length=this.pos-h.offset;let o=new ye(k.CommentLine(a),h);return this.previous=o,o}readMultiLineComment(){let e=new ue(this.startLine,this.startColumn,this.pos),t=2;t==null&&(t=1);let l=0,i=t;for(;l<i;){let r=l++;if(this.pos>=this.length)break;let a=c.cca(this.input,this.pos);(a??-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,a=c.cca(this.input,this.pos);if((a??-1)==42){let h;if(this.pos+1<this.length){let o=c.cca(this.input,this.pos+1);h=o??-1}else h=0;r=h==47}else r=!1;if(r){if(--s,s==0){let p=this.input,_=this.pos-n,m=_!=null?c.substr(p,n,_):c.substr(p,n,null),f=2;f==null&&(f=1);let g=0,d=f;for(;g<d;){let S=g++;if(this.pos>=this.length)break;let T=c.cca(this.input,this.pos);(T??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let w=e;w==null&&(w=new ue(this.startLine,this.startColumn,this.pos)),w.length=this.pos-w.offset;let y=new ye(k.CommentMultiLine(m),w);return this.previous=y,y}let h=2;h==null&&(h=1);let o=0,u=h;for(;o<u;){let p=o++;if(this.pos>=this.length)break;let _=c.cca(this.input,this.pos);(_??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else{let h,o=c.cca(this.input,this.pos);if((o??-1)==47){let u;if(this.pos+1<this.length){let p=c.cca(this.input,this.pos+1);u=p??-1}else u=0;h=u==42}else h=!1;if(h){++s;let u=2;u==null&&(u=1);let p=0,_=u;for(;p<_;){let m=p++;if(this.pos>=this.length)break;let f=c.cca(this.input,this.pos);(f??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else{let u=0,p=1;for(;u<p;){let _=u++;if(this.pos>=this.length)break;let m=c.cca(this.input,this.pos);(m??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}}return this.error("Unterminated multi-line comment",!0),null}readHashComment(){let e=new ue(this.startLine,this.startColumn,this.pos),t=0,l=1;for(;t<l;){let o=t++;if(this.pos>=this.length)break;let u=c.cca(this.input,this.pos);(u??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let i=this.pos;for(;this.pos<this.length;){let o=c.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 p=0,_=1;for(;p<_;){let m=p++;if(this.pos>=this.length)break;let f=c.cca(this.input,this.pos);(f??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else break}let n=this.input,s=this.pos-i,r=s!=null?c.substr(n,i,s):c.substr(n,i,null),a=e;a==null&&(a=new ue(this.startLine,this.startColumn,this.pos)),a.length=this.pos-a.offset;let h=new ye(k.CommentHash(r),a);return this.previous=h,h}readNumber(){let e=new ue(this.startLine,this.startColumn,this.pos),t=this.pos;for(;;){let u;if(this.pos<this.length){let m=c.cca(this.input,this.pos),f=m??-1;u=f>=48&&f<=57}else u=!1;if(!u)break;let p=0,_=1;for(;p<_;){let m=p++;if(this.pos>=this.length)break;let f=c.cca(this.input,this.pos);(f??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let l,i;if(this.pos<this.length){let u=c.cca(this.input,this.pos);i=(u??-1)==46}else i=!1;if(i&&this.pos+1<this.length){let u=c.cca(this.input,this.pos+1),p=u??-1;l=p>=48&&p<=57}else l=!1;if(l){let u=0,p=1;for(;u<p;){let _=u++;if(this.pos>=this.length)break;let m=c.cca(this.input,this.pos);(m??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}for(;;){let _;if(this.pos<this.length){let g=c.cca(this.input,this.pos),d=g??-1;_=d>=48&&d<=57}else _=!1;if(!_)break;let m=0,f=1;for(;m<f;){let g=m++;if(this.pos>=this.length)break;let d=c.cca(this.input,this.pos);(d??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}let n=this.input,s=this.pos-t,r=k.LNumber(parseFloat(s!=null?c.substr(n,t,s):c.substr(n,t,null))),a=e;a==null&&(a=new ue(this.startLine,this.startColumn,this.pos)),a.length=this.pos-a.offset;let h=new ye(r,a);return this.previous=h,h}readIdentifier(){let e=new ue(this.startLine,this.startColumn,this.pos),t=this.pos;for(;this.pos<this.length;){let h=c.cca(this.input,this.pos),o=h??-1;if(!(o>=97&&o<=122||o>=65&&o<=90||o==95||o>=48&&o<=57))break;let u=0,p=1;for(;u<p;){let _=u++;if(this.pos>=this.length)break;let m=c.cca(this.input,this.pos);(m??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let l=this.input,i=this.pos-t,n=i!=null?c.substr(l,t,i):c.substr(l,t,null);if(n=="function")return this.readFunction(e);let s=Object.prototype.hasOwnProperty.call(kt.KEYWORDS.h,n)?kt.KEYWORDS.h[n]:k.Identifier(n);if(this.previous!=null&&this.previous.type==k.Dot&&s!=null)switch(s._hx_index){case 8:case 9:case 10:case 11:case 12:s=k.Identifier(n);break;default:}let r=e;r==null&&(r=new ue(this.startLine,this.startColumn,this.pos)),r.length=this.pos-r.offset;let a=new ye(s,r);return this.previous=a,a}readFunction(e){let t=!1;t==null&&(t=!1);let l=this._skipWhitespaceAndComments(this.pos,t);for(;this.pos<l;){let P=0,B=1;for(;P<B;){let N=P++;if(this.pos>=this.length)break;let D=c.cca(this.input,this.pos);(D??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let i=e.column,n=null,s=c.cca(this.input,this.pos),r=s??-1;if(r>=97&&r<=122||r>=65&&r<=90||r==95){let P=this.pos;for(;;){let D;if(this.pos<this.length){let J=c.cca(this.input,this.pos),H=J??-1;D=H>=97&&H<=122||H>=65&&H<=90||H==95||H>=48&&H<=57}else D=!1;if(!D)break;let U=0,W=1;for(;U<W;){let J=U++;if(this.pos>=this.length)break;let H=c.cca(this.input,this.pos);(H??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let B=this.input,N=this.pos-P;n=N!=null?c.substr(B,P,N):c.substr(B,P,null)}let a=!1;a==null&&(a=!1);let h=this._skipWhitespaceAndComments(this.pos,a);for(;this.pos<h;){let P=0,B=1;for(;P<B;){let N=P++;if(this.pos>=this.length)break;let D=c.cca(this.input,this.pos);(D??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let o;if(this.pos<this.length){let P=c.cca(this.input,this.pos);o=(P??-1)!=40}else o=!0;o&&this.error("Expected opening parenthesis after function name",!0);let u=0,p=[],_=0,m=1;for(;_<m;){let P=_++;if(this.pos>=this.length)break;let B=c.cca(this.input,this.pos);(B??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}u=1;let f=new gt;for(;this.pos<this.length&&u>0;){let P=c.cca(this.input,this.pos),B=P??-1;if(B==47){let N=this.pos,D=!1;D==null&&(D=!1);let U=this._skipWhitespaceAndComments(this.pos,D);for(;this.pos<U;){let W=0,J=1;for(;W<J;){let H=W++;if(this.pos>=this.length)break;let X=c.cca(this.input,this.pos);(X??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}if(this.pos==N){let W=0,J=1;for(;W<J;){let H=W++;if(this.pos>=this.length)break;let X=c.cca(this.input,this.pos);(X??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.error('Invalid character "/"',!1)}}else if(B==40){++u,f.b+=String.fromCodePoint(B);let N=0,D=1;for(;N<D;){let J=N++;if(this.pos>=this.length)break;let H=c.cca(this.input,this.pos);(H??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let U=!1;U==null&&(U=!1);let W=this._skipWhitespaceAndComments(this.pos,U);for(;this.pos<W;){let J=0,H=1;for(;J<H;){let X=J++;if(this.pos>=this.length)break;let ae=c.cca(this.input,this.pos);(ae??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}else if(B==41){if(--u,u>0)f.b+=String.fromCodePoint(B);else{let J=He.trim(f.b);J.length>0&&p.push(J)}let N=0,D=1;for(;N<D;){let J=N++;if(this.pos>=this.length)break;let H=c.cca(this.input,this.pos);(H??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let U=!1;U==null&&(U=!1);let W=this._skipWhitespaceAndComments(this.pos,U);for(;this.pos<W;){let J=0,H=1;for(;J<H;){let X=J++;if(this.pos>=this.length)break;let ae=c.cca(this.input,this.pos);(ae??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}else if(B==44&&u==1){let N=He.trim(f.b);N.length>0&&p.push(N),f=new gt;let D=0,U=1;for(;D<U;){let H=D++;if(this.pos>=this.length)break;let X=c.cca(this.input,this.pos);(X??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let W=!1;W==null&&(W=!1);let J=this._skipWhitespaceAndComments(this.pos,W);for(;this.pos<J;){let H=0,X=1;for(;H<X;){let ae=H++;if(this.pos>=this.length)break;let ce=c.cca(this.input,this.pos);(ce??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}else{f.b+=String.fromCodePoint(B);let N=0,D=1;for(;N<D;){let U=N++;if(this.pos>=this.length)break;let W=c.cca(this.input,this.pos);(W??-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 d=this._skipWhitespaceAndComments(this.pos,g);for(;this.pos<d;){let P=0,B=1;for(;P<B;){let N=P++;if(this.pos>=this.length)break;let D=c.cca(this.input,this.pos);(D??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let w;if(this.pos<this.length){let P=c.cca(this.input,this.pos);w=(P??-1)==123}else w=!1;let y=this.pos,S=this.line,T=this.column;if(w){let P=0,B=1;for(;P<B;){let D=P++;if(this.pos>=this.length)break;let U=c.cca(this.input,this.pos);(U??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let N=1;for(;this.pos<this.length&&N>0;){let D=c.cca(this.input,this.pos),U=D??-1;if(U==34){let H=0,X=1;for(;H<X;){let ae=H++;if(this.pos>=this.length)break;let ce=c.cca(this.input,this.pos);(ce??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.skipQuotedString();continue}U==123?++N:U==125&&--N;let W=0,J=1;for(;W<J;){let H=W++;if(this.pos>=this.length)break;let X=c.cca(this.input,this.pos);(X??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}N>0&&this.error("Unclosed braces in function body",!1)}else{let P=-1,B=!0;for(;this.pos<this.length;){let N=c.cca(this.input,this.pos),D=N??-1;if(D==10||D==13){y=this.pos,S=this.line,T=this.column;let J=0,H=1;for(;J<H;){let X=J++;if(this.pos>=this.length)break;let ae=c.cca(this.input,this.pos);(ae??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}B=!0;break}let U=0,W=1;for(;U<W;){let J=U++;if(this.pos>=this.length)break;let H=c.cca(this.input,this.pos);(H??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}for(;this.pos<this.length;){if(B){let J=0,H=this.pos;for(;this.pos<this.length;){let ce=c.cca(this.input,this.pos),ne=ce??-1;if(ne==32)++J;else if(ne==9)++J;else break;let re=0,xe=1;for(;re<xe;){let Pe=re++;if(this.pos>=this.length)break;let Ue=c.cca(this.input,this.pos);(Ue??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let X,ae;if(P==-1&&this.pos<this.length){let ce=c.cca(this.input,this.pos);ae=(ce??-1)!=10}else ae=!1;if(ae){let ce=c.cca(this.input,this.pos);X=(ce??-1)!=13}else X=!1;if(X){if(P=J,P<i){this.pos=H;break}}else{let ce;if(P!=-1&&J<P)if(this.pos<this.length){let ne=c.cca(this.input,this.pos);if((ne??-1)!=10){let re=c.cca(this.input,this.pos);ce=(re??-1)!=13}else ce=!1}else ce=!0;else ce=!1;if(ce){this.pos=H;break}}B=!1}let N=c.cca(this.input,this.pos),D=N??-1;if(D==34){this.skipQuotedString();continue}(D==10||D==13)&&(y=this.pos,S=this.line,T=this.column,B=!0);let U=0,W=1;for(;U<W;){let J=U++;if(this.pos>=this.length)break;let H=c.cca(this.input,this.pos);(H??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}this.pos=y,this.line=S,this.column=T;let O=this.pos,E=this.input,v=e.offset,M=O-e.offset,A=He.rtrim(M!=null?c.substr(E,v,M):c.substr(E,v,null)),L=A.indexOf(`
31
+ `,null)==-1;L||(A+=`
32
+ `);let I=e;I==null&&(I=new ue(this.startLine,this.startColumn,this.pos)),I.length=this.pos-I.offset;let q=new ye(k.Function(n,p,A,L),I);this.previous=q;let z=q;return z.pos.length=A.length,z}skipQuotedString(){let e=!1,t=0,l=1;for(;t<l;){let i=t++;if(this.pos>=this.length)break;let n=c.cca(this.input,this.pos);(n??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}for(;this.pos<this.length;){let i=c.cca(this.input,this.pos),n=i??-1;if(e){e=!1;let s=0,r=1;for(;s<r;){let a=s++;if(this.pos>=this.length)break;let h=c.cca(this.input,this.pos);(h??-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 a=s++;if(this.pos>=this.length)break;let h=c.cca(this.input,this.pos);(h??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else if(n==34){let s=0,r=1;for(;s<r;){let a=s++;if(this.pos>=this.length)break;let h=c.cca(this.input,this.pos);(h??-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 h=s++;if(this.pos>=this.length)break;let o=c.cca(this.input,this.pos);(o??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let a;if(this.pos<this.length){let h=c.cca(this.input,this.pos);a=(h??-1)==123}else a=!1;if(a){let h=0,o=1;for(;h<o;){let p=h++;if(this.pos>=this.length)break;let _=c.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 p=c.cca(this.input,this.pos),_=p??-1;if(_==34){this.skipQuotedString();continue}else _==123?++u:_==125&&--u;if(u>0||_!=125){let m=0,f=1;for(;m<f;){let g=m++;if(this.pos>=this.length)break;let d=c.cca(this.input,this.pos);(d??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else{let m=0,f=1;for(;m<f;){let g=m++;if(this.pos>=this.length)break;let d=c.cca(this.input,this.pos);(d??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}break}}}else{let h=c.cca(this.input,this.pos),o=h??-1;if(o>=97&&o<=122||o>=65&&o<=90||o==95)for(;;){let u;if(this.pos<this.length){let m=c.cca(this.input,this.pos),f=m??-1;u=f>=97&&f<=122||f>=65&&f<=90||f==95||f>=48&&f<=57}else u=!1;if(!u)break;let p=0,_=1;for(;p<_;){let m=p++;if(this.pos>=this.length)break;let f=c.cca(this.input,this.pos);(f??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}}else{let s=0,r=1;for(;s<r;){let a=s++;if(this.pos>=this.length)break;let h=c.cca(this.input,this.pos);(h??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}}makePosition(){return new ue(this.startLine,this.startColumn,this.pos)}makeToken(e,t){t==null&&(t=new ue(this.startLine,this.startColumn,this.pos)),t.length=this.pos-t.offset;let l=new ye(e,t);return this.previous=l,l}advance(e){e==null&&(e=1);let t=0,l=e;for(;t<l;){let i=t++;if(this.pos>=this.length)break;let n=c.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=c.cca(this.input,this.pos+e);return t??-1}else return 0}error(e,t){let l=new ui(e,new ue(this.startLine,this.startColumn,this.pos));if(this.errors==null&&(this.errors=[]),this.errors.push(l),t)throw C.thrown(l);return l}getErrors(){return this.errors==null&&(this.errors=[]),this.errors}skipWhitespace(){for(;this.pos<this.length;){let e=c.cca(this.input,this.pos);switch(e??-1){case 9:case 32:let t=0,l=1;for(;t<l;){let i=t++;if(this.pos>=this.length)break;let n=c.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 l;switch(e._hx_index){case 0:let n=e.braces,s=e.inTag,r=e.expr,a=e.length;l=e.start;break;case 1:let o=e.closing,u=e.length;l=e.start;break}let i;switch(t._hx_index){case 0:let n=t.braces,s=t.inTag,r=t.expr,a=t.length;i=t.start;break;case 1:let o=t.closing,u=t.length;i=t.start;break}return l-i}}Q["loreline.Lexer"]=kt,kt.__name__="loreline.Lexer",Object.assign(kt.prototype,{__class__:kt});class ml{static lastError(){return ml._lastError}static parse(e,t,l,i){ml._lastError=null;let n=new kt(e),s=n.tokenize(),r=n.getErrors();if(r!=null&&r.length>0)return ml._reportParseError(r[0],i);let a=null;if(t!=null&&l!=null)return new zi().resolve(t,s,l,function(p){ml._reportParseError(p,i)},function(p,_){if(ml._lastError!=null)return;let m=new Gl(s,new Fi(t,t,_,null));a=m.parse(),a.indentSize=n.detectedIndentSize;let f=m.getErrors();if(f!=null&&f.length>0){a=null,ml._reportParseError(f[0],i);return}i?.(a)}),a;let h=new Gl(s);a=h.parse(),a.indentSize=n.detectedIndentSize;let o=h.getErrors();return o!=null&&o.length>0?ml._reportParseError(o[0],i):(i?.(a),a)}static _reportParseError(e,t){if(ml._lastError=e,t!=null)return t(null),null;throw C.thrown(e)}static loadLocale(e,t,l,i,n){if(ml._lastError=null,l==null&&(l=t.filePath),l==null)throw C.thrown(new st("Cannot load locale: no filePath provided and script.filePath is null"));if(i==null)throw C.thrown(new st("Cannot load locale: handleFile is required"));let s=Cl.wrap(i,e);i=s.handler;let r=s.lastError,a=".lor",h,o,u;if(l==null)u=!1;else{let E=l.length;if(E<8)u=!1;else{let v,M,A,L,I,q,z=c.cca(l,E-8);if((z??-1)==46){let P=c.cca(l,E-7),B=P??-1;q=B==108||B==76}else q=!1;if(q){let P=c.cca(l,E-6),B=P??-1;I=B==111||B==79}else I=!1;if(I){let P=c.cca(l,E-5),B=P??-1;L=B==114||B==82}else L=!1;if(L){let P=c.cca(l,E-4);A=(P??-1)==46}else A=!1;if(A){let P=c.cca(l,E-3),B=P??-1;M=B==116||B==84}else M=!1;if(M){let P=c.cca(l,E-2),B=P??-1;v=B==120||B==88}else v=!1;if(v){let P=c.cca(l,E-1),B=P??-1;u=B==116||B==84}else u=!1}}if(u)o=!0;else if(l==null)o=!1;else{let E=l.length;if(E<4)o=!1;else{let v,M,A=c.cca(l,E-4);if((A??-1)==46){let L=c.cca(l,E-3),I=L??-1;M=I==108||I==76}else M=!1;if(M){let L=c.cca(l,E-2),I=L??-1;v=I==111||I==79}else v=!1;if(v){let L=c.cca(l,E-1),I=L??-1;o=I==114||I==82}else o=!1}}if(o)h=De.directory(l);else{let E=l.length,v;if(E>0){let M=c.cca(l,E-1);v=M??-1}else v=0;if(v==47||v==92){let M=E-1;h=M!=null?c.substr(l,0,M):c.substr(l,0,null)}else h=l}let p=t.filePath,_=[],m=[];if(p!=null){let E=De.withoutDirectory(p),v;if(E==null)v=null;else{let A;if(E==null)A=!1;else{let L=E.length;if(L<8)A=!1;else{let I,q,z,P,B,N,D=c.cca(E,L-8);if((D??-1)==46){let U=c.cca(E,L-7),W=U??-1;N=W==108||W==76}else N=!1;if(N){let U=c.cca(E,L-6),W=U??-1;B=W==111||W==79}else B=!1;if(B){let U=c.cca(E,L-5),W=U??-1;P=W==114||W==82}else P=!1;if(P){let U=c.cca(E,L-4);z=(U??-1)==46}else z=!1;if(z){let U=c.cca(E,L-3),W=U??-1;q=W==116||W==84}else q=!1;if(q){let U=c.cca(E,L-2),W=U??-1;I=W==120||W==88}else I=!1;if(I){let U=c.cca(E,L-1),W=U??-1;A=W==116||W==84}else A=!1}}if(A){let L=E.length-8;v=L!=null?c.substr(E,0,L):c.substr(E,0,null)}else{let L;if(E==null)L=!1;else{let I=E.length;if(I<4)L=!1;else{let q,z,P=c.cca(E,I-4);if((P??-1)==46){let B=c.cca(E,I-3),N=B??-1;z=N==108||N==76}else z=!1;if(z){let B=c.cca(E,I-2),N=B??-1;q=N==111||N==79}else q=!1;if(q){let B=c.cca(E,I-1),N=B??-1;L=N==114||N==82}else L=!1}}if(L){let I=E.length-4;v=I!=null?c.substr(E,0,I):c.substr(E,0,null)}else v=E}}let M=v+"."+e+a;_.push("."),m.push(De.normalize(De.join([h,M])))}if(p!=null){let E=new Ii(t),v=De.directory(p),M=E.getImportedPaths(p),A=0;for(;A<M.length;){let L=M[A];++A;let I=ml.relativePath(v,L),q;if(I==null)q=null;else{let N;if(I==null)N=!1;else{let D=I.length;if(D<8)N=!1;else{let U,W,J,H,X,ae,ce=c.cca(I,D-8);if((ce??-1)==46){let ne=c.cca(I,D-7),re=ne??-1;ae=re==108||re==76}else ae=!1;if(ae){let ne=c.cca(I,D-6),re=ne??-1;X=re==111||re==79}else X=!1;if(X){let ne=c.cca(I,D-5),re=ne??-1;H=re==114||re==82}else H=!1;if(H){let ne=c.cca(I,D-4);J=(ne??-1)==46}else J=!1;if(J){let ne=c.cca(I,D-3),re=ne??-1;W=re==116||re==84}else W=!1;if(W){let ne=c.cca(I,D-2),re=ne??-1;U=re==120||re==88}else U=!1;if(U){let ne=c.cca(I,D-1),re=ne??-1;N=re==116||re==84}else N=!1}}if(N){let D=I.length-8;q=D!=null?c.substr(I,0,D):c.substr(I,0,null)}else{let D;if(I==null)D=!1;else{let U=I.length;if(U<4)D=!1;else{let W,J,H=c.cca(I,U-4);if((H??-1)==46){let X=c.cca(I,U-3),ae=X??-1;J=ae==108||ae==76}else J=!1;if(J){let X=c.cca(I,U-2),ae=X??-1;W=ae==111||ae==79}else W=!1;if(W){let X=c.cca(I,U-1),ae=X??-1;D=ae==114||ae==82}else D=!1}}if(D){let U=I.length-4;q=U!=null?c.substr(I,0,U):c.substr(I,0,null)}else q=I}}let z=q+"."+e+a,P=De.normalize(I),B;if(P==null)B=null;else{let N;if(P==null)N=!1;else{let D=P.length;if(D<8)N=!1;else{let U,W,J,H,X,ae,ce=c.cca(P,D-8);if((ce??-1)==46){let ne=c.cca(P,D-7),re=ne??-1;ae=re==108||re==76}else ae=!1;if(ae){let ne=c.cca(P,D-6),re=ne??-1;X=re==111||re==79}else X=!1;if(X){let ne=c.cca(P,D-5),re=ne??-1;H=re==114||re==82}else H=!1;if(H){let ne=c.cca(P,D-4);J=(ne??-1)==46}else J=!1;if(J){let ne=c.cca(P,D-3),re=ne??-1;W=re==116||re==84}else W=!1;if(W){let ne=c.cca(P,D-2),re=ne??-1;U=re==120||re==88}else U=!1;if(U){let ne=c.cca(P,D-1),re=ne??-1;N=re==116||re==84}else N=!1}}if(N){let D=P.length-8;B=D!=null?c.substr(P,0,D):c.substr(P,0,null)}else{let D;if(P==null)D=!1;else{let U=P.length;if(U<4)D=!1;else{let W,J,H=c.cca(P,U-4);if((H??-1)==46){let X=c.cca(P,U-3),ae=X??-1;J=ae==108||ae==76}else J=!1;if(J){let X=c.cca(P,U-2),ae=X??-1;W=ae==111||ae==79}else W=!1;if(W){let X=c.cca(P,U-1),ae=X??-1;D=ae==114||ae==82}else D=!1}}if(D){let U=P.length-4;B=U!=null?c.substr(P,0,U):c.substr(P,0,null)}else B=P}}_.push(B),m.push(De.normalize(De.join([h,z])))}}let f=new Ee,g=_.length,d=!1,w=null,y=function(E,v){v(null)},S=function(){let E=w??r();if(E!=null){if(ml._lastError=E,n!=null){n(null);return}throw C.thrown(E)}n?.(f)},T=0,O=_.length;for(;T<O;){let E=T++,v=_[E],M=m[E];i(M,function(A){if(g-=1,A!=null)try{let L=ml.parse(A,M,y);if(L!=null){let q=et.extractTranslations(L).h,z=q,P=Object.keys(q),B=P.length,N=0;for(;N<B;){let D=P[N++],U=D,W=z[D],J=U,H=W;f.h[v+"#"+J]=H}}}catch(L){let I=C.caught(L).unwrap();if(I instanceof st){let q=I;w==null&&(w=new st('Failed to load translation file "'+M+'": '+q.message))}else{let q=I;w==null&&(w=new st('Failed to load translation file "'+M+'": '+(q==null?"null":Y.string(q))))}}g==0&&d&&S()})}return d=!0,g==0&&S(),ml._lastError!=null?null:f}static relativePath(e,t){let l=De.normalize(e),i=De.normalize(t),n=l.split("/"),s=i.split("/"),r=0;for(;r<n.length&&r<s.length&&n[r]==s[r];)++r;let a=n.length-r,h=[],o=0,u=a;for(;o<u;){let m=o++;h.push("..")}let p=r,_=s.length;for(;p<_;){let m=p++;h.push(s[m])}return h.length==0?".":h.join("/")}static play(e,t,l,i,n,s){let r=new Pi(e,t,l,i,s);return r.start(n),r}static resume(e,t,l,i,n,s,r){let a=new Pi(e,t,l,i,r);return a.restore(n),s!=null?a.start(s):a.resume(),a}static extractTranslations(e){return et.extractTranslations(e)}static translationFormat(e,t){Cl.translationFormat(e,t)}static generateTranslationFile(e,t,l,i){if(l==null||l=="lor")return et.generateTranslationFile(e,t,new Wl);if(i==null||i=="")throw C.thrown(new st("A locale is required when generating a translation file in format '"+l+"'"));if(l==null)throw C.thrown(new st("Unknown translation file format: '"+l+"'"));switch(l){case"csv":return Ut.fromScript(e,t,i);case"po":return bl.fromScript(e,t,i);case"tsv":return Ut.tsvFromScript(e,t,i);case"xliff":return vt.fromScript(e,t,i);default:throw C.thrown(new st("Unknown translation file format: '"+l+"'"))}}static insertLocalizationKeys(e,t,l,i){return l==null&&(l=!0),et.insertLocalizationKeys(e,t,l,i)}static collectHashIds(e,t){return et.collectHashIds(e,t)}static removeLocalizationKeys(e,t){return et.removeLocalizationKeys(e,t)}static extractTranslatableEntries(e){return et.extractTranslatableEntries(e)}static hasUntaggedTranslatableStrings(e){return et.hasUntaggedTranslatableStrings(e)}static print(e,t,l){let i=t,n=l;return new Wl(i??" ",n??`
33
+ `).print(e)}static update(e){Zl.update(e)}}Q["loreline.Loreline"]=Xl.loreline.Loreline=ml,ml.__name__="loreline.Loreline";class Ae{constructor(e,t,l,i){if(e<0||e>65535)throw C.thrown("Section value ("+e+") should be between 0 and 65535");if(t<0||t>65535)throw C.thrown("Branch value ("+t+") should be between 0 and 65535");if(l<0||l>65535)throw C.thrown("Block value ("+l+") should be between 0 and 65535");if(i<0||i>65535)throw C.thrown("Node value ("+i+") 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=l-32768,a=i-32768;r<0&&(r=r+65536&65535),a<0&&(a=a+65536&65535),this.thisVal=new jl(n<<16|s&65535,r<<16|a&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 jl(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 jl(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 jl(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 jl(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 C.thrown("Node id section overflow");return new Ae(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 l=this.thisVal.high>>16&65535;return new Ae((l>=32768?l-65536:l)+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 l=this.thisVal.high>>16&65535,i=this.thisVal.high&65535;return new Ae((l>=32768?l-65536:l)+32768,(i>=32768?i-65536:i)+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 l=this.thisVal.high>>16&65535,i=this.thisVal.high&65535,n=this.thisVal.low>>16&65535;return new Ae((l>=32768?l-65536:l)+32768,(i>=32768?i-65536:i)+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,l=this.thisVal.low>>16&65535,i=this.thisVal.low&65535;return""+((e>=32768?e-65536:e)+32768)+"."+((t>=32768?t-65536:t)+32768)+"."+((l>=32768?l-65536:l)+32768)+"."+((i>=32768?i-65536:i)+32768)}static fromInt64(e){let t=new Ae(32768,32768,32768,32768);return t.thisVal=e,t}static fromString(e){let t=e.split(".");return new Ae(Y.parseInt(t[0]),Y.parseInt(t[1]),Y.parseInt(t[2]),Y.parseInt(t[3]))}static fromTwoInt32(e,t){return Ae.fromInt64(new jl(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 l=e.thisVal,i=t.thisVal;return l.high==i.high?l.low==i.low:!1}}Q["loreline.NodeId"]=Ae,Ae.__name__="loreline.NodeId",Object.assign(Ae.prototype,{__class__:Ae,__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 li{constructor(){this.map=new El}get(e){let t=e.thisVal;return this.map._get(t.high,t.low)}set(e,t){let l=e.thisVal;this.map._set(l.high,l.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 $i(this.map)}keys(){return new Yi(this.map)}keyValueIterator(){return new Zi(this.map)}}Q["loreline.NodeIdMap"]=li,li.__name__="loreline.NodeIdMap",Object.assign(li.prototype,{__class__:li});class $i{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}}Q["loreline._Node.NodeIdMapIterator"]=$i,$i.__name__="loreline._Node.NodeIdMapIterator",Object.assign($i.prototype,{__class__:$i});class Yi{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 Ae.fromTwoInt32(e,t)}}Q["loreline._Node.NodeIdMapKeyIterator"]=Yi,Yi.__name__="loreline._Node.NodeIdMapKeyIterator",Object.assign(Yi.prototype,{__class__:Yi});class Zi{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],l=this.map._values[this.index];for(this.index++;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++;return{key:Ae.fromTwoInt32(e,t),value:l}}}Q["loreline._Node.NodeIdMapKeyValueIterator"]=Zi,Zi.__name__="loreline._Node.NodeIdMapKeyValueIterator",Object.assign(Zi.prototype,{__class__:Zi});class At{constructor(e,t){At._hx_skip_constructor||this._hx_constructor(e,t)}_hx_constructor(e,t){this.id=Ae.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 R.nodeFromJson(e)}}Q["loreline.Node"]=Xl.loreline.Node=At,At.__name__="loreline.Node",Object.assign(At.prototype,{__class__:At});class Ql extends At{constructor(e,t,l,i,n){n==null&&(n=!1),super(e,t),this.content=l,this.multiline=i,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}}Q["loreline.Comment"]=Ql,Ql.__name__="loreline.Comment",Ql.__super__=At,Object.assign(Ql.prototype,{__class__:Ql});class Be extends At{constructor(e,t,l,i){if(At._hx_skip_constructor){super();return}At._hx_skip_constructor=!0,super(),At._hx_skip_constructor=!1,this._hx_constructor(e,t,l,i)}_hx_constructor(e,t,l,i){super._hx_constructor(e,t),this.leadingComments=l,this.trailingComments=i}type(){return"AstNode"}eachComment(e){if(this.leadingComments!=null){let l=0,i=this.leadingComments;for(;l<i.length;){let n=i[l];++l,e(this,n)}}if(this.trailingComments!=null){let l=0,i=this.trailingComments;for(;l<i.length;){let n=i[l];++l,e(this,n)}}let t=this;this.each(function(l,i){if(l instanceof Be){let n=l;if(n.leadingComments!=null){let s=0,r=n.leadingComments;for(;s<r.length;){let a=r[s];++s,e(t,a)}}if(n.trailingComments!=null){let s=0,r=n.trailingComments;for(;s<r.length;){let a=r[s];++s,e(t,a)}}}})}each(e){if(super.each(e),this.leadingComments!=null){let t=0,l=this.leadingComments;for(;t<l.length;){let i=l[t];++t,e(i,this),i.each(e)}}if(this.trailingComments!=null){let t=0,l=this.trailingComments;for(;t<l.length;){let i=l[t];++t,e(i,this),i.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 l=[],i=0,n=this.leadingComments;for(;i<n.length;){let s=n[i];++i,l.push(s.toJson())}t.leading=l}if(this.trailingComments!=null&&this.trailingComments.length>0){let l=[],i=0,n=this.trailingComments;for(;i<n.length;){let s=n[i];++i,l.push(s.toJson())}t.trailing=l}e.comments=t}return e}}Q["loreline.AstNode"]=Be,Be.__name__="loreline.AstNode",Be.__super__=At,Object.assign(Be.prototype,{__class__:Be});class ct extends Be{constructor(e,t,l,i){super(e,t,l,i)}toJson(){return super.toJson()}type(){return"Expr"}}Q["loreline.NExpr"]=ct,ct.__name__="loreline.NExpr",ct.__super__=Be,Object.assign(ct.prototype,{__class__:ct});class $t extends Be{constructor(e,t,l,i,n,s){super(e,t,n,s),this.temporary=l,this.fields=i,this.style=0}type(){return"State"}get(e){let t=0,l=this.fields;for(;t<l.length;){let i=l[t];if(++t,i.name==e)return i.value}return null}each(e){if(super.each(e),this.fields!=null){let t=0,l=this.fields.length;for(;t<l;){let i=t++,n=this.fields[i];e(n,this),n.each(e)}}}toJson(){let e=super.toJson();e.temporary=this.temporary;let t=[],l=0,i=this.fields;for(;l<i.length;){let n=i[l];++l,t.push(n.toJson())}return e.fields=t,e.style=Vl.toString(this.style),e}}Q["loreline.NStateDecl"]=$t,$t.__name__="loreline.NStateDecl",$t.__super__=Be,Object.assign($t.prototype,{__class__:$t});class Ul extends Be{constructor(e,t,l,i,n,s){super(e,t,n,s),this.name=l,this.value=i}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}}Q["loreline.NObjectField"]=Ul,Ul.__name__="loreline.NObjectField",Ul.__super__=Be,Object.assign(Ul.prototype,{__class__:Ul});class jt extends Be{constructor(e,t,l,i,n,s,r){super(e,t,s,r),this.name=l,this.namePos=i,this.fields=n,this.style=0}type(){return"Character"}get(e){let t=0,l=this.fields;for(;t<l.length;){let i=l[t];if(++t,i.name==e)return i.value}return null}each(e){if(super.each(e),this.fields!=null){let t=0,l=this.fields.length;for(;t<l;){let i=t++,n=this.fields[i];e(n,this),n.each(e)}}}toJson(){let e=super.toJson();e.name=this.name,e.namePos=this.namePos.toJson();let t=[],l=0,i=this.fields;for(;l<i.length;){let n=i[l];++l,t.push(n.toJson())}return e.fields=t,e.style=Vl.toString(this.style),e}}Q["loreline.NCharacterDecl"]=jt,jt.__name__="loreline.NCharacterDecl",jt.__super__=Be,Object.assign(jt.prototype,{__class__:jt});class Me extends Be{constructor(e,t,l,i,n,s){super(e,t,n,s),this.name=l,this.body=i,this.style=0}type(){return"Beat"}each(e){if(super.each(e),this.body!=null){let t=0,l=this.body.length;for(;t<l;){let i=t++,n=this.body[i];e(n,this),n.each(e)}}}toJson(){let e=super.toJson();e.name=this.name;let t=[],l=0,i=this.body;for(;l<i.length;){let n=i[l];++l,t.push(n.toJson())}return e.body=t,e.style=Vl.toString(this.style),e}}Q["loreline.NBeatDecl"]=Me,Me.__name__="loreline.NBeatDecl",Me.__super__=Be,Object.assign(Me.prototype,{__class__:Me});var ze=Ye["loreline.StringPartType"]={__ename__:"loreline.StringPartType",__constructs__:null,Raw:(x=function(b){return{_hx_index:0,text:b,__enum__:"loreline.StringPartType",toString:F}},x._hx_name="Raw",x.__params__=["text"],x),Expr:(x=function(b){return{_hx_index:1,expr:b,__enum__:"loreline.StringPartType",toString:F}},x._hx_name="Expr",x.__params__=["expr"],x),Tag:(x=function(b,e){return{_hx_index:2,closing:b,expr:e,__enum__:"loreline.StringPartType",toString:F}},x._hx_name="Tag",x.__params__=["closing","expr"],x)};ze.__constructs__=[ze.Raw,ze.Expr,ze.Tag];class Vl{static toString(e){switch(e){case 0:return"Plain";case 1:return"Braces"}}}class Ni{static toString(e){switch(e){case 0:return"Plain";case 2:return"Parens"}}}class Mi{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 Ge extends ct{constructor(e,t,l,i,n){super(e,t,i,n),this.partType=l}type(){return"Part"}each(e){super.each(e);let t=this.partType;switch(t._hx_index){case 0:let l=t.text;break;case 1:let i=t.expr;e(i,this),i.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 l=t.text;e.part="Raw",e.text=l;break;case 1:let i=t.expr;e.part="Expr",e.expression=i.toJson();break;case 2:let n=t.closing,s=t.expr;e.part="Tag",e.closing=n,e.content=s.toJson();break}return e}}Q["loreline.NStringPart"]=Ge,Ge.__name__="loreline.NStringPart",Ge.__super__=ct,Object.assign(Ge.prototype,{__class__:Ge});class Mt extends ct{constructor(e,t,l,i,n,s){super(e,t,n,s),this.parts=i,this.quotes=l}type(){return"String"}each(e){if(super.each(e),this.parts!=null){let t=0,l=this.parts.length;for(;t<l;){let i=t++,n=this.parts[i];e(n,this),n.each(e)}}}toJson(){let e=super.toJson(),t=[],l=0,i=this.parts;for(;l<i.length;){let s=i[l];++l,t.push(s.toJson())}let n=t;return e.parts=n,e.quotes=fn.toString(this.quotes),e}}Q["loreline.NStringLiteral"]=Mt,Mt.__name__="loreline.NStringLiteral",Mt.__super__=ct,Object.assign(Mt.prototype,{__class__:Mt});class ll extends Be{constructor(e,t,l,i,n){super(e,t,i,n),this.content=l,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=Ni.toString(this.conditionStyle),e.conditionPos=this.conditionPos.toJson()),e}}Q["loreline.NTextStatement"]=ll,ll.__name__="loreline.NTextStatement",ll.__super__=Be,Object.assign(ll.prototype,{__class__:ll});class Kt extends Be{constructor(e,t,l,i,n,s,r){super(e,t,s,r),this.character=l,this.characterPos=i,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=Ni.toString(this.conditionStyle),e.conditionPos=this.conditionPos.toJson()),e}}Q["loreline.NDialogueStatement"]=Kt,Kt.__name__="loreline.NDialogueStatement",Kt.__super__=Be,Object.assign(Kt.prototype,{__class__:Kt});class xl extends Be{constructor(e,t,l,i,n){super(e,t,i,n),this.options=l,this.style=0}type(){return"Choice"}each(e){if(super.each(e),this.options!=null){let t=0,l=this.options.length;for(;t<l;){let i=t++,n=this.options[i];e(n,this),n.each(e)}}}toJson(){let e=super.toJson(),t=[],l=0,i=this.options;for(;l<i.length;){let n=i[l];++l,t.push(n.toJson())}return e.options=t,e.style=Vl.toString(this.style),e}}Q["loreline.NChoiceStatement"]=xl,xl.__name__="loreline.NChoiceStatement",xl.__super__=Be,Object.assign(xl.prototype,{__class__:xl});class St extends Be{constructor(e,t,l,i,n,s,r,a,h){super(e,t,a,h),this.text=l,this.insertion=i,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,l=this.body.length;for(;t<l;){let i=t++,n=this.body[i];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=Ni.toString(this.conditionStyle),e.conditionPos=this.conditionPos.toJson());let t=[],l=0,i=this.body;for(;l<i.length;){let n=i[l];++l,t.push(n.toJson())}return e.body=t,e.style=Vl.toString(this.style),this.once&&(e.once=!0),e}}Q["loreline.NChoiceOption"]=St,St.__name__="loreline.NChoiceOption",St.__super__=Be,Object.assign(St.prototype,{__class__:St});class hl extends Be{constructor(e,t,l,i,n){super(e,t,i,n),this.body=l,this.style=0}type(){return"Block"}each(e){if(super.each(e),this.body!=null){let t=0,l=this.body.length;for(;t<l;){let i=t++,n=this.body[i];e(n,this),n.each(e)}}}toJson(){let e=super.toJson(),t=[],l=0,i=this.body;for(;l<i.length;){let n=i[l];++l,t.push(n.toJson())}return e.body=t,e.style=Vl.toString(this.style),e}}Q["loreline.NBlock"]=hl,hl.__name__="loreline.NBlock",hl.__super__=Be,Object.assign(hl.prototype,{__class__:hl});class wl extends Be{constructor(e,t,l,i,n,s,r,a,h,o){super(e,t,r,a),this.condition=l,this.conditionStyle=i,this.thenBranch=n,this.elseBranch=s,this.elseLeadingComments=h,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,l=this.elseLeadingComments;for(;t<l.length;){let i=l[t];++t,e(i,this),i.each(e)}}if(this.elseTrailingComments!=null){let t=0,l=this.elseTrailingComments;for(;t<l.length;){let i=l[t];++t,e(i,this),i.each(e)}}}toJson(){let e=super.toJson();e.condition=this.condition.toJson(),e.conditionStyle=Ni.toString(this.conditionStyle);let t=[],l=0,i=this.thenBranch.body;for(;l<i.length;){let n=i[l];++l,t.push(n.toJson())}if(e.thenBranch=t,e.thenStyle=Vl.toString(this.thenBranch.style),this.elseBranch!=null){let n=[],s=0,r=this.elseBranch.body;for(;s<r.length;){let a=r[s];++s,n.push(a.toJson())}if(e.elseBranch=n,e.elseStyle=Vl.toString(this.elseBranch.style),this.elseLeadingComments!=null&&this.elseLeadingComments.length>0||this.elseTrailingComments!=null&&this.elseTrailingComments.length>0){let a=e.comments,h=a??{};if(this.elseLeadingComments!=null&&this.elseLeadingComments.length>0){let o=[],u=0,p=this.elseLeadingComments;for(;u<p.length;){let _=p[u];++u,o.push(_.toJson())}h.elseLeading=o}if(this.elseTrailingComments!=null&&this.elseTrailingComments.length>0){let o=[],u=0,p=this.elseTrailingComments;for(;u<p.length;){let _=p[u];++u,o.push(_.toJson())}h.elseTrailing=o}e.comments=h}}return e}}Q["loreline.NIfStatement"]=wl,wl.__name__="loreline.NIfStatement",wl.__super__=Be,Object.assign(wl.prototype,{__class__:wl});class Hl extends Be{constructor(e,t,l,i,n,s){super(e,t,n,s),this.mode=l,this.items=i,this.style=0}type(){return"Alternative"}each(e){if(super.each(e),this.items!=null){let t=0,l=this.items.length;for(;t<l;){let i=t++,n=this.items[i];e(n,this),n.each(e)}}if(this.separatorComments!=null){let t=0,l=this.separatorComments;for(;t<l.length;){let i=l[t];if(++t,i!=null){let n=0;for(;n<i.length;){let s=i[n];++n,e(s,this),s.each(e)}}}}}toJson(){let e=super.toJson();e.mode=Mi.toString(this.mode);let t=[],l=0,i=this.items;for(;l<i.length;){let n=i[l];++l,t.push(n.toJson())}if(e.items=t,e.style=Vl.toString(this.style),this.separatorComments!=null){let n=[],s=0,r=this.separatorComments;for(;s<r.length;){let a=r[s];++s;let h;if(a!=null){let o=[],u=0;for(;u<a.length;){let p=a[u];++u,o.push(p.toJson())}h=o}else h=null;n.push(h)}e.separatorComments=n}return e}}Q["loreline.NAlternative"]=Hl,Hl.__name__="loreline.NAlternative",Hl.__super__=Be,Object.assign(Hl.prototype,{__class__:Hl});class Jt extends ct{constructor(e,t,l,i,n,s){super(e,t,n,s),this.target=l,this.args=i}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,l=this.args;for(;t<l.length;){let i=l[t];++t,e(i,this),i.each(e)}}}toJson(){let e=super.toJson();e.target=this.target.toJson();let t=[],l=0,i=this.args;for(;l<i.length;){let n=i[l];++l,t.push(n.toJson())}return e.args=t,e}}Q["loreline.NCall"]=Jt,Jt.__name__="loreline.NCall",Jt.__super__=ct,Object.assign(Jt.prototype,{__class__:Jt});class Dl extends Be{constructor(e,t,l,i,n,s){super(e,t,n,s),this.target=l,this.targetPos=i}type(){return"Transition"}toJson(){let e=super.toJson();return e.target=this.target,e.targetPos=this.targetPos.toJson(),e}}Q["loreline.NTransition"]=Dl,Dl.__name__="loreline.NTransition",Dl.__super__=Be,Object.assign(Dl.prototype,{__class__:Dl});class $l extends Be{constructor(e,t,l,i,n,s){super(e,t,n,s),this.target=l,this.targetPos=i}type(){return"Insertion"}toJson(){let e=super.toJson();return e.target=this.target,e.targetPos=this.targetPos.toJson(),e}}Q["loreline.NInsertion"]=$l,$l.__name__="loreline.NInsertion",$l.__super__=Be,Object.assign($l.prototype,{__class__:$l});class ql extends ct{constructor(e,t,l,i,n,s,r,a){super(e,t,r,a),this.name=l,this.args=i,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}}Q["loreline.NFunctionDecl"]=ql,ql.__name__="loreline.NFunctionDecl",ql.__super__=ct,Object.assign(ql.prototype,{__class__:ql});class je extends ct{constructor(e,t,l,i,n,s){super(e,t,n,s),this.value=l,this.literalType=i}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 i=0,n=this.value;for(;i<n.length;){let s=n[i];if(++i,s instanceof At){let r=s;e(r,this),r.each(e)}}}break;case 4:let l=t.style;if(this.value!=null){let i=0,n=this.value;for(;i<n.length;){let s=n[i];if(++i,s.value instanceof At){let r=s.value;e(r,this),r.each(e)}}}break}}toJson(){let e=super.toJson(),t=this.literalType;e.literal=Ye[t.__enum__].__constructs__[t._hx_index]._hx_name;let l=this.literalType;switch(l._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 a=r[s];++s,a instanceof At?n.push(a.toJson()):n.push(a)}e.value=n}break;case 4:let i=l.style;if(this.value!=null){let n=[],s=0,r=this.value;for(;s<r.length;){let a=r[s];++s,n.push(a.toJson())}e.value=n}else e.value=[];e.style=Vl.toString(i);break}return e}}Q["loreline.NLiteral"]=je,je.__name__="loreline.NLiteral",je.__super__=ct,Object.assign(je.prototype,{__class__:je});var Ke=Ye["loreline.LiteralType"]={__ename__:"loreline.LiteralType",__constructs__:null,Number:{_hx_name:"Number",_hx_index:0,__enum__:"loreline.LiteralType",toString:F},Boolean:{_hx_name:"Boolean",_hx_index:1,__enum__:"loreline.LiteralType",toString:F},Null:{_hx_name:"Null",_hx_index:2,__enum__:"loreline.LiteralType",toString:F},Array:{_hx_name:"Array",_hx_index:3,__enum__:"loreline.LiteralType",toString:F},Object:(x=function(b){return{_hx_index:4,style:b,__enum__:"loreline.LiteralType",toString:F}},x._hx_name="Object",x.__params__=["style"],x)};Ke.__constructs__=[Ke.Number,Ke.Boolean,Ke.Null,Ke.Array,Ke.Object];class ft extends ct{constructor(e,t,l,i,n,s){super(e,t,n,s),this.target=l,this.name=i}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}}Q["loreline.NAccess"]=ft,ft.__name__="loreline.NAccess",ft.__super__=ct,Object.assign(ft.prototype,{__class__:ft});class kl extends ct{constructor(e,t,l,i,n,s,r){super(e,t,s,r),this.target=l,this.op=i,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=Y.string(this.op),e.value=this.value.toJson(),e}}Q["loreline.NAssign"]=kl,kl.__name__="loreline.NAssign",kl.__super__=ct,Object.assign(kl.prototype,{__class__:kl});class gl extends ct{constructor(e,t,l,i,n,s){super(e,t,n,s),this.target=l,this.index=i}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}}Q["loreline.NArrayAccess"]=gl,gl.__name__="loreline.NArrayAccess",gl.__super__=ct,Object.assign(gl.prototype,{__class__:gl});class il extends ct{constructor(e,t,l,i,n,s,r){super(e,t,s,r),this.left=l,this.op=i,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=Y.string(this.op),e.right=this.right.toJson(),e}}Q["loreline.NBinary"]=il,il.__name__="loreline.NBinary",il.__super__=ct,Object.assign(il.prototype,{__class__:il});class Yl extends ct{constructor(e,t,l,i,n,s){super(e,t,n,s),this.op=l,this.operand=i}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=Y.string(this.op),e.operand=this.operand.toJson(),e}}Q["loreline.NUnary"]=Yl,Yl.__name__="loreline.NUnary",Yl.__super__=ct,Object.assign(Yl.prototype,{__class__:Yl});class ii extends ct{constructor(e,t,l,i,n,s,r){super(e,t,s,r),this.condition=l,this.trueExpr=i,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}}Q["loreline.NTernary"]=ii,ii.__name__="loreline.NTernary",ii.__super__=ct,Object.assign(ii.prototype,{__class__:ii});class Rt extends Be{constructor(e,t,l,i,n,s){super(e,t,n,s),this.path=l,this.script=i}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}}Q["loreline.NImportStatement"]=Rt,Rt.__name__="loreline.NImportStatement",Rt.__super__=Be,Object.assign(Rt.prototype,{__class__:Rt});class oe{static isFields(e){return te.__implements(e,Ml)||e instanceof Ee?!0:e instanceof Kl||typeof e=="number"&&(e|0)===e||typeof e=="number"||typeof e=="boolean"||typeof e=="string"?!1:!he.isArray(e)}static getField(e,t,l){return te.__implements(t,Ml)?t.lorelineGet(e,l):t instanceof Ee?t.h[l]:qe.getProperty(t,l)}static getFields(e,t){if(te.__implements(t,Ml))return t.lorelineFields(e);if(t instanceof Ee){let l=[],i=t.h,n=i,s=Object.keys(i),r=s.length,a=0;for(;a<r;){let h=s[a++];l.push(h)}return l}else return qe.fields(t)}static setField(e,t,l,i){te.__implements(t,Ml)?t.lorelineSet(e,l,i):t instanceof Ee?t.h[l]=i:qe.setProperty(t,l,i)}static removeField(e,t,l){if(te.__implements(t,Ml))return t.lorelineRemove(e,l);if(t instanceof Ee){let i=t;return Object.prototype.hasOwnProperty.call(i.h,l)?(delete i.h[l],!0):!1}else return qe.deleteField(t,l)}static fieldExists(e,t,l){return te.__implements(t,Ml)?t.lorelineExists(e,l):t instanceof Ee?Object.prototype.hasOwnProperty.call(t.h,l):Object.prototype.hasOwnProperty.call(t,l)}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,l){if(e!=null&&e.customCreateFields!=null){let i=e.customCreateFields(e,t,l);if(i!=null)return i}if(t!=null){let i=Object.create(Q[t].prototype);return te.__implements(i,Ml)&&i.lorelineCreate(e),i}return new Ee}}Q["loreline.Objects"]=oe,oe.__name__="loreline.Objects";class Ne extends st{constructor(e,t){super(e,t)}}Q["loreline.ParseError"]=Ne,Ne.__name__="loreline.ParseError",Ne.__super__=st,Object.assign(Ne.prototype,{__class__:Ne});class Fi{constructor(e,t,l,i){this.imported=new Ee,this.rootPath=e,this.path=t,this.imports=l,i!=null&&(this.imported=i)}}Q["loreline.ParserContext"]=Fi,Fi.__name__="loreline.ParserContext",Object.assign(Fi.prototype,{__class__:Fi});class Gl{constructor(e,t){this.parsingCondition=!1,this.tokens=e,this.current=0,this.errors=null,this.pendingComments=null,this.lastTokenEnd=new ue(1,1,0),this.lastLineBreak=null,this.lineBreakAfterToken=!1,this.currentNodeId=Ae.UNDEFINED,this.rootBeat=null,this.context=t}parse(){let e=this.currentPos(),t=[],l=new nl(this.nextNodeId(4),e,t);for(this.context!=null&&(l.filePath=this.context.path);!this.isAtEnd();)try{let i=this.parseNode(!0);for(i!=null&&t.push(i);this.match(k.LineBreak););}catch(i){let n=C.caught(i).unwrap();if(n instanceof Ne){let s=n;this.addError(s),this.synchronize()}else throw i}return this.attachComments(l),l}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 l=t.content;++e;break;case 52:let i=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),this.parsingCondition&&(e=!1);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==k.LineBreak);){this.current++;let l=this.tokens[this.current].type;switch(l._hx_index){case 51:let i=l.content;this.pendingComments==null&&(this.pendingComments=[]),this.pendingComments.push(new Ql(this.nextNodeId(4),this.currentPos(),i,!1));break;case 52:let n=l.content;this.pendingComments==null&&(this.pendingComments=[]),this.pendingComments.push(new Ql(this.nextNodeId(4),this.currentPos(),n,!0));break;case 53:let s=l.content;this.pendingComments==null&&(this.pendingComments=[]),this.pendingComments.push(new Ql(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(Nt.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 l=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 l=t.content;break;case 52:let i=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 l=t.content;break;case 52:let i=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 l=t.content;break;case 52:let i=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 ue(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?Nt.toCodeString(t):null}return null}check(e){return this.isAtEnd()?!1:e._hx_index==41?this.tokens[this.current].type==k.Colon:Nt.equals(this.tokens[this.current].type,e)}checkString(){let e=this.tokens[this.current].type;if(e._hx_index==15){let t=e.attachments,l=e.quotes,i=e.s;return!0}else return!1}isAtEnd(){return this.current<this.tokens.length?this.tokens[this.current].type==k.Eof:!0}isComment(e){switch(e._hx_index){case 51:let t=e.content;return!0;case 52:let l=e.content;return!0;case 53:let i=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==k.LineBreak;){if(this.isComment(this.tokens[this.current].type)){this.pendingComments==null&&(this.pendingComments=[]);let i=this.pendingComments,n=this.nextNodeId(4),s=this.currentPos(),r=this.tokens[this.current].type,a;switch(r._hx_index){case 51:a=r.content;break;case 52:a=r.content;break;case 53:a=r.content;break;default:a=""}let h=this.tokens[this.current].type,o;if(h._hx_index==52){let _=h.content;o=!0}else o=!1;let u=this.tokens[this.current].type,p;if(u._hx_index==53){let _=u.content;p=!0}else p=!1;i.push(new Ql(n,s,a,o,p))}if(this.advance(),this.isAtEnd())throw C.thrown(new Ne("Unexpected end of file",this.currentPos()))}if(this.isAtEnd())throw C.thrown(new Ne("Unexpected end of file",this.currentPos()));let t=this,l=this.tokens[this.current].type;switch(l._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 je(this.nextNodeId(4),this.currentPos(),null,Ke.Null));case 4:let i=this.parseChoiceStatement();return e?t.wrapInRootBeat(i):i;case 5:let n=this.parseIfStatement();return e?t.wrapInRootBeat(n):n;case 7:if(this.advance(),!this.check(k.KwState))throw C.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 a=l.name,h=l.args,o=l.code,u=l.external;return e?this.parseFunction():(this.addError(new Ne("Unexpected: "+this.currentTokenTypeToString(),this.currentPos())),this.advance(),new je(this.nextNodeId(4),this.currentPos(),null,Ke.Null));case 15:let p=l.quotes,_=l.s,m=l.attachments,f=this.parseTextStatement();return e?t.wrapInRootBeat(f):f;case 16:let g=l.n,d=this.parseExpressionStatement();return e?t.wrapInRootBeat(d):d;case 17:let w=l.b,y=this.parseExpressionStatement();return e?t.wrapInRootBeat(y):y;case 19:let S=l.name;if(this.peek().type==k.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 T=this.parseInsertion();return e?t.wrapInRootBeat(T):T;case 18:case 27:case 39:case 45:case 47:case 49:let O=this.parseExpressionStatement();return e?t.wrapInRootBeat(O):O;case 40:let E=this.parseTransition();return e?t.wrapInRootBeat(E):E;default:return this.addError(new Ne("Unexpected: "+this.currentTokenTypeToString(),this.currentPos())),this.advance(),new je(this.nextNodeId(4),this.currentPos(),null,Ke.Null)}}wrapInRootBeat(e){let t,l=null;if(this.rootBeat==null){let i=this.currentPos();t=[],this.rootBeat=new Me(this.nextNodeId(1),i,"_",t),l=this.rootBeat}else t=this.rootBeat.body;return t.push(e),l}parseImport(){let e=this.currentPos();if(this.expect(k.KwImport),this.context==null)throw C.thrown(new Ne("Cannot import without a context",this.currentPos()));let t=0,l=this.tokens[this.current],i,n=l.type;if(n._hx_index==15){let _=n.attachments,m=n.quotes,f=n.s;t=m,i=f}else throw C.thrown(new Ne("Expected string literal for import path",this.currentPos()));let s=i;De.isAbsolute(s)||(s=De.join([De.directory(this.context.path),s])),s=De.normalize(s);let r,a;if(s==null)a=!1;else{let _=s.length;if(_<8)a=!1;else{let m,f,g,d,w,y,S=c.cca(s,_-8);if((S??-1)==46){let T=c.cca(s,_-7),O=T??-1;y=O==108||O==76}else y=!1;if(y){let T=c.cca(s,_-6),O=T??-1;w=O==111||O==79}else w=!1;if(w){let T=c.cca(s,_-5),O=T??-1;d=O==114||O==82}else d=!1;if(d){let T=c.cca(s,_-4);g=(T??-1)==46}else g=!1;if(g){let T=c.cca(s,_-3),O=T??-1;f=O==116||O==84}else f=!1;if(f){let T=c.cca(s,_-2),O=T??-1;m=O==120||O==88}else m=!1;if(m){let T=c.cca(s,_-1),O=T??-1;a=O==116||O==84}else a=!1}}if(a)r=!0;else if(s==null)r=!1;else{let _=s.length;if(_<4)r=!1;else{let m,f,g=c.cca(s,_-4);if((g??-1)==46){let d=c.cca(s,_-3),w=d??-1;f=w==108||w==76}else f=!1;if(f){let d=c.cca(s,_-2),w=d??-1;m=w==111||w==79}else m=!1;if(m){let d=c.cca(s,_-1),w=d??-1;r=w==114||w==82}else r=!1}}if(!r){let _=this.context.rootPath,m;if(_==null)m=!1;else{let f=_.length;if(f<8)m=!1;else{let g,d,w,y,S,T,O=c.cca(_,f-8);if((O??-1)==46){let E=c.cca(_,f-7),v=E??-1;T=v==108||v==76}else T=!1;if(T){let E=c.cca(_,f-6),v=E??-1;S=v==111||v==79}else S=!1;if(S){let E=c.cca(_,f-5),v=E??-1;y=v==114||v==82}else y=!1;if(y){let E=c.cca(_,f-4);w=(E??-1)==46}else w=!1;if(w){let E=c.cca(_,f-3),v=E??-1;d=v==116||v==84}else d=!1;if(d){let E=c.cca(_,f-2),v=E??-1;g=v==120||v==88}else g=!1;if(g){let E=c.cca(_,f-1),v=E??-1;m=v==116||v==84}else m=!1}}s+=m?".lor.txt":".lor"}if(Object.prototype.hasOwnProperty.call(this.context.imported.h,s)){this.advance();let _=new Rt(this.nextNodeId(1),e.extendedTo(this.prevNonWhitespaceOrComment().pos),null,null);return _.path=new Mt(this.nextNodeId(4),l.pos,t,[new Ge(this.nextNodeId(4),l.pos,ze.Raw(i))]),this.attachComments(_)}let h=this.context.imports.h[s];if(h==null)throw C.thrown(new Ne("Failed to import file at path "+s+" ("+i+")",this.currentPos()));this.context.imported.h[s]=!0;let o=new Gl(h,new Fi(this.context.rootPath,s,this.context.imports,this.context.imported));o.currentNodeId=this.currentNodeId;let u=o.parse();this.currentNodeId=o.currentNodeId,this.advance();let p=new Rt(this.nextNodeId(1),e.extendedTo(this.prevNonWhitespaceOrComment().pos),null,u);return p.path=new Mt(this.nextNodeId(4),l.pos,t,[new Ge(this.nextNodeId(4),l.pos,ze.Raw(i))]),this.attachComments(p)}parseDialogueStatement(){let e=this.currentPos(),t=new Kt(this.nextNodeId(4),e,null,null,null),l=this.tokens[this.current].type,i;if(l._hx_index==19)i=l.name;else throw C.thrown(new Ne("Expected character name",this.currentPos()));t.character=i,t.characterPos=this.tokens[this.current].pos,this.advance(),this.expect(k.Colon),this.attachComments(t);let n=!1;if(this.checkBlockStart()){let s=this.parseBlockStart();if(s.type!=k.Indent)throw C.thrown(new Ne("Expected indent, got "+Nt.toCodeString(s.type),s.pos));n=!0}try{t.content=this.parseStringLiteral()}catch(s){let r=C.caught(s).unwrap();if(r instanceof Ne){let a=r;this.addError(a),t.content=new Mt(this.nextNodeId(4),this.currentPos(),0,[new Ge(this.nextNodeId(4),this.currentPos(),ze.Raw("?"))])}else throw s}if(!this.lineBreakAfterToken&&this.match(k.KwIf)){let s=this.previous().pos;this.check(k.LParen)&&(t.conditionStyle=2),t.condition=this.parseConditionExpression(),t.conditionPos=s.extendedTo(this.prevNonWhitespaceOrComment().pos)}if(n){for(;this.match(k.LineBreak););this.expect(k.Unindent)}return t.pos=t.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),t}parseStatementBlock(e){let t=this.parseBlockStart().type==k.Indent?k.Unindent:k.RBrace;for(;!this.check(t)&&!this.isAtEnd();){for(;this.match(k.LineBreak)||t!=k.Unindent&&this.match(k.Unindent););if(this.check(t))break;try{e.push(this.parseNode())}catch(l){let i=C.caught(l).unwrap();if(i instanceof Ne){let n=i;if(this.errors==null&&(this.errors=[]),this.errors.push(n),this.synchronize(),this.check(t))break}else throw l}for(;this.match(k.LineBreak)||t!=k.Unindent&&this.match(k.Unindent););}return this.expect(t),t==k.RBrace?1:0}parseStateDecl(e){let t=this.currentPos(),l=new $t(this.nextNodeId(3),t,e,[]);this.expect(k.KwState);let i=this.parseBlockStart().type==k.Indent?k.Unindent:k.RBrace;for(l.style=i==k.RBrace?1:0,this.attachComments(l);!this.check(i)&&!this.isAtEnd();){for(;this.match(k.LineBreak)||i!=k.Unindent&&this.match(k.Unindent););for(l.fields.push(this.parseObjectField());this.match(k.LineBreak)||i!=k.Unindent&&this.match(k.Unindent););}for(;this.match(k.LineBreak)||i!=k.Unindent&&this.match(k.Unindent););return this.expect(i),l.pos=l.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),l}parseObjectField(){let e=this.currentPos(),t=this.expectIdentifier(),l=new Ul(this.nextNodeId(3),e,t,null);return this.expect(k.Colon),this.attachComments(l),this.checkBlockStart()?l.value=this.parseObjectLiteral():l.value=this.parseExpression(),l.pos=l.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),l}parseBeatDecl(){let e=this.currentPos(),t=new Me(this.nextNodeId(1),e,null,[],[]);this.expect(k.KwBeat),t.pos=e.extendedTo(this.currentPos()),t.name=this.expectIdentifier();let i=this.parseBlockStart().type==k.Indent?k.Unindent:k.RBrace;for(t.style=i==k.RBrace?1:0,this.attachComments(t);!this.check(i)&&!this.isAtEnd();){for(;this.match(k.LineBreak)||i!=k.Unindent&&this.match(k.Unindent););for(t.body.push(this.parseNode());this.match(k.LineBreak)||i!=k.Unindent&&this.match(k.Unindent););}for(;this.match(k.LineBreak)||i!=k.Unindent&&this.match(k.Unindent););return this.expect(i),t.pos=t.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),t}checkBlockStart(){let e=null,t=null,l=0,i=0;for(;this.current+i<this.tokens.length;){let n=this.tokens[this.current+i];if(++i,n.type!=k.LineBreak){if(n.type==k.Indent){++l,e=n;continue}if(n.type==k.LBrace){t==null&&(t=n);continue}break}}if(t!=null)return!0;if(e!=null){if(l>1)throw C.thrown(new Ne("Invalid indentation level",e.pos));return!0}else return!1}parseBlockStart(){let e=null,t=null,l=0;for(;!this.isAtEnd();)if(!this.match(k.LineBreak)){if(this.match(k.Indent)){++l,e=this.prevWithType(k.Indent);continue}if(this.match(k.LBrace)){t==null&&(t=this.prevWithType(k.LBrace));continue}break}if(t!=null)return t;if(e!=null){if(l>1)throw C.thrown(new Ne("Invalid indentation level",e.pos));return e}else return this.addError(new Ne("Expected "+Nt.toCodeString(k.LBrace)+" or "+Nt.toCodeString(k.Indent)+", got "+this.currentTokenTypeToString(),this.currentPos())),new ye(k.Indent,this.currentPos())}parseCharacterDecl(){let e=this.currentPos(),t=new jt(this.nextNodeId(3),e,null,null,[]);this.expect(k.KwCharacter),t.name=this.expectIdentifier(),t.namePos=this.prevNonWhitespaceOrComment().pos;let l=this.parseBlockStart().type==k.Indent?k.Unindent:k.RBrace;for(t.style=l==k.RBrace?1:0,this.attachComments(t);!this.check(l)&&!this.isAtEnd();){for(;this.match(k.LineBreak)||l!=k.Unindent&&this.match(k.Unindent););for(t.fields.push(this.parseObjectField());this.match(k.LineBreak)||l!=k.Unindent&&this.match(k.Unindent););}for(;this.match(k.LineBreak)||l!=k.Unindent&&this.match(k.Unindent););return this.expect(l),t.pos=t.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),t}parseTextStatement(){let e=this.currentPos(),t=this.attachComments(new ll(this.nextNodeId(4),e,null));if(t.content=this.parseStringLiteral(),!this.lineBreakAfterToken&&this.match(k.KwIf)){let l=this.previous().pos;this.check(k.LParen)&&(t.conditionStyle=2),t.condition=this.parseConditionExpression(),t.conditionPos=l.extendedTo(this.prevNonWhitespaceOrComment().pos)}return t.pos=t.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),t}parseChoiceStatement(){let e=this.currentPos(),t=new xl(this.nextNodeId(2),e,[]);this.expect(k.KwChoice);let l=this.parseBlockStart().type==k.Indent?k.Unindent:k.RBrace;for(t.style=l==k.RBrace?1:0,this.attachComments(t);!this.check(l)&&!this.isAtEnd();){for(;this.match(k.LineBreak)||l!=k.Unindent&&this.match(k.Unindent););for(t.options.push(this.parseChoiceOption(l));this.match(k.LineBreak)||l!=k.Unindent&&this.match(k.Unindent););}return this.expect(l),t.pos=t.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),t}parseChoiceOption(e){let t=this.currentPos(),l=this.attachComments(new St(this.nextNodeId(3),t,null,null,null,0,[])),i=null,n=!1;try{this.check(k.OpPlus)?(n=!0,l.insertion=this.parseInsertion()):(this.match(k.OpMinus)&&(l.once=!0),l.text=this.parseStringLiteral())}catch(s){let r=C.caught(s).unwrap();if(r instanceof Ne){let a=r;this.addError(a),i=this.currentPos(),this.currentPos().offset==t.offset&&this.advance(),l.text=new Mt(this.nextNodeId(4),this.currentPos(),0,[new Ge(this.nextNodeId(4),this.currentPos(),ze.Raw("?"))])}else throw s}if(this.match(k.KwIf)){let s=this.previous().pos,r=this.currentPos().offset;try{this.check(k.LParen)&&(l.conditionStyle=2),l.condition=this.parseConditionExpression(),l.conditionPos=s.extendedTo(this.prevNonWhitespaceOrComment().pos)}catch(a){let h=C.caught(a).unwrap();if(h instanceof Ne){let o=h;this.addError(o),i=this.currentPos(),this.currentPos().offset==r&&this.advance()}else throw a}}if(!n){if(this.checkBlockStart()){l.body=[];let s=this.currentPos().offset;try{l.style=this.parseStatementBlock(l.body)}catch(r){let a=C.caught(r).unwrap();if(a instanceof Ne){let h=a;this.addError(h),i=this.currentPos(),this.currentPos().offset==s&&this.advance(),l.body.length==0&&(l.body=[new je(this.nextNodeId(4),this.currentPos(),null,Ke.Null)])}else throw r}}else if(this.check(k.Arrow)){let s=this.currentPos().offset;try{l.body=[],l.body.push(this.parseNode())}catch(r){let a=C.caught(r).unwrap();if(a instanceof Ne){let h=a;this.addError(h),i=this.currentPos(),this.currentPos().offset==s&&this.advance(),l.body.length==0&&(l.body=[new je(this.nextNodeId(4),this.currentPos(),null,Ke.Null)])}else throw r}l.style=0}}if(l.pos=l.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),i!=null)for(;!this.isAtEnd()&&this.currentPos().line<=i.line+1;)this.advance();return l}isExpressionStart(){let e=this.tokens[this.current].type;switch(e._hx_index){case 15:let t=e.quotes,l=e.s,i=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!=k.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(k.OpAssign)||this.match(k.OpPlusAssign)||this.match(k.OpMinusAssign)||this.match(k.OpMultiplyAssign)||this.match(k.OpDivideAssign)||this.match(k.OpUnquotedAssign)){let t=this.previous().type,l=this.attachComments(new kl(this.nextNodeId(4),e.pos,e,t,null));return l.value=this.parseExpression(),l.pos=l.pos.extendedTo(l.value.pos),l}return this.attachComments(e)}isKnownNodeStart(){let e=this.tokens[this.current].type;switch(e._hx_index){case 15:let t=e.quotes,l=e.s,i=e.attachments;return!0;case 19:let n=e.name;return this.peek().type==k.Colon?!0:this.peek().type==k.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 wl(this.nextNodeId(4),e,null,0,null,null);for(this.expect(k.KwIf),this.check(k.LParen)&&(t.conditionStyle=2),t.condition=this.parseConditionExpression();this.match(k.LineBreak););this.attachComments(t),t.thenBranch=new hl(this.nextNodeId(3),this.currentPos(),null),t.thenBranch.body=[],t.thenBranch.style=this.parseStatementBlock(t.thenBranch.body);let l=this.tokens[this.current];if(l!=null&&l.type==k.KwElse){for(this.advance();this.match(k.LineBreak););if(this.attachElseComments(t,l),this.check(k.KwIf)){t.elseBranch=new hl(this.nextNodeId(3),this.currentPos(),null);let i=this.parseIfStatement();t.elseBranch.body=[i],t.elseBranch.style=0}else t.elseBranch=new hl(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 C.thrown(new Ne("Expected alternative keyword",this.currentPos()))}let l=new Hl(this.nextNodeId(2),e,t,[]);for(this.advance();this.match(k.LineBreak););this.attachComments(l);let i=new hl(this.nextNodeId(3),this.currentPos(),null);for(i.body=[],i.style=this.parseStatementBlock(i.body),l.items.push(i),l.style=i.style;this.check(k.Separator);){let n=this.tokens[this.current];for(this.advance();this.match(k.LineBreak););if(this.pendingComments!=null&&this.pendingComments.length>0){l.separatorComments==null&&(l.separatorComments=[]);let r=[],a=[],h=0,o=this.pendingComments;for(;h<o.length;){let u=o[h];++h,u.pos.line<=n.pos.line?r.push(u):a.push(u)}l.separatorComments.push(r),this.pendingComments=a}let s=new hl(this.nextNodeId(3),this.currentPos(),null);s.body=[],s.style=this.parseStatementBlock(s.body),l.items.push(s)}return l.pos=l.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),l}parseTransition(){let e=this.currentPos();if(this.expect(k.Arrow),this.match(k.Dot))return this.attachComments(new Dl(this.nextNodeId(4),e.extendedTo(this.prevNonWhitespaceOrComment().pos),".",this.prevNonWhitespaceOrComment().pos));let t=this.expectIdentifier();return this.attachComments(new Dl(this.nextNodeId(4),e.extendedTo(this.prevNonWhitespaceOrComment().pos),t,this.prevNonWhitespaceOrComment().pos))}parseInsertion(){let e=this.currentPos();this.expect(k.OpPlus);let t=this.expectIdentifier();return this.attachComments(new $l(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 l=t.name,i=t.args,n=t.code,s=t.external;return this.advance(),this.attachComments(new ql(this.nextNodeId(3),e,l,[].concat(i),n,s))}else throw C.thrown(new Ne("Unexpected token in expression",this.currentPos()))}parseExpression(){try{let e=this.parseTernary();if(this.check(k.OpAssign)||this.check(k.OpPlusAssign)||this.check(k.OpMinusAssign)||this.check(k.OpMultiplyAssign)||this.check(k.OpDivideAssign)||this.check(k.OpUnquotedAssign)){let t=this.tokens[this.current].type;this.advance();let l=this.attachComments(new kl(this.nextNodeId(4),e.pos,e,t,null));return l.value=this.parseExpression(),l.pos=l.pos.extendedTo(l.value.pos),l}return e}catch(e){let t=C.caught(e).unwrap();return t instanceof Ne&&this.addError(t),new je(this.nextNodeId(4),this.currentPos(),null,Ke.Null)}}parseTernary(){let e=this.parseLogicalOr();if(this.match(k.Question)){let t=this.parseTernary();this.expect(k.Colon);let l=this.parseTernary();e=this.attachComments(new ii(this.nextNodeId(4),e.pos,e,t,l)),e.pos=e.pos.extendedTo(l.pos)}return e}parseLogicalOr(){let e=this.parseLogicalAnd();for(;this.match(k.OpOr(!1));){let t=this.previous().type,l=this.attachComments(new il(this.nextNodeId(4),e.pos,e,t,null));l.right=this.parseLogicalAnd(),l.pos=l.pos.extendedTo(l.right.pos),e=l}return e}parseLogicalAnd(){let e=this.parseEquality();for(;this.match(k.OpAnd(!1));){let t=this.previous().type,l=this.attachComments(new il(this.nextNodeId(4),e.pos,e,t,null));l.right=this.parseEquality(),l.pos=l.pos.extendedTo(l.right.pos),e=l}return e}parseEquality(){let e=this.parseComparison();for(;this.match(k.OpEquals)||this.match(k.OpNotEquals);){let t=this.previous().type,l=this.attachComments(new il(this.nextNodeId(4),e.pos,e,t,null));l.right=this.parseComparison(),l.pos=l.pos.extendedTo(l.right.pos),e=l}return e}parseComparison(){let e=this.parseAdditive();for(;this.match(k.OpGreater)||this.match(k.OpGreaterEq)||this.match(k.OpLess)||this.match(k.OpLessEq);){let t=this.previous().type,l=this.attachComments(new il(this.nextNodeId(4),e.pos,e,t,null));l.right=this.parseAdditive(),l.pos=l.pos.extendedTo(l.right.pos),e=l}return e}parseAdditive(){let e=this.parseMultiplicative();for(;this.match(k.OpPlus)||this.match(k.OpMinus);){let t=this.previous().type,l=this.attachComments(new il(this.nextNodeId(4),e.pos,e,t,null));l.right=this.parseMultiplicative(),l.pos=l.pos.extendedTo(l.right.pos),e=l}return e}parseMultiplicative(){let e=this.parseUnary();for(;this.match(k.OpMultiply)||this.match(k.OpDivide)||this.match(k.OpModulo);){let t=this.previous().type,l=this.attachComments(new il(this.nextNodeId(4),e.pos,e,t,null));l.right=this.parseUnary(),l.pos=l.pos.extendedTo(l.right.pos),e=l}return e}parseUnary(){if(this.match(k.OpNot)||this.match(k.OpMinus)){let e=this.previous().type,t=this.attachComments(new Yl(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 l=t.quotes,i=t.s,n=t.attachments;return this.parsePostfix(e,this.parseStringLiteral());case 16:let s=t.n;return this.advance(),this.attachComments(new je(this.nextNodeId(4),e,s,Ke.Number));case 17:let r=t.b;return this.advance(),this.attachComments(new je(this.nextNodeId(4),e,r,Ke.Boolean));case 18:return this.advance(),this.attachComments(new je(this.nextNodeId(4),e,null,Ke.Null));case 19:let a=t.name;if(this.peek().type==k.Colon){let o=[this.parseObjectField()];return new je(this.nextNodeId(4),e.extendedTo(this.prevNonWhitespaceOrComment().pos),o,Ke.Object(0))}else return this.advance(),this.parseIdentifierExpression(e,a);break;case 45:return this.parsePostfix(e,this.parseObjectLiteral());case 47:this.advance();let h=this.parseExpression();return this.expect(k.RParen),this.parsePostfix(e,h);case 49:return this.parsePostfix(e,this.parseArrayLiteral());default:throw C.thrown(new Ne("Unexpected token in expression",this.currentPos()))}}parseStringLiteral(){let e=this.currentPos(),t=[],l=this.tokens[this.current].type;if(l._hx_index==15){let i=l.quotes,n=l.s,s=l.attachments,r=i!=0?e.withOffset(n,1,e.length-2):e,a=0;if(s==null||s.length==0){let p=this.makeStringPartPosition(r,n,0);p.length=r.length;let _=this.nextNodeId(4),m=this.nextNodeId(4);return t.push(new Ge(m,p,ze.Raw(n))),this.advance(),this.attachComments(new Mt(_,e,i,t))}let h=this.attachComments(new Mt(this.nextNodeId(4),e,i,t)),o=0,u=s.length;for(;o<u;){let p=o++,_=s[p];switch(_._hx_index){case 0:let m=_.braces,f=_.inTag,g=_.expr,d=_.start,w=_.length;if(a>=d+w)continue;if(d>a){let O=this.makeStringPartPosition(r,n,a);O.length=d-a;let E=d-a;t.push(new Ge(this.nextNodeId(4),O,ze.Raw(E!=null?c.substr(n,a,E):c.substr(n,a,null))))}t.push(this.parseStringInterpolation(m,f,g,d,w,n)),a=d+w;break;case 1:let y=_.closing,S=_.start,T=_.length;if(a>=S+T)continue;if(S>a){let O=this.makeStringPartPosition(r,n,a);O.length=S-a;let E=S-a;t.push(new Ge(this.nextNodeId(4),O,ze.Raw(E!=null?c.substr(n,a,E):c.substr(n,a,null))))}t.push(this.parseStringTag(y,S,T,n,i,s)),a=S+T;break}}if(a<n.length){let p=this.makeStringPartPosition(r,n,a);p.length=n.length-a;let _=null;t.push(new Ge(this.nextNodeId(4),p,ze.Raw(_!=null?c.substr(n,a,_):c.substr(n,a,null))))}if(this.advance(),this.pendingComments!=null){let p=null,_=0,m=this.pendingComments;for(;_<m.length;){let f=m[_];++_,f.pos.line==e.line?(h.trailingComments==null&&(h.trailingComments=[]),h.trailingComments.push(f)):(p==null&&(p=[]),p.push(f))}this.pendingComments=p}return h}else throw C.thrown(new Ne("Expected text, got "+this.currentTokenTypeToString(),this.currentPos()))}makeStringPartPosition(e,t,l){let i=e.line,n=e.column,s=0,r=l;for(;s<r;){let a=s++,h=c.cca(t,a);(h??-1)==10?(++i,n=1):++n}return new ue(i,n,e.offset+l)}makeAccess(e,t,l,i){if(l!=null){if(l.length==0&&(this.errors==null||this.errors.length==0)&&this.addError(new Ne("Invalid access: "+(l!=null?"'"+l+"'":"null"),e)),t!=null)if(i!=null)e=new ue(t.pos.line,t.pos.column,t.pos.offset,i.offset+l.length-t.pos.offset);else throw C.thrown(new Ne("Invalid access (missing name position)",e));else if(e.length==0){let n=i!=null?i.length:null;e=new ue(e.line,e.column,e.offset,n??l.length)}}return new ft(this.nextNodeId(4),e,t,l)}parseStringInterpolation(e,t,l,i,n,s){let r=l[0],a=r!=null?r.pos:null,h=this.makeStringPartPosition(a??this.currentPos(),s,i);if(h.length=n,l.length==0){let p=l[0],_=p!=null?p.pos:null;this.addError(new Ne("Empty interpolation",_??this.currentPos()));let m=this.nextNodeId(4),f=this.nextNodeId(4),g=l[0],d=g!=null?g.pos:null;return new Ge(m,h,ze.Expr(new je(f,d??this.currentPos(),null,Ke.Null)))}let o=null;if(!e&&l.length>0){let p=null,_=0,m=!1;for(;_<l.length;){let f=l[_];++_;let g=f.type;switch(g._hx_index){case 19:let d=g.name;if(p==null)p=this.attachComments(this.makeAccess(f.pos,null,d,null));else if(m)p=this.attachComments(this.makeAccess(f.pos,p,d,f.pos));else{this.addError(new Ne("Missing dot in field access",f.pos));let U=this.nextNodeId(4),W=this.nextNodeId(4),J=l[0],H=J!=null?J.pos:null;return new Ge(U,h,ze.Expr(new je(W,H??this.currentPos(),null,Ke.Null)))}m=!1;break;case 44:if(p==null){this.addError(new Ne("Leading dot in field access",f.pos));let U=this.nextNodeId(4),W=this.nextNodeId(4),J=l[0],H=J!=null?J.pos:null;return new Ge(U,h,ze.Expr(new je(W,H??this.currentPos(),null,Ke.Null)))}m=!0;break;case 47:if(p==null){this.addError(new Ne("Function call without target",f.pos));let U=this.nextNodeId(4),W=this.nextNodeId(4),J=l[0],H=J!=null?J.pos:null;return new Ge(U,h,ze.Expr(new je(W,H??this.currentPos(),null,Ke.Null)))}let w=f.pos,y=[],S=[],T=1;for(;_<l.length&&T>0;){let U=l[_];switch(++_,U.type._hx_index){case 43:T==1?S.length>0&&(y.push(S),S=[]):S.push(U);break;case 47:++T,S.push(U);break;case 48:--T,T>0?S.push(U):S.length>0&&y.push(S);break;default:S.push(U)}}if(T>0){this.addError(new Ne("Unterminated function call",w));let U=this.nextNodeId(4),W=this.nextNodeId(4),J=l[0],H=J!=null?J.pos:null;return new Ge(U,h,ze.Expr(new je(W,H??this.currentPos(),null,Ke.Null)))}let O=[],E=0;for(;E<y.length;){let U=y[E];++E;let W=new Gl(U);W.currentNodeId=this.currentNodeId;let J=W.parseExpression();O.push(J),this.currentNodeId=W.currentNodeId}p=this.attachComments(new Jt(this.nextNodeId(4),w.extendedTo(l[_-1].pos),p,O)),m=!1;break;case 49:if(p==null){this.addError(new Ne("Array access without target",f.pos));let U=this.nextNodeId(4),W=this.nextNodeId(4),J=l[0],H=J!=null?J.pos:null;return new Ge(U,h,ze.Expr(new je(W,H??this.currentPos(),null,Ke.Null)))}let v=f.pos,M=[],A=1,L=null;for(;_<l.length&&A>0;){let U=l[_];switch(++_,U.type._hx_index){case 49:++A,M.push(U);break;case 50:--A,A>0&&M.push(U),L=U;break;default:M.push(U)}}if(A>0){this.addError(new Ne("Unterminated array access",v));let U=this.nextNodeId(4),W=this.nextNodeId(4),J=l[0],H=J!=null?J.pos:null;return new Ge(U,h,ze.Expr(new je(W,H??this.currentPos(),null,Ke.Null)))}let I=new Gl(M);I.currentNodeId=this.currentNodeId;let q=I.parseExpression();this.currentNodeId=I.currentNodeId;let z=h.extendedTo(l[_-1].pos);z.length+=1,p=this.attachComments(new gl(this.nextNodeId(4),z,p,q)),m=!1;break;default:this.addError(new Ne("Unexpected token in field access: "+Nt.toCodeString(f.type),f.pos));let P=this.nextNodeId(4),B=this.nextNodeId(4),N=l[0],D=N!=null?N.pos:null;return new Ge(P,h,ze.Expr(new je(B,D??this.currentPos(),null,Ke.Null)))}}m&&this.addError(new Ne("Trailing dot in field access",l[l.length-1].pos)),o=p}else{let p=new Gl(l);p.currentNodeId=this.currentNodeId,o=p.parseExpression(),this.currentNodeId=p.currentNodeId,p.isAtEnd()||this.addError(new Ne("Unexpected tokens after interpolation expression",p.tokens[p.current].pos))}let u=new ue(h.line,h.column+(e?1:0),h.offset-(e?2:0),n);return new Ge(this.nextNodeId(4),u,ze.Expr(o))}parseStringTag(e,t,l,i,n,s){let r=this.currentPos();n!=0&&(r=r.withOffset(i,1,r.length-2));let a=this.makeStringPartPosition(r,i,t);a.length=l;let h=e?2:1,o=t+h,u=l-(e?3:2),p=o+u,_=this.nextNodeId(4),m=!1;if(s!=null){let w=0,y=s.length;e:for(;w<y;){let S=w++,T=s[S];switch(T._hx_index){case 0:let O=T.braces,E=T.inTag,v=T.expr,M=T.start,A=T.length,L=M+A;if(M>=o&&L<=p){m=!0;break e}break;case 1:let I=T.closing,q=T.start,z=T.length;continue}}}if(!m){let w=this.makeStringPartPosition(r,i,o);w.length=u;let y=this.nextNodeId(4),S=this.nextNodeId(4);return new Ge(_,a,ze.Tag(e,this.attachComments(new Mt(y,w,0,[new Ge(S,w,ze.Raw(u!=null?c.substr(i,o,u):c.substr(i,o,null)))]))))}let f=[],g=this.attachComments(new Mt(this.nextNodeId(4),a,0,f)),d=o;if(s!=null){let w=0,y=s.length;for(;w<y;){let S=w++,T=s[S];switch(T._hx_index){case 0:let O=T.inTag,E=T.braces,v=T.expr,M=T.start,A=T.length,L=M+A;if(M>=o&&L<=p){if(M>d){let B=this.makeStringPartPosition(r,i,o);B.length=M-o;let N=M-d;f.push(new Ge(this.nextNodeId(4),B,ze.Raw(N!=null?c.substr(i,d,N):c.substr(i,d,null))))}let P=this.parseStringInterpolation(E,!0,v,M,A,i);P.pos=this.makeStringPartPosition(r,i,M),P.pos.length=A,f.push(P),d=L}break;case 1:let I=T.closing,q=T.start,z=T.length;continue}}}if(d<p){let w=null,y=this.makeStringPartPosition(a,w!=null?c.substr(i,t,w):c.substr(i,t,null),d-t+h);y.length=o+p-d;let S=p-d;f.push(new Ge(this.nextNodeId(4),y,ze.Raw(S!=null?c.substr(i,d,S):c.substr(i,d,null))))}return new Ge(_,a,ze.Tag(e,g))}parseIdentifierExpression(e,t){let l=this.attachComments(this.makeAccess(e,null,t,null));return this.parsePostfix(e,l)}parsePostfix(e,t){for(;;)if(this.match(k.Dot,!1)){let l=null,i=this.currentPos();this.checkIdentifier()?l=this.expectIdentifier():(this.addError(new Ne("Expected identifier after '.'",this.currentPos())),l=""),t=this.attachComments(this.makeAccess(e,t,l,i))}else if(this.match(k.LBracket)){let l=this.parseExpression();this.expect(k.RBracket);let i=e.extendedTo(this.previous().pos);t=this.attachComments(new gl(this.nextNodeId(4),i,t,l))}else if(this.match(k.LParen)){let l=this.parseCallArguments();t=this.attachComments(new Jt(this.nextNodeId(4),e.extendedTo(this.previous().pos),t,l))}else break;return t}parseArrayLiteral(){let e=this.currentPos(),t=[],l=new je(this.nextNodeId(4),e,t,Ke.Array);this.expect(k.LBracket),this.attachComments(l);let i=!1;for(;!this.check(k.RBracket)&&!this.isAtEnd();){if(i){for(;this.match(k.LineBreak);)i=!1;this.match(k.Comma)&&(i=!1)}for(;this.match(k.LineBreak)||this.match(k.Indent)||this.match(k.Unindent);)i=!1;if(!this.check(k.RBracket)&&i)throw C.thrown(new Ne("Expected comma or line break between elements",this.currentPos()));for(;this.match(k.LineBreak)||this.match(k.Indent)||this.match(k.Unindent););this.check(k.RBracket)||t.push(this.parseExpression());let n=this.previous();i=n.type!=k.Colon&&n.type!=k.LineBreak&&n.type!=k.Unindent}for(;this.match(k.LineBreak)||this.match(k.Indent)||this.match(k.Unindent););return this.expect(k.RBracket),l.pos=l.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),l}parseObjectLiteral(){let e=this.currentPos(),t=[],l=this.parseBlockStart().type==k.Indent?k.Unindent:k.RBrace,i=l==k.RBrace?1:0,n=new je(this.nextNodeId(4),l!=k.RBrace?this.nextNonWhitespaceOrComment().pos:e,t,Ke.Object(i));this.attachComments(n);let s=!1;for(;!this.check(l)&&!this.isAtEnd();){if(s){for(;this.match(k.LineBreak)||l!=k.Unindent&&this.match(k.Unindent);)s=!1;this.match(k.Comma)&&(s=!1)}for(;this.match(k.LineBreak)||l!=k.Unindent&&this.match(k.Unindent);)s=!1;if(!this.check(l)&&s)throw C.thrown(new Ne("Expected comma or line break between fields",this.currentPos()));for(;this.match(k.LineBreak)||l!=k.Unindent&&this.match(k.Unindent););this.check(l)||t.push(this.parseObjectField());let r=this.previous();s=r.type!=k.Colon&&r.type!=k.LineBreak&&r.type!=k.Unindent}for(;this.match(k.LineBreak)||l!=k.Unindent&&this.match(k.Unindent););return this.expect(l),n.pos=n.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),n}parseCallArguments(){let e=[];if(!this.check(k.RParen))do{for(;this.match(k.LineBreak););for(e.push(this.parseExpression());this.match(k.LineBreak););}while(this.match(k.Comma));return this.expect(k.RParen),e}parseConditionExpression(){let e=this.parsingCondition;this.parsingCondition=!0;let t=this.match(k.LParen),l=null;try{l=this.parseExpression(),l!=null&&te.getClass(l)==kl&&this.addError(new Ne("Invalid condition expression: can't assign a variable here. Did you want to use '==' instead?",l.pos))}catch(i){let n=C.caught(i).unwrap();if(n instanceof Ne){let s=n;this.addError(s),l=new je(this.nextNodeId(4),this.currentPos(),null,Ke.Null)}else throw i}return this.parsingCondition=e,t&&this.expect(k.RParen),l}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==k.LineBreak}expect(e){if(this.check(e))return this.advance();{let t=new Ne("Expected "+Nt.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 ye(e,this.currentPos());default:}throw C.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 C.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,l=null,i=0,n=this.pendingComments.length;for(;i<n;){let s=i++,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)):(l==null&&(l=[]),l.push(r))}return this.pendingComments=l,e}attachElseComments(e,t){if(this.pendingComments!=null){let l=t.pos,i=[],n=0,s=this.pendingComments;for(;n<s.length;){let r=s[n];++n,r.pos.line<l.line?(e.elseLeadingComments==null&&(e.elseLeadingComments=[]),e.elseLeadingComments.push(r)):r.pos.line==l.line?(e.elseTrailingComments==null&&(e.elseTrailingComments=[]),e.elseTrailingComments.push(r)):i.push(r)}this.pendingComments=i}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,l=e.s,i=e.attachments;if(this.previous().type==k.RBrace)return;this.advance();break;case 40:this.advance(),(this.check(k.Dot)||Nt.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}}Q["loreline.Parser"]=Gl,Gl.__name__="loreline.Parser",Object.assign(Gl.prototype,{__class__:Gl});class ue{constructor(e,t,l,i){i==null&&(i=0),this.line=e,this.column=t,this.offset=l,this.length=i}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,l,i){if(i==null&&(i=0),l==null&&(l=0),t==0)return new ue(this.line,this.column,this.offset,l);let n=this.line,s=this.column,r=this.offset;if(t>0){let a=0;for(;a<t;){let h;if(r<i+e.length){let o=c.cca(e,r-i);h=(o??-1)==10}else h=!1;h?(++n,s=1):++s,++a,++r}}else{let a=0;for(;a>t;){--r;let h;if(r>=0){let o=c.cca(e,r-i);h=(o??-1)==10}else h=!1;if(h){--n;let o=1,u=r-1;for(;u>=0;){let p=c.cca(e,u-i);if((p??-1)==10)break;++o,--u}s=o}else--s;--a}}return r<0&&(r=0,n=1,s=1),new ue(n,s,r,l)}extendedTo(e){return new ue(this.line,this.column,this.offset,e.offset+e.length-this.offset)}static fromContentAndIndex(e,t,l){l==null&&(l=0);let i=1,n=1,s=0,r=e.length;for(t>r&&(t=r),t<0&&(t=0);s<t;){let a=c.cca(e,s);(a??-1)==10?(++i,n=1):++n,++s}return new ue(i,n,t,l)}}Q["loreline.Position"]=ue,ue.__name__="loreline.Position",Object.assign(ue.prototype,{__class__:ue});class Wl{constructor(e,t){t==null&&(t=`
34
34
  `),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 gt}clear(){this._noLn=0,this._level=0,this._prevLevel=0,this._numEmptyLines=0,this._buf=new gt}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=c.cca(e,e.length-1);this._lastChar=t??-1;let l=e.length-1;for(;l>=0;){let i=c.cca(e,l),n=i??-1;if(n!=32&&n!=10&&n!=13&&n!=9){this._lastVisibleChar=n;break}--l}}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+=Y.string(this._newline),this._beginLine++),this}tab(){let e=0,t=this._level;for(;e<t;){let l=e++;this._buf.b+=Y.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 gt,this._beginLine=1,this.printStringLiteral(e),this.enableComments=t;let l=He.trim(this.toString());return l=l.split(`
35
35
  `).join("\\n"),l}printStringLiteralAsText(e){let t=this.enableComments;this.enableComments=!1,this._noLn=0,this._level=0,this._prevLevel=0,this._numEmptyLines=0,this._buf=new gt,this._beginLine=1;let l=0,i=e.parts;for(;l<i.length;){let s=i[l];++l;let r=s.partType;switch(r._hx_index){case 0:let a=r.text;e.quotes==1?this.writeQuotedRaw(a):this.writeUnquotedRaw(a);break;case 1:let h=r.expr,o=this.isSimpleInterpolationExpr(h);this.write("$"),o||this.write("{"),this.printNode(h),o||this.write("}");break;case 2:let u=r.closing,p=r.expr;this.write(u?"</":"<"),this.printStringLiteral(p),this.write(">");break}}this.enableComments=t;let n=He.trim(this.toString());return n=n.split(`
36
- `).join("\\n"),n}print(e){return this._noLn=0,this._level=0,this._prevLevel=0,this._numEmptyLines=0,this._buf=new gt,this._beginLine=1,this.printNode(e),this.toString()}printNode(e,t){if(t==null&&(t=!1),e!=null)switch(te.getClass(e)){case ft:this.printAccess(e);break;case Hl:this.printAlternative(e);break;case gl:this.printArrayAccess(e);break;case kl:this.printAssignment(e);break;case Me:this.printBeatDecl(e);break;case il:this.printBinary(e);break;case Jt:this.printCall(e);break;case jt:this.printCharacterDecl(e);break;case St:this.printChoiceOption(e);break;case xl:this.printChoiceStatement(e);break;case Kt:this.printDialogueStatement(e);break;case ql:this.printFunctionDecl(e);break;case wl:this.printIfStatement(e);break;case Rt:this.printImportStatement(e);break;case $l:this.printInsertion(e);break;case je:this.printLiteral(e);break;case $t:this.printStateDecl(e);break;case Nt:this.printStringLiteral(e);break;case ii:this.printTernary(e);break;case ll:this.printTextStatement(e);break;case Dl:this.printTransition(e,t);break;case Yl:this.printUnary(e);break;case nl:this.printScript(e);break;default:let l=te.getClass(e);throw T.thrown("Unsupported node type: "+l.__name__)}}printLeadingComments(e){if(this.enableComments&&e.leadingComments!=null){let t=0,l=e.leadingComments;for(;t<l.length;){let i=l[t];++t,i.multiline?(this.write("/*"+i.content+"*/"),this.newline()):i.isHash?(this.write("#"+i.content),this.newline()):(this.write("//"+i.content),this.newline())}}}printHashTrailingComments(e){if(this.enableComments&&e.trailingComments!=null){let t=0,l=e.trailingComments;for(;t<l.length;){let i=l[t];++t,i.isHash&&(this._lastChar!=32&&this._beginLine==0&&this.write(" "),this.write("#"+i.content),this.newline())}}}printTrailingComments(e){if(this.enableComments&&e.trailingComments!=null){let t=0,l=e.trailingComments;for(;t<l.length;){let i=l[t];++t,this._lastChar!=32&&this._beginLine==0&&this.write(" "),i.multiline?this.write("/*"+i.content+"*/ "):i.isHash?(this.write("#"+i.content),this.newline()):(this.write("//"+i.content),this.newline())}}}printImport(e){this.printLeadingComments(e),this.write('import "'+Y.string(e.path)+'"'),this.newline(),this.printTrailingComments(e)}printScript(e){let t=0,l=e.body;for(;t<l.length;){let i=l[t];++t,this._prevLevel=this._level,this.printNode(i)}}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,l=0,i=e.fields;for(;l<i.length;){let n=i[l];++l,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,l=e.fields;for(;t<l.length;){let i=l[t];++t,this.printLeadingComments(i),this.write(""+i.name+": "),this.printTrailingComments(i),this.printNode(i.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,l=e.body.length;for(;t<l;){let i=t++;this._prevLevel=this._level,this.printNode(e.body[i]),i<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,l=e.options;for(;t<l.length;){let i=l[t];++t,this.printNode(i),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 Dl)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,l=e.body;for(;t<l.length;){let i=l[t];++t,this.printNode(i),this._beginLine==0&&i!=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 l=this._numEmptyLines,i=0,n=e.thenBranch.body;for(;i<n.length;){let s=n[i];++i,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 wl){let s=e.elseBranch.body[0];(this._numEmptyLines-l>0||this.needsEmptyLines(s))&&this.newline(),this.write("else "),this.printIfStatement(e.elseBranch.body[0],!0)}else{this._numEmptyLines-l>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 a=r[s];++s,this.printNode(a),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 l=0,i=e.items.length;for(;l<i;){let n=l++,s=e.items[n];this._level++;let r=0,a=s.body;for(;r<a.length;){let h=a[r];++r,this.printNode(h),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 Wl(this._indent,`
36
+ `).join("\\n"),n}print(e){return this._noLn=0,this._level=0,this._prevLevel=0,this._numEmptyLines=0,this._buf=new gt,this._beginLine=1,this.printNode(e),this.toString()}printNode(e,t){if(t==null&&(t=!1),e!=null)switch(te.getClass(e)){case ft:this.printAccess(e);break;case Hl:this.printAlternative(e);break;case gl:this.printArrayAccess(e);break;case kl:this.printAssignment(e);break;case Me:this.printBeatDecl(e);break;case il:this.printBinary(e);break;case Jt:this.printCall(e);break;case jt:this.printCharacterDecl(e);break;case St:this.printChoiceOption(e);break;case xl:this.printChoiceStatement(e);break;case Kt:this.printDialogueStatement(e);break;case ql:this.printFunctionDecl(e);break;case wl:this.printIfStatement(e);break;case Rt:this.printImportStatement(e);break;case $l:this.printInsertion(e);break;case je:this.printLiteral(e);break;case $t:this.printStateDecl(e);break;case Mt:this.printStringLiteral(e);break;case ii:this.printTernary(e);break;case ll:this.printTextStatement(e);break;case Dl:this.printTransition(e,t);break;case Yl:this.printUnary(e);break;case nl:this.printScript(e);break;default:let l=te.getClass(e);throw C.thrown("Unsupported node type: "+l.__name__)}}printLeadingComments(e){if(this.enableComments&&e.leadingComments!=null){let t=0,l=e.leadingComments;for(;t<l.length;){let i=l[t];++t,i.multiline?(this.write("/*"+i.content+"*/"),this.newline()):i.isHash?(this.write("#"+i.content),this.newline()):(this.write("//"+i.content),this.newline())}}}printHashTrailingComments(e){if(this.enableComments&&e.trailingComments!=null){let t=0,l=e.trailingComments;for(;t<l.length;){let i=l[t];++t,i.isHash&&(this._lastChar!=32&&this._beginLine==0&&this.write(" "),this.write("#"+i.content),this.newline())}}}printTrailingComments(e){if(this.enableComments&&e.trailingComments!=null){let t=0,l=e.trailingComments;for(;t<l.length;){let i=l[t];++t,this._lastChar!=32&&this._beginLine==0&&this.write(" "),i.multiline?this.write("/*"+i.content+"*/ "):i.isHash?(this.write("#"+i.content),this.newline()):(this.write("//"+i.content),this.newline())}}}printImport(e){this.printLeadingComments(e),this.write('import "'+Y.string(e.path)+'"'),this.newline(),this.printTrailingComments(e)}printScript(e){let t=0,l=e.body;for(;t<l.length;){let i=l[t];++t,this._prevLevel=this._level,this.printNode(i)}}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,l=0,i=e.fields;for(;l<i.length;){let n=i[l];++l,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,l=e.fields;for(;t<l.length;){let i=l[t];++t,this.printLeadingComments(i),this.write(""+i.name+": "),this.printTrailingComments(i),this.printNode(i.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,l=e.body.length;for(;t<l;){let i=t++;this._prevLevel=this._level,this.printNode(e.body[i]),i<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,l=e.options;for(;t<l.length;){let i=l[t];++t,this.printNode(i),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 Dl)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,l=e.body;for(;t<l.length;){let i=l[t];++t,this.printNode(i),this._beginLine==0&&i!=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 l=this._numEmptyLines,i=0,n=e.thenBranch.body;for(;i<n.length;){let s=n[i];++i,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 wl){let s=e.elseBranch.body[0];(this._numEmptyLines-l>0||this.needsEmptyLines(s))&&this.newline(),this.write("else "),this.printIfStatement(e.elseBranch.body[0],!0)}else{this._numEmptyLines-l>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 a=r[s];++s,this.printNode(a),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 l=0,i=e.items.length;for(;l<i;){let n=l++,s=e.items[n];this._level++;let r=0,a=s.body;for(;r<a.length;){let h=a[r];++r,this.printNode(h),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 Wl(this._indent,`
37
37
  `).print(e).indexOf(`
38
38
 
39
39
  `)!=-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 l=0,i=e.parts;for(;l<i.length;){let n=i[l];++l;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 a=s.expr,h=this.isSimpleInterpolationExpr(a);this.write("$"),h||this.write("{"),this.printNode(a),h||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(`
40
40
  `)==-1){this.write(e);return}let t=e.split(`
41
41
  `),l=0,i=t.length;for(;l<i;){let n=l++;n>0&&(this._buf.b+=Y.string(this._newline));let s=t[n],r;if(s.length>0){let a=c.cca(s,s.length-1);r=(a??-1)==13}else r=!1;if(r){let a=s.length-1;s=a!=null?s.substring(0,a):s.substring(0)}if(s.length>0){this._buf.b+=s==null?"null":""+s;let a=c.cca(s,s.length-1);this._lastChar=a??-1}}}writeRawWithContinuation(e,t){if(e.indexOf(`
42
42
  `)==-1){this.write(e);return}let l=e.split(`
43
- `),i=0,n=l.length;for(;i<n;){let s=i++;s>0&&(this._buf.b+=Y.string(this._newline),this._beginLine=1);let r=l[s],a;if(r.length>0){let h=c.cca(r,r.length-1);a=(h??-1)==13}else a=!1;if(a){let h=r.length-1;r=h!=null?r.substring(0,h):r.substring(0)}if(t&&s>0){let h=0;for(;;){let o;if(h<r.length){let u=c.cca(r,h);if((u??-1)!=32){let p=c.cca(r,h);o=(p??-1)==9}else o=!0}else o=!1;if(!o)break;++h}if(h>0){let o=null;r=o!=null?r.substring(h,o):r.substring(h)}}r.length>0&&this.write(r)}}printLiteral(e){this.printLeadingComments(e);let t=e.literalType;switch(t._hx_index){case 0:this.write(e.value==null?"null":Y.string(e.value));break;case 1:this.write(e.value?"true":"false");break;case 2:this.write("null");break;case 3:let l=!1,i=0,n=e.value;for(;i<n.length;){let o=n[i];if(++i,this.hasRealNewlines(o)){l=!0;break}}if(l){this.write("["),this.newline(),this._level++;let o=!0,u=0,p=e.value;for(;u<p.length;){let _=p[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,p=e.value;for(;u<p.length;){let _=p[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,a=0,h=e.value;for(;a<h.length;){let o=h[a];++a,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,l=0,i=e.args;for(;l<i.length;){let n=i[l];++l,t||this.write(", "),t=!1,this.printNode(n)}this.write(")"),this.printTrailingComments(e)}printBinary(e,t){t==null&&(t=!1),this.printLeadingComments(e);let l;if(t)l=!1;else{let i=e.op;switch(i._hx_index){case 37:let n=i.word;l=!0;break;case 38:let s=i.word;l=!0;break;default:l=!1}}l&&this.write("("),this.printNode(e.left),this.write(" "+this.getOperator(e.op)+" "),this.printNode(e.right),l&&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 l=this.enableComments;this.enableComments=!1,t&&this.write("("),e instanceof il?this.printBinary(e,!0):this.printNode(e),t&&this.write(")"),this.enableComments=l}isSimpleInterpolationExpr(e){if(e instanceof ft){let t=e;return t.target==null?!0:this.isSimpleInterpolationExpr(t.target)}return e instanceof gl?this.isSimpleInterpolationExpr(te.__cast(e,gl).target):e instanceof Jt?this.isSimpleInterpolationExpr(te.__cast(e,Jt).target):!1}hasRealNewlines(e){if(e instanceof Nt){let t=e;if(t.quotes==1)return!1;let l=0,i=t.parts;for(;l<i.length;){let n=i[l];++l;let s=n.partType;if(s._hx_index==0&&s.text.indexOf(`
44
- `)!=-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 T.thrown("Unsupported operator: "+Y.string(e))}}}Q["loreline.Printer"]=Wl,Wl.__name__="loreline.Printer",Object.assign(Wl.prototype,{__class__:Wl});class fn{static toString(e){switch(e){case 0:return"Unquoted";case 1:return"DoubleQuotes"}}}class wi{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}}Q["loreline.Random"]=wi,wi.__name__="loreline.Random",Object.assign(wi.prototype,{__class__:wi});class nl extends Be{constructor(e,t,l){At._hx_skip_constructor=!0,super(),At._hx_skip_constructor=!1,this._hx_constructor(e,t,l)}_hx_constructor(e,t,l){this.filePath=null,this.indentSize=2,super._hx_constructor(e,t),this.body=l}toJson(){let e=super.toJson(),t=[],l=0,i=this.body;for(;l<i.length;){let n=i[l];++l,t.push(n.toJson())}return e.body=t,e.indentSize=this.indentSize,this.filePath!=null&&(e.filePath=this.filePath),e}type(){return"Script"}eachExcludingImported(e){if(super.each(e),this.body!=null){let t=0,l=this.body;for(;t<l.length;){let i=l[t];++t,e(i,this),i instanceof Rt||i.each(e)}}}each(e){if(super.each(e),this.body!=null){let t=0,l=this.body;for(;t<l.length;){let i=l[t];++t,e(i,this),i.each(e)}}}iterator(){return new Xi(this.body)}static fromJson(e){return A.scriptFromJson(e)}}Q["loreline.Script"]=Xl.loreline.Script=nl,nl.__name__="loreline.Script",nl.__super__=Be,Object.assign(nl.prototype,{__class__:nl});class Xi{constructor(e){this.body=e,this.index=0,this.flatBody=[],this.fillBody(e)}fillBody(e){let t=0,l=e.length;for(;t<l;){let i=t++,n=e[i];if(n instanceof Rt){let s=n;s.script!=null&&this.fillBody(s.script.body)}this.flatBody.push(e[i])}}hasNext(){return this.index<this.flatBody.length}next(){let e=this.flatBody[this.index];return this.index++,e}}Q["loreline._Script.ScriptBodyIterator"]=Xi,Xi.__name__="loreline._Script.ScriptBodyIterator",Object.assign(Xi.prototype,{__class__:Xi});class en{constructor(e,t){this.remaining=e,this.done=t}}Q["loreline._Timer.PendingTimer"]=en,en.__name__="loreline._Timer.PendingTimer",Object.assign(en.prototype,{__class__:en});class Zl{static register(e,t){Zl.timers.push(new en(e,t))}static update(e){if(Zl.timers.length==0)return;let t=Zl.timers.length;for(;--t>=0;){let l=Zl.timers[t];l.remaining-=e,l.remaining<=0&&(Zl.timers.splice(t,1),l.done())}}}Q["loreline.Timer"]=Zl,Zl.__name__="loreline.Timer";class yn{static uLength(e){return e.length}static uSubstr(e,t,l){return l!=null?c.substr(e,t,l):c.substr(e,t,null)}static uSubstring(e,t,l){return l!=null?e.substring(t,l):e.substring(t)}static uCharCodeAt(e,t){let l=c.cca(e,t);return l??-1}static uIndexOf(e,t,l){return e.indexOf(t,l)}static uLastIndexOf(e,t,l){return e.lastIndexOf(t,l)}static uToChars(e){return e.split("")}static uCharAt(e,t){return e.charAt(t)}}Q["loreline.Utf8"]=yn,yn.__name__="loreline.Utf8";class Li extends st{constructor(e,t,l){super(t,l),this.wrapped=e}}Q["loreline.WrappedError"]=Li,Li.__name__="loreline.WrappedError",Li.__super__=st,Object.assign(Li.prototype,{__class__:Li});class _n{static main(){}}Q["loreline.lib.Library"]=_n,_n.__name__="loreline.lib.Library";var G=Ye["loreline.lorscript.TType"]={__ename__:"loreline.lorscript.TType",__constructs__:null,TMono:(w=function(b){return{_hx_index:0,r:b,__enum__:"loreline.lorscript.TType",toString:F}},w._hx_name="TMono",w.__params__=["r"],w),TVoid:{_hx_name:"TVoid",_hx_index:1,__enum__:"loreline.lorscript.TType",toString:F},TInt:{_hx_name:"TInt",_hx_index:2,__enum__:"loreline.lorscript.TType",toString:F},TFloat:{_hx_name:"TFloat",_hx_index:3,__enum__:"loreline.lorscript.TType",toString:F},TBool:{_hx_name:"TBool",_hx_index:4,__enum__:"loreline.lorscript.TType",toString:F},TDynamic:{_hx_name:"TDynamic",_hx_index:5,__enum__:"loreline.lorscript.TType",toString:F},TParam:(w=function(b){return{_hx_index:6,name:b,__enum__:"loreline.lorscript.TType",toString:F}},w._hx_name="TParam",w.__params__=["name"],w),TUnresolved:(w=function(b){return{_hx_index:7,name:b,__enum__:"loreline.lorscript.TType",toString:F}},w._hx_name="TUnresolved",w.__params__=["name"],w),TNull:(w=function(b){return{_hx_index:8,t:b,__enum__:"loreline.lorscript.TType",toString:F}},w._hx_name="TNull",w.__params__=["t"],w),TInst:(w=function(b,e){return{_hx_index:9,c:b,args:e,__enum__:"loreline.lorscript.TType",toString:F}},w._hx_name="TInst",w.__params__=["c","args"],w),TEnum:(w=function(b,e){return{_hx_index:10,e:b,args:e,__enum__:"loreline.lorscript.TType",toString:F}},w._hx_name="TEnum",w.__params__=["e","args"],w),TType:(w=function(b,e){return{_hx_index:11,t:b,args:e,__enum__:"loreline.lorscript.TType",toString:F}},w._hx_name="TType",w.__params__=["t","args"],w),TAbstract:(w=function(b,e){return{_hx_index:12,a:b,args:e,__enum__:"loreline.lorscript.TType",toString:F}},w._hx_name="TAbstract",w.__params__=["a","args"],w),TFun:(w=function(b,e){return{_hx_index:13,args:b,ret:e,__enum__:"loreline.lorscript.TType",toString:F}},w._hx_name="TFun",w.__params__=["args","ret"],w),TAnon:(w=function(b){return{_hx_index:14,fields:b,__enum__:"loreline.lorscript.TType",toString:F}},w._hx_name="TAnon",w.__params__=["fields"],w),TLazy:(w=function(b){return{_hx_index:15,f:b,__enum__:"loreline.lorscript.TType",toString:F}},w._hx_name="TLazy",w.__params__=["f"],w)};G.__constructs__=[G.TMono,G.TVoid,G.TInt,G.TFloat,G.TBool,G.TDynamic,G.TParam,G.TUnresolved,G.TNull,G.TInst,G.TEnum,G.TType,G.TAbstract,G.TFun,G.TAnon,G.TLazy];var ve=Ye["loreline.lorscript._Checker.WithType"]={__ename__:"loreline.lorscript._Checker.WithType",__constructs__:null,NoValue:{_hx_name:"NoValue",_hx_index:0,__enum__:"loreline.lorscript._Checker.WithType",toString:F},Value:{_hx_name:"Value",_hx_index:1,__enum__:"loreline.lorscript._Checker.WithType",toString:F},WithType:(w=function(b){return{_hx_index:2,t:b,__enum__:"loreline.lorscript._Checker.WithType",toString:F}},w._hx_name="WithType",w.__params__=["t"],w)};ve.__constructs__=[ve.NoValue,ve.Value,ve.WithType];var dl=Ye["loreline.lorscript.CTypedecl"]={__ename__:"loreline.lorscript.CTypedecl",__constructs__:null,CTClass:(w=function(b){return{_hx_index:0,c:b,__enum__:"loreline.lorscript.CTypedecl",toString:F}},w._hx_name="CTClass",w.__params__=["c"],w),CTEnum:(w=function(b){return{_hx_index:1,e:b,__enum__:"loreline.lorscript.CTypedecl",toString:F}},w._hx_name="CTEnum",w.__params__=["e"],w),CTTypedef:(w=function(b){return{_hx_index:2,t:b,__enum__:"loreline.lorscript.CTypedecl",toString:F}},w._hx_name="CTTypedef",w.__params__=["t"],w),CTAlias:(w=function(b){return{_hx_index:3,t:b,__enum__:"loreline.lorscript.CTypedecl",toString:F}},w._hx_name="CTAlias",w.__params__=["t"],w),CTAbstract:(w=function(b){return{_hx_index:4,a:b,__enum__:"loreline.lorscript.CTypedecl",toString:F}},w._hx_name="CTAbstract",w.__params__=["a"],w)};dl.__constructs__=[dl.CTClass,dl.CTEnum,dl.CTTypedef,dl.CTAlias,dl.CTAbstract];class Bi{constructor(e,t){this.expr=e,this.t=t}}Q["loreline.lorscript.Completion"]=Bi,Bi.__name__="loreline.lorscript.Completion",Object.assign(Bi.prototype,{__class__:Bi});class tn{constructor(){this.types=new Ee,this.types=new Ee,this.types.h.Void=dl.CTAlias(G.TVoid),this.types.h.Int=dl.CTAlias(G.TInt),this.types.h.Float=dl.CTAlias(G.TFloat),this.types.h.Bool=dl.CTAlias(G.TBool),this.types.h.Dynamic=dl.CTAlias(G.TDynamic),this.parser=new ci}addXmlApi(e){let t=new Vi;t.process(e,"");let l=[],i=0,n=t.root;for(;i<n.length;){let r=n[i];++i,this.addXmlType(r,l)}let s=0;for(;s<l.length;){let r=l[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]=dl.CTClass(t),t}addXmlType(e,t){let l=this;switch(e._hx_index){case 0:let i=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 a=e.c;if(Object.prototype.hasOwnProperty.call(this.types.h,a.path))return;let h={name:a.path,params:[],fields:new Ee,statics:new Ee};this.addMeta(a,h),a.isInterface&&(h.isInterface=!0);let o=0,u=a.params;for(;o<u.length;){let v=u[o];++o,h.params.push(G.TParam(v))}t.push(function(){let v=new Ee,N=0,B=h.params;for(;N<B.length;){let M=B[N];++N;let D=a.path+"."+tt.typeStr(M);v.h[D]=M}if(l.localParams=v,a.superClass!=null){let M=l,D=a.superClass.path,U=[],z=0,J=a.superClass.params;for(;z<J.length;){let H=J[z];++z,U.push(l.makeXmlType(H))}h.superClass=M.getType(D,U)}if(a.interfaces!=null){h.interfaces=[];let M=0,D=a.interfaces;for(;M<D.length;){let U=D[M];++M;let z=h.interfaces,J=l,H=U.path,X=[],ae=0,ce=U.params;for(;ae<ce.length;){let ne=ce[ae];++ae,X.push(l.makeXmlType(ne))}z.push(J.getType(H,X))}}let L=[],I=function(M,D){if(M.isOverride||c.substr(M.name,0,4)=="get_"||c.substr(M.name,0,4)=="set_")return;let U=!M.name.startsWith("__"),z=0,J=M.meta;for(;z<J.length;){let re=J[z];if(++z,re.name==":noScript")return;re.name==":noCompletion"&&(U=!1)}let H=M.set,X;switch(H._hx_index){case 2:let re=H.m;X=!0;break;case 0:case 4:X=!0;break;default:X=!1}let ae={isPublic:M.isPublic,canWrite:X,complete:U,params:[],name:M.name,t:null},ce=0,ne=M.params;for(;ce<ne.length;){let re=ne[ce];++ce;let xe=G.TParam(re),Pe=M.name+"."+re;L.push(Pe),ae.params.push(xe),l.localParams.h[Pe]=xe}if(ae.t=l.makeXmlType(M.type),M.meta!=null&&M.meta.length>0){ae.meta=[];let re=0,xe=M.meta;for(;re<xe.length;){let Pe=xe[re];++re;let Ue=ae.meta,Je=Pe.name,lt=[],Ve=0,Qe=Pe.params;for(;Ve<Qe.length;){let at=Qe[Ve];++Ve;let Re;try{Re=l.parser.parseString(at)}catch($){if(T.caught($).unwrap()instanceof Se)Re=null;else throw $}lt.push(Re)}Ue.push({name:Je,params:lt})}}for(;L.length>0;){let re=l.localParams,xe=L.pop(),Pe=re;Object.prototype.hasOwnProperty.call(Pe.h,xe)&&delete Pe.h[xe]}ae.name=="new"?h.constructor=ae:D.set(M.name,ae)},W=0,q=a.fields;for(;W<q.length;){let M=q[W];++W,I(M,h.fields)}let P=0,R=a.statics;for(;P<R.length;){let M=R[P];++P,I(M,h.statics)}l.localParams=null}),this.types.h[h.name]=dl.CTClass(h);break;case 2:let p=e.e;if(Object.prototype.hasOwnProperty.call(this.types.h,p.path))return;let _={name:p.path,params:[],constructors:[]};this.addMeta(p,_);let m=0,f=p.params;for(;m<f.length;){let v=f[m];++m,_.params.push(G.TParam(v))}t.push(function(){let v=new Ee,N=0,B=_.params;for(;N<B.length;){let W=B[N];++N;let q=p.path+"."+tt.typeStr(W);v.h[q]=W}l.localParams=v;let L=0,I=p.constructors;for(;L<I.length;){let W=I[L];++L;let q=_.constructors,P=W.name,R;if(W.args==null)R=null;else{let M=[],D=0,U=W.args;for(;D<U.length;){let z=U[D];++D,M.push({name:z.name,opt:z.opt,t:l.makeXmlType(z.t)})}R=M}q.push({name:P,args:R})}l.localParams=null}),this.types.h[_.name]=dl.CTEnum(_);break;case 3:let g=e.t;if(Object.prototype.hasOwnProperty.call(this.types.h,g.path))return;let d={name:g.path,params:[],t:null},x=0,y=g.params;for(;x<y.length;){let v=y[x];++x,d.params.push(G.TParam(v))}g.path=="loreline.lorscript.TypeCheck"&&d.params.reverse(),t.push(function(){let v=new Ee,N=0,B=d.params;for(;N<B.length;){let L=B[N];++N;let I=g.path+"."+tt.typeStr(L);v.h[I]=L}l.localParams=v,d.t=l.makeXmlType(g.type),l.localParams=null}),this.types.h[g.path]=dl.CTTypedef(d);break;case 4:let S=e.a;if(Object.prototype.hasOwnProperty.call(this.types.h,S.path))return;let C={name:S.path,params:[],t:null};this.addMeta(S,C);let O=0,E=S.params;for(;O<E.length;){let v=E[O];++O,C.params.push(G.TParam(v))}t.push(function(){let v=new Ee,N=0,B=C.params;for(;N<B.length;){let L=B[N];++N;let I=S.path+"."+tt.typeStr(L);v.h[I]=L}l.localParams=v,C.t=l.makeXmlType(S.athis),l.localParams=null}),this.types.h[S.path]=dl.CTAbstract(C);break}}addMeta(e,t){if(e.meta==null||e.meta.length==0)return;t.meta=[];let l=0,i=e.meta;for(;l<i.length;){let n=i[l];++l;let s=t.meta,r=n.name,a=[],h=0,o=n.params;for(;h<o.length;){let u=o[h];++h;let p;try{p=this.parser.parseString(u)}catch(_){if(T.caught(_).unwrap()instanceof Se)p=null;else throw _}a.push(p)}s.push({name:r,params:a})}}makeXmlType(e){switch(e._hx_index){case 0:return G.TUnresolved("Unknown");case 1:let t=e.name,l=e.params,i=[],n=0;for(;n<l.length;){let B=l[n];++n,i.push(this.makeXmlType(B))}return this.getType(t,i);case 2:let s=e.name,r=e.params,a=[],h=0;for(;h<r.length;){let B=r[h];++h,a.push(this.makeXmlType(B))}return this.getType(s,a);case 3:let o=e.name,u=e.params,p=[],_=0;for(;_<u.length;){let B=u[_];++_,p.push(this.makeXmlType(B))}return this.getType(o,p);case 4:let m=e.args,f=e.ret,g=[],d=0;for(;d<m.length;){let B=m[d];++d,g.push({name:B.name,opt:B.opt,t:this.makeXmlType(B.t)})}return G.TFun(g,this.makeXmlType(f));case 5:let x=e.fields,y=[],S=0;for(;S<x.length;){let B=x[S];++S;let L=B.name,I=this.makeXmlType(B.type),W=B.meta,q;if(W==null)q=!1;else{let P=!1,R=0;for(;R<W.length;){let M=W[R];if(++R,M.name==":optional"){P=!0;break}}q=P}y.push({name:L,t:I,opt:q})}return G.TAnon(y);case 6:let C=e.t;return G.TDynamic;case 7:let O=e.name,E=e.params,v=[],N=0;for(;N<E.length;){let B=E[N];++N,v.push(this.makeXmlType(B))}return this.getType(O,v)}}getType(e,t){if(this.localParams!=null){let i=this.localParams.h[e];if(i!=null)return i}let l=this.resolve(e,t);if(l==null){let i=e.split(".");if(i.length>1){let n=i[i.length-2];if(c.cca(n,0)==95)return c.remove(i,n),this.getType(i.join("."),t)}return G.TUnresolved(e)}return l}resolve(e,t){if(e=="Null"){if(t==null||t.length!=1)throw T.thrown("Missing Null<T> parameter");return G.TNull(t[0])}let l=this.types.h[e];if(l==null)return null;switch(t==null&&(t=[]),l._hx_index){case 0:let i=l.c;return G.TInst(i,t);case 1:let n=l.e;return G.TEnum(n,t);case 2:let s=l.t;return G.TType(s,t);case 3:return l.t;case 4:let a=l.a;return G.TAbstract(a,t)}}}Q["loreline.lorscript.CheckerTypes"]=tn,tn.__name__="loreline.lorscript.CheckerTypes",Object.assign(tn.prototype,{__class__:tn});class tt{constructor(e){this.events=new Ee,this.globals=new Ee,e==null&&(e=new tn),this.types=e}setGlobals(e,t){t==null&&(t=!1);let l=this;for(;;){let i=e.fields.h,n=i,s=Object.keys(i),r=s.length,a=0;for(;a<r;){let o=n[s[a++]];if(o.isPublic||t){let u=o.params.length==0?o.t:G.TLazy(function(){let p=l,_=o.t,m=o.params,f=[],g=0,d=o.params.length;for(;g<d;){let x=g++;f.push(l.makeMono())}return p.apply(_,m,f)});this.setGlobal(o.name,u)}}if(e.superClass==null)break;let h=e.superClass;if(h==null)throw T.thrown("assert");if(h._hx_index==9){let o=h.args;e=h.c}else throw T.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 l=[],i=0,n=e.length;for(;i<n;){let s=i++,r=e[s],a=r.t==null?this.makeMono():this.makeType(r.t,t);l.push({name:r.name,opt:r.opt,t:a})}return l}check(e,t,l){l==null&&(l=!1),t==null&&(t=ve.NoValue),this.locals=new Ee,this.types.t_string==null&&(this.types.t_string=this.types.getType("String")),this.allowDefine=this.allowGlobalsDefine,this.isCompletion=l;let i=e.e,n;if(i._hx_index==14){let a=i.args,h=i.e,o=i.name,u=i.ret;n=!0}else n=!1;n&&(e=this.mk(K.EBlock([e]),e));let s=this,r=e.e;if(r._hx_index==4){let a=r.e,h=[],o=G.TVoid,u=0;for(;u<a.length;){let _=a[u];for(++u;;){let f=_.e;if(f._hx_index==25){let g=f.name,d=f.args;_=f.e}else break}let m=_.e;if(m._hx_index==14){let f=m.e,g=m.args,d=m.name,x=m.ret;if(d!=null){let y=x==null?this.makeMono():this.makeType(x,_),S=G.TFun(this.typeArgs(g,_),y);this.locals.h[d]=S,h.push(function(){return s.currentFunType=S,s.typeExpr(_,ve.NoValue),S})}else{let y=0;for(;y<h.length;){let S=h[y];++y,S()}h=[],a[a.length-1]==_?o=this.typeExpr(_,t):this.typeExpr(_,ve.NoValue)}}else{let f=0;for(;f<h.length;){let g=h[f];++f,g()}h=[],a[a.length-1]==_?o=this.typeExpr(_,t):this.typeExpr(_,ve.NoValue)}}let p=0;for(;p<h.length;){let _=h[p];++p,o=_()}return o}return this.typeExpr(e,t)}edef(e){return e.e}error(e,t){let l=Te.ECustom(e),i=new Se(l,t.pmin,t.pmax,t.origin,t.line);if(!this.isCompletion)throw T.thrown(i)}saveLocals(){let e=new Ee,t=this.locals.h,l=t,i=Object.keys(t),n=i.length,s=0;for(;s<n;){let r=i[s++];e.h[r]=this.locals.h[r]}return e}makeType(e,t){switch(e._hx_index){case 0:let l=e.path,i=e.params,n=this.types,s=l.join("."),r;if(i==null)r=[];else{let C=[],O=0;for(;O<i.length;){let E=i[O];++O,C.push(this.makeType(E,t))}r=C}let a=n.resolve(s,r);if(a==null){let C=Te.ECustom("Unknown type "+Y.string(l)),O=new Se(C,t.pmin,t.pmax,t.origin,t.line);if(!this.isCompletion)throw T.thrown(O);a=G.TDynamic}return a;case 1:let h=e.args,o=e.ret,u=0,p=[],_=0;for(;_<h.length;){let C=h[_];++_,p.push({name:"p"+u++,opt:!1,t:this.makeType(C,t)})}return G.TFun(p,this.makeType(o,t));case 2:let m=e.fields,f=[],g=0;for(;g<m.length;){let C=m[g];++g,f.push({name:C.name,opt:!1,t:this.makeType(C.t,t)})}return G.TAnon(f);case 3:let d=e.t;return this.makeType(d,t);case 4:let x=e.t;return this.makeType(x,t);case 5:let y=e.n,S=e.t;return this.makeType(S,t)}}linkLoop(e,t){if(t==e)return!0;switch(t._hx_index){case 0:let l=t.r;return l.r==null?!1:this.linkLoop(e,l.r);case 5:return t==G.TDynamic?!1:this.linkLoop(e,G.TDynamic);case 9:let i=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,a=t.args,h=0;for(;h<a.length;){let C=a[h];if(++h,this.linkLoop(e,C))return!0}return!1;case 11:let o=t.t,u=t.args,p=0;for(;p<u.length;){let C=u[p];if(++p,this.linkLoop(e,C))return!0}return!1;case 12:let _=t.a,m=t.args,f=0;for(;f<m.length;){let C=m[f];if(++f,this.linkLoop(e,C))return!0}return!1;case 13:let g=t.args,d=t.ret,x=0;for(;x<g.length;){let C=g[x];if(++x,this.linkLoop(e,C.t))return!0}return this.linkLoop(e,d);case 14:let y=t.fields,S=0;for(;S<y.length;){let C=y[S];if(++S,this.linkLoop(e,C.t))return!0}return!1;default:return!1}}link(e,t,l){return this.linkLoop(e,t)?this.follow(t)==e:(t==G.TDynamic||(l.r=t),!0)}typeEq(e,t){if(e==t)return!0;switch(e._hx_index){case 0:let l=e.r;return l.r==null?this.link(e,t,l)?(l.r=t,!0):!1:this.typeEq(l.r,t);case 8:let i=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 d=t.t,x=i;return this.typeEq(x,d);case 11:let y=t.t,S=t.args;return this.typeEq(e,this.apply(y.t,y.params,S));default:let C=i;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 d=t.t;return this.typeEq(e,d);case 9:let x=t.c,y=t.args,S=s;if(n==x){let v=0,N=S.length;for(;v<N;){let B=v++;if(!this.typeEq(S[B],y[B]))return!1}return!0}break;case 11:let O=t.t,E=t.args;return this.typeEq(e,this.apply(O.t,O.params,E));default:}break;case 10:let r=e.e,a=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 d=t.t;return this.typeEq(e,d);case 10:let x=t.e,y=t.args,S=a;if(r==x){let v=0,N=S.length;for(;v<N;){let B=v++;if(!this.typeEq(S[B],y[B]))return!1}return!0}break;case 11:let O=t.t,E=t.args;return this.typeEq(e,this.apply(O.t,O.params,E));default:}break;case 11:let h=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 d=t.t,x=o,y=h;return this.typeEq(this.apply(y.t,y.params,x),t);case 11:let S=t.t,C=t.args,O=o;if(h==S){let B=0,L=O.length;for(;B<L;){let I=B++;if(!this.typeEq(O[I],C[I]))return!1}return!0}else{let B=o,L=h;return this.typeEq(this.apply(L.t,L.params,B),t)}break;default:let v=o,N=h;return this.typeEq(this.apply(N.t,N.params,v),t)}break;case 12:let u=e.a,p=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 d=t.t;return this.typeEq(e,d);case 11:let x=t.t,y=t.args;return this.typeEq(e,this.apply(x.t,x.params,y));case 12:let S=t.a,C=t.args,O=p;if(u==S){let v=0,N=O.length;for(;v<N;){let B=v++;if(!this.typeEq(O[B],C[B]))return!1}return!0}break;default:}break;case 13:let _=e.args,m=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 d=t.t;return this.typeEq(e,d);case 11:let x=t.t,y=t.args;return this.typeEq(e,this.apply(x.t,x.params,y));case 13:let S=t.args,C=t.ret,O=m,E=_;if(E.length==S.length){let v=0,N=E.length;for(;v<N;){let B=v++;if(!this.typeEq(E[B].t,S[B].t))return!1}return this.typeEq(O,C)}break;default:}break;case 14:let f=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 d=t.t;return this.typeEq(e,d);case 11:let x=t.t,y=t.args;return this.typeEq(e,this.apply(x.t,x.params,y));case 14:let S=t.fields,C=f;if(C.length==S.length){let O=Object.create(null),E=0;for(;E<S.length;){let N=S[E];++E,O[N.name]=N}let v=0;for(;v<C.length;){let N=C[v];++v;let B=O[N.name];if(B==null||!this.typeEq(N.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 d=t.t;return this.typeEq(e,d);case 11:let x=t.t,y=t.args;return this.typeEq(e,this.apply(x.t,x.params,y));default:}}return!1}tryUnify(e,t){if(e==t)return!0;switch(e._hx_index){case 0:let l=e.r;return l.r==null?this.link(e,t,l)?(l.r=t,!0):!1:this.tryUnify(l.r,t);case 2:switch(t._hx_index){case 0:let p=t.r;return p.r==null?this.link(t,e,p)?(p.r=e,!0):!1:this.tryUnify(e,p.r);case 3:return!0;case 5:return!0;case 8:let _=t.t;return this.tryUnify(e,_);case 11:let m=t.t,f=t.args;return this.tryUnify(e,this.apply(m.t,m.params,f));default:}break;case 5:switch(t._hx_index){case 0:let p=t.r;return p.r==null?this.link(t,e,p)?(p.r=e,!0):!1:this.tryUnify(e,p.r);case 5:return!0;case 8:let _=t.t;return this.tryUnify(e,_);case 11:let m=t.t,f=t.args;return this.tryUnify(e,this.apply(m.t,m.params,f));default:return!0}break;case 8:let i=e.t;switch(t._hx_index){case 0:let p=t.r;return p.r==null?this.link(t,e,p)?(p.r=e,!0):!1:this.tryUnify(e,p.r);case 5:let _=i;return this.tryUnify(_,t);case 8:let m=t.t,f=i;return this.tryUnify(f,t);case 11:let g=t.t,d=t.args;return this.tryUnify(e,this.apply(g.t,g.params,d));default:let x=i;return this.tryUnify(x,t)}break;case 9:let n=e.c,s=e.args;switch(t._hx_index){case 0:let p=t.r;return p.r==null?this.link(t,e,p)?(p.r=e,!0):!1:this.tryUnify(e,p.r);case 5:return!0;case 8:let _=t.t;return this.tryUnify(e,_);case 9:let m=t.c,f=t.args,g=s,d=n;for(;d!=m;){if(d.interfaces!=null){let I=0,W=d.interfaces;for(;I<W.length;){let q=W[I];if(++I,q._hx_index==9){let P=q.c,R=q.args,M=[],D=0;for(;D<R.length;){let z=R[D];++D,M.push(this.apply(z,d.params,g))}let U=G.TInst(P,M);if(this.tryUnify(U,t))return!0}else throw T.thrown("assert")}}let L=d.superClass;if(L==null)return!1;if(L._hx_index==9){let I=L.c,W=L.args,q=[],P=0;for(;P<W.length;){let R=W[P];++P,q.push(this.apply(R,d.params,g))}g=q,d=I}else throw T.thrown("assert")}let x=0,y=g.length;for(;x<y;){let L=x++;if(!this.typeEq(g[L],f[L]))return!1}return!0;case 11:let S=t.t,C=t.args;return this.tryUnify(e,this.apply(S.t,S.params,C));case 14:let O=t.fields,E=s,v=n,N=0,B=O.length;for(;N<B;){let L=N++,I=O[L],W=null,q=v;for(;W=q.fields.h[I.name],W==null;){if(q.superClass==null)return!1;let P=q.superClass;if(P==null)throw T.thrown("assert");if(P._hx_index==9){let R=P.args;q=P.c}else throw T.thrown("assert")}if(!this.typeEq(this.apply(W.t,v.params,E),I.t))return!1}return!0;default:}break;case 11:let r=e.t,a=e.args;switch(t._hx_index){case 0:let p=t.r;return p.r==null?this.link(t,e,p)?(p.r=e,!0):!1:this.tryUnify(e,p.r);case 5:let _=a,m=r;return this.tryUnify(this.apply(m.t,m.params,_),t);case 8:let f=t.t,g=a,d=r;return this.tryUnify(this.apply(d.t,d.params,g),t);case 11:let x=t.t,y=t.args,S=a,C=r;return this.tryUnify(this.apply(C.t,C.params,S),t);default:let O=a,E=r;return this.tryUnify(this.apply(E.t,E.params,O),t)}break;case 13:let h=e.args,o=e.ret;switch(t._hx_index){case 0:let p=t.r;return p.r==null?this.link(t,e,p)?(p.r=e,!0):!1:this.tryUnify(e,p.r);case 5:return!0;case 8:let _=t.t;return this.tryUnify(e,_);case 11:let m=t.t,f=t.args;return this.tryUnify(e,this.apply(m.t,m.params,f));case 12:let g=t.a,d=t.args,x=g.meta,y=g.params,S=g.t;if(g.name=="haxe.Function")return!0;break;case 13:let C=t.args,O=t.ret,E=o,v=h;if(v.length==C.length){let N=0,B=v.length;for(;N<B;){let L=N++,I=v[L],W=C[L];if(W.opt&&!I.opt||!this.tryUnify(W.t,I.t))return!1}return this.tryUnify(E,O)}break;default:}break;case 14:let u=e.fields;switch(t._hx_index){case 0:let p=t.r;return p.r==null?this.link(t,e,p)?(p.r=e,!0):!1:this.tryUnify(e,p.r);case 5:return!0;case 8:let _=t.t;return this.tryUnify(e,_);case 11:let m=t.t,f=t.args;return this.tryUnify(e,this.apply(m.t,m.params,f));case 14:let g=t.fields,d=u;if(g.length==0)return!0;let x=Object.create(null),y=0;for(;y<d.length;){let C=d[y];++y,x[C.name]=C}let S=0;for(;S<g.length;){let C=g[S];++S;let O=x[C.name];if(O==null){if(C.opt)continue;return!1}if(!this.typeEq(O.t,C.t))return!1}return!0;default:}break;default:switch(t._hx_index){case 0:let p=t.r;return p.r==null?this.link(t,e,p)?(p.r=e,!0):!1:this.tryUnify(e,p.r);case 5:return!0;case 8:let _=t.t;return this.tryUnify(e,_);case 11:let m=t.t,f=t.args;return this.tryUnify(e,this.apply(m.t,m.params,f));default:}}return this.typeEq(e,t)}unify(e,t,l){if(!this.tryUnify(e,t)){let i=Te.ECustom(tt.typeStr(e)+" should be "+tt.typeStr(t)),n=new Se(i,l.pmin,l.pmax,l.origin,l.line);if(!this.isCompletion)throw T.thrown(n)}}apply(e,t,l){if(l.length!=t.length)throw T.thrown("Invalid number of type parameters");if(l.length==0)return e;let i=new ri,n=0,s=t.length;for(;n<s;){let h=n++;i.set(t[h],l[h])}let r=null,a=this;return r=function(h){let o=i.get(h);return o??a.mapType(h,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 i=e.name;return e;case 7:let n=e.name;return e;case 8:let s=e.t;return G.TNull(t(s));case 9:let r=e.args;if(r.length==0)return e;{let y=r,S=e.c,C=[],O=0;for(;O<y.length;){let E=y[O];++O,C.push(t(E))}return G.TInst(S,C)}break;case 10:let a=e.args;if(a.length==0)return e;{let y=a,S=e.e,C=[],O=0;for(;O<y.length;){let E=y[O];++O,C.push(t(E))}return G.TEnum(S,C)}break;case 11:let h=e.args;if(h.length==0)return e;{let y=h,S=e.t,C=[],O=0;for(;O<y.length;){let E=y[O];++O,C.push(t(E))}return G.TType(S,C)}break;case 12:let o=e.args;if(o.length==0)return e;{let y=o,S=e.a,C=[],O=0;for(;O<y.length;){let E=y[O];++O,C.push(t(E))}return G.TAbstract(S,C)}break;case 13:let u=e.args,p=e.ret,_=[],m=0;for(;m<u.length;){let y=u[m];++m,_.push({name:y.name,opt:y.opt,t:t(y.t)})}return G.TFun(_,t(p));case 14:let f=e.fields,g=[],d=0;for(;d<f.length;){let y=f[d];++d,g.push({name:y.name,opt:y.opt,t:t(y.t)})}return G.TAnon(g);case 15:let x=e.f;return t(x())}}follow(e){switch(e._hx_index){case 0:let t=e.r;return t.r!=null?this.follow(t.r):e;case 8:let l=e.t;return this.follow(l);case 11:let i=e.t,n=e.args;return this.follow(this.apply(i.t,i.params,n));case 15:let s=e.f;return this.follow(s());default:return e}}getFields(e){let t=[],l=this,i=this.follow(e);switch(i._hx_index){case 9:let n=i.c,s=i.args,r=function(p){return l.apply(p,n.params,s)};for(;n!=null;){let p=n.fields.h,_=p,m=Object.keys(p),f=m.length,g=0;for(;g<f;){let x=m[g++],y=n.fields.h[x];if(!y.isPublic||!y.complete)continue;let S=y.name,C=r(y.t);this.allowAsync&&S.startsWith("a_")&&(C=this.unasync(C),S=c.substr(S,2,null)),t.push({name:S,t:C})}if(n.isInterface&&n.interfaces!=null){let x=0,y=n.interfaces;for(;x<y.length;){let S=y[x];++x;let C=0,O=this.getFields(S);for(;C<O.length;){let E=O[C];++C,t.push({name:E.name,t:r(E.t)})}}}if(n.superClass==null)break;let d=n.superClass;if(d==null)break;if(d._hx_index==9){let x=d.c,y=d.args,S=r;r=function(C){return S(l.apply(C,x.params,y))},n=x}else break}break;case 13:let a=i.args,h=i.ret;this.isCompletion&&t.push({name:"bind",t:G.TFun(a,G.TVoid)});break;case 14:let o=i.fields,u=0;for(;u<o.length;){let p=o[u];++u,t.push({name:p.name,t:p.t})}break;default:}return t}getField(e,t,l,i){i==null&&(i=!1);let n=this.follow(e);switch(n._hx_index){case 5:return this.makeMono();case 9:let s=n.c,r=n.args,a=s.fields.h[t];if(a==null&&this.allowAsync&&(a=s.fields.h["a_"+t],a!=null&&(a={isPublic:!0,canWrite:!1,params:a.params,name:a.name,t:this.unasync(a.t),complete:a.complete},a.t==null&&(a=null))),a==null&&s.isInterface&&s.interfaces!=null){let p=0,_=s.interfaces;for(;p<_.length;){let m=_[p];++p;let f=this.getField(m,t,l,i);if(f!=null)return this.apply(f,s.params,r)}}if(a==null){if(s.superClass==null)return null;let p=this.getField(s.superClass,t,l,i);return p!=null&&(p=this.apply(p,s.params,r)),p}if(!a.isPublic){let p=Te.ECustom("Can't access private field "+t+" on "+s.name),_=new Se(p,l.pmin,l.pmax,l.origin,l.line);if(!this.isCompletion)throw T.thrown(_)}if(i&&!a.canWrite){let p=Te.ECustom("Can't write readonly field "+t+" on "+s.name),_=new Se(p,l.pmin,l.pmax,l.origin,l.line);if(!this.isCompletion)throw T.thrown(_)}let h=a.t;if(a.params!=null){let p=a.params,_=[],m=0,f=a.params.length;for(;m<f;){let g=m++;_.push(this.makeMono())}h=this.apply(h,p,_)}return this.apply(h,s.params,r);case 14:let o=n.fields,u=0;for(;u<o.length;){let p=o[u];if(++u,p.name==t)return p.t}return null;default:return null}}unasync(e){let t=this.follow(e);if(t._hx_index==13){let l=t.args,i=t.ret;if(l.length>0){let n=l.slice(),s=this.follow(n.shift().t);if(s._hx_index==13){let r=s.args,a=s.ret;if(r.length==1){let h=r[0];return G.TFun(n,h.t)}}}}return null}typeExprWith(e,t){let l=this.typeExpr(e,ve.WithType(t));return this.unify(l,t,e),t}makeMono(){return G.TMono({r:null})}makeIterator(e){return G.TAnon([{name:"next",opt:!1,t:G.TFun([],e)},{name:"hasNext",opt:!1,t:G.TFun([],G.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,l=e.args,i=t.constructor,n=t.fields,s=t.interfaces,r=t.isInterface,a=t.meta,h=t.params,o=t.statics,u=t.superClass;return t.name=="String"}else return!1}onCompletion(e,t){if(this.isCompletion)throw T.thrown(new Bi(e,t))}typeField(e,t,l,i){let n=this.typeExpr(e,ve.Value);t==null&&this.onCompletion(l,n);let s=this.getField(n,t,l,i);if(s==null){let r=Te.ECustom(tt.typeStr(n)+" has no field "+t),a=new Se(r,l.pmin,l.pmax,l.origin,l.line);if(!this.isCompletion)throw T.thrown(a);s=G.TDynamic}return s}typeExpr(e,t){if(e==null&&this.isCompletion)return t._hx_index==2?t.t:G.TDynamic;let l=this,i=e.e;switch(i._hx_index){case 0:let a=i.c;switch(a._hx_index){case 0:let fe=a.v;return G.TInt;case 1:let ke=a.f;return G.TFloat;case 2:let Fe=a.s;return this.types.t_string}break;case 1:let h=i.v,o=this.locals.h[h];if(o!=null)return o;let u=this.globals.h[h];if(u!=null){if(u==null)return u;if(u._hx_index==15){let fe=u.f;return fe()}else return u}if(this.allowAsync&&(u=this.globals.h["a_"+h],u!=null&&(u=this.unasync(u)),u!=null))return u;switch(h){case"false":case"true":return G.TBool;case"null":return this.makeMono();case"trace":return G.TDynamic;default:if(t._hx_index==2){let Fe=t.t;if(Fe._hx_index==10){let qe=Fe,Wt=Fe.e,Dt=Fe.args,ut=0,vl=Wt.constructors;for(;ut<vl.length;){let pl=vl[ut];if(++ut,pl.name==h){if(this.onTopDownEnum(Wt,h)){let mt=pl.args==null?qe:G.TFun(pl.args,qe);return this.apply(mt,Wt.params,Dt)}break}}}}if(this.isCompletion)return G.TDynamic;let fe=Te.ECustom("Unknown identifier "+h),ke=new Se(fe,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw T.thrown(ke)}break;case 2:let p=i.n,_=i.t,m=i.e,f=_==null?this.makeMono():this.makeType(_,e);if(m!=null){let fe=this.typeExpr(m,_==null?ve.Value:ve.WithType(f));_==null?f=fe:this.unify(fe,f,m)}return this.locals.h[p]=f,G.TVoid;case 3:let g=i.e;return this.typeExpr(g,t);case 4:let d=i.e,x=G.TVoid,y=this.saveLocals(),S=0;for(;S<d.length;){let fe=d[S];++S,x=this.typeExpr(fe,fe==d[d.length-1]?t:ve.NoValue)}return this.locals=y,x;case 5:let C=i.e,O=i.f;return this.typeField(C,O,e,!1);case 6:let E=i.op,v=i.e1,N=i.e2;switch(E){case"!=":case"==":let fe=this.typeExpr(v,ve.Value),ke=this.typeExpr(N,ve.WithType(fe));return this.tryUnify(fe,ke)||this.unify(ke,fe,N),G.TBool;case"%":case"*":case"-":case"/":let Fe=this.typeExpr(v,ve.WithType(G.TInt)),qe=this.typeExpr(N,ve.WithType(Fe));this.tryUnify(Fe,qe)||this.unify(qe,Fe,N);let Wt=this.follow(Fe),Dt=this.follow(qe);switch(Wt._hx_index){case 2:switch(Dt._hx_index){case 2:return E=="/"?G.TFloat:G.TInt;case 3:case 5:return G.TFloat;default:this.unify(Fe,G.TFloat,v),this.unify(qe,G.TFloat,N)}break;case 3:switch(Dt._hx_index){case 2:case 3:case 5:return G.TFloat;default:this.unify(Fe,G.TFloat,v),this.unify(qe,G.TFloat,N)}break;case 5:switch(Dt._hx_index){case 2:case 3:case 5:return G.TFloat;default:this.unify(Fe,G.TFloat,v),this.unify(qe,G.TFloat,N)}break;default:this.unify(Fe,G.TFloat,v),this.unify(qe,G.TFloat,N)}break;case"+":let ut=this.typeExpr(v,ve.WithType(G.TInt)),vl=this.typeExpr(N,ve.WithType(ut));this.tryUnify(ut,vl);let pl=this.follow(ut),mt=this.follow(vl);switch(pl._hx_index){case 2:switch(mt._hx_index){case 2:return G.TInt;case 3:return G.TFloat;case 5:return G.TDynamic;default:let Pt=pl,Tl=mt;if(this.isString(Pt)||this.isString(Tl))return this.types.t_string;this.unify(Pt,G.TFloat,v),this.unify(Tl,G.TFloat,N)}break;case 3:switch(mt._hx_index){case 2:case 3:return G.TFloat;case 5:return G.TDynamic;default:let Pt=pl,Tl=mt;if(this.isString(Pt)||this.isString(Tl))return this.types.t_string;this.unify(Pt,G.TFloat,v),this.unify(Tl,G.TFloat,N)}break;case 5:return G.TDynamic;default:if(mt._hx_index==5)return G.TDynamic;{let Pt=pl,Tl=mt;if(this.isString(Pt)||this.isString(Tl))return this.types.t_string;this.unify(Pt,G.TFloat,v),this.unify(Tl,G.TFloat,N)}}break;case"...":return this.typeExprWith(v,G.TInt),this.typeExprWith(N,G.TInt),this.makeIterator(G.TInt);case"&":case"<<":case">>":case">>>":case"^":case"|":return this.typeExprWith(v,G.TInt),this.typeExprWith(N,G.TInt),G.TInt;case"<":case"<=":case">":case">=":let Qt=this.typeExpr(v,ve.Value),zl=this.typeExpr(N,ve.WithType(Qt));this.tryUnify(Qt,zl)||this.unify(zl,Qt,N);let pi=this.follow(Qt);switch(pi._hx_index){case 2:case 3:case 4:break;case 9:let Pt=pi.c,Tl=pi.args,dn=Pt.constructor,jn=Pt.fields,Kn=Pt.interfaces,Jn=Pt.isInterface,Hn=Pt.meta,Gn=Pt.params,Qn=Pt.statics,$n=Pt.superClass;if(Pt.name!="String"){let Vn=Te.ECustom("Cannot compare "+tt.typeStr(Qt)),qn=new Se(Vn,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw T.thrown(qn)}break;default:let Rn=Te.ECustom("Cannot compare "+tt.typeStr(Qt)),Un=new Se(Rn,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw T.thrown(Un)}return G.TBool;case"=":if(this.allowDefine){let Pt=v.e;if(Pt._hx_index==1){let Tl=Pt.v;if(!Object.prototype.hasOwnProperty.call(this.locals.h,Tl)&&!Object.prototype.hasOwnProperty.call(this.globals.h,Tl)){let dn=this.typeExpr(N,ve.Value);return this.locals.h[Tl]=dn,dn}}}let Ai,an=v.e;if(an._hx_index==5){let Pt=an.e,Tl=an.f;Ai=this.typeField(Pt,Tl,v,!0)}else Ai=this.typeExpr(v,ve.Value);return this.typeExprWith(N,Ai),Ai;case"&&":case"||":return this.typeExprWith(v,G.TBool),this.typeExprWith(N,G.TBool),G.TBool;default:if(c.cca(E,E.length-1)==61){let Pt=this.typeExpr(this.mk(K.EBinop(c.substr(E,0,E.length-1),v,N),e),t);return this.typeExpr(this.mk(K.EBinop("=",v,N),e),t)}let Dn=Te.ECustom("Unsupported operation "+E),An=new Se(Dn,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw T.thrown(An)}break;case 7:let B=i.prefix,L=i.op,I=i.e,W=this.typeExpr(I,ve.Value);switch(L){case"!":return this.unify(W,G.TBool,I),W;case"++":case"-":case"--":return this.unify(W,G.TInt,I),W;default:}break;case 8:let q=i.e,P=i.params,R=q.e;if(R._hx_index==5&&R.f=="bind"){let fe=R.e,ke=this.typeExpr(fe,ve.Value);if(ke._hx_index==13){let Fe=ke.args,qe=ke.ret,Wt=Fe.slice(),Dt=0;for(;Dt<P.length;){let ut=P[Dt];++Dt;let vl=Wt.shift();if(vl==null){let pl=Te.ECustom("Too many arguments"),mt=new Se(pl,ut.pmin,ut.pmax,ut.origin,ut.line);if(!this.isCompletion)throw T.thrown(mt);return G.TFun([],qe)}this.typeExprWith(ut,vl.t)}return G.TFun(Wt,qe)}}let M=q.e,D;if(M._hx_index==1){let fe=M.v;if(t._hx_index==2){let ke=t.t;if(ke._hx_index==10){let Fe=ke.e,qe=ke.args;D=t}else D=ve.Value}else D=ve.Value}else D=ve.Value;let U=this.typeExpr(q,D),z=this.follow(U);switch(z._hx_index){case 5:let fe=0;for(;fe<P.length;){let mt=P[fe];++fe,this.typeExpr(mt,ve.Value)}return this.makeMono();case 13:let ke=z.args,Fe=z.ret,qe=0,Wt=P.length;for(;qe<Wt;){let mt=qe++,Qt=ke[mt];if(Qt==null){let pi=P[mt],Ai=Te.ECustom("Too many arguments"),an=new Se(Ai,pi.pmin,pi.pmax,pi.origin,pi.line);if(!this.isCompletion)throw T.thrown(an);break}let zl=this.typeExpr(P[mt],Qt==null?ve.Value:ve.WithType(Qt.t));this.unify(zl,Qt.t,P[mt])}let Dt=P.length,ut=ke.length;for(;Dt<ut;){let mt=Dt++;if(!ke[mt].opt){let Qt=Te.ECustom("Missing argument "+ke[mt].name+":"+tt.typeStr(ke[mt].t)),zl=new Se(Qt,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw T.thrown(zl)}}return Fe;default:let vl=Te.ECustom(tt.typeStr(U)+" cannot be called"),pl=new Se(vl,q.pmin,q.pmax,q.origin,q.line);if(!this.isCompletion)throw T.thrown(pl);return this.makeMono()}break;case 9:let J=i.cond,H=i.e1,X=i.e2;this.typeExprWith(J,G.TBool);let ae=this.typeExpr(H,t);if(X==null)return ae;let ce=this.typeExpr(X,t);if(t==ve.NoValue)return G.TVoid;if(this.tryUnify(ce,ae))return ae;if(this.tryUnify(ae,ce))return ce;this.unify(ce,ae,X);break;case 10:let ne=i.cond,re=i.e;return this.typeExprWith(ne,G.TBool),this.typeExpr(re,ve.NoValue),G.TVoid;case 11:let xe=i.v,Pe=i.it,Ue=i.e,Je=this.saveLocals(),lt=this.typeExpr(Pe,ve.Value),Ve=this.getIteratorType(Pe,lt);return this.locals.h[xe]=Ve,this.typeExpr(Ue,ve.NoValue),this.locals=Je,G.TVoid;case 12:case 13:return G.TVoid;case 14:let Qe=i.args,at=i.e,Re=i.name,$=i.ret,se=null,j=null,ie=null;if(this.currentFunType!=null){let fe=this.currentFunType;if(fe._hx_index==13){let ke=fe.args,Fe=fe.ret;se=this.currentFunType,j=Fe,ie=ke}else throw T.thrown("assert");this.currentFunType=null}else j=$==null?this.makeMono():this.makeType($,e);let le=this.saveLocals(),ee=this.allowReturn,pe=this.allowDefine,me=this.hasReturn;this.allowReturn=j,this.allowDefine=!1,this.hasReturn=!1;let we=null,Ze;if(Re!=null){let fe;if(t._hx_index==2){let ke=this.follow(t.t);if(ke._hx_index==13){let Fe=ke.args,qe=ke.ret;fe=!0}else fe=!1}else fe=!1;Ze=!fe}else Ze=!1;if(Ze){let fe=this.events.h[Re];fe!=null&&(t=ve.WithType(fe))}if(t._hx_index==2){let fe=this.follow(t.t);if(fe._hx_index==13){let ke=fe.args,Fe=fe.ret;we=ke,this.unify(j,Fe,e)}}ie==null&&(ie=this.typeArgs(Qe,e));let yt=0,Le=ie.length;for(;yt<Le;){let fe=yt++,ke=ie[fe];if(we!=null)if(fe<we.length)this.unify(we[fe].t,ke.t,e);else{let Fe=Te.ECustom("Extra argument "+ke.name),qe=new Se(Fe,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw T.thrown(qe)}this.locals.h[ke.name]=ke.t}if(we!=null&&ie.length<we.length){let fe="Missing "+(we.length-ie.length)+" arguments (",ke=[],Fe=ie.length,qe=we.length;for(;Fe<qe;){let ut=Fe++;ke.push(tt.typeStr(we[ut].t))}let Wt=Te.ECustom(fe+ke.join(",")+")"),Dt=new Se(Wt,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw T.thrown(Dt)}if(this.typeExpr(at,ve.NoValue),!this.hasReturn&&!this.tryUnify(j,G.TVoid)){let fe=Te.ECustom("Missing return "+tt.typeStr(j)),ke=new Se(fe,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw T.thrown(ke)}return this.allowDefine=pe,this.allowReturn=ee,this.hasReturn=me,this.locals=le,se==null&&(se=G.TFun(ie,j),Re!=null&&(le.h[Re]=se)),se;case 15:let dt=i.e,Oe=dt==null?G.TVoid:this.typeExpr(dt,this.allowReturn==null?ve.Value:ve.WithType(this.allowReturn));if(this.hasReturn=!0,this.allowReturn==null){let fe=Te.ECustom("Return not allowed here"),ke=new Se(fe,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw T.thrown(ke)}else this.unify(Oe,this.allowReturn,dt??e);return this.makeMono();case 16:let Ie=i.e,pt=i.index;this.typeExprWith(pt,G.TInt);let it=this.typeExpr(Ie,ve.Value),Ot=this.follow(it);if(Ot._hx_index==9){let fe=Ot.c,ke=Ot.args,Fe=fe.constructor,qe=fe.fields,Wt=fe.interfaces,Dt=fe.isInterface,ut=fe.meta,vl=fe.params,pl=fe.statics,mt=fe.superClass;if(fe.name=="Array"){if(ke.length==1)return ke[0];{let Qt=Te.ECustom(tt.typeStr(it)+" is not an Array"),zl=new Se(Qt,Ie.pmin,Ie.pmax,Ie.origin,Ie.line);if(!this.isCompletion)throw T.thrown(zl)}}else{let Qt=Te.ECustom(tt.typeStr(it)+" is not an Array"),zl=new Se(Qt,Ie.pmin,Ie.pmax,Ie.origin,Ie.line);if(!this.isCompletion)throw T.thrown(zl)}}else{let fe=Te.ECustom(tt.typeStr(it)+" is not an Array"),ke=new Se(fe,Ie.pmin,Ie.pmax,Ie.origin,Ie.line);if(!this.isCompletion)throw T.thrown(ke)}break;case 17:let Yt=i.e,xt=null,ol=0;for(;ol<Yt.length;){let fe=Yt[ol];++ol;let ke=this.typeExpr(fe,xt==null?ve.Value:ve.WithType(xt));xt==null?xt=ke:this.tryUnify(ke,xt)||(this.tryUnify(xt,ke)?xt=ke:this.unify(ke,xt,fe))}return xt==null&&(xt=this.makeMono()),this.types.getType("Array",[xt]);case 18:let $e=i.cl,Vt=i.params;break;case 19:let Bt=i.e;return this.typeExpr(Bt,ve.Value),this.makeMono();case 20:let qt=i.e,wt=i.v,Ht=i.t,Zt=i.ecatch,Gt=this.typeExpr(qt,t),ul=this.locals.h[wt],cl=this.locals,Xt=this.makeType(Ht,Zt);cl.h[wt]=Xt;let nt=this.typeExpr(Zt,t);if(ul!=null)this.locals.h[wt]=ul;else{let fe=this.locals;Object.prototype.hasOwnProperty.call(fe.h,wt)&&delete fe.h[wt]}return t==ve.NoValue?G.TVoid:this.tryUnify(Gt,nt)?nt:(this.unify(nt,Gt,Zt),Gt);case 21:let Sl=i.fl;if(t._hx_index==2){let fe=this.follow(t.t);if(fe._hx_index==14){let ke=fe.fields;if(ke.length>0){let Fe=Object.create(null),qe=0;for(;qe<ke.length;){let ut=ke[qe];++qe,Fe[ut.name]=ut}let Wt=[],Dt=0;for(;Dt<Sl.length;){let ut=Sl[Dt];++Dt;let vl=Fe[ut.name],pl;if(vl==null){let mt=ut.e,Qt=Te.ECustom("Extra field "+ut.name),zl=new Se(Qt,mt.pmin,mt.pmax,mt.origin,mt.line);if(!this.isCompletion)throw T.thrown(zl);pl=G.TDynamic}else pl=vl.t;Wt.push({t:this.typeExprWith(ut.e,pl),opt:!1,name:ut.name})}return G.TAnon(Wt)}else{let Fe=[],qe=0;for(;qe<Sl.length;){let Wt=Sl[qe];++qe,Fe.push({t:this.typeExpr(Wt.e,ve.Value),opt:!1,name:Wt.name})}return G.TAnon(Fe)}}else{let ke=[],Fe=0;for(;Fe<Sl.length;){let qe=Sl[Fe];++Fe,ke.push({t:this.typeExpr(qe.e,ve.Value),opt:!1,name:qe.name})}return G.TAnon(ke)}}else{let fe=[],ke=0;for(;ke<Sl.length;){let Fe=Sl[ke];++ke,fe.push({t:this.typeExpr(Fe.e,ve.Value),opt:!1,name:Fe.name})}return G.TAnon(fe)}break;case 22:let Ce=i.cond,rt=i.e1,_t=i.e2;this.typeExprWith(Ce,G.TBool);let ot=this.typeExpr(rt,t);if(_t==null)return ot;let bt=this.typeExpr(_t,t);if(t==ve.NoValue)return G.TVoid;if(this.tryUnify(bt,ot))return ot;if(this.tryUnify(ot,bt))return bt;this.unify(bt,ot,_t);break;case 23:let Ct=i.e,Mt=i.cases,el=i.defaultExpr,Tt=null,rn=this.typeExpr(Ct,ve.Value),yi=0;for(;yi<Mt.length;){let fe=Mt[yi];++yi;let ke=0,Fe=fe.values;for(;ke<Fe.length;){let Dt=Fe[ke];++ke;let ut=this.typeExpr(Dt,ve.WithType(rn));this.unify(ut,rn,Dt)}let qe=this.typeExpr(fe.expr,t),Wt=fe.expr;t!=ve.NoValue&&(Tt==null?Tt=qe:l.tryUnify(qe,Tt)||(l.unify(Tt,qe,Wt),Tt=qe))}if(el!=null){let fe=this.typeExpr(el,t);t!=ve.NoValue&&(Tt==null?Tt=fe:l.tryUnify(fe,Tt)||(l.unify(Tt,fe,el),Tt=fe))}return t==ve.NoValue?G.TVoid:Tt??this.makeMono();case 24:let si=i.cond,mn=i.e;return this.typeExprWith(si,G.TBool),this.typeExpr(mn,ve.NoValue),G.TVoid;case 25:let zn=i.args,Mn=i.name,Fn=i.e;return Mn==":untyped"&&this.allowUntypedMeta?this.makeMono():this.typeExpr(Fn,t);case 26:let Cn=i.e,Ln=i.t,gn=this.makeType(Ln,e),Bn=this.typeExpr(Cn,ve.WithType(gn));return this.unify(Bn,gn,Cn),gn}let n=e.e,s=Te.ECustom("Don't know how to type "+Ye[n.__enum__].__constructs__[n._hx_index]._hx_name),r=new Se(s,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw T.thrown(r);return G.TDynamic}getIteratorType(e,t){let l=this.follow(t);if(l._hx_index==9){let r=l.c,a=l.args,h=r.constructor,o=r.fields,u=r.interfaces,p=r.isInterface,_=r.meta,m=r.params,f=r.statics,g=r.superClass;if(r.name=="Array"&&a.length==1)return a[0]}let i=this.getField(t,"iterator",e);if(i==null&&t._hx_index==12){let r=t.a,a=t.args,h=this.apply(r.t,r.params,a);return this.getIteratorType(e,h)}i!=null&&(i==null?i=null:i._hx_index==13&&i.args.length==0?i=i.ret:i=null);let n=this.makeMono(),s=this.makeIterator(n);return this.unify(i??t,s,e),n}static typeStr(e){switch(e._hx_index){case 0:let t=e.r;return t.r==null?"Unknown":tt.typeStr(t.r);case 6:return e.name;case 7:return"?"+e.name;case 8:let n=e.t;return"Null<"+tt.typeStr(n)+">";case 9:let s=e.c,r=e.args,a=s.name,h;if(r.length==0)h="";else{let L=[],I=0;for(;I<r.length;){let W=r[I];++I,L.push(tt.typeStr(W))}h="<"+L.join(",")+">"}return a+h;case 10:let o=e.e,u=e.args,p=o.name,_;if(u.length==0)_="";else{let L=[],I=0;for(;I<u.length;){let W=u[I];++I,L.push(tt.typeStr(W))}_="<"+L.join(",")+">"}return p+_;case 11:let m=e.t,f=e.args;if(m.name=="loreline.lorscript.TypeCheck")return tt.typeStr(f[1]);{let L=m.name,I;if(f.length==0)I="";else{let W=[],q=0;for(;q<f.length;){let P=f[q];++q,W.push(tt.typeStr(P))}I="<"+W.join(",")+">"}return L+I}break;case 12:let g=e.a,d=e.args,x=g.name,y;if(d.length==0)y="";else{let L=[],I=0;for(;I<d.length;){let W=d[I];++I,L.push(tt.typeStr(W))}y="<"+L.join(",")+">"}return x+y;case 13:let S=e.args,C=e.ret,O=[],E=0;for(;E<S.length;){let L=S[E];++E,O.push((L.opt?"?":"")+(L.name==""?"":L.name+":")+tt.typeStr(L.t))}return"("+O.join(", ")+") -> "+tt.typeStr(C);case 14:let v=e.fields,N=[],B=0;for(;B<v.length;){let L=v[B];++B,N.push((L.opt?"?":"")+L.name+":"+tt.typeStr(L.t))}return"{"+N.join(", ")+"}";default:return c.substr(Ye[e.__enum__].__constructs__[e._hx_index]._hx_name,1,null)}}static typeIter(e,t){switch(e._hx_index){case 0:let l=e.r;l.r!=null&&t(l.r);break;case 8:let i=e.t;t(i);break;case 9:let n=e.c,s=e.args,r=0;for(;r<s.length;){let E=s[r];++r,t(E)}break;case 10:let a=e.e,h=e.args,o=0;for(;o<h.length;){let E=h[o];++o,t(E)}break;case 11:let u=e.t,p=e.args,_=0;for(;_<p.length;){let E=p[_];++_,t(E)}break;case 12:let m=e.a,f=e.args,g=0;for(;g<f.length;){let E=f[g];++g,t(E)}break;case 13:let d=e.args,x=e.ret,y=0;for(;y<d.length;){let E=d[y];++y,t(E.t)}t(x);break;case 14:let S=e.fields,C=0;for(;C<S.length;){let E=S[C];++C,t(E.t)}break;case 15:let O=e.f;t(O());break;default:}}}Q["loreline.lorscript.Checker"]=tt,tt.__name__="loreline.lorscript.Checker",Object.assign(tt.prototype,{__class__:tt});var yl=Ye["loreline.lorscript.Const"]={__ename__:"loreline.lorscript.Const",__constructs__:null,CInt:(w=function(b){return{_hx_index:0,v:b,__enum__:"loreline.lorscript.Const",toString:F}},w._hx_name="CInt",w.__params__=["v"],w),CFloat:(w=function(b){return{_hx_index:1,f:b,__enum__:"loreline.lorscript.Const",toString:F}},w._hx_name="CFloat",w.__params__=["f"],w),CString:(w=function(b){return{_hx_index:2,s:b,__enum__:"loreline.lorscript.Const",toString:F}},w._hx_name="CString",w.__params__=["s"],w)};yl.__constructs__=[yl.CInt,yl.CFloat,yl.CString];var K=Ye["loreline.lorscript.ExprDef"]={__ename__:"loreline.lorscript.ExprDef",__constructs__:null,EConst:(w=function(b){return{_hx_index:0,c:b,__enum__:"loreline.lorscript.ExprDef",toString:F}},w._hx_name="EConst",w.__params__=["c"],w),EIdent:(w=function(b){return{_hx_index:1,v:b,__enum__:"loreline.lorscript.ExprDef",toString:F}},w._hx_name="EIdent",w.__params__=["v"],w),EVar:(w=function(b,e,t){return{_hx_index:2,n:b,t:e,e:t,__enum__:"loreline.lorscript.ExprDef",toString:F}},w._hx_name="EVar",w.__params__=["n","t","e"],w),EParent:(w=function(b){return{_hx_index:3,e:b,__enum__:"loreline.lorscript.ExprDef",toString:F}},w._hx_name="EParent",w.__params__=["e"],w),EBlock:(w=function(b){return{_hx_index:4,e:b,__enum__:"loreline.lorscript.ExprDef",toString:F}},w._hx_name="EBlock",w.__params__=["e"],w),EField:(w=function(b,e){return{_hx_index:5,e:b,f:e,__enum__:"loreline.lorscript.ExprDef",toString:F}},w._hx_name="EField",w.__params__=["e","f"],w),EBinop:(w=function(b,e,t){return{_hx_index:6,op:b,e1:e,e2:t,__enum__:"loreline.lorscript.ExprDef",toString:F}},w._hx_name="EBinop",w.__params__=["op","e1","e2"],w),EUnop:(w=function(b,e,t){return{_hx_index:7,op:b,prefix:e,e:t,__enum__:"loreline.lorscript.ExprDef",toString:F}},w._hx_name="EUnop",w.__params__=["op","prefix","e"],w),ECall:(w=function(b,e){return{_hx_index:8,e:b,params:e,__enum__:"loreline.lorscript.ExprDef",toString:F}},w._hx_name="ECall",w.__params__=["e","params"],w),EIf:(w=function(b,e,t){return{_hx_index:9,cond:b,e1:e,e2:t,__enum__:"loreline.lorscript.ExprDef",toString:F}},w._hx_name="EIf",w.__params__=["cond","e1","e2"],w),EWhile:(w=function(b,e){return{_hx_index:10,cond:b,e,__enum__:"loreline.lorscript.ExprDef",toString:F}},w._hx_name="EWhile",w.__params__=["cond","e"],w),EFor:(w=function(b,e,t){return{_hx_index:11,v:b,it:e,e:t,__enum__:"loreline.lorscript.ExprDef",toString:F}},w._hx_name="EFor",w.__params__=["v","it","e"],w),EBreak:{_hx_name:"EBreak",_hx_index:12,__enum__:"loreline.lorscript.ExprDef",toString:F},EContinue:{_hx_name:"EContinue",_hx_index:13,__enum__:"loreline.lorscript.ExprDef",toString:F},EFunction:(w=function(b,e,t,l){return{_hx_index:14,args:b,e,name:t,ret:l,__enum__:"loreline.lorscript.ExprDef",toString:F}},w._hx_name="EFunction",w.__params__=["args","e","name","ret"],w),EReturn:(w=function(b){return{_hx_index:15,e:b,__enum__:"loreline.lorscript.ExprDef",toString:F}},w._hx_name="EReturn",w.__params__=["e"],w),EArray:(w=function(b,e){return{_hx_index:16,e:b,index:e,__enum__:"loreline.lorscript.ExprDef",toString:F}},w._hx_name="EArray",w.__params__=["e","index"],w),EArrayDecl:(w=function(b){return{_hx_index:17,e:b,__enum__:"loreline.lorscript.ExprDef",toString:F}},w._hx_name="EArrayDecl",w.__params__=["e"],w),ENew:(w=function(b,e){return{_hx_index:18,cl:b,params:e,__enum__:"loreline.lorscript.ExprDef",toString:F}},w._hx_name="ENew",w.__params__=["cl","params"],w),EThrow:(w=function(b){return{_hx_index:19,e:b,__enum__:"loreline.lorscript.ExprDef",toString:F}},w._hx_name="EThrow",w.__params__=["e"],w),ETry:(w=function(b,e,t,l){return{_hx_index:20,e:b,v:e,t,ecatch:l,__enum__:"loreline.lorscript.ExprDef",toString:F}},w._hx_name="ETry",w.__params__=["e","v","t","ecatch"],w),EObject:(w=function(b){return{_hx_index:21,fl:b,__enum__:"loreline.lorscript.ExprDef",toString:F}},w._hx_name="EObject",w.__params__=["fl"],w),ETernary:(w=function(b,e,t){return{_hx_index:22,cond:b,e1:e,e2:t,__enum__:"loreline.lorscript.ExprDef",toString:F}},w._hx_name="ETernary",w.__params__=["cond","e1","e2"],w),ESwitch:(w=function(b,e,t){return{_hx_index:23,e:b,cases:e,defaultExpr:t,__enum__:"loreline.lorscript.ExprDef",toString:F}},w._hx_name="ESwitch",w.__params__=["e","cases","defaultExpr"],w),EDoWhile:(w=function(b,e){return{_hx_index:24,cond:b,e,__enum__:"loreline.lorscript.ExprDef",toString:F}},w._hx_name="EDoWhile",w.__params__=["cond","e"],w),EMeta:(w=function(b,e,t){return{_hx_index:25,name:b,args:e,e:t,__enum__:"loreline.lorscript.ExprDef",toString:F}},w._hx_name="EMeta",w.__params__=["name","args","e"],w),ECheckType:(w=function(b,e){return{_hx_index:26,e:b,t:e,__enum__:"loreline.lorscript.ExprDef",toString:F}},w._hx_name="ECheckType",w.__params__=["e","t"],w)};K.__constructs__=[K.EConst,K.EIdent,K.EVar,K.EParent,K.EBlock,K.EField,K.EBinop,K.EUnop,K.ECall,K.EIf,K.EWhile,K.EFor,K.EBreak,K.EContinue,K.EFunction,K.EReturn,K.EArray,K.EArrayDecl,K.ENew,K.EThrow,K.ETry,K.EObject,K.ETernary,K.ESwitch,K.EDoWhile,K.EMeta,K.ECheckType];var sl=Ye["loreline.lorscript.CType"]={__ename__:"loreline.lorscript.CType",__constructs__:null,CTPath:(w=function(b,e){return{_hx_index:0,path:b,params:e,__enum__:"loreline.lorscript.CType",toString:F}},w._hx_name="CTPath",w.__params__=["path","params"],w),CTFun:(w=function(b,e){return{_hx_index:1,args:b,ret:e,__enum__:"loreline.lorscript.CType",toString:F}},w._hx_name="CTFun",w.__params__=["args","ret"],w),CTAnon:(w=function(b){return{_hx_index:2,fields:b,__enum__:"loreline.lorscript.CType",toString:F}},w._hx_name="CTAnon",w.__params__=["fields"],w),CTParent:(w=function(b){return{_hx_index:3,t:b,__enum__:"loreline.lorscript.CType",toString:F}},w._hx_name="CTParent",w.__params__=["t"],w),CTOpt:(w=function(b){return{_hx_index:4,t:b,__enum__:"loreline.lorscript.CType",toString:F}},w._hx_name="CTOpt",w.__params__=["t"],w),CTNamed:(w=function(b,e){return{_hx_index:5,n:b,t:e,__enum__:"loreline.lorscript.CType",toString:F}},w._hx_name="CTNamed",w.__params__=["n","t"],w)};sl.__constructs__=[sl.CTPath,sl.CTFun,sl.CTAnon,sl.CTParent,sl.CTOpt,sl.CTNamed];class Se{constructor(e,t,l,i,n){this.e=e,this.pmin=t,this.pmax=l,this.origin=i,this.line=n}toString(){return ki.errorToString(this)}}Q["loreline.lorscript.Error"]=Se,Se.__name__="loreline.lorscript.Error",Object.assign(Se.prototype,{__class__:Se});var Te=Ye["loreline.lorscript.ErrorDef"]={__ename__:"loreline.lorscript.ErrorDef",__constructs__:null,EInvalidChar:(w=function(b){return{_hx_index:0,c:b,__enum__:"loreline.lorscript.ErrorDef",toString:F}},w._hx_name="EInvalidChar",w.__params__=["c"],w),EUnexpected:(w=function(b){return{_hx_index:1,s:b,__enum__:"loreline.lorscript.ErrorDef",toString:F}},w._hx_name="EUnexpected",w.__params__=["s"],w),EUnterminatedString:{_hx_name:"EUnterminatedString",_hx_index:2,__enum__:"loreline.lorscript.ErrorDef",toString:F},EUnterminatedComment:{_hx_name:"EUnterminatedComment",_hx_index:3,__enum__:"loreline.lorscript.ErrorDef",toString:F},EInvalidPreprocessor:(w=function(b){return{_hx_index:4,msg:b,__enum__:"loreline.lorscript.ErrorDef",toString:F}},w._hx_name="EInvalidPreprocessor",w.__params__=["msg"],w),EUnknownVariable:(w=function(b){return{_hx_index:5,v:b,__enum__:"loreline.lorscript.ErrorDef",toString:F}},w._hx_name="EUnknownVariable",w.__params__=["v"],w),EInvalidIterator:(w=function(b){return{_hx_index:6,v:b,__enum__:"loreline.lorscript.ErrorDef",toString:F}},w._hx_name="EInvalidIterator",w.__params__=["v"],w),EInvalidOp:(w=function(b){return{_hx_index:7,op:b,__enum__:"loreline.lorscript.ErrorDef",toString:F}},w._hx_name="EInvalidOp",w.__params__=["op"],w),EInvalidAccess:(w=function(b){return{_hx_index:8,f:b,__enum__:"loreline.lorscript.ErrorDef",toString:F}},w._hx_name="EInvalidAccess",w.__params__=["f"],w),ECustom:(w=function(b){return{_hx_index:9,msg:b,__enum__:"loreline.lorscript.ErrorDef",toString:F}},w._hx_name="ECustom",w.__params__=["msg"],w)};Te.__constructs__=[Te.EInvalidChar,Te.EUnexpected,Te.EUnterminatedString,Te.EUnterminatedComment,Te.EInvalidPreprocessor,Te.EUnknownVariable,Te.EInvalidIterator,Te.EInvalidOp,Te.EInvalidAccess,Te.ECustom];var ni=Ye["loreline.lorscript.ModuleDecl"]={__ename__:"loreline.lorscript.ModuleDecl",__constructs__:null,DPackage:(w=function(b){return{_hx_index:0,path:b,__enum__:"loreline.lorscript.ModuleDecl",toString:F}},w._hx_name="DPackage",w.__params__=["path"],w),DImport:(w=function(b,e){return{_hx_index:1,path:b,everything:e,__enum__:"loreline.lorscript.ModuleDecl",toString:F}},w._hx_name="DImport",w.__params__=["path","everything"],w),DClass:(w=function(b){return{_hx_index:2,c:b,__enum__:"loreline.lorscript.ModuleDecl",toString:F}},w._hx_name="DClass",w.__params__=["c"],w),DTypedef:(w=function(b){return{_hx_index:3,c:b,__enum__:"loreline.lorscript.ModuleDecl",toString:F}},w._hx_name="DTypedef",w.__params__=["c"],w)};ni.__constructs__=[ni.DPackage,ni.DImport,ni.DClass,ni.DTypedef];var Al=Ye["loreline.lorscript.FieldAccess"]={__ename__:"loreline.lorscript.FieldAccess",__constructs__:null,APublic:{_hx_name:"APublic",_hx_index:0,__enum__:"loreline.lorscript.FieldAccess",toString:F},APrivate:{_hx_name:"APrivate",_hx_index:1,__enum__:"loreline.lorscript.FieldAccess",toString:F},AInline:{_hx_name:"AInline",_hx_index:2,__enum__:"loreline.lorscript.FieldAccess",toString:F},AOverride:{_hx_name:"AOverride",_hx_index:3,__enum__:"loreline.lorscript.FieldAccess",toString:F},AStatic:{_hx_name:"AStatic",_hx_index:4,__enum__:"loreline.lorscript.FieldAccess",toString:F},AMacro:{_hx_name:"AMacro",_hx_index:5,__enum__:"loreline.lorscript.FieldAccess",toString:F}};Al.__constructs__=[Al.APublic,Al.APrivate,Al.AInline,Al.AOverride,Al.AStatic,Al.AMacro];var ln=Ye["loreline.lorscript.FieldKind"]={__ename__:"loreline.lorscript.FieldKind",__constructs__:null,KFunction:(w=function(b){return{_hx_index:0,f:b,__enum__:"loreline.lorscript.FieldKind",toString:F}},w._hx_name="KFunction",w.__params__=["f"],w),KVar:(w=function(b){return{_hx_index:1,v:b,__enum__:"loreline.lorscript.FieldKind",toString:F}},w._hx_name="KVar",w.__params__=["v"],w)};ln.__constructs__=[ln.KFunction,ln.KVar];var Rl=Ye["loreline.lorscript._Interp.Stop"]={__ename__:"loreline.lorscript._Interp.Stop",__constructs__:null,SBreak:{_hx_name:"SBreak",_hx_index:0,__enum__:"loreline.lorscript._Interp.Stop",toString:F},SContinue:{_hx_name:"SContinue",_hx_index:1,__enum__:"loreline.lorscript._Interp.Stop",toString:F},SReturn:{_hx_name:"SReturn",_hx_index:2,__enum__:"loreline.lorscript._Interp.Stop",toString:F}};Rl.__constructs__=[Rl.SBreak,Rl.SContinue,Rl.SReturn];class nn{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,l=We.makeVarArgs(function(i){let n=e.posInfos(),s=i.shift();i.length>0&&(n.customParams=i),Ri.trace(Y.string(s),n)});t.h.trace=l}posInfos(){return this.curExpr!=null?{fileName:this.curExpr.origin,lineNumber:this.curExpr.line}:{fileName:"lorscript",lineNumber:0}}initOps(){let e=this;this.binops=new Ee,this.binops.h["+"]=function(t,l){return e.expr(t)+e.expr(l)},this.binops.h["-"]=function(t,l){return e.expr(t)-e.expr(l)},this.binops.h["*"]=function(t,l){return e.expr(t)*e.expr(l)},this.binops.h["/"]=function(t,l){return e.expr(t)/e.expr(l)},this.binops.h["%"]=function(t,l){return e.expr(t)%e.expr(l)},this.binops.h["&"]=function(t,l){return e.expr(t)&e.expr(l)},this.binops.h["|"]=function(t,l){return e.expr(t)|e.expr(l)},this.binops.h["^"]=function(t,l){return e.expr(t)^e.expr(l)},this.binops.h["<<"]=function(t,l){return e.expr(t)<<e.expr(l)},this.binops.h[">>"]=function(t,l){return e.expr(t)>>e.expr(l)},this.binops.h[">>>"]=function(t,l){return e.expr(t)>>>e.expr(l)},this.binops.h["=="]=function(t,l){return e.expr(t)==e.expr(l)},this.binops.h["!="]=function(t,l){return e.expr(t)!=e.expr(l)},this.binops.h[">="]=function(t,l){let i=e.expr(t),n=e.expr(l);return i>=n},this.binops.h["<="]=function(t,l){let i=e.expr(t),n=e.expr(l);return i<=n},this.binops.h[">"]=function(t,l){let i=e.expr(t),n=e.expr(l);return i>n},this.binops.h["<"]=function(t,l){let i=e.expr(t),n=e.expr(l);return i<n},this.binops.h["||"]=function(t,l){return e.expr(t)!=!0?e.expr(l)==!0:!0},this.binops.h["&&"]=function(t,l){return e.expr(t)==!0?e.expr(l)==!0:!1},this.binops.h["="]=be(this,this.assign),this.binops.h["..."]=function(t,l){return new bi(e.expr(t),e.expr(l))},this.binops.h.is=function(t,l){return te.__instanceof(e.expr(t),e.expr(l))},this.assignOp("+=",function(t,l){return t+l}),this.assignOp("-=",function(t,l){return t-l}),this.assignOp("*=",function(t,l){return t*l}),this.assignOp("/=",function(t,l){return t/l}),this.assignOp("%=",function(t,l){return t%l}),this.assignOp("&=",function(t,l){return t&l}),this.assignOp("|=",function(t,l){return t|l}),this.assignOp("^=",function(t,l){return t^l}),this.assignOp("<<=",function(t,l){return t<<l}),this.assignOp(">>=",function(t,l){return t>>l}),this.assignOp(">>>=",function(t,l){return t>>>l})}setVar(e,t){if(!Object.prototype.hasOwnProperty.call(this.variables.h,e))he.setField(this.interpreter,this.interpreter.topLevelState.fields,e,t);else throw T.thrown("Invalid assign");return t}assign(e,t){let l=this.expr(t),i=e.e;switch(i._hx_index){case 1:let n=i.v,s=this.locals.h[n];s==null?this.setVar(n,l):s.r=l;break;case 5:let r=i.e,a=i.f;l=this.set(this.expr(r),a,l);break;case 16:let h=i.e,o=i.index,u=this.expr(h),p=this.expr(o);oe.isArray(u)?oe.arraySet(u,p,l):he.isFields(u)?he.setField(this.interpreter,u,p,l):te.__implements(u,Et)?te.__cast(u,Et).set(p,l):u[p]=l;break;default:let _=new Se(Te.EInvalidOp("="),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw T.thrown(_)}return l}assignOp(e,t){let l=this;this.binops.h[e]=function(i,n){return l.evalAssignOp(e,t,i,n)}}evalAssignOp(e,t,l,i){let n,s=l.e;switch(s._hx_index){case 1:let r=s.v,a=this.locals.h[r];n=t(this.expr(l),this.expr(i)),a==null?this.setVar(r,n):a.r=n;break;case 5:let h=s.e,o=s.f,u=this.expr(h);n=t(this.get(u,o),this.expr(i)),n=this.set(u,o,n);break;case 16:let p=s.e,_=s.index,m=this.expr(p),f=this.expr(_);oe.isArray(m)?(n=t(oe.arrayGet(m,f),this.expr(i)),oe.arraySet(m,f,n)):he.isFields(m)?(n=t(he.getField(this.interpreter,m,f),this.expr(i)),he.setField(this.interpreter,m,f,n)):te.__implements(m,Et)?(n=t(te.__cast(m,Et).get(f),this.expr(i)),te.__cast(m,Et).set(f,n)):(n=t(m[f],this.expr(i)),m[f]=n);break;default:let g=new Se(Te.EInvalidOp(e),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw T.thrown(g)}return n}increment(e,t,l){this.curExpr=e;let i=e.e;switch(i._hx_index){case 1:let n=i.v,s=this.locals.h[n],r=s==null?this.resolve(n):s.r;return t?(r+=l,s==null?this.setVar(n,r):s.r=r):s==null?this.setVar(n,r+l):s.r=r+l,r;case 5:let a=i.e,h=i.f,o=this.expr(a),u=this.get(o,h);return t?(u+=l,this.set(o,h,u)):this.set(o,h,u+l),u;case 16:let p=i.e,_=i.index,m=this.expr(p),f=this.expr(_);if(oe.isArray(m)){let d=oe.arrayGet(m,f);return t?(d+=l,oe.arraySet(m,f,d)):oe.arraySet(m,f,d+l),d}else if(he.isFields(m)){let d=he.getField(this.interpreter,m,f);return t?(d+=l,he.setField(this.interpreter,m,f,d)):he.setField(this.interpreter,m,f,d+l),d}else if(te.__implements(m,Et)){let d=te.__cast(m,Et).get(f);return t?(d+=l,te.__cast(m,Et).set(f,d)):te.__cast(m,Et).set(f,d+l),d}else{let d=m[f];return t?(d+=l,m[f]=d):m[f]=d+l,d}break;default:let g=new Se(Te.EInvalidOp(l>0?"++":"--"),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw T.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 l=T.caught(t).unwrap();if(te.__instanceof(l,Rl))switch(l._hx_index){case 0:throw T.thrown("Invalid break");case 1:throw T.thrown("Invalid continue");case 2:let n=this.returnValue;return this.returnValue=null,n}else throw t}}duplicate(e){let t=new Ee,l=e.h,i=l,n=Object.keys(l),s=n.length,r=0;for(;r<s;){let a=n[r++];t.h[a]=e.h[a]}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 l=new Se(e,this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw T.thrown(l)}rethrow(e){throw T.thrown(e)}resolve(e){let t=this.variables.h[e];if(t==null&&!Object.prototype.hasOwnProperty.call(this.variables.h,e)){if(he.fieldExists(this.interpreter,this.interpreter.topLevelState.fields,e))return he.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 l=this.interpreter.resolveBeatByName(e);if(l!=null)return l;let i=new Se(Te.EUnknownVariable(e),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw T.thrown(i)}return t}expr(e){this.curExpr=e;let t=e.e,l=this;switch(t._hx_index){case 0:let i=t.c;switch(i._hx_index){case 0:return i.v;case 1:return i.f;case 2:return i.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,a=t.n,h=t.e;this.declared.push({n:a,old:this.locals.h[a]});let o=this.locals,u=h==null?null:this.expr(h);return o.h[a]={r:u},null;case 3:let p=t.e;return this.expr(p);case 4:let _=t.e,m=this.declared.length,f=null,g=0;for(;g<_.length;){let Ce=_[g];++g,f=this.expr(Ce)}return this.restore(m),f;case 5:let d=t.e,x=t.f;return this.get(this.expr(d),x);case 6:let y=t.op,S=t.e1,C=t.e2,O=this.binops.h[y];if(O==null){let Ce=new Se(Te.EInvalidOp(y),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw T.thrown(Ce)}return O(S,C);case 7:let E=t.op,v=t.prefix,N=t.e;switch(E){case"!":return this.expr(N)!=!0;case"++":return this.increment(N,v,1);case"-":return-this.expr(N);case"--":return this.increment(N,v,-1);case"~":return~this.expr(N);default:let Ce=new Se(Te.EInvalidOp(E),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw T.thrown(Ce)}break;case 8:let B=t.e,L=t.params,I=[],W=0;for(;W<L.length;){let Ce=L[W];++W,I.push(this.expr(Ce))}let q=B.e;if(q._hx_index==5){let Ce=q.e,rt=q.f,_t=this.expr(Ce);if(_t==null){let ot=new Se(Te.EInvalidAccess(rt),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw T.thrown(ot)}return this.fcall(_t,rt,I)}else return this.call(null,this.expr(B),I);break;case 9:let P=t.cond,R=t.e1,M=t.e2;return this.expr(P)==!0?this.expr(R):M==null?null:this.expr(M);case 10:let D=t.cond,U=t.e;return this.whileLoop(D,U),null;case 11:let z=t.v,J=t.it,H=t.e;return this.forLoop(z,J,H),null;case 12:throw T.thrown(Rl.SBreak);case 13:throw T.thrown(Rl.SContinue);case 14:let X=t.ret,ae=t.args,ce=t.e,ne=t.name,re=this.duplicate(this.locals),xe=this,Pe=!1,Ue=0,Je=0;for(;Je<ae.length;){let Ce=ae[Je];++Je,Ce.opt||Ce.value!=null?Pe=!0:Ue+=1}let lt=function(Ce){if((Ce==null?0:Ce.length)!=ae.length){if(Ce.length<Ue){let si="Invalid number of parameters. Got "+Ce.length+", required "+Ue;ne!=null&&(si+=" for function '"+ne+"'");let mn=new Se(Te.ECustom(si),l.curExpr.pmin,l.curExpr.pmax,l.curExpr.origin,l.curExpr.line);throw T.thrown(mn)}let el=[],Tt=Ce.length-Ue,rn=0,yi=0;for(;yi<ae.length;){let si=ae[yi];++yi,si.opt||si.value!=null?Tt>0?(el.push(Ce[rn++]),--Tt):el.push(si.value!=null?xe.expr(si.value):null):el.push(Ce[rn++])}Ce=el}let rt=xe.locals,_t=xe.depth;xe.depth++,xe.locals=xe.duplicate(re);let ot=0,bt=ae.length;for(;ot<bt;){let el=ot++;xe.locals.h[ae[el].name]={r:Ce[el]}}let Ct=null,Mt=l.declared.length;if(l.inTry)try{Ct=xe.exprReturn(ce)}catch(el){let Tt=T.caught(el).unwrap();throw l.restore(Mt),xe.locals=rt,xe.depth=_t,T.thrown(Tt)}else Ct=xe.exprReturn(ce);return l.restore(Mt),xe.locals=rt,xe.depth=_t,Ct},Ve=We.makeVarArgs(lt);if(ne!=null)if(this.depth==0)this.variables.h[ne]=Ve;else{this.declared.push({n:ne,old:this.locals.h[ne]});let Ce={r:Ve};this.locals.h[ne]=Ce,re.h[ne]=Ce}return Ve;case 15:let Qe=t.e;throw this.returnValue=Qe==null?null:this.expr(Qe),T.thrown(Rl.SReturn);case 16:let at=t.e,Re=t.index,$=this.expr(at),se=this.expr(Re);return oe.isArray($)?oe.arrayGet($,se):he.isFields($)?he.getField(this.interpreter,$,se):te.__implements($,Et)?te.__cast($,Et).get(se):$[se];case 17:let j=t.e,ie;if(j.length>0){let Ce=j[0].e;if(Ce._hx_index==6){let rt=Ce.e1,_t=Ce.e2;ie=Ce.op=="=>"}else ie=!1}else ie=!1;if(ie){let Ce=[],rt=[],_t=0;for(;_t<j.length;){let ot=j[_t];++_t;let bt=ot.e;if(bt._hx_index==6)if(bt.op=="=>"){let Ct=bt.e1,Mt=bt.e2;Ce.push(this.expr(Ct)),rt.push(this.expr(Mt))}else{this.curExpr=ot;let Ct=new Se(Te.ECustom("Invalid map key=>value expression"),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw T.thrown(Ct)}else{this.curExpr=ot;let Ct=new Se(Te.ECustom("Invalid map key=>value expression"),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw T.thrown(Ct)}}return this.makeMap(Ce,rt)}else{let Ce=[],rt=0;for(;rt<j.length;){let _t=j[rt];++rt,Ce.push(this.expr(_t))}return Ce}break;case 18:let le=t.cl,ee=t.params,pe=[],me=0;for(;me<ee.length;){let Ce=ee[me];++me,pe.push(this.expr(Ce))}return this.cnew(le,pe);case 19:let we=t.e;throw T.thrown(this.expr(we));case 20:let Ze=t.t,yt=t.e,Le=t.v,dt=t.ecatch,Oe=this.declared.length,Ie=this.inTry;try{this.inTry=!0;let Ce=this.expr(yt);return this.restore(Oe),this.inTry=Ie,Ce}catch(Ce){let rt=T.caught(Ce).unwrap();if(te.__instanceof(rt,Rl)){let _t=rt;throw this.inTry=Ie,T.thrown(_t)}else{let _t=rt;this.restore(Oe),this.inTry=Ie,this.declared.push({n:Le,old:this.locals.h[Le]}),this.locals.h[Le]={r:_t};let ot=this.expr(dt);return this.restore(Oe),ot}}break;case 21:let pt=t.fl,it=he.createFields(this.interpreter),Ot=0;for(;Ot<pt.length;){let Ce=pt[Ot];++Ot,he.setField(this.interpreter,it,Ce.name,this.expr(Ce.e))}return it;case 22:let Yt=t.cond,xt=t.e1,ol=t.e2;return this.expr(Yt)==!0?this.expr(xt):this.expr(ol);case 23:let $e=t.e,Vt=t.cases,Bt=t.defaultExpr,qt=this.expr($e),wt=!1,Ht=0;for(;Ht<Vt.length;){let Ce=Vt[Ht];++Ht;let rt=0,_t=Ce.values;for(;rt<_t.length;){let ot=_t[rt];if(++rt,this.expr(ot)==qt){wt=!0;break}}if(wt){qt=this.expr(Ce.expr);break}}return wt||(qt=Bt==null?null:this.expr(Bt)),qt;case 24:let Zt=t.cond,Gt=t.e;return this.doWhileLoop(Zt,Gt),null;case 25:let ul=t.name,cl=t.args,Xt=t.e;return this.expr(Xt);case 26:let nt=t.t,Sl=t.e;return this.expr(Sl)}}doWhileLoop(e,t){let l=this.declared.length,i=this;do{let n=!0;try{i.expr(t)}catch(s){let r=T.caught(s).unwrap();if(te.__instanceof(r,Rl)){let a=r;switch(a._hx_index){case 0:n=!1;break;case 1:break;case 2:throw T.thrown(a)}}else throw s}if(!n)break}while(this.expr(e)==!0);this.restore(l)}whileLoop(e,t){let l=this.declared.length,i=this;for(;this.expr(e)==!0;){let n=!0;try{i.expr(t)}catch(s){let r=T.caught(s).unwrap();if(te.__instanceof(r,Rl)){let a=r;switch(a._hx_index){case 0:n=!1;break;case 1:break;case 2:throw T.thrown(a)}}else throw s}if(!n)break}this.restore(l)}makeIterator(e){if(e instanceof Array)return new Il(e);if(oe.isArray(e))return oe.getIterator(e);if(e.iterator!=null&&(e=bn(e)),e.hasNext==null||e.next==null){let t=new Se(Te.EInvalidIterator(e),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw T.thrown(t)}return e}forLoop(e,t,l){let i=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,a={r:n.next()};r.h[e]=a;let h=!0;try{s.expr(l)}catch(o){let u=T.caught(o).unwrap();if(te.__instanceof(u,Rl)){let p=u;switch(p._hx_index){case 0:h=!1;break;case 1:break;case 2:throw T.thrown(p)}}else throw o}if(!h)break}this.restore(i)}loopRun(e){let t=!0;try{e()}catch(l){let i=T.caught(l).unwrap();if(te.__instanceof(i,Rl)){let n=i;switch(n._hx_index){case 0:t=!1;break;case 1:break;case 2:throw T.thrown(n)}}else throw l}return t}isMap(e){return te.__implements(e,Et)}getMapValue(e,t){return te.__cast(e,Et).get(t)}setMapValue(e,t,l){te.__cast(e,Et).set(t,l)}makeMap(e,t){let l=!0,i=!0,n=!0,s=!0,r=0;for(;r<e.length;){let h=e[r];++r,l=l&&typeof h=="string",i=i&&typeof h=="number"&&(h|0)===h,n=n&&We.isObject(h),s=s&&We.isEnumValue(h)}if(i){let h=new Kl,o=0,u=e;for(;o<u.length;){let p=u[o],m=o++,f=p;h.h[f]=t[m]}return h}if(l){let h=new Ee,o=0,u=e;for(;o<u.length;){let p=u[o],m=o++,f=p;h.h[f]=t[m]}return h}if(s){let h=new ri,o=0,u=e;for(;o<u.length;){let p=u[o],m=o++,f=p;h.set(f,t[m])}return h}if(n){let h=new Ti,o=0,u=e;for(;o<u.length;){let p=u[o],m=o++,f=p;h.set(f,t[m])}return h}let a=new Se(Te.ECustom("Invalid map keys "+Y.string(e)),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw T.thrown(a)}get(e,t){if(e==null){let l=new Se(Te.EInvalidAccess(t),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw T.thrown(l)}return he.isFields(e)?he.getField(this.interpreter,e,t):We.getProperty(e,t)}set(e,t,l){if(e==null){let i=new Se(Te.EInvalidAccess(t),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw T.thrown(i)}return he.isFields(e)?(he.setField(this.interpreter,e,t,l),l):(We.setProperty(e,t,l),l)}fcall(e,t,l){let i=null;return typeof e=="string"?i=he.getStringHelper(this.interpreter,t):oe.isArray(e)?i=he.getArrayHelper(this.interpreter,t):e instanceof Me?i=he.getBeatHelper(this.interpreter,t):he.isFields(e)&&(i=he.getMapHelper(this.interpreter,t)),i!=null&&We.isFunction(i)?(l.splice(0,0,e),this.call(null,i,l)):this.call(e,this.get(e,t),l)}call(e,t,l){return t.apply(e,l)}cnew(e,t){let l=Q[e];return l==null&&(l=this.resolve(e)),_e.createInstance(l,t)}static __keepIntIterator(){let e=new bi(0,0);return[be(e,e.hasNext),be(e,e.next)]}}Q["loreline.lorscript.Interp"]=nn,nn.__name__="loreline.lorscript.Interp",Object.assign(nn.prototype,{__class__:nn});var Z=Ye["loreline.lorscript.Token"]={__ename__:"loreline.lorscript.Token",__constructs__:null,TEof:{_hx_name:"TEof",_hx_index:0,__enum__:"loreline.lorscript.Token",toString:F},TConst:(w=function(b){return{_hx_index:1,c:b,__enum__:"loreline.lorscript.Token",toString:F}},w._hx_name="TConst",w.__params__=["c"],w),TId:(w=function(b){return{_hx_index:2,s:b,__enum__:"loreline.lorscript.Token",toString:F}},w._hx_name="TId",w.__params__=["s"],w),TOp:(w=function(b){return{_hx_index:3,s:b,__enum__:"loreline.lorscript.Token",toString:F}},w._hx_name="TOp",w.__params__=["s"],w),TPOpen:{_hx_name:"TPOpen",_hx_index:4,__enum__:"loreline.lorscript.Token",toString:F},TPClose:{_hx_name:"TPClose",_hx_index:5,__enum__:"loreline.lorscript.Token",toString:F},TBrOpen:{_hx_name:"TBrOpen",_hx_index:6,__enum__:"loreline.lorscript.Token",toString:F},TBrClose:{_hx_name:"TBrClose",_hx_index:7,__enum__:"loreline.lorscript.Token",toString:F},TDot:{_hx_name:"TDot",_hx_index:8,__enum__:"loreline.lorscript.Token",toString:F},TQuestionDot:{_hx_name:"TQuestionDot",_hx_index:9,__enum__:"loreline.lorscript.Token",toString:F},TComma:{_hx_name:"TComma",_hx_index:10,__enum__:"loreline.lorscript.Token",toString:F},TSemicolon:{_hx_name:"TSemicolon",_hx_index:11,__enum__:"loreline.lorscript.Token",toString:F},TBkOpen:{_hx_name:"TBkOpen",_hx_index:12,__enum__:"loreline.lorscript.Token",toString:F},TBkClose:{_hx_name:"TBkClose",_hx_index:13,__enum__:"loreline.lorscript.Token",toString:F},TQuestion:{_hx_name:"TQuestion",_hx_index:14,__enum__:"loreline.lorscript.Token",toString:F},TDoubleDot:{_hx_name:"TDoubleDot",_hx_index:15,__enum__:"loreline.lorscript.Token",toString:F},TMeta:(w=function(b){return{_hx_index:16,s:b,__enum__:"loreline.lorscript.Token",toString:F}},w._hx_name="TMeta",w.__params__=["s"],w),TPrepro:(w=function(b){return{_hx_index:17,s:b,__enum__:"loreline.lorscript.Token",toString:F}},w._hx_name="TPrepro",w.__params__=["s"],w)};Z.__constructs__=[Z.TEof,Z.TConst,Z.TId,Z.TOp,Z.TPOpen,Z.TPClose,Z.TBrOpen,Z.TBrClose,Z.TDot,Z.TQuestionDot,Z.TComma,Z.TSemicolon,Z.TBkOpen,Z.TBkClose,Z.TQuestion,Z.TDoubleDot,Z.TMeta,Z.TPrepro];class ci{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,l=e.length;for(;t<l;){let a=t++,h=0,o=e[a];for(;h<o.length;){let u=o[h];++h,this.opPriority.h[u]=a,a==9&&(this.opRightAssoc.h[u]=!0)}}let i="!";this.opPriority.h[i]=i=="++"||i=="--"?-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,l){if(!this.resumeErrors)throw T.thrown(new Se(e,t,l,this.origin,this.line))}invalidChar(e){if(!this.resumeErrors)throw T.thrown(new Se(Te.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 Ui,this.offset=t,this.char=-1,this.ops=[],this.idents=[],this.uid=0;let l=0,i=this.opChars.length;for(;l<i;){let r=l++;this.ops[c.cca(this.opChars,r)]=!0}let n=0,s=this.identChars.length;for(;n<s;){let r=n++;this.idents[c.cca(this.identChars,r)]=!0}}parseString(e,t,l){l==null&&(l=0),t==null&&(t="loreline.lorscript"),this.initParser(t,l),this.input=e,this.readPos=0;let i=[];for(;;){let n=this.token();if(n==Z.TEof)break;this.tokens.push({t:n,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,this.parseFullExpr(i)}if(i.length==1)return i[0];{let n=K.EBlock(i),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=Te.EUnexpected(this.tokenString(e));if(!this.resumeErrors)throw T.thrown(new Se(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();_e.enumEq(t,e)||this.unexpected(t)}maybe(e){let t=this.token();return _e.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,l){return e==null?null:(t==null&&(t=this.tokenMin),l==null&&(l=this.tokenMax),{e,pmin:t,pmax:l,origin:this.origin,line:this.line})}isBlock(e){if(e==null)return!1;let t=e.e;switch(t._hx_index){case 2:let l=t.n,i=t.t,n=t.e;if(n!=null)return this.isBlock(n);if(i!=null){if(i==null)return!1;if(i._hx_index==2){let X=i.fields;return!0}else return!1}else return!1;break;case 4:let s=t.e;return!0;case 6:let r=t.op,a=t.e1,h=t.e2;return this.isBlock(h);case 7:let o=t.op,u=t.prefix,p=t.e;return u?!1:this.isBlock(p);case 9:let _=t.cond,m=t.e1,f=t.e2;return f!=null?this.isBlock(f):this.isBlock(m);case 10:let g=t.cond,d=t.e;return this.isBlock(d);case 11:let x=t.v,y=t.it,S=t.e;return this.isBlock(S);case 14:let C=t.args,O=t.name,E=t.ret,v=t.e;return this.isBlock(v);case 15:let N=t.e;return N!=null?this.isBlock(N):!1;case 20:let B=t.e,L=t.v,I=t.t,W=t.ecatch;return this.isBlock(W);case 21:let q=t.fl;return!0;case 23:let P=t.e,R=t.cases,M=t.defaultExpr;return!0;case 24:let D=t.cond,U=t.e;return this.isBlock(U);case 25:let z=t.name,J=t.args,H=t.e;return this.isBlock(H);default:return!1}}parseFullExpr(e){let t=this.parseExpr();e.push(t);let l=this.token();for(;;){let i;if(l==Z.TComma&&t!=null){let n=t.e;if(n._hx_index==2){let s=n.n,r=n.t,a=n.e;i=!0}else i=!1}else i=!1;if(!i)break;t=this.parseStructure("var"),e.push(t),l=this.token()}l!=Z.TSemicolon&&l!=Z.TEof&&(this.isBlock(t)?(this.tokens.push({t:l,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax):this.unexpected(l))}parseObject(e){let t=[];e:for(;;){let r=this.token(),a=null;switch(r._hx_index){case 1:let o=r.c;this.allowJSON||this.unexpected(r),o._hx_index==2?a=o.s:this.unexpected(r);break;case 2:a=r.s;break;case 7:break e;default:this.unexpected(r);break e}let h=this.token();switch(h!=Z.TDoubleDot&&this.unexpected(h),t.push({name:a,e:this.parseExpr()}),r=this.token(),r._hx_index){case 7:break e;case 10:break;default:this.unexpected(r)}}let l=K.EObject(t),i=e,n=null,s;return l==null?s=null:(i==null&&(i=this.tokenMin),n==null&&(n=this.tokenMax),s={e:l,pmin:i,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 l=e.c,i=K.EConst(l),n=null,s=null,r;return i==null?r=null:(n==null&&(n=this.tokenMin),s==null&&(s=this.tokenMax),r={e:i,pmin:n,pmax:s,origin:this.origin,line:this.line}),this.parseExprNext(r);case 2:let a=e.s,h=this.parseStructure(a);if(h==null){let E=K.EIdent(a),v=null,N=null;E==null?h=null:(v==null&&(v=this.tokenMin),N==null&&(N=this.tokenMax),h={e:E,pmin:v,pmax:N,origin:this.origin,line:this.line})}return this.parseExprNext(h);case 3:let o=e.s;if(o=="-"){let E=this.tokenMin,v=this.parseExpr();if(v==null)return this.makeUnop(o,v);let N=v.e;if(N._hx_index==0){let B=N.c;switch(B._hx_index){case 0:let L=B.v,I=K.EConst(yl.CInt(-L)),W=E,q=v==null?0:v.pmax;return I==null?null:(W==null&&(W=this.tokenMin),q==null&&(q=this.tokenMax),{e:I,pmin:W,pmax:q,origin:this.origin,line:this.line});case 1:let P=B.f,R=K.EConst(yl.CFloat(-P)),M=E,D=v==null?0:v.pmax;return R==null?null:(M==null&&(M=this.tokenMin),D==null&&(D=this.tokenMax),{e:R,pmin:M,pmax:D,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==Z.TPClose){let E=this.token();_e.enumEq(E,Z.TOp("->"))||this.unexpected(E);let v=this.parseExpr(),N=K.EReturn(v),B=t,L=null,I;N==null?I=null:(B==null&&(B=this.tokenMin),L==null&&(L=this.tokenMax),I={e:N,pmin:B,pmax:L,origin:this.origin,line:this.line});let W=K.EFunction([],I),q=t,P=null;return W==null?null:(q==null&&(q=this.tokenMin),P==null&&(P=this.tokenMax),{e:W,pmin:q,pmax:P,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 E=K.EParent(u),v=t,N=this.tokenMax,B;return E==null?B=null:(v==null&&(v=this.tokenMin),N==null&&(N=this.tokenMax),B={e:E,pmin:v,pmax:N,origin:this.origin,line:this.line}),this.parseExprNext(B);case 10:let L=u.e;if(L._hx_index==1){let W=L.v;return this.parseLambda([{name:W}],u==null?0:u.pmin)}break;case 15:let I=this.parseType();switch(e=this.token(),e._hx_index){case 5:let W=K.ECheckType(u,I),q=t,P=this.tokenMax,R;return W==null?R=null:(q==null&&(q=this.tokenMin),P==null&&(P=this.tokenMax),R={e:W,pmin:q,pmax:P,origin:this.origin,line:this.line}),this.parseExprNext(R);case 10:let M=u.e;if(M._hx_index==1){let D=M.v;return this.parseLambda([{name:D,t:I}],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 E=e.c;if(this.allowJSON)if(E._hx_index==2){let q=E.s,P=this.token();if(this.tokens.push({t:P,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,P._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,N=this.token();if(this.tokens.push({t:N,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,N._hx_index==15)return this.parseExprNext(this.parseObject(t));break;case 7:let B=K.EObject([]),L=t,I=null,W;return B==null?W=null:(L==null&&(L=this.tokenMin),I==null&&(I=this.tokenMax),W={e:B,pmin:L,pmax:I,origin:this.origin,line:this.line}),this.parseExprNext(W);default:this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax}let p=[];for(;this.parseFullExpr(p),e=this.token(),!(e==Z.TBrClose||this.resumeErrors&&e==Z.TEof);)this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;let _=K.EBlock(p),m=t,f=null;return _==null?null:(m==null&&(m=this.tokenMin),f==null&&(f=this.tokenMax),{e:_,pmin:m,pmax:f,origin:this.origin,line:this.line});case 12:let g=[];e=this.token();let d=!0;for(;e!=Z.TBkClose&&(!this.resumeErrors||e!=Z.TEof);)d||(e!=Z.TComma?this.unexpected(e):e=this.token()),d=!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 E=g[0].e;switch(E._hx_index){case 10:let v=E.cond,N=E.e,B="__a_"+this.uid++,L=K.EArrayDecl([]),I=t,W=null,q;L==null?q=null:(I==null&&(I=this.tokenMin),W==null&&(W=this.tokenMax),q={e:L,pmin:I,pmax:W,origin:this.origin,line:this.line});let P=K.EVar(B,null,q),R=t,M=null,D;P==null?D=null:(R==null&&(R=this.tokenMin),M==null&&(M=this.tokenMax),D={e:P,pmin:R,pmax:M,origin:this.origin,line:this.line});let U=this.mapCompr(B,g[0]),z=K.EIdent(B),J=t,H=null,X;z==null?X=null:(J==null&&(J=this.tokenMin),H==null&&(H=this.tokenMax),X={e:z,pmin:J,pmax:H,origin:this.origin,line:this.line});let ae=K.EBlock([D,U,X]),ce=t,ne=null,re;return ae==null?re=null:(ce==null&&(ce=this.tokenMin),ne==null&&(ne=this.tokenMax),re={e:ae,pmin:ce,pmax:ne,origin:this.origin,line:this.line}),this.parseExprNext(re);case 11:let xe=E.v,Pe=E.it,Ue=E.e,Je="__a_"+this.uid++,lt=K.EArrayDecl([]),Ve=t,Qe=null,at;lt==null?at=null:(Ve==null&&(Ve=this.tokenMin),Qe==null&&(Qe=this.tokenMax),at={e:lt,pmin:Ve,pmax:Qe,origin:this.origin,line:this.line});let Re=K.EVar(Je,null,at),$=t,se=null,j;Re==null?j=null:($==null&&($=this.tokenMin),se==null&&(se=this.tokenMax),j={e:Re,pmin:$,pmax:se,origin:this.origin,line:this.line});let ie=this.mapCompr(Je,g[0]),le=K.EIdent(Je),ee=t,pe=null,me;le==null?me=null:(ee==null&&(ee=this.tokenMin),pe==null&&(pe=this.tokenMax),me={e:le,pmin:ee,pmax:pe,origin:this.origin,line:this.line});let we=K.EBlock([j,ie,me]),Ze=t,yt=null,Le;return we==null?Le=null:(Ze==null&&(Ze=this.tokenMin),yt==null&&(yt=this.tokenMax),Le={e:we,pmin:Ze,pmax:yt,origin:this.origin,line:this.line}),this.parseExprNext(Le);case 24:let dt=E.cond,Oe=E.e,Ie="__a_"+this.uid++,pt=K.EArrayDecl([]),it=t,Ot=null,Yt;pt==null?Yt=null:(it==null&&(it=this.tokenMin),Ot==null&&(Ot=this.tokenMax),Yt={e:pt,pmin:it,pmax:Ot,origin:this.origin,line:this.line});let xt=K.EVar(Ie,null,Yt),ol=t,$e=null,Vt;xt==null?Vt=null:(ol==null&&(ol=this.tokenMin),$e==null&&($e=this.tokenMax),Vt={e:xt,pmin:ol,pmax:$e,origin:this.origin,line:this.line});let Bt=this.mapCompr(Ie,g[0]),qt=K.EIdent(Ie),wt=t,Ht=null,Zt;qt==null?Zt=null:(wt==null&&(wt=this.tokenMin),Ht==null&&(Ht=this.tokenMax),Zt={e:qt,pmin:wt,pmax:Ht,origin:this.origin,line:this.line});let Gt=K.EBlock([Vt,Bt,Zt]),ul=t,cl=null,Xt;return Gt==null?Xt=null:(ul==null&&(ul=this.tokenMin),cl==null&&(cl=this.tokenMax),Xt={e:Gt,pmin:ul,pmax:cl,origin:this.origin,line:this.line}),this.parseExprNext(Xt);default:}}let x=K.EArrayDecl(g),y=t,S=null,C;return x==null?C=null:(y==null&&(y=this.tokenMin),S==null&&(S=this.tokenMax),C={e:x,pmin:y,pmax:S,origin:this.origin,line:this.line}),this.parseExprNext(C);case 16:let O=e.s;if(this.allowMetadata){let E=this.parseMetaArgs(),v=K.EMeta(O,E,this.parseExpr()),N=t,B=null;return v==null?null:(N==null&&(N=this.tokenMin),B==null&&(B=this.tokenMax),{e:v,pmin:N,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 p=this.getIdent(),_=this.maybe(Z.TDoubleDot)?this.parseType():null;e.push({name:p,t:_});let m=this.token();switch(m._hx_index){case 5:break e;case 10:break;default:this.unexpected(m);break e}}let l=this.token();_e.enumEq(l,Z.TOp("->"))||this.unexpected(l);let i=this.parseExpr(),n=K.EReturn(i),s=t,r=null,a;n==null?a=null:(s==null&&(s=this.tokenMin),r==null&&(r=this.tokenMax),a={e:n,pmin:s,pmax:r,origin:this.origin,line:this.line});let h=K.EFunction(e,a),o=t,u=null;return h==null?null:(o==null&&(o=this.tokenMin),u==null&&(u=this.tokenMax),{e:h,pmin:o,pmax:u,origin:this.origin,line:this.line})}parseMetaArgs(){let e=this.token();if(e!=Z.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!=Z.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 l=this.token();switch(l._hx_index){case 5:break e;case 10:break;default:let i=l;this.unexpected(i)}}}return t}mapCompr(e,t){if(t==null)return null;let l,i=t.e;switch(i._hx_index){case 3:let r=i.e;l=K.EParent(this.mapCompr(e,r));break;case 4:let a=i.e;if(a.length==1){let L=a[0];l=K.EBlock([this.mapCompr(e,L)])}else{let L=K.EIdent(e),I=t==null?0:t.pmin,W=t==null?0:t.pmax,q;L==null?q=null:(I==null&&(I=this.tokenMin),W==null&&(W=this.tokenMax),q={e:L,pmin:I,pmax:W,origin:this.origin,line:this.line});let P=K.EField(q,"push"),R=t==null?0:t.pmin,M=t==null?0:t.pmax,D;P==null?D=null:(R==null&&(R=this.tokenMin),M==null&&(M=this.tokenMax),D={e:P,pmin:R,pmax:M,origin:this.origin,line:this.line}),l=K.ECall(D,[t])}break;case 9:let h=i.cond,o=i.e1;if(i.e2==null)l=K.EIf(h,this.mapCompr(e,o),null);else{let L=K.EIdent(e),I=t==null?0:t.pmin,W=t==null?0:t.pmax,q;L==null?q=null:(I==null&&(I=this.tokenMin),W==null&&(W=this.tokenMax),q={e:L,pmin:I,pmax:W,origin:this.origin,line:this.line});let P=K.EField(q,"push"),R=t==null?0:t.pmin,M=t==null?0:t.pmax,D;P==null?D=null:(R==null&&(R=this.tokenMin),M==null&&(M=this.tokenMax),D={e:P,pmin:R,pmax:M,origin:this.origin,line:this.line}),l=K.ECall(D,[t])}break;case 10:let p=i.cond,_=i.e;l=K.EWhile(p,this.mapCompr(e,_));break;case 11:let m=i.v,f=i.it,g=i.e;l=K.EFor(m,f,this.mapCompr(e,g));break;case 24:let d=i.cond,x=i.e;l=K.EDoWhile(d,this.mapCompr(e,x));break;default:let y=K.EIdent(e),S=t==null?0:t.pmin,C=t==null?0:t.pmax,O;y==null?O=null:(S==null&&(S=this.tokenMin),C==null&&(C=this.tokenMax),O={e:y,pmin:S,pmax:C,origin:this.origin,line:this.line});let E=K.EField(O,"push"),v=t==null?0:t.pmin,N=t==null?0:t.pmax,B;E==null?B=null:(v==null&&(v=this.tokenMin),N==null&&(N=this.tokenMax),B={e:E,pmin:v,pmax:N,origin:this.origin,line:this.line}),l=K.ECall(B,[t])}let n=t==null?0:t.pmin,s=t==null?0:t.pmax;return l==null?null:(n==null&&(n=this.tokenMin),s==null&&(s=this.tokenMax),{e:l,pmin:n,pmax:s,origin:this.origin,line:this.line})}makeUnop(e,t){if(t==null&&this.resumeErrors)return null;let l=t.e;switch(l._hx_index){case 6:let i=l.op,n=l.e1,s=l.e2,r=K.EBinop(i,this.makeUnop(e,n),s),a=n==null?0:n.pmin,h=s==null?0:s.pmax;return r==null?null:(a==null&&(a=this.tokenMin),h==null&&(h=this.tokenMax),{e:r,pmin:a,pmax:h,origin:this.origin,line:this.line});case 22:let o=l.cond,u=l.e1,p=l.e2,_=K.ETernary(this.makeUnop(e,o),u,p),m=o==null?0:o.pmin,f=p==null?0:p.pmax;return _==null?null:(m==null&&(m=this.tokenMin),f==null&&(f=this.tokenMax),{e:_,pmin:m,pmax:f,origin:this.origin,line:this.line});default:let g=K.EUnop(e,!0,t),d=t==null?0:t.pmin,x=t==null?0:t.pmax;return g==null?null:(d==null&&(d=this.tokenMin),x==null&&(x=this.tokenMax),{e:g,pmin:d,pmax:x,origin:this.origin,line:this.line})}}makeBinop(e,t,l){if(l==null&&this.resumeErrors){let n=K.EBinop(e,t,l),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 i=l.e;switch(i._hx_index){case 6:let n=i.op,s=i.e1,r=i.e2;if(this.opPriority.h[e]<=this.opPriority.h[n]&&!Object.prototype.hasOwnProperty.call(this.opRightAssoc.h,e)){let m=K.EBinop(n,this.makeBinop(e,t,s),r),f=t==null?0:t.pmin,g=r==null?0:r.pmax;return m==null?null:(f==null&&(f=this.tokenMin),g==null&&(g=this.tokenMax),{e:m,pmin:f,pmax:g,origin:this.origin,line:this.line})}else{let m=K.EBinop(e,t,l),f=t==null?0:t.pmin,g=l==null?0:l.pmax;return m==null?null:(f==null&&(f=this.tokenMin),g==null&&(g=this.tokenMax),{e:m,pmin:f,pmax:g,origin:this.origin,line:this.line})}break;case 22:let a=i.cond,h=i.e1,o=i.e2;if(Object.prototype.hasOwnProperty.call(this.opRightAssoc.h,e)){let m=K.EBinop(e,t,l),f=t==null?0:t.pmin,g=l==null?0:l.pmax;return m==null?null:(f==null&&(f=this.tokenMin),g==null&&(g=this.tokenMax),{e:m,pmin:f,pmax:g,origin:this.origin,line:this.line})}else{let m=K.ETernary(this.makeBinop(e,t,a),h,o),f=t==null?0:t.pmin,g=l==null?0:l.pmax;return m==null?null:(f==null&&(f=this.tokenMin),g==null&&(g=this.tokenMax),{e:m,pmin:f,pmax:g,origin:this.origin,line:this.line})}break;default:let u=K.EBinop(e,t,l),p=t==null?0:t.pmin,_=l==null?0:l.pmax;return u==null?null:(p==null&&(p=this.tokenMin),_==null&&(_=this.tokenMax),{e:u,pmin:p,pmax:_,origin:this.origin,line:this.line})}}parseStructure(e){let t=this.tokenMin;switch(e){case"break":let l=K.EBreak,i=null,n=null;return l==null?null:(i==null&&(i=this.tokenMin),n==null&&(n=this.tokenMax),{e:l,pmin:i,pmax:n,origin:this.origin,line:this.line});case"continue":let s=K.EContinue,r=null,a=null;return s==null?null:(r==null&&(r=this.tokenMin),a==null&&(a=this.tokenMax),{e:s,pmin:r,pmax:a,origin:this.origin,line:this.line});case"do":let h=this.parseExpr(),o=this.token();o._hx_index==2?o.s!="while"&&this.unexpected(o):this.unexpected(o);let u=this.parseExpr(),p=K.EDoWhile(u,h),_=t,m=u==null?0:u.pmax;return p==null?null:(_==null&&(_=this.tokenMin),m==null&&(m=this.tokenMax),{e:p,pmin:_,pmax:m,origin:this.origin,line:this.line});case"else":return this.unexpected(Z.TId(e));case"for":let f=this.token();f!=Z.TPOpen&&this.unexpected(f);let g=this.getIdent(),d=this.token();_e.enumEq(d,Z.TId("in"))||this.unexpected(d);let x=this.parseExpr(),y=this.token();y!=Z.TPClose&&this.unexpected(y);let S=this.parseExpr(),C=K.EFor(g,x,S),O=t,E=S==null?0:S.pmax;return C==null?null:(O==null&&(O=this.tokenMin),E==null&&(E=this.tokenMax),{e:C,pmin:O,pmax:E,origin:this.origin,line:this.line});case"function":let v=this.token(),N=null;v._hx_index==2?N=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(),L=K.EFunction(B.args,B.body,N,B.ret),I=t,W=B.body,q=W==null?0:W.pmax;return L==null?null:(I==null&&(I=this.tokenMin),q==null&&(q=this.tokenMax),{e:L,pmin:I,pmax:q,origin:this.origin,line:this.line});case"if":let P=this.token();P!=Z.TPOpen&&this.unexpected(P);let R=this.parseExpr(),M=this.token();M!=Z.TPClose&&this.unexpected(M);let D=this.parseExpr(),U=null,z=!1,J=this.token();J==Z.TSemicolon&&(z=!0,J=this.token()),_e.enumEq(J,Z.TId("else"))?U=this.parseExpr():(this.tokens.push({t:J,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,z&&(this.tokens.push({t:Z.TSemicolon,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax));let H=K.EIf(R,D,U),X=t,ae=U==null?this.tokenMax:U==null?0:U.pmax;return H==null?null:(X==null&&(X=this.tokenMin),ae==null&&(ae=this.tokenMax),{e:H,pmin:X,pmax:ae,origin:this.origin,line:this.line});case"inline":return this.maybe(Z.TId("function"))||this.unexpected(Z.TId("inline")),this.parseStructure("function");case"new":let ce=[];ce.push(this.getIdent());e:for(;;){let nt=this.token();switch(nt._hx_index){case 4:break e;case 8:ce.push(this.getIdent());break;default:this.unexpected(nt);break e}}let ne=this.parseExprList(Z.TPClose),re=K.ENew(ce.join("."),ne),xe=t,Pe=null;return re==null?null:(xe==null&&(xe=this.tokenMin),Pe==null&&(Pe=this.tokenMax),{e:re,pmin:xe,pmax:Pe,origin:this.origin,line:this.line});case"return":let Ue=this.token();this.tokens.push({t:Ue,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;let Je=Ue==Z.TSemicolon?null:this.parseExpr(),lt=K.EReturn(Je),Ve=t,Qe=Je==null?this.tokenMax:Je==null?0:Je.pmax;return lt==null?null:(Ve==null&&(Ve=this.tokenMin),Qe==null&&(Qe=this.tokenMax),{e:lt,pmin:Ve,pmax:Qe,origin:this.origin,line:this.line});case"switch":let at=this.parseExpr(),Re=null,$=[],se=this.token();se!=Z.TBrOpen&&this.unexpected(se);e:for(;;){let nt=this.token();switch(nt._hx_index){case 2:switch(nt.s){case"case":let Sl={values:[],expr:null};$.push(Sl);t:for(;;){let bt=this.parseExpr();switch(Sl.values.push(bt),nt=this.token(),nt._hx_index){case 10:break;case 15:break t;default:this.unexpected(nt);break t}}let Ce=[];t:for(;;)switch(nt=this.token(),this.tokens.push({t:nt,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,nt._hx_index){case 0:if(this.resumeErrors)break t;this.parseFullExpr(Ce);break;case 2:switch(nt.s){case"case":case"default":break t;default:this.parseFullExpr(Ce)}break;case 7:break t;default:this.parseFullExpr(Ce)}let rt;if(Ce.length==1)rt=Ce[0];else if(Ce.length==0){let bt=K.EBlock([]),Ct=this.tokenMin,Mt=this.tokenMin;bt==null?rt=null:(Ct==null&&(Ct=this.tokenMin),Mt==null&&(Mt=this.tokenMax),rt={e:bt,pmin:Ct,pmax:Mt,origin:this.origin,line:this.line})}else{let bt=K.EBlock(Ce),Ct=Ce[0],Mt=Ct==null?0:Ct.pmin,el=Ce[Ce.length-1],Tt=el==null?0:el.pmax;bt==null?rt=null:(Mt==null&&(Mt=this.tokenMin),Tt==null&&(Tt=this.tokenMax),rt={e:bt,pmin:Mt,pmax:Tt,origin:this.origin,line:this.line})}Sl.expr=rt;break;case"default":Re!=null&&this.unexpected(nt);let _t=this.token();_t!=Z.TDoubleDot&&this.unexpected(_t);let ot=[];t:for(;;)switch(nt=this.token(),this.tokens.push({t:nt,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,nt._hx_index){case 0:if(this.resumeErrors)break t;this.parseFullExpr(ot);break;case 2:switch(nt.s){case"case":case"default":break t;default:this.parseFullExpr(ot)}break;case 7:break t;default:this.parseFullExpr(ot)}if(ot.length==1)Re=ot[0];else if(ot.length==0){let bt=K.EBlock([]),Ct=this.tokenMin,Mt=this.tokenMin;bt==null?Re=null:(Ct==null&&(Ct=this.tokenMin),Mt==null&&(Mt=this.tokenMax),Re={e:bt,pmin:Ct,pmax:Mt,origin:this.origin,line:this.line})}else{let bt=K.EBlock(ot),Ct=ot[0],Mt=Ct==null?0:Ct.pmin,el=ot[ot.length-1],Tt=el==null?0:el.pmax;bt==null?Re=null:(Mt==null&&(Mt=this.tokenMin),Tt==null&&(Tt=this.tokenMax),Re={e:bt,pmin:Mt,pmax:Tt,origin:this.origin,line:this.line})}break;default:this.unexpected(nt);break e}break;case 7:break e;default:this.unexpected(nt);break e}}let j=K.ESwitch(at,$,Re),ie=t,le=this.tokenMax;return j==null?null:(ie==null&&(ie=this.tokenMin),le==null&&(le=this.tokenMax),{e:j,pmin:ie,pmax:le,origin:this.origin,line:this.line});case"throw":let ee=this.parseExpr(),pe=K.EThrow(ee),me=t,we=ee==null?0:ee.pmax;return pe==null?null:(me==null&&(me=this.tokenMin),we==null&&(we=this.tokenMax),{e:pe,pmin:me,pmax:we,origin:this.origin,line:this.line});case"try":let Ze=this.parseExpr(),yt=this.token();_e.enumEq(yt,Z.TId("catch"))||this.unexpected(yt);let Le=this.token();Le!=Z.TPOpen&&this.unexpected(Le);let dt=this.getIdent(),Oe=this.token();Oe!=Z.TDoubleDot&&this.unexpected(Oe);let Ie=null;if(this.allowTypes)Ie=this.parseType();else{let nt=this.token();_e.enumEq(nt,Z.TId("Dynamic"))||this.unexpected(nt)}let pt=this.token();pt!=Z.TPClose&&this.unexpected(pt);let it=this.parseExpr(),Ot=K.ETry(Ze,dt,Ie,it),Yt=t,xt=it==null?0:it.pmax;return Ot==null?null:(Yt==null&&(Yt=this.tokenMin),xt==null&&(xt=this.tokenMax),{e:Ot,pmin:Yt,pmax:xt,origin:this.origin,line:this.line});case"var":let ol=this.getIdent(),$e=this.token(),Vt=null;$e==Z.TDoubleDot&&this.allowTypes&&(Vt=this.parseType(),$e=this.token());let Bt=null;switch($e._hx_index){case 3:$e.s=="="?Bt=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:Vt!=null?(this.tokens.push({t:$e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax):this.unexpected($e)}let qt=K.EVar(ol,Vt,Bt),wt=t,Ht=Bt==null?this.tokenMax:Bt==null?0:Bt.pmax;return qt==null?null:(wt==null&&(wt=this.tokenMin),Ht==null&&(Ht=this.tokenMax),{e:qt,pmin:wt,pmax:Ht,origin:this.origin,line:this.line});case"while":let Zt=this.parseExpr(),Gt=this.parseExpr(),ul=K.EWhile(Zt,Gt),cl=t,Xt=Gt==null?0:Gt.pmax;return ul==null?null:(cl==null&&(cl=this.tokenMin),Xt==null&&(Xt=this.tokenMax),{e:ul,pmin:cl,pmax:Xt,origin:this.origin,line:this.line});default:return null}}parseExprNext(e){let t=this.token();switch(t._hx_index){case 2:let l=t.s;return l=="is"?this.makeBinop(l,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 i=t.s;if(i=="->"){let Le=e.e;switch(Le._hx_index){case 1:let dt=Le.v,Oe=this.parseExpr(),Ie=K.EReturn(Oe),pt=Oe==null?0:Oe.pmin,it=null,Ot;Ie==null?Ot=null:(pt==null&&(pt=this.tokenMin),it==null&&(it=this.tokenMax),Ot={e:Ie,pmin:pt,pmax:it,origin:this.origin,line:this.line});let Yt=K.EFunction([{name:dt}],Ot),xt=e==null?0:e.pmin,ol=null;return Yt==null?null:(xt==null&&(xt=this.tokenMin),ol==null&&(ol=this.tokenMax),{e:Yt,pmin:xt,pmax:ol,origin:this.origin,line:this.line});case 3:let $e=Le.e.e;if($e._hx_index==1){let Bt=$e.v,qt=this.parseExpr(),wt=K.EReturn(qt),Ht=qt==null?0:qt.pmin,Zt=null,Gt;wt==null?Gt=null:(Ht==null&&(Ht=this.tokenMin),Zt==null&&(Zt=this.tokenMax),Gt={e:wt,pmin:Ht,pmax:Zt,origin:this.origin,line:this.line});let ul=K.EFunction([{name:Bt}],Gt),cl=e==null?0:e.pmin,Xt=null;return ul==null?null:(cl==null&&(cl=this.tokenMin),Xt==null&&(Xt=this.tokenMax),{e:ul,pmin:cl,pmax:Xt,origin:this.origin,line:this.line})}break;case 26:let Vt=Le.e.e;if(Vt._hx_index==1){let Bt=Vt.v,qt=Le.t,wt=this.parseExpr(),Ht=K.EReturn(wt),Zt=wt==null?0:wt.pmin,Gt=null,ul;Ht==null?ul=null:(Zt==null&&(Zt=this.tokenMin),Gt==null&&(Gt=this.tokenMax),ul={e:Ht,pmin:Zt,pmax:Gt,origin:this.origin,line:this.line});let cl=K.EFunction([{name:Bt,t:qt}],ul),Xt=e==null?0:e.pmin,nt=null;return cl==null?null:(Xt==null&&(Xt=this.tokenMin),nt==null&&(nt=this.tokenMax),{e:cl,pmin:Xt,pmax:nt,origin:this.origin,line:this.line})}break;default:}this.unexpected(t)}if(this.opPriority.h[i]==-1){let Le;if(this.isBlock(e))Le=!0;else{let it=e.e;if(it._hx_index==3){let Ot=it.e;Le=!0}else Le=!1}if(Le)return this.tokens.push({t,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,e;let dt=K.EUnop(i,!1,e),Oe=e==null?0:e.pmin,Ie=null,pt;return dt==null?pt=null:(Oe==null&&(Oe=this.tokenMin),Ie==null&&(Ie=this.tokenMax),pt={e:dt,pmin:Oe,pmax:Ie,origin:this.origin,line:this.line}),this.parseExprNext(pt)}return this.makeBinop(i,e,this.parseExpr());case 4:let n=K.ECall(e,this.parseExprList(Z.TPClose)),s=e==null?0:e.pmin,r=null,a;return n==null?a=null:(s==null&&(s=this.tokenMin),r==null&&(r=this.tokenMax),a={e:n,pmin:s,pmax:r,origin:this.origin,line:this.line}),this.parseExprNext(a);case 8:let h=this.getIdent(),o=K.EField(e,h),u=e==null?0:e.pmin,p=null,_;return o==null?_=null:(u==null&&(u=this.tokenMin),p==null&&(p=this.tokenMax),_={e:o,pmin:u,pmax:p,origin:this.origin,line:this.line}),this.parseExprNext(_);case 9:let m=this.getIdent(),f="__a_"+this.uid++,g=K.EVar(f,null,e),d=e==null?0:e.pmin,x=e==null?0:e.pmax,y;g==null?y=null:(d==null&&(d=this.tokenMin),x==null&&(x=this.tokenMax),y={e:g,pmin:d,pmax:x,origin:this.origin,line:this.line});let S=K.EIdent(f),C=e==null?0:e.pmin,O=e==null?0:e.pmax,E;S==null?E=null:(C==null&&(C=this.tokenMin),O==null&&(O=this.tokenMax),E={e:S,pmin:C,pmax:O,origin:this.origin,line:this.line});let v=K.EIdent("null"),N=e==null?0:e.pmin,B=e==null?0:e.pmax,L;v==null?L=null:(N==null&&(N=this.tokenMin),B==null&&(B=this.tokenMax),L={e:v,pmin:N,pmax:B,origin:this.origin,line:this.line});let I=K.EBinop("==",E,L),W=null,q=null,P;I==null?P=null:(W==null&&(W=this.tokenMin),q==null&&(q=this.tokenMax),P={e:I,pmin:W,pmax:q,origin:this.origin,line:this.line});let R=K.EIdent("null"),M=e==null?0:e.pmin,D=e==null?0:e.pmax,U;R==null?U=null:(M==null&&(M=this.tokenMin),D==null&&(D=this.tokenMax),U={e:R,pmin:M,pmax:D,origin:this.origin,line:this.line});let z=K.EIdent(f),J=e==null?0:e.pmin,H=e==null?0:e.pmax,X;z==null?X=null:(J==null&&(J=this.tokenMin),H==null&&(H=this.tokenMax),X={e:z,pmin:J,pmax:H,origin:this.origin,line:this.line});let ae=K.EField(X,m),ce=e==null?0:e.pmin,ne=null,re;ae==null?re=null:(ce==null&&(ce=this.tokenMin),ne==null&&(ne=this.tokenMax),re={e:ae,pmin:ce,pmax:ne,origin:this.origin,line:this.line});let xe=K.ETernary(P,U,re),Pe=null,Ue=null,Je;xe==null?Je=null:(Pe==null&&(Pe=this.tokenMin),Ue==null&&(Ue=this.tokenMax),Je={e:xe,pmin:Pe,pmax:Ue,origin:this.origin,line:this.line});let lt=K.EBlock([y,Je]),Ve=e==null?0:e.pmin,Qe=null,at;return lt==null?at=null:(Ve==null&&(Ve=this.tokenMin),Qe==null&&(Qe=this.tokenMax),at={e:lt,pmin:Ve,pmax:Qe,origin:this.origin,line:this.line}),this.parseExprNext(at);case 12:let Re=this.parseExpr(),$=this.token();$!=Z.TBkClose&&this.unexpected($);let se=K.EArray(e,Re),j=e==null?0:e.pmin,ie=null,le;return se==null?le=null:(j==null&&(j=this.tokenMin),ie==null&&(ie=this.tokenMax),le={e:se,pmin:j,pmax:ie,origin:this.origin,line:this.line}),this.parseExprNext(le);case 14:let ee=this.parseExpr(),pe=this.token();pe!=Z.TDoubleDot&&this.unexpected(pe);let me=this.parseExpr(),we=K.ETernary(e,ee,me),Ze=e==null?0:e.pmin,yt=me==null?0:me.pmax;return we==null?null:(Ze==null&&(Ze=this.tokenMin),yt==null&&(yt=this.tokenMax),{e:we,pmin:Ze,pmax:yt,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!=Z.TPClose){let l=!1;for(;!l;){let i=null,n=!1;if(t._hx_index==14&&(n=!0,t=this.token()),t._hx_index==2)i=t.s;else{this.unexpected(t);break}let s={name:i};switch(e.push(s),n&&(s.opt=!0),this.allowTypes&&(this.maybe(Z.TDoubleDot)&&(s.t=this.parseType()),this.maybe(Z.TOp("="))&&(s.value=this.parseExpr())),t=this.token(),t._hx_index){case 5:l=!0;break;case 10:t=this.token();break;default:this.unexpected(t)}}}return e}parseFunctionDecl(){let e=this.token();e!=Z.TPOpen&&this.unexpected(e);let t=this.parseFunctionArgs(),l=null;if(this.allowTypes){let i=this.token();i!=Z.TDoubleDot?(this.tokens.push({t:i,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax):l=this.parseType()}return{args:t,ret:l,body:this.parseExpr()}}parsePath(){let e=[this.getIdent()];for(;;){let t=this.token();if(t!=Z.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 l=e.s;this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;let i=this.parsePath(),n=null;if(e=this.token(),e._hx_index==3)if(e.s=="<"){n=[];e:for(;;){switch(n.push(this.parseType()),e=this.token(),e._hx_index){case 3:let p=e.s;if(p==">")break e;if(c.cca(p,0)==62){this.tokens.add({t:Z.TOp(c.substr(p,1,null)),min:this.tokenMax-p.length-1,max:this.tokenMax});break e}break;case 10:continue;default:}this.unexpected(e);break}}else this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;else this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;return this.parseTypeNext(sl.CTPath(i,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 a=function(u){let p=t.token();if(p._hx_index==3){if(p.s!="->"){let _=p;t.unexpected(_)}}else{let _=p;t.unexpected(_)}return sl.CTFun(u,t.parseType())};switch(s._hx_index){case 2:let u=s.s;if(r._hx_index==15){let x=[],y=0,S=this.parseFunctionArgs();for(;y<S.length;){let O=S[y];++y;let E=O.value;if(E!=null){let v=E;if(!this.resumeErrors)throw T.thrown(new Se(Te.ECustom("Default values not allowed in function types"),v.pmin,v.pmax,this.origin,this.line))}x.push(sl.CTNamed(O.name,O.opt?sl.CTOpt(O.t):O.t))}return a(x)}else{let x=this.parseType(),y=this.token();switch(y._hx_index){case 5:return this.parseTypeNext(sl.CTParent(x));case 10:let S=[x];do S.push(this.parseType());while(this.maybe(Z.TComma));let C=this.token();return C!=Z.TPClose&&this.unexpected(C),a(S);default:let O=y;return this.unexpected(O)}}break;case 5:let p=[],_=0,m=this.parseFunctionArgs();for(;_<m.length;){let x=m[_];++_;let y=x.value;if(y!=null){let S=y;if(!this.resumeErrors)throw T.thrown(new Se(Te.ECustom("Default values not allowed in function types"),S.pmin,S.pmax,this.origin,this.line))}p.push(sl.CTNamed(x.name,x.opt?sl.CTOpt(x.t):x.t))}return a(p);default:let g=this.parseType(),d=this.token();switch(d._hx_index){case 5:return this.parseTypeNext(sl.CTParent(g));case 10:let x=[g];do x.push(this.parseType());while(this.maybe(Z.TComma));let y=this.token();return y!=Z.TPClose&&this.unexpected(y),a(x);default:let S=d;return this.unexpected(S)}}break;case 6:let h=[],o=null;e:for(;;)switch(e=this.token(),e._hx_index){case 2:let u=e.s;if(u=="var"){let _=this.getIdent(),m=this.token();m!=Z.TDoubleDot&&this.unexpected(m),h.push({name:_,t:this.parseType(),meta:o}),o=null;let f=this.token();f!=Z.TSemicolon&&this.unexpected(f)}else{let _=u,m=this.token();switch(m!=Z.TDoubleDot&&this.unexpected(m),h.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 p=e.s;o==null&&(o=[]),o.push({name:p,params:this.parseMetaArgs()});break;default:this.unexpected(e);break e}return this.parseTypeNext(sl.CTAnon(h));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 l=this.parseType();if(l._hx_index==1){let i=l.ret;return l.args.unshift(e),l}else return sl.CTFun([e],l)}parseExprList(e){let t=[],l=this.token();if(l==e)return t;for(this.tokens.push({t:l,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;;)if(t.push(this.parseExpr()),l=this.token(),l._hx_index!=10){if(l==e)break;this.unexpected(l);break}return t}parseModule(e,t,l){l==null&&(l=0),t==null&&(t="loreline.lorscript"),this.initParser(t,l),this.input=e,this.readPos=0,this.allowTypes=!0,this.allowMetadata=!0;let i=[];for(;;){let n=this.token();if(n==Z.TEof)break;this.tokens.push({t:n,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,i.push(this.parseModuleDecl())}return i}parseMetadata(){let e=[];for(;;){let t=this.token();if(t._hx_index==16){let l=t.s;e.push({name:l,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(Z.TOp("<"))&&!this.resumeErrors)throw T.thrown(new Se(Te.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(),l=!1,i=!1;e:for(;;){switch(t){case"extern":i=!0;break;case"private":l=!0;break;default:break e}t=this.getIdent()}switch(t){case"class":let n=this.getIdent(),s=this.parseParams(),r=null,a=[];e:for(;;){let S=this.token();if(S._hx_index==2)switch(S.s){case"extends":r=this.parseType();break;case"implements":a.push(this.parseType());break;default:this.tokens.push({t:S,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break e}else{this.tokens.push({t:S,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break}}let h=[],o=this.token();for(o!=Z.TBrOpen&&this.unexpected(o);!this.maybe(Z.TBrClose);)h.push(this.parseField());return ni.DClass({name:n,meta:e,params:s,extend:r,implement:a,fields:h,isPrivate:l,isExtern:i});case"import":let u=[this.getIdent()],p=!1;for(;;){let S=this.token();if(S!=Z.TDot){this.tokens.push({t:S,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break}switch(S=this.token(),S._hx_index){case 2:let C=S.s;u.push(C);break;case 3:S.s=="*"?p=!0:this.unexpected(S);break;default:this.unexpected(S)}}let _=this.token();return _!=Z.TSemicolon&&this.unexpected(_),ni.DImport(u,p);case"package":let m=this.parsePath(),f=this.token();return f!=Z.TSemicolon&&this.unexpected(f),ni.DPackage(m);case"typedef":let g=this.getIdent(),d=this.parseParams(),x=this.token();_e.enumEq(x,Z.TOp("="))||this.unexpected(x);let y=this.parseType();return ni.DTypedef({name:g,meta:e,params:d,isPrivate:l,t:y});default:this.unexpected(Z.TId(t))}return null}parseField(){let e=this.parseMetadata(),t=[];e:for(;;){let l=this.getIdent();switch(l){case"function":let i=this.getIdent(),n=this.parseFunctionDecl();return{name:i,meta:e,access:t,kind:ln.KFunction({args:n.args,expr:n.body,ret:n.ret})};case"inline":t.push(Al.AInline);break;case"macro":t.push(Al.AMacro);break;case"override":t.push(Al.AOverride);break;case"private":t.push(Al.APrivate);break;case"public":t.push(Al.APublic);break;case"static":t.push(Al.AStatic);break;case"var":let s=this.getIdent(),r=null,a=null;if(this.maybe(Z.TPOpen)){r=this.getIdent();let u=this.token();u!=Z.TComma&&this.unexpected(u),a=this.getIdent();let p=this.token();p!=Z.TPClose&&this.unexpected(p)}let h=this.maybe(Z.TDoubleDot)?this.parseType():null,o=this.maybe(Z.TOp("="))?this.parseExpr():null;if(o!=null)if(this.isBlock(o))this.maybe(Z.TSemicolon);else{let u=this.token();u!=Z.TSemicolon&&this.unexpected(u)}else{let u;if(h!=null)if(h==null)u=!1;else if(h._hx_index==2){let p=h.fields;u=!0}else u=!1;else u=!1;if(u)this.maybe(Z.TSemicolon);else{let p=this.token();p!=Z.TSemicolon&&this.unexpected(p)}}return{name:s,meta:e,access:t,kind:ln.KVar({get:r,set:a,type:h,expr:o})};default:this.unexpected(Z.TId(l));break e}}return null}readChar(){return this.input.charCodeAt(this.readPos++)}readString(e){let t=0,l="",i=!1,n=this.line,s=this.input,r=this.readPos+this.offset-1;for(;;){let a=this.input.charCodeAt(this.readPos++);if(a!=a){if(this.line=n,!this.resumeErrors)throw T.thrown(new Se(Te.EUnterminatedString,r,r,this.origin,this.line));break}if(i)switch(i=!1,a){case 47:this.allowJSON?l+=String.fromCodePoint(a):this.invalidChar(a);break;case 34:case 39:case 92:l+=String.fromCodePoint(a);break;case 110:l+=String.fromCodePoint(10);break;case 114:l+=String.fromCodePoint(13);break;case 116:l+=String.fromCodePoint(9);break;case 117:this.allowJSON||this.invalidChar(a);let h=0,o=0;for(;o<4;){let u=o++;h<<=4;let p=this.input.charCodeAt(this.readPos++);switch(p){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:h+=p-48;break;case 65:case 66:case 67:case 68:case 69:case 70:h+=p-55;break;case 97:case 98:case 99:case 100:case 101:case 102:h+=p-87;break;default:if(p!=p&&(this.line=n,!this.resumeErrors))throw T.thrown(new Se(Te.EUnterminatedString,r,r,this.origin,this.line));this.invalidChar(p)}}l+=String.fromCodePoint(h);break;default:this.invalidChar(a)}else if(a==92)i=!0;else{if(a==e)break;a==10&&this.line++,l+=String.fromCodePoint(a)}}return l}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,Z.TEof;switch(e){case 0:return Z.TEof;case 10:this.line++,this.tokenMin++;break;case 9:case 13:case 32:this.tokenMin++;break;case 34:case 39:return Z.TConst(yl.CString(this.readString(e)));case 35:if(e=this.input.charCodeAt(this.readPos++),this.idents[e]){let i=String.fromCodePoint(e);for(;;){if(e=this.input.charCodeAt(this.readPos++),!this.idents[e])return this.char=e,this.preprocess(i);i+=String.fromCodePoint(e)}}this.invalidChar(e);break;case 40:return Z.TPOpen;case 41:return Z.TPClose;case 44:return Z.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),Z.TOp("...");case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:let i=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:i=i*10+(e-48);break;default:return this.char=e,Z.TConst(yl.CFloat(i/n))}break;default:return this.char=e,Z.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,l=0;for(;;)switch(e=this.input.charCodeAt(this.readPos++),l*=10,e){case 46:if(l>0){if(l==10&&this.input.charCodeAt(this.readPos++)==46){this.tokens.push({t:Z.TOp("..."),min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;let a=t|0;return Z.TConst(a==t?yl.CInt(a):yl.CFloat(t))}this.invalidChar(e)}l=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 i=this.token(),n=null;switch(i._hx_index){case 1:let a=i.c;a._hx_index==0?n=a.v:(this.tokens.push({t:i,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax);break;case 3:if(i.s=="-")if(i=this.token(),i._hx_index==1){let h=i.c;h._hx_index==0?n=-h.v:(this.tokens.push({t:i,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax)}else this.tokens.push({t:i,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;else this.tokens.push({t:i,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break;default:this.tokens.push({t:i,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax}return n==null&&this.invalidChar(e),l==0&&(l=10),Z.TConst(yl.CFloat(Math.pow(10,n)/l*t*10));case 120:(t>0||l>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,Z.TConst(yl.CInt(s))}break;default:this.char=e;let r=t|0;return Z.TConst(l>0?yl.CFloat(t*10/l):r==t?yl.CInt(r):yl.CFloat(t))}break;case 58:return Z.TDoubleDot;case 59:return Z.TSemicolon;case 61:return e=this.input.charCodeAt(this.readPos++),e==61?Z.TOp("=="):e==62?Z.TOp("=>"):(this.char=e,Z.TOp("="));case 63:return e=this.input.charCodeAt(this.readPos++),e==46?Z.TQuestionDot:(this.char=e,Z.TQuestion);case 64:if(e=this.input.charCodeAt(this.readPos++),this.idents[e]||e==58){let i=String.fromCodePoint(e);for(;;){if(e=this.input.charCodeAt(this.readPos++),!this.idents[e])return this.char=e,Z.TMeta(i);i+=String.fromCodePoint(e)}}this.invalidChar(e);break;case 91:return Z.TBkOpen;case 93:return Z.TBkClose;case 123:return Z.TBrOpen;case 125:return Z.TBrClose;default:if(this.ops[e]){let i=String.fromCodePoint(e);for(;;){if(e=this.input.charCodeAt(this.readPos++),e!=e&&(e=0),!this.ops[e])return this.char=e,Z.TOp(i);let n=i;if(i+=String.fromCodePoint(e),!Object.prototype.hasOwnProperty.call(this.opPriority.h,i)&&Object.prototype.hasOwnProperty.call(this.opPriority.h,n))return i=="//"||i=="/*"?this.tokenComment(i,e):(this.char=e,Z.TOp(n))}}if(this.idents[e]){let i=String.fromCodePoint(e);for(;;){if(e=this.input.charCodeAt(this.readPos++),e!=e&&(e=0),!this.idents[e])return this.char=e,Z.TId(i);i+=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,l=K.EIdent(t),i=this.tokenMin,n=this.tokenMax;return l==null?null:(i==null&&(i=this.tokenMin),n==null&&(n=this.tokenMax),{e:l,pmin:i,pmax:n,origin:this.origin,line:this.line});case 3:if(e.s=="!"){let s=K.EUnop("!",!0,this.parsePreproCond()),r=this.tokenMin,a=this.tokenMax;return s==null?null:(r==null&&(r=this.tokenMin),a==null&&(a=this.tokenMax),{e:s,pmin:r,pmax:a,origin:this.origin,line:this.line})}else return this.unexpected(e);break;case 4:return this.tokens.push({t:Z.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 l=t.v;return this.preprocValue(l)!=null;case 3:let i=t.e;return this.evalPreproCond(i);case 6:let n=t.e1,s=t.e2;switch(t.op){case"&&":let h=n,o=s;return this.evalPreproCond(h)?this.evalPreproCond(o):!1;case"||":let u=n,p=s;return this.evalPreproCond(u)?!0:this.evalPreproCond(p);default:let _=e.e;if(!this.resumeErrors)throw T.thrown(new Se(Te.EInvalidPreprocessor("Can't eval "+Ye[_.__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 h=t.e;return!this.evalPreproCond(h)}else{let h=e.e;if(!this.resumeErrors)throw T.thrown(new Se(Te.EInvalidPreprocessor("Can't eval "+Ye[h.__enum__].__constructs__[h._hx_index]._hx_name),this.readPos+this.offset,this.readPos+this.offset,this.origin,this.line));return!1}break;default:let a=e.e;if(!this.resumeErrors)throw T.thrown(new Se(Te.EInvalidPreprocessor("Can't eval "+Ye[a.__enum__].__constructs__[a._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")):Z.TPrepro(e);case"end":return this.preprocStack.length>0?(this.preprocStack.pop(),this.token()):Z.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 Z.TPrepro(e)}}skipTokens(){let e=this.preprocStack.length-1,t=this.preprocStack[e],l=this.readPos+this.offset;for(;;){let i=this.token();if(i==Z.TEof&&!this.resumeErrors)throw T.thrown(new Se(Te.EInvalidPreprocessor("Unclosed"),l,l,this.origin,this.line));if(this.preprocStack[e]!=t){this.tokens.push({t:i,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break}}}tokenComment(e,t){let l=c.cca(e,1),i=this.input;if(l==47){for(;t!=13&&t!=10&&(t=this.input.charCodeAt(this.readPos++),t==t););return this.char=t,this.token()}if(l==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 T.thrown(new Se(Te.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 T.thrown(new Se(Te.EUnterminatedComment,this.tokenMin,this.tokenMin,this.origin,this.line));break}}while(t!=47);return this.token()}return this.char=t,Z.TOp(e)}constString(e){switch(e._hx_index){case 0:let t=e.v;return t==null?"null":""+t;case 1:let l=e.f;return l==null?"null":""+l;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}}}Q["loreline.lorscript.Parser"]=ci,ci.__name__="loreline.lorscript.Parser",Object.assign(ci.prototype,{__class__:ci,__properties__:{get_currentPos:"get_currentPos"}});class ki{constructor(){}exprToString(e){return this.buf=new gt,this.tabs="",this.expr(e),this.buf.b}typeToString(e){return this.buf=new gt,this.tabs="",this.type(e),this.buf.b}add(e){this.buf.b+=Y.string(e)}type(e){switch(e._hx_index){case 0:let t=e.path,l=e.params,i=t.join(".");if(this.buf.b+=Y.string(i),l!=null){this.buf.b+="<";let g=!0,d=0;for(;d<l.length;){let x=l[d];++d,g?g=!1:this.buf.b+=", ",this.type(x)}this.buf.b+=">"}break;case 1:let n=e.args,s=e.ret,r=n,a=s;if(cn.exists(r,function(g){if(g._hx_index==5){let d=g.n,x=g.t;return!0}else return!1})){this.buf.b+="(";let g=0;for(;g<r.length;){let d=r[g];if(++g,d._hx_index==5){let x=d.n,y=d.t;this.type(d)}else this.type(sl.CTNamed("_",d))}this.buf.b+=")->",this.type(a)}else{let g=n,d=s;if(g.length==0)this.buf.b+="Void -> ";else{let x=0;for(;x<g.length;){let y=g[x];++x,this.type(y),this.buf.b+=" -> "}}this.type(d)}break;case 2:let h=e.fields;this.buf.b+="{";let o=!0,u=0;for(;u<h.length;){let g=h[u];++u,o?(o=!1,this.buf.b+=" "):this.buf.b+=", ",this.buf.b+=Y.string(g.name+" : "),this.type(g.t)}this.buf.b+=o?"}":" }";break;case 3:let p=e.t;this.buf.b+="(",this.type(p),this.buf.b+=")";break;case 4:let _=e.t;this.buf.b+="?",this.type(_);break;case 5:let m=e.n,f=e.t;this.buf.b+=m==null?"null":""+m,this.buf.b+=":",this.type(f);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 l=t.c;switch(l._hx_index){case 0:let Oe=l.v;this.buf.b+=Oe==null?"null":""+Oe;break;case 1:let Ie=l.f;this.buf.b+=Ie==null?"null":""+Ie;break;case 2:let pt=l.s;this.buf.b+='"';let it=pt.split('"').join('\\"').split(`
43
+ `),i=0,n=l.length;for(;i<n;){let s=i++;s>0&&(this._buf.b+=Y.string(this._newline),this._beginLine=1);let r=l[s],a;if(r.length>0){let h=c.cca(r,r.length-1);a=(h??-1)==13}else a=!1;if(a){let h=r.length-1;r=h!=null?r.substring(0,h):r.substring(0)}if(t&&s>0){let h=0;for(;;){let o;if(h<r.length){let u=c.cca(r,h);if((u??-1)!=32){let p=c.cca(r,h);o=(p??-1)==9}else o=!0}else o=!1;if(!o)break;++h}if(h>0){let o=null;r=o!=null?r.substring(h,o):r.substring(h)}}r.length>0&&this.write(r)}}printLiteral(e){this.printLeadingComments(e);let t=e.literalType;switch(t._hx_index){case 0:this.write(e.value==null?"null":Y.string(e.value));break;case 1:this.write(e.value?"true":"false");break;case 2:this.write("null");break;case 3:let l=!1,i=0,n=e.value;for(;i<n.length;){let o=n[i];if(++i,this.hasRealNewlines(o)){l=!0;break}}if(l){this.write("["),this.newline(),this._level++;let o=!0,u=0,p=e.value;for(;u<p.length;){let _=p[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,p=e.value;for(;u<p.length;){let _=p[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,a=0,h=e.value;for(;a<h.length;){let o=h[a];++a,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,l=0,i=e.args;for(;l<i.length;){let n=i[l];++l,t||this.write(", "),t=!1,this.printNode(n)}this.write(")"),this.printTrailingComments(e)}printBinary(e,t){t==null&&(t=!1),this.printLeadingComments(e);let l;if(t)l=!1;else{let i=e.op;switch(i._hx_index){case 37:let n=i.word;l=!0;break;case 38:let s=i.word;l=!0;break;default:l=!1}}l&&this.write("("),this.printNode(e.left),this.write(" "+this.getOperator(e.op)+" "),this.printNode(e.right),l&&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 l=this.enableComments;this.enableComments=!1,t&&this.write("("),e instanceof il?this.printBinary(e,!0):this.printNode(e),t&&this.write(")"),this.enableComments=l}isSimpleInterpolationExpr(e){if(e instanceof ft){let t=e;return t.target==null?!0:this.isSimpleInterpolationExpr(t.target)}return e instanceof gl?this.isSimpleInterpolationExpr(te.__cast(e,gl).target):e instanceof Jt?this.isSimpleInterpolationExpr(te.__cast(e,Jt).target):!1}hasRealNewlines(e){if(e instanceof Mt){let t=e;if(t.quotes==1)return!1;let l=0,i=t.parts;for(;l<i.length;){let n=i[l];++l;let s=n.partType;if(s._hx_index==0&&s.text.indexOf(`
44
+ `)!=-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 C.thrown("Unsupported operator: "+Y.string(e))}}}Q["loreline.Printer"]=Wl,Wl.__name__="loreline.Printer",Object.assign(Wl.prototype,{__class__:Wl});class fn{static toString(e){switch(e){case 0:return"Unquoted";case 1:return"DoubleQuotes"}}}class wi{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}}Q["loreline.Random"]=wi,wi.__name__="loreline.Random",Object.assign(wi.prototype,{__class__:wi});class nl extends Be{constructor(e,t,l){At._hx_skip_constructor=!0,super(),At._hx_skip_constructor=!1,this._hx_constructor(e,t,l)}_hx_constructor(e,t,l){this.filePath=null,this.indentSize=2,super._hx_constructor(e,t),this.body=l}toJson(){let e=super.toJson(),t=[],l=0,i=this.body;for(;l<i.length;){let n=i[l];++l,t.push(n.toJson())}return e.body=t,e.indentSize=this.indentSize,this.filePath!=null&&(e.filePath=this.filePath),e}type(){return"Script"}eachExcludingImported(e){if(super.each(e),this.body!=null){let t=0,l=this.body;for(;t<l.length;){let i=l[t];++t,e(i,this),i instanceof Rt||i.each(e)}}}each(e){if(super.each(e),this.body!=null){let t=0,l=this.body;for(;t<l.length;){let i=l[t];++t,e(i,this),i.each(e)}}}iterator(){return new Xi(this.body)}static fromJson(e){return R.scriptFromJson(e)}}Q["loreline.Script"]=Xl.loreline.Script=nl,nl.__name__="loreline.Script",nl.__super__=Be,Object.assign(nl.prototype,{__class__:nl});class Xi{constructor(e){this.body=e,this.index=0,this.flatBody=[],this.fillBody(e)}fillBody(e){let t=0,l=e.length;for(;t<l;){let i=t++,n=e[i];if(n instanceof Rt){let s=n;s.script!=null&&this.fillBody(s.script.body)}this.flatBody.push(e[i])}}hasNext(){return this.index<this.flatBody.length}next(){let e=this.flatBody[this.index];return this.index++,e}}Q["loreline._Script.ScriptBodyIterator"]=Xi,Xi.__name__="loreline._Script.ScriptBodyIterator",Object.assign(Xi.prototype,{__class__:Xi});class en{constructor(e,t){this.remaining=e,this.done=t}}Q["loreline._Timer.PendingTimer"]=en,en.__name__="loreline._Timer.PendingTimer",Object.assign(en.prototype,{__class__:en});class Zl{static register(e,t){Zl.timers.push(new en(e,t))}static update(e){if(Zl.timers.length==0)return;let t=Zl.timers.length;for(;--t>=0;){let l=Zl.timers[t];l.remaining-=e,l.remaining<=0&&(Zl.timers.splice(t,1),l.done())}}}Q["loreline.Timer"]=Zl,Zl.__name__="loreline.Timer";class yn{static uLength(e){return e.length}static uSubstr(e,t,l){return l!=null?c.substr(e,t,l):c.substr(e,t,null)}static uSubstring(e,t,l){return l!=null?e.substring(t,l):e.substring(t)}static uCharCodeAt(e,t){let l=c.cca(e,t);return l??-1}static uIndexOf(e,t,l){return e.indexOf(t,l)}static uLastIndexOf(e,t,l){return e.lastIndexOf(t,l)}static uToChars(e){return e.split("")}static uCharAt(e,t){return e.charAt(t)}}Q["loreline.Utf8"]=yn,yn.__name__="loreline.Utf8";class Li extends st{constructor(e,t,l){super(t,l),this.wrapped=e}}Q["loreline.WrappedError"]=Li,Li.__name__="loreline.WrappedError",Li.__super__=st,Object.assign(Li.prototype,{__class__:Li});class _n{static main(){}}Q["loreline.lib.Library"]=_n,_n.__name__="loreline.lib.Library";var G=Ye["loreline.lorscript.TType"]={__ename__:"loreline.lorscript.TType",__constructs__:null,TMono:(x=function(b){return{_hx_index:0,r:b,__enum__:"loreline.lorscript.TType",toString:F}},x._hx_name="TMono",x.__params__=["r"],x),TVoid:{_hx_name:"TVoid",_hx_index:1,__enum__:"loreline.lorscript.TType",toString:F},TInt:{_hx_name:"TInt",_hx_index:2,__enum__:"loreline.lorscript.TType",toString:F},TFloat:{_hx_name:"TFloat",_hx_index:3,__enum__:"loreline.lorscript.TType",toString:F},TBool:{_hx_name:"TBool",_hx_index:4,__enum__:"loreline.lorscript.TType",toString:F},TDynamic:{_hx_name:"TDynamic",_hx_index:5,__enum__:"loreline.lorscript.TType",toString:F},TParam:(x=function(b){return{_hx_index:6,name:b,__enum__:"loreline.lorscript.TType",toString:F}},x._hx_name="TParam",x.__params__=["name"],x),TUnresolved:(x=function(b){return{_hx_index:7,name:b,__enum__:"loreline.lorscript.TType",toString:F}},x._hx_name="TUnresolved",x.__params__=["name"],x),TNull:(x=function(b){return{_hx_index:8,t:b,__enum__:"loreline.lorscript.TType",toString:F}},x._hx_name="TNull",x.__params__=["t"],x),TInst:(x=function(b,e){return{_hx_index:9,c:b,args:e,__enum__:"loreline.lorscript.TType",toString:F}},x._hx_name="TInst",x.__params__=["c","args"],x),TEnum:(x=function(b,e){return{_hx_index:10,e:b,args:e,__enum__:"loreline.lorscript.TType",toString:F}},x._hx_name="TEnum",x.__params__=["e","args"],x),TType:(x=function(b,e){return{_hx_index:11,t:b,args:e,__enum__:"loreline.lorscript.TType",toString:F}},x._hx_name="TType",x.__params__=["t","args"],x),TAbstract:(x=function(b,e){return{_hx_index:12,a:b,args:e,__enum__:"loreline.lorscript.TType",toString:F}},x._hx_name="TAbstract",x.__params__=["a","args"],x),TFun:(x=function(b,e){return{_hx_index:13,args:b,ret:e,__enum__:"loreline.lorscript.TType",toString:F}},x._hx_name="TFun",x.__params__=["args","ret"],x),TAnon:(x=function(b){return{_hx_index:14,fields:b,__enum__:"loreline.lorscript.TType",toString:F}},x._hx_name="TAnon",x.__params__=["fields"],x),TLazy:(x=function(b){return{_hx_index:15,f:b,__enum__:"loreline.lorscript.TType",toString:F}},x._hx_name="TLazy",x.__params__=["f"],x)};G.__constructs__=[G.TMono,G.TVoid,G.TInt,G.TFloat,G.TBool,G.TDynamic,G.TParam,G.TUnresolved,G.TNull,G.TInst,G.TEnum,G.TType,G.TAbstract,G.TFun,G.TAnon,G.TLazy];var ve=Ye["loreline.lorscript._Checker.WithType"]={__ename__:"loreline.lorscript._Checker.WithType",__constructs__:null,NoValue:{_hx_name:"NoValue",_hx_index:0,__enum__:"loreline.lorscript._Checker.WithType",toString:F},Value:{_hx_name:"Value",_hx_index:1,__enum__:"loreline.lorscript._Checker.WithType",toString:F},WithType:(x=function(b){return{_hx_index:2,t:b,__enum__:"loreline.lorscript._Checker.WithType",toString:F}},x._hx_name="WithType",x.__params__=["t"],x)};ve.__constructs__=[ve.NoValue,ve.Value,ve.WithType];var dl=Ye["loreline.lorscript.CTypedecl"]={__ename__:"loreline.lorscript.CTypedecl",__constructs__:null,CTClass:(x=function(b){return{_hx_index:0,c:b,__enum__:"loreline.lorscript.CTypedecl",toString:F}},x._hx_name="CTClass",x.__params__=["c"],x),CTEnum:(x=function(b){return{_hx_index:1,e:b,__enum__:"loreline.lorscript.CTypedecl",toString:F}},x._hx_name="CTEnum",x.__params__=["e"],x),CTTypedef:(x=function(b){return{_hx_index:2,t:b,__enum__:"loreline.lorscript.CTypedecl",toString:F}},x._hx_name="CTTypedef",x.__params__=["t"],x),CTAlias:(x=function(b){return{_hx_index:3,t:b,__enum__:"loreline.lorscript.CTypedecl",toString:F}},x._hx_name="CTAlias",x.__params__=["t"],x),CTAbstract:(x=function(b){return{_hx_index:4,a:b,__enum__:"loreline.lorscript.CTypedecl",toString:F}},x._hx_name="CTAbstract",x.__params__=["a"],x)};dl.__constructs__=[dl.CTClass,dl.CTEnum,dl.CTTypedef,dl.CTAlias,dl.CTAbstract];class Bi{constructor(e,t){this.expr=e,this.t=t}}Q["loreline.lorscript.Completion"]=Bi,Bi.__name__="loreline.lorscript.Completion",Object.assign(Bi.prototype,{__class__:Bi});class tn{constructor(){this.types=new Ee,this.types=new Ee,this.types.h.Void=dl.CTAlias(G.TVoid),this.types.h.Int=dl.CTAlias(G.TInt),this.types.h.Float=dl.CTAlias(G.TFloat),this.types.h.Bool=dl.CTAlias(G.TBool),this.types.h.Dynamic=dl.CTAlias(G.TDynamic),this.parser=new ci}addXmlApi(e){let t=new Vi;t.process(e,"");let l=[],i=0,n=t.root;for(;i<n.length;){let r=n[i];++i,this.addXmlType(r,l)}let s=0;for(;s<l.length;){let r=l[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]=dl.CTClass(t),t}addXmlType(e,t){let l=this;switch(e._hx_index){case 0:let i=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 a=e.c;if(Object.prototype.hasOwnProperty.call(this.types.h,a.path))return;let h={name:a.path,params:[],fields:new Ee,statics:new Ee};this.addMeta(a,h),a.isInterface&&(h.isInterface=!0);let o=0,u=a.params;for(;o<u.length;){let v=u[o];++o,h.params.push(G.TParam(v))}t.push(function(){let v=new Ee,M=0,A=h.params;for(;M<A.length;){let N=A[M];++M;let D=a.path+"."+tt.typeStr(N);v.h[D]=N}if(l.localParams=v,a.superClass!=null){let N=l,D=a.superClass.path,U=[],W=0,J=a.superClass.params;for(;W<J.length;){let H=J[W];++W,U.push(l.makeXmlType(H))}h.superClass=N.getType(D,U)}if(a.interfaces!=null){h.interfaces=[];let N=0,D=a.interfaces;for(;N<D.length;){let U=D[N];++N;let W=h.interfaces,J=l,H=U.path,X=[],ae=0,ce=U.params;for(;ae<ce.length;){let ne=ce[ae];++ae,X.push(l.makeXmlType(ne))}W.push(J.getType(H,X))}}let L=[],I=function(N,D){if(N.isOverride||c.substr(N.name,0,4)=="get_"||c.substr(N.name,0,4)=="set_")return;let U=!N.name.startsWith("__"),W=0,J=N.meta;for(;W<J.length;){let re=J[W];if(++W,re.name==":noScript")return;re.name==":noCompletion"&&(U=!1)}let H=N.set,X;switch(H._hx_index){case 2:let re=H.m;X=!0;break;case 0:case 4:X=!0;break;default:X=!1}let ae={isPublic:N.isPublic,canWrite:X,complete:U,params:[],name:N.name,t:null},ce=0,ne=N.params;for(;ce<ne.length;){let re=ne[ce];++ce;let xe=G.TParam(re),Pe=N.name+"."+re;L.push(Pe),ae.params.push(xe),l.localParams.h[Pe]=xe}if(ae.t=l.makeXmlType(N.type),N.meta!=null&&N.meta.length>0){ae.meta=[];let re=0,xe=N.meta;for(;re<xe.length;){let Pe=xe[re];++re;let Ue=ae.meta,Je=Pe.name,lt=[],Ve=0,Qe=Pe.params;for(;Ve<Qe.length;){let at=Qe[Ve];++Ve;let Re;try{Re=l.parser.parseString(at)}catch($){if(C.caught($).unwrap()instanceof Se)Re=null;else throw $}lt.push(Re)}Ue.push({name:Je,params:lt})}}for(;L.length>0;){let re=l.localParams,xe=L.pop(),Pe=re;Object.prototype.hasOwnProperty.call(Pe.h,xe)&&delete Pe.h[xe]}ae.name=="new"?h.constructor=ae:D.set(N.name,ae)},q=0,z=a.fields;for(;q<z.length;){let N=z[q];++q,I(N,h.fields)}let P=0,B=a.statics;for(;P<B.length;){let N=B[P];++P,I(N,h.statics)}l.localParams=null}),this.types.h[h.name]=dl.CTClass(h);break;case 2:let p=e.e;if(Object.prototype.hasOwnProperty.call(this.types.h,p.path))return;let _={name:p.path,params:[],constructors:[]};this.addMeta(p,_);let m=0,f=p.params;for(;m<f.length;){let v=f[m];++m,_.params.push(G.TParam(v))}t.push(function(){let v=new Ee,M=0,A=_.params;for(;M<A.length;){let q=A[M];++M;let z=p.path+"."+tt.typeStr(q);v.h[z]=q}l.localParams=v;let L=0,I=p.constructors;for(;L<I.length;){let q=I[L];++L;let z=_.constructors,P=q.name,B;if(q.args==null)B=null;else{let N=[],D=0,U=q.args;for(;D<U.length;){let W=U[D];++D,N.push({name:W.name,opt:W.opt,t:l.makeXmlType(W.t)})}B=N}z.push({name:P,args:B})}l.localParams=null}),this.types.h[_.name]=dl.CTEnum(_);break;case 3:let g=e.t;if(Object.prototype.hasOwnProperty.call(this.types.h,g.path))return;let d={name:g.path,params:[],t:null},w=0,y=g.params;for(;w<y.length;){let v=y[w];++w,d.params.push(G.TParam(v))}g.path=="loreline.lorscript.TypeCheck"&&d.params.reverse(),t.push(function(){let v=new Ee,M=0,A=d.params;for(;M<A.length;){let L=A[M];++M;let I=g.path+"."+tt.typeStr(L);v.h[I]=L}l.localParams=v,d.t=l.makeXmlType(g.type),l.localParams=null}),this.types.h[g.path]=dl.CTTypedef(d);break;case 4:let S=e.a;if(Object.prototype.hasOwnProperty.call(this.types.h,S.path))return;let T={name:S.path,params:[],t:null};this.addMeta(S,T);let O=0,E=S.params;for(;O<E.length;){let v=E[O];++O,T.params.push(G.TParam(v))}t.push(function(){let v=new Ee,M=0,A=T.params;for(;M<A.length;){let L=A[M];++M;let I=S.path+"."+tt.typeStr(L);v.h[I]=L}l.localParams=v,T.t=l.makeXmlType(S.athis),l.localParams=null}),this.types.h[S.path]=dl.CTAbstract(T);break}}addMeta(e,t){if(e.meta==null||e.meta.length==0)return;t.meta=[];let l=0,i=e.meta;for(;l<i.length;){let n=i[l];++l;let s=t.meta,r=n.name,a=[],h=0,o=n.params;for(;h<o.length;){let u=o[h];++h;let p;try{p=this.parser.parseString(u)}catch(_){if(C.caught(_).unwrap()instanceof Se)p=null;else throw _}a.push(p)}s.push({name:r,params:a})}}makeXmlType(e){switch(e._hx_index){case 0:return G.TUnresolved("Unknown");case 1:let t=e.name,l=e.params,i=[],n=0;for(;n<l.length;){let A=l[n];++n,i.push(this.makeXmlType(A))}return this.getType(t,i);case 2:let s=e.name,r=e.params,a=[],h=0;for(;h<r.length;){let A=r[h];++h,a.push(this.makeXmlType(A))}return this.getType(s,a);case 3:let o=e.name,u=e.params,p=[],_=0;for(;_<u.length;){let A=u[_];++_,p.push(this.makeXmlType(A))}return this.getType(o,p);case 4:let m=e.args,f=e.ret,g=[],d=0;for(;d<m.length;){let A=m[d];++d,g.push({name:A.name,opt:A.opt,t:this.makeXmlType(A.t)})}return G.TFun(g,this.makeXmlType(f));case 5:let w=e.fields,y=[],S=0;for(;S<w.length;){let A=w[S];++S;let L=A.name,I=this.makeXmlType(A.type),q=A.meta,z;if(q==null)z=!1;else{let P=!1,B=0;for(;B<q.length;){let N=q[B];if(++B,N.name==":optional"){P=!0;break}}z=P}y.push({name:L,t:I,opt:z})}return G.TAnon(y);case 6:let T=e.t;return G.TDynamic;case 7:let O=e.name,E=e.params,v=[],M=0;for(;M<E.length;){let A=E[M];++M,v.push(this.makeXmlType(A))}return this.getType(O,v)}}getType(e,t){if(this.localParams!=null){let i=this.localParams.h[e];if(i!=null)return i}let l=this.resolve(e,t);if(l==null){let i=e.split(".");if(i.length>1){let n=i[i.length-2];if(c.cca(n,0)==95)return c.remove(i,n),this.getType(i.join("."),t)}return G.TUnresolved(e)}return l}resolve(e,t){if(e=="Null"){if(t==null||t.length!=1)throw C.thrown("Missing Null<T> parameter");return G.TNull(t[0])}let l=this.types.h[e];if(l==null)return null;switch(t==null&&(t=[]),l._hx_index){case 0:let i=l.c;return G.TInst(i,t);case 1:let n=l.e;return G.TEnum(n,t);case 2:let s=l.t;return G.TType(s,t);case 3:return l.t;case 4:let a=l.a;return G.TAbstract(a,t)}}}Q["loreline.lorscript.CheckerTypes"]=tn,tn.__name__="loreline.lorscript.CheckerTypes",Object.assign(tn.prototype,{__class__:tn});class tt{constructor(e){this.events=new Ee,this.globals=new Ee,e==null&&(e=new tn),this.types=e}setGlobals(e,t){t==null&&(t=!1);let l=this;for(;;){let i=e.fields.h,n=i,s=Object.keys(i),r=s.length,a=0;for(;a<r;){let o=n[s[a++]];if(o.isPublic||t){let u=o.params.length==0?o.t:G.TLazy(function(){let p=l,_=o.t,m=o.params,f=[],g=0,d=o.params.length;for(;g<d;){let w=g++;f.push(l.makeMono())}return p.apply(_,m,f)});this.setGlobal(o.name,u)}}if(e.superClass==null)break;let h=e.superClass;if(h==null)throw C.thrown("assert");if(h._hx_index==9){let o=h.args;e=h.c}else throw C.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 l=[],i=0,n=e.length;for(;i<n;){let s=i++,r=e[s],a=r.t==null?this.makeMono():this.makeType(r.t,t);l.push({name:r.name,opt:r.opt,t:a})}return l}check(e,t,l){l==null&&(l=!1),t==null&&(t=ve.NoValue),this.locals=new Ee,this.types.t_string==null&&(this.types.t_string=this.types.getType("String")),this.allowDefine=this.allowGlobalsDefine,this.isCompletion=l;let i=e.e,n;if(i._hx_index==14){let a=i.args,h=i.e,o=i.name,u=i.ret;n=!0}else n=!1;n&&(e=this.mk(K.EBlock([e]),e));let s=this,r=e.e;if(r._hx_index==4){let a=r.e,h=[],o=G.TVoid,u=0;for(;u<a.length;){let _=a[u];for(++u;;){let f=_.e;if(f._hx_index==25){let g=f.name,d=f.args;_=f.e}else break}let m=_.e;if(m._hx_index==14){let f=m.e,g=m.args,d=m.name,w=m.ret;if(d!=null){let y=w==null?this.makeMono():this.makeType(w,_),S=G.TFun(this.typeArgs(g,_),y);this.locals.h[d]=S,h.push(function(){return s.currentFunType=S,s.typeExpr(_,ve.NoValue),S})}else{let y=0;for(;y<h.length;){let S=h[y];++y,S()}h=[],a[a.length-1]==_?o=this.typeExpr(_,t):this.typeExpr(_,ve.NoValue)}}else{let f=0;for(;f<h.length;){let g=h[f];++f,g()}h=[],a[a.length-1]==_?o=this.typeExpr(_,t):this.typeExpr(_,ve.NoValue)}}let p=0;for(;p<h.length;){let _=h[p];++p,o=_()}return o}return this.typeExpr(e,t)}edef(e){return e.e}error(e,t){let l=Te.ECustom(e),i=new Se(l,t.pmin,t.pmax,t.origin,t.line);if(!this.isCompletion)throw C.thrown(i)}saveLocals(){let e=new Ee,t=this.locals.h,l=t,i=Object.keys(t),n=i.length,s=0;for(;s<n;){let r=i[s++];e.h[r]=this.locals.h[r]}return e}makeType(e,t){switch(e._hx_index){case 0:let l=e.path,i=e.params,n=this.types,s=l.join("."),r;if(i==null)r=[];else{let T=[],O=0;for(;O<i.length;){let E=i[O];++O,T.push(this.makeType(E,t))}r=T}let a=n.resolve(s,r);if(a==null){let T=Te.ECustom("Unknown type "+Y.string(l)),O=new Se(T,t.pmin,t.pmax,t.origin,t.line);if(!this.isCompletion)throw C.thrown(O);a=G.TDynamic}return a;case 1:let h=e.args,o=e.ret,u=0,p=[],_=0;for(;_<h.length;){let T=h[_];++_,p.push({name:"p"+u++,opt:!1,t:this.makeType(T,t)})}return G.TFun(p,this.makeType(o,t));case 2:let m=e.fields,f=[],g=0;for(;g<m.length;){let T=m[g];++g,f.push({name:T.name,opt:!1,t:this.makeType(T.t,t)})}return G.TAnon(f);case 3:let d=e.t;return this.makeType(d,t);case 4:let w=e.t;return this.makeType(w,t);case 5:let y=e.n,S=e.t;return this.makeType(S,t)}}linkLoop(e,t){if(t==e)return!0;switch(t._hx_index){case 0:let l=t.r;return l.r==null?!1:this.linkLoop(e,l.r);case 5:return t==G.TDynamic?!1:this.linkLoop(e,G.TDynamic);case 9:let i=t.c,n=t.args,s=0;for(;s<n.length;){let T=n[s];if(++s,this.linkLoop(e,T))return!0}return!1;case 10:let r=t.e,a=t.args,h=0;for(;h<a.length;){let T=a[h];if(++h,this.linkLoop(e,T))return!0}return!1;case 11:let o=t.t,u=t.args,p=0;for(;p<u.length;){let T=u[p];if(++p,this.linkLoop(e,T))return!0}return!1;case 12:let _=t.a,m=t.args,f=0;for(;f<m.length;){let T=m[f];if(++f,this.linkLoop(e,T))return!0}return!1;case 13:let g=t.args,d=t.ret,w=0;for(;w<g.length;){let T=g[w];if(++w,this.linkLoop(e,T.t))return!0}return this.linkLoop(e,d);case 14:let y=t.fields,S=0;for(;S<y.length;){let T=y[S];if(++S,this.linkLoop(e,T.t))return!0}return!1;default:return!1}}link(e,t,l){return this.linkLoop(e,t)?this.follow(t)==e:(t==G.TDynamic||(l.r=t),!0)}typeEq(e,t){if(e==t)return!0;switch(e._hx_index){case 0:let l=e.r;return l.r==null?this.link(e,t,l)?(l.r=t,!0):!1:this.typeEq(l.r,t);case 8:let i=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 d=t.t,w=i;return this.typeEq(w,d);case 11:let y=t.t,S=t.args;return this.typeEq(e,this.apply(y.t,y.params,S));default:let T=i;return this.typeEq(T,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 d=t.t;return this.typeEq(e,d);case 9:let w=t.c,y=t.args,S=s;if(n==w){let v=0,M=S.length;for(;v<M;){let A=v++;if(!this.typeEq(S[A],y[A]))return!1}return!0}break;case 11:let O=t.t,E=t.args;return this.typeEq(e,this.apply(O.t,O.params,E));default:}break;case 10:let r=e.e,a=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 d=t.t;return this.typeEq(e,d);case 10:let w=t.e,y=t.args,S=a;if(r==w){let v=0,M=S.length;for(;v<M;){let A=v++;if(!this.typeEq(S[A],y[A]))return!1}return!0}break;case 11:let O=t.t,E=t.args;return this.typeEq(e,this.apply(O.t,O.params,E));default:}break;case 11:let h=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 d=t.t,w=o,y=h;return this.typeEq(this.apply(y.t,y.params,w),t);case 11:let S=t.t,T=t.args,O=o;if(h==S){let A=0,L=O.length;for(;A<L;){let I=A++;if(!this.typeEq(O[I],T[I]))return!1}return!0}else{let A=o,L=h;return this.typeEq(this.apply(L.t,L.params,A),t)}break;default:let v=o,M=h;return this.typeEq(this.apply(M.t,M.params,v),t)}break;case 12:let u=e.a,p=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 d=t.t;return this.typeEq(e,d);case 11:let w=t.t,y=t.args;return this.typeEq(e,this.apply(w.t,w.params,y));case 12:let S=t.a,T=t.args,O=p;if(u==S){let v=0,M=O.length;for(;v<M;){let A=v++;if(!this.typeEq(O[A],T[A]))return!1}return!0}break;default:}break;case 13:let _=e.args,m=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 d=t.t;return this.typeEq(e,d);case 11:let w=t.t,y=t.args;return this.typeEq(e,this.apply(w.t,w.params,y));case 13:let S=t.args,T=t.ret,O=m,E=_;if(E.length==S.length){let v=0,M=E.length;for(;v<M;){let A=v++;if(!this.typeEq(E[A].t,S[A].t))return!1}return this.typeEq(O,T)}break;default:}break;case 14:let f=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 d=t.t;return this.typeEq(e,d);case 11:let w=t.t,y=t.args;return this.typeEq(e,this.apply(w.t,w.params,y));case 14:let S=t.fields,T=f;if(T.length==S.length){let O=Object.create(null),E=0;for(;E<S.length;){let M=S[E];++E,O[M.name]=M}let v=0;for(;v<T.length;){let M=T[v];++v;let A=O[M.name];if(A==null||!this.typeEq(M.t,A.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 d=t.t;return this.typeEq(e,d);case 11:let w=t.t,y=t.args;return this.typeEq(e,this.apply(w.t,w.params,y));default:}}return!1}tryUnify(e,t){if(e==t)return!0;switch(e._hx_index){case 0:let l=e.r;return l.r==null?this.link(e,t,l)?(l.r=t,!0):!1:this.tryUnify(l.r,t);case 2:switch(t._hx_index){case 0:let p=t.r;return p.r==null?this.link(t,e,p)?(p.r=e,!0):!1:this.tryUnify(e,p.r);case 3:return!0;case 5:return!0;case 8:let _=t.t;return this.tryUnify(e,_);case 11:let m=t.t,f=t.args;return this.tryUnify(e,this.apply(m.t,m.params,f));default:}break;case 5:switch(t._hx_index){case 0:let p=t.r;return p.r==null?this.link(t,e,p)?(p.r=e,!0):!1:this.tryUnify(e,p.r);case 5:return!0;case 8:let _=t.t;return this.tryUnify(e,_);case 11:let m=t.t,f=t.args;return this.tryUnify(e,this.apply(m.t,m.params,f));default:return!0}break;case 8:let i=e.t;switch(t._hx_index){case 0:let p=t.r;return p.r==null?this.link(t,e,p)?(p.r=e,!0):!1:this.tryUnify(e,p.r);case 5:let _=i;return this.tryUnify(_,t);case 8:let m=t.t,f=i;return this.tryUnify(f,t);case 11:let g=t.t,d=t.args;return this.tryUnify(e,this.apply(g.t,g.params,d));default:let w=i;return this.tryUnify(w,t)}break;case 9:let n=e.c,s=e.args;switch(t._hx_index){case 0:let p=t.r;return p.r==null?this.link(t,e,p)?(p.r=e,!0):!1:this.tryUnify(e,p.r);case 5:return!0;case 8:let _=t.t;return this.tryUnify(e,_);case 9:let m=t.c,f=t.args,g=s,d=n;for(;d!=m;){if(d.interfaces!=null){let I=0,q=d.interfaces;for(;I<q.length;){let z=q[I];if(++I,z._hx_index==9){let P=z.c,B=z.args,N=[],D=0;for(;D<B.length;){let W=B[D];++D,N.push(this.apply(W,d.params,g))}let U=G.TInst(P,N);if(this.tryUnify(U,t))return!0}else throw C.thrown("assert")}}let L=d.superClass;if(L==null)return!1;if(L._hx_index==9){let I=L.c,q=L.args,z=[],P=0;for(;P<q.length;){let B=q[P];++P,z.push(this.apply(B,d.params,g))}g=z,d=I}else throw C.thrown("assert")}let w=0,y=g.length;for(;w<y;){let L=w++;if(!this.typeEq(g[L],f[L]))return!1}return!0;case 11:let S=t.t,T=t.args;return this.tryUnify(e,this.apply(S.t,S.params,T));case 14:let O=t.fields,E=s,v=n,M=0,A=O.length;for(;M<A;){let L=M++,I=O[L],q=null,z=v;for(;q=z.fields.h[I.name],q==null;){if(z.superClass==null)return!1;let P=z.superClass;if(P==null)throw C.thrown("assert");if(P._hx_index==9){let B=P.args;z=P.c}else throw C.thrown("assert")}if(!this.typeEq(this.apply(q.t,v.params,E),I.t))return!1}return!0;default:}break;case 11:let r=e.t,a=e.args;switch(t._hx_index){case 0:let p=t.r;return p.r==null?this.link(t,e,p)?(p.r=e,!0):!1:this.tryUnify(e,p.r);case 5:let _=a,m=r;return this.tryUnify(this.apply(m.t,m.params,_),t);case 8:let f=t.t,g=a,d=r;return this.tryUnify(this.apply(d.t,d.params,g),t);case 11:let w=t.t,y=t.args,S=a,T=r;return this.tryUnify(this.apply(T.t,T.params,S),t);default:let O=a,E=r;return this.tryUnify(this.apply(E.t,E.params,O),t)}break;case 13:let h=e.args,o=e.ret;switch(t._hx_index){case 0:let p=t.r;return p.r==null?this.link(t,e,p)?(p.r=e,!0):!1:this.tryUnify(e,p.r);case 5:return!0;case 8:let _=t.t;return this.tryUnify(e,_);case 11:let m=t.t,f=t.args;return this.tryUnify(e,this.apply(m.t,m.params,f));case 12:let g=t.a,d=t.args,w=g.meta,y=g.params,S=g.t;if(g.name=="haxe.Function")return!0;break;case 13:let T=t.args,O=t.ret,E=o,v=h;if(v.length==T.length){let M=0,A=v.length;for(;M<A;){let L=M++,I=v[L],q=T[L];if(q.opt&&!I.opt||!this.tryUnify(q.t,I.t))return!1}return this.tryUnify(E,O)}break;default:}break;case 14:let u=e.fields;switch(t._hx_index){case 0:let p=t.r;return p.r==null?this.link(t,e,p)?(p.r=e,!0):!1:this.tryUnify(e,p.r);case 5:return!0;case 8:let _=t.t;return this.tryUnify(e,_);case 11:let m=t.t,f=t.args;return this.tryUnify(e,this.apply(m.t,m.params,f));case 14:let g=t.fields,d=u;if(g.length==0)return!0;let w=Object.create(null),y=0;for(;y<d.length;){let T=d[y];++y,w[T.name]=T}let S=0;for(;S<g.length;){let T=g[S];++S;let O=w[T.name];if(O==null){if(T.opt)continue;return!1}if(!this.typeEq(O.t,T.t))return!1}return!0;default:}break;default:switch(t._hx_index){case 0:let p=t.r;return p.r==null?this.link(t,e,p)?(p.r=e,!0):!1:this.tryUnify(e,p.r);case 5:return!0;case 8:let _=t.t;return this.tryUnify(e,_);case 11:let m=t.t,f=t.args;return this.tryUnify(e,this.apply(m.t,m.params,f));default:}}return this.typeEq(e,t)}unify(e,t,l){if(!this.tryUnify(e,t)){let i=Te.ECustom(tt.typeStr(e)+" should be "+tt.typeStr(t)),n=new Se(i,l.pmin,l.pmax,l.origin,l.line);if(!this.isCompletion)throw C.thrown(n)}}apply(e,t,l){if(l.length!=t.length)throw C.thrown("Invalid number of type parameters");if(l.length==0)return e;let i=new ri,n=0,s=t.length;for(;n<s;){let h=n++;i.set(t[h],l[h])}let r=null,a=this;return r=function(h){let o=i.get(h);return o??a.mapType(h,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 i=e.name;return e;case 7:let n=e.name;return e;case 8:let s=e.t;return G.TNull(t(s));case 9:let r=e.args;if(r.length==0)return e;{let y=r,S=e.c,T=[],O=0;for(;O<y.length;){let E=y[O];++O,T.push(t(E))}return G.TInst(S,T)}break;case 10:let a=e.args;if(a.length==0)return e;{let y=a,S=e.e,T=[],O=0;for(;O<y.length;){let E=y[O];++O,T.push(t(E))}return G.TEnum(S,T)}break;case 11:let h=e.args;if(h.length==0)return e;{let y=h,S=e.t,T=[],O=0;for(;O<y.length;){let E=y[O];++O,T.push(t(E))}return G.TType(S,T)}break;case 12:let o=e.args;if(o.length==0)return e;{let y=o,S=e.a,T=[],O=0;for(;O<y.length;){let E=y[O];++O,T.push(t(E))}return G.TAbstract(S,T)}break;case 13:let u=e.args,p=e.ret,_=[],m=0;for(;m<u.length;){let y=u[m];++m,_.push({name:y.name,opt:y.opt,t:t(y.t)})}return G.TFun(_,t(p));case 14:let f=e.fields,g=[],d=0;for(;d<f.length;){let y=f[d];++d,g.push({name:y.name,opt:y.opt,t:t(y.t)})}return G.TAnon(g);case 15:let w=e.f;return t(w())}}follow(e){switch(e._hx_index){case 0:let t=e.r;return t.r!=null?this.follow(t.r):e;case 8:let l=e.t;return this.follow(l);case 11:let i=e.t,n=e.args;return this.follow(this.apply(i.t,i.params,n));case 15:let s=e.f;return this.follow(s());default:return e}}getFields(e){let t=[],l=this,i=this.follow(e);switch(i._hx_index){case 9:let n=i.c,s=i.args,r=function(p){return l.apply(p,n.params,s)};for(;n!=null;){let p=n.fields.h,_=p,m=Object.keys(p),f=m.length,g=0;for(;g<f;){let w=m[g++],y=n.fields.h[w];if(!y.isPublic||!y.complete)continue;let S=y.name,T=r(y.t);this.allowAsync&&S.startsWith("a_")&&(T=this.unasync(T),S=c.substr(S,2,null)),t.push({name:S,t:T})}if(n.isInterface&&n.interfaces!=null){let w=0,y=n.interfaces;for(;w<y.length;){let S=y[w];++w;let T=0,O=this.getFields(S);for(;T<O.length;){let E=O[T];++T,t.push({name:E.name,t:r(E.t)})}}}if(n.superClass==null)break;let d=n.superClass;if(d==null)break;if(d._hx_index==9){let w=d.c,y=d.args,S=r;r=function(T){return S(l.apply(T,w.params,y))},n=w}else break}break;case 13:let a=i.args,h=i.ret;this.isCompletion&&t.push({name:"bind",t:G.TFun(a,G.TVoid)});break;case 14:let o=i.fields,u=0;for(;u<o.length;){let p=o[u];++u,t.push({name:p.name,t:p.t})}break;default:}return t}getField(e,t,l,i){i==null&&(i=!1);let n=this.follow(e);switch(n._hx_index){case 5:return this.makeMono();case 9:let s=n.c,r=n.args,a=s.fields.h[t];if(a==null&&this.allowAsync&&(a=s.fields.h["a_"+t],a!=null&&(a={isPublic:!0,canWrite:!1,params:a.params,name:a.name,t:this.unasync(a.t),complete:a.complete},a.t==null&&(a=null))),a==null&&s.isInterface&&s.interfaces!=null){let p=0,_=s.interfaces;for(;p<_.length;){let m=_[p];++p;let f=this.getField(m,t,l,i);if(f!=null)return this.apply(f,s.params,r)}}if(a==null){if(s.superClass==null)return null;let p=this.getField(s.superClass,t,l,i);return p!=null&&(p=this.apply(p,s.params,r)),p}if(!a.isPublic){let p=Te.ECustom("Can't access private field "+t+" on "+s.name),_=new Se(p,l.pmin,l.pmax,l.origin,l.line);if(!this.isCompletion)throw C.thrown(_)}if(i&&!a.canWrite){let p=Te.ECustom("Can't write readonly field "+t+" on "+s.name),_=new Se(p,l.pmin,l.pmax,l.origin,l.line);if(!this.isCompletion)throw C.thrown(_)}let h=a.t;if(a.params!=null){let p=a.params,_=[],m=0,f=a.params.length;for(;m<f;){let g=m++;_.push(this.makeMono())}h=this.apply(h,p,_)}return this.apply(h,s.params,r);case 14:let o=n.fields,u=0;for(;u<o.length;){let p=o[u];if(++u,p.name==t)return p.t}return null;default:return null}}unasync(e){let t=this.follow(e);if(t._hx_index==13){let l=t.args,i=t.ret;if(l.length>0){let n=l.slice(),s=this.follow(n.shift().t);if(s._hx_index==13){let r=s.args,a=s.ret;if(r.length==1){let h=r[0];return G.TFun(n,h.t)}}}}return null}typeExprWith(e,t){let l=this.typeExpr(e,ve.WithType(t));return this.unify(l,t,e),t}makeMono(){return G.TMono({r:null})}makeIterator(e){return G.TAnon([{name:"next",opt:!1,t:G.TFun([],e)},{name:"hasNext",opt:!1,t:G.TFun([],G.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,l=e.args,i=t.constructor,n=t.fields,s=t.interfaces,r=t.isInterface,a=t.meta,h=t.params,o=t.statics,u=t.superClass;return t.name=="String"}else return!1}onCompletion(e,t){if(this.isCompletion)throw C.thrown(new Bi(e,t))}typeField(e,t,l,i){let n=this.typeExpr(e,ve.Value);t==null&&this.onCompletion(l,n);let s=this.getField(n,t,l,i);if(s==null){let r=Te.ECustom(tt.typeStr(n)+" has no field "+t),a=new Se(r,l.pmin,l.pmax,l.origin,l.line);if(!this.isCompletion)throw C.thrown(a);s=G.TDynamic}return s}typeExpr(e,t){if(e==null&&this.isCompletion)return t._hx_index==2?t.t:G.TDynamic;let l=this,i=e.e;switch(i._hx_index){case 0:let a=i.c;switch(a._hx_index){case 0:let fe=a.v;return G.TInt;case 1:let ke=a.f;return G.TFloat;case 2:let Fe=a.s;return this.types.t_string}break;case 1:let h=i.v,o=this.locals.h[h];if(o!=null)return o;let u=this.globals.h[h];if(u!=null){if(u==null)return u;if(u._hx_index==15){let fe=u.f;return fe()}else return u}if(this.allowAsync&&(u=this.globals.h["a_"+h],u!=null&&(u=this.unasync(u)),u!=null))return u;switch(h){case"false":case"true":return G.TBool;case"null":return this.makeMono();case"trace":return G.TDynamic;default:if(t._hx_index==2){let Fe=t.t;if(Fe._hx_index==10){let We=Fe,Wt=Fe.e,Dt=Fe.args,ut=0,vl=Wt.constructors;for(;ut<vl.length;){let pl=vl[ut];if(++ut,pl.name==h){if(this.onTopDownEnum(Wt,h)){let mt=pl.args==null?We:G.TFun(pl.args,We);return this.apply(mt,Wt.params,Dt)}break}}}}if(this.isCompletion)return G.TDynamic;let fe=Te.ECustom("Unknown identifier "+h),ke=new Se(fe,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw C.thrown(ke)}break;case 2:let p=i.n,_=i.t,m=i.e,f=_==null?this.makeMono():this.makeType(_,e);if(m!=null){let fe=this.typeExpr(m,_==null?ve.Value:ve.WithType(f));_==null?f=fe:this.unify(fe,f,m)}return this.locals.h[p]=f,G.TVoid;case 3:let g=i.e;return this.typeExpr(g,t);case 4:let d=i.e,w=G.TVoid,y=this.saveLocals(),S=0;for(;S<d.length;){let fe=d[S];++S,w=this.typeExpr(fe,fe==d[d.length-1]?t:ve.NoValue)}return this.locals=y,w;case 5:let T=i.e,O=i.f;return this.typeField(T,O,e,!1);case 6:let E=i.op,v=i.e1,M=i.e2;switch(E){case"!=":case"==":let fe=this.typeExpr(v,ve.Value),ke=this.typeExpr(M,ve.WithType(fe));return this.tryUnify(fe,ke)||this.unify(ke,fe,M),G.TBool;case"%":case"*":case"-":case"/":let Fe=this.typeExpr(v,ve.WithType(G.TInt)),We=this.typeExpr(M,ve.WithType(Fe));this.tryUnify(Fe,We)||this.unify(We,Fe,M);let Wt=this.follow(Fe),Dt=this.follow(We);switch(Wt._hx_index){case 2:switch(Dt._hx_index){case 2:return E=="/"?G.TFloat:G.TInt;case 3:case 5:return G.TFloat;default:this.unify(Fe,G.TFloat,v),this.unify(We,G.TFloat,M)}break;case 3:switch(Dt._hx_index){case 2:case 3:case 5:return G.TFloat;default:this.unify(Fe,G.TFloat,v),this.unify(We,G.TFloat,M)}break;case 5:switch(Dt._hx_index){case 2:case 3:case 5:return G.TFloat;default:this.unify(Fe,G.TFloat,v),this.unify(We,G.TFloat,M)}break;default:this.unify(Fe,G.TFloat,v),this.unify(We,G.TFloat,M)}break;case"+":let ut=this.typeExpr(v,ve.WithType(G.TInt)),vl=this.typeExpr(M,ve.WithType(ut));this.tryUnify(ut,vl);let pl=this.follow(ut),mt=this.follow(vl);switch(pl._hx_index){case 2:switch(mt._hx_index){case 2:return G.TInt;case 3:return G.TFloat;case 5:return G.TDynamic;default:let Pt=pl,Tl=mt;if(this.isString(Pt)||this.isString(Tl))return this.types.t_string;this.unify(Pt,G.TFloat,v),this.unify(Tl,G.TFloat,M)}break;case 3:switch(mt._hx_index){case 2:case 3:return G.TFloat;case 5:return G.TDynamic;default:let Pt=pl,Tl=mt;if(this.isString(Pt)||this.isString(Tl))return this.types.t_string;this.unify(Pt,G.TFloat,v),this.unify(Tl,G.TFloat,M)}break;case 5:return G.TDynamic;default:if(mt._hx_index==5)return G.TDynamic;{let Pt=pl,Tl=mt;if(this.isString(Pt)||this.isString(Tl))return this.types.t_string;this.unify(Pt,G.TFloat,v),this.unify(Tl,G.TFloat,M)}}break;case"...":return this.typeExprWith(v,G.TInt),this.typeExprWith(M,G.TInt),this.makeIterator(G.TInt);case"&":case"<<":case">>":case">>>":case"^":case"|":return this.typeExprWith(v,G.TInt),this.typeExprWith(M,G.TInt),G.TInt;case"<":case"<=":case">":case">=":let Qt=this.typeExpr(v,ve.Value),zl=this.typeExpr(M,ve.WithType(Qt));this.tryUnify(Qt,zl)||this.unify(zl,Qt,M);let pi=this.follow(Qt);switch(pi._hx_index){case 2:case 3:case 4:break;case 9:let Pt=pi.c,Tl=pi.args,dn=Pt.constructor,jn=Pt.fields,Kn=Pt.interfaces,Jn=Pt.isInterface,Hn=Pt.meta,Gn=Pt.params,Qn=Pt.statics,$n=Pt.superClass;if(Pt.name!="String"){let Vn=Te.ECustom("Cannot compare "+tt.typeStr(Qt)),qn=new Se(Vn,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw C.thrown(qn)}break;default:let Rn=Te.ECustom("Cannot compare "+tt.typeStr(Qt)),Un=new Se(Rn,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw C.thrown(Un)}return G.TBool;case"=":if(this.allowDefine){let Pt=v.e;if(Pt._hx_index==1){let Tl=Pt.v;if(!Object.prototype.hasOwnProperty.call(this.locals.h,Tl)&&!Object.prototype.hasOwnProperty.call(this.globals.h,Tl)){let dn=this.typeExpr(M,ve.Value);return this.locals.h[Tl]=dn,dn}}}let Ai,an=v.e;if(an._hx_index==5){let Pt=an.e,Tl=an.f;Ai=this.typeField(Pt,Tl,v,!0)}else Ai=this.typeExpr(v,ve.Value);return this.typeExprWith(M,Ai),Ai;case"&&":case"||":return this.typeExprWith(v,G.TBool),this.typeExprWith(M,G.TBool),G.TBool;default:if(c.cca(E,E.length-1)==61){let Pt=this.typeExpr(this.mk(K.EBinop(c.substr(E,0,E.length-1),v,M),e),t);return this.typeExpr(this.mk(K.EBinop("=",v,M),e),t)}let Dn=Te.ECustom("Unsupported operation "+E),An=new Se(Dn,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw C.thrown(An)}break;case 7:let A=i.prefix,L=i.op,I=i.e,q=this.typeExpr(I,ve.Value);switch(L){case"!":return this.unify(q,G.TBool,I),q;case"++":case"-":case"--":return this.unify(q,G.TInt,I),q;default:}break;case 8:let z=i.e,P=i.params,B=z.e;if(B._hx_index==5&&B.f=="bind"){let fe=B.e,ke=this.typeExpr(fe,ve.Value);if(ke._hx_index==13){let Fe=ke.args,We=ke.ret,Wt=Fe.slice(),Dt=0;for(;Dt<P.length;){let ut=P[Dt];++Dt;let vl=Wt.shift();if(vl==null){let pl=Te.ECustom("Too many arguments"),mt=new Se(pl,ut.pmin,ut.pmax,ut.origin,ut.line);if(!this.isCompletion)throw C.thrown(mt);return G.TFun([],We)}this.typeExprWith(ut,vl.t)}return G.TFun(Wt,We)}}let N=z.e,D;if(N._hx_index==1){let fe=N.v;if(t._hx_index==2){let ke=t.t;if(ke._hx_index==10){let Fe=ke.e,We=ke.args;D=t}else D=ve.Value}else D=ve.Value}else D=ve.Value;let U=this.typeExpr(z,D),W=this.follow(U);switch(W._hx_index){case 5:let fe=0;for(;fe<P.length;){let mt=P[fe];++fe,this.typeExpr(mt,ve.Value)}return this.makeMono();case 13:let ke=W.args,Fe=W.ret,We=0,Wt=P.length;for(;We<Wt;){let mt=We++,Qt=ke[mt];if(Qt==null){let pi=P[mt],Ai=Te.ECustom("Too many arguments"),an=new Se(Ai,pi.pmin,pi.pmax,pi.origin,pi.line);if(!this.isCompletion)throw C.thrown(an);break}let zl=this.typeExpr(P[mt],Qt==null?ve.Value:ve.WithType(Qt.t));this.unify(zl,Qt.t,P[mt])}let Dt=P.length,ut=ke.length;for(;Dt<ut;){let mt=Dt++;if(!ke[mt].opt){let Qt=Te.ECustom("Missing argument "+ke[mt].name+":"+tt.typeStr(ke[mt].t)),zl=new Se(Qt,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw C.thrown(zl)}}return Fe;default:let vl=Te.ECustom(tt.typeStr(U)+" cannot be called"),pl=new Se(vl,z.pmin,z.pmax,z.origin,z.line);if(!this.isCompletion)throw C.thrown(pl);return this.makeMono()}break;case 9:let J=i.cond,H=i.e1,X=i.e2;this.typeExprWith(J,G.TBool);let ae=this.typeExpr(H,t);if(X==null)return ae;let ce=this.typeExpr(X,t);if(t==ve.NoValue)return G.TVoid;if(this.tryUnify(ce,ae))return ae;if(this.tryUnify(ae,ce))return ce;this.unify(ce,ae,X);break;case 10:let ne=i.cond,re=i.e;return this.typeExprWith(ne,G.TBool),this.typeExpr(re,ve.NoValue),G.TVoid;case 11:let xe=i.v,Pe=i.it,Ue=i.e,Je=this.saveLocals(),lt=this.typeExpr(Pe,ve.Value),Ve=this.getIteratorType(Pe,lt);return this.locals.h[xe]=Ve,this.typeExpr(Ue,ve.NoValue),this.locals=Je,G.TVoid;case 12:case 13:return G.TVoid;case 14:let Qe=i.args,at=i.e,Re=i.name,$=i.ret,se=null,j=null,ie=null;if(this.currentFunType!=null){let fe=this.currentFunType;if(fe._hx_index==13){let ke=fe.args,Fe=fe.ret;se=this.currentFunType,j=Fe,ie=ke}else throw C.thrown("assert");this.currentFunType=null}else j=$==null?this.makeMono():this.makeType($,e);let le=this.saveLocals(),ee=this.allowReturn,pe=this.allowDefine,me=this.hasReturn;this.allowReturn=j,this.allowDefine=!1,this.hasReturn=!1;let we=null,Ze;if(Re!=null){let fe;if(t._hx_index==2){let ke=this.follow(t.t);if(ke._hx_index==13){let Fe=ke.args,We=ke.ret;fe=!0}else fe=!1}else fe=!1;Ze=!fe}else Ze=!1;if(Ze){let fe=this.events.h[Re];fe!=null&&(t=ve.WithType(fe))}if(t._hx_index==2){let fe=this.follow(t.t);if(fe._hx_index==13){let ke=fe.args,Fe=fe.ret;we=ke,this.unify(j,Fe,e)}}ie==null&&(ie=this.typeArgs(Qe,e));let yt=0,Le=ie.length;for(;yt<Le;){let fe=yt++,ke=ie[fe];if(we!=null)if(fe<we.length)this.unify(we[fe].t,ke.t,e);else{let Fe=Te.ECustom("Extra argument "+ke.name),We=new Se(Fe,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw C.thrown(We)}this.locals.h[ke.name]=ke.t}if(we!=null&&ie.length<we.length){let fe="Missing "+(we.length-ie.length)+" arguments (",ke=[],Fe=ie.length,We=we.length;for(;Fe<We;){let ut=Fe++;ke.push(tt.typeStr(we[ut].t))}let Wt=Te.ECustom(fe+ke.join(",")+")"),Dt=new Se(Wt,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw C.thrown(Dt)}if(this.typeExpr(at,ve.NoValue),!this.hasReturn&&!this.tryUnify(j,G.TVoid)){let fe=Te.ECustom("Missing return "+tt.typeStr(j)),ke=new Se(fe,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw C.thrown(ke)}return this.allowDefine=pe,this.allowReturn=ee,this.hasReturn=me,this.locals=le,se==null&&(se=G.TFun(ie,j),Re!=null&&(le.h[Re]=se)),se;case 15:let dt=i.e,Oe=dt==null?G.TVoid:this.typeExpr(dt,this.allowReturn==null?ve.Value:ve.WithType(this.allowReturn));if(this.hasReturn=!0,this.allowReturn==null){let fe=Te.ECustom("Return not allowed here"),ke=new Se(fe,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw C.thrown(ke)}else this.unify(Oe,this.allowReturn,dt??e);return this.makeMono();case 16:let Ie=i.e,pt=i.index;this.typeExprWith(pt,G.TInt);let it=this.typeExpr(Ie,ve.Value),Ot=this.follow(it);if(Ot._hx_index==9){let fe=Ot.c,ke=Ot.args,Fe=fe.constructor,We=fe.fields,Wt=fe.interfaces,Dt=fe.isInterface,ut=fe.meta,vl=fe.params,pl=fe.statics,mt=fe.superClass;if(fe.name=="Array"){if(ke.length==1)return ke[0];{let Qt=Te.ECustom(tt.typeStr(it)+" is not an Array"),zl=new Se(Qt,Ie.pmin,Ie.pmax,Ie.origin,Ie.line);if(!this.isCompletion)throw C.thrown(zl)}}else{let Qt=Te.ECustom(tt.typeStr(it)+" is not an Array"),zl=new Se(Qt,Ie.pmin,Ie.pmax,Ie.origin,Ie.line);if(!this.isCompletion)throw C.thrown(zl)}}else{let fe=Te.ECustom(tt.typeStr(it)+" is not an Array"),ke=new Se(fe,Ie.pmin,Ie.pmax,Ie.origin,Ie.line);if(!this.isCompletion)throw C.thrown(ke)}break;case 17:let Yt=i.e,xt=null,ol=0;for(;ol<Yt.length;){let fe=Yt[ol];++ol;let ke=this.typeExpr(fe,xt==null?ve.Value:ve.WithType(xt));xt==null?xt=ke:this.tryUnify(ke,xt)||(this.tryUnify(xt,ke)?xt=ke:this.unify(ke,xt,fe))}return xt==null&&(xt=this.makeMono()),this.types.getType("Array",[xt]);case 18:let $e=i.cl,Vt=i.params;break;case 19:let Bt=i.e;return this.typeExpr(Bt,ve.Value),this.makeMono();case 20:let qt=i.e,wt=i.v,Ht=i.t,Zt=i.ecatch,Gt=this.typeExpr(qt,t),ul=this.locals.h[wt],cl=this.locals,Xt=this.makeType(Ht,Zt);cl.h[wt]=Xt;let nt=this.typeExpr(Zt,t);if(ul!=null)this.locals.h[wt]=ul;else{let fe=this.locals;Object.prototype.hasOwnProperty.call(fe.h,wt)&&delete fe.h[wt]}return t==ve.NoValue?G.TVoid:this.tryUnify(Gt,nt)?nt:(this.unify(nt,Gt,Zt),Gt);case 21:let Sl=i.fl;if(t._hx_index==2){let fe=this.follow(t.t);if(fe._hx_index==14){let ke=fe.fields;if(ke.length>0){let Fe=Object.create(null),We=0;for(;We<ke.length;){let ut=ke[We];++We,Fe[ut.name]=ut}let Wt=[],Dt=0;for(;Dt<Sl.length;){let ut=Sl[Dt];++Dt;let vl=Fe[ut.name],pl;if(vl==null){let mt=ut.e,Qt=Te.ECustom("Extra field "+ut.name),zl=new Se(Qt,mt.pmin,mt.pmax,mt.origin,mt.line);if(!this.isCompletion)throw C.thrown(zl);pl=G.TDynamic}else pl=vl.t;Wt.push({t:this.typeExprWith(ut.e,pl),opt:!1,name:ut.name})}return G.TAnon(Wt)}else{let Fe=[],We=0;for(;We<Sl.length;){let Wt=Sl[We];++We,Fe.push({t:this.typeExpr(Wt.e,ve.Value),opt:!1,name:Wt.name})}return G.TAnon(Fe)}}else{let ke=[],Fe=0;for(;Fe<Sl.length;){let We=Sl[Fe];++Fe,ke.push({t:this.typeExpr(We.e,ve.Value),opt:!1,name:We.name})}return G.TAnon(ke)}}else{let fe=[],ke=0;for(;ke<Sl.length;){let Fe=Sl[ke];++ke,fe.push({t:this.typeExpr(Fe.e,ve.Value),opt:!1,name:Fe.name})}return G.TAnon(fe)}break;case 22:let Ce=i.cond,rt=i.e1,_t=i.e2;this.typeExprWith(Ce,G.TBool);let ot=this.typeExpr(rt,t);if(_t==null)return ot;let bt=this.typeExpr(_t,t);if(t==ve.NoValue)return G.TVoid;if(this.tryUnify(bt,ot))return ot;if(this.tryUnify(ot,bt))return bt;this.unify(bt,ot,_t);break;case 23:let Ct=i.e,Ft=i.cases,el=i.defaultExpr,Tt=null,rn=this.typeExpr(Ct,ve.Value),yi=0;for(;yi<Ft.length;){let fe=Ft[yi];++yi;let ke=0,Fe=fe.values;for(;ke<Fe.length;){let Dt=Fe[ke];++ke;let ut=this.typeExpr(Dt,ve.WithType(rn));this.unify(ut,rn,Dt)}let We=this.typeExpr(fe.expr,t),Wt=fe.expr;t!=ve.NoValue&&(Tt==null?Tt=We:l.tryUnify(We,Tt)||(l.unify(Tt,We,Wt),Tt=We))}if(el!=null){let fe=this.typeExpr(el,t);t!=ve.NoValue&&(Tt==null?Tt=fe:l.tryUnify(fe,Tt)||(l.unify(Tt,fe,el),Tt=fe))}return t==ve.NoValue?G.TVoid:Tt??this.makeMono();case 24:let si=i.cond,mn=i.e;return this.typeExprWith(si,G.TBool),this.typeExpr(mn,ve.NoValue),G.TVoid;case 25:let zn=i.args,Mn=i.name,Fn=i.e;return Mn==":untyped"&&this.allowUntypedMeta?this.makeMono():this.typeExpr(Fn,t);case 26:let Cn=i.e,Ln=i.t,gn=this.makeType(Ln,e),Bn=this.typeExpr(Cn,ve.WithType(gn));return this.unify(Bn,gn,Cn),gn}let n=e.e,s=Te.ECustom("Don't know how to type "+Ye[n.__enum__].__constructs__[n._hx_index]._hx_name),r=new Se(s,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw C.thrown(r);return G.TDynamic}getIteratorType(e,t){let l=this.follow(t);if(l._hx_index==9){let r=l.c,a=l.args,h=r.constructor,o=r.fields,u=r.interfaces,p=r.isInterface,_=r.meta,m=r.params,f=r.statics,g=r.superClass;if(r.name=="Array"&&a.length==1)return a[0]}let i=this.getField(t,"iterator",e);if(i==null&&t._hx_index==12){let r=t.a,a=t.args,h=this.apply(r.t,r.params,a);return this.getIteratorType(e,h)}i!=null&&(i==null?i=null:i._hx_index==13&&i.args.length==0?i=i.ret:i=null);let n=this.makeMono(),s=this.makeIterator(n);return this.unify(i??t,s,e),n}static typeStr(e){switch(e._hx_index){case 0:let t=e.r;return t.r==null?"Unknown":tt.typeStr(t.r);case 6:return e.name;case 7:return"?"+e.name;case 8:let n=e.t;return"Null<"+tt.typeStr(n)+">";case 9:let s=e.c,r=e.args,a=s.name,h;if(r.length==0)h="";else{let L=[],I=0;for(;I<r.length;){let q=r[I];++I,L.push(tt.typeStr(q))}h="<"+L.join(",")+">"}return a+h;case 10:let o=e.e,u=e.args,p=o.name,_;if(u.length==0)_="";else{let L=[],I=0;for(;I<u.length;){let q=u[I];++I,L.push(tt.typeStr(q))}_="<"+L.join(",")+">"}return p+_;case 11:let m=e.t,f=e.args;if(m.name=="loreline.lorscript.TypeCheck")return tt.typeStr(f[1]);{let L=m.name,I;if(f.length==0)I="";else{let q=[],z=0;for(;z<f.length;){let P=f[z];++z,q.push(tt.typeStr(P))}I="<"+q.join(",")+">"}return L+I}break;case 12:let g=e.a,d=e.args,w=g.name,y;if(d.length==0)y="";else{let L=[],I=0;for(;I<d.length;){let q=d[I];++I,L.push(tt.typeStr(q))}y="<"+L.join(",")+">"}return w+y;case 13:let S=e.args,T=e.ret,O=[],E=0;for(;E<S.length;){let L=S[E];++E,O.push((L.opt?"?":"")+(L.name==""?"":L.name+":")+tt.typeStr(L.t))}return"("+O.join(", ")+") -> "+tt.typeStr(T);case 14:let v=e.fields,M=[],A=0;for(;A<v.length;){let L=v[A];++A,M.push((L.opt?"?":"")+L.name+":"+tt.typeStr(L.t))}return"{"+M.join(", ")+"}";default:return c.substr(Ye[e.__enum__].__constructs__[e._hx_index]._hx_name,1,null)}}static typeIter(e,t){switch(e._hx_index){case 0:let l=e.r;l.r!=null&&t(l.r);break;case 8:let i=e.t;t(i);break;case 9:let n=e.c,s=e.args,r=0;for(;r<s.length;){let E=s[r];++r,t(E)}break;case 10:let a=e.e,h=e.args,o=0;for(;o<h.length;){let E=h[o];++o,t(E)}break;case 11:let u=e.t,p=e.args,_=0;for(;_<p.length;){let E=p[_];++_,t(E)}break;case 12:let m=e.a,f=e.args,g=0;for(;g<f.length;){let E=f[g];++g,t(E)}break;case 13:let d=e.args,w=e.ret,y=0;for(;y<d.length;){let E=d[y];++y,t(E.t)}t(w);break;case 14:let S=e.fields,T=0;for(;T<S.length;){let E=S[T];++T,t(E.t)}break;case 15:let O=e.f;t(O());break;default:}}}Q["loreline.lorscript.Checker"]=tt,tt.__name__="loreline.lorscript.Checker",Object.assign(tt.prototype,{__class__:tt});var yl=Ye["loreline.lorscript.Const"]={__ename__:"loreline.lorscript.Const",__constructs__:null,CInt:(x=function(b){return{_hx_index:0,v:b,__enum__:"loreline.lorscript.Const",toString:F}},x._hx_name="CInt",x.__params__=["v"],x),CFloat:(x=function(b){return{_hx_index:1,f:b,__enum__:"loreline.lorscript.Const",toString:F}},x._hx_name="CFloat",x.__params__=["f"],x),CString:(x=function(b){return{_hx_index:2,s:b,__enum__:"loreline.lorscript.Const",toString:F}},x._hx_name="CString",x.__params__=["s"],x)};yl.__constructs__=[yl.CInt,yl.CFloat,yl.CString];var K=Ye["loreline.lorscript.ExprDef"]={__ename__:"loreline.lorscript.ExprDef",__constructs__:null,EConst:(x=function(b){return{_hx_index:0,c:b,__enum__:"loreline.lorscript.ExprDef",toString:F}},x._hx_name="EConst",x.__params__=["c"],x),EIdent:(x=function(b){return{_hx_index:1,v:b,__enum__:"loreline.lorscript.ExprDef",toString:F}},x._hx_name="EIdent",x.__params__=["v"],x),EVar:(x=function(b,e,t){return{_hx_index:2,n:b,t:e,e:t,__enum__:"loreline.lorscript.ExprDef",toString:F}},x._hx_name="EVar",x.__params__=["n","t","e"],x),EParent:(x=function(b){return{_hx_index:3,e:b,__enum__:"loreline.lorscript.ExprDef",toString:F}},x._hx_name="EParent",x.__params__=["e"],x),EBlock:(x=function(b){return{_hx_index:4,e:b,__enum__:"loreline.lorscript.ExprDef",toString:F}},x._hx_name="EBlock",x.__params__=["e"],x),EField:(x=function(b,e){return{_hx_index:5,e:b,f:e,__enum__:"loreline.lorscript.ExprDef",toString:F}},x._hx_name="EField",x.__params__=["e","f"],x),EBinop:(x=function(b,e,t){return{_hx_index:6,op:b,e1:e,e2:t,__enum__:"loreline.lorscript.ExprDef",toString:F}},x._hx_name="EBinop",x.__params__=["op","e1","e2"],x),EUnop:(x=function(b,e,t){return{_hx_index:7,op:b,prefix:e,e:t,__enum__:"loreline.lorscript.ExprDef",toString:F}},x._hx_name="EUnop",x.__params__=["op","prefix","e"],x),ECall:(x=function(b,e){return{_hx_index:8,e:b,params:e,__enum__:"loreline.lorscript.ExprDef",toString:F}},x._hx_name="ECall",x.__params__=["e","params"],x),EIf:(x=function(b,e,t){return{_hx_index:9,cond:b,e1:e,e2:t,__enum__:"loreline.lorscript.ExprDef",toString:F}},x._hx_name="EIf",x.__params__=["cond","e1","e2"],x),EWhile:(x=function(b,e){return{_hx_index:10,cond:b,e,__enum__:"loreline.lorscript.ExprDef",toString:F}},x._hx_name="EWhile",x.__params__=["cond","e"],x),EFor:(x=function(b,e,t){return{_hx_index:11,v:b,it:e,e:t,__enum__:"loreline.lorscript.ExprDef",toString:F}},x._hx_name="EFor",x.__params__=["v","it","e"],x),EBreak:{_hx_name:"EBreak",_hx_index:12,__enum__:"loreline.lorscript.ExprDef",toString:F},EContinue:{_hx_name:"EContinue",_hx_index:13,__enum__:"loreline.lorscript.ExprDef",toString:F},EFunction:(x=function(b,e,t,l){return{_hx_index:14,args:b,e,name:t,ret:l,__enum__:"loreline.lorscript.ExprDef",toString:F}},x._hx_name="EFunction",x.__params__=["args","e","name","ret"],x),EReturn:(x=function(b){return{_hx_index:15,e:b,__enum__:"loreline.lorscript.ExprDef",toString:F}},x._hx_name="EReturn",x.__params__=["e"],x),EArray:(x=function(b,e){return{_hx_index:16,e:b,index:e,__enum__:"loreline.lorscript.ExprDef",toString:F}},x._hx_name="EArray",x.__params__=["e","index"],x),EArrayDecl:(x=function(b){return{_hx_index:17,e:b,__enum__:"loreline.lorscript.ExprDef",toString:F}},x._hx_name="EArrayDecl",x.__params__=["e"],x),ENew:(x=function(b,e){return{_hx_index:18,cl:b,params:e,__enum__:"loreline.lorscript.ExprDef",toString:F}},x._hx_name="ENew",x.__params__=["cl","params"],x),EThrow:(x=function(b){return{_hx_index:19,e:b,__enum__:"loreline.lorscript.ExprDef",toString:F}},x._hx_name="EThrow",x.__params__=["e"],x),ETry:(x=function(b,e,t,l){return{_hx_index:20,e:b,v:e,t,ecatch:l,__enum__:"loreline.lorscript.ExprDef",toString:F}},x._hx_name="ETry",x.__params__=["e","v","t","ecatch"],x),EObject:(x=function(b){return{_hx_index:21,fl:b,__enum__:"loreline.lorscript.ExprDef",toString:F}},x._hx_name="EObject",x.__params__=["fl"],x),ETernary:(x=function(b,e,t){return{_hx_index:22,cond:b,e1:e,e2:t,__enum__:"loreline.lorscript.ExprDef",toString:F}},x._hx_name="ETernary",x.__params__=["cond","e1","e2"],x),ESwitch:(x=function(b,e,t){return{_hx_index:23,e:b,cases:e,defaultExpr:t,__enum__:"loreline.lorscript.ExprDef",toString:F}},x._hx_name="ESwitch",x.__params__=["e","cases","defaultExpr"],x),EDoWhile:(x=function(b,e){return{_hx_index:24,cond:b,e,__enum__:"loreline.lorscript.ExprDef",toString:F}},x._hx_name="EDoWhile",x.__params__=["cond","e"],x),EMeta:(x=function(b,e,t){return{_hx_index:25,name:b,args:e,e:t,__enum__:"loreline.lorscript.ExprDef",toString:F}},x._hx_name="EMeta",x.__params__=["name","args","e"],x),ECheckType:(x=function(b,e){return{_hx_index:26,e:b,t:e,__enum__:"loreline.lorscript.ExprDef",toString:F}},x._hx_name="ECheckType",x.__params__=["e","t"],x)};K.__constructs__=[K.EConst,K.EIdent,K.EVar,K.EParent,K.EBlock,K.EField,K.EBinop,K.EUnop,K.ECall,K.EIf,K.EWhile,K.EFor,K.EBreak,K.EContinue,K.EFunction,K.EReturn,K.EArray,K.EArrayDecl,K.ENew,K.EThrow,K.ETry,K.EObject,K.ETernary,K.ESwitch,K.EDoWhile,K.EMeta,K.ECheckType];var sl=Ye["loreline.lorscript.CType"]={__ename__:"loreline.lorscript.CType",__constructs__:null,CTPath:(x=function(b,e){return{_hx_index:0,path:b,params:e,__enum__:"loreline.lorscript.CType",toString:F}},x._hx_name="CTPath",x.__params__=["path","params"],x),CTFun:(x=function(b,e){return{_hx_index:1,args:b,ret:e,__enum__:"loreline.lorscript.CType",toString:F}},x._hx_name="CTFun",x.__params__=["args","ret"],x),CTAnon:(x=function(b){return{_hx_index:2,fields:b,__enum__:"loreline.lorscript.CType",toString:F}},x._hx_name="CTAnon",x.__params__=["fields"],x),CTParent:(x=function(b){return{_hx_index:3,t:b,__enum__:"loreline.lorscript.CType",toString:F}},x._hx_name="CTParent",x.__params__=["t"],x),CTOpt:(x=function(b){return{_hx_index:4,t:b,__enum__:"loreline.lorscript.CType",toString:F}},x._hx_name="CTOpt",x.__params__=["t"],x),CTNamed:(x=function(b,e){return{_hx_index:5,n:b,t:e,__enum__:"loreline.lorscript.CType",toString:F}},x._hx_name="CTNamed",x.__params__=["n","t"],x)};sl.__constructs__=[sl.CTPath,sl.CTFun,sl.CTAnon,sl.CTParent,sl.CTOpt,sl.CTNamed];class Se{constructor(e,t,l,i,n){this.e=e,this.pmin=t,this.pmax=l,this.origin=i,this.line=n}toString(){return ki.errorToString(this)}}Q["loreline.lorscript.Error"]=Se,Se.__name__="loreline.lorscript.Error",Object.assign(Se.prototype,{__class__:Se});var Te=Ye["loreline.lorscript.ErrorDef"]={__ename__:"loreline.lorscript.ErrorDef",__constructs__:null,EInvalidChar:(x=function(b){return{_hx_index:0,c:b,__enum__:"loreline.lorscript.ErrorDef",toString:F}},x._hx_name="EInvalidChar",x.__params__=["c"],x),EUnexpected:(x=function(b){return{_hx_index:1,s:b,__enum__:"loreline.lorscript.ErrorDef",toString:F}},x._hx_name="EUnexpected",x.__params__=["s"],x),EUnterminatedString:{_hx_name:"EUnterminatedString",_hx_index:2,__enum__:"loreline.lorscript.ErrorDef",toString:F},EUnterminatedComment:{_hx_name:"EUnterminatedComment",_hx_index:3,__enum__:"loreline.lorscript.ErrorDef",toString:F},EInvalidPreprocessor:(x=function(b){return{_hx_index:4,msg:b,__enum__:"loreline.lorscript.ErrorDef",toString:F}},x._hx_name="EInvalidPreprocessor",x.__params__=["msg"],x),EUnknownVariable:(x=function(b){return{_hx_index:5,v:b,__enum__:"loreline.lorscript.ErrorDef",toString:F}},x._hx_name="EUnknownVariable",x.__params__=["v"],x),EInvalidIterator:(x=function(b){return{_hx_index:6,v:b,__enum__:"loreline.lorscript.ErrorDef",toString:F}},x._hx_name="EInvalidIterator",x.__params__=["v"],x),EInvalidOp:(x=function(b){return{_hx_index:7,op:b,__enum__:"loreline.lorscript.ErrorDef",toString:F}},x._hx_name="EInvalidOp",x.__params__=["op"],x),EInvalidAccess:(x=function(b){return{_hx_index:8,f:b,__enum__:"loreline.lorscript.ErrorDef",toString:F}},x._hx_name="EInvalidAccess",x.__params__=["f"],x),ECustom:(x=function(b){return{_hx_index:9,msg:b,__enum__:"loreline.lorscript.ErrorDef",toString:F}},x._hx_name="ECustom",x.__params__=["msg"],x)};Te.__constructs__=[Te.EInvalidChar,Te.EUnexpected,Te.EUnterminatedString,Te.EUnterminatedComment,Te.EInvalidPreprocessor,Te.EUnknownVariable,Te.EInvalidIterator,Te.EInvalidOp,Te.EInvalidAccess,Te.ECustom];var ni=Ye["loreline.lorscript.ModuleDecl"]={__ename__:"loreline.lorscript.ModuleDecl",__constructs__:null,DPackage:(x=function(b){return{_hx_index:0,path:b,__enum__:"loreline.lorscript.ModuleDecl",toString:F}},x._hx_name="DPackage",x.__params__=["path"],x),DImport:(x=function(b,e){return{_hx_index:1,path:b,everything:e,__enum__:"loreline.lorscript.ModuleDecl",toString:F}},x._hx_name="DImport",x.__params__=["path","everything"],x),DClass:(x=function(b){return{_hx_index:2,c:b,__enum__:"loreline.lorscript.ModuleDecl",toString:F}},x._hx_name="DClass",x.__params__=["c"],x),DTypedef:(x=function(b){return{_hx_index:3,c:b,__enum__:"loreline.lorscript.ModuleDecl",toString:F}},x._hx_name="DTypedef",x.__params__=["c"],x)};ni.__constructs__=[ni.DPackage,ni.DImport,ni.DClass,ni.DTypedef];var Al=Ye["loreline.lorscript.FieldAccess"]={__ename__:"loreline.lorscript.FieldAccess",__constructs__:null,APublic:{_hx_name:"APublic",_hx_index:0,__enum__:"loreline.lorscript.FieldAccess",toString:F},APrivate:{_hx_name:"APrivate",_hx_index:1,__enum__:"loreline.lorscript.FieldAccess",toString:F},AInline:{_hx_name:"AInline",_hx_index:2,__enum__:"loreline.lorscript.FieldAccess",toString:F},AOverride:{_hx_name:"AOverride",_hx_index:3,__enum__:"loreline.lorscript.FieldAccess",toString:F},AStatic:{_hx_name:"AStatic",_hx_index:4,__enum__:"loreline.lorscript.FieldAccess",toString:F},AMacro:{_hx_name:"AMacro",_hx_index:5,__enum__:"loreline.lorscript.FieldAccess",toString:F}};Al.__constructs__=[Al.APublic,Al.APrivate,Al.AInline,Al.AOverride,Al.AStatic,Al.AMacro];var ln=Ye["loreline.lorscript.FieldKind"]={__ename__:"loreline.lorscript.FieldKind",__constructs__:null,KFunction:(x=function(b){return{_hx_index:0,f:b,__enum__:"loreline.lorscript.FieldKind",toString:F}},x._hx_name="KFunction",x.__params__=["f"],x),KVar:(x=function(b){return{_hx_index:1,v:b,__enum__:"loreline.lorscript.FieldKind",toString:F}},x._hx_name="KVar",x.__params__=["v"],x)};ln.__constructs__=[ln.KFunction,ln.KVar];var Rl=Ye["loreline.lorscript._Interp.Stop"]={__ename__:"loreline.lorscript._Interp.Stop",__constructs__:null,SBreak:{_hx_name:"SBreak",_hx_index:0,__enum__:"loreline.lorscript._Interp.Stop",toString:F},SContinue:{_hx_name:"SContinue",_hx_index:1,__enum__:"loreline.lorscript._Interp.Stop",toString:F},SReturn:{_hx_name:"SReturn",_hx_index:2,__enum__:"loreline.lorscript._Interp.Stop",toString:F}};Rl.__constructs__=[Rl.SBreak,Rl.SContinue,Rl.SReturn];class nn{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,l=qe.makeVarArgs(function(i){let n=e.posInfos(),s=i.shift();i.length>0&&(n.customParams=i),Ri.trace(Y.string(s),n)});t.h.trace=l}posInfos(){return this.curExpr!=null?{fileName:this.curExpr.origin,lineNumber:this.curExpr.line}:{fileName:"lorscript",lineNumber:0}}initOps(){let e=this;this.binops=new Ee,this.binops.h["+"]=function(t,l){return e.expr(t)+e.expr(l)},this.binops.h["-"]=function(t,l){return e.expr(t)-e.expr(l)},this.binops.h["*"]=function(t,l){return e.expr(t)*e.expr(l)},this.binops.h["/"]=function(t,l){return e.expr(t)/e.expr(l)},this.binops.h["%"]=function(t,l){return e.expr(t)%e.expr(l)},this.binops.h["&"]=function(t,l){return e.expr(t)&e.expr(l)},this.binops.h["|"]=function(t,l){return e.expr(t)|e.expr(l)},this.binops.h["^"]=function(t,l){return e.expr(t)^e.expr(l)},this.binops.h["<<"]=function(t,l){return e.expr(t)<<e.expr(l)},this.binops.h[">>"]=function(t,l){return e.expr(t)>>e.expr(l)},this.binops.h[">>>"]=function(t,l){return e.expr(t)>>>e.expr(l)},this.binops.h["=="]=function(t,l){return e.expr(t)==e.expr(l)},this.binops.h["!="]=function(t,l){return e.expr(t)!=e.expr(l)},this.binops.h[">="]=function(t,l){let i=e.expr(t),n=e.expr(l);return i>=n},this.binops.h["<="]=function(t,l){let i=e.expr(t),n=e.expr(l);return i<=n},this.binops.h[">"]=function(t,l){let i=e.expr(t),n=e.expr(l);return i>n},this.binops.h["<"]=function(t,l){let i=e.expr(t),n=e.expr(l);return i<n},this.binops.h["||"]=function(t,l){return e.expr(t)!=!0?e.expr(l)==!0:!0},this.binops.h["&&"]=function(t,l){return e.expr(t)==!0?e.expr(l)==!0:!1},this.binops.h["="]=be(this,this.assign),this.binops.h["..."]=function(t,l){return new bi(e.expr(t),e.expr(l))},this.binops.h.is=function(t,l){return te.__instanceof(e.expr(t),e.expr(l))},this.assignOp("+=",function(t,l){return t+l}),this.assignOp("-=",function(t,l){return t-l}),this.assignOp("*=",function(t,l){return t*l}),this.assignOp("/=",function(t,l){return t/l}),this.assignOp("%=",function(t,l){return t%l}),this.assignOp("&=",function(t,l){return t&l}),this.assignOp("|=",function(t,l){return t|l}),this.assignOp("^=",function(t,l){return t^l}),this.assignOp("<<=",function(t,l){return t<<l}),this.assignOp(">>=",function(t,l){return t>>l}),this.assignOp(">>>=",function(t,l){return t>>>l})}setVar(e,t){if(!Object.prototype.hasOwnProperty.call(this.variables.h,e))oe.setField(this.interpreter,this.interpreter.topLevelState.fields,e,t);else throw C.thrown("Invalid assign");return t}assign(e,t){let l=this.expr(t),i=e.e;switch(i._hx_index){case 1:let n=i.v,s=this.locals.h[n];s==null?this.setVar(n,l):s.r=l;break;case 5:let r=i.e,a=i.f;l=this.set(this.expr(r),a,l);break;case 16:let h=i.e,o=i.index,u=this.expr(h),p=this.expr(o);he.isArray(u)?he.arraySet(u,p,l):oe.isFields(u)?oe.setField(this.interpreter,u,p,l):te.__implements(u,Et)?te.__cast(u,Et).set(p,l):u[p]=l;break;default:let _=new Se(Te.EInvalidOp("="),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw C.thrown(_)}return l}assignOp(e,t){let l=this;this.binops.h[e]=function(i,n){return l.evalAssignOp(e,t,i,n)}}evalAssignOp(e,t,l,i){let n,s=l.e;switch(s._hx_index){case 1:let r=s.v,a=this.locals.h[r];n=t(this.expr(l),this.expr(i)),a==null?this.setVar(r,n):a.r=n;break;case 5:let h=s.e,o=s.f,u=this.expr(h);n=t(this.get(u,o),this.expr(i)),n=this.set(u,o,n);break;case 16:let p=s.e,_=s.index,m=this.expr(p),f=this.expr(_);he.isArray(m)?(n=t(he.arrayGet(m,f),this.expr(i)),he.arraySet(m,f,n)):oe.isFields(m)?(n=t(oe.getField(this.interpreter,m,f),this.expr(i)),oe.setField(this.interpreter,m,f,n)):te.__implements(m,Et)?(n=t(te.__cast(m,Et).get(f),this.expr(i)),te.__cast(m,Et).set(f,n)):(n=t(m[f],this.expr(i)),m[f]=n);break;default:let g=new Se(Te.EInvalidOp(e),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw C.thrown(g)}return n}increment(e,t,l){this.curExpr=e;let i=e.e;switch(i._hx_index){case 1:let n=i.v,s=this.locals.h[n],r=s==null?this.resolve(n):s.r;return t?(r+=l,s==null?this.setVar(n,r):s.r=r):s==null?this.setVar(n,r+l):s.r=r+l,r;case 5:let a=i.e,h=i.f,o=this.expr(a),u=this.get(o,h);return t?(u+=l,this.set(o,h,u)):this.set(o,h,u+l),u;case 16:let p=i.e,_=i.index,m=this.expr(p),f=this.expr(_);if(he.isArray(m)){let d=he.arrayGet(m,f);return t?(d+=l,he.arraySet(m,f,d)):he.arraySet(m,f,d+l),d}else if(oe.isFields(m)){let d=oe.getField(this.interpreter,m,f);return t?(d+=l,oe.setField(this.interpreter,m,f,d)):oe.setField(this.interpreter,m,f,d+l),d}else if(te.__implements(m,Et)){let d=te.__cast(m,Et).get(f);return t?(d+=l,te.__cast(m,Et).set(f,d)):te.__cast(m,Et).set(f,d+l),d}else{let d=m[f];return t?(d+=l,m[f]=d):m[f]=d+l,d}break;default:let g=new Se(Te.EInvalidOp(l>0?"++":"--"),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw C.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 l=C.caught(t).unwrap();if(te.__instanceof(l,Rl))switch(l._hx_index){case 0:throw C.thrown("Invalid break");case 1:throw C.thrown("Invalid continue");case 2:let n=this.returnValue;return this.returnValue=null,n}else throw t}}duplicate(e){let t=new Ee,l=e.h,i=l,n=Object.keys(l),s=n.length,r=0;for(;r<s;){let a=n[r++];t.h[a]=e.h[a]}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 l=new Se(e,this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw C.thrown(l)}rethrow(e){throw C.thrown(e)}resolve(e){let t=this.variables.h[e];if(t==null&&!Object.prototype.hasOwnProperty.call(this.variables.h,e)){if(oe.fieldExists(this.interpreter,this.interpreter.topLevelState.fields,e))return oe.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 l=this.interpreter.resolveBeatByName(e);if(l!=null)return l;let i=new Se(Te.EUnknownVariable(e),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw C.thrown(i)}return t}expr(e){this.curExpr=e;let t=e.e,l=this;switch(t._hx_index){case 0:let i=t.c;switch(i._hx_index){case 0:return i.v;case 1:return i.f;case 2:return i.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,a=t.n,h=t.e;this.declared.push({n:a,old:this.locals.h[a]});let o=this.locals,u=h==null?null:this.expr(h);return o.h[a]={r:u},null;case 3:let p=t.e;return this.expr(p);case 4:let _=t.e,m=this.declared.length,f=null,g=0;for(;g<_.length;){let Ce=_[g];++g,f=this.expr(Ce)}return this.restore(m),f;case 5:let d=t.e,w=t.f;return this.get(this.expr(d),w);case 6:let y=t.op,S=t.e1,T=t.e2,O=this.binops.h[y];if(O==null){let Ce=new Se(Te.EInvalidOp(y),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw C.thrown(Ce)}return O(S,T);case 7:let E=t.op,v=t.prefix,M=t.e;switch(E){case"!":return this.expr(M)!=!0;case"++":return this.increment(M,v,1);case"-":return-this.expr(M);case"--":return this.increment(M,v,-1);case"~":return~this.expr(M);default:let Ce=new Se(Te.EInvalidOp(E),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw C.thrown(Ce)}break;case 8:let A=t.e,L=t.params,I=[],q=0;for(;q<L.length;){let Ce=L[q];++q,I.push(this.expr(Ce))}let z=A.e;if(z._hx_index==5){let Ce=z.e,rt=z.f,_t=this.expr(Ce);if(_t==null){let ot=new Se(Te.EInvalidAccess(rt),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw C.thrown(ot)}return this.fcall(_t,rt,I)}else return this.call(null,this.expr(A),I);break;case 9:let P=t.cond,B=t.e1,N=t.e2;return this.expr(P)==!0?this.expr(B):N==null?null:this.expr(N);case 10:let D=t.cond,U=t.e;return this.whileLoop(D,U),null;case 11:let W=t.v,J=t.it,H=t.e;return this.forLoop(W,J,H),null;case 12:throw C.thrown(Rl.SBreak);case 13:throw C.thrown(Rl.SContinue);case 14:let X=t.ret,ae=t.args,ce=t.e,ne=t.name,re=this.duplicate(this.locals),xe=this,Pe=!1,Ue=0,Je=0;for(;Je<ae.length;){let Ce=ae[Je];++Je,Ce.opt||Ce.value!=null?Pe=!0:Ue+=1}let lt=function(Ce){if((Ce==null?0:Ce.length)!=ae.length){if(Ce.length<Ue){let si="Invalid number of parameters. Got "+Ce.length+", required "+Ue;ne!=null&&(si+=" for function '"+ne+"'");let mn=new Se(Te.ECustom(si),l.curExpr.pmin,l.curExpr.pmax,l.curExpr.origin,l.curExpr.line);throw C.thrown(mn)}let el=[],Tt=Ce.length-Ue,rn=0,yi=0;for(;yi<ae.length;){let si=ae[yi];++yi,si.opt||si.value!=null?Tt>0?(el.push(Ce[rn++]),--Tt):el.push(si.value!=null?xe.expr(si.value):null):el.push(Ce[rn++])}Ce=el}let rt=xe.locals,_t=xe.depth;xe.depth++,xe.locals=xe.duplicate(re);let ot=0,bt=ae.length;for(;ot<bt;){let el=ot++;xe.locals.h[ae[el].name]={r:Ce[el]}}let Ct=null,Ft=l.declared.length;if(l.inTry)try{Ct=xe.exprReturn(ce)}catch(el){let Tt=C.caught(el).unwrap();throw l.restore(Ft),xe.locals=rt,xe.depth=_t,C.thrown(Tt)}else Ct=xe.exprReturn(ce);return l.restore(Ft),xe.locals=rt,xe.depth=_t,Ct},Ve=qe.makeVarArgs(lt);if(ne!=null)if(this.depth==0)this.variables.h[ne]=Ve;else{this.declared.push({n:ne,old:this.locals.h[ne]});let Ce={r:Ve};this.locals.h[ne]=Ce,re.h[ne]=Ce}return Ve;case 15:let Qe=t.e;throw this.returnValue=Qe==null?null:this.expr(Qe),C.thrown(Rl.SReturn);case 16:let at=t.e,Re=t.index,$=this.expr(at),se=this.expr(Re);return he.isArray($)?he.arrayGet($,se):oe.isFields($)?oe.getField(this.interpreter,$,se):te.__implements($,Et)?te.__cast($,Et).get(se):$[se];case 17:let j=t.e,ie;if(j.length>0){let Ce=j[0].e;if(Ce._hx_index==6){let rt=Ce.e1,_t=Ce.e2;ie=Ce.op=="=>"}else ie=!1}else ie=!1;if(ie){let Ce=[],rt=[],_t=0;for(;_t<j.length;){let ot=j[_t];++_t;let bt=ot.e;if(bt._hx_index==6)if(bt.op=="=>"){let Ct=bt.e1,Ft=bt.e2;Ce.push(this.expr(Ct)),rt.push(this.expr(Ft))}else{this.curExpr=ot;let Ct=new Se(Te.ECustom("Invalid map key=>value expression"),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw C.thrown(Ct)}else{this.curExpr=ot;let Ct=new Se(Te.ECustom("Invalid map key=>value expression"),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw C.thrown(Ct)}}return this.makeMap(Ce,rt)}else{let Ce=[],rt=0;for(;rt<j.length;){let _t=j[rt];++rt,Ce.push(this.expr(_t))}return Ce}break;case 18:let le=t.cl,ee=t.params,pe=[],me=0;for(;me<ee.length;){let Ce=ee[me];++me,pe.push(this.expr(Ce))}return this.cnew(le,pe);case 19:let we=t.e;throw C.thrown(this.expr(we));case 20:let Ze=t.t,yt=t.e,Le=t.v,dt=t.ecatch,Oe=this.declared.length,Ie=this.inTry;try{this.inTry=!0;let Ce=this.expr(yt);return this.restore(Oe),this.inTry=Ie,Ce}catch(Ce){let rt=C.caught(Ce).unwrap();if(te.__instanceof(rt,Rl)){let _t=rt;throw this.inTry=Ie,C.thrown(_t)}else{let _t=rt;this.restore(Oe),this.inTry=Ie,this.declared.push({n:Le,old:this.locals.h[Le]}),this.locals.h[Le]={r:_t};let ot=this.expr(dt);return this.restore(Oe),ot}}break;case 21:let pt=t.fl,it=oe.createFields(this.interpreter),Ot=0;for(;Ot<pt.length;){let Ce=pt[Ot];++Ot,oe.setField(this.interpreter,it,Ce.name,this.expr(Ce.e))}return it;case 22:let Yt=t.cond,xt=t.e1,ol=t.e2;return this.expr(Yt)==!0?this.expr(xt):this.expr(ol);case 23:let $e=t.e,Vt=t.cases,Bt=t.defaultExpr,qt=this.expr($e),wt=!1,Ht=0;for(;Ht<Vt.length;){let Ce=Vt[Ht];++Ht;let rt=0,_t=Ce.values;for(;rt<_t.length;){let ot=_t[rt];if(++rt,this.expr(ot)==qt){wt=!0;break}}if(wt){qt=this.expr(Ce.expr);break}}return wt||(qt=Bt==null?null:this.expr(Bt)),qt;case 24:let Zt=t.cond,Gt=t.e;return this.doWhileLoop(Zt,Gt),null;case 25:let ul=t.name,cl=t.args,Xt=t.e;return this.expr(Xt);case 26:let nt=t.t,Sl=t.e;return this.expr(Sl)}}doWhileLoop(e,t){let l=this.declared.length,i=this;do{let n=!0;try{i.expr(t)}catch(s){let r=C.caught(s).unwrap();if(te.__instanceof(r,Rl)){let a=r;switch(a._hx_index){case 0:n=!1;break;case 1:break;case 2:throw C.thrown(a)}}else throw s}if(!n)break}while(this.expr(e)==!0);this.restore(l)}whileLoop(e,t){let l=this.declared.length,i=this;for(;this.expr(e)==!0;){let n=!0;try{i.expr(t)}catch(s){let r=C.caught(s).unwrap();if(te.__instanceof(r,Rl)){let a=r;switch(a._hx_index){case 0:n=!1;break;case 1:break;case 2:throw C.thrown(a)}}else throw s}if(!n)break}this.restore(l)}makeIterator(e){if(e instanceof Array)return new Il(e);if(he.isArray(e))return he.getIterator(e);if(e.iterator!=null&&(e=bn(e)),e.hasNext==null||e.next==null){let t=new Se(Te.EInvalidIterator(e),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw C.thrown(t)}return e}forLoop(e,t,l){let i=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,a={r:n.next()};r.h[e]=a;let h=!0;try{s.expr(l)}catch(o){let u=C.caught(o).unwrap();if(te.__instanceof(u,Rl)){let p=u;switch(p._hx_index){case 0:h=!1;break;case 1:break;case 2:throw C.thrown(p)}}else throw o}if(!h)break}this.restore(i)}loopRun(e){let t=!0;try{e()}catch(l){let i=C.caught(l).unwrap();if(te.__instanceof(i,Rl)){let n=i;switch(n._hx_index){case 0:t=!1;break;case 1:break;case 2:throw C.thrown(n)}}else throw l}return t}isMap(e){return te.__implements(e,Et)}getMapValue(e,t){return te.__cast(e,Et).get(t)}setMapValue(e,t,l){te.__cast(e,Et).set(t,l)}makeMap(e,t){let l=!0,i=!0,n=!0,s=!0,r=0;for(;r<e.length;){let h=e[r];++r,l=l&&typeof h=="string",i=i&&typeof h=="number"&&(h|0)===h,n=n&&qe.isObject(h),s=s&&qe.isEnumValue(h)}if(i){let h=new Kl,o=0,u=e;for(;o<u.length;){let p=u[o],m=o++,f=p;h.h[f]=t[m]}return h}if(l){let h=new Ee,o=0,u=e;for(;o<u.length;){let p=u[o],m=o++,f=p;h.h[f]=t[m]}return h}if(s){let h=new ri,o=0,u=e;for(;o<u.length;){let p=u[o],m=o++,f=p;h.set(f,t[m])}return h}if(n){let h=new Ti,o=0,u=e;for(;o<u.length;){let p=u[o],m=o++,f=p;h.set(f,t[m])}return h}let a=new Se(Te.ECustom("Invalid map keys "+Y.string(e)),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw C.thrown(a)}get(e,t){if(e==null){let l=new Se(Te.EInvalidAccess(t),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw C.thrown(l)}return oe.isFields(e)?oe.getField(this.interpreter,e,t):qe.getProperty(e,t)}set(e,t,l){if(e==null){let i=new Se(Te.EInvalidAccess(t),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw C.thrown(i)}return oe.isFields(e)?(oe.setField(this.interpreter,e,t,l),l):(qe.setProperty(e,t,l),l)}fcall(e,t,l){let i=null;return typeof e=="string"?i=oe.getStringHelper(this.interpreter,t):he.isArray(e)?i=oe.getArrayHelper(this.interpreter,t):e instanceof Me?i=oe.getBeatHelper(this.interpreter,t):oe.isFields(e)&&(i=oe.getMapHelper(this.interpreter,t)),i!=null&&qe.isFunction(i)?(l.splice(0,0,e),this.call(null,i,l)):this.call(e,this.get(e,t),l)}call(e,t,l){return t.apply(e,l)}cnew(e,t){let l=Q[e];return l==null&&(l=this.resolve(e)),_e.createInstance(l,t)}static __keepIntIterator(){let e=new bi(0,0);return[be(e,e.hasNext),be(e,e.next)]}}Q["loreline.lorscript.Interp"]=nn,nn.__name__="loreline.lorscript.Interp",Object.assign(nn.prototype,{__class__:nn});var Z=Ye["loreline.lorscript.Token"]={__ename__:"loreline.lorscript.Token",__constructs__:null,TEof:{_hx_name:"TEof",_hx_index:0,__enum__:"loreline.lorscript.Token",toString:F},TConst:(x=function(b){return{_hx_index:1,c:b,__enum__:"loreline.lorscript.Token",toString:F}},x._hx_name="TConst",x.__params__=["c"],x),TId:(x=function(b){return{_hx_index:2,s:b,__enum__:"loreline.lorscript.Token",toString:F}},x._hx_name="TId",x.__params__=["s"],x),TOp:(x=function(b){return{_hx_index:3,s:b,__enum__:"loreline.lorscript.Token",toString:F}},x._hx_name="TOp",x.__params__=["s"],x),TPOpen:{_hx_name:"TPOpen",_hx_index:4,__enum__:"loreline.lorscript.Token",toString:F},TPClose:{_hx_name:"TPClose",_hx_index:5,__enum__:"loreline.lorscript.Token",toString:F},TBrOpen:{_hx_name:"TBrOpen",_hx_index:6,__enum__:"loreline.lorscript.Token",toString:F},TBrClose:{_hx_name:"TBrClose",_hx_index:7,__enum__:"loreline.lorscript.Token",toString:F},TDot:{_hx_name:"TDot",_hx_index:8,__enum__:"loreline.lorscript.Token",toString:F},TQuestionDot:{_hx_name:"TQuestionDot",_hx_index:9,__enum__:"loreline.lorscript.Token",toString:F},TComma:{_hx_name:"TComma",_hx_index:10,__enum__:"loreline.lorscript.Token",toString:F},TSemicolon:{_hx_name:"TSemicolon",_hx_index:11,__enum__:"loreline.lorscript.Token",toString:F},TBkOpen:{_hx_name:"TBkOpen",_hx_index:12,__enum__:"loreline.lorscript.Token",toString:F},TBkClose:{_hx_name:"TBkClose",_hx_index:13,__enum__:"loreline.lorscript.Token",toString:F},TQuestion:{_hx_name:"TQuestion",_hx_index:14,__enum__:"loreline.lorscript.Token",toString:F},TDoubleDot:{_hx_name:"TDoubleDot",_hx_index:15,__enum__:"loreline.lorscript.Token",toString:F},TMeta:(x=function(b){return{_hx_index:16,s:b,__enum__:"loreline.lorscript.Token",toString:F}},x._hx_name="TMeta",x.__params__=["s"],x),TPrepro:(x=function(b){return{_hx_index:17,s:b,__enum__:"loreline.lorscript.Token",toString:F}},x._hx_name="TPrepro",x.__params__=["s"],x)};Z.__constructs__=[Z.TEof,Z.TConst,Z.TId,Z.TOp,Z.TPOpen,Z.TPClose,Z.TBrOpen,Z.TBrClose,Z.TDot,Z.TQuestionDot,Z.TComma,Z.TSemicolon,Z.TBkOpen,Z.TBkClose,Z.TQuestion,Z.TDoubleDot,Z.TMeta,Z.TPrepro];class ci{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,l=e.length;for(;t<l;){let a=t++,h=0,o=e[a];for(;h<o.length;){let u=o[h];++h,this.opPriority.h[u]=a,a==9&&(this.opRightAssoc.h[u]=!0)}}let i="!";this.opPriority.h[i]=i=="++"||i=="--"?-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,l){if(!this.resumeErrors)throw C.thrown(new Se(e,t,l,this.origin,this.line))}invalidChar(e){if(!this.resumeErrors)throw C.thrown(new Se(Te.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 Ui,this.offset=t,this.char=-1,this.ops=[],this.idents=[],this.uid=0;let l=0,i=this.opChars.length;for(;l<i;){let r=l++;this.ops[c.cca(this.opChars,r)]=!0}let n=0,s=this.identChars.length;for(;n<s;){let r=n++;this.idents[c.cca(this.identChars,r)]=!0}}parseString(e,t,l){l==null&&(l=0),t==null&&(t="loreline.lorscript"),this.initParser(t,l),this.input=e,this.readPos=0;let i=[];for(;;){let n=this.token();if(n==Z.TEof)break;this.tokens.push({t:n,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,this.parseFullExpr(i)}if(i.length==1)return i[0];{let n=K.EBlock(i),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=Te.EUnexpected(this.tokenString(e));if(!this.resumeErrors)throw C.thrown(new Se(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();_e.enumEq(t,e)||this.unexpected(t)}maybe(e){let t=this.token();return _e.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,l){return e==null?null:(t==null&&(t=this.tokenMin),l==null&&(l=this.tokenMax),{e,pmin:t,pmax:l,origin:this.origin,line:this.line})}isBlock(e){if(e==null)return!1;let t=e.e;switch(t._hx_index){case 2:let l=t.n,i=t.t,n=t.e;if(n!=null)return this.isBlock(n);if(i!=null){if(i==null)return!1;if(i._hx_index==2){let X=i.fields;return!0}else return!1}else return!1;break;case 4:let s=t.e;return!0;case 6:let r=t.op,a=t.e1,h=t.e2;return this.isBlock(h);case 7:let o=t.op,u=t.prefix,p=t.e;return u?!1:this.isBlock(p);case 9:let _=t.cond,m=t.e1,f=t.e2;return f!=null?this.isBlock(f):this.isBlock(m);case 10:let g=t.cond,d=t.e;return this.isBlock(d);case 11:let w=t.v,y=t.it,S=t.e;return this.isBlock(S);case 14:let T=t.args,O=t.name,E=t.ret,v=t.e;return this.isBlock(v);case 15:let M=t.e;return M!=null?this.isBlock(M):!1;case 20:let A=t.e,L=t.v,I=t.t,q=t.ecatch;return this.isBlock(q);case 21:let z=t.fl;return!0;case 23:let P=t.e,B=t.cases,N=t.defaultExpr;return!0;case 24:let D=t.cond,U=t.e;return this.isBlock(U);case 25:let W=t.name,J=t.args,H=t.e;return this.isBlock(H);default:return!1}}parseFullExpr(e){let t=this.parseExpr();e.push(t);let l=this.token();for(;;){let i;if(l==Z.TComma&&t!=null){let n=t.e;if(n._hx_index==2){let s=n.n,r=n.t,a=n.e;i=!0}else i=!1}else i=!1;if(!i)break;t=this.parseStructure("var"),e.push(t),l=this.token()}l!=Z.TSemicolon&&l!=Z.TEof&&(this.isBlock(t)?(this.tokens.push({t:l,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax):this.unexpected(l))}parseObject(e){let t=[];e:for(;;){let r=this.token(),a=null;switch(r._hx_index){case 1:let o=r.c;this.allowJSON||this.unexpected(r),o._hx_index==2?a=o.s:this.unexpected(r);break;case 2:a=r.s;break;case 7:break e;default:this.unexpected(r);break e}let h=this.token();switch(h!=Z.TDoubleDot&&this.unexpected(h),t.push({name:a,e:this.parseExpr()}),r=this.token(),r._hx_index){case 7:break e;case 10:break;default:this.unexpected(r)}}let l=K.EObject(t),i=e,n=null,s;return l==null?s=null:(i==null&&(i=this.tokenMin),n==null&&(n=this.tokenMax),s={e:l,pmin:i,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 l=e.c,i=K.EConst(l),n=null,s=null,r;return i==null?r=null:(n==null&&(n=this.tokenMin),s==null&&(s=this.tokenMax),r={e:i,pmin:n,pmax:s,origin:this.origin,line:this.line}),this.parseExprNext(r);case 2:let a=e.s,h=this.parseStructure(a);if(h==null){let E=K.EIdent(a),v=null,M=null;E==null?h=null:(v==null&&(v=this.tokenMin),M==null&&(M=this.tokenMax),h={e:E,pmin:v,pmax:M,origin:this.origin,line:this.line})}return this.parseExprNext(h);case 3:let o=e.s;if(o=="-"){let E=this.tokenMin,v=this.parseExpr();if(v==null)return this.makeUnop(o,v);let M=v.e;if(M._hx_index==0){let A=M.c;switch(A._hx_index){case 0:let L=A.v,I=K.EConst(yl.CInt(-L)),q=E,z=v==null?0:v.pmax;return I==null?null:(q==null&&(q=this.tokenMin),z==null&&(z=this.tokenMax),{e:I,pmin:q,pmax:z,origin:this.origin,line:this.line});case 1:let P=A.f,B=K.EConst(yl.CFloat(-P)),N=E,D=v==null?0:v.pmax;return B==null?null:(N==null&&(N=this.tokenMin),D==null&&(D=this.tokenMax),{e:B,pmin:N,pmax:D,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==Z.TPClose){let E=this.token();_e.enumEq(E,Z.TOp("->"))||this.unexpected(E);let v=this.parseExpr(),M=K.EReturn(v),A=t,L=null,I;M==null?I=null:(A==null&&(A=this.tokenMin),L==null&&(L=this.tokenMax),I={e:M,pmin:A,pmax:L,origin:this.origin,line:this.line});let q=K.EFunction([],I),z=t,P=null;return q==null?null:(z==null&&(z=this.tokenMin),P==null&&(P=this.tokenMax),{e:q,pmin:z,pmax:P,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 E=K.EParent(u),v=t,M=this.tokenMax,A;return E==null?A=null:(v==null&&(v=this.tokenMin),M==null&&(M=this.tokenMax),A={e:E,pmin:v,pmax:M,origin:this.origin,line:this.line}),this.parseExprNext(A);case 10:let L=u.e;if(L._hx_index==1){let q=L.v;return this.parseLambda([{name:q}],u==null?0:u.pmin)}break;case 15:let I=this.parseType();switch(e=this.token(),e._hx_index){case 5:let q=K.ECheckType(u,I),z=t,P=this.tokenMax,B;return q==null?B=null:(z==null&&(z=this.tokenMin),P==null&&(P=this.tokenMax),B={e:q,pmin:z,pmax:P,origin:this.origin,line:this.line}),this.parseExprNext(B);case 10:let N=u.e;if(N._hx_index==1){let D=N.v;return this.parseLambda([{name:D,t:I}],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 E=e.c;if(this.allowJSON)if(E._hx_index==2){let z=E.s,P=this.token();if(this.tokens.push({t:P,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,P._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,M=this.token();if(this.tokens.push({t:M,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,M._hx_index==15)return this.parseExprNext(this.parseObject(t));break;case 7:let A=K.EObject([]),L=t,I=null,q;return A==null?q=null:(L==null&&(L=this.tokenMin),I==null&&(I=this.tokenMax),q={e:A,pmin:L,pmax:I,origin:this.origin,line:this.line}),this.parseExprNext(q);default:this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax}let p=[];for(;this.parseFullExpr(p),e=this.token(),!(e==Z.TBrClose||this.resumeErrors&&e==Z.TEof);)this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;let _=K.EBlock(p),m=t,f=null;return _==null?null:(m==null&&(m=this.tokenMin),f==null&&(f=this.tokenMax),{e:_,pmin:m,pmax:f,origin:this.origin,line:this.line});case 12:let g=[];e=this.token();let d=!0;for(;e!=Z.TBkClose&&(!this.resumeErrors||e!=Z.TEof);)d||(e!=Z.TComma?this.unexpected(e):e=this.token()),d=!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 E=g[0].e;switch(E._hx_index){case 10:let v=E.cond,M=E.e,A="__a_"+this.uid++,L=K.EArrayDecl([]),I=t,q=null,z;L==null?z=null:(I==null&&(I=this.tokenMin),q==null&&(q=this.tokenMax),z={e:L,pmin:I,pmax:q,origin:this.origin,line:this.line});let P=K.EVar(A,null,z),B=t,N=null,D;P==null?D=null:(B==null&&(B=this.tokenMin),N==null&&(N=this.tokenMax),D={e:P,pmin:B,pmax:N,origin:this.origin,line:this.line});let U=this.mapCompr(A,g[0]),W=K.EIdent(A),J=t,H=null,X;W==null?X=null:(J==null&&(J=this.tokenMin),H==null&&(H=this.tokenMax),X={e:W,pmin:J,pmax:H,origin:this.origin,line:this.line});let ae=K.EBlock([D,U,X]),ce=t,ne=null,re;return ae==null?re=null:(ce==null&&(ce=this.tokenMin),ne==null&&(ne=this.tokenMax),re={e:ae,pmin:ce,pmax:ne,origin:this.origin,line:this.line}),this.parseExprNext(re);case 11:let xe=E.v,Pe=E.it,Ue=E.e,Je="__a_"+this.uid++,lt=K.EArrayDecl([]),Ve=t,Qe=null,at;lt==null?at=null:(Ve==null&&(Ve=this.tokenMin),Qe==null&&(Qe=this.tokenMax),at={e:lt,pmin:Ve,pmax:Qe,origin:this.origin,line:this.line});let Re=K.EVar(Je,null,at),$=t,se=null,j;Re==null?j=null:($==null&&($=this.tokenMin),se==null&&(se=this.tokenMax),j={e:Re,pmin:$,pmax:se,origin:this.origin,line:this.line});let ie=this.mapCompr(Je,g[0]),le=K.EIdent(Je),ee=t,pe=null,me;le==null?me=null:(ee==null&&(ee=this.tokenMin),pe==null&&(pe=this.tokenMax),me={e:le,pmin:ee,pmax:pe,origin:this.origin,line:this.line});let we=K.EBlock([j,ie,me]),Ze=t,yt=null,Le;return we==null?Le=null:(Ze==null&&(Ze=this.tokenMin),yt==null&&(yt=this.tokenMax),Le={e:we,pmin:Ze,pmax:yt,origin:this.origin,line:this.line}),this.parseExprNext(Le);case 24:let dt=E.cond,Oe=E.e,Ie="__a_"+this.uid++,pt=K.EArrayDecl([]),it=t,Ot=null,Yt;pt==null?Yt=null:(it==null&&(it=this.tokenMin),Ot==null&&(Ot=this.tokenMax),Yt={e:pt,pmin:it,pmax:Ot,origin:this.origin,line:this.line});let xt=K.EVar(Ie,null,Yt),ol=t,$e=null,Vt;xt==null?Vt=null:(ol==null&&(ol=this.tokenMin),$e==null&&($e=this.tokenMax),Vt={e:xt,pmin:ol,pmax:$e,origin:this.origin,line:this.line});let Bt=this.mapCompr(Ie,g[0]),qt=K.EIdent(Ie),wt=t,Ht=null,Zt;qt==null?Zt=null:(wt==null&&(wt=this.tokenMin),Ht==null&&(Ht=this.tokenMax),Zt={e:qt,pmin:wt,pmax:Ht,origin:this.origin,line:this.line});let Gt=K.EBlock([Vt,Bt,Zt]),ul=t,cl=null,Xt;return Gt==null?Xt=null:(ul==null&&(ul=this.tokenMin),cl==null&&(cl=this.tokenMax),Xt={e:Gt,pmin:ul,pmax:cl,origin:this.origin,line:this.line}),this.parseExprNext(Xt);default:}}let w=K.EArrayDecl(g),y=t,S=null,T;return w==null?T=null:(y==null&&(y=this.tokenMin),S==null&&(S=this.tokenMax),T={e:w,pmin:y,pmax:S,origin:this.origin,line:this.line}),this.parseExprNext(T);case 16:let O=e.s;if(this.allowMetadata){let E=this.parseMetaArgs(),v=K.EMeta(O,E,this.parseExpr()),M=t,A=null;return v==null?null:(M==null&&(M=this.tokenMin),A==null&&(A=this.tokenMax),{e:v,pmin:M,pmax:A,origin:this.origin,line:this.line})}else return this.unexpected(e);break;default:return this.unexpected(e)}}parseLambda(e,t){e:for(;;){let p=this.getIdent(),_=this.maybe(Z.TDoubleDot)?this.parseType():null;e.push({name:p,t:_});let m=this.token();switch(m._hx_index){case 5:break e;case 10:break;default:this.unexpected(m);break e}}let l=this.token();_e.enumEq(l,Z.TOp("->"))||this.unexpected(l);let i=this.parseExpr(),n=K.EReturn(i),s=t,r=null,a;n==null?a=null:(s==null&&(s=this.tokenMin),r==null&&(r=this.tokenMax),a={e:n,pmin:s,pmax:r,origin:this.origin,line:this.line});let h=K.EFunction(e,a),o=t,u=null;return h==null?null:(o==null&&(o=this.tokenMin),u==null&&(u=this.tokenMax),{e:h,pmin:o,pmax:u,origin:this.origin,line:this.line})}parseMetaArgs(){let e=this.token();if(e!=Z.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!=Z.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 l=this.token();switch(l._hx_index){case 5:break e;case 10:break;default:let i=l;this.unexpected(i)}}}return t}mapCompr(e,t){if(t==null)return null;let l,i=t.e;switch(i._hx_index){case 3:let r=i.e;l=K.EParent(this.mapCompr(e,r));break;case 4:let a=i.e;if(a.length==1){let L=a[0];l=K.EBlock([this.mapCompr(e,L)])}else{let L=K.EIdent(e),I=t==null?0:t.pmin,q=t==null?0:t.pmax,z;L==null?z=null:(I==null&&(I=this.tokenMin),q==null&&(q=this.tokenMax),z={e:L,pmin:I,pmax:q,origin:this.origin,line:this.line});let P=K.EField(z,"push"),B=t==null?0:t.pmin,N=t==null?0:t.pmax,D;P==null?D=null:(B==null&&(B=this.tokenMin),N==null&&(N=this.tokenMax),D={e:P,pmin:B,pmax:N,origin:this.origin,line:this.line}),l=K.ECall(D,[t])}break;case 9:let h=i.cond,o=i.e1;if(i.e2==null)l=K.EIf(h,this.mapCompr(e,o),null);else{let L=K.EIdent(e),I=t==null?0:t.pmin,q=t==null?0:t.pmax,z;L==null?z=null:(I==null&&(I=this.tokenMin),q==null&&(q=this.tokenMax),z={e:L,pmin:I,pmax:q,origin:this.origin,line:this.line});let P=K.EField(z,"push"),B=t==null?0:t.pmin,N=t==null?0:t.pmax,D;P==null?D=null:(B==null&&(B=this.tokenMin),N==null&&(N=this.tokenMax),D={e:P,pmin:B,pmax:N,origin:this.origin,line:this.line}),l=K.ECall(D,[t])}break;case 10:let p=i.cond,_=i.e;l=K.EWhile(p,this.mapCompr(e,_));break;case 11:let m=i.v,f=i.it,g=i.e;l=K.EFor(m,f,this.mapCompr(e,g));break;case 24:let d=i.cond,w=i.e;l=K.EDoWhile(d,this.mapCompr(e,w));break;default:let y=K.EIdent(e),S=t==null?0:t.pmin,T=t==null?0:t.pmax,O;y==null?O=null:(S==null&&(S=this.tokenMin),T==null&&(T=this.tokenMax),O={e:y,pmin:S,pmax:T,origin:this.origin,line:this.line});let E=K.EField(O,"push"),v=t==null?0:t.pmin,M=t==null?0:t.pmax,A;E==null?A=null:(v==null&&(v=this.tokenMin),M==null&&(M=this.tokenMax),A={e:E,pmin:v,pmax:M,origin:this.origin,line:this.line}),l=K.ECall(A,[t])}let n=t==null?0:t.pmin,s=t==null?0:t.pmax;return l==null?null:(n==null&&(n=this.tokenMin),s==null&&(s=this.tokenMax),{e:l,pmin:n,pmax:s,origin:this.origin,line:this.line})}makeUnop(e,t){if(t==null&&this.resumeErrors)return null;let l=t.e;switch(l._hx_index){case 6:let i=l.op,n=l.e1,s=l.e2,r=K.EBinop(i,this.makeUnop(e,n),s),a=n==null?0:n.pmin,h=s==null?0:s.pmax;return r==null?null:(a==null&&(a=this.tokenMin),h==null&&(h=this.tokenMax),{e:r,pmin:a,pmax:h,origin:this.origin,line:this.line});case 22:let o=l.cond,u=l.e1,p=l.e2,_=K.ETernary(this.makeUnop(e,o),u,p),m=o==null?0:o.pmin,f=p==null?0:p.pmax;return _==null?null:(m==null&&(m=this.tokenMin),f==null&&(f=this.tokenMax),{e:_,pmin:m,pmax:f,origin:this.origin,line:this.line});default:let g=K.EUnop(e,!0,t),d=t==null?0:t.pmin,w=t==null?0:t.pmax;return g==null?null:(d==null&&(d=this.tokenMin),w==null&&(w=this.tokenMax),{e:g,pmin:d,pmax:w,origin:this.origin,line:this.line})}}makeBinop(e,t,l){if(l==null&&this.resumeErrors){let n=K.EBinop(e,t,l),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 i=l.e;switch(i._hx_index){case 6:let n=i.op,s=i.e1,r=i.e2;if(this.opPriority.h[e]<=this.opPriority.h[n]&&!Object.prototype.hasOwnProperty.call(this.opRightAssoc.h,e)){let m=K.EBinop(n,this.makeBinop(e,t,s),r),f=t==null?0:t.pmin,g=r==null?0:r.pmax;return m==null?null:(f==null&&(f=this.tokenMin),g==null&&(g=this.tokenMax),{e:m,pmin:f,pmax:g,origin:this.origin,line:this.line})}else{let m=K.EBinop(e,t,l),f=t==null?0:t.pmin,g=l==null?0:l.pmax;return m==null?null:(f==null&&(f=this.tokenMin),g==null&&(g=this.tokenMax),{e:m,pmin:f,pmax:g,origin:this.origin,line:this.line})}break;case 22:let a=i.cond,h=i.e1,o=i.e2;if(Object.prototype.hasOwnProperty.call(this.opRightAssoc.h,e)){let m=K.EBinop(e,t,l),f=t==null?0:t.pmin,g=l==null?0:l.pmax;return m==null?null:(f==null&&(f=this.tokenMin),g==null&&(g=this.tokenMax),{e:m,pmin:f,pmax:g,origin:this.origin,line:this.line})}else{let m=K.ETernary(this.makeBinop(e,t,a),h,o),f=t==null?0:t.pmin,g=l==null?0:l.pmax;return m==null?null:(f==null&&(f=this.tokenMin),g==null&&(g=this.tokenMax),{e:m,pmin:f,pmax:g,origin:this.origin,line:this.line})}break;default:let u=K.EBinop(e,t,l),p=t==null?0:t.pmin,_=l==null?0:l.pmax;return u==null?null:(p==null&&(p=this.tokenMin),_==null&&(_=this.tokenMax),{e:u,pmin:p,pmax:_,origin:this.origin,line:this.line})}}parseStructure(e){let t=this.tokenMin;switch(e){case"break":let l=K.EBreak,i=null,n=null;return l==null?null:(i==null&&(i=this.tokenMin),n==null&&(n=this.tokenMax),{e:l,pmin:i,pmax:n,origin:this.origin,line:this.line});case"continue":let s=K.EContinue,r=null,a=null;return s==null?null:(r==null&&(r=this.tokenMin),a==null&&(a=this.tokenMax),{e:s,pmin:r,pmax:a,origin:this.origin,line:this.line});case"do":let h=this.parseExpr(),o=this.token();o._hx_index==2?o.s!="while"&&this.unexpected(o):this.unexpected(o);let u=this.parseExpr(),p=K.EDoWhile(u,h),_=t,m=u==null?0:u.pmax;return p==null?null:(_==null&&(_=this.tokenMin),m==null&&(m=this.tokenMax),{e:p,pmin:_,pmax:m,origin:this.origin,line:this.line});case"else":return this.unexpected(Z.TId(e));case"for":let f=this.token();f!=Z.TPOpen&&this.unexpected(f);let g=this.getIdent(),d=this.token();_e.enumEq(d,Z.TId("in"))||this.unexpected(d);let w=this.parseExpr(),y=this.token();y!=Z.TPClose&&this.unexpected(y);let S=this.parseExpr(),T=K.EFor(g,w,S),O=t,E=S==null?0:S.pmax;return T==null?null:(O==null&&(O=this.tokenMin),E==null&&(E=this.tokenMax),{e:T,pmin:O,pmax:E,origin:this.origin,line:this.line});case"function":let v=this.token(),M=null;v._hx_index==2?M=v.s:(this.tokens.push({t:v,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax);let A=this.parseFunctionDecl(),L=K.EFunction(A.args,A.body,M,A.ret),I=t,q=A.body,z=q==null?0:q.pmax;return L==null?null:(I==null&&(I=this.tokenMin),z==null&&(z=this.tokenMax),{e:L,pmin:I,pmax:z,origin:this.origin,line:this.line});case"if":let P=this.token();P!=Z.TPOpen&&this.unexpected(P);let B=this.parseExpr(),N=this.token();N!=Z.TPClose&&this.unexpected(N);let D=this.parseExpr(),U=null,W=!1,J=this.token();J==Z.TSemicolon&&(W=!0,J=this.token()),_e.enumEq(J,Z.TId("else"))?U=this.parseExpr():(this.tokens.push({t:J,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,W&&(this.tokens.push({t:Z.TSemicolon,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax));let H=K.EIf(B,D,U),X=t,ae=U==null?this.tokenMax:U==null?0:U.pmax;return H==null?null:(X==null&&(X=this.tokenMin),ae==null&&(ae=this.tokenMax),{e:H,pmin:X,pmax:ae,origin:this.origin,line:this.line});case"inline":return this.maybe(Z.TId("function"))||this.unexpected(Z.TId("inline")),this.parseStructure("function");case"new":let ce=[];ce.push(this.getIdent());e:for(;;){let nt=this.token();switch(nt._hx_index){case 4:break e;case 8:ce.push(this.getIdent());break;default:this.unexpected(nt);break e}}let ne=this.parseExprList(Z.TPClose),re=K.ENew(ce.join("."),ne),xe=t,Pe=null;return re==null?null:(xe==null&&(xe=this.tokenMin),Pe==null&&(Pe=this.tokenMax),{e:re,pmin:xe,pmax:Pe,origin:this.origin,line:this.line});case"return":let Ue=this.token();this.tokens.push({t:Ue,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;let Je=Ue==Z.TSemicolon?null:this.parseExpr(),lt=K.EReturn(Je),Ve=t,Qe=Je==null?this.tokenMax:Je==null?0:Je.pmax;return lt==null?null:(Ve==null&&(Ve=this.tokenMin),Qe==null&&(Qe=this.tokenMax),{e:lt,pmin:Ve,pmax:Qe,origin:this.origin,line:this.line});case"switch":let at=this.parseExpr(),Re=null,$=[],se=this.token();se!=Z.TBrOpen&&this.unexpected(se);e:for(;;){let nt=this.token();switch(nt._hx_index){case 2:switch(nt.s){case"case":let Sl={values:[],expr:null};$.push(Sl);t:for(;;){let bt=this.parseExpr();switch(Sl.values.push(bt),nt=this.token(),nt._hx_index){case 10:break;case 15:break t;default:this.unexpected(nt);break t}}let Ce=[];t:for(;;)switch(nt=this.token(),this.tokens.push({t:nt,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,nt._hx_index){case 0:if(this.resumeErrors)break t;this.parseFullExpr(Ce);break;case 2:switch(nt.s){case"case":case"default":break t;default:this.parseFullExpr(Ce)}break;case 7:break t;default:this.parseFullExpr(Ce)}let rt;if(Ce.length==1)rt=Ce[0];else if(Ce.length==0){let bt=K.EBlock([]),Ct=this.tokenMin,Ft=this.tokenMin;bt==null?rt=null:(Ct==null&&(Ct=this.tokenMin),Ft==null&&(Ft=this.tokenMax),rt={e:bt,pmin:Ct,pmax:Ft,origin:this.origin,line:this.line})}else{let bt=K.EBlock(Ce),Ct=Ce[0],Ft=Ct==null?0:Ct.pmin,el=Ce[Ce.length-1],Tt=el==null?0:el.pmax;bt==null?rt=null:(Ft==null&&(Ft=this.tokenMin),Tt==null&&(Tt=this.tokenMax),rt={e:bt,pmin:Ft,pmax:Tt,origin:this.origin,line:this.line})}Sl.expr=rt;break;case"default":Re!=null&&this.unexpected(nt);let _t=this.token();_t!=Z.TDoubleDot&&this.unexpected(_t);let ot=[];t:for(;;)switch(nt=this.token(),this.tokens.push({t:nt,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,nt._hx_index){case 0:if(this.resumeErrors)break t;this.parseFullExpr(ot);break;case 2:switch(nt.s){case"case":case"default":break t;default:this.parseFullExpr(ot)}break;case 7:break t;default:this.parseFullExpr(ot)}if(ot.length==1)Re=ot[0];else if(ot.length==0){let bt=K.EBlock([]),Ct=this.tokenMin,Ft=this.tokenMin;bt==null?Re=null:(Ct==null&&(Ct=this.tokenMin),Ft==null&&(Ft=this.tokenMax),Re={e:bt,pmin:Ct,pmax:Ft,origin:this.origin,line:this.line})}else{let bt=K.EBlock(ot),Ct=ot[0],Ft=Ct==null?0:Ct.pmin,el=ot[ot.length-1],Tt=el==null?0:el.pmax;bt==null?Re=null:(Ft==null&&(Ft=this.tokenMin),Tt==null&&(Tt=this.tokenMax),Re={e:bt,pmin:Ft,pmax:Tt,origin:this.origin,line:this.line})}break;default:this.unexpected(nt);break e}break;case 7:break e;default:this.unexpected(nt);break e}}let j=K.ESwitch(at,$,Re),ie=t,le=this.tokenMax;return j==null?null:(ie==null&&(ie=this.tokenMin),le==null&&(le=this.tokenMax),{e:j,pmin:ie,pmax:le,origin:this.origin,line:this.line});case"throw":let ee=this.parseExpr(),pe=K.EThrow(ee),me=t,we=ee==null?0:ee.pmax;return pe==null?null:(me==null&&(me=this.tokenMin),we==null&&(we=this.tokenMax),{e:pe,pmin:me,pmax:we,origin:this.origin,line:this.line});case"try":let Ze=this.parseExpr(),yt=this.token();_e.enumEq(yt,Z.TId("catch"))||this.unexpected(yt);let Le=this.token();Le!=Z.TPOpen&&this.unexpected(Le);let dt=this.getIdent(),Oe=this.token();Oe!=Z.TDoubleDot&&this.unexpected(Oe);let Ie=null;if(this.allowTypes)Ie=this.parseType();else{let nt=this.token();_e.enumEq(nt,Z.TId("Dynamic"))||this.unexpected(nt)}let pt=this.token();pt!=Z.TPClose&&this.unexpected(pt);let it=this.parseExpr(),Ot=K.ETry(Ze,dt,Ie,it),Yt=t,xt=it==null?0:it.pmax;return Ot==null?null:(Yt==null&&(Yt=this.tokenMin),xt==null&&(xt=this.tokenMax),{e:Ot,pmin:Yt,pmax:xt,origin:this.origin,line:this.line});case"var":let ol=this.getIdent(),$e=this.token(),Vt=null;$e==Z.TDoubleDot&&this.allowTypes&&(Vt=this.parseType(),$e=this.token());let Bt=null;switch($e._hx_index){case 3:$e.s=="="?Bt=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:Vt!=null?(this.tokens.push({t:$e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax):this.unexpected($e)}let qt=K.EVar(ol,Vt,Bt),wt=t,Ht=Bt==null?this.tokenMax:Bt==null?0:Bt.pmax;return qt==null?null:(wt==null&&(wt=this.tokenMin),Ht==null&&(Ht=this.tokenMax),{e:qt,pmin:wt,pmax:Ht,origin:this.origin,line:this.line});case"while":let Zt=this.parseExpr(),Gt=this.parseExpr(),ul=K.EWhile(Zt,Gt),cl=t,Xt=Gt==null?0:Gt.pmax;return ul==null?null:(cl==null&&(cl=this.tokenMin),Xt==null&&(Xt=this.tokenMax),{e:ul,pmin:cl,pmax:Xt,origin:this.origin,line:this.line});default:return null}}parseExprNext(e){let t=this.token();switch(t._hx_index){case 2:let l=t.s;return l=="is"?this.makeBinop(l,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 i=t.s;if(i=="->"){let Le=e.e;switch(Le._hx_index){case 1:let dt=Le.v,Oe=this.parseExpr(),Ie=K.EReturn(Oe),pt=Oe==null?0:Oe.pmin,it=null,Ot;Ie==null?Ot=null:(pt==null&&(pt=this.tokenMin),it==null&&(it=this.tokenMax),Ot={e:Ie,pmin:pt,pmax:it,origin:this.origin,line:this.line});let Yt=K.EFunction([{name:dt}],Ot),xt=e==null?0:e.pmin,ol=null;return Yt==null?null:(xt==null&&(xt=this.tokenMin),ol==null&&(ol=this.tokenMax),{e:Yt,pmin:xt,pmax:ol,origin:this.origin,line:this.line});case 3:let $e=Le.e.e;if($e._hx_index==1){let Bt=$e.v,qt=this.parseExpr(),wt=K.EReturn(qt),Ht=qt==null?0:qt.pmin,Zt=null,Gt;wt==null?Gt=null:(Ht==null&&(Ht=this.tokenMin),Zt==null&&(Zt=this.tokenMax),Gt={e:wt,pmin:Ht,pmax:Zt,origin:this.origin,line:this.line});let ul=K.EFunction([{name:Bt}],Gt),cl=e==null?0:e.pmin,Xt=null;return ul==null?null:(cl==null&&(cl=this.tokenMin),Xt==null&&(Xt=this.tokenMax),{e:ul,pmin:cl,pmax:Xt,origin:this.origin,line:this.line})}break;case 26:let Vt=Le.e.e;if(Vt._hx_index==1){let Bt=Vt.v,qt=Le.t,wt=this.parseExpr(),Ht=K.EReturn(wt),Zt=wt==null?0:wt.pmin,Gt=null,ul;Ht==null?ul=null:(Zt==null&&(Zt=this.tokenMin),Gt==null&&(Gt=this.tokenMax),ul={e:Ht,pmin:Zt,pmax:Gt,origin:this.origin,line:this.line});let cl=K.EFunction([{name:Bt,t:qt}],ul),Xt=e==null?0:e.pmin,nt=null;return cl==null?null:(Xt==null&&(Xt=this.tokenMin),nt==null&&(nt=this.tokenMax),{e:cl,pmin:Xt,pmax:nt,origin:this.origin,line:this.line})}break;default:}this.unexpected(t)}if(this.opPriority.h[i]==-1){let Le;if(this.isBlock(e))Le=!0;else{let it=e.e;if(it._hx_index==3){let Ot=it.e;Le=!0}else Le=!1}if(Le)return this.tokens.push({t,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,e;let dt=K.EUnop(i,!1,e),Oe=e==null?0:e.pmin,Ie=null,pt;return dt==null?pt=null:(Oe==null&&(Oe=this.tokenMin),Ie==null&&(Ie=this.tokenMax),pt={e:dt,pmin:Oe,pmax:Ie,origin:this.origin,line:this.line}),this.parseExprNext(pt)}return this.makeBinop(i,e,this.parseExpr());case 4:let n=K.ECall(e,this.parseExprList(Z.TPClose)),s=e==null?0:e.pmin,r=null,a;return n==null?a=null:(s==null&&(s=this.tokenMin),r==null&&(r=this.tokenMax),a={e:n,pmin:s,pmax:r,origin:this.origin,line:this.line}),this.parseExprNext(a);case 8:let h=this.getIdent(),o=K.EField(e,h),u=e==null?0:e.pmin,p=null,_;return o==null?_=null:(u==null&&(u=this.tokenMin),p==null&&(p=this.tokenMax),_={e:o,pmin:u,pmax:p,origin:this.origin,line:this.line}),this.parseExprNext(_);case 9:let m=this.getIdent(),f="__a_"+this.uid++,g=K.EVar(f,null,e),d=e==null?0:e.pmin,w=e==null?0:e.pmax,y;g==null?y=null:(d==null&&(d=this.tokenMin),w==null&&(w=this.tokenMax),y={e:g,pmin:d,pmax:w,origin:this.origin,line:this.line});let S=K.EIdent(f),T=e==null?0:e.pmin,O=e==null?0:e.pmax,E;S==null?E=null:(T==null&&(T=this.tokenMin),O==null&&(O=this.tokenMax),E={e:S,pmin:T,pmax:O,origin:this.origin,line:this.line});let v=K.EIdent("null"),M=e==null?0:e.pmin,A=e==null?0:e.pmax,L;v==null?L=null:(M==null&&(M=this.tokenMin),A==null&&(A=this.tokenMax),L={e:v,pmin:M,pmax:A,origin:this.origin,line:this.line});let I=K.EBinop("==",E,L),q=null,z=null,P;I==null?P=null:(q==null&&(q=this.tokenMin),z==null&&(z=this.tokenMax),P={e:I,pmin:q,pmax:z,origin:this.origin,line:this.line});let B=K.EIdent("null"),N=e==null?0:e.pmin,D=e==null?0:e.pmax,U;B==null?U=null:(N==null&&(N=this.tokenMin),D==null&&(D=this.tokenMax),U={e:B,pmin:N,pmax:D,origin:this.origin,line:this.line});let W=K.EIdent(f),J=e==null?0:e.pmin,H=e==null?0:e.pmax,X;W==null?X=null:(J==null&&(J=this.tokenMin),H==null&&(H=this.tokenMax),X={e:W,pmin:J,pmax:H,origin:this.origin,line:this.line});let ae=K.EField(X,m),ce=e==null?0:e.pmin,ne=null,re;ae==null?re=null:(ce==null&&(ce=this.tokenMin),ne==null&&(ne=this.tokenMax),re={e:ae,pmin:ce,pmax:ne,origin:this.origin,line:this.line});let xe=K.ETernary(P,U,re),Pe=null,Ue=null,Je;xe==null?Je=null:(Pe==null&&(Pe=this.tokenMin),Ue==null&&(Ue=this.tokenMax),Je={e:xe,pmin:Pe,pmax:Ue,origin:this.origin,line:this.line});let lt=K.EBlock([y,Je]),Ve=e==null?0:e.pmin,Qe=null,at;return lt==null?at=null:(Ve==null&&(Ve=this.tokenMin),Qe==null&&(Qe=this.tokenMax),at={e:lt,pmin:Ve,pmax:Qe,origin:this.origin,line:this.line}),this.parseExprNext(at);case 12:let Re=this.parseExpr(),$=this.token();$!=Z.TBkClose&&this.unexpected($);let se=K.EArray(e,Re),j=e==null?0:e.pmin,ie=null,le;return se==null?le=null:(j==null&&(j=this.tokenMin),ie==null&&(ie=this.tokenMax),le={e:se,pmin:j,pmax:ie,origin:this.origin,line:this.line}),this.parseExprNext(le);case 14:let ee=this.parseExpr(),pe=this.token();pe!=Z.TDoubleDot&&this.unexpected(pe);let me=this.parseExpr(),we=K.ETernary(e,ee,me),Ze=e==null?0:e.pmin,yt=me==null?0:me.pmax;return we==null?null:(Ze==null&&(Ze=this.tokenMin),yt==null&&(yt=this.tokenMax),{e:we,pmin:Ze,pmax:yt,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!=Z.TPClose){let l=!1;for(;!l;){let i=null,n=!1;if(t._hx_index==14&&(n=!0,t=this.token()),t._hx_index==2)i=t.s;else{this.unexpected(t);break}let s={name:i};switch(e.push(s),n&&(s.opt=!0),this.allowTypes&&(this.maybe(Z.TDoubleDot)&&(s.t=this.parseType()),this.maybe(Z.TOp("="))&&(s.value=this.parseExpr())),t=this.token(),t._hx_index){case 5:l=!0;break;case 10:t=this.token();break;default:this.unexpected(t)}}}return e}parseFunctionDecl(){let e=this.token();e!=Z.TPOpen&&this.unexpected(e);let t=this.parseFunctionArgs(),l=null;if(this.allowTypes){let i=this.token();i!=Z.TDoubleDot?(this.tokens.push({t:i,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax):l=this.parseType()}return{args:t,ret:l,body:this.parseExpr()}}parsePath(){let e=[this.getIdent()];for(;;){let t=this.token();if(t!=Z.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 l=e.s;this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;let i=this.parsePath(),n=null;if(e=this.token(),e._hx_index==3)if(e.s=="<"){n=[];e:for(;;){switch(n.push(this.parseType()),e=this.token(),e._hx_index){case 3:let p=e.s;if(p==">")break e;if(c.cca(p,0)==62){this.tokens.add({t:Z.TOp(c.substr(p,1,null)),min:this.tokenMax-p.length-1,max:this.tokenMax});break e}break;case 10:continue;default:}this.unexpected(e);break}}else this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;else this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;return this.parseTypeNext(sl.CTPath(i,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 a=function(u){let p=t.token();if(p._hx_index==3){if(p.s!="->"){let _=p;t.unexpected(_)}}else{let _=p;t.unexpected(_)}return sl.CTFun(u,t.parseType())};switch(s._hx_index){case 2:let u=s.s;if(r._hx_index==15){let w=[],y=0,S=this.parseFunctionArgs();for(;y<S.length;){let O=S[y];++y;let E=O.value;if(E!=null){let v=E;if(!this.resumeErrors)throw C.thrown(new Se(Te.ECustom("Default values not allowed in function types"),v.pmin,v.pmax,this.origin,this.line))}w.push(sl.CTNamed(O.name,O.opt?sl.CTOpt(O.t):O.t))}return a(w)}else{let w=this.parseType(),y=this.token();switch(y._hx_index){case 5:return this.parseTypeNext(sl.CTParent(w));case 10:let S=[w];do S.push(this.parseType());while(this.maybe(Z.TComma));let T=this.token();return T!=Z.TPClose&&this.unexpected(T),a(S);default:let O=y;return this.unexpected(O)}}break;case 5:let p=[],_=0,m=this.parseFunctionArgs();for(;_<m.length;){let w=m[_];++_;let y=w.value;if(y!=null){let S=y;if(!this.resumeErrors)throw C.thrown(new Se(Te.ECustom("Default values not allowed in function types"),S.pmin,S.pmax,this.origin,this.line))}p.push(sl.CTNamed(w.name,w.opt?sl.CTOpt(w.t):w.t))}return a(p);default:let g=this.parseType(),d=this.token();switch(d._hx_index){case 5:return this.parseTypeNext(sl.CTParent(g));case 10:let w=[g];do w.push(this.parseType());while(this.maybe(Z.TComma));let y=this.token();return y!=Z.TPClose&&this.unexpected(y),a(w);default:let S=d;return this.unexpected(S)}}break;case 6:let h=[],o=null;e:for(;;)switch(e=this.token(),e._hx_index){case 2:let u=e.s;if(u=="var"){let _=this.getIdent(),m=this.token();m!=Z.TDoubleDot&&this.unexpected(m),h.push({name:_,t:this.parseType(),meta:o}),o=null;let f=this.token();f!=Z.TSemicolon&&this.unexpected(f)}else{let _=u,m=this.token();switch(m!=Z.TDoubleDot&&this.unexpected(m),h.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 p=e.s;o==null&&(o=[]),o.push({name:p,params:this.parseMetaArgs()});break;default:this.unexpected(e);break e}return this.parseTypeNext(sl.CTAnon(h));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 l=this.parseType();if(l._hx_index==1){let i=l.ret;return l.args.unshift(e),l}else return sl.CTFun([e],l)}parseExprList(e){let t=[],l=this.token();if(l==e)return t;for(this.tokens.push({t:l,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;;)if(t.push(this.parseExpr()),l=this.token(),l._hx_index!=10){if(l==e)break;this.unexpected(l);break}return t}parseModule(e,t,l){l==null&&(l=0),t==null&&(t="loreline.lorscript"),this.initParser(t,l),this.input=e,this.readPos=0,this.allowTypes=!0,this.allowMetadata=!0;let i=[];for(;;){let n=this.token();if(n==Z.TEof)break;this.tokens.push({t:n,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,i.push(this.parseModuleDecl())}return i}parseMetadata(){let e=[];for(;;){let t=this.token();if(t._hx_index==16){let l=t.s;e.push({name:l,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(Z.TOp("<"))&&!this.resumeErrors)throw C.thrown(new Se(Te.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(),l=!1,i=!1;e:for(;;){switch(t){case"extern":i=!0;break;case"private":l=!0;break;default:break e}t=this.getIdent()}switch(t){case"class":let n=this.getIdent(),s=this.parseParams(),r=null,a=[];e:for(;;){let S=this.token();if(S._hx_index==2)switch(S.s){case"extends":r=this.parseType();break;case"implements":a.push(this.parseType());break;default:this.tokens.push({t:S,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break e}else{this.tokens.push({t:S,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break}}let h=[],o=this.token();for(o!=Z.TBrOpen&&this.unexpected(o);!this.maybe(Z.TBrClose);)h.push(this.parseField());return ni.DClass({name:n,meta:e,params:s,extend:r,implement:a,fields:h,isPrivate:l,isExtern:i});case"import":let u=[this.getIdent()],p=!1;for(;;){let S=this.token();if(S!=Z.TDot){this.tokens.push({t:S,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break}switch(S=this.token(),S._hx_index){case 2:let T=S.s;u.push(T);break;case 3:S.s=="*"?p=!0:this.unexpected(S);break;default:this.unexpected(S)}}let _=this.token();return _!=Z.TSemicolon&&this.unexpected(_),ni.DImport(u,p);case"package":let m=this.parsePath(),f=this.token();return f!=Z.TSemicolon&&this.unexpected(f),ni.DPackage(m);case"typedef":let g=this.getIdent(),d=this.parseParams(),w=this.token();_e.enumEq(w,Z.TOp("="))||this.unexpected(w);let y=this.parseType();return ni.DTypedef({name:g,meta:e,params:d,isPrivate:l,t:y});default:this.unexpected(Z.TId(t))}return null}parseField(){let e=this.parseMetadata(),t=[];e:for(;;){let l=this.getIdent();switch(l){case"function":let i=this.getIdent(),n=this.parseFunctionDecl();return{name:i,meta:e,access:t,kind:ln.KFunction({args:n.args,expr:n.body,ret:n.ret})};case"inline":t.push(Al.AInline);break;case"macro":t.push(Al.AMacro);break;case"override":t.push(Al.AOverride);break;case"private":t.push(Al.APrivate);break;case"public":t.push(Al.APublic);break;case"static":t.push(Al.AStatic);break;case"var":let s=this.getIdent(),r=null,a=null;if(this.maybe(Z.TPOpen)){r=this.getIdent();let u=this.token();u!=Z.TComma&&this.unexpected(u),a=this.getIdent();let p=this.token();p!=Z.TPClose&&this.unexpected(p)}let h=this.maybe(Z.TDoubleDot)?this.parseType():null,o=this.maybe(Z.TOp("="))?this.parseExpr():null;if(o!=null)if(this.isBlock(o))this.maybe(Z.TSemicolon);else{let u=this.token();u!=Z.TSemicolon&&this.unexpected(u)}else{let u;if(h!=null)if(h==null)u=!1;else if(h._hx_index==2){let p=h.fields;u=!0}else u=!1;else u=!1;if(u)this.maybe(Z.TSemicolon);else{let p=this.token();p!=Z.TSemicolon&&this.unexpected(p)}}return{name:s,meta:e,access:t,kind:ln.KVar({get:r,set:a,type:h,expr:o})};default:this.unexpected(Z.TId(l));break e}}return null}readChar(){return this.input.charCodeAt(this.readPos++)}readString(e){let t=0,l="",i=!1,n=this.line,s=this.input,r=this.readPos+this.offset-1;for(;;){let a=this.input.charCodeAt(this.readPos++);if(a!=a){if(this.line=n,!this.resumeErrors)throw C.thrown(new Se(Te.EUnterminatedString,r,r,this.origin,this.line));break}if(i)switch(i=!1,a){case 47:this.allowJSON?l+=String.fromCodePoint(a):this.invalidChar(a);break;case 34:case 39:case 92:l+=String.fromCodePoint(a);break;case 110:l+=String.fromCodePoint(10);break;case 114:l+=String.fromCodePoint(13);break;case 116:l+=String.fromCodePoint(9);break;case 117:this.allowJSON||this.invalidChar(a);let h=0,o=0;for(;o<4;){let u=o++;h<<=4;let p=this.input.charCodeAt(this.readPos++);switch(p){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:h+=p-48;break;case 65:case 66:case 67:case 68:case 69:case 70:h+=p-55;break;case 97:case 98:case 99:case 100:case 101:case 102:h+=p-87;break;default:if(p!=p&&(this.line=n,!this.resumeErrors))throw C.thrown(new Se(Te.EUnterminatedString,r,r,this.origin,this.line));this.invalidChar(p)}}l+=String.fromCodePoint(h);break;default:this.invalidChar(a)}else if(a==92)i=!0;else{if(a==e)break;a==10&&this.line++,l+=String.fromCodePoint(a)}}return l}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,Z.TEof;switch(e){case 0:return Z.TEof;case 10:this.line++,this.tokenMin++;break;case 9:case 13:case 32:this.tokenMin++;break;case 34:case 39:return Z.TConst(yl.CString(this.readString(e)));case 35:if(e=this.input.charCodeAt(this.readPos++),this.idents[e]){let i=String.fromCodePoint(e);for(;;){if(e=this.input.charCodeAt(this.readPos++),!this.idents[e])return this.char=e,this.preprocess(i);i+=String.fromCodePoint(e)}}this.invalidChar(e);break;case 40:return Z.TPOpen;case 41:return Z.TPClose;case 44:return Z.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),Z.TOp("...");case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:let i=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:i=i*10+(e-48);break;default:return this.char=e,Z.TConst(yl.CFloat(i/n))}break;default:return this.char=e,Z.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,l=0;for(;;)switch(e=this.input.charCodeAt(this.readPos++),l*=10,e){case 46:if(l>0){if(l==10&&this.input.charCodeAt(this.readPos++)==46){this.tokens.push({t:Z.TOp("..."),min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;let a=t|0;return Z.TConst(a==t?yl.CInt(a):yl.CFloat(t))}this.invalidChar(e)}l=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 i=this.token(),n=null;switch(i._hx_index){case 1:let a=i.c;a._hx_index==0?n=a.v:(this.tokens.push({t:i,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax);break;case 3:if(i.s=="-")if(i=this.token(),i._hx_index==1){let h=i.c;h._hx_index==0?n=-h.v:(this.tokens.push({t:i,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax)}else this.tokens.push({t:i,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;else this.tokens.push({t:i,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break;default:this.tokens.push({t:i,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax}return n==null&&this.invalidChar(e),l==0&&(l=10),Z.TConst(yl.CFloat(Math.pow(10,n)/l*t*10));case 120:(t>0||l>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,Z.TConst(yl.CInt(s))}break;default:this.char=e;let r=t|0;return Z.TConst(l>0?yl.CFloat(t*10/l):r==t?yl.CInt(r):yl.CFloat(t))}break;case 58:return Z.TDoubleDot;case 59:return Z.TSemicolon;case 61:return e=this.input.charCodeAt(this.readPos++),e==61?Z.TOp("=="):e==62?Z.TOp("=>"):(this.char=e,Z.TOp("="));case 63:return e=this.input.charCodeAt(this.readPos++),e==46?Z.TQuestionDot:(this.char=e,Z.TQuestion);case 64:if(e=this.input.charCodeAt(this.readPos++),this.idents[e]||e==58){let i=String.fromCodePoint(e);for(;;){if(e=this.input.charCodeAt(this.readPos++),!this.idents[e])return this.char=e,Z.TMeta(i);i+=String.fromCodePoint(e)}}this.invalidChar(e);break;case 91:return Z.TBkOpen;case 93:return Z.TBkClose;case 123:return Z.TBrOpen;case 125:return Z.TBrClose;default:if(this.ops[e]){let i=String.fromCodePoint(e);for(;;){if(e=this.input.charCodeAt(this.readPos++),e!=e&&(e=0),!this.ops[e])return this.char=e,Z.TOp(i);let n=i;if(i+=String.fromCodePoint(e),!Object.prototype.hasOwnProperty.call(this.opPriority.h,i)&&Object.prototype.hasOwnProperty.call(this.opPriority.h,n))return i=="//"||i=="/*"?this.tokenComment(i,e):(this.char=e,Z.TOp(n))}}if(this.idents[e]){let i=String.fromCodePoint(e);for(;;){if(e=this.input.charCodeAt(this.readPos++),e!=e&&(e=0),!this.idents[e])return this.char=e,Z.TId(i);i+=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,l=K.EIdent(t),i=this.tokenMin,n=this.tokenMax;return l==null?null:(i==null&&(i=this.tokenMin),n==null&&(n=this.tokenMax),{e:l,pmin:i,pmax:n,origin:this.origin,line:this.line});case 3:if(e.s=="!"){let s=K.EUnop("!",!0,this.parsePreproCond()),r=this.tokenMin,a=this.tokenMax;return s==null?null:(r==null&&(r=this.tokenMin),a==null&&(a=this.tokenMax),{e:s,pmin:r,pmax:a,origin:this.origin,line:this.line})}else return this.unexpected(e);break;case 4:return this.tokens.push({t:Z.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 l=t.v;return this.preprocValue(l)!=null;case 3:let i=t.e;return this.evalPreproCond(i);case 6:let n=t.e1,s=t.e2;switch(t.op){case"&&":let h=n,o=s;return this.evalPreproCond(h)?this.evalPreproCond(o):!1;case"||":let u=n,p=s;return this.evalPreproCond(u)?!0:this.evalPreproCond(p);default:let _=e.e;if(!this.resumeErrors)throw C.thrown(new Se(Te.EInvalidPreprocessor("Can't eval "+Ye[_.__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 h=t.e;return!this.evalPreproCond(h)}else{let h=e.e;if(!this.resumeErrors)throw C.thrown(new Se(Te.EInvalidPreprocessor("Can't eval "+Ye[h.__enum__].__constructs__[h._hx_index]._hx_name),this.readPos+this.offset,this.readPos+this.offset,this.origin,this.line));return!1}break;default:let a=e.e;if(!this.resumeErrors)throw C.thrown(new Se(Te.EInvalidPreprocessor("Can't eval "+Ye[a.__enum__].__constructs__[a._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")):Z.TPrepro(e);case"end":return this.preprocStack.length>0?(this.preprocStack.pop(),this.token()):Z.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 Z.TPrepro(e)}}skipTokens(){let e=this.preprocStack.length-1,t=this.preprocStack[e],l=this.readPos+this.offset;for(;;){let i=this.token();if(i==Z.TEof&&!this.resumeErrors)throw C.thrown(new Se(Te.EInvalidPreprocessor("Unclosed"),l,l,this.origin,this.line));if(this.preprocStack[e]!=t){this.tokens.push({t:i,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break}}}tokenComment(e,t){let l=c.cca(e,1),i=this.input;if(l==47){for(;t!=13&&t!=10&&(t=this.input.charCodeAt(this.readPos++),t==t););return this.char=t,this.token()}if(l==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 C.thrown(new Se(Te.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 C.thrown(new Se(Te.EUnterminatedComment,this.tokenMin,this.tokenMin,this.origin,this.line));break}}while(t!=47);return this.token()}return this.char=t,Z.TOp(e)}constString(e){switch(e._hx_index){case 0:let t=e.v;return t==null?"null":""+t;case 1:let l=e.f;return l==null?"null":""+l;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}}}Q["loreline.lorscript.Parser"]=ci,ci.__name__="loreline.lorscript.Parser",Object.assign(ci.prototype,{__class__:ci,__properties__:{get_currentPos:"get_currentPos"}});class ki{constructor(){}exprToString(e){return this.buf=new gt,this.tabs="",this.expr(e),this.buf.b}typeToString(e){return this.buf=new gt,this.tabs="",this.type(e),this.buf.b}add(e){this.buf.b+=Y.string(e)}type(e){switch(e._hx_index){case 0:let t=e.path,l=e.params,i=t.join(".");if(this.buf.b+=Y.string(i),l!=null){this.buf.b+="<";let g=!0,d=0;for(;d<l.length;){let w=l[d];++d,g?g=!1:this.buf.b+=", ",this.type(w)}this.buf.b+=">"}break;case 1:let n=e.args,s=e.ret,r=n,a=s;if(cn.exists(r,function(g){if(g._hx_index==5){let d=g.n,w=g.t;return!0}else return!1})){this.buf.b+="(";let g=0;for(;g<r.length;){let d=r[g];if(++g,d._hx_index==5){let w=d.n,y=d.t;this.type(d)}else this.type(sl.CTNamed("_",d))}this.buf.b+=")->",this.type(a)}else{let g=n,d=s;if(g.length==0)this.buf.b+="Void -> ";else{let w=0;for(;w<g.length;){let y=g[w];++w,this.type(y),this.buf.b+=" -> "}}this.type(d)}break;case 2:let h=e.fields;this.buf.b+="{";let o=!0,u=0;for(;u<h.length;){let g=h[u];++u,o?(o=!1,this.buf.b+=" "):this.buf.b+=", ",this.buf.b+=Y.string(g.name+" : "),this.type(g.t)}this.buf.b+=o?"}":" }";break;case 3:let p=e.t;this.buf.b+="(",this.type(p),this.buf.b+=")";break;case 4:let _=e.t;this.buf.b+="?",this.type(_);break;case 5:let m=e.n,f=e.t;this.buf.b+=m==null?"null":""+m,this.buf.b+=":",this.type(f);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 l=t.c;switch(l._hx_index){case 0:let Oe=l.v;this.buf.b+=Oe==null?"null":""+Oe;break;case 1:let Ie=l.f;this.buf.b+=Ie==null?"null":""+Ie;break;case 2:let pt=l.s;this.buf.b+='"';let it=pt.split('"').join('\\"').split(`
45
45
  `).join("\\n").split("\r").join("\\r").split(" ").join("\\t");this.buf.b+=Y.string(it),this.buf.b+='"';break}break;case 1:let i=t.v;this.buf.b+=i==null?"null":""+i;break;case 2:let n=t.n,s=t.t,r=t.e;this.buf.b+=Y.string("var "+n),this.addType(s),r!=null&&(this.buf.b+=" = ",this.expr(r));break;case 3:let a=t.e;this.buf.b+="(",this.expr(a),this.buf.b+=")";break;case 4:let h=t.e;if(h.length==0)this.buf.b+="{}";else{this.tabs+=" ",this.buf.b+=`{
46
46
  `;let Oe=0;for(;Oe<h.length;){let Ie=h[Oe];++Oe,this.buf.b+=Y.string(this.tabs),this.expr(Ie),this.buf.b+=`;
47
- `}this.tabs=c.substr(this.tabs,1,null),this.buf.b+="}"}break;case 5:let o=t.e,u=t.f;this.expr(o),this.buf.b+=Y.string("."+u);break;case 6:let p=t.op,_=t.e1,m=t.e2;this.expr(_),this.buf.b+=Y.string(" "+p+" "),this.expr(m);break;case 7:let f=t.op,g=t.prefix,d=t.e;g?(this.buf.b+=f==null?"null":""+f,this.expr(d)):(this.expr(d),this.buf.b+=f==null?"null":""+f);break;case 8:let x=t.e,y=t.params;if(x==null)this.expr(x);else{let Oe=x.e;switch(Oe._hx_index){case 0:let Ie=Oe.c;this.expr(x);break;case 1:let pt=Oe.v;this.expr(x);break;case 5:let it=Oe.e,Ot=Oe.f;this.expr(x);break;default:this.buf.b+="(",this.expr(x),this.buf.b+=")"}}this.buf.b+="(";let S=!0,C=0;for(;C<y.length;){let Oe=y[C];++C,S?S=!1:this.buf.b+=", ",this.expr(Oe)}this.buf.b+=")";break;case 9:let O=t.cond,E=t.e1,v=t.e2;this.buf.b+="if( ",this.expr(O),this.buf.b+=" ) ",this.expr(E),v!=null&&(this.buf.b+=" else ",this.expr(v));break;case 10:let N=t.cond,B=t.e;this.buf.b+="while( ",this.expr(N),this.buf.b+=" ) ",this.expr(B);break;case 11:let L=t.v,I=t.it,W=t.e;this.buf.b+=Y.string("for( "+L+" in "),this.expr(I),this.buf.b+=" ) ",this.expr(W);break;case 12:this.buf.b+="break";break;case 13:this.buf.b+="continue";break;case 14:let q=t.args,P=t.e,R=t.name,M=t.ret;this.buf.b+="function",R!=null&&(this.buf.b+=Y.string(" "+R)),this.buf.b+="(";let D=!0,U=0;for(;U<q.length;){let Oe=q[U];++U,D?D=!1:this.buf.b+=", ",Oe.opt&&(this.buf.b+="?"),this.buf.b+=Y.string(Oe.name),this.addType(Oe.t)}this.buf.b+=")",this.addType(M),this.buf.b+=" ",this.expr(P);break;case 15:let z=t.e;this.buf.b+="return",z!=null&&(this.buf.b+=" ",this.expr(z));break;case 16:let J=t.e,H=t.index;this.expr(J),this.buf.b+="[",this.expr(H),this.buf.b+="]";break;case 17:let X=t.e;this.buf.b+="[";let ae=!0,ce=0;for(;ce<X.length;){let Oe=X[ce];++ce,ae?ae=!1:this.buf.b+=", ",this.expr(Oe)}this.buf.b+="]";break;case 18:let ne=t.cl,re=t.params;this.buf.b+=Y.string("new "+ne+"(");let xe=!0,Pe=0;for(;Pe<re.length;){let Oe=re[Pe];++Pe,xe?xe=!1:this.buf.b+=", ",this.expr(Oe)}this.buf.b+=")";break;case 19:let Ue=t.e;this.buf.b+="throw ",this.expr(Ue);break;case 20:let Je=t.e,lt=t.v,Ve=t.t,Qe=t.ecatch;this.buf.b+="try ",this.expr(Je),this.buf.b+=Y.string(" catch( "+lt),this.addType(Ve),this.buf.b+=") ",this.expr(Qe);break;case 21:let at=t.fl;if(at.length==0)this.buf.b+="{}";else{this.tabs+=" ",this.buf.b+=`{
47
+ `}this.tabs=c.substr(this.tabs,1,null),this.buf.b+="}"}break;case 5:let o=t.e,u=t.f;this.expr(o),this.buf.b+=Y.string("."+u);break;case 6:let p=t.op,_=t.e1,m=t.e2;this.expr(_),this.buf.b+=Y.string(" "+p+" "),this.expr(m);break;case 7:let f=t.op,g=t.prefix,d=t.e;g?(this.buf.b+=f==null?"null":""+f,this.expr(d)):(this.expr(d),this.buf.b+=f==null?"null":""+f);break;case 8:let w=t.e,y=t.params;if(w==null)this.expr(w);else{let Oe=w.e;switch(Oe._hx_index){case 0:let Ie=Oe.c;this.expr(w);break;case 1:let pt=Oe.v;this.expr(w);break;case 5:let it=Oe.e,Ot=Oe.f;this.expr(w);break;default:this.buf.b+="(",this.expr(w),this.buf.b+=")"}}this.buf.b+="(";let S=!0,T=0;for(;T<y.length;){let Oe=y[T];++T,S?S=!1:this.buf.b+=", ",this.expr(Oe)}this.buf.b+=")";break;case 9:let O=t.cond,E=t.e1,v=t.e2;this.buf.b+="if( ",this.expr(O),this.buf.b+=" ) ",this.expr(E),v!=null&&(this.buf.b+=" else ",this.expr(v));break;case 10:let M=t.cond,A=t.e;this.buf.b+="while( ",this.expr(M),this.buf.b+=" ) ",this.expr(A);break;case 11:let L=t.v,I=t.it,q=t.e;this.buf.b+=Y.string("for( "+L+" in "),this.expr(I),this.buf.b+=" ) ",this.expr(q);break;case 12:this.buf.b+="break";break;case 13:this.buf.b+="continue";break;case 14:let z=t.args,P=t.e,B=t.name,N=t.ret;this.buf.b+="function",B!=null&&(this.buf.b+=Y.string(" "+B)),this.buf.b+="(";let D=!0,U=0;for(;U<z.length;){let Oe=z[U];++U,D?D=!1:this.buf.b+=", ",Oe.opt&&(this.buf.b+="?"),this.buf.b+=Y.string(Oe.name),this.addType(Oe.t)}this.buf.b+=")",this.addType(N),this.buf.b+=" ",this.expr(P);break;case 15:let W=t.e;this.buf.b+="return",W!=null&&(this.buf.b+=" ",this.expr(W));break;case 16:let J=t.e,H=t.index;this.expr(J),this.buf.b+="[",this.expr(H),this.buf.b+="]";break;case 17:let X=t.e;this.buf.b+="[";let ae=!0,ce=0;for(;ce<X.length;){let Oe=X[ce];++ce,ae?ae=!1:this.buf.b+=", ",this.expr(Oe)}this.buf.b+="]";break;case 18:let ne=t.cl,re=t.params;this.buf.b+=Y.string("new "+ne+"(");let xe=!0,Pe=0;for(;Pe<re.length;){let Oe=re[Pe];++Pe,xe?xe=!1:this.buf.b+=", ",this.expr(Oe)}this.buf.b+=")";break;case 19:let Ue=t.e;this.buf.b+="throw ",this.expr(Ue);break;case 20:let Je=t.e,lt=t.v,Ve=t.t,Qe=t.ecatch;this.buf.b+="try ",this.expr(Je),this.buf.b+=Y.string(" catch( "+lt),this.addType(Ve),this.buf.b+=") ",this.expr(Qe);break;case 21:let at=t.fl;if(at.length==0)this.buf.b+="{}";else{this.tabs+=" ",this.buf.b+=`{
48
48
  `;let Oe=0;for(;Oe<at.length;){let Ie=at[Oe];++Oe,this.buf.b+=Y.string(this.tabs),this.buf.b+=Y.string(Ie.name+" : "),this.expr(Ie.e),this.buf.b+=`,
49
49
  `}this.tabs=c.substr(this.tabs,1,null),this.buf.b+="}"}break;case 22:let Re=t.cond,$=t.e1,se=t.e2;this.expr(Re),this.buf.b+=" ? ",this.expr($),this.buf.b+=" : ",this.expr(se);break;case 23:let j=t.e,ie=t.cases,le=t.defaultExpr;this.buf.b+="switch( ",this.expr(j),this.buf.b+=") {";let ee=0;for(;ee<ie.length;){let Oe=ie[ee];++ee,this.buf.b+="case ";let Ie=!0,pt=0,it=Oe.values;for(;pt<it.length;){let Ot=it[pt];++pt,Ie?Ie=!1:this.buf.b+=", ",this.expr(Ot)}this.buf.b+=": ",this.expr(Oe.expr),this.buf.b+=`;
50
50
  `}le!=null&&(this.buf.b+="default: ",this.expr(le),this.buf.b+=`;
51
- `),this.buf.b+="}";break;case 24:let pe=t.cond,me=t.e;this.buf.b+="do ",this.expr(me),this.buf.b+=" while ( ",this.expr(pe),this.buf.b+=" )";break;case 25:let we=t.name,Ze=t.args,yt=t.e;if(this.buf.b+="@",this.buf.b+=we==null?"null":""+we,Ze!=null&&Ze.length>0){this.buf.b+="(";let Oe=!0,Ie=0;for(;Ie<Ze.length;){let pt=Ze[Ie];++Ie,Oe?Oe=!1:this.buf.b+=", ",this.expr(yt)}this.buf.b+=")"}this.buf.b+=" ",this.expr(yt);break;case 26:let Le=t.e,dt=t.t;this.buf.b+="(",this.expr(Le),this.buf.b+=" : ",this.addType(dt),this.buf.b+=")";break}}static toString(e){return new ki().exprToString(e)}static errorToString(e){let t,l=e.e;switch(l._hx_index){case 0:let i=l.c;t="Invalid character: '"+(i!=i?"EOF":String.fromCodePoint(i))+"' ("+i+")";break;case 1:t='Unexpected token: "'+l.s+'"';break;case 2:t="Unterminated string";break;case 3:t="Unterminated comment";break;case 4:t="Invalid preprocessor ("+l.msg+")";break;case 5:t="Unknown variable: "+l.v;break;case 6:t="Invalid iterator: "+l.v;break;case 7:t="Invalid operator: "+l.op;break;case 8:t="Invalid access to field "+l.f;break;case 9:t=l.msg;break}return e.origin+":"+e.line+": "+t}}Q["loreline.lorscript.Printer"]=ki,ki.__name__="loreline.lorscript.Printer",Object.assign(ki.prototype,{__class__:ki});class un{static iter(e,t){let l=e.e;switch(l._hx_index){case 0:let i=l.c;break;case 1:let n=l.v;break;case 2:let s=l.n,r=l.t,a=l.e;a!=null&&t(a);break;case 3:let h=l.e;t(h);break;case 4:let o=l.e,u=0;for(;u<o.length;){let Le=o[u];++u,t(Le)}break;case 5:let p=l.f,_=l.e;t(_);break;case 6:let m=l.op,f=l.e1,g=l.e2;t(f),t(g);break;case 7:let d=l.op,x=l.prefix,y=l.e;t(y);break;case 8:let S=l.e,C=l.params;t(S);let O=0;for(;O<C.length;){let Le=C[O];++O,t(Le)}break;case 9:let E=l.cond,v=l.e1,N=l.e2;t(E),t(v),N!=null&&t(N);break;case 10:let B=l.cond,L=l.e;t(B),t(L);break;case 11:let I=l.v,W=l.it,q=l.e;t(W),t(q);break;case 12:case 13:break;case 14:let P=l.args,R=l.name,M=l.ret,D=l.e;t(D);break;case 15:let U=l.e;U!=null&&t(U);break;case 16:let z=l.e,J=l.index;t(z),t(J);break;case 17:let H=l.e,X=0;for(;X<H.length;){let Le=H[X];++X,t(Le)}break;case 18:let ae=l.cl,ce=l.params,ne=0;for(;ne<ce.length;){let Le=ce[ne];++ne,t(Le)}break;case 19:let re=l.e;t(re);break;case 20:let xe=l.v,Pe=l.t,Ue=l.e,Je=l.ecatch;t(Ue),t(Je);break;case 21:let lt=l.fl,Ve=0;for(;Ve<lt.length;){let Le=lt[Ve];++Ve,t(Le.e)}break;case 22:let Qe=l.cond,at=l.e1,Re=l.e2;t(Qe),t(at),t(Re);break;case 23:let $=l.e,se=l.cases,j=l.defaultExpr;t($);let ie=0;for(;ie<se.length;){let Le=se[ie];++ie;let dt=0,Oe=Le.values;for(;dt<Oe.length;){let Ie=Oe[dt];++dt,t(Ie)}t(Le.expr)}j!=null&&t(j);break;case 24:let le=l.cond,ee=l.e;t(le),t(ee);break;case 25:let pe=l.name,me=l.args,we=l.e;if(me!=null){let Le=0;for(;Le<me.length;){let dt=me[Le];++Le,t(dt)}}t(we);break;case 26:let Ze=l.t,yt=l.e;t(yt);break}}static map(e,t){let l,i=e.e;switch(i._hx_index){case 0:let n=i.c;l=e.e;break;case 1:let s=i.v;l=e.e;break;case 2:let r=i.n,a=i.t,h=i.e;l=K.EVar(r,a,h!=null?t(h):null);break;case 3:let o=i.e;l=K.EParent(t(o));break;case 4:let u=i.e,p=[],_=0;for(;_<u.length;){let $e=u[_];++_,p.push(t($e))}l=K.EBlock(p);break;case 5:let m=i.e,f=i.f;l=K.EField(t(m),f);break;case 6:let g=i.op,d=i.e1,x=i.e2;l=K.EBinop(g,t(d),t(x));break;case 7:let y=i.op,S=i.prefix,C=i.e;l=K.EUnop(y,S,t(C));break;case 8:let O=i.e,E=i.params,v=t(O),N=[],B=0;for(;B<E.length;){let $e=E[B];++B,N.push(t($e))}l=K.ECall(v,N);break;case 9:let L=i.cond,I=i.e1,W=i.e2;l=K.EIf(t(L),t(I),W!=null?t(W):null);break;case 10:let q=i.cond,P=i.e;l=K.EWhile(t(q),t(P));break;case 11:let R=i.v,M=i.it,D=i.e;l=K.EFor(R,t(M),t(D));break;case 12:case 13:l=e.e;break;case 14:let U=i.args,z=i.e,J=i.name,H=i.ret;l=K.EFunction(U,t(z),J,H);break;case 15:let X=i.e;l=K.EReturn(X!=null?t(X):null);break;case 16:let ae=i.e,ce=i.index;l=K.EArray(t(ae),t(ce));break;case 17:let ne=i.e,re=[],xe=0;for(;xe<ne.length;){let $e=ne[xe];++xe,re.push(t($e))}l=K.EArrayDecl(re);break;case 18:let Pe=i.cl,Ue=i.params,Je=[],lt=0;for(;lt<Ue.length;){let $e=Ue[lt];++lt,Je.push(t($e))}l=K.ENew(Pe,Je);break;case 19:let Ve=i.e;l=K.EThrow(t(Ve));break;case 20:let Qe=i.e,at=i.v,Re=i.t,$=i.ecatch;l=K.ETry(t(Qe),at,Re,t($));break;case 21:let se=i.fl,j=[],ie=0;for(;ie<se.length;){let $e=se[ie];++ie,j.push({name:$e.name,e:t($e.e)})}l=K.EObject(j);break;case 22:let le=i.cond,ee=i.e1,pe=i.e2;l=K.ETernary(t(le),t(ee),t(pe));break;case 23:let me=i.e,we=i.cases,Ze=i.defaultExpr,yt=t(me),Le=[],dt=0;for(;dt<we.length;){let $e=we[dt];++dt;let Vt=[],Bt=0,qt=$e.values;for(;Bt<qt.length;){let wt=qt[Bt];++Bt,Vt.push(t(wt))}Le.push({values:Vt,expr:t($e.expr)})}l=K.ESwitch(yt,Le,Ze==null?null:t(Ze));break;case 24:let Oe=i.cond,Ie=i.e;l=K.EDoWhile(t(Oe),t(Ie));break;case 25:let pt=i.name,it=i.args,Ot=i.e,Yt;if(it==null)Yt=null;else{let $e=[],Vt=0;for(;Vt<it.length;){let Bt=it[Vt];++Vt,$e.push(t(Bt))}Yt=$e}l=K.EMeta(pt,Yt,t(Ot));break;case 26:let xt=i.e,ol=i.t;l=K.ECheckType(t(xt),ol);break}return{e:l,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}}}Q["loreline.lorscript.Tools"]=un,un.__name__="loreline.lorscript.Tools";class Ut{static toLoreline(e,t){return Ut.convert(e,44,t)}static tsvToLoreline(e,t){return Ut.convert(e,9,t)}static convert(e,t,l){let i=Ut.parseRows(e,t);if(i.length<1)throw T.thrown(new st("Invalid CSV: header row required"));if(i.length<2)return"";let n=i[0],s=Ut.findColumn(n,["key"]);if(s<0)throw T.thrown(new st("Invalid CSV: 'key' column not found in header"));let r=Ut.findColumn(n,["source","en","original"]),a=Ut.findLocaleColumn(n,l);if(a<0)if(n.length>=2)a=n.length-1;else return"";let h="",o=!0,u=1,p=i.length;for(;u<p;){let _=u++,m=i[_];if(m.length<=s)continue;let f=m[s];if(f==null||f==""||m.length<=a)continue;let g=m[a];if(g==null||g=="")continue;let d=r>=0&&m.length>r?m[r]:null;o||(h+=`
51
+ `),this.buf.b+="}";break;case 24:let pe=t.cond,me=t.e;this.buf.b+="do ",this.expr(me),this.buf.b+=" while ( ",this.expr(pe),this.buf.b+=" )";break;case 25:let we=t.name,Ze=t.args,yt=t.e;if(this.buf.b+="@",this.buf.b+=we==null?"null":""+we,Ze!=null&&Ze.length>0){this.buf.b+="(";let Oe=!0,Ie=0;for(;Ie<Ze.length;){let pt=Ze[Ie];++Ie,Oe?Oe=!1:this.buf.b+=", ",this.expr(yt)}this.buf.b+=")"}this.buf.b+=" ",this.expr(yt);break;case 26:let Le=t.e,dt=t.t;this.buf.b+="(",this.expr(Le),this.buf.b+=" : ",this.addType(dt),this.buf.b+=")";break}}static toString(e){return new ki().exprToString(e)}static errorToString(e){let t,l=e.e;switch(l._hx_index){case 0:let i=l.c;t="Invalid character: '"+(i!=i?"EOF":String.fromCodePoint(i))+"' ("+i+")";break;case 1:t='Unexpected token: "'+l.s+'"';break;case 2:t="Unterminated string";break;case 3:t="Unterminated comment";break;case 4:t="Invalid preprocessor ("+l.msg+")";break;case 5:t="Unknown variable: "+l.v;break;case 6:t="Invalid iterator: "+l.v;break;case 7:t="Invalid operator: "+l.op;break;case 8:t="Invalid access to field "+l.f;break;case 9:t=l.msg;break}return e.origin+":"+e.line+": "+t}}Q["loreline.lorscript.Printer"]=ki,ki.__name__="loreline.lorscript.Printer",Object.assign(ki.prototype,{__class__:ki});class un{static iter(e,t){let l=e.e;switch(l._hx_index){case 0:let i=l.c;break;case 1:let n=l.v;break;case 2:let s=l.n,r=l.t,a=l.e;a!=null&&t(a);break;case 3:let h=l.e;t(h);break;case 4:let o=l.e,u=0;for(;u<o.length;){let Le=o[u];++u,t(Le)}break;case 5:let p=l.f,_=l.e;t(_);break;case 6:let m=l.op,f=l.e1,g=l.e2;t(f),t(g);break;case 7:let d=l.op,w=l.prefix,y=l.e;t(y);break;case 8:let S=l.e,T=l.params;t(S);let O=0;for(;O<T.length;){let Le=T[O];++O,t(Le)}break;case 9:let E=l.cond,v=l.e1,M=l.e2;t(E),t(v),M!=null&&t(M);break;case 10:let A=l.cond,L=l.e;t(A),t(L);break;case 11:let I=l.v,q=l.it,z=l.e;t(q),t(z);break;case 12:case 13:break;case 14:let P=l.args,B=l.name,N=l.ret,D=l.e;t(D);break;case 15:let U=l.e;U!=null&&t(U);break;case 16:let W=l.e,J=l.index;t(W),t(J);break;case 17:let H=l.e,X=0;for(;X<H.length;){let Le=H[X];++X,t(Le)}break;case 18:let ae=l.cl,ce=l.params,ne=0;for(;ne<ce.length;){let Le=ce[ne];++ne,t(Le)}break;case 19:let re=l.e;t(re);break;case 20:let xe=l.v,Pe=l.t,Ue=l.e,Je=l.ecatch;t(Ue),t(Je);break;case 21:let lt=l.fl,Ve=0;for(;Ve<lt.length;){let Le=lt[Ve];++Ve,t(Le.e)}break;case 22:let Qe=l.cond,at=l.e1,Re=l.e2;t(Qe),t(at),t(Re);break;case 23:let $=l.e,se=l.cases,j=l.defaultExpr;t($);let ie=0;for(;ie<se.length;){let Le=se[ie];++ie;let dt=0,Oe=Le.values;for(;dt<Oe.length;){let Ie=Oe[dt];++dt,t(Ie)}t(Le.expr)}j!=null&&t(j);break;case 24:let le=l.cond,ee=l.e;t(le),t(ee);break;case 25:let pe=l.name,me=l.args,we=l.e;if(me!=null){let Le=0;for(;Le<me.length;){let dt=me[Le];++Le,t(dt)}}t(we);break;case 26:let Ze=l.t,yt=l.e;t(yt);break}}static map(e,t){let l,i=e.e;switch(i._hx_index){case 0:let n=i.c;l=e.e;break;case 1:let s=i.v;l=e.e;break;case 2:let r=i.n,a=i.t,h=i.e;l=K.EVar(r,a,h!=null?t(h):null);break;case 3:let o=i.e;l=K.EParent(t(o));break;case 4:let u=i.e,p=[],_=0;for(;_<u.length;){let $e=u[_];++_,p.push(t($e))}l=K.EBlock(p);break;case 5:let m=i.e,f=i.f;l=K.EField(t(m),f);break;case 6:let g=i.op,d=i.e1,w=i.e2;l=K.EBinop(g,t(d),t(w));break;case 7:let y=i.op,S=i.prefix,T=i.e;l=K.EUnop(y,S,t(T));break;case 8:let O=i.e,E=i.params,v=t(O),M=[],A=0;for(;A<E.length;){let $e=E[A];++A,M.push(t($e))}l=K.ECall(v,M);break;case 9:let L=i.cond,I=i.e1,q=i.e2;l=K.EIf(t(L),t(I),q!=null?t(q):null);break;case 10:let z=i.cond,P=i.e;l=K.EWhile(t(z),t(P));break;case 11:let B=i.v,N=i.it,D=i.e;l=K.EFor(B,t(N),t(D));break;case 12:case 13:l=e.e;break;case 14:let U=i.args,W=i.e,J=i.name,H=i.ret;l=K.EFunction(U,t(W),J,H);break;case 15:let X=i.e;l=K.EReturn(X!=null?t(X):null);break;case 16:let ae=i.e,ce=i.index;l=K.EArray(t(ae),t(ce));break;case 17:let ne=i.e,re=[],xe=0;for(;xe<ne.length;){let $e=ne[xe];++xe,re.push(t($e))}l=K.EArrayDecl(re);break;case 18:let Pe=i.cl,Ue=i.params,Je=[],lt=0;for(;lt<Ue.length;){let $e=Ue[lt];++lt,Je.push(t($e))}l=K.ENew(Pe,Je);break;case 19:let Ve=i.e;l=K.EThrow(t(Ve));break;case 20:let Qe=i.e,at=i.v,Re=i.t,$=i.ecatch;l=K.ETry(t(Qe),at,Re,t($));break;case 21:let se=i.fl,j=[],ie=0;for(;ie<se.length;){let $e=se[ie];++ie,j.push({name:$e.name,e:t($e.e)})}l=K.EObject(j);break;case 22:let le=i.cond,ee=i.e1,pe=i.e2;l=K.ETernary(t(le),t(ee),t(pe));break;case 23:let me=i.e,we=i.cases,Ze=i.defaultExpr,yt=t(me),Le=[],dt=0;for(;dt<we.length;){let $e=we[dt];++dt;let Vt=[],Bt=0,qt=$e.values;for(;Bt<qt.length;){let wt=qt[Bt];++Bt,Vt.push(t(wt))}Le.push({values:Vt,expr:t($e.expr)})}l=K.ESwitch(yt,Le,Ze==null?null:t(Ze));break;case 24:let Oe=i.cond,Ie=i.e;l=K.EDoWhile(t(Oe),t(Ie));break;case 25:let pt=i.name,it=i.args,Ot=i.e,Yt;if(it==null)Yt=null;else{let $e=[],Vt=0;for(;Vt<it.length;){let Bt=it[Vt];++Vt,$e.push(t(Bt))}Yt=$e}l=K.EMeta(pt,Yt,t(Ot));break;case 26:let xt=i.e,ol=i.t;l=K.ECheckType(t(xt),ol);break}return{e:l,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}}}Q["loreline.lorscript.Tools"]=un,un.__name__="loreline.lorscript.Tools";class Ut{static toLoreline(e,t){return Ut.convert(e,44,t)}static tsvToLoreline(e,t){return Ut.convert(e,9,t)}static convert(e,t,l){let i=Ut.parseRows(e,t);if(i.length<1)throw C.thrown(new st("Invalid CSV: header row required"));if(i.length<2)return"";let n=i[0],s=Ut.findColumn(n,["key"]);if(s<0)throw C.thrown(new st("Invalid CSV: 'key' column not found in header"));let r=Ut.findColumn(n,["source","en","original"]),a=Ut.findLocaleColumn(n,l);if(a<0)if(n.length>=2)a=n.length-1;else return"";let h="",o=!0,u=1,p=i.length;for(;u<p;){let _=u++,m=i[_];if(m.length<=s)continue;let f=m[s];if(f==null||f==""||m.length<=a)continue;let g=m[a];if(g==null||g=="")continue;let d=r>=0&&m.length>r?m[r]:null;o||(h+=`
52
52
  `),o=!1,h+="#",h+=f==null?"null":""+f,d!=null&&d!=""&&(h+=" // ",h+=Y.string(d.split(`
53
53
  `).join(" ").split("\r").join(""))),h+=`
54
54
  `,h+=g==null?"null":""+g,h+=`
@@ -67,10 +67,10 @@
67
67
  `,s+='msgid "',s+=Y.string(bl.escapeForPoString(h)),s+=`"
68
68
  `,s+='msgstr "',s+=Y.string(bl.escapeForPoString(o)),s+=`"
69
69
  `}return s}static escapeForPoString(e){let t=e.split("\\").join("\\\\");return t=t.split('"').join('\\"'),t}static parse(e){let t=e.split(`
70
- `),l=[],i=null,n=0;for(;n<t.length;){let s=t[n],r;if(s.length>0){let g=c.cca(s,s.length-1);r=(g??-1)==13}else r=!1;if(r){let g=s.length-1;s=g!=null?c.substr(s,0,g):c.substr(s,0,null)}let a=0,h=s.length;for(;a<h;){let g=c.cca(s,a),d=g??-1;if(d!=32&&d!=9)break;++a}let o;if(a==0)o=s;else{let g=null;o=g!=null?c.substr(s,a,g):c.substr(s,a,null)}if(o==""){i!=null&&(l.push(i),i=null),++n;continue}let u=c.cca(o,0);if((u??-1)==35){++n;continue}i==null&&(i=new sn);let p=bl.readKeyword(o);if(p==null){++n;continue}let _=bl.readQuotedString(o,p.length),m=_??"",f=n+1;for(;f<t.length;){let g=t[f],d;if(g.length>0){let E=c.cca(g,g.length-1);d=(E??-1)==13}else d=!1;if(d){let E=g.length-1;g=E!=null?c.substr(g,0,E):c.substr(g,0,null)}let x=0,y=g.length;for(;x<y;){let E=c.cca(g,x),v=E??-1;if(v!=32&&v!=9)break;++x}let S;if(x==0)S=g;else{let E=null;S=E!=null?c.substr(g,x,E):c.substr(g,x,null)}let C;if(S.length!=0){let E=c.cca(S,0);C=(E??-1)!=34}else C=!0;if(C)break;let O=bl.readQuotedString(S,0);O!=null&&(m+=O),++f}switch(p){case"msgctxt":i.msgctxt=m;break;case"msgid":i.msgid=m;break;case"msgstr":i.msgstr=m;break;default:p=="msgstr[0]"&&(i.msgstr=m)}n=f}return i!=null&&l.push(i),l}static readKeyword(e){let t=0,l=e.length;for(;t<l;){let i=c.cca(e,t),n=i??-1;if(n==32||n==9)break;++t}return t==0?null:t!=null?c.substr(e,0,t):c.substr(e,0,null)}static readQuotedString(e,t){let l=t,i=e.length;for(;l<i;){let r=c.cca(e,l),a=r??-1;if(a!=32&&a!=9)break;++l}let n;if(l<i){let r=c.cca(e,l);n=(r??-1)!=34}else n=!0;if(n)return null;++l;let s="";for(;l<i;){let r=c.cca(e,l),a=r??-1;if(a==92&&l+1<i){let h=c.cca(e,l+1),o=h??-1;switch(o){case 34:s+=String.fromCodePoint(34);break;case 92:s+=String.fromCodePoint(92);break;case 110:s+=String.fromCodePoint(10);break;case 114:s+=String.fromCodePoint(13);break;case 116:s+=String.fromCodePoint(9);break;default:s+=String.fromCodePoint(o)}l+=2}else{if(a==34)return s;s+=String.fromCodePoint(a),++l}}throw T.thrown(new st("Invalid PO: unterminated quoted string"))}static trimLeft(e){let t=0,l=e.length;for(;t<l;){let i=c.cca(e,t),n=i??-1;if(n!=32&&n!=9)break;++t}if(t==0)return e;{let i=null;return i!=null?c.substr(e,t,i):c.substr(e,t,null)}}static escapeLineForComment(e){return e.split(`
71
- `).join(" ").split("\r").join("")}static escapeLineForBody(e){return e}}Q["loreline.translation.PoTranslation"]=bl,bl.__name__="loreline.translation.PoTranslation";class sn{constructor(){}}Q["loreline.translation._PoTranslation.PoEntry"]=sn,sn.__name__="loreline.translation._PoTranslation.PoEntry",Object.assign(sn.prototype,{__class__:sn});class Cl{static convert(e,t,l){switch(e){case".csv":return Ut.toLoreline(t,l);case".po":return bl.toLoreline(t,l);case".tsv":return Ut.tsvToLoreline(t,l);case".xlf":case".xliff":return vt.toLoreline(t,l);default:throw new T("Unknown translation format extension: "+e)}}static translationFormat(e,t){Cl.enabled.h[e]=t}static anyEnabled(){let e=0,t=Cl.formats;for(;e<t.length;){let l=t[e];if(++e,Cl.enabled.h[l.name]==!0)return!0}return!1}static wrap(e,t){if(!Cl.anyEnabled())return new Di(e,function(){return null});let l=null,i=null;i=function(s,r,a,h){if(a>=Cl.formats.length){r?i(s,!1,0,h):h(null);return}let o=Cl.formats[a];if(Cl.enabled.h[o.name]!=!0){i(s,r,a+1,h);return}let u=r?s+"."+t+o.ext:s+o.ext;e(u,function(p){if(p!=null)try{h(Cl.convert(o.ext,p,t))}catch(_){let m=T.caught(_).unwrap();if(m instanceof st){let f=m;l=new st('Failed to load translation file "'+u+'": '+f.message),i(s,r,a+1,h)}else throw _}else i(s,r,a+1,h)})};let n=function(s,r){e(s,function(a){if(a!=null){r(a);return}let h;if(s==null)h=!1;else{let d=s.length;if(d<4)h=!1;else{let x,y,S=c.cca(s,d-4);if((S??-1)==46){let C=c.cca(s,d-3),O=C??-1;y=O==108||O==76}else y=!1;if(y){let C=c.cca(s,d-2),O=C??-1;x=O==111||O==79}else x=!1;if(x){let C=c.cca(s,d-1),O=C??-1;h=O==114||O==82}else h=!1}}if(!h){r(null);return}let o=s.length-4,u=o!=null?c.substr(s,0,o):c.substr(s,0,null),p="."+t,_,m=u.length,f=p.length,g;if(f>m)g=!1;else{let d=m-f;g=(f!=null?c.substr(u,d,f):c.substr(u,d,null))==p}if(g){let d=u.length-p.length;_=d!=null?c.substr(u,0,d):c.substr(u,0,null)}else _=u;i(_,!0,0,r)})};return new Di(n,function(){return l})}static endsWith(e,t){let l=e.length,i=t.length;if(i>l)return!1;let n=l-i;return(i!=null?c.substr(e,n,i):c.substr(e,n,null))==t}}Q["loreline.translation.TranslationFormats"]=Cl,Cl.__name__="loreline.translation.TranslationFormats";class Di{constructor(e,t){this.handler=e,this.lastError=t}}Q["loreline.translation.WrappedFileHandler"]=Di,Di.__name__="loreline.translation.WrappedFileHandler",Object.assign(Di.prototype,{__class__:Di});class vt{static toLoreline(e,t){let l;try{l=ei.parse(e)}catch(p){let _=T.caught(p).unwrap();throw T.thrown(new st("Invalid XLIFF: "+Y.string(_)))}let i=null;if(l.nodeType!=V.Document&&l.nodeType!=V.Element)throw T.thrown("Bad node type, expected Element or Document but found "+(l.nodeType==null?"null":de.toString(l.nodeType)));let n=0,s=l.children;for(;n<s.length;){let p=s[n++],_;if(p.nodeType==0){if(p.nodeType!=V.Element)throw T.thrown("Bad node type, expected Element but found "+(p.nodeType==null?"null":de.toString(p.nodeType)));_=p.nodeName=="xliff"}else _=!1;if(_){i=p;break}}if(i==null)throw T.thrown(new st("Invalid XLIFF: missing <xliff> root element"));let r=i.exists("trgLang")?i.get("trgLang"):null,a=r!=null;if(a&&!vt.localeMatches(r,t))return"";let h=new gt,o=!0,u=i.elementsNamed("file");for(;u.hasNext();){let p=u.next();if(!a){let _=p.exists("target-language")?p.get("target-language"):null;if(_!=null&&!vt.localeMatches(_,t))continue}if(a){let _=p.elementsNamed("unit");for(;_.hasNext();){let m=_.next();if(!m.exists("id"))continue;let f=m.get("id"),g=[],d=m.elementsNamed("segment");for(;d.hasNext();){let v=d.next();g.push(v)}let x=g;if(x.length==0)continue;let y=[],S=[],C=0;for(;C<x.length;){let v=x[C];++C;let N=vt.innerText(vt.firstChildElement(v,"source")),B=vt.innerText(vt.firstChildElement(v,"target"));N!=null&&y.push(N),B!=null&&S.push(B)}let O=y.join(""),E=S.join("");E!=""&&(o||(h.b+=`
72
- `),o=!1,vt.writeEntry(h,f,O,E))}}else{let _=vt.firstChildElement(p,"body");if(_==null)continue;let m=_.elementsNamed("trans-unit");for(;m.hasNext();){let f=m.next();if(!f.exists("id"))continue;let g=f.get("id"),d=vt.innerText(vt.firstChildElement(f,"source")),x=vt.innerText(vt.firstChildElement(f,"target"));x==null||x==""||(o||(h.b+=`
73
- `),o=!1,vt.writeEntry(h,g,d??"",x))}}}return h.b}static localeMatches(e,t){if(e==t)return!0;let l=e.toLowerCase(),i=t.toLowerCase();if(l==i)return!0;let n=l.indexOf("-",null),s=n<0?l:n!=null?c.substr(l,0,n):c.substr(l,0,null),r=i.indexOf("-",null),a=r<0?i:r!=null?c.substr(i,0,r):c.substr(i,0,null);return s==a}static primarySubtag(e){let t=e.indexOf("-",null);return t<0?e:t!=null?c.substr(e,0,t):c.substr(e,0,null)}static firstChildElement(e,t){if(e.nodeType!=V.Document&&e.nodeType!=V.Element)throw T.thrown("Bad node type, expected Element or Document but found "+(e.nodeType==null?"null":de.toString(e.nodeType)));let l=0,i=e.children;for(;l<i.length;){let n=i[l++],s;if(n.nodeType==0){if(n.nodeType!=V.Element)throw T.thrown("Bad node type, expected Element but found "+(n.nodeType==null?"null":de.toString(n.nodeType)));s=n.nodeName==t}else s=!1;if(s)return n}return null}static innerText(e){if(e==null)return null;let t="";if(e.nodeType!=V.Document&&e.nodeType!=V.Element)throw T.thrown("Bad node type, expected Element or Document but found "+(e.nodeType==null?"null":de.toString(e.nodeType)));let l=0,i=e.children;for(;l<i.length;){let n=i[l++];switch(n.nodeType){case 0:t+=Y.string(vt.innerText(n));break;case 1:if(n.nodeType==V.Document||n.nodeType==V.Element)throw T.thrown("Bad node type, unexpected "+(n.nodeType==null?"null":de.toString(n.nodeType)));t+=Y.string(n.nodeValue);break;case 2:if(n.nodeType==V.Document||n.nodeType==V.Element)throw T.thrown("Bad node type, unexpected "+(n.nodeType==null?"null":de.toString(n.nodeType)));t+=Y.string(n.nodeValue);break;default:}}return t}static fromScript(e,t,l){let i=et.extractTranslatableEntries(e),n=new Wl,s="";s+=`<?xml version="1.0" encoding="UTF-8"?>
70
+ `),l=[],i=null,n=0;for(;n<t.length;){let s=t[n],r;if(s.length>0){let g=c.cca(s,s.length-1);r=(g??-1)==13}else r=!1;if(r){let g=s.length-1;s=g!=null?c.substr(s,0,g):c.substr(s,0,null)}let a=0,h=s.length;for(;a<h;){let g=c.cca(s,a),d=g??-1;if(d!=32&&d!=9)break;++a}let o;if(a==0)o=s;else{let g=null;o=g!=null?c.substr(s,a,g):c.substr(s,a,null)}if(o==""){i!=null&&(l.push(i),i=null),++n;continue}let u=c.cca(o,0);if((u??-1)==35){++n;continue}i==null&&(i=new sn);let p=bl.readKeyword(o);if(p==null){++n;continue}let _=bl.readQuotedString(o,p.length),m=_??"",f=n+1;for(;f<t.length;){let g=t[f],d;if(g.length>0){let E=c.cca(g,g.length-1);d=(E??-1)==13}else d=!1;if(d){let E=g.length-1;g=E!=null?c.substr(g,0,E):c.substr(g,0,null)}let w=0,y=g.length;for(;w<y;){let E=c.cca(g,w),v=E??-1;if(v!=32&&v!=9)break;++w}let S;if(w==0)S=g;else{let E=null;S=E!=null?c.substr(g,w,E):c.substr(g,w,null)}let T;if(S.length!=0){let E=c.cca(S,0);T=(E??-1)!=34}else T=!0;if(T)break;let O=bl.readQuotedString(S,0);O!=null&&(m+=O),++f}switch(p){case"msgctxt":i.msgctxt=m;break;case"msgid":i.msgid=m;break;case"msgstr":i.msgstr=m;break;default:p=="msgstr[0]"&&(i.msgstr=m)}n=f}return i!=null&&l.push(i),l}static readKeyword(e){let t=0,l=e.length;for(;t<l;){let i=c.cca(e,t),n=i??-1;if(n==32||n==9)break;++t}return t==0?null:t!=null?c.substr(e,0,t):c.substr(e,0,null)}static readQuotedString(e,t){let l=t,i=e.length;for(;l<i;){let r=c.cca(e,l),a=r??-1;if(a!=32&&a!=9)break;++l}let n;if(l<i){let r=c.cca(e,l);n=(r??-1)!=34}else n=!0;if(n)return null;++l;let s="";for(;l<i;){let r=c.cca(e,l),a=r??-1;if(a==92&&l+1<i){let h=c.cca(e,l+1),o=h??-1;switch(o){case 34:s+=String.fromCodePoint(34);break;case 92:s+=String.fromCodePoint(92);break;case 110:s+=String.fromCodePoint(10);break;case 114:s+=String.fromCodePoint(13);break;case 116:s+=String.fromCodePoint(9);break;default:s+=String.fromCodePoint(o)}l+=2}else{if(a==34)return s;s+=String.fromCodePoint(a),++l}}throw C.thrown(new st("Invalid PO: unterminated quoted string"))}static trimLeft(e){let t=0,l=e.length;for(;t<l;){let i=c.cca(e,t),n=i??-1;if(n!=32&&n!=9)break;++t}if(t==0)return e;{let i=null;return i!=null?c.substr(e,t,i):c.substr(e,t,null)}}static escapeLineForComment(e){return e.split(`
71
+ `).join(" ").split("\r").join("")}static escapeLineForBody(e){return e}}Q["loreline.translation.PoTranslation"]=bl,bl.__name__="loreline.translation.PoTranslation";class sn{constructor(){}}Q["loreline.translation._PoTranslation.PoEntry"]=sn,sn.__name__="loreline.translation._PoTranslation.PoEntry",Object.assign(sn.prototype,{__class__:sn});class Cl{static convert(e,t,l){switch(e){case".csv":return Ut.toLoreline(t,l);case".po":return bl.toLoreline(t,l);case".tsv":return Ut.tsvToLoreline(t,l);case".xlf":case".xliff":return vt.toLoreline(t,l);default:throw new C("Unknown translation format extension: "+e)}}static translationFormat(e,t){Cl.enabled.h[e]=t}static anyEnabled(){let e=0,t=Cl.formats;for(;e<t.length;){let l=t[e];if(++e,Cl.enabled.h[l.name]==!0)return!0}return!1}static wrap(e,t){if(!Cl.anyEnabled())return new Di(e,function(){return null});let l=null,i=null;i=function(s,r,a,h){if(a>=Cl.formats.length){r?i(s,!1,0,h):h(null);return}let o=Cl.formats[a];if(Cl.enabled.h[o.name]!=!0){i(s,r,a+1,h);return}let u=r?s+"."+t+o.ext:s+o.ext;e(u,function(p){if(p!=null)try{h(Cl.convert(o.ext,p,t))}catch(_){let m=C.caught(_).unwrap();if(m instanceof st){let f=m;l=new st('Failed to load translation file "'+u+'": '+f.message),i(s,r,a+1,h)}else throw _}else i(s,r,a+1,h)})};let n=function(s,r){e(s,function(a){if(a!=null){r(a);return}let h;if(s==null)h=!1;else{let d=s.length;if(d<4)h=!1;else{let w,y,S=c.cca(s,d-4);if((S??-1)==46){let T=c.cca(s,d-3),O=T??-1;y=O==108||O==76}else y=!1;if(y){let T=c.cca(s,d-2),O=T??-1;w=O==111||O==79}else w=!1;if(w){let T=c.cca(s,d-1),O=T??-1;h=O==114||O==82}else h=!1}}if(!h){r(null);return}let o=s.length-4,u=o!=null?c.substr(s,0,o):c.substr(s,0,null),p="."+t,_,m=u.length,f=p.length,g;if(f>m)g=!1;else{let d=m-f;g=(f!=null?c.substr(u,d,f):c.substr(u,d,null))==p}if(g){let d=u.length-p.length;_=d!=null?c.substr(u,0,d):c.substr(u,0,null)}else _=u;i(_,!0,0,r)})};return new Di(n,function(){return l})}static endsWith(e,t){let l=e.length,i=t.length;if(i>l)return!1;let n=l-i;return(i!=null?c.substr(e,n,i):c.substr(e,n,null))==t}}Q["loreline.translation.TranslationFormats"]=Cl,Cl.__name__="loreline.translation.TranslationFormats";class Di{constructor(e,t){this.handler=e,this.lastError=t}}Q["loreline.translation.WrappedFileHandler"]=Di,Di.__name__="loreline.translation.WrappedFileHandler",Object.assign(Di.prototype,{__class__:Di});class vt{static toLoreline(e,t){let l;try{l=ei.parse(e)}catch(p){let _=C.caught(p).unwrap();throw C.thrown(new st("Invalid XLIFF: "+Y.string(_)))}let i=null;if(l.nodeType!=V.Document&&l.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element or Document but found "+(l.nodeType==null?"null":de.toString(l.nodeType)));let n=0,s=l.children;for(;n<s.length;){let p=s[n++],_;if(p.nodeType==0){if(p.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element but found "+(p.nodeType==null?"null":de.toString(p.nodeType)));_=p.nodeName=="xliff"}else _=!1;if(_){i=p;break}}if(i==null)throw C.thrown(new st("Invalid XLIFF: missing <xliff> root element"));let r=i.exists("trgLang")?i.get("trgLang"):null,a=r!=null;if(a&&!vt.localeMatches(r,t))return"";let h=new gt,o=!0,u=i.elementsNamed("file");for(;u.hasNext();){let p=u.next();if(!a){let _=p.exists("target-language")?p.get("target-language"):null;if(_!=null&&!vt.localeMatches(_,t))continue}if(a){let _=p.elementsNamed("unit");for(;_.hasNext();){let m=_.next();if(!m.exists("id"))continue;let f=m.get("id"),g=[],d=m.elementsNamed("segment");for(;d.hasNext();){let v=d.next();g.push(v)}let w=g;if(w.length==0)continue;let y=[],S=[],T=0;for(;T<w.length;){let v=w[T];++T;let M=vt.innerText(vt.firstChildElement(v,"source")),A=vt.innerText(vt.firstChildElement(v,"target"));M!=null&&y.push(M),A!=null&&S.push(A)}let O=y.join(""),E=S.join("");E!=""&&(o||(h.b+=`
72
+ `),o=!1,vt.writeEntry(h,f,O,E))}}else{let _=vt.firstChildElement(p,"body");if(_==null)continue;let m=_.elementsNamed("trans-unit");for(;m.hasNext();){let f=m.next();if(!f.exists("id"))continue;let g=f.get("id"),d=vt.innerText(vt.firstChildElement(f,"source")),w=vt.innerText(vt.firstChildElement(f,"target"));w==null||w==""||(o||(h.b+=`
73
+ `),o=!1,vt.writeEntry(h,g,d??"",w))}}}return h.b}static localeMatches(e,t){if(e==t)return!0;let l=e.toLowerCase(),i=t.toLowerCase();if(l==i)return!0;let n=l.indexOf("-",null),s=n<0?l:n!=null?c.substr(l,0,n):c.substr(l,0,null),r=i.indexOf("-",null),a=r<0?i:r!=null?c.substr(i,0,r):c.substr(i,0,null);return s==a}static primarySubtag(e){let t=e.indexOf("-",null);return t<0?e:t!=null?c.substr(e,0,t):c.substr(e,0,null)}static firstChildElement(e,t){if(e.nodeType!=V.Document&&e.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element or Document but found "+(e.nodeType==null?"null":de.toString(e.nodeType)));let l=0,i=e.children;for(;l<i.length;){let n=i[l++],s;if(n.nodeType==0){if(n.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element but found "+(n.nodeType==null?"null":de.toString(n.nodeType)));s=n.nodeName==t}else s=!1;if(s)return n}return null}static innerText(e){if(e==null)return null;let t="";if(e.nodeType!=V.Document&&e.nodeType!=V.Element)throw C.thrown("Bad node type, expected Element or Document but found "+(e.nodeType==null?"null":de.toString(e.nodeType)));let l=0,i=e.children;for(;l<i.length;){let n=i[l++];switch(n.nodeType){case 0:t+=Y.string(vt.innerText(n));break;case 1:if(n.nodeType==V.Document||n.nodeType==V.Element)throw C.thrown("Bad node type, unexpected "+(n.nodeType==null?"null":de.toString(n.nodeType)));t+=Y.string(n.nodeValue);break;case 2:if(n.nodeType==V.Document||n.nodeType==V.Element)throw C.thrown("Bad node type, unexpected "+(n.nodeType==null?"null":de.toString(n.nodeType)));t+=Y.string(n.nodeValue);break;default:}}return t}static fromScript(e,t,l){let i=et.extractTranslatableEntries(e),n=new Wl,s="";s+=`<?xml version="1.0" encoding="UTF-8"?>
74
74
  `,s+=`<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
75
75
  `,s+=' <file source-language="en" target-language="',s+=Y.string(vt.escapeForXmlAttr(l)),s+=`" datatype="plaintext">
76
76
  `,s+=` <body>