diff --git a/vendor/sockjs/.bower.json b/vendor/sockjs/.bower.json deleted file mode 100644 index 1c3ebf4ee..000000000 --- a/vendor/sockjs/.bower.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "sockjs", - "version": "0.3.4", - "main": "sockjs.js", - "ignore": [ - "**/.*", - "node_modules", - "components" - ], - "homepage": "https://github.com/myguidingstar/bower-sockjs", - "_release": "0.3.4", - "_resolution": { - "type": "version", - "tag": "0.3.4", - "commit": "ae96e770ab85caf9073a8806a9dcd7c0ce316623" - }, - "_source": "git://github.com/myguidingstar/bower-sockjs.git", - "_target": "~0.3.2", - "_originalSource": "sockjs" -} \ No newline at end of file diff --git a/vendor/sockjs/component.json b/vendor/sockjs/component.json deleted file mode 100644 index 80139f70e..000000000 --- a/vendor/sockjs/component.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "sockjs", - "version": "0.3.4", - "main": "sockjs.js", - "ignore": [ - "**/.*", - "node_modules", - "components" - ] -} \ No newline at end of file diff --git a/vendor/sockjs/sockjs.js b/vendor/sockjs/sockjs.js index 1296de327..f168d5f7b 100644 --- a/vendor/sockjs/sockjs.js +++ b/vendor/sockjs/sockjs.js @@ -1,5 +1,5 @@ -/* sockjs-client v1.0.3 | http://sockjs.org | MIT license */ -!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.SockJS=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o= v31? // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages - (navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31); + (typeof navigator !== 'undefined' && navigator && 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 worker + (typeof navigator !== 'undefined' && navigator && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); } /** @@ -3760,7 +3792,11 @@ function useColors() { */ exports.formatters.j = function(v) { - return JSON.stringify(v); + try { + return JSON.stringify(v); + } catch (err) { + return '[UnexpectedJSONParseError]: ' + err.message; + } }; @@ -3770,8 +3806,7 @@ exports.formatters.j = function(v) { * @api public */ -function formatArgs() { - var args = arguments; +function formatArgs(args) { var useColors = this.useColors; args[0] = (useColors ? '%c' : '') @@ -3781,17 +3816,17 @@ function formatArgs() { + (useColors ? '%c ' : ' ') + '+' + exports.humanize(this.diff); - if (!useColors) return args; + if (!useColors) return; var c = 'color: ' + this.color; - args = [args[0], c, 'color: inherit'].concat(Array.prototype.slice.call(args, 1)); + args.splice(1, 0, c, 'color: inherit') // the final "%c" is somewhat tricky, because there could be other // arguments passed either before or after the %c, so we need to // figure out the correct index to insert the CSS into var index = 0; var lastC = 0; - args[0].replace(/%[a-z%]/g, function(match) { + args[0].replace(/%[a-zA-Z%]/g, function(match) { if ('%%' === match) return; index++; if ('%c' === match) { @@ -3802,7 +3837,6 @@ function formatArgs() { }); args.splice(lastC, 0, c); - return args; } /** @@ -3830,9 +3864,9 @@ function log() { function save(namespaces) { try { if (null == namespaces) { - storage.removeItem('debug'); + exports.storage.removeItem('debug'); } else { - storage.debug = namespaces; + exports.storage.debug = namespaces; } } catch(e) {} } @@ -3845,11 +3879,14 @@ function save(namespaces) { */ function load() { - var r; try { - r = storage.debug; + return exports.storage.debug; } catch(e) {} - return r; + + // If debug isn't set in LS, and we're in Electron, try to load $DEBUG + if (typeof process !== 'undefined' && 'env' in process) { + return process.env.DEBUG; + } } /** @@ -3869,12 +3906,14 @@ exports.enable(load()); * @api private */ -function localstorage(){ +function localstorage() { try { return window.localStorage; } catch (e) {} } +}).call(this,{ env: {} }) + },{"./debug":55}],55:[function(require,module,exports){ /** @@ -3884,7 +3923,7 @@ function localstorage(){ * Expose `debug()` as the module. */ -exports = module.exports = debug; +exports = module.exports = createDebug.debug = createDebug.default = createDebug; exports.coerce = coerce; exports.disable = disable; exports.enable = enable; @@ -3901,17 +3940,11 @@ exports.skips = []; /** * Map of special "%n" handling functions, for the debug "format" argument. * - * Valid key names are a single, lowercased letter, i.e. "n". + * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". */ exports.formatters = {}; -/** - * Previously assigned color. - */ - -var prevColor = 0; - /** * Previous log timestamp. */ @@ -3920,13 +3953,20 @@ var prevTime; /** * Select a color. - * + * @param {String} namespace * @return {Number} * @api private */ -function selectColor() { - return exports.colors[prevColor++ % exports.colors.length]; +function selectColor(namespace) { + var hash = 0, i; + + for (i in namespace) { + hash = ((hash << 5) - hash) + namespace.charCodeAt(i); + hash |= 0; // Convert to 32bit integer + } + + return exports.colors[Math.abs(hash) % exports.colors.length]; } /** @@ -3937,17 +3977,13 @@ function selectColor() { * @api public */ -function debug(namespace) { +function createDebug(namespace) { - // define the `disabled` version - function disabled() { - } - disabled.enabled = false; + function debug() { + // disabled? + if (!debug.enabled) return; - // define the `enabled` version - function enabled() { - - var self = enabled; + var self = debug; // set `diff` timestamp var curr = +new Date(); @@ -3957,22 +3993,22 @@ function debug(namespace) { self.curr = curr; prevTime = curr; - // add the `color` if not set - if (null == self.useColors) self.useColors = exports.useColors(); - if (null == self.color && self.useColors) self.color = selectColor(); - - var args = Array.prototype.slice.call(arguments); + // turn the `arguments` into a proper Array + var args = new Array(arguments.length); + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i]; + } args[0] = exports.coerce(args[0]); if ('string' !== typeof args[0]) { - // anything else let's inspect with %o - args = ['%o'].concat(args); + // anything else let's inspect with %O + args.unshift('%O'); } // apply any `formatters` transformations var index = 0; - args[0] = args[0].replace(/%([a-z%])/g, function(match, format) { + args[0] = args[0].replace(/%([a-zA-Z%])/g, function(match, format) { // if we encounter an escaped % then don't increase the array index if (match === '%%') return match; index++; @@ -3988,19 +4024,24 @@ function debug(namespace) { return match; }); - if ('function' === typeof exports.formatArgs) { - args = exports.formatArgs.apply(self, args); - } - var logFn = enabled.log || exports.log || console.log.bind(console); + // apply env-specific formatting (colors, etc.) + exports.formatArgs.call(self, args); + + var logFn = debug.log || exports.log || console.log.bind(console); logFn.apply(self, args); } - enabled.enabled = true; - var fn = exports.enabled(namespace) ? enabled : disabled; + debug.namespace = namespace; + debug.enabled = exports.enabled(namespace); + debug.useColors = exports.useColors(); + debug.color = selectColor(namespace); - fn.namespace = namespace; + // env-specific initialization logic for debug instances + if ('function' === typeof exports.init) { + exports.init(debug); + } - return fn; + return debug; } /** @@ -4074,132 +4115,7 @@ function coerce(val) { return val; } -},{"ms":56}],56:[function(require,module,exports){ -/** - * Helpers. - */ - -var s = 1000; -var m = s * 60; -var h = m * 60; -var d = h * 24; -var y = d * 365.25; - -/** - * Parse or format the given `val`. - * - * Options: - * - * - `long` verbose formatting [false] - * - * @param {String|Number} val - * @param {Object} options - * @return {String|Number} - * @api public - */ - -module.exports = function(val, options){ - options = options || {}; - if ('string' == typeof val) return parse(val); - return options.long - ? long(val) - : short(val); -}; - -/** - * Parse the given `str` and return milliseconds. - * - * @param {String} str - * @return {Number} - * @api private - */ - -function parse(str) { - var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(str); - if (!match) return; - var n = parseFloat(match[1]); - var type = (match[2] || 'ms').toLowerCase(); - switch (type) { - case 'years': - case 'year': - case 'yrs': - case 'yr': - case 'y': - return n * y; - case 'days': - case 'day': - case 'd': - return n * d; - case 'hours': - case 'hour': - case 'hrs': - case 'hr': - case 'h': - return n * h; - case 'minutes': - case 'minute': - case 'mins': - case 'min': - case 'm': - return n * m; - case 'seconds': - case 'second': - case 'secs': - case 'sec': - case 's': - return n * s; - case 'milliseconds': - case 'millisecond': - case 'msecs': - case 'msec': - case 'ms': - return n; - } -} - -/** - * Short format for `ms`. - * - * @param {Number} ms - * @return {String} - * @api private - */ - -function short(ms) { - if (ms >= d) return Math.round(ms / d) + 'd'; - if (ms >= h) return Math.round(ms / h) + 'h'; - if (ms >= m) return Math.round(ms / m) + 'm'; - if (ms >= s) return Math.round(ms / s) + 's'; - return ms + 'ms'; -} - -/** - * Long format for `ms`. - * - * @param {Number} ms - * @return {String} - * @api private - */ - -function long(ms) { - return plural(ms, d, 'day') - || plural(ms, h, 'hour') - || plural(ms, m, 'minute') - || plural(ms, s, 'second') - || ms + ' ms'; -} - -/** - * Pluralization helper. - */ - -function plural(ms, n, name) { - if (ms < n) return; - if (ms < n * 1.5) return Math.floor(ms / n) + ' ' + name; - return Math.ceil(ms / n) + ' ' + name + 's'; -} - -},{}],57:[function(require,module,exports){ +},{"ms":58}],56:[function(require,module,exports){ if (typeof Object.create === 'function') { // implementation from standard node.js 'util' module module.exports = function inherits(ctor, superCtor) { @@ -4224,7 +4140,7 @@ if (typeof Object.create === 'function') { } } -},{}],58:[function(require,module,exports){ +},{}],57:[function(require,module,exports){ (function (global){ /*! JSON v3.3.2 | http://bestiejs.github.io/json3 | Copyright 2012-2014, Kit Cambridge | http://kit.mit-license.org */ ;(function () { @@ -5130,289 +5046,159 @@ if (typeof Object.create === 'function') { }).call(this); }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9qc29uMy9saWIvanNvbjMuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBO0FBQ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1wbGUgcGFyc2luZyB0ZXN0LlxuICAgICAgICAgICAgICAgIHZhbHVlID0gcGFyc2Uoc2VyaWFsaXplZCk7XG4gICAgICAgICAgICAgICAgdmFyIHBhcnNlU3VwcG9ydGVkID0gdmFsdWVbXCJhXCJdLmxlbmd0aCA9PSA1ICYmIHZhbHVlW1wiYVwiXVswXSA9PT0gMTtcbiAgICAgICAgICAgICAgICBpZiAocGFyc2VTdXBwb3J0ZWQpIHtcbiAgICAgICAgICAgICAgICAgIHRyeSB7XG4gICAgICAgICAgICAgICAgICAgIC8vIFNhZmFyaSA8PSA1LjEuMiBhbmQgRkYgMy4xYjEgYWxsb3cgdW5lc2NhcGVkIHRhYnMgaW4gc3RyaW5ncy5cbiAgICAgICAgICAgICAgICAgICAgcGFyc2VTdXBwb3J0ZWQgPSAhcGFyc2UoJ1wiXFx0XCInKTtcbiAgICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGV4Y2VwdGlvbikge31cbiAgICAgICAgICAgICAgICAgIGlmIChwYXJzZVN1cHBvcnRlZCkge1xuICAgICAgICAgICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAgICAgICAgIC8vIEZGIDQuMCBhbmQgNC4wLjEgYWxsb3cgbGVhZGluZyBgK2Agc2lnbnMgYW5kIGxlYWRpbmdcbiAgICAgICAgICAgICAgICAgICAgICAvLyBkZWNpbWFsIHBvaW50cy4gRkYgNC4wLCA0LjAuMSwgYW5kIElFIDktMTAgYWxzbyBhbGxvd1xuICAgICAgICAgICAgICAgICAgICAgIC8vIGNlcnRhaW4gb2N0YWwgbGl0ZXJhbHMuXG4gICAgICAgICAgICAgICAgICAgICAgcGFyc2VTdXBwb3J0ZWQgPSBwYXJzZShcIjAxXCIpICE9PSAxO1xuICAgICAgICAgICAgICAgICAgICB9IGNhdGNoIChleGNlcHRpb24pIHt9XG4gICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICBpZiAocGFyc2VTdXBwb3J0ZWQpIHtcbiAgICAgICAgICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgICAgICAgICAvLyBGRiA0LjAsIDQuMC4xLCBhbmQgUmhpbm8gMS43UjMtUjQgYWxsb3cgdHJhaWxpbmcgZGVjaW1hbFxuICAgICAgICAgICAgICAgICAgICAgIC8vIHBvaW50cy4gVGhlc2UgZW52aXJvbm1lbnRzLCBhbG9uZyB3aXRoIEZGIDMuMWIxIGFuZCAyLFxuICAgICAgICAgICAgICAgICAgICAgIC8vIGFsc28gYWxsb3cgdHJhaWxpbmcgY29tbWFzIGluIEpTT04gb2JqZWN0cyBhbmQgYXJyYXlzLlxuICAgICAgICAgICAgICAgICAgICAgIHBhcnNlU3VwcG9ydGVkID0gcGFyc2UoXCIxLlwiKSAhPT0gMTtcbiAgICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZXhjZXB0aW9uKSB7fVxuICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSBjYXRjaCAoZXhjZXB0aW9uKSB7XG4gICAgICAgICAgICAgIHBhcnNlU3VwcG9ydGVkID0gZmFsc2U7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICAgIGlzU3VwcG9ydGVkID0gcGFyc2VTdXBwb3J0ZWQ7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICAgIHJldHVybiBoYXNbbmFtZV0gPSAhIWlzU3VwcG9ydGVkO1xuICAgIH1cblxuICAgIGlmICghaGFzKFwianNvblwiKSkge1xuICAgICAgLy8gQ29tbW9uIGBbW0NsYXNzXV1gIG5hbWUgYWxpYXNlcy5cbiAgICAgIHZhciBmdW5jdGlvbkNsYXNzID0gXCJbb2JqZWN0IEZ1bmN0aW9uXVwiLFxuICAgICAgICAgIGRhdGVDbGFzcyA9IFwiW29iamVjdCBEYXRlXVwiLFxuICAgICAgICAgIG51bWJlckNsYXNzID0gXCJbb2JqZWN0IE51bWJlcl1cIixcbiA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ICAgY2FsbGJhY2socHJvcGVydHkpO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAvLyBObyBidWdzIGRldGVjdGVkOyB1c2UgdGhlIHN0YW5kYXJkIGBmb3IuLi5pbmAgYWxnb3JpdGhtLlxuICAgICAgICAgIGZvckVhY2ggPSBmdW5jdGlvbiAob2JqZWN0LCBjYWxsYmFjaykge1xuICAgICAgICAgICAgdmFyIGlzRnVuY3Rpb24gPSBnZXRDbGFzcy5jYWxsKG9iamVjdCkgPT0gZnVuY3Rpb25DbGFzcywgcHJvcGVydHksIGlzQ29uc3RydWN0b3I7XG4gICAgICAgICAgICBmb3IgKHByb3BlcnR5IGluIG9iamVjdCkge1xuICAgICAgICAgICAgICBpZiAoIShpc0Z1bmN0aW9uICYmIHByb3BlcnR5ID09IFwicHJvdG90eXBlXCIpICYmIGlzUHJvcGVydHkuY2FsbChvYmplY3QsIHByb3BlcnR5KSAmJiAhKGlzQ29uc3RydWN0b3IgPSBwcm9wZXJ0eSA9PT0gXCJjb25zdHJ1Y3RvclwiKSkge1xuICAgICAgICAgICAgICAgIGNhbGxiYWNrKHByb3BlcnR5KTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgLy8gTWFudWFsbHkgaW52b2tlIHRoZSBjYWxsYmFjayBmb3IgdGhlIGBjb25zdHJ1Y3RvcmAgcHJvcGVydHkgZHVlIHRvXG4gICAgICAgICAgICAvLyBjcm9zcy1lbnZpcm9ubWVudCBpbmNvbnNpc3RlbmNpZXMuXG4gICAgICAgICAgICBpZiAoaXNDb25zdHJ1Y3RvciB8fCBpc1Byb3BlcnR5LmNhbGwob2JqZWN0LCAocHJvcGVydHkgPSBcImNvbnN0cnVjdG9yXCIpKSkge1xuICAgICAgICAgICAgICBjYWxsYmFjayhwcm9wZXJ0eSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICA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KHRpbWUgLyAxZTMpICUgNjA7XG4gICAgICAgICAgICAgICAgICBtaWxsaXNlY29uZHMgPSB0aW1lICUgMWUzO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICB5ZWFyID0gdmFsdWUuZ2V0VVRDRnVsbFllYXIoKTtcbiAgICAgICAgICAgICAgICAgIG1vbnRoID0gdmFsdWUuZ2V0VVRDTW9udGgoKTtcbiAgICAgICAgICAgICAgICAgIGRhdGUgPSB2YWx1ZS5nZXRVVENEYXRlKCk7XG4gICAgICAgICAgICAgICAgICBob3VycyA9IHZhbHVlLmdldFVUQ0hvdXJzKCk7XG4gICAgICAgICAgICAgICAgICBtaW51dGVzID0gdmFsdWUuZ2V0VVRDTWludXRlcygpO1xuICAgICAgICAgICAgICAgICAgc2Vjb25kcyA9IHZhbHVlLmdldFVUQ1NlY29uZHMoKTtcbiAgICAgICAgICAgICAgICAgIG1pbGxpc2Vjb25kcyA9IHZhbHVlLmdldFVUQ01pbGxpc2Vjb25kcygpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAvLyBTZXJpYWxpemUgZXh0ZW5kZWQgeWVhcnMgY29ycmVjdGx5LlxuICAgICAgICAgICAgICAgIHZhbHVlID0gKHllYXIgPD0gMCB8fCB5ZWFyID49IDFlNCA/ICh5ZWFyIDwgMCA/IFwiLVwiIDogXCIrXCIpICsgdG9QYWRkZWRTdHJpbmcoNiwgeWVhciA8IDAgPyAteWVhciA6IHllYXIpIDogdG9QYWRkZWRTdHJpbmcoNCwgeWVhcikpICtcbiAgICAgICAgICAgICAgICAgIFwiLVwiICsgdG9QYWRkZWRTdHJpbmcoMiwgbW9udGggKyAxKSArIFwiLVwiICsgdG9QYWRkZWRTdHJpbmcoMiwgZGF0ZSkgK1xuICAgICAgICAgICAgICAgICAgLy8gTW9udGhzLCBkYXRlcywgaG91cnMsIG1pbnV0ZXMsIGFuZCBzZWNvbmRzIHNob3VsZCBoYXZlIHR3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AgICAgICAgICAgICAvLyBTa2lwIHdoaXRlc3BhY2UgdG9rZW5zLCBpbmNsdWRpbmcgdGFicywgY2FycmlhZ2UgcmV0dXJucywgbGluZVxuICAgICAgICAgICAgICAgIC8vIGZlZWRzLCBhbmQgc3BhY2UgY2hhcmFjdGVycy5cbiAgICAgICAgICAgICAgICBJbmRleCsrO1xuICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICBjYXNlIDEyMzogY2FzZSAxMjU6IGNhc2UgOTE6IGNhc2UgOTM6IGNhc2UgNTg6IGNhc2UgNDQ6XG4gICAgICAgICAgICAgICAgLy8gUGFyc2UgYSBwdW5jdHVhdG9yIHRva2VuIChge2AsIGB9YCwgYFtgLCBgXWAsIGA6YCwgb3IgYCxgKSBhdFxuICAgICAgICAgICAgICAgIC8vIHRoZSBjdXJyZW50IHBvc2l0aW9uLlxuICAgICAgICAgICAgICAgIHZhbHVlID0gY2hhckluZGV4QnVnZ3kgPyBzb3VyY2UuY2hhckF0KEluZGV4KSA6IHNvdXJjZVtJbmRleF07XG4gICAgICAgICAgICAgICAgSW5kZXgrKztcbiAgICAgICAgICAgICAgICByZXR1cm4gdmFsdWU7XG4gICAgICAgICAgICAgIGNhc2UgMzQ6XG4gICAgICAgICAgICAgICAgLy8gYFwiYCBkZWxpbWl0cyBhIEpTT04gc3RyaW5nOyBhZHZhbmNlIHRvIHRoZSBuZXh0IGNoYXJhY3RlciBhbmRcbiAgICAgICAgICAgICAgICAvLyBiZWdpbiBwYXJzaW5nIHRoZSBzdHJpbmcuIFN0cmluZyB0b2tlbnMgYXJlIHByZWZpeGVkIHdpdGggdGhlXG4gICAgICAgICAgICAgICAgLy8gc2VudGluZWwgYEBgIGNoYXJhY3RlciB0byBkaXN0aW5ndWlzaCB0aGVtIGZyb20gcHVuY3R1YXRvcnMgYW5kXG4gICAgICAgICAgICAgICAgLy8gZW5kLW9mLXN0cmluZyB0b2tlbnMuXG4gICAgICAgICAgICAgICAgZm9yICh2YW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lxuICAgICAgICAgICAgICAgICAgICAgICAgdmFsdWUgKz0gVW5lc2NhcGVzW2NoYXJDb2RlXTtcbiAgICAgICAgICAgICAgICAgICAgICAgIEluZGV4Kys7XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgICBjYXNlIDExNzpcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIGBcXHVgIG1hcmtzIHRoZSBiZWdpbm5pbmcgb2YgYSBVbmljb2RlIGVzY2FwZSBzZXF1ZW5jZS5cbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIEFkdmFuY2UgdG8gdGhlIGZpcnN0IGNoYXJhY3RlciBhbmQgdmFsaWRhdGUgdGhlXG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBmb3VyLWRpZ2l0IGNvZGUgcG9pbnQuXG4gICAgICAgICAgICAgICAgICAgICAgICBiZWdpbiA9ICsrSW5kZXg7XG4gICAgICAgICAgICAgICAgICAgICAgICBmb3IgKHBvc2l0aW9uID0gSW5kZXggKyA0OyBJbmRleCA8IHBvc2l0aW9uOyBJbmRleCsrKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgIGNoYXJDb2RlID0gc291cmNlLmNoYXJDb2RlQXQoSW5kZXgpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBBIHZhbGlkIHNlcXVlbmNlIGNvbXByaXNlcyBmb3VyIGhleGRpZ2l0cyAoY2FzZS1cbiAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gaW5zZW5zaXRpdmUpIHRoYXQgZm9ybSBhIHNpbmdsZSBoZXhhZGVjaW1hbCB2YWx1ZS5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCEoY2hhckNvZGUgPj0gNDggJiYgY2hhckNvZGUgPD0gNTcgfHwgY2hhckNvZGUgPj0gOTcgJiYgY2hhckNvZGUgPD0gMTAyIHx8IGNoYXJDb2RlID49IDY1ICYmIGNoYXJDb2RlIDw9IDcwKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIEludmFsaWQgVW5pY29kZSBlc2NhcGUgc2VxdWVuY2UuXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYWJvcnQoKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgLy8gUmV2aXZlIHRoZSBlc2NhcGVkIGNoYXJhY3Rlci5cbiAgICAgICAgICAgICAgICAgICAgICAgIHZhbHVlICs9IGZyb21DaGFyQ29kZShcIjB4XCIgKyBzb3VyY2Uuc2xpY2UoYmVnaW4sIEluZGV4KSk7XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgICAgICAgICAgLy8gSW52YWxpZCBlc2NhcGUgc2VxdWVuY2UuXG4gICAgICAgICAgICAgICAgICAgICAgICBhYm9ydCgpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBpZiAoY2hhckNvZGUgPT0gMzQpIHtcbiAgICAgICAgICAgICAgICAgICAgICAvLyBBbiB1bmVzY2FwZWQgZG91YmxlLXF1b3RlIGNoYXJhY3RlciBtYXJrcyB0aGUgZW5kIG9mIHRoZVxuICAgICAgICAgICAgICAgICAgICAgIC8vIHN0cmluZy5cbiAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBjaGFyQ29kZSA9IHNvdXJjZS5jaGFyQ29kZUF0KEluZGV4KTtcbiAgICAgICAgICAgICAgICAgICAgYmVnaW4gPSBJbmRleDtcbiAgICAgICAgICAgICAgICAgICAgLy8gT3B0aW1pemUgZm9yIHRoZSBjb21tb24gY2FzZSB3aGVyZSBhIHN0cmluZyBpcyB2YWxpZC5cbiAgICAgICAgICAgICAgICAgICAgd2hpbGUgKGNoYXJDb2RlID49IDMyICYmIGNoYXJDb2RlICE9IDkyICYmIGNoYXJDb2RlICE9IDM0KSB7XG4gICAgICAgICAgICAgICAgICAgICAgY2hhckNvZGUgPSBzb3VyY2UuY2hhckNvZGVBdCgrK0luZGV4KTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAvLyBBcHBlbmQgdGhlIHN0cmluZyBhcy1pcy5cbiAgICAgICAgICAgICAgICAgICAgdmFsdWUgKz0gc291cmNlLnNsaWNlKGJlZ2luLCBJbmRleCk7XG4gICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmIChzb3VyY2UuY2hhckNvZGVBdChJbmRleCkgPT0gMzQpIHtcbiAgICAgICAgICAgICAgICAgIC8vIEFkdmFuY2UgdG8gdGhlIG5leHQgY2hhcmFjdGVyIGFuZCByZXR1cm4gdGhlIHJldml2ZWQgc3RyaW5nLlxuICAgICAgICAgICAgICAgICAgSW5kZXgrKztcbiAgICAgICAgICAgICAgICAgIHJldHVybiB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgLy8gVW50ZXJtaW5hdGVkIHN0cmluZy5cbiAgICAgICAgICAgICAgICBhYm9ydCgpO1xuICAgICAgICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgICAgIC8vIFBhcnNlIG51bWJlcnMgYW5kIGxpdGVyYWxzLlxuICAgICAgICAgICAgICAgIGJlZ2luID0gSW5kZXg7XG4gICAgICAgICAgICAgICAgLy8gQWR2YW5jZSBwYXN0IHRoZSBuZWdhdGl2ZSBzaWduLCBpZiBvbmUgaXMgc3BlY2lmaWVkLlxuICAgICAgICAgICAgICAgIGlmIChjaGFyQ29kZSA9PSA0NSkge1xuICAgICAgICAgICAgICAgICAgaXNTaWduZWQgPSB0cnVlO1xuICAgICAgICAgICAgICAgICAgY2hhckNvZGUgPSBzb3VyY2UuY2hhckNvZGVBdCgrK0luZGV4KTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgLy8gUGFyc2UgYW4gaW50ZWdlciBvciBmbG9hdGluZy1wb2ludCB2YWx1ZS5cbiAgICAgICAgICAgICAgICBpZiAoY2hhckNvZGUgPj0gNDggJiYgY2hhckNvZGUgPD0gNTcpIHtcbiAgICAgICAgICAgICAgICAgIC8vIExlYWRpbmcgemVyb2VzIGFyZSBpbnRlcnByZXRlZCBhcyBvY3RhbCBsaXRlcmFscy5cbiAgICAgICAgICAgICAgICAgIGlmIChjaGFyQ29kZSA9PSA0OCAmJiAoKGNoYXJDb2RlID0gc291cmNlLmNoYXJDb2RlQXQoSW5kZXggKyAxKSksIGNoYXJDb2RlID49IDQ4ICYmIGNoYXJDb2RlIDw9IDU3KSkge1xuICAgICAgICAgICAgICAgICAgICAvLyBJbGxlZ2FsIG9jdGFsIGxpdGVyYWwuXG4gICAgICAgICAgICAgICAgICAgIGFib3J0KCk7XG4gICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICBpc1NpZ25lZCA9IGZhbHNlO1xuICAgICAgICAgICAgICAgICAgLy8gUGFyc2UgdGhlIGludGVnZXIgY29tcG9uZW50LlxuICAgICAgICAgICAgICAgICAgZm9yICg7IEluZGV4IDwgbGVuZ3RoICYmICgoY2hhckNvZGUgPSBzb3VyY2UuY2hhckNvZGVBdChJbmRleCkpLCBjaGFyQ29kZSA+PSA0OCAmJiBjaGFyQ29kZSA8PSA1Nyk7IEluZGV4KyspO1xuICAgICAgICAgICAgICAgICAgLy8gRmxvYXRzIGNhbm5vdCBjb250YWluIGEgbGVhZGluZyBkZWNpbWFsIHBvaW50OyBob3dldmVyLCB0aGlzXG4gICAgICAgICAgICAgICAgICAvLyBjYXNlIGlzIGFscmVhZHkgYWNjb3VudGVkIGZvciBieSB0aGUgcGFyc2VyLlxuICAgICAgICAgICAgICAgICAgaWYgKHNvdXJjZS5jaGFyQ29kZUF0KEluZGV4KSA9PSA0Nikge1xuICAgICAgICAgICAgICAgICAgICBwb3NpdGlvbiA9ICsrSW5kZXg7XG4gICAgICAgICAgICAgICAgICAgIC8vIFBhcnNlIHRoZSBkZWNpbWFsIGNvbXBvbmVudC5cbiAgICAgICAgICAgICAgICAgICAgZm9yICg7IHBvc2l0aW9uIDwgbGVuZ3RoICYmICgoY2hhckNvZGUgPSBzb3VyY2UuY2hhckNvZGVBdChwb3NpdGlvbikpLCBjaGFyQ29kZSA+PSA0OCAmJiBjaGFyQ29kZSA8PSA1Nyk7IHBvc2l0aW9uKyspO1xuICAgICAgICAgICAgICAgICAgICBpZiAocG9zaXRpb24gPT0gSW5kZXgpIHtcbiAgICAgICAgICAgICAgICAgICAgICAvLyBJbGxlZ2FsIHRyYWlsaW5nIGRlY2ltYWwuXG4gICAgICAgICAgICAgICAgICAgICAgYWJvcnQoKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICBJbmRleCA9IHBvc2l0aW9uO1xuICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgLy8gUGFyc2UgZXhwb25lbnRzLiBUaGUgYGVgIGRlbm90aW5nIHRoZSBleHBvbmVudCBpc1xuICAgICAgICAgICAgICAgICAgLy8gY2FzZS1pbnNlbnNpdGl2ZS5cbiAgICAgICAgICAgICAgICAgIGNoYXJDb2RlID0gc291cmNlLmNoYXJDb2RlQXQoSW5kZXgpO1xuICAgICAgICAgICAgICAgICAgaWYgKGNoYXJDb2RlID09IDEwMSB8fCBjaGFyQ29kZSA9PSA2OSkge1xuICAgICAgICAgICAgICAgICAgICBjaGFyQ29kZSA9IHNvdXJjZS5jaGFyQ29kZUF0KCsrSW5kZXgpO1xuICAgICAgICAgICAgICAgICAgICAvLyBTa2lwIHBhc3QgdGhlIHNpZ24gZm9sbG93aW5nIHRoZSBleHBvbmVudCwgaWYgb25lIGlzXG4gICAgICAgICAgICAgICAgICAgIC8vIHNwZWNpZmllZC5cbiAgICAgICAgICAgICAgICAgICAgaWYgKGNoYXJDb2RlID09IDQzIHx8IGNoYXJDb2RlID09IDQ1KSB7XG4gICAgICAgICAgICAgICAgICAgICAgSW5kZXgrKztcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAvLyBQYXJzZSB0aGUgZXhwb25lbnRpYWwgY29tcG9uZW50LlxuICAgICAgICAgICAgICAgICAgICBmb3IgKHBvc2l0aW9uID0gSW5kZXg7IHBvc2l0aW9uIDwgbGVuZ3RoICYmICgoY2hhckNvZGUgPSBzb3VyY2UuY2hhckNvZGVBdChwb3NpdGlvbikpLCBjaGFyQ29kZSA+PSA0OCAmJiBjaGFyQ29kZSA8PSA1Nyk7IHBvc2l0aW9uKyspO1xuICAgICAgICAgICAgICAgICAgICBpZiAocG9zaXRpb24gPT0gSW5kZXgpIHtcbiAgICAgICAgICAgICAgICAgICAgICAvLyBJbGxlZ2FsIGVtcHR5IGV4cG9uZW50LlxuICAgICAgICAgICAgICAgICAgICAgIGFib3J0KCk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgSW5kZXggPSBwb3NpdGlvbjtcbiAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgIC8vIENvZXJjZSB0aGUgcGFyc2VkIHZhbHVlIHRvIGEgSmF2YVNjcmlwdCBudW1iZXIuXG4gICAgICAgICAgICAgICAgICByZXR1cm4gK3NvdXJjZS5zbGljZShiZWdpbiwgSW5kZXgpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAvLyBBIG5lZ2F0aXZlIHNpZ24gbWF5IG9ubHkgcHJlY2VkZSBudW1iZXJzLlxuICAgICAgICAgICAgICAgIGlmIChpc1NpZ25lZCkge1xuICAgICAgICAgICAgICAgICAgYWJvcnQoKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgLy8gYHRydWVgLCBgZmFsc2VgLCBhbmQgYG51bGxgIGxpdGVyYWxzLlxuICAgICAgICAgICAgICAgIGlmIChzb3VyY2Uuc2xpY2UoSW5kZXgsIEluZGV4ICsgNCkgPT0gXCJ0cnVlXCIpIHtcbiAgICAgICAgICAgICAgICAgIEluZGV4ICs9IDQ7XG4gICAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTtcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKHNvdXJjZS5zbGljZShJbmRleCwgSW5kZXggKyA1KSA9PSBcImZhbHNlXCIpIHtcbiAgICAgICAgICAgICAgICAgIEluZGV4ICs9IDU7XG4gICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7XG4gICAgICAgICAgICAgICAgfSBlbHNlIGlmIChzb3VyY2Uuc2xpY2UoSW5kZXgsIEluZGV4ICsgNCkgPT0gXCJudWxsXCIpIHtcbiAgICAgICAgICAgICAgICAgIEluZGV4ICs9IDQ7XG4gICAgICAgICAgICAgICAgICByZXR1cm4gbnVsbDtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgLy8gVW5yZWNvZ25pemVkIHRva2VuLlxuICAgICAgICAgICAgICAgIGFib3J0KCk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICAgIC8vIFJldHVybiB0aGUgc2VudGluZWwgYCRgIGNoYXJhY3RlciBpZiB0aGUgcGFyc2VyIGhhcyByZWFjaGVkIHRoZSBlbmRcbiAgICAgICAgICAvLyBvZiB0aGUgc291cmNlIHN0cmluZy5cbiAgICAgICAgICByZXR1cm4gXCIkXCI7XG4gICAgICAgIH07XG5cbiAgICAgICAgLy8gSW50ZXJuYWw6IFBhcnNlcyBhIEpTT04gYHZhbHVlYCB0b2tlbi5cbiAgICAgICAgdmFyIGdldCA9IGZ1bmN0aW9uICh2YWx1ZSkge1xuICAgICAgICAgIHZhciByZXN1bHRzLCBoYXNNZW1iZXJzO1xuICAgICAgICAgIGlmICh2YWx1ZSA9PSBcIiRcIikge1xuICAgICAgICAgICAgLy8gVW5leHBlY3RlZCBlbmQgb2YgaW5wdXQuXG4gICAgICAgICAgICBhYm9ydCgpO1xuICAgICAgICAgIH1cbiAgICAgICAgICBpZiAodHlwZW9mIHZhbHVlID09IFwic3RyaW5nXCIpIHtcbiAgICAgICAgICAgIGlmICgoY2hhckluZGV4QnVnZ3kgPyB2YWx1ZS5jaGFyQXQoMCkgOiB2YWx1ZVswXSkgPT0gXCJAXCIpIHtcbiAgICAgICAgICAgICAgLy8gUmVtb3ZlIHRoZSBzZW50aW5lbCBgQGAgY2hhcmFjdGVyLlxuICAgICAgICAgICAgICByZXR1cm4gdmFsdWUuc2xpY2UoMSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICAvLyBQYXJzZSBvYmplY3QgYW5kIGFycmF5IGxpdGVyYWxzLlxuICAgICAgICAgICAgaWYgKHZhbHVlID09IFwiW1wiKSB7XG4gICAgICAgICAgICAgIC8vIFBhcnNlcyBhIEpTT04gYXJyYXksIHJldHVybmluZyBhIG5ldyBKYXZhU2NyaXB0IGFycmF5LlxuICAgICAgICAgICAgICByZXN1bHRzID0gW107XG4gICAgICAgICAgICAgIGZvciAoOzsgaGFzTWVtYmVycyB8fCAoaGFzTWVtYmVycyA9IHRydWUpKSB7XG4gICAgICAgICAgICAgICAgdmFsdWUgPSBsZXgoKTtcbiAgICAgICAgICAgICAgICAvLyBBIGNsb3Npbmcgc3F1YXJlIGJyYWNrZXQgbWFya3MgdGhlIGVuZCBvZiB0aGUgYXJyYXkgbGl0ZXJhbC5cbiAgICAgICAgICAgICAgICBpZiAodmFsdWUgPT0gXCJdXCIpIHtcbiAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAvLyBJZiB0aGUgYXJyYXkgbGl0ZXJhbCBjb250YWlucyBlbGVtZW50cywgdGhlIGN1cnJlbnQgdG9rZW5cbiAgICAgICAgICAgICAgICAvLyBzaG91bGQgYmUgYSBjb21tYSBzZXBhcmF0aW5nIHRoZSBwcmV2aW91cyBlbGVtZW50IGZyb20gdGhlXG4gICAgICAgICAgICAgICAgLy8gbmV4dC5cbiAgICAgICAgICAgICAgICBpZiAoaGFzTWVtYmVycykge1xuICAgICAgICAgICAgICAgICAgaWYgKHZhbHVlID09IFwiLFwiKSB7XG4gICAgICAgICAgICAgICAgICAgIHZhbHVlID0gbGV4KCk7XG4gICAgICAgICAgICAgICAgICAgIGlmICh2YWx1ZSA9PSBcIl1cIikge1xuICAgICAgICAgICAgICAgICAgICAgIC8vIFVuZXhwZWN0ZWQgdHJhaWxpbmcgYCxgIGluIGFycmF5IGxpdGVyYWwuXG4gICAgICAgICAgICAgICAgICAgICAgYWJvcnQoKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgLy8gQSBgLGAgbXVzdCBzZXBhcmF0ZSBlYWNoIGFycmF5IGVsZW1lbnQuXG4gICAgICAgICAgICAgICAgICAgIGFib3J0KCk7XG4gICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIC8vIEVsaXNpb25zIGFuZCBsZWFkaW5nIGNvbW1hcyBhcmUgbm90IHBlcm1pdHRlZC5cbiAgICAgICAgICAgICAgICBpZiAodmFsdWUgPT0gXCIsXCIpIHtcbiAgICAgICAgICAgICAgICAgIGFib3J0KCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHJlc3VsdHMucHVzaChnZXQodmFsdWUpKTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICByZXR1cm4gcmVzdWx0cztcbiAgICAgICAgICAgIH0gZWxzZSBpZiAodmFsdWUgPT0gXCJ7XCIpIHtcbiAgICAgICAgICAgICAgLy8gUGFyc2VzIGEgSlNPTiBvYmplY3QsIHJldHVybmluZyBhIG5ldyBKYXZhU2NyaXB0IG9iamVjdC5cbiAgICAgICAgICAgICAgcmVzdWx0cyA9IHt9O1xuICAgICAgICAgICAgICBmb3IgKDs7IGhhc01lbWJlcnMgfHwgKGhhc01lbWJlcnMgPSB0cnVlKSkge1xuICAgICAgICAgICAgICAgIHZhbHVlID0gbGV4KCk7XG4gICAgICAgICAgICAgICAgLy8gQSBjbG9zaW5nIGN1cmx5IGJyYWNlIG1hcmtzIHRoZSBlbmQgb2YgdGhlIG9iamVjdCBsaXRlcmFsLlxuICAgICAgICAgICAgICAgIGlmICh2YWx1ZSA9PSBcIn1cIikge1xuICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIC8vIElmIHRoZSBvYmplY3QgbGl0ZXJhbCBjb250YWlucyBtZW1iZXJzLCB0aGUgY3VycmVudCB0b2tlblxuICAgICAgICAgICAgICAgIC8vIHNob3VsZCBiZSBhIGNvbW1hIHNlcGFyYXRvci5cbiAgICAgICAgICAgICAgICBpZiAoaGFzTWVtYmVycykge1xuICAgICAgICAgICAgICAgICAgaWYgKHZhbHVlID09IFwiLFwiKSB7XG4gICAgICAgICAgICAgICAgICAgIHZhbHVlID0gbGV4KCk7XG4gICAgICAgICAgICAgICAgICAgIGlmICh2YWx1ZSA9PSBcIn1cIikge1xuICAgICAgICAgICAgICAgICAgICAgIC8vIFVuZXhwZWN0ZWQgdHJhaWxpbmcgYCxgIGluIG9iamVjdCBsaXRlcmFsLlxuICAgICAgICAgICAgICAgICAgICAgIGFib3J0KCk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIC8vIEEgYCxgIG11c3Qgc2VwYXJhdGUgZWFjaCBvYmplY3QgbWVtYmVyLlxuICAgICAgICAgICAgICAgICAgICBhYm9ydCgpO1xuICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAvLyBMZWFkaW5nIGNvbW1hcyBhcmUgbm90IHBlcm1pdHRlZCwgb2JqZWN0IHByb3BlcnR5IG5hbWVzIG11c3QgYmVcbiAgICAgICAgICAgICAgICAvLyBkb3VibGUtcXVvdGVkIHN0cmluZ3MsIGFuZCBhIGA6YCBtdXN0IHNlcGFyYXRlIGVhY2ggcHJvcGVydHlcbiAgICAgICAgICAgICAgICAvLyBuYW1lIGFuZCB2YWx1ZS5cbiAgICAgICAgICAgICAgICBpZiAodmFsdWUgPT0gXCIsXCIgfHwgdHlwZW9mIHZhbHVlICE9IFwic3RyaW5nXCIgfHwgKGNoYXJJbmRleEJ1Z2d5ID8gdmFsdWUuY2hhckF0KDApIDogdmFsdWVbMF0pICE9IFwiQFwiIHx8IGxleCgpICE9IFwiOlwiKSB7XG4gICAgICAgICAgICAgICAgICBhYm9ydCgpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICByZXN1bHRzW3ZhbHVlLnNsaWNlKDEpXSA9IGdldChsZXgoKSk7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgcmV0dXJuIHJlc3VsdHM7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICAvLyBVbmV4cGVjdGVkIHRva2VuIGVuY291bnRlcmVkLlxuICAgICAgICAgICAgYWJvcnQoKTtcbiAgICAgICAgICB9XG4gICAgICAgICAgcmV0dXJuIHZhbHVlO1xuICAgICAgICB9O1xuXG4gICAgICAgIC8vIEludGVybmFsOiBVcGRhdGVzIGEgdHJhdmVyc2VkIG9iamVjdCBtZW1iZXIuXG4gICAgICAgIHZhciB1cGRhdGUgPSBmdW5jdGlvbiAoc291cmNlLCBwcm9wZXJ0eSwgY2FsbGJhY2spIHtcbiAgICAgICAgICB2YXIgZWxlbWVudCA9IHdhbGsoc291cmNlLCBwcm9wZXJ0eSwgY2FsbGJhY2spO1xuICAgICAgICAgIGlmIChlbGVtZW50ID09PSB1bmRlZikge1xuICAgICAgICAgICAgZGVsZXRlIHNvdXJjZVtwcm9wZXJ0eV07XG4gICAgIC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oOyBsZW5ndGgtLTspIHtcbiAgICAgICAgICAgICAgICB1cGRhdGUodmFsdWUsIGxlbmd0aCwgY2FsbGJhY2spO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICBmb3JFYWNoKHZhbHVlLCBmdW5jdGlvbiAocHJvcGVydHkpIHtcbiAgICAgICAgICAgICAgICB1cGRhdGUodmFsdWUsIHByb3BlcnR5LCBjYWxsYmFjayk7XG4gICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgICByZXR1cm4gY2FsbGJhY2suY2FsbChzb3VyY2UsIHByb3BlcnR5LCB2YWx1ZSk7XG4gICAgICAgIH07XG5cbiAgICAgICAgLy8gUHVibGljOiBgSlNPTi5wYXJzZWAuIFNlZSBFUyA1LjEgc2VjdGlvbiAxNS4xMi4yLlxuICAgICAgICBleHBvcnRzLnBhcnNlID0gZnVuY3Rpb24gKHNvdXJjZSwgY2FsbGJhY2spIHtcbiAgICAgICAgICB2YXIgcmVzdWx0LCB2YWx1ZTtcbiAgICAgICAgICBJbmRleCA9IDA7XG4gICAgICAgICAgU291cmNlID0gXCJcIiArIHNvdXJjZTtcbiAgICAgICAgICByZXN1bHQgPSBnZXQobGV4KCkpO1xuICAgICAgICAgIC8vIElmIGEgSlNPTiBzdHJpbmcgY29udGFpbnMgbXVsdGlwbGUgdG9rZW5zLCBpdCBpcyBpbnZhbGlkLlxuICAgICAgICAgIGlmIChsZXgoKSAhPSBcIiRcIikge1xuICAgICAgICAgICAgYWJvcnQoKTtcbiAgICAgICAgICB9XG4gICAgICAgICAgLy8gUmVzZXQgdGhlIHBhcnNlciBzdGF0ZS5cbiAgICAgICAgICBJbmRleCA9IFNvdXJjZSA9IG51bGw7XG4gICAgICAgICAgcmV0dXJuIGNhbGxiYWNrICYmIGdldENsYXNzLmNhbGwoY2FsbGJhY2spID09IGZ1bmN0aW9uQ2xhc3MgPyB3YWxrK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O1xuICAgICAgICAgIG5hdGl2ZUpTT04gPSBwcmV2aW91c0pTT04gPSBudWxsO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBKU09OMztcbiAgICAgIH1cbiAgICB9KSk7XG5cbiAgICByb290LkpTT04gPSB7XG4gICAgICBcInBhcnNlXCI6IEpTT04zLnBhcnNlLFxuICAgICAgXCJzdHJpbmdpZnlcIjogSlNPTjMuc3RyaW5naWZ5XG4gICAgfTtcbiAgfVxuXG4gIC8vIEV4cG9ydCBmb3IgYXN5bmNocm9ub3VzIG1vZHVsZSBsb2FkZXJzLlxuICBpZiAoaXNMb2FkZXIpIHtcbiAgICBkZWZpbmUoZnVuY3Rpb24gKCkge1xuICAgICAgcmV0dXJuIEpTT04zO1xuICAgIH0pO1xuICB9XG59KS5jYWxsKHRoaXMpO1xuIl19 -},{}],59:[function(require,module,exports){ -'use strict'; - -var required = require('requires-port') - , lolcation = require('./lolcation') - , qs = require('querystringify') - , relativere = /^\/(?!\/)/; +},{}],58:[function(require,module,exports){ /** - * These are the parse instructions for the URL parsers, it informs the parser - * about: - * - * 0. The char it Needs to parse, if it's a string it should be done using - * indexOf, RegExp using exec and NaN means set as current value. - * 1. The property we should set when parsing this value. - * 2. Indication if it's backwards or forward parsing, when set as number it's - * the value of extra chars that should be split off. - * 3. Inherit from location if non existing in the parser. - * 4. `toLowerCase` the resulting value. + * Helpers. */ -var instructions = [ - ['#', 'hash'], // Extract from the back. - ['?', 'query'], // Extract from the back. - ['//', 'protocol', 2, 1, 1], // Extract from the front. - ['/', 'pathname'], // Extract from the back. - ['@', 'auth', 1], // Extract from the front. - [NaN, 'host', undefined, 1, 1], // Set left over value. - [/\:(\d+)$/, 'port'], // RegExp the back. - [NaN, 'hostname', undefined, 1, 1] // Set left over. -]; + +var s = 1000 +var m = s * 60 +var h = m * 60 +var d = h * 24 +var y = d * 365.25 /** - * The actual URL instance. Instead of returning an object we've opted-in to - * create an actual constructor as it's much more memory efficient and - * faster and it pleases my CDO. + * Parse or format the given `val`. * - * @constructor - * @param {String} address URL we want to parse. - * @param {Boolean|function} parser Parser for the query string. - * @param {Object} location Location defaults for relative paths. + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} options + * @throws {Error} throw an error if val is not a non-empty string or a number + * @return {String|Number} * @api public */ -function URL(address, location, parser) { - if (!(this instanceof URL)) { - return new URL(address, location, parser); + +module.exports = function (val, options) { + options = options || {} + var type = typeof val + if (type === 'string' && val.length > 0) { + return parse(val) + } else if (type === 'number' && isNaN(val) === false) { + return options.long ? + fmtLong(val) : + fmtShort(val) } - - var relative = relativere.test(address) - , parse, instruction, index, key - , type = typeof location - , url = this - , i = 0; - - // - // The following if statements allows this module two have compatibility with - // 2 different API: - // - // 1. Node.js's `url.parse` api which accepts a URL, boolean as arguments - // where the boolean indicates that the query string should also be parsed. - // - // 2. The `URL` interface of the browser which accepts a URL, object as - // arguments. The supplied object will be used as default values / fall-back - // for relative paths. - // - if ('object' !== type && 'string' !== type) { - parser = location; - location = null; - } - - if (parser && 'function' !== typeof parser) { - parser = qs.parse; - } - - location = lolcation(location); - - for (; i < instructions.length; i++) { - instruction = instructions[i]; - parse = instruction[0]; - key = instruction[1]; - - if (parse !== parse) { - url[key] = address; - } else if ('string' === typeof parse) { - if (~(index = address.indexOf(parse))) { - if ('number' === typeof instruction[2]) { - url[key] = address.slice(0, index); - address = address.slice(index + instruction[2]); - } else { - url[key] = address.slice(index); - address = address.slice(0, index); - } - } - } else if (index = parse.exec(address)) { - url[key] = index[1]; - address = address.slice(0, address.length - index[0].length); - } - - url[key] = url[key] || (instruction[3] || ('port' === key && relative) ? location[key] || '' : ''); - - // - // Hostname, host and protocol should be lowercased so they can be used to - // create a proper `origin`. - // - if (instruction[4]) { - url[key] = url[key].toLowerCase(); - } - } - - // - // Also parse the supplied query string in to an object. If we're supplied - // with a custom parser as function use that instead of the default build-in - // parser. - // - if (parser) url.query = parser(url.query); - - // - // We should not add port numbers if they are already the default port number - // for a given protocol. As the host also contains the port number we're going - // override it with the hostname which contains no port number. - // - if (!required(url.port, url.protocol)) { - url.host = url.hostname; - url.port = ''; - } - - // - // Parse down the `auth` for the username and password. - // - url.username = url.password = ''; - if (url.auth) { - instruction = url.auth.split(':'); - url.username = instruction[0] || ''; - url.password = instruction[1] || ''; - } - - // - // The href is just the compiled result. - // - url.href = url.toString(); + throw new Error('val is not a non-empty string or a valid number. val=' + JSON.stringify(val)) } /** - * This is convenience method for changing properties in the URL instance to - * insure that they all propagate correctly. + * Parse the given `str` and return milliseconds. * - * @param {String} prop Property we need to adjust. - * @param {Mixed} value The newly assigned value. - * @returns {URL} - * @api public + * @param {String} str + * @return {Number} + * @api private */ -URL.prototype.set = function set(part, value, fn) { - var url = this; - if ('query' === part) { - if ('string' === typeof value) value = (fn || qs.parse)(value); - url[part] = value; - } else if ('port' === part) { - url[part] = value; - - if (!required(value, url.protocol)) { - url.host = url.hostname; - url[part] = ''; - } else if (value) { - url.host = url.hostname +':'+ value; - } - } else if ('hostname' === part) { - url[part] = value; - - if (url.port) value += ':'+ url.port; - url.host = value; - } else if ('host' === part) { - url[part] = value; - - if (/\:\d+/.test(value)) { - value = value.split(':'); - url.hostname = value[0]; - url.port = value[1]; - } - } else { - url[part] = value; +function parse(str) { + str = String(str) + if (str.length > 10000) { + return } - - url.href = url.toString(); - return url; -}; + var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(str) + if (!match) { + return + } + var n = parseFloat(match[1]) + var type = (match[2] || 'ms').toLowerCase() + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y + case 'days': + case 'day': + case 'd': + return n * d + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n + default: + return undefined + } +} /** - * Transform the properties back in to a valid and full URL string. + * Short format for `ms`. * - * @param {Function} stringify Optional query stringify function. - * @returns {String} - * @api public + * @param {Number} ms + * @return {String} + * @api private */ -URL.prototype.toString = function toString(stringify) { - if (!stringify || 'function' !== typeof stringify) stringify = qs.stringify; - var query - , url = this - , result = url.protocol +'//'; - - if (url.username) { - result += url.username; - if (url.password) result += ':'+ url.password; - result += '@'; +function fmtShort(ms) { + if (ms >= d) { + return Math.round(ms / d) + 'd' } - - result += url.hostname; - if (url.port) result += ':'+ url.port; - - result += url.pathname; - - if (url.query) { - if ('object' === typeof url.query) query = stringify(url.query); - else query = url.query; - - result += (query.charAt(0) === '?' ? '' : '?') + query; + if (ms >= h) { + return Math.round(ms / h) + 'h' } - - if (url.hash) result += url.hash; - - return result; -}; - -// -// Expose the URL parser and some additional properties that might be useful for -// others. -// -URL.qs = qs; -URL.location = lolcation; -module.exports = URL; - -},{"./lolcation":60,"querystringify":61,"requires-port":62}],60:[function(require,module,exports){ -(function (global){ -'use strict'; + if (ms >= m) { + return Math.round(ms / m) + 'm' + } + if (ms >= s) { + return Math.round(ms / s) + 's' + } + return ms + 'ms' +} /** - * These properties should not be copied or inherited from. This is only needed - * for all non blob URL's as the a blob URL does not include a hash, only the - * origin. + * Long format for `ms`. * - * @type {Object} - * @private + * @param {Number} ms + * @return {String} + * @api private */ -var ignore = { hash: 1, query: 1 } - , URL; + +function fmtLong(ms) { + return plural(ms, d, 'day') || + plural(ms, h, 'hour') || + plural(ms, m, 'minute') || + plural(ms, s, 'second') || + ms + ' ms' +} /** - * The location object differs when your code is loaded through a normal page, - * Worker or through a worker using a blob. And with the blobble begins the - * trouble as the location object will contain the URL of the blob, not the - * location of the page where our code is loaded in. The actual origin is - * encoded in the `pathname` so we can thankfully generate a good "default" - * location from it so we can generate proper relative URL's again. - * - * @param {Object} loc Optional default location object. - * @returns {Object} lolcation object. - * @api public + * Pluralization helper. */ -module.exports = function lolcation(loc) { - loc = loc || global.location || {}; - URL = URL || require('./'); - var finaldestination = {} - , type = typeof loc - , key; - - if ('blob:' === loc.protocol) { - finaldestination = new URL(unescape(loc.pathname), {}); - } else if ('string' === type) { - finaldestination = new URL(loc, {}); - for (key in ignore) delete finaldestination[key]; - } else if ('object' === type) for (key in loc) { - if (key in ignore) continue; - finaldestination[key] = loc[key]; +function plural(ms, n, name) { + if (ms < n) { + return } + if (ms < n * 1.5) { + return Math.floor(ms / n) + ' ' + name + } + return Math.ceil(ms / n) + ' ' + name + 's' +} - return finaldestination; -}; - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy91cmwtcGFyc2UvbG9sY2F0aW9uLmpzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSIsImZpbGUiOiJnZW5lcmF0ZWQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlc0NvbnRlbnQiOlsiJ3VzZSBzdHJpY3QnO1xuXG4vKipcbiAqIFRoZXNlIHByb3BlcnRpZXMgc2hvdWxkIG5vdCBiZSBjb3BpZWQgb3IgaW5oZXJpdGVkIGZyb20uIFRoaX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ID0gZnVuY3Rpb24gbG9sY2F0aW9uKGxvYykge1xuICBsb2MgPSBsb2MgfHwgZ2xvYmFsLmxvY2F0aW9uIHx8IHt9O1xuICBVUkwgPSBVUkwgfHwgcmVxdWlyZSgnLi8nKTtcblxuICB2YXIgZmluYWxkZXN0aW5hdGlvbiA9IHt9XG4gICAgLCB0eXBlID0gdHlwZW9mIGxvY1xuICAgICwga2V5O1xuXG4gIGlmICgnYmxvYjonID09PSBsb2MucHJvdG9jb2wpIHtcbiAgICBmaW5hbGRlc3RpbmF0aW9uID0gbmV3IFVSTCh1bmVzY2FwZShsb2MucGF0aG5hbWUpLCB7fSk7XG4gIH0gZWxzZSBpZiAoJ3N0cmluZycgPT09IHR5cGUpIHtcbiAgICBmaW5hbGRlc3RpbmF0aW9uID0gbmV3IFVSTChsb2MsIHt9KTtcbiAgICBmb3IgKGtleSBpbiBpZ25vcmUpIGRlbGV0ZSBmaW5hbGRlc3RpbmF0aW9uW2tleV07XG4gIH0gZWxzZSBpZiAoJ29iamVjdCcgPT09IHR5cGUpIGZvciAoa2V5IGluIGxvYykge1xuICAgIGlmIChrZXkgaW4gaWdub3JlKSBjb250aW51ZTtcbiAgICBmaW5hbGRlc3RpbmF0aW9uW2tleV0gPSBsb2Nba2V5XTtcbiAgfVxuXG4gIHJldHVybiBmaW5hbGRlc3RpbmF0aW9uO1xufTtcbiJdfQ== -},{"./":59}],61:[function(require,module,exports){ +},{}],59:[function(require,module,exports){ 'use strict'; var has = Object.prototype.hasOwnProperty; @@ -5425,7 +5211,7 @@ var has = Object.prototype.hasOwnProperty; * @api public */ function querystring(query) { - var parser = /([^=?&]+)=([^&]*)/g + var parser = /([^=?&]+)=?([^&]*)/g , result = {} , part; @@ -5475,7 +5261,7 @@ function querystringify(obj, prefix) { exports.stringify = querystringify; exports.parse = querystring; -},{}],62:[function(require,module,exports){ +},{}],60:[function(require,module,exports){ 'use strict'; /** @@ -5503,7 +5289,7 @@ module.exports = function required(port, protocol) { return port !== 443; case 'ftp': - return port !== 22; + return port !== 21; case 'gopher': return port !== 70; @@ -5515,8 +5301,425 @@ module.exports = function required(port, protocol) { return port !== 0; }; -},{}]},{},[1])(1) +},{}],61:[function(require,module,exports){ +'use strict'; + +var required = require('requires-port') + , lolcation = require('./lolcation') + , qs = require('querystringify') + , protocolre = /^([a-z][a-z0-9.+-]*:)?(\/\/)?([\S\s]*)/i; + +/** + * These are the parse rules for the URL parser, it informs the parser + * about: + * + * 0. The char it Needs to parse, if it's a string it should be done using + * indexOf, RegExp using exec and NaN means set as current value. + * 1. The property we should set when parsing this value. + * 2. Indication if it's backwards or forward parsing, when set as number it's + * the value of extra chars that should be split off. + * 3. Inherit from location if non existing in the parser. + * 4. `toLowerCase` the resulting value. + */ +var rules = [ + ['#', 'hash'], // Extract from the back. + ['?', 'query'], // Extract from the back. + ['/', 'pathname'], // Extract from the back. + ['@', 'auth', 1], // Extract from the front. + [NaN, 'host', undefined, 1, 1], // Set left over value. + [/:(\d+)$/, 'port', undefined, 1], // RegExp the back. + [NaN, 'hostname', undefined, 1, 1] // Set left over. +]; + +/** + * @typedef ProtocolExtract + * @type Object + * @property {String} protocol Protocol matched in the URL, in lowercase. + * @property {Boolean} slashes `true` if protocol is followed by "//", else `false`. + * @property {String} rest Rest of the URL that is not part of the protocol. + */ + +/** + * Extract protocol information from a URL with/without double slash ("//"). + * + * @param {String} address URL we want to extract from. + * @return {ProtocolExtract} Extracted information. + * @api private + */ +function extractProtocol(address) { + var match = protocolre.exec(address); + + return { + protocol: match[1] ? match[1].toLowerCase() : '', + slashes: !!match[2], + rest: match[3] + }; +} + +/** + * Resolve a relative URL pathname against a base URL pathname. + * + * @param {String} relative Pathname of the relative URL. + * @param {String} base Pathname of the base URL. + * @return {String} Resolved pathname. + * @api private + */ +function resolve(relative, base) { + var path = (base || '/').split('/').slice(0, -1).concat(relative.split('/')) + , i = path.length + , last = path[i - 1] + , unshift = false + , up = 0; + + while (i--) { + if (path[i] === '.') { + path.splice(i, 1); + } else if (path[i] === '..') { + path.splice(i, 1); + up++; + } else if (up) { + if (i === 0) unshift = true; + path.splice(i, 1); + up--; + } + } + + if (unshift) path.unshift(''); + if (last === '.' || last === '..') path.push(''); + + return path.join('/'); +} + +/** + * The actual URL instance. Instead of returning an object we've opted-in to + * create an actual constructor as it's much more memory efficient and + * faster and it pleases my OCD. + * + * @constructor + * @param {String} address URL we want to parse. + * @param {Object|String} location Location defaults for relative paths. + * @param {Boolean|Function} parser Parser for the query string. + * @api public + */ +function URL(address, location, parser) { + if (!(this instanceof URL)) { + return new URL(address, location, parser); + } + + var relative, extracted, parse, instruction, index, key + , instructions = rules.slice() + , type = typeof location + , url = this + , i = 0; + + // + // The following if statements allows this module two have compatibility with + // 2 different API: + // + // 1. Node.js's `url.parse` api which accepts a URL, boolean as arguments + // where the boolean indicates that the query string should also be parsed. + // + // 2. The `URL` interface of the browser which accepts a URL, object as + // arguments. The supplied object will be used as default values / fall-back + // for relative paths. + // + if ('object' !== type && 'string' !== type) { + parser = location; + location = null; + } + + if (parser && 'function' !== typeof parser) parser = qs.parse; + + location = lolcation(location); + + // + // Extract protocol information before running the instructions. + // + extracted = extractProtocol(address || ''); + relative = !extracted.protocol && !extracted.slashes; + url.slashes = extracted.slashes || relative && location.slashes; + url.protocol = extracted.protocol || location.protocol || ''; + address = extracted.rest; + + // + // When the authority component is absent the URL starts with a path + // component. + // + if (!extracted.slashes) instructions[2] = [/(.*)/, 'pathname']; + + for (; i < instructions.length; i++) { + instruction = instructions[i]; + parse = instruction[0]; + key = instruction[1]; + + if (parse !== parse) { + url[key] = address; + } else if ('string' === typeof parse) { + if (~(index = address.indexOf(parse))) { + if ('number' === typeof instruction[2]) { + url[key] = address.slice(0, index); + address = address.slice(index + instruction[2]); + } else { + url[key] = address.slice(index); + address = address.slice(0, index); + } + } + } else if (index = parse.exec(address)) { + url[key] = index[1]; + address = address.slice(0, index.index); + } + + url[key] = url[key] || ( + relative && instruction[3] ? location[key] || '' : '' + ); + + // + // Hostname, host and protocol should be lowercased so they can be used to + // create a proper `origin`. + // + if (instruction[4]) url[key] = url[key].toLowerCase(); + } + + // + // Also parse the supplied query string in to an object. If we're supplied + // with a custom parser as function use that instead of the default build-in + // parser. + // + if (parser) url.query = parser(url.query); + + // + // If the URL is relative, resolve the pathname against the base URL. + // + if ( + relative + && location.slashes + && url.pathname.charAt(0) !== '/' + && (url.pathname !== '' || location.pathname !== '') + ) { + url.pathname = resolve(url.pathname, location.pathname); + } + + // + // We should not add port numbers if they are already the default port number + // for a given protocol. As the host also contains the port number we're going + // override it with the hostname which contains no port number. + // + if (!required(url.port, url.protocol)) { + url.host = url.hostname; + url.port = ''; + } + + // + // Parse down the `auth` for the username and password. + // + url.username = url.password = ''; + if (url.auth) { + instruction = url.auth.split(':'); + url.username = instruction[0] || ''; + url.password = instruction[1] || ''; + } + + url.origin = url.protocol && url.host && url.protocol !== 'file:' + ? url.protocol +'//'+ url.host + : 'null'; + + // + // The href is just the compiled result. + // + url.href = url.toString(); +} + +/** + * This is convenience method for changing properties in the URL instance to + * insure that they all propagate correctly. + * + * @param {String} part Property we need to adjust. + * @param {Mixed} value The newly assigned value. + * @param {Boolean|Function} fn When setting the query, it will be the function + * used to parse the query. + * When setting the protocol, double slash will be + * removed from the final url if it is true. + * @returns {URL} + * @api public + */ +URL.prototype.set = function set(part, value, fn) { + var url = this; + + switch (part) { + case 'query': + if ('string' === typeof value && value.length) { + value = (fn || qs.parse)(value); + } + + url[part] = value; + break; + + case 'port': + url[part] = value; + + if (!required(value, url.protocol)) { + url.host = url.hostname; + url[part] = ''; + } else if (value) { + url.host = url.hostname +':'+ value; + } + + break; + + case 'hostname': + url[part] = value; + + if (url.port) value += ':'+ url.port; + url.host = value; + break; + + case 'host': + url[part] = value; + + if (/:\d+$/.test(value)) { + value = value.split(':'); + url.port = value.pop(); + url.hostname = value.join(':'); + } else { + url.hostname = value; + url.port = ''; + } + + break; + + case 'protocol': + url.protocol = value.toLowerCase(); + url.slashes = !fn; + break; + + case 'pathname': + url.pathname = value.length && value.charAt(0) !== '/' ? '/' + value : value; + + break; + + default: + url[part] = value; + } + + for (var i = 0; i < rules.length; i++) { + var ins = rules[i]; + + if (ins[4]) url[ins[1]] = url[ins[1]].toLowerCase(); + } + + url.origin = url.protocol && url.host && url.protocol !== 'file:' + ? url.protocol +'//'+ url.host + : 'null'; + + url.href = url.toString(); + + return url; +}; + +/** + * Transform the properties back in to a valid and full URL string. + * + * @param {Function} stringify Optional query stringify function. + * @returns {String} + * @api public + */ +URL.prototype.toString = function toString(stringify) { + if (!stringify || 'function' !== typeof stringify) stringify = qs.stringify; + + var query + , url = this + , protocol = url.protocol; + + if (protocol && protocol.charAt(protocol.length - 1) !== ':') protocol += ':'; + + var result = protocol + (url.slashes ? '//' : ''); + + if (url.username) { + result += url.username; + if (url.password) result += ':'+ url.password; + result += '@'; + } + + result += url.host + url.pathname; + + query = 'object' === typeof url.query ? stringify(url.query) : url.query; + if (query) result += '?' !== query.charAt(0) ? '?'+ query : query; + + if (url.hash) result += url.hash; + + return result; +}; + +// +// Expose the URL parser and some additional properties that might be useful for +// others or testing. +// +URL.extractProtocol = extractProtocol; +URL.location = lolcation; +URL.qs = qs; + +module.exports = URL; + +},{"./lolcation":62,"querystringify":59,"requires-port":60}],62:[function(require,module,exports){ +(function (global){ +'use strict'; + +var slashes = /^[A-Za-z][A-Za-z0-9+-.]*:\/\//; + +/** + * These properties should not be copied or inherited from. This is only needed + * for all non blob URL's as a blob URL does not include a hash, only the + * origin. + * + * @type {Object} + * @private + */ +var ignore = { hash: 1, query: 1 } + , URL; + +/** + * The location object differs when your code is loaded through a normal page, + * Worker or through a worker using a blob. And with the blobble begins the + * trouble as the location object will contain the URL of the blob, not the + * location of the page where our code is loaded in. The actual origin is + * encoded in the `pathname` so we can thankfully generate a good "default" + * location from it so we can generate proper relative URL's again. + * + * @param {Object|String} loc Optional default location object. + * @returns {Object} lolcation object. + * @api public + */ +module.exports = function lolcation(loc) { + loc = loc || global.location || {}; + URL = URL || require('./'); + + var finaldestination = {} + , type = typeof loc + , key; + + if ('blob:' === loc.protocol) { + finaldestination = new URL(unescape(loc.pathname), {}); + } else if ('string' === type) { + finaldestination = new URL(loc, {}); + for (key in ignore) delete finaldestination[key]; + } else if ('object' === type) { + for (key in loc) { + if (key in ignore) continue; + finaldestination[key] = loc[key]; + } + + if (finaldestination.slashes === undefined) { + finaldestination.slashes = slashes.test(loc.href); + } + } + + return finaldestination; +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) + +},{"./":61}]},{},[1])(1) }); -//# sourceMappingURL=sockjs.js.map \ No newline at end of file +//# sourceMappingURL=sockjs.js.map diff --git a/vendor/sockjs/sockjs.js.map b/vendor/sockjs/sockjs.js.map new file mode 100644 index 000000000..fa8bee664 --- /dev/null +++ b/vendor/sockjs/sockjs.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["node_modules/browser-pack/_prelude.js","lib/entry.js","lib/event/close.js","lib/event/emitter.js","lib/event/event.js","lib/event/eventtarget.js","lib/event/trans-message.js","lib/facade.js","lib/iframe-bootstrap.js","lib/info-ajax.js","lib/info-iframe-receiver.js","lib/info-iframe.js","lib/info-receiver.js","lib/location.js","lib/main.js","lib/shims.js","lib/transport-list.js","lib/transport/browser/abstract-xhr.js","lib/transport/browser/eventsource.js","lib/transport/browser/websocket.js","lib/transport/eventsource.js","lib/transport/htmlfile.js","lib/transport/iframe.js","lib/transport/jsonp-polling.js","lib/transport/lib/ajax-based.js","lib/transport/lib/buffered-sender.js","lib/transport/lib/iframe-wrap.js","lib/transport/lib/polling.js","lib/transport/lib/sender-receiver.js","lib/transport/receiver/eventsource.js","lib/transport/receiver/htmlfile.js","lib/transport/receiver/jsonp.js","lib/transport/receiver/xhr.js","lib/transport/sender/jsonp.js","lib/transport/sender/xdr.js","lib/transport/sender/xhr-cors.js","lib/transport/sender/xhr-fake.js","lib/transport/sender/xhr-local.js","lib/transport/websocket.js","lib/transport/xdr-polling.js","lib/transport/xdr-streaming.js","lib/transport/xhr-polling.js","lib/transport/xhr-streaming.js","lib/utils/browser-crypto.js","lib/utils/browser.js","lib/utils/escape.js","lib/utils/event.js","lib/utils/iframe.js","lib/utils/log.js","lib/utils/object.js","lib/utils/random.js","lib/utils/transport.js","lib/utils/url.js","lib/version.js","node_modules/debug/src/browser.js","node_modules/debug/src/debug.js","node_modules/inherits/inherits_browser.js","node_modules/json3/lib/json3.js","node_modules/ms/index.js","node_modules/querystringify/index.js","node_modules/requires-port/index.js","node_modules/url-parse/index.js","node_modules/url-parse/lolcation.js"],"names":[],"mappings":";AAAA;;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;ACVA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AC3BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACtGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;ACjDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;ACjCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACrEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACzFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACVA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AC7XA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpcA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AClBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACjMA;AACA;;;;;ACDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;ACVA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;ACzBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AC7IA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AClCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACjDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACvFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACjCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACzDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AC7CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AC/DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACvFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACvLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACtEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACnGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;ACvGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;ACjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;ACnGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;ACjCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACzCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AC3BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AClDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACzEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AC1LA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AClBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AC7BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AClDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AC/CA;AACA;;;ACDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;ACtLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;ACvBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;ACt4BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;ACrWA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"sockjs.js","sourcesContent":["(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o 1) {\n // Make a copy so as not to interfere with a current dispatchEvent.\n this._listeners[eventType] = arr.slice(0, idx).concat(arr.slice(idx + 1));\n } else {\n delete this._listeners[eventType];\n }\n return;\n }\n};\n\nEventTarget.prototype.dispatchEvent = function() {\n var event = arguments[0];\n var t = event.type;\n // equivalent of Array.prototype.slice.call(arguments, 0);\n var args = arguments.length === 1 ? [event] : Array.apply(null, arguments);\n // TODO: This doesn't match the real behavior; per spec, onfoo get\n // their place in line from the /first/ time they're set from\n // non-null. Although WebKit bumps it to the end every time it's\n // set.\n if (this['on' + t]) {\n this['on' + t].apply(this, args);\n }\n if (t in this._listeners) {\n // Grab a reference to the listeners list. removeEventListener may alter the list.\n var listeners = this._listeners[t];\n for (var i = 0; i < listeners.length; i++) {\n listeners[i].apply(this, args);\n }\n }\n};\n\nmodule.exports = EventTarget;\n","'use strict';\n\nvar inherits = require('inherits')\n , Event = require('./event')\n ;\n\nfunction TransportMessageEvent(data) {\n Event.call(this);\n this.initEvent('message', false, false);\n this.data = data;\n}\n\ninherits(TransportMessageEvent, Event);\n\nmodule.exports = TransportMessageEvent;\n","'use strict';\n\nvar JSON3 = require('json3')\n , iframeUtils = require('./utils/iframe')\n ;\n\nfunction FacadeJS(transport) {\n this._transport = transport;\n transport.on('message', this._transportMessage.bind(this));\n transport.on('close', this._transportClose.bind(this));\n}\n\nFacadeJS.prototype._transportClose = function(code, reason) {\n iframeUtils.postMessage('c', JSON3.stringify([code, reason]));\n};\nFacadeJS.prototype._transportMessage = function(frame) {\n iframeUtils.postMessage('t', frame);\n};\nFacadeJS.prototype._send = function(data) {\n this._transport.send(data);\n};\nFacadeJS.prototype._close = function() {\n this._transport.close();\n this._transport.removeAllListeners();\n};\n\nmodule.exports = FacadeJS;\n","'use strict';\n\nvar 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')\n ;\n\nvar debug = function() {};\nif (process.env.NODE_ENV !== 'production') {\n debug = require('debug')('sockjs-client:iframe-bootstrap');\n}\n\nmodule.exports = function(SockJS, availableTransports) {\n var transportMap = {};\n availableTransports.forEach(function(at) {\n if (at.facadeTransport) {\n transportMap[at.facadeTransport.transportName] = at.facadeTransport;\n }\n });\n\n // hard-coded for the info iframe\n // TODO see if we can make this more dynamic\n transportMap[InfoIframeReceiver.transportName] = InfoIframeReceiver;\n var parentOrigin;\n\n /* eslint-disable camelcase */\n SockJS.bootstrap_iframe = function() {\n /* eslint-enable camelcase */\n var facade;\n iframeUtils.currentWindowId = loc.hash.slice(1);\n var onMessage = function(e) {\n if (e.source !== parent) {\n return;\n }\n if (typeof parentOrigin === 'undefined') {\n parentOrigin = e.origin;\n }\n if (e.origin !== parentOrigin) {\n return;\n }\n\n var iframeMessage;\n try {\n iframeMessage = JSON3.parse(e.data);\n } catch (ignored) {\n debug('bad json', e.data);\n return;\n }\n\n if (iframeMessage.windowId !== iframeUtils.currentWindowId) {\n return;\n }\n switch (iframeMessage.type) {\n case 's':\n var p;\n try {\n p = JSON3.parse(iframeMessage.data);\n } catch (ignored) {\n debug('bad json', iframeMessage.data);\n break;\n }\n var version = p[0];\n var transport = p[1];\n var transUrl = p[2];\n var baseUrl = p[3];\n debug(version, transport, transUrl, baseUrl);\n // change this to semver logic\n if (version !== SockJS.version) {\n throw new Error('Incompatible SockJS! Main site uses:' +\n ' \"' + version + '\", the iframe:' +\n ' \"' + SockJS.version + '\".');\n }\n\n if (!urlUtils.isOriginEqual(transUrl, loc.href) ||\n !urlUtils.isOriginEqual(baseUrl, loc.href)) {\n throw new Error('Can\\'t connect to different domain from within an ' +\n 'iframe. (' + loc.href + ', ' + transUrl + ', ' + baseUrl + ')');\n }\n facade = new FacadeJS(new transportMap[transport](transUrl, baseUrl));\n break;\n case 'm':\n facade._send(iframeMessage.data);\n break;\n case 'c':\n if (facade) {\n facade._close();\n }\n facade = null;\n break;\n }\n };\n\n eventUtils.attachEvent('message', onMessage);\n\n // Start\n iframeUtils.postMessage('s');\n };\n};\n","'use strict';\n\nvar EventEmitter = require('events').EventEmitter\n , inherits = require('inherits')\n , JSON3 = require('json3')\n , objectUtils = require('./utils/object')\n ;\n\nvar debug = function() {};\nif (process.env.NODE_ENV !== 'production') {\n debug = require('debug')('sockjs-client:info-ajax');\n}\n\nfunction InfoAjax(url, AjaxObject) {\n EventEmitter.call(this);\n\n var self = this;\n var t0 = +new Date();\n this.xo = new AjaxObject('GET', url);\n\n this.xo.once('finish', function(status, text) {\n var info, rtt;\n if (status === 200) {\n rtt = (+new Date()) - t0;\n if (text) {\n try {\n info = JSON3.parse(text);\n } catch (e) {\n debug('bad json', text);\n }\n }\n\n if (!objectUtils.isObject(info)) {\n info = {};\n }\n }\n self.emit('finish', info, rtt);\n self.removeAllListeners();\n });\n}\n\ninherits(InfoAjax, EventEmitter);\n\nInfoAjax.prototype.close = function() {\n this.removeAllListeners();\n this.xo.close();\n};\n\nmodule.exports = InfoAjax;\n","'use strict';\n\nvar inherits = require('inherits')\n , EventEmitter = require('events').EventEmitter\n , JSON3 = require('json3')\n , XHRLocalObject = require('./transport/sender/xhr-local')\n , InfoAjax = require('./info-ajax')\n ;\n\nfunction InfoReceiverIframe(transUrl) {\n var self = this;\n EventEmitter.call(this);\n\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}\n\ninherits(InfoReceiverIframe, EventEmitter);\n\nInfoReceiverIframe.transportName = 'iframe-info-receiver';\n\nInfoReceiverIframe.prototype.close = function() {\n if (this.ir) {\n this.ir.close();\n this.ir = null;\n }\n this.removeAllListeners();\n};\n\nmodule.exports = InfoReceiverIframe;\n","'use strict';\n\nvar 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')\n ;\n\nvar debug = function() {};\nif (process.env.NODE_ENV !== 'production') {\n debug = require('debug')('sockjs-client:info-iframe');\n}\n\nfunction InfoIframe(baseUrl, url) {\n var self = this;\n EventEmitter.call(this);\n\n var go = function() {\n var ifr = self.ifr = new IframeTransport(InfoReceiverIframe.transportName, url, baseUrl);\n\n ifr.once('message', function(msg) {\n if (msg) {\n var d;\n try {\n d = JSON3.parse(msg);\n } catch (e) {\n debug('bad json', msg);\n self.emit('finish');\n self.close();\n return;\n }\n\n var info = d[0], rtt = d[1];\n self.emit('finish', info, rtt);\n }\n self.close();\n });\n\n ifr.once('close', function() {\n self.emit('finish');\n self.close();\n });\n };\n\n // TODO this seems the same as the 'needBody' from transports\n if (!global.document.body) {\n utils.attachEvent('load', go);\n } else {\n go();\n }\n}\n\ninherits(InfoIframe, EventEmitter);\n\nInfoIframe.enabled = function() {\n return IframeTransport.enabled();\n};\n\nInfoIframe.prototype.close = function() {\n if (this.ifr) {\n this.ifr.close();\n }\n this.removeAllListeners();\n this.ifr = null;\n};\n\nmodule.exports = InfoIframe;\n","'use strict';\n\nvar 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')\n ;\n\nvar debug = function() {};\nif (process.env.NODE_ENV !== 'production') {\n debug = require('debug')('sockjs-client:info-receiver');\n}\n\nfunction InfoReceiver(baseUrl, urlInfo) {\n debug(baseUrl);\n var self = this;\n EventEmitter.call(this);\n\n setTimeout(function() {\n self.doXhr(baseUrl, urlInfo);\n }, 0);\n}\n\ninherits(InfoReceiver, EventEmitter);\n\n// TODO this is currently ignoring the list of available transports and the whitelist\n\nInfoReceiver._getReceiver = function(baseUrl, url, urlInfo) {\n // determine method of CORS support (if needed)\n if (urlInfo.sameOrigin) {\n return new InfoAjax(url, XHRLocal);\n }\n if (XHRCors.enabled) {\n return new InfoAjax(url, XHRCors);\n }\n if (XDR.enabled && urlInfo.sameScheme) {\n return new InfoAjax(url, XDR);\n }\n if (InfoIframe.enabled()) {\n return new InfoIframe(baseUrl, url);\n }\n return new InfoAjax(url, XHRFake);\n};\n\nInfoReceiver.prototype.doXhr = function(baseUrl, urlInfo) {\n var self = this\n , url = urlUtils.addPath(baseUrl, '/info')\n ;\n debug('doXhr', url);\n\n this.xo = InfoReceiver._getReceiver(baseUrl, url, urlInfo);\n\n this.timeoutRef = setTimeout(function() {\n debug('timeout');\n self._cleanup(false);\n self.emit('finish');\n }, InfoReceiver.timeout);\n\n this.xo.once('finish', function(info, rtt) {\n debug('finish', info, rtt);\n self._cleanup(true);\n self.emit('finish', info, rtt);\n });\n};\n\nInfoReceiver.prototype._cleanup = function(wasClean) {\n debug('_cleanup');\n clearTimeout(this.timeoutRef);\n this.timeoutRef = null;\n if (!wasClean && this.xo) {\n this.xo.close();\n }\n this.xo = null;\n};\n\nInfoReceiver.prototype.close = function() {\n debug('close');\n this.removeAllListeners();\n this._cleanup(false);\n};\n\nInfoReceiver.timeout = 8000;\n\nmodule.exports = InfoReceiver;\n","'use strict';\n\nmodule.exports = global.location || {\n origin: 'http://localhost:80'\n, protocol: 'http'\n, host: 'localhost'\n, port: 80\n, href: 'http://localhost/'\n, hash: ''\n};\n","'use strict';\n\nrequire('./shims');\n\nvar 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')\n ;\n\nvar debug = function() {};\nif (process.env.NODE_ENV !== 'production') {\n debug = require('debug')('sockjs-client:main');\n}\n\nvar transports;\n\n// follow constructor steps defined at http://dev.w3.org/html5/websockets/#the-websocket-interface\nfunction SockJS(url, protocols, options) {\n if (!(this instanceof SockJS)) {\n return new SockJS(url, protocols, options);\n }\n if (arguments.length < 1) {\n throw new TypeError(\"Failed to construct 'SockJS: 1 argument required, but only 0 present\");\n }\n EventTarget.call(this);\n\n this.readyState = SockJS.CONNECTING;\n this.extensions = '';\n this.protocol = '';\n\n // non-standard extension\n options = options || {};\n if (options.protocols_whitelist) {\n log.warn(\"'protocols_whitelist' is DEPRECATED. Use 'transports' instead.\");\n }\n this._transportsWhitelist = options.transports;\n this._transportOptions = options.transportOptions || {};\n\n var sessionId = options.sessionId || 8;\n 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 }\n\n this._server = options.server || random.numberString(1000);\n\n // Step 1 of WS spec - parse and validate the url. Issue #8\n var parsedUrl = new URL(url);\n 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 }\n\n var secure = parsedUrl.protocol === 'https:';\n // Step 2 - don't allow secure origin with an insecure protocol\n 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 }\n\n // Step 3 - check port access - no need here\n // Step 4 - parse protocols argument\n if (!protocols) {\n protocols = [];\n } else if (!Array.isArray(protocols)) {\n protocols = [protocols];\n }\n\n // Step 5 - check protocols argument\n var sortedProtocols = protocols.sort();\n sortedProtocols.forEach(function(proto, i) {\n if (!proto) {\n throw new SyntaxError(\"The protocols entry '\" + proto + \"' is invalid.\");\n }\n if (i < (sortedProtocols.length - 1) && proto === sortedProtocols[i + 1]) {\n throw new SyntaxError(\"The protocols entry '\" + proto + \"' is duplicated.\");\n }\n });\n\n // Step 6 - convert origin\n var o = urlUtils.getOrigin(loc.href);\n this._origin = o ? o.toLowerCase() : null;\n\n // remove the trailing slash\n parsedUrl.set('pathname', parsedUrl.pathname.replace(/\\/+$/, ''));\n\n // store the sanitized url\n this.url = parsedUrl.href;\n debug('using url', this.url);\n\n // Step 7 - start connection in background\n // obtain server info\n // http://sockjs.github.io/sockjs-protocol/sockjs-protocol-0.3.3.html#section-26\n this._urlInfo = {\n nullOrigin: !browser.hasDomain()\n , sameOrigin: urlUtils.isOriginEqual(this.url, loc.href)\n , sameScheme: urlUtils.isSchemeEqual(this.url, loc.href)\n };\n\n this._ir = new InfoReceiver(this.url, this._urlInfo);\n this._ir.once('finish', this._receiveInfo.bind(this));\n}\n\ninherits(SockJS, EventTarget);\n\nfunction userSetCode(code) {\n return code === 1000 || (code >= 3000 && code <= 4999);\n}\n\nSockJS.prototype.close = function(code, reason) {\n // Step 1\n if (code && !userSetCode(code)) {\n throw new Error('InvalidAccessError: Invalid code');\n }\n // Step 2.4 states the max is 123 bytes, but we are just checking length\n if (reason && reason.length > 123) {\n throw new SyntaxError('reason argument has an invalid length');\n }\n\n // Step 3.1\n if (this.readyState === SockJS.CLOSING || this.readyState === SockJS.CLOSED) {\n return;\n }\n\n // TODO look at docs to determine how to set this\n var wasClean = true;\n this._close(code || 1000, reason || 'Normal closure', wasClean);\n};\n\nSockJS.prototype.send = function(data) {\n // #13 - convert anything non-string to string\n // TODO this currently turns objects into [object Object]\n if (typeof data !== 'string') {\n data = '' + data;\n }\n if (this.readyState === SockJS.CONNECTING) {\n throw new Error('InvalidStateError: The connection has not been established yet');\n }\n if (this.readyState !== SockJS.OPEN) {\n return;\n }\n this._transport.send(escape.quote(data));\n};\n\nSockJS.version = require('./version');\n\nSockJS.CONNECTING = 0;\nSockJS.OPEN = 1;\nSockJS.CLOSING = 2;\nSockJS.CLOSED = 3;\n\nSockJS.prototype._receiveInfo = function(info, rtt) {\n debug('_receiveInfo', rtt);\n this._ir = null;\n if (!info) {\n this._close(1002, 'Cannot connect to server');\n return;\n }\n\n // establish a round-trip timeout (RTO) based on the\n // round-trip time (RTT)\n this._rto = this.countRTO(rtt);\n // allow server to override url used for the actual transport\n this._transUrl = info.base_url ? info.base_url : this.url;\n info = objectUtils.extend(info, this._urlInfo);\n debug('info', info);\n // determine list of desired and supported transports\n var enabledTransports = transports.filterToEnabled(this._transportsWhitelist, info);\n this._transports = enabledTransports.main;\n debug(this._transports.length + ' enabled transports');\n\n this._connect();\n};\n\nSockJS.prototype._connect = function() {\n for (var Transport = this._transports.shift(); Transport; Transport = this._transports.shift()) {\n debug('attempt', Transport.transportName);\n if (Transport.needBody) {\n if (!global.document.body ||\n (typeof global.document.readyState !== 'undefined' &&\n global.document.readyState !== 'complete' &&\n global.document.readyState !== 'interactive')) {\n debug('waiting for body');\n this._transports.unshift(Transport);\n eventUtils.attachEvent('load', this._connect.bind(this));\n return;\n }\n }\n\n // calculate timeout based on RTO and round trips. Default to 5s\n var timeoutMs = (this._rto * Transport.roundTrips) || 5000;\n this._transportTimeoutId = setTimeout(this._transportTimeout.bind(this), timeoutMs);\n debug('using timeout', timeoutMs);\n\n var transportUrl = urlUtils.addPath(this._transUrl, '/' + this._server + '/' + this._generateSessionId());\n var options = this._transportOptions[Transport.transportName];\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\n return;\n }\n this._close(2000, 'All transports failed', false);\n};\n\nSockJS.prototype._transportTimeout = function() {\n debug('_transportTimeout');\n if (this.readyState === SockJS.CONNECTING) {\n this._transportClose(2007, 'Transport timed out');\n }\n};\n\nSockJS.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\n ;\n\n // first check for messages that don't need a payload\n switch (type) {\n case 'o':\n this._open();\n return;\n case 'h':\n this.dispatchEvent(new Event('heartbeat'));\n debug('heartbeat', this.transport);\n return;\n }\n\n if (content) {\n try {\n payload = JSON3.parse(content);\n } catch (e) {\n debug('bad json', content);\n }\n }\n\n if (typeof payload === 'undefined') {\n debug('empty payload', content);\n return;\n }\n\n 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 }\n break;\n case 'm':\n debug('message', this.transport, payload);\n this.dispatchEvent(new TransportMessageEvent(payload));\n break;\n case 'c':\n if (Array.isArray(payload) && payload.length === 2) {\n this._close(payload[0], payload[1], true);\n }\n break;\n }\n};\n\nSockJS.prototype._transportClose = function(code, reason) {\n debug('_transportClose', this.transport, code, reason);\n if (this._transport) {\n this._transport.removeAllListeners();\n this._transport = null;\n this.transport = null;\n }\n\n if (!userSetCode(code) && code !== 2000 && this.readyState === SockJS.CONNECTING) {\n this._connect();\n return;\n }\n\n this._close(code, reason);\n};\n\nSockJS.prototype._open = function() {\n debug('_open', this._transport.transportName, this.readyState);\n if (this.readyState === SockJS.CONNECTING) {\n if (this._transportTimeoutId) {\n clearTimeout(this._transportTimeoutId);\n this._transportTimeoutId = null;\n }\n 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 our\n // connection.\n this._close(1006, 'Server lost session');\n }\n};\n\nSockJS.prototype._close = function(code, reason, wasClean) {\n debug('_close', this.transport, code, reason, wasClean, this.readyState);\n var forceFail = false;\n\n if (this._ir) {\n forceFail = true;\n this._ir.close();\n this._ir = null;\n }\n if (this._transport) {\n this._transport.close();\n this._transport = null;\n this.transport = null;\n }\n\n if (this.readyState === SockJS.CLOSED) {\n throw new Error('InvalidStateError: SockJS has already been closed');\n }\n\n this.readyState = SockJS.CLOSING;\n setTimeout(function() {\n this.readyState = SockJS.CLOSED;\n\n if (forceFail) {\n this.dispatchEvent(new Event('error'));\n }\n\n var e = new CloseEvent('close');\n e.wasClean = wasClean || false;\n e.code = code || 1000;\n e.reason = reason;\n\n this.dispatchEvent(e);\n this.onmessage = this.onclose = this.onerror = null;\n debug('disconnected');\n }.bind(this), 0);\n};\n\n// See: http://www.erg.abdn.ac.uk/~gerrit/dccp/notes/ccid2/rto_estimator/\n// and RFC 2988.\nSockJS.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 pass\n // from the opening of the transport to the call of `_dispatchOpen`) is\n // around 200msec (the lower bound used in the article above) and this\n // causes spurious timeouts. For this reason we calculate a value slightly\n // larger than that used in the article.\n if (rtt > 100) {\n return 4 * rtt; // rto > 400msec\n }\n return 300 + rtt; // 300msec < rto <= 400msec\n};\n\nmodule.exports = function(availableTransports) {\n transports = transport(availableTransports);\n require('./iframe-bootstrap')(SockJS, availableTransports);\n return SockJS;\n};\n","/* eslint-disable */\n/* jscs: disable */\n'use strict';\n\n// pulled specific shims from https://github.com/es-shims/es5-shim\n\nvar ArrayPrototype = Array.prototype;\nvar ObjectPrototype = Object.prototype;\nvar FunctionPrototype = Function.prototype;\nvar StringPrototype = String.prototype;\nvar array_slice = ArrayPrototype.slice;\n\nvar _toString = ObjectPrototype.toString;\nvar isFunction = function (val) {\n return ObjectPrototype.toString.call(val) === '[object Function]';\n};\nvar isArray = function isArray(obj) {\n return _toString.call(obj) === '[object Array]';\n};\nvar isString = function isString(obj) {\n return _toString.call(obj) === '[object String]';\n};\n\nvar supportsDescriptors = Object.defineProperty && (function () {\n try {\n Object.defineProperty({}, 'x', {});\n return true;\n } catch (e) { /* this is ES3 */\n return false;\n }\n}());\n\n// Define configurable, writable and non-enumerable props\n// if they don't exist.\nvar defineProperty;\nif (supportsDescriptors) {\n defineProperty = function (object, name, method, forceAssign) {\n if (!forceAssign && (name in object)) { return; }\n Object.defineProperty(object, name, {\n configurable: true,\n enumerable: false,\n writable: true,\n value: method\n });\n };\n} else {\n defineProperty = function (object, name, method, forceAssign) {\n if (!forceAssign && (name in object)) { return; }\n object[name] = method;\n };\n}\nvar defineProperties = function (object, map, forceAssign) {\n for (var name in map) {\n if (ObjectPrototype.hasOwnProperty.call(map, name)) {\n defineProperty(object, name, map[name], forceAssign);\n }\n }\n};\n\nvar toObject = function (o) {\n if (o == null) { // this matches both null and undefined\n throw new TypeError(\"can't convert \" + o + ' to object');\n }\n return Object(o);\n};\n\n//\n// Util\n// ======\n//\n\n// ES5 9.4\n// http://es5.github.com/#x9.4\n// http://jsperf.com/to-integer\n\nfunction toInteger(num) {\n var n = +num;\n if (n !== n) { // isNaN\n n = 0;\n } else if (n !== 0 && n !== (1 / 0) && n !== -(1 / 0)) {\n n = (n > 0 || -1) * Math.floor(Math.abs(n));\n }\n return n;\n}\n\nfunction ToUint32(x) {\n return x >>> 0;\n}\n\n//\n// Function\n// ========\n//\n\n// ES-5 15.3.4.5\n// http://es5.github.com/#x15.3.4.5\n\nfunction Empty() {}\n\ndefineProperties(FunctionPrototype, {\n bind: function bind(that) { // .length is 1\n // 1. Let Target be the this value.\n var target = this;\n // 2. If IsCallable(Target) is false, throw a TypeError exception.\n if (!isFunction(target)) {\n throw new TypeError('Function.prototype.bind called on incompatible ' + target);\n }\n // 3. Let A be a new (possibly empty) internal list of all of the\n // argument values provided after thisArg (arg1, arg2 etc), in order.\n // XXX slicedArgs will stand in for \"A\" if used\n var args = array_slice.call(arguments, 1); // for normal call\n // 4. Let F be a new native ECMAScript object.\n // 11. Set the [[Prototype]] internal property of F to the standard\n // built-in Function prototype object as specified in 15.3.3.1.\n // 12. Set the [[Call]] internal property of F as described in\n // 15.3.4.5.1.\n // 13. Set the [[Construct]] internal property of F as described in\n // 15.3.4.5.2.\n // 14. Set the [[HasInstance]] internal property of F as described in\n // 15.3.4.5.3.\n var binder = function () {\n\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 a\n // 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, a\n // TypeError exception is thrown.\n // 3. Let boundArgs be the value of F's [[BoundArgs]] internal\n // property.\n // 4. Let args be a new list containing the same values as the\n // list boundArgs in the same order followed by the same\n // values as the list ExtraArgs in the same order.\n // 5. Return the result of calling the [[Construct]] internal\n // method of target providing args as the arguments.\n\n var result = target.apply(\n this,\n args.concat(array_slice.call(arguments))\n );\n if (Object(result) === result) {\n return result;\n }\n return this;\n\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 a\n // this value and a list of arguments ExtraArgs, the following\n // steps are taken:\n // 1. Let boundArgs be the value of F's [[BoundArgs]] internal\n // property.\n // 2. Let boundThis be the value of F's [[BoundThis]] internal\n // property.\n // 3. Let target be the value of F's [[TargetFunction]] internal\n // property.\n // 4. Let args be a new list containing the same values as the\n // list boundArgs in the same order followed by the same\n // values as the list ExtraArgs in the same order.\n // 5. Return the result of calling the [[Call]] internal method\n // of target providing boundThis as the this value and\n // providing args as the arguments.\n\n // equiv: target.call(this, ...boundArgs, ...args)\n return target.apply(\n that,\n args.concat(array_slice.call(arguments))\n );\n\n }\n\n };\n\n // 15. If the [[Class]] internal property of Target is \"Function\", then\n // 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 is\n // larger.\n // 16. Else set the length own property of F to 0.\n\n var boundLength = Math.max(0, target.length - args.length);\n\n // 17. Set the attributes of the length own property of F to the values\n // specified in 15.3.5.1.\n var boundArgs = [];\n for (var i = 0; i < boundLength; i++) {\n boundArgs.push('$' + i);\n }\n\n // XXX Build a dynamic function with desired amount of arguments is the only\n // 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 exists\n // and so this code will never be executed.\n var bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this, arguments); }')(binder);\n\n if (target.prototype) {\n Empty.prototype = target.prototype;\n bound.prototype = new Empty();\n // Clean up dangling references.\n Empty.prototype = null;\n }\n\n // TODO\n // 18. Set the [[Extensible]] internal property of F to true.\n\n // TODO\n // 19. Let thrower be the [[ThrowTypeError]] function Object (13.2.3).\n // 20. Call the [[DefineOwnProperty]] internal method of F with\n // arguments \"caller\", PropertyDescriptor {[[Get]]: thrower, [[Set]]:\n // thrower, [[Enumerable]]: false, [[Configurable]]: false}, and\n // false.\n // 21. Call the [[DefineOwnProperty]] internal method of F with\n // arguments \"arguments\", PropertyDescriptor {[[Get]]: thrower,\n // [[Set]]: thrower, [[Enumerable]]: false, [[Configurable]]: false},\n // and false.\n\n // TODO\n // NOTE Function objects created using Function.prototype.bind do not\n // have a prototype property or the [[Code]], [[FormalParameters]], and\n // [[Scope]] internal properties.\n // XXX can't delete prototype in pure-js.\n\n // 22. Return F.\n return bound;\n }\n});\n\n//\n// Array\n// =====\n//\n\n// ES5 15.4.3.2\n// http://es5.github.com/#x15.4.3.2\n// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/isArray\ndefineProperties(Array, { isArray: isArray });\n\n\nvar boxedString = Object('a');\nvar splitString = boxedString[0] !== 'a' || !(0 in boxedString);\n\nvar properlyBoxesContext = function properlyBoxed(method) {\n // Check node 0.6.21 bug where third parameter is not boxed\n var properlyBoxesNonStrict = true;\n var properlyBoxesStrict = true;\n if (method) {\n method.call('foo', function (_, __, context) {\n if (typeof context !== 'object') { properlyBoxesNonStrict = false; }\n });\n\n method.call([1], function () {\n 'use strict';\n properlyBoxesStrict = typeof this === 'string';\n }, 'x');\n }\n return !!method && properlyBoxesNonStrict && properlyBoxesStrict;\n};\n\ndefineProperties(ArrayPrototype, {\n forEach: function forEach(fun /*, thisp*/) {\n var object = toObject(this),\n self = splitString && isString(this) ? this.split('') : object,\n thisp = arguments[1],\n i = -1,\n length = self.length >>> 0;\n\n // If no callback function or if callback is not a callable function\n if (!isFunction(fun)) {\n throw new TypeError(); // TODO message\n }\n\n while (++i < length) {\n if (i in self) {\n // Invoke the callback function with call, passing arguments:\n // context, property value, property key, thisArg object\n // context\n fun.call(thisp, self[i], i, object);\n }\n }\n }\n}, !properlyBoxesContext(ArrayPrototype.forEach));\n\n// ES5 15.4.4.14\n// http://es5.github.com/#x15.4.4.14\n// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/indexOf\nvar hasFirefox2IndexOfBug = Array.prototype.indexOf && [0, 1].indexOf(1, 2) !== -1;\ndefineProperties(ArrayPrototype, {\n indexOf: function indexOf(sought /*, fromIndex */ ) {\n var self = splitString && isString(this) ? this.split('') : toObject(this),\n length = self.length >>> 0;\n\n if (!length) {\n return -1;\n }\n\n var i = 0;\n if (arguments.length > 1) {\n i = toInteger(arguments[1]);\n }\n\n // handle negative indices\n i = i >= 0 ? i : Math.max(0, length + i);\n for (; i < length; i++) {\n if (i in self && self[i] === sought) {\n return i;\n }\n }\n return -1;\n }\n}, hasFirefox2IndexOfBug);\n\n//\n// String\n// ======\n//\n\n// ES5 15.5.4.14\n// http://es5.github.com/#x15.5.4.14\n\n// [bugfix, IE lt 9, firefox 4, Konqueror, Opera, obscure browsers]\n// Many browsers do not split properly with regular expressions or they\n// do not perform the split correctly under obscure conditions.\n// See http://blog.stevenlevithan.com/archives/cross-browser-split\n// 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\"], not\n// [undefined, \"t\", undefined, \"e\", ...]\n// ''.split(/.?/) should be [], not [\"\"]\n// '.'.split(/()()/) should be [\".\"], not [\"\", \"\", \".\"]\n\nvar string_split = StringPrototype.split;\nif (\n 'ab'.split(/(?:ab)*/).length !== 2 ||\n '.'.split(/(.?)(.?)/).length !== 4 ||\n 'tesst'.split(/(s)*/)[1] === 't' ||\n 'test'.split(/(?:)/, -1).length !== 4 ||\n ''.split(/.?/).length ||\n '.'.split(/()()/).length > 1\n) {\n (function () {\n var compliantExecNpcg = /()??/.exec('')[1] === void 0; // NPCG: nonparticipating capturing group\n\n StringPrototype.split = function (separator, limit) {\n var string = this;\n if (separator === void 0 && limit === 0) {\n return [];\n }\n\n // If `separator` is not a regex, use native split\n if (_toString.call(separator) !== '[object RegExp]') {\n return string_split.call(this, separator, limit);\n }\n\n var output = [],\n flags = (separator.ignoreCase ? 'i' : '') +\n (separator.multiline ? 'm' : '') +\n (separator.extended ? 'x' : '') + // Proposed for ES6\n (separator.sticky ? 'y' : ''), // Firefox 3+\n lastLastIndex = 0,\n // Make `global` and avoid `lastIndex` issues by working with a copy\n separator2, match, lastIndex, lastLength;\n separator = new RegExp(separator.source, flags + 'g');\n string += ''; // Type-convert\n if (!compliantExecNpcg) {\n // Doesn't need flags gy, but they don't hurt\n separator2 = new RegExp('^' + separator.source + '$(?!\\\\s)', flags);\n }\n /* Values for `limit`, per the spec:\n * If undefined: 4294967295 // Math.pow(2, 32) - 1\n * If 0, Infinity, or NaN: 0\n * 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 rules\n */\n limit = limit === void 0 ?\n -1 >>> 0 : // Math.pow(2, 32) - 1\n ToUint32(limit);\n while (match = separator.exec(string)) {\n // `separator.lastIndex` is not reliable cross-browser\n lastIndex = match.index + match[0].length;\n if (lastIndex > lastLastIndex) {\n output.push(string.slice(lastLastIndex, match.index));\n // Fix browsers whose `exec` methods don't consistently return `undefined` for\n // nonparticipating capturing groups\n if (!compliantExecNpcg && match.length > 1) {\n match[0].replace(separator2, function () {\n for (var i = 1; i < arguments.length - 2; i++) {\n if (arguments[i] === void 0) {\n match[i] = void 0;\n }\n }\n });\n }\n if (match.length > 1 && match.index < string.length) {\n ArrayPrototype.push.apply(output, match.slice(1));\n }\n lastLength = match[0].length;\n lastLastIndex = lastIndex;\n if (output.length >= limit) {\n break;\n }\n }\n if (separator.lastIndex === match.index) {\n separator.lastIndex++; // Avoid an infinite loop\n }\n }\n if (lastLastIndex === string.length) {\n if (lastLength || !separator.test('')) {\n output.push('');\n }\n } else {\n output.push(string.slice(lastLastIndex));\n }\n return output.length > limit ? output.slice(0, limit) : output;\n };\n }());\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 limit\n// elements.\n// \"0\".split(undefined, 0) -> []\n} else if ('0'.split(void 0, 0).length) {\n StringPrototype.split = function split(separator, limit) {\n if (separator === void 0 && limit === 0) { return []; }\n return string_split.call(this, separator, limit);\n };\n}\n\n// ECMA-262, 3rd B.2.3\n// Not an ECMAScript standard, although ECMAScript 3rd Edition has a\n// non-normative section suggesting uniform semantics and it should be\n// normalized across all browsers\n// [bugfix, IE lt 9] IE < 9 substr() with negative value not working in IE\nvar string_substr = StringPrototype.substr;\nvar hasNegativeSubstrBug = ''.substr && '0b'.substr(-1) !== 'b';\ndefineProperties(StringPrototype, {\n substr: function substr(start, length) {\n return string_substr.call(\n this,\n start < 0 ? ((start = this.length + start) < 0 ? 0 : start) : start,\n length\n );\n }\n}, hasNegativeSubstrBug);\n","'use strict';\n\nmodule.exports = [\n // streaming transports\n require('./transport/websocket')\n, require('./transport/xhr-streaming')\n, require('./transport/xdr-streaming')\n, require('./transport/eventsource')\n, require('./transport/lib/iframe-wrap')(require('./transport/eventsource'))\n\n // polling transports\n, require('./transport/htmlfile')\n, require('./transport/lib/iframe-wrap')(require('./transport/htmlfile'))\n, require('./transport/xhr-polling')\n, require('./transport/xdr-polling')\n, require('./transport/lib/iframe-wrap')(require('./transport/xhr-polling'))\n, require('./transport/jsonp-polling')\n];\n","'use strict';\n\nvar EventEmitter = require('events').EventEmitter\n , inherits = require('inherits')\n , utils = require('../../utils/event')\n , urlUtils = require('../../utils/url')\n , XHR = global.XMLHttpRequest\n ;\n\nvar debug = function() {};\nif (process.env.NODE_ENV !== 'production') {\n debug = require('debug')('sockjs-client:browser:xhr');\n}\n\nfunction AbstractXHRObject(method, url, payload, opts) {\n debug(method, url);\n var self = this;\n EventEmitter.call(this);\n\n setTimeout(function () {\n self._start(method, url, payload, opts);\n }, 0);\n}\n\ninherits(AbstractXHRObject, EventEmitter);\n\nAbstractXHRObject.prototype._start = function(method, url, payload, opts) {\n var self = this;\n\n try {\n this.xhr = new XHR();\n } catch (x) {\n // intentionally empty\n }\n\n if (!this.xhr) {\n debug('no xhr');\n this.emit('finish', 0, 'no xhr support');\n this._cleanup();\n return;\n }\n\n // several browsers cache POSTs\n url = urlUtils.addQuery(url, 't=' + (+new Date()));\n\n // Explorer tends to keep connection open, even after the\n // tab gets closed: http://bugs.jquery.com/ticket/5280\n this.unloadRef = utils.unloadAdd(function() {\n debug('unload cleanup');\n self._cleanup(true);\n });\n try {\n this.xhr.open(method, url, true);\n if (this.timeout && 'timeout' in this.xhr) {\n this.xhr.timeout = this.timeout;\n this.xhr.ontimeout = function() {\n debug('xhr timeout');\n self.emit('finish', 0, '');\n self._cleanup(false);\n };\n }\n } catch (e) {\n debug('exception', e);\n // IE raises an exception on wrong port.\n this.emit('finish', 0, '');\n this._cleanup(false);\n return;\n }\n\n if ((!opts || !opts.noCredentials) && AbstractXHRObject.supportsCORS) {\n debug('withCredentials');\n // Mozilla docs says https://developer.mozilla.org/en/XMLHttpRequest :\n // \"This never affects same-site requests.\"\n\n this.xhr.withCredentials = 'true';\n }\n if (opts && opts.headers) {\n for (var key in opts.headers) {\n this.xhr.setRequestHeader(key, opts.headers[key]);\n }\n }\n\n this.xhr.onreadystatechange = function() {\n if (self.xhr) {\n var x = self.xhr;\n var text, status;\n debug('readyState', x.readyState);\n switch (x.readyState) {\n case 3:\n // IE doesn't like peeking into responseText or status\n // on Microsoft.XMLHTTP and readystate=3\n try {\n status = x.status;\n text = x.responseText;\n } catch (e) {\n // intentionally empty\n }\n debug('status', status);\n // IE returns 1223 for 204: http://bugs.jquery.com/ticket/1450\n if (status === 1223) {\n status = 204;\n }\n\n // IE does return readystate == 3 for 404 answers.\n if (status === 200 && text && text.length > 0) {\n debug('chunk');\n self.emit('chunk', status, text);\n }\n break;\n case 4:\n status = x.status;\n debug('status', status);\n // IE returns 1223 for 204: http://bugs.jquery.com/ticket/1450\n if (status === 1223) {\n status = 204;\n }\n // IE returns this for a bad port\n // http://msdn.microsoft.com/en-us/library/windows/desktop/aa383770(v=vs.85).aspx\n if (status === 12005 || status === 12029) {\n status = 0;\n }\n\n debug('finish', status, x.responseText);\n self.emit('finish', status, x.responseText);\n self._cleanup(false);\n break;\n }\n }\n };\n\n try {\n self.xhr.send(payload);\n } catch (e) {\n self.emit('finish', 0, '');\n self._cleanup(false);\n }\n};\n\nAbstractXHRObject.prototype._cleanup = function(abort) {\n debug('cleanup');\n if (!this.xhr) {\n return;\n }\n this.removeAllListeners();\n utils.unloadDel(this.unloadRef);\n\n // IE needs this field to be a function\n this.xhr.onreadystatechange = function() {};\n if (this.xhr.ontimeout) {\n this.xhr.ontimeout = null;\n }\n\n if (abort) {\n try {\n this.xhr.abort();\n } catch (x) {\n // intentionally empty\n }\n }\n this.unloadRef = this.xhr = null;\n};\n\nAbstractXHRObject.prototype.close = function() {\n debug('close');\n this._cleanup(true);\n};\n\nAbstractXHRObject.enabled = !!XHR;\n// override XMLHttpRequest for IE6/7\n// obfuscate to avoid firewalls\nvar axo = ['Active'].concat('Object').join('X');\nif (!AbstractXHRObject.enabled && (axo in global)) {\n debug('overriding xmlhttprequest');\n XHR = function() {\n try {\n return new global[axo]('Microsoft.XMLHTTP');\n } catch (e) {\n return null;\n }\n };\n AbstractXHRObject.enabled = !!new XHR();\n}\n\nvar cors = false;\ntry {\n cors = 'withCredentials' in new XHR();\n} catch (ignored) {\n // intentionally empty\n}\n\nAbstractXHRObject.supportsCORS = cors;\n\nmodule.exports = AbstractXHRObject;\n","module.exports = global.EventSource;\n","'use strict';\n\nvar Driver = global.WebSocket || global.MozWebSocket;\nif (Driver) {\n\tmodule.exports = function WebSocketBrowserDriver(url) {\n\t\treturn new Driver(url);\n\t};\n} else {\n\tmodule.exports = undefined;\n}\n","'use strict';\n\nvar inherits = require('inherits')\n , AjaxBasedTransport = require('./lib/ajax-based')\n , EventSourceReceiver = require('./receiver/eventsource')\n , XHRCorsObject = require('./sender/xhr-cors')\n , EventSourceDriver = require('eventsource')\n ;\n\nfunction EventSourceTransport(transUrl) {\n if (!EventSourceTransport.enabled()) {\n throw new Error('Transport created when disabled');\n }\n\n AjaxBasedTransport.call(this, transUrl, '/eventsource', EventSourceReceiver, XHRCorsObject);\n}\n\ninherits(EventSourceTransport, AjaxBasedTransport);\n\nEventSourceTransport.enabled = function() {\n return !!EventSourceDriver;\n};\n\nEventSourceTransport.transportName = 'eventsource';\nEventSourceTransport.roundTrips = 2;\n\nmodule.exports = EventSourceTransport;\n","'use strict';\n\nvar inherits = require('inherits')\n , HtmlfileReceiver = require('./receiver/htmlfile')\n , XHRLocalObject = require('./sender/xhr-local')\n , AjaxBasedTransport = require('./lib/ajax-based')\n ;\n\nfunction HtmlFileTransport(transUrl) {\n if (!HtmlfileReceiver.enabled) {\n throw new Error('Transport created when disabled');\n }\n AjaxBasedTransport.call(this, transUrl, '/htmlfile', HtmlfileReceiver, XHRLocalObject);\n}\n\ninherits(HtmlFileTransport, AjaxBasedTransport);\n\nHtmlFileTransport.enabled = function(info) {\n return HtmlfileReceiver.enabled && info.sameOrigin;\n};\n\nHtmlFileTransport.transportName = 'htmlfile';\nHtmlFileTransport.roundTrips = 2;\n\nmodule.exports = HtmlFileTransport;\n","'use strict';\n\n// Few cool transports do work only for same-origin. In order to make\n// them work cross-domain we shall use iframe, served from the\n// remote domain. New browsers have capabilities to communicate with\n// cross domain iframe using postMessage(). In IE it was implemented\n// from IE 8+, but of course, IE got some details wrong:\n// http://msdn.microsoft.com/en-us/library/cc197015(v=VS.85).aspx\n// http://stevesouders.com/misc/test-postmessage.php\n\nvar 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')\n ;\n\nvar debug = function() {};\nif (process.env.NODE_ENV !== 'production') {\n debug = require('debug')('sockjs-client:transport:iframe');\n}\n\nfunction IframeTransport(transport, transUrl, baseUrl) {\n if (!IframeTransport.enabled()) {\n throw new Error('Transport created when disabled');\n }\n EventEmitter.call(this);\n\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\n var iframeUrl = urlUtils.addPath(baseUrl, '/iframe.html') + '#' + this.windowId;\n debug(transport, transUrl, iframeUrl);\n\n this.iframeObj = iframeUtils.createIframe(iframeUrl, function(r) {\n debug('err callback');\n self.emit('close', 1006, 'Unable to load an iframe (' + r + ')');\n self.close();\n });\n\n this.onmessageCallback = this._message.bind(this);\n eventUtils.attachEvent('message', this.onmessageCallback);\n}\n\ninherits(IframeTransport, EventEmitter);\n\nIframeTransport.prototype.close = function() {\n debug('close');\n this.removeAllListeners();\n if (this.iframeObj) {\n eventUtils.detachEvent('message', this.onmessageCallback);\n try {\n // When the iframe is not loaded, IE raises an exception\n // on 'contentWindow'.\n this.postMessage('c');\n } catch (x) {\n // intentionally empty\n }\n this.iframeObj.cleanup();\n this.iframeObj = null;\n this.onmessageCallback = this.iframeObj = null;\n }\n};\n\nIframeTransport.prototype._message = function(e) {\n debug('message', e.data);\n if (!urlUtils.isOriginEqual(e.origin, this.origin)) {\n debug('not same origin', e.origin, this.origin);\n return;\n }\n\n var iframeMessage;\n try {\n iframeMessage = JSON3.parse(e.data);\n } catch (ignored) {\n debug('bad json', e.data);\n return;\n }\n\n if (iframeMessage.windowId !== this.windowId) {\n debug('mismatched window id', iframeMessage.windowId, this.windowId);\n return;\n }\n\n switch (iframeMessage.type) {\n case 's':\n this.iframeObj.loaded();\n // window global dependency\n this.postMessage('s', JSON3.stringify([\n version\n , this.transport\n , this.transUrl\n , this.baseUrl\n ]));\n break;\n case 't':\n this.emit('message', iframeMessage.data);\n break;\n case 'c':\n var cdata;\n try {\n cdata = JSON3.parse(iframeMessage.data);\n } catch (ignored) {\n debug('bad json', iframeMessage.data);\n return;\n }\n this.emit('close', cdata[0], cdata[1]);\n this.close();\n break;\n }\n};\n\nIframeTransport.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};\n\nIframeTransport.prototype.send = function(message) {\n debug('send', message);\n this.postMessage('m', message);\n};\n\nIframeTransport.enabled = function() {\n return iframeUtils.iframeEnabled;\n};\n\nIframeTransport.transportName = 'iframe';\nIframeTransport.roundTrips = 2;\n\nmodule.exports = IframeTransport;\n","'use strict';\n\n// The simplest and most robust transport, using the well-know cross\n// domain hack - JSONP. This transport is quite inefficient - one\n// message could use up to one http request. But at least it works almost\n// everywhere.\n// Known limitations:\n// o you will get a spinning cursor\n// o for Konqueror a dumb timer is needed to detect errors\n\nvar inherits = require('inherits')\n , SenderReceiver = require('./lib/sender-receiver')\n , JsonpReceiver = require('./receiver/jsonp')\n , jsonpSender = require('./sender/jsonp')\n ;\n\nfunction JsonPTransport(transUrl) {\n if (!JsonPTransport.enabled()) {\n throw new Error('Transport created when disabled');\n }\n SenderReceiver.call(this, transUrl, '/jsonp', jsonpSender, JsonpReceiver);\n}\n\ninherits(JsonPTransport, SenderReceiver);\n\nJsonPTransport.enabled = function() {\n return !!global.document;\n};\n\nJsonPTransport.transportName = 'jsonp-polling';\nJsonPTransport.roundTrips = 1;\nJsonPTransport.needBody = true;\n\nmodule.exports = JsonPTransport;\n","'use strict';\n\nvar inherits = require('inherits')\n , urlUtils = require('../../utils/url')\n , SenderReceiver = require('./sender-receiver')\n ;\n\nvar debug = function() {};\nif (process.env.NODE_ENV !== 'production') {\n debug = require('debug')('sockjs-client:ajax-based');\n}\n\nfunction createAjaxSender(AjaxObject) {\n return function(url, payload, callback) {\n debug('create ajax sender', url, payload);\n var opt = {};\n if (typeof payload === 'string') {\n opt.headers = {'Content-type': 'text/plain'};\n }\n 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;\n\n if (status !== 200 && status !== 204) {\n return callback(new Error('http status ' + status));\n }\n callback();\n });\n return function() {\n debug('abort');\n xo.close();\n xo = null;\n\n var err = new Error('Aborted');\n err.code = 1000;\n callback(err);\n };\n };\n}\n\nfunction AjaxBasedTransport(transUrl, urlSuffix, Receiver, AjaxObject) {\n SenderReceiver.call(this, transUrl, urlSuffix, createAjaxSender(AjaxObject), Receiver, AjaxObject);\n}\n\ninherits(AjaxBasedTransport, SenderReceiver);\n\nmodule.exports = AjaxBasedTransport;\n","'use strict';\n\nvar inherits = require('inherits')\n , EventEmitter = require('events').EventEmitter\n ;\n\nvar debug = function() {};\nif (process.env.NODE_ENV !== 'production') {\n debug = require('debug')('sockjs-client:buffered-sender');\n}\n\nfunction BufferedSender(url, sender) {\n debug(url);\n EventEmitter.call(this);\n this.sendBuffer = [];\n this.sender = sender;\n this.url = url;\n}\n\ninherits(BufferedSender, EventEmitter);\n\nBufferedSender.prototype.send = function(message) {\n debug('send', message);\n this.sendBuffer.push(message);\n if (!this.sendStop) {\n this.sendSchedule();\n }\n};\n\n// For polling transports in a situation when in the message callback,\n// new message is being send. If the sending connection was started\n// before receiving one, it is possible to saturate the network and\n// timeout due to the lack of receiving socket. To avoid that we delay\n// sending messages by some small time, in order to let receiving\n// connection be started beforehand. This is only a halfmeasure and\n// does not fix the big problem, but it does make the tests go more\n// stable on slow networks.\nBufferedSender.prototype.sendScheduleWait = function() {\n debug('sendScheduleWait');\n var self = this;\n var tref;\n this.sendStop = function() {\n debug('sendStop');\n self.sendStop = null;\n clearTimeout(tref);\n };\n tref = setTimeout(function() {\n debug('timeout');\n self.sendStop = null;\n self.sendSchedule();\n }, 25);\n};\n\nBufferedSender.prototype.sendSchedule = function() {\n debug('sendSchedule', this.sendBuffer.length);\n var self = this;\n 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;\n 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};\n\nBufferedSender.prototype._cleanup = function() {\n debug('_cleanup');\n this.removeAllListeners();\n};\n\nBufferedSender.prototype.close = function() {\n debug('close');\n this._cleanup();\n if (this.sendStop) {\n this.sendStop();\n this.sendStop = null;\n }\n};\n\nmodule.exports = BufferedSender;\n","'use strict';\n\nvar inherits = require('inherits')\n , IframeTransport = require('../iframe')\n , objectUtils = require('../../utils/object')\n ;\n\nmodule.exports = function(transport) {\n\n function IframeWrapTransport(transUrl, baseUrl) {\n IframeTransport.call(this, transport.transportName, transUrl, baseUrl);\n }\n\n inherits(IframeWrapTransport, IframeTransport);\n\n IframeWrapTransport.enabled = function(url, info) {\n if (!global.document) {\n return false;\n }\n\n var iframeInfo = objectUtils.extend({}, info);\n iframeInfo.sameOrigin = true;\n return transport.enabled(iframeInfo) && IframeTransport.enabled();\n };\n\n IframeWrapTransport.transportName = 'iframe-' + transport.transportName;\n IframeWrapTransport.needBody = true;\n IframeWrapTransport.roundTrips = IframeTransport.roundTrips + transport.roundTrips - 1; // html, javascript (2) + transport - no CORS (1)\n\n IframeWrapTransport.facadeTransport = transport;\n\n return IframeWrapTransport;\n};\n","'use strict';\n\nvar inherits = require('inherits')\n , EventEmitter = require('events').EventEmitter\n ;\n\nvar debug = function() {};\nif (process.env.NODE_ENV !== 'production') {\n debug = require('debug')('sockjs-client:polling');\n}\n\nfunction Polling(Receiver, receiveUrl, AjaxObject) {\n debug(receiveUrl);\n EventEmitter.call(this);\n this.Receiver = Receiver;\n this.receiveUrl = receiveUrl;\n this.AjaxObject = AjaxObject;\n this._scheduleReceiver();\n}\n\ninherits(Polling, EventEmitter);\n\nPolling.prototype._scheduleReceiver = function() {\n debug('_scheduleReceiver');\n var self = this;\n var poll = this.poll = new this.Receiver(this.receiveUrl, this.AjaxObject);\n\n poll.on('message', function(msg) {\n debug('message', msg);\n self.emit('message', msg);\n });\n\n poll.once('close', function(code, reason) {\n debug('close', code, reason, self.pollIsClosing);\n self.poll = poll = null;\n\n 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};\n\nPolling.prototype.abort = function() {\n debug('abort');\n this.removeAllListeners();\n this.pollIsClosing = true;\n if (this.poll) {\n this.poll.abort();\n }\n};\n\nmodule.exports = Polling;\n","'use strict';\n\nvar inherits = require('inherits')\n , urlUtils = require('../../utils/url')\n , BufferedSender = require('./buffered-sender')\n , Polling = require('./polling')\n ;\n\nvar debug = function() {};\nif (process.env.NODE_ENV !== 'production') {\n debug = require('debug')('sockjs-client:sender-receiver');\n}\n\nfunction 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\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}\n\ninherits(SenderReceiver, BufferedSender);\n\nSenderReceiver.prototype.close = function() {\n BufferedSender.prototype.close.call(this);\n debug('close');\n this.removeAllListeners();\n if (this.poll) {\n this.poll.abort();\n this.poll = null;\n }\n};\n\nmodule.exports = SenderReceiver;\n","'use strict';\n\nvar inherits = require('inherits')\n , EventEmitter = require('events').EventEmitter\n , EventSourceDriver = require('eventsource')\n ;\n\nvar debug = function() {};\nif (process.env.NODE_ENV !== 'production') {\n debug = require('debug')('sockjs-client:receiver:eventsource');\n}\n\nfunction EventSourceReceiver(url) {\n debug(url);\n EventEmitter.call(this);\n\n var self = this;\n var es = this.es = new EventSourceDriver(url);\n es.onmessage = function(e) {\n debug('message', e.data);\n self.emit('message', decodeURI(e.data));\n };\n es.onerror = function(e) {\n debug('error', es.readyState, e);\n // ES on reconnection has readyState = 0 or 1.\n // on network error it's CLOSED = 2\n var reason = (es.readyState !== 2 ? 'network' : 'permanent');\n self._cleanup();\n self._close(reason);\n };\n}\n\ninherits(EventSourceReceiver, EventEmitter);\n\nEventSourceReceiver.prototype.abort = function() {\n debug('abort');\n this._cleanup();\n this._close('user');\n};\n\nEventSourceReceiver.prototype._cleanup = function() {\n debug('cleanup');\n var es = this.es;\n if (es) {\n es.onmessage = es.onerror = null;\n es.close();\n this.es = null;\n }\n};\n\nEventSourceReceiver.prototype._close = function(reason) {\n debug('close', reason);\n var self = this;\n // Safari and chrome < 15 crash if we close window before\n // waiting for ES cleanup. See:\n // https://code.google.com/p/chromium/issues/detail?id=89155\n setTimeout(function() {\n self.emit('close', null, reason);\n self.removeAllListeners();\n }, 200);\n};\n\nmodule.exports = EventSourceReceiver;\n","'use strict';\n\nvar inherits = require('inherits')\n , iframeUtils = require('../../utils/iframe')\n , urlUtils = require('../../utils/url')\n , EventEmitter = require('events').EventEmitter\n , random = require('../../utils/random')\n ;\n\nvar debug = function() {};\nif (process.env.NODE_ENV !== 'production') {\n debug = require('debug')('sockjs-client:receiver:htmlfile');\n}\n\nfunction HtmlfileReceiver(url) {\n debug(url);\n EventEmitter.call(this);\n var self = this;\n iframeUtils.polluteGlobalNamespace();\n\n this.id = 'a' + random.string(6);\n url = urlUtils.addQuery(url, 'c=' + decodeURIComponent(iframeUtils.WPrefix + '.' + this.id));\n\n debug('using htmlfile', HtmlfileReceiver.htmlfileEnabled);\n var constructFunc = HtmlfileReceiver.htmlfileEnabled ?\n iframeUtils.createHtmlfile : iframeUtils.createIframe;\n\n global[iframeUtils.WPrefix][this.id] = {\n start: function() {\n debug('start');\n self.iframeObj.loaded();\n }\n , message: function(data) {\n debug('message', data);\n self.emit('message', data);\n }\n , stop: function() {\n debug('stop');\n self._cleanup();\n self._close('network');\n }\n };\n this.iframeObj = constructFunc(url, function() {\n debug('callback');\n self._cleanup();\n self._close('permanent');\n });\n}\n\ninherits(HtmlfileReceiver, EventEmitter);\n\nHtmlfileReceiver.prototype.abort = function() {\n debug('abort');\n this._cleanup();\n this._close('user');\n};\n\nHtmlfileReceiver.prototype._cleanup = function() {\n debug('_cleanup');\n if (this.iframeObj) {\n this.iframeObj.cleanup();\n this.iframeObj = null;\n }\n delete global[iframeUtils.WPrefix][this.id];\n};\n\nHtmlfileReceiver.prototype._close = function(reason) {\n debug('_close', reason);\n this.emit('close', null, reason);\n this.removeAllListeners();\n};\n\nHtmlfileReceiver.htmlfileEnabled = false;\n\n// obfuscate to avoid firewalls\nvar axo = ['Active'].concat('Object').join('X');\nif (axo in global) {\n try {\n HtmlfileReceiver.htmlfileEnabled = !!new global[axo]('htmlfile');\n } catch (x) {\n // intentionally empty\n }\n}\n\nHtmlfileReceiver.enabled = HtmlfileReceiver.htmlfileEnabled || iframeUtils.iframeEnabled;\n\nmodule.exports = HtmlfileReceiver;\n","'use strict';\n\nvar 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\n ;\n\nvar debug = function() {};\nif (process.env.NODE_ENV !== 'production') {\n debug = require('debug')('sockjs-client:receiver:jsonp');\n}\n\nfunction JsonpReceiver(url) {\n debug(url);\n var self = this;\n EventEmitter.call(this);\n\n utils.polluteGlobalNamespace();\n\n this.id = 'a' + random.string(6);\n var urlWithId = urlUtils.addQuery(url, 'c=' + encodeURIComponent(utils.WPrefix + '.' + this.id));\n\n global[utils.WPrefix][this.id] = this._callback.bind(this);\n this._createScript(urlWithId);\n\n // Fallback mostly for Konqueror - stupid timer, 35 seconds shall be plenty.\n this.timeoutId = setTimeout(function() {\n debug('timeout');\n self._abort(new Error('JSONP script loaded abnormally (timeout)'));\n }, JsonpReceiver.timeout);\n}\n\ninherits(JsonpReceiver, EventEmitter);\n\nJsonpReceiver.prototype.abort = function() {\n debug('abort');\n if (global[utils.WPrefix][this.id]) {\n var err = new Error('JSONP user aborted read');\n err.code = 1000;\n this._abort(err);\n }\n};\n\nJsonpReceiver.timeout = 35000;\nJsonpReceiver.scriptErrorTimeout = 1000;\n\nJsonpReceiver.prototype._callback = function(data) {\n debug('_callback', data);\n this._cleanup();\n\n if (this.aborting) {\n return;\n }\n\n if (data) {\n debug('message', data);\n this.emit('message', data);\n }\n this.emit('close', null, 'network');\n this.removeAllListeners();\n};\n\nJsonpReceiver.prototype._abort = function(err) {\n debug('_abort', err);\n this._cleanup();\n this.aborting = true;\n this.emit('close', err.code, err.message);\n this.removeAllListeners();\n};\n\nJsonpReceiver.prototype._cleanup = function() {\n debug('_cleanup');\n clearTimeout(this.timeoutId);\n if (this.script2) {\n this.script2.parentNode.removeChild(this.script2);\n this.script2 = null;\n }\n if (this.script) {\n var script = this.script;\n // Unfortunately, you can't really abort script loading of\n // the script.\n script.parentNode.removeChild(script);\n script.onreadystatechange = script.onerror =\n script.onload = script.onclick = null;\n this.script = null;\n }\n delete global[utils.WPrefix][this.id];\n};\n\nJsonpReceiver.prototype._scriptError = function() {\n debug('_scriptError');\n var self = this;\n if (this.errorTimer) {\n return;\n }\n\n this.errorTimer = setTimeout(function() {\n if (!self.loadedOkay) {\n self._abort(new Error('JSONP script loaded abnormally (onerror)'));\n }\n }, JsonpReceiver.scriptErrorTimeout);\n};\n\nJsonpReceiver.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.\n\n 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);\n script.onload = function() {\n debug('onload');\n self._abort(new Error('JSONP script loaded abnormally (onload)'));\n };\n\n // IE9 fires 'error' event after onreadystatechange or before, in random order.\n // Use loadedOkay to determine if actually errored\n script.onreadystatechange = function() {\n debug('onreadystatechange', script.readyState);\n if (/loaded|closed/.test(script.readyState)) {\n if (script && script.htmlFor && script.onclick) {\n self.loadedOkay = true;\n try {\n // In IE, actually execute the script.\n script.onclick();\n } catch (x) {\n // intentionally empty\n }\n }\n if (script) {\n self._abort(new Error('JSONP script loaded abnormally (onreadystatechange)'));\n }\n }\n };\n // IE: event/htmlFor/onclick trick.\n // One can't rely on proper order for onreadystatechange. In order to\n // make sure, set a 'htmlFor' and 'event' properties, so that\n // script code will be installed as 'onclick' handler for the\n // script object. Later, onreadystatechange, manually execute this\n // code. FF and Chrome doesn't work with 'event' and 'htmlFor'\n // set. For reference see:\n // http://jaubourg.net/2010/07/loading-script-as-onclick-handler-of.html\n // Also, read on that about script ordering:\n // http://wiki.whatwg.org/wiki/Dynamic_Script_Execution_Order\n if (typeof script.async === 'undefined' && global.document.attachEvent) {\n // According to mozilla docs, in recent browsers script.async defaults\n // to 'true', so we may use it to detect a good browser:\n // https://developer.mozilla.org/en/HTML/Element/script\n if (!browser.isOpera()) {\n // Naively assume we're in IE\n try {\n script.htmlFor = script.id;\n script.event = 'onclick';\n } catch (x) {\n // intentionally empty\n }\n script.async = true;\n } else {\n // Opera, second sync script hack\n 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 }\n if (typeof script.async !== 'undefined') {\n script.async = true;\n }\n\n var head = global.document.getElementsByTagName('head')[0];\n head.insertBefore(script, head.firstChild);\n if (script2) {\n head.insertBefore(script2, head.firstChild);\n }\n};\n\nmodule.exports = JsonpReceiver;\n","'use strict';\n\nvar inherits = require('inherits')\n , EventEmitter = require('events').EventEmitter\n ;\n\nvar debug = function() {};\nif (process.env.NODE_ENV !== 'production') {\n debug = require('debug')('sockjs-client:receiver:xhr');\n}\n\nfunction XhrReceiver(url, AjaxObject) {\n debug(url);\n EventEmitter.call(this);\n var self = this;\n\n this.bufferPosition = 0;\n\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);\n self._chunkHandler(status, text);\n self.xo = null;\n var reason = status === 200 ? 'network' : 'permanent';\n debug('close', reason);\n self.emit('close', null, reason);\n self._cleanup();\n });\n}\n\ninherits(XhrReceiver, EventEmitter);\n\nXhrReceiver.prototype._chunkHandler = function(status, text) {\n debug('_chunkHandler', status);\n if (status !== 200 || !text) {\n return;\n }\n\n for (var idx = -1; ; this.bufferPosition += idx + 1) {\n var buf = text.slice(this.bufferPosition);\n idx = buf.indexOf('\\n');\n if (idx === -1) {\n break;\n }\n var msg = buf.slice(0, idx);\n if (msg) {\n debug('message', msg);\n this.emit('message', msg);\n }\n }\n};\n\nXhrReceiver.prototype._cleanup = function() {\n debug('_cleanup');\n this.removeAllListeners();\n};\n\nXhrReceiver.prototype.abort = function() {\n debug('abort');\n if (this.xo) {\n this.xo.close();\n debug('close');\n this.emit('close', null, 'user');\n this.xo = null;\n }\n this._cleanup();\n};\n\nmodule.exports = XhrReceiver;\n","'use strict';\n\nvar random = require('../../utils/random')\n , urlUtils = require('../../utils/url')\n ;\n\nvar debug = function() {};\nif (process.env.NODE_ENV !== 'production') {\n debug = require('debug')('sockjs-client:sender:jsonp');\n}\n\nvar form, area;\n\nfunction createIframe(id) {\n debug('createIframe', id);\n try {\n // ie6 dynamic iframes with target=\"\" support (thanks Chris Lambacher)\n return global.document.createElement('