loreline 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -3
- package/js/loreline.d.ts +9 -5
- package/js/loreline.js +1733 -444
- package/js/loreline.min.js +55 -55
- package/package.json +1 -1
package/js/loreline.min.js
CHANGED
|
@@ -1,89 +1,89 @@
|
|
|
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+=""":l+=String.fromCodePoint(o);break;case 38:l+="&";break;case 39:t?l+="'":l+=String.fromCodePoint(o);break;case 60:l+="<";break;case 62:l+=">";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(`
|
|
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],
|
|
3
|
-
`:case"Error:":++t;break;default:}return
|
|
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!=
|
|
1
|
+
"use strict";let pn={},Jn={};(function(Zl,fn){"use strict";Zl.loreline=Zl.loreline||{};var J={},M=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()}}J.HxOverrides=c,c.__name__="HxOverrides";class Ti{constructor(e,t){this.min=e,this.max=t}hasNext(){return this.min<this.max}next(){return this.min++}}J.IntIterator=Ti,Ti.__name__="IntIterator",Object.assign(Ti.prototype,{__class__:Ti});class mn{static exists(e,t){let l=Sn(e);for(;l.hasNext();){let i=l.next();if(t(i))return!0}return!1}}J.Lambda=mn,mn.__name__="Lambda",Math.__name__="Math";class Ae{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)}}}J.Reflect=Ae,Ae.__name__="Reflect";class Y{static string(e){return te.__string_rec(e,"")}static parseInt(e){let t=parseInt(e);return isNaN(t)?null:t}}J.Std=Y,Y.__name__="Std";class xt{constructor(){this.b=""}}J.StringBuf=xt,xt.__name__="StringBuf",Object.assign(xt.prototype,{__class__:xt});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+=""":l+=String.fromCodePoint(o);break;case 38:l+="&";break;case 39:t?l+="'":l+=String.fromCodePoint(o);break;case 60:l+="<";break;case 62:l+=">";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)}}J.StringTools=He,He.__name__="StringTools";var At=Ye.ValueType={__ename__:"ValueType",__constructs__:null,TNull:{_hx_name:"TNull",_hx_index:0,__enum__:"ValueType",toString:M},TInt:{_hx_name:"TInt",_hx_index:1,__enum__:"ValueType",toString:M},TFloat:{_hx_name:"TFloat",_hx_index:2,__enum__:"ValueType",toString:M},TBool:{_hx_name:"TBool",_hx_index:3,__enum__:"ValueType",toString:M},TObject:{_hx_name:"TObject",_hx_index:4,__enum__:"ValueType",toString:M},TFunction:{_hx_name:"TFunction",_hx_index:5,__enum__:"ValueType",toString:M},TClass:(w=function(T){return{_hx_index:6,c:T,__enum__:"ValueType",toString:M}},w._hx_name="TClass",w.__params__=["c"],w),TEnum:(w=function(T){return{_hx_index:7,e:T,__enum__:"ValueType",toString:M}},w._hx_name="TEnum",w.__params__=["e"],w),TUnknown:{_hx_name:"TUnknown",_hx_index:8,__enum__:"ValueType",toString:M}};At.__constructs__=[At.TNull,At.TInt,At.TFloat,At.TBool,At.TObject,At.TFunction,At.TClass,At.TEnum,At.TUnknown];class me{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 At.TBool;case"function":return e.__name__||e.__ename__?At.TObject:At.TFunction;case"number":return Math.ceil(e)==e%2147483648?At.TInt:At.TFloat;case"object":if(e==null)return At.TNull;let t=e.__enum__;if(t!=null)return At.TEnum(Ye[t]);let l=te.getClass(e);return l!=null?At.TClass(l):At.TObject;case"string":return At.TClass(String);case"undefined":return At.TNull;default:return At.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,!me.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[]}}J.Type=me,me.__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 U{constructor(e){this.nodeType=e,this.children=[],this.attributeMap=new Se}get(e){if(this.nodeType!=U.Element)throw b.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!=U.Element)throw b.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!=U.Element)throw b.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!=U.Element)throw b.thrown("Bad node type, expected Element but found "+(this.nodeType==null?"null":de.toString(this.nodeType)));return new vi(this.attributeMap.h)}elements(){if(this.nodeType!=U.Document&&this.nodeType!=U.Element)throw b.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==U.Element&&e.push(n)}let i=e;return new Bl(i)}elementsNamed(e){if(this.nodeType!=U.Document&&this.nodeType!=U.Element)throw b.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==U.Element){if(s.nodeType!=U.Element)throw b.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 Bl(n)}firstElement(){if(this.nodeType!=U.Document&&this.nodeType!=U.Element)throw b.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==U.Element)return l}return null}addChild(e){if(this.nodeType!=U.Document&&this.nodeType!=U.Element)throw b.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!=U.Document&&this.nodeType!=U.Element)throw b.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 ui.print(this)}static createElement(e){let t=new U(U.Element);if(t.nodeType!=U.Element)throw b.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 U(U.PCData);if(t.nodeType==U.Document||t.nodeType==U.Element)throw b.thrown("Bad node type, unexpected "+(t.nodeType==null?"null":de.toString(t.nodeType)));return t.nodeValue=e,t}static createCData(e){let t=new U(U.CData);if(t.nodeType==U.Document||t.nodeType==U.Element)throw b.thrown("Bad node type, unexpected "+(t.nodeType==null?"null":de.toString(t.nodeType)));return t.nodeValue=e,t}static createComment(e){let t=new U(U.Comment);if(t.nodeType==U.Document||t.nodeType==U.Element)throw b.thrown("Bad node type, unexpected "+(t.nodeType==null?"null":de.toString(t.nodeType)));return t.nodeValue=e,t}static createDocType(e){let t=new U(U.DocType);if(t.nodeType==U.Document||t.nodeType==U.Element)throw b.thrown("Bad node type, unexpected "+(t.nodeType==null?"null":de.toString(t.nodeType)));return t.nodeValue=e,t}static createProcessingInstruction(e){let t=new U(U.ProcessingInstruction);if(t.nodeType==U.Document||t.nodeType==U.Element)throw b.thrown("Bad node type, unexpected "+(t.nodeType==null?"null":de.toString(t.nodeType)));return t.nodeValue=e,t}static createDocument(){return new U(U.Document)}}J.Xml=U,U.__name__="Xml",Object.assign(U.prototype,{__class__:U});var Fl=Ye["haxe.StackItem"]={__ename__:"haxe.StackItem",__constructs__:null,CFunction:{_hx_name:"CFunction",_hx_index:0,__enum__:"haxe.StackItem",toString:M},Module:(w=function(T){return{_hx_index:1,m:T,__enum__:"haxe.StackItem",toString:M}},w._hx_name="Module",w.__params__=["m"],w),FilePos:(w=function(T,e,t,l){return{_hx_index:2,s:T,file:e,line:t,column:l,__enum__:"haxe.StackItem",toString:M}},w._hx_name="FilePos",w.__params__=["s","file","line","column"],w),Method:(w=function(T,e){return{_hx_index:3,classname:T,method:e,__enum__:"haxe.StackItem",toString:M}},w._hx_name="Method",w.__params__=["classname","method"],w),LocalFunction:(w=function(T){return{_hx_index:4,v:T,__enum__:"haxe.StackItem",toString:M}},w._hx_name="LocalFunction",w.__params__=["v"],w)};Fl.__constructs__=[Fl.CFunction,Fl.Module,Fl.FilePos,Fl.Method,Fl.LocalFunction];class On{static callStack(){return Ml.toHaxe(Ml.callStack())}}class vt{}J["haxe.IMap"]=vt,vt.__name__="haxe.IMap",vt.__isInterface__=!0,Object.assign(vt.prototype,{__class__:vt});class b 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 b?e:e instanceof Error?new b(e.message,null,e):new gi(e,null,e)}static thrown(e){return e instanceof b?e.get_native():e instanceof Error?e:new gi(e)}}J["haxe.Exception"]=b,b.__name__="haxe.Exception",b.__super__=Error,Object.assign(b.prototype,{__class__:b,__properties__:{get_native:"get_native",get_message:"get_message"}});class Gl{constructor(e,t){this.high=e,this.low=t}}J["haxe._Int64.___Int64"]=Gl,Gl.__name__="haxe._Int64.___Int64",Object.assign(Gl.prototype,{__class__:Gl});class Wi{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=Wi.formatOutput(e,t);typeof console<"u"&&console.log!=null&&console.log(l)}}J["haxe.Log"]=Wi,Wi.__name__="haxe.Log";class Ml{static callStack(){let e=new Error(""),t=Ml.tryHaxeStack(e);if(typeof t>"u"){try{throw e}catch{}t=e.stack}return Ml.normalize(t,2)}static toHaxe(e,t){if(t==null&&(t=0),e==null)return[];if(typeof e=="string"){let l=e.split(`
|
|
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],f=Y.parseInt(h[3]),m=Y.parseInt(h[4]);i.push(Fl.FilePos(u=="Anonymous function"?Fl.LocalFunction():u=="Global code"?null:Fl.Method(o.join("."),u),p,f,m))}else i.push(Fl.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=Ml.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,Ml.wrapCallSite!=null&&(n=Ml.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=Fl.Method(u,p)}else s=Fl.Method(null,r)}let a=n.getFileName(),h=a==null?-1:a.indexOf("file:");Ml.wrapCallSite!=null&&h>0&&(a=a.substring(h+6)),l.push(Fl.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
|
+
`:case"Error:":++t;break;default:}return Ml.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?"":Ml.skipLines(e,--t,l+1)):e.substring(l)}}J["haxe.NativeStackTrace"]=Ml,Ml.__name__="haxe.NativeStackTrace";class mi{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 mi(t);return l.run=function(){l.stop(),e()},l}}J["haxe.Timer"]=mi,mi.__name__="haxe.Timer",Object.assign(mi.prototype,{__class__:mi});class gi extends b{constructor(e,t,l){super(String(e),t,l),this.value=e}unwrap(){return this.value}}J["haxe.ValueException"]=gi,gi.__name__="haxe.ValueException",gi.__super__=b,Object.assign(gi.prototype,{__class__:gi});class di{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 Bl(e)}setLoop(e,t,l){if(l==null)return new al(null,e,t,null);let i=this.compare(e,l.key);if(i==0)return new al(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 al(e.left,e.key,e.value,new al(e.right,t,l,i)):new al(new al(e.left,e.key,e.value,e.right.left),e.right.key,e.right.value,new al(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 al(new al(e,t,l,i.left),i.key,i.value,i.right):new al(new al(e,t,l,i.left.left),i.left.key,i.left.value,new al(i.left.right,i.key,i.value,i.right))}else return new al(e,t,l,i,(n>s?n:s)+1)}compare(e,t){return Ae.compare(e,t)}}J["haxe.ds.BalancedTree"]=di,di.__name__="haxe.ds.BalancedTree",di.__interfaces__=[vt],Object.assign(di.prototype,{__class__:di});class al{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}}J["haxe.ds.TreeNode"]=al,al.__name__="haxe.ds.TreeNode",Object.assign(al.prototype,{__class__:al});class hi extends di{constructor(){super()}compare(e,t){let l=e._hx_index-t._hx_index;if(l!=0)return l;let i=me.enumParameters(e),n=me.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 Ae.isEnumValue(e)&&Ae.isEnumValue(t)?this.compare(e,t):e instanceof Array&&t instanceof Array?this.compareArgs(e,t):Ae.compare(e,t)}}J["haxe.ds.EnumValueMap"]=hi,hi.__name__="haxe.ds.EnumValueMap",hi.__interfaces__=[vt],hi.__super__=di,Object.assign(hi.prototype,{__class__:hi});class Ul{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 Bl(e)}}J["haxe.ds.IntMap"]=Ul,Ul.__name__="haxe.ds.IntMap",Ul.__interfaces__=[vt],Object.assign(Ul.prototype,{__class__:Ul});class zi{constructor(){this.length=0}add(e){let t=new Ei(e,null);this.h==null?this.h=t:this.q.next=t,this.q=t,this.length++}push(e){let t=new Ei(e,this.h);this.h=t,this.q==null&&(this.q=t),this.length++}pop(){if(this.h==null)return null;let e=this.h.item;return this.h=this.h.next,this.h==null&&(this.q=null),this.length--,e}}J["haxe.ds.List"]=zi,zi.__name__="haxe.ds.List",Object.assign(zi.prototype,{__class__:zi});class Ei{constructor(e,t){this.item=e,this.next=t}}J["haxe.ds._List.ListNode"]=Ei,Ei.__name__="haxe.ds._List.ListNode",Object.assign(Ei.prototype,{__class__:Ei});class Si{constructor(){this.h={__keys__:{}}}set(e,t){let l=e.__id__;l==null&&(l=e.__id__=fn.$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 Bl(e)}}J["haxe.ds.ObjectMap"]=Si,Si.__name__="haxe.ds.ObjectMap",Si.__interfaces__=[vt],Object.assign(Si.prototype,{__class__:Si});class Se{constructor(){this.h=Object.create(null)}get(e){return this.h[e]}set(e,t){this.h[e]=t}keys(){return new vi(this.h)}}J["haxe.ds.StringMap"]=Se,Se.__name__="haxe.ds.StringMap",Se.__interfaces__=[vt],Object.assign(Se.prototype,{__class__:Se});class vi{constructor(e){this.h=e,this.keys=Object.keys(e),this.length=this.keys.length,this.current=0}hasNext(){return this.current<this.length}next(){return this.keys[this.current++]}}J["haxe.ds._StringMap.StringMapKeyIterator"]=vi,vi.__name__="haxe.ds._StringMap.StringMapKeyIterator",Object.assign(vi.prototype,{__class__:vi});class gn{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,f=o++,m=p.charCodeAt(f);m>=55296&&m<=56319&&(m=m-55232<<10|p.charCodeAt(f+1)&1023);let _=m;_>=65536&&++o;let g=_;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("\\\\"))}}J["haxe.io.Path"]=De,De.__name__="haxe.io.Path",Object.assign(De.prototype,{__class__:De});class Bl{constructor(e){this.current=0,this.array=e}hasNext(){return this.current<this.array.length}next(){return this.array[this.current++]}}J["haxe.iterators.ArrayIterator"]=Bl,Bl.__name__="haxe.iterators.ArrayIterator",Object.assign(Bl.prototype,{__class__:Bl});var ll=Ye["haxe.rtti.CType"]={__ename__:"haxe.rtti.CType",__constructs__:null,CUnknown:{_hx_name:"CUnknown",_hx_index:0,__enum__:"haxe.rtti.CType",toString:M},CEnum:(w=function(T,e){return{_hx_index:1,name:T,params:e,__enum__:"haxe.rtti.CType",toString:M}},w._hx_name="CEnum",w.__params__=["name","params"],w),CClass:(w=function(T,e){return{_hx_index:2,name:T,params:e,__enum__:"haxe.rtti.CType",toString:M}},w._hx_name="CClass",w.__params__=["name","params"],w),CTypedef:(w=function(T,e){return{_hx_index:3,name:T,params:e,__enum__:"haxe.rtti.CType",toString:M}},w._hx_name="CTypedef",w.__params__=["name","params"],w),CFunction:(w=function(T,e){return{_hx_index:4,args:T,ret:e,__enum__:"haxe.rtti.CType",toString:M}},w._hx_name="CFunction",w.__params__=["args","ret"],w),CAnonymous:(w=function(T){return{_hx_index:5,fields:T,__enum__:"haxe.rtti.CType",toString:M}},w._hx_name="CAnonymous",w.__params__=["fields"],w),CDynamic:(w=function(T){return{_hx_index:6,t:T,__enum__:"haxe.rtti.CType",toString:M}},w._hx_name="CDynamic",w.__params__=["t"],w),CAbstract:(w=function(T,e){return{_hx_index:7,name:T,params:e,__enum__:"haxe.rtti.CType",toString:M}},w._hx_name="CAbstract",w.__params__=["name","params"],w)};ll.__constructs__=[ll.CUnknown,ll.CEnum,ll.CClass,ll.CTypedef,ll.CFunction,ll.CAnonymous,ll.CDynamic,ll.CAbstract];var jt=Ye["haxe.rtti.Rights"]={__ename__:"haxe.rtti.Rights",__constructs__:null,RNormal:{_hx_name:"RNormal",_hx_index:0,__enum__:"haxe.rtti.Rights",toString:M},RNo:{_hx_name:"RNo",_hx_index:1,__enum__:"haxe.rtti.Rights",toString:M},RCall:(w=function(T){return{_hx_index:2,m:T,__enum__:"haxe.rtti.Rights",toString:M}},w._hx_name="RCall",w.__params__=["m"],w),RMethod:{_hx_name:"RMethod",_hx_index:3,__enum__:"haxe.rtti.Rights",toString:M},RDynamic:{_hx_name:"RDynamic",_hx_index:4,__enum__:"haxe.rtti.Rights",toString:M},RInline:{_hx_name:"RInline",_hx_index:5,__enum__:"haxe.rtti.Rights",toString:M}};jt.__constructs__=[jt.RNormal,jt.RNo,jt.RCall,jt.RMethod,jt.RDynamic,jt.RInline];var Ql=Ye["haxe.rtti.TypeTree"]={__ename__:"haxe.rtti.TypeTree",__constructs__:null,TPackage:(w=function(T,e,t){return{_hx_index:0,name:T,full:e,subs:t,__enum__:"haxe.rtti.TypeTree",toString:M}},w._hx_name="TPackage",w.__params__=["name","full","subs"],w),TClassdecl:(w=function(T){return{_hx_index:1,c:T,__enum__:"haxe.rtti.TypeTree",toString:M}},w._hx_name="TClassdecl",w.__params__=["c"],w),TEnumdecl:(w=function(T){return{_hx_index:2,e:T,__enum__:"haxe.rtti.TypeTree",toString:M}},w._hx_name="TEnumdecl",w.__params__=["e"],w),TTypedecl:(w=function(T){return{_hx_index:3,t:T,__enum__:"haxe.rtti.TypeTree",toString:M}},w._hx_name="TTypedecl",w.__params__=["t"],w),TAbstractdecl:(w=function(T){return{_hx_index:4,a:T,__enum__:"haxe.rtti.TypeTree",toString:M}},w._hx_name="TAbstractdecl",w.__params__=["a"],w)};Ql.__constructs__=[Ql.TPackage,Ql.TClassdecl,Ql.TEnumdecl,Ql.TTypedecl,Ql.TAbstractdecl];class ot{static typeInfos(e){let t;switch(e._hx_index){case 0:let l=e.name,i=e.full,n=e.subs;throw b.thrown("Unexpected Package");case 1:t=e.c;break;case 2:t=e.e;break;case 3:t=e.t;break;case 4:t=e.a;break}return t}static leq(e,t,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==ll.CUnknown;case 1:let l=e.name,i=e.params;if(t._hx_index==1){let _=t.name,g=t.params;return l==_?ot.leq(ot.typeEq,i,g):!1}break;case 2:let n=e.name,s=e.params;if(t._hx_index==2){let _=t.name,g=t.params;return n==_?ot.leq(ot.typeEq,s,g):!1}break;case 3:let r=e.name,a=e.params;if(t._hx_index==3){let _=t.name,g=t.params;return r==_?ot.leq(ot.typeEq,a,g):!1}break;case 4:let h=e.args,o=e.ret;if(t._hx_index==4){let _=t.args,g=t.ret;return ot.leq(function(d,x){return d.name==x.name&&d.opt==x.opt?ot.typeEq(d.t,x.t):!1},h,_)?ot.typeEq(o,g):!1}break;case 5:let u=e.fields;if(t._hx_index==5){let _=t.fields;return ot.leq(function(g,d){return ot.fieldEq(g,d)},u,_)}break;case 6:let p=e.t;if(t._hx_index==6){let _=t.t;return p==null!=(_==null)?!1:p!=null?ot.typeEq(p,_):!0}break;case 7:let f=e.name,m=e.params;if(t._hx_index==7){let _=t.name,g=t.params;return f==_?ot.leq(ot.typeEq,m,g):!1}break}return!1}static fieldEq(e,t){return!(e.name!=t.name||!ot.typeEq(e.type,t.type)||e.isPublic!=t.isPublic||e.doc!=t.doc||!ot.rightsEq(e.get,t.get)||!ot.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&&!ot.leq(function(l,i){return l.name==i.name&&l.opt==i.opt?ot.typeEq(l.t,i.t):!1},e.args,t.args))}}J["haxe.rtti.TypeApi"]=ot,ot.__name__="haxe.rtti.TypeApi";class Ki{constructor(){this.root=[]}process(e,t){if(this.curplatform=t,e.nodeType!=U.Document&&e.nodeType!=U.Element)throw b.thrown("Invalid nodeType "+(e.nodeType==null?"null":de.toString(e.nodeType)));this.xroot(e)}mergeRights(e,t){return e.get==jt.RInline&&e.set==jt.RNo&&t.get==jt.RNormal&&t.set==jt.RMethod?(e.get=jt.RNormal,e.set=jt.RMethod,!0):me.enumEq(e.get,t.get)?me.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 ot.fieldEq(e,t)?!0:e.name==t.name&&(this.mergeRights(e,t)||this.mergeRights(t,e))&&this.mergeDoc(e,t)?ot.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,ot.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(!ot.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(!ot.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=ot.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,f=u.name,m=u.subs;if(f==a){h=!0,i=m;break}}}if(n.push(a),!h){let u=[];i.push(Ql.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,f=a.subs;h=!0}else h=!1;if(h)continue;let o=ot.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 f=a.name,m=a.full,_=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 b.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 jt.RDynamic;case"inline":return jt.RInline;case"method":return jt.RMethod;case"null":return jt.RNo;default:return jt.RCall(e)}}xerror(e){let t;if(e.nodeType==U.Document)t="Document";else{if(e.nodeType!=U.Element)throw b.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":de.toString(e.nodeType)));t=e.nodeName}throw b.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!=U.Document&&e.nodeType!=U.Element)throw b.thrown("Invalid nodeType "+(e.nodeType==null?"null":de.toString(e.nodeType)));let t=e,l;if(t.nodeType==U.Document)l="Document";else{if(t.nodeType!=U.Element)throw b.thrown("Bad node type, expected Element but found "+(t.nodeType==null?"null":de.toString(t.nodeType)));l=t.nodeName}switch(l){case"abstract":return Ql.TAbstractdecl(this.xabstract(t));case"class":return Ql.TClassdecl(this.xclass(t));case"enum":return Ql.TEnumdecl(this.xenum(t));case"typedef":return Ql.TTypedecl(this.xtypedef(t));default:return this.xerror(t)}}xmeta(e){let t=[],l=0,i=Tn.resolve(e,"m");for(;l<i.length;){let n=i[l];++l;let s=[],r=0,a=Tn.resolve(n,"e");for(;r<a.length;){let h=a[r];++r,s.push(oi.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==U.Document)p="Document";else{if(u.nodeType!=U.Element)throw b.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=oi.get_innerData(u);break;case"haxe_dynamic":let f=u.firstElement();if(f.nodeType!=U.Document&&f.nodeType!=U.Element)throw b.thrown("Invalid nodeType "+(f.nodeType==null?"null":de.toString(f.nodeType)));i=this.xtype(f);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:hl.resolve(e,"file")?Xe.resolve(e,"file"):null,path:this.mkPath(Xe.resolve(e,"path")),module:hl.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==U.Document)u="Document";else{if(o.nodeType!=U.Element)throw b.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=oi.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==U.Document)h="Document";else{if(e.nodeType!=U.Element)throw b.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:hl.resolve(e,"line")?Y.parseInt(Xe.resolve(e,"line")):null,doc:n,get:hl.resolve(e,"get")?this.mkRights(Xe.resolve(e,"get")):jt.RNormal,set:hl.resolve(e,"set")?this.mkRights(Xe.resolve(e,"set")):jt.RNormal,params:hl.resolve(e,"params")?this.mkTypeParams(Xe.resolve(e,"params")):[],platforms:this.defplat(),meta:s,overloads:r,expr:hl.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==U.Document)r="Document";else{if(s.nodeType!=U.Element)throw b.thrown("Bad node type, expected Element but found "+(s.nodeType==null?"null":de.toString(s.nodeType)));r=s.nodeName}if(r=="haxe_doc")l=oi.get_innerData(s);else{let a;if(s.nodeType==U.Document)a="Document";else{if(s.nodeType!=U.Element)throw b.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:hl.resolve(e,"file")?Xe.resolve(e,"file"):null,path:this.mkPath(Xe.resolve(e,"path")),module:hl.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=Pn.resolve(e,"meta")?this.xmeta(Cn.resolve(e,"meta")):[];if(hl.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==U.Document)s="Document";else{if(e.nodeType!=U.Element)throw b.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!=U.Document&&i.nodeType!=U.Element)throw b.thrown("Invalid nodeType "+(i.nodeType==null?"null":de.toString(i.nodeType)));r=oi.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==U.Document)o="Document";else{if(h.nodeType!=U.Element)throw b.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(),_=m.firstElement();if(_.nodeType!=U.Document&&_.nodeType!=U.Element)throw b.thrown("Invalid nodeType "+(_.nodeType==null?"null":de.toString(_.nodeType)));r.push({t:this.xtype(_),field:hl.resolve(m,"field")?Xe.resolve(m,"field"):null})}break;case"haxe_doc":t=oi.get_innerData(h);break;case"impl":l=this.xclass(Cn.resolve(h,"class"));break;case"meta":n=this.xmeta(h);break;case"this":let p=h.firstElement();if(p.nodeType!=U.Document&&p.nodeType!=U.Element)throw b.thrown("Invalid nodeType "+(p.nodeType==null?"null":de.toString(p.nodeType)));i=this.xtype(p);break;case"to":let f=h.elements();for(;f.hasNext();){let m=f.next(),_=m.firstElement();if(_.nodeType!=U.Document&&_.nodeType!=U.Element)throw b.thrown("Invalid nodeType "+(_.nodeType==null?"null":de.toString(_.nodeType)));s.push({t:this.xtype(_),field:hl.resolve(m,"field")?Xe.resolve(m,"field"):null})}break;default:this.xerror(h)}}return{file:hl.resolve(e,"file")?Xe.resolve(e,"file"):null,path:this.mkPath(Xe.resolve(e,"path")),module:hl.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==U.Document)a="Document";else{if(r.nodeType!=U.Element)throw b.thrown("Bad node type, expected Element but found "+(r.nodeType==null?"null":de.toString(r.nodeType)));a=r.nodeName}if(a=="haxe_doc")t=oi.get_innerData(r);else{let h;if(r.nodeType==U.Document)h="Document";else{if(r.nodeType!=U.Element)throw b.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 Se;return this.curplatform!=null&&(s.h[this.curplatform]=l),{file:hl.resolve(e,"file")?Xe.resolve(e,"file"):null,path:this.mkPath(Xe.resolve(e,"path")),module:hl.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==U.Document)t="Document";else{if(e.nodeType!=U.Element)throw b.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(),_=this.xclassfield(m,!0);_.platforms=[],l.push(_)}return ll.CAnonymous(l);case"c":return ll.CClass(this.mkPath(Xe.resolve(e,"path")),this.xtypeparams(e));case"d":let n=null,s=e.firstElement();if(s!=null){if(s.nodeType!=U.Document&&s.nodeType!=U.Element)throw b.thrown("Invalid nodeType "+(s.nodeType==null?"null":de.toString(s.nodeType)));n=this.xtype(s)}return ll.CDynamic(n);case"e":return ll.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=hl.resolve(e,"v")?new Bl(Xe.resolve(e,"v").split(":")):null,p=e.elements();for(;p.hasNext();){let m=p.next(),_=!1,g=h<o.length?o[h++]:null;g==null&&(g=""),g.charAt(0)=="?"&&(_=!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:_,t:this.xtype(m),value:d==""?null:d})}let f=r[r.length-1];return c.remove(r,f),ll.CFunction(r,f.t);case"t":return ll.CTypedef(this.mkPath(Xe.resolve(e,"path")),this.xtypeparams(e));case"unknown":return ll.CUnknown;case"x":return ll.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}}J["haxe.rtti.XmlParser"]=Ki,Ki.__name__="haxe.rtti.XmlParser",Object.assign(Ki.prototype,{__class__:Ki});class Cn{static resolve(e,t){let l=e.elementsNamed(t).next();if(l==null){let i;if(e.nodeType==U.Document)i="Document";else{if(e.nodeType!=U.Element)throw b.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":de.toString(e.nodeType)));i=e.nodeName}throw b.thrown(i+" is missing element "+t)}if(l.nodeType!=U.Document&&l.nodeType!=U.Element)throw b.thrown("Invalid nodeType "+(l.nodeType==null?"null":de.toString(l.nodeType)));return l}}class Xe{static resolve(e,t){if(e.nodeType==U.Document)throw b.thrown("Cannot access document attribute "+t);let l=e.get(t);if(l==null)throw e.nodeType!=U.Element?b.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":de.toString(e.nodeType))):b.thrown(e.nodeName+" is missing attribute "+t);return l}}class hl{static resolve(e,t){if(e.nodeType==U.Document)throw b.thrown("Cannot access document attribute "+t);return e.exists(t)}}class Pn{static resolve(e,t){return e.elementsNamed(t).hasNext()}}class Tn{static resolve(e,t){let l=[],i=e.elementsNamed(t);for(;i.hasNext();){let n=i.next();if(n.nodeType!=U.Document&&n.nodeType!=U.Element)throw b.thrown("Invalid nodeType "+(n.nodeType==null?"null":de.toString(n.nodeType)));l.push(n)}return l}}class oi{static get_innerData(e){if(e.nodeType!=U.Document&&e.nodeType!=U.Element)throw b.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==U.Document)n="Document";else{if(e.nodeType!=U.Element)throw b.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":de.toString(e.nodeType)));n=e.nodeName}throw b.thrown(n+" does not have data")}let i=l[t++];if(t<l.length){let n=l[t++],s;if(i.nodeType==U.PCData&&n.nodeType==U.CData){if(i.nodeType==U.Document||i.nodeType==U.Element)throw b.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==U.Document||n.nodeType==U.Element)throw b.thrown("Bad node type, unexpected "+(n.nodeType==null?"null":de.toString(n.nodeType)));return n.nodeValue}let a=l[t++],h;if(a.nodeType==U.PCData){if(a.nodeType==U.Document||a.nodeType==U.Element)throw b.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==U.Document||n.nodeType==U.Element)throw b.thrown("Bad node type, unexpected "+(n.nodeType==null?"null":de.toString(n.nodeType)));return n.nodeValue}}let r;if(e.nodeType==U.Document)r="Document";else{if(e.nodeType!=U.Element)throw b.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":de.toString(e.nodeType)));r=e.nodeName}throw b.thrown(r+" does not only have data")}if(i.nodeType!=U.PCData&&i.nodeType!=U.CData){let n;if(e.nodeType==U.Document)n="Document";else{if(e.nodeType!=U.Element)throw b.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":de.toString(e.nodeType)));n=e.nodeName}throw b.thrown(n+" does not have data")}if(i.nodeType==U.Document||i.nodeType==U.Element)throw b.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!=U.Document&&e.nodeType!=U.Element)throw b.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(ui.print(n))}return t}}oi.__properties__={get_innerHTML:"get_innerHTML",get_innerData:"get_innerData"};class Ft{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}}J["haxe.xml.XmlParserException"]=Ft,Ft.__name__="haxe.xml.XmlParserException",Object.assign(Ft.prototype,{__class__:Ft});class li{static parse(e,t){t==null&&(t=!1);let l=U.createDocument();return li.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 xt,f=1,m=-1;for(;l<e.length;){let _=e.charCodeAt(l);switch(s){case 0:switch(_){case 9:case 10:case 13:case 32:break;default:s=r;continue}break;case 1:if(_==60)s=0,r=2;else{h=l,s=13;continue}break;case 2:switch(_){case 33:if(e.charCodeAt(l+1)==91){if(l+=2,c.substr(e,l,6).toUpperCase()!="CDATA[")throw b.thrown(new Ft("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 b.thrown(new Ft("Expected <!DOCTYPE",e,l));l+=8,s=16,h=l+1}else{if(e.charCodeAt(l+1)!=45||e.charCodeAt(l+2)!=45)throw b.thrown(new Ft("Expected <!--",e,l));l+=2,s=15,h=l+1}break;case 47:if(i==null)throw b.thrown(new Ft("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(!(_>=97&&_<=122||_>=65&&_<=90||_>=48&&_<=57||_==58||_==46||_==95||_==45)){if(l==h)throw b.thrown(new Ft("Expected node name",e,l));n=U.createElement(c.substr(e,h,l-h)),i.addChild(n),++o,s=0,r=4;continue}break;case 4:switch(_){case 47:s=11;break;case 62:s=9;break;default:s=5,h=l;continue}break;case 5:if(!(_>=97&&_<=122||_>=65&&_<=90||_>=48&&_<=57||_==58||_==46||_==95||_==45)){if(h==l)throw b.thrown(new Ft("Expected attribute name",e,l));if(a=c.substr(e,h,l-h),n.exists(a))throw b.thrown(new Ft("Duplicate attribute ["+a+"]",e,l));s=0,r=6;continue}break;case 6:if(_==61)s=0,r=7;else throw b.thrown(new Ft("Expected =",e,l));break;case 7:switch(_){case 34:case 39:p=new xt,s=8,h=l+1,m=_;break;default:throw b.thrown(new Ft('Expected "',e,l))}break;case 8:switch(_){case 38:let g=l-h;p.b+=g==null?c.substr(e,h,null):c.substr(e,h,g),s=18,f=8,h=l+1;break;case 60:case 62:if(t)throw b.thrown(new Ft("Invalid unescaped "+String.fromCodePoint(_)+" in attribute value",e,l));if(_==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 xt,n.set(a,x),s=0,r=4}break;default:if(_==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 xt,n.set(a,x),s=0,r=4}}break;case 9:l=li.doParse(e,t,l,n),h=l,s=1;break;case 10:if(!(_>=97&&_<=122||_>=65&&_<=90||_>=48&&_<=57||_==58||_==46||_==95||_==45)){if(h==l)throw b.thrown(new Ft("Expected node name",e,l));let g=c.substr(e,h,l-h);if(i==null||i.nodeType!=0)throw b.thrown(new Ft("Unexpected </"+g+">, tag is not open",e,l));if(i.nodeType!=U.Element)throw b.thrown("Bad node type, expected Element but found "+(i.nodeType==null?"null":de.toString(i.nodeType)));if(g!=i.nodeName)throw i.nodeType!=U.Element?b.thrown("Bad node type, expected Element but found "+(i.nodeType==null?"null":de.toString(i.nodeType))):b.thrown(new Ft("Expected </"+i.nodeName+">",e,l));s=0,r=12;continue}break;case 11:if(_==62)s=1;else throw b.thrown(new Ft("Expected >",e,l));break;case 12:if(_==62)return o==0&&i.addChild(U.createPCData("")),l;throw b.thrown(new Ft("Expected >",e,l));case 13:if(_==60){let g=l-h;p.b+=g==null?c.substr(e,h,null):c.substr(e,h,g);let d=U.createPCData(p.b);p=new xt,i.addChild(d),++o,s=0,r=2}else if(_==38){let g=l-h;p.b+=g==null?c.substr(e,h,null):c.substr(e,h,g),s=18,f=13,h=l+1}break;case 14:if(_==63&&e.charCodeAt(l+1)==62){++l;let g=c.substr(e,h+1,l-h-2);i.addChild(U.createProcessingInstruction(g)),++o,s=1}break;case 15:_==45&&e.charCodeAt(l+1)==45&&e.charCodeAt(l+2)==62&&(i.addChild(U.createComment(c.substr(e,h,l-h))),++o,l+=2,s=1);break;case 16:_==91?++u:_==93?--u:_==62&&u==0&&(i.addChild(U.createDocType(c.substr(e,h,l-h))),++o,s=1);break;case 17:if(_==93&&e.charCodeAt(l+1)==93&&e.charCodeAt(l+2)==62){let g=U.createCData(c.substr(e,h,l-h));i.addChild(g),++o,l+=2,s=1}break;case 18:if(_==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(li.escapes.h,g))p.b+=Y.string(li.escapes.h[g]);else{if(t)throw b.thrown(new Ft("Undefined entity: "+g,e,l));p.b+=Y.string("&"+g+";")}h=l+1,s=f}else if(!(_>=97&&_<=122||_>=65&&_<=90||_>=48&&_<=57||_==58||_==46||_==95||_==45)&&_!=35){if(t)throw b.thrown(new Ft("Invalid character in entity: "+String.fromCodePoint(_),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=f}break}++l}if(s==1&&(h=l,s=13),s==13){if(i.nodeType==0)throw i.nodeType!=U.Element?b.thrown("Bad node type, expected Element but found "+(i.nodeType==null?"null":de.toString(i.nodeType))):b.thrown(new Ft("Unclosed node <"+i.nodeName+">",e,l));if(l!=h||o==0){let _=l-h;p.b+=_==null?c.substr(e,h,null):c.substr(e,h,_),i.addChild(U.createPCData(p.b)),++o}return l}if(!t&&s==18&&f==13){p.b+=String.fromCodePoint(38);let _=l-h;return p.b+=_==null?c.substr(e,h,null):c.substr(e,h,_),i.addChild(U.createPCData(p.b)),++o,l}throw b.thrown(new Ft("Unexpected end",e,l))}}J["haxe.xml.Parser"]=li,li.__name__="haxe.xml.Parser";class ui{constructor(e){this.output=new xt,this.pretty=e}writeNode(e,t){switch(e.nodeType){case 0:if(this.output.b+=Y.string(t+"<"),e.nodeType!=U.Element)throw b.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!=U.Document&&e.nodeType!=U.Element)throw b.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!=U.Element)throw b.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==
|
|
8
|
-
`)}break;case 2:if(this.output.b+=Y.string(t+"<![CDATA["),e.nodeType==
|
|
9
|
-
`);break;case 3:if(e.nodeType==
|
|
7
|
+
`);break;case 1:if(e.nodeType==U.Document||e.nodeType==U.Element)throw b.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==U.Document||e.nodeType==U.Element)throw b.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==U.Document||e.nodeType==U.Element)throw b.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==
|
|
12
|
-
`);break;case 5:if(e.nodeType==
|
|
13
|
-
`);break;case 6:if(e.nodeType!=
|
|
11
|
+
`);break;case 4:if(e.nodeType==U.Document||e.nodeType==U.Element)throw b.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==U.Document||e.nodeType==U.Element)throw b.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!=U.Document&&e.nodeType!=U.Element)throw b.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!=U.Document&&e.nodeType!=U.Element)throw b.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==U.Document||i.nodeType==U.Element)throw b.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 ui(t);return l.writeNode(e,""),l.output.b}}J["haxe.xml.Printer"]=ui,ui.__name__="haxe.xml.Printer",Object.assign(ui.prototype,{__class__:ui});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 f=[];{let m=0,_=h.__params__;for(;m<_.length;){let g=_[m];m=m+1,f.push(te.__string_rec(e[g],t))}}return p=f,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
|
|
17
|
-
`),r=!l&&t instanceof
|
|
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 Mn:return typeof e=="boolean";case Nn:return e!=null;case Fn:return typeof e=="number";case In:return typeof e=="number"?(e|0)===e:!1;case String:return typeof e=="string";default:if(e!=null){if(typeof t=="function"){if(te.__downcastCheck(e,t))return!0}else if(typeof t=="object"&&te.__isNativeObj(t)&&e instanceof t)return!0}else return!1;return t==Bn&&e.__name__!=null||t==Ln&&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 b.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 fn[e]}}J["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 Bl(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}}J["loreline.Arrays"]=oe,oe.__name__="loreline.Arrays";class et{static addQuotes(e){e.each(function(t,l){if(t instanceof Bt){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 Bt){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,f=et.quotedRawToUnquotedRaw(p);i.parts[o].partType=ze.Raw(f)}}}}}})}static toBraceStyle(e){e.each(function(t,l){if(t instanceof Yt)te.__cast(t,Yt).style=1;else if(t instanceof Jt)te.__cast(t,Jt).style=1;else if(t instanceof Be)te.__cast(t,Be).style=1;else if(t instanceof wl)te.__cast(t,wl).style=1;else if(t instanceof Ot)te.__cast(t,Ot).style=1;else if(t instanceof ol)te.__cast(t,ol).style=1;else if(t instanceof Ke){let i=t,n=i.literalType;if(n._hx_index==4){let s=n.style;i.literalType=je.Object(1)}}})}static toPlainStyle(e){e.each(function(t,l){if(t instanceof Yt)te.__cast(t,Yt).style=0;else if(t instanceof Jt)te.__cast(t,Jt).style=0;else if(t instanceof Be)te.__cast(t,Be).style=0;else if(t instanceof wl)te.__cast(t,wl).style=0;else if(t instanceof Ot)te.__cast(t,Ot).style=0;else if(t instanceof ol)te.__cast(t,ol).style=0;else if(t instanceof Ke){let i=t,n=i.literalType;if(n._hx_index==4){let s=n.style;i.literalType=je.Object(0)}}})}static useWordOperators(e){e.each(function(t,l){if(t instanceof nl){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 nl){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 kl?te.__cast(t,kl).conditionStyle=2:t instanceof Ot&&(te.__cast(t,Ot).conditionStyle=2)})}static usePlainConditions(e){e.each(function(t,l){t instanceof kl?te.__cast(t,kl).conditionStyle=0:t instanceof Ot&&(te.__cast(t,Ot).conditionStyle=0)})}static reindentFunctions(e,t,l){e.each(function(i,n){if(i instanceof jl){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 yi);let s=e.split(`
|
|
17
|
+
`),r=!l&&t instanceof sl?(w=te.__cast(t,sl),Te(w,w.eachExcludingImported)):Te(t,t.each),a=i??new Se;r(function(p,f){if(p instanceof Fe){let m=p;if(m.trailingComments!=null){let _=0,g=m.trailingComments;for(;_<g.length;){let d=g[_];++_,d.isHash&&(a.h[d.content]=!0)}}if(m.leadingComments!=null){let _=0,g=m.leadingComments;for(;_<g.length;){let d=g[_];++_,d.isHash&&(a.h[d.content]=!0)}}}});let h=[];if(r(function(p,f){let m=null;if(p instanceof il?m=te.__cast(p,il).content:p instanceof Ht?m=te.__cast(p,Ht).content:p instanceof Ot&&(m=te.__cast(p,Ot).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,f){return f.offset-p.offset});let o=e,u=0;for(;u<h.length;){let p=h[u];++u;let f=p.offset,m=p.offset,_=null;o=(f!=null?c.substr(o,0,f):c.substr(o,0,null))+p.text+(_!=null?c.substr(o,m,_):c.substr(o,m,null))}return o}static removeLocalizationKeys(e,t){let l=[];if(t.each(function(s,r){if(s instanceof Fe){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 f=p.pos.offset,m=p.pos.offset+p.pos.length;for(;f>0;){let _=c.cca(e,f-1),g=_??-1;if(g==32||g==9)--f;else break}l.push({start:f,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 f=p.pos.offset,m=p.pos.offset+p.pos.length;for(;f>0;){let _=c.cca(e,f-1),g=_??-1;if(g==32||g==9)--f;else break}l.push({start:f,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 Se;return e.each(function(l,i){let n=null,s=null;if(l instanceof il?(s=l,n=te.__cast(l,il).content):l instanceof Ht&&(s=l,n=te.__cast(l,Ht).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 il)n=l,s=te.__cast(l,il).content;else if(l instanceof Ht)n=l,s=te.__cast(l,Ht).content;else if(l instanceof Ot){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 il)n=l,s=te.__cast(l,il).content;else if(l instanceof Ht)n=l,s=te.__cast(l,Ht).content;else if(l instanceof Ot){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 Se),e==null)return t;let i=new Ct(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+=`
|
|
21
21
|
`}return n}static unquotedRawToQuotedRaw(e){let t="",l=0;for(;l<e.length;){let i=c.cca(e,l);if(i==92&&l+1<e.length){let n=c.cca(e,l+1);n==110||n==116||n==114||n==92||n==60?(t+=String.fromCodePoint(i),t+=String.fromCodePoint(n),l+=2):(t+=String.fromCodePoint(n),l+=2)}else i==34?(t+='\\"',++l):(t+=String.fromCodePoint(i),++l)}return t}static quotedRawToUnquotedRaw(e){let t="",l=0;for(;l<e.length;){let i=c.cca(e,l);if(i==92&&l+1<e.length){let n=c.cca(e,l+1);n==34?(t+=String.fromCodePoint(n),l+=2):(t+=String.fromCodePoint(i),t+=String.fromCodePoint(n),l+=2)}else t+=String.fromCodePoint(i),++l}return t}static canSafelyRemoveQuotes(e){if(e.length==0||e.indexOf(`
|
|
22
22
|
`)!=-1||e.indexOf("{")!=-1)return!1;let t=c.cca(e,0);if(t==40||t==91||t==123||t==125||t==93||t==58||t==61)return!1;if(e.length>=2&&t==47){let s=c.cca(e,1);if(s==47||s==42)return!1}if(e.length>=2&&t==45&&c.cca(e,1)==62||t==43&&e.length>=3&&c.cca(e,1)==32)return!1;let l=["beat ","state ","character ","choice ","import ","new ","function ","if ","else "],i=0;for(;i<l.length;){let s=l[i];if(++i,e.startsWith(s))return!1}let n=e.indexOf(":");if(n>0){let s=!0,r=0,a=n;for(;r<a;){let h=r++,o=c.cca(e,h);if(!(o>=97&&o<=122||o>=65&&o<=90||o>=48&&o<=57||o==95)){s=!1;break}}if(s)return!1}return!(e=="null"||e=="true"||e=="false"||et.isNumberLiteral(e)||e.length>=2&&c.cca(e,1)==61&&(t==43||t==45||t==42||t==47))}static isNumberLiteral(e){if(e.length==0)return!1;let t=0;if(c.cca(e,0)==45&&++t,t>=e.length)return!1;let l=!1,i=!1;for(;t<e.length;){let n=c.cca(e,t);if(n>=48&&n<=57)l=!0;else if(n==46&&!i)i=!0;else return!1;++t}return l}static reindentCode(e,t,l){if(t==l)return e;let i=e.split(`
|
|
23
23
|
`),n="",s=0,r=i.length;for(;s<r;){let a=s++;a>0&&(n+=`
|
|
24
|
-
`);let h=i[a],o=0,u=0;for(;c.substr(h,u,null).startsWith(t);)++o,u+=t.length;let p=0,
|
|
25
|
-
//<END>`,this.input=e,this.index=0,this.output=new
|
|
26
|
-
`}toLorelinePos(e,t,l){let i=this.inputPosFromProcessedPos(t),s=this.inputPosFromProcessedPos(l)+1-i;return e.withOffset(this.
|
|
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(`
|
|
24
|
+
`);let h=i[a],o=0,u=0;for(;c.substr(h,u,null).startsWith(t);)++o,u+=t.length;let p=0,f=o;for(;p<f;){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}}J["loreline.AstUtils"]=Zl.loreline.AstUtils=et,et.__name__="loreline.AstUtils";class ci{constructor(e){this.func=e}}J["loreline.Async"]=Zl.loreline.Async=ci,ci.__name__="loreline.Async",Object.assign(ci.prototype,{__class__:ci});class xi{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 ii{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.inputText=null,this.input=null,this.index=0}process(e){return e=He.rtrim(e)+`
|
|
25
|
+
//<END>`,this.inputText=e,this.input=e,this.index=0,this.output=new xt,this.lineOutput=new xt,this.length=e.length,this.indent=0,this.inComment=!1,this.inString=!1,this.posOffsets=[],this.currentPosOffset=0,this.inControl=!1,this.inControlWithoutParens=!1,this.indentStack=[],this.indentLevel=0,this.stack=[],this.processInput(),He.rtrim(this.output.b)+`
|
|
26
|
+
`}toLorelinePos(e,t,l){let i=this.inputPosFromProcessedPos(t),s=this.inputPosFromProcessedPos(l)+1-i;return e.withOffset(this.inputText,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=ii.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 xt,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:1070,className:"loreline.CodeToLorscript",methodName:"_add"})&&!this.endsOrFollowsWithChar(l,91,this.index,{fileName:"src/loreline/CodeToLorscript.hx",lineNumber:1070,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:1099,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:1124,className:"loreline.CodeToLorscript",methodName:"_add"})&&!this.endsOrFollowsWithChar(l,44,this.index,{fileName:"src/loreline/CodeToLorscript.hx",lineNumber:1124,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 b.thrown(new st(e,ue.fromContentAndIndex(this.inputText,this.index)))}}J["loreline.CodeToLorscript"]=ii,ii.__name__="loreline.CodeToLorscript",Object.assign(ii.prototype,{__class__:ii});class vl{static equal(e,t,l){return t==l?!0:t==null||l==null?!1:oe.isArray(t)?oe.isArray(l)?vl.arrayEqual(e,t,l):!1:t instanceof Se?l instanceof Se?vl.stringMapEqual(e,t,l):!1:t instanceof Ul?l instanceof Ul?vl.intMapEqual(e,t,l):!1:re.isFields(t)&&re.isFields(l)?vl.objectFieldsEqual(e,t,l):!1}static objectFieldsEqual(e,t,l){let i=0,n=re.getFields(e,t);for(;i<n.length;){let a=n[i];if(++i,!re.fieldExists(e,l,a)||!vl.equal(e,re.getField(e,t,a),re.getField(e,l,a)))return!1}let s=0,r=re.getFields(e,l);for(;s<r.length;){let a=r[s];if(++s,!re.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(!vl.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++],_=m,g=n[m],d=_,x=g;if(!Object.prototype.hasOwnProperty.call(l.h,d)||!vl.equal(e,l.h[d],x))return!1}let h=l.h,o=h,u=Object.keys(h),p=u.length,f=0;for(;f<p;){let m=u[f++];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)||!vl.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}}J["loreline.Equal"]=vl,vl.__name__="loreline.Equal";class st{constructor(e,t){this.message=e,this.pos=t,this.stack=On.callStack()}toString(){return this.pos!=null?""+this.message+" at "+this.pos.toString():this.message}}J["loreline.Error"]=st,st.__name__="loreline.Error",Object.assign(st.prototype,{__class__:st});class Ll{}J["loreline.Fields"]=Zl.loreline.Fields=Ll,Ll.__name__="loreline.Fields",Ll.__isInterface__=!0,Object.assign(Ll.prototype,{__class__:Ll});class ji{constructor(e){this._random=null,this.interpreter=e}bindAll(e){e.h.floor=Te(this,this.floor),e.h.ceil=Te(this,this.ceil),e.h.round=Te(this,this.round),e.h.abs=Te(this,this.abs),e.h.min=Te(this,this.min),e.h.max=Te(this,this.max),e.h.clamp=Te(this,this.clamp),e.h.pow=Te(this,this.pow),e.h.random=Te(this,this.random),e.h.chance=Te(this,this.chance),e.h.seed_random=Te(this,this.seed_random),e.h.random_float=Te(this,this.random_float),e.h.wait=Te(this,this.wait),e.h.float=Te(this,this.float_),e.h.string=Te(this,this.string_),e.h.bool=Te(this,this.bool),e.h.string_length=Te(this,this.string_length),e.h.string_upper=Te(this,this.string_upper),e.h.string_lower=Te(this,this.string_lower),e.h.string_contains=Te(this,this.string_contains),e.h.string_replace=Te(this,this.string_replace),e.h.string_split=Te(this,this.string_split),e.h.string_trim=Te(this,this.string_trim),e.h.string_index=Te(this,this.string_index),e.h.string_sub=Te(this,this.string_sub),e.h.string_starts=Te(this,this.string_starts),e.h.string_ends=Te(this,this.string_ends),e.h.string_repeat=Te(this,this.string_repeat),e.h.plural=Te(this,this.plural),e.h.array_length=Te(this,this.array_length),e.h.array_add=Te(this,this.array_add),e.h.array_pop=Te(this,this.array_pop),e.h.array_prepend=Te(this,this.array_prepend),e.h.array_shift=Te(this,this.array_shift),e.h.array_remove=Te(this,this.array_remove),e.h.array_index=Te(this,this.array_index),e.h.array_has=Te(this,this.array_has),e.h.array_sort=Te(this,this.array_sort),e.h.array_reverse=Te(this,this.array_reverse),e.h.array_join=Te(this,this.array_join),e.h.array_pick=Te(this,this.array_pick),e.h.array_shuffle=Te(this,this.array_shuffle),e.h.array_copy=Te(this,this.array_copy),e.h.map_length=Te(this,this.map_length),e.h.map_keys=Te(this,this.map_keys),e.h.map_has=Te(this,this.map_has),e.h.map_get=Te(this,this.map_get),e.h.map_set=Te(this,this.map_set),e.h.map_remove=Te(this,this.map_remove),e.h.map_copy=Te(this,this.map_copy),e.h.current_beat=Te(this,this.current_beat),e.h.has_beat=Te(this,this.has_beat),e.h.beat_visits=Te(this,this.beat_visits),e.h.choices=Te(this,this.choices),e.h.choices_disabled=Te(this,this.choices_disabled),e.h.choices_all=Te(this,this.choices_all)}rng(){this._random==null&&(this._random=new yi);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 yi(e),null}random_float(e,t){return e+this.rng()*(t-e)}wait(e){return new ci(function(t){mi.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:oe.isArray(e)?oe.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 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 re.getFields(this.interpreter,e).length}map_keys(e){let t=re.getFields(this.interpreter,e);return t.sort(function(l,i){return l<i?-1:l>i?1:0}),t}map_has(e,t){return re.fieldExists(this.interpreter,e,t)}map_get(e,t){return re.getField(this.interpreter,e,t)}map_set(e,t,l){return re.setField(this.interpreter,e,t,l),null}map_remove(e,t){return re.fieldExists(this.interpreter,e,t)?re.removeField(this.interpreter,e,t):!1}map_copy(e){let t=re.getFields(this.interpreter,e),l=re.createFields(this.interpreter),i=0;for(;i<t.length;){let n=t[i];++i,re.setField(this.interpreter,l,n,re.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(bt.beatOf(e)!=null)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 Be&&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(bt.beatOf(e)!=null)return this.interpreter.getBeatVisitCount(bt.beatOf(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}}J["loreline.Functions"]=ji,ji.__name__="loreline.Functions",Object.assign(ji.prototype,{__class__:ji});class Ji{constructor(e){this.finished=e}}J["loreline._Imports.ImportsLoopInfo"]=Ji,Ji.__name__="loreline._Imports.ImportsLoopInfo",Object.assign(Ji.prototype,{__class__:Ji});class Hi{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,f,m,_,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;_=S==114||S==82}else _=!1;if(_){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;f=S==116||S==84}else f=!1;if(f){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 Se,a=[],h=new Se,o=De.directory(e);this.extractImports(o,t,a,h),this.processImports(a,h,r)}processImports(e,t,l){let i=new Ji(!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 Ct(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=b.caught(a).unwrap();if(s.hasErrors=!0,h instanceof st)s.handleError(h);else throw b.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,f;if(u==null)f=!1;else{let m=u.length;if(m<8)f=!1;else{let _,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;_=E==120||E==88}else _=!1;if(_){let O=c.cca(u,m-1),E=O??-1;f=E==116||E==84}else f=!1}}if(f)p=!0;else if(u==null)p=!1;else{let m=u.length;if(m<4)p=!1;else{let _,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;_=y==111||y==79}else _=!1;if(_){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),f=p??-1;o=f==108||f==76}else o=!1;if(o){let p=c.cca(e,i-6),f=p??-1;h=f==111||f==79}else h=!1;if(h){let p=c.cca(e,i-5),f=p??-1;a=f==114||f==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),f=p??-1;s=f==116||f==84}else s=!1;if(s){let p=c.cca(e,i-2),f=p??-1;n=f==120||f==88}else n=!1;if(n){let p=c.cca(e,i-1),f=p??-1;t=f==116||f==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}}J["loreline.Imports"]=Hi,Hi.__name__="loreline.Imports",Object.assign(Hi.prototype,{__class__:Hi});class Ol{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 Ol,t=this._keys1,l=new Array(t.length);gn.blit(t,0,l,0,t.length),e._keys1=l;let i=this._keys2,n=new Array(i.length);gn.blit(i,0,n,0,i.length),e._keys2=n;let s=this._values,r=new Array(s.length);return gn.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 f=u++;o[f]!=null&&this._set(a[f],h[f],o[f])}}}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 Gi(this)}keyIterator(){return new Qi(this)}keyValueIterator(){return new $i(this)}length(){return this.size}}J["loreline.Int64Map"]=Ol,Ol.__name__="loreline.Int64Map",Object.assign(Ol.prototype,{__class__:Ol});class Gi{constructor(e){for(this.map=e,this.index=0;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++}skipNulls(){for(;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++}hasNext(){return this.index<this.map._values.length}next(){let e=this.map._values[this.index];for(this.index++;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++;return e}}J["loreline._Int64Map.Int64MapIterator"]=Gi,Gi.__name__="loreline._Int64Map.Int64MapIterator",Object.assign(Gi.prototype,{__class__:Gi});class Qi{constructor(e){for(this.map=e,this.index=0;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++}skipNulls(){for(;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++}hasNext(){return this.index<this.map._values.length}next(){let e=this.map._keys1[this.index],t=this.map._keys2[this.index];for(this.index++;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++;return{high:e,low:t}}}J["loreline._Int64Map.Int64MapKeyIterator"]=Qi,Qi.__name__="loreline._Int64Map.Int64MapKeyIterator",Object.assign(Qi.prototype,{__class__:Qi});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._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}}}J["loreline._Int64Map.Int64MapKeyValueIterator"]=$i,$i.__name__="loreline._Int64Map.Int64MapKeyValueIterator",Object.assign($i.prototype,{__class__:$i});class Pl{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=re.createFields(e,null,t)}createOriginalFields(){this.originalFields=re.createFields()}}J["loreline.RuntimeState"]=Pl,Pl.__name__="loreline.RuntimeState",Object.assign(Pl.prototype,{__class__:Pl});class wi extends Pl{constructor(e,t,l,i){super(e,t,l,i)}}J["loreline.RuntimeCharacter"]=wi,wi.__name__="loreline.RuntimeCharacter",wi.__super__=Pl,Object.assign(wi.prototype,{__class__:wi});var _l=Ye["loreline.RuntimeAccess"]={__ename__:"loreline.RuntimeAccess",__constructs__:null,FieldAccess:(w=function(T,e,t){return{_hx_index:0,pos:T,obj:e,name:t,__enum__:"loreline.RuntimeAccess",toString:M}},w._hx_name="FieldAccess",w.__params__=["pos","obj","name"],w),ArrayAccess:(w=function(T,e,t){return{_hx_index:1,pos:T,array:e,index:t,__enum__:"loreline.RuntimeAccess",toString:M}},w._hx_name="ArrayAccess",w.__params__=["pos","array","index"],w),CharacterAccess:(w=function(T,e){return{_hx_index:2,pos:T,name:e,__enum__:"loreline.RuntimeAccess",toString:M}},w._hx_name="CharacterAccess",w.__params__=["pos","name"],w),FunctionAccess:(w=function(T,e){return{_hx_index:3,pos:T,name:e,__enum__:"loreline.RuntimeAccess",toString:M}},w._hx_name="FunctionAccess",w.__params__=["pos","name"],w),BeatAccess:(w=function(T,e){return{_hx_index:4,pos:T,ref:e,__enum__:"loreline.RuntimeAccess",toString:M}},w._hx_name="BeatAccess",w.__params__=["pos","ref"],w)};_l.__constructs__=[_l.FieldAccess,_l.ArrayAccess,_l.CharacterAccess,_l.FunctionAccess,_l.BeatAccess];class ki{constructor(e,t,l,i,n,s,r,a){this.captured=null,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),a!=null&&(this.captured=a)}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}}J["loreline.RuntimeScope"]=ki,ki.__name__="loreline.RuntimeScope",Object.assign(ki.prototype,{__class__:ki});class bt{constructor(e,t){this.beat=e,this.stack=t}static beatOf(e){return e instanceof Be?e:e instanceof bt?e.beat:null}static beatNameOf(e){let t=bt.beatOf(e);return t!=null?t.name:null}}J["loreline.RuntimeBeatRef"]=Zl.loreline.RuntimeBeatRef=bt,bt.__name__="loreline.RuntimeBeatRef",Object.assign(bt.prototype,{__class__:bt});class Oi{constructor(e,t){this.parentNextOptionIndex=0,this.parentPartialOptions=null,this.stack=[],this.options=null,this.id=e,this.origin=t}}J["loreline.RuntimeInsertion"]=Oi,Oi.__name__="loreline.RuntimeInsertion",Object.assign(Oi.prototype,{__class__:Oi});class Pi{constructor(e,t,l){this.closing=e,this.value=t,this.offset=l}}J["loreline.TextTag"]=Pi,Pi.__name__="loreline.TextTag",Object.assign(Pi.prototype,{__class__:Pi});class Ii{constructor(e,t,l,i,n){this.text=e,this.tags=t,this.enabled=l,this.node=i,this.insertion=n}}J["loreline.ChoiceOption"]=Ii,Ii.__name__="loreline.ChoiceOption",Object.assign(Ii.prototype,{__class__:Ii});class fe extends st{constructor(e,t){super(e,t)}}J["loreline.RuntimeError"]=fe,fe.__name__="loreline.RuntimeError",fe.__super__=st,Object.assign(fe.prototype,{__class__:fe});class Yi{constructor(){this.cb=null,this.sync=!0}}J["loreline.EvalNext"]=Yi,Yi.__name__="loreline.EvalNext",Object.assign(Yi.prototype,{__class__:Yi});class Ni{constructor(e,t,l,i,n){this._restoreInsertionsCache=null,this._restoreSavedInsertions=null,this._serializingScopes=[],this._saveInsertions=null,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 Se,this.mapHelpers=new Se,this.arrayHelpers=new Se,this.stringHelpers=new Se,this.topLevelFunctions=new Se,this.nodeStates=new ni,this.topLevelBeats=new Se,this.topLevelCharacters=new Se,this.script=e,this.handleDialogue=t,this.handleChoice=l,this.handleFinish=i,this.lens=new Fi(e);let s=n!=null?n.strictAccess:null;this.strictAccess=s!=null&&s,this.translations=n!=null?n.translations:null,this.topLevelState=new Pl(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 Be:this.initializeTopLevelBeat(a);break;case Jt:this.initializeTopLevelCharacter(a);break;case jl:this.initializeTopLevelFunction(a);break;case Yt:this.initializeTopLevelState(a);break;default:}}this.inferImplicitCharactersFromRootBeat()}get_currentScope(){return this.stack.length>0?this.stack[this.stack.length-1]:null}get_currentInsertion(){return this.insertionAtOrBelow(this.stack.length-1)}insertionAtOrBelow(e){let t=e;for(;t>=0;){let l=this.stack[t];if(l.insertion!=null)return l.insertion;--t}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(Be);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)&&(re.fieldExists(this,this.topLevelState.fields,s)||this.initializeTopLevelCharacter(new Jt(Re.UNDEFINED,l.pos,s,l.pos,[])))}}}start(e){let t=null;if(e!=null){if(t=this.topLevelBeats.h[e],t==null)throw b.thrown(new fe("Beat "+e+" not found",this.script.pos))}else{let l=0,i=this.script.body;for(;l<i.length;){let n=i[l];if(++l,n instanceof Be){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 Be){let r=s;if(r.name=="_"){t=r;break}t==null&&(t=r)}}}if(t==null)throw b.thrown(new fe("No beats found in script",this.script.pos))}this.transitionToBeat(t),this.flush()}save(){let e={};this._saveInsertions=e;let 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 Ae.fields(e).length>0&&(n.insertions=e),this._saveInsertions=null,n}restore(e){if(e.version!=1)throw b.thrown(new fe("Unsupported save version: "+e.version,this.script.pos));this.stack.length=0,this.nodeStates.map.clear(),this.nextScopeId=1,this.nextInsertionId=1,this.pendingChoiceOptions=null,this._choiceEvalTexts.length=0,this._choiceEvalEnabled.length=0;let t=new Ul;if(this._restoreSavedInsertions=e.insertions,this._restoreInsertionsCache=t,this.restoreState(this.topLevelState,e.state),this.restoreCharacters(e.characters),this.restoreNodeStates(e.nodeStates),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)}}this._restoreSavedInsertions=null,this._restoreInsertionsCache=null}resume(){if(this.stack.length==0){this.start();return}let e=this.wrapNext(Te(this,this.finish));this.finishTrigger=e,this.resumeNode(this.stack[0].node,0,e.cb),e.sync=!1,this.flush()}resumeFromLevel(e,t){let 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?re.getField(this,i,t):null}setCharacterField(e,t,l){let i=this.topLevelCharacters.h[e].fields;re.setField(this,i,t,l)}eachResolutionScope(e,t){this.walkResolutionScopes(this.stack,e==-1?this.stack.length-1:e,t)}walkResolutionScopes(e,t,l){let i=t;for(;i>=0;){let n=e[i];if(l(n))return;if(n.captured!=null){this.walkResolutionScopes(n.captured,n.captured.length-1,l);return}--i}}getStateField(e){let t=!1,l=null,i=this;return this.eachResolutionScope(-1,function(n){if(n.state!=null&&re.fieldExists(i,n.state.fields,e))return l=re.getField(i,n.state.fields,e),t=!0,!0;if(n.node!=null){let s=n.node.id.thisVal,r=i.nodeStates.map._get(s.high,s.low);if(r!=null&&re.fieldExists(i,r.fields,e))return l=re.getField(i,r.fields,e),t=!0,!0}return!1}),t?l:re.fieldExists(this,this.topLevelState.fields,e)?re.getField(this,this.topLevelState.fields,e):null}setStateField(e,t){let l=!1,i=this;this.eachResolutionScope(-1,function(n){if(n.state!=null&&re.fieldExists(i,n.state.fields,e))return re.setField(i,n.state.fields,e,t),l=!0,!0;if(n.node!=null){let s=n.node.id.thisVal,r=i.nodeStates.map._get(s.high,s.low);if(r!=null&&re.fieldExists(i,r.fields,e))return re.setField(i,r.fields,e,t),l=!0,!0}return!1}),!l&&re.setField(this,this.topLevelState.fields,e,t)}getTopLevelStateField(e){return re.getField(this,this.topLevelState.fields,e)}setTopLevelStateField(e,t){re.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(this._serializingScopes.push(e),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}if(e.head!=null&&(l.head=this.serializeNodeReference(e.head)),e.insertion!=null&&(l.insertion=this.serializeInsertion(e.insertion,t)),e.captured!=null){let i=[],n=0,s=e.captured;for(;n<s.length;){let r=s[n];++n,i.push(this.serializeScope(r,t))}l.captured=i}return this._serializingScopes.pop(),l}serializeInsertion(e,t){let l=e.id==null?"null":""+e.id,i=Ae.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);Ae.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=Re.fromTwoInt32(i,n),a=s,h=r,o=a,u=this.serializeState(o);Ae.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,Be),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,Ll)){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 Se){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||!re.fieldExists(this,t,u)||!vl.equal(this,re.getField(this,t,u),p))&&(i[u]=this.serializeValue(p))}}else if(te.getClass(e)==null){let n=0,s=Ae.fields(e);for(;n<s.length;){let r=s[n];++n;let a=Ae.field(e,r);(t==null||!re.fieldExists(this,t,r)||!vl.equal(this,re.getField(this,t,r),a))&&(i[r]=this.serializeValue(a))}}else{let n=te.getClass(e);n!=null&&(l=n.__name__);let s=0,r=Ae.fields(e);for(;s<r.length;){let a=r[s];++s;let h=Ae.getProperty(e,a);(t==null||!re.fieldExists(this,t,a)||!vl.equal(this,re.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 l=[],i=oe.arrayLength(e),n=0,s=i;for(;n<s;){let r=n++;l.push(this.serializeValue(oe.arrayGet(e,r)))}return l}let t=bt.beatOf(e);if(t!=null){let l={type:"$beatRef",beat:this.serializeBeatReference(t)};if(e instanceof bt){let i=e;if(i.stack.length>0){let n=!1,s=0,r=i.stack;for(;s<r.length;){let a=r[s];if(++s,this._serializingScopes.indexOf(a)!=-1){n=!0;break}}if(!n){let a=this._saveInsertions!=null?this._saveInsertions:{},h=[],o=0,u=i.stack;for(;o<u.length;){let p=u[o];++o,h.push(this.serializeScope(p,a))}l.stack=h}}}return l}return this.serializeFields(e)}resumeNode(e,t,l){let i=this.stack.length-1;if(t>=this.stack.length)switch(te.getClass(e)){case $l:this.evalAlternative(e,l);break;case Kl:this.evalBeatCall(e,l);break;case Vt:if(!this.isBeatCall(e))this.evalCall(e,l);else{let r=te.getClass(e);throw b.thrown(new fe("Resume execution not supported from last node: "+r.__name__,e.pos))}break;case wl:this.evalChoice(e,l);break;case Ht:this.evalDialogue(e,l);break;case il:this.evalText(e,l);break;default:let s=te.getClass(e);throw b.thrown(new fe("Resume execution not supported from last node: "+s.__name__,e.pos))}else switch(te.getClass(e)){case $l:this.resumeAlternative(e,t,l);break;case Kl:this.resumeBeatCall(e,t,l);break;case Be:this.resumeBeatRun(e,t,l);break;case Vt:if(this.isBeatCall(e,t))this.resumeCall(e,t,l);else{let r=te.getClass(e);throw b.thrown(new fe("Resume execution not supported from node within stack: "+r.__name__,e.pos))}break;case Ot:this.resumeChoiceOption(e,t,l);break;case wl:this.resumeChoice(e,t,l);break;case kl:this.resumeIf(e,t,l);break;default:let s=te.getClass(e);throw b.thrown(new fe("Resume execution not supported from node within stack: "+s.__name__,e.pos))}}resumeNodeBody(e,t,l,i){let n=this.stack[t],s=0,r=-1;if(n.head==null&&t<this.stack.length-1)throw b.thrown(new fe("Cannot resume through a body with a no-headed scope that is not at the bottom of the stack",e.pos));if(n.head!=null&&(s=l.indexOf(n.head),r=s,s==-1))throw b.thrown(new fe("Failed to resolve head in scope when resuming through body",e.pos));let a=this.insertionAtOrBelow(t),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 Ot){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,null,null,l)}else if(i.insertion!=null){let s=i.node,r=i.insertion;if(s instanceof Be){let a=s,h=!0,o=0,u=t;for(;o<u;){let p=o++;if(this.stack[p].insertion!=null){h=!1;break}}this.resumeNodeBody(a,t,a.body,function(){let p=r.parentPartialOptions!=null?r.parentPartialOptions:[];if(r.options!=null){let g=0,d=r.options;for(;g<d.length;){let x=d[g];++g,p.push(x)}}let f=r.parentNextOptionIndex,m=i.beat,_=n.wrapNext(function(){n.presentChoice(e,p,l)});n.evalChoiceOptionsAndInsertions(m,e,p,_.cb,f,h),_.sync=!1})}else{for(;this.stack.length>t;)this.pop();this.evalChoice(e,l)}}else if(i.node instanceof Ot){let s=i.node;this.resumeNodeBody(s,t,s.body,l)}else if(i.node instanceof Be){let s=i.node;this.resumeNodeBody(s,t,s.body,l)}else throw b.thrown(new fe("Choice head is not a choice option",i.head.pos))}resumeIf(e,t,l){let i=this.stack[t];if(i.head==null)throw b.thrown(new fe("Failed to resolve head in scope when resuming through condition",e.pos));let s=e.thenBranch.body.indexOf(i.head)!=-1?e.thenBranch:e.elseBranch;if(s!=null&&s.body.length>0)this.resumeNodeBody(s,t,s.body,l);else throw b.thrown(new fe("Failed to resume condition: invalid scope",e.pos))}resumeAlternative(e,t,l){let i=this.stack[t];if(i.head==null)throw b.thrown(new fe("Failed to resolve head when resuming alternative",e.pos));let n=0,s=e.items;for(;n<s.length;){let r=s[n];if(++n,r.body.indexOf(i.head)!=-1){this.resumeNodeBody(r,t,r.body,l);return}}throw b.thrown(new fe("Failed to resume alternative: head not found in any item",e.pos))}resumeCall(e,t,l){let i=this.resolveBeatRefFromCall(e);if(i!=null){this.resumeBeatRun(i.beat,t,l);return}throw b.thrown(new fe("Cannot resume through a function call that is not at the bottom of the stack",e.pos))}resumeBeatCall(e,t,l){if(t>=0&&t<this.stack.length&&this.stack[t].node instanceof Be){this.resumeBeatRun(this.stack[t].node,t,l);return}throw b.thrown(new fe("Cannot resume through a beat call that is not at the bottom of the stack",e.pos))}restoreStack(e,t,l){let i=[];l==null&&(l=new Ul);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=Re.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 _=0,g=e.beats;for(;_<g.length;){let d=g[_];++_;let x=this.restoreBeat(d);if(x==null)return null;a.push(x)}}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 f=null;e.insertion!=null&&t!=null&&(f=this.restoreInsertion(e.insertion,t,l));let m=null;if(e.captured!=null){m=[];let _=0,g=e.captured;for(;_<g.length;){let d=g[_];++_;let x=this.restoreScopeItem(d,t,l);if(x==null)return null;m.push(x)}}return new ki(null,i,r,a,o,p,f,m)}restoreInsertion(e,t,l){if(l.h.hasOwnProperty(e))return l.h[e];let i=e==null?"null":""+e,n=Ae.field(t,i);if(n==null)return null;let s=null;if(n.origin!=null){let a=Re.fromString(n.origin.id),h=this.lens.getNodeById(a);h!=null&&h.type()==n.origin.type&&(s=h)}let r=new Oi(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=Re.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 Pi(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 Ii(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,Be),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=Re.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 Gl(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 Pl(this,null,i,null)),e}restoreCharacters(e){let t=0,l=Ae.fields(e);for(;t<l.length;){let i=l[t];++t;let n=Ae.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=Ae.fields(e);for(;t<l.length;){let i=l[t];++t;let n=Re.fromString(i),s=Ae.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 wi(this,null,i,null)),e}restoreFields(e,t){if(t==null||t.fields==null)return e;e==null&&(e=re.createFields(this,t.type));let l=t.fields;if(re.isFields(e)){let i=0,n=Ae.fields(l);for(;i<n.length;){let s=n[i];++i,re.setField(this,e,s,this.restoreValue(Ae.field(l,s)))}}else{let i=0,n=Ae.fields(l);for(;i<n.length;){let s=n[i];++i,e[s]=this.restoreValue(Ae.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}if(Ae.field(e,"type")=="$beatRef"){let t=e,l=this.restoreBeat(t.beat);if(l==null)return null;let i=[];if(t.stack!=null){let n=this._restoreSavedInsertions!=null?this._restoreSavedInsertions:{},s=this._restoreInsertionsCache!=null?this._restoreInsertionsCache:new Ul,r=0,a=t.stack;for(;r<a.length;){let h=a[r];++r;let o=this.restoreScopeItem(h,n,s);if(o==null){i=[];break}i.push(o)}}return new bt(l,i)}return this.restoreFields(null,e)}initializeTopLevelFunctions(e){if(this.builtins=new ji(this),this.builtins.bindAll(this.topLevelFunctions),e!=null){let r=e,a=r,h=Ae.fields(r),o=0;for(;o<h.length;){let u=h[o++],p=a[u],m=u,_=p;this.registerTopLevelFunction(m,_)}}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=Ae.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 ii;try{let l=t.process(e.code+(e.external?" {}":"")),i=new fi;i.allowJSON=!0,i.allowTypes=!0;let n=i.parseString(l),r=new hn(this).execute(n);this.topLevelFunctions.h[e.name]=r}catch(l){let i=b.caught(l).unwrap();throw b.thrown(new fe("Failed to parse function code: "+(i==null?"null":Y.string(i)),e.pos))}}}else throw b.thrown(new fe("Top level function must have a name",e.pos))}wrapNext(e){let t=new Yi;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=b.caught(e).unwrap();throw this.flushing=!1,b.thrown(t)}this.flushing=!1}}pop(){return this.stack.length>0?(this.stack.pop(),!0):!1}push(e){e.id=this.nextScopeId++,this.stack.push(e)}initializeTopLevelState(e){if(e.temporary)throw b.thrown(new fe("Top level temporary states are not allowed",e.pos));let t=0,l=e.fields;for(;t<l.length;){let i=l[t];++t;let n=this.evaluateExpression(i.value);re.setField(this,this.topLevelState.fields,i.name,n),this.isOriginalScriptExpression(i.value)&&re.setField(this,this.topLevelState.originalFields,i.name,n)}}initializeTopLevelBeat(e){if(Object.prototype.hasOwnProperty.call(this.topLevelBeats.h,e.name))throw b.thrown(new fe("Duplicate top level beat: "+e.name,e.pos));this.topLevelBeats.h[e.name]=e}initializeTopLevelCharacter(e){if(Object.prototype.hasOwnProperty.call(this.topLevelCharacters.h,e.name))throw b.thrown(new fe("Duplicate top level character: "+e.name,e.pos));let t=new wi(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);re.setField(this,t.fields,n.name,s),this.isOriginalScriptExpression(n.value)&&re.setField(this,t.originalFields,n.name,s)}}initializeState(e,t){let l=null;if(e.temporary)t.state==null&&(t.state=new Pl(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 Pl(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,!re.fieldExists(this,l.fields,s.name)){let r=this.evaluateExpression(s.value);re.setField(this,l.fields,s.name,r),!e.temporary&&this.isOriginalScriptExpression(s.value)&&re.setField(this,l.originalFields,s.name,r)}}}evaluateBeatArgs(e,t,l){if(t==null||t.length==0)return null;let i=e.params!=null?e.params.length:0;if(t.length>i)throw b.thrown(new fe("Beat "+e.name+" expects at most "+i+" argument(s), got "+t.length,l));let n=[],s=0;for(;s<t.length;){let r=t[s];++s,n.push(this.evaluateExpression(r))}return n}seedBeatParams(e,t,l){let i=t.params;if(i==null||i.length==0)return;e.state==null&&(e.state=new Pl(this,t,null,null));let n=0,s=i.length;for(;n<s;){let r=n++,a=i[r],h=null;l!=null&&r<l.length?h=l[r]:a.defaultValue!=null&&(h=this.evaluateExpression(a.defaultValue)),re.setField(this,e.state.fields,a.name,h)}}finish(){this.finishTrigger=null,this.handleFinish!=null&&this.handleFinish(this)}transitionToBeat(e,t,l){for(;this.pop(););this.nextScopeId=1,this.nextInsertionId=1,this.pendingChoiceOptions=null,this._choiceEvalTexts.length=0,this._choiceEvalEnabled.length=0;let i=this.wrapNext(Te(this,this.finish));this.finishTrigger=i,this.evalBeatRun(e,i.cb,t,l),i.sync=!1}evalNode(e,t){switch(te.getClass(e)){case $l:this.evalAlternative(e,t);break;case bl:this.evalAssignment(e,t);break;case Kl:this.evalBeatCall(e,t);break;case Be:this.evalBeatDecl(e,t);break;case Vt:this.evalCall(e,t);break;case Ot:this.evalChoiceOption(e,t);break;case wl:this.evalChoice(e,t);break;case Ht:this.evalDialogue(e,t);break;case kl:this.evalIf(e,t);break;case Yt:this.evalStateDecl(e,t);break;case il:this.evalText(e,t);break;case yl:this.evalTransition(e);break;default:let l=te.getClass(e);throw b.thrown(new fe("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 b.thrown(new fe("Duplicate beat with name: "+e.name,e.pos));this.get_currentScope().beats.push(e),t()}evalNodeBody(e,t,l,i,n,s,r){this.push(new ki(null,e,t,null,null,null,i,null)),t==e&&e!=null&&e.params!=null&&this.seedBeatParams(this.get_currentScope(),e,n),t==e&&e!=null&&s!=null&&s.length>0&&(this.get_currentScope().captured=s);let a=0,h=null,o=this.get_currentInsertion(),u=this;h=function(){if((o!=null?o.options:null)!=null)u.pop(),r();else if(a<l.length){let p=l[a];u.get_currentScope().head=p,a+=1;let f=u.wrapNext(h);u.evalNode(p,f.cb),f.sync=!1}else u.pop(),r()},h()}evalBeatRun(e,t,l,i){this.incrementBeatVisitCount(e),this.evalNodeBody(e,e,e.body,null,l,i,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 f=a.stack.length;for(;a.stack.length>0;)a.stack.pop();let m=0,_=u.insertion.stack;for(;m<_.length;){let d=_[m];++m,d.insertion!=null&&(d.insertion=null),a.stack.push(d)}let g=a.stack[a.stack.length-1];a.push(new ki(null,g.beat,a.lens.getParentNode(u.node),null,null,u.node,null,null)),a.resumeFromLevel(f,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 f=l[p];++p,this._choiceEvalTexts.push(f.text),this._choiceEvalEnabled.push(f.enabled)}}let a=n??0,h=null,o=null,u=this;h=function(){if(o!=null&&o.options!=null){let p=0,f=o.options.length;for(;p<f;){let m=p++,_=o.options[m];l.push(_)}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 _=u.wrapNext(h),g=u.getTranslatedString(p,p.text),d=u.evaluateString(g);l.push(new Ii(d.text,d.tags,m,p,u.get_currentInsertion())),u._choiceEvalTexts.push(d.text),u._choiceEvalEnabled.push(m),_.cb(),_.sync=!1}else if(p.insertion!=null){let _=u.wrapNext(h);m?(o=new Oi(u.nextInsertionId++,p.insertion),o.parentPartialOptions=[].concat(l),o.parentNextOptionIndex=a,u.evalInsertion(o,_.cb)):_.cb(),_.sync=!1}else throw b.thrown(new fe("Invalid choice option",p.pos))}else i()},h()}evalInsertion(e,t){let l=e.origin,i=null;if(l.targetExpr!=null){let r=this.evaluateExpression(l.targetExpr);i=this.resolveDynamicBeatTarget(r,l)}else{let r=l.target;if(i=this.resolveBeatRefFromNode(r,l),i==null)throw b.thrown(this.beatNotFoundError(r,l))}let n=i.beat,s=this.evaluateBeatArgs(n,l.args,l.pos);this.evalNodeBody(n,n,n.body,e,s,i.stack.length>0?i.stack:null,t)}evalBeatCall(e,t){let l=this.evaluateExpression(e.targetExpr),i=this.resolveDynamicBeatTarget(l,e),n=this.evaluateBeatArgs(i.beat,e.args,e.pos);this.evalBeatRun(i.beat,t,n,i.stack.length>0?i.stack:null)}evalChoiceOption(e,t){this.evalNodeBody(this.get_currentScope().beat,e,e.body,null,null,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,null,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,null,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,null,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,null,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,null,null,t);break;case 4:let f=[],m=0,_=e.items.length;for(;m<_;){let x=m++;f.push(x)}let g=f,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,null,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=re.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 Pl(this,e,null,null);let s=e.id.thisVal;this.nodeStates.map._set(s.high,s.low,l)}let i=re.getField(this,l.fields,"_visitCount"),n=i??0;re.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=re.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 Pl(this,e,null,null);let n=e.id.thisVal;this.nodeStates.map._set(n.high,n.low,i)}re.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=re.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 Pl(this,e,null,null);let i=e.id.thisVal;this.nodeStates.map._set(i.high,i.low,l)}re.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 b.thrown(new fe("Invalid assignment operator",e.pos))}this.writeAccess(l,n),t()}isOriginalScriptExpression(e){switch(te.getClass(e)){case nl:let t=e;return this.isOriginalScriptExpression(t.left)?this.isOriginalScriptExpression(t.right):!1;case _t:case dl:case Vt:return!1;case Ke: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,f=0;for(;f<p.length;){let m=p[f];if(++f,!this.isOriginalScriptExpression(m.value))return!1}return!0}break;case Bt: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 f=o.closing,m=o.expr;if(!this.isOriginalScriptExpression(m))return!1;break}}return!0;case ei:let a=e;return this.isOriginalScriptExpression(a.operand)}return!1}isBeatCall(e,t){return t==null&&(t=-1),e instanceof Vt?this.resolveBeatRefFromCall(e)!=null:!1}isDynamicCallForm(e){if(e.target instanceof _t){let t=e.target;if(t.target==null&&t.name=="call")return!this.resolvesExistingBinding("call")}return!1}resolveBeatByName(e,t){t==null&&(t=-1);let l=null;return this.eachResolutionScope(t,function(i){let n=i.beatByName(e);return n!=null?(l=n,!0):!1}),l??this.topLevelBeats.h[e]}resolveBeatRefByName(e){let t=null,l=null;if(l=function(n,s){let r=s;for(;r>=0;){let a=n[r],h=a.beatByName(e);if(h!=null){t=new bt(h,n.slice(0,r+1));return}if(a.captured!=null){l(a.captured,a.captured.length-1);return}--r}},l(this.stack,this.stack.length-1),t!=null)return t;let i=this.topLevelBeats.h[e];return i!=null?new bt(i,[]):null}resolveBeatRefFromNode(e,t){if(t==null)return this.resolveBeatRefByName(e);let l=this.lens.findBeatByNameFromNode(e,t);return l==null?null:new bt(l,this.captureChainForBeat(l))}captureChainForBeat(e){let t=this.lens.getFirstParentOfType(e,Be);if(t==null)return[];let l=null,i=null;return i=function(n,s){let r=s,a=-1;for(;r>=0;){let h=n[r];if(h.beats!=null&&h.beats.indexOf(e)!=-1){l=n.slice(0,r+1);return}if(a==-1&&h.beat==t&&(a=r),h.captured!=null){i(h.captured,h.captured.length-1),l==null&&a!=-1&&(l=n.slice(0,a+1));return}--r}l==null&&a!=-1&&(l=n.slice(0,a+1))},i(this.stack,this.stack.length-1),l??[]}resolveDynamicBeatTarget(e,t){if(e instanceof bt)return e;if(e instanceof Be)return new bt(e,[]);if(typeof e=="string"){let l=e,i=this.resolveBeatRefFromNode(l,t);if(i==null)throw b.thrown(this.beatNotFoundError(l,t));return i}throw b.thrown(new fe("Invalid dynamic beat target: "+this.valueToString(e),t.pos))}beatNotFoundError(e,t){let l=t!=null?t.pos:this.script.pos,i=0,n=this.lens.getNodesOfType(Be,!0);for(;i<n.length;){let s=n[i];if(++i,s.name==e)return new fe("Beat "+e+" is not visible from this scope. Store a reference (ref = "+e+") while it is in scope to use it from elsewhere.",l)}return new fe("Beat "+e+" not found",l)}resolveBeatRefFromCall(e){if(e.target instanceof _t){let t=e.target;if(t.target==null)return this.resolveBeatRefFromNode(t.name,t)}return null}evalCall(e,t){let l=this.resolveBeatRefFromCall(e);if(l!=null){let i=this.evaluateBeatArgs(l.beat,e.args,e.pos);this.evalBeatRun(l.beat,t,i,l.stack.length>0?l.stack:null);return}this.evaluateFunctionCall(e,t)}evalTransition(e){let t=null;if(e.targetExpr!=null){let i=this.evaluateExpression(e.targetExpr);if(typeof i=="string"&&i=="."){if(e.args!=null&&e.args.length>0)throw b.thrown(new fe("Cannot pass arguments when ending the script",e.pos));this.finish();return}t=this.resolveDynamicBeatTarget(i,e)}else{let i=e.target;if(i=="."){this.finish();return}if(t=this.resolveBeatRefFromNode(i,e),t==null)throw b.thrown(this.beatNotFoundError(i,e))}let l=this.evaluateBeatArgs(t.beat,e.args,e.pos);this.transitionToBeat(t.beat,l,t.stack.length>0?t.stack:null)}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,f=r;for(;p<f;){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,y=x.length;y>0&&(a=!0);let S=!1,C=!1,O=!1,E=0,v=y;for(;E<v;){let q=E++,z=c.cca(x,q),P=z??-1;O?(P==110?i+=String.fromCodePoint(10):P==114?i+=String.fromCodePoint(13):P==116?i+=String.fromCodePoint(9):i+=String.fromCodePoint(P),O=!1,S=!1,C=!1):P==92?(O=!0,S=!1,C=!1):P==36?(S?(i+=String.fromCodePoint(P),S=!1):S=!0,C=!1):P==35?(C?(i+=String.fromCodePoint(P),C=!1):C=!0,S=!1):(C&&(i+=String.fromCodePoint(35),C=!1),i+=String.fromCodePoint(P))}C&&(i+=String.fromCodePoint(35)),s+=y;break;case 1:let N=g.expr;if(a=!0,N instanceof _t){let q=N,z=this.resolveAccess(q,q.target,q.name);if(z._hx_index==2){let P=z.pos,A=z.name,F=this.evaluateExpression(N),R=re.getField(this,F,"name"),V=R??A,W=this.valueToString(V);s+=W.length,i+=W==null?"null":""+W}else{let P=this.evaluateExpression(N),A=this.valueToString(P);s+=A.length,i+=A==null?"null":""+A}}else{let q=this.evaluateExpression(N),z=this.valueToString(q);s+=z.length,i+=z==null?"null":""+z}break;case 2:let L=g.closing,B=g.expr,I=this.evaluateString(B).text;n.push(new Pi(L,I,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,_=e.parts[t].partType;if(_._hx_index==1?m=_.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,f=h.expr;break}l&&i.push(a)}return l?new Bt(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 f=c.cca(e,p),m=f??-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 f=s+1,m=o-s-1,_=m!=null?c.substr(e,f,m):c.substr(e,f,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(Re.UNDEFINED,l,ze.Raw(y!=null?c.substr(e,r,y):c.substr(e,r,null))))}i.push(new Ge(Re.UNDEFINED,l,ze.Expr(this.makePluralCall(t,_,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,f=p!=null?c.substr(e,o,p):c.substr(e,o,null),m=s+1,_=u-s-1,g=_!=null?c.substr(e,m,_):c.substr(e,m,null);if(f.length>0&&g.length>0){if(o>r){let d=o-r;i.push(new Ge(Re.UNDEFINED,l,ze.Raw(d!=null?c.substr(e,r,d):c.substr(e,r,null))))}i.push(new Ge(Re.UNDEFINED,l,ze.Expr(this.makePluralCall(t,f,g,l)))),s=u,r=s;continue}}++s}if(r<n){let a=n-r;i.push(new Ge(Re.UNDEFINED,l,ze.Raw(a!=null?c.substr(e,r,a):c.substr(e,r,null))))}}makePluralCall(e,t,l,i){let n=new _t(Re.UNDEFINED,i,null,"plural"),s=new Bt(Re.UNDEFINED,i,1,[new Ge(Re.UNDEFINED,i,ze.Raw(t))]),r=new Bt(Re.UNDEFINED,i,1,[new Ge(Re.UNDEFINED,i,ze.Raw(l))]);return new Vt(Re.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;
|
|
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=`
|
|
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
|
|
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
|
|
36
|
-
`).join("\\n"),n}print(e){return this._noLn=0,this._level=0,this._prevLevel=0,this._numEmptyLines=0,this._buf=new
|
|
30
|
+
`)}return e}stripStringComments(e){let t=e,l="",i=t.length,n=0;for(;n<i;){let s=c.cca(t,n),r=s??-1,a;if(r==47&&n+1<i){let o=c.cca(t,n+1);a=(o??-1)==47}else a=!1;if(a){for(;;){let o;if(n<i){let u=c.cca(t,n);o=(u??-1)!=10}else o=!1;if(!o)break;++n}continue}let h;if(r==47&&n+1<i){let o=c.cca(t,n+1);h=(o??-1)==42}else h=!1;if(h){let o;if(n>0){let p=c.cca(t,n-1);o=(p??-1)==32}else o=!1;for(n+=2;;){let p;if(n+1<i){let f,m=c.cca(t,n);if((m??-1)==42){let _=c.cca(t,n+1);f=(_??-1)==47}else f=!1;p=!f}else p=!1;if(!p)break;++n}n+=2;let u;if(n<i){let p=c.cca(t,n);u=(p??-1)==32}else u=!1;o&&u&&++n,!o&&!u&&n<i&&(l+=String.fromCodePoint(32));continue}l+=String.fromCodePoint(r),++n}return l}evaluateCondition(e){let t=this.evaluateExpression(e);return typeof t=="boolean"?t==!0:typeof t=="string"?t.length>0:oe.isArray(t)?oe.arrayLength(t)>0:typeof t=="number"&&(t|0)===t||typeof t=="number"?t!=0:t!=null}callFunctionValue(e,t,l,i){try{let n=e.apply(null,t);if(n!=null&&n instanceof ci){if(i==null)throw b.thrown(new fe("Cannot call async function in expression",l));n.func(i)}else i?.();return n}catch(n){let s=b.caught(n).unwrap();if(s instanceof ke){let r=s;throw b.thrown(new fe("Error when evaluating function ("+r.pmin+"-"+r.pmax+"): "+Y.string(r.e),l))}throw b.thrown(new fe("Error when calling function: "+Y.string(s),l))}}resolvesExistingBinding(e){let t=!1,l=this;return this.eachResolutionScope(-1,function(i){if(i.state!=null&&re.fieldExists(l,i.state.fields,e))return t=!0,!0;if(i.node!=null){let n=i.node.id.thisVal,s=l.nodeStates.map._get(n.high,n.low);if(s!=null&&re.fieldExists(l,s.fields,e))return t=!0,!0}return!1}),!!(t||re.fieldExists(this,this.topLevelState.fields,e)||Object.prototype.hasOwnProperty.call(this.topLevelCharacters.h,e)||Object.prototype.hasOwnProperty.call(this.topLevelFunctions.h,e)||this.resolveBeatByName(e)!=null)}evaluateDynamicCall(e,t){if(e.args.length==0)throw b.thrown(new fe("call() requires a target argument",e.pos));let l=this.evaluateExpression(e.args[0]);if(bt.beatOf(l)!=null)throw b.thrown(new fe("call() can only call functions. Use beat(...) to call a beat.",e.pos));let i=null;if(Ae.isFunction(l))i=l;else if(typeof l=="string"){let n=l;if(this.resolveBeatByName(n)!=null)throw b.thrown(new fe("call() can only call functions. Use beat(...) to call a beat.",e.pos));Object.prototype.hasOwnProperty.call(this.topLevelFunctions.h,n)&&(i=this.topLevelFunctions.h[n])}if(i!=null){let n=[],s=1,r=e.args.length;for(;s<r;){let h=s++;n.push(this.evaluateExpression(e.args[h]))}let a=n;return this.callFunctionValue(i,a,e.pos,t)}throw b.thrown(new fe("call() target is not a function: "+this.valueToString(l),e.pos))}evaluateFunctionCall(e,t){if(e.target instanceof _t){let n=e.target;if(n.target==null){if(n.name=="call"&&!this.resolvesExistingBinding("call"))return this.evaluateDynamicCall(e,t);let s=this.evaluateExpression(e.target);if(s!=null&&Ae.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;return this.callFunctionValue(s,o,e.pos,t)}}else{let s=this.evaluateExpression(n.target),r=null,a=bt.beatOf(s);if(typeof s=="string"?r=re.getStringHelper(this,n.name):oe.isArray(s)?r=re.getArrayHelper(this,n.name):a!=null?r=re.getBeatHelper(this,n.name):re.isFields(s)&&(r=re.getMapHelper(this,n.name)),r!=null&&Ae.isFunction(r)){let h=[],o=0,u=e.args;for(;o<u.length;){let m=u[o];++o,h.push(this.evaluateExpression(m))}let p=h;p.splice(0,0,a??s);let f=r.apply(null,p);if(f!=null&&f instanceof ci){if(t==null)throw b.thrown(new fe("Cannot call async function in expression",e.pos));f.func(t)}else t?.();return f}else if(r==null&&!(typeof s=="string"||oe.isArray(s)||re.isFields(s))){let h=Ae.getProperty(s,n.name);if(Ae.isFunction(h)){let o=[],u=0,p=e.args;for(;u<p.length;){let _=p[u];++u,o.push(this.evaluateExpression(_))}let f=o,m=h.apply(s,f);if(m!=null&&m instanceof ci){if(t==null)throw b.thrown(new fe("Cannot call async function in expression",e.pos));m.func(t)}else t?.();return m}}}}let l=this.printLoreline(e.target),i;throw l!=null?i=l:i=te.getClass(e.target).__name__,b.thrown(new fe("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={},l=0;for(;l<e.length;){let i=e[l];++l,t[i.name]=this.evaluateExpression(i.value)}return t}evaluateExpression(e){switch(te.getClass(e)){case _t:let t=e,l=this.resolveAccess(t,t.target,t.name);return this.readAccess(l);case dl: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 b.thrown(new fe("Array index out of bounds: "+x,i.pos));return oe.arrayGet(n,x)}else if(typeof s=="string"){if(n==null)throw b.thrown(new fe("Cannot access field '"+(s==null?"null":Y.string(s))+"' of null",i.pos));return re.getField(this,n,s)}else throw b.thrown(new fe("Invalid array access",i.pos));break;case nl:let r=e,a=this.evaluateExpression(r.left),h=this.evaluateExpression(r.right);return this.performOperation(r.op,a,h,r.pos);case Vt:return this.evaluateFunctionCall(e,null);case Ke:let o=e,u=o.literalType;switch(u._hx_index){case 0:case 1:case 2:return o.value;case 3:return this.evaluateArrayLiteral(o.value);case 4:let x=u.style;return this.evaluateObjectLiteral(o.value)}break;case Bt: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 si:let f=e;return this.evaluateCondition(f.condition)?this.evaluateExpression(f.trueExpr):this.evaluateExpression(f.falseExpr);case ei:let _=e,g=this.evaluateExpression(_.operand);switch(_.op._hx_index){case 27:if(typeof g=="number"&&(g|0)===g)return-g;if(typeof g=="number")return-g;throw b.thrown(new fe("Invalid unary operation",_.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 return oe.isArray(g)?oe.arrayLength(g)==0:typeof g=="number"&&(g|0)===g||typeof g=="number"?g==0:g==null;break;default:throw b.thrown(new fe("Invalid unary operation",_.pos))}break;default:let d=te.getClass(e);throw b.thrown(new fe("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 b.thrown(new fe("Cannot read field '"+i+"' of null",t));return re.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 b.thrown(new fe("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 b.thrown(new fe("Function not found: "+u,o));case 4:let p=e.pos;return e.ref}}writeAccess(e,t){switch(e._hx_index){case 0:let l=e.pos,i=e.obj,n=e.name;if(i==null)throw b.thrown(new fe("Cannot set field '"+n+"' of null",l));re.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 b.thrown(new fe("Cannot overwrite character: "+o,h));case 3:let u=e.pos,p=e.name;throw b.thrown(new fe("Cannot overwrite function: "+p,u));case 4:let f=e.pos,m=e.ref;throw b.thrown(new fe("Cannot overwrite beat: "+m.beat.name,f))}}resolveAssignmentTarget(e){switch(te.getClass(e)){case _t:let t=e;return this.resolveAccess(t,t.target,t.name);case dl: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 _l.ArrayAccess(l.pos,i,s)}else if(typeof n=="string"){if(i==null)throw b.thrown(new fe("Cannot access field '"+(n==null?"null":Y.string(n))+"' of null",l.pos));return _l.FieldAccess(l.pos,i,n)}else throw b.thrown(new fe("Invalid array access target",l.pos));break;default:throw b.thrown(new fe("Invalid assignment target",e.pos))}}resolveAccess(e,t,l){if(t!=null){let o=this.evaluateExpression(t);if(o==null){let u=te.getClass(t)==_t?t.name:null;throw b.thrown(new fe(u!=null?"Cannot access field '"+l+"' of undefined variable '"+u+"'":"Cannot access field '"+l+"' of null value",t.pos))}return _l.FieldAccess(t.pos,o,l)}let i=null,n=this;if(this.eachResolutionScope(-1,function(o){if(o.state!=null&&re.fieldExists(n,o.state.fields,l)){let u=e!=null?e.pos:null,p;if(u!=null)p=u;else{let f=n.get_currentScope(),m=f!=null?f.node:null;p=m!=null?m.pos:null}return i=_l.FieldAccess(p??n.script.pos,o.state.fields,l),!0}if(o.node!=null){let u=o.node.id.thisVal,p=n.nodeStates.map._get(u.high,u.low);if(p!=null&&re.fieldExists(n,p.fields,l)){let f=e!=null?e.pos:null,m;if(f!=null)m=f;else{let _=n.get_currentScope(),g=_!=null?_.node:null;m=g!=null?g.pos:null}return i=_l.FieldAccess(m??n.script.pos,p.fields,l),!0}}return!1}),i!=null)return i;if(re.fieldExists(this,this.topLevelState.fields,l)){let o=e!=null?e.pos:null,u;if(o!=null)u=o;else{let p=this.get_currentScope(),f=p!=null?p.node:null;u=f!=null?f.pos:null}return _l.FieldAccess(u??this.script.pos,this.topLevelState.fields,l)}if(Object.prototype.hasOwnProperty.call(this.topLevelCharacters.h,l)){let o=e!=null?e.pos:null,u;if(o!=null)u=o;else{let p=this.get_currentScope(),f=p!=null?p.node:null;u=f!=null?f.pos:null}return _l.CharacterAccess(u??this.script.pos,l)}if(Object.prototype.hasOwnProperty.call(this.topLevelFunctions.h,l)){let o=e!=null?e.pos:null,u;if(o!=null)u=o;else{let p=this.get_currentScope(),f=p!=null?p.node:null;u=f!=null?f.pos:null}return _l.FunctionAccess(u??this.script.pos,l)}let s=this.resolveBeatRefFromNode(l,e);if(s!=null){let o=e!=null?e.pos:null,u;if(o!=null)u=o;else{let p=this.get_currentScope(),f=p!=null?p.node:null;u=f!=null?f.pos:null}return _l.BeatAccess(u??this.script.pos,s)}if(!this.strictAccess){let o=e!=null?e.pos:null,u;if(o!=null)u=o;else{let p=this.get_currentScope(),f=p!=null?p.node:null;u=f!=null?f.pos:null}return _l.FieldAccess(u??this.script.pos,this.topLevelState.fields,l)}let r="Undefined variable: "+l,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}throw b.thrown(new fe(r,h??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=me.typeof(t),s=me.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 x="Cannot add "+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 b.thrown(new fe(x,S??this.script.pos))}break;default:let _="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(s),g=i,d;if(g!=null)d=g;else{let x=this.get_currentScope(),y=x!=null?x.node:null;d=y!=null?y.pos:null}throw b.thrown(new fe(_,d??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 x="Cannot add "+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 b.thrown(new fe(x,S??this.script.pos))}break;default:let _="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(s),g=i,d;if(g!=null)d=g;else{let x=this.get_currentScope(),y=x!=null?x.node:null;d=y!=null?y.pos:null}throw b.thrown(new fe(_,d??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),g=i,d;if(g!=null)d=g;else{let x=this.get_currentScope(),y=x!=null?x.node:null;d=y!=null?y.pos:null}throw b.thrown(new fe(_,d??this.script.pos))}}else{let _="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(s),g=i,d;if(g!=null)d=g;else{let x=this.get_currentScope(),y=x!=null?x.node:null;d=y!=null?y.pos:null}throw b.thrown(new fe(_,d??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),g=i,d;if(g!=null)d=g;else{let x=this.get_currentScope(),y=x!=null?x.node:null;d=y!=null?y.pos:null}throw b.thrown(new fe(_,d??this.script.pos))}}else{let _="Cannot add "+this.getTypeName(n)+" and "+this.getTypeName(s),g=i,d;if(g!=null)d=g;else{let x=this.get_currentScope(),y=x!=null?x.node:null;d=y!=null?y.pos:null}throw b.thrown(new fe(_,d??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 y=parseFloat(Y.string(t)),S=parseFloat(Y.string(l));switch(e._hx_index){case 27:return y-S;case 28:return y*S;case 29:if(S==0){let N=i,L;if(N!=null)L=N;else{let B=this.get_currentScope(),I=B!=null?B.node:null;L=I!=null?I.pos:null}throw b.thrown(new fe("Division by zero",L??this.script.pos))}return y/S;case 30:if(S==0){let N=i,L;if(N!=null)L=N;else{let B=this.get_currentScope(),I=B!=null?B.node:null;L=I!=null?I.pos:null}throw b.thrown(new fe("Modulo by zero",L??this.script.pos))}return y%S;default:throw b.thrown("Unreachable")}break;default:let C;switch(e._hx_index){case 27:C="subtract";break;case 28:C="multiply";break;case 29:C="divide";break;case 30:C="modulo";break;default:C="perform operation on"}let O="Cannot "+C+" "+this.getTypeName(n)+" and "+this.getTypeName(s),E=i,v;if(E!=null)v=E;else{let N=this.get_currentScope(),L=N!=null?N.node:null;v=L!=null?L.pos:null}throw b.thrown(new fe(O,v??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 g="Cannot "+_+" "+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 b.thrown(new fe(g,x??this.script.pos))}break;case 31:case 32:let r=bt.beatOf(t),a=bt.beatOf(l),h=r!=null&&typeof l=="string"?r.name==l:typeof t=="string"&&a!=null?t==a.name:r!=null&&a!=null?r.name==a.name:t==l;switch(e._hx_index){case 31:return h;case 32:return!h;default:throw b.thrown("Unreachable")}break;case 33:case 34:case 35:case 36:switch(n._hx_index){case 1:case 2:switch(s._hx_index){case 1:case 2:let x=parseFloat(Y.string(t)),y=parseFloat(Y.string(l));switch(e._hx_index){case 33:return x>y;case 34:return x<y;case 35:return x>=y;case 36:return x<=y;default:throw b.thrown("Unreachable")}break;default:let S="Cannot compare "+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 b.thrown(new fe(S,O??this.script.pos))}break;default:let _="Cannot compare "+this.getTypeName(n)+" and "+this.getTypeName(s),g=i,d;if(g!=null)d=g;else{let x=this.get_currentScope(),y=x!=null?x.node:null;d=y!=null?y.pos:null}throw b.thrown(new fe(_,d??this.script.pos))}break;case 37:let o=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 g=e.word;return t?!0:l;default:throw b.thrown("Unreachable")}else{let _="Cannot perform logical operation on "+this.getTypeName(n)+" and "+this.getTypeName(s),g=i,d;if(g!=null)d=g;else{let x=this.get_currentScope(),y=x!=null?x.node:null;d=y!=null?y.pos:null}throw b.thrown(new fe(_,d??this.script.pos))}else{let _="Cannot perform logical operation on "+this.getTypeName(n)+" and "+this.getTypeName(s),g=i,d;if(g!=null)d=g;else{let x=this.get_currentScope(),y=x!=null?x.node:null;d=y!=null?y.pos:null}throw b.thrown(new fe(_,d??this.script.pos))}break;case 38:let u=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 g=e.word;return t?!0:l;default:throw b.thrown("Unreachable")}else{let _="Cannot perform logical operation on "+this.getTypeName(n)+" and "+this.getTypeName(s),g=i,d;if(g!=null)d=g;else{let x=this.get_currentScope(),y=x!=null?x.node:null;d=y!=null?y.pos:null}throw b.thrown(new fe(_,d??this.script.pos))}else{let _="Cannot perform logical operation on "+this.getTypeName(n)+" and "+this.getTypeName(s),g=i,d;if(g!=null)d=g;else{let x=this.get_currentScope(),y=x!=null?x.node:null;d=y!=null?y.pos:null}throw b.thrown(new fe(_,d??this.script.pos))}break;default:let p="Invalid operation: "+Y.string(e),f=i,m;if(f!=null)m=f;else{let _=this.get_currentScope(),g=_!=null?_.node:null;m=g!=null?g.pos:null}throw b.thrown(new fe(p,m??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 n=t[l];if(++l,n==e)return"..."}if(t.push(e),oe.isArray(e)){let n=oe.arrayLength(e),s="";s+="[";let r=0,a=n;for(;r<a;){let h=r++;h>0&&(s+=", "),s+=Y.string(this.valueToStringImpl(oe.arrayGet(e,h),t))}return s+="]",t.pop(),s}let i=bt.beatOf(e);if(i!=null)return t.pop(),i.name;if(re.isFields(e)){let n=re.getFields(this,e);n.sort(function(h,o){return h<o?-1:h>o?1:0});let s="";s+="{";let r=0,a=n.length;for(;r<a;){let h=r++;h>0&&(s+=", "),s+=Y.string(n[h]),s+=": ",s+=Y.string(this.valueToStringImpl(re.getField(this,e,n[h]),t))}return s+="}",t.pop(),s}return t.pop(),e==null?"null":Y.string(e)}printLoreline(e){try{let t=new Jl;return t.enableComments=!1,He.trim(t.print(e))}catch{return null}}}J["loreline.Interpreter"]=Zl.loreline.Interpreter=Ni,Ni.__name__="loreline.Interpreter",Object.assign(Ni.prototype,{__class__:Ni,__properties__:{get_currentInsertion:"get_currentInsertion",get_currentScope:"get_currentScope"}});class En{static stringify(e,t){return t==null&&(t=!1),JSON.stringify(e,null,t?" ":null)}static parse(e){return JSON.parse(e)}}J["loreline.Json"]=En,En.__name__="loreline.Json";class D{static scriptFromJson(e){if(e==null)throw b.thrown("Cannot create Script from null JSON");let t=e.type;if(t!="Script")throw b.thrown("Expected Script node, got: "+t);let l=D.idFromJson(e),i=D.positionFromJson(e.pos),n=e.body,s=[],r=0;for(;r<n.length;){let o=n[r];++r,s.push(D.nodeFromJson(o))}let a=s,h=new sl(l,i,a);return h.indentSize=e.indentSize!=null?e.indentSize:2,e.filePath!=null&&(h.filePath=e.filePath),D.applyComments(h,e),h}static nodeFromJson(e){if(e==null)return null;let t=e.type;switch(t){case"Access":return D.accessFromJson(e);case"Alternative":return D.alternativeFromJson(e);case"ArrayAccess":return D.arrayAccessFromJson(e);case"Assign":return D.assignFromJson(e);case"Beat":return D.beatFromJson(e);case"BeatCall":return D.beatCallFromJson(e);case"Binary":return D.binaryFromJson(e);case"Block":return D.blockFromJson(e);case"Call":return D.callFromJson(e);case"Character":return D.characterFromJson(e);case"Choice":return D.choiceStatementFromJson(e);case"Comment":return D.commentFromJson(e);case"Dialogue":return D.dialogueStatementFromJson(e);case"Field":return D.objectFieldFromJson(e);case"Function":return D.functionDeclFromJson(e);case"If":return D.ifStatementFromJson(e);case"Import":return D.importStatementFromJson(e);case"Insertion":return D.insertionFromJson(e);case"Literal":return D.literalFromJson(e);case"Option":return D.choiceOptionFromJson(e);case"Part":return D.stringPartFromJson(e);case"Script":return D.scriptFromJson(e);case"State":return D.stateFromJson(e);case"String":return D.stringLiteralFromJson(e);case"Ternary":return D.ternaryFromJson(e);case"Text":return D.textStatementFromJson(e);case"Transition":return D.transitionFromJson(e);case"Unary":return D.unaryFromJson(e);default:throw b.thrown("Unknown node type: "+t)}}static commentFromJson(e){let t=D.idFromJson(e),l=D.positionFromJson(e.pos),i=e.isHash!=null&&e.isHash;return new Xl(t,l,e.content,e.multiline,i)}static stateFromJson(e){let t=D.idFromJson(e),l=D.positionFromJson(e.pos),i=e.fields,n=[],s=0;for(;s<i.length;){let o=i[s];++s,n.push(D.nodeFromJson(o))}let r=n,a=D.extractComments(e),h=new Yt(t,l,e.temporary,r,a.leading,a.trailing);return h.style=D.blockStyleFromString(e.style),h}static objectFieldFromJson(e){let t=D.idFromJson(e),l=D.positionFromJson(e.pos),i=D.extractComments(e);return new ql(t,l,e.name,D.nodeFromJson(e.value),i.leading,i.trailing)}static characterFromJson(e){let t=D.idFromJson(e),l=D.positionFromJson(e.pos),i=D.positionFromJson(e.namePos),n=e.fields,s=[],r=0;for(;r<n.length;){let u=n[r];++r,s.push(D.nodeFromJson(u))}let a=s,h=D.extractComments(e),o=new Jt(t,l,e.name,i,a,h.leading,h.trailing);return o.style=D.blockStyleFromString(e.style),o}static beatFromJson(e){let t=D.idFromJson(e),l=D.positionFromJson(e.pos),i=e.body,n=[],s=0;for(;s<i.length;){let o=i[s];++s,n.push(D.nodeFromJson(o))}let r=n,a=D.extractComments(e),h=new Be(t,l,e.name,r,a.leading,a.trailing);if(h.style=D.blockStyleFromString(e.style),e.params!=null){let o=e.params,u=[],p=0;for(;p<o.length;){let f=o[p];++p,u.push(new Mi(f.name,D.positionFromJson(f.namePos),f.defaultValue!=null?D.nodeFromJson(f.defaultValue):null))}h.params=u}return h}static stringPartFromJson(e){let t=D.idFromJson(e),l=D.positionFromJson(e.pos),i=e.part,n;switch(i){case"Expr":n=ze.Expr(D.nodeFromJson(e.expression));break;case"Raw":n=ze.Raw(e.text);break;case"Tag":n=ze.Tag(e.closing,D.nodeFromJson(e.content));break;default:throw b.thrown("Unknown string part type: "+i)}let s=D.extractComments(e);return new Ge(t,l,n,s.leading,s.trailing)}static stringLiteralFromJson(e){let t=D.idFromJson(e),l=D.positionFromJson(e.pos),i=D.quotesFromString(e.quotes),n=e.parts,s=[],r=0;for(;r<n.length;){let o=n[r];++r,s.push(D.nodeFromJson(o))}let a=s,h=D.extractComments(e);return new Bt(t,l,i,a,h.leading,h.trailing)}static textStatementFromJson(e){let t=D.idFromJson(e),l=D.positionFromJson(e.pos),i=D.nodeFromJson(e.content),n=D.extractComments(e),s=new il(t,l,i,n.leading,n.trailing);return e.condition!=null&&(s.condition=D.nodeFromJson(e.condition),s.conditionStyle=D.conditionStyleFromString(e.conditionStyle),s.conditionPos=D.positionFromJson(e.conditionPos)),s}static dialogueStatementFromJson(e){let t=D.idFromJson(e),l=D.positionFromJson(e.pos),i=D.positionFromJson(e.characterPos),n=D.nodeFromJson(e.content),s=D.extractComments(e),r=new Ht(t,l,e.character,i,n,s.leading,s.trailing);return e.condition!=null&&(r.condition=D.nodeFromJson(e.condition),r.conditionStyle=D.conditionStyleFromString(e.conditionStyle),r.conditionPos=D.positionFromJson(e.conditionPos)),r}static choiceStatementFromJson(e){let t=D.idFromJson(e),l=D.positionFromJson(e.pos),i=e.options,n=[],s=0;for(;s<i.length;){let o=i[s];++s,n.push(D.nodeFromJson(o))}let r=n,a=D.extractComments(e),h=new wl(t,l,r,a.leading,a.trailing);return h.style=D.blockStyleFromString(e.style),h}static choiceOptionFromJson(e){let t=D.idFromJson(e),l=D.positionFromJson(e.pos),i=e.text!=null?D.nodeFromJson(e.text):null,n=e.insertion!=null?D.nodeFromJson(e.insertion):null,s=e.condition!=null?D.nodeFromJson(e.condition):null,r=e.conditionStyle!=null?D.conditionStyleFromString(e.conditionStyle):0,a=e.body,h=[],o=0;for(;o<a.length;){let m=a[o];++o,h.push(D.nodeFromJson(m))}let u=h,p=D.extractComments(e),f=new Ot(t,l,i,n,s,r,u,p.leading,p.trailing);return f.style=D.blockStyleFromString(e.style),e.once!=null&&e.once&&(f.once=!0),e.conditionPos!=null&&(f.conditionPos=D.positionFromJson(e.conditionPos)),f}static blockFromJson(e){let t=D.idFromJson(e),l=D.positionFromJson(e.pos),i=e.body,n=[],s=0;for(;s<i.length;){let o=i[s];++s,n.push(D.nodeFromJson(o))}let r=n,a=D.extractComments(e),h=new ol(t,l,r,a.leading,a.trailing);return h.style=D.blockStyleFromString(e.style),h}static ifStatementFromJson(e){let t=D.idFromJson(e),l=D.positionFromJson(e.pos),i=D.nodeFromJson(e.condition),n=D.conditionStyleFromString(e.conditionStyle),s=e.thenBranch,r=[],a=0;for(;a<s.length;){let _=s[a];++a,r.push(D.nodeFromJson(_))}let h=r,o=new ol(Re.UNDEFINED,l,h);o.style=D.blockStyleFromString(e.thenStyle);let u=null;if(e.elseBranch!=null){let _=e.elseBranch,g=[],d=0;for(;d<_.length;){let y=_[d];++d,g.push(D.nodeFromJson(y))}let x=g;u=new ol(Re.UNDEFINED,l,x),u.style=D.blockStyleFromString(e.elseStyle)}let p=D.extractComments(e),f=null,m=null;if(e.comments!=null){if(e.comments.elseLeading!=null){let _=e.comments.elseLeading,g=[],d=0;for(;d<_.length;){let x=_[d];++d,g.push(D.commentFromJson(x))}f=g}if(e.comments.elseTrailing!=null){let _=e.comments.elseTrailing,g=[],d=0;for(;d<_.length;){let x=_[d];++d,g.push(D.commentFromJson(x))}m=g}}return new kl(t,l,i,n,o,u,p.leading,p.trailing,f,m)}static alternativeFromJson(e){let t=D.idFromJson(e),l=D.positionFromJson(e.pos),i=D.alternativeModeFromString(e.mode),n=e.items,s=[],r=0;for(;r<n.length;){let u=n[r];++r,s.push(D.nodeFromJson(u))}let a=s,h=D.extractComments(e),o=new $l(t,l,i,a,h.leading,h.trailing);if(o.style=D.blockStyleFromString(e.style),e.separatorComments!=null){let u=e.separatorComments,p=[],f=0;for(;f<u.length;){let m=u[f];if(++f,m!=null){let _=m,g=[],d=0;for(;d<_.length;){let x=_[d];++d,g.push(D.commentFromJson(x))}p.push(g)}else p.push(null)}o.separatorComments=p}return o}static callFromJson(e){let t=D.idFromJson(e),l=D.positionFromJson(e.pos),i=D.nodeFromJson(e.target),n=e.args,s=[],r=0;for(;r<n.length;){let o=n[r];++r,s.push(D.nodeFromJson(o))}let a=s,h=D.extractComments(e);return new Vt(t,l,i,a,h.leading,h.trailing)}static transitionFromJson(e){let t=D.idFromJson(e),l=D.positionFromJson(e.pos),i=D.positionFromJson(e.targetPos),n=D.extractComments(e),s=new yl(t,l,e.target,i,n.leading,n.trailing);if(e.targetExpr!=null&&(s.targetExpr=D.nodeFromJson(e.targetExpr)),e.args!=null){let r=e.args,a=[],h=0;for(;h<r.length;){let o=r[h];++h,a.push(D.nodeFromJson(o))}s.args=a}return s}static beatCallFromJson(e){let t=D.idFromJson(e),l=D.positionFromJson(e.pos),i=D.positionFromJson(e.targetPos),n=D.nodeFromJson(e.targetExpr),s=D.extractComments(e),r=new Kl(t,l,n,i,s.leading,s.trailing);if(e.args!=null){let a=e.args,h=[],o=0;for(;o<a.length;){let u=a[o];++o,h.push(D.nodeFromJson(u))}r.args=h}return r}static insertionFromJson(e){let t=D.idFromJson(e),l=D.positionFromJson(e.pos),i=D.positionFromJson(e.targetPos),n=D.extractComments(e),s=new zl(t,l,e.target,i,n.leading,n.trailing);if(e.targetExpr!=null&&(s.targetExpr=D.nodeFromJson(e.targetExpr)),e.args!=null){let r=e.args,a=[],h=0;for(;h<r.length;){let o=r[h];++h,a.push(D.nodeFromJson(o))}s.args=a}return s}static functionDeclFromJson(e){let t=D.idFromJson(e),l=D.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=D.extractComments(e);return new jl(t,l,i,a,e.code,e.external,h.leading,h.trailing)}static literalFromJson(e){let t=D.idFromJson(e),l=D.positionFromJson(e.pos),i=e.literal,n=D.extractComments(e),s,r;switch(i){case"Array":if(s=je.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(D.nodeFromJson(p)):o.push(p)}r=o}else r=null;break;case"Boolean":s=je.Boolean,r=e.value;break;case"Null":s=je.Null,r=null;break;case"Number":s=je.Number,r=e.value;break;case"Object":let a=D.blockStyleFromString(e.style);if(s=je.Object(a),e.value!=null){let h=e.value,o=[],u=0;for(;u<h.length;){let p=h[u];++u,o.push(D.nodeFromJson(p))}r=o}else r=[];break;default:throw b.thrown("Unknown literal type: "+i)}return new Ke(t,l,r,s,n.leading,n.trailing)}static accessFromJson(e){let t=D.idFromJson(e),l=D.positionFromJson(e.pos),i=e.target!=null?D.nodeFromJson(e.target):null,n=D.extractComments(e);return new _t(t,l,i,e.name,n.leading,n.trailing)}static assignFromJson(e){let t=D.idFromJson(e),l=D.positionFromJson(e.pos),i=D.nodeFromJson(e.target),n=D.tokenTypeFromString(e.op),s=D.nodeFromJson(e.value),r=D.extractComments(e);return new bl(t,l,i,n,s,r.leading,r.trailing)}static arrayAccessFromJson(e){let t=D.idFromJson(e),l=D.positionFromJson(e.pos),i=D.nodeFromJson(e.target),n=D.nodeFromJson(e.index),s=D.extractComments(e);return new dl(t,l,i,n,s.leading,s.trailing)}static binaryFromJson(e){let t=D.idFromJson(e),l=D.positionFromJson(e.pos),i=D.nodeFromJson(e.left),n=D.tokenTypeFromString(e.op),s=D.nodeFromJson(e.right),r=D.extractComments(e);return new nl(t,l,i,n,s,r.leading,r.trailing)}static unaryFromJson(e){let t=D.idFromJson(e),l=D.positionFromJson(e.pos),i=D.tokenTypeFromString(e.op),n=D.nodeFromJson(e.operand),s=D.extractComments(e);return new ei(t,l,i,n,s.leading,s.trailing)}static ternaryFromJson(e){let t=D.idFromJson(e),l=D.positionFromJson(e.pos),i=D.nodeFromJson(e.condition),n=D.nodeFromJson(e.trueExpr),s=D.nodeFromJson(e.falseExpr),r=D.extractComments(e);return new si(t,l,i,n,s,r.leading,r.trailing)}static importStatementFromJson(e){let t=D.idFromJson(e),l=D.positionFromJson(e.pos),i=D.nodeFromJson(e.path),n=e.script!=null?D.scriptFromJson(e.script):null,s=D.extractComments(e);return new Ut(t,l,i,n,s.leading,s.trailing)}static idFromJson(e){let t=e.id;return t!=null?Re.fromString(t):Re.UNDEFINED}static positionFromJson(e){if(e==null)return new 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(D.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(D.commentFromJson(r))}l=n}return{leading:t,trailing:l}}static applyComments(e,t){let l=D.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 b.thrown("Unknown operator: "+e)}}}J["loreline.JsonToAst"]=D,D.__name__="loreline.JsonToAst";class ml{constructor(e,t){this.target=e,this.origin=t}}J["loreline.Reference"]=ml,ml.__name__="loreline.Reference",Object.assign(ml.prototype,{__class__:ml});class Zi{constructor(e){this.error=null,this.expr=null,this.lorscript=null,this.func=e,this.codeToLorscript=new ii;try{this.lorscript=this.codeToLorscript.process(e.code)}catch(t){let l=b.caught(t).unwrap();l instanceof st&&(this.error=l,this.error.pos=e.pos.withOffset(this.codeToLorscript.inputText,this.error.pos.offset,this.error.pos.length,e.pos.offset)),this.lorscript=this.codeToLorscript.output.b}try{let t=new fi;t.resumeErrors=!1,t.allowJSON=!0,t.allowTypes=!0;let l=e.name;this.expr=t.parseString(this.lorscript,l??"?")}catch(t){let l=b.caught(t).unwrap();if(this.error==null)if(l instanceof ke){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 Ri(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.inputText,this.error.pos.offset,this.error.pos.length,e.pos.offset));try{let i=new fi;i.resumeErrors=!0,i.allowJSON=!0,i.allowTypes=!0;let n=e.name;this.expr=i.parseString(this.lorscript,n??"?")}catch{}}}}J["loreline.FuncLorscript"]=Zi,Zi.__name__="loreline.FuncLorscript",Object.assign(Zi.prototype,{__class__:Zi});class Xi{constructor(e,t){this.completion=null,this.locals=null,e!=null&&(this.locals=e),t!=null&&(this.completion=t)}}J["loreline.LorscriptCompletion"]=Xi,Xi.__name__="loreline.LorscriptCompletion",Object.assign(Xi.prototype,{__class__:Xi});class Fi{constructor(e){this.lorscriptFunctions=new ni,this.childNodes=new ni,this.parentNodes=new ni,this.nodesById=new ni,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 Ut||n instanceof sl)}),l}getDialogueSpeakers(e){let t=[],l=Object.create(null);return this.traverse(e,function(i,n){if(i instanceof Ht){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,Ut);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,f,m,_,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;_=y==111||y==79}else _=!1;if(_){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);f=(x??-1)==46}else f=!1;if(f){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 f,m;if(u==null)m=!1;else{let _=u.length;if(_<8)m=!1;else{let g,d,x,y,S,C,O=c.cca(u,_-8);if((O??-1)==46){let E=c.cca(u,_-7),v=E??-1;C=v==108||v==76}else C=!1;if(C){let E=c.cca(u,_-6),v=E??-1;S=v==111||v==79}else S=!1;if(S){let E=c.cca(u,_-5),v=E??-1;y=v==114||v==82}else y=!1;if(y){let E=c.cca(u,_-4);x=(E??-1)==46}else x=!1;if(x){let E=c.cca(u,_-3),v=E??-1;d=v==116||v==84}else d=!1;if(d){let E=c.cca(u,_-2),v=E??-1;g=v==120||v==88}else g=!1;if(g){let E=c.cca(u,_-1),v=E??-1;m=v==116||v==84}else m=!1}}if(m)f=!0;else if(u==null)f=!1;else{let _=u.length;if(_<4)f=!1;else{let g,d,x=c.cca(u,_-4);if((x??-1)==46){let y=c.cca(u,_-3),S=y??-1;d=S==108||S==76}else d=!1;if(d){let y=c.cca(u,_-2),S=y??-1;g=S==111||S==79}else g=!1;if(g){let y=c.cca(u,_-1),S=y??-1;f=S==114||S==82}else f=!1}}f||(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,Ut);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 f=o.length;if(f<8)p=!1;else{let m,_,g,d,x,y,S=c.cca(o,f-8);if((S??-1)==46){let C=c.cca(o,f-7),O=C??-1;y=O==108||O==76}else y=!1;if(y){let C=c.cca(o,f-6),O=C??-1;x=O==111||O==79}else x=!1;if(x){let C=c.cca(o,f-5),O=C??-1;d=O==114||O==82}else d=!1;if(d){let C=c.cca(o,f-4);g=(C??-1)==46}else g=!1;if(g){let C=c.cca(o,f-3),O=C??-1;_=O==116||O==84}else _=!1;if(_){let C=c.cca(o,f-2),O=C??-1;m=O==120||O==88}else m=!1;if(m){let C=c.cca(o,f-1),O=C??-1;p=O==116||O==84}else p=!1}}if(p){let f=o.length-8;u=f!=null?c.substr(o,0,f):c.substr(o,0,null)}else{let f;if(o==null)f=!1;else{let m=o.length;if(m<4)f=!1;else{let _,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;_=y==111||y==79}else _=!1;if(_){let x=c.cca(o,m-1),y=x??-1;f=y==114||y==82}else f=!1}}if(f){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,Ut);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,f,m,_=c.cca(s,a-8);if((_??-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;f=d==111||d==79}else f=!1;if(f){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 f=c.cca(s,h-3),m=f??-1;u=m==108||m==76}else u=!1;if(u){let f=c.cca(s,h-2),m=f??-1;o=m==111||m==79}else o=!1;if(o){let f=c.cca(s,h-1),m=f??-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 Se),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,f,m,_,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;_=y==111||y==79}else _=!1;if(_){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);f=(x??-1)==46}else f=!1;if(f){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 Ut){let u=o,p,f=u.path.parts[0].partType;f._hx_index==0?p=f.text:p="",De.isAbsolute(p)||(p=De.join([n,p])),p=De.normalize(p);let m,_;if(p==null)_=!1;else{let g=p.length;if(g<8)_=!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;_=N==116||N==84}else _=!1}}if(_)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 _t?t=this.resolveAccess(e.target):e.target instanceof dl&&(t=this.resolveArrayAccess(e.target)),t==null)return null;switch(te.getClass(t)){case Ke:let l=t;if(l.literalType==je.Array){let n=l.value;if(e.index instanceof Ke){let s=e.index;if(s.literalType==je.Number){let r=s.value|0;if(r>=0&&r<n.length){let a=n[r];if(a instanceof ut)return a}}}}break;case ql:let i=t;if(i.value instanceof Ke){let n=i.value;if(n.literalType==je.Array){let s=n.value;if(e.index instanceof Ke){let r=e.index;if(r.literalType==je.Number){let a=r.value|0;if(a>=0&&a<s.length){let h=s[a];if(h instanceof ut)return h}}}}}break;default:}return null}resolveAccess(e){if(e.target!=null){let a=e.target instanceof _t?this.resolveAccess(e.target):e.target instanceof dl?this.resolveArrayAccess(e.target):null;if(a!=null)switch(a instanceof ql&&(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 Ke:let p=a,f=p.literalType;if(f._hx_index==4){let m=f.style,_=p.value,g=0;for(;g<_.length;){let d=_[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,Be);for(;l!=null;){let a=null;if(this.traverse(l,function(h,o){if(a!=null)return!1;if(h instanceof Yt){let u=h,p=0,f=u.fields;for(;p<f.length;){let m=f[p];if(++p,m.name==t)return a=m,!1}}return!0}),a!=null)return a;l=this.getFirstParentOfType(l,Be)}let i=null;if(this.traverse(this.script,function(a,h){if(i!=null)return!1;if(a instanceof Yt){let o=a,u=0,p=o.fields;for(;u<p.length;){let f=p[u];if(++u,f.name==t)return i=f,!1}}return a instanceof Ut?!0:a instanceof sl}),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}findBeatParamFromAccess(e){if(e.target!=null||e.name==null)return null;let t=this.getFirstParentOfType(e,Be);for(;t!=null;){if(t.params!=null){let l=0,i=t.params;for(;l<i.length;){let n=i[l];if(++l,n.name==e.name)return{param:n,beat:t}}}t=this.getFirstParentOfType(t,Be)}return null}findCallArgument(e){let t=e,l=this.getParentNode(t);for(;l!=null;){switch(te.getClass(l)){case Kl:let i=l;if(i.args!=null){let a=i.args.indexOf(t);if(a!=-1)return{owner:l,index:a}}return null;case Vt:let n=l;if(n.args!=null){let a=n.args.indexOf(t);if(a!=-1)return{owner:l,index:a}}return null;case zl:let s=l;if(s.args!=null){let a=s.args.indexOf(t);if(a!=-1)return{owner:l,index:a}}return null;case yl:let r=l;if(r.args!=null){let a=r.args.indexOf(t);if(a!=-1)return{owner:l,index:a}}return null;default:if(!(l instanceof ct))return null}t=l,l=this.getParentNode(t)}return null}findBeatFromTransition(e){return e.targetExpr!=null?null:this.findBeatByNameFromNode(e.target,e)}findBeatFromInsertion(e){return e.targetExpr!=null?null: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 Be){let o=a;return o.name==s&&(r=o),!1}else return r==null}),i=r,++n}return i}isTopLevelNode(e){if(e instanceof Fe){let t=e;return this.script.body.indexOf(t)!=-1}return!1}findTopLevelBeatFromNode(e){if(this.isTopLevelNode(e))return e instanceof Be?e:null;{let t=this.getFirstParentOfType(e,Be);for(;t!=null&&!this.isTopLevelNode(t);)t=this.getFirstParentOfType(t,Be);if(t!=null&&t instanceof Be)return t}return null}findBeatByNameFromNode(e,t){let l=null,i=this.getFirstParentOfType(t,Be);for(;i!=null;)this.traverse(i,function(n,s){if(l!=null||n==t)return!1;if(n instanceof Be){let r=n;return r.name==e&&(l=r),!1}return!0}),i=this.getFirstParentOfType(i,Be);return l==null&&this.traverse(this.script,function(n,s){if(l==null&&n instanceof Be){let r=n;r.name==e&&(l=r)}return n instanceof Ut?!0:n instanceof sl}),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 Ut?!0:i instanceof sl}),l}findFunctionByNameFromNode(e,t){let l=null;return this.traverse(this.script,function(i,n){if(l==null&&i instanceof jl){let s=i;s.name==e&&(l=s)}return i instanceof Ut?!0:i instanceof sl}),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 jl&&e.push(l)}return e}getVisibleStateFields(e){let t=[],l=new Ol,i=e;for(;i!=null;){if(te.getClass(i)==Yt){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)==Yt){let r=n;if(s instanceof sl){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)==Be&&this.getParentNode(i)!=null){let s=0,r=this.getNodesOfType(Be);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)==Be&&s instanceof sl){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 Fe?a:null;if(o!=null&&o.trailingComments!=null){let u=0,p=o.trailingComments;for(;u<p.length;){let f=p[u];if(++u,f.isHash){let m=He.trim(f.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 Se;return this.script.each(function(t,l){let i=t instanceof Fe?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 Ol,l=this;this.traverse(e,function(r,a){switch(te.getClass(r)){case Vt:let h=r;if(h.target instanceof _t){let p=h.target;if(p.target==null){let f=l.findBeatFromAccess(p);if(f!=null){let m=f.id,_=new ml(f,h),g=m.thisVal;t._set(g.high,g.low,_)}}}break;case zl:let o=r;if(o.targetExpr==null){let p=l.findBeatByNameFromNode(o.target,o);if(p!=null){let f=p.id,m=new ml(p,o),_=f.thisVal;t._set(_.high,_.low,m)}}break;case yl:let u=r;if(u.targetExpr==null){let p=l.findBeatByNameFromNode(u.target,u);if(p!=null){let f=p.id,m=new ml(p,u),_=f.thisVal;t._set(_.high,_.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 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 Vt:let s=i;if(s.target instanceof _t){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 ml(e,s))}}break;case zl:let r=i;r.target==e.name&&t.push(new ml(e,r));break;case yl:let a=i;a.target==e.name&&t.push(new ml(e,a));break;default:}}),t}findModifiedStateFields(e){let t=Object.create(null),l=this;this.traverse(e,function(u,p){if(te.getClass(u)==bl){let f=u;if(f.target instanceof _t){let m=f.target,_=l.findStateField(m);if(_!=null){let g=_.name,d=new ml(_,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 f=u.target.name.toLowerCase(),m=p.target.name.toLowerCase();return f<m?-1:f>m?1:0}),o}findReadStateFields(e){let t=Object.create(null),l=this;this.traverse(e,function(u,p){if(te.getClass(u)==_t){let f=u;if(p instanceof bl&&p.target==u)return!0;let m=l.findStateField(f);if(m!=null){let _=m.name,g=new ml(m,f);t[_]=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 f=u.target.name.toLowerCase(),m=p.target.name.toLowerCase();return f<m?-1:f>m?1:0}),o}findBeatCharacters(e){let t=new Ol,l=this;this.traverse(e,function(a,h){switch(te.getClass(a)){case _t:let o=a;if(o.target==null){let f=l.findCharacterByNameFromNode(o.name,o);if(f!=null){let m=f.id,_=new ml(f,o),g=m.thisVal;t._set(g.high,g.low,_)}}break;case Ht:let u=a,p=l.findCharacterFromDialogue(u);if(p!=null){let f=p.id,m=new ml(p,u),_=f.thisVal;t._set(_.high,_.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 Ol,l=[],i=this;return this.traverse(e,function(n,s){if(te.getClass(n)==bl){let r=n;if(r.target instanceof _t){let a=r.target,h=i.resolveAccess(a);if(h instanceof ql){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 ml(h,n))}}}}return!0}),l}findReadCharacterFields(e){let t=new Ol,l=[],i=this;return this.traverse(e,function(n,s){if(te.getClass(n)==_t){let r=n,a=i.getParentNode(r);if(a instanceof bl&&a.target==r)return!0;let h=i.resolveAccess(r);if(h instanceof ql){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 ml(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 Zi(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),_n.iter(r,s)}},_n.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(f,m){if(n!=null)return!1;if(f instanceof Yt){let _=f,g=0,d=_.fields;for(;g<d.length;){let x=d[g];if(++g,x.name==i)return n=x,!1}}return f instanceof Ut?!0:f instanceof sl}),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 ql&&(o=o.value),te.getClass(o)){case Jt:let f=o,m=0,_=f.fields;for(;m<_.length;){let x=_[m];if(++m,x.name==h)return x}break;case Ke: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(Ae.field(e,"e"),j):!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="",f=0,m=h-u;for(;f<m;){let x=f++;p+=String.fromCodePoint(32)}a=p+a;let _=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=b.caught(x).unwrap();y instanceof Vi&&(_=y)}let d=g.locals;return new Xi(d,_)}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}}J["loreline.Lens"]=Fi,Fi.__name__="loreline.Lens",Object.assign(Fi.prototype,{__class__:Fi});class pi extends st{constructor(e,t){super(e,t)}}J["loreline.LexerError"]=pi,pi.__name__="loreline.LexerError",pi.__super__=st,Object.assign(pi.prototype,{__class__:pi});var Al=Ye["loreline.LStringAttachment"]={__ename__:"loreline.LStringAttachment",__constructs__:null,Interpolation:(w=function(T,e,t,l,i){return{_hx_index:0,braces:T,inTag:e,expr:t,start:l,length:i,__enum__:"loreline.LStringAttachment",toString:M}},w._hx_name="Interpolation",w.__params__=["braces","inTag","expr","start","length"],w),Tag:(w=function(T,e,t){return{_hx_index:1,closing:T,start:e,length:t,__enum__:"loreline.LStringAttachment",toString:M}},w._hx_name="Tag",w.__params__=["closing","start","length"],w)};Al.__constructs__=[Al.Interpolation,Al.Tag];class Dl{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:M},KwState:{_hx_name:"KwState",_hx_index:1,__enum__:"loreline.TokenType",toString:M},KwBeat:{_hx_name:"KwBeat",_hx_index:2,__enum__:"loreline.TokenType",toString:M},KwCharacter:{_hx_name:"KwCharacter",_hx_index:3,__enum__:"loreline.TokenType",toString:M},KwChoice:{_hx_name:"KwChoice",_hx_index:4,__enum__:"loreline.TokenType",toString:M},KwIf:{_hx_name:"KwIf",_hx_index:5,__enum__:"loreline.TokenType",toString:M},KwElse:{_hx_name:"KwElse",_hx_index:6,__enum__:"loreline.TokenType",toString:M},KwNew:{_hx_name:"KwNew",_hx_index:7,__enum__:"loreline.TokenType",toString:M},KwSequence:{_hx_name:"KwSequence",_hx_index:8,__enum__:"loreline.TokenType",toString:M},KwCycle:{_hx_name:"KwCycle",_hx_index:9,__enum__:"loreline.TokenType",toString:M},KwOnce:{_hx_name:"KwOnce",_hx_index:10,__enum__:"loreline.TokenType",toString:M},KwPick:{_hx_name:"KwPick",_hx_index:11,__enum__:"loreline.TokenType",toString:M},KwShuffle:{_hx_name:"KwShuffle",_hx_index:12,__enum__:"loreline.TokenType",toString:M},Separator:{_hx_name:"Separator",_hx_index:13,__enum__:"loreline.TokenType",toString:M},Function:(w=function(T,e,t,l){return{_hx_index:14,name:T,args:e,code:t,external:l,__enum__:"loreline.TokenType",toString:M}},w._hx_name="Function",w.__params__=["name","args","code","external"],w),LString:(w=function(T,e,t){return{_hx_index:15,quotes:T,s:e,attachments:t,__enum__:"loreline.TokenType",toString:M}},w._hx_name="LString",w.__params__=["quotes","s","attachments"],w),LNumber:(w=function(T){return{_hx_index:16,n:T,__enum__:"loreline.TokenType",toString:M}},w._hx_name="LNumber",w.__params__=["n"],w),LBoolean:(w=function(T){return{_hx_index:17,b:T,__enum__:"loreline.TokenType",toString:M}},w._hx_name="LBoolean",w.__params__=["b"],w),LNull:{_hx_name:"LNull",_hx_index:18,__enum__:"loreline.TokenType",toString:M},Identifier:(w=function(T){return{_hx_index:19,name:T,__enum__:"loreline.TokenType",toString:M}},w._hx_name="Identifier",w.__params__=["name"],w),OpAssign:{_hx_name:"OpAssign",_hx_index:20,__enum__:"loreline.TokenType",toString:M},OpPlusAssign:{_hx_name:"OpPlusAssign",_hx_index:21,__enum__:"loreline.TokenType",toString:M},OpMinusAssign:{_hx_name:"OpMinusAssign",_hx_index:22,__enum__:"loreline.TokenType",toString:M},OpMultiplyAssign:{_hx_name:"OpMultiplyAssign",_hx_index:23,__enum__:"loreline.TokenType",toString:M},OpDivideAssign:{_hx_name:"OpDivideAssign",_hx_index:24,__enum__:"loreline.TokenType",toString:M},OpUnquotedAssign:{_hx_name:"OpUnquotedAssign",_hx_index:25,__enum__:"loreline.TokenType",toString:M},OpPlus:{_hx_name:"OpPlus",_hx_index:26,__enum__:"loreline.TokenType",toString:M},OpMinus:{_hx_name:"OpMinus",_hx_index:27,__enum__:"loreline.TokenType",toString:M},OpMultiply:{_hx_name:"OpMultiply",_hx_index:28,__enum__:"loreline.TokenType",toString:M},OpDivide:{_hx_name:"OpDivide",_hx_index:29,__enum__:"loreline.TokenType",toString:M},OpModulo:{_hx_name:"OpModulo",_hx_index:30,__enum__:"loreline.TokenType",toString:M},OpEquals:{_hx_name:"OpEquals",_hx_index:31,__enum__:"loreline.TokenType",toString:M},OpNotEquals:{_hx_name:"OpNotEquals",_hx_index:32,__enum__:"loreline.TokenType",toString:M},OpGreater:{_hx_name:"OpGreater",_hx_index:33,__enum__:"loreline.TokenType",toString:M},OpLess:{_hx_name:"OpLess",_hx_index:34,__enum__:"loreline.TokenType",toString:M},OpGreaterEq:{_hx_name:"OpGreaterEq",_hx_index:35,__enum__:"loreline.TokenType",toString:M},OpLessEq:{_hx_name:"OpLessEq",_hx_index:36,__enum__:"loreline.TokenType",toString:M},OpAnd:(w=function(T){return{_hx_index:37,word:T,__enum__:"loreline.TokenType",toString:M}},w._hx_name="OpAnd",w.__params__=["word"],w),OpOr:(w=function(T){return{_hx_index:38,word:T,__enum__:"loreline.TokenType",toString:M}},w._hx_name="OpOr",w.__params__=["word"],w),OpNot:{_hx_name:"OpNot",_hx_index:39,__enum__:"loreline.TokenType",toString:M},Arrow:{_hx_name:"Arrow",_hx_index:40,__enum__:"loreline.TokenType",toString:M},Colon:{_hx_name:"Colon",_hx_index:41,__enum__:"loreline.TokenType",toString:M},Question:{_hx_name:"Question",_hx_index:42,__enum__:"loreline.TokenType",toString:M},Comma:{_hx_name:"Comma",_hx_index:43,__enum__:"loreline.TokenType",toString:M},Dot:{_hx_name:"Dot",_hx_index:44,__enum__:"loreline.TokenType",toString:M},LBrace:{_hx_name:"LBrace",_hx_index:45,__enum__:"loreline.TokenType",toString:M},RBrace:{_hx_name:"RBrace",_hx_index:46,__enum__:"loreline.TokenType",toString:M},LParen:{_hx_name:"LParen",_hx_index:47,__enum__:"loreline.TokenType",toString:M},RParen:{_hx_name:"RParen",_hx_index:48,__enum__:"loreline.TokenType",toString:M},LBracket:{_hx_name:"LBracket",_hx_index:49,__enum__:"loreline.TokenType",toString:M},RBracket:{_hx_name:"RBracket",_hx_index:50,__enum__:"loreline.TokenType",toString:M},CommentLine:(w=function(T){return{_hx_index:51,content:T,__enum__:"loreline.TokenType",toString:M}},w._hx_name="CommentLine",w.__params__=["content"],w),CommentMultiLine:(w=function(T){return{_hx_index:52,content:T,__enum__:"loreline.TokenType",toString:M}},w._hx_name="CommentMultiLine",w.__params__=["content"],w),CommentHash:(w=function(T){return{_hx_index:53,content:T,__enum__:"loreline.TokenType",toString:M}},w._hx_name="CommentHash",w.__params__=["content"],w),Indent:{_hx_name:"Indent",_hx_index:54,__enum__:"loreline.TokenType",toString:M},Unindent:{_hx_name:"Unindent",_hx_index:55,__enum__:"loreline.TokenType",toString:M},LineBreak:{_hx_name:"LineBreak",_hx_index:56,__enum__:"loreline.TokenType",toString:M},Eof:{_hx_name:"Eof",_hx_index:57,__enum__:"loreline.TokenType",toString:M}};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 Mt{static equals(e,t){switch(e._hx_index){case 1:return t._hx_index==1?!0:me.enumEq(e,t);case 2:return t._hx_index==2?!0:me.enumEq(e,t);case 3:return t._hx_index==3?!0:me.enumEq(e,t);case 4:return t._hx_index==4?!0:me.enumEq(e,t);case 5:return t._hx_index==5?!0:me.enumEq(e,t);case 6:return t._hx_index==6?!0:me.enumEq(e,t);case 7:return t._hx_index==7?!0:me.enumEq(e,t);case 8:return t._hx_index==8?!0:me.enumEq(e,t);case 9:return t._hx_index==9?!0:me.enumEq(e,t);case 10:return t._hx_index==10?!0:me.enumEq(e,t);case 11:return t._hx_index==11?!0:me.enumEq(e,t);case 12:return t._hx_index==12?!0:me.enumEq(e,t);case 13:return t._hx_index==13?!0:me.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 me.enumEq(e,t);break;case 16:if(t._hx_index==16){let r=t.n;return e.n==r}else return me.enumEq(e,t);break;case 17:if(t._hx_index==17){let r=t.b;return e.b==r}else return me.enumEq(e,t);break;case 18:return t._hx_index==18?!0:me.enumEq(e,t);case 19:if(t._hx_index==19){let r=t.name;return e.name==r}else return me.enumEq(e,t);break;case 20:return t._hx_index==20?!0:me.enumEq(e,t);case 21:return t._hx_index==21?!0:me.enumEq(e,t);case 22:return t._hx_index==22?!0:me.enumEq(e,t);case 23:return t._hx_index==23?!0:me.enumEq(e,t);case 24:return t._hx_index==24?!0:me.enumEq(e,t);case 25:return t._hx_index==25?!0:me.enumEq(e,t);case 26:return t._hx_index==26?!0:me.enumEq(e,t);case 27:return t._hx_index==27?!0:me.enumEq(e,t);case 28:return t._hx_index==28?!0:me.enumEq(e,t);case 29:return t._hx_index==29?!0:me.enumEq(e,t);case 30:return t._hx_index==30?!0:me.enumEq(e,t);case 31:return t._hx_index==31?!0:me.enumEq(e,t);case 32:return t._hx_index==32?!0:me.enumEq(e,t);case 33:return t._hx_index==33?!0:me.enumEq(e,t);case 34:return t._hx_index==34?!0:me.enumEq(e,t);case 35:return t._hx_index==35?!0:me.enumEq(e,t);case 36:return t._hx_index==36?!0:me.enumEq(e,t);case 37:let n=e.word;if(t._hx_index==37){let r=t.word;return!0}else return me.enumEq(e,t);break;case 38:let s=e.word;if(t._hx_index==38){let r=t.word;return!0}else return me.enumEq(e,t);break;case 39:return t._hx_index==39?!0:me.enumEq(e,t);case 40:return t._hx_index==40?!0:me.enumEq(e,t);case 41:return t._hx_index==41?!0:me.enumEq(e,t);case 42:return t._hx_index==42?!0:me.enumEq(e,t);case 44:return t._hx_index==44?!0:me.enumEq(e,t);case 45:return t._hx_index==45?!0:me.enumEq(e,t);case 46:return t._hx_index==46?!0:me.enumEq(e,t);case 47:return t._hx_index==47?!0:me.enumEq(e,t);case 48:return t._hx_index==48?!0:me.enumEq(e,t);case 49:return t._hx_index==49?!0:me.enumEq(e,t);case 50:return t._hx_index==50?!0:me.enumEq(e,t);case 51:if(t._hx_index==51){let r=t.content;return e.content==r}else return me.enumEq(e,t);break;case 52:if(t._hx_index==52){let r=t.content;return e.content==r}else return me.enumEq(e,t);break;case 53:if(t._hx_index==53){let r=t.content;return e.content==r}else return me.enumEq(e,t);break;case 54:return t._hx_index==54?!0:me.enumEq(e,t);case 55:return t._hx_index==55?!0:me.enumEq(e,t);case 56:return t._hx_index==56?!0:me.enumEq(e,t);case 57:return t._hx_index==57?!0:me.enumEq(e,t);default:return me.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 _=e.content;return"multiline comment";case 53:let g=e.content;return"hash comment";case 54:return"indent";case 55:return"unindent";case 56:return"line break";case 57:return"end of file"}}}J["loreline.TokenTypeHelpers"]=Mt,Mt.__name__="loreline.TokenTypeHelpers";class Ce{constructor(e,t){this.type=e,this.pos=t}toString(){return""+Y.string(this.type)+" at "+this.pos.toString()}}J["loreline.Token"]=Ce,Ce.__name__="loreline.Token",Object.assign(Ce.prototype,{__class__:Ce});class Ct{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 Ce(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:let l=e.length-2;e:for(;l>=0;){let h=e[l].type;switch(h._hx_index){case 51:let o=h.content;--l;break;case 52:let u=h.content;--l;break;default:break e}}let i;if(l>=0)switch(e[l].type._hx_index){case 26:case 40:i=!0;break;default:i=!1}else i=!1;let n=this.pos;for(;n<this.length;){let h=c.cca(this.input,n),o=h??-1;if(o==32||o==9)++n;else break}let s;if(n<this.length){let h=c.cca(this.input,n);s=(h??-1)==40}else s=!1;!i&&!s&&(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 r;switch(this.nextBlock){case 0:case 1:r=0;break;case 2:case 3:r=2;break;case 4:case 5:r=4;break;case 6:case 7:r=7;break;case 8:case 9:r=8;break;case 10:case 11:case 12:r=10;break}this.stack.push(r),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 a;switch(this.nextBlock){case 0:case 1:a=1;break;case 2:case 3:a=3;break;case 4:case 5:a=5;break;case 6:case 7:a=7;break;case 8:case 9:a=9;break;case 10:case 11:case 12:a=11;break}this.stack.push(a),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 Ce(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 Ce(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 Ce(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 Ce(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 Ce(k.LBrace,u);return this.previous=p,p;case 125:let f=0,m=1;for(;f<m;){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++}let _=l;_==null&&(_=new ue(this.startLine,this.startColumn,this.pos)),_.length=this.pos-_.offset;let g=new Ce(k.RBrace,_);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 K=c.cca(this.input,this.pos+1);se=K??-1}else se=0;if(se==61){let K=2;K==null&&(K=1);let ie=0,le=K;for(;ie<le;){let ge=ie++;if(this.pos>=this.length)break;let ye=c.cca(this.input,this.pos);(ye??-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 Ce(k.OpNotEquals,ee);return this.previous=pe,pe}else{let K=0,ie=1;for(;K<ie;){let pe=K++;if(this.pos>=this.length)break;let ge=c.cca(this.input,this.pos);(ge??-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 Ce(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 K=c.cca(this.input,this.pos+1);se=K??-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,K=1;for(;se<K;){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 Ce(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 K=c.cca(this.input,this.pos+1);se=K??-1}else se=0;if(se==38){let K=2;K==null&&(K=1);let ie=0,le=K;for(;ie<le;){let ge=ie++;if(this.pos>=this.length)break;let ye=c.cca(this.input,this.pos);(ye??-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 Ce(k.OpAnd(!1),ee);return this.previous=pe,pe}else{let K=0,ie=1;for(;K<ie;){let pe=K++;if(this.pos>=this.length)break;let ge=c.cca(this.input,this.pos);(ge??-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 Ce(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 Ce(k.LParen,v);return this.previous=N,N;case 41:let L=0,B=1;for(;L<B;){let $=L++;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 Ce(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 K=c.cca(this.input,this.pos+1);se=K??-1}else se=0;if(se==61){let K=2;K==null&&(K=1);let ie=0,le=K;for(;ie<le;){let ge=ie++;if(this.pos>=this.length)break;let ye=c.cca(this.input,this.pos);(ye??-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 Ce(k.OpMultiplyAssign,ee);return this.previous=pe,pe}else{let K=0,ie=1;for(;K<ie;){let pe=K++;if(this.pos>=this.length)break;let ge=c.cca(this.input,this.pos);(ge??-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 Ce(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 K=c.cca(this.input,this.pos+1);se=K??-1}else se=0;if(se==61){let K=2;K==null&&(K=1);let ie=0,le=K;for(;ie<le;){let ge=ie++;if(this.pos>=this.length)break;let ye=c.cca(this.input,this.pos);(ye??-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 Ce(k.OpPlusAssign,ee);return this.previous=pe,pe}else{let K=0,ie=1;for(;K<ie;){let pe=K++;if(this.pos>=this.length)break;let ge=c.cca(this.input,this.pos);(ge??-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 Ce(k.OpPlus,le);return this.previous=ee,ee}}}break;case 44:let A=0,F=1;for(;A<F;){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++}let R=l;R==null&&(R=new ue(this.startLine,this.startColumn,this.pos)),R.length=this.pos-R.offset;let V=new Ce(k.Comma,R);return this.previous=V,V;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 K=c.cca(this.input,this.pos+1);se=K??-1}else se=0;if(se==62){let K=2;K==null&&(K=1);let ie=0,le=K;for(;ie<le;){let ge=ie++;if(this.pos>=this.length)break;let ye=c.cca(this.input,this.pos);(ye??-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 Ce(k.Arrow,ee);return this.previous=pe,pe}else{let K;if(this.pos+1<this.length){let ie=c.cca(this.input,this.pos+1);K=ie??-1}else K=0;if(K==45&&this.strictExprs.length==0){let ie=2;ie==null&&(ie=1);let le=0,ee=ie;for(;le<ee;){let ye=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 ge=new Ce(k.Separator,pe);return this.previous=ge,ge}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 Tt=c.cca(this.input,this.pos);(Tt??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ge=l;ge==null&&(ge=new ue(this.startLine,this.startColumn,this.pos)),ge.length=this.pos-ge.offset;let ye=new Ce(k.OpMinusAssign,ge);return this.previous=ye,ye}else{let le=0,ee=1;for(;le<ee;){let ye=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 ge=new Ce(k.OpMinus,pe);return this.previous=ge,ge}}}}}break;case 46:let H=0,G=1;for(;H<G;){let $=H++;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 he=new Ce(k.Dot,X);return this.previous=he,he;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 K=c.cca(this.input,this.pos+1);se=K??-1}else se=0;if(se==61){let K=2;K==null&&(K=1);let ie=0,le=K;for(;ie<le;){let ge=ie++;if(this.pos>=this.length)break;let ye=c.cca(this.input,this.pos);(ye??-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 Ce(k.OpDivideAssign,ee);return this.previous=pe,pe}else{let K;if(this.pos+1<this.length){let ie=c.cca(this.input,this.pos+1);K=ie??-1}else K=0;if(K==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 ye=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 ge=new Ce(k.OpDivide,pe);return this.previous=ge,ge}}}}}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,K=$;for(;se<K;){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 Ce(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 K=l;K==null&&(K=new ue(this.startLine,this.startColumn,this.pos)),K.length=this.pos-K.offset;let ie=new Ce(k.Colon,K);return this.previous=ie,ie}break;case 60:let ae=t;if(ae>=48&&ae<=57)return this.readNumber();{let $=t;if($>=97&&$<=122||$>=65&&$<=90||$==95)return this.readIdentifier();{let se;if(this.pos+1<this.length){let K=c.cca(this.input,this.pos+1);se=K??-1}else se=0;if(se==61){let K=2;K==null&&(K=1);let ie=0,le=K;for(;ie<le;){let ge=ie++;if(this.pos>=this.length)break;let ye=c.cca(this.input,this.pos);(ye??-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 Ce(k.OpLessEq,ee);return this.previous=pe,pe}else{let K=0,ie=1;for(;K<ie;){let pe=K++;if(this.pos>=this.length)break;let ge=c.cca(this.input,this.pos);(ge??-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 Ce(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 K=c.cca(this.input,this.pos+1);se=K??-1}else se=0;if(se==61){let K=2;K==null&&(K=1);let ie=0,le=K;for(;ie<le;){let ge=ie++;if(this.pos>=this.length)break;let ye=c.cca(this.input,this.pos);(ye??-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 Ce(k.OpEquals,ee);return this.previous=pe,pe}else{let K=0,ie=1;for(;K<ie;){let pe=K++;if(this.pos>=this.length)break;let ge=c.cca(this.input,this.pos);(ge??-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 Ce(k.OpAssign,le);return this.previous=ee,ee}}}break;case 62:let Ie=t;if(Ie>=48&&Ie<=57)return this.readNumber();{let $=t;if($>=97&&$<=122||$>=65&&$<=90||$==95)return this.readIdentifier();{let se;if(this.pos+1<this.length){let K=c.cca(this.input,this.pos+1);se=K??-1}else se=0;if(se==61){let K=2;K==null&&(K=1);let ie=0,le=K;for(;ie<le;){let ge=ie++;if(this.pos>=this.length)break;let ye=c.cca(this.input,this.pos);(ye??-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 Ce(k.OpGreaterEq,ee);return this.previous=pe,pe}else{let K=0,ie=1;for(;K<ie;){let pe=K++;if(this.pos>=this.length)break;let ge=c.cca(this.input,this.pos);(ge??-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 Ce(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 K=new Ce(k.Question,se);return this.previous=K,K}}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 qe=l;qe==null&&(qe=new ue(this.startLine,this.startColumn,this.pos)),qe.length=this.pos-qe.offset;let Qe=new Ce(k.RBracket,qe);return this.previous=Qe,Qe;case 124:let rt=t;if(rt>=48&&rt<=57)return this.readNumber();{let $=t;if($>=97&&$<=122||$>=65&&$<=90||$==95)return this.readIdentifier();{let se;if(this.pos+1<this.length){let K=c.cca(this.input,this.pos+1);se=K??-1}else se=0;if(se==124){let K=2;K==null&&(K=1);let ie=0,le=K;for(;ie<le;){let ge=ie++;if(this.pos>=this.length)break;let ye=c.cca(this.input,this.pos);(ye??-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 Ce(k.OpOr(!1),ee);return this.previous=pe,pe}else{let K=0,ie=1;for(;K<ie;){let pe=K++;if(this.pos>=this.length)break;let ge=c.cca(this.input,this.pos);(ge??-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 Ce(k.OpOr(!1),le);return this.previous=ee,ee}}}break;default:let Ve=t;if(Ve>=48&&Ve<=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 Ce(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),f=p??-1;r=f>=48&&f<=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),f=p??-1;a=!(f>=48&&f<=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 C=c.cca(this.input,e),O=C??-1;if(O>=48&&O<=57)for(;;){let E;if(e<this.length){let v=c.cca(this.input,e),N=v??-1;if(N>=48&&N<=57)E=!0;else{let L=c.cca(this.input,e);E=(L??-1)==46}}else E=!1;if(!E)break;++e}else{let E=!0,v=h.length;if(e>=v)E=!1;else{let N,L,B;if(e+1<v){let I=c.cca(h.input,e);B=(I??-1)==111}else B=!1;if(B){let I=c.cca(h.input,e+1);L=(I??-1)==114}else L=!1;if(L)if(e+2<v){let I=c.cca(h.input,e+2),q=I??-1;N=!(q>=97&&q<=122||q>=65&&q<=90||q==95)}else N=!0;else N=!1;if(N)E=!1;else{let I,q,z,P;if(e+2<v){let A=c.cca(h.input,e);P=(A??-1)==97}else P=!1;if(P){let A=c.cca(h.input,e+1);z=(A??-1)==110}else z=!1;if(z){let A=c.cca(h.input,e+2);q=(A??-1)==100}else q=!1;if(q)if(e+3<v){let A=c.cca(h.input,e+3),F=A??-1;I=!(F>=97&&F<=122||F>=65&&F<=90||F==95)}else I=!0;else I=!1;if(I)E=!1;else{let A=c.cca(h.input,e),F=A??-1;if(!(F>=97&&F<=122||F>=65&&F<=90||F==95))E=!1;else for(++e;e<h.length;){let R=c.cca(h.input,e);if(F=R??-1,!(F>=97&&F<=122||F>=65&&F<=90||F==95||F>=48&&F<=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;for(;p==46||p==91;){if(p==46){++e,e=this._skipWhitespaceAndComments(e,!1);let O=!0,E=h.length;if(e>=E)O=!1;else{let v,N,L;if(e+1<E){let B=c.cca(h.input,e);L=(B??-1)==111}else L=!1;if(L){let B=c.cca(h.input,e+1);N=(B??-1)==114}else N=!1;if(N)if(e+2<E){let B=c.cca(h.input,e+2),I=B??-1;v=!(I>=97&&I<=122||I>=65&&I<=90||I==95)}else v=!0;else v=!1;if(v)O=!1;else{let B,I,q,z;if(e+2<E){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<E){let P=c.cca(h.input,e+3),A=P??-1;B=!(A>=97&&A<=122||A>=65&&A<=90||A==95)}else B=!0;else B=!1;if(B)O=!1;else{let P=c.cca(h.input,e),A=P??-1;if(!(A>=97&&A<=122||A>=65&&A<=90||A==95))O=!1;else for(++e;e<h.length;){let F=c.cca(h.input,e);if(A=F??-1,!(A>=97&&A<=122||A>=65&&A<=90||A==95||A>=48&&A<=57))break;++e}}}}if(!O)return!0}else{++e;let O=1;for(;e<this.length&&O>0;){let E=c.cca(this.input,e);p=E??-1,p==91&&++O,p==93&&--O,++e}}if(e=this._skipWhitespaceAndComments(e,!1),e>=this.length)return!0;let C=c.cca(this.input,e);p=C??-1}let f,m,_;if(p==97){let C=c.cca(this.input,e+1);_=(C??-1)==110}else _=!1;if(_){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;f=!(O>=97&&O<=122||O>=65&&O<=90||O==95)}else f=!0;else f=!1;if(f)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),L=N??-1;v=L==32||L==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),f=p??-1;if(u=f==95,!(f>=97&&f<=122||f>=65&&f<=90||f==95))o=!1;else for(++e;e<i.length;){let m=u,_=c.cca(i.input,e);if(f=_??-1,u=f==95,!(f>=97&&f<=122||f>=65&&f<=90||f==95||f>=48&&f<=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 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}let a;if(e<this.length){let h=c.cca(this.input,e);a=(h??-1)==40}else a=!1;if(a&&(e=this.skipBalancedParens(e,this.parentBlockType()==k.KwBeat),e==-1))return!1}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 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}let r;if(e<this.length){let a=c.cca(this.input,e);r=(a??-1)==40}else r=!1;if(r&&(e=this.skipBalancedParens(e,this.parentBlockType()==k.KwBeat),e==-1))return!1}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(Ct.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 f=c.cca(l.input,e),m=f??-1;if(!(m>=97&&m<=122||m>=65&&m<=90||m==95))h=!1;else for(++e;e<l.length;){let _=c.cca(l.input,e);if(m=_??-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 f=c.cca(l.input,o);p=(f??-1)==105}else p=!1;if(p){let f=c.cca(l.input,o+1);u=(f??-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 f=c.cca(l.input,e),m=f??-1;if(!(m>=97&&m<=122||m>=65&&m<=90||m==95))h=!1;else for(++e;e<l.length;){let _=c.cca(l.input,e);if(m=_??-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 f=c.cca(l.input,o);p=(f??-1)==105}else p=!1;if(p){let f=c.cca(l.input,o+1);u=(f??-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(!Mt.isComment(l.type)&&(e||l.type!=k.LineBreak&&l.type!=k.Indent&&l.type!=k.Unindent))return l.type==k.Colon&&t>0&&Mt.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 f,m=c.cca(this.input,i),_=m??-1;if(_==32||_==9)f=!0;else{let g=c.cca(this.input,i);if((g??-1)==47){let d=c.cca(this.input,i+1);f=(d??-1)==47}else f=!1}return f?-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,_;if(e<this.length){let g=c.cca(this.input,e);_=(g??-1)!=13}else _=!1;if(_){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,_=c.cca(this.input,e);if((_??-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),f=p??-1;if(f==32||f==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 _=c.cca(this.input,e+1);h=(_??-1)==47}else h=!1}return!h}isAfterComma(){let e=this.tokenized.length-1;for(;e>=0;){let t=this.tokenized[e];if(!Mt.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(!Mt.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(Mt.isComment(t.type)||t.type==k.Indent||t.type==k.Unindent)--e;else return!!Mt.isAssignOp(t.type)}return!1}followsUnquotedAssign(){let e=this.tokenized.length-1;for(;e>=0;){let t=this.tokenized[e];if(Mt.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(Mt.isComment(l.type)||l.type==k.Indent||l.type==k.Unindent)--t;else if(!e&&l.type==k.Colon)if(--t,t>=0)Mt.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(Mt.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(Mt.isComment(t.type)||t.type==k.Indent||t.type==k.Unindent)--e;else if(t.type==k.OpMinus){for(--e;e>=0&&(Mt.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=Ct.hasNonSpecialChar_specialChars.length;for(;a<h;){let o=a++,u=c.cca(Ct.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 2:case 48:case 50:return!0;case 19:let i=l.name;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 Ce(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 f;if(u==47&&l+1<this.length){let m=c.cca(this.input,l+1);f=(m??-1)==42}else f=!1;if(f){for(l+=2;;){if(l>=this.length)return-1;let m=c.cca(this.input,l);if((m??-1)==10)return-1;let _,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);_=(d??-1)==47}else _=!1;if(_){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 f,m;if(e+1<this.length){let _=c.cca(this.input,e);m=(_??-1)==42}else m=!1;if(m){let _=c.cca(this.input,e+1);f=(_??-1)==47}else f=!1;if(f){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}skipBalancedParens(e,t){let l;if(e<this.length){let n=c.cca(this.input,e);l=(n??-1)!=40}else l=!0;if(l)return-1;++e;let i=1;for(;e<this.length&&i>0;){let n=c.cca(this.input,e),s=n??-1;if(s==92){e+=2;continue}if(s==10)return-1;let r;if(s==47&&e+1<this.length){let h=c.cca(this.input,e+1);r=(h??-1)==47}else r=!1;if(r)return-1;let a;if(s==47&&e+1<this.length){let h=c.cca(this.input,e+1);a=(h??-1)==42}else a=!1;if(a){for(e+=2;;){if(e>=this.length)return-1;let h=c.cca(this.input,e);if((h??-1)==10)return-1;let o,u;if(e+1<this.length){let p=c.cca(this.input,e);u=(p??-1)==42}else u=!1;if(u){let p=c.cca(this.input,e+1);o=(p??-1)==47}else o=!1;if(o){e+=2;break}++e}continue}if(s==34){if(e=this.scanStringEnd(e,t),e==-1)return-1;continue}s==40?++i:s==41&&--i,++e}return i!=0?-1: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 B=c.cca(this.input,this.pos+1);l=B??-1}else l=0;if(t==47&&this.pos<this.length-1){let B=c.cca(this.input,this.pos+1),I=B??-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(Ct.KEYWORDS.h,u)||this.isColon(this.pos+u.length))))return null;let p=!o,f=!1;if(o){if(n){if(!h&&!this.followsOnlyWhitespacesOrCommentsInLine()&&!this.isAfterComma()&&!this.isAfterLBracket())return null}else if(!s&&!h)return null}else if(f=this.followsOnlyLabelOrCommentsInLine(),!f&&!this.followsOnlyWhitespacesOrCommentsInLine()&&!this.followsChoiceOncePrefix()||!f&&l==62&&t==45)return null;if(t==34){let B=this.scanStringEnd(this.pos,i==k.KwBeat);if(B==-1)return null;let I=!1,q=B;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 A;if(P==47&&q+1<this.length){let F=c.cca(this.input,q+1);if((F??-1)!=47){let R=c.cca(this.input,q+1);A=(R??-1)==42}else A=!0}else A=!1;if(A||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 A=c.cca(this.input,P),F=A??-1,R;if(F==10||F==13||F==34)R=!0;else if(F==47&&P+1<this.length){let X=c.cca(this.input,P+1);if((X??-1)!=47){let he=c.cca(this.input,P+1);R=(he??-1)==42}else R=!0}else R=!1;if(R)return null;let V=0,W=P;for(;;){let X;if(W>0){let he=c.cca(this.input,W-1);if((he??-1)!=32){let ce=c.cca(this.input,W-1);X=(ce??-1)==9}else X=!0}else X=!1;if(!X)break;++V,--W}let H=a!=-1?a:this.column-1;if(V!=H)return null;let G;if(F==45&&P+1<this.length){let X=c.cca(this.input,P+1);G=(X??-1)==62}else G=!1;if(G||F==43||this.isAssignStart(P,!1)||this.isCallStart(P)||this.isLabelStart(P)||this.isIfStart(P)||this.isIdentifierExpressionStart(P,!0))return null;if(F>=97&&F<=122||F>=65&&F<=90||F==95){let X=P;for(;;){let ae;if(X<this.length){let xe=c.cca(this.input,X),Ie=xe??-1;ae=Ie>=97&&Ie<=122||Ie>=65&&Ie<=90||Ie==95||Ie>=48&&Ie<=57}else ae=!1;if(!ae)break;++X}let he=this.input,ce=X-P,ne=ce!=null?c.substr(he,P,ce):c.substr(he,P,null);if(ne!="null"&&ne!="true"&&ne!="false"&&Object.prototype.hasOwnProperty.call(Ct.KEYWORDS.h,ne))return null}}else if(!I)return null}let m=new ue(this.startLine,this.startColumn,this.pos),_="",g=[],d=this.line,x=this.column,y=this.pos,S=!1,C=-1,O=!1,E=this.column,v=this.line,N=!0,L=!1;for(;this.pos<this.length;){let B=c.cca(this.input,this.pos),I=B??-1,q=I==32||I==9;if(L||!q&&C==-1&&(I!=60||!p)&&(L=!0),S){_+=String.fromCodePoint(92),_+=String.fromCodePoint(I),S=!1;let z=0,P=1;for(;z<P;){let A=z++;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++}E+=2}else if(I==92){S=!0;let z=0,P=1;for(;z<P;){let A=z++;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 if(C==-1&&q&&!L&&g.length==0){let z=0,P=1;for(;z<P;){let A=z++;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{if(C==-1&&I==123)break;{let z;if(C==-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)){_+=String.fromCodePoint(I);let P=0,A=1;for(;P<A;){let R=P++;if(this.pos>=this.length)break;let V=c.cca(this.input,this.pos);(V??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let F;if(I==13){let R=c.cca(this.input,this.pos);F=(R??-1)==10}else F=!1;if(F){_+=String.fromCodePoint(10);let R=0,V=1;for(;R<V;){let W=R++;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=this.column,v=this.line}else break;else break;else{let P;if(C==-1)if(I==47&&this.pos<this.length-1){let A=c.cca(this.input,this.pos+1);P=(A??-1)==42}else P=!1;else P=!1;if(P){_+=String.fromCodePoint(47),_+=String.fromCodePoint(42);let A=2;A==null&&(A=1);let F=0,R=A;for(;F<R;){let W=F++;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 V=!1;for(;this.pos<this.length;){let W,H=c.cca(this.input,this.pos);if((H??-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){_+=String.fromCodePoint(42),_+=String.fromCodePoint(47);let ne=2;ne==null&&(ne=1);let ae=0,xe=ne;for(;ae<xe;){let Ie=ae++;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++}V=!0;break}let G=c.cca(this.input,this.pos),X=G??-1;_+=String.fromCodePoint(X);let he=0,ce=1;for(;he<ce;){let ne=he++;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++}}E=this.column,v=this.line,V||this.error("Unterminated multiline comment",!1)}else{if(C==-1&&!o&&this.isIfStart(this.pos))break;{let A;if(C==-1&&I==45&&this.pos<this.length-1){let F=c.cca(this.input,this.pos+1);A=(F??-1)==62}else A=!1;if(A&&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 F;if(this.pos+1<this.length){let H=c.cca(this.input,this.pos+1);F=H??-1}else F=0;O=F==47;let R=this.pos+(O?2:1);if(R<this.length){let H=c.cca(this.input,R),G=H??-1;(G>=97&&G<=122||G>=65&&G<=90||G==95||G==95||G==36||O&&G==62)&&(C=_.length)}_+=String.fromCodePoint(I);let V=0,W=1;for(;V<W;){let H=V++;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++}++E}else if(p&&I==62){_+=String.fromCodePoint(I);let F=0,R=1;for(;F<R;){let V=F++;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,C!=-1&&(g.push(Al.Tag(O,C,_.length-C)),C=-1)}else if(C==-1&&I==35&&!S){let F;if(this.pos+1<this.length){let R=c.cca(this.input,this.pos+1);F=R??-1}else F=0;if(F==35){_+=String.fromCodePoint(35),_+=String.fromCodePoint(35);let R=0,V=1;for(;R<V;){let G=R++;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,H=1;for(;W<H;){let G=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(F>=97&&F<=122||F>=65&&F<=90||F==95||F>=48&&F<=57||F==45)break;{_+=String.fromCodePoint(I);let R=0,V=1;for(;R<V;){let W=R++;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(I==36&&!S){let F=_.length,R=v,V=E,W=this.pos;try{let H=0,G=1;for(;H<G;){let he=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++}++E;let X=c.cca(this.input,this.pos);if((X??-1)==123){let he=0,ce=1;for(;he<ce;){let Ue=he++;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(R,V+2,this.pos),ae=this.readComplexInterpolation(ne),xe=this.pos-W;g.push(Al.Interpolation(!0,C!=-1,ae,F,xe));let Ie=this.input;_+=Y.string(xe!=null?c.substr(Ie,W,xe):c.substr(Ie,W,null))}else{let he=c.cca(this.input,this.pos),ce=he??-1;if(ce>=97&&ce<=122||ce>=65&&ce<=90||ce==95){let ne=new ue(R,V+1,this.pos),ae=this.readFieldAccessInterpolation(ne),xe=this.pos-W;g.push(Al.Interpolation(!1,C!=-1,ae,F,xe));let Ie=this.input;_+=Y.string(xe!=null?c.substr(Ie,W,xe):c.substr(Ie,W,null))}else{let ne=c.cca(this.input,this.pos);if((ne??-1)==36){_+=String.fromCodePoint(36),_+=String.fromCodePoint(36);let ae=0,xe=1;for(;ae<xe;){let Ie=ae++;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 ae=this.pos-W;g.push(Al.Interpolation(!1,C!=-1,[],F,ae));let xe=this.input;_+=Y.string(ae!=null?c.substr(xe,W,ae):c.substr(xe,W,null))}}}}catch(H){let G=b.caught(H).unwrap();if(G instanceof pi){let X=G;throw X.pos==null&&(X.pos=new ue(R,V,this.pos)),b.thrown(X)}else throw H}E=V+(this.pos-W)}else{I==10?(++v,E=1):++E,_+=String.fromCodePoint(I);let F=0,R=1;for(;F<R;){let V=F++;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(N){let B=_,I=B.length;B=He.rtrim(B);let q=B.length,z=I-q;if(q>0&&this.hasNonSpecialChar(B)&&(!o||!this.isNumber(B)&&B!="null"&&B!="true"&&B!="false")){if(a==-1&&!h&&!this.inChoiceRoot()){let V=this.line,W=this.column,H=this.pos,G=!0;G==null&&(G=!1);let X=G;X==null&&(X=!1);let he=this._skipWhitespaceAndComments(this.pos,X);for(;this.pos<he;){let ne=0,ae=1;for(;ne<ae;){let xe=ne++;if(this.pos>=this.length)break;let Ie=c.cca(this.input,this.pos);(Ie??-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 ae=this.input,xe=H-z,Ie=ce!=null?ae.substring(xe,ce):ae.substring(xe),Ue=ne.type;if(Ue._hx_index==15){let lt=Ue.quotes,qe=Ue.s,Qe=Ue.attachments;if(Qe!=null){let rt=0;for(;rt<Qe.length;){let Ve=Qe[rt];switch(++rt,Ve._hx_index){case 0:let $=Ve.braces,se=Ve.inTag,K=Ve.expr,ie=Ve.start,le=Ve.length;g.push(Al.Interpolation($,se,K,ie+ce-y,le));break;case 1:let ee=Ve.closing,pe=Ve.start,ge=Ve.length;g.push(Al.Tag(ee,pe+ce-y,ge));break}}}B+=Ie,B+=qe}z=0;let Je=this.pos-1;for(;;){let lt;if(Je>=0){let qe=c.cca(this.input,Je);if((qe??-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=V,this.column=W,this.pos=H}else this.line=V,this.column=W,this.pos=H}g.sort(function(V,W){return Ct.compareAttachments(V,W)});let P=g.length>0?g:null,A=m;A==null&&(A=new ue(this.startLine,this.startColumn,this.pos)),A.length=this.pos-A.offset;let F=new Ce(k.LString(0,B,P),A);this.previous=F;let R=F;return R.pos.length-=z,R}}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 f=c.cca(this.input,this.pos);(f??-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),f=p??-1;if(s){i+=String.fromCodePoint(92),i+=String.fromCodePoint(f),s=!1;let m=0,_=1;for(;m<_;){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(f==92){s=!0;let m=0,_=1;for(;m<_;){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(f==34&&r==-1){let m=0,_=1;for(;m<_;){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 Ct.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 Ce(k.LString(1,i,g),d);return this.previous=x,x}else if(u&&f==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 _=this.pos+(a?2:1);if(_<this.length){let x=c.cca(this.input,_),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(f);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(f==62){i+=String.fromCodePoint(f);let m=0,_=1;for(;m<_;){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(Al.Tag(a,r,i.length-r)),r=-1)}else if(f==36&&!s){let m=i.length,_=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 B=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(_,g+2,this.pos),v=this.readComplexInterpolation(E),N=this.pos-d;n.push(Al.Interpolation(!0,r!=-1,v,m,N));let L=this.input;i+=Y.string(N!=null?c.substr(L,d,N):c.substr(L,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(_,g+1,this.pos),v=this.readFieldAccessInterpolation(E),N=this.pos-d;n.push(Al.Interpolation(!1,r!=-1,v,m,N));let L=this.input;i+=Y.string(N!=null?c.substr(L,d,N):c.substr(L,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 L=v++;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++}++h}else{this.error("Expected identifier or { after $",!1);let v=this.pos-d;n.push(Al.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=b.caught(x).unwrap();if(y instanceof pi){let S=y;throw S.pos==null&&(S.pos=new ue(_,g,this.pos)),b.thrown(S)}else throw x}h=g+(this.pos-d)}else{f==10?(++o,h=1):++h,i+=String.fromCodePoint(f);let m=0,_=1;for(;m<_;){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 f=h.n;a=(f==null?"null":""+f).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,f=1;for(;p<f;){let m=p++;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 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(Ct.KEYWORDS.h,a)?Ct.KEYWORDS.h[a]:k.Identifier(a);t.push(new Ce(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 Ce(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 f=1;for(;this.pos<this.length&&f>0;){let x=c.cca(this.input,this.pos);if((x??-1)==41){if(--f,f==0){t.push(new Ce(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&&++f}let y=c.cca(this.input,this.pos);if((y??-1)==44){t.push(new Ce(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())}f>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 Ce(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 L=c.cca(this.input,this.pos);(L??-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),L=N??-1;if(!(L>=97&&L<=122||L>=65&&L<=90||L==95||L>=48&&L<=57))break;let B=0,I=1;for(;B<I;){let q=B++;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 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(Ct.KEYWORDS.h,E)?Ct.KEYWORDS.h[E]:k.Identifier(E);t.push(new Ce(v,new ue(this.line,this.column-(this.pos-S),S)))}else break e;break;case 91:t.push(new Ce(k.LBracket,new ue(this.line,this.column,this.pos,1)));let _=0,g=1;for(;_<g;){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++}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 Ce(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 f=c.cca(this.input,this.pos);(f??-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(Ct.KEYWORDS.h,s)?Ct.KEYWORDS.h[s]:k.Identifier(s);return new Ce(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 f=0,m=1;for(;f<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 Ce(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,f=this.pos-n,m=f!=null?c.substr(p,n,f):c.substr(p,n,null),_=2;_==null&&(_=1);let g=0,d=_;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 Ce(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 f=c.cca(this.input,this.pos);(f??-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,f=u;for(;p<f;){let m=p++;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 u=0,p=1;for(;u<p;){let f=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,f=1;for(;p<f;){let m=p++;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 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 Ce(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),_=m??-1;u=_>=48&&_<=57}else u=!1;if(!u)break;let p=0,f=1;for(;p<f;){let m=p++;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 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 f=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 f;if(this.pos<this.length){let g=c.cca(this.input,this.pos),d=g??-1;f=d>=48&&d<=57}else f=!1;if(!f)break;let m=0,_=1;for(;m<_;){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 Ce(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 f=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(Ct.KEYWORDS.h,n)?Ct.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 Ce(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,A=1;for(;P<A;){let F=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++}}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 R;if(this.pos<this.length){let H=c.cca(this.input,this.pos),G=H??-1;R=G>=97&&G<=122||G>=65&&G<=90||G==95||G>=48&&G<=57}else R=!1;if(!R)break;let V=0,W=1;for(;V<W;){let H=V++;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 A=this.input,F=this.pos-P;n=F!=null?c.substr(A,P,F):c.substr(A,P,null)}let a=!1;a==null&&(a=!1);let h=this._skipWhitespaceAndComments(this.pos,a);for(;this.pos<h;){let P=0,A=1;for(;P<A;){let F=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++}}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=[],f=0,m=1;for(;f<m;){let P=f++;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++}u=1;let _=new xt;for(;this.pos<this.length&&u>0;){let P=c.cca(this.input,this.pos),A=P??-1;if(A==47){let F=this.pos,R=!1;R==null&&(R=!1);let V=this._skipWhitespaceAndComments(this.pos,R);for(;this.pos<V;){let W=0,H=1;for(;W<H;){let G=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==F){let W=0,H=1;for(;W<H;){let G=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(A==40){++u,_.b+=String.fromCodePoint(A);let F=0,R=1;for(;F<R;){let H=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 V=!1;V==null&&(V=!1);let W=this._skipWhitespaceAndComments(this.pos,V);for(;this.pos<W;){let H=0,G=1;for(;H<G;){let X=H++;if(this.pos>=this.length)break;let he=c.cca(this.input,this.pos);(he??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}else if(A==41){if(--u,u>0)_.b+=String.fromCodePoint(A);else{let H=He.trim(_.b);H.length>0&&p.push(H)}let F=0,R=1;for(;F<R;){let H=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 V=!1;V==null&&(V=!1);let W=this._skipWhitespaceAndComments(this.pos,V);for(;this.pos<W;){let H=0,G=1;for(;H<G;){let X=H++;if(this.pos>=this.length)break;let he=c.cca(this.input,this.pos);(he??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}else if(A==44&&u==1){let F=He.trim(_.b);F.length>0&&p.push(F),_=new xt;let R=0,V=1;for(;R<V;){let G=R++;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 H=this._skipWhitespaceAndComments(this.pos,W);for(;this.pos<H;){let G=0,X=1;for(;G<X;){let he=G++;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{_.b+=String.fromCodePoint(A);let F=0,R=1;for(;F<R;){let V=F++;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,A=1;for(;P<A;){let F=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++}}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,A=1;for(;P<A;){let R=P++;if(this.pos>=this.length)break;let V=c.cca(this.input,this.pos);(V??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let F=1;for(;this.pos<this.length&&F>0;){let R=c.cca(this.input,this.pos),V=R??-1;if(V==34){let G=0,X=1;for(;G<X;){let he=G++;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}V==123?++F:V==125&&--F;let W=0,H=1;for(;W<H;){let G=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++}}F>0&&this.error("Unclosed braces in function body",!1)}else{let P=-1,A=!0;for(;this.pos<this.length;){let F=c.cca(this.input,this.pos),R=F??-1;if(R==10||R==13){y=this.pos,S=this.line,C=this.column;let H=0,G=1;for(;H<G;){let X=H++;if(this.pos>=this.length)break;let he=c.cca(this.input,this.pos);(he??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}A=!0;break}let V=0,W=1;for(;V<W;){let H=V++;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++}}for(;this.pos<this.length;){if(A){let H=0,G=this.pos;for(;this.pos<this.length;){let ce=c.cca(this.input,this.pos),ne=ce??-1;if(ne==32)++H;else if(ne==9)++H;else break;let ae=0,xe=1;for(;ae<xe;){let Ie=ae++;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,he;if(P==-1&&this.pos<this.length){let ce=c.cca(this.input,this.pos);he=(ce??-1)!=10}else he=!1;if(he){let ce=c.cca(this.input,this.pos);X=(ce??-1)!=13}else X=!1;if(X){if(P=H,P<i){this.pos=G;break}}else{let ce;if(P!=-1&&H<P)if(this.pos<this.length){let ne=c.cca(this.input,this.pos);if((ne??-1)!=10){let ae=c.cca(this.input,this.pos);ce=(ae??-1)!=13}else ce=!1}else ce=!0;else ce=!1;if(ce){this.pos=G;break}}A=!1}let F=c.cca(this.input,this.pos),R=F??-1;if(R==34){this.skipQuotedString();continue}(R==10||R==13)&&(y=this.pos,S=this.line,C=this.column,A=!0);let V=0,W=1;for(;V<W;){let H=V++;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++}}}this.pos=y,this.line=S,this.column=C;let O=this.pos,E=this.input,v=e.offset,N=O-e.offset,L=He.rtrim(N!=null?c.substr(E,v,N):c.substr(E,v,null)),B=L.indexOf(`
|
|
31
|
+
`,null)==-1;B||(L+=`
|
|
32
|
+
`);let I=e;I==null&&(I=new ue(this.startLine,this.startColumn,this.pos)),I.length=this.pos-I.offset;let q=new Ce(k.Function(n,p,L,B),I);this.previous=q;let z=q;return z.pos.length=L.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 f=c.cca(this.input,this.pos);(f??-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),f=p??-1;if(f==34){this.skipQuotedString();continue}else f==123?++u:f==125&&--u;if(u>0||f!=125){let m=0,_=1;for(;m<_;){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,_=1;for(;m<_;){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),_=m??-1;u=_>=97&&_<=122||_>=65&&_<=90||_==95||_>=48&&_<=57}else u=!1;if(!u)break;let p=0,f=1;for(;p<f;){let m=p++;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 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 Ce(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 pi(e,new ue(this.startLine,this.startColumn,this.pos));if(this.errors==null&&(this.errors=[]),this.errors.push(l),t)throw b.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}}J["loreline.Lexer"]=Ct,Ct.__name__="loreline.Lexer",Object.assign(Ct.prototype,{__class__:Ct});class gl{static lastError(){return gl._lastError}static parse(e,t,l,i){gl._lastError=null;let n=new Ct(e),s=n.tokenize(),r=n.getErrors();if(r!=null&&r.length>0)return gl._reportParseError(r[0],i);let a=null;if(t!=null&&l!=null)return new Hi().resolve(t,s,l,function(p){gl._reportParseError(p,i)},function(p,f){if(gl._lastError!=null)return;let m=new Yl(s,new Ai(t,t,f,null));a=m.parse(),a.indentSize=n.detectedIndentSize;let _=m.getErrors();if(_!=null&&_.length>0){a=null,gl._reportParseError(_[0],i);return}i?.(a)}),a;let h=new Yl(s);a=h.parse(),a.indentSize=n.detectedIndentSize;let o=h.getErrors();return o!=null&&o.length>0?gl._reportParseError(o[0],i):(i?.(a),a)}static _reportParseError(e,t){if(gl._lastError=e,t!=null)return t(null),null;throw b.thrown(e)}static loadLocale(e,t,l,i,n){if(gl._lastError=null,l==null&&(l=t.filePath),l==null)throw b.thrown(new st("Cannot load locale: no filePath provided and script.filePath is null"));if(i==null)throw b.thrown(new st("Cannot load locale: handleFile is required"));let s=El.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,L,B,I,q,z=c.cca(l,E-8);if((z??-1)==46){let P=c.cca(l,E-7),A=P??-1;q=A==108||A==76}else q=!1;if(q){let P=c.cca(l,E-6),A=P??-1;I=A==111||A==79}else I=!1;if(I){let P=c.cca(l,E-5),A=P??-1;B=A==114||A==82}else B=!1;if(B){let P=c.cca(l,E-4);L=(P??-1)==46}else L=!1;if(L){let P=c.cca(l,E-3),A=P??-1;N=A==116||A==84}else N=!1;if(N){let P=c.cca(l,E-2),A=P??-1;v=A==120||A==88}else v=!1;if(v){let P=c.cca(l,E-1),A=P??-1;u=A==116||A==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,L=c.cca(l,E-4);if((L??-1)==46){let B=c.cca(l,E-3),I=B??-1;N=I==108||I==76}else N=!1;if(N){let B=c.cca(l,E-2),I=B??-1;v=I==111||I==79}else v=!1;if(v){let B=c.cca(l,E-1),I=B??-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,f=[],m=[];if(p!=null){let E=De.withoutDirectory(p),v;if(E==null)v=null;else{let L;if(E==null)L=!1;else{let B=E.length;if(B<8)L=!1;else{let I,q,z,P,A,F,R=c.cca(E,B-8);if((R??-1)==46){let V=c.cca(E,B-7),W=V??-1;F=W==108||W==76}else F=!1;if(F){let V=c.cca(E,B-6),W=V??-1;A=W==111||W==79}else A=!1;if(A){let V=c.cca(E,B-5),W=V??-1;P=W==114||W==82}else P=!1;if(P){let V=c.cca(E,B-4);z=(V??-1)==46}else z=!1;if(z){let V=c.cca(E,B-3),W=V??-1;q=W==116||W==84}else q=!1;if(q){let V=c.cca(E,B-2),W=V??-1;I=W==120||W==88}else I=!1;if(I){let V=c.cca(E,B-1),W=V??-1;L=W==116||W==84}else L=!1}}if(L){let B=E.length-8;v=B!=null?c.substr(E,0,B):c.substr(E,0,null)}else{let B;if(E==null)B=!1;else{let I=E.length;if(I<4)B=!1;else{let q,z,P=c.cca(E,I-4);if((P??-1)==46){let A=c.cca(E,I-3),F=A??-1;z=F==108||F==76}else z=!1;if(z){let A=c.cca(E,I-2),F=A??-1;q=F==111||F==79}else q=!1;if(q){let A=c.cca(E,I-1),F=A??-1;B=F==114||F==82}else B=!1}}if(B){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;f.push("."),m.push(De.normalize(De.join([h,N])))}if(p!=null){let E=new Fi(t),v=De.directory(p),N=E.getImportedPaths(p),L=0;for(;L<N.length;){let B=N[L];++L;let I=gl.relativePath(v,B),q;if(I==null)q=null;else{let F;if(I==null)F=!1;else{let R=I.length;if(R<8)F=!1;else{let V,W,H,G,X,he,ce=c.cca(I,R-8);if((ce??-1)==46){let ne=c.cca(I,R-7),ae=ne??-1;he=ae==108||ae==76}else he=!1;if(he){let ne=c.cca(I,R-6),ae=ne??-1;X=ae==111||ae==79}else X=!1;if(X){let ne=c.cca(I,R-5),ae=ne??-1;G=ae==114||ae==82}else G=!1;if(G){let ne=c.cca(I,R-4);H=(ne??-1)==46}else H=!1;if(H){let ne=c.cca(I,R-3),ae=ne??-1;W=ae==116||ae==84}else W=!1;if(W){let ne=c.cca(I,R-2),ae=ne??-1;V=ae==120||ae==88}else V=!1;if(V){let ne=c.cca(I,R-1),ae=ne??-1;F=ae==116||ae==84}else F=!1}}if(F){let R=I.length-8;q=R!=null?c.substr(I,0,R):c.substr(I,0,null)}else{let R;if(I==null)R=!1;else{let V=I.length;if(V<4)R=!1;else{let W,H,G=c.cca(I,V-4);if((G??-1)==46){let X=c.cca(I,V-3),he=X??-1;H=he==108||he==76}else H=!1;if(H){let X=c.cca(I,V-2),he=X??-1;W=he==111||he==79}else W=!1;if(W){let X=c.cca(I,V-1),he=X??-1;R=he==114||he==82}else R=!1}}if(R){let V=I.length-4;q=V!=null?c.substr(I,0,V):c.substr(I,0,null)}else q=I}}let z=q+"."+e+a,P=De.normalize(I),A;if(P==null)A=null;else{let F;if(P==null)F=!1;else{let R=P.length;if(R<8)F=!1;else{let V,W,H,G,X,he,ce=c.cca(P,R-8);if((ce??-1)==46){let ne=c.cca(P,R-7),ae=ne??-1;he=ae==108||ae==76}else he=!1;if(he){let ne=c.cca(P,R-6),ae=ne??-1;X=ae==111||ae==79}else X=!1;if(X){let ne=c.cca(P,R-5),ae=ne??-1;G=ae==114||ae==82}else G=!1;if(G){let ne=c.cca(P,R-4);H=(ne??-1)==46}else H=!1;if(H){let ne=c.cca(P,R-3),ae=ne??-1;W=ae==116||ae==84}else W=!1;if(W){let ne=c.cca(P,R-2),ae=ne??-1;V=ae==120||ae==88}else V=!1;if(V){let ne=c.cca(P,R-1),ae=ne??-1;F=ae==116||ae==84}else F=!1}}if(F){let R=P.length-8;A=R!=null?c.substr(P,0,R):c.substr(P,0,null)}else{let R;if(P==null)R=!1;else{let V=P.length;if(V<4)R=!1;else{let W,H,G=c.cca(P,V-4);if((G??-1)==46){let X=c.cca(P,V-3),he=X??-1;H=he==108||he==76}else H=!1;if(H){let X=c.cca(P,V-2),he=X??-1;W=he==111||he==79}else W=!1;if(W){let X=c.cca(P,V-1),he=X??-1;R=he==114||he==82}else R=!1}}if(R){let V=P.length-4;A=V!=null?c.substr(P,0,V):c.substr(P,0,null)}else A=P}}f.push(A),m.push(De.normalize(De.join([h,z])))}}let _=new Se,g=f.length,d=!1,x=null,y=function(E,v){v(null)},S=function(){let E=x??r();if(E!=null){if(gl._lastError=E,n!=null){n(null);return}throw b.thrown(E)}n?.(_)},C=0,O=f.length;for(;C<O;){let E=C++,v=f[E],N=m[E];i(N,function(L){if(g-=1,L!=null)try{let B=gl.parse(L,N,y);if(B!=null){let q=et.extractTranslations(B).h,z=q,P=Object.keys(q),A=P.length,F=0;for(;F<A;){let R=P[F++],V=R,W=z[R],H=V,G=W;_.h[v+"#"+H]=G}}}catch(B){let I=b.caught(B).unwrap();if(I instanceof st){let q=I;x==null&&(x=new st('Failed to load translation file "'+N+'": '+q.message))}else{let q=I;x==null&&(x=new st('Failed to load translation file "'+N+'": '+(q==null?"null":Y.string(q))))}}g==0&&d&&S()})}return d=!0,g==0&&S(),gl._lastError!=null?null:_}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,f=s.length;for(;p<f;){let m=p++;h.push(s[m])}return h.length==0?".":h.join("/")}static play(e,t,l,i,n,s){let r=new Ni(e,t,l,i,s);return r.start(n),r}static resume(e,t,l,i,n,s,r){let a=new Ni(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){El.translationFormat(e,t)}static generateTranslationFile(e,t,l,i){if(l==null||l=="lor")return et.generateTranslationFile(e,t,new Jl);if(i==null||i=="")throw b.thrown(new st("A locale is required when generating a translation file in format '"+l+"'"));if(l==null)throw b.thrown(new st("Unknown translation file format: '"+l+"'"));switch(l){case"csv":return qt.fromScript(e,t,i);case"po":return Tl.fromScript(e,t,i);case"tsv":return qt.tsvFromScript(e,t,i);case"xliff":return Pt.fromScript(e,t,i);default:throw b.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 Jl(i??" ",n??`
|
|
33
|
+
`).print(e)}static update(e){ti.update(e)}}J["loreline.Loreline"]=Zl.loreline.Loreline=gl,gl.__name__="loreline.Loreline";class Re{constructor(e,t,l,i){if(e<0||e>65535)throw b.thrown("Section value ("+e+") should be between 0 and 65535");if(t<0||t>65535)throw b.thrown("Branch value ("+t+") should be between 0 and 65535");if(l<0||l>65535)throw b.thrown("Block value ("+l+") should be between 0 and 65535");if(i<0||i>65535)throw b.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 Gl(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 Gl(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 Gl(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 Gl(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 Gl(this.thisVal.high,this.thisVal.low&-65536|t),e}nextSection(){let e=this.thisVal.high>>16&65535,t=(e>=32768?e-65536:e)+32768;if(t==65535)throw b.thrown("Node id section overflow");return new Re(t+1,0,0,0)}nextBranch(){let e=this.thisVal.high&65535,t=(e>=32768?e-65536:e)+32768;if(t==65535)return this.nextSection();let l=this.thisVal.high>>16&65535;return new Re((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 Re((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 Re((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 Re(32768,32768,32768,32768);return t.thisVal=e,t}static fromString(e){let t=e.split(".");return new Re(Y.parseInt(t[0]),Y.parseInt(t[1]),Y.parseInt(t[2]),Y.parseInt(t[3]))}static fromTwoInt32(e,t){return Re.fromInt64(new Gl(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}}J["loreline.NodeId"]=Re,Re.__name__="loreline.NodeId",Object.assign(Re.prototype,{__class__:Re,__properties__:{set_node:"set_node",get_node:"get_node",set_block:"set_block",get_block:"get_block",set_branch:"set_branch",get_branch:"get_branch",set_section:"set_section",get_section:"get_section"}});class ni{constructor(){this.map=new Ol}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 en(this.map)}keys(){return new tn(this.map)}keyValueIterator(){return new ln(this.map)}}J["loreline.NodeIdMap"]=ni,ni.__name__="loreline.NodeIdMap",Object.assign(ni.prototype,{__class__:ni});class en{constructor(e){for(this.map=e,this.index=0;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++}skipNulls(){for(;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++}hasNext(){return this.index<this.map._values.length}next(){let e=this.map._values[this.index];for(this.index++;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++;return e}}J["loreline._Node.NodeIdMapIterator"]=en,en.__name__="loreline._Node.NodeIdMapIterator",Object.assign(en.prototype,{__class__:en});class tn{constructor(e){for(this.map=e,this.index=0;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++}skipNulls(){for(;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++}hasNext(){return this.index<this.map._values.length}next(){let e=this.map._keys1[this.index],t=this.map._keys2[this.index];for(this.index++;this.index<this.map._values.length&&this.map._values[this.index]==null;)this.index++;return Re.fromTwoInt32(e,t)}}J["loreline._Node.NodeIdMapKeyIterator"]=tn,tn.__name__="loreline._Node.NodeIdMapKeyIterator",Object.assign(tn.prototype,{__class__:tn});class ln{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:Re.fromTwoInt32(e,t),value:l}}}J["loreline._Node.NodeIdMapKeyValueIterator"]=ln,ln.__name__="loreline._Node.NodeIdMapKeyValueIterator",Object.assign(ln.prototype,{__class__:ln});class ut{constructor(e,t){ut._hx_skip_constructor||this._hx_constructor(e,t)}_hx_constructor(e,t){this.id=Re.UNDEFINED,this.id=e,this.pos=t}type(){return"Node"}toJson(){return{id:this.id.toString(),type:this.type(),pos:this.pos.toJson()}}each(e){}static fromJson(e){return D.nodeFromJson(e)}}J["loreline.Node"]=Zl.loreline.Node=ut,ut.__name__="loreline.Node",Object.assign(ut.prototype,{__class__:ut});class Xl extends ut{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}}J["loreline.Comment"]=Xl,Xl.__name__="loreline.Comment",Xl.__super__=ut,Object.assign(Xl.prototype,{__class__:Xl});class Fe extends ut{constructor(e,t,l,i){if(ut._hx_skip_constructor){super();return}ut._hx_skip_constructor=!0,super(),ut._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 Fe){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}}J["loreline.AstNode"]=Fe,Fe.__name__="loreline.AstNode",Fe.__super__=ut,Object.assign(Fe.prototype,{__class__:Fe});class ct extends Fe{constructor(e,t,l,i){super(e,t,l,i)}toJson(){return super.toJson()}type(){return"Expr"}}J["loreline.NExpr"]=ct,ct.__name__="loreline.NExpr",ct.__super__=Fe,Object.assign(ct.prototype,{__class__:ct});class Yt extends Fe{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=Wl.toString(this.style),e}}J["loreline.NStateDecl"]=Yt,Yt.__name__="loreline.NStateDecl",Yt.__super__=Fe,Object.assign(Yt.prototype,{__class__:Yt});class ql extends Fe{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}}J["loreline.NObjectField"]=ql,ql.__name__="loreline.NObjectField",ql.__super__=Fe,Object.assign(ql.prototype,{__class__:ql});class Jt extends Fe{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=Wl.toString(this.style),e}}J["loreline.NCharacterDecl"]=Jt,Jt.__name__="loreline.NCharacterDecl",Jt.__super__=Fe,Object.assign(Jt.prototype,{__class__:Jt});class Mi{constructor(e,t,l){this.name=e,this.namePos=t,this.defaultValue=l}toJson(){let e={name:this.name,namePos:this.namePos.toJson()};return this.defaultValue!=null&&(e.defaultValue=this.defaultValue.toJson()),e}}J["loreline.NBeatParam"]=Mi,Mi.__name__="loreline.NBeatParam",Object.assign(Mi.prototype,{__class__:Mi});class Be extends Fe{constructor(e,t,l,i,n,s){ut._hx_skip_constructor=!0,super(),ut._hx_skip_constructor=!1,this._hx_constructor(e,t,l,i,n,s)}_hx_constructor(e,t,l,i,n,s){this.params=null,super._hx_constructor(e,t,n,s),this.name=l,this.body=i,this.style=0}type(){return"Beat"}each(e){if(super.each(e),this.params!=null){let t=0,l=this.params;for(;t<l.length;){let i=l[t];++t,i.defaultValue!=null&&(e(i.defaultValue,this),i.defaultValue.each(e))}}if(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();if(e.name=this.name,this.params!=null){let n=[],s=0,r=this.params;for(;s<r.length;){let a=r[s];++s,n.push(a.toJson())}e.params=n}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=Wl.toString(this.style),e}}J["loreline.NBeatDecl"]=Be,Be.__name__="loreline.NBeatDecl",Be.__super__=Fe,Object.assign(Be.prototype,{__class__:Be});var ze=Ye["loreline.StringPartType"]={__ename__:"loreline.StringPartType",__constructs__:null,Raw:(w=function(T){return{_hx_index:0,text:T,__enum__:"loreline.StringPartType",toString:M}},w._hx_name="Raw",w.__params__=["text"],w),Expr:(w=function(T){return{_hx_index:1,expr:T,__enum__:"loreline.StringPartType",toString:M}},w._hx_name="Expr",w.__params__=["expr"],w),Tag:(w=function(T,e){return{_hx_index:2,closing:T,expr:e,__enum__:"loreline.StringPartType",toString:M}},w._hx_name="Tag",w.__params__=["closing","expr"],w)};ze.__constructs__=[ze.Raw,ze.Expr,ze.Tag];class Wl{static toString(e){switch(e){case 0:return"Plain";case 1:return"Braces"}}}class Bi{static toString(e){switch(e){case 0:return"Plain";case 2:return"Parens"}}}class Li{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}}J["loreline.NStringPart"]=Ge,Ge.__name__="loreline.NStringPart",Ge.__super__=ct,Object.assign(Ge.prototype,{__class__:Ge});class Bt 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=dn.toString(this.quotes),e}}J["loreline.NStringLiteral"]=Bt,Bt.__name__="loreline.NStringLiteral",Bt.__super__=ct,Object.assign(Bt.prototype,{__class__:Bt});class il extends Fe{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=Bi.toString(this.conditionStyle),e.conditionPos=this.conditionPos.toJson()),e}}J["loreline.NTextStatement"]=il,il.__name__="loreline.NTextStatement",il.__super__=Fe,Object.assign(il.prototype,{__class__:il});class Ht extends Fe{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=Bi.toString(this.conditionStyle),e.conditionPos=this.conditionPos.toJson()),e}}J["loreline.NDialogueStatement"]=Ht,Ht.__name__="loreline.NDialogueStatement",Ht.__super__=Fe,Object.assign(Ht.prototype,{__class__:Ht});class wl extends Fe{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=Wl.toString(this.style),e}}J["loreline.NChoiceStatement"]=wl,wl.__name__="loreline.NChoiceStatement",wl.__super__=Fe,Object.assign(wl.prototype,{__class__:wl});class Ot extends Fe{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=Bi.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=Wl.toString(this.style),this.once&&(e.once=!0),e}}J["loreline.NChoiceOption"]=Ot,Ot.__name__="loreline.NChoiceOption",Ot.__super__=Fe,Object.assign(Ot.prototype,{__class__:Ot});class ol extends Fe{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=Wl.toString(this.style),e}}J["loreline.NBlock"]=ol,ol.__name__="loreline.NBlock",ol.__super__=Fe,Object.assign(ol.prototype,{__class__:ol});class kl extends Fe{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=Bi.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=Wl.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=Wl.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 f=p[u];++u,o.push(f.toJson())}h.elseLeading=o}if(this.elseTrailingComments!=null&&this.elseTrailingComments.length>0){let o=[],u=0,p=this.elseTrailingComments;for(;u<p.length;){let f=p[u];++u,o.push(f.toJson())}h.elseTrailing=o}e.comments=h}}return e}}J["loreline.NIfStatement"]=kl,kl.__name__="loreline.NIfStatement",kl.__super__=Fe,Object.assign(kl.prototype,{__class__:kl});class $l extends Fe{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=Li.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=Wl.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}}J["loreline.NAlternative"]=$l,$l.__name__="loreline.NAlternative",$l.__super__=Fe,Object.assign($l.prototype,{__class__:$l});class Vt 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}}J["loreline.NCall"]=Vt,Vt.__name__="loreline.NCall",Vt.__super__=ct,Object.assign(Vt.prototype,{__class__:Vt});class yl extends Fe{constructor(e,t,l,i,n,s){ut._hx_skip_constructor=!0,super(),ut._hx_skip_constructor=!1,this._hx_constructor(e,t,l,i,n,s)}_hx_constructor(e,t,l,i,n,s){this.args=null,this.targetExpr=null,super._hx_constructor(e,t,n,s),this.target=l,this.targetPos=i}type(){return"Transition"}each(e){if(super.each(e),this.targetExpr!=null&&(e(this.targetExpr,this),this.targetExpr.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();if(this.targetExpr!=null?e.targetExpr=this.targetExpr.toJson():e.target=this.target,e.targetPos=this.targetPos.toJson(),this.args!=null){let t=[],l=0,i=this.args;for(;l<i.length;){let n=i[l];++l,t.push(n.toJson())}e.args=t}return e}}J["loreline.NTransition"]=yl,yl.__name__="loreline.NTransition",yl.__super__=Fe,Object.assign(yl.prototype,{__class__:yl});class zl extends Fe{constructor(e,t,l,i,n,s){ut._hx_skip_constructor=!0,super(),ut._hx_skip_constructor=!1,this._hx_constructor(e,t,l,i,n,s)}_hx_constructor(e,t,l,i,n,s){this.args=null,this.targetExpr=null,super._hx_constructor(e,t,n,s),this.target=l,this.targetPos=i}type(){return"Insertion"}each(e){if(super.each(e),this.targetExpr!=null&&(e(this.targetExpr,this),this.targetExpr.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();if(this.targetExpr!=null?e.targetExpr=this.targetExpr.toJson():e.target=this.target,e.targetPos=this.targetPos.toJson(),this.args!=null){let t=[],l=0,i=this.args;for(;l<i.length;){let n=i[l];++l,t.push(n.toJson())}e.args=t}return e}}J["loreline.NInsertion"]=zl,zl.__name__="loreline.NInsertion",zl.__super__=Fe,Object.assign(zl.prototype,{__class__:zl});class Kl extends Fe{constructor(e,t,l,i,n,s){ut._hx_skip_constructor=!0,super(),ut._hx_skip_constructor=!1,this._hx_constructor(e,t,l,i,n,s)}_hx_constructor(e,t,l,i,n,s){this.args=null,super._hx_constructor(e,t,n,s),this.targetExpr=l,this.targetPos=i}type(){return"BeatCall"}each(e){if(super.each(e),this.targetExpr!=null&&(e(this.targetExpr,this),this.targetExpr.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();if(e.targetExpr=this.targetExpr.toJson(),e.targetPos=this.targetPos.toJson(),this.args!=null){let t=[],l=0,i=this.args;for(;l<i.length;){let n=i[l];++l,t.push(n.toJson())}e.args=t}return e}}J["loreline.NBeatCall"]=Kl,Kl.__name__="loreline.NBeatCall",Kl.__super__=Fe,Object.assign(Kl.prototype,{__class__:Kl});class jl 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}}J["loreline.NFunctionDecl"]=jl,jl.__name__="loreline.NFunctionDecl",jl.__super__=ct,Object.assign(jl.prototype,{__class__:jl});class Ke 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 ut){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 ut){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 ut?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=Wl.toString(i);break}return e}}J["loreline.NLiteral"]=Ke,Ke.__name__="loreline.NLiteral",Ke.__super__=ct,Object.assign(Ke.prototype,{__class__:Ke});var je=Ye["loreline.LiteralType"]={__ename__:"loreline.LiteralType",__constructs__:null,Number:{_hx_name:"Number",_hx_index:0,__enum__:"loreline.LiteralType",toString:M},Boolean:{_hx_name:"Boolean",_hx_index:1,__enum__:"loreline.LiteralType",toString:M},Null:{_hx_name:"Null",_hx_index:2,__enum__:"loreline.LiteralType",toString:M},Array:{_hx_name:"Array",_hx_index:3,__enum__:"loreline.LiteralType",toString:M},Object:(w=function(T){return{_hx_index:4,style:T,__enum__:"loreline.LiteralType",toString:M}},w._hx_name="Object",w.__params__=["style"],w)};je.__constructs__=[je.Number,je.Boolean,je.Null,je.Array,je.Object];class _t 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}}J["loreline.NAccess"]=_t,_t.__name__="loreline.NAccess",_t.__super__=ct,Object.assign(_t.prototype,{__class__:_t});class bl 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}}J["loreline.NAssign"]=bl,bl.__name__="loreline.NAssign",bl.__super__=ct,Object.assign(bl.prototype,{__class__:bl});class dl 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}}J["loreline.NArrayAccess"]=dl,dl.__name__="loreline.NArrayAccess",dl.__super__=ct,Object.assign(dl.prototype,{__class__:dl});class nl 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}}J["loreline.NBinary"]=nl,nl.__name__="loreline.NBinary",nl.__super__=ct,Object.assign(nl.prototype,{__class__:nl});class ei 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}}J["loreline.NUnary"]=ei,ei.__name__="loreline.NUnary",ei.__super__=ct,Object.assign(ei.prototype,{__class__:ei});class si 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}}J["loreline.NTernary"]=si,si.__name__="loreline.NTernary",si.__super__=ct,Object.assign(si.prototype,{__class__:si});class Ut extends Fe{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}}J["loreline.NImportStatement"]=Ut,Ut.__name__="loreline.NImportStatement",Ut.__super__=Fe,Object.assign(Ut.prototype,{__class__:Ut});class re{static isFields(e){return e==null?!1:te.__implements(e,Ll)||e instanceof Se?!0:e instanceof Ul||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,Ll)?t.lorelineGet(e,l):t instanceof Se?t.h[l]:Ae.getProperty(t,l)}static getFields(e,t){if(te.__implements(t,Ll))return t.lorelineFields(e);if(t instanceof Se){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 Ae.fields(t)}static setField(e,t,l,i){te.__implements(t,Ll)?t.lorelineSet(e,l,i):t instanceof Se?t.h[l]=i:Ae.setProperty(t,l,i)}static removeField(e,t,l){if(te.__implements(t,Ll))return t.lorelineRemove(e,l);if(t instanceof Se){let i=t;return Object.prototype.hasOwnProperty.call(i.h,l)?(delete i.h[l],!0):!1}else return Ae.deleteField(t,l)}static fieldExists(e,t,l){return te.__implements(t,Ll)?t.lorelineExists(e,l):t instanceof Se?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 n=e.customCreateFields(e,t,l);if(n!=null)return n}if(t!=null){let n=Object.create(J[t].prototype);return te.__implements(n,Ll)&&n.lorelineCreate(e),n}return{}}}J["loreline.Objects"]=re,re.__name__="loreline.Objects";class Pe extends st{constructor(e,t){super(e,t)}}J["loreline.ParseError"]=Pe,Pe.__name__="loreline.ParseError",Pe.__super__=st,Object.assign(Pe.prototype,{__class__:Pe});class Ai{constructor(e,t,l,i){this.imported=new Se,this.rootPath=e,this.path=t,this.imports=l,i!=null&&(this.imported=i)}}J["loreline.ParserContext"]=Ai,Ai.__name__="loreline.ParserContext",Object.assign(Ai.prototype,{__class__:Ai});class Yl{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=Re.UNDEFINED,this.rootBeat=null,this.context=t}parse(){let e=this.currentPos(),t=[],l=new sl(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=b.caught(i).unwrap();if(n instanceof Pe){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 Xl(this.nextNodeId(4),this.currentPos(),i,!1));break;case 52:let n=l.content;this.pendingComments==null&&(this.pendingComments=[]),this.pendingComments.push(new Xl(this.nextNodeId(4),this.currentPos(),n,!0));break;case 53:let s=l.content;this.pendingComments==null&&(this.pendingComments=[]),this.pendingComments.push(new Xl(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(Mt.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?Mt.toCodeString(t):null}return null}check(e){return this.isAtEnd()?!1:e._hx_index==41?this.tokens[this.current].type==k.Colon:Mt.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 f=h.content;o=!0}else o=!1;let u=this.tokens[this.current].type,p;if(u._hx_index==53){let f=u.content;p=!0}else p=!1;i.push(new Xl(n,s,a,o,p))}if(this.advance(),this.isAtEnd())throw b.thrown(new Pe("Unexpected end of file",this.currentPos()))}if(this.isAtEnd())throw b.thrown(new Pe("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:if(this.peek().type==k.LParen){let v=this.parseBeatCall();return e?t.wrapInRootBeat(v):v}else return this.parseBeatDecl();break;case 3:return e?this.parseCharacterDecl():(this.addError(new Pe("Unexpected: "+this.currentTokenTypeToString(),this.currentPos())),this.advance(),new Ke(this.nextNodeId(4),this.currentPos(),null,je.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 b.thrown(new Pe("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 Pe("Unexpected: "+this.currentTokenTypeToString(),this.currentPos())),this.advance(),new Ke(this.nextNodeId(4),this.currentPos(),null,je.Null));case 15:let p=l.quotes,f=l.s,m=l.attachments,_=this.parseTextStatement();return e?t.wrapInRootBeat(_):_;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 Pe("Unexpected: "+this.currentTokenTypeToString(),this.currentPos())),this.advance(),new Ke(this.nextNodeId(4),this.currentPos(),null,je.Null)}}wrapInRootBeat(e){let t,l=null;if(this.rootBeat==null){let i=this.currentPos();t=[],this.rootBeat=new Be(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 b.thrown(new Pe("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 f=n.attachments,m=n.quotes,_=n.s;t=m,i=_}else throw b.thrown(new Pe("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 f=s.length;if(f<8)a=!1;else{let m,_,g,d,x,y,S=c.cca(s,f-8);if((S??-1)==46){let C=c.cca(s,f-7),O=C??-1;y=O==108||O==76}else y=!1;if(y){let C=c.cca(s,f-6),O=C??-1;x=O==111||O==79}else x=!1;if(x){let C=c.cca(s,f-5),O=C??-1;d=O==114||O==82}else d=!1;if(d){let C=c.cca(s,f-4);g=(C??-1)==46}else g=!1;if(g){let C=c.cca(s,f-3),O=C??-1;_=O==116||O==84}else _=!1;if(_){let C=c.cca(s,f-2),O=C??-1;m=O==120||O==88}else m=!1;if(m){let C=c.cca(s,f-1),O=C??-1;a=O==116||O==84}else a=!1}}if(a)r=!0;else if(s==null)r=!1;else{let f=s.length;if(f<4)r=!1;else{let m,_,g=c.cca(s,f-4);if((g??-1)==46){let d=c.cca(s,f-3),x=d??-1;_=x==108||x==76}else _=!1;if(_){let d=c.cca(s,f-2),x=d??-1;m=x==111||x==79}else m=!1;if(m){let d=c.cca(s,f-1),x=d??-1;r=x==114||x==82}else r=!1}}if(!r){let f=this.context.rootPath,m;if(f==null)m=!1;else{let _=f.length;if(_<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 f=new Ut(this.nextNodeId(1),e.extendedTo(this.prevNonWhitespaceOrComment().pos),null,null);return f.path=new Bt(this.nextNodeId(4),l.pos,t,[new Ge(this.nextNodeId(4),l.pos,ze.Raw(i))]),this.attachComments(f)}let h=this.context.imports.h[s];if(h==null)throw b.thrown(new Pe("Failed to import file at path "+s+" ("+i+")",this.currentPos()));this.context.imported.h[s]=!0;let o=new Yl(h,new Ai(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 Ut(this.nextNodeId(1),e.extendedTo(this.prevNonWhitespaceOrComment().pos),null,u);return p.path=new Bt(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 Ht(this.nextNodeId(4),e,null,null,null),l=this.tokens[this.current].type,i;if(l._hx_index==19)i=l.name;else throw b.thrown(new Pe("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 b.thrown(new Pe("Expected indent, got "+Mt.toCodeString(s.type),s.pos));n=!0}try{t.content=this.parseStringLiteral()}catch(s){let r=b.caught(s).unwrap();if(r instanceof Pe){let a=r;this.addError(a),t.content=new Bt(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=b.caught(l).unwrap();if(i instanceof Pe){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 Yt(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 ql(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 Be(this.nextNodeId(1),e,null,[],[]);if(this.expect(k.KwBeat),t.pos=e.extendedTo(this.currentPos()),t.name=this.expectIdentifier(),this.match(k.LParen)){let n=[];if(!this.check(k.RParen))do{for(;this.match(k.LineBreak););let s=this.currentPos(),r=this.expectIdentifier(),a=null;this.match(k.OpAssign)&&(a=this.parseExpression());let h=0;for(;h<n.length;){let o=n[h];++h,o.name==r&&this.addError(new Pe("Duplicate beat parameter: "+r,s))}for(n.push(new Mi(r,s,a));this.match(k.LineBreak););}while(this.match(k.Comma));this.expect(k.RParen),t.params=n}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 b.thrown(new Pe("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 b.thrown(new Pe("Invalid indentation level",e.pos));return e}else return this.addError(new Pe("Expected "+Mt.toCodeString(k.LBrace)+" or "+Mt.toCodeString(k.Indent)+", got "+this.currentTokenTypeToString(),this.currentPos())),new Ce(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 il(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 wl(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 Ot(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=b.caught(s).unwrap();if(r instanceof Pe){let a=r;this.addError(a),i=this.currentPos(),this.currentPos().offset==t.offset&&this.advance(),l.text=new Bt(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=b.caught(a).unwrap();if(h instanceof Pe){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=b.caught(r).unwrap();if(a instanceof Pe){let h=a;this.addError(h),i=this.currentPos(),this.currentPos().offset==s&&this.advance(),l.body.length==0&&(l.body=[new Ke(this.nextNodeId(4),this.currentPos(),null,je.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=b.caught(r).unwrap();if(a instanceof Pe){let h=a;this.addError(h),i=this.currentPos(),this.currentPos().offset==s&&this.advance(),l.body.length==0&&(l.body=[new Ke(this.nextNodeId(4),this.currentPos(),null,je.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 bl(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 kl(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 ol(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 ol(this.nextNodeId(3),this.currentPos(),null);let i=this.parseIfStatement();t.elseBranch.body=[i],t.elseBranch.style=0}else t.elseBranch=new ol(this.nextNodeId(3),this.currentPos(),null),t.elseBranch.body=[],t.elseBranch.style=this.parseStatementBlock(t.elseBranch.body)}return t.pos=t.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),t}parseAlternative(){let e=this.currentPos(),t;switch(this.tokens[this.current].type._hx_index){case 8:t=0;break;case 9:t=1;break;case 10:t=2;break;case 11:t=3;break;case 12:t=4;break;default:throw b.thrown(new Pe("Expected alternative keyword",this.currentPos()))}let l=new $l(this.nextNodeId(2),e,t,[]);for(this.advance();this.match(k.LineBreak););this.attachComments(l);let i=new ol(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 ol(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 yl(this.nextNodeId(4),e.extendedTo(this.prevNonWhitespaceOrComment().pos),".",this.prevNonWhitespaceOrComment().pos));if(this.check(k.KwBeat)){let s=this.currentPos();this.advance(),this.expect(k.LParen);let r=this.parseCallArguments();r.length==0&&this.addError(new Pe("beat() requires a target expression",s));let a=new yl(this.nextNodeId(4),e.extendedTo(this.prevNonWhitespaceOrComment().pos),null,s.extendedTo(this.prevNonWhitespaceOrComment().pos));return a.targetExpr=r.length>0?r[0]:null,r.length>1&&(a.args=r.slice(1)),this.attachComments(a)}let t=this.expectIdentifier(),l=this.prevNonWhitespaceOrComment().pos,i=null;this.match(k.LParen)&&(i=this.parseCallArguments());let n=new yl(this.nextNodeId(4),e.extendedTo(this.prevNonWhitespaceOrComment().pos),t,l);return n.args=i,this.attachComments(n)}parseInsertion(){let e=this.currentPos();if(this.expect(k.OpPlus),this.check(k.KwBeat)){let s=this.currentPos();this.advance(),this.expect(k.LParen);let r=this.parseCallArguments();r.length==0&&this.addError(new Pe("beat() requires a target expression",s));let a=new zl(this.nextNodeId(4),e.extendedTo(this.prevNonWhitespaceOrComment().pos),null,s.extendedTo(this.prevNonWhitespaceOrComment().pos));return a.targetExpr=r.length>0?r[0]:null,r.length>1&&(a.args=r.slice(1)),this.attachComments(a)}let t=this.expectIdentifier(),l=this.prevNonWhitespaceOrComment().pos,i=null;this.match(k.LParen)&&(i=this.parseCallArguments());let n=new zl(this.nextNodeId(4),e.extendedTo(this.prevNonWhitespaceOrComment().pos),t,l);return n.args=i,this.attachComments(n)}parseBeatCall(){let e=this.currentPos();this.expect(k.KwBeat),this.expect(k.LParen);let t=this.parseCallArguments();t.length==0&&this.addError(new Pe("beat() requires a target expression",e));let l=new Kl(this.nextNodeId(4),e.extendedTo(this.prevNonWhitespaceOrComment().pos),t.length>0?t[0]:null,e.extendedTo(this.prevNonWhitespaceOrComment().pos));return t.length>1&&(l.args=t.slice(1)),this.attachComments(l)}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 jl(this.nextNodeId(3),e,l,[].concat(i),n,s))}else throw b.thrown(new Pe("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 bl(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=b.caught(e).unwrap();return t instanceof Pe&&this.addError(t),new Ke(this.nextNodeId(4),this.currentPos(),null,je.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 si(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 nl(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 nl(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 nl(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 nl(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 nl(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 nl(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 ei(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 Ke(this.nextNodeId(4),e,s,je.Number));case 17:let r=t.b;return this.advance(),this.attachComments(new Ke(this.nextNodeId(4),e,r,je.Boolean));case 18:return this.advance(),this.attachComments(new Ke(this.nextNodeId(4),e,null,je.Null));case 19:let a=t.name;if(this.peek().type==k.Colon){let o=[this.parseObjectField()];return new Ke(this.nextNodeId(4),e.extendedTo(this.prevNonWhitespaceOrComment().pos),o,je.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 b.thrown(new Pe("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 f=this.nextNodeId(4),m=this.nextNodeId(4);return t.push(new Ge(m,p,ze.Raw(n))),this.advance(),this.attachComments(new Bt(f,e,i,t))}let h=this.attachComments(new Bt(this.nextNodeId(4),e,i,t)),o=0,u=s.length;for(;o<u;){let p=o++,f=s[p];switch(f._hx_index){case 0:let m=f.braces,_=f.inTag,g=f.expr,d=f.start,x=f.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,_,g,d,x,n)),a=d+x;break;case 1:let y=f.closing,S=f.start,C=f.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 f=null;t.push(new Ge(this.nextNodeId(4),p,ze.Raw(f!=null?c.substr(n,a,f):c.substr(n,a,null))))}if(this.advance(),this.pendingComments!=null){let p=null,f=0,m=this.pendingComments;for(;f<m.length;){let _=m[f];++f,_.pos.line==e.line?(h.trailingComments==null&&(h.trailingComments=[]),h.trailingComments.push(_)):(p==null&&(p=[]),p.push(_))}this.pendingComments=p}return h}else throw b.thrown(new Pe("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 Pe("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 b.thrown(new Pe("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 _t(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],f=p!=null?p.pos:null;this.addError(new Pe("Empty interpolation",f??this.currentPos()));let m=this.nextNodeId(4),_=this.nextNodeId(4),g=l[0],d=g!=null?g.pos:null;return new Ge(m,h,ze.Expr(new Ke(_,d??this.currentPos(),null,je.Null)))}let o=null;if(!e&&l.length>0){let p=null,f=0,m=!1;for(;f<l.length;){let _=l[f];++f;let g=_.type;switch(g._hx_index){case 19:let d=g.name;if(p==null)p=this.attachComments(this.makeAccess(_.pos,null,d,null));else if(m)p=this.attachComments(this.makeAccess(_.pos,p,d,_.pos));else{this.addError(new Pe("Missing dot in field access",_.pos));let V=this.nextNodeId(4),W=this.nextNodeId(4),H=l[0],G=H!=null?H.pos:null;return new Ge(V,h,ze.Expr(new Ke(W,G??this.currentPos(),null,je.Null)))}m=!1;break;case 44:if(p==null){this.addError(new Pe("Leading dot in field access",_.pos));let V=this.nextNodeId(4),W=this.nextNodeId(4),H=l[0],G=H!=null?H.pos:null;return new Ge(V,h,ze.Expr(new Ke(W,G??this.currentPos(),null,je.Null)))}m=!0;break;case 47:if(p==null){this.addError(new Pe("Function call without target",_.pos));let V=this.nextNodeId(4),W=this.nextNodeId(4),H=l[0],G=H!=null?H.pos:null;return new Ge(V,h,ze.Expr(new Ke(W,G??this.currentPos(),null,je.Null)))}let x=_.pos,y=[],S=[],C=1;for(;f<l.length&&C>0;){let V=l[f];switch(++f,V.type._hx_index){case 43:C==1?S.length>0&&(y.push(S),S=[]):S.push(V);break;case 47:++C,S.push(V);break;case 48:--C,C>0?S.push(V):S.length>0&&y.push(S);break;default:S.push(V)}}if(C>0){this.addError(new Pe("Unterminated function call",x));let V=this.nextNodeId(4),W=this.nextNodeId(4),H=l[0],G=H!=null?H.pos:null;return new Ge(V,h,ze.Expr(new Ke(W,G??this.currentPos(),null,je.Null)))}let O=[],E=0;for(;E<y.length;){let V=y[E];++E;let W=new Yl(V);W.currentNodeId=this.currentNodeId;let H=W.parseExpression();O.push(H),this.currentNodeId=W.currentNodeId}p=this.attachComments(new Vt(this.nextNodeId(4),x.extendedTo(l[f-1].pos),p,O)),m=!1;break;case 49:if(p==null){this.addError(new Pe("Array access without target",_.pos));let V=this.nextNodeId(4),W=this.nextNodeId(4),H=l[0],G=H!=null?H.pos:null;return new Ge(V,h,ze.Expr(new Ke(W,G??this.currentPos(),null,je.Null)))}let v=_.pos,N=[],L=1,B=null;for(;f<l.length&&L>0;){let V=l[f];switch(++f,V.type._hx_index){case 49:++L,N.push(V);break;case 50:--L,L>0&&N.push(V),B=V;break;default:N.push(V)}}if(L>0){this.addError(new Pe("Unterminated array access",v));let V=this.nextNodeId(4),W=this.nextNodeId(4),H=l[0],G=H!=null?H.pos:null;return new Ge(V,h,ze.Expr(new Ke(W,G??this.currentPos(),null,je.Null)))}let I=new Yl(N);I.currentNodeId=this.currentNodeId;let q=I.parseExpression();this.currentNodeId=I.currentNodeId;let z=h.extendedTo(l[f-1].pos);z.length+=1,p=this.attachComments(new dl(this.nextNodeId(4),z,p,q)),m=!1;break;default:this.addError(new Pe("Unexpected token in field access: "+Mt.toCodeString(_.type),_.pos));let P=this.nextNodeId(4),A=this.nextNodeId(4),F=l[0],R=F!=null?F.pos:null;return new Ge(P,h,ze.Expr(new Ke(A,R??this.currentPos(),null,je.Null)))}}m&&this.addError(new Pe("Trailing dot in field access",l[l.length-1].pos)),o=p}else{let p=new Yl(l);p.currentNodeId=this.currentNodeId,o=p.parseExpression(),this.currentNodeId=p.currentNodeId,p.isAtEnd()||this.addError(new Pe("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,f=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,L=C.length,B=N+L;if(N>=o&&B<=p){m=!0;break e}break;case 1:let I=C.closing,q=C.start,z=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(f,a,ze.Tag(e,this.attachComments(new Bt(y,x,0,[new Ge(S,x,ze.Raw(u!=null?c.substr(i,o,u):c.substr(i,o,null)))]))))}let _=[],g=this.attachComments(new Bt(this.nextNodeId(4),a,0,_)),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,L=C.length,B=N+L;if(N>=o&&B<=p){if(N>d){let A=this.makeStringPartPosition(r,i,o);A.length=N-o;let F=N-d;_.push(new Ge(this.nextNodeId(4),A,ze.Raw(F!=null?c.substr(i,d,F):c.substr(i,d,null))))}let P=this.parseStringInterpolation(E,!0,v,N,L,i);P.pos=this.makeStringPartPosition(r,i,N),P.pos.length=L,_.push(P),d=B}break;case 1:let I=C.closing,q=C.start,z=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;_.push(new Ge(this.nextNodeId(4),y,ze.Raw(S!=null?c.substr(i,d,S):c.substr(i,d,null))))}return new Ge(f,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 Pe("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 dl(this.nextNodeId(4),i,t,l))}else if(this.match(k.LParen)){let l=this.parseCallArguments();t=this.attachComments(new Vt(this.nextNodeId(4),e.extendedTo(this.previous().pos),t,l))}else break;return t}parseArrayLiteral(){let e=this.currentPos(),t=[],l=new Ke(this.nextNodeId(4),e,t,je.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 b.thrown(new Pe("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 Ke(this.nextNodeId(4),l!=k.RBrace?this.nextNonWhitespaceOrComment().pos:e,t,je.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 b.thrown(new Pe("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)==bl&&this.addError(new Pe("Invalid condition expression: can't assign a variable here. Did you want to use '==' instead?",l.pos))}catch(i){let n=b.caught(i).unwrap();if(n instanceof Pe){let s=n;this.addError(s),l=new Ke(this.nextNodeId(4),this.currentPos(),null,je.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 Pe("Expected "+Mt.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 Ce(e,this.currentPos());default:}throw b.thrown(t)}}checkIdentifier(){let e=this.tokens[this.current].type;if(e._hx_index==19){let t=e.name;return!0}else return!1}expectIdentifier(){let e=this.tokens[this.current].type;if(e._hx_index==19){let t=e.name;return this.advance(),t}else throw b.thrown(new Pe("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)||Mt.isIdentifier(this.tokens[this.current].type))&&this.advance();return;case 1:case 2:case 3:case 4:case 5:case 46:case 54:return;default:this.advance()}}}requiresNewLine(){switch(this.tokens[this.current].type._hx_index){case 6:case 40:case 46:return!1;default:return!0}}addError(e){return this.errors==null&&(this.errors=[]),this.errors.includes(e)||this.errors.push(e),e}}J["loreline.Parser"]=Yl,Yl.__name__="loreline.Parser",Object.assign(Yl.prototype,{__class__:Yl});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)}}J["loreline.Position"]=ue,ue.__name__="loreline.Position",Object.assign(ue.prototype,{__class__:ue});class Jl{constructor(e,t){t==null&&(t=`
|
|
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 xt}clear(){this._noLn=0,this._level=0,this._prevLevel=0,this._numEmptyLines=0,this._buf=new xt}indent(){this._level++}unindent(){this._level--}write(e){if(e.length>0){this._beginLine>0&&(this.tab(),this._beginLine=0),this._buf.b+=e==null?"null":""+e;let t=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 xt,this._beginLine=1,this.printStringLiteral(e),this.enableComments=t;let l=He.trim(this.toString());return l=l.split(`
|
|
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 xt,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 xt,this._beginLine=1,this.printNode(e),this.toString()}printNode(e,t){if(t==null&&(t=!1),e!=null)switch(te.getClass(e)){case _t:this.printAccess(e);break;case $l:this.printAlternative(e);break;case dl:this.printArrayAccess(e);break;case bl:this.printAssignment(e);break;case Kl:this.printBeatCall(e);break;case Be:this.printBeatDecl(e);break;case nl:this.printBinary(e);break;case Vt:this.printCall(e);break;case Jt:this.printCharacterDecl(e);break;case Ot:this.printChoiceOption(e);break;case wl:this.printChoiceStatement(e);break;case Ht:this.printDialogueStatement(e);break;case jl:this.printFunctionDecl(e);break;case kl:this.printIfStatement(e);break;case Ut:this.printImportStatement(e);break;case zl:this.printInsertion(e);break;case Ke:this.printLiteral(e);break;case Yt:this.printStateDecl(e);break;case Bt:this.printStringLiteral(e);break;case si:this.printTernary(e);break;case il:this.printTextStatement(e);break;case yl:this.printTransition(e,t);break;case ei:this.printUnary(e);break;case sl:this.printScript(e);break;default:let l=te.getClass(e);throw b.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){if(this.newline(),this.newline(),this.printLeadingComments(e),this.write("beat "+e.name),e.params!=null){let i=this.enableComments;this.enableComments=!1,this.write("(");let n=0,s=e.params.length;for(;n<s;){let r=n++;r>0&&this.write(", ");let a=e.params[r];this.write(a.name),a.defaultValue!=null&&(this.write(" = "),this.printNode(a.defaultValue))}this.write(")"),this.enableComments=i}this.write(" "),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 yl)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 kl){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 Jl(this._indent,`
|
|
37
37
|
`).print(e).indexOf(`
|
|
38
38
|
|
|
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(`
|
|
39
|
+
`)!=-1}printTransition(e,t){!t&&this._prevLevel==this._level&&this.newline(),this.printLeadingComments(e),e.targetExpr!=null?(this.write("-> beat("),this.printTargetExprAndArgs(e.targetExpr,e.args),this.write(")")):(this.write("-> "+e.target),e.args!=null&&(this.write("("),this.printTargetExprAndArgs(null,e.args),this.write(")"))),this.printTrailingComments(e)}printInsertion(e){this._prevLevel==this._level&&this.newline(),this.printLeadingComments(e),e.targetExpr!=null?(this.write("+ beat("),this.printTargetExprAndArgs(e.targetExpr,e.args),this.write(")")):(this.write("+ "+e.target),e.args!=null&&(this.write("("),this.printTargetExprAndArgs(null,e.args),this.write(")"))),this.printTrailingComments(e)}printBeatCall(e){this._prevLevel==this._level&&this.newline(),this.printLeadingComments(e),this.write("beat("),this.printTargetExprAndArgs(e.targetExpr,e.args),this.write(")"),this.printTrailingComments(e)}printTargetExprAndArgs(e,t){let l=this.enableComments;this.enableComments=!1;let i=!0;if(e!=null&&(this.printNode(e),i=!1),t!=null){let n=0;for(;n<t.length;){let s=t[n];++n,i||this.write(", "),i=!1,this.printNode(s)}}this.enableComments=l}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
|
|
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 f=p[u];++u,o||(this.write(","),this.newline()),o=!1,this.printNode(f)}this.newline(),this._level--,this.write("]")}else{let o=!0;this.write("[");let u=0,p=e.value;for(;u<p.length;){let f=p[u];++u,o||this.write(", "),o=!1,this.printNode(f)}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 nl?this.printBinary(e,!0):this.printNode(e),t&&this.write(")"),this.enableComments=l}isSimpleInterpolationExpr(e){if(e instanceof _t){let t=e;return t.target==null?!0:this.isSimpleInterpolationExpr(t.target)}return e instanceof dl?this.isSimpleInterpolationExpr(te.__cast(e,dl).target):e instanceof Vt?this.isSimpleInterpolationExpr(te.__cast(e,Vt).target):!1}hasRealNewlines(e){if(e instanceof Bt){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 b.thrown("Unsupported operator: "+Y.string(e))}}}J["loreline.Printer"]=Jl,Jl.__name__="loreline.Printer",Object.assign(Jl.prototype,{__class__:Jl});class dn{static toString(e){switch(e){case 0:return"Unquoted";case 1:return"DoubleQuotes"}}}class yi{constructor(e){e==null&&(e=-1),e<0&&(e=new Date().getTime()/1e3*1e6,e+=Math.random()*1e5,e%=2147483647),this.seed=e,this.initialSeed=this.seed}next(){return(this.seed=this.seed*16807%2147483647)/2147483647+233e-12}between(e,t){return Math.floor(e+(t-e)*((this.seed=this.seed*16807%2147483647)/2147483647+233e-12))}reset(e){e!=null&&(this.initialSeed=e),this.seed=this.initialSeed}}J["loreline.Random"]=yi,yi.__name__="loreline.Random",Object.assign(yi.prototype,{__class__:yi});class sl extends Fe{constructor(e,t,l){ut._hx_skip_constructor=!0,super(),ut._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 Ut||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 nn(this.body)}static fromJson(e){return D.scriptFromJson(e)}}J["loreline.Script"]=Zl.loreline.Script=sl,sl.__name__="loreline.Script",sl.__super__=Fe,Object.assign(sl.prototype,{__class__:sl});class nn{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 Ut){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}}J["loreline._Script.ScriptBodyIterator"]=nn,nn.__name__="loreline._Script.ScriptBodyIterator",Object.assign(nn.prototype,{__class__:nn});class sn{constructor(e,t){this.remaining=e,this.done=t}}J["loreline._Timer.PendingTimer"]=sn,sn.__name__="loreline._Timer.PendingTimer",Object.assign(sn.prototype,{__class__:sn});class ti{static register(e,t){ti.timers.push(new sn(e,t))}static update(e){if(ti.timers.length==0)return;let t=ti.timers.length;for(;--t>=0;){let l=ti.timers[t];l.remaining-=e,l.remaining<=0&&(ti.timers.splice(t,1),l.done())}}}J["loreline.Timer"]=ti,ti.__name__="loreline.Timer";class xn{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)}static toCodes(e){let t=e.length,l=new Array(t),i=0,n=t;for(;i<n;){let s=i++;l[s]=e.charCodeAt(s)}return l}}J["loreline.Utf8"]=xn,xn.__name__="loreline.Utf8";class Di{static uLength(e){return e.length}static uCharCodeAt(e,t){return t<0||t>=e.length?-1:e[t]}static uSubstr(e,t,l){return Di.slice(e,t,l!=null?t+l:e.length)}static uSubstring(e,t,l){return Di.slice(e,t,l??e.length)}static uCharAt(e,t){return t<0||t>=e.length?"":Di.slice(e,t,t+1)}static uIndexOf(e,t,l){let i=xn.toCodes(t),n=i.length;if(n==0)return l??0;let s=l!=null&&l>0?l:0,r=e.length-n;for(;s<=r;){let a=0;for(;a<n&&e[s+a]==i[a];)++a;if(a==n)return s;++s}return-1}static slice(e,t,l){t<0&&(t=0),l>e.length&&(l=e.length);let i="",n=t;for(;n<l;)i+=String.fromCodePoint(e[n]),++n;return i}}J["loreline.Utf8Vector"]=Di,Di.__name__="loreline.Utf8Vector";class Ri extends st{constructor(e,t,l){super(t,l),this.wrapped=e}}J["loreline.WrappedError"]=Ri,Ri.__name__="loreline.WrappedError",Ri.__super__=st,Object.assign(Ri.prototype,{__class__:Ri});class wn{static main(){}}J["loreline.lib.Library"]=wn,wn.__name__="loreline.lib.Library";var Q=Ye["loreline.lorscript.TType"]={__ename__:"loreline.lorscript.TType",__constructs__:null,TMono:(w=function(T){return{_hx_index:0,r:T,__enum__:"loreline.lorscript.TType",toString:M}},w._hx_name="TMono",w.__params__=["r"],w),TVoid:{_hx_name:"TVoid",_hx_index:1,__enum__:"loreline.lorscript.TType",toString:M},TInt:{_hx_name:"TInt",_hx_index:2,__enum__:"loreline.lorscript.TType",toString:M},TFloat:{_hx_name:"TFloat",_hx_index:3,__enum__:"loreline.lorscript.TType",toString:M},TBool:{_hx_name:"TBool",_hx_index:4,__enum__:"loreline.lorscript.TType",toString:M},TDynamic:{_hx_name:"TDynamic",_hx_index:5,__enum__:"loreline.lorscript.TType",toString:M},TParam:(w=function(T){return{_hx_index:6,name:T,__enum__:"loreline.lorscript.TType",toString:M}},w._hx_name="TParam",w.__params__=["name"],w),TUnresolved:(w=function(T){return{_hx_index:7,name:T,__enum__:"loreline.lorscript.TType",toString:M}},w._hx_name="TUnresolved",w.__params__=["name"],w),TNull:(w=function(T){return{_hx_index:8,t:T,__enum__:"loreline.lorscript.TType",toString:M}},w._hx_name="TNull",w.__params__=["t"],w),TInst:(w=function(T,e){return{_hx_index:9,c:T,args:e,__enum__:"loreline.lorscript.TType",toString:M}},w._hx_name="TInst",w.__params__=["c","args"],w),TEnum:(w=function(T,e){return{_hx_index:10,e:T,args:e,__enum__:"loreline.lorscript.TType",toString:M}},w._hx_name="TEnum",w.__params__=["e","args"],w),TType:(w=function(T,e){return{_hx_index:11,t:T,args:e,__enum__:"loreline.lorscript.TType",toString:M}},w._hx_name="TType",w.__params__=["t","args"],w),TAbstract:(w=function(T,e){return{_hx_index:12,a:T,args:e,__enum__:"loreline.lorscript.TType",toString:M}},w._hx_name="TAbstract",w.__params__=["a","args"],w),TFun:(w=function(T,e){return{_hx_index:13,args:T,ret:e,__enum__:"loreline.lorscript.TType",toString:M}},w._hx_name="TFun",w.__params__=["args","ret"],w),TAnon:(w=function(T){return{_hx_index:14,fields:T,__enum__:"loreline.lorscript.TType",toString:M}},w._hx_name="TAnon",w.__params__=["fields"],w),TLazy:(w=function(T){return{_hx_index:15,f:T,__enum__:"loreline.lorscript.TType",toString:M}},w._hx_name="TLazy",w.__params__=["f"],w)};Q.__constructs__=[Q.TMono,Q.TVoid,Q.TInt,Q.TFloat,Q.TBool,Q.TDynamic,Q.TParam,Q.TUnresolved,Q.TNull,Q.TInst,Q.TEnum,Q.TType,Q.TAbstract,Q.TFun,Q.TAnon,Q.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:M},Value:{_hx_name:"Value",_hx_index:1,__enum__:"loreline.lorscript._Checker.WithType",toString:M},WithType:(w=function(T){return{_hx_index:2,t:T,__enum__:"loreline.lorscript._Checker.WithType",toString:M}},w._hx_name="WithType",w.__params__=["t"],w)};ve.__constructs__=[ve.NoValue,ve.Value,ve.WithType];var xl=Ye["loreline.lorscript.CTypedecl"]={__ename__:"loreline.lorscript.CTypedecl",__constructs__:null,CTClass:(w=function(T){return{_hx_index:0,c:T,__enum__:"loreline.lorscript.CTypedecl",toString:M}},w._hx_name="CTClass",w.__params__=["c"],w),CTEnum:(w=function(T){return{_hx_index:1,e:T,__enum__:"loreline.lorscript.CTypedecl",toString:M}},w._hx_name="CTEnum",w.__params__=["e"],w),CTTypedef:(w=function(T){return{_hx_index:2,t:T,__enum__:"loreline.lorscript.CTypedecl",toString:M}},w._hx_name="CTTypedef",w.__params__=["t"],w),CTAlias:(w=function(T){return{_hx_index:3,t:T,__enum__:"loreline.lorscript.CTypedecl",toString:M}},w._hx_name="CTAlias",w.__params__=["t"],w),CTAbstract:(w=function(T){return{_hx_index:4,a:T,__enum__:"loreline.lorscript.CTypedecl",toString:M}},w._hx_name="CTAbstract",w.__params__=["a"],w)};xl.__constructs__=[xl.CTClass,xl.CTEnum,xl.CTTypedef,xl.CTAlias,xl.CTAbstract];class Vi{constructor(e,t){this.expr=e,this.t=t}}J["loreline.lorscript.Completion"]=Vi,Vi.__name__="loreline.lorscript.Completion",Object.assign(Vi.prototype,{__class__:Vi});class rn{constructor(){this.types=new Se,this.types=new Se,this.types.h.Void=xl.CTAlias(Q.TVoid),this.types.h.Int=xl.CTAlias(Q.TInt),this.types.h.Float=xl.CTAlias(Q.TFloat),this.types.h.Bool=xl.CTAlias(Q.TBool),this.types.h.Dynamic=xl.CTAlias(Q.TDynamic),this.parser=new fi}addXmlApi(e){let t=new Ki;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 Se,statics:new Se,params:[]}),this.types.h[e]=xl.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 Se,statics:new Se};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(Q.TParam(v))}t.push(function(){let v=new Se,N=0,L=h.params;for(;N<L.length;){let F=L[N];++N;let R=a.path+"."+tt.typeStr(F);v.h[R]=F}if(l.localParams=v,a.superClass!=null){let F=l,R=a.superClass.path,V=[],W=0,H=a.superClass.params;for(;W<H.length;){let G=H[W];++W,V.push(l.makeXmlType(G))}h.superClass=F.getType(R,V)}if(a.interfaces!=null){h.interfaces=[];let F=0,R=a.interfaces;for(;F<R.length;){let V=R[F];++F;let W=h.interfaces,H=l,G=V.path,X=[],he=0,ce=V.params;for(;he<ce.length;){let ne=ce[he];++he,X.push(l.makeXmlType(ne))}W.push(H.getType(G,X))}}let B=[],I=function(F,R){if(F.isOverride||c.substr(F.name,0,4)=="get_"||c.substr(F.name,0,4)=="set_")return;let V=!F.name.startsWith("__"),W=0,H=F.meta;for(;W<H.length;){let ae=H[W];if(++W,ae.name==":noScript")return;ae.name==":noCompletion"&&(V=!1)}let G=F.set,X;switch(G._hx_index){case 2:let ae=G.m;X=!0;break;case 0:case 4:X=!0;break;default:X=!1}let he={isPublic:F.isPublic,canWrite:X,complete:V,params:[],name:F.name,t:null},ce=0,ne=F.params;for(;ce<ne.length;){let ae=ne[ce];++ce;let xe=Q.TParam(ae),Ie=F.name+"."+ae;B.push(Ie),he.params.push(xe),l.localParams.h[Ie]=xe}if(he.t=l.makeXmlType(F.type),F.meta!=null&&F.meta.length>0){he.meta=[];let ae=0,xe=F.meta;for(;ae<xe.length;){let Ie=xe[ae];++ae;let Ue=he.meta,Je=Ie.name,lt=[],qe=0,Qe=Ie.params;for(;qe<Qe.length;){let rt=Qe[qe];++qe;let Ve;try{Ve=l.parser.parseString(rt)}catch($){if(b.caught($).unwrap()instanceof ke)Ve=null;else throw $}lt.push(Ve)}Ue.push({name:Je,params:lt})}}for(;B.length>0;){let ae=l.localParams,xe=B.pop(),Ie=ae;Object.prototype.hasOwnProperty.call(Ie.h,xe)&&delete Ie.h[xe]}he.name=="new"?h.constructor=he:R.set(F.name,he)},q=0,z=a.fields;for(;q<z.length;){let F=z[q];++q,I(F,h.fields)}let P=0,A=a.statics;for(;P<A.length;){let F=A[P];++P,I(F,h.statics)}l.localParams=null}),this.types.h[h.name]=xl.CTClass(h);break;case 2:let p=e.e;if(Object.prototype.hasOwnProperty.call(this.types.h,p.path))return;let f={name:p.path,params:[],constructors:[]};this.addMeta(p,f);let m=0,_=p.params;for(;m<_.length;){let v=_[m];++m,f.params.push(Q.TParam(v))}t.push(function(){let v=new Se,N=0,L=f.params;for(;N<L.length;){let q=L[N];++N;let z=p.path+"."+tt.typeStr(q);v.h[z]=q}l.localParams=v;let B=0,I=p.constructors;for(;B<I.length;){let q=I[B];++B;let z=f.constructors,P=q.name,A;if(q.args==null)A=null;else{let F=[],R=0,V=q.args;for(;R<V.length;){let W=V[R];++R,F.push({name:W.name,opt:W.opt,t:l.makeXmlType(W.t)})}A=F}z.push({name:P,args:A})}l.localParams=null}),this.types.h[f.name]=xl.CTEnum(f);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(Q.TParam(v))}g.path=="loreline.lorscript.TypeCheck"&&d.params.reverse(),t.push(function(){let v=new Se,N=0,L=d.params;for(;N<L.length;){let B=L[N];++N;let I=g.path+"."+tt.typeStr(B);v.h[I]=B}l.localParams=v,d.t=l.makeXmlType(g.type),l.localParams=null}),this.types.h[g.path]=xl.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(Q.TParam(v))}t.push(function(){let v=new Se,N=0,L=C.params;for(;N<L.length;){let B=L[N];++N;let I=S.path+"."+tt.typeStr(B);v.h[I]=B}l.localParams=v,C.t=l.makeXmlType(S.athis),l.localParams=null}),this.types.h[S.path]=xl.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(f){if(b.caught(f).unwrap()instanceof ke)p=null;else throw f}a.push(p)}s.push({name:r,params:a})}}makeXmlType(e){switch(e._hx_index){case 0:return Q.TUnresolved("Unknown");case 1:let t=e.name,l=e.params,i=[],n=0;for(;n<l.length;){let L=l[n];++n,i.push(this.makeXmlType(L))}return this.getType(t,i);case 2:let s=e.name,r=e.params,a=[],h=0;for(;h<r.length;){let L=r[h];++h,a.push(this.makeXmlType(L))}return this.getType(s,a);case 3:let o=e.name,u=e.params,p=[],f=0;for(;f<u.length;){let L=u[f];++f,p.push(this.makeXmlType(L))}return this.getType(o,p);case 4:let m=e.args,_=e.ret,g=[],d=0;for(;d<m.length;){let L=m[d];++d,g.push({name:L.name,opt:L.opt,t:this.makeXmlType(L.t)})}return Q.TFun(g,this.makeXmlType(_));case 5:let x=e.fields,y=[],S=0;for(;S<x.length;){let L=x[S];++S;let B=L.name,I=this.makeXmlType(L.type),q=L.meta,z;if(q==null)z=!1;else{let P=!1,A=0;for(;A<q.length;){let F=q[A];if(++A,F.name==":optional"){P=!0;break}}z=P}y.push({name:B,t:I,opt:z})}return Q.TAnon(y);case 6:let C=e.t;return Q.TDynamic;case 7:let O=e.name,E=e.params,v=[],N=0;for(;N<E.length;){let L=E[N];++N,v.push(this.makeXmlType(L))}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 Q.TUnresolved(e)}return l}resolve(e,t){if(e=="Null"){if(t==null||t.length!=1)throw b.thrown("Missing Null<T> parameter");return Q.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 Q.TInst(i,t);case 1:let n=l.e;return Q.TEnum(n,t);case 2:let s=l.t;return Q.TType(s,t);case 3:return l.t;case 4:let a=l.a;return Q.TAbstract(a,t)}}}J["loreline.lorscript.CheckerTypes"]=rn,rn.__name__="loreline.lorscript.CheckerTypes",Object.assign(rn.prototype,{__class__:rn});class tt{constructor(e){this.events=new Se,this.globals=new Se,e==null&&(e=new rn),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:Q.TLazy(function(){let p=l,f=o.t,m=o.params,_=[],g=0,d=o.params.length;for(;g<d;){let x=g++;_.push(l.makeMono())}return p.apply(f,m,_)});this.setGlobal(o.name,u)}}if(e.superClass==null)break;let h=e.superClass;if(h==null)throw b.thrown("assert");if(h._hx_index==9){let o=h.args;e=h.c}else throw b.thrown("assert")}}removeGlobal(e){let t=this.globals;Object.prototype.hasOwnProperty.call(t.h,e)&&delete t.h[e]}setGlobal(e,t){this.globals.h[e]=t}setEvent(e,t){this.events.h[e]=t}getGlobals(){return this.globals}onTopDownEnum(e,t){return!1}typeArgs(e,t){let 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 Se,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(j.EBlock([e]),e));let s=this,r=e.e;if(r._hx_index==4){let a=r.e,h=[],o=Q.TVoid,u=0;for(;u<a.length;){let f=a[u];for(++u;;){let _=f.e;if(_._hx_index==25){let g=_.name,d=_.args;f=_.e}else break}let m=f.e;if(m._hx_index==14){let _=m.e,g=m.args,d=m.name,x=m.ret;if(d!=null){let y=x==null?this.makeMono():this.makeType(x,f),S=Q.TFun(this.typeArgs(g,f),y);this.locals.h[d]=S,h.push(function(){return s.currentFunType=S,s.typeExpr(f,ve.NoValue),S})}else{let y=0;for(;y<h.length;){let S=h[y];++y,S()}h=[],a[a.length-1]==f?o=this.typeExpr(f,t):this.typeExpr(f,ve.NoValue)}}else{let _=0;for(;_<h.length;){let g=h[_];++_,g()}h=[],a[a.length-1]==f?o=this.typeExpr(f,t):this.typeExpr(f,ve.NoValue)}}let p=0;for(;p<h.length;){let f=h[p];++p,o=f()}return o}return this.typeExpr(e,t)}edef(e){return e.e}error(e,t){let l=we.ECustom(e),i=new ke(l,t.pmin,t.pmax,t.origin,t.line);if(!this.isCompletion)throw b.thrown(i)}saveLocals(){let e=new Se,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=we.ECustom("Unknown type "+Y.string(l)),O=new ke(C,t.pmin,t.pmax,t.origin,t.line);if(!this.isCompletion)throw b.thrown(O);a=Q.TDynamic}return a;case 1:let h=e.args,o=e.ret,u=0,p=[],f=0;for(;f<h.length;){let C=h[f];++f,p.push({name:"p"+u++,opt:!1,t:this.makeType(C,t)})}return Q.TFun(p,this.makeType(o,t));case 2:let m=e.fields,_=[],g=0;for(;g<m.length;){let C=m[g];++g,_.push({name:C.name,opt:!1,t:this.makeType(C.t,t)})}return Q.TAnon(_);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==Q.TDynamic?!1:this.linkLoop(e,Q.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 f=t.a,m=t.args,_=0;for(;_<m.length;){let C=m[_];if(++_,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==Q.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 L=v++;if(!this.typeEq(S[L],y[L]))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 L=v++;if(!this.typeEq(S[L],y[L]))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 L=0,B=O.length;for(;L<B;){let I=L++;if(!this.typeEq(O[I],C[I]))return!1}return!0}else{let L=o,B=h;return this.typeEq(this.apply(B.t,B.params,L),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 L=v++;if(!this.typeEq(O[L],C[L]))return!1}return!0}break;default:}break;case 13:let f=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=f;if(E.length==S.length){let v=0,N=E.length;for(;v<N;){let L=v++;if(!this.typeEq(E[L].t,S[L].t))return!1}return this.typeEq(O,C)}break;default:}break;case 14:let _=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=_;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 L=O[N.name];if(L==null||!this.typeEq(N.t,L.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 f=t.t;return this.tryUnify(e,f);case 11:let m=t.t,_=t.args;return this.tryUnify(e,this.apply(m.t,m.params,_));default:}break;case 5:switch(t._hx_index){case 0:let p=t.r;return p.r==null?this.link(t,e,p)?(p.r=e,!0):!1:this.tryUnify(e,p.r);case 5:return!0;case 8:let f=t.t;return this.tryUnify(e,f);case 11:let m=t.t,_=t.args;return this.tryUnify(e,this.apply(m.t,m.params,_));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 f=i;return this.tryUnify(f,t);case 8:let m=t.t,_=i;return this.tryUnify(_,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 f=t.t;return this.tryUnify(e,f);case 9:let m=t.c,_=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,A=z.args,F=[],R=0;for(;R<A.length;){let W=A[R];++R,F.push(this.apply(W,d.params,g))}let V=Q.TInst(P,F);if(this.tryUnify(V,t))return!0}else throw b.thrown("assert")}}let B=d.superClass;if(B==null)return!1;if(B._hx_index==9){let I=B.c,q=B.args,z=[],P=0;for(;P<q.length;){let A=q[P];++P,z.push(this.apply(A,d.params,g))}g=z,d=I}else throw b.thrown("assert")}let x=0,y=g.length;for(;x<y;){let B=x++;if(!this.typeEq(g[B],_[B]))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,L=O.length;for(;N<L;){let B=N++,I=O[B],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 b.thrown("assert");if(P._hx_index==9){let A=P.args;z=P.c}else throw b.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 f=a,m=r;return this.tryUnify(this.apply(m.t,m.params,f),t);case 8:let _=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 f=t.t;return this.tryUnify(e,f);case 11:let m=t.t,_=t.args;return this.tryUnify(e,this.apply(m.t,m.params,_));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,L=v.length;for(;N<L;){let B=N++,I=v[B],q=C[B];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 f=t.t;return this.tryUnify(e,f);case 11:let m=t.t,_=t.args;return this.tryUnify(e,this.apply(m.t,m.params,_));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 f=t.t;return this.tryUnify(e,f);case 11:let m=t.t,_=t.args;return this.tryUnify(e,this.apply(m.t,m.params,_));default:}}return this.typeEq(e,t)}unify(e,t,l){if(!this.tryUnify(e,t)){let i=we.ECustom(tt.typeStr(e)+" should be "+tt.typeStr(t)),n=new ke(i,l.pmin,l.pmax,l.origin,l.line);if(!this.isCompletion)throw b.thrown(n)}}apply(e,t,l){if(l.length!=t.length)throw b.thrown("Invalid number of type parameters");if(l.length==0)return e;let i=new hi,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 Q.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 Q.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 Q.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 Q.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 Q.TAbstract(S,C)}break;case 13:let u=e.args,p=e.ret,f=[],m=0;for(;m<u.length;){let y=u[m];++m,f.push({name:y.name,opt:y.opt,t:t(y.t)})}return Q.TFun(f,t(p));case 14:let _=e.fields,g=[],d=0;for(;d<_.length;){let y=_[d];++d,g.push({name:y.name,opt:y.opt,t:t(y.t)})}return Q.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,f=p,m=Object.keys(p),_=m.length,g=0;for(;g<_;){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:Q.TFun(a,Q.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,f=s.interfaces;for(;p<f.length;){let m=f[p];++p;let _=this.getField(m,t,l,i);if(_!=null)return this.apply(_,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=we.ECustom("Can't access private field "+t+" on "+s.name),f=new ke(p,l.pmin,l.pmax,l.origin,l.line);if(!this.isCompletion)throw b.thrown(f)}if(i&&!a.canWrite){let p=we.ECustom("Can't write readonly field "+t+" on "+s.name),f=new ke(p,l.pmin,l.pmax,l.origin,l.line);if(!this.isCompletion)throw b.thrown(f)}let h=a.t;if(a.params!=null){let p=a.params,f=[],m=0,_=a.params.length;for(;m<_;){let g=m++;f.push(this.makeMono())}h=this.apply(h,p,f)}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 Q.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 Q.TMono({r:null})}makeIterator(e){return Q.TAnon([{name:"next",opt:!1,t:Q.TFun([],e)},{name:"hasNext",opt:!1,t:Q.TFun([],Q.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 b.thrown(new Vi(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=we.ECustom(tt.typeStr(n)+" has no field "+t),a=new ke(r,l.pmin,l.pmax,l.origin,l.line);if(!this.isCompletion)throw b.thrown(a);s=Q.TDynamic}return s}typeExpr(e,t){if(e==null&&this.isCompletion)return t._hx_index==2?t.t:Q.TDynamic;let l=this,i=e.e;switch(i._hx_index){case 0:let a=i.c;switch(a._hx_index){case 0:let _e=a.v;return Q.TInt;case 1:let be=a.f;return Q.TFloat;case 2:let Me=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 _e=u.f;return _e()}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 Q.TBool;case"null":return this.makeMono();case"trace":return Q.TDynamic;default:if(t._hx_index==2){let Me=t.t;if(Me._hx_index==10){let We=Me,Kt=Me.e,Rt=Me.args,pt=0,Nl=Kt.constructors;for(;pt<Nl.length;){let fl=Nl[pt];if(++pt,fl.name==h){if(this.onTopDownEnum(Kt,h)){let dt=fl.args==null?We:Q.TFun(fl.args,We);return this.apply(dt,Kt.params,Rt)}break}}}}if(this.isCompletion)return Q.TDynamic;let _e=we.ECustom("Unknown identifier "+h),be=new ke(_e,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw b.thrown(be)}break;case 2:let p=i.n,f=i.t,m=i.e,_=f==null?this.makeMono():this.makeType(f,e);if(m!=null){let _e=this.typeExpr(m,f==null?ve.Value:ve.WithType(_));f==null?_=_e:this.unify(_e,_,m)}return this.locals.h[p]=_,Q.TVoid;case 3:let g=i.e;return this.typeExpr(g,t);case 4:let d=i.e,x=Q.TVoid,y=this.saveLocals(),S=0;for(;S<d.length;){let _e=d[S];++S,x=this.typeExpr(_e,_e==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 _e=this.typeExpr(v,ve.Value),be=this.typeExpr(N,ve.WithType(_e));return this.tryUnify(_e,be)||this.unify(be,_e,N),Q.TBool;case"%":case"*":case"-":case"/":let Me=this.typeExpr(v,ve.WithType(Q.TInt)),We=this.typeExpr(N,ve.WithType(Me));this.tryUnify(Me,We)||this.unify(We,Me,N);let Kt=this.follow(Me),Rt=this.follow(We);switch(Kt._hx_index){case 2:switch(Rt._hx_index){case 2:return E=="/"?Q.TFloat:Q.TInt;case 3:case 5:return Q.TFloat;default:this.unify(Me,Q.TFloat,v),this.unify(We,Q.TFloat,N)}break;case 3:switch(Rt._hx_index){case 2:case 3:case 5:return Q.TFloat;default:this.unify(Me,Q.TFloat,v),this.unify(We,Q.TFloat,N)}break;case 5:switch(Rt._hx_index){case 2:case 3:case 5:return Q.TFloat;default:this.unify(Me,Q.TFloat,v),this.unify(We,Q.TFloat,N)}break;default:this.unify(Me,Q.TFloat,v),this.unify(We,Q.TFloat,N)}break;case"+":let pt=this.typeExpr(v,ve.WithType(Q.TInt)),Nl=this.typeExpr(N,ve.WithType(pt));this.tryUnify(pt,Nl);let fl=this.follow(pt),dt=this.follow(Nl);switch(fl._hx_index){case 2:switch(dt._hx_index){case 2:return Q.TInt;case 3:return Q.TFloat;case 5:return Q.TDynamic;default:let Nt=fl,Sl=dt;if(this.isString(Nt)||this.isString(Sl))return this.types.t_string;this.unify(Nt,Q.TFloat,v),this.unify(Sl,Q.TFloat,N)}break;case 3:switch(dt._hx_index){case 2:case 3:return Q.TFloat;case 5:return Q.TDynamic;default:let Nt=fl,Sl=dt;if(this.isString(Nt)||this.isString(Sl))return this.types.t_string;this.unify(Nt,Q.TFloat,v),this.unify(Sl,Q.TFloat,N)}break;case 5:return Q.TDynamic;default:if(dt._hx_index==5)return Q.TDynamic;{let Nt=fl,Sl=dt;if(this.isString(Nt)||this.isString(Sl))return this.types.t_string;this.unify(Nt,Q.TFloat,v),this.unify(Sl,Q.TFloat,N)}}break;case"...":return this.typeExprWith(v,Q.TInt),this.typeExprWith(N,Q.TInt),this.makeIterator(Q.TInt);case"&":case"<<":case">>":case">>>":case"^":case"|":return this.typeExprWith(v,Q.TInt),this.typeExprWith(N,Q.TInt),Q.TInt;case"<":case"<=":case">":case">=":let $t=this.typeExpr(v,ve.Value),Hl=this.typeExpr(N,ve.WithType($t));this.tryUnify($t,Hl)||this.unify(Hl,$t,N);let _i=this.follow($t);switch(_i._hx_index){case 2:case 3:case 4:break;case 9:let Nt=_i.c,Sl=_i.args,bn=Nt.constructor,Gn=Nt.fields,Qn=Nt.interfaces,$n=Nt.isInterface,Yn=Nt.meta,Zn=Nt.params,Xn=Nt.statics,es=Nt.superClass;if(Nt.name!="String"){let Kn=we.ECustom("Cannot compare "+tt.typeStr($t)),jn=new ke(Kn,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw b.thrown(jn)}break;default:let Wn=we.ECustom("Cannot compare "+tt.typeStr($t)),zn=new ke(Wn,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw b.thrown(zn)}return Q.TBool;case"=":if(this.allowDefine){let Nt=v.e;if(Nt._hx_index==1){let Sl=Nt.v;if(!Object.prototype.hasOwnProperty.call(this.locals.h,Sl)&&!Object.prototype.hasOwnProperty.call(this.globals.h,Sl)){let bn=this.typeExpr(N,ve.Value);return this.locals.h[Sl]=bn,bn}}}let qi,cn=v.e;if(cn._hx_index==5){let Nt=cn.e,Sl=cn.f;qi=this.typeField(Nt,Sl,v,!0)}else qi=this.typeExpr(v,ve.Value);return this.typeExprWith(N,qi),qi;case"&&":case"||":return this.typeExprWith(v,Q.TBool),this.typeExprWith(N,Q.TBool),Q.TBool;default:if(c.cca(E,E.length-1)==61){let Nt=this.typeExpr(this.mk(j.EBinop(c.substr(E,0,E.length-1),v,N),e),t);return this.typeExpr(this.mk(j.EBinop("=",v,N),e),t)}let Un=we.ECustom("Unsupported operation "+E),qn=new ke(Un,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw b.thrown(qn)}break;case 7:let L=i.prefix,B=i.op,I=i.e,q=this.typeExpr(I,ve.Value);switch(B){case"!":return this.unify(q,Q.TBool,I),q;case"++":case"-":case"--":return this.unify(q,Q.TInt,I),q;default:}break;case 8:let z=i.e,P=i.params,A=z.e;if(A._hx_index==5&&A.f=="bind"){let _e=A.e,be=this.typeExpr(_e,ve.Value);if(be._hx_index==13){let Me=be.args,We=be.ret,Kt=Me.slice(),Rt=0;for(;Rt<P.length;){let pt=P[Rt];++Rt;let Nl=Kt.shift();if(Nl==null){let fl=we.ECustom("Too many arguments"),dt=new ke(fl,pt.pmin,pt.pmax,pt.origin,pt.line);if(!this.isCompletion)throw b.thrown(dt);return Q.TFun([],We)}this.typeExprWith(pt,Nl.t)}return Q.TFun(Kt,We)}}let F=z.e,R;if(F._hx_index==1){let _e=F.v;if(t._hx_index==2){let be=t.t;if(be._hx_index==10){let Me=be.e,We=be.args;R=t}else R=ve.Value}else R=ve.Value}else R=ve.Value;let V=this.typeExpr(z,R),W=this.follow(V);switch(W._hx_index){case 5:let _e=0;for(;_e<P.length;){let dt=P[_e];++_e,this.typeExpr(dt,ve.Value)}return this.makeMono();case 13:let be=W.args,Me=W.ret,We=0,Kt=P.length;for(;We<Kt;){let dt=We++,$t=be[dt];if($t==null){let _i=P[dt],qi=we.ECustom("Too many arguments"),cn=new ke(qi,_i.pmin,_i.pmax,_i.origin,_i.line);if(!this.isCompletion)throw b.thrown(cn);break}let Hl=this.typeExpr(P[dt],$t==null?ve.Value:ve.WithType($t.t));this.unify(Hl,$t.t,P[dt])}let Rt=P.length,pt=be.length;for(;Rt<pt;){let dt=Rt++;if(!be[dt].opt){let $t=we.ECustom("Missing argument "+be[dt].name+":"+tt.typeStr(be[dt].t)),Hl=new ke($t,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw b.thrown(Hl)}}return Me;default:let Nl=we.ECustom(tt.typeStr(V)+" cannot be called"),fl=new ke(Nl,z.pmin,z.pmax,z.origin,z.line);if(!this.isCompletion)throw b.thrown(fl);return this.makeMono()}break;case 9:let H=i.cond,G=i.e1,X=i.e2;this.typeExprWith(H,Q.TBool);let he=this.typeExpr(G,t);if(X==null)return he;let ce=this.typeExpr(X,t);if(t==ve.NoValue)return Q.TVoid;if(this.tryUnify(ce,he))return he;if(this.tryUnify(he,ce))return ce;this.unify(ce,he,X);break;case 10:let ne=i.cond,ae=i.e;return this.typeExprWith(ne,Q.TBool),this.typeExpr(ae,ve.NoValue),Q.TVoid;case 11:let xe=i.v,Ie=i.it,Ue=i.e,Je=this.saveLocals(),lt=this.typeExpr(Ie,ve.Value),qe=this.getIteratorType(Ie,lt);return this.locals.h[xe]=qe,this.typeExpr(Ue,ve.NoValue),this.locals=Je,Q.TVoid;case 12:case 13:return Q.TVoid;case 14:let Qe=i.args,rt=i.e,Ve=i.name,$=i.ret,se=null,K=null,ie=null;if(this.currentFunType!=null){let _e=this.currentFunType;if(_e._hx_index==13){let be=_e.args,Me=_e.ret;se=this.currentFunType,K=Me,ie=be}else throw b.thrown("assert");this.currentFunType=null}else K=$==null?this.makeMono():this.makeType($,e);let le=this.saveLocals(),ee=this.allowReturn,pe=this.allowDefine,ge=this.hasReturn;this.allowReturn=K,this.allowDefine=!1,this.hasReturn=!1;let ye=null,Ze;if(Ve!=null){let _e;if(t._hx_index==2){let be=this.follow(t.t);if(be._hx_index==13){let Me=be.args,We=be.ret;_e=!0}else _e=!1}else _e=!1;Ze=!_e}else Ze=!1;if(Ze){let _e=this.events.h[Ve];_e!=null&&(t=ve.WithType(_e))}if(t._hx_index==2){let _e=this.follow(t.t);if(_e._hx_index==13){let be=_e.args,Me=_e.ret;ye=be,this.unify(K,Me,e)}}ie==null&&(ie=this.typeArgs(Qe,e));let Tt=0,Le=ie.length;for(;Tt<Le;){let _e=Tt++,be=ie[_e];if(ye!=null)if(_e<ye.length)this.unify(ye[_e].t,be.t,e);else{let Me=we.ECustom("Extra argument "+be.name),We=new ke(Me,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw b.thrown(We)}this.locals.h[be.name]=be.t}if(ye!=null&&ie.length<ye.length){let _e="Missing "+(ye.length-ie.length)+" arguments (",be=[],Me=ie.length,We=ye.length;for(;Me<We;){let pt=Me++;be.push(tt.typeStr(ye[pt].t))}let Kt=we.ECustom(_e+be.join(",")+")"),Rt=new ke(Kt,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw b.thrown(Rt)}if(this.typeExpr(rt,ve.NoValue),!this.hasReturn&&!this.tryUnify(K,Q.TVoid)){let _e=we.ECustom("Missing return "+tt.typeStr(K)),be=new ke(_e,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw b.thrown(be)}return this.allowDefine=pe,this.allowReturn=ee,this.hasReturn=ge,this.locals=le,se==null&&(se=Q.TFun(ie,K),Ve!=null&&(le.h[Ve]=se)),se;case 15:let wt=i.e,Oe=wt==null?Q.TVoid:this.typeExpr(wt,this.allowReturn==null?ve.Value:ve.WithType(this.allowReturn));if(this.hasReturn=!0,this.allowReturn==null){let _e=we.ECustom("Return not allowed here"),be=new ke(_e,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw b.thrown(be)}else this.unify(Oe,this.allowReturn,wt??e);return this.makeMono();case 16:let Ne=i.e,ft=i.index;this.typeExprWith(ft,Q.TInt);let it=this.typeExpr(Ne,ve.Value),It=this.follow(it);if(It._hx_index==9){let _e=It.c,be=It.args,Me=_e.constructor,We=_e.fields,Kt=_e.interfaces,Rt=_e.isInterface,pt=_e.meta,Nl=_e.params,fl=_e.statics,dt=_e.superClass;if(_e.name=="Array"){if(be.length==1)return be[0];{let $t=we.ECustom(tt.typeStr(it)+" is not an Array"),Hl=new ke($t,Ne.pmin,Ne.pmax,Ne.origin,Ne.line);if(!this.isCompletion)throw b.thrown(Hl)}}else{let $t=we.ECustom(tt.typeStr(it)+" is not an Array"),Hl=new ke($t,Ne.pmin,Ne.pmax,Ne.origin,Ne.line);if(!this.isCompletion)throw b.thrown(Hl)}}else{let _e=we.ECustom(tt.typeStr(it)+" is not an Array"),be=new ke(_e,Ne.pmin,Ne.pmax,Ne.origin,Ne.line);if(!this.isCompletion)throw b.thrown(be)}break;case 17:let Zt=i.e,kt=null,ul=0;for(;ul<Zt.length;){let _e=Zt[ul];++ul;let be=this.typeExpr(_e,kt==null?ve.Value:ve.WithType(kt));kt==null?kt=be:this.tryUnify(be,kt)||(this.tryUnify(kt,be)?kt=be:this.unify(be,kt,_e))}return kt==null&&(kt=this.makeMono()),this.types.getType("Array",[kt]);case 18:let $e=i.cl,Wt=i.params;break;case 19:let Dt=i.e;return this.typeExpr(Dt,ve.Value),this.makeMono();case 20:let zt=i.e,yt=i.v,Gt=i.t,Xt=i.ecatch,Qt=this.typeExpr(zt,t),cl=this.locals.h[yt],pl=this.locals,el=this.makeType(Gt,Xt);pl.h[yt]=el;let nt=this.typeExpr(Xt,t);if(cl!=null)this.locals.h[yt]=cl;else{let _e=this.locals;Object.prototype.hasOwnProperty.call(_e.h,yt)&&delete _e.h[yt]}return t==ve.NoValue?Q.TVoid:this.tryUnify(Qt,nt)?nt:(this.unify(nt,Qt,Xt),Qt);case 21:let Il=i.fl;if(t._hx_index==2){let _e=this.follow(t.t);if(_e._hx_index==14){let be=_e.fields;if(be.length>0){let Me=Object.create(null),We=0;for(;We<be.length;){let pt=be[We];++We,Me[pt.name]=pt}let Kt=[],Rt=0;for(;Rt<Il.length;){let pt=Il[Rt];++Rt;let Nl=Me[pt.name],fl;if(Nl==null){let dt=pt.e,$t=we.ECustom("Extra field "+pt.name),Hl=new ke($t,dt.pmin,dt.pmax,dt.origin,dt.line);if(!this.isCompletion)throw b.thrown(Hl);fl=Q.TDynamic}else fl=Nl.t;Kt.push({t:this.typeExprWith(pt.e,fl),opt:!1,name:pt.name})}return Q.TAnon(Kt)}else{let Me=[],We=0;for(;We<Il.length;){let Kt=Il[We];++We,Me.push({t:this.typeExpr(Kt.e,ve.Value),opt:!1,name:Kt.name})}return Q.TAnon(Me)}}else{let be=[],Me=0;for(;Me<Il.length;){let We=Il[Me];++Me,be.push({t:this.typeExpr(We.e,ve.Value),opt:!1,name:We.name})}return Q.TAnon(be)}}else{let _e=[],be=0;for(;be<Il.length;){let Me=Il[be];++be,_e.push({t:this.typeExpr(Me.e,ve.Value),opt:!1,name:Me.name})}return Q.TAnon(_e)}break;case 22:let Ee=i.cond,at=i.e1,mt=i.e2;this.typeExprWith(Ee,Q.TBool);let ht=this.typeExpr(at,t);if(mt==null)return ht;let gt=this.typeExpr(mt,t);if(t==ve.NoValue)return Q.TVoid;if(this.tryUnify(gt,ht))return ht;if(this.tryUnify(ht,gt))return gt;this.unify(gt,ht,mt);break;case 23:let Et=i.e,Lt=i.cases,tl=i.defaultExpr,St=null,un=this.typeExpr(Et,ve.Value),Ci=0;for(;Ci<Lt.length;){let _e=Lt[Ci];++Ci;let be=0,Me=_e.values;for(;be<Me.length;){let Rt=Me[be];++be;let pt=this.typeExpr(Rt,ve.WithType(un));this.unify(pt,un,Rt)}let We=this.typeExpr(_e.expr,t),Kt=_e.expr;t!=ve.NoValue&&(St==null?St=We:l.tryUnify(We,St)||(l.unify(St,We,Kt),St=We))}if(tl!=null){let _e=this.typeExpr(tl,t);t!=ve.NoValue&&(St==null?St=_e:l.tryUnify(_e,St)||(l.unify(St,_e,tl),St=_e))}return t==ve.NoValue?Q.TVoid:St??this.makeMono();case 24:let ai=i.cond,kn=i.e;return this.typeExprWith(ai,Q.TBool),this.typeExpr(kn,ve.NoValue),Q.TVoid;case 25:let Hn=i.args,An=i.name,Dn=i.e;return An==":untyped"&&this.allowUntypedMeta?this.makeMono():this.typeExpr(Dn,t);case 26:let vn=i.e,Rn=i.t,yn=this.makeType(Rn,e),Vn=this.typeExpr(vn,ve.WithType(yn));return this.unify(Vn,yn,vn),yn}let n=e.e,s=we.ECustom("Don't know how to type "+Ye[n.__enum__].__constructs__[n._hx_index]._hx_name),r=new ke(s,e.pmin,e.pmax,e.origin,e.line);if(!this.isCompletion)throw b.thrown(r);return Q.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,f=r.meta,m=r.params,_=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 B=[],I=0;for(;I<r.length;){let q=r[I];++I,B.push(tt.typeStr(q))}h="<"+B.join(",")+">"}return a+h;case 10:let o=e.e,u=e.args,p=o.name,f;if(u.length==0)f="";else{let B=[],I=0;for(;I<u.length;){let q=u[I];++I,B.push(tt.typeStr(q))}f="<"+B.join(",")+">"}return p+f;case 11:let m=e.t,_=e.args;if(m.name=="loreline.lorscript.TypeCheck")return tt.typeStr(_[1]);{let B=m.name,I;if(_.length==0)I="";else{let q=[],z=0;for(;z<_.length;){let P=_[z];++z,q.push(tt.typeStr(P))}I="<"+q.join(",")+">"}return B+I}break;case 12:let g=e.a,d=e.args,x=g.name,y;if(d.length==0)y="";else{let B=[],I=0;for(;I<d.length;){let q=d[I];++I,B.push(tt.typeStr(q))}y="<"+B.join(",")+">"}return x+y;case 13:let S=e.args,C=e.ret,O=[],E=0;for(;E<S.length;){let B=S[E];++E,O.push((B.opt?"?":"")+(B.name==""?"":B.name+":")+tt.typeStr(B.t))}return"("+O.join(", ")+") -> "+tt.typeStr(C);case 14:let v=e.fields,N=[],L=0;for(;L<v.length;){let B=v[L];++L,N.push((B.opt?"?":"")+B.name+":"+tt.typeStr(B.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,f=0;for(;f<p.length;){let E=p[f];++f,t(E)}break;case 12:let m=e.a,_=e.args,g=0;for(;g<_.length;){let E=_[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:}}}J["loreline.lorscript.Checker"]=tt,tt.__name__="loreline.lorscript.Checker",Object.assign(tt.prototype,{__class__:tt});var Cl=Ye["loreline.lorscript.Const"]={__ename__:"loreline.lorscript.Const",__constructs__:null,CInt:(w=function(T){return{_hx_index:0,v:T,__enum__:"loreline.lorscript.Const",toString:M}},w._hx_name="CInt",w.__params__=["v"],w),CFloat:(w=function(T){return{_hx_index:1,f:T,__enum__:"loreline.lorscript.Const",toString:M}},w._hx_name="CFloat",w.__params__=["f"],w),CString:(w=function(T){return{_hx_index:2,s:T,__enum__:"loreline.lorscript.Const",toString:M}},w._hx_name="CString",w.__params__=["s"],w)};Cl.__constructs__=[Cl.CInt,Cl.CFloat,Cl.CString];var j=Ye["loreline.lorscript.ExprDef"]={__ename__:"loreline.lorscript.ExprDef",__constructs__:null,EConst:(w=function(T){return{_hx_index:0,c:T,__enum__:"loreline.lorscript.ExprDef",toString:M}},w._hx_name="EConst",w.__params__=["c"],w),EIdent:(w=function(T){return{_hx_index:1,v:T,__enum__:"loreline.lorscript.ExprDef",toString:M}},w._hx_name="EIdent",w.__params__=["v"],w),EVar:(w=function(T,e,t){return{_hx_index:2,n:T,t:e,e:t,__enum__:"loreline.lorscript.ExprDef",toString:M}},w._hx_name="EVar",w.__params__=["n","t","e"],w),EParent:(w=function(T){return{_hx_index:3,e:T,__enum__:"loreline.lorscript.ExprDef",toString:M}},w._hx_name="EParent",w.__params__=["e"],w),EBlock:(w=function(T){return{_hx_index:4,e:T,__enum__:"loreline.lorscript.ExprDef",toString:M}},w._hx_name="EBlock",w.__params__=["e"],w),EField:(w=function(T,e){return{_hx_index:5,e:T,f:e,__enum__:"loreline.lorscript.ExprDef",toString:M}},w._hx_name="EField",w.__params__=["e","f"],w),EBinop:(w=function(T,e,t){return{_hx_index:6,op:T,e1:e,e2:t,__enum__:"loreline.lorscript.ExprDef",toString:M}},w._hx_name="EBinop",w.__params__=["op","e1","e2"],w),EUnop:(w=function(T,e,t){return{_hx_index:7,op:T,prefix:e,e:t,__enum__:"loreline.lorscript.ExprDef",toString:M}},w._hx_name="EUnop",w.__params__=["op","prefix","e"],w),ECall:(w=function(T,e){return{_hx_index:8,e:T,params:e,__enum__:"loreline.lorscript.ExprDef",toString:M}},w._hx_name="ECall",w.__params__=["e","params"],w),EIf:(w=function(T,e,t){return{_hx_index:9,cond:T,e1:e,e2:t,__enum__:"loreline.lorscript.ExprDef",toString:M}},w._hx_name="EIf",w.__params__=["cond","e1","e2"],w),EWhile:(w=function(T,e){return{_hx_index:10,cond:T,e,__enum__:"loreline.lorscript.ExprDef",toString:M}},w._hx_name="EWhile",w.__params__=["cond","e"],w),EFor:(w=function(T,e,t){return{_hx_index:11,v:T,it:e,e:t,__enum__:"loreline.lorscript.ExprDef",toString:M}},w._hx_name="EFor",w.__params__=["v","it","e"],w),EBreak:{_hx_name:"EBreak",_hx_index:12,__enum__:"loreline.lorscript.ExprDef",toString:M},EContinue:{_hx_name:"EContinue",_hx_index:13,__enum__:"loreline.lorscript.ExprDef",toString:M},EFunction:(w=function(T,e,t,l){return{_hx_index:14,args:T,e,name:t,ret:l,__enum__:"loreline.lorscript.ExprDef",toString:M}},w._hx_name="EFunction",w.__params__=["args","e","name","ret"],w),EReturn:(w=function(T){return{_hx_index:15,e:T,__enum__:"loreline.lorscript.ExprDef",toString:M}},w._hx_name="EReturn",w.__params__=["e"],w),EArray:(w=function(T,e){return{_hx_index:16,e:T,index:e,__enum__:"loreline.lorscript.ExprDef",toString:M}},w._hx_name="EArray",w.__params__=["e","index"],w),EArrayDecl:(w=function(T){return{_hx_index:17,e:T,__enum__:"loreline.lorscript.ExprDef",toString:M}},w._hx_name="EArrayDecl",w.__params__=["e"],w),ENew:(w=function(T,e){return{_hx_index:18,cl:T,params:e,__enum__:"loreline.lorscript.ExprDef",toString:M}},w._hx_name="ENew",w.__params__=["cl","params"],w),EThrow:(w=function(T){return{_hx_index:19,e:T,__enum__:"loreline.lorscript.ExprDef",toString:M}},w._hx_name="EThrow",w.__params__=["e"],w),ETry:(w=function(T,e,t,l){return{_hx_index:20,e:T,v:e,t,ecatch:l,__enum__:"loreline.lorscript.ExprDef",toString:M}},w._hx_name="ETry",w.__params__=["e","v","t","ecatch"],w),EObject:(w=function(T){return{_hx_index:21,fl:T,__enum__:"loreline.lorscript.ExprDef",toString:M}},w._hx_name="EObject",w.__params__=["fl"],w),ETernary:(w=function(T,e,t){return{_hx_index:22,cond:T,e1:e,e2:t,__enum__:"loreline.lorscript.ExprDef",toString:M}},w._hx_name="ETernary",w.__params__=["cond","e1","e2"],w),ESwitch:(w=function(T,e,t){return{_hx_index:23,e:T,cases:e,defaultExpr:t,__enum__:"loreline.lorscript.ExprDef",toString:M}},w._hx_name="ESwitch",w.__params__=["e","cases","defaultExpr"],w),EDoWhile:(w=function(T,e){return{_hx_index:24,cond:T,e,__enum__:"loreline.lorscript.ExprDef",toString:M}},w._hx_name="EDoWhile",w.__params__=["cond","e"],w),EMeta:(w=function(T,e,t){return{_hx_index:25,name:T,args:e,e:t,__enum__:"loreline.lorscript.ExprDef",toString:M}},w._hx_name="EMeta",w.__params__=["name","args","e"],w),ECheckType:(w=function(T,e){return{_hx_index:26,e:T,t:e,__enum__:"loreline.lorscript.ExprDef",toString:M}},w._hx_name="ECheckType",w.__params__=["e","t"],w)};j.__constructs__=[j.EConst,j.EIdent,j.EVar,j.EParent,j.EBlock,j.EField,j.EBinop,j.EUnop,j.ECall,j.EIf,j.EWhile,j.EFor,j.EBreak,j.EContinue,j.EFunction,j.EReturn,j.EArray,j.EArrayDecl,j.ENew,j.EThrow,j.ETry,j.EObject,j.ETernary,j.ESwitch,j.EDoWhile,j.EMeta,j.ECheckType];var rl=Ye["loreline.lorscript.CType"]={__ename__:"loreline.lorscript.CType",__constructs__:null,CTPath:(w=function(T,e){return{_hx_index:0,path:T,params:e,__enum__:"loreline.lorscript.CType",toString:M}},w._hx_name="CTPath",w.__params__=["path","params"],w),CTFun:(w=function(T,e){return{_hx_index:1,args:T,ret:e,__enum__:"loreline.lorscript.CType",toString:M}},w._hx_name="CTFun",w.__params__=["args","ret"],w),CTAnon:(w=function(T){return{_hx_index:2,fields:T,__enum__:"loreline.lorscript.CType",toString:M}},w._hx_name="CTAnon",w.__params__=["fields"],w),CTParent:(w=function(T){return{_hx_index:3,t:T,__enum__:"loreline.lorscript.CType",toString:M}},w._hx_name="CTParent",w.__params__=["t"],w),CTOpt:(w=function(T){return{_hx_index:4,t:T,__enum__:"loreline.lorscript.CType",toString:M}},w._hx_name="CTOpt",w.__params__=["t"],w),CTNamed:(w=function(T,e){return{_hx_index:5,n:T,t:e,__enum__:"loreline.lorscript.CType",toString:M}},w._hx_name="CTNamed",w.__params__=["n","t"],w)};rl.__constructs__=[rl.CTPath,rl.CTFun,rl.CTAnon,rl.CTParent,rl.CTOpt,rl.CTNamed];class ke{constructor(e,t,l,i,n){this.e=e,this.pmin=t,this.pmax=l,this.origin=i,this.line=n}toString(){return bi.errorToString(this)}}J["loreline.lorscript.Error"]=ke,ke.__name__="loreline.lorscript.Error",Object.assign(ke.prototype,{__class__:ke});var we=Ye["loreline.lorscript.ErrorDef"]={__ename__:"loreline.lorscript.ErrorDef",__constructs__:null,EInvalidChar:(w=function(T){return{_hx_index:0,c:T,__enum__:"loreline.lorscript.ErrorDef",toString:M}},w._hx_name="EInvalidChar",w.__params__=["c"],w),EUnexpected:(w=function(T){return{_hx_index:1,s:T,__enum__:"loreline.lorscript.ErrorDef",toString:M}},w._hx_name="EUnexpected",w.__params__=["s"],w),EUnterminatedString:{_hx_name:"EUnterminatedString",_hx_index:2,__enum__:"loreline.lorscript.ErrorDef",toString:M},EUnterminatedComment:{_hx_name:"EUnterminatedComment",_hx_index:3,__enum__:"loreline.lorscript.ErrorDef",toString:M},EInvalidPreprocessor:(w=function(T){return{_hx_index:4,msg:T,__enum__:"loreline.lorscript.ErrorDef",toString:M}},w._hx_name="EInvalidPreprocessor",w.__params__=["msg"],w),EUnknownVariable:(w=function(T){return{_hx_index:5,v:T,__enum__:"loreline.lorscript.ErrorDef",toString:M}},w._hx_name="EUnknownVariable",w.__params__=["v"],w),EInvalidIterator:(w=function(T){return{_hx_index:6,v:T,__enum__:"loreline.lorscript.ErrorDef",toString:M}},w._hx_name="EInvalidIterator",w.__params__=["v"],w),EInvalidOp:(w=function(T){return{_hx_index:7,op:T,__enum__:"loreline.lorscript.ErrorDef",toString:M}},w._hx_name="EInvalidOp",w.__params__=["op"],w),EInvalidAccess:(w=function(T){return{_hx_index:8,f:T,__enum__:"loreline.lorscript.ErrorDef",toString:M}},w._hx_name="EInvalidAccess",w.__params__=["f"],w),ECustom:(w=function(T){return{_hx_index:9,msg:T,__enum__:"loreline.lorscript.ErrorDef",toString:M}},w._hx_name="ECustom",w.__params__=["msg"],w)};we.__constructs__=[we.EInvalidChar,we.EUnexpected,we.EUnterminatedString,we.EUnterminatedComment,we.EInvalidPreprocessor,we.EUnknownVariable,we.EInvalidIterator,we.EInvalidOp,we.EInvalidAccess,we.ECustom];var ri=Ye["loreline.lorscript.ModuleDecl"]={__ename__:"loreline.lorscript.ModuleDecl",__constructs__:null,DPackage:(w=function(T){return{_hx_index:0,path:T,__enum__:"loreline.lorscript.ModuleDecl",toString:M}},w._hx_name="DPackage",w.__params__=["path"],w),DImport:(w=function(T,e){return{_hx_index:1,path:T,everything:e,__enum__:"loreline.lorscript.ModuleDecl",toString:M}},w._hx_name="DImport",w.__params__=["path","everything"],w),DClass:(w=function(T){return{_hx_index:2,c:T,__enum__:"loreline.lorscript.ModuleDecl",toString:M}},w._hx_name="DClass",w.__params__=["c"],w),DTypedef:(w=function(T){return{_hx_index:3,c:T,__enum__:"loreline.lorscript.ModuleDecl",toString:M}},w._hx_name="DTypedef",w.__params__=["c"],w)};ri.__constructs__=[ri.DPackage,ri.DImport,ri.DClass,ri.DTypedef];var Rl=Ye["loreline.lorscript.FieldAccess"]={__ename__:"loreline.lorscript.FieldAccess",__constructs__:null,APublic:{_hx_name:"APublic",_hx_index:0,__enum__:"loreline.lorscript.FieldAccess",toString:M},APrivate:{_hx_name:"APrivate",_hx_index:1,__enum__:"loreline.lorscript.FieldAccess",toString:M},AInline:{_hx_name:"AInline",_hx_index:2,__enum__:"loreline.lorscript.FieldAccess",toString:M},AOverride:{_hx_name:"AOverride",_hx_index:3,__enum__:"loreline.lorscript.FieldAccess",toString:M},AStatic:{_hx_name:"AStatic",_hx_index:4,__enum__:"loreline.lorscript.FieldAccess",toString:M},AMacro:{_hx_name:"AMacro",_hx_index:5,__enum__:"loreline.lorscript.FieldAccess",toString:M}};Rl.__constructs__=[Rl.APublic,Rl.APrivate,Rl.AInline,Rl.AOverride,Rl.AStatic,Rl.AMacro];var an=Ye["loreline.lorscript.FieldKind"]={__ename__:"loreline.lorscript.FieldKind",__constructs__:null,KFunction:(w=function(T){return{_hx_index:0,f:T,__enum__:"loreline.lorscript.FieldKind",toString:M}},w._hx_name="KFunction",w.__params__=["f"],w),KVar:(w=function(T){return{_hx_index:1,v:T,__enum__:"loreline.lorscript.FieldKind",toString:M}},w._hx_name="KVar",w.__params__=["v"],w)};an.__constructs__=[an.KFunction,an.KVar];var Vl=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:M},SContinue:{_hx_name:"SContinue",_hx_index:1,__enum__:"loreline.lorscript._Interp.Stop",toString:M},SReturn:{_hx_name:"SReturn",_hx_index:2,__enum__:"loreline.lorscript._Interp.Stop",toString:M}};Vl.__constructs__=[Vl.SBreak,Vl.SContinue,Vl.SReturn];class hn{constructor(e){this.interpreter=e,this.locals=new Se,this.declared=[],this.resetVariables(),this.initOps()}resetVariables(){this.variables=new Se,this.variables.h.null=null,this.variables.h.true=!0,this.variables.h.false=!1;let e=this,t=this.variables,l=Ae.makeVarArgs(function(i){let n=e.posInfos(),s=i.shift();i.length>0&&(n.customParams=i),Wi.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 Se,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["="]=Te(this,this.assign),this.binops.h["..."]=function(t,l){return new Ti(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))re.setField(this.interpreter,this.interpreter.topLevelState.fields,e,t);else throw b.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):re.isFields(u)?re.setField(this.interpreter,u,p,l):te.__implements(u,vt)?te.__cast(u,vt).set(p,l):u[p]=l;break;default:let f=new ke(we.EInvalidOp("="),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw b.thrown(f)}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,f=s.index,m=this.expr(p),_=this.expr(f);oe.isArray(m)?(n=t(oe.arrayGet(m,_),this.expr(i)),oe.arraySet(m,_,n)):re.isFields(m)?(n=t(re.getField(this.interpreter,m,_),this.expr(i)),re.setField(this.interpreter,m,_,n)):te.__implements(m,vt)?(n=t(te.__cast(m,vt).get(_),this.expr(i)),te.__cast(m,vt).set(_,n)):(n=t(m[_],this.expr(i)),m[_]=n);break;default:let g=new ke(we.EInvalidOp(e),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw b.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,f=i.index,m=this.expr(p),_=this.expr(f);if(oe.isArray(m)){let d=oe.arrayGet(m,_);return t?(d+=l,oe.arraySet(m,_,d)):oe.arraySet(m,_,d+l),d}else if(re.isFields(m)){let d=re.getField(this.interpreter,m,_);return t?(d+=l,re.setField(this.interpreter,m,_,d)):re.setField(this.interpreter,m,_,d+l),d}else if(te.__implements(m,vt)){let d=te.__cast(m,vt).get(_);return t?(d+=l,te.__cast(m,vt).set(_,d)):te.__cast(m,vt).set(_,d+l),d}else{let d=m[_];return t?(d+=l,m[_]=d):m[_]=d+l,d}break;default:let g=new ke(we.EInvalidOp(l>0?"++":"--"),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw b.thrown(g)}}execute(e){return this.depth=0,this.locals=new Se,this.declared=[],this.exprReturn(e)}exprReturn(e){try{return this.expr(e)}catch(t){let l=b.caught(t).unwrap();if(te.__instanceof(l,Vl))switch(l._hx_index){case 0:throw b.thrown("Invalid break");case 1:throw b.thrown("Invalid continue");case 2:let n=this.returnValue;return this.returnValue=null,n}else throw t}}duplicate(e){let t=new Se,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 ke(e,this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw b.thrown(l)}rethrow(e){throw b.thrown(e)}resolve(e){let t=this.variables.h[e];if(t==null&&!Object.prototype.hasOwnProperty.call(this.variables.h,e)){if(re.fieldExists(this.interpreter,this.interpreter.topLevelState.fields,e))return re.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.resolveBeatRefByName(e);if(l!=null)return l;let i=new ke(we.EUnknownVariable(e),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw b.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 f=t.e,m=this.declared.length,_=null,g=0;for(;g<f.length;){let Ee=f[g];++g,_=this.expr(Ee)}return this.restore(m),_;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 Ee=new ke(we.EInvalidOp(y),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw b.thrown(Ee)}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 Ee=new ke(we.EInvalidOp(E),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw b.thrown(Ee)}break;case 8:let L=t.e,B=t.params,I=[],q=0;for(;q<B.length;){let Ee=B[q];++q,I.push(this.expr(Ee))}let z=L.e;switch(z._hx_index){case 1:return z.v=="call"&&!this.callIsShadowed()?this.dynamicCall(I):this.call(null,this.expr(L),I);case 5:let at=z.e,mt=z.f,ht=this.expr(at);if(ht==null){let gt=new ke(we.EInvalidAccess(mt),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw b.thrown(gt)}return this.fcall(ht,mt,I);default:return this.call(null,this.expr(L),I)}break;case 9:let P=t.cond,A=t.e1,F=t.e2;return this.expr(P)==!0?this.expr(A):F==null?null:this.expr(F);case 10:let R=t.cond,V=t.e;return this.whileLoop(R,V),null;case 11:let W=t.v,H=t.it,G=t.e;return this.forLoop(W,H,G),null;case 12:throw b.thrown(Vl.SBreak);case 13:throw b.thrown(Vl.SContinue);case 14:let X=t.ret,he=t.args,ce=t.e,ne=t.name,ae=this.duplicate(this.locals),xe=this,Ie=!1,Ue=0,Je=0;for(;Je<he.length;){let Ee=he[Je];++Je,Ee.opt||Ee.value!=null?Ie=!0:Ue+=1}let lt=function(Ee){if((Ee==null?0:Ee.length)!=he.length){if(Ee.length<Ue){let ai="Invalid number of parameters. Got "+Ee.length+", required "+Ue;ne!=null&&(ai+=" for function '"+ne+"'");let kn=new ke(we.ECustom(ai),l.curExpr.pmin,l.curExpr.pmax,l.curExpr.origin,l.curExpr.line);throw b.thrown(kn)}let tl=[],St=Ee.length-Ue,un=0,Ci=0;for(;Ci<he.length;){let ai=he[Ci];++Ci,ai.opt||ai.value!=null?St>0?(tl.push(Ee[un++]),--St):tl.push(ai.value!=null?xe.expr(ai.value):null):tl.push(Ee[un++])}Ee=tl}let at=xe.locals,mt=xe.depth;xe.depth++,xe.locals=xe.duplicate(ae);let ht=0,gt=he.length;for(;ht<gt;){let tl=ht++;xe.locals.h[he[tl].name]={r:Ee[tl]}}let Et=null,Lt=l.declared.length;if(l.inTry)try{Et=xe.exprReturn(ce)}catch(tl){let St=b.caught(tl).unwrap();throw l.restore(Lt),xe.locals=at,xe.depth=mt,b.thrown(St)}else Et=xe.exprReturn(ce);return l.restore(Lt),xe.locals=at,xe.depth=mt,Et},qe=Ae.makeVarArgs(lt);if(ne!=null)if(this.depth==0)this.variables.h[ne]=qe;else{this.declared.push({n:ne,old:this.locals.h[ne]});let Ee={r:qe};this.locals.h[ne]=Ee,ae.h[ne]=Ee}return qe;case 15:let Qe=t.e;throw this.returnValue=Qe==null?null:this.expr(Qe),b.thrown(Vl.SReturn);case 16:let rt=t.e,Ve=t.index,$=this.expr(rt),se=this.expr(Ve);return oe.isArray($)?oe.arrayGet($,se):re.isFields($)?re.getField(this.interpreter,$,se):te.__implements($,vt)?te.__cast($,vt).get(se):$[se];case 17:let K=t.e,ie;if(K.length>0){let Ee=K[0].e;if(Ee._hx_index==6){let at=Ee.e1,mt=Ee.e2;ie=Ee.op=="=>"}else ie=!1}else ie=!1;if(ie){let Ee=[],at=[],mt=0;for(;mt<K.length;){let ht=K[mt];++mt;let gt=ht.e;if(gt._hx_index==6)if(gt.op=="=>"){let Et=gt.e1,Lt=gt.e2;Ee.push(this.expr(Et)),at.push(this.expr(Lt))}else{this.curExpr=ht;let Et=new ke(we.ECustom("Invalid map key=>value expression"),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw b.thrown(Et)}else{this.curExpr=ht;let Et=new ke(we.ECustom("Invalid map key=>value expression"),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw b.thrown(Et)}}return this.makeMap(Ee,at)}else{let Ee=[],at=0;for(;at<K.length;){let mt=K[at];++at,Ee.push(this.expr(mt))}return Ee}break;case 18:let le=t.cl,ee=t.params,pe=[],ge=0;for(;ge<ee.length;){let Ee=ee[ge];++ge,pe.push(this.expr(Ee))}return this.cnew(le,pe);case 19:let ye=t.e;throw b.thrown(this.expr(ye));case 20:let Ze=t.t,Tt=t.e,Le=t.v,wt=t.ecatch,Oe=this.declared.length,Ne=this.inTry;try{this.inTry=!0;let Ee=this.expr(Tt);return this.restore(Oe),this.inTry=Ne,Ee}catch(Ee){let at=b.caught(Ee).unwrap();if(te.__instanceof(at,Vl)){let mt=at;throw this.inTry=Ne,b.thrown(mt)}else{let mt=at;this.restore(Oe),this.inTry=Ne,this.declared.push({n:Le,old:this.locals.h[Le]}),this.locals.h[Le]={r:mt};let ht=this.expr(wt);return this.restore(Oe),ht}}break;case 21:let ft=t.fl,it=re.createFields(this.interpreter),It=0;for(;It<ft.length;){let Ee=ft[It];++It,re.setField(this.interpreter,it,Ee.name,this.expr(Ee.e))}return it;case 22:let Zt=t.cond,kt=t.e1,ul=t.e2;return this.expr(Zt)==!0?this.expr(kt):this.expr(ul);case 23:let $e=t.e,Wt=t.cases,Dt=t.defaultExpr,zt=this.expr($e),yt=!1,Gt=0;for(;Gt<Wt.length;){let Ee=Wt[Gt];++Gt;let at=0,mt=Ee.values;for(;at<mt.length;){let ht=mt[at];if(++at,this.expr(ht)==zt){yt=!0;break}}if(yt){zt=this.expr(Ee.expr);break}}return yt||(zt=Dt==null?null:this.expr(Dt)),zt;case 24:let Xt=t.cond,Qt=t.e;return this.doWhileLoop(Xt,Qt),null;case 25:let cl=t.name,pl=t.args,el=t.e;return this.expr(el);case 26:let nt=t.t,Il=t.e;return this.expr(Il)}}doWhileLoop(e,t){let l=this.declared.length,i=this;do{let n=!0;try{i.expr(t)}catch(s){let r=b.caught(s).unwrap();if(te.__instanceof(r,Vl)){let a=r;switch(a._hx_index){case 0:n=!1;break;case 1:break;case 2:throw b.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=b.caught(s).unwrap();if(te.__instanceof(r,Vl)){let a=r;switch(a._hx_index){case 0:n=!1;break;case 1:break;case 2:throw b.thrown(a)}}else throw s}if(!n)break}this.restore(l)}makeIterator(e){if(e instanceof Array)return new Bl(e);if(oe.isArray(e))return oe.getIterator(e);if(e.iterator!=null&&(e=Sn(e)),e.hasNext==null||e.next==null){let t=new ke(we.EInvalidIterator(e),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw b.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=b.caught(o).unwrap();if(te.__instanceof(u,Vl)){let p=u;switch(p._hx_index){case 0:h=!1;break;case 1:break;case 2:throw b.thrown(p)}}else throw o}if(!h)break}this.restore(i)}loopRun(e){let t=!0;try{e()}catch(l){let i=b.caught(l).unwrap();if(te.__instanceof(i,Vl)){let n=i;switch(n._hx_index){case 0:t=!1;break;case 1:break;case 2:throw b.thrown(n)}}else throw l}return t}isMap(e){return te.__implements(e,vt)}getMapValue(e,t){return te.__cast(e,vt).get(t)}setMapValue(e,t,l){te.__cast(e,vt).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&&Ae.isObject(h),s=s&&Ae.isEnumValue(h)}if(i){let h=new Ul,o=0,u=e;for(;o<u.length;){let p=u[o],m=o++,_=p;h.h[_]=t[m]}return h}if(l){let h=new Se,o=0,u=e;for(;o<u.length;){let p=u[o],m=o++,_=p;h.h[_]=t[m]}return h}if(s){let h=new hi,o=0,u=e;for(;o<u.length;){let p=u[o],m=o++,_=p;h.set(_,t[m])}return h}if(n){let h=new Si,o=0,u=e;for(;o<u.length;){let p=u[o],m=o++,_=p;h.set(_,t[m])}return h}let a=new ke(we.ECustom("Invalid map keys "+Y.string(e)),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw b.thrown(a)}get(e,t){if(e==null){let l=new ke(we.EInvalidAccess(t),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw b.thrown(l)}return re.isFields(e)?re.getField(this.interpreter,e,t):Ae.getProperty(e,t)}set(e,t,l){if(e==null){let i=new ke(we.EInvalidAccess(t),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw b.thrown(i)}return re.isFields(e)?(re.setField(this.interpreter,e,t,l),l):(Ae.setProperty(e,t,l),l)}fcall(e,t,l){let i=null,n=bt.beatOf(e);return typeof e=="string"?i=re.getStringHelper(this.interpreter,t):oe.isArray(e)?i=re.getArrayHelper(this.interpreter,t):n!=null?i=re.getBeatHelper(this.interpreter,t):re.isFields(e)&&(i=re.getMapHelper(this.interpreter,t)),i!=null&&Ae.isFunction(i)?(l.splice(0,0,n??e),this.call(null,i,l)):this.call(e,this.get(e,t),l)}call(e,t,l){return t.apply(e,l)}callIsShadowed(){return!!(Object.prototype.hasOwnProperty.call(this.locals.h,"call")||Object.prototype.hasOwnProperty.call(this.variables.h,"call")||re.fieldExists(this.interpreter,this.interpreter.topLevelState.fields,"call")||Object.prototype.hasOwnProperty.call(this.interpreter.topLevelCharacters.h,"call")||Object.prototype.hasOwnProperty.call(this.interpreter.topLevelFunctions.h,"call")||this.interpreter.resolveBeatByName("call")!=null)}dynamicCall(e){if(e.length==0){let i=new ke(we.ECustom("call() requires a target argument"),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw b.thrown(i)}let t=e[0],l=e.slice(1);if(bt.beatOf(t)!=null){let i=new ke(we.ECustom("call() can only call functions. Beats cannot run inside function code."),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw b.thrown(i)}if(typeof t=="string"){let i=t;if(this.interpreter.resolveBeatByName(i)!=null){let n=new ke(we.ECustom("call() can only call functions. Beats cannot run inside function code."),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw b.thrown(n)}if(Object.prototype.hasOwnProperty.call(this.interpreter.topLevelFunctions.h,i))t=this.interpreter.topLevelFunctions.h[i];else{let n=new ke(we.ECustom("call() target not found: "+i),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw b.thrown(n)}}if(!Ae.isFunction(t)){let i=new ke(we.ECustom("call() target is not a function"),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw b.thrown(i)}return this.call(null,t,l)}cnew(e,t){let l=J[e];return l==null&&(l=this.resolve(e)),me.createInstance(l,t)}static __keepIntIterator(){let e=new Ti(0,0);return[Te(e,e.hasNext),Te(e,e.next)]}}J["loreline.lorscript.Interp"]=hn,hn.__name__="loreline.lorscript.Interp",Object.assign(hn.prototype,{__class__:hn});var Z=Ye["loreline.lorscript.Token"]={__ename__:"loreline.lorscript.Token",__constructs__:null,TEof:{_hx_name:"TEof",_hx_index:0,__enum__:"loreline.lorscript.Token",toString:M},TConst:(w=function(T){return{_hx_index:1,c:T,__enum__:"loreline.lorscript.Token",toString:M}},w._hx_name="TConst",w.__params__=["c"],w),TId:(w=function(T){return{_hx_index:2,s:T,__enum__:"loreline.lorscript.Token",toString:M}},w._hx_name="TId",w.__params__=["s"],w),TOp:(w=function(T){return{_hx_index:3,s:T,__enum__:"loreline.lorscript.Token",toString:M}},w._hx_name="TOp",w.__params__=["s"],w),TPOpen:{_hx_name:"TPOpen",_hx_index:4,__enum__:"loreline.lorscript.Token",toString:M},TPClose:{_hx_name:"TPClose",_hx_index:5,__enum__:"loreline.lorscript.Token",toString:M},TBrOpen:{_hx_name:"TBrOpen",_hx_index:6,__enum__:"loreline.lorscript.Token",toString:M},TBrClose:{_hx_name:"TBrClose",_hx_index:7,__enum__:"loreline.lorscript.Token",toString:M},TDot:{_hx_name:"TDot",_hx_index:8,__enum__:"loreline.lorscript.Token",toString:M},TQuestionDot:{_hx_name:"TQuestionDot",_hx_index:9,__enum__:"loreline.lorscript.Token",toString:M},TComma:{_hx_name:"TComma",_hx_index:10,__enum__:"loreline.lorscript.Token",toString:M},TSemicolon:{_hx_name:"TSemicolon",_hx_index:11,__enum__:"loreline.lorscript.Token",toString:M},TBkOpen:{_hx_name:"TBkOpen",_hx_index:12,__enum__:"loreline.lorscript.Token",toString:M},TBkClose:{_hx_name:"TBkClose",_hx_index:13,__enum__:"loreline.lorscript.Token",toString:M},TQuestion:{_hx_name:"TQuestion",_hx_index:14,__enum__:"loreline.lorscript.Token",toString:M},TDoubleDot:{_hx_name:"TDoubleDot",_hx_index:15,__enum__:"loreline.lorscript.Token",toString:M},TMeta:(w=function(T){return{_hx_index:16,s:T,__enum__:"loreline.lorscript.Token",toString:M}},w._hx_name="TMeta",w.__params__=["s"],w),TPrepro:(w=function(T){return{_hx_index:17,s:T,__enum__:"loreline.lorscript.Token",toString:M}},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 fi{constructor(){this.uid=0,this.preprocesorValues=new Se,this.line=1,this.opChars="+*/-=!><&|^%~",this.identChars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_";let e=[["%"],["*","/"],["+","-"],["<<",">>",">>>"],["|","&","^"],["==","!=",">","<",">=","<="],["..."],["&&"],["||"],["=","+=","-=","*=","/=","%=","<<=",">>=",">>>=","|=","&=","^=","=>"],["->"]];this.opPriority=new Se,this.opRightAssoc=new Se;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 b.thrown(new ke(e,t,l,this.origin,this.line))}invalidChar(e){if(!this.resumeErrors)throw b.thrown(new ke(we.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 zi,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=j.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=we.EUnexpected(this.tokenString(e));if(!this.resumeErrors)throw b.thrown(new ke(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();me.enumEq(t,e)||this.unexpected(t)}maybe(e){let t=this.token();return me.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 f=t.cond,m=t.e1,_=t.e2;return _!=null?this.isBlock(_):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 L=t.e,B=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,A=t.cases,F=t.defaultExpr;return!0;case 24:let R=t.cond,V=t.e;return this.isBlock(V);case 25:let W=t.name,H=t.args,G=t.e;return this.isBlock(G);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=j.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=j.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=j.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 L=N.c;switch(L._hx_index){case 0:let B=L.v,I=j.EConst(Cl.CInt(-B)),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=L.f,A=j.EConst(Cl.CFloat(-P)),F=E,R=v==null?0:v.pmax;return A==null?null:(F==null&&(F=this.tokenMin),R==null&&(R=this.tokenMax),{e:A,pmin:F,pmax:R,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();me.enumEq(E,Z.TOp("->"))||this.unexpected(E);let v=this.parseExpr(),N=j.EReturn(v),L=t,B=null,I;N==null?I=null:(L==null&&(L=this.tokenMin),B==null&&(B=this.tokenMax),I={e:N,pmin:L,pmax:B,origin:this.origin,line:this.line});let q=j.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=j.EParent(u),v=t,N=this.tokenMax,L;return E==null?L=null:(v==null&&(v=this.tokenMin),N==null&&(N=this.tokenMax),L={e:E,pmin:v,pmax:N,origin:this.origin,line:this.line}),this.parseExprNext(L);case 10:let B=u.e;if(B._hx_index==1){let q=B.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=j.ECheckType(u,I),z=t,P=this.tokenMax,A;return q==null?A=null:(z==null&&(z=this.tokenMin),P==null&&(P=this.tokenMax),A={e:q,pmin:z,pmax:P,origin:this.origin,line:this.line}),this.parseExprNext(A);case 10:let F=u.e;if(F._hx_index==1){let R=F.v;return this.parseLambda([{name:R,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,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 L=j.EObject([]),B=t,I=null,q;return L==null?q=null:(B==null&&(B=this.tokenMin),I==null&&(I=this.tokenMax),q={e:L,pmin:B,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 f=j.EBlock(p),m=t,_=null;return f==null?null:(m==null&&(m=this.tokenMin),_==null&&(_=this.tokenMax),{e:f,pmin:m,pmax:_,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,L="__a_"+this.uid++,B=j.EArrayDecl([]),I=t,q=null,z;B==null?z=null:(I==null&&(I=this.tokenMin),q==null&&(q=this.tokenMax),z={e:B,pmin:I,pmax:q,origin:this.origin,line:this.line});let P=j.EVar(L,null,z),A=t,F=null,R;P==null?R=null:(A==null&&(A=this.tokenMin),F==null&&(F=this.tokenMax),R={e:P,pmin:A,pmax:F,origin:this.origin,line:this.line});let V=this.mapCompr(L,g[0]),W=j.EIdent(L),H=t,G=null,X;W==null?X=null:(H==null&&(H=this.tokenMin),G==null&&(G=this.tokenMax),X={e:W,pmin:H,pmax:G,origin:this.origin,line:this.line});let he=j.EBlock([R,V,X]),ce=t,ne=null,ae;return he==null?ae=null:(ce==null&&(ce=this.tokenMin),ne==null&&(ne=this.tokenMax),ae={e:he,pmin:ce,pmax:ne,origin:this.origin,line:this.line}),this.parseExprNext(ae);case 11:let xe=E.v,Ie=E.it,Ue=E.e,Je="__a_"+this.uid++,lt=j.EArrayDecl([]),qe=t,Qe=null,rt;lt==null?rt=null:(qe==null&&(qe=this.tokenMin),Qe==null&&(Qe=this.tokenMax),rt={e:lt,pmin:qe,pmax:Qe,origin:this.origin,line:this.line});let Ve=j.EVar(Je,null,rt),$=t,se=null,K;Ve==null?K=null:($==null&&($=this.tokenMin),se==null&&(se=this.tokenMax),K={e:Ve,pmin:$,pmax:se,origin:this.origin,line:this.line});let ie=this.mapCompr(Je,g[0]),le=j.EIdent(Je),ee=t,pe=null,ge;le==null?ge=null:(ee==null&&(ee=this.tokenMin),pe==null&&(pe=this.tokenMax),ge={e:le,pmin:ee,pmax:pe,origin:this.origin,line:this.line});let ye=j.EBlock([K,ie,ge]),Ze=t,Tt=null,Le;return ye==null?Le=null:(Ze==null&&(Ze=this.tokenMin),Tt==null&&(Tt=this.tokenMax),Le={e:ye,pmin:Ze,pmax:Tt,origin:this.origin,line:this.line}),this.parseExprNext(Le);case 24:let wt=E.cond,Oe=E.e,Ne="__a_"+this.uid++,ft=j.EArrayDecl([]),it=t,It=null,Zt;ft==null?Zt=null:(it==null&&(it=this.tokenMin),It==null&&(It=this.tokenMax),Zt={e:ft,pmin:it,pmax:It,origin:this.origin,line:this.line});let kt=j.EVar(Ne,null,Zt),ul=t,$e=null,Wt;kt==null?Wt=null:(ul==null&&(ul=this.tokenMin),$e==null&&($e=this.tokenMax),Wt={e:kt,pmin:ul,pmax:$e,origin:this.origin,line:this.line});let Dt=this.mapCompr(Ne,g[0]),zt=j.EIdent(Ne),yt=t,Gt=null,Xt;zt==null?Xt=null:(yt==null&&(yt=this.tokenMin),Gt==null&&(Gt=this.tokenMax),Xt={e:zt,pmin:yt,pmax:Gt,origin:this.origin,line:this.line});let Qt=j.EBlock([Wt,Dt,Xt]),cl=t,pl=null,el;return Qt==null?el=null:(cl==null&&(cl=this.tokenMin),pl==null&&(pl=this.tokenMax),el={e:Qt,pmin:cl,pmax:pl,origin:this.origin,line:this.line}),this.parseExprNext(el);default:}}let x=j.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=j.EMeta(O,E,this.parseExpr()),N=t,L=null;return v==null?null:(N==null&&(N=this.tokenMin),L==null&&(L=this.tokenMax),{e:v,pmin:N,pmax:L,origin:this.origin,line:this.line})}else return this.unexpected(e);break;default:return this.unexpected(e)}}parseLambda(e,t){e:for(;;){let p=this.getIdent(),f=this.maybe(Z.TDoubleDot)?this.parseType():null;e.push({name:p,t:f});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();me.enumEq(l,Z.TOp("->"))||this.unexpected(l);let i=this.parseExpr(),n=j.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=j.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=j.EParent(this.mapCompr(e,r));break;case 4:let a=i.e;if(a.length==1){let B=a[0];l=j.EBlock([this.mapCompr(e,B)])}else{let B=j.EIdent(e),I=t==null?0:t.pmin,q=t==null?0:t.pmax,z;B==null?z=null:(I==null&&(I=this.tokenMin),q==null&&(q=this.tokenMax),z={e:B,pmin:I,pmax:q,origin:this.origin,line:this.line});let P=j.EField(z,"push"),A=t==null?0:t.pmin,F=t==null?0:t.pmax,R;P==null?R=null:(A==null&&(A=this.tokenMin),F==null&&(F=this.tokenMax),R={e:P,pmin:A,pmax:F,origin:this.origin,line:this.line}),l=j.ECall(R,[t])}break;case 9:let h=i.cond,o=i.e1;if(i.e2==null)l=j.EIf(h,this.mapCompr(e,o),null);else{let B=j.EIdent(e),I=t==null?0:t.pmin,q=t==null?0:t.pmax,z;B==null?z=null:(I==null&&(I=this.tokenMin),q==null&&(q=this.tokenMax),z={e:B,pmin:I,pmax:q,origin:this.origin,line:this.line});let P=j.EField(z,"push"),A=t==null?0:t.pmin,F=t==null?0:t.pmax,R;P==null?R=null:(A==null&&(A=this.tokenMin),F==null&&(F=this.tokenMax),R={e:P,pmin:A,pmax:F,origin:this.origin,line:this.line}),l=j.ECall(R,[t])}break;case 10:let p=i.cond,f=i.e;l=j.EWhile(p,this.mapCompr(e,f));break;case 11:let m=i.v,_=i.it,g=i.e;l=j.EFor(m,_,this.mapCompr(e,g));break;case 24:let d=i.cond,x=i.e;l=j.EDoWhile(d,this.mapCompr(e,x));break;default:let y=j.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=j.EField(O,"push"),v=t==null?0:t.pmin,N=t==null?0:t.pmax,L;E==null?L=null:(v==null&&(v=this.tokenMin),N==null&&(N=this.tokenMax),L={e:E,pmin:v,pmax:N,origin:this.origin,line:this.line}),l=j.ECall(L,[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=j.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,f=j.ETernary(this.makeUnop(e,o),u,p),m=o==null?0:o.pmin,_=p==null?0:p.pmax;return f==null?null:(m==null&&(m=this.tokenMin),_==null&&(_=this.tokenMax),{e:f,pmin:m,pmax:_,origin:this.origin,line:this.line});default:let g=j.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=j.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=j.EBinop(n,this.makeBinop(e,t,s),r),_=t==null?0:t.pmin,g=r==null?0:r.pmax;return m==null?null:(_==null&&(_=this.tokenMin),g==null&&(g=this.tokenMax),{e:m,pmin:_,pmax:g,origin:this.origin,line:this.line})}else{let m=j.EBinop(e,t,l),_=t==null?0:t.pmin,g=l==null?0:l.pmax;return m==null?null:(_==null&&(_=this.tokenMin),g==null&&(g=this.tokenMax),{e:m,pmin:_,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=j.EBinop(e,t,l),_=t==null?0:t.pmin,g=l==null?0:l.pmax;return m==null?null:(_==null&&(_=this.tokenMin),g==null&&(g=this.tokenMax),{e:m,pmin:_,pmax:g,origin:this.origin,line:this.line})}else{let m=j.ETernary(this.makeBinop(e,t,a),h,o),_=t==null?0:t.pmin,g=l==null?0:l.pmax;return m==null?null:(_==null&&(_=this.tokenMin),g==null&&(g=this.tokenMax),{e:m,pmin:_,pmax:g,origin:this.origin,line:this.line})}break;default:let u=j.EBinop(e,t,l),p=t==null?0:t.pmin,f=l==null?0:l.pmax;return u==null?null:(p==null&&(p=this.tokenMin),f==null&&(f=this.tokenMax),{e:u,pmin:p,pmax:f,origin:this.origin,line:this.line})}}parseStructure(e){let t=this.tokenMin;switch(e){case"break":let l=j.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=j.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=j.EDoWhile(u,h),f=t,m=u==null?0:u.pmax;return p==null?null:(f==null&&(f=this.tokenMin),m==null&&(m=this.tokenMax),{e:p,pmin:f,pmax:m,origin:this.origin,line:this.line});case"else":return this.unexpected(Z.TId(e));case"for":let _=this.token();_!=Z.TPOpen&&this.unexpected(_);let g=this.getIdent(),d=this.token();me.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=j.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 L=this.parseFunctionDecl(),B=j.EFunction(L.args,L.body,N,L.ret),I=t,q=L.body,z=q==null?0:q.pmax;return B==null?null:(I==null&&(I=this.tokenMin),z==null&&(z=this.tokenMax),{e:B,pmin:I,pmax:z,origin:this.origin,line:this.line});case"if":let P=this.token();P!=Z.TPOpen&&this.unexpected(P);let A=this.parseExpr(),F=this.token();F!=Z.TPClose&&this.unexpected(F);let R=this.parseExpr(),V=null,W=!1,H=this.token();H==Z.TSemicolon&&(W=!0,H=this.token()),me.enumEq(H,Z.TId("else"))?V=this.parseExpr():(this.tokens.push({t:H,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 G=j.EIf(A,R,V),X=t,he=V==null?this.tokenMax:V==null?0:V.pmax;return G==null?null:(X==null&&(X=this.tokenMin),he==null&&(he=this.tokenMax),{e:G,pmin:X,pmax:he,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),ae=j.ENew(ce.join("."),ne),xe=t,Ie=null;return ae==null?null:(xe==null&&(xe=this.tokenMin),Ie==null&&(Ie=this.tokenMax),{e:ae,pmin:xe,pmax:Ie,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=j.EReturn(Je),qe=t,Qe=Je==null?this.tokenMax:Je==null?0:Je.pmax;return lt==null?null:(qe==null&&(qe=this.tokenMin),Qe==null&&(Qe=this.tokenMax),{e:lt,pmin:qe,pmax:Qe,origin:this.origin,line:this.line});case"switch":let rt=this.parseExpr(),Ve=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 Il={values:[],expr:null};$.push(Il);t:for(;;){let gt=this.parseExpr();switch(Il.values.push(gt),nt=this.token(),nt._hx_index){case 10:break;case 15:break t;default:this.unexpected(nt);break t}}let Ee=[];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(Ee);break;case 2:switch(nt.s){case"case":case"default":break t;default:this.parseFullExpr(Ee)}break;case 7:break t;default:this.parseFullExpr(Ee)}let at;if(Ee.length==1)at=Ee[0];else if(Ee.length==0){let gt=j.EBlock([]),Et=this.tokenMin,Lt=this.tokenMin;gt==null?at=null:(Et==null&&(Et=this.tokenMin),Lt==null&&(Lt=this.tokenMax),at={e:gt,pmin:Et,pmax:Lt,origin:this.origin,line:this.line})}else{let gt=j.EBlock(Ee),Et=Ee[0],Lt=Et==null?0:Et.pmin,tl=Ee[Ee.length-1],St=tl==null?0:tl.pmax;gt==null?at=null:(Lt==null&&(Lt=this.tokenMin),St==null&&(St=this.tokenMax),at={e:gt,pmin:Lt,pmax:St,origin:this.origin,line:this.line})}Il.expr=at;break;case"default":Ve!=null&&this.unexpected(nt);let mt=this.token();mt!=Z.TDoubleDot&&this.unexpected(mt);let ht=[];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(ht);break;case 2:switch(nt.s){case"case":case"default":break t;default:this.parseFullExpr(ht)}break;case 7:break t;default:this.parseFullExpr(ht)}if(ht.length==1)Ve=ht[0];else if(ht.length==0){let gt=j.EBlock([]),Et=this.tokenMin,Lt=this.tokenMin;gt==null?Ve=null:(Et==null&&(Et=this.tokenMin),Lt==null&&(Lt=this.tokenMax),Ve={e:gt,pmin:Et,pmax:Lt,origin:this.origin,line:this.line})}else{let gt=j.EBlock(ht),Et=ht[0],Lt=Et==null?0:Et.pmin,tl=ht[ht.length-1],St=tl==null?0:tl.pmax;gt==null?Ve=null:(Lt==null&&(Lt=this.tokenMin),St==null&&(St=this.tokenMax),Ve={e:gt,pmin:Lt,pmax:St,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 K=j.ESwitch(rt,$,Ve),ie=t,le=this.tokenMax;return K==null?null:(ie==null&&(ie=this.tokenMin),le==null&&(le=this.tokenMax),{e:K,pmin:ie,pmax:le,origin:this.origin,line:this.line});case"throw":let ee=this.parseExpr(),pe=j.EThrow(ee),ge=t,ye=ee==null?0:ee.pmax;return pe==null?null:(ge==null&&(ge=this.tokenMin),ye==null&&(ye=this.tokenMax),{e:pe,pmin:ge,pmax:ye,origin:this.origin,line:this.line});case"try":let Ze=this.parseExpr(),Tt=this.token();me.enumEq(Tt,Z.TId("catch"))||this.unexpected(Tt);let Le=this.token();Le!=Z.TPOpen&&this.unexpected(Le);let wt=this.getIdent(),Oe=this.token();Oe!=Z.TDoubleDot&&this.unexpected(Oe);let Ne=null;if(this.allowTypes)Ne=this.parseType();else{let nt=this.token();me.enumEq(nt,Z.TId("Dynamic"))||this.unexpected(nt)}let ft=this.token();ft!=Z.TPClose&&this.unexpected(ft);let it=this.parseExpr(),It=j.ETry(Ze,wt,Ne,it),Zt=t,kt=it==null?0:it.pmax;return It==null?null:(Zt==null&&(Zt=this.tokenMin),kt==null&&(kt=this.tokenMax),{e:It,pmin:Zt,pmax:kt,origin:this.origin,line:this.line});case"var":let ul=this.getIdent(),$e=this.token(),Wt=null;$e==Z.TDoubleDot&&this.allowTypes&&(Wt=this.parseType(),$e=this.token());let Dt=null;switch($e._hx_index){case 3:$e.s=="="?Dt=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:Wt!=null?(this.tokens.push({t:$e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax):this.unexpected($e)}let zt=j.EVar(ul,Wt,Dt),yt=t,Gt=Dt==null?this.tokenMax:Dt==null?0:Dt.pmax;return zt==null?null:(yt==null&&(yt=this.tokenMin),Gt==null&&(Gt=this.tokenMax),{e:zt,pmin:yt,pmax:Gt,origin:this.origin,line:this.line});case"while":let Xt=this.parseExpr(),Qt=this.parseExpr(),cl=j.EWhile(Xt,Qt),pl=t,el=Qt==null?0:Qt.pmax;return cl==null?null:(pl==null&&(pl=this.tokenMin),el==null&&(el=this.tokenMax),{e:cl,pmin:pl,pmax:el,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 wt=Le.v,Oe=this.parseExpr(),Ne=j.EReturn(Oe),ft=Oe==null?0:Oe.pmin,it=null,It;Ne==null?It=null:(ft==null&&(ft=this.tokenMin),it==null&&(it=this.tokenMax),It={e:Ne,pmin:ft,pmax:it,origin:this.origin,line:this.line});let Zt=j.EFunction([{name:wt}],It),kt=e==null?0:e.pmin,ul=null;return Zt==null?null:(kt==null&&(kt=this.tokenMin),ul==null&&(ul=this.tokenMax),{e:Zt,pmin:kt,pmax:ul,origin:this.origin,line:this.line});case 3:let $e=Le.e.e;if($e._hx_index==1){let Dt=$e.v,zt=this.parseExpr(),yt=j.EReturn(zt),Gt=zt==null?0:zt.pmin,Xt=null,Qt;yt==null?Qt=null:(Gt==null&&(Gt=this.tokenMin),Xt==null&&(Xt=this.tokenMax),Qt={e:yt,pmin:Gt,pmax:Xt,origin:this.origin,line:this.line});let cl=j.EFunction([{name:Dt}],Qt),pl=e==null?0:e.pmin,el=null;return cl==null?null:(pl==null&&(pl=this.tokenMin),el==null&&(el=this.tokenMax),{e:cl,pmin:pl,pmax:el,origin:this.origin,line:this.line})}break;case 26:let Wt=Le.e.e;if(Wt._hx_index==1){let Dt=Wt.v,zt=Le.t,yt=this.parseExpr(),Gt=j.EReturn(yt),Xt=yt==null?0:yt.pmin,Qt=null,cl;Gt==null?cl=null:(Xt==null&&(Xt=this.tokenMin),Qt==null&&(Qt=this.tokenMax),cl={e:Gt,pmin:Xt,pmax:Qt,origin:this.origin,line:this.line});let pl=j.EFunction([{name:Dt,t:zt}],cl),el=e==null?0:e.pmin,nt=null;return pl==null?null:(el==null&&(el=this.tokenMin),nt==null&&(nt=this.tokenMax),{e:pl,pmin:el,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 It=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 wt=j.EUnop(i,!1,e),Oe=e==null?0:e.pmin,Ne=null,ft;return wt==null?ft=null:(Oe==null&&(Oe=this.tokenMin),Ne==null&&(Ne=this.tokenMax),ft={e:wt,pmin:Oe,pmax:Ne,origin:this.origin,line:this.line}),this.parseExprNext(ft)}return this.makeBinop(i,e,this.parseExpr());case 4:let n=j.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=j.EField(e,h),u=e==null?0:e.pmin,p=null,f;return o==null?f=null:(u==null&&(u=this.tokenMin),p==null&&(p=this.tokenMax),f={e:o,pmin:u,pmax:p,origin:this.origin,line:this.line}),this.parseExprNext(f);case 9:let m=this.getIdent(),_="__a_"+this.uid++,g=j.EVar(_,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=j.EIdent(_),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=j.EIdent("null"),N=e==null?0:e.pmin,L=e==null?0:e.pmax,B;v==null?B=null:(N==null&&(N=this.tokenMin),L==null&&(L=this.tokenMax),B={e:v,pmin:N,pmax:L,origin:this.origin,line:this.line});let I=j.EBinop("==",E,B),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 A=j.EIdent("null"),F=e==null?0:e.pmin,R=e==null?0:e.pmax,V;A==null?V=null:(F==null&&(F=this.tokenMin),R==null&&(R=this.tokenMax),V={e:A,pmin:F,pmax:R,origin:this.origin,line:this.line});let W=j.EIdent(_),H=e==null?0:e.pmin,G=e==null?0:e.pmax,X;W==null?X=null:(H==null&&(H=this.tokenMin),G==null&&(G=this.tokenMax),X={e:W,pmin:H,pmax:G,origin:this.origin,line:this.line});let he=j.EField(X,m),ce=e==null?0:e.pmin,ne=null,ae;he==null?ae=null:(ce==null&&(ce=this.tokenMin),ne==null&&(ne=this.tokenMax),ae={e:he,pmin:ce,pmax:ne,origin:this.origin,line:this.line});let xe=j.ETernary(P,V,ae),Ie=null,Ue=null,Je;xe==null?Je=null:(Ie==null&&(Ie=this.tokenMin),Ue==null&&(Ue=this.tokenMax),Je={e:xe,pmin:Ie,pmax:Ue,origin:this.origin,line:this.line});let lt=j.EBlock([y,Je]),qe=e==null?0:e.pmin,Qe=null,rt;return lt==null?rt=null:(qe==null&&(qe=this.tokenMin),Qe==null&&(Qe=this.tokenMax),rt={e:lt,pmin:qe,pmax:Qe,origin:this.origin,line:this.line}),this.parseExprNext(rt);case 12:let Ve=this.parseExpr(),$=this.token();$!=Z.TBkClose&&this.unexpected($);let se=j.EArray(e,Ve),K=e==null?0:e.pmin,ie=null,le;return se==null?le=null:(K==null&&(K=this.tokenMin),ie==null&&(ie=this.tokenMax),le={e:se,pmin:K,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 ge=this.parseExpr(),ye=j.ETernary(e,ee,ge),Ze=e==null?0:e.pmin,Tt=ge==null?0:ge.pmax;return ye==null?null:(Ze==null&&(Ze=this.tokenMin),Tt==null&&(Tt=this.tokenMax),{e:ye,pmin:Ze,pmax:Tt,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(rl.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 f=p;t.unexpected(f)}}else{let f=p;t.unexpected(f)}return rl.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 b.thrown(new ke(we.ECustom("Default values not allowed in function types"),v.pmin,v.pmax,this.origin,this.line))}x.push(rl.CTNamed(O.name,O.opt?rl.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(rl.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=[],f=0,m=this.parseFunctionArgs();for(;f<m.length;){let x=m[f];++f;let y=x.value;if(y!=null){let S=y;if(!this.resumeErrors)throw b.thrown(new ke(we.ECustom("Default values not allowed in function types"),S.pmin,S.pmax,this.origin,this.line))}p.push(rl.CTNamed(x.name,x.opt?rl.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(rl.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 f=this.getIdent(),m=this.token();m!=Z.TDoubleDot&&this.unexpected(m),h.push({name:f,t:this.parseType(),meta:o}),o=null;let _=this.token();_!=Z.TSemicolon&&this.unexpected(_)}else{let f=u,m=this.token();switch(m!=Z.TDoubleDot&&this.unexpected(m),h.push({name:f,t:this.parseType(),meta:o}),e=this.token(),e._hx_index){case 7:break e;case 10:break;default:this.unexpected(e)}}break;case 7:break e;case 16:let p=e.s;o==null&&(o=[]),o.push({name:p,params:this.parseMetaArgs()});break;default:this.unexpected(e);break e}return this.parseTypeNext(rl.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 rl.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 b.thrown(new ke(we.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 ri.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 f=this.token();return f!=Z.TSemicolon&&this.unexpected(f),ri.DImport(u,p);case"package":let m=this.parsePath(),_=this.token();return _!=Z.TSemicolon&&this.unexpected(_),ri.DPackage(m);case"typedef":let g=this.getIdent(),d=this.parseParams(),x=this.token();me.enumEq(x,Z.TOp("="))||this.unexpected(x);let y=this.parseType();return ri.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:an.KFunction({args:n.args,expr:n.body,ret:n.ret})};case"inline":t.push(Rl.AInline);break;case"macro":t.push(Rl.AMacro);break;case"override":t.push(Rl.AOverride);break;case"private":t.push(Rl.APrivate);break;case"public":t.push(Rl.APublic);break;case"static":t.push(Rl.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:an.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 b.thrown(new ke(we.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 b.thrown(new ke(we.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(Cl.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(Cl.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?Cl.CInt(a):Cl.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(Cl.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(Cl.CInt(s))}break;default:this.char=e;let r=t|0;return Z.TConst(l>0?Cl.CFloat(t*10/l):r==t?Cl.CInt(r):Cl.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=j.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=j.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 f=e.e;if(!this.resumeErrors)throw b.thrown(new ke(we.EInvalidPreprocessor("Can't eval "+Ye[f.__enum__].__constructs__[f._hx_index]._hx_name),this.readPos+this.offset,this.readPos+this.offset,this.origin,this.line));return!1}break;case 7:let r=t.prefix;if(t.op=="!"){let h=t.e;return!this.evalPreproCond(h)}else{let h=e.e;if(!this.resumeErrors)throw b.thrown(new ke(we.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 b.thrown(new ke(we.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 b.thrown(new ke(we.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 b.thrown(new ke(we.EUnterminatedComment,this.tokenMin,this.tokenMin,this.origin,this.line));break}if(t=this.input.charCodeAt(this.readPos++),t!=t){if(this.line=n,!this.resumeErrors)throw b.thrown(new ke(we.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}}}J["loreline.lorscript.Parser"]=fi,fi.__name__="loreline.lorscript.Parser",Object.assign(fi.prototype,{__class__:fi,__properties__:{get_currentPos:"get_currentPos"}});class bi{constructor(){}exprToString(e){return this.buf=new xt,this.tabs="",this.expr(e),this.buf.b}typeToString(e){return this.buf=new xt,this.tabs="",this.type(e),this.buf.b}add(e){this.buf.b+=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(mn.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(rl.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 f=e.t;this.buf.b+="?",this.type(f);break;case 5:let m=e.n,_=e.t;this.buf.b+=m==null?"null":""+m,this.buf.b+=":",this.type(_);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 Ne=l.f;this.buf.b+=Ne==null?"null":""+Ne;break;case 2:let ft=l.s;this.buf.b+='"';let it=ft.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
|
-
`;let Oe=0;for(;Oe<h.length;){let
|
|
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,
|
|
48
|
-
`;let Oe=0;for(;Oe<
|
|
49
|
-
`}this.tabs=c.substr(this.tabs,1,null),this.buf.b+="}"}break;case 22:let
|
|
46
|
+
`;let Oe=0;for(;Oe<h.length;){let Ne=h[Oe];++Oe,this.buf.b+=Y.string(this.tabs),this.expr(Ne),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,f=t.e1,m=t.e2;this.expr(f),this.buf.b+=Y.string(" "+p+" "),this.expr(m);break;case 7:let _=t.op,g=t.prefix,d=t.e;g?(this.buf.b+=_==null?"null":""+_,this.expr(d)):(this.expr(d),this.buf.b+=_==null?"null":""+_);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 Ne=Oe.c;this.expr(x);break;case 1:let ft=Oe.v;this.expr(x);break;case 5:let it=Oe.e,It=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,L=t.e;this.buf.b+="while( ",this.expr(N),this.buf.b+=" ) ",this.expr(L);break;case 11:let B=t.v,I=t.it,q=t.e;this.buf.b+=Y.string("for( "+B+" 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,A=t.name,F=t.ret;this.buf.b+="function",A!=null&&(this.buf.b+=Y.string(" "+A)),this.buf.b+="(";let R=!0,V=0;for(;V<z.length;){let Oe=z[V];++V,R?R=!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(F),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 H=t.e,G=t.index;this.expr(H),this.buf.b+="[",this.expr(G),this.buf.b+="]";break;case 17:let X=t.e;this.buf.b+="[";let he=!0,ce=0;for(;ce<X.length;){let Oe=X[ce];++ce,he?he=!1:this.buf.b+=", ",this.expr(Oe)}this.buf.b+="]";break;case 18:let ne=t.cl,ae=t.params;this.buf.b+=Y.string("new "+ne+"(");let xe=!0,Ie=0;for(;Ie<ae.length;){let Oe=ae[Ie];++Ie,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,qe=t.t,Qe=t.ecatch;this.buf.b+="try ",this.expr(Je),this.buf.b+=Y.string(" catch( "+lt),this.addType(qe),this.buf.b+=") ",this.expr(Qe);break;case 21:let rt=t.fl;if(rt.length==0)this.buf.b+="{}";else{this.tabs+=" ",this.buf.b+=`{
|
|
48
|
+
`;let Oe=0;for(;Oe<rt.length;){let Ne=rt[Oe];++Oe,this.buf.b+=Y.string(this.tabs),this.buf.b+=Y.string(Ne.name+" : "),this.expr(Ne.e),this.buf.b+=`,
|
|
49
|
+
`}this.tabs=c.substr(this.tabs,1,null),this.buf.b+="}"}break;case 22:let Ve=t.cond,$=t.e1,se=t.e2;this.expr(Ve),this.buf.b+=" ? ",this.expr($),this.buf.b+=" : ",this.expr(se);break;case 23:let K=t.e,ie=t.cases,le=t.defaultExpr;this.buf.b+="switch( ",this.expr(K),this.buf.b+=") {";let ee=0;for(;ee<ie.length;){let Oe=ie[ee];++ee,this.buf.b+="case ";let Ne=!0,ft=0,it=Oe.values;for(;ft<it.length;){let It=it[ft];++ft,Ne?Ne=!1:this.buf.b+=", ",this.expr(It)}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,
|
|
52
|
-
`),o=!1,h+="#",h+=
|
|
51
|
+
`),this.buf.b+="}";break;case 24:let pe=t.cond,ge=t.e;this.buf.b+="do ",this.expr(ge),this.buf.b+=" while ( ",this.expr(pe),this.buf.b+=" )";break;case 25:let ye=t.name,Ze=t.args,Tt=t.e;if(this.buf.b+="@",this.buf.b+=ye==null?"null":""+ye,Ze!=null&&Ze.length>0){this.buf.b+="(";let Oe=!0,Ne=0;for(;Ne<Ze.length;){let ft=Ze[Ne];++Ne,Oe?Oe=!1:this.buf.b+=", ",this.expr(Tt)}this.buf.b+=")"}this.buf.b+=" ",this.expr(Tt);break;case 26:let Le=t.e,wt=t.t;this.buf.b+="(",this.expr(Le),this.buf.b+=" : ",this.addType(wt),this.buf.b+=")";break}}static toString(e){return new bi().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}}J["loreline.lorscript.Printer"]=bi,bi.__name__="loreline.lorscript.Printer",Object.assign(bi.prototype,{__class__:bi});class _n{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,f=l.e;t(f);break;case 6:let m=l.op,_=l.e1,g=l.e2;t(_),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 L=l.cond,B=l.e;t(L),t(B);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,A=l.name,F=l.ret,R=l.e;t(R);break;case 15:let V=l.e;V!=null&&t(V);break;case 16:let W=l.e,H=l.index;t(W),t(H);break;case 17:let G=l.e,X=0;for(;X<G.length;){let Le=G[X];++X,t(Le)}break;case 18:let he=l.cl,ce=l.params,ne=0;for(;ne<ce.length;){let Le=ce[ne];++ne,t(Le)}break;case 19:let ae=l.e;t(ae);break;case 20:let xe=l.v,Ie=l.t,Ue=l.e,Je=l.ecatch;t(Ue),t(Je);break;case 21:let lt=l.fl,qe=0;for(;qe<lt.length;){let Le=lt[qe];++qe,t(Le.e)}break;case 22:let Qe=l.cond,rt=l.e1,Ve=l.e2;t(Qe),t(rt),t(Ve);break;case 23:let $=l.e,se=l.cases,K=l.defaultExpr;t($);let ie=0;for(;ie<se.length;){let Le=se[ie];++ie;let wt=0,Oe=Le.values;for(;wt<Oe.length;){let Ne=Oe[wt];++wt,t(Ne)}t(Le.expr)}K!=null&&t(K);break;case 24:let le=l.cond,ee=l.e;t(le),t(ee);break;case 25:let pe=l.name,ge=l.args,ye=l.e;if(ge!=null){let Le=0;for(;Le<ge.length;){let wt=ge[Le];++Le,t(wt)}}t(ye);break;case 26:let Ze=l.t,Tt=l.e;t(Tt);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=j.EVar(r,a,h!=null?t(h):null);break;case 3:let o=i.e;l=j.EParent(t(o));break;case 4:let u=i.e,p=[],f=0;for(;f<u.length;){let $e=u[f];++f,p.push(t($e))}l=j.EBlock(p);break;case 5:let m=i.e,_=i.f;l=j.EField(t(m),_);break;case 6:let g=i.op,d=i.e1,x=i.e2;l=j.EBinop(g,t(d),t(x));break;case 7:let y=i.op,S=i.prefix,C=i.e;l=j.EUnop(y,S,t(C));break;case 8:let O=i.e,E=i.params,v=t(O),N=[],L=0;for(;L<E.length;){let $e=E[L];++L,N.push(t($e))}l=j.ECall(v,N);break;case 9:let B=i.cond,I=i.e1,q=i.e2;l=j.EIf(t(B),t(I),q!=null?t(q):null);break;case 10:let z=i.cond,P=i.e;l=j.EWhile(t(z),t(P));break;case 11:let A=i.v,F=i.it,R=i.e;l=j.EFor(A,t(F),t(R));break;case 12:case 13:l=e.e;break;case 14:let V=i.args,W=i.e,H=i.name,G=i.ret;l=j.EFunction(V,t(W),H,G);break;case 15:let X=i.e;l=j.EReturn(X!=null?t(X):null);break;case 16:let he=i.e,ce=i.index;l=j.EArray(t(he),t(ce));break;case 17:let ne=i.e,ae=[],xe=0;for(;xe<ne.length;){let $e=ne[xe];++xe,ae.push(t($e))}l=j.EArrayDecl(ae);break;case 18:let Ie=i.cl,Ue=i.params,Je=[],lt=0;for(;lt<Ue.length;){let $e=Ue[lt];++lt,Je.push(t($e))}l=j.ENew(Ie,Je);break;case 19:let qe=i.e;l=j.EThrow(t(qe));break;case 20:let Qe=i.e,rt=i.v,Ve=i.t,$=i.ecatch;l=j.ETry(t(Qe),rt,Ve,t($));break;case 21:let se=i.fl,K=[],ie=0;for(;ie<se.length;){let $e=se[ie];++ie,K.push({name:$e.name,e:t($e.e)})}l=j.EObject(K);break;case 22:let le=i.cond,ee=i.e1,pe=i.e2;l=j.ETernary(t(le),t(ee),t(pe));break;case 23:let ge=i.e,ye=i.cases,Ze=i.defaultExpr,Tt=t(ge),Le=[],wt=0;for(;wt<ye.length;){let $e=ye[wt];++wt;let Wt=[],Dt=0,zt=$e.values;for(;Dt<zt.length;){let yt=zt[Dt];++Dt,Wt.push(t(yt))}Le.push({values:Wt,expr:t($e.expr)})}l=j.ESwitch(Tt,Le,Ze==null?null:t(Ze));break;case 24:let Oe=i.cond,Ne=i.e;l=j.EDoWhile(t(Oe),t(Ne));break;case 25:let ft=i.name,it=i.args,It=i.e,Zt;if(it==null)Zt=null;else{let $e=[],Wt=0;for(;Wt<it.length;){let Dt=it[Wt];++Wt,$e.push(t(Dt))}Zt=$e}l=j.EMeta(ft,Zt,t(It));break;case 26:let kt=i.e,ul=i.t;l=j.ECheckType(t(kt),ul);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}}}J["loreline.lorscript.Tools"]=_n,_n.__name__="loreline.lorscript.Tools";class qt{static toLoreline(e,t){return qt.convert(e,44,t)}static tsvToLoreline(e,t){return qt.convert(e,9,t)}static convert(e,t,l){let i=qt.parseRows(e,t);if(i.length<1)throw b.thrown(new st("Invalid CSV: header row required"));if(i.length<2)return"";let n=i[0],s=qt.findColumn(n,["key"]);if(s<0)throw b.thrown(new st("Invalid CSV: 'key' column not found in header"));let r=qt.findColumn(n,["source","en","original"]),a=qt.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 f=u++,m=i[f];if(m.length<=s)continue;let _=m[s];if(_==null||_==""||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
|
+
`),o=!1,h+="#",h+=_==null?"null":""+_,d!=null&&d!=""&&(h+=" // ",h+=Y.string(d.split(`
|
|
53
53
|
`).join(" ").split("\r").join(""))),h+=`
|
|
54
54
|
`,h+=g==null?"null":""+g,h+=`
|
|
55
|
-
`}return h}static fromScript(e,t,l){return
|
|
56
|
-
`;let h=0;for(;h<n.length;){let o=n[h];++h;let u=s.printStringLiteralAsText(o.str),p=t!=null&&Object.prototype.hasOwnProperty.call(t.h,o.id)?s.printStringLiteralAsText(t.h[o.id]):u;r+=Y.string(
|
|
57
|
-
`}return r}static escapeForCsvField(e,t){let l=!1,i=0,n=e.length;for(;i<n;){let s=i++,r=c.cca(e,s),a=r??-1;if(a==t||a==34||a==10||a==13){l=!0;break}}return l?'"'+e.split('"').join('""')+'"':e}static findColumn(e,t){let l=0,i=e.length;for(;l<i;){let n=l++,s=e[n].toLowerCase(),r=0;for(;r<t.length;){let a=t[r];if(++r,s==a)return n}}return-1}static findLocaleColumn(e,t){let l=t.toLowerCase(),i=0,n=e.length;for(;i<n;){let o=i++;if(e[o].toLowerCase()==l)return o}let s=l.indexOf("-",null),r=s<0?l:s!=null?c.substr(l,0,s):c.substr(l,0,null),a=0,h=e.length;for(;a<h;){let o=a++,u=e[o].toLowerCase(),p=u.indexOf("-",null);if((p<0?u:p!=null?c.substr(u,0,p):c.substr(u,0,null))==r)return o}return-1}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 parseRows(e,t){let l=[],i=[],n=new
|
|
58
|
-
`).join(" ").split("\r").join("")}}
|
|
59
|
-
`),n=!1,i+="#",i+=a==null?"null":""+a,r.msgctxt!=null&&r.msgid!=null&&r.msgid!=""&&(i+=" // ",i+=Y.string(
|
|
60
|
-
`,i+=Y.string(
|
|
61
|
-
`)}return i}static fromScript(e,t,l){let i=et.extractTranslatableEntries(e),n=new
|
|
55
|
+
`}return h}static fromScript(e,t,l){return qt.generate(e,t,l,44)}static tsvFromScript(e,t,l){return qt.generate(e,t,l,9)}static generate(e,t,l,i){let n=et.extractTranslatableEntries(e),s=new Jl,r="",a=String.fromCodePoint(i);r+=Y.string(qt.escapeForCsvField("key",i)),r+=a==null?"null":""+a,r+=Y.string(qt.escapeForCsvField("source",i)),r+=a==null?"null":""+a,r+=Y.string(qt.escapeForCsvField(l,i)),r+=`
|
|
56
|
+
`;let h=0;for(;h<n.length;){let o=n[h];++h;let u=s.printStringLiteralAsText(o.str),p=t!=null&&Object.prototype.hasOwnProperty.call(t.h,o.id)?s.printStringLiteralAsText(t.h[o.id]):u;r+=Y.string(qt.escapeForCsvField(o.id,i)),r+=a==null?"null":""+a,r+=Y.string(qt.escapeForCsvField(u,i)),r+=a==null?"null":""+a,r+=Y.string(qt.escapeForCsvField(p,i)),r+=`
|
|
57
|
+
`}return r}static escapeForCsvField(e,t){let l=!1,i=0,n=e.length;for(;i<n;){let s=i++,r=c.cca(e,s),a=r??-1;if(a==t||a==34||a==10||a==13){l=!0;break}}return l?'"'+e.split('"').join('""')+'"':e}static findColumn(e,t){let l=0,i=e.length;for(;l<i;){let n=l++,s=e[n].toLowerCase(),r=0;for(;r<t.length;){let a=t[r];if(++r,s==a)return n}}return-1}static findLocaleColumn(e,t){let l=t.toLowerCase(),i=0,n=e.length;for(;i<n;){let o=i++;if(e[o].toLowerCase()==l)return o}let s=l.indexOf("-",null),r=s<0?l:s!=null?c.substr(l,0,s):c.substr(l,0,null),a=0,h=e.length;for(;a<h;){let o=a++,u=e[o].toLowerCase(),p=u.indexOf("-",null);if((p<0?u:p!=null?c.substr(u,0,p):c.substr(u,0,null))==r)return o}return-1}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 parseRows(e,t){let l=[],i=[],n=new xt,s=!1,r=0,a=e,h=a.length;for(;r<h;){let o=c.cca(a,r),u=o??-1;if(s)if(u==34){let p;if(r+1<h){let f=c.cca(a,r+1);p=(f??-1)==34}else p=!1;p?(n.b+=String.fromCodePoint(34),r+=2):(s=!1,++r)}else n.b+=String.fromCodePoint(u),++r;else if(u==34)s=!0,++r;else if(u==t)i.push(n.b),n=new xt,++r;else if(u==10||u==13){i.push(n.b),n=new xt,(i.length>1||i.length==1&&i[0]!="")&&l.push(i),i=[];let p;if(u==13&&r+1<h){let f=c.cca(a,r+1);p=(f??-1)==10}else p=!1;p?r+=2:++r}else n.b+=String.fromCodePoint(u),++r}return(n.b!=""||i.length>0)&&(i.push(n.b),(i.length>1||i.length==1&&i[0]!="")&&l.push(i)),l}static escapeLineForComment(e){return e.split(`
|
|
58
|
+
`).join(" ").split("\r").join("")}}J["loreline.translation.CsvTranslation"]=qt,qt.__name__="loreline.translation.CsvTranslation";class Tl{static toLoreline(e,t){let l=Tl.parse(e),i="",n=!0,s=0;for(;s<l.length;){let r=l[s];if(++s,r.msgstr==null||r.msgstr=="")continue;let a=r.msgctxt!=null&&r.msgctxt!=""?r.msgctxt:r.msgid;a==null||a==""||(n||(i+=`
|
|
59
|
+
`),n=!1,i+="#",i+=a==null?"null":""+a,r.msgctxt!=null&&r.msgid!=null&&r.msgid!=""&&(i+=" // ",i+=Y.string(Tl.escapeLineForComment(r.msgid))),i+=`
|
|
60
|
+
`,i+=Y.string(Tl.escapeLineForBody(r.msgstr)),i+=`
|
|
61
|
+
`)}return i}static fromScript(e,t,l){let i=et.extractTranslatableEntries(e),n=new Jl,s="";s+=`msgid ""
|
|
62
62
|
`,s+=`msgstr ""
|
|
63
63
|
`,s+=`"Content-Type: text/plain; charset=UTF-8\\n"
|
|
64
|
-
`,s+='"Language: ',s+=Y.string(
|
|
64
|
+
`,s+='"Language: ',s+=Y.string(Tl.escapeForPoString(l)),s+=`\\n"
|
|
65
65
|
`;let r=0;for(;r<i.length;){let a=i[r];++r,s+=`
|
|
66
|
-
`;let h=n.printStringLiteralAsText(a.str),o=t!=null&&Object.prototype.hasOwnProperty.call(t.h,a.id)?n.printStringLiteralAsText(t.h[a.id]):h;s+='msgctxt "',s+=Y.string(
|
|
67
|
-
`,s+='msgid "',s+=Y.string(
|
|
68
|
-
`,s+='msgstr "',s+=Y.string(
|
|
66
|
+
`;let h=n.printStringLiteralAsText(a.str),o=t!=null&&Object.prototype.hasOwnProperty.call(t.h,a.id)?n.printStringLiteralAsText(t.h[a.id]):h;s+='msgctxt "',s+=Y.string(Tl.escapeForPoString(a.id)),s+=`"
|
|
67
|
+
`,s+='msgid "',s+=Y.string(Tl.escapeForPoString(h)),s+=`"
|
|
68
|
+
`,s+='msgstr "',s+=Y.string(Tl.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
|
|
71
|
-
`).join(" ").split("\r").join("")}static escapeLineForBody(e){return e}}
|
|
72
|
-
`),o=!1,
|
|
73
|
-
`),o=!1,
|
|
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 on);let p=Tl.readKeyword(o);if(p==null){++n;continue}let f=Tl.readQuotedString(o,p.length),m=f??"",_=n+1;for(;_<t.length;){let g=t[_],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=Tl.readQuotedString(S,0);O!=null&&(m+=O),++_}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=_}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 b.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}}J["loreline.translation.PoTranslation"]=Tl,Tl.__name__="loreline.translation.PoTranslation";class on{constructor(){}}J["loreline.translation._PoTranslation.PoEntry"]=on,on.__name__="loreline.translation._PoTranslation.PoEntry",Object.assign(on.prototype,{__class__:on});class El{static convert(e,t,l){switch(e){case".csv":return qt.toLoreline(t,l);case".po":return Tl.toLoreline(t,l);case".tsv":return qt.tsvToLoreline(t,l);case".xlf":case".xliff":return Pt.toLoreline(t,l);default:throw new b("Unknown translation format extension: "+e)}}static translationFormat(e,t){El.enabled.h[e]=t}static anyEnabled(){let e=0,t=El.formats;for(;e<t.length;){let l=t[e];if(++e,El.enabled.h[l.name]==!0)return!0}return!1}static wrap(e,t){if(!El.anyEnabled())return new Ui(e,function(){return null});let l=null,i=null;i=function(s,r,a,h){if(a>=El.formats.length){r?i(s,!1,0,h):h(null);return}let o=El.formats[a];if(El.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(El.convert(o.ext,p,t))}catch(f){let m=b.caught(f).unwrap();if(m instanceof st){let _=m;l=new st('Failed to load translation file "'+u+'": '+_.message),i(s,r,a+1,h)}else throw f}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,f,m=u.length,_=p.length,g;if(_>m)g=!1;else{let d=m-_;g=(_!=null?c.substr(u,d,_):c.substr(u,d,null))==p}if(g){let d=u.length-p.length;f=d!=null?c.substr(u,0,d):c.substr(u,0,null)}else f=u;i(f,!0,0,r)})};return new Ui(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}}J["loreline.translation.TranslationFormats"]=El,El.__name__="loreline.translation.TranslationFormats";class Ui{constructor(e,t){this.handler=e,this.lastError=t}}J["loreline.translation.WrappedFileHandler"]=Ui,Ui.__name__="loreline.translation.WrappedFileHandler",Object.assign(Ui.prototype,{__class__:Ui});class Pt{static toLoreline(e,t){let l;try{l=li.parse(e)}catch(p){let f=b.caught(p).unwrap();throw b.thrown(new st("Invalid XLIFF: "+Y.string(f)))}let i=null;if(l.nodeType!=U.Document&&l.nodeType!=U.Element)throw b.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!=U.Element)throw b.thrown("Bad node type, expected Element but found "+(p.nodeType==null?"null":de.toString(p.nodeType)));if(p.nodeName=="xliff"){i=p;break}}}if(i==null)throw b.thrown(new st("Invalid XLIFF: missing <xliff> root element"));let r=i.exists("trgLang")?i.get("trgLang"):null,a=r!=null;if(a&&!Pt.localeMatches(r,t))return"";let h=new xt,o=!0,u=i.elementsNamed("file");for(;u.hasNext();){let p=u.next();if(!a){let f=p.exists("target-language")?p.get("target-language"):null;if(f!=null&&!Pt.localeMatches(f,t))continue}if(a){let f=p.elementsNamed("unit");for(;f.hasNext();){let m=f.next();if(!m.exists("id"))continue;let _=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=Pt.innerText(Pt.firstChildElement(v,"source")),L=Pt.innerText(Pt.firstChildElement(v,"target"));N!=null&&y.push(N),L!=null&&S.push(L)}let O=y.join(""),E=S.join("");E!=""&&(o||(h.b+=`
|
|
72
|
+
`),o=!1,Pt.writeEntry(h,_,O,E))}}else{let f=Pt.firstChildElement(p,"body");if(f==null)continue;let m=f.elementsNamed("trans-unit");for(;m.hasNext();){let _=m.next();if(!_.exists("id"))continue;let g=_.get("id"),d=Pt.innerText(Pt.firstChildElement(_,"source")),x=Pt.innerText(Pt.firstChildElement(_,"target"));x==null||x==""||(o||(h.b+=`
|
|
73
|
+
`),o=!1,Pt.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!=U.Document&&e.nodeType!=U.Element)throw b.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++];if(n.nodeType==0){if(n.nodeType!=U.Element)throw b.thrown("Bad node type, expected Element but found "+(n.nodeType==null?"null":de.toString(n.nodeType)));if(n.nodeName==t)return n}}return null}static innerText(e){if(e==null)return null;let t="";if(e.nodeType!=U.Document&&e.nodeType!=U.Element)throw b.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(Pt.innerText(n));break;case 1:if(n.nodeType==U.Document||n.nodeType==U.Element)throw b.thrown("Bad node type, unexpected "+(n.nodeType==null?"null":de.toString(n.nodeType)));t+=Y.string(n.nodeValue);break;case 2:if(n.nodeType==U.Document||n.nodeType==U.Element)throw b.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 Jl,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
|
-
`,s+=' <file source-language="en" target-language="',s+=Y.string(
|
|
75
|
+
`,s+=' <file source-language="en" target-language="',s+=Y.string(Pt.escapeForXmlAttr(l)),s+=`" datatype="plaintext">
|
|
76
76
|
`,s+=` <body>
|
|
77
|
-
`;let r=0;for(;r<i.length;){let a=i[r];++r;let h=n.printStringLiteralAsText(a.str),o=t!=null&&Object.prototype.hasOwnProperty.call(t.h,a.id)?n.printStringLiteralAsText(t.h[a.id]):h;s+=' <trans-unit id="',s+=Y.string(
|
|
78
|
-
`,s+=" <source>",s+=Y.string(
|
|
79
|
-
`,s+=" <target>",s+=Y.string(
|
|
77
|
+
`;let r=0;for(;r<i.length;){let a=i[r];++r;let h=n.printStringLiteralAsText(a.str),o=t!=null&&Object.prototype.hasOwnProperty.call(t.h,a.id)?n.printStringLiteralAsText(t.h[a.id]):h;s+=' <trans-unit id="',s+=Y.string(Pt.escapeForXmlAttr(a.id)),s+=`">
|
|
78
|
+
`,s+=" <source>",s+=Y.string(Pt.escapeForXmlText(h)),s+=`</source>
|
|
79
|
+
`,s+=" <target>",s+=Y.string(Pt.escapeForXmlText(o)),s+=`</target>
|
|
80
80
|
`,s+=` </trans-unit>
|
|
81
81
|
`}return s+=` </body>
|
|
82
82
|
`,s+=` </file>
|
|
83
83
|
`,s+=`</xliff>
|
|
84
|
-
`,s}static escapeForXmlText(e){let t=e.split("&").join("&");return t=t.split("<").join("<"),t=t.split(">").join(">"),t}static escapeForXmlAttr(e){let t=
|
|
84
|
+
`,s}static escapeForXmlText(e){let t=e.split("&").join("&");return t=t.split("<").join("<"),t=t.split(">").join(">"),t}static escapeForXmlAttr(e){let t=Pt.escapeForXmlText(e);return t=t.split('"').join("""),t}static writeEntry(e,t,l,i){if(e.b+="#",e.b+=t==null?"null":""+t,l!=null&&l!=""){e.b+=" // ";let n=l.split(`
|
|
85
85
|
`).join(" ").split("\r").join("");e.b+=Y.string(n)}e.b+=`
|
|
86
86
|
`,e.b+=i==null?"null":""+i,e.b+=`
|
|
87
87
|
`}static escapeLineForComment(e){return e.split(`
|
|
88
|
-
`).join(" ").split("\r").join("")}}
|
|
89
|
-
\r`,
|
|
88
|
+
`).join(" ").split("\r").join("")}}J["loreline.translation.XliffTranslation"]=Pt,Pt.__name__="loreline.translation.XliffTranslation";function Sn(T){return T instanceof Array?new Bl(T):T.iterator()}function Te(T,e){if(e==null)return null;e.__id__==null&&(e.__id__=fn.$haxeUID++);var t;return T.hx__closures__==null?T.hx__closures__={}:t=T.hx__closures__[e.__id__],t==null&&(t=e.bind(T),T.hx__closures__[e.__id__]=t),t}fn.$haxeUID|=0,typeof performance<"u"&&typeof performance.now=="function"&&(c.now=performance.now.bind(performance)),J.Math=Math,String.fromCodePoint==null&&(String.fromCodePoint=function(T){return T<65536?String.fromCharCode(T):String.fromCharCode((T>>10)+55232)+String.fromCharCode((T&1023)+56320)});{Object.defineProperty(String.prototype,"__class__",{value:J.String=String,enumerable:!1,writable:!0}),String.__name__="String",J.Array=Array,Array.__name__="Array",Date.prototype.__class__=J.Date=Date,Date.__name__="Date";var In={},Nn={},Fn=Number,Mn=Boolean,Bn={},Ln={}}te.__toStr={}.toString,U.Element=0,U.PCData=1,U.CData=2,U.Comment=3,U.DocType=4,U.ProcessingInstruction=5,U.Document=6,li.escapes=(function(T){var e;let t=new Se;return t.h.lt="<",t.h.gt=">",t.h.amp="&",t.h.quot='"',t.h.apos="'",e=t,e})(this),et.randomId_nonHexChars="ghijklmnopqrstuvwxyz",et.randomId_chars="0123456789abcdefghijklmnopqrstuvwxyz",xi.ObjectBrace=0,xi.ArrayBracket=1,xi.Brace=2,xi.Indent=3,xi.CaseIndent=4,xi.Bracket=5,xi.Paren=6,ii.CONTROL_KEYWORDS=["for","while","if","else","switch","catch"],Ol.INITIAL_SIZE=16,Ol.LOAD_FACTOR=.75,Dl.ChoiceBrace=0,Dl.ChoiceIndent=1,Dl.StateBrace=2,Dl.StateIndent=3,Dl.CharacterBrace=4,Dl.CharacterIndent=5,Dl.BeatBrace=6,Dl.BeatIndent=7,Dl.AlternativeBrace=8,Dl.AlternativeIndent=9,Dl.Brace=10,Dl.Indent=11,Dl.Bracket=12,Ct.hasNonSpecialChar_specialChars=` "+=*/-(){}[]:
|
|
89
|
+
\r`,Ct.KEYWORDS=(function(T){var e;let t=new Se;return t.h.import=k.KwImport,t.h.state=k.KwState,t.h.beat=k.KwBeat,t.h.character=k.KwCharacter,t.h.choice=k.KwChoice,t.h.if=k.KwIf,t.h.else=k.KwElse,t.h.new=k.KwNew,t.h.sequence=k.KwSequence,t.h.cycle=k.KwCycle,t.h.once=k.KwOnce,t.h.pick=k.KwPick,t.h.shuffle=k.KwShuffle,t.h.true=k.LBoolean(!0),t.h.false=k.LBoolean(!1),t.h.null=k.LNull,t.h.and=k.OpAnd(!0),t.h.or=k.OpOr(!0),e=t,e})(this),Re.OFFSET=32768,Re.MAX=65535,Re.UNDEFINED=new Re(0,0,0,0),ut._hx_skip_constructor=!1,Wl.Plain=0,Wl.Braces=1,Bi.Plain=0,Bi.Parens=2,Li.Sequence=0,Li.Cycle=1,Li.Once=2,Li.Pick=3,Li.Shuffle=4,dn.Unquoted=0,dn.DoubleQuotes=1,ti.timers=[],El.formats=[{name:"po",ext:".po"},{name:"xliff",ext:".xliff"},{name:"xliff",ext:".xlf"},{name:"csv",ext:".csv"},{name:"csv",ext:".tsv"}],El.enabled=new Se,wn.main()})(pn,Jn);export const Loreline=pn.loreline.Loreline,Interpreter=pn.loreline.Interpreter,Node=pn.loreline.Node,Script=pn.loreline.Script;
|