loreline 0.10.0 → 0.11.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.
@@ -1,89 +1,90 @@
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+="&quot;":l+=String.fromCodePoint(o);break;case 38:l+="&amp;";break;case 39:t?l+="&#039;":l+=String.fromCodePoint(o);break;case 60:l+="&lt;";break;case 62:l+="&gt;";break;default:l+=String.fromCodePoint(o)}}return l}static isSpace(e,t){let l=c.cca(e,t);return l>8&&l<14?!0:l==32}static ltrim(e){let t=e.length,l=0;for(;l<t&&He.isSpace(e,l);)++l;return l>0?c.substr(e,l,t-l):e}static rtrim(e){let t=e.length,l=0;for(;l<t&&He.isSpace(e,t-l-1);)++l;return l>0?c.substr(e,0,t-l):e}static trim(e){return He.ltrim(He.rtrim(e))}static replace(e,t,l){return e.split(t).join(l)}}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+=`
1
+ "use strict";let sn={},hs={};(function(Jl,Bn){"use strict";Jl.loreline=Jl.loreline||{},Jl.loreline.i18n=Jl.loreline.i18n||{};var J={},F=function(){return le.__string_rec(this,"")},it=it||{},w;class p{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=p,p.__name__="HxOverrides";class Gi{constructor(e,t){this.min=e,this.max=t}hasNext(){return this.min<this.max}next(){return this.min++}}J.IntIterator=Gi,Gi.__name__="IntIterator",Object.assign(Gi.prototype,{__class__:Gi});class An{static exists(e,t){let l=Jn(e);for(;l.hasNext();){let i=l.next();if(t(i))return!0}return!1}}J.Lambda=An,An.__name__="Lambda",Math.__name__="Math";class Le{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=Le,Le.__name__="Reflect";class oe{static string(e){return le.__string_rec(e,"")}static parseInt(e){let t=parseInt(e);return isNaN(t)?null:t}}J.Std=oe,oe.__name__="Std";class Et{constructor(){this.b=""}}J.StringBuf=Et,Et.__name__="StringBuf",Object.assign(Et.prototype,{__class__:Et});class Ue{static htmlEscape(e,t){let l="",i=0,n=e;for(;i<n.length;){let s=n,r=i++,a=s.charCodeAt(r);a>=55296&&a<=56319&&(a=a-55232<<10|s.charCodeAt(r+1)&1023);let h=a;h>=65536&&++i;let o=h;switch(o){case 34:t?l+="&quot;":l+=String.fromCodePoint(o);break;case 38:l+="&amp;";break;case 39:t?l+="&#039;":l+=String.fromCodePoint(o);break;case 60:l+="&lt;";break;case 62:l+="&gt;";break;default:l+=String.fromCodePoint(o)}}return l}static isSpace(e,t){let l=p.cca(e,t);return l>8&&l<14?!0:l==32}static ltrim(e){let t=e.length,l=0;for(;l<t&&Ue.isSpace(e,l);)++l;return l>0?p.substr(e,l,t-l):e}static rtrim(e){let t=e.length,l=0;for(;l<t&&Ue.isSpace(e,t-l-1);)++l;return l>0?p.substr(e,0,t-l):e}static trim(e){return Ue.ltrim(Ue.rtrim(e))}static replace(e,t,l){return e.split(t).join(l)}}J.StringTools=Ue,Ue.__name__="StringTools";var Ft=it.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 he{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(it[t]);let l=le.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=it[l].__constructs__[e._hx_index].__params__,s=0;for(;s<n.length;){let r=n[s];if(++s,!he.enumEq(e[r],t[r]))return!1}}catch{return!1}return!0}static enumParameters(e){let l=it[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=he,he.__name__="Type";class be{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 W{constructor(e){this.nodeType=e,this.children=[],this.attributeMap=new Ce}get(e){if(this.nodeType!=W.Element)throw y.thrown("Bad node type, expected Element but found "+(this.nodeType==null?"null":be.toString(this.nodeType)));return this.attributeMap.h[e]}set(e,t){if(this.nodeType!=W.Element)throw y.thrown("Bad node type, expected Element but found "+(this.nodeType==null?"null":be.toString(this.nodeType)));this.attributeMap.h[e]=t}exists(e){if(this.nodeType!=W.Element)throw y.thrown("Bad node type, expected Element but found "+(this.nodeType==null?"null":be.toString(this.nodeType)));return Object.prototype.hasOwnProperty.call(this.attributeMap.h,e)}attributes(){if(this.nodeType!=W.Element)throw y.thrown("Bad node type, expected Element but found "+(this.nodeType==null?"null":be.toString(this.nodeType)));return new Qi(this.attributeMap.h)}elements(){if(this.nodeType!=W.Document&&this.nodeType!=W.Element)throw y.thrown("Bad node type, expected Element or Document but found "+(this.nodeType==null?"null":be.toString(this.nodeType)));let e=[],t=0,l=this.children;for(;t<l.length;){let n=l[t];++t,n.nodeType==W.Element&&e.push(n)}let i=e;return new ei(i)}elementsNamed(e){if(this.nodeType!=W.Document&&this.nodeType!=W.Element)throw y.thrown("Bad node type, expected Element or Document but found "+(this.nodeType==null?"null":be.toString(this.nodeType)));let t=[],l=0,i=this.children;for(;l<i.length;){let s=i[l];++l;let r;if(s.nodeType==W.Element){if(s.nodeType!=W.Element)throw y.thrown("Bad node type, expected Element but found "+(s.nodeType==null?"null":be.toString(s.nodeType)));r=s.nodeName==e}else r=!1;r&&t.push(s)}let n=t;return new ei(n)}firstElement(){if(this.nodeType!=W.Document&&this.nodeType!=W.Element)throw y.thrown("Bad node type, expected Element or Document but found "+(this.nodeType==null?"null":be.toString(this.nodeType)));let e=0,t=this.children;for(;e<t.length;){let l=t[e];if(++e,l.nodeType==W.Element)return l}return null}addChild(e){if(this.nodeType!=W.Document&&this.nodeType!=W.Element)throw y.thrown("Bad node type, expected Element or Document but found "+(this.nodeType==null?"null":be.toString(this.nodeType)));e.parent!=null&&e.parent.removeChild(e),this.children.push(e),e.parent=this}removeChild(e){if(this.nodeType!=W.Document&&this.nodeType!=W.Element)throw y.thrown("Bad node type, expected Element or Document but found "+(this.nodeType==null?"null":be.toString(this.nodeType)));return p.remove(this.children,e)?(e.parent=null,!0):!1}toString(){return Ni.print(this)}static createElement(e){let t=new W(W.Element);if(t.nodeType!=W.Element)throw y.thrown("Bad node type, expected Element but found "+(t.nodeType==null?"null":be.toString(t.nodeType)));return t.nodeName=e,t}static createPCData(e){let t=new W(W.PCData);if(t.nodeType==W.Document||t.nodeType==W.Element)throw y.thrown("Bad node type, unexpected "+(t.nodeType==null?"null":be.toString(t.nodeType)));return t.nodeValue=e,t}static createCData(e){let t=new W(W.CData);if(t.nodeType==W.Document||t.nodeType==W.Element)throw y.thrown("Bad node type, unexpected "+(t.nodeType==null?"null":be.toString(t.nodeType)));return t.nodeValue=e,t}static createComment(e){let t=new W(W.Comment);if(t.nodeType==W.Document||t.nodeType==W.Element)throw y.thrown("Bad node type, unexpected "+(t.nodeType==null?"null":be.toString(t.nodeType)));return t.nodeValue=e,t}static createDocType(e){let t=new W(W.DocType);if(t.nodeType==W.Document||t.nodeType==W.Element)throw y.thrown("Bad node type, unexpected "+(t.nodeType==null?"null":be.toString(t.nodeType)));return t.nodeValue=e,t}static createProcessingInstruction(e){let t=new W(W.ProcessingInstruction);if(t.nodeType==W.Document||t.nodeType==W.Element)throw y.thrown("Bad node type, unexpected "+(t.nodeType==null?"null":be.toString(t.nodeType)));return t.nodeValue=e,t}static createDocument(){return new W(W.Document)}}J.Xml=W,W.__name__="Xml",Object.assign(W.prototype,{__class__:W});var Yl=it["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)};Yl.__constructs__=[Yl.CFunction,Yl.Module,Yl.FilePos,Yl.Method,Yl.LocalFunction];class Qn{static callStack(){return Zl.toHaxe(Zl.callStack())}}class At{}J["haxe.IMap"]=At,At.__name__="haxe.IMap",At.__isInterface__=!0,Object.assign(At.prototype,{__class__:At});class y 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 y?e:e instanceof Error?new y(e.message,null,e):new Ri(e,null,e)}static thrown(e){return e instanceof y?e.get_native():e instanceof Error?e:new Ri(e)}}J["haxe.Exception"]=y,y.__name__="haxe.Exception",y.__super__=Error,Object.assign(y.prototype,{__class__:y,__properties__:{get_native:"get_native",get_message:"get_message"}});class ui{constructor(e,t){this.high=e,this.low=t}}J["haxe._Int64.___Int64"]=ui,ui.__name__="haxe._Int64.___Int64",Object.assign(ui.prototype,{__class__:ui});class rn{static formatOutput(e,t){let l=oe.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+=", "+oe.string(r)}}return i+": "+l}static trace(e,t){let l=rn.formatOutput(e,t);typeof console<"u"&&console.log!=null&&console.log(l)}}J["haxe.Log"]=rn,rn.__name__="haxe.Log";class Zl{static callStack(){let e=new Error(""),t=Zl.tryHaxeStack(e);if(typeof t>"u"){try{throw e}catch{}t=e.stack}return Zl.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(),c=h[2],f=oe.parseInt(h[3]),g=oe.parseInt(h[4]);i.push(Yl.FilePos(u=="Anonymous function"?Yl.LocalFunction():u=="Global code"?null:Yl.Method(o.join("."),u),c,f,g))}else i.push(Yl.Module(Ue.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=Zl.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,Zl.wrapCallSite!=null&&(n=Zl.wrapCallSite(n));let s=null,r=n.getFunctionName();if(r!=null){let o=r.lastIndexOf(".");if(o>=0){let u=r.substring(0,o),c=r.substring(o+1);s=Yl.Method(u,c)}else s=Yl.Method(null,r)}let a=n.getFileName(),h=a==null?-1:a.indexOf("file:");Zl.wrapCallSite!=null&&h>0&&(a=a.substring(h+6)),l.push(Yl.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 Zl.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?"":Zl.skipLines(e,--t,l+1)):e.substring(l)}}J["haxe.NativeStackTrace"]=Zl,Zl.__name__="haxe.NativeStackTrace";class Ai{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 Ai(t);return l.run=function(){l.stop(),e()},l}}J["haxe.Timer"]=Ai,Ai.__name__="haxe.Timer",Object.assign(Ai.prototype,{__class__:Ai});class Ri extends y{constructor(e,t,l){super(String(e),t,l),this.value=e}unwrap(){return this.value}}J["haxe.ValueException"]=Ri,Ri.__name__="haxe.ValueException",Ri.__super__=y,Object.assign(Ri.prototype,{__class__:Ri});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 ei(e)}setLoop(e,t,l){if(l==null)return new Tl(null,e,t,null);let i=this.compare(e,l.key);if(i==0)return new Tl(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 Tl(e.left,e.key,e.value,new Tl(e.right,t,l,i)):new Tl(new Tl(e.left,e.key,e.value,e.right.left),e.right.key,e.right.value,new Tl(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 Tl(new Tl(e,t,l,i.left),i.key,i.value,i.right):new Tl(new Tl(e,t,l,i.left.left),i.left.key,i.left.value,new Tl(i.left.right,i.key,i.value,i.right))}else return new Tl(e,t,l,i,(n>s?n:s)+1)}compare(e,t){return Le.compare(e,t)}}J["haxe.ds.BalancedTree"]=Di,Di.__name__="haxe.ds.BalancedTree",Di.__interfaces__=[At],Object.assign(Di.prototype,{__class__:Di});class Tl{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"]=Tl,Tl.__name__="haxe.ds.TreeNode",Object.assign(Tl.prototype,{__class__:Tl});class Pi extends Di{constructor(){super()}compare(e,t){let l=e._hx_index-t._hx_index;if(l!=0)return l;let i=he.enumParameters(e),n=he.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 Le.isEnumValue(e)&&Le.isEnumValue(t)?this.compare(e,t):e instanceof Array&&t instanceof Array?this.compareArgs(e,t):Le.compare(e,t)}}J["haxe.ds.EnumValueMap"]=Pi,Pi.__name__="haxe.ds.EnumValueMap",Pi.__interfaces__=[At],Pi.__super__=Di,Object.assign(Pi.prototype,{__class__:Pi});class Xl{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 ei(e)}}J["haxe.ds.IntMap"]=Xl,Xl.__name__="haxe.ds.IntMap",Xl.__interfaces__=[At],Object.assign(Xl.prototype,{__class__:Xl});class an{constructor(){this.length=0}add(e){let t=new $i(e,null);this.h==null?this.h=t:this.q.next=t,this.q=t,this.length++}push(e){let t=new $i(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"]=an,an.__name__="haxe.ds.List",Object.assign(an.prototype,{__class__:an});class $i{constructor(e,t){this.item=e,this.next=t}}J["haxe.ds._List.ListNode"]=$i,$i.__name__="haxe.ds._List.ListNode",Object.assign($i.prototype,{__class__:$i});class Ui{constructor(){this.h={__keys__:{}}}set(e,t){let l=e.__id__;l==null&&(l=e.__id__=Bn.$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 ei(e)}}J["haxe.ds.ObjectMap"]=Ui,Ui.__name__="haxe.ds.ObjectMap",Ui.__interfaces__=[At],Object.assign(Ui.prototype,{__class__:Ui});class Ce{constructor(){this.h=Object.create(null)}get(e){return this.h[e]}set(e,t){this.h[e]=t}keys(){return new Qi(this.h)}}J["haxe.ds.StringMap"]=Ce,Ce.__name__="haxe.ds.StringMap",Ce.__interfaces__=[At],Object.assign(Ce.prototype,{__class__:Ce});class Qi{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"]=Qi,Qi.__name__="haxe.ds._StringMap.StringMapKeyIterator",Object.assign(Qi.prototype,{__class__:Qi});class Ln{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 nt{constructor(e){switch(e){case".":case"..":this.dir=e,this.file="";return}let t=e.lastIndexOf("/"),l=e.lastIndexOf("\\");t<l?(this.dir=p.substr(e,0,l),e=p.substr(e,l+1,null),this.backslash=!0):l<t?(this.dir=p.substr(e,0,t),e=p.substr(e,t+1,null)):this.dir=null;let i=e.lastIndexOf(".");i!=-1?(this.ext=p.substr(e,i+1,null),this.file=p.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 nt(e);return t.dir=null,t.toString()}static directory(e){let t=new nt(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=nt.addTrailingSlash(s),s+=n[h]}return nt.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 c=n[i];++i,c==".."&&l.length>0&&l[l.length-1]!=".."?l.pop():c==""?(l.length>0||p.cca(e,0)==47)&&l.push(c):c!="."&&l.push(c)}let s=l.join(t),r="",a=!1,h=!1,o=0,u=s;for(;o<u.length;){let c=u,f=o++,g=c.charCodeAt(f);g>=55296&&g<=56319&&(g=g-55232<<10|c.charCodeAt(f+1)&1023);let _=g;_>=65536&&++o;let d=_;switch(d){case 47:if(!a)h=!0;else{let k=d;a=!1,h&&(r+="/",h=!1),r+=String.fromCodePoint(k)}break;case 58:r+=":",a=!0;break;default:let m=d;a=!1,h&&(r+="/",h=!1),r+=String.fromCodePoint(m)}}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"]=nt,nt.__name__="haxe.io.Path",Object.assign(nt.prototype,{__class__:nt});class ei{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"]=ei,ei.__name__="haxe.iterators.ArrayIterator",Object.assign(ei.prototype,{__class__:ei});var wl=it["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)};wl.__constructs__=[wl.CUnknown,wl.CEnum,wl.CClass,wl.CTypedef,wl.CFunction,wl.CAnonymous,wl.CDynamic,wl.CAbstract];var rl=it["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}};rl.__constructs__=[rl.RNormal,rl.RNo,rl.RCall,rl.RMethod,rl.RDynamic,rl.RInline];var ci=it["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)};ci.__constructs__=[ci.TPackage,ci.TClassdecl,ci.TEnumdecl,ci.TTypedecl,ci.TAbstractdecl];class yt{static typeInfos(e){let t;switch(e._hx_index){case 0:let l=e.name,i=e.full,n=e.subs;throw y.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==wl.CUnknown;case 1:let l=e.name,i=e.params;if(t._hx_index==1){let _=t.name,d=t.params;return l==_?yt.leq(yt.typeEq,i,d):!1}break;case 2:let n=e.name,s=e.params;if(t._hx_index==2){let _=t.name,d=t.params;return n==_?yt.leq(yt.typeEq,s,d):!1}break;case 3:let r=e.name,a=e.params;if(t._hx_index==3){let _=t.name,d=t.params;return r==_?yt.leq(yt.typeEq,a,d):!1}break;case 4:let h=e.args,o=e.ret;if(t._hx_index==4){let _=t.args,d=t.ret;return yt.leq(function(m,k){return m.name==k.name&&m.opt==k.opt?yt.typeEq(m.t,k.t):!1},h,_)?yt.typeEq(o,d):!1}break;case 5:let u=e.fields;if(t._hx_index==5){let _=t.fields;return yt.leq(function(d,m){return yt.fieldEq(d,m)},u,_)}break;case 6:let c=e.t;if(t._hx_index==6){let _=t.t;return c==null!=(_==null)?!1:c!=null?yt.typeEq(c,_):!0}break;case 7:let f=e.name,g=e.params;if(t._hx_index==7){let _=t.name,d=t.params;return f==_?yt.leq(yt.typeEq,g,d):!1}break}return!1}static fieldEq(e,t){return!(e.name!=t.name||!yt.typeEq(e.type,t.type)||e.isPublic!=t.isPublic||e.doc!=t.doc||!yt.rightsEq(e.get,t.get)||!yt.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&&!yt.leq(function(l,i){return l.name==i.name&&l.opt==i.opt?yt.typeEq(l.t,i.t):!1},e.args,t.args))}}J["haxe.rtti.TypeApi"]=yt,yt.__name__="haxe.rtti.TypeApi";class hn{constructor(){this.root=[]}process(e,t){if(this.curplatform=t,e.nodeType!=W.Document&&e.nodeType!=W.Element)throw y.thrown("Invalid nodeType "+(e.nodeType==null?"null":be.toString(e.nodeType)));this.xroot(e)}mergeRights(e,t){return e.get==rl.RInline&&e.set==rl.RNo&&t.get==rl.RNormal&&t.set==rl.RMethod?(e.get=rl.RNormal,e.set=rl.RMethod,!0):he.enumEq(e.get,t.get)?he.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 yt.fieldEq(e,t)?!0:e.name==t.name&&(this.mergeRights(e,t)||this.mergeRights(t,e))&&this.mergeDoc(e,t)?yt.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,yt.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(!yt.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(!yt.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=yt.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 c=u.full,f=u.name,g=u.subs;if(f==a){h=!0,i=g;break}}}if(n.push(a),!h){let u=[];i.push(ci.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,c=a.full,f=a.subs;h=!0}else h=!1;if(h)continue;let o=yt.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,g=a.full,_=a.subs;u=!1;break;case 1:let d=a.c;if(e._hx_index==1){let T=e.c;if(this.mergeClasses(d,T))return}else u=!1;break;case 2:let m=a.e;if(e._hx_index==2){let T=e.e;if(this.mergeEnums(m,T))return}else u=!1;break;case 3:let k=a.t;if(e._hx_index==3){let T=e.t;if(this.mergeTypedefs(k,T))return}break;case 4:let C=a.a;if(e._hx_index==4){let T=e.a;if(this.mergeAbstracts(C,T))return}else u=!1;break}let c=o.module!=t.module?"module "+t.module+" should be "+o.module:o.doc!=t.doc?"documentation is different":o.isPrivate!=t.isPrivate?"private flag is different":u?"could not merge definition":"type kind is different";throw y.thrown("Incompatibilities between "+o.path+" in "+o.platforms.join(",")+" and "+this.curplatform+" ("+c+")")}}i.push(e)}mkPath(e){return e}mkTypeParams(e){let t=e.split(":");return t[0]==""?[]:t}mkRights(e){switch(e){case"dynamic":return rl.RDynamic;case"inline":return rl.RInline;case"method":return rl.RMethod;case"null":return rl.RNo;default:return rl.RCall(e)}}xerror(e){let t;if(e.nodeType==W.Document)t="Document";else{if(e.nodeType!=W.Element)throw y.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":be.toString(e.nodeType)));t=e.nodeName}throw y.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!=W.Document&&e.nodeType!=W.Element)throw y.thrown("Invalid nodeType "+(e.nodeType==null?"null":be.toString(e.nodeType)));let t=e,l;if(t.nodeType==W.Document)l="Document";else{if(t.nodeType!=W.Element)throw y.thrown("Bad node type, expected Element but found "+(t.nodeType==null?"null":be.toString(t.nodeType)));l=t.nodeName}switch(l){case"abstract":return ci.TAbstractdecl(this.xabstract(t));case"class":return ci.TClassdecl(this.xclass(t));case"enum":return ci.TEnumdecl(this.xenum(t));case"typedef":return ci.TTypedecl(this.xtypedef(t));default:return this.xerror(t)}}xmeta(e){let t=[],l=0,i=qn.resolve(e,"m");for(;l<i.length;){let n=i[l];++l;let s=[],r=0,a=qn.resolve(n,"e");for(;r<a.length;){let h=a[r];++r,s.push(Ii.get_innerHTML(h))}t.push({name:ut.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(ut.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(),c;if(u.nodeType==W.Document)c="Document";else{if(u.nodeType!=W.Element)throw y.thrown("Bad node type, expected Element but found "+(u.nodeType==null?"null":be.toString(u.nodeType)));c=u.nodeName}switch(c){case"extends":h?n.push(this.xpath(u)):t=this.xpath(u);break;case"haxe_doc":l=Ii.get_innerData(u);break;case"haxe_dynamic":let f=u.firstElement();if(f.nodeType!=W.Document&&f.nodeType!=W.Element)throw y.thrown("Invalid nodeType "+(f.nodeType==null?"null":be.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:Sl.resolve(e,"file")?ut.resolve(e,"file"):null,path:this.mkPath(ut.resolve(e,"path")),module:Sl.resolve(e,"module")?this.mkPath(ut.resolve(e,"module")):null,doc:l,isPrivate:e.exists("private"),isExtern:e.exists("extern"),isFinal:e.exists("final"),isInterface:h,params:this.mkTypeParams(ut.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==W.Document)u="Document";else{if(o.nodeType!=W.Element)throw y.thrown("Bad node type, expected Element but found "+(o.nodeType==null?"null":be.toString(o.nodeType)));u=o.nodeName}switch(u){case"haxe_doc":n=Ii.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==W.Document)h="Document";else{if(e.nodeType!=W.Element)throw y.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":be.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:Sl.resolve(e,"line")?oe.parseInt(ut.resolve(e,"line")):null,doc:n,get:Sl.resolve(e,"get")?this.mkRights(ut.resolve(e,"get")):rl.RNormal,set:Sl.resolve(e,"set")?this.mkRights(ut.resolve(e,"set")):rl.RNormal,params:Sl.resolve(e,"params")?this.mkTypeParams(ut.resolve(e,"params")):[],platforms:this.defplat(),meta:s,overloads:r,expr:Sl.resolve(e,"expr")?ut.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==W.Document)r="Document";else{if(s.nodeType!=W.Element)throw y.thrown("Bad node type, expected Element but found "+(s.nodeType==null?"null":be.toString(s.nodeType)));r=s.nodeName}if(r=="haxe_doc")l=Ii.get_innerData(s);else{let a;if(s.nodeType==W.Document)a="Document";else{if(s.nodeType!=W.Element)throw y.thrown("Bad node type, expected Element but found "+(s.nodeType==null?"null":be.toString(s.nodeType)));a=s.nodeName}a=="meta"?i=this.xmeta(s):t.push(this.xenumfield(s))}}return{file:Sl.resolve(e,"file")?ut.resolve(e,"file"):null,path:this.mkPath(ut.resolve(e,"path")),module:Sl.resolve(e,"module")?this.mkPath(ut.resolve(e,"module")):null,doc:l,isPrivate:e.exists("private"),isExtern:e.exists("extern"),params:this.mkTypeParams(ut.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=Yn.resolve(e,"meta")?this.xmeta(Vn.resolve(e,"meta")):[];if(Sl.resolve(e,"a")){let a=ut.resolve(e,"a").split(":"),h=e.elements();t=[];let o=0;for(;o<a.length;){let u=a[o];++o;let c=!1;u.charAt(0)=="?"&&(c=!0,u=p.substr(u,1,null)),t.push({name:u,opt:c,t:this.xtype(h.next())})}}let s;if(e.nodeType==W.Document)s="Document";else{if(e.nodeType!=W.Element)throw y.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":be.toString(e.nodeType)));s=e.nodeName}let r;if(i==null)r=null;else{if(i.nodeType!=W.Document&&i.nodeType!=W.Element)throw y.thrown("Invalid nodeType "+(i.nodeType==null?"null":be.toString(i.nodeType)));r=Ii.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==W.Document)o="Document";else{if(h.nodeType!=W.Element)throw y.thrown("Bad node type, expected Element but found "+(h.nodeType==null?"null":be.toString(h.nodeType)));o=h.nodeName}switch(o){case"from":let u=h.elements();for(;u.hasNext();){let g=u.next(),_=g.firstElement();if(_.nodeType!=W.Document&&_.nodeType!=W.Element)throw y.thrown("Invalid nodeType "+(_.nodeType==null?"null":be.toString(_.nodeType)));r.push({t:this.xtype(_),field:Sl.resolve(g,"field")?ut.resolve(g,"field"):null})}break;case"haxe_doc":t=Ii.get_innerData(h);break;case"impl":l=this.xclass(Vn.resolve(h,"class"));break;case"meta":n=this.xmeta(h);break;case"this":let c=h.firstElement();if(c.nodeType!=W.Document&&c.nodeType!=W.Element)throw y.thrown("Invalid nodeType "+(c.nodeType==null?"null":be.toString(c.nodeType)));i=this.xtype(c);break;case"to":let f=h.elements();for(;f.hasNext();){let g=f.next(),_=g.firstElement();if(_.nodeType!=W.Document&&_.nodeType!=W.Element)throw y.thrown("Invalid nodeType "+(_.nodeType==null?"null":be.toString(_.nodeType)));s.push({t:this.xtype(_),field:Sl.resolve(g,"field")?ut.resolve(g,"field"):null})}break;default:this.xerror(h)}}return{file:Sl.resolve(e,"file")?ut.resolve(e,"file"):null,path:this.mkPath(ut.resolve(e,"path")),module:Sl.resolve(e,"module")?this.mkPath(ut.resolve(e,"module")):null,doc:t,isPrivate:e.exists("private"),params:this.mkTypeParams(ut.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==W.Document)a="Document";else{if(r.nodeType!=W.Element)throw y.thrown("Bad node type, expected Element but found "+(r.nodeType==null?"null":be.toString(r.nodeType)));a=r.nodeName}if(a=="haxe_doc")t=Ii.get_innerData(r);else{let h;if(r.nodeType==W.Document)h="Document";else{if(r.nodeType!=W.Element)throw y.thrown("Bad node type, expected Element but found "+(r.nodeType==null?"null":be.toString(r.nodeType)));h=r.nodeName}h=="meta"?i=this.xmeta(r):l=this.xtype(r)}}let s=new Ce;return this.curplatform!=null&&(s.h[this.curplatform]=l),{file:Sl.resolve(e,"file")?ut.resolve(e,"file"):null,path:this.mkPath(ut.resolve(e,"path")),module:Sl.resolve(e,"module")?this.mkPath(ut.resolve(e,"module")):null,doc:t,isPrivate:e.exists("private"),params:this.mkTypeParams(ut.resolve(e,"params")),type:l,types:s,platforms:this.defplat(),meta:i}}xtype(e){let t;if(e.nodeType==W.Document)t="Document";else{if(e.nodeType!=W.Element)throw y.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":be.toString(e.nodeType)));t=e.nodeName}switch(t){case"a":let l=[],i=e.elements();for(;i.hasNext();){let g=i.next(),_=this.xclassfield(g,!0);_.platforms=[],l.push(_)}return wl.CAnonymous(l);case"c":return wl.CClass(this.mkPath(ut.resolve(e,"path")),this.xtypeparams(e));case"d":let n=null,s=e.firstElement();if(s!=null){if(s.nodeType!=W.Document&&s.nodeType!=W.Element)throw y.thrown("Invalid nodeType "+(s.nodeType==null?"null":be.toString(s.nodeType)));n=this.xtype(s)}return wl.CDynamic(n);case"e":return wl.CEnum(this.mkPath(ut.resolve(e,"path")),this.xtypeparams(e));case"f":let r=[],a=ut.resolve(e,"a").split(":"),h=0,o=a,u=Sl.resolve(e,"v")?new ei(ut.resolve(e,"v").split(":")):null,c=e.elements();for(;c.hasNext();){let g=c.next(),_=!1,d=h<o.length?o[h++]:null;d==null&&(d=""),d.charAt(0)=="?"&&(_=!0,d=p.substr(d,1,null));let m=u==null||u.current>=u.array.length?null:u.array[u.current++];r.push({name:d,opt:_,t:this.xtype(g),value:m==""?null:m})}let f=r[r.length-1];return p.remove(r,f),wl.CFunction(r,f.t);case"t":return wl.CTypedef(this.mkPath(ut.resolve(e,"path")),this.xtypeparams(e));case"unknown":return wl.CUnknown;case"x":return wl.CAbstract(this.mkPath(ut.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"]=hn,hn.__name__="haxe.rtti.XmlParser",Object.assign(hn.prototype,{__class__:hn});class Vn{static resolve(e,t){let l=e.elementsNamed(t).next();if(l==null){let i;if(e.nodeType==W.Document)i="Document";else{if(e.nodeType!=W.Element)throw y.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":be.toString(e.nodeType)));i=e.nodeName}throw y.thrown(i+" is missing element "+t)}if(l.nodeType!=W.Document&&l.nodeType!=W.Element)throw y.thrown("Invalid nodeType "+(l.nodeType==null?"null":be.toString(l.nodeType)));return l}}class ut{static resolve(e,t){if(e.nodeType==W.Document)throw y.thrown("Cannot access document attribute "+t);let l=e.get(t);if(l==null)throw e.nodeType!=W.Element?y.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":be.toString(e.nodeType))):y.thrown(e.nodeName+" is missing attribute "+t);return l}}class Sl{static resolve(e,t){if(e.nodeType==W.Document)throw y.thrown("Cannot access document attribute "+t);return e.exists(t)}}class Yn{static resolve(e,t){return e.elementsNamed(t).hasNext()}}class qn{static resolve(e,t){let l=[],i=e.elementsNamed(t);for(;i.hasNext();){let n=i.next();if(n.nodeType!=W.Document&&n.nodeType!=W.Element)throw y.thrown("Invalid nodeType "+(n.nodeType==null?"null":be.toString(n.nodeType)));l.push(n)}return l}}class Ii{static get_innerData(e){if(e.nodeType!=W.Document&&e.nodeType!=W.Element)throw y.thrown("Bad node type, expected Element or Document but found "+(e.nodeType==null?"null":be.toString(e.nodeType)));let t=0,l=e.children;if(t>=l.length){let n;if(e.nodeType==W.Document)n="Document";else{if(e.nodeType!=W.Element)throw y.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":be.toString(e.nodeType)));n=e.nodeName}throw y.thrown(n+" does not have data")}let i=l[t++];if(t<l.length){let n=l[t++],s;if(i.nodeType==W.PCData&&n.nodeType==W.CData){if(i.nodeType==W.Document||i.nodeType==W.Element)throw y.thrown("Bad node type, unexpected "+(i.nodeType==null?"null":be.toString(i.nodeType)));s=Ue.trim(i.nodeValue)==""}else s=!1;if(s){if(t>=l.length){if(n.nodeType==W.Document||n.nodeType==W.Element)throw y.thrown("Bad node type, unexpected "+(n.nodeType==null?"null":be.toString(n.nodeType)));return n.nodeValue}let a=l[t++],h;if(a.nodeType==W.PCData){if(a.nodeType==W.Document||a.nodeType==W.Element)throw y.thrown("Bad node type, unexpected "+(a.nodeType==null?"null":be.toString(a.nodeType)));h=Ue.trim(a.nodeValue)==""}else h=!1;if(h&&t>=l.length){if(n.nodeType==W.Document||n.nodeType==W.Element)throw y.thrown("Bad node type, unexpected "+(n.nodeType==null?"null":be.toString(n.nodeType)));return n.nodeValue}}let r;if(e.nodeType==W.Document)r="Document";else{if(e.nodeType!=W.Element)throw y.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":be.toString(e.nodeType)));r=e.nodeName}throw y.thrown(r+" does not only have data")}if(i.nodeType!=W.PCData&&i.nodeType!=W.CData){let n;if(e.nodeType==W.Document)n="Document";else{if(e.nodeType!=W.Element)throw y.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":be.toString(e.nodeType)));n=e.nodeName}throw y.thrown(n+" does not have data")}if(i.nodeType==W.Document||i.nodeType==W.Element)throw y.thrown("Bad node type, unexpected "+(i.nodeType==null?"null":be.toString(i.nodeType)));return i.nodeValue}static get_innerHTML(e){let t="";if(e.nodeType!=W.Document&&e.nodeType!=W.Element)throw y.thrown("Bad node type, expected Element or Document but found "+(e.nodeType==null?"null":be.toString(e.nodeType)));let l=0,i=e.children;for(;l<i.length;){let n=i[l++];t+=oe.string(Ni.print(n))}return t}}Ii.__properties__={get_innerHTML:"get_innerHTML",get_innerData:"get_innerData"};class qt{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 le.getClass(this).__name__+": "+this.message+" at line "+this.lineNumber+" char "+this.positionAtLine}}J["haxe.xml.XmlParserException"]=qt,qt.__name__="haxe.xml.XmlParserException",Object.assign(qt.prototype,{__class__:qt});class Ci{static parse(e,t){t==null&&(t=!1);let l=W.createDocument();return Ci.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,c=new Et,f=1,g=-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,p.substr(e,l,6).toUpperCase()!="CDATA[")throw y.thrown(new qt("Expected <![CDATA[",e,l));l+=5,s=17,h=l+1}else if(e.charCodeAt(l+1)==68||e.charCodeAt(l+1)==100){if(p.substr(e,l+2,6).toUpperCase()!="OCTYPE")throw y.thrown(new qt("Expected <!DOCTYPE",e,l));l+=8,s=16,h=l+1}else{if(e.charCodeAt(l+1)!=45||e.charCodeAt(l+2)!=45)throw y.thrown(new qt("Expected <!--",e,l));l+=2,s=15,h=l+1}break;case 47:if(i==null)throw y.thrown(new qt("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 y.thrown(new qt("Expected node name",e,l));n=W.createElement(p.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 y.thrown(new qt("Expected attribute name",e,l));if(a=p.substr(e,h,l-h),n.exists(a))throw y.thrown(new qt("Duplicate attribute ["+a+"]",e,l));s=0,r=6;continue}break;case 6:if(_==61)s=0,r=7;else throw y.thrown(new qt("Expected =",e,l));break;case 7:switch(_){case 34:case 39:c=new Et,s=8,h=l+1,g=_;break;default:throw y.thrown(new qt('Expected "',e,l))}break;case 8:switch(_){case 38:let d=l-h;c.b+=d==null?p.substr(e,h,null):p.substr(e,h,d),s=18,f=8,h=l+1;break;case 60:case 62:if(t)throw y.thrown(new qt("Invalid unescaped "+String.fromCodePoint(_)+" in attribute value",e,l));if(_==g){let m=l-h;c.b+=m==null?p.substr(e,h,null):p.substr(e,h,m);let k=c.b;c=new Et,n.set(a,k),s=0,r=4}break;default:if(_==g){let m=l-h;c.b+=m==null?p.substr(e,h,null):p.substr(e,h,m);let k=c.b;c=new Et,n.set(a,k),s=0,r=4}}break;case 9:l=Ci.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 y.thrown(new qt("Expected node name",e,l));let d=p.substr(e,h,l-h);if(i==null||i.nodeType!=0)throw y.thrown(new qt("Unexpected </"+d+">, tag is not open",e,l));if(i.nodeType!=W.Element)throw y.thrown("Bad node type, expected Element but found "+(i.nodeType==null?"null":be.toString(i.nodeType)));if(d!=i.nodeName)throw i.nodeType!=W.Element?y.thrown("Bad node type, expected Element but found "+(i.nodeType==null?"null":be.toString(i.nodeType))):y.thrown(new qt("Expected </"+i.nodeName+">",e,l));s=0,r=12;continue}break;case 11:if(_==62)s=1;else throw y.thrown(new qt("Expected >",e,l));break;case 12:if(_==62)return o==0&&i.addChild(W.createPCData("")),l;throw y.thrown(new qt("Expected >",e,l));case 13:if(_==60){let d=l-h;c.b+=d==null?p.substr(e,h,null):p.substr(e,h,d);let m=W.createPCData(c.b);c=new Et,i.addChild(m),++o,s=0,r=2}else if(_==38){let d=l-h;c.b+=d==null?p.substr(e,h,null):p.substr(e,h,d),s=18,f=13,h=l+1}break;case 14:if(_==63&&e.charCodeAt(l+1)==62){++l;let d=p.substr(e,h+1,l-h-2);i.addChild(W.createProcessingInstruction(d)),++o,s=1}break;case 15:_==45&&e.charCodeAt(l+1)==45&&e.charCodeAt(l+2)==62&&(i.addChild(W.createComment(p.substr(e,h,l-h))),++o,l+=2,s=1);break;case 16:_==91?++u:_==93?--u:_==62&&u==0&&(i.addChild(W.createDocType(p.substr(e,h,l-h))),++o,s=1);break;case 17:if(_==93&&e.charCodeAt(l+1)==93&&e.charCodeAt(l+2)==62){let d=W.createCData(p.substr(e,h,l-h));i.addChild(d),++o,l+=2,s=1}break;case 18:if(_==59){let d=p.substr(e,h,l-h);if(d.charCodeAt(0)==35){let m=d.charCodeAt(1)==120?oe.parseInt("0"+p.substr(d,1,d.length-1)):oe.parseInt(p.substr(d,1,d.length-1));c.b+=String.fromCodePoint(m)}else if(Object.prototype.hasOwnProperty.call(Ci.escapes.h,d))c.b+=oe.string(Ci.escapes.h[d]);else{if(t)throw y.thrown(new qt("Undefined entity: "+d,e,l));c.b+=oe.string("&"+d+";")}h=l+1,s=f}else if(!(_>=97&&_<=122||_>=65&&_<=90||_>=48&&_<=57||_==58||_==46||_==95||_==45)&&_!=35){if(t)throw y.thrown(new qt("Invalid character in entity: "+String.fromCodePoint(_),e,l));c.b+=String.fromCodePoint(38);let d=l-h;c.b+=d==null?p.substr(e,h,null):p.substr(e,h,d),--l,h=l+1,s=f}break}++l}if(s==1&&(h=l,s=13),s==13){if(i.nodeType==0)throw i.nodeType!=W.Element?y.thrown("Bad node type, expected Element but found "+(i.nodeType==null?"null":be.toString(i.nodeType))):y.thrown(new qt("Unclosed node <"+i.nodeName+">",e,l));if(l!=h||o==0){let _=l-h;c.b+=_==null?p.substr(e,h,null):p.substr(e,h,_),i.addChild(W.createPCData(c.b)),++o}return l}if(!t&&s==18&&f==13){c.b+=String.fromCodePoint(38);let _=l-h;return c.b+=_==null?p.substr(e,h,null):p.substr(e,h,_),i.addChild(W.createPCData(c.b)),++o,l}throw y.thrown(new qt("Unexpected end",e,l))}}J["haxe.xml.Parser"]=Ci,Ci.__name__="haxe.xml.Parser";class Ni{constructor(e){this.output=new Et,this.pretty=e}writeNode(e,t){switch(e.nodeType){case 0:if(this.output.b+=oe.string(t+"<"),e.nodeType!=W.Element)throw y.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":be.toString(e.nodeType)));this.output.b+=oe.string(e.nodeName);let l=e.attributes();for(;l.hasNext();){let o=l.next();this.output.b+=oe.string(" "+o+'="');let u=Ue.htmlEscape(e.get(o),!0);this.output.b+=oe.string(u),this.output.b+='"'}if(this.hasChildren(e)){if(this.output.b+=">",this.pretty&&(this.output.b+=`
5
+ `),e.nodeType!=W.Document&&e.nodeType!=W.Element)throw y.thrown("Bad node type, expected Element or Document but found "+(e.nodeType==null?"null":be.toString(e.nodeType)));let o=0,u=e.children;for(;o<u.length;){let c=u[o++];this.writeNode(c,this.pretty?t+" ":t)}if(this.output.b+=oe.string(t+"</"),e.nodeType!=W.Element)throw y.thrown("Bad node type, expected Element but found "+(e.nodeType==null?"null":be.toString(e.nodeType)));this.output.b+=oe.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==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
- \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==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=`{
7
+ `);break;case 1:if(e.nodeType==W.Document||e.nodeType==W.Element)throw y.thrown("Bad node type, unexpected "+(e.nodeType==null?"null":be.toString(e.nodeType)));let i=e.nodeValue;if(i.length!=0){let o=t+Ue.htmlEscape(i);this.output.b+=oe.string(o),this.pretty&&(this.output.b+=`
8
+ `)}break;case 2:if(this.output.b+=oe.string(t+"<![CDATA["),e.nodeType==W.Document||e.nodeType==W.Element)throw y.thrown("Bad node type, unexpected "+(e.nodeType==null?"null":be.toString(e.nodeType)));this.output.b+=oe.string(e.nodeValue),this.output.b+="]]>",this.pretty&&(this.output.b+=`
9
+ `);break;case 3:if(e.nodeType==W.Document||e.nodeType==W.Element)throw y.thrown("Bad node type, unexpected "+(e.nodeType==null?"null":be.toString(e.nodeType)));let n=e.nodeValue,s=new RegExp(`[
10
+ \r ]+`,"g".split("u").join(""));n=n.replace(s,""),n="<!--"+n+"-->",this.output.b+=t==null?"null":""+t;let r=Ue.trim(n);this.output.b+=oe.string(r),this.pretty&&(this.output.b+=`
11
+ `);break;case 4:if(e.nodeType==W.Document||e.nodeType==W.Element)throw y.thrown("Bad node type, unexpected "+(e.nodeType==null?"null":be.toString(e.nodeType)));this.output.b+=oe.string("<!DOCTYPE "+e.nodeValue+">"),this.pretty&&(this.output.b+=`
12
+ `);break;case 5:if(e.nodeType==W.Document||e.nodeType==W.Element)throw y.thrown("Bad node type, unexpected "+(e.nodeType==null?"null":be.toString(e.nodeType)));this.output.b+=oe.string("<?"+e.nodeValue+"?>"),this.pretty&&(this.output.b+=`
13
+ `);break;case 6:if(e.nodeType!=W.Document&&e.nodeType!=W.Element)throw y.thrown("Bad node type, expected Element or Document but found "+(e.nodeType==null?"null":be.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!=W.Document&&e.nodeType!=W.Element)throw y.thrown("Bad node type, expected Element or Document but found "+(e.nodeType==null?"null":be.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==W.Document||i.nodeType==W.Element)throw y.thrown("Bad node type, unexpected "+(i.nodeType==null?"null":be.toString(i.nodeType)));if(Ue.ltrim(i.nodeValue).length!=0)return!0;break;default:}}return!1}static print(e,t){t==null&&(t=!1);let l=new Ni(t);return l.writeNode(e,""),l.output.b}}J["haxe.xml.Printer"]=Ni,Ni.__name__="haxe.xml.Printer",Object.assign(Ni.prototype,{__class__:Ni});class le{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=le.__nativeClassName(e);return l!=null?le.__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=it[e.__enum__].__constructs__[e._hx_index],o=h._hx_name;return h.__params__?(t=t+" ",o+"("+(function(u){var c;let f=[];{let g=0,_=h.__params__;for(;g<_.length;){let d=_[g];g=g+1,f.push(le.__string_rec(e[d],t))}}return c=f,c})(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?",":"")+le.__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
- `),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 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+=`
15
+ `),n+=t+r+" : "+le.__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||le.__interfLoop(r,t))return!0}}return le.__interfLoop(e.__super__,t)}static __instanceof(e,t){if(t==null)return!1;switch(t){case Array:return e instanceof Array;case ts:return typeof e=="boolean";case Xn:return e!=null;case es:return typeof e=="number";case Zn:return typeof e=="number"?(e|0)===e:!1;case String:return typeof e=="string";default:if(e!=null){if(typeof t=="function"){if(le.__downcastCheck(e,t))return!0}else if(typeof t=="object"&&le.__isNativeObj(t)&&e instanceof t)return!0}else return!1;return t==ls&&e.__name__!=null||t==is&&e.__ename__!=null?!0:e.__enum__!=null?it[e.__enum__]==t:!1}}static __downcastCheck(e,t){return e instanceof t?!0:t.__isInterface__?le.__interfLoop(le.getClass(e),t):!1}static __implements(e,t){return le.__interfLoop(le.getClass(e),t)}static __cast(e,t){if(e==null||le.__instanceof(e,t))return e;throw y.thrown("Cannot cast "+oe.string(e)+" to "+oe.string(t))}static __nativeClassName(e){let t=le.__toStr.call(e).slice(8,-1);return t=="Object"||t=="Function"||t=="Math"||t=="JSON"?null:t}static __isNativeObj(e){return le.__nativeClassName(e)!=null}static __resolveNativeClass(e){return Bn[e]}}J["js.Boot"]=le,le.__name__="js.Boot";class se{static fromValues(e){return e}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 ei(e)}static arrayCopy(e){let t=se.arrayLength(e),l=se.createArray(),i=0,n=t;for(;i<n;){let s=i++;se.arrayPush(l,se.arrayGet(e,s))}return l}static arraySort(e,t){let l=se.arrayLength(e),i=1,n=l;for(;i<n;){let s=i++,r=se.arrayGet(e,s),a=s-1;for(;a>=0&&t(se.arrayGet(e,a),r)>0;)se.arraySet(e,a+1,se.arrayGet(e,a)),--a;se.arraySet(e,a+1,r)}}static arrayReverse(e){let t=0,l=se.arrayLength(e)-1;for(;t<l;){let i=se.arrayGet(e,t);se.arraySet(e,t,se.arrayGet(e,l)),se.arraySet(e,l,i),++t,--l}}static arrayJoin(e,t){let l=se.arrayLength(e),i="",n=0,s=l;for(;n<s;){let r=n++;r>0&&(i+=t==null?"null":""+t),i+=oe.string(se.arrayGet(e,r)==null?"null":oe.string(se.arrayGet(e,r)))}return i}}J["loreline.Arrays"]=se,se.__name__="loreline.Arrays";class Ve{static addQuotes(e){e.each(function(t,l){if(t instanceof vt){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=Ve.unquotedRawToQuotedRaw(h);i.parts[r].partType=Ye.Raw(o)}}}}})}static removeQuotes(e){e.each(function(t,l){if(t instanceof vt){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(Ve.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 c=u.text,f=Ve.quotedRawToUnquotedRaw(c);i.parts[o].partType=Ye.Raw(f)}}}}}})}static toBraceStyle(e){e.each(function(t,l){if(t instanceof Kt)le.__cast(t,Kt).style=1;else if(t instanceof Zt)le.__cast(t,Zt).style=1;else if(t instanceof Ae)le.__cast(t,Ae).style=1;else if(t instanceof Vl)le.__cast(t,Vl).style=1;else if(t instanceof Dt)le.__cast(t,Dt).style=1;else if(t instanceof kl)le.__cast(t,kl).style=1;else if(t instanceof De){let i=t,n=i.literalType;if(n._hx_index==4){let s=n.style;i.literalType=ze.Object(1)}}})}static toPlainStyle(e){e.each(function(t,l){if(t instanceof Kt)le.__cast(t,Kt).style=0;else if(t instanceof Zt)le.__cast(t,Zt).style=0;else if(t instanceof Ae)le.__cast(t,Ae).style=0;else if(t instanceof Vl)le.__cast(t,Vl).style=0;else if(t instanceof Dt)le.__cast(t,Dt).style=0;else if(t instanceof kl)le.__cast(t,kl).style=0;else if(t instanceof De){let i=t,n=i.literalType;if(n._hx_index==4){let s=n.style;i.literalType=ze.Object(0)}}})}static useWordOperators(e){Ve.setWordOperators(e,!0)}static useSymbolOperators(e){Ve.setWordOperators(e,!1)}static setWordOperators(e,t){e.each(function(l,i){if(l instanceof Ht){let n=l,s=n.op;switch(s._hx_index){case 34:let r=s.word;n.op=x.OpEquals(t);break;case 35:let a=s.word;n.op=x.OpNotEquals(t);break;case 40:let h=s.word;n.op=x.OpAnd(t);break;case 41:let o=s.word;n.op=x.OpOr(t);break;default:}}else if(l instanceof $l){let n=l,s=n.op;if(s._hx_index==42){let r=s.word;n.op=x.OpNot(t)}}})}static whenRuleScore(e){return e.condition==null?0:Ve.andClauseCount(e.condition)}static conditionClauseCount(e){return Ve.andClauseCount(e)}static andClauseCount(e){if(Ve.isLiteralTrue(e))return 0;if(e.parens==0&&e instanceof Ht){let t=e,l=t.op;if(l._hx_index==40){let i=l.word;return Ve.andClauseCount(t.left)+Ve.andClauseCount(t.right)}}return 1}static isLiteralTrue(e){if(e instanceof De){let t=e;return t.literalType==ze.Boolean?t.value==!0:!1}return!1}static docComments(e){let t=e.leadingComments;if(t==null)return[];let l=[],i=e.pos.line-1,n=t.length-1;for(;n>=0;){let s=t[n];if(s.pos.line+s.content.split(`
17
+ `).length-1!=i)break;l.unshift(s),i=s.pos.line-1,--n}return l}static useParenConditions(e){e.each(function(t,l){t instanceof ql?le.__cast(t,ql).conditionStyle=2:t instanceof Dt&&(le.__cast(t,Dt).conditionStyle=2)})}static usePlainConditions(e){e.each(function(t,l){t instanceof ql?le.__cast(t,ql).conditionStyle=0:t instanceof Dt&&(le.__cast(t,Dt).conditionStyle=0)})}static reindentFunctions(e,t,l){e.each(function(i,n){if(i instanceof si){let s=i;s.code!=null&&s.code.length>0&&!s.external&&(s.code=Ve.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(`
18
+ `),r=!l&&t instanceof Ot?(w=le.__cast(t,Ot),Te(w,w.eachExcludingImported)):Te(t,t.each),a=i??new Ce;r(function(c,f){if(c instanceof Be){let g=c;if(g.trailingComments!=null){let _=0,d=g.trailingComments;for(;_<d.length;){let m=d[_];++_,m.isHash&&(a.h[m.content]=!0)}}if(g.leadingComments!=null){let _=0,d=g.leadingComments;for(;_<d.length;){let m=d[_];++_,m.isHash&&(a.h[m.content]=!0)}}}});let h=[];if(r(function(c,f){let g=null;if(c instanceof fl?g=le.__cast(c,fl).content:c instanceof Jt?g=le.__cast(c,Jt).content:c instanceof Dt&&(g=le.__cast(c,Dt).text),g!=null){let d=Ve.getStringEndLine(g)-1;if(d>=0&&d<s.length&&Ve.lineHasHashComment(s[d]))return;let m,k=0;do m=Ve.randomId(n,7+(k*.01|0)),++k;while(Object.prototype.hasOwnProperty.call(a.h,m));a.h[m]=!0,h.push({offset:g.pos.offset+g.pos.length,text:" #"+m})}}),h.length==0)return e;h.sort(function(c,f){return f.offset-c.offset});let o=e,u=0;for(;u<h.length;){let c=h[u];++u;let f=c.offset,g=c.offset,_=null;o=(f!=null?p.substr(o,0,f):p.substr(o,0,null))+c.text+(_!=null?p.substr(o,g,_):p.substr(o,g,null))}return o}static removeLocalizationKeys(e,t,l){l==null&&(l=!0);let i=[];if((!l&&t instanceof Ot?(w=le.__cast(t,Ot),Te(w,w.eachExcludingImported)):Te(t,t.each))(function(a,h){if(a instanceof Be){let o=a,u=o.trailingComments;if(u!=null){let f=0;for(;f<u.length;){let g=u[f];if(++f,g.isHash){let _=g.pos.offset,d=g.pos.offset+g.pos.length;for(;_>0;){let m=p.cca(e,_-1),k=m??-1;if(k==32||k==9)--_;else break}i.push({start:_,end:d})}}}let c=o.leadingComments;if(c!=null){let f=0;for(;f<c.length;){let g=c[f];if(++f,g.isHash){let _=g.pos.offset,d=g.pos.offset+g.pos.length;for(;_>0;){let m=p.cca(e,_-1),k=m??-1;if(k==32||k==9)--_;else break}i.push({start:_,end:d})}}}}}),i.length==0)return e;i.sort(function(a,h){return h.start-a.start});let s=e,r=0;for(;r<i.length;){let a=i[r];++r;let h=a.start,o=a.end,u=null;s=(h!=null?p.substr(s,0,h):p.substr(s,0,null))+(u!=null?p.substr(s,o,u):p.substr(s,o,null))}return s}static lineHasHashComment(e){let t=e.length,l=0;for(;l<t;){let i=p.cca(e,l);if((i??-1)==35){let n;if(l+1<t){let a=p.cca(e,l+1);n=(a??-1)==35}else n=!1;if(n){l+=2;continue}let s;if(l>0){let a=p.cca(e,l-1);s=(a??-1)==92}else s=!1;if(s){++l;continue}let r=D.stringCodeAt(e,l+1);if(Q.isStart(r)||r>=48&&r<=57||r==45)return!0}++l}return!1}static extractTranslations(e){let t=new Ce;return e.each(function(l,i){let n=null,s=null;if(l instanceof fl?(s=l,n=le.__cast(l,fl).content):l instanceof Jt&&(s=l,n=le.__cast(l,Jt).content),n!=null&&s!=null){let r=Ve.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 fl)n=l,s=le.__cast(l,fl).content;else if(l instanceof Jt)n=l,s=le.__cast(l,Jt).content;else if(l instanceof Dt){let r=l;r.text!=null&&(n=l,s=r.text)}if(s!=null&&n!=null){let r=Ve.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 fl)n=l,s=le.__cast(l,fl).content;else if(l instanceof Jt)n=l,s=le.__cast(l,Jt).content;else if(l instanceof Dt){let r=l;r.text!=null&&(n=l,s=r.text)}s!=null&&n!=null&&Ve.findHashComment(n,s)==null&&(t=!0)}),t}static collectHashIds(e,t){if(t==null&&(t=new Ce),e==null)return t;let i=new Bt(e).tokenize(),n=0;for(;n<i.length;){let s=i[n];++n;let r=s.type;if(r._hx_index==56){let a=r.content;t.h[a]=!0}}return t}static generateTranslationFile(e,t,l){let i=Ve.extractTranslatableEntries(e),n="",s=!0;n+=`
18
19
  `;let r=0;for(;r<i.length;){let a=i[r];++r,s||(n+=`
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
- `,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
- `}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
- `)!=-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(`
20
+ `),s=!1;let h=l.printStringLiteralAsReference(a.str),o=l.printStringLiteralAsText(a.str);n+="#",n+=oe.string(a.id),n+=" // ",n+=h==null?"null":""+h,n+=`
21
+ `,t!=null&&Object.prototype.hasOwnProperty.call(t.h,a.id)?n+=oe.string(l.printStringLiteralAsText(t.h[a.id])):n+=o==null?"null":""+o,n+=`
22
+ `}return n}static unquotedRawToQuotedRaw(e){let t="",l=0;for(;l<e.length;){let i=p.cca(e,l);if(i==92&&l+1<e.length){let n=p.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=p.cca(e,l);if(i==92&&l+1<e.length){let n=p.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(`
23
+ `)!=-1||e.indexOf("{")!=-1)return!1;let t=p.cca(e,0);if(t==40||t==91||t==123||t==125||t==93||t==58||t==61)return!1;if(e.length>=2&&t==47){let r=p.cca(e,1);if(r==47||r==42)return!1}if(e.length>=2&&t==45&&p.cca(e,1)==62||t==43&&e.length>=3&&p.cca(e,1)==32)return!1;let l=["beat ","state ","character ","choice ","import ","new ","function ","if ","else "],i=0;for(;i<l.length;){let r=l[i];if(++i,e.startsWith(r))return!1}let n=0;for(;Q.isPart(D.stringCodeAt(e,n));)n+=D.stringUnitsAt(e,n);let s=n;if(s>0){for(;D.stringCodeAt(e,s)==32||D.stringCodeAt(e,s)==9;)++s;if(D.stringCodeAt(e,s)==58)return!1}return!(e=="null"||e=="true"||e=="false"||Ve.isNumberLiteral(e)||e.length>=2&&p.cca(e,1)==61&&(t==43||t==45||t==42||t==47))}static isNumberLiteral(e){if(e.length==0)return!1;let t=0;if(p.cca(e,0)==45&&++t,t>=e.length)return!1;let l=!1,i=!1;for(;t<e.length;){let n=p.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
24
  `),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,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(`
25
+ `);let h=i[a],o=0,u=0;for(;p.substr(h,u,null).startsWith(t);)++o,u+=t.length;let c=0,f=o;for(;c<f;){let g=c++;n+=l==null?"null":""+l}n+=oe.string(p.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;)p.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=p.cca(Ve.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=p.cca(s,o);if(!(u>=48&&u<=57||u>=97&&u<=102)){r=!1;break}}if(r){let o=Math.floor(t*((e.seed=e.seed*16807%2147483647)/2147483647+233e-12)),u=p.cca(Ve.randomId_nonHexChars,Math.floor(Ve.randomId_nonHexChars.length*((e.seed=e.seed*16807%2147483647)/2147483647+233e-12)));s=p.substr(s,0,o)+String.fromCodePoint(u)+p.substr(s,o+1,null)}return s}}J["loreline.AstUtils"]=Jl.loreline.AstUtils=Ve,Ve.__name__="loreline.AstUtils";class Ti{constructor(e){this.func=e}}J["loreline.Async"]=Jl.loreline.Async=Ti,Ti.__name__="loreline.Async",Object.assign(Ti.prototype,{__class__:Ti});class D{static count(e){let t=e.length;if(D.UNITS==1)return t;let l=0,i=0;for(;i<t;)i+=D.stringUnitsAt(e,i),++l;return l}static textOf(e){let t="";return D.UNITS==4&&e>=128?(e<2048?t+=String.fromCodePoint(192|e>>6):e<65536?(t+=String.fromCodePoint(224|e>>12),t+=String.fromCodePoint(128|e>>6&63)):(t+=String.fromCodePoint(240|e>>18),t+=String.fromCodePoint(128|e>>12&63),t+=String.fromCodePoint(128|e>>6&63)),t+=String.fromCodePoint(128|e&63)):D.UNITS==2&&e>=65536?(t+=String.fromCodePoint(55296+(e-65536>>10)),t+=String.fromCodePoint(56320+(e-65536&1023))):t+=String.fromCodePoint(e),t}static stringCodeAt(e,t){let l=p.cca(e,t),i=l??-1;if(i<128)return i;if(D.UNITS==2){if(i>=55296&&i<=56319){let n=p.cca(e,t+1),s=n??-1;if(s>=56320&&s<=57343)return 65536+(i-55296<<10)+(s-56320)}return i}if(D.UNITS==4){let n=i>=240?4:i>=224?3:i>=192?2:1;if(n==1)return 65533;let s=i&(n==2?31:n==3?15:7),r=1,a=n;for(;r<a;){let h=r++,o=p.cca(e,t+h),u=o??-1;if(u<128||u>191)return 65533;s=s<<6|u&63}return s}return i}static stringUnitsAt(e,t){let l=p.cca(e,t),i=l??-1;if(i<0)return 0;if(i<128||D.UNITS==1)return 1;if(D.UNITS==2){if(i>=55296&&i<=56319){let a=p.cca(e,t+1),h=a??-1;if(h>=56320&&h<=57343)return 2}return 1}let n=i>=240?4:i>=224?3:i>=192?2:1,s=1,r=n;for(;s<r;){let a=s++,h=p.cca(e,t+a),o=h??-1;if(o<128||o>191)return a}return n}static stringStartBefore(e,t){if(t<=0||D.UNITS==1)return t-1;let l=p.cca(e,t-1),i=l??-1;if(D.UNITS==2){if(i>=56320&&i<=57343&&t>=2){let s=p.cca(e,t-2),r=s??-1;if(r>=55296&&r<=56319)return t-2}return t-1}let n=t-1;for(;n>0&&t-n<4;){let s=p.cca(e,n),r=s??-1;if(r<128||r>191)break;--n}return n}static utf8Length(e){return e>=240?4:e>=224?3:e>=192?2:1}}J["loreline.Chars"]=D,D.__name__="loreline.Chars";class Wi{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 Si{constructor(){this.continuedKeyIndent=-1,this.closedDoBrace=!1,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=Ue.rtrim(e)+`
26
+ //<END>`,this.inputText=e,this.input=e,this.index=0,this.output=new Et,this.lineOutput=new Et,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.doBraces=[],this.closedDoBrace=!1,this.continuedKeyIndent=-1,this.processInput(),Ue.rtrim(this.output.b)+`
27
+ `}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=p.cca(this.input,this.index),s=n??-1;if(s==34)this.processString();else if(s==39)this.error(new U("Use double quotes for text, not single quotes",null));else if(s==47){let r=p.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 if(s>=128)this.processNonAsciiCharacter();else{let r;if(Q.isPart(s)&&this.index>0){let a=this.index,h;if(a>0){let o=D.stringStartBefore(this.input,a);h=Q.isPart(D.stringCodeAt(this.input,o))}else h=!1;r=!h}else r=!1;if(r)if(s==97){let a,h=p.cca(this.input,this.index+1);if((h??-1)==110){let o=p.cca(this.input,this.index+2);a=(o??-1)==100}else a=!1;a&&!Q.isPart(D.stringCodeAt(this.input,this.index+3))&&!this.isAfterDot()?(this._add(38,!0),this._add(38,!0),this._add(32,!0)):this._add(s,!0)}else if(s==111){let a=p.cca(this.input,this.index+1);(a??-1)==114&&!Q.isPart(D.stringCodeAt(this.input,this.index+2))&&!this.isAfterDot()?(this._add(124,!0),this._add(124,!0),this._add(32,!0)):this._add(s,!0)}else{let a;if(s==105){let h=p.cca(this.input,this.index+1);a=(h??-1)==115}else a=!1;if(a&&!Q.isPart(D.stringCodeAt(this.input,this.index+2))&&!this.isAfterDot()){let h=this.index+2;for(;;){let g,_=p.cca(this.input,h);if((_??-1)!=32){let d=p.cca(this.input,h);g=(d??-1)==9}else g=!0;if(!g)break;++h}let o,u,c=p.cca(this.input,h);if((c??-1)==110){let g=p.cca(this.input,h+1);u=(g??-1)==111}else u=!1;if(u){let g=p.cca(this.input,h+2);o=(g??-1)==116}else o=!1;if(o&&!Q.isPart(D.stringCodeAt(this.input,h+3)))for(this._add(33,!0),this._add(61,!0);this.index<h+3;)this._add(32,!0);else this._add(61,!0),this._add(61,!0)}else{let h,o;if(s==110){let u=p.cca(this.input,this.index+1);o=(u??-1)==111}else o=!1;if(o){let u=p.cca(this.input,this.index+2);h=(u??-1)==116}else h=!1;h&&!Q.isPart(D.stringCodeAt(this.input,this.index+3))&&!this.isAfterDot()?(this._add(33,!0),this._add(32,!0),this._add(32,!0)):this._add(s,!0)}}else this._add(s,!0)}}if(e==-1)for(;this.stack.length>0&&(this.stack[this.stack.length-1]==3||this.stack[this.stack.length-1]==4);){let n=this.stack.pop();this.indentStack.pop(),n==3&&(this.currentPosOffset++,this.output.b+=String.fromCodePoint(32),this.posOffsets.push(this.currentPosOffset),this.currentPosOffset++,this.output.b+=String.fromCodePoint(125),this.posOffsets.push(this.currentPosOffset))}}processString(){this.inString=!0,this._add(34,!0);let e=!1;for(;this.index<this.length;){let t=p.cca(this.input,this.index),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=p.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++):Q.isStart(D.stringCodeAt(this.input,this.index))?(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(new U("Expected name or { after $",null))}else this._add(l,!0)}this.error(new U("Unterminated string",null))}processComplexInterpolation(){this.processInput(125)}processFieldAccessInterpolation(){Q.isStart(D.stringCodeAt(this.input,this.index))||this.error(new U("Expected name in field access",null)),this.processIdentifier();e:for(;this.index<this.length;){let e=p.cca(this.input,this.index);switch(e??-1){case 40:this._add(40,!0),this.processInput(41),this._add(41,!0);break;case 46:if(this.index+1<this.length&&Q.isStart(D.stringCodeAt(this.input,this.index+1)))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&&Q.isPart(D.stringCodeAt(this.input,this.index));){let e=D.stringUnitsAt(this.input,this.index),t=0,l=e;for(;t<l;){let i=t++,n=p.cca(this.input,this.index);this._add(n??-1,!0)}}}isDigit(e){return e>=48?e<=57:!1}codeAt(e){return D.stringCodeAt(this.input,e)}unitsAt(e){return D.stringUnitsAt(this.input,e)}isNameStartAt(e){return Q.isStart(D.stringCodeAt(this.input,e))}isNamePartAt(e){return Q.isPart(D.stringCodeAt(this.input,e))}isNamePartBefore(e){if(e>0){let t=D.stringStartBefore(this.input,e);return Q.isPart(D.stringCodeAt(this.input,t))}else return!1}isNamePartBeforeIn(e,t){return t>0?Q.isPart(D.stringCodeAt(e,D.stringStartBefore(e,t))):!1}processNonAsciiCharacter(){let e=D.stringCodeAt(this.input,this.index),t;if(Q.isStart(e))t=!1;else{let s;if(Q.isPart(e)){let r=this.index;if(r>0){let a=D.stringStartBefore(this.input,r);s=Q.isPart(D.stringCodeAt(this.input,a))}else s=!1}else s=!1;t=!s}t&&this.error(Q.unexpectedCharacterMessage(e));let l=D.stringUnitsAt(this.input,this.index),i=0,n=l;for(;i<n;){let s=i++,r=p.cca(this.input,this.index);this._add(r??-1,!0)}}processComment(){this.inComment=!0;let e=p.cca(this.input,this.index+1),t=e??-1;if(t==47)for(this._add(32,!0),this._add(32,!0);this.index<this.length;){let l=p.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=p.cca(this.input,this.index),i=l??-1,n;if(i==42&&this.index+1<this.length){let s=p.cca(this.input,this.index+1);n=(s??-1)==47}else n=!1;if(n){this._add(32,!0),this._add(32,!0);break}else 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=Ue.rtrim(e),i=l.length,n;if(i>0){let s=p.cca(l,i-1);n=(s??-1)==t}else n=!1;return n}isWholeConditionInParens(e){if(!this.followsWithChar(40,e))return!1;let t=e;for(;;){let r;if(t<this.length){let a=p.cca(this.input,t);r=(a??-1)!=40}else r=!1;if(!r)break;++t}let l=0;for(;t<this.length;){let r=p.cca(this.input,t),a=r??-1;if(a==34)for(++t;;){let h;if(t<this.length){let u=p.cca(this.input,t);h=(u??-1)!=34}else h=!1;if(!h)break;let o=p.cca(this.input,t);(o??-1)==92&&++t,++t}else if(a==40)++l;else if(a==41&&(--l,l==0))break;++t}if(t>=this.length)return!0;for(++t;;){let r;if(t<this.length){let a=p.cca(this.input,t);if((a??-1)!=32){let h=p.cca(this.input,t);r=(h??-1)==9}else r=!0}else r=!1;if(!r)break;++t}if(t>=this.length)return!0;let i=p.cca(this.input,t),n=i??-1,s;if(t+1<this.length){let r=p.cca(this.input,t+1);s=r??-1}else s=0;switch(n){case 47:return s!=47?s==42:!0;case 33:case 37:case 38:case 42:case 43:case 45:case 46:case 60:case 61:case 62:case 63:case 91:case 124:return!1;case 97:let r;if(s==110&&t+2<this.length){let a=p.cca(this.input,t+2);r=(a??-1)==100}else r=!1;return!(r&&!Q.isPart(D.stringCodeAt(this.input,t+3)));case 105:return!(s==115&&!Q.isPart(D.stringCodeAt(this.input,t+2)));case 111:return!(s==114&&!Q.isPart(D.stringCodeAt(this.input,t+2)));default:return!0}}followsWithChar(e,t){let l=t,i=!1;for(;l<this.length;){let n=p.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=p.cca(this.input,l+1),a=r??-1;if(a==47){for(l+=2;;){let h,o;if(l<this.length){let u=p.cca(this.input,l);o=(u??-1)!=13}else o=!1;if(o){let u=p.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=p.cca(this.input,l);if((o??-1)==42){let u=p.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=Ue.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(`
28
+ `,t);s==-1&&(s=this.length);let r=this.input,a=s!=null?r.substring(t,s):r.substring(t),h=Ue.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){return this.followsWithWord("if",e)}followsWithWord(e,t){let l=t;for(;l<this.length;){let i=p.cca(this.input,l),n=i??-1;if(n==32||n==9||n==10||n==13){++l;continue}if(n==47&&l+1<this.length){let r=p.cca(this.input,l+1),a=r??-1;if(a==47){for(l+=2;;){let h,o;if(l<this.length){let u=p.cca(this.input,l);o=(u??-1)!=13}else o=!1;if(o){let u=p.cca(this.input,l);h=(u??-1)!=10}else h=!1;if(!h)break;++l}continue}if(a==42){for(l+=2;l+1<this.length;){let h,o=p.cca(this.input,l);if((o??-1)==42){let u=p.cca(this.input,l+1);h=(u??-1)==47}else h=!1;if(h){l+=2;break}++l}continue}}let s=e.length;if(l+s<=this.length){let r=!0,a=0,h=s;for(;a<h;){let o=a++,u=p.cca(this.input,l+o);if((u??-1)!=p.cca(e,o)){r=!1;break}}if(r&&(l+s>=this.length||!Q.isPart(D.stringCodeAt(this.input,l+s))))return!0}return!1}return!1}endsWithControlKeyword(e,t){let l=Ue.rtrim(e);if(l.length==0)return!1;let i=0,n=Si.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=a==0||!(a>0&&Q.isPart(D.stringCodeAt(l,D.stringStartBefore(l,a)))),o=t,u=o<this.length&&(r>0||!Q.isPart(D.stringCodeAt(this.input,o)));if(h&&u&&(s!="else"||!this.followsWithIf(t)))return!0}}return!1}endsWithWord(e,t){let l=Ue.rtrim(e);if(!l.endsWith(t))return!1;let i=l.length-t.length;return i!=0?!(i>0&&Q.isPart(D.stringCodeAt(l,D.stringStartBefore(l,i)))):!0}endsWithArrayIndexable(e){let t=e.length;if(t==0)return!1;let l=t-1;for(;l>=0;){let s=p.cca(e,l),r=s??-1;if(!this.isWhitespace(r))break;--l}if(l<0)return!1;let i=p.cca(e,l),n=i??-1;if(n==41||n==125||n==93)return!0;{let s=l+1;return s>0?Q.isPart(D.stringCodeAt(e,D.stringStartBefore(e,s))):!1}}lineIndentOf(e){return e.length-Ue.ltrim(e).length}isWhitespace(e){return e==32||e==10||e==9?!0:e==13}isAfterDot(){let e=this.index-1;for(;;){let t;if(e>=0){let l=p.cca(this.input,e);if((l??-1)!=32){let i=p.cca(this.input,e);t=(i??-1)==9}else t=!0}else t=!1;if(!t)break;--e}if(e>=0){let t=p.cca(this.input,e);return(t??-1)==46}else return!1}inStatementsBlock(){let e=this.stack.length-1;return e>=0?this.stack[e]==2||this.stack[e]==3?!0:this.stack[e]==4:!0}inObjectBlock(){let e=this.stack.length-1;for(;e>=0;){if(this.stack[e]!=3&&this.stack[e]!=4)return this.stack[e]==0;--e}return!1}inArrayBlock(){let e=this.stack.length-1;for(;e>=0;){if(this.stack[e]!=3&&this.stack[e]!=4)return this.stack[e]==1;--e}return!1}isLabelStart(e){e=this.skipWhitespaceAndComments(e);let t=p.cca(this.input,e);if((t??-1)==34){for(++e;;){let o;if(e<this.length){let f=p.cca(this.input,e);o=(f??-1)!=34}else o=!1;if(!o)break;let u=p.cca(this.input,e);(u??-1)==92&&++e;let c=p.cca(this.input,e);if((c??-1)==10)return!1;++e}if(e>=this.length)return!1;for(++e;;){let o;if(e<this.length){let u=p.cca(this.input,e);o=this.isWhitespace(u??-1)}else o=!1;if(!o)break;++e}if(e<this.length){let o=p.cca(this.input,e);return(o??-1)==58}else return!1}if(!Q.isStart(D.stringCodeAt(this.input,e)))return!1;let l=e,i=this.input,n=e;for(;Q.isPart(D.stringCodeAt(i,n));)n+=D.stringUnitsAt(i,n);for(e=n;;){let o;if(e<this.length){let u=p.cca(this.input,e);o=this.isWhitespace(u??-1)}else o=!1;if(!o)break;++e}let s;if(e<this.length){let o=p.cca(this.input,e);s=(o??-1)!=58}else s=!0;if(s)return!1;let r=this.input,a=e-l;return(a!=null?p.substr(r,l,a):p.substr(r,l,null))!="case"}skipWhitespaceAndComments(e){let t=e,l=!1;for(;e<this.length;){for(;;){let i;if(e<this.length){let n,s,r=p.cca(this.input,e);if((r??-1)!=32){let a=p.cca(this.input,e);s=(a??-1)==9}else s=!0;if(s)n=!0;else{let a=p.cca(this.input,e);n=(a??-1)==10}if(n)i=!0;else{let a=p.cca(this.input,e);i=(a??-1)==13}}else i=!1;if(!i)break;++e,l=!0}if(e<this.length-1){let i=p.cca(this.input,e);if((i??-1)==47){let n=p.cca(this.input,e+1);if((n??-1)==47)return e=t,e;{let s=p.cca(this.input,e+1);if((s??-1)==42){e+=2,l=!0;let r=!1;for(;e<this.length-1;){let a,h=p.cca(this.input,e);if((h??-1)==42){let o=p.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&&e==123&&this.inControlWithoutParens&&this.stack.length>0&&this.stack[this.stack.length-1]==6&&!this.isLabelStart(this.index)&&(this.inControlWithoutParens=!1,this.stack.pop(),this.currentPosOffset++,this.lineOutput.b+=String.fromCodePoint(41),this.output.b+=String.fromCodePoint(41),this.posOffsets.push(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(new U("Unexpected end of line",null)),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;this.lineOutput=new Et;let i=this.endsWithChar(l,125)&&(this.followsWithWord("else",this.index)||this.followsWithWord("catch",this.index)||this.closedDoBrace&&this.followsWithWord("while",this.index));if(this.closedDoBrace=!1,this.inStatementsBlock()||this.inObjectBlock()||this.inArrayBlock()){let n=this.nextLineIndentOffset(l,this.index),s=Ue.trim(l).length>0&&this.inObjectBlock()&&this.endsWithChar(l,58);if(!s&&Ue.trim(l).length>0&&this.continuedKeyIndent>=0&&(n+=this.lineIndentOf(l)-this.continuedKeyIndent,this.continuedKeyIndent=-1),Ue.trim(l).length!=0)if(s)this.continuedKeyIndent=this.lineIndentOf(l);else if(n>0&&!this.endsOrFollowsWithChar(l,123,this.index,{fileName:"src/loreline/CodeToLorscript.hx",lineNumber:1287,className:"loreline.CodeToLorscript",methodName:"_add"})&&!this.endsOrFollowsWithChar(l,91,this.index,{fileName:"src/loreline/CodeToLorscript.hx",lineNumber:1287,className:"loreline.CodeToLorscript",methodName:"_add"})){let r=Ue.ltrim(l);r.startsWith("case ")||r.startsWith("case ")||r=="default"||r.startsWith("default ")||r.startsWith("default ")?(this.stack.push(4),this.indentLevel+=n,this.indentStack.push(this.indentLevel),this.currentPosOffset++,this.output.b+=String.fromCodePoint(58),this.posOffsets.push(this.currentPosOffset)):(this.stack.push(3),this.indentLevel+=n,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(n<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:1316,className:"loreline.CodeToLorscript",methodName:"_add"})&&(this.currentPosOffset++,this.output.b+=String.fromCodePoint(59),this.posOffsets.push(this.currentPosOffset)),this.indentLevel+=n;let r=!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 a=this.stack.pop();this.indentStack.pop(),a==3&&(r&&(r=!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 n<0&&this.stack.length>0&&this.stack[this.stack.length-1]==2&&!i&&!this.endsOrFollowsWithChar(l,59,this.index,{fileName:"src/loreline/CodeToLorscript.hx",lineNumber:1341,className:"loreline.CodeToLorscript",methodName:"_add"})?(this.currentPosOffset++,this.output.b+=String.fromCodePoint(59),this.posOffsets.push(this.currentPosOffset)):n==0&&!i&&!this.endsOrFollowsWithChar(l,59,this.index,{fileName:"src/loreline/CodeToLorscript.hx",lineNumber:1347,className:"loreline.CodeToLorscript",methodName:"_add"})&&!this.endsOrFollowsWithChar(l,44,this.index,{fileName:"src/loreline/CodeToLorscript.hx",lineNumber:1347,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.isWholeConditionInParens(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),e==40&&this.stack.push(6)),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(new U("Unexpected: {token}",{token:")"}));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(new U("Unexpected: {token}",{token:"]"}))}else if(e==123)this.isLabelStart(this.index)?this.stack.push(0):(this.stack.push(2),this.endsWithWord(this.lineOutput.b,"do")&&this.doBraces.push(this.stack.length));else if(e==125){let l=Ue.rtrim(this.lineOutput.b);if(this.stack.length>0&&this.stack[this.stack.length-1]==2&&l.length>0){let n=p.cca(l,l.length-1),s=n??-1;s!=59&&s!=123&&s!=125&&(this.currentPosOffset++,this.output.b+=String.fromCodePoint(59),this.posOffsets.push(this.currentPosOffset))}this.closedDoBrace=this.doBraces.length>0&&this.doBraces[this.doBraces.length-1]==this.stack.length,this.closedDoBrace&&this.doBraces.pop();let i=this.stack.pop();i!=2&&i!=0&&this.error(new U("Unexpected: {token}",{token:"}"}))}this.lineOutput.b+=String.fromCodePoint(e),this.output.b+=String.fromCodePoint(e),this.posOffsets.push(this.currentPosOffset)}}error(e){throw y.thrown(st.of(e,ge.fromContentAndIndex(this.inputText,this.index)))}}J["loreline.CodeToLorscript"]=Si,Si.__name__="loreline.CodeToLorscript",Object.assign(Si.prototype,{__class__:Si});class Hl{static equal(e,t,l){if(t==null||l==null)return t==null?l==null:!1;if(typeof t=="string"||typeof l=="string")return typeof t=="string"&&typeof l=="string"?t==l:!1;let i=he.typeof(t),n=he.typeof(l);switch(i._hx_index){case 1:case 2:switch(n._hx_index){case 1:case 2:return i._hx_index==1,t==(n._hx_index==1,l);case 3:return!1;default:return!1}break;case 3:switch(n._hx_index){case 1:case 2:return!1;case 3:return t==l;default:return!1}break;default:switch(n._hx_index){case 1:case 2:case 3:return!1;default:}}if(t==l)return!0;if(se.isArray(t))return se.isArray(l)?Hl.arrayEqual(e,t,l):!1;if(t instanceof Ce)return l instanceof Ce?Hl.stringMapEqual(e,t,l):!1;if(t instanceof Xl)return l instanceof Xl?Hl.intMapEqual(e,t,l):!1;if(Qe.beatOf(t)!=null||Qe.beatOf(l)!=null){let s=Qe.beatOf(t),r=Qe.beatOf(l);return s!=null&&r!=null?s==r:!1}else if(rt.characterOf(t)!=null||rt.characterOf(l)!=null){let s=rt.fieldsOf(t),r=rt.fieldsOf(l);return s==r}else if(G.isFields(t))return G.isFields(l)?Hl.objectFieldsEqual(e,t,l):!1;return!1}static objectFieldsEqual(e,t,l){let i=0,n=G.getFields(e,t);for(;i<n.length;){let a=n[i];if(++i,!G.fieldExists(e,l,a)||!Hl.equal(e,G.getField(e,t,a),G.getField(e,l,a)))return!1}let s=0,r=G.getFields(e,l);for(;s<r.length;){let a=r[s];if(++s,!G.fieldExists(e,t,a))return!1}return!0}static arrayEqual(e,t,l){let i=se.arrayLength(t),n=se.arrayLength(l);if(i!=n)return!1;let s=0,r=i;for(;s<r;){let a=s++;if(!Hl.equal(e,se.arrayGet(t,a),se.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 g=s[a++],_=g,d=n[g],m=_,k=d;if(!Object.prototype.hasOwnProperty.call(l.h,m)||!Hl.equal(e,l.h[m],k))return!1}let h=l.h,o=h,u=Object.keys(h),c=u.length,f=0;for(;f<c;){let g=u[f++];if(!Object.prototype.hasOwnProperty.call(t.h,g))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,c=h;if(!l.h.hasOwnProperty(u)||!Hl.equal(e,l.h[u],c))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"]=Hl,Hl.__name__="loreline.Equal";class st{constructor(e,t){this.params=null,this.template=null,this.filePath=null,this.message=e,this.pos=t,this.stack=Qn.callStack()}keep(e){return this.template=e.template,this.params=e.params,this}toString(){return this.pos!=null?""+this.message+" at "+this.pos.toString():this.message}static of(e,t){return new st(e.toString(),t).keep(e)}}J["loreline.Error"]=st,st.__name__="loreline.Error",Object.assign(st.prototype,{__class__:st});class ti{}J["loreline.Fields"]=Jl.loreline.Fields=ti,ti.__name__="loreline.Fields",ti.__isInterface__=!0,Object.assign(ti.prototype,{__class__:ti});class pi{constructor(e){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_decimal=Te(this,this.random_decimal),e.h.wait=Te(this,this.wait),e.h.number=Te(this,this.number),e.h.string=Te(this,this.string_),e.h.bool=Te(this,this.bool),e.h.type_of=Te(this,this.type_of),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);let t=this,l=Ei.make(function(i){return t.plural(i[0],i.slice(1))});e.h.plural=l,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(){let e=this.interpreter.context;e.random==null&&(e.random=new yi);let t=e.random;return(t.seed=t.seed*16807%2147483647)/2147483647+233e-12}floor(e){return Math.floor(z.numberArg(e,"floor"))}ceil(e){return Math.ceil(z.numberArg(e,"ceil"))}round(e){return Math.floor(z.numberArg(e,"round")+.5)}abs(e){return Math.abs(z.numberArg(e,"abs"))}min(e,t){return pi.smaller(z.numberArg(e,"min"),z.numberArg(t,"min"))}max(e,t){return pi.larger(z.numberArg(e,"max"),z.numberArg(t,"max"))}clamp(e,t,l){return pi.larger(z.numberArg(t,"clamp"),pi.smaller(z.numberArg(l,"clamp"),z.numberArg(e,"clamp")))}pow(e,t){return pi.power(z.numberArg(e,"pow"),z.numberArg(t,"pow"))}random(e,t){let l=z.numberArg(e,"random"),i=z.numberArg(t,"random");if(l>i){let n=l;l=i,i=n}return l=Math.ceil(l),i=Math.floor(i),i<l&&(i=l),Math.floor(l+this.rng()*(i+1-l))}randomInt(e,t){return Math.floor(e+this.rng()*(t+1-e))}chance(e){let t=z.numberArg(e,"chance"),l=this.rng();return t<=1?!0:Math.floor(l*t)==0}seed_random(e){return this.interpreter.seedRandom(e==null?null:z.numberArg(e,"seed_random")),null}random_decimal(e,t){let l=z.numberArg(e,"random_decimal"),i=z.numberArg(t,"random_decimal");return l+this.rng()*(i-l)}wait(e){let t=z.numberArg(e,"wait");return new Ti(function(l){Ai.delay(l,t*1e3|0)})}number(e){if(e==null)return 0;if(typeof e=="string"){let l=z.numberOfText(e);return isNaN(l)?0:l}let t=he.typeof(e);switch(t._hx_index){case 1:case 2:let l=e;return t._hx_index==1,l;case 3:return e?1:0;default:return 0}}string_(e){return z.textOf(e,this.interpreter)}bool(e){return z.isTruthy(e)}type_of(e){return z.typeOf(e)}string_length(e){return je.length(z.textArg(e,"string_length"))}string_upper(e){return je.upper(z.textArg(e,"string_upper"))}string_lower(e){return je.lower(z.textArg(e,"string_lower"))}string_contains(e,t){let l=z.textArg(e,"string_contains"),i=z.textArg(t,"string_contains");return l.includes(i)}string_replace(e,t,l){let i=z.textArg(e,"string_replace"),n=z.textArg(t,"string_replace"),s=z.textArg(l,"string_replace");return n.length==0?je.chars(i).join(s):Ue.replace(i,n,s)}string_split(e,t){let l=z.textArg(e,"string_split"),i=z.textArg(t,"string_split");return i.length==0?je.chars(l):l.split(i)}string_trim(e){return Ue.trim(z.textArg(e,"string_trim"))}string_index(e,t){return je.indexOf(z.textArg(e,"string_index"),z.textArg(t,"string_index"))}string_sub(e,t,l){let i=z.textArg(e,"string_sub"),n=Math.floor(z.numberArg(t,"string_sub"))|0;return l==null?je.sub(i,n):je.sub(i,n,Math.floor(z.numberArg(l,"string_sub"))|0)}string_starts(e,t){let l=z.textArg(e,"string_starts"),i=z.textArg(t,"string_starts");return l.startsWith(i)}string_ends(e,t){let l=z.textArg(e,"string_ends"),i=z.textArg(t,"string_ends");return l.endsWith(i)}string_repeat(e,t){let l=z.textArg(e,"string_repeat"),i=Math.floor(z.numberArg(t,"string_repeat")),n="",s=0;for(;s<i;)n+=l==null?"null":""+l,++s;return n}plural(e,t){let l=[],i=[],n=0;for(;n<t.length;){let a=t[n],h;switch(he.typeof(a)._hx_index){case 1:case 2:h=!0;break;default:h=!1}h&&n+1<t.length?(i.push({at:a,form:t[n+1]}),n+=2):(i.length==0&&l.push(a),++n)}let s;switch(he.typeof(e)._hx_index){case 1:case 2:s=e;break;default:s=typeof e=="string"?z.numberOfText(e):NaN}if(!isNaN(s)){let a=null,h=0;for(;h<i.length;){let o=i[h];++h,o.at<=s&&(a==null||o.at>=a.at)&&(a=o)}if(a!=null)return z.textArg(a.form,"plural")}if(l.length==0&&i.length>0){let a=i[0],h=0;for(;h<i.length;){let o=i[h];++h,o.at<a.at&&(a=o)}return z.textArg(a.form,"plural")}let r=isNaN(s)?typeof e!="boolean"&&z.equals(e,1)?0:1:ki.formIndex(this.interpreter!=null?this.interpreter.pluralLanguage():null,s,l.length);return r>=l.length&&(r=l.length-1),z.textArg(r>=0?l[r]:null,"plural")}array_length(e){return se.isArray(e)?se.arrayLength(e):0}array_add(e,t){return se.isArray(e)&&se.arrayPush(e,t),null}array_pop(e){return se.isArray(e)?se.arrayPop(e):null}array_prepend(e,t){return se.isArray(e)&&se.arrayInsert(e,0,t),null}array_shift(e){return se.isArray(e)?se.arrayShift(e):null}array_remove(e,t){if(se.isArray(e)){let l=se.arrayLength(e),i=0,n=l;for(;i<n;){let s=i++;if(z.equals(se.arrayGet(e,s),t))return se.arrayRemoveAt(e,s),!0}}return!1}array_index(e,t){if(se.isArray(e)){let l=se.arrayLength(e),i=0,n=l;for(;i<n;){let s=i++;if(z.equals(se.arrayGet(e,s),t))return s}}return-1}array_has(e,t){if(se.isArray(e)){let l=se.arrayLength(e),i=0,n=l;for(;i<n;){let s=i++;if(z.equals(se.arrayGet(e,s),t))return!0}}return!1}array_sort(e){if(se.isArray(e)){let t=se.arrayLength(e),l=[],i=0,n=t;for(;i<n;){let a=i++,h=se.arrayGet(e,a),o=he.typeof(h),u;switch(o._hx_index){case 1:case 2:u=0;break;default:u=typeof h=="string"?1:2}let c;if(u==0){let f=h;c=(o._hx_index==1,f)}else c=0;l.push({value:h,rank:u,number:c,index:a})}l.sort(function(a,h){if(a.rank!=h.rank)return a.rank<h.rank?-1:1;if(a.rank==0){if(a.number<h.number)return-1;if(a.number>h.number)return 1}if(a.rank==1){let o=a.value,u=h.value;if(o!=u)return o<u?-1:1}return a.index<h.index?-1:a.index>h.index?1:0});let s=0,r=t;for(;s<r;){let a=s++;se.arraySet(e,a,l[a].value)}}return e}array_reverse(e){return se.isArray(e)&&se.arrayReverse(e),e}array_join(e,t){if(se.isArray(e)){let l=z.textArg(t,"array_join"),i="",n=0,s=se.arrayLength(e);for(;n<s;){let r=n++;r>0&&(i+=l==null?"null":""+l),i+=oe.string(z.textOf(se.arrayGet(e,r),this.interpreter))}return i}return""}array_pick(e){if(se.isArray(e)){let t=se.arrayLength(e);if(t==0)return null;let l=Math.floor(this.rng()*t);return se.arrayGet(e,l)}return null}array_shuffle(e){if(se.isArray(e)){let t=se.arrayLength(e)-1;for(;t>0;){let l=Math.floor(this.rng()*(t+1)),i=se.arrayGet(e,t);se.arraySet(e,t,se.arrayGet(e,l)),se.arraySet(e,l,i),--t}}return e}array_copy(e){return se.isArray(e)?se.arrayCopy(e):e}map_length(e){return G.isFields(e)?G.getFields(this.interpreter,e).length:0}map_keys(e){if(!G.isFields(e))return[];let t=G.getFields(this.interpreter,e);return t.sort(function(l,i){return l<i?-1:l>i?1:0}),t}map_has(e,t){return G.isFields(e)?G.fieldExists(this.interpreter,e,z.textArg(t,"map_has")):!1}map_get(e,t){return G.isFields(e)?G.getField(this.interpreter,e,z.textArg(t,"map_get")):null}map_set(e,t,l){return G.isFields(e)&&G.setField(this.interpreter,e,z.textArg(t,"map_set"),l),null}map_remove(e,t){if(!G.isFields(e))return!1;let l=z.textArg(t,"map_remove");return G.fieldExists(this.interpreter,e,l)?G.removeField(this.interpreter,e,l):!1}map_copy(e){if(!G.isFields(e))return null;let t=G.getFields(this.interpreter,e),l=G.createFields(this.interpreter),i=0;for(;i<t.length;){let n=t[i];++i,G.setField(this.interpreter,l,n,G.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(Qe.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 Ae&&r.name==t)return!0}}--l}return Object.prototype.hasOwnProperty.call(this.interpreter.context.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(Qe.beatOf(e)!=null)return this.interpreter.getBeatVisitCount(Qe.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}static smaller(e,t){return isNaN(e)||isNaN(t)?NaN:e<t?e:t}static larger(e,t){return isNaN(e)||isNaN(t)?NaN:e>t?e:t}static power(e,t){return Math.pow(e,t)}}J["loreline.Functions"]=pi,pi.__name__="loreline.Functions",Object.assign(pi.prototype,{__class__:pi});class Q{static isStart(e){return e<128?e>=97&&e<=122||e>=65&&e<=90?!0:e==95:Q.inRanges(Q.START,e)}static isPart(e){return e<128?e>=97&&e<=122||e>=65&&e<=90||e==95?!0:e>=48?e<=57:!1:Q.inRanges(Q.PART,e)}static isEmoji(e){return e<8960?!1:Q.inRanges(Q.EMOJI,e)}static isLowerCase(e){return e<128?e>=97?e<=122:!1:Q.inRanges(Q.LOWER,e)}static isUpperCase(e){return e<128?e>=65?e<=90:!1:Q.inRanges(Q.UPPER,e)}static scriptOf(e){return e<128?Q.isStart(e)&&e!=95?"Latin":null:Q.inRanges(Q.LATIN,e)?"Latin":Q.inRanges(Q.GREEK,e)?"Greek":Q.inRanges(Q.CYRILLIC,e)?"Cyrillic":null}static asciiTwinOf(e){switch(e){case 8220:case 8221:case 65282:return 34;case 12289:case 65292:return 44;case 12290:return 46;case 12304:case 65339:return 91;case 12305:case 65341:return 93;case 65288:return 40;case 65289:return 41;case 65306:return 58;case 65307:return 59;case 65309:return 61;case 65371:return 123;case 65373:return 125;default:return-1}}static unexpectedCharacterMessage(e){let t=Q.asciiTwinOf(e),l=D.textOf(e);return t!=-1?new U('"{text}" looks like "{twin}" but is a different character',{text:l,twin:String.fromCodePoint(t)}):new U("Unexpected character: {text}",{text:l})}static inRanges(e,t){let l=0,i=(e.length>>1)-1;for(;l<=i;){let n=l+i>>1;if(t<e[n*2])i=n-1;else if(t>e[n*2+1])l=n+1;else return!0}return!1}static tables(){return[Q.START,Q.PART,Q.EMOJI,Q.LOWER,Q.UPPER,Q.LATIN,Q.GREEK,Q.CYRILLIC]}}J["loreline.Identifiers"]=Q,Q.__name__="loreline.Identifiers";class on{constructor(e){this.finished=e}}J["loreline._Imports.ImportsLoopInfo"]=on,on.__name__="loreline._Imports.ImportsLoopInfo",Object.assign(on.prototype,{__class__:on});class Dl{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 c=e.length;if(c<8)s=!1;else{let f,g,_,d,m,k,C=p.cca(e,c-8);if((C??-1)==46){let T=p.cca(e,c-7),S=T??-1;k=S==108||S==76}else k=!1;if(k){let T=p.cca(e,c-6),S=T??-1;m=S==111||S==79}else m=!1;if(m){let T=p.cca(e,c-5),S=T??-1;d=S==114||S==82}else d=!1;if(d){let T=p.cca(e,c-4);_=(T??-1)==46}else _=!1;if(_){let T=p.cca(e,c-3),S=T??-1;g=S==116||S==84}else g=!1;if(g){let T=p.cca(e,c-2),S=T??-1;f=S==120||S==88}else f=!1;if(f){let T=p.cca(e,c-1),S=T??-1;s=S==116||S==84}else s=!1}}this.ext=s?".lor.txt":".lor";let r=new Ce,a=[],h=new Ce,o=nt.directory(e),u=Dl.rootImportPath(e);h.h[u]=!0,this.extractImports(o,t,a,h),this.processImports(a,h,r)}processImports(e,t,l){let i=new on(!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 Bt(r),h=a.tokenize(),o=a.getErrors();o!=null&&o.length>0&&(o[0].filePath==null&&(o[0].filePath=e),s.handleError(o[0])),n.h[e]=h,s.extractImports(nt.directory(e),h,l,i),t.finished&&s.processImports(l,i,n)}catch(a){let h=y.caught(a).unwrap();if(s.hasErrors=!0,h instanceof st){let o=h;o.filePath==null&&(o.filePath=e),s.handleError(o)}else throw y.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==x.KwImport){let r=n+1;for(;r<s-1&&Dl.isComment(t[r].type);)++r;let a=t[r].type;if(a._hx_index==18){let h=a.quotes,o=a.attachments,u=a.s,c=Dl.resolveImportPath(e,u,this.ext);Object.prototype.hasOwnProperty.call(i.h,c)||(this.pendingImports++,i.h[c]=!0,l.push(c))}}++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=p.cca(e,t-8);if((h??-1)==46){let o=p.cca(e,t-7),u=o??-1;a=u==108||u==76}else a=!1;if(a){let o=p.cca(e,t-6),u=o??-1;r=u==111||u==79}else r=!1;if(r){let o=p.cca(e,t-5),u=o??-1;s=u==114||u==82}else s=!1;if(s){let o=p.cca(e,t-4);n=(o??-1)==46}else n=!1;if(n){let o=p.cca(e,t-3),u=o??-1;i=u==116||u==84}else i=!1;if(i){let o=p.cca(e,t-2),u=o??-1;l=u==120||u==88}else l=!1;if(l){let o=p.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=p.cca(e,t-4);if((n??-1)==46){let s=p.cca(e,t-3),r=s??-1;i=r==108||r==76}else i=!1;if(i){let s=p.cca(e,t-2),r=s??-1;l=r==111||r==79}else l=!1;if(l){let s=p.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=p.cca(e,l-8);if((o??-1)==46){let u=p.cca(e,l-7),c=u??-1;h=c==108||c==76}else h=!1;if(h){let u=p.cca(e,l-6),c=u??-1;a=c==111||c==79}else a=!1;if(a){let u=p.cca(e,l-5),c=u??-1;r=c==114||c==82}else r=!1;if(r){let u=p.cca(e,l-4);s=(u??-1)==46}else s=!1;if(s){let u=p.cca(e,l-3),c=u??-1;n=c==116||c==84}else n=!1;if(n){let u=p.cca(e,l-2),c=u??-1;i=c==120||c==88}else i=!1;if(i){let u=p.cca(e,l-1),c=u??-1;t=c==116||c==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=p.cca(e,l-8);if((o??-1)==46){let u=p.cca(e,l-7),c=u??-1;h=c==108||c==76}else h=!1;if(h){let u=p.cca(e,l-6),c=u??-1;a=c==111||c==79}else a=!1;if(a){let u=p.cca(e,l-5),c=u??-1;r=c==114||c==82}else r=!1;if(r){let u=p.cca(e,l-4);s=(u??-1)==46}else s=!1;if(s){let u=p.cca(e,l-3),c=u??-1;n=c==116||c==84}else n=!1;if(n){let u=p.cca(e,l-2),c=u??-1;i=c==120||c==88}else i=!1;if(i){let u=p.cca(e,l-1),c=u??-1;t=c==116||c==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=p.cca(e,l-4);if((s??-1)==46){let r=p.cca(e,l-3),a=r??-1;n=a==108||a==76}else n=!1;if(n){let r=p.cca(e,l-2),a=r??-1;i=a==111||a==79}else i=!1;if(i){let r=p.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=p.cca(e,i-8);if((u??-1)==46){let c=p.cca(e,i-7),f=c??-1;o=f==108||f==76}else o=!1;if(o){let c=p.cca(e,i-6),f=c??-1;h=f==111||f==79}else h=!1;if(h){let c=p.cca(e,i-5),f=c??-1;a=f==114||f==82}else a=!1;if(a){let c=p.cca(e,i-4);r=(c??-1)==46}else r=!1;if(r){let c=p.cca(e,i-3),f=c??-1;s=f==116||f==84}else s=!1;if(s){let c=p.cca(e,i-2),f=c??-1;n=f==120||f==88}else n=!1;if(n){let c=p.cca(e,i-1),f=c??-1;t=f==116||f==84}else t=!1}}if(t){let i=e.length-8;return i!=null?p.substr(e,0,i):p.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=p.cca(e,i-4);if((r??-1)==46){let a=p.cca(e,i-3),h=a??-1;s=h==108||h==76}else s=!1;if(s){let a=p.cca(e,i-2),h=a??-1;n=h==111||h==79}else n=!1;if(n){let a=p.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?p.substr(e,0,i):p.substr(e,0,null)}return e}static resolveImportPath(e,t,l){let i=t;nt.isAbsolute(i)||(i=nt.join([e,i])),i=nt.normalize(i);let n,s;if(i==null)s=!1;else{let r=i.length;if(r<8)s=!1;else{let a,h,o,u,c,f,g=p.cca(i,r-8);if((g??-1)==46){let _=p.cca(i,r-7),d=_??-1;f=d==108||d==76}else f=!1;if(f){let _=p.cca(i,r-6),d=_??-1;c=d==111||d==79}else c=!1;if(c){let _=p.cca(i,r-5),d=_??-1;u=d==114||d==82}else u=!1;if(u){let _=p.cca(i,r-4);o=(_??-1)==46}else o=!1;if(o){let _=p.cca(i,r-3),d=_??-1;h=d==116||d==84}else h=!1;if(h){let _=p.cca(i,r-2),d=_??-1;a=d==120||d==88}else a=!1;if(a){let _=p.cca(i,r-1),d=_??-1;s=d==116||d==84}else s=!1}}if(s)n=!0;else if(i==null)n=!1;else{let r=i.length;if(r<4)n=!1;else{let a,h,o=p.cca(i,r-4);if((o??-1)==46){let u=p.cca(i,r-3),c=u??-1;h=c==108||c==76}else h=!1;if(h){let u=p.cca(i,r-2),c=u??-1;a=c==111||c==79}else a=!1;if(a){let u=p.cca(i,r-1),c=u??-1;n=c==114||c==82}else n=!1}}return n||(i+=l),i}static rootImportPath(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=p.cca(e,l-8);if((o??-1)==46){let u=p.cca(e,l-7),c=u??-1;h=c==108||c==76}else h=!1;if(h){let u=p.cca(e,l-6),c=u??-1;a=c==111||c==79}else a=!1;if(a){let u=p.cca(e,l-5),c=u??-1;r=c==114||c==82}else r=!1;if(r){let u=p.cca(e,l-4);s=(u??-1)==46}else s=!1;if(s){let u=p.cca(e,l-3),c=u??-1;n=c==116||c==84}else n=!1;if(n){let u=p.cca(e,l-2),c=u??-1;i=c==120||c==88}else i=!1;if(i){let u=p.cca(e,l-1),c=u??-1;t=c==116||c==84}else t=!1}}return Dl.resolveImportPath("",e,t?".lor.txt":".lor")}static isComment(e){switch(e._hx_index){case 54:let t=e.content;return!0;case 55:let l=e.content;return!0;default:return!1}}}J["loreline.Imports"]=Dl,Dl.__name__="loreline.Imports",Object.assign(Dl.prototype,{__class__:Dl});class Gl{constructor(){this.mask=0,this.size=0,this._used=null,this._values=null,this._keys2=null,this._keys1=null;let e=this._keys1,t=this._keys2,l=this._values,i=this._used;this._keys1=new Array(16),this._keys2=new Array(16),this._values=new Array(16),this._used=new Array(16);let n=0,s=16;for(;n<s;){let r=n++;this._used[r]=!1}if(this.mask=15,e!=null){this.size=0;let r=0,a=e.length;for(;r<a;){let h=r++;i[h]&&this._set(e[h],t[h],l[h])}}}resize(e){let t=this._keys1,l=this._keys2,i=this._values,n=this._used;this._keys1=new Array(e),this._keys2=new Array(e),this._values=new Array(e),this._used=new Array(e);let s=0,r=e;for(;s<r;){let a=s++;this._used[a]=!1}if(this.mask=e-1,t!=null){this.size=0;let a=0,h=t.length;for(;a<h;){let o=a++;n[o]&&this._set(t[o],l[o],i[o])}}}isUsed(e){return this._used[e]}hashCoords(e,t){let l=e^t>>>16^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,this._used=null;let e=this._keys1,t=this._keys2,l=this._values,i=this._used;this._keys1=new Array(16),this._keys2=new Array(16),this._values=new Array(16),this._used=new Array(16);let n=0,s=16;for(;n<s;){let r=n++;this._used[r]=!1}if(this.mask=15,e!=null){this.size=0;let r=0,a=e.length;for(;r<a;){let h=r++;i[h]&&this._set(e[h],t[h],l[h])}}this.size=0}copy(){let e=new Gl,t=this._keys1,l=new Array(t.length);Ln.blit(t,0,l,0,t.length),e._keys1=l;let i=this._keys2,n=new Array(i.length);Ln.blit(i,0,n,0,i.length),e._keys2=n;let s=this._values,r=new Array(s.length);Ln.blit(s,0,r,0,s.length),e._values=r;let a=this._used,h=new Array(a.length);return Ln.blit(a,0,h,0,a.length),e._used=h,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,u=this._used;this._keys1=new Array(r),this._keys2=new Array(r),this._values=new Array(r),this._used=new Array(r);let c=0,f=r;for(;c<f;){let g=c++;this._used[g]=!1}if(this.mask=r-1,a!=null){this.size=0;let g=0,_=a.length;for(;g<_;){let d=g++;u[d]&&this._set(a[d],h[d],o[d])}}}let i=e^t>>>16^t<<16;i=(i^i>>>16)*-2048144789,i=(i^i>>>13)*-1028477387;let s=(i^i>>>16)&this.mask;for(;;){if(!this._used[s]){this._keys1[s]=e,this._keys2[s]=t,this._values[s]=l,this._used[s]=!0,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^t<<16;l=(l^l>>>16)*-2048144789,l=(l^l>>>13)*-1028477387;let n=(l^l>>>16)&this.mask;for(;;){if(!this._used[n])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^t<<16;l=(l^l>>>16)*-2048144789,l=(l^l>>>13)*-1028477387;let n=(l^l>>>16)&this.mask;for(;;){if(!this._used[n])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^t<<16;l=(l^l>>>16)*-2048144789,l=(l^l>>>13)*-1028477387;let n=(l^l>>>16)&this.mask;for(;;){if(!this._used[n])return!1;if(this._keys1[n]==e&&this._keys2[n]==t){for(this._values[n]=null,this._used[n]=!1,this.size--,n=n+1&this.mask;this._used[n];){let s=this._keys1[n],r=this._keys2[n],a=this._values[n];this._values[n]=null,this._used[n]=!1,this.size--,this._set(s,r,a),n=n+1&this.mask}return!0}n=n+1&this.mask}}iterator(){return new un(this)}keyIterator(){return new cn(this)}keyValueIterator(){return new pn(this)}length(){return this.size}}J["loreline.Int64Map"]=Gl,Gl.__name__="loreline.Int64Map",Object.assign(Gl.prototype,{__class__:Gl});class un{constructor(e){for(this.map=e,this.index=0;this.index<this.map._values.length&&!this.map._used[this.index];)this.index++}skipNulls(){for(;this.index<this.map._values.length&&!this.map._used[this.index];)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._used[this.index];)this.index++;return e}}J["loreline._Int64Map.Int64MapIterator"]=un,un.__name__="loreline._Int64Map.Int64MapIterator",Object.assign(un.prototype,{__class__:un});class cn{constructor(e){for(this.map=e,this.index=0;this.index<this.map._values.length&&!this.map._used[this.index];)this.index++}skipNulls(){for(;this.index<this.map._values.length&&!this.map._used[this.index];)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._used[this.index];)this.index++;return{high:e,low:t}}}J["loreline._Int64Map.Int64MapKeyIterator"]=cn,cn.__name__="loreline._Int64Map.Int64MapKeyIterator",Object.assign(cn.prototype,{__class__:cn});class pn{constructor(e){for(this.map=e,this.index=0;this.index<this.map._values.length&&!this.map._used[this.index];)this.index++}skipNulls(){for(;this.index<this.map._values.length&&!this.map._used[this.index];)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._used[this.index];)this.index++;return{key:{high:e,low:t},value:l}}}J["loreline._Int64Map.Int64MapKeyValueIterator"]=pn,pn.__name__="loreline._Int64Map.Int64MapKeyValueIterator",Object.assign(pn.prototype,{__class__:pn});class Yt{constructor(e,t,l,i){Yt._hx_skip_constructor||this._hx_constructor(e,t,l,i)}_hx_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=G.createFields(e,null,t)}createOriginalFields(){this.originalFields=G.createFields()}}J["loreline.RuntimeState"]=Yt,Yt.__name__="loreline.RuntimeState",Object.assign(Yt.prototype,{__class__:Yt});class Vi extends Yt{constructor(e,t,l,i){Yt._hx_skip_constructor=!0,super(),Yt._hx_skip_constructor=!1,this._hx_constructor(e,t,l,i)}_hx_constructor(e,t,l,i){this.characterRef=null,super._hx_constructor(e,t,l,i)}}J["loreline.RuntimeCharacter"]=Vi,Vi.__name__="loreline.RuntimeCharacter",Vi.__super__=Yt,Object.assign(Vi.prototype,{__class__:Vi});var cl=it["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,ref:e,__enum__:"loreline.RuntimeAccess",toString:F}},w._hx_name="BeatAccess",w.__params__=["pos","ref"],w),MetadataAccess:(w=function(b){return{_hx_index:5,pos:b,__enum__:"loreline.RuntimeAccess",toString:F}},w._hx_name="MetadataAccess",w.__params__=["pos"],w)};cl.__constructs__=[cl.FieldAccess,cl.ArrayAccess,cl.CharacterAccess,cl.FunctionAccess,cl.BeatAccess,cl.MetadataAccess];class Fi{constructor(e,t,l,i,n,s,r,a,h){this.shuffle=null,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),h!=null&&(this.shuffle=h)}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"]=Fi,Fi.__name__="loreline.RuntimeScope",Object.assign(Fi.prototype,{__class__:Fi});class Qe{constructor(e,t){this.beat=e,this.stack=t}static beatOf(e){return e instanceof Ae?e:e instanceof Qe?e.beat:null}static beatNameOf(e){let t=Qe.beatOf(e);return t!=null?t.name:null}}J["loreline.RuntimeBeatRef"]=Jl.loreline.RuntimeBeatRef=Qe,Qe.__name__="loreline.RuntimeBeatRef",Object.assign(Qe.prototype,{__class__:Qe});class rt{constructor(e,t){this.name=e,this.character=t}get_fields(){return this.character.fields}static characterOf(e){return e instanceof rt?e:null}static characterNameOf(e){let t=rt.characterOf(e);return t!=null?t.name:null}static fieldsOf(e){let t=rt.characterOf(e);return t!=null?t.get_fields():e}}J["loreline.RuntimeCharacterRef"]=Jl.loreline.RuntimeCharacterRef=rt,rt.__name__="loreline.RuntimeCharacterRef",Object.assign(rt.prototype,{__class__:rt,__properties__:{get_fields:"get_fields"}});class qi{constructor(e,t){this.whenSalient=!1,this.whenFirst=!1,this.parentNextRuleIndex=0,this.parentPartialRules=null,this.rules=null,this.kind=0,this.parentNextOptionIndex=0,this.parentPartialOptions=null,this.stack=[],this.options=null,this.id=e,this.origin=t}isCollected(){return this.options==null?this.rules!=null:!0}}J["loreline.RuntimeInsertion"]=qi,qi.__name__="loreline.RuntimeInsertion",Object.assign(qi.prototype,{__class__:qi});class fn{constructor(e,t){this.name=e,this.text=t}}J["loreline.WhenIndexText"]=fn,fn.__name__="loreline.WhenIndexText",Object.assign(fn.prototype,{__class__:fn});class gn{constructor(e,t,l){this.fact=e,this.groups=t,this.ungrouped=l}}J["loreline.WhenRunIndex"]=gn,gn.__name__="loreline.WhenRunIndex",Object.assign(gn.prototype,{__class__:gn});class _n{constructor(e,t,l){this.scores=e,this.clauses=t,this.runs=l}}J["loreline.WhenBlockInfo"]=_n,_n.__name__="loreline.WhenBlockInfo",Object.assign(_n.prototype,{__class__:_n});class dn{constructor(e,t,l,i){this.end=e,this.pure=t,this.byScore=l,this.index=i}}J["loreline.WhenSalientRun"]=dn,dn.__name__="loreline.WhenSalientRun",Object.assign(dn.prototype,{__class__:dn});class Ki{constructor(e,t,l){this.closing=e,this.value=t,this.offset=l}}J["loreline.TextTag"]=Ki,Ki.__name__="loreline.TextTag",Object.assign(Ki.prototype,{__class__:Ki});class Yi{constructor(e,t,l,i,n){this.text=e,this.tags=t,this.enabled=l,this.node=i,this.insertion=n}}J["loreline.ChoiceOption"]=Yi,Yi.__name__="loreline.ChoiceOption",Object.assign(Yi.prototype,{__class__:Yi});class _e extends st{constructor(e,t){super(e,t)}static of(e,t){let l=new _e(e.toString(),t);return l.keep(e),l}static at(e,t){let l=new _e(e.message,t);return l.template=e.template,l.params=e.params,l}}J["loreline.RuntimeError"]=_e,_e.__name__="loreline.RuntimeError",_e.__super__=st,Object.assign(_e.prototype,{__class__:_e});class mn{constructor(){this.cb=null,this.sync=!0}}J["loreline.EvalNext"]=mn,mn.__name__="loreline.EvalNext",Object.assign(mn.prototype,{__class__:mn});class xn{constructor(e,t){this.pendingInsertionsCache=null,this.pendingSavedInsertions=null,this.pendingRestoredKeys=null,this.pendingRestoredFlows=null,this.children=[],this.root=null,this.nextInsertionId=1,this.missingExternalFunctions=[],this.scriptFunctions=[],this.random=null,this.nodeStates=new Fl,this.topLevelBeats=new Ce,this.topLevelCharacters=new Ce,this.topLevelState=null,this.whenBlocks=new Fl,this.whenIndexTexts=new Fl,this.constantStrings=new Ui,this.userStringProcessors=!1,this.stringLiteralProcessors=[],this.sourceLanguageRead=!1,this.sourceLanguage=null,this.lineLanguage=null,this.inLine=!1,this.script=e,this.lens=new El(e);let l=t!=null?t.strictAccess:null;this.strictAccess=l!=null&&l,this.translations=t!=null?t.translations:null,this.hostFunctions=t!=null?t.functions:null,this.customCreateFields=t!=null?t.customCreateFields:null}childByKey(e){let t=0,l=this.children;for(;t<l.length;){let i=l[t];if(++t,i.key==e)return i}return null}removePendingFlow(e){if(this.pendingRestoredFlows==null)return null;let t=this.pendingRestoredFlows.h[e];if(t==null)return null;let l=this.pendingRestoredFlows;return Object.prototype.hasOwnProperty.call(l.h,e)&&delete l.h[e],p.remove(this.pendingRestoredKeys,e),this.pendingRestoredKeys.length==0&&this.clearPendingFlows(),t}clearPendingFlows(){this.pendingRestoredFlows=null,this.pendingRestoredKeys=null,this.pendingSavedInsertions=null,this.pendingInsertionsCache=null}}J["loreline.InterpreterContext"]=xn,xn.__name__="loreline.InterpreterContext",Object.assign(xn.prototype,{__class__:xn});class Rt{constructor(e,t,l,i,n,s){if(this._restoreInsertionsCache=null,this._restoreSavedInsertions=null,this._serializingScopes=[],this._saveInsertions=null,this._choiceEvalEnabled=[],this._choiceEvalTexts=[],this.pendingDialogue=null,this.pendingChoiceOptions=null,this.beatToResume=null,this.finishTrigger=null,this.flushing=!1,this.syncCallbacks=[],this.nextScopeId=1,this.stack=[],this.beatHelpers=new Ce,this.mapHelpers=new Ce,this.arrayHelpers=new Ce,this.stringHelpers=new Ce,this.topLevelFunctions=new Ce,this.finished=!1,this.disposed=!1,this.key=null,this.handleDialogue=t,this.handleChoice=l,this.handleFinish=i,s!=null){this.context=s;let a=n!=null?n.customCreateFields:null;this.customCreateFields=a??this.context.customCreateFields;let h=n!=null?n.functions:null;this.bindFunctions(h??this.context.hostFunctions);return}this.context=new xn(e,n),this.context.root=this,this.customCreateFields=this.context.customCreateFields,this.context.topLevelState=new Yt(this,e,null,null),this.bindFunctions(this.context.hostFunctions),this.initializeStringLiteralProcessors(n!=null?n.stringLiteralProcessors:null);let r=e.iterator();for(;r.hasNext();){let a=r.next();switch(le.getClass(a)){case Ae:this.initializeTopLevelBeat(a);break;case Zt:this.initializeTopLevelCharacter(a);break;case si:this.initializeTopLevelFunction(a);break;case Kt:this.initializeTopLevelState(a);break;default:}}this.inferImplicitCharactersFromRootBeat(),(n!=null?n.prepareCaches:null)==!0&&this.prepareCaches()}isRoot(){return this.context.root==this}get_script(){return this.context.script}get_translations(){return this.context.translations}set_translations(e){return this.context.translations=e}get_topLevelState(){return this.context.topLevelState}get_topLevelCharacters(){return this.context.topLevelCharacters}get_topLevelBeats(){return this.context.topLevelBeats}get_nodeStates(){return this.context.nodeStates}get_stringLiteralProcessors(){return this.context.stringLiteralProcessors}set_stringLiteralProcessors(e){return this.context.userStringProcessors=!0,this.context.constantStrings.h={__keys__:{}},this.context.whenIndexTexts.map.clear(),this.context.whenBlocks.map.clear(),this.context.stringLiteralProcessors=e}get_lens(){return this.context.lens}get_strictAccess(){return this.context.strictAccess}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}}get_nextInsertionId(){return this.context.nextInsertionId}set_nextInsertionId(e){return this.context.nextInsertionId=e}prepareCaches(){this.context.lens.prepareCaches();let e=0,t=this.context.lens.getWhenStatements();for(;e<t.length;){let l=t[e];++e,this.whenBlockInfoOf(l)}}inferImplicitCharactersFromRootBeat(){let e=0,t=this.context.lens.getDefaultBeats();for(;e<t.length;){let l=t[e];++e;let i=0,n=this.context.lens.getDialogueSpeakers(l);for(;i<n.length;){let s=n[i];++i,!Object.prototype.hasOwnProperty.call(this.context.topLevelCharacters.h,s)&&(G.fieldExists(this,this.context.topLevelState.fields,s)||this.initializeTopLevelCharacter(new Zt(We.UNDEFINED,l.pos,s,l.pos,[])))}}}start(e){this.attachBeforeRun();let t=null;if(e!=null){if(t=this.context.topLevelBeats.h[e],t==null)throw y.thrown(_e.of(new U("Beat {name} not found",{name:e}),this.context.script.pos))}else{let l=0,i=this.context.script.body;for(;l<i.length;){let n=i[l];if(++l,n instanceof Ae){let s=n;if(s.name=="_"){t=s;break}t==null&&(t=s)}}if(t==null){let n=this.context.script.iterator();for(;n.hasNext();){let s=n.next();if(s instanceof Ae){let r=s;if(r.name=="_"){t=r;break}t==null&&(t=r)}}}if(t==null)throw y.thrown(_e.of(new U("No beats found in script",null),this.context.script.pos))}this.transitionToBeat(t),this.flush()}seedRandom(e){this.context.random=new yi(e)}save(){if(!this.isRoot())return this.context.root.save();let e={};this._saveInsertions=e;let t=[],l=0,i=this.stack;for(;l<i.length;){let c=i[l];++l,t.push(this.serializeScope(c,e))}let n={version:1,stack:t,state:this.serializeState(this.context.topLevelState),characters:this.serializeCharacters(),nodeStates:this.serializeNodeStates()};this.context.random!=null&&(n.random=this.context.random.seed);let s=this.serializePendingChoiceOptions(this,e);s!=null&&(n.pendingChoiceOptions=s);let r=this.serializePendingDialogue(this);r!=null&&(n.pendingDialogue=r);let a=this.serializeChoiceEvalContext(this);a!=null&&(n.choiceEvalContext=a);let h=[],o=0,u=this.context.children;for(;o<u.length;){let c=u[o];if(++o,c.stack.length==0)continue;let f=c.key,g=[],_=0,d=c.stack;for(;_<d.length;){let S=d[_];++_,g.push(this.serializeScope(S,e))}let m={key:f,stack:g},k=this.serializePendingChoiceOptions(c,e);k!=null&&(m.pendingChoiceOptions=k);let C=this.serializePendingDialogue(c);C!=null&&(m.pendingDialogue=C);let T=this.serializeChoiceEvalContext(c);T!=null&&(m.choiceEvalContext=T),h.push(m)}return h.length>0&&(n.children=h,this.finished&&this.stack.length==0&&(n.finished=!0)),Le.fields(e).length>0&&(n.insertions=e),this._saveInsertions=null,n}serializePendingChoiceOptions(e,t){if(e.pendingChoiceOptions==null)return null;let l=[],i=0,n=e.pendingChoiceOptions;for(;i<n.length;){let s=n[i];++i,l.push(this.serializeChoiceOption(s,t))}return l}serializePendingDialogue(e){let t=e.pendingDialogue;if(t==null)return null;let l={node:this.serializeNodeReference(t.node),text:t.text};if(t.character!=null&&(l.character=t.character),t.tags!=null&&t.tags.length>0){let i=[],n=0,s=t.tags;for(;n<s.length;){let r=s[n];++n,i.push(this.serializeTextTag(r))}l.tags=i}return l}serializeChoiceEvalContext(e){if(e._choiceEvalTexts.length==0)return null;let t=[],l=0,i=e._choiceEvalTexts.length;for(;l<i;){let n=l++,s={text:e._choiceEvalTexts[n]};e._choiceEvalEnabled[n]||(s.disabled=!0),t.push(s)}return t}restore(e){if(!this.isRoot())throw y.thrown(new _e("restore() can only be called on a root interpreter",this.context.script.pos));if(e.version!=1)throw y.thrown(_e.of(new U("Unsupported save version: {version}",{version:e.version}),this.context.script.pos));let t=0,l=this.context.children.slice();for(;t<l.length;){let s=l[t];++t,s.dispose()}if(this.context.clearPendingFlows(),this.context.nodeStates.map.clear(),this.finished=e.finished==!0,this.context.nextInsertionId=1,e.insertions!=null){let s=0,r=Le.fields(e.insertions);for(;s<r.length;){let a=r[s];++s;let h=oe.parseInt(a);h!=null&&h>=this.context.nextInsertionId&&(this.context.nextInsertionId=h+1)}}let i=new Xl;this._restoreSavedInsertions=e.insertions,this._restoreInsertionsCache=i,this.restoreState(this.context.topLevelState,e.state),this.restoreCharacters(e.characters),this.restoreNodeStates(e.nodeStates);let n=e.random;if(n!=null&&(this.context.random=new yi(n)),this.restoreFlow(e.stack,e.pendingChoiceOptions,e.pendingDialogue,e.choiceEvalContext,e.insertions,i),e.children!=null&&e.children.length>0){this.context.pendingRestoredFlows=new Ce,this.context.pendingRestoredKeys=[];let s=0,r=e.children;for(;s<r.length;){let a=r[s];++s,!(a.key==null||Object.prototype.hasOwnProperty.call(this.context.pendingRestoredFlows.h,a.key))&&(this.context.pendingRestoredFlows.h[a.key]=a,this.context.pendingRestoredKeys.push(a.key))}this.context.pendingSavedInsertions=e.insertions,this.context.pendingInsertionsCache=i}this._restoreSavedInsertions=null,this._restoreInsertionsCache=null}restoreFlow(e,t,l,i,n,s){this.stack.length=0,this.nextScopeId=1,this.pendingChoiceOptions=null,this.pendingDialogue=null,this._choiceEvalTexts.length=0,this._choiceEvalEnabled.length=0;let r=this._restoreSavedInsertions,a=this._restoreInsertionsCache;if(this._restoreSavedInsertions=n,this._restoreInsertionsCache=s,this.restoreStack(e,n,s)||(this.beatToResume=this.restoreBeatToResume(e)),t!=null){this.pendingChoiceOptions=[];let h=0;for(;h<t.length;){let o=t[h];++h;let u=this.restoreChoiceOption(o,n,s);u!=null&&this.pendingChoiceOptions.push(u)}}if(l!=null&&l.node!=null){let h=this.context.lens.getNodeById(We.fromString(l.node.id));if(h!=null&&h.type()==l.node.type){let o=l.character,u=l.text,c;if(l.tags!=null){let f=[],g=0,_=l.tags;for(;g<_.length;){let d=_[g];++g,f.push(new Ki(d.closing==!0,d.value,d.offset))}c=f}else c=[];this.pendingDialogue={node:h,character:o,text:u,tags:c}}}if(i!=null){let h=0;for(;h<i.length;){let o=i[h];++h,this._choiceEvalTexts.push(o.text),this._choiceEvalEnabled.push(o.disabled!=!0)}}this._restoreSavedInsertions=r,this._restoreInsertionsCache=a}resume(){if(this.stack.length==0&&this.finished&&this.isRoot()){this.finish();return}if(this.stack.length==0){this.start();return}this.attachBeforeRun();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}spawn(e,t,l,i,n){this.checkSpawnKey(e);let s=this.context.childByKey(e);return s?.dispose(),this.context.removePendingFlow(e),this.createChild(e,t,l,i,n)}resumeSpawn(e,t,l,i,n){this.checkSpawnKey(e);let s=this.context.pendingSavedInsertions,r=this.context.pendingInsertionsCache,a=this.context.removePendingFlow(e);if(a==null)throw y.thrown(new _e("No saved interpreter to resume with key: "+e,this.context.script.pos));let h=this.context.childByKey(e);h?.dispose();let o=this.createChild(e,t,l,i,n);return o.restoreFlow(a.stack,a.pendingChoiceOptions,a.pendingDialogue,a.choiceEvalContext,s,r),o}resumableSpawnKeys(){return this.context.pendingRestoredKeys!=null?this.context.pendingRestoredKeys.slice():[]}dispose(){if(this.isRoot())throw y.thrown(new _e("Cannot dispose a root interpreter",this.context.script.pos));this.disposed||(this.disposed=!0,this.stack.length=0,this.syncCallbacks=[],this.finishTrigger=null,this.beatToResume=null,this.pendingChoiceOptions=null,this.pendingDialogue=null,this._choiceEvalTexts.length=0,this._choiceEvalEnabled.length=0,p.remove(this.context.children,this))}checkSpawnKey(e){if(e==null||e.length==0)throw y.thrown(new _e("A key is required to spawn an interpreter",this.context.script.pos))}createChild(e,t,l,i,n){let s=t,r=l,a=i,h=new Rt(this.context.script,s??this.handleDialogue,r??this.handleChoice,a??this.handleFinish,n,this.context);return h.key=e,this.context.children.push(h),h}attachBeforeRun(){if(this.disposed)throw y.thrown(new _e("Cannot run a disposed interpreter (key: "+this.key+")",this.context.script.pos));if(this.isRoot()){this.finished=!1;return}if(this.context.children.indexOf(this)==-1){if(this.context.childByKey(this.key)!=null)throw y.thrown(new _e("Another interpreter is already running with key: "+this.key,this.context.script.pos));this.context.children.push(this)}}getCharacter(e){let t=this.context.topLevelCharacters.h[e];return t!=null?t.fields:null}getCharacterField(e,t){let l=this.context.topLevelCharacters.h[e],i=l!=null?l.fields:null;return i!=null?this.hostValueOf(G.getField(this,i,t)):null}setCharacterField(e,t,l){let i=this.context.topLevelCharacters.h[e].fields;G.setField(this,i,t,this.hostValueToRuntime(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}}hostValueOf(e){let t=rt.characterOf(e);if(t!=null)return{type:"$characterRef",name:t.name};let l=Qe.beatOf(e);return l!=null?{type:"$beatRef",beat:this.serializeBeatReference(l)}:e}hostValueToRuntime(e){return this.hostValueToRuntimeDepth(e,0)}hostValueToRuntimeDepth(e,t){if(e==null||typeof e=="string"||typeof e=="number"||typeof e=="number"&&(e|0)===e||typeof e=="boolean"||t>=Rt.HOST_VALUE_MAX_DEPTH||rt.characterOf(e)!=null||Qe.beatOf(e)!=null)return e;if(se.isArray(e)){let l=se.arrayLength(e),i=0,n=l;for(;i<n;){let s=i++,r=se.arrayGet(e,s),a=this.hostValueToRuntimeDepth(r,t+1);a!=r&&se.arraySet(e,s,a)}return e}if(G.isFields(e)){let l=G.getField(this,e,"type");if(l!=null&&typeof l=="string"){let s=l;if(s=="$characterRef"){let r=G.getField(this,e,"name");if(r!=null&&typeof r=="string"&&Object.prototype.hasOwnProperty.call(this.context.topLevelCharacters.h,r)){let a=this.context.topLevelCharacters.h[r];return a.characterRef==null&&(a.characterRef=new rt(r,a)),a.characterRef}}else if(s=="$beatRef"){let r=null,a=G.getField(this,e,"beat");if(a!=null&&G.isFields(a)&&(r=G.getField(this,a,"path")),r==null&&(r=G.getField(this,e,"name")),r!=null&&typeof r=="string"){let h=this.context.lens.findBeatByPathFromNode(r,this.context.script);if(h!=null)return new Qe(h,[])}}}let i=G.getFields(this,e),n=0;for(;n<i.length;){let s=i[n];++n;let r=G.getField(this,e,s),a=this.hostValueToRuntimeDepth(r,t+1);a!=r&&G.setField(this,e,s,a)}}return e}getStateField(e){return this.hostValueOf(this.getStateFieldRaw(e))}getStateFieldRaw(e){let t=!1,l=null,i=this;return this.eachResolutionScope(-1,function(n){if(n.state!=null&&G.fieldExists(i,n.state.fields,e))return l=G.getField(i,n.state.fields,e),t=!0,!0;if(n.node!=null){let s=n.node.id.thisVal,r=i.context.nodeStates.map._get(s.high,s.low);if(r!=null&&G.fieldExists(i,r.fields,e))return l=G.getField(i,r.fields,e),t=!0,!0}return!1}),t?l:G.fieldExists(this,this.context.topLevelState.fields,e)?G.getField(this,this.context.topLevelState.fields,e):null}setStateField(e,t){t=this.hostValueToRuntime(t);let l=!1,i=this;this.eachResolutionScope(-1,function(n){if(n.state!=null&&G.fieldExists(i,n.state.fields,e))return G.setField(i,n.state.fields,e,t),l=!0,!0;if(n.node!=null){let s=n.node.id.thisVal,r=i.context.nodeStates.map._get(s.high,s.low);if(r!=null&&G.fieldExists(i,r.fields,e))return G.setField(i,r.fields,e,t),l=!0,!0}return!1}),!l&&G.setField(this,this.context.topLevelState.fields,e,t)}getTopLevelStateField(e){return this.hostValueOf(G.getField(this,this.context.topLevelState.fields,e))}setTopLevelStateField(e,t){G.setField(this,this.context.topLevelState.fields,e,this.hostValueToRuntime(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.context.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 e.shuffle!=null&&(l.shuffle=e.shuffle.slice()),this._serializingScopes.pop(),l}serializeInsertion(e,t){let l=e.id==null?"null":""+e.id,i=Le.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}if(e.kind==1&&(i.kind="when"),e.rules!=null){let n=[],s=0,r=e.rules;for(;s<r.length;){let a=r[s];++s,n.push(this.serializeWhenCandidate(a,t))}i.rules=n}if(e.parentPartialRules!=null){let n=[],s=0,r=e.parentPartialRules;for(;s<r.length;){let a=r[s];++s,n.push(this.serializeWhenCandidate(a,t))}i.parentPartialRules=n,i.parentNextRuleIndex=e.parentNextRuleIndex}e.whenFirst&&(i.whenFirst=!0),e.whenSalient&&(i.whenSalient=!0)}return e.id}serializeWhenCandidate(e,t){let l={node:this.serializeNodeReference(e.rule)};return e.eligible&&(l.eligible=!0),e.insertion!=null&&(l.insertion=this.serializeInsertion(e.insertion,t)),l}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.context.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,c=this.serializeCharacter(u);Le.fields(c.fields).length>0&&(e[o]=c)}return e}serializeNodeStates(){let e={},t=this.context.nodeStates.map,l=0;for(;l<t._values.length&&!t._used[l];)++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._used[l];)++l;let r=We.fromTwoInt32(i,n),a=s,h=r,o=a,u=this.serializeState(o);(G.getFields(this,o.originalFields).length>0||Le.fields(u.fields).length>0)&&(e[h.toString()]=u)}return e}serializeBeatReference(e){let t=e.name,l=e;do l=this.context.lens.getFirstParentOfType(l,Ae),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(le.__implements(e,ti)){let n=le.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 Ce){let n=e,s=n.h,r=s,a=Object.keys(s),h=a.length,o=0;for(;o<h;){let u=a[o++],c=n.h[u];(t==null||!G.fieldExists(this,t,u)||!Hl.equal(this,G.getField(this,t,u),c))&&(i[u]=this.serializeValue(c))}}else if(le.getClass(e)==null){let n=0,s=Le.fields(e);for(;n<s.length;){let r=s[n];++n;let a=Le.field(e,r);(t==null||!G.fieldExists(this,t,r)||!Hl.equal(this,G.getField(this,t,r),a))&&(i[r]=this.serializeValue(a))}}else{let n=le.getClass(e);n!=null&&(l=n.__name__);let s=0,r=Le.fields(e);for(;s<r.length;){let a=r[s];++s;let h=Le.getProperty(e,a);(t==null||!G.fieldExists(this,t,a)||!Hl.equal(this,G.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(se.isArray(e)){let i=[],n=se.arrayLength(e),s=0,r=n;for(;s<r;){let a=s++;i.push(this.serializeValue(se.arrayGet(e,a)))}return i}let t=Qe.beatOf(e);if(t!=null){let i={type:"$beatRef",beat:this.serializeBeatReference(t)};if(e instanceof Qe){let n=e;if(n.stack.length>0){let s=!1,r=0,a=n.stack;for(;r<a.length;){let h=a[r];if(++r,this._serializingScopes.indexOf(h)!=-1){s=!0;break}}if(!s){let h=this._saveInsertions!=null?this._saveInsertions:{},o=[],u=0,c=n.stack;for(;u<c.length;){let f=c[u];++u,o.push(this.serializeScope(f,h))}i.stack=o}}}return i}let l=rt.characterOf(e);return l!=null?{type:"$characterRef",name:l.name}:this.serializeFields(e)}resumeNode(e,t,l){let i=this.stack.length-1;if(t>=this.stack.length)switch(le.getClass(e)){case hi:this.evalAlternative(e,l);break;case oi:this.evalBeatCall(e,l);break;case zt:if(!this.isBeatCall(e))this.evalCall(e,l);else{let r=le.getClass(e);throw y.thrown(new _e("Resume execution not supported from last node: "+r.__name__,e.pos))}break;case Vl:this.evalChoice(e,l);break;case Jt:this.evalDialogue(e,l);break;case fl:this.evalText(e,l);break;default:let s=le.getClass(e);throw y.thrown(new _e("Resume execution not supported from last node: "+s.__name__,e.pos))}else switch(le.getClass(e)){case hi:this.resumeAlternative(e,t,l);break;case oi:this.resumeBeatCall(e,t,l);break;case Ae:this.resumeBeatRun(e,t,l);break;case zt:if(this.isBeatCall(e,t))this.resumeCall(e,t,l);else{let r=le.getClass(e);throw y.thrown(new _e("Resume execution not supported from node within stack: "+r.__name__,e.pos))}break;case Dt:this.resumeChoiceOption(e,t,l);break;case Vl:this.resumeChoice(e,t,l);break;case ql:this.resumeIf(e,t,l);break;case fi:this.resumeWhen(e,t,l);break;default:let s=le.getClass(e);throw y.thrown(new _e("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 y.thrown(new _e("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 y.thrown(new _e("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.isCollected())o.pop(),i();else if(s!=-1&&s==r){let u=l[s];s+=1;let c=o.wrapNext(h);o.resumeNode(u,t+1,c.cb),c.sync=!1}else if(s<l.length){let u=l[s];o.stack[t].head=u,s+=1;let c=o.wrapNext(h);o.evalNode(u,c.cb),c.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 Dt){let s=i.head,r=function(){n.pop(),l()};t+1<this.stack.length?this.resumeNodeBody(s,t+1,s.body,r):this.evalNodeBody(i.beat,s,s.body,null,null,null,null,r)}else if(i.insertion!=null&&i.insertion.kind==0){let s=i.node,r=i.insertion;if(s instanceof Ae){let a=s,h=!0,o=0,u=t;for(;o<u;){let c=o++;if(this.stack[c].insertion!=null){h=!1;break}}this.resumeNodeBody(a,t,a.body,function(){let c=r.parentPartialOptions!=null?r.parentPartialOptions:[];if(r.options!=null){let d=0,m=r.options;for(;d<m.length;){let k=m[d];++d,c.push(k)}}let f=r.parentNextOptionIndex,g=i.beat,_=n.wrapNext(function(){n.presentChoice(e,c,l)});n.evalChoiceOptionsAndInsertions(g,e,c,_.cb,f,h),_.sync=!1})}else{for(;this.stack.length>t;)this.pop();this.evalChoice(e,l)}}else if(i.node instanceof Dt){let s=i.node;this.resumeNodeBody(s,t,s.body,l)}else if(i.node instanceof Ae){let s=i.node;this.resumeNodeBody(s,t,s.body,l)}else throw y.thrown(new _e("Choice head is not a choice option",i.head.pos))}resumeIf(e,t,l){let i=this.stack[t];if(i.head==null)throw y.thrown(new _e("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 y.thrown(new _e("Failed to resume condition: invalid scope",e.pos))}resumeWhen(e,t,l){let i=this.stack[t],n=this;if(i.head instanceof xi){let a=i.head,h=function(){n.pop(),l()};t+1<this.stack.length?this.resumeNodeBody(a,t+1,a.body,h):(this.recordWhenRulePlayed(a),this.evalNodeBody(i.beat,a,a.body,null,null,null,null,h));return}if(i.insertion!=null&&i.insertion.kind==1&&i.node instanceof Ae){let a=i.insertion,h=i.node,o=this.collectingWhenInsertion(t-1);this.resumeNodeBody(h,t,h.body,function(){let u=a.parentPartialRules!=null?a.parentPartialRules:[];if(a.rules!=null){let _=0,d=a.rules;for(;_<d.length;){let m=d[_];++_,u.push(m)}}let c=o!=null?o.whenFirst:e.strategy=="first",f=o!=null?o.whenSalient:e.strategy==null,g=n.wrapNext(function(){n.finishWhenCollection(e,u,o,l)});n.collectWhenRules(e,u,a.parentNextRuleIndex,c,f,o,g.cb),g.sync=!1});return}if(i.node instanceof Ae){let a=i.node;this.resumeNodeBody(a,t,a.body,l);return}if(i.head==null)throw y.thrown(new _e("Failed to resolve head when resuming when block",e.pos));let s=0,r=e.rules;for(;s<r.length;){let a=r[s];if(++s,a.body.indexOf(i.head)!=-1){this.resumeNodeBody(a,t,a.body,l);return}}throw y.thrown(new _e("Failed to resume when block: head not found in any rule",e.pos))}resumeAlternative(e,t,l){let i=this.stack[t];if(i.head==null)throw y.thrown(new _e("Failed to resolve head when resuming alternative",e.pos));let n=this,s=0,r=e.items.length;for(;s<r;){let a=s++,h=e.items[a];if(h.body.indexOf(i.head)!=-1){let o=i.shuffle,u=o!=null?o.indexOf(a):-1;e.mode==4&&u!=-1?this.resumeNodeBody(h,t,h.body,function(){n.evalShuffledItems(e,o,u+1,l)}):this.resumeNodeBody(h,t,h.body,l);return}}throw y.thrown(new _e("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 y.thrown(new _e("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 Ae){this.resumeBeatRun(this.stack[t].node,t,l);return}throw y.thrown(new _e("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 Xl);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=We.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 d=0,m=e.beats;for(;d<m.length;){let k=m[d];++d;let C=this.restoreBeat(k);if(C==null)return null;a.push(C)}}let o=e.state!=null?this.restoreState(null,e.state):null,u=e.head,c=u!=null?this.restoreNode(u,n,i):null;if(u!=null&&c==null)return null;let f=null;e.insertion!=null&&t!=null&&(f=this.restoreInsertion(e.insertion,t,l));let g=null;if(e.captured!=null){g=[];let d=0,m=e.captured;for(;d<m.length;){let k=m[d];++d;let C=this.restoreScopeItem(k,t,l);if(C==null)return null;g.push(C)}}let _=null;return e.shuffle!=null&&r instanceof kl&&(_=this.restoreShuffleOrder(e.shuffle,r)),new Fi(null,i,r,a,o,c,f,g,_)}restoreInsertion(e,t,l){if(l.h.hasOwnProperty(e))return l.h[e];let i=e==null?"null":""+e,n=Le.field(t,i);if(n==null)return null;let s=null;if(n.origin!=null){let a=We.fromString(n.origin.id),h=this.context.lens.getNodeById(a);h!=null&&h.type()==n.origin.type&&(s=h)}let r=new qi(e,s);if(l.h[e]=r,e>=this.context.nextInsertionId&&(this.context.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 n.kind=="when"&&(r.kind=1),n.rules!=null&&(r.rules=this.restoreWhenCandidates(n.rules,t,l)),n.parentPartialRules!=null&&(r.parentPartialRules=this.restoreWhenCandidates(n.parentPartialRules,t,l),r.parentNextRuleIndex=n.parentNextRuleIndex!=null?n.parentNextRuleIndex:0),r.whenFirst=n.whenFirst==!0,r.whenSalient=n.whenSalient==!0,r}restoreWhenCandidates(e,t,l){let i=[],n=0;for(;n<e.length;){let s=e[n];++n;let r=s.node!=null?this.context.lens.getNodeById(We.fromString(s.node.id)):null;r==null||r.type()!=s.node.type||!(r instanceof xi)||i.push({rule:r,eligible:s.eligible==!0,insertion:s.insertion!=null?this.restoreInsertion(s.insertion,t,l):null})}return i}restoreChoiceOption(e,t,l){let i=null;if(e.node!=null){let r=We.fromString(e.node.id),a=this.context.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 Ki(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 Yi(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.context.lens.getFirstParentOfType(i,Ae),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=We.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 ui(r.thisVal.high&65535|o<<16,r.thisVal.low);let u=this.context.lens.getNodeById(r);return u!=null&&u.type()==e.type?u:null}restoreBeat(e){return this.context.lens.findBeatByPathFromNode(e.path,this.context.script)}restoreState(e,t){let l=e!=null?e.fields:null,i=this.restoreFields(l??null,t);return e==null&&(e=new Yt(this,null,i,null)),e}restoreCharacters(e){let t=0,l=Le.fields(e);for(;t<l.length;){let i=l[t];++t;let n=Le.field(e,i);if(Object.prototype.hasOwnProperty.call(this.context.topLevelCharacters.h,i))this.restoreCharacter(this.context.topLevelCharacters.h[i],n);else{let s=this.restoreCharacter(null,n);this.context.topLevelCharacters.h[i]=s}}}restoreNodeStates(e){let t=Object.create(null),l=0,i=this.context.lens.getNodesOfType(Kt,!0);for(;l<i.length;){let r=i[l];if(++l,r.temporary)continue;let a=this.context.lens.getParentNode(r);if(a==null||!(a instanceof Be))continue;let h=a.id.toString();Object.prototype.hasOwnProperty.call(t,h)||(t[h]=[]),t[h].push(r)}let n=0,s=Le.fields(e);for(;n<s.length;){let r=s[n];++n;let a=We.fromString(r),h=Le.field(e,r),o=t[r],u=null;if(o!=null){let f=(h!=null?h.type:null)!=null?G.createFields(this,h.type,o[0]):null;u=new Yt(this,o[0],f,null);let g=0;for(;g<o.length;){let _=o[g];++g;let d=0,m=_.fields;for(;d<m.length;){let k=m[d];if(++d,this.isOriginalScriptExpression(k.value)){let C=this.evaluateExpression(k.value);G.setField(this,u.fields,k.name,C),G.setField(this,u.originalFields,k.name,this.snapshotOriginalValue(C))}}}this.restoreState(u,h)}else u=this.restoreState(null,h);let c=a.thisVal;this.context.nodeStates.map._set(c.high,c.low,u)}}restoreCharacter(e,t){let l=e!=null?e.fields:null,i=this.restoreFields(l??null,t);return e==null&&(e=new Vi(this,null,i,null)),e}restoreFields(e,t){if(t==null||t.fields==null)return e;e==null&&(e=G.createFields(this,t.type));let l=t.fields;if(G.isFields(e)){let i=0,n=Le.fields(l);for(;i<n.length;){let s=n[i];++i,G.setField(this,e,s,this.restoreValue(Le.field(l,s)))}}else{let i=0,n=Le.fields(l);for(;i<n.length;){let s=n[i];++i,e[s]=this.restoreValue(Le.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(se.isArray(e)){let t=se.arrayLength(e),l=se.createArray(),i=0,n=t;for(;i<n;){let s=i++;se.arrayPush(l,this.restoreValue(se.arrayGet(e,s)))}return l}if(Le.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 Xl,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 Qe(l,i)}if(Le.field(e,"type")=="$characterRef"){let t=e,l=this.context.topLevelCharacters.h[t.name];return l==null?null:(l.characterRef==null&&(l.characterRef=new rt(t.name,l)),l.characterRef)}return this.restoreFields(null,e)}bindFunctions(e){if(this.builtins=new pi(this),this.builtins.bindAll(this.topLevelFunctions),e!=null){let s=e,r=s,a=Le.fields(s),h=0;for(;h<a.length;){let o=a[h++],u=r[o],f=o,g=u;this.registerTopLevelFunction(f,g)}}this.refreshFunctionHelpers();let t=0,l=this.context.scriptFunctions;for(;t<l.length;){let s=l[t];++t,this.bindScriptFunction(s)}let i=0,n=this.context.missingExternalFunctions;for(;i<n.length;){let s=n[i];if(++i,!Object.prototype.hasOwnProperty.call(this.topLevelFunctions.h,s)){let r=this.topLevelFunctions,a=Rt.missingExternalFunction(s);r.h[s]=a}}}refreshFunctionHelpers(){let e=this.topLevelFunctions.h,t=e,l=Object.keys(e),i=l.length,n=0;for(;n<i;){let s=l[n++],r=s,a=t[s],h=r,o=a;h.startsWith("string_")?this.stringHelpers.h[p.substr(h,7,null)]=o:h.startsWith("array_")?this.arrayHelpers.h[p.substr(h,6,null)]=o:h.startsWith("map_")?this.mapHelpers.h[p.substr(h,4,null)]=o:h.startsWith("beat_")&&(this.beatHelpers.h[p.substr(h,5,null)]=o)}}bindScriptFunction(e){let l=new Pn(this).execute(e.ast);this.topLevelFunctions.h[e.name]=l}registerTopLevelFunction(e,t){let l=t,i=this,n=this.topLevelFunctions,s=Ei.make(function(r){let a=[],h=0;for(;h<r.length;){let u=r[h];++h,a.push(i.hostValueOf(u))}let o=a;return l.apply(null,[i,o])});n.h[e]=s}initializeStringLiteralProcessors(e){let t=this;if(this.context.stringLiteralProcessors.push(function(l){return t.pluralPipeProcess(l)}),e!=null){let l=0;for(;l<e.length;){let i=e[l];++l,this.context.stringLiteralProcessors.push(i),this.context.userStringProcessors=!0}}}initializeTopLevelFunction(e){if(e.name!=null)if(e.external){if(!Object.prototype.hasOwnProperty.call(this.topLevelFunctions.h,e.name)){this.context.missingExternalFunctions.push(e.name);let t=this.topLevelFunctions,l=e.name,i=Rt.missingExternalFunction(e.name);t.h[l]=i,this.refreshFunctionHelpers()}}else{let t=new Si;try{let l=t.process(e.code),i=new Bi;i.allowJSON=!0,i.allowTypes=!0;let n={name:e.name,ast:i.parseString(l)};this.context.scriptFunctions.push(n),this.bindScriptFunction(n)}catch(l){let i=y.caught(l).unwrap();throw y.thrown(_e.of(new U("Failed to parse function code: {error}",{error:i}),e.pos))}}else throw y.thrown(_e.of(new U("A function outside a beat must have a name",null),e.pos))}wrapNext(e){let t=new mn;t.sync=!0;let l=this;return t.cb=function(){l.disposed||(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=y.caught(e).unwrap();throw this.flushing=!1,y.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 y.thrown(_e.of(new U("new state can only be used inside a beat",null),e.pos));let t=0,l=e.fields;for(;t<l.length;){let i=l[t];++t;let n=this.evaluateExpression(i.value);G.setField(this,this.context.topLevelState.fields,i.name,n),this.isOriginalScriptExpression(i.value)&&G.setField(this,this.context.topLevelState.originalFields,i.name,this.snapshotOriginalValue(n))}}initializeTopLevelBeat(e){if(Object.prototype.hasOwnProperty.call(this.context.topLevelBeats.h,e.name))throw y.thrown(_e.of(new U("Duplicate top level beat: {name}",{name:e.name}),e.pos));this.context.topLevelBeats.h[e.name]=e}initializeTopLevelCharacter(e){if(Object.prototype.hasOwnProperty.call(this.context.topLevelCharacters.h,e.name))throw y.thrown(_e.of(new U("Duplicate top level character: {name}",{name:e.name}),e.pos));let t=new Vi(this,e,null,null);this.context.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);G.setField(this,t.fields,n.name,s),this.isOriginalScriptExpression(n.value)&&G.setField(this,t.originalFields,n.name,this.snapshotOriginalValue(s))}}initializeState(e,t){let l=null;if(e.temporary)t.state==null&&(t.state=new Yt(this,e,null,null)),l=t.state;else{let s=t.node.id.thisVal;if(l=this.context.nodeStates.map._get(s.high,s.low),l==null){l=new Yt(this,e,null,null);let r=t.node.id.thisVal;this.context.nodeStates.map._set(r.high,r.low,l)}}let i=0,n=e.fields;for(;i<n.length;){let s=n[i];if(++i,!G.fieldExists(this,l.fields,s.name)){let r=this.evaluateExpression(s.value);G.setField(this,l.fields,s.name,r),!e.temporary&&this.isOriginalScriptExpression(s.value)&&G.setField(this,l.originalFields,s.name,this.snapshotOriginalValue(r))}}}evaluateBeatArgs(e,t,l){if(t==null||t.length==0)return null;let i=e.params!=null?e.params.length:0;if(i==0)throw y.thrown(_e.of(new U("Beat {name} takes no arguments, got {count}",{name:e.name,count:t.length}),l));if(t.length>i)throw y.thrown(_e.of(new U("Beat {name} expects at most {args}, got {count}",{name:e.name,args:qe.formatCount(i,"{n} argument","{n} arguments",null,null),count: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 Yt(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)),G.setField(this,e.state.fields,a.name,h)}}finish(){this.finishTrigger=null,this.isRoot()?this.finished=!0:p.remove(this.context.children,this),this.handleFinish!=null&&this.handleFinish(this)}transitionToBeat(e,t,l){for(;this.pop(););this.nextScopeId=1,this.pendingChoiceOptions=null,this.pendingDialogue=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(le.getClass(e)){case hi:this.evalAlternative(e,t);break;case yl:this.evalAssignment(e,t);break;case oi:this.evalBeatCall(e,t);break;case Ae:this.evalBeatDecl(e,t);break;case zt:this.evalCall(e,t);break;case Dt:this.evalChoiceOption(e,t);break;case Vl:this.evalChoice(e,t);break;case Jt:this.evalDialogue(e,t);break;case ql:this.evalIf(e,t);break;case Kt:this.evalStateDecl(e,t);break;case fl:this.evalText(e,t);break;case Bl:this.evalTransition(e);break;case fi:this.evalWhen(e,t);break;default:let l=le.getClass(e);throw y.thrown(new _e("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 y.thrown(_e.of(new U("Duplicate beat with name: {name}",{name:e.name}),e.pos));this.get_currentScope().beats.push(e),t()}evalNodeBody(e,t,l,i,n,s,r,a){this.push(new Fi(null,e,t,null,null,null,i,null,r)),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 h=0,o=null,u=this.get_currentInsertion(),c=this;o=function(){if(u!=null&&u.isCollected())c.pop(),a();else if(h<l.length){let f=l[h];c.get_currentScope().head=f,h+=1;let g=c.wrapNext(o);c.evalNode(f,g.cb),g.sync=!1}else c.pop(),a()},o()}evalBeatRun(e,t,l,i){this.incrementBeatVisitCount(e),this.evalNodeBody(e,e,e.body,null,l,i,null,t)}evalStateDecl(e,t){this.initializeState(e,this.get_currentScope()),t()}evalText(e,t){if(this.presentRestoredDialogue(e,t))return;if(e.condition!=null&&!this.evaluateCondition(e.condition)){t();return}let l=this.getTranslatedString(e,e.content),i=this.evaluateLine(l,l!=e.content);this.presentDialogue(e,null,i.text,i.tags,t)}evalDialogue(e,t){if(this.presentRestoredDialogue(e,t))return;if(e.condition!=null&&!this.evaluateCondition(e.condition)){t();return}let l=this.getTranslatedString(e,e.content),i=this.evaluateLine(l,l!=e.content),n=e.character,s=this.getStateFieldRaw(n),r=rt.characterOf(s);r!=null&&(n=r.name),this.presentDialogue(e,n,i.text,i.tags,t)}presentDialogue(e,t,l,i,n){let s={node:e,character:t,text:l,tags:i};this.pendingDialogue=s;let r=this;this.handleDialogue(this,t,l,i,function(){r.pendingDialogue==s&&(r.pendingDialogue=null),n()})}presentRestoredDialogue(e,t){let l=this.pendingDialogue;return l==null||l.node!=e?!1:(this.presentDialogue(e,l.character,l.text,l.tags,t),!0)}evalChoice(e,t){let l=this.pendingChoiceOptions;if(l!=null&&this.restoredOptionsMatch(e,l)){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}this.pendingChoiceOptions=null;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}restoredOptionsMatch(e,t){let l=0;for(;l<t.length;){let i=t[l];if(++l,i.node==null||i.insertion==null&&e.options.indexOf(i.node)==-1)return!1}return!0}presentChoice(e,t,l){let i=this.get_currentInsertion();if(i!=null&&i.kind==0&&i.options==null){i.stack=[].concat(this.stack),i.options=t,l();return}this.pendingChoiceOptions=t;let n=-1,s=this,r=function(){s._choiceEvalTexts.length=0,s._choiceEvalEnabled.length=0},a=this.wrapNext(function(){if(s.pendingChoiceOptions=null,n>=0&&n<t.length){let h=t[n];h.node.once&&s.setChoiceOptionChosen(h.node);let o=function(){r(),l()};if(h.insertion!=null){let u=s.stack.length;for(;s.stack.length>0;)s.stack.pop();let c=0,f=h.insertion.stack;for(;c<f.length;){let _=f[c];++c,_.insertion!=null&&(_.insertion=null),s.stack.push(_)}let g=s.stack[s.stack.length-1];s.push(new Fi(null,g.beat,s.context.lens.getParentNode(h.node),null,null,h.node,null,null,null)),s.resumeFromLevel(u,o)}else s.evalChoiceOption(h.node,o)}else r(),l()});this.handleChoice(this,t,function(h){n=h,a.cb()}),a.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 c=0;for(;c<l.length;){let f=l[c];++c,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 c=0,f=o.options.length;for(;c<f;){let g=c++,_=o.options[g];l.push(_)}o=null}if(a<r.length){let c=r[a];a+=1;let g=!(c.once&&u.isChoiceOptionChosen(c))&&(c.condition==null||u.evaluateCondition(c.condition));if(c.text!=null){let _=u.wrapNext(h),d=u.getTranslatedString(c,c.text),m=u.evaluateLine(d,d!=c.text),k=u.get_currentInsertion();l.push(new Yi(m.text,m.tags,g,c,k!=null&&k.kind==0?k:null)),u._choiceEvalTexts.push(m.text),u._choiceEvalEnabled.push(g),_.cb(),_.sync=!1}else if(c.insertion!=null){let _=u.wrapNext(h);if(!g)_.cb();else{let d=u.context,m=d.nextInsertionId;u.context.nextInsertionId=d.nextInsertionId+1,o=new qi(m,c.insertion),o.parentPartialOptions=[].concat(l),o.parentNextOptionIndex=a,u.evalInsertion(o,_.cb)}_.sync=!1}else throw y.thrown(_e.of(new U("Invalid choice option",null),c.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 y.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,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,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,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,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,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,null,t);break;case 3:let u=this.builtins.randomInt(0,e.items.length-1),c=e.items[u];this.evalNodeBody(this.get_currentScope().beat,c,c.body,null,null,null,null,t);break;case 4:let f=[],g=0,_=e.items.length;for(;g<_;){let k=g++;f.push(k)}let d=f,m=d.length-1;for(;m>0;){let k=this.builtins.randomInt(0,m),C=d[m];d[m]=d[k],d[k]=C,--m}this.evalShuffledItems(e,d,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,t,function(){s.evalShuffledItems(e,t,l+1,i)})}restoreShuffleOrder(e,t){let l=this.context.lens.getParentNode(t),i=l instanceof hi?l:null;if(i==null||i.mode!=4||e.length!=i.items.length)return null;let n=[],s=0,r=e.length;for(;s<r;){let a=s++,h=e[a];if(h<0||h>=e.length||n.indexOf(h)!=-1)return null;n.push(h)}return n}getBeatVisitCount(e){let t=e.id.thisVal,l=this.context.nodeStates.map._get(t.high,t.low);if(l==null)return 0;let i=G.getField(this,l.fields,"_visitCount");return i??0}incrementBeatVisitCount(e){let t=e.id.thisVal,l=this.context.nodeStates.map._get(t.high,t.low);if(l==null){l=new Yt(this,e,null,null);let s=e.id.thisVal;this.context.nodeStates.map._set(s.high,s.low,l)}let i=G.getField(this,l.fields,"_visitCount"),n=i??0;G.setField(this,l.fields,"_visitCount",n+1)}evalWhen(e,t){let l=this.collectingWhenInsertion(this.stack.length-1),i=l!=null?l.whenFirst:e.strategy=="first",n=l!=null?l.whenSalient:e.strategy==null,s=[],r=this,a=this.wrapNext(function(){r.finishWhenCollection(e,s,l,t)});this.collectWhenRules(e,s,0,i,n,l,a.cb),a.sync=!1}collectingWhenInsertion(e){let t=this.insertionAtOrBelow(e);return t!=null&&t.kind==1&&!t.isCollected()?t:null}finishWhenCollection(e,t,l,i){if(l!=null){l.stack=[].concat(this.stack),l.rules=t,i();return}let n=this.chooseWhenCandidate(e,t);n==null?i():n.insertion==null?this.playWhenRule(n.rule,i):this.playInsertedWhenRule(n,i)}collectWhenRules(e,t,l,i,n,s,r){let a=l,h=null,o=i&&Rt.hasEligibleCandidate(t),u=this.whenBlockInfoOf(e),c=new Ce,f=null,g=this;f=function(){if(h!=null&&h.rules!=null){let k=0,C=h.rules;for(;k<C.length;){let T=C[k];++k,t.push(T),T.eligible&&(o=!0)}}for(h=null,c.h=Object.create(null);a<e.rules.length;){if(i&&o){r();return}let k=e.rules[a];if(k.insertion!=null)break;if(n&&!i){let v=g.salientRunAt(e,u,a);if(v.pure){g.collectSalientRun(e,u,v,t,s,c)&&(o=!0),a=v.end;continue}}let C=u.clauses[a];a+=1;let S=!(k.once&&g.isWhenRuleConsumed(k))&&(k.condition==null||!g.isKnownFalse(C,c)&&g.evaluateCondition(k.condition));S&&(o=!0),t.push({rule:k,eligible:S,insertion:s})}if(a>=e.rules.length||i&&o){r();return}let _=e.rules[a],d=u.clauses[a];a+=1;let m=g.wrapNext(f);if(_.insertionCondition==null||!g.isKnownFalse(d,c)&&g.evaluateCondition(_.insertionCondition)){let k=g.context,C=k.nextInsertionId;g.context.nextInsertionId=k.nextInsertionId+1,h=new qi(C,_.insertion),h.kind=1,h.whenFirst=i,h.whenSalient=n,h.parentPartialRules=[].concat(t),h.parentNextRuleIndex=a,g.evalInsertion(h,m.cb)}else m.cb();m.sync=!1},f()}whenBlockInfoOf(e){let t=e.id.thisVal,l=this.context.whenBlocks.map._get(t.high,t.low);if(l!=null)return l;let i=e.rules.length,n=this.customCreateFields==null&&!this.context.userStringProcessors,s=[],r=0,a=e.rules;for(;r<a.length;){let T=a[r];++r,s.push(this.context.lens.whenRuleScore(T))}let h=s,o=[],u=0,c=e.rules;for(;u<c.length;){let T=c[u];++u,o.push(n?this.knownFalseClausesOf(T.insertion!=null?T.insertionCondition:T.condition):null)}let f=o,g=[],_=0,d=i;for(;_<d;){let T=_++;g.push(null)}let m=new _n(h,f,g),k=0;for(;k<i;){if(e.rules[k].insertion!=null){++k;continue}let T=this.salientRunFrom(e,m,k,n);m.runs[k]=T,k=T.end}let C=e.id.thisVal;return this.context.whenBlocks.map._set(C.high,C.low,m),m}salientRunAt(e,t,l){let i=t.runs[l];if(i!=null)return i;let n=this.customCreateFields==null&&!this.context.userStringProcessors,s=this.salientRunFrom(e,t,l,n);return t.runs[l]=s,s}salientRunFrom(e,t,l,i){let n=this.context.lens.whenRun(e,l);return new dn(n.end,n.pure,n.byScore,i?this.runIndexOf(e,t,n):null)}collectSalientRun(e,t,l,i,n,s){let r=l.byScore,a=null,h=l.index;if(h!=null){let d=this.indexKeyOf(h.fact,s);if(d!=null){let m=h.groups.h[d];r=m??Rt.NO_RULES,a=h.ungrouped}}let o=t.scores,u=null,c=-1,f=0,g=0;for(;;){let d=-1;if(f<r.length)if(d=r[f],a!=null&&g<a.length){let C=a[g];o[C]>o[d]||o[C]==o[d]&&C<d?(d=C,++g):++f}else++f;else if(a!=null&&g<a.length)d=a[g],++g;else break;let m=o[d];if(m<c)break;let k=e.rules[d];k.once&&this.isWhenRuleConsumed(k)||k.condition!=null&&(this.isKnownFalse(t.clauses[d],s)||!this.evaluateCondition(k.condition))||(u==null&&(u=[]),u.push(d),m>c&&(c=m))}if(u==null)return!1;u.length>1&&u.sort(function(d,m){return d-m});let _=0;for(;_<u.length;){let d=u[_];++_,i.push({rule:e.rules[d],eligible:!0,insertion:n})}return!0}runIndexOf(e,t,l){if(l.end-l.start<16)return null;let i=Object.create(null),n=0,s=l.byScore;for(;n<s.length;){let k=s[n];++n;let C=e.rules[k].condition;if(C==null)continue;let T=0,S=this.indexTextsOf(C);for(;T<S.length;){let v=S[T];++T;let I=i[v.name];I==null&&(I=new Ce,i[v.name]=I),I.h[v.text]=!0}}let r=null,a=1,h=i,o=h,u=Object.keys(h),c=u.length,f=0;for(;f<c;){let k=u[f++],C=k,T=o[k],S=C,v=T,I=0,E=v.h,N=E,K=Object.keys(E),V=K.length,B=0;for(;B<V;){let O=N[K[B++]];++I}(I>a||I==a&&r!=null&&S<r)&&(r=S,a=I)}if(r==null)return null;let g=new Ce,_=[],d=0,m=l.byScore;for(;d<m.length;){let k=m[d];++d;let C=e.rules[k].condition,T=null;if(C!=null&&this.context.lens.isPureCondition(C)){let S=0,v=this.indexTextsOf(C);for(;S<v.length;){let I=v[S];if(++S,I.name==r){T=I.text;break}}}if(T==null)_.push(k);else{let S=g.h[T];S==null&&(S=[],g.h[T]=S),S.push(k)}}return new gn(r,g,_)}isKnownFalse(e,t){if(e==null)return!1;let l=0;for(;l<e.length;){let i=e[l];++l;let n=this.indexKeyOf(i.name,t);if(n!=null&&n!=i.text)return!0}return!1}knownFalseClausesOf(e){if(e==null||!this.context.lens.isPureCondition(e)||Ve.conditionClauseCount(e)<=1)return null;let t=this.indexTextsOf(e);return t.length>0?t:null}indexKeyOf(e,t){if(Object.prototype.hasOwnProperty.call(t.h,e))return t.h[e];let l=null;if(this.customCreateFields==null&&this.context.lens.isRootOnlyName(e)&&G.fieldExists(this,this.context.topLevelState.fields,e)){let i=G.getField(this,this.context.topLevelState.fields,e);if(typeof i=="string")l=i;else{let n=Qe.beatOf(i);if(n!=null)l=n.name;else{let s=rt.characterOf(i);s!=null&&(l=s.name)}}}return t.h[e]=l,l}indexTextsOf(e){let t=e.id.thisVal,l=this.context.whenIndexTexts.map._get(t.high,t.low);if(l!=null)return l;let i=[],n=0,s=this.context.lens.indexClausesOf(e);for(;n<s.length;){let h=s[n];++n,i.push(new fn(h.name,this.evaluateString(h.literal).text))}let r=i,a=e.id.thisVal;return this.context.whenIndexTexts.map._set(a.high,a.low,r),r}chooseWhenCandidate(e,t){let l=e.strategy;if(l!=null&&l!="first"&&l!="pick"){let i=this.topLevelFunctions.h[l];if(i==null||!Le.isFunction(i)){let n=e.strategyPos,s=n??e.pos;throw y.thrown(_e.of(new U("Unknown when strategy: {strategy}",{strategy:l}),s))}return this.customStrategyCandidate(e,t,i)}if(l==null)return this.mostSalientCandidate(t);switch(l){case"first":let i=null,n=0;for(;n<t.length;){let h=t[n];if(++n,h.eligible){i=h;break}}return i;case"pick":let s=[],r=0;for(;r<t.length;){let h=t[r];++r,h.eligible&&s.push(h)}let a=s;return a.length==0?null:a[this.builtins.randomInt(0,a.length-1)];default:return this.mostSalientCandidate(t)}}mostSalientCandidate(e){let t=null,l=0,i=0,n=0;for(;n<e.length;){let s=e[n];if(++n,!s.eligible)continue;let r=this.context.lens.whenRuleScore(s.rule),a=this.getWhenRuleLastPlayed(s.rule);(t==null||r>l||r==l&&a<i)&&(t=s,l=r,i=a)}return t}customStrategyCandidate(e,t,l){let i=se.createArray(),n=0,s=t.length;for(;n<s;){let u=n++,c=t[u],f=G.createFields();G.setField(this,f,"index",u),G.setField(this,f,"eligible",c.eligible),G.setField(this,f,"criteria",this.context.lens.whenRuleScore(c.rule)),G.setField(this,f,"played",this.getNodeStateInt(c.rule,"_played")),G.setField(this,f,"lastPlayed",this.getWhenRuleLastPlayed(c.rule)),G.setField(this,f,"ephemeral",c.rule.once),se.arrayPush(i,f)}let r=e.strategyPos,a=r??e.pos,h=this.callFunctionValue(l,[i],a,null),o=typeof h=="number"&&(h|0)===h?h:typeof h=="number"&&Math.floor(h)==h?h|0:null;if(o==-1)return null;if(o==null||o<0||o>=t.length)throw y.thrown(_e.of(new U("Strategy {strategy} returned {value}, expected -1 or the index of an eligible rule",{strategy:e.strategy,value:this.valueToString(h)}),a));if(!t[o].eligible)throw y.thrown(_e.of(new U("Strategy {strategy} returned {index}, which is not an eligible rule",{strategy:e.strategy,index:o}),a));return t[o]}playWhenRule(e,t){this.recordWhenRulePlayed(e),this.evalNodeBody(this.get_currentScope().beat,e,e.body,null,null,null,null,t)}recordWhenRulePlayed(e){let t=this.nodeStateOf(this.context.script),l=this.intFieldOf(t,"_whenTick")+1;G.setField(this,t.fields,"_whenTick",l);let i=this.nodeStateOf(e);G.setField(this,i.fields,"_played",this.intFieldOf(i,"_played")+1),G.setField(this,i.fields,"_lastPlayed",l)}nodeStateOf(e){let t=e.id.thisVal,l=this.context.nodeStates.map._get(t.high,t.low);if(l==null){l=new Yt(this,e,null,null);let i=e.id.thisVal;this.context.nodeStates.map._set(i.high,i.low,l)}return l}intFieldOf(e,t){let l=G.getField(this,e.fields,t);return l==null?0:l|0}playInsertedWhenRule(e,t){let l=e.insertion,i=this.stack.length;for(;this.stack.length>0;)this.stack.pop();let n=0,s=l.stack;for(;n<s.length;){let a=s[n];++n,a.insertion!=null&&(a.insertion=null),this.stack.push(a)}let r=this.stack[this.stack.length-1];this.push(new Fi(null,r.beat,this.context.lens.getParentNode(e.rule),null,null,e.rule,null,null,null)),this.resumeFromLevel(i,t)}isWhenRuleConsumed(e){return this.getNodeStateInt(e,"_played")>0}getWhenRuleLastPlayed(e){let t=e.id.thisVal,l=this.context.nodeStates.map._get(t.high,t.low);if(l==null)return-1;let i=G.getField(this,l.fields,"_lastPlayed");return i==null?-1:i|0}getNodeStateInt(e,t){let l=e.id.thisVal,i=this.context.nodeStates.map._get(l.high,l.low);if(i==null)return 0;let n=G.getField(this,i.fields,t);return n==null?0:n|0}setNodeStateField(e,t,l){G.setField(this,this.nodeStateOf(e).fields,t,l)}getAlternativeVisitCount(e){let t=e.id.thisVal,l=this.context.nodeStates.map._get(t.high,t.low);if(l==null)return 0;let i=G.getField(this,l.fields,"_visitCount");return i??0}setAlternativeVisitCount(e,t){let l=e.id.thisVal,i=this.context.nodeStates.map._get(l.high,l.low);if(i==null){i=new Yt(this,e,null,null);let n=e.id.thisVal;this.context.nodeStates.map._set(n.high,n.low,i)}G.setField(this,i.fields,"_visitCount",t)}isChoiceOptionChosen(e){let t=e.id.thisVal,l=this.context.nodeStates.map._get(t.high,t.low);if(l==null)return!1;let i=G.getField(this,l.fields,"_chosen");return i??!1}setChoiceOptionChosen(e){let t=e.id.thisVal,l=this.context.nodeStates.map._get(t.high,t.low);if(l==null){l=new Yt(this,e,null,null);let i=e.id.thisVal;this.context.nodeStates.map._set(i.high,i.low,l)}G.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 24:n=this.performOperation(x.OpPlus,this.readAccess(l),i,e.pos);break;case 25:n=this.performOperation(x.OpMinus,this.readAccess(l),i,e.pos);break;case 26:n=this.performOperation(x.OpMultiply,this.readAccess(l),i,e.pos);break;case 27:n=this.performOperation(x.OpDivide,this.readAccess(l),i,e.pos);break;case 23:case 28:n=i;break;default:throw y.thrown(_e.of(new U("Invalid assignment operator",null),e.pos))}this.writeAccess(l,n),t()}snapshotOriginalValue(e){if(e==null||typeof e=="string"||typeof e=="number"||typeof e=="number"&&(e|0)===e||typeof e=="boolean"||rt.characterOf(e)!=null||Qe.beatOf(e)!=null)return e;if(se.isArray(e)){let t=se.createArray(),l=0,i=se.arrayLength(e);for(;l<i;){let n=l++;se.arrayPush(t,this.snapshotOriginalValue(se.arrayGet(e,n)))}return t}if(G.isFields(e)){let t=G.createFields(),l=0,i=G.getFields(this,e);for(;l<i.length;){let n=i[l];++l,G.setField(this,t,n,this.snapshotOriginalValue(G.getField(this,e,n)))}return t}return e}isOriginalScriptExpression(e){switch(le.getClass(e)){case Ht:let t=e;return this.isOriginalScriptExpression(t.left)?this.isOriginalScriptExpression(t.right):!1;case mt:case bl:case zt:return!1;case De: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 g=h[o];if(++o,g instanceof dt&&!this.isOriginalScriptExpression(g))return!1}return!0;case 4:let u=i.style,c=l.value,f=0;for(;f<c.length;){let g=c[f];if(++f,!this.isOriginalScriptExpression(g.value))return!1}return!0}break;case vt: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 c=o.expr;return!1;case 2:let f=o.closing,g=o.expr;if(!this.isOriginalScriptExpression(g))return!1;break}}return!0;case $l:let a=e;return this.isOriginalScriptExpression(a.operand)}return!1}isBeatCall(e,t){return t==null&&(t=-1),e instanceof zt?this.resolveBeatRefFromCall(e)!=null:!1}isDynamicCallForm(e){if(e.target instanceof mt){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.context.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 Qe(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.context.topLevelBeats.h[e];return i!=null?new Qe(i,[]):null}resolveBeatRefFromNode(e,t){if(t==null)return this.resolveBeatRefByName(e);let l=this.context.lens.findBeatByNameFromNode(e,t);return l==null?null:new Qe(l,this.captureChainForBeat(l))}captureChainForBeat(e){let t=this.context.lens.getFirstParentOfType(e,Ae);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 Qe)return e;if(e instanceof Ae)return new Qe(e,[]);if(typeof e=="string"){let l=e,i=this.resolveBeatRefFromNode(l,t);if(i==null)throw y.thrown(this.beatNotFoundError(l,t));return i}throw y.thrown(_e.of(new U("Invalid dynamic beat target: {value}",{value:this.valueToString(e)}),t.pos))}beatNotFoundError(e,t){let l=t!=null?t.pos:this.context.script.pos,i=0,n=this.context.lens.getNodesOfType(Ae,!0);for(;i<n.length;){let s=n[i];if(++i,s.name==e)return _e.of(new U("Beat {name} can't be reached from here. Store a reference (ref = {name}) where it is visible to use it elsewhere.",{name:e}),l)}return _e.of(new U("Beat {name} not found",{name:e}),l)}resolveBeatRefFromCall(e){if(e.target instanceof mt){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 y.thrown(_e.of(new U("Cannot pass arguments when ending the script",null),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 y.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)}evaluateLine(e,t){let l=this.context.inLine,i=this.context.lineLanguage;this.context.inLine=!0;let n=t?this.translationLocale():this.sourceLanguage();this.context.lineLanguage=n;let s;try{s=this.evaluateString(e)}catch(r){let a=y.caught(r).unwrap();throw this.context.inLine=l,this.context.lineLanguage=i,y.thrown(a)}return this.context.inLine=l,this.context.lineLanguage=i,s}pluralLanguage(){if(this.context.inLine)return this.context.lineLanguage;let e=this.translationLocale();return e??this.sourceLanguage()}translationLocale(){let e=this.context.translations,t=e!=null?e.h.$locale:null;if(t==null||t.parts.length!=1)return null;let l=t.parts[0].partType;return l._hx_index==0?l.text:null}sourceLanguage(){if(!this.context.sourceLanguageRead){let e=this.context.script.getMetadataField("language");this.context.sourceLanguage=typeof e=="string"?e:null,this.context.sourceLanguageRead=!0}return this.context.sourceLanguage}getTranslatedString(e,t){if(this.context.translations!=null){let l=this.findHashCommentId(e,t);if(l!=null&&this.context.script.filePath!=null){let i=0,n=this.context.lens.getNodeAncestorFilePaths(e);for(;i<n.length;){let s=n[i];++i;let r=this.context.translations.h[s+"#"+l];if(r!=null)return r}}}return t}findHashCommentId(e,t){return Ve.findHashComment(e,t)}evaluateString(e){let t=e,l=!this.context.userStringProcessors&&Rt.isRawOnlyString(e);if(l){let _=this.context.constantStrings.h[t.__id__];if(_!=null)return{text:_,tags:[]}}let i=0,n=this.context.stringLiteralProcessors.length;for(;i<n;){let _=i++;e=this.context.stringLiteralProcessors[_](e)}let s="",r=[],a=0,h=e.parts.length,o=e.quotes!=0,u=-1;if(!o){let _=h-1;e:for(;_>=0;){let m=e.parts[_].partType;switch(m._hx_index){case 0:let k=m.text;u=_;break e;case 1:let C=m.expr;break e;case 2:let T=m.closing,S=m.expr;--_;break}}}let c=0,f=h;for(;c<f;){let _=c++,m=e.parts[_].partType;switch(m._hx_index){case 0:let k=m.text;k=Rt.prepareRawText(k,e.quotes,!o,_==u),k.length>0&&(o=!0);let C=Rt.unescapeRawText(k);s+=C==null?"null":""+C,a+=D.count(C);break;case 1:let T=m.expr;o=!0;let S=this.evaluateExpression(T),v=this.valueToString(S);a+=D.count(v),s+=v==null?"null":""+v;break;case 2:let I=m.closing,E=m.expr,N=this.evaluateString(E).text;r.push(new Ki(I,N,a));break}}let g=s;return l&&this.context.constantStrings.set(t,g),{text:g,tags:r}}pluralPipeProcess(e){let t=!1,l=null,i=0,n=e.parts.length;for(;i<n;){let s=i++,r=e.parts[s],a=r.partType;if(a._hx_index==0){let h=a.text;if(this.rawTextHasUnescapedPipe(h)){let o=gi.countExpr(e.parts,s);if(o!=null){if(!t){let u=[],c=0,f=s;for(;c<f;){let g=c++;u.push(e.parts[g])}l=u,t=!0}this.transformPipeRaw(h,o,r.pos,l);continue}}}t&&l.push(r)}return t?new vt(e.id,e.pos,e.quotes,l):e}rawTextHasUnescapedPipe(e){let t=e.length,l=0;for(;l<t;){let i=p.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=0,s=0,r=gi.scan(e);for(;s<r.length;){let h=r[s];if(++s,h.start>n){let o=h.start;i.push(new et(We.UNDEFINED,l,Ye.Raw(o!=null?e.substring(n,o):e.substring(n))))}i.push(new et(We.UNDEFINED,l,Ye.Expr(this.makePluralCall(t,h.forms,h.thresholds,l)))),n=h.end}let a=e.length;n<a&&i.push(new et(We.UNDEFINED,l,Ye.Raw(a!=null?e.substring(n,a):e.substring(n))))}makePluralCall(e,t,l,i){let n=new mt(We.UNDEFINED,i,null,"plural"),s=[e],r=0,a=t.length;for(;r<a;){let h=r++,o=l[h];o!=null&&s.push(new De(We.UNDEFINED,i,o,ze.Number)),s.push(new vt(We.UNDEFINED,i,1,[new et(We.UNDEFINED,i,Ye.Raw(t[h]))]))}return new zt(We.UNDEFINED,i,n,s)}evaluateCondition(e){return z.isTruthy(this.evaluateExpression(e))}callFunctionValue(e,t,l,i){try{let n=Ei.call(null,e,t);if(n!=null&&!(n instanceof Ti)&&(n=this.hostValueToRuntime(n)),n!=null&&n instanceof Ti){if(i==null)throw y.thrown(_e.of(new U("Cannot call async function in expression",null),l));n.func(i)}else i?.();return n}catch(n){let s=y.caught(n).unwrap();if(s instanceof Ie){let r=s;throw y.thrown(_e.of(new U("Error in function: {error}",{error:r.e}),l))}throw s instanceof _e&&s.pos==null?y.thrown(_e.at(s,l)):y.thrown(_e.of(new U("Error when calling function: {error}",{error:s}),l))}}resolvesExistingBinding(e){let t=!1,l=this;return this.eachResolutionScope(-1,function(i){if(i.state!=null&&G.fieldExists(l,i.state.fields,e))return t=!0,!0;if(i.node!=null){let n=i.node.id.thisVal,s=l.context.nodeStates.map._get(n.high,n.low);if(s!=null&&G.fieldExists(l,s.fields,e))return t=!0,!0}return!1}),!!(t||G.fieldExists(this,this.context.topLevelState.fields,e)||Object.prototype.hasOwnProperty.call(this.context.topLevelCharacters.h,e)||Object.prototype.hasOwnProperty.call(this.topLevelFunctions.h,e)||this.resolveBeatByName(e)!=null)}evaluateDynamicCall(e,t){if(e.args.length==0)throw y.thrown(_e.of(new U("call() requires a target argument",null),e.pos));let l=this.evaluateExpression(e.args[0]);if(Qe.beatOf(l)!=null)throw y.thrown(_e.of(new U("call() can only call functions. Use beat(...) to call a beat.",null),e.pos));let i=null;if(Le.isFunction(l))i=l;else if(typeof l=="string"){let n=l;if(this.resolveBeatByName(n)!=null)throw y.thrown(_e.of(new U("call() can only call functions. Use beat(...) to call a beat.",null),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 y.thrown(_e.of(new U("call() target is not a function: {value}",{value:this.valueToString(l)}),e.pos))}evaluateFunctionCall(e,t){if(e.target instanceof mt){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&&Le.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=rt.fieldsOf(this.evaluateExpression(n.target)),r=null,a=Qe.beatOf(s);if(typeof s=="string"?r=G.getStringHelper(this,n.name):se.isArray(s)?r=G.getArrayHelper(this,n.name):a!=null?r=G.getBeatHelper(this,n.name):G.isFields(s)&&(r=G.getMapHelper(this,n.name)),r!=null&&Le.isFunction(r)){let h=[],o=0,u=e.args;for(;o<u.length;){let g=u[o];++o,h.push(this.evaluateExpression(g))}let c=h;c.splice(0,0,a??s);let f=Ei.call(null,r,c);if(f!=null&&f instanceof Ti){if(t==null)throw y.thrown(_e.of(new U("Cannot call async function in expression",null),e.pos));f.func(t)}else t?.();return f}else if(r==null&&!(typeof s=="string"||se.isArray(s)||G.isFields(s))){let h=Le.getProperty(s,n.name);if(Le.isFunction(h)){let o=[],u=0,c=e.args;for(;u<c.length;){let _=c[u];++u,o.push(this.evaluateExpression(_))}let f=o,g=h.apply(s,f);if(g!=null&&g instanceof Ti){if(t==null)throw y.thrown(_e.of(new U("Cannot call async function in expression",null),e.pos));g.func(t)}else t?.();return g}}}}let l=this.printLoreline(e.target),i;throw l!=null?i=l:i=le.getClass(e.target).__name__,y.thrown(_e.of(new U("Invalid call target: {target}",{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 se.fromValues(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(le.getClass(e)){case mt:let t=e,l;if(t.target==null){let k=t.name;l=this.customCreateFields==null&&this.context.lens.isRootOnlyName(k)&&G.fieldExists(this,this.context.topLevelState.fields,k)}else l=!1;if(l)return G.getField(this,this.context.topLevelState.fields,t.name);{let k=this.resolveAccess(t,t.target,t.name);return this.readAccess(k)}break;case bl:let i=e,n=this.evaluateExpression(i.target),s=this.evaluateExpression(i.index);if(se.isArray(n)&&(typeof s=="number"||typeof s=="number"&&(s|0)===s)){let k=s|0;if(k<0||k>=se.arrayLength(n))throw y.thrown(_e.of(new U("Array index out of bounds: {index}",{index:k}),i.pos));return se.arrayGet(n,k)}else if(typeof s=="string"){if(n==null)throw y.thrown(_e.of(new U("Cannot access field '{field}' of null",{field:s}),i.pos));return G.getField(this,n,s)}else throw y.thrown(_e.of(new U("Invalid array access",null),i.pos));break;case Ht:let r=e,a=r.op;switch(a._hx_index){case 40:let k=a.word,C=z.isTruthy(this.evaluateExpression(r.left)),T=r.op,S;if(T._hx_index==40){let B=T.word;S=!0}else S=!1;return(S?!C:C)?C:z.isTruthy(this.evaluateExpression(r.right));case 41:let v=a.word,I=z.isTruthy(this.evaluateExpression(r.left)),E=r.op,N;if(E._hx_index==40){let B=E.word;N=!0}else N=!1;return(N?!I:I)?I:z.isTruthy(this.evaluateExpression(r.right));default:let K=this.evaluateExpression(r.left),V=this.evaluateExpression(r.right);return this.performOperation(r.op,K,V,r.pos)}break;case zt:return this.evaluateFunctionCall(e,null);case De:let h=e,o=h.literalType;switch(o._hx_index){case 0:case 1:case 2:return h.value;case 3:return this.evaluateArrayLiteral(h.value);case 4:let k=o.style;return this.evaluateObjectLiteral(h.value)}break;case vt:let u=e;if(u.parts.length==1&&u.quotes==0){let k=u.parts[0].partType;if(k._hx_index==1){let C=k.expr;return this.evaluateExpression(C)}else return this.evaluateString(u).text}else return this.evaluateString(u).text;break;case wi:let c=e;return this.evaluateCondition(c.condition)?this.evaluateExpression(c.trueExpr):this.evaluateExpression(c.falseExpr);case $l:let g=e,_=this.evaluateExpression(g.operand),d=g.op;switch(d._hx_index){case 30:if(he.typeof(_)==Ft.TInt)return-_;if(he.typeof(_)==Ft.TFloat)return-_;try{return z.negate(_)}catch(C){let T=y.caught(C).unwrap();if(T instanceof _e){let S=T;throw y.thrown(_e.at(S,g.pos))}else throw C}break;case 42:let k=d.word;return!z.isTruthy(_);default:throw y.thrown(_e.of(new U("Invalid unary operation",null),g.pos))}break;default:let m=le.getClass(e);throw y.thrown(new _e("Unsupported expression type: "+m.__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 y.thrown(_e.of(new U("Cannot read field '{name}' of null",{name:i}),t));return G.getField(this,l,i);case 1:let n=e.pos,s=e.array,r=e.index;return se.arrayGet(s,r);case 2:let a=e.pos,h=e.name;if(Object.prototype.hasOwnProperty.call(this.context.topLevelCharacters.h,h)){let _=this.context.topLevelCharacters.h[h];return _.characterRef==null&&(_.characterRef=new rt(h,_)),_.characterRef}else throw y.thrown(_e.of(new U("Character not found: {name}",{name:h}),a));break;case 3:let o=e.pos,u=e.name;if(Object.prototype.hasOwnProperty.call(this.topLevelFunctions.h,u))return this.topLevelFunctions.h[u];throw y.thrown(_e.of(new U("Function not found: {name}",{name:u}),o));case 4:let c=e.pos;return e.ref;case 5:let g=e.pos;return this.evaluateObjectLiteral(this.context.script.metadataBlock().fields)}}writeAccess(e,t){switch(e._hx_index){case 0:let l=e.pos,i=e.obj,n=e.name;if(i==null)throw y.thrown(_e.of(new U("Cannot set field '{name}' of null",{name:n}),l));G.setField(this,i,n,t);break;case 1:let s=e.pos,r=e.array,a=e.index;se.arraySet(r,a,t);break;case 2:let h=e.pos,o=e.name;throw y.thrown(_e.of(new U("Cannot overwrite character: {name}",{name:o}),h));case 3:let u=e.pos,c=e.name;throw y.thrown(_e.of(new U("Cannot overwrite function: {name}",{name:c}),u));case 4:let f=e.pos,g=e.ref;throw y.thrown(_e.of(new U("Cannot overwrite beat: {name}",{name:g.beat.name}),f));case 5:let _=e.pos;throw y.thrown(this.metadataChangeError(_))}}resolveAssignmentTarget(e){switch(le.getClass(e)){case mt:let t=e;if(t.target!=null&&this.readsMetadata(t.target))throw y.thrown(this.metadataChangeError(t.pos));return this.resolveAccess(t,t.target,t.name);case bl:let l=e;if(this.readsMetadata(l.target))throw y.thrown(this.metadataChangeError(l.pos));let i=this.evaluateExpression(l.target),n=this.evaluateExpression(l.index);if(se.isArray(i)&&(typeof n=="number"||typeof n=="number"&&(n|0)===n)){let s=n|0;return cl.ArrayAccess(l.pos,i,s)}else if(typeof n=="string"){if(i==null)throw y.thrown(_e.of(new U("Cannot access field '{field}' of null",{field:n}),l.pos));return cl.FieldAccess(l.pos,i,n)}else throw y.thrown(_e.of(new U("Invalid array access target",null),l.pos));break;default:throw y.thrown(_e.of(new U("Invalid assignment target",null),e.pos))}}isRootOnlyField(e){return this.customCreateFields==null&&this.context.lens.isRootOnlyName(e)?G.fieldExists(this,this.context.topLevelState.fields,e):!1}resolveAccess(e,t,l){if(t!=null){let o=this.evaluateExpression(t);if(o==null){let u=le.getClass(t)==mt?t.name:null;throw y.thrown(_e.of(u!=null?new U("Cannot access field '{name}': '{target}' is null or doesn't exist",{name:l,target:u}):new U("Cannot access field '{name}' of null value",{name:l}),t.pos))}return cl.FieldAccess(t.pos,rt.fieldsOf(o),l)}if(this.customCreateFields==null&&this.context.lens.isRootOnlyName(l)&&G.fieldExists(this,this.context.topLevelState.fields,l)){let o=e!=null?e.pos:null,u;if(o!=null)u=o;else{let c=this.get_currentScope(),f=c!=null?c.node:null;u=f!=null?f.pos:null}return cl.FieldAccess(u??this.context.script.pos,this.context.topLevelState.fields,l)}let i=null,n=this;if(this.eachResolutionScope(-1,function(o){if(o.state!=null&&G.fieldExists(n,o.state.fields,l)){let u=e!=null?e.pos:null,c;if(u!=null)c=u;else{let f=n.get_currentScope(),g=f!=null?f.node:null;c=g!=null?g.pos:null}return i=cl.FieldAccess(c??n.context.script.pos,o.state.fields,l),!0}if(o.node!=null){let u=o.node.id.thisVal,c=n.context.nodeStates.map._get(u.high,u.low);if(c!=null&&G.fieldExists(n,c.fields,l)){let f=e!=null?e.pos:null,g;if(f!=null)g=f;else{let _=n.get_currentScope(),d=_!=null?_.node:null;g=d!=null?d.pos:null}return i=cl.FieldAccess(g??n.context.script.pos,c.fields,l),!0}}return!1}),i!=null)return i;if(G.fieldExists(this,this.context.topLevelState.fields,l)){let o=e!=null?e.pos:null,u;if(o!=null)u=o;else{let c=this.get_currentScope(),f=c!=null?c.node:null;u=f!=null?f.pos:null}return cl.FieldAccess(u??this.context.script.pos,this.context.topLevelState.fields,l)}if(Object.prototype.hasOwnProperty.call(this.context.topLevelCharacters.h,l)){let o=e!=null?e.pos:null,u;if(o!=null)u=o;else{let c=this.get_currentScope(),f=c!=null?c.node:null;u=f!=null?f.pos:null}return cl.CharacterAccess(u??this.context.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 c=this.get_currentScope(),f=c!=null?c.node:null;u=f!=null?f.pos:null}return cl.FunctionAccess(u??this.context.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 c=this.get_currentScope(),f=c!=null?c.node:null;u=f!=null?f.pos:null}return cl.BeatAccess(u??this.context.script.pos,s)}if(l=="metadata"&&this.context.script.metadataBlock()!=null){let o=e!=null?e.pos:null,u;if(o!=null)u=o;else{let c=this.get_currentScope(),f=c!=null?c.node:null;u=f!=null?f.pos:null}return cl.MetadataAccess(u??this.context.script.pos)}if(!this.context.strictAccess){let o=e!=null?e.pos:null,u;if(o!=null)u=o;else{let c=this.get_currentScope(),f=c!=null?c.node:null;u=f!=null?f.pos:null}return cl.FieldAccess(u??this.context.script.pos,this.context.topLevelState.fields,l)}let r=new U("Unknown name: {name}",{name: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 y.thrown(_e.of(r,h??this.context.script.pos))}readsMetadata(e){let t=e;for(;t!=null;)if(t instanceof mt){let l=t;if(l.target==null)if(l.name=="metadata"){let i=this.resolveAccess(l,null,l.name);if(i._hx_index==5){let n=i.pos;return!0}else return!1}else return!1;t=l.target}else if(t instanceof bl)t=t.target;else return!1;return!1}metadataChangeError(e){return _e.of(new U("The story's metadata can't be changed by the script",null),e)}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"}}arithmetic(e,t,l,i){try{return z.arithmetic(e,t,l,this)}catch(n){let s=y.caught(n).unwrap();if(s instanceof _e){let r=s,a=i,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 y.thrown(_e.at(r,h??this.context.script.pos))}else throw n}}performOperation(e,t,l,i){let n=he.typeof(t),s=he.typeof(l);switch(e._hx_index){case 29:switch(n._hx_index){case 1:case 2:switch(s._hx_index){case 1:case 2:return n._hx_index==1,t+(s._hx_index==1,l);default:return this.arithmetic("+",t,l,i)}break;default:return this.arithmetic("+",t,l,i)}break;case 30:case 31:case 32:case 33:switch(n._hx_index){case 1:case 2:switch(s._hx_index){case 1:case 2:let m=(n._hx_index==1,t),k=(s._hx_index==1,l);switch(e._hx_index){case 30:return m-k;case 31:return m*k;case 32:if(k==0){let T=new U("Division by zero",null),S=i,v;if(S!=null)v=S;else{let I=this.get_currentScope(),E=I!=null?I.node:null;v=E!=null?E.pos:null}throw y.thrown(_e.of(T,v??this.context.script.pos))}return m/k;case 33:if(k==0){let T=new U("Modulo by zero",null),S=i,v;if(S!=null)v=S;else{let I=this.get_currentScope(),E=I!=null?I.node:null;v=E!=null?E.pos:null}throw y.thrown(_e.of(T,v??this.context.script.pos))}return m%k;default:throw y.thrown("Unreachable")}break;default:let C;switch(e._hx_index){case 30:C="-";break;case 31:C="*";break;case 32:C="/";break;default:C="%"}return this.arithmetic(C,t,l,i)}break;default:let d;switch(e._hx_index){case 30:d="-";break;case 31:d="*";break;case 32:d="/";break;default:d="%"}return this.arithmetic(d,t,l,i)}break;case 34:let r=e.word,a=typeof t=="string"&&typeof l=="string"?t==l:z.equals(t,l);switch(e._hx_index){case 34:let d=e.word;return a;case 35:let m=e.word;return!a;default:throw y.thrown("Unreachable")}break;case 35:let h=e.word,o=typeof t=="string"&&typeof l=="string"?t==l:z.equals(t,l);switch(e._hx_index){case 34:let d=e.word;return o;case 35:let m=e.word;return!o;default:throw y.thrown("Unreachable")}break;case 36:case 37:case 38:case 39:switch(n._hx_index){case 1:case 2:switch(s._hx_index){case 1:case 2:let d=(n._hx_index==1,t),m=(s._hx_index==1,l);switch(e._hx_index){case 36:return d>m;case 37:return d<m;case 38:return d>=m;case 39:return d<=m;default:throw y.thrown("Unreachable")}break;default:if(z.canCompare(t,l)){let k=z.compare(t,l);switch(e._hx_index){case 36:return k>0;case 37:return k<0;case 38:return k>=0;case 39:return k<=0;default:throw y.thrown("Unreachable")}}else{let k=new U("Cannot compare {a} and {b}",{a:z.describeForError(t),b:z.describeForError(l)}),C=i,T;if(C!=null)T=C;else{let S=this.get_currentScope(),v=S!=null?S.node:null;T=v!=null?v.pos:null}throw y.thrown(_e.of(k,T??this.context.script.pos))}}break;default:if(z.canCompare(t,l)){let d=z.compare(t,l);switch(e._hx_index){case 36:return d>0;case 37:return d<0;case 38:return d>=0;case 39:return d<=0;default:throw y.thrown("Unreachable")}}else{let d=new U("Cannot compare {a} and {b}",{a:z.describeForError(t),b:z.describeForError(l)}),m=i,k;if(m!=null)k=m;else{let C=this.get_currentScope(),T=C!=null?C.node:null;k=T!=null?T.pos:null}throw y.thrown(_e.of(d,k??this.context.script.pos))}}break;case 40:let u=e.word;if(e._hx_index==40){let d=e.word;return z.isTruthy(t)?z.isTruthy(l):!1}else return z.isTruthy(t)?!0:z.isTruthy(l);break;case 41:let c=e.word;if(e._hx_index==40){let d=e.word;return z.isTruthy(t)?z.isTruthy(l):!1}else return z.isTruthy(t)?!0:z.isTruthy(l);break;default:let f=new U("Invalid operation: {op}",{op:e}),g=i,_;if(g!=null)_=g;else{let d=this.get_currentScope(),m=d!=null?d.node:null;_=m!=null?m.pos:null}throw y.thrown(_e.of(f,_??this.context.script.pos))}}valueToString(e){return z.textOf(e,this)}printLoreline(e){try{let t=new Ll;return t.enableComments=!1,Ue.trim(t.print(e))}catch{return null}}static missingExternalFunction(e){return Ei.make(function(t){throw y.thrown(_e.of(new U("{name}() is declared without a body, so the app running the story must provide it",{name:e})))})}static hasEligibleCandidate(e){let t=0;for(;t<e.length;){let l=e[t];if(++t,l.eligible)return!0}return!1}static isRawOnlyString(e){let t=0,l=e.parts;for(;t<l.length;){let i=l[t];++t;let n=i.partType;if(n._hx_index==0){let s=n.text}else return!1}return!0}static prepareRawText(e,t,l,i){return l&&(e=Ue.ltrim(e)),i&&(e=Ue.rtrim(e)),t==0&&(e=Rt.stripStringComments(e),e=Rt.stripStringIndent(e)),e}static unescapeRawText(e){let t=e,l=t.length,i="",n=!1,s=!1,r=!1,a=0,h=l;for(;a<h;){let o=a++,u=p.cca(t,o),c=u??-1;r?(c==110?i+=String.fromCodePoint(10):c==114?i+=String.fromCodePoint(13):c==116?i+=String.fromCodePoint(9):i+=String.fromCodePoint(c),r=!1,n=!1,s=!1):c==92?(r=!0,n=!1,s=!1):c==36?(n?(i+=String.fromCodePoint(c),n=!1):n=!0,s=!1):c==35?(s?(i+=String.fromCodePoint(c),s=!1):s=!0,n=!1):(s&&(i+=String.fromCodePoint(35),s=!1),i+=String.fromCodePoint(c))}return s&&(i+=String.fromCodePoint(35)),i}static constantText(e){let t="",l=e.quotes!=0,i=-1;if(!l){let r=0,a=e.parts.length;for(;r<a;){let h=r++,o=e.parts[h].partType;if(o._hx_index==0){let u=o.text;i=h}}}let n=0,s=e.parts.length;for(;n<s;){let r=n++,a=e.parts[r].partType;if(a._hx_index==0){let h=a.text;h=Rt.prepareRawText(h,e.quotes,!l,r==i),h.length>0&&(l=!0),t+=oe.string(Rt.unescapeRawText(h))}}return t}static stripStringIndent(e){if(e.indexOf(`
28
29
  `)==-1)return e;let t=e.split(`
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=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,`
30
+ `),l=-1,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=p.cca(r,a),o=h??-1;if(o!=32&&o!=9)break;++a}(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(`
31
+ `)}return e}static stripStringComments(e){let t=e,l="",i=t.length,n=0;for(;n<i;){let s=p.cca(t,n),r=s??-1,a;if(r==47&&n+1<i){let o=p.cca(t,n+1);a=(o??-1)==47}else a=!1;if(a){for(;;){let o;if(n<i){let u=p.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=p.cca(t,n+1);h=(o??-1)==42}else h=!1;if(h){let o;if(n>0){let c=p.cca(t,n-1);o=(c??-1)==32}else o=!1;for(n+=2;;){let c;if(n+1<i){let f,g=p.cca(t,n);if((g??-1)==42){let _=p.cca(t,n+1);f=(_??-1)==47}else f=!1;c=!f}else c=!1;if(!c)break;++n}n+=2;let u;if(n<i){let c=p.cca(t,n);u=(c??-1)==32}else u=!1;o&&u&&++n,!o&&!u&&n<i&&(l+=String.fromCodePoint(32));continue}l+=String.fromCodePoint(r),++n}return l}static numberOf(e,t){return t._hx_index==1,e}}J["loreline.Interpreter"]=Jl.loreline.Interpreter=Rt,Rt.__name__="loreline.Interpreter",Object.assign(Rt.prototype,{__class__:Rt,__properties__:{set_nextInsertionId:"set_nextInsertionId",get_nextInsertionId:"get_nextInsertionId",get_currentInsertion:"get_currentInsertion",get_currentScope:"get_currentScope",get_strictAccess:"get_strictAccess",get_lens:"get_lens",set_stringLiteralProcessors:"set_stringLiteralProcessors",get_stringLiteralProcessors:"get_stringLiteralProcessors",get_nodeStates:"get_nodeStates",get_topLevelBeats:"get_topLevelBeats",get_topLevelCharacters:"get_topLevelCharacters",get_topLevelState:"get_topLevelState",set_translations:"set_translations",get_translations:"get_translations",get_script:"get_script"}});class Kn{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"]=Kn,Kn.__name__="loreline.Json";class P{static scriptFromJson(e){if(e==null)throw y.thrown("Cannot create Script from null JSON");let t=e.type;if(t!="Script")throw y.thrown("Expected Script node, got: "+t);let l=P.idFromJson(e),i=P.positionFromJson(e.pos),n=e.body,s=[],r=0;for(;r<n.length;){let o=n[r];++r,s.push(P.nodeFromJson(o))}let a=s,h=new Ot(l,i,a);return h.indentSize=e.indentSize!=null?e.indentSize:2,e.filePath!=null&&(h.filePath=e.filePath),P.applyComments(h,e),h}static nodeFromJson(e){if(e==null)return null;let t=P.nodeFromJsonOfType(e);return e.parens!=null&&t instanceof dt&&(t.parens=e.parens|0),t}static nodeFromJsonOfType(e){let t=e.type;switch(t){case"Access":return P.accessFromJson(e);case"Alternative":return P.alternativeFromJson(e);case"ArrayAccess":return P.arrayAccessFromJson(e);case"Assign":return P.assignFromJson(e);case"Beat":return P.beatFromJson(e);case"BeatCall":return P.beatCallFromJson(e);case"Binary":return P.binaryFromJson(e);case"Block":return P.blockFromJson(e);case"Call":return P.callFromJson(e);case"Character":return P.characterFromJson(e);case"Choice":return P.choiceStatementFromJson(e);case"Comment":return P.commentFromJson(e);case"Dialogue":return P.dialogueStatementFromJson(e);case"Field":return P.objectFieldFromJson(e);case"Function":return P.functionDeclFromJson(e);case"If":return P.ifStatementFromJson(e);case"Import":return P.importStatementFromJson(e);case"Insertion":return P.insertionFromJson(e);case"Literal":return P.literalFromJson(e);case"Metadata":return P.metadataFromJson(e);case"Option":return P.choiceOptionFromJson(e);case"Part":return P.stringPartFromJson(e);case"Script":return P.scriptFromJson(e);case"State":return P.stateFromJson(e);case"String":return P.stringLiteralFromJson(e);case"Ternary":return P.ternaryFromJson(e);case"Text":return P.textStatementFromJson(e);case"Transition":return P.transitionFromJson(e);case"Unary":return P.unaryFromJson(e);case"When":return P.whenStatementFromJson(e);case"WhenRule":return P.whenRuleFromJson(e);default:throw y.thrown("Unknown node type: "+t)}}static commentFromJson(e){let t=P.idFromJson(e),l=P.positionFromJson(e.pos),i=e.isHash!=null&&e.isHash;return new di(t,l,e.content,e.multiline,i)}static stateFromJson(e){let t=P.idFromJson(e),l=P.positionFromJson(e.pos),i=e.fields,n=[],s=0;for(;s<i.length;){let o=i[s];++s,n.push(P.nodeFromJson(o))}let r=n,a=P.extractComments(e),h=new Kt(t,l,e.temporary,r,a.leading,a.trailing);return h.style=P.blockStyleFromString(e.style),h}static metadataFromJson(e){let t=P.idFromJson(e),l=P.positionFromJson(e.pos),i=e.fields,n=[],s=0;for(;s<i.length;){let o=i[s];++s,n.push(P.nodeFromJson(o))}let r=n,a=P.extractComments(e),h=new mi(t,l,r,a.leading,a.trailing);return h.style=P.blockStyleFromString(e.style),h}static objectFieldFromJson(e){let t=P.idFromJson(e),l=P.positionFromJson(e.pos),i=P.extractComments(e);return new ii(t,l,e.name,P.nodeFromJson(e.value),i.leading,i.trailing)}static characterFromJson(e){let t=P.idFromJson(e),l=P.positionFromJson(e.pos),i=P.positionFromJson(e.namePos),n=e.fields,s=[],r=0;for(;r<n.length;){let u=n[r];++r,s.push(P.nodeFromJson(u))}let a=s,h=P.extractComments(e),o=new Zt(t,l,e.name,i,a,h.leading,h.trailing);return o.style=P.blockStyleFromString(e.style),o}static beatFromJson(e){let t=P.idFromJson(e),l=P.positionFromJson(e.pos),i=e.body,n=[],s=0;for(;s<i.length;){let o=i[s];++s,n.push(P.nodeFromJson(o))}let r=n,a=P.extractComments(e),h=new Ae(t,l,e.name,r,a.leading,a.trailing);if(h.style=P.blockStyleFromString(e.style),e.isPublic==!0&&(h.isPublic=!0),e.params!=null){let o=e.params,u=[],c=0;for(;c<o.length;){let f=o[c];++c,u.push(new Zi(f.name,P.positionFromJson(f.namePos),f.defaultValue!=null?P.nodeFromJson(f.defaultValue):null))}h.params=u}return h}static stringPartFromJson(e){let t=P.idFromJson(e),l=P.positionFromJson(e.pos),i=e.part,n;switch(i){case"Expr":n=Ye.Expr(P.nodeFromJson(e.expression));break;case"Raw":n=Ye.Raw(e.text);break;case"Tag":n=Ye.Tag(e.closing,P.nodeFromJson(e.content));break;default:throw y.thrown("Unknown string part type: "+i)}let s=P.extractComments(e);return new et(t,l,n,s.leading,s.trailing)}static stringLiteralFromJson(e){let t=P.idFromJson(e),l=P.positionFromJson(e.pos),i=P.quotesFromString(e.quotes),n=e.parts,s=[],r=0;for(;r<n.length;){let o=n[r];++r,s.push(P.nodeFromJson(o))}let a=s,h=P.extractComments(e);return new vt(t,l,i,a,h.leading,h.trailing)}static textStatementFromJson(e){let t=P.idFromJson(e),l=P.positionFromJson(e.pos),i=P.nodeFromJson(e.content),n=P.extractComments(e),s=new fl(t,l,i,n.leading,n.trailing);return e.condition!=null&&(s.condition=P.nodeFromJson(e.condition),s.conditionStyle=P.conditionStyleFromString(e.conditionStyle),s.conditionPos=P.positionFromJson(e.conditionPos)),s}static dialogueStatementFromJson(e){let t=P.idFromJson(e),l=P.positionFromJson(e.pos),i=P.positionFromJson(e.characterPos),n=P.nodeFromJson(e.content),s=P.extractComments(e),r=new Jt(t,l,e.character,i,n,s.leading,s.trailing);return e.condition!=null&&(r.condition=P.nodeFromJson(e.condition),r.conditionStyle=P.conditionStyleFromString(e.conditionStyle),r.conditionPos=P.positionFromJson(e.conditionPos)),r}static choiceStatementFromJson(e){let t=P.idFromJson(e),l=P.positionFromJson(e.pos),i=e.options,n=[],s=0;for(;s<i.length;){let o=i[s];++s,n.push(P.nodeFromJson(o))}let r=n,a=P.extractComments(e),h=new Vl(t,l,r,a.leading,a.trailing);return h.style=P.blockStyleFromString(e.style),h}static choiceOptionFromJson(e){let t=P.idFromJson(e),l=P.positionFromJson(e.pos),i=e.text!=null?P.nodeFromJson(e.text):null,n=e.insertion!=null?P.nodeFromJson(e.insertion):null,s=e.condition!=null?P.nodeFromJson(e.condition):null,r=e.conditionStyle!=null?P.conditionStyleFromString(e.conditionStyle):0,a=e.body,h=[],o=0;for(;o<a.length;){let g=a[o];++o,h.push(P.nodeFromJson(g))}let u=h,c=P.extractComments(e),f=new Dt(t,l,i,n,s,r,u,c.leading,c.trailing);return f.style=P.blockStyleFromString(e.style),e.once!=null&&e.once&&(f.once=!0),e.conditionPos!=null&&(f.conditionPos=P.positionFromJson(e.conditionPos)),f}static whenStatementFromJson(e){let t=P.idFromJson(e),l=P.positionFromJson(e.pos),i=e.rules,n=[],s=0;for(;s<i.length;){let o=i[s];++s,n.push(P.nodeFromJson(o))}let r=n,a=P.extractComments(e),h=new fi(t,l,e.strategy,r,a.leading,a.trailing);return e.strategyPos!=null&&(h.strategyPos=P.positionFromJson(e.strategyPos)),h.style=P.blockStyleFromString(e.style),h}static whenRuleFromJson(e){let t=P.idFromJson(e),l=P.positionFromJson(e.pos),i=e.condition!=null?P.nodeFromJson(e.condition):null,n=e.body,s=[],r=0;for(;r<n.length;){let u=n[r];++r,s.push(P.nodeFromJson(u))}let a=s,h=P.extractComments(e),o=new xi(t,l,i,a,h.leading,h.trailing);return e.insertion!=null&&(o.insertion=P.nodeFromJson(e.insertion)),e.insertionCondition!=null&&(o.insertionCondition=P.nodeFromJson(e.insertionCondition),o.insertionConditionStyle=e.insertionConditionStyle!=null?P.conditionStyleFromString(e.insertionConditionStyle):0),o.style=P.blockStyleFromString(e.style),e.once!=null&&e.once&&(o.once=!0),o}static blockFromJson(e){let t=P.idFromJson(e),l=P.positionFromJson(e.pos),i=e.body,n=[],s=0;for(;s<i.length;){let o=i[s];++s,n.push(P.nodeFromJson(o))}let r=n,a=P.extractComments(e),h=new kl(t,l,r,a.leading,a.trailing);return h.style=P.blockStyleFromString(e.style),h}static ifStatementFromJson(e){let t=P.idFromJson(e),l=P.positionFromJson(e.pos),i=P.nodeFromJson(e.condition),n=P.conditionStyleFromString(e.conditionStyle),s=e.thenBranch,r=[],a=0;for(;a<s.length;){let _=s[a];++a,r.push(P.nodeFromJson(_))}let h=r,o=new kl(We.UNDEFINED,l,h);o.style=P.blockStyleFromString(e.thenStyle);let u=null;if(e.elseBranch!=null){let _=e.elseBranch,d=[],m=0;for(;m<_.length;){let C=_[m];++m,d.push(P.nodeFromJson(C))}let k=d;u=new kl(We.UNDEFINED,l,k),u.style=P.blockStyleFromString(e.elseStyle)}let c=P.extractComments(e),f=null,g=null;if(e.comments!=null){if(e.comments.elseLeading!=null){let _=e.comments.elseLeading,d=[],m=0;for(;m<_.length;){let k=_[m];++m,d.push(P.commentFromJson(k))}f=d}if(e.comments.elseTrailing!=null){let _=e.comments.elseTrailing,d=[],m=0;for(;m<_.length;){let k=_[m];++m,d.push(P.commentFromJson(k))}g=d}}return new ql(t,l,i,n,o,u,c.leading,c.trailing,f,g)}static alternativeFromJson(e){let t=P.idFromJson(e),l=P.positionFromJson(e.pos),i=P.alternativeModeFromString(e.mode),n=e.items,s=[],r=0;for(;r<n.length;){let u=n[r];++r,s.push(P.nodeFromJson(u))}let a=s,h=P.extractComments(e),o=new hi(t,l,i,a,h.leading,h.trailing);if(o.style=P.blockStyleFromString(e.style),e.separatorComments!=null){let u=e.separatorComments,c=[],f=0;for(;f<u.length;){let g=u[f];if(++f,g!=null){let _=g,d=[],m=0;for(;m<_.length;){let k=_[m];++m,d.push(P.commentFromJson(k))}c.push(d)}else c.push(null)}o.separatorComments=c}return o}static callFromJson(e){let t=P.idFromJson(e),l=P.positionFromJson(e.pos),i=P.nodeFromJson(e.target),n=e.args,s=[],r=0;for(;r<n.length;){let o=n[r];++r,s.push(P.nodeFromJson(o))}let a=s,h=P.extractComments(e);return new zt(t,l,i,a,h.leading,h.trailing)}static transitionFromJson(e){let t=P.idFromJson(e),l=P.positionFromJson(e.pos),i=P.positionFromJson(e.targetPos),n=P.extractComments(e),s=new Bl(t,l,e.target,i,n.leading,n.trailing);if(e.targetExpr!=null&&(s.targetExpr=P.nodeFromJson(e.targetExpr)),e.args!=null){let r=e.args,a=[],h=0;for(;h<r.length;){let o=r[h];++h,a.push(P.nodeFromJson(o))}s.args=a}return s}static beatCallFromJson(e){let t=P.idFromJson(e),l=P.positionFromJson(e.pos),i=P.positionFromJson(e.targetPos),n=P.nodeFromJson(e.targetExpr),s=P.extractComments(e),r=new oi(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(P.nodeFromJson(u))}r.args=h}return r}static insertionFromJson(e){let t=P.idFromJson(e),l=P.positionFromJson(e.pos),i=P.positionFromJson(e.targetPos),n=P.extractComments(e),s=new ni(t,l,e.target,i,n.leading,n.trailing);if(e.targetExpr!=null&&(s.targetExpr=P.nodeFromJson(e.targetExpr)),e.args!=null){let r=e.args,a=[],h=0;for(;h<r.length;){let o=r[h];++h,a.push(P.nodeFromJson(o))}s.args=a}return s}static functionDeclFromJson(e){let t=P.idFromJson(e),l=P.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=P.extractComments(e);return new si(t,l,i,a,e.code,e.external,h.leading,h.trailing)}static literalFromJson(e){let t=P.idFromJson(e),l=P.positionFromJson(e.pos),i=e.literal,n=P.extractComments(e),s,r;switch(i){case"Array":if(s=ze.Array,e.value!=null){let h=e.value,o=[],u=0;for(;u<h.length;){let c=h[u];++u,Object.prototype.hasOwnProperty.call(c,"type")?o.push(P.nodeFromJson(c)):o.push(c)}r=o}else r=null;break;case"Boolean":s=ze.Boolean,r=e.value;break;case"Null":s=ze.Null,r=null;break;case"Number":s=ze.Number,r=e.value;break;case"Object":let a=P.blockStyleFromString(e.style);if(s=ze.Object(a),e.value!=null){let h=e.value,o=[],u=0;for(;u<h.length;){let c=h[u];++u,o.push(P.nodeFromJson(c))}r=o}else r=[];break;default:throw y.thrown("Unknown literal type: "+i)}return new De(t,l,r,s,n.leading,n.trailing)}static accessFromJson(e){let t=P.idFromJson(e),l=P.positionFromJson(e.pos),i=e.target!=null?P.nodeFromJson(e.target):null,n=P.extractComments(e);return new mt(t,l,i,e.name,n.leading,n.trailing)}static assignFromJson(e){let t=P.idFromJson(e),l=P.positionFromJson(e.pos),i=P.nodeFromJson(e.target),n=P.tokenTypeFromString(e.op),s=P.nodeFromJson(e.value),r=P.extractComments(e);return new yl(t,l,i,n,s,r.leading,r.trailing)}static arrayAccessFromJson(e){let t=P.idFromJson(e),l=P.positionFromJson(e.pos),i=P.nodeFromJson(e.target),n=P.nodeFromJson(e.index),s=P.extractComments(e);return new bl(t,l,i,n,s.leading,s.trailing)}static binaryFromJson(e){let t=P.idFromJson(e),l=P.positionFromJson(e.pos),i=P.nodeFromJson(e.left),n=P.tokenTypeFromString(e.op),s=P.nodeFromJson(e.right),r=P.extractComments(e);return new Ht(t,l,i,n,s,r.leading,r.trailing)}static unaryFromJson(e){let t=P.idFromJson(e),l=P.positionFromJson(e.pos),i=P.tokenTypeFromString(e.op),n=P.nodeFromJson(e.operand),s=P.extractComments(e);return new $l(t,l,i,n,s.leading,s.trailing)}static ternaryFromJson(e){let t=P.idFromJson(e),l=P.positionFromJson(e.pos),i=P.nodeFromJson(e.condition),n=P.nodeFromJson(e.trueExpr),s=P.nodeFromJson(e.falseExpr),r=P.extractComments(e);return new wi(t,l,i,n,s,r.leading,r.trailing)}static importStatementFromJson(e){let t=P.idFromJson(e),l=P.positionFromJson(e.pos),i=P.nodeFromJson(e.path),n=e.script!=null?P.scriptFromJson(e.script):null,s=P.extractComments(e);return new Xt(t,l,i,n,s.leading,s.trailing)}static idFromJson(e){let t=e.id;return t!=null?We.fromString(t):We.UNDEFINED}static positionFromJson(e){if(e==null)return new ge(0,0,0,0);let t=e.length!=null?e.length:0;return new ge(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(P.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(P.commentFromJson(r))}l=n}return{leading:t,trailing:l}}static applyComments(e,t){let l=P.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 x.OpAssign;case"OpDivide":return x.OpDivide;case"OpDivideAssign":return x.OpDivideAssign;case"OpGreater":return x.OpGreater;case"OpGreaterEq":return x.OpGreaterEq;case"OpLess":return x.OpLess;case"OpLessEq":return x.OpLessEq;case"OpMinus":return x.OpMinus;case"OpMinusAssign":return x.OpMinusAssign;case"OpModulo":return x.OpModulo;case"OpMultiply":return x.OpMultiply;case"OpMultiplyAssign":return x.OpMultiplyAssign;case"OpPlus":return x.OpPlus;case"OpPlusAssign":return x.OpPlusAssign;case"OpUnquotedAssign":return x.OpUnquotedAssign;default:if(e.startsWith("OpNotEquals"))return x.OpNotEquals(e.indexOf("true")!=-1);if(e.startsWith("OpEquals"))return x.OpEquals(e.indexOf("true")!=-1);if(e.startsWith("OpNot"))return x.OpNot(e.indexOf("true")!=-1);if(e.startsWith("OpAnd"))return x.OpAnd(e.indexOf("true")!=-1);if(e.startsWith("OpOr"))return x.OpOr(e.indexOf("true")!=-1);throw y.thrown("Unknown operator: "+e)}}}J["loreline.JsonToAst"]=P,P.__name__="loreline.JsonToAst";class Nl{constructor(e,t){this.target=e,this.origin=t}}J["loreline.Reference"]=Nl,Nl.__name__="loreline.Reference",Object.assign(Nl.prototype,{__class__:Nl});class zi{constructor(e){this.error=null,this.expr=null,this.lorscript=null,this.func=e,this.codeToLorscript=new Si;try{this.lorscript=this.codeToLorscript.process(e.code)}catch(t){let l=y.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 Bi;t.resumeErrors=!1,t.allowJSON=!0,t.allowTypes=!0;let l=e.name;this.expr=t.parseString(this.lorscript,l??"?")}catch(t){let l=y.caught(t).unwrap();if(this.error==null)if(l instanceof Ie){let i=l,n=i.text,s=n??zi.errorText(i.e),r;if(s!=null)r=s.toString();else{let a=i.e;a._hx_index==9?r=a.msg:r=""}this.error=new tn(i,r,this.codeToLorscript.toLorelinePos(e.pos,i.pmin,i.pmax)),s!=null&&(this.error.template=s.template,this.error.params=s.params)}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 Bi;i.resumeErrors=!0,i.allowJSON=!0,i.allowTypes=!0;let n=e.name;this.expr=i.parseString(this.lorscript,n??"?")}catch{}}}static errorText(e){switch(e._hx_index){case 0:let t=e.c;return new U("Invalid character: '{char}' ({code})",{char:t!=t?"EOF":String.fromCodePoint(t),code:t});case 1:let l=e.s;return new U("Unexpected: {token}",{token:l});case 2:return new U("Unterminated string",null);case 3:return new U("Unterminated multiline comment",null);case 4:let i=e.msg;return new U("Invalid preprocessor: {text}",{text:i});case 5:let n=e.v;return new U("Unknown variable: {name}",{name:n});case 6:let s=e.v;return new U("Invalid iterator: {name}",{name:s});case 7:let r=e.op;return new U("Invalid operator: {op}",{op:r});case 8:let a=e.f;return new U("Invalid access to field {field}",{field:a});case 9:let h=e.msg;return null}}}J["loreline.FuncLorscript"]=zi,zi.__name__="loreline.FuncLorscript",Object.assign(zi.prototype,{__class__:zi});class wn{constructor(e,t){this.completion=null,this.locals=null,e!=null&&(this.locals=e),t!=null&&(this.completion=t)}}J["loreline.LorscriptCompletion"]=wn,wn.__name__="loreline.LorscriptCompletion",Object.assign(wn.prototype,{__class__:wn});class kn{constructor(e,t){this.name=e,this.literal=t}}J["loreline.WhenIndexClause"]=kn,kn.__name__="loreline.WhenIndexClause",Object.assign(kn.prototype,{__class__:kn});class yn{constructor(e,t,l,i){this.start=e,this.end=t,this.pure=l,this.byScore=i}}J["loreline.WhenRun"]=yn,yn.__name__="loreline.WhenRun",Object.assign(yn.prototype,{__class__:yn});class El{constructor(e){this.scopeNodes=[],this.defaultBeats=[],this.whenStatements=[],this.whenRuns=new Fl,this.indexClauses=new Fl,this.pureConditions=new Fl,this.scopedNames=null,this.whenRuleScores=new Fl,this.beatsByNameFromNode=new Fl,this.lorscriptFunctions=new Fl,this.childNodes=null,this.parentNodes=new Fl,this.nodesById=null,this.script=e,this.initialize()}initialize(){let e=this;this.script.each(function(t,l){if(l!=null){let i=t.id.thisVal;e.parentNodes.map._set(i.high,i.low,l)}if(t instanceof fi)e.whenStatements.push(t);else if(t instanceof Kt)(t.temporary||l==null||!(l instanceof Ot))&&e.scopeNodes.push(t);else if(t instanceof Ae){let i=t;i.params!=null&&i.params.length>0&&e.scopeNodes.push(t),i.name=="_"&&!e.isImported(i)&&e.defaultBeats.push(i)}})}isImported(e){let t=e.id.thisVal,l=this.parentNodes.map._get(t.high,t.low);for(;l!=null&&!(l instanceof Ot);){let i=l.id.thisVal;l=this.parentNodes.map._get(i.high,i.low)}return l!=null?l!=this.script:!1}buildNodeMaps(){let e=new Fl,t=new Fl;this.script.each(function(l,i){let n=l.id.thisVal;if(e.map._set(n.high,n.low,l),i!=null){let s=i.id.thisVal,r=t.map._get(s.high,s.low);if(r==null){r=[];let a=i.id.thisVal;t.map._set(a.high,a.low,r)}r.push(l)}}),this.nodesById=e,this.childNodes=t}getWhenStatements(){return this.whenStatements}getDefaultBeats(){return this.defaultBeats}getNodeById(e){this.nodesById==null&&this.buildNodeMaps();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;if(n.length>0&&n.offset<=e.offset&&n.offset+n.length>=e.offset){let s;if(l instanceof et&&n.offset==e.offset){let a=l.partType;if(a._hx_index==0){let h=a.text;s=!0}else s=!1}else s=!1;let r=t!=null&&t.pos.offset+t.pos.length==e.offset;s&&r||(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 le.__instanceof(n,e)&&l.push(n),t||n==i.script?!0:!(n instanceof Xt||n instanceof Ot)}),l}getDialogueSpeakers(e){let t=[],l=Object.create(null);return this.traverse(e,function(i,n){if(i instanceof Jt){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&&le.getClass(l)==t)return l;return null}getNodeFilePath(e,t){let l=[],i=e;for(;i!=null;){let o=this.getFirstParentOfType(i,Xt);if(o!=null)l.push(o),i=o;else break}if(l.length==0)return t;let n=nt.directory(t),s;if(t==null)s=!1;else{let o=t.length;if(o<8)s=!1;else{let u,c,f,g,_,d,m=p.cca(t,o-8);if((m??-1)==46){let k=p.cca(t,o-7),C=k??-1;d=C==108||C==76}else d=!1;if(d){let k=p.cca(t,o-6),C=k??-1;_=C==111||C==79}else _=!1;if(_){let k=p.cca(t,o-5),C=k??-1;g=C==114||C==82}else g=!1;if(g){let k=p.cca(t,o-4);f=(k??-1)==46}else f=!1;if(f){let k=p.cca(t,o-3),C=k??-1;c=C==116||C==84}else c=!1;if(c){let k=p.cca(t,o-2),C=k??-1;u=C==120||C==88}else u=!1;if(u){let k=p.cca(t,o-1),C=k??-1;s=C==116||C==84}else s=!1}}let r=s?".lor.txt":".lor",a=t,h=l.length-1;for(;h>=0;){let o=l[h],u,c=o.path.parts[0].partType;c._hx_index==0?u=c.text:u="",a=Dl.resolveImportPath(n,u,r),n=nt.directory(a),--h}return a}getNodeAncestorFilePaths(e){let t=[],l=e;for(;l!=null;){let r=this.getFirstParentOfType(l,Xt);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=nt.join([nt.directory(n),a]);let o=nt.normalize(n),u;if(o==null)u=null;else{let c;if(o==null)c=!1;else{let f=o.length;if(f<8)c=!1;else{let g,_,d,m,k,C,T=p.cca(o,f-8);if((T??-1)==46){let S=p.cca(o,f-7),v=S??-1;C=v==108||v==76}else C=!1;if(C){let S=p.cca(o,f-6),v=S??-1;k=v==111||v==79}else k=!1;if(k){let S=p.cca(o,f-5),v=S??-1;m=v==114||v==82}else m=!1;if(m){let S=p.cca(o,f-4);d=(S??-1)==46}else d=!1;if(d){let S=p.cca(o,f-3),v=S??-1;_=v==116||v==84}else _=!1;if(_){let S=p.cca(o,f-2),v=S??-1;g=v==120||v==88}else g=!1;if(g){let S=p.cca(o,f-1),v=S??-1;c=v==116||v==84}else c=!1}}if(c){let f=o.length-8;u=f!=null?p.substr(o,0,f):p.substr(o,0,null)}else{let f;if(o==null)f=!1;else{let g=o.length;if(g<4)f=!1;else{let _,d,m=p.cca(o,g-4);if((m??-1)==46){let k=p.cca(o,g-3),C=k??-1;d=C==108||C==76}else d=!1;if(d){let k=p.cca(o,g-2),C=k??-1;_=C==111||C==79}else _=!1;if(_){let k=p.cca(o,g-1),C=k??-1;f=C==114||C==82}else f=!1}}if(f){let g=o.length-4;u=g!=null?p.substr(o,0,g):p.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,Xt);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=nt.join([nt.directory(i),a]),--n}let s=nt.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,c,f,g,_=p.cca(s,a-8);if((_??-1)==46){let d=p.cca(s,a-7),m=d??-1;g=m==108||m==76}else g=!1;if(g){let d=p.cca(s,a-6),m=d??-1;f=m==111||m==79}else f=!1;if(f){let d=p.cca(s,a-5),m=d??-1;c=m==114||m==82}else c=!1;if(c){let d=p.cca(s,a-4);u=(d??-1)==46}else u=!1;if(u){let d=p.cca(s,a-3),m=d??-1;o=m==116||m==84}else o=!1;if(o){let d=p.cca(s,a-2),m=d??-1;h=m==120||m==88}else h=!1;if(h){let d=p.cca(s,a-1),m=d??-1;r=m==116||m==84}else r=!1}}if(r){let a=s.length-8;return a!=null?p.substr(s,0,a):p.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,c=p.cca(s,h-4);if((c??-1)==46){let f=p.cca(s,h-3),g=f??-1;u=g==108||g==76}else u=!1;if(u){let f=p.cca(s,h-2),g=f??-1;o=g==111||g==79}else o=!1;if(o){let f=p.cca(s,h-1),g=f??-1;a=g==114||g==82}else a=!1}}if(a){let h=s.length-4;return h!=null?p.substr(s,0,h):p.substr(s,0,null)}else return s}}}getImportedPaths(e){let t=[],l=this.script,i=new Ce,n=Dl.rootImportPath(e);return i.h[n]=!0,this._getImportedPaths(e,l,t,i),t}_getImportedPaths(e,t,l,i){let n=nt.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,c,f,g,_,d,m=p.cca(e,o-8);if((m??-1)==46){let k=p.cca(e,o-7),C=k??-1;d=C==108||C==76}else d=!1;if(d){let k=p.cca(e,o-6),C=k??-1;_=C==111||C==79}else _=!1;if(_){let k=p.cca(e,o-5),C=k??-1;g=C==114||C==82}else g=!1;if(g){let k=p.cca(e,o-4);f=(k??-1)==46}else f=!1;if(f){let k=p.cca(e,o-3),C=k??-1;c=C==116||C==84}else c=!1;if(c){let k=p.cca(e,o-2),C=k??-1;u=C==120||C==88}else u=!1;if(u){let k=p.cca(e,o-1),C=k??-1;s=C==116||C==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 Xt){let u=o,c,f=u.path.parts[0].partType;f._hx_index==0?c=f.text:c="";let g=Dl.resolveImportPath(n,c,r);Object.prototype.hasOwnProperty.call(i.h,g)||(i.h[g]=!0,l.push(g),u.script!=null&&this._getImportedPaths(g,u.script,l,i))}}return l}resolveArrayAccess(e){let t=null;if(e.target instanceof mt?t=this.resolveAccess(e.target):e.target instanceof bl&&(t=this.resolveArrayAccess(e.target)),t==null)return null;switch(le.getClass(t)){case De:let l=t;if(l.literalType==ze.Array){let n=l.value;if(e.index instanceof De){let s=e.index;if(s.literalType==ze.Number){let r=s.value|0;if(r>=0&&r<n.length){let a=n[r];if(a instanceof _t)return a}}}}break;case ii:let i=t;if(i.value instanceof De){let n=i.value;if(n.literalType==ze.Array){let s=n.value;if(e.index instanceof De){let r=e.index;if(r.literalType==ze.Number){let a=r.value|0;if(a>=0&&a<s.length){let h=s[a];if(h instanceof _t)return h}}}}}break;default:}return null}resolveAccess(e){if(e.target!=null){let a=e.target instanceof mt?this.resolveAccess(e.target):e.target instanceof bl?this.resolveArrayAccess(e.target):null;if(a!=null)switch(a instanceof ii&&(a=a.value),le.getClass(a)){case Zt:let h=a,o=0,u=h.fields;for(;o<u.length;){let d=u[o];if(++o,d.name==e.name)return d}break;case De:let c=a,f=c.literalType;if(f._hx_index==4){let d=f.style,m=c.value,k=0;for(;k<m.length;){let C=m[k];if(++k,C.name==e.name)return C}}break;case mi:let g=0,_=a.fields;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,Ae);for(;l!=null;){let a=null;if(this.traverse(l,function(h,o){if(a!=null)return!1;if(h instanceof Kt){let u=h,c=0,f=u.fields;for(;c<f.length;){let g=f[c];if(++c,g.name==t)return a=g,!1}}return!0}),a!=null)return a;l=this.getFirstParentOfType(l,Ae)}let i=null;if(this.traverse(this.script,function(a,h){if(i!=null)return!1;if(a instanceof Kt){let o=a,u=0,c=o.fields;for(;u<c.length;){let f=c[u];if(++u,f.name==t)return i=f,!1}}return a instanceof Xt?!0:a instanceof Ot}),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??(t=="metadata"?this.script.metadataBlock():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,Ae);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,Ae)}return null}findCallArgument(e){let t=e,l=this.getParentNode(t);for(;l!=null;){switch(le.getClass(l)){case oi:let i=l;if(i.args!=null){let a=i.args.indexOf(t);if(a!=-1)return{owner:l,index:a}}return null;case zt:let n=l;if(n.args!=null){let a=n.args.indexOf(t);if(a!=-1)return{owner:l,index:a}}return null;case ni:let s=l;if(s.args!=null){let a=s.args.indexOf(t);if(a!=-1)return{owner:l,index:a}}return null;case Bl: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 dt))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 Ae){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 Ae?e:null;{let t=this.getFirstParentOfType(e,Ae);for(;t!=null&&!this.isTopLevelNode(t);)t=this.getFirstParentOfType(t,Ae);if(t!=null&&t instanceof Ae)return t}return null}whenRuleScore(e){let t=e.id.thisVal,l=this.whenRuleScores.map._get(t.high,t.low);if(l!=null)return l;let i=Ve.whenRuleScore(e),n=e.id.thisVal;return this.whenRuleScores.map._set(n.high,n.low,i),i}isRootOnlyName(e){return this.scopedNames==null&&(this.scopedNames=this.collectScopedNames()),!Object.prototype.hasOwnProperty.call(this.scopedNames.h,e)}prepareCaches(){this.scopedNames==null&&(this.scopedNames=this.collectScopedNames())}collectScopedNames(){let e=new Ce,t=0,l=this.scopeNodes;for(;t<l.length;){let r=l[t];if(++t,r instanceof Kt){let a=r,h=0,o=a.fields;for(;h<o.length;){let u=o[h];++h,e.h[u.name]=!0}}else{let a=r,h=0,o=a.params;for(;h<o.length;){let u=o[h];++h,e.h[u.name]=!0}}}let i="_whenTick";e.h[i]=!0;let n="_played";e.h[n]=!0;let s="_lastPlayed";return e.h[s]=!0,e}isPureCondition(e){let t=e.id.thisVal,l=this.pureConditions.map._get(t.high,t.low);if(l!=null)return l;let i=!(e instanceof zt||e instanceof yl);i&&e.each(function(s,r){(s instanceof zt||s instanceof yl)&&(i=!1)});let n=e.id.thisVal;return this.pureConditions.map._set(n.high,n.low,i),i}indexClausesOf(e){let t=e.id.thisVal,l=this.indexClauses.map._get(t.high,t.low);if(l!=null)return l;let i=[];this.collectIndexClauses(e,i);let n=e.id.thisVal;return this.indexClauses.map._set(n.high,n.low,i),i}collectIndexClauses(e,t){if(!(e instanceof Ht))return;let l=e,i=l.op;switch(i._hx_index){case 34:let n=i.word,s=this.indexClauseOf(l.left,l.right);s==null&&(s=this.indexClauseOf(l.right,l.left)),s!=null&&t.push(s);break;case 40:let r=i.word;e.parens==0&&(this.collectIndexClauses(l.left,t),this.collectIndexClauses(l.right,t));break;default:}}indexClauseOf(e,t){if(!(e instanceof mt)||!(t instanceof vt))return null;let l=e;if(l.target!=null||!this.isRootOnlyName(l.name))return null;let i=t;if(i.parts.length==0)return null;let n=0,s=i.parts;for(;n<s.length;){let r=s[n];++n;let a=r.partType;if(a._hx_index==0){let h=a.text}else return null}return new kn(l.name,i)}whenRun(e,t){let l=e.id.thisVal,i=this.whenRuns.map._get(l.high,l.low);if(i==null){i=new Xl;let B=e.id.thisVal;this.whenRuns.map._set(B.high,B.low,i)}let n=i.h[t];if(n!=null)return n;let s=t,r=!0;for(;s<e.rules.length&&e.rules[s].insertion==null;){let B=e.rules[s].condition;B!=null&&!this.isPureCondition(B)&&(r=!1),++s}let a=[],h=t,o=s;for(;h<o;){let B=h++;a.push(this.whenRuleScore(e.rules[B]))}let u=a,c=0,f=0;for(;f<u.length;){let B=u[f];++f,B>c&&(c=B)}let g=[],_=0,d=c+2;for(;_<d;){let B=_++;g.push(0)}let m=g,k=0;for(;k<u.length;){let B=u[k];++k,m[c-B+1]++}let C=1,T=m.length;for(;C<T;){let B=C++;m[B]+=m[B-1]}let S=[],v=t,I=s;for(;v<I;){let B=v++;S.push(0)}let E=S,N=t,K=s;for(;N<K;){let B=N++,O=c-u[B-t];E[m[O]]=B,m[O]++}let V=new yn(t,s,r,E);return i.h[t]=V,V}findBeatByNameFromNode(e,t){let l=t.id.thisVal,i=this.beatsByNameFromNode.map._get(l.high,l.low);if(i==null){i=new Ce;let r=t.id.thisVal;this.beatsByNameFromNode.map._set(r.high,r.low,i)}let n=i.h[e];if(n!=null)return n.beat;let s=this.searchBeatByNameFromNode(e,t);return i.h[e]={beat:s},s}searchBeatByNameFromNode(e,t){let l=null,i=this.getFirstParentOfType(t,Ae);for(;i!=null;)this.traverse(i,function(n,s){if(l!=null||n==t)return!1;if(n instanceof Ae){let r=n;return r.name==e&&(l=r),!1}return!0}),i=this.getFirstParentOfType(i,Ae);return l==null&&this.traverse(this.script,function(n,s){if(l==null&&n instanceof Ae){let r=n;r.name==e&&(l=r)}return n instanceof Xt?!0:n instanceof Ot}),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 Zt){let s=i;s.name==e&&(l=s)}return i instanceof Xt?!0:i instanceof Ot}),l}getNameWarnings(){let e=[],t=function(i,n){if(i==null||n==null)return;let s=[],r=0,a=El.scriptsOf(i);for(;r<a.length;){let o=a[r];++r;let u;switch(o){case"Cyrillic":u=qe.format("Cyrillic\xA7letters",null,null);break;case"Greek":u=qe.format("Greek\xA7letters",null,null);break;default:u=qe.format("Latin\xA7letters",null,null)}s.push(u)}let h=s;if(h.length>1){let o=h.pop();e.push({pos:n,message:qe.format("This name mixes {scripts} and {last} letters, often a lookalike typo: {name}",{scripts:h.join(", "),last:o,name:i},null)})}},l=this;return this.script.eachExcludingImported(function(i,n){switch(le.getClass(i)){case mt:let s=i;t(s.name,s.pos),s.target==null&&n instanceof et&&l.checkEmojiAfterName(s,e);break;case Ae:let r=i;if(t(r.name,r.pos),r.params!=null){let _=0,d=r.params;for(;_<d.length;){let m=d[_];++_,t(m.name,m.namePos)}}break;case Zt:let a=i,h=a.namePos;t(a.name,h??a.pos);break;case Jt:let o=i;t(o.character,o.characterPos);break;case si:let u=i;if(t(u.name,u.pos),u.args!=null){let _=0,d=u.args;for(;_<d.length;){let m=d[_];++_,t(m,u.pos)}}break;case ni:let c=i;t(c.target,c.targetPos);break;case ii:let f=i;t(f.name,f.pos);break;case fl:l.checkFullWidthColon(i,e);break;case Bl:let g=i;t(g.target,g.targetPos);break;default:}}),e}checkFullWidthColon(e,t){if(e.content==null||e.content.parts.length==0)return;let l=e.content.parts[0].partType;if(l._hx_index==0){let i=l.text,n=0;for(;Q.isPart(D.stringCodeAt(i,n));)n+=D.stringUnitsAt(i,n);let s=n;if(s==0)return;let r=s;for(;D.stringCodeAt(i,r)==32||D.stringCodeAt(i,r)==9;)++r;if(D.stringCodeAt(i,r)!=65306)return;let a=s!=null?p.substr(i,0,s):p.substr(i,0,null);if(this.findCharacterByNameFromNode(a,e)==null)return;t.push({pos:e.pos,message:qe.format(`"\uFF1A" looks like ":" but isn't, so this line is narration. Write {name}: to make {name} speak.`,{name:a},null)})}}checkEmojiAfterName(e,t){let l=e.name,i=0;for(;;){let a=D.stringCodeAt(l,i);if(a==-1)return;if(Q.isEmoji(a))break;i+=D.stringUnitsAt(l,i)}if(i==0)return;let n=i!=null?p.substr(l,0,i):p.substr(l,0,null),s=null,r=s!=null?p.substr(l,i,s):p.substr(l,i,null);this.isKnownName(l,e)||!this.isKnownName(n,e)||t.push({pos:e.pos,message:qe.format('No name "{name}" here. To show the value of {before} followed by {after}, write ${{{before}}}{after}.',{name:l,before:n,after:r},null)})}isKnownName(e,t){if(this.findCharacterByNameFromNode(e,t)!=null||this.findFunctionByNameFromNode(e,t)!=null||this.findBeatByNameFromNode(e,t)!=null)return!0;let l=!1;if(this.script.each(function(n,s){if(!l&&n instanceof Kt){let r=0,a=n.fields;for(;r<a.length;){let h=a[r];++r,h.name==e&&(l=!0)}}}),l)return!0;let i=this.getFirstParentOfType(t,Ae);for(;i!=null;){if(i.params!=null){let n=0,s=i.params;for(;n<s.length;){let r=s[n];if(++n,r.name==e)return!0}}i=this.getFirstParentOfType(i,Ae)}return!1}getWhenWarnings(e){let t=[],l=e.strategy;if(l!=null&&l!="first"&&l!="pick"&&this.findFunctionByNameFromNode(l,e)==null){let a=e.strategyPos;t.push({pos:a??e.pos,message:qe.format("Unknown strategy: {strategy}. Use first, pick, or the name of a function. A function provided by the app running the story can be declared with `function {strategy}(rules)`.",{strategy:l},null),isWarning:!0,kind:"unknown-strategy"})}let i=Object.create(null),n=!1,s=0,r=e.rules;for(;s<r.length;){let a=r[s];if(++s,a.insertion!=null||a.condition==null)continue;let h=El.leftmostOperand(a.condition);if(!a.once&&h instanceof $l&&h.pos.offset==a.pos.offset&&h.op._hx_index==30&&t.push({pos:new ge(h.pos.line,h.pos.column,h.pos.offset,1),message:qe.format("This `-` is read as a minus sign in the condition. To play this rule only once, put a space after it: `- `.",null,null),isWarning:!0}),l==null&&!n){let o=Ve.whenRuleScore(a),u=0,c=El.topLevelClauses(a.condition);for(;u<c.length;){let f=c[u];++u;let g=El.comparedValue(f);if(g==null)continue;let _=o+":"+g;if(Object.prototype.hasOwnProperty.call(i,_)){t.push({pos:f.pos,message:qe.format("With the default strategy, rules that compare `{value}` with a number and have as many criteria tie: the one played longest ago wins, not the first that matches. Use `when first` for thresholds.",{value:g},null),isWarning:!0}),n=!0;break}i[_]=!0}}}return t}findFunctionByNameFromNode(e,t){let l=null;return this.traverse(this.script,function(i,n){if(l==null&&i instanceof si){let s=i;s.name==e&&(l=s)}return i instanceof Xt?!0:i instanceof Ot}),l}getMetadata(){return this.script.metadataBlock()}getVisibleCharacters(){let e=[],t=this.script.iterator();for(;t.hasNext();){let l=t.next();l instanceof Zt&&e.push(l)}return e}getVisibleFunctions(){let e=[],t=this.script.iterator();for(;t.hasNext();){let l=t.next();l instanceof si&&e.push(l)}return e}getExternalFunctions(){let e=[],t=0,l=this.getVisibleFunctions();for(;t<l.length;){let i=l[t];++t,i.external&&i.name!=null&&e.push(i)}return e}getVisibleStateFields(e){let t=[],l=new Gl,i=e;for(;i!=null;){if(le.getClass(i)==Kt){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(le.getClass(n)==Kt){let r=n;if(s instanceof Ot){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 c=o.id.thisVal;l._set(c.high,c.low,!0),t.push(o)}}}}}),t}getVisibleBeats(e){let t=[],l=Object.create(null),i=this.getParentNode(e);for(;i!=null;){if(le.getClass(i)==Ae&&this.getParentNode(i)!=null){let s=0,r=this.getNodesOfType(Ae);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(le.getClass(n)==Ae&&s instanceof Ot){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,c=o.trailingComments;for(;u<c.length;){let f=c[u];if(++u,f.isHash){let g=Ue.trim(f.content);e[g]=!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 Ce;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=Ue.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 Gl,l=this;this.traverse(e,function(r,a){switch(le.getClass(r)){case zt:let h=r;if(h.target instanceof mt){let c=h.target;if(c.target==null){let f=l.findBeatFromAccess(c);if(f!=null){let g=f.id,_=new Nl(f,h),d=g.thisVal;t._set(d.high,d.low,_)}}}break;case ni:let o=r;if(o.targetExpr==null){let c=l.findBeatByNameFromNode(o.target,o);if(c!=null){let f=c.id,g=new Nl(c,o),_=f.thisVal;t._set(_.high,_.low,g)}}break;case Bl:let u=r;if(u.targetExpr==null){let c=l.findBeatByNameFromNode(u.target,u);if(c!=null){let f=c.id,g=new Nl(c,u),_=f.thisVal;t._set(_.high,_.low,g)}}break;default:}return!0});let i=[],n=t,s=0;for(;s<n._values.length&&!n._used[s];)++s;for(;s<n._values.length;){let r=n._values[s];for(++s;s<n._values.length&&!n._used[s];)++s;let a=r;i.push(a)}return i}findReferencesToBeat(e){let t=[],l=this;return this.script.each(function(i,n){switch(le.getClass(i)){case zt:let s=i;if(s.target instanceof mt){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 Nl(e,s))}}break;case ni:let r=i;r.target==e.name&&t.push(new Nl(e,r));break;case Bl:let a=i;a.target==e.name&&t.push(new Nl(e,a));break;default:}}),t}findModifiedStateFields(e){let t=Object.create(null),l=this;this.traverse(e,function(u,c){if(le.getClass(u)==yl){let f=u;if(f.target instanceof mt){let g=f.target,_=l.findStateField(g);if(_!=null){let d=_.name,m=new Nl(_,f);t[d]=m}}}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,c){let f=u.target.name.toLowerCase(),g=c.target.name.toLowerCase();return f<g?-1:f>g?1:0}),o}findReadStateFields(e){let t=Object.create(null),l=this;this.traverse(e,function(u,c){if(le.getClass(u)==mt){let f=u;if(c instanceof yl&&c.target==u)return!0;let g=l.findStateField(f);if(g!=null){let _=g.name,d=new Nl(g,f);t[_]=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,c){let f=u.target.name.toLowerCase(),g=c.target.name.toLowerCase();return f<g?-1:f>g?1:0}),o}findBeatCharacters(e){let t=new Gl,l=this;this.traverse(e,function(a,h){switch(le.getClass(a)){case mt:let o=a;if(o.target==null){let f=l.findCharacterByNameFromNode(o.name,o),g;if(f!=null){let _=f.id.thisVal,d=t._get(_.high,_.low);g=!((d!=null?d.origin:null)instanceof Jt)}else g=!1;if(g){let _=f.id,d=new Nl(f,o),m=_.thisVal;t._set(m.high,m.low,d)}}break;case Jt:let u=a,c=l.findCharacterFromDialogue(u);if(c!=null){let f=c.id,g=new Nl(c,u),_=f.thisVal;t._set(_.high,_.low,g)}break;default:}return!0});let i=[],n=t,s=0;for(;s<n._values.length&&!n._used[s];)++s;for(;s<n._values.length;){let a=n._values[s];for(++s;s<n._values.length&&!n._used[s];)++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 Gl,l=[],i=this;return this.traverse(e,function(n,s){if(le.getClass(n)==yl){let r=n;if(r.target instanceof mt){let a=r.target,h=i.resolveAccess(a);if(h instanceof ii){let o=h.id.thisVal;if(!t._exists(o.high,o.low)&&i.getParentNode(h)instanceof Zt){let c=h.id.thisVal;t._set(c.high,c.low,!0),l.push(new Nl(h,n))}}}}return!0}),l}findReadCharacterFields(e){let t=new Gl,l=[],i=this;return this.traverse(e,function(n,s){if(le.getClass(n)==mt){let r=n,a=i.getParentNode(r);if(a instanceof yl&&a.target==r)return!0;let h=i.resolveAccess(r);if(h instanceof ii){let o=h.id.thisVal;if(!t._exists(o.high,o.low)&&i.getParentNode(h)instanceof Zt){let c=h.id.thisVal;t._set(c.high,c.low,!0),l.push(new Nl(h,n))}}}return!0}),l}traverse(e,t){this.childNodes==null&&this.buildNodeMaps();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),Mn.iter(r,s)}},Mn.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,g){if(n!=null)return!1;if(f instanceof Kt){let _=f,d=0,m=_.fields;for(;d<m.length;){let k=m[d];if(++d,k.name==i)return n=k,!1}}return f instanceof Xt?!0:f instanceof Ot}),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 ii&&(o=o.value),le.getClass(o)){case Zt:let f=o,g=0,_=f.fields;for(;g<_.length;){let k=_[g];if(++g,k.name==h)return k}break;case De:let d=o,m=d.literalType;if(m._hx_index==4){let k=m.style,C=d.value,T=0;for(;T<C.length;){let S=C[T];if(++T,S.name==h)return S}}break;default:}break;case 16:let u=l.e,c=l.index;break;default:}return null}isLorscriptExpr(e){return e!=null&&Object.prototype.hasOwnProperty.call(e,"e")?le.__instanceof(Le.field(e,"e"),Y):!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,c="",f=0,g=h-u;for(;f<g;){let k=f++;c+=String.fromCodePoint(32)}a=c+a;let _=null,d=new ct;try{d.types.parser.allowJSON=!0,d.types.parser.allowTypes=!0,d.types.parser.resumeErrors=!0;let k=d.types.parser.parseString(a);d.check(k,null,!0)}catch(k){let C=y.caught(k).unwrap();C instanceof ln&&(_=C)}let m=d.locals;return new wn(m,_)}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}static scriptsOf(e){let t=[],l=0;for(;;){let i=D.stringCodeAt(e,l);if(i==-1)break;let n=Q.scriptOf(i);n!=null&&!t.includes(n)&&t.push(n),l+=D.stringUnitsAt(e,l)}return t}static leftmostOperand(e){return e.parens==0&&e instanceof Ht?El.leftmostOperand(e.left):e}static topLevelClauses(e){if(e.parens==0&&e instanceof Ht){let t=e,l=t.op;if(l._hx_index==40){let i=l.word;return El.topLevelClauses(t.left).concat(El.topLevelClauses(t.right))}}return[e]}static comparedValue(e){if(!(e instanceof Ht))return null;let t=e;switch(t.op._hx_index){case 36:case 37:case 38:case 39:break;default:return null}let l=El.isNumberLiteral(t.right)?t.left:El.isNumberLiteral(t.left)?t.right:null;if(l==null||!(l instanceof mt||l instanceof bl))return null;let i=new Ll;return i.enableComments=!1,Ue.trim(i.print(l))}static isNumberLiteral(e){return e instanceof De?e.literalType._hx_index==0:!1}}J["loreline.Lens"]=El,El.__name__="loreline.Lens",Object.assign(El.prototype,{__class__:El});class _i extends st{constructor(e,t){super(e,t)}static of(e,t){let l=new _i(e.toString(),t);return l.keep(e),l}}J["loreline.LexerError"]=_i,_i.__name__="loreline.LexerError",_i.__super__=st,Object.assign(_i.prototype,{__class__:_i});var li=it["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)};li.__constructs__=[li.Interpolation,li.Tag];class Ul{static toString(e){switch(e){case 0:return"ChoiceBrace";case 1:return"ChoiceIndent";case 2:return"WhenBrace";case 3:return"WhenIndent";case 4:return"StateBrace";case 5:return"StateIndent";case 6:return"CharacterBrace";case 7:return"CharacterIndent";case 8:return"BeatBrace";case 9:return"BeatIndent";case 10:return"AlternativeBrace";case 11:return"AlternativeIndent";case 12:return"Brace";case 13:return"Indent";case 14:return"Bracket"}}}var x=it["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},KwMetadata:{_hx_name:"KwMetadata",_hx_index:2,__enum__:"loreline.TokenType",toString:F},KwBeat:{_hx_name:"KwBeat",_hx_index:3,__enum__:"loreline.TokenType",toString:F},KwCharacter:{_hx_name:"KwCharacter",_hx_index:4,__enum__:"loreline.TokenType",toString:F},KwChoice:{_hx_name:"KwChoice",_hx_index:5,__enum__:"loreline.TokenType",toString:F},KwWhen:{_hx_name:"KwWhen",_hx_index:6,__enum__:"loreline.TokenType",toString:F},KwPublic:{_hx_name:"KwPublic",_hx_index:7,__enum__:"loreline.TokenType",toString:F},KwIf:{_hx_name:"KwIf",_hx_index:8,__enum__:"loreline.TokenType",toString:F},KwElse:{_hx_name:"KwElse",_hx_index:9,__enum__:"loreline.TokenType",toString:F},KwNew:{_hx_name:"KwNew",_hx_index:10,__enum__:"loreline.TokenType",toString:F},KwSequence:{_hx_name:"KwSequence",_hx_index:11,__enum__:"loreline.TokenType",toString:F},KwCycle:{_hx_name:"KwCycle",_hx_index:12,__enum__:"loreline.TokenType",toString:F},KwOnce:{_hx_name:"KwOnce",_hx_index:13,__enum__:"loreline.TokenType",toString:F},KwPick:{_hx_name:"KwPick",_hx_index:14,__enum__:"loreline.TokenType",toString:F},KwShuffle:{_hx_name:"KwShuffle",_hx_index:15,__enum__:"loreline.TokenType",toString:F},Separator:{_hx_name:"Separator",_hx_index:16,__enum__:"loreline.TokenType",toString:F},Function:(w=function(b,e,t,l){return{_hx_index:17,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:18,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:19,n:b,__enum__:"loreline.TokenType",toString:F}},w._hx_name="LNumber",w.__params__=["n"],w),LBoolean:(w=function(b){return{_hx_index:20,b,__enum__:"loreline.TokenType",toString:F}},w._hx_name="LBoolean",w.__params__=["b"],w),LNull:{_hx_name:"LNull",_hx_index:21,__enum__:"loreline.TokenType",toString:F},Identifier:(w=function(b){return{_hx_index:22,name:b,__enum__:"loreline.TokenType",toString:F}},w._hx_name="Identifier",w.__params__=["name"],w),OpAssign:{_hx_name:"OpAssign",_hx_index:23,__enum__:"loreline.TokenType",toString:F},OpPlusAssign:{_hx_name:"OpPlusAssign",_hx_index:24,__enum__:"loreline.TokenType",toString:F},OpMinusAssign:{_hx_name:"OpMinusAssign",_hx_index:25,__enum__:"loreline.TokenType",toString:F},OpMultiplyAssign:{_hx_name:"OpMultiplyAssign",_hx_index:26,__enum__:"loreline.TokenType",toString:F},OpDivideAssign:{_hx_name:"OpDivideAssign",_hx_index:27,__enum__:"loreline.TokenType",toString:F},OpUnquotedAssign:{_hx_name:"OpUnquotedAssign",_hx_index:28,__enum__:"loreline.TokenType",toString:F},OpPlus:{_hx_name:"OpPlus",_hx_index:29,__enum__:"loreline.TokenType",toString:F},OpMinus:{_hx_name:"OpMinus",_hx_index:30,__enum__:"loreline.TokenType",toString:F},OpMultiply:{_hx_name:"OpMultiply",_hx_index:31,__enum__:"loreline.TokenType",toString:F},OpDivide:{_hx_name:"OpDivide",_hx_index:32,__enum__:"loreline.TokenType",toString:F},OpModulo:{_hx_name:"OpModulo",_hx_index:33,__enum__:"loreline.TokenType",toString:F},OpEquals:(w=function(b){return{_hx_index:34,word:b,__enum__:"loreline.TokenType",toString:F}},w._hx_name="OpEquals",w.__params__=["word"],w),OpNotEquals:(w=function(b){return{_hx_index:35,word:b,__enum__:"loreline.TokenType",toString:F}},w._hx_name="OpNotEquals",w.__params__=["word"],w),OpGreater:{_hx_name:"OpGreater",_hx_index:36,__enum__:"loreline.TokenType",toString:F},OpLess:{_hx_name:"OpLess",_hx_index:37,__enum__:"loreline.TokenType",toString:F},OpGreaterEq:{_hx_name:"OpGreaterEq",_hx_index:38,__enum__:"loreline.TokenType",toString:F},OpLessEq:{_hx_name:"OpLessEq",_hx_index:39,__enum__:"loreline.TokenType",toString:F},OpAnd:(w=function(b){return{_hx_index:40,word:b,__enum__:"loreline.TokenType",toString:F}},w._hx_name="OpAnd",w.__params__=["word"],w),OpOr:(w=function(b){return{_hx_index:41,word:b,__enum__:"loreline.TokenType",toString:F}},w._hx_name="OpOr",w.__params__=["word"],w),OpNot:(w=function(b){return{_hx_index:42,word:b,__enum__:"loreline.TokenType",toString:F}},w._hx_name="OpNot",w.__params__=["word"],w),Arrow:{_hx_name:"Arrow",_hx_index:43,__enum__:"loreline.TokenType",toString:F},Colon:{_hx_name:"Colon",_hx_index:44,__enum__:"loreline.TokenType",toString:F},Question:{_hx_name:"Question",_hx_index:45,__enum__:"loreline.TokenType",toString:F},Comma:{_hx_name:"Comma",_hx_index:46,__enum__:"loreline.TokenType",toString:F},Dot:{_hx_name:"Dot",_hx_index:47,__enum__:"loreline.TokenType",toString:F},LBrace:{_hx_name:"LBrace",_hx_index:48,__enum__:"loreline.TokenType",toString:F},RBrace:{_hx_name:"RBrace",_hx_index:49,__enum__:"loreline.TokenType",toString:F},LParen:{_hx_name:"LParen",_hx_index:50,__enum__:"loreline.TokenType",toString:F},RParen:{_hx_name:"RParen",_hx_index:51,__enum__:"loreline.TokenType",toString:F},LBracket:{_hx_name:"LBracket",_hx_index:52,__enum__:"loreline.TokenType",toString:F},RBracket:{_hx_name:"RBracket",_hx_index:53,__enum__:"loreline.TokenType",toString:F},CommentLine:(w=function(b){return{_hx_index:54,content:b,__enum__:"loreline.TokenType",toString:F}},w._hx_name="CommentLine",w.__params__=["content"],w),CommentMultiLine:(w=function(b){return{_hx_index:55,content:b,__enum__:"loreline.TokenType",toString:F}},w._hx_name="CommentMultiLine",w.__params__=["content"],w),CommentHash:(w=function(b){return{_hx_index:56,content:b,__enum__:"loreline.TokenType",toString:F}},w._hx_name="CommentHash",w.__params__=["content"],w),Indent:{_hx_name:"Indent",_hx_index:57,__enum__:"loreline.TokenType",toString:F},Unindent:{_hx_name:"Unindent",_hx_index:58,__enum__:"loreline.TokenType",toString:F},LineBreak:{_hx_name:"LineBreak",_hx_index:59,__enum__:"loreline.TokenType",toString:F},Eof:{_hx_name:"Eof",_hx_index:60,__enum__:"loreline.TokenType",toString:F}};x.__constructs__=[x.KwImport,x.KwState,x.KwMetadata,x.KwBeat,x.KwCharacter,x.KwChoice,x.KwWhen,x.KwPublic,x.KwIf,x.KwElse,x.KwNew,x.KwSequence,x.KwCycle,x.KwOnce,x.KwPick,x.KwShuffle,x.Separator,x.Function,x.LString,x.LNumber,x.LBoolean,x.LNull,x.Identifier,x.OpAssign,x.OpPlusAssign,x.OpMinusAssign,x.OpMultiplyAssign,x.OpDivideAssign,x.OpUnquotedAssign,x.OpPlus,x.OpMinus,x.OpMultiply,x.OpDivide,x.OpModulo,x.OpEquals,x.OpNotEquals,x.OpGreater,x.OpLess,x.OpGreaterEq,x.OpLessEq,x.OpAnd,x.OpOr,x.OpNot,x.Arrow,x.Colon,x.Question,x.Comma,x.Dot,x.LBrace,x.RBrace,x.LParen,x.RParen,x.LBracket,x.RBracket,x.CommentLine,x.CommentMultiLine,x.CommentHash,x.Indent,x.Unindent,x.LineBreak,x.Eof];class pl{static equals(e,t){switch(e._hx_index){case 1:return t._hx_index==1?!0:he.enumEq(e,t);case 2:return t._hx_index==2?!0:he.enumEq(e,t);case 3:return t._hx_index==3?!0:he.enumEq(e,t);case 4:return t._hx_index==4?!0:he.enumEq(e,t);case 5:return t._hx_index==5?!0:he.enumEq(e,t);case 6:return t._hx_index==6?!0:he.enumEq(e,t);case 7:return t._hx_index==7?!0:he.enumEq(e,t);case 8:return t._hx_index==8?!0:he.enumEq(e,t);case 9:return t._hx_index==9?!0:he.enumEq(e,t);case 10:return t._hx_index==10?!0:he.enumEq(e,t);case 11:return t._hx_index==11?!0:he.enumEq(e,t);case 12:return t._hx_index==12?!0:he.enumEq(e,t);case 13:return t._hx_index==13?!0:he.enumEq(e,t);case 14:return t._hx_index==14?!0:he.enumEq(e,t);case 15:return t._hx_index==15?!0:he.enumEq(e,t);case 16:return t._hx_index==16?!0:he.enumEq(e,t);case 18:let l=e.s,i=e.attachments;if(t._hx_index==18){let o=t.s,u=t.attachments,c=t.quotes;return e.quotes==c}else return he.enumEq(e,t);break;case 19:if(t._hx_index==19){let o=t.n;return e.n==o}else return he.enumEq(e,t);break;case 20:if(t._hx_index==20){let o=t.b;return e.b==o}else return he.enumEq(e,t);break;case 21:return t._hx_index==21?!0:he.enumEq(e,t);case 22:if(t._hx_index==22){let o=t.name;return e.name==o}else return he.enumEq(e,t);break;case 23:return t._hx_index==23?!0:he.enumEq(e,t);case 24:return t._hx_index==24?!0:he.enumEq(e,t);case 25:return t._hx_index==25?!0:he.enumEq(e,t);case 26:return t._hx_index==26?!0:he.enumEq(e,t);case 27:return t._hx_index==27?!0:he.enumEq(e,t);case 28:return t._hx_index==28?!0:he.enumEq(e,t);case 29:return t._hx_index==29?!0:he.enumEq(e,t);case 30:return t._hx_index==30?!0:he.enumEq(e,t);case 31:return t._hx_index==31?!0:he.enumEq(e,t);case 32:return t._hx_index==32?!0:he.enumEq(e,t);case 33:return t._hx_index==33?!0:he.enumEq(e,t);case 34:let n=e.word;if(t._hx_index==34){let o=t.word;return!0}else return he.enumEq(e,t);break;case 35:let s=e.word;if(t._hx_index==35){let o=t.word;return!0}else return he.enumEq(e,t);break;case 36:return t._hx_index==36?!0:he.enumEq(e,t);case 37:return t._hx_index==37?!0:he.enumEq(e,t);case 38:return t._hx_index==38?!0:he.enumEq(e,t);case 39:return t._hx_index==39?!0:he.enumEq(e,t);case 40:let r=e.word;if(t._hx_index==40){let o=t.word;return!0}else return he.enumEq(e,t);break;case 41:let a=e.word;if(t._hx_index==41){let o=t.word;return!0}else return he.enumEq(e,t);break;case 42:let h=e.word;if(t._hx_index==42){let o=t.word;return!0}else return he.enumEq(e,t);break;case 43:return t._hx_index==43?!0:he.enumEq(e,t);case 44:return t._hx_index==44?!0:he.enumEq(e,t);case 45:return t._hx_index==45?!0:he.enumEq(e,t);case 47:return t._hx_index==47?!0:he.enumEq(e,t);case 48:return t._hx_index==48?!0:he.enumEq(e,t);case 49:return t._hx_index==49?!0:he.enumEq(e,t);case 50:return t._hx_index==50?!0:he.enumEq(e,t);case 51:return t._hx_index==51?!0:he.enumEq(e,t);case 52:return t._hx_index==52?!0:he.enumEq(e,t);case 53:return t._hx_index==53?!0:he.enumEq(e,t);case 54:if(t._hx_index==54){let o=t.content;return e.content==o}else return he.enumEq(e,t);break;case 55:if(t._hx_index==55){let o=t.content;return e.content==o}else return he.enumEq(e,t);break;case 56:if(t._hx_index==56){let o=t.content;return e.content==o}else return he.enumEq(e,t);break;case 57:return t._hx_index==57?!0:he.enumEq(e,t);case 58:return t._hx_index==58?!0:he.enumEq(e,t);case 59:return t._hx_index==59?!0:he.enumEq(e,t);case 60:return t._hx_index==60?!0:he.enumEq(e,t);default:return he.enumEq(e,t)}}static isComment(e){switch(e._hx_index){case 54:let t=e.content;return!0;case 55:let l=e.content;return!0;case 56:let i=e.content;return!0;default:return!1}}static isAssignOp(e){switch(e._hx_index){case 23:case 24:case 25:case 26:case 27:case 28:return!0;default:return!1}}static isIdentifier(e){if(e._hx_index==22){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:case 6:case 8:return!0;case 11:case 12:case 13:case 14:case 15:case 16:return!0;default:return!1}}static toCodeString(e){switch(e._hx_index){case 0:return"import";case 1:return"state";case 2:return"metadata";case 3:return"beat";case 4:return"character";case 5:return"choice";case 6:return"when";case 7:return"public";case 8:return"if";case 9:return"else";case 10:return"new";case 11:return"sequence";case 12:return"cycle";case 13:return"once";case 14:return"pick";case 15:return"shuffle";case 16:return"--";case 17:let t=e.name,l=e.args,i=e.code,n=e.external;return"function";case 18:let s=e.quotes,r=e.s,a=e.attachments;return"string";case 19:let h=e.n;return"number";case 20:let o=e.b;return"boolean";case 21:return"null";case 22:let u=e.name;return"identifier";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 e.word?"is":"==";case 35:return e.word?"is not":"!=";case 36:return">";case 37:return"<";case 38:return">=";case 39:return"<=";case 40:return e.word?"and":"&&";case 41:return e.word?"or":"||";case 42:return e.word?"not":"!";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:return")";case 52:return"[";case 53:return"]";case 54:let m=e.content;return"comment";case 55:let k=e.content;return"multiline comment";case 56:let C=e.content;return"hash comment";case 57:return"indent";case 58:return"unindent";case 59:return"line break";case 60:return"end of file"}}}J["loreline.TokenTypeHelpers"]=pl,pl.__name__="loreline.TokenTypeHelpers";class Ee{constructor(e,t){this.type=e,this.pos=t}toString(){return""+oe.string(this.type)+" at "+this.pos.toString()}}J["loreline.Token"]=Ee,Ee.__name__="loreline.Token",Object.assign(Ee.prototype,{__class__:Ee});class Bt{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=12,this.tokenized=null,this.strictExprs=[],this.indentLevel=0,this.indentStack=[0],this.indentTokens=[]}tokenize(){let e=[];for(this.tokenized=e;;){let t=this.nextToken();if(t.type==x.Eof){if(this.indentStack.length>1){let l=this.indentStack.length-1,i=0,n=l;for(;i<n;){let s=i++,r=null;r==null&&(r=new ge(this.startLine,this.startColumn,this.pos)),r.length=this.pos-r.offset;let a=new Ee(x.Unindent,r);this.previous=a,e.push(a)}}break}switch(e.push(t),t.type._hx_index){case 1:case 2:this.nextBlock=5;break;case 3:let l=e.length-2;e:for(;l>=0;){let h=e[l].type;switch(h._hx_index){case 54:let o=h.content;--l;break;case 55:let u=h.content;--l;break;default:break e}}let i;if(l>=0)switch(e[l].type._hx_index){case 29:case 43:i=!0;break;default:i=!1}else i=!1;let n=this.pos;for(;n<this.length;){let h=p.cca(this.input,n),o=h??-1;if(o==32||o==9)++n;else break}let s;if(n<this.length){let h=p.cca(this.input,n);s=(h??-1)==40}else s=!1;!i&&!s&&(this.nextBlock=9);break;case 4:this.nextBlock=7;break;case 5:this.nextBlock=1;break;case 6:this.nextBlock=3;break;case 11:case 12:case 13:case 14:case 15:case 16:this.nextBlock=11;break;case 48: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=6;break;case 8:case 9:r=9;break;case 10:case 11:r=10;break;case 12:case 13:case 14:r=12;break}this.stack.push(r),this.nextBlock=12;break;case 52:this.stack.push(14),this.nextBlock=12;break;case 49:case 53:case 58:this.stack.pop(),this.nextBlock=12;break;case 57: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:a=11;break;case 12:case 13:case 14:a=13;break}this.stack.push(a),this.nextBlock=12;break;default:}}return e}nextToken(){if(this.indentTokens.length>0)return this.indentTokens.shift();if(this.skipWhitespace(),this.pos>=this.length){let n=null;n==null&&(n=new ge(this.startLine,this.startColumn,this.pos)),n.length=this.pos-n.offset;let s=new Ee(x.Eof,n);return this.previous=s,s}this.startLine=this.line,this.startColumn=this.column;let e=p.cca(this.input,this.pos),t=e??-1;if(t==10||t==13){let n=this.readLineBreak(),s=this.countIndentation();if(s>this.indentStack[this.indentStack.length-1]){this.indentStack.length==1&&(this.detectedIndentSize=s-this.indentStack[0]),this.indentStack.push(s);let r=this.indentTokens,a=null;a==null&&(a=new ge(this.startLine,this.startColumn,this.pos)),a.length=this.pos-a.offset;let h=new Ee(x.Indent,a);this.previous=h,r.push(h)}else if(s<this.indentStack[this.indentStack.length-1])for(;this.indentStack.length>0&&s<this.indentStack[this.indentStack.length-1];){this.indentStack.pop();let r=this.indentTokens,a=null;a==null&&(a=new ge(this.startLine,this.startColumn,this.pos)),a.length=this.pos-a.offset;let h=new Ee(x.Unindent,a);this.previous=h,r.push(h)}return n}let l=new ge(this.startLine,this.startColumn,this.pos),i;if(this.followsImportKeyword()){let n;if(t==47){let s;if(this.pos+1<this.length){let r=p.cca(this.input,this.pos+1);s=r??-1}else s=0;if(s!=47){let r;if(this.pos+1<this.length){let a=p.cca(this.input,this.pos+1);r=a??-1}else r=0;n=r==42}else n=!0}else n=!1;i=!n}else i=!1;if(i)return this.readImportValue(t,l);switch(t){case 34:let n=this.tryReadUnquotedString();return n??this.readString(l);case 91:let s=0,r=1;for(;s<r;){let C=s++;if(this.pos>=this.length)break;let T=p.cca(this.input,this.pos);(T??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.makeLooseOrStrictAfterBracket();let a=l;a==null&&(a=new ge(this.startLine,this.startColumn,this.pos)),a.length=this.pos-a.offset;let h=new Ee(x.LBracket,a);return this.previous=h,h;case 123:let o=0,u=1;for(;o<u;){let C=o++;if(this.pos>=this.length)break;let T=p.cca(this.input,this.pos);(T??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let c=l;c==null&&(c=new ge(this.startLine,this.startColumn,this.pos)),c.length=this.pos-c.offset;let f=new Ee(x.LBrace,c);return this.previous=f,f;case 125:let g=0,_=1;for(;g<_;){let C=g++;if(this.pos>=this.length)break;let T=p.cca(this.input,this.pos);(T??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let d=l;d==null&&(d=new ge(this.startLine,this.startColumn,this.pos)),d.length=this.pos-d.offset;let m=new Ee(x.RBrace,d);return this.previous=m,m;default:let k=this.tryReadUnquotedString();if(k!=null)return k;switch(t){case 33:let C=t;if(C>=48&&C<=57)return this.readNumber();if(Q.isStart(D.stringCodeAt(this.input,this.pos)))return this.readIdentifier();{let fe;if(this.pos+1<this.length){let j=p.cca(this.input,this.pos+1);fe=j??-1}else fe=0;if(fe==61){let j=2;j==null&&(j=1);let re=0,te=j;for(;re<te;){let we=re++;if(this.pos>=this.length)break;let Se=p.cca(this.input,this.pos);(Se??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ne=l;ne==null&&(ne=new ge(this.startLine,this.startColumn,this.pos)),ne.length=this.pos-ne.offset;let xe=new Ee(x.OpNotEquals(!1),ne);return this.previous=xe,xe}else{let j=0,re=1;for(;j<re;){let xe=j++;if(this.pos>=this.length)break;let we=p.cca(this.input,this.pos);(we??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let te=l;te==null&&(te=new ge(this.startLine,this.startColumn,this.pos)),te.length=this.pos-te.offset;let ne=new Ee(x.OpNot(!1),te);return this.previous=ne,ne}}break;case 35:let T=t;if(T>=48&&T<=57)return this.readNumber();if(Q.isStart(D.stringCodeAt(this.input,this.pos)))return this.readIdentifier();{let fe=D.stringCodeAt(this.input,this.pos+1);return Q.isStart(fe)||fe>=48&&fe<=57||fe==45?this.readHashComment():(this.error(new U("Unexpected character: {text}",{text:"#"}),!0),null)}break;case 37:let S=t;if(S>=48&&S<=57)return this.readNumber();if(Q.isStart(D.stringCodeAt(this.input,this.pos)))return this.readIdentifier();{let fe=0,j=1;for(;fe<j;){let ne=fe++;if(this.pos>=this.length)break;let xe=p.cca(this.input,this.pos);(xe??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let re=l;re==null&&(re=new ge(this.startLine,this.startColumn,this.pos)),re.length=this.pos-re.offset;let te=new Ee(x.OpModulo,re);return this.previous=te,te}break;case 38:let v=t;if(v>=48&&v<=57)return this.readNumber();if(Q.isStart(D.stringCodeAt(this.input,this.pos)))return this.readIdentifier();{let fe;if(this.pos+1<this.length){let j=p.cca(this.input,this.pos+1);fe=j??-1}else fe=0;if(fe==38){let j=2;j==null&&(j=1);let re=0,te=j;for(;re<te;){let we=re++;if(this.pos>=this.length)break;let Se=p.cca(this.input,this.pos);(Se??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ne=l;ne==null&&(ne=new ge(this.startLine,this.startColumn,this.pos)),ne.length=this.pos-ne.offset;let xe=new Ee(x.OpAnd(!1),ne);return this.previous=xe,xe}else{let j=0,re=1;for(;j<re;){let xe=j++;if(this.pos>=this.length)break;let we=p.cca(this.input,this.pos);(we??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.error(new U("Write && (or and), not a single &",null),!1);let te=l;te==null&&(te=new ge(this.startLine,this.startColumn,this.pos)),te.length=this.pos-te.offset;let ne=new Ee(x.OpAnd(!1),te);return this.previous=ne,ne}}break;case 40:let I=0,E=1;for(;I<E;){let fe=I++;if(this.pos>=this.length)break;let j=p.cca(this.input,this.pos);(j??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.makeStrictIfFollowingCallable();let N=l;N==null&&(N=new ge(this.startLine,this.startColumn,this.pos)),N.length=this.pos-N.offset;let K=new Ee(x.LParen,N);return this.previous=K,K;case 41:let V=0,B=1;for(;V<B;){let fe=V++;if(this.pos>=this.length)break;let j=p.cca(this.input,this.pos);(j??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.strictExprs.pop();let O=l;O==null&&(O=new ge(this.startLine,this.startColumn,this.pos)),O.length=this.pos-O.offset;let q=new Ee(x.RParen,O);return this.previous=q,q;case 42:let R=t;if(R>=48&&R<=57)return this.readNumber();if(Q.isStart(D.stringCodeAt(this.input,this.pos)))return this.readIdentifier();{let fe;if(this.pos+1<this.length){let j=p.cca(this.input,this.pos+1);fe=j??-1}else fe=0;if(fe==61){let j=2;j==null&&(j=1);let re=0,te=j;for(;re<te;){let we=re++;if(this.pos>=this.length)break;let Se=p.cca(this.input,this.pos);(Se??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ne=l;ne==null&&(ne=new ge(this.startLine,this.startColumn,this.pos)),ne.length=this.pos-ne.offset;let xe=new Ee(x.OpMultiplyAssign,ne);return this.previous=xe,xe}else{let j=0,re=1;for(;j<re;){let xe=j++;if(this.pos>=this.length)break;let we=p.cca(this.input,this.pos);(we??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let te=l;te==null&&(te=new ge(this.startLine,this.startColumn,this.pos)),te.length=this.pos-te.offset;let ne=new Ee(x.OpMultiply,te);return this.previous=ne,ne}}break;case 43:let A=t;if(A>=48&&A<=57)return this.readNumber();if(Q.isStart(D.stringCodeAt(this.input,this.pos)))return this.readIdentifier();{let fe;if(this.pos+1<this.length){let j=p.cca(this.input,this.pos+1);fe=j??-1}else fe=0;if(fe==61){let j=2;j==null&&(j=1);let re=0,te=j;for(;re<te;){let we=re++;if(this.pos>=this.length)break;let Se=p.cca(this.input,this.pos);(Se??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ne=l;ne==null&&(ne=new ge(this.startLine,this.startColumn,this.pos)),ne.length=this.pos-ne.offset;let xe=new Ee(x.OpPlusAssign,ne);return this.previous=xe,xe}else{let j=0,re=1;for(;j<re;){let xe=j++;if(this.pos>=this.length)break;let we=p.cca(this.input,this.pos);(we??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let te=l;te==null&&(te=new ge(this.startLine,this.startColumn,this.pos)),te.length=this.pos-te.offset;let ne=new Ee(x.OpPlus,te);return this.previous=ne,ne}}break;case 44:let L=0,H=1;for(;L<H;){let fe=L++;if(this.pos>=this.length)break;let j=p.cca(this.input,this.pos);(j??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let $=l;$==null&&($=new ge(this.startLine,this.startColumn,this.pos)),$.length=this.pos-$.offset;let M=new Ee(x.Comma,$);return this.previous=M,M;case 45:let Z=t;if(Z>=48&&Z<=57)return this.readNumber();if(Q.isStart(D.stringCodeAt(this.input,this.pos)))return this.readIdentifier();{let fe;if(this.pos+1<this.length){let j=p.cca(this.input,this.pos+1);fe=j??-1}else fe=0;if(fe==62){let j=2;j==null&&(j=1);let re=0,te=j;for(;re<te;){let we=re++;if(this.pos>=this.length)break;let Se=p.cca(this.input,this.pos);(Se??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ne=l;ne==null&&(ne=new ge(this.startLine,this.startColumn,this.pos)),ne.length=this.pos-ne.offset;let xe=new Ee(x.Arrow,ne);return this.previous=xe,xe}else{let j;if(this.pos+1<this.length){let re=p.cca(this.input,this.pos+1);j=re??-1}else j=0;if(j==45&&this.strictExprs.length==0){let re=2;re==null&&(re=1);let te=0,ne=re;for(;te<ne;){let Se=te++;if(this.pos>=this.length)break;let ot=p.cca(this.input,this.pos);(ot??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let xe=l;xe==null&&(xe=new ge(this.startLine,this.startColumn,this.pos)),xe.length=this.pos-xe.offset;let we=new Ee(x.Separator,xe);return this.previous=we,we}else{let re;if(this.pos+1<this.length){let te=p.cca(this.input,this.pos+1);re=te??-1}else re=0;if(re==61){let te=2;te==null&&(te=1);let ne=0,xe=te;for(;ne<xe;){let ot=ne++;if(this.pos>=this.length)break;let Lt=p.cca(this.input,this.pos);(Lt??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let we=l;we==null&&(we=new ge(this.startLine,this.startColumn,this.pos)),we.length=this.pos-we.offset;let Se=new Ee(x.OpMinusAssign,we);return this.previous=Se,Se}else{let te=0,ne=1;for(;te<ne;){let Se=te++;if(this.pos>=this.length)break;let ot=p.cca(this.input,this.pos);(ot??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let xe=l;xe==null&&(xe=new ge(this.startLine,this.startColumn,this.pos)),xe.length=this.pos-xe.offset;let we=new Ee(x.OpMinus,xe);return this.previous=we,we}}}}break;case 46:let ae=0,ie=1;for(;ae<ie;){let fe=ae++;if(this.pos>=this.length)break;let j=p.cca(this.input,this.pos);(j??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ue=l;ue==null&&(ue=new ge(this.startLine,this.startColumn,this.pos)),ue.length=this.pos-ue.offset;let de=new Ee(x.Dot,ue);return this.previous=de,de;case 47:let ye=t;if(ye>=48&&ye<=57)return this.readNumber();if(Q.isStart(D.stringCodeAt(this.input,this.pos)))return this.readIdentifier();{let fe;if(this.pos+1<this.length){let j=p.cca(this.input,this.pos+1);fe=j??-1}else fe=0;if(fe==61){let j=2;j==null&&(j=1);let re=0,te=j;for(;re<te;){let we=re++;if(this.pos>=this.length)break;let Se=p.cca(this.input,this.pos);(Se??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ne=l;ne==null&&(ne=new ge(this.startLine,this.startColumn,this.pos)),ne.length=this.pos-ne.offset;let xe=new Ee(x.OpDivideAssign,ne);return this.previous=xe,xe}else{let j;if(this.pos+1<this.length){let re=p.cca(this.input,this.pos+1);j=re??-1}else j=0;if(j==47)return this.readLineComment();{let re;if(this.pos+1<this.length){let te=p.cca(this.input,this.pos+1);re=te??-1}else re=0;if(re==42)return this.readMultiLineComment();{let te=0,ne=1;for(;te<ne;){let Se=te++;if(this.pos>=this.length)break;let ot=p.cca(this.input,this.pos);(ot??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let xe=l;xe==null&&(xe=new ge(this.startLine,this.startColumn,this.pos)),xe.length=this.pos-xe.offset;let we=new Ee(x.OpDivide,xe);return this.previous=we,we}}}}break;case 58:let ce;if(this.pos+1<this.length){let fe=p.cca(this.input,this.pos+1);ce=fe??-1}else ce=0;if(ce==61){let fe=2;fe==null&&(fe=1);let j=0,re=fe;for(;j<re;){let xe=j++;if(this.pos>=this.length)break;let we=p.cca(this.input,this.pos);(we??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let te=l;te==null&&(te=new ge(this.startLine,this.startColumn,this.pos)),te.length=this.pos-te.offset;let ne=new Ee(x.OpUnquotedAssign,te);return this.previous=ne,ne}else{let fe=0,j=1;for(;fe<j;){let ne=fe++;if(this.pos>=this.length)break;let xe=p.cca(this.input,this.pos);(xe??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let re=l;re==null&&(re=new ge(this.startLine,this.startColumn,this.pos)),re.length=this.pos-re.offset;let te=new Ee(x.Colon,re);return this.previous=te,te}break;case 60:let pe=t;if(pe>=48&&pe<=57)return this.readNumber();if(Q.isStart(D.stringCodeAt(this.input,this.pos)))return this.readIdentifier();{let fe;if(this.pos+1<this.length){let j=p.cca(this.input,this.pos+1);fe=j??-1}else fe=0;if(fe==61){let j=2;j==null&&(j=1);let re=0,te=j;for(;re<te;){let we=re++;if(this.pos>=this.length)break;let Se=p.cca(this.input,this.pos);(Se??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ne=l;ne==null&&(ne=new ge(this.startLine,this.startColumn,this.pos)),ne.length=this.pos-ne.offset;let xe=new Ee(x.OpLessEq,ne);return this.previous=xe,xe}else{let j=0,re=1;for(;j<re;){let xe=j++;if(this.pos>=this.length)break;let we=p.cca(this.input,this.pos);(we??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let te=l;te==null&&(te=new ge(this.startLine,this.startColumn,this.pos)),te.length=this.pos-te.offset;let ne=new Ee(x.OpLess,te);return this.previous=ne,ne}}break;case 61:let Je=t;if(Je>=48&&Je<=57)return this.readNumber();if(Q.isStart(D.stringCodeAt(this.input,this.pos)))return this.readIdentifier();{let fe;if(this.pos+1<this.length){let j=p.cca(this.input,this.pos+1);fe=j??-1}else fe=0;if(fe==61){let j=2;j==null&&(j=1);let re=0,te=j;for(;re<te;){let we=re++;if(this.pos>=this.length)break;let Se=p.cca(this.input,this.pos);(Se??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ne=l;ne==null&&(ne=new ge(this.startLine,this.startColumn,this.pos)),ne.length=this.pos-ne.offset;let xe=new Ee(x.OpEquals(!1),ne);return this.previous=xe,xe}else{let j=0,re=1;for(;j<re;){let xe=j++;if(this.pos>=this.length)break;let we=p.cca(this.input,this.pos);(we??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let te=l;te==null&&(te=new ge(this.startLine,this.startColumn,this.pos)),te.length=this.pos-te.offset;let ne=new Ee(x.OpAssign,te);return this.previous=ne,ne}}break;case 62:let tt=t;if(tt>=48&&tt<=57)return this.readNumber();if(Q.isStart(D.stringCodeAt(this.input,this.pos)))return this.readIdentifier();{let fe;if(this.pos+1<this.length){let j=p.cca(this.input,this.pos+1);fe=j??-1}else fe=0;if(fe==61){let j=2;j==null&&(j=1);let re=0,te=j;for(;re<te;){let we=re++;if(this.pos>=this.length)break;let Se=p.cca(this.input,this.pos);(Se??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ne=l;ne==null&&(ne=new ge(this.startLine,this.startColumn,this.pos)),ne.length=this.pos-ne.offset;let xe=new Ee(x.OpGreaterEq,ne);return this.previous=xe,xe}else{let j=0,re=1;for(;j<re;){let xe=j++;if(this.pos>=this.length)break;let we=p.cca(this.input,this.pos);(we??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let te=l;te==null&&(te=new ge(this.startLine,this.startColumn,this.pos)),te.length=this.pos-te.offset;let ne=new Ee(x.OpGreater,te);return this.previous=ne,ne}}break;case 63:let Ge=t;if(Ge>=48&&Ge<=57)return this.readNumber();if(Q.isStart(D.stringCodeAt(this.input,this.pos)))return this.readIdentifier();{this.pos++;let fe=null;fe==null&&(fe=new ge(this.startLine,this.startColumn,this.pos)),fe.length=this.pos-fe.offset;let j=new Ee(x.Question,fe);return this.previous=j,j}break;case 93:let ht=0,Ze=1;for(;ht<Ze;){let fe=ht++;if(this.pos>=this.length)break;let j=p.cca(this.input,this.pos);(j??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.strictExprs.pop();let $e=l;$e==null&&($e=new ge(this.startLine,this.startColumn,this.pos)),$e.length=this.pos-$e.offset;let xt=new Ee(x.RBracket,$e);return this.previous=xt,xt;case 124:let Ke=t;if(Ke>=48&&Ke<=57)return this.readNumber();if(Q.isStart(D.stringCodeAt(this.input,this.pos)))return this.readIdentifier();{let fe;if(this.pos+1<this.length){let j=p.cca(this.input,this.pos+1);fe=j??-1}else fe=0;if(fe==124){let j=2;j==null&&(j=1);let re=0,te=j;for(;re<te;){let we=re++;if(this.pos>=this.length)break;let Se=p.cca(this.input,this.pos);(Se??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let ne=l;ne==null&&(ne=new ge(this.startLine,this.startColumn,this.pos)),ne.length=this.pos-ne.offset;let xe=new Ee(x.OpOr(!1),ne);return this.previous=xe,xe}else{let j=0,re=1;for(;j<re;){let xe=j++;if(this.pos>=this.length)break;let we=p.cca(this.input,this.pos);(we??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.error(new U("Write || (or or), not a single |",null),!1);let te=l;te==null&&(te=new ge(this.startLine,this.startColumn,this.pos)),te.length=this.pos-te.offset;let ne=new Ee(x.OpOr(!1),te);return this.previous=ne,ne}}break;default:let at=t;return at>=48&&at<=57?this.readNumber():Q.isStart(D.stringCodeAt(this.input,this.pos))?this.readIdentifier():(this.error(Q.unexpectedCharacterMessage(D.stringCodeAt(this.input,this.pos)),!0),null)}}}isPublicBeatStart(e){let t=e,l;if(t<this.length){let i=p.cca(this.input,t),n=i??-1;l=!(n==32||n==9)}else l=!0;if(l)return!1;for(;;){let i;if(t<this.length){let n=p.cca(this.input,t),s=n??-1;i=s==32||s==9}else i=!1;if(!i)break;++t}return this.wordEnd(t,"beat")!=-1}followsImportKeyword(){if(this.tokenized==null)return!1;let e=this.tokenized.length-1;for(;e>=0;){let t=this.tokenized[e].type;switch(t._hx_index){case 0:return!0;case 54:let l=t.content;--e;break;case 55:let i=t.content;--e;break;default:return!1}}return!1}countIndentation(){let e=this.pos,t=0;for(;e<this.length;){let n=p.cca(this.input,e),s=n??-1;if(s==32)++t;else if(s==9)++t;else break;++e}let l,i;if(e<this.length){let n=p.cca(this.input,e);i=(n??-1)==10}else i=!0;if(i)l=!0;else{let n=p.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]!=12&&this.stack[e]!=13&&this.stack[e]!=14)switch(this.stack[e]){case 0:case 1:return x.KwBeat;case 2:case 3:return x.KwBeat;case 4:case 5:return x.KwState;case 6:case 7:return x.KwCharacter;case 8:case 9:return x.KwBeat;case 10:case 11:return x.KwBeat;case 12:return x.LBrace;case 13:return x.Indent;case 14:return x.LBracket}--e}return x.KwBeat}inBeat(){return this.parentBlockType()==x.KwBeat}inChoiceRoot(){return this.stack.length>0?this.stack[this.stack.length-1]!=1?this.stack[this.stack.length-1]==0:!0:!1}inWhenRoot(){if(this.stack.length==0)return!1;let e=this.stack[this.stack.length-1];return e==3||e==2?!0:e==13&&this.stack.length>1?this.stack[this.stack.length-2]==2:!1}isWhenStart(e){let t=this.wordEnd(e,"when");if(t==-1||this.parentBlockType()!=x.KwBeat||this.inChoiceRoot()||this.inWhenRoot())return!1;let l=e;for(;;){let f;if(l>0){let g=p.cca(this.input,l-1);if((g??-1)!=32){let _=p.cca(this.input,l-1);f=(_??-1)==9}else f=!0}else f=!1;if(!f)break;--l}let i,n;if(l>0){let f=p.cca(this.input,l-1);n=(f??-1)!=10}else n=!1;if(n){let f=p.cca(this.input,l-1);i=(f??-1)!=13}else i=!1;if(i)return!1;let s=e-l,r=this.skipInlineSpacesAndComments(t);if(r<this.length&&Q.isStart(D.stringCodeAt(this.input,r))){let f=this.input,g=r;for(;Q.isPart(D.stringCodeAt(f,g));)g+=D.stringUnitsAt(f,g);r=g,r=this.skipInlineSpacesAndComments(r)}let a;if(r<this.length){let f=p.cca(this.input,r);a=(f??-1)==123}else a=!1;if(a)return!0;let h,o;if(r<this.length){let f=p.cca(this.input,r);o=(f??-1)==47}else o=!1;if(o&&r+1<this.length){let f=p.cca(this.input,r+1);h=(f??-1)==47}else h=!1;if(h)for(;;){let f,g;if(r<this.length){let _=p.cca(this.input,r);g=(_??-1)!=10}else g=!1;if(g){let _=p.cca(this.input,r);f=(_??-1)!=13}else f=!1;if(!f)break;++r}let u,c;if(r<this.length){let f=p.cca(this.input,r);c=(f??-1)!=10}else c=!1;if(c){let f=p.cca(this.input,r);u=(f??-1)!=13}else u=!1;return u?!1:this.nextLineOpensBlock(r,s)}isMetadataStart(e){let t=this.wordEnd(e,"metadata");if(t==-1||this.stack.length>0)return!1;let l,i;if(e>0){let u=p.cca(this.input,e-1);i=(u??-1)!=10}else i=!1;if(i){let u=p.cca(this.input,e-1);l=(u??-1)!=13}else l=!1;if(l)return!1;let n=this.skipInlineSpacesAndComments(t),s;if(n<this.length){let u=p.cca(this.input,n);s=(u??-1)==123}else s=!1;if(s)return!0;let r,a;if(n<this.length){let u=p.cca(this.input,n);a=(u??-1)==47}else a=!1;if(a&&n+1<this.length){let u=p.cca(this.input,n+1);r=(u??-1)==47}else r=!1;if(r)for(;;){let u,c;if(n<this.length){let f=p.cca(this.input,n);c=(f??-1)!=10}else c=!1;if(c){let f=p.cca(this.input,n);u=(f??-1)!=13}else u=!1;if(!u)break;++n}let h,o;if(n<this.length){let u=p.cca(this.input,n);o=(u??-1)!=10}else o=!1;if(o){let u=p.cca(this.input,n);h=(u??-1)!=13}else h=!1;return h?!1:this.nextLineOpensBlock(n,0)}nextLineOpensBlock(e,t){for(;e<this.length;){for(;;){let s,r;if(e<this.length){let a=p.cca(this.input,e);r=(a??-1)!=10}else r=!1;if(r){let a=p.cca(this.input,e);s=(a??-1)!=13}else s=!1;if(!s)break;++e}for(;;){let s;if(e<this.length){let r=p.cca(this.input,e);if((r??-1)!=10){let a=p.cca(this.input,e);s=(a??-1)==13}else s=!0}else s=!1;if(!s)break;++e}let l=e;for(;;){let s;if(e<this.length){let r=p.cca(this.input,e);if((r??-1)!=32){let a=p.cca(this.input,e);s=(a??-1)==9}else s=!0}else s=!1;if(!s)break;++e}if(e>=this.length)return!1;let i=p.cca(this.input,e),n=i??-1;if(!(n==10||n==13))return n==123?!0:e-l>t}return!1}inStateOrCharacter(){let e=this.parentBlockType();return e!=x.KwState?e==x.KwCharacter:!0}readLineBreak(){let e=new ge(this.startLine,this.startColumn,this.pos),t=p.cca(this.input,this.pos);if((t??-1)==13){let n=0,s=1;for(;n<s;){let a=n++;if(this.pos>=this.length)break;let h=p.cca(this.input,this.pos);(h??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let r;if(this.pos<this.length){let a=p.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=p.cca(this.input,this.pos);(u??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}else{let n=0,s=1;for(;n<s;){let r=n++;if(this.pos>=this.length)break;let a=p.cca(this.input,this.pos);(a??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let l=e;l==null&&(l=new ge(this.startLine,this.startColumn,this.pos)),l.length=this.pos-l.offset;let i=new Ee(x.LineBreak,l);return this.previous=i,i}isWhitespace(e){return e!=32?e==9:!0}matchIdentifier(e){if(!Q.isStart(D.stringCodeAt(this.input,e)))return null;let t=this.input,l=this.input,i=e;for(;Q.isPart(D.stringCodeAt(l,i));)i+=D.stringUnitsAt(l,i);let n=i-e;return n!=null?p.substr(t,e,n):p.substr(t,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=p.cca(this.input,e);if((s??-1)!=32){let r=p.cca(this.input,e);n=(r??-1)==9}else n=!0}else n=!1;if(!n)break;++e,i=!0}if(e<this.length-1){let n=p.cca(this.input,e);if((n??-1)==47){let s=p.cca(this.input,e+1);if((s??-1)==47)return e=l,e;{let r=p.cca(this.input,e+1);if((r??-1)==42){e+=2,i=!0;let a=!1;for(;e<this.length-1;){let h,o=p.cca(this.input,e);if((o??-1)==42){let u=p.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=p.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=p.cca(this.input,e);if((n??-1)==47){let s=p.cca(this.input,e+1);if((s??-1)==47){for(e+=2,l=!0;;){let r,a;if(e<this.length){let h=p.cca(this.input,e);a=(h??-1)!=10}else a=!1;if(a){let h=p.cca(this.input,e);r=(h??-1)!=13}else r=!1;if(!r)break;++e}continue}else{let r=p.cca(this.input,e+1);if((r??-1)==42){e+=2,l=!0;let a=!1;for(;e<this.length-1;){let h,o=p.cca(this.input,e);if((o??-1)==42){let u=p.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=p.cca(this.input,e);if((t??-1)!=105)return!1;++e;let l=p.cca(this.input,e);return(l??-1)!=102||(++e,e<this.length&&Q.isPart(D.stringCodeAt(this.input,e)))?!1:this.isConditionUntilLineEnd(e)}isConditionUntilLineEnd(e){let t=!0;for(;;)if(e=this.skipInlineSpacesAndComments(e),t){if(e>=this.length)return!1;let l=p.cca(this.input,e),i=l??-1,n;if(e+1<this.length){let r=p.cca(this.input,e+1);n=r??-1}else n=0;if(i==33&&n!=61){++e;continue}if(i==45&&n!=62){++e;continue}let s=this.wordEnd(e,"not");if(s!=-1){e=s;continue}if(e=this.conditionOperandEnd(e),e==-1)return!1;t=!1}else{if(this.isConditionEnd(e))return!0;if(e=this.conditionOperatorEnd(e),e==-1)return!1;t=!0}}isConditionEnd(e){if(e>=this.length)return!0;let t=p.cca(this.input,e),l=t??-1,i;if(e+1<this.length){let n=p.cca(this.input,e+1);i=n??-1}else i=0;return l==10||l==13||l==123||l==35||l==47&&i==47?!0:l==45?i==62:!1}skipInlineSpacesAndComments(e){for(;e<this.length;){let t=p.cca(this.input,e),l=t??-1;if(l==32||l==9)++e;else{let i;if(l==47&&e+1<this.length){let n=p.cca(this.input,e+1);i=(n??-1)==42}else i=!1;if(i){let n=e+2;for(;;){let s;if(n+1<this.length){let a,h=p.cca(this.input,n);if((h??-1)==42){let o=p.cca(this.input,n+1);a=(o??-1)==47}else a=!1;s=!a}else s=!1;if(!s)break;let r=p.cca(this.input,n);if((r??-1)==10)return e;++n}if(n+1>=this.length)return e;e=n+2}else break}}return e}conditionOperandEnd(e){let t=p.cca(this.input,e),l=t??-1;if(l>=48&&l<=57){for(;;){let s;if(e<this.length){let r=p.cca(this.input,e),a=r??-1;s=a>=48&&a<=57}else s=!1;if(!s)break;++e}let i,n;if(e+1<this.length){let s=p.cca(this.input,e);n=(s??-1)==46}else n=!1;if(n){let s=p.cca(this.input,e+1),r=s??-1;i=r>=48&&r<=57}else i=!1;if(i)for(++e;;){let s;if(e<this.length){let r=p.cca(this.input,e),a=r??-1;s=a>=48&&a<=57}else s=!1;if(!s)break;++e}return e}if(l==34)return this.conditionGroupEnd(e);if(l==40||l==91)e=this.conditionGroupEnd(e);else if(Q.isStart(D.stringCodeAt(this.input,e))){let i=e,n=this.input,s=e;for(;Q.isPart(D.stringCodeAt(n,s));)s+=D.stringUnitsAt(n,s);e=s;let r=this.input,a=e-i;switch(a!=null?p.substr(r,i,a):p.substr(r,i,null)){case"and":case"is":case"not":case"or":return-1;default:}}else return-1;for(;e!=-1&&e<this.length;){let i=p.cca(this.input,e),n=i??-1;if(n==46){if(++e,e>=this.length||!Q.isStart(D.stringCodeAt(this.input,e)))return-1;let s=this.input,r=e;for(;Q.isPart(D.stringCodeAt(s,r));)r+=D.stringUnitsAt(s,r);e=r}else if(n==40||n==91)e=this.conditionGroupEnd(e);else break}return e}conditionGroupEnd(e){let t=[];for(;e<this.length;){let l=p.cca(this.input,e),i=l??-1;if(i==10||i==13)return-1;if(i==34){for(++e;;){let n;if(e<this.length){let a=p.cca(this.input,e);n=(a??-1)!=34}else n=!1;if(!n)break;let s=p.cca(this.input,e),r=s??-1;if(r==10||r==13)return-1;r==92&&++e,++e}if(e>=this.length)return-1;if(++e,t.length==0)return e;continue}if(i==40)t.push(41);else if(i==91)t.push(93);else if(i==41||i==93){if(t.length==0||t.pop()!=i)return-1;if(t.length==0)return e+1}++e}return-1}conditionOperatorEnd(e){let l=this.wordEnd(e,"and");if(l!=-1)return l;let n=this.wordEnd(e,"or");if(n!=-1)return n;let r=this.wordEnd(e,"is");if(r!=-1)return r;let a=p.cca(this.input,e),h=a??-1,o;if(e+1<this.length){let u=p.cca(this.input,e+1);o=u??-1}else o=0;return h==38&&o==38||h==124&&o==124||(h==61||h==33||h==60||h==62)&&o==61?e+2:h==60||h==62||h==43||h==42||h==37||h==47&&o!=47&&o!=42||h==45&&o!=62?e+1:-1}isIdentifierExpressionStart(e,t){if(e=this._skipWhitespaceAndComments(e,!1),e=this._skipWhitespaceAndComments(e,!1),e>=this.length)return!1;let l=p.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=D.stringCodeAt(i.input,e),a=r==95,h=!1;if(Q.isStart(r)?n&&!a&&!Q.isLowerCase(r)&&(r>=128&&!Q.isLowerCase(r)&&!Q.isUpperCase(r)?h=!0:s=!1):s=!1,s){for(e+=D.stringUnitsAt(i.input,e);e<i.length;){let o=a;if(r=D.stringCodeAt(i.input,e),a=r==95,!Q.isPart(r))break;if(n&&o&&!a&&!Q.isLowerCase(r))if(r>=128&&!Q.isLowerCase(r)&&!Q.isUpperCase(r))h=!0;else{s=!1;break}e+=D.stringUnitsAt(i.input,e)}if(s&&h){let o=D.stringCodeAt(i.input,e);s=o==46||o==40||o==91}}}if(!s)return!1;for(;e<this.length;){if(e=this._skipWhitespaceAndComments(e,!1),e>=this.length)return!0;let r=p.cca(this.input,e),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=p.cca(this.input,e+1);if((o??-1)!=47){let u=p.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=D.stringCodeAt(i.input,e),c=u==95,f=!1;if(Q.isStart(u)||(o=!1),o){for(e+=D.stringUnitsAt(i.input,e);e<i.length;){let g=c;if(u=D.stringCodeAt(i.input,e),c=u==95,!Q.isPart(u))break;e+=D.stringUnitsAt(i.input,e)}if(o&&f){let g=D.stringCodeAt(i.input,e);o=g==46||g==40||g==91}}}if(!o)return!0;continue}if(a==91){++e;let o=1;for(;e<this.length&&o>0;){let u=p.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=p.cca(this.input,e);if((l??-1)!=45||e>=this.length-1)t=!0;else{let s=p.cca(this.input,e+1);t=(s??-1)!=62}if(t||(e+=2,e=this._skipWhitespaceAndComments(e,!1),e>=this.length))return!1;let i=p.cca(this.input,e);if((i??-1)==46)++e;else if(Q.isPart(D.stringCodeAt(this.input,e))){let s=this.input,r=e;for(;Q.isPart(D.stringCodeAt(s,r));)r+=D.stringUnitsAt(s,r);e=r;let a;if(e<this.length){let h=p.cca(this.input,e);a=(h??-1)==40}else a=!1;if(a&&(e=this.skipBalancedParens(e,this.parentBlockType()==x.KwBeat),e==-1))return!1}else return!1;if(e=this._skipWhitespaceAndComments(e,!1),e<this.length){let s=p.cca(this.input,e),r=s??-1;if(r!=10&&r!=13&&r!=32&&r!=9&&r!=47&&r!=35)return!1}return!0}isInsertionStart(e){let t=p.cca(this.input,e);if((t??-1)!=43||(++e,e=this._skipWhitespaceAndComments(e,!1),e>=this.length))return!1;let l=p.cca(this.input,e);if((l??-1)==46)++e;else if(Q.isPart(D.stringCodeAt(this.input,e))){let n=this.input,s=e;for(;Q.isPart(D.stringCodeAt(n,s));)s+=D.stringUnitsAt(n,s);e=s;let r;if(e<this.length){let a=p.cca(this.input,e);r=(a??-1)==40}else r=!1;if(r&&(e=this.skipBalancedParens(e,this.parentBlockType()==x.KwBeat),e==-1))return!1}else return!1;if(e=this._skipWhitespaceAndComments(e,!1),e<this.length){let n=p.cca(this.input,e),s=n??-1,r;if(s==105&&e+1<this.length){let a=p.cca(this.input,e+1);r=(a??-1)==102}else r=!1;if(r&&(e+2>=this.length||!Q.isPart(D.stringCodeAt(this.input,e+2))))return!0;if(s!=10&&s!=13&&s!=32&&s!=9&&s!=47)return!1}return!0}isChoiceOnceStart(e){if(!this.inChoiceRoot())return!1;let t=p.cca(this.input,e);if((t??-1)!=45||(++e,e>=this.length))return!1;let l=p.cca(this.input,e);return(l??-1)==32}isLabelStart(e){if(e=this._skipWhitespaceAndComments(e,!1),!Q.isStart(D.stringCodeAt(this.input,e)))return!1;let t=e,l=this.input,i=e;for(;Q.isPart(D.stringCodeAt(l,i));)i+=D.stringUnitsAt(l,i);for(e=i;;){let h;if(e<this.length){let o=p.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=p.cca(this.input,e);n=(h??-1)!=58}else n=!0;if(n)return!1;let s=this.input,r=e-t,a=r!=null?p.substr(s,t,r):p.substr(s,t,null);return!Object.prototype.hasOwnProperty.call(Bt.KEYWORDS.h,a)}isCallStart(e){let t=e,l=this,i=!0;if(e>=l.length)i=!1;else if(!Q.isStart(D.stringCodeAt(l.input,e)))i=!1;else{let n=l.input,s=e;for(;Q.isPart(D.stringCodeAt(n,s));)s+=D.stringUnitsAt(n,s);e=s}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=p.cca(this.input,e),s=n??-1;if(s==40)return e=t,!0;if(s==46){++e,e=this._skipWhitespaceAndComments(e,!1);let r=!0;if(e>=l.length)r=!1;else if(!Q.isStart(D.stringCodeAt(l.input,e)))r=!1;else{let a=l.input,h=e;for(;Q.isPart(D.stringCodeAt(a,h));)h+=D.stringUnitsAt(a,h);e=h}if(!r)return e=t,!1;continue}if(s==91){for(++e;e<this.length;){let r=p.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){if(e>=this.length||!Q.isStart(D.stringCodeAt(this.input,e)))return!1;let t=this.input,l=e;for(;Q.isPart(D.stringCodeAt(t,l));)l+=D.stringUnitsAt(t,l);let i=l,n,s;if(i==e+2){let u=p.cca(this.input,e);s=(u??-1)==105}else s=!1;if(s){let u=p.cca(this.input,e+1);n=(u??-1)==102}else n=!1;if(n)return!1;for(e=i;e<this.length;){let u=p.cca(this.input,e),c=u??-1;if(c==46){if(++e,e>=this.length||!Q.isStart(D.stringCodeAt(this.input,e)))return!1;let f=this.input,g=e;for(;Q.isPart(D.stringCodeAt(f,g));)g+=D.stringUnitsAt(f,g);e=g}else if(c==91||c==40){if(e=this.bracketsEnd(e),e==-1)return!1}else break}let r=!0;if(r==null&&(r=!1),e=this._skipWhitespaceAndComments(e,r),e>=this.length)return!1;let a=p.cca(this.input,e),h=a??-1,o;if(e+1<this.length){let u=p.cca(this.input,e+1);o=u??-1}else o=-1;return h==61?o!=61:o==61?h==43||h==45||h==42||h==47?!0:h==58:!1}bracketsEnd(e){let t=0;for(;e<this.length;){let l=p.cca(this.input,e),i=l??-1;if(i==34){if(e=this.scanStringEnd(e,!1),e==-1)return-1;continue}if(i==10||i==13)return-1;if(i==91||i==40)++t;else if((i==93||i==41)&&(--t,t==0))return e+1;++e}return-1}isColon(e,t){if(t==null&&(t=!0),t)for(;;){let l;if(e<this.length){let i=p.cca(this.input,e);if((i??-1)!=32){let n=p.cca(this.input,e);l=(n??-1)==9}else l=!0}else l=!1;if(!l)break;++e}if(e<this.length){let l=p.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(!pl.isComment(l.type)&&(e||l.type!=x.LineBreak&&l.type!=x.Indent&&l.type!=x.Unindent))return l.type==x.Colon&&t>0&&pl.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!=x.Colon;)++l;let i=this.tokenized[l].pos.offset+1,n=t.pos.column,s=!0,r=!1;for(;i<this.length;){let d=p.cca(this.input,i),m=d??-1;if(m==32||m==9)++i;else break}for(;i<this.length;){let d=p.cca(this.input,i),m=d??-1;if(m==10||m==13)break;if(m==47&&i+1<this.length){let k=p.cca(this.input,i+1),C=k??-1;if(C==47)break;if(C==42){for(i+=2;i<this.length;){let T,S=p.cca(this.input,i);if((S??-1)==42&&i+1<this.length){let v=p.cca(this.input,i+1);T=(v??-1)==47}else T=!1;if(T){i+=2;break}++i}continue}}if(m==60)r=!0;else if(m==62)r=!1;else if(!r&&!(m==32||m==9)){s=!1;break}++i}if(!s)for(;;){let d,m;if(i<this.length){let k=p.cca(this.input,i);m=(k??-1)!=10}else m=!1;if(m){let k=p.cca(this.input,i);d=(k??-1)!=13}else d=!1;if(!d)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 d;if(u>0){let m=p.cca(this.input,u-1);if((m??-1)!=32){let k=p.cca(this.input,u-1);d=(k??-1)==9}else d=!0}else d=!1;if(!d)break;++o,--u}if(o<=n-1)return-1;let c=!1;c==null&&(c=!1),i=this._skipWhitespaceAndComments(i,c);let f,g=p.cca(this.input,i),_=g??-1;if(_==32||_==9)f=!0;else{let d=p.cca(this.input,i);if((d??-1)==47){let m=p.cca(this.input,i+1);f=(m??-1)==47}else f=!1}return f?-1:o}isContinuingMultilineText(e,t){let l,i=p.cca(this.input,e);if((i??-1)==47){let g=p.cca(this.input,e+1);l=(g??-1)==47}else l=!1;if(l)for(;;){let g,_;if(e<this.length){let d=p.cca(this.input,e);_=(d??-1)!=13}else _=!1;if(_){let d=p.cca(this.input,e);g=(d??-1)!=10}else g=!1;if(!g)break;++e}let n=p.cca(this.input,e);(n??-1)==13&&++e;let s=p.cca(this.input,e);if((s??-1)==10)++e;else return!1;let r=0;for(;;){let g,_=p.cca(this.input,e);if((_??-1)!=32){let d=p.cca(this.input,e);g=(d??-1)==9}else g=!0;if(!g)break;++r,++e}if(r!=t)return!1;let a=!1;a==null&&(a=!1),e=this._skipWhitespaceAndComments(e,a);let h,o,u,c=p.cca(this.input,e),f=c??-1;if(f==32||f==9)u=!0;else{let g=p.cca(this.input,e);u=(g??-1)==13}if(u)o=!0;else{let g=p.cca(this.input,e);o=(g??-1)==10}if(o)h=!0;else{let g=p.cca(this.input,e);if((g??-1)==47){let _=p.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(!pl.isComment(t.type)&&t.type!=x.LineBreak&&t.type!=x.Indent&&t.type!=x.Unindent)return t.type==x.Comma;--e}return!1}isAfterLBracket(){let e=this.tokenized.length-1;for(;e>=0;){let t=this.tokenized[e];if(!pl.isComment(t.type)&&t.type!=x.LineBreak&&t.type!=x.Indent&&t.type!=x.Unindent)return t.type==x.LBracket;--e}return!1}isInsideBrackets(){let e=this.stack.length-1;for(;e>=0&&this.stack[e]==13;)--e;return e>=0?this.stack[e]==14:!1}followsAssignStart(){let e=this.tokenized.length-1;for(;e>=0;){let t=this.tokenized[e];if(pl.isComment(t.type)||t.type==x.Indent||t.type==x.Unindent)--e;else return!!pl.isAssignOp(t.type)}return!1}followsUnquotedAssign(){let e=this.tokenized.length-1;for(;e>=0;){let t=this.tokenized[e];if(pl.isComment(t.type)||t.type==x.Indent||t.type==x.Unindent)--e;else return t.type==x.OpUnquotedAssign}return!1}followsOnlyLabelOrCommentsInLine(){let e=!1,t=this.tokenized.length-1;for(;t>=0;){let l=this.tokenized[t];if(pl.isComment(l.type)||l.type==x.Indent||l.type==x.Unindent)--t;else if(!e&&l.type==x.Colon)if(--t,t>=0)pl.isIdentifier(this.tokenized[t].type)&&(e=!0,--t);else return!1;else return l.type==x.LineBreak}return!0}followsOnlyWhitespacesOrCommentsInLine(){let e=this.tokenized.length-1;for(;e>=0;){let t=this.tokenized[e];if(pl.isComment(t.type)||t.type==x.Indent||t.type==x.Unindent)--e;else return t.type==x.LineBreak}return!0}followsChoiceOncePrefix(){if(!this.inChoiceRoot())return!1;let e=this.tokenized.length-1;for(;e>=0;){let t=this.tokenized[e];if(pl.isComment(t.type)||t.type==x.Indent||t.type==x.Unindent)--e;else if(t.type==x.OpMinus){for(--e;e>=0&&(pl.isComment(this.tokenized[e].type)||this.tokenized[e].type==x.Indent||this.tokenized[e].type==x.Unindent);)--e;return e>=0?this.tokenized[e].type==x.LineBreak:!0}else return!1}return!1}hasNonSpecialChar(e){let t=0,l=e.length;for(;t<l;){let i=t++,n=!1,s=p.cca(e,i),r=s??-1,a=0,h=Bt.hasNonSpecialChar_specialChars.length;for(;a<h;){let o=a++,u=p.cca(Bt.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=p.cca(e,t);i=(a??-1)==45}else i=!1;i&&++t;let n=t;for(;;){let a;if(t<l){let h=p.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=p.cca(e,t);r=(a??-1)==46}else r=!1;if(r&&t+1<l){let a=p.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=p.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 22:let i=l.name;this.strictExprs.push(1);return;case 51:case 53:this.strictExprs.push(1);return;case 54:let n=l.content;break;case 55:let s=l.content;break;case 56:let r=l.content;break;case 57:case 58:case 59: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 3:case 51:case 53:return!0;case 22:let i=l.name;return!0;case 54:let n=l.content;break;case 55:let s=l.content;break;case 56:let r=l.content;break;case 57:case 58:case 59: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=p.cca(this.input,this.pos),a=r??-1;if(a==10)break;if(a==47&&this.pos+1<this.length){let h=p.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=D.stringCodeAt(this.input,this.pos+1);if(Q.isStart(h)||h>=48&&h<=57||h==45)break}l+=String.fromCodePoint(a),this.pos++}let i=Ue.rtrim(l),n=new ge(t.line,t.column,t.offset,i.length);n==null&&(n=new ge(this.startLine,this.startColumn,this.pos)),n.length=this.pos-n.offset;let s=new Ee(x.LString(0,i,[]),n);return this.previous=s,s}}isTagStart(e){let t;if(e<this.length){let r=p.cca(this.input,e);t=(r??-1)!=60}else t=!0;if(t)return!1;let l;if(e+1<this.length){let r=p.cca(this.input,e+1);l=(r??-1)==47}else l=!1;let i=e+(l?2:1);if(i>=this.length)return!1;let n=p.cca(this.input,i),s=n??-1;return Q.isStart(D.stringCodeAt(this.input,i))||s==36?!0:l?s==62:!1}scanStringEnd(e,t){let l=e+1,i=!1;for(;l<this.length;){let n=p.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&&this.isTagStart(l)&&(i=!0),s==62&&i&&(i=!1),s==36&&l+1<this.length){let r=p.cca(this.input,l+1),a=r??-1;if(a==123){l+=2;let h=1;for(;l<this.length&&h>0;){let o=p.cca(this.input,l),u=o??-1;if(u==92){l+=2;continue}if(u==10)return-1;let c;if(u==47&&l+1<this.length){let g=p.cca(this.input,l+1);c=(g??-1)==47}else c=!1;if(c)return-1;let f;if(u==47&&l+1<this.length){let g=p.cca(this.input,l+1);f=(g??-1)==42}else f=!1;if(f){for(l+=2;;){if(l>=this.length)return-1;let g=p.cca(this.input,l);if((g??-1)==10)return-1;let _,d;if(l+1<this.length){let m=p.cca(this.input,l);d=(m??-1)==42}else d=!1;if(d){let m=p.cca(this.input,l+1);_=(m??-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(Q.isStart(D.stringCodeAt(this.input,l+1))){++l;let h=this.input,o=l;for(;Q.isPart(D.stringCodeAt(h,o));)o+=D.stringUnitsAt(h,o);if(l=o,l=this.scanAccessorChain(l,t),l==-1)return-1;continue}}++l}return-1}scanAccessorChain(e,t){for(;e<this.length;){let l=p.cca(this.input,e),i=l??-1;if(i==46&&e+1<this.length&&Q.isStart(D.stringCodeAt(this.input,e+1))){++e;let n=this.input,s=e;for(;Q.isPart(D.stringCodeAt(n,s));)s+=D.stringUnitsAt(n,s);e=s}else if(i==91||i==40){let n=i==91?93:41;++e;let s=1;for(;e<this.length&&s>0;){let r=p.cca(this.input,e),a=r??-1;if(a==92){e+=2;continue}if(a==10)return-1;let h;if(a==47&&e+1<this.length){let u=p.cca(this.input,e+1);h=(u??-1)==47}else h=!1;if(h)return-1;let o;if(a==47&&e+1<this.length){let u=p.cca(this.input,e+1);o=(u??-1)==42}else o=!1;if(o){for(e+=2;;){if(e>=this.length)return-1;let u=p.cca(this.input,e);if((u??-1)==10)return-1;let c,f;if(e+1<this.length){let g=p.cca(this.input,e);f=(g??-1)==42}else f=!1;if(f){let g=p.cca(this.input,e+1);c=(g??-1)==47}else c=!1;if(c){e+=2;break}++e}continue}if(a==34){if(e=this.scanStringEnd(e,t),e==-1)return-1;continue}a==i?++s:a==n&&--s,++e}if(s!=0)return-1}else break}return e}skipBalancedParens(e,t){let l;if(e<this.length){let n=p.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=p.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=p.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=p.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=p.cca(this.input,e);if((h??-1)==10)return-1;let o,u;if(e+1<this.length){let c=p.cca(this.input,e);u=(c??-1)==42}else u=!1;if(u){let c=p.cca(this.input,e+1);o=(c??-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()||this.inWhenRoot())return null;let e=p.cca(this.input,this.pos),t=e??-1,l;if(this.pos+1<this.length){let V=p.cca(this.input,this.pos+1);l=V??-1}else l=0;if(t==47&&this.pos<this.length-1){let V=p.cca(this.input,this.pos+1),B=V??-1;if(B==47||B==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!=x.KwBeat&&i!=x.KwState&&i!=x.KwCharacter)return null;let n=this.isInsideBrackets(),s=this.followsUnquotedAssign(),r=this.afterLabelIdentifierToken(!1);if(r!=-1&&this.tokenized[r].pos.line<this.line&&(this.tokenized[r].pos.column>=this.column||this.line-this.tokenized[r].pos.line>1))return null;let a=r!=-1?this.isStartingMultilineDialogue(r):-1,h=r!=-1,o=i==x.KwState||i==x.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)))return null;if(!o&&(t==61||l==61&&(t==43||t==45||t==42||t==47))||!o&&!h&&(this.isInsertionStart(this.pos)||this.isWhenStart(this.pos)||this.isChoiceOnceStart(this.pos)))return null;if(u!=null){if(u=="function")return null;if(!o){if(u!="if"&&u!="null"&&u!="true"&&u!="false"&&u!="and"&&u!="or"&&u!="is"&&u!="not"&&Object.prototype.hasOwnProperty.call(Bt.KEYWORDS.h,u))return null;let V=this.input,B=this.pos;for(;Q.isPart(D.stringCodeAt(V,B));)B+=D.stringUnitsAt(V,B);if(this.isColon(B))return null;let O;if(u=="public"){let q=this.input,R=this.pos;for(;Q.isPart(D.stringCodeAt(q,R));)R+=D.stringUnitsAt(q,R);O=this.isPublicBeatStart(R)}else O=!1;if(O||u=="metadata"&&this.isMetadataStart(this.pos))return null}}let c=!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 V=this.scanStringEnd(this.pos,i==x.KwBeat);if(V==-1)return null;let B=!1,O=V;for(;O<this.length;){let q=p.cca(this.input,O),R=q??-1;if(R==32||R==9){++O;continue}if(R==10||R==13)break;let A;if(R==47&&O+1<this.length){let L=p.cca(this.input,O+1);if((L??-1)!=47){let H=p.cca(this.input,O+1);A=(H??-1)==42}else A=!0}else A=!1;if(A||R==93||R==125||R==41||R==44||R==35)break;B=!0;break}if(!B&&!o){let q=!0;q==null&&(q=!1);let R=this._skipWhitespaceAndComments(O,q);if(R<=O||R>=this.length)return null;let A=p.cca(this.input,R),L=A??-1,H;if(L==10||L==13||L==34)H=!0;else if(L==47&&R+1<this.length){let ie=p.cca(this.input,R+1);if((ie??-1)!=47){let ue=p.cca(this.input,R+1);H=(ue??-1)==42}else H=!0}else H=!1;if(H)return null;let $=0,M=R;for(;;){let ie;if(M>0){let ue=p.cca(this.input,M-1);if((ue??-1)!=32){let de=p.cca(this.input,M-1);ie=(de??-1)==9}else ie=!0}else ie=!1;if(!ie)break;++$,--M}let Z=a!=-1?a:this.column-1;if($!=Z)return null;let ae;if(L==45&&R+1<this.length){let ie=p.cca(this.input,R+1);ae=(ie??-1)==62}else ae=!1;if(ae||L==43||this.isAssignStart(R)||this.isCallStart(R)||this.isLabelStart(R)||this.isIfStart(R)||this.isWhenStart(R)||this.isMetadataStart(R)||this.isIdentifierExpressionStart(R,!0))return null;if(Q.isStart(D.stringCodeAt(this.input,R))){let ie=this.input,ue=R;for(;Q.isPart(D.stringCodeAt(ie,ue));)ue+=D.stringUnitsAt(ie,ue);let de=ue,ye=this.input,ce=de-R,pe=ce!=null?p.substr(ye,R,ce):p.substr(ye,R,null);if(pe!="null"&&pe!="true"&&pe!="false"&&pe!="is"&&pe!="not"&&Object.prototype.hasOwnProperty.call(Bt.KEYWORDS.h,pe))return null}}else if(!B)return null}let g=new ge(this.startLine,this.startColumn,this.pos),_="",d=[],m=this.line,k=this.column,C=this.pos,T=!1,S=-1,v=!1,I=this.column,E=this.line,N=!0,K=!1;for(;this.pos<this.length;){let V=p.cca(this.input,this.pos),B=V??-1,O=B==32||B==9;if(K||!O&&S==-1&&(B!=60||!c)&&(K=!0),T){_+=String.fromCodePoint(92),_+=String.fromCodePoint(B),T=!1;let q=0,R=1;for(;q<R;){let A=q++;if(this.pos>=this.length)break;let L=p.cca(this.input,this.pos);(L??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}I+=2}else if(B==92){T=!0;let q=0,R=1;for(;q<R;){let A=q++;if(this.pos>=this.length)break;let L=p.cca(this.input,this.pos);(L??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else if(S==-1&&O&&!K&&d.length==0){let q=0,R=1;for(;q<R;){let A=q++;if(this.pos>=this.length)break;let L=p.cca(this.input,this.pos);(L??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else{if(S==-1&&B==123)break;{let q;if(S==-1)if(B==10||B==13)q=!0;else if(B==47&&this.pos<this.length-1){let R=p.cca(this.input,this.pos+1);q=(R??-1)==47}else q=!1;else q=!1;if(q)if(a!=-1)if(this.isContinuingMultilineText(this.pos,a)){_+=String.fromCodePoint(B);let R=0,A=1;for(;R<A;){let H=R++;if(this.pos>=this.length)break;let $=p.cca(this.input,this.pos);($??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let L;if(B==13){let H=p.cca(this.input,this.pos);L=(H??-1)==10}else L=!1;if(L){_+=String.fromCodePoint(10);let H=0,$=1;for(;H<$;){let M=H++;if(this.pos>=this.length)break;let Z=p.cca(this.input,this.pos);(Z??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}I=this.column,E=this.line}else break;else break;else{let R;if(S==-1)if(B==47&&this.pos<this.length-1){let A=p.cca(this.input,this.pos+1);R=(A??-1)==42}else R=!1;else R=!1;if(R){_+=String.fromCodePoint(47),_+=String.fromCodePoint(42);let A=2;A==null&&(A=1);let L=0,H=A;for(;L<H;){let M=L++;if(this.pos>=this.length)break;let Z=p.cca(this.input,this.pos);(Z??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let $=!1;for(;this.pos<this.length;){let M,Z=p.cca(this.input,this.pos);if((Z??-1)==42&&this.pos+1<this.length){let ye=p.cca(this.input,this.pos+1);M=(ye??-1)==47}else M=!1;if(M){_+=String.fromCodePoint(42),_+=String.fromCodePoint(47);let ye=2;ye==null&&(ye=1);let ce=0,pe=ye;for(;ce<pe;){let Je=ce++;if(this.pos>=this.length)break;let tt=p.cca(this.input,this.pos);(tt??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}$=!0;break}let ae=p.cca(this.input,this.pos),ie=ae??-1;_+=String.fromCodePoint(ie);let ue=0,de=1;for(;ue<de;){let ye=ue++;if(this.pos>=this.length)break;let ce=p.cca(this.input,this.pos);(ce??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}I=this.column,E=this.line,$||this.error(new U("Unterminated multiline comment",null),!1)}else{if(S==-1&&!o&&this.isIfStart(this.pos))break;{let A;if(S==-1&&B==45&&this.pos<this.length-1){let L=p.cca(this.input,this.pos+1);A=(L??-1)==62}else A=!1;if(A&&this.isTransitionStart(this.pos))break;if(S==-1&&o&&(B==44||B==93||B==125))break;if(c&&B==60){S!=-1&&this.error(new U("Unexpected < inside tag",null),!0);let L;if(this.pos+1<this.length){let M=p.cca(this.input,this.pos+1);L=M??-1}else L=0;v=L==47,this.isTagStart(this.pos)&&(S=_.length),_+=String.fromCodePoint(B);let H=0,$=1;for(;H<$;){let M=H++;if(this.pos>=this.length)break;let Z=p.cca(this.input,this.pos);(Z??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++I}else if(c&&B==62){_+=String.fromCodePoint(B);let L=0,H=1;for(;L<H;){let $=L++;if(this.pos>=this.length)break;let M=p.cca(this.input,this.pos);(M??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++I,S!=-1&&(d.push(li.Tag(v,S,_.length-S)),S=-1)}else if(S==-1&&B==35&&!T){let L;if(this.pos+1<this.length){let H=p.cca(this.input,this.pos+1);L=H??-1}else L=0;if(L==35){_+=String.fromCodePoint(35),_+=String.fromCodePoint(35);let H=0,$=1;for(;H<$;){let ae=H++;if(this.pos>=this.length)break;let ie=p.cca(this.input,this.pos);(ie??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let M=0,Z=1;for(;M<Z;){let ae=M++;if(this.pos>=this.length)break;let ie=p.cca(this.input,this.pos);(ie??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}I+=2}else{let H=D.stringCodeAt(this.input,this.pos+1);if(Q.isStart(H)||H>=48&&H<=57||H==45)break;{_+=String.fromCodePoint(B);let $=0,M=1;for(;$<M;){let Z=$++;if(this.pos>=this.length)break;let ae=p.cca(this.input,this.pos);(ae??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++I}}}else if(B==36&&!T){let L=_.length,H=E,$=I,M=this.pos;try{let Z=0,ae=1;for(;Z<ae;){let ue=Z++;if(this.pos>=this.length)break;let de=p.cca(this.input,this.pos);(de??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++I;let ie=p.cca(this.input,this.pos);if((ie??-1)==123){let ue=0,de=1;for(;ue<de;){let tt=ue++;if(this.pos>=this.length)break;let Ge=p.cca(this.input,this.pos);(Ge??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++I;let ye=new ge(H,$+2,this.pos),ce=this.readComplexInterpolation(ye),pe=this.pos-M;d.push(li.Interpolation(!0,S!=-1,ce,L,pe));let Je=this.input;_+=oe.string(pe!=null?p.substr(Je,M,pe):p.substr(Je,M,null))}else if(Q.isStart(D.stringCodeAt(this.input,this.pos))){let ue=new ge(H,$+1,this.pos),de=this.readFieldAccessInterpolation(ue),ye=this.pos-M;d.push(li.Interpolation(!1,S!=-1,de,L,ye));let ce=this.input;_+=oe.string(ye!=null?p.substr(ce,M,ye):p.substr(ce,M,null))}else{let ue=p.cca(this.input,this.pos);if((ue??-1)==36){_+=String.fromCodePoint(36),_+=String.fromCodePoint(36);let de=0,ye=1;for(;de<ye;){let ce=de++;if(this.pos>=this.length)break;let pe=p.cca(this.input,this.pos);(pe??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++I}else{this.error(new U("Expected name or { after $",null),!1);let de=this.pos-M;d.push(li.Interpolation(!1,S!=-1,[],L,de));let ye=this.input;_+=oe.string(de!=null?p.substr(ye,M,de):p.substr(ye,M,null))}}}catch(Z){let ae=y.caught(Z).unwrap();if(ae instanceof _i){let ie=ae;throw ie.pos==null&&(ie.pos=new ge(H,$,this.pos)),y.thrown(ie)}else throw Z}I=$+(this.pos-M)}else{B==10?(++E,I=1):++I,_+=String.fromCodePoint(B);let L=0,H=1;for(;L<H;){let $=L++;if(this.pos>=this.length)break;let M=p.cca(this.input,this.pos);(M??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}}}}}}if(N){let V=_,B=V.length;V=Ue.rtrim(V);let O=V.length,q=B-O;if(O>0&&this.hasNonSpecialChar(V)&&(!o||!this.isNumber(V)&&V!="null"&&V!="true"&&V!="false")){if(a==-1&&!h&&!this.inChoiceRoot()){let $=this.line,M=this.column,Z=this.pos,ae=!0;ae==null&&(ae=!1);let ie=ae;ie==null&&(ie=!1);let ue=this._skipWhitespaceAndComments(this.pos,ie);for(;this.pos<ue;){let ye=0,ce=1;for(;ye<ce;){let pe=ye++;if(this.pos>=this.length)break;let Je=p.cca(this.input,this.pos);(Je??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let de=this.pos;if(this.column==k){let ye=this.tryReadUnquotedString();if(ye!=null){let ce=this.input,pe=Z-q,Je=de!=null?ce.substring(pe,de):ce.substring(pe),tt=ye.type;if(tt._hx_index==18){let ht=tt.quotes,Ze=tt.s,$e=tt.attachments;if($e!=null){let xt=0;for(;xt<$e.length;){let Ke=$e[xt];switch(++xt,Ke._hx_index){case 0:let at=Ke.braces,fe=Ke.inTag,j=Ke.expr,re=Ke.start,te=Ke.length;d.push(li.Interpolation(at,fe,j,re+de-C,te));break;case 1:let ne=Ke.closing,xe=Ke.start,we=Ke.length;d.push(li.Tag(ne,xe+de-C,we));break}}}V+=Je,V+=Ze}q=0;let Ge=this.pos-1;for(;;){let ht;if(Ge>=0){let Ze=p.cca(this.input,Ge);if((Ze??-1)!=32){let $e=p.cca(this.input,Ge);ht=($e??-1)==9}else ht=!0}else ht=!1;if(!ht)break;++q,--Ge}}else this.line=$,this.column=M,this.pos=Z}else this.line=$,this.column=M,this.pos=Z}d.sort(function($,M){return Bt.compareAttachments($,M)});let R=d.length>0?d:null,A=g;A==null&&(A=new ge(this.startLine,this.startColumn,this.pos)),A.length=this.pos-A.offset;let L=new Ee(x.LString(0,V,R),A);this.previous=L;let H=L;return H.pos.length-=q,H}}return this.line=m,this.column=k,this.pos=C,null}readString(e){let t=0,l=1;for(;t<l;){let c=t++;if(this.pos>=this.length)break;let f=p.cca(this.input,this.pos);(f??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let i="",n=[],s=!1,r=-1,a=!1,h=e.column+1,o=e.line,u=this.parentBlockType()==x.KwBeat;for(;this.pos<this.length;){let c=p.cca(this.input,this.pos),f=c??-1;if(s){i+=String.fromCodePoint(92),i+=String.fromCodePoint(f),s=!1;let g=0,_=1;for(;g<_;){let d=g++;if(this.pos>=this.length)break;let m=p.cca(this.input,this.pos);(m??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}h+=2}else if(f==92){s=!0;let g=0,_=1;for(;g<_;){let d=g++;if(this.pos>=this.length)break;let m=p.cca(this.input,this.pos);(m??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else if(f==34&&r==-1){let g=0,_=1;for(;g<_;){let C=g++;if(this.pos>=this.length)break;let T=p.cca(this.input,this.pos);(T??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}n.sort(function(C,T){return Bt.compareAttachments(C,T)});let d=n.length>0?n:null,m=e;m==null&&(m=new ge(this.startLine,this.startColumn,this.pos)),m.length=this.pos-m.offset;let k=new Ee(x.LString(1,i,d),m);return this.previous=k,k}else if(u&&f==60){r!=-1&&this.error(new U("Unexpected < inside tag",null),!0);let g;if(this.pos+1<this.length){let m=p.cca(this.input,this.pos+1);g=m??-1}else g=0;a=g==47,this.isTagStart(this.pos)&&(r=i.length),i+=String.fromCodePoint(f);let _=0,d=1;for(;_<d;){let m=_++;if(this.pos>=this.length)break;let k=p.cca(this.input,this.pos);(k??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++h}else if(f==62){i+=String.fromCodePoint(f);let g=0,_=1;for(;g<_;){let d=g++;if(this.pos>=this.length)break;let m=p.cca(this.input,this.pos);(m??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++h,r!=-1&&(n.push(li.Tag(a,r,i.length-r)),r=-1)}else if(f==36&&!s){let g=i.length,_=o,d=h,m=this.pos;try{let k=0,C=1;for(;k<C;){let S=k++;if(this.pos>=this.length)break;let v=p.cca(this.input,this.pos);(v??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++h;let T=p.cca(this.input,this.pos);if((T??-1)==123){let S=0,v=1;for(;S<v;){let V=S++;if(this.pos>=this.length)break;let B=p.cca(this.input,this.pos);(B??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++h;let I=new ge(_,d+2,this.pos),E=this.readComplexInterpolation(I),N=this.pos-m;n.push(li.Interpolation(!0,r!=-1,E,g,N));let K=this.input;i+=oe.string(N!=null?p.substr(K,m,N):p.substr(K,m,null))}else if(Q.isStart(D.stringCodeAt(this.input,this.pos))){let S=new ge(_,d+1,this.pos),v=this.readFieldAccessInterpolation(S),I=this.pos-m;n.push(li.Interpolation(!1,r!=-1,v,g,I));let E=this.input;i+=oe.string(I!=null?p.substr(E,m,I):p.substr(E,m,null))}else{let S=p.cca(this.input,this.pos);if((S??-1)==36){i+=String.fromCodePoint(36),i+=String.fromCodePoint(36);let v=0,I=1;for(;v<I;){let E=v++;if(this.pos>=this.length)break;let N=p.cca(this.input,this.pos);(N??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}++h}else{this.error(new U("Expected name or { after $",null),!1);let v=this.pos-m;n.push(li.Interpolation(!1,r!=-1,[],g,v));let I=this.input;i+=oe.string(v!=null?p.substr(I,m,v):p.substr(I,m,null))}}}catch(k){let C=y.caught(k).unwrap();if(C instanceof _i){let T=C;throw T.pos==null&&(T.pos=new ge(_,d,this.pos)),y.thrown(T)}else throw k}h=d+(this.pos-m)}else{f==10?(++o,h=1):++h,i+=String.fromCodePoint(f);let g=0,_=1;for(;g<_;){let d=g++;if(this.pos>=this.length)break;let m=p.cca(this.input,this.pos);(m??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}return this.error(new U("Unterminated string",null),!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=p.cca(this.input,this.pos);if((s??-1)==34){let a=new ge(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==x.LineBreak)++n,i=1;else if(!(r.type==x.Indent||r.type==x.Unindent)){let a,h=r.type;switch(h._hx_index){case 18:let o=h.attachments,u=h.quotes;a=h.s.length+(u!=0?2:0);break;case 19:let f=h.n;a=(f==null?"null":""+f).length;break;case 22:a=h.name.length;break;default:a=1}i+=a}switch(r.type._hx_index){case 48:++l;break;case 49:--l;break;default:}r.type==x.Eof&&this.error(new U("Unterminated interpolation expression",null),!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 ge(e.line,e.column+r,e.offset+r,s),this.line=t,this.column=l,n}readFieldAccessInterpolation(e){this.strictExprs.push(1);let t=[];Q.isStart(D.stringCodeAt(this.input,this.pos))||this.error(new U("Expected name in field access",null),!0);let l=this.pos,i=this.input,n=this.pos;for(;Q.isPart(D.stringCodeAt(i,n));)n+=D.stringUnitsAt(i,n);let s=n-this.pos;s==null&&(s=1);let r=0,a=s;for(;r<a;){let f=r++;if(this.pos>=this.length)break;let g=p.cca(this.input,this.pos);(g??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let h=this.input,o=this.pos-l,u=o!=null?p.substr(h,l,o):p.substr(h,l,null),c=Object.prototype.hasOwnProperty.call(Bt.KEYWORDS.h,u)?Bt.KEYWORDS.h[u]:x.Identifier(u);t.push(new Ee(c,new ge(e.line,e.column,l,this.pos-l)));e:for(;this.pos<this.length;){let f=p.cca(this.input,this.pos);switch(f??-1){case 40:t.push(new Ee(x.LParen,new ge(this.line,this.column,this.pos,1)));let g=0,_=1;for(;g<_;){let T=g++;if(this.pos>=this.length)break;let S=p.cca(this.input,this.pos);(S??-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 T=p.cca(this.input,this.pos);if((T??-1)==41){if(--d,d==0){t.push(new Ee(x.RParen,new ge(this.line,this.column,this.pos,1)));let v=0,I=1;for(;v<I;){let E=v++;if(this.pos>=this.length)break;let N=p.cca(this.input,this.pos);(N??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.stack.pop(),this.strictExprs.pop();break}}else{let v=p.cca(this.input,this.pos);(v??-1)==40&&++d}let S=p.cca(this.input,this.pos);if((S??-1)==44){t.push(new Ee(x.Comma,new ge(this.line,this.column,this.pos,1)));let v=0,I=1;for(;v<I;){let E=v++;if(this.pos>=this.length)break;let N=p.cca(this.input,this.pos);(N??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else t.push(this.nextToken())}d>0&&this.error(new U("Unterminated function call in interpolation",null),!0);break;case 46:if(this.pos+1<this.length&&Q.isStart(D.stringCodeAt(this.input,this.pos+1))){t.push(new Ee(x.Dot,new ge(this.line,this.column,this.pos,1)));let T=0,S=1;for(;T<S;){let A=T++;if(this.pos>=this.length)break;let L=p.cca(this.input,this.pos);(L??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let v=this.pos,I=this.input,E=this.pos;for(;Q.isPart(D.stringCodeAt(I,E));)E+=D.stringUnitsAt(I,E);let N=E-this.pos;N==null&&(N=1);let K=0,V=N;for(;K<V;){let A=K++;if(this.pos>=this.length)break;let L=p.cca(this.input,this.pos);(L??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let B=this.input,O=this.pos-v,q=O!=null?p.substr(B,v,O):p.substr(B,v,null),R=Object.prototype.hasOwnProperty.call(Bt.KEYWORDS.h,q)?Bt.KEYWORDS.h[q]:x.Identifier(q);t.push(new Ee(R,new ge(this.line,this.column-(this.pos-v),v)))}else break e;break;case 91:t.push(new Ee(x.LBracket,new ge(this.line,this.column,this.pos,1)));let m=0,k=1;for(;m<k;){let T=m++;if(this.pos>=this.length)break;let S=p.cca(this.input,this.pos);(S??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.stack.push(14),this.strictExprs.push(1);let C=1;for(;this.pos<this.length&&C>0;){let T=p.cca(this.input,this.pos);if((T??-1)==93){if(--C,C==0){t.push(new Ee(x.RBracket,new ge(this.line,this.column,this.pos,1)));let S=0,v=1;for(;S<v;){let I=S++;if(this.pos>=this.length)break;let E=p.cca(this.input,this.pos);(E??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.stack.pop(),this.strictExprs.pop();break}}else{let S=p.cca(this.input,this.pos);(S??-1)==91&&++C}t.push(this.nextToken())}C>0&&this.error(new U("Unterminated array access in interpolation",null),!0);break;default:break e}}return this.strictExprs.pop(),t}readIdentifierTokenInInterpolation(e){let t=this.makePositionRelativeTo(e),l=this.pos,i=this.input,n=this.pos;for(;Q.isPart(D.stringCodeAt(i,n));)n+=D.stringUnitsAt(i,n);let s=n-this.pos;s==null&&(s=1);let r=0,a=s;for(;r<a;){let f=r++;if(this.pos>=this.length)break;let g=p.cca(this.input,this.pos);(g??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let h=this.input,o=this.pos-l,u=o!=null?p.substr(h,l,o):p.substr(h,l,null),c=this.mergeIsNot(Object.prototype.hasOwnProperty.call(Bt.KEYWORDS.h,u)?Bt.KEYWORDS.h[u]:x.Identifier(u));return new Ee(c,t)}makePositionRelativeTo(e){let t=e.line,l=e.column,i=e.offset;for(;i<this.pos;){let n=p.cca(this.input,i);(n??-1)==10?(++t,l=1):++l,++i}return new ge(t,l,this.pos,e.length)}readLineComment(){let e=new ge(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 c=p.cca(this.input,this.pos);(c??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let n=this.pos;for(;this.pos<this.length;){let u=p.cca(this.input,this.pos),c=u??-1;if(c==10||c==13)break;let f=0,g=1;for(;f<g;){let _=f++;if(this.pos>=this.length)break;let d=p.cca(this.input,this.pos);(d??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let s=this.input,r=this.pos-n,a=r!=null?p.substr(s,n,r):p.substr(s,n,null),h=e;h==null&&(h=new ge(this.startLine,this.startColumn,this.pos)),h.length=this.pos-h.offset;let o=new Ee(x.CommentLine(a),h);return this.previous=o,o}readMultiLineComment(){let e=new ge(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=p.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=p.cca(this.input,this.pos);if((a??-1)==42){let h;if(this.pos+1<this.length){let o=p.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 c=this.input,f=this.pos-n,g=f!=null?p.substr(c,n,f):p.substr(c,n,null),_=2;_==null&&(_=1);let d=0,m=_;for(;d<m;){let T=d++;if(this.pos>=this.length)break;let S=p.cca(this.input,this.pos);(S??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let k=e;k==null&&(k=new ge(this.startLine,this.startColumn,this.pos)),k.length=this.pos-k.offset;let C=new Ee(x.CommentMultiLine(g),k);return this.previous=C,C}let h=2;h==null&&(h=1);let o=0,u=h;for(;o<u;){let c=o++;if(this.pos>=this.length)break;let f=p.cca(this.input,this.pos);(f??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else{let h,o=p.cca(this.input,this.pos);if((o??-1)==47){let u;if(this.pos+1<this.length){let c=p.cca(this.input,this.pos+1);u=c??-1}else u=0;h=u==42}else h=!1;if(h){++s;let u=2;u==null&&(u=1);let c=0,f=u;for(;c<f;){let g=c++;if(this.pos>=this.length)break;let _=p.cca(this.input,this.pos);(_??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else{let u=0,c=1;for(;u<c;){let f=u++;if(this.pos>=this.length)break;let g=p.cca(this.input,this.pos);(g??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}}return this.error(new U("Unterminated multiline comment",null),!0),null}readHashComment(){let e=new ge(this.startLine,this.startColumn,this.pos),t=0,l=1;for(;t<l;){let o=t++;if(this.pos>=this.length)break;let u=p.cca(this.input,this.pos);(u??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let i=this.pos;for(;this.pos<this.length;)if(Q.isPart(D.stringCodeAt(this.input,this.pos))){let o=D.stringUnitsAt(this.input,this.pos);o==null&&(o=1);let u=0,c=o;for(;u<c;){let f=u++;if(this.pos>=this.length)break;let g=p.cca(this.input,this.pos);(g??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else{let o=p.cca(this.input,this.pos);if((o??-1)==45){let u=0,c=1;for(;u<c;){let f=u++;if(this.pos>=this.length)break;let g=p.cca(this.input,this.pos);(g??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else break}let n=this.input,s=this.pos-i,r=s!=null?p.substr(n,i,s):p.substr(n,i,null),a=e;a==null&&(a=new ge(this.startLine,this.startColumn,this.pos)),a.length=this.pos-a.offset;let h=new Ee(x.CommentHash(r),a);return this.previous=h,h}readNumber(){let e=new ge(this.startLine,this.startColumn,this.pos),t=this.pos;for(;;){let u;if(this.pos<this.length){let g=p.cca(this.input,this.pos),_=g??-1;u=_>=48&&_<=57}else u=!1;if(!u)break;let c=0,f=1;for(;c<f;){let g=c++;if(this.pos>=this.length)break;let _=p.cca(this.input,this.pos);(_??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let l,i;if(this.pos<this.length){let u=p.cca(this.input,this.pos);i=(u??-1)==46}else i=!1;if(i&&this.pos+1<this.length){let u=p.cca(this.input,this.pos+1),c=u??-1;l=c>=48&&c<=57}else l=!1;if(l){let u=0,c=1;for(;u<c;){let f=u++;if(this.pos>=this.length)break;let g=p.cca(this.input,this.pos);(g??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}for(;;){let f;if(this.pos<this.length){let d=p.cca(this.input,this.pos),m=d??-1;f=m>=48&&m<=57}else f=!1;if(!f)break;let g=0,_=1;for(;g<_;){let d=g++;if(this.pos>=this.length)break;let m=p.cca(this.input,this.pos);(m??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}let n=this.input,s=this.pos-t,r=x.LNumber(parseFloat(s!=null?p.substr(n,t,s):p.substr(n,t,null))),a=e;a==null&&(a=new ge(this.startLine,this.startColumn,this.pos)),a.length=this.pos-a.offset;let h=new Ee(r,a);return this.previous=h,h}mergeIsNot(e){if(e._hx_index==34&&e.word==!0){let t=this.wordEnd(this.skipSpacesAndTabs(this.pos),"not");if(t!=-1){for(;this.pos<t;){let l=0,i=1;for(;l<i;){let n=l++;if(this.pos>=this.length)break;let s=p.cca(this.input,this.pos);(s??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}return x.OpNotEquals(!0)}}return e}wordEnd(e,t){let l=e+t.length;if(l>this.length)return-1;let i=0,n=t.length;for(;i<n;){let s=i++,r=p.cca(this.input,e+s);if((r??-1)!=p.cca(t,s))return-1}return l<this.length&&Q.isPart(D.stringCodeAt(this.input,l))?-1:l}skipSpacesAndTabs(e){for(;;){let t;if(e<this.length){let l=p.cca(this.input,e);if((l??-1)!=32){let i=p.cca(this.input,e);t=(i??-1)==9}else t=!0}else t=!1;if(!t)break;++e}return e}readIdentifier(){let e=new ge(this.startLine,this.startColumn,this.pos),t=this.pos,l=this.input,i=this.pos;for(;Q.isPart(D.stringCodeAt(l,i));)i+=D.stringUnitsAt(l,i);let n=i-this.pos;n==null&&(n=1);let s=0,r=n;for(;s<r;){let g=s++;if(this.pos>=this.length)break;let _=p.cca(this.input,this.pos);(_??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let a=this.input,h=this.pos-t,o=h!=null?p.substr(a,t,h):p.substr(a,t,null);if(o=="function")return this.readFunction(e);let u=Object.prototype.hasOwnProperty.call(Bt.KEYWORDS.h,o)?Bt.KEYWORDS.h[o]:x.Identifier(o);if(o=="when"&&this.isWhenStart(t)&&(u=x.KwWhen),o=="metadata"&&this.isMetadataStart(t)&&(u=x.KwMetadata),o=="public"&&this.isPublicBeatStart(this.pos)&&(u=x.KwPublic),this.previous!=null&&this.previous.type==x.Dot&&u!=null)switch(u._hx_index){case 11:case 12:case 13:case 14:case 15:u=x.Identifier(o);break;case 34:u.word==!0&&(u=x.Identifier(o));break;case 42:u.word==!0&&(u=x.Identifier(o));break;default:}this.previous!=null&&this.previous.type==x.KwWhen&&this.previous.pos.line==e.line&&(u=x.Identifier(o)),u=this.mergeIsNot(u);let c=e;c==null&&(c=new ge(this.startLine,this.startColumn,this.pos)),c.length=this.pos-c.offset;let f=new Ee(u,c);return this.previous=f,f}readFunction(e){let t=!1;t==null&&(t=!1);let l=this._skipWhitespaceAndComments(this.pos,t);for(;this.pos<l;){let O=0,q=1;for(;O<q;){let R=O++;if(this.pos>=this.length)break;let A=p.cca(this.input,this.pos);(A??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let i=e.column,n=null;if(Q.isStart(D.stringCodeAt(this.input,this.pos))){let O=this.pos,q=this.input,R=this.pos;for(;Q.isPart(D.stringCodeAt(q,R));)R+=D.stringUnitsAt(q,R);let A=R-this.pos;A==null&&(A=1);let L=0,H=A;for(;L<H;){let Z=L++;if(this.pos>=this.length)break;let ae=p.cca(this.input,this.pos);(ae??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let $=this.input,M=this.pos-O;n=M!=null?p.substr($,O,M):p.substr($,O,null)}let s=!1;s==null&&(s=!1);let r=this._skipWhitespaceAndComments(this.pos,s);for(;this.pos<r;){let O=0,q=1;for(;O<q;){let R=O++;if(this.pos>=this.length)break;let A=p.cca(this.input,this.pos);(A??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let a;if(this.pos<this.length){let O=p.cca(this.input,this.pos);a=(O??-1)!=40}else a=!0;a&&this.error(new U("Expected opening parenthesis after function name",null),!0);let h=0,o=[],u=0,c=1;for(;u<c;){let O=u++;if(this.pos>=this.length)break;let q=p.cca(this.input,this.pos);(q??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}h=1;let f=new Et;for(;this.pos<this.length&&h>0;){let O=p.cca(this.input,this.pos),q=O??-1;if(q==47){let R=this.pos,A=!1;A==null&&(A=!1);let L=this._skipWhitespaceAndComments(this.pos,A);for(;this.pos<L;){let H=0,$=1;for(;H<$;){let M=H++;if(this.pos>=this.length)break;let Z=p.cca(this.input,this.pos);(Z??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}if(this.pos==R){let H=0,$=1;for(;H<$;){let M=H++;if(this.pos>=this.length)break;let Z=p.cca(this.input,this.pos);(Z??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}this.error(new U('Invalid character "/"',null),!1)}}else if(q==40){++h,f.b+=String.fromCodePoint(q);let R=0,A=1;for(;R<A;){let $=R++;if(this.pos>=this.length)break;let M=p.cca(this.input,this.pos);(M??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let L=!1;L==null&&(L=!1);let H=this._skipWhitespaceAndComments(this.pos,L);for(;this.pos<H;){let $=0,M=1;for(;$<M;){let Z=$++;if(this.pos>=this.length)break;let ae=p.cca(this.input,this.pos);(ae??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}else if(q==41){if(--h,h>0)f.b+=String.fromCodePoint(q);else{let $=Ue.trim(f.b);$.length>0&&o.push($)}let R=0,A=1;for(;R<A;){let $=R++;if(this.pos>=this.length)break;let M=p.cca(this.input,this.pos);(M??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let L=!1;L==null&&(L=!1);let H=this._skipWhitespaceAndComments(this.pos,L);for(;this.pos<H;){let $=0,M=1;for(;$<M;){let Z=$++;if(this.pos>=this.length)break;let ae=p.cca(this.input,this.pos);(ae??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}else if(q==44&&h==1){let R=Ue.trim(f.b);R.length>0&&o.push(R),f=new Et;let A=0,L=1;for(;A<L;){let M=A++;if(this.pos>=this.length)break;let Z=p.cca(this.input,this.pos);(Z??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let H=!1;H==null&&(H=!1);let $=this._skipWhitespaceAndComments(this.pos,H);for(;this.pos<$;){let M=0,Z=1;for(;M<Z;){let ae=M++;if(this.pos>=this.length)break;let ie=p.cca(this.input,this.pos);(ie??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}else{f.b+=String.fromCodePoint(q);let R=0,A=1;for(;R<A;){let L=R++;if(this.pos>=this.length)break;let H=p.cca(this.input,this.pos);(H??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}h>0&&this.error(new U("Unclosed parentheses in function declaration",null),!1);let g=!1;g==null&&(g=!1);let _=this._skipWhitespaceAndComments(this.pos,g);for(;this.pos<_;){let O=0,q=1;for(;O<q;){let R=O++;if(this.pos>=this.length)break;let A=p.cca(this.input,this.pos);(A??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let d;if(this.pos<this.length){let O=p.cca(this.input,this.pos);d=(O??-1)==123}else d=!1;let m=this.pos,k=this.line,C=this.column;if(d){let O=0,q=1;for(;O<q;){let A=O++;if(this.pos>=this.length)break;let L=p.cca(this.input,this.pos);(L??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let R=1;for(;this.pos<this.length&&R>0;){let A=p.cca(this.input,this.pos),L=A??-1;if(L==34){this.skipQuotedString();continue}L==123?++R:L==125&&--R;let H=0,$=1;for(;H<$;){let M=H++;if(this.pos>=this.length)break;let Z=p.cca(this.input,this.pos);(Z??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}R>0&&this.error(new U("Unclosed braces in function body",null),!1),m=this.pos,k=this.line,C=this.column}else{let O=-1,q=!0;for(;this.pos<this.length;){let R=p.cca(this.input,this.pos),A=R??-1;if(A==10||A==13){m=this.pos,k=this.line,C=this.column;let $=0,M=1;for(;$<M;){let Z=$++;if(this.pos>=this.length)break;let ae=p.cca(this.input,this.pos);(ae??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}q=!0;break}let L=0,H=1;for(;L<H;){let $=L++;if(this.pos>=this.length)break;let M=p.cca(this.input,this.pos);(M??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}for(;this.pos<this.length;){if(q){let $=0,M=this.pos;for(;this.pos<this.length;){let ie=p.cca(this.input,this.pos),ue=ie??-1;if(ue==32)++$;else if(ue==9)++$;else break;let de=0,ye=1;for(;de<ye;){let ce=de++;if(this.pos>=this.length)break;let pe=p.cca(this.input,this.pos);(pe??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}let Z,ae;if(O==-1&&this.pos<this.length){let ie=p.cca(this.input,this.pos);ae=(ie??-1)!=10}else ae=!1;if(ae){let ie=p.cca(this.input,this.pos);Z=(ie??-1)!=13}else Z=!1;if(Z){if(O=$,O<i){this.pos=M;break}}else{let ie;if(O!=-1&&$<O)if(this.pos<this.length){let ue=p.cca(this.input,this.pos);if((ue??-1)!=10){let de=p.cca(this.input,this.pos);ie=(de??-1)!=13}else ie=!1}else ie=!0;else ie=!1;if(ie){this.pos=M;break}}q=!1}let R=p.cca(this.input,this.pos),A=R??-1;if(A==34){this.skipQuotedString();continue}(A==10||A==13)&&(m=this.pos,k=this.line,C=this.column,q=!0);let L=0,H=1;for(;L<H;){let $=L++;if(this.pos>=this.length)break;let M=p.cca(this.input,this.pos);(M??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}this.pos=m,this.line=k,this.column=C;let T=this.pos,S=this.input,v=e.offset,I=T-e.offset,E=Ue.rtrim(I!=null?p.substr(S,v,I):p.substr(S,v,null)),N=!d&&E.indexOf(`
32
+ `,null)==-1;N||(E+=`
33
+ `);let K=e;K==null&&(K=new ge(this.startLine,this.startColumn,this.pos)),K.length=this.pos-K.offset;let V=new Ee(x.Function(n,o,E,N),K);this.previous=V;let B=V;return B.pos.length=E.length,B}skipQuotedString(){let e=!1,t=0,l=1;for(;t<l;){let i=t++;if(this.pos>=this.length)break;let n=p.cca(this.input,this.pos);(n??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}for(;this.pos<this.length;){let i=p.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=p.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=p.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=p.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=p.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=p.cca(this.input,this.pos);a=(h??-1)==123}else a=!1;if(a){let h=0,o=1;for(;h<o;){let c=h++;if(this.pos>=this.length)break;let f=p.cca(this.input,this.pos);(f??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}let u=1;for(;this.pos<this.length&&u>0;){let c=p.cca(this.input,this.pos),f=c??-1;if(f==34){this.skipQuotedString();continue}else f==123?++u:f==125&&--u;if(u>0||f!=125){let g=0,_=1;for(;g<_;){let d=g++;if(this.pos>=this.length)break;let m=p.cca(this.input,this.pos);(m??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}else{let g=0,_=1;for(;g<_;){let d=g++;if(this.pos>=this.length)break;let m=p.cca(this.input,this.pos);(m??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}break}}}else if(Q.isStart(D.stringCodeAt(this.input,this.pos))){let h=this.input,o=this.pos;for(;Q.isPart(D.stringCodeAt(h,o));)o+=D.stringUnitsAt(h,o);let u=o-this.pos;u==null&&(u=1);let c=0,f=u;for(;c<f;){let g=c++;if(this.pos>=this.length)break;let _=p.cca(this.input,this.pos);(_??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}else{let s=0,r=1;for(;s<r;){let a=s++;if(this.pos>=this.length)break;let h=p.cca(this.input,this.pos);(h??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}}}makePosition(){return new ge(this.startLine,this.startColumn,this.pos)}makeToken(e,t){t==null&&(t=new ge(this.startLine,this.startColumn,this.pos)),t.length=this.pos-t.offset;let l=new Ee(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=p.cca(this.input,this.pos);(n??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}}peek(e){if(e==null&&(e=1),this.pos+e<this.length){let t=p.cca(this.input,this.pos+e);return t??-1}else return 0}error(e,t){let l=_i.of(e,new ge(this.startLine,this.startColumn,this.pos));if(this.errors==null&&(this.errors=[]),this.errors.push(l),t)throw y.thrown(l);return l}getErrors(){return this.errors==null&&(this.errors=[]),this.errors}skipWhitespace(){for(;this.pos<this.length;){let e=p.cca(this.input,this.pos);switch(e??-1){case 9:case 32:let t=0,l=1;for(;t<l;){let i=t++;if(this.pos>=this.length)break;let n=p.cca(this.input,this.pos);(n??-1)==10?(this.line++,this.column=1):this.column++,this.pos++}break;default:return}}}isDigit(e){return e>=48?e<=57:!1}codeAt(e){return D.stringCodeAt(this.input,e)}unitsAt(e){return D.stringUnitsAt(this.input,e)}isNameStartAt(e){return Q.isStart(D.stringCodeAt(this.input,e))}isNamePartAt(e){return Q.isPart(D.stringCodeAt(this.input,e))}nameEnd(e){let t=this.input,l=e;for(;Q.isPart(D.stringCodeAt(t,l));)l+=D.stringUnitsAt(t,l);return l}isKeyStartAt(e){let t=D.stringCodeAt(this.input,e);return Q.isStart(t)||t>=48&&t<=57?!0:t==45}isUncased(e){return e>=128&&!Q.isLowerCase(e)?!Q.isUpperCase(e):!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"]=Bt,Bt.__name__="loreline.Lexer",Object.assign(Bt.prototype,{__class__:Bt});class vl{static lastError(){return vl._lastError}static parse(e,t,l,i){vl._lastError=null;let n=new Bt(e),s=n.tokenize(),r=n.getErrors();if(r!=null&&r.length>0)return vl._reportParseError(r[0],i);let a=null;if(t!=null&&l!=null)return new Dl().resolve(t,s,l,function(c){vl._reportParseError(c,i)},function(c,f){if(vl._lastError!=null)return;let g=s,_=t,d=t,m=new Ce,k=Dl.rootImportPath(t);m.h[k]=!0;let C=new el(g,new en(_,d,f,m));a=C.parse(),a.indentSize=n.detectedIndentSize;let T=C.getErrors();if(T!=null&&T.length>0){a=null,vl._reportParseError(T[0],i);return}i?.(a)}),a;let h=new el(s);a=h.parse(),a.indentSize=n.detectedIndentSize;let o=h.getErrors();return o!=null&&o.length>0?vl._reportParseError(o[0],i):(i?.(a),a)}static _reportParseError(e,t){if(vl._lastError=e,t!=null)return t(null),null;throw y.thrown(e)}static loadLocale(e,t,l,i,n){if(vl._lastError=null,l==null&&(l=t.filePath),l==null)throw y.thrown(new st("Cannot load locale: no filePath provided and script.filePath is null"));if(i==null)throw y.thrown(new st("Cannot load locale: handleFile is required"));let s=jl.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 N,K,V,B,O,q,R=p.cca(l,E-8);if((R??-1)==46){let A=p.cca(l,E-7),L=A??-1;q=L==108||L==76}else q=!1;if(q){let A=p.cca(l,E-6),L=A??-1;O=L==111||L==79}else O=!1;if(O){let A=p.cca(l,E-5),L=A??-1;B=L==114||L==82}else B=!1;if(B){let A=p.cca(l,E-4);V=(A??-1)==46}else V=!1;if(V){let A=p.cca(l,E-3),L=A??-1;K=L==116||L==84}else K=!1;if(K){let A=p.cca(l,E-2),L=A??-1;N=L==120||L==88}else N=!1;if(N){let A=p.cca(l,E-1),L=A??-1;u=L==116||L==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 N,K,V=p.cca(l,E-4);if((V??-1)==46){let B=p.cca(l,E-3),O=B??-1;K=O==108||O==76}else K=!1;if(K){let B=p.cca(l,E-2),O=B??-1;N=O==111||O==79}else N=!1;if(N){let B=p.cca(l,E-1),O=B??-1;o=O==114||O==82}else o=!1}}if(o)h=nt.directory(l);else{let E=l.length,N;if(E>0){let K=p.cca(l,E-1);N=K??-1}else N=0;if(N==47||N==92){let K=E-1;h=K!=null?p.substr(l,0,K):p.substr(l,0,null)}else h=l}let c=t.filePath,f=[],g=[];if(c!=null){let E=nt.withoutDirectory(c),N;if(E==null)N=null;else{let V;if(E==null)V=!1;else{let B=E.length;if(B<8)V=!1;else{let O,q,R,A,L,H,$=p.cca(E,B-8);if(($??-1)==46){let M=p.cca(E,B-7),Z=M??-1;H=Z==108||Z==76}else H=!1;if(H){let M=p.cca(E,B-6),Z=M??-1;L=Z==111||Z==79}else L=!1;if(L){let M=p.cca(E,B-5),Z=M??-1;A=Z==114||Z==82}else A=!1;if(A){let M=p.cca(E,B-4);R=(M??-1)==46}else R=!1;if(R){let M=p.cca(E,B-3),Z=M??-1;q=Z==116||Z==84}else q=!1;if(q){let M=p.cca(E,B-2),Z=M??-1;O=Z==120||Z==88}else O=!1;if(O){let M=p.cca(E,B-1),Z=M??-1;V=Z==116||Z==84}else V=!1}}if(V){let B=E.length-8;N=B!=null?p.substr(E,0,B):p.substr(E,0,null)}else{let B;if(E==null)B=!1;else{let O=E.length;if(O<4)B=!1;else{let q,R,A=p.cca(E,O-4);if((A??-1)==46){let L=p.cca(E,O-3),H=L??-1;R=H==108||H==76}else R=!1;if(R){let L=p.cca(E,O-2),H=L??-1;q=H==111||H==79}else q=!1;if(q){let L=p.cca(E,O-1),H=L??-1;B=H==114||H==82}else B=!1}}if(B){let O=E.length-4;N=O!=null?p.substr(E,0,O):p.substr(E,0,null)}else N=E}}let K=N+"."+e+a;f.push("."),g.push(nt.normalize(nt.join([h,K])))}if(c!=null){let E=new El(t),N=nt.directory(c),K=E.getImportedPaths(c),V=0;for(;V<K.length;){let B=K[V];++V;let O=vl.relativePath(N,B),q;if(O==null)q=null;else{let H;if(O==null)H=!1;else{let $=O.length;if($<8)H=!1;else{let M,Z,ae,ie,ue,de,ye=p.cca(O,$-8);if((ye??-1)==46){let ce=p.cca(O,$-7),pe=ce??-1;de=pe==108||pe==76}else de=!1;if(de){let ce=p.cca(O,$-6),pe=ce??-1;ue=pe==111||pe==79}else ue=!1;if(ue){let ce=p.cca(O,$-5),pe=ce??-1;ie=pe==114||pe==82}else ie=!1;if(ie){let ce=p.cca(O,$-4);ae=(ce??-1)==46}else ae=!1;if(ae){let ce=p.cca(O,$-3),pe=ce??-1;Z=pe==116||pe==84}else Z=!1;if(Z){let ce=p.cca(O,$-2),pe=ce??-1;M=pe==120||pe==88}else M=!1;if(M){let ce=p.cca(O,$-1),pe=ce??-1;H=pe==116||pe==84}else H=!1}}if(H){let $=O.length-8;q=$!=null?p.substr(O,0,$):p.substr(O,0,null)}else{let $;if(O==null)$=!1;else{let M=O.length;if(M<4)$=!1;else{let Z,ae,ie=p.cca(O,M-4);if((ie??-1)==46){let ue=p.cca(O,M-3),de=ue??-1;ae=de==108||de==76}else ae=!1;if(ae){let ue=p.cca(O,M-2),de=ue??-1;Z=de==111||de==79}else Z=!1;if(Z){let ue=p.cca(O,M-1),de=ue??-1;$=de==114||de==82}else $=!1}}if($){let M=O.length-4;q=M!=null?p.substr(O,0,M):p.substr(O,0,null)}else q=O}}let R=q+"."+e+a,A=nt.normalize(O),L;if(A==null)L=null;else{let H;if(A==null)H=!1;else{let $=A.length;if($<8)H=!1;else{let M,Z,ae,ie,ue,de,ye=p.cca(A,$-8);if((ye??-1)==46){let ce=p.cca(A,$-7),pe=ce??-1;de=pe==108||pe==76}else de=!1;if(de){let ce=p.cca(A,$-6),pe=ce??-1;ue=pe==111||pe==79}else ue=!1;if(ue){let ce=p.cca(A,$-5),pe=ce??-1;ie=pe==114||pe==82}else ie=!1;if(ie){let ce=p.cca(A,$-4);ae=(ce??-1)==46}else ae=!1;if(ae){let ce=p.cca(A,$-3),pe=ce??-1;Z=pe==116||pe==84}else Z=!1;if(Z){let ce=p.cca(A,$-2),pe=ce??-1;M=pe==120||pe==88}else M=!1;if(M){let ce=p.cca(A,$-1),pe=ce??-1;H=pe==116||pe==84}else H=!1}}if(H){let $=A.length-8;L=$!=null?p.substr(A,0,$):p.substr(A,0,null)}else{let $;if(A==null)$=!1;else{let M=A.length;if(M<4)$=!1;else{let Z,ae,ie=p.cca(A,M-4);if((ie??-1)==46){let ue=p.cca(A,M-3),de=ue??-1;ae=de==108||de==76}else ae=!1;if(ae){let ue=p.cca(A,M-2),de=ue??-1;Z=de==111||de==79}else Z=!1;if(Z){let ue=p.cca(A,M-1),de=ue??-1;$=de==114||de==82}else $=!1}}if($){let M=A.length-4;L=M!=null?p.substr(A,0,M):p.substr(A,0,null)}else L=A}}f.push(L),g.push(nt.normalize(nt.join([h,R])))}}let _=new Ce,d=new vt(We.UNDEFINED,new ge(0,0,0),1,[new et(We.UNDEFINED,new ge(0,0,0),Ye.Raw(e))]);_.h.$locale=d;let m=f.length,k=!1,C=null,T=function(E,N){N(null)},S=function(){let E=C??r();if(E!=null){if(vl._lastError=E,n!=null){n(null);return}throw y.thrown(E)}n?.(_)},v=0,I=f.length;for(;v<I;){let E=v++,N=f[E],K=g[E];i(K,function(V){if(m-=1,V!=null)try{let B=vl.parse(V,K,T);if(B!=null){let q=Ve.extractTranslations(B).h,R=q,A=Object.keys(q),L=A.length,H=0;for(;H<L;){let $=A[H++],M=$,Z=R[$],ae=M,ie=Z;_.h[N+"#"+ae]=ie}}}catch(B){let O=y.caught(B).unwrap();if(O instanceof st){let q=O;C==null&&(C=st.of(new U('Failed to load translation file "{path}": {message}',{path:K,message:q})))}else{let q=O;C==null&&(C=st.of(new U('Failed to load translation file "{path}": {message}',{path:K,message:q==null?"null":oe.string(q)})))}}m==0&&k&&S()})}return k=!0,m==0&&S(),vl._lastError!=null?null:_}static relativePath(e,t){let l=nt.normalize(e),i=nt.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 g=o++;h.push("..")}let c=r,f=s.length;for(;c<f;){let g=c++;h.push(s[g])}return h.length==0?".":h.join("/")}static play(e,t,l,i,n,s){let r=new Rt(e,t,l,i,s);return r.start(n),r}static resume(e,t,l,i,n,s,r){let a=new Rt(e,t,l,i,r);return a.restore(n),s!=null?a.start(s):a.resume(),a}static extractTranslations(e){return Ve.extractTranslations(e)}static translationFormat(e,t){jl.translationFormat(e,t)}static generateTranslationFile(e,t,l,i){if(l==null||l=="lor")return Ve.generateTranslationFile(e,t,new Ll);if(i==null||i=="")throw y.thrown(new st("A locale is required when generating a translation file in format '"+l+"'"));if(l==null)throw y.thrown(new st("Unknown translation file format: '"+l+"'"));switch(l){case"csv":return tl.fromScript(e,t,i);case"po":return zl.fromScript(e,t,i);case"tsv":return tl.tsvFromScript(e,t,i);case"xliff":return Ut.fromScript(e,t,i);default:throw y.thrown(new st("Unknown translation file format: '"+l+"'"))}}static insertLocalizationKeys(e,t,l,i){return l==null&&(l=!0),Ve.insertLocalizationKeys(e,t,l,i)}static externalFunctions(e){let t=[],l=0,i=new El(e).getExternalFunctions();for(;l<i.length;){let n=i[l];++l,t.push(n.name)}return t}static collectHashIds(e,t){return Ve.collectHashIds(e,t)}static removeLocalizationKeys(e,t){return Ve.removeLocalizationKeys(e,t)}static extractTranslatableEntries(e){return Ve.extractTranslatableEntries(e)}static hasUntaggedTranslatableStrings(e){return Ve.hasUntaggedTranslatableStrings(e)}static print(e,t,l){let i=t,n=l;return new Ll(i??" ",n??`
34
+ `).print(e)}static update(e){bi.update(e)}}J["loreline.Loreline"]=Jl.loreline.Loreline=vl,vl.__name__="loreline.Loreline";class We{constructor(e,t,l,i){if(e<0||e>65535)throw y.thrown("Section value ("+e+") should be between 0 and 65535");if(t<0||t>65535)throw y.thrown("Branch value ("+t+") should be between 0 and 65535");if(l<0||l>65535)throw y.thrown("Block value ("+l+") should be between 0 and 65535");if(i<0||i>65535)throw y.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 ui(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 ui(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 ui(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 ui(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 ui(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 y.thrown("Node id section overflow");return new We(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 We((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 We((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 We((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 We(32768,32768,32768,32768);return t.thisVal=e,t}static fromString(e){let t=e.split(".");return new We(oe.parseInt(t[0]),oe.parseInt(t[1]),oe.parseInt(t[2]),oe.parseInt(t[3]))}static fromTwoInt32(e,t){return We.fromInt64(new ui(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"]=We,We.__name__="loreline.NodeId",Object.assign(We.prototype,{__class__:We,__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 Fl{constructor(){this.map=new Gl}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 bn(this.map)}keys(){return new Cn(this.map)}keyValueIterator(){return new Tn(this.map)}}J["loreline.NodeIdMap"]=Fl,Fl.__name__="loreline.NodeIdMap",Object.assign(Fl.prototype,{__class__:Fl});class bn{constructor(e){for(this.map=e,this.index=0;this.index<this.map._values.length&&!this.map._used[this.index];)this.index++}skipNulls(){for(;this.index<this.map._values.length&&!this.map._used[this.index];)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._used[this.index];)this.index++;return e}}J["loreline._Node.NodeIdMapIterator"]=bn,bn.__name__="loreline._Node.NodeIdMapIterator",Object.assign(bn.prototype,{__class__:bn});class Cn{constructor(e){for(this.map=e,this.index=0;this.index<this.map._values.length&&!this.map._used[this.index];)this.index++}skipNulls(){for(;this.index<this.map._values.length&&!this.map._used[this.index];)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._used[this.index];)this.index++;return We.fromTwoInt32(e,t)}}J["loreline._Node.NodeIdMapKeyIterator"]=Cn,Cn.__name__="loreline._Node.NodeIdMapKeyIterator",Object.assign(Cn.prototype,{__class__:Cn});class Tn{constructor(e){for(this.map=e,this.index=0;this.index<this.map._values.length&&!this.map._used[this.index];)this.index++}skipNulls(){for(;this.index<this.map._values.length&&!this.map._used[this.index];)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._used[this.index];)this.index++;return{key:We.fromTwoInt32(e,t),value:l}}}J["loreline._Node.NodeIdMapKeyValueIterator"]=Tn,Tn.__name__="loreline._Node.NodeIdMapKeyValueIterator",Object.assign(Tn.prototype,{__class__:Tn});class _t{constructor(e,t){_t._hx_skip_constructor||this._hx_constructor(e,t)}_hx_constructor(e,t){this.id=We.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 P.nodeFromJson(e)}}J["loreline.Node"]=Jl.loreline.Node=_t,_t.__name__="loreline.Node",Object.assign(_t.prototype,{__class__:_t});class di extends _t{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"]=di,di.__name__="loreline.Comment",di.__super__=_t,Object.assign(di.prototype,{__class__:di});class Be extends _t{constructor(e,t,l,i){if(_t._hx_skip_constructor){super();return}_t._hx_skip_constructor=!0,super(),_t._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}}J["loreline.AstNode"]=Be,Be.__name__="loreline.AstNode",Be.__super__=_t,Object.assign(Be.prototype,{__class__:Be});class dt extends Be{constructor(e,t,l,i){_t._hx_skip_constructor=!0,super(),_t._hx_skip_constructor=!1,this._hx_constructor(e,t,l,i)}_hx_constructor(e,t,l,i){this.parens=0,super._hx_constructor(e,t,l,i)}toJson(){let e=super.toJson();return this.parens>0&&(e.parens=this.parens),e}type(){return"Expr"}}J["loreline.NExpr"]=dt,dt.__name__="loreline.NExpr",dt.__super__=Be,Object.assign(dt.prototype,{__class__:dt});class Kt 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=Wl.toString(this.style),e}}J["loreline.NStateDecl"]=Kt,Kt.__name__="loreline.NStateDecl",Kt.__super__=Be,Object.assign(Kt.prototype,{__class__:Kt});class mi extends Be{constructor(e,t,l,i,n){super(e,t,i,n),this.fields=l,this.style=0}type(){return"Metadata"}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(),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.NMetadataDecl"]=mi,mi.__name__="loreline.NMetadataDecl",mi.__super__=Be,Object.assign(mi.prototype,{__class__:mi});class ii 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}}J["loreline.NObjectField"]=ii,ii.__name__="loreline.NObjectField",ii.__super__=Be,Object.assign(ii.prototype,{__class__:ii});class Zt 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=Wl.toString(this.style),e}}J["loreline.NCharacterDecl"]=Zt,Zt.__name__="loreline.NCharacterDecl",Zt.__super__=Be,Object.assign(Zt.prototype,{__class__:Zt});class Zi{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"]=Zi,Zi.__name__="loreline.NBeatParam",Object.assign(Zi.prototype,{__class__:Zi});class Ae extends Be{constructor(e,t,l,i,n,s){_t._hx_skip_constructor=!0,super(),_t._hx_skip_constructor=!1,this._hx_constructor(e,t,l,i,n,s)}_hx_constructor(e,t,l,i,n,s){this.isPublic=!1,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.isPublic&&(e.isPublic=!0),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"]=Ae,Ae.__name__="loreline.NBeatDecl",Ae.__super__=Be,Object.assign(Ae.prototype,{__class__:Ae});var Ye=it["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)};Ye.__constructs__=[Ye.Raw,Ye.Expr,Ye.Tag];class Wl{static toString(e){switch(e){case 0:return"Plain";case 1:return"Braces"}}}class ji{static toString(e){switch(e){case 0:return"Plain";case 2:return"Parens"}}}class Xi{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 et extends dt{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"]=et,et.__name__="loreline.NStringPart",et.__super__=dt,Object.assign(et.prototype,{__class__:et});class vt extends dt{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=Rn.toString(this.quotes),e}}J["loreline.NStringLiteral"]=vt,vt.__name__="loreline.NStringLiteral",vt.__super__=dt,Object.assign(vt.prototype,{__class__:vt});class fl 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=ji.toString(this.conditionStyle),e.conditionPos=this.conditionPos.toJson()),e}}J["loreline.NTextStatement"]=fl,fl.__name__="loreline.NTextStatement",fl.__super__=Be,Object.assign(fl.prototype,{__class__:fl});class Jt 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=ji.toString(this.conditionStyle),e.conditionPos=this.conditionPos.toJson()),e}}J["loreline.NDialogueStatement"]=Jt,Jt.__name__="loreline.NDialogueStatement",Jt.__super__=Be,Object.assign(Jt.prototype,{__class__:Jt});class Vl 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=Wl.toString(this.style),e}}J["loreline.NChoiceStatement"]=Vl,Vl.__name__="loreline.NChoiceStatement",Vl.__super__=Be,Object.assign(Vl.prototype,{__class__:Vl});class Dt 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=ji.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"]=Dt,Dt.__name__="loreline.NChoiceOption",Dt.__super__=Be,Object.assign(Dt.prototype,{__class__:Dt});class fi extends Be{constructor(e,t,l,i,n,s){super(e,t,n,s),this.strategy=l,this.rules=i,this.style=0}type(){return"When"}each(e){if(super.each(e),this.rules!=null){let t=0,l=this.rules.length;for(;t<l;){let i=t++,n=this.rules[i];e(n,this),n.each(e)}}}toJson(){let e=super.toJson();this.strategy!=null&&(e.strategy=this.strategy,this.strategyPos!=null&&(e.strategyPos=this.strategyPos.toJson()));let t=[],l=0,i=this.rules;for(;l<i.length;){let n=i[l];++l,t.push(n.toJson())}return e.rules=t,e.style=Wl.toString(this.style),e}}J["loreline.NWhenStatement"]=fi,fi.__name__="loreline.NWhenStatement",fi.__super__=Be,Object.assign(fi.prototype,{__class__:fi});class xi extends Be{constructor(e,t,l,i,n,s){super(e,t,n,s),this.condition=l,this.insertion=null,this.insertionCondition=null,this.insertionConditionStyle=0,this.body=i,this.style=0,this.once=!1}type(){return"WhenRule"}each(e){if(super.each(e),this.condition!=null&&(e(this.condition,this),this.condition.each(e)),this.insertion!=null&&(e(this.insertion,this),this.insertion.each(e)),this.insertionCondition!=null&&(e(this.insertionCondition,this),this.insertionCondition.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();this.condition!=null&&(e.condition=this.condition.toJson()),this.insertion!=null&&(e.insertion=this.insertion.toJson(),this.insertionCondition!=null&&(e.insertionCondition=this.insertionCondition.toJson(),e.insertionConditionStyle=ji.toString(this.insertionConditionStyle)));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.NWhenRule"]=xi,xi.__name__="loreline.NWhenRule",xi.__super__=Be,Object.assign(xi.prototype,{__class__:xi});class kl 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=Wl.toString(this.style),e}}J["loreline.NBlock"]=kl,kl.__name__="loreline.NBlock",kl.__super__=Be,Object.assign(kl.prototype,{__class__:kl});class ql 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=ji.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,c=this.elseLeadingComments;for(;u<c.length;){let f=c[u];++u,o.push(f.toJson())}h.elseLeading=o}if(this.elseTrailingComments!=null&&this.elseTrailingComments.length>0){let o=[],u=0,c=this.elseTrailingComments;for(;u<c.length;){let f=c[u];++u,o.push(f.toJson())}h.elseTrailing=o}e.comments=h}}return e}}J["loreline.NIfStatement"]=ql,ql.__name__="loreline.NIfStatement",ql.__super__=Be,Object.assign(ql.prototype,{__class__:ql});class hi 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=Xi.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 c=a[u];++u,o.push(c.toJson())}h=o}else h=null;n.push(h)}e.separatorComments=n}return e}}J["loreline.NAlternative"]=hi,hi.__name__="loreline.NAlternative",hi.__super__=Be,Object.assign(hi.prototype,{__class__:hi});class zt extends dt{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"]=zt,zt.__name__="loreline.NCall",zt.__super__=dt,Object.assign(zt.prototype,{__class__:zt});class Bl extends Be{constructor(e,t,l,i,n,s){_t._hx_skip_constructor=!0,super(),_t._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"]=Bl,Bl.__name__="loreline.NTransition",Bl.__super__=Be,Object.assign(Bl.prototype,{__class__:Bl});class ni extends Be{constructor(e,t,l,i,n,s){_t._hx_skip_constructor=!0,super(),_t._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"]=ni,ni.__name__="loreline.NInsertion",ni.__super__=Be,Object.assign(ni.prototype,{__class__:ni});class oi extends Be{constructor(e,t,l,i,n,s){_t._hx_skip_constructor=!0,super(),_t._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"]=oi,oi.__name__="loreline.NBeatCall",oi.__super__=Be,Object.assign(oi.prototype,{__class__:oi});class si extends dt{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"]=si,si.__name__="loreline.NFunctionDecl",si.__super__=dt,Object.assign(si.prototype,{__class__:si});class De extends dt{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 _t){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 _t){let r=s.value;e(r,this),r.each(e)}}}break}}toJson(){let e=super.toJson(),t=this.literalType;e.literal=it[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 _t?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"]=De,De.__name__="loreline.NLiteral",De.__super__=dt,Object.assign(De.prototype,{__class__:De});var ze=it["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)};ze.__constructs__=[ze.Number,ze.Boolean,ze.Null,ze.Array,ze.Object];class mt extends dt{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"]=mt,mt.__name__="loreline.NAccess",mt.__super__=dt,Object.assign(mt.prototype,{__class__:mt});class yl extends dt{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=oe.string(this.op),e.value=this.value.toJson(),e}}J["loreline.NAssign"]=yl,yl.__name__="loreline.NAssign",yl.__super__=dt,Object.assign(yl.prototype,{__class__:yl});class bl extends dt{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"]=bl,bl.__name__="loreline.NArrayAccess",bl.__super__=dt,Object.assign(bl.prototype,{__class__:bl});class Ht extends dt{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=oe.string(this.op),e.right=this.right.toJson(),e}}J["loreline.NBinary"]=Ht,Ht.__name__="loreline.NBinary",Ht.__super__=dt,Object.assign(Ht.prototype,{__class__:Ht});class $l extends dt{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=oe.string(this.op),e.operand=this.operand.toJson(),e}}J["loreline.NUnary"]=$l,$l.__name__="loreline.NUnary",$l.__super__=dt,Object.assign($l.prototype,{__class__:$l});class wi extends dt{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"]=wi,wi.__name__="loreline.NTernary",wi.__super__=dt,Object.assign(wi.prototype,{__class__:wi});class Xt 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}}J["loreline.NImportStatement"]=Xt,Xt.__name__="loreline.NImportStatement",Xt.__super__=Be,Object.assign(Xt.prototype,{__class__:Xt});class G{static isFields(e){return e==null?!1:le.__implements(e,ti)||e instanceof Ce?!0:e instanceof Xl||typeof e=="number"||typeof e=="number"&&(e|0)===e||typeof e=="boolean"||typeof e=="string"?!1:!se.isArray(e)}static getField(e,t,l){return le.__implements(t,ti)?t.lorelineGet(e,l):t instanceof Ce?t.h[l]:l=="length"&&typeof t=="string"?je.length(t):Le.getProperty(t,l)}static getFields(e,t){if(le.__implements(t,ti))return t.lorelineFields(e);if(t instanceof Ce){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 Le.fields(t)}static setField(e,t,l,i){le.__implements(t,ti)?t.lorelineSet(e,l,i):t instanceof Ce?t.h[l]=i:Le.setProperty(t,l,i)}static removeField(e,t,l){if(le.__implements(t,ti))return t.lorelineRemove(e,l);if(t instanceof Ce){let i=t;return Object.prototype.hasOwnProperty.call(i.h,l)?(delete i.h[l],!0):!1}else return Le.deleteField(t,l)}static fieldExists(e,t,l){return le.__implements(t,ti)?t.lorelineExists(e,l):t instanceof Ce?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 le.__implements(n,ti)&&n.lorelineCreate(e),n}return{}}}J["loreline.Objects"]=G,G.__name__="loreline.Objects";class ve extends st{constructor(e,t){super(e,t)}static of(e,t){let l=new ve(e.toString(),t);return l.keep(e),l}}J["loreline.ParseError"]=ve,ve.__name__="loreline.ParseError",ve.__super__=st,Object.assign(ve.prototype,{__class__:ve});class en{constructor(e,t,l,i){this.imported=new Ce,this.rootPath=e,this.path=t,this.imports=l,i!=null&&(this.imported=i)}}J["loreline.ParserContext"]=en,en.__name__="loreline.ParserContext",Object.assign(en.prototype,{__class__:en});class el{constructor(e,t){this.parsingCondition=!1,this.metadataParsed=!1,this.tokens=e,this.current=0,this.errors=null,this.pendingComments=null,this.lastTokenEnd=new ge(1,1,0),this.lastLineBreak=null,this.lineBreakAfterToken=!1,this.currentNodeId=We.UNDEFINED,this.rootBeat=null,this.context=t}parse(){let e=this.currentPos(),t=[],l=new Ot(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(x.LineBreak););}catch(i){let n=y.caught(i).unwrap();if(n instanceof ve){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 54:let l=t.content;++e;break;case 55:let i=t.content;++e;break;case 56:let n=t.content;++e;break;case 59:++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==x.LineBreak);){this.current++;let l=this.tokens[this.current].type;switch(l._hx_index){case 54:let i=l.content;this.pendingComments==null&&(this.pendingComments=[]),this.pendingComments.push(new di(this.nextNodeId(4),this.currentPos(),i,!1));break;case 55:let n=l.content;this.pendingComments==null&&(this.pendingComments=[]),this.pendingComments.push(new di(this.nextNodeId(4),this.currentPos(),n,!0));break;case 56:let s=l.content;this.pendingComments==null&&(this.pendingComments=[]),this.pendingComments.push(new di(this.nextNodeId(4),this.currentPos(),s,!1,!0));break;case 59: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(pl.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==22){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 54:let l=t.content;break;case 55:let i=t.content;break;case 56:let n=t.content;break;case 57:case 58:case 59: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 54:let l=t.content;break;case 55:let i=t.content;break;case 56:let n=t.content;break;case 57:case 58:case 59: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 54:let l=t.content;break;case 55:let i=t.content;break;case 56:let n=t.content;break;case 59: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 ge(1,1,0,0)}currentTokenWord(){return this.tokens!=null&&this.current>=0&&this.tokens[this.current]!=null?el.tokenWord(this.tokens[this.current].type):null}currentTokenTypeToString(){if(this.tokens!=null&&this.current>=0){let e=this.tokens[this.current],t=e!=null?e.type:null;return t!=null?pl.toCodeString(t):null}return null}check(e){return this.isAtEnd()?!1:e._hx_index==44?this.tokens[this.current].type==x.Colon:pl.equals(this.tokens[this.current].type,e)}checkString(){let e=this.tokens[this.current].type;if(e._hx_index==18){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==x.Eof:!0}isComment(e){switch(e._hx_index){case 54:let t=e.content;return!0;case 55:let l=e.content;return!0;case 56: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==x.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 54:a=r.content;break;case 55:a=r.content;break;case 56:a=r.content;break;default:a=""}let h=this.tokens[this.current].type,o;if(h._hx_index==55){let f=h.content;o=!0}else o=!1;let u=this.tokens[this.current].type,c;if(u._hx_index==56){let f=u.content;c=!0}else c=!1;i.push(new di(n,s,a,o,c))}if(this.advance(),this.isAtEnd())throw y.thrown(ve.of(new U("Unexpected end of file",null),this.currentPos()))}if(this.isAtEnd())throw y.thrown(ve.of(new U("Unexpected end of file",null),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 e?this.parseMetadataDecl():(this.addError(ve.of(new U("Unexpected: {token}",{token:this.currentTokenWord()}),this.currentPos())),this.advance(),new De(this.nextNodeId(4),this.currentPos(),null,ze.Null));case 3:if(this.peek().type==x.LParen){let O=this.parseBeatCall();return e?t.wrapInRootBeat(O):O}else return this.parseBeatDecl();break;case 4:return e?this.parseCharacterDecl():(this.addError(ve.of(new U("Unexpected: {token}",{token:this.currentTokenWord()}),this.currentPos())),this.advance(),new De(this.nextNodeId(4),this.currentPos(),null,ze.Null));case 5:let i=this.parseChoiceStatement();return e?t.wrapInRootBeat(i):i;case 6:let n=this.parseWhenStatement();return e?t.wrapInRootBeat(n):n;case 7:let s=this.currentPos();if(!e)throw y.thrown(ve.of(new U("A nested beat can't be public",null),s));this.advance();let r=this.parseBeatDecl(s);return r.isPublic=!0,r;case 8:let a=this.parseIfStatement();return e?t.wrapInRootBeat(a):a;case 10:if(this.advance(),!this.check(x.KwState))throw y.thrown(ve.of(new U("Expected 'state' after 'new'",null),this.currentPos()));let h=this.parseStateDecl(!0);return e?t.wrapInRootBeat(h):h;case 11:case 12:case 13:case 14:case 15:let o=this.parseAlternative();return e?t.wrapInRootBeat(o):o;case 17:let u=l.name,c=l.args,f=l.code,g=l.external;return e?this.parseFunction():(this.addError(ve.of(new U("Unexpected: {token}",{token:this.currentTokenWord()}),this.currentPos())),this.advance(),new De(this.nextNodeId(4),this.currentPos(),null,ze.Null));case 18:let _=l.quotes,d=l.s,m=l.attachments,k=this.parseTextStatement();return e?t.wrapInRootBeat(k):k;case 19:let C=l.n,T=this.parseExpressionStatement();return e?t.wrapInRootBeat(T):T;case 20:let S=l.b,v=this.parseExpressionStatement();return e?t.wrapInRootBeat(v):v;case 22:let I=l.name;if(this.peek().type==x.Colon){let O=this.parseDialogueStatement();return e?t.wrapInRootBeat(O):O}else{let O=this.parseExpressionStatement();return e?t.wrapInRootBeat(O):O}break;case 29:let E=this.parseInsertion();return e?t.wrapInRootBeat(E):E;case 21:case 30:case 48:case 50:case 52:let N=this.parseExpressionStatement();return e?t.wrapInRootBeat(N):N;case 42:let K=l.word,V=this.parseExpressionStatement();return e?t.wrapInRootBeat(V):V;case 43:let B=this.parseTransition();return e?t.wrapInRootBeat(B):B;default:return this.addError(ve.of(new U("Unexpected: {token}",{token:this.currentTokenWord()}),this.currentPos())),this.advance(),new De(this.nextNodeId(4),this.currentPos(),null,ze.Null)}}wrapInRootBeat(e){let t,l=null;if(this.rootBeat==null){let i=this.currentPos();t=[],this.rootBeat=new Ae(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(x.KwImport),this.context==null)throw y.thrown(new ve("Cannot import without a context",this.currentPos()));let t=0,l=this.tokens[this.current],i,n=l.type;if(n._hx_index==18){let d=n.attachments,m=n.quotes,k=n.s;t=m,i=k}else throw y.thrown(ve.of(new U("Expected the import path between quotes",null),this.currentPos()));let s=nt.directory(this.context.path),r=this.context.rootPath,a;if(r==null)a=!1;else{let d=r.length;if(d<8)a=!1;else{let m,k,C,T,S,v,I=p.cca(r,d-8);if((I??-1)==46){let E=p.cca(r,d-7),N=E??-1;v=N==108||N==76}else v=!1;if(v){let E=p.cca(r,d-6),N=E??-1;S=N==111||N==79}else S=!1;if(S){let E=p.cca(r,d-5),N=E??-1;T=N==114||N==82}else T=!1;if(T){let E=p.cca(r,d-4);C=(E??-1)==46}else C=!1;if(C){let E=p.cca(r,d-3),N=E??-1;k=N==116||N==84}else k=!1;if(k){let E=p.cca(r,d-2),N=E??-1;m=N==120||N==88}else m=!1;if(m){let E=p.cca(r,d-1),N=E??-1;a=N==116||N==84}else a=!1}}let h=Dl.resolveImportPath(s,i,a?".lor.txt":".lor");if(Object.prototype.hasOwnProperty.call(this.context.imported.h,h)){this.advance();let d=new Xt(this.nextNodeId(1),e.extendedTo(this.prevNonWhitespaceOrComment().pos),null,null);return d.path=new vt(this.nextNodeId(4),l.pos,t,[new et(this.nextNodeId(4),l.pos,Ye.Raw(i))]),this.attachComments(d)}let o=this.context.imports.h[h];if(o==null)throw y.thrown(ve.of(new U("Failed to import file at path {path} ({raw})",{path:h,raw:i}),this.currentPos()));this.context.imported.h[h]=!0;let u=new el(o,new en(this.context.rootPath,h,this.context.imports,this.context.imported));u.currentNodeId=this.currentNodeId;let c=u.parse();this.currentNodeId=u.currentNodeId;let f=0,g=u.getErrors();for(;f<g.length;){let d=g[f];++f,d.filePath==null&&(d.filePath=h),this.addError(d)}this.advance();let _=new Xt(this.nextNodeId(1),e.extendedTo(this.prevNonWhitespaceOrComment().pos),null,c);return _.path=new vt(this.nextNodeId(4),l.pos,t,[new et(this.nextNodeId(4),l.pos,Ye.Raw(i))]),this.attachComments(_)}parseDialogueStatement(){let e=this.currentPos(),t=new Jt(this.nextNodeId(4),e,null,null,null),l=this.tokens[this.current].type,i;if(l._hx_index==22)i=l.name;else throw y.thrown(ve.of(new U("Expected character name",null),this.currentPos()));t.character=i,t.characterPos=this.tokens[this.current].pos,this.advance(),this.expect(x.Colon),this.attachComments(t);let n=!1;if(this.checkBlockStart()){let s=this.parseBlockStart();if(s.type!=x.Indent)throw y.thrown(ve.of(new U("Expected indent, got {got}",{got:el.tokenWord(s.type)}),s.pos));n=!0}try{t.content=this.parseStringLiteral()}catch(s){let r=y.caught(s).unwrap();if(r instanceof ve){let a=r;this.addError(a),t.content=new vt(this.nextNodeId(4),this.currentPos(),0,[new et(this.nextNodeId(4),this.currentPos(),Ye.Raw("?"))])}else throw s}if(!this.lineBreakAfterToken&&this.match(x.KwIf)){let s=this.previous().pos;t.condition=this.parseConditionExpression(),t.conditionStyle=this.takeConditionParens(t.condition),t.conditionPos=s.extendedTo(this.prevNonWhitespaceOrComment().pos)}if(n){for(;this.match(x.LineBreak););this.expect(x.Unindent)}return t.pos=t.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),t}parseStatementBlock(e){let t=this.parseBlockStart().type==x.Indent?x.Unindent:x.RBrace;for(;!this.check(t)&&!this.isAtEnd();){for(;this.match(x.LineBreak)||t!=x.Unindent&&this.match(x.Unindent););if(this.check(t))break;try{e.push(this.parseNode())}catch(l){let i=y.caught(l).unwrap();if(i instanceof ve){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(x.LineBreak)||t!=x.Unindent&&this.match(x.Unindent););}return this.expect(t),t==x.RBrace?1:0}parseStateDecl(e){let t=this.currentPos(),l=new Kt(this.nextNodeId(3),t,e,[]);this.expect(x.KwState);let i=this.parseBlockStart().type==x.Indent?x.Unindent:x.RBrace;for(l.style=i==x.RBrace?1:0,this.attachComments(l);!this.check(i)&&!this.isAtEnd();){for(;this.match(x.LineBreak)||i!=x.Unindent&&this.match(x.Unindent););for(l.fields.push(this.parseObjectField());this.match(x.LineBreak)||i!=x.Unindent&&this.match(x.Unindent););}for(;this.match(x.LineBreak)||i!=x.Unindent&&this.match(x.Unindent););return this.expect(i),l.pos=l.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),l}parseMetadataDecl(){let e=this.currentPos();if(this.metadataParsed)throw y.thrown(ve.of(new U("A story can have only one metadata block",null),e));this.metadataParsed=!0;let t=new mi(this.nextNodeId(3),e,[]);this.expect(x.KwMetadata);let l=this.parseBlockStart().type==x.Indent?x.Unindent:x.RBrace;for(t.style=l==x.RBrace?1:0,this.attachComments(t);!this.check(l)&&!this.isAtEnd();){for(;this.match(x.LineBreak)||l!=x.Unindent&&this.match(x.Unindent););let i=this.parseObjectField();if(!el.isConstantValue(i.value))throw y.thrown(ve.of(new U("Metadata values are constant: text, numbers, true or false, lists and objects",null),i.pos));for(t.fields.push(i);this.match(x.LineBreak)||l!=x.Unindent&&this.match(x.Unindent););}for(;this.match(x.LineBreak)||l!=x.Unindent&&this.match(x.Unindent););return this.expect(l),t.pos=t.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),t}parseObjectField(){let e=this.currentPos(),t=this.expectIdentifier(),l=new ii(this.nextNodeId(3),e,t,null);return this.expect(x.Colon),this.attachComments(l),this.checkBlockStart()?l.value=this.parseObjectLiteral():l.value=this.parseExpression(),l.pos=l.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),l}parseBeatDecl(e){let t=e,l=t??this.currentPos(),i=new Ae(this.nextNodeId(1),l,null,[],[]);if(this.expect(x.KwBeat),i.pos=l.extendedTo(this.currentPos()),i.name=this.expectIdentifier(),this.attachComments(i),this.match(x.LParen)){let r=[];if(!this.check(x.RParen))do{for(;this.match(x.LineBreak););let a=this.currentPos(),h=this.expectIdentifier(),o=null;this.match(x.OpAssign)&&(o=this.parseExpression());let u=0;for(;u<r.length;){let c=r[u];++u,c.name==h&&this.addError(ve.of(new U("Duplicate beat parameter: {name}",{name:h}),a))}for(r.push(new Zi(h,a,o));this.match(x.LineBreak););}while(this.match(x.Comma));this.expect(x.RParen),i.params=r}let s=this.parseBlockStart().type==x.Indent?x.Unindent:x.RBrace;for(i.style=s==x.RBrace?1:0,this.attachComments(i);!this.check(s)&&!this.isAtEnd();){for(;this.match(x.LineBreak)||s!=x.Unindent&&this.match(x.Unindent););for(i.body.push(this.parseNode());this.match(x.LineBreak)||s!=x.Unindent&&this.match(x.Unindent););}for(;this.match(x.LineBreak)||s!=x.Unindent&&this.match(x.Unindent););return this.expect(s),i.pos=i.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),i}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!=x.LineBreak){if(n.type==x.Indent){++l,e=n;continue}if(n.type==x.LBrace){t==null&&(t=n);continue}break}}if(t!=null)return!0;if(e!=null){if(l>1)throw y.thrown(ve.of(new U("Invalid indentation level",null),e.pos));return!0}else return!1}parseBlockStart(){let e=null,t=null,l=0;for(;!this.isAtEnd();)if(!this.match(x.LineBreak)){if(this.match(x.Indent)){++l,e=this.prevWithType(x.Indent);continue}if(this.match(x.LBrace)){t==null&&(t=this.prevWithType(x.LBrace));continue}break}if(t!=null)return t;if(e!=null){if(l>1)throw y.thrown(ve.of(new U("Invalid indentation level",null),e.pos));return e}else return this.addError(ve.of(new U("Expected {a} or {b}, got {got}",{a:el.tokenWord(x.LBrace),b:el.tokenWord(x.Indent),got:this.currentTokenWord()}),this.currentPos())),new Ee(x.Indent,this.currentPos())}parseCharacterDecl(){let e=this.currentPos(),t=new Zt(this.nextNodeId(3),e,null,null,[]);if(this.expect(x.KwCharacter),t.name=this.expectIdentifier(),t.namePos=this.prevNonWhitespaceOrComment().pos,!this.check(x.Indent)&&!this.check(x.LBrace))return t.style=0,t.pos=t.pos.extendedTo(t.namePos),this.attachComments(t),t;let l=this.parseBlockStart().type==x.Indent?x.Unindent:x.RBrace;for(t.style=l==x.RBrace?1:0,this.attachComments(t);!this.check(l)&&!this.isAtEnd();){for(;this.match(x.LineBreak)||l!=x.Unindent&&this.match(x.Unindent););for(t.fields.push(this.parseObjectField());this.match(x.LineBreak)||l!=x.Unindent&&this.match(x.Unindent););}for(;this.match(x.LineBreak)||l!=x.Unindent&&this.match(x.Unindent););return this.expect(l),t.pos=t.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),t}parseTextStatement(){let e=this.currentPos(),t=this.attachComments(new fl(this.nextNodeId(4),e,null));if(t.content=this.parseStringLiteral(),!this.lineBreakAfterToken&&this.match(x.KwIf)){let l=this.previous().pos;t.condition=this.parseConditionExpression(),t.conditionStyle=this.takeConditionParens(t.condition),t.conditionPos=l.extendedTo(this.prevNonWhitespaceOrComment().pos)}return t.pos=t.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),t}parseChoiceStatement(){let e=this.currentPos(),t=new Vl(this.nextNodeId(2),e,[]);this.expect(x.KwChoice);let l=this.parseBlockStart().type==x.Indent?x.Unindent:x.RBrace;for(t.style=l==x.RBrace?1:0,this.attachComments(t);!this.check(l)&&!this.isAtEnd();){for(;this.match(x.LineBreak)||l!=x.Unindent&&this.match(x.Unindent););for(t.options.push(this.parseChoiceOption(l));this.match(x.LineBreak)||l!=x.Unindent&&this.match(x.Unindent););}return this.expect(l),t.pos=t.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),t}parseChoiceOption(e){let t=this.currentPos(),l=this.attachComments(new Dt(this.nextNodeId(3),t,null,null,null,0,[])),i=null,n=!1;try{this.check(x.OpPlus)?(n=!0,l.insertion=this.parseInsertion()):(this.match(x.OpMinus)&&(l.once=!0),l.text=this.parseStringLiteral())}catch(s){let r=y.caught(s).unwrap();if(r instanceof ve){let a=r;this.addError(a),i=this.currentPos(),this.currentPos().offset==t.offset&&this.advance(),l.text=new vt(this.nextNodeId(4),this.currentPos(),0,[new et(this.nextNodeId(4),this.currentPos(),Ye.Raw("?"))])}else throw s}if(this.match(x.KwIf)){let s=this.previous().pos,r=this.currentPos().offset;try{l.condition=this.parseConditionExpression(),l.conditionStyle=this.takeConditionParens(l.condition),l.conditionPos=s.extendedTo(this.prevNonWhitespaceOrComment().pos)}catch(a){let h=y.caught(a).unwrap();if(h instanceof ve){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=y.caught(r).unwrap();if(a instanceof ve){let h=a;this.addError(h),i=this.currentPos(),this.currentPos().offset==s&&this.advance(),l.body.length==0&&(l.body=[new De(this.nextNodeId(4),this.currentPos(),null,ze.Null)])}else throw r}}else if(this.check(x.Arrow)){let s=this.currentPos().offset;try{l.body=[],l.body.push(this.parseNode())}catch(r){let a=y.caught(r).unwrap();if(a instanceof ve){let h=a;this.addError(h),i=this.currentPos(),this.currentPos().offset==s&&this.advance(),l.body.length==0&&(l.body=[new De(this.nextNodeId(4),this.currentPos(),null,ze.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}parseWhenStatement(){let e=this.currentPos(),t=new fi(this.nextNodeId(2),e,null,[]),l=this.tokens[this.current];this.expect(x.KwWhen);let i=this.tokens[this.current].type;if(i._hx_index==22){let s=i.name;this.tokens[this.current].pos.line==l.pos.line&&(t.strategy=s,t.strategyPos=this.tokens[this.current].pos,this.advance())}let n=this.parseBlockStart().type==x.Indent?x.Unindent:x.RBrace;for(t.style=n==x.RBrace?1:0,this.attachComments(t);!this.check(n)&&!this.isAtEnd();){for(;this.match(x.LineBreak)||n!=x.Unindent&&this.match(x.Unindent););if(this.check(n)||this.isAtEnd())break;for(t.rules.push(this.parseWhenRule());this.match(x.LineBreak)||n!=x.Unindent&&this.match(x.Unindent););}return this.expect(n),t.pos=t.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),t}parseWhenRule(){let e=this.currentPos(),t=this.attachComments(new xi(this.nextNodeId(3),e,null,[])),l=null;try{if(this.check(x.OpPlus))t.insertion=this.parseInsertion(),this.match(x.KwIf)&&(t.insertionCondition=this.parseConditionExpression(),t.insertionConditionStyle=this.takeConditionParens(t.insertionCondition));else{let i=this.tokens[this.current];i.type==x.OpMinus&&this.current+1<this.tokens.length&&this.tokens[this.current+1].pos.offset>i.pos.offset+i.pos.length&&(this.advance(),t.once=!0),t.condition=this.parseConditionExpression(),t.style=this.parseStatementBlock(t.body)}}catch(i){let n=y.caught(i).unwrap();if(n instanceof ve){let s=n;this.addError(s),l=this.currentPos(),this.currentPos().offset==e.offset&&this.advance()}else throw i}if(t.pos=t.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),l!=null)for(;!this.isAtEnd()&&this.currentPos().line<=l.line+1;)this.advance();return t}isExpressionStart(){let e=this.tokens[this.current].type;switch(e._hx_index){case 18:let t=e.quotes,l=e.s,i=e.attachments;return!0;case 19:let n=e.n;return!0;case 20:let s=e.b;return!0;case 22:let r=e.name;return this.peek().type!=x.Colon;case 21:case 30:case 48:case 50:case 52:return!0;case 42:let a=e.word;return!0;default:return!1}}parseExpressionStatement(){let e=this.parseExpression();if(this.match(x.OpAssign)||this.match(x.OpPlusAssign)||this.match(x.OpMinusAssign)||this.match(x.OpMultiplyAssign)||this.match(x.OpDivideAssign)||this.match(x.OpUnquotedAssign)){let t=this.previous().type,l=this.attachComments(new yl(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 18:let t=e.quotes,l=e.s,i=e.attachments;return!0;case 22:let n=e.name;return this.peek().type==x.Colon?!0:this.peek().type==x.Arrow;case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 43:return!0;default:return!1}}parseIfStatement(){let e=this.currentPos(),t=new ql(this.nextNodeId(4),e,null,0,null,null);for(this.expect(x.KwIf),t.condition=this.parseConditionExpression(),t.conditionStyle=this.takeConditionParens(t.condition);this.match(x.LineBreak););this.attachComments(t),t.thenBranch=new kl(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==x.KwElse){for(this.advance();this.match(x.LineBreak););if(this.attachElseComments(t,l),this.check(x.KwIf)){t.elseBranch=new kl(this.nextNodeId(3),this.currentPos(),null);let i=this.parseIfStatement();t.elseBranch.body=[i],t.elseBranch.style=0}else t.elseBranch=new kl(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 11:t=0;break;case 12:t=1;break;case 13:t=2;break;case 14:t=3;break;case 15:t=4;break;default:throw y.thrown(ve.of(new U("Expected sequence, cycle, once, pick or shuffle",null),this.currentPos()))}let l=new hi(this.nextNodeId(2),e,t,[]);for(this.advance();this.match(x.LineBreak););this.attachComments(l);let i=new kl(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(x.Separator);){let n=this.tokens[this.current];for(this.advance();this.match(x.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 kl(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(x.Arrow),this.match(x.Dot))return this.attachComments(new Bl(this.nextNodeId(4),e.extendedTo(this.prevNonWhitespaceOrComment().pos),".",this.prevNonWhitespaceOrComment().pos));if(this.check(x.KwBeat)){let s=this.currentPos();this.advance(),this.expect(x.LParen);let r=this.parseCallArguments();r.length==0&&this.addError(ve.of(new U("beat() needs the name of a beat",null),s));let a=new Bl(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(x.LParen)&&(i=this.parseCallArguments());let n=new Bl(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(x.OpPlus),this.check(x.KwBeat)){let s=this.currentPos();this.advance(),this.expect(x.LParen);let r=this.parseCallArguments();r.length==0&&this.addError(ve.of(new U("beat() needs the name of a beat",null),s));let a=new ni(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(x.LParen)&&(i=this.parseCallArguments());let n=new ni(this.nextNodeId(4),e.extendedTo(this.prevNonWhitespaceOrComment().pos),t,l);return n.args=i,this.attachComments(n)}parseBeatCall(){let e=this.currentPos();this.expect(x.KwBeat),this.expect(x.LParen);let t=this.parseCallArguments();t.length==0&&this.addError(ve.of(new U("beat() needs the name of a beat",null),e));let l=new oi(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==17){let l=t.name,i=t.args,n=t.code,s=t.external;return this.advance(),this.attachComments(new si(this.nextNodeId(3),e,l,[].concat(i),n,s))}else throw y.thrown(ve.of(new U("Unexpected token in expression",null),this.currentPos()))}parseExpression(){try{let e=this.parseTernary();if(this.check(x.OpAssign)||this.check(x.OpPlusAssign)||this.check(x.OpMinusAssign)||this.check(x.OpMultiplyAssign)||this.check(x.OpDivideAssign)||this.check(x.OpUnquotedAssign)){let t=this.tokens[this.current].type;this.advance();let l=this.attachComments(new yl(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=y.caught(e).unwrap();return t instanceof ve&&this.addError(t),new De(this.nextNodeId(4),this.currentPos(),null,ze.Null)}}parseTernary(){let e=this.parseLogicalOr();if(this.match(x.Question)){let t=this.parseTernary();this.expect(x.Colon);let l=this.parseTernary();e=this.attachComments(new wi(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(x.OpOr(!1));){let t=this.previous().type,l=this.attachComments(new Ht(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(x.OpAnd(!1));){let t=this.previous().type,l=this.attachComments(new Ht(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(x.OpEquals(!1))||this.match(x.OpNotEquals(!1));){let t=this.previous().type,l=this.attachComments(new Ht(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(x.OpGreater)||this.match(x.OpGreaterEq)||this.match(x.OpLess)||this.match(x.OpLessEq);){let t=this.previous().type,l=this.attachComments(new Ht(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(x.OpPlus)||this.match(x.OpMinus);){let t=this.previous().type,l=this.attachComments(new Ht(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(x.OpMultiply)||this.match(x.OpDivide)||this.match(x.OpModulo);){let t=this.previous().type,l=this.attachComments(new Ht(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(x.OpNot(!1))||this.match(x.OpMinus)){let e=this.previous().type,t=this.attachComments(new $l(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 18:let l=t.quotes,i=t.s,n=t.attachments;return this.parsePostfix(e,this.parseStringLiteral());case 19:let s=t.n;return this.advance(),this.attachComments(new De(this.nextNodeId(4),e,s,ze.Number));case 20:let r=t.b;return this.advance(),this.attachComments(new De(this.nextNodeId(4),e,r,ze.Boolean));case 21:return this.advance(),this.attachComments(new De(this.nextNodeId(4),e,null,ze.Null));case 22:let a=t.name;if(this.peek().type==x.Colon){let o=[this.parseObjectField()];return new De(this.nextNodeId(4),e.extendedTo(this.prevNonWhitespaceOrComment().pos),o,ze.Object(0))}else return this.advance(),this.parseIdentifierExpression(e,a);break;case 48:return this.parsePostfix(e,this.parseObjectLiteral());case 50:this.advance();let h=this.parseExpression();return this.expect(x.RParen),h.parens++,this.parsePostfix(e,h);case 52:return this.parsePostfix(e,this.parseArrayLiteral());default:throw y.thrown(ve.of(new U("Unexpected token in expression",null),this.currentPos()))}}parseStringLiteral(){let e=this.currentPos(),t=[],l=this.tokens[this.current].type;if(l._hx_index==18){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 c=this.makeStringPartPosition(r,n,0);c.length=r.length;let f=this.nextNodeId(4),g=this.nextNodeId(4);return t.push(new et(g,c,Ye.Raw(n))),this.advance(),this.attachComments(new vt(f,e,i,t))}let h=this.attachComments(new vt(this.nextNodeId(4),e,i,t)),o=0,u=s.length;for(;o<u;){let c=o++,f=s[c];switch(f._hx_index){case 0:let g=f.braces,_=f.inTag,d=f.expr,m=f.start,k=f.length;if(a>=m+k)continue;if(m>a){let v=this.makeStringPartPosition(r,n,a);v.length=m-a;let I=m-a;t.push(new et(this.nextNodeId(4),v,Ye.Raw(I!=null?p.substr(n,a,I):p.substr(n,a,null))))}t.push(this.parseStringInterpolation(g,_,d,m,k,n)),a=m+k;break;case 1:let C=f.closing,T=f.start,S=f.length;if(a>=T+S)continue;if(T>a){let v=this.makeStringPartPosition(r,n,a);v.length=T-a;let I=T-a;t.push(new et(this.nextNodeId(4),v,Ye.Raw(I!=null?p.substr(n,a,I):p.substr(n,a,null))))}t.push(this.parseStringTag(C,T,S,n,i,s)),a=T+S;break}}if(a<n.length){let c=this.makeStringPartPosition(r,n,a);c.length=n.length-a;let f=null;t.push(new et(this.nextNodeId(4),c,Ye.Raw(f!=null?p.substr(n,a,f):p.substr(n,a,null))))}if(this.advance(),this.pendingComments!=null){let c=null,f=0,g=this.pendingComments;for(;f<g.length;){let _=g[f];++f,_.pos.line==e.line?(h.trailingComments==null&&(h.trailingComments=[]),h.trailingComments.push(_)):(c==null&&(c=[]),c.push(_))}this.pendingComments=c}return h}else throw y.thrown(ve.of(new U("Expected text, got {got}",{got:this.currentTokenWord()}),this.currentPos()))}makeStringPartPosition(e,t,l){let i=e.line,n=e.column,s=0,r=l;for(;s<r;){let a=s++,h=p.cca(t,a);(h??-1)==10?(++i,n=1):++n}return new ge(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(ve.of(l!=null?new U("Invalid access: '{name}'",{name:l}):new U("Invalid access: null",null),e)),t!=null)if(i!=null)e=new ge(t.pos.line,t.pos.column,t.pos.offset,i.offset+l.length-t.pos.offset);else throw y.thrown(ve.of(new U("Invalid access (missing name position)",null),e));else if(e.length==0){let n=i!=null?i.length:null;e=new ge(e.line,e.column,e.offset,n??l.length)}}return new mt(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 c=new U("Empty interpolation",null),f=l[0],g=f!=null?f.pos:null;this.addError(ve.of(c,g??this.currentPos()));let _=this.nextNodeId(4),d=this.nextNodeId(4),m=l[0],k=m!=null?m.pos:null;return new et(_,h,Ye.Expr(new De(d,k??this.currentPos(),null,ze.Null)))}let o=null;if(!e&&l.length>0){let c=null,f=0,g=!1;for(;f<l.length;){let _=l[f];++f;let d=_.type;switch(d._hx_index){case 22:let m=d.name;if(c==null)c=this.attachComments(this.makeAccess(_.pos,null,m,null));else if(g)c=this.attachComments(this.makeAccess(_.pos,c,m,_.pos));else{this.addError(ve.of(new U("Missing dot in field access",null),_.pos));let M=this.nextNodeId(4),Z=this.nextNodeId(4),ae=l[0],ie=ae!=null?ae.pos:null;return new et(M,h,Ye.Expr(new De(Z,ie??this.currentPos(),null,ze.Null)))}g=!1;break;case 47:if(c==null){this.addError(ve.of(new U("Leading dot in field access",null),_.pos));let M=this.nextNodeId(4),Z=this.nextNodeId(4),ae=l[0],ie=ae!=null?ae.pos:null;return new et(M,h,Ye.Expr(new De(Z,ie??this.currentPos(),null,ze.Null)))}g=!0;break;case 50:if(c==null){this.addError(ve.of(new U("Function call without target",null),_.pos));let M=this.nextNodeId(4),Z=this.nextNodeId(4),ae=l[0],ie=ae!=null?ae.pos:null;return new et(M,h,Ye.Expr(new De(Z,ie??this.currentPos(),null,ze.Null)))}let k=_.pos,C=[],T=[],S=1,v=0;for(;f<l.length&&S>0;){let M=l[f];switch(++f,M.type._hx_index){case 46:S==1&&v==0?T.length>0&&(C.push(T),T=[]):T.push(M);break;case 48:case 52:++v,T.push(M);break;case 49:case 53:--v,T.push(M);break;case 50:++S,T.push(M);break;case 51:--S,S>0?T.push(M):T.length>0&&C.push(T);break;default:T.push(M)}}if(S>0){this.addError(ve.of(new U("Unterminated function call",null),k));let M=this.nextNodeId(4),Z=this.nextNodeId(4),ae=l[0],ie=ae!=null?ae.pos:null;return new et(M,h,Ye.Expr(new De(Z,ie??this.currentPos(),null,ze.Null)))}let I=[],E=0;for(;E<C.length;){let M=C[E];++E;let Z=new el(M);Z.currentNodeId=this.currentNodeId;let ae=Z.parseExpression();I.push(ae),this.currentNodeId=Z.currentNodeId}c=this.attachComments(new zt(this.nextNodeId(4),k.extendedTo(l[f-1].pos),c,I)),g=!1;break;case 52:if(c==null){this.addError(ve.of(new U("Array access without target",null),_.pos));let M=this.nextNodeId(4),Z=this.nextNodeId(4),ae=l[0],ie=ae!=null?ae.pos:null;return new et(M,h,Ye.Expr(new De(Z,ie??this.currentPos(),null,ze.Null)))}let N=_.pos,K=[],V=1,B=null;for(;f<l.length&&V>0;){let M=l[f];switch(++f,M.type._hx_index){case 52:++V,K.push(M);break;case 53:--V,V>0&&K.push(M),B=M;break;default:K.push(M)}}if(V>0){this.addError(ve.of(new U("Unterminated array access",null),N));let M=this.nextNodeId(4),Z=this.nextNodeId(4),ae=l[0],ie=ae!=null?ae.pos:null;return new et(M,h,Ye.Expr(new De(Z,ie??this.currentPos(),null,ze.Null)))}let O=new el(K);O.currentNodeId=this.currentNodeId;let q=O.parseExpression();this.currentNodeId=O.currentNodeId;let R=h.extendedTo(l[f-1].pos);R.length+=1,c=this.attachComments(new bl(this.nextNodeId(4),R,c,q)),g=!1;break;default:this.addError(ve.of(new U("Unexpected token in field access: {token}",{token:el.tokenWord(_.type)}),_.pos));let A=this.nextNodeId(4),L=this.nextNodeId(4),H=l[0],$=H!=null?H.pos:null;return new et(A,h,Ye.Expr(new De(L,$??this.currentPos(),null,ze.Null)))}}if(g){let _=l.length-1;this.addError(ve.of(new U("Trailing dot in field access",null),l[_].pos))}o=c}else{let c=new el(l);c.currentNodeId=this.currentNodeId,o=c.parseExpression(),this.currentNodeId=c.currentNodeId,c.isAtEnd()||this.addError(ve.of(new U("Unexpected tokens after interpolation expression",null),c.tokens[c.current].pos))}let u=new ge(h.line,h.column+(e?1:0),h.offset-(e?2:0),n);return new et(this.nextNodeId(4),u,Ye.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),c=o+u,f=this.nextNodeId(4),g=!1;if(s!=null){let k=0,C=s.length;e:for(;k<C;){let T=k++,S=s[T];switch(S._hx_index){case 0:let v=S.braces,I=S.inTag,E=S.expr,N=S.start,K=S.length,V=N+K;if(N>=o&&V<=c){g=!0;break e}break;case 1:let B=S.closing,O=S.start,q=S.length;continue}}}if(!g){let k=this.makeStringPartPosition(r,i,o);k.length=u;let C=this.nextNodeId(4),T=this.nextNodeId(4);return new et(f,a,Ye.Tag(e,this.attachComments(new vt(C,k,0,[new et(T,k,Ye.Raw(u!=null?p.substr(i,o,u):p.substr(i,o,null)))]))))}let _=[],d=this.attachComments(new vt(this.nextNodeId(4),a,0,_)),m=o;if(s!=null){let k=0,C=s.length;for(;k<C;){let T=k++,S=s[T];switch(S._hx_index){case 0:let v=S.inTag,I=S.braces,E=S.expr,N=S.start,K=S.length,V=N+K;if(N>=o&&V<=c){if(N>m){let A=this.makeStringPartPosition(r,i,o);A.length=N-o;let L=N-m;_.push(new et(this.nextNodeId(4),A,Ye.Raw(L!=null?p.substr(i,m,L):p.substr(i,m,null))))}let R=this.parseStringInterpolation(I,!0,E,N,K,i);R.pos=this.makeStringPartPosition(r,i,N),R.pos.length=K,_.push(R),m=V}break;case 1:let B=S.closing,O=S.start,q=S.length;continue}}}if(m<c){let k=null,C=this.makeStringPartPosition(a,k!=null?p.substr(i,t,k):p.substr(i,t,null),m-t+h);C.length=o+c-m;let T=c-m;_.push(new et(this.nextNodeId(4),C,Ye.Raw(T!=null?p.substr(i,m,T):p.substr(i,m,null))))}return new et(f,a,Ye.Tag(e,d))}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(x.Dot,!1)){let l=null,i=this.currentPos();this.checkIdentifier()?l=this.expectIdentifier():(this.addError(ve.of(new U("Expected name after '.'",null),this.currentPos())),l=""),t=this.attachComments(this.makeAccess(e,t,l,i))}else if(this.match(x.LBracket)){let l=this.parseExpression();this.expect(x.RBracket);let i=e.extendedTo(this.previous().pos);t=this.attachComments(new bl(this.nextNodeId(4),i,t,l))}else if(this.match(x.LParen)){let l=this.parseCallArguments();t=this.attachComments(new zt(this.nextNodeId(4),e.extendedTo(this.previous().pos),t,l))}else break;return t}parseArrayLiteral(){let e=this.currentPos(),t=[],l=new De(this.nextNodeId(4),e,t,ze.Array);this.expect(x.LBracket),this.attachComments(l);let i=!1;for(;!this.check(x.RBracket)&&!this.isAtEnd();){if(i){for(;this.match(x.LineBreak);)i=!1;this.match(x.Comma)&&(i=!1)}for(;this.match(x.LineBreak)||this.match(x.Indent)||this.match(x.Unindent);)i=!1;if(!this.check(x.RBracket)&&i)throw y.thrown(ve.of(new U("Expected comma or line break between elements",null),this.currentPos()));for(;this.match(x.LineBreak)||this.match(x.Indent)||this.match(x.Unindent););this.check(x.RBracket)||t.push(this.parseExpression());let n=this.previous();i=n.type!=x.Colon&&n.type!=x.LineBreak&&n.type!=x.Unindent}for(;this.match(x.LineBreak)||this.match(x.Indent)||this.match(x.Unindent););return this.expect(x.RBracket),l.pos=l.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),l}parseObjectLiteral(){let e=this.currentPos(),t=[],l=this.parseBlockStart().type==x.Indent?x.Unindent:x.RBrace,i=l==x.RBrace?1:0,n=new De(this.nextNodeId(4),l!=x.RBrace?this.nextNonWhitespaceOrComment().pos:e,t,ze.Object(i));this.attachComments(n);let s=!1;for(;!this.check(l)&&!this.isAtEnd();){if(s){for(;this.match(x.LineBreak)||l!=x.Unindent&&this.match(x.Unindent);)s=!1;this.match(x.Comma)&&(s=!1)}for(;this.match(x.LineBreak)||l!=x.Unindent&&this.match(x.Unindent);)s=!1;if(!this.check(l)&&s)throw y.thrown(ve.of(new U("Expected comma or line break between fields",null),this.currentPos()));for(;this.match(x.LineBreak)||l!=x.Unindent&&this.match(x.Unindent););this.check(l)||t.push(this.parseObjectField());let r=this.previous();s=r.type!=x.Colon&&r.type!=x.LineBreak&&r.type!=x.Unindent}for(;this.match(x.LineBreak)||l!=x.Unindent&&this.match(x.Unindent););return this.expect(l),n.pos=n.pos.extendedTo(this.prevNonWhitespaceOrComment().pos),n}parseCallArguments(){let e=[];if(!this.check(x.RParen))do{for(;this.match(x.LineBreak););for(e.push(this.parseExpression());this.match(x.LineBreak););}while(this.match(x.Comma));return this.expect(x.RParen),e}parseConditionExpression(){let e=this.parsingCondition;this.parsingCondition=!0;let t=null;try{t=this.parseExpression(),t!=null&&le.getClass(t)==yl&&this.addError(ve.of(new U("A condition can't assign a value. To compare, write '=='.",null),t.pos))}catch(l){let i=y.caught(l).unwrap();if(i instanceof ve){let n=i;this.addError(n),t=new De(this.nextNodeId(4),this.currentPos(),null,ze.Null)}else throw l}return this.parsingCondition=e,t}takeConditionParens(e){return e!=null&&e.parens>0?(e.parens--,2):0}match(e,t){return t==null&&(t=!0),this.check(e)?(this.advance(t),!0):!1}isAtLineBreak(){return this.lineBreakAfterToken?!0:this.tokens[this.current].type==x.LineBreak}expect(e){if(this.check(e))return this.advance();{let t=el.tokenWord(e),l=this.isAtEnd()?el.tokenWord(x.Eof):this.currentTokenWord(),i=this.tokens,n=Math.min(this.current,this.tokens.length-1)|0,s=ve.of(new U("Expected {type}, got {got}",{type:t,got:l}),i[n].pos);switch(e._hx_index){case 49:case 51:case 58:return this.addError(s),new Ee(e,this.currentPos());default:}throw y.thrown(s)}}checkIdentifier(){let e=this.tokens[this.current].type;if(e._hx_index==22){let t=e.name;return!0}else return!1}expectIdentifier(){let e=this.tokens[this.current].type;if(e._hx_index==22){let t=e.name;return this.advance(),t}else throw y.thrown(ve.of(new U("Expected name, got {got}",{got:this.currentTokenWord()}),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 18:let t=e.quotes,l=e.s,i=e.attachments;if(this.previous().type==x.RBrace)return;this.advance();break;case 43:this.advance(),(this.check(x.Dot)||pl.isIdentifier(this.tokens[this.current].type))&&this.advance();return;case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 49:case 57:return;default:this.advance()}}}requiresNewLine(){switch(this.tokens[this.current].type._hx_index){case 9:case 43:case 49:return!1;default:return!0}}addError(e){return this.errors==null&&(this.errors=[]),this.errors.includes(e)||this.errors.push(e),e}static tokenWord(e){switch(e._hx_index){case 17:let t=e.name,l=e.args,i=e.code,n=e.external;return new Ct("function\xA7token");case 18:let s=e.quotes,r=e.s,a=e.attachments;return new Ct("string\xA7token");case 19:let h=e.n;return new Ct("number\xA7token");case 20:let o=e.b;return new Ct("boolean\xA7token");case 22:let u=e.name;return new Ct("name\xA7token");case 54:let c=e.content;return new Ct("comment\xA7token");case 55:let f=e.content;return new Ct("multiline comment\xA7token");case 56:let g=e.content;return new Ct("hash comment\xA7token");case 57:return new Ct("indent\xA7token");case 58:return new Ct("unindent\xA7token");case 59:return new Ct("line break\xA7token");case 60:return new Ct("end of file");default:return pl.toCodeString(e)}}static isConstantValue(e){if(e==null)return!0;if(e instanceof vt){let t=0,l=e.parts;for(;t<l.length;){let i=l[t];++t;let n=i.partType;if(n._hx_index==0){let s=n.text}else return!1}return!0}if(e instanceof De){let t=e,l=t.literalType;switch(l._hx_index){case 3:let i=0,n=t.value;for(;i<n.length;){let h=n[i];if(++i,!el.isConstantValue(h))return!1}break;case 4:let s=l.style,r=0,a=t.value;for(;r<a.length;){let h=a[r];if(++r,!el.isConstantValue(h.value))return!1}break;default:}return!0}return!1}}J["loreline.Parser"]=el,el.__name__="loreline.Parser",Object.assign(el.prototype,{__class__:el});class gi{static scan(e){let t=[],l=e.length,i=0,n=0;for(;n<l;){let s=p.cca(e,n),r=s??-1;if(r==92){n+=2;continue}if(r==40){let a=gi.scanParentheses(e,n,l);if(a!=null){t.push(a),n=a.end,i=n;continue}}if(r==124){let a=gi.scanWords(e,n,l,i);if(a!=null){t.push(a),n=a.end,i=n;continue}}++n}return t}static countExpr(e,t){let l=t-1;for(;l>=0;){let i=e[l].partType;switch(i._hx_index){case 0:let n=i.text;break;case 1:return i.expr;case 2:let r=i.closing,a=i.expr,h=a.parts.length-1;for(;h>=0;){let o=a.parts[h].partType;if(o._hx_index==1)return o.expr;--h}break}--l}return null}static scanParentheses(e,t,l){let i=[],n=-1,s=t+1;for(;s<l;){let f=p.cca(e,s),g=f??-1;if(g==92){s+=2;continue}if(g==124)i.push(s);else if(g==41){n=s;break}++s}if(n==-1||i.length==0)return null;let r=[],a=[],h=[t],o=t+1,u=0,c=i.concat([n]);for(;u<c.length;){let f=c[u];++u;let g=o;for(;;){let k;if(g<f){let C=p.cca(e,g),T=C??-1;k=T>=48&&T<=57}else k=!1;if(!k)break;++g}let _=o,d=null,m;if(g>o&&g<f){let k=p.cca(e,g);m=(k??-1)==58}else m=!1;if(m){d=oe.parseInt(g!=null?e.substring(o,g):e.substring(o));let k=o,C=g+1;for(;k<C;){let S=k++;h.push(S)}_=g+1;let T;if(_<f){let S=p.cca(e,_);T=(S??-1)==32}else T=!1;T&&++_}if(f==_)return null;r.push(f!=null?e.substring(_,f):e.substring(_)),a.push(d),h.push(f),o=f+1}return{start:t,end:n+1,forms:r,thresholds:a,marks:h}}static scanWords(e,t,l,i){let n=t;for(;n>i;){let h=D.stringStartBefore(e,n),o;if(h>=i){let u=p.cca(e,h);o=gi.isWordEnd(u??-1)}else o=!0;if(o)break;n=h}for(;n<t&&gi.isOpeningMark(D.stringCodeAt(e,n));)n+=D.stringUnitsAt(e,n);if(n==t)return null;let s=[t!=null?e.substring(n,t):e.substring(n)],r=[t],a=t+1;for(;;){let h=a;for(;h<l;){let g=p.cca(e,h),_=g??-1;if(_==92){h+=2;continue}if(gi.isWordEnd(_))break;++h}h>l&&(h=l);let o;if(h<l){let g=p.cca(e,h);o=(g??-1)==124}else o=!1;if(o){if(h==a)return null;s.push(h!=null?e.substring(a,h):e.substring(a)),r.push(h),a=h+1;continue}let u=h;for(;u>a;){let g=D.stringStartBefore(e,u);if(g<a||!gi.isClosingMark(D.stringCodeAt(e,g)))break;u=g}if(u==a)return null;s.push(u!=null?e.substring(a,u):e.substring(a));let c=[],f=0;for(;f<s.length;){let g=s[f];++f,c.push(null)}return{start:n,end:u,forms:s,thresholds:c,marks:r}}}static isDigit(e){return e>=48?e<=57:!1}static isWordEnd(e){return e==32||e==9||e==10||e==13||e==124||e==40?!0:e==41}static isOpeningMark(e){return e==34||e==171?!0:e==8220}static isClosingMark(e){return e==46||e==44||e==59||e==58||e==33||e==63||e==8230||e==34||e==187?!0:e==8221}}J["loreline.PluralPipes"]=gi,gi.__name__="loreline.PluralPipes";class ki{static formIndex(e,t,l){let i=e==null?t==1?0:1:ki.ruleIndex(ki.familyOf(e),Math.abs(t));return i<l?i:l-1}static formCount(e){return ki.formsOf(ki.familyOf(e))}static formsOf(e){switch(e){case 0:return 1;case 1:case 2:return 2;case 3:case 4:case 5:case 6:case 7:case 8:return 3;case 9:return 4;case 10:return 5;case 11:return 6}}static ruleIndex(e,t){if(t!=Math.floor(t))return e==2?t<2?0:1:ki.formsOf(e)-1;let l=t%10,i=t%100;switch(e){case 0:return 0;case 1:return t==1?0:1;case 2:return t<2?0:1;case 3:return l==1&&i!=11?0:l>=2&&l<=4&&(i<10||i>=20)?1:2;case 4:return t==1?0:l>=2&&l<=4&&(i<10||i>=20)?1:2;case 5:return t==1?0:t>=2&&t<=4?1:2;case 6:return l==1&&i!=11?0:l>=2&&(i<10||i>=20)?1:2;case 7:return l==1&&i!=11?0:t!=0?1:2;case 8:return t==1?0:t==0||i>0&&i<20?1:2;case 9:return i==1?0:i==2?1:i==3||i==4?2:3;case 10:return t==1?0:t==2?1:t>2&&t<7?2:t>6&&t<11?3:4;case 11:return t==0?0:t==1?1:t==2?2:i>=3&&i<=10?3:i>=11?4:5}}static familyOf(e){if(e==null)return 1;let t=Ue.replace(e.toLowerCase(),"_","-"),l=t.indexOf("-"),i=l==-1?t:p.substr(t,0,l);if(i=="pt")return t.startsWith("pt-pt")?1:2;switch(i){case"ar":return 11;case"be":case"bs":case"hr":case"ru":case"sr":case"uk":return 3;case"ga":return 10;case"fr":case"hy":return 2;case"lt":return 6;case"lv":return 7;case"id":case"ja":case"km":case"ko":case"lo":case"ms":case"my":case"th":case"vi":case"zh":return 0;case"pl":return 4;case"ro":return 8;case"cs":case"sk":return 5;case"sl":return 9;default:return 1}}}J["loreline.PluralRules"]=ki,ki.__name__="loreline.PluralRules";class ge{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 ge(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=p.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=p.cca(e,r-i);h=(o??-1)==10}else h=!1;if(h){--n;let o=1,u=r-1;for(;u>=0;){let c=p.cca(e,u-i);if((c??-1)==10)break;++o,--u}s=o}else--s;--a}}return r<0&&(r=0,n=1,s=1),new ge(n,s,r,l)}extendedTo(e){return new ge(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=p.cca(e,s);(a??-1)==10?(++i,n=1):++n,++s}return new ge(i,n,t,l)}}J["loreline.Position"]=ge,ge.__name__="loreline.Position",Object.assign(ge.prototype,{__class__:ge});class Ll{constructor(e,t){t==null&&(t=`
35
+ `),e==null&&(e=" "),this.enableComments=!0,this._interpolationDepth=0,this._pendingSpace=!1,this._indent=e,this._newline=t,this._beginLine=0,this._lastChar=-1,this._noLn=0,this._pendingSpace=!1,this._level=0,this._prevLevel=0,this._numEmptyLines=0,this._buf=new Et}clear(){this._noLn=0,this._pendingSpace=!1,this._level=0,this._prevLevel=0,this._numEmptyLines=0,this._buf=new Et}indent(){this._level++}unindent(){this._level--}write(e){if(e.length>0){if(this._beginLine>0&&(this.tab(),this._beginLine=0),this._pendingSpace){this._pendingSpace=!1;let i=p.cca(e,0),n=i??-1;n!=32&&n!=10&&n!=13&&(this._buf.b+=" ")}this._buf.b+=e==null?"null":""+e;let t=p.cca(e,e.length-1);this._lastChar=t??-1;let l=e.length-1;for(;l>=0;){let i=p.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._noLn==0&&(this._pendingSpace=!1),this._beginLine<2&&this._noLn==0&&(this._beginLine==1&&this._numEmptyLines++,this._buf.b+=oe.string(this._newline),this._beginLine++),this}space(){return this._pendingSpace=!0,this}tab(){let e=0,t=this._level;for(;e<t;){let l=e++;this._buf.b+=oe.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._pendingSpace=!1,this._level=0,this._prevLevel=0,this._numEmptyLines=0,this._buf=new Et,this._beginLine=1,this.printStringLiteral(e),this.enableComments=t;let l=Ue.trim(this.toString());return l=l.split(`
36
+ `).join("\\n"),l}printStringLiteralAsText(e){let t=this.enableComments;this.enableComments=!1,this._noLn=0,this._pendingSpace=!1,this._level=0,this._prevLevel=0,this._numEmptyLines=0,this._buf=new Et,this._beginLine=1;let l=0,i=e.parts.length;for(;l<i;){let s=l++,a=e.parts[s].partType;switch(a._hx_index){case 0:let h=a.text;e.quotes==1?this.writeQuotedRaw(h):this.writeUnquotedRaw(h);break;case 1:let o=a.expr,u=this.isSimpleInterpolationExpr(o)&&!this.continuesInterpolation(s+1<e.parts.length?e.parts[s+1]:null);this.write("$"),u||this.write("{"),this.printNode(o),u||this.write("}");break;case 2:let c=a.closing,f=a.expr;this.write(c?"</":"<"),this.printStringLiteral(f),this.write(">");break}}this.enableComments=t;let n=Ue.trim(this.toString());return n=n.split(`
37
+ `).join("\\n"),n}print(e){return this._noLn=0,this._pendingSpace=!1,this._level=0,this._prevLevel=0,this._numEmptyLines=0,this._buf=new Et,this._beginLine=1,this.printNode(e),this.toString()}printNode(e,t){if(t==null&&(t=!1),e==null)return;let l=e instanceof dt?e.parens:0,i=0,n=l;for(;i<n;){let a=i++;this.write("(")}switch(le.getClass(e)){case mt:this.printAccess(e);break;case hi:this.printAlternative(e);break;case bl:this.printArrayAccess(e);break;case yl:this.printAssignment(e);break;case oi:this.printBeatCall(e);break;case Ae:this.printBeatDecl(e);break;case Ht:this.printBinary(e);break;case zt:this.printCall(e);break;case Zt:this.printCharacterDecl(e);break;case Dt:this.printChoiceOption(e);break;case Vl:this.printChoiceStatement(e);break;case Jt:this.printDialogueStatement(e);break;case si:this.printFunctionDecl(e);break;case ql:this.printIfStatement(e);break;case Xt:this.printImportStatement(e);break;case ni:this.printInsertion(e);break;case De:this.printLiteral(e);break;case mi:this.printMetadataDecl(e);break;case Kt:this.printStateDecl(e);break;case vt:this.printStringLiteral(e);break;case wi:this.printTernary(e);break;case fl:this.printTextStatement(e);break;case Bl:this.printTransition(e,t);break;case $l:this.printUnary(e);break;case xi:this.printWhenRule(e);break;case fi:this.printWhenStatement(e);break;case Ot:this.printScript(e);break;default:let a=le.getClass(e);throw y.thrown("Unsupported node type: "+a.__name__)}let s=0,r=l;for(;s<r;){let a=s++;this.write(")")}}printOperand(e,t){let l=e!=null&&e.parens==0&&Ll.precedence(e)<t;l&&this.write("("),this.printNode(e),l&&this.write(")")}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+"*/"),this.space()):i.isHash?(this.write("#"+i.content),this.newline()):(this.write("//"+i.content),this.newline())}}}printImport(e){this.printLeadingComments(e),this.write('import "'+oe.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.space(),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.space(),this.printTrailingComments(n),this.printNode(n.value)}this.newline(),this._level--,e.style==1&&(this.write("}"),this.newline())}printMetadataDecl(e){this.newline(),this.newline(),this.printLeadingComments(e),this.write("metadata"),this.space(),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.space(),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.space(),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.space(),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),e.isPublic&&this.write("public "),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.space(),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.space(),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())}printWhenStatement(e){if(this.newline(),this.newline(),this.printLeadingComments(e),this.write("when"),e.strategy!=null&&this.write(" "+e.strategy),this.printTrailingComments(e),e.style==1?(this.write(" {"),this.newline()):this._beginLine==0&&this.newline(),this._level++,e.rules.length>0){this._noLn++;let t=0,l=e.rules;for(;t<l.length;){let i=l[t];++t,this.printNode(i),this.newline()}}this._level--,e.style==1&&(this.write("}"),this.newline())}printWhenRule(e){if(this.newline(),this.newline(),this._noLn=0,this.printLeadingComments(e),e.insertion!=null){this.printNode(e.insertion),e.insertionCondition!=null&&(this.write(" if "),this.printInLineExpression(e.insertionCondition,e.insertionConditionStyle==2)),this.printTrailingComments(e),this.newline();return}e.once&&this.write("- "),e.condition==null?this.write("true"):this.printInLineExpression(e.condition,!1),this.printTrailingComments(e),e.style==1?(this.write(" {"),this.newline()):this._beginLine==0&&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())}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 Bl)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 ql){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 Ll(this._indent,`
37
38
  `).print(e).indexOf(`
38
39
 
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
+ `)!=-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.length;for(;l<i;){let n=l++,r=e.parts[n].partType;switch(r._hx_index){case 0:let a=r.text;t?this.writeQuotedRaw(a):this.writeUnquotedRaw(a);break;case 1:let h=r.expr,o=this.isSimpleInterpolationExpr(h)&&!this.continuesInterpolation(n+1<e.parts.length?e.parts[n+1]:null);this.write("$"),o||this.write("{"),this._interpolationDepth++,this.printNode(h),this._interpolationDepth--,o||this.write("}");break;case 2:let u=r.closing,c=r.expr;this.write(u?"</":"<"),this.printStringLiteral(c),this.write(">");break}}t?(this.write('"'),this.printTrailingComments(e)):this.printHashTrailingComments(e)}writeUnquotedRaw(e){this.writeRawWithContinuation(e,!0)}writeQuotedRaw(e){if(e.indexOf(`
40
41
  `)==-1){this.write(e);return}let t=e.split(`
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
+ `),l=0,i=t.length;for(;l<i;){let n=l++;n>0&&(this._buf.b+=oe.string(this._newline));let s=t[n],r;if(s.length>0){let a=p.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=p.cca(s,s.length-1);this._lastChar=a??-1}}}writeRawWithContinuation(e,t){if(e.indexOf(`
42
43
  `)==-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 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
- `).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 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
- `}le!=null&&(this.buf.b+="default: ",this.expr(le),this.buf.b+=`;
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(`
44
+ `),i=0,n=l.length;for(;i<n;){let s=i++;s>0&&(this._buf.b+=oe.string(this._newline),this._beginLine=1);let r=l[s],a;if(r.length>0){let h=p.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=p.cca(r,h);if((u??-1)!=32){let c=p.cca(r,h);o=(c??-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(z.numberLiteral(z.numberArg(e.value,"print")));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 r=n[i];if(++i,this.hasRealNewlines(r)){l=!0;break}}if(l){this.write("["),this.newline(),this._level++;let r=!0,a=0,h=e.value;for(;a<h.length;){let o=h[a];++a,r||(this.write(","),this.newline()),r=!1,this.printNode(o)}this.newline(),this._level--,this.write("]")}else{let r=!0;this.write("[");let a=0,h=e.value;for(;a<h.length;){let o=h[a];++a,r||this.write(", "),r=!1,this.printNode(o)}this.write("]")}break;case 4:let s=t.style;if(this._interpolationDepth>0){this.write("{");let r=!0,a=0,h=e.value;for(;a<h.length;){let o=h[a];++a,r||this.write(", "),r=!1,this.write(""+o.name+": "),this.printNode(o.value)}this.write("}")}else{let r=s;r==1?(this.write("{"),this.newline()):this.newline(),this._level++;let a=!0,h=0,o=e.value;for(;h<o.length;){let u=o[h];++h,a||this._beginLine==0&&this.newline(),a=!1,this.printLeadingComments(u),this.write(""+u.name+":"),this.space(),this.printTrailingComments(u),this.printNode(u.value)}this.newline(),this._level--,r==1&&this.write("}")}break}this.printTrailingComments(e)}printAccess(e){this.printLeadingComments(e),e.target!=null&&(this.printOperand(e.target,10),this.write(".")),this.write(e.name),this.printTrailingComments(e)}printArrayAccess(e){this.printLeadingComments(e),this.printOperand(e.target,10),this.write("["),this.printNode(e.index),this.write("]"),this.printTrailingComments(e)}printCall(e){this.printLeadingComments(e),this.printOperand(e.target,10),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){this.printLeadingComments(e);let t=Ll.precedence(e);this.printOperand(e.left,t),this.write(" "+this.getOperator(e.op)+" "),Ll.isWordNotAfterIs(e)?(this.write("("),this.printNode(e.right),this.write(")")):this.printOperand(e.right,t+1),this.printTrailingComments(e)}printUnary(e){this.printLeadingComments(e),this.write(this.getOperator(e.op));let t=e.op;t._hx_index==42&&t.word==!0&&this.write(" "),this.printTrailingComments(e),this.printOperand(e.operand,9)}printTernary(e){this.printLeadingComments(e),this.printOperand(e.condition,3),this.write(" ? "),this.printOperand(e.trueExpr,2),this.write(" : "),this.printOperand(e.falseExpr,2),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("("),this.printNode(e),t&&this.write(")"),this.enableComments=l}continuesInterpolation(e){if(e==null)return!1;let t=e.partType;if(t._hx_index==0){let l=t.text,i=D.stringCodeAt(l,0);return Q.isPart(i)||i==40||i==91?!0:i==46?Q.isStart(D.stringCodeAt(l,1)):!1}else return!1}isSimpleInterpolationExpr(e){if(e instanceof mt){let t=e;return t.target==null?!0:this.isSimpleInterpolationExpr(t.target)}return e instanceof bl?this.isSimpleInterpolationExpr(le.__cast(e,bl).target):e instanceof zt?this.isSimpleInterpolationExpr(le.__cast(e,zt).target):!1}hasRealNewlines(e){if(e instanceof vt){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(`
45
+ `)!=-1)return!0}}return!1}getOperator(e){switch(e._hx_index){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 e.word?"is":"==";case 35:return e.word?"is not":"!=";case 36:return">";case 37:return"<";case 38:return">=";case 39:return"<=";case 40:return e.word?"and":"&&";case 41:return e.word?"or":"||";case 42:return e.word?"not":"!";default:throw y.thrown("Unsupported operator: "+oe.string(e))}}static precedence(e){if(e instanceof yl)return 1;if(e instanceof wi)return 2;if(e instanceof $l)return 9;if(e instanceof Ht){let t=e.op;switch(t._hx_index){case 29:case 30:return 7;case 31:case 32:case 33:return 8;case 34:let l=t.word;return 5;case 35:let i=t.word;return 5;case 36:case 37:case 38:case 39:return 6;case 40:let n=t.word;return 4;case 41:let s=t.word;return 3;default:return 8}}return 10}static isWordNotAfterIs(e){let t=e.op;if(t._hx_index==34){if(t.word!=!0)return!1}else return!1;let l=e.right;if(l==null||l.parens>0||!(l instanceof $l))return!1;let i=l.op;return i._hx_index==42?i.word==!0:!1}}J["loreline.Printer"]=Ll,Ll.__name__="loreline.Printer",Object.assign(Ll.prototype,{__class__:Ll});class Rn{static toString(e){switch(e){case 0:return"Unquoted";case 1:return"DoubleQuotes"}}}class yi{constructor(e){e==null&&(e=new Date().getTime()/1e3*1e6,e+=Math.random()*1e5),this.seed=yi.normalizeSeed(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}static normalizeSeed(e){if(isNaN(e)||!isFinite(e))return 1;let t=Math.floor(Math.abs(e)%2147483647);return t==0?1:t}}J["loreline.Random"]=yi,yi.__name__="loreline.Random",Object.assign(yi.prototype,{__class__:yi});class Ot extends Be{constructor(e,t,l){_t._hx_skip_constructor=!0,super(),_t._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"}metadataBlock(){if(this.body!=null){let e=0,t=this.body;for(;e<t.length;){let l=t[e];if(++e,l instanceof mi)return l}}return null}getMetadataField(e){let t=this.metadataBlock();if(t==null)return null;let l=t.get(e);return l!=null?Ot.constantValue(l):null}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 Xt||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 Sn(this.body)}static fromJson(e){return P.scriptFromJson(e)}static constantValue(e){if(e instanceof vt)return Rt.constantText(e);if(e instanceof De){let t=e,l=t.literalType;switch(l._hx_index){case 3:let i=[],n=0,s=t.value;for(;n<s.length;){let u=s[n];++n,i.push(Ot.constantValue(u))}return se.fromValues(i);case 4:let r=l.style,a=G.createFields(),h=0,o=t.value;for(;h<o.length;){let u=o[h];++h,G.setField(null,a,u.name,u.value!=null?Ot.constantValue(u.value):null)}return a;default:return t.value}}return null}}J["loreline.Script"]=Jl.loreline.Script=Ot,Ot.__name__="loreline.Script",Ot.__super__=Be,Object.assign(Ot.prototype,{__class__:Ot});class Sn{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 Xt){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"]=Sn,Sn.__name__="loreline._Script.ScriptBodyIterator",Object.assign(Sn.prototype,{__class__:Sn});class zn{static uLength(e){return e.length}static uSubstr(e,t,l){return l!=null?p.substr(e,t,l):p.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=p.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 uCharAt(e,t){return e.charAt(t)}}J["loreline.TextUnits"]=zn,zn.__name__="loreline.TextUnits";class je{static charOffsets(e){let t=e.length,l=[];if(je.UNITS_PER_EMOJI==1){let i=0,n=t;for(;i<n;){let s=i++;l.push(s)}}else if(je.UNITS_PER_EMOJI==2){let i=0;for(;i<t;){l.push(i);let n=e.charCodeAt(i);if(n>=55296&&n<=56319&&i+1<t){let s=e.charCodeAt(i+1);i+=s>=56320&&s<=57343?2:1}else++i}}else{let i=0;for(;i<t;){l.push(i);let n=e.charCodeAt(i);i+=n<192?1:n<224?2:n<240?3:4}}return l.push(t),l}static length(e){return je.charOffsets(e).length-1}static chars(e){let t=je.charOffsets(e),l=[],i=0,n=t.length-1;for(;i<n;){let s=i++;l.push(p.substr(e,t[s],t[s+1]-t[s]))}return l}static sub(e,t,l){let i=je.charOffsets(e),n=i.length-1;if(t<0&&(t+n<0?t=0:t+=n),t>=n)return"";let s=l==null?n:t+l;return s>n&&(s=n),s<=t?"":p.substr(e,i[t],i[s]-i[t])}static indexOf(e,t){let l=e.indexOf(t);if(l<=0)return l;let i=je.charOffsets(e),n=0,s=i.length-1;for(;n<s;){let r=n+s>>1;i[r]<l?n=r+1:s=r}return n}static upper(e){return je.convertCase(e,!0)}static lower(e){return je.convertCase(e,!1)}static convertCase(e,t){let l=t?je.upperTable():je.lowerTable(),i="",n=je.charOffsets(e),s=0,r=n.length-1;for(;s<r;){let a=s++,h=p.substr(e,n[a],n[a+1]-n[a]),o=l.h[h];i+=oe.string(o??h)}return i}static upperTable(){return je.upperByLower==null&&je.buildTables(),je.upperByLower}static lowerTable(){return je.lowerByUpper==null&&je.buildTables(),je.lowerByUpper}static buildTables(){let e=je.chars(je.LOWER_LETTERS),t=je.chars(je.UPPER_LETTERS),l=new Ce,i=new Ce,n=0,s=e.length;for(;n<s;){let r=n++;l.h[e[r]]=t[r],i.h[t[r]]=e[r]}l.h.\u00DF="SS",l.h.\u03C2="\u03A3",l.h.\u0131="I",je.upperByLower=l,je.lowerByUpper=i}}J["loreline.Texts"]=je,je.__name__="loreline.Texts";class En{constructor(e,t){this.remaining=e,this.done=t}}J["loreline._Timer.PendingTimer"]=En,En.__name__="loreline._Timer.PendingTimer",Object.assign(En.prototype,{__class__:En});class bi{static register(e,t){bi.timers.push(new En(e,t))}static update(e){if(bi.timers.length==0)return;let t=bi.timers.length;for(;--t>=0;){let l=bi.timers[t];l.remaining-=e,l.remaining<=0&&(bi.timers.splice(t,1),l.done())}}}J["loreline.Timer"]=bi,bi.__name__="loreline.Timer";class z{static equals(e,t){if(e==null||t==null)return e==null?t==null:!1;if(typeof e=="string")return typeof t=="string"?e==t:z.textEquals(e,t);if(typeof t=="string")return z.textEquals(t,e);let l=he.typeof(e),i=he.typeof(t);switch(l._hx_index){case 1:case 2:switch(i._hx_index){case 1:case 2:let r=e,a=t;return l._hx_index==1,r==(i._hx_index==1,a);case 3:let h=e;return l._hx_index==1,h==(t?1:0);default:return!1}break;case 3:switch(i._hx_index){case 1:case 2:let r=t;return(e?1:0)==(i._hx_index==1,r);case 3:return e==t;default:return!1}break;default:switch(i._hx_index){case 1:case 2:case 3:return!1;default:}}let n=Qe.beatOf(e),s=Qe.beatOf(t);return n!=null||s!=null?n!=null&&s!=null?n.name==s.name:!1:rt.characterOf(e)!=null||rt.characterOf(t)!=null?rt.fieldsOf(e)==rt.fieldsOf(t):e==t}static textEquals(e,t){switch(he.typeof(t)._hx_index){case 1:case 2:let n=t;return z.numberOfText(e)==(he.typeof(t)._hx_index==1,n);case 3:return e==(t?"true":"false");default:}let l=Qe.beatOf(t);if(l!=null)return l.name==e;let i=rt.characterOf(t);return i!=null?i.name==e:!1}static same(e,t){return e==t}static orderNumberOf(e){if(e==null)return NaN;if(typeof e=="string")return z.numberOfText(e);let t=he.typeof(e);switch(t._hx_index){case 1:case 2:let l=e;return t._hx_index==1,l;default:return NaN}}static canCompare(e,t){if(typeof e=="string"){let i;if(typeof t!="string")if(t!=null)switch(he.typeof(t)._hx_index){case 1:case 2:i=!0;break;default:i=!1}else i=!1;else i=!1;if(i){let n=z.numberOfText(e);return!isNaN(n)}else return!1}if(typeof t=="string"){let i;if(e!=null)switch(he.typeof(e)._hx_index){case 1:case 2:i=!0;break;default:i=!1}else i=!1;if(i){let n=z.numberOfText(t);return!isNaN(n)}else return!1}let l;if(e!=null)switch(he.typeof(e)._hx_index){case 1:case 2:l=!0;break;default:l=!1}else l=!1;if(l)if(t!=null)switch(he.typeof(t)._hx_index){case 1:case 2:return!0;default:return!1}else return!1;else return!1}static isNumber(e){if(e!=null)switch(he.typeof(e)._hx_index){case 1:case 2:return!0;default:return!1}else return!1}static compare(e,t){let l=z.orderNumberOf(e),i=z.orderNumberOf(t);return l<i?-1:l>i?1:0}static isTruthy(e){if(typeof e=="boolean")return e;if(e==null)return!1;if(typeof e=="string")return e.length>0;if(se.isArray(e))return se.arrayLength(e)>0;let t=he.typeof(e);switch(t._hx_index){case 1:case 2:let l=e;return t._hx_index==1,l!=0;default:return!0}}static numberOfText(e){let t=e.length,l=0,i=t;for(;;){let g;if(l<i){let _=e.charCodeAt(l);g=_==32||_==9||_==10||_==13}else g=!1;if(!g)break;++l}for(;;){let g;if(i>l){let _=e.charCodeAt(i-1);g=_==32||_==9||_==10||_==13}else g=!1;if(!g)break;--i}if(l==i)return NaN;let n=l,s=!1,r=e.charCodeAt(n);(r==43||r==45)&&(s=r==45,++n);let a=n;for(;;){let g;if(n<i){let _=e.charCodeAt(n);g=_>=48&&_<=57}else g=!1;if(!g)break;++n}let h=n,o=n,u=n;if(n<i&&e.charCodeAt(n)==46){for(++n,o=n;;){let g;if(n<i){let _=e.charCodeAt(n);g=_>=48&&_<=57}else g=!1;if(!g)break;++n}u=n}if(h==a&&u==o)return NaN;let c="";if(n<i){if(r=e.charCodeAt(n),r!=101&&r!=69)return NaN;++n;let g=!1;n<i&&(r=e.charCodeAt(n),(r==43||r==45)&&(g=r==45,++n));let _=n;for(;;){let d;if(n<i){let m=e.charCodeAt(n);d=m>=48&&m<=57}else d=!1;if(!d)break;++n}if(n==_||n<i)return NaN;c="e"+(g?"-":"")+e.substring(_,n)}let f=(s?"-":"")+(h>a?e.substring(a,h):"0")+(u>o?"."+e.substring(o,u):"")+c;return parseFloat(f)}static isSpace(e){return e==32||e==9||e==10?!0:e==13}static isDigit(e){return e>=48?e<=57:!1}static numberOf(e,t){return t._hx_index==1,e}static numberText(e){return z.formatNumber(e,15,!1)}static numberLiteral(e){if(isNaN(e)||!isFinite(e))return z.numberText(e);let t=z.formatNumber(e,15,!0);if(z.numberOfText(t)==e)return t;let l=z.formatNumber(e,16,!0);return z.numberOfText(l)==e?l:z.formatNumber(e,17,!0)}static formatNumber(e,t,l){if(isNaN(e))return"NaN";if(!isFinite(e))return e>0?"Infinity":"-Infinity";if(e==0)return"0";let i=e<0,n=i?-e:e;if(n<1e15&&Math.floor(n)==n){let g=z.wholeDigits(n);return i?"-"+g:g}let s=z.POWERS_OF_TEN[t-1],r=z.POWERS_OF_TEN[t],a=Math.floor(Math.log(n)/Math.log(10)),h=z.scaleByPowerOfTen(n,t-1-a);h>=r?(++a,h=z.scaleByPowerOfTen(n,t-1-a)):h<s&&(--a,h=z.scaleByPowerOfTen(n,t-1-a));let o=Math.floor(h+.5);o>=r&&(o=s,++a);let u=z.wholeDigits(o),c=u.length;for(;c>1&&u.charCodeAt(c-1)==48;)--c;u=p.substr(u,0,c);let f=!l&&(a>=21||a<-6)?u.charAt(0)+(u.length>1?"."+p.substr(u,1,null):"")+"e"+(a>0?"+":"-")+z.wholeDigits(Math.abs(a)):a>=0?u.length<=a+1?u+z.zeros(a+1-u.length):p.substr(u,0,a+1)+"."+p.substr(u,a+1,null):"0."+z.zeros(-a-1)+u;return i?"-"+f:f}static wholeDigits(e){if(e==0)return"0";let t="",l=[],i=e;for(;i>0;){let s=i%10;l.push(48+(s|0)),i=(i-s)/10}let n=l.length-1;for(;n>=0;)t+=String.fromCodePoint(l[n]),--n;return t}static zeros(e){let t="",l=0,i=e;for(;l<i;){let n=l++;t+=String.fromCodePoint(48)}return t}static scaleByPowerOfTen(e,t){let l=e;if(t>=0){for(;t>22;)l*=1e22,t-=22;return l*z.POWERS_OF_TEN[t]}for(t=-t;t>22;)l/=1e22,t-=22;return l/z.POWERS_OF_TEN[t]}static textOf(e,t){return z.textOfImpl(e,t,null)}static textOfImpl(e,t,l){if(e==null)return"null";if(typeof e=="string")return e;let i=he.typeof(e);switch(i._hx_index){case 1:case 2:let a=e;return z.numberText((i._hx_index==1,a));case 3:return e?"true":"false";default:}l==null&&(l=[]);let n=0;for(;n<l.length;){let a=l[n];if(++n,a==e)return"..."}if(l.push(e),se.isArray(e)){let a=se.arrayLength(e),h="";h+="[";let o=0,u=a;for(;o<u;){let c=o++;c>0&&(h+=", "),h+=oe.string(z.textOfImpl(se.arrayGet(e,c),t,l))}return h+="]",l.pop(),h}let s=Qe.beatOf(e);if(s!=null)return l.pop(),s.name;let r=rt.characterOf(e);if(r!=null){let a=G.getField(t,r.get_fields(),"name");return l.pop(),a!=null?z.textOfImpl(a,t,null):r.name}if(G.isFields(e)){let a=G.getFields(t,e);a.sort(function(c,f){return c<f?-1:c>f?1:0});let h="";h+="{";let o=0,u=a.length;for(;o<u;){let c=o++;c>0&&(h+=", "),h+=oe.string(a[c]),h+=": ",h+=oe.string(z.textOfImpl(G.getField(t,e,a[c]),t,l))}return h+="}",l.pop(),h}return l.pop(),e==null?"null":oe.string(e)}static textArg(e,t){if(typeof e=="string")return e;switch((e==null?Ft.TNull:he.typeof(e))._hx_index){case 1:case 2:case 3:return z.textOf(e,null);default:throw y.thrown(_e.of(new U("{fn}() expects a text, got {value}",{fn:t,value:z.describeForError(e)})))}}static numberArg(e,t){if(e!=null){let l=he.typeof(e);switch(l._hx_index){case 1:case 2:let i=e;return l._hx_index==1,i;default:}if(typeof e=="string"){let i=z.numberOfText(e);if(!isNaN(i))return i}}throw y.thrown(_e.of(new U("{fn}() expects a number, got {value}",{fn:t,value:z.describeForError(e)})))}static arithmetic(e,t,l,i){if(e=="+"){if(typeof t=="string"||typeof l=="string")return z.textOf(t,i)+z.textOf(l,i);let r,a;if(t!=null)switch(he.typeof(t)._hx_index){case 1:case 2:a=!0;break;default:a=!1}else a=!1;if(a)if(l!=null)switch(he.typeof(l)._hx_index){case 1:case 2:r=!0;break;default:r=!1}else r=!1;else r=!1;if(r){let h=t,o=l;return he.typeof(t)._hx_index==1,h+(he.typeof(l)._hx_index==1,o)}throw y.thrown(_e.of(new U("Cannot add {a} and {b}",{a:z.describeForError(t),b:z.describeForError(l)})))}if(!z.isNumberLike(t)||!z.isNumberLike(l)){let r={a:z.describeForError(t),b:z.describeForError(l)},a;switch(e){case"*":a=new U("Cannot multiply {a} by {b}",r);break;case"-":a=new U("Cannot subtract {b} from {a}",r);break;case"/":a=new U("Cannot divide {a} by {b}",r);break;default:a=new U("Cannot take the modulo of {a} and {b}",r)}throw y.thrown(_e.of(a))}let n=z.orderNumberOf(t),s=z.orderNumberOf(l);switch(e){case"*":return n*s;case"-":return n-s;case"/":if(s==0)throw y.thrown(_e.of(new U("Division by zero",null)));return n/s;default:if(s==0)throw y.thrown(_e.of(new U("Modulo by zero",null)));return n%s}}static negate(e){if(!z.isNumberLike(e))throw y.thrown(_e.of(new U("Cannot negate {value}",{value:z.describeForError(e)})));return-z.orderNumberOf(e)}static isNumberLike(e){let t;if(e!=null)switch(he.typeof(e)._hx_index){case 1:case 2:t=!0;break;default:t=!1}else t=!1;if(t)return!0;if(typeof e=="string"){let l=z.numberOfText(e);return!isNaN(l)}else return!1}static describeForError(e){return typeof e=="string"?'"'+e+'"':z.describeKind(z.typeOf(e))}static describeKind(e){switch(e){case"array":return new Ct("array\xA7value");case"beat":return new Ct("beat\xA7value");case"bool":return new Ct("bool\xA7value");case"character":return new Ct("character\xA7value");case"function":return new Ct("function\xA7value");case"null":return new Ct("null\xA7value");case"number":return new Ct("number\xA7value");case"text":return new Ct("text\xA7value");default:return new Ct("object\xA7value")}}static typeOf(e){if(e==null)return"null";if(typeof e=="string")return"text";if(se.isArray(e))return"array";if(Qe.beatOf(e)!=null)return"beat";if(rt.characterOf(e)!=null)return"character";switch(he.typeof(e)._hx_index){case 1:case 2:return"number";case 3:return"bool";case 5:return"function";default:return"object"}}static kindOf(e){if(e==null)return"Null";if(typeof e=="string")return"String";if(se.isArray(e))return"Array";if(Qe.beatOf(e)!=null)return"Beat";if(rt.characterOf(e)!=null)return"Character";switch(he.typeof(e)._hx_index){case 1:return"Int";case 2:return"Float";case 3:return"Bool";default:return"Object"}}}J["loreline.Values"]=z,z.__name__="loreline.Values";class Ei{static make(e){return Le.makeVarArgs(e)}static call(e,t,l){return t.apply(e,l)}}J["loreline.VarArgs"]=Ei,Ei.__name__="loreline.VarArgs";class tn extends st{constructor(e,t,l){super(t,l),this.wrapped=e}}J["loreline.WrappedError"]=tn,tn.__name__="loreline.WrappedError",tn.__super__=st,Object.assign(tn.prototype,{__class__:tn});class qe{static fromTag(e){if(e==null)return"en";let t=e.toLowerCase();return t=="fr"||t.indexOf("fr-")==0||t.indexOf("fr_")==0?"fr":"en"}static register(e,t){let l=qe.tables.h[e];l==null&&(l=new Ce,qe.tables.h[e]=l);let i=t.h,n=i,s=Object.keys(i),r=s.length,a=0;for(;a<r;){let h=s[a++],o=h,u=n[h],c=o,f=u;l.h[c]=f}}static registerObject(e,t){let l=new Ce,i=0,n=Le.fields(t);for(;i<n.length;){let s=n[i];++i,l.h[s]=Le.field(t,s)}qe.register(e,l)}static keyOf(e){return new Ct(e)}static format(e,t,l){let i=l,n=i??qe.locale;return qe.fill(qe.translate(e,n),t,n)}static formatCount(e,t,l,i,n){let s=n,r=s??qe.locale,a=ki.formIndex(r,e,2)==0,h={};if(i!=null){let o=0,u=Le.fields(i);for(;o<u.length;){let c=u[o];++o,h[c]=Le.field(i,c)}}return h.n=e,qe.format(a?t:l,h,r)}static errorText(e,t){return e==null?null:e.template!=null?qe.format(e.template,e.params,t):e.message}static translate(e,t){if(t!="en"){let i=qe.tables.h[t];if(i!=null){let n=i.h[e];if(n!=null)return n}}let l=e.lastIndexOf("\xA7");return l!=-1?p.substr(e,0,l):e}static fill(e,t,l){if(e.indexOf("{")==-1&&e.indexOf("}")==-1)return e;let i="",n=0,s=e.length;for(;n<s;){let r=e.indexOf("{",n),a=e.indexOf("}",n);if(r==-1&&a==-1){i+=oe.string(p.substr(e,n,null));break}if(a!=-1&&(r==-1||a<r)){i+=oe.string(e.substring(n,a+1)),n=a+(p.substr(e,a,2)=="}}"?2:1);continue}if(i+=oe.string(e.substring(n,r)),p.substr(e,r,2)=="{{"){i+="{",n=r+2;continue}let h=e.indexOf("}",r),o=h!=-1?e.substring(r+1,h):null;if(o==null||!qe.isParamName(o)){i+="{",n=r+1;continue}i+=oe.string(qe.paramText(t,o,l)),n=h+1}return i}static isParamName(e){if(e.length==0)return!1;let t=0,l=e.length;for(;t<l;){let i=t++,n=p.cca(e,i);if(!(n>=97&&n<=122||n>=65&&n<=90||n==95)&&!(i>0&&n>=48&&n<=57))return!1}return!0}static paramText(e,t,l){if(e==null||!Object.prototype.hasOwnProperty.call(e,t))return"{"+t+"}";let i=Le.field(e,t);if(i==null)return"null";if(i instanceof Ct)return qe.translate(i.word,l);if(i instanceof U)return i.format(l);if(i instanceof st)return qe.errorText(i,l);if(i instanceof Ie)return Li.errorToString(i,l);if(typeof i=="number"&&!(typeof i=="number"&&(i|0)===i)){let n=i;if(n==Math.floor(n)&&Math.abs(n)<2147483647)return oe.string(n|0)}return oe.string(i)}}J["loreline.i18n.I18n"]=Jl.loreline.i18n.I18n=qe,qe.__name__="loreline.i18n.I18n";class Ct{constructor(e){this.word=e}toString(){return qe.translate(this.word,"en")}}J["loreline.i18n.I18nKey"]=Ct,Ct.__name__="loreline.i18n.I18nKey",Object.assign(Ct.prototype,{__class__:Ct});class U{constructor(e,t){this.template=e,this.params=t}format(e){return qe.format(this.template,this.params,e)}toString(){return qe.format(this.template,this.params,"en")}}J["loreline.i18n.I18nText"]=U,U.__name__="loreline.i18n.I18nText",Object.assign(U.prototype,{__class__:U});class Dn{static main(){}}J["loreline.lib.Library"]=Dn,Dn.__name__="loreline.lib.Library";var X=it["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)};X.__constructs__=[X.TMono,X.TVoid,X.TInt,X.TFloat,X.TBool,X.TDynamic,X.TParam,X.TUnresolved,X.TNull,X.TInst,X.TEnum,X.TType,X.TAbstract,X.TFun,X.TAnon,X.TLazy];var Oe=it["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)};Oe.__constructs__=[Oe.NoValue,Oe.Value,Oe.WithType];var Ml=it["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)};Ml.__constructs__=[Ml.CTClass,Ml.CTEnum,Ml.CTTypedef,Ml.CTAlias,Ml.CTAbstract];class ln{constructor(e,t){this.expr=e,this.t=t}}J["loreline.lorscript.Completion"]=ln,ln.__name__="loreline.lorscript.Completion",Object.assign(ln.prototype,{__class__:ln});class vn{constructor(){this.types=new Ce,this.types=new Ce,this.types.h.Void=Ml.CTAlias(X.TVoid),this.types.h.Int=Ml.CTAlias(X.TInt),this.types.h.Float=Ml.CTAlias(X.TFloat),this.types.h.Bool=Ml.CTAlias(X.TBool),this.types.h.Dynamic=Ml.CTAlias(X.TDynamic),this.parser=new Bi}addXmlApi(e){let t=new hn;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 Ce,statics:new Ce,params:[]}),this.types.h[e]=Ml.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 E=s[r];++r,this.addXmlType(E,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 Ce,statics:new Ce};this.addMeta(a,h),a.isInterface&&(h.isInterface=!0);let o=0,u=a.params;for(;o<u.length;){let E=u[o];++o,h.params.push(X.TParam(E))}t.push(function(){let E=new Ce,N=0,K=h.params;for(;N<K.length;){let L=K[N];++N;let H=a.path+"."+ct.typeStr(L);E.h[H]=L}if(l.localParams=E,a.superClass!=null){let L=l,H=a.superClass.path,$=[],M=0,Z=a.superClass.params;for(;M<Z.length;){let ae=Z[M];++M,$.push(l.makeXmlType(ae))}h.superClass=L.getType(H,$)}if(a.interfaces!=null){h.interfaces=[];let L=0,H=a.interfaces;for(;L<H.length;){let $=H[L];++L;let M=h.interfaces,Z=l,ae=$.path,ie=[],ue=0,de=$.params;for(;ue<de.length;){let ye=de[ue];++ue,ie.push(l.makeXmlType(ye))}M.push(Z.getType(ae,ie))}}let V=[],B=function(L,H){if(L.isOverride||p.substr(L.name,0,4)=="get_"||p.substr(L.name,0,4)=="set_")return;let $=!L.name.startsWith("__"),M=0,Z=L.meta;for(;M<Z.length;){let ce=Z[M];if(++M,ce.name==":noScript")return;ce.name==":noCompletion"&&($=!1)}let ae=L.set,ie;switch(ae._hx_index){case 2:let ce=ae.m;ie=!0;break;case 0:case 4:ie=!0;break;default:ie=!1}let ue={isPublic:L.isPublic,canWrite:ie,complete:$,params:[],name:L.name,t:null},de=0,ye=L.params;for(;de<ye.length;){let ce=ye[de];++de;let pe=X.TParam(ce),Je=L.name+"."+ce;V.push(Je),ue.params.push(pe),l.localParams.h[Je]=pe}if(ue.t=l.makeXmlType(L.type),L.meta!=null&&L.meta.length>0){ue.meta=[];let ce=0,pe=L.meta;for(;ce<pe.length;){let Je=pe[ce];++ce;let tt=ue.meta,Ge=Je.name,ht=[],Ze=0,$e=Je.params;for(;Ze<$e.length;){let xt=$e[Ze];++Ze;let Ke;try{Ke=l.parser.parseString(xt)}catch(at){if(y.caught(at).unwrap()instanceof Ie)Ke=null;else throw at}ht.push(Ke)}tt.push({name:Ge,params:ht})}}for(;V.length>0;){let ce=l.localParams,pe=V.pop(),Je=ce;Object.prototype.hasOwnProperty.call(Je.h,pe)&&delete Je.h[pe]}ue.name=="new"?h.constructor=ue:H.set(L.name,ue)},O=0,q=a.fields;for(;O<q.length;){let L=q[O];++O,B(L,h.fields)}let R=0,A=a.statics;for(;R<A.length;){let L=A[R];++R,B(L,h.statics)}l.localParams=null}),this.types.h[h.name]=Ml.CTClass(h);break;case 2:let c=e.e;if(Object.prototype.hasOwnProperty.call(this.types.h,c.path))return;let f={name:c.path,params:[],constructors:[]};this.addMeta(c,f);let g=0,_=c.params;for(;g<_.length;){let E=_[g];++g,f.params.push(X.TParam(E))}t.push(function(){let E=new Ce,N=0,K=f.params;for(;N<K.length;){let O=K[N];++N;let q=c.path+"."+ct.typeStr(O);E.h[q]=O}l.localParams=E;let V=0,B=c.constructors;for(;V<B.length;){let O=B[V];++V;let q=f.constructors,R=O.name,A;if(O.args==null)A=null;else{let L=[],H=0,$=O.args;for(;H<$.length;){let M=$[H];++H,L.push({name:M.name,opt:M.opt,t:l.makeXmlType(M.t)})}A=L}q.push({name:R,args:A})}l.localParams=null}),this.types.h[f.name]=Ml.CTEnum(f);break;case 3:let d=e.t;if(Object.prototype.hasOwnProperty.call(this.types.h,d.path))return;let m={name:d.path,params:[],t:null},k=0,C=d.params;for(;k<C.length;){let E=C[k];++k,m.params.push(X.TParam(E))}d.path=="loreline.lorscript.TypeCheck"&&m.params.reverse(),t.push(function(){let E=new Ce,N=0,K=m.params;for(;N<K.length;){let V=K[N];++N;let B=d.path+"."+ct.typeStr(V);E.h[B]=V}l.localParams=E,m.t=l.makeXmlType(d.type),l.localParams=null}),this.types.h[d.path]=Ml.CTTypedef(m);break;case 4:let T=e.a;if(Object.prototype.hasOwnProperty.call(this.types.h,T.path))return;let S={name:T.path,params:[],t:null};this.addMeta(T,S);let v=0,I=T.params;for(;v<I.length;){let E=I[v];++v,S.params.push(X.TParam(E))}t.push(function(){let E=new Ce,N=0,K=S.params;for(;N<K.length;){let V=K[N];++N;let B=T.path+"."+ct.typeStr(V);E.h[B]=V}l.localParams=E,S.t=l.makeXmlType(T.athis),l.localParams=null}),this.types.h[T.path]=Ml.CTAbstract(S);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 c;try{c=this.parser.parseString(u)}catch(f){if(y.caught(f).unwrap()instanceof Ie)c=null;else throw f}a.push(c)}s.push({name:r,params:a})}}makeXmlType(e){switch(e._hx_index){case 0:return X.TUnresolved("Unknown");case 1:let t=e.name,l=e.params,i=[],n=0;for(;n<l.length;){let K=l[n];++n,i.push(this.makeXmlType(K))}return this.getType(t,i);case 2:let s=e.name,r=e.params,a=[],h=0;for(;h<r.length;){let K=r[h];++h,a.push(this.makeXmlType(K))}return this.getType(s,a);case 3:let o=e.name,u=e.params,c=[],f=0;for(;f<u.length;){let K=u[f];++f,c.push(this.makeXmlType(K))}return this.getType(o,c);case 4:let g=e.args,_=e.ret,d=[],m=0;for(;m<g.length;){let K=g[m];++m,d.push({name:K.name,opt:K.opt,t:this.makeXmlType(K.t)})}return X.TFun(d,this.makeXmlType(_));case 5:let k=e.fields,C=[],T=0;for(;T<k.length;){let K=k[T];++T;let V=K.name,B=this.makeXmlType(K.type),O=K.meta,q;if(O==null)q=!1;else{let R=!1,A=0;for(;A<O.length;){let L=O[A];if(++A,L.name==":optional"){R=!0;break}}q=R}C.push({name:V,t:B,opt:q})}return X.TAnon(C);case 6:let S=e.t;return X.TDynamic;case 7:let v=e.name,I=e.params,E=[],N=0;for(;N<I.length;){let K=I[N];++N,E.push(this.makeXmlType(K))}return this.getType(v,E)}}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(p.cca(n,0)==95)return p.remove(i,n),this.getType(i.join("."),t)}return X.TUnresolved(e)}return l}resolve(e,t){if(e=="Null"){if(t==null||t.length!=1)throw y.thrown("Missing Null<T> parameter");return X.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 X.TInst(i,t);case 1:let n=l.e;return X.TEnum(n,t);case 2:let s=l.t;return X.TType(s,t);case 3:return l.t;case 4:let a=l.a;return X.TAbstract(a,t)}}}J["loreline.lorscript.CheckerTypes"]=vn,vn.__name__="loreline.lorscript.CheckerTypes",Object.assign(vn.prototype,{__class__:vn});class ct{constructor(e){this.events=new Ce,this.globals=new Ce,e==null&&(e=new vn),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:X.TLazy(function(){let c=l,f=o.t,g=o.params,_=[],d=0,m=o.params.length;for(;d<m;){let k=d++;_.push(l.makeMono())}return c.apply(f,g,_)});this.setGlobal(o.name,u)}}if(e.superClass==null)break;let h=e.superClass;if(h==null)throw y.thrown("assert");if(h._hx_index==9){let o=h.args;e=h.c}else throw y.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=Oe.NoValue),this.locals=new Ce,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(Y.EBlock([e]),e));let s=this,r=e.e;if(r._hx_index==4){let a=r.e,h=[],o=X.TVoid,u=0;for(;u<a.length;){let f=a[u];for(++u;;){let _=f.e;if(_._hx_index==25){let d=_.name,m=_.args;f=_.e}else break}let g=f.e;if(g._hx_index==14){let _=g.e,d=g.args,m=g.name,k=g.ret;if(m!=null){let C=k==null?this.makeMono():this.makeType(k,f),T=X.TFun(this.typeArgs(d,f),C);this.locals.h[m]=T,h.push(function(){return s.currentFunType=T,s.typeExpr(f,Oe.NoValue),T})}else{let C=0;for(;C<h.length;){let T=h[C];++C,T()}h=[],a[a.length-1]==f?o=this.typeExpr(f,t):this.typeExpr(f,Oe.NoValue)}}else{let _=0;for(;_<h.length;){let d=h[_];++_,d()}h=[],a[a.length-1]==f?o=this.typeExpr(f,t):this.typeExpr(f,Oe.NoValue)}}let c=0;for(;c<h.length;){let f=h[c];++c,o=f()}return o}return this.typeExpr(e,t)}edef(e){return e.e}error(e,t){let l=new Ie(Ne.ECustom(e.toString()),t.pmin,t.pmax,t.origin,t.line);if(l.text=e,!this.isCompletion)throw y.thrown(l)}saveLocals(){let e=new Ce,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 S=[],v=0;for(;v<i.length;){let I=i[v];++v,S.push(this.makeType(I,t))}r=S}let a=n.resolve(s,r);if(a==null){let S=new U("Unknown type {path}",{path:l}),v=new Ie(Ne.ECustom(S.toString()),t.pmin,t.pmax,t.origin,t.line);if(v.text=S,!this.isCompletion)throw y.thrown(v);a=X.TDynamic}return a;case 1:let h=e.args,o=e.ret,u=0,c=[],f=0;for(;f<h.length;){let S=h[f];++f,c.push({name:"p"+u++,opt:!1,t:this.makeType(S,t)})}return X.TFun(c,this.makeType(o,t));case 2:let g=e.fields,_=[],d=0;for(;d<g.length;){let S=g[d];++d,_.push({name:S.name,opt:!1,t:this.makeType(S.t,t)})}return X.TAnon(_);case 3:let m=e.t;return this.makeType(m,t);case 4:let k=e.t;return this.makeType(k,t);case 5:let C=e.n,T=e.t;return this.makeType(T,t)}}linkLoop(e,t){if(t==e)return!0;switch(t._hx_index){case 0:let l=t.r;return l.r==null?!1:this.linkLoop(e,l.r);case 5:return t==X.TDynamic?!1:this.linkLoop(e,X.TDynamic);case 9:let i=t.c,n=t.args,s=0;for(;s<n.length;){let S=n[s];if(++s,this.linkLoop(e,S))return!0}return!1;case 10:let r=t.e,a=t.args,h=0;for(;h<a.length;){let S=a[h];if(++h,this.linkLoop(e,S))return!0}return!1;case 11:let o=t.t,u=t.args,c=0;for(;c<u.length;){let S=u[c];if(++c,this.linkLoop(e,S))return!0}return!1;case 12:let f=t.a,g=t.args,_=0;for(;_<g.length;){let S=g[_];if(++_,this.linkLoop(e,S))return!0}return!1;case 13:let d=t.args,m=t.ret,k=0;for(;k<d.length;){let S=d[k];if(++k,this.linkLoop(e,S.t))return!0}return this.linkLoop(e,m);case 14:let C=t.fields,T=0;for(;T<C.length;){let S=C[T];if(++T,this.linkLoop(e,S.t))return!0}return!1;default:return!1}}link(e,t,l){return this.linkLoop(e,t)?this.follow(t)==e:(t==X.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 d=t.r;return d.r==null?this.link(t,e,d)?(d.r=e,!0):!1:this.typeEq(e,d.r);case 8:let m=t.t,k=i;return this.typeEq(k,m);case 11:let C=t.t,T=t.args;return this.typeEq(e,this.apply(C.t,C.params,T));default:let S=i;return this.typeEq(S,t)}break;case 9:let n=e.c,s=e.args;switch(t._hx_index){case 0:let d=t.r;return d.r==null?this.link(t,e,d)?(d.r=e,!0):!1:this.typeEq(e,d.r);case 8:let m=t.t;return this.typeEq(e,m);case 9:let k=t.c,C=t.args,T=s;if(n==k){let E=0,N=T.length;for(;E<N;){let K=E++;if(!this.typeEq(T[K],C[K]))return!1}return!0}break;case 11:let v=t.t,I=t.args;return this.typeEq(e,this.apply(v.t,v.params,I));default:}break;case 10:let r=e.e,a=e.args;switch(t._hx_index){case 0:let d=t.r;return d.r==null?this.link(t,e,d)?(d.r=e,!0):!1:this.typeEq(e,d.r);case 8:let m=t.t;return this.typeEq(e,m);case 10:let k=t.e,C=t.args,T=a;if(r==k){let E=0,N=T.length;for(;E<N;){let K=E++;if(!this.typeEq(T[K],C[K]))return!1}return!0}break;case 11:let v=t.t,I=t.args;return this.typeEq(e,this.apply(v.t,v.params,I));default:}break;case 11:let h=e.t,o=e.args;switch(t._hx_index){case 0:let d=t.r;return d.r==null?this.link(t,e,d)?(d.r=e,!0):!1:this.typeEq(e,d.r);case 8:let m=t.t,k=o,C=h;return this.typeEq(this.apply(C.t,C.params,k),t);case 11:let T=t.t,S=t.args,v=o;if(h==T){let K=0,V=v.length;for(;K<V;){let B=K++;if(!this.typeEq(v[B],S[B]))return!1}return!0}else{let K=o,V=h;return this.typeEq(this.apply(V.t,V.params,K),t)}break;default:let E=o,N=h;return this.typeEq(this.apply(N.t,N.params,E),t)}break;case 12:let u=e.a,c=e.args;switch(t._hx_index){case 0:let d=t.r;return d.r==null?this.link(t,e,d)?(d.r=e,!0):!1:this.typeEq(e,d.r);case 8:let m=t.t;return this.typeEq(e,m);case 11:let k=t.t,C=t.args;return this.typeEq(e,this.apply(k.t,k.params,C));case 12:let T=t.a,S=t.args,v=c;if(u==T){let E=0,N=v.length;for(;E<N;){let K=E++;if(!this.typeEq(v[K],S[K]))return!1}return!0}break;default:}break;case 13:let f=e.args,g=e.ret;switch(t._hx_index){case 0:let d=t.r;return d.r==null?this.link(t,e,d)?(d.r=e,!0):!1:this.typeEq(e,d.r);case 8:let m=t.t;return this.typeEq(e,m);case 11:let k=t.t,C=t.args;return this.typeEq(e,this.apply(k.t,k.params,C));case 13:let T=t.args,S=t.ret,v=g,I=f;if(I.length==T.length){let E=0,N=I.length;for(;E<N;){let K=E++;if(!this.typeEq(I[K].t,T[K].t))return!1}return this.typeEq(v,S)}break;default:}break;case 14:let _=e.fields;switch(t._hx_index){case 0:let d=t.r;return d.r==null?this.link(t,e,d)?(d.r=e,!0):!1:this.typeEq(e,d.r);case 8:let m=t.t;return this.typeEq(e,m);case 11:let k=t.t,C=t.args;return this.typeEq(e,this.apply(k.t,k.params,C));case 14:let T=t.fields,S=_;if(S.length==T.length){let v=Object.create(null),I=0;for(;I<T.length;){let N=T[I];++I,v[N.name]=N}let E=0;for(;E<S.length;){let N=S[E];++E;let K=v[N.name];if(K==null||!this.typeEq(N.t,K.t))return!1}return!0}break;default:}break;default:switch(t._hx_index){case 0:let d=t.r;return d.r==null?this.link(t,e,d)?(d.r=e,!0):!1:this.typeEq(e,d.r);case 8:let m=t.t;return this.typeEq(e,m);case 11:let k=t.t,C=t.args;return this.typeEq(e,this.apply(k.t,k.params,C));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 c=t.r;return c.r==null?this.link(t,e,c)?(c.r=e,!0):!1:this.tryUnify(e,c.r);case 3:return!0;case 5:return!0;case 8:let f=t.t;return this.tryUnify(e,f);case 11:let g=t.t,_=t.args;return this.tryUnify(e,this.apply(g.t,g.params,_));default:}break;case 5:switch(t._hx_index){case 0:let c=t.r;return c.r==null?this.link(t,e,c)?(c.r=e,!0):!1:this.tryUnify(e,c.r);case 5:return!0;case 8:let f=t.t;return this.tryUnify(e,f);case 11:let g=t.t,_=t.args;return this.tryUnify(e,this.apply(g.t,g.params,_));default:return!0}break;case 8:let i=e.t;switch(t._hx_index){case 0:let c=t.r;return c.r==null?this.link(t,e,c)?(c.r=e,!0):!1:this.tryUnify(e,c.r);case 5:let f=i;return this.tryUnify(f,t);case 8:let g=t.t,_=i;return this.tryUnify(_,t);case 11:let d=t.t,m=t.args;return this.tryUnify(e,this.apply(d.t,d.params,m));default:let k=i;return this.tryUnify(k,t)}break;case 9:let n=e.c,s=e.args;switch(t._hx_index){case 0:let c=t.r;return c.r==null?this.link(t,e,c)?(c.r=e,!0):!1:this.tryUnify(e,c.r);case 5:return!0;case 8:let f=t.t;return this.tryUnify(e,f);case 9:let g=t.c,_=t.args,d=s,m=n;for(;m!=g;){if(m.interfaces!=null){let B=0,O=m.interfaces;for(;B<O.length;){let q=O[B];if(++B,q._hx_index==9){let R=q.c,A=q.args,L=[],H=0;for(;H<A.length;){let M=A[H];++H,L.push(this.apply(M,m.params,d))}let $=X.TInst(R,L);if(this.tryUnify($,t))return!0}else throw y.thrown("assert")}}let V=m.superClass;if(V==null)return!1;if(V._hx_index==9){let B=V.c,O=V.args,q=[],R=0;for(;R<O.length;){let A=O[R];++R,q.push(this.apply(A,m.params,d))}d=q,m=B}else throw y.thrown("assert")}let k=0,C=d.length;for(;k<C;){let V=k++;if(!this.typeEq(d[V],_[V]))return!1}return!0;case 11:let T=t.t,S=t.args;return this.tryUnify(e,this.apply(T.t,T.params,S));case 14:let v=t.fields,I=s,E=n,N=0,K=v.length;for(;N<K;){let V=N++,B=v[V],O=null,q=E;for(;O=q.fields.h[B.name],O==null;){if(q.superClass==null)return!1;let R=q.superClass;if(R==null)throw y.thrown("assert");if(R._hx_index==9){let A=R.args;q=R.c}else throw y.thrown("assert")}if(!this.typeEq(this.apply(O.t,E.params,I),B.t))return!1}return!0;default:}break;case 11:let r=e.t,a=e.args;switch(t._hx_index){case 0:let c=t.r;return c.r==null?this.link(t,e,c)?(c.r=e,!0):!1:this.tryUnify(e,c.r);case 5:let f=a,g=r;return this.tryUnify(this.apply(g.t,g.params,f),t);case 8:let _=t.t,d=a,m=r;return this.tryUnify(this.apply(m.t,m.params,d),t);case 11:let k=t.t,C=t.args,T=a,S=r;return this.tryUnify(this.apply(S.t,S.params,T),t);default:let v=a,I=r;return this.tryUnify(this.apply(I.t,I.params,v),t)}break;case 13:let h=e.args,o=e.ret;switch(t._hx_index){case 0:let c=t.r;return c.r==null?this.link(t,e,c)?(c.r=e,!0):!1:this.tryUnify(e,c.r);case 5:return!0;case 8:let f=t.t;return this.tryUnify(e,f);case 11:let g=t.t,_=t.args;return this.tryUnify(e,this.apply(g.t,g.params,_));case 12:let d=t.a,m=t.args,k=d.meta,C=d.params,T=d.t;if(d.name=="haxe.Function")return!0;break;case 13:let S=t.args,v=t.ret,I=o,E=h;if(E.length==S.length){let N=0,K=E.length;for(;N<K;){let V=N++,B=E[V],O=S[V];if(O.opt&&!B.opt||!this.tryUnify(O.t,B.t))return!1}return this.tryUnify(I,v)}break;default:}break;case 14:let u=e.fields;switch(t._hx_index){case 0:let c=t.r;return c.r==null?this.link(t,e,c)?(c.r=e,!0):!1:this.tryUnify(e,c.r);case 5:return!0;case 8:let f=t.t;return this.tryUnify(e,f);case 11:let g=t.t,_=t.args;return this.tryUnify(e,this.apply(g.t,g.params,_));case 14:let d=t.fields,m=u;if(d.length==0)return!0;let k=Object.create(null),C=0;for(;C<m.length;){let S=m[C];++C,k[S.name]=S}let T=0;for(;T<d.length;){let S=d[T];++T;let v=k[S.name];if(v==null){if(S.opt)continue;return!1}if(!this.typeEq(v.t,S.t))return!1}return!0;default:}break;default:switch(t._hx_index){case 0:let c=t.r;return c.r==null?this.link(t,e,c)?(c.r=e,!0):!1:this.tryUnify(e,c.r);case 5:return!0;case 8:let f=t.t;return this.tryUnify(e,f);case 11:let g=t.t,_=t.args;return this.tryUnify(e,this.apply(g.t,g.params,_));default:}}return this.typeEq(e,t)}unify(e,t,l){if(!this.tryUnify(e,t)){let i=new U("{a} should be {b}",{a:ct.typeStr(e),b:ct.typeStr(t)}),n=new Ie(Ne.ECustom(i.toString()),l.pmin,l.pmax,l.origin,l.line);if(n.text=i,!this.isCompletion)throw y.thrown(n)}}apply(e,t,l){if(l.length!=t.length)throw y.thrown("Invalid number of type parameters");if(l.length==0)return e;let i=new Pi,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 X.TNull(t(s));case 9:let r=e.args;if(r.length==0)return e;{let C=r,T=e.c,S=[],v=0;for(;v<C.length;){let I=C[v];++v,S.push(t(I))}return X.TInst(T,S)}break;case 10:let a=e.args;if(a.length==0)return e;{let C=a,T=e.e,S=[],v=0;for(;v<C.length;){let I=C[v];++v,S.push(t(I))}return X.TEnum(T,S)}break;case 11:let h=e.args;if(h.length==0)return e;{let C=h,T=e.t,S=[],v=0;for(;v<C.length;){let I=C[v];++v,S.push(t(I))}return X.TType(T,S)}break;case 12:let o=e.args;if(o.length==0)return e;{let C=o,T=e.a,S=[],v=0;for(;v<C.length;){let I=C[v];++v,S.push(t(I))}return X.TAbstract(T,S)}break;case 13:let u=e.args,c=e.ret,f=[],g=0;for(;g<u.length;){let C=u[g];++g,f.push({name:C.name,opt:C.opt,t:t(C.t)})}return X.TFun(f,t(c));case 14:let _=e.fields,d=[],m=0;for(;m<_.length;){let C=_[m];++m,d.push({name:C.name,opt:C.opt,t:t(C.t)})}return X.TAnon(d);case 15:let k=e.f;return t(k())}}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(c){return l.apply(c,n.params,s)};for(;n!=null;){let c=n.fields.h,f=c,g=Object.keys(c),_=g.length,d=0;for(;d<_;){let k=g[d++],C=n.fields.h[k];if(!C.isPublic||!C.complete)continue;let T=C.name,S=r(C.t);this.allowAsync&&T.startsWith("a_")&&(S=this.unasync(S),T=p.substr(T,2,null)),t.push({name:T,t:S})}if(n.isInterface&&n.interfaces!=null){let k=0,C=n.interfaces;for(;k<C.length;){let T=C[k];++k;let S=0,v=this.getFields(T);for(;S<v.length;){let I=v[S];++S,t.push({name:I.name,t:r(I.t)})}}}if(n.superClass==null)break;let m=n.superClass;if(m==null)break;if(m._hx_index==9){let k=m.c,C=m.args,T=r;r=function(S){return T(l.apply(S,k.params,C))},n=k}else break}break;case 13:let a=i.args,h=i.ret;this.isCompletion&&t.push({name:"bind",t:X.TFun(a,X.TVoid)});break;case 14:let o=i.fields,u=0;for(;u<o.length;){let c=o[u];++u,t.push({name:c.name,t:c.t})}break;default:}return t}getField(e,t,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 c=0,f=s.interfaces;for(;c<f.length;){let g=f[c];++c;let _=this.getField(g,t,l,i);if(_!=null)return this.apply(_,s.params,r)}}if(a==null){if(s.superClass==null)return null;let c=this.getField(s.superClass,t,l,i);return c!=null&&(c=this.apply(c,s.params,r)),c}if(!a.isPublic){let c=new U("Can't access private field {field} on {type}",{field:t,type:s.name}),f=new Ie(Ne.ECustom(c.toString()),l.pmin,l.pmax,l.origin,l.line);if(f.text=c,!this.isCompletion)throw y.thrown(f)}if(i&&!a.canWrite){let c=new U("Can't write readonly field {field} on {type}",{field:t,type:s.name}),f=new Ie(Ne.ECustom(c.toString()),l.pmin,l.pmax,l.origin,l.line);if(f.text=c,!this.isCompletion)throw y.thrown(f)}let h=a.t;if(a.params!=null){let c=a.params,f=[],g=0,_=a.params.length;for(;g<_;){let d=g++;f.push(this.makeMono())}h=this.apply(h,c,f)}return this.apply(h,s.params,r);case 14:let o=n.fields,u=0;for(;u<o.length;){let c=o[u];if(++u,c.name==t)return c.t}return null;default:return null}}unasync(e){let t=this.follow(e);if(t._hx_index==13){let 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 X.TFun(n,h.t)}}}}return null}typeExprWith(e,t){let l=this.typeExpr(e,Oe.WithType(t));return this.unify(l,t,e),t}makeMono(){return X.TMono({r:null})}makeIterator(e){return X.TAnon([{name:"next",opt:!1,t:X.TFun([],e)},{name:"hasNext",opt:!1,t:X.TFun([],X.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 y.thrown(new ln(e,t))}typeField(e,t,l,i){let n=this.typeExpr(e,Oe.Value);t==null&&this.onCompletion(l,n);let s=this.getField(n,t,l,i);if(s==null){let r=new U("{type} has no field {field}",{type:ct.typeStr(n),field:t}),a=new Ie(Ne.ECustom(r.toString()),l.pmin,l.pmax,l.origin,l.line);if(a.text=r,!this.isCompletion)throw y.thrown(a);s=X.TDynamic}return s}typeExpr(e,t){if(e==null&&this.isCompletion)return t._hx_index==2?t.t:X.TDynamic;let l=this,i=e.e;switch(i._hx_index){case 0:let a=i.c;switch(a._hx_index){case 0:let me=a.v;return X.TInt;case 1:let ke=a.f;return X.TFloat;case 2:let He=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 me=u.f;return me()}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 X.TBool;case"null":return this.makeMono();case"trace":return X.TDynamic;default:if(t._hx_index==2){let He=t.t;if(He._hx_index==10){let Xe=He,Vt=He.e,$t=He.args,kt=0,xl=Vt.constructors;for(;kt<xl.length;){let Al=xl[kt];if(++kt,Al.name==h){if(this.onTopDownEnum(Vt,h)){let Qt=Al.args==null?Xe:X.TFun(Al.args,Xe);return this.apply(Qt,Vt.params,$t)}break}}}}if(this.isCompletion)return X.TDynamic;let me=new U("Unknown name: {name}",{name:h}),ke=new Ie(Ne.ECustom(me.toString()),e.pmin,e.pmax,e.origin,e.line);if(ke.text=me,!this.isCompletion)throw y.thrown(ke)}break;case 2:let c=i.n,f=i.t,g=i.e,_=f==null?this.makeMono():this.makeType(f,e);if(g!=null){let me=this.typeExpr(g,f==null?Oe.Value:Oe.WithType(_));f==null?_=me:this.unify(me,_,g)}return this.locals.h[c]=_,X.TVoid;case 3:let d=i.e;return this.typeExpr(d,t);case 4:let m=i.e,k=X.TVoid,C=this.saveLocals(),T=0;for(;T<m.length;){let me=m[T];++T,k=this.typeExpr(me,me==m[m.length-1]?t:Oe.NoValue)}return this.locals=C,k;case 5:let S=i.e,v=i.f;return this.typeField(S,v,e,!1);case 6:let I=i.op,E=i.e1,N=i.e2;switch(I){case"!=":case"==":return this.typeExpr(E,Oe.Value),this.typeExpr(N,Oe.Value),X.TBool;case"%":case"*":case"-":case"/":let me=this.typeExpr(E,Oe.WithType(X.TInt)),ke=this.typeExpr(N,Oe.WithType(me));this.tryUnify(me,ke)||this.unify(ke,me,N);let He=this.follow(me),Xe=this.follow(ke);switch(He._hx_index){case 2:switch(Xe._hx_index){case 2:return I=="/"?X.TFloat:X.TInt;case 3:case 5:return X.TFloat;default:this.unify(me,X.TFloat,E),this.unify(ke,X.TFloat,N)}break;case 3:switch(Xe._hx_index){case 2:case 3:case 5:return X.TFloat;default:this.unify(me,X.TFloat,E),this.unify(ke,X.TFloat,N)}break;case 5:switch(Xe._hx_index){case 2:case 3:case 5:return X.TFloat;default:this.unify(me,X.TFloat,E),this.unify(ke,X.TFloat,N)}break;default:this.unify(me,X.TFloat,E),this.unify(ke,X.TFloat,N)}break;case"+":let Vt=this.typeExpr(E,Oe.WithType(X.TInt)),$t=this.typeExpr(N,Oe.WithType(Vt));this.tryUnify(Vt,$t);let kt=this.follow(Vt),xl=this.follow($t);switch(kt._hx_index){case 2:switch(xl._hx_index){case 2:return X.TInt;case 3:return X.TFloat;case 5:return X.TDynamic;default:let ol=kt,ul=xl;if(this.isString(ol)||this.isString(ul))return this.types.t_string;this.unify(ol,X.TFloat,E),this.unify(ul,X.TFloat,N)}break;case 3:switch(xl._hx_index){case 2:case 3:return X.TFloat;case 5:return X.TDynamic;default:let ol=kt,ul=xl;if(this.isString(ol)||this.isString(ul))return this.types.t_string;this.unify(ol,X.TFloat,E),this.unify(ul,X.TFloat,N)}break;case 5:return X.TDynamic;default:if(xl._hx_index==5)return X.TDynamic;{let ol=kt,ul=xl;if(this.isString(ol)||this.isString(ul))return this.types.t_string;this.unify(ol,X.TFloat,E),this.unify(ul,X.TFloat,N)}}break;case"...":return this.typeExprWith(E,X.TInt),this.typeExprWith(N,X.TInt),this.makeIterator(X.TInt);case"&":case"<<":case">>":case">>>":case"^":case"|":return this.typeExprWith(E,X.TInt),this.typeExprWith(N,X.TInt),X.TInt;case"<":case"<=":case">":case">=":let Al=E,Qt=this.typeExpr(Al,Oe.Value);if(this.follow(Qt)._hx_index==4){let ol=new U("Cannot compare {type}",{type:ct.typeStr(Qt)}),ul=new Ie(Ne.ECustom(ol.toString()),e.pmin,e.pmax,e.origin,e.line);if(ul.text=ol,!this.isCompletion)throw y.thrown(ul)}let sl=N,Rl=this.typeExpr(sl,Oe.Value);if(this.follow(Rl)._hx_index==4){let ol=new U("Cannot compare {type}",{type:ct.typeStr(Rl)}),ul=new Ie(Ne.ECustom(ol.toString()),e.pmin,e.pmax,e.origin,e.line);if(ul.text=ol,!this.isCompletion)throw y.thrown(ul)}return X.TBool;case"=":if(this.allowDefine){let ol=E.e;if(ol._hx_index==1){let ul=ol.v;if(!Object.prototype.hasOwnProperty.call(this.locals.h,ul)&&!Object.prototype.hasOwnProperty.call(this.globals.h,ul)){let $n=this.typeExpr(N,Oe.Value);return this.locals.h[ul]=$n,$n}}}let Hi,Mi=E.e;if(Mi._hx_index==5){let ol=Mi.e,ul=Mi.f;Hi=this.typeField(ol,ul,E,!0)}else Hi=this.typeExpr(E,Oe.Value);return this.typeExprWith(N,Hi),Hi;case"&&":case"||":return this.typeExpr(E,Oe.Value),this.typeExpr(N,Oe.Value),X.TBool;default:if(p.cca(I,I.length-1)==61){let ol=this.typeExpr(this.mk(Y.EBinop(p.substr(I,0,I.length-1),E,N),e),t);return this.typeExpr(this.mk(Y.EBinop("=",E,N),e),t)}let Fn=new U("Unsupported operation {op}",{op:I}),Gn=new Ie(Ne.ECustom(Fn.toString()),e.pmin,e.pmax,e.origin,e.line);if(Gn.text=Fn,!this.isCompletion)throw y.thrown(Gn)}break;case 7:let K=i.prefix,V=i.op,B=i.e,O=this.typeExpr(B,Oe.Value);switch(V){case"!":return X.TBool;case"++":case"-":case"--":return this.unify(O,X.TInt,B),O;default:}break;case 8:let q=i.e,R=i.params,A=q.e;if(A._hx_index==5&&A.f=="bind"){let me=A.e,ke=this.typeExpr(me,Oe.Value);if(ke._hx_index==13){let He=ke.args,Xe=ke.ret,Vt=He.slice(),$t=0;for(;$t<R.length;){let kt=R[$t];++$t;let xl=Vt.shift();if(xl==null){let Al=new U("Too many arguments",null),Qt=new Ie(Ne.ECustom(Al.toString()),kt.pmin,kt.pmax,kt.origin,kt.line);if(Qt.text=Al,!this.isCompletion)throw y.thrown(Qt);return X.TFun([],Xe)}this.typeExprWith(kt,xl.t)}return X.TFun(Vt,Xe)}}let L=q.e,H;if(L._hx_index==1){let me=L.v;if(t._hx_index==2){let ke=t.t;if(ke._hx_index==10){let He=ke.e,Xe=ke.args;H=t}else H=Oe.Value}else H=Oe.Value}else H=Oe.Value;let $=this.typeExpr(q,H),M=this.follow($);switch(M._hx_index){case 5:let me=0;for(;me<R.length;){let Qt=R[me];++me,this.typeExpr(Qt,Oe.Value)}return this.makeMono();case 13:let ke=M.args,He=M.ret,Xe=0,Vt=R.length;for(;Xe<Vt;){let Qt=Xe++,sl=ke[Qt];if(sl==null){let Hi=new U("Too many arguments",null),Mi=R[Qt],Fn=new Ie(Ne.ECustom(Hi.toString()),Mi.pmin,Mi.pmax,Mi.origin,Mi.line);if(Fn.text=Hi,!this.isCompletion)throw y.thrown(Fn);break}let Rl=this.typeExpr(R[Qt],sl==null?Oe.Value:Oe.WithType(sl.t));this.unify(Rl,sl.t,R[Qt])}let $t=R.length,kt=ke.length;for(;$t<kt;){let Qt=$t++;if(!ke[Qt].opt){let sl=new U("Missing argument {name}:{type}",{name:ke[Qt].name,type:ct.typeStr(ke[Qt].t)}),Rl=new Ie(Ne.ECustom(sl.toString()),e.pmin,e.pmax,e.origin,e.line);if(Rl.text=sl,!this.isCompletion)throw y.thrown(Rl)}}return He;default:let xl=new U("{type} cannot be called",{type:ct.typeStr($)}),Al=new Ie(Ne.ECustom(xl.toString()),q.pmin,q.pmax,q.origin,q.line);if(Al.text=xl,!this.isCompletion)throw y.thrown(Al);return this.makeMono()}break;case 9:let Z=i.cond,ae=i.e1,ie=i.e2;this.typeExpr(Z,Oe.Value);let ue=this.typeExpr(ae,t);if(ie==null)return ue;let de=this.typeExpr(ie,t);if(t==Oe.NoValue)return X.TVoid;if(this.tryUnify(de,ue))return ue;if(this.tryUnify(ue,de))return de;this.unify(de,ue,ie);break;case 10:let ye=i.cond,ce=i.e;return this.typeExpr(ye,Oe.Value),this.typeExpr(ce,Oe.NoValue),X.TVoid;case 11:let pe=i.v,Je=i.it,tt=i.e,Ge=this.saveLocals(),ht=this.typeExpr(Je,Oe.Value),Ze=this.getIteratorType(Je,ht);return this.locals.h[pe]=Ze,this.typeExpr(tt,Oe.NoValue),this.locals=Ge,X.TVoid;case 12:case 13:return X.TVoid;case 14:let $e=i.args,xt=i.e,Ke=i.name,at=i.ret,fe=null,j=null,re=null;if(this.currentFunType!=null){let me=this.currentFunType;if(me._hx_index==13){let ke=me.args,He=me.ret;fe=this.currentFunType,j=He,re=ke}else throw y.thrown("assert");this.currentFunType=null}else j=at==null?this.makeMono():this.makeType(at,e);let te=this.saveLocals(),ne=this.allowReturn,xe=this.allowDefine,we=this.hasReturn;this.allowReturn=j,this.allowDefine=!1,this.hasReturn=!1;let Se=null,ot;if(Ke!=null){let me;if(t._hx_index==2){let ke=this.follow(t.t);if(ke._hx_index==13){let He=ke.args,Xe=ke.ret;me=!0}else me=!1}else me=!1;ot=!me}else ot=!1;if(ot){let me=this.events.h[Ke];me!=null&&(t=Oe.WithType(me))}if(t._hx_index==2){let me=this.follow(t.t);if(me._hx_index==13){let ke=me.args,He=me.ret;Se=ke,this.unify(j,He,e)}}re==null&&(re=this.typeArgs($e,e));let Lt=0,Re=re.length;for(;Lt<Re;){let me=Lt++,ke=re[me];if(Se!=null)if(me<Se.length)this.unify(Se[me].t,ke.t,e);else{let He=new U("Extra argument {name}",{name:ke.name}),Xe=new Ie(Ne.ECustom(He.toString()),e.pmin,e.pmax,e.origin,e.line);if(Xe.text=He,!this.isCompletion)throw y.thrown(Xe)}this.locals.h[ke.name]=ke.t}if(Se!=null&&re.length<Se.length){let me=qe.formatCount(Se.length-re.length,"{n} argument","{n} arguments",null,null),ke=[],He=re.length,Xe=Se.length;for(;He<Xe;){let kt=He++;ke.push(ct.typeStr(Se[kt].t))}let Vt=new U("Missing {count} ({types})",{count:me,types:ke.join(",")}),$t=new Ie(Ne.ECustom(Vt.toString()),e.pmin,e.pmax,e.origin,e.line);if($t.text=Vt,!this.isCompletion)throw y.thrown($t)}if(this.typeExpr(xt,Oe.NoValue),!this.hasReturn&&!this.tryUnify(j,X.TVoid)){let me=new U("Missing return {type}",{type:ct.typeStr(j)}),ke=new Ie(Ne.ECustom(me.toString()),e.pmin,e.pmax,e.origin,e.line);if(ke.text=me,!this.isCompletion)throw y.thrown(ke)}return this.allowDefine=xe,this.allowReturn=ne,this.hasReturn=we,this.locals=te,fe==null&&(fe=X.TFun(re,j),Ke!=null&&(te.h[Ke]=fe)),fe;case 15:let Pt=i.e,Fe=Pt==null?X.TVoid:this.typeExpr(Pt,this.allowReturn==null?Oe.Value:Oe.WithType(this.allowReturn));if(this.hasReturn=!0,this.allowReturn==null){let me=new U("Return not allowed here",null),ke=new Ie(Ne.ECustom(me.toString()),e.pmin,e.pmax,e.origin,e.line);if(ke.text=me,!this.isCompletion)throw y.thrown(ke)}else this.unify(Fe,this.allowReturn,Pt??e);return this.makeMono();case 16:let Me=i.e,bt=i.index;this.typeExprWith(bt,X.TInt);let pt=this.typeExpr(Me,Oe.Value),Wt=this.follow(pt);if(Wt._hx_index==9){let me=Wt.c,ke=Wt.args,He=me.constructor,Xe=me.fields,Vt=me.interfaces,$t=me.isInterface,kt=me.meta,xl=me.params,Al=me.statics,Qt=me.superClass;if(me.name=="Array"){if(ke.length==1)return ke[0];{let sl=new U("{type} is not an Array",{type:ct.typeStr(pt)}),Rl=new Ie(Ne.ECustom(sl.toString()),Me.pmin,Me.pmax,Me.origin,Me.line);if(Rl.text=sl,!this.isCompletion)throw y.thrown(Rl)}}else{let sl=new U("{type} is not an Array",{type:ct.typeStr(pt)}),Rl=new Ie(Ne.ECustom(sl.toString()),Me.pmin,Me.pmax,Me.origin,Me.line);if(Rl.text=sl,!this.isCompletion)throw y.thrown(Rl)}}else{let me=new U("{type} is not an Array",{type:ct.typeStr(pt)}),ke=new Ie(Ne.ECustom(me.toString()),Me.pmin,Me.pmax,Me.origin,Me.line);if(ke.text=me,!this.isCompletion)throw y.thrown(ke)}break;case 17:let gl=i.e,It=null,Ol=0;for(;Ol<gl.length;){let me=gl[Ol];++Ol;let ke=this.typeExpr(me,It==null?Oe.Value:Oe.WithType(It));It==null?It=ke:this.tryUnify(ke,It)||(this.tryUnify(It,ke)?It=ke:this.unify(ke,It,me))}return It==null&&(It=this.makeMono()),this.types.getType("Array",[It]);case 18:let lt=i.cl,ll=i.params;break;case 19:let Gt=i.e;return this.typeExpr(Gt,Oe.Value),this.makeMono();case 20:let il=i.e,Nt=i.v,al=i.t,_l=i.ecatch,hl=this.typeExpr(il,t),Pl=this.locals.h[Nt],Il=this.locals,dl=this.makeType(al,_l);Il.h[Nt]=dl;let ft=this.typeExpr(_l,t);if(Pl!=null)this.locals.h[Nt]=Pl;else{let me=this.locals;Object.prototype.hasOwnProperty.call(me.h,Nt)&&delete me.h[Nt]}return t==Oe.NoValue?X.TVoid:this.tryUnify(hl,ft)?ft:(this.unify(ft,hl,_l),hl);case 21:let Ql=i.fl;if(t._hx_index==2){let me=this.follow(t.t);if(me._hx_index==14){let ke=me.fields;if(ke.length>0){let He=Object.create(null),Xe=0;for(;Xe<ke.length;){let kt=ke[Xe];++Xe,He[kt.name]=kt}let Vt=[],$t=0;for(;$t<Ql.length;){let kt=Ql[$t];++$t;let xl=He[kt.name],Al;if(xl==null){let Qt=new U("Extra field {field}",{field:kt.name}),sl=kt.e,Rl=new Ie(Ne.ECustom(Qt.toString()),sl.pmin,sl.pmax,sl.origin,sl.line);if(Rl.text=Qt,!this.isCompletion)throw y.thrown(Rl);Al=X.TDynamic}else Al=xl.t;Vt.push({t:this.typeExprWith(kt.e,Al),opt:!1,name:kt.name})}return X.TAnon(Vt)}else{let He=[],Xe=0;for(;Xe<Ql.length;){let Vt=Ql[Xe];++Xe,He.push({t:this.typeExpr(Vt.e,Oe.Value),opt:!1,name:Vt.name})}return X.TAnon(He)}}else{let ke=[],He=0;for(;He<Ql.length;){let Xe=Ql[He];++He,ke.push({t:this.typeExpr(Xe.e,Oe.Value),opt:!1,name:Xe.name})}return X.TAnon(ke)}}else{let me=[],ke=0;for(;ke<Ql.length;){let He=Ql[ke];++ke,me.push({t:this.typeExpr(He.e,Oe.Value),opt:!1,name:He.name})}return X.TAnon(me)}break;case 22:let Pe=i.cond,gt=i.e1,Tt=i.e2;this.typeExpr(Pe,Oe.Value);let wt=this.typeExpr(gt,t);if(Tt==null)return wt;let St=this.typeExpr(Tt,t);if(t==Oe.NoValue)return X.TVoid;if(this.tryUnify(St,wt))return wt;if(this.tryUnify(wt,St))return St;this.unify(St,wt,Tt);break;case 23:let nl=i.e,jt=i.cases,ml=i.defaultExpr,Mt=null,Nn=this.typeExpr(nl,Oe.Value),Ji=0;for(;Ji<jt.length;){let me=jt[Ji];++Ji;let ke=0,He=me.values;for(;ke<He.length;){let $t=He[ke];++ke;let kt=this.typeExpr($t,Oe.WithType(Nn));this.unify(kt,Nn,$t)}let Xe=this.typeExpr(me.expr,t),Vt=me.expr;t!=Oe.NoValue&&(Mt==null?Mt=Xe:l.tryUnify(Xe,Mt)||(l.unify(Mt,Xe,Vt),Mt=Xe))}if(ml!=null){let me=this.typeExpr(ml,t);t!=Oe.NoValue&&(Mt==null?Mt=me:l.tryUnify(me,Mt)||(l.unify(Mt,me,ml),Mt=me))}return t==Oe.NoValue?X.TVoid:Mt??this.makeMono();case 24:let Oi=i.cond,Un=i.e;return this.typeExpr(Oi,Oe.Value),this.typeExpr(Un,Oe.NoValue),X.TVoid;case 25:let os=i.args,ns=i.name,ss=i.e;return ns==":untyped"&&this.allowUntypedMeta?this.makeMono():this.typeExpr(ss,t);case 26:let Hn=i.e,rs=i.t,Wn=this.makeType(rs,e),as=this.typeExpr(Hn,Oe.WithType(Wn));return this.unify(as,Wn,Hn),Wn}let n=e.e,s=new U("Don't know how to type "+it[n.__enum__].__constructs__[n._hx_index]._hx_name),r=new Ie(Ne.ECustom(s.toString()),e.pmin,e.pmax,e.origin,e.line);if(r.text=s,!this.isCompletion)throw y.thrown(r);return X.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,c=r.isInterface,f=r.meta,g=r.params,_=r.statics,d=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":ct.typeStr(t.r);case 6:return e.name;case 7:return"?"+e.name;case 8:let n=e.t;return"Null<"+ct.typeStr(n)+">";case 9:let s=e.c,r=e.args,a=s.name,h;if(r.length==0)h="";else{let V=[],B=0;for(;B<r.length;){let O=r[B];++B,V.push(ct.typeStr(O))}h="<"+V.join(",")+">"}return a+h;case 10:let o=e.e,u=e.args,c=o.name,f;if(u.length==0)f="";else{let V=[],B=0;for(;B<u.length;){let O=u[B];++B,V.push(ct.typeStr(O))}f="<"+V.join(",")+">"}return c+f;case 11:let g=e.t,_=e.args;if(g.name=="loreline.lorscript.TypeCheck")return ct.typeStr(_[1]);{let V=g.name,B;if(_.length==0)B="";else{let O=[],q=0;for(;q<_.length;){let R=_[q];++q,O.push(ct.typeStr(R))}B="<"+O.join(",")+">"}return V+B}break;case 12:let d=e.a,m=e.args,k=d.name,C;if(m.length==0)C="";else{let V=[],B=0;for(;B<m.length;){let O=m[B];++B,V.push(ct.typeStr(O))}C="<"+V.join(",")+">"}return k+C;case 13:let T=e.args,S=e.ret,v=[],I=0;for(;I<T.length;){let V=T[I];++I,v.push((V.opt?"?":"")+(V.name==""?"":V.name+":")+ct.typeStr(V.t))}return"("+v.join(", ")+") -> "+ct.typeStr(S);case 14:let E=e.fields,N=[],K=0;for(;K<E.length;){let V=E[K];++K,N.push((V.opt?"?":"")+V.name+":"+ct.typeStr(V.t))}return"{"+N.join(", ")+"}";default:return p.substr(it[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 I=s[r];++r,t(I)}break;case 10:let a=e.e,h=e.args,o=0;for(;o<h.length;){let I=h[o];++o,t(I)}break;case 11:let u=e.t,c=e.args,f=0;for(;f<c.length;){let I=c[f];++f,t(I)}break;case 12:let g=e.a,_=e.args,d=0;for(;d<_.length;){let I=_[d];++d,t(I)}break;case 13:let m=e.args,k=e.ret,C=0;for(;C<m.length;){let I=m[C];++C,t(I.t)}t(k);break;case 14:let T=e.fields,S=0;for(;S<T.length;){let I=T[S];++S,t(I.t)}break;case 15:let v=e.f;t(v());break;default:}}}J["loreline.lorscript.Checker"]=ct,ct.__name__="loreline.lorscript.Checker",Object.assign(ct.prototype,{__class__:ct});var Kl=it["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)};Kl.__constructs__=[Kl.CInt,Kl.CFloat,Kl.CString];var Y=it["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)};Y.__constructs__=[Y.EConst,Y.EIdent,Y.EVar,Y.EParent,Y.EBlock,Y.EField,Y.EBinop,Y.EUnop,Y.ECall,Y.EIf,Y.EWhile,Y.EFor,Y.EBreak,Y.EContinue,Y.EFunction,Y.EReturn,Y.EArray,Y.EArrayDecl,Y.ENew,Y.EThrow,Y.ETry,Y.EObject,Y.ETernary,Y.ESwitch,Y.EDoWhile,Y.EMeta,Y.ECheckType];var Cl=it["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)};Cl.__constructs__=[Cl.CTPath,Cl.CTFun,Cl.CTAnon,Cl.CTParent,Cl.CTOpt,Cl.CTNamed];class Ie{constructor(e,t,l,i,n){this.text=null,this.e=e,this.pmin=t,this.pmax=l,this.origin=i,this.line=n}toString(){return Li.errorToString(this)}}J["loreline.lorscript.Error"]=Ie,Ie.__name__="loreline.lorscript.Error",Object.assign(Ie.prototype,{__class__:Ie});var Ne=it["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)};Ne.__constructs__=[Ne.EInvalidChar,Ne.EUnexpected,Ne.EUnterminatedString,Ne.EUnterminatedComment,Ne.EInvalidPreprocessor,Ne.EUnknownVariable,Ne.EInvalidIterator,Ne.EInvalidOp,Ne.EInvalidAccess,Ne.ECustom];var vi=it["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)};vi.__constructs__=[vi.DPackage,vi.DImport,vi.DClass,vi.DTypedef];var ri=it["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}};ri.__constructs__=[ri.APublic,ri.APrivate,ri.AInline,ri.AOverride,ri.AStatic,ri.AMacro];var On=it["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)};On.__constructs__=[On.KFunction,On.KVar];var ai=it["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}};ai.__constructs__=[ai.SBreak,ai.SContinue,ai.SReturn];class Pn{constructor(e){this.interpreter=e,this.locals=new Ce,this.declared=[],this.resetVariables(),this.initOps()}resetVariables(){this.variables=new Ce,this.variables.h.null=null,this.variables.h.true=!0,this.variables.h.false=!1;let e=this,t=this.variables,l=Le.makeVarArgs(function(i){let n=e.posInfos(),s=i.shift();i.length>0&&(n.customParams=i),rn.trace(oe.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 Ce,this.binops.h["+"]=function(t,l){let i=e.expr(t),n=e.expr(l);return e.plus(i,n)},this.binops.h["-"]=function(t,l){let i=e.expr(t),n=e.expr(l);return z.arithmetic("-",i,n,e.interpreter)},this.binops.h["*"]=function(t,l){let i=e.expr(t),n=e.expr(l);return z.arithmetic("*",i,n,e.interpreter)},this.binops.h["/"]=function(t,l){let i=e.expr(t),n=e.expr(l);return z.arithmetic("/",i,n,e.interpreter)},this.binops.h["%"]=function(t,l){let i=e.expr(t),n=e.expr(l);return z.arithmetic("%",i,n,e.interpreter)},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 z.equals(i,n)},this.binops.h["!="]=function(t,l){let i=e.expr(t),n=e.expr(l);return!z.equals(i,n)},this.binops.h[">="]=function(t,l){return e.order(t,l)>=0},this.binops.h["<="]=function(t,l){return e.order(t,l)<=0},this.binops.h[">"]=function(t,l){return e.order(t,l)>0},this.binops.h["<"]=function(t,l){return e.order(t,l)<0},this.binops.h["||"]=function(t,l){return e.truthy(t)?!0:e.truthy(l)},this.binops.h["&&"]=function(t,l){return e.truthy(t)?e.truthy(l):!1},this.binops.h["="]=Te(this,this.assign),this.binops.h["..."]=function(t,l){return new Gi(e.expr(t),e.expr(l))},this.binops.h.is=function(t,l){return le.__instanceof(e.expr(t),e.expr(l))},this.assignOp("+=",function(t,l){return e.plus(t,l)}),this.assignOp("-=",function(t,l){return z.arithmetic("-",t,l,e.interpreter)}),this.assignOp("*=",function(t,l){return z.arithmetic("*",t,l,e.interpreter)}),this.assignOp("/=",function(t,l){return z.arithmetic("/",t,l,e.interpreter)}),this.assignOp("%=",function(t,l){return z.arithmetic("%",t,l,e.interpreter)}),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))G.setField(this.interpreter,this.interpreter.context.topLevelState.fields,e,t);else throw y.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),c=this.expr(o);se.isArray(u)?se.arraySet(u,c,l):G.isFields(u)?G.setField(this.interpreter,u,c,l):le.__implements(u,At)?le.__cast(u,At).set(c,l):u[c]=l;break;default:let f=new Ie(Ne.EInvalidOp("="),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw y.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 c=s.e,f=s.index,g=this.expr(c),_=this.expr(f);se.isArray(g)?(n=t(se.arrayGet(g,_),this.expr(i)),se.arraySet(g,_,n)):G.isFields(g)?(n=t(G.getField(this.interpreter,g,_),this.expr(i)),G.setField(this.interpreter,g,_,n)):le.__implements(g,At)?(n=t(le.__cast(g,At).get(_),this.expr(i)),le.__cast(g,At).set(_,n)):(n=t(g[_],this.expr(i)),g[_]=n);break;default:let d=new Ie(Ne.EInvalidOp(e),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw y.thrown(d)}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 r=this.step(r,0),t?(r=this.step(r,l),s==null?this.setVar(n,r):s.r=r):s==null?this.setVar(n,this.step(r,l)):s.r=this.step(r,l),r;case 5:let a=i.e,h=i.f,o=this.expr(a),u=this.get(o,h);return u=this.step(u,0),t?(u=this.step(u,l),this.set(o,h,u)):this.set(o,h,this.step(u,l)),u;case 16:let c=i.e,f=i.index,g=this.expr(c),_=this.expr(f);if(se.isArray(g)){let m=se.arrayGet(g,_);return m=this.step(m,0),t?(m=this.step(m,l),se.arraySet(g,_,m)):se.arraySet(g,_,this.step(m,l)),m}else if(G.isFields(g)){let m=G.getField(this.interpreter,g,_);return m=this.step(m,0),t?(m=this.step(m,l),G.setField(this.interpreter,g,_,m)):G.setField(this.interpreter,g,_,this.step(m,l)),m}else if(le.__implements(g,At)){let m=le.__cast(g,At).get(_);return m=this.step(m,0),t?(m=this.step(m,l),le.__cast(g,At).set(_,m)):le.__cast(g,At).set(_,this.step(m,l)),m}else{let m=g[_];return m=this.step(m,0),t?(m=this.step(m,l),g[_]=m):g[_]=this.step(m,l),m}break;default:let d=new Ie(Ne.EInvalidOp(l>0?"++":"--"),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw y.thrown(d)}}execute(e){return this.depth=0,this.locals=new Ce,this.declared=[],this.exprReturn(e)}exprReturn(e){try{return this.expr(e)}catch(t){let l=y.caught(t).unwrap();if(le.__instanceof(l,ai))switch(l._hx_index){case 0:throw y.thrown("Invalid break");case 1:throw y.thrown("Invalid continue");case 2:let n=this.returnValue;return this.returnValue=null,n}else throw t}}duplicate(e){let t=new Ce,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}}errorText(e){let t=new Ie(Ne.ECustom(e.toString()),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw t.text=e,y.thrown(t)}error(e,t){t==null&&(t=!1);let l=new Ie(e,this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw y.thrown(l)}rethrow(e){throw y.thrown(e)}resolve(e){let t=this.variables.h[e];if(t==null&&!Object.prototype.hasOwnProperty.call(this.variables.h,e)){if(G.fieldExists(this.interpreter,this.interpreter.context.topLevelState.fields,e))return G.getField(this.interpreter,this.interpreter.context.topLevelState.fields,e);if(Object.prototype.hasOwnProperty.call(this.interpreter.context.topLevelCharacters.h,e))return this.interpreter.context.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 Ie(Ne.EUnknownVariable(e),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw y.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 c=t.e;return this.expr(c);case 4:let f=t.e,g=this.declared.length,_=null,d=0;for(;d<f.length;){let Pe=f[d];++d,_=this.expr(Pe)}return this.restore(g),_;case 5:let m=t.e,k=t.f;return this.get(this.expr(m),k);case 6:let C=t.op,T=t.e1,S=t.e2,v=this.binops.h[C];if(v==null){let Pe=new Ie(Ne.EInvalidOp(C),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw y.thrown(Pe)}return v(T,S);case 7:let I=t.op,E=t.prefix,N=t.e;switch(I){case"!":return!this.truthy(N);case"++":return this.increment(N,E,1);case"-":let Pe=this.expr(N);return z.negate(Pe);case"--":return this.increment(N,E,-1);case"~":return~this.expr(N);default:let gt=new Ie(Ne.EInvalidOp(I),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw y.thrown(gt)}break;case 8:let K=t.e,V=t.params,B=[],O=0;for(;O<V.length;){let Pe=V[O];++O,B.push(this.expr(Pe))}let q=K.e;switch(q._hx_index){case 1:return q.v=="call"&&!this.callIsShadowed()?this.dynamicCall(B):this.call(null,this.expr(K),B);case 5:let gt=q.e,Tt=q.f,wt=this.expr(gt);if(wt==null){let St=new Ie(Ne.EInvalidAccess(Tt),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw y.thrown(St)}return this.fcall(wt,Tt,B);default:return this.call(null,this.expr(K),B)}break;case 9:let R=t.cond,A=t.e1,L=t.e2;return this.truthy(R)?this.expr(A):L==null?null:this.expr(L);case 10:let H=t.cond,$=t.e;return this.whileLoop(H,$),null;case 11:let M=t.v,Z=t.it,ae=t.e;return this.forLoop(M,Z,ae),null;case 12:throw y.thrown(ai.SBreak);case 13:throw y.thrown(ai.SContinue);case 14:let ie=t.ret,ue=t.args,de=t.e,ye=t.name,ce=this.duplicate(this.locals),pe=this,Je=!1,tt=0,Ge=0;for(;Ge<ue.length;){let Pe=ue[Ge];++Ge,Pe.opt||Pe.value!=null?Je=!0:tt+=1}let ht=function(Pe){if((Pe==null?0:Pe.length)!=ue.length){if(Pe.length<tt){let Oi="Invalid number of parameters. Got "+Pe.length+", required "+tt;ye!=null&&(Oi+=" for function '"+ye+"'");let Un=new Ie(Ne.ECustom(Oi),l.curExpr.pmin,l.curExpr.pmax,l.curExpr.origin,l.curExpr.line);throw y.thrown(Un)}let ml=[],Mt=Pe.length-tt,Nn=0,Ji=0;for(;Ji<ue.length;){let Oi=ue[Ji];++Ji,Oi.opt||Oi.value!=null?Mt>0?(ml.push(Pe[Nn++]),--Mt):ml.push(Oi.value!=null?pe.expr(Oi.value):null):ml.push(Pe[Nn++])}Pe=ml}let gt=pe.locals,Tt=pe.depth;pe.depth++,pe.locals=pe.duplicate(ce);let wt=0,St=ue.length;for(;wt<St;){let ml=wt++;pe.locals.h[ue[ml].name]={r:Pe[ml]}}let nl=null,jt=l.declared.length;if(l.inTry)try{nl=pe.exprReturn(de)}catch(ml){let Mt=y.caught(ml).unwrap();throw l.restore(jt),pe.locals=gt,pe.depth=Tt,y.thrown(Mt)}else nl=pe.exprReturn(de);return l.restore(jt),pe.locals=gt,pe.depth=Tt,nl},Ze=Ei.make(ht);if(ye!=null)if(this.depth==0)this.variables.h[ye]=Ze;else{this.declared.push({n:ye,old:this.locals.h[ye]});let Pe={r:Ze};this.locals.h[ye]=Pe,ce.h[ye]=Pe}return Ze;case 15:let $e=t.e;throw this.returnValue=$e==null?null:this.expr($e),y.thrown(ai.SReturn);case 16:let xt=t.e,Ke=t.index,at=this.expr(xt),fe=this.expr(Ke);return se.isArray(at)?se.arrayGet(at,fe):G.isFields(at)?G.getField(this.interpreter,at,fe):le.__implements(at,At)?le.__cast(at,At).get(fe):at[fe];case 17:let j=t.e,re;if(j.length>0){let Pe=j[0].e;if(Pe._hx_index==6){let gt=Pe.e1,Tt=Pe.e2;re=Pe.op=="=>"}else re=!1}else re=!1;if(re){let Pe=[],gt=[],Tt=0;for(;Tt<j.length;){let wt=j[Tt];++Tt;let St=wt.e;if(St._hx_index==6)if(St.op=="=>"){let nl=St.e1,jt=St.e2;Pe.push(this.expr(nl)),gt.push(this.expr(jt))}else this.curExpr=wt,this.errorText(new U("Invalid map key=>value expression",null));else this.curExpr=wt,this.errorText(new U("Invalid map key=>value expression",null))}return this.makeMap(Pe,gt)}else{let Pe=[],gt=0;for(;gt<j.length;){let Tt=j[gt];++gt,Pe.push(this.expr(Tt))}return Pe}break;case 18:let te=t.cl,ne=t.params,xe=[],we=0;for(;we<ne.length;){let Pe=ne[we];++we,xe.push(this.expr(Pe))}return this.cnew(te,xe);case 19:let Se=t.e;throw y.thrown(this.expr(Se));case 20:let ot=t.t,Lt=t.e,Re=t.v,Pt=t.ecatch,Fe=this.declared.length,Me=this.inTry;try{this.inTry=!0;let Pe=this.expr(Lt);return this.restore(Fe),this.inTry=Me,Pe}catch(Pe){let gt=y.caught(Pe).unwrap();if(le.__instanceof(gt,ai)){let Tt=gt;throw this.inTry=Me,y.thrown(Tt)}else{let Tt=gt;this.restore(Fe),this.inTry=Me,this.declared.push({n:Re,old:this.locals.h[Re]}),this.locals.h[Re]={r:Tt};let wt=this.expr(Pt);return this.restore(Fe),wt}}break;case 21:let bt=t.fl,pt=G.createFields(this.interpreter),Wt=0;for(;Wt<bt.length;){let Pe=bt[Wt];++Wt,G.setField(this.interpreter,pt,Pe.name,this.expr(Pe.e))}return pt;case 22:let gl=t.cond,It=t.e1,Ol=t.e2;return this.truthy(gl)?this.expr(It):this.expr(Ol);case 23:let lt=t.e,ll=t.cases,Gt=t.defaultExpr,il=this.expr(lt),Nt=!1,al=0;for(;al<ll.length;){let Pe=ll[al];++al;let gt=0,Tt=Pe.values;for(;gt<Tt.length;){let wt=Tt[gt];if(++gt,z.equals(this.expr(wt),il)){Nt=!0;break}}if(Nt){il=this.expr(Pe.expr);break}}return Nt||(il=Gt==null?null:this.expr(Gt)),il;case 24:let _l=t.cond,hl=t.e;return this.doWhileLoop(_l,hl),null;case 25:let Pl=t.name,Il=t.args,dl=t.e;return this.expr(dl);case 26:let ft=t.t,Ql=t.e;return this.expr(Ql)}}plus(e,t){return z.arithmetic("+",e,t,this.interpreter)}step(e,t){return z.arithmetic("-",e,-t,this.interpreter)}truthy(e){return z.isTruthy(this.expr(e))}order(e,t){let l=this.expr(e),i=this.expr(t);return z.canCompare(l,i)||this.errorText(new U("Cannot compare {a} and {b}",{a:z.describeForError(l),b:z.describeForError(i)})),z.compare(l,i)}doWhileLoop(e,t){let l=this.declared.length,i=this;do{let n=!0;try{i.expr(t)}catch(s){let r=y.caught(s).unwrap();if(le.__instanceof(r,ai)){let a=r;switch(a._hx_index){case 0:n=!1;break;case 1:break;case 2:throw y.thrown(a)}}else throw s}if(!n)break}while(this.truthy(e));this.restore(l)}whileLoop(e,t){let l=this.declared.length,i=this;for(;this.truthy(e);){let n=!0;try{i.expr(t)}catch(s){let r=y.caught(s).unwrap();if(le.__instanceof(r,ai)){let a=r;switch(a._hx_index){case 0:n=!1;break;case 1:break;case 2:throw y.thrown(a)}}else throw s}if(!n)break}this.restore(l)}makeIterator(e){if(e instanceof Array)return new ei(e);if(se.isArray(e))return se.getIterator(e);if(e.iterator!=null&&(e=Jn(e)),e.hasNext==null||e.next==null){let t=new Ie(Ne.EInvalidIterator(e),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw y.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=y.caught(o).unwrap();if(le.__instanceof(u,ai)){let c=u;switch(c._hx_index){case 0:h=!1;break;case 1:break;case 2:throw y.thrown(c)}}else throw o}if(!h)break}this.restore(i)}loopRun(e){let t=!0;try{e()}catch(l){let i=y.caught(l).unwrap();if(le.__instanceof(i,ai)){let n=i;switch(n._hx_index){case 0:t=!1;break;case 1:break;case 2:throw y.thrown(n)}}else throw l}return t}isMap(e){return le.__implements(e,At)}getMapValue(e,t){return le.__cast(e,At).get(t)}setMapValue(e,t,l){le.__cast(e,At).set(t,l)}makeMap(e,t){let l=!0,i=!0,n=!0,s=!0,r=0;for(;r<e.length;){let a=e[r];++r,l=l&&typeof a=="string",i=i&&typeof a=="number"&&(a|0)===a,n=n&&Le.isObject(a),s=s&&Le.isEnumValue(a)}if(i){let a=new Xl,h=0,o=e;for(;h<o.length;){let u=o[h],f=h++,g=u;a.h[g]=t[f]}return a}if(l){let a=new Ce,h=0,o=e;for(;h<o.length;){let u=o[h],f=h++,g=u;a.h[g]=t[f]}return a}if(s){let a=new Pi,h=0,o=e;for(;h<o.length;){let u=o[h],f=h++,g=u;a.set(g,t[f])}return a}if(n){let a=new Ui,h=0,o=e;for(;h<o.length;){let u=o[h],f=h++,g=u;a.set(g,t[f])}return a}return this.errorText(new U("Invalid map keys {keys}",{keys:e})),null}get(e,t){if(e==null){let l=new Ie(Ne.EInvalidAccess(t),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw y.thrown(l)}return e=rt.fieldsOf(e),t=="length"&&se.isArray(e)?se.arrayLength(e):t=="length"&&typeof e=="string"?je.length(e):G.isFields(e)?G.getField(this.interpreter,e,t):Le.getProperty(e,t)}set(e,t,l){if(e==null){let i=new Ie(Ne.EInvalidAccess(t),this.curExpr.pmin,this.curExpr.pmax,this.curExpr.origin,this.curExpr.line);throw y.thrown(i)}return e=rt.fieldsOf(e),G.isFields(e)?(G.setField(this.interpreter,e,t,l),l):(Le.setProperty(e,t,l),l)}fcall(e,t,l){e=rt.fieldsOf(e);let i=null,n=Qe.beatOf(e);return typeof e=="string"?i=G.getStringHelper(this.interpreter,t):se.isArray(e)?i=G.getArrayHelper(this.interpreter,t):n!=null?i=G.getBeatHelper(this.interpreter,t):G.isFields(e)&&(i=G.getMapHelper(this.interpreter,t)),i!=null&&Le.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 Ei.call(e,t,l)}callIsShadowed(){return!!(Object.prototype.hasOwnProperty.call(this.locals.h,"call")||Object.prototype.hasOwnProperty.call(this.variables.h,"call")||G.fieldExists(this.interpreter,this.interpreter.context.topLevelState.fields,"call")||Object.prototype.hasOwnProperty.call(this.interpreter.context.topLevelCharacters.h,"call")||Object.prototype.hasOwnProperty.call(this.interpreter.topLevelFunctions.h,"call")||this.interpreter.resolveBeatByName("call")!=null)}dynamicCall(e){e.length==0&&this.errorText(new U("call() requires a target argument",null));let t=e[0],l=e.slice(1);if(Qe.beatOf(t)!=null&&this.errorText(new U("call() can only call functions. Beats cannot run inside function code.",null)),typeof t=="string"){let i=t;this.interpreter.resolveBeatByName(i)!=null&&this.errorText(new U("call() can only call functions. Beats cannot run inside function code.",null)),Object.prototype.hasOwnProperty.call(this.interpreter.topLevelFunctions.h,i)?t=this.interpreter.topLevelFunctions.h[i]:this.errorText(new U("call() target not found: {name}",{name:i}))}return Le.isFunction(t)||this.errorText(new U("call() target is not a function",null)),this.call(null,t,l)}cnew(e,t){let l=J[e];return l==null&&(l=this.resolve(e)),he.createInstance(l,t)}static __keepIntIterator(){let e=new Gi(0,0);return[Te(e,e.hasNext),Te(e,e.next)]}}J["loreline.lorscript.Interp"]=Pn,Pn.__name__="loreline.lorscript.Interp",Object.assign(Pn.prototype,{__class__:Pn});var ee=it["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)};ee.__constructs__=[ee.TEof,ee.TConst,ee.TId,ee.TOp,ee.TPOpen,ee.TPClose,ee.TBrOpen,ee.TBrClose,ee.TDot,ee.TQuestionDot,ee.TComma,ee.TSemicolon,ee.TBkOpen,ee.TBkClose,ee.TQuestion,ee.TDoubleDot,ee.TMeta,ee.TPrepro];class Bi{constructor(){this.uid=0,this.preprocesorValues=new Ce,this.line=1,this.opChars="+*/-=!><&|^%~",this.identChars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_";let e=[["%"],["*","/"],["+","-"],["<<",">>",">>>"],["|","&","^"],["==","!=",">","<",">=","<="],["..."],["&&"],["||"],["=","+=","-=","*=","/=","%=","<<=",">>=",">>>=","|=","&=","^=","=>"],["->"]];this.opPriority=new Ce,this.opRightAssoc=new Ce;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 y.thrown(new Ie(e,t,l,this.origin,this.line))}invalidChar(e){if(!this.resumeErrors)throw y.thrown(new Ie(Ne.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 an,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[p.cca(this.opChars,r)]=!0}let n=0,s=this.identChars.length;for(;n<s;){let r=n++;this.idents[p.cca(this.identChars,r)]=!0}}parseString(e,t,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==ee.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=Y.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=Ne.EUnexpected(this.tokenString(e));if(!this.resumeErrors)throw y.thrown(new Ie(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();he.enumEq(t,e)||this.unexpected(t)}maybe(e){let t=this.token();return he.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 ie=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,c=t.e;return u?!1:this.isBlock(c);case 9:let f=t.cond,g=t.e1,_=t.e2;return _!=null?this.isBlock(_):this.isBlock(g);case 10:let d=t.cond,m=t.e;return this.isBlock(m);case 11:let k=t.v,C=t.it,T=t.e;return this.isBlock(T);case 14:let S=t.args,v=t.name,I=t.ret,E=t.e;return this.isBlock(E);case 15:let N=t.e;return N!=null?this.isBlock(N):!1;case 20:let K=t.e,V=t.v,B=t.t,O=t.ecatch;return this.isBlock(O);case 21:let q=t.fl;return!0;case 23:let R=t.e,A=t.cases,L=t.defaultExpr;return!0;case 24:let H=t.cond,$=t.e;return this.isBlock($);case 25:let M=t.name,Z=t.args,ae=t.e;return this.isBlock(ae);default:return!1}}parseFullExpr(e){let t=this.parseExpr();e.push(t);let l=this.token();for(;;){let i;if(l==ee.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!=ee.TSemicolon&&l!=ee.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!=ee.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=Y.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=Y.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 I=Y.EIdent(a),E=null,N=null;I==null?h=null:(E==null&&(E=this.tokenMin),N==null&&(N=this.tokenMax),h={e:I,pmin:E,pmax:N,origin:this.origin,line:this.line})}return this.parseExprNext(h);case 3:let o=e.s;if(o=="-"){let I=this.tokenMin,E=this.parseExpr();if(E==null)return this.makeUnop(o,E);let N=E.e;if(N._hx_index==0){let K=N.c;switch(K._hx_index){case 0:let V=K.v,B=Y.EConst(Kl.CInt(-V)),O=I,q=E==null?0:E.pmax;return B==null?null:(O==null&&(O=this.tokenMin),q==null&&(q=this.tokenMax),{e:B,pmin:O,pmax:q,origin:this.origin,line:this.line});case 1:let R=K.f,A=Y.EConst(Kl.CFloat(-R)),L=I,H=E==null?0:E.pmax;return A==null?null:(L==null&&(L=this.tokenMin),H==null&&(H=this.tokenMax),{e:A,pmin:L,pmax:H,origin:this.origin,line:this.line});default:return this.makeUnop(o,E)}}else return this.makeUnop(o,E)}return this.opPriority.h[o]<0?this.makeUnop(o,this.parseExpr()):this.unexpected(e);case 4:if(e=this.token(),e==ee.TPClose){let I=this.token();he.enumEq(I,ee.TOp("->"))||this.unexpected(I);let E=this.parseExpr(),N=Y.EReturn(E),K=t,V=null,B;N==null?B=null:(K==null&&(K=this.tokenMin),V==null&&(V=this.tokenMax),B={e:N,pmin:K,pmax:V,origin:this.origin,line:this.line});let O=Y.EFunction([],B),q=t,R=null;return O==null?null:(q==null&&(q=this.tokenMin),R==null&&(R=this.tokenMax),{e:O,pmin:q,pmax:R,origin:this.origin,line:this.line})}this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;let u=this.parseExpr();switch(e=this.token(),e._hx_index){case 5:let I=Y.EParent(u),E=t,N=this.tokenMax,K;return I==null?K=null:(E==null&&(E=this.tokenMin),N==null&&(N=this.tokenMax),K={e:I,pmin:E,pmax:N,origin:this.origin,line:this.line}),this.parseExprNext(K);case 10:let V=u.e;if(V._hx_index==1){let O=V.v;return this.parseLambda([{name:O}],u==null?0:u.pmin)}break;case 15:let B=this.parseType();switch(e=this.token(),e._hx_index){case 5:let O=Y.ECheckType(u,B),q=t,R=this.tokenMax,A;return O==null?A=null:(q==null&&(q=this.tokenMin),R==null&&(R=this.tokenMax),A={e:O,pmin:q,pmax:R,origin:this.origin,line:this.line}),this.parseExprNext(A);case 10:let L=u.e;if(L._hx_index==1){let H=L.v;return this.parseLambda([{name:H,t:B}],u==null?0:u.pmin)}break;default:}break;default:}return this.unexpected(e);case 6:switch(e=this.token(),e._hx_index){case 1:let I=e.c;if(this.allowJSON)if(I._hx_index==2){let q=I.s,R=this.token();if(this.tokens.push({t:R,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,R._hx_index==15)return this.parseExprNext(this.parseObject(t))}else this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;else this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break;case 2:let E=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 K=Y.EObject([]),V=t,B=null,O;return K==null?O=null:(V==null&&(V=this.tokenMin),B==null&&(B=this.tokenMax),O={e:K,pmin:V,pmax:B,origin:this.origin,line:this.line}),this.parseExprNext(O);default:this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax}let c=[];for(;this.parseFullExpr(c),e=this.token(),!(e==ee.TBrClose||this.resumeErrors&&e==ee.TEof);)this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;let f=Y.EBlock(c),g=t,_=null;return f==null?null:(g==null&&(g=this.tokenMin),_==null&&(_=this.tokenMax),{e:f,pmin:g,pmax:_,origin:this.origin,line:this.line});case 12:let d=[];e=this.token();let m=!0;for(;e!=ee.TBkClose&&(!this.resumeErrors||e!=ee.TEof);)m||(e!=ee.TComma?this.unexpected(e):e=this.token()),m=!1,this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,d.push(this.parseExpr()),e=this.token();if(d.length==1&&d[0]!=null){let I=d[0].e;switch(I._hx_index){case 10:let E=I.cond,N=I.e,K="__a_"+this.uid++,V=Y.EArrayDecl([]),B=t,O=null,q;V==null?q=null:(B==null&&(B=this.tokenMin),O==null&&(O=this.tokenMax),q={e:V,pmin:B,pmax:O,origin:this.origin,line:this.line});let R=Y.EVar(K,null,q),A=t,L=null,H;R==null?H=null:(A==null&&(A=this.tokenMin),L==null&&(L=this.tokenMax),H={e:R,pmin:A,pmax:L,origin:this.origin,line:this.line});let $=this.mapCompr(K,d[0]),M=Y.EIdent(K),Z=t,ae=null,ie;M==null?ie=null:(Z==null&&(Z=this.tokenMin),ae==null&&(ae=this.tokenMax),ie={e:M,pmin:Z,pmax:ae,origin:this.origin,line:this.line});let ue=Y.EBlock([H,$,ie]),de=t,ye=null,ce;return ue==null?ce=null:(de==null&&(de=this.tokenMin),ye==null&&(ye=this.tokenMax),ce={e:ue,pmin:de,pmax:ye,origin:this.origin,line:this.line}),this.parseExprNext(ce);case 11:let pe=I.v,Je=I.it,tt=I.e,Ge="__a_"+this.uid++,ht=Y.EArrayDecl([]),Ze=t,$e=null,xt;ht==null?xt=null:(Ze==null&&(Ze=this.tokenMin),$e==null&&($e=this.tokenMax),xt={e:ht,pmin:Ze,pmax:$e,origin:this.origin,line:this.line});let Ke=Y.EVar(Ge,null,xt),at=t,fe=null,j;Ke==null?j=null:(at==null&&(at=this.tokenMin),fe==null&&(fe=this.tokenMax),j={e:Ke,pmin:at,pmax:fe,origin:this.origin,line:this.line});let re=this.mapCompr(Ge,d[0]),te=Y.EIdent(Ge),ne=t,xe=null,we;te==null?we=null:(ne==null&&(ne=this.tokenMin),xe==null&&(xe=this.tokenMax),we={e:te,pmin:ne,pmax:xe,origin:this.origin,line:this.line});let Se=Y.EBlock([j,re,we]),ot=t,Lt=null,Re;return Se==null?Re=null:(ot==null&&(ot=this.tokenMin),Lt==null&&(Lt=this.tokenMax),Re={e:Se,pmin:ot,pmax:Lt,origin:this.origin,line:this.line}),this.parseExprNext(Re);case 24:let Pt=I.cond,Fe=I.e,Me="__a_"+this.uid++,bt=Y.EArrayDecl([]),pt=t,Wt=null,gl;bt==null?gl=null:(pt==null&&(pt=this.tokenMin),Wt==null&&(Wt=this.tokenMax),gl={e:bt,pmin:pt,pmax:Wt,origin:this.origin,line:this.line});let It=Y.EVar(Me,null,gl),Ol=t,lt=null,ll;It==null?ll=null:(Ol==null&&(Ol=this.tokenMin),lt==null&&(lt=this.tokenMax),ll={e:It,pmin:Ol,pmax:lt,origin:this.origin,line:this.line});let Gt=this.mapCompr(Me,d[0]),il=Y.EIdent(Me),Nt=t,al=null,_l;il==null?_l=null:(Nt==null&&(Nt=this.tokenMin),al==null&&(al=this.tokenMax),_l={e:il,pmin:Nt,pmax:al,origin:this.origin,line:this.line});let hl=Y.EBlock([ll,Gt,_l]),Pl=t,Il=null,dl;return hl==null?dl=null:(Pl==null&&(Pl=this.tokenMin),Il==null&&(Il=this.tokenMax),dl={e:hl,pmin:Pl,pmax:Il,origin:this.origin,line:this.line}),this.parseExprNext(dl);default:}}let k=Y.EArrayDecl(d),C=t,T=null,S;return k==null?S=null:(C==null&&(C=this.tokenMin),T==null&&(T=this.tokenMax),S={e:k,pmin:C,pmax:T,origin:this.origin,line:this.line}),this.parseExprNext(S);case 16:let v=e.s;if(this.allowMetadata){let I=this.parseMetaArgs(),E=Y.EMeta(v,I,this.parseExpr()),N=t,K=null;return E==null?null:(N==null&&(N=this.tokenMin),K==null&&(K=this.tokenMax),{e:E,pmin:N,pmax:K,origin:this.origin,line:this.line})}else return this.unexpected(e);break;default:return this.unexpected(e)}}parseLambda(e,t){e:for(;;){let c=this.getIdent(),f=this.maybe(ee.TDoubleDot)?this.parseType():null;e.push({name:c,t:f});let g=this.token();switch(g._hx_index){case 5:break e;case 10:break;default:this.unexpected(g);break e}}let l=this.token();he.enumEq(l,ee.TOp("->"))||this.unexpected(l);let i=this.parseExpr(),n=Y.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=Y.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!=ee.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!=ee.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=Y.EParent(this.mapCompr(e,r));break;case 4:let a=i.e;if(a.length==1){let V=a[0];l=Y.EBlock([this.mapCompr(e,V)])}else{let V=Y.EIdent(e),B=t==null?0:t.pmin,O=t==null?0:t.pmax,q;V==null?q=null:(B==null&&(B=this.tokenMin),O==null&&(O=this.tokenMax),q={e:V,pmin:B,pmax:O,origin:this.origin,line:this.line});let R=Y.EField(q,"push"),A=t==null?0:t.pmin,L=t==null?0:t.pmax,H;R==null?H=null:(A==null&&(A=this.tokenMin),L==null&&(L=this.tokenMax),H={e:R,pmin:A,pmax:L,origin:this.origin,line:this.line}),l=Y.ECall(H,[t])}break;case 9:let h=i.cond,o=i.e1;if(i.e2==null)l=Y.EIf(h,this.mapCompr(e,o),null);else{let V=Y.EIdent(e),B=t==null?0:t.pmin,O=t==null?0:t.pmax,q;V==null?q=null:(B==null&&(B=this.tokenMin),O==null&&(O=this.tokenMax),q={e:V,pmin:B,pmax:O,origin:this.origin,line:this.line});let R=Y.EField(q,"push"),A=t==null?0:t.pmin,L=t==null?0:t.pmax,H;R==null?H=null:(A==null&&(A=this.tokenMin),L==null&&(L=this.tokenMax),H={e:R,pmin:A,pmax:L,origin:this.origin,line:this.line}),l=Y.ECall(H,[t])}break;case 10:let c=i.cond,f=i.e;l=Y.EWhile(c,this.mapCompr(e,f));break;case 11:let g=i.v,_=i.it,d=i.e;l=Y.EFor(g,_,this.mapCompr(e,d));break;case 24:let m=i.cond,k=i.e;l=Y.EDoWhile(m,this.mapCompr(e,k));break;default:let C=Y.EIdent(e),T=t==null?0:t.pmin,S=t==null?0:t.pmax,v;C==null?v=null:(T==null&&(T=this.tokenMin),S==null&&(S=this.tokenMax),v={e:C,pmin:T,pmax:S,origin:this.origin,line:this.line});let I=Y.EField(v,"push"),E=t==null?0:t.pmin,N=t==null?0:t.pmax,K;I==null?K=null:(E==null&&(E=this.tokenMin),N==null&&(N=this.tokenMax),K={e:I,pmin:E,pmax:N,origin:this.origin,line:this.line}),l=Y.ECall(K,[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=Y.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,c=l.e2,f=Y.ETernary(this.makeUnop(e,o),u,c),g=o==null?0:o.pmin,_=c==null?0:c.pmax;return f==null?null:(g==null&&(g=this.tokenMin),_==null&&(_=this.tokenMax),{e:f,pmin:g,pmax:_,origin:this.origin,line:this.line});default:let d=Y.EUnop(e,!0,t),m=t==null?0:t.pmin,k=t==null?0:t.pmax;return d==null?null:(m==null&&(m=this.tokenMin),k==null&&(k=this.tokenMax),{e:d,pmin:m,pmax:k,origin:this.origin,line:this.line})}}makeBinop(e,t,l){if(l==null&&this.resumeErrors){let n=Y.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 g=Y.EBinop(n,this.makeBinop(e,t,s),r),_=t==null?0:t.pmin,d=r==null?0:r.pmax;return g==null?null:(_==null&&(_=this.tokenMin),d==null&&(d=this.tokenMax),{e:g,pmin:_,pmax:d,origin:this.origin,line:this.line})}else{let g=Y.EBinop(e,t,l),_=t==null?0:t.pmin,d=l==null?0:l.pmax;return g==null?null:(_==null&&(_=this.tokenMin),d==null&&(d=this.tokenMax),{e:g,pmin:_,pmax:d,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 g=Y.EBinop(e,t,l),_=t==null?0:t.pmin,d=l==null?0:l.pmax;return g==null?null:(_==null&&(_=this.tokenMin),d==null&&(d=this.tokenMax),{e:g,pmin:_,pmax:d,origin:this.origin,line:this.line})}else{let g=Y.ETernary(this.makeBinop(e,t,a),h,o),_=t==null?0:t.pmin,d=l==null?0:l.pmax;return g==null?null:(_==null&&(_=this.tokenMin),d==null&&(d=this.tokenMax),{e:g,pmin:_,pmax:d,origin:this.origin,line:this.line})}break;default:let u=Y.EBinop(e,t,l),c=t==null?0:t.pmin,f=l==null?0:l.pmax;return u==null?null:(c==null&&(c=this.tokenMin),f==null&&(f=this.tokenMax),{e:u,pmin:c,pmax:f,origin:this.origin,line:this.line})}}parseStructure(e){let t=this.tokenMin;switch(e){case"break":let l=Y.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=Y.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(),c=Y.EDoWhile(u,h),f=t,g=u==null?0:u.pmax;return c==null?null:(f==null&&(f=this.tokenMin),g==null&&(g=this.tokenMax),{e:c,pmin:f,pmax:g,origin:this.origin,line:this.line});case"else":return this.unexpected(ee.TId(e));case"for":let _=this.token();_!=ee.TPOpen&&this.unexpected(_);let d=this.getIdent(),m=this.token();he.enumEq(m,ee.TId("in"))||this.unexpected(m);let k=this.parseExpr(),C=this.token();C!=ee.TPClose&&this.unexpected(C);let T=this.parseExpr(),S=Y.EFor(d,k,T),v=t,I=T==null?0:T.pmax;return S==null?null:(v==null&&(v=this.tokenMin),I==null&&(I=this.tokenMax),{e:S,pmin:v,pmax:I,origin:this.origin,line:this.line});case"function":let E=this.token(),N=null;E._hx_index==2?N=E.s:(this.tokens.push({t:E,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax);let K=this.parseFunctionDecl(),V=Y.EFunction(K.args,K.body,N,K.ret),B=t,O=K.body,q=O==null?0:O.pmax;return V==null?null:(B==null&&(B=this.tokenMin),q==null&&(q=this.tokenMax),{e:V,pmin:B,pmax:q,origin:this.origin,line:this.line});case"if":let R=this.token();R!=ee.TPOpen&&this.unexpected(R);let A=this.parseExpr(),L=this.token();L!=ee.TPClose&&this.unexpected(L);let H=this.parseExpr(),$=null,M=!1,Z=this.token();Z==ee.TSemicolon&&(M=!0,Z=this.token()),he.enumEq(Z,ee.TId("else"))?$=this.parseExpr():(this.tokens.push({t:Z,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,M&&(this.tokens.push({t:ee.TSemicolon,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax));let ae=Y.EIf(A,H,$),ie=t,ue=$==null?this.tokenMax:$==null?0:$.pmax;return ae==null?null:(ie==null&&(ie=this.tokenMin),ue==null&&(ue=this.tokenMax),{e:ae,pmin:ie,pmax:ue,origin:this.origin,line:this.line});case"inline":return this.maybe(ee.TId("function"))||this.unexpected(ee.TId("inline")),this.parseStructure("function");case"new":let de=[];de.push(this.getIdent());e:for(;;){let ft=this.token();switch(ft._hx_index){case 4:break e;case 8:de.push(this.getIdent());break;default:this.unexpected(ft);break e}}let ye=this.parseExprList(ee.TPClose),ce=Y.ENew(de.join("."),ye),pe=t,Je=null;return ce==null?null:(pe==null&&(pe=this.tokenMin),Je==null&&(Je=this.tokenMax),{e:ce,pmin:pe,pmax:Je,origin:this.origin,line:this.line});case"return":let tt=this.token();this.tokens.push({t:tt,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;let Ge=tt==ee.TSemicolon?null:this.parseExpr(),ht=Y.EReturn(Ge),Ze=t,$e=Ge==null?this.tokenMax:Ge==null?0:Ge.pmax;return ht==null?null:(Ze==null&&(Ze=this.tokenMin),$e==null&&($e=this.tokenMax),{e:ht,pmin:Ze,pmax:$e,origin:this.origin,line:this.line});case"switch":let xt=this.parseExpr(),Ke=null,at=[],fe=this.token();fe!=ee.TBrOpen&&this.unexpected(fe);e:for(;;){let ft=this.token();switch(ft._hx_index){case 2:switch(ft.s){case"case":let Ql={values:[],expr:null};at.push(Ql);t:for(;;){let St=this.parseExpr();switch(Ql.values.push(St),ft=this.token(),ft._hx_index){case 10:break;case 15:break t;default:this.unexpected(ft);break t}}let Pe=[];t:for(;;)switch(ft=this.token(),this.tokens.push({t:ft,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,ft._hx_index){case 0:if(this.resumeErrors)break t;this.parseFullExpr(Pe);break;case 2:switch(ft.s){case"case":case"default":break t;default:this.parseFullExpr(Pe)}break;case 7:break t;default:this.parseFullExpr(Pe)}let gt;if(Pe.length==1)gt=Pe[0];else if(Pe.length==0){let St=Y.EBlock([]),nl=this.tokenMin,jt=this.tokenMin;St==null?gt=null:(nl==null&&(nl=this.tokenMin),jt==null&&(jt=this.tokenMax),gt={e:St,pmin:nl,pmax:jt,origin:this.origin,line:this.line})}else{let St=Y.EBlock(Pe),nl=Pe[0],jt=nl==null?0:nl.pmin,ml=Pe[Pe.length-1],Mt=ml==null?0:ml.pmax;St==null?gt=null:(jt==null&&(jt=this.tokenMin),Mt==null&&(Mt=this.tokenMax),gt={e:St,pmin:jt,pmax:Mt,origin:this.origin,line:this.line})}Ql.expr=gt;break;case"default":Ke!=null&&this.unexpected(ft);let Tt=this.token();Tt!=ee.TDoubleDot&&this.unexpected(Tt);let wt=[];t:for(;;)switch(ft=this.token(),this.tokens.push({t:ft,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,ft._hx_index){case 0:if(this.resumeErrors)break t;this.parseFullExpr(wt);break;case 2:switch(ft.s){case"case":case"default":break t;default:this.parseFullExpr(wt)}break;case 7:break t;default:this.parseFullExpr(wt)}if(wt.length==1)Ke=wt[0];else if(wt.length==0){let St=Y.EBlock([]),nl=this.tokenMin,jt=this.tokenMin;St==null?Ke=null:(nl==null&&(nl=this.tokenMin),jt==null&&(jt=this.tokenMax),Ke={e:St,pmin:nl,pmax:jt,origin:this.origin,line:this.line})}else{let St=Y.EBlock(wt),nl=wt[0],jt=nl==null?0:nl.pmin,ml=wt[wt.length-1],Mt=ml==null?0:ml.pmax;St==null?Ke=null:(jt==null&&(jt=this.tokenMin),Mt==null&&(Mt=this.tokenMax),Ke={e:St,pmin:jt,pmax:Mt,origin:this.origin,line:this.line})}break;default:this.unexpected(ft);break e}break;case 7:break e;default:this.unexpected(ft);break e}}let j=Y.ESwitch(xt,at,Ke),re=t,te=this.tokenMax;return j==null?null:(re==null&&(re=this.tokenMin),te==null&&(te=this.tokenMax),{e:j,pmin:re,pmax:te,origin:this.origin,line:this.line});case"throw":let ne=this.parseExpr(),xe=Y.EThrow(ne),we=t,Se=ne==null?0:ne.pmax;return xe==null?null:(we==null&&(we=this.tokenMin),Se==null&&(Se=this.tokenMax),{e:xe,pmin:we,pmax:Se,origin:this.origin,line:this.line});case"try":let ot=this.parseExpr(),Lt=this.token();he.enumEq(Lt,ee.TId("catch"))||this.unexpected(Lt);let Re=this.token();Re!=ee.TPOpen&&this.unexpected(Re);let Pt=this.getIdent(),Fe=this.token();Fe!=ee.TDoubleDot&&this.unexpected(Fe);let Me=null;if(this.allowTypes)Me=this.parseType();else{let ft=this.token();he.enumEq(ft,ee.TId("Dynamic"))||this.unexpected(ft)}let bt=this.token();bt!=ee.TPClose&&this.unexpected(bt);let pt=this.parseExpr(),Wt=Y.ETry(ot,Pt,Me,pt),gl=t,It=pt==null?0:pt.pmax;return Wt==null?null:(gl==null&&(gl=this.tokenMin),It==null&&(It=this.tokenMax),{e:Wt,pmin:gl,pmax:It,origin:this.origin,line:this.line});case"var":let Ol=this.getIdent(),lt=this.token(),ll=null;lt==ee.TDoubleDot&&this.allowTypes&&(ll=this.parseType(),lt=this.token());let Gt=null;switch(lt._hx_index){case 3:lt.s=="="?Gt=this.parseExpr():this.unexpected(lt);break;case 10:case 11:this.tokens.push({t:lt,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break;default:ll!=null?(this.tokens.push({t:lt,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax):this.unexpected(lt)}let il=Y.EVar(Ol,ll,Gt),Nt=t,al=Gt==null?this.tokenMax:Gt==null?0:Gt.pmax;return il==null?null:(Nt==null&&(Nt=this.tokenMin),al==null&&(al=this.tokenMax),{e:il,pmin:Nt,pmax:al,origin:this.origin,line:this.line});case"while":let _l=this.parseExpr(),hl=this.parseExpr(),Pl=Y.EWhile(_l,hl),Il=t,dl=hl==null?0:hl.pmax;return Pl==null?null:(Il==null&&(Il=this.tokenMin),dl==null&&(dl=this.tokenMax),{e:Pl,pmin:Il,pmax:dl,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 Re=e.e;switch(Re._hx_index){case 1:let Pt=Re.v,Fe=this.parseExpr(),Me=Y.EReturn(Fe),bt=Fe==null?0:Fe.pmin,pt=null,Wt;Me==null?Wt=null:(bt==null&&(bt=this.tokenMin),pt==null&&(pt=this.tokenMax),Wt={e:Me,pmin:bt,pmax:pt,origin:this.origin,line:this.line});let gl=Y.EFunction([{name:Pt}],Wt),It=e==null?0:e.pmin,Ol=null;return gl==null?null:(It==null&&(It=this.tokenMin),Ol==null&&(Ol=this.tokenMax),{e:gl,pmin:It,pmax:Ol,origin:this.origin,line:this.line});case 3:let lt=Re.e.e;if(lt._hx_index==1){let Gt=lt.v,il=this.parseExpr(),Nt=Y.EReturn(il),al=il==null?0:il.pmin,_l=null,hl;Nt==null?hl=null:(al==null&&(al=this.tokenMin),_l==null&&(_l=this.tokenMax),hl={e:Nt,pmin:al,pmax:_l,origin:this.origin,line:this.line});let Pl=Y.EFunction([{name:Gt}],hl),Il=e==null?0:e.pmin,dl=null;return Pl==null?null:(Il==null&&(Il=this.tokenMin),dl==null&&(dl=this.tokenMax),{e:Pl,pmin:Il,pmax:dl,origin:this.origin,line:this.line})}break;case 26:let ll=Re.e.e;if(ll._hx_index==1){let Gt=ll.v,il=Re.t,Nt=this.parseExpr(),al=Y.EReturn(Nt),_l=Nt==null?0:Nt.pmin,hl=null,Pl;al==null?Pl=null:(_l==null&&(_l=this.tokenMin),hl==null&&(hl=this.tokenMax),Pl={e:al,pmin:_l,pmax:hl,origin:this.origin,line:this.line});let Il=Y.EFunction([{name:Gt,t:il}],Pl),dl=e==null?0:e.pmin,ft=null;return Il==null?null:(dl==null&&(dl=this.tokenMin),ft==null&&(ft=this.tokenMax),{e:Il,pmin:dl,pmax:ft,origin:this.origin,line:this.line})}break;default:}this.unexpected(t)}if(this.opPriority.h[i]==-1){let Re;if(this.isBlock(e))Re=!0;else{let pt=e.e;if(pt._hx_index==3){let Wt=pt.e;Re=!0}else Re=!1}if(Re)return this.tokens.push({t,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax,e;let Pt=Y.EUnop(i,!1,e),Fe=e==null?0:e.pmin,Me=null,bt;return Pt==null?bt=null:(Fe==null&&(Fe=this.tokenMin),Me==null&&(Me=this.tokenMax),bt={e:Pt,pmin:Fe,pmax:Me,origin:this.origin,line:this.line}),this.parseExprNext(bt)}return this.makeBinop(i,e,this.parseExpr());case 4:let n=Y.ECall(e,this.parseExprList(ee.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=Y.EField(e,h),u=e==null?0:e.pmin,c=null,f;return o==null?f=null:(u==null&&(u=this.tokenMin),c==null&&(c=this.tokenMax),f={e:o,pmin:u,pmax:c,origin:this.origin,line:this.line}),this.parseExprNext(f);case 9:let g=this.getIdent(),_="__a_"+this.uid++,d=Y.EVar(_,null,e),m=e==null?0:e.pmin,k=e==null?0:e.pmax,C;d==null?C=null:(m==null&&(m=this.tokenMin),k==null&&(k=this.tokenMax),C={e:d,pmin:m,pmax:k,origin:this.origin,line:this.line});let T=Y.EIdent(_),S=e==null?0:e.pmin,v=e==null?0:e.pmax,I;T==null?I=null:(S==null&&(S=this.tokenMin),v==null&&(v=this.tokenMax),I={e:T,pmin:S,pmax:v,origin:this.origin,line:this.line});let E=Y.EIdent("null"),N=e==null?0:e.pmin,K=e==null?0:e.pmax,V;E==null?V=null:(N==null&&(N=this.tokenMin),K==null&&(K=this.tokenMax),V={e:E,pmin:N,pmax:K,origin:this.origin,line:this.line});let B=Y.EBinop("==",I,V),O=null,q=null,R;B==null?R=null:(O==null&&(O=this.tokenMin),q==null&&(q=this.tokenMax),R={e:B,pmin:O,pmax:q,origin:this.origin,line:this.line});let A=Y.EIdent("null"),L=e==null?0:e.pmin,H=e==null?0:e.pmax,$;A==null?$=null:(L==null&&(L=this.tokenMin),H==null&&(H=this.tokenMax),$={e:A,pmin:L,pmax:H,origin:this.origin,line:this.line});let M=Y.EIdent(_),Z=e==null?0:e.pmin,ae=e==null?0:e.pmax,ie;M==null?ie=null:(Z==null&&(Z=this.tokenMin),ae==null&&(ae=this.tokenMax),ie={e:M,pmin:Z,pmax:ae,origin:this.origin,line:this.line});let ue=Y.EField(ie,g),de=e==null?0:e.pmin,ye=null,ce;ue==null?ce=null:(de==null&&(de=this.tokenMin),ye==null&&(ye=this.tokenMax),ce={e:ue,pmin:de,pmax:ye,origin:this.origin,line:this.line});let pe=Y.ETernary(R,$,ce),Je=null,tt=null,Ge;pe==null?Ge=null:(Je==null&&(Je=this.tokenMin),tt==null&&(tt=this.tokenMax),Ge={e:pe,pmin:Je,pmax:tt,origin:this.origin,line:this.line});let ht=Y.EBlock([C,Ge]),Ze=e==null?0:e.pmin,$e=null,xt;return ht==null?xt=null:(Ze==null&&(Ze=this.tokenMin),$e==null&&($e=this.tokenMax),xt={e:ht,pmin:Ze,pmax:$e,origin:this.origin,line:this.line}),this.parseExprNext(xt);case 12:let Ke=this.parseExpr(),at=this.token();at!=ee.TBkClose&&this.unexpected(at);let fe=Y.EArray(e,Ke),j=e==null?0:e.pmin,re=null,te;return fe==null?te=null:(j==null&&(j=this.tokenMin),re==null&&(re=this.tokenMax),te={e:fe,pmin:j,pmax:re,origin:this.origin,line:this.line}),this.parseExprNext(te);case 14:let ne=this.parseExpr(),xe=this.token();xe!=ee.TDoubleDot&&this.unexpected(xe);let we=this.parseExpr(),Se=Y.ETernary(e,ne,we),ot=e==null?0:e.pmin,Lt=we==null?0:we.pmax;return Se==null?null:(ot==null&&(ot=this.tokenMin),Lt==null&&(Lt=this.tokenMax),{e:Se,pmin:ot,pmax:Lt,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!=ee.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(ee.TDoubleDot)&&(s.t=this.parseType()),this.maybe(ee.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!=ee.TPOpen&&this.unexpected(e);let t=this.parseFunctionArgs(),l=null;if(this.allowTypes){let i=this.token();i!=ee.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!=ee.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 c=e.s;if(c==">")break e;if(p.cca(c,0)==62){this.tokens.add({t:ee.TOp(p.substr(c,1,null)),min:this.tokenMax-c.length-1,max:this.tokenMax});break e}break;case 10:continue;default:}this.unexpected(e);break}}else this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;else this.tokens.push({t:e,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;return this.parseTypeNext(Cl.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 c=t.token();if(c._hx_index==3){if(c.s!="->"){let f=c;t.unexpected(f)}}else{let f=c;t.unexpected(f)}return Cl.CTFun(u,t.parseType())};switch(s._hx_index){case 2:let u=s.s;if(r._hx_index==15){let k=[],C=0,T=this.parseFunctionArgs();for(;C<T.length;){let v=T[C];++C;let I=v.value;if(I!=null){let E=I;if(!this.resumeErrors)throw y.thrown(new Ie(Ne.ECustom("Default values not allowed in function types"),E.pmin,E.pmax,this.origin,this.line))}k.push(Cl.CTNamed(v.name,v.opt?Cl.CTOpt(v.t):v.t))}return a(k)}else{let k=this.parseType(),C=this.token();switch(C._hx_index){case 5:return this.parseTypeNext(Cl.CTParent(k));case 10:let T=[k];do T.push(this.parseType());while(this.maybe(ee.TComma));let S=this.token();return S!=ee.TPClose&&this.unexpected(S),a(T);default:let v=C;return this.unexpected(v)}}break;case 5:let c=[],f=0,g=this.parseFunctionArgs();for(;f<g.length;){let k=g[f];++f;let C=k.value;if(C!=null){let T=C;if(!this.resumeErrors)throw y.thrown(new Ie(Ne.ECustom("Default values not allowed in function types"),T.pmin,T.pmax,this.origin,this.line))}c.push(Cl.CTNamed(k.name,k.opt?Cl.CTOpt(k.t):k.t))}return a(c);default:let d=this.parseType(),m=this.token();switch(m._hx_index){case 5:return this.parseTypeNext(Cl.CTParent(d));case 10:let k=[d];do k.push(this.parseType());while(this.maybe(ee.TComma));let C=this.token();return C!=ee.TPClose&&this.unexpected(C),a(k);default:let T=m;return this.unexpected(T)}}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(),g=this.token();g!=ee.TDoubleDot&&this.unexpected(g),h.push({name:f,t:this.parseType(),meta:o}),o=null;let _=this.token();_!=ee.TSemicolon&&this.unexpected(_)}else{let f=u,g=this.token();switch(g!=ee.TDoubleDot&&this.unexpected(g),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 c=e.s;o==null&&(o=[]),o.push({name:c,params:this.parseMetaArgs()});break;default:this.unexpected(e);break e}return this.parseTypeNext(Cl.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 Cl.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==ee.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(ee.TOp("<"))&&!this.resumeErrors)throw y.thrown(new Ie(Ne.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 T=this.token();if(T._hx_index==2)switch(T.s){case"extends":r=this.parseType();break;case"implements":a.push(this.parseType());break;default:this.tokens.push({t:T,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break e}else{this.tokens.push({t:T,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break}}let h=[],o=this.token();for(o!=ee.TBrOpen&&this.unexpected(o);!this.maybe(ee.TBrClose);)h.push(this.parseField());return vi.DClass({name:n,meta:e,params:s,extend:r,implement:a,fields:h,isPrivate:l,isExtern:i});case"import":let u=[this.getIdent()],c=!1;for(;;){let T=this.token();if(T!=ee.TDot){this.tokens.push({t:T,min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;break}switch(T=this.token(),T._hx_index){case 2:let S=T.s;u.push(S);break;case 3:T.s=="*"?c=!0:this.unexpected(T);break;default:this.unexpected(T)}}let f=this.token();return f!=ee.TSemicolon&&this.unexpected(f),vi.DImport(u,c);case"package":let g=this.parsePath(),_=this.token();return _!=ee.TSemicolon&&this.unexpected(_),vi.DPackage(g);case"typedef":let d=this.getIdent(),m=this.parseParams(),k=this.token();he.enumEq(k,ee.TOp("="))||this.unexpected(k);let C=this.parseType();return vi.DTypedef({name:d,meta:e,params:m,isPrivate:l,t:C});default:this.unexpected(ee.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:On.KFunction({args:n.args,expr:n.body,ret:n.ret})};case"inline":t.push(ri.AInline);break;case"macro":t.push(ri.AMacro);break;case"override":t.push(ri.AOverride);break;case"private":t.push(ri.APrivate);break;case"public":t.push(ri.APublic);break;case"static":t.push(ri.AStatic);break;case"var":let s=this.getIdent(),r=null,a=null;if(this.maybe(ee.TPOpen)){r=this.getIdent();let u=this.token();u!=ee.TComma&&this.unexpected(u),a=this.getIdent();let c=this.token();c!=ee.TPClose&&this.unexpected(c)}let h=this.maybe(ee.TDoubleDot)?this.parseType():null,o=this.maybe(ee.TOp("="))?this.parseExpr():null;if(o!=null)if(this.isBlock(o))this.maybe(ee.TSemicolon);else{let u=this.token();u!=ee.TSemicolon&&this.unexpected(u)}else{let u;if(h!=null)if(h==null)u=!1;else if(h._hx_index==2){let c=h.fields;u=!0}else u=!1;else u=!1;if(u)this.maybe(ee.TSemicolon);else{let c=this.token();c!=ee.TSemicolon&&this.unexpected(c)}}return{name:s,meta:e,access:t,kind:On.KVar({get:r,set:a,type:h,expr:o})};default:this.unexpected(ee.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 y.thrown(new Ie(Ne.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 c=this.input.charCodeAt(this.readPos++);switch(c){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:h+=c-48;break;case 65:case 66:case 67:case 68:case 69:case 70:h+=c-55;break;case 97:case 98:case 99:case 100:case 101:case 102:h+=c-87;break;default:if(c!=c&&(this.line=n,!this.resumeErrors))throw y.thrown(new Ie(Ne.EUnterminatedString,r,r,this.origin,this.line));this.invalidChar(c)}}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,ee.TEof;switch(e){case 0:return ee.TEof;case 10:this.line++,this.tokenMin++;break;case 9:case 13:case 32:this.tokenMin++;break;case 34:case 39:return ee.TConst(Kl.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 ee.TPOpen;case 41:return ee.TPClose;case 44:return ee.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),ee.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,ee.TConst(Kl.CFloat(i/n))}break;default:return this.char=e,ee.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:ee.TOp("..."),min:this.tokenMin,max:this.tokenMax}),this.tokenMin=this.oldTokenMin,this.tokenMax=this.oldTokenMax;let a=t|0;return ee.TConst(a==t?Kl.CInt(a):Kl.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),ee.TConst(Kl.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,ee.TConst(Kl.CInt(s))}break;default:this.char=e;let r=t|0;return ee.TConst(l>0?Kl.CFloat(t*10/l):r==t?Kl.CInt(r):Kl.CFloat(t))}break;case 58:return ee.TDoubleDot;case 59:return ee.TSemicolon;case 61:return e=this.input.charCodeAt(this.readPos++),e==61?ee.TOp("=="):e==62?ee.TOp("=>"):(this.char=e,ee.TOp("="));case 63:return e=this.input.charCodeAt(this.readPos++),e==46?ee.TQuestionDot:(this.char=e,ee.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,ee.TMeta(i);i+=String.fromCodePoint(e)}}this.invalidChar(e);break;case 91:return ee.TBkOpen;case 93:return ee.TBkClose;case 123:return ee.TBrOpen;case 125:return ee.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,ee.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,ee.TOp(n))}}if(this.idents[e]||e>=128){let i=this.readPos-1;for(;;)if(e=this.input.charCodeAt(this.readPos++),e!=e&&(e=0),!this.idents[e]&&e<128)return this.char=e,ee.TId(p.substr(this.input,i,this.readPos-1-i))}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=Y.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=Y.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:ee.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,c=s;return this.evalPreproCond(u)?!0:this.evalPreproCond(c);default:let f=e.e;if(!this.resumeErrors)throw y.thrown(new Ie(Ne.EInvalidPreprocessor("Can't eval "+it[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 y.thrown(new Ie(Ne.EInvalidPreprocessor("Can't eval "+it[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 y.thrown(new Ie(Ne.EInvalidPreprocessor("Can't eval "+it[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")):ee.TPrepro(e);case"end":return this.preprocStack.length>0?(this.preprocStack.pop(),this.token()):ee.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 ee.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==ee.TEof&&!this.resumeErrors)throw y.thrown(new Ie(Ne.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=p.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 y.thrown(new Ie(Ne.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 y.thrown(new Ie(Ne.EUnterminatedComment,this.tokenMin,this.tokenMin,this.origin,this.line));break}}while(t!=47);return this.token()}return this.char=t,ee.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"]=Bi,Bi.__name__="loreline.lorscript.Parser",Object.assign(Bi.prototype,{__class__:Bi,__properties__:{get_currentPos:"get_currentPos"}});class Li{constructor(){}exprToString(e){return this.buf=new Et,this.tabs="",this.expr(e),this.buf.b}typeToString(e){return this.buf=new Et,this.tabs="",this.type(e),this.buf.b}add(e){this.buf.b+=oe.string(e)}type(e){switch(e._hx_index){case 0:let t=e.path,l=e.params,i=t.join(".");if(this.buf.b+=oe.string(i),l!=null){this.buf.b+="<";let d=!0,m=0;for(;m<l.length;){let k=l[m];++m,d?d=!1:this.buf.b+=", ",this.type(k)}this.buf.b+=">"}break;case 1:let n=e.args,s=e.ret,r=n,a=s;if(An.exists(r,function(d){if(d._hx_index==5){let m=d.n,k=d.t;return!0}else return!1})){this.buf.b+="(";let d=0;for(;d<r.length;){let m=r[d];if(++d,m._hx_index==5){let k=m.n,C=m.t;this.type(m)}else this.type(Cl.CTNamed("_",m))}this.buf.b+=")->",this.type(a)}else{let d=n,m=s;if(d.length==0)this.buf.b+="Void -> ";else{let k=0;for(;k<d.length;){let C=d[k];++k,this.type(C),this.buf.b+=" -> "}}this.type(m)}break;case 2:let h=e.fields;this.buf.b+="{";let o=!0,u=0;for(;u<h.length;){let d=h[u];++u,o?(o=!1,this.buf.b+=" "):this.buf.b+=", ",this.buf.b+=oe.string(d.name+" : "),this.type(d.t)}this.buf.b+=o?"}":" }";break;case 3:let c=e.t;this.buf.b+="(",this.type(c),this.buf.b+=")";break;case 4:let f=e.t;this.buf.b+="?",this.type(f);break;case 5:let g=e.n,_=e.t;this.buf.b+=g==null?"null":""+g,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 Fe=l.v;this.buf.b+=Fe==null?"null":""+Fe;break;case 1:let Me=l.f;this.buf.b+=Me==null?"null":""+Me;break;case 2:let bt=l.s;this.buf.b+='"';let pt=bt.split('"').join('\\"').split(`
46
+ `).join("\\n").split("\r").join("\\r").split(" ").join("\\t");this.buf.b+=oe.string(pt),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+=oe.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+=`{
47
+ `;let Fe=0;for(;Fe<h.length;){let Me=h[Fe];++Fe,this.buf.b+=oe.string(this.tabs),this.expr(Me),this.buf.b+=`;
48
+ `}this.tabs=p.substr(this.tabs,1,null),this.buf.b+="}"}break;case 5:let o=t.e,u=t.f;this.expr(o),this.buf.b+=oe.string("."+u);break;case 6:let c=t.op,f=t.e1,g=t.e2;this.expr(f),this.buf.b+=oe.string(" "+c+" "),this.expr(g);break;case 7:let _=t.op,d=t.prefix,m=t.e;d?(this.buf.b+=_==null?"null":""+_,this.expr(m)):(this.expr(m),this.buf.b+=_==null?"null":""+_);break;case 8:let k=t.e,C=t.params;if(k==null)this.expr(k);else{let Fe=k.e;switch(Fe._hx_index){case 0:let Me=Fe.c;this.expr(k);break;case 1:let bt=Fe.v;this.expr(k);break;case 5:let pt=Fe.e,Wt=Fe.f;this.expr(k);break;default:this.buf.b+="(",this.expr(k),this.buf.b+=")"}}this.buf.b+="(";let T=!0,S=0;for(;S<C.length;){let Fe=C[S];++S,T?T=!1:this.buf.b+=", ",this.expr(Fe)}this.buf.b+=")";break;case 9:let v=t.cond,I=t.e1,E=t.e2;this.buf.b+="if( ",this.expr(v),this.buf.b+=" ) ",this.expr(I),E!=null&&(this.buf.b+=" else ",this.expr(E));break;case 10:let N=t.cond,K=t.e;this.buf.b+="while( ",this.expr(N),this.buf.b+=" ) ",this.expr(K);break;case 11:let V=t.v,B=t.it,O=t.e;this.buf.b+=oe.string("for( "+V+" in "),this.expr(B),this.buf.b+=" ) ",this.expr(O);break;case 12:this.buf.b+="break";break;case 13:this.buf.b+="continue";break;case 14:let q=t.args,R=t.e,A=t.name,L=t.ret;this.buf.b+="function",A!=null&&(this.buf.b+=oe.string(" "+A)),this.buf.b+="(";let H=!0,$=0;for(;$<q.length;){let Fe=q[$];++$,H?H=!1:this.buf.b+=", ",Fe.opt&&(this.buf.b+="?"),this.buf.b+=oe.string(Fe.name),this.addType(Fe.t)}this.buf.b+=")",this.addType(L),this.buf.b+=" ",this.expr(R);break;case 15:let M=t.e;this.buf.b+="return",M!=null&&(this.buf.b+=" ",this.expr(M));break;case 16:let Z=t.e,ae=t.index;this.expr(Z),this.buf.b+="[",this.expr(ae),this.buf.b+="]";break;case 17:let ie=t.e;this.buf.b+="[";let ue=!0,de=0;for(;de<ie.length;){let Fe=ie[de];++de,ue?ue=!1:this.buf.b+=", ",this.expr(Fe)}this.buf.b+="]";break;case 18:let ye=t.cl,ce=t.params;this.buf.b+=oe.string("new "+ye+"(");let pe=!0,Je=0;for(;Je<ce.length;){let Fe=ce[Je];++Je,pe?pe=!1:this.buf.b+=", ",this.expr(Fe)}this.buf.b+=")";break;case 19:let tt=t.e;this.buf.b+="throw ",this.expr(tt);break;case 20:let Ge=t.e,ht=t.v,Ze=t.t,$e=t.ecatch;this.buf.b+="try ",this.expr(Ge),this.buf.b+=oe.string(" catch( "+ht),this.addType(Ze),this.buf.b+=") ",this.expr($e);break;case 21:let xt=t.fl;if(xt.length==0)this.buf.b+="{}";else{this.tabs+=" ",this.buf.b+=`{
49
+ `;let Fe=0;for(;Fe<xt.length;){let Me=xt[Fe];++Fe,this.buf.b+=oe.string(this.tabs),this.buf.b+=oe.string(Me.name+" : "),this.expr(Me.e),this.buf.b+=`,
50
+ `}this.tabs=p.substr(this.tabs,1,null),this.buf.b+="}"}break;case 22:let Ke=t.cond,at=t.e1,fe=t.e2;this.expr(Ke),this.buf.b+=" ? ",this.expr(at),this.buf.b+=" : ",this.expr(fe);break;case 23:let j=t.e,re=t.cases,te=t.defaultExpr;this.buf.b+="switch( ",this.expr(j),this.buf.b+=") {";let ne=0;for(;ne<re.length;){let Fe=re[ne];++ne,this.buf.b+="case ";let Me=!0,bt=0,pt=Fe.values;for(;bt<pt.length;){let Wt=pt[bt];++bt,Me?Me=!1:this.buf.b+=", ",this.expr(Wt)}this.buf.b+=": ",this.expr(Fe.expr),this.buf.b+=`;
51
+ `}te!=null&&(this.buf.b+="default: ",this.expr(te),this.buf.b+=`;
52
+ `),this.buf.b+="}";break;case 24:let xe=t.cond,we=t.e;this.buf.b+="do ",this.expr(we),this.buf.b+=" while ( ",this.expr(xe),this.buf.b+=" )";break;case 25:let Se=t.name,ot=t.args,Lt=t.e;if(this.buf.b+="@",this.buf.b+=Se==null?"null":""+Se,ot!=null&&ot.length>0){this.buf.b+="(";let Fe=!0,Me=0;for(;Me<ot.length;){let bt=ot[Me];++Me,Fe?Fe=!1:this.buf.b+=", ",this.expr(Lt)}this.buf.b+=")"}this.buf.b+=" ",this.expr(Lt);break;case 26:let Re=t.e,Pt=t.t;this.buf.b+="(",this.expr(Re),this.buf.b+=" : ",this.addType(Pt),this.buf.b+=")";break}}static toString(e){return new Li().exprToString(e)}static errorToString(e,t){let l=t,i=l??"en",n;if(e.text!=null)n=e.text.format(i);else{let s=e.e;switch(s._hx_index){case 0:let r=s.c;n=qe.format("Invalid character: '{char}' ({code})",{char:r!=r?"EOF":String.fromCodePoint(r),code:r},i);break;case 1:let a=s.s;n=qe.format('Unexpected token: "{token}"',{token:a},i);break;case 2:n=qe.format("Unterminated string",null,i);break;case 3:n=qe.format("Unterminated multiline comment",null,i);break;case 4:let h=s.msg;n=qe.format("Invalid preprocessor: {text}",{text:h},i);break;case 5:let o=s.v;n=qe.format("Unknown variable: {name}",{name:o},i);break;case 6:let u=s.v;n=qe.format("Invalid iterator: {name}",{name:u},i);break;case 7:let c=s.op;n=qe.format("Invalid operator: {op}",{op:c},i);break;case 8:let f=s.f;n=qe.format("Invalid access to field {field}",{field:f},i);break;case 9:n=s.msg;break}}return e.origin+":"+e.line+": "+n}}J["loreline.lorscript.Printer"]=Li,Li.__name__="loreline.lorscript.Printer",Object.assign(Li.prototype,{__class__:Li});class Mn{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 Re=o[u];++u,t(Re)}break;case 5:let c=l.f,f=l.e;t(f);break;case 6:let g=l.op,_=l.e1,d=l.e2;t(_),t(d);break;case 7:let m=l.op,k=l.prefix,C=l.e;t(C);break;case 8:let T=l.e,S=l.params;t(T);let v=0;for(;v<S.length;){let Re=S[v];++v,t(Re)}break;case 9:let I=l.cond,E=l.e1,N=l.e2;t(I),t(E),N!=null&&t(N);break;case 10:let K=l.cond,V=l.e;t(K),t(V);break;case 11:let B=l.v,O=l.it,q=l.e;t(O),t(q);break;case 12:case 13:break;case 14:let R=l.args,A=l.name,L=l.ret,H=l.e;t(H);break;case 15:let $=l.e;$!=null&&t($);break;case 16:let M=l.e,Z=l.index;t(M),t(Z);break;case 17:let ae=l.e,ie=0;for(;ie<ae.length;){let Re=ae[ie];++ie,t(Re)}break;case 18:let ue=l.cl,de=l.params,ye=0;for(;ye<de.length;){let Re=de[ye];++ye,t(Re)}break;case 19:let ce=l.e;t(ce);break;case 20:let pe=l.v,Je=l.t,tt=l.e,Ge=l.ecatch;t(tt),t(Ge);break;case 21:let ht=l.fl,Ze=0;for(;Ze<ht.length;){let Re=ht[Ze];++Ze,t(Re.e)}break;case 22:let $e=l.cond,xt=l.e1,Ke=l.e2;t($e),t(xt),t(Ke);break;case 23:let at=l.e,fe=l.cases,j=l.defaultExpr;t(at);let re=0;for(;re<fe.length;){let Re=fe[re];++re;let Pt=0,Fe=Re.values;for(;Pt<Fe.length;){let Me=Fe[Pt];++Pt,t(Me)}t(Re.expr)}j!=null&&t(j);break;case 24:let te=l.cond,ne=l.e;t(te),t(ne);break;case 25:let xe=l.name,we=l.args,Se=l.e;if(we!=null){let Re=0;for(;Re<we.length;){let Pt=we[Re];++Re,t(Pt)}}t(Se);break;case 26:let ot=l.t,Lt=l.e;t(Lt);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=Y.EVar(r,a,h!=null?t(h):null);break;case 3:let o=i.e;l=Y.EParent(t(o));break;case 4:let u=i.e,c=[],f=0;for(;f<u.length;){let lt=u[f];++f,c.push(t(lt))}l=Y.EBlock(c);break;case 5:let g=i.e,_=i.f;l=Y.EField(t(g),_);break;case 6:let d=i.op,m=i.e1,k=i.e2;l=Y.EBinop(d,t(m),t(k));break;case 7:let C=i.op,T=i.prefix,S=i.e;l=Y.EUnop(C,T,t(S));break;case 8:let v=i.e,I=i.params,E=t(v),N=[],K=0;for(;K<I.length;){let lt=I[K];++K,N.push(t(lt))}l=Y.ECall(E,N);break;case 9:let V=i.cond,B=i.e1,O=i.e2;l=Y.EIf(t(V),t(B),O!=null?t(O):null);break;case 10:let q=i.cond,R=i.e;l=Y.EWhile(t(q),t(R));break;case 11:let A=i.v,L=i.it,H=i.e;l=Y.EFor(A,t(L),t(H));break;case 12:case 13:l=e.e;break;case 14:let $=i.args,M=i.e,Z=i.name,ae=i.ret;l=Y.EFunction($,t(M),Z,ae);break;case 15:let ie=i.e;l=Y.EReturn(ie!=null?t(ie):null);break;case 16:let ue=i.e,de=i.index;l=Y.EArray(t(ue),t(de));break;case 17:let ye=i.e,ce=[],pe=0;for(;pe<ye.length;){let lt=ye[pe];++pe,ce.push(t(lt))}l=Y.EArrayDecl(ce);break;case 18:let Je=i.cl,tt=i.params,Ge=[],ht=0;for(;ht<tt.length;){let lt=tt[ht];++ht,Ge.push(t(lt))}l=Y.ENew(Je,Ge);break;case 19:let Ze=i.e;l=Y.EThrow(t(Ze));break;case 20:let $e=i.e,xt=i.v,Ke=i.t,at=i.ecatch;l=Y.ETry(t($e),xt,Ke,t(at));break;case 21:let fe=i.fl,j=[],re=0;for(;re<fe.length;){let lt=fe[re];++re,j.push({name:lt.name,e:t(lt.e)})}l=Y.EObject(j);break;case 22:let te=i.cond,ne=i.e1,xe=i.e2;l=Y.ETernary(t(te),t(ne),t(xe));break;case 23:let we=i.e,Se=i.cases,ot=i.defaultExpr,Lt=t(we),Re=[],Pt=0;for(;Pt<Se.length;){let lt=Se[Pt];++Pt;let ll=[],Gt=0,il=lt.values;for(;Gt<il.length;){let Nt=il[Gt];++Gt,ll.push(t(Nt))}Re.push({values:ll,expr:t(lt.expr)})}l=Y.ESwitch(Lt,Re,ot==null?null:t(ot));break;case 24:let Fe=i.cond,Me=i.e;l=Y.EDoWhile(t(Fe),t(Me));break;case 25:let bt=i.name,pt=i.args,Wt=i.e,gl;if(pt==null)gl=null;else{let lt=[],ll=0;for(;ll<pt.length;){let Gt=pt[ll];++ll,lt.push(t(Gt))}gl=lt}l=Y.EMeta(bt,gl,t(Wt));break;case 26:let It=i.e,Ol=i.t;l=Y.ECheckType(t(It),Ol);break}return{e:l,pmin:e.pmin,pmax:e.pmax,origin:e.origin,line:e.line}}static expr(e){return e.e}static mk(e,t){return{e,pmin:t.pmin,pmax:t.pmax,origin:t.origin,line:t.line}}}J["loreline.lorscript.Tools"]=Mn,Mn.__name__="loreline.lorscript.Tools";class jn{}J["loreline.macros.IdentifierTables"]=jn,jn.__name__="loreline.macros.IdentifierTables";class tl{static toLoreline(e,t){return tl.convert(e,44,t)}static tsvToLoreline(e,t){return tl.convert(e,9,t)}static convert(e,t,l){let i=tl.parseRows(e,t);if(i.length<1)throw y.thrown(new st("Invalid CSV: header row required"));if(i.length<2)return"";let n=i[0],s=tl.findColumn(n,["key"]);if(s<0)throw y.thrown(new st("Invalid CSV: 'key' column not found in header"));let r=tl.findColumn(n,["source","en","original"]),a=tl.findLocaleColumn(n,l);if(a<0)if(n.length>=2)a=n.length-1;else return"";let h="",o=!0,u=1,c=i.length;for(;u<c;){let f=u++,g=i[f];if(g.length<=s)continue;let _=g[s];if(_==null||_==""||g.length<=a)continue;let d=g[a];if(d==null||d=="")continue;let m=r>=0&&g.length>r?g[r]:null;o||(h+=`
53
+ `),o=!1,h+="#",h+=_==null?"null":""+_,m!=null&&m!=""&&(h+=" // ",h+=oe.string(m.split(`
53
54
  `).join(" ").split("\r").join(""))),h+=`
54
- `,h+=g==null?"null":""+g,h+=`
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 ""
55
+ `,h+=d==null?"null":""+d,h+=`
56
+ `}return h}static fromScript(e,t,l){return tl.generate(e,t,l,44)}static tsvFromScript(e,t,l){return tl.generate(e,t,l,9)}static generate(e,t,l,i){let n=Ve.extractTranslatableEntries(e),s=new Ll,r="",a=String.fromCodePoint(i);r+=oe.string(tl.escapeForCsvField("key",i)),r+=a==null?"null":""+a,r+=oe.string(tl.escapeForCsvField("source",i)),r+=a==null?"null":""+a,r+=oe.string(tl.escapeForCsvField(l,i)),r+=`
57
+ `;let h=0;for(;h<n.length;){let o=n[h];++h;let u=s.printStringLiteralAsText(o.str),c=t!=null&&Object.prototype.hasOwnProperty.call(t.h,o.id)?s.printStringLiteralAsText(t.h[o.id]):u;r+=oe.string(tl.escapeForCsvField(o.id,i)),r+=a==null?"null":""+a,r+=oe.string(tl.escapeForCsvField(u,i)),r+=a==null?"null":""+a,r+=oe.string(tl.escapeForCsvField(c,i)),r+=`
58
+ `}return r}static escapeForCsvField(e,t){let l=!1,i=0,n=e.length;for(;i<n;){let s=i++,r=p.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?p.substr(l,0,s):p.substr(l,0,null),a=0,h=e.length;for(;a<h;){let o=a++,u=e[o].toLowerCase(),c=u.indexOf("-",null);if((c<0?u:c!=null?p.substr(u,0,c):p.substr(u,0,null))==r)return o}return-1}static primarySubtag(e){let t=e.indexOf("-",null);return t<0?e:t!=null?p.substr(e,0,t):p.substr(e,0,null)}static parseRows(e,t){let l=[],i=[],n=new Et,s=!1,r=0,a=e,h=a.length;for(;r<h;){let o=p.cca(a,r),u=o??-1;if(s)if(u==34){let c;if(r+1<h){let f=p.cca(a,r+1);c=(f??-1)==34}else c=!1;c?(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 Et,++r;else if(u==10||u==13){i.push(n.b),n=new Et,(i.length>1||i.length==1&&i[0]!="")&&l.push(i),i=[];let c;if(u==13&&r+1<h){let f=p.cca(a,r+1);c=(f??-1)==10}else c=!1;c?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(`
59
+ `).join(" ").split("\r").join("")}}J["loreline.translation.CsvTranslation"]=tl,tl.__name__="loreline.translation.CsvTranslation";class zl{static toLoreline(e,t){let l=zl.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+=`
60
+ `),n=!1,i+="#",i+=a==null?"null":""+a,r.msgctxt!=null&&r.msgid!=null&&r.msgid!=""&&(i+=" // ",i+=oe.string(zl.escapeLineForComment(r.msgid))),i+=`
61
+ `,i+=oe.string(zl.escapeLineForBody(r.msgstr)),i+=`
62
+ `)}return i}static fromScript(e,t,l){let i=Ve.extractTranslatableEntries(e),n=new Ll,s="";s+=`msgid ""
62
63
  `,s+=`msgstr ""
63
64
  `,s+=`"Content-Type: text/plain; charset=UTF-8\\n"
64
- `,s+='"Language: ',s+=Y.string(Tl.escapeForPoString(l)),s+=`\\n"
65
+ `,s+='"Language: ',s+=oe.string(zl.escapeForPoString(l)),s+=`\\n"
65
66
  `;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(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+=`"
67
+ `;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+=oe.string(zl.escapeForPoString(a.id)),s+=`"
68
+ `,s+='msgid "',s+=oe.string(zl.escapeForPoString(h)),s+=`"
69
+ `,s+='msgstr "',s+=oe.string(zl.escapeForPoString(o)),s+=`"
69
70
  `}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 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"?>
71
+ `),l=[],i=null,n=0;for(;n<t.length;){let s=t[n],r;if(s.length>0){let d=p.cca(s,s.length-1);r=(d??-1)==13}else r=!1;if(r){let d=s.length-1;s=d!=null?p.substr(s,0,d):p.substr(s,0,null)}let a=0,h=s.length;for(;a<h;){let d=p.cca(s,a),m=d??-1;if(m!=32&&m!=9)break;++a}let o;if(a==0)o=s;else{let d=null;o=d!=null?p.substr(s,a,d):p.substr(s,a,null)}if(o==""){i!=null&&(l.push(i),i=null),++n;continue}let u=p.cca(o,0);if((u??-1)==35){++n;continue}i==null&&(i=new In);let c=zl.readKeyword(o);if(c==null){++n;continue}let f=zl.readQuotedString(o,c.length),g=f??"",_=n+1;for(;_<t.length;){let d=t[_],m;if(d.length>0){let I=p.cca(d,d.length-1);m=(I??-1)==13}else m=!1;if(m){let I=d.length-1;d=I!=null?p.substr(d,0,I):p.substr(d,0,null)}let k=0,C=d.length;for(;k<C;){let I=p.cca(d,k),E=I??-1;if(E!=32&&E!=9)break;++k}let T;if(k==0)T=d;else{let I=null;T=I!=null?p.substr(d,k,I):p.substr(d,k,null)}let S;if(T.length!=0){let I=p.cca(T,0);S=(I??-1)!=34}else S=!0;if(S)break;let v=zl.readQuotedString(T,0);v!=null&&(g+=v),++_}switch(c){case"msgctxt":i.msgctxt=g;break;case"msgid":i.msgid=g;break;case"msgstr":i.msgstr=g;break;default:c=="msgstr[0]"&&(i.msgstr=g)}n=_}return i!=null&&l.push(i),l}static readKeyword(e){let t=0,l=e.length;for(;t<l;){let i=p.cca(e,t),n=i??-1;if(n==32||n==9)break;++t}return t==0?null:t!=null?p.substr(e,0,t):p.substr(e,0,null)}static readQuotedString(e,t){let l=t,i=e.length;for(;l<i;){let r=p.cca(e,l),a=r??-1;if(a!=32&&a!=9)break;++l}let n;if(l<i){let r=p.cca(e,l);n=(r??-1)!=34}else n=!0;if(n)return null;++l;let s="";for(;l<i;){let r=p.cca(e,l),a=r??-1;if(a==92&&l+1<i){let h=p.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 y.thrown(new st("Invalid PO: unterminated quoted string"))}static trimLeft(e){let t=0,l=e.length;for(;t<l;){let i=p.cca(e,t),n=i??-1;if(n!=32&&n!=9)break;++t}if(t==0)return e;{let i=null;return i!=null?p.substr(e,t,i):p.substr(e,t,null)}}static escapeLineForComment(e){return e.split(`
72
+ `).join(" ").split("\r").join("")}static escapeLineForBody(e){return e}}J["loreline.translation.PoTranslation"]=zl,zl.__name__="loreline.translation.PoTranslation";class In{constructor(){}}J["loreline.translation._PoTranslation.PoEntry"]=In,In.__name__="loreline.translation._PoTranslation.PoEntry",Object.assign(In.prototype,{__class__:In});class jl{static convert(e,t,l){switch(e){case".csv":return tl.toLoreline(t,l);case".po":return zl.toLoreline(t,l);case".tsv":return tl.tsvToLoreline(t,l);case".xlf":case".xliff":return Ut.toLoreline(t,l);default:throw new y("Unknown translation format extension: "+e)}}static translationFormat(e,t){jl.enabled.h[e]=t}static anyEnabled(){let e=0,t=jl.formats;for(;e<t.length;){let l=t[e];if(++e,jl.enabled.h[l.name]==!0)return!0}return!1}static wrap(e,t){if(!jl.anyEnabled())return new nn(e,function(){return null});let l=null,i=null;i=function(s,r,a,h){if(a>=jl.formats.length){r?i(s,!1,0,h):h(null);return}let o=jl.formats[a];if(jl.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(c){if(c!=null)try{h(jl.convert(o.ext,c,t))}catch(f){let g=y.caught(f).unwrap();if(g instanceof st){let _=g;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 m=s.length;if(m<4)h=!1;else{let k,C,T=p.cca(s,m-4);if((T??-1)==46){let S=p.cca(s,m-3),v=S??-1;C=v==108||v==76}else C=!1;if(C){let S=p.cca(s,m-2),v=S??-1;k=v==111||v==79}else k=!1;if(k){let S=p.cca(s,m-1),v=S??-1;h=v==114||v==82}else h=!1}}if(!h){r(null);return}let o=s.length-4,u=o!=null?p.substr(s,0,o):p.substr(s,0,null),c="."+t,f,g=u.length,_=c.length,d;if(_>g)d=!1;else{let m=g-_;d=(_!=null?p.substr(u,m,_):p.substr(u,m,null))==c}if(d){let m=u.length-c.length;f=m!=null?p.substr(u,0,m):p.substr(u,0,null)}else f=u;i(f,!0,0,r)})};return new nn(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?p.substr(e,n,i):p.substr(e,n,null))==t}}J["loreline.translation.TranslationFormats"]=jl,jl.__name__="loreline.translation.TranslationFormats";class nn{constructor(e,t){this.handler=e,this.lastError=t}}J["loreline.translation.WrappedFileHandler"]=nn,nn.__name__="loreline.translation.WrappedFileHandler",Object.assign(nn.prototype,{__class__:nn});class Ut{static toLoreline(e,t){let l;try{l=Ci.parse(e)}catch(c){let f=y.caught(c).unwrap();throw y.thrown(new st("Invalid XLIFF: "+oe.string(f)))}let i=null;if(l.nodeType!=W.Document&&l.nodeType!=W.Element)throw y.thrown("Bad node type, expected Element or Document but found "+(l.nodeType==null?"null":be.toString(l.nodeType)));let n=0,s=l.children;for(;n<s.length;){let c=s[n++];if(c.nodeType==0){if(c.nodeType!=W.Element)throw y.thrown("Bad node type, expected Element but found "+(c.nodeType==null?"null":be.toString(c.nodeType)));if(c.nodeName=="xliff"){i=c;break}}}if(i==null)throw y.thrown(new st("Invalid XLIFF: missing <xliff> root element"));let r=i.exists("trgLang")?i.get("trgLang"):null,a=r!=null;if(a&&!Ut.localeMatches(r,t))return"";let h=new Et,o=!0,u=i.elementsNamed("file");for(;u.hasNext();){let c=u.next();if(!a){let f=c.exists("target-language")?c.get("target-language"):null;if(f!=null&&!Ut.localeMatches(f,t))continue}if(a){let f=c.elementsNamed("unit");for(;f.hasNext();){let g=f.next();if(!g.exists("id"))continue;let _=g.get("id"),d=[],m=g.elementsNamed("segment");for(;m.hasNext();){let E=m.next();d.push(E)}let k=d;if(k.length==0)continue;let C=[],T=[],S=0;for(;S<k.length;){let E=k[S];++S;let N=Ut.innerText(Ut.firstChildElement(E,"source")),K=Ut.innerText(Ut.firstChildElement(E,"target"));N!=null&&C.push(N),K!=null&&T.push(K)}let v=C.join(""),I=T.join("");I!=""&&(o||(h.b+=`
73
+ `),o=!1,Ut.writeEntry(h,_,v,I))}}else{let f=Ut.firstChildElement(c,"body");if(f==null)continue;let g=f.elementsNamed("trans-unit");for(;g.hasNext();){let _=g.next();if(!_.exists("id"))continue;let d=_.get("id"),m=Ut.innerText(Ut.firstChildElement(_,"source")),k=Ut.innerText(Ut.firstChildElement(_,"target"));k==null||k==""||(o||(h.b+=`
74
+ `),o=!1,Ut.writeEntry(h,d,m??"",k))}}}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?p.substr(l,0,n):p.substr(l,0,null),r=i.indexOf("-",null),a=r<0?i:r!=null?p.substr(i,0,r):p.substr(i,0,null);return s==a}static primarySubtag(e){let t=e.indexOf("-",null);return t<0?e:t!=null?p.substr(e,0,t):p.substr(e,0,null)}static firstChildElement(e,t){if(e.nodeType!=W.Document&&e.nodeType!=W.Element)throw y.thrown("Bad node type, expected Element or Document but found "+(e.nodeType==null?"null":be.toString(e.nodeType)));let l=0,i=e.children;for(;l<i.length;){let n=i[l++];if(n.nodeType==0){if(n.nodeType!=W.Element)throw y.thrown("Bad node type, expected Element but found "+(n.nodeType==null?"null":be.toString(n.nodeType)));if(n.nodeName==t)return n}}return null}static innerText(e){if(e==null)return null;let t="";if(e.nodeType!=W.Document&&e.nodeType!=W.Element)throw y.thrown("Bad node type, expected Element or Document but found "+(e.nodeType==null?"null":be.toString(e.nodeType)));let l=0,i=e.children;for(;l<i.length;){let n=i[l++];switch(n.nodeType){case 0:t+=oe.string(Ut.innerText(n));break;case 1:if(n.nodeType==W.Document||n.nodeType==W.Element)throw y.thrown("Bad node type, unexpected "+(n.nodeType==null?"null":be.toString(n.nodeType)));t+=oe.string(n.nodeValue);break;case 2:if(n.nodeType==W.Document||n.nodeType==W.Element)throw y.thrown("Bad node type, unexpected "+(n.nodeType==null?"null":be.toString(n.nodeType)));t+=oe.string(n.nodeValue);break;default:}}return t}static fromScript(e,t,l){let i=Ve.extractTranslatableEntries(e),n=new Ll,s="";s+=`<?xml version="1.0" encoding="UTF-8"?>
74
75
  `,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(Pt.escapeForXmlAttr(l)),s+=`" datatype="plaintext">
76
+ `,s+=' <file source-language="en" target-language="',s+=oe.string(Ut.escapeForXmlAttr(l)),s+=`" datatype="plaintext">
76
77
  `,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(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>
78
+ `;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+=oe.string(Ut.escapeForXmlAttr(a.id)),s+=`">
79
+ `,s+=" <source>",s+=oe.string(Ut.escapeForXmlText(h)),s+=`</source>
80
+ `,s+=" <target>",s+=oe.string(Ut.escapeForXmlText(o)),s+=`</target>
80
81
  `,s+=` </trans-unit>
81
82
  `}return s+=` </body>
82
83
  `,s+=` </file>
83
84
  `,s+=`</xliff>
84
- `,s}static escapeForXmlText(e){let t=e.split("&").join("&amp;");return t=t.split("<").join("&lt;"),t=t.split(">").join("&gt;"),t}static escapeForXmlAttr(e){let t=Pt.escapeForXmlText(e);return t=t.split('"').join("&quot;"),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
- `).join(" ").split("\r").join("");e.b+=Y.string(n)}e.b+=`
85
+ `,s}static escapeForXmlText(e){let t=e.split("&").join("&amp;");return t=t.split("<").join("&lt;"),t=t.split(">").join("&gt;"),t}static escapeForXmlAttr(e){let t=Ut.escapeForXmlText(e);return t=t.split('"').join("&quot;"),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(`
86
+ `).join(" ").split("\r").join("");e.b+=oe.string(n)}e.b+=`
86
87
  `,e.b+=i==null?"null":""+i,e.b+=`
87
88
  `}static escapeLineForComment(e){return e.split(`
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;
89
+ `).join(" ").split("\r").join("")}}J["loreline.translation.XliffTranslation"]=Ut,Ut.__name__="loreline.translation.XliffTranslation";function Jn(b){return b instanceof Array?new ei(b):b.iterator()}function Te(b,e){if(e==null)return null;e.__id__==null&&(e.__id__=Bn.$haxeUID++);var t;return b.hx__closures__==null?b.hx__closures__={}:t=b.hx__closures__[e.__id__],t==null&&(t=e.bind(b),b.hx__closures__[e.__id__]=t),t}Bn.$haxeUID|=0,typeof performance<"u"&&typeof performance.now=="function"&&(p.now=performance.now.bind(performance)),J.Math=Math,String.fromCodePoint==null&&(String.fromCodePoint=function(b){return b<65536?String.fromCharCode(b):String.fromCharCode((b>>10)+55232)+String.fromCharCode((b&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 Zn={},Xn={},es=Number,ts=Boolean,ls={},is={}}le.__toStr={}.toString,W.Element=0,W.PCData=1,W.CData=2,W.Comment=3,W.DocType=4,W.ProcessingInstruction=5,W.Document=6,Ci.escapes=(function(b){var e;let t=new Ce;return t.h.lt="<",t.h.gt=">",t.h.amp="&",t.h.quot='"',t.h.apos="'",e=t,e})(this),Ve.randomId_nonHexChars="ghijklmnopqrstuvwxyz",Ve.randomId_chars="0123456789abcdefghijklmnopqrstuvwxyz",D.emoji="\u{1F600}",D.UNITS=D.emoji.length,Wi.ObjectBrace=0,Wi.ArrayBracket=1,Wi.Brace=2,Wi.Indent=3,Wi.CaseIndent=4,Wi.Bracket=5,Wi.Paren=6,Si.CONTROL_KEYWORDS=["for","while","if","switch","catch"],Q.START=[65,90,95,95,97,122,170,170,181,181,186,186,192,214,216,246,248,705,710,721,736,740,748,748,750,750,880,884,886,887,891,893,895,895,902,902,904,906,908,908,910,929,931,1013,1015,1153,1162,1327,1329,1366,1369,1369,1376,1416,1488,1514,1519,1522,1568,1610,1646,1647,1649,1747,1749,1749,1765,1766,1774,1775,1786,1788,1791,1791,1808,1808,1810,1839,1869,1957,1969,1969,1994,2026,2036,2037,2042,2042,2048,2069,2074,2074,2084,2084,2088,2088,2112,2136,2144,2154,2160,2183,2185,2190,2208,2249,2308,2361,2365,2365,2384,2384,2392,2401,2417,2432,2437,2444,2447,2448,2451,2472,2474,2480,2482,2482,2486,2489,2493,2493,2510,2510,2524,2525,2527,2529,2544,2545,2556,2556,2565,2570,2575,2576,2579,2600,2602,2608,2610,2611,2613,2614,2616,2617,2649,2652,2654,2654,2674,2676,2693,2701,2703,2705,2707,2728,2730,2736,2738,2739,2741,2745,2749,2749,2768,2768,2784,2785,2809,2809,2821,2828,2831,2832,2835,2856,2858,2864,2866,2867,2869,2873,2877,2877,2908,2909,2911,2913,2929,2929,2947,2947,2949,2954,2958,2960,2962,2965,2969,2970,2972,2972,2974,2975,2979,2980,2984,2986,2990,3001,3024,3024,3077,3084,3086,3088,3090,3112,3114,3129,3133,3133,3160,3162,3165,3165,3168,3169,3200,3200,3205,3212,3214,3216,3218,3240,3242,3251,3253,3257,3261,3261,3293,3294,3296,3297,3313,3314,3332,3340,3342,3344,3346,3386,3389,3389,3406,3406,3412,3414,3423,3425,3450,3455,3461,3478,3482,3505,3507,3515,3517,3517,3520,3526,3585,3632,3634,3634,3648,3654,3713,3714,3716,3716,3718,3722,3724,3747,3749,3749,3751,3760,3762,3762,3773,3773,3776,3780,3782,3782,3804,3807,3840,3840,3904,3911,3913,3948,3976,3980,4096,4138,4159,4159,4176,4181,4186,4189,4193,4193,4197,4198,4206,4208,4213,4225,4238,4238,4256,4293,4295,4295,4301,4301,4304,4346,4348,4680,4682,4685,4688,4694,4696,4696,4698,4701,4704,4744,4746,4749,4752,4784,4786,4789,4792,4798,4800,4800,4802,4805,4808,4822,4824,4880,4882,4885,4888,4954,4992,5007,5024,5109,5112,5117,5121,5740,5743,5759,5761,5786,5792,5866,5870,5880,5888,5905,5919,5937,5952,5969,5984,5996,5998,6e3,6016,6067,6103,6103,6108,6108,6176,6264,6272,6312,6314,6314,6320,6389,6400,6430,6480,6509,6512,6516,6528,6571,6576,6601,6656,6678,6688,6740,6823,6823,6917,6963,6981,6988,7043,7072,7086,7087,7098,7141,7168,7203,7245,7247,7258,7293,7296,7306,7312,7354,7357,7359,7401,7404,7406,7411,7413,7414,7418,7418,7424,7615,7680,7957,7960,7965,7968,8005,8008,8013,8016,8023,8025,8025,8027,8027,8029,8029,8031,8061,8064,8116,8118,8124,8126,8126,8130,8132,8134,8140,8144,8147,8150,8155,8160,8172,8178,8180,8182,8188,8305,8305,8319,8319,8336,8348,8450,8450,8455,8455,8458,8467,8469,8469,8472,8477,8484,8484,8486,8486,8488,8488,8490,8505,8508,8511,8517,8521,8526,8526,8544,8584,8986,8987,9e3,9e3,9096,9096,9167,9167,9193,9203,9208,9210,9410,9410,9642,9643,9654,9654,9664,9664,9723,9726,9728,9733,9735,9746,9748,9861,9872,9989,9992,10002,10004,10004,10006,10006,10013,10013,10017,10017,10024,10024,10035,10036,10052,10052,10055,10055,10060,10060,10062,10062,10067,10069,10071,10071,10083,10087,10133,10135,10145,10145,10160,10160,10175,10175,10548,10549,11013,11015,11035,11036,11088,11088,11093,11093,11264,11492,11499,11502,11506,11507,11520,11557,11559,11559,11565,11565,11568,11623,11631,11631,11648,11670,11680,11686,11688,11694,11696,11702,11704,11710,11712,11718,11720,11726,11728,11734,11736,11742,12293,12295,12321,12329,12337,12341,12344,12348,12353,12438,12445,12447,12449,12538,12540,12543,12549,12591,12593,12686,12704,12735,12784,12799,12951,12951,12953,12953,13312,19903,19968,42124,42192,42237,42240,42508,42512,42527,42538,42539,42560,42606,42623,42653,42656,42735,42775,42783,42786,42888,42891,42957,42960,42961,42963,42963,42965,42972,42994,43009,43011,43013,43015,43018,43020,43042,43072,43123,43138,43187,43250,43255,43259,43259,43261,43262,43274,43301,43312,43334,43360,43388,43396,43442,43471,43471,43488,43492,43494,43503,43514,43518,43520,43560,43584,43586,43588,43595,43616,43638,43642,43642,43646,43695,43697,43697,43701,43702,43705,43709,43712,43712,43714,43714,43739,43741,43744,43754,43762,43764,43777,43782,43785,43790,43793,43798,43808,43814,43816,43822,43824,43866,43868,43881,43888,44002,44032,55203,55216,55238,55243,55291,63744,64109,64112,64217,64256,64262,64275,64279,64285,64285,64287,64296,64298,64310,64312,64316,64318,64318,64320,64321,64323,64324,64326,64433,64467,64605,64612,64829,64848,64911,64914,64967,65008,65017,65137,65137,65139,65139,65143,65143,65145,65145,65147,65147,65149,65149,65151,65276,65313,65338,65345,65370,65382,65437,65440,65470,65474,65479,65482,65487,65490,65495,65498,65500,65536,65547,65549,65574,65576,65594,65596,65597,65599,65613,65616,65629,65664,65786,65856,65908,66176,66204,66208,66256,66304,66335,66349,66378,66384,66421,66432,66461,66464,66499,66504,66511,66513,66517,66560,66717,66736,66771,66776,66811,66816,66855,66864,66915,66928,66938,66940,66954,66956,66962,66964,66965,66967,66977,66979,66993,66995,67001,67003,67004,67008,67059,67072,67382,67392,67413,67424,67431,67456,67461,67463,67504,67506,67514,67584,67589,67592,67592,67594,67637,67639,67640,67644,67644,67647,67669,67680,67702,67712,67742,67808,67826,67828,67829,67840,67861,67872,67897,67968,68023,68030,68031,68096,68096,68112,68115,68117,68119,68121,68149,68192,68220,68224,68252,68288,68295,68297,68324,68352,68405,68416,68437,68448,68466,68480,68497,68608,68680,68736,68786,68800,68850,68864,68899,68938,68965,68975,68997,69248,69289,69296,69297,69314,69316,69376,69404,69415,69415,69424,69445,69488,69505,69552,69572,69600,69622,69635,69687,69745,69746,69749,69749,69763,69807,69840,69864,69891,69926,69956,69956,69959,69959,69968,70002,70006,70006,70019,70066,70081,70084,70106,70106,70108,70108,70144,70161,70163,70187,70207,70208,70272,70278,70280,70280,70282,70285,70287,70301,70303,70312,70320,70366,70405,70412,70415,70416,70419,70440,70442,70448,70450,70451,70453,70457,70461,70461,70480,70480,70493,70497,70528,70537,70539,70539,70542,70542,70544,70581,70583,70583,70609,70609,70611,70611,70656,70708,70727,70730,70751,70753,70784,70831,70852,70853,70855,70855,71040,71086,71128,71131,71168,71215,71236,71236,71296,71338,71352,71352,71424,71450,71488,71494,71680,71723,71840,71903,71935,71942,71945,71945,71948,71955,71957,71958,71960,71983,71999,71999,72001,72001,72096,72103,72106,72144,72161,72161,72163,72163,72192,72192,72203,72242,72250,72250,72272,72272,72284,72329,72349,72349,72368,72440,72640,72672,72704,72712,72714,72750,72768,72768,72818,72847,72960,72966,72968,72969,72971,73008,73030,73030,73056,73061,73063,73064,73066,73097,73112,73112,73440,73458,73474,73474,73476,73488,73490,73523,73648,73648,73728,74649,74752,74862,74880,75075,77712,77808,77824,78895,78913,78918,78944,82938,82944,83526,90368,90397,92160,92728,92736,92766,92784,92862,92880,92909,92928,92975,92992,92995,93027,93047,93053,93071,93504,93548,93760,93823,93952,94026,94032,94032,94099,94111,94176,94177,94179,94179,94208,100343,100352,101589,101631,101640,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,113664,113770,113776,113788,113792,113800,113808,113817,119808,119892,119894,119964,119966,119967,119970,119970,119973,119974,119977,119980,119982,119993,119995,119995,119997,120003,120005,120069,120071,120074,120077,120084,120086,120092,120094,120121,120123,120126,120128,120132,120134,120134,120138,120144,120146,120485,120488,120512,120514,120538,120540,120570,120572,120596,120598,120628,120630,120654,120656,120686,120688,120712,120714,120744,120746,120770,120772,120779,122624,122654,122661,122666,122928,122989,123136,123180,123191,123197,123214,123214,123536,123565,123584,123627,124112,124139,124368,124397,124400,124400,124896,124902,124904,124907,124909,124910,124912,124926,124928,125124,125184,125251,125259,125259,126464,126467,126469,126495,126497,126498,126500,126500,126503,126503,126505,126514,126516,126519,126521,126521,126523,126523,126530,126530,126535,126535,126537,126537,126539,126539,126541,126543,126545,126546,126548,126548,126551,126551,126553,126553,126555,126555,126557,126557,126559,126559,126561,126562,126564,126564,126567,126570,126572,126578,126580,126583,126585,126588,126590,126590,126592,126601,126603,126619,126625,126627,126629,126633,126635,126651,126976,127231,127245,127247,127279,127279,127340,127345,127358,127359,127374,127374,127377,127386,127405,127487,127489,127503,127514,127514,127535,127535,127538,127546,127548,127551,127561,127994,128e3,128317,128326,128591,128640,128767,128884,128895,128981,129023,129036,129039,129096,129103,129114,129119,129160,129167,129198,129279,129292,129338,129340,129349,129351,129791,130048,131069,131072,173791,173824,177977,177984,178205,178208,183969,183984,191456,191472,192093,194560,195101,196608,201546,201552,205743],Q.PART=[48,57,65,90,95,95,97,122,170,170,181,181,183,183,186,186,192,214,216,246,248,705,710,721,736,740,748,748,750,750,768,884,886,887,891,893,895,895,902,906,908,908,910,929,931,1013,1015,1153,1155,1159,1162,1327,1329,1366,1369,1369,1376,1416,1425,1469,1471,1471,1473,1474,1476,1477,1479,1479,1488,1514,1519,1522,1552,1562,1568,1641,1646,1747,1749,1756,1759,1768,1770,1788,1791,1791,1808,1866,1869,1969,1984,2037,2042,2042,2045,2045,2048,2093,2112,2139,2144,2154,2160,2183,2185,2190,2199,2273,2275,2403,2406,2415,2417,2435,2437,2444,2447,2448,2451,2472,2474,2480,2482,2482,2486,2489,2492,2500,2503,2504,2507,2510,2519,2519,2524,2525,2527,2531,2534,2545,2556,2556,2558,2558,2561,2563,2565,2570,2575,2576,2579,2600,2602,2608,2610,2611,2613,2614,2616,2617,2620,2620,2622,2626,2631,2632,2635,2637,2641,2641,2649,2652,2654,2654,2662,2677,2689,2691,2693,2701,2703,2705,2707,2728,2730,2736,2738,2739,2741,2745,2748,2757,2759,2761,2763,2765,2768,2768,2784,2787,2790,2799,2809,2815,2817,2819,2821,2828,2831,2832,2835,2856,2858,2864,2866,2867,2869,2873,2876,2884,2887,2888,2891,2893,2901,2903,2908,2909,2911,2915,2918,2927,2929,2929,2946,2947,2949,2954,2958,2960,2962,2965,2969,2970,2972,2972,2974,2975,2979,2980,2984,2986,2990,3001,3006,3010,3014,3016,3018,3021,3024,3024,3031,3031,3046,3055,3072,3084,3086,3088,3090,3112,3114,3129,3132,3140,3142,3144,3146,3149,3157,3158,3160,3162,3165,3165,3168,3171,3174,3183,3200,3203,3205,3212,3214,3216,3218,3240,3242,3251,3253,3257,3260,3268,3270,3272,3274,3277,3285,3286,3293,3294,3296,3299,3302,3311,3313,3315,3328,3340,3342,3344,3346,3396,3398,3400,3402,3406,3412,3415,3423,3427,3430,3439,3450,3455,3457,3459,3461,3478,3482,3505,3507,3515,3517,3517,3520,3526,3530,3530,3535,3540,3542,3542,3544,3551,3558,3567,3570,3571,3585,3642,3648,3662,3664,3673,3713,3714,3716,3716,3718,3722,3724,3747,3749,3749,3751,3773,3776,3780,3782,3782,3784,3790,3792,3801,3804,3807,3840,3840,3864,3865,3872,3881,3893,3893,3895,3895,3897,3897,3902,3911,3913,3948,3953,3972,3974,3991,3993,4028,4038,4038,4096,4169,4176,4253,4256,4293,4295,4295,4301,4301,4304,4346,4348,4680,4682,4685,4688,4694,4696,4696,4698,4701,4704,4744,4746,4749,4752,4784,4786,4789,4792,4798,4800,4800,4802,4805,4808,4822,4824,4880,4882,4885,4888,4954,4957,4959,4969,4977,4992,5007,5024,5109,5112,5117,5121,5740,5743,5759,5761,5786,5792,5866,5870,5880,5888,5909,5919,5940,5952,5971,5984,5996,5998,6e3,6002,6003,6016,6099,6103,6103,6108,6109,6112,6121,6155,6157,6159,6169,6176,6264,6272,6314,6320,6389,6400,6430,6432,6443,6448,6459,6470,6509,6512,6516,6528,6571,6576,6601,6608,6618,6656,6683,6688,6750,6752,6780,6783,6793,6800,6809,6823,6823,6832,6845,6847,6862,6912,6988,6992,7001,7019,7027,7040,7155,7168,7223,7232,7241,7245,7293,7296,7306,7312,7354,7357,7359,7376,7378,7380,7418,7424,7957,7960,7965,7968,8005,8008,8013,8016,8023,8025,8025,8027,8027,8029,8029,8031,8061,8064,8116,8118,8124,8126,8126,8130,8132,8134,8140,8144,8147,8150,8155,8160,8172,8178,8180,8182,8188,8204,8205,8255,8256,8276,8276,8305,8305,8319,8319,8336,8348,8400,8412,8417,8417,8421,8432,8450,8450,8455,8455,8458,8467,8469,8469,8472,8477,8484,8484,8486,8486,8488,8488,8490,8505,8508,8511,8517,8521,8526,8526,8544,8584,8986,8987,9e3,9e3,9096,9096,9167,9167,9193,9203,9208,9210,9410,9410,9642,9643,9654,9654,9664,9664,9723,9726,9728,9733,9735,9746,9748,9861,9872,9989,9992,10002,10004,10004,10006,10006,10013,10013,10017,10017,10024,10024,10035,10036,10052,10052,10055,10055,10060,10060,10062,10062,10067,10069,10071,10071,10083,10087,10133,10135,10145,10145,10160,10160,10175,10175,10548,10549,11013,11015,11035,11036,11088,11088,11093,11093,11264,11492,11499,11507,11520,11557,11559,11559,11565,11565,11568,11623,11631,11631,11647,11670,11680,11686,11688,11694,11696,11702,11704,11710,11712,11718,11720,11726,11728,11734,11736,11742,11744,11775,12293,12295,12321,12335,12337,12341,12344,12348,12353,12438,12441,12442,12445,12447,12449,12543,12549,12591,12593,12686,12704,12735,12784,12799,12951,12951,12953,12953,13312,19903,19968,42124,42192,42237,42240,42508,42512,42539,42560,42607,42612,42621,42623,42737,42775,42783,42786,42888,42891,42957,42960,42961,42963,42963,42965,42972,42994,43047,43052,43052,43072,43123,43136,43205,43216,43225,43232,43255,43259,43259,43261,43309,43312,43347,43360,43388,43392,43456,43471,43481,43488,43518,43520,43574,43584,43597,43600,43609,43616,43638,43642,43714,43739,43741,43744,43759,43762,43766,43777,43782,43785,43790,43793,43798,43808,43814,43816,43822,43824,43866,43868,43881,43888,44010,44012,44013,44016,44025,44032,55203,55216,55238,55243,55291,63744,64109,64112,64217,64256,64262,64275,64279,64285,64296,64298,64310,64312,64316,64318,64318,64320,64321,64323,64324,64326,64433,64467,64605,64612,64829,64848,64911,64914,64967,65008,65017,65024,65039,65056,65071,65075,65076,65101,65103,65137,65137,65139,65139,65143,65143,65145,65145,65147,65147,65149,65149,65151,65276,65296,65305,65313,65338,65343,65343,65345,65370,65381,65470,65474,65479,65482,65487,65490,65495,65498,65500,65536,65547,65549,65574,65576,65594,65596,65597,65599,65613,65616,65629,65664,65786,65856,65908,66045,66045,66176,66204,66208,66256,66272,66272,66304,66335,66349,66378,66384,66426,66432,66461,66464,66499,66504,66511,66513,66517,66560,66717,66720,66729,66736,66771,66776,66811,66816,66855,66864,66915,66928,66938,66940,66954,66956,66962,66964,66965,66967,66977,66979,66993,66995,67001,67003,67004,67008,67059,67072,67382,67392,67413,67424,67431,67456,67461,67463,67504,67506,67514,67584,67589,67592,67592,67594,67637,67639,67640,67644,67644,67647,67669,67680,67702,67712,67742,67808,67826,67828,67829,67840,67861,67872,67897,67968,68023,68030,68031,68096,68099,68101,68102,68108,68115,68117,68119,68121,68149,68152,68154,68159,68159,68192,68220,68224,68252,68288,68295,68297,68326,68352,68405,68416,68437,68448,68466,68480,68497,68608,68680,68736,68786,68800,68850,68864,68903,68912,68921,68928,68965,68969,68973,68975,68997,69248,69289,69291,69292,69296,69297,69314,69316,69372,69404,69415,69415,69424,69456,69488,69509,69552,69572,69600,69622,69632,69702,69734,69749,69759,69818,69826,69826,69840,69864,69872,69881,69888,69940,69942,69951,69956,69959,69968,70003,70006,70006,70016,70084,70089,70092,70094,70106,70108,70108,70144,70161,70163,70199,70206,70209,70272,70278,70280,70280,70282,70285,70287,70301,70303,70312,70320,70378,70384,70393,70400,70403,70405,70412,70415,70416,70419,70440,70442,70448,70450,70451,70453,70457,70459,70468,70471,70472,70475,70477,70480,70480,70487,70487,70493,70499,70502,70508,70512,70516,70528,70537,70539,70539,70542,70542,70544,70581,70583,70592,70594,70594,70597,70597,70599,70602,70604,70611,70625,70626,70656,70730,70736,70745,70750,70753,70784,70853,70855,70855,70864,70873,71040,71093,71096,71104,71128,71133,71168,71232,71236,71236,71248,71257,71296,71352,71360,71369,71376,71395,71424,71450,71453,71467,71472,71481,71488,71494,71680,71738,71840,71913,71935,71942,71945,71945,71948,71955,71957,71958,71960,71989,71991,71992,71995,72003,72016,72025,72096,72103,72106,72151,72154,72161,72163,72164,72192,72254,72263,72263,72272,72345,72349,72349,72368,72440,72640,72672,72688,72697,72704,72712,72714,72758,72760,72768,72784,72793,72818,72847,72850,72871,72873,72886,72960,72966,72968,72969,72971,73014,73018,73018,73020,73021,73023,73031,73040,73049,73056,73061,73063,73064,73066,73102,73104,73105,73107,73112,73120,73129,73440,73462,73472,73488,73490,73530,73534,73538,73552,73562,73648,73648,73728,74649,74752,74862,74880,75075,77712,77808,77824,78895,78912,78933,78944,82938,82944,83526,90368,90425,92160,92728,92736,92766,92768,92777,92784,92862,92864,92873,92880,92909,92912,92916,92928,92982,92992,92995,93008,93017,93027,93047,93053,93071,93504,93548,93552,93561,93760,93823,93952,94026,94031,94087,94095,94111,94176,94177,94179,94180,94192,94193,94208,100343,100352,101589,101631,101640,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,113664,113770,113776,113788,113792,113800,113808,113817,113821,113822,118e3,118009,118528,118573,118576,118598,119141,119145,119149,119154,119163,119170,119173,119179,119210,119213,119362,119364,119808,119892,119894,119964,119966,119967,119970,119970,119973,119974,119977,119980,119982,119993,119995,119995,119997,120003,120005,120069,120071,120074,120077,120084,120086,120092,120094,120121,120123,120126,120128,120132,120134,120134,120138,120144,120146,120485,120488,120512,120514,120538,120540,120570,120572,120596,120598,120628,120630,120654,120656,120686,120688,120712,120714,120744,120746,120770,120772,120779,120782,120831,121344,121398,121403,121452,121461,121461,121476,121476,121499,121503,121505,121519,122624,122654,122661,122666,122880,122886,122888,122904,122907,122913,122915,122916,122918,122922,122928,122989,123023,123023,123136,123180,123184,123197,123200,123209,123214,123214,123536,123566,123584,123641,124112,124153,124368,124410,124896,124902,124904,124907,124909,124910,124912,124926,124928,125124,125136,125142,125184,125259,125264,125273,126464,126467,126469,126495,126497,126498,126500,126500,126503,126503,126505,126514,126516,126519,126521,126521,126523,126523,126530,126530,126535,126535,126537,126537,126539,126539,126541,126543,126545,126546,126548,126548,126551,126551,126553,126553,126555,126555,126557,126557,126559,126559,126561,126562,126564,126564,126567,126570,126572,126578,126580,126583,126585,126588,126590,126590,126592,126601,126603,126619,126625,126627,126629,126633,126635,126651,126976,127231,127245,127247,127279,127279,127340,127345,127358,127359,127374,127374,127377,127386,127405,127487,127489,127503,127514,127514,127535,127535,127538,127546,127548,127551,127561,128317,128326,128591,128640,128767,128884,128895,128981,129023,129036,129039,129096,129103,129114,129119,129160,129167,129198,129279,129292,129338,129340,129349,129351,129791,130032,130041,130048,131069,131072,173791,173824,177977,177984,178205,178208,183969,183984,191456,191472,192093,194560,195101,196608,201546,201552,205743,917536,917631,917760,917999],Q.EMOJI=[8986,8987,9e3,9e3,9096,9096,9167,9167,9193,9203,9208,9210,9410,9410,9642,9643,9654,9654,9664,9664,9723,9726,9728,9733,9735,9746,9748,9861,9872,9989,9992,10002,10004,10004,10006,10006,10013,10013,10017,10017,10024,10024,10035,10036,10052,10052,10055,10055,10060,10060,10062,10062,10067,10069,10071,10071,10083,10087,10133,10135,10145,10145,10160,10160,10175,10175,10548,10549,11013,11015,11035,11036,11088,11088,11093,11093,12951,12951,12953,12953,126976,127231,127245,127247,127279,127279,127340,127345,127358,127359,127374,127374,127377,127386,127405,127487,127489,127503,127514,127514,127535,127535,127538,127546,127548,127551,127561,127994,128e3,128317,128326,128591,128640,128767,128884,128895,128981,129023,129036,129039,129096,129103,129114,129119,129160,129167,129198,129279,129292,129338,129340,129349,129351,129791,130048,131069],Q.LOWER=[97,122,181,181,223,246,248,255,257,257,259,259,261,261,263,263,265,265,267,267,269,269,271,271,273,273,275,275,277,277,279,279,281,281,283,283,285,285,287,287,289,289,291,291,293,293,295,295,297,297,299,299,301,301,303,303,305,305,307,307,309,309,311,312,314,314,316,316,318,318,320,320,322,322,324,324,326,326,328,329,331,331,333,333,335,335,337,337,339,339,341,341,343,343,345,345,347,347,349,349,351,351,353,353,355,355,357,357,359,359,361,361,363,363,365,365,367,367,369,369,371,371,373,373,375,375,378,378,380,380,382,384,387,387,389,389,392,392,396,397,402,402,405,405,409,411,414,414,417,417,419,419,421,421,424,424,426,427,429,429,432,432,436,436,438,438,441,442,445,447,454,454,457,457,460,460,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,477,479,479,481,481,483,483,485,485,487,487,489,489,491,491,493,493,495,496,499,499,501,501,505,505,507,507,509,509,511,511,513,513,515,515,517,517,519,519,521,521,523,523,525,525,527,527,529,529,531,531,533,533,535,535,537,537,539,539,541,541,543,543,545,545,547,547,549,549,551,551,553,553,555,555,557,557,559,559,561,561,563,569,572,572,575,576,578,578,583,583,585,585,587,587,589,589,591,659,661,687,881,881,883,883,887,887,891,893,912,912,940,974,976,977,981,983,985,985,987,987,989,989,991,991,993,993,995,995,997,997,999,999,1001,1001,1003,1003,1005,1005,1007,1011,1013,1013,1016,1016,1019,1020,1072,1119,1121,1121,1123,1123,1125,1125,1127,1127,1129,1129,1131,1131,1133,1133,1135,1135,1137,1137,1139,1139,1141,1141,1143,1143,1145,1145,1147,1147,1149,1149,1151,1151,1153,1153,1163,1163,1165,1165,1167,1167,1169,1169,1171,1171,1173,1173,1175,1175,1177,1177,1179,1179,1181,1181,1183,1183,1185,1185,1187,1187,1189,1189,1191,1191,1193,1193,1195,1195,1197,1197,1199,1199,1201,1201,1203,1203,1205,1205,1207,1207,1209,1209,1211,1211,1213,1213,1215,1215,1218,1218,1220,1220,1222,1222,1224,1224,1226,1226,1228,1228,1230,1231,1233,1233,1235,1235,1237,1237,1239,1239,1241,1241,1243,1243,1245,1245,1247,1247,1249,1249,1251,1251,1253,1253,1255,1255,1257,1257,1259,1259,1261,1261,1263,1263,1265,1265,1267,1267,1269,1269,1271,1271,1273,1273,1275,1275,1277,1277,1279,1279,1281,1281,1283,1283,1285,1285,1287,1287,1289,1289,1291,1291,1293,1293,1295,1295,1297,1297,1299,1299,1301,1301,1303,1303,1305,1305,1307,1307,1309,1309,1311,1311,1313,1313,1315,1315,1317,1317,1319,1319,1321,1321,1323,1323,1325,1325,1327,1327,1376,1416,4304,4346,4349,4351,5112,5117,7296,7304,7306,7306,7424,7467,7531,7543,7545,7578,7681,7681,7683,7683,7685,7685,7687,7687,7689,7689,7691,7691,7693,7693,7695,7695,7697,7697,7699,7699,7701,7701,7703,7703,7705,7705,7707,7707,7709,7709,7711,7711,7713,7713,7715,7715,7717,7717,7719,7719,7721,7721,7723,7723,7725,7725,7727,7727,7729,7729,7731,7731,7733,7733,7735,7735,7737,7737,7739,7739,7741,7741,7743,7743,7745,7745,7747,7747,7749,7749,7751,7751,7753,7753,7755,7755,7757,7757,7759,7759,7761,7761,7763,7763,7765,7765,7767,7767,7769,7769,7771,7771,7773,7773,7775,7775,7777,7777,7779,7779,7781,7781,7783,7783,7785,7785,7787,7787,7789,7789,7791,7791,7793,7793,7795,7795,7797,7797,7799,7799,7801,7801,7803,7803,7805,7805,7807,7807,7809,7809,7811,7811,7813,7813,7815,7815,7817,7817,7819,7819,7821,7821,7823,7823,7825,7825,7827,7827,7829,7837,7839,7839,7841,7841,7843,7843,7845,7845,7847,7847,7849,7849,7851,7851,7853,7853,7855,7855,7857,7857,7859,7859,7861,7861,7863,7863,7865,7865,7867,7867,7869,7869,7871,7871,7873,7873,7875,7875,7877,7877,7879,7879,7881,7881,7883,7883,7885,7885,7887,7887,7889,7889,7891,7891,7893,7893,7895,7895,7897,7897,7899,7899,7901,7901,7903,7903,7905,7905,7907,7907,7909,7909,7911,7911,7913,7913,7915,7915,7917,7917,7919,7919,7921,7921,7923,7923,7925,7925,7927,7927,7929,7929,7931,7931,7933,7933,7935,7943,7952,7957,7968,7975,7984,7991,8e3,8005,8016,8023,8032,8039,8048,8061,8064,8071,8080,8087,8096,8103,8112,8116,8118,8119,8126,8126,8130,8132,8134,8135,8144,8147,8150,8151,8160,8167,8178,8180,8182,8183,8458,8458,8462,8463,8467,8467,8495,8495,8500,8500,8505,8505,8508,8509,8518,8521,8526,8526,8580,8580,11312,11359,11361,11361,11365,11366,11368,11368,11370,11370,11372,11372,11377,11377,11379,11380,11382,11387,11393,11393,11395,11395,11397,11397,11399,11399,11401,11401,11403,11403,11405,11405,11407,11407,11409,11409,11411,11411,11413,11413,11415,11415,11417,11417,11419,11419,11421,11421,11423,11423,11425,11425,11427,11427,11429,11429,11431,11431,11433,11433,11435,11435,11437,11437,11439,11439,11441,11441,11443,11443,11445,11445,11447,11447,11449,11449,11451,11451,11453,11453,11455,11455,11457,11457,11459,11459,11461,11461,11463,11463,11465,11465,11467,11467,11469,11469,11471,11471,11473,11473,11475,11475,11477,11477,11479,11479,11481,11481,11483,11483,11485,11485,11487,11487,11489,11489,11491,11492,11500,11500,11502,11502,11507,11507,11520,11557,11559,11559,11565,11565,42561,42561,42563,42563,42565,42565,42567,42567,42569,42569,42571,42571,42573,42573,42575,42575,42577,42577,42579,42579,42581,42581,42583,42583,42585,42585,42587,42587,42589,42589,42591,42591,42593,42593,42595,42595,42597,42597,42599,42599,42601,42601,42603,42603,42605,42605,42625,42625,42627,42627,42629,42629,42631,42631,42633,42633,42635,42635,42637,42637,42639,42639,42641,42641,42643,42643,42645,42645,42647,42647,42649,42649,42651,42651,42787,42787,42789,42789,42791,42791,42793,42793,42795,42795,42797,42797,42799,42801,42803,42803,42805,42805,42807,42807,42809,42809,42811,42811,42813,42813,42815,42815,42817,42817,42819,42819,42821,42821,42823,42823,42825,42825,42827,42827,42829,42829,42831,42831,42833,42833,42835,42835,42837,42837,42839,42839,42841,42841,42843,42843,42845,42845,42847,42847,42849,42849,42851,42851,42853,42853,42855,42855,42857,42857,42859,42859,42861,42861,42863,42863,42865,42872,42874,42874,42876,42876,42879,42879,42881,42881,42883,42883,42885,42885,42887,42887,42892,42892,42894,42894,42897,42897,42899,42901,42903,42903,42905,42905,42907,42907,42909,42909,42911,42911,42913,42913,42915,42915,42917,42917,42919,42919,42921,42921,42927,42927,42933,42933,42935,42935,42937,42937,42939,42939,42941,42941,42943,42943,42945,42945,42947,42947,42952,42952,42954,42954,42957,42957,42961,42961,42963,42963,42965,42965,42967,42967,42969,42969,42971,42971,42998,42998,43002,43002,43824,43866,43872,43880,43888,43967,64256,64262,64275,64279,65345,65370,66600,66639,66776,66811,66967,66977,66979,66993,66995,67001,67003,67004,68800,68850,68976,68997,71872,71903,93792,93823,119834,119859,119886,119892,119894,119911,119938,119963,119990,119993,119995,119995,119997,120003,120005,120015,120042,120067,120094,120119,120146,120171,120198,120223,120250,120275,120302,120327,120354,120379,120406,120431,120458,120485,120514,120538,120540,120545,120572,120596,120598,120603,120630,120654,120656,120661,120688,120712,120714,120719,120746,120770,120772,120777,120779,120779,122624,122633,122635,122654,122661,122666,125218,125251],Q.UPPER=[65,90,192,214,216,222,256,256,258,258,260,260,262,262,264,264,266,266,268,268,270,270,272,272,274,274,276,276,278,278,280,280,282,282,284,284,286,286,288,288,290,290,292,292,294,294,296,296,298,298,300,300,302,302,304,304,306,306,308,308,310,310,313,313,315,315,317,317,319,319,321,321,323,323,325,325,327,327,330,330,332,332,334,334,336,336,338,338,340,340,342,342,344,344,346,346,348,348,350,350,352,352,354,354,356,356,358,358,360,360,362,362,364,364,366,366,368,368,370,370,372,372,374,374,376,377,379,379,381,381,385,386,388,388,390,391,393,395,398,401,403,404,406,408,412,413,415,416,418,418,420,420,422,423,425,425,428,428,430,431,433,435,437,437,439,440,444,444,452,453,455,456,458,459,461,461,463,463,465,465,467,467,469,469,471,471,473,473,475,475,478,478,480,480,482,482,484,484,486,486,488,488,490,490,492,492,494,494,497,498,500,500,502,504,506,506,508,508,510,510,512,512,514,514,516,516,518,518,520,520,522,522,524,524,526,526,528,528,530,530,532,532,534,534,536,536,538,538,540,540,542,542,544,544,546,546,548,548,550,550,552,552,554,554,556,556,558,558,560,560,562,562,570,571,573,574,577,577,579,582,584,584,586,586,588,588,590,590,880,880,882,882,886,886,895,895,902,902,904,906,908,908,910,911,913,929,931,939,975,975,978,980,984,984,986,986,988,988,990,990,992,992,994,994,996,996,998,998,1e3,1e3,1002,1002,1004,1004,1006,1006,1012,1012,1015,1015,1017,1018,1021,1071,1120,1120,1122,1122,1124,1124,1126,1126,1128,1128,1130,1130,1132,1132,1134,1134,1136,1136,1138,1138,1140,1140,1142,1142,1144,1144,1146,1146,1148,1148,1150,1150,1152,1152,1162,1162,1164,1164,1166,1166,1168,1168,1170,1170,1172,1172,1174,1174,1176,1176,1178,1178,1180,1180,1182,1182,1184,1184,1186,1186,1188,1188,1190,1190,1192,1192,1194,1194,1196,1196,1198,1198,1200,1200,1202,1202,1204,1204,1206,1206,1208,1208,1210,1210,1212,1212,1214,1214,1216,1217,1219,1219,1221,1221,1223,1223,1225,1225,1227,1227,1229,1229,1232,1232,1234,1234,1236,1236,1238,1238,1240,1240,1242,1242,1244,1244,1246,1246,1248,1248,1250,1250,1252,1252,1254,1254,1256,1256,1258,1258,1260,1260,1262,1262,1264,1264,1266,1266,1268,1268,1270,1270,1272,1272,1274,1274,1276,1276,1278,1278,1280,1280,1282,1282,1284,1284,1286,1286,1288,1288,1290,1290,1292,1292,1294,1294,1296,1296,1298,1298,1300,1300,1302,1302,1304,1304,1306,1306,1308,1308,1310,1310,1312,1312,1314,1314,1316,1316,1318,1318,1320,1320,1322,1322,1324,1324,1326,1326,1329,1366,4256,4293,4295,4295,4301,4301,5024,5109,7305,7305,7312,7354,7357,7359,7680,7680,7682,7682,7684,7684,7686,7686,7688,7688,7690,7690,7692,7692,7694,7694,7696,7696,7698,7698,7700,7700,7702,7702,7704,7704,7706,7706,7708,7708,7710,7710,7712,7712,7714,7714,7716,7716,7718,7718,7720,7720,7722,7722,7724,7724,7726,7726,7728,7728,7730,7730,7732,7732,7734,7734,7736,7736,7738,7738,7740,7740,7742,7742,7744,7744,7746,7746,7748,7748,7750,7750,7752,7752,7754,7754,7756,7756,7758,7758,7760,7760,7762,7762,7764,7764,7766,7766,7768,7768,7770,7770,7772,7772,7774,7774,7776,7776,7778,7778,7780,7780,7782,7782,7784,7784,7786,7786,7788,7788,7790,7790,7792,7792,7794,7794,7796,7796,7798,7798,7800,7800,7802,7802,7804,7804,7806,7806,7808,7808,7810,7810,7812,7812,7814,7814,7816,7816,7818,7818,7820,7820,7822,7822,7824,7824,7826,7826,7828,7828,7838,7838,7840,7840,7842,7842,7844,7844,7846,7846,7848,7848,7850,7850,7852,7852,7854,7854,7856,7856,7858,7858,7860,7860,7862,7862,7864,7864,7866,7866,7868,7868,7870,7870,7872,7872,7874,7874,7876,7876,7878,7878,7880,7880,7882,7882,7884,7884,7886,7886,7888,7888,7890,7890,7892,7892,7894,7894,7896,7896,7898,7898,7900,7900,7902,7902,7904,7904,7906,7906,7908,7908,7910,7910,7912,7912,7914,7914,7916,7916,7918,7918,7920,7920,7922,7922,7924,7924,7926,7926,7928,7928,7930,7930,7932,7932,7934,7934,7944,7951,7960,7965,7976,7983,7992,7999,8008,8013,8025,8025,8027,8027,8029,8029,8031,8031,8040,8047,8072,8079,8088,8095,8104,8111,8120,8124,8136,8140,8152,8155,8168,8172,8184,8188,8450,8450,8455,8455,8459,8461,8464,8466,8469,8469,8473,8477,8484,8484,8486,8486,8488,8488,8490,8493,8496,8499,8510,8511,8517,8517,8579,8579,11264,11311,11360,11360,11362,11364,11367,11367,11369,11369,11371,11371,11373,11376,11378,11378,11381,11381,11390,11392,11394,11394,11396,11396,11398,11398,11400,11400,11402,11402,11404,11404,11406,11406,11408,11408,11410,11410,11412,11412,11414,11414,11416,11416,11418,11418,11420,11420,11422,11422,11424,11424,11426,11426,11428,11428,11430,11430,11432,11432,11434,11434,11436,11436,11438,11438,11440,11440,11442,11442,11444,11444,11446,11446,11448,11448,11450,11450,11452,11452,11454,11454,11456,11456,11458,11458,11460,11460,11462,11462,11464,11464,11466,11466,11468,11468,11470,11470,11472,11472,11474,11474,11476,11476,11478,11478,11480,11480,11482,11482,11484,11484,11486,11486,11488,11488,11490,11490,11499,11499,11501,11501,11506,11506,42560,42560,42562,42562,42564,42564,42566,42566,42568,42568,42570,42570,42572,42572,42574,42574,42576,42576,42578,42578,42580,42580,42582,42582,42584,42584,42586,42586,42588,42588,42590,42590,42592,42592,42594,42594,42596,42596,42598,42598,42600,42600,42602,42602,42604,42604,42624,42624,42626,42626,42628,42628,42630,42630,42632,42632,42634,42634,42636,42636,42638,42638,42640,42640,42642,42642,42644,42644,42646,42646,42648,42648,42650,42650,42786,42786,42788,42788,42790,42790,42792,42792,42794,42794,42796,42796,42798,42798,42802,42802,42804,42804,42806,42806,42808,42808,42810,42810,42812,42812,42814,42814,42816,42816,42818,42818,42820,42820,42822,42822,42824,42824,42826,42826,42828,42828,42830,42830,42832,42832,42834,42834,42836,42836,42838,42838,42840,42840,42842,42842,42844,42844,42846,42846,42848,42848,42850,42850,42852,42852,42854,42854,42856,42856,42858,42858,42860,42860,42862,42862,42873,42873,42875,42875,42877,42878,42880,42880,42882,42882,42884,42884,42886,42886,42891,42891,42893,42893,42896,42896,42898,42898,42902,42902,42904,42904,42906,42906,42908,42908,42910,42910,42912,42912,42914,42914,42916,42916,42918,42918,42920,42920,42922,42926,42928,42932,42934,42934,42936,42936,42938,42938,42940,42940,42942,42942,42944,42944,42946,42946,42948,42951,42953,42953,42955,42956,42960,42960,42966,42966,42968,42968,42970,42970,42972,42972,42997,42997,65313,65338,66560,66599,66736,66771,66928,66938,66940,66954,66956,66962,66964,66965,68736,68786,68944,68965,71840,71871,93760,93791,119808,119833,119860,119885,119912,119937,119964,119964,119966,119967,119970,119970,119973,119974,119977,119980,119982,119989,120016,120041,120068,120069,120071,120074,120077,120084,120086,120092,120120,120121,120123,120126,120128,120132,120134,120134,120138,120144,120172,120197,120224,120249,120276,120301,120328,120353,120380,120405,120432,120457,120488,120512,120546,120570,120604,120628,120662,120686,120720,120744,120778,120778,125184,125217],Q.LATIN=[65,90,97,122,192,214,216,246,248,687,7424,7461,7522,7525,7531,7543,7545,7578,7680,7935,8305,8305,8319,8319,8336,8348,8580,8580,11360,11388,11390,11391,42786,42863,42865,42887,42891,42957,42960,42961,42963,42963,42965,42972,42997,42999,43002,43007,43824,43866,43872,43876,43878,43880,64256,64262,65313,65338,65345,65370,122624,122654,122661,122666],Q.GREEK=[880,884,886,887,890,893,895,895,902,902,904,906,908,908,910,929,931,993,1008,1013,1015,1023,7462,7466,7518,7518,7520,7520,7526,7530,7936,7957,7960,7965,7968,8005,8008,8013,8016,8023,8025,8025,8027,8027,8029,8029,8031,8061,8064,8116,8118,8124,8126,8126,8130,8132,8134,8140,8144,8147,8150,8155,8160,8172,8178,8180,8182,8188,43877,43877],Q.CYRILLIC=[1024,1153,1162,1327,7296,7306,7467,7467,7544,7544,42560,42606,42623,42653,122928,122989],Gl.INITIAL_SIZE=16,Gl.LOAD_FACTOR=.75,Yt._hx_skip_constructor=!1,Rt.HOST_VALUE_MAX_DEPTH=64,Rt.NO_RULES=[],Rt.MIN_INDEXED_RUN=16,Ul.ChoiceBrace=0,Ul.ChoiceIndent=1,Ul.WhenBrace=2,Ul.WhenIndent=3,Ul.StateBrace=4,Ul.StateIndent=5,Ul.CharacterBrace=6,Ul.CharacterIndent=7,Ul.BeatBrace=8,Ul.BeatIndent=9,Ul.AlternativeBrace=10,Ul.AlternativeIndent=11,Ul.Brace=12,Ul.Indent=13,Ul.Bracket=14,Bt.hasNonSpecialChar_specialChars=` "+=*/-(){}[]:
90
+ \r`,Bt.KEYWORDS=(function(b){var e;let t=new Ce;return t.h.import=x.KwImport,t.h.state=x.KwState,t.h.beat=x.KwBeat,t.h.character=x.KwCharacter,t.h.choice=x.KwChoice,t.h.if=x.KwIf,t.h.else=x.KwElse,t.h.new=x.KwNew,t.h.sequence=x.KwSequence,t.h.cycle=x.KwCycle,t.h.once=x.KwOnce,t.h.pick=x.KwPick,t.h.shuffle=x.KwShuffle,t.h.true=x.LBoolean(!0),t.h.false=x.LBoolean(!1),t.h.null=x.LNull,t.h.and=x.OpAnd(!0),t.h.or=x.OpOr(!0),t.h.is=x.OpEquals(!0),t.h.not=x.OpNot(!0),e=t,e})(this),vl.TRANSLATIONS_LOCALE="$locale",We.OFFSET=32768,We.MAX=65535,We.UNDEFINED=new We(0,0,0,0),_t._hx_skip_constructor=!1,Wl.Plain=0,Wl.Braces=1,ji.Plain=0,ji.Parens=2,Xi.Sequence=0,Xi.Cycle=1,Xi.Once=2,Xi.Pick=3,Xi.Shuffle=4,Rn.Unquoted=0,Rn.DoubleQuotes=1,je.emoji="\u{1F600}",je.UNITS_PER_EMOJI=je.emoji.length,je.LOWER_LETTERS="abcdefghijklmnopqrstuvwxyz\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xFF\u0101\u0103\u0105\u0107\u0109\u010B\u010D\u010F\u0111\u0113\u0115\u0117\u0119\u011B\u011D\u011F\u0121\u0123\u0125\u0127\u0129\u012B\u012D\u012F\u0133\u0135\u0137\u014B\u014D\u014F\u0151\u0153\u0155\u0157\u0159\u015B\u015D\u015F\u0161\u0163\u0165\u0167\u0169\u016B\u016D\u016F\u0171\u0173\u0175\u0177\u013A\u013C\u013E\u0140\u0142\u0144\u0146\u0148\u017A\u017C\u017E\u03B1\u03B2\u03B3\u03B4\u03B5\u03B6\u03B7\u03B8\u03B9\u03BA\u03BB\u03BC\u03BD\u03BE\u03BF\u03C0\u03C1\u03C3\u03C4\u03C5\u03C6\u03C7\u03C8\u03C9\u03AC\u03AD\u03AE\u03AF\u03CC\u03CD\u03CE\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043A\u043B\u043C\u043D\u043E\u043F\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044A\u044B\u044C\u044D\u044E\u044F\u0450\u0451\u0452\u0453\u0454\u0455\u0456\u0457\u0458\u0459\u045A\u045B\u045C\u045D\u045E\u045F",je.UPPER_LETTERS="ABCDEFGHIJKLMNOPQRSTUVWXYZ\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1\xD2\xD3\xD4\xD5\xD6\xD8\xD9\xDA\xDB\xDC\xDD\xDE\u0178\u0100\u0102\u0104\u0106\u0108\u010A\u010C\u010E\u0110\u0112\u0114\u0116\u0118\u011A\u011C\u011E\u0120\u0122\u0124\u0126\u0128\u012A\u012C\u012E\u0132\u0134\u0136\u014A\u014C\u014E\u0150\u0152\u0154\u0156\u0158\u015A\u015C\u015E\u0160\u0162\u0164\u0166\u0168\u016A\u016C\u016E\u0170\u0172\u0174\u0176\u0139\u013B\u013D\u013F\u0141\u0143\u0145\u0147\u0179\u017B\u017D\u0391\u0392\u0393\u0394\u0395\u0396\u0397\u0398\u0399\u039A\u039B\u039C\u039D\u039E\u039F\u03A0\u03A1\u03A3\u03A4\u03A5\u03A6\u03A7\u03A8\u03A9\u0386\u0388\u0389\u038A\u038C\u038E\u038F\u0410\u0411\u0412\u0413\u0414\u0415\u0416\u0417\u0418\u0419\u041A\u041B\u041C\u041D\u041E\u041F\u0420\u0421\u0422\u0423\u0424\u0425\u0426\u0427\u0428\u0429\u042A\u042B\u042C\u042D\u042E\u042F\u0400\u0401\u0402\u0403\u0404\u0405\u0406\u0407\u0408\u0409\u040A\u040B\u040C\u040D\u040E\u040F",bi.timers=[],z.POWERS_OF_TEN=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13,1e14,1e15,1e16,1e17,1e18,1e19,1e20,1e21,1e22],qe.locale="en",qe.tables=new Ce,jl.formats=[{name:"po",ext:".po"},{name:"xliff",ext:".xliff"},{name:"xliff",ext:".xlf"},{name:"csv",ext:".csv"},{name:"csv",ext:".tsv"}],jl.enabled=new Ce,Dn.main()})(sn,hs);export const Loreline=sn.loreline.Loreline,Interpreter=sn.loreline.Interpreter,Node=sn.loreline.Node,Script=sn.loreline.Script,I18n=sn.loreline.i18n.I18n;