// Generated by Haxe 4.3.7 (function ($global) { "use strict"; var $estr = function() { return js_Boot.__string_rec(this,''); },$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 ClientGroup = $hxEnums["ClientGroup"] = { __ename__:true,__constructs__:null ,Banned: {_hx_name:"Banned",_hx_index:0,__enum__:"ClientGroup",toString:$estr} ,User: {_hx_name:"User",_hx_index:1,__enum__:"ClientGroup",toString:$estr} ,Leader: {_hx_name:"Leader",_hx_index:2,__enum__:"ClientGroup",toString:$estr} ,Admin: {_hx_name:"Admin",_hx_index:3,__enum__:"ClientGroup",toString:$estr} }; ClientGroup.__constructs__ = [ClientGroup.Banned,ClientGroup.User,ClientGroup.Leader,ClientGroup.Admin]; var Client = function(ws,req,id,name,group) { this.isAlive = true; this.ws = ws; this.req = req; this.id = id; this.name = name; var i = group; if(group == null) { i = 0; } this.group = i; }; Client.__name__ = true; Client.prototype = { hasPermission: function(permission,permissions) { if((this.group & 1) != 0) { return permissions.banned.indexOf(permission) != -1; } if((this.group & 8) != 0) { return permissions.admin.indexOf(permission) != -1; } if((this.group & 4) != 0) { return permissions.leader.indexOf(permission) != -1; } if((this.group & 2) != 0) { return permissions.user.indexOf(permission) != -1; } return permissions.guest.indexOf(permission) != -1; } ,setGroupFlag: function(type,flag) { if(flag) { this.group |= 1 << type._hx_index; } else { this.group &= -1 - (1 << type._hx_index); } return flag; } ,getData: function() { return { name : this.name, group : this.group}; } ,__class__: Client }; var ClientTools = function() { }; ClientTools.__name__ = true; ClientTools.setLeader = function(clients,name) { var _g = 0; while(_g < clients.length) { var client = clients[_g]; ++_g; if(client.name == name) { client.setGroupFlag(ClientGroup.Leader,true); } else if((client.group & 4) != 0) { client.setGroupFlag(ClientGroup.Leader,false); } } }; ClientTools.hasLeader = function(clients) { var _g = 0; while(_g < clients.length) if((clients[_g++].group & 4) != 0) { return true; } return false; }; ClientTools.getByName = function(clients,name,def) { var _g = 0; while(_g < clients.length) { var client = clients[_g]; ++_g; if(client.name == name) { return client; } } return def; }; var DateTools = function() { }; DateTools.__name__ = true; DateTools.__format_get = function(d,e) { switch(e) { case "%": return "%"; case "A": return DateTools.DAY_NAMES[d.getDay()]; case "B": return DateTools.MONTH_NAMES[d.getMonth()]; case "C": return StringTools.lpad(Std.string(d.getFullYear() / 100 | 0),"0",2); case "D": return DateTools.__format(d,"%m/%d/%y"); case "F": return DateTools.__format(d,"%Y-%m-%d"); case "M": return StringTools.lpad(Std.string(d.getMinutes()),"0",2); case "R": return DateTools.__format(d,"%H:%M"); case "S": return StringTools.lpad(Std.string(d.getSeconds()),"0",2); case "T": return DateTools.__format(d,"%H:%M:%S"); case "Y": return Std.string(d.getFullYear()); case "a": return DateTools.DAY_SHORT_NAMES[d.getDay()]; case "d": return StringTools.lpad(Std.string(d.getDate()),"0",2); case "e": return Std.string(d.getDate()); case "b":case "h": return DateTools.MONTH_SHORT_NAMES[d.getMonth()]; case "H":case "k": return StringTools.lpad(Std.string(d.getHours()),e == "H" ? "0" : " ",2); case "I":case "l": var hour = d.getHours() % 12; return StringTools.lpad(Std.string(hour == 0 ? 12 : hour),e == "I" ? "0" : " ",2); case "m": return StringTools.lpad(Std.string(d.getMonth() + 1),"0",2); case "n": return "\n"; case "p": if(d.getHours() > 11) { return "PM"; } else { return "AM"; } break; case "r": return DateTools.__format(d,"%I:%M:%S %p"); case "s": return Std.string(d.getTime() / 1000 | 0); case "t": return "\t"; case "u": var t = d.getDay(); if(t == 0) { return "7"; } else if(t == null) { return "null"; } else { return "" + t; } break; case "w": return Std.string(d.getDay()); case "y": return StringTools.lpad(Std.string(d.getFullYear() % 100),"0",2); default: throw new haxe_exceptions_NotImplementedException("Date.format %" + e + "- not implemented yet.",null,{ fileName : "DateTools.hx", lineNumber : 101, className : "DateTools", methodName : "__format_get"}); } }; DateTools.__format = function(d,f) { var r_b = ""; var p = 0; while(true) { var np = f.indexOf("%",p); if(np < 0) { break; } var len = np - p; r_b += len == null ? HxOverrides.substr(f,p,null) : HxOverrides.substr(f,p,len); r_b += Std.string(DateTools.__format_get(d,HxOverrides.substr(f,np + 1,1))); p = np + 2; } var len = f.length - p; r_b += len == null ? HxOverrides.substr(f,p,null) : HxOverrides.substr(f,p,len); return r_b; }; DateTools.format = function(d,f) { return DateTools.__format(d,f); }; var EReg = function(r,opt) { this.r = new RegExp(r,opt.split("u").join("")); }; EReg.__name__ = true; EReg.prototype = { 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"); } } ,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) { return s.replace(this.r,"#__delim__#").split("#__delim__#"); } ,map: function(s,f) { var offset = 0; var buf_b = ""; do { 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; } } while(this.r.global); if(!this.r.global && offset > 0 && offset < s.length) { buf_b += Std.string(HxOverrides.substr(s,offset,null)); } return buf_b; } ,__class__: EReg }; var HxOverrides = function() { }; HxOverrides.__name__ = true; 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.remove = function(a,obj) { var i = a.indexOf(obj); if(i == -1) { return false; } a.splice(i,1); return true; }; HxOverrides.now = function() { return Date.now(); }; var json2object_reader_BaseParser = function(errors,putils,errorType) { this.errors = errors; this.putils = putils; this.errorType = errorType; }; json2object_reader_BaseParser.__name__ = true; json2object_reader_BaseParser.prototype = { fromJson: function(jsonString,filename) { if(filename == null) { filename = ""; } this.putils = new json2object_PositionUtils(jsonString); this.errors = []; try { this.loadJson(new hxjsonast_Parser(jsonString,filename).doParse()); } catch( _g ) { var _g1 = haxe_Exception.caught(_g).unwrap(); if(((_g1) instanceof hxjsonast_Error)) { var e = _g1; this.errors.push(json2object_Error.ParserError(e.message,this.putils.convertPosition(e.pos))); } else { throw _g; } } return this.value; } ,loadJson: function(json,variable) { if(variable == null) { variable = ""; } var pos = this.putils.convertPosition(json.pos); var _g = json.value; switch(_g._hx_index) { case 0: this.loadJsonString(_g.s,pos,variable); break; case 1: this.loadJsonNumber(_g.s,pos,variable); break; case 2: this.loadJsonObject(_g.fields,pos,variable); break; case 3: this.loadJsonArray(_g.values,pos,variable); break; case 4: this.loadJsonBool(_g.b,pos,variable); break; case 5: this.loadJsonNull(pos,variable); break; } return this.value; } ,loadJsonNull: function(pos,variable) { this.onIncorrectType(pos,variable); } ,loadJsonString: function(s,pos,variable) { this.onIncorrectType(pos,variable); } ,loadString: function(s,pos,variable,validValues,defaultValue) { if(validValues.indexOf(s) != -1) { return s; } this.onIncorrectType(pos,variable); return defaultValue; } ,loadJsonNumber: function(f,pos,variable) { this.onIncorrectType(pos,variable); } ,loadJsonInt: function(f,pos,variable,value) { if(Std.parseInt(f) != null && Std.parseInt(f) == parseFloat(f)) { return Std.parseInt(f); } this.onIncorrectType(pos,variable); return value; } ,loadJsonFloat: function(f,pos,variable,value) { if(Std.parseInt(f) != null) { return parseFloat(f); } this.onIncorrectType(pos,variable); return value; } ,loadJsonBool: function(b,pos,variable) { this.onIncorrectType(pos,variable); } ,loadJsonArray: function(a,pos,variable) { this.onIncorrectType(pos,variable); } ,loadJsonArrayValue: function(a,loadJsonFn,variable) { var _g = []; var _g1 = 0; while(_g1 < a.length) { var j = a[_g1++]; var tmp; try { tmp = loadJsonFn(j,variable); } catch( _g2 ) { var _g3 = haxe_Exception.caught(_g2).unwrap(); if(js_Boot.__instanceof(_g3,json2object_InternalError)) { var e = _g3; if(e != json2object_InternalError.ParsingThrow) { throw haxe_Exception.thrown(e); } continue; } else { throw _g2; } } _g.push(tmp); } return _g; } ,loadJsonObject: function(o,pos,variable) { this.onIncorrectType(pos,variable); } ,loadObjectField: function(loadJsonFn,field,name,assigned,defaultValue,pos) { try { var ret = loadJsonFn(field.value,field.name); this.mapSet(assigned,name,true); return ret; } catch( _g ) { var _g1 = haxe_Exception.caught(_g).unwrap(); if(js_Boot.__instanceof(_g1,json2object_InternalError)) { var e = _g1; if(e != json2object_InternalError.ParsingThrow) { throw haxe_Exception.thrown(e); } } else { this.errors.push(json2object_Error.CustomFunctionException(_g1,pos)); } } return defaultValue; } ,loadObjectFieldReflect: function(loadJsonFn,field,name,assigned,pos) { try { this.value[name] = loadJsonFn(field.value,field.name); this.mapSet(assigned,name,true); } catch( _g ) { var _g1 = haxe_Exception.caught(_g).unwrap(); if(js_Boot.__instanceof(_g1,json2object_InternalError)) { var e = _g1; if(e != json2object_InternalError.ParsingThrow) { throw haxe_Exception.thrown(e); } } else { this.errors.push(json2object_Error.CustomFunctionException(_g1,pos)); } } } ,objectSetupAssign: function(assigned,keys,values) { var _g = 0; var _g1 = keys.length; while(_g < _g1) { var i = _g++; this.mapSet(assigned,keys[i],values[i]); } } ,objectErrors: function(assigned,pos) { var lastPos = this.putils.convertPosition(new hxjsonast_Position(pos.file,pos.max - 1,pos.max - 1)); var s_keys = Object.keys(assigned.h); var s_length = s_keys.length; var s_current = 0; while(s_current < s_length) { var s = s_keys[s_current++]; if(!assigned.h[s]) { this.errors.push(json2object_Error.UninitializedVariable(s,lastPos)); } } } ,onIncorrectType: function(pos,variable) { this.parsingThrow(); } ,parsingThrow: function() { if(this.errorType != 0) { throw haxe_Exception.thrown(json2object_InternalError.ParsingThrow); } } ,objectThrow: function(pos,variable) { if(this.errorType == 2) { throw haxe_Exception.thrown(json2object_InternalError.ParsingThrow); } if(this.errorType == 1) { this.errors.push(json2object_Error.UninitializedVariable(variable,pos)); } } ,mapSet: function(map,key,value) { map.h[key] = value; } ,__class__: json2object_reader_BaseParser }; var JsonParser_$043b7de5ce8f024a03541dbc6c2ccc11 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; JsonParser_$043b7de5ce8f024a03541dbc6c2ccc11.__name__ = true; JsonParser_$043b7de5ce8f024a03541dbc6c2ccc11.__super__ = json2object_reader_BaseParser; JsonParser_$043b7de5ce8f024a03541dbc6c2ccc11.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.errors.push(json2object_Error.IncorrectType(variable,"{ name : String, group : Int }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { this.value = null; } ,loadJsonObject: function(o,pos,variable) { var assigned = new haxe_ds_StringMap(); this.objectSetupAssign(assigned,["group","name"],[false,false]); this.value = this.getAuto(); var _g = 0; while(_g < o.length) { var field = o[_g]; ++_g; switch(field.name) { case "group": this.value.group = this.loadObjectField(($_=new JsonParser_$1686a6c336b71b36d77354cea19a8b52(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"group",assigned,this.value.group,pos); break; case "name": this.value.name = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"name",assigned,this.value.name,pos); break; default: this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); } } this.objectErrors(assigned,pos); } ,getAuto: function() { return { group : new JsonParser_$1686a6c336b71b36d77354cea19a8b52([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), name : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } ,__class__: JsonParser_$043b7de5ce8f024a03541dbc6c2ccc11 }); var JsonParser_$08065556836b0755d9c8e1550cf9f19c = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; JsonParser_$08065556836b0755d9c8e1550cf9f19c.__name__ = true; JsonParser_$08065556836b0755d9c8e1550cf9f19c.__super__ = json2object_reader_BaseParser; JsonParser_$08065556836b0755d9c8e1550cf9f19c.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.errors.push(json2object_Error.IncorrectType(variable,"Float",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { this.value = null; } ,loadJsonNumber: function(f,pos,variable) { this.value = this.loadJsonFloat(f,pos,variable,this.value); } ,__class__: JsonParser_$08065556836b0755d9c8e1550cf9f19c }); var JsonParser_$126814d365d277a375ef70de1963f53d = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; JsonParser_$126814d365d277a375ef70de1963f53d.__name__ = true; JsonParser_$126814d365d277a375ef70de1963f53d.__super__ = json2object_reader_BaseParser; JsonParser_$126814d365d277a375ef70de1963f53d.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.errors.push(json2object_Error.IncorrectType(variable,"{ clients : Array }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { this.value = null; } ,loadJsonObject: function(o,pos,variable) { var assigned = new haxe_ds_StringMap(); this.objectSetupAssign(assigned,["clients"],[false]); this.value = this.getAuto(); var _g = 0; while(_g < o.length) { var field = o[_g]; ++_g; if(field.name == "clients") { this.value.clients = this.loadObjectField(($_=new JsonParser_$b3a4781c98609b64e4a870171c45561f(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"clients",assigned,this.value.clients,pos); } else { this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); } } this.objectErrors(assigned,pos); } ,getAuto: function() { return { clients : new JsonParser_$b3a4781c98609b64e4a870171c45561f([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } ,__class__: JsonParser_$126814d365d277a375ef70de1963f53d }); var JsonParser_$128275a4734b926daca1924fc6a200c7 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; JsonParser_$128275a4734b926daca1924fc6a200c7.__name__ = true; JsonParser_$128275a4734b926daca1924fc6a200c7.__super__ = json2object_reader_BaseParser; JsonParser_$128275a4734b926daca1924fc6a200c7.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.errors.push(json2object_Error.IncorrectType(variable,"{ ?passHash : Null, ?isUnknownClient : Null, ?clients : Null>, clientName : String }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { this.value = null; } ,loadJsonObject: function(o,pos,variable) { var assigned = new haxe_ds_StringMap(); this.objectSetupAssign(assigned,["clientName","clients","isUnknownClient","passHash"],[false,true,true,true]); this.value = this.getAuto(); var _g = 0; while(_g < o.length) { var field = o[_g]; ++_g; switch(field.name) { case "clientName": this.value.clientName = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"clientName",assigned,this.value.clientName,pos); break; case "clients": this.value.clients = this.loadObjectField(($_=new JsonParser_$5a6d5e1c31f149294d2abd0cc01ec07d(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"clients",assigned,this.value.clients,pos); break; case "isUnknownClient": this.value.isUnknownClient = this.loadObjectField(($_=new JsonParser_$f55acea3678203c700715b781ad1ef0c(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"isUnknownClient",assigned,this.value.isUnknownClient,pos); break; case "passHash": this.value.passHash = this.loadObjectField(($_=new JsonParser_$ddce6d3de223cb2759be5c48797abca5(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"passHash",assigned,this.value.passHash,pos); break; default: this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); } } this.objectErrors(assigned,pos); } ,getAuto: function() { return { clientName : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), clients : new JsonParser_$5a6d5e1c31f149294d2abd0cc01ec07d([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), isUnknownClient : new JsonParser_$f55acea3678203c700715b781ad1ef0c([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), passHash : new JsonParser_$ddce6d3de223cb2759be5c48797abca5([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } ,__class__: JsonParser_$128275a4734b926daca1924fc6a200c7 }); var JsonParser_$1686a6c336b71b36d77354cea19a8b52 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); this.value = 0; }; JsonParser_$1686a6c336b71b36d77354cea19a8b52.__name__ = true; JsonParser_$1686a6c336b71b36d77354cea19a8b52.__super__ = json2object_reader_BaseParser; JsonParser_$1686a6c336b71b36d77354cea19a8b52.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.errors.push(json2object_Error.IncorrectType(variable,"Int",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNumber: function(f,pos,variable) { this.value = this.loadJsonInt(f,pos,variable,this.value); } ,__class__: JsonParser_$1686a6c336b71b36d77354cea19a8b52 }); var JsonParser_$17f62a9968afd16686d4888a98c34102 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; JsonParser_$17f62a9968afd16686d4888a98c34102.__name__ = true; JsonParser_$17f62a9968afd16686d4888a98c34102.__super__ = json2object_reader_BaseParser; JsonParser_$17f62a9968afd16686d4888a98c34102.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.errors.push(json2object_Error.IncorrectType(variable,"{ item : VideoItem, atEnd : Bool }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { this.value = null; } ,loadJsonObject: function(o,pos,variable) { var assigned = new haxe_ds_StringMap(); this.objectSetupAssign(assigned,["atEnd","item"],[false,false]); this.value = this.getAuto(); var _g = 0; while(_g < o.length) { var field = o[_g]; ++_g; switch(field.name) { case "atEnd": this.value.atEnd = this.loadObjectField(($_=new JsonParser_$c26f15e86e3de4c398a8273272aba034(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"atEnd",assigned,this.value.atEnd,pos); break; case "item": this.value.item = this.loadObjectField(($_=new JsonParser_$d89734267d6f665b411f49f013149267(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"item",assigned,this.value.item,pos); break; default: this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); } } this.objectErrors(assigned,pos); } ,getAuto: function() { return { atEnd : new JsonParser_$c26f15e86e3de4c398a8273272aba034([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), item : new JsonParser_$d89734267d6f665b411f49f013149267([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } ,__class__: JsonParser_$17f62a9968afd16686d4888a98c34102 }); var JsonParser_$22ae0e2b89e5e3d477f988cc36d3272b = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); this.value = 0; }; JsonParser_$22ae0e2b89e5e3d477f988cc36d3272b.__name__ = true; JsonParser_$22ae0e2b89e5e3d477f988cc36d3272b.__super__ = json2object_reader_BaseParser; JsonParser_$22ae0e2b89e5e3d477f988cc36d3272b.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.errors.push(json2object_Error.IncorrectType(variable,"Float",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNumber: function(f,pos,variable) { this.value = this.loadJsonFloat(f,pos,variable,this.value); } ,__class__: JsonParser_$22ae0e2b89e5e3d477f988cc36d3272b }); var JsonParser_$237c3c85cf00342dfb7f01e6a6157d10 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; JsonParser_$237c3c85cf00342dfb7f01e6a6157d10.__name__ = true; JsonParser_$237c3c85cf00342dfb7f01e6a6157d10.__super__ = json2object_reader_BaseParser; JsonParser_$237c3c85cf00342dfb7f01e6a6157d10.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.value = "RawType"; this.errors.push(json2object_Error.IncorrectType(variable,"PlayerType",pos)); this.objectThrow(pos,variable); } ,loadJsonNull: function(pos,variable) { this.value = null; } ,loadJsonString: function(s,pos,variable) { this.value = this.loadString(s,pos,variable,["RawType","YoutubeType","VkType","IframeType"],"RawType"); } ,__class__: JsonParser_$237c3c85cf00342dfb7f01e6a6157d10 }); var JsonParser_$269e3fee3d557ee1c48cb89bee0049dc = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; JsonParser_$269e3fee3d557ee1c48cb89bee0049dc.__name__ = true; JsonParser_$269e3fee3d557ee1c48cb89bee0049dc.__super__ = json2object_reader_BaseParser; JsonParser_$269e3fee3d557ee1c48cb89bee0049dc.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.errors.push(json2object_Error.IncorrectType(variable,"Array",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { this.value = null; } ,loadJsonArray: function(a,pos,variable) { this.value = this.loadJsonArrayValue(a,($_=new JsonParser_$237c3c85cf00342dfb7f01e6a6157d10(this.errors,this.putils,2),$bind($_,$_.loadJson)),variable); } ,__class__: JsonParser_$269e3fee3d557ee1c48cb89bee0049dc }); var JsonParser_$27118326006d3829667a400ad23d5d98 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; JsonParser_$27118326006d3829667a400ad23d5d98.__name__ = true; JsonParser_$27118326006d3829667a400ad23d5d98.__super__ = json2object_reader_BaseParser; JsonParser_$27118326006d3829667a400ad23d5d98.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.errors.push(json2object_Error.IncorrectType(variable,"String",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { this.value = null; } ,loadJsonString: function(s,pos,variable) { this.value = s; } ,__class__: JsonParser_$27118326006d3829667a400ad23d5d98 }); var JsonParser_$33c34d246ae14cf949ef186cb0e1d8eb = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; JsonParser_$33c34d246ae14cf949ef186cb0e1d8eb.__name__ = true; JsonParser_$33c34d246ae14cf949ef186cb0e1d8eb.__super__ = json2object_reader_BaseParser; JsonParser_$33c34d246ae14cf949ef186cb0e1d8eb.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.errors.push(json2object_Error.IncorrectType(variable,"{ text : String, clientName : String }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { this.value = null; } ,loadJsonObject: function(o,pos,variable) { var assigned = new haxe_ds_StringMap(); this.objectSetupAssign(assigned,["clientName","text"],[false,false]); this.value = this.getAuto(); var _g = 0; while(_g < o.length) { var field = o[_g]; ++_g; switch(field.name) { case "clientName": this.value.clientName = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"clientName",assigned,this.value.clientName,pos); break; case "text": this.value.text = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"text",assigned,this.value.text,pos); break; default: this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); } } this.objectErrors(assigned,pos); } ,getAuto: function() { return { clientName : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), text : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } ,__class__: JsonParser_$33c34d246ae14cf949ef186cb0e1d8eb }); var JsonParser_$359929cb56fda98b8740cbc66ef083c4 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; JsonParser_$359929cb56fda98b8740cbc66ef083c4.__name__ = true; JsonParser_$359929cb56fda98b8740cbc66ef083c4.__super__ = json2object_reader_BaseParser; JsonParser_$359929cb56fda98b8740cbc66ef083c4.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.errors.push(json2object_Error.IncorrectType(variable,"{ rate : Float }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { this.value = null; } ,loadJsonObject: function(o,pos,variable) { var assigned = new haxe_ds_StringMap(); this.objectSetupAssign(assigned,["rate"],[false]); this.value = this.getAuto(); var _g = 0; while(_g < o.length) { var field = o[_g]; ++_g; if(field.name == "rate") { this.value.rate = this.loadObjectField(($_=new JsonParser_$22ae0e2b89e5e3d477f988cc36d3272b(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"rate",assigned,this.value.rate,pos); } else { this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); } } this.objectErrors(assigned,pos); } ,getAuto: function() { return { rate : new JsonParser_$22ae0e2b89e5e3d477f988cc36d3272b([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } ,__class__: JsonParser_$359929cb56fda98b8740cbc66ef083c4 }); var JsonParser_$4152afa9599cfde83ddff5d84d1707c8 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; JsonParser_$4152afa9599cfde83ddff5d84d1707c8.__name__ = true; JsonParser_$4152afa9599cfde83ddff5d84d1707c8.__super__ = json2object_reader_BaseParser; JsonParser_$4152afa9599cfde83ddff5d84d1707c8.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.errors.push(json2object_Error.IncorrectType(variable,"Array",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { this.value = null; } ,loadJsonArray: function(a,pos,variable) { this.value = this.loadJsonArrayValue(a,($_=new JsonParser_$d7778d0c64b6ba21494c97f77a66885a(this.errors,this.putils,2),$bind($_,$_.loadJson)),variable); } ,__class__: JsonParser_$4152afa9599cfde83ddff5d84d1707c8 }); var JsonParser_$4b72cd217167f3afa7ba448cbebefe3a = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; JsonParser_$4b72cd217167f3afa7ba448cbebefe3a.__name__ = true; JsonParser_$4b72cd217167f3afa7ba448cbebefe3a.__super__ = json2object_reader_BaseParser; JsonParser_$4b72cd217167f3afa7ba448cbebefe3a.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.errors.push(json2object_Error.IncorrectType(variable,"{ name : String, image : String }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { this.value = null; } ,loadJsonObject: function(o,pos,variable) { var assigned = new haxe_ds_StringMap(); this.objectSetupAssign(assigned,["image","name"],[false,false]); this.value = this.getAuto(); var _g = 0; while(_g < o.length) { var field = o[_g]; ++_g; switch(field.name) { case "image": this.value.image = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"image",assigned,this.value.image,pos); break; case "name": this.value.name = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"name",assigned,this.value.name,pos); break; default: this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); } } this.objectErrors(assigned,pos); } ,getAuto: function() { return { image : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), name : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } ,__class__: JsonParser_$4b72cd217167f3afa7ba448cbebefe3a }); var JsonParser_$4c2a8fe7eaf24721cc7a9f0175115bd4 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; JsonParser_$4c2a8fe7eaf24721cc7a9f0175115bd4.__name__ = true; JsonParser_$4c2a8fe7eaf24721cc7a9f0175115bd4.__super__ = json2object_reader_BaseParser; JsonParser_$4c2a8fe7eaf24721cc7a9f0175115bd4.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.errors.push(json2object_Error.IncorrectType(variable,"{ time : String, text : String, name : String }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { this.value = null; } ,loadJsonObject: function(o,pos,variable) { var assigned = new haxe_ds_StringMap(); this.objectSetupAssign(assigned,["name","text","time"],[false,false,false]); this.value = this.getAuto(); var _g = 0; while(_g < o.length) { var field = o[_g]; ++_g; switch(field.name) { case "name": this.value.name = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"name",assigned,this.value.name,pos); break; case "text": this.value.text = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"text",assigned,this.value.text,pos); break; case "time": this.value.time = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"time",assigned,this.value.time,pos); break; default: this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); } } this.objectErrors(assigned,pos); } ,getAuto: function() { return { name : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), text : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), time : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } ,__class__: JsonParser_$4c2a8fe7eaf24721cc7a9f0175115bd4 }); var JsonParser_$5696efcdbd81f0be9220dc4cfb255706 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; JsonParser_$5696efcdbd81f0be9220dc4cfb255706.__name__ = true; JsonParser_$5696efcdbd81f0be9220dc4cfb255706.__super__ = json2object_reader_BaseParser; JsonParser_$5696efcdbd81f0be9220dc4cfb255706.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.errors.push(json2object_Error.IncorrectType(variable,"{ pos : Int }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { this.value = null; } ,loadJsonObject: function(o,pos,variable) { var assigned = new haxe_ds_StringMap(); this.objectSetupAssign(assigned,["pos"],[false]); this.value = this.getAuto(); var _g = 0; while(_g < o.length) { var field = o[_g]; ++_g; if(field.name == "pos") { this.value.pos = this.loadObjectField(($_=new JsonParser_$1686a6c336b71b36d77354cea19a8b52(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"pos",assigned,this.value.pos,pos); } else { this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); } } this.objectErrors(assigned,pos); } ,getAuto: function() { return { pos : new JsonParser_$1686a6c336b71b36d77354cea19a8b52([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } ,__class__: JsonParser_$5696efcdbd81f0be9220dc4cfb255706 }); var JsonParser_$5a6d5e1c31f149294d2abd0cc01ec07d = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; JsonParser_$5a6d5e1c31f149294d2abd0cc01ec07d.__name__ = true; JsonParser_$5a6d5e1c31f149294d2abd0cc01ec07d.__super__ = json2object_reader_BaseParser; JsonParser_$5a6d5e1c31f149294d2abd0cc01ec07d.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.errors.push(json2object_Error.IncorrectType(variable,"Array",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { this.value = null; } ,loadJsonArray: function(a,pos,variable) { this.value = this.loadJsonArrayValue(a,($_=new JsonParser_$043b7de5ce8f024a03541dbc6c2ccc11(this.errors,this.putils,2),$bind($_,$_.loadJson)),variable); } ,__class__: JsonParser_$5a6d5e1c31f149294d2abd0cc01ec07d }); var JsonParser_$5f812affc76e9ba3f21130cdbd3b05d9 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; JsonParser_$5f812affc76e9ba3f21130cdbd3b05d9.__name__ = true; JsonParser_$5f812affc76e9ba3f21130cdbd3b05d9.__super__ = json2object_reader_BaseParser; JsonParser_$5f812affc76e9ba3f21130cdbd3b05d9.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.errors.push(json2object_Error.IncorrectType(variable,"{ ?updatePlaylist : Null<{ videoList : Array }>, ?updateClients : Null<{ clients : Array }>, type : WsEventType, ?togglePlaylistLock : Null<{ isOpen : Bool }>, ?toggleItemType : Null<{ pos : Int }>, ?skipVideo : Null<{ url : String }>, ?setTime : Null<{ time : Float }>, ?setRate : Null<{ rate : Float }>, ?setNextItem : Null<{ pos : Int }>, ?setLeader : Null<{ clientName : String }>, ?serverMessage : Null<{ textId : String }>, ?rewind : Null<{ time : Float }>, ?removeVideo : Null<{ url : String }>, ?progress : Null<{ type : ProgressType, ratio : Float, ?data : Null }>, ?playItem : Null<{ pos : Int }>, ?play : Null<{ time : Float }>, ?pause : Null<{ time : Float }>, ?message : Null<{ text : String, clientName : String }>, ?logout : Null<{ oldClientName : String, clients : Array, clientName : String }>, ?login : Null<{ ?passHash : Null, ?isUnknownClient : Null, ?clients : Null>, clientName : String }>, ?kickClient : Null<{ name : String }>, ?getTime : Null, ?dump : Null<{ data : String }>, ?connected : Null<{ videoList : Array, uuid : String, playersCacheSupport : Array, itemPos : Int, isUnknownClient : Bool, isPlaylistOpen : Bool, history : Array, globalIp : String, config : Config, clients : Array, clientName : String }>, ?banClient : Null<{ time : Float, name : String }>, ?addVideo : Null<{ item : VideoItem, atEnd : Bool }> }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { this.value = null; } ,loadJsonObject: function(o,pos,variable) { var assigned = new haxe_ds_StringMap(); this.objectSetupAssign(assigned,["addVideo","banClient","connected","dump","getTime","kickClient","login","logout","message","pause","play","playItem","progress","removeVideo","rewind","serverMessage","setLeader","setNextItem","setRate","setTime","skipVideo","toggleItemType","togglePlaylistLock","type","updateClients","updatePlaylist"],[true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,false,true,true]); this.value = this.getAuto(); var _g = 0; while(_g < o.length) { var field = o[_g]; ++_g; switch(field.name) { case "addVideo": this.value.addVideo = this.loadObjectField(($_=new JsonParser_$17f62a9968afd16686d4888a98c34102(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"addVideo",assigned,this.value.addVideo,pos); break; case "banClient": this.value.banClient = this.loadObjectField(($_=new JsonParser_$cceff829ad5e63207b6f78bebb03c69a(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"banClient",assigned,this.value.banClient,pos); break; case "connected": this.value.connected = this.loadObjectField(($_=new JsonParser_$d011018d886fa55f8828ebb1e93413c3(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"connected",assigned,this.value.connected,pos); break; case "dump": this.value.dump = this.loadObjectField(($_=new JsonParser_$dda5f87e2972892b16c7b833df96706a(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"dump",assigned,this.value.dump,pos); break; case "getTime": this.value.getTime = this.loadObjectField(($_=new JsonParser_$feded5bdb427eb48f39e60029d5dca4a(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"getTime",assigned,this.value.getTime,pos); break; case "kickClient": this.value.kickClient = this.loadObjectField(($_=new JsonParser_$b2777fc36a3f1c43a2ae7d80ba0572ca(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"kickClient",assigned,this.value.kickClient,pos); break; case "login": this.value.login = this.loadObjectField(($_=new JsonParser_$128275a4734b926daca1924fc6a200c7(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"login",assigned,this.value.login,pos); break; case "logout": this.value.logout = this.loadObjectField(($_=new JsonParser_$8d3a3702ec359ae3022bce905b75550b(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"logout",assigned,this.value.logout,pos); break; case "message": this.value.message = this.loadObjectField(($_=new JsonParser_$33c34d246ae14cf949ef186cb0e1d8eb(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"message",assigned,this.value.message,pos); break; case "pause": this.value.pause = this.loadObjectField(($_=new JsonParser_$6340d11111c9ffddbd7ebb0d12d7c162(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"pause",assigned,this.value.pause,pos); break; case "play": this.value.play = this.loadObjectField(($_=new JsonParser_$6340d11111c9ffddbd7ebb0d12d7c162(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"play",assigned,this.value.play,pos); break; case "playItem": this.value.playItem = this.loadObjectField(($_=new JsonParser_$5696efcdbd81f0be9220dc4cfb255706(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"playItem",assigned,this.value.playItem,pos); break; case "progress": this.value.progress = this.loadObjectField(($_=new JsonParser_$e15c2211613da80aa2992b6249949a65(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"progress",assigned,this.value.progress,pos); break; case "removeVideo": this.value.removeVideo = this.loadObjectField(($_=new JsonParser_$bf1400338ef221d86126b3ec267cf395(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"removeVideo",assigned,this.value.removeVideo,pos); break; case "rewind": this.value.rewind = this.loadObjectField(($_=new JsonParser_$6340d11111c9ffddbd7ebb0d12d7c162(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"rewind",assigned,this.value.rewind,pos); break; case "serverMessage": this.value.serverMessage = this.loadObjectField(($_=new JsonParser_$d1c1e71f4452df068de6cecc104f6dd6(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"serverMessage",assigned,this.value.serverMessage,pos); break; case "setLeader": this.value.setLeader = this.loadObjectField(($_=new JsonParser_$65985176838b1da92d970132a0cb6d58(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"setLeader",assigned,this.value.setLeader,pos); break; case "setNextItem": this.value.setNextItem = this.loadObjectField(($_=new JsonParser_$5696efcdbd81f0be9220dc4cfb255706(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"setNextItem",assigned,this.value.setNextItem,pos); break; case "setRate": this.value.setRate = this.loadObjectField(($_=new JsonParser_$359929cb56fda98b8740cbc66ef083c4(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"setRate",assigned,this.value.setRate,pos); break; case "setTime": this.value.setTime = this.loadObjectField(($_=new JsonParser_$6340d11111c9ffddbd7ebb0d12d7c162(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"setTime",assigned,this.value.setTime,pos); break; case "skipVideo": this.value.skipVideo = this.loadObjectField(($_=new JsonParser_$bf1400338ef221d86126b3ec267cf395(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"skipVideo",assigned,this.value.skipVideo,pos); break; case "toggleItemType": this.value.toggleItemType = this.loadObjectField(($_=new JsonParser_$5696efcdbd81f0be9220dc4cfb255706(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"toggleItemType",assigned,this.value.toggleItemType,pos); break; case "togglePlaylistLock": this.value.togglePlaylistLock = this.loadObjectField(($_=new JsonParser_$e5a960b500232cc84a0caf718de13706(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"togglePlaylistLock",assigned,this.value.togglePlaylistLock,pos); break; case "type": this.value.type = this.loadObjectField(($_=new JsonParser_$d8e5213783812cec0906ca233f0379dc(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"type",assigned,this.value.type,pos); break; case "updateClients": this.value.updateClients = this.loadObjectField(($_=new JsonParser_$126814d365d277a375ef70de1963f53d(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"updateClients",assigned,this.value.updateClients,pos); break; case "updatePlaylist": this.value.updatePlaylist = this.loadObjectField(($_=new JsonParser_$a82c17fc41c21179c58e1d406d2b20cd(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"updatePlaylist",assigned,this.value.updatePlaylist,pos); break; default: this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); } } this.objectErrors(assigned,pos); } ,getAuto: function() { return { addVideo : new JsonParser_$17f62a9968afd16686d4888a98c34102([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), banClient : new JsonParser_$cceff829ad5e63207b6f78bebb03c69a([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), connected : new JsonParser_$d011018d886fa55f8828ebb1e93413c3([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), dump : new JsonParser_$dda5f87e2972892b16c7b833df96706a([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), getTime : new JsonParser_$feded5bdb427eb48f39e60029d5dca4a([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), kickClient : new JsonParser_$b2777fc36a3f1c43a2ae7d80ba0572ca([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), login : new JsonParser_$128275a4734b926daca1924fc6a200c7([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), logout : new JsonParser_$8d3a3702ec359ae3022bce905b75550b([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), message : new JsonParser_$33c34d246ae14cf949ef186cb0e1d8eb([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), pause : new JsonParser_$6340d11111c9ffddbd7ebb0d12d7c162([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), play : new JsonParser_$6340d11111c9ffddbd7ebb0d12d7c162([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), playItem : new JsonParser_$5696efcdbd81f0be9220dc4cfb255706([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), progress : new JsonParser_$e15c2211613da80aa2992b6249949a65([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), removeVideo : new JsonParser_$bf1400338ef221d86126b3ec267cf395([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), rewind : new JsonParser_$6340d11111c9ffddbd7ebb0d12d7c162([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), serverMessage : new JsonParser_$d1c1e71f4452df068de6cecc104f6dd6([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), setLeader : new JsonParser_$65985176838b1da92d970132a0cb6d58([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), setNextItem : new JsonParser_$5696efcdbd81f0be9220dc4cfb255706([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), setRate : new JsonParser_$359929cb56fda98b8740cbc66ef083c4([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), setTime : new JsonParser_$6340d11111c9ffddbd7ebb0d12d7c162([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), skipVideo : new JsonParser_$bf1400338ef221d86126b3ec267cf395([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), toggleItemType : new JsonParser_$5696efcdbd81f0be9220dc4cfb255706([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), togglePlaylistLock : new JsonParser_$e5a960b500232cc84a0caf718de13706([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), type : new JsonParser_$d8e5213783812cec0906ca233f0379dc([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), updateClients : new JsonParser_$126814d365d277a375ef70de1963f53d([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), updatePlaylist : new JsonParser_$a82c17fc41c21179c58e1d406d2b20cd([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } ,__class__: JsonParser_$5f812affc76e9ba3f21130cdbd3b05d9 }); var JsonParser_$6340d11111c9ffddbd7ebb0d12d7c162 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; JsonParser_$6340d11111c9ffddbd7ebb0d12d7c162.__name__ = true; JsonParser_$6340d11111c9ffddbd7ebb0d12d7c162.__super__ = json2object_reader_BaseParser; JsonParser_$6340d11111c9ffddbd7ebb0d12d7c162.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.errors.push(json2object_Error.IncorrectType(variable,"{ time : Float }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { this.value = null; } ,loadJsonObject: function(o,pos,variable) { var assigned = new haxe_ds_StringMap(); this.objectSetupAssign(assigned,["time"],[false]); this.value = this.getAuto(); var _g = 0; while(_g < o.length) { var field = o[_g]; ++_g; if(field.name == "time") { this.value.time = this.loadObjectField(($_=new JsonParser_$22ae0e2b89e5e3d477f988cc36d3272b(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"time",assigned,this.value.time,pos); } else { this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); } } this.objectErrors(assigned,pos); } ,getAuto: function() { return { time : new JsonParser_$22ae0e2b89e5e3d477f988cc36d3272b([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } ,__class__: JsonParser_$6340d11111c9ffddbd7ebb0d12d7c162 }); var JsonParser_$65985176838b1da92d970132a0cb6d58 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; JsonParser_$65985176838b1da92d970132a0cb6d58.__name__ = true; JsonParser_$65985176838b1da92d970132a0cb6d58.__super__ = json2object_reader_BaseParser; JsonParser_$65985176838b1da92d970132a0cb6d58.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.errors.push(json2object_Error.IncorrectType(variable,"{ clientName : String }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { this.value = null; } ,loadJsonObject: function(o,pos,variable) { var assigned = new haxe_ds_StringMap(); this.objectSetupAssign(assigned,["clientName"],[false]); this.value = this.getAuto(); var _g = 0; while(_g < o.length) { var field = o[_g]; ++_g; if(field.name == "clientName") { this.value.clientName = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"clientName",assigned,this.value.clientName,pos); } else { this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); } } this.objectErrors(assigned,pos); } ,getAuto: function() { return { clientName : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } ,__class__: JsonParser_$65985176838b1da92d970132a0cb6d58 }); var JsonParser_$65cb6553a71d34740bf81458b7243f94 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; JsonParser_$65cb6553a71d34740bf81458b7243f94.__name__ = true; JsonParser_$65cb6553a71d34740bf81458b7243f94.__super__ = json2object_reader_BaseParser; JsonParser_$65cb6553a71d34740bf81458b7243f94.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.errors.push(json2object_Error.IncorrectType(variable,"Array",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { this.value = null; } ,loadJsonArray: function(a,pos,variable) { this.value = this.loadJsonArrayValue(a,($_=new JsonParser_$ed5dea09095f671b801bee34ea28a319(this.errors,this.putils,2),$bind($_,$_.loadJson)),variable); } ,__class__: JsonParser_$65cb6553a71d34740bf81458b7243f94 }); var JsonParser_$8d3a3702ec359ae3022bce905b75550b = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; JsonParser_$8d3a3702ec359ae3022bce905b75550b.__name__ = true; JsonParser_$8d3a3702ec359ae3022bce905b75550b.__super__ = json2object_reader_BaseParser; JsonParser_$8d3a3702ec359ae3022bce905b75550b.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.errors.push(json2object_Error.IncorrectType(variable,"{ oldClientName : String, clients : Array, clientName : String }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { this.value = null; } ,loadJsonObject: function(o,pos,variable) { var assigned = new haxe_ds_StringMap(); this.objectSetupAssign(assigned,["clientName","clients","oldClientName"],[false,false,false]); this.value = this.getAuto(); var _g = 0; while(_g < o.length) { var field = o[_g]; ++_g; switch(field.name) { case "clientName": this.value.clientName = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"clientName",assigned,this.value.clientName,pos); break; case "clients": this.value.clients = this.loadObjectField(($_=new JsonParser_$b3a4781c98609b64e4a870171c45561f(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"clients",assigned,this.value.clients,pos); break; case "oldClientName": this.value.oldClientName = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"oldClientName",assigned,this.value.oldClientName,pos); break; default: this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); } } this.objectErrors(assigned,pos); } ,getAuto: function() { return { clientName : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), clients : new JsonParser_$b3a4781c98609b64e4a870171c45561f([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), oldClientName : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } ,__class__: JsonParser_$8d3a3702ec359ae3022bce905b75550b }); var JsonParser_$a82c17fc41c21179c58e1d406d2b20cd = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; JsonParser_$a82c17fc41c21179c58e1d406d2b20cd.__name__ = true; JsonParser_$a82c17fc41c21179c58e1d406d2b20cd.__super__ = json2object_reader_BaseParser; JsonParser_$a82c17fc41c21179c58e1d406d2b20cd.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.errors.push(json2object_Error.IncorrectType(variable,"{ videoList : Array }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { this.value = null; } ,loadJsonObject: function(o,pos,variable) { var assigned = new haxe_ds_StringMap(); this.objectSetupAssign(assigned,["videoList"],[false]); this.value = this.getAuto(); var _g = 0; while(_g < o.length) { var field = o[_g]; ++_g; if(field.name == "videoList") { this.value.videoList = this.loadObjectField(($_=new JsonParser_$acbf8fc6181cc1dcb443a91fcea5cf0c(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"videoList",assigned,this.value.videoList,pos); } else { this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); } } this.objectErrors(assigned,pos); } ,getAuto: function() { return { videoList : new JsonParser_$acbf8fc6181cc1dcb443a91fcea5cf0c([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } ,__class__: JsonParser_$a82c17fc41c21179c58e1d406d2b20cd }); var JsonParser_$acbf8fc6181cc1dcb443a91fcea5cf0c = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; JsonParser_$acbf8fc6181cc1dcb443a91fcea5cf0c.__name__ = true; JsonParser_$acbf8fc6181cc1dcb443a91fcea5cf0c.__super__ = json2object_reader_BaseParser; JsonParser_$acbf8fc6181cc1dcb443a91fcea5cf0c.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.errors.push(json2object_Error.IncorrectType(variable,"Array",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { this.value = null; } ,loadJsonArray: function(a,pos,variable) { this.value = this.loadJsonArrayValue(a,($_=new JsonParser_$d89734267d6f665b411f49f013149267(this.errors,this.putils,2),$bind($_,$_.loadJson)),variable); } ,__class__: JsonParser_$acbf8fc6181cc1dcb443a91fcea5cf0c }); var JsonParser_$b228e2c506a1d2b95c8332e07c38b0f2 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; JsonParser_$b228e2c506a1d2b95c8332e07c38b0f2.__name__ = true; JsonParser_$b228e2c506a1d2b95c8332e07c38b0f2.__super__ = json2object_reader_BaseParser; JsonParser_$b228e2c506a1d2b95c8332e07c38b0f2.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.errors.push(json2object_Error.IncorrectType(variable,"Array",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { this.value = null; } ,loadJsonArray: function(a,pos,variable) { this.value = this.loadJsonArrayValue(a,($_=new JsonParser_$4b72cd217167f3afa7ba448cbebefe3a(this.errors,this.putils,2),$bind($_,$_.loadJson)),variable); } ,__class__: JsonParser_$b228e2c506a1d2b95c8332e07c38b0f2 }); var JsonParser_$b2777fc36a3f1c43a2ae7d80ba0572ca = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; JsonParser_$b2777fc36a3f1c43a2ae7d80ba0572ca.__name__ = true; JsonParser_$b2777fc36a3f1c43a2ae7d80ba0572ca.__super__ = json2object_reader_BaseParser; JsonParser_$b2777fc36a3f1c43a2ae7d80ba0572ca.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.errors.push(json2object_Error.IncorrectType(variable,"{ name : String }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { this.value = null; } ,loadJsonObject: function(o,pos,variable) { var assigned = new haxe_ds_StringMap(); this.objectSetupAssign(assigned,["name"],[false]); this.value = this.getAuto(); var _g = 0; while(_g < o.length) { var field = o[_g]; ++_g; if(field.name == "name") { this.value.name = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"name",assigned,this.value.name,pos); } else { this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); } } this.objectErrors(assigned,pos); } ,getAuto: function() { return { name : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } ,__class__: JsonParser_$b2777fc36a3f1c43a2ae7d80ba0572ca }); var JsonParser_$b3a4781c98609b64e4a870171c45561f = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; JsonParser_$b3a4781c98609b64e4a870171c45561f.__name__ = true; JsonParser_$b3a4781c98609b64e4a870171c45561f.__super__ = json2object_reader_BaseParser; JsonParser_$b3a4781c98609b64e4a870171c45561f.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.errors.push(json2object_Error.IncorrectType(variable,"Array",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { this.value = null; } ,loadJsonArray: function(a,pos,variable) { this.value = this.loadJsonArrayValue(a,($_=new JsonParser_$043b7de5ce8f024a03541dbc6c2ccc11(this.errors,this.putils,2),$bind($_,$_.loadJson)),variable); } ,__class__: JsonParser_$b3a4781c98609b64e4a870171c45561f }); var JsonParser_$bf1400338ef221d86126b3ec267cf395 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; JsonParser_$bf1400338ef221d86126b3ec267cf395.__name__ = true; JsonParser_$bf1400338ef221d86126b3ec267cf395.__super__ = json2object_reader_BaseParser; JsonParser_$bf1400338ef221d86126b3ec267cf395.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.errors.push(json2object_Error.IncorrectType(variable,"{ url : String }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { this.value = null; } ,loadJsonObject: function(o,pos,variable) { var assigned = new haxe_ds_StringMap(); this.objectSetupAssign(assigned,["url"],[false]); this.value = this.getAuto(); var _g = 0; while(_g < o.length) { var field = o[_g]; ++_g; if(field.name == "url") { this.value.url = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"url",assigned,this.value.url,pos); } else { this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); } } this.objectErrors(assigned,pos); } ,getAuto: function() { return { url : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } ,__class__: JsonParser_$bf1400338ef221d86126b3ec267cf395 }); var JsonParser_$c26f15e86e3de4c398a8273272aba034 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); this.value = false; }; JsonParser_$c26f15e86e3de4c398a8273272aba034.__name__ = true; JsonParser_$c26f15e86e3de4c398a8273272aba034.__super__ = json2object_reader_BaseParser; JsonParser_$c26f15e86e3de4c398a8273272aba034.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.errors.push(json2object_Error.IncorrectType(variable,"Bool",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonBool: function(b,pos,variable) { this.value = b; } ,__class__: JsonParser_$c26f15e86e3de4c398a8273272aba034 }); var JsonParser_$cceff829ad5e63207b6f78bebb03c69a = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; JsonParser_$cceff829ad5e63207b6f78bebb03c69a.__name__ = true; JsonParser_$cceff829ad5e63207b6f78bebb03c69a.__super__ = json2object_reader_BaseParser; JsonParser_$cceff829ad5e63207b6f78bebb03c69a.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.errors.push(json2object_Error.IncorrectType(variable,"{ time : Float, name : String }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { this.value = null; } ,loadJsonObject: function(o,pos,variable) { var assigned = new haxe_ds_StringMap(); this.objectSetupAssign(assigned,["name","time"],[false,false]); this.value = this.getAuto(); var _g = 0; while(_g < o.length) { var field = o[_g]; ++_g; switch(field.name) { case "name": this.value.name = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"name",assigned,this.value.name,pos); break; case "time": this.value.time = this.loadObjectField(($_=new JsonParser_$22ae0e2b89e5e3d477f988cc36d3272b(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"time",assigned,this.value.time,pos); break; default: this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); } } this.objectErrors(assigned,pos); } ,getAuto: function() { return { name : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), time : new JsonParser_$22ae0e2b89e5e3d477f988cc36d3272b([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } ,__class__: JsonParser_$cceff829ad5e63207b6f78bebb03c69a }); var JsonParser_$d011018d886fa55f8828ebb1e93413c3 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; JsonParser_$d011018d886fa55f8828ebb1e93413c3.__name__ = true; JsonParser_$d011018d886fa55f8828ebb1e93413c3.__super__ = json2object_reader_BaseParser; JsonParser_$d011018d886fa55f8828ebb1e93413c3.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.errors.push(json2object_Error.IncorrectType(variable,"{ videoList : Array, uuid : String, playersCacheSupport : Array, itemPos : Int, isUnknownClient : Bool, isPlaylistOpen : Bool, history : Array, globalIp : String, config : Config, clients : Array, clientName : String }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { this.value = null; } ,loadJsonObject: function(o,pos,variable) { var assigned = new haxe_ds_StringMap(); this.objectSetupAssign(assigned,["clientName","clients","config","globalIp","history","isPlaylistOpen","isUnknownClient","itemPos","playersCacheSupport","uuid","videoList"],[false,false,false,false,false,false,false,false,false,false,false]); this.value = this.getAuto(); var _g = 0; while(_g < o.length) { var field = o[_g]; ++_g; switch(field.name) { case "clientName": this.value.clientName = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"clientName",assigned,this.value.clientName,pos); break; case "clients": this.value.clients = this.loadObjectField(($_=new JsonParser_$b3a4781c98609b64e4a870171c45561f(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"clients",assigned,this.value.clients,pos); break; case "config": this.value.config = this.loadObjectField(($_=new JsonParser_$fa535ffb25e1fd20341652f9be21e06e(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"config",assigned,this.value.config,pos); break; case "globalIp": this.value.globalIp = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"globalIp",assigned,this.value.globalIp,pos); break; case "history": this.value.history = this.loadObjectField(($_=new JsonParser_$d853ed77ba06d4925d9511d45b7002f6(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"history",assigned,this.value.history,pos); break; case "isPlaylistOpen": this.value.isPlaylistOpen = this.loadObjectField(($_=new JsonParser_$c26f15e86e3de4c398a8273272aba034(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"isPlaylistOpen",assigned,this.value.isPlaylistOpen,pos); break; case "isUnknownClient": this.value.isUnknownClient = this.loadObjectField(($_=new JsonParser_$c26f15e86e3de4c398a8273272aba034(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"isUnknownClient",assigned,this.value.isUnknownClient,pos); break; case "itemPos": this.value.itemPos = this.loadObjectField(($_=new JsonParser_$1686a6c336b71b36d77354cea19a8b52(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"itemPos",assigned,this.value.itemPos,pos); break; case "playersCacheSupport": this.value.playersCacheSupport = this.loadObjectField(($_=new JsonParser_$269e3fee3d557ee1c48cb89bee0049dc(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"playersCacheSupport",assigned,this.value.playersCacheSupport,pos); break; case "uuid": this.value.uuid = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"uuid",assigned,this.value.uuid,pos); break; case "videoList": this.value.videoList = this.loadObjectField(($_=new JsonParser_$acbf8fc6181cc1dcb443a91fcea5cf0c(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"videoList",assigned,this.value.videoList,pos); break; default: this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); } } this.objectErrors(assigned,pos); } ,getAuto: function() { return { clientName : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), clients : new JsonParser_$b3a4781c98609b64e4a870171c45561f([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), config : new JsonParser_$fa535ffb25e1fd20341652f9be21e06e([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), globalIp : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), history : new JsonParser_$d853ed77ba06d4925d9511d45b7002f6([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), isPlaylistOpen : new JsonParser_$c26f15e86e3de4c398a8273272aba034([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), isUnknownClient : new JsonParser_$c26f15e86e3de4c398a8273272aba034([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), itemPos : new JsonParser_$1686a6c336b71b36d77354cea19a8b52([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), playersCacheSupport : new JsonParser_$269e3fee3d557ee1c48cb89bee0049dc([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), uuid : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), videoList : new JsonParser_$acbf8fc6181cc1dcb443a91fcea5cf0c([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } ,__class__: JsonParser_$d011018d886fa55f8828ebb1e93413c3 }); var JsonParser_$d08ccf52b4cdd08e41cfb99ec42e0b29 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; JsonParser_$d08ccf52b4cdd08e41cfb99ec42e0b29.__name__ = true; JsonParser_$d08ccf52b4cdd08e41cfb99ec42e0b29.__super__ = json2object_reader_BaseParser; JsonParser_$d08ccf52b4cdd08e41cfb99ec42e0b29.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.errors.push(json2object_Error.IncorrectType(variable,"{ user : Array, leader : Array, guest : Array, banned : Array, admin : Array }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { this.value = null; } ,loadJsonObject: function(o,pos,variable) { var assigned = new haxe_ds_StringMap(); this.objectSetupAssign(assigned,["admin","banned","guest","leader","user"],[false,false,false,false,false]); this.value = this.getAuto(); var _g = 0; while(_g < o.length) { var field = o[_g]; ++_g; switch(field.name) { case "admin": this.value.admin = this.loadObjectField(($_=new JsonParser_$65cb6553a71d34740bf81458b7243f94(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"admin",assigned,this.value.admin,pos); break; case "banned": this.value.banned = this.loadObjectField(($_=new JsonParser_$65cb6553a71d34740bf81458b7243f94(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"banned",assigned,this.value.banned,pos); break; case "guest": this.value.guest = this.loadObjectField(($_=new JsonParser_$65cb6553a71d34740bf81458b7243f94(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"guest",assigned,this.value.guest,pos); break; case "leader": this.value.leader = this.loadObjectField(($_=new JsonParser_$65cb6553a71d34740bf81458b7243f94(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"leader",assigned,this.value.leader,pos); break; case "user": this.value.user = this.loadObjectField(($_=new JsonParser_$65cb6553a71d34740bf81458b7243f94(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"user",assigned,this.value.user,pos); break; default: this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); } } this.objectErrors(assigned,pos); } ,getAuto: function() { return { admin : new JsonParser_$65cb6553a71d34740bf81458b7243f94([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), banned : new JsonParser_$65cb6553a71d34740bf81458b7243f94([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), guest : new JsonParser_$65cb6553a71d34740bf81458b7243f94([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), leader : new JsonParser_$65cb6553a71d34740bf81458b7243f94([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), user : new JsonParser_$65cb6553a71d34740bf81458b7243f94([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } ,__class__: JsonParser_$d08ccf52b4cdd08e41cfb99ec42e0b29 }); var JsonParser_$d1c1e71f4452df068de6cecc104f6dd6 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; JsonParser_$d1c1e71f4452df068de6cecc104f6dd6.__name__ = true; JsonParser_$d1c1e71f4452df068de6cecc104f6dd6.__super__ = json2object_reader_BaseParser; JsonParser_$d1c1e71f4452df068de6cecc104f6dd6.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.errors.push(json2object_Error.IncorrectType(variable,"{ textId : String }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { this.value = null; } ,loadJsonObject: function(o,pos,variable) { var assigned = new haxe_ds_StringMap(); this.objectSetupAssign(assigned,["textId"],[false]); this.value = this.getAuto(); var _g = 0; while(_g < o.length) { var field = o[_g]; ++_g; if(field.name == "textId") { this.value.textId = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"textId",assigned,this.value.textId,pos); } else { this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); } } this.objectErrors(assigned,pos); } ,getAuto: function() { return { textId : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } ,__class__: JsonParser_$d1c1e71f4452df068de6cecc104f6dd6 }); var JsonParser_$d7778d0c64b6ba21494c97f77a66885a = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; JsonParser_$d7778d0c64b6ba21494c97f77a66885a.__name__ = true; JsonParser_$d7778d0c64b6ba21494c97f77a66885a.__super__ = json2object_reader_BaseParser; JsonParser_$d7778d0c64b6ba21494c97f77a66885a.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.errors.push(json2object_Error.IncorrectType(variable,"{ replace : String, regex : String, name : String, flags : String }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { this.value = null; } ,loadJsonObject: function(o,pos,variable) { var assigned = new haxe_ds_StringMap(); this.objectSetupAssign(assigned,["flags","name","regex","replace"],[false,false,false,false]); this.value = this.getAuto(); var _g = 0; while(_g < o.length) { var field = o[_g]; ++_g; switch(field.name) { case "flags": this.value.flags = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"flags",assigned,this.value.flags,pos); break; case "name": this.value.name = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"name",assigned,this.value.name,pos); break; case "regex": this.value.regex = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"regex",assigned,this.value.regex,pos); break; case "replace": this.value.replace = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"replace",assigned,this.value.replace,pos); break; default: this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); } } this.objectErrors(assigned,pos); } ,getAuto: function() { return { flags : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), name : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), regex : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), replace : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } ,__class__: JsonParser_$d7778d0c64b6ba21494c97f77a66885a }); var JsonParser_$d853ed77ba06d4925d9511d45b7002f6 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; JsonParser_$d853ed77ba06d4925d9511d45b7002f6.__name__ = true; JsonParser_$d853ed77ba06d4925d9511d45b7002f6.__super__ = json2object_reader_BaseParser; JsonParser_$d853ed77ba06d4925d9511d45b7002f6.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.errors.push(json2object_Error.IncorrectType(variable,"Array",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { this.value = null; } ,loadJsonArray: function(a,pos,variable) { this.value = this.loadJsonArrayValue(a,($_=new JsonParser_$4c2a8fe7eaf24721cc7a9f0175115bd4(this.errors,this.putils,2),$bind($_,$_.loadJson)),variable); } ,__class__: JsonParser_$d853ed77ba06d4925d9511d45b7002f6 }); var JsonParser_$d89734267d6f665b411f49f013149267 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; JsonParser_$d89734267d6f665b411f49f013149267.__name__ = true; JsonParser_$d89734267d6f665b411f49f013149267.__super__ = json2object_reader_BaseParser; JsonParser_$d89734267d6f665b411f49f013149267.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.errors.push(json2object_Error.IncorrectType(variable,"{ ?voiceOverTrack : Null, url : String, title : String, ?subs : Null, playerType : PlayerType, isTemp : Bool, duration : Float, doCache : Bool, author : String }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { this.value = null; } ,loadJsonObject: function(o,pos,variable) { var assigned = new haxe_ds_StringMap(); this.objectSetupAssign(assigned,["author","doCache","duration","isTemp","playerType","subs","title","url","voiceOverTrack"],[false,false,false,false,false,true,false,false,true]); this.value = this.getAuto(); var _g = 0; while(_g < o.length) { var field = o[_g]; ++_g; switch(field.name) { case "author": this.value.author = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"author",assigned,this.value.author,pos); break; case "doCache": this.value.doCache = this.loadObjectField(($_=new JsonParser_$c26f15e86e3de4c398a8273272aba034(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"doCache",assigned,this.value.doCache,pos); break; case "duration": this.value.duration = this.loadObjectField(($_=new JsonParser_$22ae0e2b89e5e3d477f988cc36d3272b(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"duration",assigned,this.value.duration,pos); break; case "isTemp": this.value.isTemp = this.loadObjectField(($_=new JsonParser_$c26f15e86e3de4c398a8273272aba034(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"isTemp",assigned,this.value.isTemp,pos); break; case "playerType": this.value.playerType = this.loadObjectField(($_=new JsonParser_$237c3c85cf00342dfb7f01e6a6157d10(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"playerType",assigned,this.value.playerType,pos); break; case "subs": this.value.subs = this.loadObjectField(($_=new JsonParser_$ddce6d3de223cb2759be5c48797abca5(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"subs",assigned,this.value.subs,pos); break; case "title": this.value.title = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"title",assigned,this.value.title,pos); break; case "url": this.loadObjectFieldReflect(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"url",assigned,pos); break; case "voiceOverTrack": this.value.voiceOverTrack = this.loadObjectField(($_=new JsonParser_$ddce6d3de223cb2759be5c48797abca5(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"voiceOverTrack",assigned,this.value.voiceOverTrack,pos); break; default: this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); } } this.objectErrors(assigned,pos); } ,getAuto: function() { return { author : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), doCache : new JsonParser_$c26f15e86e3de4c398a8273272aba034([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), duration : new JsonParser_$22ae0e2b89e5e3d477f988cc36d3272b([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), isTemp : new JsonParser_$c26f15e86e3de4c398a8273272aba034([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), playerType : new JsonParser_$237c3c85cf00342dfb7f01e6a6157d10([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), subs : new JsonParser_$ddce6d3de223cb2759be5c48797abca5([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), title : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), url : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), voiceOverTrack : new JsonParser_$ddce6d3de223cb2759be5c48797abca5([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } ,__class__: JsonParser_$d89734267d6f665b411f49f013149267 }); var JsonParser_$d8e5213783812cec0906ca233f0379dc = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; JsonParser_$d8e5213783812cec0906ca233f0379dc.__name__ = true; JsonParser_$d8e5213783812cec0906ca233f0379dc.__super__ = json2object_reader_BaseParser; JsonParser_$d8e5213783812cec0906ca233f0379dc.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.value = "Connected"; this.errors.push(json2object_Error.IncorrectType(variable,"WsEventType",pos)); this.objectThrow(pos,variable); } ,loadJsonNull: function(pos,variable) { this.value = null; } ,loadJsonString: function(s,pos,variable) { this.value = this.loadString(s,pos,variable,["Connected","Disconnected","Login","PasswordRequest","LoginError","Logout","Message","ServerMessage","Progress","UpdateClients","BanClient","KickClient","AddVideo","RemoveVideo","SkipVideo","VideoLoaded","Pause","Play","GetTime","SetTime","SetRate","Rewind","Flashback","SetLeader","PlayItem","SetNextItem","ToggleItemType","ClearChat","ClearPlaylist","ShufflePlaylist","UpdatePlaylist","TogglePlaylistLock","Dump","CrashTest"],"Connected"); } ,__class__: JsonParser_$d8e5213783812cec0906ca233f0379dc }); var JsonParser_$dda5f87e2972892b16c7b833df96706a = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; JsonParser_$dda5f87e2972892b16c7b833df96706a.__name__ = true; JsonParser_$dda5f87e2972892b16c7b833df96706a.__super__ = json2object_reader_BaseParser; JsonParser_$dda5f87e2972892b16c7b833df96706a.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.errors.push(json2object_Error.IncorrectType(variable,"{ data : String }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { this.value = null; } ,loadJsonObject: function(o,pos,variable) { var assigned = new haxe_ds_StringMap(); this.objectSetupAssign(assigned,["data"],[false]); this.value = this.getAuto(); var _g = 0; while(_g < o.length) { var field = o[_g]; ++_g; if(field.name == "data") { this.value.data = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"data",assigned,this.value.data,pos); } else { this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); } } this.objectErrors(assigned,pos); } ,getAuto: function() { return { data : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } ,__class__: JsonParser_$dda5f87e2972892b16c7b833df96706a }); var JsonParser_$ddce6d3de223cb2759be5c48797abca5 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; JsonParser_$ddce6d3de223cb2759be5c48797abca5.__name__ = true; JsonParser_$ddce6d3de223cb2759be5c48797abca5.__super__ = json2object_reader_BaseParser; JsonParser_$ddce6d3de223cb2759be5c48797abca5.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.errors.push(json2object_Error.IncorrectType(variable,"String",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { this.value = null; } ,loadJsonString: function(s,pos,variable) { this.value = s; } ,__class__: JsonParser_$ddce6d3de223cb2759be5c48797abca5 }); var JsonParser_$e15c2211613da80aa2992b6249949a65 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; JsonParser_$e15c2211613da80aa2992b6249949a65.__name__ = true; JsonParser_$e15c2211613da80aa2992b6249949a65.__super__ = json2object_reader_BaseParser; JsonParser_$e15c2211613da80aa2992b6249949a65.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.errors.push(json2object_Error.IncorrectType(variable,"{ type : ProgressType, ratio : Float, ?data : Null }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { this.value = null; } ,loadJsonObject: function(o,pos,variable) { var assigned = new haxe_ds_StringMap(); this.objectSetupAssign(assigned,["data","ratio","type"],[true,false,false]); this.value = this.getAuto(); var _g = 0; while(_g < o.length) { var field = o[_g]; ++_g; switch(field.name) { case "data": this.value.data = this.loadObjectField(($_=new JsonParser_$ddce6d3de223cb2759be5c48797abca5(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"data",assigned,this.value.data,pos); break; case "ratio": this.value.ratio = this.loadObjectField(($_=new JsonParser_$22ae0e2b89e5e3d477f988cc36d3272b(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"ratio",assigned,this.value.ratio,pos); break; case "type": this.value.type = this.loadObjectField(($_=new JsonParser_$ec6c0149f584f56bd68388d292edf21c(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"type",assigned,this.value.type,pos); break; default: this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); } } this.objectErrors(assigned,pos); } ,getAuto: function() { return { data : new JsonParser_$ddce6d3de223cb2759be5c48797abca5([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), ratio : new JsonParser_$22ae0e2b89e5e3d477f988cc36d3272b([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), type : new JsonParser_$ec6c0149f584f56bd68388d292edf21c([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } ,__class__: JsonParser_$e15c2211613da80aa2992b6249949a65 }); var JsonParser_$e5a960b500232cc84a0caf718de13706 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; JsonParser_$e5a960b500232cc84a0caf718de13706.__name__ = true; JsonParser_$e5a960b500232cc84a0caf718de13706.__super__ = json2object_reader_BaseParser; JsonParser_$e5a960b500232cc84a0caf718de13706.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.errors.push(json2object_Error.IncorrectType(variable,"{ isOpen : Bool }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { this.value = null; } ,loadJsonObject: function(o,pos,variable) { var assigned = new haxe_ds_StringMap(); this.objectSetupAssign(assigned,["isOpen"],[false]); this.value = this.getAuto(); var _g = 0; while(_g < o.length) { var field = o[_g]; ++_g; if(field.name == "isOpen") { this.value.isOpen = this.loadObjectField(($_=new JsonParser_$c26f15e86e3de4c398a8273272aba034(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"isOpen",assigned,this.value.isOpen,pos); } else { this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); } } this.objectErrors(assigned,pos); } ,getAuto: function() { return { isOpen : new JsonParser_$c26f15e86e3de4c398a8273272aba034([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } ,__class__: JsonParser_$e5a960b500232cc84a0caf718de13706 }); var JsonParser_$ec6c0149f584f56bd68388d292edf21c = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; JsonParser_$ec6c0149f584f56bd68388d292edf21c.__name__ = true; JsonParser_$ec6c0149f584f56bd68388d292edf21c.__super__ = json2object_reader_BaseParser; JsonParser_$ec6c0149f584f56bd68388d292edf21c.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.value = "Caching"; this.errors.push(json2object_Error.IncorrectType(variable,"ProgressType",pos)); this.objectThrow(pos,variable); } ,loadJsonNull: function(pos,variable) { this.value = null; } ,loadJsonString: function(s,pos,variable) { this.value = this.loadString(s,pos,variable,["Caching","Downloading","Uploading","Canceled"],"Caching"); } ,__class__: JsonParser_$ec6c0149f584f56bd68388d292edf21c }); var JsonParser_$ed5dea09095f671b801bee34ea28a319 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; JsonParser_$ed5dea09095f671b801bee34ea28a319.__name__ = true; JsonParser_$ed5dea09095f671b801bee34ea28a319.__super__ = json2object_reader_BaseParser; JsonParser_$ed5dea09095f671b801bee34ea28a319.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.value = "guest"; this.errors.push(json2object_Error.IncorrectType(variable,"Permission",pos)); this.objectThrow(pos,variable); } ,loadJsonNull: function(pos,variable) { this.value = null; } ,loadJsonString: function(s,pos,variable) { this.value = this.loadString(s,pos,variable,["guest","user","leader","admin","writeChat","addVideo","removeVideo","requestLeader","rewind","clearChat","setLeader","changeOrder","toggleItemType","lockPlaylist","banClient"],"guest"); } ,__class__: JsonParser_$ed5dea09095f671b801bee34ea28a319 }); var JsonParser_$f3c29c0813c93ee49a61ccf072b8a177 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; JsonParser_$f3c29c0813c93ee49a61ccf072b8a177.__name__ = true; JsonParser_$f3c29c0813c93ee49a61ccf072b8a177.__super__ = json2object_reader_BaseParser; JsonParser_$f3c29c0813c93ee49a61ccf072b8a177.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.errors.push(json2object_Error.IncorrectType(variable,"{ passwordConfirmation : String, password : String, name : String }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { this.value = null; } ,loadJsonObject: function(o,pos,variable) { var assigned = new haxe_ds_StringMap(); this.objectSetupAssign(assigned,["name","password","passwordConfirmation"],[false,false,false]); this.value = this.getAuto(); var _g = 0; while(_g < o.length) { var field = o[_g]; ++_g; switch(field.name) { case "name": this.value.name = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"name",assigned,this.value.name,pos); break; case "password": this.value.password = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"password",assigned,this.value.password,pos); break; case "passwordConfirmation": this.value.passwordConfirmation = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"passwordConfirmation",assigned,this.value.passwordConfirmation,pos); break; default: this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); } } this.objectErrors(assigned,pos); } ,getAuto: function() { return { name : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), password : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), passwordConfirmation : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } ,__class__: JsonParser_$f3c29c0813c93ee49a61ccf072b8a177 }); var JsonParser_$f55acea3678203c700715b781ad1ef0c = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; JsonParser_$f55acea3678203c700715b781ad1ef0c.__name__ = true; JsonParser_$f55acea3678203c700715b781ad1ef0c.__super__ = json2object_reader_BaseParser; JsonParser_$f55acea3678203c700715b781ad1ef0c.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.errors.push(json2object_Error.IncorrectType(variable,"Bool",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { this.value = null; } ,loadJsonBool: function(b,pos,variable) { this.value = b; } ,__class__: JsonParser_$f55acea3678203c700715b781ad1ef0c }); var JsonParser_$fa535ffb25e1fd20341652f9be21e06e = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; JsonParser_$fa535ffb25e1fd20341652f9be21e06e.__name__ = true; JsonParser_$fa535ffb25e1fd20341652f9be21e06e.__super__ = json2object_reader_BaseParser; JsonParser_$fa535ffb25e1fd20341652f9be21e06e.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.errors.push(json2object_Error.IncorrectType(variable,"{ youtubePlaylistLimit : Int, youtubeApiKey : String, userVideoLimit : Int, unpauseWithoutLeader : Bool, totalVideoLimit : Int, templateUrl : String, ?serverVersion : Null, ?salt : Null, requestLeaderOnPause : Bool, port : Int, permissions : Permissions, maxMessageLength : Int, maxLoginLength : Int, ?isVerbose : Null, filters : Array, emotes : Array, channelName : String }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { this.value = null; } ,loadJsonObject: function(o,pos,variable) { var assigned = new haxe_ds_StringMap(); this.objectSetupAssign(assigned,["channelName","emotes","filters","isVerbose","maxLoginLength","maxMessageLength","permissions","port","requestLeaderOnPause","salt","serverVersion","templateUrl","totalVideoLimit","unpauseWithoutLeader","userVideoLimit","youtubeApiKey","youtubePlaylistLimit"],[false,false,false,true,false,false,false,false,false,true,true,false,false,false,false,false,false]); this.value = this.getAuto(); var _g = 0; while(_g < o.length) { var field = o[_g]; ++_g; switch(field.name) { case "channelName": this.value.channelName = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"channelName",assigned,this.value.channelName,pos); break; case "emotes": this.value.emotes = this.loadObjectField(($_=new JsonParser_$b228e2c506a1d2b95c8332e07c38b0f2(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"emotes",assigned,this.value.emotes,pos); break; case "filters": this.value.filters = this.loadObjectField(($_=new JsonParser_$4152afa9599cfde83ddff5d84d1707c8(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"filters",assigned,this.value.filters,pos); break; case "isVerbose": this.value.isVerbose = this.loadObjectField(($_=new JsonParser_$f55acea3678203c700715b781ad1ef0c(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"isVerbose",assigned,this.value.isVerbose,pos); break; case "maxLoginLength": this.value.maxLoginLength = this.loadObjectField(($_=new JsonParser_$1686a6c336b71b36d77354cea19a8b52(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"maxLoginLength",assigned,this.value.maxLoginLength,pos); break; case "maxMessageLength": this.value.maxMessageLength = this.loadObjectField(($_=new JsonParser_$1686a6c336b71b36d77354cea19a8b52(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"maxMessageLength",assigned,this.value.maxMessageLength,pos); break; case "permissions": this.value.permissions = this.loadObjectField(($_=new JsonParser_$d08ccf52b4cdd08e41cfb99ec42e0b29(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"permissions",assigned,this.value.permissions,pos); break; case "port": this.value.port = this.loadObjectField(($_=new JsonParser_$1686a6c336b71b36d77354cea19a8b52(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"port",assigned,this.value.port,pos); break; case "requestLeaderOnPause": this.value.requestLeaderOnPause = this.loadObjectField(($_=new JsonParser_$c26f15e86e3de4c398a8273272aba034(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"requestLeaderOnPause",assigned,this.value.requestLeaderOnPause,pos); break; case "salt": this.value.salt = this.loadObjectField(($_=new JsonParser_$ddce6d3de223cb2759be5c48797abca5(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"salt",assigned,this.value.salt,pos); break; case "serverVersion": this.value.serverVersion = this.loadObjectField(($_=new JsonParser_$fce7124f52c7d8d1f8ed39d333573e17(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"serverVersion",assigned,this.value.serverVersion,pos); break; case "templateUrl": this.value.templateUrl = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"templateUrl",assigned,this.value.templateUrl,pos); break; case "totalVideoLimit": this.value.totalVideoLimit = this.loadObjectField(($_=new JsonParser_$1686a6c336b71b36d77354cea19a8b52(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"totalVideoLimit",assigned,this.value.totalVideoLimit,pos); break; case "unpauseWithoutLeader": this.value.unpauseWithoutLeader = this.loadObjectField(($_=new JsonParser_$c26f15e86e3de4c398a8273272aba034(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"unpauseWithoutLeader",assigned,this.value.unpauseWithoutLeader,pos); break; case "userVideoLimit": this.value.userVideoLimit = this.loadObjectField(($_=new JsonParser_$1686a6c336b71b36d77354cea19a8b52(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"userVideoLimit",assigned,this.value.userVideoLimit,pos); break; case "youtubeApiKey": this.value.youtubeApiKey = this.loadObjectField(($_=new JsonParser_$27118326006d3829667a400ad23d5d98(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"youtubeApiKey",assigned,this.value.youtubeApiKey,pos); break; case "youtubePlaylistLimit": this.value.youtubePlaylistLimit = this.loadObjectField(($_=new JsonParser_$1686a6c336b71b36d77354cea19a8b52(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"youtubePlaylistLimit",assigned,this.value.youtubePlaylistLimit,pos); break; default: this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); } } this.objectErrors(assigned,pos); } ,getAuto: function() { return { channelName : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), emotes : new JsonParser_$b228e2c506a1d2b95c8332e07c38b0f2([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), filters : new JsonParser_$4152afa9599cfde83ddff5d84d1707c8([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), isVerbose : new JsonParser_$f55acea3678203c700715b781ad1ef0c([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), maxLoginLength : new JsonParser_$1686a6c336b71b36d77354cea19a8b52([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), maxMessageLength : new JsonParser_$1686a6c336b71b36d77354cea19a8b52([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), permissions : new JsonParser_$d08ccf52b4cdd08e41cfb99ec42e0b29([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), port : new JsonParser_$1686a6c336b71b36d77354cea19a8b52([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), requestLeaderOnPause : new JsonParser_$c26f15e86e3de4c398a8273272aba034([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), salt : new JsonParser_$ddce6d3de223cb2759be5c48797abca5([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), serverVersion : new JsonParser_$fce7124f52c7d8d1f8ed39d333573e17([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), templateUrl : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), totalVideoLimit : new JsonParser_$1686a6c336b71b36d77354cea19a8b52([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), unpauseWithoutLeader : new JsonParser_$c26f15e86e3de4c398a8273272aba034([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), userVideoLimit : new JsonParser_$1686a6c336b71b36d77354cea19a8b52([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), youtubeApiKey : new JsonParser_$27118326006d3829667a400ad23d5d98([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), youtubePlaylistLimit : new JsonParser_$1686a6c336b71b36d77354cea19a8b52([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } ,__class__: JsonParser_$fa535ffb25e1fd20341652f9be21e06e }); var JsonParser_$fce7124f52c7d8d1f8ed39d333573e17 = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; JsonParser_$fce7124f52c7d8d1f8ed39d333573e17.__name__ = true; JsonParser_$fce7124f52c7d8d1f8ed39d333573e17.__super__ = json2object_reader_BaseParser; JsonParser_$fce7124f52c7d8d1f8ed39d333573e17.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.errors.push(json2object_Error.IncorrectType(variable,"Int",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { this.value = null; } ,loadJsonNumber: function(f,pos,variable) { this.value = this.loadJsonInt(f,pos,variable,this.value); } ,__class__: JsonParser_$fce7124f52c7d8d1f8ed39d333573e17 }); var JsonParser_$feded5bdb427eb48f39e60029d5dca4a = function(errors,putils,errorType) { if(errorType == null) { errorType = 0; } json2object_reader_BaseParser.call(this,errors,putils,errorType); }; JsonParser_$feded5bdb427eb48f39e60029d5dca4a.__name__ = true; JsonParser_$feded5bdb427eb48f39e60029d5dca4a.__super__ = json2object_reader_BaseParser; JsonParser_$feded5bdb427eb48f39e60029d5dca4a.prototype = $extend(json2object_reader_BaseParser.prototype,{ onIncorrectType: function(pos,variable) { this.errors.push(json2object_Error.IncorrectType(variable,"{ time : Float, ?rate : Null, ?pausedByServer : Null, ?paused : Null }",pos)); json2object_reader_BaseParser.prototype.onIncorrectType.call(this,pos,variable); } ,loadJsonNull: function(pos,variable) { this.value = null; } ,loadJsonObject: function(o,pos,variable) { var assigned = new haxe_ds_StringMap(); this.objectSetupAssign(assigned,["paused","pausedByServer","rate","time"],[true,true,true,false]); this.value = this.getAuto(); var _g = 0; while(_g < o.length) { var field = o[_g]; ++_g; switch(field.name) { case "paused": this.value.paused = this.loadObjectField(($_=new JsonParser_$f55acea3678203c700715b781ad1ef0c(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"paused",assigned,this.value.paused,pos); break; case "pausedByServer": this.value.pausedByServer = this.loadObjectField(($_=new JsonParser_$f55acea3678203c700715b781ad1ef0c(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"pausedByServer",assigned,this.value.pausedByServer,pos); break; case "rate": this.value.rate = this.loadObjectField(($_=new JsonParser_$08065556836b0755d9c8e1550cf9f19c(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"rate",assigned,this.value.rate,pos); break; case "time": this.value.time = this.loadObjectField(($_=new JsonParser_$22ae0e2b89e5e3d477f988cc36d3272b(this.errors,this.putils,1),$bind($_,$_.loadJson)),field,"time",assigned,this.value.time,pos); break; default: this.errors.push(json2object_Error.UnknownVariable(field.name,this.putils.convertPosition(field.namePos))); } } this.objectErrors(assigned,pos); } ,getAuto: function() { return { paused : new JsonParser_$f55acea3678203c700715b781ad1ef0c([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), pausedByServer : new JsonParser_$f55acea3678203c700715b781ad1ef0c([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), rate : new JsonParser_$08065556836b0755d9c8e1550cf9f19c([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1))), time : new JsonParser_$22ae0e2b89e5e3d477f988cc36d3272b([],this.putils,0).loadJson(new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position("",0,1)))}; } ,__class__: JsonParser_$feded5bdb427eb48f39e60029d5dca4a }); var Lambda = function() { }; Lambda.__name__ = true; Lambda.exists = function(it,f) { var x = $getIterator(it); while(x.hasNext()) if(f(x.next())) { return true; } return false; }; Lambda.count = function(it,pred) { var n = 0; if(pred == null) { var _ = $getIterator(it); while(_.hasNext()) { _.next(); ++n; } } else { var x = $getIterator(it); while(x.hasNext()) if(pred(x.next())) { ++n; } } return n; }; Lambda.find = function(it,f) { var v = $getIterator(it); while(v.hasNext()) { var v1 = v.next(); if(f(v1)) { return v1; } } return null; }; Lambda.findIndex = function(it,f) { var i = 0; var v = $getIterator(it); while(v.hasNext()) { if(f(v.next())) { return i; } ++i; } return -1; }; var haxe_IMap = function() { }; haxe_IMap.__name__ = true; haxe_IMap.__isInterface__ = true; var haxe_ds_StringMap = function() { this.h = Object.create(null); }; haxe_ds_StringMap.__name__ = true; haxe_ds_StringMap.__interfaces__ = [haxe_IMap]; haxe_ds_StringMap.prototype = { __class__: haxe_ds_StringMap }; var Lang = function() { }; Lang.__name__ = true; Lang.request = function(path,callback) { callback(js_node_Fs.readFileSync(path,{ encoding : "utf8"})); }; Lang.init = function(folderPath,callback) { Lang.langs.h = Object.create(null); var count = 0; var _g = 0; var _g1 = Lang.ids; while(_g < _g1.length) { var name = [_g1[_g]]; ++_g; Lang.request("" + folderPath + "/" + name[0] + ".json",(function(name) { return function(data) { var data1 = JSON.parse(data); var lang = new haxe_ds_StringMap(); var _g = 0; var _g1 = Reflect.fields(data1); while(_g < _g1.length) { var key = _g1[_g]; ++_g; lang.h[key] = Reflect.field(data1,key); } var id = haxe_io_Path.withoutExtension(name[0]); Lang.langs.h[id] = lang; count += 1; if(count == Lang.ids.length && callback != null) { callback(); } }; })(name)); } }; Lang.get = function(lang,key) { if(Lang.langs.h[lang] == null) { lang = Lang.ids[0]; } var text = Lang.langs.h[lang].h[key]; if(text != null) { return text; } else { return key; } }; Math.__name__ = true; var Reflect = function() { }; Reflect.__name__ = true; Reflect.field = function(o,field) { try { return o[field]; } catch( _g ) { return null; } }; 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; }; var Std = function() { }; Std.__name__ = true; Std.string = function(s) { return js_Boot.__string_rec(s,""); }; Std.parseInt = function(x) { var v = parseInt(x); if(isNaN(v)) { return null; } return v; }; Std.random = function(x) { if(x <= 0) { return 0; } else { return Math.floor(Math.random() * x); } }; var StringBuf = function() { this.b = ""; }; StringBuf.__name__ = true; StringBuf.prototype = { __class__: StringBuf }; var StringTools = function() { }; StringTools.__name__ = true; 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 = ""; do { s = "0123456789ABCDEF".charAt(n & 15) + s; n >>>= 4; } while(n > 0); if(digits != null) { while(s.length < digits) s = "0" + s; } return s; }; var _$Types_VideoItemTools = function() { }; _$Types_VideoItemTools.__name__ = true; _$Types_VideoItemTools.withUrl = function(item,url) { return { url : url, title : item.title, author : item.author, duration : item.duration, subs : item.subs, voiceOverTrack : item.voiceOverTrack, isTemp : item.isTemp, doCache : item.doCache, playerType : item.playerType}; }; var VideoList = function() { this.items = []; this.isOpen = true; this.pos = 0; }; VideoList.__name__ = true; VideoList.prototype = { setItems: function(items) { this.items.length = 0; this.pos = 0; var _g = 0; while(_g < items.length) this.items.push(items[_g++]); } ,setPos: function(i) { if(i < 0 || i > this.items.length - 1) { i = 0; } this.pos = i; } ,hasItem: function(i) { return this.items[i] != null; } ,exists: function(f) { return Lambda.exists(this.items,f); } ,findIndex: function(f) { return Lambda.findIndex(this.items,f); } ,addItem: function(item,atEnd) { if(atEnd) { this.items.push(item); } else { this.items.splice(this.pos + 1,0,item); } } ,setNextItem: function(nextPos) { var next = this.items[nextPos]; HxOverrides.remove(this.items,next); if(nextPos < this.pos) { this.pos--; } this.items.splice(this.pos + 1,0,next); } ,toggleItemType: function(pos) { this.items[pos].isTemp = !this.items[pos].isTemp; } ,removeItem: function(index) { if(index < this.pos) { this.pos--; } HxOverrides.remove(this.items,this.items[index]); if(this.pos >= this.items.length) { this.pos = 0; } } ,skipItem: function() { var item = this.items[this.pos]; if(!item.isTemp) { this.pos++; } else { HxOverrides.remove(this.items,item); } if(this.pos >= this.items.length) { this.pos = 0; } } ,itemsByUser: function(client) { var i = 0; var _g = 0; var _g1 = this.items; while(_g < _g1.length) if(_g1[_g++].author == client.name) { ++i; } return i; } ,shuffle: function() { var current = this.items[this.pos]; HxOverrides.remove(this.items,current); this.shuffleArray(this.items); this.items.splice(this.pos,0,current); } ,shuffleArray: function(arr) { var _g_current = 0; while(_g_current < arr.length) { var _g_value = arr[_g_current++]; var n = Std.random(arr.length); arr[_g_current - 1] = arr[n]; arr[n] = _g_value; } } ,__class__: VideoList }; var haxe_Exception = function(message,previous,native) { Error.call(this,message); this.message = message; this.__previousException = previous; this.__nativeException = native != null ? native : this; }; haxe_Exception.__name__ = true; 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); return e; } }; haxe_Exception.__super__ = Error; haxe_Exception.prototype = $extend(Error.prototype,{ unwrap: function() { return this.__nativeException; } ,toString: function() { return this.get_message(); } ,get_message: function() { return this.message; } ,get_native: function() { return this.__nativeException; } ,__class__: haxe_Exception }); var haxe_Log = function() { }; haxe_Log.__name__ = true; 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) str += ", " + Std.string(_g1[_g++]); } 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_Timer = function(time_ms) { var me = this; this.id = setInterval(function() { me.run(); },time_ms); }; haxe_Timer.__name__ = true; haxe_Timer.delay = function(f,time_ms) { var t = new haxe_Timer(time_ms); t.run = function() { t.stop(); f(); }; return t; }; haxe_Timer.prototype = { stop: function() { if(this.id == null) { return; } clearInterval(this.id); this.id = null; } ,run: function() { } ,__class__: haxe_Timer }; var haxe_ValueException = function(value,previous,native) { haxe_Exception.call(this,String(value),previous,native); this.value = value; }; haxe_ValueException.__name__ = true; haxe_ValueException.__super__ = haxe_Exception; haxe_ValueException.prototype = $extend(haxe_Exception.prototype,{ unwrap: function() { return this.value; } ,__class__: haxe_ValueException }); var haxe_crypto_Sha256 = function() { }; haxe_crypto_Sha256.__name__ = true; haxe_crypto_Sha256.encode = function(s) { var sh = new haxe_crypto_Sha256(); return sh.hex(sh.doEncode(haxe_crypto_Sha256.str2blks(s),s.length * 8)); }; haxe_crypto_Sha256.str2blks = function(s) { var s1 = haxe_io_Bytes.ofString(s); var nblk = (s1.length + 8 >> 6) + 1; var blks = []; var _g = 0; var _g1 = nblk * 16; while(_g < _g1) blks[_g++] = 0; var _g = 0; var _g1 = s1.length; while(_g < _g1) { var i = _g++; blks[i >> 2] |= s1.b[i] << 24 - ((i & 3) << 3); } var i = s1.length; blks[i >> 2] |= 128 << 24 - ((i & 3) << 3); blks[nblk * 16 - 1] = s1.length * 8; return blks; }; haxe_crypto_Sha256.prototype = { doEncode: function(m,l) { var K = [1116352408,1899447441,-1245643825,-373957723,961987163,1508970993,-1841331548,-1424204075,-670586216,310598401,607225278,1426881987,1925078388,-2132889090,-1680079193,-1046744716,-459576895,-272742522,264347078,604807628,770255983,1249150122,1555081692,1996064986,-1740746414,-1473132947,-1341970488,-1084653625,-958395405,-710438585,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,-2117940946,-1838011259,-1564481375,-1474664885,-1035236496,-949202525,-778901479,-694614492,-200395387,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,-2067236844,-1933114872,-1866530822,-1538233109,-1090935817,-965641998]; var HASH = [1779033703,-1150833019,1013904242,-1521486534,1359893119,-1694144372,528734635,1541459225]; var W = []; W[64] = 0; var a; var b; var c; var d; var e; var f; var g; var h; var T1; var T2; m[l >> 5] |= 128 << 24 - l % 32; m[(l + 64 >> 9 << 4) + 15] = l; var i = 0; while(i < m.length) { a = HASH[0]; b = HASH[1]; c = HASH[2]; d = HASH[3]; e = HASH[4]; f = HASH[5]; g = HASH[6]; h = HASH[7]; var _g = 0; while(_g < 64) { var j = _g++; if(j < 16) { W[j] = m[j + i]; } else { var x = W[j - 2]; var x1 = (x >>> 17 | x << 15) ^ (x >>> 19 | x << 13) ^ x >>> 10; var y = W[j - 7]; var lsw = (x1 & 65535) + (y & 65535); var x2 = (x1 >> 16) + (y >> 16) + (lsw >> 16) << 16 | lsw & 65535; var x3 = W[j - 15]; var y1 = (x3 >>> 7 | x3 << 25) ^ (x3 >>> 18 | x3 << 14) ^ x3 >>> 3; var lsw1 = (x2 & 65535) + (y1 & 65535); var x4 = (x2 >> 16) + (y1 >> 16) + (lsw1 >> 16) << 16 | lsw1 & 65535; var y2 = W[j - 16]; var lsw2 = (x4 & 65535) + (y2 & 65535); W[j] = (x4 >> 16) + (y2 >> 16) + (lsw2 >> 16) << 16 | lsw2 & 65535; } var y3 = (e >>> 6 | e << 26) ^ (e >>> 11 | e << 21) ^ (e >>> 25 | e << 7); var lsw3 = (h & 65535) + (y3 & 65535); var x5 = (h >> 16) + (y3 >> 16) + (lsw3 >> 16) << 16 | lsw3 & 65535; var y4 = e & f ^ ~e & g; var lsw4 = (x5 & 65535) + (y4 & 65535); var x6 = (x5 >> 16) + (y4 >> 16) + (lsw4 >> 16) << 16 | lsw4 & 65535; var y5 = K[j]; var lsw5 = (x6 & 65535) + (y5 & 65535); var x7 = (x6 >> 16) + (y5 >> 16) + (lsw5 >> 16) << 16 | lsw5 & 65535; var y6 = W[j]; var lsw6 = (x7 & 65535) + (y6 & 65535); T1 = (x7 >> 16) + (y6 >> 16) + (lsw6 >> 16) << 16 | lsw6 & 65535; var x8 = (a >>> 2 | a << 30) ^ (a >>> 13 | a << 19) ^ (a >>> 22 | a << 10); var y7 = a & b ^ a & c ^ b & c; var lsw7 = (x8 & 65535) + (y7 & 65535); T2 = (x8 >> 16) + (y7 >> 16) + (lsw7 >> 16) << 16 | lsw7 & 65535; h = g; g = f; f = e; var lsw8 = (d & 65535) + (T1 & 65535); e = (d >> 16) + (T1 >> 16) + (lsw8 >> 16) << 16 | lsw8 & 65535; d = c; c = b; b = a; var lsw9 = (T1 & 65535) + (T2 & 65535); a = (T1 >> 16) + (T2 >> 16) + (lsw9 >> 16) << 16 | lsw9 & 65535; } var y8 = HASH[0]; var lsw10 = (a & 65535) + (y8 & 65535); HASH[0] = (a >> 16) + (y8 >> 16) + (lsw10 >> 16) << 16 | lsw10 & 65535; var y9 = HASH[1]; var lsw11 = (b & 65535) + (y9 & 65535); HASH[1] = (b >> 16) + (y9 >> 16) + (lsw11 >> 16) << 16 | lsw11 & 65535; var y10 = HASH[2]; var lsw12 = (c & 65535) + (y10 & 65535); HASH[2] = (c >> 16) + (y10 >> 16) + (lsw12 >> 16) << 16 | lsw12 & 65535; var y11 = HASH[3]; var lsw13 = (d & 65535) + (y11 & 65535); HASH[3] = (d >> 16) + (y11 >> 16) + (lsw13 >> 16) << 16 | lsw13 & 65535; var y12 = HASH[4]; var lsw14 = (e & 65535) + (y12 & 65535); HASH[4] = (e >> 16) + (y12 >> 16) + (lsw14 >> 16) << 16 | lsw14 & 65535; var y13 = HASH[5]; var lsw15 = (f & 65535) + (y13 & 65535); HASH[5] = (f >> 16) + (y13 >> 16) + (lsw15 >> 16) << 16 | lsw15 & 65535; var y14 = HASH[6]; var lsw16 = (g & 65535) + (y14 & 65535); HASH[6] = (g >> 16) + (y14 >> 16) + (lsw16 >> 16) << 16 | lsw16 & 65535; var y15 = HASH[7]; var lsw17 = (h & 65535) + (y15 & 65535); HASH[7] = (h >> 16) + (y15 >> 16) + (lsw17 >> 16) << 16 | lsw17 & 65535; i += 16; } return HASH; } ,hex: function(a) { var str = ""; var _g = 0; while(_g < a.length) str += StringTools.hex(a[_g++],8); return str.toLowerCase(); } ,__class__: haxe_crypto_Sha256 }; var haxe_exceptions_PosException = function(message,previous,pos) { haxe_Exception.call(this,message,previous); if(pos == null) { this.posInfos = { fileName : "(unknown)", lineNumber : 0, className : "(unknown)", methodName : "(unknown)"}; } else { this.posInfos = pos; } }; haxe_exceptions_PosException.__name__ = true; haxe_exceptions_PosException.__super__ = haxe_Exception; haxe_exceptions_PosException.prototype = $extend(haxe_Exception.prototype,{ toString: function() { return "" + haxe_Exception.prototype.toString.call(this) + " in " + this.posInfos.className + "." + this.posInfos.methodName + " at " + this.posInfos.fileName + ":" + this.posInfos.lineNumber; } ,__class__: haxe_exceptions_PosException }); var haxe_exceptions_NotImplementedException = function(message,previous,pos) { if(message == null) { message = "Not implemented"; } haxe_exceptions_PosException.call(this,message,previous,pos); }; haxe_exceptions_NotImplementedException.__name__ = true; haxe_exceptions_NotImplementedException.__super__ = haxe_exceptions_PosException; haxe_exceptions_NotImplementedException.prototype = $extend(haxe_exceptions_PosException.prototype,{ __class__: haxe_exceptions_NotImplementedException }); var haxe_io_Bytes = function(data) { this.length = data.byteLength; this.b = new Uint8Array(data); this.b.bufferValue = data; data.hxBytes = this; data.bytes = this.b; }; haxe_io_Bytes.__name__ = true; haxe_io_Bytes.ofString = function(s,encoding) { if(encoding == haxe_io_Encoding.RawNative) { var buf = new Uint8Array(s.length << 1); var _g = 0; var _g1 = s.length; while(_g < _g1) { var i = _g++; var c = s.charCodeAt(i); buf[i << 1] = c & 255; buf[i << 1 | 1] = c >> 8; } return new haxe_io_Bytes(buf.buffer); } var a = []; var i = 0; while(i < s.length) { var c = s.charCodeAt(i++); if(55296 <= c && c <= 56319) { c = c - 55232 << 10 | s.charCodeAt(i++) & 1023; } if(c <= 127) { a.push(c); } else if(c <= 2047) { a.push(192 | c >> 6); a.push(128 | c & 63); } else if(c <= 65535) { a.push(224 | c >> 12); a.push(128 | c >> 6 & 63); a.push(128 | c & 63); } else { a.push(240 | c >> 18); a.push(128 | c >> 12 & 63); a.push(128 | c >> 6 & 63); a.push(128 | c & 63); } } return new haxe_io_Bytes(new Uint8Array(a).buffer); }; haxe_io_Bytes.prototype = { __class__: haxe_io_Bytes }; var haxe_io_Encoding = $hxEnums["haxe.io.Encoding"] = { __ename__:true,__constructs__:null ,UTF8: {_hx_name:"UTF8",_hx_index:0,__enum__:"haxe.io.Encoding",toString:$estr} ,RawNative: {_hx_name:"RawNative",_hx_index:1,__enum__:"haxe.io.Encoding",toString:$estr} }; haxe_io_Encoding.__constructs__ = [haxe_io_Encoding.UTF8,haxe_io_Encoding.RawNative]; var haxe_io_Path = function(path) { switch(path) { case ".":case "..": this.dir = path; this.file = ""; return; } var c1 = path.lastIndexOf("/"); var c2 = path.lastIndexOf("\\"); if(c1 < c2) { this.dir = HxOverrides.substr(path,0,c2); path = HxOverrides.substr(path,c2 + 1,null); this.backslash = true; } else if(c2 < c1) { this.dir = HxOverrides.substr(path,0,c1); path = HxOverrides.substr(path,c1 + 1,null); } else { this.dir = null; } var cp = path.lastIndexOf("."); if(cp != -1) { this.ext = HxOverrides.substr(path,cp + 1,null); this.file = HxOverrides.substr(path,0,cp); } else { this.ext = null; this.file = path; } }; haxe_io_Path.__name__ = true; haxe_io_Path.withoutExtension = function(path) { var s = new haxe_io_Path(path); s.ext = null; return s.toString(); }; haxe_io_Path.withoutDirectory = function(path) { var s = new haxe_io_Path(path); s.dir = null; return s.toString(); }; haxe_io_Path.extension = function(path) { var s = new haxe_io_Path(path); if(s.ext == null) { return ""; } return s.ext; }; haxe_io_Path.normalize = function(path) { var slash = "/"; path = path.split("\\").join(slash); if(path == slash) { return slash; } var target = []; var _g = 0; var _g1 = path.split(slash); while(_g < _g1.length) { var token = _g1[_g]; ++_g; if(token == ".." && target.length > 0 && target[target.length - 1] != "..") { target.pop(); } else if(token == "") { if(target.length > 0 || HxOverrides.cca(path,0) == 47) { target.push(token); } } else if(token != ".") { target.push(token); } } var acc_b = ""; var colon = false; var slashes = false; var _g_offset = 0; var _g_s = target.join(slash); 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 c2 = c1; switch(c2) { case 47: if(!colon) { slashes = true; } else { var i = c2; colon = false; if(slashes) { acc_b += "/"; slashes = false; } acc_b += String.fromCodePoint(i); } break; case 58: acc_b += ":"; colon = true; break; default: var i1 = c2; colon = false; if(slashes) { acc_b += "/"; slashes = false; } acc_b += String.fromCodePoint(i1); } } return acc_b; }; haxe_io_Path.addTrailingSlash = function(path) { if(path.length == 0) { return "/"; } var c1 = path.lastIndexOf("/"); var c2 = path.lastIndexOf("\\"); if(c1 < c2) { if(c2 != path.length - 1) { return path + "\\"; } else { return path; } } else if(c1 != path.length - 1) { return path + "/"; } else { return path; } }; haxe_io_Path.prototype = { toString: function() { return (this.dir == null ? "" : this.dir + (this.backslash ? "\\" : "/")) + this.file + (this.ext == null ? "" : "." + this.ext); } ,__class__: haxe_io_Path }; var haxe_iterators_ArrayIterator = function(array) { this.current = 0; this.array = array; }; haxe_iterators_ArrayIterator.__name__ = true; haxe_iterators_ArrayIterator.prototype = { hasNext: function() { return this.current < this.array.length; } ,next: function() { return this.array[this.current++]; } ,__class__: haxe_iterators_ArrayIterator }; var hxjsonast_Error = function(message,pos) { this.message = message; this.pos = pos; }; hxjsonast_Error.__name__ = true; hxjsonast_Error.prototype = { __class__: hxjsonast_Error }; var hxjsonast_Json = function(value,pos) { this.value = value; this.pos = pos; }; hxjsonast_Json.__name__ = true; hxjsonast_Json.prototype = { __class__: hxjsonast_Json }; var hxjsonast_JsonValue = $hxEnums["hxjsonast.JsonValue"] = { __ename__:true,__constructs__:null ,JString: ($_=function(s) { return {_hx_index:0,s:s,__enum__:"hxjsonast.JsonValue",toString:$estr}; },$_._hx_name="JString",$_.__params__ = ["s"],$_) ,JNumber: ($_=function(s) { return {_hx_index:1,s:s,__enum__:"hxjsonast.JsonValue",toString:$estr}; },$_._hx_name="JNumber",$_.__params__ = ["s"],$_) ,JObject: ($_=function(fields) { return {_hx_index:2,fields:fields,__enum__:"hxjsonast.JsonValue",toString:$estr}; },$_._hx_name="JObject",$_.__params__ = ["fields"],$_) ,JArray: ($_=function(values) { return {_hx_index:3,values:values,__enum__:"hxjsonast.JsonValue",toString:$estr}; },$_._hx_name="JArray",$_.__params__ = ["values"],$_) ,JBool: ($_=function(b) { return {_hx_index:4,b:b,__enum__:"hxjsonast.JsonValue",toString:$estr}; },$_._hx_name="JBool",$_.__params__ = ["b"],$_) ,JNull: {_hx_name:"JNull",_hx_index:5,__enum__:"hxjsonast.JsonValue",toString:$estr} }; hxjsonast_JsonValue.__constructs__ = [hxjsonast_JsonValue.JString,hxjsonast_JsonValue.JNumber,hxjsonast_JsonValue.JObject,hxjsonast_JsonValue.JArray,hxjsonast_JsonValue.JBool,hxjsonast_JsonValue.JNull]; var hxjsonast_JObjectField = function(name,namePos,value) { this.name = name; this.namePos = namePos; this.value = value; }; hxjsonast_JObjectField.__name__ = true; hxjsonast_JObjectField.prototype = { __class__: hxjsonast_JObjectField }; var hxjsonast_Parser = function(source,filename) { this.source = source; this.filename = filename; this.pos = 0; }; hxjsonast_Parser.__name__ = true; hxjsonast_Parser.prototype = { doParse: function() { var result = this.parseRec(); var c; while(true) { c = this.source.charCodeAt(this.pos++); if(!(c == c)) { break; } switch(c) { case 9:case 10:case 13:case 32: break; default: this.invalidChar(); } } return result; } ,parseRec: function() { while(true) { var c = this.source.charCodeAt(this.pos++); switch(c) { case 9:case 10:case 13:case 32: break; case 34: var save = this.pos; return new hxjsonast_Json(hxjsonast_JsonValue.JString(this.parseString()),new hxjsonast_Position(this.filename,save - 1,this.pos)); case 45:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57: var start = this.pos - 1; var minus = c == 45; var digit = !minus; var zero = c == 48; var point = false; var e = false; var pm = false; var end = false; do switch(this.source.charCodeAt(this.pos++)) { case 43:case 45: if(!e || pm) { this.invalidNumber(start); } digit = false; pm = true; break; case 46: if(minus || point || e) { this.invalidNumber(start); } digit = false; point = true; break; case 48: if(zero && !point) { this.invalidNumber(start); } if(minus) { minus = false; zero = true; } digit = true; break; case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57: if(zero && !point) { this.invalidNumber(start); } if(minus) { minus = false; } digit = true; zero = false; break; case 69:case 101: if(minus || zero || e) { this.invalidNumber(start); } digit = false; e = true; break; default: if(!digit) { this.invalidNumber(start); } this.pos--; end = true; } while(!end); return new hxjsonast_Json(hxjsonast_JsonValue.JNumber(HxOverrides.substr(this.source,start,this.pos - start)),new hxjsonast_Position(this.filename,start,this.pos)); case 91: var values = []; var comma = null; var startPos = this.pos - 1; while(true) switch(this.source.charCodeAt(this.pos++)) { case 9:case 10:case 13:case 32: break; case 44: if(comma) { comma = false; } else { this.invalidChar(); } break; case 93: if(comma == false) { this.invalidChar(); } return new hxjsonast_Json(hxjsonast_JsonValue.JArray(values),new hxjsonast_Position(this.filename,startPos,this.pos)); default: if(comma) { this.invalidChar(); } this.pos--; values.push(this.parseRec()); comma = true; } break; case 102: var save1 = this.pos; if(this.source.charCodeAt(this.pos++) != 97 || this.source.charCodeAt(this.pos++) != 108 || this.source.charCodeAt(this.pos++) != 115 || this.source.charCodeAt(this.pos++) != 101) { this.pos = save1; this.invalidChar(); } return new hxjsonast_Json(hxjsonast_JsonValue.JBool(false),new hxjsonast_Position(this.filename,save1 - 1,this.pos)); case 110: var save2 = this.pos; if(this.source.charCodeAt(this.pos++) != 117 || this.source.charCodeAt(this.pos++) != 108 || this.source.charCodeAt(this.pos++) != 108) { this.pos = save2; this.invalidChar(); } return new hxjsonast_Json(hxjsonast_JsonValue.JNull,new hxjsonast_Position(this.filename,save2 - 1,this.pos)); case 116: var save3 = this.pos; if(this.source.charCodeAt(this.pos++) != 114 || this.source.charCodeAt(this.pos++) != 117 || this.source.charCodeAt(this.pos++) != 101) { this.pos = save3; this.invalidChar(); } return new hxjsonast_Json(hxjsonast_JsonValue.JBool(true),new hxjsonast_Position(this.filename,save3 - 1,this.pos)); case 123: var fields = []; var names_h = Object.create(null); var field = null; var fieldPos = null; var comma1 = null; var startPos1 = this.pos - 1; while(true) switch(this.source.charCodeAt(this.pos++)) { case 9:case 10:case 13:case 32: break; case 34: if(field != null || comma1) { this.invalidChar(); } var fieldStartPos = this.pos - 1; field = this.parseString(); fieldPos = new hxjsonast_Position(this.filename,fieldStartPos,this.pos); if(Object.prototype.hasOwnProperty.call(names_h,field)) { throw haxe_Exception.thrown(new hxjsonast_Error("Duplicate field name \"" + field + "\"",fieldPos)); } else { names_h[field] = true; } break; case 44: if(comma1) { comma1 = false; } else { this.invalidChar(); } break; case 58: if(field == null) { this.invalidChar(); } fields.push(new hxjsonast_JObjectField(field,fieldPos,this.parseRec())); field = null; fieldPos = null; comma1 = true; break; case 125: if(field != null || comma1 == false) { this.invalidChar(); } return new hxjsonast_Json(hxjsonast_JsonValue.JObject(fields),new hxjsonast_Position(this.filename,startPos1,this.pos)); default: this.invalidChar(); } break; default: this.invalidChar(); } } } ,parseString: function() { var start = this.pos; var buf = null; while(true) { var c = this.source.charCodeAt(this.pos++); if(c == 34) { break; } if(c == 92) { if(buf == null) { buf = new StringBuf(); } var s = this.source; var len = this.pos - start - 1; buf.b += len == null ? HxOverrides.substr(s,start,null) : HxOverrides.substr(s,start,len); c = this.source.charCodeAt(this.pos++); switch(c) { case 34:case 47:case 92: buf.b += String.fromCodePoint(c); break; case 98: buf.b += String.fromCodePoint(8); break; case 102: buf.b += String.fromCodePoint(12); break; case 110: buf.b += String.fromCodePoint(10); break; case 114: buf.b += String.fromCodePoint(13); break; case 116: buf.b += String.fromCodePoint(9); break; case 117: var uc = Std.parseInt("0x" + HxOverrides.substr(this.source,this.pos,4)); this.pos += 4; buf.b += String.fromCodePoint(uc); break; default: throw haxe_Exception.thrown(new hxjsonast_Error("Invalid escape sequence \\" + String.fromCodePoint(c),new hxjsonast_Position(this.filename,this.pos - 2,this.pos))); } start = this.pos; } else if(c != c) { this.pos--; throw haxe_Exception.thrown(new hxjsonast_Error("Unclosed string",new hxjsonast_Position(this.filename,start - 1,this.pos))); } } if(buf == null) { return HxOverrides.substr(this.source,start,this.pos - start - 1); } else { var s = this.source; var len = this.pos - start - 1; buf.b += len == null ? HxOverrides.substr(s,start,null) : HxOverrides.substr(s,start,len); return buf.b; } } ,invalidChar: function() { this.pos--; throw haxe_Exception.thrown(new hxjsonast_Error("Invalid character: " + this.source.charAt(this.pos),new hxjsonast_Position(this.filename,this.pos,this.pos + 1))); } ,invalidNumber: function(start) { throw haxe_Exception.thrown(new hxjsonast_Error("Invalid number: " + this.source.substring(start,this.pos),new hxjsonast_Position(this.filename,start,this.pos))); } ,__class__: hxjsonast_Parser }; var hxjsonast_Position = function(file,min,max) { this.file = file; this.min = min; this.max = max; }; hxjsonast_Position.__name__ = true; hxjsonast_Position.prototype = { __class__: hxjsonast_Position }; var js_Boot = function() { }; js_Boot.__name__ = true; 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.__enum__) { var e = $hxEnums[o.__enum__]; var con = e.__constructs__[o._hx_index]; var n = con._hx_name; if(con.__params__) { s = s + "\t"; return n + "(" + ((function($this) { var $r; var _g = []; { var _g1 = 0; var _g2 = con.__params__; while(true) { if(!(_g1 < _g2.length)) { break; } var p = _g2[_g1]; _g1 = _g1 + 1; _g.push(js_Boot.__string_rec(o[p],s)); } } $r = _g; return $r; }(this))).join(",") + ")"; } else { return n; } } 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 ) { 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) { while(true) { 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 = intf[_g++]; if(i == cl || js_Boot.__interfLoop(i,cl)) { return true; } } } cc = cc.__super__; } }; 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 o.__enum__ != null ? $hxEnums[o.__enum__] == cl : 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.__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_node_ChildProcess = require("child_process"); var js_node_Crypto = require("crypto"); var js_node_Fs = require("fs"); var js_node_Http = require("http"); var js_node_Https = require("https"); var js_node_Os = require("os"); var js_node_Path = require("path"); var js_node_Readline = require("readline"); var js_node_buffer_Buffer = require("buffer").Buffer; var js_node_url_URL = require("url").URL; var js_npm_ws_Server = require("ws").Server; var json2object_Error = $hxEnums["json2object.Error"] = { __ename__:true,__constructs__:null ,IncorrectType: ($_=function(variable,expected,pos) { return {_hx_index:0,variable:variable,expected:expected,pos:pos,__enum__:"json2object.Error",toString:$estr}; },$_._hx_name="IncorrectType",$_.__params__ = ["variable","expected","pos"],$_) ,IncorrectEnumValue: ($_=function(value,expected,pos) { return {_hx_index:1,value:value,expected:expected,pos:pos,__enum__:"json2object.Error",toString:$estr}; },$_._hx_name="IncorrectEnumValue",$_.__params__ = ["value","expected","pos"],$_) ,InvalidEnumConstructor: ($_=function(value,expected,pos) { return {_hx_index:2,value:value,expected:expected,pos:pos,__enum__:"json2object.Error",toString:$estr}; },$_._hx_name="InvalidEnumConstructor",$_.__params__ = ["value","expected","pos"],$_) ,UninitializedVariable: ($_=function(variable,pos) { return {_hx_index:3,variable:variable,pos:pos,__enum__:"json2object.Error",toString:$estr}; },$_._hx_name="UninitializedVariable",$_.__params__ = ["variable","pos"],$_) ,UnknownVariable: ($_=function(variable,pos) { return {_hx_index:4,variable:variable,pos:pos,__enum__:"json2object.Error",toString:$estr}; },$_._hx_name="UnknownVariable",$_.__params__ = ["variable","pos"],$_) ,ParserError: ($_=function(message,pos) { return {_hx_index:5,message:message,pos:pos,__enum__:"json2object.Error",toString:$estr}; },$_._hx_name="ParserError",$_.__params__ = ["message","pos"],$_) ,CustomFunctionException: ($_=function(e,pos) { return {_hx_index:6,e:e,pos:pos,__enum__:"json2object.Error",toString:$estr}; },$_._hx_name="CustomFunctionException",$_.__params__ = ["e","pos"],$_) }; json2object_Error.__constructs__ = [json2object_Error.IncorrectType,json2object_Error.IncorrectEnumValue,json2object_Error.InvalidEnumConstructor,json2object_Error.UninitializedVariable,json2object_Error.UnknownVariable,json2object_Error.ParserError,json2object_Error.CustomFunctionException]; var json2object_InternalError = $hxEnums["json2object.InternalError"] = { __ename__:true,__constructs__:null ,AbstractNoJsonRepresentation: ($_=function(name) { return {_hx_index:0,name:name,__enum__:"json2object.InternalError",toString:$estr}; },$_._hx_name="AbstractNoJsonRepresentation",$_.__params__ = ["name"],$_) ,CannotGenerateSchema: ($_=function(name) { return {_hx_index:1,name:name,__enum__:"json2object.InternalError",toString:$estr}; },$_._hx_name="CannotGenerateSchema",$_.__params__ = ["name"],$_) ,HandleExpr: {_hx_name:"HandleExpr",_hx_index:2,__enum__:"json2object.InternalError",toString:$estr} ,ParsingThrow: {_hx_name:"ParsingThrow",_hx_index:3,__enum__:"json2object.InternalError",toString:$estr} ,UnsupportedAbstractEnumType: ($_=function(name) { return {_hx_index:4,name:name,__enum__:"json2object.InternalError",toString:$estr}; },$_._hx_name="UnsupportedAbstractEnumType",$_.__params__ = ["name"],$_) ,UnsupportedEnumAbstractValue: ($_=function(name) { return {_hx_index:5,name:name,__enum__:"json2object.InternalError",toString:$estr}; },$_._hx_name="UnsupportedEnumAbstractValue",$_.__params__ = ["name"],$_) ,UnsupportedMapKeyType: ($_=function(name) { return {_hx_index:6,name:name,__enum__:"json2object.InternalError",toString:$estr}; },$_._hx_name="UnsupportedMapKeyType",$_.__params__ = ["name"],$_) ,UnsupportedSchemaObjectType: ($_=function(name) { return {_hx_index:7,name:name,__enum__:"json2object.InternalError",toString:$estr}; },$_._hx_name="UnsupportedSchemaObjectType",$_.__params__ = ["name"],$_) ,UnsupportedSchemaType: ($_=function(type) { return {_hx_index:8,type:type,__enum__:"json2object.InternalError",toString:$estr}; },$_._hx_name="UnsupportedSchemaType",$_.__params__ = ["type"],$_) }; json2object_InternalError.__constructs__ = [json2object_InternalError.AbstractNoJsonRepresentation,json2object_InternalError.CannotGenerateSchema,json2object_InternalError.HandleExpr,json2object_InternalError.ParsingThrow,json2object_InternalError.UnsupportedAbstractEnumType,json2object_InternalError.UnsupportedEnumAbstractValue,json2object_InternalError.UnsupportedMapKeyType,json2object_InternalError.UnsupportedSchemaObjectType,json2object_InternalError.UnsupportedSchemaType]; var json2object_ErrorUtils = function() { }; json2object_ErrorUtils.__name__ = true; json2object_ErrorUtils.convertError = function(e) { var pos; switch(e._hx_index) { case 0: pos = e.pos; break; case 1: pos = e.pos; break; case 2: pos = e.pos; break; case 3: pos = e.pos; break; case 4: pos = e.pos; break; case 5: pos = e.pos; break; case 6: pos = e.pos; break; } var header = ""; if(pos != null) { var file = pos.file == "" ? "line" : "" + pos.file + ":"; if(pos.lines.length == 1) { header = "" + file + pos.lines[0].number + ": characters " + pos.lines[0].start + "-" + pos.lines[0].end + " : "; } else if(pos.lines.length > 1) { header = "" + file + pos.lines[0].number + ": lines " + pos.lines[0].number + "-" + pos.lines[pos.lines.length - 1].number + " : "; } } switch(e._hx_index) { case 0: return header + ("Variable '" + e.variable + "' should be of type '" + e.expected + "'"); case 1: return header + ("Identifier '" + e.value + "' isn't part of '" + e.expected + "'"); case 2: return header + ("Enum argument '" + e.value + "' should be of type '" + e.expected + "'"); case 3: return header + ("Variable '" + e.variable + "' should be in the json"); case 4: return header + ("Variable '" + e.variable + "' isn't part of the schema"); case 5: return header + ("Parser error: " + e.message); case 6: var _g = e.e; return header + ("Custom function exception: " + (_g == null ? "null" : Std.string(_g))); } }; json2object_ErrorUtils.convertErrorArray = function(e) { var f = json2object_ErrorUtils.convertError; var result = new Array(e.length); var _g = 0; var _g1 = e.length; while(_g < _g1) { var i = _g++; result[i] = f(e[i]); } return result.join("\n"); }; var json2object_PositionUtils = function(content) { this.linesInfo = []; var s = 0; var e = 0; var i = 0; var lineCount = 0; while(i < content.length) switch(content.charAt(i)) { case "\n": e = i; this.linesInfo.push({ number : lineCount, start : s, end : e}); ++lineCount; ++i; s = i; break; case "\r": e = i; if(content.charAt(i + 1) == "\n") { ++e; } this.linesInfo.push({ number : lineCount, start : s, end : e}); ++lineCount; i = e + 1; s = i; break; default: ++i; } this.linesInfo.push({ number : lineCount, start : s, end : i}); }; json2object_PositionUtils.__name__ = true; json2object_PositionUtils.prototype = { convertPosition: function(position) { var min = position.min; var max = position.max; var pos = { file : position.file, min : min + 1, max : max + 1, lines : []}; var bounds_min = 0; var bounds_max = this.linesInfo.length - 1; if(min > this.linesInfo[0].end) { while(bounds_max > bounds_min) { var i = (bounds_min + bounds_max) / 2 | 0; var line = this.linesInfo[i]; if(line.start == min) { bounds_min = i; bounds_max = i; } if(line.end < min) { bounds_min = i + 1; } if(line.start > min || line.end >= min && line.start < min) { bounds_max = i; } } } var _g = bounds_min; var _g1 = this.linesInfo.length; while(_g < _g1) { var line = this.linesInfo[_g++]; if(line.start <= min && line.end >= max) { pos.lines.push({ number : line.number + 1, start : min - line.start + 1, end : max - line.start + 1}); break; } if(line.start <= min && min <= line.end) { pos.lines.push({ number : line.number + 1, start : min - line.start + 1, end : line.end + 1}); } if(line.start <= max && max <= line.end) { pos.lines.push({ number : line.number + 1, start : line.start + 1, end : max - line.start + 1}); } if(line.start >= max || line.end >= max) { break; } } return pos; } ,__class__: json2object_PositionUtils }; var server_ConsoleInput = function(main) { var _g = new haxe_ds_StringMap(); _g.h["addAdmin"] = { args : ["name","password"], desc : "Adds channel admin"}; _g.h["removeAdmin"] = { args : ["name"], desc : "Removes channel admin"}; _g.h["replay"] = { args : ["name"], desc : "Replay log file on server from user/logs/"}; _g.h["logList"] = { args : [], desc : "Show log list from user/logs/"}; _g.h["exit"] = { args : [], desc : "Exit process"}; this.commands = _g; this.main = main; }; server_ConsoleInput.__name__ = true; server_ConsoleInput.prototype = { initConsoleInput: function() { var _gthis = this; var rl = js_node_Readline.createInterface({ input : process.stdin, output : process.stdout, completer : $bind(this,this.onCompletion)}); var originalTrace = haxe_Log.trace; haxe_Log.trace = function(msg,infos) { js_node_Readline.clearLine(process.stdout,0); js_node_Readline.cursorTo(process.stdout,0,null); console.log(_gthis.formatOutput(msg,infos)); rl.prompt(true); }; rl.prompt(); rl.on("line",function(line) { _gthis.parseLine(line); rl.prompt(); }); rl.on("close",function() { return haxe_Log.trace = originalTrace; }); } ,formatOutput: function(v,infos) { var str = Std.string(v); if(infos == null) { return str; } if(infos.customParams != null) { var _g = 0; var _g1 = infos.customParams; while(_g < _g1.length) str += ", " + Std.string(_g1[_g++]); } return str; } ,onCompletion: function(line) { var _g = []; var item_keys = Object.keys(this.commands.h); var item_length = item_keys.length; var item_current = 0; while(item_current < item_length) _g.push("/" + item_keys[item_current++] + " "); var _g1 = []; var _g2 = 0; while(_g2 < _g.length) { var v = _g[_g2]; ++_g2; if(StringTools.startsWith(v,line)) { _g1.push(v); } } if(_g1.length > 0) { return [_g1,line]; } return [_g,line]; } ,parseLine: function(line) { if(line.charCodeAt(0) != 47 || line.length < 2) { this.printHelp(line); return; } var args = StringTools.trim(line).split(" "); var command = HxOverrides.substr(args.shift(),1,null); if(this.commands.h[command] == null) { this.printHelp(line); return; } if(!this.isValidArgs(command,args)) { return; } switch(command) { case "addAdmin": var name = args[0]; var password = args[1]; if(this.main.isBadClientName(name)) { haxe_Log.trace(StringTools.replace(Lang.get("usernameError"),"$MAX","" + this.main.config.maxLoginLength),{ fileName : "src/server/ConsoleInput.hx", lineNumber : 116, className : "server.ConsoleInput", methodName : "parseLine"}); return; } this.main.addAdmin(name,password); break; case "exit": this.main.exit(); break; case "logList": server_Utils.ensureDir(this.main.logsDir); var _this = js_node_Fs.readdirSync(this.main.logsDir); var _g = []; var _g1 = 0; while(_g1 < _this.length) { var v = _this[_g1]; ++_g1; if(StringTools.endsWith(v,".json")) { _g.push(v); } } var _g1 = 0; while(_g1 < _g.length) haxe_Log.trace(haxe_io_Path.withoutExtension(_g[_g1++]),{ fileName : "src/server/ConsoleInput.hx", lineNumber : 143, className : "server.ConsoleInput", methodName : "parseLine"}); break; case "removeAdmin": this.main.removeAdmin(args[0]); break; case "replay": server_Utils.ensureDir(this.main.logsDir); var path = haxe_io_Path.normalize("" + this.main.logsDir + "/" + args[0] + ".json"); if(!sys_FileSystem.exists(path)) { haxe_Log.trace("File \"" + path + "\" not found",{ fileName : "src/server/ConsoleInput.hx", lineNumber : 130, className : "server.ConsoleInput", methodName : "parseLine"}); return; } var text = js_node_Fs.readFileSync(path,{ encoding : "utf8"}); var events = JSON.parse(text); this.main.replayLog(events); break; } } ,isValidArgs: function(command,args) { var len = args.length; var actual = this.commands.h[command].args.length; if(len != actual) { haxe_Log.trace("Wrong count of arguments for command \"" + command + "\" (" + len + " instead of " + actual + ")",{ fileName : "src/server/ConsoleInput.hx", lineNumber : 155, className : "server.ConsoleInput", methodName : "isValidArgs"}); return false; } return true; } ,printHelp: function(line) { var maxLength = 0; var h = this.commands.h; var _g_keys = Object.keys(h); var _g_length = _g_keys.length; var _g_current = 0; while(_g_current < _g_length) { var key = _g_keys[_g_current++]; var _g = { key : key, value : h[key]}; var len = ("/" + _g.key + " " + _g.value.args.join(" ")).length; if(maxLength < len) { maxLength = len; } } var list = []; var h = this.commands.h; var _g_keys = Object.keys(h); var _g_length = _g_keys.length; var _g_current = 0; while(_g_current < _g_length) { var key = _g_keys[_g_current++]; var _g = { key : key, value : h[key]}; var data = _g.value; list.push("" + StringTools.rpad("/" + _g.key + " " + data.args.join(" ")," ",maxLength) + " | " + data.desc); } haxe_Log.trace("Unknown command \"" + line + "\". List:\n" + list.join("\n"),{ fileName : "src/server/ConsoleInput.hx", lineNumber : 174, className : "server.ConsoleInput", methodName : "printHelp"}); } ,__class__: server_ConsoleInput }; var server__$HttpServer_HttpServerConfig = function(dir,customDir,allowLocalRequests,cache) { this.cache = null; this.allowLocalRequests = false; this.customDir = null; this.dir = dir; if(customDir != null) { this.customDir = customDir; } if(allowLocalRequests != null) { this.allowLocalRequests = allowLocalRequests; } if(cache != null) { this.cache = cache; } }; server__$HttpServer_HttpServerConfig.__name__ = true; server__$HttpServer_HttpServerConfig.prototype = { __class__: server__$HttpServer_HttpServerConfig }; var server_HttpServer = function(main,config) { this.ctrlCharacters = new EReg("[\\u0000-\\u001F\\u007F-\\u009F\\u2000-\\u200D\\uFEFF]","g"); this.matchVarString = new EReg("\\${([A-z_]+)}","g"); this.matchLang = new EReg("^[A-z]+",""); this.uploadingFilesLastChunks = new haxe_ds_StringMap(); this.uploadingFilesSizes = new haxe_ds_StringMap(); this.CHUNK_SIZE = 5242880; this.cache = null; this.allowLocalRequests = false; this.allowedLocalFiles = new haxe_ds_StringMap(); this.hasCustomRes = false; this.main = main; this.dir = config.dir; this.customDir = config.customDir; this.allowLocalRequests = config.allowLocalRequests; this.cache = config.cache; if(this.customDir != null) { this.hasCustomRes = sys_FileSystem.exists(this.customDir); } }; server_HttpServer.__name__ = true; server_HttpServer.prototype = { serveFiles: function(req,res) { var _gthis = this; var url; try { url = new js_node_url_URL(this.safeDecodeURI(req.url),"http://localhost"); } catch( _g ) { url = new js_node_url_URL("/","http://localhost"); } var filePath = this.getPath(this.dir,url); var ext = haxe_io_Path.extension(filePath).toLowerCase(); res.setHeader("accept-ranges","bytes"); res.setHeader("content-type",this.getMimeType(ext)); if(req.method == "POST") { if(this.cache != null) { switch(url.pathname) { case "/upload": this.uploadFile(req,res); break; case "/upload-last-chunk": this.uploadFileLastChunk(req,res); break; } } if(url.pathname == "/setup") { this.finishSetup(req,res); } return; } if(this.allowLocalRequests && req.socket.remoteAddress == req.socket.localAddress || this.allowedLocalFiles.h[url.pathname]) { if(this.isMediaExtension(ext)) { this.allowedLocalFiles.h[url.pathname] = true; var s = url.pathname; if(this.serveMedia(req,res,decodeURIComponent(s.split("+").join(" ")))) { return; } } } if(!this.isChildOf(this.dir,filePath)) { res.statusCode = 500; var rel = js_node_Path.relative(this.dir,filePath); res.end("Error getting the file: No access to " + rel + "."); return; } if(url.pathname == "/setup") { if(this.main.hasAdmins()) { tools_HttpServerTools.redirect(res,"/"); return; } js_node_Fs.readFile("" + this.dir + "/setup.html",function(err,data) { data = js_node_buffer_Buffer.from(_gthis.localizeHtml(data.toString(),req.headers["accept-language"])); res.setHeader("content-type",_gthis.getMimeType("html")); res.end(data); }); return; } if(url.pathname == "/proxy") { if(!this.proxyUrl(req,res)) { res.end("Proxy error: " + req.url); } return; } if(this.hasCustomRes) { var path = this.getPath(this.customDir,url); if(js_node_Fs.existsSync(path)) { filePath = path; } var ext1 = haxe_io_Path.extension(filePath).toLowerCase(); res.setHeader("content-type",this.getMimeType(ext1)); } if(this.isMediaExtension(ext)) { if(this.serveMedia(req,res,filePath)) { return; } } js_node_Fs.readFile(filePath,function(err,data) { if(err != null) { _gthis.readFileError(err,res,filePath); return; } if(ext == "html") { if(!_gthis.main.isNoState && !_gthis.main.hasAdmins()) { tools_HttpServerTools.redirect(res,"/setup"); return; } data = _gthis.localizeHtml(data.toString(),req.headers["accept-language"]); } res.end(data); }); } ,uploadFileLastChunk: function(req,res) { var _gthis = this; var fileName; try { fileName = decodeURIComponent(req.headers["content-name"]); } catch( _g ) { fileName = ""; } if(StringTools.trim(fileName).length == 0) { fileName = null; } var name = this.cache.getFreeFileName(fileName); var filePath = this.cache.getFilePath(name); var body = []; req.on("data",function(chunk) { return body.push(chunk); }); req.on("end",function() { var buffer = js_node_buffer_Buffer.concat(body); _gthis.uploadingFilesLastChunks.h[filePath] = buffer; var json = { info : "File last chunk uploaded", url : _gthis.cache.getFileUrl(name)}; return tools_HttpServerTools.json(tools_HttpServerTools.status(res,200),json); }); } ,uploadFile: function(req,res) { var _gthis = this; var fileName; try { fileName = decodeURIComponent(req.headers["content-name"]); } catch( _g ) { fileName = ""; } if(StringTools.trim(fileName).length == 0) { fileName = null; } var name = this.cache.getFreeFileName(fileName); var filePath = this.cache.getFilePath(name); var tmp = Std.parseInt(req.headers["content-length"]); if(tmp == null) { return; } if(tmp < this.cache.storageLimit) { this.cache.removeOlderCache(tmp); } if(this.cache.getFreeSpace() < tmp) { var json = { info : this.cache.notEnoughSpaceErrorText, errorId : "freeSpace"}; tools_HttpServerTools.json(tools_HttpServerTools.status(res,413),json); var _this = _gthis.uploadingFilesSizes; if(Object.prototype.hasOwnProperty.call(_this.h,filePath)) { delete(_this.h[filePath]); } var _this = _gthis.uploadingFilesLastChunks; if(Object.prototype.hasOwnProperty.call(_this.h,filePath)) { delete(_this.h[filePath]); } this.cache.remove(name); req.destroy(); var tmp1 = ClientTools.getByName(this.main.clients,name); if(tmp1 == null) { return; } this.main.serverMessage(tmp1,this.cache.notEnoughSpaceErrorText); return; } var stream = js_node_Fs.createWriteStream(filePath); req.pipe(stream); this.cache.add(name); this.uploadingFilesSizes.h[filePath] = tmp; stream.on("close",function() { tools_HttpServerTools.json(tools_HttpServerTools.status(res,200),{ info : "File write stream closed."}); var _this = _gthis.uploadingFilesSizes; if(Object.prototype.hasOwnProperty.call(_this.h,filePath)) { delete(_this.h[filePath]); } var _this = _gthis.uploadingFilesLastChunks; if(Object.prototype.hasOwnProperty.call(_this.h,filePath)) { delete(_this.h[filePath]); } }); stream.on("error",function(err) { haxe_Log.trace(err,{ fileName : "src/server/HttpServer.hx", lineNumber : 231, className : "server.HttpServer", methodName : "uploadFile"}); tools_HttpServerTools.json(tools_HttpServerTools.status(res,500),{ info : "File write stream error."}); var _this = _gthis.uploadingFilesSizes; if(Object.prototype.hasOwnProperty.call(_this.h,filePath)) { delete(_this.h[filePath]); } var _this = _gthis.uploadingFilesLastChunks; if(Object.prototype.hasOwnProperty.call(_this.h,filePath)) { delete(_this.h[filePath]); } _gthis.cache.remove(name); }); req.on("error",function(err) { haxe_Log.trace("Request Error:",{ fileName : "src/server/HttpServer.hx", lineNumber : 238, className : "server.HttpServer", methodName : "uploadFile", customParams : [err]}); stream.destroy(); tools_HttpServerTools.json(tools_HttpServerTools.status(res,500),{ info : "File request error."}); var _this = _gthis.uploadingFilesSizes; if(Object.prototype.hasOwnProperty.call(_this.h,filePath)) { delete(_this.h[filePath]); } var _this = _gthis.uploadingFilesLastChunks; if(Object.prototype.hasOwnProperty.call(_this.h,filePath)) { delete(_this.h[filePath]); } _gthis.cache.remove(name); }); } ,finishSetup: function(req,res) { var _gthis = this; if(this.main.hasAdmins()) { tools_HttpServerTools.redirect(res,"/"); return; } var bodyChunks = []; req.on("data",function(chunk) { return bodyChunks.push(chunk); }); req.on("end",function() { var body = js_node_buffer_Buffer.concat(bodyChunks).toString(); var jsonParser = new JsonParser_$f3c29c0813c93ee49a61ccf072b8a177(); var jsonData = jsonParser.fromJson(body); if(jsonParser.errors.length > 0) { haxe_Log.trace(json2object_ErrorUtils.convertErrorArray(jsonParser.errors),{ fileName : "src/server/HttpServer.hx", lineNumber : 264, className : "server.HttpServer", methodName : "finishSetup"}); tools_HttpServerTools.json(tools_HttpServerTools.status(res,400),{ success : false, errors : []}); return; } var name = jsonData.name; var password = jsonData.password; var passwordConfirmation = jsonData.passwordConfirmation; var tmp = req.headers["accept-language"]; var lang = tmp != null ? tmp : "en"; var errors = []; if(_gthis.main.isBadClientName(name)) { errors.push({ type : "name", error : StringTools.replace(Lang.get(lang,"usernameError"),"$MAX","" + _gthis.main.config.maxLoginLength)}); } if(password.length < 4 || password.length > 50) { errors.push({ type : "password", error : StringTools.replace(StringTools.replace(Lang.get(lang,"passwordError"),"$MIN","" + 4),"$MAX","" + 50)}); } if(password != passwordConfirmation) { errors.push({ type : "password", error : Lang.get(lang,"passwordsMismatchError")}); } if(errors.length > 0) { tools_HttpServerTools.json(tools_HttpServerTools.status(res,400),{ success : false, errors : errors}); return; } _gthis.main.addAdmin(name,password); tools_HttpServerTools.json(tools_HttpServerTools.status(res,200),{ success : true}); }); } ,getPath: function(dir,url) { var filePath = decodeURIComponent(dir.split("+").join(" ")) + decodeURIComponent(url.pathname); if(!sys_FileSystem.isDirectory(filePath)) { return filePath; } return haxe_io_Path.addTrailingSlash(filePath) + "index.html"; } ,readFileError: function(err,res,filePath) { res.setHeader("content-type",this.getMimeType("html")); if(err.code == "ENOENT") { res.statusCode = 404; var rel = js_node_Path.relative(this.dir,filePath); res.end("File " + rel + " not found."); } else { res.statusCode = 500; res.end("Error getting the file: " + Std.string(err) + "."); } } ,serveMedia: function(req,res,filePath) { if(!js_node_Fs.existsSync(filePath)) { return false; } var videoSize = js_node_Fs.statSync(filePath).size; if(Object.prototype.hasOwnProperty.call(this.uploadingFilesSizes.h,filePath)) { videoSize = this.uploadingFilesSizes.h[filePath]; } var rangeHeader = req.headers["range"]; if(rangeHeader == null) { res.statusCode = 200; res.setHeader("content-length","" + videoSize); var videoStream = js_node_Fs.createReadStream(filePath); videoStream.pipe(res); res.on("error",function() { return videoStream.destroy(); }); res.on("close",function() { return videoStream.destroy(); }); return true; } var range = this.parseRangeHeader(rangeHeader,videoSize); var start = range.start; var end = range.end; var contentLength = end - start + 1; res.setHeader("content-range","bytes " + start + "-" + end + "/" + videoSize); res.setHeader("content-length","" + contentLength); res.statusCode = 206; var buffer = this.uploadingFilesLastChunks.h[filePath]; if(buffer != null && end == videoSize - 1 && contentLength < buffer.byteLength) { var a = buffer.byteLength - contentLength; res.end(buffer.slice(a < 0 ? 0 : a)); return true; } var videoStream1 = js_node_Fs.createReadStream(filePath,{ start : start, end : end}); videoStream1.pipe(res); res.on("error",function() { return videoStream1.destroy(); }); res.on("close",function() { return videoStream1.destroy(); }); return true; } ,parseRangeHeader: function(rangeHeader,videoSize) { var ranges = new EReg("[-=]","g").split(rangeHeader); var start = Std.parseInt(ranges[1]); if(server_Utils.isOutOfRange(start,0,videoSize - 1)) { start = 0; } var end = Std.parseInt(ranges[2]); if(end == null) { end = start + this.CHUNK_SIZE; } if(server_Utils.isOutOfRange(end,start,videoSize - 1)) { var a = videoSize - 1; end = a < 0 ? 0 : a; } return { start : start, end : end}; } ,isMediaExtension: function(ext) { switch(ext) { case "mp3":case "mp4":case "ogg":case "wav":case "webm": return true; default: return false; } } ,localizeHtml: function(data,lang) { if(data.indexOf("") == -1) { return data; } if(lang != null && this.matchLang.match(lang)) { lang = this.matchLang.matched(0); } else { lang = "en"; } data = this.matchVarString.map(data,function(regExp) { var key = regExp.matched(1); return Lang.get(lang,key); }); return data; } ,proxyUrl: function(req,res) { var _gthis = this; var url = StringTools.replace(req.url,"/proxy?url=",""); var proxy = this.proxyRequest(url,req,res,function(proxyRes) { var tmp = proxyRes.headers["location"]; if(tmp == null) { return false; } var proxy2 = _gthis.proxyRequest(tmp,req,res,function(proxyRes) { return false; }); if(proxy2 == null) { if(!res.headersSent) { res.end("Proxy error: multiple redirects for url " + tmp); } return true; } req.pipe(proxy2); req.on("error",function() { return proxy2.destroy(); }); return true; }); if(proxy == null) { return false; } req.pipe(proxy); req.on("error",function() { return proxy.destroy(); }); return true; } ,proxyRequest: function(url,req,res,cancelProxyRequest) { var url1; try { url1 = new js_node_url_URL(this.safeDecodeURI(url)); } catch( _g ) { return null; } if(url1.host == req.headers["host"]) { return null; } var options = { host : url1.hostname, port : Std.parseInt(url1.port), path : url1.pathname + url1.search, method : req.method}; req.headers["referer"] = url1.toString(); req.headers["host"] = url1.hostname; var request = url1.protocol == "https:" ? js_node_Https.request : js_node_Http.request; var proxy = request(options,function(proxyRes) { if(cancelProxyRequest(proxyRes)) { proxyRes.destroy(); return; } proxyRes.headers["content-type"] = "application/octet-stream"; res.writeHead(proxyRes.statusCode,proxyRes.headers); proxyRes.pipe(res); proxyRes.on("end",function() { if(!res.writableEnded) { res.end(); } }); }); proxy.on("error",function(err) { proxy.destroy(); if(!res.headersSent) { res.end("Proxy error: " + url1.href); } }); res.on("close",function() { if(!proxy.destroyed) { proxy.destroy(); } }); return proxy; } ,isChildOf: function(parent,child) { var rel = js_node_Path.relative(parent,child); if(rel.length > 0 && !StringTools.startsWith(rel,"..")) { return !js_node_Path.isAbsolute(rel); } else { return false; } } ,getMimeType: function(ext) { var tmp = server_HttpServer.mimeTypes.h[ext]; if(tmp != null) { return tmp; } else { return "application/octet-stream"; } } ,safeDecodeURI: function(data) { try { data = decodeURI(data); } catch( _g ) { data = ""; } data = data.replace(this.ctrlCharacters.r,""); return data; } ,__class__: server_HttpServer }; var server_Logger = function(folder,maxCount,verbose) { this.matchFileFormat = new EReg("[0-9_-]+\\.json$",""); this.logs = []; this.folder = folder; this.maxCount = maxCount; this.verbose = verbose; }; server_Logger.__name__ = true; server_Logger.prototype = { log: function(event) { this.logs.push(event); if(this.logs.length > 1000) { this.logs.shift(); } if(this.hasSameLatestEvents("GetTime",5)) { this.logs.splice(this.logs.length - 3,1); } } ,hasSameLatestEvents: function(type,count) { if(this.logs.length < count) { return false; } var _g = 1; var _g1 = count + 1; while(_g < _g1) if(this.logs[this.logs.length - _g++].event.type != type) { return false; } return true; } ,saveLog: function() { if(this.logs.length == 0) { return; } server_Utils.ensureDir(this.folder); this.removeOldestLog(); var name = DateTools.format(new Date(),"%Y-%m-%d_%H_%M_%S"); js_node_Fs.writeFileSync("" + this.folder + "/" + name + ".json",server_Main.jsonStringify(this.getLogs(),"\t")); } ,getLogs: function() { return this.logs; } ,removeOldestLog: function() { var _gthis = this; var _this = js_node_Fs.readdirSync(this.folder); var _g = []; var _g1 = 0; while(_g1 < _this.length) { var v = _this[_g1]; ++_g1; if(sys_FileSystem.isDirectory("" + _gthis.folder + "/" + v) ? false : StringTools.startsWith(v,".") ? false : StringTools.endsWith(v,".json")) { _g.push(v); } } if(Lambda.count(_g,function(item) { return _gthis.matchFileFormat.match(item); }) < this.maxCount) { return; } var minDate = 0.0; var fileName = null; var _g1 = 0; while(_g1 < _g.length) { var name = _g[_g1]; ++_g1; var date = this.extractFileDate(name).getTime(); if(minDate == 0 || minDate > date) { minDate = date; fileName = name; } } if(fileName == null) { return; } js_node_Fs.unlinkSync("" + this.folder + "/" + fileName); } ,extractFileDate: function(name) { name = haxe_io_Path.withoutExtension(name); var t = name.split("_"); var d = t.shift().split("-"); if(d.length != 3 && t.length != 3) { return new Date(0); } return HxOverrides.strDate("" + d[0] + "-" + d[1] + "-" + d[2] + " " + t[0] + ":" + t[1] + ":" + t[2]); } ,__class__: server_Logger }; var server_Main = function(opts) { this.loadedClientsCount = 0; this.matchGuestName = new EReg("guest [0-9]+",""); this.matchHtmlChars = new EReg("[&^<>'\"]",""); this.isServerPause = false; this.flashbacks = []; this.messages = []; this.videoTimer = new server_VideoTimer(); this.videoList = new VideoList(); this.wsEventParser = new JsonParser_$5f812affc76e9ba3f21130cdbd3b05d9(); this.freeIds = []; this.clients = []; this.playersCacheSupport = ["RawType"]; this.rootDir = "" + __dirname + "/.."; var _gthis = this; this.isNoState = !opts.loadState; var args = server_Utils.parseArgs(process.argv.slice(2),false); this.verbose = Object.prototype.hasOwnProperty.call(args.h,"verbose"); this.userDir = "" + this.rootDir + "/user"; this.statePath = "" + this.userDir + "/state.json"; this.logsDir = "" + this.userDir + "/logs"; this.cacheDir = "" + this.userDir + "/res/cache"; process.on("SIGINT",$bind(this,this.exit)); process.on("SIGUSR1",$bind(this,this.exit)); process.on("SIGUSR2",$bind(this,this.exit)); process.on("SIGTERM",$bind(this,this.exit)); process.on("uncaughtException",function(err) { _gthis.logError("uncaughtException",{ message : err.message, stack : err.stack}); _gthis.exit(); }); process.on("unhandledRejection",function(err,promise) { if(((err) instanceof Error)) { _gthis.logError("unhandledRejection",{ message : err.message, stack : err.stack}); } else { _gthis.logError("unhandledRejection","" + Std.string(err)); } _gthis.exit(); }); this.config = this.loadUserConfig(); this.config.serverVersion = 2; this.config.isVerbose = this.verbose; this.userList = this.loadUsers(); this.config.salt = this.generateConfigSalt(this.userList); this.logger = new server_Logger(this.logsDir,10,this.verbose); this.consoleInput = new server_ConsoleInput(this); this.consoleInput.initConsoleInput(); this.cache = new server_cache_Cache(this,this.cacheDir); if(this.cache.isYtReady) { this.playersCacheSupport.push("YoutubeType"); } this.initIntergationHandlers(); this.loadState(); this.cache.setStorageLimit(this.config.cacheStorageLimitGiB * 1024 * 1024 * 1024); if(this.config.localNetworkOnly) { this.localIp = "127.0.0.1"; } else { this.localIp = server_Utils.getLocalIp(); } this.globalIp = this.localIp; this.port = this.config.port; var envPort = process.env.PORT; if(envPort != null) { this.port = envPort; } var argPort = args.h["port"]; if(argPort != null) { var newPort = Std.parseInt(argPort); if(newPort != null) { this.port = newPort; } } var attempts = this.isNoState ? 500 : 5; var preparePort = null; preparePort = function() { server_Utils.isPortFree(_gthis.port,function(isFree) { if(!isFree && attempts > 0) { haxe_Log.trace("Warning: port " + _gthis.port + " is already in use. Changed to " + (_gthis.port + 1),{ fileName : "src/server/Main.hx", lineNumber : 157, className : "server.Main", methodName : "new"}); attempts -= 1; _gthis.port++; preparePort(); return; } _gthis.runServer(); }); }; preparePort(); }; server_Main.__name__ = true; server_Main.main = function() { new server_Main({ loadState : true}); }; server_Main.jsonStringify = function(data,space) { return JSON.stringify(data,server_Main.jsonFilterNulls,space); }; server_Main.jsonFilterNulls = function(key,value) { if(value == null) { return undefined; } return value; }; server_Main.prototype = { isDefaultPort: function() { if(this.port != 80) { return this.port == 443; } else { return true; } } ,getPort: function(protocol) { if(!this.isDefaultPort()) { return this.port; } switch(protocol) { case "http": return 80; case "https": return 443; default: return 80; } } ,runServer: function() { var _gthis = this; var ssl = this.getSslConfig(this.config); var protocol = ssl == null ? "http" : "https"; var port = this.getPort(protocol); var colonPort = this.isDefaultPort() ? "" : ":" + port; haxe_Log.trace("Local: " + protocol + "://" + this.localIp + colonPort,{ fileName : "src/server/Main.hx", lineNumber : 187, className : "server.Main", methodName : "runServer"}); if(this.config.localNetworkOnly) { haxe_Log.trace("Global network is disabled in config",{ fileName : "src/server/Main.hx", lineNumber : 189, className : "server.Main", methodName : "runServer"}); } else if(!this.isNoState) { server_Utils.getGlobalIp(function(ip) { if(ip.indexOf(":") != -1) { ip = "[" + ip + "]"; } _gthis.globalIp = ip; haxe_Log.trace("Global: " + protocol + "://" + _gthis.globalIp + colonPort,{ fileName : "src/server/Main.hx", lineNumber : 195, className : "server.Main", methodName : "runServer"}); }); } var dir = "" + this.rootDir + "/res"; var httpServer = new server_HttpServer(this,new server__$HttpServer_HttpServerConfig(dir,"" + this.userDir + "/res",this.config.localAdmins,this.cache)); Lang.init("" + dir + "/langs"); var server; if(ssl == null) { server = js_node_Http.createServer($bind(httpServer,httpServer.serveFiles)); } else { if(this.isDefaultPort()) { try { var redirectHttpServer = js_node_Http.createServer(function(req,res) { var tmp = req.headers["host"]; var location = "https://" + (tmp != null ? tmp : "") + req.url; res.writeHead(302,{ "location" : location}); res.end(); }); redirectHttpServer.listen(80); } catch( _g ) { var _g1 = haxe_Exception.caught(_g); haxe_Log.trace("Cannot run http server on port 80 for https redirects:",{ fileName : "src/server/Main.hx", lineNumber : 221, className : "server.Main", methodName : "runServer", customParams : [_g1]}); } } server = js_node_Https.createServer({ key : ssl.key, cert : ssl.cert},$bind(httpServer,httpServer.serveFiles)); } this.wss = new js_npm_ws_Server({ server : server}); this.wss.on("connection",$bind(this,this.onConnect)); if(this.config.localNetworkOnly) { server.listen(port,this.localIp,$bind(this,this.onServerInited)); } else { server.listen(port,$bind(this,this.onServerInited)); } new haxe_Timer(25000).run = function() { var _g = 0; var _g1 = _gthis.clients; while(_g < _g1.length) { var client = _g1[_g]; ++_g; if(client.isAlive) { client.isAlive = false; client.ws.ping(); continue; } client.ws.terminate(); } }; } ,getSslConfig: function(config) { if(config.sslKeyPemPath.length == 0 && config.sslCertPemPath.length == 0) { return null; } if(sys_FileSystem.exists(config.sslKeyPemPath) && sys_FileSystem.exists(config.sslCertPemPath)) { var key = js_node_Fs.readFileSync(config.sslKeyPemPath,{ encoding : "utf8"}); var cert = js_node_Fs.readFileSync(config.sslCertPemPath,{ encoding : "utf8"}); return { key : key, cert : cert}; } if(!sys_FileSystem.exists(config.sslKeyPemPath)) { haxe_Log.trace("sslKeyPemPath: absolute file path not found: " + config.sslKeyPemPath,{ fileName : "src/server/Main.hx", lineNumber : 259, className : "server.Main", methodName : "getSslConfig"}); } if(!sys_FileSystem.exists(config.sslCertPemPath)) { haxe_Log.trace("sslCertPemPath: absolute file path not found: " + config.sslCertPemPath,{ fileName : "src/server/Main.hx", lineNumber : 261, className : "server.Main", methodName : "getSslConfig"}); } return null; } ,onServerInited: function() { } ,exit: function() { this.saveState(); this.logger.saveLog(); process.exit(); } ,generateConfigSalt: function(users) { users.salt = users.salt != null ? users.salt : haxe_crypto_Sha256.encode("" + Math.random()); return users.salt; } ,loadUserConfig: function() { var config = this.getUserConfig(); var groups = ["guest","user","leader","admin"]; var _g = 0; while(_g < groups.length) { var field = groups[_g]; ++_g; var group = Reflect.field(config.permissions,field); var _g1 = 0; while(_g1 < groups.length) { var type = groups[_g1]; ++_g1; if(type == field) { continue; } if(group.indexOf(type) == -1) { continue; } HxOverrides.remove(group,type); var _g2 = 0; var _g3 = Reflect.field(config.permissions,type); while(_g2 < _g3.length) group.push(_g3[_g2++]); } } return config; } ,getUserConfig: function() { var config = JSON.parse(js_node_Fs.readFileSync("" + this.rootDir + "/default-config.json",{ encoding : "utf8"})); if(this.isNoState) { return config; } var customPath = "" + this.userDir + "/config.json"; if(!sys_FileSystem.exists(customPath)) { return config; } var customConfig = JSON.parse(js_node_Fs.readFileSync(customPath,{ encoding : "utf8"})); var _g = 0; var _g1 = Reflect.fields(customConfig); while(_g < _g1.length) { var field = _g1[_g]; ++_g; if(Reflect.field(config,field) == null) { haxe_Log.trace("Warning: config field \"" + field + "\" is unknown",{ fileName : "src/server/Main.hx", lineNumber : 306, className : "server.Main", methodName : "getUserConfig"}); } config[field] = Reflect.field(customConfig,field); } var emoteCopies_h = Object.create(null); var _g = 0; var _g1 = config.emotes; while(_g < _g1.length) { var emote = _g1[_g]; ++_g; if(emoteCopies_h[emote.name]) { haxe_Log.trace("Warning: emote name \"" + emote.name + "\" has copy",{ fileName : "src/server/Main.hx", lineNumber : 312, className : "server.Main", methodName : "getUserConfig"}); } emoteCopies_h[emote.name] = true; if(!this.verbose) { continue; } if(emoteCopies_h[emote.image]) { haxe_Log.trace("Warning: emote url of name \"" + emote.name + "\" has copy",{ fileName : "src/server/Main.hx", lineNumber : 316, className : "server.Main", methodName : "getUserConfig"}); } emoteCopies_h[emote.image] = true; } return config; } ,loadUsers: function() { var customPath = "" + this.userDir + "/users.json"; if(this.isNoState || !sys_FileSystem.exists(customPath)) { return { admins : [], bans : []}; } var users = JSON.parse(js_node_Fs.readFileSync(customPath,{ encoding : "utf8"})); users.admins = users.admins != null ? users.admins : []; users.bans = users.bans != null ? users.bans : []; var _g = 0; var _g1 = users.bans; while(_g < _g1.length) { var field = _g1[_g]; ++_g; field.toDate = HxOverrides.strDate(field.toDate); } return users; } ,writeUsers: function(users) { server_Utils.ensureDir(this.userDir); var users1 = users.admins; var _g = []; var _g1 = 0; var _g2 = users.bans; while(_g1 < _g2.length) { var field = _g2[_g1]; ++_g1; _g.push({ ip : field.ip, toDate : HxOverrides.dateStr(field.toDate)}); } js_node_Fs.writeFileSync("" + this.userDir + "/users.json",JSON.stringify({ admins : users1, bans : _g, salt : users.salt},null,"\t")); } ,saveState: function() { haxe_Log.trace("Saving state...",{ fileName : "src/server/Main.hx", lineNumber : 354, className : "server.Main", methodName : "saveState"}); var json = JSON.stringify(this.getCurrentState(),null,"\t"); js_node_Fs.writeFileSync(this.statePath,json); this.writeUsers(this.userList); } ,getCurrentState: function() { return { videoList : this.videoList.items, isPlaylistOpen : this.videoList.isOpen, itemPos : this.videoList.pos, messages : this.messages, timer : { time : this.videoTimer.getTime(), paused : this.videoTimer.isPaused()}, flashbacks : this.flashbacks, cachedFiles : this.cache.getCachedFiles()}; } ,loadState: function() { if(this.isNoState) { return; } if(!sys_FileSystem.exists(this.statePath)) { return; } haxe_Log.trace("Loading state...",{ fileName : "src/server/Main.hx", lineNumber : 378, className : "server.Main", methodName : "loadState"}); var state = JSON.parse(js_node_Fs.readFileSync(this.statePath,{ encoding : "utf8"})); state.flashbacks = state.flashbacks != null ? state.flashbacks : []; state.cachedFiles = state.cachedFiles != null ? state.cachedFiles : []; this.videoList.setItems(state.videoList); this.videoList.isOpen = state.isPlaylistOpen; this.videoList.setPos(state.itemPos); this.messages.length = 0; var _g = 0; var _g1 = state.messages; while(_g < _g1.length) this.messages.push(_g1[_g++]); this.flashbacks.length = 0; var _g = 0; var _g1 = state.flashbacks; while(_g < _g1.length) this.flashbacks.push(_g1[_g++]); this.cache.setCachedFiles(state.cachedFiles); this.videoTimer.start(); this.videoTimer.setTime(state.timer.time); this.videoTimer.pause(); } ,logError: function(type,data) { this.cache.removeOlderCache(1048576); haxe_Log.trace(type,{ fileName : "src/server/Main.hx", lineNumber : 402, className : "server.Main", methodName : "logError", customParams : [data]}); var crashesFolder = "" + this.userDir + "/crashes"; server_Utils.ensureDir(crashesFolder); var name = DateTools.format(new Date(),"%Y-%m-%d_%H_%M_%S") + "-" + type; js_node_Fs.writeFileSync("" + crashesFolder + "/" + name + ".json",JSON.stringify(data,null,"\t")); } ,initIntergationHandlers: function() { var _gthis = this; var url; var tmp = process.env["APP_URL"]; if(tmp != null) { url = tmp; } else { return; } if(!StringTools.startsWith(url,"http")) { url = "http://" + url; } new haxe_Timer(600000).run = function() { if(_gthis.clients.length == 0) { return; } haxe_Log.trace("Ping " + url,{ fileName : "src/server/Main.hx", lineNumber : 415, className : "server.Main", methodName : "initIntergationHandlers"}); js_node_Http.get(url,null,function(r) { }); }; } ,clientIp: function(req) { if(this.config.allowProxyIps) { var forwarded = req.headers["x-forwarded-for"]; if(forwarded == null || forwarded.length == 0) { return req.socket.remoteAddress; } return StringTools.trim(forwarded.split(",")[0]); } return req.socket.remoteAddress; } ,addAdmin: function(name,password) { password += this.config.salt; var hash = haxe_crypto_Sha256.encode(password); this.userList.admins.push({ name : name, hash : hash}); haxe_Log.trace("Admin " + name + " added.",{ fileName : "src/server/Main.hx", lineNumber : 436, className : "server.Main", methodName : "addAdmin"}); } ,removeAdmin: function(name) { HxOverrides.remove(this.userList.admins,Lambda.find(this.userList.admins,function(item) { return item.name == name; })); haxe_Log.trace("Admin " + name + " removed.",{ fileName : "src/server/Main.hx", lineNumber : 443, className : "server.Main", methodName : "removeAdmin"}); } ,hasAdmins: function() { return this.userList.admins.length > 0; } ,replayLog: function(events) { var _gthis = this; var timer = new haxe_Timer(1000); timer.run = function() { if(events.length == 0) { timer.stop(); return; } var e = events.shift(); switch(e.event.type) { case "Connected": if(ClientTools.getByName(_gthis.clients,e.clientName) == null) { var ws = { send : function() { return; }}; var client = new Client(ws,null,_gthis.freeIds.length > 0 ? _gthis.freeIds.shift() : _gthis.clients.length,e.clientName,e.clientGroup); ws.ping = function() { return client.isAlive = true; }; _gthis.clients.push(client); } _gthis.onMessage(ClientTools.getByName(_gthis.clients,e.clientName),e.event,true); break; case "Login": var name = e.event.login.clientName; if(e.event.login.passHash != null && !Lambda.exists(_gthis.userList.admins,function(a) { return a.name == name; })) { e.event.login.passHash = null; } _gthis.onMessage(ClientTools.getByName(_gthis.clients,e.clientName),e.event,true); break; default: _gthis.onMessage(ClientTools.getByName(_gthis.clients,e.clientName),e.event,true); } }; } ,randomUuid: function() { return js_node_Crypto.randomUUID(); } ,getUrlUuid: function(link) { try { if(StringTools.startsWith(link,"/")) { link = "http://127.0.0.1" + link; } return new js_node_url_URL(link).searchParams.get("uuid"); } catch( _g ) { return null; } } ,onConnect: function(ws,req) { var _gthis = this; var uuid; var tmp = this.getUrlUuid(req.url); uuid = tmp != null ? tmp : this.randomUuid(); var oldClient = Lambda.find(this.clients,function(client) { return client.uuid == uuid; }); if(oldClient != null) { this.send(oldClient,{ type : "KickClient"}); this.onMessage(oldClient,{ type : "Disconnected"},true); } var ip = this.clientIp(req); var id = this.freeIds.length > 0 ? this.freeIds.shift() : this.clients.length; var name = "Guest " + (id + 1); haxe_Log.trace(HxOverrides.dateStr(new Date()),{ fileName : "src/server/Main.hx", lineNumber : 506, className : "server.Main", methodName : "onConnect", customParams : ["" + name + " connected (" + ip + ")"]}); var isAdmin = this.config.localAdmins && req.socket.localAddress == ip; var client = new Client(ws,req,id,name,0); client.uuid = uuid; client.setGroupFlag(ClientGroup.Admin,isAdmin); this.clients.push(client); ws.on("pong",function() { return client.isAlive = true; }); this.onMessage(client,{ type : "Connected"},true); ws.on("message",function(data) { var obj = _gthis.wsEventParser.fromJson(data.toString()); if(_gthis.wsEventParser.errors.length > 0 || _gthis.noTypeObj(obj)) { var errors = "" + ("Wrong request for type \"" + obj.type + "\":") + "\n" + json2object_ErrorUtils.convertErrorArray(_gthis.wsEventParser.errors); haxe_Log.trace(errors,{ fileName : "src/server/Main.hx", lineNumber : 523, className : "server.Main", methodName : "onConnect"}); _gthis.serverMessage(client,errors); return; } _gthis.onMessage(client,obj,false); }); ws.on("close",function(err) { _gthis.onMessage(client,{ type : "Disconnected"},true); }); } ,noTypeObj: function(data) { if(data.type == "GetTime") { return false; } if(data.type == "Flashback") { return false; } if(data.type == "TogglePlaylistLock") { return false; } if(data.type == "UpdatePlaylist") { return false; } if(data.type == "Logout") { return false; } if(data.type == "Dump") { return false; } var t = data.type; return ((Reflect.field(data,t.charAt(0).toLowerCase() + HxOverrides.substr(t,1,null))) === null); } ,onMessage: function(client,data,internal) { var _gthis = this; this.logger.log({ clientName : client.name, clientGroup : client.group, event : data, time : HxOverrides.dateStr(new Date())}); switch(data.type) { case "AddVideo": if(this.isPlaylistLockedFor(client)) { return; } if(!this.checkPermission(client,"addVideo")) { return; } if(this.config.totalVideoLimit != 0 && this.videoList.items.length >= this.config.totalVideoLimit) { this.serverMessage(client,"totalVideoLimitError"); return; } if(this.config.userVideoLimit != 0 && (client.group & 8) == 0 && this.videoList.itemsByUser(client) >= this.config.userVideoLimit) { this.serverMessage(client,"videoLimitPerUserError"); return; } if(!data.addVideo.atEnd && !this.checkPermission(client,"changeOrder")) { data.addVideo.atEnd = true; } var item = data.addVideo.item; item.author = client.name; var localIpPort = "" + this.localIp + ":" + this.port; if(item.url.indexOf(localIpPort) != -1) { var newUrl = StringTools.replace(item.url,localIpPort,"" + this.globalIp + ":" + this.port); item = _$Types_VideoItemTools.withUrl(item,newUrl); } if(this.videoList.exists(function(i) { return i.url == item.url; })) { this.serverMessage(client,"videoAlreadyExistsError"); return; } if(!item.doCache) { data.addVideo.item = item; _gthis.videoList.addItem(item,data.addVideo.atEnd); _gthis.broadcast(data); if(_gthis.videoList.items.length == 1) { _gthis.restartWaitTimer(); } } else { var _g = item.playerType; switch(_g) { case "RawType": this.cache.cacheRawVideo(client,item.url,function(name) { item = _$Types_VideoItemTools.withUrl(item,_gthis.cache.getFileUrl(name)); data.addVideo.item = item; _gthis.videoList.addItem(item,data.addVideo.atEnd); _gthis.broadcast(data); if(_gthis.videoList.items.length == 1) { _gthis.restartWaitTimer(); } }); break; case "YoutubeType": this.cache.cacheYoutubeVideo(client,item.url,function(name) { item = _$Types_VideoItemTools.withUrl(item,_gthis.cache.getFileUrl(name)); if(item.duration > 1) { item.duration -= 1; } data.addVideo.item = item; _gthis.videoList.addItem(item,data.addVideo.atEnd); _gthis.broadcast(data); if(_gthis.videoList.items.length == 1) { _gthis.restartWaitTimer(); } }); break; default: var name = StringTools.replace("" + _g,"Type",""); this.serverMessage(client,"No cache support for " + name + " player."); data.addVideo.item = item; _gthis.videoList.addItem(item,data.addVideo.atEnd); _gthis.broadcast(data); if(_gthis.videoList.items.length == 1) { _gthis.restartWaitTimer(); } } } break; case "BanClient": if(!this.checkPermission(client,"banClient")) { return; } var name = data.banClient.name; var tmp = ClientTools.getByName(this.clients,name); if(tmp == null) { return; } if(client.name == name || (tmp.group & 8) != 0) { this.serverMessage(client,"adminsCannotBeBannedError"); return; } var ip = this.clientIp(tmp.req); HxOverrides.remove(this.userList.bans,Lambda.find(this.userList.bans,function(item) { return item.ip == ip; })); if(data.banClient.time == 0) { tmp.setGroupFlag(ClientGroup.Banned,false); this.sendClientList(); return; } var currentTime = new Date().getTime(); var time = currentTime + data.banClient.time * 1000; if(time < currentTime) { return; } this.userList.bans.push({ ip : ip, toDate : new Date(time)}); this.checkBan(tmp); this.serverMessage(client,"" + tmp.name + " (" + ip + ") has been banned."); this.sendClientList(); break; case "ClearChat": if(!this.checkPermission(client,"clearChat")) { return; } this.messages.length = 0; this.broadcast(data); break; case "ClearPlaylist": if(this.isPlaylistLockedFor(client)) { return; } if(!this.checkPermission(client,"removeVideo")) { return; } if(this.videoList.items.length != 0) { if(this.videoTimer.getTime() > 30) { var _this = this.videoList; this.saveFlashbackTime(_this.items[_this.pos]); } } this.videoTimer.stop(); var _this = this.videoList; _this.items.length = 0; _this.pos = 0; this.broadcast(data); break; case "Connected": if(!internal) { return; } var tmp = this.emptyRoomCallbackTimer; if(tmp != null) { tmp.stop(); } if(this.clients.length == 1 && this.videoList.items.length > 0) { if(!this.isServerPause) { if(this.videoTimer.isPaused()) { this.videoTimer.play(); } } } this.checkBan(client); this.send(client,{ type : "Connected", connected : { uuid : client.uuid, config : { channelName : this.config.channelName, emotes : this.config.emotes, filters : this.config.filters, isVerbose : this.config.isVerbose, maxLoginLength : this.config.maxLoginLength, maxMessageLength : this.config.maxMessageLength, permissions : this.config.permissions, port : this.config.port, requestLeaderOnPause : this.config.requestLeaderOnPause, salt : this.config.salt, serverVersion : this.config.serverVersion, templateUrl : this.config.templateUrl, totalVideoLimit : this.config.totalVideoLimit, unpauseWithoutLeader : this.config.unpauseWithoutLeader, userVideoLimit : this.config.userVideoLimit, youtubeApiKey : this.config.youtubeApiKey, youtubePlaylistLimit : this.config.youtubePlaylistLimit}, history : this.messages, isUnknownClient : true, clientName : client.name, clients : this.clientList(), videoList : this.videoList.items, isPlaylistOpen : this.videoList.isOpen, itemPos : this.videoList.pos, globalIp : this.globalIp, playersCacheSupport : this.playersCacheSupport}}); this.sendClientListExcept(client); break; case "CrashTest": if((client.group & 8) == 0) { return; } haxe_Log.trace("Crashing...",{ fileName : "src/server/Main.hx", lineNumber : 1043, className : "server.Main", methodName : "onMessage"}); null[1]++; break; case "Disconnected": if(!internal) { return; } haxe_Log.trace(HxOverrides.dateStr(new Date()),{ fileName : "src/server/Main.hx", lineNumber : 588, className : "server.Main", methodName : "onMessage", customParams : ["Client " + client.name + " disconnected"]}); server_Utils.sortedPush(this.freeIds,client.id); HxOverrides.remove(this.clients,client); this.sendClientList(); if((client.group & 4) != 0) { if(this.videoList.items.length > 0) { this.videoTimer.pause(); this.isServerPause = true; } } if(this.clients.length == 0) { var tmp = this.emptyRoomCallbackTimer; if(tmp != null) { tmp.stop(); } this.emptyRoomCallbackTimer = haxe_Timer.delay(function() { if(_gthis.clients.length > 0) { return; } var tmp = _gthis.waitVideoStart; if(tmp != null) { tmp.stop(); } _gthis.videoTimer.pause(); },5000); } haxe_Timer.delay(function() { if(Lambda.exists(_gthis.clients,function(i) { return i.name == client.name; })) { return; } _gthis.broadcast({ type : "ServerMessage", serverMessage : { textId : "" + client.name + " has left"}}); },5000); break; case "Dump": if((client.group & 8) == 0) { return; } var data1 = this.getCurrentState(); var _this = this.clients; var result = new Array(_this.length); var _g = 0; var _g1 = _this.length; while(_g < _g1) { var i = _g++; var client1 = _this[i]; result[i] = { name : client1.name, id : client1.id, ip : _gthis.clientIp(client1.req), isBanned : (client1.group & 1) != 0, isAdmin : (client1.group & 8) != 0, isLeader : (client1.group & 4) != 0, isUser : (client1.group & 2) != 0}; } var json = server_Main.jsonStringify({ state : data1, clients : result, logs : this.logger.getLogs()},"\t"); this.serverMessage(client,"Free space: " + tools_MathTools.toFixed(this.cache.getFreeSpace() / 1024) + "KiB"); this.serverMessage(client,"Memory usage: " + Std.string(process.memoryUsage())); this.send(client,{ type : "Dump", dump : { data : json}}); break; case "Flashback": if(this.videoList.items.length == 0) { return; } if(!this.checkPermission(client,"rewind")) { return; } var _this = this.videoList; this.loadFlashbackTime(_this.items[_this.pos]); this.broadcast({ type : "Rewind", rewind : { time : this.videoTimer.getTime()}}); break; case "GetTime": if(this.videoList.items.length == 0) { return; } var _this = this.videoList; var maxTime = _this.items[_this.pos].duration - 0.01; if(this.videoTimer.getTime() > maxTime) { this.videoTimer.pause(); this.videoTimer.setTime(maxTime); var _this = this.videoList; var skipUrl = _this.items[_this.pos].url; haxe_Timer.delay(function() { _gthis.skipVideo({ type : "SkipVideo", skipVideo : { url : skipUrl}}); },1000); return; } var obj = { type : "GetTime", getTime : { time : tools_MathTools.toFixed(this.videoTimer.getTime())}}; if(this.videoTimer.isPaused()) { obj.getTime.paused = true; } if(this.isServerPause) { obj.getTime.pausedByServer = true; } if(this.videoTimer.getRate() != 1) { if(!ClientTools.hasLeader(this.clients)) { this.videoTimer.setRate(1); } else { obj.getTime.rate = this.videoTimer.getRate(); } } this.send(client,obj); break; case "KickClient": if(!this.checkPermission(client,"banClient")) { return; } var name = data.kickClient.name; var tmp = ClientTools.getByName(this.clients,name); if(tmp == null) { return; } if(client.name != name && (tmp.group & 8) != 0) { this.serverMessage(client,"adminsCannotBeBannedError"); return; } this.send(tmp,{ type : "KickClient"}); break; case "Login": var name = StringTools.trim(data.login.clientName); var lcName = name.toLowerCase(); if(this.isBadClientName(lcName)) { this.serverMessage(client,"usernameError"); this.send(client,{ type : "LoginError"}); return; } var hash = data.login.passHash; if(hash == null) { if(Lambda.exists(this.userList.admins,function(a) { return a.name.toLowerCase() == lcName; })) { this.send(client,{ type : "PasswordRequest"}); return; } } else if(Lambda.exists(this.userList.admins,function(a) { if(a.name.toLowerCase() == lcName) { return a.hash == hash; } else { return false; } })) { client.setGroupFlag(ClientGroup.Admin,true); } else { this.serverMessage(client,"passwordMatchError"); this.send(client,{ type : "LoginError"}); return; } haxe_Log.trace(HxOverrides.dateStr(new Date()),{ fileName : "src/server/Main.hx", lineNumber : 679, className : "server.Main", methodName : "onMessage", customParams : ["Client " + client.name + " logged as " + name]}); client.name = name; client.setGroupFlag(ClientGroup.User,true); this.checkBan(client); this.send(client,{ type : data.type, login : { isUnknownClient : true, clientName : client.name, clients : this.clientList()}}); this.sendClientListExcept(client); break; case "LoginError": break; case "Logout": var oldName = client.name; client.name = "Guest " + (this.clients.indexOf(client) + 1); client.setGroupFlag(ClientGroup.User,false); haxe_Log.trace(HxOverrides.dateStr(new Date()),{ fileName : "src/server/Main.hx", lineNumber : 700, className : "server.Main", methodName : "onMessage", customParams : ["Client " + oldName + " logout to " + client.name]}); this.send(client,{ type : data.type, logout : { oldClientName : oldName, clientName : client.name, clients : this.clientList()}}); this.sendClientListExcept(client); break; case "Message": if(!this.checkPermission(client,"writeChat")) { return; } var text = StringTools.trim(data.message.text); if(text.length == 0) { return; } if(text.length > this.config.maxMessageLength) { text = HxOverrides.substr(text,0,this.config.maxMessageLength); } data.message.text = text; data.message.clientName = client.name; var date = new Date(); var time = HxOverrides.dateStr(new Date(date.getTime() + date.getTimezoneOffset() * 60 * 1000)); this.messages.push({ text : text, name : client.name, time : time}); if(this.messages.length > this.config.serverChatHistory) { this.messages.shift(); } this.broadcast(data); break; case "PasswordRequest": break; case "Pause": if(this.videoList.items.length == 0) { return; } if((client.group & 4) == 0) { return; } if(Math.abs(data.pause.time - this.videoTimer.getTime()) > 30) { var _this = this.videoList; this.saveFlashbackTime(_this.items[_this.pos]); } this.videoTimer.setTime(data.pause.time); this.videoTimer.pause(); this.broadcast({ type : data.type, pause : data.pause}); break; case "Play": if(this.videoList.items.length == 0) { return; } if((client.group & 4) == 0) { return; } if(Math.abs(data.play.time - this.videoTimer.getTime()) > 30) { var _this = this.videoList; this.saveFlashbackTime(_this.items[_this.pos]); } this.videoTimer.setTime(data.play.time); this.isServerPause = false; this.videoTimer.play(); this.broadcast({ type : data.type, play : data.play}); break; case "PlayItem": if(!this.checkPermission(client,"changeOrder")) { return; } var pos = data.playItem.pos; if(!this.videoList.hasItem(pos)) { return; } if(this.videoTimer.getTime() > 30) { var _this = this.videoList; this.saveFlashbackTime(_this.items[_this.pos]); } this.videoList.setPos(pos); data.playItem.pos = this.videoList.pos; this.restartWaitTimer(); this.broadcast(data); break; case "Progress": break; case "RemoveVideo": if(this.videoList.items.length == 0) { return; } if(this.isPlaylistLockedFor(client)) { return; } if(!this.checkPermission(client,"removeVideo")) { return; } var url = data.removeVideo.url; var index = this.videoList.findIndex(function(item) { return item.url == url; }); if(index == -1) { return; } var _this = this.videoList; var isCurrent = _this.items[_this.pos].url == url; if(isCurrent && this.videoTimer.getTime() > 30) { var _this = this.videoList; this.saveFlashbackTime(_this.items[_this.pos]); } this.videoList.removeItem(index); this.broadcast(data); if(isCurrent && this.videoList.items.length > 0) { this.restartWaitTimer(); } break; case "Rewind": if(this.videoList.items.length == 0) { return; } if(!this.checkPermission(client,"rewind")) { return; } data.rewind.time += this.videoTimer.getTime(); if(data.rewind.time < 0) { data.rewind.time = 0; } var _this = this.videoList; this.saveFlashbackTime(_this.items[_this.pos]); this.videoTimer.setTime(data.rewind.time); this.broadcast({ type : data.type, rewind : data.rewind}); break; case "ServerMessage": break; case "SetLeader": var clientName = data.setLeader.clientName; if(client.name == clientName) { if(!this.checkPermission(client,"requestLeader")) { return; } } else if((client.group & 4) == 0 && clientName != "") { if(!this.checkPermission(client,"setLeader")) { return; } } this.isServerPause = false; ClientTools.setLeader(this.clients,clientName); this.broadcast({ type : "SetLeader", setLeader : { clientName : clientName}}); if(this.videoList.items.length == 0) { return; } if(!ClientTools.hasLeader(this.clients)) { if(this.videoTimer.isPaused()) { this.videoTimer.play(); } this.videoTimer.setRate(1); this.broadcast({ type : "Play", play : { time : this.videoTimer.getTime()}}); } break; case "SetNextItem": if(this.isPlaylistLockedFor(client)) { return; } if(!this.checkPermission(client,"changeOrder")) { return; } var pos = data.setNextItem.pos; if(!this.videoList.hasItem(pos)) { return; } if(pos == this.videoList.pos || pos == this.videoList.pos + 1) { return; } this.videoList.setNextItem(pos); this.broadcast(data); break; case "SetRate": if(this.videoList.items.length == 0) { return; } if((client.group & 4) == 0) { return; } this.videoTimer.setRate(data.setRate.rate); this.broadcastExcept(client,{ type : data.type, setRate : data.setRate}); break; case "SetTime": if(this.videoList.items.length == 0) { return; } if((client.group & 4) == 0) { return; } if(Math.abs(data.setTime.time - this.videoTimer.getTime()) > 30) { var _this = this.videoList; this.saveFlashbackTime(_this.items[_this.pos]); } this.videoTimer.setTime(data.setTime.time); this.broadcastExcept(client,{ type : data.type, setTime : data.setTime}); break; case "ShufflePlaylist": if(this.videoList.items.length == 0) { return; } if(this.isPlaylistLockedFor(client)) { return; } if(!this.checkPermission(client,"changeOrder")) { return; } this.videoList.shuffle(); this.broadcast({ type : "UpdatePlaylist", updatePlaylist : { videoList : this.videoList.items}}); break; case "SkipVideo": if(!this.checkPermission(client,"removeVideo")) { return; } this.skipVideo(data); break; case "ToggleItemType": if(this.isPlaylistLockedFor(client)) { return; } if(!this.checkPermission(client,"toggleItemType")) { return; } var pos = data.toggleItemType.pos; if(!this.videoList.hasItem(pos)) { return; } this.videoList.toggleItemType(pos); this.broadcast(data); break; case "TogglePlaylistLock": if(!this.checkPermission(client,"lockPlaylist")) { return; } this.videoList.isOpen = !this.videoList.isOpen; this.broadcast({ type : "TogglePlaylistLock", togglePlaylistLock : { isOpen : this.videoList.isOpen}}); break; case "UpdateClients": this.sendClientList(); break; case "UpdatePlaylist": this.broadcast({ type : "UpdatePlaylist", updatePlaylist : { videoList : this.videoList.items}}); break; case "VideoLoaded": if(this.isServerPause) { return; } this.prepareVideoPlayback(); break; } } ,clientList: function() { var _g = []; var _g1 = 0; var _g2 = this.clients; while(_g1 < _g2.length) _g.push(_g2[_g1++].getData()); return _g; } ,sendClientList: function() { this.broadcast({ type : "UpdateClients", updateClients : { clients : this.clientList()}}); } ,sendClientListExcept: function(skipped) { this.broadcastExcept(skipped,{ type : "UpdateClients", updateClients : { clients : this.clientList()}}); } ,serverMessage: function(client,textId) { this.send(client,{ type : "ServerMessage", serverMessage : { textId : textId}}); } ,send: function(client,data) { client.ws.send(server_Main.jsonStringify(data),null); } ,sendByName: function(clientName,data) { var tmp = ClientTools.getByName(this.clients,clientName); if(tmp == null) { return; } tmp.ws.send(server_Main.jsonStringify(data),null); } ,broadcast: function(data) { var json = server_Main.jsonStringify(data); var _g = 0; var _g1 = this.clients; while(_g < _g1.length) _g1[_g++].ws.send(json,null); } ,broadcastExcept: function(skipped,data) { var json = server_Main.jsonStringify(data); var _g = 0; var _g1 = this.clients; while(_g < _g1.length) { var client = _g1[_g]; ++_g; if(client == skipped) { continue; } client.ws.send(json,null); } } ,skipVideo: function(data) { if(this.videoList.items.length == 0) { return; } var _this = this.videoList; if(_this.items[_this.pos].url != data.skipVideo.url) { return; } var _this = this.videoList; var dur = _this.items[_this.pos].duration; if(this.videoTimer.getTime() > 30 && this.videoTimer.getTime() < dur - 30) { var _this = this.videoList; this.saveFlashbackTime(_this.items[_this.pos]); } this.videoList.skipItem(); if(this.videoList.items.length > 0) { this.restartWaitTimer(); } this.broadcast(data); } ,checkPermission: function(client,perm) { if((client.group & 1) != 0) { this.checkBan(client); } var state = client.hasPermission(perm,this.config.permissions); if(!state) { this.serverMessage(client,"accessError|" + perm); } return state; } ,checkBan: function(client) { if((client.group & 8) != 0) { client.setGroupFlag(ClientGroup.Banned,false); return; } var ip = this.clientIp(client.req); var currentTime = new Date().getTime(); var arr = this.userList.bans; var _g_i = arr.length - 1; while(_g_i > -1) { var ban = arr[_g_i--]; if(ban.ip != ip) { continue; } var isOutdated = ban.toDate.getTime() < currentTime; client.setGroupFlag(ClientGroup.Banned,!isOutdated); if(isOutdated) { HxOverrides.remove(this.userList.bans,ban); haxe_Log.trace("" + client.name + " ban removed",{ fileName : "src/server/Main.hx", lineNumber : 1152, className : "server.Main", methodName : "checkBan"}); this.sendClientList(); } break; } } ,isBadClientName: function(name) { if(name.length > this.config.maxLoginLength) { return true; } if(name.length == 0) { return true; } if(this.matchHtmlChars.match(name)) { return true; } if(this.matchGuestName.match(name)) { return true; } if(Lambda.exists(this.clients,function(i) { return i.name.toLowerCase() == name; })) { return true; } return false; } ,restartWaitTimer: function() { this.videoTimer.stop(); var tmp = this.waitVideoStart; if(tmp != null) { tmp.stop(); } this.waitVideoStart = haxe_Timer.delay($bind(this,this.startVideoPlayback),3000); } ,prepareVideoPlayback: function() { if(this.videoTimer.isStarted) { return; } this.loadedClientsCount++; if(this.loadedClientsCount == 1) { this.restartWaitTimer(); } if(this.loadedClientsCount >= this.clients.length) { this.startVideoPlayback(); } } ,startVideoPlayback: function() { var tmp = this.waitVideoStart; if(tmp != null) { tmp.stop(); } this.loadedClientsCount = 0; this.broadcast({ type : "VideoLoaded"}); this.isServerPause = false; this.videoTimer.start(); } ,saveFlashbackTime: function(item) { var url = item.url; var duration = item.duration; var time = this.videoTimer.getTime(); if(Math.abs(this.findFlashbackTime(url,duration) - time) < 30) { return; } this.addRecentFlashback(url,duration,time); } ,loadFlashbackTime: function(item) { var url = item.url; var duration = item.duration; var time = this.videoTimer.getTime(); var flashbackTime = this.findFlashbackTime(url,duration); this.videoTimer.setTime(flashbackTime); this.addRecentFlashback(url,duration,time); } ,findFlashbackTime: function(url,duration) { var tmp = this.findFlashbackItem(url,duration); var tmp1 = tmp != null ? tmp.time : null; if(tmp1 != null) { return tmp1; } else { return 0.0; } } ,findFlashbackItem: function(url,duration) { var item = Lambda.find(this.flashbacks,function(item) { return item.url == url; }); if(duration != null && item == null) { item = Lambda.find(this.flashbacks,function(item) { return item.duration == duration; }); } return item; } ,addRecentFlashback: function(url,duration,time) { HxOverrides.remove(this.flashbacks,this.findFlashbackItem(url)); this.flashbacks.unshift({ url : url, duration : duration, time : time}); while(this.flashbacks.length > 50) this.flashbacks.pop(); } ,isPlaylistLockedFor: function(client) { if(!this.videoList.isOpen) { if(!this.checkPermission(client,"lockPlaylist")) { return true; } } return false; } ,hasPlaylistUrl: function(url) { return this.videoList.exists(function(item) { return item.url == url; }); } ,__class__: server_Main }; var server_Utils = function() { }; server_Utils.__name__ = true; server_Utils.parseArgs = function(args,caseSensitive) { if(caseSensitive == null) { caseSensitive = true; } var map = new haxe_ds_StringMap(); var _g = 0; while(_g < args.length) { var arg = args[_g]; ++_g; if(arg.length == 0) { continue; } if(arg.charCodeAt(0) == 45) { arg = HxOverrides.substr(arg,arg.charCodeAt(1) == 45 ? 2 : 1,null); } var delimiterPos = arg.indexOf("="); if(delimiterPos < 1) { map.h[caseSensitive ? arg : arg.toLowerCase()] = ""; continue; } var key = HxOverrides.substr(arg,0,delimiterPos); if(!caseSensitive) { key = key.toLowerCase(); } map.h[key] = HxOverrides.substr(arg,delimiterPos + 1,null); } return map; }; server_Utils.ensureDir = function(path) { if(!sys_FileSystem.exists(path)) { sys_FileSystem.createDirectory(path); } }; server_Utils.isPortFree = function(port,callback) { var server = js_node_Http.createServer(); var timeout = 1000; var status = false; server.setTimeout(timeout); server.once("error",function(err) { status = false; server.close(); }); server.once("timeout",function() { status = false; haxe_Log.trace("Timeout (" + timeout + "ms) occurred waiting for port " + port + " to be available",{ fileName : "src/server/Utils.hx", lineNumber : 47, className : "server.Utils", methodName : "isPortFree"}); server.close(); }); server.once("listening",function() { status = true; server.close(); }); server.once("close",function() { callback(status); }); server.listen(port); }; server_Utils.getGlobalIp = function(callback) { var onError = function(e) { haxe_Log.trace("Warning: connection error, server is local.",{ fileName : "src/server/Utils.hx", lineNumber : 60, className : "server.Utils", methodName : "getGlobalIp"}); callback("127.0.0.1"); }; var url = new js_node_url_URL("https://myexternalip.com/raw"); js_node_Https.get({ timeout : 5000, protocol : url.protocol, host : url.host, path : url.pathname},function(r) { r.setEncoding("utf8"); var data_b = ""; r.on("data",function(chunk) { data_b += Std.string(chunk); }); r.on("end",function() { callback(data_b); }); }).on("error",onError).on("timeout",onError); }; server_Utils.getLocalIp = function() { var ifaces = js_node_Os.networkInterfaces(); var _g = 0; var _g1 = Reflect.fields(ifaces); while(_g < _g1.length) { var type = Reflect.field(ifaces,_g1[_g++]); var _g2 = 0; var _g3 = Reflect.fields(type); while(_g2 < _g3.length) { var iface = Reflect.field(type,_g3[_g2++]); if("IPv4" != iface.family || iface.internal != false) { continue; } return iface.address; } } return "127.0.0.1"; }; server_Utils.isOutOfRange = function(value,min,max) { if(!(value == null || value < min)) { return value > max; } else { return true; } }; server_Utils.sortedPush = function(ids,id) { var _g_current = 0; while(_g_current < ids.length) if(id < ids[_g_current++]) { ids.splice(_g_current - 1,0,id); return; } ids.push(id); }; var server_VideoTimer = function() { this.rate = 1.0; this.rateStartTime = 0.0; this.pauseStartTime = 0.0; this.startTime = 0.0; this.isStarted = false; }; server_VideoTimer.__name__ = true; server_VideoTimer.prototype = { start: function() { this.isStarted = true; var hrtime = process.hrtime(); this.startTime = hrtime[0] + hrtime[1] / 1e9; this.pauseStartTime = 0; var hrtime = process.hrtime(); this.rateStartTime = hrtime[0] + hrtime[1] / 1e9; } ,stop: function() { this.isStarted = false; this.startTime = 0; this.pauseStartTime = 0; } ,pause: function() { if(this.isPaused()) { return; } this.updatePauseTime(); } ,updatePauseTime: function() { this.startTime += this.rateTime() - this.rateTime() * this.rate; var hrtime = process.hrtime(); this.pauseStartTime = hrtime[0] + hrtime[1] / 1e9; this.rateStartTime = 0; } ,play: function() { if(!this.isStarted) { this.start(); } this.startTime += this.pauseTime(); this.pauseStartTime = 0; var hrtime = process.hrtime(); this.rateStartTime = hrtime[0] + hrtime[1] / 1e9; } ,getTime: function() { if(this.startTime == 0) { return 0; } var hrtime = process.hrtime(); return hrtime[0] + hrtime[1] / 1e9 - this.startTime - this.rateTime() + this.rateTime() * this.rate - this.pauseTime(); } ,setTime: function(secs) { var hrtime = process.hrtime(); this.startTime = hrtime[0] + hrtime[1] / 1e9 - secs; var hrtime = process.hrtime(); this.rateStartTime = hrtime[0] + hrtime[1] / 1e9; if(this.isPaused()) { this.updatePauseTime(); } } ,isPaused: function() { if(this.isStarted) { return this.pauseStartTime != 0; } else { return true; } } ,getRate: function() { return this.rate; } ,setRate: function(rate) { if(!this.isPaused()) { this.startTime += this.rateTime() - this.rateTime() * this.rate; var hrtime = process.hrtime(); this.rateStartTime = hrtime[0] + hrtime[1] / 1e9; } this.rate = rate; } ,pauseTime: function() { if(this.pauseStartTime == 0) { return 0; } var hrtime = process.hrtime(); return hrtime[0] + hrtime[1] / 1e9 - this.pauseStartTime; } ,rateTime: function() { if(this.rateStartTime == 0) { return 0; } var hrtime = process.hrtime(); return hrtime[0] + hrtime[1] / 1e9 - this.rateStartTime - this.pauseTime(); } ,__class__: server_VideoTimer }; var server_cache_Cache = function(main,cacheDir) { this.cachedFiles = []; this.freeSpaceBlock = 10485760; this.storageLimit = 3145728 * 1024; this.isYtReady = false; this.notEnoughSpaceErrorText = "Error: Not enough free space on server or file size is out of cache storage limit."; this.main = main; this.cacheDir = cacheDir; server_Utils.ensureDir(cacheDir); this.youtubeCache = new server_cache_YoutubeCache(main,this); this.rawCache = new server_cache_RawCache(main,this); this.isYtReady = this.youtubeCache.checkYtDeps(); if(this.isYtReady) { this.youtubeCache.cleanYtInputFiles(); this.youtubeCache.checkUpdate(); } }; server_cache_Cache.__name__ = true; server_cache_Cache.prototype = { getCachedFiles: function() { return this.cachedFiles; } ,setCachedFiles: function(names) { this.cachedFiles.length = 0; var _g = 0; while(_g < names.length) this.cachedFiles.push(names[_g++]); this.removeUntrackedFiles(); } ,removeUntrackedFiles: function() { var names = js_node_Fs.readdirSync(this.cacheDir); var _g = 0; while(_g < names.length) { var name = names[_g]; ++_g; if(StringTools.startsWith(name,".")) { continue; } if(sys_FileSystem.isDirectory("" + this.cacheDir + "/" + name)) { continue; } if(this.cachedFiles.indexOf(name) != -1) { continue; } haxe_Log.trace("Remove untracked cache " + name,{ fileName : "src/server/cache/Cache.hx", lineNumber : 54, className : "server.cache.Cache", methodName : "removeUntrackedFiles"}); this.remove(name); } } ,log: function(client,msg) { haxe_Log.trace(msg,{ fileName : "src/server/cache/Cache.hx", lineNumber : 60, className : "server.cache.Cache", methodName : "log"}); this.main.serverMessage(client,msg); } ,logByName: function(clientName,msg) { haxe_Log.trace(msg,{ fileName : "src/server/cache/Cache.hx", lineNumber : 65, className : "server.cache.Cache", methodName : "logByName"}); var tmp = ClientTools.getByName(this.main.clients,clientName); if(tmp == null) { return; } this.main.serverMessage(tmp,msg); } ,logWithAdmins: function(client,msg) { this.log(client,msg); var _this = this.main.clients; var _g = []; var _g1 = 0; while(_g1 < _this.length) { var v = _this[_g1]; ++_g1; if((v.group & 8) != 0) { _g.push(v); } } var _g1 = 0; while(_g1 < _g.length) { var admin = _g[_g1]; ++_g1; if(client != admin) { this.main.serverMessage(admin,msg); } } } ,cacheYoutubeVideo: function(client,url,callback) { this.youtubeCache.cacheYoutubeVideo(client,url,callback); } ,cacheRawVideo: function(client,url,callback) { this.rawCache.cacheRawVideo(client,url,callback); } ,setStorageLimit: function(bytes) { var _gthis = this; this.storageLimit = bytes; var a = this.storageLimit; this.storageLimit = a < 0 ? 0 : a; this.getFreeDiskSpace(function(availSpace) { var a = availSpace - _gthis.freeSpaceBlock; var availSpace = a < 0 ? 0 : a; _gthis.removeOlderCache(); var freeSpace = _gthis.getFreeSpace(); if(availSpace < freeSpace) { var a = _gthis.storageLimit += availSpace - freeSpace; _gthis.storageLimit = a < 0 ? 0 : a; _gthis.removeOlderCache(); } }); } ,getFreeDiskSpace: function(callback) { var _gthis = this; var tmp = js_node_Fs.statfs; if(tmp == null) { haxe_Log.trace("Warning: no fs.statfs support in current nodejs version (needs v18+)",{ fileName : "src/server/cache/Cache.hx", lineNumber : 104, className : "server.cache.Cache", methodName : "getFreeDiskSpace"}); callback(this.storageLimit); return; } tmp("/",function(err,stats) { if(err != null) { haxe_Log.trace(err,{ fileName : "src/server/cache/Cache.hx", lineNumber : 110, className : "server.cache.Cache", methodName : "getFreeDiskSpace"}); callback(_gthis.storageLimit); return; } callback(stats.bsize * stats.bavail); }); } ,add: function(name) { if(this.cachedFiles.indexOf(name) == -1) { this.cachedFiles.unshift(name); } } ,remove: function(name) { HxOverrides.remove(this.cachedFiles,name); this.removeFile(name); } ,exists: function(name) { if(this.cachedFiles.indexOf(name) != -1) { return this.isFileExists(name); } else { return false; } } ,removeOlderCache: function(addFileSize) { if(addFileSize == null) { addFileSize = 0; } var space = this.getUsedSpace(addFileSize); var arr = this.cachedFiles; var _g_i = arr.length - 1; while(_g_i > -1) { var name = arr[_g_i--]; if(space <= this.storageLimit) { break; } if(this.main.hasPlaylistUrl(this.getFileUrl(name))) { continue; } this.remove(name); space = this.getUsedSpace(addFileSize); } return space < this.storageLimit; } ,removeFile: function(name) { var path = this.getFilePath(name); if(sys_FileSystem.exists(path)) { js_node_Fs.unlinkSync(path); } } ,getFreeFileName: function(fullName) { if(fullName == null) { fullName = "video.mp4"; } var baseName = haxe_io_Path.withoutDirectory(haxe_io_Path.withoutExtension(fullName)); var ext = haxe_io_Path.extension(fullName); var i = 1; while(true) { var name = "" + baseName + (i == 1 ? "" : "" + i) + "." + ext; if(!this.isFileExists(name)) { return name; } ++i; } } ,getFilePath: function(name) { return "" + this.cacheDir + "/" + name; } ,getFileUrl: function(name) { return "/" + haxe_io_Path.withoutDirectory(this.cacheDir) + "/" + name; } ,isFileExists: function(name) { return sys_FileSystem.exists(this.getFilePath(name)); } ,findFile: function(callback) { var names = js_node_Fs.readdirSync(this.cacheDir); var _g = 0; while(_g < names.length) { var name = names[_g]; ++_g; if(callback(name)) { return name; } } return null; } ,getFreeSpace: function() { return this.storageLimit - this.getUsedSpace(); } ,getUsedSpace: function(addFileSize) { if(addFileSize == null) { addFileSize = 0; } var total = addFileSize < 0 ? 0 : addFileSize; var arr = this.cachedFiles; var _g_i = arr.length - 1; while(_g_i > -1) { var name = arr[_g_i--]; var path = this.getFilePath(name); if(!sys_FileSystem.exists(path)) { HxOverrides.remove(this.cachedFiles,name); continue; } total += js_node_Fs.statSync(path).size; } return total; } ,__class__: server_cache_Cache }; var server_cache_RawCache = function(main,cache) { this.main = main; this.cache = cache; }; server_cache_RawCache.__name__ = true; server_cache_RawCache.prototype = { cacheRawVideo: function(client,url,callback) { var isM3U8 = url.indexOf(".m3u8") != -1; var ext = isM3U8 ? "m3u8" : "mp4"; var matchName = new EReg("^([^:.]+)\\.(.+)",""); var decodedUrl; try { decodedUrl = decodeURIComponent(url.split("+").join(" ")); } catch( _g ) { decodedUrl = url; } var outName = matchName.match(HxOverrides.substr(decodedUrl,decodedUrl.lastIndexOf("/") + 1,null)) ? matchName.matched(1) + ("." + ext) : "video." + ext; outName = this.cache.getFreeFileName(outName); if(this.cache.exists(outName)) { callback(outName); return; } haxe_Log.trace("Caching " + url + " to " + outName + "...",{ fileName : "src/server/cache/RawCache.hx", lineNumber : 46, className : "server.cache.RawCache", methodName : "cacheRawVideo"}); this.main.send(client,{ type : "Progress", progress : { type : "Caching", ratio : 0, data : outName}}); if(isM3U8) { this.handleM3u8(client,url,outName,callback); } else { this.handleMp4(client,url,outName,callback); } } ,handleMp4: function(client,url,outName,callback) { var _gthis = this; var clientName = client.name; this.downloadFile(client,url,outName,function(downloaded,total) { var v = downloaded / total; _gthis.main.sendByName(clientName,{ type : "Progress", progress : { type : "Downloading", ratio : tools_MathTools.toFixed(v < 0 ? 0 : v > 1 ? 1 : v,4)}}); },function() { _gthis.cache.add(outName); callback(outName); },function(err) { _gthis.log(clientName,"Mp4 download failed: " + err); _gthis.cancelProgress(clientName); }); } ,handleM3u8: function(client,url,outName,callback) { var _gthis = this; var clientName = client.name; var useProxy = true; this.downloadM3u8Playlist(client,url,useProxy,function(playlist,totalSize,segments) { if(useProxy) { totalSize = playlist.length; } if(!_gthis.cache.removeOlderCache(totalSize + _gthis.cache.freeSpaceBlock)) { _gthis.log(clientName,_gthis.cache.notEnoughSpaceErrorText); _gthis.cancelProgress(clientName); return; } if(useProxy) { _gthis.main.sendByName(clientName,{ type : "Progress", progress : { type : "Caching", ratio : 1, data : outName}}); js_node_Fs.writeFileSync("" + _gthis.cache.cacheDir + "/" + outName,playlist); _gthis.cache.add(outName); callback(outName); return; } var activeDownloads = 0; var maxParallelDownloads = 10; var downloaded = 0; var downloadNextBatch = null; downloadNextBatch = function() { var _g = 0; while(_g < segments.length) { var segment = [segments[_g]]; ++_g; if(activeDownloads >= maxParallelDownloads) { break; } if(segment[0].started) { continue; } segment[0].started = true; activeDownloads += 1; haxe_Log.trace("download segment",{ fileName : "src/server/cache/RawCache.hx", lineNumber : 120, className : "server.cache.RawCache", methodName : "handleM3u8", customParams : [segment[0].i]}); _gthis.downloadFile(client,segment[0].url,segment[0].name,(function() { return function(downloadedBytes,totalBytes) { }; })(),(function(segment) { return function() { activeDownloads -= 1; segment[0].completed = true; downloaded += 1; var progress = downloaded / segments.length; _gthis.main.sendByName(clientName,{ type : "Progress", progress : { type : "Downloading", ratio : progress < 0 ? 0 : progress > 1 ? 1 : progress}}); if(downloaded == segments.length) { haxe_Log.trace("All " + downloaded + "/" + segments.length + " segments downloaded",{ fileName : "src/server/cache/RawCache.hx", lineNumber : 140, className : "server.cache.RawCache", methodName : "handleM3u8"}); js_node_Fs.writeFileSync("" + _gthis.cache.cacheDir + "/" + outName,playlist); _gthis.cache.add(outName); callback(outName); } else { downloadNextBatch(); } }; })(segment),(function(segment) { return function(err) { activeDownloads -= 1; downloaded += 1; _gthis.log(clientName,"TS segment " + segment[0].i + " download failed: " + err); _gthis.cancelProgress(clientName); var _gthis1 = _gthis; var result = new Array(segments.length); var _g = 0; var _g1 = segments.length; while(_g < _g1) { var i = _g++; result[i] = segments[i].name; } _gthis1.cleanupFiles(result); }; })(segment)); } }; downloadNextBatch(); },function(err) { _gthis.log(clientName,"M3U8 processing failed: " + err); _gthis.cancelProgress(clientName); }); } ,request: function(url,options,callback) { var httpsOptions = options != null ? options : { }; httpsOptions.rejectUnauthorized = false; httpsOptions.headers = httpsOptions.headers != null ? httpsOptions.headers : { }; if(StringTools.startsWith(url,"https:")) { return js_node_Https.request(url,httpsOptions,callback); } else { return js_node_Http.request(url,httpsOptions,callback); } } ,downloadM3u8Playlist: function(client,url,useProxy,onSuccess,onError) { var _gthis = this; var req = this.request(url,{ headers : { "User-Agent" : "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36", "Accept" : "*/*"}},function(res) { if(res.statusCode >= 300 && res.statusCode < 400) { var redirectUrl = res.headers["location"]; if(redirectUrl != null) { _gthis.downloadM3u8Playlist(client,redirectUrl,useProxy,onSuccess,onError); return; } } var body = []; res.on("data",function(chunk) { return body.push(chunk); }); res.on("end",function() { try { var buffer = js_node_buffer_Buffer.concat(body); var content = buffer.toString(); if(!new EReg("^#EXTM3U","").match(content)) { onError("Invalid M3U8 playlist"); return; } var baseUrl = url.substring(0,url.lastIndexOf("/") + 1); var segments = []; var lines = content.split("\n"); var _g_current = 0; var _g_array = lines; while(_g_current < _g_array.length) { var _g_value = _g_array[_g_current++]; var _g_key = _g_current - 1; var line = StringTools.trim(_g_value); if(line.length == 0) { continue; } if(StringTools.startsWith(line,"#")) { continue; } var segmentUrl = line.indexOf("://") == -1 ? baseUrl + line : line; var i = segments.length; var segment = { i : i, url : segmentUrl, started : false, completed : false, name : "segment" + i + ".ts"}; segments.push(segment); lines[_g_key] = "./" + segment.name; if(useProxy) { lines[_g_key] = "/proxy?url=" + segmentUrl; } } var req = _gthis.request(segments[0].url,{ method : "GET"},function(res) { var tmp = Std.parseInt(res.headers["content-length"]); var totalSize = (tmp != null ? tmp : 0) * (segments.length + 1); if(totalSize == 0) { onError("Failed to get segment sizes: no content-length"); return; } onSuccess(lines.join("\n"),totalSize,segments); }); req.on("error",function(err) { onError("Request error: failed to get segment sizes"); }); req.end(); } catch( _g ) { var _g1 = haxe_Exception.caught(_g); onError("Playlist processing error: " + Std.string(_g1)); } }); }); req.on("error",onError); req.end(); } ,downloadFile: function(client,url,fileName,onProgress,onComplete,onError) { var file = js_node_Fs.createWriteStream("" + this.cache.cacheDir + "/" + fileName); var req = this.request(url,{ method : "GET", headers : { "User-Agent" : "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537." + Std.random(100), "Accept" : "*/*"}},function(res) { var total; var tmp = Std.parseInt(res.headers["content-length"]); total = tmp != null ? tmp : 0; var downloaded = 0; res.on("data",function(chunk) { downloaded += chunk.length; onProgress(downloaded,total); if(!file.write(chunk)) { res.pause(); file.once("drain",function() { return res.resume(); }); } }); res.on("end",function() { file.end(); }); res.on("error",function(err) { file.destroy(); onError("Response error: " + err); }); }); file.on("finish",onComplete); file.on("error",function(err) { req.destroy(); onError("File error: " + err); }); req.on("error",function(err) { file.destroy(); onError("Request failed: " + err); }); req.end(); } ,cleanupFiles: function(files) { var _g = 0; while(_g < files.length) { var file = files[_g]; ++_g; if(sys_FileSystem.exists(file)) { js_node_Fs.unlinkSync(file); } } } ,log: function(clientName,msg) { this.cache.logByName(clientName,msg); } ,cancelProgress: function(clientName) { this.main.sendByName(clientName,{ type : "Progress", progress : { type : "Canceled", ratio : 0}}); } ,__class__: server_cache_RawCache }; var server_cache_YoutubeCache = function(main,cache) { this.main = main; this.cache = cache; }; server_cache_YoutubeCache.__name__ = true; server_cache_YoutubeCache.prototype = { checkYtDeps: function() { try { js_node_ChildProcess.execSync("ffmpeg -version",{ stdio : "ignore", timeout : 5000}); this.ytDlp = new (require('ytdlp-nodejs')).YtDlp(); return true; } catch( _g ) { return false; } } ,checkUpdate: function() { this.ytDlp.execAsync("",{ updateTo : this.main.config.ytDlp.channel, onData : function(d) { haxe_Log.trace(d,{ fileName : "src/server/cache/YoutubeCache.hx", lineNumber : 36, className : "server.cache.YoutubeCache", methodName : "checkUpdate"}); }}).catch(function(e) { haxe_Log.trace(e,{ fileName : "src/server/cache/YoutubeCache.hx", lineNumber : 39, className : "server.cache.YoutubeCache", methodName : "checkUpdate"}); }); } ,cleanYtInputFiles: function(prefix) { if(prefix == null) { prefix = "__tmp"; } var names = js_node_Fs.readdirSync(this.cache.cacheDir); var _g = 0; while(_g < names.length) { var name = names[_g]; ++_g; if(!StringTools.startsWith(name,prefix)) { continue; } this.cache.remove(name); } } ,cacheYoutubeVideo: function(client,url,callback) { var _gthis = this; if(!this.cache.isYtReady) { haxe_Log.trace("Do `npm i https://github.com/RblSb/ytdlp-nodejs` to use cache feature (you also need to install `ffmpeg` to build mp4 from downloaded audio/video tracks).",{ fileName : "src/server/cache/YoutubeCache.hx", lineNumber : 53, className : "server.cache.YoutubeCache", methodName : "cacheYoutubeVideo"}); return; } var clientName = client.name; var videoId = utils_YoutubeUtils.extractVideoId(url); if(videoId == "") { this.log(clientName,"Error: youtube video id not found in url: " + url); return; } var outName = videoId + ".mp4"; if(this.cache.exists(outName)) { callback(outName); return; } var inVideoName = "__tmp-video-" + videoId; if(this.cache.isFileExists(inVideoName)) { this.log(clientName,"Caching " + outName + " already in progress"); return; } haxe_Log.trace("Caching " + url + " to " + outName + "...",{ fileName : "src/server/cache/YoutubeCache.hx", lineNumber : 85, className : "server.cache.YoutubeCache", methodName : "cacheYoutubeVideo"}); this.main.sendByName(clientName,{ type : "Progress", progress : { type : "Caching", ratio : 0, data : outName}}); var useCookies = false; var onGetInfo = function(info) { haxe_Log.trace("Get info with " + info.formats.length + " formats",{ fileName : "src/server/cache/YoutubeCache.hx", lineNumber : 98, className : "server.cache.YoutubeCache", methodName : "cacheYoutubeVideo"}); var _this = info.formats; var _g = []; var _g1 = 0; while(_g1 < _this.length) { var v = _this[_g1]; ++_g1; var onGetInfo; if(v.acodec != "none" && v.vcodec == "none") { var tmp = v.format_note; onGetInfo = tmp != null ? tmp.indexOf("original") != -1 : null; } else { onGetInfo = false; } if(onGetInfo) { _g.push(v); } } var aformats = _g; if(_g.length == 0) { var _this = info.formats; var _g = []; var _g1 = 0; while(_g1 < _this.length) { var v = _this[_g1]; ++_g1; if(v.acodec != "none" && v.vcodec == "none") { _g.push(v); } } aformats = _g; } if(aformats.length == 0) { var _this = info.formats; var _g = []; var _g1 = 0; while(_g1 < _this.length) { var v = _this[_g1]; ++_g1; if(v.acodec != "none") { _g.push(v); } } aformats = _g; } aformats.sort(function(a,b) { var tmp = a != null ? a.filesize : null; var tmp1 = b != null ? b.filesize : null; if((tmp != null ? tmp : 0) < (tmp1 != null ? tmp1 : 0)) { return 1; } else { return -1; } }); var tmp = aformats[0]; if(tmp == null) { _gthis.log(clientName,"Error: format with audio not found"); var _g = 0; while(_g < aformats.length) haxe_Log.trace(aformats[_g++],{ fileName : "src/server/cache/YoutubeCache.hx", lineNumber : 110, className : "server.cache.YoutubeCache", methodName : "cacheYoutubeVideo"}); return; } var _this = info.formats; var _g = []; var _g1 = 0; while(_g1 < _this.length) { var v = _this[_g1]; ++_g1; if(v.vcodec == "none" ? false : v.width != null && v.height != null) { _g.push(v); } } _g.sort(function(a,b) { var tmp = a != null ? a.filesize : null; var tmp1 = b != null ? b.filesize : null; if((tmp != null ? tmp : 0) < (tmp1 != null ? tmp1 : 0)) { return 1; } else { return -1; } }); var videoFormat; var tmp1 = _gthis.getBestYoutubeVideoFormat(_g); if(tmp1 != null) { videoFormat = tmp1; } else { _gthis.log(clientName,"Error: video format not found"); var _g1 = 0; while(_g1 < _g.length) haxe_Log.trace(_g[_g1++],{ fileName : "src/server/cache/YoutubeCache.hx", lineNumber : 120, className : "server.cache.YoutubeCache", methodName : "cacheYoutubeVideo"}); return; } var ignoreQualities = []; var _g1 = 0; while(_g1 < 3) { ++_g1; var tmp1 = videoFormat.filesize; var tmp2 = tmp.filesize; if(_gthis.cache.removeOlderCache(((tmp1 != null ? tmp1 : 0) + (tmp2 != null ? tmp2 : 0)) * 2 + _gthis.cache.freeSpaceBlock)) { break; } ignoreQualities.push(_gthis.videoFormatResolution(videoFormat)); var tmp3 = _gthis.getBestYoutubeVideoFormat(_g,ignoreQualities); if(tmp3 != null) { videoFormat = tmp3; } else { break; } } var tmp1 = videoFormat.filesize; var tmp2 = tmp.filesize; var hasSpace = _gthis.cache.removeOlderCache(((tmp1 != null ? tmp1 : 0) + (tmp2 != null ? tmp2 : 0)) * 2 + _gthis.cache.freeSpaceBlock); if(!hasSpace) { _gthis.cleanYtInputFiles(inVideoName); _gthis.cancelProgress(clientName); _gthis.log(clientName,_gthis.cache.notEnoughSpaceErrorText); } if(!hasSpace) { return; } var isMuxed = videoFormat.format_id == tmp.format_id; var formatIds = isMuxed ? videoFormat.format_id : "" + videoFormat.format_id + "+" + tmp.format_id; var tmp1 = videoFormat.filesize; var tmp2 = tmp.filesize; var a = (tmp1 != null ? tmp1 : 0) + (tmp2 != null ? tmp2 : 0); var totalSize = a < 10 ? 10 : a; var tmp1 = videoFormat.filesize; var a = tmp1 != null ? tmp1 : 0; var videoSizeRatio = (a < 8 ? 8 : a) / totalSize; var tmp1 = tmp.filesize; var a = tmp1 != null ? tmp1 : 0; var audioSizeRatio = (a < 2 ? 2 : a) / totalSize; if(isMuxed) { videoSizeRatio = 1; audioSizeRatio = 0; } haxe_Log.trace(formatIds,{ fileName : "src/server/cache/YoutubeCache.hx", lineNumber : 153, className : "server.cache.YoutubeCache", methodName : "cacheYoutubeVideo", customParams : ["" + tools_MathTools.toFixed(totalSize / 1024 / 1024) + " MiB",tools_MathTools.toFixed(videoSizeRatio),tools_MathTools.toFixed(audioSizeRatio)]}); var videoRatioCache = 0.0; var audioRatioCache = 0.0; var dlVideo = _gthis.ytDlp.downloadAsync(url,{ format : formatIds, output : "" + _gthis.cache.cacheDir + "/" + inVideoName, remuxVideo : "mp4", additionalOptions : ["--no-js-runtimes","--js-runtimes",_gthis.main.config.ytDlp.jsRuntime], cookies : useCookies ? _gthis.getCookiesPathOrNull() : null, forceIpv4 : true, socketTimeout : 2, extractorRetries : 0, onProgress : function(p) { var isFinished = p.status == "finished"; if(isFinished) { haxe_Log.trace("" + haxe_io_Path.withoutDirectory(p.filename) + " format file downloaded",{ fileName : "src/server/cache/YoutubeCache.hx", lineNumber : 171, className : "server.cache.YoutubeCache", methodName : "cacheYoutubeVideo"}); } var ratio; if(isFinished) { ratio = 1; } else { var v = p.downloaded / p.total; ratio = v < 0 ? 0 : v > 1 ? 1 : v; } if(p.filename.indexOf("f" + videoFormat.format_id) != -1) { videoRatioCache = ratio; } else { audioRatioCache = ratio; } ratio = videoRatioCache * videoSizeRatio + audioRatioCache * audioSizeRatio; _gthis.main.sendByName(clientName,{ type : "Progress", progress : { type : "Downloading", ratio : tools_MathTools.toFixed(ratio,4)}}); }}).catch(function(err) { _gthis.cache.logWithAdmins(client,"Error during video download: " + err); _gthis.cleanYtInputFiles(inVideoName); _gthis.cancelProgress(clientName); }); dlVideo.then(function(v) { var tmp = _gthis.cache.findFile(function(n) { return StringTools.startsWith(n,inVideoName); }); if(tmp == null) { _gthis.cache.logWithAdmins(client,"Error: cannot find downloaded file with prefix " + inVideoName); _gthis.cancelProgress(clientName); return; } js_node_Fs.renameSync("" + _gthis.cache.cacheDir + "/" + tmp,"" + _gthis.cache.cacheDir + "/" + outName); _gthis.cleanYtInputFiles(inVideoName); _gthis.cache.add(outName); callback(outName); }); }; this.getInfoAsync(url,useCookies).then(onGetInfo).catch(function(err) { haxe_Log.trace(err,{ fileName : "src/server/cache/YoutubeCache.hx", lineNumber : 215, className : "server.cache.YoutubeCache", methodName : "cacheYoutubeVideo"}); useCookies = true; return _gthis.getInfoAsync(url,useCookies).then(onGetInfo).catch(function(err) { _gthis.cleanYtInputFiles(inVideoName); _gthis.cancelProgress(clientName); _gthis.log(clientName,"" + err); }); }); } ,getInfoAsync: function(url,useCookies) { if(useCookies == null) { useCookies = false; } return this.ytDlp.getInfoAsync(url,{ cookies : useCookies ? this.getCookiesPathOrNull() : null, additionalOptions : ["--no-js-runtimes","--js-runtimes",this.main.config.ytDlp.jsRuntime]}); } ,getCookiesPathOrNull: function() { var cookiesPath = "" + this.main.userDir + "/cookies.txt"; if(sys_FileSystem.exists(cookiesPath)) { return cookiesPath; } else { return null; } } ,getBestYoutubeVideoFormat: function(formats,ignoreQualities) { var qPriority = [1080,720,480,360,240,144]; if(ignoreQualities != null) { var _g = 0; while(_g < ignoreQualities.length) HxOverrides.remove(qPriority,ignoreQualities[_g++]); } var format60 = this.findVideoFormat(formats,qPriority,true); if(format60 != null) { return format60; } else { return this.findVideoFormat(formats,qPriority,false); } } ,findVideoFormat: function(formats,qPriority,is60fps) { var _g = 0; while(_g < qPriority.length) { var q = qPriority[_g]; ++_g; var quality = "" + q + "p" + (is60fps ? "60" : ""); var _g1 = 0; while(_g1 < formats.length) { var format = formats[_g1]; ++_g1; if(this.videoFormatResolution(format) > q) { continue; } if(this.formatVideoQuality(format) == quality) { return format; } } } return null; } ,videoFormatResolution: function(format) { return Math.min(format.width,format.height) | 0; } ,formatVideoQuality: function(format) { var resolution = this.videoFormatResolution(format); var tmp = format.format_note; if(tmp != null) { return tmp; } else { return "" + resolution + "p"; } } ,log: function(clientName,msg) { this.cache.logByName(clientName,msg); } ,cancelProgress: function(clientName) { this.main.sendByName(clientName,{ type : "Progress", progress : { type : "Canceled", ratio : 0}}); } ,__class__: server_cache_YoutubeCache }; var sys_FileSystem = function() { }; sys_FileSystem.__name__ = true; sys_FileSystem.exists = function(path) { try { js_node_Fs.accessSync(path); return true; } catch( _g ) { return false; } }; sys_FileSystem.isDirectory = function(path) { try { return js_node_Fs.statSync(path).isDirectory(); } catch( _g ) { return false; } }; sys_FileSystem.createDirectory = function(path) { try { js_node_Fs.mkdirSync(path); } catch( _g ) { var _g1 = haxe_Exception.caught(_g).unwrap(); if(_g1.code == "ENOENT") { sys_FileSystem.createDirectory(js_node_Path.dirname(path)); js_node_Fs.mkdirSync(path); } else { var stat; try { stat = js_node_Fs.statSync(path); } catch( _g2 ) { throw _g1; } if(!stat.isDirectory()) { throw _g1; } } } }; var tools_HttpServerTools = function() { }; tools_HttpServerTools.__name__ = true; tools_HttpServerTools.status = function(res,status) { res.statusCode = status; return res; }; tools_HttpServerTools.json = function(res,obj) { res.setHeader("content-type","application/json"); res.end(JSON.stringify(obj)); return res; }; tools_HttpServerTools.redirect = function(res,url) { res.writeHead(302,{ "location" : url}); res.end(); }; var tools_MathTools = function() { }; tools_MathTools.__name__ = true; tools_MathTools.toFixed = function(v,digits) { if(digits == null) { digits = 2; } if(digits > 8) { throw haxe_Exception.thrown("digits is " + digits + ", but cannot be bigger than 8 (for value " + v + ")"); } var ratio = Math.pow(10,digits); return (v * ratio | 0) / ratio; }; var utils_YoutubeUtils = function() { }; utils_YoutubeUtils.__name__ = true; utils_YoutubeUtils.extractVideoId = function(url) { if(utils_YoutubeUtils.matchId.match(url)) { return utils_YoutubeUtils.matchId.matched(1); } if(utils_YoutubeUtils.matchShort.match(url)) { return utils_YoutubeUtils.matchShort.matched(1); } if(utils_YoutubeUtils.matchShorts.match(url)) { return utils_YoutubeUtils.matchShorts.matched(1); } if(utils_YoutubeUtils.matchEmbed.match(url)) { return utils_YoutubeUtils.matchEmbed.matched(1); } return ""; }; function $getIterator(o) { if( o instanceof Array ) return new haxe_iterators_ArrayIterator(o); else return o.iterator(); } function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $global.$haxeUID++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = m.bind(o); o.hx__closures__[m.__id__] = f; } return f; } $global.$haxeUID |= 0; if(typeof(performance) != "undefined" ? typeof(performance.now) == "function" : false) { HxOverrides.now = performance.now.bind(performance); } if( String.fromCodePoint == null ) String.fromCodePoint = function(c) { return c < 0x10000 ? String.fromCharCode(c) : String.fromCharCode((c>>10)+0xD7C0)+String.fromCharCode((c&0x3FF)+0xDC00); } Object.defineProperty(String.prototype,"__class__",{ value : String, enumerable : false, writable : true}); String.__name__ = true; Array.__name__ = true; Date.prototype.__class__ = Date; Date.__name__ = "Date"; var Int = { }; var Dynamic = { }; var Float = Number; var Bool = Boolean; var Class = { }; var Enum = { }; js_Boot.__toStr = ({ }).toString; DateTools.DAY_SHORT_NAMES = ["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]; DateTools.DAY_NAMES = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]; DateTools.MONTH_SHORT_NAMES = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]; DateTools.MONTH_NAMES = ["January","February","March","April","May","June","July","August","September","October","November","December"]; Lang.langs = new haxe_ds_StringMap(); Lang.ids = ["en","ru"]; server_HttpServer.mimeTypes = (function($this) { var $r; var _g = new haxe_ds_StringMap(); _g.h["html"] = "text/html"; _g.h["js"] = "text/javascript"; _g.h["css"] = "text/css"; _g.h["json"] = "application/json"; _g.h["png"] = "image/png"; _g.h["jpg"] = "image/jpeg"; _g.h["jpeg"] = "image/jpeg"; _g.h["gif"] = "image/gif"; _g.h["webp"] = "image/webp"; _g.h["avif"] = "image/avif"; _g.h["svg"] = "image/svg+xml"; _g.h["ico"] = "image/x-icon"; _g.h["wav"] = "audio/wav"; _g.h["mp3"] = "audio/mpeg"; _g.h["ogg"] = "audio/ogg"; _g.h["mp4"] = "video/mp4"; _g.h["webm"] = "video/webm"; _g.h["woff"] = "application/font-woff"; _g.h["ttf"] = "application/font-ttf"; _g.h["eot"] = "application/vnd.ms-fontobject"; _g.h["otf"] = "application/font-otf"; _g.h["wasm"] = "application/wasm"; $r = _g; return $r; }(this)); utils_YoutubeUtils.matchId = new EReg("youtube\\.com.*v=([A-z0-9_-]+)",""); utils_YoutubeUtils.matchShort = new EReg("youtu\\.be/([A-z0-9_-]+)",""); utils_YoutubeUtils.matchShorts = new EReg("youtube\\.com/shorts/([A-z0-9_-]+)",""); utils_YoutubeUtils.matchEmbed = new EReg("youtube\\.com/embed/([A-z0-9_-]+)",""); server_Main.main(); })(typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this);