UNPKG

lix

Version:

lix - Libraries for Haxe

2 lines 222 kB
#!/usr/bin/env node (()=>{var e={293:function(e,t,r){(function(e){"use strict";var $estr=function(){return js_Boot.__string_rec(this,"")},t=t||{},n;function $extend(e,t){var r=Object.create(e);for(var n in t)r[n]=t[n];if(t.toString!==Object.prototype.toString)r.toString=t.toString;return r}var i=t["Attribute"]={__ename__:true,__constructs__:["Off","Bold","Underline","Blink","ReverseVideo","Concealed","BoldOff","UnderlineOff","BlinkOff","NormalVideo","ConcealedOff","Black","Red","Green","Yellow","Blue","Magenta","Cyan","White","DefaultForeground","BlackBack","RedBack","GreenBack","YellowBack","BlueBack","MagentaBack","CyanBack","WhiteBack","DefaultBackground"],Off:{_hx_index:0,__enum__:"Attribute",toString:$estr},Bold:{_hx_index:1,__enum__:"Attribute",toString:$estr},Underline:{_hx_index:2,__enum__:"Attribute",toString:$estr},Blink:{_hx_index:3,__enum__:"Attribute",toString:$estr},ReverseVideo:{_hx_index:4,__enum__:"Attribute",toString:$estr},Concealed:{_hx_index:5,__enum__:"Attribute",toString:$estr},BoldOff:{_hx_index:6,__enum__:"Attribute",toString:$estr},UnderlineOff:{_hx_index:7,__enum__:"Attribute",toString:$estr},BlinkOff:{_hx_index:8,__enum__:"Attribute",toString:$estr},NormalVideo:{_hx_index:9,__enum__:"Attribute",toString:$estr},ConcealedOff:{_hx_index:10,__enum__:"Attribute",toString:$estr},Black:{_hx_index:11,__enum__:"Attribute",toString:$estr},Red:{_hx_index:12,__enum__:"Attribute",toString:$estr},Green:{_hx_index:13,__enum__:"Attribute",toString:$estr},Yellow:{_hx_index:14,__enum__:"Attribute",toString:$estr},Blue:{_hx_index:15,__enum__:"Attribute",toString:$estr},Magenta:{_hx_index:16,__enum__:"Attribute",toString:$estr},Cyan:{_hx_index:17,__enum__:"Attribute",toString:$estr},White:{_hx_index:18,__enum__:"Attribute",toString:$estr},DefaultForeground:{_hx_index:19,__enum__:"Attribute",toString:$estr},BlackBack:{_hx_index:20,__enum__:"Attribute",toString:$estr},RedBack:{_hx_index:21,__enum__:"Attribute",toString:$estr},GreenBack:{_hx_index:22,__enum__:"Attribute",toString:$estr},YellowBack:{_hx_index:23,__enum__:"Attribute",toString:$estr},BlueBack:{_hx_index:24,__enum__:"Attribute",toString:$estr},MagentaBack:{_hx_index:25,__enum__:"Attribute",toString:$estr},CyanBack:{_hx_index:26,__enum__:"Attribute",toString:$estr},WhiteBack:{_hx_index:27,__enum__:"Attribute",toString:$estr},DefaultBackground:{_hx_index:28,__enum__:"Attribute",toString:$estr}};var Sys=function(){};Sys.__name__=true;Sys.systemName=function(){var e=process.platform;switch(e){case"darwin":return"Mac";case"freebsd":return"BSD";case"linux":return"Linux";case"win32":return"Windows";default:var t=e;return t}};var s=r(2081);var Reflect=function(){};Reflect.__name__=true;Reflect.field=function(e,t){try{return e[t]}catch(e){var r=e instanceof js__$Boot_HaxeError?e.val:e;return null}};Reflect.fields=function(e){var t=[];if(e!=null){var r=Object.prototype.hasOwnProperty;for(var n in e){if(n!="__id__"&&n!="hx__closures__"&&r.call(e,n)){t.push(n)}}}return t};Reflect.compare=function(e,t){if(e==t){return 0}else if(e>t){return 1}else{return-1}};Reflect.isEnumValue=function(e){if(e!=null){return e.__enum__!=null}else{return false}};Reflect.copy=function(e){if(e==null){return null}var t={};var r=0;var n=Reflect.fields(e);while(r<n.length){var i=n[r];++r;t[i]=Reflect.field(e,i)}return t};var js_Boot=function(){};js_Boot.__name__=true;js_Boot.getClass=function(e){if(e==null){return null}else if(e instanceof Array){return Array}else{var t=e.__class__;if(t!=null){return t}var r=js_Boot.__nativeClassName(e);if(r!=null){return js_Boot.__resolveNativeClass(r)}return null}};js_Boot.__string_rec=function(e,r){if(e==null){return"null"}if(r.length>=5){return"<...>"}var n=typeof e;if(n=="function"&&(e.__name__||e.__ename__)){n="object"}switch(n){case"function":return"<function>";case"object":if(e.__enum__){var i=t[e.__enum__];var s=i.__constructs__[e._hx_index];var a=i[s];if(a.__params__){r=r+"\t";return s+"("+function(t){var n;var i=[];{var s=0;var o=a.__params__;while(true){if(!(s<o.length)){break}var l=o[s];s=s+1;i.push(js_Boot.__string_rec(e[l],r))}}n=i;return n}(this).join(",")+")"}else{return s}}if(e instanceof Array){var o="[";r+="\t";var l=0;var c=e.length;while(l<c){var u=l++;o+=(u>0?",":"")+js_Boot.__string_rec(e[u],r)}o+="]";return o}var h;try{h=e.toString}catch(e){var d=e instanceof js__$Boot_HaxeError?e.val:e;return"???"}if(h!=null&&h!=Object.toString&&typeof h=="function"){var p=e.toString();if(p!="[object Object]"){return p}}var m="{\n";r+="\t";var _=e.hasOwnProperty!=null;var v=null;for(v in e){if(_&&!e.hasOwnProperty(v)){continue}if(v=="prototype"||v=="__class__"||v=="__super__"||v=="__interfaces__"||v=="__properties__"){continue}if(m.length!=2){m+=", \n"}m+=r+v+" : "+js_Boot.__string_rec(e[v],r)}r=r.substring(1);m+="\n"+r+"}";return m;case"string":return e;default:return String(e)}};js_Boot.__interfLoop=function(e,t){if(e==null){return false}if(e==t){return true}if(Object.prototype.hasOwnProperty.call(e,"__interfaces__")){var r=e.__interfaces__;var n=0;var i=r.length;while(n<i){var s=n++;var a=r[s];if(a==t||js_Boot.__interfLoop(a,t)){return true}}}return js_Boot.__interfLoop(e.__super__,t)};js_Boot.__instanceof=function(e,r){if(r==null){return false}switch(r){case Array:return e instanceof Array;case Y:return typeof e=="boolean";case H:return e!=null;case j:return typeof e=="number";case W:if(typeof e=="number"){return(e|0)===e}else{return false}break;case String:return typeof e=="string";default:if(e!=null){if(typeof r=="function"){if(js_Boot.__downcastCheck(e,r)){return true}}else if(typeof r=="object"&&js_Boot.__isNativeObj(r)){if(e instanceof r){return true}}}else{return false}if(r==G?e.__name__!=null:false){return true}if(r==V?e.__ename__!=null:false){return true}return e.__enum__!=null?t[e.__enum__]==r:false}};js_Boot.__downcastCheck=function(e,t){if(!(e instanceof t)){if(t.__isInterface__){return js_Boot.__interfLoop(js_Boot.getClass(e),t)}else{return false}}else{return true}};js_Boot.__nativeClassName=function(e){var t=js_Boot.__toStr.call(e).slice(8,-1);if(t=="Object"||t=="Function"||t=="Math"||t=="JSON"){return null}return t};js_Boot.__isNativeObj=function(e){return js_Boot.__nativeClassName(e)!=null};js_Boot.__resolveNativeClass=function(t){return e[t]};var Std=function(){};Std.__name__=true;Std.string=function(e){return js_Boot.__string_rec(e,"")};Std.parseInt=function(e){if(e!=null){var t=0;var r=e.length;while(t<r){var n=t++;var i=e.charCodeAt(n);if(i<=8||i>=14&&i!=32&&i!=45){var s=parseInt(e,e[n+1]=="x"||e[n+1]=="X"?16:10);if(isNaN(s)){return null}else{return s}}}}return null};var ANSI=function(){};ANSI.__name__=true;ANSI.aset=function(e){if(ANSI.strip||ANSI.stripIfUnavailable&&!ANSI.available){return""}var t=""+"[";var r=[];var n=0;while(n<e.length){var s=e[n];++n;if(!js_Boot.__instanceof(s,i)){throw new js__$Boot_HaxeError("Set argument is not an Attribute: "+Std.string(s))}r.push(ANSI.values.get(s))}return t+r.join(";")+"m"};ANSI.detectSupport=function(){if(Sys.systemName().toLowerCase().indexOf("window")==-1){var e=-1;try{e=s.spawnSync("tput",["colors"]).error==null?0:125}catch(e){var t=e instanceof js__$Boot_HaxeError?e.val:e}return e==0}else{return process.env["ANSICON"]!=null}};var DateTools=function(){};DateTools.__name__=true;DateTools.__format_get=function(e,t){switch(t){case"%":return"%";case"A":return DateTools.DAY_NAMES[e.getDay()];case"B":return DateTools.MONTH_NAMES[e.getMonth()];case"C":return StringTools.lpad(Std.string(e.getFullYear()/100|0),"0",2);case"D":return DateTools.__format(e,"%m/%d/%y");case"F":return DateTools.__format(e,"%Y-%m-%d");case"I":case"l":var r=e.getHours()%12;return StringTools.lpad(Std.string(r==0?12:r),t=="I"?"0":" ",2);case"M":return StringTools.lpad(Std.string(e.getMinutes()),"0",2);case"R":return DateTools.__format(e,"%H:%M");case"S":return StringTools.lpad(Std.string(e.getSeconds()),"0",2);case"T":return DateTools.__format(e,"%H:%M:%S");case"Y":return Std.string(e.getFullYear());case"a":return DateTools.DAY_SHORT_NAMES[e.getDay()];case"b":case"h":return DateTools.MONTH_SHORT_NAMES[e.getMonth()];case"d":return StringTools.lpad(Std.string(e.getDate()),"0",2);case"e":return Std.string(e.getDate());case"H":case"k":return StringTools.lpad(Std.string(e.getHours()),t=="H"?"0":" ",2);case"m":return StringTools.lpad(Std.string(e.getMonth()+1),"0",2);case"n":return"\n";case"p":if(e.getHours()>11){return"PM"}else{return"AM"}break;case"r":return DateTools.__format(e,"%I:%M:%S %p");case"s":return Std.string(e.getTime()/1e3|0);case"t":return"\t";case"u":var n=e.getDay();if(n==0){return"7"}else if(n==null){return"null"}else{return""+n}break;case"w":return Std.string(e.getDay());case"y":return StringTools.lpad(Std.string(e.getFullYear()%100),"0",2);default:throw new js__$Boot_HaxeError("Date.format %"+t+"- not implemented yet.")}};DateTools.__format=function(e,t){var r="";var n=0;while(true){var i=t.indexOf("%",n);if(i<0){break}var s=i-n;r+=s==null?HxOverrides.substr(t,n,null):HxOverrides.substr(t,n,s);r+=Std.string(DateTools.__format_get(e,HxOverrides.substr(t,i+1,1)));n=i+2}var a=t.length-n;r+=a==null?HxOverrides.substr(t,n,null):HxOverrides.substr(t,n,a);return r};DateTools.format=function(e,t){return DateTools.__format(e,t)};var EReg=function(e,t){this.r=new RegExp(e,t.split("u").join(""))};EReg.__name__=true;EReg.prototype={match:function(e){if(this.r.global){this.r.lastIndex=0}this.r.m=this.r.exec(e);this.r.s=e;return this.r.m!=null},__class__:EReg};var HxOverrides=function(){};HxOverrides.__name__=true;HxOverrides.dateStr=function(e){var t=e.getMonth()+1;var r=e.getDate();var n=e.getHours();var i=e.getMinutes();var s=e.getSeconds();return e.getFullYear()+"-"+(t<10?"0"+t:""+t)+"-"+(r<10?"0"+r:""+r)+" "+(n<10?"0"+n:""+n)+":"+(i<10?"0"+i:""+i)+":"+(s<10?"0"+s:""+s)};HxOverrides.strDate=function(e){switch(e.length){case 8:var t=e.split(":");var r=new Date;r["setTime"](0);r["setUTCHours"](t[0]);r["setUTCMinutes"](t[1]);r["setUTCSeconds"](t[2]);return r;case 10:var n=e.split("-");return new Date(n[0],n[1]-1,n[2],0,0,0);case 19:var i=e.split(" ");var s=i[0].split("-");var a=i[1].split(":");return new Date(s[0],s[1]-1,s[2],a[0],a[1],a[2]);default:throw new js__$Boot_HaxeError("Invalid date format : "+e)}};HxOverrides.cca=function(e,t){var r=e.charCodeAt(t);if(r!=r){return undefined}return r};HxOverrides.substr=function(e,t,r){if(r==null){r=e.length}else if(r<0){if(t==0){r=e.length+r}else{return""}}return e.substr(t,r)};HxOverrides.iter=function(e){return{cur:0,arr:e,hasNext:function(){return this.cur<this.arr.length},next:function(){return this.arr[this.cur++]}}};var Lambda=function(){};Lambda.__name__=true;Lambda.has=function(e,t){var r=$getIterator(e);while(r.hasNext()){var n=r.next();if(n==t){return true}}return false};Math.__name__=true;var StringTools=function(){};StringTools.__name__=true;StringTools.startsWith=function(e,t){if(e.length>=t.length){return e.lastIndexOf(t,0)==0}else{return false}};StringTools.endsWith=function(e,t){var r=t.length;var n=e.length;if(n>=r){return e.indexOf(t,n-r)==n-r}else{return false}};StringTools.isSpace=function(e,t){var r=HxOverrides.cca(e,t);if(!(r>8&&r<14)){return r==32}else{return true}};StringTools.ltrim=function(e){var t=e.length;var r=0;while(r<t&&StringTools.isSpace(e,r))++r;if(r>0){return HxOverrides.substr(e,r,t-r)}else{return e}};StringTools.rtrim=function(e){var t=e.length;var r=0;while(r<t&&StringTools.isSpace(e,t-r-1))++r;if(r>0){return HxOverrides.substr(e,0,t-r)}else{return e}};StringTools.trim=function(e){return StringTools.ltrim(StringTools.rtrim(e))};StringTools.lpad=function(e,t,r){if(t.length<=0){return e}var n="";r-=e.length;while(n.length<r)n+=t==null?"null":""+t;n+=e==null?"null":""+e;return n};StringTools.replace=function(e,t,r){return e.split(t).join(r)};var haxe_io_Output=function(){};haxe_io_Output.__name__=true;haxe_io_Output.prototype={writeByte:function(e){throw new js__$Boot_HaxeError("Not implemented")},writeBytes:function(e,t,r){if(t<0||r<0||t+r>e.length){throw new js__$Boot_HaxeError(c.OutsideBounds)}var n=e.b;var i=r;while(i>0){this.writeByte(n[t]);++t;--i}return r},writeFullBytes:function(e,t,r){while(r>0){var n=this.writeBytes(e,t,r);t+=n;r-=n}},writeString:function(e,t){var r=haxe_io_Bytes.ofString(e,t);this.writeFullBytes(r,0,r.length)},__class__:haxe_io_Output};var _$Sys_FileOutput=function(e){this.fd=e};_$Sys_FileOutput.__name__=true;_$Sys_FileOutput.__super__=haxe_io_Output;_$Sys_FileOutput.prototype=$extend(haxe_io_Output.prototype,{writeByte:function(e){v.writeSync(this.fd,String.fromCodePoint(e))},writeBytes:function(e,t,r){var n=e.b;return v.writeSync(this.fd,E.from(n.buffer,n.byteOffset,e.length),t,r)},writeString:function(e,t){v.writeSync(this.fd,e)},__class__:_$Sys_FileOutput});var Type=function(){};Type.__name__=true;Type.enumParameters=function(e){var r=t[e.__enum__];var n=r.__constructs__[e._hx_index];var i=r[n].__params__;if(i!=null){var s=[];var a=0;while(a<i.length){var o=i[a];++a;s.push(e[o])}return s}else{return[]}};var a=t["haxe.StackItem"]={__ename__:true,__constructs__:["CFunction","Module","FilePos","Method","LocalFunction"],CFunction:{_hx_index:0,__enum__:"haxe.StackItem",toString:$estr},Module:(n=function(e){return{_hx_index:1,m:e,__enum__:"haxe.StackItem",toString:$estr}},n.__params__=["m"],n),FilePos:(n=function(e,t,r,n){return{_hx_index:2,s:e,file:t,line:r,column:n,__enum__:"haxe.StackItem",toString:$estr}},n.__params__=["s","file","line","column"],n),Method:(n=function(e,t){return{_hx_index:3,classname:e,method:t,__enum__:"haxe.StackItem",toString:$estr}},n.__params__=["classname","method"],n),LocalFunction:(n=function(e){return{_hx_index:4,v:e,__enum__:"haxe.StackItem",toString:$estr}},n.__params__=["v"],n)};var haxe_IMap=function(){};haxe_IMap.__name__=true;haxe_IMap.__isInterface__=true;var haxe_Timer=function(e){var t=this;this.id=setInterval((function(){t.run()}),e)};haxe_Timer.__name__=true;haxe_Timer.delay=function(e,t){var r=new haxe_Timer(t);r.run=function(){r.stop();e()};return r};haxe_Timer.prototype={stop:function(){if(this.id==null){return}clearInterval(this.id);this.id=null},run:function(){},__class__:haxe_Timer};var haxe_ds_BalancedTree=function(){};haxe_ds_BalancedTree.__name__=true;haxe_ds_BalancedTree.__interfaces__=[haxe_IMap];haxe_ds_BalancedTree.prototype={set:function(e,t){this.root=this.setLoop(e,t,this.root)},get:function(e){var t=this.root;while(t!=null){var r=this.compare(e,t.key);if(r==0){return t.value}if(r<0){t=t.left}else{t=t.right}}return null},setLoop:function(e,t,r){if(r==null){return new haxe_ds_TreeNode(null,e,t,null)}var n=this.compare(e,r.key);if(n==0){return new haxe_ds_TreeNode(r.left,e,t,r.right,r==null?0:r._height)}else if(n<0){var i=this.setLoop(e,t,r.left);return this.balance(i,r.key,r.value,r.right)}else{var s=this.setLoop(e,t,r.right);return this.balance(r.left,r.key,r.value,s)}},balance:function(e,t,r,n){var i=e==null?0:e._height;var s=n==null?0:n._height;if(i>s+2){var a=e.left;var o=e.right;if((a==null?0:a._height)>=(o==null?0:o._height)){return new haxe_ds_TreeNode(e.left,e.key,e.value,new haxe_ds_TreeNode(e.right,t,r,n))}else{return new haxe_ds_TreeNode(new haxe_ds_TreeNode(e.left,e.key,e.value,e.right.left),e.right.key,e.right.value,new haxe_ds_TreeNode(e.right.right,t,r,n))}}else if(s>i+2){var l=n.right;var c=n.left;if((l==null?0:l._height)>(c==null?0:c._height)){return new haxe_ds_TreeNode(new haxe_ds_TreeNode(e,t,r,n.left),n.key,n.value,n.right)}else{return new haxe_ds_TreeNode(new haxe_ds_TreeNode(e,t,r,n.left.left),n.left.key,n.left.value,new haxe_ds_TreeNode(n.left.right,n.key,n.value,n.right))}}else{return new haxe_ds_TreeNode(e,t,r,n,(i>s?i:s)+1)}},compare:function(e,t){return Reflect.compare(e,t)},__class__:haxe_ds_BalancedTree};var haxe_ds_TreeNode=function(e,t,r,n,i){if(i==null){i=-1}this.left=e;this.key=t;this.value=r;this.right=n;if(i==-1){var s;var a=this.left;var o=this.right;if((a==null?0:a._height)>(o==null?0:o._height)){var l=this.left;s=l==null?0:l._height}else{var c=this.right;s=c==null?0:c._height}this._height=s+1}else{this._height=i}};haxe_ds_TreeNode.__name__=true;haxe_ds_TreeNode.prototype={__class__:haxe_ds_TreeNode};var haxe_ds_EnumValueMap=function(){haxe_ds_BalancedTree.call(this)};haxe_ds_EnumValueMap.__name__=true;haxe_ds_EnumValueMap.__interfaces__=[haxe_IMap];haxe_ds_EnumValueMap.__super__=haxe_ds_BalancedTree;haxe_ds_EnumValueMap.prototype=$extend(haxe_ds_BalancedTree.prototype,{compare:function(e,t){var r=e._hx_index-t._hx_index;if(r!=0){return r}var n=Type.enumParameters(e);var i=Type.enumParameters(t);if(n.length==0&&i.length==0){return 0}return this.compareArgs(n,i)},compareArgs:function(e,t){var r=e.length-t.length;if(r!=0){return r}var n=0;var i=e.length;while(n<i){var s=n++;var a=this.compareArg(e[s],t[s]);if(a!=0){return a}}return 0},compareArg:function(e,t){if(Reflect.isEnumValue(e)&&Reflect.isEnumValue(t)){return this.compare(e,t)}else if(e instanceof Array&&t instanceof Array){return this.compareArgs(e,t)}else{return Reflect.compare(e,t)}},__class__:haxe_ds_EnumValueMap});var haxe_ds_IntMap=function(){this.h={}};haxe_ds_IntMap.__name__=true;haxe_ds_IntMap.__interfaces__=[haxe_IMap];haxe_ds_IntMap.prototype={__class__:haxe_ds_IntMap};var o=t["haxe.ds.Option"]={__ename__:true,__constructs__:["Some","None"],Some:(n=function(e){return{_hx_index:0,v:e,__enum__:"haxe.ds.Option",toString:$estr}},n.__params__=["v"],n),None:{_hx_index:1,__enum__:"haxe.ds.Option",toString:$estr}};var haxe_ds_StringMap=function(){this.h={}};haxe_ds_StringMap.__name__=true;haxe_ds_StringMap.__interfaces__=[haxe_IMap];haxe_ds_StringMap.prototype={setReserved:function(e,t){if(this.rh==null){this.rh={}}this.rh["$"+e]=t},getReserved:function(e){if(this.rh==null){return null}else{return this.rh["$"+e]}},keys:function(){return HxOverrides.iter(this.arrayKeys())},arrayKeys:function(){var e=[];for(var t in this.h){if(this.h.hasOwnProperty(t)){e.push(t)}}if(this.rh!=null){for(var t in this.rh){if(t.charCodeAt(0)==36){e.push(t.substr(1))}}}return e},__class__:haxe_ds_StringMap};var haxe_io_Bytes=function(e){this.length=e.byteLength;this.b=new Uint8Array(e);this.b.bufferValue=e;e.hxBytes=this;e.bytes=this.b};haxe_io_Bytes.__name__=true;haxe_io_Bytes.ofString=function(e,t){if(t==l.RawNative){var r=new Uint8Array(e.length<<1);var n=0;var i=e.length;while(n<i){var s=n++;var a=e.charCodeAt(s);r[s<<1]=a&255;r[s<<1|1]=a>>8}return new haxe_io_Bytes(r.buffer)}var o=[];var c=0;while(c<e.length){var u=e.charCodeAt(c++);if(55296<=u&&u<=56319){u=u-55232<<10|e.charCodeAt(c++)&1023}if(u<=127){o.push(u)}else if(u<=2047){o.push(192|u>>6);o.push(128|u&63)}else if(u<=65535){o.push(224|u>>12);o.push(128|u>>6&63);o.push(128|u&63)}else{o.push(240|u>>18);o.push(128|u>>12&63);o.push(128|u>>6&63);o.push(128|u&63)}}return new haxe_io_Bytes(new Uint8Array(o).buffer)};haxe_io_Bytes.prototype={sub:function(e,t){if(e<0||t<0||e+t>this.length){throw new js__$Boot_HaxeError(c.OutsideBounds)}return new haxe_io_Bytes(this.b.buffer.slice(e+this.b.byteOffset,e+this.b.byteOffset+t))},getString:function(e,t,r){if(e<0||t<0||e+t>this.length){throw new js__$Boot_HaxeError(c.OutsideBounds)}if(r==null){r=l.UTF8}var n="";var i=this.b;var s=e;var a=e+t;switch(r._hx_index){case 0:var o=e>0;while(s<a){var u=i[s++];if(u<128){if(u==0){break}n+=String.fromCodePoint(u)}else if(u<224){var h=(u&63)<<6|i[s++]&127;n+=String.fromCodePoint(h)}else if(u<240){var d=i[s++];var p=(u&31)<<12|(d&127)<<6|i[s++]&127;n+=String.fromCodePoint(p)}else{var m=i[s++];var _=i[s++];var v=(u&15)<<18|(m&127)<<12|(_&127)<<6|i[s++]&127;n+=String.fromCodePoint(v)}}break;case 1:while(s<a){var g=i[s++]|i[s++]<<8;n+=String.fromCodePoint(g)}break}return n},toString:function(){return this.getString(0,this.length)},__class__:haxe_io_Bytes};var l=t["haxe.io.Encoding"]={__ename__:true,__constructs__:["UTF8","RawNative"],UTF8:{_hx_index:0,__enum__:"haxe.io.Encoding",toString:$estr},RawNative:{_hx_index:1,__enum__:"haxe.io.Encoding",toString:$estr}};var c=t["haxe.io.Error"]={__ename__:true,__constructs__:["Blocked","Overflow","OutsideBounds","Custom"],Blocked:{_hx_index:0,__enum__:"haxe.io.Error",toString:$estr},Overflow:{_hx_index:1,__enum__:"haxe.io.Error",toString:$estr},OutsideBounds:{_hx_index:2,__enum__:"haxe.io.Error",toString:$estr},Custom:(n=function(e){return{_hx_index:3,e:e,__enum__:"haxe.io.Error",toString:$estr}},n.__params__=["e"],n)};var haxe_io_Path=function(e){switch(e){case".":case"..":this.dir=e;this.file="";return}var t=e.lastIndexOf("/");var r=e.lastIndexOf("\\");if(t<r){this.dir=HxOverrides.substr(e,0,r);e=HxOverrides.substr(e,r+1,null);this.backslash=true}else if(r<t){this.dir=HxOverrides.substr(e,0,t);e=HxOverrides.substr(e,t+1,null)}else{this.dir=null}var n=e.lastIndexOf(".");if(n!=-1){this.ext=HxOverrides.substr(e,n+1,null);this.file=HxOverrides.substr(e,0,n)}else{this.ext=null;this.file=e}};haxe_io_Path.__name__=true;haxe_io_Path.directory=function(e){var t=new haxe_io_Path(e);if(t.dir==null){return""}return t.dir};haxe_io_Path.extension=function(e){var t=new haxe_io_Path(e);if(t.ext==null){return""}return t.ext};haxe_io_Path.join=function(e){var t=[];var r=0;var n=e;while(r<n.length){var i=n[r];++r;if(i!=null&&i!=""){t.push(i)}}var s=t;if(s.length==0){return""}var a=s[0];var o=1;var l=s.length;while(o<l){var c=o++;a=haxe_io_Path.addTrailingSlash(a);a+=s[c]}return haxe_io_Path.normalize(a)};haxe_io_Path.normalize=function(e){var t="/";e=e.split("\\").join(t);if(e==t){return t}var r=[];var n=0;var i=e.split(t);while(n<i.length){var s=i[n];++n;if(s==".."&&r.length>0&&r[r.length-1]!=".."){r.pop()}else if(s==""){if(r.length>0||HxOverrides.cca(e,0)==47){r.push(s)}}else if(s!="."){r.push(s)}}var a=r.join(t);var o="";var l=false;var c=false;var u=0;var h=a;while(u<h.length){var d=h;var p=u++;var m=d.charCodeAt(p);if(m>=55296&&m<=56319){m=m-55232<<10|d.charCodeAt(p+1)&1023}var _=m;if(_>=65536){++u}var v=_;switch(v){case 47:if(!l){c=true}else{var g=v;l=false;if(c){o+="/";c=false}o+=String.fromCodePoint(g)}break;case 58:o+=":";l=true;break;default:var y=v;l=false;if(c){o+="/";c=false}o+=String.fromCodePoint(y)}}return o};haxe_io_Path.addTrailingSlash=function(e){if(e.length==0){return"/"}var t=e.lastIndexOf("/");var r=e.lastIndexOf("\\");if(t<r){if(r!=e.length-1){return e+"\\"}else{return e}}else if(t!=e.length-1){return e+"/"}else{return e}};haxe_io_Path.removeTrailingSlashes=function(e){e:while(true){var t=HxOverrides.cca(e,e.length-1);if(t==null){break}else{switch(t){case 47:case 92:e=HxOverrides.substr(e,0,-1);break;default:break e}}}return e};haxe_io_Path.isAbsolute=function(e){if(StringTools.startsWith(e,"/")){return true}if(e.charAt(1)==":"){return true}if(StringTools.startsWith(e,"\\\\")){return true}return false};haxe_io_Path.prototype={__class__:haxe_io_Path};var haxeshim_Args=function(e,t){this.cwd=e;this.args=t};haxeshim_Args.__name__=true;haxeshim_Args.interpolate=function(e,t){if(e.indexOf("${")==-1){return g.Success(e)}var r="";var n=0;while(n<e.length){var i=e.indexOf("${",n);if(i==-1){var s=null;r+=s==null?HxOverrides.substr(e,n,null):HxOverrides.substr(e,n,s);break}else{var a=i;var o=a-n;r+=o==null?HxOverrides.substr(e,n,null):HxOverrides.substr(e,n,o);var l=a+2;var c;var u=e.indexOf("}",l);if(u==-1){return g.Failure("unclosed interpolation in "+e)}else{var h=u;c=h}var d=HxOverrides.substr(e,l,c-l);var p;var m=t(d);if(m==null){return g.Failure("unknown variable "+d)}else{var _=m;if(_=="$"+"{"+d+"}"){p=_}else{var v=haxeshim_Args.interpolate(_,t);if(v._hx_index==0){var y=v.data;p=y}else{var w=v;return w}}}r+=Std.string(p);n=c+1}}return g.Success(r)};haxeshim_Args.fromMultilineString=function(e,t,r,n){if(n==null){n=false}var i=[];var s=new haxeshim_Errors;var getVar1=function(e){if(e=="__dirname"){return haxe_io_Path.directory(t)}else{return r(e)}};var add=function(e,r){var add1=function(e){i.push({pos:p.File(t,r),val:e})};if(e.charAt(0)=="-"){add1(e)}else{var n=haxeshim_Args.interpolate(e,getVar1);switch(n._hx_index){case 0:var a=n.data;add1(a);break;case 1:var o=n.failure;s.fail(o,p.File(t,r));break}}};var a=e.split("\n");var o=StringTools.trim;var l=new Array(a.length);var c=0;var u=a.length;while(c<u){var h=c++;l[h]=o(a[h])}var d=l;var m=0;var _=d.length;while(m<_){var v=m++;var g=d[v];var y=function(e,t){return function(r){t[0](r,e[0])}}([v],[add]);var w=g.charAt(0);if(w!=null){switch(w){case"#":break;case"-":var b=g.indexOf(" ");if(b==-1){y(g)}else{var S=b;y(HxOverrides.substr(g,0,S));y(StringTools.trim(HxOverrides.substr(g,S,null)))}break;default:var x=StringTools.trim(g);if(x!=""){var E=x;if(n){y("-cp")}y(E)}}}}return s.produce(i)};haxeshim_Args.getNdll=function(e){if(StringTools.startsWith(e,"ndll:")){return o.Some(HxOverrides.substr(e,5,null))}else{return o.None}};haxeshim_Args.split=function(e,t,r,n){var i=[];var s=0;var a=e.length;while(s<a){var o=s++;i.push({val:e[o],pos:p.Cmd(o)})}var l=i;var c=[];var u=[];var h=[];var d=new haxeshim_Errors;var resolvePath=function(e){if(haxe_io_Path.isAbsolute(e)){return e}else{return haxe_io_Path.join([t,e])}};var flush=function(){if(u.length>0){var e=c.concat(u);var r=new haxeshim_Args(t,e);u=[];h.push(r)}};while(true){var m=l.shift();if(m==null){flush();break}else{var _=[m];var v=function(e){return function(t){var r=l.shift();if(r==null){d.fail(""+e[0].val+" without argument",e[0].pos)}else{var n=r;t(n)}}}(_);var g=_[0].val;switch(g){case"--each":c=u;u=[];break;case"--next":flush();break;case"--run":case"-x":var y=[_[0]].concat(l);u=u.concat(y);l=[];flush();break;case"--cwd":case"-C":var w=l.shift();if(w==null){d.fail(""+_[0].val+" without argument",_[0].pos)}else{var b=w;t=resolvePath(b.val);if(!r.isDirectory(t)){d.fail("Cannot use "+t+" as working directory",b.pos);l=[]}}break;default:var S=g;if(haxe_io_Path.extension(S)=="hxml"){l=haxeshim_Args.readHxml(resolvePath(S),r,n,d,_[0].pos).concat(l)}else{var x=g;if(StringTools.startsWith(x,"${")){var E=haxeshim_Args.interpolate(x,n);switch(E._hx_index){case 0:var R=E.data;u.push({val:R,pos:_[0].pos});break;case 1:var O=E.failure;d.fail(O,_[0].pos);break}}else{u.push(_[0])}}}}}return d.produce(h)};haxeshim_Args.readHxml=function(e,t,r,n,i){var s=t.readFile(e);switch(s._hx_index){case 0:var a=s.data;return n.getResult(haxeshim_Args.fromMultilineString(a,e,r));case 1:var o=s.failure;n.fail(o,i);return[]}};haxeshim_Args.prototype={__class__:haxeshim_Args};var haxeshim_Attempt=function(){};haxeshim_Attempt.__name__=true;haxeshim_Attempt.to=function(e,t,r){return new tink_core__$Future_SyncFuture(new tink_core__$Lazy_LazyFunc((function(){return tink_core_TypedError.catchExceptions(t,(function(t){return tink_core_TypedError.withData(null,"Failed to "+e,t,r)}),{fileName:"haxeshim/Attempt.hx",lineNumber:8,className:"haxeshim.Attempt",methodName:"to"})})))};var u=t["haxeshim.ServerKind"]={__ename__:true,__constructs__:["Port","Stdio"],Port:(n=function(e){return{_hx_index:0,num:e,__enum__:"haxeshim.ServerKind",toString:$estr}},n.__params__=["num"],n),Stdio:{_hx_index:1,__enum__:"haxeshim.ServerKind",toString:$estr}};var h=t["haxeshim.StdioState"]={__ename__:true,__constructs__:["AwaitingHeader","AwaitingData"],AwaitingHeader:(n=function(e){return{_hx_index:0,buf:e,__enum__:"haxeshim.StdioState",toString:$estr}},n.__params__=["buf"],n),AwaitingData:(n=function(e,t){return{_hx_index:1,buf:e,total:t,__enum__:"haxeshim.StdioState",toString:$estr}},n.__params__=["buf","total"],n)};var haxeshim_CompilerServer=function(e,t,r){this.freePort=M.async((function(e){var t=b.createServer();t.listen(0,(function(){var r=t.address().port;t.close((function(){e(g.Success(r))}))}))}),true);this.args=r;this.scope=t;switch(e._hx_index){case 0:var n=e.num;this.waitOnPort(n);break;case 1:this.stdio();break}};haxeshim_CompilerServer.__name__=true;haxeshim_CompilerServer.prototype={handleIntSignals:function(){var cleanExit=function(){process.exit()};process.on("SIGINT",cleanExit);process.on("SIGTERM",cleanExit)},stdio:function(){var e=this;v.watch(this.scope.configFile,{persistent:false},(function(t,r){var n=10;var i=null;i=function(t){if(t==null){t=0}try{e.scope.reload()}catch(e){var r=e instanceof js__$Boot_HaxeError?e.val:e;if(t>=n){haxeshim_Logger.get().error("Reloading .haxerc after change detected failed "+n+" times!");process.exit(500)}else{var s=i;var a=t+1;haxe_Timer.delay((function(){s(a);return}),100)}}};i()}));var t=null;var quit=function(){if(t!=null){t.kill()}};process.on("exit",quit);this.handleIntSignals();process.stdin.on("end",quit);process.stdin.on("close",quit);var r=h.AwaitingHeader(E.alloc(0));var frame=function(e){var t=E.alloc(4+e.length);t.writeInt32LE(e.length,0);e.copy(t,4);return t};var processData=function(r){var i=E.alloc(0);var a=r.indexOf(1);var o;if(a==-1){o=r}else{var l=a;i=r.slice(l);o=r.slice(0,l)}var c=e.parseArgs(o);if(t==null||c.version!=e.lastVersion){if(t!=null){t.kill();t.stdout.unpipe(process.stdout);t.stderr.unpipe(process.stderr)}e.lastVersion=c.version;var u=e.scope.haxeInstallation;t=s.spawn(u.compiler,e.args.concat(["--wait","stdio"]),{cwd:e.scope.cwd,env:d.toVars(haxeshim_Exec.mergeEnv(u.env())),stdio:"pipe"});var h=t;t.on("exit",(function(e,r){if(t==h){t=null}}));t.stdout.pipe(process.stdout);t.stderr.pipe(process.stderr)}var p=(n=e.scope,$bind(n,n.resolve));var m=c.args;var _=tink_core_TypedError.catchExceptions((function(){return p(m)}),null,{fileName:"haxeshim/CompilerServer.hx",lineNumber:142,className:"haxeshim.CompilerServer",methodName:"stdio"});switch(_._hx_index){case 0:var v=_.data;var g=E.from(v.join("\n"));var y=t.stdin;var w=E.concat([g,i]);y.write(frame(w));break;case 1:var b=_.failure;haxeshim_Exec.die(b.code,b.message);break}};var reduce=function(){while(true){var e;switch(r._hx_index){case 0:var t=r.buf;e=t.length>=4?h.AwaitingData(t.slice(4),t.readInt32LE(0)):r;break;case 1:var n=r.total;var i=r.buf;if(i.length>=n){var s=i.slice(0,n);processData(s);e=h.AwaitingHeader(i.slice(n))}else{e=r}break;default:e=r}if(r==e){break}r=e}};process.stdin.on("data",(function(e){switch(r._hx_index){case 0:var t=r.buf;r=h.AwaitingHeader(E.concat([t,e]));break;case 1:var n=r.total;var i=r.buf;r=h.AwaitingData(E.concat([i,e]),n);break}reduce()}))},parseArgs:function(e){var t=e.toString().split("\n");var r;var n=t.indexOf("--haxe-version");if(n==-1){r=this.lastVersion==null?this.scope.haxeInstallation.version:this.lastVersion}else{var i=n;r=t.splice(i,2).pop()}return{version:r,args:t}},waitOnPort:function(e){var t=this;var quit=function(){if(t.waiting!=null){t.waiting.handle((function(e){if(e._hx_index==0){var t=e.data;t.kill()}}))}};process.on("exit",quit);this.handleIntSignals();var r=b.createServer((function(e){var r=[];e.on("data",(function(n){var i=n.indexOf(0);if(i==-1){r.push(n)}else{var s=i;var a=n.slice(0,s);r.push(a);var o=n.slice(s+1);e.unshift(o);var l=E.concat(r).toString().split("\n");r=[];var c;var u=l.indexOf("--haxe-version");if(u==-1){c=t.lastVersion==null?t.scope.haxeInstallation.version:t.lastVersion}else{var h=u;c=l.splice(h,2).pop()}t.connect(c).handle((function(t){switch(t._hx_index){case 0:var r=t.data;r.write(l.join("\n")+String.fromCodePoint(0));r.pipe(e,{end:true});break;case 1:var n=t.failure;e.end(n.message+"\n"+""+"\n","utf8");break}}))}}));e.on("error",(function(){}));e.on("end",(function(){}))}));r.listen(e)},disconnect:function(){if(this.waiting==null){return new tink_core__$Future_SyncFuture(new tink_core__$Lazy_LazyConst(g.Success(B.Noise)))}else{return P.next(this.waiting,(function(e){var t=e.kill().map(g.Success);return t.gather()}))}},connect:function(e){var t=this;if(e!=this.lastVersion||this.waiting==null){this.lastVersion=e;var r=this.waiting=P.next(this.disconnect(),(function(r){return P.next(t.freePort,U.ofSafeSync((function(r){var n=t.scope.getInstallation(e);var i=haxeshim_Exec.async(n.compiler,t.scope.cwd,t.args.concat(["--wait",r==null?"null":""+r]),n.env());return{died:M.async((function(e){var t=e;var nu1=function(){t(B.Noise)};i.on("exit",nu1);var r=e;var nu2=function(){r(B.Noise)};i.on("error",nu2);var n=e;var nu3=function(){n(B.Noise)};i.on("disconnect",nu3)})),version:e,socket:function(){return M.async((function(e){var t=10;var n=null;n=function(i){var s=b.createConnection(r,"127.0.0.1");s.on("error",(function(s){if(i>=t){var a=g.Failure(new tink_core_TypedError(null,"Failed to connect to 127.0.0.1:"+r+" after "+t+" attempts because "+s,{fileName:"haxeshim/CompilerServer.hx",lineNumber:291,className:"haxeshim.CompilerServer",methodName:"connect"}));e(a)}else{var o=n;var l=i+1;haxe_Timer.delay((function(){o(l);return}),100)}})).on("connect",(function(){e(g.Success(s))}))};n(1)}))},kill:function(){i.kill();return M.async((function(e){var t=e;haxe_Timer.delay((function(){t(B.Noise)}),500)}))}}})))}));this.waiting.handle((function(e){switch(e._hx_index){case 0:var n=e.data;n.died.handle(D.fromNiladic((function(){if(t.waiting==r){t.waiting=null}})));break;case 1:var i=e.failure;t.waiting=null;break}}))}return P.next(this.waiting,(function(e){return e.socket()}))},__class__:haxeshim_CompilerServer};var d={};d.__name__=true;d.ofVars=function(e){var t={};var r=t;var n=0;var i=Reflect.fields(e);while(n<i.length){var s=i[n];++n;r[haxeshim_Os.IS_WINDOWS?s.toUpperCase():s]=e[s]}var a=r;return a};d.ofMap=function(e){var t={};var r=t;var n=e.keys();while(n.hasNext()){var i=n.next();r[haxeshim_Os.IS_WINDOWS?i.toUpperCase():i]=$[i]!=null?e.getReserved(i):e.h[i]}var s=r;return s};d.vars=function(e){return e};d.toVars=function(e){return Reflect.copy(e)};d.get=function(e,t){return e[haxeshim_Os.IS_WINDOWS?t.toUpperCase():t]};d.mergeInto=function(e,t){var r=d.vars(t);if(e==null){var n=r;var i=n;return i}else if(r==null){var s=e;var a=s;return a}else{var o=e;var l=r;var c={};var u=c;var h=l;var p=0;var m=Reflect.fields(h);while(p<m.length){var _=m[p];++p;u[_]=h[_]}var v=o;var g=0;var y=Reflect.fields(v);while(g<y.length){var w=y[g];++g;u[w]=v[w]}var b=u;return b}};var haxeshim_Errors=function(){this.errors=[]};haxeshim_Errors.__name__=true;haxeshim_Errors.getCode=function(e){var t=0;var r=e;while(t<r.length){var n=r[t];++t;var i=n.code;if(i!=null){var s=i;return s}}return 500};haxeshim_Errors.prototype={fail:function(e,t,r){this.errors.push({message:e,pos:t,code:r})},produce:function(e){if(this.errors.length==0){return g.Success(e)}else{return g.Failure({result:e,errors:this.errors})}},getResult:function(e){switch(e._hx_index){case 0:var t=e.data;return t;case 1:var r=e.failure;var n=0;var i=r.errors;while(n<i.length){var s=i[n];++n;this.errors.push(s)}return r.result}},__class__:haxeshim_Errors};var p=t["haxeshim.Pos"]={__ename__:true,__constructs__:["File","Cmd","Custom"],File:(n=function(e,t){return{_hx_index:0,path:e,line:t,__enum__:"haxeshim.Pos",toString:$estr}},n.__params__=["path","line"],n),Cmd:(n=function(e){return{_hx_index:1,index:e,__enum__:"haxeshim.Pos",toString:$estr}},n.__params__=["index"],n),Custom:(n=function(e){return{_hx_index:2,source:e,__enum__:"haxeshim.Pos",toString:$estr}},n.__params__=["source"],n)};var haxeshim_PosTools=function(){};haxeshim_PosTools.__name__=true;haxeshim_PosTools.toString=function(e){switch(e._hx_index){case 0:var t=e.line;var r=e.path;return""+r+":"+t;case 1:var n=e.index;return"CLI arg#"+n;case 2:var i=e.source;return i}};var haxeshim_Exec=function(){};haxeshim_Exec.__name__=true;haxeshim_Exec.die=function(e,t){if(t!=null){haxeshim_Logger.get().error(t)}process.exit(e);throw new js__$Boot_HaxeError("unreachable")};haxeshim_Exec.dieFromErrors=function(e){var t=null;var r=haxeshim_Logger.get();var n=0;var i=e;while(n<i.length){var s=i[n];++n;r.error(haxeshim_PosTools.toString(s.pos)+(": "+s.message))}process.exit(haxeshim_Errors.getCode(e));throw new js__$Boot_HaxeError("unreachable")};haxeshim_Exec.gracefully=function(e){try{return e()}catch(e){var t=e instanceof js__$Boot_HaxeError?e.val:e;if(t instanceof tink_core_TypedError){var r=t;return haxeshim_Exec.die(r.code,r.message)}else{return haxeshim_Exec.die(500,Std.string(t))}}};haxeshim_Exec.mergeEnv=function(e){return d.mergeInto(e,d.ofVars(process.env))};haxeshim_Exec.async=function(e,t,r,n){return s.spawn(e,r,{cwd:t,stdio:"inherit",env:d.toVars(haxeshim_Exec.mergeEnv(n))})};haxeshim_Exec.shell=function(e,t,r){try{return g.Success(s.execSync(e,{cwd:t,stdio:"inherit",env:d.toVars(haxeshim_Exec.mergeEnv(r))}))}catch(t){var n=t instanceof js__$Boot_HaxeError?t.val:t;return g.Failure(new tink_core_TypedError(n.status,"Failed to invoke `"+e+"` because "+Std.string(n),{fileName:"haxeshim/Exec.hx",lineNumber:47,className:"haxeshim.Exec",methodName:"shell"}))}};haxeshim_Exec.sync=function(e,t,r,n){var i=s.spawnSync(e,r,{cwd:t,stdio:"inherit",env:d.toVars(haxeshim_Exec.mergeEnv(n))});var a=i.stdout;var o=i.stderr;var l=i.status;var c=i.signal;var u=i.pid;var h=i.output;var p=i.error;if(p==null){var m=l;return g.Success(m)}else{var _=l;var v=p;return g.Failure(new tink_core_TypedError(_,"Failed to call "+e+" because "+Std.string(v),{fileName:"haxeshim/Exec.hx",lineNumber:54,className:"haxeshim.Exec",methodName:"sync"}))}};haxeshim_Exec.eval=function(e,t,r,n){var i=s.spawnSync(e,r,{cwd:t,env:d.toVars(haxeshim_Exec.mergeEnv(n))});var a=i;if(a.error==null){return g.Success({status:a.status,stdout:a.stdout.toString(),stderr:a.stderr.toString()})}else{var o=i.stdout;var l=i.stderr;var c=i.status;var u=i.signal;var h=i.pid;var p=i.output;var m=i.error;return g.Failure(new tink_core_TypedError(null,"Failed to call "+e+" because "+Std.string(m),{fileName:"haxeshim/Exec.hx",lineNumber:66,className:"haxeshim.Exec",methodName:"eval"}))}};var m={};m.__name__=true;m.ofString=function(e){return haxe_io_Bytes.ofString(e)};var haxeshim_Fs=function(){};haxeshim_Fs.__name__=true;haxeshim_Fs.save=function(e,t,r){return P.noise(P.next(haxeshim_Fs.ensureDir(e),(function(n){var i=e;var f=function(e){var t=e.b;var r=E.from(t.buffer,t.byteOffset,e.length);v.writeFileSync(i,r)};var s=t;var tmp=function(){f(s)};return haxeshim_Attempt.to("save to "+e,tmp,r)})))};haxeshim_Fs.exists=function(e){var t=e;return haxeshim_Attempt.to("check the existence of "+e,(function(){return sys_FileSystem.exists(t)}),{fileName:"haxeshim/Fs.hx",lineNumber:26,className:"haxeshim.Fs",methodName:"exists"})};haxeshim_Fs.ensureDir=function(e){var t=StringTools.endsWith(e,"/")||StringTools.endsWith(e,"\\");if(t){e=haxe_io_Path.removeTrailingSlashes(e)}var r=haxe_io_Path.directory(e);if(haxe_io_Path.removeTrailingSlashes(r)==e){return new tink_core__$Future_SyncFuture(new tink_core__$Lazy_LazyConst(g.Success(B.Noise)))}else{return P.next(P.next(haxeshim_Fs.exists(r),(function(e){if(e){return new tink_core__$Future_SyncFuture(new tink_core__$Lazy_LazyConst(g.Success(B.Noise)))}else{return haxeshim_Fs.ensureDir(haxe_io_Path.addTrailingSlash(r))}})),(function(r){if(t){return P.next(haxeshim_Fs.exists(e),(function(t){return haxeshim_Attempt.to("create directory "+e,(function(){if(!t){sys_FileSystem.createDirectory(e)}return B.Noise}),{fileName:"haxeshim/Fs.hx",lineNumber:49,className:"haxeshim.Fs",methodName:"ensureDir"})}))}else{return new tink_core__$Future_SyncFuture(new tink_core__$Lazy_LazyConst(g.Success(B.Noise)))}}))}};haxeshim_Fs.ls=function(e,t){var r=[];var n=0;var i=v.readdirSync(e);while(n<i.length){var s=i[n];++n;var a=""+e+"/"+s;var o;if(t==null||t(a)){o=a}else{continue}r.push(o)}return r};haxeshim_Fs.delete=function(e){return haxeshim_Attempt.to("delete "+e,(function(){if(e!=null&&sys_FileSystem.exists(e)){if(sys_FileSystem.isDirectory(e)){var t=0;var r=v.readdirSync(e);while(t<r.length){var n=r[t];++t;haxeshim_Fs.delete(""+e+"/"+n)}if(sys_FileSystem.exists(e)){var i=0;var s=v.readdirSync(e);while(i<s.length){var a=s[i];++i;var o=e+"/"+a;if(sys_FileSystem.isDirectory(o)){if(sys_FileSystem.exists(o)){var l=0;var c=v.readdirSync(o);while(l<c.length){var u=c[l];++l;var h=o+"/"+u;if(sys_FileSystem.isDirectory(h)){sys_FileSystem.deleteDirectory(h)}else{v.unlinkSync(h)}}v.rmdirSync(o)}}else{v.unlinkSync(o)}}v.rmdirSync(e)}}else{v.unlinkSync(e)}}return}),{fileName:"haxeshim/Fs.hx",lineNumber:107,className:"haxeshim.Fs",methodName:"delete"})};haxeshim_Fs.peel=function(e,t){var r=0;var n=0;var i=t;while(n<i){var s=n++;var a=e.indexOf("/",r);if(a==-1){return o.None}else{var l=a;r=l+1}}return o.Some(HxOverrides.substr(e,r,null))};haxeshim_Fs.findNearest=function(e,t){while(true)if(sys_FileSystem.exists(""+t+"/"+e)){return o.Some(""+t+"/"+e)}else{var r=haxe_io_Path.directory(t);var n=r;if(t==n){return o.None}else{var i=r;t=i}}};var haxeshim_HaxeCli=function(e){this.scope=e};haxeshim_HaxeCli.__name__=true;haxeshim_HaxeCli.withArgs=function(e){var t=process.argv.slice(2);if(t[0]=="--cwd"){t.shift();var r=t.shift();if(r==null){haxeshim_Exec.die(500,"--cwd requires argument")}else{var n=r;process.chdir(n)}}return e(t)};haxeshim_HaxeCli.run=function(e){haxeshim_Neko.setEnv();new haxeshim_HaxeCli(haxeshim_Exec.gracefully((function(){return haxeshim_Scope.seek()}))).dispatch(e)};haxeshim_HaxeCli.prototype={installLibs:function(e){return this.scope.withLogger(haxeshim_Logger.get(e),(n=this.scope,$bind(n,n.installLibs))).handle((function(e){if(e._hx_index==1){var t=e.failure;haxeshim_Logger.get().error(t.message);process.exit(t.code)}}))},dispatch:function(e){var getScope=function(){var e={cwd:null};return haxeshim_Exec.gracefully((function(){return haxeshim_Scope.seek(e)}))};var t;var r;t=e.indexOf("--wait");var n=t;if(n>=0&&n<e.length-1){var i;var s=e.splice(n,2).pop();var a;if(s==null){a=Std.parseInt(s);var o=a;i=u.Port(o)}else if(s=="stdio"){i=u.Stdio}else{a=Std.parseInt(s);var l=a;i=u.Port(l)}new haxeshim_CompilerServer(i,getScope(),e)}else{r=e.slice(0,2);if(r.length==2){if(r[0]=="--run"){var c=r[1];if(c.indexOf("-")!=-1&&c.toLowerCase()==c){var h=e.slice(2);var d=getScope();switch(c){case"install-libs":var p;switch(h.length){case 0:p=false;break;case 1:p=h[0]=="--silent"?true:haxeshim_Exec.die(422,"unexpected arguments "+Std.string(h));break;default:p=haxeshim_Exec.die(422,"unexpected arguments "+Std.string(h))}this.installLibs(p);break;case"resolve-args":var m=$bind(d,d.resolve);var _=h;var v=haxeshim_Exec.gracefully((function(){return m(_)})).join("\n");process.stdout.write(Std.string(v));process.stdout.write("\n");process.exit(0);break;case"show-version":if(h.length>0){haxeshim_Exec.die(422,"too many arguments")}var g;var y=haxeshim_Exec.eval(d.haxeInstallation.compiler,d.cwd,["-version"]);switch(y._hx_index){case 0:var w=y.data;g=StringTools.trim(w.stdout.toString()+w.stderr.toString());break;case 1:var b=y.failure;g=haxeshim_Exec.die(b.code,b.message);break}process.stdout.write(Std.string("-D haxe-ver="+g));process.stdout.write("\n");process.stdout.write(Std.string("-cp "+d.haxeInstallation.stdLib));process.stdout.write("\n");break;default:var S=c;haxeshim_Exec.die(404,"Unknown extension "+S)}}else{var x=e;var E=getScope();var R=x.indexOf("--haxe-version");if(x.indexOf("--connect")==-1){var O=R==-1}else if(R==-1){x.push("--haxe-version");x.push(E.haxeInstallation.version)}var N=E.haxeInstallation.compiler;var k=N;if(sys_FileSystem.exists(k)){var get=function(e){switch(e._hx_index){case 0:var t=e.data;return t;case 1:var r=e.failure;var n=r.result;var i=r.errors;return haxeshim_Exec.dieFromErrors(i)}};var callHaxe=function(e,t){var r=E.haxeInstallation.env();var n=haxeshim_Exec.sync(k,t,e,r);switch(n._hx_index){case 0:var i=n.data;if(i!=0){var s=i;haxeshim_Exec.die(s)}break;case 1:var a=n.failure;haxeshim_Exec.die(a.code,a.message);break}};if(x.length==0){callHaxe(x,E.cwd)}else{var I=0;var A=get(E.getBuilds(x));while(I<A.length){var F=A[I];++I;var T=get(F);get(T.checkClassPaths());var L=[];var D=0;var C=T.args;while(D<C.length){var B=C[D];++D;L.push(B.val)}callHaxe(L,T.cwd)}}}else{var M=N;haxeshim_Exec.die(404,'haxe compiler not found at the expected location "'+M+'"')}}}else{var P=e;var U=getScope();var z=P.indexOf("--haxe-version");if(P.indexOf("--connect")==-1){var W=z==-1}else if(z==-1){P.push("--haxe-version");P.push(U.haxeInstallation.version)}var H=U.haxeInstallation.compiler;var j=H;if(sys_FileSystem.exists(j)){var get1=function(e){switch(e._hx_index){case 0:var t=e.data;return t;case 1:var r=e.failure;var n=r.result;var i=r.errors;return haxeshim_Exec.dieFromErrors(i)}};var callHaxe1=function(e,t){var r=U.haxeInstallation.env();var n=haxeshim_Exec.sync(j,t,e,r);switch(n._hx_index){case 0:var i=n.data;if(i!=0){var s=i;haxeshim_Exec.die(s)}break;case 1:var a=n.failure;haxeshim_Exec.die(a.code,a.message);break}};if(P.length==0){callHaxe1(P,U.cwd)}else{var Y=0;var G=get1(U.getBuilds(P));while(Y<G.length){var V=G[Y];++Y;var $=get1(V);get1($.checkClassPaths());var Z=[];var q=0;var X=$.args;while(q<X.length){var K=X[q];++q;Z.push(K.val)}callHaxe1(Z,$.cwd)}}}else{var J=H;haxeshim_Exec.die(404,'haxe compiler not found at the expected location "'+J+'"')}}}else{var Q=e;var ee=getScope();var te=Q.indexOf("--haxe-version");if(Q.indexOf("--connect")==-1){var re=te==-1}else if(te==-1){Q.push("--haxe-version");Q.push(ee.haxeInstallation.version)}var ne=ee.haxeInstallation.compiler;var ie=ne;if(sys_FileSystem.exists(ie)){var get2=function(e){switch(e._hx_index){case 0:var t=e.data;return t;case 1:var r=e.failure;var n=r.result;var i=r.errors;return haxeshim_Exec.dieFromErrors(i)}};var callHaxe2=function(e,t){var r=ee.haxeInstallation.env();var n=haxeshim_Exec.sync(ie,t,e,r);switch(n._hx_index){case 0:var i=n.data;if(i!=0){var s=i;haxeshim_Exec.die(s)}break;case 1:var a=n.failure;haxeshim_Exec.die(a.code,a.message);break}};if(Q.length==0){callHaxe2(Q,ee.cwd)}else{var se=0;var ae=get2(ee.getBuilds(Q));while(se<ae.length){var oe=ae[se];++se;var le=get2(oe);get2(le.checkClassPaths());var ce=[];var ue=0;var he=le.args;while(ue<he.length){var fe=he[ue];++ue;ce.push(fe.val)}callHaxe2(ce,le.cwd)}}}else{var de=ne;haxeshim_Exec.die(404,'haxe compiler not found at the expected location "'+de+'"')}}}},__class__:haxeshim_HaxeCli};var haxeshim_Os=function(){};haxeshim_Os.__name__=true;haxeshim_Os.slashes=function(e){if(haxeshim_Os.IS_WINDOWS){return StringTools.replace(e,"/","\\")}else{return e}};var haxeshim_HaxeInstallation=function(e,t,r){this.path=e;this.version=t;this.compiler=""+e+"/haxe"+haxeshim_HaxeInstallation.EXT;this.haxelib=""+e+"/haxelib"+haxeshim_HaxeInstallation.EXT;this.stdLib=""+e+"/std";this.haxelibRepo=r};haxeshim_HaxeInstallation.__name__=true;haxeshim_HaxeInstallation.prototype={env:function(){var e=d.ofVars({HAXE_STD_PATH:this.stdLib,HAXEPATH:this.path,HAXELIB_PATH:this.haxelibRepo,HAXE_VERSION:this.version});return d.mergeInto(e,haxeshim_Neko.ENV)},__class__:haxeshim_HaxeInstallation};var haxeshim_Logger=function(){};haxeshim_Logger.__name__=true;haxeshim_Logger.get=function(e){if(e==null){e=false}if(e){if(haxeshim_Logger.SILENT==null){haxeshim_Logger.SILENT=new haxeshim_Logger}return haxeshim_Logger.SILENT}else{if(haxeshim_Logger.DEFAULT==null){haxeshim_Logger.DEFAULT=new haxeshim__$Logger_SysLogger}return haxeshim_Logger.DEFAULT}};haxeshim_Logger.prototype={error:function(e){},info:function(e){},success:function(e){},progress:function(e){},__class__:haxeshim_Logger};var haxeshim__$Logger_SysLogger=function(){haxeshim_Logger.call(this)};haxeshim__$Logger_SysLogger.__name__=true;haxeshim__$Logger_SysLogger.__super__=haxeshim_Logger;haxeshim__$Logger_SysLogger.prototype=$extend(haxeshim_Logger.prototype,{log:function(e,t){this.progress("");var r=haxeshim__$Logger_SysLogger.out;var n;switch(e._hx_index){case 0:n=[i.Red];break;case 1:n=[i.Yellow];break;case 2:n=[i.DefaultForeground];break;case 3:n=[i.Green];break}r.writeString(ANSI.aset(n)+t+ANSI.aset([i.Off])+"\n")},error:function(e){this.log(_.Error,e)},info:function(e){this.log(_.Info,e)},success:function(e){this.log(_.Success,e)},progress:function(e){if(haxeshim__$Logger_SysLogger.isTTY){if(e.length>80){e=HxOverrides.substr(e,0,77)+"..."}haxeshim__$Logger_SysLogger.out.writeString((ANSI.strip||ANSI.stripIfUnavailable&&!ANSI.available?"":"")+(ANSI.strip||ANSI.stripIfUnavailable&&!ANSI.available?"":"["+1+"G")+e)}},__class__:haxeshim__$Logger_SysLogger});var _=t["haxeshim._Logger.Level"]={__ename__:true,__constructs__:["Error","Warning","Info","Success"],Error:{_hx_index:0,__enum__:"haxeshim._Logger.Level",toString:$estr},Warning:{_hx_index:1,__enum__:"haxeshim._Logger.Level",toString:$estr},Info:{_hx_index:2,__enum__:"haxeshim._Logger.Level",toString:$estr},Success:{_hx_index:3,__enum__:"haxeshim._Logger.Level",toString:$estr}};var tink_core__$Lazy_LazyObject=function(){};tink_core__$Lazy_LazyObject.__name__=true;tink_core__$Lazy_LazyObject.__isInterface__=true;tink_core__$Lazy_LazyObject.prototype={__class__:tink_core__$Lazy_LazyObject};var tink_core__$Lazy_LazyConst=function(e){this.value=e};tink_core__$Lazy_LazyConst.__name__=true;tink_core__$Lazy_LazyConst.__interfaces__=[tink_core__$Lazy_LazyObject];tink_core__$Lazy_LazyConst.prototype={get:function(){return this.value},map:function(e){var t=this;return new tink_core__$Lazy_LazyFunc((function(){return e(t.value)}))},__class__:tink_core__$Lazy_LazyConst};var sys_FileSystem=function(){};sys_FileSystem.__name__=true;sys_FileSystem.exists=function(e){try{v.accessSync(e);return true}catch(e){var t=e instanceof js__$Boot_HaxeError?e.val:e;return false}};sys_FileSystem.isDirectory=function(e){try{return v.statSync(e).isDirectory()}catch(e){var t=e instanceof js__$Boot_HaxeError?e.val:e;return false}};sys_FileSystem.createDirectory=function(e){try{v.mkdirSync(e)}catch(i){var t=i instanceof js__$Boot_HaxeError?i.val:i;if(t.code=="ENOENT"){sys_FileSystem.createDirectory(S.dirname(e));v.mkdirSync(e)}else{var r;try{r=v.statSync(e)}catch(e){var n=e instanceof js__$Boot_HaxeError?e.val:e;throw t}if(!r.isDirectory()){throw t}}}};sys_FileSystem.deleteDirectory=function(e){if(sys_FileSystem.exists(e)){var t=0;var r=v.readdirSync(e);while(t<r.length){var n=r[t];++t;var i=e+"/"+n;if(sys_FileSystem.isDirectory(i)){sys_FileSystem.deleteDirectory(i)}else{v.unlinkSync(i)}}v.rmdirSync(e)}};var v=r(7147);var g=t["tink.core.Outcome"]={__ename__:true,__constructs__:["Success","Failure"],Success:(n=function(e){return{_hx_index:0,data:e,__enum__:"tink.core.Outcome",toString:$estr}},n.__params__=["data"],n),Failure:(n=function(e){return{_hx_index