Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

remove cookies, update engine.io

  • Loading branch information...
commit 3b1a5f6a1daa32724c7db1884edfbee3283f502c 1 parent fed33ef
Eric Schoffstall contra authored
21 README.md
View
@@ -17,6 +17,8 @@
</tr>
</table>
+Vein uses ES5 features so be sure to include es5shim on your page.
+
## Example
### Server
@@ -67,23 +69,6 @@ vein.add('getNumber', function (res, name, num) {
});
```
-### Cookies
-
-The server can read and write cookies to the client via res.cookie()
-
-```javascript
-vein.add('login', function (res, username, password) {
- if (res.cookie('login')) {
- res.reply(false, 'You already logged in!');
- } else if (username == 'username' && password == 'pass123') {
- res.cookie('login', 'success');
- res.reply(true);
- } else {
- res.reply(false, 'Invalid username or password');
- }
-});
-```
-
### Middleware
You can use middleware to add layers in front of your services. Any arguments passed into next will be thrown as an error on the client and end the middleware chain.
@@ -104,7 +89,7 @@ vein.use(function(req, res, next){
### Testing
-Vein supports calling the res object as a function. If you write your code like this you will be able to test your services without writing anything specific to vein. The only difference is that you still have to put the callback first (this is to prevent headaches with variable arguments).
+Vein supports calling the res object as a function. This makes it easier to integrate vanilla-JS services into vein. The only difference is that you still have to put the callback first (this is to prevent headaches with variable arguments from the client).
```javascript
vein.add('echoUser', function (res, username, password) {
100 examples/add/vein.js
View
@@ -6,7 +6,7 @@
* @api public.
*/
-exports.version = '0.2.1';
+exports.version = '0.2.2';
/**
* Protocol version.
@@ -421,7 +421,7 @@ exports.decodePayload = function (data) {
*/
var Polling = require('./polling')
- , util = require('../util')
+ , util = require('../util');
/**
* Module exports.
@@ -433,13 +433,13 @@ module.exports = JSONPPolling;
* Cached regular expressions.
*/
-var rNewline = /\n/g
+var rNewline = /\n/g;
/**
* Global JSONP callbacks.
*/
-var callbacks = global.___eio = [];
+var callbacks;
/**
* Callbacks count.
@@ -463,8 +463,16 @@ function empty () { }
function JSONPPolling (opts) {
Polling.call(this, opts);
+ // define global callbacks array if not present
+ // we do this here (lazily) to avoid unneeded global pollution
+ if (!callbacks) {
+ // we need to consider multiple engines in the same page
+ if (!global.___eio) global.___eio = [];
+ callbacks = global.___eio;
+ }
+
// callback identifier
- this.index = index++;
+ this.index = callbacks.length;
// add callback to jsonp global
var self = this;
@@ -473,7 +481,7 @@ function JSONPPolling (opts) {
});
// append to query string
- this.query.j = callbacks.length - 1;
+ this.query.j = this.index;
};
/**
@@ -532,7 +540,7 @@ JSONPPolling.prototype.doPoll = function () {
script.async = true;
script.src = this.uri();
- var insertAt = document.getElementsByTagName('script')[0]
+ var insertAt = document.getElementsByTagName('script')[0];
insertAt.parentNode.insertBefore(script, insertAt);
this.script = script;
@@ -554,7 +562,7 @@ JSONPPolling.prototype.doPoll = function () {
*/
JSONPPolling.prototype.doWrite = function (data, fn) {
- var self = this
+ var self = this;
if (!this.form) {
var form = document.createElement('form')
@@ -613,7 +621,7 @@ JSONPPolling.prototype.doWrite = function (data, fn) {
} catch(e) {}
if (this.iframe.attachEvent) {
- iframe.onreadystatechange = function () {
+ this.iframe.onreadystatechange = function(){
if (self.iframe.readyState == 'complete') {
complete();
}
@@ -2692,10 +2700,6 @@ Transport.prototype.onClose = function () {
if (!Array.isArray(msg.args)) {
return done(false);
}
- } else if (msg.type === 'cookie') {
- if (typeof msg.key !== 'string') {
- return done(false);
- }
} else if (msg.type === 'services') {
if (!Array.isArray(msg.args)) {
return done(false);
@@ -2711,9 +2715,8 @@ Transport.prototype.onClose = function () {
message: function(socket, msg) {
var k, _i, _len, _ref, _ref1;
if (msg.type === 'response') {
- return (_ref = this.callbacks)[msg.id].apply(_ref, msg.args);
- } else if (msg.type === 'cookie') {
- return this.cookie(msg.key, msg.val);
+ (_ref = this.callbacks)[msg.id].apply(_ref, msg.args);
+ return delete this.callbacks[msg.id];
} else if (msg.type === 'services') {
this.services = msg.args;
_ref1 = this.services;
@@ -2736,72 +2739,9 @@ Transport.prototype.onClose = function () {
type: 'request',
id: id,
service: service,
- args: args,
- cookies: _this.cookie()
+ args: args
});
};
- },
- cookie: function(key, val, expires) {
- var all, remove, set, _ref,
- _this = this;
- if (isBrowser) {
- all = function() {
- var cookie, pair, _i, _len, _ref;
- out = {};
- _ref = document.cookie.split(";");
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- cookie = _ref[_i];
- pair = cookie.split("=");
- if (!(pair[0] && pair[1])) {
- continue;
- }
- out[pair[0].trim()] = pair[1].trim();
- }
- return out;
- };
- set = function(key, val, expires) {
- var sExpires;
- sExpires = "";
- if (typeof expires === 'number') {
- sExpires = "; max-age=" + expires;
- }
- if (typeof expires === 'string') {
- sExpires = "; expires=" + expires;
- }
- if (typeof expires === 'object' ? expires.toGMTString : void 0) {
- sExpires = "; expires=" + (expires.toGMTString());
- }
- document.cookie = "" + (escape(key)) + "=" + (escape(val)) + sExpires;
- };
- remove = function(key) {
- document.cookie = "" + (escape(key)) + "=; expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/";
- };
- } else {
- if ((_ref = this.cookies) == null) {
- this.cookies = {};
- }
- all = function() {
- return _this.cookies;
- };
- set = function(key, val, expires) {
- _this.cookies[key] = val;
- };
- remove = function(key) {
- delete _this.cookies[key];
- };
- }
- if (!key) {
- return all();
- }
- if (key && val === null) {
- return remove(key);
- }
- if (key && !val) {
- return all()[key];
- }
- if (key && val) {
- return set(key, val, expires);
- }
}
};
for (k in opt) {
41 lib/Client.coffee
View
@@ -26,8 +26,6 @@ client = (opt) ->
return done false unless typeof @callbacks[msg.id] is 'function'
return done false unless typeof msg.service is 'string'
return done false unless Array.isArray msg.args
- else if msg.type is 'cookie'
- return done false unless typeof msg.key is 'string'
else if msg.type is 'services'
return done false unless Array.isArray msg.args
else
@@ -39,11 +37,10 @@ client = (opt) ->
message: (socket, msg) ->
if msg.type is 'response'
@callbacks[msg.id] msg.args...
- else if msg.type is 'cookie'
- @cookie msg.key, msg.val
+ delete @callbacks[msg.id]
else if msg.type is 'services'
@services = msg.args
- @[k]=@getSender(socket,k) for k in @services
+ @[k] = @getSender(socket,k) for k in @services
@synced = true
@emit 'ready', @services
@@ -56,40 +53,6 @@ client = (opt) ->
id: id
service: service
args: args
- cookies: @cookie()
-
- cookie: (key, val, expires) ->
- if isBrowser
- all = ->
- out = {}
- for cookie in document.cookie.split ";"
- pair = cookie.split "="
- continue unless pair[0] and pair[1]
- out[pair[0].trim()] = pair[1].trim()
- return out
- set = (key, val, expires) ->
- sExpires = ""
- sExpires = "; max-age=#{expires}" if typeof expires is 'number'
- sExpires = "; expires=#{expires}" if typeof expires is 'string'
- sExpires = "; expires=#{expires.toGMTString()}" if expires.toGMTString if typeof expires is 'object'
- document.cookie = "#{escape(key)}=#{escape(val)}#{sExpires}"
- return
- remove = (key) ->
- document.cookie = "#{escape(key)}=; expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/"
- return
- else
- @cookies ?= {}
- all = => @cookies
- set = (key, val, expires) =>
- @cookies[key] = val
- return
- remove = (key) =>
- delete @cookies[key]
- return
- return all() unless key
- return remove key if key and val is null
- return all()[key] if key and not val
- return set key, val, expires if key and val
out.options[k]=v for k,v of opt
return out
14 lib/Server.coffee
View
@@ -38,7 +38,6 @@ module.exports = (opt) ->
return done false unless typeof msg.service is 'string'
return done false unless typeof @services[msg.service] is 'function'
return done false unless Array.isArray msg.args
- return done false if msg.cookies? and typeof msg.cookies isnt 'object'
else
return done false
return done true
@@ -67,19 +66,6 @@ module.exports = (opt) ->
args: args
return @
- responder.cookie = (key, val) ->
- # TODO: implement expires
- return msg.cookies unless key or val
- if key and not val
- return msg.cookies[key]
- else
- msg.cookies[key] = val
- socket.write
- type: 'cookie'
- key: key
- val: val
- return @
-
responder.reply = responder
return responder
4 package.json
View
@@ -1,7 +1,7 @@
{
"name":"vein",
"description":"WebSocket RPC",
- "version":"0.4.1",
+ "version":"0.4.2",
"homepage":"http://github.com/wearefractal/vein",
"repository":"git://github.com/wearefractal/vein.git",
"author":"Fractal <contact@wearefractal.com> (http://wearefractal.com/)",
@@ -10,7 +10,7 @@
"dependencies":{
"coffee-script":"*",
"async":"*",
- "protosock":"0.0.5"
+ "protosock":"0.0.6"
},
"devDependencies":{
"mocha":"*",
19 test/server.coffee
View
@@ -53,7 +53,6 @@ describe 'Vein', ->
services.should.eql ['test']
client.test 5, 6, (num) ->
num.should.equal 30
- serv.destroy()
done()
it 'should call as fn', (done) ->
@@ -69,27 +68,12 @@ describe 'Vein', ->
services.should.eql ['test']
client.test 5, 6, (num) ->
num.should.equal 30
- serv.destroy()
- done()
-
- it 'should transmit cookies', (done) ->
- serv = getServer()
- serv.add 'test', (res) ->
- res.cookie 'result', 'oi'
- res.reply 'goyta'
-
- client = getClient serv
- client.ready (services) ->
- client.test ->
- client.cookie('result').should.equal 'oi'
- serv.destroy()
done()
describe 'middleware', ->
it 'should add', (done) ->
serv = getServer()
serv.use (req, res, next) -> next()
- serv.destroy()
done()
it 'should call', (done) ->
@@ -105,7 +89,6 @@ describe 'Vein', ->
client.ready (services) ->
client.test ->
called.should.equal true
- serv.destroy()
done()
describe 'client', ->
@@ -116,7 +99,7 @@ describe 'client', ->
client2 = getClient serv
client2.ready (services) -> done()
- it 'should disconnect before ready', (done) ->
+ it 'should disconnect after ready', (done) ->
serv = getServer()
client = getClient serv
client.ready ->
100 vein.js
View
@@ -6,7 +6,7 @@
* @api public.
*/
-exports.version = '0.2.1';
+exports.version = '0.2.2';
/**
* Protocol version.
@@ -421,7 +421,7 @@ exports.decodePayload = function (data) {
*/
var Polling = require('./polling')
- , util = require('../util')
+ , util = require('../util');
/**
* Module exports.
@@ -433,13 +433,13 @@ module.exports = JSONPPolling;
* Cached regular expressions.
*/
-var rNewline = /\n/g
+var rNewline = /\n/g;
/**
* Global JSONP callbacks.
*/
-var callbacks = global.___eio = [];
+var callbacks;
/**
* Callbacks count.
@@ -463,8 +463,16 @@ function empty () { }
function JSONPPolling (opts) {
Polling.call(this, opts);
+ // define global callbacks array if not present
+ // we do this here (lazily) to avoid unneeded global pollution
+ if (!callbacks) {
+ // we need to consider multiple engines in the same page
+ if (!global.___eio) global.___eio = [];
+ callbacks = global.___eio;
+ }
+
// callback identifier
- this.index = index++;
+ this.index = callbacks.length;
// add callback to jsonp global
var self = this;
@@ -473,7 +481,7 @@ function JSONPPolling (opts) {
});
// append to query string
- this.query.j = callbacks.length - 1;
+ this.query.j = this.index;
};
/**
@@ -532,7 +540,7 @@ JSONPPolling.prototype.doPoll = function () {
script.async = true;
script.src = this.uri();
- var insertAt = document.getElementsByTagName('script')[0]
+ var insertAt = document.getElementsByTagName('script')[0];
insertAt.parentNode.insertBefore(script, insertAt);
this.script = script;
@@ -554,7 +562,7 @@ JSONPPolling.prototype.doPoll = function () {
*/
JSONPPolling.prototype.doWrite = function (data, fn) {
- var self = this
+ var self = this;
if (!this.form) {
var form = document.createElement('form')
@@ -613,7 +621,7 @@ JSONPPolling.prototype.doWrite = function (data, fn) {
} catch(e) {}
if (this.iframe.attachEvent) {
- iframe.onreadystatechange = function () {
+ this.iframe.onreadystatechange = function(){
if (self.iframe.readyState == 'complete') {
complete();
}
@@ -2692,10 +2700,6 @@ Transport.prototype.onClose = function () {
if (!Array.isArray(msg.args)) {
return done(false);
}
- } else if (msg.type === 'cookie') {
- if (typeof msg.key !== 'string') {
- return done(false);
- }
} else if (msg.type === 'services') {
if (!Array.isArray(msg.args)) {
return done(false);
@@ -2711,9 +2715,8 @@ Transport.prototype.onClose = function () {
message: function(socket, msg) {
var k, _i, _len, _ref, _ref1;
if (msg.type === 'response') {
- return (_ref = this.callbacks)[msg.id].apply(_ref, msg.args);
- } else if (msg.type === 'cookie') {
- return this.cookie(msg.key, msg.val);
+ (_ref = this.callbacks)[msg.id].apply(_ref, msg.args);
+ return delete this.callbacks[msg.id];
} else if (msg.type === 'services') {
this.services = msg.args;
_ref1 = this.services;
@@ -2736,72 +2739,9 @@ Transport.prototype.onClose = function () {
type: 'request',
id: id,
service: service,
- args: args,
- cookies: _this.cookie()
+ args: args
});
};
- },
- cookie: function(key, val, expires) {
- var all, remove, set, _ref,
- _this = this;
- if (isBrowser) {
- all = function() {
- var cookie, pair, _i, _len, _ref;
- out = {};
- _ref = document.cookie.split(";");
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- cookie = _ref[_i];
- pair = cookie.split("=");
- if (!(pair[0] && pair[1])) {
- continue;
- }
- out[pair[0].trim()] = pair[1].trim();
- }
- return out;
- };
- set = function(key, val, expires) {
- var sExpires;
- sExpires = "";
- if (typeof expires === 'number') {
- sExpires = "; max-age=" + expires;
- }
- if (typeof expires === 'string') {
- sExpires = "; expires=" + expires;
- }
- if (typeof expires === 'object' ? expires.toGMTString : void 0) {
- sExpires = "; expires=" + (expires.toGMTString());
- }
- document.cookie = "" + (escape(key)) + "=" + (escape(val)) + sExpires;
- };
- remove = function(key) {
- document.cookie = "" + (escape(key)) + "=; expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/";
- };
- } else {
- if ((_ref = this.cookies) == null) {
- this.cookies = {};
- }
- all = function() {
- return _this.cookies;
- };
- set = function(key, val, expires) {
- _this.cookies[key] = val;
- };
- remove = function(key) {
- delete _this.cookies[key];
- };
- }
- if (!key) {
- return all();
- }
- if (key && val === null) {
- return remove(key);
- }
- if (key && !val) {
- return all()[key];
- }
- if (key && val) {
- return set(key, val, expires);
- }
}
};
for (k in opt) {
2  vein.min.js
View
@@ -1 +1 @@
-(function(){function t(){return t}function n(t,r){var i=n.resolve(t),s=n.modules[i];if(!s)throw Error('failed to require "'+t+'" from '+r);return s.exports||(s.exports={},s.call(s.exports,s,s.exports,n.relative(i),e)),s.exports}var e=this;n.modules={},n.resolve=function(e){var t=e,r=e+".js",i=e+"/index.js";return n.modules[r]&&r||n.modules[i]&&i||t},n.register=function(e,t){n.modules[e]=t},n.relative=function(e){return function(r){if("debug"==r)return t;if("."!=r.charAt(0))return n(r);var i=e.split("/"),s=r.split("/");i.pop();for(var o=0;o<s.length;o++){var u=s[o];".."==u?i.pop():"."!=u&&i.push(u)}return n(i.join("/"),e)}},n.register("node_modules/engine.io-client/lib/engine.io-client.js",function(e,t,n,r){t.version="0.2.1",t.protocol=1,t.util=n("./util"),t.parser=n("./parser"),t.Socket=n("./socket"),t.EventEmitter=n("./event-emitter"),t.Transport=n("./transport"),t.transports=n("./transports")}),n.register("node_modules/engine.io-client/lib/event-emitter.js",function(e,t,n,r){function i(){}function s(e){return"[object Array]"==Object.prototype.toString.call(e)}e.exports=i,i.prototype.on=function(e,t){return this.$events||(this.$events={}),this.$events[e]?s(this.$events[e])?this.$events[e].push(t):this.$events[e]=[this.$events[e],t]:this.$events[e]=t,this},i.prototype.addListener=i.prototype.on,i.prototype.once=function(e,t){function r(){n.removeListener(e,r),t.apply(this,arguments)}var n=this;return r.listener=t,this.on(e,r),this},i.prototype.removeListener=function(e,t){if(this.$events&&this.$events[e]){var n=this.$events[e];if(s(n)){var r=-1;for(var i=0,o=n.length;i<o;i++)if(n[i]===t||n[i].listener&&n[i].listener===t){r=i;break}if(r<0)return this;n.splice(r,1),n.length||delete this.$events[e]}else(n===t||n.listener&&n.listener===t)&&delete this.$events[e]}return this},i.prototype.removeAllListeners=function(e){return e===undefined?(this.$events={},this):(this.$events&&this.$events[e]&&(this.$events[e]=null),this)},i.prototype.listeners=function(e){return this.$events||(this.$events={}),this.$events[e]||(this.$events[e]=[]),s(this.$events[e])||(this.$events[e]=[this.$events[e]]),this.$events[e]},i.prototype.emit=function(e){if(!this.$events)return!1;var t=this.$events[e];if(!t)return!1;var n=Array.prototype.slice.call(arguments,1);if("function"==typeof t)t.apply(this,n);else{if(!s(t))return!1;var r=t.slice();for(var i=0,o=r.length;i<o;i++)r[i].apply(this,n)}return!0},i.prototype.addEventListener=i.prototype.on,i.prototype.removeEventListener=i.prototype.removeListener,i.prototype.dispatchEvent=i.prototype.emit}),n.register("node_modules/engine.io-client/lib/parser.js",function(e,t,n,r){var i=n("./util"),s=t.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6},o=i.keys(s),u={type:"error",data:"parser error"};t.encodePacket=function(e){var t=s[e.type];return undefined!==e.data&&(t+=e.data+""),""+t},t.decodePacket=function(e){var t=e.charAt(0);return Number(t)!=t||!o[t]?u:e.length>1?{type:o[t],data:e.substring(1)}:{type:o[t]}},t.encodePayload=function(e){if(!e.length)return"0:";var n="",r;for(var i=0,s=e.length;i<s;i++)r=t.encodePacket(e[i]),n+=r.length+":"+r;return n},t.decodePayload=function(e){if(e=="")return[u];var n=[],r="",i,s,o;for(var a=0,f=e.length;a<f;a++){var l=e.charAt(a);if(":"!=l)r+=l;else{if(""==r||r!=(i=Number(r)))return[u];s=e.substr(a+1,i);if(r!=s.length)return[u];if(s.length){o=t.decodePacket(s);if(u.type==o.type&&u.data==o.data)return[u];n.push(o)}a+=i,r=""}}return r!=""?[u]:n}}),n.register("node_modules/engine.io-client/lib/transports/polling-jsonp.js",function(e,t,n,r){function f(){}function l(e){i.call(this,e),this.index=a++;var t=this;u.push(function(e){t.onData(e)}),this.query.j=u.length-1}var i=n("./polling"),s=n("../util");e.exports=l;var o=/\n/g,u=r.___eio=[],a=0;s.inherits(l,i),l.prototype.doOpen=function(){var e=this;s.defer(function(){i.prototype.doOpen.call(e)})},l.prototype.doClose=function(){this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),this.form&&(this.form.parentNode.removeChild(this.form),this.form=null),i.prototype.doClose.call(this)},l.prototype.doPoll=function(){var e=document.createElement("script");this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),e.async=!0,e.src=this.uri();var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t),this.script=e,s.ua.gecko&&setTimeout(function(){var e=document.createElement("iframe");document.body.appendChild(e),document.body.removeChild(e)},100)},l.prototype.doWrite=function(e,t){function a(){f(),t()}function f(){n.iframe&&n.form.removeChild(n.iframe);try{u=document.createElement('<iframe name="'+n.iframeId+'">')}catch(e){u=document.createElement("iframe"),u.name=n.iframeId}u.id=n.iframeId,n.form.appendChild(u),n.iframe=u}var n=this;if(!this.form){var r=document.createElement("form"),i=document.createElement("textarea"),s=this.iframeId="eio_iframe_"+this.index,u;r.className="socketio",r.style.position="absolute",r.style.top="-1000px",r.style.left="-1000px",r.target=s,r.method="POST",r.setAttribute("accept-charset","utf-8"),i.name="d",r.appendChild(i),document.body.appendChild(r),this.form=r,this.area=i}this.form.action=this.uri(),f(),this.area.value=e.replace(o,"\\n");try{this.form.submit()}catch(l){}this.iframe.attachEvent?u.onreadystatechange=function(){n.iframe.readyState=="complete"&&a()}:this.iframe.onload=a}}),n.register("node_modules/engine.io-client/lib/transports/polling.js",function(e,t,n,r){function u(e){i.call(this,e)}var i=n("../transport"),s=n("../util"),o=n("../parser");e.exports=u,s.inherits(u,i),u.prototype.name="polling",u.prototype.doOpen=function(){this.poll()},u.prototype.pause=function(e){function r(){n.readyState="paused",e()}var t=0,n=this;this.readyState="pausing";if(this.polling||!this.writable){var i=0;this.polling&&(i++,this.once("pollComplete",function(){--i||r()})),this.writable||(i++,this.once("drain",function(){--i||r()}))}else r()},u.prototype.poll=function(){this.polling=!0,this.doPoll(),this.emit("poll")},u.prototype.onData=function(e){var t=o.decodePayload(e);for(var n=0,r=t.length;n<r;n++){"opening"==this.readyState&&this.onOpen();if("close"==t[n].type){this.onClose();return}this.onPacket(t[n])}this.polling=!1,this.emit("pollComplete"),"open"==this.readyState&&this.poll()},u.prototype.doClose=function(){this.send([{type:"close"}])},u.prototype.write=function(e){var t=this;this.writable=!1,this.doWrite(o.encodePayload(e),function(){t.writable=!0,t.emit("drain")})},u.prototype.uri=function(){var e=this.query||{},t=this.secure?"https":"http",n="";if(r.ActiveXObject||s.ua.android||this.timestampRequests)e[this.timestampParam]=+(new Date);return e=s.qs(e),this.port&&("https"==t&&this.port!=443||"http"==t&&this.port!=80)&&(n=":"+this.port),e.length&&(e="?"+e),t+"://"+this.host+n+this.path+e}}),n.register("node_modules/engine.io-client/lib/transports/index.js",function(e,t,n,r){function f(e){var t=!1;return r.location&&(t=e.host!=r.location.hostname||r.location.port!=e.port),a.request(t)&&!e.forceJSONP?new i(e):new s(e)}var i=n("./polling-xhr"),s=n("./polling-jsonp"),o=n("./websocket"),u=n("./flashsocket"),a=n("../util");t.polling=f,t.websocket=o,t.flashsocket=u}),n.register("node_modules/engine.io-client/lib/transports/flashsocket.js",function(e,t,n,r){function o(e){i.call(this,e),this.flashPath=e.flashPath,this.policyPort=e.policyPort}function a(e,t){if(u[e])return t();var n=document.createElement("script"),r=!1;n.onload=n.onreadystatechange=function(){if(r||u[e])return;var i=n.readyState;if(!i||"loaded"==i||"complete"==i)n.onload=n.onreadystatechange=null,r=!0,u[e]=!0,t()},n.async=1,n.src=e;var i=document.getElementsByTagName("head")[0];i.insertBefore(n,i.firstChild)}function f(e,t){function n(r){if(!e[r])return t();a(e[r],function(){n(++r)})}n(0)}var i=n("./websocket"),s=n("../util");e.exports=o,s.inherits(o,i),o.prototype.name="flashsocket",o.prototype.doOpen=function(){function e(e){return function(){var e=Array.prototype.join.call(arguments," ")}}if(!this.check())return;WEB_SOCKET_LOGGER={log:e("debug"),error:e("error")},WEB_SOCKET_SUPPRESS_CROSS_DOMAIN_SWF_ERROR=!0,WEB_SOCKET_DISABLE_AUTO_INITIALIZATION=!0,"undefined"==typeof WEB_SOCKET_SWF_LOCATION&&(WEB_SOCKET_SWF_LOCATION=this.flashPath+"WebSocketMainInsecure.swf");var t=[this.flashPath+"web_socket.js"];"undefined"==typeof swfobject&&t.unshift(this.flashPath+"swfobject.js");var n=this;f(t,function(){n.ready(function(){WebSocket.__addTask(function(){i.prototype.doOpen.call(n)})})})},o.prototype.doClose=function(){if(!this.socket)return;var e=this;WebSocket.__addTask(function(){i.prototype.doClose.call(e)})},o.prototype.write=function(){var e=this,t=arguments;WebSocket.__addTask(function(){i.prototype.write.apply(e,t)})},o.prototype.ready=function(e){function t(){o.loaded||(843!=n.policyPort&&WebSocket.loadFlashPolicyFile("xmlsocket://"+n.host+":"+n.policyPort),WebSocket.__initialize(),o.loaded=!0),e.call(n)}if(!(typeof WebSocket!="undefined"&&"__initialize"in WebSocket)||!swfobject)return;if(swfobject.getFlashPlayerVersion().major<10)return;var n=this;if(document.body)return t();s.load(t)},o.prototype.check=function(){if(typeof WebSocket=="undefined"||"__initialize"in WebSocket){if(window.ActiveXObject){var e=null;try{e=new ActiveXObject("ShockwaveFlash.ShockwaveFlash")}catch(t){}if(e)return!0}else for(var n=0,r=navigator.plugins.length;n<r;n++)for(var i=0,s=navigator.plugins[n].length;i<s;i++)if(navigator.plugins[n][i].description=="Shockwave Flash")return!0;return!1}return!1};var u={}}),n.register("node_modules/engine.io-client/lib/transports/polling-xhr.js",function(e,t,n,r){function u(){}function a(e){i.call(this,e),r.location&&(this.xd=e.host!=r.location.hostname||r.location.port!=e.port)}function f(e){this.method=e.method||"GET",this.uri=e.uri,this.xd=!!e.xd,this.async=!1!==e.async,this.data=undefined!=e.data?e.data:null,this.create()}var i=n("./polling"),s=n("../event-emitter"),o=n("../util");e.exports=a,e.exports.Request=f,o.inherits(a,i),a.prototype.doOpen=function(){var e=this;o.defer(function(){i.prototype.doOpen.call(e)})},a.prototype.request=function(e){return e=e||{},e.uri=this.uri(),e.xd=this.xd,new f(e)},a.prototype.doWrite=function(e,t){var n=this.request({method:"POST",data:e}),r=this;n.on("success",t),n.on("error",function(e){r.onError("xhr post error",e)}),this.sendXhr=n},a.prototype.doPoll=function(){var e=this.request(),t=this;e.on("data",function(e){t.onData(e)}),e.on("error",function(e){t.onError("xhr poll error",e)}),this.pollXhr=e},o.inherits(f,s),f.prototype.create=function(){var e=this.xhr=o.request(this.xd),t=this;e.open(this.method,this.uri,this.async);if("POST"==this.method)try{e.setRequestHeader?e.setRequestHeader("Content-type","text/plain;charset=UTF-8"):e.contentType="text/plain"}catch(n){}this.xd&&r.XDomainRequest&&e instanceof XDomainRequest?(e.onerror=function(e){t.onError(e)},e.onload=function(){t.onData(e.responseText)},e.onprogress=u):("withCredentials"in e&&(e.withCredentials=!0),e.onreadystatechange=function(){var n;try{if(4!=e.readyState)return;200==e.status||1223==e.status?n=e.responseText:t.onError(e.status)}catch(r){t.onError(r)}undefined!==n&&t.onData(n)}),e.send(this.data),r.ActiveXObject&&(this.index=f.requestsCount++,f.requests[this.index]=this)},f.prototype.onSuccess=function(){this.emit("success"),this.cleanup()},f.prototype.onData=function(e){this.emit("data",e),this.onSuccess()},f.prototype.onError=function(e){this.emit("error",e),this.cleanup()},f.prototype.cleanup=function(){this.xhr.onreadystatechange=u,this.xhr.onload=this.xhr.onerror=u;try{this.xhr.abort()}catch(e){}r.ActiveXObject&&delete f.requests[this.index],this.xhr=null},f.prototype.abort=function(){this.cleanup()},r.ActiveXObject&&(f.requestsCount=0,f.requests={},r.attachEvent("onunload",function(){for(var e in f.requests)f.requests.hasOwnProperty(e)&&f.requests[e].abort()}))}),n.register("node_modules/engine.io-client/lib/transports/websocket.js",function(e,t,n,r){function u(e){i.call(this,e)}function a(){return r.WebSocket||r.MozWebSocket}var i=n("../transport"),s=n("../parser"),o=n("../util");e.exports=u,o.inherits(u,i),u.prototype.name="websocket",u.prototype.doOpen=function(){if(!this.check())return;var e=this;this.socket=new(a())(this.uri()),this.socket.onopen=function(){e.onOpen()},this.socket.onclose=function(){e.onClose()},this.socket.onmessage=function(t){e.onData(t.data)},this.socket.onerror=function(t){e.onError("websocket error",t)}},u.prototype.write=function(e){for(var t=0,n=e.length;t<n;t++)this.socket.send(s.encodePacket(e[t]))},u.prototype.doClose=function(){typeof this.socket!="undefined"&&this.socket.close()},u.prototype.uri=function(){var e=this.query||{},t=this.secure?"wss":"ws",n="";return this.port&&("wss"==t&&this.port!=443||"ws"==t&&this.port!=80)&&(n=":"+this.port),this.timestampRequests&&(e[this.timestampParam]=+(new Date)),e=o.qs(e),e.length&&(e="?"+e),t+"://"+this.host+n+this.path+e},u.prototype.check=function(){var e=a();return!!e&&!("__initialize"in e&&this.name===u.prototype.name)}}),n.register("node_modules/engine.io-client/lib/socket.js",function(e,t,n,r){function a(e){if("string"==typeof e){var t=i.parseUri(e);e=arguments[1]||{},e.host=t.host,e.secure=t.scheme=="https"||t.scheme=="wss",e.port=t.port||(e.secure?443:80)}e=e||{},this.secure=e.secure||!1,this.host=e.host||e.hostname||"localhost",this.port=e.port||80,this.query=e.query||{},this.query.uid=l(),this.upgrade=!1!==e.upgrade,this.resource=e.resource||"default",this.path=(e.path||"/engine.io").replace(/\/$/,""),this.path+="/"+this.resource+"/",this.forceJSONP=!!e.forceJSONP,this.timestampParam=e.timestampParam||"t",this.timestampRequests=!!e.timestampRequests,this.flashPath=e.flashPath||"",this.transports=e.transports||["polling","websocket","flashsocket"],this.readyState="",this.writeBuffer=[],this.policyPort=e.policyPort||843,this.open()}function f(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}function l(){return(Math.random()+"").substr(5)+(Math.random()+"").substr(5)}var i=n("./util"),s=n("./transports"),o=n("debug")("engine-client:socket"),u=n("./event-emitter");e.exports=a,i.inherits(a,u),a.prototype.createTransport=function(e){o('creating transport "%s"',e);var t=f(this.query);t.transport=e,this.id&&(t.sid=this.id);var n=new s[e]({host:this.host,port:this.port,secure:this.secure,path:this.path,query:t,forceJSONP:this.forceJSONP,timestampRequests:this.timestampRequests,timestampParam:this.timestampParam,flashPath:this.flashPath,policyPort:this.policyPort});return n},a.prototype.open=function(){this.readyState="opening";var e=this.createTransport(this.transports[0]);e.open(),this.setTransport(e)},a.prototype.setTransport=function(e){var t=this;this.transport&&(o("clearing existing transport"),this.transport.removeAllListeners()),this.transport=e,e.on("drain",function(){t.flush()}).on("packet",function(e){t.onPacket(e)}).on("error",function(e){t.onError(e)}).on("close",function(){t.onClose("transport close")})},a.prototype.probe=function(e){o('probing transport "%s"',e);var t=this.createTransport(e,{probe:1}),n=this;t.once("open",function(){o('probe transport "%s" opened',e),t.send([{type:"ping",data:"probe"}]),t.once("packet",function(r){if("pong"==r.type&&"probe"==r.data)o('probe transport "%s" pong',e),n.upgrading=!0,n.emit("upgrading",t),o('pausing current transport "%s"',n.transport.name),n.transport.pause(function(){if("closed"==n.readyState||"closing"==n.readyState)return;o("changing transport and sending upgrade packet"),n.emit("upgrade",t),n.setTransport(t),t.send([{type:"upgrade"}]),t=null,n.upgrading=!1,n.flush()});else{o('probe transport "%s" failed',e);var i=Error("probe error");i.transport=t.name,n.emit("error",i)}})}),t.open(),this.once("close",function(){t&&(o("socket closed prematurely - aborting probe"),t.close(),t=null)}),this.once("upgrading",function(e){t&&e.name!=t.name&&(o('"%s" works - aborting "%s"',e.name,t.name),t.close(),t=null)})},a.prototype.onOpen=function(){o("socket open"),this.readyState="open",this.emit("open"),this.onopen&&this.onopen.call(this),this.flush();if(this.upgrade&&this.transport.pause){o("starting upgrade probes");for(var e=0,t=this.upgrades.length;e<t;e++)this.probe(this.upgrades[e])}},a.prototype.onPacket=function(e){if("opening"==this.readyState||"open"==this.readyState){o('socket receive: type "%s", data "%s"',e.type,e.data);switch(e.type){case"open":this.onHandshake(i.parseJSON(e.data));break;case"ping":this.sendPacket("pong"),this.setPingTimeout();break;case"error":var t=Error("server error");t.code=e.data,this.emit("error",t);break;case"message":this.emit("message",e.data);var n={data:e.data};n.toString=function(){return e.data},this.onmessage&&this.onmessage.call(this,n)}}else o('packet received with socket readyState "%s"',this.readyState)},a.prototype.onHandshake=function(e){this.emit("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this.upgrades=e.upgrades,this.pingTimeout=e.pingTimeout,this.onOpen(),this.setPingTimeout()},a.prototype.setPingTimeout=function(){clearTimeout(this.pingTimeoutTimer);var e=this;this.pingTimeoutTimer=setTimeout(function(){e.onClose("ping timeout")},this.pingTimeout)},a.prototype.flush=function(){"closed"!=this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length&&(o("flushing %d packets in socket",this.writeBuffer.length),this.transport.send(this.writeBuffer),this.writeBuffer=[])},a.prototype.send=function(e){return this.sendPacket("message",e),this},a.prototype.sendPacket=function(e,t){var n={type:e,data:t};this.writeBuffer.push(n),this.flush()},a.prototype.close=function(){if("opening"==this.readyState||"open"==this.readyState)this.onClose("forced close"),o("socket closing - telling transport to close"),this.transport.close();return this},a.prototype.onError=function(e){this.emit("error",e),this.onClose("transport error",e)},a.prototype.onClose=function(e,t){"closed"!=this.readyState&&(o('socket close with reason: "%s"',e),this.readyState="closed",this.emit("close",e,t),this.onclose&&this.onclose.call(this))}}),n.register("node_modules/engine.io-client/lib/util.js",function(e,t,n,r){var i=!1;t.inherits=function(t,n){function r(){}r.prototype=n.prototype,t.prototype=new r},t.keys=Object.keys||function(e){var t=[],n=Object.prototype.hasOwnProperty;for(var r in e)n.call(e,r)&&t.push(r);return t},t.on=function(e,t,n,r){e.attachEvent?e.attachEvent("on"+t,n):e.addEventListener&&e.addEventListener(t,n,r)},t.load=function(e){if(r.document&&document.readyState==="complete"||i)return e();t.on(r,"load",e,!1)},"undefined"!=typeof window&&t.load(function(){i=!0}),t.defer=function(e){if(!t.ua.webkit||"undefined"!=typeof importScripts)return e();t.load(function(){setTimeout(e,100)})};var s=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,u=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,a=/(?:^|:|,)(?:\s*\[)+/g,f=/^\s+/,l=/\s+$/;t.parseJSON=function(e){if("string"!=typeof e||!e)return null;e=e.replace(f,"").replace(l,"");if(r.JSON&&JSON.parse)return JSON.parse(e);if(s.test(e.replace(o,"@").replace(u,"]").replace(a,"")))return Function("return "+e)()},t.ua={},t.ua.hasCORS="undefined"!=typeof XMLHttpRequest&&function(){try{var e=new XMLHttpRequest}catch(t){return!1}return e.withCredentials!=undefined}(),t.ua.webkit="undefined"!=typeof navigator&&/webkit/i.test(navigator.userAgent),t.ua.gecko="undefined"!=typeof navigator&&/gecko/i.test(navigator.userAgent),t.ua.android="undefined"!=typeof navigator&&/android/i.test(navigator.userAgent),t.request=function(n){if(n&&"undefined"!=typeof XDomainRequest)return new XDomainRequest;try{if("undefined"!=typeof XMLHttpRequest&&(!n||t.ua.hasCORS))return new XMLHttpRequest}catch(r){}if(!n)try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(r){}};var c=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,h=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];t.parseUri=function(e){var t=c.exec(e||""),n={},r=14;while(r--)n[h[r]]=t[r]||"";return n},t.qs=function(e){var t="";for(var n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=n+"="+encodeURIComponent(e[n]));return t}}),n.register("node_modules/engine.io-client/lib/transport.js",function(e,t,n,r){function u(e){this.path=e.path,this.host=e.host,this.port=e.port,this.secure=e.secure,this.query=e.query,this.timestampParam=e.timestampParam,this.timestampRequests=e.timestampRequests,this.readyState=""}var i=n("./util"),s=n("./parser"),o=n("./event-emitter");e.exports=u,i.inherits(u,o),u.prototype.onError=function(e,t){var n=Error(e);return n.type="TransportError",n.description=t,this.emit("error",n),this},u.prototype.open=function(){if("closed"==this.readyState||""==this.readyState)this.readyState="opening",this.doOpen();return this},u.prototype.close=function(){if("opening"==this.readyState||"open"==this.readyState)this.doClose(),this.onClose();return this},u.prototype.send=function(e){if("open"!=this.readyState)throw Error("Transport not open");this.write(e)},u.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},u.prototype.onData=function(e){this.onPacket(s.decodePacket(e))},u.prototype.onPacket=function(e){this.emit("packet",e)},u.prototype.onClose=function(){this.readyState="closed",this.emit("close")}}),n.register("Socket.js",function(e,t,n,r){(function(){var t=[].slice;e.exports={write:function(e){var t=this;return this.parent.outbound(this,e,function(e){return t.send(e)}),this},disconnect:function(){var e;return e=1>arguments.length?[]:t.call(arguments,0),this.close.apply(this,e),this}}}).call(this)}),n.register("Client.js",function(e,t,n,r){(function(){var t,r,i,s,o,u=function(e,t){return function(){return e.apply(t,arguments)}},a={}.hasOwnProperty,f=function(e,t){function r(){this.constructor=e}for(var n in t)a.call(t,n)&&(e[n]=t[n]);return r.prototype=t.prototype,e.prototype=new r,e.__super__=t.prototype,e};o=n("./util"),s=o.isBrowser(),s?(i=n("node_modules/engine.io-client/lib/engine.io-client"),r=i.EventEmitter):(i=n("engine.io-client"),r=n("events").EventEmitter),o.extendSocket(i.Socket),t=function(e){function t(e){this.handleClose=u(this.handleClose,this),this.handleError=u(this.handleError,this),this.handleMessage=u(this.handleMessage,this),this.handleConnection=u(this.handleConnection,this);var t,n,r;for(n in e)r=e[n],this[n]=r;this.isServer=!1,this.isClient=!0,this.isBrowser=s,t={host:this.options.host,port:this.options.port,secure:this.options.secure,path:"/"+this.options.namespace,resource:this.options.resource,transports:this.options.transports,upgrade:this.options.upgrade,flashPath:this.options.flashPath,policyPort:this.options.policyPort,forceJSONP:this.options.forceJSONP,forceBust:this.options.forceBust,debug:this.options.debug},this.ssocket=new i.Socket(t),this.ssocket.parent=this,this.ssocket.on("open",this.handleConnection),this.ssocket.on("error",this.handleError),this.ssocket.on("message",this.handleMessage),this.ssocket.on("close",this.handleClose),this.start();return}return f(t,e),t.prototype.disconnect=function(){return this.ssocket.close(),this},t.prototype.handleConnection=function(){return this.connected=!0,this.connect(this.ssocket)},t.prototype.handleMessage=function(e){var t=this;return this.emit("inbound",this.ssocket,e),this.inbound(this.ssocket,e,function(e){return t.validate(t.ssocket,e,function(n){return n?(t.emit("message",t.ssocket,e),t.message(t.ssocket,e)):(t.emit("invalid",t.ssocket,e),t.invalid(t.ssocket,e))})})},t.prototype.handleError=function(e){return typeof e=="string"&&(e=Error(e)),this.error(this.ssocket,e)},t.prototype.handleClose=function(e){return this.emit("close",this.ssocket,e),this.close(this.ssocket,e)},t}(r),e.exports=t}).call(this)}),n.register("main.js",function(e,t,n,r){(function(){var e,t;t=n("./util"),e={createClient:function(e){var r,i,s,o;r=n("./Client"),i=n("./defaultClient"),o=t.mergePlugins(i,e),s=t.validatePlugin(o);if(s!=null)throw Error("Plugin validation failed: "+s);return new r(o)}},window.ProtoSock=e}).call(this)}),n.register("util.js",function(e,t,n,r){(function(){var t,r={}.hasOwnProperty,i=function(e,t){function i(){this.constructor=e}for(var n in t)r.call(t,n)&&(e[n]=t[n]);return i.prototype=t.prototype,e.prototype=new i,e.__super__=t.prototype,e},s=[].slice;e.exports=t={extendSocket:function(e){var t;return t=n("./Socket"),i(e.prototype,t)},mergePlugins:function(){var e,n,r,i,o,u,a;e=1>arguments.length?[]:s.call(arguments,0),r={};for(u=0,a=e.length;u<a;u++){i=e[u];for(n in i)o=i[n],typeof o=="object"&&n!=="server"?r[n]=t.mergePlugins(r[n],o):r[n]=o}return r},validatePlugin:function(e){if(typeof e.options!="object")return"missing options object";if(typeof e.options.namespace!="string")return"namespace option required";if(typeof e.options.resource!="string")return"resource option required";if(typeof e.inbound!="function")return"missing inbound formatter";if(typeof e.outbound!="function")return"missing outbound formatter";if(typeof e.validate!="function")return"missing validate"},isBrowser:function(){return!0}}}).call(this)}),n.register("defaultClient.js",function(e,t,n,r){(function(){var t;t={options:{},start:function(){},inbound:function(e,t,n){try{return n(JSON.parse(t))}catch(r){return this.error(r)}},outbound:function(e,t,n){try{return n(JSON.stringify(t))}catch(r){return this.error(r)}},validate:function(e,t,n){return n(!0)},invalid:function(){},connect:function(){},message:function(){},error:function(){},close:function(){}},t.options={host:window.location.hostname,port:window.location.port.length>0?parseInt(window.location.port):80,secure:window.location.protocol==="https:"},e.exports=t}).call(this)}),main=n("main")})(),function(){var e,t,n,r=this,i=[].slice;n=typeof window!="undefined",t=function(){var e;return e=function(){return((1+Math.random())*268435456|0).toString(16)},e()+e()+e()},e=function(e){var r,s,o;s={options:{namespace:"Vein",resource:"default"},start:function(){return this.services={},this.callbacks={}},ready:function(e){return this.synced?e(this.services):this.once("ready",e)},validate:function(e,t,n){if(typeof t!="object")return n(!1);if(typeof t.type!="string")return n(!1);if(t.type==="response"){if(typeof t.id!="string")return n(!1);if(typeof this.callbacks[t.id]!="function")return n(!1);if(typeof t.service!="string")return n(!1);if(!Array.isArray(t.args))return n(!1)}else if(t.type==="cookie"){if(typeof t.key!="string")return n(!1)}else{if(t.type!=="services")return n(!1);if(!Array.isArray(t.args))return n(!1)}return n(!0)},error:function(e,t){throw t},message:function(e,t){var n,r,i,s,o;if(t.type==="response")return(s=this.callbacks)[t.id].apply(s,t.args);if(t.type==="cookie")return this.cookie(t.key,t.val);if(t.type==="services"){this.services=t.args,o=this.services;for(r=0,i=o.length;r<i;r++)n=o[r],this[n]=this.getSender(e,n);return this.synced=!0,this.emit("ready",this.services)}},getSender:function(e,n){var r=this;return function(){var s,o,u,a;return s=2>arguments.length?(a=0,[]):i.call(arguments,0,a=arguments.length-1),o=arguments[a++],u=t(),r.callbacks[u]=o,e.write({type:"request",id:u,service:n,args:s,cookies:r.cookie()})}},cookie:function(e,t,r){var i,o,u,a,f=this;n?(i=function(){var e,t,n,r,i;s={},i=document.cookie.split(";");for(n=0,r=i.length;n<r;n++){e=i[n],t=e.split("=");if(!t[0]||!t[1])continue;s[t[0].trim()]=t[1].trim()}return s},u=function(e,t,n){var r;r="",typeof n=="number"&&(r="; max-age="+n),typeof n=="string"&&(r="; expires="+n);if(typeof n=="object"?n.toGMTString:void 0)r="; expires="+n.toGMTString();document.cookie=""+escape(e)+"="+escape(t)+r},o=function(e){document.cookie=""+escape(e)+"=; expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/"}):((a=this.cookies)==null&&(this.cookies={}),i=function(){return f.cookies},u=function(e,t,n){f.cookies[e]=t},o=function(e){delete f.cookies[e]});if(!e)return i();if(e&&t===null)return o(e);if(e&&!t)return i()[e];if(e&&t)return u(e,t,r)}};for(r in e)o=e[r],s.options[r]=o;return s},n?(window.Vein={createClient:function(t){return t==null&&(t={}),ProtoSock.createClient(e(t))}},typeof define=="function"&&define(function(){return Vein})):module.exports=e}.call(this);
+(function(){function t(){return t}function n(t,r){var i=n.resolve(t),s=n.modules[i];if(!s)throw Error('failed to require "'+t+'" from '+r);return s.exports||(s.exports={},s.call(s.exports,s,s.exports,n.relative(i),e)),s.exports}var e=this;n.modules={},n.resolve=function(e){var t=e,r=e+".js",i=e+"/index.js";return n.modules[r]&&r||n.modules[i]&&i||t},n.register=function(e,t){n.modules[e]=t},n.relative=function(e){return function(r){if("debug"==r)return t;if("."!=r.charAt(0))return n(r);var i=e.split("/"),s=r.split("/");i.pop();for(var o=0;o<s.length;o++){var u=s[o];".."==u?i.pop():"."!=u&&i.push(u)}return n(i.join("/"),e)}},n.register("node_modules/engine.io-client/lib/engine.io-client.js",function(e,t,n,r){t.version="0.2.2",t.protocol=1,t.util=n("./util"),t.parser=n("./parser"),t.Socket=n("./socket"),t.EventEmitter=n("./event-emitter"),t.Transport=n("./transport"),t.transports=n("./transports")}),n.register("node_modules/engine.io-client/lib/event-emitter.js",function(e,t,n,r){function i(){}function s(e){return"[object Array]"==Object.prototype.toString.call(e)}e.exports=i,i.prototype.on=function(e,t){return this.$events||(this.$events={}),this.$events[e]?s(this.$events[e])?this.$events[e].push(t):this.$events[e]=[this.$events[e],t]:this.$events[e]=t,this},i.prototype.addListener=i.prototype.on,i.prototype.once=function(e,t){function r(){n.removeListener(e,r),t.apply(this,arguments)}var n=this;return r.listener=t,this.on(e,r),this},i.prototype.removeListener=function(e,t){if(this.$events&&this.$events[e]){var n=this.$events[e];if(s(n)){var r=-1;for(var i=0,o=n.length;i<o;i++)if(n[i]===t||n[i].listener&&n[i].listener===t){r=i;break}if(r<0)return this;n.splice(r,1),n.length||delete this.$events[e]}else(n===t||n.listener&&n.listener===t)&&delete this.$events[e]}return this},i.prototype.removeAllListeners=function(e){return e===undefined?(this.$events={},this):(this.$events&&this.$events[e]&&(this.$events[e]=null),this)},i.prototype.listeners=function(e){return this.$events||(this.$events={}),this.$events[e]||(this.$events[e]=[]),s(this.$events[e])||(this.$events[e]=[this.$events[e]]),this.$events[e]},i.prototype.emit=function(e){if(!this.$events)return!1;var t=this.$events[e];if(!t)return!1;var n=Array.prototype.slice.call(arguments,1);if("function"==typeof t)t.apply(this,n);else{if(!s(t))return!1;var r=t.slice();for(var i=0,o=r.length;i<o;i++)r[i].apply(this,n)}return!0},i.prototype.addEventListener=i.prototype.on,i.prototype.removeEventListener=i.prototype.removeListener,i.prototype.dispatchEvent=i.prototype.emit}),n.register("node_modules/engine.io-client/lib/parser.js",function(e,t,n,r){var i=n("./util"),s=t.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6},o=i.keys(s),u={type:"error",data:"parser error"};t.encodePacket=function(e){var t=s[e.type];return undefined!==e.data&&(t+=e.data+""),""+t},t.decodePacket=function(e){var t=e.charAt(0);return Number(t)!=t||!o[t]?u:e.length>1?{type:o[t],data:e.substring(1)}:{type:o[t]}},t.encodePayload=function(e){if(!e.length)return"0:";var n="",r;for(var i=0,s=e.length;i<s;i++)r=t.encodePacket(e[i]),n+=r.length+":"+r;return n},t.decodePayload=function(e){if(e=="")return[u];var n=[],r="",i,s,o;for(var a=0,f=e.length;a<f;a++){var l=e.charAt(a);if(":"!=l)r+=l;else{if(""==r||r!=(i=Number(r)))return[u];s=e.substr(a+1,i);if(r!=s.length)return[u];if(s.length){o=t.decodePacket(s);if(u.type==o.type&&u.data==o.data)return[u];n.push(o)}a+=i,r=""}}return r!=""?[u]:n}}),n.register("node_modules/engine.io-client/lib/transports/polling-jsonp.js",function(e,t,n,r){function f(){}function l(e){i.call(this,e),u||(r.___eio||(r.___eio=[]),u=r.___eio),this.index=u.length;var t=this;u.push(function(e){t.onData(e)}),this.query.j=this.index}var i=n("./polling"),s=n("../util");e.exports=l;var o=/\n/g,u,a=0;s.inherits(l,i),l.prototype.doOpen=function(){var e=this;s.defer(function(){i.prototype.doOpen.call(e)})},l.prototype.doClose=function(){this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),this.form&&(this.form.parentNode.removeChild(this.form),this.form=null),i.prototype.doClose.call(this)},l.prototype.doPoll=function(){var e=document.createElement("script");this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),e.async=!0,e.src=this.uri();var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t),this.script=e,s.ua.gecko&&setTimeout(function(){var e=document.createElement("iframe");document.body.appendChild(e),document.body.removeChild(e)},100)},l.prototype.doWrite=function(e,t){function a(){f(),t()}function f(){n.iframe&&n.form.removeChild(n.iframe);try{u=document.createElement('<iframe name="'+n.iframeId+'">')}catch(e){u=document.createElement("iframe"),u.name=n.iframeId}u.id=n.iframeId,n.form.appendChild(u),n.iframe=u}var n=this;if(!this.form){var r=document.createElement("form"),i=document.createElement("textarea"),s=this.iframeId="eio_iframe_"+this.index,u;r.className="socketio",r.style.position="absolute",r.style.top="-1000px",r.style.left="-1000px",r.target=s,r.method="POST",r.setAttribute("accept-charset","utf-8"),i.name="d",r.appendChild(i),document.body.appendChild(r),this.form=r,this.area=i}this.form.action=this.uri(),f(),this.area.value=e.replace(o,"\\n");try{this.form.submit()}catch(l){}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){n.iframe.readyState=="complete"&&a()}:this.iframe.onload=a}}),n.register("node_modules/engine.io-client/lib/transports/polling.js",function(e,t,n,r){function u(e){i.call(this,e)}var i=n("../transport"),s=n("../util"),o=n("../parser");e.exports=u,s.inherits(u,i),u.prototype.name="polling",u.prototype.doOpen=function(){this.poll()},u.prototype.pause=function(e){function r(){n.readyState="paused",e()}var t=0,n=this;this.readyState="pausing";if(this.polling||!this.writable){var i=0;this.polling&&(i++,this.once("pollComplete",function(){--i||r()})),this.writable||(i++,this.once("drain",function(){--i||r()}))}else r()},u.prototype.poll=function(){this.polling=!0,this.doPoll(),this.emit("poll")},u.prototype.onData=function(e){var t=o.decodePayload(e);for(var n=0,r=t.length;n<r;n++){"opening"==this.readyState&&this.onOpen();if("close"==t[n].type){this.onClose();return}this.onPacket(t[n])}this.polling=!1,this.emit("pollComplete"),"open"==this.readyState&&this.poll()},u.prototype.doClose=function(){this.send([{type:"close"}])},u.prototype.write=function(e){var t=this;this.writable=!1,this.doWrite(o.encodePayload(e),function(){t.writable=!0,t.emit("drain")})},u.prototype.uri=function(){var e=this.query||{},t=this.secure?"https":"http",n="";if(r.ActiveXObject||s.ua.android||this.timestampRequests)e[this.timestampParam]=+(new Date);return e=s.qs(e),this.port&&("https"==t&&this.port!=443||"http"==t&&this.port!=80)&&(n=":"+this.port),e.length&&(e="?"+e),t+"://"+this.host+n+this.path+e}}),n.register("node_modules/engine.io-client/lib/transports/index.js",function(e,t,n,r){function f(e){var t=!1;return r.location&&(t=e.host!=r.location.hostname||r.location.port!=e.port),a.request(t)&&!e.forceJSONP?new i(e):new s(e)}var i=n("./polling-xhr"),s=n("./polling-jsonp"),o=n("./websocket"),u=n("./flashsocket"),a=n("../util");t.polling=f,t.websocket=o,t.flashsocket=u}),n.register("node_modules/engine.io-client/lib/transports/flashsocket.js",function(e,t,n,r){function o(e){i.call(this,e),this.flashPath=e.flashPath,this.policyPort=e.policyPort}function a(e,t){if(u[e])return t();var n=document.createElement("script"),r=!1;n.onload=n.onreadystatechange=function(){if(r||u[e])return;var i=n.readyState;if(!i||"loaded"==i||"complete"==i)n.onload=n.onreadystatechange=null,r=!0,u[e]=!0,t()},n.async=1,n.src=e;var i=document.getElementsByTagName("head")[0];i.insertBefore(n,i.firstChild)}function f(e,t){function n(r){if(!e[r])return t();a(e[r],function(){n(++r)})}n(0)}var i=n("./websocket"),s=n("../util");e.exports=o,s.inherits(o,i),o.prototype.name="flashsocket",o.prototype.doOpen=function(){function e(e){return function(){var e=Array.prototype.join.call(arguments," ")}}if(!this.check())return;WEB_SOCKET_LOGGER={log:e("debug"),error:e("error")},WEB_SOCKET_SUPPRESS_CROSS_DOMAIN_SWF_ERROR=!0,WEB_SOCKET_DISABLE_AUTO_INITIALIZATION=!0,"undefined"==typeof WEB_SOCKET_SWF_LOCATION&&(WEB_SOCKET_SWF_LOCATION=this.flashPath+"WebSocketMainInsecure.swf");var t=[this.flashPath+"web_socket.js"];"undefined"==typeof swfobject&&t.unshift(this.flashPath+"swfobject.js");var n=this;f(t,function(){n.ready(function(){WebSocket.__addTask(function(){i.prototype.doOpen.call(n)})})})},o.prototype.doClose=function(){if(!this.socket)return;var e=this;WebSocket.__addTask(function(){i.prototype.doClose.call(e)})},o.prototype.write=function(){var e=this,t=arguments;WebSocket.__addTask(function(){i.prototype.write.apply(e,t)})},o.prototype.ready=function(e){function t(){o.loaded||(843!=n.policyPort&&WebSocket.loadFlashPolicyFile("xmlsocket://"+n.host+":"+n.policyPort),WebSocket.__initialize(),o.loaded=!0),e.call(n)}if(!(typeof WebSocket!="undefined"&&"__initialize"in WebSocket)||!swfobject)return;if(swfobject.getFlashPlayerVersion().major<10)return;var n=this;if(document.body)return t();s.load(t)},o.prototype.check=function(){if(typeof WebSocket=="undefined"||"__initialize"in WebSocket){if(window.ActiveXObject){var e=null;try{e=new ActiveXObject("ShockwaveFlash.ShockwaveFlash")}catch(t){}if(e)return!0}else for(var n=0,r=navigator.plugins.length;n<r;n++)for(var i=0,s=navigator.plugins[n].length;i<s;i++)if(navigator.plugins[n][i].description=="Shockwave Flash")return!0;return!1}return!1};var u={}}),n.register("node_modules/engine.io-client/lib/transports/polling-xhr.js",function(e,t,n,r){function u(){}function a(e){i.call(this,e),r.location&&(this.xd=e.host!=r.location.hostname||r.location.port!=e.port)}function f(e){this.method=e.method||"GET",this.uri=e.uri,this.xd=!!e.xd,this.async=!1!==e.async,this.data=undefined!=e.data?e.data:null,this.create()}var i=n("./polling"),s=n("../event-emitter"),o=n("../util");e.exports=a,e.exports.Request=f,o.inherits(a,i),a.prototype.doOpen=function(){var e=this;o.defer(function(){i.prototype.doOpen.call(e)})},a.prototype.request=function(e){return e=e||{},e.uri=this.uri(),e.xd=this.xd,new f(e)},a.prototype.doWrite=function(e,t){var n=this.request({method:"POST",data:e}),r=this;n.on("success",t),n.on("error",function(e){r.onError("xhr post error",e)}),this.sendXhr=n},a.prototype.doPoll=function(){var e=this.request(),t=this;e.on("data",function(e){t.onData(e)}),e.on("error",function(e){t.onError("xhr poll error",e)}),this.pollXhr=e},o.inherits(f,s),f.prototype.create=function(){var e=this.xhr=o.request(this.xd),t=this;e.open(this.method,this.uri,this.async);if("POST"==this.method)try{e.setRequestHeader?e.setRequestHeader("Content-type","text/plain;charset=UTF-8"):e.contentType="text/plain"}catch(n){}this.xd&&r.XDomainRequest&&e instanceof XDomainRequest?(e.onerror=function(e){t.onError(e)},e.onload=function(){t.onData(e.responseText)},e.onprogress=u):("withCredentials"in e&&(e.withCredentials=!0),e.onreadystatechange=function(){var n;try{if(4!=e.readyState)return;200==e.status||1223==e.status?n=e.responseText:t.onError(e.status)}catch(r){t.onError(r)}undefined!==n&&t.onData(n)}),e.send(this.data),r.ActiveXObject&&(this.index=f.requestsCount++,f.requests[this.index]=this)},f.prototype.onSuccess=function(){this.emit("success"),this.cleanup()},f.prototype.onData=function(e){this.emit("data",e),this.onSuccess()},f.prototype.onError=function(e){this.emit("error",e),this.cleanup()},f.prototype.cleanup=function(){this.xhr.onreadystatechange=u,this.xhr.onload=this.xhr.onerror=u;try{this.xhr.abort()}catch(e){}r.ActiveXObject&&delete f.requests[this.index],this.xhr=null},f.prototype.abort=function(){this.cleanup()},r.ActiveXObject&&(f.requestsCount=0,f.requests={},r.attachEvent("onunload",function(){for(var e in f.requests)f.requests.hasOwnProperty(e)&&f.requests[e].abort()}))}),n.register("node_modules/engine.io-client/lib/transports/websocket.js",function(e,t,n,r){function u(e){i.call(this,e)}function a(){return r.WebSocket||r.MozWebSocket}var i=n("../transport"),s=n("../parser"),o=n("../util");e.exports=u,o.inherits(u,i),u.prototype.name="websocket",u.prototype.doOpen=function(){if(!this.check())return;var e=this;this.socket=new(a())(this.uri()),this.socket.onopen=function(){e.onOpen()},this.socket.onclose=function(){e.onClose()},this.socket.onmessage=function(t){e.onData(t.data)},this.socket.onerror=function(t){e.onError("websocket error",t)}},u.prototype.write=function(e){for(var t=0,n=e.length;t<n;t++)this.socket.send(s.encodePacket(e[t]))},u.prototype.doClose=function(){typeof this.socket!="undefined"&&this.socket.close()},u.prototype.uri=function(){var e=this.query||{},t=this.secure?"wss":"ws",n="";return this.port&&("wss"==t&&this.port!=443||"ws"==t&&this.port!=80)&&(n=":"+this.port),this.timestampRequests&&(e[this.timestampParam]=+(new Date)),e=o.qs(e),e.length&&(e="?"+e),t+"://"+this.host+n+this.path+e},u.prototype.check=function(){var e=a();return!!e&&!("__initialize"in e&&this.name===u.prototype.name)}}),n.register("node_modules/engine.io-client/lib/socket.js",function(e,t,n,r){function a(e){if("string"==typeof e){var t=i.parseUri(e);e=arguments[1]||{},e.host=t.host,e.secure=t.scheme=="https"||t.scheme=="wss",e.port=t.port||(e.secure?443:80)}e=e||{},this.secure=e.secure||!1,this.host=e.host||e.hostname||"localhost",this.port=e.port||80,this.query=e.query||{},this.query.uid=l(),this.upgrade=!1!==e.upgrade,this.resource=e.resource||"default",this.path=(e.path||"/engine.io").replace(/\/$/,""),this.path+="/"+this.resource+"/",this.forceJSONP=!!e.forceJSONP,this.timestampParam=e.timestampParam||"t",this.timestampRequests=!!e.timestampRequests,this.flashPath=e.flashPath||"",this.transports=e.transports||["polling","websocket","flashsocket"],this.readyState="",this.writeBuffer=[],this.policyPort=e.policyPort||843,this.open()}function f(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}function l(){return(Math.random()+"").substr(5)+(Math.random()+"").substr(5)}var i=n("./util"),s=n("./transports"),o=n("debug")("engine-client:socket"),u=n("./event-emitter");e.exports=a,i.inherits(a,u),a.prototype.createTransport=function(e){o('creating transport "%s"',e);var t=f(this.query);t.transport=e,this.id&&(t.sid=this.id);var n=new s[e]({host:this.host,port:this.port,secure:this.secure,path:this.path,query:t,forceJSONP:this.forceJSONP,timestampRequests:this.timestampRequests,timestampParam:this.timestampParam,flashPath:this.flashPath,policyPort:this.policyPort});return n},a.prototype.open=function(){this.readyState="opening";var e=this.createTransport(this.transports[0]);e.open(),this.setTransport(e)},a.prototype.setTransport=function(e){var t=this;this.transport&&(o("clearing existing transport"),this.transport.removeAllListeners()),this.transport=e,e.on("drain",function(){t.flush()}).on("packet",function(e){t.onPacket(e)}).on("error",function(e){t.onError(e)}).on("close",function(){t.onClose("transport close")})},a.prototype.probe=function(e){o('probing transport "%s"',e);var t=this.createTransport(e,{probe:1}),n=this;t.once("open",function(){o('probe transport "%s" opened',e),t.send([{type:"ping",data:"probe"}]),t.once("packet",function(r){if("pong"==r.type&&"probe"==r.data)o('probe transport "%s" pong',e),n.upgrading=!0,n.emit("upgrading",t),o('pausing current transport "%s"',n.transport.name),n.transport.pause(function(){if("closed"==n.readyState||"closing"==n.readyState)return;o("changing transport and sending upgrade packet"),n.emit("upgrade",t),n.setTransport(t),t.send([{type:"upgrade"}]),t=null,n.upgrading=!1,n.flush()});else{o('probe transport "%s" failed',e);var i=Error("probe error");i.transport=t.name,n.emit("error",i)}})}),t.open(),this.once("close",function(){t&&(o("socket closed prematurely - aborting probe"),t.close(),t=null)}),this.once("upgrading",function(e){t&&e.name!=t.name&&(o('"%s" works - aborting "%s"',e.name,t.name),t.close(),t=null)})},a.prototype.onOpen=function(){o("socket open"),this.readyState="open",this.emit("open"),this.onopen&&this.onopen.call(this),this.flush();if(this.upgrade&&this.transport.pause){o("starting upgrade probes");for(var e=0,t=this.upgrades.length;e<t;e++)this.probe(this.upgrades[e])}},a.prototype.onPacket=function(e){if("opening"==this.readyState||"open"==this.readyState){o('socket receive: type "%s", data "%s"',e.type,e.data);switch(e.type){case"open":this.onHandshake(i.parseJSON(e.data));break;case"ping":this.sendPacket("pong"),this.setPingTimeout();break;case"error":var t=Error("server error");t.code=e.data,this.emit("error",t);break;case"message":this.emit("message",e.data);var n={data:e.data};n.toString=function(){return e.data},this.onmessage&&this.onmessage.call(this,n)}}else o('packet received with socket readyState "%s"',this.readyState)},a.prototype.onHandshake=function(e){this.emit("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this.upgrades=e.upgrades,this.pingTimeout=e.pingTimeout,this.onOpen(),this.setPingTimeout()},a.prototype.setPingTimeout=function(){clearTimeout(this.pingTimeoutTimer);var e=this;this.pingTimeoutTimer=setTimeout(function(){e.onClose("ping timeout")},this.pingTimeout)},a.prototype.flush=function(){"closed"!=this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length&&(o("flushing %d packets in socket",this.writeBuffer.length),this.transport.send(this.writeBuffer),this.writeBuffer=[])},a.prototype.send=function(e){return this.sendPacket("message",e),this},a.prototype.sendPacket=function(e,t){var n={type:e,data:t};this.writeBuffer.push(n),this.flush()},a.prototype.close=function(){if("opening"==this.readyState||"open"==this.readyState)this.onClose("forced close"),o("socket closing - telling transport to close"),this.transport.close();return this},a.prototype.onError=function(e){this.emit("error",e),this.onClose("transport error",e)},a.prototype.onClose=function(e,t){"closed"!=this.readyState&&(o('socket close with reason: "%s"',e),this.readyState="closed",this.emit("close",e,t),this.onclose&&this.onclose.call(this))}}),n.register("node_modules/engine.io-client/lib/util.js",function(e,t,n,r){var i=!1;t.inherits=function(t,n){function r(){}r.prototype=n.prototype,t.prototype=new r},t.keys=Object.keys||function(e){var t=[],n=Object.prototype.hasOwnProperty;for(var r in e)n.call(e,r)&&t.push(r);return t},t.on=function(e,t,n,r){e.attachEvent?e.attachEvent("on"+t,n):e.addEventListener&&e.addEventListener(t,n,r)},t.load=function(e){if(r.document&&document.readyState==="complete"||i)return e();t.on(r,"load",e,!1)},"undefined"!=typeof window&&t.load(function(){i=!0}),t.defer=function(e){if(!t.ua.webkit||"undefined"!=typeof importScripts)return e();t.load(function(){setTimeout(e,100)})};var s=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,u=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,a=/(?:^|:|,)(?:\s*\[)+/g,f=/^\s+/,l=/\s+$/;t.parseJSON=function(e){if("string"!=typeof e||!e)return null;e=e.replace(f,"").replace(l,"");if(r.JSON&&JSON.parse)return JSON.parse(e);if(s.test(e.replace(o,"@").replace(u,"]").replace(a,"")))return Function("return "+e)()},t.ua={},t.ua.hasCORS="undefined"!=typeof XMLHttpRequest&&function(){try{var e=new XMLHttpRequest}catch(t){return!1}return e.withCredentials!=undefined}(),t.ua.webkit="undefined"!=typeof navigator&&/webkit/i.test(navigator.userAgent),t.ua.gecko="undefined"!=typeof navigator&&/gecko/i.test(navigator.userAgent),t.ua.android="undefined"!=typeof navigator&&/android/i.test(navigator.userAgent),t.request=function(n){if(n&&"undefined"!=typeof XDomainRequest)return new XDomainRequest;try{if("undefined"!=typeof XMLHttpRequest&&(!n||t.ua.hasCORS))return new XMLHttpRequest}catch(r){}if(!n)try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(r){}};var c=/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,h=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];t.parseUri=function(e){var t=c.exec(e||""),n={},r=14;while(r--)n[h[r]]=t[r]||"";return n},t.qs=function(e){var t="";for(var n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=n+"="+encodeURIComponent(e[n]));return t}}),n.register("node_modules/engine.io-client/lib/transport.js",function(e,t,n,r){function u(e){this.path=e.path,this.host=e.host,this.port=e.port,this.secure=e.secure,this.query=e.query,this.timestampParam=e.timestampParam,this.timestampRequests=e.timestampRequests,this.readyState=""}var i=n("./util"),s=n("./parser"),o=n("./event-emitter");e.exports=u,i.inherits(u,o),u.prototype.onError=function(e,t){var n=Error(e);return n.type="TransportError",n.description=t,this.emit("error",n),this},u.prototype.open=function(){if("closed"==this.readyState||""==this.readyState)this.readyState="opening",this.doOpen();return this},u.prototype.close=function(){if("opening"==this.readyState||"open"==this.readyState)this.doClose(),this.onClose();return this},u.prototype.send=function(e){if("open"!=this.readyState)throw Error("Transport not open");this.write(e)},u.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},u.prototype.onData=function(e){this.onPacket(s.decodePacket(e))},u.prototype.onPacket=function(e){this.emit("packet",e)},u.prototype.onClose=function(){this.readyState="closed",this.emit("close")}}),n.register("Socket.js",function(e,t,n,r){(function(){var t=[].slice;e.exports={write:function(e){var t=this;return this.parent.outbound(this,e,function(e){return t.send(e)}),this},disconnect:function(){var e;return e=1>arguments.length?[]:t.call(arguments,0),this.close.apply(this,e),this}}}).call(this)}),n.register("Client.js",function(e,t,n,r){(function(){var t,r,i,s,o,u=function(e,t){return function(){return e.apply(t,arguments)}},a={}.hasOwnProperty,f=function(e,t){function r(){this.constructor=e}for(var n in t)a.call(t,n)&&(e[n]=t[n]);return r.prototype=t.prototype,e.prototype=new r,e.__super__=t.prototype,e};o=n("./util"),s=o.isBrowser(),s?(i=n("node_modules/engine.io-client/lib/engine.io-client"),r=i.EventEmitter):(i=n("engine.io-client"),r=n("events").EventEmitter),o.extendSocket(i.Socket),t=function(e){function t(e){this.handleClose=u(this.handleClose,this),this.handleError=u(this.handleError,this),this.handleMessage=u(this.handleMessage,this),this.handleConnection=u(this.handleConnection,this);var t,n,r;for(n in e)r=e[n],this[n]=r;this.isServer=!1,this.isClient=!0,this.isBrowser=s,t={host:this.options.host,port:this.options.port,secure:this.options.secure,path:"/"+this.options.namespace,resource:this.options.resource,transports:this.options.transports,upgrade:this.options.upgrade,flashPath:this.options.flashPath,policyPort:this.options.policyPort,forceJSONP:this.options.forceJSONP,forceBust:this.options.forceBust,debug:this.options.debug},this.ssocket=new i.Socket(t),this.ssocket.parent=this,this.ssocket.on("open",this.handleConnection),this.ssocket.on("error",this.handleError),this.ssocket.on("message",this.handleMessage),this.ssocket.on("close",this.handleClose),this.start();return}return f(t,e),t.prototype.disconnect=function(){return this.ssocket.close(),this},t.prototype.handleConnection=function(){return this.connected=!0,this.connect(this.ssocket)},t.prototype.handleMessage=function(e){var t=this;return this.emit("inbound",this.ssocket,e),this.inbound(this.ssocket,e,function(e){return t.validate(t.ssocket,e,function(n){return n?(t.emit("message",t.ssocket,e),t.message(t.ssocket,e)):(t.emit("invalid",t.ssocket,e),t.invalid(t.ssocket,e))})})},t.prototype.handleError=function(e){return typeof e=="string"&&(e=Error(e)),this.error(this.ssocket,e)},t.prototype.handleClose=function(e){return this.emit("close",this.ssocket,e),this.close(this.ssocket,e)},t}(r),e.exports=t}).call(this)}),n.register("main.js",function(e,t,n,r){(function(){var e,t;t=n("./util"),e={createClient:function(e){var r,i,s,o;r=n("./Client"),i=n("./defaultClient"),o=t.mergePlugins(i,e),s=t.validatePlugin(o);if(s!=null)throw Error("Plugin validation failed: "+s);return new r(o)}},window.ProtoSock=e}).call(this)}),n.register("util.js",function(e,t,n,r){(function(){var t,r={}.hasOwnProperty,i=function(e,t){function i(){this.constructor=e}for(var n in t)r.call(t,n)&&(e[n]=t[n]);return i.prototype=t.prototype,e.prototype=new i,e.__super__=t.prototype,e},s=[].slice;e.exports=t={extendSocket:function(e){var t;return t=n("./Socket"),i(e.prototype,t)},mergePlugins:function(){var e,n,r,i,o,u,a;e=1>arguments.length?[]:s.call(arguments,0),r={};for(u=0,a=e.length;u<a;u++){i=e[u];for(n in i)o=i[n],typeof o=="object"&&n!=="server"?r[n]=t.mergePlugins(r[n],o):r[n]=o}return r},validatePlugin:function(e){if(typeof e.options!="object")return"missing options object";if(typeof e.options.namespace!="string")return"namespace option required";if(typeof e.options.resource!="string")return"resource option required";if(typeof e.inbound!="function")return"missing inbound formatter";if(typeof e.outbound!="function")return"missing outbound formatter";if(typeof e.validate!="function")return"missing validate"},isBrowser:function(){return!0}}}).call(this)}),n.register("defaultClient.js",function(e,t,n,r){(function(){var t;t={options:{},start:function(){},inbound:function(e,t,n){try{return n(JSON.parse(t))}catch(r){return this.error(r)}},outbound:function(e,t,n){try{return n(JSON.stringify(t))}catch(r){return this.error(r)}},validate:function(e,t,n){return n(!0)},invalid:function(){},connect:function(){},message:function(){},error:function(){},close:function(){}},t.options={host:window.location.hostname,port:window.location.port.length>0?parseInt(window.location.port):80,secure:window.location.protocol==="https:"},e.exports=t}).call(this)}),main=n("main")})(),function(){var e,t,n,r=this,i=[].slice;n=typeof window!="undefined",t=function(){var e;return e=function(){return((1+Math.random())*268435456|0).toString(16)},e()+e()+e()},e=function(e){var n,r,s;r={options:{namespace:"Vein",resource:"default"},start:function(){return this.services={},this.callbacks={}},ready:function(e){return this.synced?e(this.services):this.once("ready",e)},validate:function(e,t,n){if(typeof t!="object")return n(!1);if(typeof t.type!="string")return n(!1);if(t.type==="response"){if(typeof t.id!="string")return n(!1);if(typeof this.callbacks[t.id]!="function")return n(!1);if(typeof t.service!="string")return n(!1);if(!Array.isArray(t.args))return n(!1)}else{if(t.type!=="services")return n(!1);if(!Array.isArray(t.args))return n(!1)}return n(!0)},error:function(e,t){throw t},message:function(e,t){var n,r,i,s,o;if(t.type==="response")return(s=this.callbacks)[t.id].apply(s,t.args),delete this.callbacks[t.id];if(t.type==="services"){this.services=t.args,o=this.services;for(r=0,i=o.length;r<i;r++)n=o[r],this[n]=this.getSender(e,n);return this.synced=!0,this.emit("ready",this.services)}},getSender:function(e,n){var r=this;return function(){var s,o,u,a;return s=2>arguments.length?(a=0,[]):i.call(arguments,0,a=arguments.length-1),o=arguments[a++],u=t(),r.callbacks[u]=o,e.write({type:"request",id:u,service:n,args:s})}}};for(n in e)s=e[n],r.options[n]=s;return r},n?(window.Vein={createClient:function(t){return t==null&&(t={}),ProtoSock.createClient(e(t))}},typeof define=="function"&&define(function(){return Vein})):module.exports=e}.call(this);
Please sign in to comment.
Something went wrong with that request. Please try again.