Commits

Martin Thorsen Ranang committed 12e3956

Updated Orbited.js with the command 'jsio_compile orbited.pkg -j ../../../../js.io/packages -o ../static/Orbited.js', where the js.io/packages were from Git commit e34b3934957420ac1313cd5e7d0aef5f2a1abe0f by Michael Carter.

Comments (0)

Files changed (1)

daemon/orbited/static/Orbited.js

-;(function(){var ENV,sourceCache={'std.base64':{"src":"\nvar alphabet='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_';var pad='=';var padChar=alphabet.charAt(alphabet.length-1);var shorten=function(array,number){for(var i=number;i>0;i--){array.pop();};};var decode_map={};for(var i=0,n=alphabet.length;i<n;i++){decode_map[alphabet.charAt(i)]=i;};var alphabet_inverse=new RegExp('[^'+alphabet.replace('-','\\\\-')+']');var Base64CodecError=exports.Base64CodecError=function(message){this.message=message;};Base64CodecError.prototype.toString=function(){return'Base64CodecError'+(this.message?': '+this.message:'');};var assertOrBadInput=function(exp,message){if(!exp){throw new Base64CodecError(message)};};exports.encode=function(bytes){assertOrBadInput(!(/[^\\x00-\\xFF]/.test(bytes)),'Input contains out-of-range characters.');var padding='\\x00\\x00\\x00'.slice((bytes.length%3)||3);bytes+=padding;var out_array=[];for(var i=0,n=bytes.length;i<n;i+=3){var newchars=((bytes.charCodeAt(i)<<020)+\n(bytes.charCodeAt(i+1)<<010)+\n(bytes.charCodeAt(i+2)));out_array.push(alphabet.charAt((newchars>>18)&077),alphabet.charAt((newchars>>12)&077),alphabet.charAt((newchars>>6)&077),alphabet.charAt((newchars)&077));};shorten(out_array,padding.length);return out_array.join('');};exports.decode=function(b64text){logger.debug('decode',b64text);b64text=b64text.replace(/\\s/g,'')\nvar i=b64text.length;while(b64text.charAt(--i)===pad){};b64text=b64text.slice(0,i+1);assertOrBadInput(!alphabet_inverse.test(b64text),'Input contains out-of-range characters.');var padding=Array(5-((b64text.length%4)||4)).join(padChar);b64text+=padding;var out_array=[];for(var i=0,n=b64text.length;i<n;i+=4){newchars=((decode_map[b64text.charAt(i)]<<18)+\n(decode_map[b64text.charAt(i+1)]<<12)+\n(decode_map[b64text.charAt(i+2)]<<6)+\n(decode_map[b64text.charAt(i+3)]));out_array.push((newchars>>020)&0xFF,(newchars>>010)&0xFF,(newchars)&0xFF);};shorten(out_array,padding.length);var result=String.fromCharCode.apply(String,out_array);logger.debug('decoded',result);return result;};","filePath":"jsio/std/base64.js"},'net.env':{"src":"\nfunction getObj(objectName,transportName,envName){try{jsio('from .env.'+(envName||jsio.__env.name)+'.'+transportName+' import '+objectName+' as result');}catch(e){throw logger.error('Invalid transport (',transportName,') or environment (',envName,')');}\nreturn result;}\nexports.getListener=bind(this,getObj,'Listener');exports.getConnector=bind(this,getObj,'Connector');","filePath":"jsio/net/env.js"},'logging':{"src":"\nexports.UIWatcher=Class(function(){});","filePath":"jsio/logging.js"},'lib.Enum':{"src":"\nexports=function(){if(arguments.length==1){if(typeof arguments[0]=='object'){var obj=arguments[0];for(var i in obj){if(!(obj[i]in obj)){obj[obj[i]]=i;}}\nreturn obj;}else if(typeof arguments[0]!='string'){keys=arguments[0];}}\nif(!keys){var keys=arguments;}\nvar obj={};for(var i=0,len=keys.length;i<len;++i){if(keys[i]){obj[keys[i]]=i+1;}\nobj[i+1]=keys[i];}\nreturn obj;}","filePath":"jsio/lib/Enum.js"},'net.errors':{"src":"\nvar makeErrorClass=function(name,_code){var toString=function(){return name+(this.message?': '+this.message:'');}\nvar ctor=function(data){if(typeof data=='string'){this.message=data;}else{this.data=data;}}\nctor.prototype={type:name,toString:toString};return ctor;}\nexports.ReadyStateError=makeErrorClass(\"ReadyStateError\");exports.InvalidEncodingError=makeErrorClass(\"InvalidEncodingError\");exports.ExpiredSession=makeErrorClass(\"ExpiredSession\");exports.ServerUnreachable=makeErrorClass(\"ServerUnreachable\",100);exports.ConnectionTimeout=makeErrorClass(\"ConnectionTimeout\",101);exports.ServerProtocolError=makeErrorClass(\"ServerProtocolError\",200);exports.ServerClosedConnection=makeErrorClass(\"ServerClosedConnection\",301);exports.ConnectionClosedCleanly=makeErrorClass(\"ConnectionClosedCleanly\",300);","filePath":"jsio/net/errors.js"},'net.env.browser.csp':{"src":"\njsio('import net.interfaces');jsio('from net.csp.client import CometSession');jsio('import std.utf8 as utf8');exports.Connector=Class(net.interfaces.Connector,function(){this.connect=function(){this._state=net.interfaces.STATE.CONNECTING;var conn=new CometSession();conn.onconnect=bind(this,'cometSessionOnConnect',conn);conn.ondisconnect=bind(this,'onDisconnect');logger.debug('opening the connection');this._opts.encoding='plain';var url=this._opts.url;delete this._opts.url;conn.connect(url,this._opts);}\nthis.cometSessionOnConnect=function(conn){logger.debug('conn has opened');this.onConnect(new Transport(conn));}});var Transport=Class(net.interfaces.Transport,function(){this.init=function(conn){this._conn=conn;}\nthis.makeConnection=function(protocol){this._conn.onread=bind(protocol,'dataReceived');}\nthis.write=function(data){this._conn.write(this._encoding=='utf8'?utf8.encode(data):data);}\nthis.loseConnection=function(protocol){this._conn.close();}});","filePath":"jsio/net/env/browser/csp.js"},'net.csp.transports':{"src":"\njsio('import std.uri as uri');jsio('import std.base64 as base64');jsio('from util.browserdetect import BrowserDetect');;(function(){var doc;exports.getDoc=function(){if(doc){return doc;}\ntry{doc=window.ActiveXObject&&new ActiveXObject('htmlfile');if(doc){doc.open().write('<html></html>');doc.close();window.attachEvent('onunload',function(){try{doc.body.innerHTML='';}catch(e){}\ndoc=null;});}}catch(e){}\nif(!doc){doc=document;}\nreturn doc;};exports.XHR=function(){var win=window,doc=exports.getDoc();return new(exports.XHR=win.XMLHttpRequest?win.XMLHttpRequest:function(){return win.ActiveXObject&&new win.ActiveXObject('Msxml2.XMLHTTP')||null;});}\nexports.createXHR=function(){return new exports.XHR();}})();function isLocalFile(url){return/^file:\\/\\//.test(url);}\nfunction isWindowDomain(url){return uri.isSameDomain(url,window.location.href);}\nfunction canUseXHR(url){if(isLocalFile(url)){return false;}\nvar xhr=new exports.XHR();if(!xhr){return false;}\nif(isWindowDomain(url)){return true;}\nif(window.XMLHttpRequest&&(xhr.__proto__==XMLHttpRequest.prototype||xhr instanceof window.XMLHttpRequest)&&xhr.withCredentials!==undefined||window.XDomainRequest&&xhr instanceof window.XDomainRequest){return true;}};var transports=exports.transports={};exports.chooseTransport=function(url,options){switch(options.preferredTransport){case'jsonp':return transports.jsonp;case'xhr':default:if(canUseXHR(url)){return transports.xhr;};return transports.jsonp;}};var PARAMS={'xhrstream':{\"is\":\"1\",\"bs\":\"\\n\"},'xhrpoll':{\"du\":\"0\"},'xhrlongpoll':{},'sselongpoll':{\"bp\":\"data: \",\"bs\":\"\\r\\n\",\"se\":\"1\"},'ssestream':{\"bp\":\"data: \",\"bs\":\"\\r\\n\",\"se\":\"1\",\"is\":\"1\"}};exports.Transport=Class(function(supr){this.handshake=function(url,options){throw new Error(\"handshake Not Implemented\");};this.comet=function(url,sessionKey,lastEventId,options){throw new Error(\"comet Not Implemented\");};this.send=function(url,sessionKey,data,options){throw new Error(\"send Not Implemented\");};this.encodePacket=function(packetId,data,options){throw new Error(\"encodePacket Not Implemented\");};this.abort=function(){throw new Error(\"abort Not Implemented\");};});var baseTransport=Class(exports.Transport,function(supr){this.init=function(){this._aborted=false;this._handshakeArgs={d:'{}',ct:'application/javascript'};};this.handshake=function(url,options){logger.debug('handshake:',url,options);this._makeRequest('send',url+'/handshake',this._handshakeArgs,this.handshakeSuccess,this.handshakeFailure);};this.comet=function(url,sessionKey,lastEventId,options){logger.debug('comet:',url,sessionKey,lastEventId,options);args={s:sessionKey,a:lastEventId};this._makeRequest('comet',url+'/comet',args,this.cometSuccess,this.cometFailure);};this.send=function(url,sessionKey,lastEventId,data,options){logger.debug('send:',url,sessionKey,data,options);args={d:data,s:sessionKey,a:lastEventId};this._makeRequest('send',url+'/send',args,this.sendSuccess,this.sendFailure);};});transports.xhr=Class(baseTransport,function(supr){this.init=function(){supr(this,'init');this._xhr={'send':new exports.XHR(),'comet':new exports.XHR()};};this.abort=function(){this._aborted=true;for(var i in this._xhr){if(this._xhr.hasOwnProperty(i)){this._abortXHR(i);}}};this._abortXHR=function(type){logger.debug('aborting XHR');var xhr=this._xhr[type];try{if('onload'in xhr){xhr.onload=xhr.onerror=xhr.ontimeout=null;}else if('onreadystatechange'in xhr){xhr.onreadystatechange=null;}\nif(xhr.abort){xhr.abort();}}catch(e){logger.debug('error aborting xhr',e);}\nthis._xhr[type]=new exports.XHR();};var mustEncode=!(exports.createXHR().sendAsBinary);this.encodePacket=function(packetId,data,options){return mustEncode?[packetId,1,base64.encode(data)]:[packetId,0,data];};this._onReadyStateChange=function(rType,cb,eb){var response='',xhr=this._xhr[rType];try{var data={status:xhr.status};}catch(e){eb({response:'Could not access status'});}\ntry{if(xhr.readyState!=4){return;}\ndata.response=eval(xhr.responseText);if(data.status!=200){logger.debug('XHR failed with status ',xhr.status);eb(data);return;}\nlogger.debug('XHR data received');}catch(e){logger.debug('Error in XHR::onReadyStateChange',e);eb(data);this._abortXHR(rType);logger.debug('done handling XHR error');return;}\ncb(data);};this._makeRequest=function(rType,url,args,cb,eb){if(this._aborted){return;}\nvar xhr=this._xhr[rType],data=args.d||null;if('d'in args){delete args.d;}\nxhr.open('POST',url+'?'+uri.buildQuery(args));xhr.setRequestHeader('Content-Type','text/plain');if('onload'in xhr){xhr.onload=bind(this,'_onReadyStateChange',rType,cb,eb);xhr.onerror=xhr.ontimeout=eb;}else if('onreadystatechange'in xhr){xhr.onreadystatechange=bind(this,'_onReadyStateChange',rType,cb,eb);}\nvar supportsBinary=!!xhr.sendAsBinary;if(supportsBinary){}\nsetTimeout(bind(xhr,supportsBinary?'sendAsBinary':'send',data),0);};});var EMPTY_FUNCTION=function(){},SLICE=Array.prototype.slice;transports.jsonp=Class(baseTransport,function(supr){var doc;var createIframe=function(){var doc=exports.getDoc();if(!doc.body){return false;}\nvar i=doc.createElement(\"iframe\");with(i.style){display='block';width=height=border=margin=padding='0';overflow=visibility='hidden';position='absolute';top=left='-999px';}\ni.cbId=0;doc.body.appendChild(i);i.src='javascript:var d=document;d.open();d.write(\"<html><body></body></html>\");d.close();';return i;};var cleanupIframe=function(ifr){var win=ifr.contentWindow,doc=win.document;logger.debug('removing script tags');var scripts=doc.getElementsByTagName('script');for(var i=scripts.length-1;i>=0;--i){doc.body.removeChild(scripts[i]);}\nlogger.debug('deleting iframe callbacks');win['cb'+ifr.cbId]=win['eb'+ifr.cbId]=EMPTY_FUNCTION;};var removeIframe=function(ifr){$setTimeout(function(){if(ifr&&ifr.parentNode){ifr.parentNode.removeChild(ifr);}},60000);};this.init=function(){supr(this,'init');this._onReady=[];this._isReady=false;this._createIframes();};this._createIframes=function(){this._ifr={send:createIframe(),comet:createIframe()};if(this._ifr.send===false){return $setTimeout(bind(this,'_createIframes'),100);}\nthis._isReady=true;var readyArgs=this._onReady;this._onReady=[];for(var i=0,args;args=readyArgs[i];++i){this._makeRequest.apply(this,args);}};this.encodePacket=function(packetId,data,options){return[packetId,1,base64.encode(data)];};this.abort=function(){this._aborted=true;for(var i in this._ifr){if(this._ifr.hasOwnProperty(i)){var ifr=this._ifr[i];cleanupIframe(ifr);removeIframe(ifr);}}};this._makeRequest=function(rType,url,args,cb,eb){if(!this._isReady){return this._onReady.push(arguments);}\nvar ifr=this._ifr[rType],id=++ifr.cbId,req={type:rType,id:id,cb:cb,eb:eb,cbName:'cb'+id,ebName:'eb'+id,completed:false};args.n=Math.random();switch(rType){case'send':args.rs=';';args.rp=req.cbName;break;case'comet':args.bs=';';args.bp=req.cbName;break;}\nreq.url=url+'?'+uri.buildQuery(args)\n$setTimeout(bind(this,'_request',req),0);}\nthis._request=function(req){var ifr=this._ifr[req.type],win=ifr.contentWindow,doc=win.document,body=doc.body;win[req.ebName]=bind(this,checkForError,req);win[req.cbName]=bind(this,onSuccess,req);if(BrowserDetect.isWebKit){doc.open();doc.write('<scr'+'ipt src=\"'+req.url+'\"></scr'+'ipt><scr'+'ipt>'+ebName+'(false)</scr'+'ipt>');doc.close();}else{var s=doc.createElement('script');s.src=req.url;if(s.onreadystatechange===null){s.onreadystatechange=bind(this,onReadyStateChange,req,s);}\nbody.appendChild(s);if(!BrowserDetect.isIE){var s=doc.createElement('script');s.innerHTML=req.ebName+'(false)';body.appendChild(s);}}\nkillLoadingBar();};function onSuccess(req,response){logger.debug('successful: ',req.url,response);req.completed=true;logger.debug('calling the cb');req.cb.call(GLOBAL,{status:200,response:response});logger.debug('cb called');}\nfunction onReadyStateChange(req,scriptTag){if(scriptTag&&scriptTag.readyState!='loaded'){return;}\nscriptTag.onreadystatechange=function(){};checkForError.call(this,req);}\nfunction checkForError(req,response){cleanupIframe(this._ifr[req.type]);if(!req.completed){var data={status:response?200:404,response:response||'Unable to load resouce'};logger.debug('error making request:',req.url,data);logger.debug('calling eb');req.eb.call(GLOBAL,data);}}\nvar killLoadingBar=BrowserDetect.isFirefox?function(){var b=document.body;if(!b){return;}\nif(!killLoadingBar.iframe){killLoadingBar.iframe=document.createElement('iframe');}\nb.insertBefore(killLoadingBar.iframe,b.firstChild);b.removeChild(killLoadingBar.iframe);}:function(){};});","filePath":"jsio/net/csp/transports.js"},'net.interfaces':{"src":"\njsio('import net');jsio('import lib.Enum as Enum');var ctx=jsio.__env.global;exports.Protocol=Class(function(){this.connectionMade=function(isReconnect){}\nthis.dataReceived=function(data){}\nthis.connectionLost=function(reason){}});exports.Client=Class(function(){this.init=function(protocol){this._protocol=protocol;}\nthis.connect=function(transportName,opts){this._remote=new this._protocol();this._remote._client=this;net.connect(this._remote,transportName,opts);}});exports.Server=Class(function(){this.init=function(protocolClass){this._protocolClass=protocolClass;}\nthis.buildProtocol=function(){return new this._protocolClass();}\nthis.listen=function(how,port){return net.listen(this,how,port);}});exports.Transport=Class(function(){this._encoding='plain'\nthis.write=function(data,encoding){throw new Error(\"Not implemented\");}\nthis.getPeer=function(){throw new Error(\"Not implemented\");}\nthis.setEncoding=function(encoding){this._encoding=encoding;}\nthis.getEncoding=function(){return this._encoding;}});exports.Listener=Class(function(){this.init=function(server,opts){this._server=server;this._opts=opts||{};}\nthis.onConnect=function(transport){var p=this._server.buildProtocol();p.transport=transport;p.server=this._server;transport.protocol=p;transport.makeConnection(p);p.connectionMade();}\nthis.listen=function(){throw new Error('Abstract class');}\nthis.stop=function(){}});exports.STATE=Enum('INITIAL','DISCONNECTED','CONNECTING','CONNECTED');exports.Connector=Class(function(){this.init=function(protocol,opts){this._protocol=protocol;this._opts=opts;this._state=exports.STATE.INITIAL;}\nthis.onConnect=function(transport){this._state=exports.STATE.CONNECTED;transport.makeConnection(this._protocol);this._protocol.transport=transport;try{this._protocol.connectionMade();}catch(e){throw logger.error(e);}}\nthis.onDisconnect=function(err){var wasConnected=this._state==exports.STATE.CONNECTED;this._state=exports.STATE.DISCONNECTED;try{this._protocol.connectionLost(err,wasConnected);}catch(e){throw logger.error(e);}}\nthis.getProtocol=function(){return this._protocol;}});","filePath":"jsio/net/interfaces.js"},'net.buffer':{"src":"\njsio('from net.interfaces import Protocol');var EmptyBufferError=exports.EmptyBufferError=Class(function(){this.init=function(message){this.message=message;}})\nexports.Buffer=Class(function(supr){this.init=function(rawBuffer){this._rawBuffer=!!rawBuffer?rawBuffer:\"\";}\nthis.getLength=function(){return this._rawBuffer.length;}\nthis.append=function(data){logger.debug('append',JSON.stringify(data));this._rawBuffer+=data;}\nthis.peekBytes=function(num){if(!!num)\nreturn this._rawBuffer.slice(0,num);else\nreturn this._rawBuffer;}\nthis.peekToDelimiter=function(delimiter){delimiter=delimiter?delimiter:'\\n';var i=this._rawBuffer.indexOf(delimiter);if(i==-1)\nthrow new EmptyBufferError(\"delimiter \"+delimiter+\"not present in buffer\");else\nreturn this._rawBuffer.slice(0,i);}\nthis.consumeBytes=function(num){var output=this.peekBytes(num);this._rawBuffer=this._rawBuffer.slice(output.length);return output;}\nthis.consumeMaxBytes=function(num){var output=this._rawBuffer.slice(0,num);this._rawBuffer=this._rawBuffer(num);return output;}\nthis.consumeAllBytes=function(){var temp=this._rawBuffer;this._rawBuffer=\"\";return temp;}\nthis.consumeThroughDelimiter=function(delimiter){return this.consumeToDelimiter(delimiter)+this.consumeBytes(delimiter.length);}\nthis.consumeToDelimiter=function(delimiter){delimiter=!!delimiter?delimiter:\"\\n\"\nvar output=this.peekToDelimiter(delimiter);this._rawBuffer=this._rawBuffer.slice(output.length);return output;}\nthis.hasBytes=function(num){num=num?num:0;return this._rawBuffer.length>=num;}\nthis.hasDelimiter=function(delimiter){delimiter=!!delimiter?delimiter:'\\n';return(this._rawBuffer.indexOf(delimiter)!=-1);}})","filePath":"jsio/net/buffer.js"},'net.csp.client':{"src":"\njsio('import std.base64 as base64');jsio('import std.utf8 as utf8');jsio('import std.uri as uri');jsio('import net.errors as errors');jsio('import .transports');jsio('import lib.Enum as Enum');var READYSTATE=exports.READYSTATE=Enum({INITIAL:0,CONNECTING:1,CONNECTED:2,DISCONNECTING:3,DISCONNECTED:4});exports.CometSession=Class(function(supr){var id=0;var kDefaultBackoff=50;var kDefaultTimeoutInterval=45000;var kDefaultHandshakeTimeout=10000;this.init=function(){this._id=++id;this._url=null;this.readyState=READYSTATE.INITIAL;this._sessionKey=null;this._transport=null;this._options=null;this._utf8ReadBuffer=\"\";this._writeBuffer=\"\";this._packetsInFlight=null;this._lastEventId=null;this._lastSentId=null;this._handshakeLater=null;this._handshakeBackoff=kDefaultBackoff;this._handshakeRetryTimer=null;this._handshakeTimeoutTimer=null;this._timeoutTimer=null;this._writeBackoff=kDefaultBackoff;this._cometBackoff=kDefaultBackoff;this._nullInBuffer=false;this._nullInFlight=false;this._nullSent=false;this._nullReceived=false;}\nthis.setEncoding=function(encoding){if(encoding==this._options.encoding){return;}\nif(encoding!='utf8'&&encoding!='plain'){throw new errors.InvalidEncodingError();}\nif(encoding=='plain'&&this._buffer){var buffer=this._utf8ReadBuffer;this._utf8ReadBuffer=\"\";this._doOnRead(buffer);}\nthis._options.encoding=encoding;}\nthis.connect=function(url,options){this._url=url.replace(/\\/$/,'');this._options=options||{};this._options.encoding=this._options.encoding||'utf8';this.setEncoding(this._options.encoding);this._options.connectTimeout=this._options.connectTimeout||kDefaultHandshakeTimeout;var transportClass=transports.chooseTransport(url,this._options);this._transport=new transportClass();this._transport.handshakeFailure=bind(this,this._handshakeFailure);this._transport.handshakeSuccess=bind(this,this._handshakeSuccess);this._transport.cometFailure=bind(this,this._cometFailure);this._transport.cometSuccess=bind(this,this._cometSuccess);this._transport.sendFailure=bind(this,this._writeFailure);this._transport.sendSuccess=bind(this,this._writeSuccess);this.readyState=READYSTATE.CONNECTING;this._transport.handshake(this._url,this._options);this._handshakeTimeoutTimer=$setTimeout(bind(this,this._handshakeTimeout),this._options.connectTimeout);}\nthis.write=function(data,encoding){if(this.readyState!=READYSTATE.CONNECTED){throw new errors.ReadyStateError();}\nencoding=encoding||this._options.encoding||'utf8';if(encoding=='utf8'){data=utf8.encode(data);}\nthis._writeBuffer+=data;this._doWrite();}\nthis._protocolError=function(msg){logger.debug('_protocolError',msg);this.readyState=READYSTATE.DISCONNECTED;this._doWrite(true);this._doOnDisconnect(new errors.ServerProtocolError(msg));}\nthis._receivedNullPacket=function(){logger.debug('_receivedNullPacket');this._receivedNull=true;if(!(this._nullInFlight||this._nullInBuffer||this._nullSent)){this.readyState=READYSTATE.DISCONNECTING;this._doWrite(true);}\nelse{this.readyState=READYSTATE.DISCONNECTED;}\nthis._doOnDisconnect(new errors.ConnectionClosedCleanly());}\nthis._sentNullPacket=function(){logger.debug('_sentNullPacket');this._nullSent=true;if(this._nullSent&&this._nullReceived){this.readyState=READYSTATE.DISCONNECTED;}}\nthis.close=function(err){logger.debug('close called',err,'readyState',this.readyState);switch(this.readyState){case READYSTATE.CONNECTING:clearTimeout(this._handshakeRetryTimer);clearTimeout(this._handshakeTimeoutTimer);this.readyState=READYSTATE.DISCONNECTED;this._doOnDisconnect(err);break;case READYSTATE.CONNECTED:this.readyState=READYSTATE.DISCONNECTING;this._doWrite(true);clearTimeout(this._timeoutTimer);break;case READYSTATE.DISCONNECTED:throw new errors.ReadyStateError(\"Session is already disconnected\");break;}\nthis._sessionKey=null;this._opened=false;this.readyState=READYSTATE.DISCONNECTED;this._doOnDisconnect(err);}\nthis._handshakeTimeout=function(){logger.debug('handshake timeout');this._handshakeTimeoutTimer=null;this._doOnDisconnect(new errors.ServerUnreachable());}\nthis._handshakeSuccess=function(data){logger.debug('handshake success',data);if(this.readyState!=READYSTATE.CONNECTING){logger.debug('received handshake success in invalid readyState:',this.readyState);return;}\nclearTimeout(this._handshakeTimeoutTimer);this._handshakeTimeoutTimer=null;this._sessionKey=data.response.session;this._opened=true;this.readyState=READYSTATE.CONNECTED;this._doOnConnect();this._doConnectComet();}\nthis._handshakeFailure=function(data){logger.debug('handshake failure',data);if(this.readyState!=READYSTATE.CONNECTING){return;}\nif(data.status==404){clearTimeout(this._handshakeTimeoutTimer);return this._doOnDisconnect(new errors.ServerUnreachable());}\nlogger.debug('trying again in ',this._handshakeBackoff);this._handshakeRetryTimer=$setTimeout(bind(this,function(){this._handshakeRetryTimer=null;this._transport.handshake(this._url,this._options);}),this._handshakeBackoff);this._handshakeBackoff*=2;}\nthis._writeSuccess=function(){if(this.readyState!=READYSTATE.CONNECTED&&this.readyState!=READYSTATE.DISCONNECTING){return;}\nif(this._nullInFlight){return this._sentNullPacket();}\nthis._resetTimeoutTimer();this.writeBackoff=kDefaultBackoff;this._packetsInFlight=null;if(this._writeBuffer||this._nullInBuffer){this._doWrite(this._nullInBuffer);}}\nthis._writeFailure=function(){if(this.readyState!=READYSTATE.CONNECTED&&this.READYSTATE!=READYSTATE.DISCONNECTING){return;}\nthis._writeTimer=$setTimeout(bind(this,function(){this._writeTimer=null;this.__doWrite(this._nullInBuffer);}),this._writeBackoff);this._writeBackoff*=2;}\nthis._doWrite=function(sendNull){if(this._packetsInFlight){if(sendNull){this._nullInBuffer=true;return;}\nreturn;}\nthis.__doWrite(sendNull);}\nthis.__doWrite=function(sendNull){logger.debug('_writeBuffer:',this._writeBuffer);if(!this._packetsInFlight&&this._writeBuffer){this._packetsInFlight=[this._transport.encodePacket(++this._lastSentId,this._writeBuffer,this._options)];this._writeBuffer=\"\";}\nif(sendNull&&!this._writeBuffer){if(!this._packetsInFlight){this._packetsInFlight=[];}\nthis._packetsInFlight.push([++this._lastSentId,0,null]);this._nullInFlight=true;}\nif(!this._packetsInFlight){logger.debug(\"no packets to send\");return;}\nlogger.debug('sending packets:',JSON.stringify(this._packetsInFlight));this._transport.send(this._url,this._sessionKey,this._lastEventId||0,JSON.stringify(this._packetsInFlight),this._options);}\nthis._doConnectComet=function(){logger.debug('_doConnectComet');this._transport.comet(this._url,this._sessionKey,this._lastEventId||0,this._options);}\nthis._cometFailure=function(data){if(this.readyState!=READYSTATE.CONNECTED){return;}\nif(data.status==404&&data.response=='Session not found'){return this.close(new errors.ExpiredSession(data));}\nthis._cometTimer=$setTimeout(bind(this,function(){this._doConnectComet();}),this._cometBackoff);this._cometBackoff*=2;}\nthis._cometSuccess=function(data){if(this.readyState!=READYSTATE.CONNECTED&&this.readyState!=READYSTATE.DISCONNECTING){return;}\nlogger.debug('comet Success:',data);this._cometBackoff=kDefaultBackoff;this._resetTimeoutTimer();var response=data.response;for(var i=0,packet;(packet=response[i])||i<response.length;i++){logger.debug('process packet:',packet);if(packet===null){return this.close(new errors.ServerProtocolError(data));}\nlogger.debug('process packet',packet);var ackId=packet[0];var encoding=packet[1];var data=packet[2];if(typeof(this._lastEventId)=='number'&&ackId<=this._lastEventId){continue;}\nif(typeof(this._lastEventId)=='number'&&ackId!=this._lastEventId+1){return this._protocolError(\"Ack id too high\");}\nthis._lastEventId=ackId;if(data==null){return this._receivedNullPacket();}\nif(encoding==1){try{logger.debug('before base64 decode:',data);data=base64.decode(data);logger.debug('after base64 decode:',data);}catch(e){return this._protocolError(\"Unable to decode base64 payload\");}}\nif(this._options.encoding=='utf8'){this._utf8ReadBuffer+=data;logger.debug('before utf8 decode, _utf8ReadBuffer:',this._utf8ReadBuffer);var result=utf8.decode(this._utf8ReadBuffer);data=result[0];this._utf8ReadBuffer=this._utf8ReadBuffer.slice(result[1]);logger.debug('after utf8 decode, _utf8ReadBuffer:',this._utf8ReadBuffer,'data:',data);}\nlogger.debug('dispatching data:',data);try{this._doOnRead(data);}catch(e){logger.error('application code threw an error. (re-throwing in timeout):',e);setTimeout(function(){logger.debug('timeout fired, throwing error',e);throw e;},0);}}\nthis._doConnectComet();}\nthis._doOnRead=function(data){if(typeof(this.onread)=='function'){logger.debug('call onread function',data);this.onread(data);}\nelse{logger.debug('skipping onread callback (function missing)');}}\nthis._doOnDisconnect=function(err){if(typeof(this.ondisconnect)=='function'){logger.debug('call ondisconnect function',err);this.ondisconnect(err);}\nelse{logger.debug('skipping ondisconnect callback (function missing)');}}\nthis._doOnConnect=function(){if(typeof(this.onconnect)=='function'){logger.debug('call onconnect function');try{this.onconnect();}catch(e){logger.debug('onconnect caused errror',e);setTimeout(function(){throw e},0);}}\nelse{logger.debug('skipping onconnect callback (function missing)');}}\nthis._resetTimeoutTimer=function(){clearTimeout(this._timeoutTimer);this._timeoutTimer=$setTimeout(bind(this,function(){logger.debug('connection timeout expired');this.close(new errors.ConnectionTimeout())}),this._getTimeoutInterval())}\nthis._getTimeoutInterval=function(){return kDefaultTimeoutInterval;}});","filePath":"jsio/net/csp/client.js"},'base':{"src":"\nexports.log=jsio.__env.log;exports.GLOBAL=jsio.__env.global;exports.bind=function(context,method){if(arguments.length>2){var args=Array.prototype.slice.call(arguments,2);return typeof method=='string'?function(){if(context[method]){return context[method].apply(context,args.concat(Array.prototype.slice.call(arguments,0)));}else{throw logger.error('No method:',method,'for context',context);}}:function(){return method.apply(context,args.concat(Array.prototype.slice.call(arguments,0)));}}else{return typeof method=='string'?function(){if(context[method]){return context[method].apply(context,arguments);}else{throw logger.error('No method:',method,'for context',context);}}:function(){return method.apply(context,arguments);}}}\nexports.Class=function(parent,proto){if(!parent){throw new Error('parent or prototype not provided');}\nif(!proto){proto=parent;parent=null;}\nelse if(parent instanceof Array){proto.prototype={};for(var i=0,p;p=parent[i];++i){for(var item in p.prototype){if(!(item in proto.prototype)){proto.prototype[item]=p.prototype[item];}}}\nparent=parent[0];}else{proto.prototype=parent.prototype;}\nvar cls=function(){if(this.init){return this.init.apply(this,arguments);}}\ncls.prototype=new proto(parent?function(context,method,args){var args=args||[];var target=proto;while(target=target.prototype){if(target[method]){return target[method].apply(context,args);}}\nthrow new Error('method '+method+' does not exist');}:null);cls.prototype.constructor=cls;return cls;}\nexports.$setTimeout=function(f,t){var args=Array.prototype.slice.call(arguments,2);return setTimeout(function(){try{f.apply(this,args);}catch(e){}},t)}\nexports.$setInterval=function(f,t){var args=Array.prototype.slice.call(arguments,2);return setInterval(function(){try{f.apply(this,args);}catch(e){}},t)}\nexports.$clearTimeout=function(timer){return timer?clearTimeout(timer):null;};exports.$clearInterval=function(timer){return timer?clearInterval(timer):null;};exports.logging=(function(){var logging={DEBUG:1,LOG:2,INFO:3,WARN:4,ERROR:5},loggers={},production=false;logging.setProduction=function(prod){production=!!prod;}\nlogging.get=function(name){return loggers.hasOwnProperty(name)?loggers[name]:(loggers[name]=new Logger(name));}\nlogging.set=function(name,_logger){loggers[name]=_logger;}\nlogging.getAll=function(){return loggers;}\nlogging.__create=function(pkg,ctx){ctx.logger=logging.get(pkg);}\nvar Logger=exports.Class(function(){this.init=function(name,level){this._name=name;this._level=level||logging.LOG;this._listener=exports.log;}\nthis.setLevel=function(level){this._level=level;}\nvar SLICE=Array.prototype.slice;function makeLogFunction(level,type){return function(){if(!production&&level>=this._level){return this._listener.apply(this._listener,[type,this._name].concat(SLICE.call(arguments)));}\nreturn arguments[0];}}\nthis.setListener=function(listener){log=listener;}\nthis.debug=makeLogFunction(logging.DEBUG,\"DEBUG\");this.log=makeLogFunction(logging.LOG,\"LOG\");this.info=makeLogFunction(logging.INFO,\"INFO\");this.warn=makeLogFunction(logging.WARN,\"WARN\");this.error=makeLogFunction(logging.ERROR,\"ERROR\");});return logging;})();var logger=exports.logging.get('jsiocore');","filePath":"jsio/base.js"},'Orbited':{"src":"\njsio('from base import Class');jsio('import logging');jsio('from net.protocols.mspp import MSPPStream, MSPPProtocol');exports.logging=logging;exports.settings={'host':'localhost','port':8000,'path':'/csp'};var multiplexer=null;exports.TCPSocket=Class(MSPPStream,function(){this.init=function(){this.setEncoding('plain');if(multiplexer==null){multiplexer=new MSPPProtocol();multiplexer.setTransport('csp',{\"url\":\"http://\"+exports.settings.host+\":\"+exports.settings.port+exports.settings.path});}\nthis.setMultiplexer(multiplexer);}});","filePath":"Orbited.js"},'std.JSON':{"src":"\nexports.createGlobal=function(){if(typeof JSON=='undefined'){JSON={};}\nif(typeof JSON.stringify!=='function'){JSON.stringify=exports.stringify;}\nif(typeof JSON.parse!=='function'){JSON.parse=exports.parse;}};;(function(){var cx=/[\\u0000\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]/g,escapable=/[\\\\\\\"\\x00-\\x1f\\x7f-\\x9f\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]/g,gap,indent,meta={'\\b':'\\\\b','\\t':'\\\\t','\\n':'\\\\n','\\f':'\\\\f','\\r':'\\\\r','\"':'\\\\\"','\\\\':'\\\\\\\\'},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'\"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==='string'?c:'\\\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4);})+'\"':'\"'+string+'\"';}\nfunction str(key,holder){var mind=gap,value=holder[key];if(value&&typeof value==='object'&&typeof value.toJSON==='function'){value=value.toJSON(key);}\nif(typeof rep==='function'){value=rep.call(holder,key,value);}\nswitch(typeof value){case'string':return quote(value);case'number':return isFinite(value)?String(value):'null';case'boolean':return String(value);case'object':if(value===null){return'null';}\nif(value.constructor===Date){return exports.stringifyDate(value);}\ngap+=indent;var partial=[];if(value.constructor===Array){var length=value.length;for(var i=0;i<length;i+=1){partial[i]=str(i,value)||'null';}\nvar v=partial.length===0?'[]':gap?'[\\n'+gap+\npartial.join(',\\n'+gap)+'\\n'+\nmind+']':'['+partial.join(',')+']';gap=mind;return v;}\nif(rep&&typeof rep==='object'){var length=rep.length;for(var i=0;i<length;i+=1){var k=rep[i];if(typeof k==='string'){var v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}else{for(var k in value){if(Object.hasOwnProperty.call(value,k)){var v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}\nvar v=partial.length===0?'{}':gap?'{\\n'+gap+partial.join(',\\n'+gap)+'\\n'+\nmind+'}':'{'+partial.join(',')+'}';gap=mind;return v;}}\nexports.stringify=function(value,replacer,space){gap='';indent='';if(typeof space==='number'){for(var i=0;i<space;i+=1){indent+=' ';}}else if(typeof space==='string'){indent=space;}\nrep=replacer;if(replacer&&typeof replacer!=='function'&&(typeof replacer!=='object'||typeof replacer.length!=='number')){throw new Error('JSON stringify: invalid replacer');}\nreturn str('',{'':value});};exports.stringifyDate=function(d){var year=d.getUTCFullYear(),month=d.getUTCMonth()+1,day=d.getUTCDate(),hours=d.getUTCHours(),minutes=d.getUTCMinutes(),seconds=d.getUTCSeconds(),ms=d.getUTCMilliseconds();if(month<10){month='0'+month;}\nif(day<10){day='0'+day;}\nif(hours<10){hours='0'+hours;}\nif(minutes<10){minutes='0'+minutes;}\nif(seconds<10){seconds='0'+seconds;}\nif(ms<10){ms='00'+ms;}\nelse if(ms<100){ms='0'+ms;}\nreturn'\"'+year\n+'-'+month\n+'-'+day\n+'T'+hours\n+':'+minutes\n+':'+seconds\n+'.'+ms\n+'Z\"';}\nexports.parse=function(text,reviver){cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return'\\\\u'+\n('0000'+a.charCodeAt(0).toString(16)).slice(-4);});}\nif(/^[\\],:{}\\s]*$/.test(text.replace(/\\\\(?:[\"\\\\\\/bfnrt]|u[0-9a-fA-F]{4})/g,'@').replace(/\"[^\"\\\\\\n\\r]*\"|true|false|null|-?\\d+(?:\\.\\d*)?(?:[eE][+\\-]?\\d+)?/g,']').replace(/(?:^|:|,)(?:\\s*\\[)+/g,'')))\n{var j=eval('('+text+')');if(!reviver){return j;}else{var walk=function(holder,key){var k,v,value=holder[key];if(value&&typeof value==='object'){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v;}else{delete value[k];}}}}\nreturn reviver.call(holder,key,value);}\nreturn walk({'':j},'');}}\nthrow new SyntaxError('JSON.parse');};}());","filePath":"jsio/std/JSON.js"},'std.uri':{"src":"\nvar attrs=[\"source\",\"protocol\",\"authority\",\"userInfo\",\"user\",\"password\",\"host\",\"port\",\"relative\",\"path\",\"directory\",\"file\",\"query\",\"anchor\"];exports.Uri=Class(function(supr){this.init=function(url,isStrict){var uriData=exports.parse(url,isStrict)\nfor(attr in uriData){this['_'+attr]=uriData[attr];};};for(var i=0,attr;attr=attrs[i];++i){(function(attr){var fNameSuffix=attr.charAt(0).toUpperCase()+attr.slice(1);this['get'+fNameSuffix]=function(){return this['_'+attr];};this['set'+fNameSuffix]=function(val){this['_'+attr]=val;};}).call(this,attr);};this.toString=this.render=function(){var a=this._protocol?this._protocol+\"://\":\"\"\nvar b=this._host?this._host+((this._port||80)==80?\"\":\":\"+this._port):\"\";var c=this._path;var d=this._query?'?'+this._query:'';var e=this._anchor?'#'+this._anchor:'';return a+b+c+d+e;};});exports.buildQuery=function(kvp){var pairs=[];for(key in kvp){pairs.push(encodeURIComponent(key)+'='+encodeURIComponent(kvp[key]));}\nreturn pairs.join('&');}\nexports.parseQuery=function(str){var pairs=str.split('&'),n=pairs.length,data={};for(var i=0;i<n;++i){var pair=pairs[i].split('='),key=decodeURIComponent(pair[0]);if(key){data[key]=decodeURIComponent(pair[1]);}}\nreturn data;}\nvar strictRegex=/^(?:([^:\\/?#]+):)?(?:\\/\\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\\/?#]*)(?::(\\d*))?))?((((?:[^?#\\/]*\\/)*)([^?#]*))(?:\\?([^#]*))?(?:#(.*))?)/;var looseRegex=/^(?:(?![^:@]+:[^:@\\/]*@)([^:\\/?#.]+):)?(?:\\/\\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\\/?#]*)(?::(\\d*))?)(((\\/(?:[^?#](?![^?#\\/]*\\.[^?#\\/.]+(?:[?#]|$)))*\\/?)?([^?#\\/]*))(?:\\?([^#]*))?(?:#(.*))?)/;var queryStringRegex=/(?:^|&)([^&=]*)=?([^&]*)/g;exports.parse=function(str,isStrict){var regex=isStrict?strictRegex:looseRegex;var result={};var match=regex.exec(str);for(var i=0,attr;attr=attrs[i];++i){result[attr]=match[i]||\"\";}\nvar qs=result['queryKey']={};result['query'].replace(queryStringRegex,function(check,key,val){if(check){qs[key]=val;}});return result;}\nexports.isSameDomain=function(urlA,urlB){var a=exports.parse(urlA);var b=exports.parse(urlB);return((a.port==b.port)&&(a.host==b.host)&&(a.protocol==b.protocol));};","filePath":"jsio/std/uri.js"},'net.protocols.buffered':{"src":"\njsio('from net.interfaces import Protocol');jsio('from net.buffer import Buffer');exports.BufferedProtocol=Class(Protocol,function(supr){this.init=function(){this.buffer=new Buffer();}\nthis.bufferUpdated=function(){}\nthis.dataReceived=function(data){this.buffer.append(data);this.bufferUpdated();}})","filePath":"jsio/net/protocols/buffered.js"},'net':{"src":"\njsio('import net.env');jsio('import std.JSON as JSON');JSON.createGlobal();exports.listen=function(server,transportName,opts){if(!transportName){throw logger.error('No transport provided for net.listen');}\nvar listenerClass=net.env.getListener(transportName);var listener=new listenerClass(server,opts);listener.listen();return listener;}\nexports.connect=function(protocolInstance,transportName,opts){var ctor=net.env.getConnector(transportName),connector=new ctor(protocolInstance,opts);connector.connect();return connector;}\nexports.quickServer=function(protocolClass){jsio('import net.interfaces');return new net.interfaces.Server(protocolClass);}","filePath":"jsio/net.js"},'net.protocols.mspp':{"src":"\njsio('import net');jsio('from net.protocols.buffered import BufferedProtocol');jsio('import std.utf8 as utf8');jsio('from base import logging');var loggers={};loggers.stream=logging.get('MSPPStream');loggers.protocol=logging.get('MSPPProtocol');var frames={'OPEN':0,'CLOSE':1,'DATA':2};exports.MSPPStream=Class(function(){this.setMultiplexer=function(multiplexer){loggers.stream.debug('setMultiplexer: '+multiplexer);this.multiplexer=multiplexer;}\nthis.setEncoding=function(encoding){loggers.stream.debug('setEncoding: '+encoding);this.encoding=encoding;}\nthis.open=function(host,port,isBinary){if(isBinary)\nthis.encoding='utf8';this.id=this.multiplexer.openStream(this,host,port);loggers.stream.debug('open '+this.id+\": \"+host+\" \"+port+\" \"+isBinary);}\nthis.close=function(){loggers.stream.debug('close '+this.id);this.multiplexer.close(this.id);}\nthis.send=function(data,encoding){loggers.stream.debug('send '+this.id+\": \"+data+\" \"+encoding);if((encoding||this.encoding)=='utf8')\ndata=utf8.encode(data);this.multiplexer.writeToStream(this.id,data);}\nthis._onreadraw=function(data){if(this.encoding=='utf8'){var raw=utf8.decode(data);var length=raw[1];if(length!=data.length){throw new Error(\"Incomplete utf8 codepoint\");}\ndata=raw[0]}\nloggers.stream.debug('_onreadraw '+data);this.onread(data);}\nthis.onopen=function(){}\nthis.onclose=function(err){}\nthis.onread=function(data){}});var state={};state.closed=0;state.connecting=1;state.consuming=2;exports.MSPPProtocol=Class(BufferedProtocol,function(supr){this.init=function(){loggers.protocol.debug('new MSPPProtocol');supr(this,'init',[]);this.state=state.closed;this.transportType=null;this.transportOptions=null;this.currentId=0;this.streams={};this.writeBuffer=[];}\nthis.setTransport=function(transportType,transportOptions){this.transportType=transportType;this.transportOptions=transportOptions;}\nthis.connectionMade=function(isReconnect){loggers.protocol.debug('connectionMade');this.state=state.consuming;for(var i=0;i<this.writeBuffer.length;i++)\nthis._write(this.writeBuffer[i]);writeBuffer=[];}\nthis.connectionLost=function(reason){loggers.protocol.debug('closed: '+reason);this.state=state.closed;for(stream in this.streams)\nthis.streams[stream].onclose(reason);}\nthis.openStream=function(stream,host,port){if(this.state==state.closed){this.state=state.connecting;net.connect(this,this.transportType,this.transportOptions);}\nvar id=++this.currentId;this.streams[id]=stream;this._write([id,frames.OPEN,host+\",\"+port]);return id;}\nthis.closeStream=function(id){this._write([id,frames.CLOSE,\"\"]);}\nthis.writeToStream=function(id,data){this._write([id,frames.DATA,data]);}\nthis.bufferUpdated=function(){loggers.protocol.debug(\"bufferUpdated. state: \"+this.state+\". buffer: \"+this.buffer._rawBuffer);if(this.state!=state.consuming)\nthrow new Error(\"buffer update in invalid MSPP state: \"+this.state);if(!this.buffer.hasDelimiter(':'))\nreturn;var lStr=this.buffer.peekToDelimiter(':');var len=parseInt(lStr);if(!this.buffer.hasBytes(len+lStr.length+1))\nreturn;this.buffer.consumeThroughDelimiter(':');var streamId=this.buffer.consumeToDelimiter(',');this.buffer.consumeBytes(1);var frameType=parseInt(this.buffer.consumeBytes(1));len-=(streamId.length+2);streamId=parseInt(streamId);var data=this.buffer.consumeBytes(len);switch(frameType){case frames.OPEN:this.streams[streamId].onopen();break;case frames.CLOSE:this.streams[streamId].onclose(data);break;case frames.DATA:this.streams[streamId]._onreadraw(data);break;default:throw new Error('invalid MSPP data type!');}}\nthis._write=function(data){if(this.state!=state.consuming){loggers.protocol.debug(\"buffering write: \"+data);this.writeBuffer.push(data);return;}\nvar s=data[0]+\",\"+data[1]+data[2];s=s.length+\":\"+s;loggers.protocol.debug('write: '+s);this.transport.write(s);}});","filePath":"jsio/net/protocols/mspp.js"},'util.browserdetect':{"src":"\nexports.BrowserDetect=new function(){var versionSearchString;var dataBrowser=[{string:navigator.userAgent,subString:\"Chrome\"},{string:navigator.userAgent,subString:\"OmniWeb\",versionSearch:\"OmniWeb/\"},{string:navigator.vendor,subString:\"Apple\",identity:\"Safari\",versionSearch:\"Version\"},{prop:window.opera,identity:\"Opera\"},{string:navigator.vendor,subString:\"iCab\"},{string:navigator.vendor,subString:\"KDE\",identity:\"Konqueror\"},{string:navigator.userAgent,subString:\"Firefox\"},{string:navigator.vendor,subString:\"Camino\"},{string:navigator.userAgent,subString:\"Netscape\"},{string:navigator.userAgent,subString:\"MSIE\",identity:\"IE\",versionSearch:\"MSIE\"},{string:navigator.userAgent,subString:\"Gecko\",identity:\"Mozilla\",versionSearch:\"rv\"},{string:navigator.userAgent,subString:\"Mozilla\",identity:\"Netscape\",versionSearch:\"Mozilla\"}];var dataOS=[{string:navigator.platform,subString:\"Win\",identity:\"Windows\"},{string:navigator.platform,subString:\"Mac\"},{string:navigator.userAgent,subString:\"iPhone\",identity:\"iPhone/iPod\"},{string:navigator.platform,subString:\"Linux\"}];function searchString(data){for(var i=0,item;item=data[i];i++){var dataString=item.string;var dataProp=item.prop;item.identity=item.identity||item.subString;versionSearchString=item.versionSearch||item.identity;if(dataString){if(dataString.indexOf(item.subString)!=-1)\nreturn item.identity;}else if(dataProp)\nreturn item.identity;}}\nfunction searchVersion(dataString){var index=dataString.indexOf(versionSearchString);if(index==-1)return;return parseFloat(dataString.substring(index+versionSearchString.length+1));}\nthis.browser=searchString(dataBrowser)||\"unknown\";this.version=searchVersion(navigator.userAgent)||searchVersion(navigator.appVersion)||\"unknown\";this.OS=searchString(dataOS)||\"unknown\";this.isWebKit=RegExp(\" AppleWebKit/\").test(navigator.userAgent);this['is'+this.browser]=this.version;};","filePath":"jsio/util/browserdetect.js"},'std.utf8':{"src":"\nexports.UnicodeCodecError=function(message){this.message=message;};var UnicodeCodecError=exports.UnicodeCodecError;UnicodeCodecError.prototype.toString=function(){return'UnicodeCodecError'+(this.message?': '+this.message:'');};exports.encode=function(unicode_string){try{return unescape(encodeURIComponent(unicode_string));}\ncatch(err){throw new UnicodeCodecError('invalid input string');};};exports.decode=function(bytes){if(/[^\\x00-\\xFF]/.test(bytes)){throw new UnicodeCodecError('invalid utf-8 bytes');};var len,len_parsed;len=len_parsed=bytes.length;var last=len-1;if(bytes.charCodeAt(last)>=0x80){for(var i=1;i<=3;i++){if(bytes.charCodeAt(len-i)>=0xC0){len_parsed=len-i;break;};};try{decodeURIComponent(escape(bytes.slice(len_parsed)));len_parsed=len;}\ncatch(err){};};try{return[decodeURIComponent(escape(bytes.slice(0,len_parsed))),len_parsed];}\ncatch(err){throw new UnicodeCodecError('invalid utf-8 bytes');};};","filePath":"jsio/std/utf8.js"}};function bind(context,method){var args=Array.prototype.slice.call(arguments,2);return function(){method=(typeof method=='string'?context[method]:method);return method.apply(context,args.concat(Array.prototype.slice.call(arguments,0)));}}
+;(function(){var ENV,sourceCache={'std.base64':{"src":"\njsio('import logging');var logger=logging.getLogger('base64');var alphabet='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_';var pad='=';var padChar=alphabet.charAt(alphabet.length-1);var shorten=function(array,number){for(var i=number;i>0;i--){array.pop();};};var decode_map={};for(var i=0,n=alphabet.length;i<n;i++){decode_map[alphabet.charAt(i)]=i;};var alphabet_inverse=new RegExp('[^'+alphabet.replace('-','\\\\-')+']');var Base64CodecError=exports.Base64CodecError=function(message){this.message=message;};Base64CodecError.prototype.toString=function(){return'Base64CodecError'+(this.message?': '+this.message:'');};var assertOrBadInput=function(exp,message){if(!exp){throw new Base64CodecError(message)};};exports.encode=function(bytes){assertOrBadInput(!(/[^\\x00-\\xFF]/.test(bytes)),'Input contains out-of-range characters.');var padding='\\x00\\x00\\x00'.slice((bytes.length%3)||3);bytes+=padding;var out_array=[];for(var i=0,n=bytes.length;i<n;i+=3){var newchars=((bytes.charCodeAt(i)<<020)+\n(bytes.charCodeAt(i+1)<<010)+\n(bytes.charCodeAt(i+2)));out_array.push(alphabet.charAt((newchars>>18)&077),alphabet.charAt((newchars>>12)&077),alphabet.charAt((newchars>>6)&077),alphabet.charAt((newchars)&077));};shorten(out_array,padding.length);return out_array.join('');};exports.decode=function(b64text){logger.debug('decode',b64text);b64text=b64text.replace(/\\s/g,'')\nvar i=b64text.length;while(b64text.charAt(--i)===pad){};b64text=b64text.slice(0,i+1);assertOrBadInput(!alphabet_inverse.test(b64text),'Input contains out-of-range characters.');var padding=Array(5-((b64text.length%4)||4)).join(padChar);b64text+=padding;var out_array=[];for(var i=0,n=b64text.length;i<n;i+=4){newchars=((decode_map[b64text.charAt(i)]<<18)+\n(decode_map[b64text.charAt(i+1)]<<12)+\n(decode_map[b64text.charAt(i+2)]<<6)+\n(decode_map[b64text.charAt(i+3)]));out_array.push((newchars>>020)&0xFF,(newchars>>010)&0xFF,(newchars)&0xFF);};shorten(out_array,padding.length);var result=String.fromCharCode.apply(String,out_array);logger.debug('decoded',result);return result;};","filePath":"jsio/std/base64.js"},'net.env':{"src":"\njsio('from base import *');jsio('import logging');var logger=logging.getLogger('net.env');function getObj(objectName,transportName,envName){try{jsio('from .env.'+(envName||jsio.__env.name)+'.'+transportName+' import '+objectName+' as result');}catch(e){throw logger.error('Invalid transport (',transportName,') or environment (',envName,')');}\nreturn result;}\nexports.getListener=bind(this,getObj,'Listener');exports.getConnector=bind(this,getObj,'Connector');","filePath":"jsio/net/env.js"},'logging':{"src":"\njsio('from base import *');var loggers={}\nvar levels=exports.levels={DEBUG:0,LOG:1,INFO:2,WARN:3,ERROR:4};var production=false;exports.setProduction=function(prod){production=!!prod;}\nexports.getLogger=function(name){if(!(name in loggers)){loggers[name]=new exports.Logger(name);}\nreturn loggers[name];}\nexports.Logger=Class(function(){this.init=function(name,level){if(!level){level=levels.LOG;}\nthis.name=name;this.level=level;}\nthis.setLevel=function(level){this.level=level;}\nfunction makeLogFunction(level,type){return function(){if(!production&&level>=this.level){return log.apply(log,[type,this.name].concat(Array.prototype.slice.call(arguments,0)));}\nreturn arguments[0];}}\nthis.debug=makeLogFunction(levels.DEBUG,\"DEBUG\");this.log=makeLogFunction(levels.LOG,\"LOG\");this.info=makeLogFunction(levels.INFO,\"INFO\");this.warn=makeLogFunction(levels.WARN,\"WARN\");this.error=makeLogFunction(levels.ERROR,\"ERROR\");})","filePath":"jsio/logging.js"},'net.csp.errors':{"src":"\nvar makeErrorClass=function(name,_code){var out=function(message,code){this.message=message;this.code=code||_code;}\nout.prototype.toString=function(){return name+(this.message?': '+this.message:'');}\nreturn out;}\nexports.ReadyStateError=makeErrorClass(\"ReadyStateError\");exports.InvalidEncodingError=makeErrorClass(\"InvalidEncodingError\");exports.HandshakeTimeout=makeErrorClass(\"HandshakeTimeout\",100);exports.SessionTimeout=makeErrorClass(\"HandshakeTimeout\",101);exports.ServerProtocolError=makeErrorClass(\"ServerProtocolError\",200);exports.ServerClosedConnection=makeErrorClass(\"ServerClosedConnection\",301);exports.ConnectionClosedCleanly=makeErrorClass(\"ConnectionClosedCleanly\",300);","filePath":"jsio/net/csp/errors.js"},'net.env.browser.csp':{"src":"\njsio('from base import *');jsio('import logging, net.interfaces');jsio('from net.csp.client import CometSession');var logger=logging.getLogger('env.browser.csp');exports.Connector=Class(net.interfaces.Connector,function(){this.connect=function(){var conn=new CometSession();conn.onconnect=bind(this,function(){logger.debug('conn has opened');this.onConnect(new Transport(conn));});conn.ondisconnect=bind(this,function(code){logger.debug('conn closed without opening, code:',code);});logger.debug('open the conection');this._opts.encoding='plain';var url=this._opts.url;delete this._opts.url;conn.connect(url,this._opts);}});var Transport=Class(net.interfaces.Transport,function(){this.init=function(conn){this._conn=conn;}\nthis.makeConnection=function(protocol){this._conn.onread=bind(protocol,'dataReceived');this._conn.ondisconnect=bind(protocol,'connectionLost');}\nthis.write=function(data,encoding){this._conn.write(data);}\nthis.loseConnection=function(protocol){this._conn.close();}});","filePath":"jsio/net/env/browser/csp.js"},'net.csp.transports':{"src":"\njsio('from base import *');jsio('import std.uri as uri');jsio('import std.base64 as base64');jsio('import .errors');jsio('from util.browserdetect import BrowserDetect');var createXHR=exports.createXHR=function(){return window.XMLHttpRequest?new XMLHttpRequest():window.XDomainRequest?new XDomainRequest():window.ActiveXObject?new ActiveXObject(\"Msxml2.XMLHTTP\"):null;};function isLocalFile(url){return/^file:\\/\\//.test(url);}\nfunction isWindowDomain(url){return uri.isSameDomain(url,window.location.href);}\nfunction canUseXHR(url){if(isLocalFile(url)){return false;}\nvar xhr=createXHR();if(!xhr){return false;}\nif(isWindowDomain(url)){return true;}\nif(window.XMLHttpRequest&&(xhr.__proto__==XMLHttpRequest.prototype||xhr instanceof window.XMLHttpRequest)&&xhr.withCredentials!==undefined||window.XDomainRequest&&xhr instanceof window.XDomainRequest){return true;}};var transports=exports.transports={};exports.chooseTransport=function(url,options){switch(options.preferredTransport){case'jsonp':return transports.jsonp;case'xhr':default:if(canUseXHR(url)){return transports.xhr;};return transports.jsonp;}};var PARAMS={'xhrstream':{\"is\":\"1\",\"bs\":\"\\n\"},'xhrpoll':{\"du\":\"0\"},'xhrlongpoll':{},'sselongpoll':{\"bp\":\"data: \",\"bs\":\"\\r\\n\",\"se\":\"1\"},'ssestream':{\"bp\":\"data: \",\"bs\":\"\\r\\n\",\"se\":\"1\",\"is\":\"1\"}};exports.Transport=Class(function(supr){this.handshake=function(url,options){throw new Error(\"handshake Not Implemented\");};this.comet=function(url,sessionKey,lastEventId,options){throw new Error(\"comet Not Implemented\");};this.send=function(url,sessionKey,data,options){throw new Error(\"send Not Implemented\");};this.encodePacket=function(packetId,data,options){throw new Error(\"encodePacket Not Implemented\");};this.abort=function(){throw new Error(\"abort Not Implemented\");};});var baseTransport=Class(exports.Transport,function(supr){this.init=function(){this._aborted=false;this._handshakeArgs={d:'{}',ct:'application/javascript'};};this.handshake=function(url,options){logger.debug('handshake:',url,options);this._makeRequest('send',url+'/handshake',this._handshakeArgs,this.handshakeSuccess,this.handshakeFailure);};this.comet=function(url,sessionKey,lastEventId,options){logger.debug('comet:',url,sessionKey,lastEventId,options);args={s:sessionKey,a:lastEventId};this._makeRequest('comet',url+'/comet',args,this.cometSuccess,this.cometFailure);};this.send=function(url,sessionKey,lastEventId,data,options){logger.debug('send:',url,sessionKey,data,options);args={d:data,s:sessionKey,a:lastEventId};this._makeRequest('send',url+'/send',args,this.sendSuccess,this.sendFailure);};});transports.xhr=Class(baseTransport,function(supr){var abortXHR=function(xhr){logger.debug('aborting XHR');try{if('onload'in xhr){xhr.onload=xhr.onerror=xhr.ontimeout=null;}else if('onreadystatechange'in xhr){xhr.onreadystatechange=null;}\nif(xhr.abort){xhr.abort();}}catch(e){logger.debug('error aborting xhr',e);}};this.init=function(){supr(this,'init');this._xhr={'send':createXHR(),'comet':createXHR()};};this.abort=function(){this._aborted=true;for(var i in this._xhr){if(this._xhr.hasOwnProperty(i)){abortXHR(this._xhr[i]);}}};this.encodePacket=function(packetId,data,options){return data.indexOf('\\0')==-1?[packetId,0,data]:[packetId,1,base64.encode(data)];};this._onReadyStateChange=function(rType,cb,eb){try{var xhr=this._xhr[rType];if(xhr.readyState!=4){return;}\nif(xhr.status!=200){logger.debug('XHR failed with status ',xhr.status);eb();return;}\nlogger.debug('XHR data received');cb(eval(xhr.responseText));}catch(e){var xhr=this._xhr[rType];logger.debug('Error in XHR::onReadyStateChange',e);eb();abortXHR(xhr);logger.debug('done handling XHR error');}};this._makeRequest=function(rType,url,args,cb,eb){if(this._aborted){return;}\nvar xhr=this._xhr[rType],data=args.d||null;if('d'in args){delete args.d;}\nxhr.open('POST',url+'?'+uri.buildQuery(args));xhr.setRequestHeader('Content-Type','text/plain');if('onload'in xhr){xhr.onload=bind(this,'_onReadyStateChange',rType,cb,eb);xhr.onerror=xhr.ontimeout=eb;}else if('onreadystatechange'in xhr){xhr.onreadystatechange=bind(this,'_onReadyStateChange',rType,cb,eb);}\nif(data){xhr.send(data);}else{xhr.send();}};});transports.jsonp=Class(baseTransport,function(supr){var createIframe=function(){var i=document.createElement(\"iframe\");with(i.style){display='block';width=height=border=margin=padding='0';overflow=visibility='hidden';}\ni.cbId=0;i.src='javascript:document.open();document.write(\"<html><body></body></html>\")';document.body.appendChild(i);return i;};var abortIframe=function(ifr){var win=ifr.contentWindow,doc=win.document;logger.debug('removing script tags');var scripts=doc.getElementsByTagName('script');var s1=doc.getElementsByTagName('script')[0];var s2=doc.getElementsByTagName('script')[1];if(s1)s1.parentNode.removeChild(s1);if(s2)s2.parentNode.removeChild(s2);logger.debug('deleting iframe callbacks');win['cb'+(ifr.cbId-1)]=function(){};win['eb'+(ifr.cbId-1)]=function(){};};var removeIframe=function(ifr){$setTimeout(function(){if(ifr&&ifr.parentNode){ifr.parentNode.removeChild(ifr);}},60000);};this.init=function(){supr(this,'init');this._onReady=[];this._isReady=false;this._createIframes();};this._createIframes=function(){if(!document.body){return $setTimeout(bind(this,'_createIframes'),100);}\nthis._isReady=true;this._ifr={'send':createIframe(),'comet':createIframe()};var readyArgs=this._onReady;this._onReady=[];for(var i=0,args;args=readyArgs[i];++i){this._makeRequest.apply(this,args);}};this.encodePacket=function(packetId,data,options){return[packetId,1,base64.encode(data)];};this.abort=function(){this._aborted=true;for(var i in this._ifr){if(this._ifr.hasOwnProperty(i)){var ifr=this._ifr[i];abortIframe(ifr);removeIframe(ifr);}}};this._makeRequest=function(rType,url,args,cb,eb){if(!this._isReady){return this._onReady.push(arguments);}\nargs.n=Math.random();$setTimeout(bind(this,function(){var ifr=this._ifr[rType];var win=ifr.contentWindow,doc=win.document,body=doc.body;var completed=false;var jsonpId=ifr.cbId++;var onFinish=win['eb'+jsonpId]=function(scriptTag){if(scriptTag&&scriptTag.readyState!='loaded'){return;}\nif(!completed){logger.debug('error making request:',fullUrl);}\nabortIframe(ifr);if(!completed){logger.debug('calling eb');eb.apply(null,arguments);}};win['cb'+jsonpId]=function callback(){logger.debug('successful: ',fullUrl,[].slice.call(arguments,0));completed=true;logger.debug('calling the cb');cb.apply(null,arguments);logger.debug('cb called');};switch(rType){case'send':args.rs=';';args.rp='cb'+jsonpId;break;case'comet':args.bs=';';args.bp='cb'+jsonpId;break;}\nvar fullUrl=url+'?'+uri.buildQuery(args);if(BrowserDetect.isWebKit){doc.open();doc.write('<scr'+'ipt src=\"'+fullUrl+'\"></scr'+'ipt>');doc.write('<scr'+'ipt>eb'+jsonpId+'(false)</scr'+'ipt>');}else{var s=doc.createElement('script');s.src=fullUrl;if(s.onreadystatechange===null){s.onreadystatechange=bind(window,onFinish,s);}\nbody.appendChild(s);if(!BrowserDetect.isIE){var s=doc.createElement('script');s.innerHTML='eb'+jsonpId+'(false)';body.appendChild(s);}}\nkillLoadingBar();}),0);};var killLoadingBar=BrowserDetect.isFirefox?function(){if(!killLoadingBar.iframe){killLoadingBar.iframe=document.createElement('iframe');}\nif(document.body){document.body.insertBefore(killLoadingBar.iframe,document.body.firstChild);document.body.removeChild(killLoadingBar.iframe);}}:function(){};});","filePath":"jsio/net/csp/transports.js"},'net.interfaces':{"src":"\njsio('from base import *');jsio('import net');var ctx=jsio.__env.global;exports.Protocol=Class(function(){this.connectionMade=function(isReconnect){}\nthis.dataReceived=function(data){}\nthis.connectionLost=function(reason){}\nthis.connectionFailed=function(){}});exports.Client=Class(function(){this.init=function(protocol){this._protocol=protocol;}\nthis.connect=function(transportName,opts){this._remote=new this._protocol();this._remote._client=this;net.connect(this._remote,transportName,opts);}});exports.Server=Class(function(){this.init=function(protocolClass){this._protocolClass=protocolClass;}\nthis.buildProtocol=function(){return new this._protocolClass();}\nthis.listen=function(how,port){return net.listen(this,how,port);}});exports.Transport=Class(function(){this.write=function(data,encoding){throw new Error(\"Not implemented\");}\nthis.getPeer=function(){throw new Error(\"Not implemented\");}});exports.Listener=Class(function(){this.init=function(server,opts){this._server=server;this._opts=opts||{};}\nthis.onConnect=function(transport){try{var p=this._server.buildProtocol();p.transport=transport;p.server=this._server;transport.protocol=p;transport.makeConnection(p);p.connectionMade();}catch(e){logger.error(e);}}\nthis.listen=function(){throw new Error('Abstract class');}\nthis.stop=function(){}});exports.Connector=Class(function(){this.init=function(protocol,opts){this._protocol=protocol;this._opts=opts;}\nthis.onConnect=function(transport){transport.makeConnection(this._protocol);this._protocol.transport=transport;try{this._protocol.connectionMade();}catch(e){throw logger.error(e);}}\nthis.onDisconnect=function(){try{this._protocol.connectionLost();}catch(e){throw logger.error(e);}}\nthis.getProtocol=function(){return this._protocol;}});","filePath":"jsio/net/interfaces.js"},'net.buffer':{"src":"\njsio('from base import *');jsio('import logging');jsio('from net.interfaces import Protocol');var logger=logging.getLogger('net.buffer.Buffer');var EmptyBufferError=exports.EmptyBufferError=Class(function(){this.init=function(message){this.message=message;}})\nexports.Buffer=Class(function(supr){this.init=function(rawBuffer){this._rawBuffer=!!rawBuffer?rawBuffer:\"\";}\nthis.getLength=function(){return this._rawBuffer.length;}\nthis.append=function(data){logger.debug('append',JSON.stringify(data));this._rawBuffer+=data;}\nthis.peekBytes=function(num){if(!!num)\nreturn this._rawBuffer.slice(0,num);else\nreturn this._rawBuffer;}\nthis.peekToDelimiter=function(delimiter){delimiter=delimiter?delimiter:'\\n';var i=this._rawBuffer.indexOf(delimiter);if(i==-1)\nthrow new EmptyBufferError(\"delimiter \"+delmiter+\"not present in buffer\");else\nreturn this._rawBuffer.slice(0,i);}\nthis.consumeBytes=function(num){var output=this.peekBytes(num);this._rawBuffer=this._rawBuffer.slice(output.length);return output;}\nthis.consumeMaxBytes=function(num){var output=this._rawBuffer.slice(0,num);this._rawBuffer=this._rawBuffer(num);return output;}\nthis.consumeAllBytes=function(){var temp=this._rawBuffer;this._rawBuffer=\"\";return temp;}\nthis.consumeThroughDelimiter=function(delimiter){return this.consumeToDelimiter(delimiter)+this.consumeBytes(delimiter.length);}\nthis.consumeToDelimiter=function(delimiter){delimiter=!!delimiter?delimiter:\"\\n\"\nvar output=this.peekToDelimiter(delimiter);this._rawBuffer=this._rawBuffer.slice(output.length);return output;}\nthis.hasBytes=function(num){num=num?num:0;return this._rawBuffer.length>=num;}\nthis.hasDelimiter=function(delimiter){delimiter=!!delimiter?delimiter:'\\n';return(this._rawBuffer.indexOf(delimiter)!=-1);}})","filePath":"jsio/net/buffer.js"},'net.csp.client':{"src":"\njsio('from base import *');jsio('import std.base64 as base64');jsio('import std.utf8 as utf8');jsio('import std.uri as uri');jsio('import .errors');jsio('import .transports');var READYSTATE=exports.READYSTATE={INITIAL:0,CONNECTING:1,CONNECTED:2,DISCONNECTING:3,DISCONNECTED:4};exports.CometSession=Class(function(supr){var id=0;var kDefaultBackoff=50;var kDefaultTimeoutInterval=45000;var kDefaultHandshakeTimeout=10000;this.init=function(){this._id=++id;this._url=null;this.readyState=READYSTATE.INITIAL;this._sessionKey=null;this._transport=null;this._options=null;this._utf8ReadBuffer=\"\";this._writeBuffer=\"\";this._packetsInFlight=null;this._lastEventId=null;this._lastSentId=null;this._handshakeLater=null;this._handshakeBackoff=kDefaultBackoff;this._handshakeRetryTimer=null;this._handshakeTimeoutTimer=null;this._timeoutTimer=null;this._writeBackoff=kDefaultBackoff;this._cometBackoff=kDefaultBackoff;this._nullInBuffer=false;this._nullInFlight=false;this._nullSent=false;this._nullReceived=false;}\nthis.setEncoding=function(encoding){if(encoding==this._options.encoding){return;}\nif(encoding!='utf8'&&encoding!='plain'){throw new errors.InvalidEncodingError();}\nif(encoding=='plain'&&this._buffer){var buffer=this._utf8ReadBuffer;this._utf8ReadBuffer=\"\";this._doOnRead(buffer);}\nthis._options.encoding=encoding;}\nthis.connect=function(url,options){this._url=url.replace(/\\/$/,'');this._options=options||{};this._options.encoding=this._options.encoding||'utf8';this.setEncoding(this._options.encoding);this._options.connectTimeout=this._options.connectTimeout||kDefaultHandshakeTimeout;var transportClass=transports.chooseTransport(url,this._options);this._transport=new transportClass();this._transport.handshakeFailure=bind(this,this._handshakeFailure);this._transport.handshakeSuccess=bind(this,this._handshakeSuccess);this._transport.cometFailure=bind(this,this._cometFailure);this._transport.cometSuccess=bind(this,this._cometSuccess);this._transport.sendFailure=bind(this,this._writeFailure);this._transport.sendSuccess=bind(this,this._writeSuccess);this.readyState=READYSTATE.CONNECTING;this._transport.handshake(this._url,this._options);this._handshakeTimeoutTimer=$setTimeout(bind(this,this._handshakeTimeout),this._options.connectTimeout);}\nthis.write=function(data,encoding){if(this.readyState!=READYSTATE.CONNECTED){throw new errors.ReadyStateError();}\nencoding=encoding||this._options.encoding||'utf8';if(encoding=='utf8'){data=utf8.encode(data);}\nthis._writeBuffer+=data;this._doWrite();}\nthis._protocolError=function(msg){logger.debug('_protocolError',msg);this.readyState=READYSTATE.DISCONNECTED;this._doWrite(true);this._doOnDisconnect(new errors.ServerProtocolError(msg));}\nthis._receivedNullPacket=function(){logger.debug('_receivedNullPacket');this._receivedNull=true;if(!(this._nullInFlight||this._nullInBuffer||this._nullSent)){this.readyState=READYSTATE.DISCONNECTING;this._doWrite(true);}\nelse{this.readyState=READYSTATE.DISCONNECTED;}\nthis._doOnDisconnect(new errors.ConnectionClosedCleanly());}\nthis._sentNullPacket=function(){logger.debug('_sentNullPacket');this._nullSent=true;if(this._nullSent&&this._nullReceived){this.readyState=READYSTATE.DISCONNECTED;}}\nthis.close=function(err){logger.debug('close called',err,'readyState',this.readyState);switch(this.readyState){case READYSTATE.CONNECTING:clearTimeout(this._handshakeRetryTimer);clearTimeout(this._handshakeTimeoutTimer);this.readyState=READYSTATE.DISCONNECTED;this._doOnDisconnect(err);break;case READYSTATE.CONNECTED:this.readyState=READYSTATE.DISCONNECTING;this._doWrite(true);clearTimeout(this._timeoutTimer);break;case READYSTATE.DISCONNECTED:throw new errors.ReadyStateError(\"Session is already disconnected\");break;}}\nthis._handshakeTimeout=function(){logger.debug('handshake timeout');this._handshakeTimeoutTimer=null;this._doOnDisconnect(new errors.HandshakeTimeout());}\nthis._handshakeSuccess=function(d){logger.debug('handshake success',d);if(this.readyState!=READYSTATE.CONNECTING){logger.debug('received handshake success in invalid readyState:',this.readyState);return;}\nclearTimeout(this._handshakeTimeoutTimer);this._handshakeTimeoutTimer=null;this._sessionKey=d.session;this._opened=true;this.readyState=READYSTATE.CONNECTED;this._doOnConnect();this._doConnectComet();}\nthis._handshakeFailure=function(e){logger.debug('handshake failure',e);if(this.readyState!=READYSTATE.CONNECTING){return;}\nlogger.debug('trying again in ',this._handshakeBackoff);this._handshakeRetryTimer=$setTimeout(bind(this,function(){this._handshakeRetryTimer=null;this._transport.handshake(this._url,this._options);}),this._handshakeBackoff);this._handshakeBackoff*=2;}\nthis._writeSuccess=function(){if(this.readyState!=READYSTATE.CONNECTED&&this.readyState!=READYSTATE.DISCONNECTING){return;}\nif(this._nullInFlight){return this._sentNullPacket();this.readyState=READYSTATE.DISCONNECTED;return;}\nthis._resetTimeoutTimer();this.writeBackoff=kDefaultBackoff;this._packetsInFlight=null;if(this._writeBuffer||this._nullInBuffer){this._doWrite(this._nullInBuffer);}}\nthis._writeFailure=function(){if(this.readyState!=READYSTATE.CONNECTED&&this.READYSTATE!=READYSTATE.DISCONNECTING){return;}\nthis._writeTimer=$setTimeout(bind(this,function(){this._writeTimer=null;this.__doWrite(this._nullInBuffer);}),this._writeBackoff);this._writeBackoff*=2;}\nthis._doWrite=function(sendNull){if(this._packetsInFlight){if(sendNull){this._nullInBuffer=true;return;}\nreturn;}\nthis.__doWrite(sendNull);}\nthis.__doWrite=function(sendNull){logger.debug('_writeBuffer:',this._writeBuffer);if(!this._packetsInFlight&&this._writeBuffer){this._packetsInFlight=[this._transport.encodePacket(++this._lastSentId,this._writeBuffer,this._options)];this._writeBuffer=\"\";}\nif(sendNull&&!this._writeBuffer){if(!this._packetsInFlight){this._packetsInFlight=[];}\nthis._packetsInFlight.push([++this._lastSentId,0,null]);this._nullInFlight=true;}\nif(!this._packetsInFlight){logger.debug(\"no packets to send\");return;}\nlogger.debug('sending packets:',JSON.stringify(this._packetsInFlight));this._transport.send(this._url,this._sessionKey,this._lastEventId||0,JSON.stringify(this._packetsInFlight),this._options);}\nthis._doConnectComet=function(){logger.debug('_doConnectComet');this._transport.comet(this._url,this._sessionKey,this._lastEventId||0,this._options);}\nthis._cometFailure=function(){if(this.readyState!=READYSTATE.CONNECTED){return;}\nthis._cometTimer=$setTimeout(bind(this,function(){this._doConnectComet();}),this._cometBackoff);this._cometBackoff*=2;}\nthis._cometSuccess=function(packets){if(this.readyState!=READYSTATE.CONNECTED&&this.readyState!=READYSTATE.DISCONNECTING){return;}\nlogger.debug('comet Success:',packets);this._cometBackoff=kDefaultBackoff;this._resetTimeoutTimer();for(var i=0,packet;(packet=packets[i])||i<packets.length;i++){logger.debug('process packet:',packet);if(packet===null){return self.close();}\nlogger.debug('process packet',packet);var ackId=packet[0];var encoding=packet[1];var data=packet[2];if(typeof(this._lastEventId)=='number'&&ackId<=this._lastEventId){continue;}\nif(typeof(this._lastEventId)=='number'&&ackId!=this._lastEventId+1){return this._protocolError(\"Ack id too high\");}\nthis._lastEventId=ackId;if(data==null){return this._receivedNullPacket();}\nif(encoding==1){try{logger.debug('before base64 decode:',data);data=base64.decode(data);logger.debug('after base64 decode:',data);}catch(e){return this._protocolError(\"Unable to decode base64 payload\");}}\nif(this._options.encoding=='utf8'){this._utf8ReadBuffer+=data;logger.debug('before utf8 decode, _utf8ReadBuffer:',this._utf8ReadBuffer);var result=utf8.decode(this._utf8ReadBuffer);data=result[0];this._utf8ReadBuffer=this._utf8ReadBuffer.slice(result[1]);logger.debug('after utf8 decode, _utf8ReadBuffer:',this._utf8ReadBuffer,'data:',data);}\nlogger.debug('dispatching data:',data);try{this._doOnRead(data);}catch(e){logger.error('application code threw an error. (re-throwing in timeout):',e);setTimeout(function(){logger.debug('timeout fired, throwing error',e);throw e;},0);}}\nthis._doConnectComet();}\nthis._doOnRead=function(data){if(typeof(this.onread)=='function'){logger.debug('call onread function',data);this.onread(data);}\nelse{logger.debug('skipping onread callback (function missing)');}}\nthis._doOnDisconnect=function(err){if(typeof(this.ondisconnect)=='function'){logger.debug('call ondisconnect function',err);this.ondisconnect(err);}\nelse{logger.debug('skipping ondisconnect callback (function missing)');}}\nthis._doOnConnect=function(){if(typeof(this.onconnect)=='function'){logger.debug('call onconnect function');try{this.onconnect();}catch(e){logger.debug('onconnect caused errror',e);setTimeout(function(){throw e},0);}}\nelse{logger.debug('skipping onconnect callback (function missing)');}}\nthis._resetTimeoutTimer=function(){clearTimeout(this._timeoutTimer);this._timeoutTimer=$setTimeout(bind(this,function(){logger.debug('connection timeout expired');this.close(new errors.SessionTimeout())}),this._getTimeoutInterval())}\nthis._getTimeoutInterval=function(){return kDefaultTimeoutInterval;}});","filePath":"jsio/net/csp/client.js"},'base':{"src":"\nexports.log=jsio.__env.log;exports.bind=function(context,method){if(arguments.length>2){var args=Array.prototype.slice.call(arguments,2);return typeof method=='string'?function(){if(context[method]){return context[method].apply(context,args.concat(Array.prototype.slice.call(arguments,0)));}else{throw logger.error('No method:',method,'for context',context);}}:function(){return method.apply(context,args.concat(Array.prototype.slice.call(arguments,0)));}}else{return typeof method=='string'?function(){if(context[method]){return context[method].apply(context,arguments);}else{throw logger.error('No method:',method,'for context',context);}}:function(){return method.apply(context,arguments);}}}\nexports.Class=function(parent,proto){if(!parent){throw new Error('parent or prototype not provided');}\nif(!proto){proto=parent;}\nelse if(parent instanceof Array){proto.prototype={};for(var i=0,p;p=parent[i];++i){for(var item in p.prototype){if(!(item in proto.prototype)){proto.prototype[item]=p.prototype[item];}}}\nparent=parent[0];}else{proto.prototype=parent.prototype;}\nvar cls=function(){if(this.init){return this.init.apply(this,arguments);}}\ncls.prototype=new proto(function(context,method,args){var args=args||[];var target=proto;while(target=target.prototype){if(target[method]){return target[method].apply(context,args);}}\nthrow new Error('method '+method+' does not exist');});cls.prototype.constructor=cls;return cls;}\nexports.$setTimeout=function(f,t){var args=Array.prototype.slice.call(arguments,2);return setTimeout(function(){try{f.apply(this,args);}catch(e){}},t)}\nexports.$setInterval=function(f,t){var args=Array.prototype.slice.call(arguments,2);return setInterval(function(){try{f.apply(this,args);}catch(e){}},t)}\nexports.$clearTimeout=function(timer){return timer?clearTimeout(timer):null;};exports.$clearInterval=function(timer){return timer?clearInterval(timer):null;};exports.logging=(function(){var logging={DEBUG:1,LOG:2,INFO:3,WARN:4,ERROR:5};var loggers={}\nvar production=false;logging.setProduction=function(prod){production=!!prod;}\nlogging.get=function(name){return loggers.hasOwnProperty(name)?loggers[name]:(loggers[name]=new Logger(name));}\nlogging.set=function(name,_logger){loggers[name]=_logger;}\nlogging.getAll=function(){return loggers;}\nlogging.__create=function(pkg,ctx){ctx.logger=logging.get(pkg);}\nvar Logger=exports.Class(function(){this.init=function(name,level){this._name=name;this._level=level||logging.LOG;}\nthis.setLevel=function(level){this._level=level;}\nvar slice=Array.prototype.slice;var log=exports.log;function makeLogFunction(level,type){return function(){if(!production&&level>=this._level){return log.apply(log,[type,this._name].concat(slice.call(arguments,0)));}\nreturn arguments[0];}}\nthis.debug=makeLogFunction(logging.DEBUG,\"DEBUG\");this.log=makeLogFunction(logging.LOG,\"LOG\");this.info=makeLogFunction(logging.INFO,\"INFO\");this.warn=makeLogFunction(logging.WARN,\"WARN\");this.error=makeLogFunction(logging.ERROR,\"ERROR\");});return logging;})();var logger=exports.logging.get('jsiocore');","filePath":"jsio/base.js"},'Orbited':{"src":"\njsio('from net.protocols.mspp import MSPPStream, MSPPProtocol');jsio('import std.utf8');exports.logging=logging;exports.utf8=std.utf8;exports.settings={'host':'localhost','port':8000,'path':'/csp'};var multiplexer=null;exports.TCPSocket=Class(MSPPStream,function(){this.init=function(){this.setEncoding('plain');if(multiplexer==null){multiplexer=new MSPPProtocol();multiplexer.setTransport('csp',{\"url\":\"http://\"+exports.settings.host+\":\"+exports.settings.port+exports.settings.path});}\nthis.setMultiplexer(multiplexer);}});","filePath":"Orbited.js"},'std.JSON':{"src":"\nexports.createGlobal=function(){if(typeof JSON=='undefined'){JSON={};}\nif(typeof JSON.stringify!=='function'){JSON.stringify=exports.stringify;}\nif(typeof JSON.parse!=='function'){JSON.parse=exports.parse;}};;(function(){var cx=/[\\u0000\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]/g,escapable=/[\\\\\\\"\\x00-\\x1f\\x7f-\\x9f\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]/g,gap,indent,meta={'\\b':'\\\\b','\\t':'\\\\t','\\n':'\\\\n','\\f':'\\\\f','\\r':'\\\\r','\"':'\\\\\"','\\\\':'\\\\\\\\'},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'\"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==='string'?c:'\\\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4);})+'\"':'\"'+string+'\"';}\nfunction str(key,holder){var mind=gap,value=holder[key];if(value&&typeof value==='object'&&typeof value.toJSON==='function'){value=value.toJSON(key);}\nif(typeof rep==='function'){value=rep.call(holder,key,value);}\nswitch(typeof value){case'string':return quote(value);case'number':return isFinite(value)?String(value):'null';case'boolean':return String(value);case'object':if(value===null){return'null';}\nif(value.constructor===Date){return exports.stringifyDate(value);}\ngap+=indent;var partial=[];if(value.constructor===Array){var length=value.length;for(var i=0;i<length;i+=1){partial[i]=str(i,value)||'null';}\nvar v=partial.length===0?'[]':gap?'[\\n'+gap+\npartial.join(',\\n'+gap)+'\\n'+\nmind+']':'['+partial.join(',')+']';gap=mind;return v;}\nif(rep&&typeof rep==='object'){var length=rep.length;for(var i=0;i<length;i+=1){var k=rep[i];if(typeof k==='string'){var v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}else{for(var k in value){if(Object.hasOwnProperty.call(value,k)){var v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}\nvar v=partial.length===0?'{}':gap?'{\\n'+gap+partial.join(',\\n'+gap)+'\\n'+\nmind+'}':'{'+partial.join(',')+'}';gap=mind;return v;}}\nexports.stringify=function(value,replacer,space){gap='';indent='';if(typeof space==='number'){for(var i=0;i<space;i+=1){indent+=' ';}}else if(typeof space==='string'){indent=space;}\nrep=replacer;if(replacer&&typeof replacer!=='function'&&(typeof replacer!=='object'||typeof replacer.length!=='number')){throw new Error('JSON stringify: invalid replacer');}\nreturn str('',{'':value});};exports.stringifyDate=function(d){var year=d.getUTCFullYear(),month=d.getUTCMonth()+1,day=d.getUTCDate(),hours=d.getUTCHours(),minutes=d.getUTCMinutes(),seconds=d.getUTCSeconds(),ms=d.getUTCMilliseconds();if(month<10){month='0'+month;}\nif(day<10){day='0'+day;}\nif(hours<10){hours='0'+hours;}\nif(minutes<10){minutes='0'+minutes;}\nif(seconds<10){seconds='0'+seconds;}\nif(ms<10){ms='00'+ms;}\nelse if(ms<100){ms='0'+ms;}\nreturn'\"'+year\n+'-'+month\n+'-'+day\n+'T'+hours\n+':'+minutes\n+':'+seconds\n+'.'+ms\n+'Z\"';}\nexports.parse=function(text,reviver){cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return'\\\\u'+\n('0000'+a.charCodeAt(0).toString(16)).slice(-4);});}\nif(/^[\\],:{}\\s]*$/.test(text.replace(/\\\\(?:[\"\\\\\\/bfnrt]|u[0-9a-fA-F]{4})/g,'@').replace(/\"[^\"\\\\\\n\\r]*\"|true|false|null|-?\\d+(?:\\.\\d*)?(?:[eE][+\\-]?\\d+)?/g,']').replace(/(?:^|:|,)(?:\\s*\\[)+/g,'')))\n{var j=eval('('+text+')');if(!reviver){return j;}else{var walk=function(holder,key){var k,v,value=holder[key];if(value&&typeof value==='object'){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v;}else{delete value[k];}}}}\nreturn reviver.call(holder,key,value);}\nreturn walk({'':j},'');}}\nthrow new SyntaxError('JSON.parse');};}());","filePath":"jsio/std/JSON.js"},'std.uri':{"src":"\njsio('from base import *');jsio('import logging');var logger=logging.getLogger('uri');var attrs=[\"source\",\"protocol\",\"authority\",\"userInfo\",\"user\",\"password\",\"host\",\"port\",\"relative\",\"path\",\"directory\",\"file\",\"query\",\"anchor\"];exports.Uri=Class(function(supr){this.init=function(url,isStrict){var uriData=exports.parse(url,isStrict)\nfor(attr in uriData){this['_'+attr]=uriData[attr];};};for(var i=0,attr;attr=attrs[i];++i){(function(attr){var fNameSuffix=attr.charAt(0).toUpperCase()+attr.slice(1);this['get'+fNameSuffix]=function(){return this['_'+attr];};this['set'+fNameSuffix]=function(val){this['_'+attr]=val;};}).call(this,attr);};this.toString=this.render=function(){return this._source;};});exports.buildQuery=function(kvp){var pairs=[];for(key in kvp){pairs.push(encodeURIComponent(key)+'='+encodeURIComponent(kvp[key]));}\nreturn pairs.join('&');}\nvar strictRegex=/^(?:([^:\\/?#]+):)?(?:\\/\\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\\/?#]*)(?::(\\d*))?))?((((?:[^?#\\/]*\\/)*)([^?#]*))(?:\\?([^#]*))?(?:#(.*))?)/;var looseRegex=/^(?:(?![^:@]+:[^:@\\/]*@)([^:\\/?#.]+):)?(?:\\/\\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\\/?#]*)(?::(\\d*))?)(((\\/(?:[^?#](?![^?#\\/]*\\.[^?#\\/.]+(?:[?#]|$)))*\\/?)?([^?#\\/]*))(?:\\?([^#]*))?(?:#(.*))?)/;var queryStringRegex=/(?:^|&)([^&=]*)=?([^&]*)/g;exports.parse=function(str,isStrict){var regex=isStrict?strictRegex:looseRegex;var result={};var match=regex.exec(str);for(var i=0,attr;attr=attrs[i];++i){result[attr]=match[i]||\"\";}\nvar qs=result['queryKey']={};result['query'].replace(queryStringRegex,function(check,key,val){if(check){qs[key]=val;}});return result;}\nexports.isSameDomain=function(urlA,urlB){var a=exports.parse(urlA);var b=exports.parse(urlB);return((a.port==b.port)&&(a.host==b.host)&&(a.protocol==b.protocol));};","filePath":"jsio/std/uri.js"},'net.protocols.buffered':{"src":"\njsio('from base import *');jsio('import logging');jsio('from net.interfaces import Protocol');jsio('from net.buffer import Buffer');var logger=logging.getLogger('Buffered');exports.BufferedProtocol=Class(Protocol,function(supr){this.init=function(){this.buffer=new Buffer();}\nthis.bufferUpdated=function(){}\nthis.dataReceived=function(data){this.buffer.append(data);this.bufferUpdated();}})","filePath":"jsio/net/protocols/buffered.js"},'net':{"src":"\njsio('import net.env');jsio('import std.JSON as JSON');JSON.createGlobal();exports.listen=function(server,transportName,opts){if(!transportName){throw logger.error('No transport provided for net.listen');}\nvar listenerClass=net.env.getListener(transportName);var listener=new listenerClass(server,opts);listener.listen();return listener;}\nexports.connect=function(protocolInstance,transportName,opts){var connector=new(net.env.getConnector(transportName))(protocolInstance,opts);connector.connect();return connector;}\nexports.quickServer=function(protocolClass){jsio('import net.interfaces');return new net.interfaces.Server(protocolClass);}","filePath":"jsio/net.js"},'net.protocols.mspp':{"src":"\njsio('from base import *');jsio('import net');jsio('from net.protocols.buffered import BufferedProtocol');jsio('import logging');jsio('import std.utf8 as utf8');var loggers={};loggers.stream=logging.getLogger('MSPPStream');loggers.protocol=logging.getLogger('MSPPProtocol');var frames={'OPEN':0,'CLOSE':1,'DATA':2};exports.MSPPStream=Class(function(){this.setMultiplexer=function(multiplexer){loggers.stream.debug('setMultiplexer: '+multiplexer);this.multiplexer=multiplexer;}\nthis.setEncoding=function(encoding){loggers.stream.debug('setEncoding: '+encoding);this.encoding=encoding;}\nthis.open=function(host,port,isBinary){if(isBinary)\nthis.encoding='utf8';this.id=this.multiplexer.openStream(this,host,port);loggers.stream.debug('open '+this.id+\": \"+host+\" \"+port+\" \"+isBinary);}\nthis.close=function(){loggers.stream.debug('close '+this.id);this.multiplexer.close(this.id);}\nthis.send=function(data,encoding){loggers.stream.debug('send '+this.id+\": \"+data+\" \"+encoding);if((encoding||this.encoding)=='utf8')\ndata=utf8.encode(data);this.multiplexer.writeToStream(this.id,data);}\nthis._onreadraw=function(data){if(this.encoding=='utf8'){var raw=utf8.decode(data);var length=raw[1];if(length!=data.length){throw new Error(\"Incomplete utf8 codepoint\");}\ndata=raw[0]}\nloggers.stream.debug('_onreadraw '+data);this.onread(data);}\nthis.onopen=function(){}\nthis.onclose=function(err){}\nthis.onread=function(data){}});var state={};state.closed=0;state.connecting=1;state.consuming=2;exports.MSPPProtocol=Class(BufferedProtocol,function(supr){this.init=function(){loggers.protocol.debug('new MSPPProtocol');supr(this,'init',[]);this.state=state.closed;this.transportType=null;this.transportOptions=null;this.currentId=0;this.streams={};this.writeBuffer=[];}\nthis.setTransport=function(transportType,transportOptions){this.transportType=transportType;this.transportOptions=transportOptions;}\nthis.connectionMade=function(isReconnect){loggers.protocol.debug('connectionMade');this.state=state.consuming;for(var i=0;i<this.writeBuffer.length;i++)\nthis._write(this.writeBuffer[i]);writeBuffer=[];}\nthis.connectionLost=this.connectionFailed=function(reason){loggers.protocol.debug('closed: '+reason);this.state=state.closed;for(stream in this.streams)\nthis.streams[stream].onclose(reason);}\nthis.openStream=function(stream,host,port){if(this.state==state.closed){this.state=state.connecting;net.connect(this,this.transportType,this.transportOptions);}\nvar id=++this.currentId;this.streams[id]=stream;this._write([id,frames.OPEN,host+\",\"+port]);return id;}\nthis.closeStream=function(id){this._write([id,frames.CLOSE,\"\"]);}\nthis.writeToStream=function(id,data){this._write([id,frames.DATA,data]);}\nthis.bufferUpdated=function(){loggers.protocol.debug(\"bufferUpdated. state: \"+this.state+\". buffer: \"+this.buffer._rawBuffer);if(this.state!=state.consuming)\nthrow new Error(\"buffer update in invalid MSPP state: \"+this.state);if(!this.buffer.hasDelimiter(':'))\nreturn;var lStr=this.buffer.peekToDelimiter(':');var len=parseInt(lStr);if(!this.buffer.hasBytes(len+lStr.length+1))\nreturn;this.buffer.consumeThroughDelimiter(':');var streamId=this.buffer.consumeToDelimiter(',');this.buffer.consumeBytes(1);var frameType=parseInt(this.buffer.consumeBytes(1));len-=(streamId.length+2);streamId=parseInt(streamId);var data=this.buffer.consumeBytes(len);switch(frameType){case frames.OPEN:this.streams[streamId].onopen();break;case frames.CLOSE:this.streams[streamId].onclose(data);break;case frames.DATA:this.streams[streamId]._onreadraw(data);break;default:throw new Error('invalid MSPP data type!');}}\nthis._write=function(data){if(this.state!=state.consuming){loggers.protocol.debug(\"buffering write: \"+data);this.writeBuffer.push(data);return;}\nvar s=data[0]+\",\"+data[1]+data[2];s=s.length+\":\"+s;loggers.protocol.debug('write: '+s);this.transport.write(s);}});","filePath":"jsio/net/protocols/mspp.js"},'util.browserdetect':{"src":"\nexports.BrowserDetect=new function(){var versionSearchString;var dataBrowser=[{string:navigator.userAgent,subString:\"Chrome\"},{string:navigator.userAgent,subString:\"OmniWeb\",versionSearch:\"OmniWeb/\"},{string:navigator.vendor,subString:\"Apple\",identity:\"Safari\",versionSearch:\"Version\"},{prop:window.opera,identity:\"Opera\"},{string:navigator.vendor,subString:\"iCab\"},{string:navigator.vendor,subString:\"KDE\",identity:\"Konqueror\"},{string:navigator.userAgent,subString:\"Firefox\"},{string:navigator.vendor,subString:\"Camino\"},{string:navigator.userAgent,subString:\"Netscape\"},{string:navigator.userAgent,subString:\"MSIE\",identity:\"IE\",versionSearch:\"MSIE\"},{string:navigator.userAgent,subString:\"Gecko\",identity:\"Mozilla\",versionSearch:\"rv\"},{string:navigator.userAgent,subString:\"Mozilla\",identity:\"Netscape\",versionSearch:\"Mozilla\"}];var dataOS=[{string:navigator.platform,subString:\"Win\",identity:\"Windows\"},{string:navigator.platform,subString:\"Mac\"},{string:navigator.userAgent,subString:\"iPhone\",identity:\"iPhone/iPod\"},{string:navigator.platform,subString:\"Linux\"}];function searchString(data){for(var i=0,item;item=data[i];i++){var dataString=item.string;var dataProp=item.prop;item.identity=item.identity||item.subString;versionSearchString=item.versionSearch||item.identity;if(dataString){if(dataString.indexOf(item.subString)!=-1)\nreturn item.identity;}else if(dataProp)\nreturn item.identity;}}\nfunction searchVersion(dataString){var index=dataString.indexOf(versionSearchString);if(index==-1)return;return parseFloat(dataString.substring(index+versionSearchString.length+1));}\nthis.browser=searchString(dataBrowser)||\"unknown\";this.version=searchVersion(navigator.userAgent)||searchVersion(navigator.appVersion)||\"unknown\";this.OS=searchString(dataOS)||\"unknown\";this.isWebKit=RegExp(\" AppleWebKit/\").test(navigator.userAgent);this['is'+this.browser]=this.version;};","filePath":"jsio/util/browserdetect.js"},'std.utf8':{"src":"\nexports.UnicodeCodecError=function(message){this.message=message;};var UnicodeCodecError=exports.UnicodeCodecError;UnicodeCodecError.prototype.toString=function(){return'UnicodeCodecError'+(this.message?': '+this.message:'');};exports.encode=function(unicode_string){try{return unescape(encodeURIComponent(unicode_string));}\ncatch(err){throw new UnicodeCodecError('invalid input string');};};exports.decode=function(bytes){if(/[^\\x00-\\xFF]/.test(bytes)){throw new UnicodeCodecError('invalid utf-8 bytes');};var len,len_parsed;len=len_parsed=bytes.length;var last=len-1;if(bytes.charCodeAt(last)>=0x80){for(var i=1;i<=3;i++){if(bytes.charCodeAt(len-i)>=0xC0){len_parsed=len-i;break;};};try{decodeURIComponent(escape(bytes.slice(len_parsed)));len_parsed=len;}\ncatch(err){};};try{return[decodeURIComponent(escape(bytes.slice(0,len_parsed))),len_parsed];}\ncatch(err){throw new UnicodeCodecError('invalid utf-8 bytes');};};","filePath":"jsio/std/utf8.js"}};function bind(context,method){var args=Array.prototype.slice.call(arguments,2);return function(){method=(typeof method=='string'?context[method]:method);return method.apply(context,args.concat(Array.prototype.slice.call(arguments,0)));}}
 jsio=bind(this,importer,null,'');jsio.__filename='jsio.js';jsio.modules=[];jsio.setCachedSrc=function(pkg,filePath,src){sourceCache[pkg]={filePath:filePath,src:src};}
-jsio.getCachedSrc=function(pkg){return sourceCache[pkg];}
 jsio.path={};jsio.setPath=function(path){jsio.path.__default__=typeof path=='string'?[path]:path;}
 jsio.setEnv=function(env){if(ENV&&(env==ENV||env==ENV.name)){return;}
 if(typeof env=='string'){switch(env){case'node':ENV=new ENV_node();break;case'browser':default:ENV=new ENV_browser();break;}
 ENV.name=env;}else{ENV=env;}
 jsio.__env=ENV;jsio.__dir=ENV.getCwd();if(!jsio.path.__default__){jsio.setPath(ENV.getPath());}}
-if(typeof process!=='undefined'&&process.version){jsio.setEnv('node');}else if(typeof XMLHttpRequest!='undefined'||typeof ActiveXObject!='undefined'){jsio.setEnv('browser');}
+if(typeof node!=='undefined'&&typeof process!=='undefined'&&process.version){jsio.setEnv('node');}else if(typeof XMLHttpRequest!='undefined'||typeof ActiveXObject!='undefined'){jsio.setEnv('browser');}
 function ENV_node(){var fs=require('fs'),sys=require('sys');this.global=GLOBAL;this.getCwd=process.cwd;this.log=function(){var msg;try{sys.error(msg=Array.prototype.map.call(arguments,function(a){if((a instanceof Error)&&a.message){return'Error:'+a.message+'\nStack:'+a.stack+'\nArguments:'+a.arguments;}
 return typeof a=='string'?a:JSON.stringify(a);}).join(' '));}catch(e){sys.error(msg=Array.prototype.join.call(arguments,' ')+'\n');}
 return msg;}
 this.eval=process.compile;this.findModule=function(possibilities){for(var i=0,possible;possible=possibilities[i];++i){try{possible.src=fs.readFileSync(possible.filePath);return possible;}catch(e){}}
 return false;}
 this.require=require;this.include=include;}
-function ENV_browser(){var XHR=window.XMLHttpRequest||function(){return new ActiveXObject("Msxml2.XMLHTTP");},SLICE=Array.prototype.slice,cwd=null,path=null;this.global=window;this.global.jsio=jsio;this.log=function(){var args=SLICE.call(arguments,0);if(typeof console!='undefined'&&console.log){if(console.log.apply){console.log.apply(console,arguments);}else{console.log(args);}}
-return args.join(' ');}
-this.getCwd=function(){if(!cwd){var location=window.location.toString().split('#')[0];cwd=location.substring(0,location.lastIndexOf('/')+1);}
+function ENV_browser(){var XHR=window.XMLHttpRequest||function(){return new ActiveXObject("Msxml2.XMLHTTP");}
+this.global=window;this.global.jsio=jsio;this.log=function(){if(typeof console!='undefined'&&console.log){console.log.apply(console,arguments);}
+return Array.prototype.join.call(arguments,' ');}
+var cwd=null,path=null;this.getCwd=function(){if(!cwd){var location=window.location.toString();cwd=location.substring(0,location.lastIndexOf('/')+1);}
 return cwd;}
-this.getPath=function(){if(!path){try{var filename=new RegExp('(.*?)'+jsio.__filename+'(\\?.*)?$'),scripts=document.getElementsByTagName('script');for(var i=0,script;script=scripts[i];++i){var result=script.src.match(filename);if(result){path=result[1];if(/^[A-Za-z]*:\/\//.test(path)){path=makeRelativePath(path,this.getCwd());}
+this.getPath=function(){if(!path){try{var filename=new RegExp('(.*?)'+jsio.__filename+'(\\?.*)?$');var scripts=document.getElementsByTagName('script');for(var i=0,script;script=scripts[i];++i){var result=script.src.match(filename);if(result){path=result[1];if(/^[A-Za-z]*:\/\//.test(path)){path=makeRelativePath(path,this.getCwd());}
 break;}}}catch(e){}
 if(!path){path='.';}}
 return path;}
 var rawEval=typeof eval('(function(){})')=='undefined'?function(src,path){return(new Function('return '+src))();}:function(src,path){var src=src+'\n//@ sourceURL='+path;return window.eval(src);}
-this.eval=function(code,path){try{return rawEval(code,path);}catch(e){if(e instanceof SyntaxError){e.message="a syntax error is preventing execution of "+path;e.type="syntax_error";try{var cb=function(){var el=document.createElement('iframe');el.style.cssText="position:absolute;top:-999px;left:-999px;width:1px;height:1px;visibility:hidden";el.src='javascript:document.open();document.write("<scr"+"ipt src=\''+path+'\'></scr"+"ipt>")';setTimeout(function(){try{document.body.appendChild(el)}catch(e){}},0);};if(document.body){cb();}
-else{window.addEventListener('load',cb,false);}}catch(f){}}
+this.eval=function(code,path){try{return rawEval(code,path);}catch(e){if(e instanceof SyntaxError){var src='javascript:document.open();document.write("<scr"+"ipt src=\''+path+'\'></scr"+"ipt>")';var callback=function(){var el=document.createElement('iframe');with(el.style){position='absolute';top=left='-999px';width=height='1px';visibility='hidden';}
+el.src=src;setTimeout(function(){try{document.body.appendChild(el)}catch(e){}},0);}
+if(document.body){callback();}
+else{window.addEventListener('load',callback,false);}
+throw new Error("forcing halt on load of "+path);}
 throw e;}}
 this.findModule=function(possibilities){for(var i=0,possible;possible=possibilities[i];++i){var xhr=new XHR();try{xhr.open('GET',possible.filePath,false);xhr.send(null);}catch(e){ENV.log('e:',e);continue;}
 if(xhr.status==404||xhr.status==-1100||false)
 throw new Error("Module not found: "+pathString+" (looked in "+paths.join(', ')+")");}
 if(!(module.baseMod in jsio.path)){jsio.path[module.baseMod]=module.basePath;}
 return module;}
-function execModule(context,module){var code="(function(_){with(_){delete _;(function(){"+module.src+"\n}).call(this)}})";var fn=ENV.eval(code,module.filePath);try{fn.call(context.exports,context);}catch(e){if(e.type=="syntax_error"){throw new Error("error importing module: "+e.message);}else if(!e.jsioLogged){e.jsioLogged=true;if(e.type=="stack_overflow"){ENV.log("Stack overflow in",module.filePath,':',e);}else{ENV.log("ERROR LOADING",module.filePath,':',e);}}
+function execModule(context,module){var code="(function(_){with(_){delete _;(function(){"+module.src+"\n}).call(this)}})";var fn=ENV.eval(code,module.filePath);try{fn.call(context.exports,context);}catch(e){if(e.type=="stack_overflow"){ENV.log("Stack overflow in",module.filePath,':',e);}else{ENV.log("error when loading",module.filePath,':',e);}
 throw e;}};function resolveRelativePath(pkg,path,pathSep){if(!path||(pathSep=pathSep||'.')!=pkg.charAt(0)){return pkg;}
 var i=1;while(pkg.charAt(i)==pathSep){++i;}
 path=path.split(pathSep).slice(0,-i);if(path.length){path=path.join(pathSep);if(path.charAt(path.length-1)!=pathSep){path+=pathSep;}}
 return path+pkg.substring(i);}
-function resolveImportRequest(path,request){var match,imports=[];if((match=request.match(/^(from|external)\s+([\w.$]+)\s+import\s+(.*)$/))){imports[0]={from:resolveRelativePath(match[2],path),external:match[1]=='external','import':{}};match[3].replace(/\s*([\w.$*]+)(?:\s+as\s+([\w.$]+))?/g,function(_,item,as){imports[0]['import'][item]=as||item;});}else if((match=request.match(/^import\s+(.*)$/))){match[1].replace(/\s*([\w.$]+)(?:\s+as\s+([\w.$]+))?,?/g,function(_,pkg,as){fullPkg=resolveRelativePath(pkg,path);imports[imports.length]=as?{from:fullPkg,as:as}:{from:fullPkg,as:pkg};});}else if((match=request.match(/[\w.0-9$\/]/))){var req=match[0],isAbsolute=req.charAt(0)=='/';req=req.replace(/^\//,'').replace(/\.\.?\//g,'.').replace(/\//g,'.');imports[0]={from:isAbsolute?req:resolveRelativePath(req,path),as:req};}else{var msg='Invalid jsio request: jsio(\''+request+'\')';throw SyntaxError?new SyntaxError(msg):new Error(msg);}
-return imports;};function makeContext(pkgPath,filePath){var ctx={exports:{},global:ENV.global},cwd=ENV.getCwd(),i=filePath.lastIndexOf('/'),isRelative=i>0;ctx.require=ctx.jsio=bind(this,importer,ctx,pkgPath);ctx.module={id:pkgPath};if(pkgPath!='base'){ctx.jsio('from base import *');ctx.logging.__create(pkgPath,ctx);}
-ctx.jsio.__jsio=jsio;ctx.jsio.__env=jsio.__env;ctx.jsio.__dir=isRelative?makeRelativePath(filePath.substring(0,i),cwd):'';ctx.jsio.__filename=isRelative?filePath.substring(i):filePath;ctx.jsio.__path=pkgPath;return ctx;};function makeRelativePath(path,relativeTo){var i=path.match('^'+relativeTo);if(i&&i[0]==relativeTo){var offset=path[relativeTo.length]=='/'?1:0
+function resolveImportRequest(path,request){var match,imports=[];if((match=request.match(/^(from|external)\s+([\w.$]+)\s+import\s+(.*)$/))){imports[0]={from:resolveRelativePath(match[2],path),external:match[1]=='external',"import":{}};match[3].replace(/\s*([\w.$*]+)(?:\s+as\s+([\w.$]+))?/g,function(_,item,as){imports[0]["import"][item]=as||item;});}else if((match=request.match(/^import\s+(.*)$/))){match[1].replace(/\s*([\w.$]+)(?:\s+as\s+([\w.$]+))?,?/g,function(_,pkg,as){fullPkg=resolveRelativePath(pkg,path);imports[imports.length]=as?{from:fullPkg,as:as}:{from:fullPkg,as:pkg};});}else{var msg='Invalid jsio request: jsio(\''+request+'\')';throw SyntaxError?new SyntaxError(msg):new Error(msg);}
+return imports;};function makeContext(pkgPath,filePath){var ctx={exports:{},global:ENV.global};ctx.jsio=bind(this,importer,ctx,pkgPath);if(pkgPath!='base'){ctx.jsio('from base import *');ctx.logging.__create(pkgPath,ctx);}
+var cwd=ENV.getCwd();var i=filePath.lastIndexOf('/');ctx.jsio.__env=jsio.__env;ctx.jsio.__dir=i>0?makeRelativePath(filePath.substring(0,i),cwd):'';ctx.jsio.__filename=i>0?filePath.substring(i):filePath;ctx.jsio.__path=pkgPath;return ctx;};function makeRelativePath(path,relativeTo){var i=path.match('^'+relativeTo);if(i&&i[0]==relativeTo){var offset=path[relativeTo.length]=='/'?1:0
 return path.slice(relativeTo.length+offset);}
-return path;};function importer(context,path,request,altContext){context=altContext||context||ENV.global;var imports=resolveImportRequest(path,request),numImports=imports.length,retVal=numImports>1?{}:null;for(var i=0;i<numImports;++i){var item=imports[i],pkg=item.from,modules=jsio.modules;if(!(pkg in modules)){try{var module=sourceCache[pkg]||loadModule(pkg);}catch(e){ENV.log('\nError executing \'',request,'\': could not load module',pkg,'\n\tpath:',path,'\n\trequest:',request,'\n');throw e;}
-if(!item.external){var newContext=makeContext(pkg,module.filePath);modules[pkg]=newContext.exports;execModule(newContext,module);modules[pkg]=newContext.exports;}else{var newContext=modules[pkg]={};for(var j in item['import']){newContext[j]=undefined;}
-execModule(newContext,module);for(var j in item['import']){if(newContext[j]===undefined){newContext[j]=ENV.global[j];}}}}
-var module=modules[pkg];if(numImports==1){retVal=module;}
-if(item.as){var as=item.as.match(/^\.*(.*?)\.*$/)[1],segments=as.split('.'),kMax=segments.length-1,c=context;for(var k=0;k<kMax;++k){var segment=segments[k];if(!segment)continue;if(!c[segment]){c[segment]={};}
+return path;};function importer(context,path,request,altContext){context=context||ENV.global;var imports=resolveImportRequest(path,request);for(var i=0,item,len=imports.length;(item=imports[i])||i<len;++i){var pkg=item.from;var modules=jsio.modules;if(!(pkg in modules)){try{var module=sourceCache[pkg]||loadModule(pkg);}catch(e){ENV.log('\nError executing \'',request,'\': could not load module',pkg,'\n\tpath:',path,'\n\trequest:',request,'\n');throw e;}
+if(!item.external){var newContext=makeContext(pkg,module.filePath);execModule(newContext,module);modules[pkg]=newContext.exports;}else{var newContext={};for(var j in item['import']){newContext[j]=undefined;}
+execModule(newContext,module);modules[pkg]=newContext;for(var j in item['import']){if(newContext[j]===undefined){newContext[j]=ENV.global[j];}}}}
+var c=altContext||context;if(item.as){var segments=item.as.match(/^\.*(.*?)\.*$/)[1].split('.');for(var k=0,slen=segments.length-1,segment;(segment=segments[k])&&k<slen;++k){if(!segment)continue;if(!c[segment]){c[segment]={};}
 c=c[segment];}
-c[segments[kMax]]=module;if(numImports>1){retVal[as]=module;}}else if(item['import']){if(item['import']['*']){for(var k in modules[pkg]){context[k]=module[k];}}else{try{for(var k in item['import']){context[item['import'][k]]=module[k];}}catch(e){ENV.log('module: ',modules);throw e;}}}}
-return retVal;}})();jsio("import Orbited as Orbited");
+c[segments[slen]]=modules[pkg];}else if(item['import']){if(item['import']['*']){for(var k in modules[pkg]){c[k]=modules[pkg][k];}}else{try{for(var k in item['import']){c[item['import'][k]]=modules[pkg][k];}}catch(e){ENV.log('module: ',modules);throw e;}}}}}})();jsio("import Orbited");
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.