diff --git a/.vimrc b/.vimrc new file mode 100644 index 0000000..4d2f0fc --- /dev/null +++ b/.vimrc @@ -0,0 +1 @@ +noremap :!./make && ./make runtest \| most diff --git a/README.md b/README.md index 62e3f48..e152553 100644 --- a/README.md +++ b/README.md @@ -1 +1,10 @@ -# xrfragment \ No newline at end of file +# usage + + +# development + +``` +$ ./make install +$ ./make +$ ./make runtest +``` diff --git a/build.hxml b/build.hxml new file mode 100644 index 0000000..b5f61d4 --- /dev/null +++ b/build.hxml @@ -0,0 +1,83 @@ +-dce no +-cp src + +xrfragment.Query +-D shallow-expose +--resource stub/stub.js@stub +-js dist/xrfragment.js + +--next + +-dce no +-cp src + +Test +-D shallow-expose +-m Test +-js test/generated/test.js + +--next + +-dce no +-cp src + +xrfragment.Query +-lua dist/xrfragment.lua + +--next + +-dce no +-cp src + +xrfragment.Query +-python dist/xrfragment.py + +--next + +-dce no +-cp src + +Test +-m Test +-python test/generated/test.py + +#--next +# +#-dce no +#-cp src +# +#xrfragment.Query +#-php dist/xrfragment.php5 +# +#--next +# +#-dce no +#-cp src +# +#xrfragment.Query +#-cpp dist/xrfragment.cpp +# +#--next +# +#-dce no +#-cp src +# +#xrfragment.Query +#-cppia dist/xrfragment.cppia +# +#--next +# +#-dce no +#-cp src +# +#xrfragment.Query +#-cs dist/xrfragment.csharp +# +# +#--next +# +#-dce no +#-cp src +# +#xrfragment.Query +#-java xrfragment.jdk diff --git a/dist/xrfragment.js b/dist/xrfragment.js new file mode 100644 index 0000000..0aae9d0 --- /dev/null +++ b/dist/xrfragment.js @@ -0,0 +1,2257 @@ +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +$hx_exports["xrfragment"]["Query"] = $hx_exports["xrfragment"]["Query"] || {}; +var $hxClasses = {},$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +$hxClasses["EReg"] = EReg; +EReg.__name__ = "EReg"; +EReg.escape = function(s) { + return s.replace(EReg.escapeRe,"\\$&"); +}; +EReg.prototype = { + r: null + ,match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedLeft: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return HxOverrides.substr(this.r.s,0,this.r.m.index); + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,matchSub: function(s,pos,len) { + if(len == null) { + len = -1; + } + if(this.r.global) { + this.r.lastIndex = pos; + this.r.m = this.r.exec(len < 0 ? s : HxOverrides.substr(s,0,pos + len)); + var b = this.r.m != null; + if(b) { + this.r.s = s; + } + return b; + } else { + var b = this.match(len < 0 ? HxOverrides.substr(s,pos,null) : HxOverrides.substr(s,pos,len)); + if(b) { + this.r.s = s; + this.r.m.index += pos; + } + return b; + } + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } + ,replace: function(s,by) { + return s.replace(this.r,by); + } + ,map: function(s,f) { + var offset = 0; + var buf_b = ""; + while(true) { + if(offset >= s.length) { + break; + } else if(!this.matchSub(s,offset)) { + buf_b += Std.string(HxOverrides.substr(s,offset,null)); + break; + } + var p = this.matchedPos(); + buf_b += Std.string(HxOverrides.substr(s,offset,p.pos - offset)); + buf_b += Std.string(f(this)); + if(p.len == 0) { + buf_b += Std.string(HxOverrides.substr(s,p.pos,1)); + offset = p.pos + 1; + } else { + offset = p.pos + p.len; + } + if(!this.r.global) { + break; + } + } + if(!this.r.global && offset > 0 && offset < s.length) { + buf_b += Std.string(HxOverrides.substr(s,offset,null)); + } + return buf_b; + } + ,__class__: EReg +}; +var EnumValue = {}; +EnumValue.match = function(this1,pattern) { + return false; +}; +var HxOverrides = function() { }; +$hxClasses["HxOverrides"] = HxOverrides; +HxOverrides.__name__ = "HxOverrides"; +HxOverrides.dateStr = function(date) { + var m = date.getMonth() + 1; + var d = date.getDate(); + var h = date.getHours(); + var mi = date.getMinutes(); + var s = date.getSeconds(); + return date.getFullYear() + "-" + (m < 10 ? "0" + m : "" + m) + "-" + (d < 10 ? "0" + d : "" + d) + " " + (h < 10 ? "0" + h : "" + h) + ":" + (mi < 10 ? "0" + mi : "" + mi) + ":" + (s < 10 ? "0" + s : "" + s); +}; +HxOverrides.strDate = function(s) { + switch(s.length) { + case 8: + var k = s.split(":"); + var d = new Date(); + d["setTime"](0); + d["setUTCHours"](k[0]); + d["setUTCMinutes"](k[1]); + d["setUTCSeconds"](k[2]); + return d; + case 10: + var k = s.split("-"); + return new Date(k[0],k[1] - 1,k[2],0,0,0); + case 19: + var k = s.split(" "); + var y = k[0].split("-"); + var t = k[1].split(":"); + return new Date(y[0],y[1] - 1,y[2],t[0],t[1],t[2]); + default: + throw haxe_Exception.thrown("Invalid date format : " + s); + } +}; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.indexOf = function(a,obj,i) { + var len = a.length; + if(i < 0) { + i += len; + if(i < 0) { + i = 0; + } + } + while(i < len) { + if(((a[i]) === obj)) { + return i; + } + ++i; + } + return -1; +}; +HxOverrides.lastIndexOf = function(a,obj,i) { + var len = a.length; + if(i >= len) { + i = len - 1; + } else if(i < 0) { + i += len; + } + while(i >= 0) { + if(((a[i]) === obj)) { + return i; + } + --i; + } + return -1; +}; +HxOverrides.remove = function(a,obj) { + var i = a.indexOf(obj); + if(i == -1) { + return false; + } + a.splice(i,1); + return true; +}; +HxOverrides.iter = function(a) { + return { cur : 0, arr : a, hasNext : function() { + return this.cur < this.arr.length; + }, next : function() { + return this.arr[this.cur++]; + }}; +}; +HxOverrides.keyValueIter = function(a) { + return new haxe_iterators_ArrayKeyValueIterator(a); +}; +HxOverrides.now = function() { + return Date.now(); +}; +var IntIterator = function(min,max) { + this.min = min; + this.max = max; +}; +$hxClasses["IntIterator"] = IntIterator; +IntIterator.__name__ = "IntIterator"; +IntIterator.prototype = { + min: null + ,max: null + ,hasNext: function() { + return this.min < this.max; + } + ,next: function() { + return this.min++; + } + ,__class__: IntIterator +}; +Math.__name__ = "Math"; +var Reflect = function() { }; +$hxClasses["Reflect"] = Reflect; +Reflect.__name__ = "Reflect"; +Reflect.hasField = function(o,field) { + return Object.prototype.hasOwnProperty.call(o,field); +}; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + haxe_NativeStackTrace.lastError = _g; + return null; + } +}; +Reflect.setField = function(o,field,value) { + o[field] = value; +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.setProperty = function(o,field,value) { + var tmp; + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["set_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + o[tmp](value); + } else { + o[field] = value; + } +}; +Reflect.callMethod = function(o,func,args) { + return func.apply(o,args); +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isFunction = function(f) { + if(typeof(f) == "function") { + return !(f.__name__ || f.__ename__); + } else { + return false; + } +}; +Reflect.compare = function(a,b) { + if(a == b) { + return 0; + } else if(a > b) { + return 1; + } else { + return -1; + } +}; +Reflect.compareMethods = function(f1,f2) { + if(f1 == f2) { + return true; + } + if(!Reflect.isFunction(f1) || !Reflect.isFunction(f2)) { + return false; + } + if(f1.scope == f2.scope && f1.method == f2.method) { + return f1.method != null; + } else { + return false; + } +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.isEnumValue = function(v) { + if(v != null) { + return v.__enum__ != null; + } else { + return false; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +Reflect.makeVarArgs = function(f) { + return function() { + var a = Array.prototype.slice; + var a1 = arguments; + var a2 = a.call(a1); + return f(a2); + }; +}; +var Std = function() { }; +$hxClasses["Std"] = Std; +Std.__name__ = "Std"; +Std.is = function(v,t) { + return js_Boot.__instanceof(v,t); +}; +Std.isOfType = function(v,t) { + return js_Boot.__instanceof(v,t); +}; +Std.downcast = function(value,c) { + if(js_Boot.__downcastCheck(value,c)) { + return value; + } else { + return null; + } +}; +Std.instance = function(value,c) { + if(js_Boot.__downcastCheck(value,c)) { + return value; + } else { + return null; + } +}; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.int = function(x) { + return x | 0; +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +Std.parseFloat = function(x) { + return parseFloat(x); +}; +Std.random = function(x) { + if(x <= 0) { + return 0; + } else { + return Math.floor(Math.random() * x); + } +}; +var StringBuf = function() { + this.b = ""; +}; +$hxClasses["StringBuf"] = StringBuf; +StringBuf.__name__ = "StringBuf"; +StringBuf.prototype = { + b: null + ,get_length: function() { + return this.b.length; + } + ,add: function(x) { + this.b += Std.string(x); + } + ,addChar: function(c) { + this.b += String.fromCodePoint(c); + } + ,addSub: function(s,pos,len) { + this.b += len == null ? HxOverrides.substr(s,pos,null) : HxOverrides.substr(s,pos,len); + } + ,toString: function() { + return this.b; + } + ,__class__: StringBuf + ,__properties__: {get_length:"get_length"} +}; +var haxe_SysTools = function() { }; +$hxClasses["haxe.SysTools"] = haxe_SysTools; +haxe_SysTools.__name__ = "haxe.SysTools"; +haxe_SysTools.quoteUnixArg = function(argument) { + if(argument == "") { + return "''"; + } + if(!new EReg("[^a-zA-Z0-9_@%+=:,./-]","").match(argument)) { + return argument; + } + return "'" + StringTools.replace(argument,"'","'\"'\"'") + "'"; +}; +haxe_SysTools.quoteWinArg = function(argument,escapeMetaCharacters) { + if(!new EReg("^[^ \t\\\\\"]+$","").match(argument)) { + var result_b = ""; + var needquote = argument.indexOf(" ") != -1 || argument.indexOf("\t") != -1 || argument == ""; + if(needquote) { + result_b += "\""; + } + var bs_buf = new StringBuf(); + var _g = 0; + var _g1 = argument.length; + while(_g < _g1) { + var i = _g++; + var _g2 = HxOverrides.cca(argument,i); + if(_g2 == null) { + var c = _g2; + if(bs_buf.b.length > 0) { + result_b += Std.string(bs_buf.b); + bs_buf = new StringBuf(); + } + result_b += String.fromCodePoint(c); + } else { + switch(_g2) { + case 34: + var bs = bs_buf.b; + result_b += bs == null ? "null" : "" + bs; + result_b += bs == null ? "null" : "" + bs; + bs_buf = new StringBuf(); + result_b += "\\\""; + break; + case 92: + bs_buf.b += "\\"; + break; + default: + var c1 = _g2; + if(bs_buf.b.length > 0) { + result_b += Std.string(bs_buf.b); + bs_buf = new StringBuf(); + } + result_b += String.fromCodePoint(c1); + } + } + } + result_b += Std.string(bs_buf.b); + if(needquote) { + result_b += Std.string(bs_buf.b); + result_b += "\""; + } + argument = result_b; + } + if(escapeMetaCharacters) { + var result_b = ""; + var _g = 0; + var _g1 = argument.length; + while(_g < _g1) { + var i = _g++; + var c = HxOverrides.cca(argument,i); + if(haxe_SysTools.winMetaCharacters.indexOf(c) >= 0) { + result_b += String.fromCodePoint(94); + } + result_b += String.fromCodePoint(c); + } + return result_b; + } else { + return argument; + } +}; +var StringTools = function() { }; +$hxClasses["StringTools"] = StringTools; +StringTools.__name__ = "StringTools"; +StringTools.urlEncode = function(s) { + return encodeURIComponent(s); +}; +StringTools.urlDecode = function(s) { + return decodeURIComponent(s.split("+").join(" ")); +}; +StringTools.htmlEscape = function(s,quotes) { + var buf_b = ""; + var _g_offset = 0; + var _g_s = s; + while(_g_offset < _g_s.length) { + var s = _g_s; + var index = _g_offset++; + var c = s.charCodeAt(index); + if(c >= 55296 && c <= 56319) { + c = c - 55232 << 10 | s.charCodeAt(index + 1) & 1023; + } + var c1 = c; + if(c1 >= 65536) { + ++_g_offset; + } + var code = c1; + switch(code) { + case 34: + if(quotes) { + buf_b += """; + } else { + buf_b += String.fromCodePoint(code); + } + break; + case 38: + buf_b += "&"; + break; + case 39: + if(quotes) { + buf_b += "'"; + } else { + buf_b += String.fromCodePoint(code); + } + break; + case 60: + buf_b += "<"; + break; + case 62: + buf_b += ">"; + break; + default: + buf_b += String.fromCodePoint(code); + } + } + return buf_b; +}; +StringTools.htmlUnescape = function(s) { + return s.split(">").join(">").split("<").join("<").split(""").join("\"").split("'").join("'").split("&").join("&"); +}; +StringTools.contains = function(s,value) { + return s.indexOf(value) != -1; +}; +StringTools.startsWith = function(s,start) { + if(s.length >= start.length) { + return s.lastIndexOf(start,0) == 0; + } else { + return false; + } +}; +StringTools.endsWith = function(s,end) { + var elen = end.length; + var slen = s.length; + if(slen >= elen) { + return s.indexOf(end,slen - elen) == slen - elen; + } else { + return false; + } +}; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.lpad = function(s,c,l) { + if(c.length <= 0) { + return s; + } + var buf_b = ""; + l -= s.length; + while(buf_b.length < l) buf_b += c == null ? "null" : "" + c; + buf_b += s == null ? "null" : "" + s; + return buf_b; +}; +StringTools.rpad = function(s,c,l) { + if(c.length <= 0) { + return s; + } + var buf_b = ""; + buf_b += s == null ? "null" : "" + s; + while(buf_b.length < l) buf_b += c == null ? "null" : "" + c; + return buf_b; +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +StringTools.hex = function(n,digits) { + var s = ""; + var hexChars = "0123456789ABCDEF"; + while(true) { + s = hexChars.charAt(n & 15) + s; + n >>>= 4; + if(!(n > 0)) { + break; + } + } + if(digits != null) { + while(s.length < digits) s = "0" + s; + } + return s; +}; +StringTools.fastCodeAt = function(s,index) { + return s.charCodeAt(index); +}; +StringTools.unsafeCodeAt = function(s,index) { + return s.charCodeAt(index); +}; +StringTools.iterator = function(s) { + return new haxe_iterators_StringIterator(s); +}; +StringTools.keyValueIterator = function(s) { + return new haxe_iterators_StringKeyValueIterator(s); +}; +StringTools.isEof = function(c) { + return c != c; +}; +StringTools.quoteUnixArg = function(argument) { + if(argument == "") { + return "''"; + } else if(!new EReg("[^a-zA-Z0-9_@%+=:,./-]","").match(argument)) { + return argument; + } else { + return "'" + StringTools.replace(argument,"'","'\"'\"'") + "'"; + } +}; +StringTools.quoteWinArg = function(argument,escapeMetaCharacters) { + var argument1 = argument; + if(!new EReg("^[^ \t\\\\\"]+$","").match(argument1)) { + var result_b = ""; + var needquote = argument1.indexOf(" ") != -1 || argument1.indexOf("\t") != -1 || argument1 == ""; + if(needquote) { + result_b += "\""; + } + var bs_buf = new StringBuf(); + var _g = 0; + var _g1 = argument1.length; + while(_g < _g1) { + var i = _g++; + var _g2 = HxOverrides.cca(argument1,i); + if(_g2 == null) { + var c = _g2; + if(bs_buf.b.length > 0) { + result_b += Std.string(bs_buf.b); + bs_buf = new StringBuf(); + } + result_b += String.fromCodePoint(c); + } else { + switch(_g2) { + case 34: + var bs = bs_buf.b; + result_b += Std.string(bs); + result_b += Std.string(bs); + bs_buf = new StringBuf(); + result_b += "\\\""; + break; + case 92: + bs_buf.b += "\\"; + break; + default: + var c1 = _g2; + if(bs_buf.b.length > 0) { + result_b += Std.string(bs_buf.b); + bs_buf = new StringBuf(); + } + result_b += String.fromCodePoint(c1); + } + } + } + result_b += Std.string(bs_buf.b); + if(needquote) { + result_b += Std.string(bs_buf.b); + result_b += "\""; + } + argument1 = result_b; + } + if(escapeMetaCharacters) { + var result_b = ""; + var _g = 0; + var _g1 = argument1.length; + while(_g < _g1) { + var i = _g++; + var c = HxOverrides.cca(argument1,i); + if(haxe_SysTools.winMetaCharacters.indexOf(c) >= 0) { + result_b += String.fromCodePoint(94); + } + result_b += String.fromCodePoint(c); + } + return result_b; + } else { + return argument1; + } +}; +StringTools.utf16CodePointAt = function(s,index) { + var c = s.charCodeAt(index); + if(c >= 55296 && c <= 56319) { + c = c - 55232 << 10 | s.charCodeAt(index + 1) & 1023; + } + return c; +}; +var ValueType = $hxEnums["ValueType"] = { __ename__:"ValueType",__constructs__:null + ,TNull: {_hx_name:"TNull",_hx_index:0,__enum__:"ValueType"} + ,TInt: {_hx_name:"TInt",_hx_index:1,__enum__:"ValueType"} + ,TFloat: {_hx_name:"TFloat",_hx_index:2,__enum__:"ValueType"} + ,TBool: {_hx_name:"TBool",_hx_index:3,__enum__:"ValueType"} + ,TObject: {_hx_name:"TObject",_hx_index:4,__enum__:"ValueType"} + ,TFunction: {_hx_name:"TFunction",_hx_index:5,__enum__:"ValueType"} + ,TClass: ($_=function(c) { return {_hx_index:6,c:c,__enum__:"ValueType"}; },$_._hx_name="TClass",$_.__params__ = ["c"],$_) + ,TEnum: ($_=function(e) { return {_hx_index:7,e:e,__enum__:"ValueType"}; },$_._hx_name="TEnum",$_.__params__ = ["e"],$_) + ,TUnknown: {_hx_name:"TUnknown",_hx_index:8,__enum__:"ValueType"} +}; +ValueType.__constructs__ = [ValueType.TNull,ValueType.TInt,ValueType.TFloat,ValueType.TBool,ValueType.TObject,ValueType.TFunction,ValueType.TClass,ValueType.TEnum,ValueType.TUnknown]; +ValueType.__empty_constructs__ = [ValueType.TNull,ValueType.TInt,ValueType.TFloat,ValueType.TBool,ValueType.TObject,ValueType.TFunction,ValueType.TUnknown]; +var Type = function() { }; +$hxClasses["Type"] = Type; +Type.__name__ = "Type"; +Type.getClass = function(o) { + return js_Boot.getClass(o); +}; +Type.getEnum = function(o) { + if(o == null) { + return null; + } + return $hxEnums[o.__enum__]; +}; +Type.getSuperClass = function(c) { + return c.__super__; +}; +Type.getClassName = function(c) { + return c.__name__; +}; +Type.getEnumName = function(e) { + return e.__ename__; +}; +Type.resolveClass = function(name) { + return $hxClasses[name]; +}; +Type.resolveEnum = function(name) { + return $hxEnums[name]; +}; +Type.createInstance = function(cl,args) { + var ctor = Function.prototype.bind.apply(cl,[null].concat(args)); + return new (ctor); +}; +Type.createEmptyInstance = function(cl) { + return Object.create(cl.prototype); +}; +Type.createEnum = function(e,constr,params) { + var f = Reflect.field(e,constr); + if(f == null) { + throw haxe_Exception.thrown("No such constructor " + constr); + } + if(Reflect.isFunction(f)) { + if(params == null) { + throw haxe_Exception.thrown("Constructor " + constr + " need parameters"); + } + return f.apply(e,params); + } + if(params != null && params.length != 0) { + throw haxe_Exception.thrown("Constructor " + constr + " does not need parameters"); + } + return f; +}; +Type.createEnumIndex = function(e,index,params) { + var c; + var _g = e.__constructs__[index]; + if(_g == null) { + c = null; + } else { + var ctor = _g; + c = ctor._hx_name; + } + if(c == null) { + throw haxe_Exception.thrown(index + " is not a valid enum constructor index"); + } + return Type.createEnum(e,c,params); +}; +Type.getInstanceFields = function(c) { + var a = []; + for(var i in c.prototype) a.push(i); + HxOverrides.remove(a,"__class__"); + HxOverrides.remove(a,"__properties__"); + return a; +}; +Type.getClassFields = function(c) { + var a = Reflect.fields(c); + HxOverrides.remove(a,"__name__"); + HxOverrides.remove(a,"__interfaces__"); + HxOverrides.remove(a,"__properties__"); + HxOverrides.remove(a,"__super__"); + HxOverrides.remove(a,"__meta__"); + HxOverrides.remove(a,"prototype"); + return a; +}; +Type.getEnumConstructs = function(e) { + var _this = e.__constructs__; + var result = new Array(_this.length); + var _g = 0; + var _g1 = _this.length; + while(_g < _g1) { + var i = _g++; + result[i] = _this[i]._hx_name; + } + return result; +}; +Type.typeof = function(v) { + switch(typeof(v)) { + case "boolean": + return ValueType.TBool; + case "function": + if(v.__name__ || v.__ename__) { + return ValueType.TObject; + } + return ValueType.TFunction; + case "number": + if(Math.ceil(v) == v % 2147483648.0) { + return ValueType.TInt; + } + return ValueType.TFloat; + case "object": + if(v == null) { + return ValueType.TNull; + } + var e = v.__enum__; + if(e != null) { + return ValueType.TEnum($hxEnums[e]); + } + var c = js_Boot.getClass(v); + if(c != null) { + return ValueType.TClass(c); + } + return ValueType.TObject; + case "string": + return ValueType.TClass(String); + case "undefined": + return ValueType.TNull; + default: + return ValueType.TUnknown; + } +}; +Type.enumEq = function(a,b) { + if(a == b) { + return true; + } + try { + var e = a.__enum__; + if(e == null || e != b.__enum__) { + return false; + } + if(a._hx_index != b._hx_index) { + return false; + } + var enm = $hxEnums[e]; + var params = enm.__constructs__[a._hx_index].__params__; + var _g = 0; + while(_g < params.length) { + var f = params[_g]; + ++_g; + if(!Type.enumEq(a[f],b[f])) { + return false; + } + } + } catch( _g ) { + haxe_NativeStackTrace.lastError = _g; + return false; + } + return true; +}; +Type.enumConstructor = function(e) { + return $hxEnums[e.__enum__].__constructs__[e._hx_index]._hx_name; +}; +Type.enumParameters = function(e) { + var enm = $hxEnums[e.__enum__]; + var params = enm.__constructs__[e._hx_index].__params__; + if(params != null) { + var _g = []; + var _g1 = 0; + while(_g1 < params.length) { + var p = params[_g1]; + ++_g1; + _g.push(e[p]); + } + return _g; + } else { + return []; + } +}; +Type.enumIndex = function(e) { + return e._hx_index; +}; +Type.allEnums = function(e) { + return e.__empty_constructs__.slice(); +}; +var haxe_StackItem = $hxEnums["haxe.StackItem"] = { __ename__:"haxe.StackItem",__constructs__:null + ,CFunction: {_hx_name:"CFunction",_hx_index:0,__enum__:"haxe.StackItem"} + ,Module: ($_=function(m) { return {_hx_index:1,m:m,__enum__:"haxe.StackItem"}; },$_._hx_name="Module",$_.__params__ = ["m"],$_) + ,FilePos: ($_=function(s,file,line,column) { return {_hx_index:2,s:s,file:file,line:line,column:column,__enum__:"haxe.StackItem"}; },$_._hx_name="FilePos",$_.__params__ = ["s","file","line","column"],$_) + ,Method: ($_=function(classname,method) { return {_hx_index:3,classname:classname,method:method,__enum__:"haxe.StackItem"}; },$_._hx_name="Method",$_.__params__ = ["classname","method"],$_) + ,LocalFunction: ($_=function(v) { return {_hx_index:4,v:v,__enum__:"haxe.StackItem"}; },$_._hx_name="LocalFunction",$_.__params__ = ["v"],$_) +}; +haxe_StackItem.__constructs__ = [haxe_StackItem.CFunction,haxe_StackItem.Module,haxe_StackItem.FilePos,haxe_StackItem.Method,haxe_StackItem.LocalFunction]; +haxe_StackItem.__empty_constructs__ = [haxe_StackItem.CFunction]; +var haxe_CallStack = {}; +haxe_CallStack.__properties__ = {get_length:"get_length"}; +haxe_CallStack.get_length = function(this1) { + return this1.length; +}; +haxe_CallStack.callStack = function() { + return haxe_NativeStackTrace.toHaxe(haxe_NativeStackTrace.callStack()); +}; +haxe_CallStack.exceptionStack = function(fullStack) { + if(fullStack == null) { + fullStack = false; + } + var eStack = haxe_NativeStackTrace.toHaxe(haxe_NativeStackTrace.exceptionStack()); + return fullStack ? eStack : haxe_CallStack.subtract(eStack,haxe_CallStack.callStack()); +}; +haxe_CallStack.toString = function(stack) { + var b = new StringBuf(); + var _g = 0; + var _g1 = stack; + while(_g < _g1.length) { + var s = _g1[_g]; + ++_g; + b.b += "\nCalled from "; + haxe_CallStack.itemToString(b,s); + } + return b.b; +}; +haxe_CallStack.subtract = function(this1,stack) { + var startIndex = -1; + var i = -1; + while(++i < this1.length) { + var _g = 0; + var _g1 = stack.length; + while(_g < _g1) { + var j = _g++; + if(haxe_CallStack.equalItems(this1[i],stack[j])) { + if(startIndex < 0) { + startIndex = i; + } + ++i; + if(i >= this1.length) { + break; + } + } else { + startIndex = -1; + } + } + if(startIndex >= 0) { + break; + } + } + if(startIndex >= 0) { + return this1.slice(0,startIndex); + } else { + return this1; + } +}; +haxe_CallStack.copy = function(this1) { + return this1.slice(); +}; +haxe_CallStack.get = function(this1,index) { + return this1[index]; +}; +haxe_CallStack.asArray = function(this1) { + return this1; +}; +haxe_CallStack.equalItems = function(item1,item2) { + if(item1 == null) { + if(item2 == null) { + return true; + } else { + return false; + } + } else { + switch(item1._hx_index) { + case 0: + if(item2 == null) { + return false; + } else if(item2._hx_index == 0) { + return true; + } else { + return false; + } + break; + case 1: + if(item2 == null) { + return false; + } else if(item2._hx_index == 1) { + var m2 = item2.m; + var m1 = item1.m; + return m1 == m2; + } else { + return false; + } + break; + case 2: + if(item2 == null) { + return false; + } else if(item2._hx_index == 2) { + var item21 = item2.s; + var file2 = item2.file; + var line2 = item2.line; + var col2 = item2.column; + var col1 = item1.column; + var line1 = item1.line; + var file1 = item1.file; + var item11 = item1.s; + if(file1 == file2 && line1 == line2 && col1 == col2) { + return haxe_CallStack.equalItems(item11,item21); + } else { + return false; + } + } else { + return false; + } + break; + case 3: + if(item2 == null) { + return false; + } else if(item2._hx_index == 3) { + var class2 = item2.classname; + var method2 = item2.method; + var method1 = item1.method; + var class1 = item1.classname; + if(class1 == class2) { + return method1 == method2; + } else { + return false; + } + } else { + return false; + } + break; + case 4: + if(item2 == null) { + return false; + } else if(item2._hx_index == 4) { + var v2 = item2.v; + var v1 = item1.v; + return v1 == v2; + } else { + return false; + } + break; + } + } +}; +haxe_CallStack.exceptionToString = function(e) { + if(e.get_previous() == null) { + var tmp = "Exception: " + e.toString(); + var tmp1 = e.get_stack(); + return tmp + (tmp1 == null ? "null" : haxe_CallStack.toString(tmp1)); + } + var result = ""; + var e1 = e; + var prev = null; + while(e1 != null) { + if(prev == null) { + var result1 = "Exception: " + e1.get_message(); + var tmp = e1.get_stack(); + result = result1 + (tmp == null ? "null" : haxe_CallStack.toString(tmp)) + result; + } else { + var prevStack = haxe_CallStack.subtract(e1.get_stack(),prev.get_stack()); + result = "Exception: " + e1.get_message() + (prevStack == null ? "null" : haxe_CallStack.toString(prevStack)) + "\n\nNext " + result; + } + prev = e1; + e1 = e1.get_previous(); + } + return result; +}; +haxe_CallStack.itemToString = function(b,s) { + switch(s._hx_index) { + case 0: + b.b += "a C function"; + break; + case 1: + var m = s.m; + b.b += "module "; + b.b += m == null ? "null" : "" + m; + break; + case 2: + var s1 = s.s; + var file = s.file; + var line = s.line; + var col = s.column; + if(s1 != null) { + haxe_CallStack.itemToString(b,s1); + b.b += " ("; + } + b.b += file == null ? "null" : "" + file; + b.b += " line "; + b.b += line == null ? "null" : "" + line; + if(col != null) { + b.b += " column "; + b.b += col == null ? "null" : "" + col; + } + if(s1 != null) { + b.b += ")"; + } + break; + case 3: + var cname = s.classname; + var meth = s.method; + b.b += Std.string(cname == null ? "" : cname); + b.b += "."; + b.b += meth == null ? "null" : "" + meth; + break; + case 4: + var n = s.v; + b.b += "local function #"; + b.b += n == null ? "null" : "" + n; + break; + } +}; +var haxe_IMap = function() { }; +$hxClasses["haxe.IMap"] = haxe_IMap; +haxe_IMap.__name__ = "haxe.IMap"; +haxe_IMap.__isInterface__ = true; +haxe_IMap.prototype = { + get: null + ,set: null + ,exists: null + ,remove: null + ,keys: null + ,iterator: null + ,keyValueIterator: null + ,copy: null + ,toString: null + ,clear: null + ,__class__: haxe_IMap +}; +var haxe_DynamicAccess = {}; +haxe_DynamicAccess._new = function() { + var this1 = { }; + return this1; +}; +haxe_DynamicAccess.get = function(this1,key) { + return this1[key]; +}; +haxe_DynamicAccess.set = function(this1,key,value) { + return this1[key] = value; +}; +haxe_DynamicAccess.exists = function(this1,key) { + return Object.prototype.hasOwnProperty.call(this1,key); +}; +haxe_DynamicAccess.remove = function(this1,key) { + return Reflect.deleteField(this1,key); +}; +haxe_DynamicAccess.keys = function(this1) { + return Reflect.fields(this1); +}; +haxe_DynamicAccess.copy = function(this1) { + return Reflect.copy(this1); +}; +haxe_DynamicAccess.iterator = function(this1) { + return new haxe_iterators_DynamicAccessIterator(this1); +}; +haxe_DynamicAccess.keyValueIterator = function(this1) { + return new haxe_iterators_DynamicAccessKeyValueIterator(this1); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; + this.__skipStack = 0; + var old = Error.prepareStackTrace; + Error.prepareStackTrace = function(e) { return e.stack; } + if(((native) instanceof Error)) { + this.stack = native.stack; + } else { + var e = null; + if(Error.captureStackTrace) { + Error.captureStackTrace(this,haxe_Exception); + e = this; + } else { + e = new Error(); + if(typeof(e.stack) == "undefined") { + try { throw e; } catch(_) {} + this.__skipStack++; + } + } + this.stack = e.stack; + } + Error.prepareStackTrace = old; +}; +$hxClasses["haxe.Exception"] = haxe_Exception; +haxe_Exception.__name__ = "haxe.Exception"; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + e.__skipStack++; + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + __skipStack: null + ,__nativeException: null + ,__previousException: null + ,unwrap: function() { + return this.__nativeException; + } + ,toString: function() { + return this.get_message(); + } + ,details: function() { + if(this.get_previous() == null) { + var tmp = "Exception: " + this.toString(); + var tmp1 = this.get_stack(); + return tmp + (tmp1 == null ? "null" : haxe_CallStack.toString(tmp1)); + } else { + var result = ""; + var e = this; + var prev = null; + while(e != null) { + if(prev == null) { + var result1 = "Exception: " + e.get_message(); + var tmp = e.get_stack(); + result = result1 + (tmp == null ? "null" : haxe_CallStack.toString(tmp)) + result; + } else { + var prevStack = haxe_CallStack.subtract(e.get_stack(),prev.get_stack()); + result = "Exception: " + e.get_message() + (prevStack == null ? "null" : haxe_CallStack.toString(prevStack)) + "\n\nNext " + result; + } + prev = e; + e = e.get_previous(); + } + return result; + } + } + ,__shiftStack: function() { + this.__skipStack++; + } + ,get_message: function() { + return this.message; + } + ,get_previous: function() { + return this.__previousException; + } + ,get_native: function() { + return this.__nativeException; + } + ,get_stack: function() { + var _g = this.__exceptionStack; + if(_g == null) { + var value = haxe_NativeStackTrace.toHaxe(haxe_NativeStackTrace.normalize(this.stack),this.__skipStack); + this.setProperty("__exceptionStack",value); + return value; + } else { + var s = _g; + return s; + } + } + ,setProperty: function(name,value) { + try { + Object.defineProperty(this,name,{ value : value}); + } catch( _g ) { + this[name] = value; + } + } + ,get___exceptionStack: function() { + return this.__exceptionStack; + } + ,set___exceptionStack: function(value) { + this.setProperty("__exceptionStack",value); + return value; + } + ,get___skipStack: function() { + return this.__skipStack; + } + ,set___skipStack: function(value) { + this.setProperty("__skipStack",value); + return value; + } + ,get___nativeException: function() { + return this.__nativeException; + } + ,set___nativeException: function(value) { + this.setProperty("__nativeException",value); + return value; + } + ,get___previousException: function() { + return this.__previousException; + } + ,set___previousException: function(value) { + this.setProperty("__previousException",value); + return value; + } + ,__class__: haxe_Exception + ,__properties__: {set___exceptionStack:"set___exceptionStack",get___exceptionStack:"get___exceptionStack",get_native:"get_native",get_previous:"get_previous",get_stack:"get_stack",get_message:"get_message"} +}); +var haxe_NativeStackTrace = function() { }; +$hxClasses["haxe.NativeStackTrace"] = haxe_NativeStackTrace; +haxe_NativeStackTrace.__name__ = "haxe.NativeStackTrace"; +haxe_NativeStackTrace.lastError = null; +haxe_NativeStackTrace.wrapCallSite = null; +haxe_NativeStackTrace.saveStack = function(e) { + haxe_NativeStackTrace.lastError = e; +}; +haxe_NativeStackTrace.callStack = function() { + var e = new Error(""); + var stack = haxe_NativeStackTrace.tryHaxeStack(e); + if(typeof(stack) == "undefined") { + try { + throw e; + } catch( _g ) { + } + stack = e.stack; + } + return haxe_NativeStackTrace.normalize(stack,2); +}; +haxe_NativeStackTrace.exceptionStack = function() { + return haxe_NativeStackTrace.normalize(haxe_NativeStackTrace.tryHaxeStack(haxe_NativeStackTrace.lastError)); +}; +haxe_NativeStackTrace.toHaxe = function(s,skip) { + if(skip == null) { + skip = 0; + } + if(s == null) { + return []; + } else if(typeof(s) == "string") { + var stack = s.split("\n"); + if(stack[0] == "Error") { + stack.shift(); + } + var m = []; + var _g = 0; + var _g1 = stack.length; + while(_g < _g1) { + var i = _g++; + if(skip > i) { + continue; + } + var line = stack[i]; + var matched = line.match(/^ at ([A-Za-z0-9_. ]+) \(([^)]+):([0-9]+):([0-9]+)\)$/); + if(matched != null) { + var path = matched[1].split("."); + if(path[0] == "$hxClasses") { + path.shift(); + } + var meth = path.pop(); + var file = matched[2]; + var line1 = Std.parseInt(matched[3]); + var column = Std.parseInt(matched[4]); + m.push(haxe_StackItem.FilePos(meth == "Anonymous function" ? haxe_StackItem.LocalFunction() : meth == "Global code" ? null : haxe_StackItem.Method(path.join("."),meth),file,line1,column)); + } else { + m.push(haxe_StackItem.Module(StringTools.trim(line))); + } + } + return m; + } else if(skip > 0 && Array.isArray(s)) { + return s.slice(skip); + } else { + return s; + } +}; +haxe_NativeStackTrace.tryHaxeStack = function(e) { + if(e == null) { + return []; + } + var oldValue = Error.prepareStackTrace; + Error.prepareStackTrace = haxe_NativeStackTrace.prepareHxStackTrace; + var stack = e.stack; + Error.prepareStackTrace = oldValue; + return stack; +}; +haxe_NativeStackTrace.prepareHxStackTrace = function(e,callsites) { + var stack = []; + var _g = 0; + while(_g < callsites.length) { + var site = callsites[_g]; + ++_g; + if(haxe_NativeStackTrace.wrapCallSite != null) { + site = haxe_NativeStackTrace.wrapCallSite(site); + } + var method = null; + var fullName = site.getFunctionName(); + if(fullName != null) { + var idx = fullName.lastIndexOf("."); + if(idx >= 0) { + var className = fullName.substring(0,idx); + var methodName = fullName.substring(idx + 1); + method = haxe_StackItem.Method(className,methodName); + } else { + method = haxe_StackItem.Method(null,fullName); + } + } + var fileName = site.getFileName(); + var fileAddr = fileName == null ? -1 : fileName.indexOf("file:"); + if(haxe_NativeStackTrace.wrapCallSite != null && fileAddr > 0) { + fileName = fileName.substring(fileAddr + 6); + } + stack.push(haxe_StackItem.FilePos(method,fileName,site.getLineNumber(),site.getColumnNumber())); + } + return stack; +}; +haxe_NativeStackTrace.normalize = function(stack,skipItems) { + if(skipItems == null) { + skipItems = 0; + } + if(Array.isArray(stack) && skipItems > 0) { + return stack.slice(skipItems); + } else if(typeof(stack) == "string") { + switch(stack.substring(0,6)) { + case "Error\n":case "Error:": + ++skipItems; + break; + default: + } + return haxe_NativeStackTrace.skipLines(stack,skipItems); + } else { + return stack; + } +}; +haxe_NativeStackTrace.skipLines = function(stack,skip,pos) { + if(pos == null) { + pos = 0; + } + if(skip > 0) { + pos = stack.indexOf("\n",pos); + if(pos < 0) { + return ""; + } else { + return haxe_NativeStackTrace.skipLines(stack,--skip,pos + 1); + } + } else { + return stack.substring(pos); + } +}; +var haxe_Rest = {}; +haxe_Rest.__properties__ = {get_length:"get_length"}; +haxe_Rest.get_length = function(this1) { + return this1.length; +}; +haxe_Rest.of = function(array) { + var this1 = array; + return this1; +}; +haxe_Rest._new = function(array) { + var this1 = array; + return this1; +}; +haxe_Rest.get = function(this1,index) { + return this1[index]; +}; +haxe_Rest.toArray = function(this1) { + return this1.slice(); +}; +haxe_Rest.iterator = function(this1) { + return new haxe_iterators_RestIterator(this1); +}; +haxe_Rest.keyValueIterator = function(this1) { + return new haxe_iterators_RestKeyValueIterator(this1); +}; +haxe_Rest.append = function(this1,item) { + var result = this1.slice(); + result.push(item); + var this1 = result; + return this1; +}; +haxe_Rest.prepend = function(this1,item) { + var result = this1.slice(); + result.unshift(item); + var this1 = result; + return this1; +}; +haxe_Rest.toString = function(this1) { + return "[" + this1.toString() + "]"; +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; + this.__skipStack++; +}; +$hxClasses["haxe.ValueException"] = haxe_ValueException; +haxe_ValueException.__name__ = "haxe.ValueException"; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + value: null + ,unwrap: function() { + return this.value; + } + ,__class__: haxe_ValueException +}); +var haxe_ds_ReadOnlyArray = {}; +haxe_ds_ReadOnlyArray.__properties__ = {get_length:"get_length"}; +haxe_ds_ReadOnlyArray.get_length = function(this1) { + return this1.length; +}; +haxe_ds_ReadOnlyArray.get = function(this1,i) { + return this1[i]; +}; +haxe_ds_ReadOnlyArray.concat = function(this1,a) { + return this1.concat(a); +}; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +$hxClasses["haxe.iterators.ArrayIterator"] = haxe_iterators_ArrayIterator; +haxe_iterators_ArrayIterator.__name__ = "haxe.iterators.ArrayIterator"; +haxe_iterators_ArrayIterator.prototype = { + array: null + ,current: null + ,hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } + ,__class__: haxe_iterators_ArrayIterator +}; +var haxe_iterators_ArrayKeyValueIterator = function(array) { + this.current = 0; + this.array = array; +}; +$hxClasses["haxe.iterators.ArrayKeyValueIterator"] = haxe_iterators_ArrayKeyValueIterator; +haxe_iterators_ArrayKeyValueIterator.__name__ = "haxe.iterators.ArrayKeyValueIterator"; +haxe_iterators_ArrayKeyValueIterator.prototype = { + current: null + ,array: null + ,hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return { value : this.array[this.current], key : this.current++}; + } + ,__class__: haxe_iterators_ArrayKeyValueIterator +}; +var haxe_iterators_DynamicAccessIterator = function(access) { + this.access = access; + this.keys = Reflect.fields(access); + this.index = 0; +}; +$hxClasses["haxe.iterators.DynamicAccessIterator"] = haxe_iterators_DynamicAccessIterator; +haxe_iterators_DynamicAccessIterator.__name__ = "haxe.iterators.DynamicAccessIterator"; +haxe_iterators_DynamicAccessIterator.prototype = { + access: null + ,keys: null + ,index: null + ,hasNext: function() { + return this.index < this.keys.length; + } + ,next: function() { + return this.access[this.keys[this.index++]]; + } + ,__class__: haxe_iterators_DynamicAccessIterator +}; +var haxe_iterators_DynamicAccessKeyValueIterator = function(access) { + this.access = access; + this.keys = Reflect.fields(access); + this.index = 0; +}; +$hxClasses["haxe.iterators.DynamicAccessKeyValueIterator"] = haxe_iterators_DynamicAccessKeyValueIterator; +haxe_iterators_DynamicAccessKeyValueIterator.__name__ = "haxe.iterators.DynamicAccessKeyValueIterator"; +haxe_iterators_DynamicAccessKeyValueIterator.prototype = { + access: null + ,keys: null + ,index: null + ,hasNext: function() { + return this.index < this.keys.length; + } + ,next: function() { + var key = this.keys[this.index++]; + return { value : this.access[key], key : key}; + } + ,__class__: haxe_iterators_DynamicAccessKeyValueIterator +}; +var haxe_iterators_RestIterator = function(args) { + this.current = 0; + this.args = args; +}; +$hxClasses["haxe.iterators.RestIterator"] = haxe_iterators_RestIterator; +haxe_iterators_RestIterator.__name__ = "haxe.iterators.RestIterator"; +haxe_iterators_RestIterator.prototype = { + args: null + ,current: null + ,hasNext: function() { + return this.current < this.args.length; + } + ,next: function() { + return this.args[this.current++]; + } + ,__class__: haxe_iterators_RestIterator +}; +var haxe_iterators_RestKeyValueIterator = function(args) { + this.current = 0; + this.args = args; +}; +$hxClasses["haxe.iterators.RestKeyValueIterator"] = haxe_iterators_RestKeyValueIterator; +haxe_iterators_RestKeyValueIterator.__name__ = "haxe.iterators.RestKeyValueIterator"; +haxe_iterators_RestKeyValueIterator.prototype = { + args: null + ,current: null + ,hasNext: function() { + return this.current < this.args.length; + } + ,next: function() { + return { key : this.current, value : this.args[this.current++]}; + } + ,__class__: haxe_iterators_RestKeyValueIterator +}; +var haxe_iterators_StringIterator = function(s) { + this.offset = 0; + this.s = s; +}; +$hxClasses["haxe.iterators.StringIterator"] = haxe_iterators_StringIterator; +haxe_iterators_StringIterator.__name__ = "haxe.iterators.StringIterator"; +haxe_iterators_StringIterator.prototype = { + offset: null + ,s: null + ,hasNext: function() { + return this.offset < this.s.length; + } + ,next: function() { + return this.s.charCodeAt(this.offset++); + } + ,__class__: haxe_iterators_StringIterator +}; +var haxe_iterators_StringIteratorUnicode = function(s) { + this.offset = 0; + this.s = s; +}; +$hxClasses["haxe.iterators.StringIteratorUnicode"] = haxe_iterators_StringIteratorUnicode; +haxe_iterators_StringIteratorUnicode.__name__ = "haxe.iterators.StringIteratorUnicode"; +haxe_iterators_StringIteratorUnicode.unicodeIterator = function(s) { + return new haxe_iterators_StringIteratorUnicode(s); +}; +haxe_iterators_StringIteratorUnicode.prototype = { + offset: null + ,s: null + ,hasNext: function() { + return this.offset < this.s.length; + } + ,next: function() { + var s = this.s; + var index = this.offset++; + var c = s.charCodeAt(index); + if(c >= 55296 && c <= 56319) { + c = c - 55232 << 10 | s.charCodeAt(index + 1) & 1023; + } + var c1 = c; + if(c1 >= 65536) { + this.offset++; + } + return c1; + } + ,__class__: haxe_iterators_StringIteratorUnicode +}; +var haxe_iterators_StringKeyValueIterator = function(s) { + this.offset = 0; + this.s = s; +}; +$hxClasses["haxe.iterators.StringKeyValueIterator"] = haxe_iterators_StringKeyValueIterator; +haxe_iterators_StringKeyValueIterator.__name__ = "haxe.iterators.StringKeyValueIterator"; +haxe_iterators_StringKeyValueIterator.prototype = { + offset: null + ,s: null + ,hasNext: function() { + return this.offset < this.s.length; + } + ,next: function() { + return { key : this.offset, value : this.s.charCodeAt(this.offset++)}; + } + ,__class__: haxe_iterators_StringKeyValueIterator +}; +var js_Boot = function() { }; +$hxClasses["js.Boot"] = js_Boot; +js_Boot.__name__ = "js.Boot"; +js_Boot.isClass = function(o) { + return o.__name__; +}; +js_Boot.isInterface = function(o) { + return o.__isInterface__; +}; +js_Boot.isEnum = function(e) { + return e.__ename__; +}; +js_Boot.getClass = function(o) { + if(o == null) { + return null; + } else if(((o) instanceof Array)) { + return Array; + } else { + var cl = o.__class__; + if(cl != null) { + return cl; + } + var name = js_Boot.__nativeClassName(o); + if(name != null) { + return js_Boot.__resolveNativeClass(name); + } + return null; + } +}; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + haxe_NativeStackTrace.lastError = _g; + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +js_Boot.__interfLoop = function(cc,cl) { + if(cc == null) { + return false; + } + if(cc == cl) { + return true; + } + var intf = cc.__interfaces__; + if(intf != null) { + var _g = 0; + var _g1 = intf.length; + while(_g < _g1) { + var i = _g++; + var i1 = intf[i]; + if(i1 == cl || js_Boot.__interfLoop(i1,cl)) { + return true; + } + } + } + return js_Boot.__interfLoop(cc.__super__,cl); +}; +js_Boot.__instanceof = function(o,cl) { + if(cl == null) { + return false; + } + switch(cl) { + case Array: + return ((o) instanceof Array); + case Bool: + return typeof(o) == "boolean"; + case Dynamic: + return o != null; + case Float: + return typeof(o) == "number"; + case Int: + if(typeof(o) == "number") { + return ((o | 0) === o); + } else { + return false; + } + break; + case String: + return typeof(o) == "string"; + default: + if(o != null) { + if(typeof(cl) == "function") { + if(js_Boot.__downcastCheck(o,cl)) { + return true; + } + } else if(typeof(cl) == "object" && js_Boot.__isNativeObj(cl)) { + if(((o) instanceof cl)) { + return true; + } + } + } else { + return false; + } + if(cl == Class ? o.__name__ != null : false) { + return true; + } + if(cl == Enum ? o.__ename__ != null : false) { + return true; + } + return false; + } +}; +js_Boot.__downcastCheck = function(o,cl) { + if(!((o) instanceof cl)) { + if(cl.__isInterface__) { + return js_Boot.__interfLoop(js_Boot.getClass(o),cl); + } else { + return false; + } + } else { + return true; + } +}; +js_Boot.__implements = function(o,iface) { + return js_Boot.__interfLoop(js_Boot.getClass(o),iface); +}; +js_Boot.__cast = function(o,t) { + if(o == null || js_Boot.__instanceof(o,t)) { + return o; + } else { + throw haxe_Exception.thrown("Cannot cast " + Std.string(o) + " to " + Std.string(t)); + } +}; +js_Boot.__toStr = null; +js_Boot.__nativeClassName = function(o) { + var name = js_Boot.__toStr.call(o).slice(8,-1); + if(name == "Object" || name == "Function" || name == "Math" || name == "JSON") { + return null; + } + return name; +}; +js_Boot.__isNativeObj = function(o) { + return js_Boot.__nativeClassName(o) != null; +}; +js_Boot.__resolveNativeClass = function(name) { + return $global[name]; +}; +var js_Lib = function() { }; +$hxClasses["js.Lib"] = js_Lib; +js_Lib.__name__ = "js.Lib"; +js_Lib.__properties__ = {get_undefined:"get_undefined"}; +js_Lib.debug = function() { + debugger; +}; +js_Lib.alert = function(v) { + alert(js_Boot.__string_rec(v,"")); +}; +js_Lib.eval = function(code) { + return eval(code); +}; +js_Lib.get_undefined = function() { + return undefined; +}; +js_Lib.rethrow = function() { +}; +js_Lib.getOriginalException = function() { + return null; +}; +js_Lib.getNextHaxeUID = function() { + return $global.$haxeUID++; +}; +var js_lib_ObjectEntry = {}; +js_lib_ObjectEntry.__properties__ = {get_value:"get_value",get_key:"get_key"}; +js_lib_ObjectEntry.get_key = function(this1) { + return this1[0]; +}; +js_lib_ObjectEntry.get_value = function(this1) { + return this1[1]; +}; +var xrfragment_Query = function(str) { + this.preset = ""; + this.accept = false; + this.exclude = []; + this.include = []; + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +$hxClasses["xrfragment.Query"] = xrfragment_Query; +xrfragment_Query.__name__ = "xrfragment.Query"; +xrfragment_Query.prototype = { + str: null + ,q: null + ,include: null + ,exclude: null + ,accept: null + ,preset: null + ,toObject: function() { + return this.q; + } + ,qualify: function(nodename) { + if(this.q.copy_all) { + this.accept = true; + } + if(this.include.indexOf(nodename) != -1) { + this.accept = true; + } + if(this.exclude.indexOf(nodename) != -1) { + this.accept = false; + } + return this.accept; + } + ,parse: function(str,recurse) { + if(recurse == null) { + recurse = false; + } + var _gthis = this; + var copyAll = recurse ? this.q.copy_all : HxOverrides.substr(str,0,1) == "-" || HxOverrides.substr(str,0,1) == "?" || str == ""; + var isOr = new EReg("^or$",""); + var isProp = new EReg(".*:[><=!]?",""); + var isName = new EReg("[^:/]",""); + var isExclude = new EReg("^-",""); + var isInclude = new EReg("^\\+",""); + var isPreset = new EReg("^\\?",""); + var token = str.split(" "); + var ors = []; + var q = { }; + var composeQuery = function() { + q = { }; + var value = []; + q["object"] = value; + var value = []; + q["-object"] = value; + ors.push(q); + return q; + }; + composeQuery(); + var match = null; + match = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + if(isPreset.match(str) && !recurse) { + _gthis.preset = str; + return; + } + if(isExclude.match(str) || isInclude.match(str)) { + var t = HxOverrides.substr(str,1,null); + match(t,HxOverrides.substr(str,0,1)); + return; + } + if(isProp.match(str)) { + var skip = 0; + var type = "="; + if(str.indexOf("*") != -1) { + type = "*"; + } + if(str.indexOf(">") != -1) { + type = ">"; + } + if(str.indexOf("<") != -1) { + type = "<"; + } + if(str.indexOf("!=") != -1) { + type = "!="; + } + if(str.indexOf(">=") != -1) { + type = ">="; + } + if(str.indexOf("<=") != -1) { + type = "<="; + } + if(type != "=") { + skip += type.length; + } + var property = str.split(":")[0]; + var value; + if(q[prefix + property]) { + value = q[prefix + property]; + } else { + value = { }; + } + value[type] = HxOverrides.substr(str.split(":")[1],skip,null); + q[prefix + property] = value; + return; + } + if(isName.match(str)) { + if(prefix == "-") { + q["-object"].push(str); + while(q["object"].contains(str) == true) q["object"].remove(str); + } else { + q["object"].push(str); + while(q["-object"].contains(str) == true) q["-object"].remove(str); + } + return; + } + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + if(isOr.match(token[i])) { + composeQuery(); + } else { + match(token[i]); + } + } + var _g = 0; + var _g1 = ors.length; + while(_g < _g1) { + var i = _g++; + var or = ors[i]; + if(Reflect.field(or,"object") != null) { + this.include = this.include.concat(Reflect.field(or,"object")); + } + if(Reflect.field(or,"-object") != null) { + this.exclude = this.exclude.concat(Reflect.field(or,"-object")); + } + } + this.q = { or : ors, copy_all : copyAll}; + return this.q; + } + ,test: function(property,value) { + if(this.preset == property) { + this.parse(value,true); + } + var _g = 0; + var _g1 = this.q.or.length; + while(_g < _g1) { + var i = _g++; + var or = this.q.or[i]; + var conds = [0]; + var fails = [0]; + var pass = 0; + var when = (function(fails,conds) { + return function(expr) { + conds[0] += 1; + fails[0] += expr ? 0 : 1; + return expr; + }; + })(fails,conds); + var _g2 = 0; + var _g3 = Reflect.fields(or); + while(_g2 < _g3.length) { + var k = _g3[_g2]; + ++_g2; + var orval = Reflect.field(or,k); + if(k != property) { + continue; + } + if(Reflect.field(orval,"=") != null && when(value == Reflect.field(orval,"="))) { + ++pass; + } + if(Reflect.field(orval,"*") != null && when(value != null)) { + ++pass; + } + if(Reflect.field(orval,">") != null && when(value > Std.parseInt(Reflect.field(orval,">")))) { + ++pass; + } + if(Reflect.field(orval,"<") != null && when(value < Std.parseInt(Reflect.field(orval,"<")))) { + ++pass; + } + if(Reflect.field(orval,">=") != null && when(value >= Std.parseInt(Reflect.field(orval,">=")))) { + ++pass; + } + if(Reflect.field(orval,"<=") != null && when(value >= Std.parseInt(Reflect.field(orval,"<=")))) { + ++pass; + } + if(Reflect.field(orval,"!=") != null && when(value != Std.parseInt(Reflect.field(orval,"!=")))) { + ++pass; + } + } + if(this.accept && conds[0] > 0 && fails[0] > 0) { + this.accept = false; + } + if(conds[0] > 0 && pass > 0 && fails[0] == 0) { + this.accept = true; + } + } + } + ,__class__: xrfragment_Query +}; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +$hxClasses["Math"] = Math; +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.prototype.__class__ = $hxClasses["String"] = String; +String.__name__ = "String"; +$hxClasses["Array"] = Array; +Array.__name__ = "Array"; +Date.prototype.__class__ = $hxClasses["Date"] = Date; +Date.__name__ = "Date"; +var Int = { }; +var Dynamic = { }; +var Float = Number; +var Bool = Boolean; +var Class = { }; +var Enum = { }; +js_Boot.__toStr = ({ }).toString; +EReg.escapeRe = new RegExp("[.*+?^${}()|[\\]\\\\]","g"); +haxe_SysTools.winMetaCharacters = [32,40,41,37,33,94,34,60,62,38,124,10,13,44,59]; +StringTools.winMetaCharacters = haxe_SysTools.winMetaCharacters; +StringTools.MIN_SURROGATE_CODE_POINT = 65536; +var xrfragment_Query_ok = $hx_exports["xrfragment"]["Query"]["ok"] = + // haxe workarounds + + Array.prototype.contains = Array.prototype.includes + + if (typeof Array.prototype.remove !== "function") { + Array.prototype.remove = function (item) { + const oldLength = this.length + let newLength = 0 + + for (let i = 0; i < oldLength; i++) { + const entry = this[i] + if (entry === item) { + let newLength = i++ + + while (i !== this.length) { + const entry = this[i] + if (entry !== item) this[newLength++] = entry + i++ + } + + this.length = newLength + for (let i = newLength; i < oldLength; i++) delete this[i] + return true + } + } + return false + } + } + ; +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; diff --git a/dist/xrfragment.lua b/dist/xrfragment.lua new file mode 100644 index 0000000..20c8627 --- /dev/null +++ b/dist/xrfragment.lua @@ -0,0 +1,10028 @@ +local _hx_hidden = {__id__=true, hx__closures=true, super=true, prototype=true, __fields__=true, __ifields__=true, __class__=true, __properties__=true, __fields__=true, __name__=true} + +_hx_array_mt = { + __newindex = function(t,k,v) + local len = t.length + t.length = k >= len and (k + 1) or len + rawset(t,k,v) + end +} + +function _hx_is_array(o) + return type(o) == "table" + and o.__enum__ == nil + and getmetatable(o) == _hx_array_mt +end + + + +function _hx_tab_array(tab, length) + tab.length = length + return setmetatable(tab, _hx_array_mt) +end + + + +function _hx_print_class(obj, depth) + local first = true + local result = '' + for k,v in pairs(obj) do + if _hx_hidden[k] == nil then + if first then + first = false + else + result = result .. ', ' + end + if _hx_hidden[k] == nil then + result = result .. k .. ':' .. _hx_tostring(v, depth+1) + end + end + end + return '{ ' .. result .. ' }' +end + +function _hx_print_enum(o, depth) + if o.length == 2 then + return o[0] + else + local str = o[0] .. "(" + for i = 2, (o.length-1) do + if i ~= 2 then + str = str .. "," .. _hx_tostring(o[i], depth+1) + else + str = str .. _hx_tostring(o[i], depth+1) + end + end + return str .. ")" + end +end + +function _hx_tostring(obj, depth) + if depth == nil then + depth = 0 + elseif depth > 5 then + return "<...>" + end + + local tstr = _G.type(obj) + if tstr == "string" then return obj + elseif tstr == "nil" then return "null" + elseif tstr == "number" then + if obj == _G.math.POSITIVE_INFINITY then return "Infinity" + elseif obj == _G.math.NEGATIVE_INFINITY then return "-Infinity" + elseif obj == 0 then return "0" + elseif obj ~= obj then return "NaN" + else return _G.tostring(obj) + end + elseif tstr == "boolean" then return _G.tostring(obj) + elseif tstr == "userdata" then + local mt = _G.getmetatable(obj) + if mt ~= nil and mt.__tostring ~= nil then + return _G.tostring(obj) + else + return "" + end + elseif tstr == "function" then return "" + elseif tstr == "thread" then return "" + elseif tstr == "table" then + if obj.__enum__ ~= nil then + return _hx_print_enum(obj, depth) + elseif obj.toString ~= nil and not _hx_is_array(obj) then return obj:toString() + elseif _hx_is_array(obj) then + if obj.length > 5 then + return "[...]" + else + local str = "" + for i=0, (obj.length-1) do + if i == 0 then + str = str .. _hx_tostring(obj[i], depth+1) + else + str = str .. "," .. _hx_tostring(obj[i], depth+1) + end + end + return "[" .. str .. "]" + end + elseif obj.__class__ ~= nil then + return _hx_print_class(obj, depth) + else + local buffer = {} + local ref = obj + if obj.__fields__ ~= nil then + ref = obj.__fields__ + end + for k,v in pairs(ref) do + if _hx_hidden[k] == nil then + _G.table.insert(buffer, _hx_tostring(k, depth+1) .. ' : ' .. _hx_tostring(obj[k], depth+1)) + end + end + + return "{ " .. table.concat(buffer, ", ") .. " }" + end + else + _G.error("Unknown Lua type", 0) + return "" + end +end + +function _hx_error(obj) + if obj.value then + _G.print("runtime error:\n " .. _hx_tostring(obj.value)); + else + _G.print("runtime error:\n " .. tostring(obj)); + end + + if _G.debug and _G.debug.traceback then + _G.print(debug.traceback()); + end +end + + +local function _hx_obj_newindex(t,k,v) + t.__fields__[k] = true + rawset(t,k,v) +end + +local _hx_obj_mt = {__newindex=_hx_obj_newindex, __tostring=_hx_tostring} + +local function _hx_a(...) + local __fields__ = {}; + local ret = {__fields__ = __fields__}; + local max = select('#',...); + local tab = {...}; + local cur = 1; + while cur < max do + local v = tab[cur]; + __fields__[v] = true; + ret[v] = tab[cur+1]; + cur = cur + 2 + end + return setmetatable(ret, _hx_obj_mt) +end + +local function _hx_e() + return setmetatable({__fields__ = {}}, _hx_obj_mt) +end + +local function _hx_o(obj) + return setmetatable(obj, _hx_obj_mt) +end + +local function _hx_new(prototype) + return setmetatable({__fields__ = {}}, {__newindex=_hx_obj_newindex, __index=prototype, __tostring=_hx_tostring}) +end + +function _hx_field_arr(obj) + res = {} + idx = 0 + if obj.__fields__ ~= nil then + obj = obj.__fields__ + end + for k,v in pairs(obj) do + if _hx_hidden[k] == nil then + res[idx] = k + idx = idx + 1 + end + end + return _hx_tab_array(res, idx) +end + +local _hxClasses = {} +local Int = _hx_e(); +local Dynamic = _hx_e(); +local Float = _hx_e(); +local Bool = _hx_e(); +local Class = _hx_e(); +local Enum = _hx_e(); + +local _hx_exports = _hx_exports or {} +_hx_exports["xrfragment"] = _hx_exports["xrfragment"] or _hx_e() +local Array = _hx_e() +local Date = _hx_e() +__lua_lib_lrexlib_Rex = _G.require("rex_pcre") +__lua_lib_luautf8_Utf8 = _G.require("lua-utf8") +local EReg = _hx_e() +___EnumValue_EnumValue_Impl_ = _hx_e() +local IntIterator = _hx_e() +local Lambda = _hx_e() +local Math = _hx_e() +local Reflect = _hx_e() +local String = _hx_e() +local Std = _hx_e() +local StringBuf = _hx_e() +__haxe_SysTools = _hx_e() +local StringTools = _hx_e() +local Sys = _hx_e() +local ValueType = _hx_e() +local Type = _hx_e() +__haxe_StackItem = _hx_e() +__haxe__CallStack_CallStack_Impl_ = _hx_e() +__haxe_IMap = _hx_e() +__haxe__DynamicAccess_DynamicAccess_Impl_ = _hx_e() +__haxe_Exception = _hx_e() +__haxe__Int32_Int32_Impl_ = _hx_e() +__haxe__Int64_Int64_Impl_ = _hx_e() +__haxe__Int64____Int64 = _hx_e() +__haxe_Int64Helper = _hx_e() +__haxe_NativeStackTrace = _hx_e() +__haxe__Rest_Rest_Impl_ = _hx_e() +__haxe_ValueException = _hx_e() +__haxe_ds_BalancedTree = _hx_e() +__haxe_ds_TreeNode = _hx_e() +__haxe_ds_EnumValueMap = _hx_e() +__haxe_ds__HashMap_HashMap_Impl_ = _hx_e() +__haxe_ds__HashMap_HashMapData = _hx_e() +__haxe_ds_IntMap = _hx_e() +__haxe_ds_List = _hx_e() +__haxe_ds__List_ListNode = _hx_e() +__haxe_ds__List_ListIterator = _hx_e() +__haxe_ds__List_ListKeyValueIterator = _hx_e() +__haxe_ds__Map_Map_Impl_ = _hx_e() +__haxe_ds_ObjectMap = _hx_e() +__haxe_ds__ReadOnlyArray_ReadOnlyArray_Impl_ = _hx_e() +__haxe_ds_StringMap = _hx_e() +__haxe_ds_WeakMap = _hx_e() +__haxe_exceptions_PosException = _hx_e() +__haxe_exceptions_NotImplementedException = _hx_e() +__haxe_io_Bytes = _hx_e() +__haxe_io_BytesBuffer = _hx_e() +__haxe_io_Encoding = _hx_e() +__haxe_io_Eof = _hx_e() +__haxe_io_Error = _hx_e() +__haxe_io_FPHelper = _hx_e() +__haxe_io_Input = _hx_e() +__haxe_io_Output = _hx_e() +__haxe_io_Path = _hx_e() +__haxe_iterators_ArrayIterator = _hx_e() +__haxe_iterators_ArrayKeyValueIterator = _hx_e() +__haxe_iterators_DynamicAccessIterator = _hx_e() +__haxe_iterators_DynamicAccessKeyValueIterator = _hx_e() +__haxe_iterators_HashMapKeyValueIterator = _hx_e() +__haxe_iterators_MapKeyValueIterator = _hx_e() +__haxe_iterators_RestIterator = _hx_e() +__haxe_iterators_RestKeyValueIterator = _hx_e() +__haxe_iterators_StringIterator = _hx_e() +__haxe_iterators_StringIteratorUnicode = _hx_e() +__haxe_iterators_StringKeyValueIterator = _hx_e() +__lua_Boot = _hx_e() +__lua_UserData = _hx_e() +__lua_HaxeIterator = _hx_e() +__lua__Io_IoType_Impl_ = _hx_e() +__lua_Lib = _hx_e() +__lua__NativeIterator_NativeIterator_Impl_ = _hx_e() +__lua_PairTools = _hx_e() +__lua_Thread = _hx_e() +__lua_lib_luv_Handle = _G.require("luv") +__lua_lib_luv_Loop = _G.require("luv") +__lua_lib_luv_Misc = _G.require("luv") +__lua_lib_luv_Os = _G.require("luv") +__lua_lib_luv_Stream = _G.require("luv") +__lua_lib_luv_Pipe = _G.require("luv") +__lua_lib_luv_Process = _G.require("luv") +__lua_lib_luv_Request = _G.require("luv") +__lua_lib_luv_Signal = _G.require("luv") +__lua_lib_luv_Thread = _G.require("luv") +__lua_lib_luv_Timer = _G.require("luv") +__lua_lib_luv_fs_FileSystem = _G.require("luv") +__lua_lib_luv_net_Tcp = _G.require("luv") +__sys_FileSystem = _hx_e() +__sys_io_FileInput = _hx_e() +__sys_io_FileOutput = _hx_e() +__sys_io_FileSeek = _hx_e() +__sys_io_Process = _hx_e() +__sys_io__Process_ProcessInput = _hx_e() +__sys_io__Process_ProcessOutput = _hx_e() +__xrfragment_Query = _hx_e() + +local _hx_bind, _hx_bit, _hx_staticToInstance, _hx_funcToField, _hx_maxn, _hx_print, _hx_apply_self, _hx_box_mr, _hx_bit_clamp, _hx_table, _hx_bit_raw +local _hx_pcall_default = {}; +local _hx_pcall_break = {}; + +Array.new = function() + local self = _hx_new(Array.prototype) + Array.super(self) + return self +end +Array.super = function(self) + _hx_tab_array(self, 0); +end +_hxClasses["Array"] = Array +Array.__name__ = "Array" +Array.prototype = _hx_e(); +Array.prototype.length= nil; +Array.prototype.concat = function(self,a) + local _g = _hx_tab_array({}, 0); + local _g1 = 0; + local _g2 = self; + while (_g1 < _g2.length) do + local i = _g2[_g1]; + _g1 = _g1 + 1; + _g:push(i); + end; + local ret = _g; + local _g = 0; + while (_g < a.length) do + local i = a[_g]; + _g = _g + 1; + ret:push(i); + end; + do return ret end +end +Array.prototype.join = function(self,sep) + local tbl = ({}); + local _g_current = 0; + local _g_array = self; + while (_g_current < _g_array.length) do + _g_current = _g_current + 1; + local i = _g_array[_g_current - 1]; + _G.table.insert(tbl, Std.string(i)); + end; + do return _G.table.concat(tbl, sep) end +end +Array.prototype.pop = function(self) + if (self.length == 0) then + do return nil end; + end; + local ret = self[self.length - 1]; + self[self.length - 1] = nil; + self.length = self.length - 1; + do return ret end +end +Array.prototype.push = function(self,x) + self[self.length] = x; + do return self.length end +end +Array.prototype.reverse = function(self) + local tmp; + local i = 0; + while (i < Std.int(self.length / 2)) do + tmp = self[i]; + self[i] = self[(self.length - i) - 1]; + self[(self.length - i) - 1] = tmp; + i = i + 1; + end; +end +Array.prototype.shift = function(self) + if (self.length == 0) then + do return nil end; + end; + local ret = self[0]; + if (self.length == 1) then + self[0] = nil; + else + if (self.length > 1) then + self[0] = self[1]; + _G.table.remove(self, 1); + end; + end; + local tmp = self; + tmp.length = tmp.length - 1; + do return ret end +end +Array.prototype.slice = function(self,pos,_end) + if ((_end == nil) or (_end > self.length)) then + _end = self.length; + else + if (_end < 0) then + _end = _G.math.fmod((self.length - (_G.math.fmod(-_end, self.length))), self.length); + end; + end; + if (pos < 0) then + pos = _G.math.fmod((self.length - (_G.math.fmod(-pos, self.length))), self.length); + end; + if ((pos > _end) or (pos > self.length)) then + do return _hx_tab_array({}, 0) end; + end; + local ret = _hx_tab_array({}, 0); + local _g = pos; + local _g1 = _end; + while (_g < _g1) do + _g = _g + 1; + local i = _g - 1; + ret:push(self[i]); + end; + do return ret end +end +Array.prototype.sort = function(self,f) + local i = 0; + local l = self.length; + while (i < l) do + local swap = false; + local j = 0; + local max = (l - i) - 1; + while (j < max) do + if (f(self[j], self[j + 1]) > 0) then + local tmp = self[j + 1]; + self[j + 1] = self[j]; + self[j] = tmp; + swap = true; + end; + j = j + 1; + end; + if (not swap) then + break; + end; + i = i + 1; + end; +end +Array.prototype.splice = function(self,pos,len) + if ((len < 0) or (pos > self.length)) then + do return _hx_tab_array({}, 0) end; + else + if (pos < 0) then + pos = self.length - (_G.math.fmod(-pos, self.length)); + end; + end; + len = Math.min(len, self.length - pos); + local ret = _hx_tab_array({}, 0); + local _g = pos; + local _g1 = pos + len; + while (_g < _g1) do + _g = _g + 1; + local i = _g - 1; + ret:push(self[i]); + self[i] = self[i + len]; + end; + local _g = pos + len; + local _g1 = self.length; + while (_g < _g1) do + _g = _g + 1; + local i = _g - 1; + self[i] = self[i + len]; + end; + local tmp = self; + tmp.length = tmp.length - len; + do return ret end +end +Array.prototype.toString = function(self) + local tbl = ({}); + _G.table.insert(tbl, "["); + _G.table.insert(tbl, self:join(",")); + _G.table.insert(tbl, "]"); + do return _G.table.concat(tbl, "") end +end +Array.prototype.unshift = function(self,x) + local len = self.length; + local _g = 0; + local _g1 = len; + while (_g < _g1) do + _g = _g + 1; + local i = _g - 1; + self[len - i] = self[(len - i) - 1]; + end; + self[0] = x; +end +Array.prototype.insert = function(self,pos,x) + if (pos > self.length) then + pos = self.length; + end; + if (pos < 0) then + pos = self.length + pos; + if (pos < 0) then + pos = 0; + end; + end; + local cur_len = self.length; + while (cur_len > pos) do + self[cur_len] = self[cur_len - 1]; + cur_len = cur_len - 1; + end; + self[pos] = x; +end +Array.prototype.remove = function(self,x) + local _g = 0; + local _g1 = self.length; + while (_g < _g1) do + _g = _g + 1; + local i = _g - 1; + if (self[i] == x) then + local _g = i; + local _g1 = self.length - 1; + while (_g < _g1) do + _g = _g + 1; + local j = _g - 1; + self[j] = self[j + 1]; + end; + self[self.length - 1] = nil; + self.length = self.length - 1; + do return true end; + end; + end; + do return false end +end +Array.prototype.contains = function(self,x) + local _g = 0; + local _g1 = self.length; + while (_g < _g1) do + _g = _g + 1; + local i = _g - 1; + if (self[i] == x) then + do return true end; + end; + end; + do return false end +end +Array.prototype.indexOf = function(self,x,fromIndex) + local _end = self.length; + if (fromIndex == nil) then + fromIndex = 0; + else + if (fromIndex < 0) then + fromIndex = self.length + fromIndex; + if (fromIndex < 0) then + fromIndex = 0; + end; + end; + end; + local _g = fromIndex; + local _g1 = _end; + while (_g < _g1) do + _g = _g + 1; + local i = _g - 1; + if (x == self[i]) then + do return i end; + end; + end; + do return -1 end +end +Array.prototype.lastIndexOf = function(self,x,fromIndex) + if ((fromIndex == nil) or (fromIndex >= self.length)) then + fromIndex = self.length - 1; + else + if (fromIndex < 0) then + fromIndex = self.length + fromIndex; + if (fromIndex < 0) then + do return -1 end; + end; + end; + end; + local i = fromIndex; + while (i >= 0) do + if (self[i] == x) then + do return i end; + else + i = i - 1; + end; + end; + do return -1 end +end +Array.prototype.copy = function(self) + local _g = _hx_tab_array({}, 0); + local _g1 = 0; + local _g2 = self; + while (_g1 < _g2.length) do + local i = _g2[_g1]; + _g1 = _g1 + 1; + _g:push(i); + end; + do return _g end +end +Array.prototype.map = function(self,f) + local _g = _hx_tab_array({}, 0); + local _g1 = 0; + local _g2 = self; + while (_g1 < _g2.length) do + local i = _g2[_g1]; + _g1 = _g1 + 1; + _g:push(f(i)); + end; + do return _g end +end +Array.prototype.filter = function(self,f) + local _g = _hx_tab_array({}, 0); + local _g1 = 0; + local _g2 = self; + while (_g1 < _g2.length) do + local i = _g2[_g1]; + _g1 = _g1 + 1; + if (f(i)) then + _g:push(i); + end; + end; + do return _g end +end +Array.prototype.iterator = function(self) + do return __haxe_iterators_ArrayIterator.new(self) end +end +Array.prototype.keyValueIterator = function(self) + do return __haxe_iterators_ArrayKeyValueIterator.new(self) end +end +Array.prototype.resize = function(self,len) + if (self.length < len) then + self.length = len; + else + if (self.length > len) then + local _g = len; + local _g1 = self.length; + while (_g < _g1) do + _g = _g + 1; + local i = _g - 1; + self[i] = nil; + end; + self.length = len; + end; + end; +end + +Array.prototype.__class__ = Array + +Date.new = function(year,month,day,hour,min,sec) + local self = _hx_new(Date.prototype) + Date.super(self,year,month,day,hour,min,sec) + return self +end +Date.super = function(self,year,month,day,hour,min,sec) + self.t = _G.os.time(_hx_o({__fields__={year=true,month=true,day=true,hour=true,min=true,sec=true},year=year,month=month + 1,day=day,hour=hour,min=min,sec=sec})); + self.d = _G.os.date("*t", self.t); + self.dUTC = _G.os.date("!*t", self.t); +end +_hxClasses["Date"] = Date +Date.__name__ = "Date" +Date.now = function() + local t = _G.os.time() * 1000; + local d = _hx_e(); + _G.setmetatable(d, _hx_o({__fields__={__index=true},__index=Date.prototype})); + d.t = t / 1000; + d.d = _G.os.date("*t", Std.int(d.t)); + d.dUTC = _G.os.date("!*t", Std.int(d.t)); + do return d end; +end +Date.fromTime = function(t) + local d = _hx_e(); + _G.setmetatable(d, _hx_o({__fields__={__index=true},__index=Date.prototype})); + d.t = t / 1000; + d.d = _G.os.date("*t", Std.int(d.t)); + d.dUTC = _G.os.date("!*t", Std.int(d.t)); + do return d end; +end +Date.fromString = function(s) + do return __lua_Boot.strDate(s) end; +end +Date.prototype = _hx_e(); +Date.prototype.d= nil; +Date.prototype.dUTC= nil; +Date.prototype.t= nil; +Date.prototype.getTime = function(self) + do return self.t * 1000 end +end +Date.prototype.getHours = function(self) + do return self.d.hour end +end +Date.prototype.getMinutes = function(self) + do return self.d.min end +end +Date.prototype.getSeconds = function(self) + do return self.d.sec end +end +Date.prototype.getFullYear = function(self) + do return self.d.year end +end +Date.prototype.getMonth = function(self) + do return self.d.month - 1 end +end +Date.prototype.getDate = function(self) + do return self.d.day end +end +Date.prototype.getDay = function(self) + do return self.d.wday - 1 end +end +Date.prototype.getUTCHours = function(self) + do return self.dUTC.hour end +end +Date.prototype.getUTCMinutes = function(self) + do return self.dUTC.min end +end +Date.prototype.getUTCSeconds = function(self) + do return self.dUTC.sec end +end +Date.prototype.getUTCFullYear = function(self) + do return self.dUTC.year end +end +Date.prototype.getUTCMonth = function(self) + do return self.dUTC.month - 1 end +end +Date.prototype.getUTCDate = function(self) + do return self.dUTC.day end +end +Date.prototype.getUTCDay = function(self) + do return self.dUTC.wday - 1 end +end +Date.prototype.getTimezoneOffset = function(self) + local tUTC = _G.os.time(self.dUTC); + do return Std.int((tUTC - self.t) / 60) end +end +Date.prototype.toString = function(self) + do return __lua_Boot.dateStr(self) end +end + +Date.prototype.__class__ = Date + +EReg.new = function(r,opt) + local self = _hx_new(EReg.prototype) + EReg.super(self,r,opt) + return self +end +EReg.super = function(self,r,opt) + local ropt = 0; + local _g = 0; + local _g1 = __lua_lib_luautf8_Utf8.len(opt); + while (_g < _g1) do + _g = _g + 1; + local i = _g - 1; + local _g = __lua_lib_luautf8_Utf8.sub(opt, i + 1, i + 1); + if (_g) == "g" then + self.global = true; + elseif (_g) == "i" then + ropt = _hx_bit.bor(ropt,EReg.FLAGS.CASELESS); + elseif (_g) == "m" then + ropt = _hx_bit.bor(ropt,EReg.FLAGS.MULTILINE); + elseif (_g) == "s" then + ropt = _hx_bit.bor(ropt,EReg.FLAGS.DOTALL);else end; + end; + ropt = _hx_bit.bor(ropt,EReg.FLAGS.UTF8); + ropt = _hx_bit.bor(ropt,EReg.FLAGS.UCP); + if (self.global == nil) then + self.global = false; + end; + self.r = __lua_lib_lrexlib_Rex.new(r, ropt); +end +_hxClasses["EReg"] = EReg +EReg.__name__ = "EReg" +EReg.escape = function(s) + do return EReg.escapeRegExpRe:map(s, function(r) + do return Std.string("\\") .. Std.string(r:matched(0)) end; + end) end; +end +EReg.prototype = _hx_e(); +EReg.prototype.r= nil; +EReg.prototype.global= nil; +EReg.prototype.s= nil; +EReg.prototype.m= nil; +EReg.prototype.match = function(self,s) + if (s == nil) then + do return false end; + else + self.m = _hx_table.pack(self.r:exec(s, 1)); + self.s = s; + do return self.m[1] ~= nil end; + end; +end +EReg.prototype.matchFromByte = function(self,s,offset) + if (s == nil) then + do return false end; + end; + self.m = _hx_table.pack(self.r:exec(s, offset)); + self.s = s; + do return self.m[1] ~= nil end +end +EReg.prototype.matched = function(self,n) + if ((self.m[1] == nil) or (n < 0)) then + _G.error(__haxe_Exception.thrown("EReg::matched"),0); + else + if (n == 0) then + local k = _G.string.sub(self.s, self.m[1], self.m[2]); + do return k end; + else + if (__lua_Boot.__instanceof(self.m[3], _G.table)) then + local mn = 2 * (n - 1); + if (__lua_Boot.__instanceof(self.m[3][mn + 1], Bool)) then + do return nil end; + end; + do return _G.string.sub(self.s, self.m[3][mn + 1], self.m[3][mn + 2]) end; + else + _G.error(__haxe_Exception.thrown("EReg:matched"),0); + end; + end; + end; +end +EReg.prototype.matchedLeft = function(self) + if (self.m[1] == nil) then + _G.error(__haxe_Exception.thrown("No string matched"),0); + end; + do return _G.string.sub(self.s, 1, self.m[1] - 1) end +end +EReg.prototype.matchedRight = function(self) + if (self.m[1] == nil) then + _G.error(__haxe_Exception.thrown("No string matched"),0); + end; + do return _G.string.sub(self.s, self.m[2] + 1) end +end +EReg.prototype.matchedPos = function(self) + local left = self:matchedLeft(); + local matched = self:matched(0); + if (self.m[1] == nil) then + _G.error(__haxe_Exception.thrown("No string matched"),0); + end; + do return _hx_o({__fields__={pos=true,len=true},pos=__lua_lib_luautf8_Utf8.len(left),len=__lua_lib_luautf8_Utf8.len(matched)}) end +end +EReg.prototype.matchSub = function(self,s,pos,len) + if (len == nil) then + len = -1; + end; + local pos1 = 0; + local len = (function() + local _hx_1 + if (len < 0) then + _hx_1 = __lua_lib_luautf8_Utf8.len(s); else + _hx_1 = pos + len; end + return _hx_1 + end )(); + if ((len == nil) or (len > (pos1 + __lua_lib_luautf8_Utf8.len(s)))) then + len = __lua_lib_luautf8_Utf8.len(s); + else + if (len < 0) then + len = __lua_lib_luautf8_Utf8.len(s) + len; + end; + end; + if (pos1 < 0) then + pos1 = __lua_lib_luautf8_Utf8.len(s) + pos1; + end; + if (pos1 < 0) then + pos1 = 0; + end; + local ss = __lua_lib_luautf8_Utf8.sub(s, pos1 + 1, pos1 + len); + if (self.global) then + self.m = _hx_table.pack(self.r:exec(ss, pos + 1)); + local b = self.m[1] ~= nil; + if (b) then + self.s = s; + end; + do return b end; + else + self.m = _hx_table.pack(self.r:exec(ss, pos + 1)); + local b = self.m[1] ~= nil; + if (b) then + self.s = s; + end; + do return b end; + end; +end +EReg.prototype.split = function(self,s) + if (self.global) then + do return __lua_Lib.fillArray(_hx_wrap_if_string_field(__lua_lib_lrexlib_Rex,'split')(s, self.r)) end; + else + local d = "#__delim__#"; + do return __lua_Lib.fillArray(_hx_wrap_if_string_field(__lua_lib_lrexlib_Rex,'split')(self:replace(s, d), d)) end; + end; +end +EReg.prototype.replace = function(self,s,by) + local idx = 1; + local ret = _hx_tab_array({}, 0); + while (idx ~= nil) do + local newidx = 0; + if (__lua_lib_luautf8_Utf8.len("$$") > 0) then + newidx = __lua_lib_luautf8_Utf8.find(by, "$$", idx, true); + else + if (idx >= __lua_lib_luautf8_Utf8.len(by)) then + newidx = nil; + else + newidx = idx + 1; + end; + end; + if (newidx ~= nil) then + local match = __lua_lib_luautf8_Utf8.sub(by, idx, newidx - 1); + ret:push(match); + idx = newidx + __lua_lib_luautf8_Utf8.len("$$"); + else + ret:push(__lua_lib_luautf8_Utf8.sub(by, idx, __lua_lib_luautf8_Utf8.len(by))); + idx = nil; + end; + end; + local chunks = ret; + local _g = _hx_tab_array({}, 0); + local _g1 = 0; + while (_g1 < chunks.length) do + local chunk = chunks[_g1]; + _g1 = _g1 + 1; + _g:push(__lua_lib_lrexlib_Rex.gsub(chunk, "\\$(\\d)", "%%%1", 1)); + end; + chunks = _g; + by = chunks:join("$"); + do return __lua_lib_lrexlib_Rex.gsub(s, self.r, by, (function() + local _hx_1 + if (self.global) then + _hx_1 = nil; else + _hx_1 = 1; end + return _hx_1 + end )()) end +end +EReg.prototype.map = function(self,s,f) + local bytesOffset = 1; + local buf_b = ({}); + local buf_length = 0; + while (true) do + if (bytesOffset > _G.string.len(s)) then + break; + else + local tmp; + if (s == nil) then + tmp = false; + else + self.m = _hx_table.pack(self.r:exec(s, bytesOffset)); + self.s = s; + tmp = self.m[1] ~= nil; + end; + if (not tmp) then + local str = Std.string(_G.string.sub(s, bytesOffset)); + _G.table.insert(buf_b, str); + buf_length = buf_length + __lua_lib_luautf8_Utf8.len(str); + break; + end; + end; + local pos = self.m[1]; + local length = self.m[2] - self.m[1]; + local str = Std.string(_G.string.sub(s, bytesOffset, pos - 1)); + _G.table.insert(buf_b, str); + buf_length = buf_length + __lua_lib_luautf8_Utf8.len(str); + local str = Std.string(f(self)); + _G.table.insert(buf_b, str); + buf_length = buf_length + __lua_lib_luautf8_Utf8.len(str); + if (length < 0) then + local charBytes = _G.string.len(__lua_lib_luautf8_Utf8.sub(_G.string.sub(s, pos), 1, 1)); + local str = Std.string(_G.string.sub(s, pos, (pos + charBytes) - 1)); + _G.table.insert(buf_b, str); + buf_length = buf_length + __lua_lib_luautf8_Utf8.len(str); + bytesOffset = pos + charBytes; + else + bytesOffset = self.m[2] + 1; + end; + if (not self.global) then + break; + end; + end; + if ((not self.global and (bytesOffset > 1)) and ((bytesOffset - 1) < _G.string.len(s))) then + local str = Std.string(_G.string.sub(s, bytesOffset)); + _G.table.insert(buf_b, str); + buf_length = buf_length + __lua_lib_luautf8_Utf8.len(str); + end; + do return _G.table.concat(buf_b) end +end +EReg.prototype.map_old = function(self,s,f) + local offset = 0; + local buf_b = ({}); + local buf_length = 0; + while (true) do + if (offset >= __lua_lib_luautf8_Utf8.len(s)) then + break; + else + if (not self:matchSub(s, offset)) then + local pos = offset; + local len = nil; + if ((len == nil) or (len > (pos + __lua_lib_luautf8_Utf8.len(s)))) then + len = __lua_lib_luautf8_Utf8.len(s); + else + if (len < 0) then + len = __lua_lib_luautf8_Utf8.len(s) + len; + end; + end; + if (pos < 0) then + pos = __lua_lib_luautf8_Utf8.len(s) + pos; + end; + if (pos < 0) then + pos = 0; + end; + local str = Std.string(__lua_lib_luautf8_Utf8.sub(s, pos + 1, pos + len)); + _G.table.insert(buf_b, str); + buf_length = buf_length + __lua_lib_luautf8_Utf8.len(str); + break; + end; + end; + local p = self:matchedPos(); + local pos = offset; + local len = p.pos - offset; + if ((len == nil) or (len > (pos + __lua_lib_luautf8_Utf8.len(s)))) then + len = __lua_lib_luautf8_Utf8.len(s); + else + if (len < 0) then + len = __lua_lib_luautf8_Utf8.len(s) + len; + end; + end; + if (pos < 0) then + pos = __lua_lib_luautf8_Utf8.len(s) + pos; + end; + if (pos < 0) then + pos = 0; + end; + local str = Std.string(__lua_lib_luautf8_Utf8.sub(s, pos + 1, pos + len)); + _G.table.insert(buf_b, str); + buf_length = buf_length + __lua_lib_luautf8_Utf8.len(str); + local str = Std.string(f(self)); + _G.table.insert(buf_b, str); + buf_length = buf_length + __lua_lib_luautf8_Utf8.len(str); + if (p.len == 0) then + local pos = p.pos; + local len = 1; + if ((len == nil) or (len > (pos + __lua_lib_luautf8_Utf8.len(s)))) then + len = __lua_lib_luautf8_Utf8.len(s); + else + if (len < 0) then + len = __lua_lib_luautf8_Utf8.len(s) + len; + end; + end; + if (pos < 0) then + pos = __lua_lib_luautf8_Utf8.len(s) + pos; + end; + if (pos < 0) then + pos = 0; + end; + local str = Std.string(__lua_lib_luautf8_Utf8.sub(s, pos + 1, pos + len)); + _G.table.insert(buf_b, str); + buf_length = buf_length + __lua_lib_luautf8_Utf8.len(str); + offset = p.pos + 1; + else + offset = p.pos + p.len; + end; + if (not self.global) then + break; + end; + end; + if ((not self.global and (offset > 0)) and (offset < __lua_lib_luautf8_Utf8.len(s))) then + local pos = offset; + local len = nil; + if ((len == nil) or (len > (pos + __lua_lib_luautf8_Utf8.len(s)))) then + len = __lua_lib_luautf8_Utf8.len(s); + else + if (len < 0) then + len = __lua_lib_luautf8_Utf8.len(s) + len; + end; + end; + if (pos < 0) then + pos = __lua_lib_luautf8_Utf8.len(s) + pos; + end; + if (pos < 0) then + pos = 0; + end; + local str = Std.string(__lua_lib_luautf8_Utf8.sub(s, pos + 1, pos + len)); + _G.table.insert(buf_b, str); + buf_length = buf_length + __lua_lib_luautf8_Utf8.len(str); + end; + do return _G.table.concat(buf_b) end +end + +EReg.prototype.__class__ = EReg + +___EnumValue_EnumValue_Impl_.new = {} +_hxClasses["_EnumValue.EnumValue_Impl_"] = ___EnumValue_EnumValue_Impl_ +___EnumValue_EnumValue_Impl_.__name__ = "_EnumValue.EnumValue_Impl_" +___EnumValue_EnumValue_Impl_.match = function(this1,pattern) + do return false end; +end + +IntIterator.new = function(min,max) + local self = _hx_new(IntIterator.prototype) + IntIterator.super(self,min,max) + return self +end +IntIterator.super = function(self,min,max) + self.min = min; + self.max = max; +end +_hxClasses["IntIterator"] = IntIterator +IntIterator.__name__ = "IntIterator" +IntIterator.prototype = _hx_e(); +IntIterator.prototype.min= nil; +IntIterator.prototype.max= nil; +IntIterator.prototype.hasNext = function(self) + do return self.min < self.max end +end +IntIterator.prototype.next = function(self) + do return (function() + local _hx_obj = self; + local _hx_fld = 'min'; + local _ = _hx_obj[_hx_fld]; + _hx_obj[_hx_fld] = _hx_obj[_hx_fld] + 1; + return _; + end)() end +end + +IntIterator.prototype.__class__ = IntIterator + +Lambda.new = {} +_hxClasses["Lambda"] = Lambda +Lambda.__name__ = "Lambda" +Lambda.array = function(it) + local a = Array.new(); + local i = it:iterator(); + while (i:hasNext()) do + local i = i:next(); + a:push(i); + end; + do return a end; +end +Lambda.list = function(it) + local l = __haxe_ds_List.new(); + local i = it:iterator(); + while (i:hasNext()) do + local i = i:next(); + l:add(i); + end; + do return l end; +end +Lambda.map = function(it,f) + local _g = _hx_tab_array({}, 0); + local x = it:iterator(); + while (x:hasNext()) do + local x = x:next(); + _g:push(f(x)); + end; + do return _g end; +end +Lambda.mapi = function(it,f) + local i = 0; + local _g = _hx_tab_array({}, 0); + local x = it:iterator(); + while (x:hasNext()) do + local x = x:next(); + i = i + 1; + _g:push(f(i - 1, x)); + end; + do return _g end; +end +Lambda.flatten = function(it) + local _g = _hx_tab_array({}, 0); + local e = it:iterator(); + while (e:hasNext()) do + local e = e:next(); + local x = e:iterator(); + while (x:hasNext()) do + local x = x:next(); + _g:push(x); + end; + end; + do return _g end; +end +Lambda.flatMap = function(it,f) + local _g = _hx_tab_array({}, 0); + local x = it:iterator(); + while (x:hasNext()) do + local x = x:next(); + _g:push(f(x)); + end; + local _g1 = _hx_tab_array({}, 0); + local e = _g:iterator(); + while (e:hasNext()) do + local e = e:next(); + local x = e:iterator(); + while (x:hasNext()) do + local x = x:next(); + _g1:push(x); + end; + end; + do return _g1 end; +end +Lambda.has = function(it,elt) + local x = it:iterator(); + while (x:hasNext()) do + local x = x:next(); + if (x == elt) then + do return true end; + end; + end; + do return false end; +end +Lambda.exists = function(it,f) + local x = it:iterator(); + while (x:hasNext()) do + local x = x:next(); + if (f(x)) then + do return true end; + end; + end; + do return false end; +end +Lambda.foreach = function(it,f) + local x = it:iterator(); + while (x:hasNext()) do + local x = x:next(); + if (not f(x)) then + do return false end; + end; + end; + do return true end; +end +Lambda.iter = function(it,f) + local x = it:iterator(); + while (x:hasNext()) do + local x = x:next(); + f(x); + end; +end +Lambda.filter = function(it,f) + local _g = _hx_tab_array({}, 0); + local x = it:iterator(); + while (x:hasNext()) do + local x = x:next(); + if (f(x)) then + _g:push(x); + end; + end; + do return _g end; +end +Lambda.fold = function(it,f,first) + local x = it:iterator(); + while (x:hasNext()) do + local x = x:next(); + first = f(x, first); + end; + do return first end; +end +Lambda.foldi = function(it,f,first) + local i = 0; + local x = it:iterator(); + while (x:hasNext()) do + local x = x:next(); + first = f(x, first, i); + i = i + 1; + end; + do return first end; +end +Lambda.count = function(it,pred) + local n = 0; + if (pred == nil) then + local _ = it:iterator(); + while (_:hasNext()) do + local _ = _:next(); + n = n + 1; + end; + else + local x = it:iterator(); + while (x:hasNext()) do + local x = x:next(); + if (pred(x)) then + n = n + 1; + end; + end; + end; + do return n end; +end +Lambda.empty = function(it) + do return not it:iterator():hasNext() end; +end +Lambda.indexOf = function(it,v) + local i = 0; + local v2 = it:iterator(); + while (v2:hasNext()) do + local v2 = v2:next(); + if (v == v2) then + do return i end; + end; + i = i + 1; + end; + do return -1 end; +end +Lambda.find = function(it,f) + local v = it:iterator(); + while (v:hasNext()) do + local v = v:next(); + if (f(v)) then + do return v end; + end; + end; + do return nil end; +end +Lambda.findIndex = function(it,f) + local i = 0; + local v = it:iterator(); + while (v:hasNext()) do + local v = v:next(); + if (f(v)) then + do return i end; + end; + i = i + 1; + end; + do return -1 end; +end +Lambda.concat = function(a,b) + local l = Array.new(); + local x = a:iterator(); + while (x:hasNext()) do + local x = x:next(); + l:push(x); + end; + local x = b:iterator(); + while (x:hasNext()) do + local x = x:next(); + l:push(x); + end; + do return l end; +end + +Math.new = {} +_hxClasses["Math"] = Math +Math.__name__ = "Math" +Math.__properties__ = {get_NaN="get_NaN",get_POSITIVE_INFINITY="get_POSITIVE_INFINITY",get_NEGATIVE_INFINITY="get_NEGATIVE_INFINITY",get_PI="get_PI"} +Math.PI = nil +Math.get_PI = function() + do return _G.math.pi end; +end +Math.NEGATIVE_INFINITY = nil +Math.get_NEGATIVE_INFINITY = function() + do return -_G.math.huge end; +end +Math.POSITIVE_INFINITY = nil +Math.get_POSITIVE_INFINITY = function() + do return _G.math.huge end; +end +Math.NaN = nil +Math.get_NaN = function() + do return (0/0) end; +end +Math.isNaN = function(f) + do return f ~= f end; +end +Math.isFinite = function(f) + if (f > -_G.math.huge) then + do return f < _G.math.huge end; + else + do return false end; + end; +end +Math.abs = function(v) + do return _G.math.abs(v) end; +end +Math.acos = function(v) + do return _G.math.acos(v) end; +end +Math.asin = function(v) + do return _G.math.asin(v) end; +end +Math.atan = function(v) + do return _G.math.atan(v) end; +end +Math.ceil = function(v) + do return _G.math.ceil(v) end; +end +Math.cos = function(v) + do return _G.math.cos(v) end; +end +Math.exp = function(v) + do return _G.math.exp(v) end; +end +Math.sin = function(v) + do return _G.math.sin(v) end; +end +Math.sqrt = function(v) + do return _G.math.sqrt(v) end; +end +Math.tan = function(v) + do return _G.math.tan(v) end; +end +Math.floor = function(v) + do return _G.math.floor(v) end; +end +Math.log = function(v) + do return _G.math.log(v) end; +end +Math.random = function() + do return _G.math.random() end; +end +Math.atan2 = function(y,x) + do return _G.math.atan2(y, x) end; +end +Math.max = function(a,b) + if (Math.isNaN(a) or Math.isNaN(b)) then + do return (0/0) end; + else + do return _G.math.max(a, b) end; + end; +end +Math.min = function(a,b) + if (Math.isNaN(a) or Math.isNaN(b)) then + do return (0/0) end; + else + do return _G.math.min(a, b) end; + end; +end +Math.pow = function(v,exp) + do return _G.math.pow(v, exp) end; +end +Math.round = function(v) + do return _G.math.floor(v + 0.5) end; +end +Math.ffloor = function(v) + do return _G.math.floor(v) end; +end +Math.fceil = function(v) + do return _G.math.ceil(v) end; +end +Math.fround = function(v) + do return _G.math.floor(v + 0.5) end; +end + +Reflect.new = {} +_hxClasses["Reflect"] = Reflect +Reflect.__name__ = "Reflect" +Reflect.hasField = function(o,field) + if ((_G.type(o) == "string") and ((String.prototype[field] ~= nil) or (field == "length"))) then + do return true end; + else + if (o.__fields__ ~= nil) then + do return o.__fields__[field] ~= nil end; + else + do return o[field] ~= nil end; + end; + end; +end +Reflect.field = function(o,field) + if (_G.type(o) == "string") then + if (field == "length") then + do return _hx_wrap_if_string_field(o,'length') end; + else + do return String.prototype[field] end; + end; + else + local _hx_status, _hx_result = pcall(function() + + do return o[field] end; + return _hx_pcall_default + end) + if not _hx_status and _hx_result == "_hx_pcall_break" then + elseif not _hx_status then + local _g = _hx_result; + do return nil end; + elseif _hx_result ~= _hx_pcall_default then + return _hx_result + end; + end; +end +Reflect.setField = function(o,field,value) + o[field] = value; +end +Reflect.getProperty = function(o,field) + if (o == nil) then + do return nil end; + else + if ((o.__properties__ ~= nil) and (Reflect.field(o, Std.string("get_") .. Std.string(field)) ~= nil)) then + do return Reflect.callMethod(o,Reflect.field(o, Std.string("get_") .. Std.string(field)),_hx_tab_array({}, 0)) end; + else + do return Reflect.field(o, field) end; + end; + end; +end +Reflect.setProperty = function(o,field,value) + if ((o.__properties__ ~= nil) and o.__properties__[Std.string("set_") .. Std.string(field)]) then + local tmp = o.__properties__[Std.string("set_") .. Std.string(field)]; + Reflect.callMethod(o,Reflect.field(o, tmp),_hx_tab_array({[0]=value}, 1)); + else + o[field] = value; + end; +end +Reflect.callMethod = function(o,func,args) + if ((args == nil) or (args.length == 0)) then + do return func(o) end; + else + local self_arg = false; + if ((o ~= nil) and (o.__name__ == nil)) then + self_arg = true; + end; + if (self_arg) then + do return func(o, _hx_table.unpack(args, 0, args.length - 1)) end; + else + do return func(_hx_table.unpack(args, 0, args.length - 1)) end; + end; + end; +end +Reflect.fields = function(o) + if (_G.type(o) == "string") then + do return Reflect.fields(String.prototype) end; + else + do return _hx_field_arr(o) end; + end; +end +Reflect.isFunction = function(f) + if (_G.type(f) == "function") then + do return not ((function() + local _hx_1 + if (_G.type(f) ~= "table") then + _hx_1 = false; else + _hx_1 = f.__name__; end + return _hx_1 + end )() or (function() + local _hx_2 + if (_G.type(f) ~= "table") then + _hx_2 = false; else + _hx_2 = f.__ename__; end + return _hx_2 + end )()) end; + else + do return false end; + end; +end +Reflect.compare = function(a,b) + if (a == b) then + do return 0 end; + else + if (a == nil) then + do return -1 end; + else + if (b == nil) then + do return 1 end; + else + if (a > b) then + do return 1 end; + else + do return -1 end; + end; + end; + end; + end; +end +Reflect.compareMethods = function(f1,f2) + do return f1 == f2 end; +end +Reflect.isObject = function(v) + if (v == nil) then + do return false end; + end; + local t = type(v); + if (not ((t == "string") or ((t == "table") and (v.__enum__ == nil)))) then + if (t == "function") then + do return ((function() + local _hx_1 + if (_G.type(v) ~= "table") then + _hx_1 = false; else + _hx_1 = v.__name__; end + return _hx_1 + end )() or (function() + local _hx_2 + if (_G.type(v) ~= "table") then + _hx_2 = false; else + _hx_2 = v.__ename__; end + return _hx_2 + end )()) ~= nil end; + else + do return false end; + end; + else + do return true end; + end; +end +Reflect.isEnumValue = function(v) + if ((v ~= nil) and __lua_Boot.__instanceof(v, _G.table)) then + do return v.__enum__ ~= nil end; + else + do return false end; + end; +end +Reflect.deleteField = function(o,field) + if (not ((function() + local _hx_1 + if ((_G.type(o) == "string") and ((String.prototype[field] ~= nil) or (field == "length"))) then + _hx_1 = true; elseif (o.__fields__ ~= nil) then + _hx_1 = o.__fields__[field] ~= nil; else + _hx_1 = o[field] ~= nil; end + return _hx_1 + end )())) then + do return false end; + end; + o[field] = nil; + o.__fields__[field] = nil; + do return true end; +end +Reflect.copy = function(o) + if (o == nil) then + do return nil end; + end; + local o2 = _hx_e(); + local _g = 0; + local _g1 = Reflect.fields(o); + while (_g < _g1.length) do + local f = _g1[_g]; + _g = _g + 1; + o2[f] = Reflect.field(o, f); + end; + do return o2 end; +end +Reflect.makeVarArgs = function(f) + do return function(...) + local a = {...} + local b = {} + local l = 0 + for k, v in pairs(a) do + b[k-1] = v + l = math.max(k,l) + end + return f(_hx_tab_array(b, l)) + end end; +end + +String.new = function(string) + local self = _hx_new(String.prototype) + String.super(self,string) + self = string + return self +end +String.super = function(self,string) +end +_hxClasses["String"] = String +String.__name__ = "String" +String.__oldindex = nil +String.__index = function(s,k) + if (k == "length") then + do return __lua_lib_luautf8_Utf8.len(s) end; + else + local o = String.prototype; + local field = k; + if ((function() + local _hx_1 + if ((_G.type(o) == "string") and ((String.prototype[field] ~= nil) or (field == "length"))) then + _hx_1 = true; elseif (o.__fields__ ~= nil) then + _hx_1 = o.__fields__[field] ~= nil; else + _hx_1 = o[field] ~= nil; end + return _hx_1 + end )()) then + do return String.prototype[k] end; + else + if (String.__oldindex ~= nil) then + if (_G.type(String.__oldindex) == "function") then + do return String.__oldindex(s, k) end; + else + if (_G.type(String.__oldindex) == "table") then + do return String.__oldindex[k] end; + end; + end; + do return nil end; + else + do return nil end; + end; + end; + end; +end +String.indexOfEmpty = function(s,startIndex) + local length = __lua_lib_luautf8_Utf8.len(s); + if (startIndex < 0) then + startIndex = length + startIndex; + if (startIndex < 0) then + startIndex = 0; + end; + end; + if (startIndex > length) then + do return length end; + else + do return startIndex end; + end; +end +String.fromCharCode = function(code) + do return __lua_lib_luautf8_Utf8.char(code) end; +end +String.prototype = _hx_e(); +String.prototype.length= nil; +String.prototype.toUpperCase = function(self) + do return __lua_lib_luautf8_Utf8.upper(self) end +end +String.prototype.toLowerCase = function(self) + do return __lua_lib_luautf8_Utf8.lower(self) end +end +String.prototype.indexOf = function(self,str,startIndex) + if (startIndex == nil) then + startIndex = 1; + else + startIndex = startIndex + 1; + end; + if (str == "") then + do return String.indexOfEmpty(self, startIndex - 1) end; + end; + local r = __lua_lib_luautf8_Utf8.find(self, str, startIndex, true); + if ((r ~= nil) and (r > 0)) then + do return r - 1 end; + else + do return -1 end; + end; +end +String.prototype.lastIndexOf = function(self,str,startIndex) + local ret = -1; + if (startIndex == nil) then + startIndex = __lua_lib_luautf8_Utf8.len(self); + end; + while (true) do + local startIndex1 = ret + 1; + if (startIndex1 == nil) then + startIndex1 = 1; + else + startIndex1 = startIndex1 + 1; + end; + local p; + if (str == "") then + p = String.indexOfEmpty(self, startIndex1 - 1); + else + local r = __lua_lib_luautf8_Utf8.find(self, str, startIndex1, true); + p = (function() + local _hx_1 + if ((r ~= nil) and (r > 0)) then + _hx_1 = r - 1; else + _hx_1 = -1; end + return _hx_1 + end )(); + end; + if (((p == -1) or (p > startIndex)) or (p == ret)) then + break; + end; + ret = p; + end; + do return ret end +end +String.prototype.split = function(self,delimiter) + local idx = 1; + local ret = _hx_tab_array({}, 0); + while (idx ~= nil) do + local newidx = 0; + if (__lua_lib_luautf8_Utf8.len(delimiter) > 0) then + newidx = __lua_lib_luautf8_Utf8.find(self, delimiter, idx, true); + else + if (idx >= __lua_lib_luautf8_Utf8.len(self)) then + newidx = nil; + else + newidx = idx + 1; + end; + end; + if (newidx ~= nil) then + local match = __lua_lib_luautf8_Utf8.sub(self, idx, newidx - 1); + ret:push(match); + idx = newidx + __lua_lib_luautf8_Utf8.len(delimiter); + else + ret:push(__lua_lib_luautf8_Utf8.sub(self, idx, __lua_lib_luautf8_Utf8.len(self))); + idx = nil; + end; + end; + do return ret end +end +String.prototype.toString = function(self) + do return self end +end +String.prototype.substring = function(self,startIndex,endIndex) + if (endIndex == nil) then + endIndex = __lua_lib_luautf8_Utf8.len(self); + end; + if (endIndex < 0) then + endIndex = 0; + end; + if (startIndex < 0) then + startIndex = 0; + end; + if (endIndex < startIndex) then + do return __lua_lib_luautf8_Utf8.sub(self, endIndex + 1, startIndex) end; + else + do return __lua_lib_luautf8_Utf8.sub(self, startIndex + 1, endIndex) end; + end; +end +String.prototype.charAt = function(self,index) + do return __lua_lib_luautf8_Utf8.sub(self, index + 1, index + 1) end +end +String.prototype.charCodeAt = function(self,index) + do return __lua_lib_luautf8_Utf8.byte(self, index + 1) end +end +String.prototype.substr = function(self,pos,len) + if ((len == nil) or (len > (pos + __lua_lib_luautf8_Utf8.len(self)))) then + len = __lua_lib_luautf8_Utf8.len(self); + else + if (len < 0) then + len = __lua_lib_luautf8_Utf8.len(self) + len; + end; + end; + if (pos < 0) then + pos = __lua_lib_luautf8_Utf8.len(self) + pos; + end; + if (pos < 0) then + pos = 0; + end; + do return __lua_lib_luautf8_Utf8.sub(self, pos + 1, pos + len) end +end + +String.prototype.__class__ = String + +Std.new = {} +_hxClasses["Std"] = Std +Std.__name__ = "Std" +Std.is = function(v,t) + do return __lua_Boot.__instanceof(v, t) end; +end +Std.isOfType = function(v,t) + do return __lua_Boot.__instanceof(v, t) end; +end +Std.downcast = function(value,c) + if (__lua_Boot.__instanceof(value, c)) then + do return value end; + else + do return nil end; + end; +end +Std.instance = function(value,c) + if (__lua_Boot.__instanceof(value, c)) then + do return value end; + else + do return nil end; + end; +end +Std.string = function(s) + do return _hx_tostring(s, 0) end; +end +Std.int = function(x) + if (not Math.isFinite(x) or Math.isNaN(x)) then + do return 0 end; + else + do return _hx_bit_clamp(x) end; + end; +end +Std.parseInt = function(x) + if (x == nil) then + do return nil end; + end; + local hexMatch = _G.string.match(x, "^[ \t\r\n]*([%-+]*0[xX][%da-fA-F]*)"); + if (hexMatch ~= nil) then + local sign; + local _g = __lua_lib_luautf8_Utf8.byte(hexMatch, 1); + if (_g) == 43 then + sign = 1; + elseif (_g) == 45 then + sign = -1;else + sign = 0; end; + local pos = (function() + local _hx_1 + if (sign == 0) then + _hx_1 = 2; else + _hx_1 = 3; end + return _hx_1 + end )(); + local len = nil; + if ((len == nil) or (len > (pos + __lua_lib_luautf8_Utf8.len(hexMatch)))) then + len = __lua_lib_luautf8_Utf8.len(hexMatch); + else + if (len < 0) then + len = __lua_lib_luautf8_Utf8.len(hexMatch) + len; + end; + end; + if (pos < 0) then + pos = __lua_lib_luautf8_Utf8.len(hexMatch) + pos; + end; + if (pos < 0) then + pos = 0; + end; + do return (function() + local _hx_2 + if (sign == -1) then + _hx_2 = -1; else + _hx_2 = 1; end + return _hx_2 + end )() * _G.tonumber(__lua_lib_luautf8_Utf8.sub(hexMatch, pos + 1, pos + len), 16) end; + else + local intMatch = _G.string.match(x, "^ *[%-+]?%d*"); + if (intMatch ~= nil) then + do return _G.tonumber(intMatch) end; + else + do return nil end; + end; + end; +end +Std.parseFloat = function(x) + if ((x == nil) or (x == "")) then + do return (0/0) end; + end; + local digitMatch = _G.string.match(x, "^ *[%.%-+]?[0-9]%d*"); + if (digitMatch == nil) then + do return (0/0) end; + end; + local pos = __lua_lib_luautf8_Utf8.len(digitMatch); + local len = nil; + if ((len == nil) or (len > (pos + __lua_lib_luautf8_Utf8.len(x)))) then + len = __lua_lib_luautf8_Utf8.len(x); + else + if (len < 0) then + len = __lua_lib_luautf8_Utf8.len(x) + len; + end; + end; + if (pos < 0) then + pos = __lua_lib_luautf8_Utf8.len(x) + pos; + end; + if (pos < 0) then + pos = 0; + end; + x = __lua_lib_luautf8_Utf8.sub(x, pos + 1, pos + len); + local decimalMatch = _G.string.match(x, "^%.%d*"); + if (decimalMatch == nil) then + decimalMatch = ""; + end; + local pos = __lua_lib_luautf8_Utf8.len(decimalMatch); + local len = nil; + if ((len == nil) or (len > (pos + __lua_lib_luautf8_Utf8.len(x)))) then + len = __lua_lib_luautf8_Utf8.len(x); + else + if (len < 0) then + len = __lua_lib_luautf8_Utf8.len(x) + len; + end; + end; + if (pos < 0) then + pos = __lua_lib_luautf8_Utf8.len(x) + pos; + end; + if (pos < 0) then + pos = 0; + end; + x = __lua_lib_luautf8_Utf8.sub(x, pos + 1, pos + len); + local eMatch = _G.string.match(x, "^[eE][+%-]?%d+"); + if (eMatch == nil) then + eMatch = ""; + end; + local result = _G.tonumber(Std.string(Std.string(digitMatch) .. Std.string(decimalMatch)) .. Std.string(eMatch)); + if (result ~= nil) then + do return result end; + else + do return (0/0) end; + end; +end +Std.random = function(x) + if (x <= 0) then + do return 0 end; + else + do return _G.math.floor(_G.math.random() * x) end; + end; +end + +StringBuf.new = function() + local self = _hx_new(StringBuf.prototype) + StringBuf.super(self) + return self +end +StringBuf.super = function(self) + self.b = ({}); + self.length = 0; +end +_hxClasses["StringBuf"] = StringBuf +StringBuf.__name__ = "StringBuf" +StringBuf.prototype = _hx_e(); +StringBuf.prototype.b= nil; +StringBuf.prototype.length= nil; +StringBuf.prototype.get_length = function(self) + do return self.length end +end +StringBuf.prototype.add = function(self,x) + local str = Std.string(x); + _G.table.insert(self.b, str); + local tmp = self; + tmp.length = tmp.length + __lua_lib_luautf8_Utf8.len(str); +end +StringBuf.prototype.addChar = function(self,c) + _G.table.insert(self.b, __lua_lib_luautf8_Utf8.char(c)); + local tmp = self; + tmp.length = tmp.length + 1; +end +StringBuf.prototype.addSub = function(self,s,pos,len) + local part; + if (len == nil) then + local pos = pos; + local len = nil; + if ((len == nil) or (len > (pos + __lua_lib_luautf8_Utf8.len(s)))) then + len = __lua_lib_luautf8_Utf8.len(s); + else + if (len < 0) then + len = __lua_lib_luautf8_Utf8.len(s) + len; + end; + end; + if (pos < 0) then + pos = __lua_lib_luautf8_Utf8.len(s) + pos; + end; + if (pos < 0) then + pos = 0; + end; + part = __lua_lib_luautf8_Utf8.sub(s, pos + 1, pos + len); + else + local pos = pos; + local len = len; + if ((len == nil) or (len > (pos + __lua_lib_luautf8_Utf8.len(s)))) then + len = __lua_lib_luautf8_Utf8.len(s); + else + if (len < 0) then + len = __lua_lib_luautf8_Utf8.len(s) + len; + end; + end; + if (pos < 0) then + pos = __lua_lib_luautf8_Utf8.len(s) + pos; + end; + if (pos < 0) then + pos = 0; + end; + part = __lua_lib_luautf8_Utf8.sub(s, pos + 1, pos + len); + end; + _G.table.insert(self.b, part); + local tmp = self; + tmp.length = tmp.length + __lua_lib_luautf8_Utf8.len(part); +end +StringBuf.prototype.toString = function(self) + do return _G.table.concat(self.b) end +end + +StringBuf.prototype.__class__ = StringBuf + +StringBuf.prototype.__properties__ = {get_length="get_length"} + +__haxe_SysTools.new = {} +_hxClasses["haxe.SysTools"] = __haxe_SysTools +__haxe_SysTools.__name__ = "haxe.SysTools" +__haxe_SysTools.quoteUnixArg = function(argument) + if (argument == "") then + do return "''" end; + end; + if (not EReg.new("[^a-zA-Z0-9_@%+=:,./-]", ""):match(argument)) then + do return argument end; + end; + do return Std.string(Std.string("'") .. Std.string(StringTools.replace(argument, "'", "'\"'\"'"))) .. Std.string("'") end; +end +__haxe_SysTools.quoteWinArg = function(argument,escapeMetaCharacters) + if (not EReg.new("^[^ \t\\\\\"]+$", ""):match(argument)) then + local result_b = ({}); + local result_length = 0; + local needquote; + local startIndex = nil; + if (startIndex == nil) then + startIndex = 1; + else + startIndex = startIndex + 1; + end; + local r = __lua_lib_luautf8_Utf8.find(argument, " ", startIndex, true); + if ((function() + local _hx_1 + if ((r ~= nil) and (r > 0)) then + _hx_1 = r - 1; else + _hx_1 = -1; end + return _hx_1 + end )() == -1) then + local startIndex = nil; + if (startIndex == nil) then + startIndex = 1; + else + startIndex = startIndex + 1; + end; + local r = __lua_lib_luautf8_Utf8.find(argument, "\t", startIndex, true); + needquote = (function() + local _hx_2 + if ((r ~= nil) and (r > 0)) then + _hx_2 = r - 1; else + _hx_2 = -1; end + return _hx_2 + end )() ~= -1; + else + needquote = true; + end; + local needquote = needquote or (argument == ""); + if (needquote) then + local str = "\""; + _G.table.insert(result_b, str); + result_length = result_length + __lua_lib_luautf8_Utf8.len(str); + end; + local bs_buf = StringBuf.new(); + local _g = 0; + local _g1 = __lua_lib_luautf8_Utf8.len(argument); + while (_g < _g1) do + _g = _g + 1; + local i = _g - 1; + local _g = __lua_lib_luautf8_Utf8.byte(argument, i + 1); + local _g1 = _g; + if (_g1) == 34 then + local bs = _G.table.concat(bs_buf.b); + local str = Std.string(bs); + _G.table.insert(result_b, str); + result_length = result_length + __lua_lib_luautf8_Utf8.len(str); + local str = Std.string(bs); + _G.table.insert(result_b, str); + result_length = result_length + __lua_lib_luautf8_Utf8.len(str); + bs_buf = StringBuf.new(); + local str = "\\\""; + _G.table.insert(result_b, str); + result_length = result_length + __lua_lib_luautf8_Utf8.len(str); + elseif (_g1) == 92 then + local str = "\\"; + _G.table.insert(bs_buf.b, str); + local bs_buf = bs_buf; + bs_buf.length = bs_buf.length + __lua_lib_luautf8_Utf8.len(str);else + local c = _g; + if (bs_buf.length > 0) then + local str = Std.string(_G.table.concat(bs_buf.b)); + _G.table.insert(result_b, str); + result_length = result_length + __lua_lib_luautf8_Utf8.len(str); + bs_buf = StringBuf.new(); + end; + _G.table.insert(result_b, __lua_lib_luautf8_Utf8.char(c)); + result_length = result_length + 1; end; + end; + local str = Std.string(_G.table.concat(bs_buf.b)); + _G.table.insert(result_b, str); + result_length = result_length + __lua_lib_luautf8_Utf8.len(str); + if (needquote) then + local str = Std.string(_G.table.concat(bs_buf.b)); + _G.table.insert(result_b, str); + result_length = result_length + __lua_lib_luautf8_Utf8.len(str); + local str = "\""; + _G.table.insert(result_b, str); + result_length = result_length + __lua_lib_luautf8_Utf8.len(str); + end; + argument = _G.table.concat(result_b); + end; + if (escapeMetaCharacters) then + local result_b = ({}); + local result_length = 0; + local _g = 0; + local _g1 = __lua_lib_luautf8_Utf8.len(argument); + while (_g < _g1) do + _g = _g + 1; + local i = _g - 1; + local c = __lua_lib_luautf8_Utf8.byte(argument, i + 1); + if (__haxe_SysTools.winMetaCharacters:indexOf(c) >= 0) then + _G.table.insert(result_b, __lua_lib_luautf8_Utf8.char(94)); + result_length = result_length + 1; + end; + _G.table.insert(result_b, __lua_lib_luautf8_Utf8.char(c)); + result_length = result_length + 1; + end; + do return _G.table.concat(result_b) end; + else + do return argument end; + end; +end + +StringTools.new = {} +_hxClasses["StringTools"] = StringTools +StringTools.__name__ = "StringTools" +StringTools.urlEncode = function(s) + s = _G.string.gsub(s, "\n", "\r\n"); + s = _G.string.gsub(s, "([^%w %-%_%.%~])", function(c) + do return _G.string.format("%%%02X", Std.string(_G.string.byte(c)) .. Std.string("")) end; + end); + s = _G.string.gsub(s, " ", "+"); + do return s end; +end +StringTools.urlDecode = function(s) + s = _G.string.gsub(s, "+", " "); + s = _G.string.gsub(s, "%%(%x%x)", function(h) + do return _G.string.char(_G.tonumber(h, 16)) end; + end); + s = _G.string.gsub(s, "\r\n", "\n"); + do return s end; +end +StringTools.htmlEscape = function(s,quotes) + local buf_b = ({}); + local buf_length = 0; + local _g_offset = 0; + local _g_s = s; + while (_g_offset < __lua_lib_luautf8_Utf8.len(_g_s)) do + _g_offset = _g_offset + 1; + local code = __lua_lib_luautf8_Utf8.byte(_g_s, (_g_offset - 1) + 1); + local code1 = code; + if (code1) == 34 then + if (quotes) then + local str = """; + _G.table.insert(buf_b, str); + buf_length = buf_length + __lua_lib_luautf8_Utf8.len(str); + else + _G.table.insert(buf_b, __lua_lib_luautf8_Utf8.char(code)); + buf_length = buf_length + 1; + end; + elseif (code1) == 38 then + local str = "&"; + _G.table.insert(buf_b, str); + buf_length = buf_length + __lua_lib_luautf8_Utf8.len(str); + elseif (code1) == 39 then + if (quotes) then + local str = "'"; + _G.table.insert(buf_b, str); + buf_length = buf_length + __lua_lib_luautf8_Utf8.len(str); + else + _G.table.insert(buf_b, __lua_lib_luautf8_Utf8.char(code)); + buf_length = buf_length + 1; + end; + elseif (code1) == 60 then + local str = "<"; + _G.table.insert(buf_b, str); + buf_length = buf_length + __lua_lib_luautf8_Utf8.len(str); + elseif (code1) == 62 then + local str = ">"; + _G.table.insert(buf_b, str); + buf_length = buf_length + __lua_lib_luautf8_Utf8.len(str);else + _G.table.insert(buf_b, __lua_lib_luautf8_Utf8.char(code)); + buf_length = buf_length + 1; end; + end; + do return _G.table.concat(buf_b) end; +end +StringTools.htmlUnescape = function(s) + local idx = 1; + local ret = _hx_tab_array({}, 0); + while (idx ~= nil) do + local newidx = 0; + if (__lua_lib_luautf8_Utf8.len(">") > 0) then + newidx = __lua_lib_luautf8_Utf8.find(s, ">", idx, true); + else + if (idx >= __lua_lib_luautf8_Utf8.len(s)) then + newidx = nil; + else + newidx = idx + 1; + end; + end; + if (newidx ~= nil) then + local match = __lua_lib_luautf8_Utf8.sub(s, idx, newidx - 1); + ret:push(match); + idx = newidx + __lua_lib_luautf8_Utf8.len(">"); + else + ret:push(__lua_lib_luautf8_Utf8.sub(s, idx, __lua_lib_luautf8_Utf8.len(s))); + idx = nil; + end; + end; + local _this = ret:join(">"); + local idx = 1; + local ret = _hx_tab_array({}, 0); + while (idx ~= nil) do + local newidx = 0; + if (__lua_lib_luautf8_Utf8.len("<") > 0) then + newidx = __lua_lib_luautf8_Utf8.find(_this, "<", idx, true); + else + if (idx >= __lua_lib_luautf8_Utf8.len(_this)) then + newidx = nil; + else + newidx = idx + 1; + end; + end; + if (newidx ~= nil) then + local match = __lua_lib_luautf8_Utf8.sub(_this, idx, newidx - 1); + ret:push(match); + idx = newidx + __lua_lib_luautf8_Utf8.len("<"); + else + ret:push(__lua_lib_luautf8_Utf8.sub(_this, idx, __lua_lib_luautf8_Utf8.len(_this))); + idx = nil; + end; + end; + local _this = ret:join("<"); + local idx = 1; + local ret = _hx_tab_array({}, 0); + while (idx ~= nil) do + local newidx = 0; + if (__lua_lib_luautf8_Utf8.len(""") > 0) then + newidx = __lua_lib_luautf8_Utf8.find(_this, """, idx, true); + else + if (idx >= __lua_lib_luautf8_Utf8.len(_this)) then + newidx = nil; + else + newidx = idx + 1; + end; + end; + if (newidx ~= nil) then + local match = __lua_lib_luautf8_Utf8.sub(_this, idx, newidx - 1); + ret:push(match); + idx = newidx + __lua_lib_luautf8_Utf8.len("""); + else + ret:push(__lua_lib_luautf8_Utf8.sub(_this, idx, __lua_lib_luautf8_Utf8.len(_this))); + idx = nil; + end; + end; + local _this = ret:join("\""); + local idx = 1; + local ret = _hx_tab_array({}, 0); + while (idx ~= nil) do + local newidx = 0; + if (__lua_lib_luautf8_Utf8.len("'") > 0) then + newidx = __lua_lib_luautf8_Utf8.find(_this, "'", idx, true); + else + if (idx >= __lua_lib_luautf8_Utf8.len(_this)) then + newidx = nil; + else + newidx = idx + 1; + end; + end; + if (newidx ~= nil) then + local match = __lua_lib_luautf8_Utf8.sub(_this, idx, newidx - 1); + ret:push(match); + idx = newidx + __lua_lib_luautf8_Utf8.len("'"); + else + ret:push(__lua_lib_luautf8_Utf8.sub(_this, idx, __lua_lib_luautf8_Utf8.len(_this))); + idx = nil; + end; + end; + local _this = ret:join("'"); + local idx = 1; + local ret = _hx_tab_array({}, 0); + while (idx ~= nil) do + local newidx = 0; + if (__lua_lib_luautf8_Utf8.len("&") > 0) then + newidx = __lua_lib_luautf8_Utf8.find(_this, "&", idx, true); + else + if (idx >= __lua_lib_luautf8_Utf8.len(_this)) then + newidx = nil; + else + newidx = idx + 1; + end; + end; + if (newidx ~= nil) then + local match = __lua_lib_luautf8_Utf8.sub(_this, idx, newidx - 1); + ret:push(match); + idx = newidx + __lua_lib_luautf8_Utf8.len("&"); + else + ret:push(__lua_lib_luautf8_Utf8.sub(_this, idx, __lua_lib_luautf8_Utf8.len(_this))); + idx = nil; + end; + end; + do return ret:join("&") end; +end +StringTools.contains = function(s,value) + local startIndex = nil; + if (startIndex == nil) then + startIndex = 1; + else + startIndex = startIndex + 1; + end; + local tmp; + if (value == "") then + tmp = String.indexOfEmpty(s, startIndex - 1); + else + local r = __lua_lib_luautf8_Utf8.find(s, value, startIndex, true); + tmp = (function() + local _hx_1 + if ((r ~= nil) and (r > 0)) then + _hx_1 = r - 1; else + _hx_1 = -1; end + return _hx_1 + end )(); + end; + do return tmp ~= -1 end; +end +StringTools.startsWith = function(s,start) + if (__lua_lib_luautf8_Utf8.len(s) >= __lua_lib_luautf8_Utf8.len(start)) then + local startIndex = 0; + local ret = -1; + if (startIndex == nil) then + startIndex = __lua_lib_luautf8_Utf8.len(s); + end; + while (true) do + local startIndex1 = ret + 1; + if (startIndex1 == nil) then + startIndex1 = 1; + else + startIndex1 = startIndex1 + 1; + end; + local p; + if (start == "") then + p = String.indexOfEmpty(s, startIndex1 - 1); + else + local r = __lua_lib_luautf8_Utf8.find(s, start, startIndex1, true); + p = (function() + local _hx_1 + if ((r ~= nil) and (r > 0)) then + _hx_1 = r - 1; else + _hx_1 = -1; end + return _hx_1 + end )(); + end; + if (((p == -1) or (p > startIndex)) or (p == ret)) then + break; + end; + ret = p; + end; + do return ret == 0 end; + else + do return false end; + end; +end +StringTools.endsWith = function(s,_end) + local elen = __lua_lib_luautf8_Utf8.len(_end); + local slen = __lua_lib_luautf8_Utf8.len(s); + if (slen >= elen) then + local startIndex = slen - elen; + if (startIndex == nil) then + startIndex = 1; + else + startIndex = startIndex + 1; + end; + local tmp; + if (_end == "") then + tmp = String.indexOfEmpty(s, startIndex - 1); + else + local r = __lua_lib_luautf8_Utf8.find(s, _end, startIndex, true); + tmp = (function() + local _hx_1 + if ((r ~= nil) and (r > 0)) then + _hx_1 = r - 1; else + _hx_1 = -1; end + return _hx_1 + end )(); + end; + do return tmp == (slen - elen) end; + else + do return false end; + end; +end +StringTools.isSpace = function(s,pos) + if (((__lua_lib_luautf8_Utf8.len(s) == 0) or (pos < 0)) or (pos >= __lua_lib_luautf8_Utf8.len(s))) then + do return false end; + end; + local c = __lua_lib_luautf8_Utf8.byte(s, pos + 1); + if (not ((c > 8) and (c < 14))) then + do return c == 32 end; + else + do return true end; + end; +end +StringTools.ltrim = function(s) + local l = __lua_lib_luautf8_Utf8.len(s); + local r = 0; + while ((r < l) and StringTools.isSpace(s, r)) do + r = r + 1; + end; + if (r > 0) then + local pos = r; + local len = l - r; + if ((len == nil) or (len > (pos + __lua_lib_luautf8_Utf8.len(s)))) then + len = __lua_lib_luautf8_Utf8.len(s); + else + if (len < 0) then + len = __lua_lib_luautf8_Utf8.len(s) + len; + end; + end; + if (pos < 0) then + pos = __lua_lib_luautf8_Utf8.len(s) + pos; + end; + if (pos < 0) then + pos = 0; + end; + do return __lua_lib_luautf8_Utf8.sub(s, pos + 1, pos + len) end; + else + do return s end; + end; +end +StringTools.rtrim = function(s) + local l = __lua_lib_luautf8_Utf8.len(s); + local r = 0; + while ((r < l) and StringTools.isSpace(s, (l - r) - 1)) do + r = r + 1; + end; + if (r > 0) then + local pos = 0; + local len = l - r; + if ((len == nil) or (len > (pos + __lua_lib_luautf8_Utf8.len(s)))) then + len = __lua_lib_luautf8_Utf8.len(s); + else + if (len < 0) then + len = __lua_lib_luautf8_Utf8.len(s) + len; + end; + end; + if (pos < 0) then + pos = __lua_lib_luautf8_Utf8.len(s) + pos; + end; + if (pos < 0) then + pos = 0; + end; + do return __lua_lib_luautf8_Utf8.sub(s, pos + 1, pos + len) end; + else + do return s end; + end; +end +StringTools.trim = function(s) + do return StringTools.ltrim(StringTools.rtrim(s)) end; +end +StringTools.lpad = function(s,c,l) + if (__lua_lib_luautf8_Utf8.len(c) <= 0) then + do return s end; + end; + local buf_b = ({}); + local buf_length = 0; + l = l - __lua_lib_luautf8_Utf8.len(s); + while (buf_length < l) do + local str = Std.string(c); + _G.table.insert(buf_b, str); + buf_length = buf_length + __lua_lib_luautf8_Utf8.len(str); + end; + local str = Std.string(s); + _G.table.insert(buf_b, str); + buf_length = buf_length + __lua_lib_luautf8_Utf8.len(str); + do return _G.table.concat(buf_b) end; +end +StringTools.rpad = function(s,c,l) + if (__lua_lib_luautf8_Utf8.len(c) <= 0) then + do return s end; + end; + local buf_b = ({}); + local buf_length = 0; + local str = Std.string(s); + _G.table.insert(buf_b, str); + buf_length = buf_length + __lua_lib_luautf8_Utf8.len(str); + while (buf_length < l) do + local str = Std.string(c); + _G.table.insert(buf_b, str); + buf_length = buf_length + __lua_lib_luautf8_Utf8.len(str); + end; + do return _G.table.concat(buf_b) end; +end +StringTools.replace = function(s,sub,by) + local idx = 1; + local ret = _hx_tab_array({}, 0); + while (idx ~= nil) do + local newidx = 0; + if (__lua_lib_luautf8_Utf8.len(sub) > 0) then + newidx = __lua_lib_luautf8_Utf8.find(s, sub, idx, true); + else + if (idx >= __lua_lib_luautf8_Utf8.len(s)) then + newidx = nil; + else + newidx = idx + 1; + end; + end; + if (newidx ~= nil) then + local match = __lua_lib_luautf8_Utf8.sub(s, idx, newidx - 1); + ret:push(match); + idx = newidx + __lua_lib_luautf8_Utf8.len(sub); + else + ret:push(__lua_lib_luautf8_Utf8.sub(s, idx, __lua_lib_luautf8_Utf8.len(s))); + idx = nil; + end; + end; + do return ret:join(by) end; +end +StringTools.hex = function(n,digits) + local s = ""; + local hexChars = "0123456789ABCDEF"; + while (true) do + local index = _hx_bit.band(n,15); + s = Std.string(__lua_lib_luautf8_Utf8.sub(hexChars, index + 1, index + 1)) .. Std.string(s); + n = _hx_bit.rshift(n,4); + if (not (n > 0)) then + break; + end; + end; + if (digits ~= nil) then + while (__lua_lib_luautf8_Utf8.len(s) < digits) do + s = Std.string("0") .. Std.string(s); + end; + end; + do return s end; +end +StringTools.fastCodeAt = function(s,index) + do return __lua_lib_luautf8_Utf8.byte(s, index + 1) end; +end +StringTools.unsafeCodeAt = function(s,index) + do return __lua_lib_luautf8_Utf8.byte(s, index + 1) end; +end +StringTools.iterator = function(s) + do return __haxe_iterators_StringIterator.new(s) end; +end +StringTools.keyValueIterator = function(s) + do return __haxe_iterators_StringKeyValueIterator.new(s) end; +end +StringTools.isEof = function(c) + do return c == nil end; +end +StringTools.quoteUnixArg = function(argument) + if (argument == "") then + do return "''" end; + else + if (not EReg.new("[^a-zA-Z0-9_@%+=:,./-]", ""):match(argument)) then + do return argument end; + else + do return Std.string(Std.string("'") .. Std.string(StringTools.replace(argument, "'", "'\"'\"'"))) .. Std.string("'") end; + end; + end; +end +StringTools.quoteWinArg = function(argument,escapeMetaCharacters) + local argument = argument; + if (not EReg.new("^[^ \t\\\\\"]+$", ""):match(argument)) then + local result_b = ({}); + local result_length = 0; + local needquote; + local startIndex = nil; + if (startIndex == nil) then + startIndex = 1; + else + startIndex = startIndex + 1; + end; + local r = __lua_lib_luautf8_Utf8.find(argument, " ", startIndex, true); + if ((function() + local _hx_1 + if ((r ~= nil) and (r > 0)) then + _hx_1 = r - 1; else + _hx_1 = -1; end + return _hx_1 + end )() == -1) then + local startIndex = nil; + if (startIndex == nil) then + startIndex = 1; + else + startIndex = startIndex + 1; + end; + local r = __lua_lib_luautf8_Utf8.find(argument, "\t", startIndex, true); + needquote = (function() + local _hx_2 + if ((r ~= nil) and (r > 0)) then + _hx_2 = r - 1; else + _hx_2 = -1; end + return _hx_2 + end )() ~= -1; + else + needquote = true; + end; + local needquote = needquote or (argument == ""); + if (needquote) then + local str = "\""; + _G.table.insert(result_b, str); + result_length = result_length + __lua_lib_luautf8_Utf8.len(str); + end; + local bs_buf = StringBuf.new(); + local _g = 0; + local _g1 = __lua_lib_luautf8_Utf8.len(argument); + while (_g < _g1) do + _g = _g + 1; + local i = _g - 1; + local _g = __lua_lib_luautf8_Utf8.byte(argument, i + 1); + local _g1 = _g; + if (_g1) == 34 then + local bs = _G.table.concat(bs_buf.b); + local str = Std.string(bs); + _G.table.insert(result_b, str); + result_length = result_length + __lua_lib_luautf8_Utf8.len(str); + local str = Std.string(bs); + _G.table.insert(result_b, str); + result_length = result_length + __lua_lib_luautf8_Utf8.len(str); + bs_buf = StringBuf.new(); + local str = "\\\""; + _G.table.insert(result_b, str); + result_length = result_length + __lua_lib_luautf8_Utf8.len(str); + elseif (_g1) == 92 then + local str = "\\"; + _G.table.insert(bs_buf.b, str); + local bs_buf = bs_buf; + bs_buf.length = bs_buf.length + __lua_lib_luautf8_Utf8.len(str);else + local c = _g; + if (bs_buf.length > 0) then + local str = Std.string(_G.table.concat(bs_buf.b)); + _G.table.insert(result_b, str); + result_length = result_length + __lua_lib_luautf8_Utf8.len(str); + bs_buf = StringBuf.new(); + end; + _G.table.insert(result_b, __lua_lib_luautf8_Utf8.char(c)); + result_length = result_length + 1; end; + end; + local str = Std.string(_G.table.concat(bs_buf.b)); + _G.table.insert(result_b, str); + result_length = result_length + __lua_lib_luautf8_Utf8.len(str); + if (needquote) then + local str = Std.string(_G.table.concat(bs_buf.b)); + _G.table.insert(result_b, str); + result_length = result_length + __lua_lib_luautf8_Utf8.len(str); + local str = "\""; + _G.table.insert(result_b, str); + result_length = result_length + __lua_lib_luautf8_Utf8.len(str); + end; + argument = _G.table.concat(result_b); + end; + if (escapeMetaCharacters) then + local result_b = ({}); + local result_length = 0; + local _g = 0; + local _g1 = __lua_lib_luautf8_Utf8.len(argument); + while (_g < _g1) do + _g = _g + 1; + local i = _g - 1; + local c = __lua_lib_luautf8_Utf8.byte(argument, i + 1); + if (__haxe_SysTools.winMetaCharacters:indexOf(c) >= 0) then + _G.table.insert(result_b, __lua_lib_luautf8_Utf8.char(94)); + result_length = result_length + 1; + end; + _G.table.insert(result_b, __lua_lib_luautf8_Utf8.char(c)); + result_length = result_length + 1; + end; + do return _G.table.concat(result_b) end; + else + do return argument end; + end; +end + +Sys.new = {} +_hxClasses["Sys"] = Sys +Sys.__name__ = "Sys" +Sys._system_name = nil +Sys.print = function(v) + _G.io.write(Std.string(v)); + _G.io.flush(); +end +Sys.println = function(v) + _G.print(Std.string(v)); +end +Sys.args = function() + local targs = __lua_PairTools.copy(_G.arg); + local length = nil; + local tab = __lua_PairTools.copy(targs); + local length = length; + local args; + if (length == nil) then + length = _hx_table.maxn(tab); + if (length > 0) then + local head = tab[1]; + _G.table.remove(tab, 1); + tab[0] = head; + args = _hx_tab_array(tab, length); + else + args = _hx_tab_array({}, 0); + end; + else + args = _hx_tab_array(tab, length); + end; + do return args end; +end +Sys.command = function(cmd,args) + local p = __sys_io_Process.new(cmd, args); + local code = p:exitCode(); + p:close(); + do return code end; +end +Sys.cpuTime = function() + do return _G.os.clock() end; +end +Sys.exit = function(code) + _G.os.exit(code); +end +Sys.getChar = function(echo) + do return __lua_lib_luautf8_Utf8.byte(_G.io.read(), 1) end; +end +Sys.getSystemName = function() + do return __lua_Boot.systemName() end; +end +Sys.systemName = function() + if (Sys._system_name == nil) then + Sys._system_name = Sys.getSystemName(); + end; + do return Sys._system_name end; +end +Sys.environment = function() + local env = __lua_lib_luv_Os.os_environ(); + local obj = __haxe_ds_ObjectMap.new(); + __lua_PairTools.pairsFold(env, function(k,v,m) + obj.h[k] = v; + obj.k[k] = true; + do return obj end; + end, obj); + do return obj end; +end +Sys.executablePath = function() + do return __lua_lib_luv_Misc.exepath() end; +end +Sys.programPath = function() + do return __haxe_io_Path.join(_hx_tab_array({[0]=__lua_lib_luv_Misc.cwd(), _G.arg[0]}, 2)) end; +end +Sys.getCwd = function() + do return __lua_lib_luv_Misc.cwd() end; +end +Sys.setCwd = function(s) + __lua_lib_luv_Misc.chdir(s); +end +Sys.getEnv = function(s) + do return __lua_lib_luv_Os.os_getenv(s) end; +end +Sys.putEnv = function(s,v) + __lua_lib_luv_Os.os_setenv(s, v); +end +Sys.setTimeLocale = function(loc) + do return _G.os.setlocale(loc) ~= nil end; +end +Sys.sleep = function(seconds) + __lua_lib_luv_Thread.sleep(_G.math.floor(seconds * 1000)); +end +Sys.stderr = function() + do return __sys_io_FileOutput.new(_G.io.stderr) end; +end +Sys.stdin = function() + do return __sys_io_FileInput.new(_G.io.stdin) end; +end +Sys.stdout = function() + do return __sys_io_FileOutput.new(_G.io.stdout) end; +end +Sys.time = function() + local _hx_1_stamp_seconds, _hx_1_stamp_microseconds = __lua_lib_luv_Misc.gettimeofday(); + do return _hx_1_stamp_seconds + (_hx_1_stamp_microseconds / 1000000) end; +end +_hxClasses["ValueType"] = ValueType; +_hxClasses["ValueType"] = { __ename__ = "ValueType", __constructs__ = _hx_tab_array({[0]="TNull","TInt","TFloat","TBool","TObject","TFunction","TClass","TEnum","TUnknown"},9)} +ValueType = _hxClasses["ValueType"]; +ValueType.TNull = _hx_tab_array({[0]="TNull",0,__enum__ = ValueType},2) + +ValueType.TInt = _hx_tab_array({[0]="TInt",1,__enum__ = ValueType},2) + +ValueType.TFloat = _hx_tab_array({[0]="TFloat",2,__enum__ = ValueType},2) + +ValueType.TBool = _hx_tab_array({[0]="TBool",3,__enum__ = ValueType},2) + +ValueType.TObject = _hx_tab_array({[0]="TObject",4,__enum__ = ValueType},2) + +ValueType.TFunction = _hx_tab_array({[0]="TFunction",5,__enum__ = ValueType},2) + +ValueType.TClass = function(c) local _x = _hx_tab_array({[0]="TClass",6,c,__enum__=ValueType}, 3); return _x; end +ValueType.TEnum = function(e) local _x = _hx_tab_array({[0]="TEnum",7,e,__enum__=ValueType}, 3); return _x; end +ValueType.TUnknown = _hx_tab_array({[0]="TUnknown",8,__enum__ = ValueType},2) + +ValueType.__empty_constructs__ = _hx_tab_array({[0] = ValueType.TNull,ValueType.TInt,ValueType.TFloat,ValueType.TBool,ValueType.TObject,ValueType.TFunction,ValueType.TUnknown}, 7) + +Type.new = {} +_hxClasses["Type"] = Type +Type.__name__ = "Type" +Type.getClass = function(o) + if (o == nil) then + do return nil end; + end; + local o = o; + if (__lua_Boot.__instanceof(o, Array)) then + do return Array end; + else + if (__lua_Boot.__instanceof(o, String)) then + do return String end; + else + local cl = o.__class__; + if (cl ~= nil) then + do return cl end; + else + do return nil end; + end; + end; + end; +end +Type.getEnum = function(o) + if (o == nil) then + do return nil end; + end; + do return o.__enum__ end; +end +Type.getSuperClass = function(c) + do return c.__super__ end; +end +Type.getClassName = function(c) + do return c.__name__ end; +end +Type.getEnumName = function(e) + if (e.__ename__ == nil) then + do return nil end; + end; + do return e.__ename__ end; +end +Type.resolveClass = function(name) + local cl = _hxClasses[name]; + local tmp; + if (cl ~= nil) then + local o = cl; + tmp = not ((function() + local _hx_1 + if (_G.type(o) ~= "table") then + _hx_1 = false; else + _hx_1 = o.__name__; end + return _hx_1 + end )()); + else + tmp = true; + end; + if (tmp) then + do return nil end; + end; + do return cl end; +end +Type.resolveEnum = function(name) + local e = _hxClasses[name]; + if ((e == nil) or not ((function() + local _hx_1 + if (_G.type(e) ~= "table") then + _hx_1 = false; else + _hx_1 = e.__ename__; end + return _hx_1 + end )())) then + do return nil end; + end; + do return e end; +end +Type.createInstance = function(cl,args) + do return cl.new(_hx_table.unpack(args, 0)) end; +end +Type.createEmptyInstance = function(cl) + local ret = ({}); + _G.setmetatable(ret, _hx_o({__fields__={__index=true},__index=cl.prototype})); + do return ret end; +end +Type.createEnum = function(e,constr,params) + local f = Reflect.field(e, constr); + if (f == nil) then + _G.error(__haxe_Exception.thrown(Std.string("No such constructor ") .. Std.string(constr)),0); + end; + if (Reflect.isFunction(f)) then + if (params == nil) then + _G.error(__haxe_Exception.thrown(Std.string(Std.string("Constructor ") .. Std.string(constr)) .. Std.string(" need parameters")),0); + end; + do return Reflect.callMethod(nil,f,params) end; + end; + if ((params ~= nil) and (params.length ~= 0)) then + _G.error(__haxe_Exception.thrown(Std.string(Std.string("Constructor ") .. Std.string(constr)) .. Std.string(" does not need parameters")),0); + end; + do return f end; +end +Type.createEnumIndex = function(e,index,params) + local c = e.__constructs__[index]; + if (c == nil) then + _G.error(__haxe_Exception.thrown(Std.string(index) .. Std.string(" is not a valid enum constructor index")),0); + end; + do return Type.createEnum(e, c, params) end; +end +Type.getInstanceFields = function(c) + local p = c.prototype; + local a = _hx_tab_array({}, 0); + while (p ~= nil) do + local _g = 0; + local _g1 = Reflect.fields(p); + while (_g < _g1.length) do + local f = _g1[_g]; + _g = _g + 1; + if (not Lambda.has(a, f)) then + a:push(f); + end; + end; + local mt = _G.getmetatable(p); + if ((mt ~= nil) and (mt.__index ~= nil)) then + p = mt.__index; + else + p = nil; + end; + end; + do return a end; +end +Type.getClassFields = function(c) + local a = Reflect.fields(c); + a:remove("__name__"); + a:remove("__interfaces__"); + a:remove("__properties__"); + a:remove("__super__"); + a:remove("__meta__"); + a:remove("prototype"); + a:remove("new"); + do return a end; +end +Type.getEnumConstructs = function(e) + local a = e.__constructs__; + local _g = _hx_tab_array({}, 0); + local _g1 = 0; + local _g2 = a; + while (_g1 < _g2.length) do + local i = _g2[_g1]; + _g1 = _g1 + 1; + _g:push(i); + end; + do return _g end; +end +Type.typeof = function(v) + local _g = _G.type(v); + if (_g) == "boolean" then + do return ValueType.TBool end; + elseif (_g) == "function" then + if ((function() + local _hx_1 + if (_G.type(v) ~= "table") then + _hx_1 = false; else + _hx_1 = v.__name__; end + return _hx_1 + end )() or (function() + local _hx_2 + if (_G.type(v) ~= "table") then + _hx_2 = false; else + _hx_2 = v.__ename__; end + return _hx_2 + end )()) then + do return ValueType.TObject end; + end; + do return ValueType.TFunction end; + elseif (_g) == "nil" then + do return ValueType.TNull end; + elseif (_g) == "number" then + if (_G.math.ceil(v) == (_G.math.fmod(v, 2147483648.0))) then + do return ValueType.TInt end; + end; + do return ValueType.TFloat end; + elseif (_g) == "string" then + do return ValueType.TClass(String) end; + elseif (_g) == "table" then + local e = v.__enum__; + if (e ~= nil) then + do return ValueType.TEnum(e) end; + end; + local c; + if (__lua_Boot.__instanceof(v, Array)) then + c = Array; + else + if (__lua_Boot.__instanceof(v, String)) then + c = String; + else + local cl = v.__class__; + c = (function() + local _hx_3 + if (cl ~= nil) then + _hx_3 = cl; else + _hx_3 = nil; end + return _hx_3 + end )(); + end; + end; + if (c ~= nil) then + do return ValueType.TClass(c) end; + end; + do return ValueType.TObject end;else + do return ValueType.TUnknown end; end; +end +Type.enumEq = function(a,b) + if (a == b) then + do return true end; + end; + local _hx_status, _hx_result = pcall(function() + + if (a[0] ~= b[0]) then + do return false end; + end; + local _g = 2; + local _g1 = a.length; + while (_g < _g1) do + _g = _g + 1; + local i = _g - 1; + if (not Type.enumEq(a[i], b[i])) then + do return false end; + end; + end; + local e = a.__enum__; + if ((e ~= b.__enum__) or (e == nil)) then + do return false end; + end; + return _hx_pcall_default + end) + if not _hx_status and _hx_result == "_hx_pcall_break" then + elseif not _hx_status then + local _g = _hx_result; + do return false end; + elseif _hx_result ~= _hx_pcall_default then + return _hx_result + end; + do return true end; +end +Type.enumConstructor = function(e) + do return e[0] end; +end +Type.enumParameters = function(e) + do return e:slice(2) end; +end +Type.enumIndex = function(e) + do return e[1] end; +end +Type.allEnums = function(e) + local _g = _hx_tab_array({}, 0); + local _g1 = 0; + local _g2 = e.__empty_constructs__; + while (_g1 < _g2.length) do + local i = _g2[_g1]; + _g1 = _g1 + 1; + _g:push(i); + end; + do return _g end; +end +_hxClasses["haxe.StackItem"] = __haxe_StackItem; +_hxClasses["haxe.StackItem"] = { __ename__ = "haxe.StackItem", __constructs__ = _hx_tab_array({[0]="CFunction","Module","FilePos","Method","LocalFunction"},5)} +__haxe_StackItem = _hxClasses["haxe.StackItem"]; +__haxe_StackItem.CFunction = _hx_tab_array({[0]="CFunction",0,__enum__ = __haxe_StackItem},2) + +__haxe_StackItem.Module = function(m) local _x = _hx_tab_array({[0]="Module",1,m,__enum__=__haxe_StackItem}, 3); return _x; end +__haxe_StackItem.FilePos = function(s,file,line,column) local _x = _hx_tab_array({[0]="FilePos",2,s,file,line,column,__enum__=__haxe_StackItem}, 6); return _x; end +__haxe_StackItem.Method = function(classname,method) local _x = _hx_tab_array({[0]="Method",3,classname,method,__enum__=__haxe_StackItem}, 4); return _x; end +__haxe_StackItem.LocalFunction = function(v) local _x = _hx_tab_array({[0]="LocalFunction",4,v,__enum__=__haxe_StackItem}, 3); return _x; end +__haxe_StackItem.__empty_constructs__ = _hx_tab_array({[0] = __haxe_StackItem.CFunction}, 1) + +__haxe__CallStack_CallStack_Impl_.new = {} +_hxClasses["haxe._CallStack.CallStack_Impl_"] = __haxe__CallStack_CallStack_Impl_ +__haxe__CallStack_CallStack_Impl_.__name__ = "haxe._CallStack.CallStack_Impl_" +__haxe__CallStack_CallStack_Impl_.__properties__ = {get_length="get_length"} +__haxe__CallStack_CallStack_Impl_.get_length = function(this1) + do return this1.length end; +end +__haxe__CallStack_CallStack_Impl_.callStack = function() + do return __haxe_NativeStackTrace.toHaxe(__haxe_NativeStackTrace.callStack()) end; +end +__haxe__CallStack_CallStack_Impl_.exceptionStack = function(fullStack) + if (fullStack == nil) then + fullStack = false; + end; + local eStack = __haxe_NativeStackTrace.toHaxe(__haxe_NativeStackTrace.exceptionStack()); + do return (function() + local _hx_1 + if (fullStack) then + _hx_1 = eStack; else + _hx_1 = __haxe__CallStack_CallStack_Impl_.subtract(eStack, __haxe__CallStack_CallStack_Impl_.callStack()); end + return _hx_1 + end )() end; +end +__haxe__CallStack_CallStack_Impl_.toString = function(stack) + local b = StringBuf.new(); + local _g = 0; + local _g1 = stack; + while (_g < _g1.length) do + local s = _g1[_g]; + _g = _g + 1; + local str = "\nCalled from "; + _G.table.insert(b.b, str); + local b1 = b; + b1.length = b1.length + __lua_lib_luautf8_Utf8.len(str); + __haxe__CallStack_CallStack_Impl_.itemToString(b, s); + end; + do return _G.table.concat(b.b) end; +end +__haxe__CallStack_CallStack_Impl_.subtract = function(this1,stack) + local startIndex = -1; + local i = -1; + while (true) do + i = i + 1; + if (not (i < this1.length)) then + break; + end; + local _g = 0; + local _g1 = stack.length; + while (_g < _g1) do + _g = _g + 1; + local j = _g - 1; + if (__haxe__CallStack_CallStack_Impl_.equalItems(this1[i], stack[j])) then + if (startIndex < 0) then + startIndex = i; + end; + i = i + 1; + if (i >= this1.length) then + break; + end; + else + startIndex = -1; + end; + end; + if (startIndex >= 0) then + break; + end; + end; + if (startIndex >= 0) then + do return this1:slice(0, startIndex) end; + else + do return this1 end; + end; +end +__haxe__CallStack_CallStack_Impl_.copy = function(this1) + local _g = _hx_tab_array({}, 0); + local _g1 = 0; + local _g2 = this1; + while (_g1 < _g2.length) do + local i = _g2[_g1]; + _g1 = _g1 + 1; + _g:push(i); + end; + do return _g end; +end +__haxe__CallStack_CallStack_Impl_.get = function(this1,index) + do return this1[index] end; +end +__haxe__CallStack_CallStack_Impl_.asArray = function(this1) + do return this1 end; +end +__haxe__CallStack_CallStack_Impl_.equalItems = function(item1,item2) + if (item1 == nil) then + if (item2 == nil) then + do return true end; + else + do return false end; + end; + else + local tmp = item1[1]; + if (tmp) == 0 then + if (item2 == nil) then + do return false end; + else + if (item2[1] == 0) then + do return true end; + else + do return false end; + end; + end; + elseif (tmp) == 1 then + if (item2 == nil) then + do return false end; + else + if (item2[1] == 1) then + local m2 = item2[2]; + local m1 = item1[2]; + do return m1 == m2 end; + else + do return false end; + end; + end; + elseif (tmp) == 2 then + if (item2 == nil) then + do return false end; + else + if (item2[1] == 2) then + local item21 = item2[2]; + local file2 = item2[3]; + local line2 = item2[4]; + local col2 = item2[5]; + local col1 = item1[5]; + local line1 = item1[4]; + local file1 = item1[3]; + local item1 = item1[2]; + if (((file1 == file2) and (line1 == line2)) and (col1 == col2)) then + do return __haxe__CallStack_CallStack_Impl_.equalItems(item1, item21) end; + else + do return false end; + end; + else + do return false end; + end; + end; + elseif (tmp) == 3 then + if (item2 == nil) then + do return false end; + else + if (item2[1] == 3) then + local class2 = item2[2]; + local method2 = item2[3]; + local method1 = item1[3]; + local class1 = item1[2]; + if (class1 == class2) then + do return method1 == method2 end; + else + do return false end; + end; + else + do return false end; + end; + end; + elseif (tmp) == 4 then + if (item2 == nil) then + do return false end; + else + if (item2[1] == 4) then + local v2 = item2[2]; + local v1 = item1[2]; + do return v1 == v2 end; + else + do return false end; + end; + end; end; + end; +end +__haxe__CallStack_CallStack_Impl_.exceptionToString = function(e) + if (e:get_previous() == nil) then + local tmp = Std.string("Exception: ") .. Std.string(e:toString()); + local tmp1 = e:get_stack(); + do return Std.string(tmp) .. Std.string(((function() + local _hx_1 + if (tmp1 == nil) then + _hx_1 = "null"; else + _hx_1 = _hx_wrap_if_string_field(__haxe__CallStack_CallStack_Impl_,'toString')(tmp1); end + return _hx_1 + end )())) end; + end; + local result = ""; + local e = e; + local prev = nil; + while (e ~= nil) do + if (prev == nil) then + local result1 = Std.string("Exception: ") .. Std.string(e:get_message()); + local tmp = e:get_stack(); + result = Std.string(Std.string(result1) .. Std.string(((function() + local _hx_2 + if (tmp == nil) then + _hx_2 = "null"; else + _hx_2 = _hx_wrap_if_string_field(__haxe__CallStack_CallStack_Impl_,'toString')(tmp); end + return _hx_2 + end )()))) .. Std.string(result); + else + local prevStack = __haxe__CallStack_CallStack_Impl_.subtract(e:get_stack(), prev:get_stack()); + result = Std.string(Std.string(Std.string(Std.string("Exception: ") .. Std.string(e:get_message())) .. Std.string(((function() + local _hx_3 + if (prevStack == nil) then + _hx_3 = "null"; else + _hx_3 = _hx_wrap_if_string_field(__haxe__CallStack_CallStack_Impl_,'toString')(prevStack); end + return _hx_3 + end )()))) .. Std.string("\n\nNext ")) .. Std.string(result); + end; + prev = e; + e = e:get_previous(); + end; + do return result end; +end +__haxe__CallStack_CallStack_Impl_.itemToString = function(b,s) + local tmp = s[1]; + if (tmp) == 0 then + local str = "a C function"; + _G.table.insert(b.b, str); + local b = b; + b.length = b.length + __lua_lib_luautf8_Utf8.len(str); + elseif (tmp) == 1 then + local m = s[2]; + local str = "module "; + _G.table.insert(b.b, str); + local b1 = b; + b1.length = b1.length + __lua_lib_luautf8_Utf8.len(str); + local str = Std.string(m); + _G.table.insert(b.b, str); + local b = b; + b.length = b.length + __lua_lib_luautf8_Utf8.len(str); + elseif (tmp) == 2 then + local s1 = s[2]; + local file = s[3]; + local line = s[4]; + local col = s[5]; + if (s1 ~= nil) then + __haxe__CallStack_CallStack_Impl_.itemToString(b, s1); + local str = " ("; + _G.table.insert(b.b, str); + local b = b; + b.length = b.length + __lua_lib_luautf8_Utf8.len(str); + end; + local str = Std.string(file); + _G.table.insert(b.b, str); + local b1 = b; + b1.length = b1.length + __lua_lib_luautf8_Utf8.len(str); + local str = " line "; + _G.table.insert(b.b, str); + local b1 = b; + b1.length = b1.length + __lua_lib_luautf8_Utf8.len(str); + local str = Std.string(line); + _G.table.insert(b.b, str); + local b1 = b; + b1.length = b1.length + __lua_lib_luautf8_Utf8.len(str); + if (col ~= nil) then + local str = " column "; + _G.table.insert(b.b, str); + local b1 = b; + b1.length = b1.length + __lua_lib_luautf8_Utf8.len(str); + local str = Std.string(col); + _G.table.insert(b.b, str); + local b = b; + b.length = b.length + __lua_lib_luautf8_Utf8.len(str); + end; + if (s1 ~= nil) then + local str = ")"; + _G.table.insert(b.b, str); + local b = b; + b.length = b.length + __lua_lib_luautf8_Utf8.len(str); + end; + elseif (tmp) == 3 then + local cname = s[2]; + local meth = s[3]; + local str = Std.string((function() + local _hx_1 + if (cname == nil) then + _hx_1 = ""; else + _hx_1 = cname; end + return _hx_1 + end )()); + _G.table.insert(b.b, str); + local b1 = b; + b1.length = b1.length + __lua_lib_luautf8_Utf8.len(str); + local str = "."; + _G.table.insert(b.b, str); + local b1 = b; + b1.length = b1.length + __lua_lib_luautf8_Utf8.len(str); + local str = Std.string(meth); + _G.table.insert(b.b, str); + local b = b; + b.length = b.length + __lua_lib_luautf8_Utf8.len(str); + elseif (tmp) == 4 then + local n = s[2]; + local str = "local function #"; + _G.table.insert(b.b, str); + local b1 = b; + b1.length = b1.length + __lua_lib_luautf8_Utf8.len(str); + local str = Std.string(n); + _G.table.insert(b.b, str); + local b = b; + b.length = b.length + __lua_lib_luautf8_Utf8.len(str); end; +end + +__haxe_IMap.new = {} +_hxClasses["haxe.IMap"] = __haxe_IMap +__haxe_IMap.__name__ = "haxe.IMap" +__haxe_IMap.prototype = _hx_e(); +__haxe_IMap.prototype.get= nil; +__haxe_IMap.prototype.set= nil; +__haxe_IMap.prototype.exists= nil; +__haxe_IMap.prototype.remove= nil; +__haxe_IMap.prototype.keys= nil; +__haxe_IMap.prototype.iterator= nil; +__haxe_IMap.prototype.keyValueIterator= nil; +__haxe_IMap.prototype.copy= nil; +__haxe_IMap.prototype.toString= nil; +__haxe_IMap.prototype.clear= nil; + +__haxe_IMap.prototype.__class__ = __haxe_IMap + +__haxe__DynamicAccess_DynamicAccess_Impl_.new = {} +_hxClasses["haxe._DynamicAccess.DynamicAccess_Impl_"] = __haxe__DynamicAccess_DynamicAccess_Impl_ +__haxe__DynamicAccess_DynamicAccess_Impl_.__name__ = "haxe._DynamicAccess.DynamicAccess_Impl_" +__haxe__DynamicAccess_DynamicAccess_Impl_._new = function() + local this1 = _hx_e(); + do return this1 end; +end +__haxe__DynamicAccess_DynamicAccess_Impl_.get = function(this1,key) + do return Reflect.field(this1, key) end; +end +__haxe__DynamicAccess_DynamicAccess_Impl_.set = function(this1,key,value) + this1[key] = value; + do return value end; +end +__haxe__DynamicAccess_DynamicAccess_Impl_.exists = function(this1,key) + local o = this1; + if ((_G.type(o) == "string") and ((String.prototype[key] ~= nil) or (key == "length"))) then + do return true end; + else + if (o.__fields__ ~= nil) then + do return o.__fields__[key] ~= nil end; + else + do return o[key] ~= nil end; + end; + end; +end +__haxe__DynamicAccess_DynamicAccess_Impl_.remove = function(this1,key) + do return Reflect.deleteField(this1, key) end; +end +__haxe__DynamicAccess_DynamicAccess_Impl_.keys = function(this1) + do return Reflect.fields(this1) end; +end +__haxe__DynamicAccess_DynamicAccess_Impl_.copy = function(this1) + do return Reflect.copy(this1) end; +end +__haxe__DynamicAccess_DynamicAccess_Impl_.iterator = function(this1) + do return __haxe_iterators_DynamicAccessIterator.new(this1) end; +end +__haxe__DynamicAccess_DynamicAccess_Impl_.keyValueIterator = function(this1) + do return __haxe_iterators_DynamicAccessKeyValueIterator.new(this1) end; +end + +__haxe_Exception.new = function(message,previous,native) + local self = _hx_new(__haxe_Exception.prototype) + __haxe_Exception.super(self,message,previous,native) + return self +end +__haxe_Exception.super = function(self,message,previous,native) + self.__skipStack = 0; + self.__exceptionMessage = message; + self.__previousException = previous; + if (native ~= nil) then + self.__nativeException = native; + self.__nativeStack = __haxe_NativeStackTrace.exceptionStack(); + else + self.__nativeException = self; + self.__nativeStack = __haxe_NativeStackTrace.callStack(); + self.__skipStack = 1; + end; +end +_hxClasses["haxe.Exception"] = __haxe_Exception +__haxe_Exception.__name__ = "haxe.Exception" +__haxe_Exception.caught = function(value) + if (__lua_Boot.__instanceof(value, __haxe_Exception)) then + do return value end; + else + do return __haxe_ValueException.new(value, nil, value) end; + end; +end +__haxe_Exception.thrown = function(value) + if (__lua_Boot.__instanceof(value, __haxe_Exception)) then + do return value:get_native() end; + else + local e = __haxe_ValueException.new(value); + e.__skipStack = e.__skipStack + 1; + do return e end; + end; +end +__haxe_Exception.prototype = _hx_e(); +__haxe_Exception.prototype.__exceptionMessage= nil; +__haxe_Exception.prototype.__exceptionStack= nil; +__haxe_Exception.prototype.__nativeStack= nil; +__haxe_Exception.prototype.__skipStack= nil; +__haxe_Exception.prototype.__nativeException= nil; +__haxe_Exception.prototype.__previousException= nil; +__haxe_Exception.prototype.unwrap = function(self) + do return self.__nativeException end +end +__haxe_Exception.prototype.toString = function(self) + do return self:get_message() end +end +__haxe_Exception.prototype.details = function(self) + if (self:get_previous() == nil) then + local tmp = Std.string("Exception: ") .. Std.string(self:toString()); + local tmp1 = self:get_stack(); + do return Std.string(tmp) .. Std.string(((function() + local _hx_1 + if (tmp1 == nil) then + _hx_1 = "null"; else + _hx_1 = _hx_wrap_if_string_field(__haxe__CallStack_CallStack_Impl_,'toString')(tmp1); end + return _hx_1 + end )())) end; + else + local result = ""; + local e = self; + local prev = nil; + while (e ~= nil) do + if (prev == nil) then + local result1 = Std.string("Exception: ") .. Std.string(e:get_message()); + local tmp = e:get_stack(); + result = Std.string(Std.string(result1) .. Std.string(((function() + local _hx_2 + if (tmp == nil) then + _hx_2 = "null"; else + _hx_2 = _hx_wrap_if_string_field(__haxe__CallStack_CallStack_Impl_,'toString')(tmp); end + return _hx_2 + end )()))) .. Std.string(result); + else + local prevStack = __haxe__CallStack_CallStack_Impl_.subtract(e:get_stack(), prev:get_stack()); + result = Std.string(Std.string(Std.string(Std.string("Exception: ") .. Std.string(e:get_message())) .. Std.string(((function() + local _hx_3 + if (prevStack == nil) then + _hx_3 = "null"; else + _hx_3 = _hx_wrap_if_string_field(__haxe__CallStack_CallStack_Impl_,'toString')(prevStack); end + return _hx_3 + end )()))) .. Std.string("\n\nNext ")) .. Std.string(result); + end; + prev = e; + e = e:get_previous(); + end; + do return result end; + end; +end +__haxe_Exception.prototype.__shiftStack = function(self) + self.__skipStack = self.__skipStack + 1; +end +__haxe_Exception.prototype.get_message = function(self) + do return self.__exceptionMessage end +end +__haxe_Exception.prototype.get_previous = function(self) + do return self.__previousException end +end +__haxe_Exception.prototype.get_native = function(self) + do return self.__nativeException end +end +__haxe_Exception.prototype.get_stack = function(self) + local _g = self.__exceptionStack; + if (_g == nil) then + self.__exceptionStack = __haxe_NativeStackTrace.toHaxe(self.__nativeStack, self.__skipStack) do return self.__exceptionStack end; + else + local s = _g; + do return s end; + end; +end + +__haxe_Exception.prototype.__class__ = __haxe_Exception + +__haxe_Exception.prototype.__properties__ = {get_native="get_native",get_previous="get_previous",get_stack="get_stack",get_message="get_message"} + +__haxe__Int32_Int32_Impl_.new = {} +_hxClasses["haxe._Int32.Int32_Impl_"] = __haxe__Int32_Int32_Impl_ +__haxe__Int32_Int32_Impl_.__name__ = "haxe._Int32.Int32_Impl_" +__haxe__Int32_Int32_Impl_.negate = function(this1) + do return __haxe__Int32_Int32_Impl_.clamp(_hx_bit.bnot(this1) + 1) end; +end +__haxe__Int32_Int32_Impl_.preIncrement = function(this1) + this1 = this1 + 1; + this1 = __haxe__Int32_Int32_Impl_.clamp(this1); + do return this1 end; +end +__haxe__Int32_Int32_Impl_.postIncrement = function(this1) + this1 = this1 + 1; + local ret = this1 - 1; + this1 = __haxe__Int32_Int32_Impl_.clamp(this1); + do return ret end; +end +__haxe__Int32_Int32_Impl_.preDecrement = function(this1) + this1 = this1 - 1; + this1 = __haxe__Int32_Int32_Impl_.clamp(this1); + do return this1 end; +end +__haxe__Int32_Int32_Impl_.postDecrement = function(this1) + this1 = this1 - 1; + local ret = this1 + 1; + this1 = __haxe__Int32_Int32_Impl_.clamp(this1); + do return ret end; +end +__haxe__Int32_Int32_Impl_.add = function(a,b) + do return __haxe__Int32_Int32_Impl_.clamp(a + b) end; +end +__haxe__Int32_Int32_Impl_.addInt = function(a,b) + do return __haxe__Int32_Int32_Impl_.clamp(a + b) end; +end +__haxe__Int32_Int32_Impl_.sub = function(a,b) + do return __haxe__Int32_Int32_Impl_.clamp(a - b) end; +end +__haxe__Int32_Int32_Impl_.subInt = function(a,b) + do return __haxe__Int32_Int32_Impl_.clamp(a - b) end; +end +__haxe__Int32_Int32_Impl_.intSub = function(a,b) + do return __haxe__Int32_Int32_Impl_.clamp(a - b) end; +end +__haxe__Int32_Int32_Impl_.mul = function(a,b) + do return __haxe__Int32_Int32_Impl_.clamp((a * (_hx_bit.band(b,65535))) + __haxe__Int32_Int32_Impl_.clamp(_hx_bit.lshift(a * (_hx_bit.rshift(b,16)),16))) end; +end +__haxe__Int32_Int32_Impl_.mulInt = function(a,b) + do return __haxe__Int32_Int32_Impl_.mul(a, b) end; +end +__haxe__Int32_Int32_Impl_.complement = function(a) + do return _hx_bit_clamp(_hx_bit.bnot(a)) end; +end +__haxe__Int32_Int32_Impl_["or"] = function(a,b) + do return __haxe__Int32_Int32_Impl_.clamp(_hx_bit.bor(a,b)) end; +end +__haxe__Int32_Int32_Impl_.orInt = function(a,b) + do return __haxe__Int32_Int32_Impl_.clamp(_hx_bit.bor(a,b)) end; +end +__haxe__Int32_Int32_Impl_.xor = function(a,b) + do return __haxe__Int32_Int32_Impl_.clamp(_hx_bit.bxor(a,b)) end; +end +__haxe__Int32_Int32_Impl_.xorInt = function(a,b) + do return __haxe__Int32_Int32_Impl_.clamp(_hx_bit.bxor(a,b)) end; +end +__haxe__Int32_Int32_Impl_.shr = function(a,b) + do return __haxe__Int32_Int32_Impl_.clamp(_hx_bit.arshift(a,b)) end; +end +__haxe__Int32_Int32_Impl_.shrInt = function(a,b) + do return __haxe__Int32_Int32_Impl_.clamp(_hx_bit.arshift(a,b)) end; +end +__haxe__Int32_Int32_Impl_.intShr = function(a,b) + do return __haxe__Int32_Int32_Impl_.clamp(_hx_bit.arshift(a,b)) end; +end +__haxe__Int32_Int32_Impl_.shl = function(a,b) + do return __haxe__Int32_Int32_Impl_.clamp(_hx_bit.lshift(a,b)) end; +end +__haxe__Int32_Int32_Impl_.shlInt = function(a,b) + do return __haxe__Int32_Int32_Impl_.clamp(_hx_bit.lshift(a,b)) end; +end +__haxe__Int32_Int32_Impl_.intShl = function(a,b) + do return __haxe__Int32_Int32_Impl_.clamp(_hx_bit.lshift(a,b)) end; +end +__haxe__Int32_Int32_Impl_.toFloat = function(this1) + do return this1 end; +end +__haxe__Int32_Int32_Impl_.ucompare = function(a,b) + if (a < 0) then + if (b < 0) then + do return __haxe__Int32_Int32_Impl_.clamp(_hx_bit_clamp(_hx_bit.bnot(b)) - _hx_bit_clamp(_hx_bit.bnot(a))) end; + else + do return 1 end; + end; + end; + if (b < 0) then + do return -1 end; + else + do return __haxe__Int32_Int32_Impl_.clamp(a - b) end; + end; +end +__haxe__Int32_Int32_Impl_.clamp = function(x) + do return _hx_bit_clamp(x) end; +end + +__haxe__Int64_Int64_Impl_.new = {} +_hxClasses["haxe._Int64.Int64_Impl_"] = __haxe__Int64_Int64_Impl_ +__haxe__Int64_Int64_Impl_.__name__ = "haxe._Int64.Int64_Impl_" +__haxe__Int64_Int64_Impl_.__properties__ = {get_low="get_low",get_high="get_high"} +__haxe__Int64_Int64_Impl_._new = function(x) + local this1 = x; + do return this1 end; +end +__haxe__Int64_Int64_Impl_.copy = function(this1) + local this1 = __haxe__Int64____Int64.new(this1.high, this1.low); + do return this1 end; +end +__haxe__Int64_Int64_Impl_.make = function(high,low) + local this1 = __haxe__Int64____Int64.new(high, low); + do return this1 end; +end +__haxe__Int64_Int64_Impl_.ofInt = function(x) + local this1 = __haxe__Int64____Int64.new(__haxe__Int32_Int32_Impl_.shr(x, 31), x); + do return this1 end; +end +__haxe__Int64_Int64_Impl_.toInt = function(x) + if (x.high ~= __haxe__Int32_Int32_Impl_.shr(x.low, 31)) then + _G.error(__haxe_Exception.thrown("Overflow"),0); + end; + do return x.low end; +end +__haxe__Int64_Int64_Impl_.is = function(val) + do return __lua_Boot.__instanceof(val, __haxe__Int64____Int64) end; +end +__haxe__Int64_Int64_Impl_.isInt64 = function(val) + do return __lua_Boot.__instanceof(val, __haxe__Int64____Int64) end; +end +__haxe__Int64_Int64_Impl_.getHigh = function(x) + do return x.high end; +end +__haxe__Int64_Int64_Impl_.getLow = function(x) + do return x.low end; +end +__haxe__Int64_Int64_Impl_.isNeg = function(x) + do return x.high < 0 end; +end +__haxe__Int64_Int64_Impl_.isZero = function(x) + local b_high = __haxe__Int32_Int32_Impl_.shr(0, 31); + local b_low = 0; + if (x.high == b_high) then + do return x.low == b_low end; + else + do return false end; + end; +end +__haxe__Int64_Int64_Impl_.compare = function(a,b) + local v = __haxe__Int32_Int32_Impl_.clamp(a.high - b.high); + if (v == 0) then + v = __haxe__Int32_Int32_Impl_.ucompare(a.low, b.low); + end; + if (a.high < 0) then + if (b.high < 0) then + do return v end; + else + do return -1 end; + end; + else + if (b.high >= 0) then + do return v end; + else + do return 1 end; + end; + end; +end +__haxe__Int64_Int64_Impl_.ucompare = function(a,b) + local v = __haxe__Int32_Int32_Impl_.ucompare(a.high, b.high); + if (v ~= 0) then + do return v end; + else + do return __haxe__Int32_Int32_Impl_.ucompare(a.low, b.low) end; + end; +end +__haxe__Int64_Int64_Impl_.toStr = function(x) + do return _hx_wrap_if_string_field(__haxe__Int64_Int64_Impl_,'toString')(x) end; +end +__haxe__Int64_Int64_Impl_.toString = function(this1) + local i = this1; + local b_high = __haxe__Int32_Int32_Impl_.shr(0, 31); + local b_low = 0; + if ((i.high == b_high) and (i.low == b_low)) then + do return "0" end; + end; + local str = ""; + local neg = false; + if (i.high < 0) then + neg = true; + end; + local this1 = __haxe__Int64____Int64.new(__haxe__Int32_Int32_Impl_.shr(10, 31), 10); + local ten = this1; + while (true) do + local b_high = __haxe__Int32_Int32_Impl_.shr(0, 31); + local b_low = 0; + if (not ((i.high ~= b_high) or (i.low ~= b_low))) then + break; + end; + local r = __haxe__Int64_Int64_Impl_.divMod(i, ten); + if (r.modulus.high < 0) then + local x = r.modulus; + local a = x.high; + local high = _hx_bit_clamp(_hx_bit.bnot(a)); + local low = __haxe__Int32_Int32_Impl_.clamp(_hx_bit.bnot(x.low) + 1); + if (low == 0) then + high = high + 1; + local ret = high - 1; + high = __haxe__Int32_Int32_Impl_.clamp(high); + end; + local this_high = high; + local this_low = low; + str = Std.string(this_low) .. Std.string(str); + local x = r.quotient; + local a = x.high; + local high = _hx_bit_clamp(_hx_bit.bnot(a)); + local low = __haxe__Int32_Int32_Impl_.clamp(_hx_bit.bnot(x.low) + 1); + if (low == 0) then + high = high + 1; + local ret = high - 1; + high = __haxe__Int32_Int32_Impl_.clamp(high); + end; + local this1 = __haxe__Int64____Int64.new(high, low); + i = this1; + else + str = Std.string(r.modulus.low) .. Std.string(str); + i = r.quotient; + end; + end; + if (neg) then + str = Std.string("-") .. Std.string(str); + end; + do return str end; +end +__haxe__Int64_Int64_Impl_.parseString = function(sParam) + do return __haxe_Int64Helper.parseString(sParam) end; +end +__haxe__Int64_Int64_Impl_.fromFloat = function(f) + do return __haxe_Int64Helper.fromFloat(f) end; +end +__haxe__Int64_Int64_Impl_.divMod = function(dividend,divisor) + if (divisor.high == 0) then + local _g = divisor.low; + if (_g) == 0 then + _G.error(__haxe_Exception.thrown("divide by zero"),0); + elseif (_g) == 1 then + local this1 = __haxe__Int64____Int64.new(dividend.high, dividend.low); + local this2 = __haxe__Int64____Int64.new(__haxe__Int32_Int32_Impl_.shr(0, 31), 0); + do return _hx_o({__fields__={quotient=true,modulus=true},quotient=this1,modulus=this2}) end; end; + end; + local divSign = (dividend.high < 0) ~= (divisor.high < 0); + local modulus; + if (dividend.high < 0) then + local a = dividend.high; + local high = _hx_bit_clamp(_hx_bit.bnot(a)); + local low = __haxe__Int32_Int32_Impl_.clamp(_hx_bit.bnot(dividend.low) + 1); + if (low == 0) then + high = high + 1; + local ret = high - 1; + high = __haxe__Int32_Int32_Impl_.clamp(high); + end; + local this1 = __haxe__Int64____Int64.new(high, low); + modulus = this1; + else + local this1 = __haxe__Int64____Int64.new(dividend.high, dividend.low); + modulus = this1; + end; + if (divisor.high < 0) then + local a = divisor.high; + local high = _hx_bit_clamp(_hx_bit.bnot(a)); + local low = __haxe__Int32_Int32_Impl_.clamp(_hx_bit.bnot(divisor.low) + 1); + if (low == 0) then + high = high + 1; + local ret = high - 1; + high = __haxe__Int32_Int32_Impl_.clamp(high); + end; + local this1 = __haxe__Int64____Int64.new(high, low); + divisor = this1; + end; + local this1 = __haxe__Int64____Int64.new(__haxe__Int32_Int32_Impl_.shr(0, 31), 0); + local quotient = this1; + local this1 = __haxe__Int64____Int64.new(__haxe__Int32_Int32_Impl_.shr(1, 31), 1); + local mask = this1; + while (not (divisor.high < 0)) do + local v = __haxe__Int32_Int32_Impl_.ucompare(divisor.high, modulus.high); + local cmp = (function() + local _hx_1 + if (v ~= 0) then + _hx_1 = v; else + _hx_1 = __haxe__Int32_Int32_Impl_.ucompare(divisor.low, modulus.low); end + return _hx_1 + end )(); + local b = 1; + b = _hx_bit.band(b,63); + if (b == 0) then + local this1 = __haxe__Int64____Int64.new(divisor.high, divisor.low); + divisor = this1; + else + if (b < 32) then + local this1 = __haxe__Int64____Int64.new(__haxe__Int32_Int32_Impl_["or"](__haxe__Int32_Int32_Impl_.clamp(_hx_bit.lshift(divisor.high,b)), _hx_bit.rshift(divisor.low,32 - b)), __haxe__Int32_Int32_Impl_.clamp(_hx_bit.lshift(divisor.low,b))); + divisor = this1; + else + local this1 = __haxe__Int64____Int64.new(__haxe__Int32_Int32_Impl_.clamp(_hx_bit.lshift(divisor.low,b - 32)), 0); + divisor = this1; + end; + end; + local b = 1; + b = _hx_bit.band(b,63); + if (b == 0) then + local this1 = __haxe__Int64____Int64.new(mask.high, mask.low); + mask = this1; + else + if (b < 32) then + local this1 = __haxe__Int64____Int64.new(__haxe__Int32_Int32_Impl_["or"](__haxe__Int32_Int32_Impl_.clamp(_hx_bit.lshift(mask.high,b)), _hx_bit.rshift(mask.low,32 - b)), __haxe__Int32_Int32_Impl_.clamp(_hx_bit.lshift(mask.low,b))); + mask = this1; + else + local this1 = __haxe__Int64____Int64.new(__haxe__Int32_Int32_Impl_.clamp(_hx_bit.lshift(mask.low,b - 32)), 0); + mask = this1; + end; + end; + if (cmp >= 0) then + break; + end; + end; + while (true) do + local b_high = __haxe__Int32_Int32_Impl_.shr(0, 31); + local b_low = 0; + if (not ((mask.high ~= b_high) or (mask.low ~= b_low))) then + break; + end; + local v = __haxe__Int32_Int32_Impl_.ucompare(modulus.high, divisor.high); + if ((function() + local _hx_2 + if (v ~= 0) then + _hx_2 = v; else + _hx_2 = __haxe__Int32_Int32_Impl_.ucompare(modulus.low, divisor.low); end + return _hx_2 + end )() >= 0) then + local this1 = __haxe__Int64____Int64.new(__haxe__Int32_Int32_Impl_["or"](quotient.high, mask.high), __haxe__Int32_Int32_Impl_["or"](quotient.low, mask.low)); + quotient = this1; + local high = __haxe__Int32_Int32_Impl_.clamp(modulus.high - divisor.high); + local low = __haxe__Int32_Int32_Impl_.clamp(modulus.low - divisor.low); + if (__haxe__Int32_Int32_Impl_.ucompare(modulus.low, divisor.low) < 0) then + high = high - 1; + local ret = high + 1; + high = __haxe__Int32_Int32_Impl_.clamp(high); + end; + local this1 = __haxe__Int64____Int64.new(high, low); + modulus = this1; + end; + local b = 1; + b = _hx_bit.band(b,63); + if (b == 0) then + local this1 = __haxe__Int64____Int64.new(mask.high, mask.low); + mask = this1; + else + if (b < 32) then + local this1 = __haxe__Int64____Int64.new(_hx_bit.rshift(mask.high,b), __haxe__Int32_Int32_Impl_["or"](__haxe__Int32_Int32_Impl_.clamp(_hx_bit.lshift(mask.high,32 - b)), _hx_bit.rshift(mask.low,b))); + mask = this1; + else + local this1 = __haxe__Int64____Int64.new(0, _hx_bit.rshift(mask.high,b - 32)); + mask = this1; + end; + end; + local b = 1; + b = _hx_bit.band(b,63); + if (b == 0) then + local this1 = __haxe__Int64____Int64.new(divisor.high, divisor.low); + divisor = this1; + else + if (b < 32) then + local this1 = __haxe__Int64____Int64.new(_hx_bit.rshift(divisor.high,b), __haxe__Int32_Int32_Impl_["or"](__haxe__Int32_Int32_Impl_.clamp(_hx_bit.lshift(divisor.high,32 - b)), _hx_bit.rshift(divisor.low,b))); + divisor = this1; + else + local this1 = __haxe__Int64____Int64.new(0, _hx_bit.rshift(divisor.high,b - 32)); + divisor = this1; + end; + end; + end; + if (divSign) then + local a = quotient.high; + local high = _hx_bit_clamp(_hx_bit.bnot(a)); + local low = __haxe__Int32_Int32_Impl_.clamp(_hx_bit.bnot(quotient.low) + 1); + if (low == 0) then + high = high + 1; + local ret = high - 1; + high = __haxe__Int32_Int32_Impl_.clamp(high); + end; + local this1 = __haxe__Int64____Int64.new(high, low); + quotient = this1; + end; + if (dividend.high < 0) then + local a = modulus.high; + local high = _hx_bit_clamp(_hx_bit.bnot(a)); + local low = __haxe__Int32_Int32_Impl_.clamp(_hx_bit.bnot(modulus.low) + 1); + if (low == 0) then + high = high + 1; + local ret = high - 1; + high = __haxe__Int32_Int32_Impl_.clamp(high); + end; + local this1 = __haxe__Int64____Int64.new(high, low); + modulus = this1; + end; + do return _hx_o({__fields__={quotient=true,modulus=true},quotient=quotient,modulus=modulus}) end; +end +__haxe__Int64_Int64_Impl_.neg = function(x) + local a = x.high; + local high = _hx_bit_clamp(_hx_bit.bnot(a)); + local low = __haxe__Int32_Int32_Impl_.clamp(_hx_bit.bnot(x.low) + 1); + if (low == 0) then + high = high + 1; + local ret = high - 1; + high = __haxe__Int32_Int32_Impl_.clamp(high); + end; + local this1 = __haxe__Int64____Int64.new(high, low); + do return this1 end; +end +__haxe__Int64_Int64_Impl_.preIncrement = function(this1) + local this2 = __haxe__Int64____Int64.new(this1.high, this1.low); + this1 = this2; + local ret = (function() + local _hx_obj = this1; + local _hx_fld = 'low'; + local _ = _hx_obj[_hx_fld]; + _hx_obj[_hx_fld] = _hx_obj[_hx_fld] + 1; + return _; + end)(); + this1.low = __haxe__Int32_Int32_Impl_.clamp(this1.low); + if (this1.low == 0) then + local ret = (function() + local _hx_obj = this1; + local _hx_fld = 'high'; + local _ = _hx_obj[_hx_fld]; + _hx_obj[_hx_fld] = _hx_obj[_hx_fld] + 1; + return _; + end)(); + this1.high = __haxe__Int32_Int32_Impl_.clamp(this1.high); + end; + do return this1 end; +end +__haxe__Int64_Int64_Impl_.postIncrement = function(this1) + local ret = this1; + local this2 = __haxe__Int64____Int64.new(this1.high, this1.low); + this1 = this2; + local ret1 = (function() + local _hx_obj = this1; + local _hx_fld = 'low'; + local _ = _hx_obj[_hx_fld]; + _hx_obj[_hx_fld] = _hx_obj[_hx_fld] + 1; + return _; + end)(); + this1.low = __haxe__Int32_Int32_Impl_.clamp(this1.low); + if (this1.low == 0) then + local ret = (function() + local _hx_obj = this1; + local _hx_fld = 'high'; + local _ = _hx_obj[_hx_fld]; + _hx_obj[_hx_fld] = _hx_obj[_hx_fld] + 1; + return _; + end)(); + this1.high = __haxe__Int32_Int32_Impl_.clamp(this1.high); + end; + do return ret end; +end +__haxe__Int64_Int64_Impl_.preDecrement = function(this1) + local this2 = __haxe__Int64____Int64.new(this1.high, this1.low); + this1 = this2; + if (this1.low == 0) then + local ret = (function() + local _hx_obj = this1; + local _hx_fld = 'high'; + local _ = _hx_obj[_hx_fld]; + _hx_obj[_hx_fld] = _hx_obj[_hx_fld] - 1; + return _; + end)(); + this1.high = __haxe__Int32_Int32_Impl_.clamp(this1.high); + end; + local ret = (function() + local _hx_obj = this1; + local _hx_fld = 'low'; + local _ = _hx_obj[_hx_fld]; + _hx_obj[_hx_fld] = _hx_obj[_hx_fld] - 1; + return _; + end)(); + this1.low = __haxe__Int32_Int32_Impl_.clamp(this1.low); + do return this1 end; +end +__haxe__Int64_Int64_Impl_.postDecrement = function(this1) + local ret = this1; + local this2 = __haxe__Int64____Int64.new(this1.high, this1.low); + this1 = this2; + if (this1.low == 0) then + local ret = (function() + local _hx_obj = this1; + local _hx_fld = 'high'; + local _ = _hx_obj[_hx_fld]; + _hx_obj[_hx_fld] = _hx_obj[_hx_fld] - 1; + return _; + end)(); + this1.high = __haxe__Int32_Int32_Impl_.clamp(this1.high); + end; + local ret1 = (function() + local _hx_obj = this1; + local _hx_fld = 'low'; + local _ = _hx_obj[_hx_fld]; + _hx_obj[_hx_fld] = _hx_obj[_hx_fld] - 1; + return _; + end)(); + this1.low = __haxe__Int32_Int32_Impl_.clamp(this1.low); + do return ret end; +end +__haxe__Int64_Int64_Impl_.add = function(a,b) + local high = __haxe__Int32_Int32_Impl_.clamp(a.high + b.high); + local low = __haxe__Int32_Int32_Impl_.clamp(a.low + b.low); + if (__haxe__Int32_Int32_Impl_.ucompare(low, a.low) < 0) then + high = high + 1; + local ret = high - 1; + high = __haxe__Int32_Int32_Impl_.clamp(high); + end; + local this1 = __haxe__Int64____Int64.new(high, low); + do return this1 end; +end +__haxe__Int64_Int64_Impl_.addInt = function(a,b) + local b_high = __haxe__Int32_Int32_Impl_.shr(b, 31); + local b_low = b; + local high = __haxe__Int32_Int32_Impl_.clamp(a.high + b_high); + local low = __haxe__Int32_Int32_Impl_.clamp(a.low + b_low); + if (__haxe__Int32_Int32_Impl_.ucompare(low, a.low) < 0) then + high = high + 1; + local ret = high - 1; + high = __haxe__Int32_Int32_Impl_.clamp(high); + end; + local this1 = __haxe__Int64____Int64.new(high, low); + do return this1 end; +end +__haxe__Int64_Int64_Impl_.sub = function(a,b) + local high = __haxe__Int32_Int32_Impl_.clamp(a.high - b.high); + local low = __haxe__Int32_Int32_Impl_.clamp(a.low - b.low); + if (__haxe__Int32_Int32_Impl_.ucompare(a.low, b.low) < 0) then + high = high - 1; + local ret = high + 1; + high = __haxe__Int32_Int32_Impl_.clamp(high); + end; + local this1 = __haxe__Int64____Int64.new(high, low); + do return this1 end; +end +__haxe__Int64_Int64_Impl_.subInt = function(a,b) + local b_high = __haxe__Int32_Int32_Impl_.shr(b, 31); + local b_low = b; + local high = __haxe__Int32_Int32_Impl_.clamp(a.high - b_high); + local low = __haxe__Int32_Int32_Impl_.clamp(a.low - b_low); + if (__haxe__Int32_Int32_Impl_.ucompare(a.low, b_low) < 0) then + high = high - 1; + local ret = high + 1; + high = __haxe__Int32_Int32_Impl_.clamp(high); + end; + local this1 = __haxe__Int64____Int64.new(high, low); + do return this1 end; +end +__haxe__Int64_Int64_Impl_.intSub = function(a,b) + local a_high = __haxe__Int32_Int32_Impl_.shr(a, 31); + local a_low = a; + local high = __haxe__Int32_Int32_Impl_.clamp(a_high - b.high); + local low = __haxe__Int32_Int32_Impl_.clamp(a_low - b.low); + if (__haxe__Int32_Int32_Impl_.ucompare(a_low, b.low) < 0) then + high = high - 1; + local ret = high + 1; + high = __haxe__Int32_Int32_Impl_.clamp(high); + end; + local this1 = __haxe__Int64____Int64.new(high, low); + do return this1 end; +end +__haxe__Int64_Int64_Impl_.mul = function(a,b) + local mask = 65535; + local al = _hx_bit.band(a.low,mask); + local ah = _hx_bit.rshift(a.low,16); + local bl = _hx_bit.band(b.low,mask); + local bh = _hx_bit.rshift(b.low,16); + local p00 = __haxe__Int32_Int32_Impl_.mul(al, bl); + local p10 = __haxe__Int32_Int32_Impl_.mul(ah, bl); + local p01 = __haxe__Int32_Int32_Impl_.mul(al, bh); + local p11 = __haxe__Int32_Int32_Impl_.mul(ah, bh); + local low = p00; + local high = __haxe__Int32_Int32_Impl_.clamp(__haxe__Int32_Int32_Impl_.clamp(p11 + (_hx_bit.rshift(p01,16))) + (_hx_bit.rshift(p10,16))); + p01 = __haxe__Int32_Int32_Impl_.clamp(_hx_bit.lshift(p01,16)); + low = __haxe__Int32_Int32_Impl_.clamp(low + p01); + if (__haxe__Int32_Int32_Impl_.ucompare(low, p01) < 0) then + high = high + 1; + local ret = high - 1; + high = __haxe__Int32_Int32_Impl_.clamp(high); + end; + p10 = __haxe__Int32_Int32_Impl_.clamp(_hx_bit.lshift(p10,16)); + low = __haxe__Int32_Int32_Impl_.clamp(low + p10); + if (__haxe__Int32_Int32_Impl_.ucompare(low, p10) < 0) then + high = high + 1; + local ret = high - 1; + high = __haxe__Int32_Int32_Impl_.clamp(high); + end; + high = __haxe__Int32_Int32_Impl_.clamp(high + __haxe__Int32_Int32_Impl_.clamp(__haxe__Int32_Int32_Impl_.mul(a.low, b.high) + __haxe__Int32_Int32_Impl_.mul(a.high, b.low))); + local this1 = __haxe__Int64____Int64.new(high, low); + do return this1 end; +end +__haxe__Int64_Int64_Impl_.mulInt = function(a,b) + local this1 = __haxe__Int64____Int64.new(__haxe__Int32_Int32_Impl_.shr(b, 31), b); + do return __haxe__Int64_Int64_Impl_.mul(a, this1) end; +end +__haxe__Int64_Int64_Impl_.div = function(a,b) + do return __haxe__Int64_Int64_Impl_.divMod(a, b).quotient end; +end +__haxe__Int64_Int64_Impl_.divInt = function(a,b) + local this1 = __haxe__Int64____Int64.new(__haxe__Int32_Int32_Impl_.shr(b, 31), b); + do return __haxe__Int64_Int64_Impl_.divMod(a, this1).quotient end; +end +__haxe__Int64_Int64_Impl_.intDiv = function(a,b) + local this1 = __haxe__Int64____Int64.new(__haxe__Int32_Int32_Impl_.shr(a, 31), a); + local x = __haxe__Int64_Int64_Impl_.divMod(this1, b).quotient; + if (x.high ~= __haxe__Int32_Int32_Impl_.shr(x.low, 31)) then + _G.error(__haxe_Exception.thrown("Overflow"),0); + end; + local x = x.low; + local this1 = __haxe__Int64____Int64.new(__haxe__Int32_Int32_Impl_.shr(x, 31), x); + do return this1 end; +end +__haxe__Int64_Int64_Impl_.mod = function(a,b) + do return __haxe__Int64_Int64_Impl_.divMod(a, b).modulus end; +end +__haxe__Int64_Int64_Impl_.modInt = function(a,b) + local this1 = __haxe__Int64____Int64.new(__haxe__Int32_Int32_Impl_.shr(b, 31), b); + local x = __haxe__Int64_Int64_Impl_.divMod(a, this1).modulus; + if (x.high ~= __haxe__Int32_Int32_Impl_.shr(x.low, 31)) then + _G.error(__haxe_Exception.thrown("Overflow"),0); + end; + local x = x.low; + local this1 = __haxe__Int64____Int64.new(__haxe__Int32_Int32_Impl_.shr(x, 31), x); + do return this1 end; +end +__haxe__Int64_Int64_Impl_.intMod = function(a,b) + local this1 = __haxe__Int64____Int64.new(__haxe__Int32_Int32_Impl_.shr(a, 31), a); + local x = __haxe__Int64_Int64_Impl_.divMod(this1, b).modulus; + if (x.high ~= __haxe__Int32_Int32_Impl_.shr(x.low, 31)) then + _G.error(__haxe_Exception.thrown("Overflow"),0); + end; + local x = x.low; + local this1 = __haxe__Int64____Int64.new(__haxe__Int32_Int32_Impl_.shr(x, 31), x); + do return this1 end; +end +__haxe__Int64_Int64_Impl_.eq = function(a,b) + if (a.high == b.high) then + do return a.low == b.low end; + else + do return false end; + end; +end +__haxe__Int64_Int64_Impl_.eqInt = function(a,b) + local b_high = __haxe__Int32_Int32_Impl_.shr(b, 31); + local b_low = b; + if (a.high == b_high) then + do return a.low == b_low end; + else + do return false end; + end; +end +__haxe__Int64_Int64_Impl_.neq = function(a,b) + if (a.high == b.high) then + do return a.low ~= b.low end; + else + do return true end; + end; +end +__haxe__Int64_Int64_Impl_.neqInt = function(a,b) + local b_high = __haxe__Int32_Int32_Impl_.shr(b, 31); + local b_low = b; + if (a.high == b_high) then + do return a.low ~= b_low end; + else + do return true end; + end; +end +__haxe__Int64_Int64_Impl_.lt = function(a,b) + local v = __haxe__Int32_Int32_Impl_.clamp(a.high - b.high); + if (v == 0) then + v = __haxe__Int32_Int32_Impl_.ucompare(a.low, b.low); + end; + do return (function() + local _hx_1 + if (a.high < 0) then + _hx_1 = (function() + local _hx_2 + if (b.high < 0) then + _hx_2 = v; else + _hx_2 = -1; end + return _hx_2 + end )(); elseif (b.high >= 0) then + _hx_1 = v; else + _hx_1 = 1; end + return _hx_1 + end )() < 0 end; +end +__haxe__Int64_Int64_Impl_.ltInt = function(a,b) + local b_high = __haxe__Int32_Int32_Impl_.shr(b, 31); + local b_low = b; + local v = __haxe__Int32_Int32_Impl_.clamp(a.high - b_high); + if (v == 0) then + v = __haxe__Int32_Int32_Impl_.ucompare(a.low, b_low); + end; + do return (function() + local _hx_1 + if (a.high < 0) then + _hx_1 = (function() + local _hx_2 + if (b_high < 0) then + _hx_2 = v; else + _hx_2 = -1; end + return _hx_2 + end )(); elseif (b_high >= 0) then + _hx_1 = v; else + _hx_1 = 1; end + return _hx_1 + end )() < 0 end; +end +__haxe__Int64_Int64_Impl_.intLt = function(a,b) + local a_high = __haxe__Int32_Int32_Impl_.shr(a, 31); + local a_low = a; + local v = __haxe__Int32_Int32_Impl_.clamp(a_high - b.high); + if (v == 0) then + v = __haxe__Int32_Int32_Impl_.ucompare(a_low, b.low); + end; + do return (function() + local _hx_1 + if (a_high < 0) then + _hx_1 = (function() + local _hx_2 + if (b.high < 0) then + _hx_2 = v; else + _hx_2 = -1; end + return _hx_2 + end )(); elseif (b.high >= 0) then + _hx_1 = v; else + _hx_1 = 1; end + return _hx_1 + end )() < 0 end; +end +__haxe__Int64_Int64_Impl_.lte = function(a,b) + local v = __haxe__Int32_Int32_Impl_.clamp(a.high - b.high); + if (v == 0) then + v = __haxe__Int32_Int32_Impl_.ucompare(a.low, b.low); + end; + do return (function() + local _hx_1 + if (a.high < 0) then + _hx_1 = (function() + local _hx_2 + if (b.high < 0) then + _hx_2 = v; else + _hx_2 = -1; end + return _hx_2 + end )(); elseif (b.high >= 0) then + _hx_1 = v; else + _hx_1 = 1; end + return _hx_1 + end )() <= 0 end; +end +__haxe__Int64_Int64_Impl_.lteInt = function(a,b) + local b_high = __haxe__Int32_Int32_Impl_.shr(b, 31); + local b_low = b; + local v = __haxe__Int32_Int32_Impl_.clamp(a.high - b_high); + if (v == 0) then + v = __haxe__Int32_Int32_Impl_.ucompare(a.low, b_low); + end; + do return (function() + local _hx_1 + if (a.high < 0) then + _hx_1 = (function() + local _hx_2 + if (b_high < 0) then + _hx_2 = v; else + _hx_2 = -1; end + return _hx_2 + end )(); elseif (b_high >= 0) then + _hx_1 = v; else + _hx_1 = 1; end + return _hx_1 + end )() <= 0 end; +end +__haxe__Int64_Int64_Impl_.intLte = function(a,b) + local a_high = __haxe__Int32_Int32_Impl_.shr(a, 31); + local a_low = a; + local v = __haxe__Int32_Int32_Impl_.clamp(a_high - b.high); + if (v == 0) then + v = __haxe__Int32_Int32_Impl_.ucompare(a_low, b.low); + end; + do return (function() + local _hx_1 + if (a_high < 0) then + _hx_1 = (function() + local _hx_2 + if (b.high < 0) then + _hx_2 = v; else + _hx_2 = -1; end + return _hx_2 + end )(); elseif (b.high >= 0) then + _hx_1 = v; else + _hx_1 = 1; end + return _hx_1 + end )() <= 0 end; +end +__haxe__Int64_Int64_Impl_.gt = function(a,b) + local v = __haxe__Int32_Int32_Impl_.clamp(a.high - b.high); + if (v == 0) then + v = __haxe__Int32_Int32_Impl_.ucompare(a.low, b.low); + end; + do return (function() + local _hx_1 + if (a.high < 0) then + _hx_1 = (function() + local _hx_2 + if (b.high < 0) then + _hx_2 = v; else + _hx_2 = -1; end + return _hx_2 + end )(); elseif (b.high >= 0) then + _hx_1 = v; else + _hx_1 = 1; end + return _hx_1 + end )() > 0 end; +end +__haxe__Int64_Int64_Impl_.gtInt = function(a,b) + local b_high = __haxe__Int32_Int32_Impl_.shr(b, 31); + local b_low = b; + local v = __haxe__Int32_Int32_Impl_.clamp(a.high - b_high); + if (v == 0) then + v = __haxe__Int32_Int32_Impl_.ucompare(a.low, b_low); + end; + do return (function() + local _hx_1 + if (a.high < 0) then + _hx_1 = (function() + local _hx_2 + if (b_high < 0) then + _hx_2 = v; else + _hx_2 = -1; end + return _hx_2 + end )(); elseif (b_high >= 0) then + _hx_1 = v; else + _hx_1 = 1; end + return _hx_1 + end )() > 0 end; +end +__haxe__Int64_Int64_Impl_.intGt = function(a,b) + local a_high = __haxe__Int32_Int32_Impl_.shr(a, 31); + local a_low = a; + local v = __haxe__Int32_Int32_Impl_.clamp(a_high - b.high); + if (v == 0) then + v = __haxe__Int32_Int32_Impl_.ucompare(a_low, b.low); + end; + do return (function() + local _hx_1 + if (a_high < 0) then + _hx_1 = (function() + local _hx_2 + if (b.high < 0) then + _hx_2 = v; else + _hx_2 = -1; end + return _hx_2 + end )(); elseif (b.high >= 0) then + _hx_1 = v; else + _hx_1 = 1; end + return _hx_1 + end )() > 0 end; +end +__haxe__Int64_Int64_Impl_.gte = function(a,b) + local v = __haxe__Int32_Int32_Impl_.clamp(a.high - b.high); + if (v == 0) then + v = __haxe__Int32_Int32_Impl_.ucompare(a.low, b.low); + end; + do return (function() + local _hx_1 + if (a.high < 0) then + _hx_1 = (function() + local _hx_2 + if (b.high < 0) then + _hx_2 = v; else + _hx_2 = -1; end + return _hx_2 + end )(); elseif (b.high >= 0) then + _hx_1 = v; else + _hx_1 = 1; end + return _hx_1 + end )() >= 0 end; +end +__haxe__Int64_Int64_Impl_.gteInt = function(a,b) + local b_high = __haxe__Int32_Int32_Impl_.shr(b, 31); + local b_low = b; + local v = __haxe__Int32_Int32_Impl_.clamp(a.high - b_high); + if (v == 0) then + v = __haxe__Int32_Int32_Impl_.ucompare(a.low, b_low); + end; + do return (function() + local _hx_1 + if (a.high < 0) then + _hx_1 = (function() + local _hx_2 + if (b_high < 0) then + _hx_2 = v; else + _hx_2 = -1; end + return _hx_2 + end )(); elseif (b_high >= 0) then + _hx_1 = v; else + _hx_1 = 1; end + return _hx_1 + end )() >= 0 end; +end +__haxe__Int64_Int64_Impl_.intGte = function(a,b) + local a_high = __haxe__Int32_Int32_Impl_.shr(a, 31); + local a_low = a; + local v = __haxe__Int32_Int32_Impl_.clamp(a_high - b.high); + if (v == 0) then + v = __haxe__Int32_Int32_Impl_.ucompare(a_low, b.low); + end; + do return (function() + local _hx_1 + if (a_high < 0) then + _hx_1 = (function() + local _hx_2 + if (b.high < 0) then + _hx_2 = v; else + _hx_2 = -1; end + return _hx_2 + end )(); elseif (b.high >= 0) then + _hx_1 = v; else + _hx_1 = 1; end + return _hx_1 + end )() >= 0 end; +end +__haxe__Int64_Int64_Impl_.complement = function(a) + local a1 = a.high; + local high = _hx_bit_clamp(_hx_bit.bnot(a1)); + local a = a.low; + local this1 = __haxe__Int64____Int64.new(high, _hx_bit_clamp(_hx_bit.bnot(a))); + do return this1 end; +end +__haxe__Int64_Int64_Impl_["and"] = function(a,b) + local this1 = __haxe__Int64____Int64.new(_hx_bit.band(a.high,b.high), _hx_bit.band(a.low,b.low)); + do return this1 end; +end +__haxe__Int64_Int64_Impl_["or"] = function(a,b) + local this1 = __haxe__Int64____Int64.new(__haxe__Int32_Int32_Impl_["or"](a.high, b.high), __haxe__Int32_Int32_Impl_["or"](a.low, b.low)); + do return this1 end; +end +__haxe__Int64_Int64_Impl_.xor = function(a,b) + local this1 = __haxe__Int64____Int64.new(__haxe__Int32_Int32_Impl_.xor(a.high, b.high), __haxe__Int32_Int32_Impl_.xor(a.low, b.low)); + do return this1 end; +end +__haxe__Int64_Int64_Impl_.shl = function(a,b) + b = _hx_bit.band(b,63); + if (b == 0) then + local this1 = __haxe__Int64____Int64.new(a.high, a.low); + do return this1 end; + else + if (b < 32) then + local this1 = __haxe__Int64____Int64.new(__haxe__Int32_Int32_Impl_["or"](__haxe__Int32_Int32_Impl_.clamp(_hx_bit.lshift(a.high,b)), _hx_bit.rshift(a.low,32 - b)), __haxe__Int32_Int32_Impl_.clamp(_hx_bit.lshift(a.low,b))); + do return this1 end; + else + local this1 = __haxe__Int64____Int64.new(__haxe__Int32_Int32_Impl_.clamp(_hx_bit.lshift(a.low,b - 32)), 0); + do return this1 end; + end; + end; +end +__haxe__Int64_Int64_Impl_.shr = function(a,b) + b = _hx_bit.band(b,63); + if (b == 0) then + local this1 = __haxe__Int64____Int64.new(a.high, a.low); + do return this1 end; + else + if (b < 32) then + local this1 = __haxe__Int64____Int64.new(__haxe__Int32_Int32_Impl_.shr(a.high, b), __haxe__Int32_Int32_Impl_["or"](__haxe__Int32_Int32_Impl_.clamp(_hx_bit.lshift(a.high,32 - b)), _hx_bit.rshift(a.low,b))); + do return this1 end; + else + local this1 = __haxe__Int64____Int64.new(__haxe__Int32_Int32_Impl_.shr(a.high, 31), __haxe__Int32_Int32_Impl_.shr(a.high, b - 32)); + do return this1 end; + end; + end; +end +__haxe__Int64_Int64_Impl_.ushr = function(a,b) + b = _hx_bit.band(b,63); + if (b == 0) then + local this1 = __haxe__Int64____Int64.new(a.high, a.low); + do return this1 end; + else + if (b < 32) then + local this1 = __haxe__Int64____Int64.new(_hx_bit.rshift(a.high,b), __haxe__Int32_Int32_Impl_["or"](__haxe__Int32_Int32_Impl_.clamp(_hx_bit.lshift(a.high,32 - b)), _hx_bit.rshift(a.low,b))); + do return this1 end; + else + local this1 = __haxe__Int64____Int64.new(0, _hx_bit.rshift(a.high,b - 32)); + do return this1 end; + end; + end; +end +__haxe__Int64_Int64_Impl_.get_high = function(this1) + do return this1.high end; +end +__haxe__Int64_Int64_Impl_.set_high = function(this1,x) + this1.high = x do return this1.high end; +end +__haxe__Int64_Int64_Impl_.get_low = function(this1) + do return this1.low end; +end +__haxe__Int64_Int64_Impl_.set_low = function(this1,x) + this1.low = x do return this1.low end; +end + +__haxe__Int64____Int64.new = function(high,low) + local self = _hx_new(__haxe__Int64____Int64.prototype) + __haxe__Int64____Int64.super(self,high,low) + return self +end +__haxe__Int64____Int64.super = function(self,high,low) + self.high = high; + self.low = low; +end +_hxClasses["haxe._Int64.___Int64"] = __haxe__Int64____Int64 +__haxe__Int64____Int64.__name__ = "haxe._Int64.___Int64" +__haxe__Int64____Int64.prototype = _hx_e(); +__haxe__Int64____Int64.prototype.high= nil; +__haxe__Int64____Int64.prototype.low= nil; +__haxe__Int64____Int64.prototype.toString = function(self) + do return _hx_wrap_if_string_field(__haxe__Int64_Int64_Impl_,'toString')(self) end +end + +__haxe__Int64____Int64.prototype.__class__ = __haxe__Int64____Int64 + +__haxe_Int64Helper.new = {} +_hxClasses["haxe.Int64Helper"] = __haxe_Int64Helper +__haxe_Int64Helper.__name__ = "haxe.Int64Helper" +__haxe_Int64Helper.parseString = function(sParam) + local this1 = __haxe__Int64____Int64.new(__haxe__Int32_Int32_Impl_.shr(10, 31), 10); + local base = this1; + local this1 = __haxe__Int64____Int64.new(__haxe__Int32_Int32_Impl_.shr(0, 31), 0); + local current = this1; + local this1 = __haxe__Int64____Int64.new(__haxe__Int32_Int32_Impl_.shr(1, 31), 1); + local multiplier = this1; + local sIsNegative = false; + local s = StringTools.trim(sParam); + if (__lua_lib_luautf8_Utf8.sub(s, 1, 1) == "-") then + sIsNegative = true; + local startIndex = 1; + local endIndex = __lua_lib_luautf8_Utf8.len(s); + if (endIndex == nil) then + endIndex = __lua_lib_luautf8_Utf8.len(s); + end; + if (endIndex < 0) then + endIndex = 0; + end; + if (startIndex < 0) then + startIndex = 0; + end; + s = (function() + local _hx_1 + if (endIndex < startIndex) then + _hx_1 = __lua_lib_luautf8_Utf8.sub(s, endIndex + 1, startIndex); else + _hx_1 = __lua_lib_luautf8_Utf8.sub(s, startIndex + 1, endIndex); end + return _hx_1 + end )(); + end; + local len = __lua_lib_luautf8_Utf8.len(s); + local _g = 0; + local _g1 = len; + while (_g < _g1) do + _g = _g + 1; + local i = _g - 1; + local digitInt = __lua_lib_luautf8_Utf8.byte(s, ((len - 1) - i) + 1) - 48; + if ((digitInt < 0) or (digitInt > 9)) then + _G.error(__haxe_Exception.thrown("NumberFormatError"),0); + end; + if (digitInt ~= 0) then + local this1 = __haxe__Int64____Int64.new(__haxe__Int32_Int32_Impl_.shr(digitInt, 31), digitInt); + local digit = this1; + if (sIsNegative) then + local b = __haxe__Int64_Int64_Impl_.mul(multiplier, digit); + local high = __haxe__Int32_Int32_Impl_.clamp(current.high - b.high); + local low = __haxe__Int32_Int32_Impl_.clamp(current.low - b.low); + if (__haxe__Int32_Int32_Impl_.ucompare(current.low, b.low) < 0) then + high = high - 1; + local ret = high + 1; + high = __haxe__Int32_Int32_Impl_.clamp(high); + end; + local this1 = __haxe__Int64____Int64.new(high, low); + current = this1; + if (not (current.high < 0)) then + _G.error(__haxe_Exception.thrown("NumberFormatError: Underflow"),0); + end; + else + local b = __haxe__Int64_Int64_Impl_.mul(multiplier, digit); + local high = __haxe__Int32_Int32_Impl_.clamp(current.high + b.high); + local low = __haxe__Int32_Int32_Impl_.clamp(current.low + b.low); + if (__haxe__Int32_Int32_Impl_.ucompare(low, current.low) < 0) then + high = high + 1; + local ret = high - 1; + high = __haxe__Int32_Int32_Impl_.clamp(high); + end; + local this1 = __haxe__Int64____Int64.new(high, low); + current = this1; + if (current.high < 0) then + _G.error(__haxe_Exception.thrown("NumberFormatError: Overflow"),0); + end; + end; + end; + multiplier = __haxe__Int64_Int64_Impl_.mul(multiplier, base); + end; + do return current end; +end +__haxe_Int64Helper.fromFloat = function(f) + if (Math.isNaN(f) or not Math.isFinite(f)) then + _G.error(__haxe_Exception.thrown("Number is NaN or Infinite"),0); + end; + local noFractions = f - (_G.math.fmod(f, 1)); + if (noFractions > 9007199254740991) then + _G.error(__haxe_Exception.thrown("Conversion overflow"),0); + end; + if (noFractions < -9007199254740991) then + _G.error(__haxe_Exception.thrown("Conversion underflow"),0); + end; + local this1 = __haxe__Int64____Int64.new(__haxe__Int32_Int32_Impl_.shr(0, 31), 0); + local result = this1; + local neg = noFractions < 0; + local rest = (function() + local _hx_1 + if (neg) then + _hx_1 = -noFractions; else + _hx_1 = noFractions; end + return _hx_1 + end )(); + local i = 0; + while (rest >= 1) do + local curr = _G.math.fmod(rest, 2); + rest = rest / 2; + if (curr >= 1) then + local a_high = __haxe__Int32_Int32_Impl_.shr(1, 31); + local a_low = 1; + local b = i; + b = _hx_bit.band(b,63); + local b1; + if (b == 0) then + local this1 = __haxe__Int64____Int64.new(a_high, a_low); + b1 = this1; + else + if (b < 32) then + local this1 = __haxe__Int64____Int64.new(__haxe__Int32_Int32_Impl_["or"](__haxe__Int32_Int32_Impl_.clamp(_hx_bit.lshift(a_high,b)), _hx_bit.rshift(a_low,32 - b)), __haxe__Int32_Int32_Impl_.clamp(_hx_bit.lshift(a_low,b))); + b1 = this1; + else + local this1 = __haxe__Int64____Int64.new(__haxe__Int32_Int32_Impl_.clamp(_hx_bit.lshift(a_low,b - 32)), 0); + b1 = this1; + end; + end; + local high = __haxe__Int32_Int32_Impl_.clamp(result.high + b1.high); + local low = __haxe__Int32_Int32_Impl_.clamp(result.low + b1.low); + if (__haxe__Int32_Int32_Impl_.ucompare(low, result.low) < 0) then + high = high + 1; + local ret = high - 1; + high = __haxe__Int32_Int32_Impl_.clamp(high); + end; + local this1 = __haxe__Int64____Int64.new(high, low); + result = this1; + end; + i = i + 1; + end; + if (neg) then + local a = result.high; + local high = _hx_bit_clamp(_hx_bit.bnot(a)); + local low = __haxe__Int32_Int32_Impl_.clamp(_hx_bit.bnot(result.low) + 1); + if (low == 0) then + high = high + 1; + local ret = high - 1; + high = __haxe__Int32_Int32_Impl_.clamp(high); + end; + local this1 = __haxe__Int64____Int64.new(high, low); + result = this1; + end; + do return result end; +end + +__haxe_NativeStackTrace.new = {} +_hxClasses["haxe.NativeStackTrace"] = __haxe_NativeStackTrace +__haxe_NativeStackTrace.__name__ = "haxe.NativeStackTrace" +__haxe_NativeStackTrace.saveStack = function(exception) +end +__haxe_NativeStackTrace.callStack = function() + local _g = debug.traceback(); + if (_g == nil) then + do return _hx_tab_array({}, 0) end; + else + local s = _g; + local idx = 1; + local ret = _hx_tab_array({}, 0); + while (idx ~= nil) do + local newidx = 0; + if (__lua_lib_luautf8_Utf8.len("\n") > 0) then + newidx = __lua_lib_luautf8_Utf8.find(s, "\n", idx, true); + else + if (idx >= __lua_lib_luautf8_Utf8.len(s)) then + newidx = nil; + else + newidx = idx + 1; + end; + end; + if (newidx ~= nil) then + local match = __lua_lib_luautf8_Utf8.sub(s, idx, newidx - 1); + ret:push(match); + idx = newidx + __lua_lib_luautf8_Utf8.len("\n"); + else + ret:push(__lua_lib_luautf8_Utf8.sub(s, idx, __lua_lib_luautf8_Utf8.len(s))); + idx = nil; + end; + end; + do return ret:slice(3) end; + end; +end +__haxe_NativeStackTrace.exceptionStack = function() + do return _hx_tab_array({}, 0) end; +end +__haxe_NativeStackTrace.toHaxe = function(native,skip) + if (skip == nil) then + skip = 0; + end; + local stack = _hx_tab_array({}, 0); + local cnt = -1; + local _g = 0; + local _hx_continue_1 = false; + while (_g < native.length) do repeat + local item = native[_g]; + _g = _g + 1; + local pos = 1; + local len = nil; + if ((len == nil) or (len > (pos + __lua_lib_luautf8_Utf8.len(item)))) then + len = __lua_lib_luautf8_Utf8.len(item); + else + if (len < 0) then + len = __lua_lib_luautf8_Utf8.len(item) + len; + end; + end; + if (pos < 0) then + pos = __lua_lib_luautf8_Utf8.len(item) + pos; + end; + if (pos < 0) then + pos = 0; + end; + local _this = __lua_lib_luautf8_Utf8.sub(item, pos + 1, pos + len); + local idx = 1; + local ret = _hx_tab_array({}, 0); + while (idx ~= nil) do + local newidx = 0; + if (__lua_lib_luautf8_Utf8.len(":") > 0) then + newidx = __lua_lib_luautf8_Utf8.find(_this, ":", idx, true); + else + if (idx >= __lua_lib_luautf8_Utf8.len(_this)) then + newidx = nil; + else + newidx = idx + 1; + end; + end; + if (newidx ~= nil) then + local match = __lua_lib_luautf8_Utf8.sub(_this, idx, newidx - 1); + ret:push(match); + idx = newidx + __lua_lib_luautf8_Utf8.len(":"); + else + ret:push(__lua_lib_luautf8_Utf8.sub(_this, idx, __lua_lib_luautf8_Utf8.len(_this))); + idx = nil; + end; + end; + local parts = ret; + local file = parts[0]; + if (file == "[C]") then + break; + end; + cnt = cnt + 1; + if (skip > cnt) then + break; + end; + local line = parts[1]; + local method; + if (parts.length <= 2) then + method = nil; + else + local _this = parts[2]; + local startIndex = nil; + if (startIndex == nil) then + startIndex = 1; + else + startIndex = startIndex + 1; + end; + local r = __lua_lib_luautf8_Utf8.find(_this, "'", startIndex, true); + local methodPos = (function() + local _hx_1 + if ((r ~= nil) and (r > 0)) then + _hx_1 = r - 1; else + _hx_1 = -1; end + return _hx_1 + end )(); + if (methodPos < 0) then + method = nil; + else + local _this = parts[2]; + local startIndex = methodPos + 1; + local endIndex = __lua_lib_luautf8_Utf8.len(parts[2]) - 1; + if (endIndex == nil) then + endIndex = __lua_lib_luautf8_Utf8.len(_this); + end; + if (endIndex < 0) then + endIndex = 0; + end; + if (startIndex < 0) then + startIndex = 0; + end; + method = __haxe_StackItem.Method(nil, (function() + local _hx_2 + if (endIndex < startIndex) then + _hx_2 = __lua_lib_luautf8_Utf8.sub(_this, endIndex + 1, startIndex); else + _hx_2 = __lua_lib_luautf8_Utf8.sub(_this, startIndex + 1, endIndex); end + return _hx_2 + end )()); + end; + end; + stack:push(__haxe_StackItem.FilePos(method, file, Std.parseInt(line)));until true + if _hx_continue_1 then + _hx_continue_1 = false; + break; + end; + + end; + do return stack end; +end + +__haxe__Rest_Rest_Impl_.new = {} +_hxClasses["haxe._Rest.Rest_Impl_"] = __haxe__Rest_Rest_Impl_ +__haxe__Rest_Rest_Impl_.__name__ = "haxe._Rest.Rest_Impl_" +__haxe__Rest_Rest_Impl_.__properties__ = {get_length="get_length"} +__haxe__Rest_Rest_Impl_.get_length = function(this1) + do return _hx_table.maxn(this1) end; +end +__haxe__Rest_Rest_Impl_.of = function(array) + local ret = ({}); + local _g = 0; + local _g1 = array.length; + while (_g < _g1) do + _g = _g + 1; + local idx = _g - 1; + ret[idx + 1] = array[idx]; + end; + local this1 = ret; + do return this1 end; +end +__haxe__Rest_Rest_Impl_._new = function(table) + local this1 = table; + do return this1 end; +end +__haxe__Rest_Rest_Impl_.get = function(this1,index) + do return this1[index + 1] end; +end +__haxe__Rest_Rest_Impl_.toArray = function(this1) + local length = nil; + local tab = __lua_PairTools.copy(this1); + local length = length; + if (length == nil) then + length = _hx_table.maxn(tab); + if (length > 0) then + local head = tab[1]; + _G.table.remove(tab, 1); + tab[0] = head; + do return _hx_tab_array(tab, length) end; + else + do return _hx_tab_array({}, 0) end; + end; + else + do return _hx_tab_array(tab, length) end; + end; +end +__haxe__Rest_Rest_Impl_.iterator = function(this1) + do return __haxe_iterators_RestIterator.new(this1) end; +end +__haxe__Rest_Rest_Impl_.keyValueIterator = function(this1) + do return __haxe_iterators_RestKeyValueIterator.new(this1) end; +end +__haxe__Rest_Rest_Impl_.append = function(this1,item) + local result = __lua_PairTools.copy(this1); + _G.table.insert(result, item); + local this1 = result; + do return this1 end; +end +__haxe__Rest_Rest_Impl_.prepend = function(this1,item) + local result = __lua_PairTools.copy(this1); + _G.table.insert(result, 1, item); + local this1 = result; + do return this1 end; +end +__haxe__Rest_Rest_Impl_.toString = function(this1) + do return __haxe__Rest_Rest_Impl_.toArray(this1):toString() end; +end + +__haxe_ValueException.new = function(value,previous,native) + local self = _hx_new(__haxe_ValueException.prototype) + __haxe_ValueException.super(self,value,previous,native) + return self +end +__haxe_ValueException.super = function(self,value,previous,native) + __haxe_Exception.super(self,Std.string(value),previous,native); + self.value = value; + self.__skipStack = self.__skipStack + 1; +end +_hxClasses["haxe.ValueException"] = __haxe_ValueException +__haxe_ValueException.__name__ = "haxe.ValueException" +__haxe_ValueException.prototype = _hx_e(); +__haxe_ValueException.prototype.value= nil; +__haxe_ValueException.prototype.unwrap = function(self) + do return self.value end +end + +__haxe_ValueException.prototype.__class__ = __haxe_ValueException +__haxe_ValueException.__super__ = __haxe_Exception +setmetatable(__haxe_ValueException.prototype,{__index=__haxe_Exception.prototype}) +setmetatable(__haxe_ValueException.prototype.__properties__,{__index=__haxe_Exception.prototype.__properties__}) + +__haxe_ds_BalancedTree.new = function() + local self = _hx_new(__haxe_ds_BalancedTree.prototype) + __haxe_ds_BalancedTree.super(self) + return self +end +__haxe_ds_BalancedTree.super = function(self) +end +_hxClasses["haxe.ds.BalancedTree"] = __haxe_ds_BalancedTree +__haxe_ds_BalancedTree.__name__ = "haxe.ds.BalancedTree" +__haxe_ds_BalancedTree.__interfaces__ = {__haxe_IMap} +__haxe_ds_BalancedTree.iteratorLoop = function(node,acc) + if (node ~= nil) then + __haxe_ds_BalancedTree.iteratorLoop(node.left, acc); + acc:push(node.value); + __haxe_ds_BalancedTree.iteratorLoop(node.right, acc); + end; +end +__haxe_ds_BalancedTree.prototype = _hx_e(); +__haxe_ds_BalancedTree.prototype.root= nil; +__haxe_ds_BalancedTree.prototype.set = function(self,key,value) + self.root = self:setLoop(key, value, self.root); +end +__haxe_ds_BalancedTree.prototype.get = function(self,key) + local node = self.root; + while (node ~= nil) do + local c = self:compare(key, node.key); + if (c == 0) then + do return node.value end; + end; + if (c < 0) then + node = node.left; + else + node = node.right; + end; + end; + do return nil end +end +__haxe_ds_BalancedTree.prototype.remove = function(self,key) + local _hx_status, _hx_result = pcall(function() + + self.root = self:removeLoop(key, self.root); + do return true end; + return _hx_pcall_default + end) + if not _hx_status and _hx_result == "_hx_pcall_break" then + elseif not _hx_status then + local _g = _hx_result; + if (__lua_Boot.__instanceof(__haxe_Exception.caught(_g):unwrap(), String)) then + do return false end; + else + _G.error(_g,0); + end; + elseif _hx_result ~= _hx_pcall_default then + return _hx_result + end; +end +__haxe_ds_BalancedTree.prototype.exists = function(self,key) + local node = self.root; + while (node ~= nil) do + local c = self:compare(key, node.key); + if (c == 0) then + do return true end; + else + if (c < 0) then + node = node.left; + else + node = node.right; + end; + end; + end; + do return false end +end +__haxe_ds_BalancedTree.prototype.iterator = function(self) + local ret = _hx_tab_array({}, 0); + __haxe_ds_BalancedTree.iteratorLoop(self.root, ret); + do return __haxe_iterators_ArrayIterator.new(ret) end +end +__haxe_ds_BalancedTree.prototype.keyValueIterator = function(self) + do return __haxe_iterators_MapKeyValueIterator.new(self) end +end +__haxe_ds_BalancedTree.prototype.keys = function(self) + local ret = _hx_tab_array({}, 0); + self:keysLoop(self.root, ret); + do return __haxe_iterators_ArrayIterator.new(ret) end +end +__haxe_ds_BalancedTree.prototype.copy = function(self) + local copied = __haxe_ds_BalancedTree.new(); + copied.root = self.root; + do return copied end +end +__haxe_ds_BalancedTree.prototype.setLoop = function(self,k,v,node) + if (node == nil) then + do return __haxe_ds_TreeNode.new(nil, k, v, nil) end; + end; + local c = self:compare(k, node.key); + if (c == 0) then + do return __haxe_ds_TreeNode.new(node.left, k, v, node.right, (function() + local _hx_1 + if (node == nil) then + _hx_1 = 0; else + _hx_1 = node._height; end + return _hx_1 + end )()) end; + else + if (c < 0) then + local nl = self:setLoop(k, v, node.left); + do return self:balance(nl, node.key, node.value, node.right) end; + else + local nr = self:setLoop(k, v, node.right); + do return self:balance(node.left, node.key, node.value, nr) end; + end; + end; +end +__haxe_ds_BalancedTree.prototype.removeLoop = function(self,k,node) + if (node == nil) then + _G.error(__haxe_Exception.thrown("Not_found"),0); + end; + local c = self:compare(k, node.key); + if (c == 0) then + do return self:merge(node.left, node.right) end; + else + if (c < 0) then + do return self:balance(self:removeLoop(k, node.left), node.key, node.value, node.right) end; + else + do return self:balance(node.left, node.key, node.value, self:removeLoop(k, node.right)) end; + end; + end; +end +__haxe_ds_BalancedTree.prototype.keysLoop = function(self,node,acc) + if (node ~= nil) then + self:keysLoop(node.left, acc); + acc:push(node.key); + self:keysLoop(node.right, acc); + end; +end +__haxe_ds_BalancedTree.prototype.merge = function(self,t1,t2) + if (t1 == nil) then + do return t2 end; + end; + if (t2 == nil) then + do return t1 end; + end; + local t = self:minBinding(t2); + do return self:balance(t1, t.key, t.value, self:removeMinBinding(t2)) end +end +__haxe_ds_BalancedTree.prototype.minBinding = function(self,t) + if (t == nil) then + _G.error(__haxe_Exception.thrown("Not_found"),0); + else + if (t.left == nil) then + do return t end; + else + do return self:minBinding(t.left) end; + end; + end; +end +__haxe_ds_BalancedTree.prototype.removeMinBinding = function(self,t) + if (t.left == nil) then + do return t.right end; + else + do return self:balance(self:removeMinBinding(t.left), t.key, t.value, t.right) end; + end; +end +__haxe_ds_BalancedTree.prototype.balance = function(self,l,k,v,r) + local hl = (function() + local _hx_1 + if (l == nil) then + _hx_1 = 0; else + _hx_1 = l._height; end + return _hx_1 + end )(); + local hr = (function() + local _hx_2 + if (r == nil) then + _hx_2 = 0; else + _hx_2 = r._height; end + return _hx_2 + end )(); + if (hl > (hr + 2)) then + local _this = l.left; + local _this1 = l.right; + if ((function() + local _hx_3 + if (_this == nil) then + _hx_3 = 0; else + _hx_3 = _this._height; end + return _hx_3 + end )() >= (function() + local _hx_4 + if (_this1 == nil) then + _hx_4 = 0; else + _hx_4 = _this1._height; end + return _hx_4 + end )()) then + do return __haxe_ds_TreeNode.new(l.left, l.key, l.value, __haxe_ds_TreeNode.new(l.right, k, v, r)) end; + else + do return __haxe_ds_TreeNode.new(__haxe_ds_TreeNode.new(l.left, l.key, l.value, l.right.left), l.right.key, l.right.value, __haxe_ds_TreeNode.new(l.right.right, k, v, r)) end; + end; + else + if (hr > (hl + 2)) then + local _this = r.right; + local _this1 = r.left; + if ((function() + local _hx_5 + if (_this == nil) then + _hx_5 = 0; else + _hx_5 = _this._height; end + return _hx_5 + end )() > (function() + local _hx_6 + if (_this1 == nil) then + _hx_6 = 0; else + _hx_6 = _this1._height; end + return _hx_6 + end )()) then + do return __haxe_ds_TreeNode.new(__haxe_ds_TreeNode.new(l, k, v, r.left), r.key, r.value, r.right) end; + else + do return __haxe_ds_TreeNode.new(__haxe_ds_TreeNode.new(l, k, v, r.left.left), r.left.key, r.left.value, __haxe_ds_TreeNode.new(r.left.right, r.key, r.value, r.right)) end; + end; + else + do return __haxe_ds_TreeNode.new(l, k, v, r, (function() + local _hx_7 + if (hl > hr) then + _hx_7 = hl; else + _hx_7 = hr; end + return _hx_7 + end )() + 1) end; + end; + end; +end +__haxe_ds_BalancedTree.prototype.compare = function(self,k1,k2) + do return Reflect.compare(k1, k2) end +end +__haxe_ds_BalancedTree.prototype.toString = function(self) + if (self.root == nil) then + do return "{}" end; + else + do return Std.string(Std.string("{") .. Std.string(self.root:toString())) .. Std.string("}") end; + end; +end +__haxe_ds_BalancedTree.prototype.clear = function(self) + self.root = nil; +end + +__haxe_ds_BalancedTree.prototype.__class__ = __haxe_ds_BalancedTree + +__haxe_ds_TreeNode.new = function(l,k,v,r,h) + local self = _hx_new(__haxe_ds_TreeNode.prototype) + __haxe_ds_TreeNode.super(self,l,k,v,r,h) + return self +end +__haxe_ds_TreeNode.super = function(self,l,k,v,r,h) + if (h == nil) then + h = -1; + end; + self.left = l; + self.key = k; + self.value = v; + self.right = r; + if (h == -1) then + local tmp; + local _this = self.left; + local _this1 = self.right; + if ((function() + local _hx_1 + if (_this == nil) then + _hx_1 = 0; else + _hx_1 = _this._height; end + return _hx_1 + end )() > (function() + local _hx_2 + if (_this1 == nil) then + _hx_2 = 0; else + _hx_2 = _this1._height; end + return _hx_2 + end )()) then + local _this = self.left; + tmp = (function() + local _hx_3 + if (_this == nil) then + _hx_3 = 0; else + _hx_3 = _this._height; end + return _hx_3 + end )(); + else + local _this = self.right; + tmp = (function() + local _hx_4 + if (_this == nil) then + _hx_4 = 0; else + _hx_4 = _this._height; end + return _hx_4 + end )(); + end; + self._height = tmp + 1; + else + self._height = h; + end; +end +_hxClasses["haxe.ds.TreeNode"] = __haxe_ds_TreeNode +__haxe_ds_TreeNode.__name__ = "haxe.ds.TreeNode" +__haxe_ds_TreeNode.prototype = _hx_e(); +__haxe_ds_TreeNode.prototype.left= nil; +__haxe_ds_TreeNode.prototype.right= nil; +__haxe_ds_TreeNode.prototype.key= nil; +__haxe_ds_TreeNode.prototype.value= nil; +__haxe_ds_TreeNode.prototype._height= nil; +__haxe_ds_TreeNode.prototype.toString = function(self) + do return Std.string(Std.string(((function() + local _hx_1 + if (self.left == nil) then + _hx_1 = ""; else + _hx_1 = Std.string(self.left:toString()) .. Std.string(", "); end + return _hx_1 + end )())) .. Std.string((Std.string(Std.string(Std.string("") .. Std.string(Std.string(self.key))) .. Std.string("=")) .. Std.string(Std.string(self.value))))) .. Std.string(((function() + local _hx_2 + if (self.right == nil) then + _hx_2 = ""; else + _hx_2 = Std.string(", ") .. Std.string(self.right:toString()); end + return _hx_2 + end )())) end +end + +__haxe_ds_TreeNode.prototype.__class__ = __haxe_ds_TreeNode + +__haxe_ds_EnumValueMap.new = function() + local self = _hx_new(__haxe_ds_EnumValueMap.prototype) + __haxe_ds_EnumValueMap.super(self) + return self +end +__haxe_ds_EnumValueMap.super = function(self) + __haxe_ds_BalancedTree.super(self); +end +_hxClasses["haxe.ds.EnumValueMap"] = __haxe_ds_EnumValueMap +__haxe_ds_EnumValueMap.__name__ = "haxe.ds.EnumValueMap" +__haxe_ds_EnumValueMap.__interfaces__ = {__haxe_IMap} +__haxe_ds_EnumValueMap.prototype = _hx_e(); +__haxe_ds_EnumValueMap.prototype.compare = function(self,k1,k2) + local d = k1[1] - k2[1]; + if (d ~= 0) then + do return d end; + end; + local p1 = k1:slice(2); + local p2 = k2:slice(2); + if ((p1.length == 0) and (p2.length == 0)) then + do return 0 end; + end; + do return self:compareArgs(p1, p2) end +end +__haxe_ds_EnumValueMap.prototype.compareArgs = function(self,a1,a2) + local ld = a1.length - a2.length; + if (ld ~= 0) then + do return ld end; + end; + local _g = 0; + local _g1 = a1.length; + while (_g < _g1) do + _g = _g + 1; + local i = _g - 1; + local d = self:compareArg(a1[i], a2[i]); + if (d ~= 0) then + do return d end; + end; + end; + do return 0 end +end +__haxe_ds_EnumValueMap.prototype.compareArg = function(self,v1,v2) + if (Reflect.isEnumValue(v1) and Reflect.isEnumValue(v2)) then + do return self:compare(v1, v2) end; + else + if (__lua_Boot.__instanceof(v1, Array) and __lua_Boot.__instanceof(v2, Array)) then + do return self:compareArgs(v1, v2) end; + else + do return Reflect.compare(v1, v2) end; + end; + end; +end +__haxe_ds_EnumValueMap.prototype.copy = function(self) + local copied = __haxe_ds_EnumValueMap.new(); + copied.root = self.root; + do return copied end +end + +__haxe_ds_EnumValueMap.prototype.__class__ = __haxe_ds_EnumValueMap +__haxe_ds_EnumValueMap.__super__ = __haxe_ds_BalancedTree +setmetatable(__haxe_ds_EnumValueMap.prototype,{__index=__haxe_ds_BalancedTree.prototype}) + +__haxe_ds__HashMap_HashMap_Impl_.new = {} +_hxClasses["haxe.ds._HashMap.HashMap_Impl_"] = __haxe_ds__HashMap_HashMap_Impl_ +__haxe_ds__HashMap_HashMap_Impl_.__name__ = "haxe.ds._HashMap.HashMap_Impl_" +__haxe_ds__HashMap_HashMap_Impl_._new = function() + local this1 = __haxe_ds__HashMap_HashMapData.new(); + do return this1 end; +end +__haxe_ds__HashMap_HashMap_Impl_.set = function(this1,k,v) + local _this = this1.keys; + local key = k:hashCode(); + if (k == nil) then + _this.h[key] = __haxe_ds_IntMap.tnull; + else + _this.h[key] = k; + end; + local _this = this1.values; + local key = k:hashCode(); + if (v == nil) then + _this.h[key] = __haxe_ds_IntMap.tnull; + else + _this.h[key] = v; + end; +end +__haxe_ds__HashMap_HashMap_Impl_.get = function(this1,k) + local _this = this1.values; + local key = k:hashCode(); + local ret = _this.h[key]; + if (ret == __haxe_ds_IntMap.tnull) then + ret = nil; + end; + do return ret end; +end +__haxe_ds__HashMap_HashMap_Impl_.exists = function(this1,k) + local _this = this1.values; + local key = k:hashCode(); + do return _this.h[key] ~= nil end; +end +__haxe_ds__HashMap_HashMap_Impl_.remove = function(this1,k) + this1.values:remove(k:hashCode()); + do return this1.keys:remove(k:hashCode()) end; +end +__haxe_ds__HashMap_HashMap_Impl_.keys = function(this1) + do return this1.keys:iterator() end; +end +__haxe_ds__HashMap_HashMap_Impl_.copy = function(this1) + local copied = __haxe_ds__HashMap_HashMapData.new(); + copied.keys = this1.keys:copy(); + copied.values = this1.values:copy(); + do return copied end; +end +__haxe_ds__HashMap_HashMap_Impl_.iterator = function(this1) + do return this1.values:iterator() end; +end +__haxe_ds__HashMap_HashMap_Impl_.keyValueIterator = function(this1) + do return __haxe_iterators_HashMapKeyValueIterator.new(this1) end; +end +__haxe_ds__HashMap_HashMap_Impl_.clear = function(this1) + this1.keys.h = ({}); + this1.values.h = ({}); +end + +__haxe_ds__HashMap_HashMapData.new = function() + local self = _hx_new(__haxe_ds__HashMap_HashMapData.prototype) + __haxe_ds__HashMap_HashMapData.super(self) + return self +end +__haxe_ds__HashMap_HashMapData.super = function(self) + self.keys = __haxe_ds_IntMap.new(); + self.values = __haxe_ds_IntMap.new(); +end +_hxClasses["haxe.ds._HashMap.HashMapData"] = __haxe_ds__HashMap_HashMapData +__haxe_ds__HashMap_HashMapData.__name__ = "haxe.ds._HashMap.HashMapData" +__haxe_ds__HashMap_HashMapData.prototype = _hx_e(); +__haxe_ds__HashMap_HashMapData.prototype.keys= nil; +__haxe_ds__HashMap_HashMapData.prototype.values= nil; + +__haxe_ds__HashMap_HashMapData.prototype.__class__ = __haxe_ds__HashMap_HashMapData + +__haxe_ds_IntMap.new = function() + local self = _hx_new(__haxe_ds_IntMap.prototype) + __haxe_ds_IntMap.super(self) + return self +end +__haxe_ds_IntMap.super = function(self) + self.h = ({}); +end +_hxClasses["haxe.ds.IntMap"] = __haxe_ds_IntMap +__haxe_ds_IntMap.__name__ = "haxe.ds.IntMap" +__haxe_ds_IntMap.__interfaces__ = {__haxe_IMap} +__haxe_ds_IntMap.prototype = _hx_e(); +__haxe_ds_IntMap.prototype.h= nil; +__haxe_ds_IntMap.prototype.set = function(self,key,value) + if (value == nil) then + self.h[key] = __haxe_ds_IntMap.tnull; + else + self.h[key] = value; + end; +end +__haxe_ds_IntMap.prototype.get = function(self,key) + local ret = self.h[key]; + if (ret == __haxe_ds_IntMap.tnull) then + ret = nil; + end; + do return ret end +end +__haxe_ds_IntMap.prototype.exists = function(self,key) + do return self.h[key] ~= nil end +end +__haxe_ds_IntMap.prototype.remove = function(self,key) + if (self.h[key] == nil) then + do return false end; + else + self.h[key] = nil; + do return true end; + end; +end +__haxe_ds_IntMap.prototype.keys = function(self) + local _gthis = self; + local next = _G.next; + local cur = next(self.h, nil); + do return _hx_o({__fields__={next=true,hasNext=true},next=function(self) + local ret = cur; + cur = next(_gthis.h, cur); + do return ret end; + end,hasNext=function(self) + do return cur ~= nil end; + end}) end +end +__haxe_ds_IntMap.prototype.iterator = function(self) + local _gthis = self; + local it = self:keys(); + do return _hx_o({__fields__={hasNext=true,next=true},hasNext=function(self) + do return it:hasNext() end; + end,next=function(self) + do return _gthis.h[it:next()] end; + end}) end +end +__haxe_ds_IntMap.prototype.keyValueIterator = function(self) + do return __haxe_iterators_MapKeyValueIterator.new(self) end +end +__haxe_ds_IntMap.prototype.copy = function(self) + local copied = __haxe_ds_IntMap.new(); + local key = self:keys(); + while (key:hasNext()) do + local key = key:next(); + local ret = self.h[key]; + if (ret == __haxe_ds_IntMap.tnull) then + ret = nil; + end; + local value = ret; + if (value == nil) then + copied.h[key] = __haxe_ds_IntMap.tnull; + else + copied.h[key] = value; + end; + end; + do return copied end +end +__haxe_ds_IntMap.prototype.toString = function(self) + local s_b = ({}); + local s_length = 0; + local str = "{"; + _G.table.insert(s_b, str); + s_length = s_length + __lua_lib_luautf8_Utf8.len(str); + local it = self:keys(); + local i = it; + while (i:hasNext()) do + local i = i:next(); + local str = Std.string(i); + _G.table.insert(s_b, str); + s_length = s_length + __lua_lib_luautf8_Utf8.len(str); + local str = " => "; + _G.table.insert(s_b, str); + s_length = s_length + __lua_lib_luautf8_Utf8.len(str); + local ret = self.h[i]; + if (ret == __haxe_ds_IntMap.tnull) then + ret = nil; + end; + local str = Std.string(ret); + _G.table.insert(s_b, str); + s_length = s_length + __lua_lib_luautf8_Utf8.len(str); + if (it:hasNext()) then + local str = ", "; + _G.table.insert(s_b, str); + s_length = s_length + __lua_lib_luautf8_Utf8.len(str); + end; + end; + local str = "}"; + _G.table.insert(s_b, str); + s_length = s_length + __lua_lib_luautf8_Utf8.len(str); + do return _G.table.concat(s_b) end +end +__haxe_ds_IntMap.prototype.clear = function(self) + self.h = ({}); +end + +__haxe_ds_IntMap.prototype.__class__ = __haxe_ds_IntMap + +__haxe_ds_List.new = function() + local self = _hx_new(__haxe_ds_List.prototype) + __haxe_ds_List.super(self) + return self +end +__haxe_ds_List.super = function(self) + self.length = 0; +end +_hxClasses["haxe.ds.List"] = __haxe_ds_List +__haxe_ds_List.__name__ = "haxe.ds.List" +__haxe_ds_List.prototype = _hx_e(); +__haxe_ds_List.prototype.h= nil; +__haxe_ds_List.prototype.q= nil; +__haxe_ds_List.prototype.length= nil; +__haxe_ds_List.prototype.add = function(self,item) + local next = nil; + local x = __haxe_ds__List_ListNode.new(item, next); + if (self.h == nil) then + self.h = x; + else + self.q.next = x; + end; + self.q = x; + self.length = self.length + 1; +end +__haxe_ds_List.prototype.push = function(self,item) + local x = __haxe_ds__List_ListNode.new(item, self.h); + self.h = x; + if (self.q == nil) then + self.q = x; + end; + self.length = self.length + 1; +end +__haxe_ds_List.prototype.first = function(self) + if (self.h == nil) then + do return nil end; + else + do return self.h.item end; + end; +end +__haxe_ds_List.prototype.last = function(self) + if (self.q == nil) then + do return nil end; + else + do return self.q.item end; + end; +end +__haxe_ds_List.prototype.pop = function(self) + if (self.h == nil) then + do return nil end; + end; + local x = self.h.item; + self.h = self.h.next; + if (self.h == nil) then + self.q = nil; + end; + self.length = self.length - 1; + do return x end +end +__haxe_ds_List.prototype.isEmpty = function(self) + do return self.h == nil end +end +__haxe_ds_List.prototype.clear = function(self) + self.h = nil; + self.q = nil; + self.length = 0; +end +__haxe_ds_List.prototype.remove = function(self,v) + local prev = nil; + local l = self.h; + while (l ~= nil) do + if (l.item == v) then + if (prev == nil) then + self.h = l.next; + else + prev.next = l.next; + end; + if (self.q == l) then + self.q = prev; + end; + self.length = self.length - 1; + do return true end; + end; + prev = l; + l = l.next; + end; + do return false end +end +__haxe_ds_List.prototype.iterator = function(self) + do return __haxe_ds__List_ListIterator.new(self.h) end +end +__haxe_ds_List.prototype.keyValueIterator = function(self) + do return __haxe_ds__List_ListKeyValueIterator.new(self.h) end +end +__haxe_ds_List.prototype.toString = function(self) + local s_b = ({}); + local s_length = 0; + local first = true; + local l = self.h; + local str = "{"; + _G.table.insert(s_b, str); + s_length = s_length + __lua_lib_luautf8_Utf8.len(str); + while (l ~= nil) do + if (first) then + first = false; + else + local str = ", "; + _G.table.insert(s_b, str); + s_length = s_length + __lua_lib_luautf8_Utf8.len(str); + end; + local str = Std.string(l.item); + _G.table.insert(s_b, str); + s_length = s_length + __lua_lib_luautf8_Utf8.len(str); + l = l.next; + end; + local str = "}"; + _G.table.insert(s_b, str); + s_length = s_length + __lua_lib_luautf8_Utf8.len(str); + do return _G.table.concat(s_b) end +end +__haxe_ds_List.prototype.join = function(self,sep) + local s_b = ({}); + local s_length = 0; + local first = true; + local l = self.h; + while (l ~= nil) do + if (first) then + first = false; + else + local str = Std.string(sep); + _G.table.insert(s_b, str); + s_length = s_length + __lua_lib_luautf8_Utf8.len(str); + end; + local str = Std.string(l.item); + _G.table.insert(s_b, str); + s_length = s_length + __lua_lib_luautf8_Utf8.len(str); + l = l.next; + end; + do return _G.table.concat(s_b) end +end +__haxe_ds_List.prototype.filter = function(self,f) + local l2 = __haxe_ds_List.new(); + local l = self.h; + while (l ~= nil) do + local v = l.item; + l = l.next; + if (f(v)) then + l2:add(v); + end; + end; + do return l2 end +end +__haxe_ds_List.prototype.map = function(self,f) + local b = __haxe_ds_List.new(); + local l = self.h; + while (l ~= nil) do + local v = l.item; + l = l.next; + b:add(f(v)); + end; + do return b end +end + +__haxe_ds_List.prototype.__class__ = __haxe_ds_List + +__haxe_ds__List_ListNode.new = function(item,next) + local self = _hx_new(__haxe_ds__List_ListNode.prototype) + __haxe_ds__List_ListNode.super(self,item,next) + return self +end +__haxe_ds__List_ListNode.super = function(self,item,next) + self.item = item; + self.next = next; +end +_hxClasses["haxe.ds._List.ListNode"] = __haxe_ds__List_ListNode +__haxe_ds__List_ListNode.__name__ = "haxe.ds._List.ListNode" +__haxe_ds__List_ListNode.prototype = _hx_e(); +__haxe_ds__List_ListNode.prototype.item= nil; +__haxe_ds__List_ListNode.prototype.next= nil; + +__haxe_ds__List_ListNode.prototype.__class__ = __haxe_ds__List_ListNode + +__haxe_ds__List_ListIterator.new = function(head) + local self = _hx_new(__haxe_ds__List_ListIterator.prototype) + __haxe_ds__List_ListIterator.super(self,head) + return self +end +__haxe_ds__List_ListIterator.super = function(self,head) + self.head = head; +end +_hxClasses["haxe.ds._List.ListIterator"] = __haxe_ds__List_ListIterator +__haxe_ds__List_ListIterator.__name__ = "haxe.ds._List.ListIterator" +__haxe_ds__List_ListIterator.prototype = _hx_e(); +__haxe_ds__List_ListIterator.prototype.head= nil; +__haxe_ds__List_ListIterator.prototype.hasNext = function(self) + do return self.head ~= nil end +end +__haxe_ds__List_ListIterator.prototype.next = function(self) + local val = self.head.item; + self.head = self.head.next; + do return val end +end + +__haxe_ds__List_ListIterator.prototype.__class__ = __haxe_ds__List_ListIterator + +__haxe_ds__List_ListKeyValueIterator.new = function(head) + local self = _hx_new(__haxe_ds__List_ListKeyValueIterator.prototype) + __haxe_ds__List_ListKeyValueIterator.super(self,head) + return self +end +__haxe_ds__List_ListKeyValueIterator.super = function(self,head) + self.head = head; + self.idx = 0; +end +_hxClasses["haxe.ds._List.ListKeyValueIterator"] = __haxe_ds__List_ListKeyValueIterator +__haxe_ds__List_ListKeyValueIterator.__name__ = "haxe.ds._List.ListKeyValueIterator" +__haxe_ds__List_ListKeyValueIterator.prototype = _hx_e(); +__haxe_ds__List_ListKeyValueIterator.prototype.idx= nil; +__haxe_ds__List_ListKeyValueIterator.prototype.head= nil; +__haxe_ds__List_ListKeyValueIterator.prototype.hasNext = function(self) + do return self.head ~= nil end +end +__haxe_ds__List_ListKeyValueIterator.prototype.next = function(self) + local val = self.head.item; + self.head = self.head.next; + do return _hx_o({__fields__={value=true,key=true},value=val,key=(function() + local _hx_obj = self; + local _hx_fld = 'idx'; + local _ = _hx_obj[_hx_fld]; + _hx_obj[_hx_fld] = _hx_obj[_hx_fld] + 1; + return _; + end)()}) end +end + +__haxe_ds__List_ListKeyValueIterator.prototype.__class__ = __haxe_ds__List_ListKeyValueIterator + +__haxe_ds__Map_Map_Impl_.new = {} +_hxClasses["haxe.ds._Map.Map_Impl_"] = __haxe_ds__Map_Map_Impl_ +__haxe_ds__Map_Map_Impl_.__name__ = "haxe.ds._Map.Map_Impl_" +__haxe_ds__Map_Map_Impl_.set = function(this1,key,value) + this1:set(key, value); +end +__haxe_ds__Map_Map_Impl_.get = function(this1,key) + do return this1:get(key) end; +end +__haxe_ds__Map_Map_Impl_.exists = function(this1,key) + do return this1:exists(key) end; +end +__haxe_ds__Map_Map_Impl_.remove = function(this1,key) + do return this1:remove(key) end; +end +__haxe_ds__Map_Map_Impl_.keys = function(this1) + do return this1:keys() end; +end +__haxe_ds__Map_Map_Impl_.iterator = function(this1) + do return this1:iterator() end; +end +__haxe_ds__Map_Map_Impl_.keyValueIterator = function(this1) + do return this1:keyValueIterator() end; +end +__haxe_ds__Map_Map_Impl_.copy = function(this1) + do return this1:copy() end; +end +__haxe_ds__Map_Map_Impl_.toString = function(this1) + do return this1:toString() end; +end +__haxe_ds__Map_Map_Impl_.clear = function(this1) + this1:clear(); +end +__haxe_ds__Map_Map_Impl_.arrayWrite = function(this1,k,v) + this1:set(k, v); + do return v end; +end +__haxe_ds__Map_Map_Impl_.toStringMap = function(t) + do return __haxe_ds_StringMap.new() end; +end +__haxe_ds__Map_Map_Impl_.toIntMap = function(t) + do return __haxe_ds_IntMap.new() end; +end +__haxe_ds__Map_Map_Impl_.toEnumValueMapMap = function(t) + do return __haxe_ds_EnumValueMap.new() end; +end +__haxe_ds__Map_Map_Impl_.toObjectMap = function(t) + do return __haxe_ds_ObjectMap.new() end; +end +__haxe_ds__Map_Map_Impl_.fromStringMap = function(map) + do return map end; +end +__haxe_ds__Map_Map_Impl_.fromIntMap = function(map) + do return map end; +end +__haxe_ds__Map_Map_Impl_.fromObjectMap = function(map) + do return map end; +end + +__haxe_ds_ObjectMap.new = function() + local self = _hx_new(__haxe_ds_ObjectMap.prototype) + __haxe_ds_ObjectMap.super(self) + return self +end +__haxe_ds_ObjectMap.super = function(self) + self.h = ({}); + self.k = ({}); +end +_hxClasses["haxe.ds.ObjectMap"] = __haxe_ds_ObjectMap +__haxe_ds_ObjectMap.__name__ = "haxe.ds.ObjectMap" +__haxe_ds_ObjectMap.__interfaces__ = {__haxe_IMap} +__haxe_ds_ObjectMap.assignId = function(obj) + obj.__id__ = (function() + local _hx_obj = __haxe_ds_ObjectMap; + local _hx_fld = 'count'; + _hx_obj[_hx_fld] = _hx_obj[_hx_fld] + 1; + return _hx_obj[_hx_fld]; + end)() do return obj.__id__ end; +end +__haxe_ds_ObjectMap.getId = function(obj) + do return obj.__id__ end; +end +__haxe_ds_ObjectMap.prototype = _hx_e(); +__haxe_ds_ObjectMap.prototype.h= nil; +__haxe_ds_ObjectMap.prototype.k= nil; +__haxe_ds_ObjectMap.prototype.set = function(self,key,value) + self.h[key] = value; + self.k[key] = true; +end +__haxe_ds_ObjectMap.prototype.get = function(self,key) + do return self.h[key] end +end +__haxe_ds_ObjectMap.prototype.exists = function(self,key) + do return self.k[key] ~= nil end +end +__haxe_ds_ObjectMap.prototype.remove = function(self,key) + if (self.k[key] == nil) then + do return false end; + end; + self.k[key] = nil; + self.h[key] = nil; + do return true end +end +__haxe_ds_ObjectMap.prototype.keys = function(self) + local _gthis = self; + local cur = next(self.h, nil); + do return _hx_o({__fields__={next=true,hasNext=true},next=function(self) + local ret = cur; + cur = next(_gthis.k, cur); + do return ret end; + end,hasNext=function(self) + do return cur ~= nil end; + end}) end +end +__haxe_ds_ObjectMap.prototype.iterator = function(self) + local _gthis = self; + local itr = self:keys(); + do return _hx_o({__fields__={hasNext=true,next=true},hasNext=function(_,...) return _hx_bind(itr,itr.hasNext)(...) end,next=function(self) + do return _gthis.h[itr:next()] end; + end}) end +end +__haxe_ds_ObjectMap.prototype.keyValueIterator = function(self) + do return __haxe_iterators_MapKeyValueIterator.new(self) end +end +__haxe_ds_ObjectMap.prototype.copy = function(self) + local copied = __haxe_ds_ObjectMap.new(); + local key = self:keys(); + while (key:hasNext()) do + local key = key:next(); + copied.h[key] = self.h[key]; + copied.k[key] = true; + end; + do return copied end +end +__haxe_ds_ObjectMap.prototype.toString = function(self) + local s_b = ({}); + local s_length = 0; + local str = "{"; + _G.table.insert(s_b, str); + s_length = s_length + __lua_lib_luautf8_Utf8.len(str); + local it = self:keys(); + local i = it; + while (i:hasNext()) do + local i = i:next(); + local str = Std.string(i); + _G.table.insert(s_b, str); + s_length = s_length + __lua_lib_luautf8_Utf8.len(str); + local str = " => "; + _G.table.insert(s_b, str); + s_length = s_length + __lua_lib_luautf8_Utf8.len(str); + local str = Std.string(self.h[i]); + _G.table.insert(s_b, str); + s_length = s_length + __lua_lib_luautf8_Utf8.len(str); + if (it:hasNext()) then + local str = ", "; + _G.table.insert(s_b, str); + s_length = s_length + __lua_lib_luautf8_Utf8.len(str); + end; + end; + local str = "}"; + _G.table.insert(s_b, str); + s_length = s_length + __lua_lib_luautf8_Utf8.len(str); + do return _G.table.concat(s_b) end +end +__haxe_ds_ObjectMap.prototype.clear = function(self) + self.h = ({}); + self.k = ({}); +end + +__haxe_ds_ObjectMap.prototype.__class__ = __haxe_ds_ObjectMap + +__haxe_ds__ReadOnlyArray_ReadOnlyArray_Impl_.new = {} +_hxClasses["haxe.ds._ReadOnlyArray.ReadOnlyArray_Impl_"] = __haxe_ds__ReadOnlyArray_ReadOnlyArray_Impl_ +__haxe_ds__ReadOnlyArray_ReadOnlyArray_Impl_.__name__ = "haxe.ds._ReadOnlyArray.ReadOnlyArray_Impl_" +__haxe_ds__ReadOnlyArray_ReadOnlyArray_Impl_.__properties__ = {get_length="get_length"} +__haxe_ds__ReadOnlyArray_ReadOnlyArray_Impl_.get_length = function(this1) + do return this1.length end; +end +__haxe_ds__ReadOnlyArray_ReadOnlyArray_Impl_.get = function(this1,i) + do return this1[i] end; +end +__haxe_ds__ReadOnlyArray_ReadOnlyArray_Impl_.concat = function(this1,a) + do return this1:concat(a) end; +end + +__haxe_ds_StringMap.new = function() + local self = _hx_new(__haxe_ds_StringMap.prototype) + __haxe_ds_StringMap.super(self) + return self +end +__haxe_ds_StringMap.super = function(self) + self.h = ({}); +end +_hxClasses["haxe.ds.StringMap"] = __haxe_ds_StringMap +__haxe_ds_StringMap.__name__ = "haxe.ds.StringMap" +__haxe_ds_StringMap.__interfaces__ = {__haxe_IMap} +__haxe_ds_StringMap.prototype = _hx_e(); +__haxe_ds_StringMap.prototype.h= nil; +__haxe_ds_StringMap.prototype.set = function(self,key,value) + if (value == nil) then + self.h[key] = __haxe_ds_StringMap.tnull; + else + self.h[key] = value; + end; +end +__haxe_ds_StringMap.prototype.get = function(self,key) + local ret = self.h[key]; + if (ret == __haxe_ds_StringMap.tnull) then + ret = nil; + end; + do return ret end +end +__haxe_ds_StringMap.prototype.exists = function(self,key) + do return self.h[key] ~= nil end +end +__haxe_ds_StringMap.prototype.remove = function(self,key) + if (self.h[key] == nil) then + do return false end; + else + self.h[key] = nil; + do return true end; + end; +end +__haxe_ds_StringMap.prototype.keys = function(self) + local _gthis = self; + local next = _G.next; + local cur = next(self.h, nil); + do return _hx_o({__fields__={next=true,hasNext=true},next=function(self) + local ret = cur; + cur = next(_gthis.h, cur); + do return ret end; + end,hasNext=function(self) + do return cur ~= nil end; + end}) end +end +__haxe_ds_StringMap.prototype.iterator = function(self) + local _gthis = self; + local it = self:keys(); + do return _hx_o({__fields__={hasNext=true,next=true},hasNext=function(self) + do return it:hasNext() end; + end,next=function(self) + do return _gthis.h[it:next()] end; + end}) end +end +__haxe_ds_StringMap.prototype.keyValueIterator = function(self) + do return __haxe_iterators_MapKeyValueIterator.new(self) end +end +__haxe_ds_StringMap.prototype.copy = function(self) + local copied = __haxe_ds_StringMap.new(); + local key = self:keys(); + while (key:hasNext()) do + local key = key:next(); + local ret = self.h[key]; + if (ret == __haxe_ds_StringMap.tnull) then + ret = nil; + end; + local value = ret; + if (value == nil) then + copied.h[key] = __haxe_ds_StringMap.tnull; + else + copied.h[key] = value; + end; + end; + do return copied end +end +__haxe_ds_StringMap.prototype.toString = function(self) + local s_b = ({}); + local s_length = 0; + local str = "{"; + _G.table.insert(s_b, str); + s_length = s_length + __lua_lib_luautf8_Utf8.len(str); + local it = self:keys(); + local i = it; + while (i:hasNext()) do + local i = i:next(); + local str = Std.string(i); + _G.table.insert(s_b, str); + s_length = s_length + __lua_lib_luautf8_Utf8.len(str); + local str = " => "; + _G.table.insert(s_b, str); + s_length = s_length + __lua_lib_luautf8_Utf8.len(str); + local ret = self.h[i]; + if (ret == __haxe_ds_StringMap.tnull) then + ret = nil; + end; + local str = Std.string(ret); + _G.table.insert(s_b, str); + s_length = s_length + __lua_lib_luautf8_Utf8.len(str); + if (it:hasNext()) then + local str = ", "; + _G.table.insert(s_b, str); + s_length = s_length + __lua_lib_luautf8_Utf8.len(str); + end; + end; + local str = "}"; + _G.table.insert(s_b, str); + s_length = s_length + __lua_lib_luautf8_Utf8.len(str); + do return _G.table.concat(s_b) end +end +__haxe_ds_StringMap.prototype.clear = function(self) + self.h = ({}); +end + +__haxe_ds_StringMap.prototype.__class__ = __haxe_ds_StringMap + +__haxe_ds_WeakMap.new = function() + local self = _hx_new(__haxe_ds_WeakMap.prototype) + __haxe_ds_WeakMap.super(self) + return self +end +__haxe_ds_WeakMap.super = function(self) + _G.error(__haxe_exceptions_NotImplementedException.new("Not implemented for this platform", nil, _hx_o({__fields__={fileName=true,lineNumber=true,className=true,methodName=true},fileName="haxe/ds/WeakMap.hx",lineNumber=39,className="haxe.ds.WeakMap",methodName="new"})),0); +end +_hxClasses["haxe.ds.WeakMap"] = __haxe_ds_WeakMap +__haxe_ds_WeakMap.__name__ = "haxe.ds.WeakMap" +__haxe_ds_WeakMap.__interfaces__ = {__haxe_IMap} +__haxe_ds_WeakMap.prototype = _hx_e(); +__haxe_ds_WeakMap.prototype.set = function(self,key,value) +end +__haxe_ds_WeakMap.prototype.get = function(self,key) + do return nil end +end +__haxe_ds_WeakMap.prototype.exists = function(self,key) + do return false end +end +__haxe_ds_WeakMap.prototype.remove = function(self,key) + do return false end +end +__haxe_ds_WeakMap.prototype.keys = function(self) + do return nil end +end +__haxe_ds_WeakMap.prototype.iterator = function(self) + do return nil end +end +__haxe_ds_WeakMap.prototype.keyValueIterator = function(self) + do return nil end +end +__haxe_ds_WeakMap.prototype.copy = function(self) + do return nil end +end +__haxe_ds_WeakMap.prototype.toString = function(self) + do return nil end +end +__haxe_ds_WeakMap.prototype.clear = function(self) +end + +__haxe_ds_WeakMap.prototype.__class__ = __haxe_ds_WeakMap + +__haxe_exceptions_PosException.new = function(message,previous,pos) + local self = _hx_new(__haxe_exceptions_PosException.prototype) + __haxe_exceptions_PosException.super(self,message,previous,pos) + return self +end +__haxe_exceptions_PosException.super = function(self,message,previous,pos) + __haxe_Exception.super(self,message,previous); + if (pos == nil) then + self.posInfos = _hx_o({__fields__={fileName=true,lineNumber=true,className=true,methodName=true},fileName="(unknown)",lineNumber=0,className="(unknown)",methodName="(unknown)"}); + else + self.posInfos = pos; + end; + self.__skipStack = self.__skipStack + 1; +end +_hxClasses["haxe.exceptions.PosException"] = __haxe_exceptions_PosException +__haxe_exceptions_PosException.__name__ = "haxe.exceptions.PosException" +__haxe_exceptions_PosException.prototype = _hx_e(); +__haxe_exceptions_PosException.prototype.posInfos= nil; +__haxe_exceptions_PosException.prototype.toString = function(self) + do return Std.string(Std.string(Std.string(Std.string(Std.string(Std.string(Std.string(Std.string(Std.string("") .. Std.string(__haxe_Exception.prototype.toString(self))) .. Std.string(" in ")) .. Std.string(self.posInfos.className)) .. Std.string(".")) .. Std.string(self.posInfos.methodName)) .. Std.string(" at ")) .. Std.string(self.posInfos.fileName)) .. Std.string(":")) .. Std.string(self.posInfos.lineNumber) end +end + +__haxe_exceptions_PosException.prototype.__class__ = __haxe_exceptions_PosException +__haxe_exceptions_PosException.__super__ = __haxe_Exception +setmetatable(__haxe_exceptions_PosException.prototype,{__index=__haxe_Exception.prototype}) +setmetatable(__haxe_exceptions_PosException.prototype.__properties__,{__index=__haxe_Exception.prototype.__properties__}) + +__haxe_exceptions_NotImplementedException.new = function(message,previous,pos) + local self = _hx_new(__haxe_exceptions_NotImplementedException.prototype) + __haxe_exceptions_NotImplementedException.super(self,message,previous,pos) + return self +end +__haxe_exceptions_NotImplementedException.super = function(self,message,previous,pos) + if (message == nil) then + message = "Not implemented"; + end; + __haxe_exceptions_PosException.super(self,message,previous,pos); + self.__skipStack = self.__skipStack + 1; +end +_hxClasses["haxe.exceptions.NotImplementedException"] = __haxe_exceptions_NotImplementedException +__haxe_exceptions_NotImplementedException.__name__ = "haxe.exceptions.NotImplementedException" +__haxe_exceptions_NotImplementedException.prototype = _hx_e(); + +__haxe_exceptions_NotImplementedException.prototype.__class__ = __haxe_exceptions_NotImplementedException +__haxe_exceptions_NotImplementedException.__super__ = __haxe_exceptions_PosException +setmetatable(__haxe_exceptions_NotImplementedException.prototype,{__index=__haxe_exceptions_PosException.prototype}) +setmetatable(__haxe_exceptions_NotImplementedException.prototype.__properties__,{__index=__haxe_exceptions_PosException.prototype.__properties__}) + +__haxe_io_Bytes.new = function(length,b) + local self = _hx_new(__haxe_io_Bytes.prototype) + __haxe_io_Bytes.super(self,length,b) + return self +end +__haxe_io_Bytes.super = function(self,length,b) + self.length = length; + self.b = b; +end +_hxClasses["haxe.io.Bytes"] = __haxe_io_Bytes +__haxe_io_Bytes.__name__ = "haxe.io.Bytes" +__haxe_io_Bytes.alloc = function(length) + local a = Array.new(); + local _g = 0; + local _g1 = length; + while (_g < _g1) do + _g = _g + 1; + local i = _g - 1; + a:push(0); + end; + do return __haxe_io_Bytes.new(length, a) end; +end +__haxe_io_Bytes.ofString = function(s,encoding) + local _g = _hx_tab_array({}, 0); + local _g1 = 0; + local _g2 = _G.string.len(s); + while (_g1 < _g2) do + _g1 = _g1 + 1; + local i = _g1 - 1; + _g:push(_G.string.byte(s, i + 1)); + end; + local bytes = _g; + do return __haxe_io_Bytes.new(bytes.length, bytes) end; +end +__haxe_io_Bytes.ofData = function(b) + do return __haxe_io_Bytes.new(b.length, b) end; +end +__haxe_io_Bytes.ofHex = function(s) + local len = __lua_lib_luautf8_Utf8.len(s); + if ((_hx_bit.band(len,1)) ~= 0) then + _G.error(__haxe_Exception.thrown("Not a hex string (odd number of digits)"),0); + end; + local ret = __haxe_io_Bytes.alloc(_hx_bit.arshift(len,1)); + local _g = 0; + local _g1 = ret.length; + while (_g < _g1) do + _g = _g + 1; + local i = _g - 1; + local high = __lua_lib_luautf8_Utf8.byte(s, (i * 2) + 1); + local low = __lua_lib_luautf8_Utf8.byte(s, ((i * 2) + 1) + 1); + high = (_hx_bit.band(high,15)) + ((_hx_bit.arshift((_hx_bit.band(high,64)),6)) * 9); + low = (_hx_bit.band(low,15)) + ((_hx_bit.arshift((_hx_bit.band(low,64)),6)) * 9); + ret.b[i] = _hx_bit.band(_hx_bit.band((_hx_bit.bor(_hx_bit.lshift(high,4),low)),255),255); + end; + do return ret end; +end +__haxe_io_Bytes.fastGet = function(b,pos) + do return b[pos] end; +end +__haxe_io_Bytes.prototype = _hx_e(); +__haxe_io_Bytes.prototype.length= nil; +__haxe_io_Bytes.prototype.b= nil; +__haxe_io_Bytes.prototype.get = function(self,pos) + do return self.b[pos] end +end +__haxe_io_Bytes.prototype.set = function(self,pos,v) + self.b[pos] = _hx_bit.band(v,255); +end +__haxe_io_Bytes.prototype.blit = function(self,pos,src,srcpos,len) + if (((((pos < 0) or (srcpos < 0)) or (len < 0)) or ((pos + len) > self.length)) or ((srcpos + len) > src.length)) then + _G.error(__haxe_Exception.thrown(__haxe_io_Error.OutsideBounds),0); + end; + local b1 = self.b; + local b2 = src.b; + if ((b1 == b2) and (pos > srcpos)) then + local i = len; + while (i > 0) do + i = i - 1; + b1[i + pos] = b2[i + srcpos]; + end; + do return end; + end; + local _g = 0; + local _g1 = len; + while (_g < _g1) do + _g = _g + 1; + local i = _g - 1; + b1[i + pos] = b2[i + srcpos]; + end; +end +__haxe_io_Bytes.prototype.fill = function(self,pos,len,value) + local _g = 0; + local _g1 = len; + while (_g < _g1) do + _g = _g + 1; + local i = _g - 1; + pos = pos + 1; + self.b[pos - 1] = _hx_bit.band(value,255); + end; +end +__haxe_io_Bytes.prototype.sub = function(self,pos,len) + if (((pos < 0) or (len < 0)) or ((pos + len) > self.length)) then + _G.error(__haxe_Exception.thrown(__haxe_io_Error.OutsideBounds),0); + end; + do return __haxe_io_Bytes.new(len, self.b:slice(pos, pos + len)) end +end +__haxe_io_Bytes.prototype.compare = function(self,other) + local b1 = self.b; + local b2 = other.b; + local len = (function() + local _hx_1 + if (self.length < other.length) then + _hx_1 = self.length; else + _hx_1 = other.length; end + return _hx_1 + end )(); + local _g = 0; + local _g1 = len; + while (_g < _g1) do + _g = _g + 1; + local i = _g - 1; + if (b1[i] ~= b2[i]) then + do return b1[i] - b2[i] end; + end; + end; + do return self.length - other.length end +end +__haxe_io_Bytes.prototype.getDouble = function(self,pos) + local v = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(self.b[pos],_hx_bit.lshift(self.b[pos + 1],8)),_hx_bit.lshift(self.b[pos + 2],16)),_hx_bit.lshift(self.b[pos + 3],24)); + local tmp = _hx_bit_clamp((function() + local _hx_1 + if ((_hx_bit.band(v,-2147483648)) ~= 0) then + _hx_1 = _hx_bit.bor(v,-2147483648); else + _hx_1 = v; end + return _hx_1 + end )()); + local pos = pos + 4; + local v = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(self.b[pos],_hx_bit.lshift(self.b[pos + 1],8)),_hx_bit.lshift(self.b[pos + 2],16)),_hx_bit.lshift(self.b[pos + 3],24)); + do return __haxe_io_FPHelper.i64ToDouble(tmp, _hx_bit_clamp((function() + local _hx_2 + if ((_hx_bit.band(v,-2147483648)) ~= 0) then + _hx_2 = _hx_bit.bor(v,-2147483648); else + _hx_2 = v; end + return _hx_2 + end )())) end +end +__haxe_io_Bytes.prototype.getFloat = function(self,pos) + local v = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(self.b[pos],_hx_bit.lshift(self.b[pos + 1],8)),_hx_bit.lshift(self.b[pos + 2],16)),_hx_bit.lshift(self.b[pos + 3],24)); + do return __haxe_io_FPHelper.i32ToFloat(_hx_bit_clamp((function() + local _hx_1 + if ((_hx_bit.band(v,-2147483648)) ~= 0) then + _hx_1 = _hx_bit.bor(v,-2147483648); else + _hx_1 = v; end + return _hx_1 + end )())) end +end +__haxe_io_Bytes.prototype.setDouble = function(self,pos,v) + local i = __haxe_io_FPHelper.doubleToI64(v); + local v = i.low; + self.b[pos] = _hx_bit.band(v,255); + self.b[pos + 1] = _hx_bit.band(_hx_bit.arshift(v,8),255); + self.b[pos + 2] = _hx_bit.band(_hx_bit.arshift(v,16),255); + self.b[pos + 3] = _hx_bit.band(_hx_bit.rshift(v,24),255); + local pos = pos + 4; + local v = i.high; + self.b[pos] = _hx_bit.band(v,255); + self.b[pos + 1] = _hx_bit.band(_hx_bit.arshift(v,8),255); + self.b[pos + 2] = _hx_bit.band(_hx_bit.arshift(v,16),255); + self.b[pos + 3] = _hx_bit.band(_hx_bit.rshift(v,24),255); +end +__haxe_io_Bytes.prototype.setFloat = function(self,pos,v) + local v = __haxe_io_FPHelper.floatToI32(v); + self.b[pos] = _hx_bit.band(v,255); + self.b[pos + 1] = _hx_bit.band(_hx_bit.arshift(v,8),255); + self.b[pos + 2] = _hx_bit.band(_hx_bit.arshift(v,16),255); + self.b[pos + 3] = _hx_bit.band(_hx_bit.rshift(v,24),255); +end +__haxe_io_Bytes.prototype.getUInt16 = function(self,pos) + do return _hx_bit.bor(self.b[pos],_hx_bit.lshift(self.b[pos + 1],8)) end +end +__haxe_io_Bytes.prototype.setUInt16 = function(self,pos,v) + self.b[pos] = _hx_bit.band(v,255); + self.b[pos + 1] = _hx_bit.band(_hx_bit.arshift(v,8),255); +end +__haxe_io_Bytes.prototype.getInt32 = function(self,pos) + local v = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(self.b[pos],_hx_bit.lshift(self.b[pos + 1],8)),_hx_bit.lshift(self.b[pos + 2],16)),_hx_bit.lshift(self.b[pos + 3],24)); + do return _hx_bit_clamp((function() + local _hx_1 + if ((_hx_bit.band(v,-2147483648)) ~= 0) then + _hx_1 = _hx_bit.bor(v,-2147483648); else + _hx_1 = v; end + return _hx_1 + end )()) end +end +__haxe_io_Bytes.prototype.getInt64 = function(self,pos) + local pos1 = pos + 4; + local v = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(self.b[pos1],_hx_bit.lshift(self.b[pos1 + 1],8)),_hx_bit.lshift(self.b[pos1 + 2],16)),_hx_bit.lshift(self.b[pos1 + 3],24)); + local high = _hx_bit_clamp((function() + local _hx_1 + if ((_hx_bit.band(v,-2147483648)) ~= 0) then + _hx_1 = _hx_bit.bor(v,-2147483648); else + _hx_1 = v; end + return _hx_1 + end )()); + local v = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(self.b[pos],_hx_bit.lshift(self.b[pos + 1],8)),_hx_bit.lshift(self.b[pos + 2],16)),_hx_bit.lshift(self.b[pos + 3],24)); + local this1 = __haxe__Int64____Int64.new(high, _hx_bit_clamp((function() + local _hx_2 + if ((_hx_bit.band(v,-2147483648)) ~= 0) then + _hx_2 = _hx_bit.bor(v,-2147483648); else + _hx_2 = v; end + return _hx_2 + end )())); + do return this1 end +end +__haxe_io_Bytes.prototype.setInt32 = function(self,pos,v) + self.b[pos] = _hx_bit.band(v,255); + self.b[pos + 1] = _hx_bit.band(_hx_bit.arshift(v,8),255); + self.b[pos + 2] = _hx_bit.band(_hx_bit.arshift(v,16),255); + self.b[pos + 3] = _hx_bit.band(_hx_bit.rshift(v,24),255); +end +__haxe_io_Bytes.prototype.setInt64 = function(self,pos,v) + local v1 = v.low; + self.b[pos] = _hx_bit.band(v1,255); + self.b[pos + 1] = _hx_bit.band(_hx_bit.arshift(v1,8),255); + self.b[pos + 2] = _hx_bit.band(_hx_bit.arshift(v1,16),255); + self.b[pos + 3] = _hx_bit.band(_hx_bit.rshift(v1,24),255); + local pos = pos + 4; + local v = v.high; + self.b[pos] = _hx_bit.band(v,255); + self.b[pos + 1] = _hx_bit.band(_hx_bit.arshift(v,8),255); + self.b[pos + 2] = _hx_bit.band(_hx_bit.arshift(v,16),255); + self.b[pos + 3] = _hx_bit.band(_hx_bit.rshift(v,24),255); +end +__haxe_io_Bytes.prototype.getString = function(self,pos,len,encoding) + local tmp = encoding == nil; + if (((pos < 0) or (len < 0)) or ((pos + len) > self.length)) then + _G.error(__haxe_Exception.thrown(__haxe_io_Error.OutsideBounds),0); + end; + if ((self.b.length - pos) <= __lua_Boot.MAXSTACKSIZE) then + local _end = Math.min(self.b.length, pos + len) - 1; + do return _G.string.char(_hx_table.unpack(self.b, pos, _end)) end; + else + local tbl = ({}); + local _g = pos; + local _g1 = pos + len; + while (_g < _g1) do + _g = _g + 1; + local idx = _g - 1; + _G.table.insert(tbl, _G.string.char(self.b[idx])); + end; + do return _G.table.concat(tbl, "") end; + end; +end +__haxe_io_Bytes.prototype.readString = function(self,pos,len) + do return self:getString(pos, len) end +end +__haxe_io_Bytes.prototype.toString = function(self) + do return self:getString(0, self.length) end +end +__haxe_io_Bytes.prototype.toHex = function(self) + local s_b = ({}); + local s_length = 0; + local chars = _hx_tab_array({}, 0); + local str = "0123456789abcdef"; + local _g = 0; + local _g1 = __lua_lib_luautf8_Utf8.len(str); + while (_g < _g1) do + _g = _g + 1; + local i = _g - 1; + chars:push(__lua_lib_luautf8_Utf8.byte(str, i + 1)); + end; + local _g = 0; + local _g1 = self.length; + while (_g < _g1) do + _g = _g + 1; + local i = _g - 1; + local c = self.b[i]; + _G.table.insert(s_b, __lua_lib_luautf8_Utf8.char(chars[_hx_bit.arshift(c,4)])); + s_length = s_length + 1; + _G.table.insert(s_b, __lua_lib_luautf8_Utf8.char(chars[_hx_bit.band(c,15)])); + s_length = s_length + 1; + end; + do return _G.table.concat(s_b) end +end +__haxe_io_Bytes.prototype.getData = function(self) + do return self.b end +end + +__haxe_io_Bytes.prototype.__class__ = __haxe_io_Bytes + +__haxe_io_BytesBuffer.new = function() + local self = _hx_new(__haxe_io_BytesBuffer.prototype) + __haxe_io_BytesBuffer.super(self) + return self +end +__haxe_io_BytesBuffer.super = function(self) + self.b = Array.new(); +end +_hxClasses["haxe.io.BytesBuffer"] = __haxe_io_BytesBuffer +__haxe_io_BytesBuffer.__name__ = "haxe.io.BytesBuffer" +__haxe_io_BytesBuffer.prototype = _hx_e(); +__haxe_io_BytesBuffer.prototype.b= nil; +__haxe_io_BytesBuffer.prototype.get_length = function(self) + do return self.b.length end +end +__haxe_io_BytesBuffer.prototype.addByte = function(self,byte) + self.b:push(byte); +end +__haxe_io_BytesBuffer.prototype.add = function(self,src) + local b1 = self.b; + local b2 = src.b; + local _g = 0; + local _g1 = src.length; + while (_g < _g1) do + _g = _g + 1; + local i = _g - 1; + self.b:push(b2[i]); + end; +end +__haxe_io_BytesBuffer.prototype.addString = function(self,v,encoding) + local src = __haxe_io_Bytes.ofString(v, encoding); + local b1 = self.b; + local b2 = src.b; + local _g = 0; + local _g1 = src.length; + while (_g < _g1) do + _g = _g + 1; + local i = _g - 1; + self.b:push(b2[i]); + end; +end +__haxe_io_BytesBuffer.prototype.addInt32 = function(self,v) + self.b:push(_hx_bit.band(v,255)); + self.b:push(_hx_bit.band(_hx_bit.arshift(v,8),255)); + self.b:push(_hx_bit.band(_hx_bit.arshift(v,16),255)); + self.b:push(_hx_bit.rshift(v,24)); +end +__haxe_io_BytesBuffer.prototype.addInt64 = function(self,v) + self:addInt32(v.low); + self:addInt32(v.high); +end +__haxe_io_BytesBuffer.prototype.addFloat = function(self,v) + self:addInt32(__haxe_io_FPHelper.floatToI32(v)); +end +__haxe_io_BytesBuffer.prototype.addDouble = function(self,v) + self:addInt64(__haxe_io_FPHelper.doubleToI64(v)); +end +__haxe_io_BytesBuffer.prototype.addBytes = function(self,src,pos,len) + if (((pos < 0) or (len < 0)) or ((pos + len) > src.length)) then + _G.error(__haxe_Exception.thrown(__haxe_io_Error.OutsideBounds),0); + end; + local b1 = self.b; + local b2 = src.b; + local _g = pos; + local _g1 = pos + len; + while (_g < _g1) do + _g = _g + 1; + local i = _g - 1; + self.b:push(b2[i]); + end; +end +__haxe_io_BytesBuffer.prototype.getBytes = function(self) + local bytes = __haxe_io_Bytes.new(self.b.length, self.b); + self.b = nil; + do return bytes end +end + +__haxe_io_BytesBuffer.prototype.__class__ = __haxe_io_BytesBuffer + +__haxe_io_BytesBuffer.prototype.__properties__ = {get_length="get_length"} +_hxClasses["haxe.io.Encoding"] = __haxe_io_Encoding; +_hxClasses["haxe.io.Encoding"] = { __ename__ = "haxe.io.Encoding", __constructs__ = _hx_tab_array({[0]="UTF8","RawNative"},2)} +__haxe_io_Encoding = _hxClasses["haxe.io.Encoding"]; +__haxe_io_Encoding.UTF8 = _hx_tab_array({[0]="UTF8",0,__enum__ = __haxe_io_Encoding},2) + +__haxe_io_Encoding.RawNative = _hx_tab_array({[0]="RawNative",1,__enum__ = __haxe_io_Encoding},2) + +__haxe_io_Encoding.__empty_constructs__ = _hx_tab_array({[0] = __haxe_io_Encoding.UTF8,__haxe_io_Encoding.RawNative}, 2) + +__haxe_io_Eof.new = function() + local self = _hx_new(__haxe_io_Eof.prototype) + __haxe_io_Eof.super(self) + return self +end +__haxe_io_Eof.super = function(self) +end +_hxClasses["haxe.io.Eof"] = __haxe_io_Eof +__haxe_io_Eof.__name__ = "haxe.io.Eof" +__haxe_io_Eof.prototype = _hx_e(); +__haxe_io_Eof.prototype.toString = function(self) + do return "Eof" end +end + +__haxe_io_Eof.prototype.__class__ = __haxe_io_Eof +_hxClasses["haxe.io.Error"] = __haxe_io_Error; +_hxClasses["haxe.io.Error"] = { __ename__ = "haxe.io.Error", __constructs__ = _hx_tab_array({[0]="Blocked","Overflow","OutsideBounds","Custom"},4)} +__haxe_io_Error = _hxClasses["haxe.io.Error"]; +__haxe_io_Error.Blocked = _hx_tab_array({[0]="Blocked",0,__enum__ = __haxe_io_Error},2) + +__haxe_io_Error.Overflow = _hx_tab_array({[0]="Overflow",1,__enum__ = __haxe_io_Error},2) + +__haxe_io_Error.OutsideBounds = _hx_tab_array({[0]="OutsideBounds",2,__enum__ = __haxe_io_Error},2) + +__haxe_io_Error.Custom = function(e) local _x = _hx_tab_array({[0]="Custom",3,e,__enum__=__haxe_io_Error}, 3); return _x; end +__haxe_io_Error.__empty_constructs__ = _hx_tab_array({[0] = __haxe_io_Error.Blocked,__haxe_io_Error.Overflow,__haxe_io_Error.OutsideBounds}, 3) + +__haxe_io_FPHelper.new = {} +_hxClasses["haxe.io.FPHelper"] = __haxe_io_FPHelper +__haxe_io_FPHelper.__name__ = "haxe.io.FPHelper" +__haxe_io_FPHelper._i32ToFloat = function(i) + local sign = 1 - (_hx_bit.lshift(_hx_bit.rshift(i,31),1)); + local e = _hx_bit.band(_hx_bit.arshift(i,23),255); + if (e == 255) then + if ((_hx_bit.band(i,8388607)) == 0) then + if (sign > 0) then + do return _G.math.huge end; + else + do return -_G.math.huge end; + end; + else + do return (0/0) end; + end; + end; + local m = (function() + local _hx_1 + if (e == 0) then + _hx_1 = _hx_bit.lshift((_hx_bit.band(i,8388607)),1); else + _hx_1 = _hx_bit.bor(_hx_bit.band(i,8388607),8388608); end + return _hx_1 + end )(); + do return (sign * m) * _G.math.pow(2, e - 150) end; +end +__haxe_io_FPHelper._i64ToDouble = function(lo,hi) + local sign = 1 - (_hx_bit.lshift(_hx_bit.rshift(hi,31),1)); + local e = _hx_bit.band(_hx_bit.arshift(hi,20),2047); + if (e == 2047) then + if ((lo == 0) and ((_hx_bit.band(hi,1048575)) == 0)) then + if (sign > 0) then + do return _G.math.huge end; + else + do return -_G.math.huge end; + end; + else + do return (0/0) end; + end; + end; + local m = 2.220446049250313e-16 * ((((_hx_bit.band(hi,1048575)) * 4294967296.) + ((_hx_bit.rshift(lo,31)) * 2147483648.)) + (_hx_bit.band(lo,2147483647))); + m = (function() + local _hx_1 + if (e == 0) then + _hx_1 = m * 2.0; else + _hx_1 = m + 1.0; end + return _hx_1 + end )(); + do return (sign * m) * _G.math.pow(2, e - 1023) end; +end +__haxe_io_FPHelper._floatToI32 = function(f) + if (f == 0) then + do return 0 end; + end; + local af = (function() + local _hx_1 + if (f < 0) then + _hx_1 = -f; else + _hx_1 = f; end + return _hx_1 + end )(); + local exp = _G.math.floor(_G.math.log(af) / 0.6931471805599453); + if (exp > 127) then + do return 2139095040 end; + else + if (exp <= -127) then + exp = -127; + af = af * 7.1362384635298e+44; + else + af = ((af / _G.math.pow(2, exp)) - 1.0) * 8388608; + end; + do return _hx_bit.bor(_hx_bit.bor(((function() + local _hx_2 + if (f < 0) then + _hx_2 = -2147483648; else + _hx_2 = 0; end + return _hx_2 + end )()),_hx_bit.lshift(exp + 127,23)),_G.math.floor(af + 0.5)) end; + end; +end +__haxe_io_FPHelper._doubleToI64 = function(v) + local i64 = __haxe_io_FPHelper.i64tmp; + if (v == 0) then + i64.low = 0; + i64.high = 0; + else + if (not Math.isFinite(v)) then + i64.low = 0; + i64.high = (function() + local _hx_1 + if (v > 0) then + _hx_1 = 2146435072; else + _hx_1 = -1048576; end + return _hx_1 + end )(); + else + local av = (function() + local _hx_2 + if (v < 0) then + _hx_2 = -v; else + _hx_2 = v; end + return _hx_2 + end )(); + local exp = _G.math.floor(_G.math.log(av) / 0.6931471805599453); + if (exp > 1023) then + i64.low = -1; + i64.high = 2146435071; + else + if (exp <= -1023) then + exp = -1023; + av = av / 2.2250738585072014e-308; + else + av = (av / _G.math.pow(2, exp)) - 1.0; + end; + local sig = _G.math.floor((av * 4503599627370496.) + 0.5); + local sig_l = Std.int(sig); + local sig_h = Std.int(sig / 4294967296.0); + i64.low = sig_l; + i64.high = _hx_bit.bor(_hx_bit.bor(((function() + local _hx_3 + if (v < 0) then + _hx_3 = -2147483648; else + _hx_3 = 0; end + return _hx_3 + end )()),_hx_bit.lshift(exp + 1023,20)),sig_h); + end; + end; + end; + do return i64 end; +end +__haxe_io_FPHelper.i32ToFloat = function(i) + local sign = 1 - (_hx_bit.lshift(_hx_bit.rshift(i,31),1)); + local e = _hx_bit.band(_hx_bit.arshift(i,23),255); + if (e == 255) then + if ((_hx_bit.band(i,8388607)) == 0) then + if (sign > 0) then + do return _G.math.huge end; + else + do return -_G.math.huge end; + end; + else + do return (0/0) end; + end; + else + local m = (function() + local _hx_1 + if (e == 0) then + _hx_1 = _hx_bit.lshift((_hx_bit.band(i,8388607)),1); else + _hx_1 = _hx_bit.bor(_hx_bit.band(i,8388607),8388608); end + return _hx_1 + end )(); + do return (sign * m) * _G.math.pow(2, e - 150) end; + end; +end +__haxe_io_FPHelper.floatToI32 = function(f) + if (f == 0) then + do return 0 end; + else + local af = (function() + local _hx_1 + if (f < 0) then + _hx_1 = -f; else + _hx_1 = f; end + return _hx_1 + end )(); + local exp = _G.math.floor(_G.math.log(af) / 0.6931471805599453); + if (exp > 127) then + do return 2139095040 end; + else + if (exp <= -127) then + exp = -127; + af = af * 7.1362384635298e+44; + else + af = ((af / _G.math.pow(2, exp)) - 1.0) * 8388608; + end; + do return _hx_bit.bor(_hx_bit.bor(((function() + local _hx_2 + if (f < 0) then + _hx_2 = -2147483648; else + _hx_2 = 0; end + return _hx_2 + end )()),_hx_bit.lshift(exp + 127,23)),_G.math.floor(af + 0.5)) end; + end; + end; +end +__haxe_io_FPHelper.i64ToDouble = function(low,high) + local sign = 1 - (_hx_bit.lshift(_hx_bit.rshift(high,31),1)); + local e = _hx_bit.band(_hx_bit.arshift(high,20),2047); + if (e == 2047) then + if ((low == 0) and ((_hx_bit.band(high,1048575)) == 0)) then + if (sign > 0) then + do return _G.math.huge end; + else + do return -_G.math.huge end; + end; + else + do return (0/0) end; + end; + else + local m = 2.220446049250313e-16 * ((((_hx_bit.band(high,1048575)) * 4294967296.) + ((_hx_bit.rshift(low,31)) * 2147483648.)) + (_hx_bit.band(low,2147483647))); + m = (function() + local _hx_1 + if (e == 0) then + _hx_1 = m * 2.0; else + _hx_1 = m + 1.0; end + return _hx_1 + end )(); + do return (sign * m) * _G.math.pow(2, e - 1023) end; + end; +end +__haxe_io_FPHelper.doubleToI64 = function(v) + local i64 = __haxe_io_FPHelper.i64tmp; + if (v == 0) then + i64.low = 0; + i64.high = 0; + else + if (not Math.isFinite(v)) then + i64.low = 0; + i64.high = (function() + local _hx_1 + if (v > 0) then + _hx_1 = 2146435072; else + _hx_1 = -1048576; end + return _hx_1 + end )(); + else + local av = (function() + local _hx_2 + if (v < 0) then + _hx_2 = -v; else + _hx_2 = v; end + return _hx_2 + end )(); + local exp = _G.math.floor(_G.math.log(av) / 0.6931471805599453); + if (exp > 1023) then + i64.low = -1; + i64.high = 2146435071; + else + if (exp <= -1023) then + exp = -1023; + av = av / 2.2250738585072014e-308; + else + av = (av / _G.math.pow(2, exp)) - 1.0; + end; + local sig = _G.math.floor((av * 4503599627370496.) + 0.5); + local sig_l = Std.int(sig); + local sig_h = Std.int(sig / 4294967296.0); + i64.low = sig_l; + i64.high = _hx_bit.bor(_hx_bit.bor(((function() + local _hx_3 + if (v < 0) then + _hx_3 = -2147483648; else + _hx_3 = 0; end + return _hx_3 + end )()),_hx_bit.lshift(exp + 1023,20)),sig_h); + end; + end; + end; + do return i64 end; +end + +__haxe_io_Input.new = {} +_hxClasses["haxe.io.Input"] = __haxe_io_Input +__haxe_io_Input.__name__ = "haxe.io.Input" +__haxe_io_Input.prototype = _hx_e(); +__haxe_io_Input.prototype.bigEndian= nil; +__haxe_io_Input.prototype.readByte = function(self) + _G.error(__haxe_exceptions_NotImplementedException.new(nil, nil, _hx_o({__fields__={fileName=true,lineNumber=true,className=true,methodName=true},fileName="haxe/io/Input.hx",lineNumber=53,className="haxe.io.Input",methodName="readByte"})),0); +end +__haxe_io_Input.prototype.readBytes = function(self,s,pos,len) + local k = len; + local b = s.b; + if (((pos < 0) or (len < 0)) or ((pos + len) > s.length)) then + _G.error(__haxe_Exception.thrown(__haxe_io_Error.OutsideBounds),0); + end; + local _hx_status, _hx_result = pcall(function() + + while (k > 0) do + b[pos] = self:readByte(); + pos = pos + 1; + k = k - 1; + end; + return _hx_pcall_default + end) + if not _hx_status and _hx_result == "_hx_pcall_break" then + elseif not _hx_status then + local _g = _hx_result; + if (not __lua_Boot.__instanceof(__haxe_Exception.caught(_g):unwrap(), __haxe_io_Eof)) then + _G.error(_g,0); + end; + elseif _hx_result ~= _hx_pcall_default then + return _hx_result + end; + do return len - k end +end +__haxe_io_Input.prototype.close = function(self) +end +__haxe_io_Input.prototype.set_bigEndian = function(self,b) + self.bigEndian = b; + do return b end +end +__haxe_io_Input.prototype.readAll = function(self,bufsize) + if (bufsize == nil) then + bufsize = 16384; + end; + local buf = __haxe_io_Bytes.alloc(bufsize); + local total = __haxe_io_BytesBuffer.new(); + local _hx_status, _hx_result = pcall(function() + + while (true) do + local len = self:readBytes(buf, 0, bufsize); + if (len == 0) then + _G.error(__haxe_Exception.thrown(__haxe_io_Error.Blocked),0); + end; + if ((len < 0) or (len > buf.length)) then + _G.error(__haxe_Exception.thrown(__haxe_io_Error.OutsideBounds),0); + end; + local b1 = total.b; + local b2 = buf.b; + local _g = 0; + local _g1 = len; + while (_g < _g1) do + _g = _g + 1; + local i = _g - 1; + total.b:push(b2[i]); + end; + end; + return _hx_pcall_default + end) + if not _hx_status and _hx_result == "_hx_pcall_break" then + elseif not _hx_status then + local _g = _hx_result; + if (not __lua_Boot.__instanceof(__haxe_Exception.caught(_g):unwrap(), __haxe_io_Eof)) then + _G.error(_g,0); + end; + elseif _hx_result ~= _hx_pcall_default then + return _hx_result + end; + do return total:getBytes() end +end +__haxe_io_Input.prototype.readFullBytes = function(self,s,pos,len) + while (len > 0) do + local k = self:readBytes(s, pos, len); + if (k == 0) then + _G.error(__haxe_Exception.thrown(__haxe_io_Error.Blocked),0); + end; + pos = pos + k; + len = len - k; + end; +end +__haxe_io_Input.prototype.read = function(self,nbytes) + local s = __haxe_io_Bytes.alloc(nbytes); + local p = 0; + while (nbytes > 0) do + local k = self:readBytes(s, p, nbytes); + if (k == 0) then + _G.error(__haxe_Exception.thrown(__haxe_io_Error.Blocked),0); + end; + p = p + k; + nbytes = nbytes - k; + end; + do return s end +end +__haxe_io_Input.prototype.readUntil = function(self,_end) + local buf = __haxe_io_BytesBuffer.new(); + local last; + while (true) do + last = self:readByte(); + if (not (last ~= _end)) then + break; + end; + buf.b:push(last); + end; + do return buf:getBytes():toString() end +end +__haxe_io_Input.prototype.readLine = function(self) + local buf = __haxe_io_BytesBuffer.new(); + local last; + local s; + local _hx_status, _hx_result = pcall(function() + + while (true) do + last = self:readByte(); + if (not (last ~= 10)) then + break; + end; + buf.b:push(last); + end; + s = buf:getBytes():toString(); + if (__lua_lib_luautf8_Utf8.byte(s, (__lua_lib_luautf8_Utf8.len(s) - 1) + 1) == 13) then + local pos = 0; + local len = -1; + if ((len == nil) or (len > (pos + __lua_lib_luautf8_Utf8.len(s)))) then + len = __lua_lib_luautf8_Utf8.len(s); + else + if (len < 0) then + len = __lua_lib_luautf8_Utf8.len(s) + len; + end; + end; + if (pos < 0) then + pos = __lua_lib_luautf8_Utf8.len(s) + pos; + end; + if (pos < 0) then + pos = 0; + end; + s = __lua_lib_luautf8_Utf8.sub(s, pos + 1, pos + len); + end; + return _hx_pcall_default + end) + if not _hx_status and _hx_result == "_hx_pcall_break" then + elseif not _hx_status then + local _g = _hx_result; + local _g1 = __haxe_Exception.caught(_g):unwrap(); + if (__lua_Boot.__instanceof(_g1, __haxe_io_Eof)) then + local e = _g1; + s = buf:getBytes():toString(); + if (__lua_lib_luautf8_Utf8.len(s) == 0) then + _G.error(__haxe_Exception.thrown(e),0); + end; + else + _G.error(_g,0); + end; + elseif _hx_result ~= _hx_pcall_default then + return _hx_result + end; + do return s end +end +__haxe_io_Input.prototype.readFloat = function(self) + do return __haxe_io_FPHelper.i32ToFloat(self:readInt32()) end +end +__haxe_io_Input.prototype.readDouble = function(self) + local i1 = self:readInt32(); + local i2 = self:readInt32(); + if (self.bigEndian) then + do return __haxe_io_FPHelper.i64ToDouble(i2, i1) end; + else + do return __haxe_io_FPHelper.i64ToDouble(i1, i2) end; + end; +end +__haxe_io_Input.prototype.readInt8 = function(self) + local n = self:readByte(); + if (n >= 128) then + do return n - 256 end; + end; + do return n end +end +__haxe_io_Input.prototype.readInt16 = function(self) + local ch1 = self:readByte(); + local ch2 = self:readByte(); + local n = (function() + local _hx_1 + if (self.bigEndian) then + _hx_1 = _hx_bit.bor(ch2,_hx_bit.lshift(ch1,8)); else + _hx_1 = _hx_bit.bor(ch1,_hx_bit.lshift(ch2,8)); end + return _hx_1 + end )(); + if ((_hx_bit.band(n,32768)) ~= 0) then + do return n - 65536 end; + end; + do return n end +end +__haxe_io_Input.prototype.readUInt16 = function(self) + local ch1 = self:readByte(); + local ch2 = self:readByte(); + if (self.bigEndian) then + do return _hx_bit.bor(ch2,_hx_bit.lshift(ch1,8)) end; + else + do return _hx_bit.bor(ch1,_hx_bit.lshift(ch2,8)) end; + end; +end +__haxe_io_Input.prototype.readInt24 = function(self) + local ch1 = self:readByte(); + local ch2 = self:readByte(); + local ch3 = self:readByte(); + local n = (function() + local _hx_1 + if (self.bigEndian) then + _hx_1 = _hx_bit.bor(_hx_bit.bor(ch3,_hx_bit.lshift(ch2,8)),_hx_bit.lshift(ch1,16)); else + _hx_1 = _hx_bit.bor(_hx_bit.bor(ch1,_hx_bit.lshift(ch2,8)),_hx_bit.lshift(ch3,16)); end + return _hx_1 + end )(); + if ((_hx_bit.band(n,8388608)) ~= 0) then + do return n - 16777216 end; + end; + do return n end +end +__haxe_io_Input.prototype.readUInt24 = function(self) + local ch1 = self:readByte(); + local ch2 = self:readByte(); + local ch3 = self:readByte(); + if (self.bigEndian) then + do return _hx_bit.bor(_hx_bit.bor(ch3,_hx_bit.lshift(ch2,8)),_hx_bit.lshift(ch1,16)) end; + else + do return _hx_bit.bor(_hx_bit.bor(ch1,_hx_bit.lshift(ch2,8)),_hx_bit.lshift(ch3,16)) end; + end; +end +__haxe_io_Input.prototype.readInt32 = function(self) + local ch1 = self:readByte(); + local ch2 = self:readByte(); + local ch3 = self:readByte(); + local ch4 = self:readByte(); + local n = (function() + local _hx_1 + if (self.bigEndian) then + _hx_1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(ch4,_hx_bit.lshift(ch3,8)),_hx_bit.lshift(ch2,16)),_hx_bit.lshift(ch1,24)); else + _hx_1 = _hx_bit.bor(_hx_bit.bor(_hx_bit.bor(ch1,_hx_bit.lshift(ch2,8)),_hx_bit.lshift(ch3,16)),_hx_bit.lshift(ch4,24)); end + return _hx_1 + end )(); + do return _hx_bit_clamp(n) end +end +__haxe_io_Input.prototype.readString = function(self,len,encoding) + local b = __haxe_io_Bytes.alloc(len); + self:readFullBytes(b, 0, len); + do return b:getString(0, len, encoding) end +end + +__haxe_io_Input.prototype.__class__ = __haxe_io_Input + +__haxe_io_Input.prototype.__properties__ = {set_bigEndian="set_bigEndian"} + +__haxe_io_Output.new = {} +_hxClasses["haxe.io.Output"] = __haxe_io_Output +__haxe_io_Output.__name__ = "haxe.io.Output" +__haxe_io_Output.prototype = _hx_e(); +__haxe_io_Output.prototype.bigEndian= nil; +__haxe_io_Output.prototype.writeByte = function(self,c) + _G.error(__haxe_exceptions_NotImplementedException.new(nil, nil, _hx_o({__fields__={fileName=true,lineNumber=true,className=true,methodName=true},fileName="haxe/io/Output.hx",lineNumber=47,className="haxe.io.Output",methodName="writeByte"})),0); +end +__haxe_io_Output.prototype.writeBytes = function(self,s,pos,len) + if (((pos < 0) or (len < 0)) or ((pos + len) > s.length)) then + _G.error(__haxe_Exception.thrown(__haxe_io_Error.OutsideBounds),0); + end; + local b = s.b; + local k = len; + while (k > 0) do + self:writeByte(b[pos]); + pos = pos + 1; + k = k - 1; + end; + do return len end +end +__haxe_io_Output.prototype.flush = function(self) +end +__haxe_io_Output.prototype.close = function(self) +end +__haxe_io_Output.prototype.set_bigEndian = function(self,b) + self.bigEndian = b; + do return b end +end +__haxe_io_Output.prototype.write = function(self,s) + local l = s.length; + local p = 0; + while (l > 0) do + local k = self:writeBytes(s, p, l); + if (k == 0) then + _G.error(__haxe_Exception.thrown(__haxe_io_Error.Blocked),0); + end; + p = p + k; + l = l - k; + end; +end +__haxe_io_Output.prototype.writeFullBytes = function(self,s,pos,len) + while (len > 0) do + local k = self:writeBytes(s, pos, len); + pos = pos + k; + len = len - k; + end; +end +__haxe_io_Output.prototype.writeFloat = function(self,x) + self:writeInt32(__haxe_io_FPHelper.floatToI32(x)); +end +__haxe_io_Output.prototype.writeDouble = function(self,x) + local i64 = __haxe_io_FPHelper.doubleToI64(x); + if (self.bigEndian) then + self:writeInt32(i64.high); + self:writeInt32(i64.low); + else + self:writeInt32(i64.low); + self:writeInt32(i64.high); + end; +end +__haxe_io_Output.prototype.writeInt8 = function(self,x) + if ((x < -128) or (x >= 128)) then + _G.error(__haxe_Exception.thrown(__haxe_io_Error.Overflow),0); + end; + self:writeByte(_hx_bit.band(x,255)); +end +__haxe_io_Output.prototype.writeInt16 = function(self,x) + if ((x < -32768) or (x >= 32768)) then + _G.error(__haxe_Exception.thrown(__haxe_io_Error.Overflow),0); + end; + self:writeUInt16(_hx_bit.band(x,65535)); +end +__haxe_io_Output.prototype.writeUInt16 = function(self,x) + if ((x < 0) or (x >= 65536)) then + _G.error(__haxe_Exception.thrown(__haxe_io_Error.Overflow),0); + end; + if (self.bigEndian) then + self:writeByte(_hx_bit.arshift(x,8)); + self:writeByte(_hx_bit.band(x,255)); + else + self:writeByte(_hx_bit.band(x,255)); + self:writeByte(_hx_bit.arshift(x,8)); + end; +end +__haxe_io_Output.prototype.writeInt24 = function(self,x) + if ((x < -8388608) or (x >= 8388608)) then + _G.error(__haxe_Exception.thrown(__haxe_io_Error.Overflow),0); + end; + self:writeUInt24(_hx_bit.band(x,16777215)); +end +__haxe_io_Output.prototype.writeUInt24 = function(self,x) + if ((x < 0) or (x >= 16777216)) then + _G.error(__haxe_Exception.thrown(__haxe_io_Error.Overflow),0); + end; + if (self.bigEndian) then + self:writeByte(_hx_bit.arshift(x,16)); + self:writeByte(_hx_bit.band(_hx_bit.arshift(x,8),255)); + self:writeByte(_hx_bit.band(x,255)); + else + self:writeByte(_hx_bit.band(x,255)); + self:writeByte(_hx_bit.band(_hx_bit.arshift(x,8),255)); + self:writeByte(_hx_bit.arshift(x,16)); + end; +end +__haxe_io_Output.prototype.writeInt32 = function(self,x) + if (self.bigEndian) then + self:writeByte(_hx_bit.rshift(x,24)); + self:writeByte(_hx_bit.band(_hx_bit.arshift(x,16),255)); + self:writeByte(_hx_bit.band(_hx_bit.arshift(x,8),255)); + self:writeByte(_hx_bit.band(x,255)); + else + self:writeByte(_hx_bit.band(x,255)); + self:writeByte(_hx_bit.band(_hx_bit.arshift(x,8),255)); + self:writeByte(_hx_bit.band(_hx_bit.arshift(x,16),255)); + self:writeByte(_hx_bit.rshift(x,24)); + end; +end +__haxe_io_Output.prototype.prepare = function(self,nbytes) +end +__haxe_io_Output.prototype.writeInput = function(self,i,bufsize) + if (bufsize == nil) then + bufsize = 4096; + end; + local buf = __haxe_io_Bytes.alloc(bufsize); + local _hx_status, _hx_result = pcall(function() + + while (true) do + local len = i:readBytes(buf, 0, bufsize); + if (len == 0) then + _G.error(__haxe_Exception.thrown(__haxe_io_Error.Blocked),0); + end; + local p = 0; + while (len > 0) do + local k = self:writeBytes(buf, p, len); + if (k == 0) then + _G.error(__haxe_Exception.thrown(__haxe_io_Error.Blocked),0); + end; + p = p + k; + len = len - k; + end; + end; + return _hx_pcall_default + end) + if not _hx_status and _hx_result == "_hx_pcall_break" then + elseif not _hx_status then + local _g = _hx_result; + if (not __lua_Boot.__instanceof(__haxe_Exception.caught(_g):unwrap(), __haxe_io_Eof)) then + _G.error(_g,0); + end; + elseif _hx_result ~= _hx_pcall_default then + return _hx_result + end; +end +__haxe_io_Output.prototype.writeString = function(self,s,encoding) + local b = __haxe_io_Bytes.ofString(s, encoding); + self:writeFullBytes(b, 0, b.length); +end + +__haxe_io_Output.prototype.__class__ = __haxe_io_Output + +__haxe_io_Output.prototype.__properties__ = {set_bigEndian="set_bigEndian"} + +__haxe_io_Path.new = function(path) + local self = _hx_new(__haxe_io_Path.prototype) + __haxe_io_Path.super(self,path) + return self +end +__haxe_io_Path.super = function(self,path) + local path1 = path; + if (path1) == "." or (path1) == ".." then + self.dir = path; + self.file = ""; + do return end; end; + local startIndex = nil; + local ret = -1; + if (startIndex == nil) then + startIndex = __lua_lib_luautf8_Utf8.len(path); + end; + while (true) do + local startIndex1 = ret + 1; + if (startIndex1 == nil) then + startIndex1 = 1; + else + startIndex1 = startIndex1 + 1; + end; + local r = __lua_lib_luautf8_Utf8.find(path, "/", startIndex1, true); + local p = (function() + local _hx_1 + if ((r ~= nil) and (r > 0)) then + _hx_1 = r - 1; else + _hx_1 = -1; end + return _hx_1 + end )(); + if (((p == -1) or (p > startIndex)) or (p == ret)) then + break; + end; + ret = p; + end; + local c1 = ret; + local startIndex = nil; + local ret = -1; + if (startIndex == nil) then + startIndex = __lua_lib_luautf8_Utf8.len(path); + end; + while (true) do + local startIndex1 = ret + 1; + if (startIndex1 == nil) then + startIndex1 = 1; + else + startIndex1 = startIndex1 + 1; + end; + local r = __lua_lib_luautf8_Utf8.find(path, "\\", startIndex1, true); + local p = (function() + local _hx_2 + if ((r ~= nil) and (r > 0)) then + _hx_2 = r - 1; else + _hx_2 = -1; end + return _hx_2 + end )(); + if (((p == -1) or (p > startIndex)) or (p == ret)) then + break; + end; + ret = p; + end; + local c2 = ret; + if (c1 < c2) then + local pos = 0; + local len = c2; + if ((len == nil) or (len > (pos + __lua_lib_luautf8_Utf8.len(path)))) then + len = __lua_lib_luautf8_Utf8.len(path); + else + if (len < 0) then + len = __lua_lib_luautf8_Utf8.len(path) + len; + end; + end; + if (pos < 0) then + pos = __lua_lib_luautf8_Utf8.len(path) + pos; + end; + if (pos < 0) then + pos = 0; + end; + self.dir = __lua_lib_luautf8_Utf8.sub(path, pos + 1, pos + len); + local pos = c2 + 1; + local len = nil; + if ((len == nil) or (len > (pos + __lua_lib_luautf8_Utf8.len(path)))) then + len = __lua_lib_luautf8_Utf8.len(path); + else + if (len < 0) then + len = __lua_lib_luautf8_Utf8.len(path) + len; + end; + end; + if (pos < 0) then + pos = __lua_lib_luautf8_Utf8.len(path) + pos; + end; + if (pos < 0) then + pos = 0; + end; + path = __lua_lib_luautf8_Utf8.sub(path, pos + 1, pos + len); + self.backslash = true; + else + if (c2 < c1) then + local pos = 0; + local len = c1; + if ((len == nil) or (len > (pos + __lua_lib_luautf8_Utf8.len(path)))) then + len = __lua_lib_luautf8_Utf8.len(path); + else + if (len < 0) then + len = __lua_lib_luautf8_Utf8.len(path) + len; + end; + end; + if (pos < 0) then + pos = __lua_lib_luautf8_Utf8.len(path) + pos; + end; + if (pos < 0) then + pos = 0; + end; + self.dir = __lua_lib_luautf8_Utf8.sub(path, pos + 1, pos + len); + local pos = c1 + 1; + local len = nil; + if ((len == nil) or (len > (pos + __lua_lib_luautf8_Utf8.len(path)))) then + len = __lua_lib_luautf8_Utf8.len(path); + else + if (len < 0) then + len = __lua_lib_luautf8_Utf8.len(path) + len; + end; + end; + if (pos < 0) then + pos = __lua_lib_luautf8_Utf8.len(path) + pos; + end; + if (pos < 0) then + pos = 0; + end; + path = __lua_lib_luautf8_Utf8.sub(path, pos + 1, pos + len); + else + self.dir = nil; + end; + end; + local startIndex = nil; + local ret = -1; + if (startIndex == nil) then + startIndex = __lua_lib_luautf8_Utf8.len(path); + end; + while (true) do + local startIndex1 = ret + 1; + if (startIndex1 == nil) then + startIndex1 = 1; + else + startIndex1 = startIndex1 + 1; + end; + local r = __lua_lib_luautf8_Utf8.find(path, ".", startIndex1, true); + local p = (function() + local _hx_3 + if ((r ~= nil) and (r > 0)) then + _hx_3 = r - 1; else + _hx_3 = -1; end + return _hx_3 + end )(); + if (((p == -1) or (p > startIndex)) or (p == ret)) then + break; + end; + ret = p; + end; + local cp = ret; + if (cp ~= -1) then + local pos = cp + 1; + local len = nil; + if ((len == nil) or (len > (pos + __lua_lib_luautf8_Utf8.len(path)))) then + len = __lua_lib_luautf8_Utf8.len(path); + else + if (len < 0) then + len = __lua_lib_luautf8_Utf8.len(path) + len; + end; + end; + if (pos < 0) then + pos = __lua_lib_luautf8_Utf8.len(path) + pos; + end; + if (pos < 0) then + pos = 0; + end; + self.ext = __lua_lib_luautf8_Utf8.sub(path, pos + 1, pos + len); + local pos = 0; + local len = cp; + if ((len == nil) or (len > (pos + __lua_lib_luautf8_Utf8.len(path)))) then + len = __lua_lib_luautf8_Utf8.len(path); + else + if (len < 0) then + len = __lua_lib_luautf8_Utf8.len(path) + len; + end; + end; + if (pos < 0) then + pos = __lua_lib_luautf8_Utf8.len(path) + pos; + end; + if (pos < 0) then + pos = 0; + end; + self.file = __lua_lib_luautf8_Utf8.sub(path, pos + 1, pos + len); + else + self.ext = nil; + self.file = path; + end; +end +_hxClasses["haxe.io.Path"] = __haxe_io_Path +__haxe_io_Path.__name__ = "haxe.io.Path" +__haxe_io_Path.withoutExtension = function(path) + local s = __haxe_io_Path.new(path); + s.ext = nil; + do return s:toString() end; +end +__haxe_io_Path.withoutDirectory = function(path) + local s = __haxe_io_Path.new(path); + s.dir = nil; + do return s:toString() end; +end +__haxe_io_Path.directory = function(path) + local s = __haxe_io_Path.new(path); + if (s.dir == nil) then + do return "" end; + end; + do return s.dir end; +end +__haxe_io_Path.extension = function(path) + local s = __haxe_io_Path.new(path); + if (s.ext == nil) then + do return "" end; + end; + do return s.ext end; +end +__haxe_io_Path.withExtension = function(path,ext) + local s = __haxe_io_Path.new(path); + s.ext = ext; + do return s:toString() end; +end +__haxe_io_Path.join = function(paths) + local _g = _hx_tab_array({}, 0); + local _g1 = 0; + local _g2 = paths; + while (_g1 < _g2.length) do + local i = _g2[_g1]; + _g1 = _g1 + 1; + if ((i ~= nil) and (i ~= "")) then + _g:push(i); + end; + end; + local paths = _g; + if (paths.length == 0) then + do return "" end; + end; + local path = paths[0]; + local _g = 1; + local _g1 = paths.length; + while (_g < _g1) do + _g = _g + 1; + local i = _g - 1; + path = __haxe_io_Path.addTrailingSlash(path); + path = Std.string(path) .. Std.string(paths[i]); + end; + do return __haxe_io_Path.normalize(path) end; +end +__haxe_io_Path.normalize = function(path) + local slash = "/"; + local idx = 1; + local ret = _hx_tab_array({}, 0); + while (idx ~= nil) do + local newidx = 0; + if (__lua_lib_luautf8_Utf8.len("\\") > 0) then + newidx = __lua_lib_luautf8_Utf8.find(path, "\\", idx, true); + else + if (idx >= __lua_lib_luautf8_Utf8.len(path)) then + newidx = nil; + else + newidx = idx + 1; + end; + end; + if (newidx ~= nil) then + local match = __lua_lib_luautf8_Utf8.sub(path, idx, newidx - 1); + ret:push(match); + idx = newidx + __lua_lib_luautf8_Utf8.len("\\"); + else + ret:push(__lua_lib_luautf8_Utf8.sub(path, idx, __lua_lib_luautf8_Utf8.len(path))); + idx = nil; + end; + end; + path = ret:join(slash); + if (path == slash) then + do return slash end; + end; + local target = _hx_tab_array({}, 0); + local _g = 0; + local idx = 1; + local ret = _hx_tab_array({}, 0); + while (idx ~= nil) do + local newidx = 0; + if (__lua_lib_luautf8_Utf8.len(slash) > 0) then + newidx = __lua_lib_luautf8_Utf8.find(path, slash, idx, true); + else + if (idx >= __lua_lib_luautf8_Utf8.len(path)) then + newidx = nil; + else + newidx = idx + 1; + end; + end; + if (newidx ~= nil) then + local match = __lua_lib_luautf8_Utf8.sub(path, idx, newidx - 1); + ret:push(match); + idx = newidx + __lua_lib_luautf8_Utf8.len(slash); + else + ret:push(__lua_lib_luautf8_Utf8.sub(path, idx, __lua_lib_luautf8_Utf8.len(path))); + idx = nil; + end; + end; + local _g1 = ret; + while (_g < _g1.length) do + local token = _g1[_g]; + _g = _g + 1; + if (((token == "..") and (target.length > 0)) and (target[target.length - 1] ~= "..")) then + target:pop(); + else + if (token == "") then + if ((target.length > 0) or (__lua_lib_luautf8_Utf8.byte(path, 1) == 47)) then + target:push(token); + end; + else + if (token ~= ".") then + target:push(token); + end; + end; + end; + end; + local tmp = target:join(slash); + local acc_b = ({}); + local acc_length = 0; + local colon = false; + local slashes = false; + local _g = 0; + local _g1 = __lua_lib_luautf8_Utf8.len(tmp); + while (_g < _g1) do + _g = _g + 1; + local i = _g - 1; + local _g = __lua_lib_luautf8_Utf8.byte(tmp, i + 1); + local _g1 = _g; + if (_g1) == 47 then + if (not colon) then + slashes = true; + else + local i = _g; + colon = false; + if (slashes) then + local str = "/"; + _G.table.insert(acc_b, str); + acc_length = acc_length + __lua_lib_luautf8_Utf8.len(str); + slashes = false; + end; + _G.table.insert(acc_b, __lua_lib_luautf8_Utf8.char(i)); + acc_length = acc_length + 1; + end; + elseif (_g1) == 58 then + local str = ":"; + _G.table.insert(acc_b, str); + acc_length = acc_length + __lua_lib_luautf8_Utf8.len(str); + colon = true;else + local i = _g; + colon = false; + if (slashes) then + local str = "/"; + _G.table.insert(acc_b, str); + acc_length = acc_length + __lua_lib_luautf8_Utf8.len(str); + slashes = false; + end; + _G.table.insert(acc_b, __lua_lib_luautf8_Utf8.char(i)); + acc_length = acc_length + 1; end; + end; + do return _G.table.concat(acc_b) end; +end +__haxe_io_Path.addTrailingSlash = function(path) + if (__lua_lib_luautf8_Utf8.len(path) == 0) then + do return "/" end; + end; + local startIndex = nil; + local ret = -1; + if (startIndex == nil) then + startIndex = __lua_lib_luautf8_Utf8.len(path); + end; + while (true) do + local startIndex1 = ret + 1; + if (startIndex1 == nil) then + startIndex1 = 1; + else + startIndex1 = startIndex1 + 1; + end; + local r = __lua_lib_luautf8_Utf8.find(path, "/", startIndex1, true); + local p = (function() + local _hx_1 + if ((r ~= nil) and (r > 0)) then + _hx_1 = r - 1; else + _hx_1 = -1; end + return _hx_1 + end )(); + if (((p == -1) or (p > startIndex)) or (p == ret)) then + break; + end; + ret = p; + end; + local c1 = ret; + local startIndex = nil; + local ret = -1; + if (startIndex == nil) then + startIndex = __lua_lib_luautf8_Utf8.len(path); + end; + while (true) do + local startIndex1 = ret + 1; + if (startIndex1 == nil) then + startIndex1 = 1; + else + startIndex1 = startIndex1 + 1; + end; + local r = __lua_lib_luautf8_Utf8.find(path, "\\", startIndex1, true); + local p = (function() + local _hx_2 + if ((r ~= nil) and (r > 0)) then + _hx_2 = r - 1; else + _hx_2 = -1; end + return _hx_2 + end )(); + if (((p == -1) or (p > startIndex)) or (p == ret)) then + break; + end; + ret = p; + end; + local c2 = ret; + if (c1 < c2) then + if (c2 ~= (__lua_lib_luautf8_Utf8.len(path) - 1)) then + do return Std.string(path) .. Std.string("\\") end; + else + do return path end; + end; + else + if (c1 ~= (__lua_lib_luautf8_Utf8.len(path) - 1)) then + do return Std.string(path) .. Std.string("/") end; + else + do return path end; + end; + end; +end +__haxe_io_Path.removeTrailingSlashes = function(path) + while (true) do + local _g = __lua_lib_luautf8_Utf8.byte(path, (__lua_lib_luautf8_Utf8.len(path) - 1) + 1); + if (_g == nil) then + break; + else + local _g = _g; + if (_g) == 47 or (_g) == 92 then + local pos = 0; + local len = -1; + if ((len == nil) or (len > (pos + __lua_lib_luautf8_Utf8.len(path)))) then + len = __lua_lib_luautf8_Utf8.len(path); + else + if (len < 0) then + len = __lua_lib_luautf8_Utf8.len(path) + len; + end; + end; + if (pos < 0) then + pos = __lua_lib_luautf8_Utf8.len(path) + pos; + end; + if (pos < 0) then + pos = 0; + end; + path = __lua_lib_luautf8_Utf8.sub(path, pos + 1, pos + len);else + break; end; + end; + end; + do return path end; +end +__haxe_io_Path.isAbsolute = function(path) + if (StringTools.startsWith(path, "/")) then + do return true end; + end; + if (__lua_lib_luautf8_Utf8.sub(path, 2, 2) == ":") then + do return true end; + end; + if (StringTools.startsWith(path, "\\\\")) then + do return true end; + end; + do return false end; +end +__haxe_io_Path.unescape = function(path) + local regex = EReg.new("-x([0-9][0-9])", "g"); + do return regex:map(path, function(regex) + do return __lua_lib_luautf8_Utf8.char(Std.parseInt(regex:matched(1))) end; + end) end; +end +__haxe_io_Path.escape = function(path,allowSlashes) + if (allowSlashes == nil) then + allowSlashes = false; + end; + local regex = (function() + local _hx_1 + if (allowSlashes) then + _hx_1 = EReg.new("[^A-Za-z0-9_/\\\\\\.]", "g"); else + _hx_1 = EReg.new("[^A-Za-z0-9_\\.]", "g"); end + return _hx_1 + end )(); + do return regex:map(path, function(v) + do return Std.string("-x") .. Std.string(__lua_lib_luautf8_Utf8.byte(v:matched(0), 1)) end; + end) end; +end +__haxe_io_Path.prototype = _hx_e(); +__haxe_io_Path.prototype.dir= nil; +__haxe_io_Path.prototype.file= nil; +__haxe_io_Path.prototype.ext= nil; +__haxe_io_Path.prototype.backslash= nil; +__haxe_io_Path.prototype.toString = function(self) + do return Std.string(Std.string(((function() + local _hx_1 + if (self.dir == nil) then + _hx_1 = ""; else + _hx_1 = Std.string(self.dir) .. Std.string(((function() + local _hx_2 + if (self.backslash) then + _hx_2 = "\\"; else + _hx_2 = "/"; end + return _hx_2 + end )())); end + return _hx_1 + end )())) .. Std.string(self.file)) .. Std.string(((function() + local _hx_3 + if (self.ext == nil) then + _hx_3 = ""; else + _hx_3 = Std.string(".") .. Std.string(self.ext); end + return _hx_3 + end )())) end +end + +__haxe_io_Path.prototype.__class__ = __haxe_io_Path + +__haxe_iterators_ArrayIterator.new = function(array) + local self = _hx_new(__haxe_iterators_ArrayIterator.prototype) + __haxe_iterators_ArrayIterator.super(self,array) + return self +end +__haxe_iterators_ArrayIterator.super = function(self,array) + self.current = 0; + self.array = array; +end +_hxClasses["haxe.iterators.ArrayIterator"] = __haxe_iterators_ArrayIterator +__haxe_iterators_ArrayIterator.__name__ = "haxe.iterators.ArrayIterator" +__haxe_iterators_ArrayIterator.prototype = _hx_e(); +__haxe_iterators_ArrayIterator.prototype.array= nil; +__haxe_iterators_ArrayIterator.prototype.current= nil; +__haxe_iterators_ArrayIterator.prototype.hasNext = function(self) + do return self.current < self.array.length end +end +__haxe_iterators_ArrayIterator.prototype.next = function(self) + do return self.array[(function() + local _hx_obj = self; + local _hx_fld = 'current'; + local _ = _hx_obj[_hx_fld]; + _hx_obj[_hx_fld] = _hx_obj[_hx_fld] + 1; + return _; + end)()] end +end + +__haxe_iterators_ArrayIterator.prototype.__class__ = __haxe_iterators_ArrayIterator + +__haxe_iterators_ArrayKeyValueIterator.new = function(array) + local self = _hx_new(__haxe_iterators_ArrayKeyValueIterator.prototype) + __haxe_iterators_ArrayKeyValueIterator.super(self,array) + return self +end +__haxe_iterators_ArrayKeyValueIterator.super = function(self,array) + self.current = 0; + self.array = array; +end +_hxClasses["haxe.iterators.ArrayKeyValueIterator"] = __haxe_iterators_ArrayKeyValueIterator +__haxe_iterators_ArrayKeyValueIterator.__name__ = "haxe.iterators.ArrayKeyValueIterator" +__haxe_iterators_ArrayKeyValueIterator.prototype = _hx_e(); +__haxe_iterators_ArrayKeyValueIterator.prototype.current= nil; +__haxe_iterators_ArrayKeyValueIterator.prototype.array= nil; +__haxe_iterators_ArrayKeyValueIterator.prototype.hasNext = function(self) + do return self.current < self.array.length end +end +__haxe_iterators_ArrayKeyValueIterator.prototype.next = function(self) + do return _hx_o({__fields__={value=true,key=true},value=self.array[self.current],key=(function() + local _hx_obj = self; + local _hx_fld = 'current'; + local _ = _hx_obj[_hx_fld]; + _hx_obj[_hx_fld] = _hx_obj[_hx_fld] + 1; + return _; + end)()}) end +end + +__haxe_iterators_ArrayKeyValueIterator.prototype.__class__ = __haxe_iterators_ArrayKeyValueIterator + +__haxe_iterators_DynamicAccessIterator.new = function(access) + local self = _hx_new(__haxe_iterators_DynamicAccessIterator.prototype) + __haxe_iterators_DynamicAccessIterator.super(self,access) + return self +end +__haxe_iterators_DynamicAccessIterator.super = function(self,access) + self.access = access; + self.keys = Reflect.fields(access); + self.index = 0; +end +_hxClasses["haxe.iterators.DynamicAccessIterator"] = __haxe_iterators_DynamicAccessIterator +__haxe_iterators_DynamicAccessIterator.__name__ = "haxe.iterators.DynamicAccessIterator" +__haxe_iterators_DynamicAccessIterator.prototype = _hx_e(); +__haxe_iterators_DynamicAccessIterator.prototype.access= nil; +__haxe_iterators_DynamicAccessIterator.prototype.keys= nil; +__haxe_iterators_DynamicAccessIterator.prototype.index= nil; +__haxe_iterators_DynamicAccessIterator.prototype.hasNext = function(self) + do return self.index < self.keys.length end +end +__haxe_iterators_DynamicAccessIterator.prototype.next = function(self) + local key = self.keys[(function() + local _hx_obj = self; + local _hx_fld = 'index'; + local _ = _hx_obj[_hx_fld]; + _hx_obj[_hx_fld] = _hx_obj[_hx_fld] + 1; + return _; + end)()]; + do return Reflect.field(self.access, key) end +end + +__haxe_iterators_DynamicAccessIterator.prototype.__class__ = __haxe_iterators_DynamicAccessIterator + +__haxe_iterators_DynamicAccessKeyValueIterator.new = function(access) + local self = _hx_new(__haxe_iterators_DynamicAccessKeyValueIterator.prototype) + __haxe_iterators_DynamicAccessKeyValueIterator.super(self,access) + return self +end +__haxe_iterators_DynamicAccessKeyValueIterator.super = function(self,access) + self.access = access; + self.keys = Reflect.fields(access); + self.index = 0; +end +_hxClasses["haxe.iterators.DynamicAccessKeyValueIterator"] = __haxe_iterators_DynamicAccessKeyValueIterator +__haxe_iterators_DynamicAccessKeyValueIterator.__name__ = "haxe.iterators.DynamicAccessKeyValueIterator" +__haxe_iterators_DynamicAccessKeyValueIterator.prototype = _hx_e(); +__haxe_iterators_DynamicAccessKeyValueIterator.prototype.access= nil; +__haxe_iterators_DynamicAccessKeyValueIterator.prototype.keys= nil; +__haxe_iterators_DynamicAccessKeyValueIterator.prototype.index= nil; +__haxe_iterators_DynamicAccessKeyValueIterator.prototype.hasNext = function(self) + do return self.index < self.keys.length end +end +__haxe_iterators_DynamicAccessKeyValueIterator.prototype.next = function(self) + local key = self.keys[(function() + local _hx_obj = self; + local _hx_fld = 'index'; + local _ = _hx_obj[_hx_fld]; + _hx_obj[_hx_fld] = _hx_obj[_hx_fld] + 1; + return _; + end)()]; + do return _hx_o({__fields__={value=true,key=true},value=Reflect.field(self.access, key),key=key}) end +end + +__haxe_iterators_DynamicAccessKeyValueIterator.prototype.__class__ = __haxe_iterators_DynamicAccessKeyValueIterator + +__haxe_iterators_HashMapKeyValueIterator.new = function(map) + local self = _hx_new(__haxe_iterators_HashMapKeyValueIterator.prototype) + __haxe_iterators_HashMapKeyValueIterator.super(self,map) + return self +end +__haxe_iterators_HashMapKeyValueIterator.super = function(self,map) + self.map = map; + self.keys = map.keys:iterator(); +end +_hxClasses["haxe.iterators.HashMapKeyValueIterator"] = __haxe_iterators_HashMapKeyValueIterator +__haxe_iterators_HashMapKeyValueIterator.__name__ = "haxe.iterators.HashMapKeyValueIterator" +__haxe_iterators_HashMapKeyValueIterator.prototype = _hx_e(); +__haxe_iterators_HashMapKeyValueIterator.prototype.map= nil; +__haxe_iterators_HashMapKeyValueIterator.prototype.keys= nil; +__haxe_iterators_HashMapKeyValueIterator.prototype.hasNext = function(self) + do return self.keys:hasNext() end +end +__haxe_iterators_HashMapKeyValueIterator.prototype.next = function(self) + local key = self.keys:next(); + local _this = self.map.values; + local key1 = key:hashCode(); + local ret = _this.h[key1]; + if (ret == __haxe_ds_IntMap.tnull) then + ret = nil; + end; + do return _hx_o({__fields__={value=true,key=true},value=ret,key=key}) end +end + +__haxe_iterators_HashMapKeyValueIterator.prototype.__class__ = __haxe_iterators_HashMapKeyValueIterator + +__haxe_iterators_MapKeyValueIterator.new = function(map) + local self = _hx_new(__haxe_iterators_MapKeyValueIterator.prototype) + __haxe_iterators_MapKeyValueIterator.super(self,map) + return self +end +__haxe_iterators_MapKeyValueIterator.super = function(self,map) + self.map = map; + self.keys = map:keys(); +end +_hxClasses["haxe.iterators.MapKeyValueIterator"] = __haxe_iterators_MapKeyValueIterator +__haxe_iterators_MapKeyValueIterator.__name__ = "haxe.iterators.MapKeyValueIterator" +__haxe_iterators_MapKeyValueIterator.prototype = _hx_e(); +__haxe_iterators_MapKeyValueIterator.prototype.map= nil; +__haxe_iterators_MapKeyValueIterator.prototype.keys= nil; +__haxe_iterators_MapKeyValueIterator.prototype.hasNext = function(self) + do return self.keys:hasNext() end +end +__haxe_iterators_MapKeyValueIterator.prototype.next = function(self) + local key = self.keys:next(); + do return _hx_o({__fields__={value=true,key=true},value=self.map:get(key),key=key}) end +end + +__haxe_iterators_MapKeyValueIterator.prototype.__class__ = __haxe_iterators_MapKeyValueIterator + +__haxe_iterators_RestIterator.new = function(args) + local self = _hx_new(__haxe_iterators_RestIterator.prototype) + __haxe_iterators_RestIterator.super(self,args) + return self +end +__haxe_iterators_RestIterator.super = function(self,args) + self.current = 0; + self.args = args; +end +_hxClasses["haxe.iterators.RestIterator"] = __haxe_iterators_RestIterator +__haxe_iterators_RestIterator.__name__ = "haxe.iterators.RestIterator" +__haxe_iterators_RestIterator.prototype = _hx_e(); +__haxe_iterators_RestIterator.prototype.args= nil; +__haxe_iterators_RestIterator.prototype.current= nil; +__haxe_iterators_RestIterator.prototype.hasNext = function(self) + do return self.current < _hx_table.maxn(self.args) end +end +__haxe_iterators_RestIterator.prototype.next = function(self) + local index = (function() + local _hx_obj = self; + local _hx_fld = 'current'; + local _ = _hx_obj[_hx_fld]; + _hx_obj[_hx_fld] = _hx_obj[_hx_fld] + 1; + return _; + end)(); + do return self.args[index + 1] end +end + +__haxe_iterators_RestIterator.prototype.__class__ = __haxe_iterators_RestIterator + +__haxe_iterators_RestKeyValueIterator.new = function(args) + local self = _hx_new(__haxe_iterators_RestKeyValueIterator.prototype) + __haxe_iterators_RestKeyValueIterator.super(self,args) + return self +end +__haxe_iterators_RestKeyValueIterator.super = function(self,args) + self.current = 0; + self.args = args; +end +_hxClasses["haxe.iterators.RestKeyValueIterator"] = __haxe_iterators_RestKeyValueIterator +__haxe_iterators_RestKeyValueIterator.__name__ = "haxe.iterators.RestKeyValueIterator" +__haxe_iterators_RestKeyValueIterator.prototype = _hx_e(); +__haxe_iterators_RestKeyValueIterator.prototype.args= nil; +__haxe_iterators_RestKeyValueIterator.prototype.current= nil; +__haxe_iterators_RestKeyValueIterator.prototype.hasNext = function(self) + do return self.current < _hx_table.maxn(self.args) end +end +__haxe_iterators_RestKeyValueIterator.prototype.next = function(self) + local tmp = self.current; + local index = (function() + local _hx_obj = self; + local _hx_fld = 'current'; + local _ = _hx_obj[_hx_fld]; + _hx_obj[_hx_fld] = _hx_obj[_hx_fld] + 1; + return _; + end)(); + do return _hx_o({__fields__={key=true,value=true},key=tmp,value=self.args[index + 1]}) end +end + +__haxe_iterators_RestKeyValueIterator.prototype.__class__ = __haxe_iterators_RestKeyValueIterator + +__haxe_iterators_StringIterator.new = function(s) + local self = _hx_new(__haxe_iterators_StringIterator.prototype) + __haxe_iterators_StringIterator.super(self,s) + return self +end +__haxe_iterators_StringIterator.super = function(self,s) + self.codes = __lua_lib_luautf8_Utf8.codes(s); + self.str = s; + local _hx_1_cp_position, _hx_1_cp_codepoint = self:codes(self.str, 0); + self.codepoint = _hx_1_cp_codepoint; + self.position = _hx_1_cp_position; +end +_hxClasses["haxe.iterators.StringIterator"] = __haxe_iterators_StringIterator +__haxe_iterators_StringIterator.__name__ = "haxe.iterators.StringIterator" +__haxe_iterators_StringIterator.prototype = _hx_e(); +__haxe_iterators_StringIterator.prototype.codes= nil; +__haxe_iterators_StringIterator.prototype.codepoint= nil; +__haxe_iterators_StringIterator.prototype.str= nil; +__haxe_iterators_StringIterator.prototype.position= nil; +__haxe_iterators_StringIterator.prototype.hasNext = function(self) + do return self.codepoint ~= nil end +end +__haxe_iterators_StringIterator.prototype.next = function(self) + local ret = self.codepoint; + local _hx_1_cp_position, _hx_1_cp_codepoint = self:codes(self.str, self.position); + self.codepoint = _hx_1_cp_codepoint; + self.position = _hx_1_cp_position; + do return ret end +end + +__haxe_iterators_StringIterator.prototype.__class__ = __haxe_iterators_StringIterator + +__haxe_iterators_StringIteratorUnicode.new = function(s) + local self = _hx_new(__haxe_iterators_StringIteratorUnicode.prototype) + __haxe_iterators_StringIteratorUnicode.super(self,s) + return self +end +__haxe_iterators_StringIteratorUnicode.super = function(self,s) + self.offset = 0; + self.s = s; +end +_hxClasses["haxe.iterators.StringIteratorUnicode"] = __haxe_iterators_StringIteratorUnicode +__haxe_iterators_StringIteratorUnicode.__name__ = "haxe.iterators.StringIteratorUnicode" +__haxe_iterators_StringIteratorUnicode.unicodeIterator = function(s) + do return __haxe_iterators_StringIteratorUnicode.new(s) end; +end +__haxe_iterators_StringIteratorUnicode.prototype = _hx_e(); +__haxe_iterators_StringIteratorUnicode.prototype.offset= nil; +__haxe_iterators_StringIteratorUnicode.prototype.s= nil; +__haxe_iterators_StringIteratorUnicode.prototype.hasNext = function(self) + do return self.offset < __lua_lib_luautf8_Utf8.len(self.s) end +end +__haxe_iterators_StringIteratorUnicode.prototype.next = function(self) + local index = (function() + local _hx_obj = self; + local _hx_fld = 'offset'; + local _ = _hx_obj[_hx_fld]; + _hx_obj[_hx_fld] = _hx_obj[_hx_fld] + 1; + return _; + end)(); + do return __lua_lib_luautf8_Utf8.byte(self.s, index + 1) end +end + +__haxe_iterators_StringIteratorUnicode.prototype.__class__ = __haxe_iterators_StringIteratorUnicode + +__haxe_iterators_StringKeyValueIterator.new = function(s) + local self = _hx_new(__haxe_iterators_StringKeyValueIterator.prototype) + __haxe_iterators_StringKeyValueIterator.super(self,s) + return self +end +__haxe_iterators_StringKeyValueIterator.super = function(self,s) + self.offset = 0; + self.s = s; +end +_hxClasses["haxe.iterators.StringKeyValueIterator"] = __haxe_iterators_StringKeyValueIterator +__haxe_iterators_StringKeyValueIterator.__name__ = "haxe.iterators.StringKeyValueIterator" +__haxe_iterators_StringKeyValueIterator.prototype = _hx_e(); +__haxe_iterators_StringKeyValueIterator.prototype.offset= nil; +__haxe_iterators_StringKeyValueIterator.prototype.s= nil; +__haxe_iterators_StringKeyValueIterator.prototype.hasNext = function(self) + do return self.offset < __lua_lib_luautf8_Utf8.len(self.s) end +end +__haxe_iterators_StringKeyValueIterator.prototype.next = function(self) + local tmp = self.offset; + local index = (function() + local _hx_obj = self; + local _hx_fld = 'offset'; + local _ = _hx_obj[_hx_fld]; + _hx_obj[_hx_fld] = _hx_obj[_hx_fld] + 1; + return _; + end)(); + do return _hx_o({__fields__={key=true,value=true},key=tmp,value=__lua_lib_luautf8_Utf8.byte(self.s, index + 1)}) end +end + +__haxe_iterators_StringKeyValueIterator.prototype.__class__ = __haxe_iterators_StringKeyValueIterator + +__lua_Boot.new = {} +_hxClasses["lua.Boot"] = __lua_Boot +__lua_Boot.__name__ = "lua.Boot" +__lua_Boot.__properties__ = {get_os_patterns="get_os_patterns"} +__lua_Boot._ = nil +__lua_Boot.__unhtml = function(s) + local idx = 1; + local ret = _hx_tab_array({}, 0); + while (idx ~= nil) do + local newidx = 0; + if (__lua_lib_luautf8_Utf8.len("&") > 0) then + newidx = __lua_lib_luautf8_Utf8.find(s, "&", idx, true); + else + if (idx >= __lua_lib_luautf8_Utf8.len(s)) then + newidx = nil; + else + newidx = idx + 1; + end; + end; + if (newidx ~= nil) then + local match = __lua_lib_luautf8_Utf8.sub(s, idx, newidx - 1); + ret:push(match); + idx = newidx + __lua_lib_luautf8_Utf8.len("&"); + else + ret:push(__lua_lib_luautf8_Utf8.sub(s, idx, __lua_lib_luautf8_Utf8.len(s))); + idx = nil; + end; + end; + local _this = ret:join("&"); + local idx = 1; + local ret = _hx_tab_array({}, 0); + while (idx ~= nil) do + local newidx = 0; + if (__lua_lib_luautf8_Utf8.len("<") > 0) then + newidx = __lua_lib_luautf8_Utf8.find(_this, "<", idx, true); + else + if (idx >= __lua_lib_luautf8_Utf8.len(_this)) then + newidx = nil; + else + newidx = idx + 1; + end; + end; + if (newidx ~= nil) then + local match = __lua_lib_luautf8_Utf8.sub(_this, idx, newidx - 1); + ret:push(match); + idx = newidx + __lua_lib_luautf8_Utf8.len("<"); + else + ret:push(__lua_lib_luautf8_Utf8.sub(_this, idx, __lua_lib_luautf8_Utf8.len(_this))); + idx = nil; + end; + end; + local _this = ret:join("<"); + local idx = 1; + local ret = _hx_tab_array({}, 0); + while (idx ~= nil) do + local newidx = 0; + if (__lua_lib_luautf8_Utf8.len(">") > 0) then + newidx = __lua_lib_luautf8_Utf8.find(_this, ">", idx, true); + else + if (idx >= __lua_lib_luautf8_Utf8.len(_this)) then + newidx = nil; + else + newidx = idx + 1; + end; + end; + if (newidx ~= nil) then + local match = __lua_lib_luautf8_Utf8.sub(_this, idx, newidx - 1); + ret:push(match); + idx = newidx + __lua_lib_luautf8_Utf8.len(">"); + else + ret:push(__lua_lib_luautf8_Utf8.sub(_this, idx, __lua_lib_luautf8_Utf8.len(_this))); + idx = nil; + end; + end; + do return ret:join(">") end; +end +__lua_Boot.isClass = function(o) + if (_G.type(o) ~= "table") then + do return false end; + else + do return o.__name__ end; + end; +end +__lua_Boot.isEnum = function(e) + if (_G.type(e) ~= "table") then + do return false end; + else + do return e.__ename__ end; + end; +end +__lua_Boot.getClass = function(o) + if (__lua_Boot.__instanceof(o, Array)) then + do return Array end; + else + if (__lua_Boot.__instanceof(o, String)) then + do return String end; + else + local cl = o.__class__; + if (cl ~= nil) then + do return cl end; + else + do return nil end; + end; + end; + end; +end +__lua_Boot.__instanceof = function(o,cl) + if (cl == nil) then + do return false end; + end; + local cl1 = cl; + if (cl1) == Array then + do return __lua_Boot.isArray(o) end; + elseif (cl1) == Bool then + do return _G.type(o) == "boolean" end; + elseif (cl1) == Dynamic then + do return o ~= nil end; + elseif (cl1) == Float then + do return _G.type(o) == "number" end; + elseif (cl1) == Int then + if (_G.type(o) == "number") then + do return _hx_bit_clamp(o) == o end; + else + do return false end; + end; + elseif (cl1) == String then + do return _G.type(o) == "string" end; + elseif (cl1) == _G.table then + do return _G.type(o) == "table" end; + elseif (cl1) == __lua_Thread then + do return _G.type(o) == "thread" end; + elseif (cl1) == __lua_UserData then + do return _G.type(o) == "userdata" end;else + if (((o ~= nil) and (_G.type(o) == "table")) and (_G.type(cl) == "table")) then + local tmp; + if (__lua_Boot.__instanceof(o, Array)) then + tmp = Array; + else + if (__lua_Boot.__instanceof(o, String)) then + tmp = String; + else + local cl = o.__class__; + tmp = (function() + local _hx_1 + if (cl ~= nil) then + _hx_1 = cl; else + _hx_1 = nil; end + return _hx_1 + end )(); + end; + end; + if (__lua_Boot.extendsOrImplements(tmp, cl)) then + do return true end; + end; + if ((function() + local _hx_2 + if (cl == Class) then + _hx_2 = o.__name__ ~= nil; else + _hx_2 = false; end + return _hx_2 + end )()) then + do return true end; + end; + if ((function() + local _hx_3 + if (cl == Enum) then + _hx_3 = o.__ename__ ~= nil; else + _hx_3 = false; end + return _hx_3 + end )()) then + do return true end; + end; + do return o.__enum__ == cl end; + else + do return false end; + end; end; +end +__lua_Boot.isArray = function(o) + if (_G.type(o) == "table") then + if ((o.__enum__ == nil) and (_G.getmetatable(o) ~= nil)) then + do return _G.getmetatable(o).__index == Array.prototype end; + else + do return false end; + end; + else + do return false end; + end; +end +__lua_Boot.inheritsFrom = function(o,cl) + while ((_G.getmetatable(o) ~= nil) and (_G.getmetatable(o).__index ~= nil)) do + if (_G.getmetatable(o).__index == cl.prototype) then + do return true end; + end; + o = _G.getmetatable(o).__index; + end; + do return false end; +end +__lua_Boot.__cast = function(o,t) + if ((o == nil) or __lua_Boot.__instanceof(o, t)) then + do return o end; + else + _G.error(__haxe_Exception.thrown(Std.string(Std.string(Std.string("Cannot cast ") .. Std.string(Std.string(o))) .. Std.string(" to ")) .. Std.string(Std.string(t))),0); + end; +end +__lua_Boot.defArray = function(tab,length) + if (length == nil) then + length = _hx_table.maxn(tab); + if (length > 0) then + local head = tab[1]; + _G.table.remove(tab, 1); + tab[0] = head; + do return _hx_tab_array(tab, length) end; + else + do return _hx_tab_array({}, 0) end; + end; + else + do return _hx_tab_array(tab, length) end; + end; +end +__lua_Boot.tableToObject = function(t) + do return _hx_o(t) end; +end +__lua_Boot.dateStr = function(date) + local m = date:getMonth() + 1; + local d = date:getDate(); + local h = date:getHours(); + local mi = date:getMinutes(); + local s = date:getSeconds(); + do return Std.string(Std.string(Std.string(Std.string(Std.string(Std.string(Std.string(Std.string(Std.string(Std.string(date:getFullYear()) .. Std.string("-")) .. Std.string(((function() + local _hx_1 + if (m < 10) then + _hx_1 = Std.string("0") .. Std.string(m); else + _hx_1 = Std.string("") .. Std.string(m); end + return _hx_1 + end )()))) .. Std.string("-")) .. Std.string(((function() + local _hx_2 + if (d < 10) then + _hx_2 = Std.string("0") .. Std.string(d); else + _hx_2 = Std.string("") .. Std.string(d); end + return _hx_2 + end )()))) .. Std.string(" ")) .. Std.string(((function() + local _hx_3 + if (h < 10) then + _hx_3 = Std.string("0") .. Std.string(h); else + _hx_3 = Std.string("") .. Std.string(h); end + return _hx_3 + end )()))) .. Std.string(":")) .. Std.string(((function() + local _hx_4 + if (mi < 10) then + _hx_4 = Std.string("0") .. Std.string(mi); else + _hx_4 = Std.string("") .. Std.string(mi); end + return _hx_4 + end )()))) .. Std.string(":")) .. Std.string(((function() + local _hx_5 + if (s < 10) then + _hx_5 = Std.string("0") .. Std.string(s); else + _hx_5 = Std.string("") .. Std.string(s); end + return _hx_5 + end )())) end; +end +__lua_Boot.clampInt32 = function(x) + do return _hx_bit_clamp(x) end; +end +__lua_Boot.strDate = function(s) + local _g = __lua_lib_luautf8_Utf8.len(s); + if (_g) == 8 then + local idx = 1; + local ret = _hx_tab_array({}, 0); + while (idx ~= nil) do + local newidx = 0; + if (__lua_lib_luautf8_Utf8.len(":") > 0) then + newidx = __lua_lib_luautf8_Utf8.find(s, ":", idx, true); + else + if (idx >= __lua_lib_luautf8_Utf8.len(s)) then + newidx = nil; + else + newidx = idx + 1; + end; + end; + if (newidx ~= nil) then + local match = __lua_lib_luautf8_Utf8.sub(s, idx, newidx - 1); + ret:push(match); + idx = newidx + __lua_lib_luautf8_Utf8.len(":"); + else + ret:push(__lua_lib_luautf8_Utf8.sub(s, idx, __lua_lib_luautf8_Utf8.len(s))); + idx = nil; + end; + end; + local k = ret; + local t = ((_G.tonumber(k[0]) * 3600000.) + (_G.tonumber(k[1]) * 60000.)) + (_G.tonumber(k[2]) * 1000.); + local d = _hx_e(); + _G.setmetatable(d, _hx_o({__fields__={__index=true},__index=Date.prototype})); + d.t = t / 1000; + d.d = _G.os.date("*t", Std.int(d.t)); + d.dUTC = _G.os.date("!*t", Std.int(d.t)); + do return d end; + elseif (_g) == 10 then + local idx = 1; + local ret = _hx_tab_array({}, 0); + while (idx ~= nil) do + local newidx = 0; + if (__lua_lib_luautf8_Utf8.len("-") > 0) then + newidx = __lua_lib_luautf8_Utf8.find(s, "-", idx, true); + else + if (idx >= __lua_lib_luautf8_Utf8.len(s)) then + newidx = nil; + else + newidx = idx + 1; + end; + end; + if (newidx ~= nil) then + local match = __lua_lib_luautf8_Utf8.sub(s, idx, newidx - 1); + ret:push(match); + idx = newidx + __lua_lib_luautf8_Utf8.len("-"); + else + ret:push(__lua_lib_luautf8_Utf8.sub(s, idx, __lua_lib_luautf8_Utf8.len(s))); + idx = nil; + end; + end; + local k = ret; + do return Date.new(_G.tonumber(k[0]), _G.tonumber(k[1]) - 1, _G.tonumber(k[2]), 0, 0, 0) end; + elseif (_g) == 19 then + local idx = 1; + local ret = _hx_tab_array({}, 0); + while (idx ~= nil) do + local newidx = 0; + if (__lua_lib_luautf8_Utf8.len(" ") > 0) then + newidx = __lua_lib_luautf8_Utf8.find(s, " ", idx, true); + else + if (idx >= __lua_lib_luautf8_Utf8.len(s)) then + newidx = nil; + else + newidx = idx + 1; + end; + end; + if (newidx ~= nil) then + local match = __lua_lib_luautf8_Utf8.sub(s, idx, newidx - 1); + ret:push(match); + idx = newidx + __lua_lib_luautf8_Utf8.len(" "); + else + ret:push(__lua_lib_luautf8_Utf8.sub(s, idx, __lua_lib_luautf8_Utf8.len(s))); + idx = nil; + end; + end; + local k = ret; + local _this = k[0]; + local idx = 1; + local ret = _hx_tab_array({}, 0); + while (idx ~= nil) do + local newidx = 0; + if (__lua_lib_luautf8_Utf8.len("-") > 0) then + newidx = __lua_lib_luautf8_Utf8.find(_this, "-", idx, true); + else + if (idx >= __lua_lib_luautf8_Utf8.len(_this)) then + newidx = nil; + else + newidx = idx + 1; + end; + end; + if (newidx ~= nil) then + local match = __lua_lib_luautf8_Utf8.sub(_this, idx, newidx - 1); + ret:push(match); + idx = newidx + __lua_lib_luautf8_Utf8.len("-"); + else + ret:push(__lua_lib_luautf8_Utf8.sub(_this, idx, __lua_lib_luautf8_Utf8.len(_this))); + idx = nil; + end; + end; + local y = ret; + local _this = k[1]; + local idx = 1; + local ret = _hx_tab_array({}, 0); + while (idx ~= nil) do + local newidx = 0; + if (__lua_lib_luautf8_Utf8.len(":") > 0) then + newidx = __lua_lib_luautf8_Utf8.find(_this, ":", idx, true); + else + if (idx >= __lua_lib_luautf8_Utf8.len(_this)) then + newidx = nil; + else + newidx = idx + 1; + end; + end; + if (newidx ~= nil) then + local match = __lua_lib_luautf8_Utf8.sub(_this, idx, newidx - 1); + ret:push(match); + idx = newidx + __lua_lib_luautf8_Utf8.len(":"); + else + ret:push(__lua_lib_luautf8_Utf8.sub(_this, idx, __lua_lib_luautf8_Utf8.len(_this))); + idx = nil; + end; + end; + local t = ret; + do return Date.new(_G.tonumber(y[0]), _G.tonumber(y[1]) - 1, _G.tonumber(y[2]), _G.tonumber(t[0]), _G.tonumber(t[1]), _G.tonumber(t[2])) end;else + _G.error(__haxe_Exception.thrown(Std.string("Invalid date format : ") .. Std.string(s)),0); end; +end +__lua_Boot.extendsOrImplements = function(cl1,cl2) + if ((cl1 == nil) or (cl2 == nil)) then + do return false end; + else + if (cl1 == cl2) then + do return true end; + else + if (cl1.__interfaces__ ~= nil) then + local intf = cl1.__interfaces__; + local _g = 1; + local _g1 = _hx_table.maxn(intf) + 1; + while (_g < _g1) do + _g = _g + 1; + local i = _g - 1; + if (__lua_Boot.extendsOrImplements(intf[i], cl2)) then + do return true end; + end; + end; + end; + end; + end; + do return __lua_Boot.extendsOrImplements(cl1.__super__, cl2) end; +end +__lua_Boot.shellEscapeCmd = function(cmd,args) + if (args ~= nil) then + if (Sys.systemName() == "Windows") then + local _g = _hx_tab_array({}, 0); + local _g1 = 0; + local _g2 = _hx_tab_array({[0]=StringTools.replace(cmd, "/", "\\")}, 1):concat(args); + while (_g1 < _g2.length) do + local a = _g2[_g1]; + _g1 = _g1 + 1; + _g:push(__haxe_SysTools.quoteWinArg(a, true)); + end; + cmd = _g:join(" "); + else + local f = __haxe_SysTools.quoteUnixArg; + local _g = _hx_tab_array({}, 0); + local _g1 = 0; + local _g2 = _hx_tab_array({[0]=cmd}, 1):concat(args); + while (_g1 < _g2.length) do + local i = _g2[_g1]; + _g1 = _g1 + 1; + _g:push(f(i)); + end; + cmd = _g:join(" "); + end; + end; + do return cmd end; +end +__lua_Boot.tempFile = function() + if (Sys.systemName() == "Windows") then + do return __haxe_io_Path.join(_hx_tab_array({[0]=_G.os.getenv("TMP"), _G.os.tmpname()}, 2)) end; + else + do return _G.os.tmpname() end; + end; +end +__lua_Boot.os_patterns = nil +__lua_Boot.get_os_patterns = function() + if (__lua_Boot.os_patterns == nil) then + local _g = __haxe_ds_StringMap.new(); + local value = _hx_tab_array({[0]="windows", "^mingw", "^cygwin"}, 3); + if (value == nil) then + _g.h.Windows = __haxe_ds_StringMap.tnull; + else + _g.h.Windows = value; + end; + local value = _hx_tab_array({[0]="linux"}, 1); + if (value == nil) then + _g.h.Linux = __haxe_ds_StringMap.tnull; + else + _g.h.Linux = value; + end; + local value = _hx_tab_array({[0]="mac", "darwin", "osx"}, 3); + if (value == nil) then + _g.h.Mac = __haxe_ds_StringMap.tnull; + else + _g.h.Mac = value; + end; + local value = _hx_tab_array({[0]="bsd$"}, 1); + if (value == nil) then + _g.h.BSD = __haxe_ds_StringMap.tnull; + else + _g.h.BSD = value; + end; + local value = _hx_tab_array({[0]="SunOS"}, 1); + if (value == nil) then + _g.h.Solaris = __haxe_ds_StringMap.tnull; + else + _g.h.Solaris = value; + end; + __lua_Boot.os_patterns = _g; + end; + do return __lua_Boot.os_patterns end; +end +__lua_Boot.systemName = function() + local os = nil; + if ((jit ~= nil) and (jit.os ~= nil)) then + os = jit.os; + os = __lua_lib_luautf8_Utf8.lower(os); + else + local popen_status = false; + local popen_result = nil; + popen_status, popen_result = pcall(_G.io.popen, ''); + if (popen_status) then + popen_result:close(); + os = __lua_lib_luautf8_Utf8.lower(_G.io.popen("uname -s", "r"):read("*l")); + else + os = __lua_lib_luautf8_Utf8.lower(_G.os.getenv("OS")); + end; + end; + local k = __lua_Boot.get_os_patterns():keys(); + while (k:hasNext()) do + local k = k:next(); + local _g = 0; + local ret = __lua_Boot.get_os_patterns().h[k]; + if (ret == __haxe_ds_StringMap.tnull) then + ret = nil; + end; + local _g1 = ret; + while (_g < _g1.length) do + local p = _g1[_g]; + _g = _g + 1; + if (_G.string.match(os, p) ~= nil) then + do return k end; + end; + end; + end; + do return nil end; +end + +__lua_UserData.new = {} +_hxClasses["lua.UserData"] = __lua_UserData +__lua_UserData.__name__ = "lua.UserData" + +__lua_HaxeIterator.new = function(f) + local self = _hx_new(__lua_HaxeIterator.prototype) + __lua_HaxeIterator.super(self,f) + return self +end +__lua_HaxeIterator.super = function(self,f) + self.f = _hx_funcToField(f); + self.state = f(); +end +_hxClasses["lua.HaxeIterator"] = __lua_HaxeIterator +__lua_HaxeIterator.__name__ = "lua.HaxeIterator" +__lua_HaxeIterator.prototype = _hx_e(); +__lua_HaxeIterator.prototype.state= nil; +__lua_HaxeIterator.prototype.f= nil; +__lua_HaxeIterator.prototype.next = function(self) + local ret = self.state; + self.state = self:f(); + do return ret end +end +__lua_HaxeIterator.prototype.hasNext = function(self) + do return self.state ~= nil end +end + +__lua_HaxeIterator.prototype.__class__ = __lua_HaxeIterator + +__lua__Io_IoType_Impl_.new = {} +_hxClasses["lua._Io.IoType_Impl_"] = __lua__Io_IoType_Impl_ +__lua__Io_IoType_Impl_.__name__ = "lua._Io.IoType_Impl_" +__lua__Io_IoType_Impl_.toString = function(this1) + do return this1 end; +end + +__lua_Lib.new = {} +_hxClasses["lua.Lib"] = __lua_Lib +__lua_Lib.__name__ = "lua.Lib" +__lua_Lib.println = function(v) + _G.print(Std.string(v)); +end +__lua_Lib.print = function(v) + _G.io.write(Std.string(v)); + _G.io.flush(); +end +__lua_Lib.patternQuote = function(str) + do return _G.string.gsub(str, "[%(%)%.%%%+%-%*%?%[%]%^%$]", function(c) + do return Std.string("%") .. Std.string(c) end; + end) end; +end +__lua_Lib.fillArray = function(itr) + local i = nil; + local ret = _hx_tab_array({}, 0); + while (true) do + i = itr(); + if (not (i ~= nil)) then + break; + end; + ret:push(i); + end; + do return ret end; +end +__lua_Lib.isShellAvailable = function() + local ret = _G.os.execute(); + if (_G.type(ret) == "bool") then + do return ret end; + else + do return ret ~= 0 end; + end; +end + +__lua__NativeIterator_NativeIterator_Impl_.new = {} +_hxClasses["lua._NativeIterator.NativeIterator_Impl_"] = __lua__NativeIterator_NativeIterator_Impl_ +__lua__NativeIterator_NativeIterator_Impl_.__name__ = "lua._NativeIterator.NativeIterator_Impl_" +__lua__NativeIterator_NativeIterator_Impl_._new = function(f) + local this1 = f; + do return this1 end; +end +__lua__NativeIterator_NativeIterator_Impl_.fromF = function(f) + do return __lua__NativeIterator_NativeIterator_Impl_._new(f) end; +end +__lua__NativeIterator_NativeIterator_Impl_.toIterator = function(this1) + do return __lua_HaxeIterator.new(this1) end; +end + +__lua_PairTools.new = {} +_hxClasses["lua.PairTools"] = __lua_PairTools +__lua_PairTools.__name__ = "lua.PairTools" +__lua_PairTools.ipairsEach = function(table,func) + for i,v in _G.ipairs(table) do func(i,v) end; +end +__lua_PairTools.pairsEach = function(table,func) + for k,v in _G.pairs(table) do func(k,v) end; +end +__lua_PairTools.ipairsMap = function(table,func) + local ret = ({}); + for i,v in _G.ipairs(table) do ret[i] = func(i,v) end; + do return ret end; +end +__lua_PairTools.pairsMap = function(table,func) + local ret = ({}); + for k,v in _G.pairs(table) do ret[k] = func(k,v) end; + do return ret end; +end +__lua_PairTools.ipairsFold = function(table,func,seed) + for i,v in _G.ipairs(table) do seed = func(i,v,seed) end; + do return seed end; +end +__lua_PairTools.pairsFold = function(table,func,seed) + for k,v in _G.pairs(table) do seed = func(k,v,seed) end; + do return seed end; +end +__lua_PairTools.ipairsConcat = function(table1,table2) + local ret = ({}); + __lua_PairTools.ipairsFold(table1, function(a,b,c) + c[a] = b; + do return c end; + end, ret); + local size = _hx_table.maxn(ret); + __lua_PairTools.ipairsFold(table2, function(a,b,c) + c[a + size] = b; + do return c end; + end, ret); + do return ret end; +end +__lua_PairTools.pairsMerge = function(table1,table2) + local ret = __lua_PairTools.copy(table1); + __lua_PairTools.pairsEach(table2, function(a,b) + ret[a] = b; + end); + do return ret end; +end +__lua_PairTools.ipairsExist = function(table,func) + for k,v in _G.ipairs(table) do if func(k,v) then return true end end; +end +__lua_PairTools.pairsExist = function(table,func) + for k,v in _G.pairs(table) do if func(k,v) then return true end end; +end +__lua_PairTools.copy = function(table1) + local ret = ({}); + for k,v in _G.pairs(table1) do ret[k] = v end; + do return ret end; +end +__lua_PairTools.pairsIterator = function(table) + local _hx_1_p_next, _hx_1_p_table, _hx_1_p_index = _G.pairs(table); + local next = _hx_1_p_next; + local i = _hx_1_p_index; + do return _hx_o({__fields__={next=true,hasNext=true},next=function(self) + local _hx_2_res_index, _hx_2_res_value = next(table, i); + i = _hx_2_res_index; + do return _hx_o({__fields__={index=true,value=true},index=_hx_2_res_index,value=_hx_2_res_value}) end; + end,hasNext=function(self) + do return _G.select(2, _G.next(table, i)) ~= nil end; + end}) end; +end +__lua_PairTools.ipairsIterator = function(table) + local _hx_1_p_next, _hx_1_p_table, _hx_1_p_index = _G.ipairs(table); + local next = _hx_1_p_next; + local i = _hx_1_p_index; + do return _hx_o({__fields__={next=true,hasNext=true},next=function(self) + local _hx_2_res_index, _hx_2_res_value = next(table, i); + i = _hx_2_res_index; + do return _hx_o({__fields__={index=true,value=true},index=_hx_2_res_index,value=_hx_2_res_value}) end; + end,hasNext=function(self) + do return _G.select(2, next(table, i)) ~= nil end; + end}) end; +end + +__lua_Thread.new = {} +_hxClasses["lua.Thread"] = __lua_Thread +__lua_Thread.__name__ = "lua.Thread" + +__sys_FileSystem.new = {} +_hxClasses["sys.FileSystem"] = __sys_FileSystem +__sys_FileSystem.__name__ = "sys.FileSystem" +__sys_FileSystem.exists = function(path) + if (path == nil) then + do return false end; + else + local _hx_1_res_result, _hx_1_res_message = __lua_lib_luv_fs_FileSystem.fs_stat(path); + do return _hx_1_res_result ~= nil end; + end; +end +__sys_FileSystem.rename = function(path,newPath) + local _hx_1_ret_success, _hx_1_ret_message = _G.os.rename(path, newPath); + if (not _hx_1_ret_success) then + _G.error(__haxe_Exception.thrown(_hx_1_ret_message),0); + end; +end +__sys_FileSystem.stat = function(path) + local _hx_1_ls_result, _hx_1_ls_message = __lua_lib_luv_fs_FileSystem.fs_stat(path); + if (_hx_1_ls_result == nil) then + _G.error(__haxe_Exception.thrown(_hx_1_ls_message),0); + end; + local l = _hx_1_ls_result; + local l1 = l.gid; + local l2 = l.uid; + local l3 = l.rdev; + local l4 = l.size; + local l5 = l.nlink; + local t = l.mtime.sec + (l.mtime.nsec / 1000000); + local d = _hx_e(); + _G.setmetatable(d, _hx_o({__fields__={__index=true},__index=Date.prototype})); + d.t = t / 1000; + d.d = _G.os.date("*t", Std.int(d.t)); + d.dUTC = _G.os.date("!*t", Std.int(d.t)); + local l6 = l.mode; + local l7 = l.ino; + local l8 = l.dev; + local t = l.ctime.sec + (l.ctime.nsec / 1000000); + local d1 = _hx_e(); + _G.setmetatable(d1, _hx_o({__fields__={__index=true},__index=Date.prototype})); + d1.t = t / 1000; + d1.d = _G.os.date("*t", Std.int(d1.t)); + d1.dUTC = _G.os.date("!*t", Std.int(d1.t)); + local t = l.atime.sec + (l.atime.nsec / 1000000); + local d2 = _hx_e(); + _G.setmetatable(d2, _hx_o({__fields__={__index=true},__index=Date.prototype})); + d2.t = t / 1000; + d2.d = _G.os.date("*t", Std.int(d2.t)); + d2.dUTC = _G.os.date("!*t", Std.int(d2.t)); + do return _hx_o({__fields__={gid=true,uid=true,rdev=true,size=true,nlink=true,mtime=true,mode=true,ino=true,dev=true,ctime=true,atime=true},gid=l1,uid=l2,rdev=l3,size=l4,nlink=l5,mtime=d,mode=l6,ino=l7,dev=l8,ctime=d1,atime=d2}) end; +end +__sys_FileSystem.fullPath = function(relPath) + local tmp; + if (__haxe_io_Path.isAbsolute(relPath)) then + tmp = relPath; + else + local pwd = __lua_lib_luv_Misc.cwd(); + tmp = (function() + local _hx_1 + if (pwd == nil) then + _hx_1 = relPath; else + _hx_1 = __haxe_io_Path.join(_hx_tab_array({[0]=pwd, relPath}, 2)); end + return _hx_1 + end )(); + end; + do return __lua_lib_luv_fs_FileSystem.fs_realpath(__haxe_io_Path.normalize(tmp)) end; +end +__sys_FileSystem.absolutePath = function(relPath) + if (__haxe_io_Path.isAbsolute(relPath)) then + do return relPath end; + end; + local pwd = __lua_lib_luv_Misc.cwd(); + if (pwd == nil) then + do return relPath end; + end; + do return __haxe_io_Path.join(_hx_tab_array({[0]=pwd, relPath}, 2)) end; +end +__sys_FileSystem.deleteFile = function(path) + local _hx_1_ret_success, _hx_1_ret_message = _G.os.remove(path); + if (not _hx_1_ret_success) then + _G.error(__haxe_Exception.thrown(_hx_1_ret_message),0); + end; +end +__sys_FileSystem.readDirectory = function(path) + local scandir = __lua_lib_luv_fs_FileSystem.fs_scandir(path); + local itr = function() + local next = __lua_lib_luv_fs_FileSystem.fs_scandir_next(scandir); + do return next end; + end; + do return __lua_Lib.fillArray(itr) end; +end +__sys_FileSystem.isDirectory = function(path) + local result = __lua_lib_luv_fs_FileSystem.fs_stat(path); + if (result == nil) then + do return false end; + else + do return result.type == "directory" end; + end; +end +__sys_FileSystem.deleteDirectory = function(path) + local _hx_1_ret_result, _hx_1_ret_message = __lua_lib_luv_fs_FileSystem.fs_rmdir(path); + if (_hx_1_ret_result == nil) then + _G.error(__haxe_Exception.thrown(_hx_1_ret_message),0); + end; +end +__sys_FileSystem.createDirectory = function(path) + local path = __haxe_io_Path.addTrailingSlash(path); + local _p = nil; + local parts = _hx_tab_array({}, 0); + while (true) do + _p = __haxe_io_Path.directory(path); + if (not (path ~= _p)) then + break; + end; + parts:unshift(path); + path = _p; + end; + local _g = 0; + while (_g < parts.length) do + local part = parts[_g]; + _g = _g + 1; + if (((__lua_lib_luautf8_Utf8.byte(part, (__lua_lib_luautf8_Utf8.len(part) - 1) + 1) ~= 58) and not __sys_FileSystem.exists(part)) and not __lua_lib_luv_fs_FileSystem.fs_mkdir(part, 511)) then + _G.error(__haxe_Exception.thrown(Std.string("Could not create directory:") .. Std.string(part)),0); + end; + end; +end + +__sys_io_FileInput.new = function(f) + local self = _hx_new(__sys_io_FileInput.prototype) + __sys_io_FileInput.super(self,f) + return self +end +__sys_io_FileInput.super = function(self,f) + if (f == nil) then + _G.error(__haxe_Exception.thrown(Std.string("Invalid filehandle : ") .. Std.string(Std.string(f))),0); + end; + self:set_bigEndian(__lua_Boot.platformBigEndian); + self.f = f; + self._eof = false; +end +_hxClasses["sys.io.FileInput"] = __sys_io_FileInput +__sys_io_FileInput.__name__ = "sys.io.FileInput" +__sys_io_FileInput.prototype = _hx_e(); +__sys_io_FileInput.prototype.f= nil; +__sys_io_FileInput.prototype._eof= nil; +__sys_io_FileInput.prototype.seek = function(self,p,pos) + local arg; + local arg1 = pos[1]; + if (arg1) == 0 then + arg = "set"; + elseif (arg1) == 1 then + arg = "cur"; + elseif (arg1) == 2 then + arg = "end"; end; + self._eof = false; + self.f:seek(arg, p); +end +__sys_io_FileInput.prototype.tell = function(self) + do return self.f:seek() end +end +__sys_io_FileInput.prototype.eof = function(self) + do return self._eof end +end +__sys_io_FileInput.prototype.readByte = function(self) + local byte = self.f:read(1); + if (byte == nil) then + self._eof = true; + _G.error(__haxe_Exception.thrown(__haxe_io_Eof.new()),0); + end; + do return _G.string.byte(byte) end +end +__sys_io_FileInput.prototype.readBytes = function(self,s,pos,len) + if (self._eof) then + _G.error(__haxe_Exception.thrown(__haxe_io_Eof.new()),0); + end; + do return __haxe_io_Input.prototype.readBytes(self,s,pos,len) end +end +__sys_io_FileInput.prototype.close = function(self) + self.f:close(); +end +__sys_io_FileInput.prototype.readAll = function(self,bufsize) + if (bufsize == nil) then + bufsize = 16384; + end; + local buf = __haxe_io_Bytes.alloc(bufsize); + local total = __haxe_io_BytesBuffer.new(); + local _hx_status, _hx_result = pcall(function() + + while (true) do + local len = self:readBytes(buf, 0, bufsize); + if (len == 0) then + break; + end; + if ((len < 0) or (len > buf.length)) then + _G.error(__haxe_Exception.thrown(__haxe_io_Error.OutsideBounds),0); + end; + local b1 = total.b; + local b2 = buf.b; + local _g = 0; + local _g1 = len; + while (_g < _g1) do + _g = _g + 1; + local i = _g - 1; + total.b:push(b2[i]); + end; + end; + return _hx_pcall_default + end) + if not _hx_status and _hx_result == "_hx_pcall_break" then + elseif not _hx_status then + local _g = _hx_result; + if (__lua_Boot.__instanceof(__haxe_Exception.caught(_g):unwrap(), __haxe_io_Eof)) then + self._eof = true; + else + _G.error(_g,0); + end; + elseif _hx_result ~= _hx_pcall_default then + return _hx_result + end; + do return total:getBytes() end +end + +__sys_io_FileInput.prototype.__class__ = __sys_io_FileInput +__sys_io_FileInput.__super__ = __haxe_io_Input +setmetatable(__sys_io_FileInput.prototype,{__index=__haxe_io_Input.prototype}) +setmetatable(__sys_io_FileInput.prototype.__properties__,{__index=__haxe_io_Input.prototype.__properties__}) + +__sys_io_FileOutput.new = function(f) + local self = _hx_new(__sys_io_FileOutput.prototype) + __sys_io_FileOutput.super(self,f) + return self +end +__sys_io_FileOutput.super = function(self,f) + if (f == nil) then + _G.error(__haxe_Exception.thrown(Std.string("Invalid filehandle : ") .. Std.string(Std.string(f))),0); + end; + self.f = f; +end +_hxClasses["sys.io.FileOutput"] = __sys_io_FileOutput +__sys_io_FileOutput.__name__ = "sys.io.FileOutput" +__sys_io_FileOutput.prototype = _hx_e(); +__sys_io_FileOutput.prototype.f= nil; +__sys_io_FileOutput.prototype.seek = function(self,p,pos) + local arg; + local arg1 = pos[1]; + if (arg1) == 0 then + arg = "set"; + elseif (arg1) == 1 then + arg = "cur"; + elseif (arg1) == 2 then + arg = "end"; end; + self.f:seek(arg, p); +end +__sys_io_FileOutput.prototype.tell = function(self) + do return self.f:seek() end +end +__sys_io_FileOutput.prototype.writeByte = function(self,c) + self.f:write(__lua_lib_luautf8_Utf8.char(c)); +end +__sys_io_FileOutput.prototype.writeBytes = function(self,s,pos,len) + self.f:write(s:getString(pos, len)); + do return s.length end +end +__sys_io_FileOutput.prototype.close = function(self) + self.f:close(); +end + +__sys_io_FileOutput.prototype.__class__ = __sys_io_FileOutput +__sys_io_FileOutput.__super__ = __haxe_io_Output +setmetatable(__sys_io_FileOutput.prototype,{__index=__haxe_io_Output.prototype}) +setmetatable(__sys_io_FileOutput.prototype.__properties__,{__index=__haxe_io_Output.prototype.__properties__}) +_hxClasses["sys.io.FileSeek"] = __sys_io_FileSeek; +_hxClasses["sys.io.FileSeek"] = { __ename__ = "sys.io.FileSeek", __constructs__ = _hx_tab_array({[0]="SeekBegin","SeekCur","SeekEnd"},3)} +__sys_io_FileSeek = _hxClasses["sys.io.FileSeek"]; +__sys_io_FileSeek.SeekBegin = _hx_tab_array({[0]="SeekBegin",0,__enum__ = __sys_io_FileSeek},2) + +__sys_io_FileSeek.SeekCur = _hx_tab_array({[0]="SeekCur",1,__enum__ = __sys_io_FileSeek},2) + +__sys_io_FileSeek.SeekEnd = _hx_tab_array({[0]="SeekEnd",2,__enum__ = __sys_io_FileSeek},2) + +__sys_io_FileSeek.__empty_constructs__ = _hx_tab_array({[0] = __sys_io_FileSeek.SeekBegin,__sys_io_FileSeek.SeekCur,__sys_io_FileSeek.SeekEnd}, 3) + +__sys_io_Process.new = function(cmd,args,detached) + local self = _hx_new(__sys_io_Process.prototype) + __sys_io_Process.super(self,cmd,args,detached) + return self +end +__sys_io_Process.super = function(self,cmd,args,detached) + local _gthis = self; + if (detached) then + _G.error(__haxe_Exception.thrown("Detached process is not supported on this platform"),0); + end; + local _stdout = __lua_lib_luv_Pipe.new_pipe(false); + local _stderr = __lua_lib_luv_Pipe.new_pipe(false); + local _stdin = __lua_lib_luv_Pipe.new_pipe(false); + self.stdout = __sys_io__Process_ProcessInput.new(_stdout); + self.stderr = __sys_io__Process_ProcessInput.new(_stderr); + self.stdin = __sys_io__Process_ProcessOutput.new(_stdin); + local stdio = ({_stdin,_stdout,_stderr}); + local opt = _hx_o({__fields__={args=true,stdio=true},args=__sys_io_Process.setArgs(cmd, args),stdio=stdio}); + local _hx_1_p_handle, _hx_1_p_pid = __lua_lib_luv_Process.spawn(__sys_io_Process._shell, opt, function(code,signal) + _gthis._code = code; + if (not _gthis._handle:is_closing()) then + _gthis._handle:close(); + end; + _stdin:shutdown(function() + _stdin:close(); + end); + _stderr:shutdown(function() + _stderr:close(); + end); + _stdout:shutdown(function() + _stdout:close(); + end); + end); + self._handle = _hx_1_p_handle; + if (_hx_1_p_handle == nil) then + _G.error(__haxe_Exception.thrown(_hx_1_p_pid),0); + end; + self._pid = _hx_1_p_pid; +end +_hxClasses["sys.io.Process"] = __sys_io_Process +__sys_io_Process.__name__ = "sys.io.Process" +__sys_io_Process.setArgs = function(cmd,args) + local pargs = ({}); + local idx = 1; + if (__sys_FileSystem.exists(cmd)) then + cmd = Std.string(Std.string("\"") .. Std.string(cmd)) .. Std.string("\""); + end; + local all = _hx_tab_array({[0]=cmd}, 1); + if (args ~= nil) then + local _g = 0; + while (_g < args.length) do + local a = args[_g]; + _g = _g + 1; + all:push(__sys_io_Process.argQuote(a)); + end; + end; + if (Sys.systemName() == "Windows") then + idx = idx + 1; + pargs[idx - 1] = "/s"; + idx = idx + 1; + pargs[idx - 1] = "/c"; + idx = idx + 1; + pargs[idx - 1] = all:join(" "); + else + idx = idx + 1; + pargs[idx - 1] = "-c"; + idx = idx + 1; + pargs[idx - 1] = all:join(" "); + end; + do return pargs end; +end +__sys_io_Process.prototype = _hx_e(); +__sys_io_Process.prototype._pid= nil; +__sys_io_Process.prototype._handle= nil; +__sys_io_Process.prototype._code= nil; +__sys_io_Process.prototype.closef= nil; +__sys_io_Process.prototype.stdout= nil; +__sys_io_Process.prototype.stderr= nil; +__sys_io_Process.prototype.stdin= nil; +__sys_io_Process.prototype.getPid = function(self) + do return self._pid end +end +__sys_io_Process.prototype.close = function(self) + if (not self._handle:is_closing()) then + self._handle:close(); + end; +end +__sys_io_Process.prototype.exitCode = function(self,block) + if (block == nil) then + block = true; + end; + if (not block) then + do return self._code end; + end; + while (self._handle:is_active()) do + __lua_lib_luv_Loop.run(); + end; + do return self._code end +end +__sys_io_Process.prototype.kill = function(self) + self._handle:kill("sigterm"); +end + +__sys_io_Process.prototype.__class__ = __sys_io_Process + +__sys_io__Process_ProcessInput.new = function(pipe) + local self = _hx_new(__sys_io__Process_ProcessInput.prototype) + __sys_io__Process_ProcessInput.super(self,pipe) + return self +end +__sys_io__Process_ProcessInput.super = function(self,pipe) + self.b = pipe; + self._eof = false; +end +_hxClasses["sys.io._Process.ProcessInput"] = __sys_io__Process_ProcessInput +__sys_io__Process_ProcessInput.__name__ = "sys.io._Process.ProcessInput" +__sys_io__Process_ProcessInput.prototype = _hx_e(); +__sys_io__Process_ProcessInput.prototype.b= nil; +__sys_io__Process_ProcessInput.prototype.buf= nil; +__sys_io__Process_ProcessInput.prototype.idx= nil; +__sys_io__Process_ProcessInput.prototype._eof= nil; +__sys_io__Process_ProcessInput.prototype.eof = function(self) + do return self._eof end +end +__sys_io__Process_ProcessInput.prototype.readBytes = function(self,s,pos,len) + if (self._eof) then + _G.error(__haxe_Exception.thrown(__haxe_io_Eof.new()),0); + end; + do return __haxe_io_Input.prototype.readBytes(self,s,pos,len) end +end +__sys_io__Process_ProcessInput.prototype.readByte = function(self) + local _gthis = self; + local err_str = nil; + if ((self.buf == nil) or (self.idx >= _G.string.len(self.buf))) then + self.buf = nil; + self.idx = 0; + local pending = true; + self.b:read_start(function(err,chunk) + if (chunk ~= nil) then + if (_gthis.buf ~= nil) then + _gthis.buf = Std.string(_gthis.buf) .. Std.string(chunk); + else + _gthis.buf = chunk; + end; + end; + if (err ~= nil) then + err_str = err; + end; + pending = false; + end); + while (pending) do + __lua_lib_luv_Loop.run(); + end; + end; + if (self.buf == nil) then + self._eof = true; + _G.error(__haxe_Exception.thrown(__haxe_io_Eof.new()),0); + end; + if (err_str ~= nil) then + _G.error(__haxe_Exception.thrown(err_str),0); + end; + local code = _G.string.byte(self.buf, (function() + local _hx_obj = self; + local _hx_fld = 'idx'; + _hx_obj[_hx_fld] = _hx_obj[_hx_fld] + 1; + return _hx_obj[_hx_fld]; + end)()); + do return code end +end +__sys_io__Process_ProcessInput.prototype.readAll = function(self,bufsize) + if (bufsize == nil) then + bufsize = 16384; + end; + local buf = __haxe_io_Bytes.alloc(bufsize); + local total = __haxe_io_BytesBuffer.new(); + local _hx_status, _hx_result = pcall(function() + + while (true) do + local len = self:readBytes(buf, 0, bufsize); + if (len ~= 0) then + if ((len < 0) or (len > buf.length)) then + _G.error(__haxe_Exception.thrown(__haxe_io_Error.OutsideBounds),0); + end; + local b1 = total.b; + local b2 = buf.b; + local _g = 0; + local _g1 = len; + while (_g < _g1) do + _g = _g + 1; + local i = _g - 1; + total.b:push(b2[i]); + end; + end; + if (len < bufsize) then + break; + end; + end; + return _hx_pcall_default + end) + if not _hx_status and _hx_result == "_hx_pcall_break" then + elseif not _hx_status then + local _g = _hx_result; + if (__lua_Boot.__instanceof(__haxe_Exception.caught(_g):unwrap(), __haxe_io_Eof)) then + self._eof = true; + else + _G.error(_g,0); + end; + elseif _hx_result ~= _hx_pcall_default then + return _hx_result + end; + do return total:getBytes() end +end +__sys_io__Process_ProcessInput.prototype.close = function(self) + self.b:close(); +end + +__sys_io__Process_ProcessInput.prototype.__class__ = __sys_io__Process_ProcessInput +__sys_io__Process_ProcessInput.__super__ = __haxe_io_Input +setmetatable(__sys_io__Process_ProcessInput.prototype,{__index=__haxe_io_Input.prototype}) +setmetatable(__sys_io__Process_ProcessInput.prototype.__properties__,{__index=__haxe_io_Input.prototype.__properties__}) + +__sys_io__Process_ProcessOutput.new = function(pipe) + local self = _hx_new(__sys_io__Process_ProcessOutput.prototype) + __sys_io__Process_ProcessOutput.super(self,pipe) + return self +end +__sys_io__Process_ProcessOutput.super = function(self,pipe) + self.b = pipe; + self:set_bigEndian(__lua_Boot.platformBigEndian); +end +_hxClasses["sys.io._Process.ProcessOutput"] = __sys_io__Process_ProcessOutput +__sys_io__Process_ProcessOutput.__name__ = "sys.io._Process.ProcessOutput" +__sys_io__Process_ProcessOutput.prototype = _hx_e(); +__sys_io__Process_ProcessOutput.prototype.b= nil; +__sys_io__Process_ProcessOutput.prototype.writeByte = function(self,c) + self.b:write(_G.string.char(c)); +end +__sys_io__Process_ProcessOutput.prototype.close = function(self) + self.b:close(); +end + +__sys_io__Process_ProcessOutput.prototype.__class__ = __sys_io__Process_ProcessOutput +__sys_io__Process_ProcessOutput.__super__ = __haxe_io_Output +setmetatable(__sys_io__Process_ProcessOutput.prototype,{__index=__haxe_io_Output.prototype}) +setmetatable(__sys_io__Process_ProcessOutput.prototype.__properties__,{__index=__haxe_io_Output.prototype.__properties__}) + +__xrfragment_Query.new = function(str) + local self = _hx_new(__xrfragment_Query.prototype) + __xrfragment_Query.super(self,str) + return self +end +__xrfragment_Query.super = function(self,str) + self.preset = ""; + self.accept = false; + self.exclude = Array.new(); + self.include = Array.new(); + self.q = _hx_e(); + self.str = ""; + if (str ~= nil) then + self:parse(str); + end; +end +_hx_exports["xrfragment"]["Query"] = __xrfragment_Query +_hxClasses["xrfragment.Query"] = __xrfragment_Query +__xrfragment_Query.__name__ = "xrfragment.Query" +__xrfragment_Query.prototype = _hx_e(); +__xrfragment_Query.prototype.str= nil; +__xrfragment_Query.prototype.q= nil; +__xrfragment_Query.prototype.include= nil; +__xrfragment_Query.prototype.exclude= nil; +__xrfragment_Query.prototype.accept= nil; +__xrfragment_Query.prototype.preset= nil; +__xrfragment_Query.prototype.toObject = function(self) + do return self.q end +end +__xrfragment_Query.prototype.qualify = function(self,nodename) + if (self.q.copy_all) then + self.accept = true; + end; + if (self.include:contains(nodename)) then + self.accept = true; + end; + if (self.exclude:contains(nodename)) then + self.accept = false; + end; + do return self.accept end +end +__xrfragment_Query.prototype.parse = function(self,str,recurse) + if (recurse == nil) then + recurse = false; + end; + local _gthis = self; + local copyAll; + if (recurse) then + copyAll = self.q.copy_all; + else + local copyAll1; + local pos = 0; + local len = 1; + if ((len == nil) or (len > (pos + __lua_lib_luautf8_Utf8.len(str)))) then + len = __lua_lib_luautf8_Utf8.len(str); + else + if (len < 0) then + len = __lua_lib_luautf8_Utf8.len(str) + len; + end; + end; + if (pos < 0) then + pos = __lua_lib_luautf8_Utf8.len(str) + pos; + end; + if (pos < 0) then + pos = 0; + end; + if (__lua_lib_luautf8_Utf8.sub(str, pos + 1, pos + len) ~= "-") then + local pos = 0; + local len = 1; + if ((len == nil) or (len > (pos + __lua_lib_luautf8_Utf8.len(str)))) then + len = __lua_lib_luautf8_Utf8.len(str); + else + if (len < 0) then + len = __lua_lib_luautf8_Utf8.len(str) + len; + end; + end; + if (pos < 0) then + pos = __lua_lib_luautf8_Utf8.len(str) + pos; + end; + if (pos < 0) then + pos = 0; + end; + copyAll1 = __lua_lib_luautf8_Utf8.sub(str, pos + 1, pos + len) == "?"; + else + copyAll1 = true; + end; + copyAll = copyAll1 or (str == ""); + end; + local isOr = EReg.new("^or$", ""); + local isProp = EReg.new(".*:[><=!]?", ""); + local isName = EReg.new("[^:/]", ""); + local isExclude = EReg.new("^-", ""); + local isInclude = EReg.new("^\\+", ""); + local isPreset = EReg.new("^\\?", ""); + local idx = 1; + local ret = _hx_tab_array({}, 0); + while (idx ~= nil) do + local newidx = 0; + if (__lua_lib_luautf8_Utf8.len(" ") > 0) then + newidx = __lua_lib_luautf8_Utf8.find(str, " ", idx, true); + else + if (idx >= __lua_lib_luautf8_Utf8.len(str)) then + newidx = nil; + else + newidx = idx + 1; + end; + end; + if (newidx ~= nil) then + local match = __lua_lib_luautf8_Utf8.sub(str, idx, newidx - 1); + ret:push(match); + idx = newidx + __lua_lib_luautf8_Utf8.len(" "); + else + ret:push(__lua_lib_luautf8_Utf8.sub(str, idx, __lua_lib_luautf8_Utf8.len(str))); + idx = nil; + end; + end; + local token = ret; + local ors = Array.new(); + local q = _hx_e(); + local composeQuery = function() + q = _hx_e(); + local value = Array.new(); + q.object = value; + local value = Array.new(); + q["-object"] = value; + ors:push(q); + do return q end; + end; + composeQuery(); + local match = nil; + match = function(str,prefix) + if (prefix == nil) then + prefix = ""; + end; + if (isPreset:match(str) and not recurse) then + _gthis.preset = str; + do return end; + end; + if (isExclude:match(str) or isInclude:match(str)) then + local pos = 1; + local len = nil; + if ((len == nil) or (len > (pos + __lua_lib_luautf8_Utf8.len(str)))) then + len = __lua_lib_luautf8_Utf8.len(str); + else + if (len < 0) then + len = __lua_lib_luautf8_Utf8.len(str) + len; + end; + end; + if (pos < 0) then + pos = __lua_lib_luautf8_Utf8.len(str) + pos; + end; + if (pos < 0) then + pos = 0; + end; + local t = __lua_lib_luautf8_Utf8.sub(str, pos + 1, pos + len); + local pos = 0; + local len = 1; + if ((len == nil) or (len > (pos + __lua_lib_luautf8_Utf8.len(str)))) then + len = __lua_lib_luautf8_Utf8.len(str); + else + if (len < 0) then + len = __lua_lib_luautf8_Utf8.len(str) + len; + end; + end; + if (pos < 0) then + pos = __lua_lib_luautf8_Utf8.len(str) + pos; + end; + if (pos < 0) then + pos = 0; + end; + match(t, __lua_lib_luautf8_Utf8.sub(str, pos + 1, pos + len)); + do return end; + end; + if (isProp:match(str)) then + local skip = 0; + local type = "="; + local startIndex = nil; + if (startIndex == nil) then + startIndex = 1; + else + startIndex = startIndex + 1; + end; + local r = __lua_lib_luautf8_Utf8.find(str, "*", startIndex, true); + if ((function() + local _hx_1 + if ((r ~= nil) and (r > 0)) then + _hx_1 = r - 1; else + _hx_1 = -1; end + return _hx_1 + end )() ~= -1) then + type = "*"; + end; + local startIndex = nil; + if (startIndex == nil) then + startIndex = 1; + else + startIndex = startIndex + 1; + end; + local r = __lua_lib_luautf8_Utf8.find(str, ">", startIndex, true); + if ((function() + local _hx_2 + if ((r ~= nil) and (r > 0)) then + _hx_2 = r - 1; else + _hx_2 = -1; end + return _hx_2 + end )() ~= -1) then + type = ">"; + end; + local startIndex = nil; + if (startIndex == nil) then + startIndex = 1; + else + startIndex = startIndex + 1; + end; + local r = __lua_lib_luautf8_Utf8.find(str, "<", startIndex, true); + if ((function() + local _hx_3 + if ((r ~= nil) and (r > 0)) then + _hx_3 = r - 1; else + _hx_3 = -1; end + return _hx_3 + end )() ~= -1) then + type = "<"; + end; + local startIndex = nil; + if (startIndex == nil) then + startIndex = 1; + else + startIndex = startIndex + 1; + end; + local r = __lua_lib_luautf8_Utf8.find(str, "!=", startIndex, true); + if ((function() + local _hx_4 + if ((r ~= nil) and (r > 0)) then + _hx_4 = r - 1; else + _hx_4 = -1; end + return _hx_4 + end )() ~= -1) then + type = "!="; + end; + local startIndex = nil; + if (startIndex == nil) then + startIndex = 1; + else + startIndex = startIndex + 1; + end; + local r = __lua_lib_luautf8_Utf8.find(str, ">=", startIndex, true); + if ((function() + local _hx_5 + if ((r ~= nil) and (r > 0)) then + _hx_5 = r - 1; else + _hx_5 = -1; end + return _hx_5 + end )() ~= -1) then + type = ">="; + end; + local startIndex = nil; + if (startIndex == nil) then + startIndex = 1; + else + startIndex = startIndex + 1; + end; + local r = __lua_lib_luautf8_Utf8.find(str, "<=", startIndex, true); + if ((function() + local _hx_6 + if ((r ~= nil) and (r > 0)) then + _hx_6 = r - 1; else + _hx_6 = -1; end + return _hx_6 + end )() ~= -1) then + type = "<="; + end; + if (type ~= "=") then + skip = skip + __lua_lib_luautf8_Utf8.len(type); + end; + local idx = 1; + local ret = _hx_tab_array({}, 0); + while (idx ~= nil) do + local newidx = 0; + if (__lua_lib_luautf8_Utf8.len(":") > 0) then + newidx = __lua_lib_luautf8_Utf8.find(str, ":", idx, true); + else + if (idx >= __lua_lib_luautf8_Utf8.len(str)) then + newidx = nil; + else + newidx = idx + 1; + end; + end; + if (newidx ~= nil) then + local match = __lua_lib_luautf8_Utf8.sub(str, idx, newidx - 1); + ret:push(match); + idx = newidx + __lua_lib_luautf8_Utf8.len(":"); + else + ret:push(__lua_lib_luautf8_Utf8.sub(str, idx, __lua_lib_luautf8_Utf8.len(str))); + idx = nil; + end; + end; + local property = ret[0]; + local value; + if (Reflect.field(q, Std.string(prefix) .. Std.string(property))) then + value = Reflect.field(q, Std.string(prefix) .. Std.string(property)); + else + value = _hx_e(); + end; + local idx = 1; + local ret = _hx_tab_array({}, 0); + while (idx ~= nil) do + local newidx = 0; + if (__lua_lib_luautf8_Utf8.len(":") > 0) then + newidx = __lua_lib_luautf8_Utf8.find(str, ":", idx, true); + else + if (idx >= __lua_lib_luautf8_Utf8.len(str)) then + newidx = nil; + else + newidx = idx + 1; + end; + end; + if (newidx ~= nil) then + local match = __lua_lib_luautf8_Utf8.sub(str, idx, newidx - 1); + ret:push(match); + idx = newidx + __lua_lib_luautf8_Utf8.len(":"); + else + ret:push(__lua_lib_luautf8_Utf8.sub(str, idx, __lua_lib_luautf8_Utf8.len(str))); + idx = nil; + end; + end; + local _this = ret[1]; + local pos = skip; + local len = nil; + if ((len == nil) or (len > (pos + __lua_lib_luautf8_Utf8.len(_this)))) then + len = __lua_lib_luautf8_Utf8.len(_this); + else + if (len < 0) then + len = __lua_lib_luautf8_Utf8.len(_this) + len; + end; + end; + if (pos < 0) then + pos = __lua_lib_luautf8_Utf8.len(_this) + pos; + end; + if (pos < 0) then + pos = 0; + end; + local value1 = __lua_lib_luautf8_Utf8.sub(_this, pos + 1, pos + len); + value[type] = value1; + q[Std.string(prefix) .. Std.string(property)] = value; + do return end; + end; + if (isName:match(str)) then + if (prefix == "-") then + Reflect.field(q, "-object"):push(str); + while (Reflect.field(q, "object"):contains(str) == true) do + Reflect.field(q, "object"):remove(str); + end; + else + Reflect.field(q, "object"):push(str); + while (Reflect.field(q, "-object"):contains(str) == true) do + Reflect.field(q, "-object"):remove(str); + end; + end; + do return end; + end; + end; + local _g = 0; + local _g1 = token.length; + while (_g < _g1) do + _g = _g + 1; + local i = _g - 1; + if (isOr:match(token[i])) then + composeQuery(); + else + match(token[i]); + end; + end; + local _g = 0; + local _g1 = ors.length; + while (_g < _g1) do + _g = _g + 1; + local i = _g - 1; + local _or = ors[i]; + if (Reflect.field(_or, "object") ~= nil) then + self.include = self.include:concat(Reflect.field(_or, "object")); + end; + if (Reflect.field(_or, "-object") ~= nil) then + self.exclude = self.exclude:concat(Reflect.field(_or, "-object")); + end; + end; + self.q = _hx_o({__fields__={['or']=true,copy_all=true},['or']=ors,copy_all=copyAll}); + do return self.q end +end +__xrfragment_Query.prototype.test = function(self,property,value) + if (self.preset == property) then + self:parse(value, true); + end; + local _g = 0; + local _g1 = _hx_wrap_if_string_field(self.q["or"],'length'); + while (_g < _g1) do + _g = _g + 1; + local i = _g - 1; + local _or = self.q["or"][i]; + local conds = _hx_tab_array({[0]=0}, 1); + local fails = _hx_tab_array({[0]=0}, 1); + local pass = 0; + local when = (function(fails,conds) + do return function(expr) + local conds = conds; + local when = 0; + conds[when] = conds[when] + 1; + local fails = fails; + local when = 0; + fails[when] = fails[when] + (function() + local _hx_1 + if (expr) then + _hx_1 = 0; else + _hx_1 = 1; end + return _hx_1 + end )(); + do return expr end; + end end; + end)(fails, conds); + local _g = 0; + local _g1 = Reflect.fields(_or); + local _hx_continue_2 = false; + while (_g < _g1.length) do repeat + local k = _g1[_g]; + _g = _g + 1; + local orval = Reflect.field(_or, k); + if (k ~= property) then + break; + end; + if ((Reflect.field(orval, "=") ~= nil) and when(value == Reflect.field(orval, "="))) then + pass = pass + 1; + end; + if ((Reflect.field(orval, "*") ~= nil) and when(value ~= nil)) then + pass = pass + 1; + end; + if ((Reflect.field(orval, ">") ~= nil) and when(value > Std.parseInt(Reflect.field(orval, ">")))) then + pass = pass + 1; + end; + if ((Reflect.field(orval, "<") ~= nil) and when(value < Std.parseInt(Reflect.field(orval, "<")))) then + pass = pass + 1; + end; + if ((Reflect.field(orval, ">=") ~= nil) and when(value >= Std.parseInt(Reflect.field(orval, ">=")))) then + pass = pass + 1; + end; + if ((Reflect.field(orval, "<=") ~= nil) and when(value >= Std.parseInt(Reflect.field(orval, "<=")))) then + pass = pass + 1; + end; + if ((Reflect.field(orval, "!=") ~= nil) and when(value ~= Std.parseInt(Reflect.field(orval, "!=")))) then + pass = pass + 1; + end;until true + if _hx_continue_2 then + _hx_continue_2 = false; + break; + end; + + end; + if ((self.accept and (conds[0] > 0)) and (fails[0] > 0)) then + self.accept = false; + end; + if (((conds[0] > 0) and (pass > 0)) and (fails[0] == 0)) then + self.accept = true; + end; + end; +end + +__xrfragment_Query.prototype.__class__ = __xrfragment_Query +-- require this for lua 5.1 +pcall(require, 'bit') +if bit then + _hx_bit_raw = bit + _hx_bit = setmetatable({}, { __index = _hx_bit_raw }); +else + _hx_bit_raw = _G.require('bit32') + _hx_bit = setmetatable({}, { __index = _hx_bit_raw }); + -- lua 5.2 weirdness + _hx_bit.bnot = function(...) return _hx_bit_clamp(_hx_bit_raw.bnot(...)) end; + _hx_bit.bxor = function(...) return _hx_bit_clamp(_hx_bit_raw.bxor(...)) end; +end +-- see https://github.com/HaxeFoundation/haxe/issues/8849 +_hx_bit.bor = function(...) return _hx_bit_clamp(_hx_bit_raw.bor(...)) end; +_hx_bit.band = function(...) return _hx_bit_clamp(_hx_bit_raw.band(...)) end; +_hx_bit.arshift = function(...) return _hx_bit_clamp(_hx_bit_raw.arshift(...)) end; + +if _hx_bit_raw then + _hx_bit_clamp = function(v) + if v <= 2147483647 and v >= -2147483648 then + if v > 0 then return _G.math.floor(v) + else return _G.math.ceil(v) + end + end + if v > 2251798999999999 then v = v*2 end; + if (v ~= v or math.abs(v) == _G.math.huge) then return nil end + return _hx_bit_raw.band(v, 2147483647 ) - math.abs(_hx_bit_raw.band(v, 2147483648)) + end +else + _hx_bit_clamp = function(v) + if v < -2147483648 then + return -2147483648 + elseif v > 2147483647 then + return 2147483647 + elseif v > 0 then + return _G.math.floor(v) + else + return _G.math.ceil(v) + end + end +end; + + + +_hx_array_mt.__index = Array.prototype + +local _hx_static_init = function() + + if (__lua_lib_lrexlib_Rex == nil) then + _G.error(__haxe_Exception.thrown("Rex is missing. Please install lrexlib-pcre."),0); + end; + String.__name__ = "String"; + _hxClasses.Array = Array; + Array.__name__ = "Array";EReg.FLAGS = __lua_lib_lrexlib_Rex.flags(); + + EReg.escapeRegExpRe = EReg.new("[\\[\\]{}()*+?.\\\\\\^$|]", "g"); + + __haxe_SysTools.winMetaCharacters = _hx_tab_array({[0]=32, 40, 41, 37, 33, 94, 34, 60, 62, 38, 124, 10, 13, 44, 59}, 15); + + StringTools.winMetaCharacters = __haxe_SysTools.winMetaCharacters; + + __haxe_ds_IntMap.tnull = ({}); + + __haxe_ds_ObjectMap.count = 0; + + __haxe_ds_StringMap.tnull = ({}); + + __haxe_io_FPHelper.i64tmp = (function() + local _hx_2 + + local this1 = __haxe__Int64____Int64.new(__haxe__Int32_Int32_Impl_.shr(0, 31), 0); + + _hx_2 = this1; + return _hx_2 + end )(); + + __haxe_io_FPHelper.LN2 = 0.6931471805599453; + + __lua_Boot._fid = 0; + + __lua_Boot.Max_Int32 = 2147483647; + + __lua_Boot.Min_Int32 = -2147483648; + + __lua_Boot.MAXSTACKSIZE = 1000; + + __lua_Boot.platformBigEndian = _G.string.byte(_G.string.dump(function() + end), 7) > 0; + + __lua_Boot.hiddenFields = {__id__=true, hx__closures=true, super=true, prototype=true, __fields__=true, __ifields__=true, __class__=true, __properties__=true} + + __lua__Io_IoType_Impl_.File = "file"; + + __lua__Io_IoType_Impl_.ClosedFile = "closed file"; + + __lua__Io_IoType_Impl_.NotAFile = nil; + + __sys_io_Process.argQuote = (function() + local _hx_3 + if (Sys.systemName() == "Windows") then + _hx_3 = function(x) + do return __haxe_SysTools.quoteWinArg(x, true) end; + end; else + _hx_3 = __haxe_SysTools.quoteUnixArg; end + return _hx_3 + end )(); + + __sys_io_Process._shell = (function() + local _hx_4 + if (Sys.systemName() == "Windows") then + _hx_4 = "cmd.exe"; else + _hx_4 = "/bin/sh"; end + return _hx_4 + end )(); + + +end + +_hx_bind = function(o,m) + if m == nil then return nil end; + local f; + if o._hx__closures == nil then + _G.rawset(o, '_hx__closures', {}); + else + f = o._hx__closures[m]; + end + if (f == nil) then + f = function(...) return m(o, ...) end; + o._hx__closures[m] = f; + end + return f; +end + +_hx_funcToField = function(f) + if type(f) == 'function' then + return function(self,...) + return f(...) + end + else + return f + end +end + +_G.math.randomseed(_G.os.time()); + +_hx_table = {} +_hx_table.pack = _G.table.pack or function(...) + return {...} +end +_hx_table.unpack = _G.table.unpack or _G.unpack +_hx_table.maxn = _G.table.maxn or function(t) + local maxn=0; + for i in pairs(t) do + maxn=type(i)=='number'and i>maxn and i or maxn + end + return maxn +end; + +_hx_wrap_if_string_field = function(o, fld) + if _G.type(o) == 'string' then + if fld == 'length' then + return _G.string.len(o) + else + return String.prototype[fld] + end + else + return o[fld] + end +end + +_hx_static_init(); +return _hx_exports diff --git a/dist/xrfragment.py b/dist/xrfragment.py new file mode 100644 index 0000000..23a7154 --- /dev/null +++ b/dist/xrfragment.py @@ -0,0 +1,7433 @@ +import sys + +import math as python_lib_Math +import math as Math +from os import path as python_lib_os_Path +import inspect as python_lib_Inspect +import sys as python_lib_Sys +import functools as python_lib_Functools +try: + import msvcrt as python_lib_Msvcrt +except: + pass +import os as python_lib_Os +import random as python_lib_Random +import re as python_lib_Re +import subprocess as python_lib_Subprocess +try: + import termios as python_lib_Termios +except: + pass +import time as python_lib_Time +import timeit as python_lib_Timeit +import traceback as python_lib_Traceback +try: + import tty as python_lib_Tty +except: + pass +from datetime import datetime as python_lib_datetime_Datetime +from datetime import timedelta as python_lib_datetime_Timedelta +from datetime import tzinfo as python_lib_datetime_Tzinfo +from datetime import timezone as python_lib_datetime_Timezone +from io import IOBase as python_lib_io_IOBase +from io import BufferedIOBase as python_lib_io_BufferedIOBase +from io import RawIOBase as python_lib_io_RawIOBase +from io import FileIO as python_lib_io_FileIO +from io import TextIOBase as python_lib_io_TextIOBase +from io import StringIO as python_lib_io_StringIO +from time import struct_time as python_lib_time_StructTime +import urllib.parse as python_lib_urllib_Parse + + +class _hx_AnonObject: + _hx_disable_getattr = False + def __init__(self, fields): + self.__dict__ = fields + def __repr__(self): + return repr(self.__dict__) + def __contains__(self, item): + return item in self.__dict__ + def __getitem__(self, item): + return self.__dict__[item] + def __getattr__(self, name): + if (self._hx_disable_getattr): + raise AttributeError('field does not exist') + else: + return None + def _hx_hasattr(self,field): + self._hx_disable_getattr = True + try: + getattr(self, field) + self._hx_disable_getattr = False + return True + except AttributeError: + self._hx_disable_getattr = False + return False + + + +class Enum: + _hx_class_name = "Enum" + __slots__ = ("tag", "index", "params") + _hx_fields = ["tag", "index", "params"] + _hx_methods = ["__str__"] + + def __init__(self,tag,index,params): + self.tag = tag + self.index = index + self.params = params + + def __str__(self): + if (self.params is None): + return self.tag + else: + return self.tag + '(' + (', '.join(str(v) for v in self.params)) + ')' + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.tag = None + _hx_o.index = None + _hx_o.params = None + + +class Class: pass + + +class Date: + _hx_class_name = "Date" + __slots__ = ("date", "dateUTC") + _hx_fields = ["date", "dateUTC"] + _hx_methods = ["getTime", "getHours", "getMinutes", "getSeconds", "getFullYear", "getMonth", "getDate", "getDay", "getUTCHours", "getUTCMinutes", "getUTCSeconds", "getUTCFullYear", "getUTCMonth", "getUTCDate", "getUTCDay", "getTimezoneOffset", "toString"] + _hx_statics = ["now", "fromTime", "makeLocal", "UTC", "fromString"] + + def __init__(self,year,month,day,hour,_hx_min,sec): + self.dateUTC = None + if (year < python_lib_datetime_Datetime.min.year): + year = python_lib_datetime_Datetime.min.year + if (day == 0): + day = 1 + self.date = Date.makeLocal(python_lib_datetime_Datetime(year,(month + 1),day,hour,_hx_min,sec,0)) + self.dateUTC = self.date.astimezone(python_lib_datetime_Timezone.utc) + + def getTime(self): + return (self.date.timestamp() * 1000) + + def getHours(self): + return self.date.hour + + def getMinutes(self): + return self.date.minute + + def getSeconds(self): + return self.date.second + + def getFullYear(self): + return self.date.year + + def getMonth(self): + return (self.date.month - 1) + + def getDate(self): + return self.date.day + + def getDay(self): + return HxOverrides.mod(self.date.isoweekday(), 7) + + def getUTCHours(self): + return self.dateUTC.hour + + def getUTCMinutes(self): + return self.dateUTC.minute + + def getUTCSeconds(self): + return self.dateUTC.second + + def getUTCFullYear(self): + return self.dateUTC.year + + def getUTCMonth(self): + return (self.dateUTC.month - 1) + + def getUTCDate(self): + return self.dateUTC.day + + def getUTCDay(self): + return HxOverrides.mod(self.dateUTC.isoweekday(), 7) + + def getTimezoneOffset(self): + x = (self.date.utcoffset() / python_lib_datetime_Timedelta(0,60)) + tmp = None + try: + tmp = int(x) + except BaseException as _g: + None + tmp = None + return -tmp + + def toString(self): + return self.date.strftime("%Y-%m-%d %H:%M:%S") + + @staticmethod + def now(): + d = Date(2000,0,1,0,0,0) + d.date = Date.makeLocal(python_lib_datetime_Datetime.now()) + d.dateUTC = d.date.astimezone(python_lib_datetime_Timezone.utc) + return d + + @staticmethod + def fromTime(t): + d = Date(2000,0,1,0,0,0) + d.date = Date.makeLocal(python_lib_datetime_Datetime.fromtimestamp((t / 1000.0))) + d.dateUTC = d.date.astimezone(python_lib_datetime_Timezone.utc) + return d + + @staticmethod + def makeLocal(date): + try: + return date.astimezone() + except BaseException as _g: + None + tzinfo = python_lib_datetime_Datetime.now(python_lib_datetime_Timezone.utc).astimezone().tzinfo + return date.replace(**python__KwArgs_KwArgs_Impl_.fromT(_hx_AnonObject({'tzinfo': tzinfo}))) + + @staticmethod + def UTC(year,month,day,hour,_hx_min,sec): + return (python_lib_datetime_Datetime(year,(month + 1),day,hour,_hx_min,sec,0,python_lib_datetime_Timezone.utc).timestamp() * 1000) + + @staticmethod + def fromString(s): + _g = len(s) + if (_g == 8): + k = s.split(":") + return Date.fromTime((((Std.parseInt((k[0] if 0 < len(k) else None)) * 3600000.) + ((Std.parseInt((k[1] if 1 < len(k) else None)) * 60000.))) + ((Std.parseInt((k[2] if 2 < len(k) else None)) * 1000.)))) + elif (_g == 10): + k = s.split("-") + return Date(Std.parseInt((k[0] if 0 < len(k) else None)),(Std.parseInt((k[1] if 1 < len(k) else None)) - 1),Std.parseInt((k[2] if 2 < len(k) else None)),0,0,0) + elif (_g == 19): + k = s.split(" ") + _this = (k[0] if 0 < len(k) else None) + y = _this.split("-") + _this = (k[1] if 1 < len(k) else None) + t = _this.split(":") + return Date(Std.parseInt((y[0] if 0 < len(y) else None)),(Std.parseInt((y[1] if 1 < len(y) else None)) - 1),Std.parseInt((y[2] if 2 < len(y) else None)),Std.parseInt((t[0] if 0 < len(t) else None)),Std.parseInt((t[1] if 1 < len(t) else None)),Std.parseInt((t[2] if 2 < len(t) else None))) + else: + raise haxe_Exception.thrown(("Invalid date format : " + ("null" if s is None else s))) + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.date = None + _hx_o.dateUTC = None + + +class EReg: + _hx_class_name = "EReg" + __slots__ = ("pattern", "matchObj", "_hx_global") + _hx_fields = ["pattern", "matchObj", "global"] + _hx_methods = ["match", "matched", "matchedLeft", "matchedRight", "matchedPos", "matchSub", "split", "replace", "map"] + _hx_statics = ["escape"] + + def __init__(self,r,opt): + self.matchObj = None + self._hx_global = False + options = 0 + _g = 0 + _g1 = len(opt) + while (_g < _g1): + i = _g + _g = (_g + 1) + c = (-1 if ((i >= len(opt))) else ord(opt[i])) + if (c == 109): + options = (options | python_lib_Re.M) + if (c == 105): + options = (options | python_lib_Re.I) + if (c == 115): + options = (options | python_lib_Re.S) + if (c == 117): + options = (options | python_lib_Re.U) + if (c == 103): + self._hx_global = True + self.pattern = python_lib_Re.compile(r,options) + + def match(self,s): + self.matchObj = python_lib_Re.search(self.pattern,s) + return (self.matchObj is not None) + + def matched(self,n): + return self.matchObj.group(n) + + def matchedLeft(self): + return HxString.substr(self.matchObj.string,0,self.matchObj.start()) + + def matchedRight(self): + return HxString.substr(self.matchObj.string,self.matchObj.end(),None) + + def matchedPos(self): + return _hx_AnonObject({'pos': self.matchObj.start(), 'len': (self.matchObj.end() - self.matchObj.start())}) + + def matchSub(self,s,pos,_hx_len = None): + if (_hx_len is None): + _hx_len = -1 + if (_hx_len != -1): + self.matchObj = self.pattern.search(s,pos,(pos + _hx_len)) + else: + self.matchObj = self.pattern.search(s,pos) + return (self.matchObj is not None) + + def split(self,s): + if self._hx_global: + ret = [] + lastEnd = 0 + x = python_HaxeIterator(python_lib_Re.finditer(self.pattern,s)) + while x.hasNext(): + x1 = x.next() + x2 = HxString.substring(s,lastEnd,x1.start()) + ret.append(x2) + lastEnd = x1.end() + x = HxString.substr(s,lastEnd,None) + ret.append(x) + return ret + else: + self.matchObj = python_lib_Re.search(self.pattern,s) + if (self.matchObj is None): + return [s] + else: + return [HxString.substring(s,0,self.matchObj.start()), HxString.substr(s,self.matchObj.end(),None)] + + def replace(self,s,by): + _this = by.split("$$") + by = "_hx_#repl#__".join([python_Boot.toString1(x1,'') for x1 in _this]) + def _hx_local_0(x): + res = by + g = x.groups() + _g = 0 + _g1 = len(g) + while (_g < _g1): + i = _g + _g = (_g + 1) + gs = g[i] + if (gs is None): + continue + delimiter = ("$" + HxOverrides.stringOrNull(str((i + 1)))) + _this = (list(res) if ((delimiter == "")) else res.split(delimiter)) + res = gs.join([python_Boot.toString1(x1,'') for x1 in _this]) + _this = res.split("_hx_#repl#__") + res = "$".join([python_Boot.toString1(x1,'') for x1 in _this]) + return res + replace = _hx_local_0 + return python_lib_Re.sub(self.pattern,replace,s,(0 if (self._hx_global) else 1)) + + def map(self,s,f): + buf_b = python_lib_io_StringIO() + pos = 0 + right = s + cur = self + while (pos < len(s)): + if (self.matchObj is None): + self.matchObj = python_lib_Re.search(self.pattern,s) + else: + self.matchObj = self.matchObj.re.search(s,pos) + if (self.matchObj is None): + break + pos1 = self.matchObj.end() + curPos_pos = cur.matchObj.start() + curPos_len = (cur.matchObj.end() - cur.matchObj.start()) + buf_b.write(Std.string(HxString.substr(HxString.substr(cur.matchObj.string,0,cur.matchObj.start()),pos,None))) + buf_b.write(Std.string(f(cur))) + right = HxString.substr(cur.matchObj.string,cur.matchObj.end(),None) + if (not self._hx_global): + buf_b.write(Std.string(right)) + return buf_b.getvalue() + if (curPos_len == 0): + buf_b.write(Std.string(("" if (((pos1 < 0) or ((pos1 >= len(s))))) else s[pos1]))) + right = HxString.substr(right,1,None) + pos = (pos1 + 1) + else: + pos = pos1 + buf_b.write(Std.string(right)) + return buf_b.getvalue() + + @staticmethod + def escape(s): + return python_lib_Re.escape(s) + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.pattern = None + _hx_o.matchObj = None + _hx_o._hx_global = None + + +class _EnumValue_EnumValue_Impl_: + _hx_class_name = "_EnumValue.EnumValue_Impl_" + __slots__ = () + _hx_statics = ["match"] + + @staticmethod + def match(this1,pattern): + return False + + +class IntIterator: + _hx_class_name = "IntIterator" + __slots__ = ("min", "max") + _hx_fields = ["min", "max"] + _hx_methods = ["hasNext", "next"] + + def __init__(self,_hx_min,_hx_max): + self.min = _hx_min + self.max = _hx_max + + def hasNext(self): + return (self.min < self.max) + + def next(self): + def _hx_local_3(): + def _hx_local_2(): + _hx_local_0 = self + _hx_local_1 = _hx_local_0.min + _hx_local_0.min = (_hx_local_1 + 1) + return _hx_local_1 + return _hx_local_2() + return _hx_local_3() + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.min = None + _hx_o.max = None + + +class Reflect: + _hx_class_name = "Reflect" + __slots__ = () + _hx_statics = ["hasField", "field", "setField", "getProperty", "setProperty", "callMethod", "fields", "isFunction", "compare", "isClosure", "compareMethods", "isObject", "isEnumValue", "deleteField", "copy", "makeVarArgs"] + + @staticmethod + def hasField(o,field): + return python_Boot.hasField(o,field) + + @staticmethod + def field(o,field): + return python_Boot.field(o,field) + + @staticmethod + def setField(o,field,value): + setattr(o,(("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)),value) + + @staticmethod + def getProperty(o,field): + if (o is None): + return None + if (field in python_Boot.keywords): + field = ("_hx_" + field) + elif ((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95))): + field = ("_hx_" + field) + if isinstance(o,_hx_AnonObject): + return Reflect.field(o,field) + tmp = Reflect.field(o,("get_" + ("null" if field is None else field))) + if ((tmp is not None) and callable(tmp)): + return tmp() + else: + return Reflect.field(o,field) + + @staticmethod + def setProperty(o,field,value): + field1 = (("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)) + if isinstance(o,_hx_AnonObject): + setattr(o,field1,value) + elif hasattr(o,("set_" + ("null" if field1 is None else field1))): + getattr(o,("set_" + ("null" if field1 is None else field1)))(value) + else: + setattr(o,field1,value) + + @staticmethod + def callMethod(o,func,args): + if callable(func): + return func(*args) + else: + return None + + @staticmethod + def fields(o): + return python_Boot.fields(o) + + @staticmethod + def isFunction(f): + if (not ((python_lib_Inspect.isfunction(f) or python_lib_Inspect.ismethod(f)))): + return python_Boot.hasField(f,"func_code") + else: + return True + + @staticmethod + def compare(a,b): + if ((a is None) and ((b is None))): + return 0 + if (a is None): + return 1 + elif (b is None): + return -1 + elif HxOverrides.eq(a,b): + return 0 + elif (a > b): + return 1 + else: + return -1 + + @staticmethod + def isClosure(v): + return isinstance(v,python_internal_MethodClosure) + + @staticmethod + def compareMethods(f1,f2): + if HxOverrides.eq(f1,f2): + return True + if (isinstance(f1,python_internal_MethodClosure) and isinstance(f2,python_internal_MethodClosure)): + m1 = f1 + m2 = f2 + if HxOverrides.eq(m1.obj,m2.obj): + return (m1.func == m2.func) + else: + return False + if ((not Reflect.isFunction(f1)) or (not Reflect.isFunction(f2))): + return False + return False + + @staticmethod + def isObject(v): + _g = Type.typeof(v) + tmp = _g.index + if (tmp == 4): + return True + elif (tmp == 6): + _g1 = _g.params[0] + return True + else: + return False + + @staticmethod + def isEnumValue(v): + if not HxOverrides.eq(v,Enum): + return isinstance(v,Enum) + else: + return False + + @staticmethod + def deleteField(o,field): + if (field in python_Boot.keywords): + field = ("_hx_" + field) + elif ((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95))): + field = ("_hx_" + field) + if (not python_Boot.hasField(o,field)): + return False + o.__delattr__(field) + return True + + @staticmethod + def copy(o): + if (o is None): + return None + o2 = _hx_AnonObject({}) + _g = 0 + _g1 = python_Boot.fields(o) + while (_g < len(_g1)): + f = (_g1[_g] if _g >= 0 and _g < len(_g1) else None) + _g = (_g + 1) + value = Reflect.field(o,f) + setattr(o2,(("_hx_" + f) if ((f in python_Boot.keywords)) else (("_hx_" + f) if (((((len(f) > 2) and ((ord(f[0]) == 95))) and ((ord(f[1]) == 95))) and ((ord(f[(len(f) - 1)]) != 95)))) else f)),value) + return o2 + + @staticmethod + def makeVarArgs(f): + def _hx_local_0(*v): + this1 = v + return f((list(this1) if ((not Std.isOfType(this1,list))) else this1)) + return _hx_local_0 + + +class Std: + _hx_class_name = "Std" + __slots__ = () + _hx_statics = ["downcast", "instance", "isMetaType", "is", "isOfType", "string", "int", "parseInt", "shortenPossibleNumber", "parseFloat", "random"] + + @staticmethod + def downcast(value,c): + try: + tmp = None + if (not isinstance(value,c)): + if c._hx_is_interface: + cls = c + loop = None + def _hx_local_1(intf): + f = (intf._hx_interfaces if (hasattr(intf,"_hx_interfaces")) else []) + if (f is not None): + _g = 0 + while (_g < len(f)): + i = (f[_g] if _g >= 0 and _g < len(f) else None) + _g = (_g + 1) + if (i == cls): + return True + else: + l = loop(i) + if l: + return True + return False + else: + return False + loop = _hx_local_1 + currentClass = value.__class__ + result = False + while (currentClass is not None): + if loop(currentClass): + result = True + break + currentClass = python_Boot.getSuperClass(currentClass) + tmp = result + else: + tmp = False + else: + tmp = True + if tmp: + return value + else: + return None + except BaseException as _g: + None + return None + + @staticmethod + def instance(value,c): + return Std.downcast(value,c) + + @staticmethod + def isMetaType(v,t): + return ((type(v) == type) and (v == t)) + + @staticmethod + def _hx_is(v,t): + return Std.isOfType(v,t) + + @staticmethod + def isOfType(v,t): + if ((v is None) and ((t is None))): + return False + if (t is None): + return False + if ((type(t) == type) and (t == Dynamic)): + return (v is not None) + isBool = isinstance(v,bool) + if (((type(t) == type) and (t == Bool)) and isBool): + return True + if ((((not isBool) and (not ((type(t) == type) and (t == Bool)))) and ((type(t) == type) and (t == Int))) and isinstance(v,int)): + return True + vIsFloat = isinstance(v,float) + tmp = None + tmp1 = None + if (((not isBool) and vIsFloat) and ((type(t) == type) and (t == Int))): + f = v + tmp1 = (((f != Math.POSITIVE_INFINITY) and ((f != Math.NEGATIVE_INFINITY))) and (not python_lib_Math.isnan(f))) + else: + tmp1 = False + if tmp1: + tmp1 = None + try: + tmp1 = int(v) + except BaseException as _g: + None + tmp1 = None + tmp = (v == tmp1) + else: + tmp = False + if ((tmp and ((v <= 2147483647))) and ((v >= -2147483648))): + return True + if (((not isBool) and ((type(t) == type) and (t == Float))) and isinstance(v,(float, int))): + return True + if ((type(t) == type) and (t == str)): + return isinstance(v,str) + isEnumType = ((type(t) == type) and (t == Enum)) + if ((isEnumType and python_lib_Inspect.isclass(v)) and hasattr(v,"_hx_constructs")): + return True + if isEnumType: + return False + isClassType = ((type(t) == type) and (t == Class)) + if ((((isClassType and (not isinstance(v,Enum))) and python_lib_Inspect.isclass(v)) and hasattr(v,"_hx_class_name")) and (not hasattr(v,"_hx_constructs"))): + return True + if isClassType: + return False + tmp = None + try: + tmp = isinstance(v,t) + except BaseException as _g: + None + tmp = False + if tmp: + return True + if python_lib_Inspect.isclass(t): + cls = t + loop = None + def _hx_local_1(intf): + f = (intf._hx_interfaces if (hasattr(intf,"_hx_interfaces")) else []) + if (f is not None): + _g = 0 + while (_g < len(f)): + i = (f[_g] if _g >= 0 and _g < len(f) else None) + _g = (_g + 1) + if (i == cls): + return True + else: + l = loop(i) + if l: + return True + return False + else: + return False + loop = _hx_local_1 + currentClass = v.__class__ + result = False + while (currentClass is not None): + if loop(currentClass): + result = True + break + currentClass = python_Boot.getSuperClass(currentClass) + return result + else: + return False + + @staticmethod + def string(s): + return python_Boot.toString1(s,"") + + @staticmethod + def int(x): + try: + return int(x) + except BaseException as _g: + None + return None + + @staticmethod + def parseInt(x): + if (x is None): + return None + try: + return int(x) + except BaseException as _g: + None + base = 10 + _hx_len = len(x) + foundCount = 0 + sign = 0 + firstDigitIndex = 0 + lastDigitIndex = -1 + previous = 0 + _g = 0 + _g1 = _hx_len + while (_g < _g1): + i = _g + _g = (_g + 1) + c = (-1 if ((i >= len(x))) else ord(x[i])) + if (((c > 8) and ((c < 14))) or ((c == 32))): + if (foundCount > 0): + return None + continue + else: + c1 = c + if (c1 == 43): + if (foundCount == 0): + sign = 1 + elif (not (((48 <= c) and ((c <= 57))))): + if (not (((base == 16) and ((((97 <= c) and ((c <= 122))) or (((65 <= c) and ((c <= 90))))))))): + break + elif (c1 == 45): + if (foundCount == 0): + sign = -1 + elif (not (((48 <= c) and ((c <= 57))))): + if (not (((base == 16) and ((((97 <= c) and ((c <= 122))) or (((65 <= c) and ((c <= 90))))))))): + break + elif (c1 == 48): + if (not (((foundCount == 0) or (((foundCount == 1) and ((sign != 0))))))): + if (not (((48 <= c) and ((c <= 57))))): + if (not (((base == 16) and ((((97 <= c) and ((c <= 122))) or (((65 <= c) and ((c <= 90))))))))): + break + elif ((c1 == 120) or ((c1 == 88))): + if ((previous == 48) and ((((foundCount == 1) and ((sign == 0))) or (((foundCount == 2) and ((sign != 0))))))): + base = 16 + elif (not (((48 <= c) and ((c <= 57))))): + if (not (((base == 16) and ((((97 <= c) and ((c <= 122))) or (((65 <= c) and ((c <= 90))))))))): + break + elif (not (((48 <= c) and ((c <= 57))))): + if (not (((base == 16) and ((((97 <= c) and ((c <= 122))) or (((65 <= c) and ((c <= 90))))))))): + break + if (((foundCount == 0) and ((sign == 0))) or (((foundCount == 1) and ((sign != 0))))): + firstDigitIndex = i + foundCount = (foundCount + 1) + lastDigitIndex = i + previous = c + if (firstDigitIndex <= lastDigitIndex): + digits = HxString.substring(x,firstDigitIndex,(lastDigitIndex + 1)) + try: + return (((-1 if ((sign == -1)) else 1)) * int(digits,base)) + except BaseException as _g: + return None + return None + + @staticmethod + def shortenPossibleNumber(x): + r = "" + _g = 0 + _g1 = len(x) + while (_g < _g1): + i = _g + _g = (_g + 1) + c = ("" if (((i < 0) or ((i >= len(x))))) else x[i]) + _g2 = HxString.charCodeAt(c,0) + if (_g2 is None): + break + else: + _g3 = _g2 + if (((((((((((_g3 == 57) or ((_g3 == 56))) or ((_g3 == 55))) or ((_g3 == 54))) or ((_g3 == 53))) or ((_g3 == 52))) or ((_g3 == 51))) or ((_g3 == 50))) or ((_g3 == 49))) or ((_g3 == 48))) or ((_g3 == 46))): + r = (("null" if r is None else r) + ("null" if c is None else c)) + else: + break + return r + + @staticmethod + def parseFloat(x): + try: + return float(x) + except BaseException as _g: + None + if (x is not None): + r1 = Std.shortenPossibleNumber(x) + if (r1 != x): + return Std.parseFloat(r1) + return Math.NaN + + @staticmethod + def random(x): + if (x <= 0): + return 0 + else: + return int((python_lib_Random.random() * x)) + + +class Float: pass + + +class Int: pass + + +class Bool: pass + + +class Dynamic: pass + + +class StringBuf: + _hx_class_name = "StringBuf" + __slots__ = ("b",) + _hx_fields = ["b"] + _hx_methods = ["get_length", "add", "add1", "addChar", "addSub", "toString"] + + def __init__(self): + self.b = python_lib_io_StringIO() + + def get_length(self): + pos = self.b.tell() + self.b.seek(0,2) + _hx_len = self.b.tell() + self.b.seek(pos,0) + return _hx_len + + def add(self,x): + s = Std.string(x) + self.b.write(s) + + def add1(self,s): + self.b.write(s) + + def addChar(self,c): + s = "".join(map(chr,[c])) + self.b.write(s) + + def addSub(self,s,pos,_hx_len = None): + s1 = (HxString.substr(s,pos,None) if ((_hx_len is None)) else HxString.substr(s,pos,_hx_len)) + self.b.write(s1) + + def toString(self): + return self.b.getvalue() + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.b = None + + +class haxe_SysTools: + _hx_class_name = "haxe.SysTools" + __slots__ = () + _hx_statics = ["winMetaCharacters", "quoteUnixArg", "quoteWinArg"] + + @staticmethod + def quoteUnixArg(argument): + if (argument == ""): + return "''" + _this = EReg("[^a-zA-Z0-9_@%+=:,./-]","") + _this.matchObj = python_lib_Re.search(_this.pattern,argument) + if (_this.matchObj is None): + return argument + return (("'" + HxOverrides.stringOrNull(StringTools.replace(argument,"'","'\"'\"'"))) + "'") + + @staticmethod + def quoteWinArg(argument,escapeMetaCharacters): + _this = EReg("^[^ \t\\\\\"]+$","") + _this.matchObj = python_lib_Re.search(_this.pattern,argument) + if (_this.matchObj is None): + result_b = python_lib_io_StringIO() + needquote = None + startIndex = None + if (((argument.find(" ") if ((startIndex is None)) else HxString.indexOfImpl(argument," ",startIndex))) == -1): + startIndex = None + needquote = (((argument.find("\t") if ((startIndex is None)) else HxString.indexOfImpl(argument,"\t",startIndex))) != -1) + else: + needquote = True + needquote1 = (needquote or ((argument == ""))) + if needquote1: + result_b.write("\"") + bs_buf = StringBuf() + _g = 0 + _g1 = len(argument) + while (_g < _g1): + i = _g + _g = (_g + 1) + _g2 = HxString.charCodeAt(argument,i) + if (_g2 is None): + c = _g2 + if (bs_buf.get_length() > 0): + result_b.write(Std.string(bs_buf.b.getvalue())) + bs_buf = StringBuf() + result_b.write("".join(map(chr,[c]))) + else: + _g3 = _g2 + if (_g3 == 34): + bs = bs_buf.b.getvalue() + result_b.write(Std.string(bs)) + result_b.write(Std.string(bs)) + bs_buf = StringBuf() + result_b.write("\\\"") + elif (_g3 == 92): + bs_buf.b.write("\\") + else: + c1 = _g2 + if (bs_buf.get_length() > 0): + result_b.write(Std.string(bs_buf.b.getvalue())) + bs_buf = StringBuf() + result_b.write("".join(map(chr,[c1]))) + result_b.write(Std.string(bs_buf.b.getvalue())) + if needquote1: + result_b.write(Std.string(bs_buf.b.getvalue())) + result_b.write("\"") + argument = result_b.getvalue() + if escapeMetaCharacters: + result_b = python_lib_io_StringIO() + _g = 0 + _g1 = len(argument) + while (_g < _g1): + i = _g + _g = (_g + 1) + c = HxString.charCodeAt(argument,i) + if (python_internal_ArrayImpl.indexOf(haxe_SysTools.winMetaCharacters,c,None) >= 0): + result_b.write("".join(map(chr,[94]))) + result_b.write("".join(map(chr,[c]))) + return result_b.getvalue() + else: + return argument + + +class StringTools: + _hx_class_name = "StringTools" + __slots__ = () + _hx_statics = ["urlEncode", "urlDecode", "htmlEscape", "htmlUnescape", "contains", "startsWith", "endsWith", "isSpace", "ltrim", "rtrim", "trim", "lpad", "rpad", "replace", "hex", "fastCodeAt", "unsafeCodeAt", "iterator", "keyValueIterator", "isEof", "quoteUnixArg", "winMetaCharacters", "quoteWinArg"] + + @staticmethod + def urlEncode(s): + return python_lib_urllib_Parse.quote(s,"") + + @staticmethod + def urlDecode(s): + return python_lib_urllib_Parse.unquote(s) + + @staticmethod + def htmlEscape(s,quotes = None): + buf_b = python_lib_io_StringIO() + _g_offset = 0 + _g_s = s + while (_g_offset < len(_g_s)): + index = _g_offset + _g_offset = (_g_offset + 1) + code = ord(_g_s[index]) + code1 = code + if (code1 == 34): + if quotes: + buf_b.write(""") + else: + buf_b.write("".join(map(chr,[code]))) + elif (code1 == 38): + buf_b.write("&") + elif (code1 == 39): + if quotes: + buf_b.write("'") + else: + buf_b.write("".join(map(chr,[code]))) + elif (code1 == 60): + buf_b.write("<") + elif (code1 == 62): + buf_b.write(">") + else: + buf_b.write("".join(map(chr,[code]))) + return buf_b.getvalue() + + @staticmethod + def htmlUnescape(s): + _this = s.split(">") + _this1 = ">".join([python_Boot.toString1(x1,'') for x1 in _this]) + _this = _this1.split("<") + _this1 = "<".join([python_Boot.toString1(x1,'') for x1 in _this]) + _this = _this1.split(""") + _this1 = "\"".join([python_Boot.toString1(x1,'') for x1 in _this]) + _this = _this1.split("'") + _this1 = "'".join([python_Boot.toString1(x1,'') for x1 in _this]) + _this = _this1.split("&") + return "&".join([python_Boot.toString1(x1,'') for x1 in _this]) + + @staticmethod + def contains(s,value): + startIndex = None + return (((s.find(value) if ((startIndex is None)) else HxString.indexOfImpl(s,value,startIndex))) != -1) + + @staticmethod + def startsWith(s,start): + return s.startswith(start) + + @staticmethod + def endsWith(s,end): + return s.endswith(end) + + @staticmethod + def isSpace(s,pos): + if (((len(s) == 0) or ((pos < 0))) or ((pos >= len(s)))): + return False + c = HxString.charCodeAt(s,pos) + if (not (((c > 8) and ((c < 14))))): + return (c == 32) + else: + return True + + @staticmethod + def ltrim(s): + l = len(s) + r = 0 + while ((r < l) and StringTools.isSpace(s,r)): + r = (r + 1) + if (r > 0): + return HxString.substr(s,r,(l - r)) + else: + return s + + @staticmethod + def rtrim(s): + l = len(s) + r = 0 + while ((r < l) and StringTools.isSpace(s,((l - r) - 1))): + r = (r + 1) + if (r > 0): + return HxString.substr(s,0,(l - r)) + else: + return s + + @staticmethod + def trim(s): + return StringTools.ltrim(StringTools.rtrim(s)) + + @staticmethod + def lpad(s,c,l): + if (len(c) <= 0): + return s + buf = StringBuf() + l = (l - len(s)) + while (buf.get_length() < l): + s1 = Std.string(c) + buf.b.write(s1) + s1 = Std.string(s) + buf.b.write(s1) + return buf.b.getvalue() + + @staticmethod + def rpad(s,c,l): + if (len(c) <= 0): + return s + buf = StringBuf() + s1 = Std.string(s) + buf.b.write(s1) + while (buf.get_length() < l): + s = Std.string(c) + buf.b.write(s) + return buf.b.getvalue() + + @staticmethod + def replace(s,sub,by): + _this = (list(s) if ((sub == "")) else s.split(sub)) + return by.join([python_Boot.toString1(x1,'') for x1 in _this]) + + @staticmethod + def hex(n,digits = None): + s = "" + hexChars = "0123456789ABCDEF" + while True: + index = (n & 15) + s = (HxOverrides.stringOrNull((("" if (((index < 0) or ((index >= len(hexChars))))) else hexChars[index]))) + ("null" if s is None else s)) + n = HxOverrides.rshift(n, 4) + if (not ((n > 0))): + break + if ((digits is not None) and ((len(s) < digits))): + diff = (digits - len(s)) + _g = 0 + _g1 = diff + while (_g < _g1): + _ = _g + _g = (_g + 1) + s = ("0" + ("null" if s is None else s)) + return s + + @staticmethod + def fastCodeAt(s,index): + if (index >= len(s)): + return -1 + else: + return ord(s[index]) + + @staticmethod + def unsafeCodeAt(s,index): + return ord(s[index]) + + @staticmethod + def iterator(s): + return haxe_iterators_StringIterator(s) + + @staticmethod + def keyValueIterator(s): + return haxe_iterators_StringKeyValueIterator(s) + + @staticmethod + def isEof(c): + return (c == -1) + + @staticmethod + def quoteUnixArg(argument): + if (argument == ""): + return "''" + else: + _this = EReg("[^a-zA-Z0-9_@%+=:,./-]","") + _this.matchObj = python_lib_Re.search(_this.pattern,argument) + if (_this.matchObj is None): + return argument + else: + return (("'" + HxOverrides.stringOrNull(StringTools.replace(argument,"'","'\"'\"'"))) + "'") + + @staticmethod + def quoteWinArg(argument,escapeMetaCharacters): + argument1 = argument + _this = EReg("^[^ \t\\\\\"]+$","") + _this.matchObj = python_lib_Re.search(_this.pattern,argument1) + if (_this.matchObj is None): + result_b = python_lib_io_StringIO() + needquote = None + startIndex = None + if (((argument1.find(" ") if ((startIndex is None)) else HxString.indexOfImpl(argument1," ",startIndex))) == -1): + startIndex = None + needquote = (((argument1.find("\t") if ((startIndex is None)) else HxString.indexOfImpl(argument1,"\t",startIndex))) != -1) + else: + needquote = True + needquote1 = (needquote or ((argument1 == ""))) + if needquote1: + result_b.write("\"") + bs_buf = StringBuf() + _g = 0 + _g1 = len(argument1) + while (_g < _g1): + i = _g + _g = (_g + 1) + _g2 = HxString.charCodeAt(argument1,i) + if (_g2 is None): + c = _g2 + if (bs_buf.get_length() > 0): + result_b.write(Std.string(bs_buf.b.getvalue())) + bs_buf = StringBuf() + result_b.write("".join(map(chr,[c]))) + else: + _g3 = _g2 + if (_g3 == 34): + bs = bs_buf.b.getvalue() + result_b.write(Std.string(bs)) + result_b.write(Std.string(bs)) + bs_buf = StringBuf() + result_b.write("\\\"") + elif (_g3 == 92): + bs_buf.b.write("\\") + else: + c1 = _g2 + if (bs_buf.get_length() > 0): + result_b.write(Std.string(bs_buf.b.getvalue())) + bs_buf = StringBuf() + result_b.write("".join(map(chr,[c1]))) + result_b.write(Std.string(bs_buf.b.getvalue())) + if needquote1: + result_b.write(Std.string(bs_buf.b.getvalue())) + result_b.write("\"") + argument1 = result_b.getvalue() + if escapeMetaCharacters: + result_b = python_lib_io_StringIO() + _g = 0 + _g1 = len(argument1) + while (_g < _g1): + i = _g + _g = (_g + 1) + c = HxString.charCodeAt(argument1,i) + if (python_internal_ArrayImpl.indexOf(haxe_SysTools.winMetaCharacters,c,None) >= 0): + result_b.write("".join(map(chr,[94]))) + result_b.write("".join(map(chr,[c]))) + return result_b.getvalue() + else: + return argument1 + + +class sys_FileSystem: + _hx_class_name = "sys.FileSystem" + __slots__ = () + _hx_statics = ["exists", "stat", "rename", "fullPath", "absolutePath", "isDirectory", "createDirectory", "deleteFile", "deleteDirectory", "readDirectory"] + + @staticmethod + def exists(path): + return python_lib_os_Path.exists(path) + + @staticmethod + def stat(path): + s = python_lib_Os.stat(path) + return _hx_AnonObject({'gid': s.st_gid, 'uid': s.st_uid, 'atime': Date.fromTime((1000 * s.st_atime)), 'mtime': Date.fromTime((1000 * s.st_mtime)), 'ctime': Date.fromTime((1000 * s.st_ctime)), 'size': s.st_size, 'dev': s.st_dev, 'ino': s.st_ino, 'nlink': s.st_nlink, 'rdev': getattr(s,"st_rdev",0), 'mode': s.st_mode}) + + @staticmethod + def rename(path,newPath): + python_lib_Os.rename(path,newPath) + + @staticmethod + def fullPath(relPath): + return python_lib_os_Path.realpath(relPath) + + @staticmethod + def absolutePath(relPath): + if haxe_io_Path.isAbsolute(relPath): + return relPath + return haxe_io_Path.join([Sys.getCwd(), relPath]) + + @staticmethod + def isDirectory(path): + return python_lib_os_Path.isdir(path) + + @staticmethod + def createDirectory(path): + python_lib_Os.makedirs(path,511,True) + + @staticmethod + def deleteFile(path): + python_lib_Os.remove(path) + + @staticmethod + def deleteDirectory(path): + python_lib_Os.rmdir(path) + + @staticmethod + def readDirectory(path): + return python_lib_Os.listdir(path) + + +class Sys: + _hx_class_name = "Sys" + __slots__ = () + _hx_statics = ["environ", "get_environ", "time", "exit", "print", "println", "args", "getEnv", "putEnv", "environment", "sleep", "setTimeLocale", "getCwd", "setCwd", "systemName", "command", "cpuTime", "executablePath", "_programPath", "programPath", "getChar", "stdin", "stdout", "stderr"] + environ = None + + @staticmethod + def get_environ(): + _g = Sys.environ + if (_g is None): + environ = haxe_ds_StringMap() + env = python_lib_Os.environ + key = python_HaxeIterator(iter(env.keys())) + while key.hasNext(): + key1 = key.next() + value = env.get(key1,None) + environ.h[key1] = value + def _hx_local_1(): + def _hx_local_0(): + Sys.environ = environ + return Sys.environ + return _hx_local_0() + return _hx_local_1() + else: + env = _g + return env + + @staticmethod + def time(): + return python_lib_Time.time() + + @staticmethod + def exit(code): + python_lib_Sys.exit(code) + + @staticmethod + def print(v): + python_Lib.printString(Std.string(v)) + + @staticmethod + def println(v): + _hx_str = Std.string(v) + python_Lib.printString((("" + ("null" if _hx_str is None else _hx_str)) + HxOverrides.stringOrNull(python_Lib.lineEnd))) + + @staticmethod + def args(): + argv = python_lib_Sys.argv + return argv[1:None] + + @staticmethod + def getEnv(s): + return Sys.get_environ().h.get(s,None) + + @staticmethod + def putEnv(s,v): + python_lib_Os.putenv(s,v) + Sys.get_environ().h[s] = v + + @staticmethod + def environment(): + return Sys.get_environ() + + @staticmethod + def sleep(seconds): + python_lib_Time.sleep(seconds) + + @staticmethod + def setTimeLocale(loc): + return False + + @staticmethod + def getCwd(): + return python_lib_Os.getcwd() + + @staticmethod + def setCwd(s): + python_lib_Os.chdir(s) + + @staticmethod + def systemName(): + _g = python_lib_Sys.platform + x = _g + if x.startswith("linux"): + return "Linux" + else: + _g1 = _g + _hx_local_0 = len(_g1) + if (_hx_local_0 == 5): + if (_g1 == "win32"): + return "Windows" + else: + raise haxe_Exception.thrown("not supported platform") + elif (_hx_local_0 == 6): + if (_g1 == "cygwin"): + return "Windows" + elif (_g1 == "darwin"): + return "Mac" + else: + raise haxe_Exception.thrown("not supported platform") + else: + raise haxe_Exception.thrown("not supported platform") + + @staticmethod + def command(cmd,args = None): + if (args is None): + return python_lib_Subprocess.call(cmd,**python__KwArgs_KwArgs_Impl_.fromT(_hx_AnonObject({'shell': True}))) + else: + return python_lib_Subprocess.call(([cmd] + args)) + + @staticmethod + def cpuTime(): + return python_lib_Timeit.default_timer() + + @staticmethod + def executablePath(): + return python_internal_ArrayImpl._get(python_lib_Sys.argv, 0) + + @staticmethod + def programPath(): + return Sys._programPath + + @staticmethod + def getChar(echo): + ch = None + _g = Sys.systemName() + _g1 = _g + _hx_local_0 = len(_g1) + if (_hx_local_0 == 5): + if (_g1 == "Linux"): + fd = python_lib_Sys.stdin.fileno() + old = python_lib_Termios.tcgetattr(fd) + fileNo = fd + when = python_lib_Termios.TCSADRAIN + settings = old + def _hx_local_1(): + python_lib_Termios.tcsetattr(fileNo,when,settings) + restore = _hx_local_1 + try: + python_lib_Tty.setraw(fd) + x = python_lib_Sys.stdin.read(1) + restore() + ch = HxString.charCodeAt(x,0) + except BaseException as _g1: + None + e = haxe_Exception.caught(_g1).unwrap() + restore() + raise haxe_Exception.thrown(e) + else: + x = _g + raise haxe_Exception.thrown((("platform " + ("null" if x is None else x)) + " not supported")) + elif (_hx_local_0 == 3): + if (_g1 == "Mac"): + fd = python_lib_Sys.stdin.fileno() + old = python_lib_Termios.tcgetattr(fd) + fileNo = fd + when = python_lib_Termios.TCSADRAIN + settings = old + def _hx_local_2(): + python_lib_Termios.tcsetattr(fileNo,when,settings) + restore = _hx_local_2 + try: + python_lib_Tty.setraw(fd) + x = python_lib_Sys.stdin.read(1) + restore() + ch = HxString.charCodeAt(x,0) + except BaseException as _g1: + None + e = haxe_Exception.caught(_g1).unwrap() + restore() + raise haxe_Exception.thrown(e) + else: + x = _g + raise haxe_Exception.thrown((("platform " + ("null" if x is None else x)) + " not supported")) + elif (_hx_local_0 == 7): + if (_g1 == "Windows"): + ch = HxString.charCodeAt(python_lib_Msvcrt.getwch(),0) + else: + x = _g + raise haxe_Exception.thrown((("platform " + ("null" if x is None else x)) + " not supported")) + else: + x = _g + raise haxe_Exception.thrown((("platform " + ("null" if x is None else x)) + " not supported")) + if echo: + python_Lib.printString(Std.string("".join(map(chr,[ch])))) + return ch + + @staticmethod + def stdin(): + return python_io_IoTools.createFileInputFromText(python_lib_Sys.stdin) + + @staticmethod + def stdout(): + return python_io_IoTools.createFileOutputFromText(python_lib_Sys.stdout) + + @staticmethod + def stderr(): + return python_io_IoTools.createFileOutputFromText(python_lib_Sys.stderr) + +class ValueType(Enum): + __slots__ = () + _hx_class_name = "ValueType" + _hx_constructs = ["TNull", "TInt", "TFloat", "TBool", "TObject", "TFunction", "TClass", "TEnum", "TUnknown"] + + @staticmethod + def TClass(c): + return ValueType("TClass", 6, (c,)) + + @staticmethod + def TEnum(e): + return ValueType("TEnum", 7, (e,)) +ValueType.TNull = ValueType("TNull", 0, ()) +ValueType.TInt = ValueType("TInt", 1, ()) +ValueType.TFloat = ValueType("TFloat", 2, ()) +ValueType.TBool = ValueType("TBool", 3, ()) +ValueType.TObject = ValueType("TObject", 4, ()) +ValueType.TFunction = ValueType("TFunction", 5, ()) +ValueType.TUnknown = ValueType("TUnknown", 8, ()) + + +class Type: + _hx_class_name = "Type" + __slots__ = () + _hx_statics = ["getClass", "getEnum", "getSuperClass", "getClassName", "getEnumName", "resolveClass", "resolveEnum", "createInstance", "createEmptyInstance", "createEnum", "createEnumIndex", "getInstanceFields", "getClassFields", "getEnumConstructs", "typeof", "asEnumImpl", "enumEq", "enumConstructor", "enumParameters", "enumIndex", "allEnums"] + + @staticmethod + def getClass(o): + if (o is None): + return None + o1 = o + if ((o1 is not None) and ((HxOverrides.eq(o1,str) or python_lib_Inspect.isclass(o1)))): + return None + if isinstance(o,_hx_AnonObject): + return None + if hasattr(o,"_hx_class"): + return o._hx_class + if hasattr(o,"__class__"): + return o.__class__ + else: + return None + + @staticmethod + def getEnum(o): + if (o is None): + return None + return o.__class__ + + @staticmethod + def getSuperClass(c): + return python_Boot.getSuperClass(c) + + @staticmethod + def getClassName(c): + if hasattr(c,"_hx_class_name"): + return c._hx_class_name + else: + if (c == list): + return "Array" + if (c == Math): + return "Math" + if (c == str): + return "String" + try: + return c.__name__ + except BaseException as _g: + None + return None + + @staticmethod + def getEnumName(e): + return e._hx_class_name + + @staticmethod + def resolveClass(name): + if (name == "Array"): + return list + if (name == "Math"): + return Math + if (name == "String"): + return str + cl = _hx_classes.get(name,None) + tmp = None + if (cl is not None): + o = cl + tmp = (not (((o is not None) and ((HxOverrides.eq(o,str) or python_lib_Inspect.isclass(o)))))) + else: + tmp = True + if tmp: + return None + return cl + + @staticmethod + def resolveEnum(name): + if (name == "Bool"): + return Bool + o = Type.resolveClass(name) + if hasattr(o,"_hx_constructs"): + return o + else: + return None + + @staticmethod + def createInstance(cl,args): + return cl(*args) + + @staticmethod + def createEmptyInstance(cl): + i = cl.__new__(cl) + callInit = None + def _hx_local_0(cl): + sc = Type.getSuperClass(cl) + if (sc is not None): + callInit(sc) + if hasattr(cl,"_hx_empty_init"): + cl._hx_empty_init(i) + callInit = _hx_local_0 + callInit(cl) + return i + + @staticmethod + def createEnum(e,constr,params = None): + f = Reflect.field(e,constr) + if (f is None): + raise haxe_Exception.thrown(("No such constructor " + ("null" if constr is None else constr))) + if Reflect.isFunction(f): + if (params is None): + raise haxe_Exception.thrown((("Constructor " + ("null" if constr is None else constr)) + " need parameters")) + return Reflect.callMethod(e,f,params) + if ((params is not None) and ((len(params) != 0))): + raise haxe_Exception.thrown((("Constructor " + ("null" if constr is None else constr)) + " does not need parameters")) + return f + + @staticmethod + def createEnumIndex(e,index,params = None): + c = python_internal_ArrayImpl._get(e._hx_constructs, index) + if (c is None): + raise haxe_Exception.thrown((Std.string(index) + " is not a valid enum constructor index")) + return Type.createEnum(e,c,params) + + @staticmethod + def getInstanceFields(c): + return python_Boot.getInstanceFields(c) + + @staticmethod + def getClassFields(c): + return python_Boot.getClassFields(c) + + @staticmethod + def getEnumConstructs(e): + if hasattr(e,"_hx_constructs"): + x = e._hx_constructs + return list(x) + else: + return [] + + @staticmethod + def typeof(v): + if (v is None): + return ValueType.TNull + elif isinstance(v,bool): + return ValueType.TBool + elif isinstance(v,int): + return ValueType.TInt + elif isinstance(v,float): + return ValueType.TFloat + elif isinstance(v,str): + return ValueType.TClass(str) + elif isinstance(v,list): + return ValueType.TClass(list) + elif (isinstance(v,_hx_AnonObject) or python_lib_Inspect.isclass(v)): + return ValueType.TObject + elif isinstance(v,Enum): + return ValueType.TEnum(v.__class__) + elif (isinstance(v,type) or hasattr(v,"_hx_class")): + return ValueType.TClass(v.__class__) + elif callable(v): + return ValueType.TFunction + else: + return ValueType.TUnknown + + @staticmethod + def asEnumImpl(x): + return x + + @staticmethod + def enumEq(a,b): + if HxOverrides.eq(a,b): + return True + try: + if ((b is None) and (not HxOverrides.eq(a,b))): + return False + if (a.tag != b.tag): + return False + p1 = a.params + p2 = b.params + if (len(p1) != len(p2)): + return False + _g = 0 + _g1 = len(p1) + while (_g < _g1): + i = _g + _g = (_g + 1) + if (not Type.enumEq(p1[i],p2[i])): + return False + if (a._hx_class != b._hx_class): + return False + except BaseException as _g: + None + return False + return True + + @staticmethod + def enumConstructor(e): + return e.tag + + @staticmethod + def enumParameters(e): + return list(e.params) + + @staticmethod + def enumIndex(e): + return e.index + + @staticmethod + def allEnums(e): + ctors = Type.getEnumConstructs(e) + ret = [] + _g = 0 + while (_g < len(ctors)): + ctor = (ctors[_g] if _g >= 0 and _g < len(ctors) else None) + _g = (_g + 1) + v = Reflect.field(e,ctor) + if Std.isOfType(v,e): + ret.append(v) + return ret + +class haxe_StackItem(Enum): + __slots__ = () + _hx_class_name = "haxe.StackItem" + _hx_constructs = ["CFunction", "Module", "FilePos", "Method", "LocalFunction"] + + @staticmethod + def Module(m): + return haxe_StackItem("Module", 1, (m,)) + + @staticmethod + def FilePos(s,file,line,column = None): + return haxe_StackItem("FilePos", 2, (s,file,line,column)) + + @staticmethod + def Method(classname,method): + return haxe_StackItem("Method", 3, (classname,method)) + + @staticmethod + def LocalFunction(v = None): + return haxe_StackItem("LocalFunction", 4, (v,)) +haxe_StackItem.CFunction = haxe_StackItem("CFunction", 0, ()) + + +class haxe__CallStack_CallStack_Impl_: + _hx_class_name = "haxe._CallStack.CallStack_Impl_" + __slots__ = () + _hx_statics = ["get_length", "callStack", "exceptionStack", "toString", "subtract", "copy", "get", "asArray", "equalItems", "exceptionToString", "itemToString"] + length = None + + @staticmethod + def get_length(this1): + return len(this1) + + @staticmethod + def callStack(): + infos = python_lib_Traceback.extract_stack() + if (len(infos) != 0): + infos.pop() + infos.reverse() + return haxe_NativeStackTrace.toHaxe(infos) + + @staticmethod + def exceptionStack(fullStack = None): + if (fullStack is None): + fullStack = False + eStack = haxe_NativeStackTrace.toHaxe(haxe_NativeStackTrace.exceptionStack()) + return (eStack if fullStack else haxe__CallStack_CallStack_Impl_.subtract(eStack,haxe__CallStack_CallStack_Impl_.callStack())) + + @staticmethod + def toString(stack): + b = StringBuf() + _g = 0 + _g1 = stack + while (_g < len(_g1)): + s = (_g1[_g] if _g >= 0 and _g < len(_g1) else None) + _g = (_g + 1) + b.b.write("\nCalled from ") + haxe__CallStack_CallStack_Impl_.itemToString(b,s) + return b.b.getvalue() + + @staticmethod + def subtract(this1,stack): + startIndex = -1 + i = -1 + while True: + i = (i + 1) + tmp = i + if (not ((tmp < len(this1)))): + break + _g = 0 + _g1 = len(stack) + while (_g < _g1): + j = _g + _g = (_g + 1) + if haxe__CallStack_CallStack_Impl_.equalItems((this1[i] if i >= 0 and i < len(this1) else None),python_internal_ArrayImpl._get(stack, j)): + if (startIndex < 0): + startIndex = i + i = (i + 1) + if (i >= len(this1)): + break + else: + startIndex = -1 + if (startIndex >= 0): + break + if (startIndex >= 0): + return this1[0:startIndex] + else: + return this1 + + @staticmethod + def copy(this1): + return list(this1) + + @staticmethod + def get(this1,index): + return (this1[index] if index >= 0 and index < len(this1) else None) + + @staticmethod + def asArray(this1): + return this1 + + @staticmethod + def equalItems(item1,item2): + if (item1 is None): + if (item2 is None): + return True + else: + return False + else: + tmp = item1.index + if (tmp == 0): + if (item2 is None): + return False + elif (item2.index == 0): + return True + else: + return False + elif (tmp == 1): + if (item2 is None): + return False + elif (item2.index == 1): + m2 = item2.params[0] + m1 = item1.params[0] + return (m1 == m2) + else: + return False + elif (tmp == 2): + if (item2 is None): + return False + elif (item2.index == 2): + item21 = item2.params[0] + file2 = item2.params[1] + line2 = item2.params[2] + col2 = item2.params[3] + col1 = item1.params[3] + line1 = item1.params[2] + file1 = item1.params[1] + item11 = item1.params[0] + if (((file1 == file2) and ((line1 == line2))) and ((col1 == col2))): + return haxe__CallStack_CallStack_Impl_.equalItems(item11,item21) + else: + return False + else: + return False + elif (tmp == 3): + if (item2 is None): + return False + elif (item2.index == 3): + class2 = item2.params[0] + method2 = item2.params[1] + method1 = item1.params[1] + class1 = item1.params[0] + if (class1 == class2): + return (method1 == method2) + else: + return False + else: + return False + elif (tmp == 4): + if (item2 is None): + return False + elif (item2.index == 4): + v2 = item2.params[0] + v1 = item1.params[0] + return (v1 == v2) + else: + return False + else: + pass + + @staticmethod + def exceptionToString(e): + if (e.get_previous() is None): + tmp = ("Exception: " + HxOverrides.stringOrNull(e.toString())) + tmp1 = e.get_stack() + return (("null" if tmp is None else tmp) + HxOverrides.stringOrNull((("null" if ((tmp1 is None)) else haxe__CallStack_CallStack_Impl_.toString(tmp1))))) + result = "" + e1 = e + prev = None + while (e1 is not None): + if (prev is None): + result1 = ("Exception: " + HxOverrides.stringOrNull(e1.get_message())) + tmp = e1.get_stack() + result = ((("null" if result1 is None else result1) + HxOverrides.stringOrNull((("null" if ((tmp is None)) else haxe__CallStack_CallStack_Impl_.toString(tmp))))) + ("null" if result is None else result)) + else: + prevStack = haxe__CallStack_CallStack_Impl_.subtract(e1.get_stack(),prev.get_stack()) + result = (((("Exception: " + HxOverrides.stringOrNull(e1.get_message())) + HxOverrides.stringOrNull((("null" if ((prevStack is None)) else haxe__CallStack_CallStack_Impl_.toString(prevStack))))) + "\n\nNext ") + ("null" if result is None else result)) + prev = e1 + e1 = e1.get_previous() + return result + + @staticmethod + def itemToString(b,s): + tmp = s.index + if (tmp == 0): + b.b.write("a C function") + elif (tmp == 1): + m = s.params[0] + b.b.write("module ") + s1 = Std.string(m) + b.b.write(s1) + elif (tmp == 2): + s1 = s.params[0] + file = s.params[1] + line = s.params[2] + col = s.params[3] + if (s1 is not None): + haxe__CallStack_CallStack_Impl_.itemToString(b,s1) + b.b.write(" (") + s2 = Std.string(file) + b.b.write(s2) + b.b.write(" line ") + s2 = Std.string(line) + b.b.write(s2) + if (col is not None): + b.b.write(" column ") + s2 = Std.string(col) + b.b.write(s2) + if (s1 is not None): + b.b.write(")") + elif (tmp == 3): + cname = s.params[0] + meth = s.params[1] + s1 = Std.string(("" if ((cname is None)) else cname)) + b.b.write(s1) + b.b.write(".") + s1 = Std.string(meth) + b.b.write(s1) + elif (tmp == 4): + n = s.params[0] + b.b.write("local function #") + s = Std.string(n) + b.b.write(s) + else: + pass + + +class haxe_IMap: + _hx_class_name = "haxe.IMap" + __slots__ = () + _hx_methods = ["get", "set", "exists", "remove", "keys", "iterator", "keyValueIterator", "copy", "toString", "clear"] + + +class haxe__DynamicAccess_DynamicAccess_Impl_: + _hx_class_name = "haxe._DynamicAccess.DynamicAccess_Impl_" + __slots__ = () + _hx_statics = ["_new", "get", "set", "exists", "remove", "keys", "copy", "iterator", "keyValueIterator"] + + @staticmethod + def _new(): + this1 = _hx_AnonObject({}) + return this1 + + @staticmethod + def get(this1,key): + return Reflect.field(this1,key) + + @staticmethod + def set(this1,key,value): + setattr(this1,(("_hx_" + key) if ((key in python_Boot.keywords)) else (("_hx_" + key) if (((((len(key) > 2) and ((ord(key[0]) == 95))) and ((ord(key[1]) == 95))) and ((ord(key[(len(key) - 1)]) != 95)))) else key)),value) + return value + + @staticmethod + def exists(this1,key): + return python_Boot.hasField(this1,key) + + @staticmethod + def remove(this1,key): + return Reflect.deleteField(this1,key) + + @staticmethod + def keys(this1): + return python_Boot.fields(this1) + + @staticmethod + def copy(this1): + return Reflect.copy(this1) + + @staticmethod + def iterator(this1): + return haxe_iterators_DynamicAccessIterator(this1) + + @staticmethod + def keyValueIterator(this1): + return haxe_iterators_DynamicAccessKeyValueIterator(this1) + + +class haxe_Exception(Exception): + _hx_class_name = "haxe.Exception" + __slots__ = ("_hx___exceptionStack", "_hx___nativeStack", "_hx___skipStack", "_hx___nativeException", "_hx___previousException") + _hx_fields = ["__exceptionStack", "__nativeStack", "__skipStack", "__nativeException", "__previousException"] + _hx_methods = ["unwrap", "toString", "details", "__shiftStack", "get_message", "get_previous", "get_native", "get_stack"] + _hx_statics = ["caught", "thrown"] + _hx_interfaces = [] + _hx_super = Exception + + + def __init__(self,message,previous = None,native = None): + self._hx___previousException = None + self._hx___nativeException = None + self._hx___nativeStack = None + self._hx___exceptionStack = None + self._hx___skipStack = 0 + super().__init__(message) + self._hx___previousException = previous + if ((native is not None) and Std.isOfType(native,BaseException)): + self._hx___nativeException = native + self._hx___nativeStack = haxe_NativeStackTrace.exceptionStack() + else: + self._hx___nativeException = self + infos = python_lib_Traceback.extract_stack() + if (len(infos) != 0): + infos.pop() + infos.reverse() + self._hx___nativeStack = infos + + def unwrap(self): + return self._hx___nativeException + + def toString(self): + return self.get_message() + + def details(self): + if (self.get_previous() is None): + tmp = ("Exception: " + HxOverrides.stringOrNull(self.toString())) + tmp1 = self.get_stack() + return (("null" if tmp is None else tmp) + HxOverrides.stringOrNull((("null" if ((tmp1 is None)) else haxe__CallStack_CallStack_Impl_.toString(tmp1))))) + else: + result = "" + e = self + prev = None + while (e is not None): + if (prev is None): + result1 = ("Exception: " + HxOverrides.stringOrNull(e.get_message())) + tmp = e.get_stack() + result = ((("null" if result1 is None else result1) + HxOverrides.stringOrNull((("null" if ((tmp is None)) else haxe__CallStack_CallStack_Impl_.toString(tmp))))) + ("null" if result is None else result)) + else: + prevStack = haxe__CallStack_CallStack_Impl_.subtract(e.get_stack(),prev.get_stack()) + result = (((("Exception: " + HxOverrides.stringOrNull(e.get_message())) + HxOverrides.stringOrNull((("null" if ((prevStack is None)) else haxe__CallStack_CallStack_Impl_.toString(prevStack))))) + "\n\nNext ") + ("null" if result is None else result)) + prev = e + e = e.get_previous() + return result + + def _hx___shiftStack(self): + _hx_local_0 = self + _hx_local_1 = _hx_local_0._hx___skipStack + _hx_local_0._hx___skipStack = (_hx_local_1 + 1) + _hx_local_1 + + def get_message(self): + return str(self) + + def get_previous(self): + return self._hx___previousException + + def get_native(self): + return self._hx___nativeException + + def get_stack(self): + _g = self._hx___exceptionStack + if (_g is None): + def _hx_local_1(): + def _hx_local_0(): + self._hx___exceptionStack = haxe_NativeStackTrace.toHaxe(self._hx___nativeStack,self._hx___skipStack) + return self._hx___exceptionStack + return _hx_local_0() + return _hx_local_1() + else: + s = _g + return s + + @staticmethod + def caught(value): + if Std.isOfType(value,haxe_Exception): + return value + elif Std.isOfType(value,BaseException): + return haxe_Exception(str(value),None,value) + else: + return haxe_ValueException(value,None,value) + + @staticmethod + def thrown(value): + if Std.isOfType(value,haxe_Exception): + return value.get_native() + elif Std.isOfType(value,BaseException): + return value + else: + e = haxe_ValueException(value) + e._hx___skipStack = (e._hx___skipStack + 1) + return e + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o._hx___exceptionStack = None + _hx_o._hx___nativeStack = None + _hx_o._hx___skipStack = None + _hx_o._hx___nativeException = None + _hx_o._hx___previousException = None + + +class haxe__Int32_Int32_Impl_: + _hx_class_name = "haxe._Int32.Int32_Impl_" + __slots__ = () + _hx_statics = ["negate", "preIncrement", "postIncrement", "preDecrement", "postDecrement", "add", "addInt", "sub", "subInt", "intSub", "mul", "mulInt", "complement", "or", "orInt", "xor", "xorInt", "shr", "shrInt", "intShr", "shl", "shlInt", "intShl", "toFloat", "ucompare", "clamp"] + + @staticmethod + def negate(this1): + return (((~this1 + 1) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + + @staticmethod + def preIncrement(this1): + this1 = (this1 + 1) + x = this1 + this1 = ((x + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + return this1 + + @staticmethod + def postIncrement(this1): + ret = this1 + this1 = (this1 + 1) + this1 = ((this1 + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + return ret + + @staticmethod + def preDecrement(this1): + this1 = (this1 - 1) + x = this1 + this1 = ((x + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + return this1 + + @staticmethod + def postDecrement(this1): + ret = this1 + this1 = (this1 - 1) + this1 = ((this1 + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + return ret + + @staticmethod + def add(a,b): + return (((a + b) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + + @staticmethod + def addInt(a,b): + return (((a + b) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + + @staticmethod + def sub(a,b): + return (((a - b) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + + @staticmethod + def subInt(a,b): + return (((a - b) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + + @staticmethod + def intSub(a,b): + return (((a - b) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + + @staticmethod + def mul(a,b): + return ((((a * ((b & 65535))) + ((((((a * (HxOverrides.rshift(b, 16))) << 16)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + + @staticmethod + def mulInt(a,b): + return haxe__Int32_Int32_Impl_.mul(a,b) + + @staticmethod + def complement(a): + return ((~a + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + + @staticmethod + def _hx_or(a,b): + return ((((a | b)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + + @staticmethod + def orInt(a,b): + return ((((a | b)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + + @staticmethod + def xor(a,b): + return ((((a ^ b)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + + @staticmethod + def xorInt(a,b): + return ((((a ^ b)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + + @staticmethod + def shr(a,b): + return ((((a >> b)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + + @staticmethod + def shrInt(a,b): + return ((((a >> b)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + + @staticmethod + def intShr(a,b): + return ((((a >> b)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + + @staticmethod + def shl(a,b): + return ((((a << b)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + + @staticmethod + def shlInt(a,b): + return ((((a << b)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + + @staticmethod + def intShl(a,b): + return ((((a << b)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + + @staticmethod + def toFloat(this1): + return this1 + + @staticmethod + def ucompare(a,b): + if (a < 0): + if (b < 0): + return (((((~b + (2 ** 31)) % (2 ** 32) - (2 ** 31)) - (((~a + (2 ** 31)) % (2 ** 32) - (2 ** 31)))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + else: + return 1 + if (b < 0): + return -1 + else: + return (((a - b) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + + @staticmethod + def clamp(x): + return ((x + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + + +class haxe__Int64_Int64_Impl_: + _hx_class_name = "haxe._Int64.Int64_Impl_" + __slots__ = () + _hx_statics = ["_new", "copy", "make", "ofInt", "toInt", "is", "isInt64", "getHigh", "getLow", "isNeg", "isZero", "compare", "ucompare", "toStr", "toString", "parseString", "fromFloat", "divMod", "neg", "preIncrement", "postIncrement", "preDecrement", "postDecrement", "add", "addInt", "sub", "subInt", "intSub", "mul", "mulInt", "div", "divInt", "intDiv", "mod", "modInt", "intMod", "eq", "eqInt", "neq", "neqInt", "lt", "ltInt", "intLt", "lte", "lteInt", "intLte", "gt", "gtInt", "intGt", "gte", "gteInt", "intGte", "complement", "and", "or", "xor", "shl", "shr", "ushr", "get_high", "set_high", "get_low", "set_low"] + high = None + low = None + + @staticmethod + def _new(x): + this1 = x + return this1 + + @staticmethod + def copy(this1): + this2 = haxe__Int64____Int64(this1.high,this1.low) + return this2 + + @staticmethod + def make(high,low): + this1 = haxe__Int64____Int64(high,low) + return this1 + + @staticmethod + def ofInt(x): + this1 = haxe__Int64____Int64((x >> 31),x) + return this1 + + @staticmethod + def toInt(x): + if (x.high != ((((x.low >> 31)) + (2 ** 31)) % (2 ** 32) - (2 ** 31))): + raise haxe_Exception.thrown("Overflow") + return x.low + + @staticmethod + def _hx_is(val): + return Std.isOfType(val,haxe__Int64____Int64) + + @staticmethod + def isInt64(val): + return Std.isOfType(val,haxe__Int64____Int64) + + @staticmethod + def getHigh(x): + return x.high + + @staticmethod + def getLow(x): + return x.low + + @staticmethod + def isNeg(x): + return (x.high < 0) + + @staticmethod + def isZero(x): + b_high = 0 + b_low = 0 + if (x.high == b_high): + return (x.low == b_low) + else: + return False + + @staticmethod + def compare(a,b): + v = (((a.high - b.high) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (v == 0): + v = haxe__Int32_Int32_Impl_.ucompare(a.low,b.low) + if (a.high < 0): + if (b.high < 0): + return v + else: + return -1 + elif (b.high >= 0): + return v + else: + return 1 + + @staticmethod + def ucompare(a,b): + v = haxe__Int32_Int32_Impl_.ucompare(a.high,b.high) + if (v != 0): + return v + else: + return haxe__Int32_Int32_Impl_.ucompare(a.low,b.low) + + @staticmethod + def toStr(x): + return haxe__Int64_Int64_Impl_.toString(x) + + @staticmethod + def toString(this1): + i = this1 + b_high = 0 + b_low = 0 + if ((i.high == b_high) and ((i.low == b_low))): + return "0" + _hx_str = "" + neg = False + if (i.high < 0): + neg = True + this1 = haxe__Int64____Int64(0,10) + ten = this1 + while True: + b_high = 0 + b_low = 0 + if (not (((i.high != b_high) or ((i.low != b_low))))): + break + r = haxe__Int64_Int64_Impl_.divMod(i,ten) + if (r.modulus.high < 0): + x = r.modulus + high = ((~x.high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + low = (((~x.low + 1) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (low == 0): + ret = high + high = (high + 1) + high = ((high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + this_high = high + this_low = low + _hx_str = (Std.string(this_low) + ("null" if _hx_str is None else _hx_str)) + x1 = r.quotient + high1 = ((~x1.high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + low1 = (((~x1.low + 1) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (low1 == 0): + ret1 = high1 + high1 = (high1 + 1) + high1 = ((high1 + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + this1 = haxe__Int64____Int64(high1,low1) + i = this1 + else: + _hx_str = (Std.string(r.modulus.low) + ("null" if _hx_str is None else _hx_str)) + i = r.quotient + if neg: + _hx_str = ("-" + ("null" if _hx_str is None else _hx_str)) + return _hx_str + + @staticmethod + def parseString(sParam): + return haxe_Int64Helper.parseString(sParam) + + @staticmethod + def fromFloat(f): + return haxe_Int64Helper.fromFloat(f) + + @staticmethod + def divMod(dividend,divisor): + if (divisor.high == 0): + _g = divisor.low + if (_g == 0): + raise haxe_Exception.thrown("divide by zero") + elif (_g == 1): + this1 = haxe__Int64____Int64(dividend.high,dividend.low) + this2 = haxe__Int64____Int64(0,0) + return _hx_AnonObject({'quotient': this1, 'modulus': this2}) + else: + pass + divSign = ((dividend.high < 0) != ((divisor.high < 0))) + modulus = None + if (dividend.high < 0): + high = ((~dividend.high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + low = (((~dividend.low + 1) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (low == 0): + ret = high + high = (high + 1) + high = ((high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + this1 = haxe__Int64____Int64(high,low) + modulus = this1 + else: + this1 = haxe__Int64____Int64(dividend.high,dividend.low) + modulus = this1 + if (divisor.high < 0): + high = ((~divisor.high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + low = (((~divisor.low + 1) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (low == 0): + ret = high + high = (high + 1) + high = ((high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + this1 = haxe__Int64____Int64(high,low) + divisor = this1 + this1 = haxe__Int64____Int64(0,0) + quotient = this1 + this1 = haxe__Int64____Int64(0,1) + mask = this1 + while (not ((divisor.high < 0))): + v = haxe__Int32_Int32_Impl_.ucompare(divisor.high,modulus.high) + cmp = (v if ((v != 0)) else haxe__Int32_Int32_Impl_.ucompare(divisor.low,modulus.low)) + b = 1 + b = (b & 63) + if (b == 0): + this1 = haxe__Int64____Int64(divisor.high,divisor.low) + divisor = this1 + elif (b < 32): + this2 = haxe__Int64____Int64(((((((((divisor.high << b)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) | HxOverrides.rshift(divisor.low, ((32 - b))))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)),((((divisor.low << b)) + (2 ** 31)) % (2 ** 32) - (2 ** 31))) + divisor = this2 + else: + this3 = haxe__Int64____Int64(((((divisor.low << ((b - 32)))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)),0) + divisor = this3 + b1 = 1 + b1 = (b1 & 63) + if (b1 == 0): + this4 = haxe__Int64____Int64(mask.high,mask.low) + mask = this4 + elif (b1 < 32): + this5 = haxe__Int64____Int64(((((((((mask.high << b1)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) | HxOverrides.rshift(mask.low, ((32 - b1))))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)),((((mask.low << b1)) + (2 ** 31)) % (2 ** 32) - (2 ** 31))) + mask = this5 + else: + this6 = haxe__Int64____Int64(((((mask.low << ((b1 - 32)))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)),0) + mask = this6 + if (cmp >= 0): + break + while True: + b_high = 0 + b_low = 0 + if (not (((mask.high != b_high) or ((mask.low != b_low))))): + break + v = haxe__Int32_Int32_Impl_.ucompare(modulus.high,divisor.high) + if (((v if ((v != 0)) else haxe__Int32_Int32_Impl_.ucompare(modulus.low,divisor.low))) >= 0): + this1 = haxe__Int64____Int64(((((quotient.high | mask.high)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)),((((quotient.low | mask.low)) + (2 ** 31)) % (2 ** 32) - (2 ** 31))) + quotient = this1 + high = (((modulus.high - divisor.high) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + low = (((modulus.low - divisor.low) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (haxe__Int32_Int32_Impl_.ucompare(modulus.low,divisor.low) < 0): + ret = high + high = (high - 1) + high = ((high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + this2 = haxe__Int64____Int64(high,low) + modulus = this2 + b = 1 + b = (b & 63) + if (b == 0): + this3 = haxe__Int64____Int64(mask.high,mask.low) + mask = this3 + elif (b < 32): + this4 = haxe__Int64____Int64(HxOverrides.rshift(mask.high, b),((((((((mask.high << ((32 - b)))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) | HxOverrides.rshift(mask.low, b))) + (2 ** 31)) % (2 ** 32) - (2 ** 31))) + mask = this4 + else: + this5 = haxe__Int64____Int64(0,HxOverrides.rshift(mask.high, ((b - 32)))) + mask = this5 + b1 = 1 + b1 = (b1 & 63) + if (b1 == 0): + this6 = haxe__Int64____Int64(divisor.high,divisor.low) + divisor = this6 + elif (b1 < 32): + this7 = haxe__Int64____Int64(HxOverrides.rshift(divisor.high, b1),((((((((divisor.high << ((32 - b1)))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) | HxOverrides.rshift(divisor.low, b1))) + (2 ** 31)) % (2 ** 32) - (2 ** 31))) + divisor = this7 + else: + this8 = haxe__Int64____Int64(0,HxOverrides.rshift(divisor.high, ((b1 - 32)))) + divisor = this8 + if divSign: + high = ((~quotient.high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + low = (((~quotient.low + 1) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (low == 0): + ret = high + high = (high + 1) + high = ((high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + this1 = haxe__Int64____Int64(high,low) + quotient = this1 + if (dividend.high < 0): + high = ((~modulus.high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + low = (((~modulus.low + 1) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (low == 0): + ret = high + high = (high + 1) + high = ((high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + this1 = haxe__Int64____Int64(high,low) + modulus = this1 + return _hx_AnonObject({'quotient': quotient, 'modulus': modulus}) + + @staticmethod + def neg(x): + high = ((~x.high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + low = (((~x.low + 1) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (low == 0): + ret = high + high = (high + 1) + high = ((high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + this1 = haxe__Int64____Int64(high,low) + return this1 + + @staticmethod + def preIncrement(this1): + this2 = haxe__Int64____Int64(this1.high,this1.low) + this1 = this2 + def _hx_local_1(): + _hx_local_0 = this1.low + this1.low = (this1.low + 1) + return _hx_local_0 + ret = _hx_local_1() + this1.low = ((this1.low + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (this1.low == 0): + def _hx_local_3(): + _hx_local_2 = this1.high + this1.high = (this1.high + 1) + return _hx_local_2 + ret = _hx_local_3() + this1.high = ((this1.high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + return this1 + + @staticmethod + def postIncrement(this1): + ret = this1 + this2 = haxe__Int64____Int64(this1.high,this1.low) + this1 = this2 + def _hx_local_2(): + _hx_local_0 = this1 + _hx_local_1 = _hx_local_0.low + _hx_local_0.low = (_hx_local_1 + 1) + return _hx_local_1 + ret1 = _hx_local_2() + this1.low = ((this1.low + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (this1.low == 0): + def _hx_local_5(): + _hx_local_3 = this1 + _hx_local_4 = _hx_local_3.high + _hx_local_3.high = (_hx_local_4 + 1) + return _hx_local_4 + ret1 = _hx_local_5() + this1.high = ((this1.high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + return ret + + @staticmethod + def preDecrement(this1): + this2 = haxe__Int64____Int64(this1.high,this1.low) + this1 = this2 + if (this1.low == 0): + def _hx_local_1(): + _hx_local_0 = this1.high + this1.high = (this1.high - 1) + return _hx_local_0 + ret = _hx_local_1() + this1.high = ((this1.high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + def _hx_local_3(): + _hx_local_2 = this1.low + this1.low = (this1.low - 1) + return _hx_local_2 + ret = _hx_local_3() + this1.low = ((this1.low + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + return this1 + + @staticmethod + def postDecrement(this1): + ret = this1 + this2 = haxe__Int64____Int64(this1.high,this1.low) + this1 = this2 + if (this1.low == 0): + def _hx_local_2(): + _hx_local_0 = this1 + _hx_local_1 = _hx_local_0.high + _hx_local_0.high = (_hx_local_1 - 1) + return _hx_local_1 + ret1 = _hx_local_2() + this1.high = ((this1.high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + def _hx_local_5(): + _hx_local_3 = this1 + _hx_local_4 = _hx_local_3.low + _hx_local_3.low = (_hx_local_4 - 1) + return _hx_local_4 + ret1 = _hx_local_5() + this1.low = ((this1.low + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + return ret + + @staticmethod + def add(a,b): + high = (((a.high + b.high) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + low = (((a.low + b.low) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (haxe__Int32_Int32_Impl_.ucompare(low,a.low) < 0): + ret = high + high = (high + 1) + high = ((high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + this1 = haxe__Int64____Int64(high,low) + return this1 + + @staticmethod + def addInt(a,b): + b_high = (b >> 31) + b_low = b + high = (((a.high + b_high) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + low = (((a.low + b_low) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (haxe__Int32_Int32_Impl_.ucompare(low,a.low) < 0): + ret = high + high = (high + 1) + high = ((high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + this1 = haxe__Int64____Int64(high,low) + return this1 + + @staticmethod + def sub(a,b): + high = (((a.high - b.high) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + low = (((a.low - b.low) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (haxe__Int32_Int32_Impl_.ucompare(a.low,b.low) < 0): + ret = high + high = (high - 1) + high = ((high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + this1 = haxe__Int64____Int64(high,low) + return this1 + + @staticmethod + def subInt(a,b): + b_high = (b >> 31) + b_low = b + high = (((a.high - b_high) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + low = (((a.low - b_low) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (haxe__Int32_Int32_Impl_.ucompare(a.low,b_low) < 0): + ret = high + high = (high - 1) + high = ((high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + this1 = haxe__Int64____Int64(high,low) + return this1 + + @staticmethod + def intSub(a,b): + a_high = (a >> 31) + a_low = a + high = (((a_high - b.high) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + low = (((a_low - b.low) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (haxe__Int32_Int32_Impl_.ucompare(a_low,b.low) < 0): + ret = high + high = (high - 1) + high = ((high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + this1 = haxe__Int64____Int64(high,low) + return this1 + + @staticmethod + def mul(a,b): + mask = 65535 + al = (a.low & mask) + ah = HxOverrides.rshift(a.low, 16) + bl = (b.low & mask) + bh = HxOverrides.rshift(b.low, 16) + p00 = haxe__Int32_Int32_Impl_.mul(al,bl) + p10 = haxe__Int32_Int32_Impl_.mul(ah,bl) + p01 = haxe__Int32_Int32_Impl_.mul(al,bh) + p11 = haxe__Int32_Int32_Impl_.mul(ah,bh) + low = p00 + high = ((((((p11 + (HxOverrides.rshift(p01, 16))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + (HxOverrides.rshift(p10, 16))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + p01 = ((((p01 << 16)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + low = (((low + p01) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (haxe__Int32_Int32_Impl_.ucompare(low,p01) < 0): + ret = high + high = (high + 1) + high = ((high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + p10 = ((((p10 << 16)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + low = (((low + p10) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (haxe__Int32_Int32_Impl_.ucompare(low,p10) < 0): + ret = high + high = (high + 1) + high = ((high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + high = (((high + ((((haxe__Int32_Int32_Impl_.mul(a.low,b.high) + haxe__Int32_Int32_Impl_.mul(a.high,b.low)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + this1 = haxe__Int64____Int64(high,low) + return this1 + + @staticmethod + def mulInt(a,b): + b_high = (b >> 31) + b_low = b + mask = 65535 + al = (a.low & mask) + ah = HxOverrides.rshift(a.low, 16) + bl = (b_low & mask) + bh = HxOverrides.rshift(b_low, 16) + p00 = haxe__Int32_Int32_Impl_.mul(al,bl) + p10 = haxe__Int32_Int32_Impl_.mul(ah,bl) + p01 = haxe__Int32_Int32_Impl_.mul(al,bh) + p11 = haxe__Int32_Int32_Impl_.mul(ah,bh) + low = p00 + high = ((((((p11 + (HxOverrides.rshift(p01, 16))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + (HxOverrides.rshift(p10, 16))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + p01 = ((((p01 << 16)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + low = (((low + p01) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (haxe__Int32_Int32_Impl_.ucompare(low,p01) < 0): + ret = high + high = (high + 1) + high = ((high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + p10 = ((((p10 << 16)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + low = (((low + p10) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (haxe__Int32_Int32_Impl_.ucompare(low,p10) < 0): + ret = high + high = (high + 1) + high = ((high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + high = (((high + ((((haxe__Int32_Int32_Impl_.mul(a.low,b_high) + haxe__Int32_Int32_Impl_.mul(a.high,b_low)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + this1 = haxe__Int64____Int64(high,low) + return this1 + + @staticmethod + def div(a,b): + return haxe__Int64_Int64_Impl_.divMod(a,b).quotient + + @staticmethod + def divInt(a,b): + this1 = haxe__Int64____Int64((b >> 31),b) + return haxe__Int64_Int64_Impl_.divMod(a,this1).quotient + + @staticmethod + def intDiv(a,b): + this1 = haxe__Int64____Int64((a >> 31),a) + x = haxe__Int64_Int64_Impl_.divMod(this1,b).quotient + if (x.high != ((((x.low >> 31)) + (2 ** 31)) % (2 ** 32) - (2 ** 31))): + raise haxe_Exception.thrown("Overflow") + x1 = x.low + this1 = haxe__Int64____Int64((x1 >> 31),x1) + return this1 + + @staticmethod + def mod(a,b): + return haxe__Int64_Int64_Impl_.divMod(a,b).modulus + + @staticmethod + def modInt(a,b): + this1 = haxe__Int64____Int64((b >> 31),b) + x = haxe__Int64_Int64_Impl_.divMod(a,this1).modulus + if (x.high != ((((x.low >> 31)) + (2 ** 31)) % (2 ** 32) - (2 ** 31))): + raise haxe_Exception.thrown("Overflow") + x1 = x.low + this1 = haxe__Int64____Int64((x1 >> 31),x1) + return this1 + + @staticmethod + def intMod(a,b): + this1 = haxe__Int64____Int64((a >> 31),a) + x = haxe__Int64_Int64_Impl_.divMod(this1,b).modulus + if (x.high != ((((x.low >> 31)) + (2 ** 31)) % (2 ** 32) - (2 ** 31))): + raise haxe_Exception.thrown("Overflow") + x1 = x.low + this1 = haxe__Int64____Int64((x1 >> 31),x1) + return this1 + + @staticmethod + def eq(a,b): + if (a.high == b.high): + return (a.low == b.low) + else: + return False + + @staticmethod + def eqInt(a,b): + b_high = (b >> 31) + b_low = b + if (a.high == b_high): + return (a.low == b_low) + else: + return False + + @staticmethod + def neq(a,b): + if (a.high == b.high): + return (a.low != b.low) + else: + return True + + @staticmethod + def neqInt(a,b): + b_high = (b >> 31) + b_low = b + if (a.high == b_high): + return (a.low != b_low) + else: + return True + + @staticmethod + def lt(a,b): + v = (((a.high - b.high) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (v == 0): + v = haxe__Int32_Int32_Impl_.ucompare(a.low,b.low) + return ((((v if ((b.high < 0)) else -1) if ((a.high < 0)) else (v if ((b.high >= 0)) else 1))) < 0) + + @staticmethod + def ltInt(a,b): + b_high = (b >> 31) + b_low = b + v = (((a.high - b_high) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (v == 0): + v = haxe__Int32_Int32_Impl_.ucompare(a.low,b_low) + return ((((v if ((b_high < 0)) else -1) if ((a.high < 0)) else (v if ((b_high >= 0)) else 1))) < 0) + + @staticmethod + def intLt(a,b): + a_high = (a >> 31) + a_low = a + v = (((a_high - b.high) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (v == 0): + v = haxe__Int32_Int32_Impl_.ucompare(a_low,b.low) + return ((((v if ((b.high < 0)) else -1) if ((a_high < 0)) else (v if ((b.high >= 0)) else 1))) < 0) + + @staticmethod + def lte(a,b): + v = (((a.high - b.high) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (v == 0): + v = haxe__Int32_Int32_Impl_.ucompare(a.low,b.low) + return ((((v if ((b.high < 0)) else -1) if ((a.high < 0)) else (v if ((b.high >= 0)) else 1))) <= 0) + + @staticmethod + def lteInt(a,b): + b_high = (b >> 31) + b_low = b + v = (((a.high - b_high) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (v == 0): + v = haxe__Int32_Int32_Impl_.ucompare(a.low,b_low) + return ((((v if ((b_high < 0)) else -1) if ((a.high < 0)) else (v if ((b_high >= 0)) else 1))) <= 0) + + @staticmethod + def intLte(a,b): + a_high = (a >> 31) + a_low = a + v = (((a_high - b.high) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (v == 0): + v = haxe__Int32_Int32_Impl_.ucompare(a_low,b.low) + return ((((v if ((b.high < 0)) else -1) if ((a_high < 0)) else (v if ((b.high >= 0)) else 1))) <= 0) + + @staticmethod + def gt(a,b): + v = (((a.high - b.high) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (v == 0): + v = haxe__Int32_Int32_Impl_.ucompare(a.low,b.low) + return ((((v if ((b.high < 0)) else -1) if ((a.high < 0)) else (v if ((b.high >= 0)) else 1))) > 0) + + @staticmethod + def gtInt(a,b): + b_high = (b >> 31) + b_low = b + v = (((a.high - b_high) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (v == 0): + v = haxe__Int32_Int32_Impl_.ucompare(a.low,b_low) + return ((((v if ((b_high < 0)) else -1) if ((a.high < 0)) else (v if ((b_high >= 0)) else 1))) > 0) + + @staticmethod + def intGt(a,b): + a_high = (a >> 31) + a_low = a + v = (((a_high - b.high) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (v == 0): + v = haxe__Int32_Int32_Impl_.ucompare(a_low,b.low) + return ((((v if ((b.high < 0)) else -1) if ((a_high < 0)) else (v if ((b.high >= 0)) else 1))) > 0) + + @staticmethod + def gte(a,b): + v = (((a.high - b.high) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (v == 0): + v = haxe__Int32_Int32_Impl_.ucompare(a.low,b.low) + return ((((v if ((b.high < 0)) else -1) if ((a.high < 0)) else (v if ((b.high >= 0)) else 1))) >= 0) + + @staticmethod + def gteInt(a,b): + b_high = (b >> 31) + b_low = b + v = (((a.high - b_high) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (v == 0): + v = haxe__Int32_Int32_Impl_.ucompare(a.low,b_low) + return ((((v if ((b_high < 0)) else -1) if ((a.high < 0)) else (v if ((b_high >= 0)) else 1))) >= 0) + + @staticmethod + def intGte(a,b): + a_high = (a >> 31) + a_low = a + v = (((a_high - b.high) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (v == 0): + v = haxe__Int32_Int32_Impl_.ucompare(a_low,b.low) + return ((((v if ((b.high < 0)) else -1) if ((a_high < 0)) else (v if ((b.high >= 0)) else 1))) >= 0) + + @staticmethod + def complement(a): + this1 = haxe__Int64____Int64(((~a.high + (2 ** 31)) % (2 ** 32) - (2 ** 31)),((~a.low + (2 ** 31)) % (2 ** 32) - (2 ** 31))) + return this1 + + @staticmethod + def _hx_and(a,b): + this1 = haxe__Int64____Int64((a.high & b.high),(a.low & b.low)) + return this1 + + @staticmethod + def _hx_or(a,b): + this1 = haxe__Int64____Int64(((((a.high | b.high)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)),((((a.low | b.low)) + (2 ** 31)) % (2 ** 32) - (2 ** 31))) + return this1 + + @staticmethod + def xor(a,b): + this1 = haxe__Int64____Int64(((((a.high ^ b.high)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)),((((a.low ^ b.low)) + (2 ** 31)) % (2 ** 32) - (2 ** 31))) + return this1 + + @staticmethod + def shl(a,b): + b = (b & 63) + if (b == 0): + this1 = haxe__Int64____Int64(a.high,a.low) + return this1 + elif (b < 32): + this1 = haxe__Int64____Int64(((((((((a.high << b)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) | HxOverrides.rshift(a.low, ((32 - b))))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)),((((a.low << b)) + (2 ** 31)) % (2 ** 32) - (2 ** 31))) + return this1 + else: + this1 = haxe__Int64____Int64(((((a.low << ((b - 32)))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)),0) + return this1 + + @staticmethod + def shr(a,b): + b = (b & 63) + if (b == 0): + this1 = haxe__Int64____Int64(a.high,a.low) + return this1 + elif (b < 32): + this1 = haxe__Int64____Int64(((((a.high >> b)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)),((((((((a.high << ((32 - b)))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) | HxOverrides.rshift(a.low, b))) + (2 ** 31)) % (2 ** 32) - (2 ** 31))) + return this1 + else: + this1 = haxe__Int64____Int64(((((a.high >> 31)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)),((((a.high >> ((b - 32)))) + (2 ** 31)) % (2 ** 32) - (2 ** 31))) + return this1 + + @staticmethod + def ushr(a,b): + b = (b & 63) + if (b == 0): + this1 = haxe__Int64____Int64(a.high,a.low) + return this1 + elif (b < 32): + this1 = haxe__Int64____Int64(HxOverrides.rshift(a.high, b),((((((((a.high << ((32 - b)))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) | HxOverrides.rshift(a.low, b))) + (2 ** 31)) % (2 ** 32) - (2 ** 31))) + return this1 + else: + this1 = haxe__Int64____Int64(0,HxOverrides.rshift(a.high, ((b - 32)))) + return this1 + + @staticmethod + def get_high(this1): + return this1.high + + @staticmethod + def set_high(this1,x): + def _hx_local_1(): + def _hx_local_0(): + this1.high = x + return this1.high + return _hx_local_0() + return _hx_local_1() + + @staticmethod + def get_low(this1): + return this1.low + + @staticmethod + def set_low(this1,x): + def _hx_local_1(): + def _hx_local_0(): + this1.low = x + return this1.low + return _hx_local_0() + return _hx_local_1() + + +class haxe__Int64____Int64: + _hx_class_name = "haxe._Int64.___Int64" + __slots__ = ("high", "low") + _hx_fields = ["high", "low"] + _hx_methods = ["toString"] + + def __init__(self,high,low): + self.high = high + self.low = low + + def toString(self): + return haxe__Int64_Int64_Impl_.toString(self) + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.high = None + _hx_o.low = None + + +class haxe_Int64Helper: + _hx_class_name = "haxe.Int64Helper" + __slots__ = () + _hx_statics = ["parseString", "fromFloat"] + + @staticmethod + def parseString(sParam): + base_high = 0 + base_low = 10 + this1 = haxe__Int64____Int64(0,0) + current = this1 + this1 = haxe__Int64____Int64(0,1) + multiplier = this1 + sIsNegative = False + s = StringTools.trim(sParam) + if ((("" if ((0 >= len(s))) else s[0])) == "-"): + sIsNegative = True + s = HxString.substring(s,1,len(s)) + _hx_len = len(s) + _g = 0 + _g1 = _hx_len + while (_g < _g1): + i = _g + _g = (_g + 1) + digitInt = (HxString.charCodeAt(s,((_hx_len - 1) - i)) - 48) + if ((digitInt < 0) or ((digitInt > 9))): + raise haxe_Exception.thrown("NumberFormatError") + if (digitInt != 0): + digit_high = (digitInt >> 31) + digit_low = digitInt + if sIsNegative: + mask = 65535 + al = (multiplier.low & mask) + ah = HxOverrides.rshift(multiplier.low, 16) + bl = (digit_low & mask) + bh = HxOverrides.rshift(digit_low, 16) + p00 = haxe__Int32_Int32_Impl_.mul(al,bl) + p10 = haxe__Int32_Int32_Impl_.mul(ah,bl) + p01 = haxe__Int32_Int32_Impl_.mul(al,bh) + p11 = haxe__Int32_Int32_Impl_.mul(ah,bh) + low = p00 + high = ((((((p11 + (HxOverrides.rshift(p01, 16))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + (HxOverrides.rshift(p10, 16))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + p01 = ((((p01 << 16)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + low = (((low + p01) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (haxe__Int32_Int32_Impl_.ucompare(low,p01) < 0): + ret = high + high = (high + 1) + high = ((high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + p10 = ((((p10 << 16)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + low = (((low + p10) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (haxe__Int32_Int32_Impl_.ucompare(low,p10) < 0): + ret1 = high + high = (high + 1) + high = ((high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + high = (((high + ((((haxe__Int32_Int32_Impl_.mul(multiplier.low,digit_high) + haxe__Int32_Int32_Impl_.mul(multiplier.high,digit_low)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + b_high = high + b_low = low + high1 = (((current.high - b_high) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + low1 = (((current.low - b_low) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (haxe__Int32_Int32_Impl_.ucompare(current.low,b_low) < 0): + ret2 = high1 + high1 = (high1 - 1) + high1 = ((high1 + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + this1 = haxe__Int64____Int64(high1,low1) + current = this1 + if (not ((current.high < 0))): + raise haxe_Exception.thrown("NumberFormatError: Underflow") + else: + mask1 = 65535 + al1 = (multiplier.low & mask1) + ah1 = HxOverrides.rshift(multiplier.low, 16) + bl1 = (digit_low & mask1) + bh1 = HxOverrides.rshift(digit_low, 16) + p001 = haxe__Int32_Int32_Impl_.mul(al1,bl1) + p101 = haxe__Int32_Int32_Impl_.mul(ah1,bl1) + p011 = haxe__Int32_Int32_Impl_.mul(al1,bh1) + p111 = haxe__Int32_Int32_Impl_.mul(ah1,bh1) + low2 = p001 + high2 = ((((((p111 + (HxOverrides.rshift(p011, 16))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + (HxOverrides.rshift(p101, 16))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + p011 = ((((p011 << 16)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + low2 = (((low2 + p011) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (haxe__Int32_Int32_Impl_.ucompare(low2,p011) < 0): + ret3 = high2 + high2 = (high2 + 1) + high2 = ((high2 + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + p101 = ((((p101 << 16)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + low2 = (((low2 + p101) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (haxe__Int32_Int32_Impl_.ucompare(low2,p101) < 0): + ret4 = high2 + high2 = (high2 + 1) + high2 = ((high2 + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + high2 = (((high2 + ((((haxe__Int32_Int32_Impl_.mul(multiplier.low,digit_high) + haxe__Int32_Int32_Impl_.mul(multiplier.high,digit_low)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + b_high1 = high2 + b_low1 = low2 + high3 = (((current.high + b_high1) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + low3 = (((current.low + b_low1) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (haxe__Int32_Int32_Impl_.ucompare(low3,current.low) < 0): + ret5 = high3 + high3 = (high3 + 1) + high3 = ((high3 + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + this2 = haxe__Int64____Int64(high3,low3) + current = this2 + if (current.high < 0): + raise haxe_Exception.thrown("NumberFormatError: Overflow") + mask2 = 65535 + al2 = (multiplier.low & mask2) + ah2 = HxOverrides.rshift(multiplier.low, 16) + bl2 = (base_low & mask2) + bh2 = HxOverrides.rshift(base_low, 16) + p002 = haxe__Int32_Int32_Impl_.mul(al2,bl2) + p102 = haxe__Int32_Int32_Impl_.mul(ah2,bl2) + p012 = haxe__Int32_Int32_Impl_.mul(al2,bh2) + p112 = haxe__Int32_Int32_Impl_.mul(ah2,bh2) + low4 = p002 + high4 = ((((((p112 + (HxOverrides.rshift(p012, 16))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + (HxOverrides.rshift(p102, 16))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + p012 = ((((p012 << 16)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + low4 = (((low4 + p012) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (haxe__Int32_Int32_Impl_.ucompare(low4,p012) < 0): + ret6 = high4 + high4 = (high4 + 1) + high4 = ((high4 + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + p102 = ((((p102 << 16)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + low4 = (((low4 + p102) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (haxe__Int32_Int32_Impl_.ucompare(low4,p102) < 0): + ret7 = high4 + high4 = (high4 + 1) + high4 = ((high4 + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + high4 = (((high4 + ((((haxe__Int32_Int32_Impl_.mul(multiplier.low,base_high) + haxe__Int32_Int32_Impl_.mul(multiplier.high,base_low)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + this3 = haxe__Int64____Int64(high4,low4) + multiplier = this3 + return current + + @staticmethod + def fromFloat(f): + if (python_lib_Math.isnan(f) or (not ((((f != Math.POSITIVE_INFINITY) and ((f != Math.NEGATIVE_INFINITY))) and (not python_lib_Math.isnan(f)))))): + raise haxe_Exception.thrown("Number is NaN or Infinite") + noFractions = (f - (HxOverrides.modf(f, 1))) + if (noFractions > 9007199254740991): + raise haxe_Exception.thrown("Conversion overflow") + if (noFractions < -9007199254740991): + raise haxe_Exception.thrown("Conversion underflow") + this1 = haxe__Int64____Int64(0,0) + result = this1 + neg = (noFractions < 0) + rest = (-noFractions if neg else noFractions) + i = 0 + while (rest >= 1): + curr = HxOverrides.modf(rest, 2) + rest = (rest / 2) + if (curr >= 1): + a_high = 0 + a_low = 1 + b = i + b = (b & 63) + b1 = None + if (b == 0): + this1 = haxe__Int64____Int64(a_high,a_low) + b1 = this1 + elif (b < 32): + this2 = haxe__Int64____Int64(((((((((a_high << b)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) | HxOverrides.rshift(a_low, ((32 - b))))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)),((((a_low << b)) + (2 ** 31)) % (2 ** 32) - (2 ** 31))) + b1 = this2 + else: + this3 = haxe__Int64____Int64(((((a_low << ((b - 32)))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)),0) + b1 = this3 + high = (((result.high + b1.high) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + low = (((result.low + b1.low) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (haxe__Int32_Int32_Impl_.ucompare(low,result.low) < 0): + ret = high + high = (high + 1) + high = ((high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + this4 = haxe__Int64____Int64(high,low) + result = this4 + i = (i + 1) + if neg: + high = ((~result.high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + low = (((~result.low + 1) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (low == 0): + ret = high + high = (high + 1) + high = ((high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + this1 = haxe__Int64____Int64(high,low) + result = this1 + return result + + +class haxe_NativeStackTrace: + _hx_class_name = "haxe.NativeStackTrace" + __slots__ = () + _hx_statics = ["saveStack", "callStack", "exceptionStack", "toHaxe"] + + @staticmethod + def saveStack(exception): + pass + + @staticmethod + def callStack(): + infos = python_lib_Traceback.extract_stack() + if (len(infos) != 0): + infos.pop() + infos.reverse() + return infos + + @staticmethod + def exceptionStack(): + exc = python_lib_Sys.exc_info() + if (exc[2] is not None): + infos = python_lib_Traceback.extract_tb(exc[2]) + infos.reverse() + return infos + else: + return [] + + @staticmethod + def toHaxe(native,skip = None): + if (skip is None): + skip = 0 + stack = [] + _g = 0 + _g1 = len(native) + while (_g < _g1): + i = _g + _g = (_g + 1) + if (skip > i): + continue + elem = (native[i] if i >= 0 and i < len(native) else None) + x = haxe_StackItem.FilePos(haxe_StackItem.Method(None,elem[2]),elem[0],elem[1]) + stack.append(x) + return stack + + +class haxe__Rest_Rest_Impl_: + _hx_class_name = "haxe._Rest.Rest_Impl_" + __slots__ = () + _hx_statics = ["get_length", "of", "_new", "get", "toArray", "iterator", "keyValueIterator", "append", "prepend", "toString"] + length = None + + @staticmethod + def get_length(this1): + return len(this1) + + @staticmethod + def of(array): + this1 = array + return this1 + + @staticmethod + def _new(array): + this1 = array + return this1 + + @staticmethod + def get(this1,index): + return (this1[index] if index >= 0 and index < len(this1) else None) + + @staticmethod + def toArray(this1): + return list(this1) + + @staticmethod + def iterator(this1): + return haxe_iterators_RestIterator(this1) + + @staticmethod + def keyValueIterator(this1): + return haxe_iterators_RestKeyValueIterator(this1) + + @staticmethod + def append(this1,item): + result = list(this1) + result.append(item) + this1 = result + return this1 + + @staticmethod + def prepend(this1,item): + result = list(this1) + result.insert(0, item) + this1 = result + return this1 + + @staticmethod + def toString(this1): + return (("[" + HxOverrides.stringOrNull(",".join([python_Boot.toString1(x1,'') for x1 in this1]))) + "]") + + +class haxe_ValueException(haxe_Exception): + _hx_class_name = "haxe.ValueException" + __slots__ = ("value",) + _hx_fields = ["value"] + _hx_methods = ["unwrap"] + _hx_statics = [] + _hx_interfaces = [] + _hx_super = haxe_Exception + + + def __init__(self,value,previous = None,native = None): + self.value = None + super().__init__(Std.string(value),previous,native) + self.value = value + _hx_local_0 = self + _hx_local_1 = _hx_local_0._hx___skipStack + _hx_local_0._hx___skipStack = (_hx_local_1 + 1) + _hx_local_1 + + def unwrap(self): + return self.value + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.value = None + + +class haxe_ds_BalancedTree: + _hx_class_name = "haxe.ds.BalancedTree" + __slots__ = ("root",) + _hx_fields = ["root"] + _hx_methods = ["set", "get", "remove", "exists", "iterator", "keyValueIterator", "keys", "copy", "setLoop", "removeLoop", "keysLoop", "merge", "minBinding", "removeMinBinding", "balance", "compare", "toString", "clear"] + _hx_statics = ["iteratorLoop"] + _hx_interfaces = [haxe_IMap] + + def __init__(self): + self.root = None + + def set(self,key,value): + self.root = self.setLoop(key,value,self.root) + + def get(self,key): + node = self.root + while (node is not None): + c = self.compare(key,node.key) + if (c == 0): + return node.value + if (c < 0): + node = node.left + else: + node = node.right + return None + + def remove(self,key): + try: + self.root = self.removeLoop(key,self.root) + return True + except BaseException as _g: + None + if Std.isOfType(haxe_Exception.caught(_g).unwrap(),str): + return False + else: + raise _g + + def exists(self,key): + node = self.root + while (node is not None): + c = self.compare(key,node.key) + if (c == 0): + return True + elif (c < 0): + node = node.left + else: + node = node.right + return False + + def iterator(self): + ret = [] + haxe_ds_BalancedTree.iteratorLoop(self.root,ret) + return haxe_iterators_ArrayIterator(ret) + + def keyValueIterator(self): + return haxe_iterators_MapKeyValueIterator(self) + + def keys(self): + ret = [] + self.keysLoop(self.root,ret) + return haxe_iterators_ArrayIterator(ret) + + def copy(self): + copied = haxe_ds_BalancedTree() + copied.root = self.root + return copied + + def setLoop(self,k,v,node): + if (node is None): + return haxe_ds_TreeNode(None,k,v,None) + c = self.compare(k,node.key) + if (c == 0): + return haxe_ds_TreeNode(node.left,k,v,node.right,(0 if ((node is None)) else node._height)) + elif (c < 0): + nl = self.setLoop(k,v,node.left) + return self.balance(nl,node.key,node.value,node.right) + else: + nr = self.setLoop(k,v,node.right) + return self.balance(node.left,node.key,node.value,nr) + + def removeLoop(self,k,node): + if (node is None): + raise haxe_Exception.thrown("Not_found") + c = self.compare(k,node.key) + if (c == 0): + return self.merge(node.left,node.right) + elif (c < 0): + return self.balance(self.removeLoop(k,node.left),node.key,node.value,node.right) + else: + return self.balance(node.left,node.key,node.value,self.removeLoop(k,node.right)) + + def keysLoop(self,node,acc): + if (node is not None): + self.keysLoop(node.left,acc) + x = node.key + acc.append(x) + self.keysLoop(node.right,acc) + + def merge(self,t1,t2): + if (t1 is None): + return t2 + if (t2 is None): + return t1 + t = self.minBinding(t2) + return self.balance(t1,t.key,t.value,self.removeMinBinding(t2)) + + def minBinding(self,t): + if (t is None): + raise haxe_Exception.thrown("Not_found") + elif (t.left is None): + return t + else: + return self.minBinding(t.left) + + def removeMinBinding(self,t): + if (t.left is None): + return t.right + else: + return self.balance(self.removeMinBinding(t.left),t.key,t.value,t.right) + + def balance(self,l,k,v,r): + hl = (0 if ((l is None)) else l._height) + hr = (0 if ((r is None)) else r._height) + if (hl > ((hr + 2))): + _this = l.left + _this1 = l.right + if (((0 if ((_this is None)) else _this._height)) >= ((0 if ((_this1 is None)) else _this1._height))): + return haxe_ds_TreeNode(l.left,l.key,l.value,haxe_ds_TreeNode(l.right,k,v,r)) + else: + return haxe_ds_TreeNode(haxe_ds_TreeNode(l.left,l.key,l.value,l.right.left),l.right.key,l.right.value,haxe_ds_TreeNode(l.right.right,k,v,r)) + elif (hr > ((hl + 2))): + _this = r.right + _this1 = r.left + if (((0 if ((_this is None)) else _this._height)) > ((0 if ((_this1 is None)) else _this1._height))): + return haxe_ds_TreeNode(haxe_ds_TreeNode(l,k,v,r.left),r.key,r.value,r.right) + else: + return haxe_ds_TreeNode(haxe_ds_TreeNode(l,k,v,r.left.left),r.left.key,r.left.value,haxe_ds_TreeNode(r.left.right,r.key,r.value,r.right)) + else: + return haxe_ds_TreeNode(l,k,v,r,(((hl if ((hl > hr)) else hr)) + 1)) + + def compare(self,k1,k2): + return Reflect.compare(k1,k2) + + def toString(self): + if (self.root is None): + return "{}" + else: + return (("{" + HxOverrides.stringOrNull(self.root.toString())) + "}") + + def clear(self): + self.root = None + + @staticmethod + def iteratorLoop(node,acc): + if (node is not None): + haxe_ds_BalancedTree.iteratorLoop(node.left,acc) + x = node.value + acc.append(x) + haxe_ds_BalancedTree.iteratorLoop(node.right,acc) + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.root = None + + +class haxe_ds_TreeNode: + _hx_class_name = "haxe.ds.TreeNode" + __slots__ = ("left", "right", "key", "value", "_height") + _hx_fields = ["left", "right", "key", "value", "_height"] + _hx_methods = ["toString"] + + def __init__(self,l,k,v,r,h = None): + if (h is None): + h = -1 + self._height = None + self.left = l + self.key = k + self.value = v + self.right = r + if (h == -1): + tmp = None + _this = self.left + _this1 = self.right + if (((0 if ((_this is None)) else _this._height)) > ((0 if ((_this1 is None)) else _this1._height))): + _this = self.left + tmp = (0 if ((_this is None)) else _this._height) + else: + _this = self.right + tmp = (0 if ((_this is None)) else _this._height) + self._height = (tmp + 1) + else: + self._height = h + + def toString(self): + return ((HxOverrides.stringOrNull((("" if ((self.left is None)) else (HxOverrides.stringOrNull(self.left.toString()) + ", ")))) + (((("" + Std.string(self.key)) + "=") + Std.string(self.value)))) + HxOverrides.stringOrNull((("" if ((self.right is None)) else (", " + HxOverrides.stringOrNull(self.right.toString())))))) + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.left = None + _hx_o.right = None + _hx_o.key = None + _hx_o.value = None + _hx_o._height = None + + +class haxe_ds_EnumValueMap(haxe_ds_BalancedTree): + _hx_class_name = "haxe.ds.EnumValueMap" + __slots__ = () + _hx_fields = [] + _hx_methods = ["compare", "compareArgs", "compareArg", "copy"] + _hx_statics = [] + _hx_interfaces = [haxe_IMap] + _hx_super = haxe_ds_BalancedTree + + + def __init__(self): + super().__init__() + + def compare(self,k1,k2): + d = (k1.index - k2.index) + if (d != 0): + return d + p1 = list(k1.params) + p2 = list(k2.params) + if ((len(p1) == 0) and ((len(p2) == 0))): + return 0 + return self.compareArgs(p1,p2) + + def compareArgs(self,a1,a2): + ld = (len(a1) - len(a2)) + if (ld != 0): + return ld + _g = 0 + _g1 = len(a1) + while (_g < _g1): + i = _g + _g = (_g + 1) + d = self.compareArg((a1[i] if i >= 0 and i < len(a1) else None),(a2[i] if i >= 0 and i < len(a2) else None)) + if (d != 0): + return d + return 0 + + def compareArg(self,v1,v2): + if (Reflect.isEnumValue(v1) and Reflect.isEnumValue(v2)): + return self.compare(v1,v2) + elif (Std.isOfType(v1,list) and Std.isOfType(v2,list)): + return self.compareArgs(v1,v2) + else: + return Reflect.compare(v1,v2) + + def copy(self): + copied = haxe_ds_EnumValueMap() + copied.root = self.root + return copied + + @staticmethod + def _hx_empty_init(_hx_o): pass + + +class haxe_ds__HashMap_HashMap_Impl_: + _hx_class_name = "haxe.ds._HashMap.HashMap_Impl_" + __slots__ = () + _hx_statics = ["_new", "set", "get", "exists", "remove", "keys", "copy", "iterator", "keyValueIterator", "clear"] + + @staticmethod + def _new(): + this1 = haxe_ds__HashMap_HashMapData() + return this1 + + @staticmethod + def set(this1,k,v): + this1.keys.set(k.hashCode(),k) + this1.values.set(k.hashCode(),v) + + @staticmethod + def get(this1,k): + _this = this1.values + key = k.hashCode() + return _this.h.get(key,None) + + @staticmethod + def exists(this1,k): + _this = this1.values + return (k.hashCode() in _this.h) + + @staticmethod + def remove(this1,k): + this1.values.remove(k.hashCode()) + return this1.keys.remove(k.hashCode()) + + @staticmethod + def keys(this1): + return this1.keys.iterator() + + @staticmethod + def copy(this1): + copied = haxe_ds__HashMap_HashMapData() + copied.keys = this1.keys.copy() + copied.values = this1.values.copy() + return copied + + @staticmethod + def iterator(this1): + return this1.values.iterator() + + @staticmethod + def keyValueIterator(this1): + return haxe_iterators_HashMapKeyValueIterator(this1) + + @staticmethod + def clear(this1): + this1.keys.h.clear() + this1.values.h.clear() + + +class haxe_ds__HashMap_HashMapData: + _hx_class_name = "haxe.ds._HashMap.HashMapData" + __slots__ = ("keys", "values") + _hx_fields = ["keys", "values"] + + def __init__(self): + self.keys = haxe_ds_IntMap() + self.values = haxe_ds_IntMap() + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.keys = None + _hx_o.values = None + + +class haxe_ds_IntMap: + _hx_class_name = "haxe.ds.IntMap" + __slots__ = ("h",) + _hx_fields = ["h"] + _hx_methods = ["set", "get", "exists", "remove", "keys", "iterator", "keyValueIterator", "copy", "toString", "clear"] + _hx_interfaces = [haxe_IMap] + + def __init__(self): + self.h = dict() + + def set(self,key,value): + self.h[key] = value + + def get(self,key): + return self.h.get(key,None) + + def exists(self,key): + return (key in self.h) + + def remove(self,key): + if (not (key in self.h)): + return False + del self.h[key] + return True + + def keys(self): + return python_HaxeIterator(iter(self.h.keys())) + + def iterator(self): + return python_HaxeIterator(iter(self.h.values())) + + def keyValueIterator(self): + return haxe_iterators_MapKeyValueIterator(self) + + def copy(self): + copied = haxe_ds_IntMap() + key = self.keys() + while key.hasNext(): + key1 = key.next() + copied.set(key1,self.h.get(key1,None)) + return copied + + def toString(self): + s_b = python_lib_io_StringIO() + s_b.write("{") + it = self.keys() + i = it + while i.hasNext(): + i1 = i.next() + s_b.write(Std.string(i1)) + s_b.write(" => ") + s_b.write(Std.string(Std.string(self.h.get(i1,None)))) + if it.hasNext(): + s_b.write(", ") + s_b.write("}") + return s_b.getvalue() + + def clear(self): + self.h.clear() + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.h = None + + +class haxe_ds__Map_Map_Impl_: + _hx_class_name = "haxe.ds._Map.Map_Impl_" + __slots__ = () + _hx_statics = ["set", "get", "exists", "remove", "keys", "iterator", "keyValueIterator", "copy", "toString", "clear", "arrayWrite", "toStringMap", "toIntMap", "toEnumValueMapMap", "toObjectMap", "fromStringMap", "fromIntMap", "fromObjectMap"] + + @staticmethod + def set(this1,key,value): + this1.set(key,value) + + @staticmethod + def get(this1,key): + return this1.get(key) + + @staticmethod + def exists(this1,key): + return this1.exists(key) + + @staticmethod + def remove(this1,key): + return this1.remove(key) + + @staticmethod + def keys(this1): + return this1.keys() + + @staticmethod + def iterator(this1): + return this1.iterator() + + @staticmethod + def keyValueIterator(this1): + return this1.keyValueIterator() + + @staticmethod + def copy(this1): + return this1.copy() + + @staticmethod + def toString(this1): + return this1.toString() + + @staticmethod + def clear(this1): + this1.clear() + + @staticmethod + def arrayWrite(this1,k,v): + this1.set(k,v) + return v + + @staticmethod + def toStringMap(t): + return haxe_ds_StringMap() + + @staticmethod + def toIntMap(t): + return haxe_ds_IntMap() + + @staticmethod + def toEnumValueMapMap(t): + return haxe_ds_EnumValueMap() + + @staticmethod + def toObjectMap(t): + return haxe_ds_ObjectMap() + + @staticmethod + def fromStringMap(_hx_map): + return _hx_map + + @staticmethod + def fromIntMap(_hx_map): + return _hx_map + + @staticmethod + def fromObjectMap(_hx_map): + return _hx_map + + +class haxe_ds_ObjectMap: + _hx_class_name = "haxe.ds.ObjectMap" + __slots__ = ("h",) + _hx_fields = ["h"] + _hx_methods = ["set", "get", "exists", "remove", "keys", "iterator", "keyValueIterator", "copy", "toString", "clear"] + _hx_interfaces = [haxe_IMap] + + def __init__(self): + self.h = dict() + + def set(self,key,value): + self.h[key] = value + + def get(self,key): + return self.h.get(key,None) + + def exists(self,key): + return (key in self.h) + + def remove(self,key): + r = (key in self.h) + if r: + del self.h[key] + return r + + def keys(self): + return python_HaxeIterator(iter(self.h.keys())) + + def iterator(self): + return python_HaxeIterator(iter(self.h.values())) + + def keyValueIterator(self): + return haxe_iterators_MapKeyValueIterator(self) + + def copy(self): + copied = haxe_ds_ObjectMap() + key = self.keys() + while key.hasNext(): + key1 = key.next() + copied.set(key1,self.h.get(key1,None)) + return copied + + def toString(self): + s_b = python_lib_io_StringIO() + s_b.write("{") + it = self.keys() + i = it + while i.hasNext(): + i1 = i.next() + s_b.write(Std.string(Std.string(i1))) + s_b.write(" => ") + s_b.write(Std.string(Std.string(self.h.get(i1,None)))) + if it.hasNext(): + s_b.write(", ") + s_b.write("}") + return s_b.getvalue() + + def clear(self): + self.h.clear() + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.h = None + + +class haxe_ds__ReadOnlyArray_ReadOnlyArray_Impl_: + _hx_class_name = "haxe.ds._ReadOnlyArray.ReadOnlyArray_Impl_" + __slots__ = () + _hx_statics = ["get_length", "get", "concat"] + length = None + + @staticmethod + def get_length(this1): + return len(this1) + + @staticmethod + def get(this1,i): + return (this1[i] if i >= 0 and i < len(this1) else None) + + @staticmethod + def concat(this1,a): + return (this1 + a) + + +class haxe_ds_StringMap: + _hx_class_name = "haxe.ds.StringMap" + __slots__ = ("h",) + _hx_fields = ["h"] + _hx_methods = ["set", "get", "exists", "remove", "keys", "iterator", "keyValueIterator", "copy", "toString", "clear"] + _hx_interfaces = [haxe_IMap] + + def __init__(self): + self.h = dict() + + def set(self,key,value): + self.h[key] = value + + def get(self,key): + return self.h.get(key,None) + + def exists(self,key): + return (key in self.h) + + def remove(self,key): + has = (key in self.h) + if has: + del self.h[key] + return has + + def keys(self): + return python_HaxeIterator(iter(self.h.keys())) + + def iterator(self): + return python_HaxeIterator(iter(self.h.values())) + + def keyValueIterator(self): + return haxe_iterators_MapKeyValueIterator(self) + + def copy(self): + copied = haxe_ds_StringMap() + key = self.keys() + while key.hasNext(): + key1 = key.next() + value = self.h.get(key1,None) + copied.h[key1] = value + return copied + + def toString(self): + s_b = python_lib_io_StringIO() + s_b.write("{") + it = self.keys() + i = it + while i.hasNext(): + i1 = i.next() + s_b.write(Std.string(i1)) + s_b.write(" => ") + s_b.write(Std.string(Std.string(self.h.get(i1,None)))) + if it.hasNext(): + s_b.write(", ") + s_b.write("}") + return s_b.getvalue() + + def clear(self): + self.h.clear() + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.h = None + + +class haxe_ds_WeakMap: + _hx_class_name = "haxe.ds.WeakMap" + __slots__ = () + _hx_methods = ["set", "get", "exists", "remove", "keys", "iterator", "keyValueIterator", "copy", "toString", "clear"] + _hx_interfaces = [haxe_IMap] + + def __init__(self): + raise haxe_exceptions_NotImplementedException("Not implemented for this platform",None,_hx_AnonObject({'fileName': "haxe/ds/WeakMap.hx", 'lineNumber': 39, 'className': "haxe.ds.WeakMap", 'methodName': "new"})) + + def set(self,key,value): + pass + + def get(self,key): + return None + + def exists(self,key): + return False + + def remove(self,key): + return False + + def keys(self): + return None + + def iterator(self): + return None + + def keyValueIterator(self): + return None + + def copy(self): + return None + + def toString(self): + return None + + def clear(self): + pass + + @staticmethod + def _hx_empty_init(_hx_o): pass + + +class haxe_exceptions_PosException(haxe_Exception): + _hx_class_name = "haxe.exceptions.PosException" + __slots__ = ("posInfos",) + _hx_fields = ["posInfos"] + _hx_methods = ["toString"] + _hx_statics = [] + _hx_interfaces = [] + _hx_super = haxe_Exception + + + def __init__(self,message,previous = None,pos = None): + self.posInfos = None + super().__init__(message,previous) + if (pos is None): + self.posInfos = _hx_AnonObject({'fileName': "(unknown)", 'lineNumber': 0, 'className': "(unknown)", 'methodName': "(unknown)"}) + else: + self.posInfos = pos + _hx_local_0 = self + _hx_local_1 = _hx_local_0._hx___skipStack + _hx_local_0._hx___skipStack = (_hx_local_1 + 1) + _hx_local_1 + + def toString(self): + return ((((((((("" + HxOverrides.stringOrNull(super().toString())) + " in ") + HxOverrides.stringOrNull(self.posInfos.className)) + ".") + HxOverrides.stringOrNull(self.posInfos.methodName)) + " at ") + HxOverrides.stringOrNull(self.posInfos.fileName)) + ":") + Std.string(self.posInfos.lineNumber)) + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.posInfos = None + + +class haxe_exceptions_NotImplementedException(haxe_exceptions_PosException): + _hx_class_name = "haxe.exceptions.NotImplementedException" + __slots__ = () + _hx_fields = [] + _hx_methods = [] + _hx_statics = [] + _hx_interfaces = [] + _hx_super = haxe_exceptions_PosException + + + def __init__(self,message = None,previous = None,pos = None): + if (message is None): + message = "Not implemented" + super().__init__(message,previous,pos) + _hx_local_0 = self + _hx_local_1 = _hx_local_0._hx___skipStack + _hx_local_0._hx___skipStack = (_hx_local_1 + 1) + _hx_local_1 + + +class haxe_io_Bytes: + _hx_class_name = "haxe.io.Bytes" + __slots__ = ("length", "b") + _hx_fields = ["length", "b"] + _hx_methods = ["get", "set", "blit", "fill", "sub", "compare", "getDouble", "getFloat", "setDouble", "setFloat", "getUInt16", "setUInt16", "getInt32", "getInt64", "setInt32", "setInt64", "getString", "readString", "toString", "toHex", "getData"] + _hx_statics = ["alloc", "ofString", "ofData", "ofHex", "fastGet"] + + def __init__(self,length,b): + self.length = length + self.b = b + + def get(self,pos): + return self.b[pos] + + def set(self,pos,v): + self.b[pos] = (v & 255) + + def blit(self,pos,src,srcpos,_hx_len): + if (((((pos < 0) or ((srcpos < 0))) or ((_hx_len < 0))) or (((pos + _hx_len) > self.length))) or (((srcpos + _hx_len) > src.length))): + raise haxe_Exception.thrown(haxe_io_Error.OutsideBounds) + self.b[pos:pos+_hx_len] = src.b[srcpos:srcpos+_hx_len] + + def fill(self,pos,_hx_len,value): + _g = 0 + _g1 = _hx_len + while (_g < _g1): + i = _g + _g = (_g + 1) + pos1 = pos + pos = (pos + 1) + self.b[pos1] = (value & 255) + + def sub(self,pos,_hx_len): + if (((pos < 0) or ((_hx_len < 0))) or (((pos + _hx_len) > self.length))): + raise haxe_Exception.thrown(haxe_io_Error.OutsideBounds) + return haxe_io_Bytes(_hx_len,self.b[pos:(pos + _hx_len)]) + + def compare(self,other): + b1 = self.b + b2 = other.b + _hx_len = (self.length if ((self.length < other.length)) else other.length) + _g = 0 + _g1 = _hx_len + while (_g < _g1): + i = _g + _g = (_g + 1) + if (b1[i] != b2[i]): + return (b1[i] - b2[i]) + return (self.length - other.length) + + def getDouble(self,pos): + v = (((self.b[pos] | ((self.b[(pos + 1)] << 8))) | ((self.b[(pos + 2)] << 16))) | ((self.b[(pos + 3)] << 24))) + pos1 = (pos + 4) + v1 = (((self.b[pos1] | ((self.b[(pos1 + 1)] << 8))) | ((self.b[(pos1 + 2)] << 16))) | ((self.b[(pos1 + 3)] << 24))) + return haxe_io_FPHelper.i64ToDouble(((v | -2147483648) if ((((v & -2147483648)) != 0)) else v),((v1 | -2147483648) if ((((v1 & -2147483648)) != 0)) else v1)) + + def getFloat(self,pos): + v = (((self.b[pos] | ((self.b[(pos + 1)] << 8))) | ((self.b[(pos + 2)] << 16))) | ((self.b[(pos + 3)] << 24))) + return haxe_io_FPHelper.i32ToFloat(((v | -2147483648) if ((((v & -2147483648)) != 0)) else v)) + + def setDouble(self,pos,v): + i = haxe_io_FPHelper.doubleToI64(v) + v = i.low + self.b[pos] = (v & 255) + self.b[(pos + 1)] = ((v >> 8) & 255) + self.b[(pos + 2)] = ((v >> 16) & 255) + self.b[(pos + 3)] = (HxOverrides.rshift(v, 24) & 255) + pos1 = (pos + 4) + v = i.high + self.b[pos1] = (v & 255) + self.b[(pos1 + 1)] = ((v >> 8) & 255) + self.b[(pos1 + 2)] = ((v >> 16) & 255) + self.b[(pos1 + 3)] = (HxOverrides.rshift(v, 24) & 255) + + def setFloat(self,pos,v): + v1 = haxe_io_FPHelper.floatToI32(v) + self.b[pos] = (v1 & 255) + self.b[(pos + 1)] = ((v1 >> 8) & 255) + self.b[(pos + 2)] = ((v1 >> 16) & 255) + self.b[(pos + 3)] = (HxOverrides.rshift(v1, 24) & 255) + + def getUInt16(self,pos): + return (self.b[pos] | ((self.b[(pos + 1)] << 8))) + + def setUInt16(self,pos,v): + self.b[pos] = (v & 255) + self.b[(pos + 1)] = ((v >> 8) & 255) + + def getInt32(self,pos): + v = (((self.b[pos] | ((self.b[(pos + 1)] << 8))) | ((self.b[(pos + 2)] << 16))) | ((self.b[(pos + 3)] << 24))) + if (((v & -2147483648)) != 0): + return (v | -2147483648) + else: + return v + + def getInt64(self,pos): + pos1 = (pos + 4) + v = (((self.b[pos1] | ((self.b[(pos1 + 1)] << 8))) | ((self.b[(pos1 + 2)] << 16))) | ((self.b[(pos1 + 3)] << 24))) + v1 = (((self.b[pos] | ((self.b[(pos + 1)] << 8))) | ((self.b[(pos + 2)] << 16))) | ((self.b[(pos + 3)] << 24))) + this1 = haxe__Int64____Int64(((v | -2147483648) if ((((v & -2147483648)) != 0)) else v),((v1 | -2147483648) if ((((v1 & -2147483648)) != 0)) else v1)) + return this1 + + def setInt32(self,pos,v): + self.b[pos] = (v & 255) + self.b[(pos + 1)] = ((v >> 8) & 255) + self.b[(pos + 2)] = ((v >> 16) & 255) + self.b[(pos + 3)] = (HxOverrides.rshift(v, 24) & 255) + + def setInt64(self,pos,v): + v1 = v.low + self.b[pos] = (v1 & 255) + self.b[(pos + 1)] = ((v1 >> 8) & 255) + self.b[(pos + 2)] = ((v1 >> 16) & 255) + self.b[(pos + 3)] = (HxOverrides.rshift(v1, 24) & 255) + pos1 = (pos + 4) + v1 = v.high + self.b[pos1] = (v1 & 255) + self.b[(pos1 + 1)] = ((v1 >> 8) & 255) + self.b[(pos1 + 2)] = ((v1 >> 16) & 255) + self.b[(pos1 + 3)] = (HxOverrides.rshift(v1, 24) & 255) + + def getString(self,pos,_hx_len,encoding = None): + tmp = (encoding is None) + if (((pos < 0) or ((_hx_len < 0))) or (((pos + _hx_len) > self.length))): + raise haxe_Exception.thrown(haxe_io_Error.OutsideBounds) + return self.b[pos:pos+_hx_len].decode('UTF-8','replace') + + def readString(self,pos,_hx_len): + return self.getString(pos,_hx_len) + + def toString(self): + return self.getString(0,self.length) + + def toHex(self): + s_b = python_lib_io_StringIO() + chars = [] + _hx_str = "0123456789abcdef" + _g = 0 + _g1 = len(_hx_str) + while (_g < _g1): + i = _g + _g = (_g + 1) + x = HxString.charCodeAt(_hx_str,i) + chars.append(x) + _g = 0 + _g1 = self.length + while (_g < _g1): + i = _g + _g = (_g + 1) + c = self.b[i] + s_b.write("".join(map(chr,[python_internal_ArrayImpl._get(chars, (c >> 4))]))) + s_b.write("".join(map(chr,[python_internal_ArrayImpl._get(chars, (c & 15))]))) + return s_b.getvalue() + + def getData(self): + return self.b + + @staticmethod + def alloc(length): + return haxe_io_Bytes(length,bytearray(length)) + + @staticmethod + def ofString(s,encoding = None): + b = bytearray(s,"UTF-8") + return haxe_io_Bytes(len(b),b) + + @staticmethod + def ofData(b): + return haxe_io_Bytes(len(b),b) + + @staticmethod + def ofHex(s): + _hx_len = len(s) + if (((_hx_len & 1)) != 0): + raise haxe_Exception.thrown("Not a hex string (odd number of digits)") + ret = haxe_io_Bytes.alloc((_hx_len >> 1)) + _g = 0 + _g1 = ret.length + while (_g < _g1): + i = _g + _g = (_g + 1) + index = (i * 2) + high = (-1 if ((index >= len(s))) else ord(s[index])) + index1 = ((i * 2) + 1) + low = (-1 if ((index1 >= len(s))) else ord(s[index1])) + high = (((high & 15)) + ((((((high & 64)) >> 6)) * 9))) + low = (((low & 15)) + ((((((low & 64)) >> 6)) * 9))) + ret.b[i] = (((((high << 4) | low)) & 255) & 255) + return ret + + @staticmethod + def fastGet(b,pos): + return b[pos] + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.length = None + _hx_o.b = None + + +class haxe_io_BytesBuffer: + _hx_class_name = "haxe.io.BytesBuffer" + __slots__ = ("b",) + _hx_fields = ["b"] + _hx_methods = ["get_length", "addByte", "add", "addString", "addInt32", "addInt64", "addFloat", "addDouble", "addBytes", "getBytes"] + + def __init__(self): + self.b = bytearray() + + def get_length(self): + return len(self.b) + + def addByte(self,byte): + self.b.append(byte) + + def add(self,src): + self.b.extend(src.b) + + def addString(self,v,encoding = None): + self.b.extend(bytearray(v,"UTF-8")) + + def addInt32(self,v): + self.b.append((v & 255)) + self.b.append(((v >> 8) & 255)) + self.b.append(((v >> 16) & 255)) + self.b.append(HxOverrides.rshift(v, 24)) + + def addInt64(self,v): + self.addInt32(v.low) + self.addInt32(v.high) + + def addFloat(self,v): + self.addInt32(haxe_io_FPHelper.floatToI32(v)) + + def addDouble(self,v): + self.addInt64(haxe_io_FPHelper.doubleToI64(v)) + + def addBytes(self,src,pos,_hx_len): + if (((pos < 0) or ((_hx_len < 0))) or (((pos + _hx_len) > src.length))): + raise haxe_Exception.thrown(haxe_io_Error.OutsideBounds) + self.b.extend(src.b[pos:(pos + _hx_len)]) + + def getBytes(self): + _hx_bytes = haxe_io_Bytes(len(self.b),self.b) + self.b = None + return _hx_bytes + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.b = None + +class haxe_io_Encoding(Enum): + __slots__ = () + _hx_class_name = "haxe.io.Encoding" + _hx_constructs = ["UTF8", "RawNative"] +haxe_io_Encoding.UTF8 = haxe_io_Encoding("UTF8", 0, ()) +haxe_io_Encoding.RawNative = haxe_io_Encoding("RawNative", 1, ()) + + +class haxe_io_Eof: + _hx_class_name = "haxe.io.Eof" + __slots__ = () + _hx_methods = ["toString"] + + def __init__(self): + pass + + def toString(self): + return "Eof" + + @staticmethod + def _hx_empty_init(_hx_o): pass + +class haxe_io_Error(Enum): + __slots__ = () + _hx_class_name = "haxe.io.Error" + _hx_constructs = ["Blocked", "Overflow", "OutsideBounds", "Custom"] + + @staticmethod + def Custom(e): + return haxe_io_Error("Custom", 3, (e,)) +haxe_io_Error.Blocked = haxe_io_Error("Blocked", 0, ()) +haxe_io_Error.Overflow = haxe_io_Error("Overflow", 1, ()) +haxe_io_Error.OutsideBounds = haxe_io_Error("OutsideBounds", 2, ()) + + +class haxe_io_FPHelper: + _hx_class_name = "haxe.io.FPHelper" + __slots__ = () + _hx_statics = ["i64tmp", "LN2", "_i32ToFloat", "_i64ToDouble", "_floatToI32", "_doubleToI64", "i32ToFloat", "floatToI32", "i64ToDouble", "doubleToI64"] + + @staticmethod + def _i32ToFloat(i): + sign = (1 - ((HxOverrides.rshift(i, 31) << 1))) + e = ((i >> 23) & 255) + if (e == 255): + if (((i & 8388607)) == 0): + if (sign > 0): + return Math.POSITIVE_INFINITY + else: + return Math.NEGATIVE_INFINITY + else: + return Math.NaN + m = ((((i & 8388607)) << 1) if ((e == 0)) else ((i & 8388607) | 8388608)) + return ((sign * m) * Math.pow(2,(e - 150))) + + @staticmethod + def _i64ToDouble(lo,hi): + sign = (1 - ((HxOverrides.rshift(hi, 31) << 1))) + e = ((hi >> 20) & 2047) + if (e == 2047): + if ((lo == 0) and ((((hi & 1048575)) == 0))): + if (sign > 0): + return Math.POSITIVE_INFINITY + else: + return Math.NEGATIVE_INFINITY + else: + return Math.NaN + m = (2.220446049250313e-16 * ((((((hi & 1048575)) * 4294967296.) + (((HxOverrides.rshift(lo, 31)) * 2147483648.))) + ((lo & 2147483647))))) + if (e == 0): + m = (m * 2.0) + else: + m = (m + 1.0) + return ((sign * m) * Math.pow(2,(e - 1023))) + + @staticmethod + def _floatToI32(f): + if (f == 0): + return 0 + af = (-f if ((f < 0)) else f) + exp = Math.floor((((Math.NEGATIVE_INFINITY if ((af == 0.0)) else (Math.NaN if ((af < 0.0)) else python_lib_Math.log(af)))) / 0.6931471805599453)) + if (exp > 127): + return 2139095040 + else: + if (exp <= -127): + exp = -127 + af = (af * 7.1362384635298e+44) + else: + af = ((((af / Math.pow(2,exp)) - 1.0)) * 8388608) + return ((((-2147483648 if ((f < 0)) else 0)) | (((exp + 127) << 23))) | Math.floor((af + 0.5))) + + @staticmethod + def _doubleToI64(v): + i64 = haxe_io_FPHelper.i64tmp + if (v == 0): + i64.low = 0 + i64.high = 0 + elif (not ((((v != Math.POSITIVE_INFINITY) and ((v != Math.NEGATIVE_INFINITY))) and (not python_lib_Math.isnan(v))))): + i64.low = 0 + i64.high = (2146435072 if ((v > 0)) else -1048576) + else: + av = (-v if ((v < 0)) else v) + exp = Math.floor((((Math.NEGATIVE_INFINITY if ((av == 0.0)) else (Math.NaN if ((av < 0.0)) else python_lib_Math.log(av)))) / 0.6931471805599453)) + if (exp > 1023): + i64.low = -1 + i64.high = 2146435071 + else: + if (exp <= -1023): + exp = -1023 + av = (av / 2.2250738585072014e-308) + else: + av = ((av / Math.pow(2,exp)) - 1.0) + v1 = (av * 4503599627370496.) + sig = (v1 if (((v1 == Math.POSITIVE_INFINITY) or ((v1 == Math.NEGATIVE_INFINITY)))) else (Math.NaN if (python_lib_Math.isnan(v1)) else Math.floor((v1 + 0.5)))) + sig_l = None + try: + sig_l = int(sig) + except BaseException as _g: + None + sig_l = None + sig_l1 = sig_l + sig_h = None + try: + sig_h = int((sig / 4294967296.0)) + except BaseException as _g: + None + sig_h = None + sig_h1 = sig_h + i64.low = sig_l1 + i64.high = ((((-2147483648 if ((v < 0)) else 0)) | (((exp + 1023) << 20))) | sig_h1) + return i64 + + @staticmethod + def i32ToFloat(i): + sign = (1 - ((HxOverrides.rshift(i, 31) << 1))) + e = ((i >> 23) & 255) + if (e == 255): + if (((i & 8388607)) == 0): + if (sign > 0): + return Math.POSITIVE_INFINITY + else: + return Math.NEGATIVE_INFINITY + else: + return Math.NaN + else: + m = ((((i & 8388607)) << 1) if ((e == 0)) else ((i & 8388607) | 8388608)) + return ((sign * m) * Math.pow(2,(e - 150))) + + @staticmethod + def floatToI32(f): + if (f == 0): + return 0 + else: + af = (-f if ((f < 0)) else f) + exp = Math.floor((((Math.NEGATIVE_INFINITY if ((af == 0.0)) else (Math.NaN if ((af < 0.0)) else python_lib_Math.log(af)))) / 0.6931471805599453)) + if (exp > 127): + return 2139095040 + else: + if (exp <= -127): + exp = -127 + af = (af * 7.1362384635298e+44) + else: + af = ((((af / Math.pow(2,exp)) - 1.0)) * 8388608) + return ((((-2147483648 if ((f < 0)) else 0)) | (((exp + 127) << 23))) | Math.floor((af + 0.5))) + + @staticmethod + def i64ToDouble(low,high): + sign = (1 - ((HxOverrides.rshift(high, 31) << 1))) + e = ((high >> 20) & 2047) + if (e == 2047): + if ((low == 0) and ((((high & 1048575)) == 0))): + if (sign > 0): + return Math.POSITIVE_INFINITY + else: + return Math.NEGATIVE_INFINITY + else: + return Math.NaN + else: + m = (2.220446049250313e-16 * ((((((high & 1048575)) * 4294967296.) + (((HxOverrides.rshift(low, 31)) * 2147483648.))) + ((low & 2147483647))))) + if (e == 0): + m = (m * 2.0) + else: + m = (m + 1.0) + return ((sign * m) * Math.pow(2,(e - 1023))) + + @staticmethod + def doubleToI64(v): + i64 = haxe_io_FPHelper.i64tmp + if (v == 0): + i64.low = 0 + i64.high = 0 + elif (not ((((v != Math.POSITIVE_INFINITY) and ((v != Math.NEGATIVE_INFINITY))) and (not python_lib_Math.isnan(v))))): + i64.low = 0 + i64.high = (2146435072 if ((v > 0)) else -1048576) + else: + av = (-v if ((v < 0)) else v) + exp = Math.floor((((Math.NEGATIVE_INFINITY if ((av == 0.0)) else (Math.NaN if ((av < 0.0)) else python_lib_Math.log(av)))) / 0.6931471805599453)) + if (exp > 1023): + i64.low = -1 + i64.high = 2146435071 + else: + if (exp <= -1023): + exp = -1023 + av = (av / 2.2250738585072014e-308) + else: + av = ((av / Math.pow(2,exp)) - 1.0) + v1 = (av * 4503599627370496.) + sig = (v1 if (((v1 == Math.POSITIVE_INFINITY) or ((v1 == Math.NEGATIVE_INFINITY)))) else (Math.NaN if (python_lib_Math.isnan(v1)) else Math.floor((v1 + 0.5)))) + sig_l = None + try: + sig_l = int(sig) + except BaseException as _g: + None + sig_l = None + sig_l1 = sig_l + sig_h = None + try: + sig_h = int((sig / 4294967296.0)) + except BaseException as _g: + None + sig_h = None + sig_h1 = sig_h + i64.low = sig_l1 + i64.high = ((((-2147483648 if ((v < 0)) else 0)) | (((exp + 1023) << 20))) | sig_h1) + return i64 + + +class haxe_io_Input: + _hx_class_name = "haxe.io.Input" + __slots__ = ("bigEndian",) + _hx_fields = ["bigEndian"] + _hx_methods = ["readByte", "readBytes", "close", "set_bigEndian", "readAll", "readFullBytes", "read", "readUntil", "readLine", "readFloat", "readDouble", "readInt8", "readInt16", "readUInt16", "readInt24", "readUInt24", "readInt32", "readString", "getDoubleSig"] + + def readByte(self): + raise haxe_exceptions_NotImplementedException(None,None,_hx_AnonObject({'fileName': "haxe/io/Input.hx", 'lineNumber': 53, 'className': "haxe.io.Input", 'methodName': "readByte"})) + + def readBytes(self,s,pos,_hx_len): + k = _hx_len + b = s.b + if (((pos < 0) or ((_hx_len < 0))) or (((pos + _hx_len) > s.length))): + raise haxe_Exception.thrown(haxe_io_Error.OutsideBounds) + try: + while (k > 0): + b[pos] = self.readByte() + pos = (pos + 1) + k = (k - 1) + except BaseException as _g: + None + if (not Std.isOfType(haxe_Exception.caught(_g).unwrap(),haxe_io_Eof)): + raise _g + return (_hx_len - k) + + def close(self): + pass + + def set_bigEndian(self,b): + self.bigEndian = b + return b + + def readAll(self,bufsize = None): + if (bufsize is None): + bufsize = 16384 + buf = haxe_io_Bytes.alloc(bufsize) + total = haxe_io_BytesBuffer() + try: + while True: + _hx_len = self.readBytes(buf,0,bufsize) + if (_hx_len == 0): + raise haxe_Exception.thrown(haxe_io_Error.Blocked) + if ((_hx_len < 0) or ((_hx_len > buf.length))): + raise haxe_Exception.thrown(haxe_io_Error.OutsideBounds) + total.b.extend(buf.b[0:_hx_len]) + except BaseException as _g: + None + if (not Std.isOfType(haxe_Exception.caught(_g).unwrap(),haxe_io_Eof)): + raise _g + return total.getBytes() + + def readFullBytes(self,s,pos,_hx_len): + while (_hx_len > 0): + k = self.readBytes(s,pos,_hx_len) + if (k == 0): + raise haxe_Exception.thrown(haxe_io_Error.Blocked) + pos = (pos + k) + _hx_len = (_hx_len - k) + + def read(self,nbytes): + s = haxe_io_Bytes.alloc(nbytes) + p = 0 + while (nbytes > 0): + k = self.readBytes(s,p,nbytes) + if (k == 0): + raise haxe_Exception.thrown(haxe_io_Error.Blocked) + p = (p + k) + nbytes = (nbytes - k) + return s + + def readUntil(self,end): + buf = haxe_io_BytesBuffer() + last = None + while True: + last = self.readByte() + if (not ((last != end))): + break + buf.b.append(last) + return buf.getBytes().toString() + + def readLine(self): + buf = haxe_io_BytesBuffer() + last = None + s = None + try: + while True: + last = self.readByte() + if (not ((last != 10))): + break + buf.b.append(last) + s = buf.getBytes().toString() + if (HxString.charCodeAt(s,(len(s) - 1)) == 13): + s = HxString.substr(s,0,-1) + except BaseException as _g: + None + _g1 = haxe_Exception.caught(_g).unwrap() + if Std.isOfType(_g1,haxe_io_Eof): + e = _g1 + s = buf.getBytes().toString() + if (len(s) == 0): + raise haxe_Exception.thrown(e) + else: + raise _g + return s + + def readFloat(self): + return haxe_io_FPHelper.i32ToFloat(self.readInt32()) + + def readDouble(self): + i1 = self.readInt32() + i2 = self.readInt32() + if self.bigEndian: + return haxe_io_FPHelper.i64ToDouble(i2,i1) + else: + return haxe_io_FPHelper.i64ToDouble(i1,i2) + + def readInt8(self): + n = self.readByte() + if (n >= 128): + return (n - 256) + return n + + def readInt16(self): + ch1 = self.readByte() + ch2 = self.readByte() + n = ((ch2 | ((ch1 << 8))) if (self.bigEndian) else (ch1 | ((ch2 << 8)))) + if (((n & 32768)) != 0): + return (n - 65536) + return n + + def readUInt16(self): + ch1 = self.readByte() + ch2 = self.readByte() + if self.bigEndian: + return (ch2 | ((ch1 << 8))) + else: + return (ch1 | ((ch2 << 8))) + + def readInt24(self): + ch1 = self.readByte() + ch2 = self.readByte() + ch3 = self.readByte() + n = (((ch3 | ((ch2 << 8))) | ((ch1 << 16))) if (self.bigEndian) else ((ch1 | ((ch2 << 8))) | ((ch3 << 16)))) + if (((n & 8388608)) != 0): + return (n - 16777216) + return n + + def readUInt24(self): + ch1 = self.readByte() + ch2 = self.readByte() + ch3 = self.readByte() + if self.bigEndian: + return ((ch3 | ((ch2 << 8))) | ((ch1 << 16))) + else: + return ((ch1 | ((ch2 << 8))) | ((ch3 << 16))) + + def readInt32(self): + ch1 = self.readByte() + ch2 = self.readByte() + ch3 = self.readByte() + ch4 = self.readByte() + n = ((((ch4 | ((ch3 << 8))) | ((ch2 << 16))) | ((ch1 << 24))) if (self.bigEndian) else (((ch1 | ((ch2 << 8))) | ((ch3 << 16))) | ((ch4 << 24)))) + if (((n & -2147483648)) != 0): + return (n | -2147483648) + else: + return n + + def readString(self,_hx_len,encoding = None): + b = haxe_io_Bytes.alloc(_hx_len) + self.readFullBytes(b,0,_hx_len) + return b.getString(0,_hx_len,encoding) + + def getDoubleSig(self,_hx_bytes): + return ((((((((((_hx_bytes[1] if 1 < len(_hx_bytes) else None) & 15)) << 16) | (((_hx_bytes[2] if 2 < len(_hx_bytes) else None) << 8))) | (_hx_bytes[3] if 3 < len(_hx_bytes) else None))) * 4294967296.) + (((((_hx_bytes[4] if 4 < len(_hx_bytes) else None) >> 7)) * 2147483648))) + ((((((((_hx_bytes[4] if 4 < len(_hx_bytes) else None) & 127)) << 24) | (((_hx_bytes[5] if 5 < len(_hx_bytes) else None) << 16))) | (((_hx_bytes[6] if 6 < len(_hx_bytes) else None) << 8))) | (_hx_bytes[7] if 7 < len(_hx_bytes) else None)))) + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.bigEndian = None + + +class haxe_io_Output: + _hx_class_name = "haxe.io.Output" + __slots__ = ("bigEndian",) + _hx_fields = ["bigEndian"] + _hx_methods = ["writeByte", "writeBytes", "flush", "close", "set_bigEndian", "write", "writeFullBytes", "writeFloat", "writeDouble", "writeInt8", "writeInt16", "writeUInt16", "writeInt24", "writeUInt24", "writeInt32", "prepare", "writeInput", "writeString"] + + def writeByte(self,c): + raise haxe_exceptions_NotImplementedException(None,None,_hx_AnonObject({'fileName': "haxe/io/Output.hx", 'lineNumber': 47, 'className': "haxe.io.Output", 'methodName': "writeByte"})) + + def writeBytes(self,s,pos,_hx_len): + if (((pos < 0) or ((_hx_len < 0))) or (((pos + _hx_len) > s.length))): + raise haxe_Exception.thrown(haxe_io_Error.OutsideBounds) + b = s.b + k = _hx_len + while (k > 0): + self.writeByte(b[pos]) + pos = (pos + 1) + k = (k - 1) + return _hx_len + + def flush(self): + pass + + def close(self): + pass + + def set_bigEndian(self,b): + self.bigEndian = b + return b + + def write(self,s): + l = s.length + p = 0 + while (l > 0): + k = self.writeBytes(s,p,l) + if (k == 0): + raise haxe_Exception.thrown(haxe_io_Error.Blocked) + p = (p + k) + l = (l - k) + + def writeFullBytes(self,s,pos,_hx_len): + while (_hx_len > 0): + k = self.writeBytes(s,pos,_hx_len) + pos = (pos + k) + _hx_len = (_hx_len - k) + + def writeFloat(self,x): + self.writeInt32(haxe_io_FPHelper.floatToI32(x)) + + def writeDouble(self,x): + i64 = haxe_io_FPHelper.doubleToI64(x) + if self.bigEndian: + self.writeInt32(i64.high) + self.writeInt32(i64.low) + else: + self.writeInt32(i64.low) + self.writeInt32(i64.high) + + def writeInt8(self,x): + if ((x < -128) or ((x >= 128))): + raise haxe_Exception.thrown(haxe_io_Error.Overflow) + self.writeByte((x & 255)) + + def writeInt16(self,x): + if ((x < -32768) or ((x >= 32768))): + raise haxe_Exception.thrown(haxe_io_Error.Overflow) + self.writeUInt16((x & 65535)) + + def writeUInt16(self,x): + if ((x < 0) or ((x >= 65536))): + raise haxe_Exception.thrown(haxe_io_Error.Overflow) + if self.bigEndian: + self.writeByte((x >> 8)) + self.writeByte((x & 255)) + else: + self.writeByte((x & 255)) + self.writeByte((x >> 8)) + + def writeInt24(self,x): + if ((x < -8388608) or ((x >= 8388608))): + raise haxe_Exception.thrown(haxe_io_Error.Overflow) + self.writeUInt24((x & 16777215)) + + def writeUInt24(self,x): + if ((x < 0) or ((x >= 16777216))): + raise haxe_Exception.thrown(haxe_io_Error.Overflow) + if self.bigEndian: + self.writeByte((x >> 16)) + self.writeByte(((x >> 8) & 255)) + self.writeByte((x & 255)) + else: + self.writeByte((x & 255)) + self.writeByte(((x >> 8) & 255)) + self.writeByte((x >> 16)) + + def writeInt32(self,x): + if self.bigEndian: + self.writeByte(HxOverrides.rshift(x, 24)) + self.writeByte(((x >> 16) & 255)) + self.writeByte(((x >> 8) & 255)) + self.writeByte((x & 255)) + else: + self.writeByte((x & 255)) + self.writeByte(((x >> 8) & 255)) + self.writeByte(((x >> 16) & 255)) + self.writeByte(HxOverrides.rshift(x, 24)) + + def prepare(self,nbytes): + pass + + def writeInput(self,i,bufsize = None): + if (bufsize is None): + bufsize = 4096 + buf = haxe_io_Bytes.alloc(bufsize) + try: + while True: + _hx_len = i.readBytes(buf,0,bufsize) + if (_hx_len == 0): + raise haxe_Exception.thrown(haxe_io_Error.Blocked) + p = 0 + while (_hx_len > 0): + k = self.writeBytes(buf,p,_hx_len) + if (k == 0): + raise haxe_Exception.thrown(haxe_io_Error.Blocked) + p = (p + k) + _hx_len = (_hx_len - k) + except BaseException as _g: + None + if (not Std.isOfType(haxe_Exception.caught(_g).unwrap(),haxe_io_Eof)): + raise _g + + def writeString(self,s,encoding = None): + b = haxe_io_Bytes.ofString(s,encoding) + self.writeFullBytes(b,0,b.length) + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.bigEndian = None + + +class haxe_io_Path: + _hx_class_name = "haxe.io.Path" + __slots__ = ("dir", "file", "ext", "backslash") + _hx_fields = ["dir", "file", "ext", "backslash"] + _hx_methods = ["toString"] + _hx_statics = ["withoutExtension", "withoutDirectory", "directory", "extension", "withExtension", "join", "normalize", "addTrailingSlash", "removeTrailingSlashes", "isAbsolute", "unescape", "escape"] + + def __init__(self,path): + self.backslash = None + self.ext = None + self.file = None + self.dir = None + path1 = path + _hx_local_0 = len(path1) + if (_hx_local_0 == 1): + if (path1 == "."): + self.dir = path + self.file = "" + return + elif (_hx_local_0 == 2): + if (path1 == ".."): + self.dir = path + self.file = "" + return + else: + pass + startIndex = None + c1 = None + if (startIndex is None): + c1 = path.rfind("/", 0, len(path)) + else: + i = path.rfind("/", 0, (startIndex + 1)) + startLeft = (max(0,((startIndex + 1) - len("/"))) if ((i == -1)) else (i + 1)) + check = path.find("/", startLeft, len(path)) + c1 = (check if (((check > i) and ((check <= startIndex)))) else i) + startIndex = None + c2 = None + if (startIndex is None): + c2 = path.rfind("\\", 0, len(path)) + else: + i = path.rfind("\\", 0, (startIndex + 1)) + startLeft = (max(0,((startIndex + 1) - len("\\"))) if ((i == -1)) else (i + 1)) + check = path.find("\\", startLeft, len(path)) + c2 = (check if (((check > i) and ((check <= startIndex)))) else i) + if (c1 < c2): + self.dir = HxString.substr(path,0,c2) + path = HxString.substr(path,(c2 + 1),None) + self.backslash = True + elif (c2 < c1): + self.dir = HxString.substr(path,0,c1) + path = HxString.substr(path,(c1 + 1),None) + else: + self.dir = None + startIndex = None + cp = None + if (startIndex is None): + cp = path.rfind(".", 0, len(path)) + else: + i = path.rfind(".", 0, (startIndex + 1)) + startLeft = (max(0,((startIndex + 1) - len("."))) if ((i == -1)) else (i + 1)) + check = path.find(".", startLeft, len(path)) + cp = (check if (((check > i) and ((check <= startIndex)))) else i) + if (cp != -1): + self.ext = HxString.substr(path,(cp + 1),None) + self.file = HxString.substr(path,0,cp) + else: + self.ext = None + self.file = path + + def toString(self): + return ((HxOverrides.stringOrNull((("" if ((self.dir is None)) else (HxOverrides.stringOrNull(self.dir) + HxOverrides.stringOrNull((("\\" if (self.backslash) else "/"))))))) + HxOverrides.stringOrNull(self.file)) + HxOverrides.stringOrNull((("" if ((self.ext is None)) else ("." + HxOverrides.stringOrNull(self.ext)))))) + + @staticmethod + def withoutExtension(path): + s = haxe_io_Path(path) + s.ext = None + return s.toString() + + @staticmethod + def withoutDirectory(path): + s = haxe_io_Path(path) + s.dir = None + return s.toString() + + @staticmethod + def directory(path): + s = haxe_io_Path(path) + if (s.dir is None): + return "" + return s.dir + + @staticmethod + def extension(path): + s = haxe_io_Path(path) + if (s.ext is None): + return "" + return s.ext + + @staticmethod + def withExtension(path,ext): + s = haxe_io_Path(path) + s.ext = ext + return s.toString() + + @staticmethod + def join(paths): + def _hx_local_0(s): + if (s is not None): + return (s != "") + else: + return False + paths1 = list(filter(_hx_local_0,paths)) + if (len(paths1) == 0): + return "" + path = (paths1[0] if 0 < len(paths1) else None) + _g = 1 + _g1 = len(paths1) + while (_g < _g1): + i = _g + _g = (_g + 1) + path = haxe_io_Path.addTrailingSlash(path) + path = (("null" if path is None else path) + HxOverrides.stringOrNull((paths1[i] if i >= 0 and i < len(paths1) else None))) + return haxe_io_Path.normalize(path) + + @staticmethod + def normalize(path): + slash = "/" + _this = path.split("\\") + path = slash.join([python_Boot.toString1(x1,'') for x1 in _this]) + if (path == slash): + return slash + target = [] + _g = 0 + _g1 = (list(path) if ((slash == "")) else path.split(slash)) + while (_g < len(_g1)): + token = (_g1[_g] if _g >= 0 and _g < len(_g1) else None) + _g = (_g + 1) + if (((token == "..") and ((len(target) > 0))) and ((python_internal_ArrayImpl._get(target, (len(target) - 1)) != ".."))): + if (len(target) != 0): + target.pop() + elif (token == ""): + if ((len(target) > 0) or ((HxString.charCodeAt(path,0) == 47))): + target.append(token) + elif (token != "."): + target.append(token) + tmp = slash.join([python_Boot.toString1(x1,'') for x1 in target]) + acc_b = python_lib_io_StringIO() + colon = False + slashes = False + _g = 0 + _g1 = len(tmp) + while (_g < _g1): + i = _g + _g = (_g + 1) + _g2 = (-1 if ((i >= len(tmp))) else ord(tmp[i])) + _g3 = _g2 + if (_g3 == 47): + if (not colon): + slashes = True + else: + i1 = _g2 + colon = False + if slashes: + acc_b.write("/") + slashes = False + acc_b.write("".join(map(chr,[i1]))) + elif (_g3 == 58): + acc_b.write(":") + colon = True + else: + i2 = _g2 + colon = False + if slashes: + acc_b.write("/") + slashes = False + acc_b.write("".join(map(chr,[i2]))) + return acc_b.getvalue() + + @staticmethod + def addTrailingSlash(path): + if (len(path) == 0): + return "/" + startIndex = None + c1 = None + if (startIndex is None): + c1 = path.rfind("/", 0, len(path)) + else: + i = path.rfind("/", 0, (startIndex + 1)) + startLeft = (max(0,((startIndex + 1) - len("/"))) if ((i == -1)) else (i + 1)) + check = path.find("/", startLeft, len(path)) + c1 = (check if (((check > i) and ((check <= startIndex)))) else i) + startIndex = None + c2 = None + if (startIndex is None): + c2 = path.rfind("\\", 0, len(path)) + else: + i = path.rfind("\\", 0, (startIndex + 1)) + startLeft = (max(0,((startIndex + 1) - len("\\"))) if ((i == -1)) else (i + 1)) + check = path.find("\\", startLeft, len(path)) + c2 = (check if (((check > i) and ((check <= startIndex)))) else i) + if (c1 < c2): + if (c2 != ((len(path) - 1))): + return (("null" if path is None else path) + "\\") + else: + return path + elif (c1 != ((len(path) - 1))): + return (("null" if path is None else path) + "/") + else: + return path + + @staticmethod + def removeTrailingSlashes(path): + while True: + _g = HxString.charCodeAt(path,(len(path) - 1)) + if (_g is None): + break + else: + _g1 = _g + if ((_g1 == 92) or ((_g1 == 47))): + path = HxString.substr(path,0,-1) + else: + break + return path + + @staticmethod + def isAbsolute(path): + if path.startswith("/"): + return True + if ((("" if ((1 >= len(path))) else path[1])) == ":"): + return True + if path.startswith("\\\\"): + return True + return False + + @staticmethod + def unescape(path): + regex = EReg("-x([0-9][0-9])","g") + def _hx_local_1(): + def _hx_local_0(regex): + code = Std.parseInt(regex.matchObj.group(1)) + return "".join(map(chr,[code])) + return regex.map(path,_hx_local_0) + return _hx_local_1() + + @staticmethod + def escape(path,allowSlashes = None): + if (allowSlashes is None): + allowSlashes = False + regex = (EReg("[^A-Za-z0-9_/\\\\\\.]","g") if allowSlashes else EReg("[^A-Za-z0-9_\\.]","g")) + def _hx_local_1(): + def _hx_local_0(v): + return ("-x" + Std.string(HxString.charCodeAt(v.matchObj.group(0),0))) + return regex.map(path,_hx_local_0) + return _hx_local_1() + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.dir = None + _hx_o.file = None + _hx_o.ext = None + _hx_o.backslash = None + + +class haxe_iterators_ArrayIterator: + _hx_class_name = "haxe.iterators.ArrayIterator" + __slots__ = ("array", "current") + _hx_fields = ["array", "current"] + _hx_methods = ["hasNext", "next"] + + def __init__(self,array): + self.current = 0 + self.array = array + + def hasNext(self): + return (self.current < len(self.array)) + + def next(self): + def _hx_local_3(): + def _hx_local_2(): + _hx_local_0 = self + _hx_local_1 = _hx_local_0.current + _hx_local_0.current = (_hx_local_1 + 1) + return _hx_local_1 + return python_internal_ArrayImpl._get(self.array, _hx_local_2()) + return _hx_local_3() + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.array = None + _hx_o.current = None + + +class haxe_iterators_ArrayKeyValueIterator: + _hx_class_name = "haxe.iterators.ArrayKeyValueIterator" + __slots__ = ("current", "array") + _hx_fields = ["current", "array"] + _hx_methods = ["hasNext", "next"] + + def __init__(self,array): + self.current = 0 + self.array = array + + def hasNext(self): + return (self.current < len(self.array)) + + def next(self): + def _hx_local_3(): + def _hx_local_2(): + _hx_local_0 = self + _hx_local_1 = _hx_local_0.current + _hx_local_0.current = (_hx_local_1 + 1) + return _hx_local_1 + return _hx_AnonObject({'value': python_internal_ArrayImpl._get(self.array, self.current), 'key': _hx_local_2()}) + return _hx_local_3() + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.current = None + _hx_o.array = None + + +class haxe_iterators_DynamicAccessIterator: + _hx_class_name = "haxe.iterators.DynamicAccessIterator" + __slots__ = ("access", "keys", "index") + _hx_fields = ["access", "keys", "index"] + _hx_methods = ["hasNext", "next"] + + def __init__(self,access): + self.access = access + self.keys = python_Boot.fields(access) + self.index = 0 + + def hasNext(self): + return (self.index < len(self.keys)) + + def next(self): + def _hx_local_2(): + _hx_local_0 = self + _hx_local_1 = _hx_local_0.index + _hx_local_0.index = (_hx_local_1 + 1) + return _hx_local_1 + key = python_internal_ArrayImpl._get(self.keys, _hx_local_2()) + return Reflect.field(self.access,key) + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.access = None + _hx_o.keys = None + _hx_o.index = None + + +class haxe_iterators_DynamicAccessKeyValueIterator: + _hx_class_name = "haxe.iterators.DynamicAccessKeyValueIterator" + __slots__ = ("access", "keys", "index") + _hx_fields = ["access", "keys", "index"] + _hx_methods = ["hasNext", "next"] + + def __init__(self,access): + self.access = access + self.keys = python_Boot.fields(access) + self.index = 0 + + def hasNext(self): + return (self.index < len(self.keys)) + + def next(self): + def _hx_local_2(): + _hx_local_0 = self + _hx_local_1 = _hx_local_0.index + _hx_local_0.index = (_hx_local_1 + 1) + return _hx_local_1 + key = python_internal_ArrayImpl._get(self.keys, _hx_local_2()) + return _hx_AnonObject({'value': Reflect.field(self.access,key), 'key': key}) + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.access = None + _hx_o.keys = None + _hx_o.index = None + + +class haxe_iterators_HashMapKeyValueIterator: + _hx_class_name = "haxe.iterators.HashMapKeyValueIterator" + __slots__ = ("map", "keys") + _hx_fields = ["map", "keys"] + _hx_methods = ["hasNext", "next"] + + def __init__(self,_hx_map): + self.map = _hx_map + self.keys = _hx_map.keys.iterator() + + def hasNext(self): + return self.keys.hasNext() + + def next(self): + key = self.keys.next() + _this = self.map.values + key1 = key.hashCode() + return _hx_AnonObject({'value': _this.h.get(key1,None), 'key': key}) + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.map = None + _hx_o.keys = None + + +class haxe_iterators_MapKeyValueIterator: + _hx_class_name = "haxe.iterators.MapKeyValueIterator" + __slots__ = ("map", "keys") + _hx_fields = ["map", "keys"] + _hx_methods = ["hasNext", "next"] + + def __init__(self,_hx_map): + self.map = _hx_map + self.keys = _hx_map.keys() + + def hasNext(self): + return self.keys.hasNext() + + def next(self): + key = self.keys.next() + return _hx_AnonObject({'value': self.map.get(key), 'key': key}) + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.map = None + _hx_o.keys = None + + +class haxe_iterators_RestIterator: + _hx_class_name = "haxe.iterators.RestIterator" + __slots__ = ("args", "current") + _hx_fields = ["args", "current"] + _hx_methods = ["hasNext", "next"] + + def __init__(self,args): + self.current = 0 + self.args = args + + def hasNext(self): + return (self.current < len(self.args)) + + def next(self): + index = self.current + self.current = (self.current + 1) + return python_internal_ArrayImpl._get(self.args, index) + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.args = None + _hx_o.current = None + + +class haxe_iterators_RestKeyValueIterator: + _hx_class_name = "haxe.iterators.RestKeyValueIterator" + __slots__ = ("args", "current") + _hx_fields = ["args", "current"] + _hx_methods = ["hasNext", "next"] + + def __init__(self,args): + self.current = 0 + self.args = args + + def hasNext(self): + return (self.current < len(self.args)) + + def next(self): + tmp = self.current + index = self.current + self.current = (self.current + 1) + return _hx_AnonObject({'key': tmp, 'value': python_internal_ArrayImpl._get(self.args, index)}) + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.args = None + _hx_o.current = None + + +class haxe_iterators_StringIterator: + _hx_class_name = "haxe.iterators.StringIterator" + __slots__ = ("offset", "s") + _hx_fields = ["offset", "s"] + _hx_methods = ["hasNext", "next"] + + def __init__(self,s): + self.offset = 0 + self.s = s + + def hasNext(self): + return (self.offset < len(self.s)) + + def next(self): + index = self.offset + self.offset = (self.offset + 1) + return ord(self.s[index]) + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.offset = None + _hx_o.s = None + + +class haxe_iterators_StringIteratorUnicode: + _hx_class_name = "haxe.iterators.StringIteratorUnicode" + __slots__ = ("offset", "s") + _hx_fields = ["offset", "s"] + _hx_methods = ["hasNext", "next"] + _hx_statics = ["unicodeIterator"] + + def __init__(self,s): + self.offset = 0 + self.s = s + + def hasNext(self): + return (self.offset < len(self.s)) + + def next(self): + index = self.offset + self.offset = (self.offset + 1) + return ord(self.s[index]) + + @staticmethod + def unicodeIterator(s): + return haxe_iterators_StringIteratorUnicode(s) + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.offset = None + _hx_o.s = None + + +class haxe_iterators_StringKeyValueIterator: + _hx_class_name = "haxe.iterators.StringKeyValueIterator" + __slots__ = ("offset", "s") + _hx_fields = ["offset", "s"] + _hx_methods = ["hasNext", "next"] + + def __init__(self,s): + self.offset = 0 + self.s = s + + def hasNext(self): + return (self.offset < len(self.s)) + + def next(self): + tmp = self.offset + s = self.s + index = self.offset + self.offset = (self.offset + 1) + return _hx_AnonObject({'key': tmp, 'value': (-1 if ((index >= len(s))) else ord(s[index]))}) + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.offset = None + _hx_o.s = None + + +class python_Boot: + _hx_class_name = "python.Boot" + __slots__ = () + _hx_statics = ["keywords", "arrayJoin", "safeJoin", "isPyBool", "isPyInt", "isPyFloat", "isClass", "isAnonObject", "_add_dynamic", "toString", "toString1", "isMetaType", "fields", "isString", "isArray", "simpleField", "createClosure", "hasField", "field", "getInstanceFields", "getSuperClass", "getClassFields", "unsafeFastCodeAt", "handleKeywords", "prefixLength", "unhandleKeywords", "implementsInterface"] + + @staticmethod + def arrayJoin(x,sep): + return sep.join([python_Boot.toString1(x1,'') for x1 in x]) + + @staticmethod + def safeJoin(x,sep): + return sep.join([x1 for x1 in x]) + + @staticmethod + def isPyBool(o): + return isinstance(o,bool) + + @staticmethod + def isPyInt(o): + if isinstance(o,int): + return (not isinstance(o,bool)) + else: + return False + + @staticmethod + def isPyFloat(o): + return isinstance(o,float) + + @staticmethod + def isClass(o): + if (o is not None): + if not HxOverrides.eq(o,str): + return python_lib_Inspect.isclass(o) + else: + return True + else: + return False + + @staticmethod + def isAnonObject(o): + return isinstance(o,_hx_AnonObject) + + @staticmethod + def _add_dynamic(a,b): + if (isinstance(a,str) and isinstance(b,str)): + return (a + b) + if (isinstance(a,str) or isinstance(b,str)): + return (python_Boot.toString1(a,"") + python_Boot.toString1(b,"")) + return (a + b) + + @staticmethod + def toString(o): + return python_Boot.toString1(o,"") + + @staticmethod + def toString1(o,s): + if (o is None): + return "null" + if isinstance(o,str): + return o + if (s is None): + s = "" + if (len(s) >= 5): + return "<...>" + if isinstance(o,bool): + if o: + return "true" + else: + return "false" + if (isinstance(o,int) and (not isinstance(o,bool))): + return str(o) + if isinstance(o,float): + try: + if (o == int(o)): + return str(Math.floor((o + 0.5))) + else: + return str(o) + except BaseException as _g: + None + return str(o) + if isinstance(o,list): + o1 = o + l = len(o1) + st = "[" + s = (("null" if s is None else s) + "\t") + _g = 0 + _g1 = l + while (_g < _g1): + i = _g + _g = (_g + 1) + prefix = "" + if (i > 0): + prefix = "," + st = (("null" if st is None else st) + HxOverrides.stringOrNull(((("null" if prefix is None else prefix) + HxOverrides.stringOrNull(python_Boot.toString1((o1[i] if i >= 0 and i < len(o1) else None),s)))))) + st = (("null" if st is None else st) + "]") + return st + try: + if hasattr(o,"toString"): + return o.toString() + except BaseException as _g: + None + if hasattr(o,"__class__"): + if isinstance(o,_hx_AnonObject): + toStr = None + try: + fields = python_Boot.fields(o) + _g = [] + _g1 = 0 + while (_g1 < len(fields)): + f = (fields[_g1] if _g1 >= 0 and _g1 < len(fields) else None) + _g1 = (_g1 + 1) + x = ((("" + ("null" if f is None else f)) + " : ") + HxOverrides.stringOrNull(python_Boot.toString1(python_Boot.simpleField(o,f),(("null" if s is None else s) + "\t")))) + _g.append(x) + fieldsStr = _g + toStr = (("{ " + HxOverrides.stringOrNull(", ".join([x1 for x1 in fieldsStr]))) + " }") + except BaseException as _g: + None + return "{ ... }" + if (toStr is None): + return "{ ... }" + else: + return toStr + if isinstance(o,Enum): + o1 = o + l = len(o1.params) + hasParams = (l > 0) + if hasParams: + paramsStr = "" + _g = 0 + _g1 = l + while (_g < _g1): + i = _g + _g = (_g + 1) + prefix = "" + if (i > 0): + prefix = "," + paramsStr = (("null" if paramsStr is None else paramsStr) + HxOverrides.stringOrNull(((("null" if prefix is None else prefix) + HxOverrides.stringOrNull(python_Boot.toString1(o1.params[i],s)))))) + return (((HxOverrides.stringOrNull(o1.tag) + "(") + ("null" if paramsStr is None else paramsStr)) + ")") + else: + return o1.tag + if hasattr(o,"_hx_class_name"): + if (o.__class__.__name__ != "type"): + fields = python_Boot.getInstanceFields(o) + _g = [] + _g1 = 0 + while (_g1 < len(fields)): + f = (fields[_g1] if _g1 >= 0 and _g1 < len(fields) else None) + _g1 = (_g1 + 1) + x = ((("" + ("null" if f is None else f)) + " : ") + HxOverrides.stringOrNull(python_Boot.toString1(python_Boot.simpleField(o,f),(("null" if s is None else s) + "\t")))) + _g.append(x) + fieldsStr = _g + toStr = (((HxOverrides.stringOrNull(o._hx_class_name) + "( ") + HxOverrides.stringOrNull(", ".join([x1 for x1 in fieldsStr]))) + " )") + return toStr + else: + fields = python_Boot.getClassFields(o) + _g = [] + _g1 = 0 + while (_g1 < len(fields)): + f = (fields[_g1] if _g1 >= 0 and _g1 < len(fields) else None) + _g1 = (_g1 + 1) + x = ((("" + ("null" if f is None else f)) + " : ") + HxOverrides.stringOrNull(python_Boot.toString1(python_Boot.simpleField(o,f),(("null" if s is None else s) + "\t")))) + _g.append(x) + fieldsStr = _g + toStr = (((("#" + HxOverrides.stringOrNull(o._hx_class_name)) + "( ") + HxOverrides.stringOrNull(", ".join([x1 for x1 in fieldsStr]))) + " )") + return toStr + if ((type(o) == type) and (o == str)): + return "#String" + if ((type(o) == type) and (o == list)): + return "#Array" + if callable(o): + return "function" + try: + if hasattr(o,"__repr__"): + return o.__repr__() + except BaseException as _g: + None + if hasattr(o,"__str__"): + return o.__str__([]) + if hasattr(o,"__name__"): + return o.__name__ + return "???" + else: + return str(o) + + @staticmethod + def isMetaType(v,t): + return ((type(v) == type) and (v == t)) + + @staticmethod + def fields(o): + a = [] + if (o is not None): + if hasattr(o,"_hx_fields"): + fields = o._hx_fields + if (fields is not None): + return list(fields) + if isinstance(o,_hx_AnonObject): + d = o.__dict__ + keys = d.keys() + handler = python_Boot.unhandleKeywords + for k in keys: + if (k != '_hx_disable_getattr'): + a.append(handler(k)) + elif hasattr(o,"__dict__"): + d = o.__dict__ + keys1 = d.keys() + for k in keys1: + a.append(k) + return a + + @staticmethod + def isString(o): + return isinstance(o,str) + + @staticmethod + def isArray(o): + return isinstance(o,list) + + @staticmethod + def simpleField(o,field): + if (field is None): + return None + field1 = (("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)) + if hasattr(o,field1): + return getattr(o,field1) + else: + return None + + @staticmethod + def createClosure(obj,func): + return python_internal_MethodClosure(obj,func) + + @staticmethod + def hasField(o,field): + if isinstance(o,_hx_AnonObject): + return o._hx_hasattr(field) + return hasattr(o,(("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field))) + + @staticmethod + def field(o,field): + if (field is None): + return None + if isinstance(o,str): + field1 = field + _hx_local_0 = len(field1) + if (_hx_local_0 == 10): + if (field1 == "charCodeAt"): + return python_internal_MethodClosure(o,HxString.charCodeAt) + else: + field1 = (("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)) + if hasattr(o,field1): + return getattr(o,field1) + else: + return None + elif (_hx_local_0 == 11): + if (field1 == "lastIndexOf"): + return python_internal_MethodClosure(o,HxString.lastIndexOf) + elif (field1 == "toLowerCase"): + return python_internal_MethodClosure(o,HxString.toLowerCase) + elif (field1 == "toUpperCase"): + return python_internal_MethodClosure(o,HxString.toUpperCase) + else: + field1 = (("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)) + if hasattr(o,field1): + return getattr(o,field1) + else: + return None + elif (_hx_local_0 == 9): + if (field1 == "substring"): + return python_internal_MethodClosure(o,HxString.substring) + else: + field1 = (("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)) + if hasattr(o,field1): + return getattr(o,field1) + else: + return None + elif (_hx_local_0 == 5): + if (field1 == "split"): + return python_internal_MethodClosure(o,HxString.split) + else: + field1 = (("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)) + if hasattr(o,field1): + return getattr(o,field1) + else: + return None + elif (_hx_local_0 == 7): + if (field1 == "indexOf"): + return python_internal_MethodClosure(o,HxString.indexOf) + else: + field1 = (("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)) + if hasattr(o,field1): + return getattr(o,field1) + else: + return None + elif (_hx_local_0 == 8): + if (field1 == "toString"): + return python_internal_MethodClosure(o,HxString.toString) + else: + field1 = (("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)) + if hasattr(o,field1): + return getattr(o,field1) + else: + return None + elif (_hx_local_0 == 6): + if (field1 == "charAt"): + return python_internal_MethodClosure(o,HxString.charAt) + elif (field1 == "length"): + return len(o) + elif (field1 == "substr"): + return python_internal_MethodClosure(o,HxString.substr) + else: + field1 = (("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)) + if hasattr(o,field1): + return getattr(o,field1) + else: + return None + else: + field1 = (("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)) + if hasattr(o,field1): + return getattr(o,field1) + else: + return None + elif isinstance(o,list): + field1 = field + _hx_local_1 = len(field1) + if (_hx_local_1 == 11): + if (field1 == "lastIndexOf"): + return python_internal_MethodClosure(o,python_internal_ArrayImpl.lastIndexOf) + else: + field1 = (("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)) + if hasattr(o,field1): + return getattr(o,field1) + else: + return None + elif (_hx_local_1 == 4): + if (field1 == "copy"): + return python_internal_MethodClosure(o,python_internal_ArrayImpl.copy) + elif (field1 == "join"): + return python_internal_MethodClosure(o,python_internal_ArrayImpl.join) + elif (field1 == "push"): + return python_internal_MethodClosure(o,python_internal_ArrayImpl.push) + elif (field1 == "sort"): + return python_internal_MethodClosure(o,python_internal_ArrayImpl.sort) + else: + field1 = (("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)) + if hasattr(o,field1): + return getattr(o,field1) + else: + return None + elif (_hx_local_1 == 5): + if (field1 == "shift"): + return python_internal_MethodClosure(o,python_internal_ArrayImpl.shift) + elif (field1 == "slice"): + return python_internal_MethodClosure(o,python_internal_ArrayImpl.slice) + else: + field1 = (("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)) + if hasattr(o,field1): + return getattr(o,field1) + else: + return None + elif (_hx_local_1 == 7): + if (field1 == "indexOf"): + return python_internal_MethodClosure(o,python_internal_ArrayImpl.indexOf) + elif (field1 == "reverse"): + return python_internal_MethodClosure(o,python_internal_ArrayImpl.reverse) + elif (field1 == "unshift"): + return python_internal_MethodClosure(o,python_internal_ArrayImpl.unshift) + else: + field1 = (("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)) + if hasattr(o,field1): + return getattr(o,field1) + else: + return None + elif (_hx_local_1 == 3): + if (field1 == "map"): + return python_internal_MethodClosure(o,python_internal_ArrayImpl.map) + elif (field1 == "pop"): + return python_internal_MethodClosure(o,python_internal_ArrayImpl.pop) + else: + field1 = (("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)) + if hasattr(o,field1): + return getattr(o,field1) + else: + return None + elif (_hx_local_1 == 8): + if (field1 == "contains"): + return python_internal_MethodClosure(o,python_internal_ArrayImpl.contains) + elif (field1 == "iterator"): + return python_internal_MethodClosure(o,python_internal_ArrayImpl.iterator) + elif (field1 == "toString"): + return python_internal_MethodClosure(o,python_internal_ArrayImpl.toString) + else: + field1 = (("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)) + if hasattr(o,field1): + return getattr(o,field1) + else: + return None + elif (_hx_local_1 == 16): + if (field1 == "keyValueIterator"): + return python_internal_MethodClosure(o,python_internal_ArrayImpl.keyValueIterator) + else: + field1 = (("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)) + if hasattr(o,field1): + return getattr(o,field1) + else: + return None + elif (_hx_local_1 == 6): + if (field1 == "concat"): + return python_internal_MethodClosure(o,python_internal_ArrayImpl.concat) + elif (field1 == "filter"): + return python_internal_MethodClosure(o,python_internal_ArrayImpl.filter) + elif (field1 == "insert"): + return python_internal_MethodClosure(o,python_internal_ArrayImpl.insert) + elif (field1 == "length"): + return len(o) + elif (field1 == "remove"): + return python_internal_MethodClosure(o,python_internal_ArrayImpl.remove) + elif (field1 == "splice"): + return python_internal_MethodClosure(o,python_internal_ArrayImpl.splice) + else: + field1 = (("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)) + if hasattr(o,field1): + return getattr(o,field1) + else: + return None + else: + field1 = (("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)) + if hasattr(o,field1): + return getattr(o,field1) + else: + return None + else: + field1 = (("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)) + if hasattr(o,field1): + return getattr(o,field1) + else: + return None + + @staticmethod + def getInstanceFields(c): + f = (list(c._hx_fields) if (hasattr(c,"_hx_fields")) else []) + if hasattr(c,"_hx_methods"): + f = (f + c._hx_methods) + sc = python_Boot.getSuperClass(c) + if (sc is None): + return f + else: + scArr = python_Boot.getInstanceFields(sc) + scMap = set(scArr) + _g = 0 + while (_g < len(f)): + f1 = (f[_g] if _g >= 0 and _g < len(f) else None) + _g = (_g + 1) + if (not (f1 in scMap)): + scArr.append(f1) + return scArr + + @staticmethod + def getSuperClass(c): + if (c is None): + return None + try: + if hasattr(c,"_hx_super"): + return c._hx_super + return None + except BaseException as _g: + None + return None + + @staticmethod + def getClassFields(c): + if hasattr(c,"_hx_statics"): + x = c._hx_statics + return list(x) + else: + return [] + + @staticmethod + def unsafeFastCodeAt(s,index): + return ord(s[index]) + + @staticmethod + def handleKeywords(name): + if (name in python_Boot.keywords): + return ("_hx_" + name) + elif ((((len(name) > 2) and ((ord(name[0]) == 95))) and ((ord(name[1]) == 95))) and ((ord(name[(len(name) - 1)]) != 95))): + return ("_hx_" + name) + else: + return name + + @staticmethod + def unhandleKeywords(name): + if (HxString.substr(name,0,python_Boot.prefixLength) == "_hx_"): + real = HxString.substr(name,python_Boot.prefixLength,None) + if (real in python_Boot.keywords): + return real + return name + + @staticmethod + def implementsInterface(value,cls): + loop = None + def _hx_local_1(intf): + f = (intf._hx_interfaces if (hasattr(intf,"_hx_interfaces")) else []) + if (f is not None): + _g = 0 + while (_g < len(f)): + i = (f[_g] if _g >= 0 and _g < len(f) else None) + _g = (_g + 1) + if (i == cls): + return True + else: + l = loop(i) + if l: + return True + return False + else: + return False + loop = _hx_local_1 + currentClass = value.__class__ + result = False + while (currentClass is not None): + if loop(currentClass): + result = True + break + currentClass = python_Boot.getSuperClass(currentClass) + return result + + +class python_HaxeIterable: + _hx_class_name = "python.HaxeIterable" + __slots__ = ("x",) + _hx_fields = ["x"] + _hx_methods = ["iterator"] + + def __init__(self,x): + self.x = x + + def iterator(self): + return python_HaxeIterator(self.x.__iter__()) + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.x = None + + +class python_HaxeIterator: + _hx_class_name = "python.HaxeIterator" + __slots__ = ("it", "x", "has", "checked") + _hx_fields = ["it", "x", "has", "checked"] + _hx_methods = ["next", "hasNext"] + + def __init__(self,it): + self.checked = False + self.has = False + self.x = None + self.it = it + + def next(self): + if (not self.checked): + self.hasNext() + self.checked = False + return self.x + + def hasNext(self): + if (not self.checked): + try: + self.x = self.it.__next__() + self.has = True + except BaseException as _g: + None + if Std.isOfType(haxe_Exception.caught(_g).unwrap(),StopIteration): + self.has = False + self.x = None + else: + raise _g + self.checked = True + return self.has + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.it = None + _hx_o.x = None + _hx_o.has = None + _hx_o.checked = None + + +class python__KwArgs_KwArgs_Impl_: + _hx_class_name = "python._KwArgs.KwArgs_Impl_" + __slots__ = () + _hx_statics = ["_new", "toDict", "toDictHelper", "fromDict", "fromT", "typed", "get"] + + @staticmethod + def _new(d): + this1 = d + return this1 + + @staticmethod + def toDict(this1): + return python__KwArgs_KwArgs_Impl_.toDictHelper(this1,None) + + @staticmethod + def toDictHelper(this1,x): + return this1 + + @staticmethod + def fromDict(d): + this1 = d + return this1 + + @staticmethod + def fromT(d): + this1 = python_Lib.anonAsDict(d) + return this1 + + @staticmethod + def typed(this1): + return _hx_AnonObject(python__KwArgs_KwArgs_Impl_.toDictHelper(this1,None)) + + @staticmethod + def get(this1,key,_hx_def): + return this1.get(key,_hx_def) + + +class python_Lib: + _hx_class_name = "python.Lib" + __slots__ = () + _hx_statics = ["lineEnd", "get___name__", "print", "printString", "println", "dictToAnon", "anonToDict", "anonAsDict", "dictAsAnon", "toPythonIterable", "toHaxeIterable", "toHaxeIterator"] + __name__ = None + + @staticmethod + def get___name__(): + return __name__ + + @staticmethod + def print(v): + python_Lib.printString(Std.string(v)) + + @staticmethod + def printString(_hx_str): + encoding = "utf-8" + if (encoding is None): + encoding = "utf-8" + python_lib_Sys.stdout.buffer.write(_hx_str.encode(encoding, "strict")) + python_lib_Sys.stdout.flush() + + @staticmethod + def println(v): + _hx_str = Std.string(v) + python_Lib.printString((("" + ("null" if _hx_str is None else _hx_str)) + HxOverrides.stringOrNull(python_Lib.lineEnd))) + + @staticmethod + def dictToAnon(v): + return _hx_AnonObject(v.copy()) + + @staticmethod + def anonToDict(o): + if isinstance(o,_hx_AnonObject): + return o.__dict__.copy() + else: + return None + + @staticmethod + def anonAsDict(o): + if isinstance(o,_hx_AnonObject): + return o.__dict__ + else: + return None + + @staticmethod + def dictAsAnon(d): + return _hx_AnonObject(d) + + @staticmethod + def toPythonIterable(it): + def _hx_local_3(): + def _hx_local_2(): + it1 = HxOverrides.iterator(it) + _hx_self = None + def _hx_local_0(): + if it1.hasNext(): + return it1.next() + else: + raise haxe_Exception.thrown(StopIteration()) + def _hx_local_1(): + return _hx_self + this1 = _hx_AnonObject({'__next__': _hx_local_0, '__iter__': _hx_local_1}) + _hx_self = this1 + return _hx_self + return _hx_AnonObject({'__iter__': _hx_local_2}) + return _hx_local_3() + + @staticmethod + def toHaxeIterable(it): + return python_HaxeIterable(it) + + @staticmethod + def toHaxeIterator(it): + return python_HaxeIterator(it) + + +class python__NativeIterable_NativeIterable_Impl_: + _hx_class_name = "python._NativeIterable.NativeIterable_Impl_" + __slots__ = () + _hx_statics = ["toHaxeIterable", "iterator"] + + @staticmethod + def toHaxeIterable(this1): + return python_HaxeIterable(this1) + + @staticmethod + def iterator(this1): + return python_HaxeIterator(this1.__iter__()) + + +class python__NativeIterator_NativeIterator_Impl_: + _hx_class_name = "python._NativeIterator.NativeIterator_Impl_" + __slots__ = () + _hx_statics = ["_new", "toHaxeIterator"] + + @staticmethod + def _new(p): + this1 = p + return this1 + + @staticmethod + def toHaxeIterator(this1): + return python_HaxeIterator(this1) + + +class python_NativeStringTools: + _hx_class_name = "python.NativeStringTools" + __slots__ = () + _hx_statics = ["format", "encode", "contains", "strip", "rpartition", "startswith", "endswith"] + + @staticmethod + def format(s,args): + return s.format(*args) + + @staticmethod + def encode(s,encoding = None,errors = None): + if (encoding is None): + encoding = "utf-8" + if (errors is None): + errors = "strict" + return s.encode(encoding, errors) + + @staticmethod + def contains(s,e): + return (e in s) + + @staticmethod + def strip(s,chars = None): + return s.strip(chars) + + @staticmethod + def rpartition(s,sep): + return s.rpartition(sep) + + @staticmethod + def startswith(s,prefix): + return s.startswith(prefix) + + @staticmethod + def endswith(s,suffix): + return s.endswith(suffix) + + +class python__VarArgs_VarArgs_Impl_: + _hx_class_name = "python._VarArgs.VarArgs_Impl_" + __slots__ = () + _hx_statics = ["_new", "raw", "toArray", "fromArray"] + + @staticmethod + def _new(d): + this1 = d + return this1 + + @staticmethod + def raw(this1): + return this1 + + @staticmethod + def toArray(this1): + if (not Std.isOfType(this1,list)): + return list(this1) + else: + return this1 + + @staticmethod + def fromArray(d): + this1 = d + return this1 + + +class python_internal_ArrayImpl: + _hx_class_name = "python.internal.ArrayImpl" + __slots__ = () + _hx_statics = ["get_length", "concat", "copy", "iterator", "keyValueIterator", "indexOf", "lastIndexOf", "join", "toString", "pop", "push", "unshift", "remove", "contains", "shift", "slice", "sort", "splice", "map", "filter", "insert", "reverse", "_get", "_set", "unsafeGet", "unsafeSet", "resize"] + + @staticmethod + def get_length(x): + return len(x) + + @staticmethod + def concat(a1,a2): + return (a1 + a2) + + @staticmethod + def copy(x): + return list(x) + + @staticmethod + def iterator(x): + return python_HaxeIterator(x.__iter__()) + + @staticmethod + def keyValueIterator(x): + return haxe_iterators_ArrayKeyValueIterator(x) + + @staticmethod + def indexOf(a,x,fromIndex = None): + _hx_len = len(a) + l = (0 if ((fromIndex is None)) else ((_hx_len + fromIndex) if ((fromIndex < 0)) else fromIndex)) + if (l < 0): + l = 0 + _g = l + _g1 = _hx_len + while (_g < _g1): + i = _g + _g = (_g + 1) + if HxOverrides.eq(a[i],x): + return i + return -1 + + @staticmethod + def lastIndexOf(a,x,fromIndex = None): + _hx_len = len(a) + l = (_hx_len if ((fromIndex is None)) else (((_hx_len + fromIndex) + 1) if ((fromIndex < 0)) else (fromIndex + 1))) + if (l > _hx_len): + l = _hx_len + while True: + l = (l - 1) + tmp = l + if (not ((tmp > -1))): + break + if HxOverrides.eq(a[l],x): + return l + return -1 + + @staticmethod + def join(x,sep): + return sep.join([python_Boot.toString1(x1,'') for x1 in x]) + + @staticmethod + def toString(x): + return (("[" + HxOverrides.stringOrNull(",".join([python_Boot.toString1(x1,'') for x1 in x]))) + "]") + + @staticmethod + def pop(x): + if (len(x) == 0): + return None + else: + return x.pop() + + @staticmethod + def push(x,e): + x.append(e) + return len(x) + + @staticmethod + def unshift(x,e): + x.insert(0, e) + + @staticmethod + def remove(x,e): + try: + x.remove(e) + return True + except BaseException as _g: + None + return False + + @staticmethod + def contains(x,e): + return (e in x) + + @staticmethod + def shift(x): + if (len(x) == 0): + return None + return x.pop(0) + + @staticmethod + def slice(x,pos,end = None): + return x[pos:end] + + @staticmethod + def sort(x,f): + x.sort(key= python_lib_Functools.cmp_to_key(f)) + + @staticmethod + def splice(x,pos,_hx_len): + if (pos < 0): + pos = (len(x) + pos) + if (pos < 0): + pos = 0 + res = x[pos:(pos + _hx_len)] + del x[pos:(pos + _hx_len)] + return res + + @staticmethod + def map(x,f): + return list(map(f,x)) + + @staticmethod + def filter(x,f): + return list(filter(f,x)) + + @staticmethod + def insert(a,pos,x): + a.insert(pos, x) + + @staticmethod + def reverse(a): + a.reverse() + + @staticmethod + def _get(x,idx): + if ((idx > -1) and ((idx < len(x)))): + return x[idx] + else: + return None + + @staticmethod + def _set(x,idx,v): + l = len(x) + while (l < idx): + x.append(None) + l = (l + 1) + if (l == idx): + x.append(v) + else: + x[idx] = v + return v + + @staticmethod + def unsafeGet(x,idx): + return x[idx] + + @staticmethod + def unsafeSet(x,idx,val): + x[idx] = val + return val + + @staticmethod + def resize(x,_hx_len): + l = len(x) + if (l < _hx_len): + idx = (_hx_len - 1) + v = None + l1 = len(x) + while (l1 < idx): + x.append(None) + l1 = (l1 + 1) + if (l1 == idx): + x.append(v) + else: + x[idx] = v + elif (l > _hx_len): + pos = _hx_len + len1 = (l - _hx_len) + if (pos < 0): + pos = (len(x) + pos) + if (pos < 0): + pos = 0 + res = x[pos:(pos + len1)] + del x[pos:(pos + len1)] + + +class HxOverrides: + _hx_class_name = "HxOverrides" + __slots__ = () + _hx_statics = ["iterator", "keyValueIterator", "eq", "stringOrNull", "shift", "pop", "push", "join", "filter", "map", "toUpperCase", "toLowerCase", "split", "length", "rshift", "modf", "mod", "arrayGet", "arraySet", "mapKwArgs", "reverseMapKwArgs"] + + @staticmethod + def iterator(x): + if isinstance(x,list): + return haxe_iterators_ArrayIterator(x) + return x.iterator() + + @staticmethod + def keyValueIterator(x): + if isinstance(x,list): + return haxe_iterators_ArrayKeyValueIterator(x) + return x.keyValueIterator() + + @staticmethod + def eq(a,b): + if (isinstance(a,list) or isinstance(b,list)): + return a is b + return (a == b) + + @staticmethod + def stringOrNull(s): + if (s is None): + return "null" + else: + return s + + @staticmethod + def shift(x): + if isinstance(x,list): + _this = x + return (None if ((len(_this) == 0)) else _this.pop(0)) + return x.shift() + + @staticmethod + def pop(x): + if isinstance(x,list): + _this = x + return (None if ((len(_this) == 0)) else _this.pop()) + return x.pop() + + @staticmethod + def push(x,e): + if isinstance(x,list): + _this = x + _this.append(e) + return len(_this) + return x.push(e) + + @staticmethod + def join(x,sep): + if isinstance(x,list): + return sep.join([python_Boot.toString1(x1,'') for x1 in x]) + return x.join(sep) + + @staticmethod + def filter(x,f): + if isinstance(x,list): + return list(filter(f,x)) + return x.filter(f) + + @staticmethod + def map(x,f): + if isinstance(x,list): + return list(map(f,x)) + return x.map(f) + + @staticmethod + def toUpperCase(x): + if isinstance(x,str): + return x.upper() + return x.toUpperCase() + + @staticmethod + def toLowerCase(x): + if isinstance(x,str): + return x.lower() + return x.toLowerCase() + + @staticmethod + def split(x,delimiter): + if isinstance(x,str): + _this = x + if (delimiter == ""): + return list(_this) + else: + return _this.split(delimiter) + return x.split(delimiter) + + @staticmethod + def length(x): + if isinstance(x,str): + return len(x) + elif isinstance(x,list): + return len(x) + return x.length + + @staticmethod + def rshift(val,n): + return ((val % 0x100000000) >> n) + + @staticmethod + def modf(a,b): + if (b == 0.0): + return float('nan') + elif (a < 0): + if (b < 0): + return -(-a % (-b)) + else: + return -(-a % b) + elif (b < 0): + return a % (-b) + else: + return a % b + + @staticmethod + def mod(a,b): + if (a < 0): + if (b < 0): + return -(-a % (-b)) + else: + return -(-a % b) + elif (b < 0): + return a % (-b) + else: + return a % b + + @staticmethod + def arrayGet(a,i): + if isinstance(a,list): + x = a + if ((i > -1) and ((i < len(x)))): + return x[i] + else: + return None + else: + return a[i] + + @staticmethod + def arraySet(a,i,v): + if isinstance(a,list): + x = a + v1 = v + l = len(x) + while (l < i): + x.append(None) + l = (l + 1) + if (l == i): + x.append(v1) + else: + x[i] = v1 + return v1 + else: + a[i] = v + return v + + @staticmethod + def mapKwArgs(a,v): + a1 = _hx_AnonObject(python_Lib.anonToDict(a)) + k = python_HaxeIterator(iter(v.keys())) + while k.hasNext(): + k1 = k.next() + val = v.get(k1) + if a1._hx_hasattr(k1): + x = getattr(a1,k1) + setattr(a1,val,x) + delattr(a1,k1) + return a1 + + @staticmethod + def reverseMapKwArgs(a,v): + a1 = a.copy() + k = python_HaxeIterator(iter(v.keys())) + while k.hasNext(): + k1 = k.next() + val = v.get(k1) + if (val in a1): + x = a1.get(val,None) + a1[k1] = x + del a1[val] + return a1 + + +class python_internal_Internal: + _hx_class_name = "python.internal.Internal" + __slots__ = () + + +class python_internal_MethodClosure: + _hx_class_name = "python.internal.MethodClosure" + __slots__ = ("obj", "func") + _hx_fields = ["obj", "func"] + _hx_methods = ["__call__"] + + def __init__(self,obj,func): + self.obj = obj + self.func = func + + def __call__(self,*args): + return self.func(self.obj,*args) + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.obj = None + _hx_o.func = None + + +class HxString: + _hx_class_name = "HxString" + __slots__ = () + _hx_statics = ["split", "charCodeAt", "charAt", "lastIndexOf", "toUpperCase", "toLowerCase", "indexOf", "indexOfImpl", "toString", "get_length", "fromCharCode", "substring", "substr"] + + @staticmethod + def split(s,d): + if (d == ""): + return list(s) + else: + return s.split(d) + + @staticmethod + def charCodeAt(s,index): + if ((((s is None) or ((len(s) == 0))) or ((index < 0))) or ((index >= len(s)))): + return None + else: + return ord(s[index]) + + @staticmethod + def charAt(s,index): + if ((index < 0) or ((index >= len(s)))): + return "" + else: + return s[index] + + @staticmethod + def lastIndexOf(s,_hx_str,startIndex = None): + if (startIndex is None): + return s.rfind(_hx_str, 0, len(s)) + elif (_hx_str == ""): + length = len(s) + if (startIndex < 0): + startIndex = (length + startIndex) + if (startIndex < 0): + startIndex = 0 + if (startIndex > length): + return length + else: + return startIndex + else: + i = s.rfind(_hx_str, 0, (startIndex + 1)) + startLeft = (max(0,((startIndex + 1) - len(_hx_str))) if ((i == -1)) else (i + 1)) + check = s.find(_hx_str, startLeft, len(s)) + if ((check > i) and ((check <= startIndex))): + return check + else: + return i + + @staticmethod + def toUpperCase(s): + return s.upper() + + @staticmethod + def toLowerCase(s): + return s.lower() + + @staticmethod + def indexOf(s,_hx_str,startIndex = None): + if (startIndex is None): + return s.find(_hx_str) + else: + return HxString.indexOfImpl(s,_hx_str,startIndex) + + @staticmethod + def indexOfImpl(s,_hx_str,startIndex): + if (_hx_str == ""): + length = len(s) + if (startIndex < 0): + startIndex = (length + startIndex) + if (startIndex < 0): + startIndex = 0 + if (startIndex > length): + return length + else: + return startIndex + return s.find(_hx_str, startIndex) + + @staticmethod + def toString(s): + return s + + @staticmethod + def get_length(s): + return len(s) + + @staticmethod + def fromCharCode(code): + return "".join(map(chr,[code])) + + @staticmethod + def substring(s,startIndex,endIndex = None): + if (startIndex < 0): + startIndex = 0 + if (endIndex is None): + return s[startIndex:] + else: + if (endIndex < 0): + endIndex = 0 + if (endIndex < startIndex): + return s[endIndex:startIndex] + else: + return s[startIndex:endIndex] + + @staticmethod + def substr(s,startIndex,_hx_len = None): + if (_hx_len is None): + return s[startIndex:] + else: + if (_hx_len == 0): + return "" + if (startIndex < 0): + startIndex = (len(s) + startIndex) + if (startIndex < 0): + startIndex = 0 + return s[startIndex:(startIndex + _hx_len)] + + +class python_io_NativeInput(haxe_io_Input): + _hx_class_name = "python.io.NativeInput" + __slots__ = ("stream", "wasEof") + _hx_fields = ["stream", "wasEof"] + _hx_methods = ["get_canSeek", "close", "tell", "throwEof", "eof", "readinto", "seek", "readBytes"] + _hx_statics = [] + _hx_interfaces = [] + _hx_super = haxe_io_Input + + + def __init__(self,s): + self.wasEof = None + self.stream = s + self.set_bigEndian(False) + self.wasEof = False + if (not self.stream.readable()): + raise haxe_Exception.thrown("Write-only stream") + + def get_canSeek(self): + return self.stream.seekable() + + def close(self): + self.stream.close() + + def tell(self): + return self.stream.tell() + + def throwEof(self): + self.wasEof = True + raise haxe_Exception.thrown(haxe_io_Eof()) + + def eof(self): + return self.wasEof + + def readinto(self,b): + raise haxe_Exception.thrown("abstract method, should be overridden") + + def seek(self,p,mode): + raise haxe_Exception.thrown("abstract method, should be overridden") + + def readBytes(self,s,pos,_hx_len): + if (((pos < 0) or ((_hx_len < 0))) or (((pos + _hx_len) > s.length))): + raise haxe_Exception.thrown(haxe_io_Error.OutsideBounds) + ba = bytearray(_hx_len) + ret = self.readinto(ba) + if (ret == 0): + self.throwEof() + s.blit(pos,haxe_io_Bytes.ofData(ba),0,_hx_len) + return ret + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.stream = None + _hx_o.wasEof = None + + +class python_io_IInput: + _hx_class_name = "python.io.IInput" + __slots__ = ("bigEndian",) + _hx_fields = ["bigEndian"] + _hx_methods = ["set_bigEndian", "readByte", "readBytes", "close", "readAll", "readFullBytes", "read", "readUntil", "readLine", "readFloat", "readDouble", "readInt8", "readInt16", "readUInt16", "readInt24", "readUInt24", "readInt32", "readString"] + + +class python_io_NativeBytesInput(python_io_NativeInput): + _hx_class_name = "python.io.NativeBytesInput" + __slots__ = () + _hx_fields = [] + _hx_methods = ["readByte", "seek", "readinto"] + _hx_statics = [] + _hx_interfaces = [python_io_IInput] + _hx_super = python_io_NativeInput + + + def __init__(self,stream): + super().__init__(stream) + + def readByte(self): + ret = self.stream.read(1) + if (len(ret) == 0): + self.throwEof() + return ret[0] + + def seek(self,p,pos): + self.wasEof = False + python_io_IoTools.seekInBinaryMode(self.stream,p,pos) + + def readinto(self,b): + return self.stream.readinto(b) + + @staticmethod + def _hx_empty_init(_hx_o): pass + + +class python_io_IFileInput: + _hx_class_name = "python.io.IFileInput" + __slots__ = () + _hx_methods = ["seek", "tell", "eof"] + _hx_interfaces = [python_io_IInput] + + +class python_io_FileBytesInput(python_io_NativeBytesInput): + _hx_class_name = "python.io.FileBytesInput" + __slots__ = () + _hx_fields = [] + _hx_methods = [] + _hx_statics = [] + _hx_interfaces = [python_io_IFileInput] + _hx_super = python_io_NativeBytesInput + + + def __init__(self,stream): + super().__init__(stream) + + +class python_io_NativeOutput(haxe_io_Output): + _hx_class_name = "python.io.NativeOutput" + __slots__ = ("stream",) + _hx_fields = ["stream"] + _hx_methods = ["get_canSeek", "close", "prepare", "flush", "tell"] + _hx_statics = [] + _hx_interfaces = [] + _hx_super = haxe_io_Output + + + def __init__(self,stream): + self.stream = None + self.set_bigEndian(False) + self.stream = stream + if (not stream.writable()): + raise haxe_Exception.thrown("Read only stream") + + def get_canSeek(self): + return self.stream.seekable() + + def close(self): + self.stream.close() + + def prepare(self,nbytes): + self.stream.truncate(nbytes) + + def flush(self): + self.stream.flush() + + def tell(self): + return self.stream.tell() + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.stream = None + + +class python_io_NativeBytesOutput(python_io_NativeOutput): + _hx_class_name = "python.io.NativeBytesOutput" + __slots__ = () + _hx_fields = [] + _hx_methods = ["seek", "prepare", "writeByte", "writeBytes"] + _hx_statics = [] + _hx_interfaces = [] + _hx_super = python_io_NativeOutput + + + def __init__(self,stream): + super().__init__(stream) + + def seek(self,p,pos): + python_io_IoTools.seekInBinaryMode(self.stream,p,pos) + + def prepare(self,nbytes): + self.stream.truncate(nbytes) + + def writeByte(self,c): + self.stream.write(bytearray([c])) + + def writeBytes(self,s,pos,_hx_len): + return self.stream.write(s.b[pos:(pos + _hx_len)]) + + @staticmethod + def _hx_empty_init(_hx_o): pass + + +class python_io_IOutput: + _hx_class_name = "python.io.IOutput" + __slots__ = ("bigEndian",) + _hx_fields = ["bigEndian"] + _hx_methods = ["set_bigEndian", "writeByte", "writeBytes", "flush", "close", "write", "writeFullBytes", "writeFloat", "writeDouble", "writeInt8", "writeInt16", "writeUInt16", "writeInt24", "writeUInt24", "writeInt32", "prepare", "writeInput", "writeString"] + + +class python_io_IFileOutput: + _hx_class_name = "python.io.IFileOutput" + __slots__ = () + _hx_methods = ["seek", "tell"] + _hx_interfaces = [python_io_IOutput] + + +class python_io_FileBytesOutput(python_io_NativeBytesOutput): + _hx_class_name = "python.io.FileBytesOutput" + __slots__ = () + _hx_fields = [] + _hx_methods = [] + _hx_statics = [] + _hx_interfaces = [python_io_IFileOutput] + _hx_super = python_io_NativeBytesOutput + + + def __init__(self,stream): + super().__init__(stream) + + +class python_io_NativeTextInput(python_io_NativeInput): + _hx_class_name = "python.io.NativeTextInput" + __slots__ = () + _hx_fields = [] + _hx_methods = ["readByte", "seek", "readinto"] + _hx_statics = [] + _hx_interfaces = [python_io_IInput] + _hx_super = python_io_NativeInput + + + def __init__(self,stream): + super().__init__(stream) + + def readByte(self): + ret = self.stream.buffer.read(1) + if (len(ret) == 0): + self.throwEof() + return ret[0] + + def seek(self,p,pos): + self.wasEof = False + python_io_IoTools.seekInTextMode(self.stream,self.tell,p,pos) + + def readinto(self,b): + return self.stream.buffer.readinto(b) + + @staticmethod + def _hx_empty_init(_hx_o): pass + + +class python_io_FileTextInput(python_io_NativeTextInput): + _hx_class_name = "python.io.FileTextInput" + __slots__ = () + _hx_fields = [] + _hx_methods = [] + _hx_statics = [] + _hx_interfaces = [python_io_IFileInput] + _hx_super = python_io_NativeTextInput + + + def __init__(self,stream): + super().__init__(stream) + + +class python_io_NativeTextOutput(python_io_NativeOutput): + _hx_class_name = "python.io.NativeTextOutput" + __slots__ = () + _hx_fields = [] + _hx_methods = ["seek", "writeBytes", "writeByte"] + _hx_statics = [] + _hx_interfaces = [] + _hx_super = python_io_NativeOutput + + + def __init__(self,stream): + super().__init__(stream) + if (not stream.writable()): + raise haxe_Exception.thrown("Read only stream") + + def seek(self,p,pos): + python_io_IoTools.seekInTextMode(self.stream,self.tell,p,pos) + + def writeBytes(self,s,pos,_hx_len): + return self.stream.buffer.write(s.b[pos:(pos + _hx_len)]) + + def writeByte(self,c): + self.stream.write("".join(map(chr,[c]))) + + @staticmethod + def _hx_empty_init(_hx_o): pass + + +class python_io_FileTextOutput(python_io_NativeTextOutput): + _hx_class_name = "python.io.FileTextOutput" + __slots__ = () + _hx_fields = [] + _hx_methods = [] + _hx_statics = [] + _hx_interfaces = [python_io_IFileOutput] + _hx_super = python_io_NativeTextOutput + + + def __init__(self,stream): + super().__init__(stream) + + +class python_io_IoTools: + _hx_class_name = "python.io.IoTools" + __slots__ = () + _hx_statics = ["createFileInputFromText", "createFileInputFromBytes", "createFileOutputFromText", "createFileOutputFromBytes", "seekInTextMode", "seekInBinaryMode"] + + @staticmethod + def createFileInputFromText(t): + return sys_io_FileInput(python_io_FileTextInput(t)) + + @staticmethod + def createFileInputFromBytes(t): + return sys_io_FileInput(python_io_FileBytesInput(t)) + + @staticmethod + def createFileOutputFromText(t): + return sys_io_FileOutput(python_io_FileTextOutput(t)) + + @staticmethod + def createFileOutputFromBytes(t): + return sys_io_FileOutput(python_io_FileBytesOutput(t)) + + @staticmethod + def seekInTextMode(stream,tell,p,pos): + pos1 = None + pos2 = pos.index + if (pos2 == 0): + pos1 = 0 + elif (pos2 == 1): + p = (tell() + p) + pos1 = 0 + elif (pos2 == 2): + stream.seek(0,2) + p = (tell() + p) + pos1 = 0 + else: + pass + stream.seek(p,pos1) + + @staticmethod + def seekInBinaryMode(stream,p,pos): + pos1 = None + pos2 = pos.index + if (pos2 == 0): + pos1 = 0 + elif (pos2 == 1): + pos1 = 1 + elif (pos2 == 2): + pos1 = 2 + else: + pass + stream.seek(p,pos1) + + +class python_lib__Re_Choice_Impl_: + _hx_class_name = "python.lib._Re.Choice_Impl_" + __slots__ = () + _hx_statics = ["fromA", "fromB"] + + @staticmethod + def fromA(x): + return x + + @staticmethod + def fromB(x): + return x + + +class python_lib__Re_RegexHelper: + _hx_class_name = "python.lib._Re.RegexHelper" + __slots__ = () + _hx_statics = ["findallDynamic"] + + @staticmethod + def findallDynamic(r,string,pos = None,endpos = None): + if (endpos is None): + if (pos is None): + return r.findall(string) + else: + return r.findall(string,pos) + else: + return r.findall(string,pos,endpos) + + +class sys_io_FileInput(haxe_io_Input): + _hx_class_name = "sys.io.FileInput" + __slots__ = ("impl",) + _hx_fields = ["impl"] + _hx_methods = ["set_bigEndian", "seek", "tell", "eof", "readByte", "readBytes", "close", "readAll", "readFullBytes", "read", "readUntil", "readLine", "readFloat", "readDouble", "readInt8", "readInt16", "readUInt16", "readInt24", "readUInt24", "readInt32", "readString"] + _hx_statics = [] + _hx_interfaces = [] + _hx_super = haxe_io_Input + + + def __init__(self,impl): + self.impl = impl + + def set_bigEndian(self,b): + return self.impl.set_bigEndian(b) + + def seek(self,p,pos): + self.impl.seek(p,pos) + + def tell(self): + return self.impl.tell() + + def eof(self): + return self.impl.eof() + + def readByte(self): + return self.impl.readByte() + + def readBytes(self,s,pos,_hx_len): + return self.impl.readBytes(s,pos,_hx_len) + + def close(self): + self.impl.close() + + def readAll(self,bufsize = None): + return self.impl.readAll(bufsize) + + def readFullBytes(self,s,pos,_hx_len): + self.impl.readFullBytes(s,pos,_hx_len) + + def read(self,nbytes): + return self.impl.read(nbytes) + + def readUntil(self,end): + return self.impl.readUntil(end) + + def readLine(self): + return self.impl.readLine() + + def readFloat(self): + return self.impl.readFloat() + + def readDouble(self): + return self.impl.readDouble() + + def readInt8(self): + return self.impl.readInt8() + + def readInt16(self): + return self.impl.readInt16() + + def readUInt16(self): + return self.impl.readUInt16() + + def readInt24(self): + return self.impl.readInt24() + + def readUInt24(self): + return self.impl.readUInt24() + + def readInt32(self): + return self.impl.readInt32() + + def readString(self,_hx_len,encoding = None): + return self.impl.readString(_hx_len) + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.impl = None + + +class sys_io_FileOutput(haxe_io_Output): + _hx_class_name = "sys.io.FileOutput" + __slots__ = ("impl",) + _hx_fields = ["impl"] + _hx_methods = ["seek", "tell", "set_bigEndian", "writeByte", "writeBytes", "flush", "close", "write", "writeFullBytes", "writeFloat", "writeDouble", "writeInt8", "writeInt16", "writeUInt16", "writeInt24", "writeUInt24", "writeInt32", "prepare", "writeInput", "writeString"] + _hx_statics = [] + _hx_interfaces = [] + _hx_super = haxe_io_Output + + + def __init__(self,impl): + self.impl = impl + + def seek(self,p,pos): + self.impl.seek(p,pos) + + def tell(self): + return self.impl.tell() + + def set_bigEndian(self,b): + return self.impl.set_bigEndian(b) + + def writeByte(self,c): + self.impl.writeByte(c) + + def writeBytes(self,s,pos,_hx_len): + return self.impl.writeBytes(s,pos,_hx_len) + + def flush(self): + self.impl.flush() + + def close(self): + self.impl.close() + + def write(self,s): + self.impl.write(s) + + def writeFullBytes(self,s,pos,_hx_len): + self.impl.writeFullBytes(s,pos,_hx_len) + + def writeFloat(self,x): + self.impl.writeFloat(x) + + def writeDouble(self,x): + self.impl.writeDouble(x) + + def writeInt8(self,x): + self.impl.writeInt8(x) + + def writeInt16(self,x): + self.impl.writeInt16(x) + + def writeUInt16(self,x): + self.impl.writeUInt16(x) + + def writeInt24(self,x): + self.impl.writeInt24(x) + + def writeUInt24(self,x): + self.impl.writeUInt24(x) + + def writeInt32(self,x): + self.impl.writeInt32(x) + + def prepare(self,nbytes): + self.impl.prepare(nbytes) + + def writeInput(self,i,bufsize = None): + self.impl.writeInput(i,bufsize) + + def writeString(self,s,encoding = None): + self.impl.writeString(s) + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.impl = None + +class sys_io_FileSeek(Enum): + __slots__ = () + _hx_class_name = "sys.io.FileSeek" + _hx_constructs = ["SeekBegin", "SeekCur", "SeekEnd"] +sys_io_FileSeek.SeekBegin = sys_io_FileSeek("SeekBegin", 0, ()) +sys_io_FileSeek.SeekCur = sys_io_FileSeek("SeekCur", 1, ()) +sys_io_FileSeek.SeekEnd = sys_io_FileSeek("SeekEnd", 2, ()) + + +class xrfragment_Query: + _hx_class_name = "xrfragment.Query" + __slots__ = ("str", "q", "include", "exclude", "accept", "preset") + _hx_fields = ["str", "q", "include", "exclude", "accept", "preset"] + _hx_methods = ["toObject", "qualify", "parse", "test"] + + def __init__(self,_hx_str): + self.preset = "" + self.accept = False + self.exclude = list() + self.include = list() + self.q = _hx_AnonObject({}) + self.str = "" + if (_hx_str is not None): + self.parse(_hx_str) + + def toObject(self): + return self.q + + def qualify(self,nodename): + if Reflect.field(self.q,"copy_all"): + self.accept = True + if (nodename in self.include): + self.accept = True + if (nodename in self.exclude): + self.accept = False + return self.accept + + def parse(self,_hx_str,recurse = None): + if (recurse is None): + recurse = False + _gthis = self + copyAll = (Reflect.field(self.q,"copy_all") if recurse else (((HxString.substr(_hx_str,0,1) == "-") or ((HxString.substr(_hx_str,0,1) == "?"))) or ((_hx_str == "")))) + isOr = EReg("^or$","") + isProp = EReg(".*:[><=!]?","") + isName = EReg("[^:/]","") + isExclude = EReg("^-","") + isInclude = EReg("^\\+","") + isPreset = EReg("^\\?","") + token = _hx_str.split(" ") + ors = list() + q = _hx_AnonObject({}) + def _hx_local_0(): + nonlocal q + q = _hx_AnonObject({}) + value = list() + setattr(q,(("_hx_" + "object") if (("object" in python_Boot.keywords)) else (("_hx_" + "object") if (((((len("object") > 2) and ((ord("object"[0]) == 95))) and ((ord("object"[1]) == 95))) and ((ord("object"[(len("object") - 1)]) != 95)))) else "object")),value) + value = list() + setattr(q,(("_hx_" + "-object") if (("-object" in python_Boot.keywords)) else (("_hx_" + "-object") if (((((len("-object") > 2) and ((ord("-object"[0]) == 95))) and ((ord("-object"[1]) == 95))) and ((ord("-object"[(len("-object") - 1)]) != 95)))) else "-object")),value) + ors.append(q) + return q + composeQuery = _hx_local_0 + composeQuery() + match = None + def _hx_local_2(_hx_str,prefix = None): + if (prefix is None): + prefix = "" + isPreset.matchObj = python_lib_Re.search(isPreset.pattern,_hx_str) + if ((isPreset.matchObj is not None) and (not recurse)): + _gthis.preset = _hx_str + return + match1 = None + isExclude.matchObj = python_lib_Re.search(isExclude.pattern,_hx_str) + if (isExclude.matchObj is None): + isInclude.matchObj = python_lib_Re.search(isInclude.pattern,_hx_str) + match1 = (isInclude.matchObj is not None) + else: + match1 = True + if match1: + t = HxString.substr(_hx_str,1,None) + match(t,HxString.substr(_hx_str,0,1)) + return + isProp.matchObj = python_lib_Re.search(isProp.pattern,_hx_str) + if (isProp.matchObj is not None): + skip = 0 + _hx_type = "=" + startIndex = None + if (((_hx_str.find("*") if ((startIndex is None)) else HxString.indexOfImpl(_hx_str,"*",startIndex))) != -1): + _hx_type = "*" + startIndex = None + if (((_hx_str.find(">") if ((startIndex is None)) else HxString.indexOfImpl(_hx_str,">",startIndex))) != -1): + _hx_type = ">" + startIndex = None + if (((_hx_str.find("<") if ((startIndex is None)) else HxString.indexOfImpl(_hx_str,"<",startIndex))) != -1): + _hx_type = "<" + startIndex = None + if (((_hx_str.find("!=") if ((startIndex is None)) else HxString.indexOfImpl(_hx_str,"!=",startIndex))) != -1): + _hx_type = "!=" + startIndex = None + if (((_hx_str.find(">=") if ((startIndex is None)) else HxString.indexOfImpl(_hx_str,">=",startIndex))) != -1): + _hx_type = ">=" + startIndex = None + if (((_hx_str.find("<=") if ((startIndex is None)) else HxString.indexOfImpl(_hx_str,"<=",startIndex))) != -1): + _hx_type = "<=" + if (_hx_type != "="): + skip = (skip + len(_hx_type)) + property = HxOverrides.arrayGet(_hx_str.split(":"), 0) + value = None + if Reflect.field(q,(("null" if prefix is None else prefix) + ("null" if property is None else property))): + value = Reflect.field(q,(("null" if prefix is None else prefix) + ("null" if property is None else property))) + else: + value = _hx_AnonObject({}) + value1 = HxString.substr(HxOverrides.arrayGet(_hx_str.split(":"), 1),skip,None) + setattr(value,(("_hx_" + _hx_type) if ((_hx_type in python_Boot.keywords)) else (("_hx_" + _hx_type) if (((((len(_hx_type) > 2) and ((ord(_hx_type[0]) == 95))) and ((ord(_hx_type[1]) == 95))) and ((ord(_hx_type[(len(_hx_type) - 1)]) != 95)))) else _hx_type)),value1) + key = (("null" if prefix is None else prefix) + ("null" if property is None else property)) + setattr(q,(("_hx_" + key) if ((key in python_Boot.keywords)) else (("_hx_" + key) if (((((len(key) > 2) and ((ord(key[0]) == 95))) and ((ord(key[1]) == 95))) and ((ord(key[(len(key) - 1)]) != 95)))) else key)),value) + return + isName.matchObj = python_lib_Re.search(isName.pattern,_hx_str) + if (isName.matchObj is not None): + if (prefix == "-"): + Reflect.field(Reflect.field(q,"-object"),"push")(_hx_str) + while (Reflect.field(Reflect.field(q,"object"),"contains")(_hx_str) == True): + Reflect.field(Reflect.field(q,"object"),"remove")(_hx_str) + else: + Reflect.field(Reflect.field(q,"object"),"push")(_hx_str) + while (Reflect.field(Reflect.field(q,"-object"),"contains")(_hx_str) == True): + Reflect.field(Reflect.field(q,"-object"),"remove")(_hx_str) + return + match = _hx_local_2 + _g = 0 + _g1 = len(token) + while (_g < _g1): + i = _g + _g = (_g + 1) + isOr.matchObj = python_lib_Re.search(isOr.pattern,(token[i] if i >= 0 and i < len(token) else None)) + if (isOr.matchObj is not None): + composeQuery() + else: + match((token[i] if i >= 0 and i < len(token) else None)) + _g = 0 + _g1 = len(ors) + while (_g < _g1): + i = _g + _g = (_g + 1) + _hx_or = (ors[i] if i >= 0 and i < len(ors) else None) + if (Reflect.field(_hx_or,"object") is not None): + self.include = (self.include + Reflect.field(_hx_or,"object")) + if (Reflect.field(_hx_or,"-object") is not None): + self.exclude = (self.exclude + Reflect.field(_hx_or,"-object")) + self.q = _hx_AnonObject({'_hx_or': ors, 'copy_all': copyAll}) + return self.q + + def test(self,property,value = None): + if (self.preset == property): + self.parse(value,True) + _g = 0 + _g1 = Reflect.field(Reflect.field(self.q,"or"),"length") + while (_g < _g1): + i = _g + _g = (_g + 1) + _hx_or = HxOverrides.arrayGet(Reflect.field(self.q,"or"), i) + conds = [0] + fails = [0] + _hx_pass = 0 + def _hx_local_7(fails,conds): + def _hx_local_0(expr): + _hx_local_1 = conds + _hx_local_2 = 0 + _hx_local_3 = (_hx_local_1[_hx_local_2] if _hx_local_2 >= 0 and _hx_local_2 < len(_hx_local_1) else None) + python_internal_ArrayImpl._set(_hx_local_1, _hx_local_2, (_hx_local_3 + 1)) + (_hx_local_1[_hx_local_2] if _hx_local_2 >= 0 and _hx_local_2 < len(_hx_local_1) else None) + _hx_local_4 = fails + _hx_local_5 = 0 + _hx_local_6 = (_hx_local_4[_hx_local_5] if _hx_local_5 >= 0 and _hx_local_5 < len(_hx_local_4) else None) + python_internal_ArrayImpl._set(_hx_local_4, _hx_local_5, (_hx_local_6 + (0 if expr else 1))) + (_hx_local_4[_hx_local_5] if _hx_local_5 >= 0 and _hx_local_5 < len(_hx_local_4) else None) + return expr + return _hx_local_0 + when = _hx_local_7(fails,conds) + _g2 = 0 + _g3 = python_Boot.fields(_hx_or) + while (_g2 < len(_g3)): + k = (_g3[_g2] if _g2 >= 0 and _g2 < len(_g3) else None) + _g2 = (_g2 + 1) + orval = Reflect.field(_hx_or,k) + if (k != property): + continue + if ((Reflect.field(orval,"=") is not None) and when(HxOverrides.eq(value,Reflect.field(orval,"=")))): + _hx_pass = (_hx_pass + 1) + if ((Reflect.field(orval,"*") is not None) and when((value is not None))): + _hx_pass = (_hx_pass + 1) + if ((Reflect.field(orval,">") is not None) and when((value > Std.parseInt(Reflect.field(orval,">"))))): + _hx_pass = (_hx_pass + 1) + if ((Reflect.field(orval,"<") is not None) and when((value < Std.parseInt(Reflect.field(orval,"<"))))): + _hx_pass = (_hx_pass + 1) + if ((Reflect.field(orval,">=") is not None) and when((value >= Std.parseInt(Reflect.field(orval,">="))))): + _hx_pass = (_hx_pass + 1) + if ((Reflect.field(orval,"<=") is not None) and when((value >= Std.parseInt(Reflect.field(orval,"<="))))): + _hx_pass = (_hx_pass + 1) + if ((Reflect.field(orval,"!=") is not None) and when((value != Std.parseInt(Reflect.field(orval,"!="))))): + _hx_pass = (_hx_pass + 1) + if ((self.accept and (((conds[0] if 0 < len(conds) else None) > 0))) and (((fails[0] if 0 < len(fails) else None) > 0))): + self.accept = False + if ((((conds[0] if 0 < len(conds) else None) > 0) and ((_hx_pass > 0))) and (((fails[0] if 0 < len(fails) else None) == 0))): + self.accept = True + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.str = None + _hx_o.q = None + _hx_o.include = None + _hx_o.exclude = None + _hx_o.accept = None + _hx_o.preset = None + +Math.NEGATIVE_INFINITY = float("-inf") +Math.POSITIVE_INFINITY = float("inf") +Math.NaN = float("nan") +Math.PI = python_lib_Math.pi + +haxe_SysTools.winMetaCharacters = [32, 40, 41, 37, 33, 94, 34, 60, 62, 38, 124, 10, 13, 44, 59] +StringTools.winMetaCharacters = haxe_SysTools.winMetaCharacters +Sys._programPath = sys_FileSystem.fullPath(python_lib_Inspect.getsourcefile(Sys)) +def _hx_init_haxe_io_FPHelper_i64tmp(): + def _hx_local_0(): + this1 = haxe__Int64____Int64(0,0) + return this1 + return _hx_local_0() +haxe_io_FPHelper.i64tmp = _hx_init_haxe_io_FPHelper_i64tmp() +haxe_io_FPHelper.LN2 = 0.6931471805599453 +python_Boot.keywords = set(["and", "del", "from", "not", "with", "as", "elif", "global", "or", "yield", "assert", "else", "if", "pass", "None", "break", "except", "import", "raise", "True", "class", "exec", "in", "return", "False", "continue", "finally", "is", "try", "def", "for", "lambda", "while"]) +python_Boot.prefixLength = len("_hx_") +python_Lib.lineEnd = ("\r\n" if ((Sys.systemName() == "Windows")) else "\n") \ No newline at end of file diff --git a/make b/make new file mode 100755 index 0000000..34f0de4 --- /dev/null +++ b/make @@ -0,0 +1,26 @@ +#!/bin/sh +set -e + +try(){ set +e; "$@" 2>/dev/null; set -e; } + +install(){ + which haxe || { + echo " 1. install haxe from haxe.org" + echo "[2.] download neko for cpp output" + echo "[3.] install mono openjdk14 for csharp + java output" + } + haxelib setup + haxelib install hxcpp + haxelib install hxjava + haxelib install hxcs + haxelib install hscript +} + +runtest(){ + set -x + which python3 && python3 test/generated/test.py | awk '{ print "py: "$0 } END{ print "\n"}' + which node && node test/generated/test.js | awk '{ print "js: "$0 } END{ print "\n"}' +} + +test -z $1 && { try rm dist/* ; haxe build.hxml; exit $?; } +test -z $1 || "$@" diff --git a/src/Test.hx b/src/Test.hx new file mode 100644 index 0000000..5eef002 --- /dev/null +++ b/src/Test.hx @@ -0,0 +1,118 @@ +import xrfragment.Query; + +class Test { + + static public function main():Void { + trace("starting tests"); + + var Query = xrfragment.Query; + + trace( (new Query("foo or bar")).toObject() ); + trace( (new Query("class:fopoer or bar foo:bar")).toObject().or[0] ); + trace( (new Query("-skybox class:foo")).toObject().or[0] ); + trace( (new Query("foo/flop moo or bar")).toObject().or[0] ); + trace( (new Query("-foo/flop moo or bar")).toObject().or[0] ); + trace( (new Query("price:>4 moo or bar")).toObject().or[0] ); + trace( (new Query("price:>=4 moo or bar")).toObject().or[0] ); + trace( (new Query("price:<=4 moo or bar")).toObject().or[0] ); + trace( (new Query("price:!=4 moo or bar")).toObject().or[0] ); + + var q:Dynamic = new Query("price:!=4 moo or bar"); + var obj:Dynamic = q.toObject(); + q.test( "price", 4); + var ok = !q.qualify("slkklskdf"); + if( !ok ) throw 'node should not be allowed'; + + q = new Query("price:!=3 moo or bar"); + var obj:Dynamic = q.toObject(); + q.test( "price", 4); + var ok = q.qualify("slkklskdf"); + if( !ok ) throw 'non-mentioned node should be allowed'; + + q = new Query("moo or bar"); + var obj:Dynamic = q.toObject(); + var ok = !q.qualify("slkklskdf"); + if( !ok ) throw 'node should not be allowed'; + obj = q.toObject(); + var ok = q.qualify("moo"); + if( !ok ) throw 'moo should be allowed'; + var ok = q.qualify("bar"); + if( !ok ) throw 'bar should be allowed'; + + q = new Query("price:>3 moo or bar"); + var obj:Dynamic = q.toObject(); + q.test( "price", 4); + var ok = q.qualify("foo"); + if( !ok ) throw 'node should be allowed'; + var ok = q.qualify("bar"); + if( !ok ) throw 'node should be allowed'; + var ok = q.qualify("moo"); + if( !ok ) throw 'node should be allowed'; + + q = new Query("price:>3 price:<10 -bar"); + var obj:Dynamic = q.toObject(); + q.test( "price", 4); + var ok = q.qualify("foo"); + if( !ok ) throw 'node should be allowed'; + var ok = !q.qualify("bar"); + if( !ok ) throw 'bar should not be allowed'; + q.test("price", 20); + var ok = !q.qualify("foo"); + if( !ok ) throw 'price 20 should not be allowed'; + + q = new Query("-bar"); + var obj:Dynamic = q.toObject(); + var ok = q.qualify("foo"); + if( !ok ) throw 'node should be allowed'; + var ok = !q.qualify("bar"); + if( !ok ) throw 'bar should not be allowed'; + + q = new Query("title:*"); + var obj:Dynamic = q.toObject(); + var ok = !q.qualify("foo"); + if( !ok ) throw 'node should not be allowed'; + q.test("foo","bar"); + var ok = !q.qualify("foo"); + if( !ok ) throw 'node should not be allowed'; + q.test("title","bar"); + var ok = q.qualify("foo"); + if( !ok ) throw 'node should be allowed'; + + q = new Query("-bar +bar"); + var obj:Dynamic = q.toObject(); + var ok = q.qualify("foo"); + if( !ok ) throw 'node should be allowed'; + var ok = q.qualify("bar"); + if( !ok ) throw 'bar should be allowed'; + + q = new Query("?discount"); + var obj:Dynamic = q.toObject(); + q.test("?discount","-foo"); + var ok = !q.qualify("foo"); + if( !ok ) throw 'foo should not be allowed'; + + q = new Query("?"); + q.test("?","-foo"); + var ok = !q.qualify("foo"); + if( !ok ) throw 'foo should not be allowed'; + + q = new Query("?"); + var ok = q.qualify("foo"); + if( !ok ) throw 'foo should not be allowed'; + + q = new Query("?discount"); + q.test("?discount","-foo"); + var ok = !q.qualify("foo"); + if( !ok ) throw 'foo should not be allowed'; + + q = new Query("?discount +foo"); + var obj:Dynamic = q.toObject(); + q.test("?discount","-foo"); + var ok = !q.qualify("foo"); + if( !ok ) throw 'foo should not be allowed'; + var ok = !q.qualify("foo"); + if( !ok ) throw 'foo should not be allowed'; + + trace("all tests passed"); + } +} diff --git a/src/xrfragment/Query.hx b/src/xrfragment/Query.hx new file mode 100644 index 0000000..a72eb54 --- /dev/null +++ b/src/xrfragment/Query.hx @@ -0,0 +1,175 @@ +package xrfragment; + +@:expose // <- makes the class reachable from plain JavaScript +@:keep // <- avoids accidental removal by dead code elimination + +#if js + var ok:Bool = js.Syntax.code(' + // haxe workarounds + + Array.prototype.contains = Array.prototype.includes + + if (typeof Array.prototype.remove !== "function") { + Array.prototype.remove = function (item) { + const oldLength = this.length + let newLength = 0 + + for (let i = 0; i < oldLength; i++) { + const entry = this[i] + if (entry === item) { + let newLength = i++ + + while (i !== this.length) { + const entry = this[i] + if (entry !== item) this[newLength++] = entry + i++ + } + + this.length = newLength + for (let i = newLength; i < oldLength; i++) delete this[i] + return true + } + } + return false + } + } + '); +#end + +class Query { + + private var str:String = ""; + private var q:Dynamic = {}; + private var include:Array = new Array(); + private var exclude:Array = new Array(); + private var accept:Bool = false; + private var preset:String = ""; + + public function new(str:String){ + if( str != null ) this.parse(str); + } + + public function toObject() : Dynamic { + return this.q; + } + + public function qualify( nodename:String ): Bool { + if( this.q.copy_all ) this.accept = true; + if( this.include.contains(nodename) ) this.accept = true; + if( this.exclude.contains(nodename) ) this.accept = false; + return this.accept; + } + + public function parse(str:String,recurse:Bool = false) : Dynamic { + + var copyAll:Bool = recurse ? this.q.copy_all : str.substr(0,1) == "-" || str.substr(0,1) == "?" || str == ""; + var isOr:EReg = ~/^or$/; + var isProp:EReg = ~/.*:[><=!]?/; + var isName:EReg = ~/[^:\/]/; + var isExclude:EReg = ~/^-/; + var isInclude:EReg = ~/^\+/; + var isPreset:EReg = ~/^\?/; + + var token = str.split(" "); + var ors = new Array(); + var q:haxe.DynamicAccess = {}; + + function composeQuery() : Dynamic { + q = {}; + q.set("object", new Array() ); + q.set("-object", new Array() ); + ors.push(q); + return q; + } + composeQuery(); + + function match(str,prefix = ""){ + if( isPreset.match(str) && !recurse ){ + this.preset = str; + return; + } + if( isExclude.match(str) || isInclude.match(str) ){ + var t = str.substr(1); + match(t, str.substr(0,1) ); + return; + } + if( isProp.match(str) ){ + var skip = 0; + var type = "="; + if( str.indexOf("*") != -1 ) type = "*"; + if( str.indexOf(">") != -1 ) type = ">"; + if( str.indexOf("<") != -1 ) type = "<"; + if( str.indexOf("!=") != -1 ) type = "!="; + if( str.indexOf(">=") != -1 ) type = ">="; + if( str.indexOf("<=") != -1 ) type = "<="; + if( type != "=" ) skip += type.length; + var property = str.split(":")[0]; + var value:haxe.DynamicAccess; + if( q.get(prefix+property) ) value = q.get(prefix+property); + else value = {}; + value[ type ] = str.split(":")[1].substr(skip); + q.set(prefix+property,value); + return; + } + if( isName.match(str) ){ + if( prefix == '-' ){ + q["-object"].push(str); + while( q["object"].contains(str) == true) { + q["object"].remove(str); + } + }else{ + q["object"].push(str); + while( q["-object"].contains(str) == true ){ + q["-object"].remove(str); + } + } + return; + } + } + + for( i in 0...token.length ) { + if( isOr.match(token[i]) ){ + composeQuery(); + }else match(token[i]); + } + for ( i in 0...ors.length ) { + var or:Dynamic = ors[i]; + if( Reflect.field(or,'object') != null ) this.include = this.include.concat( Reflect.field(or,'object') ); + if( Reflect.field(or,'-object') != null ) this.exclude = this.exclude.concat( Reflect.field(or,'-object') ); + } + this.q = { or: ors, copy_all: copyAll }; + return this.q; + } + + public function test( property:String, ?value:Dynamic ):Void{ + if( this.preset == property ){ + this.parse( value, true ); + } + for ( i in 0...this.q.or.length ) { + var or:Dynamic = this.q.or[i]; + var conds:Int = 0; + var fails:Int = 0; + var pass:Int = 0; + + var when = function(expr:Bool) : Bool { + conds+=1; + fails+= expr ? 0 : 1; + return expr; + } + + for ( k in Reflect.fields(or) ){ + var orval:Dynamic = Reflect.field(or,k); + if( k != property ) continue; + if( Reflect.field(orval,'=') != null && when( value == Reflect.field(orval,'=') ) ) pass += 1; + if( Reflect.field(orval,'*') != null && when( value != null ) ) pass += 1; + if( Reflect.field(orval,'>') != null && when( value > Std.parseInt(Reflect.field(orval,'>' )) ) ) pass += 1; + if( Reflect.field(orval,'<') != null && when( value < Std.parseInt(Reflect.field(orval,'<' )) ) ) pass += 1; + if( Reflect.field(orval,'>=') != null && when( value >= Std.parseInt(Reflect.field(orval,'>=')) ) ) pass += 1; + if( Reflect.field(orval,'<=') != null && when( value >= Std.parseInt(Reflect.field(orval,'<=')) ) ) pass += 1; + if( Reflect.field(orval,'!=') != null && when( value != Std.parseInt(Reflect.field(orval,'!=')) ) ) pass += 1; + } + if( this.accept && conds > 0 && fails > 0 ) this.accept = false; + if( conds > 0 && pass > 0 && fails == 0 ) this.accept = true; + } + } +} diff --git a/test/generated/test.js b/test/generated/test.js new file mode 100644 index 0000000..ed6724e --- /dev/null +++ b/test/generated/test.js @@ -0,0 +1,2432 @@ +var $hx_exports = typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this; +(function ($global) { "use strict"; +$hx_exports["xrfragment"] = $hx_exports["xrfragment"] || {}; +$hx_exports["xrfragment"]["Query"] = $hx_exports["xrfragment"]["Query"] || {}; +var $hxClasses = {},$hxEnums = $hxEnums || {},$_; +function $extend(from, fields) { + var proto = Object.create(from); + for (var name in fields) proto[name] = fields[name]; + if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; + return proto; +} +var EReg = function(r,opt) { + this.r = new RegExp(r,opt.split("u").join("")); +}; +$hxClasses["EReg"] = EReg; +EReg.__name__ = "EReg"; +EReg.escape = function(s) { + return s.replace(EReg.escapeRe,"\\$&"); +}; +EReg.prototype = { + r: null + ,match: function(s) { + if(this.r.global) { + this.r.lastIndex = 0; + } + this.r.m = this.r.exec(s); + this.r.s = s; + return this.r.m != null; + } + ,matched: function(n) { + if(this.r.m != null && n >= 0 && n < this.r.m.length) { + return this.r.m[n]; + } else { + throw haxe_Exception.thrown("EReg::matched"); + } + } + ,matchedLeft: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return HxOverrides.substr(this.r.s,0,this.r.m.index); + } + ,matchedRight: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + var sz = this.r.m.index + this.r.m[0].length; + return HxOverrides.substr(this.r.s,sz,this.r.s.length - sz); + } + ,matchedPos: function() { + if(this.r.m == null) { + throw haxe_Exception.thrown("No string matched"); + } + return { pos : this.r.m.index, len : this.r.m[0].length}; + } + ,matchSub: function(s,pos,len) { + if(len == null) { + len = -1; + } + if(this.r.global) { + this.r.lastIndex = pos; + this.r.m = this.r.exec(len < 0 ? s : HxOverrides.substr(s,0,pos + len)); + var b = this.r.m != null; + if(b) { + this.r.s = s; + } + return b; + } else { + var b = this.match(len < 0 ? HxOverrides.substr(s,pos,null) : HxOverrides.substr(s,pos,len)); + if(b) { + this.r.s = s; + this.r.m.index += pos; + } + return b; + } + } + ,split: function(s) { + var d = "#__delim__#"; + return s.replace(this.r,d).split(d); + } + ,replace: function(s,by) { + return s.replace(this.r,by); + } + ,map: function(s,f) { + var offset = 0; + var buf_b = ""; + while(true) { + if(offset >= s.length) { + break; + } else if(!this.matchSub(s,offset)) { + buf_b += Std.string(HxOverrides.substr(s,offset,null)); + break; + } + var p = this.matchedPos(); + buf_b += Std.string(HxOverrides.substr(s,offset,p.pos - offset)); + buf_b += Std.string(f(this)); + if(p.len == 0) { + buf_b += Std.string(HxOverrides.substr(s,p.pos,1)); + offset = p.pos + 1; + } else { + offset = p.pos + p.len; + } + if(!this.r.global) { + break; + } + } + if(!this.r.global && offset > 0 && offset < s.length) { + buf_b += Std.string(HxOverrides.substr(s,offset,null)); + } + return buf_b; + } + ,__class__: EReg +}; +var EnumValue = {}; +EnumValue.match = function(this1,pattern) { + return false; +}; +var HxOverrides = function() { }; +$hxClasses["HxOverrides"] = HxOverrides; +HxOverrides.__name__ = "HxOverrides"; +HxOverrides.dateStr = function(date) { + var m = date.getMonth() + 1; + var d = date.getDate(); + var h = date.getHours(); + var mi = date.getMinutes(); + var s = date.getSeconds(); + return date.getFullYear() + "-" + (m < 10 ? "0" + m : "" + m) + "-" + (d < 10 ? "0" + d : "" + d) + " " + (h < 10 ? "0" + h : "" + h) + ":" + (mi < 10 ? "0" + mi : "" + mi) + ":" + (s < 10 ? "0" + s : "" + s); +}; +HxOverrides.strDate = function(s) { + switch(s.length) { + case 8: + var k = s.split(":"); + var d = new Date(); + d["setTime"](0); + d["setUTCHours"](k[0]); + d["setUTCMinutes"](k[1]); + d["setUTCSeconds"](k[2]); + return d; + case 10: + var k = s.split("-"); + return new Date(k[0],k[1] - 1,k[2],0,0,0); + case 19: + var k = s.split(" "); + var y = k[0].split("-"); + var t = k[1].split(":"); + return new Date(y[0],y[1] - 1,y[2],t[0],t[1],t[2]); + default: + throw haxe_Exception.thrown("Invalid date format : " + s); + } +}; +HxOverrides.cca = function(s,index) { + var x = s.charCodeAt(index); + if(x != x) { + return undefined; + } + return x; +}; +HxOverrides.substr = function(s,pos,len) { + if(len == null) { + len = s.length; + } else if(len < 0) { + if(pos == 0) { + len = s.length + len; + } else { + return ""; + } + } + return s.substr(pos,len); +}; +HxOverrides.indexOf = function(a,obj,i) { + var len = a.length; + if(i < 0) { + i += len; + if(i < 0) { + i = 0; + } + } + while(i < len) { + if(((a[i]) === obj)) { + return i; + } + ++i; + } + return -1; +}; +HxOverrides.lastIndexOf = function(a,obj,i) { + var len = a.length; + if(i >= len) { + i = len - 1; + } else if(i < 0) { + i += len; + } + while(i >= 0) { + if(((a[i]) === obj)) { + return i; + } + --i; + } + return -1; +}; +HxOverrides.remove = function(a,obj) { + var i = a.indexOf(obj); + if(i == -1) { + return false; + } + a.splice(i,1); + return true; +}; +HxOverrides.iter = function(a) { + return { cur : 0, arr : a, hasNext : function() { + return this.cur < this.arr.length; + }, next : function() { + return this.arr[this.cur++]; + }}; +}; +HxOverrides.keyValueIter = function(a) { + return new haxe_iterators_ArrayKeyValueIterator(a); +}; +HxOverrides.now = function() { + return Date.now(); +}; +var IntIterator = function(min,max) { + this.min = min; + this.max = max; +}; +$hxClasses["IntIterator"] = IntIterator; +IntIterator.__name__ = "IntIterator"; +IntIterator.prototype = { + min: null + ,max: null + ,hasNext: function() { + return this.min < this.max; + } + ,next: function() { + return this.min++; + } + ,__class__: IntIterator +}; +Math.__name__ = "Math"; +var Reflect = function() { }; +$hxClasses["Reflect"] = Reflect; +Reflect.__name__ = "Reflect"; +Reflect.hasField = function(o,field) { + return Object.prototype.hasOwnProperty.call(o,field); +}; +Reflect.field = function(o,field) { + try { + return o[field]; + } catch( _g ) { + haxe_NativeStackTrace.lastError = _g; + return null; + } +}; +Reflect.setField = function(o,field,value) { + o[field] = value; +}; +Reflect.getProperty = function(o,field) { + var tmp; + if(o == null) { + return null; + } else { + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["get_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + return o[tmp](); + } else { + return o[field]; + } + } +}; +Reflect.setProperty = function(o,field,value) { + var tmp; + var tmp1; + if(o.__properties__) { + tmp = o.__properties__["set_" + field]; + tmp1 = tmp; + } else { + tmp1 = false; + } + if(tmp1) { + o[tmp](value); + } else { + o[field] = value; + } +}; +Reflect.callMethod = function(o,func,args) { + return func.apply(o,args); +}; +Reflect.fields = function(o) { + var a = []; + if(o != null) { + var hasOwnProperty = Object.prototype.hasOwnProperty; + for( var f in o ) { + if(f != "__id__" && f != "hx__closures__" && hasOwnProperty.call(o,f)) { + a.push(f); + } + } + } + return a; +}; +Reflect.isFunction = function(f) { + if(typeof(f) == "function") { + return !(f.__name__ || f.__ename__); + } else { + return false; + } +}; +Reflect.compare = function(a,b) { + if(a == b) { + return 0; + } else if(a > b) { + return 1; + } else { + return -1; + } +}; +Reflect.compareMethods = function(f1,f2) { + if(f1 == f2) { + return true; + } + if(!Reflect.isFunction(f1) || !Reflect.isFunction(f2)) { + return false; + } + if(f1.scope == f2.scope && f1.method == f2.method) { + return f1.method != null; + } else { + return false; + } +}; +Reflect.isObject = function(v) { + if(v == null) { + return false; + } + var t = typeof(v); + if(!(t == "string" || t == "object" && v.__enum__ == null)) { + if(t == "function") { + return (v.__name__ || v.__ename__) != null; + } else { + return false; + } + } else { + return true; + } +}; +Reflect.isEnumValue = function(v) { + if(v != null) { + return v.__enum__ != null; + } else { + return false; + } +}; +Reflect.deleteField = function(o,field) { + if(!Object.prototype.hasOwnProperty.call(o,field)) { + return false; + } + delete(o[field]); + return true; +}; +Reflect.copy = function(o) { + if(o == null) { + return null; + } + var o2 = { }; + var _g = 0; + var _g1 = Reflect.fields(o); + while(_g < _g1.length) { + var f = _g1[_g]; + ++_g; + o2[f] = Reflect.field(o,f); + } + return o2; +}; +Reflect.makeVarArgs = function(f) { + return function() { + var a = Array.prototype.slice; + var a1 = arguments; + var a2 = a.call(a1); + return f(a2); + }; +}; +var Std = function() { }; +$hxClasses["Std"] = Std; +Std.__name__ = "Std"; +Std.is = function(v,t) { + return js_Boot.__instanceof(v,t); +}; +Std.isOfType = function(v,t) { + return js_Boot.__instanceof(v,t); +}; +Std.downcast = function(value,c) { + if(js_Boot.__downcastCheck(value,c)) { + return value; + } else { + return null; + } +}; +Std.instance = function(value,c) { + if(js_Boot.__downcastCheck(value,c)) { + return value; + } else { + return null; + } +}; +Std.string = function(s) { + return js_Boot.__string_rec(s,""); +}; +Std.int = function(x) { + return x | 0; +}; +Std.parseInt = function(x) { + if(x != null) { + var _g = 0; + var _g1 = x.length; + while(_g < _g1) { + var i = _g++; + var c = x.charCodeAt(i); + if(c <= 8 || c >= 14 && c != 32 && c != 45) { + var nc = x.charCodeAt(i + 1); + var v = parseInt(x,nc == 120 || nc == 88 ? 16 : 10); + if(isNaN(v)) { + return null; + } else { + return v; + } + } + } + } + return null; +}; +Std.parseFloat = function(x) { + return parseFloat(x); +}; +Std.random = function(x) { + if(x <= 0) { + return 0; + } else { + return Math.floor(Math.random() * x); + } +}; +var StringBuf = function() { + this.b = ""; +}; +$hxClasses["StringBuf"] = StringBuf; +StringBuf.__name__ = "StringBuf"; +StringBuf.prototype = { + b: null + ,get_length: function() { + return this.b.length; + } + ,add: function(x) { + this.b += Std.string(x); + } + ,addChar: function(c) { + this.b += String.fromCodePoint(c); + } + ,addSub: function(s,pos,len) { + this.b += len == null ? HxOverrides.substr(s,pos,null) : HxOverrides.substr(s,pos,len); + } + ,toString: function() { + return this.b; + } + ,__class__: StringBuf + ,__properties__: {get_length:"get_length"} +}; +var haxe_SysTools = function() { }; +$hxClasses["haxe.SysTools"] = haxe_SysTools; +haxe_SysTools.__name__ = "haxe.SysTools"; +haxe_SysTools.quoteUnixArg = function(argument) { + if(argument == "") { + return "''"; + } + if(!new EReg("[^a-zA-Z0-9_@%+=:,./-]","").match(argument)) { + return argument; + } + return "'" + StringTools.replace(argument,"'","'\"'\"'") + "'"; +}; +haxe_SysTools.quoteWinArg = function(argument,escapeMetaCharacters) { + if(!new EReg("^[^ \t\\\\\"]+$","").match(argument)) { + var result_b = ""; + var needquote = argument.indexOf(" ") != -1 || argument.indexOf("\t") != -1 || argument == ""; + if(needquote) { + result_b += "\""; + } + var bs_buf = new StringBuf(); + var _g = 0; + var _g1 = argument.length; + while(_g < _g1) { + var i = _g++; + var _g2 = HxOverrides.cca(argument,i); + if(_g2 == null) { + var c = _g2; + if(bs_buf.b.length > 0) { + result_b += Std.string(bs_buf.b); + bs_buf = new StringBuf(); + } + result_b += String.fromCodePoint(c); + } else { + switch(_g2) { + case 34: + var bs = bs_buf.b; + result_b += bs == null ? "null" : "" + bs; + result_b += bs == null ? "null" : "" + bs; + bs_buf = new StringBuf(); + result_b += "\\\""; + break; + case 92: + bs_buf.b += "\\"; + break; + default: + var c1 = _g2; + if(bs_buf.b.length > 0) { + result_b += Std.string(bs_buf.b); + bs_buf = new StringBuf(); + } + result_b += String.fromCodePoint(c1); + } + } + } + result_b += Std.string(bs_buf.b); + if(needquote) { + result_b += Std.string(bs_buf.b); + result_b += "\""; + } + argument = result_b; + } + if(escapeMetaCharacters) { + var result_b = ""; + var _g = 0; + var _g1 = argument.length; + while(_g < _g1) { + var i = _g++; + var c = HxOverrides.cca(argument,i); + if(haxe_SysTools.winMetaCharacters.indexOf(c) >= 0) { + result_b += String.fromCodePoint(94); + } + result_b += String.fromCodePoint(c); + } + return result_b; + } else { + return argument; + } +}; +var StringTools = function() { }; +$hxClasses["StringTools"] = StringTools; +StringTools.__name__ = "StringTools"; +StringTools.urlEncode = function(s) { + return encodeURIComponent(s); +}; +StringTools.urlDecode = function(s) { + return decodeURIComponent(s.split("+").join(" ")); +}; +StringTools.htmlEscape = function(s,quotes) { + var buf_b = ""; + var _g_offset = 0; + var _g_s = s; + while(_g_offset < _g_s.length) { + var s = _g_s; + var index = _g_offset++; + var c = s.charCodeAt(index); + if(c >= 55296 && c <= 56319) { + c = c - 55232 << 10 | s.charCodeAt(index + 1) & 1023; + } + var c1 = c; + if(c1 >= 65536) { + ++_g_offset; + } + var code = c1; + switch(code) { + case 34: + if(quotes) { + buf_b += """; + } else { + buf_b += String.fromCodePoint(code); + } + break; + case 38: + buf_b += "&"; + break; + case 39: + if(quotes) { + buf_b += "'"; + } else { + buf_b += String.fromCodePoint(code); + } + break; + case 60: + buf_b += "<"; + break; + case 62: + buf_b += ">"; + break; + default: + buf_b += String.fromCodePoint(code); + } + } + return buf_b; +}; +StringTools.htmlUnescape = function(s) { + return s.split(">").join(">").split("<").join("<").split(""").join("\"").split("'").join("'").split("&").join("&"); +}; +StringTools.contains = function(s,value) { + return s.indexOf(value) != -1; +}; +StringTools.startsWith = function(s,start) { + if(s.length >= start.length) { + return s.lastIndexOf(start,0) == 0; + } else { + return false; + } +}; +StringTools.endsWith = function(s,end) { + var elen = end.length; + var slen = s.length; + if(slen >= elen) { + return s.indexOf(end,slen - elen) == slen - elen; + } else { + return false; + } +}; +StringTools.isSpace = function(s,pos) { + var c = HxOverrides.cca(s,pos); + if(!(c > 8 && c < 14)) { + return c == 32; + } else { + return true; + } +}; +StringTools.ltrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,r)) ++r; + if(r > 0) { + return HxOverrides.substr(s,r,l - r); + } else { + return s; + } +}; +StringTools.rtrim = function(s) { + var l = s.length; + var r = 0; + while(r < l && StringTools.isSpace(s,l - r - 1)) ++r; + if(r > 0) { + return HxOverrides.substr(s,0,l - r); + } else { + return s; + } +}; +StringTools.trim = function(s) { + return StringTools.ltrim(StringTools.rtrim(s)); +}; +StringTools.lpad = function(s,c,l) { + if(c.length <= 0) { + return s; + } + var buf_b = ""; + l -= s.length; + while(buf_b.length < l) buf_b += c == null ? "null" : "" + c; + buf_b += s == null ? "null" : "" + s; + return buf_b; +}; +StringTools.rpad = function(s,c,l) { + if(c.length <= 0) { + return s; + } + var buf_b = ""; + buf_b += s == null ? "null" : "" + s; + while(buf_b.length < l) buf_b += c == null ? "null" : "" + c; + return buf_b; +}; +StringTools.replace = function(s,sub,by) { + return s.split(sub).join(by); +}; +StringTools.hex = function(n,digits) { + var s = ""; + var hexChars = "0123456789ABCDEF"; + while(true) { + s = hexChars.charAt(n & 15) + s; + n >>>= 4; + if(!(n > 0)) { + break; + } + } + if(digits != null) { + while(s.length < digits) s = "0" + s; + } + return s; +}; +StringTools.fastCodeAt = function(s,index) { + return s.charCodeAt(index); +}; +StringTools.unsafeCodeAt = function(s,index) { + return s.charCodeAt(index); +}; +StringTools.iterator = function(s) { + return new haxe_iterators_StringIterator(s); +}; +StringTools.keyValueIterator = function(s) { + return new haxe_iterators_StringKeyValueIterator(s); +}; +StringTools.isEof = function(c) { + return c != c; +}; +StringTools.quoteUnixArg = function(argument) { + if(argument == "") { + return "''"; + } else if(!new EReg("[^a-zA-Z0-9_@%+=:,./-]","").match(argument)) { + return argument; + } else { + return "'" + StringTools.replace(argument,"'","'\"'\"'") + "'"; + } +}; +StringTools.quoteWinArg = function(argument,escapeMetaCharacters) { + var argument1 = argument; + if(!new EReg("^[^ \t\\\\\"]+$","").match(argument1)) { + var result_b = ""; + var needquote = argument1.indexOf(" ") != -1 || argument1.indexOf("\t") != -1 || argument1 == ""; + if(needquote) { + result_b += "\""; + } + var bs_buf = new StringBuf(); + var _g = 0; + var _g1 = argument1.length; + while(_g < _g1) { + var i = _g++; + var _g2 = HxOverrides.cca(argument1,i); + if(_g2 == null) { + var c = _g2; + if(bs_buf.b.length > 0) { + result_b += Std.string(bs_buf.b); + bs_buf = new StringBuf(); + } + result_b += String.fromCodePoint(c); + } else { + switch(_g2) { + case 34: + var bs = bs_buf.b; + result_b += Std.string(bs); + result_b += Std.string(bs); + bs_buf = new StringBuf(); + result_b += "\\\""; + break; + case 92: + bs_buf.b += "\\"; + break; + default: + var c1 = _g2; + if(bs_buf.b.length > 0) { + result_b += Std.string(bs_buf.b); + bs_buf = new StringBuf(); + } + result_b += String.fromCodePoint(c1); + } + } + } + result_b += Std.string(bs_buf.b); + if(needquote) { + result_b += Std.string(bs_buf.b); + result_b += "\""; + } + argument1 = result_b; + } + if(escapeMetaCharacters) { + var result_b = ""; + var _g = 0; + var _g1 = argument1.length; + while(_g < _g1) { + var i = _g++; + var c = HxOverrides.cca(argument1,i); + if(haxe_SysTools.winMetaCharacters.indexOf(c) >= 0) { + result_b += String.fromCodePoint(94); + } + result_b += String.fromCodePoint(c); + } + return result_b; + } else { + return argument1; + } +}; +StringTools.utf16CodePointAt = function(s,index) { + var c = s.charCodeAt(index); + if(c >= 55296 && c <= 56319) { + c = c - 55232 << 10 | s.charCodeAt(index + 1) & 1023; + } + return c; +}; +var Test = function() { }; +$hxClasses["Test"] = Test; +Test.__name__ = "Test"; +Test.main = function() { + haxe_Log.trace("starting tests",{ fileName : "src/Test.hx", lineNumber : 6, className : "Test", methodName : "main"}); + var Query = xrfragment_Query; + haxe_Log.trace(new xrfragment_Query("foo or bar").toObject(),{ fileName : "src/Test.hx", lineNumber : 10, className : "Test", methodName : "main"}); + haxe_Log.trace(new xrfragment_Query("class:fopoer or bar foo:bar").toObject().or[0],{ fileName : "src/Test.hx", lineNumber : 11, className : "Test", methodName : "main"}); + haxe_Log.trace(new xrfragment_Query("-skybox class:foo").toObject().or[0],{ fileName : "src/Test.hx", lineNumber : 12, className : "Test", methodName : "main"}); + haxe_Log.trace(new xrfragment_Query("foo/flop moo or bar").toObject().or[0],{ fileName : "src/Test.hx", lineNumber : 13, className : "Test", methodName : "main"}); + haxe_Log.trace(new xrfragment_Query("-foo/flop moo or bar").toObject().or[0],{ fileName : "src/Test.hx", lineNumber : 14, className : "Test", methodName : "main"}); + haxe_Log.trace(new xrfragment_Query("price:>4 moo or bar").toObject().or[0],{ fileName : "src/Test.hx", lineNumber : 15, className : "Test", methodName : "main"}); + haxe_Log.trace(new xrfragment_Query("price:>=4 moo or bar").toObject().or[0],{ fileName : "src/Test.hx", lineNumber : 16, className : "Test", methodName : "main"}); + haxe_Log.trace(new xrfragment_Query("price:<=4 moo or bar").toObject().or[0],{ fileName : "src/Test.hx", lineNumber : 17, className : "Test", methodName : "main"}); + haxe_Log.trace(new xrfragment_Query("price:!=4 moo or bar").toObject().or[0],{ fileName : "src/Test.hx", lineNumber : 18, className : "Test", methodName : "main"}); + var q = new xrfragment_Query("price:!=4 moo or bar"); + var obj = q.toObject(); + q.test("price",4); + var ok = !q.qualify("slkklskdf"); + if(!ok) { + throw haxe_Exception.thrown("node should not be allowed"); + } + q = new xrfragment_Query("price:!=3 moo or bar"); + var obj = q.toObject(); + q.test("price",4); + var ok = q.qualify("slkklskdf"); + if(!ok) { + throw haxe_Exception.thrown("non-mentioned node should be allowed"); + } + q = new xrfragment_Query("moo or bar"); + var obj = q.toObject(); + var ok = !q.qualify("slkklskdf"); + if(!ok) { + throw haxe_Exception.thrown("node should not be allowed"); + } + obj = q.toObject(); + var ok = q.qualify("moo"); + if(!ok) { + throw haxe_Exception.thrown("moo should be allowed"); + } + var ok = q.qualify("bar"); + if(!ok) { + throw haxe_Exception.thrown("bar should be allowed"); + } + q = new xrfragment_Query("price:>3 moo or bar"); + var obj = q.toObject(); + q.test("price",4); + var ok = q.qualify("foo"); + if(!ok) { + throw haxe_Exception.thrown("node should be allowed"); + } + var ok = q.qualify("bar"); + if(!ok) { + throw haxe_Exception.thrown("node should be allowed"); + } + var ok = q.qualify("moo"); + if(!ok) { + throw haxe_Exception.thrown("node should be allowed"); + } + q = new xrfragment_Query("price:>3 price:<10 -bar"); + var obj = q.toObject(); + q.test("price",4); + var ok = q.qualify("foo"); + if(!ok) { + throw haxe_Exception.thrown("node should be allowed"); + } + var ok = !q.qualify("bar"); + if(!ok) { + throw haxe_Exception.thrown("bar should not be allowed"); + } + q.test("price",20); + var ok = !q.qualify("foo"); + if(!ok) { + throw haxe_Exception.thrown("price 20 should not be allowed"); + } + q = new xrfragment_Query("-bar"); + var obj = q.toObject(); + var ok = q.qualify("foo"); + if(!ok) { + throw haxe_Exception.thrown("node should be allowed"); + } + var ok = !q.qualify("bar"); + if(!ok) { + throw haxe_Exception.thrown("bar should not be allowed"); + } + q = new xrfragment_Query("title:*"); + var obj = q.toObject(); + var ok = !q.qualify("foo"); + if(!ok) { + throw haxe_Exception.thrown("node should not be allowed"); + } + q.test("foo","bar"); + var ok = !q.qualify("foo"); + if(!ok) { + throw haxe_Exception.thrown("node should not be allowed"); + } + q.test("title","bar"); + var ok = q.qualify("foo"); + if(!ok) { + throw haxe_Exception.thrown("node should be allowed"); + } + q = new xrfragment_Query("-bar +bar"); + var obj = q.toObject(); + var ok = q.qualify("foo"); + if(!ok) { + throw haxe_Exception.thrown("node should be allowed"); + } + var ok = q.qualify("bar"); + if(!ok) { + throw haxe_Exception.thrown("bar should be allowed"); + } + q = new xrfragment_Query("?discount"); + var obj = q.toObject(); + q.test("?discount","-foo"); + var ok = !q.qualify("foo"); + if(!ok) { + throw haxe_Exception.thrown("foo should not be allowed"); + } + q = new xrfragment_Query("?"); + q.test("?","-foo"); + var ok = !q.qualify("foo"); + if(!ok) { + throw haxe_Exception.thrown("foo should not be allowed"); + } + q = new xrfragment_Query("?"); + var ok = q.qualify("foo"); + if(!ok) { + throw haxe_Exception.thrown("foo should not be allowed"); + } + q = new xrfragment_Query("?discount"); + q.test("?discount","-foo"); + var ok = !q.qualify("foo"); + if(!ok) { + throw haxe_Exception.thrown("foo should not be allowed"); + } + q = new xrfragment_Query("?discount +foo"); + var obj = q.toObject(); + q.test("?discount","-foo"); + var ok = !q.qualify("foo"); + if(!ok) { + throw haxe_Exception.thrown("foo should not be allowed"); + } + var ok = !q.qualify("foo"); + if(!ok) { + throw haxe_Exception.thrown("foo should not be allowed"); + } + haxe_Log.trace("all tests passed",{ fileName : "src/Test.hx", lineNumber : 116, className : "Test", methodName : "main"}); +}; +var ValueType = $hxEnums["ValueType"] = { __ename__:"ValueType",__constructs__:null + ,TNull: {_hx_name:"TNull",_hx_index:0,__enum__:"ValueType"} + ,TInt: {_hx_name:"TInt",_hx_index:1,__enum__:"ValueType"} + ,TFloat: {_hx_name:"TFloat",_hx_index:2,__enum__:"ValueType"} + ,TBool: {_hx_name:"TBool",_hx_index:3,__enum__:"ValueType"} + ,TObject: {_hx_name:"TObject",_hx_index:4,__enum__:"ValueType"} + ,TFunction: {_hx_name:"TFunction",_hx_index:5,__enum__:"ValueType"} + ,TClass: ($_=function(c) { return {_hx_index:6,c:c,__enum__:"ValueType"}; },$_._hx_name="TClass",$_.__params__ = ["c"],$_) + ,TEnum: ($_=function(e) { return {_hx_index:7,e:e,__enum__:"ValueType"}; },$_._hx_name="TEnum",$_.__params__ = ["e"],$_) + ,TUnknown: {_hx_name:"TUnknown",_hx_index:8,__enum__:"ValueType"} +}; +ValueType.__constructs__ = [ValueType.TNull,ValueType.TInt,ValueType.TFloat,ValueType.TBool,ValueType.TObject,ValueType.TFunction,ValueType.TClass,ValueType.TEnum,ValueType.TUnknown]; +ValueType.__empty_constructs__ = [ValueType.TNull,ValueType.TInt,ValueType.TFloat,ValueType.TBool,ValueType.TObject,ValueType.TFunction,ValueType.TUnknown]; +var Type = function() { }; +$hxClasses["Type"] = Type; +Type.__name__ = "Type"; +Type.getClass = function(o) { + return js_Boot.getClass(o); +}; +Type.getEnum = function(o) { + if(o == null) { + return null; + } + return $hxEnums[o.__enum__]; +}; +Type.getSuperClass = function(c) { + return c.__super__; +}; +Type.getClassName = function(c) { + return c.__name__; +}; +Type.getEnumName = function(e) { + return e.__ename__; +}; +Type.resolveClass = function(name) { + return $hxClasses[name]; +}; +Type.resolveEnum = function(name) { + return $hxEnums[name]; +}; +Type.createInstance = function(cl,args) { + var ctor = Function.prototype.bind.apply(cl,[null].concat(args)); + return new (ctor); +}; +Type.createEmptyInstance = function(cl) { + return Object.create(cl.prototype); +}; +Type.createEnum = function(e,constr,params) { + var f = Reflect.field(e,constr); + if(f == null) { + throw haxe_Exception.thrown("No such constructor " + constr); + } + if(Reflect.isFunction(f)) { + if(params == null) { + throw haxe_Exception.thrown("Constructor " + constr + " need parameters"); + } + return f.apply(e,params); + } + if(params != null && params.length != 0) { + throw haxe_Exception.thrown("Constructor " + constr + " does not need parameters"); + } + return f; +}; +Type.createEnumIndex = function(e,index,params) { + var c; + var _g = e.__constructs__[index]; + if(_g == null) { + c = null; + } else { + var ctor = _g; + c = ctor._hx_name; + } + if(c == null) { + throw haxe_Exception.thrown(index + " is not a valid enum constructor index"); + } + return Type.createEnum(e,c,params); +}; +Type.getInstanceFields = function(c) { + var a = []; + for(var i in c.prototype) a.push(i); + HxOverrides.remove(a,"__class__"); + HxOverrides.remove(a,"__properties__"); + return a; +}; +Type.getClassFields = function(c) { + var a = Reflect.fields(c); + HxOverrides.remove(a,"__name__"); + HxOverrides.remove(a,"__interfaces__"); + HxOverrides.remove(a,"__properties__"); + HxOverrides.remove(a,"__super__"); + HxOverrides.remove(a,"__meta__"); + HxOverrides.remove(a,"prototype"); + return a; +}; +Type.getEnumConstructs = function(e) { + var _this = e.__constructs__; + var result = new Array(_this.length); + var _g = 0; + var _g1 = _this.length; + while(_g < _g1) { + var i = _g++; + result[i] = _this[i]._hx_name; + } + return result; +}; +Type.typeof = function(v) { + switch(typeof(v)) { + case "boolean": + return ValueType.TBool; + case "function": + if(v.__name__ || v.__ename__) { + return ValueType.TObject; + } + return ValueType.TFunction; + case "number": + if(Math.ceil(v) == v % 2147483648.0) { + return ValueType.TInt; + } + return ValueType.TFloat; + case "object": + if(v == null) { + return ValueType.TNull; + } + var e = v.__enum__; + if(e != null) { + return ValueType.TEnum($hxEnums[e]); + } + var c = js_Boot.getClass(v); + if(c != null) { + return ValueType.TClass(c); + } + return ValueType.TObject; + case "string": + return ValueType.TClass(String); + case "undefined": + return ValueType.TNull; + default: + return ValueType.TUnknown; + } +}; +Type.enumEq = function(a,b) { + if(a == b) { + return true; + } + try { + var e = a.__enum__; + if(e == null || e != b.__enum__) { + return false; + } + if(a._hx_index != b._hx_index) { + return false; + } + var enm = $hxEnums[e]; + var params = enm.__constructs__[a._hx_index].__params__; + var _g = 0; + while(_g < params.length) { + var f = params[_g]; + ++_g; + if(!Type.enumEq(a[f],b[f])) { + return false; + } + } + } catch( _g ) { + haxe_NativeStackTrace.lastError = _g; + return false; + } + return true; +}; +Type.enumConstructor = function(e) { + return $hxEnums[e.__enum__].__constructs__[e._hx_index]._hx_name; +}; +Type.enumParameters = function(e) { + var enm = $hxEnums[e.__enum__]; + var params = enm.__constructs__[e._hx_index].__params__; + if(params != null) { + var _g = []; + var _g1 = 0; + while(_g1 < params.length) { + var p = params[_g1]; + ++_g1; + _g.push(e[p]); + } + return _g; + } else { + return []; + } +}; +Type.enumIndex = function(e) { + return e._hx_index; +}; +Type.allEnums = function(e) { + return e.__empty_constructs__.slice(); +}; +var haxe_StackItem = $hxEnums["haxe.StackItem"] = { __ename__:"haxe.StackItem",__constructs__:null + ,CFunction: {_hx_name:"CFunction",_hx_index:0,__enum__:"haxe.StackItem"} + ,Module: ($_=function(m) { return {_hx_index:1,m:m,__enum__:"haxe.StackItem"}; },$_._hx_name="Module",$_.__params__ = ["m"],$_) + ,FilePos: ($_=function(s,file,line,column) { return {_hx_index:2,s:s,file:file,line:line,column:column,__enum__:"haxe.StackItem"}; },$_._hx_name="FilePos",$_.__params__ = ["s","file","line","column"],$_) + ,Method: ($_=function(classname,method) { return {_hx_index:3,classname:classname,method:method,__enum__:"haxe.StackItem"}; },$_._hx_name="Method",$_.__params__ = ["classname","method"],$_) + ,LocalFunction: ($_=function(v) { return {_hx_index:4,v:v,__enum__:"haxe.StackItem"}; },$_._hx_name="LocalFunction",$_.__params__ = ["v"],$_) +}; +haxe_StackItem.__constructs__ = [haxe_StackItem.CFunction,haxe_StackItem.Module,haxe_StackItem.FilePos,haxe_StackItem.Method,haxe_StackItem.LocalFunction]; +haxe_StackItem.__empty_constructs__ = [haxe_StackItem.CFunction]; +var haxe_CallStack = {}; +haxe_CallStack.__properties__ = {get_length:"get_length"}; +haxe_CallStack.get_length = function(this1) { + return this1.length; +}; +haxe_CallStack.callStack = function() { + return haxe_NativeStackTrace.toHaxe(haxe_NativeStackTrace.callStack()); +}; +haxe_CallStack.exceptionStack = function(fullStack) { + if(fullStack == null) { + fullStack = false; + } + var eStack = haxe_NativeStackTrace.toHaxe(haxe_NativeStackTrace.exceptionStack()); + return fullStack ? eStack : haxe_CallStack.subtract(eStack,haxe_CallStack.callStack()); +}; +haxe_CallStack.toString = function(stack) { + var b = new StringBuf(); + var _g = 0; + var _g1 = stack; + while(_g < _g1.length) { + var s = _g1[_g]; + ++_g; + b.b += "\nCalled from "; + haxe_CallStack.itemToString(b,s); + } + return b.b; +}; +haxe_CallStack.subtract = function(this1,stack) { + var startIndex = -1; + var i = -1; + while(++i < this1.length) { + var _g = 0; + var _g1 = stack.length; + while(_g < _g1) { + var j = _g++; + if(haxe_CallStack.equalItems(this1[i],stack[j])) { + if(startIndex < 0) { + startIndex = i; + } + ++i; + if(i >= this1.length) { + break; + } + } else { + startIndex = -1; + } + } + if(startIndex >= 0) { + break; + } + } + if(startIndex >= 0) { + return this1.slice(0,startIndex); + } else { + return this1; + } +}; +haxe_CallStack.copy = function(this1) { + return this1.slice(); +}; +haxe_CallStack.get = function(this1,index) { + return this1[index]; +}; +haxe_CallStack.asArray = function(this1) { + return this1; +}; +haxe_CallStack.equalItems = function(item1,item2) { + if(item1 == null) { + if(item2 == null) { + return true; + } else { + return false; + } + } else { + switch(item1._hx_index) { + case 0: + if(item2 == null) { + return false; + } else if(item2._hx_index == 0) { + return true; + } else { + return false; + } + break; + case 1: + if(item2 == null) { + return false; + } else if(item2._hx_index == 1) { + var m2 = item2.m; + var m1 = item1.m; + return m1 == m2; + } else { + return false; + } + break; + case 2: + if(item2 == null) { + return false; + } else if(item2._hx_index == 2) { + var item21 = item2.s; + var file2 = item2.file; + var line2 = item2.line; + var col2 = item2.column; + var col1 = item1.column; + var line1 = item1.line; + var file1 = item1.file; + var item11 = item1.s; + if(file1 == file2 && line1 == line2 && col1 == col2) { + return haxe_CallStack.equalItems(item11,item21); + } else { + return false; + } + } else { + return false; + } + break; + case 3: + if(item2 == null) { + return false; + } else if(item2._hx_index == 3) { + var class2 = item2.classname; + var method2 = item2.method; + var method1 = item1.method; + var class1 = item1.classname; + if(class1 == class2) { + return method1 == method2; + } else { + return false; + } + } else { + return false; + } + break; + case 4: + if(item2 == null) { + return false; + } else if(item2._hx_index == 4) { + var v2 = item2.v; + var v1 = item1.v; + return v1 == v2; + } else { + return false; + } + break; + } + } +}; +haxe_CallStack.exceptionToString = function(e) { + if(e.get_previous() == null) { + var tmp = "Exception: " + e.toString(); + var tmp1 = e.get_stack(); + return tmp + (tmp1 == null ? "null" : haxe_CallStack.toString(tmp1)); + } + var result = ""; + var e1 = e; + var prev = null; + while(e1 != null) { + if(prev == null) { + var result1 = "Exception: " + e1.get_message(); + var tmp = e1.get_stack(); + result = result1 + (tmp == null ? "null" : haxe_CallStack.toString(tmp)) + result; + } else { + var prevStack = haxe_CallStack.subtract(e1.get_stack(),prev.get_stack()); + result = "Exception: " + e1.get_message() + (prevStack == null ? "null" : haxe_CallStack.toString(prevStack)) + "\n\nNext " + result; + } + prev = e1; + e1 = e1.get_previous(); + } + return result; +}; +haxe_CallStack.itemToString = function(b,s) { + switch(s._hx_index) { + case 0: + b.b += "a C function"; + break; + case 1: + var m = s.m; + b.b += "module "; + b.b += m == null ? "null" : "" + m; + break; + case 2: + var s1 = s.s; + var file = s.file; + var line = s.line; + var col = s.column; + if(s1 != null) { + haxe_CallStack.itemToString(b,s1); + b.b += " ("; + } + b.b += file == null ? "null" : "" + file; + b.b += " line "; + b.b += line == null ? "null" : "" + line; + if(col != null) { + b.b += " column "; + b.b += col == null ? "null" : "" + col; + } + if(s1 != null) { + b.b += ")"; + } + break; + case 3: + var cname = s.classname; + var meth = s.method; + b.b += Std.string(cname == null ? "" : cname); + b.b += "."; + b.b += meth == null ? "null" : "" + meth; + break; + case 4: + var n = s.v; + b.b += "local function #"; + b.b += n == null ? "null" : "" + n; + break; + } +}; +var haxe_IMap = function() { }; +$hxClasses["haxe.IMap"] = haxe_IMap; +haxe_IMap.__name__ = "haxe.IMap"; +haxe_IMap.__isInterface__ = true; +haxe_IMap.prototype = { + get: null + ,set: null + ,exists: null + ,remove: null + ,keys: null + ,iterator: null + ,keyValueIterator: null + ,copy: null + ,toString: null + ,clear: null + ,__class__: haxe_IMap +}; +var haxe_DynamicAccess = {}; +haxe_DynamicAccess._new = function() { + var this1 = { }; + return this1; +}; +haxe_DynamicAccess.get = function(this1,key) { + return this1[key]; +}; +haxe_DynamicAccess.set = function(this1,key,value) { + return this1[key] = value; +}; +haxe_DynamicAccess.exists = function(this1,key) { + return Object.prototype.hasOwnProperty.call(this1,key); +}; +haxe_DynamicAccess.remove = function(this1,key) { + return Reflect.deleteField(this1,key); +}; +haxe_DynamicAccess.keys = function(this1) { + return Reflect.fields(this1); +}; +haxe_DynamicAccess.copy = function(this1) { + return Reflect.copy(this1); +}; +haxe_DynamicAccess.iterator = function(this1) { + return new haxe_iterators_DynamicAccessIterator(this1); +}; +haxe_DynamicAccess.keyValueIterator = function(this1) { + return new haxe_iterators_DynamicAccessKeyValueIterator(this1); +}; +var haxe_Exception = function(message,previous,native) { + Error.call(this,message); + this.message = message; + this.__previousException = previous; + this.__nativeException = native != null ? native : this; + this.__skipStack = 0; + var old = Error.prepareStackTrace; + Error.prepareStackTrace = function(e) { return e.stack; } + if(((native) instanceof Error)) { + this.stack = native.stack; + } else { + var e = null; + if(Error.captureStackTrace) { + Error.captureStackTrace(this,haxe_Exception); + e = this; + } else { + e = new Error(); + if(typeof(e.stack) == "undefined") { + try { throw e; } catch(_) {} + this.__skipStack++; + } + } + this.stack = e.stack; + } + Error.prepareStackTrace = old; +}; +$hxClasses["haxe.Exception"] = haxe_Exception; +haxe_Exception.__name__ = "haxe.Exception"; +haxe_Exception.caught = function(value) { + if(((value) instanceof haxe_Exception)) { + return value; + } else if(((value) instanceof Error)) { + return new haxe_Exception(value.message,null,value); + } else { + return new haxe_ValueException(value,null,value); + } +}; +haxe_Exception.thrown = function(value) { + if(((value) instanceof haxe_Exception)) { + return value.get_native(); + } else if(((value) instanceof Error)) { + return value; + } else { + var e = new haxe_ValueException(value); + e.__skipStack++; + return e; + } +}; +haxe_Exception.__super__ = Error; +haxe_Exception.prototype = $extend(Error.prototype,{ + __skipStack: null + ,__nativeException: null + ,__previousException: null + ,unwrap: function() { + return this.__nativeException; + } + ,toString: function() { + return this.get_message(); + } + ,details: function() { + if(this.get_previous() == null) { + var tmp = "Exception: " + this.toString(); + var tmp1 = this.get_stack(); + return tmp + (tmp1 == null ? "null" : haxe_CallStack.toString(tmp1)); + } else { + var result = ""; + var e = this; + var prev = null; + while(e != null) { + if(prev == null) { + var result1 = "Exception: " + e.get_message(); + var tmp = e.get_stack(); + result = result1 + (tmp == null ? "null" : haxe_CallStack.toString(tmp)) + result; + } else { + var prevStack = haxe_CallStack.subtract(e.get_stack(),prev.get_stack()); + result = "Exception: " + e.get_message() + (prevStack == null ? "null" : haxe_CallStack.toString(prevStack)) + "\n\nNext " + result; + } + prev = e; + e = e.get_previous(); + } + return result; + } + } + ,__shiftStack: function() { + this.__skipStack++; + } + ,get_message: function() { + return this.message; + } + ,get_previous: function() { + return this.__previousException; + } + ,get_native: function() { + return this.__nativeException; + } + ,get_stack: function() { + var _g = this.__exceptionStack; + if(_g == null) { + var value = haxe_NativeStackTrace.toHaxe(haxe_NativeStackTrace.normalize(this.stack),this.__skipStack); + this.setProperty("__exceptionStack",value); + return value; + } else { + var s = _g; + return s; + } + } + ,setProperty: function(name,value) { + try { + Object.defineProperty(this,name,{ value : value}); + } catch( _g ) { + this[name] = value; + } + } + ,get___exceptionStack: function() { + return this.__exceptionStack; + } + ,set___exceptionStack: function(value) { + this.setProperty("__exceptionStack",value); + return value; + } + ,get___skipStack: function() { + return this.__skipStack; + } + ,set___skipStack: function(value) { + this.setProperty("__skipStack",value); + return value; + } + ,get___nativeException: function() { + return this.__nativeException; + } + ,set___nativeException: function(value) { + this.setProperty("__nativeException",value); + return value; + } + ,get___previousException: function() { + return this.__previousException; + } + ,set___previousException: function(value) { + this.setProperty("__previousException",value); + return value; + } + ,__class__: haxe_Exception + ,__properties__: {set___exceptionStack:"set___exceptionStack",get___exceptionStack:"get___exceptionStack",get_native:"get_native",get_previous:"get_previous",get_stack:"get_stack",get_message:"get_message"} +}); +var haxe_Log = function() { }; +$hxClasses["haxe.Log"] = haxe_Log; +haxe_Log.__name__ = "haxe.Log"; +haxe_Log.formatOutput = function(v,infos) { + var str = Std.string(v); + if(infos == null) { + return str; + } + var pstr = infos.fileName + ":" + infos.lineNumber; + if(infos.customParams != null) { + var _g = 0; + var _g1 = infos.customParams; + while(_g < _g1.length) { + var v = _g1[_g]; + ++_g; + str += ", " + Std.string(v); + } + } + return pstr + ": " + str; +}; +haxe_Log.trace = function(v,infos) { + var str = haxe_Log.formatOutput(v,infos); + if(typeof(console) != "undefined" && console.log != null) { + console.log(str); + } +}; +var haxe_NativeStackTrace = function() { }; +$hxClasses["haxe.NativeStackTrace"] = haxe_NativeStackTrace; +haxe_NativeStackTrace.__name__ = "haxe.NativeStackTrace"; +haxe_NativeStackTrace.lastError = null; +haxe_NativeStackTrace.wrapCallSite = null; +haxe_NativeStackTrace.saveStack = function(e) { + haxe_NativeStackTrace.lastError = e; +}; +haxe_NativeStackTrace.callStack = function() { + var e = new Error(""); + var stack = haxe_NativeStackTrace.tryHaxeStack(e); + if(typeof(stack) == "undefined") { + try { + throw e; + } catch( _g ) { + } + stack = e.stack; + } + return haxe_NativeStackTrace.normalize(stack,2); +}; +haxe_NativeStackTrace.exceptionStack = function() { + return haxe_NativeStackTrace.normalize(haxe_NativeStackTrace.tryHaxeStack(haxe_NativeStackTrace.lastError)); +}; +haxe_NativeStackTrace.toHaxe = function(s,skip) { + if(skip == null) { + skip = 0; + } + if(s == null) { + return []; + } else if(typeof(s) == "string") { + var stack = s.split("\n"); + if(stack[0] == "Error") { + stack.shift(); + } + var m = []; + var _g = 0; + var _g1 = stack.length; + while(_g < _g1) { + var i = _g++; + if(skip > i) { + continue; + } + var line = stack[i]; + var matched = line.match(/^ at ([A-Za-z0-9_. ]+) \(([^)]+):([0-9]+):([0-9]+)\)$/); + if(matched != null) { + var path = matched[1].split("."); + if(path[0] == "$hxClasses") { + path.shift(); + } + var meth = path.pop(); + var file = matched[2]; + var line1 = Std.parseInt(matched[3]); + var column = Std.parseInt(matched[4]); + m.push(haxe_StackItem.FilePos(meth == "Anonymous function" ? haxe_StackItem.LocalFunction() : meth == "Global code" ? null : haxe_StackItem.Method(path.join("."),meth),file,line1,column)); + } else { + m.push(haxe_StackItem.Module(StringTools.trim(line))); + } + } + return m; + } else if(skip > 0 && Array.isArray(s)) { + return s.slice(skip); + } else { + return s; + } +}; +haxe_NativeStackTrace.tryHaxeStack = function(e) { + if(e == null) { + return []; + } + var oldValue = Error.prepareStackTrace; + Error.prepareStackTrace = haxe_NativeStackTrace.prepareHxStackTrace; + var stack = e.stack; + Error.prepareStackTrace = oldValue; + return stack; +}; +haxe_NativeStackTrace.prepareHxStackTrace = function(e,callsites) { + var stack = []; + var _g = 0; + while(_g < callsites.length) { + var site = callsites[_g]; + ++_g; + if(haxe_NativeStackTrace.wrapCallSite != null) { + site = haxe_NativeStackTrace.wrapCallSite(site); + } + var method = null; + var fullName = site.getFunctionName(); + if(fullName != null) { + var idx = fullName.lastIndexOf("."); + if(idx >= 0) { + var className = fullName.substring(0,idx); + var methodName = fullName.substring(idx + 1); + method = haxe_StackItem.Method(className,methodName); + } else { + method = haxe_StackItem.Method(null,fullName); + } + } + var fileName = site.getFileName(); + var fileAddr = fileName == null ? -1 : fileName.indexOf("file:"); + if(haxe_NativeStackTrace.wrapCallSite != null && fileAddr > 0) { + fileName = fileName.substring(fileAddr + 6); + } + stack.push(haxe_StackItem.FilePos(method,fileName,site.getLineNumber(),site.getColumnNumber())); + } + return stack; +}; +haxe_NativeStackTrace.normalize = function(stack,skipItems) { + if(skipItems == null) { + skipItems = 0; + } + if(Array.isArray(stack) && skipItems > 0) { + return stack.slice(skipItems); + } else if(typeof(stack) == "string") { + switch(stack.substring(0,6)) { + case "Error\n":case "Error:": + ++skipItems; + break; + default: + } + return haxe_NativeStackTrace.skipLines(stack,skipItems); + } else { + return stack; + } +}; +haxe_NativeStackTrace.skipLines = function(stack,skip,pos) { + if(pos == null) { + pos = 0; + } + if(skip > 0) { + pos = stack.indexOf("\n",pos); + if(pos < 0) { + return ""; + } else { + return haxe_NativeStackTrace.skipLines(stack,--skip,pos + 1); + } + } else { + return stack.substring(pos); + } +}; +var haxe_Rest = {}; +haxe_Rest.__properties__ = {get_length:"get_length"}; +haxe_Rest.get_length = function(this1) { + return this1.length; +}; +haxe_Rest.of = function(array) { + var this1 = array; + return this1; +}; +haxe_Rest._new = function(array) { + var this1 = array; + return this1; +}; +haxe_Rest.get = function(this1,index) { + return this1[index]; +}; +haxe_Rest.toArray = function(this1) { + return this1.slice(); +}; +haxe_Rest.iterator = function(this1) { + return new haxe_iterators_RestIterator(this1); +}; +haxe_Rest.keyValueIterator = function(this1) { + return new haxe_iterators_RestKeyValueIterator(this1); +}; +haxe_Rest.append = function(this1,item) { + var result = this1.slice(); + result.push(item); + var this1 = result; + return this1; +}; +haxe_Rest.prepend = function(this1,item) { + var result = this1.slice(); + result.unshift(item); + var this1 = result; + return this1; +}; +haxe_Rest.toString = function(this1) { + return "[" + this1.toString() + "]"; +}; +var haxe_ValueException = function(value,previous,native) { + haxe_Exception.call(this,String(value),previous,native); + this.value = value; + this.__skipStack++; +}; +$hxClasses["haxe.ValueException"] = haxe_ValueException; +haxe_ValueException.__name__ = "haxe.ValueException"; +haxe_ValueException.__super__ = haxe_Exception; +haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ + value: null + ,unwrap: function() { + return this.value; + } + ,__class__: haxe_ValueException +}); +var haxe_ds_ReadOnlyArray = {}; +haxe_ds_ReadOnlyArray.__properties__ = {get_length:"get_length"}; +haxe_ds_ReadOnlyArray.get_length = function(this1) { + return this1.length; +}; +haxe_ds_ReadOnlyArray.get = function(this1,i) { + return this1[i]; +}; +haxe_ds_ReadOnlyArray.concat = function(this1,a) { + return this1.concat(a); +}; +var haxe_iterators_ArrayIterator = function(array) { + this.current = 0; + this.array = array; +}; +$hxClasses["haxe.iterators.ArrayIterator"] = haxe_iterators_ArrayIterator; +haxe_iterators_ArrayIterator.__name__ = "haxe.iterators.ArrayIterator"; +haxe_iterators_ArrayIterator.prototype = { + array: null + ,current: null + ,hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return this.array[this.current++]; + } + ,__class__: haxe_iterators_ArrayIterator +}; +var haxe_iterators_ArrayKeyValueIterator = function(array) { + this.current = 0; + this.array = array; +}; +$hxClasses["haxe.iterators.ArrayKeyValueIterator"] = haxe_iterators_ArrayKeyValueIterator; +haxe_iterators_ArrayKeyValueIterator.__name__ = "haxe.iterators.ArrayKeyValueIterator"; +haxe_iterators_ArrayKeyValueIterator.prototype = { + current: null + ,array: null + ,hasNext: function() { + return this.current < this.array.length; + } + ,next: function() { + return { value : this.array[this.current], key : this.current++}; + } + ,__class__: haxe_iterators_ArrayKeyValueIterator +}; +var haxe_iterators_DynamicAccessIterator = function(access) { + this.access = access; + this.keys = Reflect.fields(access); + this.index = 0; +}; +$hxClasses["haxe.iterators.DynamicAccessIterator"] = haxe_iterators_DynamicAccessIterator; +haxe_iterators_DynamicAccessIterator.__name__ = "haxe.iterators.DynamicAccessIterator"; +haxe_iterators_DynamicAccessIterator.prototype = { + access: null + ,keys: null + ,index: null + ,hasNext: function() { + return this.index < this.keys.length; + } + ,next: function() { + return this.access[this.keys[this.index++]]; + } + ,__class__: haxe_iterators_DynamicAccessIterator +}; +var haxe_iterators_DynamicAccessKeyValueIterator = function(access) { + this.access = access; + this.keys = Reflect.fields(access); + this.index = 0; +}; +$hxClasses["haxe.iterators.DynamicAccessKeyValueIterator"] = haxe_iterators_DynamicAccessKeyValueIterator; +haxe_iterators_DynamicAccessKeyValueIterator.__name__ = "haxe.iterators.DynamicAccessKeyValueIterator"; +haxe_iterators_DynamicAccessKeyValueIterator.prototype = { + access: null + ,keys: null + ,index: null + ,hasNext: function() { + return this.index < this.keys.length; + } + ,next: function() { + var key = this.keys[this.index++]; + return { value : this.access[key], key : key}; + } + ,__class__: haxe_iterators_DynamicAccessKeyValueIterator +}; +var haxe_iterators_RestIterator = function(args) { + this.current = 0; + this.args = args; +}; +$hxClasses["haxe.iterators.RestIterator"] = haxe_iterators_RestIterator; +haxe_iterators_RestIterator.__name__ = "haxe.iterators.RestIterator"; +haxe_iterators_RestIterator.prototype = { + args: null + ,current: null + ,hasNext: function() { + return this.current < this.args.length; + } + ,next: function() { + return this.args[this.current++]; + } + ,__class__: haxe_iterators_RestIterator +}; +var haxe_iterators_RestKeyValueIterator = function(args) { + this.current = 0; + this.args = args; +}; +$hxClasses["haxe.iterators.RestKeyValueIterator"] = haxe_iterators_RestKeyValueIterator; +haxe_iterators_RestKeyValueIterator.__name__ = "haxe.iterators.RestKeyValueIterator"; +haxe_iterators_RestKeyValueIterator.prototype = { + args: null + ,current: null + ,hasNext: function() { + return this.current < this.args.length; + } + ,next: function() { + return { key : this.current, value : this.args[this.current++]}; + } + ,__class__: haxe_iterators_RestKeyValueIterator +}; +var haxe_iterators_StringIterator = function(s) { + this.offset = 0; + this.s = s; +}; +$hxClasses["haxe.iterators.StringIterator"] = haxe_iterators_StringIterator; +haxe_iterators_StringIterator.__name__ = "haxe.iterators.StringIterator"; +haxe_iterators_StringIterator.prototype = { + offset: null + ,s: null + ,hasNext: function() { + return this.offset < this.s.length; + } + ,next: function() { + return this.s.charCodeAt(this.offset++); + } + ,__class__: haxe_iterators_StringIterator +}; +var haxe_iterators_StringIteratorUnicode = function(s) { + this.offset = 0; + this.s = s; +}; +$hxClasses["haxe.iterators.StringIteratorUnicode"] = haxe_iterators_StringIteratorUnicode; +haxe_iterators_StringIteratorUnicode.__name__ = "haxe.iterators.StringIteratorUnicode"; +haxe_iterators_StringIteratorUnicode.unicodeIterator = function(s) { + return new haxe_iterators_StringIteratorUnicode(s); +}; +haxe_iterators_StringIteratorUnicode.prototype = { + offset: null + ,s: null + ,hasNext: function() { + return this.offset < this.s.length; + } + ,next: function() { + var s = this.s; + var index = this.offset++; + var c = s.charCodeAt(index); + if(c >= 55296 && c <= 56319) { + c = c - 55232 << 10 | s.charCodeAt(index + 1) & 1023; + } + var c1 = c; + if(c1 >= 65536) { + this.offset++; + } + return c1; + } + ,__class__: haxe_iterators_StringIteratorUnicode +}; +var haxe_iterators_StringKeyValueIterator = function(s) { + this.offset = 0; + this.s = s; +}; +$hxClasses["haxe.iterators.StringKeyValueIterator"] = haxe_iterators_StringKeyValueIterator; +haxe_iterators_StringKeyValueIterator.__name__ = "haxe.iterators.StringKeyValueIterator"; +haxe_iterators_StringKeyValueIterator.prototype = { + offset: null + ,s: null + ,hasNext: function() { + return this.offset < this.s.length; + } + ,next: function() { + return { key : this.offset, value : this.s.charCodeAt(this.offset++)}; + } + ,__class__: haxe_iterators_StringKeyValueIterator +}; +var js_Boot = function() { }; +$hxClasses["js.Boot"] = js_Boot; +js_Boot.__name__ = "js.Boot"; +js_Boot.isClass = function(o) { + return o.__name__; +}; +js_Boot.isInterface = function(o) { + return o.__isInterface__; +}; +js_Boot.isEnum = function(e) { + return e.__ename__; +}; +js_Boot.getClass = function(o) { + if(o == null) { + return null; + } else if(((o) instanceof Array)) { + return Array; + } else { + var cl = o.__class__; + if(cl != null) { + return cl; + } + var name = js_Boot.__nativeClassName(o); + if(name != null) { + return js_Boot.__resolveNativeClass(name); + } + return null; + } +}; +js_Boot.__string_rec = function(o,s) { + if(o == null) { + return "null"; + } + if(s.length >= 5) { + return "<...>"; + } + var t = typeof(o); + if(t == "function" && (o.__name__ || o.__ename__)) { + t = "object"; + } + switch(t) { + case "function": + return ""; + case "object": + if(((o) instanceof Array)) { + var str = "["; + s += "\t"; + var _g = 0; + var _g1 = o.length; + while(_g < _g1) { + var i = _g++; + str += (i > 0 ? "," : "") + js_Boot.__string_rec(o[i],s); + } + str += "]"; + return str; + } + var tostr; + try { + tostr = o.toString; + } catch( _g ) { + haxe_NativeStackTrace.lastError = _g; + return "???"; + } + if(tostr != null && tostr != Object.toString && typeof(tostr) == "function") { + var s2 = o.toString(); + if(s2 != "[object Object]") { + return s2; + } + } + var str = "{\n"; + s += "\t"; + var hasp = o.hasOwnProperty != null; + var k = null; + for( k in o ) { + if(hasp && !o.hasOwnProperty(k)) { + continue; + } + if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { + continue; + } + if(str.length != 2) { + str += ", \n"; + } + str += s + k + " : " + js_Boot.__string_rec(o[k],s); + } + s = s.substring(1); + str += "\n" + s + "}"; + return str; + case "string": + return o; + default: + return String(o); + } +}; +js_Boot.__interfLoop = function(cc,cl) { + if(cc == null) { + return false; + } + if(cc == cl) { + return true; + } + var intf = cc.__interfaces__; + if(intf != null) { + var _g = 0; + var _g1 = intf.length; + while(_g < _g1) { + var i = _g++; + var i1 = intf[i]; + if(i1 == cl || js_Boot.__interfLoop(i1,cl)) { + return true; + } + } + } + return js_Boot.__interfLoop(cc.__super__,cl); +}; +js_Boot.__instanceof = function(o,cl) { + if(cl == null) { + return false; + } + switch(cl) { + case Array: + return ((o) instanceof Array); + case Bool: + return typeof(o) == "boolean"; + case Dynamic: + return o != null; + case Float: + return typeof(o) == "number"; + case Int: + if(typeof(o) == "number") { + return ((o | 0) === o); + } else { + return false; + } + break; + case String: + return typeof(o) == "string"; + default: + if(o != null) { + if(typeof(cl) == "function") { + if(js_Boot.__downcastCheck(o,cl)) { + return true; + } + } else if(typeof(cl) == "object" && js_Boot.__isNativeObj(cl)) { + if(((o) instanceof cl)) { + return true; + } + } + } else { + return false; + } + if(cl == Class ? o.__name__ != null : false) { + return true; + } + if(cl == Enum ? o.__ename__ != null : false) { + return true; + } + return false; + } +}; +js_Boot.__downcastCheck = function(o,cl) { + if(!((o) instanceof cl)) { + if(cl.__isInterface__) { + return js_Boot.__interfLoop(js_Boot.getClass(o),cl); + } else { + return false; + } + } else { + return true; + } +}; +js_Boot.__implements = function(o,iface) { + return js_Boot.__interfLoop(js_Boot.getClass(o),iface); +}; +js_Boot.__cast = function(o,t) { + if(o == null || js_Boot.__instanceof(o,t)) { + return o; + } else { + throw haxe_Exception.thrown("Cannot cast " + Std.string(o) + " to " + Std.string(t)); + } +}; +js_Boot.__toStr = null; +js_Boot.__nativeClassName = function(o) { + var name = js_Boot.__toStr.call(o).slice(8,-1); + if(name == "Object" || name == "Function" || name == "Math" || name == "JSON") { + return null; + } + return name; +}; +js_Boot.__isNativeObj = function(o) { + return js_Boot.__nativeClassName(o) != null; +}; +js_Boot.__resolveNativeClass = function(name) { + return $global[name]; +}; +var js_Lib = function() { }; +$hxClasses["js.Lib"] = js_Lib; +js_Lib.__name__ = "js.Lib"; +js_Lib.__properties__ = {get_undefined:"get_undefined"}; +js_Lib.debug = function() { + debugger; +}; +js_Lib.alert = function(v) { + alert(js_Boot.__string_rec(v,"")); +}; +js_Lib.eval = function(code) { + return eval(code); +}; +js_Lib.get_undefined = function() { + return undefined; +}; +js_Lib.rethrow = function() { +}; +js_Lib.getOriginalException = function() { + return null; +}; +js_Lib.getNextHaxeUID = function() { + return $global.$haxeUID++; +}; +var js_lib_ObjectEntry = {}; +js_lib_ObjectEntry.__properties__ = {get_value:"get_value",get_key:"get_key"}; +js_lib_ObjectEntry.get_key = function(this1) { + return this1[0]; +}; +js_lib_ObjectEntry.get_value = function(this1) { + return this1[1]; +}; +var xrfragment_Query = function(str) { + this.preset = ""; + this.accept = false; + this.exclude = []; + this.include = []; + this.q = { }; + this.str = ""; + if(str != null) { + this.parse(str); + } +}; +$hxClasses["xrfragment.Query"] = xrfragment_Query; +xrfragment_Query.__name__ = "xrfragment.Query"; +xrfragment_Query.prototype = { + str: null + ,q: null + ,include: null + ,exclude: null + ,accept: null + ,preset: null + ,toObject: function() { + return this.q; + } + ,qualify: function(nodename) { + if(this.q.copy_all) { + this.accept = true; + } + if(this.include.indexOf(nodename) != -1) { + this.accept = true; + } + if(this.exclude.indexOf(nodename) != -1) { + this.accept = false; + } + return this.accept; + } + ,parse: function(str,recurse) { + if(recurse == null) { + recurse = false; + } + var _gthis = this; + var copyAll = recurse ? this.q.copy_all : HxOverrides.substr(str,0,1) == "-" || HxOverrides.substr(str,0,1) == "?" || str == ""; + var isOr = new EReg("^or$",""); + var isProp = new EReg(".*:[><=!]?",""); + var isName = new EReg("[^:/]",""); + var isExclude = new EReg("^-",""); + var isInclude = new EReg("^\\+",""); + var isPreset = new EReg("^\\?",""); + var token = str.split(" "); + var ors = []; + var q = { }; + var composeQuery = function() { + q = { }; + var value = []; + q["object"] = value; + var value = []; + q["-object"] = value; + ors.push(q); + return q; + }; + composeQuery(); + var match = null; + match = function(str,prefix) { + if(prefix == null) { + prefix = ""; + } + if(isPreset.match(str) && !recurse) { + _gthis.preset = str; + return; + } + if(isExclude.match(str) || isInclude.match(str)) { + var t = HxOverrides.substr(str,1,null); + match(t,HxOverrides.substr(str,0,1)); + return; + } + if(isProp.match(str)) { + var skip = 0; + var type = "="; + if(str.indexOf("*") != -1) { + type = "*"; + } + if(str.indexOf(">") != -1) { + type = ">"; + } + if(str.indexOf("<") != -1) { + type = "<"; + } + if(str.indexOf("!=") != -1) { + type = "!="; + } + if(str.indexOf(">=") != -1) { + type = ">="; + } + if(str.indexOf("<=") != -1) { + type = "<="; + } + if(type != "=") { + skip += type.length; + } + var property = str.split(":")[0]; + var value; + if(q[prefix + property]) { + value = q[prefix + property]; + } else { + value = { }; + } + value[type] = HxOverrides.substr(str.split(":")[1],skip,null); + q[prefix + property] = value; + return; + } + if(isName.match(str)) { + if(prefix == "-") { + q["-object"].push(str); + while(q["object"].contains(str) == true) q["object"].remove(str); + } else { + q["object"].push(str); + while(q["-object"].contains(str) == true) q["-object"].remove(str); + } + return; + } + }; + var _g = 0; + var _g1 = token.length; + while(_g < _g1) { + var i = _g++; + if(isOr.match(token[i])) { + composeQuery(); + } else { + match(token[i]); + } + } + var _g = 0; + var _g1 = ors.length; + while(_g < _g1) { + var i = _g++; + var or = ors[i]; + if(Reflect.field(or,"object") != null) { + this.include = this.include.concat(Reflect.field(or,"object")); + } + if(Reflect.field(or,"-object") != null) { + this.exclude = this.exclude.concat(Reflect.field(or,"-object")); + } + } + this.q = { or : ors, copy_all : copyAll}; + return this.q; + } + ,test: function(property,value) { + if(this.preset == property) { + this.parse(value,true); + } + var _g = 0; + var _g1 = this.q.or.length; + while(_g < _g1) { + var i = _g++; + var or = this.q.or[i]; + var conds = [0]; + var fails = [0]; + var pass = 0; + var when = (function(fails,conds) { + return function(expr) { + conds[0] += 1; + fails[0] += expr ? 0 : 1; + return expr; + }; + })(fails,conds); + var _g2 = 0; + var _g3 = Reflect.fields(or); + while(_g2 < _g3.length) { + var k = _g3[_g2]; + ++_g2; + var orval = Reflect.field(or,k); + if(k != property) { + continue; + } + if(Reflect.field(orval,"=") != null && when(value == Reflect.field(orval,"="))) { + ++pass; + } + if(Reflect.field(orval,"*") != null && when(value != null)) { + ++pass; + } + if(Reflect.field(orval,">") != null && when(value > Std.parseInt(Reflect.field(orval,">")))) { + ++pass; + } + if(Reflect.field(orval,"<") != null && when(value < Std.parseInt(Reflect.field(orval,"<")))) { + ++pass; + } + if(Reflect.field(orval,">=") != null && when(value >= Std.parseInt(Reflect.field(orval,">=")))) { + ++pass; + } + if(Reflect.field(orval,"<=") != null && when(value >= Std.parseInt(Reflect.field(orval,"<=")))) { + ++pass; + } + if(Reflect.field(orval,"!=") != null && when(value != Std.parseInt(Reflect.field(orval,"!=")))) { + ++pass; + } + } + if(this.accept && conds[0] > 0 && fails[0] > 0) { + this.accept = false; + } + if(conds[0] > 0 && pass > 0 && fails[0] == 0) { + this.accept = true; + } + } + } + ,__class__: xrfragment_Query +}; +if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { + HxOverrides.now = performance.now.bind(performance); +} +$hxClasses["Math"] = Math; +if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } +String.prototype.__class__ = $hxClasses["String"] = String; +String.__name__ = "String"; +$hxClasses["Array"] = Array; +Array.__name__ = "Array"; +Date.prototype.__class__ = $hxClasses["Date"] = Date; +Date.__name__ = "Date"; +var Int = { }; +var Dynamic = { }; +var Float = Number; +var Bool = Boolean; +var Class = { }; +var Enum = { }; +js_Boot.__toStr = ({ }).toString; +EReg.escapeRe = new RegExp("[.*+?^${}()|[\\]\\\\]","g"); +haxe_SysTools.winMetaCharacters = [32,40,41,37,33,94,34,60,62,38,124,10,13,44,59]; +StringTools.winMetaCharacters = haxe_SysTools.winMetaCharacters; +StringTools.MIN_SURROGATE_CODE_POINT = 65536; +var xrfragment_Query_ok = $hx_exports["xrfragment"]["Query"]["ok"] = + // haxe workarounds + + Array.prototype.contains = Array.prototype.includes + + if (typeof Array.prototype.remove !== "function") { + Array.prototype.remove = function (item) { + const oldLength = this.length + let newLength = 0 + + for (let i = 0; i < oldLength; i++) { + const entry = this[i] + if (entry === item) { + let newLength = i++ + + while (i !== this.length) { + const entry = this[i] + if (entry !== item) this[newLength++] = entry + i++ + } + + this.length = newLength + for (let i = newLength; i < oldLength; i++) delete this[i] + return true + } + } + return false + } + } + ; +Test.main(); +})(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this); +var xrfragment = $hx_exports["xrfragment"]; diff --git a/test/generated/test.py b/test/generated/test.py new file mode 100644 index 0000000..8e9801f --- /dev/null +++ b/test/generated/test.py @@ -0,0 +1,7590 @@ +import sys + +import math as python_lib_Math +import math as Math +from os import path as python_lib_os_Path +import inspect as python_lib_Inspect +import sys as python_lib_Sys +import functools as python_lib_Functools +try: + import msvcrt as python_lib_Msvcrt +except: + pass +import os as python_lib_Os +import random as python_lib_Random +import re as python_lib_Re +import subprocess as python_lib_Subprocess +try: + import termios as python_lib_Termios +except: + pass +import time as python_lib_Time +import timeit as python_lib_Timeit +import traceback as python_lib_Traceback +try: + import tty as python_lib_Tty +except: + pass +from datetime import datetime as python_lib_datetime_Datetime +from datetime import timedelta as python_lib_datetime_Timedelta +from datetime import tzinfo as python_lib_datetime_Tzinfo +from datetime import timezone as python_lib_datetime_Timezone +from io import IOBase as python_lib_io_IOBase +from io import BufferedIOBase as python_lib_io_BufferedIOBase +from io import RawIOBase as python_lib_io_RawIOBase +from io import FileIO as python_lib_io_FileIO +from io import TextIOBase as python_lib_io_TextIOBase +from io import StringIO as python_lib_io_StringIO +from time import struct_time as python_lib_time_StructTime +import urllib.parse as python_lib_urllib_Parse + + +class _hx_AnonObject: + _hx_disable_getattr = False + def __init__(self, fields): + self.__dict__ = fields + def __repr__(self): + return repr(self.__dict__) + def __contains__(self, item): + return item in self.__dict__ + def __getitem__(self, item): + return self.__dict__[item] + def __getattr__(self, name): + if (self._hx_disable_getattr): + raise AttributeError('field does not exist') + else: + return None + def _hx_hasattr(self,field): + self._hx_disable_getattr = True + try: + getattr(self, field) + self._hx_disable_getattr = False + return True + except AttributeError: + self._hx_disable_getattr = False + return False + + + +class Enum: + _hx_class_name = "Enum" + __slots__ = ("tag", "index", "params") + _hx_fields = ["tag", "index", "params"] + _hx_methods = ["__str__"] + + def __init__(self,tag,index,params): + self.tag = tag + self.index = index + self.params = params + + def __str__(self): + if (self.params is None): + return self.tag + else: + return self.tag + '(' + (', '.join(str(v) for v in self.params)) + ')' + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.tag = None + _hx_o.index = None + _hx_o.params = None + + +class Class: pass + + +class Date: + _hx_class_name = "Date" + __slots__ = ("date", "dateUTC") + _hx_fields = ["date", "dateUTC"] + _hx_methods = ["getTime", "getHours", "getMinutes", "getSeconds", "getFullYear", "getMonth", "getDate", "getDay", "getUTCHours", "getUTCMinutes", "getUTCSeconds", "getUTCFullYear", "getUTCMonth", "getUTCDate", "getUTCDay", "getTimezoneOffset", "toString"] + _hx_statics = ["now", "fromTime", "makeLocal", "UTC", "fromString"] + + def __init__(self,year,month,day,hour,_hx_min,sec): + self.dateUTC = None + if (year < python_lib_datetime_Datetime.min.year): + year = python_lib_datetime_Datetime.min.year + if (day == 0): + day = 1 + self.date = Date.makeLocal(python_lib_datetime_Datetime(year,(month + 1),day,hour,_hx_min,sec,0)) + self.dateUTC = self.date.astimezone(python_lib_datetime_Timezone.utc) + + def getTime(self): + return (self.date.timestamp() * 1000) + + def getHours(self): + return self.date.hour + + def getMinutes(self): + return self.date.minute + + def getSeconds(self): + return self.date.second + + def getFullYear(self): + return self.date.year + + def getMonth(self): + return (self.date.month - 1) + + def getDate(self): + return self.date.day + + def getDay(self): + return HxOverrides.mod(self.date.isoweekday(), 7) + + def getUTCHours(self): + return self.dateUTC.hour + + def getUTCMinutes(self): + return self.dateUTC.minute + + def getUTCSeconds(self): + return self.dateUTC.second + + def getUTCFullYear(self): + return self.dateUTC.year + + def getUTCMonth(self): + return (self.dateUTC.month - 1) + + def getUTCDate(self): + return self.dateUTC.day + + def getUTCDay(self): + return HxOverrides.mod(self.dateUTC.isoweekday(), 7) + + def getTimezoneOffset(self): + x = (self.date.utcoffset() / python_lib_datetime_Timedelta(0,60)) + tmp = None + try: + tmp = int(x) + except BaseException as _g: + None + tmp = None + return -tmp + + def toString(self): + return self.date.strftime("%Y-%m-%d %H:%M:%S") + + @staticmethod + def now(): + d = Date(2000,0,1,0,0,0) + d.date = Date.makeLocal(python_lib_datetime_Datetime.now()) + d.dateUTC = d.date.astimezone(python_lib_datetime_Timezone.utc) + return d + + @staticmethod + def fromTime(t): + d = Date(2000,0,1,0,0,0) + d.date = Date.makeLocal(python_lib_datetime_Datetime.fromtimestamp((t / 1000.0))) + d.dateUTC = d.date.astimezone(python_lib_datetime_Timezone.utc) + return d + + @staticmethod + def makeLocal(date): + try: + return date.astimezone() + except BaseException as _g: + None + tzinfo = python_lib_datetime_Datetime.now(python_lib_datetime_Timezone.utc).astimezone().tzinfo + return date.replace(**python__KwArgs_KwArgs_Impl_.fromT(_hx_AnonObject({'tzinfo': tzinfo}))) + + @staticmethod + def UTC(year,month,day,hour,_hx_min,sec): + return (python_lib_datetime_Datetime(year,(month + 1),day,hour,_hx_min,sec,0,python_lib_datetime_Timezone.utc).timestamp() * 1000) + + @staticmethod + def fromString(s): + _g = len(s) + if (_g == 8): + k = s.split(":") + return Date.fromTime((((Std.parseInt((k[0] if 0 < len(k) else None)) * 3600000.) + ((Std.parseInt((k[1] if 1 < len(k) else None)) * 60000.))) + ((Std.parseInt((k[2] if 2 < len(k) else None)) * 1000.)))) + elif (_g == 10): + k = s.split("-") + return Date(Std.parseInt((k[0] if 0 < len(k) else None)),(Std.parseInt((k[1] if 1 < len(k) else None)) - 1),Std.parseInt((k[2] if 2 < len(k) else None)),0,0,0) + elif (_g == 19): + k = s.split(" ") + _this = (k[0] if 0 < len(k) else None) + y = _this.split("-") + _this = (k[1] if 1 < len(k) else None) + t = _this.split(":") + return Date(Std.parseInt((y[0] if 0 < len(y) else None)),(Std.parseInt((y[1] if 1 < len(y) else None)) - 1),Std.parseInt((y[2] if 2 < len(y) else None)),Std.parseInt((t[0] if 0 < len(t) else None)),Std.parseInt((t[1] if 1 < len(t) else None)),Std.parseInt((t[2] if 2 < len(t) else None))) + else: + raise haxe_Exception.thrown(("Invalid date format : " + ("null" if s is None else s))) + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.date = None + _hx_o.dateUTC = None + + +class EReg: + _hx_class_name = "EReg" + __slots__ = ("pattern", "matchObj", "_hx_global") + _hx_fields = ["pattern", "matchObj", "global"] + _hx_methods = ["match", "matched", "matchedLeft", "matchedRight", "matchedPos", "matchSub", "split", "replace", "map"] + _hx_statics = ["escape"] + + def __init__(self,r,opt): + self.matchObj = None + self._hx_global = False + options = 0 + _g = 0 + _g1 = len(opt) + while (_g < _g1): + i = _g + _g = (_g + 1) + c = (-1 if ((i >= len(opt))) else ord(opt[i])) + if (c == 109): + options = (options | python_lib_Re.M) + if (c == 105): + options = (options | python_lib_Re.I) + if (c == 115): + options = (options | python_lib_Re.S) + if (c == 117): + options = (options | python_lib_Re.U) + if (c == 103): + self._hx_global = True + self.pattern = python_lib_Re.compile(r,options) + + def match(self,s): + self.matchObj = python_lib_Re.search(self.pattern,s) + return (self.matchObj is not None) + + def matched(self,n): + return self.matchObj.group(n) + + def matchedLeft(self): + return HxString.substr(self.matchObj.string,0,self.matchObj.start()) + + def matchedRight(self): + return HxString.substr(self.matchObj.string,self.matchObj.end(),None) + + def matchedPos(self): + return _hx_AnonObject({'pos': self.matchObj.start(), 'len': (self.matchObj.end() - self.matchObj.start())}) + + def matchSub(self,s,pos,_hx_len = None): + if (_hx_len is None): + _hx_len = -1 + if (_hx_len != -1): + self.matchObj = self.pattern.search(s,pos,(pos + _hx_len)) + else: + self.matchObj = self.pattern.search(s,pos) + return (self.matchObj is not None) + + def split(self,s): + if self._hx_global: + ret = [] + lastEnd = 0 + x = python_HaxeIterator(python_lib_Re.finditer(self.pattern,s)) + while x.hasNext(): + x1 = x.next() + x2 = HxString.substring(s,lastEnd,x1.start()) + ret.append(x2) + lastEnd = x1.end() + x = HxString.substr(s,lastEnd,None) + ret.append(x) + return ret + else: + self.matchObj = python_lib_Re.search(self.pattern,s) + if (self.matchObj is None): + return [s] + else: + return [HxString.substring(s,0,self.matchObj.start()), HxString.substr(s,self.matchObj.end(),None)] + + def replace(self,s,by): + _this = by.split("$$") + by = "_hx_#repl#__".join([python_Boot.toString1(x1,'') for x1 in _this]) + def _hx_local_0(x): + res = by + g = x.groups() + _g = 0 + _g1 = len(g) + while (_g < _g1): + i = _g + _g = (_g + 1) + gs = g[i] + if (gs is None): + continue + delimiter = ("$" + HxOverrides.stringOrNull(str((i + 1)))) + _this = (list(res) if ((delimiter == "")) else res.split(delimiter)) + res = gs.join([python_Boot.toString1(x1,'') for x1 in _this]) + _this = res.split("_hx_#repl#__") + res = "$".join([python_Boot.toString1(x1,'') for x1 in _this]) + return res + replace = _hx_local_0 + return python_lib_Re.sub(self.pattern,replace,s,(0 if (self._hx_global) else 1)) + + def map(self,s,f): + buf_b = python_lib_io_StringIO() + pos = 0 + right = s + cur = self + while (pos < len(s)): + if (self.matchObj is None): + self.matchObj = python_lib_Re.search(self.pattern,s) + else: + self.matchObj = self.matchObj.re.search(s,pos) + if (self.matchObj is None): + break + pos1 = self.matchObj.end() + curPos_pos = cur.matchObj.start() + curPos_len = (cur.matchObj.end() - cur.matchObj.start()) + buf_b.write(Std.string(HxString.substr(HxString.substr(cur.matchObj.string,0,cur.matchObj.start()),pos,None))) + buf_b.write(Std.string(f(cur))) + right = HxString.substr(cur.matchObj.string,cur.matchObj.end(),None) + if (not self._hx_global): + buf_b.write(Std.string(right)) + return buf_b.getvalue() + if (curPos_len == 0): + buf_b.write(Std.string(("" if (((pos1 < 0) or ((pos1 >= len(s))))) else s[pos1]))) + right = HxString.substr(right,1,None) + pos = (pos1 + 1) + else: + pos = pos1 + buf_b.write(Std.string(right)) + return buf_b.getvalue() + + @staticmethod + def escape(s): + return python_lib_Re.escape(s) + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.pattern = None + _hx_o.matchObj = None + _hx_o._hx_global = None + + +class _EnumValue_EnumValue_Impl_: + _hx_class_name = "_EnumValue.EnumValue_Impl_" + __slots__ = () + _hx_statics = ["match"] + + @staticmethod + def match(this1,pattern): + return False + + +class IntIterator: + _hx_class_name = "IntIterator" + __slots__ = ("min", "max") + _hx_fields = ["min", "max"] + _hx_methods = ["hasNext", "next"] + + def __init__(self,_hx_min,_hx_max): + self.min = _hx_min + self.max = _hx_max + + def hasNext(self): + return (self.min < self.max) + + def next(self): + def _hx_local_3(): + def _hx_local_2(): + _hx_local_0 = self + _hx_local_1 = _hx_local_0.min + _hx_local_0.min = (_hx_local_1 + 1) + return _hx_local_1 + return _hx_local_2() + return _hx_local_3() + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.min = None + _hx_o.max = None + + +class Reflect: + _hx_class_name = "Reflect" + __slots__ = () + _hx_statics = ["hasField", "field", "setField", "getProperty", "setProperty", "callMethod", "fields", "isFunction", "compare", "isClosure", "compareMethods", "isObject", "isEnumValue", "deleteField", "copy", "makeVarArgs"] + + @staticmethod + def hasField(o,field): + return python_Boot.hasField(o,field) + + @staticmethod + def field(o,field): + return python_Boot.field(o,field) + + @staticmethod + def setField(o,field,value): + setattr(o,(("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)),value) + + @staticmethod + def getProperty(o,field): + if (o is None): + return None + if (field in python_Boot.keywords): + field = ("_hx_" + field) + elif ((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95))): + field = ("_hx_" + field) + if isinstance(o,_hx_AnonObject): + return Reflect.field(o,field) + tmp = Reflect.field(o,("get_" + ("null" if field is None else field))) + if ((tmp is not None) and callable(tmp)): + return tmp() + else: + return Reflect.field(o,field) + + @staticmethod + def setProperty(o,field,value): + field1 = (("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)) + if isinstance(o,_hx_AnonObject): + setattr(o,field1,value) + elif hasattr(o,("set_" + ("null" if field1 is None else field1))): + getattr(o,("set_" + ("null" if field1 is None else field1)))(value) + else: + setattr(o,field1,value) + + @staticmethod + def callMethod(o,func,args): + if callable(func): + return func(*args) + else: + return None + + @staticmethod + def fields(o): + return python_Boot.fields(o) + + @staticmethod + def isFunction(f): + if (not ((python_lib_Inspect.isfunction(f) or python_lib_Inspect.ismethod(f)))): + return python_Boot.hasField(f,"func_code") + else: + return True + + @staticmethod + def compare(a,b): + if ((a is None) and ((b is None))): + return 0 + if (a is None): + return 1 + elif (b is None): + return -1 + elif HxOverrides.eq(a,b): + return 0 + elif (a > b): + return 1 + else: + return -1 + + @staticmethod + def isClosure(v): + return isinstance(v,python_internal_MethodClosure) + + @staticmethod + def compareMethods(f1,f2): + if HxOverrides.eq(f1,f2): + return True + if (isinstance(f1,python_internal_MethodClosure) and isinstance(f2,python_internal_MethodClosure)): + m1 = f1 + m2 = f2 + if HxOverrides.eq(m1.obj,m2.obj): + return (m1.func == m2.func) + else: + return False + if ((not Reflect.isFunction(f1)) or (not Reflect.isFunction(f2))): + return False + return False + + @staticmethod + def isObject(v): + _g = Type.typeof(v) + tmp = _g.index + if (tmp == 4): + return True + elif (tmp == 6): + _g1 = _g.params[0] + return True + else: + return False + + @staticmethod + def isEnumValue(v): + if not HxOverrides.eq(v,Enum): + return isinstance(v,Enum) + else: + return False + + @staticmethod + def deleteField(o,field): + if (field in python_Boot.keywords): + field = ("_hx_" + field) + elif ((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95))): + field = ("_hx_" + field) + if (not python_Boot.hasField(o,field)): + return False + o.__delattr__(field) + return True + + @staticmethod + def copy(o): + if (o is None): + return None + o2 = _hx_AnonObject({}) + _g = 0 + _g1 = python_Boot.fields(o) + while (_g < len(_g1)): + f = (_g1[_g] if _g >= 0 and _g < len(_g1) else None) + _g = (_g + 1) + value = Reflect.field(o,f) + setattr(o2,(("_hx_" + f) if ((f in python_Boot.keywords)) else (("_hx_" + f) if (((((len(f) > 2) and ((ord(f[0]) == 95))) and ((ord(f[1]) == 95))) and ((ord(f[(len(f) - 1)]) != 95)))) else f)),value) + return o2 + + @staticmethod + def makeVarArgs(f): + def _hx_local_0(*v): + this1 = v + return f((list(this1) if ((not Std.isOfType(this1,list))) else this1)) + return _hx_local_0 + + +class Std: + _hx_class_name = "Std" + __slots__ = () + _hx_statics = ["downcast", "instance", "isMetaType", "is", "isOfType", "string", "int", "parseInt", "shortenPossibleNumber", "parseFloat", "random"] + + @staticmethod + def downcast(value,c): + try: + tmp = None + if (not isinstance(value,c)): + if c._hx_is_interface: + cls = c + loop = None + def _hx_local_1(intf): + f = (intf._hx_interfaces if (hasattr(intf,"_hx_interfaces")) else []) + if (f is not None): + _g = 0 + while (_g < len(f)): + i = (f[_g] if _g >= 0 and _g < len(f) else None) + _g = (_g + 1) + if (i == cls): + return True + else: + l = loop(i) + if l: + return True + return False + else: + return False + loop = _hx_local_1 + currentClass = value.__class__ + result = False + while (currentClass is not None): + if loop(currentClass): + result = True + break + currentClass = python_Boot.getSuperClass(currentClass) + tmp = result + else: + tmp = False + else: + tmp = True + if tmp: + return value + else: + return None + except BaseException as _g: + None + return None + + @staticmethod + def instance(value,c): + return Std.downcast(value,c) + + @staticmethod + def isMetaType(v,t): + return ((type(v) == type) and (v == t)) + + @staticmethod + def _hx_is(v,t): + return Std.isOfType(v,t) + + @staticmethod + def isOfType(v,t): + if ((v is None) and ((t is None))): + return False + if (t is None): + return False + if ((type(t) == type) and (t == Dynamic)): + return (v is not None) + isBool = isinstance(v,bool) + if (((type(t) == type) and (t == Bool)) and isBool): + return True + if ((((not isBool) and (not ((type(t) == type) and (t == Bool)))) and ((type(t) == type) and (t == Int))) and isinstance(v,int)): + return True + vIsFloat = isinstance(v,float) + tmp = None + tmp1 = None + if (((not isBool) and vIsFloat) and ((type(t) == type) and (t == Int))): + f = v + tmp1 = (((f != Math.POSITIVE_INFINITY) and ((f != Math.NEGATIVE_INFINITY))) and (not python_lib_Math.isnan(f))) + else: + tmp1 = False + if tmp1: + tmp1 = None + try: + tmp1 = int(v) + except BaseException as _g: + None + tmp1 = None + tmp = (v == tmp1) + else: + tmp = False + if ((tmp and ((v <= 2147483647))) and ((v >= -2147483648))): + return True + if (((not isBool) and ((type(t) == type) and (t == Float))) and isinstance(v,(float, int))): + return True + if ((type(t) == type) and (t == str)): + return isinstance(v,str) + isEnumType = ((type(t) == type) and (t == Enum)) + if ((isEnumType and python_lib_Inspect.isclass(v)) and hasattr(v,"_hx_constructs")): + return True + if isEnumType: + return False + isClassType = ((type(t) == type) and (t == Class)) + if ((((isClassType and (not isinstance(v,Enum))) and python_lib_Inspect.isclass(v)) and hasattr(v,"_hx_class_name")) and (not hasattr(v,"_hx_constructs"))): + return True + if isClassType: + return False + tmp = None + try: + tmp = isinstance(v,t) + except BaseException as _g: + None + tmp = False + if tmp: + return True + if python_lib_Inspect.isclass(t): + cls = t + loop = None + def _hx_local_1(intf): + f = (intf._hx_interfaces if (hasattr(intf,"_hx_interfaces")) else []) + if (f is not None): + _g = 0 + while (_g < len(f)): + i = (f[_g] if _g >= 0 and _g < len(f) else None) + _g = (_g + 1) + if (i == cls): + return True + else: + l = loop(i) + if l: + return True + return False + else: + return False + loop = _hx_local_1 + currentClass = v.__class__ + result = False + while (currentClass is not None): + if loop(currentClass): + result = True + break + currentClass = python_Boot.getSuperClass(currentClass) + return result + else: + return False + + @staticmethod + def string(s): + return python_Boot.toString1(s,"") + + @staticmethod + def int(x): + try: + return int(x) + except BaseException as _g: + None + return None + + @staticmethod + def parseInt(x): + if (x is None): + return None + try: + return int(x) + except BaseException as _g: + None + base = 10 + _hx_len = len(x) + foundCount = 0 + sign = 0 + firstDigitIndex = 0 + lastDigitIndex = -1 + previous = 0 + _g = 0 + _g1 = _hx_len + while (_g < _g1): + i = _g + _g = (_g + 1) + c = (-1 if ((i >= len(x))) else ord(x[i])) + if (((c > 8) and ((c < 14))) or ((c == 32))): + if (foundCount > 0): + return None + continue + else: + c1 = c + if (c1 == 43): + if (foundCount == 0): + sign = 1 + elif (not (((48 <= c) and ((c <= 57))))): + if (not (((base == 16) and ((((97 <= c) and ((c <= 122))) or (((65 <= c) and ((c <= 90))))))))): + break + elif (c1 == 45): + if (foundCount == 0): + sign = -1 + elif (not (((48 <= c) and ((c <= 57))))): + if (not (((base == 16) and ((((97 <= c) and ((c <= 122))) or (((65 <= c) and ((c <= 90))))))))): + break + elif (c1 == 48): + if (not (((foundCount == 0) or (((foundCount == 1) and ((sign != 0))))))): + if (not (((48 <= c) and ((c <= 57))))): + if (not (((base == 16) and ((((97 <= c) and ((c <= 122))) or (((65 <= c) and ((c <= 90))))))))): + break + elif ((c1 == 120) or ((c1 == 88))): + if ((previous == 48) and ((((foundCount == 1) and ((sign == 0))) or (((foundCount == 2) and ((sign != 0))))))): + base = 16 + elif (not (((48 <= c) and ((c <= 57))))): + if (not (((base == 16) and ((((97 <= c) and ((c <= 122))) or (((65 <= c) and ((c <= 90))))))))): + break + elif (not (((48 <= c) and ((c <= 57))))): + if (not (((base == 16) and ((((97 <= c) and ((c <= 122))) or (((65 <= c) and ((c <= 90))))))))): + break + if (((foundCount == 0) and ((sign == 0))) or (((foundCount == 1) and ((sign != 0))))): + firstDigitIndex = i + foundCount = (foundCount + 1) + lastDigitIndex = i + previous = c + if (firstDigitIndex <= lastDigitIndex): + digits = HxString.substring(x,firstDigitIndex,(lastDigitIndex + 1)) + try: + return (((-1 if ((sign == -1)) else 1)) * int(digits,base)) + except BaseException as _g: + return None + return None + + @staticmethod + def shortenPossibleNumber(x): + r = "" + _g = 0 + _g1 = len(x) + while (_g < _g1): + i = _g + _g = (_g + 1) + c = ("" if (((i < 0) or ((i >= len(x))))) else x[i]) + _g2 = HxString.charCodeAt(c,0) + if (_g2 is None): + break + else: + _g3 = _g2 + if (((((((((((_g3 == 57) or ((_g3 == 56))) or ((_g3 == 55))) or ((_g3 == 54))) or ((_g3 == 53))) or ((_g3 == 52))) or ((_g3 == 51))) or ((_g3 == 50))) or ((_g3 == 49))) or ((_g3 == 48))) or ((_g3 == 46))): + r = (("null" if r is None else r) + ("null" if c is None else c)) + else: + break + return r + + @staticmethod + def parseFloat(x): + try: + return float(x) + except BaseException as _g: + None + if (x is not None): + r1 = Std.shortenPossibleNumber(x) + if (r1 != x): + return Std.parseFloat(r1) + return Math.NaN + + @staticmethod + def random(x): + if (x <= 0): + return 0 + else: + return int((python_lib_Random.random() * x)) + + +class Float: pass + + +class Int: pass + + +class Bool: pass + + +class Dynamic: pass + + +class StringBuf: + _hx_class_name = "StringBuf" + __slots__ = ("b",) + _hx_fields = ["b"] + _hx_methods = ["get_length", "add", "add1", "addChar", "addSub", "toString"] + + def __init__(self): + self.b = python_lib_io_StringIO() + + def get_length(self): + pos = self.b.tell() + self.b.seek(0,2) + _hx_len = self.b.tell() + self.b.seek(pos,0) + return _hx_len + + def add(self,x): + s = Std.string(x) + self.b.write(s) + + def add1(self,s): + self.b.write(s) + + def addChar(self,c): + s = "".join(map(chr,[c])) + self.b.write(s) + + def addSub(self,s,pos,_hx_len = None): + s1 = (HxString.substr(s,pos,None) if ((_hx_len is None)) else HxString.substr(s,pos,_hx_len)) + self.b.write(s1) + + def toString(self): + return self.b.getvalue() + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.b = None + + +class haxe_SysTools: + _hx_class_name = "haxe.SysTools" + __slots__ = () + _hx_statics = ["winMetaCharacters", "quoteUnixArg", "quoteWinArg"] + + @staticmethod + def quoteUnixArg(argument): + if (argument == ""): + return "''" + _this = EReg("[^a-zA-Z0-9_@%+=:,./-]","") + _this.matchObj = python_lib_Re.search(_this.pattern,argument) + if (_this.matchObj is None): + return argument + return (("'" + HxOverrides.stringOrNull(StringTools.replace(argument,"'","'\"'\"'"))) + "'") + + @staticmethod + def quoteWinArg(argument,escapeMetaCharacters): + _this = EReg("^[^ \t\\\\\"]+$","") + _this.matchObj = python_lib_Re.search(_this.pattern,argument) + if (_this.matchObj is None): + result_b = python_lib_io_StringIO() + needquote = None + startIndex = None + if (((argument.find(" ") if ((startIndex is None)) else HxString.indexOfImpl(argument," ",startIndex))) == -1): + startIndex = None + needquote = (((argument.find("\t") if ((startIndex is None)) else HxString.indexOfImpl(argument,"\t",startIndex))) != -1) + else: + needquote = True + needquote1 = (needquote or ((argument == ""))) + if needquote1: + result_b.write("\"") + bs_buf = StringBuf() + _g = 0 + _g1 = len(argument) + while (_g < _g1): + i = _g + _g = (_g + 1) + _g2 = HxString.charCodeAt(argument,i) + if (_g2 is None): + c = _g2 + if (bs_buf.get_length() > 0): + result_b.write(Std.string(bs_buf.b.getvalue())) + bs_buf = StringBuf() + result_b.write("".join(map(chr,[c]))) + else: + _g3 = _g2 + if (_g3 == 34): + bs = bs_buf.b.getvalue() + result_b.write(Std.string(bs)) + result_b.write(Std.string(bs)) + bs_buf = StringBuf() + result_b.write("\\\"") + elif (_g3 == 92): + bs_buf.b.write("\\") + else: + c1 = _g2 + if (bs_buf.get_length() > 0): + result_b.write(Std.string(bs_buf.b.getvalue())) + bs_buf = StringBuf() + result_b.write("".join(map(chr,[c1]))) + result_b.write(Std.string(bs_buf.b.getvalue())) + if needquote1: + result_b.write(Std.string(bs_buf.b.getvalue())) + result_b.write("\"") + argument = result_b.getvalue() + if escapeMetaCharacters: + result_b = python_lib_io_StringIO() + _g = 0 + _g1 = len(argument) + while (_g < _g1): + i = _g + _g = (_g + 1) + c = HxString.charCodeAt(argument,i) + if (python_internal_ArrayImpl.indexOf(haxe_SysTools.winMetaCharacters,c,None) >= 0): + result_b.write("".join(map(chr,[94]))) + result_b.write("".join(map(chr,[c]))) + return result_b.getvalue() + else: + return argument + + +class StringTools: + _hx_class_name = "StringTools" + __slots__ = () + _hx_statics = ["urlEncode", "urlDecode", "htmlEscape", "htmlUnescape", "contains", "startsWith", "endsWith", "isSpace", "ltrim", "rtrim", "trim", "lpad", "rpad", "replace", "hex", "fastCodeAt", "unsafeCodeAt", "iterator", "keyValueIterator", "isEof", "quoteUnixArg", "winMetaCharacters", "quoteWinArg"] + + @staticmethod + def urlEncode(s): + return python_lib_urllib_Parse.quote(s,"") + + @staticmethod + def urlDecode(s): + return python_lib_urllib_Parse.unquote(s) + + @staticmethod + def htmlEscape(s,quotes = None): + buf_b = python_lib_io_StringIO() + _g_offset = 0 + _g_s = s + while (_g_offset < len(_g_s)): + index = _g_offset + _g_offset = (_g_offset + 1) + code = ord(_g_s[index]) + code1 = code + if (code1 == 34): + if quotes: + buf_b.write(""") + else: + buf_b.write("".join(map(chr,[code]))) + elif (code1 == 38): + buf_b.write("&") + elif (code1 == 39): + if quotes: + buf_b.write("'") + else: + buf_b.write("".join(map(chr,[code]))) + elif (code1 == 60): + buf_b.write("<") + elif (code1 == 62): + buf_b.write(">") + else: + buf_b.write("".join(map(chr,[code]))) + return buf_b.getvalue() + + @staticmethod + def htmlUnescape(s): + _this = s.split(">") + _this1 = ">".join([python_Boot.toString1(x1,'') for x1 in _this]) + _this = _this1.split("<") + _this1 = "<".join([python_Boot.toString1(x1,'') for x1 in _this]) + _this = _this1.split(""") + _this1 = "\"".join([python_Boot.toString1(x1,'') for x1 in _this]) + _this = _this1.split("'") + _this1 = "'".join([python_Boot.toString1(x1,'') for x1 in _this]) + _this = _this1.split("&") + return "&".join([python_Boot.toString1(x1,'') for x1 in _this]) + + @staticmethod + def contains(s,value): + startIndex = None + return (((s.find(value) if ((startIndex is None)) else HxString.indexOfImpl(s,value,startIndex))) != -1) + + @staticmethod + def startsWith(s,start): + return s.startswith(start) + + @staticmethod + def endsWith(s,end): + return s.endswith(end) + + @staticmethod + def isSpace(s,pos): + if (((len(s) == 0) or ((pos < 0))) or ((pos >= len(s)))): + return False + c = HxString.charCodeAt(s,pos) + if (not (((c > 8) and ((c < 14))))): + return (c == 32) + else: + return True + + @staticmethod + def ltrim(s): + l = len(s) + r = 0 + while ((r < l) and StringTools.isSpace(s,r)): + r = (r + 1) + if (r > 0): + return HxString.substr(s,r,(l - r)) + else: + return s + + @staticmethod + def rtrim(s): + l = len(s) + r = 0 + while ((r < l) and StringTools.isSpace(s,((l - r) - 1))): + r = (r + 1) + if (r > 0): + return HxString.substr(s,0,(l - r)) + else: + return s + + @staticmethod + def trim(s): + return StringTools.ltrim(StringTools.rtrim(s)) + + @staticmethod + def lpad(s,c,l): + if (len(c) <= 0): + return s + buf = StringBuf() + l = (l - len(s)) + while (buf.get_length() < l): + s1 = Std.string(c) + buf.b.write(s1) + s1 = Std.string(s) + buf.b.write(s1) + return buf.b.getvalue() + + @staticmethod + def rpad(s,c,l): + if (len(c) <= 0): + return s + buf = StringBuf() + s1 = Std.string(s) + buf.b.write(s1) + while (buf.get_length() < l): + s = Std.string(c) + buf.b.write(s) + return buf.b.getvalue() + + @staticmethod + def replace(s,sub,by): + _this = (list(s) if ((sub == "")) else s.split(sub)) + return by.join([python_Boot.toString1(x1,'') for x1 in _this]) + + @staticmethod + def hex(n,digits = None): + s = "" + hexChars = "0123456789ABCDEF" + while True: + index = (n & 15) + s = (HxOverrides.stringOrNull((("" if (((index < 0) or ((index >= len(hexChars))))) else hexChars[index]))) + ("null" if s is None else s)) + n = HxOverrides.rshift(n, 4) + if (not ((n > 0))): + break + if ((digits is not None) and ((len(s) < digits))): + diff = (digits - len(s)) + _g = 0 + _g1 = diff + while (_g < _g1): + _ = _g + _g = (_g + 1) + s = ("0" + ("null" if s is None else s)) + return s + + @staticmethod + def fastCodeAt(s,index): + if (index >= len(s)): + return -1 + else: + return ord(s[index]) + + @staticmethod + def unsafeCodeAt(s,index): + return ord(s[index]) + + @staticmethod + def iterator(s): + return haxe_iterators_StringIterator(s) + + @staticmethod + def keyValueIterator(s): + return haxe_iterators_StringKeyValueIterator(s) + + @staticmethod + def isEof(c): + return (c == -1) + + @staticmethod + def quoteUnixArg(argument): + if (argument == ""): + return "''" + else: + _this = EReg("[^a-zA-Z0-9_@%+=:,./-]","") + _this.matchObj = python_lib_Re.search(_this.pattern,argument) + if (_this.matchObj is None): + return argument + else: + return (("'" + HxOverrides.stringOrNull(StringTools.replace(argument,"'","'\"'\"'"))) + "'") + + @staticmethod + def quoteWinArg(argument,escapeMetaCharacters): + argument1 = argument + _this = EReg("^[^ \t\\\\\"]+$","") + _this.matchObj = python_lib_Re.search(_this.pattern,argument1) + if (_this.matchObj is None): + result_b = python_lib_io_StringIO() + needquote = None + startIndex = None + if (((argument1.find(" ") if ((startIndex is None)) else HxString.indexOfImpl(argument1," ",startIndex))) == -1): + startIndex = None + needquote = (((argument1.find("\t") if ((startIndex is None)) else HxString.indexOfImpl(argument1,"\t",startIndex))) != -1) + else: + needquote = True + needquote1 = (needquote or ((argument1 == ""))) + if needquote1: + result_b.write("\"") + bs_buf = StringBuf() + _g = 0 + _g1 = len(argument1) + while (_g < _g1): + i = _g + _g = (_g + 1) + _g2 = HxString.charCodeAt(argument1,i) + if (_g2 is None): + c = _g2 + if (bs_buf.get_length() > 0): + result_b.write(Std.string(bs_buf.b.getvalue())) + bs_buf = StringBuf() + result_b.write("".join(map(chr,[c]))) + else: + _g3 = _g2 + if (_g3 == 34): + bs = bs_buf.b.getvalue() + result_b.write(Std.string(bs)) + result_b.write(Std.string(bs)) + bs_buf = StringBuf() + result_b.write("\\\"") + elif (_g3 == 92): + bs_buf.b.write("\\") + else: + c1 = _g2 + if (bs_buf.get_length() > 0): + result_b.write(Std.string(bs_buf.b.getvalue())) + bs_buf = StringBuf() + result_b.write("".join(map(chr,[c1]))) + result_b.write(Std.string(bs_buf.b.getvalue())) + if needquote1: + result_b.write(Std.string(bs_buf.b.getvalue())) + result_b.write("\"") + argument1 = result_b.getvalue() + if escapeMetaCharacters: + result_b = python_lib_io_StringIO() + _g = 0 + _g1 = len(argument1) + while (_g < _g1): + i = _g + _g = (_g + 1) + c = HxString.charCodeAt(argument1,i) + if (python_internal_ArrayImpl.indexOf(haxe_SysTools.winMetaCharacters,c,None) >= 0): + result_b.write("".join(map(chr,[94]))) + result_b.write("".join(map(chr,[c]))) + return result_b.getvalue() + else: + return argument1 + + +class sys_FileSystem: + _hx_class_name = "sys.FileSystem" + __slots__ = () + _hx_statics = ["exists", "stat", "rename", "fullPath", "absolutePath", "isDirectory", "createDirectory", "deleteFile", "deleteDirectory", "readDirectory"] + + @staticmethod + def exists(path): + return python_lib_os_Path.exists(path) + + @staticmethod + def stat(path): + s = python_lib_Os.stat(path) + return _hx_AnonObject({'gid': s.st_gid, 'uid': s.st_uid, 'atime': Date.fromTime((1000 * s.st_atime)), 'mtime': Date.fromTime((1000 * s.st_mtime)), 'ctime': Date.fromTime((1000 * s.st_ctime)), 'size': s.st_size, 'dev': s.st_dev, 'ino': s.st_ino, 'nlink': s.st_nlink, 'rdev': getattr(s,"st_rdev",0), 'mode': s.st_mode}) + + @staticmethod + def rename(path,newPath): + python_lib_Os.rename(path,newPath) + + @staticmethod + def fullPath(relPath): + return python_lib_os_Path.realpath(relPath) + + @staticmethod + def absolutePath(relPath): + if haxe_io_Path.isAbsolute(relPath): + return relPath + return haxe_io_Path.join([Sys.getCwd(), relPath]) + + @staticmethod + def isDirectory(path): + return python_lib_os_Path.isdir(path) + + @staticmethod + def createDirectory(path): + python_lib_Os.makedirs(path,511,True) + + @staticmethod + def deleteFile(path): + python_lib_Os.remove(path) + + @staticmethod + def deleteDirectory(path): + python_lib_Os.rmdir(path) + + @staticmethod + def readDirectory(path): + return python_lib_Os.listdir(path) + + +class Sys: + _hx_class_name = "Sys" + __slots__ = () + _hx_statics = ["environ", "get_environ", "time", "exit", "print", "println", "args", "getEnv", "putEnv", "environment", "sleep", "setTimeLocale", "getCwd", "setCwd", "systemName", "command", "cpuTime", "executablePath", "_programPath", "programPath", "getChar", "stdin", "stdout", "stderr"] + environ = None + + @staticmethod + def get_environ(): + _g = Sys.environ + if (_g is None): + environ = haxe_ds_StringMap() + env = python_lib_Os.environ + key = python_HaxeIterator(iter(env.keys())) + while key.hasNext(): + key1 = key.next() + value = env.get(key1,None) + environ.h[key1] = value + def _hx_local_1(): + def _hx_local_0(): + Sys.environ = environ + return Sys.environ + return _hx_local_0() + return _hx_local_1() + else: + env = _g + return env + + @staticmethod + def time(): + return python_lib_Time.time() + + @staticmethod + def exit(code): + python_lib_Sys.exit(code) + + @staticmethod + def print(v): + python_Lib.printString(Std.string(v)) + + @staticmethod + def println(v): + _hx_str = Std.string(v) + python_Lib.printString((("" + ("null" if _hx_str is None else _hx_str)) + HxOverrides.stringOrNull(python_Lib.lineEnd))) + + @staticmethod + def args(): + argv = python_lib_Sys.argv + return argv[1:None] + + @staticmethod + def getEnv(s): + return Sys.get_environ().h.get(s,None) + + @staticmethod + def putEnv(s,v): + python_lib_Os.putenv(s,v) + Sys.get_environ().h[s] = v + + @staticmethod + def environment(): + return Sys.get_environ() + + @staticmethod + def sleep(seconds): + python_lib_Time.sleep(seconds) + + @staticmethod + def setTimeLocale(loc): + return False + + @staticmethod + def getCwd(): + return python_lib_Os.getcwd() + + @staticmethod + def setCwd(s): + python_lib_Os.chdir(s) + + @staticmethod + def systemName(): + _g = python_lib_Sys.platform + x = _g + if x.startswith("linux"): + return "Linux" + else: + _g1 = _g + _hx_local_0 = len(_g1) + if (_hx_local_0 == 5): + if (_g1 == "win32"): + return "Windows" + else: + raise haxe_Exception.thrown("not supported platform") + elif (_hx_local_0 == 6): + if (_g1 == "cygwin"): + return "Windows" + elif (_g1 == "darwin"): + return "Mac" + else: + raise haxe_Exception.thrown("not supported platform") + else: + raise haxe_Exception.thrown("not supported platform") + + @staticmethod + def command(cmd,args = None): + if (args is None): + return python_lib_Subprocess.call(cmd,**python__KwArgs_KwArgs_Impl_.fromT(_hx_AnonObject({'shell': True}))) + else: + return python_lib_Subprocess.call(([cmd] + args)) + + @staticmethod + def cpuTime(): + return python_lib_Timeit.default_timer() + + @staticmethod + def executablePath(): + return python_internal_ArrayImpl._get(python_lib_Sys.argv, 0) + + @staticmethod + def programPath(): + return Sys._programPath + + @staticmethod + def getChar(echo): + ch = None + _g = Sys.systemName() + _g1 = _g + _hx_local_0 = len(_g1) + if (_hx_local_0 == 5): + if (_g1 == "Linux"): + fd = python_lib_Sys.stdin.fileno() + old = python_lib_Termios.tcgetattr(fd) + fileNo = fd + when = python_lib_Termios.TCSADRAIN + settings = old + def _hx_local_1(): + python_lib_Termios.tcsetattr(fileNo,when,settings) + restore = _hx_local_1 + try: + python_lib_Tty.setraw(fd) + x = python_lib_Sys.stdin.read(1) + restore() + ch = HxString.charCodeAt(x,0) + except BaseException as _g1: + None + e = haxe_Exception.caught(_g1).unwrap() + restore() + raise haxe_Exception.thrown(e) + else: + x = _g + raise haxe_Exception.thrown((("platform " + ("null" if x is None else x)) + " not supported")) + elif (_hx_local_0 == 3): + if (_g1 == "Mac"): + fd = python_lib_Sys.stdin.fileno() + old = python_lib_Termios.tcgetattr(fd) + fileNo = fd + when = python_lib_Termios.TCSADRAIN + settings = old + def _hx_local_2(): + python_lib_Termios.tcsetattr(fileNo,when,settings) + restore = _hx_local_2 + try: + python_lib_Tty.setraw(fd) + x = python_lib_Sys.stdin.read(1) + restore() + ch = HxString.charCodeAt(x,0) + except BaseException as _g1: + None + e = haxe_Exception.caught(_g1).unwrap() + restore() + raise haxe_Exception.thrown(e) + else: + x = _g + raise haxe_Exception.thrown((("platform " + ("null" if x is None else x)) + " not supported")) + elif (_hx_local_0 == 7): + if (_g1 == "Windows"): + ch = HxString.charCodeAt(python_lib_Msvcrt.getwch(),0) + else: + x = _g + raise haxe_Exception.thrown((("platform " + ("null" if x is None else x)) + " not supported")) + else: + x = _g + raise haxe_Exception.thrown((("platform " + ("null" if x is None else x)) + " not supported")) + if echo: + python_Lib.printString(Std.string("".join(map(chr,[ch])))) + return ch + + @staticmethod + def stdin(): + return python_io_IoTools.createFileInputFromText(python_lib_Sys.stdin) + + @staticmethod + def stdout(): + return python_io_IoTools.createFileOutputFromText(python_lib_Sys.stdout) + + @staticmethod + def stderr(): + return python_io_IoTools.createFileOutputFromText(python_lib_Sys.stderr) + + +class Test: + _hx_class_name = "Test" + __slots__ = () + _hx_statics = ["main"] + + @staticmethod + def main(): + haxe_Log.trace("starting tests",_hx_AnonObject({'fileName': "src/Test.hx", 'lineNumber': 6, 'className': "Test", 'methodName': "main"})) + Query = xrfragment_Query + haxe_Log.trace(xrfragment_Query("foo or bar").toObject(),_hx_AnonObject({'fileName': "src/Test.hx", 'lineNumber': 10, 'className': "Test", 'methodName': "main"})) + haxe_Log.trace(HxOverrides.arrayGet(Reflect.field(xrfragment_Query("class:fopoer or bar foo:bar").toObject(),"or"), 0),_hx_AnonObject({'fileName': "src/Test.hx", 'lineNumber': 11, 'className': "Test", 'methodName': "main"})) + haxe_Log.trace(HxOverrides.arrayGet(Reflect.field(xrfragment_Query("-skybox class:foo").toObject(),"or"), 0),_hx_AnonObject({'fileName': "src/Test.hx", 'lineNumber': 12, 'className': "Test", 'methodName': "main"})) + haxe_Log.trace(HxOverrides.arrayGet(Reflect.field(xrfragment_Query("foo/flop moo or bar").toObject(),"or"), 0),_hx_AnonObject({'fileName': "src/Test.hx", 'lineNumber': 13, 'className': "Test", 'methodName': "main"})) + haxe_Log.trace(HxOverrides.arrayGet(Reflect.field(xrfragment_Query("-foo/flop moo or bar").toObject(),"or"), 0),_hx_AnonObject({'fileName': "src/Test.hx", 'lineNumber': 14, 'className': "Test", 'methodName': "main"})) + haxe_Log.trace(HxOverrides.arrayGet(Reflect.field(xrfragment_Query("price:>4 moo or bar").toObject(),"or"), 0),_hx_AnonObject({'fileName': "src/Test.hx", 'lineNumber': 15, 'className': "Test", 'methodName': "main"})) + haxe_Log.trace(HxOverrides.arrayGet(Reflect.field(xrfragment_Query("price:>=4 moo or bar").toObject(),"or"), 0),_hx_AnonObject({'fileName': "src/Test.hx", 'lineNumber': 16, 'className': "Test", 'methodName': "main"})) + haxe_Log.trace(HxOverrides.arrayGet(Reflect.field(xrfragment_Query("price:<=4 moo or bar").toObject(),"or"), 0),_hx_AnonObject({'fileName': "src/Test.hx", 'lineNumber': 17, 'className': "Test", 'methodName': "main"})) + haxe_Log.trace(HxOverrides.arrayGet(Reflect.field(xrfragment_Query("price:!=4 moo or bar").toObject(),"or"), 0),_hx_AnonObject({'fileName': "src/Test.hx", 'lineNumber': 18, 'className': "Test", 'methodName': "main"})) + q = xrfragment_Query("price:!=4 moo or bar") + obj = Reflect.field(q,"toObject")() + Reflect.field(q,"test")("price",4) + ok = (not Reflect.field(q,"qualify")("slkklskdf")) + if (not ok): + raise haxe_Exception.thrown("node should not be allowed") + q = xrfragment_Query("price:!=3 moo or bar") + obj = Reflect.field(q,"toObject")() + Reflect.field(q,"test")("price",4) + ok = Reflect.field(q,"qualify")("slkklskdf") + if (not ok): + raise haxe_Exception.thrown("non-mentioned node should be allowed") + q = xrfragment_Query("moo or bar") + obj = Reflect.field(q,"toObject")() + ok = (not Reflect.field(q,"qualify")("slkklskdf")) + if (not ok): + raise haxe_Exception.thrown("node should not be allowed") + obj = Reflect.field(q,"toObject")() + ok = Reflect.field(q,"qualify")("moo") + if (not ok): + raise haxe_Exception.thrown("moo should be allowed") + ok = Reflect.field(q,"qualify")("bar") + if (not ok): + raise haxe_Exception.thrown("bar should be allowed") + q = xrfragment_Query("price:>3 moo or bar") + obj = Reflect.field(q,"toObject")() + Reflect.field(q,"test")("price",4) + ok = Reflect.field(q,"qualify")("foo") + if (not ok): + raise haxe_Exception.thrown("node should be allowed") + ok = Reflect.field(q,"qualify")("bar") + if (not ok): + raise haxe_Exception.thrown("node should be allowed") + ok = Reflect.field(q,"qualify")("moo") + if (not ok): + raise haxe_Exception.thrown("node should be allowed") + q = xrfragment_Query("price:>3 price:<10 -bar") + obj = Reflect.field(q,"toObject")() + Reflect.field(q,"test")("price",4) + ok = Reflect.field(q,"qualify")("foo") + if (not ok): + raise haxe_Exception.thrown("node should be allowed") + ok = (not Reflect.field(q,"qualify")("bar")) + if (not ok): + raise haxe_Exception.thrown("bar should not be allowed") + Reflect.field(q,"test")("price",20) + ok = (not Reflect.field(q,"qualify")("foo")) + if (not ok): + raise haxe_Exception.thrown("price 20 should not be allowed") + q = xrfragment_Query("-bar") + obj = Reflect.field(q,"toObject")() + ok = Reflect.field(q,"qualify")("foo") + if (not ok): + raise haxe_Exception.thrown("node should be allowed") + ok = (not Reflect.field(q,"qualify")("bar")) + if (not ok): + raise haxe_Exception.thrown("bar should not be allowed") + q = xrfragment_Query("title:*") + obj = Reflect.field(q,"toObject")() + ok = (not Reflect.field(q,"qualify")("foo")) + if (not ok): + raise haxe_Exception.thrown("node should not be allowed") + Reflect.field(q,"test")("foo","bar") + ok = (not Reflect.field(q,"qualify")("foo")) + if (not ok): + raise haxe_Exception.thrown("node should not be allowed") + Reflect.field(q,"test")("title","bar") + ok = Reflect.field(q,"qualify")("foo") + if (not ok): + raise haxe_Exception.thrown("node should be allowed") + q = xrfragment_Query("-bar +bar") + obj = Reflect.field(q,"toObject")() + ok = Reflect.field(q,"qualify")("foo") + if (not ok): + raise haxe_Exception.thrown("node should be allowed") + ok = Reflect.field(q,"qualify")("bar") + if (not ok): + raise haxe_Exception.thrown("bar should be allowed") + q = xrfragment_Query("?discount") + obj = Reflect.field(q,"toObject")() + Reflect.field(q,"test")("?discount","-foo") + ok = (not Reflect.field(q,"qualify")("foo")) + if (not ok): + raise haxe_Exception.thrown("foo should not be allowed") + q = xrfragment_Query("?") + Reflect.field(q,"test")("?","-foo") + ok = (not Reflect.field(q,"qualify")("foo")) + if (not ok): + raise haxe_Exception.thrown("foo should not be allowed") + q = xrfragment_Query("?") + ok = Reflect.field(q,"qualify")("foo") + if (not ok): + raise haxe_Exception.thrown("foo should not be allowed") + q = xrfragment_Query("?discount") + Reflect.field(q,"test")("?discount","-foo") + ok = (not Reflect.field(q,"qualify")("foo")) + if (not ok): + raise haxe_Exception.thrown("foo should not be allowed") + q = xrfragment_Query("?discount +foo") + obj = Reflect.field(q,"toObject")() + Reflect.field(q,"test")("?discount","-foo") + ok = (not Reflect.field(q,"qualify")("foo")) + if (not ok): + raise haxe_Exception.thrown("foo should not be allowed") + ok = (not Reflect.field(q,"qualify")("foo")) + if (not ok): + raise haxe_Exception.thrown("foo should not be allowed") + haxe_Log.trace("all tests passed",_hx_AnonObject({'fileName': "src/Test.hx", 'lineNumber': 116, 'className': "Test", 'methodName': "main"})) + +class ValueType(Enum): + __slots__ = () + _hx_class_name = "ValueType" + _hx_constructs = ["TNull", "TInt", "TFloat", "TBool", "TObject", "TFunction", "TClass", "TEnum", "TUnknown"] + + @staticmethod + def TClass(c): + return ValueType("TClass", 6, (c,)) + + @staticmethod + def TEnum(e): + return ValueType("TEnum", 7, (e,)) +ValueType.TNull = ValueType("TNull", 0, ()) +ValueType.TInt = ValueType("TInt", 1, ()) +ValueType.TFloat = ValueType("TFloat", 2, ()) +ValueType.TBool = ValueType("TBool", 3, ()) +ValueType.TObject = ValueType("TObject", 4, ()) +ValueType.TFunction = ValueType("TFunction", 5, ()) +ValueType.TUnknown = ValueType("TUnknown", 8, ()) + + +class Type: + _hx_class_name = "Type" + __slots__ = () + _hx_statics = ["getClass", "getEnum", "getSuperClass", "getClassName", "getEnumName", "resolveClass", "resolveEnum", "createInstance", "createEmptyInstance", "createEnum", "createEnumIndex", "getInstanceFields", "getClassFields", "getEnumConstructs", "typeof", "asEnumImpl", "enumEq", "enumConstructor", "enumParameters", "enumIndex", "allEnums"] + + @staticmethod + def getClass(o): + if (o is None): + return None + o1 = o + if ((o1 is not None) and ((HxOverrides.eq(o1,str) or python_lib_Inspect.isclass(o1)))): + return None + if isinstance(o,_hx_AnonObject): + return None + if hasattr(o,"_hx_class"): + return o._hx_class + if hasattr(o,"__class__"): + return o.__class__ + else: + return None + + @staticmethod + def getEnum(o): + if (o is None): + return None + return o.__class__ + + @staticmethod + def getSuperClass(c): + return python_Boot.getSuperClass(c) + + @staticmethod + def getClassName(c): + if hasattr(c,"_hx_class_name"): + return c._hx_class_name + else: + if (c == list): + return "Array" + if (c == Math): + return "Math" + if (c == str): + return "String" + try: + return c.__name__ + except BaseException as _g: + None + return None + + @staticmethod + def getEnumName(e): + return e._hx_class_name + + @staticmethod + def resolveClass(name): + if (name == "Array"): + return list + if (name == "Math"): + return Math + if (name == "String"): + return str + cl = _hx_classes.get(name,None) + tmp = None + if (cl is not None): + o = cl + tmp = (not (((o is not None) and ((HxOverrides.eq(o,str) or python_lib_Inspect.isclass(o)))))) + else: + tmp = True + if tmp: + return None + return cl + + @staticmethod + def resolveEnum(name): + if (name == "Bool"): + return Bool + o = Type.resolveClass(name) + if hasattr(o,"_hx_constructs"): + return o + else: + return None + + @staticmethod + def createInstance(cl,args): + return cl(*args) + + @staticmethod + def createEmptyInstance(cl): + i = cl.__new__(cl) + callInit = None + def _hx_local_0(cl): + sc = Type.getSuperClass(cl) + if (sc is not None): + callInit(sc) + if hasattr(cl,"_hx_empty_init"): + cl._hx_empty_init(i) + callInit = _hx_local_0 + callInit(cl) + return i + + @staticmethod + def createEnum(e,constr,params = None): + f = Reflect.field(e,constr) + if (f is None): + raise haxe_Exception.thrown(("No such constructor " + ("null" if constr is None else constr))) + if Reflect.isFunction(f): + if (params is None): + raise haxe_Exception.thrown((("Constructor " + ("null" if constr is None else constr)) + " need parameters")) + return Reflect.callMethod(e,f,params) + if ((params is not None) and ((len(params) != 0))): + raise haxe_Exception.thrown((("Constructor " + ("null" if constr is None else constr)) + " does not need parameters")) + return f + + @staticmethod + def createEnumIndex(e,index,params = None): + c = python_internal_ArrayImpl._get(e._hx_constructs, index) + if (c is None): + raise haxe_Exception.thrown((Std.string(index) + " is not a valid enum constructor index")) + return Type.createEnum(e,c,params) + + @staticmethod + def getInstanceFields(c): + return python_Boot.getInstanceFields(c) + + @staticmethod + def getClassFields(c): + return python_Boot.getClassFields(c) + + @staticmethod + def getEnumConstructs(e): + if hasattr(e,"_hx_constructs"): + x = e._hx_constructs + return list(x) + else: + return [] + + @staticmethod + def typeof(v): + if (v is None): + return ValueType.TNull + elif isinstance(v,bool): + return ValueType.TBool + elif isinstance(v,int): + return ValueType.TInt + elif isinstance(v,float): + return ValueType.TFloat + elif isinstance(v,str): + return ValueType.TClass(str) + elif isinstance(v,list): + return ValueType.TClass(list) + elif (isinstance(v,_hx_AnonObject) or python_lib_Inspect.isclass(v)): + return ValueType.TObject + elif isinstance(v,Enum): + return ValueType.TEnum(v.__class__) + elif (isinstance(v,type) or hasattr(v,"_hx_class")): + return ValueType.TClass(v.__class__) + elif callable(v): + return ValueType.TFunction + else: + return ValueType.TUnknown + + @staticmethod + def asEnumImpl(x): + return x + + @staticmethod + def enumEq(a,b): + if HxOverrides.eq(a,b): + return True + try: + if ((b is None) and (not HxOverrides.eq(a,b))): + return False + if (a.tag != b.tag): + return False + p1 = a.params + p2 = b.params + if (len(p1) != len(p2)): + return False + _g = 0 + _g1 = len(p1) + while (_g < _g1): + i = _g + _g = (_g + 1) + if (not Type.enumEq(p1[i],p2[i])): + return False + if (a._hx_class != b._hx_class): + return False + except BaseException as _g: + None + return False + return True + + @staticmethod + def enumConstructor(e): + return e.tag + + @staticmethod + def enumParameters(e): + return list(e.params) + + @staticmethod + def enumIndex(e): + return e.index + + @staticmethod + def allEnums(e): + ctors = Type.getEnumConstructs(e) + ret = [] + _g = 0 + while (_g < len(ctors)): + ctor = (ctors[_g] if _g >= 0 and _g < len(ctors) else None) + _g = (_g + 1) + v = Reflect.field(e,ctor) + if Std.isOfType(v,e): + ret.append(v) + return ret + +class haxe_StackItem(Enum): + __slots__ = () + _hx_class_name = "haxe.StackItem" + _hx_constructs = ["CFunction", "Module", "FilePos", "Method", "LocalFunction"] + + @staticmethod + def Module(m): + return haxe_StackItem("Module", 1, (m,)) + + @staticmethod + def FilePos(s,file,line,column = None): + return haxe_StackItem("FilePos", 2, (s,file,line,column)) + + @staticmethod + def Method(classname,method): + return haxe_StackItem("Method", 3, (classname,method)) + + @staticmethod + def LocalFunction(v = None): + return haxe_StackItem("LocalFunction", 4, (v,)) +haxe_StackItem.CFunction = haxe_StackItem("CFunction", 0, ()) + + +class haxe__CallStack_CallStack_Impl_: + _hx_class_name = "haxe._CallStack.CallStack_Impl_" + __slots__ = () + _hx_statics = ["get_length", "callStack", "exceptionStack", "toString", "subtract", "copy", "get", "asArray", "equalItems", "exceptionToString", "itemToString"] + length = None + + @staticmethod + def get_length(this1): + return len(this1) + + @staticmethod + def callStack(): + infos = python_lib_Traceback.extract_stack() + if (len(infos) != 0): + infos.pop() + infos.reverse() + return haxe_NativeStackTrace.toHaxe(infos) + + @staticmethod + def exceptionStack(fullStack = None): + if (fullStack is None): + fullStack = False + eStack = haxe_NativeStackTrace.toHaxe(haxe_NativeStackTrace.exceptionStack()) + return (eStack if fullStack else haxe__CallStack_CallStack_Impl_.subtract(eStack,haxe__CallStack_CallStack_Impl_.callStack())) + + @staticmethod + def toString(stack): + b = StringBuf() + _g = 0 + _g1 = stack + while (_g < len(_g1)): + s = (_g1[_g] if _g >= 0 and _g < len(_g1) else None) + _g = (_g + 1) + b.b.write("\nCalled from ") + haxe__CallStack_CallStack_Impl_.itemToString(b,s) + return b.b.getvalue() + + @staticmethod + def subtract(this1,stack): + startIndex = -1 + i = -1 + while True: + i = (i + 1) + tmp = i + if (not ((tmp < len(this1)))): + break + _g = 0 + _g1 = len(stack) + while (_g < _g1): + j = _g + _g = (_g + 1) + if haxe__CallStack_CallStack_Impl_.equalItems((this1[i] if i >= 0 and i < len(this1) else None),python_internal_ArrayImpl._get(stack, j)): + if (startIndex < 0): + startIndex = i + i = (i + 1) + if (i >= len(this1)): + break + else: + startIndex = -1 + if (startIndex >= 0): + break + if (startIndex >= 0): + return this1[0:startIndex] + else: + return this1 + + @staticmethod + def copy(this1): + return list(this1) + + @staticmethod + def get(this1,index): + return (this1[index] if index >= 0 and index < len(this1) else None) + + @staticmethod + def asArray(this1): + return this1 + + @staticmethod + def equalItems(item1,item2): + if (item1 is None): + if (item2 is None): + return True + else: + return False + else: + tmp = item1.index + if (tmp == 0): + if (item2 is None): + return False + elif (item2.index == 0): + return True + else: + return False + elif (tmp == 1): + if (item2 is None): + return False + elif (item2.index == 1): + m2 = item2.params[0] + m1 = item1.params[0] + return (m1 == m2) + else: + return False + elif (tmp == 2): + if (item2 is None): + return False + elif (item2.index == 2): + item21 = item2.params[0] + file2 = item2.params[1] + line2 = item2.params[2] + col2 = item2.params[3] + col1 = item1.params[3] + line1 = item1.params[2] + file1 = item1.params[1] + item11 = item1.params[0] + if (((file1 == file2) and ((line1 == line2))) and ((col1 == col2))): + return haxe__CallStack_CallStack_Impl_.equalItems(item11,item21) + else: + return False + else: + return False + elif (tmp == 3): + if (item2 is None): + return False + elif (item2.index == 3): + class2 = item2.params[0] + method2 = item2.params[1] + method1 = item1.params[1] + class1 = item1.params[0] + if (class1 == class2): + return (method1 == method2) + else: + return False + else: + return False + elif (tmp == 4): + if (item2 is None): + return False + elif (item2.index == 4): + v2 = item2.params[0] + v1 = item1.params[0] + return (v1 == v2) + else: + return False + else: + pass + + @staticmethod + def exceptionToString(e): + if (e.get_previous() is None): + tmp = ("Exception: " + HxOverrides.stringOrNull(e.toString())) + tmp1 = e.get_stack() + return (("null" if tmp is None else tmp) + HxOverrides.stringOrNull((("null" if ((tmp1 is None)) else haxe__CallStack_CallStack_Impl_.toString(tmp1))))) + result = "" + e1 = e + prev = None + while (e1 is not None): + if (prev is None): + result1 = ("Exception: " + HxOverrides.stringOrNull(e1.get_message())) + tmp = e1.get_stack() + result = ((("null" if result1 is None else result1) + HxOverrides.stringOrNull((("null" if ((tmp is None)) else haxe__CallStack_CallStack_Impl_.toString(tmp))))) + ("null" if result is None else result)) + else: + prevStack = haxe__CallStack_CallStack_Impl_.subtract(e1.get_stack(),prev.get_stack()) + result = (((("Exception: " + HxOverrides.stringOrNull(e1.get_message())) + HxOverrides.stringOrNull((("null" if ((prevStack is None)) else haxe__CallStack_CallStack_Impl_.toString(prevStack))))) + "\n\nNext ") + ("null" if result is None else result)) + prev = e1 + e1 = e1.get_previous() + return result + + @staticmethod + def itemToString(b,s): + tmp = s.index + if (tmp == 0): + b.b.write("a C function") + elif (tmp == 1): + m = s.params[0] + b.b.write("module ") + s1 = Std.string(m) + b.b.write(s1) + elif (tmp == 2): + s1 = s.params[0] + file = s.params[1] + line = s.params[2] + col = s.params[3] + if (s1 is not None): + haxe__CallStack_CallStack_Impl_.itemToString(b,s1) + b.b.write(" (") + s2 = Std.string(file) + b.b.write(s2) + b.b.write(" line ") + s2 = Std.string(line) + b.b.write(s2) + if (col is not None): + b.b.write(" column ") + s2 = Std.string(col) + b.b.write(s2) + if (s1 is not None): + b.b.write(")") + elif (tmp == 3): + cname = s.params[0] + meth = s.params[1] + s1 = Std.string(("" if ((cname is None)) else cname)) + b.b.write(s1) + b.b.write(".") + s1 = Std.string(meth) + b.b.write(s1) + elif (tmp == 4): + n = s.params[0] + b.b.write("local function #") + s = Std.string(n) + b.b.write(s) + else: + pass + + +class haxe_IMap: + _hx_class_name = "haxe.IMap" + __slots__ = () + _hx_methods = ["get", "set", "exists", "remove", "keys", "iterator", "keyValueIterator", "copy", "toString", "clear"] + + +class haxe__DynamicAccess_DynamicAccess_Impl_: + _hx_class_name = "haxe._DynamicAccess.DynamicAccess_Impl_" + __slots__ = () + _hx_statics = ["_new", "get", "set", "exists", "remove", "keys", "copy", "iterator", "keyValueIterator"] + + @staticmethod + def _new(): + this1 = _hx_AnonObject({}) + return this1 + + @staticmethod + def get(this1,key): + return Reflect.field(this1,key) + + @staticmethod + def set(this1,key,value): + setattr(this1,(("_hx_" + key) if ((key in python_Boot.keywords)) else (("_hx_" + key) if (((((len(key) > 2) and ((ord(key[0]) == 95))) and ((ord(key[1]) == 95))) and ((ord(key[(len(key) - 1)]) != 95)))) else key)),value) + return value + + @staticmethod + def exists(this1,key): + return python_Boot.hasField(this1,key) + + @staticmethod + def remove(this1,key): + return Reflect.deleteField(this1,key) + + @staticmethod + def keys(this1): + return python_Boot.fields(this1) + + @staticmethod + def copy(this1): + return Reflect.copy(this1) + + @staticmethod + def iterator(this1): + return haxe_iterators_DynamicAccessIterator(this1) + + @staticmethod + def keyValueIterator(this1): + return haxe_iterators_DynamicAccessKeyValueIterator(this1) + + +class haxe_Exception(Exception): + _hx_class_name = "haxe.Exception" + __slots__ = ("_hx___exceptionStack", "_hx___nativeStack", "_hx___skipStack", "_hx___nativeException", "_hx___previousException") + _hx_fields = ["__exceptionStack", "__nativeStack", "__skipStack", "__nativeException", "__previousException"] + _hx_methods = ["unwrap", "toString", "details", "__shiftStack", "get_message", "get_previous", "get_native", "get_stack"] + _hx_statics = ["caught", "thrown"] + _hx_interfaces = [] + _hx_super = Exception + + + def __init__(self,message,previous = None,native = None): + self._hx___previousException = None + self._hx___nativeException = None + self._hx___nativeStack = None + self._hx___exceptionStack = None + self._hx___skipStack = 0 + super().__init__(message) + self._hx___previousException = previous + if ((native is not None) and Std.isOfType(native,BaseException)): + self._hx___nativeException = native + self._hx___nativeStack = haxe_NativeStackTrace.exceptionStack() + else: + self._hx___nativeException = self + infos = python_lib_Traceback.extract_stack() + if (len(infos) != 0): + infos.pop() + infos.reverse() + self._hx___nativeStack = infos + + def unwrap(self): + return self._hx___nativeException + + def toString(self): + return self.get_message() + + def details(self): + if (self.get_previous() is None): + tmp = ("Exception: " + HxOverrides.stringOrNull(self.toString())) + tmp1 = self.get_stack() + return (("null" if tmp is None else tmp) + HxOverrides.stringOrNull((("null" if ((tmp1 is None)) else haxe__CallStack_CallStack_Impl_.toString(tmp1))))) + else: + result = "" + e = self + prev = None + while (e is not None): + if (prev is None): + result1 = ("Exception: " + HxOverrides.stringOrNull(e.get_message())) + tmp = e.get_stack() + result = ((("null" if result1 is None else result1) + HxOverrides.stringOrNull((("null" if ((tmp is None)) else haxe__CallStack_CallStack_Impl_.toString(tmp))))) + ("null" if result is None else result)) + else: + prevStack = haxe__CallStack_CallStack_Impl_.subtract(e.get_stack(),prev.get_stack()) + result = (((("Exception: " + HxOverrides.stringOrNull(e.get_message())) + HxOverrides.stringOrNull((("null" if ((prevStack is None)) else haxe__CallStack_CallStack_Impl_.toString(prevStack))))) + "\n\nNext ") + ("null" if result is None else result)) + prev = e + e = e.get_previous() + return result + + def _hx___shiftStack(self): + _hx_local_0 = self + _hx_local_1 = _hx_local_0._hx___skipStack + _hx_local_0._hx___skipStack = (_hx_local_1 + 1) + _hx_local_1 + + def get_message(self): + return str(self) + + def get_previous(self): + return self._hx___previousException + + def get_native(self): + return self._hx___nativeException + + def get_stack(self): + _g = self._hx___exceptionStack + if (_g is None): + def _hx_local_1(): + def _hx_local_0(): + self._hx___exceptionStack = haxe_NativeStackTrace.toHaxe(self._hx___nativeStack,self._hx___skipStack) + return self._hx___exceptionStack + return _hx_local_0() + return _hx_local_1() + else: + s = _g + return s + + @staticmethod + def caught(value): + if Std.isOfType(value,haxe_Exception): + return value + elif Std.isOfType(value,BaseException): + return haxe_Exception(str(value),None,value) + else: + return haxe_ValueException(value,None,value) + + @staticmethod + def thrown(value): + if Std.isOfType(value,haxe_Exception): + return value.get_native() + elif Std.isOfType(value,BaseException): + return value + else: + e = haxe_ValueException(value) + e._hx___skipStack = (e._hx___skipStack + 1) + return e + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o._hx___exceptionStack = None + _hx_o._hx___nativeStack = None + _hx_o._hx___skipStack = None + _hx_o._hx___nativeException = None + _hx_o._hx___previousException = None + + +class haxe__Int32_Int32_Impl_: + _hx_class_name = "haxe._Int32.Int32_Impl_" + __slots__ = () + _hx_statics = ["negate", "preIncrement", "postIncrement", "preDecrement", "postDecrement", "add", "addInt", "sub", "subInt", "intSub", "mul", "mulInt", "complement", "or", "orInt", "xor", "xorInt", "shr", "shrInt", "intShr", "shl", "shlInt", "intShl", "toFloat", "ucompare", "clamp"] + + @staticmethod + def negate(this1): + return (((~this1 + 1) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + + @staticmethod + def preIncrement(this1): + this1 = (this1 + 1) + x = this1 + this1 = ((x + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + return this1 + + @staticmethod + def postIncrement(this1): + ret = this1 + this1 = (this1 + 1) + this1 = ((this1 + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + return ret + + @staticmethod + def preDecrement(this1): + this1 = (this1 - 1) + x = this1 + this1 = ((x + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + return this1 + + @staticmethod + def postDecrement(this1): + ret = this1 + this1 = (this1 - 1) + this1 = ((this1 + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + return ret + + @staticmethod + def add(a,b): + return (((a + b) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + + @staticmethod + def addInt(a,b): + return (((a + b) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + + @staticmethod + def sub(a,b): + return (((a - b) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + + @staticmethod + def subInt(a,b): + return (((a - b) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + + @staticmethod + def intSub(a,b): + return (((a - b) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + + @staticmethod + def mul(a,b): + return ((((a * ((b & 65535))) + ((((((a * (HxOverrides.rshift(b, 16))) << 16)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + + @staticmethod + def mulInt(a,b): + return haxe__Int32_Int32_Impl_.mul(a,b) + + @staticmethod + def complement(a): + return ((~a + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + + @staticmethod + def _hx_or(a,b): + return ((((a | b)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + + @staticmethod + def orInt(a,b): + return ((((a | b)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + + @staticmethod + def xor(a,b): + return ((((a ^ b)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + + @staticmethod + def xorInt(a,b): + return ((((a ^ b)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + + @staticmethod + def shr(a,b): + return ((((a >> b)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + + @staticmethod + def shrInt(a,b): + return ((((a >> b)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + + @staticmethod + def intShr(a,b): + return ((((a >> b)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + + @staticmethod + def shl(a,b): + return ((((a << b)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + + @staticmethod + def shlInt(a,b): + return ((((a << b)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + + @staticmethod + def intShl(a,b): + return ((((a << b)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + + @staticmethod + def toFloat(this1): + return this1 + + @staticmethod + def ucompare(a,b): + if (a < 0): + if (b < 0): + return (((((~b + (2 ** 31)) % (2 ** 32) - (2 ** 31)) - (((~a + (2 ** 31)) % (2 ** 32) - (2 ** 31)))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + else: + return 1 + if (b < 0): + return -1 + else: + return (((a - b) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + + @staticmethod + def clamp(x): + return ((x + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + + +class haxe__Int64_Int64_Impl_: + _hx_class_name = "haxe._Int64.Int64_Impl_" + __slots__ = () + _hx_statics = ["_new", "copy", "make", "ofInt", "toInt", "is", "isInt64", "getHigh", "getLow", "isNeg", "isZero", "compare", "ucompare", "toStr", "toString", "parseString", "fromFloat", "divMod", "neg", "preIncrement", "postIncrement", "preDecrement", "postDecrement", "add", "addInt", "sub", "subInt", "intSub", "mul", "mulInt", "div", "divInt", "intDiv", "mod", "modInt", "intMod", "eq", "eqInt", "neq", "neqInt", "lt", "ltInt", "intLt", "lte", "lteInt", "intLte", "gt", "gtInt", "intGt", "gte", "gteInt", "intGte", "complement", "and", "or", "xor", "shl", "shr", "ushr", "get_high", "set_high", "get_low", "set_low"] + high = None + low = None + + @staticmethod + def _new(x): + this1 = x + return this1 + + @staticmethod + def copy(this1): + this2 = haxe__Int64____Int64(this1.high,this1.low) + return this2 + + @staticmethod + def make(high,low): + this1 = haxe__Int64____Int64(high,low) + return this1 + + @staticmethod + def ofInt(x): + this1 = haxe__Int64____Int64((x >> 31),x) + return this1 + + @staticmethod + def toInt(x): + if (x.high != ((((x.low >> 31)) + (2 ** 31)) % (2 ** 32) - (2 ** 31))): + raise haxe_Exception.thrown("Overflow") + return x.low + + @staticmethod + def _hx_is(val): + return Std.isOfType(val,haxe__Int64____Int64) + + @staticmethod + def isInt64(val): + return Std.isOfType(val,haxe__Int64____Int64) + + @staticmethod + def getHigh(x): + return x.high + + @staticmethod + def getLow(x): + return x.low + + @staticmethod + def isNeg(x): + return (x.high < 0) + + @staticmethod + def isZero(x): + b_high = 0 + b_low = 0 + if (x.high == b_high): + return (x.low == b_low) + else: + return False + + @staticmethod + def compare(a,b): + v = (((a.high - b.high) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (v == 0): + v = haxe__Int32_Int32_Impl_.ucompare(a.low,b.low) + if (a.high < 0): + if (b.high < 0): + return v + else: + return -1 + elif (b.high >= 0): + return v + else: + return 1 + + @staticmethod + def ucompare(a,b): + v = haxe__Int32_Int32_Impl_.ucompare(a.high,b.high) + if (v != 0): + return v + else: + return haxe__Int32_Int32_Impl_.ucompare(a.low,b.low) + + @staticmethod + def toStr(x): + return haxe__Int64_Int64_Impl_.toString(x) + + @staticmethod + def toString(this1): + i = this1 + b_high = 0 + b_low = 0 + if ((i.high == b_high) and ((i.low == b_low))): + return "0" + _hx_str = "" + neg = False + if (i.high < 0): + neg = True + this1 = haxe__Int64____Int64(0,10) + ten = this1 + while True: + b_high = 0 + b_low = 0 + if (not (((i.high != b_high) or ((i.low != b_low))))): + break + r = haxe__Int64_Int64_Impl_.divMod(i,ten) + if (r.modulus.high < 0): + x = r.modulus + high = ((~x.high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + low = (((~x.low + 1) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (low == 0): + ret = high + high = (high + 1) + high = ((high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + this_high = high + this_low = low + _hx_str = (Std.string(this_low) + ("null" if _hx_str is None else _hx_str)) + x1 = r.quotient + high1 = ((~x1.high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + low1 = (((~x1.low + 1) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (low1 == 0): + ret1 = high1 + high1 = (high1 + 1) + high1 = ((high1 + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + this1 = haxe__Int64____Int64(high1,low1) + i = this1 + else: + _hx_str = (Std.string(r.modulus.low) + ("null" if _hx_str is None else _hx_str)) + i = r.quotient + if neg: + _hx_str = ("-" + ("null" if _hx_str is None else _hx_str)) + return _hx_str + + @staticmethod + def parseString(sParam): + return haxe_Int64Helper.parseString(sParam) + + @staticmethod + def fromFloat(f): + return haxe_Int64Helper.fromFloat(f) + + @staticmethod + def divMod(dividend,divisor): + if (divisor.high == 0): + _g = divisor.low + if (_g == 0): + raise haxe_Exception.thrown("divide by zero") + elif (_g == 1): + this1 = haxe__Int64____Int64(dividend.high,dividend.low) + this2 = haxe__Int64____Int64(0,0) + return _hx_AnonObject({'quotient': this1, 'modulus': this2}) + else: + pass + divSign = ((dividend.high < 0) != ((divisor.high < 0))) + modulus = None + if (dividend.high < 0): + high = ((~dividend.high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + low = (((~dividend.low + 1) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (low == 0): + ret = high + high = (high + 1) + high = ((high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + this1 = haxe__Int64____Int64(high,low) + modulus = this1 + else: + this1 = haxe__Int64____Int64(dividend.high,dividend.low) + modulus = this1 + if (divisor.high < 0): + high = ((~divisor.high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + low = (((~divisor.low + 1) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (low == 0): + ret = high + high = (high + 1) + high = ((high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + this1 = haxe__Int64____Int64(high,low) + divisor = this1 + this1 = haxe__Int64____Int64(0,0) + quotient = this1 + this1 = haxe__Int64____Int64(0,1) + mask = this1 + while (not ((divisor.high < 0))): + v = haxe__Int32_Int32_Impl_.ucompare(divisor.high,modulus.high) + cmp = (v if ((v != 0)) else haxe__Int32_Int32_Impl_.ucompare(divisor.low,modulus.low)) + b = 1 + b = (b & 63) + if (b == 0): + this1 = haxe__Int64____Int64(divisor.high,divisor.low) + divisor = this1 + elif (b < 32): + this2 = haxe__Int64____Int64(((((((((divisor.high << b)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) | HxOverrides.rshift(divisor.low, ((32 - b))))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)),((((divisor.low << b)) + (2 ** 31)) % (2 ** 32) - (2 ** 31))) + divisor = this2 + else: + this3 = haxe__Int64____Int64(((((divisor.low << ((b - 32)))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)),0) + divisor = this3 + b1 = 1 + b1 = (b1 & 63) + if (b1 == 0): + this4 = haxe__Int64____Int64(mask.high,mask.low) + mask = this4 + elif (b1 < 32): + this5 = haxe__Int64____Int64(((((((((mask.high << b1)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) | HxOverrides.rshift(mask.low, ((32 - b1))))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)),((((mask.low << b1)) + (2 ** 31)) % (2 ** 32) - (2 ** 31))) + mask = this5 + else: + this6 = haxe__Int64____Int64(((((mask.low << ((b1 - 32)))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)),0) + mask = this6 + if (cmp >= 0): + break + while True: + b_high = 0 + b_low = 0 + if (not (((mask.high != b_high) or ((mask.low != b_low))))): + break + v = haxe__Int32_Int32_Impl_.ucompare(modulus.high,divisor.high) + if (((v if ((v != 0)) else haxe__Int32_Int32_Impl_.ucompare(modulus.low,divisor.low))) >= 0): + this1 = haxe__Int64____Int64(((((quotient.high | mask.high)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)),((((quotient.low | mask.low)) + (2 ** 31)) % (2 ** 32) - (2 ** 31))) + quotient = this1 + high = (((modulus.high - divisor.high) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + low = (((modulus.low - divisor.low) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (haxe__Int32_Int32_Impl_.ucompare(modulus.low,divisor.low) < 0): + ret = high + high = (high - 1) + high = ((high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + this2 = haxe__Int64____Int64(high,low) + modulus = this2 + b = 1 + b = (b & 63) + if (b == 0): + this3 = haxe__Int64____Int64(mask.high,mask.low) + mask = this3 + elif (b < 32): + this4 = haxe__Int64____Int64(HxOverrides.rshift(mask.high, b),((((((((mask.high << ((32 - b)))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) | HxOverrides.rshift(mask.low, b))) + (2 ** 31)) % (2 ** 32) - (2 ** 31))) + mask = this4 + else: + this5 = haxe__Int64____Int64(0,HxOverrides.rshift(mask.high, ((b - 32)))) + mask = this5 + b1 = 1 + b1 = (b1 & 63) + if (b1 == 0): + this6 = haxe__Int64____Int64(divisor.high,divisor.low) + divisor = this6 + elif (b1 < 32): + this7 = haxe__Int64____Int64(HxOverrides.rshift(divisor.high, b1),((((((((divisor.high << ((32 - b1)))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) | HxOverrides.rshift(divisor.low, b1))) + (2 ** 31)) % (2 ** 32) - (2 ** 31))) + divisor = this7 + else: + this8 = haxe__Int64____Int64(0,HxOverrides.rshift(divisor.high, ((b1 - 32)))) + divisor = this8 + if divSign: + high = ((~quotient.high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + low = (((~quotient.low + 1) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (low == 0): + ret = high + high = (high + 1) + high = ((high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + this1 = haxe__Int64____Int64(high,low) + quotient = this1 + if (dividend.high < 0): + high = ((~modulus.high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + low = (((~modulus.low + 1) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (low == 0): + ret = high + high = (high + 1) + high = ((high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + this1 = haxe__Int64____Int64(high,low) + modulus = this1 + return _hx_AnonObject({'quotient': quotient, 'modulus': modulus}) + + @staticmethod + def neg(x): + high = ((~x.high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + low = (((~x.low + 1) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (low == 0): + ret = high + high = (high + 1) + high = ((high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + this1 = haxe__Int64____Int64(high,low) + return this1 + + @staticmethod + def preIncrement(this1): + this2 = haxe__Int64____Int64(this1.high,this1.low) + this1 = this2 + def _hx_local_1(): + _hx_local_0 = this1.low + this1.low = (this1.low + 1) + return _hx_local_0 + ret = _hx_local_1() + this1.low = ((this1.low + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (this1.low == 0): + def _hx_local_3(): + _hx_local_2 = this1.high + this1.high = (this1.high + 1) + return _hx_local_2 + ret = _hx_local_3() + this1.high = ((this1.high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + return this1 + + @staticmethod + def postIncrement(this1): + ret = this1 + this2 = haxe__Int64____Int64(this1.high,this1.low) + this1 = this2 + def _hx_local_2(): + _hx_local_0 = this1 + _hx_local_1 = _hx_local_0.low + _hx_local_0.low = (_hx_local_1 + 1) + return _hx_local_1 + ret1 = _hx_local_2() + this1.low = ((this1.low + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (this1.low == 0): + def _hx_local_5(): + _hx_local_3 = this1 + _hx_local_4 = _hx_local_3.high + _hx_local_3.high = (_hx_local_4 + 1) + return _hx_local_4 + ret1 = _hx_local_5() + this1.high = ((this1.high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + return ret + + @staticmethod + def preDecrement(this1): + this2 = haxe__Int64____Int64(this1.high,this1.low) + this1 = this2 + if (this1.low == 0): + def _hx_local_1(): + _hx_local_0 = this1.high + this1.high = (this1.high - 1) + return _hx_local_0 + ret = _hx_local_1() + this1.high = ((this1.high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + def _hx_local_3(): + _hx_local_2 = this1.low + this1.low = (this1.low - 1) + return _hx_local_2 + ret = _hx_local_3() + this1.low = ((this1.low + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + return this1 + + @staticmethod + def postDecrement(this1): + ret = this1 + this2 = haxe__Int64____Int64(this1.high,this1.low) + this1 = this2 + if (this1.low == 0): + def _hx_local_2(): + _hx_local_0 = this1 + _hx_local_1 = _hx_local_0.high + _hx_local_0.high = (_hx_local_1 - 1) + return _hx_local_1 + ret1 = _hx_local_2() + this1.high = ((this1.high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + def _hx_local_5(): + _hx_local_3 = this1 + _hx_local_4 = _hx_local_3.low + _hx_local_3.low = (_hx_local_4 - 1) + return _hx_local_4 + ret1 = _hx_local_5() + this1.low = ((this1.low + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + return ret + + @staticmethod + def add(a,b): + high = (((a.high + b.high) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + low = (((a.low + b.low) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (haxe__Int32_Int32_Impl_.ucompare(low,a.low) < 0): + ret = high + high = (high + 1) + high = ((high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + this1 = haxe__Int64____Int64(high,low) + return this1 + + @staticmethod + def addInt(a,b): + b_high = (b >> 31) + b_low = b + high = (((a.high + b_high) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + low = (((a.low + b_low) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (haxe__Int32_Int32_Impl_.ucompare(low,a.low) < 0): + ret = high + high = (high + 1) + high = ((high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + this1 = haxe__Int64____Int64(high,low) + return this1 + + @staticmethod + def sub(a,b): + high = (((a.high - b.high) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + low = (((a.low - b.low) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (haxe__Int32_Int32_Impl_.ucompare(a.low,b.low) < 0): + ret = high + high = (high - 1) + high = ((high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + this1 = haxe__Int64____Int64(high,low) + return this1 + + @staticmethod + def subInt(a,b): + b_high = (b >> 31) + b_low = b + high = (((a.high - b_high) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + low = (((a.low - b_low) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (haxe__Int32_Int32_Impl_.ucompare(a.low,b_low) < 0): + ret = high + high = (high - 1) + high = ((high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + this1 = haxe__Int64____Int64(high,low) + return this1 + + @staticmethod + def intSub(a,b): + a_high = (a >> 31) + a_low = a + high = (((a_high - b.high) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + low = (((a_low - b.low) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (haxe__Int32_Int32_Impl_.ucompare(a_low,b.low) < 0): + ret = high + high = (high - 1) + high = ((high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + this1 = haxe__Int64____Int64(high,low) + return this1 + + @staticmethod + def mul(a,b): + mask = 65535 + al = (a.low & mask) + ah = HxOverrides.rshift(a.low, 16) + bl = (b.low & mask) + bh = HxOverrides.rshift(b.low, 16) + p00 = haxe__Int32_Int32_Impl_.mul(al,bl) + p10 = haxe__Int32_Int32_Impl_.mul(ah,bl) + p01 = haxe__Int32_Int32_Impl_.mul(al,bh) + p11 = haxe__Int32_Int32_Impl_.mul(ah,bh) + low = p00 + high = ((((((p11 + (HxOverrides.rshift(p01, 16))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + (HxOverrides.rshift(p10, 16))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + p01 = ((((p01 << 16)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + low = (((low + p01) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (haxe__Int32_Int32_Impl_.ucompare(low,p01) < 0): + ret = high + high = (high + 1) + high = ((high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + p10 = ((((p10 << 16)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + low = (((low + p10) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (haxe__Int32_Int32_Impl_.ucompare(low,p10) < 0): + ret = high + high = (high + 1) + high = ((high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + high = (((high + ((((haxe__Int32_Int32_Impl_.mul(a.low,b.high) + haxe__Int32_Int32_Impl_.mul(a.high,b.low)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + this1 = haxe__Int64____Int64(high,low) + return this1 + + @staticmethod + def mulInt(a,b): + b_high = (b >> 31) + b_low = b + mask = 65535 + al = (a.low & mask) + ah = HxOverrides.rshift(a.low, 16) + bl = (b_low & mask) + bh = HxOverrides.rshift(b_low, 16) + p00 = haxe__Int32_Int32_Impl_.mul(al,bl) + p10 = haxe__Int32_Int32_Impl_.mul(ah,bl) + p01 = haxe__Int32_Int32_Impl_.mul(al,bh) + p11 = haxe__Int32_Int32_Impl_.mul(ah,bh) + low = p00 + high = ((((((p11 + (HxOverrides.rshift(p01, 16))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + (HxOverrides.rshift(p10, 16))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + p01 = ((((p01 << 16)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + low = (((low + p01) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (haxe__Int32_Int32_Impl_.ucompare(low,p01) < 0): + ret = high + high = (high + 1) + high = ((high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + p10 = ((((p10 << 16)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + low = (((low + p10) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (haxe__Int32_Int32_Impl_.ucompare(low,p10) < 0): + ret = high + high = (high + 1) + high = ((high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + high = (((high + ((((haxe__Int32_Int32_Impl_.mul(a.low,b_high) + haxe__Int32_Int32_Impl_.mul(a.high,b_low)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + this1 = haxe__Int64____Int64(high,low) + return this1 + + @staticmethod + def div(a,b): + return haxe__Int64_Int64_Impl_.divMod(a,b).quotient + + @staticmethod + def divInt(a,b): + this1 = haxe__Int64____Int64((b >> 31),b) + return haxe__Int64_Int64_Impl_.divMod(a,this1).quotient + + @staticmethod + def intDiv(a,b): + this1 = haxe__Int64____Int64((a >> 31),a) + x = haxe__Int64_Int64_Impl_.divMod(this1,b).quotient + if (x.high != ((((x.low >> 31)) + (2 ** 31)) % (2 ** 32) - (2 ** 31))): + raise haxe_Exception.thrown("Overflow") + x1 = x.low + this1 = haxe__Int64____Int64((x1 >> 31),x1) + return this1 + + @staticmethod + def mod(a,b): + return haxe__Int64_Int64_Impl_.divMod(a,b).modulus + + @staticmethod + def modInt(a,b): + this1 = haxe__Int64____Int64((b >> 31),b) + x = haxe__Int64_Int64_Impl_.divMod(a,this1).modulus + if (x.high != ((((x.low >> 31)) + (2 ** 31)) % (2 ** 32) - (2 ** 31))): + raise haxe_Exception.thrown("Overflow") + x1 = x.low + this1 = haxe__Int64____Int64((x1 >> 31),x1) + return this1 + + @staticmethod + def intMod(a,b): + this1 = haxe__Int64____Int64((a >> 31),a) + x = haxe__Int64_Int64_Impl_.divMod(this1,b).modulus + if (x.high != ((((x.low >> 31)) + (2 ** 31)) % (2 ** 32) - (2 ** 31))): + raise haxe_Exception.thrown("Overflow") + x1 = x.low + this1 = haxe__Int64____Int64((x1 >> 31),x1) + return this1 + + @staticmethod + def eq(a,b): + if (a.high == b.high): + return (a.low == b.low) + else: + return False + + @staticmethod + def eqInt(a,b): + b_high = (b >> 31) + b_low = b + if (a.high == b_high): + return (a.low == b_low) + else: + return False + + @staticmethod + def neq(a,b): + if (a.high == b.high): + return (a.low != b.low) + else: + return True + + @staticmethod + def neqInt(a,b): + b_high = (b >> 31) + b_low = b + if (a.high == b_high): + return (a.low != b_low) + else: + return True + + @staticmethod + def lt(a,b): + v = (((a.high - b.high) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (v == 0): + v = haxe__Int32_Int32_Impl_.ucompare(a.low,b.low) + return ((((v if ((b.high < 0)) else -1) if ((a.high < 0)) else (v if ((b.high >= 0)) else 1))) < 0) + + @staticmethod + def ltInt(a,b): + b_high = (b >> 31) + b_low = b + v = (((a.high - b_high) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (v == 0): + v = haxe__Int32_Int32_Impl_.ucompare(a.low,b_low) + return ((((v if ((b_high < 0)) else -1) if ((a.high < 0)) else (v if ((b_high >= 0)) else 1))) < 0) + + @staticmethod + def intLt(a,b): + a_high = (a >> 31) + a_low = a + v = (((a_high - b.high) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (v == 0): + v = haxe__Int32_Int32_Impl_.ucompare(a_low,b.low) + return ((((v if ((b.high < 0)) else -1) if ((a_high < 0)) else (v if ((b.high >= 0)) else 1))) < 0) + + @staticmethod + def lte(a,b): + v = (((a.high - b.high) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (v == 0): + v = haxe__Int32_Int32_Impl_.ucompare(a.low,b.low) + return ((((v if ((b.high < 0)) else -1) if ((a.high < 0)) else (v if ((b.high >= 0)) else 1))) <= 0) + + @staticmethod + def lteInt(a,b): + b_high = (b >> 31) + b_low = b + v = (((a.high - b_high) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (v == 0): + v = haxe__Int32_Int32_Impl_.ucompare(a.low,b_low) + return ((((v if ((b_high < 0)) else -1) if ((a.high < 0)) else (v if ((b_high >= 0)) else 1))) <= 0) + + @staticmethod + def intLte(a,b): + a_high = (a >> 31) + a_low = a + v = (((a_high - b.high) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (v == 0): + v = haxe__Int32_Int32_Impl_.ucompare(a_low,b.low) + return ((((v if ((b.high < 0)) else -1) if ((a_high < 0)) else (v if ((b.high >= 0)) else 1))) <= 0) + + @staticmethod + def gt(a,b): + v = (((a.high - b.high) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (v == 0): + v = haxe__Int32_Int32_Impl_.ucompare(a.low,b.low) + return ((((v if ((b.high < 0)) else -1) if ((a.high < 0)) else (v if ((b.high >= 0)) else 1))) > 0) + + @staticmethod + def gtInt(a,b): + b_high = (b >> 31) + b_low = b + v = (((a.high - b_high) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (v == 0): + v = haxe__Int32_Int32_Impl_.ucompare(a.low,b_low) + return ((((v if ((b_high < 0)) else -1) if ((a.high < 0)) else (v if ((b_high >= 0)) else 1))) > 0) + + @staticmethod + def intGt(a,b): + a_high = (a >> 31) + a_low = a + v = (((a_high - b.high) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (v == 0): + v = haxe__Int32_Int32_Impl_.ucompare(a_low,b.low) + return ((((v if ((b.high < 0)) else -1) if ((a_high < 0)) else (v if ((b.high >= 0)) else 1))) > 0) + + @staticmethod + def gte(a,b): + v = (((a.high - b.high) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (v == 0): + v = haxe__Int32_Int32_Impl_.ucompare(a.low,b.low) + return ((((v if ((b.high < 0)) else -1) if ((a.high < 0)) else (v if ((b.high >= 0)) else 1))) >= 0) + + @staticmethod + def gteInt(a,b): + b_high = (b >> 31) + b_low = b + v = (((a.high - b_high) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (v == 0): + v = haxe__Int32_Int32_Impl_.ucompare(a.low,b_low) + return ((((v if ((b_high < 0)) else -1) if ((a.high < 0)) else (v if ((b_high >= 0)) else 1))) >= 0) + + @staticmethod + def intGte(a,b): + a_high = (a >> 31) + a_low = a + v = (((a_high - b.high) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (v == 0): + v = haxe__Int32_Int32_Impl_.ucompare(a_low,b.low) + return ((((v if ((b.high < 0)) else -1) if ((a_high < 0)) else (v if ((b.high >= 0)) else 1))) >= 0) + + @staticmethod + def complement(a): + this1 = haxe__Int64____Int64(((~a.high + (2 ** 31)) % (2 ** 32) - (2 ** 31)),((~a.low + (2 ** 31)) % (2 ** 32) - (2 ** 31))) + return this1 + + @staticmethod + def _hx_and(a,b): + this1 = haxe__Int64____Int64((a.high & b.high),(a.low & b.low)) + return this1 + + @staticmethod + def _hx_or(a,b): + this1 = haxe__Int64____Int64(((((a.high | b.high)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)),((((a.low | b.low)) + (2 ** 31)) % (2 ** 32) - (2 ** 31))) + return this1 + + @staticmethod + def xor(a,b): + this1 = haxe__Int64____Int64(((((a.high ^ b.high)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)),((((a.low ^ b.low)) + (2 ** 31)) % (2 ** 32) - (2 ** 31))) + return this1 + + @staticmethod + def shl(a,b): + b = (b & 63) + if (b == 0): + this1 = haxe__Int64____Int64(a.high,a.low) + return this1 + elif (b < 32): + this1 = haxe__Int64____Int64(((((((((a.high << b)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) | HxOverrides.rshift(a.low, ((32 - b))))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)),((((a.low << b)) + (2 ** 31)) % (2 ** 32) - (2 ** 31))) + return this1 + else: + this1 = haxe__Int64____Int64(((((a.low << ((b - 32)))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)),0) + return this1 + + @staticmethod + def shr(a,b): + b = (b & 63) + if (b == 0): + this1 = haxe__Int64____Int64(a.high,a.low) + return this1 + elif (b < 32): + this1 = haxe__Int64____Int64(((((a.high >> b)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)),((((((((a.high << ((32 - b)))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) | HxOverrides.rshift(a.low, b))) + (2 ** 31)) % (2 ** 32) - (2 ** 31))) + return this1 + else: + this1 = haxe__Int64____Int64(((((a.high >> 31)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)),((((a.high >> ((b - 32)))) + (2 ** 31)) % (2 ** 32) - (2 ** 31))) + return this1 + + @staticmethod + def ushr(a,b): + b = (b & 63) + if (b == 0): + this1 = haxe__Int64____Int64(a.high,a.low) + return this1 + elif (b < 32): + this1 = haxe__Int64____Int64(HxOverrides.rshift(a.high, b),((((((((a.high << ((32 - b)))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) | HxOverrides.rshift(a.low, b))) + (2 ** 31)) % (2 ** 32) - (2 ** 31))) + return this1 + else: + this1 = haxe__Int64____Int64(0,HxOverrides.rshift(a.high, ((b - 32)))) + return this1 + + @staticmethod + def get_high(this1): + return this1.high + + @staticmethod + def set_high(this1,x): + def _hx_local_1(): + def _hx_local_0(): + this1.high = x + return this1.high + return _hx_local_0() + return _hx_local_1() + + @staticmethod + def get_low(this1): + return this1.low + + @staticmethod + def set_low(this1,x): + def _hx_local_1(): + def _hx_local_0(): + this1.low = x + return this1.low + return _hx_local_0() + return _hx_local_1() + + +class haxe__Int64____Int64: + _hx_class_name = "haxe._Int64.___Int64" + __slots__ = ("high", "low") + _hx_fields = ["high", "low"] + _hx_methods = ["toString"] + + def __init__(self,high,low): + self.high = high + self.low = low + + def toString(self): + return haxe__Int64_Int64_Impl_.toString(self) + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.high = None + _hx_o.low = None + + +class haxe_Int64Helper: + _hx_class_name = "haxe.Int64Helper" + __slots__ = () + _hx_statics = ["parseString", "fromFloat"] + + @staticmethod + def parseString(sParam): + base_high = 0 + base_low = 10 + this1 = haxe__Int64____Int64(0,0) + current = this1 + this1 = haxe__Int64____Int64(0,1) + multiplier = this1 + sIsNegative = False + s = StringTools.trim(sParam) + if ((("" if ((0 >= len(s))) else s[0])) == "-"): + sIsNegative = True + s = HxString.substring(s,1,len(s)) + _hx_len = len(s) + _g = 0 + _g1 = _hx_len + while (_g < _g1): + i = _g + _g = (_g + 1) + digitInt = (HxString.charCodeAt(s,((_hx_len - 1) - i)) - 48) + if ((digitInt < 0) or ((digitInt > 9))): + raise haxe_Exception.thrown("NumberFormatError") + if (digitInt != 0): + digit_high = (digitInt >> 31) + digit_low = digitInt + if sIsNegative: + mask = 65535 + al = (multiplier.low & mask) + ah = HxOverrides.rshift(multiplier.low, 16) + bl = (digit_low & mask) + bh = HxOverrides.rshift(digit_low, 16) + p00 = haxe__Int32_Int32_Impl_.mul(al,bl) + p10 = haxe__Int32_Int32_Impl_.mul(ah,bl) + p01 = haxe__Int32_Int32_Impl_.mul(al,bh) + p11 = haxe__Int32_Int32_Impl_.mul(ah,bh) + low = p00 + high = ((((((p11 + (HxOverrides.rshift(p01, 16))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + (HxOverrides.rshift(p10, 16))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + p01 = ((((p01 << 16)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + low = (((low + p01) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (haxe__Int32_Int32_Impl_.ucompare(low,p01) < 0): + ret = high + high = (high + 1) + high = ((high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + p10 = ((((p10 << 16)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + low = (((low + p10) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (haxe__Int32_Int32_Impl_.ucompare(low,p10) < 0): + ret1 = high + high = (high + 1) + high = ((high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + high = (((high + ((((haxe__Int32_Int32_Impl_.mul(multiplier.low,digit_high) + haxe__Int32_Int32_Impl_.mul(multiplier.high,digit_low)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + b_high = high + b_low = low + high1 = (((current.high - b_high) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + low1 = (((current.low - b_low) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (haxe__Int32_Int32_Impl_.ucompare(current.low,b_low) < 0): + ret2 = high1 + high1 = (high1 - 1) + high1 = ((high1 + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + this1 = haxe__Int64____Int64(high1,low1) + current = this1 + if (not ((current.high < 0))): + raise haxe_Exception.thrown("NumberFormatError: Underflow") + else: + mask1 = 65535 + al1 = (multiplier.low & mask1) + ah1 = HxOverrides.rshift(multiplier.low, 16) + bl1 = (digit_low & mask1) + bh1 = HxOverrides.rshift(digit_low, 16) + p001 = haxe__Int32_Int32_Impl_.mul(al1,bl1) + p101 = haxe__Int32_Int32_Impl_.mul(ah1,bl1) + p011 = haxe__Int32_Int32_Impl_.mul(al1,bh1) + p111 = haxe__Int32_Int32_Impl_.mul(ah1,bh1) + low2 = p001 + high2 = ((((((p111 + (HxOverrides.rshift(p011, 16))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + (HxOverrides.rshift(p101, 16))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + p011 = ((((p011 << 16)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + low2 = (((low2 + p011) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (haxe__Int32_Int32_Impl_.ucompare(low2,p011) < 0): + ret3 = high2 + high2 = (high2 + 1) + high2 = ((high2 + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + p101 = ((((p101 << 16)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + low2 = (((low2 + p101) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (haxe__Int32_Int32_Impl_.ucompare(low2,p101) < 0): + ret4 = high2 + high2 = (high2 + 1) + high2 = ((high2 + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + high2 = (((high2 + ((((haxe__Int32_Int32_Impl_.mul(multiplier.low,digit_high) + haxe__Int32_Int32_Impl_.mul(multiplier.high,digit_low)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + b_high1 = high2 + b_low1 = low2 + high3 = (((current.high + b_high1) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + low3 = (((current.low + b_low1) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (haxe__Int32_Int32_Impl_.ucompare(low3,current.low) < 0): + ret5 = high3 + high3 = (high3 + 1) + high3 = ((high3 + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + this2 = haxe__Int64____Int64(high3,low3) + current = this2 + if (current.high < 0): + raise haxe_Exception.thrown("NumberFormatError: Overflow") + mask2 = 65535 + al2 = (multiplier.low & mask2) + ah2 = HxOverrides.rshift(multiplier.low, 16) + bl2 = (base_low & mask2) + bh2 = HxOverrides.rshift(base_low, 16) + p002 = haxe__Int32_Int32_Impl_.mul(al2,bl2) + p102 = haxe__Int32_Int32_Impl_.mul(ah2,bl2) + p012 = haxe__Int32_Int32_Impl_.mul(al2,bh2) + p112 = haxe__Int32_Int32_Impl_.mul(ah2,bh2) + low4 = p002 + high4 = ((((((p112 + (HxOverrides.rshift(p012, 16))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + (HxOverrides.rshift(p102, 16))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + p012 = ((((p012 << 16)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + low4 = (((low4 + p012) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (haxe__Int32_Int32_Impl_.ucompare(low4,p012) < 0): + ret6 = high4 + high4 = (high4 + 1) + high4 = ((high4 + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + p102 = ((((p102 << 16)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + low4 = (((low4 + p102) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (haxe__Int32_Int32_Impl_.ucompare(low4,p102) < 0): + ret7 = high4 + high4 = (high4 + 1) + high4 = ((high4 + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + high4 = (((high4 + ((((haxe__Int32_Int32_Impl_.mul(multiplier.low,base_high) + haxe__Int32_Int32_Impl_.mul(multiplier.high,base_low)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + this3 = haxe__Int64____Int64(high4,low4) + multiplier = this3 + return current + + @staticmethod + def fromFloat(f): + if (python_lib_Math.isnan(f) or (not ((((f != Math.POSITIVE_INFINITY) and ((f != Math.NEGATIVE_INFINITY))) and (not python_lib_Math.isnan(f)))))): + raise haxe_Exception.thrown("Number is NaN or Infinite") + noFractions = (f - (HxOverrides.modf(f, 1))) + if (noFractions > 9007199254740991): + raise haxe_Exception.thrown("Conversion overflow") + if (noFractions < -9007199254740991): + raise haxe_Exception.thrown("Conversion underflow") + this1 = haxe__Int64____Int64(0,0) + result = this1 + neg = (noFractions < 0) + rest = (-noFractions if neg else noFractions) + i = 0 + while (rest >= 1): + curr = HxOverrides.modf(rest, 2) + rest = (rest / 2) + if (curr >= 1): + a_high = 0 + a_low = 1 + b = i + b = (b & 63) + b1 = None + if (b == 0): + this1 = haxe__Int64____Int64(a_high,a_low) + b1 = this1 + elif (b < 32): + this2 = haxe__Int64____Int64(((((((((a_high << b)) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) | HxOverrides.rshift(a_low, ((32 - b))))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)),((((a_low << b)) + (2 ** 31)) % (2 ** 32) - (2 ** 31))) + b1 = this2 + else: + this3 = haxe__Int64____Int64(((((a_low << ((b - 32)))) + (2 ** 31)) % (2 ** 32) - (2 ** 31)),0) + b1 = this3 + high = (((result.high + b1.high) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + low = (((result.low + b1.low) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (haxe__Int32_Int32_Impl_.ucompare(low,result.low) < 0): + ret = high + high = (high + 1) + high = ((high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + this4 = haxe__Int64____Int64(high,low) + result = this4 + i = (i + 1) + if neg: + high = ((~result.high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + low = (((~result.low + 1) + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + if (low == 0): + ret = high + high = (high + 1) + high = ((high + (2 ** 31)) % (2 ** 32) - (2 ** 31)) + this1 = haxe__Int64____Int64(high,low) + result = this1 + return result + + +class haxe_Log: + _hx_class_name = "haxe.Log" + __slots__ = () + _hx_statics = ["formatOutput", "trace"] + + @staticmethod + def formatOutput(v,infos): + _hx_str = Std.string(v) + if (infos is None): + return _hx_str + pstr = ((HxOverrides.stringOrNull(infos.fileName) + ":") + Std.string(infos.lineNumber)) + if (Reflect.field(infos,"customParams") is not None): + _g = 0 + _g1 = Reflect.field(infos,"customParams") + while (_g < len(_g1)): + v = (_g1[_g] if _g >= 0 and _g < len(_g1) else None) + _g = (_g + 1) + _hx_str = (("null" if _hx_str is None else _hx_str) + ((", " + Std.string(v)))) + return ((("null" if pstr is None else pstr) + ": ") + ("null" if _hx_str is None else _hx_str)) + + @staticmethod + def trace(v,infos = None): + _hx_str = haxe_Log.formatOutput(v,infos) + str1 = Std.string(_hx_str) + python_Lib.printString((("" + ("null" if str1 is None else str1)) + HxOverrides.stringOrNull(python_Lib.lineEnd))) + + +class haxe_NativeStackTrace: + _hx_class_name = "haxe.NativeStackTrace" + __slots__ = () + _hx_statics = ["saveStack", "callStack", "exceptionStack", "toHaxe"] + + @staticmethod + def saveStack(exception): + pass + + @staticmethod + def callStack(): + infos = python_lib_Traceback.extract_stack() + if (len(infos) != 0): + infos.pop() + infos.reverse() + return infos + + @staticmethod + def exceptionStack(): + exc = python_lib_Sys.exc_info() + if (exc[2] is not None): + infos = python_lib_Traceback.extract_tb(exc[2]) + infos.reverse() + return infos + else: + return [] + + @staticmethod + def toHaxe(native,skip = None): + if (skip is None): + skip = 0 + stack = [] + _g = 0 + _g1 = len(native) + while (_g < _g1): + i = _g + _g = (_g + 1) + if (skip > i): + continue + elem = (native[i] if i >= 0 and i < len(native) else None) + x = haxe_StackItem.FilePos(haxe_StackItem.Method(None,elem[2]),elem[0],elem[1]) + stack.append(x) + return stack + + +class haxe__Rest_Rest_Impl_: + _hx_class_name = "haxe._Rest.Rest_Impl_" + __slots__ = () + _hx_statics = ["get_length", "of", "_new", "get", "toArray", "iterator", "keyValueIterator", "append", "prepend", "toString"] + length = None + + @staticmethod + def get_length(this1): + return len(this1) + + @staticmethod + def of(array): + this1 = array + return this1 + + @staticmethod + def _new(array): + this1 = array + return this1 + + @staticmethod + def get(this1,index): + return (this1[index] if index >= 0 and index < len(this1) else None) + + @staticmethod + def toArray(this1): + return list(this1) + + @staticmethod + def iterator(this1): + return haxe_iterators_RestIterator(this1) + + @staticmethod + def keyValueIterator(this1): + return haxe_iterators_RestKeyValueIterator(this1) + + @staticmethod + def append(this1,item): + result = list(this1) + result.append(item) + this1 = result + return this1 + + @staticmethod + def prepend(this1,item): + result = list(this1) + result.insert(0, item) + this1 = result + return this1 + + @staticmethod + def toString(this1): + return (("[" + HxOverrides.stringOrNull(",".join([python_Boot.toString1(x1,'') for x1 in this1]))) + "]") + + +class haxe_ValueException(haxe_Exception): + _hx_class_name = "haxe.ValueException" + __slots__ = ("value",) + _hx_fields = ["value"] + _hx_methods = ["unwrap"] + _hx_statics = [] + _hx_interfaces = [] + _hx_super = haxe_Exception + + + def __init__(self,value,previous = None,native = None): + self.value = None + super().__init__(Std.string(value),previous,native) + self.value = value + _hx_local_0 = self + _hx_local_1 = _hx_local_0._hx___skipStack + _hx_local_0._hx___skipStack = (_hx_local_1 + 1) + _hx_local_1 + + def unwrap(self): + return self.value + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.value = None + + +class haxe_ds_BalancedTree: + _hx_class_name = "haxe.ds.BalancedTree" + __slots__ = ("root",) + _hx_fields = ["root"] + _hx_methods = ["set", "get", "remove", "exists", "iterator", "keyValueIterator", "keys", "copy", "setLoop", "removeLoop", "keysLoop", "merge", "minBinding", "removeMinBinding", "balance", "compare", "toString", "clear"] + _hx_statics = ["iteratorLoop"] + _hx_interfaces = [haxe_IMap] + + def __init__(self): + self.root = None + + def set(self,key,value): + self.root = self.setLoop(key,value,self.root) + + def get(self,key): + node = self.root + while (node is not None): + c = self.compare(key,node.key) + if (c == 0): + return node.value + if (c < 0): + node = node.left + else: + node = node.right + return None + + def remove(self,key): + try: + self.root = self.removeLoop(key,self.root) + return True + except BaseException as _g: + None + if Std.isOfType(haxe_Exception.caught(_g).unwrap(),str): + return False + else: + raise _g + + def exists(self,key): + node = self.root + while (node is not None): + c = self.compare(key,node.key) + if (c == 0): + return True + elif (c < 0): + node = node.left + else: + node = node.right + return False + + def iterator(self): + ret = [] + haxe_ds_BalancedTree.iteratorLoop(self.root,ret) + return haxe_iterators_ArrayIterator(ret) + + def keyValueIterator(self): + return haxe_iterators_MapKeyValueIterator(self) + + def keys(self): + ret = [] + self.keysLoop(self.root,ret) + return haxe_iterators_ArrayIterator(ret) + + def copy(self): + copied = haxe_ds_BalancedTree() + copied.root = self.root + return copied + + def setLoop(self,k,v,node): + if (node is None): + return haxe_ds_TreeNode(None,k,v,None) + c = self.compare(k,node.key) + if (c == 0): + return haxe_ds_TreeNode(node.left,k,v,node.right,(0 if ((node is None)) else node._height)) + elif (c < 0): + nl = self.setLoop(k,v,node.left) + return self.balance(nl,node.key,node.value,node.right) + else: + nr = self.setLoop(k,v,node.right) + return self.balance(node.left,node.key,node.value,nr) + + def removeLoop(self,k,node): + if (node is None): + raise haxe_Exception.thrown("Not_found") + c = self.compare(k,node.key) + if (c == 0): + return self.merge(node.left,node.right) + elif (c < 0): + return self.balance(self.removeLoop(k,node.left),node.key,node.value,node.right) + else: + return self.balance(node.left,node.key,node.value,self.removeLoop(k,node.right)) + + def keysLoop(self,node,acc): + if (node is not None): + self.keysLoop(node.left,acc) + x = node.key + acc.append(x) + self.keysLoop(node.right,acc) + + def merge(self,t1,t2): + if (t1 is None): + return t2 + if (t2 is None): + return t1 + t = self.minBinding(t2) + return self.balance(t1,t.key,t.value,self.removeMinBinding(t2)) + + def minBinding(self,t): + if (t is None): + raise haxe_Exception.thrown("Not_found") + elif (t.left is None): + return t + else: + return self.minBinding(t.left) + + def removeMinBinding(self,t): + if (t.left is None): + return t.right + else: + return self.balance(self.removeMinBinding(t.left),t.key,t.value,t.right) + + def balance(self,l,k,v,r): + hl = (0 if ((l is None)) else l._height) + hr = (0 if ((r is None)) else r._height) + if (hl > ((hr + 2))): + _this = l.left + _this1 = l.right + if (((0 if ((_this is None)) else _this._height)) >= ((0 if ((_this1 is None)) else _this1._height))): + return haxe_ds_TreeNode(l.left,l.key,l.value,haxe_ds_TreeNode(l.right,k,v,r)) + else: + return haxe_ds_TreeNode(haxe_ds_TreeNode(l.left,l.key,l.value,l.right.left),l.right.key,l.right.value,haxe_ds_TreeNode(l.right.right,k,v,r)) + elif (hr > ((hl + 2))): + _this = r.right + _this1 = r.left + if (((0 if ((_this is None)) else _this._height)) > ((0 if ((_this1 is None)) else _this1._height))): + return haxe_ds_TreeNode(haxe_ds_TreeNode(l,k,v,r.left),r.key,r.value,r.right) + else: + return haxe_ds_TreeNode(haxe_ds_TreeNode(l,k,v,r.left.left),r.left.key,r.left.value,haxe_ds_TreeNode(r.left.right,r.key,r.value,r.right)) + else: + return haxe_ds_TreeNode(l,k,v,r,(((hl if ((hl > hr)) else hr)) + 1)) + + def compare(self,k1,k2): + return Reflect.compare(k1,k2) + + def toString(self): + if (self.root is None): + return "{}" + else: + return (("{" + HxOverrides.stringOrNull(self.root.toString())) + "}") + + def clear(self): + self.root = None + + @staticmethod + def iteratorLoop(node,acc): + if (node is not None): + haxe_ds_BalancedTree.iteratorLoop(node.left,acc) + x = node.value + acc.append(x) + haxe_ds_BalancedTree.iteratorLoop(node.right,acc) + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.root = None + + +class haxe_ds_TreeNode: + _hx_class_name = "haxe.ds.TreeNode" + __slots__ = ("left", "right", "key", "value", "_height") + _hx_fields = ["left", "right", "key", "value", "_height"] + _hx_methods = ["toString"] + + def __init__(self,l,k,v,r,h = None): + if (h is None): + h = -1 + self._height = None + self.left = l + self.key = k + self.value = v + self.right = r + if (h == -1): + tmp = None + _this = self.left + _this1 = self.right + if (((0 if ((_this is None)) else _this._height)) > ((0 if ((_this1 is None)) else _this1._height))): + _this = self.left + tmp = (0 if ((_this is None)) else _this._height) + else: + _this = self.right + tmp = (0 if ((_this is None)) else _this._height) + self._height = (tmp + 1) + else: + self._height = h + + def toString(self): + return ((HxOverrides.stringOrNull((("" if ((self.left is None)) else (HxOverrides.stringOrNull(self.left.toString()) + ", ")))) + (((("" + Std.string(self.key)) + "=") + Std.string(self.value)))) + HxOverrides.stringOrNull((("" if ((self.right is None)) else (", " + HxOverrides.stringOrNull(self.right.toString())))))) + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.left = None + _hx_o.right = None + _hx_o.key = None + _hx_o.value = None + _hx_o._height = None + + +class haxe_ds_EnumValueMap(haxe_ds_BalancedTree): + _hx_class_name = "haxe.ds.EnumValueMap" + __slots__ = () + _hx_fields = [] + _hx_methods = ["compare", "compareArgs", "compareArg", "copy"] + _hx_statics = [] + _hx_interfaces = [haxe_IMap] + _hx_super = haxe_ds_BalancedTree + + + def __init__(self): + super().__init__() + + def compare(self,k1,k2): + d = (k1.index - k2.index) + if (d != 0): + return d + p1 = list(k1.params) + p2 = list(k2.params) + if ((len(p1) == 0) and ((len(p2) == 0))): + return 0 + return self.compareArgs(p1,p2) + + def compareArgs(self,a1,a2): + ld = (len(a1) - len(a2)) + if (ld != 0): + return ld + _g = 0 + _g1 = len(a1) + while (_g < _g1): + i = _g + _g = (_g + 1) + d = self.compareArg((a1[i] if i >= 0 and i < len(a1) else None),(a2[i] if i >= 0 and i < len(a2) else None)) + if (d != 0): + return d + return 0 + + def compareArg(self,v1,v2): + if (Reflect.isEnumValue(v1) and Reflect.isEnumValue(v2)): + return self.compare(v1,v2) + elif (Std.isOfType(v1,list) and Std.isOfType(v2,list)): + return self.compareArgs(v1,v2) + else: + return Reflect.compare(v1,v2) + + def copy(self): + copied = haxe_ds_EnumValueMap() + copied.root = self.root + return copied + + @staticmethod + def _hx_empty_init(_hx_o): pass + + +class haxe_ds__HashMap_HashMap_Impl_: + _hx_class_name = "haxe.ds._HashMap.HashMap_Impl_" + __slots__ = () + _hx_statics = ["_new", "set", "get", "exists", "remove", "keys", "copy", "iterator", "keyValueIterator", "clear"] + + @staticmethod + def _new(): + this1 = haxe_ds__HashMap_HashMapData() + return this1 + + @staticmethod + def set(this1,k,v): + this1.keys.set(k.hashCode(),k) + this1.values.set(k.hashCode(),v) + + @staticmethod + def get(this1,k): + _this = this1.values + key = k.hashCode() + return _this.h.get(key,None) + + @staticmethod + def exists(this1,k): + _this = this1.values + return (k.hashCode() in _this.h) + + @staticmethod + def remove(this1,k): + this1.values.remove(k.hashCode()) + return this1.keys.remove(k.hashCode()) + + @staticmethod + def keys(this1): + return this1.keys.iterator() + + @staticmethod + def copy(this1): + copied = haxe_ds__HashMap_HashMapData() + copied.keys = this1.keys.copy() + copied.values = this1.values.copy() + return copied + + @staticmethod + def iterator(this1): + return this1.values.iterator() + + @staticmethod + def keyValueIterator(this1): + return haxe_iterators_HashMapKeyValueIterator(this1) + + @staticmethod + def clear(this1): + this1.keys.h.clear() + this1.values.h.clear() + + +class haxe_ds__HashMap_HashMapData: + _hx_class_name = "haxe.ds._HashMap.HashMapData" + __slots__ = ("keys", "values") + _hx_fields = ["keys", "values"] + + def __init__(self): + self.keys = haxe_ds_IntMap() + self.values = haxe_ds_IntMap() + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.keys = None + _hx_o.values = None + + +class haxe_ds_IntMap: + _hx_class_name = "haxe.ds.IntMap" + __slots__ = ("h",) + _hx_fields = ["h"] + _hx_methods = ["set", "get", "exists", "remove", "keys", "iterator", "keyValueIterator", "copy", "toString", "clear"] + _hx_interfaces = [haxe_IMap] + + def __init__(self): + self.h = dict() + + def set(self,key,value): + self.h[key] = value + + def get(self,key): + return self.h.get(key,None) + + def exists(self,key): + return (key in self.h) + + def remove(self,key): + if (not (key in self.h)): + return False + del self.h[key] + return True + + def keys(self): + return python_HaxeIterator(iter(self.h.keys())) + + def iterator(self): + return python_HaxeIterator(iter(self.h.values())) + + def keyValueIterator(self): + return haxe_iterators_MapKeyValueIterator(self) + + def copy(self): + copied = haxe_ds_IntMap() + key = self.keys() + while key.hasNext(): + key1 = key.next() + copied.set(key1,self.h.get(key1,None)) + return copied + + def toString(self): + s_b = python_lib_io_StringIO() + s_b.write("{") + it = self.keys() + i = it + while i.hasNext(): + i1 = i.next() + s_b.write(Std.string(i1)) + s_b.write(" => ") + s_b.write(Std.string(Std.string(self.h.get(i1,None)))) + if it.hasNext(): + s_b.write(", ") + s_b.write("}") + return s_b.getvalue() + + def clear(self): + self.h.clear() + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.h = None + + +class haxe_ds__Map_Map_Impl_: + _hx_class_name = "haxe.ds._Map.Map_Impl_" + __slots__ = () + _hx_statics = ["set", "get", "exists", "remove", "keys", "iterator", "keyValueIterator", "copy", "toString", "clear", "arrayWrite", "toStringMap", "toIntMap", "toEnumValueMapMap", "toObjectMap", "fromStringMap", "fromIntMap", "fromObjectMap"] + + @staticmethod + def set(this1,key,value): + this1.set(key,value) + + @staticmethod + def get(this1,key): + return this1.get(key) + + @staticmethod + def exists(this1,key): + return this1.exists(key) + + @staticmethod + def remove(this1,key): + return this1.remove(key) + + @staticmethod + def keys(this1): + return this1.keys() + + @staticmethod + def iterator(this1): + return this1.iterator() + + @staticmethod + def keyValueIterator(this1): + return this1.keyValueIterator() + + @staticmethod + def copy(this1): + return this1.copy() + + @staticmethod + def toString(this1): + return this1.toString() + + @staticmethod + def clear(this1): + this1.clear() + + @staticmethod + def arrayWrite(this1,k,v): + this1.set(k,v) + return v + + @staticmethod + def toStringMap(t): + return haxe_ds_StringMap() + + @staticmethod + def toIntMap(t): + return haxe_ds_IntMap() + + @staticmethod + def toEnumValueMapMap(t): + return haxe_ds_EnumValueMap() + + @staticmethod + def toObjectMap(t): + return haxe_ds_ObjectMap() + + @staticmethod + def fromStringMap(_hx_map): + return _hx_map + + @staticmethod + def fromIntMap(_hx_map): + return _hx_map + + @staticmethod + def fromObjectMap(_hx_map): + return _hx_map + + +class haxe_ds_ObjectMap: + _hx_class_name = "haxe.ds.ObjectMap" + __slots__ = ("h",) + _hx_fields = ["h"] + _hx_methods = ["set", "get", "exists", "remove", "keys", "iterator", "keyValueIterator", "copy", "toString", "clear"] + _hx_interfaces = [haxe_IMap] + + def __init__(self): + self.h = dict() + + def set(self,key,value): + self.h[key] = value + + def get(self,key): + return self.h.get(key,None) + + def exists(self,key): + return (key in self.h) + + def remove(self,key): + r = (key in self.h) + if r: + del self.h[key] + return r + + def keys(self): + return python_HaxeIterator(iter(self.h.keys())) + + def iterator(self): + return python_HaxeIterator(iter(self.h.values())) + + def keyValueIterator(self): + return haxe_iterators_MapKeyValueIterator(self) + + def copy(self): + copied = haxe_ds_ObjectMap() + key = self.keys() + while key.hasNext(): + key1 = key.next() + copied.set(key1,self.h.get(key1,None)) + return copied + + def toString(self): + s_b = python_lib_io_StringIO() + s_b.write("{") + it = self.keys() + i = it + while i.hasNext(): + i1 = i.next() + s_b.write(Std.string(Std.string(i1))) + s_b.write(" => ") + s_b.write(Std.string(Std.string(self.h.get(i1,None)))) + if it.hasNext(): + s_b.write(", ") + s_b.write("}") + return s_b.getvalue() + + def clear(self): + self.h.clear() + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.h = None + + +class haxe_ds__ReadOnlyArray_ReadOnlyArray_Impl_: + _hx_class_name = "haxe.ds._ReadOnlyArray.ReadOnlyArray_Impl_" + __slots__ = () + _hx_statics = ["get_length", "get", "concat"] + length = None + + @staticmethod + def get_length(this1): + return len(this1) + + @staticmethod + def get(this1,i): + return (this1[i] if i >= 0 and i < len(this1) else None) + + @staticmethod + def concat(this1,a): + return (this1 + a) + + +class haxe_ds_StringMap: + _hx_class_name = "haxe.ds.StringMap" + __slots__ = ("h",) + _hx_fields = ["h"] + _hx_methods = ["set", "get", "exists", "remove", "keys", "iterator", "keyValueIterator", "copy", "toString", "clear"] + _hx_interfaces = [haxe_IMap] + + def __init__(self): + self.h = dict() + + def set(self,key,value): + self.h[key] = value + + def get(self,key): + return self.h.get(key,None) + + def exists(self,key): + return (key in self.h) + + def remove(self,key): + has = (key in self.h) + if has: + del self.h[key] + return has + + def keys(self): + return python_HaxeIterator(iter(self.h.keys())) + + def iterator(self): + return python_HaxeIterator(iter(self.h.values())) + + def keyValueIterator(self): + return haxe_iterators_MapKeyValueIterator(self) + + def copy(self): + copied = haxe_ds_StringMap() + key = self.keys() + while key.hasNext(): + key1 = key.next() + value = self.h.get(key1,None) + copied.h[key1] = value + return copied + + def toString(self): + s_b = python_lib_io_StringIO() + s_b.write("{") + it = self.keys() + i = it + while i.hasNext(): + i1 = i.next() + s_b.write(Std.string(i1)) + s_b.write(" => ") + s_b.write(Std.string(Std.string(self.h.get(i1,None)))) + if it.hasNext(): + s_b.write(", ") + s_b.write("}") + return s_b.getvalue() + + def clear(self): + self.h.clear() + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.h = None + + +class haxe_ds_WeakMap: + _hx_class_name = "haxe.ds.WeakMap" + __slots__ = () + _hx_methods = ["set", "get", "exists", "remove", "keys", "iterator", "keyValueIterator", "copy", "toString", "clear"] + _hx_interfaces = [haxe_IMap] + + def __init__(self): + raise haxe_exceptions_NotImplementedException("Not implemented for this platform",None,_hx_AnonObject({'fileName': "haxe/ds/WeakMap.hx", 'lineNumber': 39, 'className': "haxe.ds.WeakMap", 'methodName': "new"})) + + def set(self,key,value): + pass + + def get(self,key): + return None + + def exists(self,key): + return False + + def remove(self,key): + return False + + def keys(self): + return None + + def iterator(self): + return None + + def keyValueIterator(self): + return None + + def copy(self): + return None + + def toString(self): + return None + + def clear(self): + pass + + @staticmethod + def _hx_empty_init(_hx_o): pass + + +class haxe_exceptions_PosException(haxe_Exception): + _hx_class_name = "haxe.exceptions.PosException" + __slots__ = ("posInfos",) + _hx_fields = ["posInfos"] + _hx_methods = ["toString"] + _hx_statics = [] + _hx_interfaces = [] + _hx_super = haxe_Exception + + + def __init__(self,message,previous = None,pos = None): + self.posInfos = None + super().__init__(message,previous) + if (pos is None): + self.posInfos = _hx_AnonObject({'fileName': "(unknown)", 'lineNumber': 0, 'className': "(unknown)", 'methodName': "(unknown)"}) + else: + self.posInfos = pos + _hx_local_0 = self + _hx_local_1 = _hx_local_0._hx___skipStack + _hx_local_0._hx___skipStack = (_hx_local_1 + 1) + _hx_local_1 + + def toString(self): + return ((((((((("" + HxOverrides.stringOrNull(super().toString())) + " in ") + HxOverrides.stringOrNull(self.posInfos.className)) + ".") + HxOverrides.stringOrNull(self.posInfos.methodName)) + " at ") + HxOverrides.stringOrNull(self.posInfos.fileName)) + ":") + Std.string(self.posInfos.lineNumber)) + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.posInfos = None + + +class haxe_exceptions_NotImplementedException(haxe_exceptions_PosException): + _hx_class_name = "haxe.exceptions.NotImplementedException" + __slots__ = () + _hx_fields = [] + _hx_methods = [] + _hx_statics = [] + _hx_interfaces = [] + _hx_super = haxe_exceptions_PosException + + + def __init__(self,message = None,previous = None,pos = None): + if (message is None): + message = "Not implemented" + super().__init__(message,previous,pos) + _hx_local_0 = self + _hx_local_1 = _hx_local_0._hx___skipStack + _hx_local_0._hx___skipStack = (_hx_local_1 + 1) + _hx_local_1 + + +class haxe_io_Bytes: + _hx_class_name = "haxe.io.Bytes" + __slots__ = ("length", "b") + _hx_fields = ["length", "b"] + _hx_methods = ["get", "set", "blit", "fill", "sub", "compare", "getDouble", "getFloat", "setDouble", "setFloat", "getUInt16", "setUInt16", "getInt32", "getInt64", "setInt32", "setInt64", "getString", "readString", "toString", "toHex", "getData"] + _hx_statics = ["alloc", "ofString", "ofData", "ofHex", "fastGet"] + + def __init__(self,length,b): + self.length = length + self.b = b + + def get(self,pos): + return self.b[pos] + + def set(self,pos,v): + self.b[pos] = (v & 255) + + def blit(self,pos,src,srcpos,_hx_len): + if (((((pos < 0) or ((srcpos < 0))) or ((_hx_len < 0))) or (((pos + _hx_len) > self.length))) or (((srcpos + _hx_len) > src.length))): + raise haxe_Exception.thrown(haxe_io_Error.OutsideBounds) + self.b[pos:pos+_hx_len] = src.b[srcpos:srcpos+_hx_len] + + def fill(self,pos,_hx_len,value): + _g = 0 + _g1 = _hx_len + while (_g < _g1): + i = _g + _g = (_g + 1) + pos1 = pos + pos = (pos + 1) + self.b[pos1] = (value & 255) + + def sub(self,pos,_hx_len): + if (((pos < 0) or ((_hx_len < 0))) or (((pos + _hx_len) > self.length))): + raise haxe_Exception.thrown(haxe_io_Error.OutsideBounds) + return haxe_io_Bytes(_hx_len,self.b[pos:(pos + _hx_len)]) + + def compare(self,other): + b1 = self.b + b2 = other.b + _hx_len = (self.length if ((self.length < other.length)) else other.length) + _g = 0 + _g1 = _hx_len + while (_g < _g1): + i = _g + _g = (_g + 1) + if (b1[i] != b2[i]): + return (b1[i] - b2[i]) + return (self.length - other.length) + + def getDouble(self,pos): + v = (((self.b[pos] | ((self.b[(pos + 1)] << 8))) | ((self.b[(pos + 2)] << 16))) | ((self.b[(pos + 3)] << 24))) + pos1 = (pos + 4) + v1 = (((self.b[pos1] | ((self.b[(pos1 + 1)] << 8))) | ((self.b[(pos1 + 2)] << 16))) | ((self.b[(pos1 + 3)] << 24))) + return haxe_io_FPHelper.i64ToDouble(((v | -2147483648) if ((((v & -2147483648)) != 0)) else v),((v1 | -2147483648) if ((((v1 & -2147483648)) != 0)) else v1)) + + def getFloat(self,pos): + v = (((self.b[pos] | ((self.b[(pos + 1)] << 8))) | ((self.b[(pos + 2)] << 16))) | ((self.b[(pos + 3)] << 24))) + return haxe_io_FPHelper.i32ToFloat(((v | -2147483648) if ((((v & -2147483648)) != 0)) else v)) + + def setDouble(self,pos,v): + i = haxe_io_FPHelper.doubleToI64(v) + v = i.low + self.b[pos] = (v & 255) + self.b[(pos + 1)] = ((v >> 8) & 255) + self.b[(pos + 2)] = ((v >> 16) & 255) + self.b[(pos + 3)] = (HxOverrides.rshift(v, 24) & 255) + pos1 = (pos + 4) + v = i.high + self.b[pos1] = (v & 255) + self.b[(pos1 + 1)] = ((v >> 8) & 255) + self.b[(pos1 + 2)] = ((v >> 16) & 255) + self.b[(pos1 + 3)] = (HxOverrides.rshift(v, 24) & 255) + + def setFloat(self,pos,v): + v1 = haxe_io_FPHelper.floatToI32(v) + self.b[pos] = (v1 & 255) + self.b[(pos + 1)] = ((v1 >> 8) & 255) + self.b[(pos + 2)] = ((v1 >> 16) & 255) + self.b[(pos + 3)] = (HxOverrides.rshift(v1, 24) & 255) + + def getUInt16(self,pos): + return (self.b[pos] | ((self.b[(pos + 1)] << 8))) + + def setUInt16(self,pos,v): + self.b[pos] = (v & 255) + self.b[(pos + 1)] = ((v >> 8) & 255) + + def getInt32(self,pos): + v = (((self.b[pos] | ((self.b[(pos + 1)] << 8))) | ((self.b[(pos + 2)] << 16))) | ((self.b[(pos + 3)] << 24))) + if (((v & -2147483648)) != 0): + return (v | -2147483648) + else: + return v + + def getInt64(self,pos): + pos1 = (pos + 4) + v = (((self.b[pos1] | ((self.b[(pos1 + 1)] << 8))) | ((self.b[(pos1 + 2)] << 16))) | ((self.b[(pos1 + 3)] << 24))) + v1 = (((self.b[pos] | ((self.b[(pos + 1)] << 8))) | ((self.b[(pos + 2)] << 16))) | ((self.b[(pos + 3)] << 24))) + this1 = haxe__Int64____Int64(((v | -2147483648) if ((((v & -2147483648)) != 0)) else v),((v1 | -2147483648) if ((((v1 & -2147483648)) != 0)) else v1)) + return this1 + + def setInt32(self,pos,v): + self.b[pos] = (v & 255) + self.b[(pos + 1)] = ((v >> 8) & 255) + self.b[(pos + 2)] = ((v >> 16) & 255) + self.b[(pos + 3)] = (HxOverrides.rshift(v, 24) & 255) + + def setInt64(self,pos,v): + v1 = v.low + self.b[pos] = (v1 & 255) + self.b[(pos + 1)] = ((v1 >> 8) & 255) + self.b[(pos + 2)] = ((v1 >> 16) & 255) + self.b[(pos + 3)] = (HxOverrides.rshift(v1, 24) & 255) + pos1 = (pos + 4) + v1 = v.high + self.b[pos1] = (v1 & 255) + self.b[(pos1 + 1)] = ((v1 >> 8) & 255) + self.b[(pos1 + 2)] = ((v1 >> 16) & 255) + self.b[(pos1 + 3)] = (HxOverrides.rshift(v1, 24) & 255) + + def getString(self,pos,_hx_len,encoding = None): + tmp = (encoding is None) + if (((pos < 0) or ((_hx_len < 0))) or (((pos + _hx_len) > self.length))): + raise haxe_Exception.thrown(haxe_io_Error.OutsideBounds) + return self.b[pos:pos+_hx_len].decode('UTF-8','replace') + + def readString(self,pos,_hx_len): + return self.getString(pos,_hx_len) + + def toString(self): + return self.getString(0,self.length) + + def toHex(self): + s_b = python_lib_io_StringIO() + chars = [] + _hx_str = "0123456789abcdef" + _g = 0 + _g1 = len(_hx_str) + while (_g < _g1): + i = _g + _g = (_g + 1) + x = HxString.charCodeAt(_hx_str,i) + chars.append(x) + _g = 0 + _g1 = self.length + while (_g < _g1): + i = _g + _g = (_g + 1) + c = self.b[i] + s_b.write("".join(map(chr,[python_internal_ArrayImpl._get(chars, (c >> 4))]))) + s_b.write("".join(map(chr,[python_internal_ArrayImpl._get(chars, (c & 15))]))) + return s_b.getvalue() + + def getData(self): + return self.b + + @staticmethod + def alloc(length): + return haxe_io_Bytes(length,bytearray(length)) + + @staticmethod + def ofString(s,encoding = None): + b = bytearray(s,"UTF-8") + return haxe_io_Bytes(len(b),b) + + @staticmethod + def ofData(b): + return haxe_io_Bytes(len(b),b) + + @staticmethod + def ofHex(s): + _hx_len = len(s) + if (((_hx_len & 1)) != 0): + raise haxe_Exception.thrown("Not a hex string (odd number of digits)") + ret = haxe_io_Bytes.alloc((_hx_len >> 1)) + _g = 0 + _g1 = ret.length + while (_g < _g1): + i = _g + _g = (_g + 1) + index = (i * 2) + high = (-1 if ((index >= len(s))) else ord(s[index])) + index1 = ((i * 2) + 1) + low = (-1 if ((index1 >= len(s))) else ord(s[index1])) + high = (((high & 15)) + ((((((high & 64)) >> 6)) * 9))) + low = (((low & 15)) + ((((((low & 64)) >> 6)) * 9))) + ret.b[i] = (((((high << 4) | low)) & 255) & 255) + return ret + + @staticmethod + def fastGet(b,pos): + return b[pos] + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.length = None + _hx_o.b = None + + +class haxe_io_BytesBuffer: + _hx_class_name = "haxe.io.BytesBuffer" + __slots__ = ("b",) + _hx_fields = ["b"] + _hx_methods = ["get_length", "addByte", "add", "addString", "addInt32", "addInt64", "addFloat", "addDouble", "addBytes", "getBytes"] + + def __init__(self): + self.b = bytearray() + + def get_length(self): + return len(self.b) + + def addByte(self,byte): + self.b.append(byte) + + def add(self,src): + self.b.extend(src.b) + + def addString(self,v,encoding = None): + self.b.extend(bytearray(v,"UTF-8")) + + def addInt32(self,v): + self.b.append((v & 255)) + self.b.append(((v >> 8) & 255)) + self.b.append(((v >> 16) & 255)) + self.b.append(HxOverrides.rshift(v, 24)) + + def addInt64(self,v): + self.addInt32(v.low) + self.addInt32(v.high) + + def addFloat(self,v): + self.addInt32(haxe_io_FPHelper.floatToI32(v)) + + def addDouble(self,v): + self.addInt64(haxe_io_FPHelper.doubleToI64(v)) + + def addBytes(self,src,pos,_hx_len): + if (((pos < 0) or ((_hx_len < 0))) or (((pos + _hx_len) > src.length))): + raise haxe_Exception.thrown(haxe_io_Error.OutsideBounds) + self.b.extend(src.b[pos:(pos + _hx_len)]) + + def getBytes(self): + _hx_bytes = haxe_io_Bytes(len(self.b),self.b) + self.b = None + return _hx_bytes + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.b = None + +class haxe_io_Encoding(Enum): + __slots__ = () + _hx_class_name = "haxe.io.Encoding" + _hx_constructs = ["UTF8", "RawNative"] +haxe_io_Encoding.UTF8 = haxe_io_Encoding("UTF8", 0, ()) +haxe_io_Encoding.RawNative = haxe_io_Encoding("RawNative", 1, ()) + + +class haxe_io_Eof: + _hx_class_name = "haxe.io.Eof" + __slots__ = () + _hx_methods = ["toString"] + + def __init__(self): + pass + + def toString(self): + return "Eof" + + @staticmethod + def _hx_empty_init(_hx_o): pass + +class haxe_io_Error(Enum): + __slots__ = () + _hx_class_name = "haxe.io.Error" + _hx_constructs = ["Blocked", "Overflow", "OutsideBounds", "Custom"] + + @staticmethod + def Custom(e): + return haxe_io_Error("Custom", 3, (e,)) +haxe_io_Error.Blocked = haxe_io_Error("Blocked", 0, ()) +haxe_io_Error.Overflow = haxe_io_Error("Overflow", 1, ()) +haxe_io_Error.OutsideBounds = haxe_io_Error("OutsideBounds", 2, ()) + + +class haxe_io_FPHelper: + _hx_class_name = "haxe.io.FPHelper" + __slots__ = () + _hx_statics = ["i64tmp", "LN2", "_i32ToFloat", "_i64ToDouble", "_floatToI32", "_doubleToI64", "i32ToFloat", "floatToI32", "i64ToDouble", "doubleToI64"] + + @staticmethod + def _i32ToFloat(i): + sign = (1 - ((HxOverrides.rshift(i, 31) << 1))) + e = ((i >> 23) & 255) + if (e == 255): + if (((i & 8388607)) == 0): + if (sign > 0): + return Math.POSITIVE_INFINITY + else: + return Math.NEGATIVE_INFINITY + else: + return Math.NaN + m = ((((i & 8388607)) << 1) if ((e == 0)) else ((i & 8388607) | 8388608)) + return ((sign * m) * Math.pow(2,(e - 150))) + + @staticmethod + def _i64ToDouble(lo,hi): + sign = (1 - ((HxOverrides.rshift(hi, 31) << 1))) + e = ((hi >> 20) & 2047) + if (e == 2047): + if ((lo == 0) and ((((hi & 1048575)) == 0))): + if (sign > 0): + return Math.POSITIVE_INFINITY + else: + return Math.NEGATIVE_INFINITY + else: + return Math.NaN + m = (2.220446049250313e-16 * ((((((hi & 1048575)) * 4294967296.) + (((HxOverrides.rshift(lo, 31)) * 2147483648.))) + ((lo & 2147483647))))) + if (e == 0): + m = (m * 2.0) + else: + m = (m + 1.0) + return ((sign * m) * Math.pow(2,(e - 1023))) + + @staticmethod + def _floatToI32(f): + if (f == 0): + return 0 + af = (-f if ((f < 0)) else f) + exp = Math.floor((((Math.NEGATIVE_INFINITY if ((af == 0.0)) else (Math.NaN if ((af < 0.0)) else python_lib_Math.log(af)))) / 0.6931471805599453)) + if (exp > 127): + return 2139095040 + else: + if (exp <= -127): + exp = -127 + af = (af * 7.1362384635298e+44) + else: + af = ((((af / Math.pow(2,exp)) - 1.0)) * 8388608) + return ((((-2147483648 if ((f < 0)) else 0)) | (((exp + 127) << 23))) | Math.floor((af + 0.5))) + + @staticmethod + def _doubleToI64(v): + i64 = haxe_io_FPHelper.i64tmp + if (v == 0): + i64.low = 0 + i64.high = 0 + elif (not ((((v != Math.POSITIVE_INFINITY) and ((v != Math.NEGATIVE_INFINITY))) and (not python_lib_Math.isnan(v))))): + i64.low = 0 + i64.high = (2146435072 if ((v > 0)) else -1048576) + else: + av = (-v if ((v < 0)) else v) + exp = Math.floor((((Math.NEGATIVE_INFINITY if ((av == 0.0)) else (Math.NaN if ((av < 0.0)) else python_lib_Math.log(av)))) / 0.6931471805599453)) + if (exp > 1023): + i64.low = -1 + i64.high = 2146435071 + else: + if (exp <= -1023): + exp = -1023 + av = (av / 2.2250738585072014e-308) + else: + av = ((av / Math.pow(2,exp)) - 1.0) + v1 = (av * 4503599627370496.) + sig = (v1 if (((v1 == Math.POSITIVE_INFINITY) or ((v1 == Math.NEGATIVE_INFINITY)))) else (Math.NaN if (python_lib_Math.isnan(v1)) else Math.floor((v1 + 0.5)))) + sig_l = None + try: + sig_l = int(sig) + except BaseException as _g: + None + sig_l = None + sig_l1 = sig_l + sig_h = None + try: + sig_h = int((sig / 4294967296.0)) + except BaseException as _g: + None + sig_h = None + sig_h1 = sig_h + i64.low = sig_l1 + i64.high = ((((-2147483648 if ((v < 0)) else 0)) | (((exp + 1023) << 20))) | sig_h1) + return i64 + + @staticmethod + def i32ToFloat(i): + sign = (1 - ((HxOverrides.rshift(i, 31) << 1))) + e = ((i >> 23) & 255) + if (e == 255): + if (((i & 8388607)) == 0): + if (sign > 0): + return Math.POSITIVE_INFINITY + else: + return Math.NEGATIVE_INFINITY + else: + return Math.NaN + else: + m = ((((i & 8388607)) << 1) if ((e == 0)) else ((i & 8388607) | 8388608)) + return ((sign * m) * Math.pow(2,(e - 150))) + + @staticmethod + def floatToI32(f): + if (f == 0): + return 0 + else: + af = (-f if ((f < 0)) else f) + exp = Math.floor((((Math.NEGATIVE_INFINITY if ((af == 0.0)) else (Math.NaN if ((af < 0.0)) else python_lib_Math.log(af)))) / 0.6931471805599453)) + if (exp > 127): + return 2139095040 + else: + if (exp <= -127): + exp = -127 + af = (af * 7.1362384635298e+44) + else: + af = ((((af / Math.pow(2,exp)) - 1.0)) * 8388608) + return ((((-2147483648 if ((f < 0)) else 0)) | (((exp + 127) << 23))) | Math.floor((af + 0.5))) + + @staticmethod + def i64ToDouble(low,high): + sign = (1 - ((HxOverrides.rshift(high, 31) << 1))) + e = ((high >> 20) & 2047) + if (e == 2047): + if ((low == 0) and ((((high & 1048575)) == 0))): + if (sign > 0): + return Math.POSITIVE_INFINITY + else: + return Math.NEGATIVE_INFINITY + else: + return Math.NaN + else: + m = (2.220446049250313e-16 * ((((((high & 1048575)) * 4294967296.) + (((HxOverrides.rshift(low, 31)) * 2147483648.))) + ((low & 2147483647))))) + if (e == 0): + m = (m * 2.0) + else: + m = (m + 1.0) + return ((sign * m) * Math.pow(2,(e - 1023))) + + @staticmethod + def doubleToI64(v): + i64 = haxe_io_FPHelper.i64tmp + if (v == 0): + i64.low = 0 + i64.high = 0 + elif (not ((((v != Math.POSITIVE_INFINITY) and ((v != Math.NEGATIVE_INFINITY))) and (not python_lib_Math.isnan(v))))): + i64.low = 0 + i64.high = (2146435072 if ((v > 0)) else -1048576) + else: + av = (-v if ((v < 0)) else v) + exp = Math.floor((((Math.NEGATIVE_INFINITY if ((av == 0.0)) else (Math.NaN if ((av < 0.0)) else python_lib_Math.log(av)))) / 0.6931471805599453)) + if (exp > 1023): + i64.low = -1 + i64.high = 2146435071 + else: + if (exp <= -1023): + exp = -1023 + av = (av / 2.2250738585072014e-308) + else: + av = ((av / Math.pow(2,exp)) - 1.0) + v1 = (av * 4503599627370496.) + sig = (v1 if (((v1 == Math.POSITIVE_INFINITY) or ((v1 == Math.NEGATIVE_INFINITY)))) else (Math.NaN if (python_lib_Math.isnan(v1)) else Math.floor((v1 + 0.5)))) + sig_l = None + try: + sig_l = int(sig) + except BaseException as _g: + None + sig_l = None + sig_l1 = sig_l + sig_h = None + try: + sig_h = int((sig / 4294967296.0)) + except BaseException as _g: + None + sig_h = None + sig_h1 = sig_h + i64.low = sig_l1 + i64.high = ((((-2147483648 if ((v < 0)) else 0)) | (((exp + 1023) << 20))) | sig_h1) + return i64 + + +class haxe_io_Input: + _hx_class_name = "haxe.io.Input" + __slots__ = ("bigEndian",) + _hx_fields = ["bigEndian"] + _hx_methods = ["readByte", "readBytes", "close", "set_bigEndian", "readAll", "readFullBytes", "read", "readUntil", "readLine", "readFloat", "readDouble", "readInt8", "readInt16", "readUInt16", "readInt24", "readUInt24", "readInt32", "readString", "getDoubleSig"] + + def readByte(self): + raise haxe_exceptions_NotImplementedException(None,None,_hx_AnonObject({'fileName': "haxe/io/Input.hx", 'lineNumber': 53, 'className': "haxe.io.Input", 'methodName': "readByte"})) + + def readBytes(self,s,pos,_hx_len): + k = _hx_len + b = s.b + if (((pos < 0) or ((_hx_len < 0))) or (((pos + _hx_len) > s.length))): + raise haxe_Exception.thrown(haxe_io_Error.OutsideBounds) + try: + while (k > 0): + b[pos] = self.readByte() + pos = (pos + 1) + k = (k - 1) + except BaseException as _g: + None + if (not Std.isOfType(haxe_Exception.caught(_g).unwrap(),haxe_io_Eof)): + raise _g + return (_hx_len - k) + + def close(self): + pass + + def set_bigEndian(self,b): + self.bigEndian = b + return b + + def readAll(self,bufsize = None): + if (bufsize is None): + bufsize = 16384 + buf = haxe_io_Bytes.alloc(bufsize) + total = haxe_io_BytesBuffer() + try: + while True: + _hx_len = self.readBytes(buf,0,bufsize) + if (_hx_len == 0): + raise haxe_Exception.thrown(haxe_io_Error.Blocked) + if ((_hx_len < 0) or ((_hx_len > buf.length))): + raise haxe_Exception.thrown(haxe_io_Error.OutsideBounds) + total.b.extend(buf.b[0:_hx_len]) + except BaseException as _g: + None + if (not Std.isOfType(haxe_Exception.caught(_g).unwrap(),haxe_io_Eof)): + raise _g + return total.getBytes() + + def readFullBytes(self,s,pos,_hx_len): + while (_hx_len > 0): + k = self.readBytes(s,pos,_hx_len) + if (k == 0): + raise haxe_Exception.thrown(haxe_io_Error.Blocked) + pos = (pos + k) + _hx_len = (_hx_len - k) + + def read(self,nbytes): + s = haxe_io_Bytes.alloc(nbytes) + p = 0 + while (nbytes > 0): + k = self.readBytes(s,p,nbytes) + if (k == 0): + raise haxe_Exception.thrown(haxe_io_Error.Blocked) + p = (p + k) + nbytes = (nbytes - k) + return s + + def readUntil(self,end): + buf = haxe_io_BytesBuffer() + last = None + while True: + last = self.readByte() + if (not ((last != end))): + break + buf.b.append(last) + return buf.getBytes().toString() + + def readLine(self): + buf = haxe_io_BytesBuffer() + last = None + s = None + try: + while True: + last = self.readByte() + if (not ((last != 10))): + break + buf.b.append(last) + s = buf.getBytes().toString() + if (HxString.charCodeAt(s,(len(s) - 1)) == 13): + s = HxString.substr(s,0,-1) + except BaseException as _g: + None + _g1 = haxe_Exception.caught(_g).unwrap() + if Std.isOfType(_g1,haxe_io_Eof): + e = _g1 + s = buf.getBytes().toString() + if (len(s) == 0): + raise haxe_Exception.thrown(e) + else: + raise _g + return s + + def readFloat(self): + return haxe_io_FPHelper.i32ToFloat(self.readInt32()) + + def readDouble(self): + i1 = self.readInt32() + i2 = self.readInt32() + if self.bigEndian: + return haxe_io_FPHelper.i64ToDouble(i2,i1) + else: + return haxe_io_FPHelper.i64ToDouble(i1,i2) + + def readInt8(self): + n = self.readByte() + if (n >= 128): + return (n - 256) + return n + + def readInt16(self): + ch1 = self.readByte() + ch2 = self.readByte() + n = ((ch2 | ((ch1 << 8))) if (self.bigEndian) else (ch1 | ((ch2 << 8)))) + if (((n & 32768)) != 0): + return (n - 65536) + return n + + def readUInt16(self): + ch1 = self.readByte() + ch2 = self.readByte() + if self.bigEndian: + return (ch2 | ((ch1 << 8))) + else: + return (ch1 | ((ch2 << 8))) + + def readInt24(self): + ch1 = self.readByte() + ch2 = self.readByte() + ch3 = self.readByte() + n = (((ch3 | ((ch2 << 8))) | ((ch1 << 16))) if (self.bigEndian) else ((ch1 | ((ch2 << 8))) | ((ch3 << 16)))) + if (((n & 8388608)) != 0): + return (n - 16777216) + return n + + def readUInt24(self): + ch1 = self.readByte() + ch2 = self.readByte() + ch3 = self.readByte() + if self.bigEndian: + return ((ch3 | ((ch2 << 8))) | ((ch1 << 16))) + else: + return ((ch1 | ((ch2 << 8))) | ((ch3 << 16))) + + def readInt32(self): + ch1 = self.readByte() + ch2 = self.readByte() + ch3 = self.readByte() + ch4 = self.readByte() + n = ((((ch4 | ((ch3 << 8))) | ((ch2 << 16))) | ((ch1 << 24))) if (self.bigEndian) else (((ch1 | ((ch2 << 8))) | ((ch3 << 16))) | ((ch4 << 24)))) + if (((n & -2147483648)) != 0): + return (n | -2147483648) + else: + return n + + def readString(self,_hx_len,encoding = None): + b = haxe_io_Bytes.alloc(_hx_len) + self.readFullBytes(b,0,_hx_len) + return b.getString(0,_hx_len,encoding) + + def getDoubleSig(self,_hx_bytes): + return ((((((((((_hx_bytes[1] if 1 < len(_hx_bytes) else None) & 15)) << 16) | (((_hx_bytes[2] if 2 < len(_hx_bytes) else None) << 8))) | (_hx_bytes[3] if 3 < len(_hx_bytes) else None))) * 4294967296.) + (((((_hx_bytes[4] if 4 < len(_hx_bytes) else None) >> 7)) * 2147483648))) + ((((((((_hx_bytes[4] if 4 < len(_hx_bytes) else None) & 127)) << 24) | (((_hx_bytes[5] if 5 < len(_hx_bytes) else None) << 16))) | (((_hx_bytes[6] if 6 < len(_hx_bytes) else None) << 8))) | (_hx_bytes[7] if 7 < len(_hx_bytes) else None)))) + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.bigEndian = None + + +class haxe_io_Output: + _hx_class_name = "haxe.io.Output" + __slots__ = ("bigEndian",) + _hx_fields = ["bigEndian"] + _hx_methods = ["writeByte", "writeBytes", "flush", "close", "set_bigEndian", "write", "writeFullBytes", "writeFloat", "writeDouble", "writeInt8", "writeInt16", "writeUInt16", "writeInt24", "writeUInt24", "writeInt32", "prepare", "writeInput", "writeString"] + + def writeByte(self,c): + raise haxe_exceptions_NotImplementedException(None,None,_hx_AnonObject({'fileName': "haxe/io/Output.hx", 'lineNumber': 47, 'className': "haxe.io.Output", 'methodName': "writeByte"})) + + def writeBytes(self,s,pos,_hx_len): + if (((pos < 0) or ((_hx_len < 0))) or (((pos + _hx_len) > s.length))): + raise haxe_Exception.thrown(haxe_io_Error.OutsideBounds) + b = s.b + k = _hx_len + while (k > 0): + self.writeByte(b[pos]) + pos = (pos + 1) + k = (k - 1) + return _hx_len + + def flush(self): + pass + + def close(self): + pass + + def set_bigEndian(self,b): + self.bigEndian = b + return b + + def write(self,s): + l = s.length + p = 0 + while (l > 0): + k = self.writeBytes(s,p,l) + if (k == 0): + raise haxe_Exception.thrown(haxe_io_Error.Blocked) + p = (p + k) + l = (l - k) + + def writeFullBytes(self,s,pos,_hx_len): + while (_hx_len > 0): + k = self.writeBytes(s,pos,_hx_len) + pos = (pos + k) + _hx_len = (_hx_len - k) + + def writeFloat(self,x): + self.writeInt32(haxe_io_FPHelper.floatToI32(x)) + + def writeDouble(self,x): + i64 = haxe_io_FPHelper.doubleToI64(x) + if self.bigEndian: + self.writeInt32(i64.high) + self.writeInt32(i64.low) + else: + self.writeInt32(i64.low) + self.writeInt32(i64.high) + + def writeInt8(self,x): + if ((x < -128) or ((x >= 128))): + raise haxe_Exception.thrown(haxe_io_Error.Overflow) + self.writeByte((x & 255)) + + def writeInt16(self,x): + if ((x < -32768) or ((x >= 32768))): + raise haxe_Exception.thrown(haxe_io_Error.Overflow) + self.writeUInt16((x & 65535)) + + def writeUInt16(self,x): + if ((x < 0) or ((x >= 65536))): + raise haxe_Exception.thrown(haxe_io_Error.Overflow) + if self.bigEndian: + self.writeByte((x >> 8)) + self.writeByte((x & 255)) + else: + self.writeByte((x & 255)) + self.writeByte((x >> 8)) + + def writeInt24(self,x): + if ((x < -8388608) or ((x >= 8388608))): + raise haxe_Exception.thrown(haxe_io_Error.Overflow) + self.writeUInt24((x & 16777215)) + + def writeUInt24(self,x): + if ((x < 0) or ((x >= 16777216))): + raise haxe_Exception.thrown(haxe_io_Error.Overflow) + if self.bigEndian: + self.writeByte((x >> 16)) + self.writeByte(((x >> 8) & 255)) + self.writeByte((x & 255)) + else: + self.writeByte((x & 255)) + self.writeByte(((x >> 8) & 255)) + self.writeByte((x >> 16)) + + def writeInt32(self,x): + if self.bigEndian: + self.writeByte(HxOverrides.rshift(x, 24)) + self.writeByte(((x >> 16) & 255)) + self.writeByte(((x >> 8) & 255)) + self.writeByte((x & 255)) + else: + self.writeByte((x & 255)) + self.writeByte(((x >> 8) & 255)) + self.writeByte(((x >> 16) & 255)) + self.writeByte(HxOverrides.rshift(x, 24)) + + def prepare(self,nbytes): + pass + + def writeInput(self,i,bufsize = None): + if (bufsize is None): + bufsize = 4096 + buf = haxe_io_Bytes.alloc(bufsize) + try: + while True: + _hx_len = i.readBytes(buf,0,bufsize) + if (_hx_len == 0): + raise haxe_Exception.thrown(haxe_io_Error.Blocked) + p = 0 + while (_hx_len > 0): + k = self.writeBytes(buf,p,_hx_len) + if (k == 0): + raise haxe_Exception.thrown(haxe_io_Error.Blocked) + p = (p + k) + _hx_len = (_hx_len - k) + except BaseException as _g: + None + if (not Std.isOfType(haxe_Exception.caught(_g).unwrap(),haxe_io_Eof)): + raise _g + + def writeString(self,s,encoding = None): + b = haxe_io_Bytes.ofString(s,encoding) + self.writeFullBytes(b,0,b.length) + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.bigEndian = None + + +class haxe_io_Path: + _hx_class_name = "haxe.io.Path" + __slots__ = ("dir", "file", "ext", "backslash") + _hx_fields = ["dir", "file", "ext", "backslash"] + _hx_methods = ["toString"] + _hx_statics = ["withoutExtension", "withoutDirectory", "directory", "extension", "withExtension", "join", "normalize", "addTrailingSlash", "removeTrailingSlashes", "isAbsolute", "unescape", "escape"] + + def __init__(self,path): + self.backslash = None + self.ext = None + self.file = None + self.dir = None + path1 = path + _hx_local_0 = len(path1) + if (_hx_local_0 == 1): + if (path1 == "."): + self.dir = path + self.file = "" + return + elif (_hx_local_0 == 2): + if (path1 == ".."): + self.dir = path + self.file = "" + return + else: + pass + startIndex = None + c1 = None + if (startIndex is None): + c1 = path.rfind("/", 0, len(path)) + else: + i = path.rfind("/", 0, (startIndex + 1)) + startLeft = (max(0,((startIndex + 1) - len("/"))) if ((i == -1)) else (i + 1)) + check = path.find("/", startLeft, len(path)) + c1 = (check if (((check > i) and ((check <= startIndex)))) else i) + startIndex = None + c2 = None + if (startIndex is None): + c2 = path.rfind("\\", 0, len(path)) + else: + i = path.rfind("\\", 0, (startIndex + 1)) + startLeft = (max(0,((startIndex + 1) - len("\\"))) if ((i == -1)) else (i + 1)) + check = path.find("\\", startLeft, len(path)) + c2 = (check if (((check > i) and ((check <= startIndex)))) else i) + if (c1 < c2): + self.dir = HxString.substr(path,0,c2) + path = HxString.substr(path,(c2 + 1),None) + self.backslash = True + elif (c2 < c1): + self.dir = HxString.substr(path,0,c1) + path = HxString.substr(path,(c1 + 1),None) + else: + self.dir = None + startIndex = None + cp = None + if (startIndex is None): + cp = path.rfind(".", 0, len(path)) + else: + i = path.rfind(".", 0, (startIndex + 1)) + startLeft = (max(0,((startIndex + 1) - len("."))) if ((i == -1)) else (i + 1)) + check = path.find(".", startLeft, len(path)) + cp = (check if (((check > i) and ((check <= startIndex)))) else i) + if (cp != -1): + self.ext = HxString.substr(path,(cp + 1),None) + self.file = HxString.substr(path,0,cp) + else: + self.ext = None + self.file = path + + def toString(self): + return ((HxOverrides.stringOrNull((("" if ((self.dir is None)) else (HxOverrides.stringOrNull(self.dir) + HxOverrides.stringOrNull((("\\" if (self.backslash) else "/"))))))) + HxOverrides.stringOrNull(self.file)) + HxOverrides.stringOrNull((("" if ((self.ext is None)) else ("." + HxOverrides.stringOrNull(self.ext)))))) + + @staticmethod + def withoutExtension(path): + s = haxe_io_Path(path) + s.ext = None + return s.toString() + + @staticmethod + def withoutDirectory(path): + s = haxe_io_Path(path) + s.dir = None + return s.toString() + + @staticmethod + def directory(path): + s = haxe_io_Path(path) + if (s.dir is None): + return "" + return s.dir + + @staticmethod + def extension(path): + s = haxe_io_Path(path) + if (s.ext is None): + return "" + return s.ext + + @staticmethod + def withExtension(path,ext): + s = haxe_io_Path(path) + s.ext = ext + return s.toString() + + @staticmethod + def join(paths): + def _hx_local_0(s): + if (s is not None): + return (s != "") + else: + return False + paths1 = list(filter(_hx_local_0,paths)) + if (len(paths1) == 0): + return "" + path = (paths1[0] if 0 < len(paths1) else None) + _g = 1 + _g1 = len(paths1) + while (_g < _g1): + i = _g + _g = (_g + 1) + path = haxe_io_Path.addTrailingSlash(path) + path = (("null" if path is None else path) + HxOverrides.stringOrNull((paths1[i] if i >= 0 and i < len(paths1) else None))) + return haxe_io_Path.normalize(path) + + @staticmethod + def normalize(path): + slash = "/" + _this = path.split("\\") + path = slash.join([python_Boot.toString1(x1,'') for x1 in _this]) + if (path == slash): + return slash + target = [] + _g = 0 + _g1 = (list(path) if ((slash == "")) else path.split(slash)) + while (_g < len(_g1)): + token = (_g1[_g] if _g >= 0 and _g < len(_g1) else None) + _g = (_g + 1) + if (((token == "..") and ((len(target) > 0))) and ((python_internal_ArrayImpl._get(target, (len(target) - 1)) != ".."))): + if (len(target) != 0): + target.pop() + elif (token == ""): + if ((len(target) > 0) or ((HxString.charCodeAt(path,0) == 47))): + target.append(token) + elif (token != "."): + target.append(token) + tmp = slash.join([python_Boot.toString1(x1,'') for x1 in target]) + acc_b = python_lib_io_StringIO() + colon = False + slashes = False + _g = 0 + _g1 = len(tmp) + while (_g < _g1): + i = _g + _g = (_g + 1) + _g2 = (-1 if ((i >= len(tmp))) else ord(tmp[i])) + _g3 = _g2 + if (_g3 == 47): + if (not colon): + slashes = True + else: + i1 = _g2 + colon = False + if slashes: + acc_b.write("/") + slashes = False + acc_b.write("".join(map(chr,[i1]))) + elif (_g3 == 58): + acc_b.write(":") + colon = True + else: + i2 = _g2 + colon = False + if slashes: + acc_b.write("/") + slashes = False + acc_b.write("".join(map(chr,[i2]))) + return acc_b.getvalue() + + @staticmethod + def addTrailingSlash(path): + if (len(path) == 0): + return "/" + startIndex = None + c1 = None + if (startIndex is None): + c1 = path.rfind("/", 0, len(path)) + else: + i = path.rfind("/", 0, (startIndex + 1)) + startLeft = (max(0,((startIndex + 1) - len("/"))) if ((i == -1)) else (i + 1)) + check = path.find("/", startLeft, len(path)) + c1 = (check if (((check > i) and ((check <= startIndex)))) else i) + startIndex = None + c2 = None + if (startIndex is None): + c2 = path.rfind("\\", 0, len(path)) + else: + i = path.rfind("\\", 0, (startIndex + 1)) + startLeft = (max(0,((startIndex + 1) - len("\\"))) if ((i == -1)) else (i + 1)) + check = path.find("\\", startLeft, len(path)) + c2 = (check if (((check > i) and ((check <= startIndex)))) else i) + if (c1 < c2): + if (c2 != ((len(path) - 1))): + return (("null" if path is None else path) + "\\") + else: + return path + elif (c1 != ((len(path) - 1))): + return (("null" if path is None else path) + "/") + else: + return path + + @staticmethod + def removeTrailingSlashes(path): + while True: + _g = HxString.charCodeAt(path,(len(path) - 1)) + if (_g is None): + break + else: + _g1 = _g + if ((_g1 == 92) or ((_g1 == 47))): + path = HxString.substr(path,0,-1) + else: + break + return path + + @staticmethod + def isAbsolute(path): + if path.startswith("/"): + return True + if ((("" if ((1 >= len(path))) else path[1])) == ":"): + return True + if path.startswith("\\\\"): + return True + return False + + @staticmethod + def unescape(path): + regex = EReg("-x([0-9][0-9])","g") + def _hx_local_1(): + def _hx_local_0(regex): + code = Std.parseInt(regex.matchObj.group(1)) + return "".join(map(chr,[code])) + return regex.map(path,_hx_local_0) + return _hx_local_1() + + @staticmethod + def escape(path,allowSlashes = None): + if (allowSlashes is None): + allowSlashes = False + regex = (EReg("[^A-Za-z0-9_/\\\\\\.]","g") if allowSlashes else EReg("[^A-Za-z0-9_\\.]","g")) + def _hx_local_1(): + def _hx_local_0(v): + return ("-x" + Std.string(HxString.charCodeAt(v.matchObj.group(0),0))) + return regex.map(path,_hx_local_0) + return _hx_local_1() + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.dir = None + _hx_o.file = None + _hx_o.ext = None + _hx_o.backslash = None + + +class haxe_iterators_ArrayIterator: + _hx_class_name = "haxe.iterators.ArrayIterator" + __slots__ = ("array", "current") + _hx_fields = ["array", "current"] + _hx_methods = ["hasNext", "next"] + + def __init__(self,array): + self.current = 0 + self.array = array + + def hasNext(self): + return (self.current < len(self.array)) + + def next(self): + def _hx_local_3(): + def _hx_local_2(): + _hx_local_0 = self + _hx_local_1 = _hx_local_0.current + _hx_local_0.current = (_hx_local_1 + 1) + return _hx_local_1 + return python_internal_ArrayImpl._get(self.array, _hx_local_2()) + return _hx_local_3() + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.array = None + _hx_o.current = None + + +class haxe_iterators_ArrayKeyValueIterator: + _hx_class_name = "haxe.iterators.ArrayKeyValueIterator" + __slots__ = ("current", "array") + _hx_fields = ["current", "array"] + _hx_methods = ["hasNext", "next"] + + def __init__(self,array): + self.current = 0 + self.array = array + + def hasNext(self): + return (self.current < len(self.array)) + + def next(self): + def _hx_local_3(): + def _hx_local_2(): + _hx_local_0 = self + _hx_local_1 = _hx_local_0.current + _hx_local_0.current = (_hx_local_1 + 1) + return _hx_local_1 + return _hx_AnonObject({'value': python_internal_ArrayImpl._get(self.array, self.current), 'key': _hx_local_2()}) + return _hx_local_3() + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.current = None + _hx_o.array = None + + +class haxe_iterators_DynamicAccessIterator: + _hx_class_name = "haxe.iterators.DynamicAccessIterator" + __slots__ = ("access", "keys", "index") + _hx_fields = ["access", "keys", "index"] + _hx_methods = ["hasNext", "next"] + + def __init__(self,access): + self.access = access + self.keys = python_Boot.fields(access) + self.index = 0 + + def hasNext(self): + return (self.index < len(self.keys)) + + def next(self): + def _hx_local_2(): + _hx_local_0 = self + _hx_local_1 = _hx_local_0.index + _hx_local_0.index = (_hx_local_1 + 1) + return _hx_local_1 + key = python_internal_ArrayImpl._get(self.keys, _hx_local_2()) + return Reflect.field(self.access,key) + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.access = None + _hx_o.keys = None + _hx_o.index = None + + +class haxe_iterators_DynamicAccessKeyValueIterator: + _hx_class_name = "haxe.iterators.DynamicAccessKeyValueIterator" + __slots__ = ("access", "keys", "index") + _hx_fields = ["access", "keys", "index"] + _hx_methods = ["hasNext", "next"] + + def __init__(self,access): + self.access = access + self.keys = python_Boot.fields(access) + self.index = 0 + + def hasNext(self): + return (self.index < len(self.keys)) + + def next(self): + def _hx_local_2(): + _hx_local_0 = self + _hx_local_1 = _hx_local_0.index + _hx_local_0.index = (_hx_local_1 + 1) + return _hx_local_1 + key = python_internal_ArrayImpl._get(self.keys, _hx_local_2()) + return _hx_AnonObject({'value': Reflect.field(self.access,key), 'key': key}) + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.access = None + _hx_o.keys = None + _hx_o.index = None + + +class haxe_iterators_HashMapKeyValueIterator: + _hx_class_name = "haxe.iterators.HashMapKeyValueIterator" + __slots__ = ("map", "keys") + _hx_fields = ["map", "keys"] + _hx_methods = ["hasNext", "next"] + + def __init__(self,_hx_map): + self.map = _hx_map + self.keys = _hx_map.keys.iterator() + + def hasNext(self): + return self.keys.hasNext() + + def next(self): + key = self.keys.next() + _this = self.map.values + key1 = key.hashCode() + return _hx_AnonObject({'value': _this.h.get(key1,None), 'key': key}) + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.map = None + _hx_o.keys = None + + +class haxe_iterators_MapKeyValueIterator: + _hx_class_name = "haxe.iterators.MapKeyValueIterator" + __slots__ = ("map", "keys") + _hx_fields = ["map", "keys"] + _hx_methods = ["hasNext", "next"] + + def __init__(self,_hx_map): + self.map = _hx_map + self.keys = _hx_map.keys() + + def hasNext(self): + return self.keys.hasNext() + + def next(self): + key = self.keys.next() + return _hx_AnonObject({'value': self.map.get(key), 'key': key}) + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.map = None + _hx_o.keys = None + + +class haxe_iterators_RestIterator: + _hx_class_name = "haxe.iterators.RestIterator" + __slots__ = ("args", "current") + _hx_fields = ["args", "current"] + _hx_methods = ["hasNext", "next"] + + def __init__(self,args): + self.current = 0 + self.args = args + + def hasNext(self): + return (self.current < len(self.args)) + + def next(self): + index = self.current + self.current = (self.current + 1) + return python_internal_ArrayImpl._get(self.args, index) + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.args = None + _hx_o.current = None + + +class haxe_iterators_RestKeyValueIterator: + _hx_class_name = "haxe.iterators.RestKeyValueIterator" + __slots__ = ("args", "current") + _hx_fields = ["args", "current"] + _hx_methods = ["hasNext", "next"] + + def __init__(self,args): + self.current = 0 + self.args = args + + def hasNext(self): + return (self.current < len(self.args)) + + def next(self): + tmp = self.current + index = self.current + self.current = (self.current + 1) + return _hx_AnonObject({'key': tmp, 'value': python_internal_ArrayImpl._get(self.args, index)}) + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.args = None + _hx_o.current = None + + +class haxe_iterators_StringIterator: + _hx_class_name = "haxe.iterators.StringIterator" + __slots__ = ("offset", "s") + _hx_fields = ["offset", "s"] + _hx_methods = ["hasNext", "next"] + + def __init__(self,s): + self.offset = 0 + self.s = s + + def hasNext(self): + return (self.offset < len(self.s)) + + def next(self): + index = self.offset + self.offset = (self.offset + 1) + return ord(self.s[index]) + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.offset = None + _hx_o.s = None + + +class haxe_iterators_StringIteratorUnicode: + _hx_class_name = "haxe.iterators.StringIteratorUnicode" + __slots__ = ("offset", "s") + _hx_fields = ["offset", "s"] + _hx_methods = ["hasNext", "next"] + _hx_statics = ["unicodeIterator"] + + def __init__(self,s): + self.offset = 0 + self.s = s + + def hasNext(self): + return (self.offset < len(self.s)) + + def next(self): + index = self.offset + self.offset = (self.offset + 1) + return ord(self.s[index]) + + @staticmethod + def unicodeIterator(s): + return haxe_iterators_StringIteratorUnicode(s) + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.offset = None + _hx_o.s = None + + +class haxe_iterators_StringKeyValueIterator: + _hx_class_name = "haxe.iterators.StringKeyValueIterator" + __slots__ = ("offset", "s") + _hx_fields = ["offset", "s"] + _hx_methods = ["hasNext", "next"] + + def __init__(self,s): + self.offset = 0 + self.s = s + + def hasNext(self): + return (self.offset < len(self.s)) + + def next(self): + tmp = self.offset + s = self.s + index = self.offset + self.offset = (self.offset + 1) + return _hx_AnonObject({'key': tmp, 'value': (-1 if ((index >= len(s))) else ord(s[index]))}) + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.offset = None + _hx_o.s = None + + +class python_Boot: + _hx_class_name = "python.Boot" + __slots__ = () + _hx_statics = ["keywords", "arrayJoin", "safeJoin", "isPyBool", "isPyInt", "isPyFloat", "isClass", "isAnonObject", "_add_dynamic", "toString", "toString1", "isMetaType", "fields", "isString", "isArray", "simpleField", "createClosure", "hasField", "field", "getInstanceFields", "getSuperClass", "getClassFields", "unsafeFastCodeAt", "handleKeywords", "prefixLength", "unhandleKeywords", "implementsInterface"] + + @staticmethod + def arrayJoin(x,sep): + return sep.join([python_Boot.toString1(x1,'') for x1 in x]) + + @staticmethod + def safeJoin(x,sep): + return sep.join([x1 for x1 in x]) + + @staticmethod + def isPyBool(o): + return isinstance(o,bool) + + @staticmethod + def isPyInt(o): + if isinstance(o,int): + return (not isinstance(o,bool)) + else: + return False + + @staticmethod + def isPyFloat(o): + return isinstance(o,float) + + @staticmethod + def isClass(o): + if (o is not None): + if not HxOverrides.eq(o,str): + return python_lib_Inspect.isclass(o) + else: + return True + else: + return False + + @staticmethod + def isAnonObject(o): + return isinstance(o,_hx_AnonObject) + + @staticmethod + def _add_dynamic(a,b): + if (isinstance(a,str) and isinstance(b,str)): + return (a + b) + if (isinstance(a,str) or isinstance(b,str)): + return (python_Boot.toString1(a,"") + python_Boot.toString1(b,"")) + return (a + b) + + @staticmethod + def toString(o): + return python_Boot.toString1(o,"") + + @staticmethod + def toString1(o,s): + if (o is None): + return "null" + if isinstance(o,str): + return o + if (s is None): + s = "" + if (len(s) >= 5): + return "<...>" + if isinstance(o,bool): + if o: + return "true" + else: + return "false" + if (isinstance(o,int) and (not isinstance(o,bool))): + return str(o) + if isinstance(o,float): + try: + if (o == int(o)): + return str(Math.floor((o + 0.5))) + else: + return str(o) + except BaseException as _g: + None + return str(o) + if isinstance(o,list): + o1 = o + l = len(o1) + st = "[" + s = (("null" if s is None else s) + "\t") + _g = 0 + _g1 = l + while (_g < _g1): + i = _g + _g = (_g + 1) + prefix = "" + if (i > 0): + prefix = "," + st = (("null" if st is None else st) + HxOverrides.stringOrNull(((("null" if prefix is None else prefix) + HxOverrides.stringOrNull(python_Boot.toString1((o1[i] if i >= 0 and i < len(o1) else None),s)))))) + st = (("null" if st is None else st) + "]") + return st + try: + if hasattr(o,"toString"): + return o.toString() + except BaseException as _g: + None + if hasattr(o,"__class__"): + if isinstance(o,_hx_AnonObject): + toStr = None + try: + fields = python_Boot.fields(o) + _g = [] + _g1 = 0 + while (_g1 < len(fields)): + f = (fields[_g1] if _g1 >= 0 and _g1 < len(fields) else None) + _g1 = (_g1 + 1) + x = ((("" + ("null" if f is None else f)) + " : ") + HxOverrides.stringOrNull(python_Boot.toString1(python_Boot.simpleField(o,f),(("null" if s is None else s) + "\t")))) + _g.append(x) + fieldsStr = _g + toStr = (("{ " + HxOverrides.stringOrNull(", ".join([x1 for x1 in fieldsStr]))) + " }") + except BaseException as _g: + None + return "{ ... }" + if (toStr is None): + return "{ ... }" + else: + return toStr + if isinstance(o,Enum): + o1 = o + l = len(o1.params) + hasParams = (l > 0) + if hasParams: + paramsStr = "" + _g = 0 + _g1 = l + while (_g < _g1): + i = _g + _g = (_g + 1) + prefix = "" + if (i > 0): + prefix = "," + paramsStr = (("null" if paramsStr is None else paramsStr) + HxOverrides.stringOrNull(((("null" if prefix is None else prefix) + HxOverrides.stringOrNull(python_Boot.toString1(o1.params[i],s)))))) + return (((HxOverrides.stringOrNull(o1.tag) + "(") + ("null" if paramsStr is None else paramsStr)) + ")") + else: + return o1.tag + if hasattr(o,"_hx_class_name"): + if (o.__class__.__name__ != "type"): + fields = python_Boot.getInstanceFields(o) + _g = [] + _g1 = 0 + while (_g1 < len(fields)): + f = (fields[_g1] if _g1 >= 0 and _g1 < len(fields) else None) + _g1 = (_g1 + 1) + x = ((("" + ("null" if f is None else f)) + " : ") + HxOverrides.stringOrNull(python_Boot.toString1(python_Boot.simpleField(o,f),(("null" if s is None else s) + "\t")))) + _g.append(x) + fieldsStr = _g + toStr = (((HxOverrides.stringOrNull(o._hx_class_name) + "( ") + HxOverrides.stringOrNull(", ".join([x1 for x1 in fieldsStr]))) + " )") + return toStr + else: + fields = python_Boot.getClassFields(o) + _g = [] + _g1 = 0 + while (_g1 < len(fields)): + f = (fields[_g1] if _g1 >= 0 and _g1 < len(fields) else None) + _g1 = (_g1 + 1) + x = ((("" + ("null" if f is None else f)) + " : ") + HxOverrides.stringOrNull(python_Boot.toString1(python_Boot.simpleField(o,f),(("null" if s is None else s) + "\t")))) + _g.append(x) + fieldsStr = _g + toStr = (((("#" + HxOverrides.stringOrNull(o._hx_class_name)) + "( ") + HxOverrides.stringOrNull(", ".join([x1 for x1 in fieldsStr]))) + " )") + return toStr + if ((type(o) == type) and (o == str)): + return "#String" + if ((type(o) == type) and (o == list)): + return "#Array" + if callable(o): + return "function" + try: + if hasattr(o,"__repr__"): + return o.__repr__() + except BaseException as _g: + None + if hasattr(o,"__str__"): + return o.__str__([]) + if hasattr(o,"__name__"): + return o.__name__ + return "???" + else: + return str(o) + + @staticmethod + def isMetaType(v,t): + return ((type(v) == type) and (v == t)) + + @staticmethod + def fields(o): + a = [] + if (o is not None): + if hasattr(o,"_hx_fields"): + fields = o._hx_fields + if (fields is not None): + return list(fields) + if isinstance(o,_hx_AnonObject): + d = o.__dict__ + keys = d.keys() + handler = python_Boot.unhandleKeywords + for k in keys: + if (k != '_hx_disable_getattr'): + a.append(handler(k)) + elif hasattr(o,"__dict__"): + d = o.__dict__ + keys1 = d.keys() + for k in keys1: + a.append(k) + return a + + @staticmethod + def isString(o): + return isinstance(o,str) + + @staticmethod + def isArray(o): + return isinstance(o,list) + + @staticmethod + def simpleField(o,field): + if (field is None): + return None + field1 = (("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)) + if hasattr(o,field1): + return getattr(o,field1) + else: + return None + + @staticmethod + def createClosure(obj,func): + return python_internal_MethodClosure(obj,func) + + @staticmethod + def hasField(o,field): + if isinstance(o,_hx_AnonObject): + return o._hx_hasattr(field) + return hasattr(o,(("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field))) + + @staticmethod + def field(o,field): + if (field is None): + return None + if isinstance(o,str): + field1 = field + _hx_local_0 = len(field1) + if (_hx_local_0 == 10): + if (field1 == "charCodeAt"): + return python_internal_MethodClosure(o,HxString.charCodeAt) + else: + field1 = (("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)) + if hasattr(o,field1): + return getattr(o,field1) + else: + return None + elif (_hx_local_0 == 11): + if (field1 == "lastIndexOf"): + return python_internal_MethodClosure(o,HxString.lastIndexOf) + elif (field1 == "toLowerCase"): + return python_internal_MethodClosure(o,HxString.toLowerCase) + elif (field1 == "toUpperCase"): + return python_internal_MethodClosure(o,HxString.toUpperCase) + else: + field1 = (("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)) + if hasattr(o,field1): + return getattr(o,field1) + else: + return None + elif (_hx_local_0 == 9): + if (field1 == "substring"): + return python_internal_MethodClosure(o,HxString.substring) + else: + field1 = (("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)) + if hasattr(o,field1): + return getattr(o,field1) + else: + return None + elif (_hx_local_0 == 5): + if (field1 == "split"): + return python_internal_MethodClosure(o,HxString.split) + else: + field1 = (("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)) + if hasattr(o,field1): + return getattr(o,field1) + else: + return None + elif (_hx_local_0 == 7): + if (field1 == "indexOf"): + return python_internal_MethodClosure(o,HxString.indexOf) + else: + field1 = (("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)) + if hasattr(o,field1): + return getattr(o,field1) + else: + return None + elif (_hx_local_0 == 8): + if (field1 == "toString"): + return python_internal_MethodClosure(o,HxString.toString) + else: + field1 = (("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)) + if hasattr(o,field1): + return getattr(o,field1) + else: + return None + elif (_hx_local_0 == 6): + if (field1 == "charAt"): + return python_internal_MethodClosure(o,HxString.charAt) + elif (field1 == "length"): + return len(o) + elif (field1 == "substr"): + return python_internal_MethodClosure(o,HxString.substr) + else: + field1 = (("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)) + if hasattr(o,field1): + return getattr(o,field1) + else: + return None + else: + field1 = (("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)) + if hasattr(o,field1): + return getattr(o,field1) + else: + return None + elif isinstance(o,list): + field1 = field + _hx_local_1 = len(field1) + if (_hx_local_1 == 11): + if (field1 == "lastIndexOf"): + return python_internal_MethodClosure(o,python_internal_ArrayImpl.lastIndexOf) + else: + field1 = (("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)) + if hasattr(o,field1): + return getattr(o,field1) + else: + return None + elif (_hx_local_1 == 4): + if (field1 == "copy"): + return python_internal_MethodClosure(o,python_internal_ArrayImpl.copy) + elif (field1 == "join"): + return python_internal_MethodClosure(o,python_internal_ArrayImpl.join) + elif (field1 == "push"): + return python_internal_MethodClosure(o,python_internal_ArrayImpl.push) + elif (field1 == "sort"): + return python_internal_MethodClosure(o,python_internal_ArrayImpl.sort) + else: + field1 = (("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)) + if hasattr(o,field1): + return getattr(o,field1) + else: + return None + elif (_hx_local_1 == 5): + if (field1 == "shift"): + return python_internal_MethodClosure(o,python_internal_ArrayImpl.shift) + elif (field1 == "slice"): + return python_internal_MethodClosure(o,python_internal_ArrayImpl.slice) + else: + field1 = (("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)) + if hasattr(o,field1): + return getattr(o,field1) + else: + return None + elif (_hx_local_1 == 7): + if (field1 == "indexOf"): + return python_internal_MethodClosure(o,python_internal_ArrayImpl.indexOf) + elif (field1 == "reverse"): + return python_internal_MethodClosure(o,python_internal_ArrayImpl.reverse) + elif (field1 == "unshift"): + return python_internal_MethodClosure(o,python_internal_ArrayImpl.unshift) + else: + field1 = (("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)) + if hasattr(o,field1): + return getattr(o,field1) + else: + return None + elif (_hx_local_1 == 3): + if (field1 == "map"): + return python_internal_MethodClosure(o,python_internal_ArrayImpl.map) + elif (field1 == "pop"): + return python_internal_MethodClosure(o,python_internal_ArrayImpl.pop) + else: + field1 = (("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)) + if hasattr(o,field1): + return getattr(o,field1) + else: + return None + elif (_hx_local_1 == 8): + if (field1 == "contains"): + return python_internal_MethodClosure(o,python_internal_ArrayImpl.contains) + elif (field1 == "iterator"): + return python_internal_MethodClosure(o,python_internal_ArrayImpl.iterator) + elif (field1 == "toString"): + return python_internal_MethodClosure(o,python_internal_ArrayImpl.toString) + else: + field1 = (("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)) + if hasattr(o,field1): + return getattr(o,field1) + else: + return None + elif (_hx_local_1 == 16): + if (field1 == "keyValueIterator"): + return python_internal_MethodClosure(o,python_internal_ArrayImpl.keyValueIterator) + else: + field1 = (("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)) + if hasattr(o,field1): + return getattr(o,field1) + else: + return None + elif (_hx_local_1 == 6): + if (field1 == "concat"): + return python_internal_MethodClosure(o,python_internal_ArrayImpl.concat) + elif (field1 == "filter"): + return python_internal_MethodClosure(o,python_internal_ArrayImpl.filter) + elif (field1 == "insert"): + return python_internal_MethodClosure(o,python_internal_ArrayImpl.insert) + elif (field1 == "length"): + return len(o) + elif (field1 == "remove"): + return python_internal_MethodClosure(o,python_internal_ArrayImpl.remove) + elif (field1 == "splice"): + return python_internal_MethodClosure(o,python_internal_ArrayImpl.splice) + else: + field1 = (("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)) + if hasattr(o,field1): + return getattr(o,field1) + else: + return None + else: + field1 = (("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)) + if hasattr(o,field1): + return getattr(o,field1) + else: + return None + else: + field1 = (("_hx_" + field) if ((field in python_Boot.keywords)) else (("_hx_" + field) if (((((len(field) > 2) and ((ord(field[0]) == 95))) and ((ord(field[1]) == 95))) and ((ord(field[(len(field) - 1)]) != 95)))) else field)) + if hasattr(o,field1): + return getattr(o,field1) + else: + return None + + @staticmethod + def getInstanceFields(c): + f = (list(c._hx_fields) if (hasattr(c,"_hx_fields")) else []) + if hasattr(c,"_hx_methods"): + f = (f + c._hx_methods) + sc = python_Boot.getSuperClass(c) + if (sc is None): + return f + else: + scArr = python_Boot.getInstanceFields(sc) + scMap = set(scArr) + _g = 0 + while (_g < len(f)): + f1 = (f[_g] if _g >= 0 and _g < len(f) else None) + _g = (_g + 1) + if (not (f1 in scMap)): + scArr.append(f1) + return scArr + + @staticmethod + def getSuperClass(c): + if (c is None): + return None + try: + if hasattr(c,"_hx_super"): + return c._hx_super + return None + except BaseException as _g: + None + return None + + @staticmethod + def getClassFields(c): + if hasattr(c,"_hx_statics"): + x = c._hx_statics + return list(x) + else: + return [] + + @staticmethod + def unsafeFastCodeAt(s,index): + return ord(s[index]) + + @staticmethod + def handleKeywords(name): + if (name in python_Boot.keywords): + return ("_hx_" + name) + elif ((((len(name) > 2) and ((ord(name[0]) == 95))) and ((ord(name[1]) == 95))) and ((ord(name[(len(name) - 1)]) != 95))): + return ("_hx_" + name) + else: + return name + + @staticmethod + def unhandleKeywords(name): + if (HxString.substr(name,0,python_Boot.prefixLength) == "_hx_"): + real = HxString.substr(name,python_Boot.prefixLength,None) + if (real in python_Boot.keywords): + return real + return name + + @staticmethod + def implementsInterface(value,cls): + loop = None + def _hx_local_1(intf): + f = (intf._hx_interfaces if (hasattr(intf,"_hx_interfaces")) else []) + if (f is not None): + _g = 0 + while (_g < len(f)): + i = (f[_g] if _g >= 0 and _g < len(f) else None) + _g = (_g + 1) + if (i == cls): + return True + else: + l = loop(i) + if l: + return True + return False + else: + return False + loop = _hx_local_1 + currentClass = value.__class__ + result = False + while (currentClass is not None): + if loop(currentClass): + result = True + break + currentClass = python_Boot.getSuperClass(currentClass) + return result + + +class python_HaxeIterable: + _hx_class_name = "python.HaxeIterable" + __slots__ = ("x",) + _hx_fields = ["x"] + _hx_methods = ["iterator"] + + def __init__(self,x): + self.x = x + + def iterator(self): + return python_HaxeIterator(self.x.__iter__()) + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.x = None + + +class python_HaxeIterator: + _hx_class_name = "python.HaxeIterator" + __slots__ = ("it", "x", "has", "checked") + _hx_fields = ["it", "x", "has", "checked"] + _hx_methods = ["next", "hasNext"] + + def __init__(self,it): + self.checked = False + self.has = False + self.x = None + self.it = it + + def next(self): + if (not self.checked): + self.hasNext() + self.checked = False + return self.x + + def hasNext(self): + if (not self.checked): + try: + self.x = self.it.__next__() + self.has = True + except BaseException as _g: + None + if Std.isOfType(haxe_Exception.caught(_g).unwrap(),StopIteration): + self.has = False + self.x = None + else: + raise _g + self.checked = True + return self.has + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.it = None + _hx_o.x = None + _hx_o.has = None + _hx_o.checked = None + + +class python__KwArgs_KwArgs_Impl_: + _hx_class_name = "python._KwArgs.KwArgs_Impl_" + __slots__ = () + _hx_statics = ["_new", "toDict", "toDictHelper", "fromDict", "fromT", "typed", "get"] + + @staticmethod + def _new(d): + this1 = d + return this1 + + @staticmethod + def toDict(this1): + return python__KwArgs_KwArgs_Impl_.toDictHelper(this1,None) + + @staticmethod + def toDictHelper(this1,x): + return this1 + + @staticmethod + def fromDict(d): + this1 = d + return this1 + + @staticmethod + def fromT(d): + this1 = python_Lib.anonAsDict(d) + return this1 + + @staticmethod + def typed(this1): + return _hx_AnonObject(python__KwArgs_KwArgs_Impl_.toDictHelper(this1,None)) + + @staticmethod + def get(this1,key,_hx_def): + return this1.get(key,_hx_def) + + +class python_Lib: + _hx_class_name = "python.Lib" + __slots__ = () + _hx_statics = ["lineEnd", "get___name__", "print", "printString", "println", "dictToAnon", "anonToDict", "anonAsDict", "dictAsAnon", "toPythonIterable", "toHaxeIterable", "toHaxeIterator"] + __name__ = None + + @staticmethod + def get___name__(): + return __name__ + + @staticmethod + def print(v): + python_Lib.printString(Std.string(v)) + + @staticmethod + def printString(_hx_str): + encoding = "utf-8" + if (encoding is None): + encoding = "utf-8" + python_lib_Sys.stdout.buffer.write(_hx_str.encode(encoding, "strict")) + python_lib_Sys.stdout.flush() + + @staticmethod + def println(v): + _hx_str = Std.string(v) + python_Lib.printString((("" + ("null" if _hx_str is None else _hx_str)) + HxOverrides.stringOrNull(python_Lib.lineEnd))) + + @staticmethod + def dictToAnon(v): + return _hx_AnonObject(v.copy()) + + @staticmethod + def anonToDict(o): + if isinstance(o,_hx_AnonObject): + return o.__dict__.copy() + else: + return None + + @staticmethod + def anonAsDict(o): + if isinstance(o,_hx_AnonObject): + return o.__dict__ + else: + return None + + @staticmethod + def dictAsAnon(d): + return _hx_AnonObject(d) + + @staticmethod + def toPythonIterable(it): + def _hx_local_3(): + def _hx_local_2(): + it1 = HxOverrides.iterator(it) + _hx_self = None + def _hx_local_0(): + if it1.hasNext(): + return it1.next() + else: + raise haxe_Exception.thrown(StopIteration()) + def _hx_local_1(): + return _hx_self + this1 = _hx_AnonObject({'__next__': _hx_local_0, '__iter__': _hx_local_1}) + _hx_self = this1 + return _hx_self + return _hx_AnonObject({'__iter__': _hx_local_2}) + return _hx_local_3() + + @staticmethod + def toHaxeIterable(it): + return python_HaxeIterable(it) + + @staticmethod + def toHaxeIterator(it): + return python_HaxeIterator(it) + + +class python__NativeIterable_NativeIterable_Impl_: + _hx_class_name = "python._NativeIterable.NativeIterable_Impl_" + __slots__ = () + _hx_statics = ["toHaxeIterable", "iterator"] + + @staticmethod + def toHaxeIterable(this1): + return python_HaxeIterable(this1) + + @staticmethod + def iterator(this1): + return python_HaxeIterator(this1.__iter__()) + + +class python__NativeIterator_NativeIterator_Impl_: + _hx_class_name = "python._NativeIterator.NativeIterator_Impl_" + __slots__ = () + _hx_statics = ["_new", "toHaxeIterator"] + + @staticmethod + def _new(p): + this1 = p + return this1 + + @staticmethod + def toHaxeIterator(this1): + return python_HaxeIterator(this1) + + +class python_NativeStringTools: + _hx_class_name = "python.NativeStringTools" + __slots__ = () + _hx_statics = ["format", "encode", "contains", "strip", "rpartition", "startswith", "endswith"] + + @staticmethod + def format(s,args): + return s.format(*args) + + @staticmethod + def encode(s,encoding = None,errors = None): + if (encoding is None): + encoding = "utf-8" + if (errors is None): + errors = "strict" + return s.encode(encoding, errors) + + @staticmethod + def contains(s,e): + return (e in s) + + @staticmethod + def strip(s,chars = None): + return s.strip(chars) + + @staticmethod + def rpartition(s,sep): + return s.rpartition(sep) + + @staticmethod + def startswith(s,prefix): + return s.startswith(prefix) + + @staticmethod + def endswith(s,suffix): + return s.endswith(suffix) + + +class python__VarArgs_VarArgs_Impl_: + _hx_class_name = "python._VarArgs.VarArgs_Impl_" + __slots__ = () + _hx_statics = ["_new", "raw", "toArray", "fromArray"] + + @staticmethod + def _new(d): + this1 = d + return this1 + + @staticmethod + def raw(this1): + return this1 + + @staticmethod + def toArray(this1): + if (not Std.isOfType(this1,list)): + return list(this1) + else: + return this1 + + @staticmethod + def fromArray(d): + this1 = d + return this1 + + +class python_internal_ArrayImpl: + _hx_class_name = "python.internal.ArrayImpl" + __slots__ = () + _hx_statics = ["get_length", "concat", "copy", "iterator", "keyValueIterator", "indexOf", "lastIndexOf", "join", "toString", "pop", "push", "unshift", "remove", "contains", "shift", "slice", "sort", "splice", "map", "filter", "insert", "reverse", "_get", "_set", "unsafeGet", "unsafeSet", "resize"] + + @staticmethod + def get_length(x): + return len(x) + + @staticmethod + def concat(a1,a2): + return (a1 + a2) + + @staticmethod + def copy(x): + return list(x) + + @staticmethod + def iterator(x): + return python_HaxeIterator(x.__iter__()) + + @staticmethod + def keyValueIterator(x): + return haxe_iterators_ArrayKeyValueIterator(x) + + @staticmethod + def indexOf(a,x,fromIndex = None): + _hx_len = len(a) + l = (0 if ((fromIndex is None)) else ((_hx_len + fromIndex) if ((fromIndex < 0)) else fromIndex)) + if (l < 0): + l = 0 + _g = l + _g1 = _hx_len + while (_g < _g1): + i = _g + _g = (_g + 1) + if HxOverrides.eq(a[i],x): + return i + return -1 + + @staticmethod + def lastIndexOf(a,x,fromIndex = None): + _hx_len = len(a) + l = (_hx_len if ((fromIndex is None)) else (((_hx_len + fromIndex) + 1) if ((fromIndex < 0)) else (fromIndex + 1))) + if (l > _hx_len): + l = _hx_len + while True: + l = (l - 1) + tmp = l + if (not ((tmp > -1))): + break + if HxOverrides.eq(a[l],x): + return l + return -1 + + @staticmethod + def join(x,sep): + return sep.join([python_Boot.toString1(x1,'') for x1 in x]) + + @staticmethod + def toString(x): + return (("[" + HxOverrides.stringOrNull(",".join([python_Boot.toString1(x1,'') for x1 in x]))) + "]") + + @staticmethod + def pop(x): + if (len(x) == 0): + return None + else: + return x.pop() + + @staticmethod + def push(x,e): + x.append(e) + return len(x) + + @staticmethod + def unshift(x,e): + x.insert(0, e) + + @staticmethod + def remove(x,e): + try: + x.remove(e) + return True + except BaseException as _g: + None + return False + + @staticmethod + def contains(x,e): + return (e in x) + + @staticmethod + def shift(x): + if (len(x) == 0): + return None + return x.pop(0) + + @staticmethod + def slice(x,pos,end = None): + return x[pos:end] + + @staticmethod + def sort(x,f): + x.sort(key= python_lib_Functools.cmp_to_key(f)) + + @staticmethod + def splice(x,pos,_hx_len): + if (pos < 0): + pos = (len(x) + pos) + if (pos < 0): + pos = 0 + res = x[pos:(pos + _hx_len)] + del x[pos:(pos + _hx_len)] + return res + + @staticmethod + def map(x,f): + return list(map(f,x)) + + @staticmethod + def filter(x,f): + return list(filter(f,x)) + + @staticmethod + def insert(a,pos,x): + a.insert(pos, x) + + @staticmethod + def reverse(a): + a.reverse() + + @staticmethod + def _get(x,idx): + if ((idx > -1) and ((idx < len(x)))): + return x[idx] + else: + return None + + @staticmethod + def _set(x,idx,v): + l = len(x) + while (l < idx): + x.append(None) + l = (l + 1) + if (l == idx): + x.append(v) + else: + x[idx] = v + return v + + @staticmethod + def unsafeGet(x,idx): + return x[idx] + + @staticmethod + def unsafeSet(x,idx,val): + x[idx] = val + return val + + @staticmethod + def resize(x,_hx_len): + l = len(x) + if (l < _hx_len): + idx = (_hx_len - 1) + v = None + l1 = len(x) + while (l1 < idx): + x.append(None) + l1 = (l1 + 1) + if (l1 == idx): + x.append(v) + else: + x[idx] = v + elif (l > _hx_len): + pos = _hx_len + len1 = (l - _hx_len) + if (pos < 0): + pos = (len(x) + pos) + if (pos < 0): + pos = 0 + res = x[pos:(pos + len1)] + del x[pos:(pos + len1)] + + +class HxOverrides: + _hx_class_name = "HxOverrides" + __slots__ = () + _hx_statics = ["iterator", "keyValueIterator", "eq", "stringOrNull", "shift", "pop", "push", "join", "filter", "map", "toUpperCase", "toLowerCase", "split", "length", "rshift", "modf", "mod", "arrayGet", "arraySet", "mapKwArgs", "reverseMapKwArgs"] + + @staticmethod + def iterator(x): + if isinstance(x,list): + return haxe_iterators_ArrayIterator(x) + return x.iterator() + + @staticmethod + def keyValueIterator(x): + if isinstance(x,list): + return haxe_iterators_ArrayKeyValueIterator(x) + return x.keyValueIterator() + + @staticmethod + def eq(a,b): + if (isinstance(a,list) or isinstance(b,list)): + return a is b + return (a == b) + + @staticmethod + def stringOrNull(s): + if (s is None): + return "null" + else: + return s + + @staticmethod + def shift(x): + if isinstance(x,list): + _this = x + return (None if ((len(_this) == 0)) else _this.pop(0)) + return x.shift() + + @staticmethod + def pop(x): + if isinstance(x,list): + _this = x + return (None if ((len(_this) == 0)) else _this.pop()) + return x.pop() + + @staticmethod + def push(x,e): + if isinstance(x,list): + _this = x + _this.append(e) + return len(_this) + return x.push(e) + + @staticmethod + def join(x,sep): + if isinstance(x,list): + return sep.join([python_Boot.toString1(x1,'') for x1 in x]) + return x.join(sep) + + @staticmethod + def filter(x,f): + if isinstance(x,list): + return list(filter(f,x)) + return x.filter(f) + + @staticmethod + def map(x,f): + if isinstance(x,list): + return list(map(f,x)) + return x.map(f) + + @staticmethod + def toUpperCase(x): + if isinstance(x,str): + return x.upper() + return x.toUpperCase() + + @staticmethod + def toLowerCase(x): + if isinstance(x,str): + return x.lower() + return x.toLowerCase() + + @staticmethod + def split(x,delimiter): + if isinstance(x,str): + _this = x + if (delimiter == ""): + return list(_this) + else: + return _this.split(delimiter) + return x.split(delimiter) + + @staticmethod + def length(x): + if isinstance(x,str): + return len(x) + elif isinstance(x,list): + return len(x) + return x.length + + @staticmethod + def rshift(val,n): + return ((val % 0x100000000) >> n) + + @staticmethod + def modf(a,b): + if (b == 0.0): + return float('nan') + elif (a < 0): + if (b < 0): + return -(-a % (-b)) + else: + return -(-a % b) + elif (b < 0): + return a % (-b) + else: + return a % b + + @staticmethod + def mod(a,b): + if (a < 0): + if (b < 0): + return -(-a % (-b)) + else: + return -(-a % b) + elif (b < 0): + return a % (-b) + else: + return a % b + + @staticmethod + def arrayGet(a,i): + if isinstance(a,list): + x = a + if ((i > -1) and ((i < len(x)))): + return x[i] + else: + return None + else: + return a[i] + + @staticmethod + def arraySet(a,i,v): + if isinstance(a,list): + x = a + v1 = v + l = len(x) + while (l < i): + x.append(None) + l = (l + 1) + if (l == i): + x.append(v1) + else: + x[i] = v1 + return v1 + else: + a[i] = v + return v + + @staticmethod + def mapKwArgs(a,v): + a1 = _hx_AnonObject(python_Lib.anonToDict(a)) + k = python_HaxeIterator(iter(v.keys())) + while k.hasNext(): + k1 = k.next() + val = v.get(k1) + if a1._hx_hasattr(k1): + x = getattr(a1,k1) + setattr(a1,val,x) + delattr(a1,k1) + return a1 + + @staticmethod + def reverseMapKwArgs(a,v): + a1 = a.copy() + k = python_HaxeIterator(iter(v.keys())) + while k.hasNext(): + k1 = k.next() + val = v.get(k1) + if (val in a1): + x = a1.get(val,None) + a1[k1] = x + del a1[val] + return a1 + + +class python_internal_Internal: + _hx_class_name = "python.internal.Internal" + __slots__ = () + + +class python_internal_MethodClosure: + _hx_class_name = "python.internal.MethodClosure" + __slots__ = ("obj", "func") + _hx_fields = ["obj", "func"] + _hx_methods = ["__call__"] + + def __init__(self,obj,func): + self.obj = obj + self.func = func + + def __call__(self,*args): + return self.func(self.obj,*args) + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.obj = None + _hx_o.func = None + + +class HxString: + _hx_class_name = "HxString" + __slots__ = () + _hx_statics = ["split", "charCodeAt", "charAt", "lastIndexOf", "toUpperCase", "toLowerCase", "indexOf", "indexOfImpl", "toString", "get_length", "fromCharCode", "substring", "substr"] + + @staticmethod + def split(s,d): + if (d == ""): + return list(s) + else: + return s.split(d) + + @staticmethod + def charCodeAt(s,index): + if ((((s is None) or ((len(s) == 0))) or ((index < 0))) or ((index >= len(s)))): + return None + else: + return ord(s[index]) + + @staticmethod + def charAt(s,index): + if ((index < 0) or ((index >= len(s)))): + return "" + else: + return s[index] + + @staticmethod + def lastIndexOf(s,_hx_str,startIndex = None): + if (startIndex is None): + return s.rfind(_hx_str, 0, len(s)) + elif (_hx_str == ""): + length = len(s) + if (startIndex < 0): + startIndex = (length + startIndex) + if (startIndex < 0): + startIndex = 0 + if (startIndex > length): + return length + else: + return startIndex + else: + i = s.rfind(_hx_str, 0, (startIndex + 1)) + startLeft = (max(0,((startIndex + 1) - len(_hx_str))) if ((i == -1)) else (i + 1)) + check = s.find(_hx_str, startLeft, len(s)) + if ((check > i) and ((check <= startIndex))): + return check + else: + return i + + @staticmethod + def toUpperCase(s): + return s.upper() + + @staticmethod + def toLowerCase(s): + return s.lower() + + @staticmethod + def indexOf(s,_hx_str,startIndex = None): + if (startIndex is None): + return s.find(_hx_str) + else: + return HxString.indexOfImpl(s,_hx_str,startIndex) + + @staticmethod + def indexOfImpl(s,_hx_str,startIndex): + if (_hx_str == ""): + length = len(s) + if (startIndex < 0): + startIndex = (length + startIndex) + if (startIndex < 0): + startIndex = 0 + if (startIndex > length): + return length + else: + return startIndex + return s.find(_hx_str, startIndex) + + @staticmethod + def toString(s): + return s + + @staticmethod + def get_length(s): + return len(s) + + @staticmethod + def fromCharCode(code): + return "".join(map(chr,[code])) + + @staticmethod + def substring(s,startIndex,endIndex = None): + if (startIndex < 0): + startIndex = 0 + if (endIndex is None): + return s[startIndex:] + else: + if (endIndex < 0): + endIndex = 0 + if (endIndex < startIndex): + return s[endIndex:startIndex] + else: + return s[startIndex:endIndex] + + @staticmethod + def substr(s,startIndex,_hx_len = None): + if (_hx_len is None): + return s[startIndex:] + else: + if (_hx_len == 0): + return "" + if (startIndex < 0): + startIndex = (len(s) + startIndex) + if (startIndex < 0): + startIndex = 0 + return s[startIndex:(startIndex + _hx_len)] + + +class python_io_NativeInput(haxe_io_Input): + _hx_class_name = "python.io.NativeInput" + __slots__ = ("stream", "wasEof") + _hx_fields = ["stream", "wasEof"] + _hx_methods = ["get_canSeek", "close", "tell", "throwEof", "eof", "readinto", "seek", "readBytes"] + _hx_statics = [] + _hx_interfaces = [] + _hx_super = haxe_io_Input + + + def __init__(self,s): + self.wasEof = None + self.stream = s + self.set_bigEndian(False) + self.wasEof = False + if (not self.stream.readable()): + raise haxe_Exception.thrown("Write-only stream") + + def get_canSeek(self): + return self.stream.seekable() + + def close(self): + self.stream.close() + + def tell(self): + return self.stream.tell() + + def throwEof(self): + self.wasEof = True + raise haxe_Exception.thrown(haxe_io_Eof()) + + def eof(self): + return self.wasEof + + def readinto(self,b): + raise haxe_Exception.thrown("abstract method, should be overridden") + + def seek(self,p,mode): + raise haxe_Exception.thrown("abstract method, should be overridden") + + def readBytes(self,s,pos,_hx_len): + if (((pos < 0) or ((_hx_len < 0))) or (((pos + _hx_len) > s.length))): + raise haxe_Exception.thrown(haxe_io_Error.OutsideBounds) + ba = bytearray(_hx_len) + ret = self.readinto(ba) + if (ret == 0): + self.throwEof() + s.blit(pos,haxe_io_Bytes.ofData(ba),0,_hx_len) + return ret + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.stream = None + _hx_o.wasEof = None + + +class python_io_IInput: + _hx_class_name = "python.io.IInput" + __slots__ = ("bigEndian",) + _hx_fields = ["bigEndian"] + _hx_methods = ["set_bigEndian", "readByte", "readBytes", "close", "readAll", "readFullBytes", "read", "readUntil", "readLine", "readFloat", "readDouble", "readInt8", "readInt16", "readUInt16", "readInt24", "readUInt24", "readInt32", "readString"] + + +class python_io_NativeBytesInput(python_io_NativeInput): + _hx_class_name = "python.io.NativeBytesInput" + __slots__ = () + _hx_fields = [] + _hx_methods = ["readByte", "seek", "readinto"] + _hx_statics = [] + _hx_interfaces = [python_io_IInput] + _hx_super = python_io_NativeInput + + + def __init__(self,stream): + super().__init__(stream) + + def readByte(self): + ret = self.stream.read(1) + if (len(ret) == 0): + self.throwEof() + return ret[0] + + def seek(self,p,pos): + self.wasEof = False + python_io_IoTools.seekInBinaryMode(self.stream,p,pos) + + def readinto(self,b): + return self.stream.readinto(b) + + @staticmethod + def _hx_empty_init(_hx_o): pass + + +class python_io_IFileInput: + _hx_class_name = "python.io.IFileInput" + __slots__ = () + _hx_methods = ["seek", "tell", "eof"] + _hx_interfaces = [python_io_IInput] + + +class python_io_FileBytesInput(python_io_NativeBytesInput): + _hx_class_name = "python.io.FileBytesInput" + __slots__ = () + _hx_fields = [] + _hx_methods = [] + _hx_statics = [] + _hx_interfaces = [python_io_IFileInput] + _hx_super = python_io_NativeBytesInput + + + def __init__(self,stream): + super().__init__(stream) + + +class python_io_NativeOutput(haxe_io_Output): + _hx_class_name = "python.io.NativeOutput" + __slots__ = ("stream",) + _hx_fields = ["stream"] + _hx_methods = ["get_canSeek", "close", "prepare", "flush", "tell"] + _hx_statics = [] + _hx_interfaces = [] + _hx_super = haxe_io_Output + + + def __init__(self,stream): + self.stream = None + self.set_bigEndian(False) + self.stream = stream + if (not stream.writable()): + raise haxe_Exception.thrown("Read only stream") + + def get_canSeek(self): + return self.stream.seekable() + + def close(self): + self.stream.close() + + def prepare(self,nbytes): + self.stream.truncate(nbytes) + + def flush(self): + self.stream.flush() + + def tell(self): + return self.stream.tell() + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.stream = None + + +class python_io_NativeBytesOutput(python_io_NativeOutput): + _hx_class_name = "python.io.NativeBytesOutput" + __slots__ = () + _hx_fields = [] + _hx_methods = ["seek", "prepare", "writeByte", "writeBytes"] + _hx_statics = [] + _hx_interfaces = [] + _hx_super = python_io_NativeOutput + + + def __init__(self,stream): + super().__init__(stream) + + def seek(self,p,pos): + python_io_IoTools.seekInBinaryMode(self.stream,p,pos) + + def prepare(self,nbytes): + self.stream.truncate(nbytes) + + def writeByte(self,c): + self.stream.write(bytearray([c])) + + def writeBytes(self,s,pos,_hx_len): + return self.stream.write(s.b[pos:(pos + _hx_len)]) + + @staticmethod + def _hx_empty_init(_hx_o): pass + + +class python_io_IOutput: + _hx_class_name = "python.io.IOutput" + __slots__ = ("bigEndian",) + _hx_fields = ["bigEndian"] + _hx_methods = ["set_bigEndian", "writeByte", "writeBytes", "flush", "close", "write", "writeFullBytes", "writeFloat", "writeDouble", "writeInt8", "writeInt16", "writeUInt16", "writeInt24", "writeUInt24", "writeInt32", "prepare", "writeInput", "writeString"] + + +class python_io_IFileOutput: + _hx_class_name = "python.io.IFileOutput" + __slots__ = () + _hx_methods = ["seek", "tell"] + _hx_interfaces = [python_io_IOutput] + + +class python_io_FileBytesOutput(python_io_NativeBytesOutput): + _hx_class_name = "python.io.FileBytesOutput" + __slots__ = () + _hx_fields = [] + _hx_methods = [] + _hx_statics = [] + _hx_interfaces = [python_io_IFileOutput] + _hx_super = python_io_NativeBytesOutput + + + def __init__(self,stream): + super().__init__(stream) + + +class python_io_NativeTextInput(python_io_NativeInput): + _hx_class_name = "python.io.NativeTextInput" + __slots__ = () + _hx_fields = [] + _hx_methods = ["readByte", "seek", "readinto"] + _hx_statics = [] + _hx_interfaces = [python_io_IInput] + _hx_super = python_io_NativeInput + + + def __init__(self,stream): + super().__init__(stream) + + def readByte(self): + ret = self.stream.buffer.read(1) + if (len(ret) == 0): + self.throwEof() + return ret[0] + + def seek(self,p,pos): + self.wasEof = False + python_io_IoTools.seekInTextMode(self.stream,self.tell,p,pos) + + def readinto(self,b): + return self.stream.buffer.readinto(b) + + @staticmethod + def _hx_empty_init(_hx_o): pass + + +class python_io_FileTextInput(python_io_NativeTextInput): + _hx_class_name = "python.io.FileTextInput" + __slots__ = () + _hx_fields = [] + _hx_methods = [] + _hx_statics = [] + _hx_interfaces = [python_io_IFileInput] + _hx_super = python_io_NativeTextInput + + + def __init__(self,stream): + super().__init__(stream) + + +class python_io_NativeTextOutput(python_io_NativeOutput): + _hx_class_name = "python.io.NativeTextOutput" + __slots__ = () + _hx_fields = [] + _hx_methods = ["seek", "writeBytes", "writeByte"] + _hx_statics = [] + _hx_interfaces = [] + _hx_super = python_io_NativeOutput + + + def __init__(self,stream): + super().__init__(stream) + if (not stream.writable()): + raise haxe_Exception.thrown("Read only stream") + + def seek(self,p,pos): + python_io_IoTools.seekInTextMode(self.stream,self.tell,p,pos) + + def writeBytes(self,s,pos,_hx_len): + return self.stream.buffer.write(s.b[pos:(pos + _hx_len)]) + + def writeByte(self,c): + self.stream.write("".join(map(chr,[c]))) + + @staticmethod + def _hx_empty_init(_hx_o): pass + + +class python_io_FileTextOutput(python_io_NativeTextOutput): + _hx_class_name = "python.io.FileTextOutput" + __slots__ = () + _hx_fields = [] + _hx_methods = [] + _hx_statics = [] + _hx_interfaces = [python_io_IFileOutput] + _hx_super = python_io_NativeTextOutput + + + def __init__(self,stream): + super().__init__(stream) + + +class python_io_IoTools: + _hx_class_name = "python.io.IoTools" + __slots__ = () + _hx_statics = ["createFileInputFromText", "createFileInputFromBytes", "createFileOutputFromText", "createFileOutputFromBytes", "seekInTextMode", "seekInBinaryMode"] + + @staticmethod + def createFileInputFromText(t): + return sys_io_FileInput(python_io_FileTextInput(t)) + + @staticmethod + def createFileInputFromBytes(t): + return sys_io_FileInput(python_io_FileBytesInput(t)) + + @staticmethod + def createFileOutputFromText(t): + return sys_io_FileOutput(python_io_FileTextOutput(t)) + + @staticmethod + def createFileOutputFromBytes(t): + return sys_io_FileOutput(python_io_FileBytesOutput(t)) + + @staticmethod + def seekInTextMode(stream,tell,p,pos): + pos1 = None + pos2 = pos.index + if (pos2 == 0): + pos1 = 0 + elif (pos2 == 1): + p = (tell() + p) + pos1 = 0 + elif (pos2 == 2): + stream.seek(0,2) + p = (tell() + p) + pos1 = 0 + else: + pass + stream.seek(p,pos1) + + @staticmethod + def seekInBinaryMode(stream,p,pos): + pos1 = None + pos2 = pos.index + if (pos2 == 0): + pos1 = 0 + elif (pos2 == 1): + pos1 = 1 + elif (pos2 == 2): + pos1 = 2 + else: + pass + stream.seek(p,pos1) + + +class python_lib__Re_Choice_Impl_: + _hx_class_name = "python.lib._Re.Choice_Impl_" + __slots__ = () + _hx_statics = ["fromA", "fromB"] + + @staticmethod + def fromA(x): + return x + + @staticmethod + def fromB(x): + return x + + +class python_lib__Re_RegexHelper: + _hx_class_name = "python.lib._Re.RegexHelper" + __slots__ = () + _hx_statics = ["findallDynamic"] + + @staticmethod + def findallDynamic(r,string,pos = None,endpos = None): + if (endpos is None): + if (pos is None): + return r.findall(string) + else: + return r.findall(string,pos) + else: + return r.findall(string,pos,endpos) + + +class sys_io_FileInput(haxe_io_Input): + _hx_class_name = "sys.io.FileInput" + __slots__ = ("impl",) + _hx_fields = ["impl"] + _hx_methods = ["set_bigEndian", "seek", "tell", "eof", "readByte", "readBytes", "close", "readAll", "readFullBytes", "read", "readUntil", "readLine", "readFloat", "readDouble", "readInt8", "readInt16", "readUInt16", "readInt24", "readUInt24", "readInt32", "readString"] + _hx_statics = [] + _hx_interfaces = [] + _hx_super = haxe_io_Input + + + def __init__(self,impl): + self.impl = impl + + def set_bigEndian(self,b): + return self.impl.set_bigEndian(b) + + def seek(self,p,pos): + self.impl.seek(p,pos) + + def tell(self): + return self.impl.tell() + + def eof(self): + return self.impl.eof() + + def readByte(self): + return self.impl.readByte() + + def readBytes(self,s,pos,_hx_len): + return self.impl.readBytes(s,pos,_hx_len) + + def close(self): + self.impl.close() + + def readAll(self,bufsize = None): + return self.impl.readAll(bufsize) + + def readFullBytes(self,s,pos,_hx_len): + self.impl.readFullBytes(s,pos,_hx_len) + + def read(self,nbytes): + return self.impl.read(nbytes) + + def readUntil(self,end): + return self.impl.readUntil(end) + + def readLine(self): + return self.impl.readLine() + + def readFloat(self): + return self.impl.readFloat() + + def readDouble(self): + return self.impl.readDouble() + + def readInt8(self): + return self.impl.readInt8() + + def readInt16(self): + return self.impl.readInt16() + + def readUInt16(self): + return self.impl.readUInt16() + + def readInt24(self): + return self.impl.readInt24() + + def readUInt24(self): + return self.impl.readUInt24() + + def readInt32(self): + return self.impl.readInt32() + + def readString(self,_hx_len,encoding = None): + return self.impl.readString(_hx_len) + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.impl = None + + +class sys_io_FileOutput(haxe_io_Output): + _hx_class_name = "sys.io.FileOutput" + __slots__ = ("impl",) + _hx_fields = ["impl"] + _hx_methods = ["seek", "tell", "set_bigEndian", "writeByte", "writeBytes", "flush", "close", "write", "writeFullBytes", "writeFloat", "writeDouble", "writeInt8", "writeInt16", "writeUInt16", "writeInt24", "writeUInt24", "writeInt32", "prepare", "writeInput", "writeString"] + _hx_statics = [] + _hx_interfaces = [] + _hx_super = haxe_io_Output + + + def __init__(self,impl): + self.impl = impl + + def seek(self,p,pos): + self.impl.seek(p,pos) + + def tell(self): + return self.impl.tell() + + def set_bigEndian(self,b): + return self.impl.set_bigEndian(b) + + def writeByte(self,c): + self.impl.writeByte(c) + + def writeBytes(self,s,pos,_hx_len): + return self.impl.writeBytes(s,pos,_hx_len) + + def flush(self): + self.impl.flush() + + def close(self): + self.impl.close() + + def write(self,s): + self.impl.write(s) + + def writeFullBytes(self,s,pos,_hx_len): + self.impl.writeFullBytes(s,pos,_hx_len) + + def writeFloat(self,x): + self.impl.writeFloat(x) + + def writeDouble(self,x): + self.impl.writeDouble(x) + + def writeInt8(self,x): + self.impl.writeInt8(x) + + def writeInt16(self,x): + self.impl.writeInt16(x) + + def writeUInt16(self,x): + self.impl.writeUInt16(x) + + def writeInt24(self,x): + self.impl.writeInt24(x) + + def writeUInt24(self,x): + self.impl.writeUInt24(x) + + def writeInt32(self,x): + self.impl.writeInt32(x) + + def prepare(self,nbytes): + self.impl.prepare(nbytes) + + def writeInput(self,i,bufsize = None): + self.impl.writeInput(i,bufsize) + + def writeString(self,s,encoding = None): + self.impl.writeString(s) + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.impl = None + +class sys_io_FileSeek(Enum): + __slots__ = () + _hx_class_name = "sys.io.FileSeek" + _hx_constructs = ["SeekBegin", "SeekCur", "SeekEnd"] +sys_io_FileSeek.SeekBegin = sys_io_FileSeek("SeekBegin", 0, ()) +sys_io_FileSeek.SeekCur = sys_io_FileSeek("SeekCur", 1, ()) +sys_io_FileSeek.SeekEnd = sys_io_FileSeek("SeekEnd", 2, ()) + + +class xrfragment_Query: + _hx_class_name = "xrfragment.Query" + __slots__ = ("str", "q", "include", "exclude", "accept", "preset") + _hx_fields = ["str", "q", "include", "exclude", "accept", "preset"] + _hx_methods = ["toObject", "qualify", "parse", "test"] + + def __init__(self,_hx_str): + self.preset = "" + self.accept = False + self.exclude = list() + self.include = list() + self.q = _hx_AnonObject({}) + self.str = "" + if (_hx_str is not None): + self.parse(_hx_str) + + def toObject(self): + return self.q + + def qualify(self,nodename): + if Reflect.field(self.q,"copy_all"): + self.accept = True + if (nodename in self.include): + self.accept = True + if (nodename in self.exclude): + self.accept = False + return self.accept + + def parse(self,_hx_str,recurse = None): + if (recurse is None): + recurse = False + _gthis = self + copyAll = (Reflect.field(self.q,"copy_all") if recurse else (((HxString.substr(_hx_str,0,1) == "-") or ((HxString.substr(_hx_str,0,1) == "?"))) or ((_hx_str == "")))) + isOr = EReg("^or$","") + isProp = EReg(".*:[><=!]?","") + isName = EReg("[^:/]","") + isExclude = EReg("^-","") + isInclude = EReg("^\\+","") + isPreset = EReg("^\\?","") + token = _hx_str.split(" ") + ors = list() + q = _hx_AnonObject({}) + def _hx_local_0(): + nonlocal q + q = _hx_AnonObject({}) + value = list() + setattr(q,(("_hx_" + "object") if (("object" in python_Boot.keywords)) else (("_hx_" + "object") if (((((len("object") > 2) and ((ord("object"[0]) == 95))) and ((ord("object"[1]) == 95))) and ((ord("object"[(len("object") - 1)]) != 95)))) else "object")),value) + value = list() + setattr(q,(("_hx_" + "-object") if (("-object" in python_Boot.keywords)) else (("_hx_" + "-object") if (((((len("-object") > 2) and ((ord("-object"[0]) == 95))) and ((ord("-object"[1]) == 95))) and ((ord("-object"[(len("-object") - 1)]) != 95)))) else "-object")),value) + ors.append(q) + return q + composeQuery = _hx_local_0 + composeQuery() + match = None + def _hx_local_2(_hx_str,prefix = None): + if (prefix is None): + prefix = "" + isPreset.matchObj = python_lib_Re.search(isPreset.pattern,_hx_str) + if ((isPreset.matchObj is not None) and (not recurse)): + _gthis.preset = _hx_str + return + match1 = None + isExclude.matchObj = python_lib_Re.search(isExclude.pattern,_hx_str) + if (isExclude.matchObj is None): + isInclude.matchObj = python_lib_Re.search(isInclude.pattern,_hx_str) + match1 = (isInclude.matchObj is not None) + else: + match1 = True + if match1: + t = HxString.substr(_hx_str,1,None) + match(t,HxString.substr(_hx_str,0,1)) + return + isProp.matchObj = python_lib_Re.search(isProp.pattern,_hx_str) + if (isProp.matchObj is not None): + skip = 0 + _hx_type = "=" + startIndex = None + if (((_hx_str.find("*") if ((startIndex is None)) else HxString.indexOfImpl(_hx_str,"*",startIndex))) != -1): + _hx_type = "*" + startIndex = None + if (((_hx_str.find(">") if ((startIndex is None)) else HxString.indexOfImpl(_hx_str,">",startIndex))) != -1): + _hx_type = ">" + startIndex = None + if (((_hx_str.find("<") if ((startIndex is None)) else HxString.indexOfImpl(_hx_str,"<",startIndex))) != -1): + _hx_type = "<" + startIndex = None + if (((_hx_str.find("!=") if ((startIndex is None)) else HxString.indexOfImpl(_hx_str,"!=",startIndex))) != -1): + _hx_type = "!=" + startIndex = None + if (((_hx_str.find(">=") if ((startIndex is None)) else HxString.indexOfImpl(_hx_str,">=",startIndex))) != -1): + _hx_type = ">=" + startIndex = None + if (((_hx_str.find("<=") if ((startIndex is None)) else HxString.indexOfImpl(_hx_str,"<=",startIndex))) != -1): + _hx_type = "<=" + if (_hx_type != "="): + skip = (skip + len(_hx_type)) + property = HxOverrides.arrayGet(_hx_str.split(":"), 0) + value = None + if Reflect.field(q,(("null" if prefix is None else prefix) + ("null" if property is None else property))): + value = Reflect.field(q,(("null" if prefix is None else prefix) + ("null" if property is None else property))) + else: + value = _hx_AnonObject({}) + value1 = HxString.substr(HxOverrides.arrayGet(_hx_str.split(":"), 1),skip,None) + setattr(value,(("_hx_" + _hx_type) if ((_hx_type in python_Boot.keywords)) else (("_hx_" + _hx_type) if (((((len(_hx_type) > 2) and ((ord(_hx_type[0]) == 95))) and ((ord(_hx_type[1]) == 95))) and ((ord(_hx_type[(len(_hx_type) - 1)]) != 95)))) else _hx_type)),value1) + key = (("null" if prefix is None else prefix) + ("null" if property is None else property)) + setattr(q,(("_hx_" + key) if ((key in python_Boot.keywords)) else (("_hx_" + key) if (((((len(key) > 2) and ((ord(key[0]) == 95))) and ((ord(key[1]) == 95))) and ((ord(key[(len(key) - 1)]) != 95)))) else key)),value) + return + isName.matchObj = python_lib_Re.search(isName.pattern,_hx_str) + if (isName.matchObj is not None): + if (prefix == "-"): + Reflect.field(Reflect.field(q,"-object"),"push")(_hx_str) + while (Reflect.field(Reflect.field(q,"object"),"contains")(_hx_str) == True): + Reflect.field(Reflect.field(q,"object"),"remove")(_hx_str) + else: + Reflect.field(Reflect.field(q,"object"),"push")(_hx_str) + while (Reflect.field(Reflect.field(q,"-object"),"contains")(_hx_str) == True): + Reflect.field(Reflect.field(q,"-object"),"remove")(_hx_str) + return + match = _hx_local_2 + _g = 0 + _g1 = len(token) + while (_g < _g1): + i = _g + _g = (_g + 1) + isOr.matchObj = python_lib_Re.search(isOr.pattern,(token[i] if i >= 0 and i < len(token) else None)) + if (isOr.matchObj is not None): + composeQuery() + else: + match((token[i] if i >= 0 and i < len(token) else None)) + _g = 0 + _g1 = len(ors) + while (_g < _g1): + i = _g + _g = (_g + 1) + _hx_or = (ors[i] if i >= 0 and i < len(ors) else None) + if (Reflect.field(_hx_or,"object") is not None): + self.include = (self.include + Reflect.field(_hx_or,"object")) + if (Reflect.field(_hx_or,"-object") is not None): + self.exclude = (self.exclude + Reflect.field(_hx_or,"-object")) + self.q = _hx_AnonObject({'_hx_or': ors, 'copy_all': copyAll}) + return self.q + + def test(self,property,value = None): + if (self.preset == property): + self.parse(value,True) + _g = 0 + _g1 = Reflect.field(Reflect.field(self.q,"or"),"length") + while (_g < _g1): + i = _g + _g = (_g + 1) + _hx_or = HxOverrides.arrayGet(Reflect.field(self.q,"or"), i) + conds = [0] + fails = [0] + _hx_pass = 0 + def _hx_local_7(fails,conds): + def _hx_local_0(expr): + _hx_local_1 = conds + _hx_local_2 = 0 + _hx_local_3 = (_hx_local_1[_hx_local_2] if _hx_local_2 >= 0 and _hx_local_2 < len(_hx_local_1) else None) + python_internal_ArrayImpl._set(_hx_local_1, _hx_local_2, (_hx_local_3 + 1)) + (_hx_local_1[_hx_local_2] if _hx_local_2 >= 0 and _hx_local_2 < len(_hx_local_1) else None) + _hx_local_4 = fails + _hx_local_5 = 0 + _hx_local_6 = (_hx_local_4[_hx_local_5] if _hx_local_5 >= 0 and _hx_local_5 < len(_hx_local_4) else None) + python_internal_ArrayImpl._set(_hx_local_4, _hx_local_5, (_hx_local_6 + (0 if expr else 1))) + (_hx_local_4[_hx_local_5] if _hx_local_5 >= 0 and _hx_local_5 < len(_hx_local_4) else None) + return expr + return _hx_local_0 + when = _hx_local_7(fails,conds) + _g2 = 0 + _g3 = python_Boot.fields(_hx_or) + while (_g2 < len(_g3)): + k = (_g3[_g2] if _g2 >= 0 and _g2 < len(_g3) else None) + _g2 = (_g2 + 1) + orval = Reflect.field(_hx_or,k) + if (k != property): + continue + if ((Reflect.field(orval,"=") is not None) and when(HxOverrides.eq(value,Reflect.field(orval,"=")))): + _hx_pass = (_hx_pass + 1) + if ((Reflect.field(orval,"*") is not None) and when((value is not None))): + _hx_pass = (_hx_pass + 1) + if ((Reflect.field(orval,">") is not None) and when((value > Std.parseInt(Reflect.field(orval,">"))))): + _hx_pass = (_hx_pass + 1) + if ((Reflect.field(orval,"<") is not None) and when((value < Std.parseInt(Reflect.field(orval,"<"))))): + _hx_pass = (_hx_pass + 1) + if ((Reflect.field(orval,">=") is not None) and when((value >= Std.parseInt(Reflect.field(orval,">="))))): + _hx_pass = (_hx_pass + 1) + if ((Reflect.field(orval,"<=") is not None) and when((value >= Std.parseInt(Reflect.field(orval,"<="))))): + _hx_pass = (_hx_pass + 1) + if ((Reflect.field(orval,"!=") is not None) and when((value != Std.parseInt(Reflect.field(orval,"!="))))): + _hx_pass = (_hx_pass + 1) + if ((self.accept and (((conds[0] if 0 < len(conds) else None) > 0))) and (((fails[0] if 0 < len(fails) else None) > 0))): + self.accept = False + if ((((conds[0] if 0 < len(conds) else None) > 0) and ((_hx_pass > 0))) and (((fails[0] if 0 < len(fails) else None) == 0))): + self.accept = True + + @staticmethod + def _hx_empty_init(_hx_o): + _hx_o.str = None + _hx_o.q = None + _hx_o.include = None + _hx_o.exclude = None + _hx_o.accept = None + _hx_o.preset = None + +Math.NEGATIVE_INFINITY = float("-inf") +Math.POSITIVE_INFINITY = float("inf") +Math.NaN = float("nan") +Math.PI = python_lib_Math.pi + +haxe_SysTools.winMetaCharacters = [32, 40, 41, 37, 33, 94, 34, 60, 62, 38, 124, 10, 13, 44, 59] +StringTools.winMetaCharacters = haxe_SysTools.winMetaCharacters +Sys._programPath = sys_FileSystem.fullPath(python_lib_Inspect.getsourcefile(Sys)) +def _hx_init_haxe_io_FPHelper_i64tmp(): + def _hx_local_0(): + this1 = haxe__Int64____Int64(0,0) + return this1 + return _hx_local_0() +haxe_io_FPHelper.i64tmp = _hx_init_haxe_io_FPHelper_i64tmp() +haxe_io_FPHelper.LN2 = 0.6931471805599453 +python_Boot.keywords = set(["and", "del", "from", "not", "with", "as", "elif", "global", "or", "yield", "assert", "else", "if", "pass", "None", "break", "except", "import", "raise", "True", "class", "exec", "in", "return", "False", "continue", "finally", "is", "try", "def", "for", "lambda", "while"]) +python_Boot.prefixLength = len("_hx_") +python_Lib.lineEnd = ("\r\n" if ((Sys.systemName() == "Windows")) else "\n") + +Test.main() diff --git a/test/test.js b/test/test.js new file mode 100644 index 0000000..54e5ab2 --- /dev/null +++ b/test/test.js @@ -0,0 +1,28 @@ + +// in the browser use this instead of require(): +// +// +// + +var hgltf = require('../Query').hgltf +var q = new hgltf.Query() + + +var res = q.parse("") +if( !res.copy_all ) throw 'empty string should always set copy_all to true' + +console.log( q.parse("") ) +console.log( JSON.stringify(q.parse("foo:*"), null, 2) ) +return +console.log( q.parse("-skybox -plane") ) +console.log( q.parse("foo or bar") ); +console.log( q.parse("class:fopoer or bar foo:bar").or[0] ); +console.log( q.parse("-skybox class:foo").or[0] ); +console.log( q.parse("foo/flop moo or bar").or[0] ); +console.log( q.parse("-foo/flop moo or bar").or[0] ); +console.log( q.parse("price:>4 moo or bar").or[0] ); +console.log( q.parse("price:>=4 moo or bar").or[0] ); +console.log( q.parse("price:<=4 moo or bar").or[0] ); +console.log( q.parse("price:!=4 moo or bar").or[0] ); diff --git a/test/test.lua b/test/test.lua new file mode 100644 index 0000000..193c0bc --- /dev/null +++ b/test/test.lua @@ -0,0 +1 @@ +require "../Query" diff --git a/test/test.py b/test/test.py new file mode 100644 index 0000000..9874790 --- /dev/null +++ b/test/test.py @@ -0,0 +1,14 @@ +from Query import hgltf_Query + +q = hgltf_Query() + +print( q.parse("foo or bar") ) +print( q.parse("foo or bar") ) +print( q.parse("class:fopoer or bar foo:bar") ) +print( q.parse("-skybox class:foo") ) +print( q.parse("foo/flop moo or bar") ) +print( q.parse("-foo/flop moo or bar") ) +print( q.parse("price:>4 moo or bar") ) +print( q.parse("price:>=4 moo or bar") ) +print( q.parse("price:<=4 moo or bar") ) +print( q.parse("price:!=4 moo or bar") )