/* sockjs-client v1.0.3 | http://sockjs.org | MIT license */ !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.SockJS=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o 1) { // Make a copy so as not to interfere with a current dispatchEvent. this._listeners[eventType] = arr.slice(0, idx).concat(arr.slice(idx + 1)); } else { delete this._listeners[eventType]; } return; } }; EventTarget.prototype.dispatchEvent = function(event) { var t = event.type; var args = Array.prototype.slice.call(arguments, 0); // TODO: This doesn't match the real behavior; per spec, onfoo get // their place in line from the /first/ time they're set from // non-null. Although WebKit bumps it to the end every time it's // set. if (this['on' + t]) { this['on' + t].apply(this, args); } if (t in this._listeners) { // Grab a reference to the listeners list. removeEventListener may alter the list. var listeners = this._listeners[t]; for (var i = 0; i < listeners.length; i++) { listeners[i].apply(this, args); } } }; module.exports = EventTarget; },{}],6:[function(require,module,exports){ 'use strict'; var inherits = require('inherits') , Event = require('./event') ; function TransportMessageEvent(data) { Event.call(this); this.initEvent('message', false, false); this.data = data; } inherits(TransportMessageEvent, Event); module.exports = TransportMessageEvent; },{"./event":4,"inherits":57}],7:[function(require,module,exports){ 'use strict'; var JSON3 = require('json3') , iframeUtils = require('./utils/iframe') ; function FacadeJS(transport) { this._transport = transport; transport.on('message', this._transportMessage.bind(this)); transport.on('close', this._transportClose.bind(this)); } FacadeJS.prototype._transportClose = function(code, reason) { iframeUtils.postMessage('c', JSON3.stringify([code, reason])); }; FacadeJS.prototype._transportMessage = function(frame) { iframeUtils.postMessage('t', frame); }; FacadeJS.prototype._send = function(data) { this._transport.send(data); }; FacadeJS.prototype._close = function() { this._transport.close(); this._transport.removeAllListeners(); }; module.exports = FacadeJS; },{"./utils/iframe":47,"json3":58}],8:[function(require,module,exports){ (function (process){ 'use strict'; var urlUtils = require('./utils/url') , eventUtils = require('./utils/event') , JSON3 = require('json3') , FacadeJS = require('./facade') , InfoIframeReceiver = require('./info-iframe-receiver') , iframeUtils = require('./utils/iframe') , loc = require('./location') ; var debug = function() {}; if (process.env.NODE_ENV !== 'production') { debug = require('debug')('sockjs-client:iframe-bootstrap'); } module.exports = function(SockJS, availableTransports) { var transportMap = {}; availableTransports.forEach(function(at) { if (at.facadeTransport) { transportMap[at.facadeTransport.transportName] = at.facadeTransport; } }); // hard-coded for the info iframe // TODO see if we can make this more dynamic transportMap[InfoIframeReceiver.transportName] = InfoIframeReceiver; var parentOrigin; /* eslint-disable camelcase */ SockJS.bootstrap_iframe = function() { /* eslint-enable camelcase */ var facade; iframeUtils.currentWindowId = loc.hash.slice(1); var onMessage = function(e) { if (e.source !== parent) { return; } if (typeof parentOrigin === 'undefined') { parentOrigin = e.origin; } if (e.origin !== parentOrigin) { return; } var iframeMessage; try { iframeMessage = JSON3.parse(e.data); } catch (ignored) { debug('bad json', e.data); return; } if (iframeMessage.windowId !== iframeUtils.currentWindowId) { return; } switch (iframeMessage.type) { case 's': var p; try { p = JSON3.parse(iframeMessage.data); } catch (ignored) { debug('bad json', iframeMessage.data); break; } var version = p[0]; var transport = p[1]; var transUrl = p[2]; var baseUrl = p[3]; debug(version, transport, transUrl, baseUrl); // change this to semver logic if (version !== SockJS.version) { throw new Error('Incompatibile SockJS! Main site uses:' + ' "' + version + '", the iframe:' + ' "' + SockJS.version + '".'); } if (!urlUtils.isOriginEqual(transUrl, loc.href) || !urlUtils.isOriginEqual(baseUrl, loc.href)) { throw new Error('Can\'t connect to different domain from within an ' + 'iframe. (' + loc.href + ', ' + transUrl + ', ' + baseUrl + ')'); } facade = new FacadeJS(new transportMap[transport](transUrl, baseUrl)); break; case 'm': facade._send(iframeMessage.data); break; case 'c': if (facade) { facade._close(); } facade = null; break; } }; eventUtils.attachEvent('message', onMessage); // Start iframeUtils.postMessage('s'); }; }; }).call(this,{ env: {} }) //# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImxpYi9pZnJhbWUtYm9vdHN0cmFwLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSIsImZpbGUiOiJnZW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ldyBFcnJvcignQ2FuXFwndCBjb25uZWN0IHRvIGRpZmZlcmVudCBkb21haW4gZnJvbSB3aXRoaW4gYW4gJyArXG4gICAgICAgICAgICAgICAgICAgICdpZnJhbWUuICgnICsgbG9jLmhyZWYgKyAnLCAnICsgdHJhbnNVcmwgKyAnLCAnICsgYmFzZVVybCArICcpJyk7XG4gICAgICAgIH1cbiAgICAgICAgZmFjYWRlID0gbmV3IEZhY2FkZUpTKG5ldyB0cmFuc3BvcnRNYXBbdHJhbnNwb3J0XSh0cmFuc1VybCwgYmFzZVVybCkpO1xuICAgICAgICBicmVhaztcbiAgICAgIGNhc2UgJ20nOlxuICAgICAgICBmYWNhZGUuX3NlbmQoaWZyYW1lTWVzc2FnZS5kYXRhKTtcbiAgICAgICAgYnJlYWs7XG4gICAgICBjYXNlICdjJzpcbiAgICAgICAgaWYgKGZhY2FkZSkge1xuICAgICAgICAgIGZhY2FkZS5fY2xvc2UoKTtcbiAgICAgICAgfVxuICAgICAgICBmYWNhZGUgPSBudWxsO1xuICAgICAgICBicmVhaztcbiAgICAgIH1cbiAgICB9O1xuXG4gICAgZXZlbnRVdGlscy5hdHRhY2hFdmVudCgnbWVzc2FnZScsIG9uTWVzc2FnZSk7XG5cbiAgICAvLyBTdGFydFxuICAgIGlmcmFtZVV0aWxzLnBvc3RNZXNzYWdlKCdzJyk7XG4gIH07XG59O1xuIl19 },{"./facade":7,"./info-iframe-receiver":10,"./location":13,"./utils/event":46,"./utils/iframe":47,"./utils/url":52,"debug":54,"json3":58}],9:[function(require,module,exports){ (function (process){ 'use strict'; var EventEmitter = require('events').EventEmitter , inherits = require('inherits') , JSON3 = require('json3') , objectUtils = require('./utils/object') ; var debug = function() {}; if (process.env.NODE_ENV !== 'production') { debug = require('debug')('sockjs-client:info-ajax'); } function InfoAjax(url, AjaxObject) { EventEmitter.call(this); var self = this; var t0 = +new Date(); this.xo = new AjaxObject('GET', url); this.xo.once('finish', function(status, text) { var info, rtt; if (status === 200) { rtt = (+new Date()) - t0; if (text) { try { info = JSON3.parse(text); } catch (e) { debug('bad json', text); } } if (!objectUtils.isObject(info)) { info = {}; } } self.emit('finish', info, rtt); self.removeAllListeners(); }); } inherits(InfoAjax, EventEmitter); InfoAjax.prototype.close = function() { this.removeAllListeners(); this.xo.close(); }; module.exports = InfoAjax; }).call(this,{ env: {} }) //# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImxpYi9pbmZvLWFqYXguanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EiLCJmaWxlIjoiZ2VuZXJhdGVkLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXNDb250ZW50IjpbIid1c2Ugc3RyaWN0JztcblxudmFyIEV2ZW50RW1pdHRlciA9IHJlcXVpcmUoJ2V2ZW50cycpLkV2ZW50RW1pdHRlclxuICAsIGluaGVyaXRzID0gcmVxdWlyZSgnaW5oZXJpdHMnKVxuICAsIEpTT04zID0gcmVxdWlyZSgnanNvbjMnKVxuICAsIG9iamVjdFV0aWxzID0gcmVxdWlyZSgnLi91dGlscy9vYmplY3QnKVxuICA7XG5cbnZhciBkZWJ1ZyA9IGZ1bmN0aW9uKCkge307XG5pZiAocHJvY2Vzcy5lbnYuTk9ERV9FTlYgIT09ICdwcm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HBvcnRzID0gSW5mb0FqYXg7XG4iXX0= },{"./utils/object":49,"debug":54,"events":3,"inherits":57,"json3":58}],10:[function(require,module,exports){ 'use strict'; var inherits = require('inherits') , EventEmitter = require('events').EventEmitter , JSON3 = require('json3') , XHRLocalObject = require('./transport/sender/xhr-local') , InfoAjax = require('./info-ajax') ; function InfoReceiverIframe(transUrl) { var self = this; EventEmitter.call(this); this.ir = new InfoAjax(transUrl, XHRLocalObject); this.ir.once('finish', function(info, rtt) { self.ir = null; self.emit('message', JSON3.stringify([info, rtt])); }); } inherits(InfoReceiverIframe, EventEmitter); InfoReceiverIframe.transportName = 'iframe-info-receiver'; InfoReceiverIframe.prototype.close = function() { if (this.ir) { this.ir.close(); this.ir = null; } this.removeAllListeners(); }; module.exports = InfoReceiverIframe; },{"./info-ajax":9,"./transport/sender/xhr-local":37,"events":3,"inherits":57,"json3":58}],11:[function(require,module,exports){ (function (process,global){ 'use strict'; var EventEmitter = require('events').EventEmitter , inherits = require('inherits') , JSON3 = require('json3') , utils = require('./utils/event') , IframeTransport = require('./transport/iframe') , InfoReceiverIframe = require('./info-iframe-receiver') ; var debug = function() {}; if (process.env.NODE_ENV !== 'production') { debug = require('debug')('sockjs-client:info-iframe'); } function InfoIframe(baseUrl, url) { var self = this; EventEmitter.call(this); var go = function() { var ifr = self.ifr = new IframeTransport(InfoReceiverIframe.transportName, url, baseUrl); ifr.once('message', function(msg) { if (msg) { var d; try { d = JSON3.parse(msg); } catch (e) { debug('bad json', msg); self.emit('finish'); self.close(); return; } var info = d[0], rtt = d[1]; self.emit('finish', info, rtt); } self.close(); }); ifr.once('close', function() { self.emit('finish'); self.close(); }); }; // TODO this seems the same as the 'needBody' from transports if (!global.document.body) { utils.attachEvent('load', go); } else { go(); } } inherits(InfoIframe, EventEmitter); InfoIframe.enabled = function() { return IframeTransport.enabled(); }; InfoIframe.prototype.close = function() { if (this.ifr) { this.ifr.close(); } this.removeAllListeners(); this.ifr = null; }; module.exports = InfoIframe; }).call(this,{ env: {} },typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) //# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImxpYi9pbmZvLWlmcmFtZS5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EiLCJmaWxlIjoiZ2VuZXJhdGVkLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXNDb250ZW50IjpbIid1c2Ugc3RyaWN0JztcblxudmFyIEV2ZW50RW1pdHRlciA9IHJlcXVpcmUoJ2V2ZW50cycpLkV2ZW50RW1pdHRlclxuICAsIGluaGVyaXRzID0gcmVxdWlyZSgnaW5oZXJpdHMnKVxuICAsIEpTT04zID0gcmVxdWlyZSgnanNvbjMnKVxuICAsIHV0aWxzID0gcmVxdWlyZSgnLi91dGlscy9ldmVudCcpXG4gICwgSWZyYW1lVHJhbnNwb3J0ID0gcmVxdWlyZSgnLi90cmFuc3BvcnQvaWZyYW1lJylcbiAgLCB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kge1xuICAgICAgc2VsZi5lbWl0KCdmaW5pc2gnKTtcbiAgICAgIHNlbGYuY2xvc2UoKTtcbiAgICB9KTtcbiAgfTtcblxuICAvLyBUT0RPIHRoaXMgc2VlbXMgdGhlIHNhbWUgYXMgdGhlICduZWVkQm9keScgZnJvbSB0cmFuc3BvcnRzXG4gIGlmICghZ2xvYmFsLmRvY3VtZW50LmJvZHkpIHtcbiAgICB1dGlscy5hdHRhY2hFdmVudCgnbG9hZCcsIGdvKTtcbiAgfSBlbHNlIHtcbiAgICBnbygpO1xuICB9XG59XG5cbmluaGVyaXRzKEluZm9JZnJhbWUsIEV2ZW50RW1pdHRlcik7XG5cbkluZm9JZnJhbWUuZW5hYmxlZCA9IGZ1bmN0aW9uKCkge1xuICByZXR1cm4gSWZyYW1lVHJhbnNwb3J0LmVuYWJsZWQoKTtcbn07XG5cbkluZm9JZnJhbWUucHJvdG90eXBlLmNsb3NlID0gZnVuY3Rpb24oKSB7XG4gIGlmICh0aGlzLmlmcikge1xuICAgIHRoaXMuaWZyLmNsb3NlKCk7XG4gIH1cbiAgdGhpcy5yZW1vdmVBbGxMaXN0ZW5lcnMoKTtcbiAgdGhpcy5pZnIgPSBudWxsO1xufTtcblxubW9kdWxlLmV4cG9ydHMgPSBJbmZvSWZyYW1lO1xuIl19 },{"./info-iframe-receiver":10,"./transport/iframe":22,"./utils/event":46,"debug":54,"events":3,"inherits":57,"json3":58}],12:[function(require,module,exports){ (function (process){ 'use strict'; var EventEmitter = require('events').EventEmitter , inherits = require('inherits') , urlUtils = require('./utils/url') , XDR = require('./transport/sender/xdr') , XHRCors = require('./transport/sender/xhr-cors') , XHRLocal = require('./transport/sender/xhr-local') , XHRFake = require('./transport/sender/xhr-fake') , InfoIframe = require('./info-iframe') , InfoAjax = require('./info-ajax') ; var debug = function() {}; if (process.env.NODE_ENV !== 'production') { debug = require('debug')('sockjs-client:info-receiver'); } function InfoReceiver(baseUrl, urlInfo) { debug(baseUrl); var self = this; EventEmitter.call(this); setTimeout(function() { self.doXhr(baseUrl, urlInfo); }, 0); } inherits(InfoReceiver, EventEmitter); // TODO this is currently ignoring the list of available transports and the whitelist InfoReceiver._getReceiver = function(baseUrl, url, urlInfo) { // determine method of CORS support (if needed) if (urlInfo.sameOrigin) { return new InfoAjax(url, XHRLocal); } if (XHRCors.enabled) { return new InfoAjax(url, XHRCors); } if (XDR.enabled && urlInfo.sameScheme) { return new InfoAjax(url, XDR); } if (InfoIframe.enabled()) { return new InfoIframe(baseUrl, url); } return new InfoAjax(url, XHRFake); }; InfoReceiver.prototype.doXhr = function(baseUrl, urlInfo) { var self = this , url = urlUtils.addPath(baseUrl, '/info') ; debug('doXhr', url); this.xo = InfoReceiver._getReceiver(baseUrl, url, urlInfo); this.timeoutRef = setTimeout(function() { debug('timeout'); self._cleanup(false); self.emit('finish'); }, InfoReceiver.timeout); this.xo.once('finish', function(info, rtt) { debug('finish', info, rtt); self._cleanup(true); self.emit('finish', info, rtt); }); }; InfoReceiver.prototype._cleanup = function(wasClean) { debug('_cleanup'); clearTimeout(this.timeoutRef); this.timeoutRef = null; if (!wasClean && this.xo) { this.xo.close(); } this.xo = null; }; InfoReceiver.prototype.close = function() { debug('close'); this.removeAllListeners(); this._cleanup(false); }; InfoReceiver.timeout = 8000; module.exports = InfoReceiver; }).call(this,{ env: {} }) //# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImxpYi9pbmZvLXJlY2VpdmVyLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtB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nVsbDtcbiAgaWYgKCF3YXNDbGVhbiAmJiB0aGlzLnhvKSB7XG4gICAgdGhpcy54by5jbG9zZSgpO1xuICB9XG4gIHRoaXMueG8gPSBudWxsO1xufTtcblxuSW5mb1JlY2VpdmVyLnByb3RvdHlwZS5jbG9zZSA9IGZ1bmN0aW9uKCkge1xuICBkZWJ1ZygnY2xvc2UnKTtcbiAgdGhpcy5yZW1vdmVBbGxMaXN0ZW5lcnMoKTtcbiAgdGhpcy5fY2xlYW51cChmYWxzZSk7XG59O1xuXG5JbmZvUmVjZWl2ZXIudGltZW91dCA9IDgwMDA7XG5cbm1vZHVsZS5leHBvcnRzID0gSW5mb1JlY2VpdmVyO1xuIl19 },{"./info-ajax":9,"./info-iframe":11,"./transport/sender/xdr":34,"./transport/sender/xhr-cors":35,"./transport/sender/xhr-fake":36,"./transport/sender/xhr-local":37,"./utils/url":52,"debug":54,"events":3,"inherits":57}],13:[function(require,module,exports){ (function (global){ 'use strict'; module.exports = global.location || { origin: 'http://localhost:80' , protocol: 'http' , host: 'localhost' , port: 80 , href: 'http://localhost/' , hash: '' }; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) //# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImxpYi9sb2NhdGlvbi5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSIsImZpbGUiOiJnZW5lcmF0ZWQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBzdHJpY3QnO1xuXG5tb2R1bGUuZXhwb3J0cyA9IGdsb2JhbC5sb2NhdGlvbiB8fCB7XG4gIG9yaWdpbjogJ2h0dHA6Ly9sb2NhbGhvc3Q6ODAnXG4sIHByb3RvY29sOiAnaHR0cCdcbiwgaG9zdDogJ2xvY2FsaG9zdCdcbiwgcG9ydDogODBcbiwgaHJlZjogJ2h0dHA6Ly9sb2NhbGhvc3QvJ1xuLCBoYXNoOiAnJ1xufTtcbiJdfQ== },{}],14:[function(require,module,exports){ (function (process,global){ 'use strict'; require('./shims'); var URL = require('url-parse') , inherits = require('inherits') , JSON3 = require('json3') , random = require('./utils/random') , escape = require('./utils/escape') , urlUtils = require('./utils/url') , eventUtils = require('./utils/event') , transport = require('./utils/transport') , objectUtils = require('./utils/object') , browser = require('./utils/browser') , log = require('./utils/log') , Event = require('./event/event') , EventTarget = require('./event/eventtarget') , loc = require('./location') , CloseEvent = require('./event/close') , TransportMessageEvent = require('./event/trans-message') , InfoReceiver = require('./info-receiver') ; var debug = function() {}; if (process.env.NODE_ENV !== 'production') { // Make debug module available globally so you can enable via the console easily global.dbg = require('debug'); debug = global.dbg('sockjs-client:main'); } var transports; // follow constructor steps defined at http://dev.w3.org/html5/websockets/#the-websocket-interface function SockJS(url, protocols, options) { if (!(this instanceof SockJS)) { return new SockJS(url, protocols, options); } if (arguments.length < 1) { throw new TypeError("Failed to construct 'SockJS: 1 argument required, but only 0 present"); } EventTarget.call(this); this.readyState = SockJS.CONNECTING; this.extensions = ''; this.protocol = ''; // non-standard extension options = options || {}; if (options.protocols_whitelist) { log.warn("'protocols_whitelist' is DEPRECATED. Use 'transports' instead."); } this._transportsWhitelist = options.transports; var sessionId = options.sessionId || 8; if (typeof sessionId === 'function') { this._generateSessionId = sessionId; } else if (typeof sessionId === 'number') { this._generateSessionId = function() { return random.string(sessionId); }; } else { throw new TypeError("If sessionId is used in the options, it needs to be a number or a function."); } this._server = options.server || random.numberString(1000); // Step 1 of WS spec - parse and validate the url. Issue #8 var parsedUrl = new URL(url); if (!parsedUrl.host || !parsedUrl.protocol) { throw new SyntaxError("The URL '" + url + "' is invalid"); } else if (parsedUrl.hash) { throw new SyntaxError('The URL must not contain a fragment'); } else if (parsedUrl.protocol !== 'http:' && parsedUrl.protocol !== 'https:') { throw new SyntaxError("The URL's scheme must be either 'http:' or 'https:'. '" + parsedUrl.protocol + "' is not allowed."); } var secure = parsedUrl.protocol === 'https:'; // Step 2 - don't allow secure origin with an insecure protocol if (loc.protocol === 'https' && !secure) { throw new Error('SecurityError: An insecure SockJS connection may not be initiated from a page loaded over HTTPS'); } // Step 3 - check port access - no need here // Step 4 - parse protocols argument if (!protocols) { protocols = []; } else if (!Array.isArray(protocols)) { protocols = [protocols]; } // Step 5 - check protocols argument var sortedProtocols = protocols.sort(); sortedProtocols.forEach(function(proto, i) { if (!proto) { throw new SyntaxError("The protocols entry '" + proto + "' is invalid."); } if (i < (sortedProtocols.length - 1) && proto === sortedProtocols[i + 1]) { throw new SyntaxError("The protocols entry '" + proto + "' is duplicated."); } }); // Step 6 - convert origin var o = urlUtils.getOrigin(loc.href); this._origin = o ? o.toLowerCase() : null; // remove the trailing slash parsedUrl.set('pathname', parsedUrl.pathname.replace(/\/+$/, '')); // store the sanitized url this.url = parsedUrl.href; debug('using url', this.url); // Step 7 - start connection in background // obtain server info // http://sockjs.github.io/sockjs-protocol/sockjs-protocol-0.3.3.html#section-26 this._urlInfo = { nullOrigin: !browser.hasDomain() , sameOrigin: urlUtils.isOriginEqual(this.url, loc.href) , sameScheme: urlUtils.isSchemeEqual(this.url, loc.href) }; this._ir = new InfoReceiver(this.url, this._urlInfo); this._ir.once('finish', this._receiveInfo.bind(this)); } inherits(SockJS, EventTarget); function userSetCode(code) { return code === 1000 || (code >= 3000 && code <= 4999); } SockJS.prototype.close = function(code, reason) { // Step 1 if (code && !userSetCode(code)) { throw new Error('InvalidAccessError: Invalid code'); } // Step 2.4 states the max is 123 bytes, but we are just checking length if (reason && reason.length > 123) { throw new SyntaxError('reason argument has an invalid length'); } // Step 3.1 if (this.readyState === SockJS.CLOSING || this.readyState === SockJS.CLOSED) { return; } // TODO look at docs to determine how to set this var wasClean = true; this._close(code || 1000, reason || 'Normal closure', wasClean); }; SockJS.prototype.send = function(data) { // #13 - convert anything non-string to string // TODO this currently turns objects into [object Object] if (typeof data !== 'string') { data = '' + data; } if (this.readyState === SockJS.CONNECTING) { throw new Error('InvalidStateError: The connection has not been established yet'); } if (this.readyState !== SockJS.OPEN) { return; } this._transport.send(escape.quote(data)); }; SockJS.version = require('./version'); SockJS.CONNECTING = 0; SockJS.OPEN = 1; SockJS.CLOSING = 2; SockJS.CLOSED = 3; SockJS.prototype._receiveInfo = function(info, rtt) { debug('_receiveInfo', rtt); this._ir = null; if (!info) { this._close(1002, 'Cannot connect to server'); return; } // establish a round-trip timeout (RTO) based on the // round-trip time (RTT) this._rto = this.countRTO(rtt); // allow server to override url used for the actual transport this._transUrl = info.base_url ? info.base_url : this.url; info = objectUtils.extend(info, this._urlInfo); debug('info', info); // determine list of desired and supported transports var enabledTransports = transports.filterToEnabled(this._transportsWhitelist, info); this._transports = enabledTransports.main; debug(this._transports.length + ' enabled transports'); this._connect(); }; SockJS.prototype._connect = function() { for (var Transport = this._transports.shift(); Transport; Transport = this._transports.shift()) { debug('attempt', Transport.transportName); if (Transport.needBody) { if (!global.document.body || (typeof global.document.readyState !== 'undefined' && global.document.readyState !== 'complete' && global.document.readyState !== 'interactive')) { debug('waiting for body'); this._transports.unshift(Transport); eventUtils.attachEvent('load', this._connect.bind(this)); return; } } // calculate timeout based on RTO and round trips. Default to 5s var timeoutMs = (this._rto * Transport.roundTrips) || 5000; this._transportTimeoutId = setTimeout(this._transportTimeout.bind(this), timeoutMs); debug('using timeout', timeoutMs); var transportUrl = urlUtils.addPath(this._transUrl, '/' + this._server + '/' + this._generateSessionId()); debug('transport url', transportUrl); var transportObj = new Transport(transportUrl, this._transUrl); transportObj.on('message', this._transportMessage.bind(this)); transportObj.once('close', this._transportClose.bind(this)); transportObj.transportName = Transport.transportName; this._transport = transportObj; return; } this._close(2000, 'All transports failed', false); }; SockJS.prototype._transportTimeout = function() { debug('_transportTimeout'); if (this.readyState === SockJS.CONNECTING) { this._transportClose(2007, 'Transport timed out'); } }; SockJS.prototype._transportMessage = function(msg) { debug('_transportMessage', msg); var self = this , type = msg.slice(0, 1) , content = msg.slice(1) , payload ; // first check for messages that don't need a payload switch (type) { case 'o': this._open(); return; case 'h': this.dispatchEvent(new Event('heartbeat')); debug('heartbeat', this.transport); return; } if (content) { try { payload = JSON3.parse(content); } catch (e) { debug('bad json', content); } } if (typeof payload === 'undefined') { debug('empty payload', content); return; } switch (type) { case 'a': if (Array.isArray(payload)) { payload.forEach(function(p) { debug('message', self.transport, p); self.dispatchEvent(new TransportMessageEvent(p)); }); } break; case 'm': debug('message', this.transport, payload); this.dispatchEvent(new TransportMessageEvent(payload)); break; case 'c': if (Array.isArray(payload) && payload.length === 2) { this._close(payload[0], payload[1], true); } break; } }; SockJS.prototype._transportClose = function(code, reason) { debug('_transportClose', this.transport, code, reason); if (this._transport) { this._transport.removeAllListeners(); this._transport = null; this.transport = null; } if (!userSetCode(code) && code !== 2000 && this.readyState === SockJS.CONNECTING) { this._connect(); return; } this._close(code, reason); }; SockJS.prototype._open = function() { debug('_open', this._transport.transportName, this.readyState); if (this.readyState === SockJS.CONNECTING) { if (this._transportTimeoutId) { clearTimeout(this._transportTimeoutId); this._transportTimeoutId = null; } this.readyState = SockJS.OPEN; this.transport = this._transport.transportName; this.dispatchEvent(new Event('open')); debug('connected', this.transport); } else { // The server might have been restarted, and lost track of our // connection. this._close(1006, 'Server lost session'); } }; SockJS.prototype._close = function(code, reason, wasClean) { debug('_close', this.transport, code, reason, wasClean, this.readyState); var forceFail = false; if (this._ir) { forceFail = true; this._ir.close(); this._ir = null; } if (this._transport) { this._transport.close(); this._transport = null; this.transport = null; } if (this.readyState === SockJS.CLOSED) { throw new Error('InvalidStateError: SockJS has already been closed'); } this.readyState = SockJS.CLOSING; setTimeout(function() { this.readyState = SockJS.CLOSED; if (forceFail) { this.dispatchEvent(new Event('error')); } var e = new CloseEvent('close'); e.wasClean = wasClean || false; e.code = code || 1000; e.reason = reason; this.dispatchEvent(e); this.onmessage = this.onclose = this.onerror = null; debug('disconnected'); }.bind(this), 0); }; // See: http://www.erg.abdn.ac.uk/~gerrit/dccp/notes/ccid2/rto_estimator/ // and RFC 2988. SockJS.prototype.countRTO = function(rtt) { // In a local environment, when using IE8/9 and the `jsonp-polling` // transport the time needed to establish a connection (the time that pass // from the opening of the transport to the call of `_dispatchOpen`) is // around 200msec (the lower bound used in the article above) and this // causes spurious timeouts. For this reason we calculate a value slightly // larger than that used in the article. if (rtt > 100) { return 4 * rtt; // rto > 400msec } return 300 + rtt; // 300msec < rto <= 400msec }; module.exports = function(availableTransports) { transports = transport(availableTransports); require('./iframe-bootstrap')(SockJS, availableTransports); return SockJS; }; }).call(this,{ env: {} },typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) //# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImxpYi9tYWluLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0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gIGlmIChydHQgPiAxMDApIHtcbiAgICByZXR1cm4gNCAqIHJ0dDsgLy8gcnRvID4gNDAwbXNlY1xuICB9XG4gIHJldHVybiAzMDAgKyBydHQ7IC8vIDMwMG1zZWMgPCBydG8gPD0gNDAwbXNlY1xufTtcblxubW9kdWxlLmV4cG9ydHMgPSBmdW5jdGlvbihhdmFpbGFibGVUcmFuc3BvcnRzKSB7XG4gIHRyYW5zcG9ydHMgPSB0cmFuc3BvcnQoYXZhaWxhYmxlVHJhbnNwb3J0cyk7XG4gIHJlcXVpcmUoJy4vaWZyYW1lLWJvb3RzdHJhcCcpKFNvY2tKUywgYXZhaWxhYmxlVHJhbnNwb3J0cyk7XG4gIHJldHVybiBTb2NrSlM7XG59O1xuIl19 },{"./event/close":2,"./event/event":4,"./event/eventtarget":5,"./event/trans-message":6,"./iframe-bootstrap":8,"./info-receiver":12,"./location":13,"./shims":15,"./utils/browser":44,"./utils/escape":45,"./utils/event":46,"./utils/log":48,"./utils/object":49,"./utils/random":50,"./utils/transport":51,"./utils/url":52,"./version":53,"debug":54,"inherits":57,"json3":58,"url-parse":59}],15:[function(require,module,exports){ /* eslint-disable */ /* jscs: disable */ 'use strict'; // pulled specific shims from https://github.com/es-shims/es5-shim var ArrayPrototype = Array.prototype; var ObjectPrototype = Object.prototype; var FunctionPrototype = Function.prototype; var StringPrototype = String.prototype; var array_slice = ArrayPrototype.slice; var _toString = ObjectPrototype.toString; var isFunction = function (val) { return ObjectPrototype.toString.call(val) === '[object Function]'; }; var isArray = function isArray(obj) { return _toString.call(obj) === '[object Array]'; }; var isString = function isString(obj) { return _toString.call(obj) === '[object String]'; }; var supportsDescriptors = Object.defineProperty && (function () { try { Object.defineProperty({}, 'x', {}); return true; } catch (e) { /* this is ES3 */ return false; } }()); // Define configurable, writable and non-enumerable props // if they don't exist. var defineProperty; if (supportsDescriptors) { defineProperty = function (object, name, method, forceAssign) { if (!forceAssign && (name in object)) { return; } Object.defineProperty(object, name, { configurable: true, enumerable: false, writable: true, value: method }); }; } else { defineProperty = function (object, name, method, forceAssign) { if (!forceAssign && (name in object)) { return; } object[name] = method; }; } var defineProperties = function (object, map, forceAssign) { for (var name in map) { if (ObjectPrototype.hasOwnProperty.call(map, name)) { defineProperty(object, name, map[name], forceAssign); } } }; var toObject = function (o) { if (o == null) { // this matches both null and undefined throw new TypeError("can't convert " + o + ' to object'); } return Object(o); }; // // Util // ====== // // ES5 9.4 // http://es5.github.com/#x9.4 // http://jsperf.com/to-integer function toInteger(num) { var n = +num; if (n !== n) { // isNaN n = 0; } else if (n !== 0 && n !== (1 / 0) && n !== -(1 / 0)) { n = (n > 0 || -1) * Math.floor(Math.abs(n)); } return n; } function ToUint32(x) { return x >>> 0; } // // Function // ======== // // ES-5 15.3.4.5 // http://es5.github.com/#x15.3.4.5 function Empty() {} defineProperties(FunctionPrototype, { bind: function bind(that) { // .length is 1 // 1. Let Target be the this value. var target = this; // 2. If IsCallable(Target) is false, throw a TypeError exception. if (!isFunction(target)) { throw new TypeError('Function.prototype.bind called on incompatible ' + target); } // 3. Let A be a new (possibly empty) internal list of all of the // argument values provided after thisArg (arg1, arg2 etc), in order. // XXX slicedArgs will stand in for "A" if used var args = array_slice.call(arguments, 1); // for normal call // 4. Let F be a new native ECMAScript object. // 11. Set the [[Prototype]] internal property of F to the standard // built-in Function prototype object as specified in 15.3.3.1. // 12. Set the [[Call]] internal property of F as described in // 15.3.4.5.1. // 13. Set the [[Construct]] internal property of F as described in // 15.3.4.5.2. // 14. Set the [[HasInstance]] internal property of F as described in // 15.3.4.5.3. var binder = function () { if (this instanceof bound) { // 15.3.4.5.2 [[Construct]] // When the [[Construct]] internal method of a function object, // F that was created using the bind function is called with a // list of arguments ExtraArgs, the following steps are taken: // 1. Let target be the value of F's [[TargetFunction]] // internal property. // 2. If target has no [[Construct]] internal method, a // TypeError exception is thrown. // 3. Let boundArgs be the value of F's [[BoundArgs]] internal // property. // 4. Let args be a new list containing the same values as the // list boundArgs in the same order followed by the same // values as the list ExtraArgs in the same order. // 5. Return the result of calling the [[Construct]] internal // method of target providing args as the arguments. var result = target.apply( this, args.concat(array_slice.call(arguments)) ); if (Object(result) === result) { return result; } return this; } else { // 15.3.4.5.1 [[Call]] // When the [[Call]] internal method of a function object, F, // which was created using the bind function is called with a // this value and a list of arguments ExtraArgs, the following // steps are taken: // 1. Let boundArgs be the value of F's [[BoundArgs]] internal // property. // 2. Let boundThis be the value of F's [[BoundThis]] internal // property. // 3. Let target be the value of F's [[TargetFunction]] internal // property. // 4. Let args be a new list containing the same values as the // list boundArgs in the same order followed by the same // values as the list ExtraArgs in the same order. // 5. Return the result of calling the [[Call]] internal method // of target providing boundThis as the this value and // providing args as the arguments. // equiv: target.call(this, ...boundArgs, ...args) return target.apply( that, args.concat(array_slice.call(arguments)) ); } }; // 15. If the [[Class]] internal property of Target is "Function", then // a. Let L be the length property of Target minus the length of A. // b. Set the length own property of F to either 0 or L, whichever is // larger. // 16. Else set the length own property of F to 0. var boundLength = Math.max(0, target.length - args.length); // 17. Set the attributes of the length own property of F to the values // specified in 15.3.5.1. var boundArgs = []; for (var i = 0; i < boundLength; i++) { boundArgs.push('$' + i); } // XXX Build a dynamic function with desired amount of arguments is the only // way to set the length property of a function. // In environments where Content Security Policies enabled (Chrome extensions, // for ex.) all use of eval or Function costructor throws an exception. // However in all of these environments Function.prototype.bind exists // and so this code will never be executed. var bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this, arguments); }')(binder); if (target.prototype) { Empty.prototype = target.prototype; bound.prototype = new Empty(); // Clean up dangling references. Empty.prototype = null; } // TODO // 18. Set the [[Extensible]] internal property of F to true. // TODO // 19. Let thrower be the [[ThrowTypeError]] function Object (13.2.3). // 20. Call the [[DefineOwnProperty]] internal method of F with // arguments "caller", PropertyDescriptor {[[Get]]: thrower, [[Set]]: // thrower, [[Enumerable]]: false, [[Configurable]]: false}, and // false. // 21. Call the [[DefineOwnProperty]] internal method of F with // arguments "arguments", PropertyDescriptor {[[Get]]: thrower, // [[Set]]: thrower, [[Enumerable]]: false, [[Configurable]]: false}, // and false. // TODO // NOTE Function objects created using Function.prototype.bind do not // have a prototype property or the [[Code]], [[FormalParameters]], and // [[Scope]] internal properties. // XXX can't delete prototype in pure-js. // 22. Return F. return bound; } }); // // Array // ===== // // ES5 15.4.3.2 // http://es5.github.com/#x15.4.3.2 // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/isArray defineProperties(Array, { isArray: isArray }); var boxedString = Object('a'); var splitString = boxedString[0] !== 'a' || !(0 in boxedString); var properlyBoxesContext = function properlyBoxed(method) { // Check node 0.6.21 bug where third parameter is not boxed var properlyBoxesNonStrict = true; var properlyBoxesStrict = true; if (method) { method.call('foo', function (_, __, context) { if (typeof context !== 'object') { properlyBoxesNonStrict = false; } }); method.call([1], function () { 'use strict'; properlyBoxesStrict = typeof this === 'string'; }, 'x'); } return !!method && properlyBoxesNonStrict && properlyBoxesStrict; }; defineProperties(ArrayPrototype, { forEach: function forEach(fun /*, thisp*/) { var object = toObject(this), self = splitString && isString(this) ? this.split('') : object, thisp = arguments[1], i = -1, length = self.length >>> 0; // If no callback function or if callback is not a callable function if (!isFunction(fun)) { throw new TypeError(); // TODO message } while (++i < length) { if (i in self) { // Invoke the callback function with call, passing arguments: // context, property value, property key, thisArg object // context fun.call(thisp, self[i], i, object); } } } }, !properlyBoxesContext(ArrayPrototype.forEach)); // ES5 15.4.4.14 // http://es5.github.com/#x15.4.4.14 // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/indexOf var hasFirefox2IndexOfBug = Array.prototype.indexOf && [0, 1].indexOf(1, 2) !== -1; defineProperties(ArrayPrototype, { indexOf: function indexOf(sought /*, fromIndex */ ) { var self = splitString && isString(this) ? this.split('') : toObject(this), length = self.length >>> 0; if (!length) { return -1; } var i = 0; if (arguments.length > 1) { i = toInteger(arguments[1]); } // handle negative indices i = i >= 0 ? i : Math.max(0, length + i); for (; i < length; i++) { if (i in self && self[i] === sought) { return i; } } return -1; } }, hasFirefox2IndexOfBug); // // String // ====== // // ES5 15.5.4.14 // http://es5.github.com/#x15.5.4.14 // [bugfix, IE lt 9, firefox 4, Konqueror, Opera, obscure browsers] // Many browsers do not split properly with regular expressions or they // do not perform the split correctly under obscure conditions. // See http://blog.stevenlevithan.com/archives/cross-browser-split // I've tested in many browsers and this seems to cover the deviant ones: // 'ab'.split(/(?:ab)*/) should be ["", ""], not [""] // '.'.split(/(.?)(.?)/) should be ["", ".", "", ""], not ["", ""] // 'tesst'.split(/(s)*/) should be ["t", undefined, "e", "s", "t"], not // [undefined, "t", undefined, "e", ...] // ''.split(/.?/) should be [], not [""] // '.'.split(/()()/) should be ["."], not ["", "", "."] var string_split = StringPrototype.split; if ( 'ab'.split(/(?:ab)*/).length !== 2 || '.'.split(/(.?)(.?)/).length !== 4 || 'tesst'.split(/(s)*/)[1] === 't' || 'test'.split(/(?:)/, -1).length !== 4 || ''.split(/.?/).length || '.'.split(/()()/).length > 1 ) { (function () { var compliantExecNpcg = /()??/.exec('')[1] === void 0; // NPCG: nonparticipating capturing group StringPrototype.split = function (separator, limit) { var string = this; if (separator === void 0 && limit === 0) { return []; } // If `separator` is not a regex, use native split if (_toString.call(separator) !== '[object RegExp]') { return string_split.call(this, separator, limit); } var output = [], flags = (separator.ignoreCase ? 'i' : '') + (separator.multiline ? 'm' : '') + (separator.extended ? 'x' : '') + // Proposed for ES6 (separator.sticky ? 'y' : ''), // Firefox 3+ lastLastIndex = 0, // Make `global` and avoid `lastIndex` issues by working with a copy separator2, match, lastIndex, lastLength; separator = new RegExp(separator.source, flags + 'g'); string += ''; // Type-convert if (!compliantExecNpcg) { // Doesn't need flags gy, but they don't hurt separator2 = new RegExp('^' + separator.source + '$(?!\\s)', flags); } /* Values for `limit`, per the spec: * If undefined: 4294967295 // Math.pow(2, 32) - 1 * If 0, Infinity, or NaN: 0 * If positive number: limit = Math.floor(limit); if (limit > 4294967295) limit -= 4294967296; * If negative number: 4294967296 - Math.floor(Math.abs(limit)) * If other: Type-convert, then use the above rules */ limit = limit === void 0 ? -1 >>> 0 : // Math.pow(2, 32) - 1 ToUint32(limit); while (match = separator.exec(string)) { // `separator.lastIndex` is not reliable cross-browser lastIndex = match.index + match[0].length; if (lastIndex > lastLastIndex) { output.push(string.slice(lastLastIndex, match.index)); // Fix browsers whose `exec` methods don't consistently return `undefined` for // nonparticipating capturing groups if (!compliantExecNpcg && match.length > 1) { match[0].replace(separator2, function () { for (var i = 1; i < arguments.length - 2; i++) { if (arguments[i] === void 0) { match[i] = void 0; } } }); } if (match.length > 1 && match.index < string.length) { ArrayPrototype.push.apply(output, match.slice(1)); } lastLength = match[0].length; lastLastIndex = lastIndex; if (output.length >= limit) { break; } } if (separator.lastIndex === match.index) { separator.lastIndex++; // Avoid an infinite loop } } if (lastLastIndex === string.length) { if (lastLength || !separator.test('')) { output.push(''); } } else { output.push(string.slice(lastLastIndex)); } return output.length > limit ? output.slice(0, limit) : output; }; }()); // [bugfix, chrome] // If separator is undefined, then the result array contains just one String, // which is the this value (converted to a String). If limit is not undefined, // then the output array is truncated so that it contains no more than limit // elements. // "0".split(undefined, 0) -> [] } else if ('0'.split(void 0, 0).length) { StringPrototype.split = function split(separator, limit) { if (separator === void 0 && limit === 0) { return []; } return string_split.call(this, separator, limit); }; } // ES5 15.5.4.20 // whitespace from: http://es5.github.io/#x15.5.4.20 var ws = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003' + '\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028' + '\u2029\uFEFF'; var zeroWidth = '\u200b'; var wsRegexChars = '[' + ws + ']'; var trimBeginRegexp = new RegExp('^' + wsRegexChars + wsRegexChars + '*'); var trimEndRegexp = new RegExp(wsRegexChars + wsRegexChars + '*$'); var hasTrimWhitespaceBug = StringPrototype.trim && (ws.trim() || !zeroWidth.trim()); defineProperties(StringPrototype, { // http://blog.stevenlevithan.com/archives/faster-trim-javascript // http://perfectionkills.com/whitespace-deviations/ trim: function trim() { if (this === void 0 || this === null) { throw new TypeError("can't convert " + this + ' to object'); } return String(this).replace(trimBeginRegexp, '').replace(trimEndRegexp, ''); } }, hasTrimWhitespaceBug); // ECMA-262, 3rd B.2.3 // Not an ECMAScript standard, although ECMAScript 3rd Edition has a // non-normative section suggesting uniform semantics and it should be // normalized across all browsers // [bugfix, IE lt 9] IE < 9 substr() with negative value not working in IE var string_substr = StringPrototype.substr; var hasNegativeSubstrBug = ''.substr && '0b'.substr(-1) !== 'b'; defineProperties(StringPrototype, { substr: function substr(start, length) { return string_substr.call( this, start < 0 ? ((start = this.length + start) < 0 ? 0 : start) : start, length ); } }, hasNegativeSubstrBug); },{}],16:[function(require,module,exports){ 'use strict'; module.exports = [ // streaming transports require('./transport/websocket') , require('./transport/xhr-streaming') , require('./transport/xdr-streaming') , require('./transport/eventsource') , require('./transport/lib/iframe-wrap')(require('./transport/eventsource')) // polling transports , require('./transport/htmlfile') , require('./transport/lib/iframe-wrap')(require('./transport/htmlfile')) , require('./transport/xhr-polling') , require('./transport/xdr-polling') , require('./transport/lib/iframe-wrap')(require('./transport/xhr-polling')) , require('./transport/jsonp-polling') ]; },{"./transport/eventsource":20,"./transport/htmlfile":21,"./transport/jsonp-polling":23,"./transport/lib/iframe-wrap":26,"./transport/websocket":38,"./transport/xdr-polling":39,"./transport/xdr-streaming":40,"./transport/xhr-polling":41,"./transport/xhr-streaming":42}],17:[function(require,module,exports){ (function (process,global){ 'use strict'; var EventEmitter = require('events').EventEmitter , inherits = require('inherits') , utils = require('../../utils/event') , urlUtils = require('../../utils/url') , XHR = global.XMLHttpRequest ; var debug = function() {}; if (process.env.NODE_ENV !== 'production') { debug = require('debug')('sockjs-client:browser:xhr'); } function AbstractXHRObject(method, url, payload, opts) { debug(method, url); var self = this; EventEmitter.call(this); setTimeout(function () { self._start(method, url, payload, opts); }, 0); } inherits(AbstractXHRObject, EventEmitter); AbstractXHRObject.prototype._start = function(method, url, payload, opts) { var self = this; try { this.xhr = new XHR(); } catch (x) {} if (!this.xhr) { debug('no xhr'); this.emit('finish', 0, 'no xhr support'); this._cleanup(); return; } // several browsers cache POSTs url = urlUtils.addQuery(url, 't=' + (+new Date())); // Explorer tends to keep connection open, even after the // tab gets closed: http://bugs.jquery.com/ticket/5280 this.unloadRef = utils.unloadAdd(function() { debug('unload cleanup'); self._cleanup(true); }); try { this.xhr.open(method, url, true); if (this.timeout && 'timeout' in this.xhr) { this.xhr.timeout = this.timeout; this.xhr.ontimeout = function() { debug('xhr timeout'); self.emit('finish', 0, ''); self._cleanup(false); }; } } catch (e) { debug('exception', e); // IE raises an exception on wrong port. this.emit('finish', 0, ''); this._cleanup(false); return; } if ((!opts || !opts.noCredentials) && AbstractXHRObject.supportsCORS) { debug('withCredentials'); // Mozilla docs says https://developer.mozilla.org/en/XMLHttpRequest : // "This never affects same-site requests." this.xhr.withCredentials = 'true'; } if (opts && opts.headers) { for (var key in opts.headers) { this.xhr.setRequestHeader(key, opts.headers[key]); } } this.xhr.onreadystatechange = function() { if (self.xhr) { var x = self.xhr; var text, status; debug('readyState', x.readyState); switch (x.readyState) { case 3: // IE doesn't like peeking into responseText or status // on Microsoft.XMLHTTP and readystate=3 try { status = x.status; text = x.responseText; } catch (e) {} debug('status', status); // IE returns 1223 for 204: http://bugs.jquery.com/ticket/1450 if (status === 1223) { status = 204; } // IE does return readystate == 3 for 404 answers. if (status === 200 && text && text.length > 0) { debug('chunk'); self.emit('chunk', status, text); } break; case 4: status = x.status; debug('status', status); // IE returns 1223 for 204: http://bugs.jquery.com/ticket/1450 if (status === 1223) { status = 204; } // IE returns this for a bad port // http://msdn.microsoft.com/en-us/library/windows/desktop/aa383770(v=vs.85).aspx if (status === 12005 || status === 12029) { status = 0; } debug('finish', status, x.responseText); self.emit('finish', status, x.responseText); self._cleanup(false); break; } } }; try { self.xhr.send(payload); } catch (e) { self.emit('finish', 0, ''); self._cleanup(false); } }; AbstractXHRObject.prototype._cleanup = function(abort) { debug('cleanup'); if (!this.xhr) { return; } this.removeAllListeners(); utils.unloadDel(this.unloadRef); // IE needs this field to be a function this.xhr.onreadystatechange = function() {}; if (this.xhr.ontimeout) { this.xhr.ontimeout = null; } if (abort) { try { this.xhr.abort(); } catch (x) {} } this.unloadRef = this.xhr = null; }; AbstractXHRObject.prototype.close = function() { debug('close'); this._cleanup(true); }; AbstractXHRObject.enabled = !!XHR; // override XMLHttpRequest for IE6/7 // obfuscate to avoid firewalls var axo = ['Active'].concat('Object').join('X'); if (!AbstractXHRObject.enabled && (axo in global)) { debug('overriding xmlhttprequest'); XHR = function() { try { return new global[axo]('Microsoft.XMLHTTP'); } catch (e) { return null; } }; AbstractXHRObject.enabled = !!new XHR(); } var cors = false; try { cors = 'withCredentials' in new XHR(); } catch (ignored) {} AbstractXHRObject.supportsCORS = cors; module.exports = AbstractXHRObject; }).call(this,{ env: {} },typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) //# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImxpYi90cmFuc3BvcnQvYnJvd3Nlci9hYnN0cmFjdC14aHIuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFD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,module,exports){ (function (global){ module.exports = global.EventSource; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) //# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImxpYi90cmFuc3BvcnQvYnJvd3Nlci9ldmVudHNvdXJjZS5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUE7QUFDQSIsImZpbGUiOiJnZW5lcmF0ZWQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlc0NvbnRlbnQiOlsibW9kdWxlLmV4cG9ydHMgPSBnbG9iYWwuRXZlbnRTb3VyY2U7XG4iXX0= },{}],19:[function(require,module,exports){ (function (global){ module.exports = global.WebSocket || global.MozWebSocket; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) //# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImxpYi90cmFuc3BvcnQvYnJvd3Nlci93ZWJzb2NrZXQuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBO0FBQ0EiLCJmaWxlIjoiZ2VuZXJhdGVkLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXNDb250ZW50IjpbIm1vZHVsZS5leHBvcnRzID0gZ2xvYmFsLldlYlNvY2tldCB8fCBnbG9iYWwuTW96V2ViU29ja2V0O1xuIl19 },{}],20:[function(require,module,exports){ 'use strict'; var inherits = require('inherits') , AjaxBasedTransport = require('./lib/ajax-based') , EventSourceReceiver = require('./receiver/eventsource') , XHRCorsObject = require('./sender/xhr-cors') , EventSourceDriver = require('eventsource') ; function EventSourceTransport(transUrl) { if (!EventSourceTransport.enabled()) { throw new Error('Transport created when disabled'); } AjaxBasedTransport.call(this, transUrl, '/eventsource', EventSourceReceiver, XHRCorsObject); } inherits(EventSourceTransport, AjaxBasedTransport); EventSourceTransport.enabled = function() { return !!EventSourceDriver; }; EventSourceTransport.transportName = 'eventsource'; EventSourceTransport.roundTrips = 2; module.exports = EventSourceTransport; },{"./lib/ajax-based":24,"./receiver/eventsource":29,"./sender/xhr-cors":35,"eventsource":18,"inherits":57}],21:[function(require,module,exports){ 'use strict'; var inherits = require('inherits') , HtmlfileReceiver = require('./receiver/htmlfile') , XHRLocalObject = require('./sender/xhr-local') , AjaxBasedTransport = require('./lib/ajax-based') ; function HtmlFileTransport(transUrl) { if (!HtmlfileReceiver.enabled) { throw new Error('Transport created when disabled'); } AjaxBasedTransport.call(this, transUrl, '/htmlfile', HtmlfileReceiver, XHRLocalObject); } inherits(HtmlFileTransport, AjaxBasedTransport); HtmlFileTransport.enabled = function(info) { return HtmlfileReceiver.enabled && info.sameOrigin; }; HtmlFileTransport.transportName = 'htmlfile'; HtmlFileTransport.roundTrips = 2; module.exports = HtmlFileTransport; },{"./lib/ajax-based":24,"./receiver/htmlfile":30,"./sender/xhr-local":37,"inherits":57}],22:[function(require,module,exports){ (function (process){ 'use strict'; // Few cool transports do work only for same-origin. In order to make // them work cross-domain we shall use iframe, served from the // remote domain. New browsers have capabilities to communicate with // cross domain iframe using postMessage(). In IE it was implemented // from IE 8+, but of course, IE got some details wrong: // http://msdn.microsoft.com/en-us/library/cc197015(v=VS.85).aspx // http://stevesouders.com/misc/test-postmessage.php var inherits = require('inherits') , JSON3 = require('json3') , EventEmitter = require('events').EventEmitter , version = require('../version') , urlUtils = require('../utils/url') , iframeUtils = require('../utils/iframe') , eventUtils = require('../utils/event') , random = require('../utils/random') ; var debug = function() {}; if (process.env.NODE_ENV !== 'production') { debug = require('debug')('sockjs-client:transport:iframe'); } function IframeTransport(transport, transUrl, baseUrl) { if (!IframeTransport.enabled()) { throw new Error('Transport created when disabled'); } EventEmitter.call(this); var self = this; this.origin = urlUtils.getOrigin(baseUrl); this.baseUrl = baseUrl; this.transUrl = transUrl; this.transport = transport; this.windowId = random.string(8); var iframeUrl = urlUtils.addPath(baseUrl, '/iframe.html') + '#' + this.windowId; debug(transport, transUrl, iframeUrl); this.iframeObj = iframeUtils.createIframe(iframeUrl, function(r) { debug('err callback'); self.emit('close', 1006, 'Unable to load an iframe (' + r + ')'); self.close(); }); this.onmessageCallback = this._message.bind(this); eventUtils.attachEvent('message', this.onmessageCallback); } inherits(IframeTransport, EventEmitter); IframeTransport.prototype.close = function() { debug('close'); this.removeAllListeners(); if (this.iframeObj) { eventUtils.detachEvent('message', this.onmessageCallback); try { // When the iframe is not loaded, IE raises an exception // on 'contentWindow'. this.postMessage('c'); } catch (x) {} this.iframeObj.cleanup(); this.iframeObj = null; this.onmessageCallback = this.iframeObj = null; } }; IframeTransport.prototype._message = function(e) { debug('message', e.data); if (!urlUtils.isOriginEqual(e.origin, this.origin)) { debug('not same origin', e.origin, this.origin); return; } var iframeMessage; try { iframeMessage = JSON3.parse(e.data); } catch (ignored) { debug('bad json', e.data); return; } if (iframeMessage.windowId !== this.windowId) { debug('mismatched window id', iframeMessage.windowId, this.windowId); return; } switch (iframeMessage.type) { case 's': this.iframeObj.loaded(); // window global dependency this.postMessage('s', JSON3.stringify([ version , this.transport , this.transUrl , this.baseUrl ])); break; case 't': this.emit('message', iframeMessage.data); break; case 'c': var cdata; try { cdata = JSON3.parse(iframeMessage.data); } catch (ignored) { debug('bad json', iframeMessage.data); return; } this.emit('close', cdata[0], cdata[1]); this.close(); break; } }; IframeTransport.prototype.postMessage = function(type, data) { debug('postMessage', type, data); this.iframeObj.post(JSON3.stringify({ windowId: this.windowId , type: type , data: data || '' }), this.origin); }; IframeTransport.prototype.send = function(message) { debug('send', message); this.postMessage('m', message); }; IframeTransport.enabled = function() { return iframeUtils.iframeEnabled; }; IframeTransport.transportName = 'iframe'; IframeTransport.roundTrips = 2; module.exports = IframeTransport; }).call(this,{ env: {} }) //# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImxpYi90cmFuc3BvcnQvaWZyYW1lLmpzI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"../version":53,"debug":54,"events":3,"inherits":57,"json3":58}],23:[function(require,module,exports){ (function (global){ 'use strict'; // The simplest and most robust transport, using the well-know cross // domain hack - JSONP. This transport is quite inefficient - one // message could use up to one http request. But at least it works almost // everywhere. // Known limitations: // o you will get a spinning cursor // o for Konqueror a dumb timer is needed to detect errors var inherits = require('inherits') , SenderReceiver = require('./lib/sender-receiver') , JsonpReceiver = require('./receiver/jsonp') , jsonpSender = require('./sender/jsonp') ; function JsonPTransport(transUrl) { if (!JsonPTransport.enabled()) { throw new Error('Transport created when disabled'); } SenderReceiver.call(this, transUrl, '/jsonp', jsonpSender, JsonpReceiver); } inherits(JsonPTransport, SenderReceiver); JsonPTransport.enabled = function() { return !!global.document; }; JsonPTransport.transportName = 'jsonp-polling'; JsonPTransport.roundTrips = 1; JsonPTransport.needBody = true; module.exports = JsonPTransport; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) //# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImxpYi90cmFuc3BvcnQvanNvbnAtcG9sbGluZy5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSIsImZpbGUiOiJnZW5lcmF0ZWQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBzdHJpY3QnO1xuXG4vLyBUaGUgc2ltcGxlc3QgYW5kIG1vc3Qgcm9idXN0IHRyYW5zcG9ydCwg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iAgcmV0dXJuICEhZ2xvYmFsLmRvY3VtZW50O1xufTtcblxuSnNvblBUcmFuc3BvcnQudHJhbnNwb3J0TmFtZSA9ICdqc29ucC1wb2xsaW5nJztcbkpzb25QVHJhbnNwb3J0LnJvdW5kVHJpcHMgPSAxO1xuSnNvblBUcmFuc3BvcnQubmVlZEJvZHkgPSB0cnVlO1xuXG5tb2R1bGUuZXhwb3J0cyA9IEpzb25QVHJhbnNwb3J0O1xuIl19 },{"./lib/sender-receiver":28,"./receiver/jsonp":31,"./sender/jsonp":33,"inherits":57}],24:[function(require,module,exports){ (function (process){ 'use strict'; var inherits = require('inherits') , urlUtils = require('../../utils/url') , SenderReceiver = require('./sender-receiver') ; var debug = function() {}; if (process.env.NODE_ENV !== 'production') { debug = require('debug')('sockjs-client:ajax-based'); } function createAjaxSender(AjaxObject) { return function(url, payload, callback) { debug('create ajax sender', url, payload); var opt = {}; if (typeof payload === 'string') { opt.headers = {'Content-type':'text/plain'}; } var ajaxUrl = urlUtils.addPath(url, '/xhr_send'); var xo = new AjaxObject('POST', ajaxUrl, payload, opt); xo.once('finish', function(status) { debug('finish', status); xo = null; if (status !== 200 && status !== 204) { return callback(new Error('http status ' + status)); } callback(); }); return function() { debug('abort'); xo.close(); xo = null; var err = new Error('Aborted'); err.code = 1000; callback(err); }; }; } function AjaxBasedTransport(transUrl, urlSuffix, Receiver, AjaxObject) { SenderReceiver.call(this, transUrl, urlSuffix, createAjaxSender(AjaxObject), Receiver, AjaxObject); } inherits(AjaxBasedTransport, SenderReceiver); module.exports = AjaxBasedTransport; }).call(this,{ env: {} }) //# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImxpYi90cmFuc3BvcnQvbGliL2FqYXgtYmFzZWQuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO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uIl19 },{"../../utils/url":52,"./sender-receiver":28,"debug":54,"inherits":57}],25:[function(require,module,exports){ (function (process){ 'use strict'; var inherits = require('inherits') , EventEmitter = require('events').EventEmitter ; var debug = function() {}; if (process.env.NODE_ENV !== 'production') { debug = require('debug')('sockjs-client:buffered-sender'); } function BufferedSender(url, sender) { debug(url); EventEmitter.call(this); this.sendBuffer = []; this.sender = sender; this.url = url; } inherits(BufferedSender, EventEmitter); BufferedSender.prototype.send = function(message) { debug('send', message); this.sendBuffer.push(message); if (!this.sendStop) { this.sendSchedule(); } }; // For polling transports in a situation when in the message callback, // new message is being send. If the sending connection was started // before receiving one, it is possible to saturate the network and // timeout due to the lack of receiving socket. To avoid that we delay // sending messages by some small time, in order to let receiving // connection be started beforehand. This is only a halfmeasure and // does not fix the big problem, but it does make the tests go more // stable on slow networks. BufferedSender.prototype.sendScheduleWait = function() { debug('sendScheduleWait'); var self = this; var tref; this.sendStop = function() { debug('sendStop'); self.sendStop = null; clearTimeout(tref); }; tref = setTimeout(function() { debug('timeout'); self.sendStop = null; self.sendSchedule(); }, 25); }; BufferedSender.prototype.sendSchedule = function() { debug('sendSchedule', this.sendBuffer.length); var self = this; if (this.sendBuffer.length > 0) { var payload = '[' + this.sendBuffer.join(',') + ']'; this.sendStop = this.sender(this.url, payload, function(err) { self.sendStop = null; if (err) { debug('error', err); self.emit('close', err.code || 1006, 'Sending error: ' + err); self._cleanup(); } else { self.sendScheduleWait(); } }); this.sendBuffer = []; } }; BufferedSender.prototype._cleanup = function() { debug('_cleanup'); this.removeAllListeners(); }; BufferedSender.prototype.stop = function() { debug('stop'); this._cleanup(); if (this.sendStop) { this.sendStop(); this.sendStop = null; } }; module.exports = BufferedSender; }).call(this,{ env: {} }) //# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImxpYi90cmFuc3BvcnQvbGliL2J1ZmZlcmVkLXNlbmRlci5qcyJdLCJuYW1lcyI6W10sIm1hcHB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YnVnKCdlcnJvcicsIGVycik7XG4gICAgICAgIHNlbGYuZW1pdCgnY2xvc2UnLCBlcnIuY29kZSB8fCAxMDA2LCAnU2VuZGluZyBlcnJvcjogJyArIGVycik7XG4gICAgICAgIHNlbGYuX2NsZWFudXAoKTtcbiAgICAgIH0gZWxzZSB7XG4gICAgICAgIHNlbGYuc2VuZFNjaGVkdWxlV2FpdCgpO1xuICAgICAgfVxuICAgIH0pO1xuICAgIHRoaXMuc2VuZEJ1ZmZlciA9IFtdO1xuICB9XG59O1xuXG5CdWZmZXJlZFNlbmRlci5wcm90b3R5cGUuX2NsZWFudXAgPSBmdW5jdGlvbigpIHtcbiAgZGVidWcoJ19jbGVhbnVwJyk7XG4gIHRoaXMucmVtb3ZlQWxsTGlzdGVuZXJzKCk7XG59O1xuXG5CdWZmZXJlZFNlbmRlci5wcm90b3R5cGUuc3RvcCA9IGZ1bmN0aW9uKCkge1xuICBkZWJ1Zygnc3RvcCcpO1xuICB0aGlzLl9jbGVhbnVwKCk7XG4gIGlmICh0aGlzLnNlbmRTdG9wKSB7XG4gICAgdGhpcy5zZW5kU3RvcCgpO1xuICAgIHRoaXMuc2VuZFN0b3AgPSBudWxsO1xuICB9XG59O1xuXG5tb2R1bGUuZXhwb3J0cyA9IEJ1ZmZlcmVkU2VuZGVyO1xuIl19 },{"debug":54,"events":3,"inherits":57}],26:[function(require,module,exports){ (function (global){ 'use strict'; var inherits = require('inherits') , IframeTransport = require('../iframe') , objectUtils = require('../../utils/object') ; module.exports = function(transport) { function IframeWrapTransport(transUrl, baseUrl) { IframeTransport.call(this, transport.transportName, transUrl, baseUrl); } inherits(IframeWrapTransport, IframeTransport); IframeWrapTransport.enabled = function(url, info) { if (!global.document) { return false; } var iframeInfo = objectUtils.extend({}, info); iframeInfo.sameOrigin = true; return transport.enabled(iframeInfo) && IframeTransport.enabled(); }; IframeWrapTransport.transportName = 'iframe-' + transport.transportName; IframeWrapTransport.needBody = true; IframeWrapTransport.roundTrips = IframeTransport.roundTrips + transport.roundTrips - 1; // html, javascript (2) + transport - no CORS (1) IframeWrapTransport.facadeTransport = transport; return IframeWrapTransport; }; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) //# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImxpYi90cmFuc3BvcnQvbGliL2lmcmFtZS13cmFwLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSIsImZpbGUiOiJnZW5lcmF0ZWQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBzdHJpY3QnO1xuXG52YXIgaW5oZXJpdHMgPSByZXF1aXJlKCdpbmhlcml0cycpXG4gICwgSWZyYW1lVHJhbnNwb3J0ID0gcmVxdWlyZSgnLi4vaWZyYW1lJylcbiAgLCBvYmplY3RVdGlscyA9IHJlcXVpcmUoJy4uLy4uL3V0aWxzL29iamVjdCcpXG4gIDtcblxubW9kdWxlLmV4cG9ydHMgPSBmdW5jdGlvbih0cmFuc3BvcnQpIHtcblxuICBmdW5jdGlvbiBJZnJhbWVXcmFwVHJhbnNwb3J0KHRyYW5zVXJsLCBiYXNlVXJsKSB7XG4gICAgSWZyYW1lVHJhbnNwb3J0LmNhbGwodGhpcywgdHJhbnNwb3J0LnRyYW5zcG9ydE5hbWUsIHRyYW5zVXJsLCBiYXNlVXJsKTtcbiAgfVxuXG4gIGluaGVyaXRzKElmcmFtZVdyYXBUcmFuc3BvcnQsIElmcmFtZVRyYW5zcG9ydCk7XG5cbiAgSWZyYW1lV3JhcFRyYW5zcG9ydC5lbmFibGVkID0gZnVuY3Rpb24odXJsLCBpbmZvKSB7XG4gICAgaWYgKCFnbG9iYWwuZG9jdW1lbnQpIHtcbiAgICAgIHJldHVybiBmYWxzZTtcbiAgICB9XG5cbiAgICB2YXIgaWZyYW1lSW5mbyA9IG9iamVjdFV0aWxzLmV4dGVuZCh7fSwgaW5mbyk7XG4gICAgaWZyYW1lSW5mby5zYW1lT3JpZ2luID0gdHJ1ZTtcbiAgICByZXR1cm4gdHJhbnNwb3J0LmVuYWJsZWQoaWZyYW1lSW5mbykgJiYgSWZyYW1lVHJhbnNwb3J0LmVuYWJsZWQoKTtcbiAgfTtcblxuICBJZnJhbWVXcmFwVHJhbnNwb3J0LnRyYW5zcG9ydE5hbWUgPSAnaWZyYW1lLScgKyB0cmFuc3BvcnQudHJhbnNwb3J0TmFtZTtcbiAgSWZyYW1lV3JhcFRyYW5zcG9ydC5uZWVkQm9keSA9IHRydWU7XG4gIElmcmFtZVdyYXBUcmFuc3BvcnQucm91bmRUcmlwcyA9IElmcmFtZVRyYW5zcG9ydC5yb3VuZFRyaXBzICsgdHJhbnNwb3J0LnJvdW5kVHJpcHMgLSAxOyAvLyBodG1sLCBqYXZhc2NyaXB0ICgyKSArIHRyYW5zcG9ydCAtIG5vIENPUlMgKDEpXG5cbiAgSWZyYW1lV3JhcFRyYW5zcG9ydC5mYWNhZGVUcmFuc3BvcnQgPSB0cmFuc3BvcnQ7XG5cbiAgcmV0dXJuIElmcmFtZVdyYXBUcmFuc3BvcnQ7XG59O1xuIl19 },{"../../utils/object":49,"../iframe":22,"inherits":57}],27:[function(require,module,exports){ (function (process){ 'use strict'; var inherits = require('inherits') , EventEmitter = require('events').EventEmitter ; var debug = function() {}; if (process.env.NODE_ENV !== 'production') { debug = require('debug')('sockjs-client:polling'); } function Polling(Receiver, receiveUrl, AjaxObject) { debug(receiveUrl); EventEmitter.call(this); this.Receiver = Receiver; this.receiveUrl = receiveUrl; this.AjaxObject = AjaxObject; this._scheduleReceiver(); } inherits(Polling, EventEmitter); Polling.prototype._scheduleReceiver = function() { debug('_scheduleReceiver'); var self = this; var poll = this.poll = new this.Receiver(this.receiveUrl, this.AjaxObject); poll.on('message', function(msg) { debug('message', msg); self.emit('message', msg); }); poll.once('close', function(code, reason) { debug('close', code, reason, self.pollIsClosing); self.poll = poll = null; if (!self.pollIsClosing) { if (reason === 'network') { self._scheduleReceiver(); } else { self.emit('close', code || 1006, reason); self.removeAllListeners(); } } }); }; Polling.prototype.abort = function() { debug('abort'); this.removeAllListeners(); this.pollIsClosing = true; if (this.poll) { this.poll.abort(); } }; module.exports = Polling; }).call(this,{ env: {} }) //# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImxpYi90cmFuc3BvcnQvbGliL3BvbGxpbmcuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBIiwiZmlsZSI6ImdlbmVyYXRlZC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzQ29udGVudCI6WyIndXNlIHN0cmljdCc7XG5c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nY2xvc2UnLCBmdW5jdGlvbihjb2RlLCByZWFzb24pIHtcbiAgICBkZWJ1ZygnY2xvc2UnLCBjb2RlLCByZWFzb24sIHNlbGYucG9sbElzQ2xvc2luZyk7XG4gICAgc2VsZi5wb2xsID0gcG9sbCA9IG51bGw7XG5cbiAgICBpZiAoIXNlbGYucG9sbElzQ2xvc2luZykge1xuICAgICAgaWYgKHJlYXNvbiA9PT0gJ25ldHdvcmsnKSB7XG4gICAgICAgIHNlbGYuX3NjaGVkdWxlUmVjZWl2ZXIoKTtcbiAgICAgIH0gZWxzZSB7XG4gICAgICAgIHNlbGYuZW1pdCgnY2xvc2UnLCBjb2RlIHx8IDEwMDYsIHJlYXNvbik7XG4gICAgICAgIHNlbGYucmVtb3ZlQWxsTGlzdGVuZXJzKCk7XG4gICAgICB9XG4gICAgfVxuICB9KTtcbn07XG5cblBvbGxpbmcucHJvdG90eXBlLmFib3J0ID0gZnVuY3Rpb24oKSB7XG4gIGRlYnVnKCdhYm9ydCcpO1xuICB0aGlzLnJlbW92ZUFsbExpc3RlbmVycygpO1xuICB0aGlzLnBvbGxJc0Nsb3NpbmcgPSB0cnVlO1xuICBpZiAodGhpcy5wb2xsKSB7XG4gICAgdGhpcy5wb2xsLmFib3J0KCk7XG4gIH1cbn07XG5cbm1vZHVsZS5leHBvcnRzID0gUG9sbGluZztcbiJdfQ== },{"debug":54,"events":3,"inherits":57}],28:[function(require,module,exports){ (function (process){ 'use strict'; var inherits = require('inherits') , urlUtils = require('../../utils/url') , BufferedSender = require('./buffered-sender') , Polling = require('./polling') ; var debug = function() {}; if (process.env.NODE_ENV !== 'production') { debug = require('debug')('sockjs-client:sender-receiver'); } function SenderReceiver(transUrl, urlSuffix, senderFunc, Receiver, AjaxObject) { var pollUrl = urlUtils.addPath(transUrl, urlSuffix); debug(pollUrl); var self = this; BufferedSender.call(this, transUrl, senderFunc); this.poll = new Polling(Receiver, pollUrl, AjaxObject); this.poll.on('message', function(msg) { debug('poll message', msg); self.emit('message', msg); }); this.poll.once('close', function(code, reason) { debug('poll close', code, reason); self.poll = null; self.emit('close', code, reason); self.close(); }); } inherits(SenderReceiver, BufferedSender); SenderReceiver.prototype.close = function() { debug('close'); this.removeAllListeners(); if (this.poll) { this.poll.abort(); this.poll = null; } this.stop(); }; module.exports = SenderReceiver; }).call(this,{ env: {} }) //# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImxpYi90cmFuc3BvcnQvbGliL3NlbmRlci1yZWNlaXZlci5qcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EiLCJmaWxlIjoiZ2VuZXJhdGVkLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXNDb250ZW50IjpbIid1c2Ugc3RyaWN0JztcblxudmFyIGluaGVyaXRzID0gcmVxdWlyZSgnaW5oZXJpdHMnKVxuICAsIHVybFV0aWxzID0gcmVxdWlyZSgnLi4vLi4vdXRpbHMvdXJsJylcbiAgLCBCdWZmZXJlZFNlbmRlciA9IHJlcXVpcmUoJy4vYnVmZmVyZWQtc2VuZGVyJylcbiAgLCBQb2xsaW5nID0gcmVxdWlyZSgnLi9wb2xsaW5nJylcbiAgO1xuXG52YXIgZGVidWcgPSBmdW5jdGlvbigpIHt9O1xuaWYgKHByb2Nlc3MuZW52Lk5PREVfRU5WICE9PSAnc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ZW5lcnMoKTtcbiAgaWYgKHRoaXMucG9sbCkge1xuICAgIHRoaXMucG9sbC5hYm9ydCgpO1xuICAgIHRoaXMucG9sbCA9IG51bGw7XG4gIH1cbiAgdGhpcy5zdG9wKCk7XG59O1xuXG5tb2R1bGUuZXhwb3J0cyA9IFNlbmRlclJlY2VpdmVyO1xuIl19 },{"../../utils/url":52,"./buffered-sender":25,"./polling":27,"debug":54,"inherits":57}],29:[function(require,module,exports){ (function (process){ 'use strict'; var inherits = require('inherits') , EventEmitter = require('events').EventEmitter , EventSourceDriver = require('eventsource') ; var debug = function() {}; if (process.env.NODE_ENV !== 'production') { debug = require('debug')('sockjs-client:receiver:eventsource'); } function EventSourceReceiver(url) { debug(url); EventEmitter.call(this); var self = this; var es = this.es = new EventSourceDriver(url); es.onmessage = function(e) { debug('message', e.data); self.emit('message', decodeURI(e.data)); }; es.onerror = function(e) { debug('error', es.readyState, e); // ES on reconnection has readyState = 0 or 1. // on network error it's CLOSED = 2 var reason = (es.readyState !== 2 ? 'network' : 'permanent'); self._cleanup(); self._close(reason); }; } inherits(EventSourceReceiver, EventEmitter); EventSourceReceiver.prototype.abort = function() { debug('abort'); this._cleanup(); this._close('user'); }; EventSourceReceiver.prototype._cleanup = function() { debug('cleanup'); var es = this.es; if (es) { es.onmessage = es.onerror = null; es.close(); this.es = null; } }; EventSourceReceiver.prototype._close = function(reason) { debug('close', reason); var self = this; // Safari and chrome < 15 crash if we close window before // waiting for ES cleanup. See: // https://code.google.com/p/chromium/issues/detail?id=89155 setTimeout(function() { self.emit('close', null, reason); self.removeAllListeners(); }, 200); }; module.exports = EventSourceReceiver; }).call(this,{ env: {} }) //# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImxpYi90cmFuc3BvcnQvcmVjZWl2ZXIvZXZlbnRzb3VyY2UuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBO0FBQ0E7QUFDQTtBQUNBO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FNvdXJjZVJlY2VpdmVyLnByb3RvdHlwZS5fY2xvc2UgPSBmdW5jdGlvbihyZWFzb24pIHtcbiAgZGVidWcoJ2Nsb3NlJywgcmVhc29uKTtcbiAgdmFyIHNlbGYgPSB0aGlzO1xuICAvLyBTYWZhcmkgYW5kIGNocm9tZSA8IDE1IGNyYXNoIGlmIHdlIGNsb3NlIHdpbmRvdyBiZWZvcmVcbiAgLy8gd2FpdGluZyBmb3IgRVMgY2xlYW51cC4gU2VlOlxuICAvLyBodHRwczovL2NvZGUuZ29vZ2xlLmNvbS9wL2Nocm9taXVtL2lzc3Vlcy9kZXRhaWw/aWQ9ODkxNTVcbiAgc2V0VGltZW91dChmdW5jdGlvbigpIHtcbiAgICBzZWxmLmVtaXQoJ2Nsb3NlJywgbnVsbCwgcmVhc29uKTtcbiAgICBzZWxmLnJlbW92ZUFsbExpc3RlbmVycygpO1xuICB9LCAyMDApO1xufTtcblxubW9kdWxlLmV4cG9ydHMgPSBFdmVudFNvdXJjZVJlY2VpdmVyO1xuIl19 },{"debug":54,"events":3,"eventsource":18,"inherits":57}],30:[function(require,module,exports){ (function (process,global){ 'use strict'; var inherits = require('inherits') , iframeUtils = require('../../utils/iframe') , urlUtils = require('../../utils/url') , EventEmitter = require('events').EventEmitter , random = require('../../utils/random') ; var debug = function() {}; if (process.env.NODE_ENV !== 'production') { debug = require('debug')('sockjs-client:receiver:htmlfile'); } function HtmlfileReceiver(url) { debug(url); EventEmitter.call(this); var self = this; iframeUtils.polluteGlobalNamespace(); this.id = 'a' + random.string(6); url = urlUtils.addQuery(url, 'c=' + decodeURIComponent(iframeUtils.WPrefix + '.' + this.id)); debug('using htmlfile', HtmlfileReceiver.htmlfileEnabled); var constructFunc = HtmlfileReceiver.htmlfileEnabled ? iframeUtils.createHtmlfile : iframeUtils.createIframe; global[iframeUtils.WPrefix][this.id] = { start: function() { debug('start'); self.iframeObj.loaded(); } , message: function(data) { debug('message', data); self.emit('message', data); } , stop: function() { debug('stop'); self._cleanup(); self._close('network'); } }; this.iframeObj = constructFunc(url, function() { debug('callback'); self._cleanup(); self._close('permanent'); }); } inherits(HtmlfileReceiver, EventEmitter); HtmlfileReceiver.prototype.abort = function() { debug('abort'); this._cleanup(); this._close('user'); }; HtmlfileReceiver.prototype._cleanup = function() { debug('_cleanup'); if (this.iframeObj) { this.iframeObj.cleanup(); this.iframeObj = null; } delete global[iframeUtils.WPrefix][this.id]; }; HtmlfileReceiver.prototype._close = function(reason) { debug('_close', reason); this.emit('close', null, reason); this.removeAllListeners(); }; HtmlfileReceiver.htmlfileEnabled = false; // obfuscate to avoid firewalls var axo = ['Active'].concat('Object').join('X'); if (axo in global) { try { HtmlfileReceiver.htmlfileEnabled = !!new global[axo]('htmlfile'); } catch (x) {} } HtmlfileReceiver.enabled = HtmlfileReceiver.htmlfileEnabled || iframeUtils.iframeEnabled; module.exports = HtmlfileReceiver; }).call(this,{ env: {} },typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) //# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImxpYi90cmFuc3BvcnQvcmVjZWl2ZXIvaHRtbGZpbGUuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0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VjZWl2ZXIuaHRtbGZpbGVFbmFibGVkIHx8IGlmcmFtZVV0aWxzLmlmcmFtZUVuYWJsZWQ7XG5cbm1vZHVsZS5leHBvcnRzID0gSHRtbGZpbGVSZWNlaXZlcjtcbiJdfQ== },{"../../utils/iframe":47,"../../utils/random":50,"../../utils/url":52,"debug":54,"events":3,"inherits":57}],31:[function(require,module,exports){ (function (process,global){ 'use strict'; var utils = require('../../utils/iframe') , random = require('../../utils/random') , browser = require('../../utils/browser') , urlUtils = require('../../utils/url') , inherits = require('inherits') , EventEmitter = require('events').EventEmitter ; var debug = function() {}; if (process.env.NODE_ENV !== 'production') { debug = require('debug')('sockjs-client:receiver:jsonp'); } function JsonpReceiver(url) { debug(url); var self = this; EventEmitter.call(this); utils.polluteGlobalNamespace(); this.id = 'a' + random.string(6); var urlWithId = urlUtils.addQuery(url, 'c=' + encodeURIComponent(utils.WPrefix + '.' + this.id)); global[utils.WPrefix][this.id] = this._callback.bind(this); this._createScript(urlWithId); // Fallback mostly for Konqueror - stupid timer, 35 seconds shall be plenty. this.timeoutId = setTimeout(function() { debug('timeout'); self._abort(new Error('JSONP script loaded abnormally (timeout)')); }, JsonpReceiver.timeout); } inherits(JsonpReceiver, EventEmitter); JsonpReceiver.prototype.abort = function() { debug('abort'); if (global[utils.WPrefix][this.id]) { var err = new Error('JSONP user aborted read'); err.code = 1000; this._abort(err); } }; JsonpReceiver.timeout = 35000; JsonpReceiver.scriptErrorTimeout = 1000; JsonpReceiver.prototype._callback = function(data) { debug('_callback', data); this._cleanup(); if (this.aborting) { return; } if (data) { debug('message', data); this.emit('message', data); } this.emit('close', null, 'network'); this.removeAllListeners(); }; JsonpReceiver.prototype._abort = function(err) { debug('_abort', err); this._cleanup(); this.aborting = true; this.emit('close', err.code, err.message); this.removeAllListeners(); }; JsonpReceiver.prototype._cleanup = function() { debug('_cleanup'); clearTimeout(this.timeoutId); if (this.script2) { this.script2.parentNode.removeChild(this.script2); this.script2 = null; } if (this.script) { var script = this.script; // Unfortunately, you can't really abort script loading of // the script. script.parentNode.removeChild(script); script.onreadystatechange = script.onerror = script.onload = script.onclick = null; this.script = null; } delete global[utils.WPrefix][this.id]; }; JsonpReceiver.prototype._scriptError = function() { debug('_scriptError'); var self = this; if (this.errorTimer) { return; } this.errorTimer = setTimeout(function() { if (!self.loadedOkay) { self._abort(new Error('JSONP script loaded abnormally (onerror)')); } }, JsonpReceiver.scriptErrorTimeout); }; JsonpReceiver.prototype._createScript = function(url) { debug('_createScript', url); var self = this; var script = this.script = global.document.createElement('script'); var script2; // Opera synchronous load trick. script.id = 'a' + random.string(8); script.src = url; script.type = 'text/javascript'; script.charset = 'UTF-8'; script.onerror = this._scriptError.bind(this); script.onload = function() { debug('onload'); self._abort(new Error('JSONP script loaded abnormally (onload)')); }; // IE9 fires 'error' event after onreadystatechange or before, in random order. // Use loadedOkay to determine if actually errored script.onreadystatechange = function() { debug('onreadystatechange', script.readyState); if (/loaded|closed/.test(script.readyState)) { if (script && script.htmlFor && script.onclick) { self.loadedOkay = true; try { // In IE, actually execute the script. script.onclick(); } catch (x) {} } if (script) { self._abort(new Error('JSONP script loaded abnormally (onreadystatechange)')); } } }; // IE: event/htmlFor/onclick trick. // One can't rely on proper order for onreadystatechange. In order to // make sure, set a 'htmlFor' and 'event' properties, so that // script code will be installed as 'onclick' handler for the // script object. Later, onreadystatechange, manually execute this // code. FF and Chrome doesn't work with 'event' and 'htmlFor' // set. For reference see: // http://jaubourg.net/2010/07/loading-script-as-onclick-handler-of.html // Also, read on that about script ordering: // http://wiki.whatwg.org/wiki/Dynamic_Script_Execution_Order if (typeof script.async === 'undefined' && global.document.attachEvent) { // According to mozilla docs, in recent browsers script.async defaults // to 'true', so we may use it to detect a good browser: // https://developer.mozilla.org/en/HTML/Element/script if (!browser.isOpera()) { // Naively assume we're in IE try { script.htmlFor = script.id; script.event = 'onclick'; } catch (x) {} script.async = true; } else { // Opera, second sync script hack script2 = this.script2 = global.document.createElement('script'); script2.text = "try{var a = document.getElementById('" + script.id + "'); if(a)a.onerror();}catch(x){};"; script.async = script2.async = false; } } if (typeof script.async !== 'undefined') { script.async = true; } var head = global.document.getElementsByTagName('head')[0]; head.insertBefore(script, head.firstChild); if (script2) { head.insertBefore(script2, head.firstChild); } }; module.exports = JsonpReceiver; }).call(this,{ env: {} },typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) //# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImxpYi90cmFuc3BvcnQvcmVjZWl2ZXIvanNvbnAuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO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hhY2tcbiAgICAgIHNjcmlwdDIgPSB0aGlzLnNjcmlwdDIgPSBnbG9iYWwuZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgnc2NyaXB0Jyk7XG4gICAgICBzY3JpcHQyLnRleHQgPSBcInRyeXt2YXIgYSA9IGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCdcIiArIHNjcmlwdC5pZCArIFwiJyk7IGlmKGEpYS5vbmVycm9yKCk7fWNhdGNoKHgpe307XCI7XG4gICAgICBzY3JpcHQuYXN5bmMgPSBzY3JpcHQyLmFzeW5jID0gZmFsc2U7XG4gICAgfVxuICB9XG4gIGlmICh0eXBlb2Ygc2NyaXB0LmFzeW5jICE9PSAndW5kZWZpbmVkJykge1xuICAgIHNjcmlwdC5hc3luYyA9IHRydWU7XG4gIH1cblxuICB2YXIgaGVhZCA9IGdsb2JhbC5kb2N1bWVudC5nZXRFbGVtZW50c0J5VGFnTmFtZSgnaGVhZCcpWzBdO1xuICBoZWFkLmluc2VydEJlZm9yZShzY3JpcHQsIGhlYWQuZmlyc3RDaGlsZCk7XG4gIGlmIChzY3JpcHQyKSB7XG4gICAgaGVhZC5pbnNlcnRCZWZvcmUoc2NyaXB0MiwgaGVhZC5maXJzdENoaWxkKTtcbiAgfVxufTtcblxubW9kdWxlLmV4cG9ydHMgPSBKc29ucFJlY2VpdmVyO1xuIl19 },{"../../utils/browser":44,"../../utils/iframe":47,"../../utils/random":50,"../../utils/url":52,"debug":54,"events":3,"inherits":57}],32:[function(require,module,exports){ (function (process){ 'use strict'; var inherits = require('inherits') , EventEmitter = require('events').EventEmitter ; var debug = function() {}; if (process.env.NODE_ENV !== 'production') { debug = require('debug')('sockjs-client:receiver:xhr'); } function XhrReceiver(url, AjaxObject) { debug(url); EventEmitter.call(this); var self = this; this.bufferPosition = 0; this.xo = new AjaxObject('POST', url, null); this.xo.on('chunk', this._chunkHandler.bind(this)); this.xo.once('finish', function(status, text) { debug('finish', status, text); self._chunkHandler(status, text); self.xo = null; var reason = status === 200 ? 'network' : 'permanent'; debug('close', reason); self.emit('close', null, reason); self._cleanup(); }); } inherits(XhrReceiver, EventEmitter); XhrReceiver.prototype._chunkHandler = function(status, text) { debug('_chunkHandler', status); if (status !== 200 || !text) { return; } for (var idx = -1; ; this.bufferPosition += idx + 1) { var buf = text.slice(this.bufferPosition); idx = buf.indexOf('\n'); if (idx === -1) { break; } var msg = buf.slice(0, idx); if (msg) { debug('message', msg); this.emit('message', msg); } } }; XhrReceiver.prototype._cleanup = function() { debug('_cleanup'); this.removeAllListeners(); }; XhrReceiver.prototype.abort = function() { debug('abort'); if (this.xo) { this.xo.close(); debug('close'); this.emit('close', null, 'user'); this.xo = null; } this._cleanup(); }; module.exports = XhrReceiver; }).call(this,{ env: {} }) //# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImxpYi90cmFuc3BvcnQvcmVjZWl2ZXIveGhyLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBIiwi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GlzLnhvID0gbnVsbDtcbiAgfVxuICB0aGlzLl9jbGVhbnVwKCk7XG59O1xuXG5tb2R1bGUuZXhwb3J0cyA9IFhoclJlY2VpdmVyO1xuIl19 },{"debug":54,"events":3,"inherits":57}],33:[function(require,module,exports){ (function (process,global){ 'use strict'; var random = require('../../utils/random') , urlUtils = require('../../utils/url') ; var debug = function() {}; if (process.env.NODE_ENV !== 'production') { debug = require('debug')('sockjs-client:sender:jsonp'); } var form, area; function createIframe(id) { debug('createIframe', id); try { // ie6 dynamic iframes with target="" support (thanks Chris Lambacher) return global.document.createElement('