{“ast”:null,“code”:“function _typeof2(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof2 = function _typeof2(obj) { return typeof obj; }; } else { _typeof2 = function _typeof2(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof2(obj); }nn/* sockjs-client v1.3.0 | sockjs.org | MIT license */n(function (f) {n if ((typeof exports === "undefined" ? "undefined" : _typeof2(exports)) === "object" && typeof module !== "undefined") {n module.exports = f();n } else if (typeof define === "function" && define.amd) {n define([], f);n } else {n var g;nn if (typeof window !== "undefined") {n g = window;n } else if (typeof global !== "undefined") {n g = global;n } else if (typeof self !== "undefined") {n g = self;n } else {n g = this;n }nn g.SockJS = f();n }n})(function () {n var define, module, exports;n return function () {n function r(e, n, t) {n function o(i, f) {n if (!n) {n if (!e) {n var c = "function" == typeof require && require;n if (!f && c) return c(i, !0);n if (u) return u(i, !0);n var a = new Error("Cannot find module '" + i + "'");n throw a.code = "MODULE_NOT_FOUND", a;n }nn var p = n = {n exports: {}n };n e[0].call(p.exports, function ® {n var n = e[1];n return o(n || r);n }, p, p.exports, r, e, n, t);n }nn return n.exports;n }nn for (var u = "function" == typeof require && require, i = 0; i < t.length; i++) {n o(t);n }nn return o;n }nn return r;n }()({n 1: [function (require, module, exports) {n (function (global) {n 'use strict';nn var transportList = require('./transport-list');nn module.exports = require('./main')(transportList); // TODO can't get rid of this until all servers donn if ('_sockjs_onload' in global) {n setTimeout(global._sockjs_onload, 1);n }n }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});n }, {n "./main": 14,n "./transport-list": 16n }],n 2: [function (require, module, exports) {n 'use strict';nn var inherits = require('inherits'),n Event = require('./event');nn function CloseEvent() {n Event.call(this);n this.initEvent('close', false, false);n this.wasClean = false;n this.code = 0;n this.reason = '';n }nn inherits(CloseEvent, Event);n module.exports = CloseEvent;n }, {n "./event": 4,n "inherits": 57n }],n 3: [function (require, module, exports) {n 'use strict';nn var inherits = require('inherits'),n EventTarget = require('./eventtarget');nn function EventEmitter() {n EventTarget.call(this);n }nn inherits(EventEmitter, EventTarget);nn EventEmitter.prototype.removeAllListeners = function (type) {n if (type) {n delete this._listeners;n } else {n this._listeners = {};n }n };nn EventEmitter.prototype.once = function (type, listener) {n var self = this,n fired = false;nn function g() {n self.removeListener(type, g);nn if (!fired) {n fired = true;n listener.apply(this, arguments);n }n }nn this.on(type, g);n };nn EventEmitter.prototype.emit = function () {n var type = arguments;n var listeners = this._listeners;nn if (!listeners) {n return;n } // equivalent of Array.prototype.slice.call(arguments, 1);nnn var l = arguments.length;n var args = new Array(l - 1);nn for (var ai = 1; ai < l; ai++) {n args[ai - 1] = arguments;n }nn for (var i = 0; i < listeners.length; i++) {n listeners.apply(this, args);n }n };nn EventEmitter.prototype.on = EventEmitter.prototype.addListener = EventTarget.prototype.addEventListener;n EventEmitter.prototype.removeListener = EventTarget.prototype.removeEventListener;n module.exports.EventEmitter = EventEmitter;n }, {n "./eventtarget": 5,n "inherits": 57n }],n 4: [function (require, module, exports) {n 'use strict';nn function Event(eventType) {n this.type = eventType;n }nn Event.prototype.initEvent = function (eventType, canBubble, cancelable) {n this.type = eventType;n this.bubbles = canBubble;n this.cancelable = cancelable;n this.timeStamp = +new Date();n return this;n };nn Event.prototype.stopPropagation = function () {};nn Event.prototype.preventDefault = function () {};nn Event.CAPTURING_PHASE = 1;n Event.AT_TARGET = 2;n Event.BUBBLING_PHASE = 3;n module.exports = Event;n }, {}],n 5: [function (require, module, exports) {n 'use strict';n /* Simplified implementation of DOM2 EventTarget.n * www.w3.org/TR/DOM-Level-2-Events/events.html#Events-EventTargetn */nn function EventTarget() {n this._listeners = {};n }nn EventTarget.prototype.addEventListener = function (eventType, listener) {n if (!(eventType in this._listeners)) {n this._listeners = [];n }nn var arr = this._listeners; // #4nn if (arr.indexOf(listener) === -1) {n // Make a copy so as not to interfere with a current dispatchEvent.n arr = arr.concat();n }nn this._listeners = arr;n };nn EventTarget.prototype.removeEventListener = function (eventType, listener) {n var arr = this._listeners;nn if (!arr) {n return;n }nn var idx = arr.indexOf(listener);nn if (idx !== -1) {n if (arr.length > 1) {n // Make a copy so as not to interfere with a current dispatchEvent.n this._listeners = arr.slice(0, idx).concat(arr.slice(idx + 1));n } else {n delete this._listeners;n }nn return;n }n };nn EventTarget.prototype.dispatchEvent = function () {n var event = arguments;n var t = event.type; // equivalent of Array.prototype.slice.call(arguments, 0);nn var args = arguments.length === 1 ? [event] : Array.apply(null, arguments); // TODO: This doesn't match the real behavior; per spec, onfoo getn // their place in line from the /first/ time they're set fromn // non-null. Although WebKit bumps it to the end every time it'sn // set.nn if (this['on' + t]) {n this['on' + t].apply(this, args);n }nn if (t in this._listeners) {n // Grab a reference to the listeners list. removeEventListener may alter the list.n var listeners = this._listeners;nn for (var i = 0; i < listeners.length; i++) {n listeners.apply(this, args);n }n }n };nn module.exports = EventTarget;n }, {}],n 6: [function (require, module, exports) {n 'use strict';nn var inherits = require('inherits'),n Event = require('./event');nn function TransportMessageEvent(data) {n Event.call(this);n this.initEvent('message', false, false);n this.data = data;n }nn inherits(TransportMessageEvent, Event);n module.exports = TransportMessageEvent;n }, {n "./event": 4,n "inherits": 57n }],n 7: [function (require, module, exports) {n 'use strict';nn var JSON3 = require('json3'),n iframeUtils = require('./utils/iframe');nn function FacadeJS(transport) {n this._transport = transport;n transport.on('message', this._transportMessage.bind(this));n transport.on('close', this._transportClose.bind(this));n }nn FacadeJS.prototype._transportClose = function (code, reason) {n iframeUtils.postMessage('c', JSON3.stringify([code, reason]));n };nn FacadeJS.prototype._transportMessage = function (frame) {n iframeUtils.postMessage('t', frame);n };nn FacadeJS.prototype._send = function (data) {n this._transport.send(data);n };nn FacadeJS.prototype._close = function () {n this._transport.close();nn this._transport.removeAllListeners();n };nn module.exports = FacadeJS;n }, {n "./utils/iframe": 47,n "json3": 58n }],n 8: [function (require, module, exports) {n (function (process) {n 'use strict';nn var urlUtils = require('./utils/url'),n eventUtils = require('./utils/event'),n JSON3 = require('json3'),n FacadeJS = require('./facade'),n InfoIframeReceiver = require('./info-iframe-receiver'),n iframeUtils = require('./utils/iframe'),n loc = require('./location');nn var debug = function debug() {};nn if (process.env.NODE_ENV !== 'production') {n debug = require('debug')('sockjs-client:iframe-bootstrap');n }nn module.exports = function (SockJS, availableTransports) {n var transportMap = {};n availableTransports.forEach(function (at) {n if (at.facadeTransport) {n transportMap = at.facadeTransport;n }n }); // hard-coded for the info iframen // TODO see if we can make this more dynamicnn transportMap = InfoIframeReceiver;n var parentOrigin;n /* eslint-disable camelcase */nn SockJS.bootstrap_iframe = function () {n /* eslint-enable camelcase */n var facade;n iframeUtils.currentWindowId = loc.hash.slice(1);nn var onMessage = function onMessage(e) {n if (e.source !== parent) {n return;n }nn if (typeof parentOrigin === 'undefined') {n parentOrigin = e.origin;n }nn if (e.origin !== parentOrigin) {n return;n }nn var iframeMessage;nn try {n iframeMessage = JSON3.parse(e.data);n } catch (ignored) {n debug('bad json', e.data);n return;n }nn if (iframeMessage.windowId !== iframeUtils.currentWindowId) {n return;n }nn switch (iframeMessage.type) {n case 's':n var p;nn try {n p = JSON3.parse(iframeMessage.data);n } catch (ignored) {n debug('bad json', iframeMessage.data);n break;n }nn var version = p;n var transport = p;n var transUrl = p;n var baseUrl = p;n debug(version, transport, transUrl, baseUrl); // change this to semver logicnn if (version !== SockJS.version) {n throw new Error('Incompatible SockJS! Main site uses:' + ' "' + version + '", the iframe:' + ' "' + SockJS.version + '".');n }nn if (!urlUtils.isOriginEqual(transUrl, loc.href) || !urlUtils.isOriginEqual(baseUrl, loc.href)) {n throw new Error('Can\'t connect to different domain from within an ' + 'iframe. (' + loc.href + ', ' + transUrl + ', ' + baseUrl + ')');n }nn facade = new FacadeJS(new transportMap(transUrl, baseUrl));n break;nn case 'm':n facade._send(iframeMessage.data);nn break;nn case 'c':n if (facade) {n facade._close();n }nn facade = null;n break;n }n };nn eventUtils.attachEvent('message', onMessage); // Startnn iframeUtils.postMessage('s');n };n };n }).call(this, {n env: {}n });n }, {n "./facade": 7,n "./info-iframe-receiver": 10,n "./location": 13,n "./utils/event": 46,n "./utils/iframe": 47,n "./utils/url": 52,n "debug": 55,n "json3": 58n }],n 9: [function (require, module, exports) {n (function (process) {n 'use strict';nn var EventEmitter = require('events').EventEmitter,n inherits = require('inherits'),n JSON3 = require('json3'),n objectUtils = require('./utils/object');nn var debug = function debug() {};nn if (process.env.NODE_ENV !== 'production') {n debug = require('debug')('sockjs-client:info-ajax');n }nn function InfoAjax(url, AjaxObject) {n EventEmitter.call(this);n var self = this;n var t0 = +new Date();n this.xo = new AjaxObject('GET', url);n this.xo.once('finish', function (status, text) {n var info, rtt;nn if (status === 200) {n rtt = +new Date() - t0;nn if (text) {n try {n info = JSON3.parse(text);n } catch (e) {n debug('bad json', text);n }n }nn if (!objectUtils.isObject(info)) {n info = {};n }n }nn self.emit('finish', info, rtt);n self.removeAllListeners();n });n }nn inherits(InfoAjax, EventEmitter);nn InfoAjax.prototype.close = function () {n this.removeAllListeners();n this.xo.close();n };nn module.exports = InfoAjax;n }).call(this, {n env: {}n });n }, {n "./utils/object": 49,n "debug": 55,n "events": 3,n "inherits": 57,n "json3": 58n }],n 10: [function (require, module, exports) {n 'use strict';nn var inherits = require('inherits'),n EventEmitter = require('events').EventEmitter,n JSON3 = require('json3'),n XHRLocalObject = require('./transport/sender/xhr-local'),n InfoAjax = require('./info-ajax');nn function InfoReceiverIframe(transUrl) {n var self = this;n EventEmitter.call(this);n this.ir = new InfoAjax(transUrl, XHRLocalObject);n this.ir.once('finish', function (info, rtt) {n self.ir = null;n self.emit('message', JSON3.stringify([info, rtt]));n });n }nn inherits(InfoReceiverIframe, EventEmitter);n InfoReceiverIframe.transportName = 'iframe-info-receiver';nn InfoReceiverIframe.prototype.close = function () {n if (this.ir) {n this.ir.close();n this.ir = null;n }nn this.removeAllListeners();n };nn module.exports = InfoReceiverIframe;n }, {n "./info-ajax": 9,n "./transport/sender/xhr-local": 37,n "events": 3,n "inherits": 57,n "json3": 58n }],n 11: [function (require, module, exports) {n (function (process, global) {n 'use strict';nn var EventEmitter = require('events').EventEmitter,n inherits = require('inherits'),n JSON3 = require('json3'),n utils = require('./utils/event'),n IframeTransport = require('./transport/iframe'),n InfoReceiverIframe = require('./info-iframe-receiver');nn var debug = function debug() {};nn if (process.env.NODE_ENV !== 'production') {n debug = require('debug')('sockjs-client:info-iframe');n }nn function InfoIframe(baseUrl, url) {n var self = this;n EventEmitter.call(this);nn var go = function go() {n var ifr = self.ifr = new IframeTransport(InfoReceiverIframe.transportName, url, baseUrl);n ifr.once('message', function (msg) {n if (msg) {n var d;nn try {n d = JSON3.parse(msg);n } catch (e) {n debug('bad json', msg);n self.emit('finish');n self.close();n return;n }nn var info = d,n rtt = d;n self.emit('finish', info, rtt);n }nn self.close();n });n ifr.once('close', function () {n self.emit('finish');n self.close();n });n }; // TODO this seems the same as the 'needBody' from transportsnnn if (!global.document.body) {n utils.attachEvent('load', go);n } else {n go();n }n }nn inherits(InfoIframe, EventEmitter);nn InfoIframe.enabled = function () {n return IframeTransport.enabled();n };nn InfoIframe.prototype.close = function () {n if (this.ifr) {n this.ifr.close();n }nn this.removeAllListeners();n this.ifr = null;n };nn module.exports = InfoIframe;n }).call(this, {n env: {}n }, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});n }, {n "./info-iframe-receiver": 10,n "./transport/iframe": 22,n "./utils/event": 46,n "debug": 55,n "events": 3,n "inherits": 57,n "json3": 58n }],n 12: [function (require, module, exports) {n (function (process) {n 'use strict';nn var EventEmitter = require('events').EventEmitter,n inherits = require('inherits'),n urlUtils = require('./utils/url'),n XDR = require('./transport/sender/xdr'),n XHRCors = require('./transport/sender/xhr-cors'),n XHRLocal = require('./transport/sender/xhr-local'),n XHRFake = require('./transport/sender/xhr-fake'),n InfoIframe = require('./info-iframe'),n InfoAjax = require('./info-ajax');nn var debug = function debug() {};nn if (process.env.NODE_ENV !== 'production') {n debug = require('debug')('sockjs-client:info-receiver');n }nn function InfoReceiver(baseUrl, urlInfo) {n debug(baseUrl);n var self = this;n EventEmitter.call(this);n setTimeout(function () {n self.doXhr(baseUrl, urlInfo);n }, 0);n }nn inherits(InfoReceiver, EventEmitter); // TODO this is currently ignoring the list of available transports and the whitelistnn InfoReceiver._getReceiver = function (baseUrl, url, urlInfo) {n // determine method of CORS support (if needed)n if (urlInfo.sameOrigin) {n return new InfoAjax(url, XHRLocal);n }nn if (XHRCors.enabled) {n return new InfoAjax(url, XHRCors);n }nn if (XDR.enabled && urlInfo.sameScheme) {n return new InfoAjax(url, XDR);n }nn if (InfoIframe.enabled()) {n return new InfoIframe(baseUrl, url);n }nn return new InfoAjax(url, XHRFake);n };nn InfoReceiver.prototype.doXhr = function (baseUrl, urlInfo) {n var self = this,n url = urlUtils.addPath(baseUrl, '/info');n debug('doXhr', url);n this.xo = InfoReceiver._getReceiver(baseUrl, url, urlInfo);n this.timeoutRef = setTimeout(function () {n debug('timeout');nn self._cleanup(false);nn self.emit('finish');n }, InfoReceiver.timeout);n this.xo.once('finish', function (info, rtt) {n debug('finish', info, rtt);nn self._cleanup(true);nn self.emit('finish', info, rtt);n });n };nn InfoReceiver.prototype._cleanup = function (wasClean) {n debug('_cleanup');n clearTimeout(this.timeoutRef);n this.timeoutRef = null;nn if (!wasClean && this.xo) {n this.xo.close();n }nn this.xo = null;n };nn InfoReceiver.prototype.close = function () {n debug('close');n this.removeAllListeners();nn this._cleanup(false);n };nn InfoReceiver.timeout = 8000;n module.exports = InfoReceiver;n }).call(this, {n env: {}n });n }, {n "./info-ajax": 9,n "./info-iframe": 11,n "./transport/sender/xdr": 34,n "./transport/sender/xhr-cors": 35,n "./transport/sender/xhr-fake": 36,n "./transport/sender/xhr-local": 37,n "./utils/url": 52,n "debug": 55,n "events": 3,n "inherits": 57n }],n 13: [function (require, module, exports) {n (function (global) {n 'use strict';nn module.exports = global.location || {n origin: 'localhost:80’,n protocol: '‘,n host: 'localhost',n port: 80,n href: 'localhost/’,n hash: ''n };n }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});n }, {}],n 14: [function (require, module, exports) {n (function (process, global) {n 'use strict';nn require('./shims');nn var URL = require('url-parse'),n inherits = require('inherits'),n JSON3 = require('json3'),n random = require('./utils/random'),n escape = require('./utils/escape'),n urlUtils = require('./utils/url'),n eventUtils = require('./utils/event'),n transport = require('./utils/transport'),n objectUtils = require('./utils/object'),n browser = require('./utils/browser'),n log = require('./utils/log'),n Event = require('./event/event'),n EventTarget = require('./event/eventtarget'),n loc = require('./location'),n CloseEvent = require('./event/close'),n TransportMessageEvent = require('./event/trans-message'),n InfoReceiver = require('./info-receiver');nn var debug = function debug() {};nn if (process.env.NODE_ENV !== 'production') {n debug = require('debug')('sockjs-client:main');n }nn var transports; // follow constructor steps defined at dev.w3.org/html5/websockets/#the-websocket-interfacenn function SockJS(url, protocols, options) {n if (!(this instanceof SockJS)) {n return new SockJS(url, protocols, options);n }nn if (arguments.length < 1) {n throw new TypeError("Failed to construct 'SockJS: 1 argument required, but only 0 present");n }nn EventTarget.call(this);n this.readyState = SockJS.CONNECTING;n this.extensions = '';n this.protocol = ''; // non-standard extensionnn options = options || {};nn if (options.protocols_whitelist) {n log.warn("'protocols_whitelist' is DEPRECATED. Use 'transports' instead.");n }nn this._transportsWhitelist = options.transports;n this._transportOptions = options.transportOptions || {};n var sessionId = options.sessionId || 8;nn if (typeof sessionId === 'function') {n this._generateSessionId = sessionId;n } else if (typeof sessionId === 'number') {n this._generateSessionId = function () {n return random.string(sessionId);n };n } else {n throw new TypeError('If sessionId is used in the options, it needs to be a number or a function.');n }nn this._server = options.server || random.numberString(1000); // Step 1 of WS spec - parse and validate the url. Issue #8nn var parsedUrl = new URL(url);nn if (!parsedUrl.host || !parsedUrl.protocol) {n throw new SyntaxError("The URL '" + url + "' is invalid");n } else if (parsedUrl.hash) {n throw new SyntaxError('The URL must not contain a fragment');n } else if (parsedUrl.protocol !== 'http:' && parsedUrl.protocol !== 'https:') {n throw new SyntaxError("The URL's scheme must be either 'http:' or 'https:'. '" + parsedUrl.protocol + "' is not allowed.");n }nn var secure = parsedUrl.protocol === 'https:'; // Step 2 - don't allow secure origin with an insecure protocolnn if (loc.protocol === 'https:' && !secure) {n throw new Error('SecurityError: An insecure SockJS connection may not be initiated from a page loaded over HTTPS');n } // Step 3 - check port access - no need heren // Step 4 - parse protocols argumentnnn if (!protocols) {n protocols = [];n } else if (!Array.isArray(protocols)) {n protocols = [protocols];n } // Step 5 - check protocols argumentnnn var sortedProtocols = protocols.sort();n sortedProtocols.forEach(function (proto, i) {n if (!proto) {n throw new SyntaxError("The protocols entry '" + proto + "' is invalid.");n }nn if (i < sortedProtocols.length - 1 && proto === sortedProtocols[i + 1]) {n throw new SyntaxError("The protocols entry '" + proto + "' is duplicated.");n }n }); // Step 6 - convert originnn var o = urlUtils.getOrigin(loc.href);n this._origin = o ? o.toLowerCase() : null; // remove the trailing slashnn parsedUrl.set('pathname', parsedUrl.pathname.replace(/\/+$/, '')); // store the sanitized urlnn this.url = parsedUrl.href;n debug('using url', this.url); // Step 7 - start connection in backgroundn // obtain server infon // sockjs.github.io/sockjs-protocol/sockjs-protocol-0.3.3.html#section-26nn this._urlInfo = {n nullOrigin: !browser.hasDomain(),n sameOrigin: urlUtils.isOriginEqual(this.url, loc.href),n sameScheme: urlUtils.isSchemeEqual(this.url, loc.href)n };n this._ir = new InfoReceiver(this.url, this._urlInfo);nn this._ir.once('finish', this._receiveInfo.bind(this));n }nn inherits(SockJS, EventTarget);nn function userSetCode(code) {n return code === 1000 || code >= 3000 && code <= 4999;n }nn SockJS.prototype.close = function (code, reason) {n // Step 1n if (code && !userSetCode(code)) {n throw new Error('InvalidAccessError: Invalid code');n } // Step 2.4 states the max is 123 bytes, but we are just checking lengthnnn if (reason && reason.length > 123) {n throw new SyntaxError('reason argument has an invalid length');n } // Step 3.1nnn if (this.readyState === SockJS.CLOSING || this.readyState === SockJS.CLOSED) {n return;n } // TODO look at docs to determine how to set thisnnn var wasClean = true;nn this._close(code || 1000, reason || 'Normal closure', wasClean);n };nn SockJS.prototype.send = function (data) {n // #13 - convert anything non-string to stringn // TODO this currently turns objects into [object Object]n if (typeof data !== 'string') {n data = '' + data;n }nn if (this.readyState === SockJS.CONNECTING) {n throw new Error('InvalidStateError: The connection has not been established yet');n }nn if (this.readyState !== SockJS.OPEN) {n return;n }nn this._transport.send(escape.quote(data));n };nn SockJS.version = require('./version');n SockJS.CONNECTING = 0;n SockJS.OPEN = 1;n SockJS.CLOSING = 2;n SockJS.CLOSED = 3;nn SockJS.prototype._receiveInfo = function (info, rtt) {n debug('_receiveInfo', rtt);n this._ir = null;nn if (!info) {n this._close(1002, 'Cannot connect to server');nn return;n } // establish a round-trip timeout (RTO) based on then // round-trip time (RTT)nnn this._rto = this.countRTO(rtt); // allow server to override url used for the actual transportnn this._transUrl = info.base_url ? info.base_url : this.url;n info = objectUtils.extend(info, this._urlInfo);n debug('info', info); // determine list of desired and supported transportsnn var enabledTransports = transports.filterToEnabled(this._transportsWhitelist, info);n this._transports = enabledTransports.main;n debug(this._transports.length + ' enabled transports');nn this._connect();n };nn SockJS.prototype._connect = function () {n for (var Transport = this._transports.shift(); Transport; Transport = this._transports.shift()) {n debug('attempt', Transport.transportName);nn if (Transport.needBody) {n if (!global.document.body || typeof global.document.readyState !== 'undefined' && global.document.readyState !== 'complete' && global.document.readyState !== 'interactive') {n debug('waiting for body');nn this._transports.unshift(Transport);nn eventUtils.attachEvent('load', this._connect.bind(this));n return;n }n } // calculate timeout based on RTO and round trips. Default to 5snnn var timeoutMs = this._rto * Transport.roundTrips || 5000;n this._transportTimeoutId = setTimeout(this._transportTimeout.bind(this), timeoutMs);n debug('using timeout', timeoutMs);n var transportUrl = urlUtils.addPath(this._transUrl, '/' + this._server + '/' + this._generateSessionId());n var options = this._transportOptions;n debug('transport url', transportUrl);n var transportObj = new Transport(transportUrl, this._transUrl, options);n transportObj.on('message', this._transportMessage.bind(this));n transportObj.once('close', this._transportClose.bind(this));n transportObj.transportName = Transport.transportName;n this._transport = transportObj;n return;n }nn this._close(2000, 'All transports failed', false);n };nn SockJS.prototype._transportTimeout = function () {n debug('_transportTimeout');nn if (this.readyState === SockJS.CONNECTING) {n if (this._transport) {n this._transport.close();n }nn this._transportClose(2007, 'Transport timed out');n }n };nn SockJS.prototype._transportMessage = function (msg) {n debug('_transportMessage', msg);n var self = this,n type = msg.slice(0, 1),n content = msg.slice(1),n payload; // first check for messages that don't need a payloadnn switch (type) {n case 'o':n this._open();nn return;nn case 'h':n this.dispatchEvent(new Event('heartbeat'));n debug('heartbeat', this.transport);n return;n }nn if (content) {n try {n payload = JSON3.parse(content);n } catch (e) {n debug('bad json', content);n }n }nn if (typeof payload === 'undefined') {n debug('empty payload', content);n return;n }nn switch (type) {n case 'a':n if (Array.isArray(payload)) {n payload.forEach(function (p) {n debug('message', self.transport, p);n self.dispatchEvent(new TransportMessageEvent(p));n });n }nn break;nn case 'm':n debug('message', this.transport, payload);n this.dispatchEvent(new TransportMessageEvent(payload));n break;nn case 'c':n if (Array.isArray(payload) && payload.length === 2) {n this._close(payload, payload, true);n }nn break;n }n };nn SockJS.prototype._transportClose = function (code, reason) {n debug('_transportClose', this.transport, code, reason);nn if (this._transport) {n this._transport.removeAllListeners();nn this._transport = null;n this.transport = null;n }nn if (!userSetCode(code) && code !== 2000 && this.readyState === SockJS.CONNECTING) {n this._connect();nn return;n }nn this._close(code, reason);n };nn SockJS.prototype._open = function () {n debug('_open', this._transport.transportName, this.readyState);nn if (this.readyState === SockJS.CONNECTING) {n if (this._transportTimeoutId) {n clearTimeout(this._transportTimeoutId);n this._transportTimeoutId = null;n }nn this.readyState = SockJS.OPEN;n this.transport = this._transport.transportName;n this.dispatchEvent(new Event('open'));n debug('connected', this.transport);n } else {n // The server might have been restarted, and lost track of ourn // connection.n this._close(1006, 'Server lost session');n }n };nn SockJS.prototype._close = function (code, reason, wasClean) {n debug('_close', this.transport, code, reason, wasClean, this.readyState);n var forceFail = false;nn if (this._ir) {n forceFail = true;nn this._ir.close();nn this._ir = null;n }nn if (this._transport) {n this._transport.close();nn this._transport = null;n this.transport = null;n }nn if (this.readyState === SockJS.CLOSED) {n throw new Error('InvalidStateError: SockJS has already been closed');n }nn this.readyState = SockJS.CLOSING;n setTimeout(function () {n this.readyState = SockJS.CLOSED;nn if (forceFail) {n this.dispatchEvent(new Event('error'));n }nn var e = new CloseEvent('close');n e.wasClean = wasClean || false;n e.code = code || 1000;n e.reason = reason;n this.dispatchEvent(e);n this.onmessage = this.onclose = this.onerror = null;n debug('disconnected');n }.bind(this), 0);n }; // See: www.erg.abdn.ac.uk/~gerrit/dccp/notes/ccid2/rto_estimator/n // and RFC 2988.nnn SockJS.prototype.countRTO = function (rtt) {n // In a local environment, when using IE8/9 and the `jsonp-polling`n // transport the time needed to establish a connection (the time that passn // from the opening of the transport to the call of `_dispatchOpen`) isn // around 200msec (the lower bound used in the article above) and thisn // causes spurious timeouts. For this reason we calculate a value slightlyn // larger than that used in the article.n if (rtt > 100) {n return 4 * rtt; // rto > 400msecn }nn return 300 + rtt; // 300msec < rto <= 400msecn };nn module.exports = function (availableTransports) {n transports = transport(availableTransports);nn require('./iframe-bootstrap')(SockJS, availableTransports);nn return SockJS;n };n }).call(this, {n env: {}n }, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});n }, {n "./event/close": 2,n "./event/event": 4,n "./event/eventtarget": 5,n "./event/trans-message": 6,n "./iframe-bootstrap": 8,n "./info-receiver": 12,n "./location": 13,n "./shims": 15,n "./utils/browser": 44,n "./utils/escape": 45,n "./utils/event": 46,n "./utils/log": 48,n "./utils/object": 49,n "./utils/random": 50,n "./utils/transport": 51,n "./utils/url": 52,n "./version": 53,n "debug": 55,n "inherits": 57,n "json3": 58,n "url-parse": 61n }],n 15: [function (require, module, exports) {n /* eslint-disable */nn /* jscs: disable */n 'use strict'; // pulled specific shims from github.com/es-shims/es5-shimnn var ArrayPrototype = Array.prototype;n var ObjectPrototype = Object.prototype;n var FunctionPrototype = Function.prototype;n var StringPrototype = String.prototype;n var array_slice = ArrayPrototype.slice;n var _toString = ObjectPrototype.toString;nn var isFunction = function isFunction(val) {n return ObjectPrototype.toString.call(val) === '[object Function]';n };nn var isArray = function isArray(obj) {n return _toString.call(obj) === '[object Array]';n };nn var isString = function isString(obj) {n return _toString.call(obj) === '[object String]';n };nn var supportsDescriptors = Object.defineProperty && function () {n try {n Object.defineProperty({}, 'x', {});n return true;n } catch (e) {n /* this is ES3 */n return false;n }n }(); // Define configurable, writable and non-enumerable propsn // if they don't exist.nnn var defineProperty;nn if (supportsDescriptors) {n defineProperty = function defineProperty(object, name, method, forceAssign) {n if (!forceAssign && name in object) {n return;n }nn Object.defineProperty(object, name, {n configurable: true,n enumerable: false,n writable: true,n value: methodn });n };n } else {n defineProperty = function defineProperty(object, name, method, forceAssign) {n if (!forceAssign && name in object) {n return;n }nn object = method;n };n }nn var defineProperties = function defineProperties(object, map, forceAssign) {n for (var name in map) {n if (ObjectPrototype.hasOwnProperty.call(map, name)) {n defineProperty(object, name, map, forceAssign);n }n }n };nn var toObject = function toObject(o) {n if (o == null) {n // this matches both null and undefinedn throw new TypeError("can't convert " + o + ' to object');n }nn return Object(o);n }; //n // Utiln // ======n //n // ES5 9.4n // es5.github.com/#x9.4n // jsperf.com/to-integernnn function toInteger(num) {n var n = +num;nn if (n !== n) {n // isNaNn n = 0;n } else if (n !== 0 && n !== 1 / 0 && n !== -(1 / 0)) {n n = (n > 0 || -1) * Math.floor(Math.abs(n));n }nn return n;n }nn function ToUint32(x) {n return x >>> 0;n } //n // Functionn // ========n //n // ES-5 15.3.4.5n // es5.github.com/#x15.3.4.5nnn function Empty() {}nn defineProperties(FunctionPrototype, {n bind: function bind(that) {n // .length is 1n // 1. Let Target be the this value.n var target = this; // 2. If IsCallable(Target) is false, throw a TypeError exception.nn if (!isFunction(target)) {n throw new TypeError('Function.prototype.bind called on incompatible ' + target);n } // 3. Let A be a new (possibly empty) internal list of all of then // argument values provided after thisArg (arg1, arg2 etc), in order.n // XXX slicedArgs will stand in for "A" if usednnn var args = array_slice.call(arguments, 1); // for normal calln // 4. Let F be a new native ECMAScript object.n // 11. Set the [[Prototype]] internal property of F to the standardn // built-in Function prototype object as specified in 15.3.3.1.n // 12. Set the [[Call]] internal property of F as described inn // 15.3.4.5.1.n // 13. Set the [[Construct]] internal property of F as described inn // 15.3.4.5.2.n // 14. Set the [[HasInstance]] internal property of F as described inn // 15.3.4.5.3.nn var binder = function binder() {n if (this instanceof bound) {n // 15.3.4.5.2 [[Construct]]n // When the [[Construct]] internal method of a function object,n // F that was created using the bind function is called with an // list of arguments ExtraArgs, the following steps are taken:n // 1. Let target be the value of F's [[TargetFunction]]n // internal property.n // 2. If target has no [[Construct]] internal method, an // TypeError exception is thrown.n // 3. Let boundArgs be the value of F's [[BoundArgs]] internaln // property.n // 4. Let args be a new list containing the same values as then // list boundArgs in the same order followed by the samen // values as the list ExtraArgs in the same order.n // 5. Return the result of calling the [[Construct]] internaln // method of target providing args as the arguments.n var result = target.apply(this, args.concat(array_slice.call(arguments)));nn if (Object(result) === result) {n return result;n }nn return this;n } else {n // 15.3.4.5.1 [[Call]]n // When the [[Call]] internal method of a function object, F,n // which was created using the bind function is called with an // this value and a list of arguments ExtraArgs, the followingn // steps are taken:n // 1. Let boundArgs be the value of F's [[BoundArgs]] internaln // property.n // 2. Let boundThis be the value of F's [[BoundThis]] internaln // property.n // 3. Let target be the value of F's [[TargetFunction]] internaln // property.n // 4. Let args be a new list containing the same values as then // list boundArgs in the same order followed by the samen // values as the list ExtraArgs in the same order.n // 5. Return the result of calling the [[Call]] internal methodn // of target providing boundThis as the this value andn // providing args as the arguments.n // equiv: target.call(this, …boundArgs, …args)n return target.apply(that, args.concat(array_slice.call(arguments)));n }n }; // 15. If the [[Class]] internal property of Target is "Function", thenn // a. Let L be the length property of Target minus the length of A.n // b. Set the length own property of F to either 0 or L, whichever isn // larger.n // 16. Else set the length own property of F to 0.nnn var boundLength = Math.max(0, target.length - args.length); // 17. Set the attributes of the length own property of F to the valuesn // specified in 15.3.5.1.nn var boundArgs = [];nn for (var i = 0; i < boundLength; i++) {n boundArgs.push('$' + i);n } // XXX Build a dynamic function with desired amount of arguments is the onlyn // way to set the length property of a function.n // In environments where Content Security Policies enabled (Chrome extensions,n // for ex.) all use of eval or Function costructor throws an exception.n // However in all of these environments Function.prototype.bind existsn // and so this code will never be executed.nnn var bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this, arguments); }')(binder);nn if (target.prototype) {n Empty.prototype = target.prototype;n bound.prototype = new Empty(); // Clean up dangling references.nn Empty.prototype = null;n } // TODOn // 18. Set the [[Extensible]] internal property of F to true.n // TODOn // 19. Let thrower be the [[ThrowTypeError]] function Object (13.2.3).n // 20. Call the [[DefineOwnProperty]] internal method of F withn // arguments "caller", PropertyDescriptor {[[Get]]: thrower, [[Set]]:n // thrower, [[Enumerable]]: false, [[Configurable]]: false}, andn // false.n // 21. Call the [[DefineOwnProperty]] internal method of F withn // arguments "arguments", PropertyDescriptor {[[Get]]: thrower,n // [[Set]]: thrower, [[Enumerable]]: false, [[Configurable]]: false},n // and false.n // TODOn // NOTE Function objects created using Function.prototype.bind do notn // have a prototype property or the [[Code]], [[FormalParameters]], andn // [[Scope]] internal properties.n // XXX can't delete prototype in pure-js.n // 22. Return F.nnn return bound;n }n }); //n // Arrayn // =====n //n // ES5 15.4.3.2n // es5.github.com/#x15.4.3.2n // developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/isArraynn defineProperties(Array, {n isArray: isArrayn });n var boxedString = Object('a');n var splitString = boxedString !== 'a' || !(0 in boxedString);nn var properlyBoxesContext = function properlyBoxed(method) {n // Check node 0.6.21 bug where third parameter is not boxedn var properlyBoxesNonStrict = true;n var properlyBoxesStrict = true;nn if (method) {n method.call('foo', function (_, __, context) {n if (_typeof2(context) !== 'object') {n properlyBoxesNonStrict = false;n }n });n method.call(, function () {n 'use strict';nn properlyBoxesStrict = typeof this === 'string';n }, 'x');n }nn return !!method && properlyBoxesNonStrict && properlyBoxesStrict;n };nn defineProperties(ArrayPrototype, {n forEach: function forEach(funn /*, thisp*/n ) {n var object = toObject(this),n self = splitString && isString(this) ? this.split('') : object,n thisp = arguments,n i = -1,n length = self.length >>> 0; // If no callback function or if callback is not a callable functionnn if (!isFunction(fun)) {n throw new TypeError(); // TODO messagen }nn while (++i < length) {n if (i in self) {n // Invoke the callback function with call, passing arguments:n // context, property value, property key, thisArg objectn // contextn fun.call(thisp, self, i, object);n }n }n }n }, !properlyBoxesContext(ArrayPrototype.forEach)); // ES5 15.4.4.14n // es5.github.com/#x15.4.4.14n // developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/indexOfnn var hasFirefox2IndexOfBug = Array.prototype.indexOf && [0, 1].indexOf(1, 2) !== -1;n defineProperties(ArrayPrototype, {n indexOf: function indexOf(soughtn /*, fromIndex */n ) {n var self = splitString && isString(this) ? this.split('') : toObject(this),n length = self.length >>> 0;nn if (!length) {n return -1;n }nn var i = 0;nn if (arguments.length > 1) {n i = toInteger(arguments);n } // handle negative indicesnnn i = i >= 0 ? i : Math.max(0, length + i);nn for (; i < length; i++) {n if (i in self && self === sought) {n return i;n }n }nn return -1;n }n }, hasFirefox2IndexOfBug); //n // Stringn // ======n //n // ES5 15.5.4.14n // es5.github.com/#x15.5.4.14n // [bugfix, IE lt 9, firefox 4, Konqueror, Opera, obscure browsers]n // Many browsers do not split properly with regular expressions or theyn // do not perform the split correctly under obscure conditions.n // See blog.stevenlevithan.com/archives/cross-browser-splitn // I've tested in many browsers and this seems to cover the deviant ones:n // 'ab'.split(/(?:ab)*/) should be ["", ""], not [""]n // '.'.split(/(.?)(.?)/) should be ["", ".", "", ""], not ["", ""]n // 'tesst'.split(/(s)*/) should be ["t", undefined, "e", "s", "t"], notn // [undefined, "t", undefined, "e", …]n // ''.split(/.?/) should be [], not [""]n // '.'.split(/()()/) should be ["."], not ["", "", "."]nn var string_split = StringPrototype.split;nn if ('ab'.split(/(?:ab)*/).length !== 2 || '.'.split(/(.?)(.?)/).length !== 4 || 'tesst’.split(/(s)*/) === 't' || 'test'.split(/(?:)/, -1).length !== 4 || ''.split(/.?/).length || '.'.split(/()()/).length > 1) {n (function () {n var compliantExecNpcg = /()??/.exec(”) === void 0; // NPCG: nonparticipating capturing groupnn StringPrototype.split = function (separator, limit) {n var string = this;nn if (separator === void 0 && limit === 0) {n return [];n } // If `separator` is not a regex, use native splitnnn if (_toString.call(separator) !== '[object RegExp]') {n return string_split.call(this, separator, limit);n }nn var output = [],n flags = (separator.ignoreCase ? 'i' : '') + (separator.multiline ? 'm' : '') + (separator.extended ? 'x' : '') + ( // Proposed for ES6n separator.sticky ? 'y' : ''),n // Firefox 3+n lastLastIndex = 0,n // Make `global` and avoid `lastIndex` issues by working with a copyn separator2,n match,n lastIndex,n lastLength;n separator = new RegExp(separator.source, flags + 'g');n string += ''; // Type-convertnn if (!compliantExecNpcg) {n // Doesn't need flags gy, but they don't hurtn separator2 = new RegExp('^' + separator.source + '$(?!\\s)', flags);n }n /* Values for `limit`, per the spec:n * If undefined: 4294967295 // Math.pow(2, 32) - 1n * If 0, Infinity, or NaN: 0n * If positive number: limit = Math.floor(limit); if (limit > 4294967295) limit -= 4294967296;n * If negative number: 4294967296 - Math.floor(Math.abs(limit))n * If other: Type-convert, then use the above rulesn */nnn limit = limit === void 0 ? -1 >>> 0 : // Math.pow(2, 32) - 1n ToUint32(limit);nn while (match = separator.exec(string)) {n // `separator.lastIndex` is not reliable cross-browsern lastIndex = match.index + match.length;nn if (lastIndex > lastLastIndex) {n output.push(string.slice(lastLastIndex, match.index)); // Fix browsers whose `exec` methods don't consistently return `undefined` forn // nonparticipating capturing groupsnn if (!compliantExecNpcg && match.length > 1) {n match.replace(separator2, function () {n for (var i = 1; i < arguments.length - 2; i++) {n if (arguments === void 0) {n match = void 0;n }n }n });n }nn if (match.length > 1 && match.index < string.length) {n ArrayPrototype.push.apply(output, match.slice(1));n }nn lastLength = match.length;n lastLastIndex = lastIndex;nn if (output.length >= limit) {n break;n }n }nn if (separator.lastIndex === match.index) {n separator.lastIndex++; // Avoid an infinite loopn }n }nn if (lastLastIndex === string.length) {n if (lastLength || !separator.test('')) {n output.push('');n }n } else {n output.push(string.slice(lastLastIndex));n }nn return output.length > limit ? output.slice(0, limit) : output;n };n })(); // [bugfix, chrome]n // If separator is undefined, then the result array contains just one String,n // which is the this value (converted to a String). If limit is not undefined,n // then the output array is truncated so that it contains no more than limitn // elements.n // "0".split(undefined, 0) -> []nn } else if ('0'.split(void 0, 0).length) {n StringPrototype.split = function split(separator, limit) {n if (separator === void 0 && limit === 0) {n return [];n }nn return string_split.call(this, separator, limit);n };n } // ECMA-262, 3rd B.2.3n // Not an ECMAScript standard, although ECMAScript 3rd Edition has an // non-normative section suggesting uniform semantics and it should ben // normalized across all browsersn // [bugfix, IE lt 9] IE < 9 substr() with negative value not working in IEnnn var string_substr = StringPrototype.substr;n var hasNegativeSubstrBug = ''.substr && '0b'.substr(-1) !== 'b';n defineProperties(StringPrototype, {n substr: function substr(start, length) {n return string_substr.call(this, start < 0 ? (start = this.length + start) < 0 ? 0 : start : start, length);n }n }, hasNegativeSubstrBug);n }, {}],n 16: [function (require, module, exports) {n 'use strict';nn module.exports = [// streaming transportsn require('./transport/websocket'), require('./transport/xhr-streaming'), require('./transport/xdr-streaming'), require('./transport/eventsource'), require('./transport/lib/iframe-wrap')(require('./transport/eventsource')) // polling transportsn , 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')];n }, {n "./transport/eventsource": 20,n "./transport/htmlfile": 21,n "./transport/jsonp-polling": 23,n "./transport/lib/iframe-wrap": 26,n "./transport/websocket": 38,n "./transport/xdr-polling": 39,n "./transport/xdr-streaming": 40,n "./transport/xhr-polling": 41,n "./transport/xhr-streaming": 42n }],n 17: [function (require, module, exports) {n (function (process, global) {n 'use strict';nn var EventEmitter = require('events').EventEmitter,n inherits = require('inherits'),n utils = require('../../utils/event'),n urlUtils = require('../../utils/url'),n XHR = global.XMLHttpRequest;nn var debug = function debug() {};nn if (process.env.NODE_ENV !== 'production') {n debug = require('debug')('sockjs-client:browser:xhr');n }nn function AbstractXHRObject(method, url, payload, opts) {n debug(method, url);n var self = this;n EventEmitter.call(this);n setTimeout(function () {n self._start(method, url, payload, opts);n }, 0);n }nn inherits(AbstractXHRObject, EventEmitter);nn AbstractXHRObject.prototype._start = function (method, url, payload, opts) {n var self = this;nn try {n this.xhr = new XHR();n } catch (x) {// intentionally emptyn }nn if (!this.xhr) {n debug('no xhr');n this.emit('finish', 0, 'no xhr support');nn this._cleanup();nn return;n } // several browsers cache POSTsnnn url = urlUtils.addQuery(url, 't=' + +new Date()); // Explorer tends to keep connection open, even after then // tab gets closed: bugs.jquery.com/ticket/5280nn this.unloadRef = utils.unloadAdd(function () {n debug('unload cleanup');nn self._cleanup(true);n });nn try {n this.xhr.open(method, url, true);nn if (this.timeout && 'timeout' in this.xhr) {n this.xhr.timeout = this.timeout;nn this.xhr.ontimeout = function () {n debug('xhr timeout');n self.emit('finish', 0, '');nn self._cleanup(false);n };n }n } catch (e) {n debug('exception', e); // IE raises an exception on wrong port.nn this.emit('finish', 0, '');nn this._cleanup(false);nn return;n }nn if ((!opts || !opts.noCredentials) && AbstractXHRObject.supportsCORS) {n debug('withCredentials'); // Mozilla docs says developer.mozilla.org/en/XMLHttpRequest :n // "This never affects same-site requests."nn this.xhr.withCredentials = true;n }nn if (opts && opts.headers) {n for (var key in opts.headers) {n this.xhr.setRequestHeader(key, opts.headers);n }n }nn this.xhr.onreadystatechange = function () {n if (self.xhr) {n var x = self.xhr;n var text, status;n debug('readyState', x.readyState);nn switch (x.readyState) {n case 3:n // IE doesn't like peeking into responseText or statusn // on Microsoft.XMLHTTP and readystate=3n try {n status = x.status;n text = x.responseText;n } catch (e) {// intentionally emptyn }nn debug('status', status); // IE returns 1223 for 204: bugs.jquery.com/ticket/1450nn if (status === 1223) {n status = 204;n } // IE does return readystate == 3 for 404 answers.nnn if (status === 200 && text && text.length > 0) {n debug('chunk');n self.emit('chunk', status, text);n }nn break;nn case 4:n status = x.status;n debug('status', status); // IE returns 1223 for 204: bugs.jquery.com/ticket/1450nn if (status === 1223) {n status = 204;n } // IE returns this for a bad portn // msdn.microsoft.com/en-us/library/windows/desktop/aa383770(v=vs.85).aspxnnn if (status === 12005 || status === 12029) {n status = 0;n }nn debug('finish', status, x.responseText);n self.emit('finish', status, x.responseText);nn self._cleanup(false);nn break;n }n }n };nn try {n self.xhr.send(payload);n } catch (e) {n self.emit('finish', 0, '');nn self._cleanup(false);n }n };nn AbstractXHRObject.prototype._cleanup = function (abort) {n debug('cleanup');nn if (!this.xhr) {n return;n }nn this.removeAllListeners();n utils.unloadDel(this.unloadRef); // IE needs this field to be a functionnn this.xhr.onreadystatechange = function () {};nn if (this.xhr.ontimeout) {n this.xhr.ontimeout = null;n }nn if (abort) {n try {n this.xhr.abort();n } catch (x) {// intentionally emptyn }n }nn this.unloadRef = this.xhr = null;n };nn AbstractXHRObject.prototype.close = function () {n debug('close');nn this._cleanup(true);n };nn AbstractXHRObject.enabled = !!XHR; // override XMLHttpRequest for IE6/7n // obfuscate to avoid firewallsnn var axo = ['Active'].concat('Object').join('X');nn if (!AbstractXHRObject.enabled && axo in global) {n debug('overriding xmlhttprequest');nn XHR = function XHR() {n try {n return new global('Microsoft.XMLHTTP');n } catch (e) {n return null;n }n };nn AbstractXHRObject.enabled = !!new XHR();n }nn var cors = false;nn try {n cors = 'withCredentials' in new XHR();n } catch (ignored) {// intentionally emptyn }nn AbstractXHRObject.supportsCORS = cors;n module.exports = AbstractXHRObject;n }).call(this, {n env: {}n }, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});n }, {n "../../utils/event": 46,n "../../utils/url": 52,n "debug": 55,n "events": 3,n "inherits": 57n }],n 18: [function (require, module, exports) {n (function (global) {n module.exports = global.EventSource;n }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});n }, {}],n 19: [function (require, module, exports) {n (function (global) {n 'use strict';nn var Driver = global.WebSocket || global.MozWebSocket;nn if (Driver) {n module.exports = function WebSocketBrowserDriver(url) {n return new Driver(url);n };n } else {n module.exports = undefined;n }n }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});n }, {}],n 20: [function (require, module, exports) {n 'use strict';nn var inherits = require('inherits'),n AjaxBasedTransport = require('./lib/ajax-based'),n EventSourceReceiver = require('./receiver/eventsource'),n XHRCorsObject = require('./sender/xhr-cors'),n EventSourceDriver = require('eventsource');nn function EventSourceTransport(transUrl) {n if (!EventSourceTransport.enabled()) {n throw new Error('Transport created when disabled');n }nn AjaxBasedTransport.call(this, transUrl, '/eventsource', EventSourceReceiver, XHRCorsObject);n }nn inherits(EventSourceTransport, AjaxBasedTransport);nn EventSourceTransport.enabled = function () {n return !!EventSourceDriver;n };nn EventSourceTransport.transportName = 'eventsource';n EventSourceTransport.roundTrips = 2;n module.exports = EventSourceTransport;n }, {n "./lib/ajax-based": 24,n "./receiver/eventsource": 29,n "./sender/xhr-cors": 35,n "eventsource": 18,n "inherits": 57n }],n 21: [function (require, module, exports) {n 'use strict';nn var inherits = require('inherits'),n HtmlfileReceiver = require('./receiver/htmlfile'),n XHRLocalObject = require('./sender/xhr-local'),n AjaxBasedTransport = require('./lib/ajax-based');nn function HtmlFileTransport(transUrl) {n if (!HtmlfileReceiver.enabled) {n throw new Error('Transport created when disabled');n }nn AjaxBasedTransport.call(this, transUrl, '/htmlfile', HtmlfileReceiver, XHRLocalObject);n }nn inherits(HtmlFileTransport, AjaxBasedTransport);nn HtmlFileTransport.enabled = function (info) {n return HtmlfileReceiver.enabled && info.sameOrigin;n };nn HtmlFileTransport.transportName = 'htmlfile';n HtmlFileTransport.roundTrips = 2;n module.exports = HtmlFileTransport;n }, {n "./lib/ajax-based": 24,n "./receiver/htmlfile": 30,n "./sender/xhr-local": 37,n "inherits": 57n }],n 22: [function (require, module, exports) {n (function (process) {n 'use strict'; // Few cool transports do work only for same-origin. In order to maken // them work cross-domain we shall use iframe, served from then // remote domain. New browsers have capabilities to communicate withn // cross domain iframe using postMessage(). In IE it was implementedn // from IE 8+, but of course, IE got some details wrong:n // msdn.microsoft.com/en-us/library/cc197015(v=VS.85).aspxn // stevesouders.com/misc/test-postmessage.phpnn var inherits = require('inherits'),n JSON3 = require('json3'),n EventEmitter = require('events').EventEmitter,n version = require('../version'),n urlUtils = require('../utils/url'),n iframeUtils = require('../utils/iframe'),n eventUtils = require('../utils/event'),n random = require('../utils/random');nn var debug = function debug() {};nn if (process.env.NODE_ENV !== 'production') {n debug = require('debug')('sockjs-client:transport:iframe');n }nn function IframeTransport(transport, transUrl, baseUrl) {n if (!IframeTransport.enabled()) {n throw new Error('Transport created when disabled');n }nn EventEmitter.call(this);n var self = this;n this.origin = urlUtils.getOrigin(baseUrl);n this.baseUrl = baseUrl;n this.transUrl = transUrl;n this.transport = transport;n this.windowId = random.string(8);n var iframeUrl = urlUtils.addPath(baseUrl, '/iframe.html') + '#' + this.windowId;n debug(transport, transUrl, iframeUrl);n this.iframeObj = iframeUtils.createIframe(iframeUrl, function ® {n debug('err callback');n self.emit('close', 1006, 'Unable to load an iframe (' + r + ')');n self.close();n });n this.onmessageCallback = this._message.bind(this);n eventUtils.attachEvent('message', this.onmessageCallback);n }nn inherits(IframeTransport, EventEmitter);nn IframeTransport.prototype.close = function () {n debug('close');n this.removeAllListeners();nn if (this.iframeObj) {n eventUtils.detachEvent('message', this.onmessageCallback);nn try {n // When the iframe is not loaded, IE raises an exceptionn // on 'contentWindow'.n this.postMessage('c');n } catch (x) {// intentionally emptyn }nn this.iframeObj.cleanup();n this.iframeObj = null;n this.onmessageCallback = this.iframeObj = null;n }n };nn IframeTransport.prototype._message = function (e) {n debug('message', e.data);nn if (!urlUtils.isOriginEqual(e.origin, this.origin)) {n debug('not same origin', e.origin, this.origin);n return;n }nn var iframeMessage;nn try {n iframeMessage = JSON3.parse(e.data);n } catch (ignored) {n debug('bad json', e.data);n return;n }nn if (iframeMessage.windowId !== this.windowId) {n debug('mismatched window id', iframeMessage.windowId, this.windowId);n return;n }nn switch (iframeMessage.type) {n case 's':n this.iframeObj.loaded(); // window global dependencynn this.postMessage('s', JSON3.stringify([version, this.transport, this.transUrl, this.baseUrl]));n break;nn case 't':n this.emit('message', iframeMessage.data);n break;nn case 'c':n var cdata;nn try {n cdata = JSON3.parse(iframeMessage.data);n } catch (ignored) {n debug('bad json', iframeMessage.data);n return;n }nn this.emit('close', cdata, cdata);n this.close();n break;n }n };nn IframeTransport.prototype.postMessage = function (type, data) {n debug('postMessage', type, data);n this.iframeObj.post(JSON3.stringify({n windowId: this.windowId,n type: type,n data: data || ''n }), this.origin);n };nn IframeTransport.prototype.send = function (message) {n debug('send', message);n this.postMessage('m', message);n };nn IframeTransport.enabled = function () {n return iframeUtils.iframeEnabled;n };nn IframeTransport.transportName = 'iframe';n IframeTransport.roundTrips = 2;n module.exports = IframeTransport;n }).call(this, {n env: {}n });n }, {n "../utils/event": 46,n "../utils/iframe": 47,n "../utils/random": 50,n "../utils/url": 52,n "../version": 53,n "debug": 55,n "events": 3,n "inherits": 57,n "json3": 58n }],n 23: [function (require, module, exports) {n (function (global) {n 'use strict'; // The simplest and most robust transport, using the well-know crossn // domain hack - JSONP. This transport is quite inefficient - onen // message could use up to one http request. But at least it works almostn // everywhere.n // Known limitations:n // o you will get a spinning cursorn // o for Konqueror a dumb timer is needed to detect errorsnn var inherits = require('inherits'),n SenderReceiver = require('./lib/sender-receiver'),n JsonpReceiver = require('./receiver/jsonp'),n jsonpSender = require('./sender/jsonp');nn function JsonPTransport(transUrl) {n if (!JsonPTransport.enabled()) {n throw new Error('Transport created when disabled');n }nn SenderReceiver.call(this, transUrl, '/jsonp', jsonpSender, JsonpReceiver);n }nn inherits(JsonPTransport, SenderReceiver);nn JsonPTransport.enabled = function () {n return !!global.document;n };nn JsonPTransport.transportName = 'jsonp-polling';n JsonPTransport.roundTrips = 1;n JsonPTransport.needBody = true;n module.exports = JsonPTransport;n }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});n }, {n "./lib/sender-receiver": 28,n "./receiver/jsonp": 31,n "./sender/jsonp": 33,n "inherits": 57n }],n 24: [function (require, module, exports) {n (function (process) {n 'use strict';nn var inherits = require('inherits'),n urlUtils = require('../../utils/url'),n SenderReceiver = require('./sender-receiver');nn var debug = function debug() {};nn if (process.env.NODE_ENV !== 'production') {n debug = require('debug')('sockjs-client:ajax-based');n }nn function createAjaxSender(AjaxObject) {n return function (url, payload, callback) {n debug('create ajax sender', url, payload);n var opt = {};nn if (typeof payload === 'string') {n opt.headers = {n 'Content-type': 'text/plain'n };n }nn var ajaxUrl = urlUtils.addPath(url, '/xhr_send');n var xo = new AjaxObject('POST', ajaxUrl, payload, opt);n xo.once('finish', function (status) {n debug('finish', status);n xo = null;nn if (status !== 200 && status !== 204) {n return callback(new Error('http status ' + status));n }nn callback();n });n return function () {n debug('abort');n xo.close();n xo = null;n var err = new Error('Aborted');n err.code = 1000;n callback(err);n };n };n }nn function AjaxBasedTransport(transUrl, urlSuffix, Receiver, AjaxObject) {n SenderReceiver.call(this, transUrl, urlSuffix, createAjaxSender(AjaxObject), Receiver, AjaxObject);n }nn inherits(AjaxBasedTransport, SenderReceiver);n module.exports = AjaxBasedTransport;n }).call(this, {n env: {}n });n }, {n "../../utils/url": 52,n "./sender-receiver": 28,n "debug": 55,n "inherits": 57n }],n 25: [function (require, module, exports) {n (function (process) {n 'use strict';nn var inherits = require('inherits'),n EventEmitter = require('events').EventEmitter;nn var debug = function debug() {};nn if (process.env.NODE_ENV !== 'production') {n debug = require('debug')('sockjs-client:buffered-sender');n }nn function BufferedSender(url, sender) {n debug(url);n EventEmitter.call(this);n this.sendBuffer = [];n this.sender = sender;n this.url = url;n }nn inherits(BufferedSender, EventEmitter);nn BufferedSender.prototype.send = function (message) {n debug('send', message);n this.sendBuffer.push(message);nn if (!this.sendStop) {n this.sendSchedule();n }n }; // For polling transports in a situation when in the message callback,n // new message is being send. If the sending connection was startedn // before receiving one, it is possible to saturate the network andn // timeout due to the lack of receiving socket. To avoid that we delayn // sending messages by some small time, in order to let receivingn // connection be started beforehand. This is only a halfmeasure andn // does not fix the big problem, but it does make the tests go moren // stable on slow networks.nnn BufferedSender.prototype.sendScheduleWait = function () {n debug('sendScheduleWait');n var self = this;n var tref;nn this.sendStop = function () {n debug('sendStop');n self.sendStop = null;n clearTimeout(tref);n };nn tref = setTimeout(function () {n debug('timeout');n self.sendStop = null;n self.sendSchedule();n }, 25);n };nn BufferedSender.prototype.sendSchedule = function () {n debug('sendSchedule', this.sendBuffer.length);n var self = this;nn if (this.sendBuffer.length > 0) {n var payload = '[' + this.sendBuffer.join(',') + ']';n this.sendStop = this.sender(this.url, payload, function (err) {n self.sendStop = null;nn if (err) {n debug('error', err);n self.emit('close', err.code || 1006, 'Sending error: ' + err);n self.close();n } else {n self.sendScheduleWait();n }n });n this.sendBuffer = [];n }n };nn BufferedSender.prototype._cleanup = function () {n debug('_cleanup');n this.removeAllListeners();n };nn BufferedSender.prototype.close = function () {n debug('close');nn this._cleanup();nn if (this.sendStop) {n this.sendStop();n this.sendStop = null;n }n };nn module.exports = BufferedSender;n }).call(this, {n env: {}n });n }, {n "debug": 55,n "events": 3,n "inherits": 57n }],n 26: [function (require, module, exports) {n (function (global) {n 'use strict';nn var inherits = require('inherits'),n IframeTransport = require('../iframe'),n objectUtils = require('../../utils/object');nn module.exports = function (transport) {n function IframeWrapTransport(transUrl, baseUrl) {n IframeTransport.call(this, transport.transportName, transUrl, baseUrl);n }nn inherits(IframeWrapTransport, IframeTransport);nn IframeWrapTransport.enabled = function (url, info) {n if (!global.document) {n return false;n }nn var iframeInfo = objectUtils.extend({}, info);n iframeInfo.sameOrigin = true;n return transport.enabled(iframeInfo) && IframeTransport.enabled();n };nn IframeWrapTransport.transportName = 'iframe-' + transport.transportName;n IframeWrapTransport.needBody = true;n IframeWrapTransport.roundTrips = IframeTransport.roundTrips + transport.roundTrips - 1; // html, javascript (2) + transport - no CORS (1)nn IframeWrapTransport.facadeTransport = transport;n return IframeWrapTransport;n };n }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});n }, {n "../../utils/object": 49,n "../iframe": 22,n "inherits": 57n }],n 27: [function (require, module, exports) {n (function (process) {n 'use strict';nn var inherits = require('inherits'),n EventEmitter = require('events').EventEmitter;nn var debug = function debug() {};nn if (process.env.NODE_ENV !== 'production') {n debug = require('debug')('sockjs-client:polling');n }nn function Polling(Receiver, receiveUrl, AjaxObject) {n debug(receiveUrl);n EventEmitter.call(this);n this.Receiver = Receiver;n this.receiveUrl = receiveUrl;n this.AjaxObject = AjaxObject;nn this._scheduleReceiver();n }nn inherits(Polling, EventEmitter);nn Polling.prototype._scheduleReceiver = function () {n debug('_scheduleReceiver');n var self = this;n var poll = this.poll = new this.Receiver(this.receiveUrl, this.AjaxObject);n poll.on('message', function (msg) {n debug('message', msg);n self.emit('message', msg);n });n poll.once('close', function (code, reason) {n debug('close', code, reason, self.pollIsClosing);n self.poll = poll = null;nn if (!self.pollIsClosing) {n if (reason === 'network') {n self._scheduleReceiver();n } else {n self.emit('close', code || 1006, reason);n self.removeAllListeners();n }n }n });n };nn Polling.prototype.abort = function () {n debug('abort');n this.removeAllListeners();n this.pollIsClosing = true;nn if (this.poll) {n this.poll.abort();n }n };nn module.exports = Polling;n }).call(this, {n env: {}n });n }, {n "debug": 55,n "events": 3,n "inherits": 57n }],n 28: [function (require, module, exports) {n (function (process) {n 'use strict';nn var inherits = require('inherits'),n urlUtils = require('../../utils/url'),n BufferedSender = require('./buffered-sender'),n Polling = require('./polling');nn var debug = function debug() {};nn if (process.env.NODE_ENV !== 'production') {n debug = require('debug')('sockjs-client:sender-receiver');n }nn function SenderReceiver(transUrl, urlSuffix, senderFunc, Receiver, AjaxObject) {n var pollUrl = urlUtils.addPath(transUrl, urlSuffix);n debug(pollUrl);n var self = this;n BufferedSender.call(this, transUrl, senderFunc);n this.poll = new Polling(Receiver, pollUrl, AjaxObject);n this.poll.on('message', function (msg) {n debug('poll message', msg);n self.emit('message', msg);n });n this.poll.once('close', function (code, reason) {n debug('poll close', code, reason);n self.poll = null;n self.emit('close', code, reason);n self.close();n });n }nn inherits(SenderReceiver, BufferedSender);nn SenderReceiver.prototype.close = function () {n BufferedSender.prototype.close.call(this);n debug('close');n this.removeAllListeners();nn if (this.poll) {n this.poll.abort();n this.poll = null;n }n };nn module.exports = SenderReceiver;n }).call(this, {n env: {}n });n }, {n "../../utils/url": 52,n "./buffered-sender": 25,n "./polling": 27,n "debug": 55,n "inherits": 57n }],n 29: [function (require, module, exports) {n (function (process) {n 'use strict';nn var inherits = require('inherits'),n EventEmitter = require('events').EventEmitter,n EventSourceDriver = require('eventsource');nn var debug = function debug() {};nn if (process.env.NODE_ENV !== 'production') {n debug = require('debug')('sockjs-client:receiver:eventsource');n }nn function EventSourceReceiver(url) {n debug(url);n EventEmitter.call(this);n var self = this;n var es = this.es = new EventSourceDriver(url);nn es.onmessage = function (e) {n debug('message', e.data);n self.emit('message', decodeURI(e.data));n };nn es.onerror = function (e) {n debug('error', es.readyState, e); // ES on reconnection has readyState = 0 or 1.n // on network error it's CLOSED = 2nn var reason = es.readyState !== 2 ? 'network' : 'permanent';nn self._cleanup();nn self._close(reason);n };n }nn inherits(EventSourceReceiver, EventEmitter);nn EventSourceReceiver.prototype.abort = function () {n debug('abort');nn this._cleanup();nn this._close('user');n };nn EventSourceReceiver.prototype._cleanup = function () {n debug('cleanup');n var es = this.es;nn if (es) {n es.onmessage = es.onerror = null;n es.close();n this.es = null;n }n };nn EventSourceReceiver.prototype._close = function (reason) {n debug('close', reason);n var self = this; // Safari and chrome < 15 crash if we close window beforen // waiting for ES cleanup. See:n // code.google.com/p/chromium/issues/detail?id=89155nn setTimeout(function () {n self.emit('close', null, reason);n self.removeAllListeners();n }, 200);n };nn module.exports = EventSourceReceiver;n }).call(this, {n env: {}n });n }, {n "debug": 55,n "events": 3,n "eventsource": 18,n "inherits": 57n }],n 30: [function (require, module, exports) {n (function (process, global) {n 'use strict';nn var inherits = require('inherits'),n iframeUtils = require('../../utils/iframe'),n urlUtils = require('../../utils/url'),n EventEmitter = require('events').EventEmitter,n random = require('../../utils/random');nn var debug = function debug() {};nn if (process.env.NODE_ENV !== 'production') {n debug = require('debug')('sockjs-client:receiver:htmlfile');n }nn function HtmlfileReceiver(url) {n debug(url);n EventEmitter.call(this);n var self = this;n iframeUtils.polluteGlobalNamespace();n this.id = 'a' + random.string(6);n url = urlUtils.addQuery(url, 'c=' + decodeURIComponent(iframeUtils.WPrefix + '.' + this.id));n debug('using htmlfile', HtmlfileReceiver.htmlfileEnabled);n var constructFunc = HtmlfileReceiver.htmlfileEnabled ? iframeUtils.createHtmlfile : iframeUtils.createIframe;n global[this.id] = {n start: function start() {n debug('start');n self.iframeObj.loaded();n },n message: function message(data) {n debug('message', data);n self.emit('message', data);n },n stop: function stop() {n debug('stop');nn self._cleanup();nn self._close('network');n }n };n this.iframeObj = constructFunc(url, function () {n debug('callback');nn self._cleanup();nn self._close('permanent');n });n }nn inherits(HtmlfileReceiver, EventEmitter);nn HtmlfileReceiver.prototype.abort = function () {n debug('abort');nn this._cleanup();nn this._close('user');n };nn HtmlfileReceiver.prototype._cleanup = function () {n debug('_cleanup');nn if (this.iframeObj) {n this.iframeObj.cleanup();n this.iframeObj = null;n }nn delete global[this.id];n };nn HtmlfileReceiver.prototype._close = function (reason) {n debug('_close', reason);n this.emit('close', null, reason);n this.removeAllListeners();n };nn HtmlfileReceiver.htmlfileEnabled = false; // obfuscate to avoid firewallsnn var axo = ['Active'].concat('Object').join('X');nn if (axo in global) {n try {n HtmlfileReceiver.htmlfileEnabled = !!new global('htmlfile');n } catch (x) {// intentionally emptyn }n }nn HtmlfileReceiver.enabled = HtmlfileReceiver.htmlfileEnabled || iframeUtils.iframeEnabled;n module.exports = HtmlfileReceiver;n }).call(this, {n env: {}n }, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});n }, {n "../../utils/iframe": 47,n "../../utils/random": 50,n "../../utils/url": 52,n "debug": 55,n "events": 3,n "inherits": 57n }],n 31: [function (require, module, exports) {n (function (process, global) {n 'use strict';nn var utils = require('../../utils/iframe'),n random = require('../../utils/random'),n browser = require('../../utils/browser'),n urlUtils = require('../../utils/url'),n inherits = require('inherits'),n EventEmitter = require('events').EventEmitter;nn var debug = function debug() {};nn if (process.env.NODE_ENV !== 'production') {n debug = require('debug')('sockjs-client:receiver:jsonp');n }nn function JsonpReceiver(url) {n debug(url);n var self = this;n EventEmitter.call(this);n utils.polluteGlobalNamespace();n this.id = 'a' + random.string(6);n var urlWithId = urlUtils.addQuery(url, 'c=' + encodeURIComponent(utils.WPrefix + '.' + this.id));n global[this.id] = this._callback.bind(this);nn this._createScript(urlWithId); // Fallback mostly for Konqueror - stupid timer, 35 seconds shall be plenty.nnn this.timeoutId = setTimeout(function () {n debug('timeout');nn self._abort(new Error('JSONP script loaded abnormally (timeout)'));n }, JsonpReceiver.timeout);n }nn inherits(JsonpReceiver, EventEmitter);nn JsonpReceiver.prototype.abort = function () {n debug('abort');nn if (global[this.id]) {n var err = new Error('JSONP user aborted read');n err.code = 1000;nn this._abort(err);n }n };nn JsonpReceiver.timeout = 35000;n JsonpReceiver.scriptErrorTimeout = 1000;nn JsonpReceiver.prototype._callback = function (data) {n debug('_callback', data);nn this._cleanup();nn if (this.aborting) {n return;n }nn if (data) {n debug('message', data);n this.emit('message', data);n }nn this.emit('close', null, 'network');n this.removeAllListeners();n };nn JsonpReceiver.prototype._abort = function (err) {n debug('_abort', err);nn this._cleanup();nn this.aborting = true;n this.emit('close', err.code, err.message);n this.removeAllListeners();n };nn JsonpReceiver.prototype._cleanup = function () {n debug('_cleanup');n clearTimeout(this.timeoutId);nn if (this.script2) {n this.script2.parentNode.removeChild(this.script2);n this.script2 = null;n }nn if (this.script) {n var script = this.script; // Unfortunately, you can't really abort script loading ofn // the script.nn script.parentNode.removeChild(script);n script.onreadystatechange = script.onerror = script.onload = script.onclick = null;n this.script = null;n }nn delete global[this.id];n };nn JsonpReceiver.prototype._scriptError = function () {n debug('_scriptError');n var self = this;nn if (this.errorTimer) {n return;n }nn this.errorTimer = setTimeout(function () {n if (!self.loadedOkay) {n self._abort(new Error('JSONP script loaded abnormally (onerror)'));n }n }, JsonpReceiver.scriptErrorTimeout);n };nn JsonpReceiver.prototype._createScript = function (url) {n debug('_createScript', url);n var self = this;n var script = this.script = global.document.createElement('script');n var script2; // Opera synchronous load trick.nn script.id = 'a' + random.string(8);n script.src = url;n script.type = 'text/javascript';n script.charset = 'UTF-8';n script.onerror = this._scriptError.bind(this);nn script.onload = function () {n debug('onload');nn self._abort(new Error('JSONP script loaded abnormally (onload)'));n }; // IE9 fires 'error' event after onreadystatechange or before, in random order.n // Use loadedOkay to determine if actually errorednnn script.onreadystatechange = function () {n debug('onreadystatechange', script.readyState);nn if (/loaded|closed/.test(script.readyState)) {n if (script && script.htmlFor && script.onclick) {n self.loadedOkay = true;nn try {n // In IE, actually execute the script.n script.onclick();n } catch (x) {// intentionally emptyn }n }nn if (script) {n self._abort(new Error('JSONP script loaded abnormally (onreadystatechange)'));n }n }n }; // IE: event/htmlFor/onclick trick.n // One can't rely on proper order for onreadystatechange. In order ton // make sure, set a 'htmlFor' and 'event' properties, so thatn // script code will be installed as 'onclick' handler for then // script object. Later, onreadystatechange, manually execute thisn // code. FF and Chrome doesn't work with 'event' and 'htmlFor'n // set. For reference see:n // jaubourg.net/2010/07/loading-script-as-onclick-handler-of.htmln // Also, read on that about script ordering:n // wiki.whatwg.org/wiki/Dynamic_Script_Execution_Ordernnn if (typeof script.async === 'undefined' && global.document.attachEvent) {n // According to mozilla docs, in recent browsers script.async defaultsn // to 'true', so we may use it to detect a good browser:n // developer.mozilla.org/en/HTML/Element/scriptn if (!browser.isOpera()) {n // Naively assume we're in IEn try {n script.htmlFor = script.id;n script.event = 'onclick';n } catch (x) {// intentionally emptyn }nn script.async = true;n } else {n // Opera, second sync script hackn script2 = this.script2 = global.document.createElement('script');n script2.text = "try{var a = document.getElementById('" + script.id + "'); if(a)a.onerror();}catch(x){};";n script.async = script2.async = false;n }n }nn if (typeof script.async !== 'undefined') {n script.async = true;n }nn var head = global.document.getElementsByTagName(‘head’);n head.insertBefore(script, head.firstChild);nn if (script2) {n head.insertBefore(script2, head.firstChild);n }n };nn module.exports = JsonpReceiver;n }).call(this, {n env: {}n }, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});n }, {n "../../utils/browser": 44,n "../../utils/iframe": 47,n "../../utils/random": 50,n "../../utils/url": 52,n "debug": 55,n "events": 3,n "inherits": 57n }],n 32: [function (require, module, exports) {n (function (process) {n 'use strict';nn var inherits = require('inherits'),n EventEmitter = require('events').EventEmitter;nn var debug = function debug() {};nn if (process.env.NODE_ENV !== 'production') {n debug = require('debug')('sockjs-client:receiver:xhr');n }nn function XhrReceiver(url, AjaxObject) {n debug(url);n EventEmitter.call(this);n var self = this;n this.bufferPosition = 0;n this.xo = new AjaxObject('POST', url, null);n this.xo.on('chunk', this._chunkHandler.bind(this));n this.xo.once('finish', function (status, text) {n debug('finish', status, text);nn self._chunkHandler(status, text);nn self.xo = null;n var reason = status === 200 ? 'network' : 'permanent';n debug('close', reason);n self.emit('close', null, reason);nn self._cleanup();n });n }nn inherits(XhrReceiver, EventEmitter);nn XhrReceiver.prototype._chunkHandler = function (status, text) {n debug('_chunkHandler', status);nn if (status !== 200 || !text) {n return;n }nn for (var idx = -1;; this.bufferPosition += idx + 1) {n var buf = text.slice(this.bufferPosition);n idx = buf.indexOf('\n');nn if (idx === -1) {n break;n }nn var msg = buf.slice(0, idx);nn if (msg) {n debug('message', msg);n this.emit('message', msg);n }n }n };nn XhrReceiver.prototype._cleanup = function () {n debug('_cleanup');n this.removeAllListeners();n };nn XhrReceiver.prototype.abort = function () {n debug('abort');nn if (this.xo) {n this.xo.close();n debug('close');n this.emit('close', null, 'user');n this.xo = null;n }nn this._cleanup();n };nn module.exports = XhrReceiver;n }).call(this, {n env: {}n });n }, {n "debug": 55,n "events": 3,n "inherits": 57n }],n 33: [function (require, module, exports) {n (function (process, global) {n 'use strict';nn var random = require('../../utils/random'),n urlUtils = require('../../utils/url');nn var debug = function debug() {};nn if (process.env.NODE_ENV !== 'production') {n debug = require('debug')('sockjs-client:sender:jsonp');n }nn var form, area;nn function createIframe(id) {n debug('createIframe', id);nn try {n // ie6 dynamic iframes with target="" support (thanks Chris Lambacher)n return global.document.createElement('<iframe name="' + id + '">');n } catch (x) {n var iframe = global.document.createElement('iframe');n iframe.name = id;n return iframe;n }n }nn function createForm() {n debug('createForm');n form = global.document.createElement('form');n form.style.display = 'none';n form.style.position = 'absolute';n form.method = 'POST';n form.enctype = 'application/x-www-form-urlencoded';n form.acceptCharset = 'UTF-8';n area = global.document.createElement('textarea');n area.name = 'd';n form.appendChild(area);n global.document.body.appendChild(form);n }nn module.exports = function (url, payload, callback) {n debug(url, payload);nn if (!form) {n createForm();n }nn var id = 'a' + random.string(8);n form.target = id;n form.action = urlUtils.addQuery(urlUtils.addPath(url, '/jsonp_send'), 'i=' + id);n var iframe = createIframe(id);n iframe.id = id;n iframe.style.display = 'none';n form.appendChild(iframe);nn try {n area.value = payload;n } catch (e) {// seriously broken browsers get heren }nn form.submit();nn var completed = function completed(err) {n debug('completed', id, err);nn if (!iframe.onerror) {n return;n }nn iframe.onreadystatechange = iframe.onerror = iframe.onload = null; // Opera mini doesn't like if we GC iframen // immediately, thus this timeout.nn setTimeout(function () {n debug('cleaning up', id);n iframe.parentNode.removeChild(iframe);n iframe = null;n }, 500);n area.value = ''; // It is not possible to detect if the iframe succeeded orn // failed to submit our form.nn callback(err);n };nn iframe.onerror = function () {n debug('onerror', id);n completed();n };nn iframe.onload = function () {n debug('onload', id);n completed();n };nn iframe.onreadystatechange = function (e) {n debug('onreadystatechange', id, iframe.readyState, e);nn if (iframe.readyState === 'complete') {n completed();n }n };nn return function () {n debug('aborted', id);n completed(new Error('Aborted'));n };n };n }).call(this, {n env: {}n }, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});n }, {n "../../utils/random": 50,n "../../utils/url": 52,n "debug": 55n }],n 34: [function (require, module, exports) {n (function (process, global) {n 'use strict';nn var EventEmitter = require('events').EventEmitter,n inherits = require('inherits'),n eventUtils = require('../../utils/event'),n browser = require('../../utils/browser'),n urlUtils = require('../../utils/url');nn var debug = function debug() {};nn if (process.env.NODE_ENV !== 'production') {n debug = require('debug')('sockjs-client:sender:xdr');n } // References:n // ajaxian.com/archives/100-line-ajax-wrappern // msdn.microsoft.com/en-us/library/cc288060(v=VS.85).aspxnnn function XDRObject(method, url, payload) {n debug(method, url);n var self = this;n EventEmitter.call(this);n setTimeout(function () {n self._start(method, url, payload);n }, 0);n }nn inherits(XDRObject, EventEmitter);nn XDRObject.prototype._start = function (method, url, payload) {n debug('_start');n var self = this;n var xdr = new global.XDomainRequest(); // IE caches even POSTsnn url = urlUtils.addQuery(url, 't=' + +new Date());nn xdr.onerror = function () {n debug('onerror');nn self._error();n };nn xdr.ontimeout = function () {n debug('ontimeout');nn self._error();n };nn xdr.onprogress = function () {n debug('progress', xdr.responseText);n self.emit('chunk', 200, xdr.responseText);n };nn xdr.onload = function () {n debug('load');n self.emit('finish', 200, xdr.responseText);nn self._cleanup(false);n };nn this.xdr = xdr;n this.unloadRef = eventUtils.unloadAdd(function () {n self._cleanup(true);n });nn try {n // Fails with AccessDenied if port number is bogusn this.xdr.open(method, url);nn if (this.timeout) {n this.xdr.timeout = this.timeout;n }nn this.xdr.send(payload);n } catch (x) {n this._error();n }n };nn XDRObject.prototype._error = function () {n this.emit('finish', 0, '');nn this._cleanup(false);n };nn XDRObject.prototype._cleanup = function (abort) {n debug('cleanup', abort);nn if (!this.xdr) {n return;n }nn this.removeAllListeners();n eventUtils.unloadDel(this.unloadRef);n this.xdr.ontimeout = this.xdr.onerror = this.xdr.onprogress = this.xdr.onload = null;nn if (abort) {n try {n this.xdr.abort();n } catch (x) {// intentionally emptyn }n }nn this.unloadRef = this.xdr = null;n };nn XDRObject.prototype.close = function () {n debug('close');nn this._cleanup(true);n }; // IE 8/9 if the request target uses the same scheme - #79nnn XDRObject.enabled = !!(global.XDomainRequest && browser.hasDomain());n module.exports = XDRObject;n }).call(this, {n env: {}n }, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});n }, {n "../../utils/browser": 44,n "../../utils/event": 46,n "../../utils/url": 52,n "debug": 55,n "events": 3,n "inherits": 57n }],n 35: [function (require, module, exports) {n 'use strict';nn var inherits = require('inherits'),n XhrDriver = require('../driver/xhr');nn function XHRCorsObject(method, url, payload, opts) {n XhrDriver.call(this, method, url, payload, opts);n }nn inherits(XHRCorsObject, XhrDriver);n XHRCorsObject.enabled = XhrDriver.enabled && XhrDriver.supportsCORS;n module.exports = XHRCorsObject;n }, {n "../driver/xhr": 17,n "inherits": 57n }],n 36: [function (require, module, exports) {n 'use strict';nn var EventEmitter = require('events').EventEmitter,n inherits = require('inherits');nn function XHRFake()n /* method, url, payload, opts */n {n var self = this;n EventEmitter.call(this);n this.to = setTimeout(function () {n self.emit('finish', 200, '{}');n }, XHRFake.timeout);n }nn inherits(XHRFake, EventEmitter);nn XHRFake.prototype.close = function () {n clearTimeout(this.to);n };nn XHRFake.timeout = 2000;n module.exports = XHRFake;n }, {n "events": 3,n "inherits": 57n }],n 37: [function (require, module, exports) {n 'use strict';nn var inherits = require('inherits'),n XhrDriver = require('../driver/xhr');nn function XHRLocalObject(method, url, payloadn /*, opts */n ) {n XhrDriver.call(this, method, url, payload, {n noCredentials: truen });n }nn inherits(XHRLocalObject, XhrDriver);n XHRLocalObject.enabled = XhrDriver.enabled;n module.exports = XHRLocalObject;n }, {n "../driver/xhr": 17,n "inherits": 57n }],n 38: [function (require, module, exports) {n (function (process) {n 'use strict';nn var utils = require('../utils/event'),n urlUtils = require('../utils/url'),n inherits = require('inherits'),n EventEmitter = require('events').EventEmitter,n WebsocketDriver = require('./driver/websocket');nn var debug = function debug() {};nn if (process.env.NODE_ENV !== 'production') {n debug = require('debug')('sockjs-client:websocket');n }nn function WebSocketTransport(transUrl, ignore, options) {n if (!WebSocketTransport.enabled()) {n throw new Error('Transport created when disabled');n }nn EventEmitter.call(this);n debug('constructor', transUrl);n var self = this;n var url = urlUtils.addPath(transUrl, '/websocket');nn if (url.slice(0, 5) === 'https') {n url = 'wss' + url.slice(5);n } else {n url = 'ws' + url.slice(4);n }nn this.url = url;n this.ws = new WebsocketDriver(this.url, [], options);nn this.ws.onmessage = function (e) {n debug('message event', e.data);n self.emit('message', e.data);n }; // Firefox has an interesting bug. If a websocket connection isn // created after onunload, it stays alive even when usern // navigates away from the page. In such situation let's lie -n // let's not open the ws connection at all. See:n // github.com/sockjs/sockjs-client/issues/28n // bugzilla.mozilla.org/show_bug.cgi?id=696085nnn this.unloadRef = utils.unloadAdd(function () {n debug('unload');n self.ws.close();n });nn this.ws.onclose = function (e) {n debug('close event', e.code, e.reason);n self.emit('close', e.code, e.reason);nn self._cleanup();n };nn this.ws.onerror = function (e) {n debug('error event', e);n self.emit('close', 1006, 'WebSocket connection broken');nn self._cleanup();n };n }nn inherits(WebSocketTransport, EventEmitter);nn WebSocketTransport.prototype.send = function (data) {n var msg = '[' + data + ']';n debug('send', msg);n this.ws.send(msg);n };nn WebSocketTransport.prototype.close = function () {n debug('close');n var ws = this.ws;nn this._cleanup();nn if (ws) {n ws.close();n }n };nn WebSocketTransport.prototype._cleanup = function () {n debug('_cleanup');n var ws = this.ws;nn if (ws) {n ws.onmessage = ws.onclose = ws.onerror = null;n }nn utils.unloadDel(this.unloadRef);n this.unloadRef = this.ws = null;n this.removeAllListeners();n };nn WebSocketTransport.enabled = function () {n debug('enabled');n return !!WebsocketDriver;n };nn WebSocketTransport.transportName = 'websocket'; // In theory, ws should require 1 round trip. But in chrome, this isn // not very stable over SSL. Most likely a ws connection requires an // separate SSL connection, in which case 2 round trips are ann // absolute minumum.nn WebSocketTransport.roundTrips = 2;n module.exports = WebSocketTransport;n }).call(this, {n env: {}n });n }, {n "../utils/event": 46,n "../utils/url": 52,n "./driver/websocket": 19,n "debug": 55,n "events": 3,n "inherits": 57n }],n 39: [function (require, module, exports) {n 'use strict';nn var inherits = require('inherits'),n AjaxBasedTransport = require('./lib/ajax-based'),n XdrStreamingTransport = require('./xdr-streaming'),n XhrReceiver = require('./receiver/xhr'),n XDRObject = require('./sender/xdr');nn function XdrPollingTransport(transUrl) {n if (!XDRObject.enabled) {n throw new Error('Transport created when disabled');n }nn AjaxBasedTransport.call(this, transUrl, '/xhr', XhrReceiver, XDRObject);n }nn inherits(XdrPollingTransport, AjaxBasedTransport);n XdrPollingTransport.enabled = XdrStreamingTransport.enabled;n XdrPollingTransport.transportName = 'xdr-polling';n XdrPollingTransport.roundTrips = 2; // preflight, ajaxnn module.exports = XdrPollingTransport;n }, {n "./lib/ajax-based": 24,n "./receiver/xhr": 32,n "./sender/xdr": 34,n "./xdr-streaming": 40,n "inherits": 57n }],n 40: [function (require, module, exports) {n 'use strict';nn var inherits = require('inherits'),n AjaxBasedTransport = require('./lib/ajax-based'),n XhrReceiver = require('./receiver/xhr'),n XDRObject = require('./sender/xdr'); // According to:n // stackoverflow.com/questions/1641507/detect-browser-support-for-cross-domain-xmlhttprequestsn // hacks.mozilla.org/2009/07/cross-site-xmlhttprequest-with-cors/nnn function XdrStreamingTransport(transUrl) {n if (!XDRObject.enabled) {n throw new Error('Transport created when disabled');n }nn AjaxBasedTransport.call(this, transUrl, '/xhr_streaming', XhrReceiver, XDRObject);n }nn inherits(XdrStreamingTransport, AjaxBasedTransport);nn XdrStreamingTransport.enabled = function (info) {n if (info.cookie_needed || info.nullOrigin) {n return false;n }nn return XDRObject.enabled && info.sameScheme;n };nn XdrStreamingTransport.transportName = 'xdr-streaming';n XdrStreamingTransport.roundTrips = 2; // preflight, ajaxnn module.exports = XdrStreamingTransport;n }, {n "./lib/ajax-based": 24,n "./receiver/xhr": 32,n "./sender/xdr": 34,n "inherits": 57n }],n 41: [function (require, module, exports) {n 'use strict';nn var inherits = require('inherits'),n AjaxBasedTransport = require('./lib/ajax-based'),n XhrReceiver = require('./receiver/xhr'),n XHRCorsObject = require('./sender/xhr-cors'),n XHRLocalObject = require('./sender/xhr-local');nn function XhrPollingTransport(transUrl) {n if (!XHRLocalObject.enabled && !XHRCorsObject.enabled) {n throw new Error('Transport created when disabled');n }nn AjaxBasedTransport.call(this, transUrl, '/xhr', XhrReceiver, XHRCorsObject);n }nn inherits(XhrPollingTransport, AjaxBasedTransport);nn XhrPollingTransport.enabled = function (info) {n if (info.nullOrigin) {n return false;n }nn if (XHRLocalObject.enabled && info.sameOrigin) {n return true;n }nn return XHRCorsObject.enabled;n };nn XhrPollingTransport.transportName = 'xhr-polling';n XhrPollingTransport.roundTrips = 2; // preflight, ajaxnn module.exports = XhrPollingTransport;n }, {n "./lib/ajax-based": 24,n "./receiver/xhr": 32,n "./sender/xhr-cors": 35,n "./sender/xhr-local": 37,n "inherits": 57n }],n 42: [function (require, module, exports) {n (function (global) {n 'use strict';nn var inherits = require('inherits'),n AjaxBasedTransport = require('./lib/ajax-based'),n XhrReceiver = require('./receiver/xhr'),n XHRCorsObject = require('./sender/xhr-cors'),n XHRLocalObject = require('./sender/xhr-local'),n browser = require('../utils/browser');nn function XhrStreamingTransport(transUrl) {n if (!XHRLocalObject.enabled && !XHRCorsObject.enabled) {n throw new Error('Transport created when disabled');n }nn AjaxBasedTransport.call(this, transUrl, '/xhr_streaming', XhrReceiver, XHRCorsObject);n }nn inherits(XhrStreamingTransport, AjaxBasedTransport);nn XhrStreamingTransport.enabled = function (info) {n if (info.nullOrigin) {n return false;n } // Opera doesn't support xhr-streaming #60n // But it might be able to #92nnn if (browser.isOpera()) {n return false;n }nn return XHRCorsObject.enabled;n };nn XhrStreamingTransport.transportName = 'xhr-streaming';n XhrStreamingTransport.roundTrips = 2; // preflight, ajaxn // Safari gets confused when a streaming ajax request is startedn // before onload. This causes the load indicator to spin indefinetely.n // Only require body when used in a browsernn XhrStreamingTransport.needBody = !!global.document;n module.exports = XhrStreamingTransport;n }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});n }, {n "../utils/browser": 44,n "./lib/ajax-based": 24,n "./receiver/xhr": 32,n "./sender/xhr-cors": 35,n "./sender/xhr-local": 37,n "inherits": 57n }],n 43: [function (require, module, exports) {n (function (global) {n 'use strict';nn if (global.crypto && global.crypto.getRandomValues) {n module.exports.randomBytes = function (length) {n var bytes = new Uint8Array(length);n global.crypto.getRandomValues(bytes);n return bytes;n };n } else {n module.exports.randomBytes = function (length) {n var bytes = new Array(length);nn for (var i = 0; i < length; i++) {n bytes = Math.floor(Math.random() * 256);n }nn return bytes;n };n }n }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});n }, {}],n 44: [function (require, module, exports) {n (function (global) {n 'use strict';nn module.exports = {n isOpera: function isOpera() {n return global.navigator && /opera/i.test(global.navigator.userAgent);n },n isKonqueror: function isKonqueror() {n return global.navigator && /konqueror/i.test(global.navigator.userAgent);n } // #187 wrap document.domain in try/catch because of WP8 from file:///n ,n hasDomain: function hasDomain() {n // non-browser client always has a domainn if (!global.document) {n return true;n }nn try {n return !!global.document.domain;n } catch (e) {n return false;n }n }n };n }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});n }, {}],n 45: [function (require, module, exports) {n 'use strict';nn var JSON3 = require('json3'); // Some extra characters that Chrome gets wrong, and substitutes withn // something else on the wire.n // eslint-disable-next-line no-control-regexnnn var extraEscapable = /[\x00-\x1f\ud800-\udfff\ufffe\uffff\u0300-\u0333\u033d-\u0346\u034a-\u034c\u0350-\u0352\u0357-\u0358\u035c-\u0362\u0374\u037e\u0387\u0591-\u05af\u05c4\u0610-\u0617\u0653-\u0654\u0657-\u065b\u065d-\u065e\u06df-\u06e2\u06eb-\u06ec\u0730\u0732-\u0733\u0735-\u0736\u073a\u073d\u073f-\u0741\u0743\u0745\u0747\u07eb-\u07f1\u0951\u0958-\u095f\u09dc-\u09dd\u09df\u0a33\u0a36\u0a59-\u0a5b\u0a5e\u0b5c-\u0b5d\u0e38-\u0e39\u0f43\u0f4d\u0f52\u0f57\u0f5c\u0f69\u0f72-\u0f76\u0f78\u0f80-\u0f83\u0f93\u0f9d\u0fa2\u0fa7\u0fac\u0fb9\u1939-\u193a\u1a17\u1b6b\u1cda-\u1cdb\u1dc0-\u1dcf\u1dfc\u1dfe\u1f71\u1f73\u1f75\u1f77\u1f79\u1f7b\u1f7d\u1fbb\u1fbe\u1fc9\u1fcb\u1fd3\u1fdb\u1fe3\u1feb\u1fee-\u1fef\u1ff9\u1ffb\u1ffd\u2000-\u2001\u20d0-\u20d1\u20d4-\u20d7\u20e7-\u20e9\u2126\u212a-\u212b\u2329-\u232a\u2adc\u302b-\u302c\uaab2-\uaab3\uf900-\ufa0d\ufa10\ufa12\ufa15-\ufa1e\ufa20\ufa22\ufa25-\ufa26\ufa2a-\ufa2d\ufa30-\ufa6d\ufa70-\ufad9\ufb1d\ufb1f\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufb4e\ufff0-\uffff]/g,n extraLookup; // This may be quite slow, so let's delay until user actually uses badn // characters.nn var unrollLookup = function unrollLookup(escapable) {n var i;n var unrolled = {};n var c = [];nn for (i = 0; i < 65536; i++) {n c.push(String.fromCharCode(i));n }nn escapable.lastIndex = 0;n c.join('').replace(escapable, function (a) {n unrolled = "\\u" + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);n return '';n });n escapable.lastIndex = 0;n return unrolled;n }; // Quote string, also taking care of unicode characters that browsersn // often break. Especially, take care of unicode surrogates:n // en.wikipedia.org/wiki/Mapping_of_Unicode_characters#Surrogatesnnn module.exports = {n quote: function quote(string) {n var quoted = JSON3.stringify(string); // In most cases this should be very fast and good enough.nn extraEscapable.lastIndex = 0;nn if (!extraEscapable.test(quoted)) {n return quoted;n }nn if (!extraLookup) {n extraLookup = unrollLookup(extraEscapable);n }nn return quoted.replace(extraEscapable, function (a) {n return extraLookup;n });n }n };n }, {n "json3": 58n }],n 46: [function (require, module, exports) {n (function (global) {n 'use strict';nn var random = require('./random');nn var onUnload = {},n afterUnload = false // detect google chrome packaged apps because they don't allow the 'unload' eventn ,n isChromePackagedApp = global.chrome && global.chrome.app && global.chrome.app.runtime;n module.exports = {n attachEvent: function attachEvent(event, listener) {n if (typeof global.addEventListener !== 'undefined') {n global.addEventListener(event, listener, false);n } else if (global.document && global.attachEvent) {n // IE quirks.n // According to: stevesouders.com/misc/test-postmessage.phpn // the message gets delivered only to 'document', not 'window'.n global.document.attachEvent('on' + event, listener); // I get 'window' for ie8.nn global.attachEvent('on' + event, listener);n }n },n detachEvent: function detachEvent(event, listener) {n if (typeof global.addEventListener !== 'undefined') {n global.removeEventListener(event, listener, false);n } else if (global.document && global.detachEvent) {n global.document.detachEvent('on' + event, listener);n global.detachEvent('on' + event, listener);n }n },n unloadAdd: function unloadAdd(listener) {n if (isChromePackagedApp) {n return null;n }nn var ref = random.string(8);n onUnload = listener;nn if (afterUnload) {n setTimeout(this.triggerUnloadCallbacks, 0);n }nn return ref;n },n unloadDel: function unloadDel(ref) {n if (ref in onUnload) {n delete onUnload;n }n },n triggerUnloadCallbacks: function triggerUnloadCallbacks() {n for (var ref in onUnload) {n onUnload();n delete onUnload;n }n }n };nn var unloadTriggered = function unloadTriggered() {n if (afterUnload) {n return;n }nn afterUnload = true;n module.exports.triggerUnloadCallbacks();n }; // 'unload' alone is not reliable in opera within an iframe, but wen // can't use `beforeunload` as IE fires it on javascript: links.nnn if (!isChromePackagedApp) {n module.exports.attachEvent('unload', unloadTriggered);n }n }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});n }, {n "./random": 50n }],n 47: [function (require, module, exports) {n (function (process, global) {n 'use strict';nn var eventUtils = require('./event'),n JSON3 = require('json3'),n browser = require('./browser');nn var debug = function debug() {};nn if (process.env.NODE_ENV !== 'production') {n debug = require('debug')('sockjs-client:utils:iframe');n }nn module.exports = {n WPrefix: '_jp',n currentWindowId: null,n polluteGlobalNamespace: function polluteGlobalNamespace() {n if (!(module.exports.WPrefix in global)) {n global = {};n }n },n postMessage: function postMessage(type, data) {n if (global.parent !== global) {n global.parent.postMessage(JSON3.stringify({n windowId: module.exports.currentWindowId,n type: type,n data: data || ''n }), '*');n } else {n debug('Cannot postMessage, no parent window.', type, data);n }n },n createIframe: function createIframe(iframeUrl, errorCallback) {n var iframe = global.document.createElement('iframe');n var tref, unloadRef;nn var unattach = function unattach() {n debug('unattach');n clearTimeout(tref); // Explorer had problems with that.nn try {n iframe.onload = null;n } catch (x) {// intentionally emptyn }nn iframe.onerror = null;n };nn var cleanup = function cleanup() {n debug('cleanup');nn if (iframe) {n unattach(); // This timeout makes chrome fire onbeforeunload eventn // within iframe. Without the timeout it goes straight ton // onunload.nn setTimeout(function () {n if (iframe) {n iframe.parentNode.removeChild(iframe);n }nn iframe = null;n }, 0);n eventUtils.unloadDel(unloadRef);n }n };nn var onerror = function onerror(err) {n debug('onerror', err);nn if (iframe) {n cleanup();n errorCallback(err);n }n };nn var post = function post(msg, origin) {n debug('post', msg, origin);n setTimeout(function () {n try {n // When the iframe is not loaded, IE raises an exceptionn // on 'contentWindow'.n if (iframe && iframe.contentWindow) {n iframe.contentWindow.postMessage(msg, origin);n }n } catch (x) {// intentionally emptyn }n }, 0);n };nn iframe.src = iframeUrl;n iframe.style.display = 'none';n iframe.style.position = 'absolute';nn iframe.onerror = function () {n onerror('onerror');n };nn iframe.onload = function () {n debug('onload'); // `onload` is triggered before scripts on the iframe aren // executed. Give it few seconds to actually load stuff.nn clearTimeout(tref);n tref = setTimeout(function () {n onerror('onload timeout');n }, 2000);n };nn global.document.body.appendChild(iframe);n tref = setTimeout(function () {n onerror('timeout');n }, 15000);n unloadRef = eventUtils.unloadAdd(cleanup);n return {n post: post,n cleanup: cleanup,n loaded: unattachn };n }n /* eslint no-undef: "off", new-cap: "off" */n ,n createHtmlfile: function createHtmlfile(iframeUrl, errorCallback) {n var axo = ['Active'].concat('Object').join('X');n var doc = new global('htmlfile');n var tref, unloadRef;n var iframe;nn var unattach = function unattach() {n clearTimeout(tref);n iframe.onerror = null;n };nn var cleanup = function cleanup() {n if (doc) {n unattach();n eventUtils.unloadDel(unloadRef);n iframe.parentNode.removeChild(iframe);n iframe = doc = null;n CollectGarbage();n }n };nn var onerror = function onerror® {n debug('onerror', r);nn if (doc) {n cleanup();n errorCallback®;n }n };nn var post = function post(msg, origin) {n try {n // When the iframe is not loaded, IE raises an exceptionn // on 'contentWindow'.n setTimeout(function () {n if (iframe && iframe.contentWindow) {n iframe.contentWindow.postMessage(msg, origin);n }n }, 0);n } catch (x) {// intentionally emptyn }n };nn doc.open();n doc.write('<html><s' + 'cript>' + 'document.domain="' + global.document.domain + '";' + '</s' + 'cript></html>');n doc.close();n doc.parentWindow = global;n var c = doc.createElement('div');n doc.body.appendChild©;n iframe = doc.createElement('iframe');n c.appendChild(iframe);n iframe.src = iframeUrl;nn iframe.onerror = function () {n onerror('onerror');n };nn tref = setTimeout(function () {n onerror('timeout');n }, 15000);n unloadRef = eventUtils.unloadAdd(cleanup);n return {n post: post,n cleanup: cleanup,n loaded: unattachn };n }n };n module.exports.iframeEnabled = false;nn if (global.document) {n // postMessage misbehaves in konqueror 4.6.5 - the messages are delivered withn // huge delay, or not at all.n module.exports.iframeEnabled = (typeof global.postMessage === 'function' || _typeof2(global.postMessage) === 'object') && !browser.isKonqueror();n }n }).call(this, {n env: {}n }, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});n }, {n "./browser": 44,n "./event": 46,n "debug": 55,n "json3": 58n }],n 48: [function (require, module, exports) {n (function (global) {n 'use strict';nn var logObject = {};n ['log', 'debug', 'warn'].forEach(function (level) {n var levelExists;nn try {n levelExists = global.console && global.console && global.console.apply;n } catch (e) {// do nothingn }nn logObject = levelExists ? function () {n return global.console.apply(global.console, arguments);n } : level === 'log' ? function () {} : logObject.log;n });n module.exports = logObject;n }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});n }, {}],n 49: [function (require, module, exports) {n 'use strict';nn module.exports = {n isObject: function isObject(obj) {n var type = _typeof2(obj);nn return type === 'function' || type === 'object' && !!obj;n },n extend: function extend(obj) {n if (!this.isObject(obj)) {n return obj;n }nn var source, prop;nn for (var i = 1, length = arguments.length; i < length; i++) {n source = arguments;nn for (prop in source) {n if (Object.prototype.hasOwnProperty.call(source, prop)) {n obj = source;n }n }n }nn return obj;n }n };n }, {}],n 50: [function (require, module, exports) {n 'use strict';n /* global crypto:true */nn var crypto = require('crypto'); // This string has length 32, a power of 2, so the modulus doesn't introduce an // bias.nnn var _randomStringChars = 'abcdefghijklmnopqrstuvwxyz012345';n module.exports = {n string: function string(length) {n var max = _randomStringChars.length;n var bytes = crypto.randomBytes(length);n var ret = [];nn for (var i = 0; i < length; i++) {n ret.push(_randomStringChars.substr(bytes % max, 1));n }nn return ret.join('');n },n number: function number(max) {n return Math.floor(Math.random() * max);n },n numberString: function numberString(max) {n var t = ('' + (max - 1)).length;n var p = new Array(t + 1).join('0');n return (p + this.number(max)).slice(-t);n }n };n }, {n "crypto": 43n }],n 51: [function (require, module, exports) {n (function (process) {n 'use strict';nn var debug = function debug() {};nn if (process.env.NODE_ENV !== 'production') {n debug = require('debug')('sockjs-client:utils:transport');n }nn module.exports = function (availableTransports) {n return {n filterToEnabled: function filterToEnabled(transportsWhitelist, info) {n var transports = {n main: [],n facade: []n };nn if (!transportsWhitelist) {n transportsWhitelist = [];n } else if (typeof transportsWhitelist === 'string') {n transportsWhitelist = [transportsWhitelist];n }nn availableTransports.forEach(function (trans) {n if (!trans) {n return;n }nn if (trans.transportName === 'websocket' && info.websocket === false) {n debug('disabled from server', 'websocket');n return;n }nn if (transportsWhitelist.length && transportsWhitelist.indexOf(trans.transportName) === -1) {n debug('not in whitelist', trans.transportName);n return;n }nn if (trans.enabled(info)) {n debug('enabled', trans.transportName);n transports.main.push(trans);nn if (trans.facadeTransport) {n transports.facade.push(trans.facadeTransport);n }n } else {n debug('disabled', trans.transportName);n }n });n return transports;n }n };n };n }).call(this, {n env: {}n });n }, {n "debug": 55n }],n 52: [function (require, module, exports) {n (function (process) {n 'use strict';nn var URL = require('url-parse');nn var debug = function debug() {};nn if (process.env.NODE_ENV !== 'production') {n debug = require('debug')('sockjs-client:utils:url');n }nn module.exports = {n getOrigin: function getOrigin(url) {n if (!url) {n return null;n }nn var p = new URL(url);nn if (p.protocol === 'file:') {n return null;n }nn var port = p.port;nn if (!port) {n port = p.protocol === 'https:' ? '443' : '80';n }nn return p.protocol + '//' + p.hostname + ':' + port;n },n isOriginEqual: function isOriginEqual(a, b) {n var res = this.getOrigin(a) === this.getOrigin(b);n debug('same', a, b, res);n return res;n },n isSchemeEqual: function isSchemeEqual(a, b) {n return a.split(‘:’) === b.split(‘:’);n },n addPath: function addPath(url, path) {n var qs = url.split('?');n return qs + path + (qs ? '?' + qs : '');n },n addQuery: function addQuery(url, q) {n return url + (url.indexOf('?') === -1 ? '?' + q : '&' + q);n }n };n }).call(this, {n env: {}n });n }, {n "debug": 55,n "url-parse": 61n }],n 53: [function (require, module, exports) {n module.exports = '1.3.0';n }, {}],n 54: [function (require, module, exports) {n /**n * Helpers.n */n var s = 1000;n var m = s * 60;n var h = m * 60;n var d = h * 24;n var w = d * 7;n var y = d * 365.25;n /**n * Parse or format the given `val`.n *n * Options:n *n * - `long` verbose formatting [false]n *n * @param {String|Number} valn * @param {Object} [options]n * @throws {Error} throw an error if val is not a non-empty string or a numbern * @return {String|Number}n * @api publicn */nn module.exports = function (val, options) {n options = options || {};nn var type = _typeof2(val);nn if (type === 'string' && val.length > 0) {n return parse(val);n } else if (type === 'number' && isNaN(val) === false) {n return options ? fmtLong(val) : fmtShort(val);n }nn throw new Error('val is not a non-empty string or a valid number. val=' + JSON.stringify(val));n };n /**n * Parse the given `str` and return milliseconds.n *n * @param {String} strn * @return {Number}n * @api privaten */nnn function parse(str) {n str = String(str);nn if (str.length > 100) {n return;n }nn var match = /^((?:\d+)?\-?\d?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(str);nn if (!match) {n return;n }nn var n = parseFloat(match);n var type = (match || 'ms').toLowerCase();nn switch (type) {n case 'years':n case 'year':n case 'yrs':n case 'yr':n case 'y':n return n * y;nn case 'weeks':n case 'week':n case 'w':n return n * w;nn case 'days':n case 'day':n case 'd':n return n * d;nn case 'hours':n case 'hour':n case 'hrs':n case 'hr':n case 'h':n return n * h;nn case 'minutes':n case 'minute':n case 'mins':n case 'min':n case 'm':n return n * m;nn case 'seconds':n case 'second':n case 'secs':n case 'sec':n case 's':n return n * s;nn case 'milliseconds':n case 'millisecond':n case 'msecs':n case 'msec':n case 'ms':n return n;nn default:n return undefined;n }n }n /**n * Short format for `ms`.n *n * @param {Number} msn * @return {String}n * @api privaten */nnn function fmtShort(ms) {n var msAbs = Math.abs(ms);nn if (msAbs >= d) {n return Math.round(ms / d) + 'd';n }nn if (msAbs >= h) {n return Math.round(ms / h) + 'h';n }nn if (msAbs >= m) {n return Math.round(ms / m) + 'm';n }nn if (msAbs >= s) {n return Math.round(ms / s) + 's';n }nn return ms + 'ms';n }n /**n * Long format for `ms`.n *n * @param {Number} msn * @return {String}n * @api privaten */nnn function fmtLong(ms) {n var msAbs = Math.abs(ms);nn if (msAbs >= d) {n return plural(ms, msAbs, d, 'day');n }nn if (msAbs >= h) {n return plural(ms, msAbs, h, 'hour');n }nn if (msAbs >= m) {n return plural(ms, msAbs, m, 'minute');n }nn if (msAbs >= s) {n return plural(ms, msAbs, s, 'second');n }nn return ms + ' ms';n }n /**n * Pluralization helper.n */nnn function plural(ms, msAbs, n, name) {n var isPlural = msAbs >= n * 1.5;n return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');n }n }, {}],n 55: [function (require, module, exports) {n (function (process) {n "use strict";nn function _typeof(obj) {n if (typeof Symbol === "function" && _typeof2(Symbol.iterator) === "symbol") {n _typeof = function _typeof(obj) {n return _typeof2(obj);n };n } else {n _typeof = function _typeof(obj) {n return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : _typeof2(obj);n };n }nn return _typeof(obj);n }n /* eslint-env browser */nn /**n * This is the web browser implementation of `debug()`.n */nnn exports.log = log;n exports.formatArgs = formatArgs;n exports.save = save;n exports.load = load;n exports.useColors = useColors;n exports.storage = localstorage();n /**n * Colors.n */nn exports.colors = ['#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33'];n /**n * Currently only WebKit-based Web Inspectors, Firefox >= v31,n * and the Firebug extension (any Firefox version) are knownn * to support "%c" CSS customizations.n *n * TODO: add a `localStorage` variable to explicitly enable/disable colorsn */n // eslint-disable-next-line complexitynn function useColors() {n // NB: In an Electron preload script, document will be defined but not fullyn // initialized. Since we know we're in Chrome, we'll just detect this casen // explicitlyn if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {n return true;n } // Internet Explorer and Edge do not support colors.nnn if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {n return false;n } // Is webkit? stackoverflow.com/a/16459606/376773n // document is undefined in react-native: github.com/facebook/react-native/pull/1632nnn return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? stackoverflow.com/a/398120/376773n typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?n // developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messagesn typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // Double check webkit in userAgent just in case we are in a workern typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);n }n /**n * Colorize log arguments if enabled.n *n * @api publicn */nnn function formatArgs(args) {n args = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff);nn if (!this.useColors) {n return;n }nn var c = 'color: ' + this.color;n args.splice(1, 0, c, 'color: inherit'); // The final "%c" is somewhat tricky, because there could be othern // arguments passed either before or after the %c, so we need ton // figure out the correct index to insert the CSS intonn var index = 0;n var lastC = 0;n args.replace(/%/g, function (match) {n if (match === '%%') {n return;n }nn index++;nn if (match === '%c') {n // We only are interested in the last %cn // (the user may have provided their own)n lastC = index;n }n });n args.splice(lastC, 0, c);n }n /**n * Invokes `console.log()` when available.n * No-op when `console.log` is not a "function".n *n * @api publicn */nnn function log() {n var _console; // This hackery is required for IE8/9, wheren // the `console.log` function doesn't have 'apply'nnn return (typeof console === "undefined" ? "undefined" : _typeof(console)) === 'object' && console.log && (_console = console).log.apply(_console, arguments);n }n /**n * Save `namespaces`.n *n * @param {String} namespacesn * @api privaten */nnn function save(namespaces) {n try {n if (namespaces) {n exports.storage.setItem('debug', namespaces);n } else {n exports.storage.removeItem('debug');n }n } catch (error) {// Swallown // XXX (@Qix-) should we be logging these?n }n }n /**n * Load `namespaces`.n *n * @return {String} returns the previously persisted debug modesn * @api privaten */nnn function load() {n var r;nn try {n r = exports.storage.getItem('debug');n } catch (error) {} // Swallown // XXX (@Qix-) should we be logging these?n // If debug isn't set in LS, and we're in Electron, try to load $DEBUGnnn if (!r && typeof process !== 'undefined' && 'env' in process) {n r = process.env.DEBUG;n }nn return r;n }n /**n * Localstorage attempts to return the localstorage.n *n * This is necessary because safari throwsn * when a user disables cookies/localstoragen * and you attempt to access it.n *n * @return {LocalStorage}n * @api privaten */nnn function localstorage() {n try {n // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global contextn // The Browser also has localStorage in the global context.n return localStorage;n } catch (error) {// Swallown // XXX (@Qix-) should we be logging these?n }n }nn module.exports = require('./common')(exports);n var formatters = module.exports.formatters;n /**n * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.n */nn formatters.j = function (v) {n try {n return JSON.stringify(v);n } catch (error) {n return '[UnexpectedJSONParseError]: ' + error.message;n }n };n }).call(this, {n env: {}n });n }, {n "./common": 56n }],n 56: [function (require, module, exports) {n "use strict";n /**n * This is the common logic for both the Node.js and web browsern * implementations of `debug()`.n */nn function setup(env) {n createDebug.debug = createDebug;n createDebug = createDebug;n createDebug.coerce = coerce;n createDebug.disable = disable;n createDebug.enable = enable;n createDebug.enabled = enabled;n createDebug.humanize = require('ms');n Object.keys(env).forEach(function (key) {n createDebug = env;n });n /**n * Active `debug` instances.n */nn createDebug.instances = [];n /**n * The currently active debug mode names, and names to skip.n */nn createDebug.names = [];n createDebug.skips = [];n /**n * Map of special "%n" handling functions, for the debug "format" argument.n *n * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".n */nn createDebug.formatters = {};n /**n * Selects a color for a debug namespacen * @param {String} namespace The namespace string for the for the debug instance to be coloredn * @return {Number|String} An ANSI color code for the given namespacen * @api privaten */nn function selectColor(namespace) {n var hash = 0;nn for (var i = 0; i < namespace.length; i++) {n hash = (hash << 5) - hash + namespace.charCodeAt(i);n hash |= 0; // Convert to 32bit integern }nn return createDebug.colors[Math.abs(hash) % createDebug.colors.length];n }nn createDebug.selectColor = selectColor;n /**n * Create a debugger with the given `namespace`.n *n * @param {String} namespacen * @return {Function}n * @api publicn */nn function createDebug(namespace) {n var prevTime;nn function debug() {n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {n args = arguments;n } // Disabled?nnn if (!debug.enabled) {n return;n }nn var self = debug; // Set `diff` timestampnn var curr = Number(new Date());n var ms = curr - (prevTime || curr);n self.diff = ms;n self.prev = prevTime;n self.curr = curr;n prevTime = curr;n args = createDebug.coerce(args);nn if (typeof args !== 'string') {n // Anything else let's inspect with %On args.unshift('%O');n } // Apply any `formatters` transformationsnnn var index = 0;n args = args.replace(/%()/g, function (match, format) {n // If we encounter an escaped % then don't increase the array indexn if (match === '%%') {n return match;n }nn index++;n var formatter = createDebug.formatters;nn if (typeof formatter === 'function') {n var val = args;n match = formatter.call(self, val); // Now we need to remove `args` since it's inlined in the `format`nn args.splice(index, 1);n index–;n }nn return match;n }); // Apply env-specific formatting (colors, etc.)nn createDebug.formatArgs.call(self, args);n var logFn = self.log || createDebug.log;n logFn.apply(self, args);n }nn debug.namespace = namespace;n debug.enabled = createDebug.enabled(namespace);n debug.useColors = createDebug.useColors();n debug.color = selectColor(namespace);n debug.destroy = destroy;n debug.extend = extend; // Debug.formatArgs = formatArgs;n // debug.rawLog = rawLog;n // env-specific initialization logic for debug instancesnn if (typeof createDebug.init === 'function') {n createDebug.init(debug);n }nn createDebug.instances.push(debug);n return debug;n }nn function destroy() {n var index = createDebug.instances.indexOf(this);nn if (index !== -1) {n createDebug.instances.splice(index, 1);n return true;n }nn return false;n }nn function extend(namespace, delimiter) {n return createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);n }n /**n * Enables a debug mode by namespaces. This can include modesn * separated by a colon and wildcards.n *n * @param {String} namespacesn * @api publicn */nnn function enable(namespaces) {n createDebug.save(namespaces);n createDebug.names = [];n createDebug.skips = [];n var i;n var split = (typeof namespaces === 'string' ? namespaces : '').split(/+/);n var len = split.length;nn for (i = 0; i < len; i++) {n if (!split) {n // ignore empty stringsn continue;n }nn namespaces = split.replace(/*/g, '.*?');nn if (namespaces === '-') {n createDebug.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));n } else {n createDebug.names.push(new RegExp('^' + namespaces + '$'));n }n }nn for (i = 0; i < createDebug.instances.length; i++) {n var instance = createDebug.instances;n instance.enabled = createDebug.enabled(instance.namespace);n }n }n /**n * Disable debug output.n *n * @api publicn */nnn function disable() {n createDebug.enable('');n }n /**n * Returns true if the given mode name is enabled, false otherwise.n *n * @param {String} namen * @return {Boolean}n * @api publicn */nnn function enabled(name) {n if (name[name.length - 1] === '*') {n return true;n }nn var i;n var len;nn for (i = 0, len = createDebug.skips.length; i < len; i++) {n if (createDebug.skips.test(name)) {n return false;n }n }nn for (i = 0, len = createDebug.names.length; i < len; i++) {n if (createDebug.names.test(name)) {n return true;n }n }nn return false;n }n /**n * Coerce `val`.n *n * @param {Mixed} valn * @return {Mixed}n * @api privaten */nnn function coerce(val) {n if (val instanceof Error) {n return val.stack || val.message;n }nn return val;n }nn createDebug.enable(createDebug.load());n return createDebug;n }nn module.exports = setup;n }, {n "ms": 54n }],n 57: [function (require, module, exports) {n if (typeof Object.create === 'function') {n // implementation from standard node.js 'util' modulen module.exports = function inherits(ctor, superCtor) {n ctor.super_ = superCtor;n ctor.prototype = Object.create(superCtor.prototype, {n constructor: {n value: ctor,n enumerable: false,n writable: true,n configurable: truen }n });n };n } else {n // old school shim for old browsersn module.exports = function inherits(ctor, superCtor) {n ctor.super_ = superCtor;nn var TempCtor = function TempCtor() {};nn TempCtor.prototype = superCtor.prototype;n ctor.prototype = new TempCtor();n ctor.prototype.constructor = ctor;n };n }n }, {}],n 58: [function (require, module, exports) {n (function (global) {n /*! JSON v3.3.2 | bestiejs.github.io/json3 | Copyright 2012-2014, Kit Cambridge | kit.mit-license.org */n ;n (function () {n // Detect the `define` function exposed by asynchronous module loaders. Then // strict `define` check is necessary for compatibility with `r.js`.n var isLoader = typeof define === "function" && define.amd; // A set of types used to distinguish objects from primitives.nn var objectTypes = {n "function": true,n "object": truen }; // Detect the `exports` object exposed by CommonJS implementations.nn var freeExports = objectTypes && exports && !exports.nodeType && exports; // Use the `global` object exposed by Node (including Browserify vian // `insert-module-globals`), Narwhal, and Ringo as the default context,n // and the `window` object in browsers. Rhino exports a `global` functionn // instead.nn var root = objectTypes[typeof window === "undefined" ? "undefined" : _typeof2(window)] && window || this,n freeGlobal = freeExports && objectTypes && module && !module.nodeType && _typeof2(global) == "object" && global;nn if (freeGlobal && (freeGlobal === freeGlobal || freeGlobal === freeGlobal || freeGlobal === freeGlobal)) {n root = freeGlobal;n } // Public: Initializes JSON 3 using the given `context` object, attaching then // `stringify` and `parse` functions to the specified `exports` object.nnn function runInContext(context, exports) {n context || (context = root());n exports || (exports = root()); // Native constructor aliases.nn var Number = context || root,n String = context || root,n Object = context || root,n Date = context || root,n SyntaxError = context || root,n TypeError = context || root,n Math = context || root,n nativeJSON = context || root; // Delegate to the native `stringify` and `parse` implementations.nn if (_typeof2(nativeJSON) == "object" && nativeJSON) {n exports.stringify = nativeJSON.stringify;n exports.parse = nativeJSON.parse;n } // Convenience aliases.nnn var objectProto = Object.prototype,n getClass = objectProto.toString,n _isProperty,n _forEach,n undef; // Test the `Date#getUTC*` methods. Based on work by @Yaffle.nnn var isExtended = new Date(-3509827334573292);nn try {n // The `getUTCFullYear`, `Month`, and `Date` methods return nonsensicaln // results for certain dates in Opera >= 10.53.n isExtended = isExtended.getUTCFullYear() == -109252 && isExtended.getUTCMonth() === 0 && isExtended.getUTCDate() === 1 && // Safari < 2.0.2 stores the internal millisecond time value correctly,n // but clips the values returned by the date methods to the range ofn // signed 32-bit integers ([-2 ** 31, 2 ** 31 - 1]).n isExtended.getUTCHours() == 10 && isExtended.getUTCMinutes() == 37 && isExtended.getUTCSeconds() == 6 && isExtended.getUTCMilliseconds() == 708;n } catch (exception) {} // Internal: Determines whether the native `JSON.stringify` and `parse`n // implementations are spec-compliant. Based on work by Ken Snyder.nnn function has(name) {n if (has !== undef) {n // Return cached feature test result.n return has;n }nn var isSupported;nn if (name == "bug-string-char-index") {n // IE <= 7 doesn't support accessing string characters using squaren // bracket notation. IE 8 only supports this for primitives.n isSupported = "a"[0] != "a";n } else if (name == "json") {n // Indicates whether both `JSON.stringify` and `JSON.parse` aren // supported.n isSupported = has("json-stringify") && has("json-parse");n } else {n var value,n serialized = "{\"a\":}"; // Test `JSON.stringify`.nn if (name == "json-stringify") {n var stringify = exports.stringify,n stringifySupported = typeof stringify == "function" && isExtended;nn if (stringifySupported) {n // A test function object with a custom `toJSON` method.n (value = function value() {n return 1;n }).toJSON = value;nn try {n stringifySupported = // Firefox 3.1b1 and b2 serialize string, number, and booleann // primitives as object literals.n stringify(0) === "0" && // FF 3.1b1, b2, and JSON 2 serialize wrapped primitives as objectn // literals.n stringify(new Number()) === "0" && stringify(new String()) == '""' && // FF 3.1b1, 2 throw an error if the value is `null`, `undefined`, orn // does not define a canonical JSON representation (this applies ton // objects with `toJSON` properties as well, unless they are nestedn // within an object or array).n stringify(getClass) === undef && // IE 8 serializes `undefined` as `"undefined"`. Safari <= 5.1.7 andn // FF 3.1b3 pass this test.n stringify(undef) === undef && // Safari <= 5.1.7 and FF 3.1b3 throw `Error`s and `TypeError`s,n // respectively, if the value is omitted entirely.n stringify() === undef && // FF 3.1b1, 2 throw an error if the given value is not a number,n // string, array, object, Boolean, or `null` literal. This applies ton // objects with custom `toJSON` methods as well, unless they are nestedn // inside object or array literals. YUI 3.0.0b1 ignores custom `toJSON`n // methods entirely.n stringify(value) === "1" && stringify() == "[1]" && // Prototype <= 1.6.1 serializes `[undefined]` as `"[]"` instead ofn // `"[null]"`.n stringify() == "[null]" && // YUI 3.0.0b1 fails to serialize `null` literals.n stringify(null) == "null" && // FF 3.1b1, 2 halts serialization if an array contains a function:n // `[1, true, getClass, 1]` serializes as "[1,true,],". FF 3.1b3n // elides non-JSON values from objects and arrays, unless theyn // define custom `toJSON` methods.n stringify([undef, getClass, null]) == "[null,null,null]" && // Simple serialization test. FF 3.1b1 uses Unicode escape sequencesn // where character escape codes are expected (e.g., `\b` => `\u0008`).n stringify({n "a": [value, true, false, null, "\x00\b\n\f\r\t"]n }) == serialized && // FF 3.1b1 and b2 ignore the `filter` and `width` arguments.n stringify(null, value) === "1" && stringify([1, 2], null, 1) == "[\n 1,\n 2\n]" && // JSON 2, Prototype <= 1.7, and older WebKit builds incorrectlyn // serialize extended years.n stringify(new Date(-8.64e15)) == '"-271821-04-20T00:00:00.000Z"' && // The milliseconds are optional in ES 5, but required in 5.1.n stringify(new Date(8.64e15)) == '"+275760-09-13T00:00:00.000Z"' && // Firefox <= 11.0 incorrectly serializes years prior to 0 as negativen // four-digit years instead of six-digit years. Credits: @Yaffle.n stringify(new Date(-621987552e5)) == '"-000001-01-01T00:00:00.000Z"' && // Safari <= 5.1.5 and Opera >= 10.53 incorrectly serialize millisecondn // values less than 1000. Credits: @Yaffle.n stringify(new Date(-1)) == '"1969-12-31T23:59:59.999Z"';n } catch (exception) {n stringifySupported = false;n }n }nn isSupported = stringifySupported;n } // Test `JSON.parse`.nnn if (name == "json-parse") {n var parse = exports.parse;nn if (typeof parse == "function") {n try {n // FF 3.1b1, b2 will throw an exception if a bare literal is provided.n // Conforming implementations should also coerce the initial argument ton // a string prior to parsing.n if (parse("0") === 0 && !parse(false)) {n // Simple parsing test.n value = parse(serialized);n var parseSupported = value.length == 5 && value[0] === 1;nn if (parseSupported) {n try {n // Safari <= 5.1.2 and FF 3.1b1 allow unescaped tabs in strings.n parseSupported = !parse('"\t"');n } catch (exception) {}nn if (parseSupported) {n try {n // FF 4.0 and 4.0.1 allow leading `+` signs and leadingn // decimal points. FF 4.0, 4.0.1, and IE 9-10 also allown // certain octal literals.n parseSupported = parse("01") !== 1;n } catch (exception) {}n }nn if (parseSupported) {n try {n // FF 4.0, 4.0.1, and Rhino 1.7R3-R4 allow trailing decimaln // points. These environments, along with FF 3.1b1 and 2,n // also allow trailing commas in JSON objects and arrays.n parseSupported = parse("1.") !== 1;n } catch (exception) {}n }n }n }n } catch (exception) {n parseSupported = false;n }n }nn isSupported = parseSupported;n }n }nn return has = !!isSupported;n }nn if (!has("json")) {n // Common `[[Class]]` name aliases.n var functionClass = "[object Function]",n dateClass = "[object Date]",n numberClass = "[object Number]",n stringClass = "[object String]",n arrayClass = "[object Array]",n booleanClass = "[object Boolean]"; // Detect incomplete support for accessing string characters by index.nn var charIndexBuggy = has("bug-string-char-index"); // Define additional utility methods if the `Date` methods are buggy.nn if (!isExtended) {n var floor = Math.floor; // A mapping between the months of the year and the number of days betweenn // January 1st and the first of the respective month.nn var Months = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334]; // Internal: Calculates the number of days between the Unix epoch and then // first day of the given month.nn var getDay = function getDay(year, month) {n return Months + 365 * (year - 1970) + floor((year - 1969 + (month = +(month > 1))) / 4) - floor((year - 1901 + month) / 100) + floor((year - 1601 + month) / 400);n };n } // Internal: Determines if a property is a direct property of the givenn // object. Delegates to the native `Object#hasOwnProperty` method.nnn if (!(_isProperty = objectProto.hasOwnProperty)) {n _isProperty = function isProperty(property) {n var members = {},n constructor;nn if ((members.__proto__ = null, members.__proto__ = {n // The proto property cannot be set multiple times in recentn // versions of Firefox and SeaMonkey.n "toString": 1n }, members).toString != getClass) {n // Safari <= 2.0.3 doesn't implement `Object#hasOwnProperty`, butn // supports the mutable proto property.n _isProperty = function isProperty(property) {n // Capture and break the object's prototype chain (see section 8.6.2n // of the ES 5.1 spec). The parenthesized expression prevents ann // unsafe transformation by the Closure Compiler.n var original = this.__proto__,n result = property in (this.__proto__ = null, this); // Restore the original prototype chain.nn this.__proto__ = original;n return result;n };n } else {n // Capture a reference to the top-level `Object` constructor.n constructor = members.constructor; // Use the `constructor` property to simulate `Object#hasOwnProperty` inn // other environments.nn _isProperty = function isProperty(property) {n var parent = (this.constructor || constructor).prototype;n return property in this && !(property in parent && this === parent);n };n }nn members = null;n return _isProperty.call(this, property);n };n } // Internal: Normalizes the `for…in` iteration algorithm acrossn // environments. Each enumerated key is yielded to a `callback` function.nnn _forEach = function forEach(object, callback) {n var size = 0,n Properties,n members,n property; // Tests for bugs in the current environment's `for…in` algorithm. Then // `valueOf` property inherits the non-enumerable flag fromn // `Object.prototype` in older versions of IE, Netscape, and Mozilla.nn (Properties = function Properties() {n this.valueOf = 0;n }).prototype.valueOf = 0; // Iterate over a new instance of the `Properties` class.nn members = new Properties();nn for (property in members) {n // Ignore all properties inherited from `Object.prototype`.n if (_isProperty.call(members, property)) {n size++;n }n }nn Properties = members = null; // Normalize the iteration algorithm.nn if (!size) {n // A list of non-enumerable properties inherited from `Object.prototype`.n members = ["valueOf", "toString", "toLocaleString", "propertyIsEnumerable", "isPrototypeOf", "hasOwnProperty", "constructor"]; // IE <= 8, Mozilla 1.0, and Netscape 6.2 ignore shadowed non-enumerablen // properties.nn _forEach = function forEach(object, callback) {n var isFunction = getClass.call(object) == functionClass,n property,n length;nn var hasProperty = !isFunction && typeof object.constructor != "function" && objectTypes && object.hasOwnProperty || _isProperty;nn for (property in object) {n // Gecko <= 1.0 enumerates the `prototype` property of functions undern // certain conditions; IE does not.n if (!(isFunction && property == "prototype") && hasProperty.call(object, property)) {n callback(property);n }n } // Manually invoke the callback for each non-enumerable property.nnn for (length = members.length; property = members; hasProperty.call(object, property) && callback(property)) {n ;n }n };n } else if (size == 2) {n // Safari <= 2.0.4 enumerates shadowed properties twice.n _forEach = function forEach(object, callback) {n // Create a set of iterated properties.n var members = {},n isFunction = getClass.call(object) == functionClass,n property;nn for (property in object) {n // Store each property name to prevent double enumeration. Then // `prototype` property of functions is not enumerated due to cross-n // environment inconsistencies.n if (!(isFunction && property == "prototype") && !_isProperty.call(members, property) && (members = 1) && _isProperty.call(object, property)) {n callback(property);n }n }n };n } else {n // No bugs detected; use the standard `for…in` algorithm.n _forEach = function forEach(object, callback) {n var isFunction = getClass.call(object) == functionClass,n property,n isConstructor;nn for (property in object) {n if (!(isFunction && property == "prototype") && _isProperty.call(object, property) && !(isConstructor = property === "constructor")) {n callback(property);n }n } // Manually invoke the callback for the `constructor` property due ton // cross-environment inconsistencies.nnn if (isConstructor || _isProperty.call(object, property = "constructor")) {n callback(property);n }n };n }nn return _forEach(object, callback);n }; // Public: Serializes a JavaScript `value` as a JSON string. The optionaln // `filter` argument may specify either a function that alters how object andn // array members are serialized, or an array of strings and numbers thatn // indicates which properties should be serialized. The optional `width`n // argument may be either a string or number that specifies the indentationn // level of the output.nnn if (!has("json-stringify")) {n // Internal: A map of control characters and their escaped equivalents.n var Escapes = {n 92: "\\\\",n 34: '\\"',n 8: "\\b",n 12: "\\f",n 10: "\\n",n 13: "\\r",n 9: "\\t"n }; // Internal: Converts `value` into a zero-padded string such that itsn // length is at least equal to `width`. The `width` must be <= 6.nn var leadingZeroes = "000000";nn var toPaddedString = function toPaddedString(width, value) {n // The `|| 0` expression is necessary to work around a bug inn // Opera <= 7.54u2 where `0 == -0`, but `String(-0) !== "0"`.n return (leadingZeroes + (value || 0)).slice(-width);n }; // Internal: Double-quotes a string `value`, replacing all ASCII controln // characters (characters with code unit values between 0 and 31) withn // their escaped equivalents. This is an implementation of then // `Quote(value)` operation defined in ES 5.1 section 15.12.3.nnn var unicodePrefix = "\\u00";nn var quote = function quote(value) {n var result = '"',n index = 0,n length = value.length,n useCharIndex = !charIndexBuggy || length > 10;n var symbols = useCharIndex && (charIndexBuggy ? value.split("") : value);nn for (; index < length; index++) {n var charCode = value.charCodeAt(index); // If the character is a control character, append its Unicode orn // shorthand escape sequence; otherwise, append the character as-is.nn switch (charCode) {n case 8:n case 9:n case 10:n case 12:n case 13:n case 34:n case 92:n result += Escapes;n break;nn default:n if (charCode < 32) {n result += unicodePrefix + toPaddedString(2, charCode.toString(16));n break;n }nn result += useCharIndex ? symbols : value.charAt(index);n }n }nn return result + '"';n }; // Internal: Recursively serializes an object. Implements then // `Str(key, holder)`, `JO(value)`, and `JA(value)` operations.nnn var serialize = function serialize(property, object, callback, properties, whitespace, indentation, stack) {n var value, className, year, month, date, time, hours, minutes, seconds, milliseconds, results, element, index, length, prefix, result;nn try {n // Necessary for host object support.n value = object;n } catch (exception) {}nn if (_typeof2(value) == "object" && value) {n className = getClass.call(value);nn if (className == dateClass && !_isProperty.call(value, "toJSON")) {n if (value > -1 / 0 && value < 1 / 0) {n // Dates are serialized according to the `Date#toJSON` methodn // specified in ES 5.1 section 15.9.5.44. See section 15.9.1.15n // for the ISO 8601 date time string format.n if (getDay) {n // Manually compute the year, month, date, hours, minutes,n // seconds, and milliseconds if the `getUTC*` methods aren // buggy. Adapted from @Yaffle's `date-shim` project.n date = floor(value / 864e5);nn for (year = floor(date / 365.2425) + 1970 - 1; getDay(year + 1, 0) <= date; year++) {n ;n }nn for (month = floor((date - getDay(year, 0)) / 30.42); getDay(year, month + 1) <= date; month++) {n ;n }nn date = 1 + date - getDay(year, month); // The `time` value specifies the time within the day (see ESn // 5.1 section 15.9.1.2). The formula `(A % B + B) % B` is usedn // to compute `A modulo B`, as the `%` operator does notn // correspond to the `modulo` operation for negative numbers.nn time = (value % 864e5 + 864e5) % 864e5; // The hours, minutes, seconds, and milliseconds are obtained byn // decomposing the time within the day. See section 15.9.1.10.nn hours = floor(time / 36e5) % 24;n minutes = floor(time / 6e4) % 60;n seconds = floor(time / 1e3) % 60;n milliseconds = time % 1e3;n } else {n year = value.getUTCFullYear();n month = value.getUTCMonth();n date = value.getUTCDate();n hours = value.getUTCHours();n minutes = value.getUTCMinutes();n seconds = value.getUTCSeconds();n milliseconds = value.getUTCMilliseconds();n } // Serialize extended years correctly.nnn value = (year <= 0 || year >= 1e4 ? (year < 0 ? "-" : "+") + toPaddedString(6, year < 0 ? -year : year) : toPaddedString(4, year)) + "-" + toPaddedString(2, month + 1) + "-" + toPaddedString(2, date) + // Months, dates, hours, minutes, and seconds should have twon // digits; milliseconds should have three.n "T" + toPaddedString(2, hours) + ":" + toPaddedString(2, minutes) + ":" + toPaddedString(2, seconds) + // Milliseconds are optional in ES 5.0, but required in 5.1.n "." + toPaddedString(3, milliseconds) + "Z";n } else {n value = null;n }n } else if (typeof value.toJSON == "function" && (className != numberClass && className != stringClass && className != arrayClass || _isProperty.call(value, "toJSON"))) {n // Prototype <= 1.6.1 adds non-standard `toJSON` methods to then // `Number`, `String`, `Date`, and `Array` prototypes. JSON 3n // ignores all `toJSON` methods on these objects unless they aren // defined directly on an instance.n value = value.toJSON(property);n }n }nn if (callback) {n // If a replacement function was provided, call it to obtain the valuen // for serialization.n value = callback.call(object, property, value);n }nn if (value === null) {n return "null";n }nn className = getClass.call(value);nn if (className == booleanClass) {n // Booleans are represented literally.n return "" + value;n } else if (className == numberClass) {n // JSON numbers must be finite. `Infinity` and `NaN` are serialized asn // `"null"`.n return value > -1 / 0 && value < 1 / 0 ? "" + value : "null";n } else if (className == stringClass) {n // Strings are double-quoted and escaped.n return quote("" + value);n } // Recursively serialize objects and arrays.nnn if (_typeof2(value) == "object") {n // Check for cyclic structures. This is a linear search; performancen // is inversely proportional to the number of unique nested objects.n for (length = stack.length; length–;) {n if (stack === value) {n // Cyclic structures cannot be serialized by `JSON.stringify`.n throw TypeError();n }n } // Add the object to the stack of traversed objects.nnn stack.push(value);n results = []; // Save the current indentation level and indent one additional level.nn prefix = indentation;n indentation += whitespace;nn if (className == arrayClass) {n // Recursively serialize array elements.n for (index = 0, length = value.length; index < length; index++) {n element = serialize(index, value, callback, properties, whitespace, indentation, stack);n results.push(element === undef ? "null" : element);n }nn result = results.length ? whitespace ? "[\n" + indentation + results.join(",\n" + indentation) + "\n" + prefix + "]" : "[" + results.join(",") + "]" : "[]";n } else {n // Recursively serialize object members. Members are selected fromn // either a user-specified list of property names, or the objectn // itself.n _forEach(properties || value, function (property) {n var element = serialize(property, value, callback, properties, whitespace, indentation, stack);nn if (element !== undef) {n // According to ES 5.1 section 15.12.3: "If `gap` {whitespace}n // is not the empty string, let `member` {quote(property) + ":"}n // be the concatenation of `member` and the `space` character."n // The "`space` character" refers to the literal spacen // character, not the `space` {width} argument provided ton // `JSON.stringify`.n results.push(quote(property) + ":" + (whitespace ? " " : "") + element);n }n });nn result = results.length ? whitespace ? "{\n" + indentation + results.join(",\n" + indentation) + "\n" + prefix + "}" : "{" + results.join(",") + "}" : "{}";n } // Remove the object from the traversed object stack.nnn stack.pop();n return result;n }n }; // Public: `JSON.stringify`. See ES 5.1 section 15.12.3.nnn exports.stringify = function (source, filter, width) {n var whitespace, callback, properties, className;nn if (objectTypes && filter) {n if ((className = getClass.call(filter)) == functionClass) {n callback = filter;n } else if (className == arrayClass) {n // Convert the property names array into a makeshift set.n properties = {};nn for (var index = 0, length = filter.length, value; index < length; value = filter, (className = getClass.call(value), className == stringClass || className == numberClass) && (properties = 1)) {n ;n }n }n }nn if (width) {n if ((className = getClass.call(width)) == numberClass) {n // Convert the `width` to an integer and create a string containingn // `width` number of space characters.n if ((width -= width % 1) > 0) {n for (whitespace = "", width > 10 && (width = 10); whitespace.length < width; whitespace += " ") {n ;n }n }n } else if (className == stringClass) {n whitespace = width.length <= 10 ? width : width.slice(0, 10);n }n } // Opera <= 7.54u2 discards the values associated with empty string keysn // (`""`) only if they are used directly within an object member listn // (e.g., `!("" in { "": 1})`).nnn return serialize("", (value = {}, value = source, value), callback, properties, whitespace, "", []);n };n } // Public: Parses a JSON source string.nnn if (!has("json-parse")) {n var fromCharCode = String.fromCharCode; // Internal: A map of escaped control characters and their unescapedn // equivalents.nn var Unescapes = {n 92: "\\",n 34: '"',n 47: "/",n 98: "\b",n 116: "\t",n 110: "\n",n 102: "\f",n 114: "\r"n }; // Internal: Stores the parser state.nn var Index, Source; // Internal: Resets the parser state and throws a `SyntaxError`.nn var abort = function abort() {n Index = Source = null;n throw SyntaxError();n }; // Internal: Returns the next token, or `"$"` if the parser has reachedn // the end of the source string. A token may be a string, number, `null`n // literal, or Boolean literal.nnn var lex = function lex() {n var source = Source,n length = source.length,n value,n begin,n position,n isSigned,n charCode;nn while (Index < length) {n charCode = source.charCodeAt(Index);nn switch (charCode) {n case 9:n case 10:n case 13:n case 32:n // Skip whitespace tokens, including tabs, carriage returns, linen // feeds, and space characters.n Index++;n break;nn case 123:n case 125:n case 91:n case 93:n case 58:n case 44:n // Parse a punctuator token (`{`, `}`, `[`, `]`, `:`, or `,`) atn // the current position.n value = charIndexBuggy ? source.charAt(Index) : source;n Index++;n return value;nn case 34:n // `"` delimits a JSON string; advance to the next character andn // begin parsing the string. String tokens are prefixed with then // sentinel `@` character to distinguish them from punctuators andn // end-of-string tokens.n for (value = "@", Index++; Index < length;) {n charCode = source.charCodeAt(Index);nn if (charCode < 32) {n // Unescaped ASCII control characters (those with a code unitn // less than the space character) are not permitted.n abort();n } else if (charCode == 92) {n // A reverse solidus (`\`) marks the beginning of an escapedn // control character (including `"`, `\`, and `/`) or Unicoden // escape sequence.n charCode = source.charCodeAt(++Index);nn switch (charCode) {n case 92:n case 34:n case 47:n case 98:n case 116:n case 110:n case 102:n case 114:n // Revive escaped control characters.n value += Unescapes;n Index++;n break;nn case 117:n // `\u` marks the beginning of a Unicode escape sequence.n // Advance to the first character and validate then // four-digit code point.n begin = ++Index;nn for (position = Index + 4; Index < position; Index++) {n charCode = source.charCodeAt(Index); // A valid sequence comprises four hexdigits (case-n // insensitive) that form a single hexadecimal value.nn if (!(charCode >= 48 && charCode <= 57 || charCode >= 97 && charCode <= 102 || charCode >= 65 && charCode <= 70)) {n // Invalid Unicode escape sequence.n abort();n }n } // Revive the escaped character.nnn value += fromCharCode("0x" + source.slice(begin, Index));n break;nn default:n // Invalid escape sequence.n abort();n }n } else {n if (charCode == 34) {n // An unescaped double-quote character marks the end of then // string.n break;n }nn charCode = source.charCodeAt(Index);n begin = Index; // Optimize for the common case where a string is valid.nn while (charCode >= 32 && charCode != 92 && charCode != 34) {n charCode = source.charCodeAt(++Index);n } // Append the string as-is.nnn value += source.slice(begin, Index);n }n }nn if (source.charCodeAt(Index) == 34) {n // Advance to the next character and return the revived string.n Index++;n return value;n } // Unterminated string.nnn abort();nn default:n // Parse numbers and literals.n begin = Index; // Advance past the negative sign, if one is specified.nn if (charCode == 45) {n isSigned = true;n charCode = source.charCodeAt(++Index);n } // Parse an integer or floating-point value.nnn if (charCode >= 48 && charCode <= 57) {n // Leading zeroes are interpreted as octal literals.n if (charCode == 48 && (charCode = source.charCodeAt(Index + 1), charCode >= 48 && charCode <= 57)) {n // Illegal octal literal.n abort();n }nn isSigned = false; // Parse the integer component.nn for (; Index < length && (charCode = source.charCodeAt(Index), charCode >= 48 && charCode <= 57); Index++) {n ;n } // Floats cannot contain a leading decimal point; however, thisn // case is already accounted for by the parser.nnn if (source.charCodeAt(Index) == 46) {n position = ++Index; // Parse the decimal component.nn for (; position < length && (charCode = source.charCodeAt(position), charCode >= 48 && charCode <= 57); position++) {n ;n }nn if (position == Index) {n // Illegal trailing decimal.n abort();n }nn Index = position;n } // Parse exponents. The `e` denoting the exponent isn // case-insensitive.nnn charCode = source.charCodeAt(Index);nn if (charCode == 101 || charCode == 69) {n charCode = source.charCodeAt(++Index); // Skip past the sign following the exponent, if one isn // specified.nn if (charCode == 43 || charCode == 45) {n Index++;n } // Parse the exponential component.nnn for (position = Index; position < length && (charCode = source.charCodeAt(position), charCode >= 48 && charCode <= 57); position++) {n ;n }nn if (position == Index) {n // Illegal empty exponent.n abort();n }nn Index = position;n } // Coerce the parsed value to a JavaScript number.nnn return +source.slice(begin, Index);n } // A negative sign may only precede numbers.nnn if (isSigned) {n abort();n } // `true`, `false`, and `null` literals.nnn if (source.slice(Index, Index + 4) == "true") {n Index += 4;n return true;n } else if (source.slice(Index, Index + 5) == "false") {n Index += 5;n return false;n } else if (source.slice(Index, Index + 4) == "null") {n Index += 4;n return null;n } // Unrecognized token.nnn abort();n }n } // Return the sentinel `$` character if the parser has reached the endn // of the source string.nnn return "$";n }; // Internal: Parses a JSON `value` token.nnn var get = function get(value) {n var results, hasMembers;nn if (value == "$") {n // Unexpected end of input.n abort();n }nn if (typeof value == "string") {n if ((charIndexBuggy ? value.charAt(0) : value) == "@") {n // Remove the sentinel `@` character.n return value.slice(1);n } // Parse object and array literals.nnn if (value == "[") {n // Parses a JSON array, returning a new JavaScript array.n results = [];nn for (;; hasMembers || (hasMembers = true)) {n value = lex(); // A closing square bracket marks the end of the array literal.nn if (value == "]") {n break;n } // If the array literal contains elements, the current tokenn // should be a comma separating the previous element from then // next.nnn if (hasMembers) {n if (value == ",") {n value = lex();nn if (value == "]") {n // Unexpected trailing `,` in array literal.n abort();n }n } else {n // A `,` must separate each array element.n abort();n }n } // Elisions and leading commas are not permitted.nnn if (value == ",") {n abort();n }nn results.push(get(value));n }nn return results;n } else if (value == "{") {n // Parses a JSON object, returning a new JavaScript object.n results = {};nn for (;; hasMembers || (hasMembers = true)) {n value = lex(); // A closing curly brace marks the end of the object literal.nn if (value == "}") {n break;n } // If the object literal contains members, the current tokenn // should be a comma separator.nnn if (hasMembers) {n if (value == ",") {n value = lex();nn if (value == "}") {n // Unexpected trailing `,` in object literal.n abort();n }n } else {n // A `,` must separate each object member.n abort();n }n } // Leading commas are not permitted, object property names must ben // double-quoted strings, and a `:` must separate each propertyn // name and value.nnn if (value == "," || typeof value != "string" || (charIndexBuggy ? value.charAt(0) : value) != "@" || lex() != ":") {n abort();n }nn results = get(lex());n }nn return results;n } // Unexpected token encountered.nnn abort();n }nn return value;n }; // Internal: Updates a traversed object member.nnn var update = function update(source, property, callback) {n var element = walk(source, property, callback);nn if (element === undef) {n delete source;n } else {n source = element;n }n }; // Internal: Recursively traverses a parsed JSON object, invoking then // `callback` function for each value. This is an implementation of then // `Walk(holder, name)` operation defined in ES 5.1 section 15.12.2.nnn var walk = function walk(source, property, callback) {n var value = source,n length;nn if (_typeof2(value) == "object" && value) {n // `forEach` can't be used to traverse an array in Opera <= 8.54n // because its `Object#hasOwnProperty` implementation returns `false`n // for array indices (e.g., `![1, 2, 3].hasOwnProperty("0")`).n if (getClass.call(value) == arrayClass) {n for (length = value.length; length–;) {n update(value, length, callback);n }n } else {n _forEach(value, function (property) {n update(value, property, callback);n });n }n }nn return callback.call(source, property, value);n }; // Public: `JSON.parse`. See ES 5.1 section 15.12.2.nnn exports.parse = function (source, callback) {n var result, value;n Index = 0;n Source = "" + source;n result = get(lex()); // If a JSON string contains multiple tokens, it is invalid.nn if (lex() != "$") {n abort();n } // Reset the parser state.nnn Index = Source = null;n return callback && getClass.call(callback) == functionClass ? walk((value = {}, value = result, value), "", callback) : result;n };n }n }nn exports = runInContext;n return exports;n }nn if (freeExports && !isLoader) {n // Export for CommonJS environments.n runInContext(root, freeExports);n } else {n // Export for web browsers and JavaScript engines.n var nativeJSON = root.JSON,n previousJSON = root,n isRestored = false;n var JSON3 = runInContext(root, root = {n // Public: Restores the original value of the global `JSON` object andn // returns a reference to the `JSON3` object.n "noConflict": function noConflict() {n if (!isRestored) {n isRestored = true;n root.JSON = nativeJSON;n root = previousJSON;n nativeJSON = previousJSON = null;n }nn return JSON3;n }n });n root.JSON = {n "parse": JSON3.parse,n "stringify": JSON3.stringifyn };n } // Export for asynchronous module loaders.nnn if (isLoader) {n define(function () {n return JSON3;n });n }n }).call(this);n }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});n }, {}],n 59: [function (require, module, exports) {n 'use strict';nn var has = Object.prototype.hasOwnProperty;n /**n * Decode a URI encoded string.n *n * @param {String} input The URI encoded string.n * @returns {String} The decoded string.n * @api privaten */nn function decode(input) {n return decodeURIComponent(input.replace(/+/g, ' '));n }n /**n * Simple query string parser.n *n * @param {String} query The query string that needs to be parsed.n * @returns {Object}n * @api publicn */nnn function querystring(query) {n var parser = /([^=?&]+)=?([^&]*)/g,n result = {},n part;nn while (part = parser.exec(query)) {n var key = decode(part),n value = decode(part); //n // Prevent overriding of existing properties. This ensures that build-inn // methods like `toString` or __proto__ are not overriden by maliciousn // querystrings.n //nn if (key in result) continue;n result = value;n }nn return result;n }n /**n * Transform a query string to an object.n *n * @param {Object} obj Object that should be transformed.n * @param {String} prefix Optional prefix.n * @returns {String}n * @api publicn */nnn function querystringify(obj, prefix) {n prefix = prefix || '';n var pairs = []; //n // Optionally prefix with a '?' if neededn //nn if ('string' !== typeof prefix) prefix = '?';nn for (var key in obj) {n if (has.call(obj, key)) {n pairs.push(encodeURIComponent(key) + '=' + encodeURIComponent(obj));n }n }nn return pairs.length ? prefix + pairs.join('&') : '';n } //n // Expose the module.n //nnn exports.stringify = querystringify;n exports.parse = querystring;n }, {}],n 60: [function (require, module, exports) {n 'use strict';n /**n * Check if we're required to add a port number.n *n * @see url.spec.whatwg.org/#default-portn * @param {Number|String} port Port number we need to checkn * @param {String} protocol Protocol we need to check against.n * @returns {Boolean} Is it a default port for the given protocoln * @api privaten */nn module.exports = function required(port, protocol) {n protocol = protocol.split(‘:’);n port = +port;n if (!port) return false;nn switch (protocol) {n case 'http':n case 'ws':n return port !== 80;nn case 'https':n case 'wss':n return port !== 443;nn case 'ftp':n return port !== 21;nn case 'gopher':n return port !== 70;nn case 'file':n return false;n }nn return port !== 0;n };n }, {}],n 61: [function (require, module, exports) {n (function (global) {n 'use strict';nn var required = require('requires-port'),n qs = require('querystringify'),n protocolre = /^([a-z]*:)?(\/\/)?([\S\s]*)/i,n slashes = /^[A-Za-z]*:\/\//;n /**n * These are the parse rules for the URL parser, it informs the parsern * about:n *n * 0. The char it Needs to parse, if it's a string it should be done usingn * indexOf, RegExp using exec and NaN means set as current value.n * 1. The property we should set when parsing this value.n * 2. Indication if it's backwards or forward parsing, when set as number it'sn * the value of extra chars that should be split off.n * 3. Inherit from location if non existing in the parser.n * 4. `toLowerCase` the resulting value.n */nnn var rules = [['#', 'hash'], // Extract from the back.n ['?', 'query'], // Extract from the back.n function sanitize(address) {n // Sanitize what is left of the addressn return address.replace('\\', '/');n }, ['/', 'pathname'], // Extract from the back.n ['@', 'auth', 1], // Extract from the front.n [NaN, 'host', undefined, 1, 1], // Set left over value.n [/:(\d+)$/, 'port', undefined, 1], // RegExp the back.n [NaN, 'hostname', undefined, 1, 1] // Set left over.n ];n /**n * These properties should not be copied or inherited from. This is only neededn * for all non blob URL's as a blob URL does not include a hash, only then * origin.n *n * @type {Object}n * @privaten */nn var ignore = {n hash: 1,n query: 1n };n /**n * The location object differs when your code is loaded through a normal page,n * Worker or through a worker using a blob. And with the blobble begins then * trouble as the location object will contain the URL of the blob, not then * location of the page where our code is loaded in. The actual origin isn * encoded in the `pathname` so we can thankfully generate a good "default"n * location from it so we can generate proper relative URL's again.n *n * @param {Object|String} loc Optional default location object.n * @returns {Object} lolcation object.n * @publicn */nn function lolcation(loc) {n var location = global && global.location || {};n loc = loc || location;nn var finaldestination = {},n type = _typeof2(loc),n key;nn if ('blob:' === loc.protocol) {n finaldestination = new Url(unescape(loc.pathname), {});n } else if ('string' === type) {n finaldestination = new Url(loc, {});nn for (key in ignore) {n delete finaldestination;n }n } else if ('object' === type) {n for (key in loc) {n if (key in ignore) continue;n finaldestination = loc;n }nn if (finaldestination.slashes === undefined) {n finaldestination.slashes = slashes.test(loc.href);n }n }nn return finaldestination;n }n /**n * @typedef ProtocolExtractn * @type Objectn * @property {String} protocol Protocol matched in the URL, in lowercase.n * @property {Boolean} slashes `true` if protocol is followed by "//", else `false`.n * @property {String} rest Rest of the URL that is not part of the protocol.n */nn /**n * Extract protocol information from a URL with/without double slash ("//").n *n * @param {String} address URL we want to extract from.n * @return {ProtocolExtract} Extracted information.n * @privaten */nnn function extractProtocol(address) {n var match = protocolre.exec(address);n return {n protocol: match ? match.toLowerCase() : '',n slashes: !!match,n rest: matchn };n }n /**n * Resolve a relative URL pathname against a base URL pathname.n *n * @param {String} relative Pathname of the relative URL.n * @param {String} base Pathname of the base URL.n * @return {String} Resolved pathname.n * @privaten */nnn function resolve(relative, base) {n var path = (base || '/').split('/').slice(0, -1).concat(relative.split('/')),n i = path.length,n last = path[i - 1],n unshift = false,n up = 0;nn while (i–) {n if (path === '.') {n path.splice(i, 1);n } else if (path === '..') {n path.splice(i, 1);n up++;n } else if (up) {n if (i === 0) unshift = true;n path.splice(i, 1);n up–;n }n }nn if (unshift) path.unshift('');n if (last === '.' || last === '..') path.push('');n return path.join('/');n }n /**n * The actual URL instance. Instead of returning an object we've opted-in ton * create an actual constructor as it's much more memory efficient andn * faster and it pleases my OCD.n *n * It is worth noting that we should not use `URL` as class name to preventn * clashes with the global URL instance that got introduced in browsers.n *n * @constructorn * @param {String} address URL we want to parse.n * @param {Object|String} location Location defaults for relative paths.n * @param {Boolean|Function} parser Parser for the query string.n * @privaten */nnn function Url(address, location, parser) {n if (!(this instanceof Url)) {n return new Url(address, location, parser);n }nn var relative,n extracted,n parse,n instruction,n index,n key,n instructions = rules.slice(),n type = _typeof2(location),n url = this,n i = 0; //n // The following if statements allows this module two have compatibility withn // 2 different API:n //n // 1. Node.js's `url.parse` api which accepts a URL, boolean as argumentsn // where the boolean indicates that the query string should also be parsed.n //n // 2. The `URL` interface of the browser which accepts a URL, object asn // arguments. The supplied object will be used as default values / fall-backn // for relative paths.n //nnn if ('object' !== type && 'string' !== type) {n parser = location;n location = null;n }nn if (parser && 'function' !== typeof parser) parser = qs.parse;n location = lolcation(location); //n // Extract protocol information before running the instructions.n //nn extracted = extractProtocol(address || '');n relative = !extracted.protocol && !extracted.slashes;n url.slashes = extracted.slashes || relative && location.slashes;n url.protocol = extracted.protocol || location.protocol || '';n address = extracted.rest; //n // When the authority component is absent the URL starts with a pathn // component.n //nn if (!extracted.slashes) instructions = [/(.*)/, 'pathname'];nn for (; i < instructions.length; i++) {n instruction = instructions;nn if (typeof instruction === 'function') {n address = instruction(address);n continue;n }nn parse = instruction;n key = instruction;nn if (parse !== parse) {n url = address;n } else if ('string' === typeof parse) {n if (~(index = address.indexOf(parse))) {n if ('number' === typeof instruction) {n url = address.slice(0, index);n address = address.slice(index + instruction);n } else {n url = address.slice(index);n address = address.slice(0, index);n }n }n } else if (index = parse.exec(address)) {n url = index;n address = address.slice(0, index.index);n }nn url = url || (relative && instruction ? location || '' : ''); //n // Hostname, host and protocol should be lowercased so they can be used ton // create a proper `origin`.n //nn if (instruction) url = url.toLowerCase();n } //n // Also parse the supplied query string in to an object. If we're suppliedn // with a custom parser as function use that instead of the default build-inn // parser.n //nnn if (parser) url.query = parser(url.query); //n // If the URL is relative, resolve the pathname against the base URL.n //nn if (relative && location.slashes && url.pathname.charAt(0) !== '/' && (url.pathname !== '' || location.pathname !== '')) {n url.pathname = resolve(url.pathname, location.pathname);n } //n // We should not add port numbers if they are already the default port numbern // for a given protocol. As the host also contains the port number we're goingn // override it with the hostname which contains no port number.n //nnn if (!required(url.port, url.protocol)) {n url.host = url.hostname;n url.port = '';n } //n // Parse down the `auth` for the username and password.n //nnn url.username = url.password = '';nn if (url.auth) {n instruction = url.auth.split(':');n url.username = instruction || '';n url.password = instruction || '';n }nn url.origin = url.protocol && url.host && url.protocol !== 'file:' ? url.protocol + '//' + url.host : 'null'; //n // The href is just the compiled result.n //nn url.href = url.toString();n }n /**n * This is convenience method for changing properties in the URL instance ton * insure that they all propagate correctly.n *n * @param {String} part Property we need to adjust.n * @param {Mixed} value The newly assigned value.n * @param {Boolean|Function} fn When setting the query, it will be the functionn * used to parse the query.n * When setting the protocol, double slash will ben * removed from the final url if it is true.n * @returns {URL} URL instance for chaining.n * @publicn */nnn function set(part, value, fn) {n var url = this;nn switch (part) {n case 'query':n if ('string' === typeof value && value.length) {n value = (fn || qs.parse)(value);n }nn url = value;n break;nn case 'port':n url = value;nn if (!required(value, url.protocol)) {n url.host = url.hostname;n url = '';n } else if (value) {n url.host = url.hostname + ':' + value;n }nn break;nn case 'hostname':n url = value;n if (url.port) value += ':' + url.port;n url.host = value;n break;nn case 'host':n url = value;nn if (/:\d+$/.test(value)) {n value = value.split(':');n url.port = value.pop();n url.hostname = value.join(':');n } else {n url.hostname = value;n url.port = '';n }nn break;nn case 'protocol':n url.protocol = value.toLowerCase();n url.slashes = !fn;n break;nn case 'pathname':n case 'hash':n if (value) {n var _char = part === 'pathname' ? '/' : '#';nn url = value.charAt(0) !== _char ? _char + value : value;n } else {n url = value;n }nn break;nn default:n url = value;n }nn for (var i = 0; i < rules.length; i++) {n var ins = rules;n if (ins) url[ins] = url[ins].toLowerCase();n }nn url.origin = url.protocol && url.host && url.protocol !== 'file:' ? url.protocol + '//' + url.host : 'null';n url.href = url.toString();n return url;n }n /**n * Transform the properties back in to a valid and full URL string.n *n * @param {Function} stringify Optional query stringify function.n * @returns {String} Compiled version of the URL.n * @publicn */nnn function toString(stringify) {n if (!stringify || 'function' !== typeof stringify) stringify = qs.stringify;n var query,n url = this,n protocol = url.protocol;n if (protocol && protocol.charAt(protocol.length - 1) !== ':') protocol += ':';n var result = protocol + (url.slashes ? '//' : '');nn if (url.username) {n result += url.username;n if (url.password) result += ':' + url.password;n result += '@';n }nn result += url.host + url.pathname;n query = 'object' === _typeof2(url.query) ? stringify(url.query) : url.query;n if (query) result += '?' !== query.charAt(0) ? '?' + query : query;n if (url.hash) result += url.hash;n return result;n }nn Url.prototype = {n set: set,n toString: toStringn }; //n // Expose the URL parser and some additional properties that might be useful forn // others or testing.n //nn Url.extractProtocol = extractProtocol;n Url.location = lolcation;n Url.qs = qs;n module.exports = Url;n }).call(this, typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {});n }, {n "querystringify": 59,n "requires-port": 60n }]n }, {}, [1])(1);n});”,“map”:null,“metadata”:{},“sourceType”:“module”}