PageSourceSearch

https://rifftrax.games/Photon2/photon.min.js

js rifftrax.games collected 2026-10-05 02:21:26 UTC 87,395 bytes, 174 lines download raw bytes

1var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;$jscomp.ISOLATE_POLYFILLS=!1;$jscomp.FORCE_POLYFILL_PROMISE=!1;$jscomp.FORCE_POLYFILL_PROMISE_WHEN_NO_UNHANDLED_REJECTION=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(g,d,p){if(g==Array.prototype||g==Object.prototype)return g;g[d]=p.value;return g};
2$jscomp.getGlobal=function(g){g=["object"==typeof globalThis&&globalThis,g,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var d=0;d<g.length;++d){var p=g[d];if(p&&p.Math==Math)return p}throw Error("Cannot find global object");};$jscomp.global=$jscomp.getGlobal(this);$jscomp.IS_SYMBOL_NATIVE="function"===typeof Symbol&&"symbol"===typeof Symbol("x");$jscomp.TRUST_ES6_POLYFILLS=!$jscomp.ISOLATE_POLYFILLS||$jscomp.IS_SYMBOL_NATIVE;$jscomp.polyfills={};
3$jscomp.propertyToPolyfillSymbol={};$jscomp.POLYFILL_PREFIX="$jscp$";var $jscomp$lookupPolyfilledValue=function(g,d){var p=$jscomp.propertyToPolyfillSymbol[d];if(null==p)return g[d];p=g[p];return void 0!==p?p:g[d]};$jscomp.polyfill=function(g,d,p,h){d&&($jscomp.ISOLATE_POLYFILLS?$jscomp.polyfillIsolated(g,d,p,h):$jscomp.polyfillUnisolated(g,d,p,h))};
4$jscomp.polyfillUnisolated=function(g,d,p,h){p=$jscomp.global;g=g.split(".");for(h=0;h<g.length-1;h++){var f=g[h];if(!(f in p))return;p=p[f]}g=g[g.length-1];h=p[g];d=d(h);d!=h&&null!=d&&$jscomp.defineProperty(p,g,{configurable:!0,writable:!0,value:d})};
5$jscomp.polyfillIsolated=function(g,d,p,h){var f=g.split(".");g=1===f.length;h=f[0];h=!g&&h in $jscomp.polyfills?$jscomp.polyfills:$jscomp.global;for(var l=0;l<f.length-1;l++){var n=f[l];if(!(n in h))return;h=h[n]}f=f[f.length-1];p=$jscomp.IS_SYMBOL_NATIVE&&"es6"===p?h[f]:null;d=d(p);null!=d&&(g?$jscomp.defineProperty($jscomp.polyfills,f,{configurable:!0,writable:!0,value:d}):d!==p&&(void 0===$jscomp.propertyToPolyfillSymbol[f]&&($jscomp.propertyToPolyfillSymbol[f]=$jscomp.IS_SYMBOL_NATIVE?$jscomp.global.Symbol(f):
6$jscomp.POLYFILL_PREFIX+f),$jscomp.defineProperty(h,$jscomp.propertyToPolyfillSymbol[f],{configurable:!0,writable:!0,value:d})))};$jscomp.underscoreProtoCanBeSet=function(){var g={a:!0},d={};try{return d.__proto__=g,d.a}catch(p){}return!1};$jscomp.setPrototypeOf=$jscomp.TRUST_ES6_POLYFILLS&&"function"==typeof Object.setPrototypeOf?Object.setPrototypeOf:$jscomp.underscoreProtoCanBeSet()?function(g,d){g.__proto__=d;if(g.__proto__!==d)throw new TypeError(g+" is not extensible");return g}:null;
7$jscomp.polyfill("Object.setPrototypeOf",function(g){return g||$jscomp.setPrototypeOf},"es6","es5");$jscomp.arrayIteratorImpl=function(g){var d=0;return function(){return d<g.length?{done:!1,value:g[d++]}:{done:!0}}};$jscomp.arrayIterator=function(g){return{next:$jscomp.arrayIteratorImpl(g)}};$jscomp.initSymbol=function(){};
8$jscomp.polyfill("Symbol",function(g){if(g)return g;var d=function(f,l){this.$jscomp$symbol$id_=f;$jscomp.defineProperty(this,"description",{configurable:!0,writable:!0,value:l})};d.prototype.toString=function(){return this.$jscomp$symbol$id_};var p=0,h=function(f){if(this instanceof h)throw new TypeError("Symbol is not a constructor");return new d("jscomp_symbol_"+(f||"")+"_"+p++,f)};return h},"es6","es3");
9$jscomp.polyfill("Symbol.iterator",function(g){if(g)return g;g=Symbol("Symbol.iterator");for(var d="Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "),p=0;p<d.length;p++){var h=$jscomp.global[d[p]];"function"===typeof h&&"function"!=typeof h.prototype[g]&&$jscomp.defineProperty(h.prototype,g,{configurable:!0,writable:!0,value:function(){return $jscomp.iteratorPrototype($jscomp.arrayIteratorImpl(this))}})}return g},"es6",
10"es3");$jscomp.iteratorPrototype=function(g){g={next:g};g[Symbol.iterator]=function(){return this};return g};$jscomp.iteratorFromArray=function(g,d){g instanceof String&&(g+="");var p=0,h=!1,f={next:function(){if(!h&&p<g.length){var l=p++;return{value:d(l,g[l]),done:!1}}h=!0;return{done:!0,value:void 0}}};f[Symbol.iterator]=function(){return f};return f};$jscomp.polyfill("Array.prototype.keys",function(g){return g?g:function(){return $jscomp.iteratorFromArray(this,function(d){return d})}},"es6","es3");
11var __extends=this&&this.__extends||function(){var g=function(d,p){g=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(h,f){h.__proto__=f}||function(h,f){for(var l in f)Object.prototype.hasOwnProperty.call(f,l)&&(h[l]=f[l])};return g(d,p)};return function(d,p){function h(){this.constructor=d}if("function"!==typeof p&&null!==p)throw new TypeError("Class extends value "+String(p)+" is not a constructor or null");g(d,p);d.prototype=null===p?Object.create(p):(h.prototype=p.prototype,new h)}}(),
12Photon;
13(function(g){var d;(function(h){h[h.OFF=0]="OFF";h[h.ERROR=1]="ERROR";h[h.WARN=2]="WARN";h[h.INFO=3]="INFO";h[h.DEBUG=4]="DEBUG"})(d=g.LogLevel||(g.LogLevel={}));var p=function(){function h(f,l){void 0===f&&(f="");void 0===l&&(l=d.INFO);this.prefix=f;this.level=l}h.prototype.setPrefix=function(f){this.prefix=f};h.prototype.getPrefix=function(){return this.prefix};h.prototype.setLevel=function(f){f=Math.max(f,d.OFF);this.level=f=Math.min(f,d.DEBUG)};h.setExceptionHandler=function(f){this.exceptionHandler=f};
14h.prototype.isLevelEnabled=function(f){return f<=this.level};h.prototype.getLevel=function(){return this.level};h.prototype.debug=function(f){for(var l=[],n=1;n<arguments.length;n++)l[n-1]=arguments[n];this.log(d.DEBUG,f,l)};h.prototype.info=function(f){for(var l=[],n=1;n<arguments.length;n++)l[n-1]=arguments[n];this.log(d.INFO,f,l)};h.prototype.warn=function(f){for(var l=[],n=1;n<arguments.length;n++)l[n-1]=arguments[n];this.log(d.WARN,f,l)};h.prototype.error=function(f){for(var l=[],n=1;n<arguments.length;n++)l[n-
151]=arguments[n];this.log(d.ERROR,f,l)};h.prototype.exception=function(f,l){for(var n=[],q=2;q<arguments.length;q++)n[q-2]=arguments[q];if(!h.exceptionHandler||!h.exceptionHandler(f,this.format0(l,n)))throw Error(this.format0("["+f+"] "+l,n));};h.prototype.format=function(f){for(var l=[],n=1;n<arguments.length;n++)l[n-1]=arguments[n];return this.format0(f,l)};h.prototype.formatArr=function(f,l){return this.format0(f,l)};h.prototype.log=function(f,l,n){if(f<=this.level&&"undefined"!==typeof console&&
16void 0!==l)try{var q;(q=console.hasOwnProperty(h.log_types[f])?console[h.log_types[f]]:console.log)&&q.apply(console,[this.prefix,l].concat(n))}catch(r){}};h.prototype.format0=function(f,l){return(""==this.prefix?"":this.prefix+" ")+f+" "+l.map(function(n){if(void 0!==n)switch(typeof n){case "object":try{return JSON.stringify(n)}catch(q){return n.toString()+"("+q+")"}default:return n.toString()}}).join(" ")};h.log_types=["error","error","warn","info","debug"];return h}();g.Logger=p;p=function(){function h(){}
17h.isArray=function(f){return"[object Array]"===Object.prototype.toString.call(f)};h.getPropertyOrElse=function(f,l,n){return f.hasOwnProperty(l)?f[l]:n};return h}();g.Util=p})(Photon||(Photon={}));
18(function(g){g.setOnLoad=function(h){h()};var d;(function(h){h[h.Ws=0]="Ws";h[h.Wss=1]="Wss"})(d=g.ConnectionProtocol||(g.ConnectionProtocol={}));(function(h){h[h.None=0]="None";h[h.Byte=1]="Byte";h[h.Short=2]="Short";h[h.Int=3]="Int";h[h.Long=4]="Long";h[h.Float=5]="Float";h[h.Double=6]="Double";
18h[h.String=7]="String";h[h.Bool=8]="Bool";h[h.Table=9]="Table";h[h.Dict=10]="Dict";h[h.Object=11]="Object"})(g.TypeExtType||(g.TypeExtType={}));var p=function(){function h(){}h.Is=function(f){return!1};h.Byte=
19function(f){return f};h.Short=function(f){return f};h.Int=function(f){return f};h.Long=function(f){if(Array.isArray(f))throw Error("TypeExt.Long Arrays are not supported");return f};h.Float=function(f){return f};h.Double=function(f){return f};h.String=function(f){return f};h.Bool=function(f){return f};h.Dict=function(f,l,n){return n};h.TableTypedKeys=function(){return{}};h.DictTypedKeys=function(f,l){return{}};h.PutTypedKey=function(f,l,n){f[l]=n};return h}();g.TypeExt=p;p=function(){function h(f,
20l,n,q){void 0===n&&(n="");void 0===q&&(q="");this.protocol=f;this.address=l;this.subprotocol=n;this.keepAliveTimeoutMs=3E3;this._frame="~m~";this._isClosing=this._isConnected=this._isConnecting=!1;this._peerStatusListeners={};this._eventListeners={};this._responseListeners={};this.lastRtt=0;this.initTimestamp=Date.now();this.serverTimeBaseLock=!1;this.serverTimeBase=0;this.serverTimeBaseTimestamp=Date.now();this.keepAliveTimer=0;this.url=this.addProtocolPrefix(this.address,this.protocol);this._logger=
21new g.Logger(q&&""!=q?q+":":"")}h.setWebSocketImpl=function(f){h.webSocketImpl=f};h.prototype.addProtocolPrefix=function(f,l){var n={ws:"ws://",wss:"wss://"},q;for(q in n)if(0==f.indexOf(n[q]))return f;switch(l){case d.Ws:return n.ws+f;case d.Wss:return n.wss+f;default:return n.ws+f}};h.prototype.Destroy=function(){};h.prototype.isConnecting=function(){return this._isConnecting};h.prototype.getRtt=function(){return this.lastRtt};h.prototype.getServerTimeMs=function(){return this.serverTimeBase+(Date.now()-
22this.serverTimeBaseTimestamp)>>0};h.prototype.ping=function(f){void 0===f&&(f=!1);this._ping(f)};h.prototype.isConnected=function(){return this._isConnected};h.prototype.isClosing=function(){return this._isClosing};h.prototype.connect=function(f){var l=this;this._sessionid=void 0;f=this.url+"/"+f+"?libversion="+g.Version;var n=h.webSocketImpl;if(n)this._socket=""==this.subprotocol?new n(f,"Json"):new n(f,this.subprotocol);else throw Error("WebSocket is not available. Provide a WebSocket implementation using PhotonPeer.setWebSocketImpl().");
23this._onConnecting();this._socket.onopen=function(q){};this._socket.onmessage=function(q){q=l._decode(q.data);l._onMessage(q.toString())};this._socket.onclose=function(q){l._logger.debug("onclose: wasClean =",q.wasClean,", code =",q.code,", reason =",q.reason);l._isConnecting?l._onConnectFailed(q):(1006==q.code&&l._onTimeout(),l._onDisconnect())};this._socket.onerror=function(q){l._onError(q)}};h.prototype.disconnect=function(){this._isClosing=!0;this._socket&&this._socket.close()};h.prototype.sendOperation=
24function(f,l,n,q){f={req:f,vals:[]};g.Util.isArray(l)?f.vals=l:void 0===l?f.vals=[]:this._logger.exception(201,"PhotonPeer[sendOperation] - Trying to send non array data:",l);this._send(f);this._logger.debug("PhotonPeer[sendOperation] - Sending request:",f)};h.prototype.addPeerStatusListener=function(f,l){this._addListener(this._peerStatusListeners,f,l)};h.prototype.addEventListener=function(f,l){this._addListener(this._eventListeners,f.toString(),l)};h.prototype.addResponseListener=function(f,l){this._addListener(this._responseListeners,
25f.toString(),l)};h.prototype.removePeerStatusListener=function(f,l){this._removeListener(this._peerStatusListeners,f,l)};h.prototype.removeEventListener=function(f,l){this._removeListener(this._eventListeners,f.toString(),l)};h.prototype.removeResponseListener=function(f,l){this._removeListener(this._responseListeners,f.toString(),l)};h.prototype.removePeerStatusListenersForCode=function(f){this._removeListenersForCode(this._peerStatusListeners,f)};h.prototype.removeEventListenersForCode=function(f){this._removeListenersForCode(this._eventListeners,
26f.toString())};h.prototype.removeResponseListenersForCode=function(f){this._removeListenersForCode(this._responseListeners,f.toString())};h.prototype.setLogLevel=function(f){this._logger.setLevel(f)};h.prototype.onUnhandledEvent=function(f,l){this._logger.warn("PhotonPeer: No handler for event",f,"registered.")};h.prototype.onUnhandledResponse=function(f,l){this._logger.warn("PhotonPeer: No handler for response",f,"registered.")};h.prototype._dispatchEvent=function(f,l){if(!this._dispatch(this._eventListeners,
27f.toString(),l,"event"))this.onUnhandledEvent(f,l)};h.prototype._dispatchResponse=function(f,l){if(!this._dispatch(this._responseListeners,f.toString(),l,"response"))this.onUnhandledResponse(f,l)};h.prototype._stringify=function(f){return"[object Object]"==Object.prototype.toString.call(f)?(JSON||this._logger.exception(202,"PhotonPeer[_stringify] - Trying to encode as JSON, but JSON.stringify is missing."),"~j~"+JSON.stringify(f)):String(f)};h.prototype._encode=function(f){var l="";f=g.Util.isArray(f)?
28f:[f];for(var n=0,q=f.length;n<q;n++){var r=null===f[n]||void 0===f[n]?"":this._stringify(f[n]);l+=this._frame+r.length+this._frame+r}return l};h.prototype._decode=function(f){var l=[];var n=f;-1!==f.indexOf("\x00")&&(n=f.replace(/[\0]/g,""));f=n;do{if(f.substr(0,3)!==this._frame)break;f=f.substr(3);n="";for(var q=0,r=f.length;q<r;q++){var u=Number(f.substr(q,1));if(f.substr(q,1)==u)n+=u;else{f=f.substr(n.length+this._frame.length);n=Number(n);break}}l.push(f.substr(0,n));f=f.substr(n)}while(""!==
29f);return l};h.prototype._onMessage=function(f){"~j~"==f.substr(0,3)?this._onMessageReceived(JSON.parse(f.substr(3))):this._sessionid?this._onMessageReceived(f):(this._sessionid=f,this._onConnect())};h.prototype.resetKeepAlive=function(){var f=this;clearTimeout(this.keepAliveTimer);1E3<=this.keepAliveTimeoutMs&&(this.keepAliveTimer=setTimeout(function(){f._ping(!1)},this.keepAliveTimeoutMs))};h.prototype._ping=function(f){var l;void 0===f&&(f=!1);f&&(this.serverTimeBaseLock=!1);this._send((l={},l.irq=
301,l.vals=[1,Date.now()-this.initTimestamp],l),!0)};h.prototype._send=function(f,l){void 0===l&&(l=!1);var n=this._encode(f);this._socket&&this._isConnected&&!this._isClosing?(this.resetKeepAlive(),this._socket.send(n)):l||this._logger.exception(203,"PhotonPeer[_send] - Operation",f.req,'- failed, "isConnected" is',this._isConnected,', "isClosing" is',this._isClosing,"!")}
30;h.prototype._onMessageReceived=function(f){if("object"===typeof f)if(this._logger.debug("PhotonPeer[_onMessageReceived] - Socket received message:",
31f),f={err:f.err,msg:f.msg,vals:f.vals,res:f.res,evt:f.evt,irs:f.irs},f.vals=void 0!==f.vals?f.vals:[],0<f.vals.length&&(f.vals=this._parseMessageValuesArrayToJSON(f.vals)),void 0!==f.res){var l=parseInt(f.res);this._parseResponse(l,f)}else void 0!==f.evt?(l=parseInt(f.evt),this._parseEvent(l,f)):void 0!==f.irs?(l=parseInt(f.irs),this._parseInternalResponse(l,f)):this._logger.exception(204,"PhotonPeer[_onMessageReceived] - Received undefined message type:",f)};h.prototype._parseMessageValuesArrayToJSON=
32function(f){var l={};if(g.Util.isArray(f))if(0==f.length%2)for(var n,q;0<f.length;)n=f.shift()+"",q=f.shift(),l[n]=q;else this._logger.exception(205,"PhotonPeer[_parseMessageValuesToJSON] - Received invalid values array:",f);return l};h.prototype._parseEvent=function(f,l){this._dispatchEvent(f,{vals:l.vals})};h.prototype._parseResponse=function(f,l){this._dispatchResponse(f,{errCode:l.err,errMsg:l.msg,vals:l.vals})};h.prototype._parseInternalResponse=function(f,l){f=Date.now();this.lastRtt=f-this.initTimestamp-
33l.vals[1];this.serverTimeBaseLock||(this.serverTimeBase=l.vals[2]+this.lastRtt/2,this.serverTimeBaseTimestamp=f,this.serverTimeBaseLock=!0);this._logger.debug("internal response:",l)};h.prototype._onConnecting=function(){this._logger.debug("PhotonPeer[_onConnecting] - Starts connecting",this.url,'..., raising "connecting" event ...');this._isConnecting=!0;this._dispatchPeerStatus(h.StatusCodes.connecting);this.resetKeepAlive()};h.prototype._onConnect=function(){this._logger.debug('PhotonPeer[_onConnect] - Connected successfully! Raising "connect" event ...');
34this._isConnecting=!1;this._isConnected=!0;this._dispatchPeerStatus(h.StatusCodes.connect);this._ping(!0);this.resetKeepAlive()};h.prototype._onConnectFailed=function(f){this._logger.error("PhotonPeer[_onConnectFailed] - Socket connection could not be created:",this.url,this.subprotocol,'Wrong host or port?\n Raising "connectFailed event ...');this._isConnecting=this._isConnected=!1;this._dispatchPeerStatus(h.StatusCodes.connectFailed)};h.prototype._onDisconnect=function(){var f=this._isConnected,
35l=this._isClosing;this._logger.debug('PhotonPeer[_onDisconnect] - Socket closed, raising "disconnect" event ...');this._isClosing=this._isConnected=this._isConnecting=!1;f&&(l?this._dispatchPeerStatus(h.StatusCodes.disconnect):this._dispatchPeerStatus(h.StatusCodes.connectClosed))};
35h.prototype._onTimeout=function(){this._logger.debug('PhotonPeer[_onTimeout] - Client timed out! Raising "timeout" event ...');this._dispatchPeerStatus(h.StatusCodes.timeout)};h.prototype._onError=function(f){this._logger.error("PhotonPeer[_onError] - Connection error:",
36f);this._isConnecting=this._isConnected=this._isClosing=!1;this._dispatchPeerStatus(h.StatusCodes.error)};h.prototype._addListener=function(f,l,n){l in f||(f[l]=[]);n&&"function"===typeof n?(this._logger.debug("PhotonPeer[_addListener] - Adding listener for event",l),f[l].push(n)):this._logger.error("PhotonPeer[_addListener] - Listener",l,"is not a function but of type",typeof n,". No listener added!");return this};h.prototype._dispatch=function(f,l,n,q){if(l in f){f=f[l];l=0;for(q=f.length;l<q;l++)g.Util.isArray(n)||
37(n=[n]),f[l].apply(this,void 0===n?[]:n);return!0}return!1};h.prototype._dispatchPeerStatus=function(f){this._dispatch(this._peerStatusListeners,f,void 0,"peerStatus")||this._logger.warn("PhotonPeer[_dispatchPeerStatus] - No handler for ",f,"registered.")};h.prototype._removeListener=function(f,l,n){if(l in f){var q=f[l].length;f[l]=f[l].filter(function(r){return r!=n});this._logger.debug("PhotonPeer[_removeListener] - Removing listener for event",l,"removed:",q-f[l].length)}return this};h.prototype._removeListenersForCode=
38function(f,l){this._logger.debug("PhotonPeer[_removeListenersForCode] - Removing all listeners for event",l);l in f&&(f[l]=[]);return this};h.webSocketImpl="undefined"!==typeof WebSocket?WebSocket:void 0;h.StatusCodes={connecting:"connecting",connect:"connect",connectFailed:"connectFailed",disconnect:"disconnect",connectClosed:"connectClosed",error:"error",timeout:"timeout"};return h}();g.PhotonPeer=p})(Photon||(Photon={}));
39(function(g){(function(d){var p,h=function(){function e(a,b,c){this.name=a;this.actorNr=b;this.isLocal=c;this.userId="";this.customProperties={};this.suspended=!1}e.prototype.getRoom=function(){return this.loadBalancingClient?this.loadBalancingClient.myRoom():null};e.prototype.raiseEvent=function(a,b,c){this.loadBalancingClient&&this.loadBalancingClient.raiseEvent(a,b,c)};e.prototype.setProp=function(a,b,c){void 0===c&&(c=void 0);if(this.loadBalancingClient&&this.loadBalancingClient.isJoinedToRoom()){var m=
40g.TypeExt.TableTypedKeys();g.TypeExt.PutTypedKey(m,g.TypeExt.Byte(a),b);if(void 0!==c){var k=g.TypeExt.TableTypedKeys();g.TypeExt.PutTypedKey(k,g.TypeExt.Byte(a),c)}this.loadBalancingClient._setPropertiesOfActor(this.actorNr,m,!1,k);return void 0===c}return!0};e.prototype.setName=function(a){this.name!=a&&this.setProp(d.Constants.ActorProperties.PlayerName,a)&&(this.name=a)};e.prototype.onPropertiesChange=function(a,b){};e.prototype.getCustomProperty=function(a){return this.customProperties[a]};e.prototype.getCustomPropertyOrElse=
41function(a,b){return g.Util.getPropertyOrElse(this.customProperties,a,b)};e.prototype.setCustomProperty=function(a,b,c,m){var k;void 0===c&&(c=!1);var t={};t[a]=b;var v;void 0!==m&&(v=(k={},k[a]=m,k));(k=this.loadBalancingClient&&this.loadBalancingClient.isJoinedToRoom())&&this.loadBalancingClient&&this.loadBalancingClient._setPropertiesOfActor(this.actorNr,t,c,v);k&&void 0!==m||(this.customProperties[a]=b,this.onPropertiesChange(t,!0))};e.prototype.setCustomProperties=function(a,b,c){void 0===b&&
42(b=!1);var m=this.loadBalancingClient&&this.loadBalancingClient.isJoinedToRoom();m&&this.loadBalancingClient&&this.loadBalancingClient._setPropertiesOfActor(this.actorNr,a,b,c);if(!m||void 0===c){for(var k in a)this.customProperties[k]=a[k];this.onPropertiesChange(a,!0)}};e.prototype.isSuspended=function(){return this.suspended};e.prototype._getAllProperties=function(){var a={};a[d.Constants.ActorProperties.PlayerName]=this.name;for(var b in this.customProperties)a[b]=this.customProperties[b];return a};
43e.prototype._setLBC=function(a){this.loadBalancingClient=a};e.prototype.getCustomProperties=function(){var a={},b;for(b in this.customProperties)a[b]=this.customProperties[b];return a};e.prototype._updateFromResponse=function(a){this.actorNr=a[d.Constants.ParameterCode.ActorNr];a=a[d.Constants.ParameterCode.PlayerProperties];if(void 0!==a){var b=a[d.Constants.ActorProperties.PlayerName];void 0!==b&&(this.name=b);b=a[d.Constants.ActorProperties.UserId];void 0!==b&&(this.userId=b);this._updateFromProps(a)}};
44e.prototype._updateMyActorFromResponse=function(a){this.actorNr=a[d.Constants.ParameterCode.ActorNr]};e.prototype.updateIfExists=function(a,b,c){return c.hasOwnProperty(b)?c[b]:a};
44e.prototype._updateFromProps=function(a){if(a){this.name=this.updateIfExists(this.name,d.Constants.ActorProperties.PlayerName,a);var b={},c;for(c in a)parseInt(c).toString()!=c&&this.customProperties[c]!==a[c]&&(this.customProperties[c]=a[c],b[c]=a[c]);this.onPropertiesChange(b,!1)}};e.prototype._setSuspended=function(a){this.suspended=
45a};e._getActorNrFromResponse=function(a){return a[d.Constants.ParameterCode.ActorNr]};return e}();d.Actor=h;var f=function(){function e(a){this.address=this.name="";this.maxPlayers=0;this.isOpen=this.isVisible=!0;this.suspendedPlayerLiveTime=this.playerTTL=this.emptyRoomLiveTime=this.roomTTL=this.playerCount=0;this.cleanupCacheOnLeave=this.removed=!1;this.masterClientId=0;this._customProperties={};this._propsListedInLobby=[];this.name=a}e.prototype.getCustomProperties=function(){var a={},b;for(b in this._customProperties)a[b]=
46this._customProperties[b];return a};e.prototype.getPropsListedInLobby=function(){for(var a=[],b=0;b<this._propsListedInLobby.length;b++)a[b]=this._propsListedInLobby[b];return a};e.prototype.onPropertiesChange=function(a,b){};e.prototype.getCustomProperty=function(a){return this._customProperties[a]};e.prototype.getCustomPropertyOrElse=function(a,b){return g.Util.getPropertyOrElse(this._customProperties,a,b)};e.prototype._updateFromMasterResponse=function(a){this.address=a[d.Constants.ParameterCode.Address];
47if(a=a[d.Constants.ParameterCode.RoomName])this.name=a};e.prototype._updateFromProps=function(a){if(a){this.maxPlayers=this.updateIfExists(this.maxPlayers,d.Constants.GameProperties.MaxPlayers,a);this.isVisible=this.updateIfExists(this.isVisible,d.Constants.GameProperties.IsVisible,a);this.isOpen=this.updateIfExists(this.isOpen,d.Constants.GameProperties.IsOpen,a);this.playerCount=this.updateIfExists(this.playerCount,d.Constants.GameProperties.PlayerCount,a);this.removed=this.updateIfExists(this.removed,
48d.Constants.GameProperties.Removed,a);this._propsListedInLobby=this.updateIfExists(this._propsListedInLobby,d.Constants.GameProperties.PropsListedInLobby,a);this.cleanupCacheOnLeave=this.updateIfExists(this.cleanupCacheOnLeave,d.Constants.GameProperties.CleanupCacheOnLeave,a);this.masterClientId=this.updateIfExists(this.masterClientId,d.Constants.GameProperties.MasterClientId,a);this.roomTTL=this.emptyRoomLiveTime=this.updateIfExists(this.roomTTL,d.Constants.GameProperties.RoomTTL,a);this.playerTTL=
49this.suspendedPlayerLiveTime=this.updateIfExists(this.playerTTL,d.Constants.GameProperties.PlayerTTL,a);this.expectedUsers=this.updateIfExists(this.expectedUsers,d.Constants.GameProperties.ExpectedUsers,a);var b={},c;for(c in a)parseInt(c).toString()!=c&&this._customProperties[c]!==a[c]&&(this._customProperties[c]=a[c],b[c]=a[c]);this.onPropertiesChange(b,!1)}};e.prototype._updateFromEvent=function(a){a&&(this.masterClientId=this.updateIfExists(this.masterClientId,d.Constants.ParameterCode.MasterClientId,
50a))};e.prototype.updateIfExists=function(a,b,c){return c.hasOwnProperty(b)?c[b]:a};return e}();d.RoomInfo=f;var l=function(e){function a(b){return e.call(this,b)||this}__extends(a,e);a.prototype.setCustomProperty=function(b,c,m,k){var t;void 0===m&&(m=!1);var v={};v[b]=c;var w;void 0!==k&&(w=(t={},t[b]=k,t));(t=this.loadBalancingClient&&this.loadBalancingClient.isJoinedToRoom())&&this.loadBalancingClient&&this.loadBalancingClient._setPropertiesOfRoom(v,m,w);t&&void 0!==k||(this._customProperties[b]=
51c,this.onPropertiesChange(v,!0))};a.prototype.setCustomProperties=function(b,c,m){void 0===c&&(c=!1);var k=this.loadBalancingClient&&this.loadBalancingClient.isJoinedToRoom();k&&this.loadBalancingClient&&this.loadBalancingClient._setPropertiesOfRoom(b,c,m);if(!k||void 0===m){for(var t in b)this._customProperties[t]=b[t];this.onPropertiesChange(b,!0)}};a.prototype.setProp=function(b,c,m){void 0===m&&(m=void 0);if(this.loadBalancingClient&&this.loadBalancingClient.isJoinedToRoom()){var k=g.TypeExt.TableTypedKeys();
52g.TypeExt.PutTypedKey(k,g.TypeExt.Byte(b),c);if(void 0!==m){var t=g.TypeExt.TableTypedKeys();g.TypeExt.PutTypedKey(t,g.TypeExt.Byte(b),m)}this.loadBalancingClient._setPropertiesOfRoom(k,!1,t);return void 0===m}return!0};a.prototype.setIsVisible=function(b){this.isVisible!=b&&this.setProp(d.Constants.GameProperties.IsVisible,g.TypeExt.Bool(b),g.TypeExt.Bool(this.isVisible))&&(this.isVisible=b)};a.prototype.setIsOpen=function(b){this.isOpen!=b&&this.setProp(d.Constants.GameProperties.IsOpen,g.TypeExt.Bool(b),
53g.TypeExt.Bool(this.isOpen))&&(this.isOpen=b)};a.prototype.setMaxPlayers=function(b){this.maxPlayers!=b&&this.setProp(d.Constants.GameProperties.MaxPlayers,g.TypeExt.Byte(b),g.TypeExt.Byte(this.maxPlayers))&&
53(this.maxPlayers=b)};a.prototype.setRoomTTL=function(b){this.roomTTL!=b&&this.setProp(d.Constants.GameProperties.RoomTTL,g.TypeExt.Int(b))&&(this.roomTTL=this.emptyRoomLiveTime=b)};a.prototype.setEmptyRoomLiveTime=function(b){this.setRoomTTL(b)};a.prototype.setPlayerTTL=function(b){this.playerTTL!=
54b&&this.setProp(d.Constants.GameProperties.PlayerTTL,g.TypeExt.Int(b))&&(this.playerTTL=this.suspendedPlayerLiveTime=b)};a.prototype.setSuspendedPlayerLiveTime=function(b){this.setPlayerTTL(b)};a.prototype.setPlugins=function(b){this.plugins=b};a.prototype.setPropsListedInLobby=function(b){this._propsListedInLobby=b};a.prototype.setExpectedUsers=function(b){var c=null,m=null;b&&0!=b.length&&(c=g.TypeExt.String(b));this.expectedUsers&&0!=this.expectedUsers.length&&(m=g.TypeExt.String(this.expectedUsers));
55this.setProp(d.Constants.GameProperties.ExpectedUsers,c,m)&&(this.expectedUsers=b)};a.prototype.clearExpectedUsers=function(){var b=null;this.expectedUsers&&0!=this.expectedUsers.length&&(b=g.TypeExt.String(this.expectedUsers));this.setProp(d.Constants.GameProperties.ExpectedUsers,null,b)&&(this.expectedUsers=void 0)};a.prototype.setMasterClient=function(b){this.setProp(d.Constants.GameProperties.MasterClientId,b,this.masterClientId)&&(this.masterClientId=b)};a.prototype._setLBC=function(b){this.loadBalancingClient=
56b};return a}(f);d.Room=l;var n=function(){function e(a,b,c){this.appId=b;this.appVersion=c;this.onEventNative=null;this.connectionProtocol=0;this.nameServerAddress=this.masterServerAddress="";this.gamePeerWaitingForDisconnect=!1;this.autoJoinLobby=!0;this.connectOptions={};this.createRoomOptions={};this.joinRoomOptions={};this.roomInfos=[];this.roomInfosDict={};this.actors={};this.actorsArray=[];this.lowestActorId=0;this.userId="";this.userAuthType=d.Constants.CustomAuthenticationType.None;this.userAuthData=
57this.userAuthParameters="";this.findFriendsRequestList=[];this.lobbyStatsRequestList=[];this.state_=e.State.Uninitialized;this.logger=new g.Logger("Client:");this.validNextState={};if("number"==typeof a)switch(this.connectionProtocol=a,a){case g.ConnectionProtocol.Ws:this.masterServerAddress="";this.nameServerAddress="ws://ns.photonengine.io:9093";break;case g.ConnectionProtocol.Wss:this.masterServerAddress="";this.nameServerAddress="wss://ns.photonengine.io:19093";break;default:this.nameServerAddress=
58this.masterServerAddress="wrong_protocol_error",this.logger.error("Wrong protocol: ",a)}else"string"==typeof a?(this.connectionProtocol=g.ConnectionProtocol.Ws,this.nameServerAddress=this.masterServerAddress=a):(this.connectionProtocol=g.ConnectionProtocol.Ws,this.nameServerAddress=this.masterServerAddress="wrong_protocol_type_error",this.logger.error("Wrong protocol type: ",typeof a));this.initValidNextState();this.currentRoom=this.roomFactoryInternal("");this._myActor=this.actorFactoryInternal("",
59-1,!0);this.addActor(this._myActor)}e.prototype.onStateChange=function(a){};e.prototype.onError=function(a,b){};e.prototype.onOperationResponse=function(a,b,c,m){};e.prototype.onEvent=function(a,b,c){};e.prototype.onRoomList=function(a){};e.prototype.onRoomListUpdate=function(a,b,c,m){};e.prototype.onMyRoomPropertiesChange=function(){};e.prototype.onActorPropertiesChange=function(a){};e.prototype.onJoinRoom=function(a){};e.prototype.onActorJoin=function(a){};e.prototype.onActorLeave=function(a,b){};
60e.prototype.onActorSuspend=function(a){};e.prototype.onFindFriendsResult=function(a,b,c){};e.prototype.onLobbyStats=function(a,b,c){};e.prototype.onAppStats=function(a,b,c){};e.prototype.onGetRegionsResult=function(a,b,c){};e.prototype.onWebRpcResult=function(a,b,c,m,k){};e.prototype.onServerErrorInfo=function(a){};e.prototype.roomFactory=function(a){return new l(a)};e.prototype.actorFactory=function(a,b,c){return new h(a,b,c)};e.prototype.myActor=function(){return this._myActor};e.prototype.myRoom=
61function(){return this.currentRoom};e.prototype.myRoomActors=function(){return this.actors};e.prototype.myRoomActorCount=function(){return this.actorsArray.length};e.prototype.myRoomActorsArray=function(){return this.actorsArray};e.prototype.myRoomMasterActorNr=function(){return this.myRoom().masterClientId?this.myRoom().masterClientId:this.lowestActorId};e.prototype.updateRtt=function(){this.gamePeer&&this.gamePeer.ping()};e.prototype.syncServerTime=function(){this.gamePeer&&this.gamePeer.ping(!0)};
62e.prototype.getRtt=function(){return this.gamePeer?this.gamePeer.getRtt():0};e.prototype.getServerTimeMs=function(){return this.gamePeer?this.gamePeer.getServerTimeMs():0};e.prototype.roomFactoryInternal=function(a){void 0===a&&(a="");a=this.roomFactory(a);a._setLBC(this);return a};e.prototype.actorFactoryInternal=function(a,b,c){void 0===a&&(a="");void 0===b&&(b=-1);void 0===c&&(c=!1);a=this.actorFactory(a,b,c);a._setLBC(this);return a};e.prototype.setAppId=function(a){this.appId=a};e.prototype.setAppVersion=
63function(a){this.appVersion=a};e.prototype.setNameServerAddress=function(a){this.nameServerAddress=a};e.prototype.getNameServerAddress=function(){return this.nameServerAddress};e.prototype.setMasterServerAddress=function(a){this.masterServerAddress=a};e.prototype.getMasterServerAddress=function(){return this.nameServerAddress};e.prototype.setUserId=function(a){this.userId=a};e.prototype.getUserId=function(){return this.userId};e.prototype.setCustomAuthentication=function(a,b,c){void 0===b&&(b=g.LoadBalancing.Constants.CustomAuthenticationType.Custom);
64this.userAuthType=b;this.userAuthParameters=a;this.userAuthData=c};e.prototype.connect=function(a){"boolean"===typeof a&&(a=a?{keepMasterConnection:!0}
64:{keepMasterConnection:!1});a||(a={});if(this.checkNextState(e.State.ConnectingToMasterserver,!0)){this.changeState(e.State.ConnectingToMasterserver);this.logger.info("Connecting to Master",this.masterServerAddress);this.connectOptions={};for(var b in a)this.connectOptions[b]=a[b];this.masterPeer&&this.masterPeer.Destroy();this.masterPeer=new r(this,
65this.connectionProtocol,this.masterServerAddress,"");this.initMasterPeer(this.masterPeer);this.masterPeer.connect(this.appId);return!0}return!1};e.prototype.connectToNameServer=function(a){a||(a={});if(this.checkNextState(e.State.ConnectingToNameServer,!0)){this.changeState(e.State.ConnectingToNameServer);this.logger.info("Connecting to NameServer",this.nameServerAddress);this.connectOptions={};for(var b in a)this.connectOptions[b]=a[b];this.nameServerPeer&&this.nameServerPeer.Destroy();this.nameServerPeer=
66new q(this,this.connectionProtocol,this.nameServerAddress,"");this.initNameServerPeer(this.nameServerPeer);this.nameServerPeer.connect(this.appId);return!0}return!1};e.prototype.reconnectToMaster=function(){if(this.state()!=e.State.Disconnected&&this.state()!=e.State.Error)return this.logger.warn("reconnectToMaster() failed. Can only connect while in state 'Disconnected' or 'Error'. Current state: ",e.StateToName(this.state())),!1;if(!this.masterServerAddress)return this.logger.warn("reconnectToMaster() failed. MasterServerAddress is null or empty."),
67!1;if(!this.connectOptions.userAuthSecret)return this.logger.warn("reconnectToMaster() failed. It seems the client doesn't have any previous authentication token to re-connect."),!1;this.changeState(e.State.Disconnected);return this.connect(this.connectOptions)};e.prototype.reconnectAndRejoin=function(){if(this.state()!=e.State.Disconnected&&this.state()!=e.State.Error)return this.logger.warn("reconnectToMaster() failed. Can only connect while in state 'Disconnected' or 'Error'. Current state: ",
68e.StateToName(this.state())),!1;if(!this.currentRoom.address)return this.logger.warn("reconnectAndRejoin() failed. It seems the client wasn't connected to a game server before (no address)."),!1;if(!this.connectOptions.userAuthSecret)return this.logger.warn("reconnectToMaster() failed. It seems the client doesn't have any previous authentication token to re-connect."),!1;this.joinRoomOptions={rejoin:!0};this.changeState(e.State.Disconnected);return this.connectToGameServer(d.Constants.OperationCode.JoinGame)};
69e.prototype.fillCreateRoomOptions=function(a,b,c){b=b||{};var m=g.TypeExt.TableTypedKeys();void 0!==b.isVisible&&g.TypeExt.PutTypedKey(m,g.TypeExt.Byte(d.Constants.GameProperties.IsVisible),g.TypeExt.Bool(b.isVisible));void 0!==b.isOpen&&g.TypeExt.PutTypedKey(m,g.TypeExt.Byte(d.Constants.GameProperties.IsOpen),g.TypeExt.Bool(b.isOpen));void 0!==b.maxPlayers&&g.TypeExt.PutTypedKey(m,g.TypeExt.Byte(d.Constants.GameProperties.MaxPlayers),g.TypeExt.Byte(b.maxPlayers));void 0!==b.propsListedInLobby&&g.TypeExt.PutTypedKey(m,
70g.TypeExt.Byte(d.Constants.GameProperties.PropsListedInLobby),g.TypeExt.String(b.propsListedInLobby));if(void 0!==b.customGameProperties)for(var k in b.customGameProperties)g.TypeExt.PutTypedKey(m,g.TypeExt.String(k),b.customGameProperties[k]);a.push(c,m);a.push(d.Constants.ParameterCode.CleanupCacheOnLeave,!0);a.push(d.Constants.ParameterCode.Broadcast,!0);void 0!==b.emptyRoomLiveTime&&a.push(d.Constants.ParameterCode.RoomTTL,g.TypeExt.Int(b.emptyRoomLiveTime));void 0!==b.roomTTL&&a.push(d.Constants.ParameterCode.RoomTTL,
71g.TypeExt.Int(b.roomTTL));void 0!==b.suspendedPlayerLiveTime&&a.push(d.Constants.ParameterCode.PlayerTTL,g.TypeExt.Int(b.suspendedPlayerLiveTime));void 0!==b.playerTTL&&a.push(d.Constants.ParameterCode.PlayerTTL,g.TypeExt.Int(b.playerTTL));void 0!==b.plugins&&a.push(d.Constants.ParameterCode.Plugins,g.TypeExt.String(b.plugins));a.push(d.Constants.ParameterCode.CheckUserOnJoin,!0);a.push(d.Constants.ParameterCode.PublishUserId,!0);b.lobbyName&&(a.push(d.Constants.ParameterCode.LobbyName),a.push(b.lobbyName),
72void 0!=b.lobbyType&&(a.push(d.Constants.ParameterCode.LobbyType),a.push(b.lobbyType)));b.expectedUsers&&a.push(d.Constants.ParameterCode.Add,g.TypeExt.String(b.expectedUsers))};e.prototype.createRoomFromMy=function(a,b){this.joinRoomOptions={};this.createRoomOptions={};this.currentRoom.name=a?a:"";b=this.copyCreateOptionsFromMyRoom(b);this.masterPeer&&this.createRoomInternal(this.masterPeer,b)};e.prototype.copyCreateOptionsFromMyRoom=function(a){a=a||{};a.isVisible=this.currentRoom.isVisible;a.isOpen=
73this.currentRoom.isOpen;a.maxPlayers=this.currentRoom.maxPlayers;a.customGameProperties=this.currentRoom.getCustomProperties();a.propsListedInLobby=this.currentRoom.getPropsListedInLobby();a.roomTTL=this.currentRoom.roomTTL;a.playerTTL=this.currentRoom.playerTTL;a.plugins=this.currentRoom.plugins;a.expectedUsers=this.currentRoom.expectedUsers;return a};e.prototype.createRoom=function(a,b){this.joinRoomOptions={};this.createRoomOptions={};this.currentRoom=this.roomFactoryInternal(a?a:"");return this.masterPeer?
74(this.createRoomInternal(this.masterPeer,b),!0):!1};e.prototype.joinRoom=function(a,b,c){if(!this.masterPeer)return!1;this.joinRoomOptions=b||{};this.createRoomOptions=c||{};var m=[];b&&(b.createIfNotExists&&(m.push(d.Constants.ParameterCode.JoinMode,e.JoinMode.CreateIfNotExists),this.fillCreateRoomOptions(m,c,d.Constants.ParameterCode.GameProperties)),b.rejoin&&m.push(d.Constants.ParameterCode.JoinMode,e.JoinMode.RejoinOnly),b.expectedUsers&&m.push(d.Constants.ParameterCode.Add,g.TypeExt.String(b.expectedUsers)));
75this.currentRoom=this.roomFactoryInternal(a);m.push(d.Constants.ParameterCode.RoomName,a);this.logger.info("Join Room",a,b,c,"...");this.masterPeer.sendOperation(d.Constants.OperationCode.JoinGame,m);return!0};e.prototype.fillJoinRandomRoomOptions=function(a,b){if(b){void 0!=b.matchingType&&b.matchingType!=d.Constants.MatchmakingMode.FillRoom&&(a.push(d.Constants.ParameterCode.MatchMakingType),a.push(b.matchingType));var c=g.TypeExt.TableTypedKeys(),m=!1;if(void 0!=b.expectedCustomRoomProperties)for(var k in b.expectedCustomRoomProperties)g.TypeExt.PutTypedKey(c,
76g.TypeExt.String(k),b.expectedCustomRoomProperties[k]),m=!0;void 0!=b.expectedMaxPlayers&&0<b.expectedMaxPlayers&&(g.TypeExt.PutTypedKey(c,g.TypeExt.Byte(d.Constants.GameProperties.MaxPlayers),g.TypeExt.Byte(b.expectedMaxPlayers)),m=!0);m&&(a.push(d.Constants.ParameterCode.GameProperties),a.push(c));b.lobbyName&&(a.push(d.Constants.ParameterCode.LobbyName),a.push(b.lobbyName),void 0!=b.lobbyType&&(a.push(d.Constants.ParameterCode.LobbyType),a.push(b.lobbyType)));b.sqlLobbyFilter&&(a.push(d.Constants.ParameterCode.Data),
77a.push(b.sqlLobbyFilter));b.expectedUsers&&a.push(d.Constants.ParameterCode.Add,g.TypeExt.String(b.expectedUsers))}};
77e.prototype.joinRandomRoom=function(a){if(!this.masterPeer)return!1;this.joinRoomOptions={};this.createRoomOptions={};var b=[];this.fillJoinRandomRoomOptions(b,a);this.logger.info("Join Random Room",a&&a.lobbyName,a&&a.lobbyType,"...");this.masterPeer.sendOperation(d.Constants.OperationCode.JoinRandomGame,b);return!0};e.prototype.joinRandomOrCreateRoom=function(a,b,c){if(!this.masterPeer)return!1;
78this.joinRoomOptions={createIfNotExists:!0};this.createRoomOptions=c||{};var m=[];this.fillJoinRandomRoomOptions(m,a);m.push(d.Constants.ParameterCode.JoinMode,e.JoinMode.CreateIfNotExists);b&&m.push(d.Constants.ParameterCode.RoomName,b);this.fillCreateRoomOptions(m,c,d.Constants.ParameterCode.Properties);this.logger.info("Join Random or Create Room",a&&a.lobbyName,a&&a.lobbyType,b,m,"...");this.masterPeer.sendOperation(d.Constants.OperationCode.JoinRandomGame,m);return!0};e.prototype._setPropertiesOfRoom=
79function(a,b,c){if(this.gamePeer){var m=[];m.push(d.Constants.ParameterCode.Properties);m.push(a);m.push(d.Constants.ParameterCode.Broadcast);m.push(!0);b&&(m.push(d.Constants.ParameterCode.WebFlags),m.push(g.TypeExt.Byte(1)));c&&(m.push(d.Constants.ParameterCode.ExpectedValues),m.push(c));this.gamePeer.sendOperation(d.Constants.OperationCode.SetProperties,m)}};e.prototype._setPropertiesOfActor=function(a,b,c,m){if(this.gamePeer){var k=[];k.push(d.Constants.ParameterCode.ActorNr);k.push(g.TypeExt.Int(a));
80k.push(d.Constants.ParameterCode.Properties);k.push(b);k.push(d.Constants.ParameterCode.Broadcast);k.push(!0);c&&(k.push(d.Constants.ParameterCode.WebFlags),k.push(g.TypeExt.Byte(1)));m&&(k.push(d.Constants.ParameterCode.ExpectedValues),k.push(m));this.gamePeer.sendOperation(d.Constants.OperationCode.SetProperties,k)}};e.prototype.disconnect=function(){this.nameServerPeer&&this.nameServerPeer.disconnect();this._cleanupNameServerPeerData();this.masterPeer&&this.masterPeer.disconnect();this._cleanupMasterPeerData();
81this.gamePeer&&this.gamePeer.disconnect();this._cleanupGamePeerData();this.changeState(e.State.Disconnected)};e.prototype.suspendRoom=function(a){if(this.isJoinedToRoom()){if(this.gamePeer){var b=[];a&&a.sendAuthCookie&&b.push(d.Constants.ParameterCode.WebFlags,g.TypeExt.Byte(2));b.push(d.Constants.ParameterCode.IsInactive,!0);this.gamePeer.sendOperation(d.Constants.OperationCode.Leave,b);this.gamePeerWaitingForDisconnect=!0}this._cleanupGamePeerData();this.isConnectedToMaster()?this.changeState(e.State.JoinedLobby):
82(this.changeState(e.State.Disconnected),this.connect(this.connectOptions))}};e.prototype.leaveRoom=function(a){if(this.isJoinedToRoom()){if(this.gamePeer){var b=[];a&&a.sendAuthCookie&&b.push(d.Constants.ParameterCode.WebFlags,g.TypeExt.Byte(2));this.gamePeer.sendOperation(d.Constants.OperationCode.Leave,b);this.gamePeerWaitingForDisconnect=!0}this._cleanupGamePeerData();this.isConnectedToMaster()?this.changeState(e.State.JoinedLobby):(this.changeState(e.State.Disconnected),this.connect(this.connectOptions))}};
83e.prototype.raiseEvent=function(a,b,c){this.gamePeer&&this.isJoinedToRoom()&&this.gamePeer.raiseEvent(a,b,c)};e.prototype.changeGroups=function(a,b){this.gamePeer&&this.isJoinedToRoom()&&(this.logger.debug("Group change:",a,b),this.gamePeer.changeGroups(a,b))};e.prototype.findFriends=function(a){if(this.masterPeer&&this.isConnectedToMaster())if(a&&"object"==typeof a){this.findFriendsRequestList=[];for(var b=0;b<a.length;++b)if("string"==typeof a[b])this.findFriendsRequestList[b]=a[b];else{this.logger.error("FindFriends request error:",
84"Friend name is not a string",b);this.onFindFriendsResult(-1,"Friend name is not a string "+b,{});return}this.logger.debug("Find friends:",a);this.masterPeer.findFriends(this.findFriendsRequestList)}else this.logger.error("FindFriends request error:","Parameter is not an array"),this.onFindFriendsResult(-1,"Parameter is not an array",{});else this.logger.error("FindFriends request error:","Not connected to Master"),this.onFindFriendsResult(e.PeerErrorCode.MasterError,"Not connected to Master",{})};
85e.prototype.requestLobbyStats=function(a){if(this.masterPeer&&this.isConnectedToMaster()){this.lobbyStatsRequestList=[];
85if(a)if("object"==typeof a)for(var b=0;b<a.length;++b){var c=a[b];if("object"==typeof c){var m=c[0];if(m){if(void 0===c[1])c=d.Constants.LobbyType.Default;else if("number"==typeof c[1])c=c[1];else{this.requestLobbyStatsErr("Lobby type is invalid",b);return}this.lobbyStatsRequestList[b]=[m.toString(),c]}else{this.requestLobbyStatsErr("Lobby name is empty",b);return}}else{this.requestLobbyStatsErr("Lobby id is not an array",
86b);return}}else{this.requestLobbyStatsErr("Parameter is not an array");return}this.masterPeer.requestLobbyStats(this.lobbyStatsRequestList)}else this.logger.error("LobbyState request error:","Not connected to Master"),this.onLobbyStats(e.PeerErrorCode.MasterError,"Not connected to Master",[])};e.prototype.requestLobbyStatsErr=function(a,b){void 0===b&&(b="");this.logger.error("LobbyState request error:",a,b);this.onLobbyStats(-1,a+" "+b,[])};e.prototype.getRegions=function(){this.nameServerPeer&&
87this.isConnectedToNameServer()?(this.logger.debug("GetRegions..."),this.nameServerPeer.getRegions(this.appId)):(this.logger.error("GetRegions request error:","Not connected to NameServer"),this.onGetRegionsResult(e.PeerErrorCode.NameServerError,"Not connected to NameServer",{}))};e.prototype.webRpc=function(a,b,c){this.masterPeer&&this.isConnectedToMaster()?(this.logger.debug("WebRpc..."),this.masterPeer.webRpc(a,b,c)):this.gamePeer&&this.isJoinedToRoom()?(this.logger.debug("WebRpc..."),this.gamePeer.webRpc(a,
88b,c)):(this.logger.error("WebRpc request error:","Connected to neither Master nor Game server"),this.onWebRpcResult(e.PeerErrorCode.MasterError,"Connected to neither Master nor Game server",a,0,{}))};e.prototype.connectToRegionMaster=function(a){if(this.nameServerPeer&&this.isConnectedToNameServer())return this.logger.debug("Connecting to Region Master",a,"..."),this.nameServerPeer.opAuth(this.appId,this.appVersion,this.userAuthType,this.userAuthParameters,this.userAuthData,this.userId,a),!0;if(this.connectToNameServer({region:a}))return!0;
89this.logger.error("Connecting to Region Master error:","Not connected to NameServer");return!1};e.prototype.state=function(){return this.state_};e.prototype.isConnectedToMaster=function(){return this.masterPeer&&this.masterPeer.isConnected()};e.prototype.isConnectedToNameServer=function(){return this.nameServerPeer&&this.nameServerPeer.isConnected()};e.prototype.isInLobby=function(){return this.state()==e.State.JoinedLobby};e.prototype.isJoinedToRoom=function(){return this.state()==e.State.Joined};
90e.prototype.isConnectedToGame=function(){return this.isJoinedToRoom()};e.prototype.availableRooms=function(){return this.roomInfos};e.prototype.setLogLevel=function(a){this.logger.setLevel(a);this.nameServerPeer&&this.nameServerPeer.setLogLevel(a);this.masterPeer&&this.masterPeer.setLogLevel(a);this.gamePeer&&this.gamePeer.setLogLevel(a)};e.prototype.addRoom=function(a){this.roomInfos.push(a);this.roomInfosDict[a.name]=a};e.prototype.clearRooms=function(){this.roomInfos=[];this.roomInfosDict={}};
91e.prototype.purgeRemovedRooms=function(){this.roomInfos=this.roomInfos.filter(function(b){return!b.removed});for(var a in this.roomInfosDict)this.roomInfosDict[a].removed&&delete this.roomInfosDict[a]};e.prototype.addActor=function(a){this.actors[a.actorNr]=a;this.actorsArray.push(a);this.currentRoom.playerCount=this.actorsArray.length;if(0==this.lowestActorId||this.lowestActorId>a.actorNr)this.lowestActorId=a.actorNr};e.prototype.removeActor=function(a){delete this.actors[a];this.actorsArray=this.actorsArray.filter(function(b){return b.actorNr!=
92a});this.currentRoom.playerCount=this.actorsArray.length;this.lowestActorId==a&&(this.lowestActorId=0<this.actorsArray.length?this.actorsArray.reduce(function(b,c){return b.actorNr<c.actorNr?b:c}).actorNr:0)};e.prototype.clearActors=function(){this.actors={};this.actorsArray=[];this.lowestActorId=this.currentRoom.playerCount=0};e.prototype.changeState=function(a){this.logger.info("State:",e.StateToName(this.state()),"->",e.StateToName(a));this.state_=a;this.onStateChange(a)};e.prototype.createRoomInternal=
93function(a,b){var c=[];this.currentRoom.name&&c.push(d.Constants.ParameterCode.RoomName,this.currentRoom.name);this.fillCreateRoomOptions(c,b,d.Constants.ParameterCode.GameProperties);a===this.masterPeer&&(this.createRoomOptions=b);a===this.gamePeer&&(c.push(d.Constants.ParameterCode.PlayerProperties),c.push(this._myActor._getAllProperties()));var m=a==this.gamePeer?this.gamePeer._logger:this.masterPeer?this.masterPeer._logger:null;m&&m.info("Create Room",b&&b.lobbyName,b&&b.lobbyType,"...");a.sendOperation(d.Constants.OperationCode.CreateGame,
94c)};e.prototype.updateUserIdAndNickname=function(a,b){var c=a[d.Constants.ParameterCode.UserId];void 0!=c&&(this.setUserId(c),b.info("Setting userId sent by server:",c));a=a[d.Constants.ParameterCode.Nickname];void 0!=a&&(this.myActor().setName(a),b.info("Setting nickname sent by server:",a))};e.prototype.initNameServerPeer=function(a){var b=this;a.setLogLevel(this.logger.getLevel());a.addPeerStatusListener(g.PhotonPeer.StatusCodes.error,function(){b.changeState(e.State.Error);b._onErrorInternal(e.PeerErrorCode.NameServerError,
95"NameServer peer error")});a.addPeerStatusListener(g.PhotonPeer.StatusCodes.connectFailed,function(){b.changeState(e.State.Error);b._onErrorInternal(e.PeerErrorCode.NameServerConnectFailed,"NameServer peer connect failed. "+b.nameServerAddress)});a.addPeerStatusListener(g.PhotonPeer.StatusCodes.timeout,function(){b.changeState(e.State.Error);b._onErrorInternal(e.PeerErrorCode.NameServerTimeout,"NameServer peer timeout")});a.addPeerStatusListener(g.PhotonPeer.StatusCodes.connecting,function(){});a.addPeerStatusListener(g.PhotonPeer.StatusCodes.connect,
96function(){a._logger.info("Connected");b.changeState(e.State.ConnectedToNameServer);void 0!=b.connectOptions.region&&a.opAuth(b.appId,b.appVersion,b.userAuthType,b.userAuthParameters,b.userAuthData,b.userId,b.connectOptions.region)});a.addPeerStatusListener(g.PhotonPeer.StatusCodes.disconnect,function(){a==b.nameServerPeer&&(b._cleanupNameServerPeerData(),a._logger.info("Disconnected"))});a.addPeerStatusListener(g.PhotonPeer.StatusCodes.connectClosed,function(){a._logger.info("Server closed connection");
97b.changeState(e.State.Error);b._onErrorInternal(e.PeerErrorCode.NameServerConnectClosed,"NameServer server closed connection")});a.addResponseListener(d.Constants.OperationCode.GetRegions,function(c){a._logger.debug("resp GetRegions",c);var m={};if(0==c.errCode){var k=c.vals[d.Constants.ParameterCode.Region],t=c.vals[d.Constants.ParameterCode.Address],v;
97for(v in k)m[k[v]]=t[v]}else a._logger.error("GetRegions request error.",c.errCode);b.onGetRegionsResult(c.errCode,c.errMsg,m)});a.addResponseListener(d.Constants.OperationCode.Authenticate,
98function(c){a._logger.debug("resp Authenticate",c);0==c.errCode?(a._logger.info("Authenticated"),a.disconnect(),b.updateUserIdAndNickname(c.vals,a._logger),b.masterServerAddress=c.vals[d.Constants.ParameterCode.Address],a._logger.info("Connecting to Master server",b.masterServerAddress,"..."),b.connectOptions.userAuthSecret=c.vals[d.Constants.ParameterCode.Secret],b.connect(b.connectOptions)):(b.changeState(e.State.Error),b._onErrorInternal(e.PeerErrorCode.NameServerAuthenticationFailed,"NameServer authentication failed: "+
99c.errCode+" "+c.errMsg))})};e.prototype.initMasterPeer=function(a){var b=this;a.setLogLevel(this.logger.getLevel());a.addPeerStatusListener(g.PhotonPeer.StatusCodes.error,function(){b.changeState(e.State.Error);b._onErrorInternal(e.PeerErrorCode.MasterError,"Master peer error")});a.addPeerStatusListener(g.PhotonPeer.StatusCodes.connectFailed,function(){b.changeState(e.State.Error);b._onErrorInternal(e.PeerErrorCode.MasterConnectFailed,"Master peer connect failed: "+b.masterServerAddress)});a.addPeerStatusListener(g.PhotonPeer.StatusCodes.timeout,
100function(){b.changeState(e.State.Error);b._onErrorInternal(e.PeerErrorCode.MasterTimeout,"Master peer error timeout")});a.addPeerStatusListener(g.PhotonPeer.StatusCodes.connecting,function(){});a.addPeerStatusListener(g.PhotonPeer.StatusCodes.connect,function(){a._logger.info("Connected");var c=[];b.connectOptions.userAuthSecret?(c.push(d.Constants.ParameterCode.Secret,b.connectOptions.userAuthSecret),a.sendOperation(d.Constants.OperationCode.Authenticate,c),a._logger.info("Authenticate with secret...")):
101(c.push(d.Constants.ParameterCode.ApplicationId),c.push(b.appId),c.push(d.Constants.ParameterCode.AppVersion),c.push(b.appVersion),b.userAuthType!=d.Constants.CustomAuthenticationType.None&&(c.push(d.Constants.ParameterCode.ClientAuthenticationType,g.TypeExt.Byte(b.userAuthType)),c.push(d.Constants.ParameterCode.ClientAuthenticationParams,b.userAuthParameters),b.userAuthData&&c.push(d.Constants.ParameterCode.ClientAuthenticationData,b.userAuthData)),b.userId&&c.push(d.Constants.ParameterCode.UserId,
102b.userId),b.connectOptions.lobbyStats&&c.push(d.Constants.ParameterCode.LobbyStats,!0),a.sendOperation(d.Constants.OperationCode.Authenticate,c),a._logger.info("Authenticate..."))});a.addPeerStatusListener(g.PhotonPeer.StatusCodes.disconnect,function(){a==b.masterPeer&&(b._cleanupMasterPeerData(),a._logger.info("Disconnected"))});a.addPeerStatusListener(g.PhotonPeer.StatusCodes.connectClosed,function(){a._logger.info("Server closed connection");b.changeState(e.State.Error);b._onErrorInternal(e.PeerErrorCode.MasterConnectClosed,
103"Master server closed connection")});a.addEventListener(d.Constants.EventCode.GameList,function(c){c=c.vals[d.Constants.ParameterCode.GameList];b.clearRooms();for(var m in c){var k=new f(m);k._updateFromProps(c[m]);b.addRoom(k)}b.onRoomList(b.roomInfos);a._logger.debug("ev GameList",b.roomInfos,c)});a.addEventListener(d.Constants.EventCode.GameListUpdate,function(c){c=c.vals[d.Constants.ParameterCode.GameList];var m=[],k=[],t=[],v;for(v in c){var w=b.roomInfos.filter(function(x){return x.name==v});
1040<w.length?(w=w[0],w._updateFromProps(c[v]),w.removed?t.push(w):m.push(w)):(w=new f(v),w._updateFromProps(c[v]),b.addRoom(w),k.push(w))}b.purgeRemovedRooms();b.onRoomListUpdate(b.roomInfos,m,k,t);a._logger.debug("ev GameListUpdate:",b.roomInfos,"u:",m,"a:",k,"r:",t,c)});a.addResponseListener(d.Constants.OperationCode.Authenticate,function(c){a._logger.debug("resp Authenticate",c);c.errCode?(b.changeState(e.State.Error),b._onErrorInternal(e.PeerErrorCode.MasterAuthenticationFailed,"Master authentication failed: "+
105c.errCode+" "+c.errMsg)):(a._logger.info("Authenticated"),b.updateUserIdAndNickname(c.vals,a._logger),void 0!=c.vals[d.Constants.ParameterCode.Secret]&&(b.connectOptions.userAuthSecret=c.vals[d.Constants.ParameterCode.Secret]),b.changeState(e.State.ConnectedToMaster),c=[],b.connectOptions.lobbyName&&(c.push(d.Constants.ParameterCode.LobbyName),c.push(b.connectOptions.lobbyName),void 0!=b.connectOptions.lobbyType&&(c.push(d.Constants.ParameterCode.LobbyType),c.push(b.connectOptions.lobbyType))),b.autoJoinLobby&&
106(a.sendOperation(d.Constants.OperationCode.JoinLobby,c),a._logger.info("Join Lobby",b.connectOptions.lobbyName,b.connectOptions.lobbyType,"...")))});a.addResponseListener(d.Constants.OperationCode.JoinLobby,function(c){a._logger.debug("resp JoinLobby",c);c.errCode||(a._logger.info("Joined to Lobby"),void 0!=c.vals[d.Constants.ParameterCode.Secret]&&(b.connectOptions.userAuthSecret=c.vals[d.Constants.ParameterCode.Secret]),b.changeState(e.State.JoinedLobby));b._onOperationResponseInternal2(d.Constants.OperationCode.JoinLobby,
107c)});a.addResponseListener(d.Constants.OperationCode.CreateGame,function(c){a._logger.debug("resp CreateGame",c);c.errCode||(void 0!=c.vals[d.Constants.ParameterCode.Secret]&&(b.connectOptions.userAuthSecret=c.vals[d.Constants.ParameterCode.Secret]),b.currentRoom._updateFromMasterResponse(c.vals),a._logger.debug("Created/Joined "+b.currentRoom.name),b.connectToGameServer(d.Constants.OperationCode.CreateGame));b._onOperationResponseInternal2(d.Constants.OperationCode.CreateGame,c)});a.addResponseListener(d.Constants.OperationCode.JoinGame,
108function(c){a._logger.debug("resp JoinGame",c);c.errCode||(void 0!=c.vals[d.Constants.ParameterCode.Secret]&&(b.connectOptions.userAuthSecret=c.vals[d.Constants.ParameterCode.Secret]),b.currentRoom._updateFromMasterResponse(c.vals),a._logger.debug("Joined "+b.currentRoom.name),b.connectToGameServer(d.Constants.OperationCode.JoinGame));b._onOperationResponseInternal2(d.Constants.OperationCode.JoinGame,c)});a.addResponseListener(d.Constants.OperationCode.JoinRandomGame,function(c){a._logger.debug("resp JoinRandomGame",
109c);c.errCode||(void 0!=c.vals[d.Constants.ParameterCode.Secret]&&(b.connectOptions.userAuthSecret=c.vals[d.Constants.ParameterCode.Secret]),b.currentRoom._updateFromMasterResponse(c.vals),a._logger.debug("Joined "+b.currentRoom.name),b.connectToGameServer(d.Constants.OperationCode.JoinRandomGame));b._onOperationResponseInternal2(d.Constants.OperationCode.JoinRandomGame,c)});a.addResponseListener(d.Constants.OperationCode.FindFriends,function(c){a._logger.debug("resp FindFriends",c);var m={};if(c.errCode)a._logger.error("FindFriends request error:",
110c.errCode);else for(var k=c.vals[d.Constants.ParameterCode.FindFriendsResponseOnlineList]||{},t=c.vals[d.Constants.ParameterCode.FindFriendsResponseRoomIdList]||{},v=0;v<b.findFriendsRequestList.length;++v){var w=b.findFriendsRequestList[v];
110w&&(m[w]={online:k[v],roomId:t[v]})}b.onFindFriendsResult(c.errCode,c.errMsg,m)});a.addResponseListener(d.Constants.OperationCode.LobbyStats,function(c){a._logger.debug("resp LobbyStats",c);var m=[];if(c.errCode)a._logger.error("LobbyStats request error:",c.errCode);
111else{var k=c.vals[d.Constants.ParameterCode.LobbyName],t=c.vals[d.Constants.ParameterCode.LobbyType]||{},v=c.vals[d.Constants.ParameterCode.PeerCount]||{},w=c.vals[d.Constants.ParameterCode.GameCount]||{};if(k)for(var x=0;x<k.length;++x)m[x]={lobbyName:k[x],lobbyType:t[x],peerCount:v[x],gameCount:w[x]};else for(x=0;x<b.lobbyStatsRequestList.length;++x)k=b.lobbyStatsRequestList[x],m[x]={lobbyName:k[0],lobbyType:k[1],peerCount:v[x],gameCount:w[x]}}b.onLobbyStats(c.errCode,c.errMsg,m)});a.addEventListener(d.Constants.EventCode.LobbyStats,
112function(c){a._logger.debug("ev LobbyStats",c);var m=[],k=c.vals[d.Constants.ParameterCode.LobbyName],t=c.vals[d.Constants.ParameterCode.LobbyType]||{},v=c.vals[d.Constants.ParameterCode.PeerCount]||{};c=c.vals[d.Constants.ParameterCode.GameCount]||{};if(k)for(var w=0;w<k.length;++w)m[w]={lobbyName:k[w],lobbyType:t[w],peerCount:v[w],gameCount:c[w]};b.onLobbyStats(0,"",m)});a.addEventListener(d.Constants.EventCode.AppStats,function(c){a._logger.debug("ev AppStats",c);b.onAppStats(0,"",{peerCount:c.vals[d.Constants.ParameterCode.PeerCount],
113masterPeerCount:c.vals[d.Constants.ParameterCode.MasterPeerCount],gameCount:c.vals[d.Constants.ParameterCode.GameCount]})});a.addResponseListener(d.Constants.OperationCode.Rpc,a.webRpcHandler(this))};e.prototype.connectToGameServer=function(a){!this.connectOptions.keepMasterConnection&&this.masterPeer&&this.masterPeer.disconnect();return this.checkNextState(e.State.ConnectingToGameserver,!0)?(this.logger.info("Connecting to Game",this.currentRoom.address),this.gamePeer&&this.gamePeer.Destroy(),this.gamePeer=
114new u(this,this.connectionProtocol,this.currentRoom.address,""),this.gamePeerWaitingForDisconnect=!1,this.initGamePeer(this.gamePeer,a),this.gamePeer.connect(this.appId),this.changeState(e.State.ConnectingToGameserver),!0):!1};e.prototype.initGamePeer=function(a,b){var c=this;a.setLogLevel(this.logger.getLevel());a.addPeerStatusListener(g.PhotonPeer.StatusCodes.error,function(){c.changeState(e.State.Error);c._onErrorInternal(e.PeerErrorCode.GameError,"Game peer error")});a.addPeerStatusListener(g.PhotonPeer.StatusCodes.connectFailed,
115function(){c.changeState(e.State.Error);c._onErrorInternal(e.PeerErrorCode.GameConnectFailed,"Game peer connect failed: "+c.currentRoom.address)});a.addPeerStatusListener(g.PhotonPeer.StatusCodes.timeout,function(){c.changeState(e.State.Error);c._onErrorInternal(e.PeerErrorCode.GameTimeout,"Game peer timeout")});a.addPeerStatusListener(g.PhotonPeer.StatusCodes.connect,function(){a._logger.info("Connected");var k=[];k.push(d.Constants.ParameterCode.ApplicationId);k.push(c.appId);k.push(d.Constants.ParameterCode.AppVersion);
116k.push(c.appVersion);void 0!=c.connectOptions.userAuthSecret&&(k.push(d.Constants.ParameterCode.Secret),k.push(c.connectOptions.userAuthSecret));c.userAuthType!=d.Constants.CustomAuthenticationType.None&&(k.push(d.Constants.ParameterCode.ClientAuthenticationType),k.push(g.TypeExt.Byte(c.userAuthType)));c.userId&&k.push(d.Constants.ParameterCode.UserId,c.userId);a.sendOperation(d.Constants.OperationCode.Authenticate,k);a._logger.info("Authenticate...")});a.addPeerStatusListener(g.PhotonPeer.StatusCodes.disconnect,
117function(){a==c.gamePeer&&(c._cleanupGamePeerData(),a._logger.info("Disconnected"))});a.addPeerStatusListener(g.PhotonPeer.StatusCodes.connectClosed,function(){a._logger.info("Server closed connection");c.gamePeerWaitingForDisconnect||(c.changeState(e.State.Error),c._onErrorInternal(e.PeerErrorCode.GameConnectClosed,"Game server closed connection"))});a.addResponseListener(d.Constants.OperationCode.Authenticate,function(k){a._logger.debug("resp Authenticate",k);k.errCode?(c.changeState(e.State.Error),
118c._onErrorInternal(e.PeerErrorCode.GameAuthenticationFailed,"Game authentication failed: "+k.errCode+" "+k.errMsg)):(a._logger.info("Authenticated"),a._logger.info("Connected"),b==d.Constants.OperationCode.CreateGame?c.createRoomInternal(a,c.createRoomOptions):(k=[],k.push(d.Constants.ParameterCode.RoomName),k.push(c.currentRoom.name),k.push(d.Constants.ParameterCode.Broadcast),k.push(!0),k.push(d.Constants.ParameterCode.PlayerProperties),k.push(c._myActor._getAllProperties()),c.joinRoomOptions.createIfNotExists&&
119(k.push(d.Constants.ParameterCode.JoinMode,e.JoinMode.CreateIfNotExists),c.fillCreateRoomOptions(k,c.createRoomOptions,d.Constants.ParameterCode.GameProperties)),c.joinRoomOptions.rejoin&&k.push(d.Constants.ParameterCode.JoinMode,e.JoinMode.RejoinOnly),c.joinRoomOptions.expectedUsers&&k.push(d.Constants.ParameterCode.Add,g.TypeExt.String(c.joinRoomOptions.expectedUsers)),a.sendOperation(d.Constants.OperationCode.JoinGame,k)),c.changeState(e.State.ConnectedToGameserver))});var m=function(k){return{actorNr:k.actorNr,
120userId:k.userId,name:k.name,customProperties:k.getCustomProperties()}};a.addResponseListener(d.Constants.OperationCode.CreateGame,function(k){a._logger.debug("resp CreateGame",k);k.errCode||(c._myActor._updateMyActorFromResponse(k.vals),a._logger.info("myActor: ",m(c._myActor)),c.currentRoom._updateFromProps(k.vals[d.Constants.ParameterCode.GameProperties]),c.clearActors(),c.addActor(c._myActor),c.changeState(e.State.Joined),c.onJoinRoom(!0));c._onOperationResponseInternal2(d.Constants.OperationCode.CreateGame,
121k)});a.addResponseListener(d.Constants.OperationCode.JoinGame,function(k){a._logger.debug("resp JoinGame",k);if(!k.errCode){c._myActor._updateMyActorFromResponse(k.vals);a._logger.info("myActor: ",m(c._myActor));c.clearActors();c.addActor(c._myActor);var t=k.vals[d.Constants.ParameterCode.ActorList],v=k.vals[d.Constants.ParameterCode.PlayerProperties];if(void 0!==t)for(var w=0;w<t.length;w++){var x=t[w],y;void 0!==v&&(y=v[x]);var z="";void 0!==y&&(z=y[d.Constants.ActorProperties.PlayerName]);x==c._myActor.actorNr?
122x=c._myActor:(x=c.actorFactoryInternal(z,x),c.addActor(x));void 0!==y&&(z=y[d.Constants.ActorProperties.UserId],void 0!=z&&(x.userId=z));void 0!==y&&x._updateFromProps(y)}c.currentRoom._updateFromProps(k.vals[d.Constants.ParameterCode.GameProperties]);c.changeState(e.State.Joined);c.onJoinRoom(!1)}c._onOperationResponseInternal2(d.Constants.OperationCode.JoinGame,k)});a.addResponseListener(d.Constants.OperationCode.SetProperties,function(k){a._logger.debug("resp SetProperties",k);c._onOperationResponseInternal2(d.Constants.OperationCode.SetProperties,
123k)});a.addResponseListener(d.Constants.OperationCode.Leave,function(k){a._logger.debug("resp Leave",k);a.disconnect();c._onOperationResponseInternal2(d.Constants.OperationCode.Leave,k)});a.addResponseListener(d.Constants.OperationCode.Rpc,a.webRpcHandler(this));a.addEventListener(d.Constants.EventCode.Join,function(k){a._logger.debug("ev Join",k);if(h._getActorNrFromResponse(k.vals)===c._myActor.actorNr)c._myActor._updateFromResponse(k.vals),c.onActorJoin(c._myActor);else{var t=c.actorFactoryInternal();
124t._updateFromResponse(k.vals);c.addActor(t);c.onActorJoin(t)}});a.addEventListener(d.Constants.EventCode.Leave,function(k){a._logger.debug("ev Leave",k);c.myRoom()._updateFromEvent(k.vals);var t=h._getActorNrFromResponse(k.vals);if(t&&c.actors[t]){var v=c.actors[t];k.vals[d.Constants.ParameterCode.IsInactive]?(v._setSuspended(!0),c.onActorSuspend(v)):(c.removeActor(t),c.onActorLeave(v,!1))}});a.addEventListener(d.Constants.EventCode.Disconnect,function(k){a._logger.debug("ev Disconnect",k);(k=h._getActorNrFromResponse(k.vals))&&
125c.actors[k]&&(k=c.actors[k],k._setSuspended(!0),c.onActorSuspend(k))});a.addEventListener(d.Constants.EventCode.PropertiesChanged,function(k){a._logger.debug("ev PropertiesChanged",k);var t=k.vals[d.Constants.ParameterCode.TargetActorNr];void 0!==t&&0<t?void 0!==c.actors[t]&&(t=c.actors[t],t._updateFromProps(k.vals[d.Constants.ParameterCode.Properties]),c.onActorPropertiesChange(t)):(c.currentRoom._updateFromProps(k.vals[d.Constants.ParameterCode.Properties]),c.onMyRoomPropertiesChange())});a.addEventListener(d.Constants.EventCode.AuthEvent,
126function(k){a._logger.debug("ev AuthEvent",k);c.connectOptions.userAuthSecret=k.vals[d.Constants.ParameterCode.Secret]});a.addEventListener(d.Constants.EventCode.ErrorInfo,function(k){a._logger.debug("ev ErrorInfo",k);c.onServerErrorInfo(k.vals[d.Constants.ParameterCode.Info])})};e.prototype._cleanupNameServerPeerData=function(){};e.prototype._cleanupMasterPeerData=function(){};e.prototype._cleanupGamePeerData=function(){for(var a in this.actors)this.onActorLeave(this.actors[a],!0);this.clearActors();
127this.addActor(this._myActor)};e.prototype._onOperationResponseInternal2=function(a,b){b.errCode&&this.logger.warn("Operation",a,"error:",b.errMsg,"("+b.errCode+")");this.onOperationResponse(b.errCode,b.errMsg,a,b.vals)};e.prototype._onErrorInternal=function(a,b){this.logger.error("Error:",a,b);this.onError(a,b)};e.prototype.initValidNextState=function(){this.validNextState[e.State.Error]=[e.State.ConnectingToMasterserver,e.State.ConnectingToNameServer];this.validNextState[e.State.Uninitialized]=[e.State.ConnectingToMasterserver,
128e.State.ConnectingToNameServer];this.validNextState[e.State.ConnectedToNameServer]=[e.State.ConnectingToMasterserver];this.validNextState[e.State.Disconnected]=[e.State.ConnectingToGameserver,e.State.ConnectingToMasterserver,e.State.ConnectingToNameServer];this.validNextState[e.State.ConnectedToMaster]=[e.State.JoinedLobby,e.State.ConnectingToGameserver];this.validNextState[e.State.JoinedLobby]=[e.State.ConnectingToGameserver];this.validNextState[e.State.ConnectingToGameserver]=[e.State.ConnectedToGameserver];
129this.validNextState[e.State.ConnectedToGameserver]=[e.State.Joined]};e.prototype.checkNextState=function(a,b){void 0===b&&(b=!1);var c=this.validNextState[this.state()];(c=c&&0<=c.indexOf(a))||(b?this.logger.error("LoadBalancingPeer checkNextState fail: "+e.StateToName(this.state())+" -> "+e.StateToName(a)):this.logger.exception(501,"LoadBalancingPeer checkNextState fail: "+e.StateToName(this.state())+" -> "+e.StateToName(a)));return c};e.StateToName=function(a){return e.stateName[a]};e.JoinMode=
130{Default:0,CreateIfNotExists:1,RejoinOnly:3};e.PeerErrorCode={Ok:0,MasterError:1001,MasterConnectFailed:1002,MasterConnectClosed:1003,MasterTimeout:1004,MasterEncryptionEstablishError:1005,MasterAuthenticationFailed:1101,GameError:2001,GameConnectFailed:2002,GameC
130onnectClosed:2003,GameTimeout:2004,GameEncryptionEstablishError:2005,GameAuthenticationFailed:2101,NameServerError:3001,NameServerConnectFailed:3002,NameServerConnectClosed:3003,NameServerTimeout:3004,NameServerEncryptionEstablishError:3005,
131NameServerAuthenticationFailed:3101};e.State={Error:-1,Uninitialized:0,ConnectingToNameServer:1,ConnectedToNameServer:2,ConnectingToMasterserver:3,ConnectedToMaster:4,JoinedLobby:5,ConnectingToGameserver:6,ConnectedToGameserver:7,Joined:8,Disconnected:10};e.stateName=(p={},p[e.State.Error]="Error",p[e.State.Uninitialized]="Uninitialized",p[e.State.ConnectingToNameServer]="ConnectingToNameServer",p[e.State.ConnectedToNameServer]="ConnectedToNameServer",p[e.State.ConnectingToMasterserver]="ConnectingToMasterserver",
132p[e.State.ConnectedToMaster]="ConnectedToMaster",p[e.State.JoinedLobby]="JoinedLobby",p[e.State.ConnectingToGameserver]="ConnectingToGameserver",p[e.State.ConnectedToGameserver]="ConnectedToGameserver",p[e.State.Joined]="Joined",p[e.State.Disconnected]="Disconnected",p);return e}();d.LoadBalancingClient=n;n=function(e){function a(){return null!==e&&e.apply(this,arguments)||this}__extends(a,e);a.prototype.webRpc=function(b,c,m){var k=[];k.push(d.Constants.ParameterCode.UriPath,b);k.push(d.Constants.ParameterCode.RpcCallParams,
133c);m&&m.sendAuthCookie&&k.push(d.Constants.ParameterCode.WebFlags,g.TypeExt.Byte(2));this.sendOperation(d.Constants.OperationCode.Rpc,k)};a.prototype.webRpcHandler=function(b){var c=this;return function(m){c._logger.debug("resp Rpc",m);if(0==m.errCode){var k=m.vals[d.Constants.ParameterCode.UriPath];var t=m.vals[d.Constants.ParameterCode.RpcCallRetData];var v=m.vals[d.Constants.ParameterCode.RpcCallRetCode]}else c._logger.error("WebRpc request error:",m.errCode);b.onWebRpcResult(m.errCode,m.errMsg,
134k,v,t)}};return a}(g.PhotonPeer);d.LbcPeer=n;var q=function(e){function a(b,c,m,k){c=e.call(this,c,m,k,b.logger.getPrefix()+" NameServer")||this;c.client=b;return c}__extends(a,e);a.prototype.onUnhandledEvent=function(b,c){this.client.onEvent(b,c.vals[d.Constants.ParameterCode.CustomEventContent],c.vals[d.Constants.ParameterCode.ActorNr])};a.prototype.onUnhandledResponse=function(b,c){this.client.onOperationResponse(c.errCode,c.errMsg,b,c.vals)};a.prototype.getRegions=function(b){var c=[];c.push(d.Constants.ParameterCode.ApplicationId,
135b);this.sendOperation(d.Constants.OperationCode.GetRegions,c,!0,0)};a.prototype.opAuth=function(b,c,m,k,t,v,w){var x=[];x.push(d.Constants.ParameterCode.ApplicationId,b);x.push(d.Constants.ParameterCode.AppVersion,c);m!=d.Constants.CustomAuthenticationType.None&&(x.push(d.Constants.ParameterCode.ClientAuthenticationType,g.TypeExt.Byte(m)),x.push(d.Constants.ParameterCode.ClientAuthenticationParams,k),t&&x.push(d.Constants.ParameterCode.ClientAuthenticationData,t));v&&x.push(d.Constants.ParameterCode.UserId,
136v);x.push(d.Constants.ParameterCode.Region,w);this.sendOperation(d.Constants.OperationCode.Authenticate,x,!0,0);this._logger.info("Authenticate...")};return a}(n);d.NameServerPeer=q;var r=function(e){function a(b,c,m,k){c=e.call(this,c,m,k,b.logger.getPrefix()+" Master")||this;c.client=b;return c}__extends(a,e);a.prototype.onUnhandledEvent=function(b,c){this.client.onEvent(b,c.vals[d.Constants.ParameterCode.CustomEventContent],c.vals[d.Constants.ParameterCode.ActorNr])};a.prototype.onUnhandledResponse=
137function(b,c){this.client.onOperationResponse(c.errCode,c.errMsg,b,c.vals)};a.prototype.findFriends=function(b){var c=[];c.push(d.Constants.ParameterCode.FindFriendsRequestList);c.push(b);this.sendOperation(d.Constants.OperationCode.FindFriends,c)};a.prototype.requestLobbyStats=function(b){var c=[];if(b&&0<b.length){for(var m=[],k=[],t=0;t<b.length;++t)m[t]=b[t][0],k[t]=b[t][1];c.push(d.Constants.ParameterCode.LobbyName);c.push(m);c.push(d.Constants.ParameterCode.LobbyType);c.push(k)}this.sendOperation(d.Constants.OperationCode.LobbyStats,
138c)};return a}(n);d.MasterPeer=r;var u=function(e){function a(b,c,m,k){var t=e.call(this,c,m,k,b.logger.getPrefix()+" Game")||this;t.client=b;t.onEventNative=function(v,w){return t.client.onEventNative?t.client.onEventNative(v,w):!1};return t}__extends(a,e);a.prototype.onUnhandledEvent=function(b,c){this.client.onEvent(b,c.vals[d.Constants.ParameterCode.CustomEventContent],c.vals[d.Constants.ParameterCode.ActorNr])};a.prototype.onUnhandledResponse=function(b,c){this.client.onOperationResponse(c.errCode,
139c.errMsg,b,c.vals)};a.prototype.raiseEvent=function(b,c,m){if(this.client.isJoinedToRoom())this._logger.debug("raiseEvent",b,c,m),b=[d.Constants.ParameterCode.Code,g.TypeExt.Byte(b),d.Constants.ParameterCode.Data,c],m&&(void 0!=m.receivers&&m.receivers!==d.Constants.ReceiverGroup.Others&&(b.push(d.Constants.ParameterCode.ReceiverGroup),b.push(g.TypeExt.Byte(m.receivers))),void 0!=m.cache&&m.cache!==d.Constants.EventCaching.DoNotCache&&(b.push(d.Constants.ParameterCode.Cache),b.push(g.TypeExt.Byte(m.cache))),
140void 0!=m.interestGroup&&(this.checkGroupNumber(m.interestGroup)?(b.push(d.Constants.ParameterCode.Group),b.push(g.TypeExt.Byte(m.interestGroup))):this._logger.exception(502,"raiseEvent - Group not a number: "+m.interestGroup)),void 0!=m.targetActors&&(b.push(d.Constants.ParameterCode.ActorList),b.push(g.TypeExt.Int(m.targetActors))),m.webForward&&(b.push(d.Constants.ParameterCode.WebFlags),b.push(g.TypeExt.Byte(1)))),this.sendOperation(d.Constants.OperationCode.RaiseEvent,b);else throw Error("raiseEvent - Not joined!");
141};a.prototype.changeGroups=function(b,c){var m=[];null!=b&&void 0!=b&&(this.checkGroupArray(b,"groupsToRemove"),m.push(d.Constants.ParameterCode.Remove),m.push(g.TypeExt.Byte(b)));null!=c&&void 0!=c&&(this.checkGroupArray(c,"groupsToAdd"),m.push(d.Constants.ParameterCode.Add),m.push(g.TypeExt.Byte(c)));this.sendOperation(d.Constants.OperationCode.ChangeGroups,m)};a.prototype.checkGroupNumber=function(b){return!("number"!=typeof b||isNaN(b)||Infinity===b||-Infinity===b)};a.prototype.checkGroupArray=
142function(b,c){if(g.Util.isArray(b))for(var m=0;m<b.length;++m){var k=b[m];this.checkGroupNumber(k)||this._logger.exception(503,"changeGroups - "+c+" ("+b+") not an array of numbers: element "+m+" = "+k)}else this._logger.exception(504,"changeGroups - groupsToRemove not an array: "+b)};return a}(n);d.GamePeer=u}
142)(g.LoadBalancing||(g.LoadBalancing={}))})(Photon||(Photon={}));
143(function(g){g=g.Lite||(g.Lite={});g=g.Constants||(g.Constants={});g.LiteOpKey={ActorList:252,ActorNr:254,ActorProperties:249,Add:238,Broadcast:250,Cache:247,Code:244,Data:245,GameId:255,GameProperties:248,Group:240,Properties:251,ReceiverGroup:246,Remove:239,TargetActorNr:253,RoomTTL:236};g.LiteEventCode={Join:255,Leave:254,PropertiesChanged:253};g.LiteOpCode={ChangeGroups:248,GetProperties:251,Join:255,Leave:254,RaiseEvent:253,SetProperties:252}})(Photon||(Photon={}));
144(function(g){var d=g.LoadBalancing||(g.LoadBalancing={});d=d.Constants||(d.Constants={});var p=g.Lite.Constants.LiteOpKey,h=g.Lite.Constants.LiteOpCode;g=g.Lite.Constants.LiteEventCode;d.ErrorCode={Ok:0,OperationNotAllowedInCurrentState:-3,InvalidOperationCode:-2,InternalServerError:-1,InvalidAuthentication:32767,GameIdAlreadyExists:32766,GameFull:32765,GameClosed:32764,ServerFull:32762,UserBlocked:32761,NoRandomMatchFound:32760,GameDoesNotExist:32758,MaxCcuReached:32757,InvalidRegion:32756,CustomAuthenticationFailed:32755,
145AuthenticationTicketExpired:32753,PluginReportedError:32752,PluginMismatch:32751,JoinFailedPeerAlreadyJoined:32750,JoinFailedFoundInactiveJoiner:32749,JoinFailedWithRejoinerNotFound:32748,JoinFailedFoundExcludedUserId:32747,JoinFailedFoundActiveJoiner:32746,HttpLimitReached:32745,ExternalHttpCallFailed:32744,OperationLimitReached:32743,SlotError:32742,InvalidEncryptionParameters:32741};d.ActorProperties={PlayerName:255,UserId:253};d.GameProperties={MaxPlayers:255,IsVisible:254,IsOpen:253,PlayerCount:252,
146Removed:251,PropsListedInLobby:250,CleanupCacheOnLeave:249,MasterClientId:248,ExpectedUsers:247,PlayerTTL:246,RoomTTL:245};d.EventCode={GameList:230,GameListUpdate:229,QueueState:228,AppStats:226,AzureNodeInfo:210,Join:g.Join,Leave:g.Leave,PropertiesChanged:g.PropertiesChanged,Disconnect:252,LobbyStats:224,ErrorInfo:251,AuthEvent:223};d.ParameterCode={Address:230,PeerCount:229,GameCount:228,MasterPeerCount:227,UserId:225,ApplicationId:224,Position:223,MatchMakingType:223,GameList:222,Secret:221,AppVersion:220,
147AzureNodeInfo:210,AzureLocalNodeId:209,AzureMasterNodeId:208,RoomName:p.GameId,Broadcast:p.Broadcast,ActorList:p.ActorList,ActorNr:p.ActorNr,PlayerProperties:p.ActorProperties,CustomEventContent:p.Data,Data:p.Data,Code:p.Code,GameProperties:p.GameProperties,Properties:p.Properties,TargetActorNr:p.TargetActorNr,ReceiverGroup:p.ReceiverGroup,Cache:p.Cache,CleanupCacheOnLeave:241,Group:p.Group,Remove:p.Remove,Add:p.Add,RoomTTL:p.RoomTTL,PlayerTTL:235,Plugins:204,ClientAuthenticationType:217,ClientAuthenticationParams:216,
148ClientAuthenticationData:214,JoinMode:215,MasterClientId:203,FindFriendsRequestList:1,FindFriendsResponseOnlineList:1,FindFriendsResponseRoomIdList:2,LobbyName:213,LobbyType:212,LobbyStats:211,Region:210,IsInactive:233,CheckUserOnJoin:232,ExpectedValues:231,UriPath:209,RpcCallParams:208,RpcCallRetCode:207,RpcCallRetMessage:206,RpcCallRetData:208,WebFlags:234,Nickname:202,PublishUserId:239,Info:218};d.OperationCode={Authenticate:230,JoinLobby:229,LeaveLobby:228,CreateGame:227,JoinGame:226,JoinRandomGame:225,
149Leave:h.Leave,RaiseEvent:h.RaiseEvent,SetProperties:h.SetProperties,GetProperties:h.GetProperties,ChangeGroups:h.ChangeGroups,FindFriends:222,LobbyStats:221,GetRegions:220,Rpc:219};d.MatchmakingMode={FillRoom:0,SerialMatching:1,RandomMatching:2};d.EventCaching={DoNotCache:0,MergeCache:1,ReplaceCache:2,RemoveCache:3,AddToRoomCache:4,AddToRoomCacheGlobal:5,RemoveFromRoomCache:6,RemoveFromRoomCacheForActorsLeft:7};d.ReceiverGroup={Others:0,All:1,MasterClient:2};d.CustomAuthenticationType={Custom:0,Steam:1,
150Facebook:2,Oculus:3,PlayStation4:4,Xbox:5,Viveport:10,NintendoSwitch:11,PlayStation5:12,Epic:13,FacebookGaming:15,None:255};d.LobbyType={Default:0,SqlLobby:2,AsyncRandomLobby:3}})(Photon||(Photon={}));
151(function(g){(function(d){(function(p){var h;p.ParameterCode={Channels:0,Channel:1,Messages:2,Message:3,Senders:4,Sender:5,ChannelUserCount:6,UserId:225,MsgId:8,MsgIds:9,SubscribeResults:15,Status:10,Friends:11,SkipMessage:12,HistoryLength:14,WebFlags:21,Properties:22,ChannelSubscribers:23};p.OperationCode={Subscribe:0,Unsubscribe:1,Publish:2,SendPrivate:3,ChannelHistory:4,UpdateStatus:5,AddFriendds:6,RemoveFriends:7};p.EventCode={ChatMessages:0,Users:1,PrivateMessage:2,FriendsList:3,StatusUpdate:4,
152Subscribe:5,Unsubscribe:6,UserSubscribe:8,UserUnsubscribe:9};p.UserStatus={Offline:0,Invisible:1,Online:2,Away:3,Dnd:4,Lfg:5,Playing:6};var f=(h={},h[p.UserStatus.Offline]="Offline",h[p.UserStatus.Invisible]="Invisible",h[p.UserStatus.Online]="O
152nline",h[p.UserStatus.Away]="Away",h[p.UserStatus.Dnd]="Dnd",h[p.UserStatus.Lfg]="Lfg",h[p.UserStatus.Playing]="Playing",h);p.ChannelProperties={MaxSubscribers:255,PublishSubscribers:254};p.UserStatusToName=function(l){return f[l]}})(d.Constants||(d.Constants=
153{}))})(g.Chat||(g.Chat={}))})(Photon||(Photon={}));
154(function(g){(function(d){var p,h=function(){function n(q,r){this.sender=q;this.content=r}n.prototype.getSender=function(){return this.sender};n.prototype.getContent=function(){return this.content};return n}();d.Message=h;var f=function(){function n(q,r){this.name=q;this.isPrivat=r;this.messages=[];this.lastId=0;this.properties={};this.publishSubscribers=!1;this.maxSubscribers=0;this.subscribers={}}n.prototype.getName=function(){return this.name};n.prototype.isPrivate=function(){return this.isPrivat};
155n.prototype.getMessages=function(){return this.messages};n.prototype.getLastId=function(){return this.lastId};n.prototype.clearMessages=function(){this.messages.splice(0)};n.prototype.addMessages=function(q,r){for(var u=[],e=0;e<q.length;e++)if(e<r.length){var a=new h(q[e],r[e]);this.messages.push(a);u.push(a)}return u};n.prototype.readProperties=function(q){if(q){for(var r in q)this.properties[r]=null==q[r]?void 0:q[r];r=q[d.Constants.ChannelProperties.PublishSubscribers];void 0!=r&&(this.publishSubscribers=
156r);r=q[d.Constants.ChannelProperties.MaxSubscribers];void 0!=r&&(this.maxSubscribers=r)}};n.prototype.addSubscriber=function(q){return this.subscribers[q]||Object.keys(this.subscribers).length>this.maxSubscribers?!1:this.subscribers[q]=!0};n.prototype.removeSubscriber=function(q){if(!this.subscribers[q])return!1;delete this.subscribers[q];return!0};n.prototype.reset=function(){this.subscribers={};this.properties={}};return n}();d.Channel=f;var l=function(n){function q(r,u,e){r=n.call(this,r,u,e)||
157this;r.DefaultMaxSubscribers=100;r.publicChannels={};r.privateChannels={};r.subscribeRequests=[];r.unsubscribeRequests=[];r.autoJoinLobby=!1;return r}__extends(q,n);q.prototype.onStateChange=function(r){};q.prototype.onError=function(r,u){};q.prototype.onSubscribeResult=function(r){};q.prototype.onUnsubscribeResult=function(r){};q.prototype.onChatMessages=function(r,u){};q.prototype.onPrivateMessage=function(r,u){};q.prototype.onUserStatusUpdate=function(r,u,e,a){};q.prototype.onUserSubscribe=function(r,
158u){};q.prototype.onUserUnsubscribe=function(r,u){};q.prototype.connectToNameServer=function(r){return n.prototype.connectToNameServer.call(this,r)};q.prototype.connectToRegionFrontEnd=function(r){return this.connectToRegionMaster(r)};q.prototype.isConnectedToFrontEnd=function(){return this.state()==q.ChatState.ConnectedToFrontEnd};q.prototype.subscribe=function(r,u){"number"==typeof u&&(u={historyLength:u});if(this.masterPeer&&this.isConnectedToFrontEnd()){this.logger.debug("Subscribe channels:",
159r);var e=[];e.push(d.Constants.ParameterCode.Channels,g.TypeExt.String(r));if(u&&(u.historyLength&&e.push(d.Constants.ParameterCode.HistoryLength,g.TypeExt.Int(u.historyLength)),u.lastIds&&(e.push(d.Constants.ParameterCode.MsgIds,g.TypeExt.Int(u.lastIds)),void 0===u.historyLength&&e.push(d.Constants.ParameterCode.HistoryLength,g.TypeExt.Int(-1))),u.createOptions&&u.createOptions.publishSubscribers)){if(u.createOptions.maxSubscribers>this.DefaultMaxSubscribers)return this.logger.error("Cannot set MaxSubscribers > "+
160this.DefaultMaxSubscribers+" when PublishSubscribers == true."),!1;r=g.TypeExt.DictTypedKeys(g.TypeExtType.Object,g.TypeExtType.Object);g.TypeExt.PutTypedKey(r,g.TypeExt.Byte(d.Constants.ChannelProperties.PublishSubscribers),!0);g.TypeExt.PutTypedKey(r,g.TypeExt.Byte(d.Constants.ChannelProperties.MaxSubscribers),g.TypeExt.Int(u.createOptions.maxSubscribers));e.push(d.Constants.ParameterCode.Properties,r)}this.masterPeer.sendOperation(d.Constants.OperationCode.Subscribe,e);return!0}this.logger.error("subscribe request error:",
161"Not connected to Front End");return!1};q.prototype.unsubscribe=function(r){if(this.masterPeer&&this.isConnectedToFrontEnd()){this.logger.debug("Unsubscribe channels:",r);var u=[];u.push(d.Constants.ParameterCode.Channels,g.TypeExt.String(r));this.masterPeer.sendOperation(d.Constants.OperationCode.Unsubscribe,u);return!0}this.logger.error("unsubscribe request error:","Not connected to Front End");return!1};q.prototype.publishMessage=function(r,u,e){if(this.masterPeer&&this.isConnectedToFrontEnd()){var a=
162[];a.push(d.Constants.ParameterCode.Channel,r);a.push(d.Constants.ParameterCode.Message,u);e&&e.webForward&&(a.push(d.Constants.ParameterCode.WebFlags),a.push(g.TypeExt.Byte(1)));this.masterPeer.sendOperation(d.Constants.OperationCode.Publish,a);return!0}this.logger.error("publishMessage request error:","Not connected to Front End");return!1};q.prototype.sendPrivateMessage=function(r,u,e){if(this.masterPeer&&this.isConnectedToFrontEnd()){var a=[];a.push(d.Constants.ParameterCode.UserId,r);a.push(d.Constants.ParameterCode.Message,
163u);e&&e.webForward&&(a.push(d.Constants.ParameterCode.WebFlags),a.push(g.TypeExt.Byte(1)));this.masterPeer.sendOperation(d.Constants.OperationCode.SendPrivate,a);return!0}this.logger.error("sendPrivateMessage request error:","Not connected to Front End");return!1};q.prototype.setUserStatus=function(r,u,e){void 0===u&&(u=null);void 0===e&&(e=!1);if(this.masterPeer&&this.isConnectedToFrontEnd()){var a=[];a.push(d.Constants.ParameterCode.Status,g.TypeExt.Int(r));e?a.push(d.Constants.ParameterCode.SkipMessage,
164!0):a.push(d.Constants.ParameterCode.Message,u);this.masterPeer.sendOperation(d.Constants.OperationCode.UpdateStatus,a);return!0}this.logger.error("setUserStatus request error:","Not connected to Front End");return!1};q.prototype.addFriends=function(r){if(this.masterPeer&&this.isConnectedToFrontEnd()){var u=[];u.push(d.Constants.ParameterCode.Friends,g.TypeExt.String(r));this.masterPeer.sendOperation(d.Constants.OperationCode.AddFriendds,u);return!0}this.logger.error("addFriends request error:","Not connected to Front End");
165return!1};q.prototype.removeFriends=function(r){if(this.masterPeer&&this.isConnectedToFrontEnd()){var u=[];u.push(d.Constants.ParameterCode.Friends,g.TypeExt.String(r));this.masterPeer.sendOperation(d.Constants.OperationCode.RemoveFriends,u);return!0}this.logger.error("removeFriends request error:","Not connected to Front End");return!1};q.prototype.getPublicChannels=function(){return this.publicChannels};q.prototype.getPrivateChannels=function(){return this.privateChannels};q.prototype.getOrAddChannel=
166function(r,u,e){void 0==r[u]&&(r[u]=new f(u,e));return r[u]};q.prototype.initMasterPeer=function(r){var u=this;n.prototype.initMasterPeer.call(this,r);r.addEventListener(d.Constants.EventCode.ChatMessages,function(e){var a=e.vals[d.Constants.ParameterCode.Senders],b=e.vals[d.Constants.ParameterCode.Messages],c=e.vals[d.Constants.ParameterCode.Channel],m=u.publicChannels[c];m?(a=m.addMessages(a,b),m.lastId=e.vals[d.Constants.ParameterCode.MsgId],u.onChatMessages(c,a)):r._logger.warn("ev ChatMessages: Got message from unsubscribed channel ",
167c)});r.addEventListener(d.Constants.EventCode.PrivateMessage,function(e){var a=e.vals[d.Constants.ParameterCode.Sender],b=e.vals[d.Constants.ParameterCode.Message],c=e.vals[d.Constants.ParameterCode.UserId];c=u.getUserId()==a?c:a;u.getOrAddChannel(u.privateChannels,c,!0).lastId=e.vals[d.Constants.ParameterCode.MsgId];u.onPrivateMessage(c,new h(a,b))});r.addEventListener(d.Constants.EventCode.StatusUpdate,function(e){var a=e.vals[d.Constants.ParameterCode.Message];u.onUserStatusUpdate(e.vals[d.Constants.ParameterCode.Sender],
168e.vals[d.Constants.ParameterCode.Status],void 0!==a,a)});r.addEventListener(d.Constants.EventCode.Subscribe,function(e){r._logger.debug("ev Subscribe",e);var a={},b=e.vals[d.Constants.ParameterCode.Channels]||[],c=e.vals[d.Constants.ParameterCode.SubscribeResults]||[],m=!1,k=e.vals[d.Constants.ParameterCode.Properties];e=e.vals[d.Constants.ParameterCode.ChannelSubscribers];void 0!=k&&(1==b.length?m=!0:u.logger.error("Subscribe event for multiple channels with channels properties returned. Ignoring properties."));
169for(var t=0;t<b.length;t++){var v=b[t];a[v]=!1;if(t<c.length&&c[t]){var w=u.getOrAddChannel(u.publicChannels,v,!1);w.reset();a[v]=!0;if(m&&(w.readProperties(k),e))for(t=0;t<e.length;t++)if(!w.addSubscriber(e[t])){r._logger.error("Subscribe: channel '"+v+"' max subscribers exceeded");break}}}u.onSubscribeResult(a)});r.addEventListener(d.Constants.EventCode.Unsubscribe,function(e){r._logger.debug("ev Unsubscribe",e);var a={};e=e.vals[d.Constants.ParameterCode.Channels]||[];for(var b=0;b<e.length;b++){var c=
170e[b];delete u.publicChannels[c];a[c]=!0}u.onUnsubscribeResult(a)});r.addEventListener(d.Constants.EventCode.UserSubscribe,function(e){r._logger.debug("ev UserSubscribe",e);var a=e.vals[d.Constants.ParameterCode.Channel];e=e.vals[d.Constants.ParameterCode.UserId];var b=u.publicChannels[a];void 0==b?r._logger.error("UserSubscribe: channel '"+a+"' not found"):b.addSubscriber(e)||r._logger.error("UserSubscribe: channel '"+a+"' max subscribers exceeded");u.onUserSubscribe(a,e)});r.addEventListener(d.Constants.EventCode.UserUnsubscribe,
171function(e){r._logger.debug("ev UserUnsubscribe",e);var a=e.vals[d.Constants.ParameterCode.Channel];e=e.vals[d.Constants.ParameterCode.UserId];var b=u.publicChannels[a];void 0==b?r._logger.debug("UserUnsubscribe: channel '"+a+"' not found"):b.removeSubscriber(e)||r._logger.debug("UserUnsubscribe: subscriber '"+e+"' not found in channel '"+a+"'");u.onUserUnsubscribe(a,e)})};q.StateToName=function(r){var u=q.chatStateName[r];return void 0===u?n.StateToName.call(this,r):u};q.ChatPeerErrorCode={Ok:0,
172FrontEndError:1001,FrontEndConnectFailed:1002,FrontEndConnectClosed:1003,FrontEndTimeout:1004,FrontEndEncryptionEstablishError:1005,FrontEndAuthenticationFailed:1101,NameServerError:3001,NameServerConnectFailed:3002,NameServerConnectClosed:3003,NameServerTimeout:3004,NameServerEncryptionEstablishError:300,NameServerAuthenticationFailed:3101};q.ChatState={Error:-1,Uninitialized:0,ConnectingToNameServer:1,ConnectedToNameServer:2,ConnectingToFrontEnd:3,ConnectedToFrontEnd:4,Disconnected:10};q.chatStateName=
173(p={},p[q.ChatState.Error]="Error",p[q.ChatState.Uninitialized]="Uninitialized",p[q.ChatState.ConnectingToNameServer]="ConnectingToNameServer",p[q.ChatState.ConnectedToNameServer]="ConnectedToNameServer",p[q.ChatState.ConnectingToFrontEnd]="ConnectingToFrontEnd",p[q.ChatState.ConnectedToFrontEnd]="ConnectedToFrontEnd",p[q.ChatState.Disconnected]="Disconnected",p);return q}
173(g.LoadBalancing.LoadBalancingClient);d.ChatClient=l})(g.Chat||(g.Chat={}))})(Photon||(Photon={}));
174(function(g){g.IsEmscriptenBuild=g.IsEmscriptenBuildInternal;g.Version="4.3.2.0"})(Photon||(Photon={}));

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.