(function(){function require(p,parent,orig){var path=require.resolve(p),mod=require.modules[path];if(null==path){orig=orig||p;parent=parent||"root";throw new Error('failed to require "'+orig+'" from "'+parent+'"')}if(!mod.exports){mod.exports={};mod.client=mod.component=true;mod.call(this,mod,mod.exports,require.relative(path))}return mod.exports}require.modules={};require.aliases={};require.resolve=function(path){var orig=path,reg=path+".js",regJSON=path+".json",index=path+"/index.js",indexJSON=path+"/index.json";return require.modules[reg]&®||require.modules[regJSON]&®JSON||require.modules[index]&&index||require.modules[indexJSON]&&indexJSON||require.modules[orig]&&orig||require.aliases[index]};require.normalize=function(curr,path){var segs=[];if("."!=path.charAt(0))return path;curr=curr.split("/");path=path.split("/");for(var i=0;i1){return{type:packetslist[type],data:data.substring(1)}}else{return{type:packetslist[type]}}};exports.encodePayload=function(packets){if(!packets.length){return"0:"}var encoded="",message;for(var i=0,l=packets.length;i')}catch(e){iframe=document.createElement("iframe");iframe.name=self.iframeId}iframe.id=self.iframeId;self.form.appendChild(iframe);self.iframe=iframe}initIframe();this.area.value=data.replace(rNewline,"\\n");try{this.form.submit()}catch(e){}if(this.iframe.attachEvent){this.iframe.onreadystatechange=function(){if(self.iframe.readyState=="complete"){complete()}}}else{this.iframe.onload=complete}}});require.register("learnboost-engine.io-client/lib/transports/websocket.js",function(module,exports,require){var Transport=require("../transport"),parser=require("../parser"),util=require("../util"),debug=require("debug")("engine.io-client:websocket");module.exports=WS;var global="undefined"!=typeof window?window:global;function WS(opts){Transport.call(this,opts)}util.inherits(WS,Transport);WS.prototype.name="websocket";WS.prototype.doOpen=function(){if(!this.check()){return}var self=this;this.socket=new(ws())(this.uri());this.socket.onopen=function(){self.onOpen()};this.socket.onclose=function(){self.onClose()};this.socket.onmessage=function(ev){self.onData(ev.data)};this.socket.onerror=function(e){self.onError("websocket error",e)}};WS.prototype.write=function(packets){for(var i=0,l=packets.length;i=hour)return(ms/hour).toFixed(1)+"h";if(ms>=min)return(ms/min).toFixed(1)+"m";if(ms>=sec)return(ms/sec|0)+"s";return ms+"ms"};debug.enabled=function(name){for(var i=0,len=debug.skips.length;ithis._reconnectionAttempts){this.emit("reconnect_failed");this.reconnecting=false}else{var delay=this.attempts*this._reconnectionDelay;delay=Math.min(delay,this._reconnectionDelayMax);debug("will wait %d before reconnect attempt",delay);this.reconnecting=true;var timer=setTimeout(function(){debug("attemptign reconnect");self.open(function(err){if(err){debug("reconnect attempt error");self.reconnect();return self.emit("reconnect_error",err.data)}else{debug("reconnect success");self.onreconnect()}})},delay);this.subs.push({destroy:function(){clearTimeout(timer)}})}};Manager.prototype.onreconnect=function(){var attempt=this.attempts;this.attempts=0;this.reconnecting=false;this.emit("reconnect",attempt)};try{bind=require("bind");object=require("object")}catch(e){bind=require("bind-component");object=require("object-component")}});require.register("socket.io/lib/engine.js",function(module,exports,require){var engine;try{engine=require("engine.io-client")}catch(e){engine=require("engine.io")}module.exports=engine});require.register("socket.io/lib/socket.js",function(module,exports,require){var parser=require("socket.io-parser"),Emitter=require("./emitter"),toArray=require("to-array"),debug=require("debug")("socket.io-client:socket"),on=require("./on"),bind;module.exports=exports=Socket;var events=exports.events=["connect","disconnect","error"];var emit=Emitter.prototype.emit;function Socket(io,nsp){this.io=io;this.nsp=nsp;this.json=this;this.ids=0;this.acks={};this.open();this.buffer=[];this.connected=false}Emitter(Socket.prototype);Socket.prototype.open=Socket.prototype.connect=function(){var io=this.io;io.open();if("open"==this.io.readyState)this.onopen();this.subs=[on(io,"open",bind(this,"onopen")),on(io,"error",bind(this,"onerror"))]};Socket.prototype.send=function(){var args=toArray(arguments);args.shift("message");this.emit.apply(this,args);return this};Socket.prototype.emit=function(ev){if(~events.indexOf(ev)){emit.apply(this,arguments)}else{var args=toArray(arguments);var packet={type:parser.EVENT,args:args};if("function"==typeof args[args.length-1]){debug("emitting packet with ack id %d",this.ids);this.acks[this.ids]=args.pop();packet.id=this.ids++}this.packet(packet)}return this};Socket.prototype.packet=function(packet){packet.nsp=this.nsp;this.io.write(parser.encode(packet))};Socket.prototype.onerror=function(data){this.emit("error",data)};Socket.prototype.onopen=function(){var io=this.io;this.subs.push(on(io,"packet",bind(this,"onpacket")),on(io,"close",bind(this,"onclose")))};Socket.prototype.onclose=function(reason){debug("close (%s)",reason);this.emit("disconnect",reason)};Socket.prototype.onpacket=function(packet){if(packet.nsp!=this.nsp)return;switch(packet.type){case parser.CONNECT:this.onconnect();break;case parser.EVENT:this.onevent(packet);break;case parser.ACK:this.onack(packet);break;case parser.DISCONNECT:this.ondisconnect();break;case parser.ERROR:this.emit("error",packet.data);break}};Socket.prototype.onevent=function(packet){var args=packet.data||[];debug("emitting event %j",args);if(packet.id){debug("attaching ack callback to event");args.push(this.ack(packet.id))}if(this.connected){emit.apply(this,args)}else{this.buffer.push(args)}};Socket.prototype.ack=function(){var self=this;var sent=false;return function(){if(sent)return;var args=toArray(arguments);debug("sending ack %j",args);self.packet({type:parser.ACK,data:args})}};Socket.prototype.onack=function(packet){debug("calling ack %s with %j",packet.id,packet.data);this.acks[packet.id].apply(this,packet.data);delete this.acks[packet.id]};Socket.prototype.onconnect=function(){this.emit("connect");this.connected=true;this.emitBuffered()};Socket.prototype.emitBuffered=function(){for(var i=0;i