diff --git a/dist/bellows2.js b/dist/bellows2.js
index 350c1e7..b69f897 100644
--- a/dist/bellows2.js
+++ b/dist/bellows2.js
@@ -1,11642 +1,1027 @@
/******/ (() => { // webpackBootstrap
-/******/ var __webpack_modules__ = ({
+/******/ "use strict";
+var __webpack_exports__ = {};
-/***/ "./node_modules/ansi-html-community/index.js":
-/*!***************************************************!*\
- !*** ./node_modules/ansi-html-community/index.js ***!
- \***************************************************/
-/***/ ((module) => {
-
-"use strict";
-
-
-module.exports = ansiHTML
-
-// Reference to https://github.com/sindresorhus/ansi-regex
-var _regANSI = /(?:(?:\u001b\[)|\u009b)(?:(?:[0-9]{1,3})?(?:(?:;[0-9]{0,3})*)?[A-M|f-m])|\u001b[A-M]/
-
-var _defColors = {
- reset: ['fff', '000'], // [FOREGROUD_COLOR, BACKGROUND_COLOR]
- black: '000',
- red: 'ff0000',
- green: '209805',
- yellow: 'e8bf03',
- blue: '0000ff',
- magenta: 'ff00ff',
- cyan: '00ffee',
- lightgrey: 'f0f0f0',
- darkgrey: '888'
-}
-var _styles = {
- 30: 'black',
- 31: 'red',
- 32: 'green',
- 33: 'yellow',
- 34: 'blue',
- 35: 'magenta',
- 36: 'cyan',
- 37: 'lightgrey'
-}
-var _openTags = {
- '1': 'font-weight:bold', // bold
- '2': 'opacity:0.5', // dim
- '3': '', // italic
- '4': '', // underscore
- '8': 'display:none', // hidden
- '9': '' // delete
-}
-var _closeTags = {
- '23': '', // reset italic
- '24': '', // reset underscore
- '29': '' // reset delete
-}
-
-;[0, 21, 22, 27, 28, 39, 49].forEach(function (n) {
- _closeTags[n] = ''
-})
-
-/**
- * Converts text with ANSI color codes to HTML markup.
- * @param {String} text
- * @returns {*}
- */
-function ansiHTML (text) {
- // Returns the text if the string has no ANSI escape code.
- if (!_regANSI.test(text)) {
- return text
- }
-
- // Cache opened sequence.
- var ansiCodes = []
- // Replace with markup.
- var ret = text.replace(/\033\[(\d+)m/g, function (match, seq) {
- var ot = _openTags[seq]
- if (ot) {
- // If current sequence has been opened, close it.
- if (!!~ansiCodes.indexOf(seq)) { // eslint-disable-line no-extra-boolean-cast
- ansiCodes.pop()
- return ''
- }
- // Open tag.
- ansiCodes.push(seq)
- return ot[0] === '<' ? ot : ''
+;// CONCATENATED MODULE: ./src/module/helper/Utils.ts
+class Logger {
+ Log(...args) {
+ console.log("Bellows |", ...args);
}
-
- var ct = _closeTags[seq]
- if (ct) {
- // Pop sequence
- ansiCodes.pop()
- return ct
+ LogDebug(...args) {
+ console.debug("Bellows DBG |", ...args);
+ }
+ LogError(...args) {
+ console.error("Bellows ERR |", ...args);
}
- return ''
- })
-
- // Make sure tags are closed.
- var l = ansiCodes.length
- ;(l > 0) && (ret += Array(l + 1).join(''))
-
- return ret
}
+/* harmony default export */ const Utils = (new Logger());
-/**
- * Customize colors.
- * @param {Object} colors reference to _defColors
- */
-ansiHTML.setColors = function (colors) {
- if (typeof colors !== 'object') {
- throw new Error('`colors` parameter must be an Object.')
- }
+;// CONCATENATED MODULE: ./src/module/api/YoutubeIframeApi.ts
- var _finalColors = {}
- for (var key in _defColors) {
- var hex = colors.hasOwnProperty(key) ? colors[key] : null
- if (!hex) {
- _finalColors[key] = _defColors[key]
- continue
+class YoutubeIframeApi {
+ constructor() {
+ this.playersMap = new Map();
}
- if ('reset' === key) {
- if (typeof hex === 'string') {
- hex = [hex]
- }
- if (!Array.isArray(hex) || hex.length === 0 || hex.some(function (h) {
- return typeof h !== 'string'
- })) {
- throw new Error('The value of `' + key + '` property must be an Array and each item could only be a hex string, e.g.: FF0000')
- }
- var defHexColor = _defColors[key]
- if (!hex[0]) {
- hex[0] = defHexColor[0]
- }
- if (hex.length === 1 || !hex[1]) {
- hex = [hex[0]]
- hex.push(defHexColor[1])
- }
-
- hex = hex.slice(0, 2)
- } else if (typeof hex !== 'string') {
- throw new Error('The value of `' + key + '` property must be a hex string, e.g.: FF0000')
+ static async initializeApi() {
+ if (YoutubeIframeApi.instance) {
+ throw new Error("Cannot initialize YoutubeIframeApi more than once!");
+ }
+ return new Promise((resolve) => {
+ var _a;
+ window.onYouTubeIframeAPIReady = function () {
+ YoutubeIframeApi.instance = new YoutubeIframeApi();
+ Utils.LogDebug("YoutubeIframeApi successfully initialized");
+ resolve();
+ };
+ if (!$("#yt-api-script").length) {
+ const tag = document.createElement("script");
+ tag.id = "yt-api-script";
+ tag.src = `${window.location.protocol}//www.youtube.com/iframe_api`;
+ tag.type = "text/javascript";
+ const firstScriptTag = document.getElementsByTagName("script")[0];
+ (_a = firstScriptTag.parentNode) === null || _a === void 0 ? void 0 : _a.insertBefore(tag, firstScriptTag);
+ Utils.LogDebug("Downloading YoutubeIframeApi...");
+ }
+ });
}
- _finalColors[key] = hex
- }
- _setTags(_finalColors)
-}
-
-/**
- * Reset colors.
- */
-ansiHTML.reset = function () {
- _setTags(_defColors)
-}
-
-/**
- * Expose tags, including open and close.
- * @type {Object}
- */
-ansiHTML.tags = {}
-
-if (Object.defineProperty) {
- Object.defineProperty(ansiHTML.tags, 'open', {
- get: function () { return _openTags }
- })
- Object.defineProperty(ansiHTML.tags, 'close', {
- get: function () { return _closeTags }
- })
-} else {
- ansiHTML.tags.open = _openTags
- ansiHTML.tags.close = _closeTags
-}
-
-function _setTags (colors) {
- // reset all
- _openTags['0'] = 'font-weight:normal;opacity:1;color:#' + colors.reset[0] + ';background:#' + colors.reset[1]
- // inverse
- _openTags['7'] = 'color:#' + colors.reset[1] + ';background:#' + colors.reset[0]
- // dark grey
- _openTags['90'] = 'color:#' + colors.darkgrey
-
- for (var code in _styles) {
- var color = _styles[code]
- var oriColor = colors[color] || '000'
- _openTags[code] = 'color:#' + oriColor
- code = parseInt(code)
- _openTags[(code + 10).toString()] = 'background:#' + oriColor
- }
-}
-
-ansiHTML.reset()
-
-
-/***/ }),
-
-/***/ "./node_modules/events/events.js":
-/*!***************************************!*\
- !*** ./node_modules/events/events.js ***!
- \***************************************/
-/***/ ((module) => {
-
-"use strict";
-// Copyright Joyent, Inc. and other Node contributors.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a
-// copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to permit
-// persons to whom the Software is furnished to do so, subject to the
-// following conditions:
-//
-// The above copyright notice and this permission notice shall be included
-// in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
-// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-// USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-
-
-var R = typeof Reflect === 'object' ? Reflect : null
-var ReflectApply = R && typeof R.apply === 'function'
- ? R.apply
- : function ReflectApply(target, receiver, args) {
- return Function.prototype.apply.call(target, receiver, args);
- }
-
-var ReflectOwnKeys
-if (R && typeof R.ownKeys === 'function') {
- ReflectOwnKeys = R.ownKeys
-} else if (Object.getOwnPropertySymbols) {
- ReflectOwnKeys = function ReflectOwnKeys(target) {
- return Object.getOwnPropertyNames(target)
- .concat(Object.getOwnPropertySymbols(target));
- };
-} else {
- ReflectOwnKeys = function ReflectOwnKeys(target) {
- return Object.getOwnPropertyNames(target);
- };
-}
-
-function ProcessEmitWarning(warning) {
- if (console && console.warn) console.warn(warning);
-}
-
-var NumberIsNaN = Number.isNaN || function NumberIsNaN(value) {
- return value !== value;
-}
-
-function EventEmitter() {
- EventEmitter.init.call(this);
-}
-module.exports = EventEmitter;
-module.exports.once = once;
-
-// Backwards-compat with node 0.10.x
-EventEmitter.EventEmitter = EventEmitter;
-
-EventEmitter.prototype._events = undefined;
-EventEmitter.prototype._eventsCount = 0;
-EventEmitter.prototype._maxListeners = undefined;
-
-// By default EventEmitters will print a warning if more than 10 listeners are
-// added to it. This is a useful default which helps finding memory leaks.
-var defaultMaxListeners = 10;
-
-function checkListener(listener) {
- if (typeof listener !== 'function') {
- throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener);
- }
-}
-
-Object.defineProperty(EventEmitter, 'defaultMaxListeners', {
- enumerable: true,
- get: function() {
- return defaultMaxListeners;
- },
- set: function(arg) {
- if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) {
- throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + '.');
+ static getInstance() {
+ if (!YoutubeIframeApi.instance) {
+ throw new Error("Tried to get YoutubeIframeApi before initialization!");
+ }
+ return this.instance;
}
- defaultMaxListeners = arg;
- }
-});
-
-EventEmitter.init = function() {
-
- if (this._events === undefined ||
- this._events === Object.getPrototypeOf(this)._events) {
- this._events = Object.create(null);
- this._eventsCount = 0;
- }
-
- this._maxListeners = this._maxListeners || undefined;
-};
-
-// Obviously not all Emitters should be limited to 10. This function allows
-// that to be increased. Set to zero for unlimited.
-EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {
- if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) {
- throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + '.');
- }
- this._maxListeners = n;
- return this;
-};
-
-function _getMaxListeners(that) {
- if (that._maxListeners === undefined)
- return EventEmitter.defaultMaxListeners;
- return that._maxListeners;
-}
-
-EventEmitter.prototype.getMaxListeners = function getMaxListeners() {
- return _getMaxListeners(this);
-};
-
-EventEmitter.prototype.emit = function emit(type) {
- var args = [];
- for (var i = 1; i < arguments.length; i++) args.push(arguments[i]);
- var doError = (type === 'error');
-
- var events = this._events;
- if (events !== undefined)
- doError = (doError && events.error === undefined);
- else if (!doError)
- return false;
-
- // If there is no 'error' event listener then throw.
- if (doError) {
- var er;
- if (args.length > 0)
- er = args[0];
- if (er instanceof Error) {
- // Note: The comments on the `throw` lines are intentional, they show
- // up in Node's output if this results in an unhandled exception.
- throw er; // Unhandled 'error' event
+ getPlayer(containerId, videoId) {
+ const playerId = this.getIdString(containerId, videoId);
+ return this.playersMap.get(playerId);
}
- // At least give some kind of context to the user
- var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : ''));
- err.context = er;
- throw err; // Unhandled 'error' event
- }
-
- var handler = events[type];
-
- if (handler === undefined)
- return false;
-
- if (typeof handler === 'function') {
- ReflectApply(handler, this, args);
- } else {
- var len = handler.length;
- var listeners = arrayClone(handler, len);
- for (var i = 0; i < len; ++i)
- ReflectApply(listeners[i], this, args);
- }
-
- return true;
-};
-
-function _addListener(target, type, listener, prepend) {
- var m;
- var events;
- var existing;
-
- checkListener(listener);
-
- events = target._events;
- if (events === undefined) {
- events = target._events = Object.create(null);
- target._eventsCount = 0;
- } else {
- // To avoid recursion in the case that type === "newListener"! Before
- // adding it to the listeners, first emit "newListener".
- if (events.newListener !== undefined) {
- target.emit('newListener', type,
- listener.listener ? listener.listener : listener);
-
- // Re-assign `events` because a newListener handler could have caused the
- // this._events to be assigned to a new object
- events = target._events;
+ async createPlayer(containerId, videoId) {
+ const playerId = this.getIdString(containerId, videoId);
+ if (this.playersMap.has(playerId)) {
+ throw new Error("Player already exists for this audio container!");
+ }
+ return new Promise((resolve, reject) => {
+ const onPlayerError = function (event) {
+ let errorMessage;
+ const data = event.data;
+ switch (data) {
+ case 2 /* PlayerError.InvalidParam */:
+ errorMessage = "Invalid videoId value.";
+ break;
+ case 5 /* PlayerError.Html5Error */:
+ errorMessage = "The requested content cannot be played in an HTML5 player or another error related to the HTML5 player has occurred.";
+ break;
+ case 100 /* PlayerError.VideoNotFound */:
+ errorMessage = "Video not found; It may have been deleted or marked as private.";
+ break;
+ case 101 /* PlayerError.EmbeddingNotAllowed */:
+ case 150 /* PlayerError.EmbeddingNotAllowed2 */:
+ errorMessage = "Embedding is not supported for this video.";
+ break;
+ default:
+ errorMessage = "Unspecified Error";
+ }
+ console.error(`Error creating Youtube player: ${errorMessage}`);
+ reject(errorMessage);
+ };
+ const onPlayerReadyCallback = function () {
+ this.playersMap.set(playerId, player);
+ //This class only handles initial errors before onReady. Container's responsibility to deal with these after.
+ player.removeEventListener("onError", onPlayerError);
+ resolve(player);
+ };
+ $("body").append(`
`);
+ const player = new YT.Player(playerId, {
+ videoId: videoId,
+ playerVars: {
+ loop: 1,
+ playlist: videoId,
+ controls: 0,
+ disablekb: 1,
+ enablejsapi: 1,
+ origin: window.location.origin,
+ },
+ events: {
+ "onReady": onPlayerReadyCallback.bind(this),
+ "onError": onPlayerError.bind(this)
+ }
+ });
+ });
}
- existing = events[type];
- }
-
- if (existing === undefined) {
- // Optimize the case of one listener. Don't need the extra array object.
- existing = events[type] = listener;
- ++target._eventsCount;
- } else {
- if (typeof existing === 'function') {
- // Adding the second element, need to change to array.
- existing = events[type] =
- prepend ? [listener, existing] : [existing, listener];
- // If we've already got an array, just append.
- } else if (prepend) {
- existing.unshift(listener);
- } else {
- existing.push(listener);
+ async createPlaylistPlayer(containerId, playlistId) {
+ const playerId = this.getIdString(containerId, playlistId);
+ if (this.playersMap.has(playerId)) {
+ throw new Error("Player already exists for this audio container!");
+ }
+ return new Promise((resolve, reject) => {
+ const onPlayerError = function (event) {
+ let errorMessage;
+ const data = event.data;
+ switch (data) {
+ case 2 /* PlayerError.InvalidParam */:
+ errorMessage = "Invalid videoId value.";
+ break;
+ case 5 /* PlayerError.Html5Error */:
+ errorMessage = "The requested content cannot be played in an HTML5 player or another error related to the HTML5 player has occurred.";
+ break;
+ case 100 /* PlayerError.VideoNotFound */:
+ errorMessage = "Video not found; It may have been deleted or marked as private.";
+ break;
+ case 101 /* PlayerError.EmbeddingNotAllowed */:
+ case 150 /* PlayerError.EmbeddingNotAllowed2 */:
+ errorMessage = "Embedding is not supported for this video.";
+ break;
+ default:
+ errorMessage = "Unspecified Error";
+ }
+ reject(errorMessage);
+ };
+ const onPlayerReadyCallback = function () {
+ this.playersMap.set(playerId, player);
+ //This class only handles initial errors before onReady. Container's responsibility to deal with these after.
+ player.removeEventListener("onError", onPlayerError);
+ resolve(player);
+ };
+ $("body").append(``);
+ //@ts-ignore missing yt types
+ const player = new YT.Player(playerId, {
+ height: "270px",
+ width: "480px",
+ playerVars: {
+ listType: "playlist",
+ list: playlistId,
+ controls: 0,
+ autohide: 1,
+ origin: window.location.origin,
+ },
+ events: {
+ "onReady": onPlayerReadyCallback.bind(this),
+ "onError": onPlayerError.bind(this)
+ }
+ });
+ });
}
-
- // Check for listener leak
- m = _getMaxListeners(target);
- if (m > 0 && existing.length > m && !existing.warned) {
- existing.warned = true;
- // No error code for this since it is a Warning
- // eslint-disable-next-line no-restricted-syntax
- var w = new Error('Possible EventEmitter memory leak detected. ' +
- existing.length + ' ' + String(type) + ' listeners ' +
- 'added. Use emitter.setMaxListeners() to ' +
- 'increase limit');
- w.name = 'MaxListenersExceededWarning';
- w.emitter = target;
- w.type = type;
- w.count = existing.length;
- ProcessEmitWarning(w);
+ async destroyPlayer(containerId, videoId) {
+ const playerId = this.getIdString(containerId, videoId);
+ const player = this.playersMap.get(playerId);
+ if (!player) {
+ throw new Error("Player does not exist!");
+ }
+ if (player.getPlayerState() === 1 /* PlayerState.PLAYING */) {
+ player.stopVideo();
+ }
+ this.playersMap.delete(playerId);
+ player.destroy();
+ $(`div#${playerId}`).remove();
+ }
+ getIdString(containerId, videoId) {
+ return `bellows-yt-iframe-${containerId}-${videoId}`;
}
- }
-
- return target;
-}
-
-EventEmitter.prototype.addListener = function addListener(type, listener) {
- return _addListener(this, type, listener, false);
-};
-
-EventEmitter.prototype.on = EventEmitter.prototype.addListener;
-
-EventEmitter.prototype.prependListener =
- function prependListener(type, listener) {
- return _addListener(this, type, listener, true);
- };
-
-function onceWrapper() {
- if (!this.fired) {
- this.target.removeListener(this.type, this.wrapFn);
- this.fired = true;
- if (arguments.length === 0)
- return this.listener.call(this.target);
- return this.listener.apply(this.target, arguments);
- }
-}
-
-function _onceWrap(target, type, listener) {
- var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener };
- var wrapped = onceWrapper.bind(state);
- wrapped.listener = listener;
- state.wrapFn = wrapped;
- return wrapped;
}
-EventEmitter.prototype.once = function once(type, listener) {
- checkListener(listener);
- this.on(type, _onceWrap(this, type, listener));
- return this;
-};
-
-EventEmitter.prototype.prependOnceListener =
- function prependOnceListener(type, listener) {
- checkListener(listener);
- this.prependListener(type, _onceWrap(this, type, listener));
- return this;
- };
-
-// Emits a 'removeListener' event if and only if the listener was removed.
-EventEmitter.prototype.removeListener =
- function removeListener(type, listener) {
- var list, events, position, i, originalListener;
-
- checkListener(listener);
-
- events = this._events;
- if (events === undefined)
- return this;
-
- list = events[type];
- if (list === undefined)
- return this;
-
- if (list === listener || list.listener === listener) {
- if (--this._eventsCount === 0)
- this._events = Object.create(null);
- else {
- delete events[type];
- if (events.removeListener)
- this.emit('removeListener', type, list.listener || listener);
- }
- } else if (typeof list !== 'function') {
- position = -1;
+;// CONCATENATED MODULE: ./src/types/streaming/streamType.ts
+var StreamType;
+(function (StreamType) {
+ StreamType["undefined"] = "";
+ StreamType["youtube"] = "youtube";
+})(StreamType || (StreamType = {}));
- for (i = list.length - 1; i >= 0; i--) {
- if (list[i] === listener || list[i].listener === listener) {
- originalListener = list[i].listener;
- position = i;
- break;
- }
- }
+;// CONCATENATED MODULE: ./src/module/services/import/YouTubePlaylistImportService.ts
- if (position < 0)
- return this;
- if (position === 0)
- list.shift();
- else {
- spliceOne(list, position);
- }
-
- if (list.length === 1)
- events[type] = list[0];
-
- if (events.removeListener !== undefined)
- this.emit('removeListener', type, originalListener || listener);
- }
-
- return this;
- };
-
-EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
-
-EventEmitter.prototype.removeAllListeners =
- function removeAllListeners(type) {
- var listeners, events, i;
-
- events = this._events;
- if (events === undefined)
- return this;
-
- // not listening for removeListener, no need to emit
- if (events.removeListener === undefined) {
- if (arguments.length === 0) {
- this._events = Object.create(null);
- this._eventsCount = 0;
- } else if (events[type] !== undefined) {
- if (--this._eventsCount === 0)
- this._events = Object.create(null);
- else
- delete events[type];
+class YouTubePlaylistImportService {
+ extractPlaylistKey(playlistString) {
+ //YouTube url (any string with a list querystring var)
+ //No reliable regex lookbehind for all browsers yet, so we'll just get the first capture group instead
+ const urlRegEx = /list=([a-zA-Z0-9_-]+)/;
+ //Plain playlist key
+ const keyRegEx = /^[a-zA-Z0-9_-]+$/;
+ if (!playlistString || playlistString.length === 0) {
+ return;
}
- return this;
- }
-
- // emit removeListener for all listeners on all events
- if (arguments.length === 0) {
- var keys = Object.keys(events);
- var key;
- for (i = 0; i < keys.length; ++i) {
- key = keys[i];
- if (key === 'removeListener') continue;
- this.removeAllListeners(key);
+ const matches = urlRegEx.exec(playlistString);
+ if (matches) {
+ return matches[1];
}
- this.removeAllListeners('removeListener');
- this._events = Object.create(null);
- this._eventsCount = 0;
- return this;
- }
-
- listeners = events[type];
-
- if (typeof listeners === 'function') {
- this.removeListener(type, listeners);
- } else if (listeners !== undefined) {
- // LIFO order
- for (i = listeners.length - 1; i >= 0; i--) {
- this.removeListener(type, listeners[i]);
+ else {
+ return playlistString.match(keyRegEx)[0];
}
- }
-
- return this;
- };
-
-function _listeners(target, type, unwrap) {
- var events = target._events;
-
- if (events === undefined)
- return [];
-
- var evlistener = events[type];
- if (evlistener === undefined)
- return [];
-
- if (typeof evlistener === 'function')
- return unwrap ? [evlistener.listener || evlistener] : [evlistener];
-
- return unwrap ?
- unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);
-}
-
-EventEmitter.prototype.listeners = function listeners(type) {
- return _listeners(this, type, true);
-};
-
-EventEmitter.prototype.rawListeners = function rawListeners(type) {
- return _listeners(this, type, false);
-};
-
-EventEmitter.listenerCount = function(emitter, type) {
- if (typeof emitter.listenerCount === 'function') {
- return emitter.listenerCount(type);
- } else {
- return listenerCount.call(emitter, type);
- }
-};
-
-EventEmitter.prototype.listenerCount = listenerCount;
-function listenerCount(type) {
- var events = this._events;
-
- if (events !== undefined) {
- var evlistener = events[type];
-
- if (typeof evlistener === 'function') {
- return 1;
- } else if (evlistener !== undefined) {
- return evlistener.length;
- }
- }
-
- return 0;
-}
-
-EventEmitter.prototype.eventNames = function eventNames() {
- return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];
-};
-
-function arrayClone(arr, n) {
- var copy = new Array(n);
- for (var i = 0; i < n; ++i)
- copy[i] = arr[i];
- return copy;
-}
-
-function spliceOne(list, index) {
- for (; index + 1 < list.length; index++)
- list[index] = list[index + 1];
- list.pop();
-}
-
-function unwrapListeners(arr) {
- var ret = new Array(arr.length);
- for (var i = 0; i < ret.length; ++i) {
- ret[i] = arr[i].listener || arr[i];
- }
- return ret;
-}
-
-function once(emitter, name) {
- return new Promise(function (resolve, reject) {
- function errorListener(err) {
- emitter.removeListener(name, resolver);
- reject(err);
- }
-
- function resolver() {
- if (typeof emitter.removeListener === 'function') {
- emitter.removeListener('error', errorListener);
- }
- resolve([].slice.call(arguments));
- };
-
- eventTargetAgnosticAddListener(emitter, name, resolver, { once: true });
- if (name !== 'error') {
- addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true });
- }
- });
-}
-
-function addErrorHandlerIfEventEmitter(emitter, handler, flags) {
- if (typeof emitter.on === 'function') {
- eventTargetAgnosticAddListener(emitter, 'error', handler, flags);
- }
-}
-
-function eventTargetAgnosticAddListener(emitter, name, listener, flags) {
- if (typeof emitter.on === 'function') {
- if (flags.once) {
- emitter.once(name, listener);
- } else {
- emitter.on(name, listener);
- }
- } else if (typeof emitter.addEventListener === 'function') {
- // EventTarget does not have `error` event semantics like Node
- // EventEmitters, we do not listen for `error` events here.
- emitter.addEventListener(name, function wrapListener(arg) {
- // IE does not have builtin `{ once: true }` support so we
- // have to do it manually.
- if (flags.once) {
- emitter.removeEventListener(name, wrapListener);
- }
- listener(arg);
- });
- } else {
- throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof emitter);
- }
-}
-
-
-/***/ }),
-
-/***/ "./node_modules/html-entities/lib/html4-entities.js":
-/*!**********************************************************!*\
- !*** ./node_modules/html-entities/lib/html4-entities.js ***!
- \**********************************************************/
-/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
-
-"use strict";
-
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-var surrogate_pairs_1 = __webpack_require__(/*! ./surrogate-pairs */ "./node_modules/html-entities/lib/surrogate-pairs.js");
-var HTML_ALPHA = ['apos', 'nbsp', 'iexcl', 'cent', 'pound', 'curren', 'yen', 'brvbar', 'sect', 'uml', 'copy', 'ordf', 'laquo', 'not', 'shy', 'reg', 'macr', 'deg', 'plusmn', 'sup2', 'sup3', 'acute', 'micro', 'para', 'middot', 'cedil', 'sup1', 'ordm', 'raquo', 'frac14', 'frac12', 'frac34', 'iquest', 'Agrave', 'Aacute', 'Acirc', 'Atilde', 'Auml', 'Aring', 'AElig', 'Ccedil', 'Egrave', 'Eacute', 'Ecirc', 'Euml', 'Igrave', 'Iacute', 'Icirc', 'Iuml', 'ETH', 'Ntilde', 'Ograve', 'Oacute', 'Ocirc', 'Otilde', 'Ouml', 'times', 'Oslash', 'Ugrave', 'Uacute', 'Ucirc', 'Uuml', 'Yacute', 'THORN', 'szlig', 'agrave', 'aacute', 'acirc', 'atilde', 'auml', 'aring', 'aelig', 'ccedil', 'egrave', 'eacute', 'ecirc', 'euml', 'igrave', 'iacute', 'icirc', 'iuml', 'eth', 'ntilde', 'ograve', 'oacute', 'ocirc', 'otilde', 'ouml', 'divide', 'oslash', 'ugrave', 'uacute', 'ucirc', 'uuml', 'yacute', 'thorn', 'yuml', 'quot', 'amp', 'lt', 'gt', 'OElig', 'oelig', 'Scaron', 'scaron', 'Yuml', 'circ', 'tilde', 'ensp', 'emsp', 'thinsp', 'zwnj', 'zwj', 'lrm', 'rlm', 'ndash', 'mdash', 'lsquo', 'rsquo', 'sbquo', 'ldquo', 'rdquo', 'bdquo', 'dagger', 'Dagger', 'permil', 'lsaquo', 'rsaquo', 'euro', 'fnof', 'Alpha', 'Beta', 'Gamma', 'Delta', 'Epsilon', 'Zeta', 'Eta', 'Theta', 'Iota', 'Kappa', 'Lambda', 'Mu', 'Nu', 'Xi', 'Omicron', 'Pi', 'Rho', 'Sigma', 'Tau', 'Upsilon', 'Phi', 'Chi', 'Psi', 'Omega', 'alpha', 'beta', 'gamma', 'delta', 'epsilon', 'zeta', 'eta', 'theta', 'iota', 'kappa', 'lambda', 'mu', 'nu', 'xi', 'omicron', 'pi', 'rho', 'sigmaf', 'sigma', 'tau', 'upsilon', 'phi', 'chi', 'psi', 'omega', 'thetasym', 'upsih', 'piv', 'bull', 'hellip', 'prime', 'Prime', 'oline', 'frasl', 'weierp', 'image', 'real', 'trade', 'alefsym', 'larr', 'uarr', 'rarr', 'darr', 'harr', 'crarr', 'lArr', 'uArr', 'rArr', 'dArr', 'hArr', 'forall', 'part', 'exist', 'empty', 'nabla', 'isin', 'notin', 'ni', 'prod', 'sum', 'minus', 'lowast', 'radic', 'prop', 'infin', 'ang', 'and', 'or', 'cap', 'cup', 'int', 'there4', 'sim', 'cong', 'asymp', 'ne', 'equiv', 'le', 'ge', 'sub', 'sup', 'nsub', 'sube', 'supe', 'oplus', 'otimes', 'perp', 'sdot', 'lceil', 'rceil', 'lfloor', 'rfloor', 'lang', 'rang', 'loz', 'spades', 'clubs', 'hearts', 'diams'];
-var HTML_CODES = [39, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 34, 38, 60, 62, 338, 339, 352, 353, 376, 710, 732, 8194, 8195, 8201, 8204, 8205, 8206, 8207, 8211, 8212, 8216, 8217, 8218, 8220, 8221, 8222, 8224, 8225, 8240, 8249, 8250, 8364, 402, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 931, 932, 933, 934, 935, 936, 937, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 977, 978, 982, 8226, 8230, 8242, 8243, 8254, 8260, 8472, 8465, 8476, 8482, 8501, 8592, 8593, 8594, 8595, 8596, 8629, 8656, 8657, 8658, 8659, 8660, 8704, 8706, 8707, 8709, 8711, 8712, 8713, 8715, 8719, 8721, 8722, 8727, 8730, 8733, 8734, 8736, 8743, 8744, 8745, 8746, 8747, 8756, 8764, 8773, 8776, 8800, 8801, 8804, 8805, 8834, 8835, 8836, 8838, 8839, 8853, 8855, 8869, 8901, 8968, 8969, 8970, 8971, 9001, 9002, 9674, 9824, 9827, 9829, 9830];
-var alphaIndex = {};
-var numIndex = {};
-(function () {
- var i = 0;
- var length = HTML_ALPHA.length;
- while (i < length) {
- var a = HTML_ALPHA[i];
- var c = HTML_CODES[i];
- alphaIndex[a] = String.fromCharCode(c);
- numIndex[c] = a;
- i++;
}
-})();
-var Html4Entities = /** @class */ (function () {
- function Html4Entities() {
- }
- Html4Entities.prototype.decode = function (str) {
- if (!str || !str.length) {
- return '';
+ async getPlaylistInfo(playlistKey) {
+ if (!playlistKey) {
+ throw new Error("Empty playlist key");
}
- return str.replace(/&(#?[\w\d]+);?/g, function (s, entity) {
- var chr;
- if (entity.charAt(0) === "#") {
- var code = entity.charAt(1).toLowerCase() === 'x' ?
- parseInt(entity.substr(2), 16) :
- parseInt(entity.substr(1));
- if (!isNaN(code) || code >= -32768) {
- if (code <= 65535) {
- chr = String.fromCharCode(code);
- }
- else {
- chr = surrogate_pairs_1.fromCodePoint(code);
- }
- }
- }
- else {
- chr = alphaIndex[entity];
- }
- return chr || s;
- });
- };
- Html4Entities.decode = function (str) {
- return new Html4Entities().decode(str);
- };
- Html4Entities.prototype.encode = function (str) {
- if (!str || !str.length) {
- return '';
+ const api = YoutubeIframeApi.getInstance();
+ this._player = await api.createPlaylistPlayer(-1, playlistKey);
+ try {
+ return await this.scrapeVideoNames();
}
- var strLength = str.length;
- var result = '';
- var i = 0;
- while (i < strLength) {
- var alpha = numIndex[str.charCodeAt(i)];
- result += alpha ? "&" + alpha + ";" : str.charAt(i);
- i++;
+ finally {
+ api.destroyPlayer(-1, playlistKey);
+ this._player = undefined;
}
- return result;
- };
- Html4Entities.encode = function (str) {
- return new Html4Entities().encode(str);
- };
- Html4Entities.prototype.encodeNonUTF = function (str) {
- if (!str || !str.length) {
- return '';
+ }
+ async createFoundryVTTPlaylist(playlistName, trackList, volume) {
+ if (!playlistName || Object.prototype.toString.call(playlistName) !== "[object String]") {
+ throw new Error("Enter playlist name");
}
- var strLength = str.length;
- var result = '';
- var i = 0;
- while (i < strLength) {
- var cc = str.charCodeAt(i);
- var alpha = numIndex[cc];
- if (alpha) {
- result += "&" + alpha + ";";
- }
- else if (cc < 32 || cc > 126) {
- if (cc >= surrogate_pairs_1.highSurrogateFrom && cc <= surrogate_pairs_1.highSurrogateTo) {
- result += '' + surrogate_pairs_1.getCodePoint(str, i) + ';';
- i++;
- }
- else {
- result += '' + cc + ';';
+ const playlist = await Playlist.create({
+ "name": playlistName,
+ "shuffle": false
+ });
+ const realVolume = AudioHelper.inputToVolume(volume);
+ const playlistSounds = [];
+ //videos: Arr of {id, title}
+ for (let i = 0; i < trackList.length; i++) {
+ playlistSounds.push({
+ name: trackList[i].title,
+ lvolume: volume,
+ volume: realVolume,
+ path: "streamed.mp3",
+ repeat: false,
+ flags: {
+ bIsStreamed: true,
+ streamingApi: StreamType.youtube,
+ streamingId: trackList[i].id
}
- }
- else {
- result += str.charAt(i);
- }
- i++;
+ });
}
- return result;
- };
- Html4Entities.encodeNonUTF = function (str) {
- return new Html4Entities().encodeNonUTF(str);
- };
- Html4Entities.prototype.encodeNonASCII = function (str) {
- if (!str || !str.length) {
- return '';
+ // @ts-ignore
+ await (playlist === null || playlist === void 0 ? void 0 : playlist.createEmbeddedDocuments("PlaylistSound", playlistSounds));
+ }
+ async scrapeVideoNames() {
+ var _a, _b, _c;
+ const scrapedTracks = [];
+ const playlist = (_a = this._player) === null || _a === void 0 ? void 0 : _a.getPlaylist(); // return array of ids
+ if (!playlist) {
+ throw new Error("Invalid Playlist");
}
- var strLength = str.length;
- var result = '';
- var i = 0;
- while (i < strLength) {
- var c = str.charCodeAt(i);
- if (c <= 255) {
- result += str[i++];
- continue;
- }
- if (c >= surrogate_pairs_1.highSurrogateFrom && c <= surrogate_pairs_1.highSurrogateTo) {
- result += '' + surrogate_pairs_1.getCodePoint(str, i) + ';';
- i++;
+ let title = "";
+ const callBackFunc = (e) => {
+ //@ts-ignore -- missing from yt types
+ const loadedTitle = e.target.getVideoData().title;
+ if (loadedTitle) {
+ title = loadedTitle;
}
- else {
- result += '' + c + ';';
+ };
+ (_b = this._player) === null || _b === void 0 ? void 0 : _b.addEventListener("onStateChange", callBackFunc);
+ const option = '2';
+ for (let i = 0; i < playlist.length; i++) {
+ console.log(`Scraping ${i}`);
+ const id = playlist[i];
+ (_c = this._player) === null || _c === void 0 ? void 0 : _c.playVideoAt(i);
+ let timeout = 0;
+ // Issue is, we cant remove the event listener, so we cant await, resolve, and add a new listener
+ // so we have a few options of how to handle this
+ // I chose option 2 since it is faster, but this could probably be improved
+ switch (option) {
+ // Option 1: We use the onStateChange event to get the title, but since we can't await, we have to use a timeout
+ // @ts-ignore
+ case '1':
+ await new Promise((resolve) => {
+ // Wait for the title to be loaded
+ setTimeout(() => {
+ resolve();
+ }, 1000);
+ }).then(() => {
+ if (title) {
+ scrapedTracks.push({
+ id,
+ title
+ });
+ console.log(`Scraped ${i}: ${title}`);
+ }
+ else {
+ console.log(`Scraped ${i}: Could not find title in 1 second, skipping`);
+ }
+ title = "";
+ }).catch((err) => {
+ console.log(err);
+ });
+ break;
+ case '2':
+ // Option 2: We just wait for the title to load, with a while loop
+ // And timeout if it takes too long, after 10 seconds
+ while (!title && timeout < 50) {
+ await new Promise((resolve) => {
+ setTimeout(() => {
+ resolve();
+ }, 100);
+ });
+ timeout++;
+ }
+ if (title) {
+ scrapedTracks.push({
+ id,
+ title
+ });
+ console.log(`Scraped ${i}: ${title}`);
+ }
+ else {
+ console.log(`Scraped ${i}: Could not find title in 5 seconds, skipping`);
+ }
+ title = "";
+ break;
}
- i++;
}
- return result;
- };
- Html4Entities.encodeNonASCII = function (str) {
- return new Html4Entities().encodeNonASCII(str);
- };
- return Html4Entities;
-}());
-exports.Html4Entities = Html4Entities;
-
-
-/***/ }),
+ return scrapedTracks;
+ }
+}
-/***/ "./node_modules/html-entities/lib/html5-entities.js":
-/*!**********************************************************!*\
- !*** ./node_modules/html-entities/lib/html5-entities.js ***!
- \**********************************************************/
-/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
+;// CONCATENATED MODULE: ./src/module/applications/YoutubePlaylistImportForm.ts
-"use strict";
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-var surrogate_pairs_1 = __webpack_require__(/*! ./surrogate-pairs */ "./node_modules/html-entities/lib/surrogate-pairs.js");
-var ENTITIES = [['Aacute', [193]], ['aacute', [225]], ['Abreve', [258]], ['abreve', [259]], ['ac', [8766]], ['acd', [8767]], ['acE', [8766, 819]], ['Acirc', [194]], ['acirc', [226]], ['acute', [180]], ['Acy', [1040]], ['acy', [1072]], ['AElig', [198]], ['aelig', [230]], ['af', [8289]], ['Afr', [120068]], ['afr', [120094]], ['Agrave', [192]], ['agrave', [224]], ['alefsym', [8501]], ['aleph', [8501]], ['Alpha', [913]], ['alpha', [945]], ['Amacr', [256]], ['amacr', [257]], ['amalg', [10815]], ['amp', [38]], ['AMP', [38]], ['andand', [10837]], ['And', [10835]], ['and', [8743]], ['andd', [10844]], ['andslope', [10840]], ['andv', [10842]], ['ang', [8736]], ['ange', [10660]], ['angle', [8736]], ['angmsdaa', [10664]], ['angmsdab', [10665]], ['angmsdac', [10666]], ['angmsdad', [10667]], ['angmsdae', [10668]], ['angmsdaf', [10669]], ['angmsdag', [10670]], ['angmsdah', [10671]], ['angmsd', [8737]], ['angrt', [8735]], ['angrtvb', [8894]], ['angrtvbd', [10653]], ['angsph', [8738]], ['angst', [197]], ['angzarr', [9084]], ['Aogon', [260]], ['aogon', [261]], ['Aopf', [120120]], ['aopf', [120146]], ['apacir', [10863]], ['ap', [8776]], ['apE', [10864]], ['ape', [8778]], ['apid', [8779]], ['apos', [39]], ['ApplyFunction', [8289]], ['approx', [8776]], ['approxeq', [8778]], ['Aring', [197]], ['aring', [229]], ['Ascr', [119964]], ['ascr', [119990]], ['Assign', [8788]], ['ast', [42]], ['asymp', [8776]], ['asympeq', [8781]], ['Atilde', [195]], ['atilde', [227]], ['Auml', [196]], ['auml', [228]], ['awconint', [8755]], ['awint', [10769]], ['backcong', [8780]], ['backepsilon', [1014]], ['backprime', [8245]], ['backsim', [8765]], ['backsimeq', [8909]], ['Backslash', [8726]], ['Barv', [10983]], ['barvee', [8893]], ['barwed', [8965]], ['Barwed', [8966]], ['barwedge', [8965]], ['bbrk', [9141]], ['bbrktbrk', [9142]], ['bcong', [8780]], ['Bcy', [1041]], ['bcy', [1073]], ['bdquo', [8222]], ['becaus', [8757]], ['because', [8757]], ['Because', [8757]], ['bemptyv', [10672]], ['bepsi', [1014]], ['bernou', [8492]], ['Bernoullis', [8492]], ['Beta', [914]], ['beta', [946]], ['beth', [8502]], ['between', [8812]], ['Bfr', [120069]], ['bfr', [120095]], ['bigcap', [8898]], ['bigcirc', [9711]], ['bigcup', [8899]], ['bigodot', [10752]], ['bigoplus', [10753]], ['bigotimes', [10754]], ['bigsqcup', [10758]], ['bigstar', [9733]], ['bigtriangledown', [9661]], ['bigtriangleup', [9651]], ['biguplus', [10756]], ['bigvee', [8897]], ['bigwedge', [8896]], ['bkarow', [10509]], ['blacklozenge', [10731]], ['blacksquare', [9642]], ['blacktriangle', [9652]], ['blacktriangledown', [9662]], ['blacktriangleleft', [9666]], ['blacktriangleright', [9656]], ['blank', [9251]], ['blk12', [9618]], ['blk14', [9617]], ['blk34', [9619]], ['block', [9608]], ['bne', [61, 8421]], ['bnequiv', [8801, 8421]], ['bNot', [10989]], ['bnot', [8976]], ['Bopf', [120121]], ['bopf', [120147]], ['bot', [8869]], ['bottom', [8869]], ['bowtie', [8904]], ['boxbox', [10697]], ['boxdl', [9488]], ['boxdL', [9557]], ['boxDl', [9558]], ['boxDL', [9559]], ['boxdr', [9484]], ['boxdR', [9554]], ['boxDr', [9555]], ['boxDR', [9556]], ['boxh', [9472]], ['boxH', [9552]], ['boxhd', [9516]], ['boxHd', [9572]], ['boxhD', [9573]], ['boxHD', [9574]], ['boxhu', [9524]], ['boxHu', [9575]], ['boxhU', [9576]], ['boxHU', [9577]], ['boxminus', [8863]], ['boxplus', [8862]], ['boxtimes', [8864]], ['boxul', [9496]], ['boxuL', [9563]], ['boxUl', [9564]], ['boxUL', [9565]], ['boxur', [9492]], ['boxuR', [9560]], ['boxUr', [9561]], ['boxUR', [9562]], ['boxv', [9474]], ['boxV', [9553]], ['boxvh', [9532]], ['boxvH', [9578]], ['boxVh', [9579]], ['boxVH', [9580]], ['boxvl', [9508]], ['boxvL', [9569]], ['boxVl', [9570]], ['boxVL', [9571]], ['boxvr', [9500]], ['boxvR', [9566]], ['boxVr', [9567]], ['boxVR', [9568]], ['bprime', [8245]], ['breve', [728]], ['Breve', [728]], ['brvbar', [166]], ['bscr', [119991]], ['Bscr', [8492]], ['bsemi', [8271]], ['bsim', [8765]], ['bsime', [8909]], ['bsolb', [10693]], ['bsol', [92]], ['bsolhsub', [10184]], ['bull', [8226]], ['bullet', [8226]], ['bump', [8782]], ['bumpE', [10926]], ['bumpe', [8783]], ['Bumpeq', [8782]], ['bumpeq', [8783]], ['Cacute', [262]], ['cacute', [263]], ['capand', [10820]], ['capbrcup', [10825]], ['capcap', [10827]], ['cap', [8745]], ['Cap', [8914]], ['capcup', [10823]], ['capdot', [10816]], ['CapitalDifferentialD', [8517]], ['caps', [8745, 65024]], ['caret', [8257]], ['caron', [711]], ['Cayleys', [8493]], ['ccaps', [10829]], ['Ccaron', [268]], ['ccaron', [269]], ['Ccedil', [199]], ['ccedil', [231]], ['Ccirc', [264]], ['ccirc', [265]], ['Cconint', [8752]], ['ccups', [10828]], ['ccupssm', [10832]], ['Cdot', [266]], ['cdot', [267]], ['cedil', [184]], ['Cedilla', [184]], ['cemptyv', [10674]], ['cent', [162]], ['centerdot', [183]], ['CenterDot', [183]], ['cfr', [120096]], ['Cfr', [8493]], ['CHcy', [1063]], ['chcy', [1095]], ['check', [10003]], ['checkmark', [10003]], ['Chi', [935]], ['chi', [967]], ['circ', [710]], ['circeq', [8791]], ['circlearrowleft', [8634]], ['circlearrowright', [8635]], ['circledast', [8859]], ['circledcirc', [8858]], ['circleddash', [8861]], ['CircleDot', [8857]], ['circledR', [174]], ['circledS', [9416]], ['CircleMinus', [8854]], ['CirclePlus', [8853]], ['CircleTimes', [8855]], ['cir', [9675]], ['cirE', [10691]], ['cire', [8791]], ['cirfnint', [10768]], ['cirmid', [10991]], ['cirscir', [10690]], ['ClockwiseContourIntegral', [8754]], ['clubs', [9827]], ['clubsuit', [9827]], ['colon', [58]], ['Colon', [8759]], ['Colone', [10868]], ['colone', [8788]], ['coloneq', [8788]], ['comma', [44]], ['commat', [64]], ['comp', [8705]], ['compfn', [8728]], ['complement', [8705]], ['complexes', [8450]], ['cong', [8773]], ['congdot', [10861]], ['Congruent', [8801]], ['conint', [8750]], ['Conint', [8751]], ['ContourIntegral', [8750]], ['copf', [120148]], ['Copf', [8450]], ['coprod', [8720]], ['Coproduct', [8720]], ['copy', [169]], ['COPY', [169]], ['copysr', [8471]], ['CounterClockwiseContourIntegral', [8755]], ['crarr', [8629]], ['cross', [10007]], ['Cross', [10799]], ['Cscr', [119966]], ['cscr', [119992]], ['csub', [10959]], ['csube', [10961]], ['csup', [10960]], ['csupe', [10962]], ['ctdot', [8943]], ['cudarrl', [10552]], ['cudarrr', [10549]], ['cuepr', [8926]], ['cuesc', [8927]], ['cularr', [8630]], ['cularrp', [10557]], ['cupbrcap', [10824]], ['cupcap', [10822]], ['CupCap', [8781]], ['cup', [8746]], ['Cup', [8915]], ['cupcup', [10826]], ['cupdot', [8845]], ['cupor', [10821]], ['cups', [8746, 65024]], ['curarr', [8631]], ['curarrm', [10556]], ['curlyeqprec', [8926]], ['curlyeqsucc', [8927]], ['curlyvee', [8910]], ['curlywedge', [8911]], ['curren', [164]], ['curvearrowleft', [8630]], ['curvearrowright', [8631]], ['cuvee', [8910]], ['cuwed', [8911]], ['cwconint', [8754]], ['cwint', [8753]], ['cylcty', [9005]], ['dagger', [8224]], ['Dagger', [8225]], ['daleth', [8504]], ['darr', [8595]], ['Darr', [8609]], ['dArr', [8659]], ['dash', [8208]], ['Dashv', [10980]], ['dashv', [8867]], ['dbkarow', [10511]], ['dblac', [733]], ['Dcaron', [270]], ['dcaron', [271]], ['Dcy', [1044]], ['dcy', [1076]], ['ddagger', [8225]], ['ddarr', [8650]], ['DD', [8517]], ['dd', [8518]], ['DDotrahd', [10513]], ['ddotseq', [10871]], ['deg', [176]], ['Del', [8711]], ['Delta', [916]], ['delta', [948]], ['demptyv', [10673]], ['dfisht', [10623]], ['Dfr', [120071]], ['dfr', [120097]], ['dHar', [10597]], ['dharl', [8643]], ['dharr', [8642]], ['DiacriticalAcute', [180]], ['DiacriticalDot', [729]], ['DiacriticalDoubleAcute', [733]], ['DiacriticalGrave', [96]], ['DiacriticalTilde', [732]], ['diam', [8900]], ['diamond', [8900]], ['Diamond', [8900]], ['diamondsuit', [9830]], ['diams', [9830]], ['die', [168]], ['DifferentialD', [8518]], ['digamma', [989]], ['disin', [8946]], ['div', [247]], ['divide', [247]], ['divideontimes', [8903]], ['divonx', [8903]], ['DJcy', [1026]], ['djcy', [1106]], ['dlcorn', [8990]], ['dlcrop', [8973]], ['dollar', [36]], ['Dopf', [120123]], ['dopf', [120149]], ['Dot', [168]], ['dot', [729]], ['DotDot', [8412]], ['doteq', [8784]], ['doteqdot', [8785]], ['DotEqual', [8784]], ['dotminus', [8760]], ['dotplus', [8724]], ['dotsquare', [8865]], ['doublebarwedge', [8966]], ['DoubleContourIntegral', [8751]], ['DoubleDot', [168]], ['DoubleDownArrow', [8659]], ['DoubleLeftArrow', [8656]], ['DoubleLeftRightArrow', [8660]], ['DoubleLeftTee', [10980]], ['DoubleLongLeftArrow', [10232]], ['DoubleLongLeftRightArrow', [10234]], ['DoubleLongRightArrow', [10233]], ['DoubleRightArrow', [8658]], ['DoubleRightTee', [8872]], ['DoubleUpArrow', [8657]], ['DoubleUpDownArrow', [8661]], ['DoubleVerticalBar', [8741]], ['DownArrowBar', [10515]], ['downarrow', [8595]], ['DownArrow', [8595]], ['Downarrow', [8659]], ['DownArrowUpArrow', [8693]], ['DownBreve', [785]], ['downdownarrows', [8650]], ['downharpoonleft', [8643]], ['downharpoonright', [8642]], ['DownLeftRightVector', [10576]], ['DownLeftTeeVector', [10590]], ['DownLeftVectorBar', [10582]], ['DownLeftVector', [8637]], ['DownRightTeeVector', [10591]], ['DownRightVectorBar', [10583]], ['DownRightVector', [8641]], ['DownTeeArrow', [8615]], ['DownTee', [8868]], ['drbkarow', [10512]], ['drcorn', [8991]], ['drcrop', [8972]], ['Dscr', [119967]], ['dscr', [119993]], ['DScy', [1029]], ['dscy', [1109]], ['dsol', [10742]], ['Dstrok', [272]], ['dstrok', [273]], ['dtdot', [8945]], ['dtri', [9663]], ['dtrif', [9662]], ['duarr', [8693]], ['duhar', [10607]], ['dwangle', [10662]], ['DZcy', [1039]], ['dzcy', [1119]], ['dzigrarr', [10239]], ['Eacute', [201]], ['eacute', [233]], ['easter', [10862]], ['Ecaron', [282]], ['ecaron', [283]], ['Ecirc', [202]], ['ecirc', [234]], ['ecir', [8790]], ['ecolon', [8789]], ['Ecy', [1069]], ['ecy', [1101]], ['eDDot', [10871]], ['Edot', [278]], ['edot', [279]], ['eDot', [8785]], ['ee', [8519]], ['efDot', [8786]], ['Efr', [120072]], ['efr', [120098]], ['eg', [10906]], ['Egrave', [200]], ['egrave', [232]], ['egs', [10902]], ['egsdot', [10904]], ['el', [10905]], ['Element', [8712]], ['elinters', [9191]], ['ell', [8467]], ['els', [10901]], ['elsdot', [10903]], ['Emacr', [274]], ['emacr', [275]], ['empty', [8709]], ['emptyset', [8709]], ['EmptySmallSquare', [9723]], ['emptyv', [8709]], ['EmptyVerySmallSquare', [9643]], ['emsp13', [8196]], ['emsp14', [8197]], ['emsp', [8195]], ['ENG', [330]], ['eng', [331]], ['ensp', [8194]], ['Eogon', [280]], ['eogon', [281]], ['Eopf', [120124]], ['eopf', [120150]], ['epar', [8917]], ['eparsl', [10723]], ['eplus', [10865]], ['epsi', [949]], ['Epsilon', [917]], ['epsilon', [949]], ['epsiv', [1013]], ['eqcirc', [8790]], ['eqcolon', [8789]], ['eqsim', [8770]], ['eqslantgtr', [10902]], ['eqslantless', [10901]], ['Equal', [10869]], ['equals', [61]], ['EqualTilde', [8770]], ['equest', [8799]], ['Equilibrium', [8652]], ['equiv', [8801]], ['equivDD', [10872]], ['eqvparsl', [10725]], ['erarr', [10609]], ['erDot', [8787]], ['escr', [8495]], ['Escr', [8496]], ['esdot', [8784]], ['Esim', [10867]], ['esim', [8770]], ['Eta', [919]], ['eta', [951]], ['ETH', [208]], ['eth', [240]], ['Euml', [203]], ['euml', [235]], ['euro', [8364]], ['excl', [33]], ['exist', [8707]], ['Exists', [8707]], ['expectation', [8496]], ['exponentiale', [8519]], ['ExponentialE', [8519]], ['fallingdotseq', [8786]], ['Fcy', [1060]], ['fcy', [1092]], ['female', [9792]], ['ffilig', [64259]], ['fflig', [64256]], ['ffllig', [64260]], ['Ffr', [120073]], ['ffr', [120099]], ['filig', [64257]], ['FilledSmallSquare', [9724]], ['FilledVerySmallSquare', [9642]], ['fjlig', [102, 106]], ['flat', [9837]], ['fllig', [64258]], ['fltns', [9649]], ['fnof', [402]], ['Fopf', [120125]], ['fopf', [120151]], ['forall', [8704]], ['ForAll', [8704]], ['fork', [8916]], ['forkv', [10969]], ['Fouriertrf', [8497]], ['fpartint', [10765]], ['frac12', [189]], ['frac13', [8531]], ['frac14', [188]], ['frac15', [8533]], ['frac16', [8537]], ['frac18', [8539]], ['frac23', [8532]], ['frac25', [8534]], ['frac34', [190]], ['frac35', [8535]], ['frac38', [8540]], ['frac45', [8536]], ['frac56', [8538]], ['frac58', [8541]], ['frac78', [8542]], ['frasl', [8260]], ['frown', [8994]], ['fscr', [119995]], ['Fscr', [8497]], ['gacute', [501]], ['Gamma', [915]], ['gamma', [947]], ['Gammad', [988]], ['gammad', [989]], ['gap', [10886]], ['Gbreve', [286]], ['gbreve', [287]], ['Gcedil', [290]], ['Gcirc', [284]], ['gcirc', [285]], ['Gcy', [1043]], ['gcy', [1075]], ['Gdot', [288]], ['gdot', [289]], ['ge', [8805]], ['gE', [8807]], ['gEl', [10892]], ['gel', [8923]], ['geq', [8805]], ['geqq', [8807]], ['geqslant', [10878]], ['gescc', [10921]], ['ges', [10878]], ['gesdot', [10880]], ['gesdoto', [10882]], ['gesdotol', [10884]], ['gesl', [8923, 65024]], ['gesles', [10900]], ['Gfr', [120074]], ['gfr', [120100]], ['gg', [8811]], ['Gg', [8921]], ['ggg', [8921]], ['gimel', [8503]], ['GJcy', [1027]], ['gjcy', [1107]], ['gla', [10917]], ['gl', [8823]], ['glE', [10898]], ['glj', [10916]], ['gnap', [10890]], ['gnapprox', [10890]], ['gne', [10888]], ['gnE', [8809]], ['gneq', [10888]], ['gneqq', [8809]], ['gnsim', [8935]], ['Gopf', [120126]], ['gopf', [120152]], ['grave', [96]], ['GreaterEqual', [8805]], ['GreaterEqualLess', [8923]], ['GreaterFullEqual', [8807]], ['GreaterGreater', [10914]], ['GreaterLess', [8823]], ['GreaterSlantEqual', [10878]], ['GreaterTilde', [8819]], ['Gscr', [119970]], ['gscr', [8458]], ['gsim', [8819]], ['gsime', [10894]], ['gsiml', [10896]], ['gtcc', [10919]], ['gtcir', [10874]], ['gt', [62]], ['GT', [62]], ['Gt', [8811]], ['gtdot', [8919]], ['gtlPar', [10645]], ['gtquest', [10876]], ['gtrapprox', [10886]], ['gtrarr', [10616]], ['gtrdot', [8919]], ['gtreqless', [8923]], ['gtreqqless', [10892]], ['gtrless', [8823]], ['gtrsim', [8819]], ['gvertneqq', [8809, 65024]], ['gvnE', [8809, 65024]], ['Hacek', [711]], ['hairsp', [8202]], ['half', [189]], ['hamilt', [8459]], ['HARDcy', [1066]], ['hardcy', [1098]], ['harrcir', [10568]], ['harr', [8596]], ['hArr', [8660]], ['harrw', [8621]], ['Hat', [94]], ['hbar', [8463]], ['Hcirc', [292]], ['hcirc', [293]], ['hearts', [9829]], ['heartsuit', [9829]], ['hellip', [8230]], ['hercon', [8889]], ['hfr', [120101]], ['Hfr', [8460]], ['HilbertSpace', [8459]], ['hksearow', [10533]], ['hkswarow', [10534]], ['hoarr', [8703]], ['homtht', [8763]], ['hookleftarrow', [8617]], ['hookrightarrow', [8618]], ['hopf', [120153]], ['Hopf', [8461]], ['horbar', [8213]], ['HorizontalLine', [9472]], ['hscr', [119997]], ['Hscr', [8459]], ['hslash', [8463]], ['Hstrok', [294]], ['hstrok', [295]], ['HumpDownHump', [8782]], ['HumpEqual', [8783]], ['hybull', [8259]], ['hyphen', [8208]], ['Iacute', [205]], ['iacute', [237]], ['ic', [8291]], ['Icirc', [206]], ['icirc', [238]], ['Icy', [1048]], ['icy', [1080]], ['Idot', [304]], ['IEcy', [1045]], ['iecy', [1077]], ['iexcl', [161]], ['iff', [8660]], ['ifr', [120102]], ['Ifr', [8465]], ['Igrave', [204]], ['igrave', [236]], ['ii', [8520]], ['iiiint', [10764]], ['iiint', [8749]], ['iinfin', [10716]], ['iiota', [8489]], ['IJlig', [306]], ['ijlig', [307]], ['Imacr', [298]], ['imacr', [299]], ['image', [8465]], ['ImaginaryI', [8520]], ['imagline', [8464]], ['imagpart', [8465]], ['imath', [305]], ['Im', [8465]], ['imof', [8887]], ['imped', [437]], ['Implies', [8658]], ['incare', [8453]], ['in', [8712]], ['infin', [8734]], ['infintie', [10717]], ['inodot', [305]], ['intcal', [8890]], ['int', [8747]], ['Int', [8748]], ['integers', [8484]], ['Integral', [8747]], ['intercal', [8890]], ['Intersection', [8898]], ['intlarhk', [10775]], ['intprod', [10812]], ['InvisibleComma', [8291]], ['InvisibleTimes', [8290]], ['IOcy', [1025]], ['iocy', [1105]], ['Iogon', [302]], ['iogon', [303]], ['Iopf', [120128]], ['iopf', [120154]], ['Iota', [921]], ['iota', [953]], ['iprod', [10812]], ['iquest', [191]], ['iscr', [119998]], ['Iscr', [8464]], ['isin', [8712]], ['isindot', [8949]], ['isinE', [8953]], ['isins', [8948]], ['isinsv', [8947]], ['isinv', [8712]], ['it', [8290]], ['Itilde', [296]], ['itilde', [297]], ['Iukcy', [1030]], ['iukcy', [1110]], ['Iuml', [207]], ['iuml', [239]], ['Jcirc', [308]], ['jcirc', [309]], ['Jcy', [1049]], ['jcy', [1081]], ['Jfr', [120077]], ['jfr', [120103]], ['jmath', [567]], ['Jopf', [120129]], ['jopf', [120155]], ['Jscr', [119973]], ['jscr', [119999]], ['Jsercy', [1032]], ['jsercy', [1112]], ['Jukcy', [1028]], ['jukcy', [1108]], ['Kappa', [922]], ['kappa', [954]], ['kappav', [1008]], ['Kcedil', [310]], ['kcedil', [311]], ['Kcy', [1050]], ['kcy', [1082]], ['Kfr', [120078]], ['kfr', [120104]], ['kgreen', [312]], ['KHcy', [1061]], ['khcy', [1093]], ['KJcy', [1036]], ['kjcy', [1116]], ['Kopf', [120130]], ['kopf', [120156]], ['Kscr', [119974]], ['kscr', [120000]], ['lAarr', [8666]], ['Lacute', [313]], ['lacute', [314]], ['laemptyv', [10676]], ['lagran', [8466]], ['Lambda', [923]], ['lambda', [955]], ['lang', [10216]], ['Lang', [10218]], ['langd', [10641]], ['langle', [10216]], ['lap', [10885]], ['Laplacetrf', [8466]], ['laquo', [171]], ['larrb', [8676]], ['larrbfs', [10527]], ['larr', [8592]], ['Larr', [8606]], ['lArr', [8656]], ['larrfs', [10525]], ['larrhk', [8617]], ['larrlp', [8619]], ['larrpl', [10553]], ['larrsim', [10611]], ['larrtl', [8610]], ['latail', [10521]], ['lAtail', [10523]], ['lat', [10923]], ['late', [10925]], ['lates', [10925, 65024]], ['lbarr', [10508]], ['lBarr', [10510]], ['lbbrk', [10098]], ['lbrace', [123]], ['lbrack', [91]], ['lbrke', [10635]], ['lbrksld', [10639]], ['lbrkslu', [10637]], ['Lcaron', [317]], ['lcaron', [318]], ['Lcedil', [315]], ['lcedil', [316]], ['lceil', [8968]], ['lcub', [123]], ['Lcy', [1051]], ['lcy', [1083]], ['ldca', [10550]], ['ldquo', [8220]], ['ldquor', [8222]], ['ldrdhar', [10599]], ['ldrushar', [10571]], ['ldsh', [8626]], ['le', [8804]], ['lE', [8806]], ['LeftAngleBracket', [10216]], ['LeftArrowBar', [8676]], ['leftarrow', [8592]], ['LeftArrow', [8592]], ['Leftarrow', [8656]], ['LeftArrowRightArrow', [8646]], ['leftarrowtail', [8610]], ['LeftCeiling', [8968]], ['LeftDoubleBracket', [10214]], ['LeftDownTeeVector', [10593]], ['LeftDownVectorBar', [10585]], ['LeftDownVector', [8643]], ['LeftFloor', [8970]], ['leftharpoondown', [8637]], ['leftharpoonup', [8636]], ['leftleftarrows', [8647]], ['leftrightarrow', [8596]], ['LeftRightArrow', [8596]], ['Leftrightarrow', [8660]], ['leftrightarrows', [8646]], ['leftrightharpoons', [8651]], ['leftrightsquigarrow', [8621]], ['LeftRightVector', [10574]], ['LeftTeeArrow', [8612]], ['LeftTee', [8867]], ['LeftTeeVector', [10586]], ['leftthreetimes', [8907]], ['LeftTriangleBar', [10703]], ['LeftTriangle', [8882]], ['LeftTriangleEqual', [8884]], ['LeftUpDownVector', [10577]], ['LeftUpTeeVector', [10592]], ['LeftUpVectorBar', [10584]], ['LeftUpVector', [8639]], ['LeftVectorBar', [10578]], ['LeftVector', [8636]], ['lEg', [10891]], ['leg', [8922]], ['leq', [8804]], ['leqq', [8806]], ['leqslant', [10877]], ['lescc', [10920]], ['les', [10877]], ['lesdot', [10879]], ['lesdoto', [10881]], ['lesdotor', [10883]], ['lesg', [8922, 65024]], ['lesges', [10899]], ['lessapprox', [10885]], ['lessdot', [8918]], ['lesseqgtr', [8922]], ['lesseqqgtr', [10891]], ['LessEqualGreater', [8922]], ['LessFullEqual', [8806]], ['LessGreater', [8822]], ['lessgtr', [8822]], ['LessLess', [10913]], ['lesssim', [8818]], ['LessSlantEqual', [10877]], ['LessTilde', [8818]], ['lfisht', [10620]], ['lfloor', [8970]], ['Lfr', [120079]], ['lfr', [120105]], ['lg', [8822]], ['lgE', [10897]], ['lHar', [10594]], ['lhard', [8637]], ['lharu', [8636]], ['lharul', [10602]], ['lhblk', [9604]], ['LJcy', [1033]], ['ljcy', [1113]], ['llarr', [8647]], ['ll', [8810]], ['Ll', [8920]], ['llcorner', [8990]], ['Lleftarrow', [8666]], ['llhard', [10603]], ['lltri', [9722]], ['Lmidot', [319]], ['lmidot', [320]], ['lmoustache', [9136]], ['lmoust', [9136]], ['lnap', [10889]], ['lnapprox', [10889]], ['lne', [10887]], ['lnE', [8808]], ['lneq', [10887]], ['lneqq', [8808]], ['lnsim', [8934]], ['loang', [10220]], ['loarr', [8701]], ['lobrk', [10214]], ['longleftarrow', [10229]], ['LongLeftArrow', [10229]], ['Longleftarrow', [10232]], ['longleftrightarrow', [10231]], ['LongLeftRightArrow', [10231]], ['Longleftrightarrow', [10234]], ['longmapsto', [10236]], ['longrightarrow', [10230]], ['LongRightArrow', [10230]], ['Longrightarrow', [10233]], ['looparrowleft', [8619]], ['looparrowright', [8620]], ['lopar', [10629]], ['Lopf', [120131]], ['lopf', [120157]], ['loplus', [10797]], ['lotimes', [10804]], ['lowast', [8727]], ['lowbar', [95]], ['LowerLeftArrow', [8601]], ['LowerRightArrow', [8600]], ['loz', [9674]], ['lozenge', [9674]], ['lozf', [10731]], ['lpar', [40]], ['lparlt', [10643]], ['lrarr', [8646]], ['lrcorner', [8991]], ['lrhar', [8651]], ['lrhard', [10605]], ['lrm', [8206]], ['lrtri', [8895]], ['lsaquo', [8249]], ['lscr', [120001]], ['Lscr', [8466]], ['lsh', [8624]], ['Lsh', [8624]], ['lsim', [8818]], ['lsime', [10893]], ['lsimg', [10895]], ['lsqb', [91]], ['lsquo', [8216]], ['lsquor', [8218]], ['Lstrok', [321]], ['lstrok', [322]], ['ltcc', [10918]], ['ltcir', [10873]], ['lt', [60]], ['LT', [60]], ['Lt', [8810]], ['ltdot', [8918]], ['lthree', [8907]], ['ltimes', [8905]], ['ltlarr', [10614]], ['ltquest', [10875]], ['ltri', [9667]], ['ltrie', [8884]], ['ltrif', [9666]], ['ltrPar', [10646]], ['lurdshar', [10570]], ['luruhar', [10598]], ['lvertneqq', [8808, 65024]], ['lvnE', [8808, 65024]], ['macr', [175]], ['male', [9794]], ['malt', [10016]], ['maltese', [10016]], ['Map', [10501]], ['map', [8614]], ['mapsto', [8614]], ['mapstodown', [8615]], ['mapstoleft', [8612]], ['mapstoup', [8613]], ['marker', [9646]], ['mcomma', [10793]], ['Mcy', [1052]], ['mcy', [1084]], ['mdash', [8212]], ['mDDot', [8762]], ['measuredangle', [8737]], ['MediumSpace', [8287]], ['Mellintrf', [8499]], ['Mfr', [120080]], ['mfr', [120106]], ['mho', [8487]], ['micro', [181]], ['midast', [42]], ['midcir', [10992]], ['mid', [8739]], ['middot', [183]], ['minusb', [8863]], ['minus', [8722]], ['minusd', [8760]], ['minusdu', [10794]], ['MinusPlus', [8723]], ['mlcp', [10971]], ['mldr', [8230]], ['mnplus', [8723]], ['models', [8871]], ['Mopf', [120132]], ['mopf', [120158]], ['mp', [8723]], ['mscr', [120002]], ['Mscr', [8499]], ['mstpos', [8766]], ['Mu', [924]], ['mu', [956]], ['multimap', [8888]], ['mumap', [8888]], ['nabla', [8711]], ['Nacute', [323]], ['nacute', [324]], ['nang', [8736, 8402]], ['nap', [8777]], ['napE', [10864, 824]], ['napid', [8779, 824]], ['napos', [329]], ['napprox', [8777]], ['natural', [9838]], ['naturals', [8469]], ['natur', [9838]], ['nbsp', [160]], ['nbump', [8782, 824]], ['nbumpe', [8783, 824]], ['ncap', [10819]], ['Ncaron', [327]], ['ncaron', [328]], ['Ncedil', [325]], ['ncedil', [326]], ['ncong', [8775]], ['ncongdot', [10861, 824]], ['ncup', [10818]], ['Ncy', [1053]], ['ncy', [1085]], ['ndash', [8211]], ['nearhk', [10532]], ['nearr', [8599]], ['neArr', [8663]], ['nearrow', [8599]], ['ne', [8800]], ['nedot', [8784, 824]], ['NegativeMediumSpace', [8203]], ['NegativeThickSpace', [8203]], ['NegativeThinSpace', [8203]], ['NegativeVeryThinSpace', [8203]], ['nequiv', [8802]], ['nesear', [10536]], ['nesim', [8770, 824]], ['NestedGreaterGreater', [8811]], ['NestedLessLess', [8810]], ['nexist', [8708]], ['nexists', [8708]], ['Nfr', [120081]], ['nfr', [120107]], ['ngE', [8807, 824]], ['nge', [8817]], ['ngeq', [8817]], ['ngeqq', [8807, 824]], ['ngeqslant', [10878, 824]], ['nges', [10878, 824]], ['nGg', [8921, 824]], ['ngsim', [8821]], ['nGt', [8811, 8402]], ['ngt', [8815]], ['ngtr', [8815]], ['nGtv', [8811, 824]], ['nharr', [8622]], ['nhArr', [8654]], ['nhpar', [10994]], ['ni', [8715]], ['nis', [8956]], ['nisd', [8954]], ['niv', [8715]], ['NJcy', [1034]], ['njcy', [1114]], ['nlarr', [8602]], ['nlArr', [8653]], ['nldr', [8229]], ['nlE', [8806, 824]], ['nle', [8816]], ['nleftarrow', [8602]], ['nLeftarrow', [8653]], ['nleftrightarrow', [8622]], ['nLeftrightarrow', [8654]], ['nleq', [8816]], ['nleqq', [8806, 824]], ['nleqslant', [10877, 824]], ['nles', [10877, 824]], ['nless', [8814]], ['nLl', [8920, 824]], ['nlsim', [8820]], ['nLt', [8810, 8402]], ['nlt', [8814]], ['nltri', [8938]], ['nltrie', [8940]], ['nLtv', [8810, 824]], ['nmid', [8740]], ['NoBreak', [8288]], ['NonBreakingSpace', [160]], ['nopf', [120159]], ['Nopf', [8469]], ['Not', [10988]], ['not', [172]], ['NotCongruent', [8802]], ['NotCupCap', [8813]], ['NotDoubleVerticalBar', [8742]], ['NotElement', [8713]], ['NotEqual', [8800]], ['NotEqualTilde', [8770, 824]], ['NotExists', [8708]], ['NotGreater', [8815]], ['NotGreaterEqual', [8817]], ['NotGreaterFullEqual', [8807, 824]], ['NotGreaterGreater', [8811, 824]], ['NotGreaterLess', [8825]], ['NotGreaterSlantEqual', [10878, 824]], ['NotGreaterTilde', [8821]], ['NotHumpDownHump', [8782, 824]], ['NotHumpEqual', [8783, 824]], ['notin', [8713]], ['notindot', [8949, 824]], ['notinE', [8953, 824]], ['notinva', [8713]], ['notinvb', [8951]], ['notinvc', [8950]], ['NotLeftTriangleBar', [10703, 824]], ['NotLeftTriangle', [8938]], ['NotLeftTriangleEqual', [8940]], ['NotLess', [8814]], ['NotLessEqual', [8816]], ['NotLessGreater', [8824]], ['NotLessLess', [8810, 824]], ['NotLessSlantEqual', [10877, 824]], ['NotLessTilde', [8820]], ['NotNestedGreaterGreater', [10914, 824]], ['NotNestedLessLess', [10913, 824]], ['notni', [8716]], ['notniva', [8716]], ['notnivb', [8958]], ['notnivc', [8957]], ['NotPrecedes', [8832]], ['NotPrecedesEqual', [10927, 824]], ['NotPrecedesSlantEqual', [8928]], ['NotReverseElement', [8716]], ['NotRightTriangleBar', [10704, 824]], ['NotRightTriangle', [8939]], ['NotRightTriangleEqual', [8941]], ['NotSquareSubset', [8847, 824]], ['NotSquareSubsetEqual', [8930]], ['NotSquareSuperset', [8848, 824]], ['NotSquareSupersetEqual', [8931]], ['NotSubset', [8834, 8402]], ['NotSubsetEqual', [8840]], ['NotSucceeds', [8833]], ['NotSucceedsEqual', [10928, 824]], ['NotSucceedsSlantEqual', [8929]], ['NotSucceedsTilde', [8831, 824]], ['NotSuperset', [8835, 8402]], ['NotSupersetEqual', [8841]], ['NotTilde', [8769]], ['NotTildeEqual', [8772]], ['NotTildeFullEqual', [8775]], ['NotTildeTilde', [8777]], ['NotVerticalBar', [8740]], ['nparallel', [8742]], ['npar', [8742]], ['nparsl', [11005, 8421]], ['npart', [8706, 824]], ['npolint', [10772]], ['npr', [8832]], ['nprcue', [8928]], ['nprec', [8832]], ['npreceq', [10927, 824]], ['npre', [10927, 824]], ['nrarrc', [10547, 824]], ['nrarr', [8603]], ['nrArr', [8655]], ['nrarrw', [8605, 824]], ['nrightarrow', [8603]], ['nRightarrow', [8655]], ['nrtri', [8939]], ['nrtrie', [8941]], ['nsc', [8833]], ['nsccue', [8929]], ['nsce', [10928, 824]], ['Nscr', [119977]], ['nscr', [120003]], ['nshortmid', [8740]], ['nshortparallel', [8742]], ['nsim', [8769]], ['nsime', [8772]], ['nsimeq', [8772]], ['nsmid', [8740]], ['nspar', [8742]], ['nsqsube', [8930]], ['nsqsupe', [8931]], ['nsub', [8836]], ['nsubE', [10949, 824]], ['nsube', [8840]], ['nsubset', [8834, 8402]], ['nsubseteq', [8840]], ['nsubseteqq', [10949, 824]], ['nsucc', [8833]], ['nsucceq', [10928, 824]], ['nsup', [8837]], ['nsupE', [10950, 824]], ['nsupe', [8841]], ['nsupset', [8835, 8402]], ['nsupseteq', [8841]], ['nsupseteqq', [10950, 824]], ['ntgl', [8825]], ['Ntilde', [209]], ['ntilde', [241]], ['ntlg', [8824]], ['ntriangleleft', [8938]], ['ntrianglelefteq', [8940]], ['ntriangleright', [8939]], ['ntrianglerighteq', [8941]], ['Nu', [925]], ['nu', [957]], ['num', [35]], ['numero', [8470]], ['numsp', [8199]], ['nvap', [8781, 8402]], ['nvdash', [8876]], ['nvDash', [8877]], ['nVdash', [8878]], ['nVDash', [8879]], ['nvge', [8805, 8402]], ['nvgt', [62, 8402]], ['nvHarr', [10500]], ['nvinfin', [10718]], ['nvlArr', [10498]], ['nvle', [8804, 8402]], ['nvlt', [60, 8402]], ['nvltrie', [8884, 8402]], ['nvrArr', [10499]], ['nvrtrie', [8885, 8402]], ['nvsim', [8764, 8402]], ['nwarhk', [10531]], ['nwarr', [8598]], ['nwArr', [8662]], ['nwarrow', [8598]], ['nwnear', [10535]], ['Oacute', [211]], ['oacute', [243]], ['oast', [8859]], ['Ocirc', [212]], ['ocirc', [244]], ['ocir', [8858]], ['Ocy', [1054]], ['ocy', [1086]], ['odash', [8861]], ['Odblac', [336]], ['odblac', [337]], ['odiv', [10808]], ['odot', [8857]], ['odsold', [10684]], ['OElig', [338]], ['oelig', [339]], ['ofcir', [10687]], ['Ofr', [120082]], ['ofr', [120108]], ['ogon', [731]], ['Ograve', [210]], ['ograve', [242]], ['ogt', [10689]], ['ohbar', [10677]], ['ohm', [937]], ['oint', [8750]], ['olarr', [8634]], ['olcir', [10686]], ['olcross', [10683]], ['oline', [8254]], ['olt', [10688]], ['Omacr', [332]], ['omacr', [333]], ['Omega', [937]], ['omega', [969]], ['Omicron', [927]], ['omicron', [959]], ['omid', [10678]], ['ominus', [8854]], ['Oopf', [120134]], ['oopf', [120160]], ['opar', [10679]], ['OpenCurlyDoubleQuote', [8220]], ['OpenCurlyQuote', [8216]], ['operp', [10681]], ['oplus', [8853]], ['orarr', [8635]], ['Or', [10836]], ['or', [8744]], ['ord', [10845]], ['order', [8500]], ['orderof', [8500]], ['ordf', [170]], ['ordm', [186]], ['origof', [8886]], ['oror', [10838]], ['orslope', [10839]], ['orv', [10843]], ['oS', [9416]], ['Oscr', [119978]], ['oscr', [8500]], ['Oslash', [216]], ['oslash', [248]], ['osol', [8856]], ['Otilde', [213]], ['otilde', [245]], ['otimesas', [10806]], ['Otimes', [10807]], ['otimes', [8855]], ['Ouml', [214]], ['ouml', [246]], ['ovbar', [9021]], ['OverBar', [8254]], ['OverBrace', [9182]], ['OverBracket', [9140]], ['OverParenthesis', [9180]], ['para', [182]], ['parallel', [8741]], ['par', [8741]], ['parsim', [10995]], ['parsl', [11005]], ['part', [8706]], ['PartialD', [8706]], ['Pcy', [1055]], ['pcy', [1087]], ['percnt', [37]], ['period', [46]], ['permil', [8240]], ['perp', [8869]], ['pertenk', [8241]], ['Pfr', [120083]], ['pfr', [120109]], ['Phi', [934]], ['phi', [966]], ['phiv', [981]], ['phmmat', [8499]], ['phone', [9742]], ['Pi', [928]], ['pi', [960]], ['pitchfork', [8916]], ['piv', [982]], ['planck', [8463]], ['planckh', [8462]], ['plankv', [8463]], ['plusacir', [10787]], ['plusb', [8862]], ['pluscir', [10786]], ['plus', [43]], ['plusdo', [8724]], ['plusdu', [10789]], ['pluse', [10866]], ['PlusMinus', [177]], ['plusmn', [177]], ['plussim', [10790]], ['plustwo', [10791]], ['pm', [177]], ['Poincareplane', [8460]], ['pointint', [10773]], ['popf', [120161]], ['Popf', [8473]], ['pound', [163]], ['prap', [10935]], ['Pr', [10939]], ['pr', [8826]], ['prcue', [8828]], ['precapprox', [10935]], ['prec', [8826]], ['preccurlyeq', [8828]], ['Precedes', [8826]], ['PrecedesEqual', [10927]], ['PrecedesSlantEqual', [8828]], ['PrecedesTilde', [8830]], ['preceq', [10927]], ['precnapprox', [10937]], ['precneqq', [10933]], ['precnsim', [8936]], ['pre', [10927]], ['prE', [10931]], ['precsim', [8830]], ['prime', [8242]], ['Prime', [8243]], ['primes', [8473]], ['prnap', [10937]], ['prnE', [10933]], ['prnsim', [8936]], ['prod', [8719]], ['Product', [8719]], ['profalar', [9006]], ['profline', [8978]], ['profsurf', [8979]], ['prop', [8733]], ['Proportional', [8733]], ['Proportion', [8759]], ['propto', [8733]], ['prsim', [8830]], ['prurel', [8880]], ['Pscr', [119979]], ['pscr', [120005]], ['Psi', [936]], ['psi', [968]], ['puncsp', [8200]], ['Qfr', [120084]], ['qfr', [120110]], ['qint', [10764]], ['qopf', [120162]], ['Qopf', [8474]], ['qprime', [8279]], ['Qscr', [119980]], ['qscr', [120006]], ['quaternions', [8461]], ['quatint', [10774]], ['quest', [63]], ['questeq', [8799]], ['quot', [34]], ['QUOT', [34]], ['rAarr', [8667]], ['race', [8765, 817]], ['Racute', [340]], ['racute', [341]], ['radic', [8730]], ['raemptyv', [10675]], ['rang', [10217]], ['Rang', [10219]], ['rangd', [10642]], ['range', [10661]], ['rangle', [10217]], ['raquo', [187]], ['rarrap', [10613]], ['rarrb', [8677]], ['rarrbfs', [10528]], ['rarrc', [10547]], ['rarr', [8594]], ['Rarr', [8608]], ['rArr', [8658]], ['rarrfs', [10526]], ['rarrhk', [8618]], ['rarrlp', [8620]], ['rarrpl', [10565]], ['rarrsim', [10612]], ['Rarrtl', [10518]], ['rarrtl', [8611]], ['rarrw', [8605]], ['ratail', [10522]], ['rAtail', [10524]], ['ratio', [8758]], ['rationals', [8474]], ['rbarr', [10509]], ['rBarr', [10511]], ['RBarr', [10512]], ['rbbrk', [10099]], ['rbrace', [125]], ['rbrack', [93]], ['rbrke', [10636]], ['rbrksld', [10638]], ['rbrkslu', [10640]], ['Rcaron', [344]], ['rcaron', [345]], ['Rcedil', [342]], ['rcedil', [343]], ['rceil', [8969]], ['rcub', [125]], ['Rcy', [1056]], ['rcy', [1088]], ['rdca', [10551]], ['rdldhar', [10601]], ['rdquo', [8221]], ['rdquor', [8221]], ['CloseCurlyDoubleQuote', [8221]], ['rdsh', [8627]], ['real', [8476]], ['realine', [8475]], ['realpart', [8476]], ['reals', [8477]], ['Re', [8476]], ['rect', [9645]], ['reg', [174]], ['REG', [174]], ['ReverseElement', [8715]], ['ReverseEquilibrium', [8651]], ['ReverseUpEquilibrium', [10607]], ['rfisht', [10621]], ['rfloor', [8971]], ['rfr', [120111]], ['Rfr', [8476]], ['rHar', [10596]], ['rhard', [8641]], ['rharu', [8640]], ['rharul', [10604]], ['Rho', [929]], ['rho', [961]], ['rhov', [1009]], ['RightAngleBracket', [10217]], ['RightArrowBar', [8677]], ['rightarrow', [8594]], ['RightArrow', [8594]], ['Rightarrow', [8658]], ['RightArrowLeftArrow', [8644]], ['rightarrowtail', [8611]], ['RightCeiling', [8969]], ['RightDoubleBracket', [10215]], ['RightDownTeeVector', [10589]], ['RightDownVectorBar', [10581]], ['RightDownVector', [8642]], ['RightFloor', [8971]], ['rightharpoondown', [8641]], ['rightharpoonup', [8640]], ['rightleftarrows', [8644]], ['rightleftharpoons', [8652]], ['rightrightarrows', [8649]], ['rightsquigarrow', [8605]], ['RightTeeArrow', [8614]], ['RightTee', [8866]], ['RightTeeVector', [10587]], ['rightthreetimes', [8908]], ['RightTriangleBar', [10704]], ['RightTriangle', [8883]], ['RightTriangleEqual', [8885]], ['RightUpDownVector', [10575]], ['RightUpTeeVector', [10588]], ['RightUpVectorBar', [10580]], ['RightUpVector', [8638]], ['RightVectorBar', [10579]], ['RightVector', [8640]], ['ring', [730]], ['risingdotseq', [8787]], ['rlarr', [8644]], ['rlhar', [8652]], ['rlm', [8207]], ['rmoustache', [9137]], ['rmoust', [9137]], ['rnmid', [10990]], ['roang', [10221]], ['roarr', [8702]], ['robrk', [10215]], ['ropar', [10630]], ['ropf', [120163]], ['Ropf', [8477]], ['roplus', [10798]], ['rotimes', [10805]], ['RoundImplies', [10608]], ['rpar', [41]], ['rpargt', [10644]], ['rppolint', [10770]], ['rrarr', [8649]], ['Rrightarrow', [8667]], ['rsaquo', [8250]], ['rscr', [120007]], ['Rscr', [8475]], ['rsh', [8625]], ['Rsh', [8625]], ['rsqb', [93]], ['rsquo', [8217]], ['rsquor', [8217]], ['CloseCurlyQuote', [8217]], ['rthree', [8908]], ['rtimes', [8906]], ['rtri', [9657]], ['rtrie', [8885]], ['rtrif', [9656]], ['rtriltri', [10702]], ['RuleDelayed', [10740]], ['ruluhar', [10600]], ['rx', [8478]], ['Sacute', [346]], ['sacute', [347]], ['sbquo', [8218]], ['scap', [10936]], ['Scaron', [352]], ['scaron', [353]], ['Sc', [10940]], ['sc', [8827]], ['sccue', [8829]], ['sce', [10928]], ['scE', [10932]], ['Scedil', [350]], ['scedil', [351]], ['Scirc', [348]], ['scirc', [349]], ['scnap', [10938]], ['scnE', [10934]], ['scnsim', [8937]], ['scpolint', [10771]], ['scsim', [8831]], ['Scy', [1057]], ['scy', [1089]], ['sdotb', [8865]], ['sdot', [8901]], ['sdote', [10854]], ['searhk', [10533]], ['searr', [8600]], ['seArr', [8664]], ['searrow', [8600]], ['sect', [167]], ['semi', [59]], ['seswar', [10537]], ['setminus', [8726]], ['setmn', [8726]], ['sext', [10038]], ['Sfr', [120086]], ['sfr', [120112]], ['sfrown', [8994]], ['sharp', [9839]], ['SHCHcy', [1065]], ['shchcy', [1097]], ['SHcy', [1064]], ['shcy', [1096]], ['ShortDownArrow', [8595]], ['ShortLeftArrow', [8592]], ['shortmid', [8739]], ['shortparallel', [8741]], ['ShortRightArrow', [8594]], ['ShortUpArrow', [8593]], ['shy', [173]], ['Sigma', [931]], ['sigma', [963]], ['sigmaf', [962]], ['sigmav', [962]], ['sim', [8764]], ['simdot', [10858]], ['sime', [8771]], ['simeq', [8771]], ['simg', [10910]], ['simgE', [10912]], ['siml', [10909]], ['simlE', [10911]], ['simne', [8774]], ['simplus', [10788]], ['simrarr', [10610]], ['slarr', [8592]], ['SmallCircle', [8728]], ['smallsetminus', [8726]], ['smashp', [10803]], ['smeparsl', [10724]], ['smid', [8739]], ['smile', [8995]], ['smt', [10922]], ['smte', [10924]], ['smtes', [10924, 65024]], ['SOFTcy', [1068]], ['softcy', [1100]], ['solbar', [9023]], ['solb', [10692]], ['sol', [47]], ['Sopf', [120138]], ['sopf', [120164]], ['spades', [9824]], ['spadesuit', [9824]], ['spar', [8741]], ['sqcap', [8851]], ['sqcaps', [8851, 65024]], ['sqcup', [8852]], ['sqcups', [8852, 65024]], ['Sqrt', [8730]], ['sqsub', [8847]], ['sqsube', [8849]], ['sqsubset', [8847]], ['sqsubseteq', [8849]], ['sqsup', [8848]], ['sqsupe', [8850]], ['sqsupset', [8848]], ['sqsupseteq', [8850]], ['square', [9633]], ['Square', [9633]], ['SquareIntersection', [8851]], ['SquareSubset', [8847]], ['SquareSubsetEqual', [8849]], ['SquareSuperset', [8848]], ['SquareSupersetEqual', [8850]], ['SquareUnion', [8852]], ['squarf', [9642]], ['squ', [9633]], ['squf', [9642]], ['srarr', [8594]], ['Sscr', [119982]], ['sscr', [120008]], ['ssetmn', [8726]], ['ssmile', [8995]], ['sstarf', [8902]], ['Star', [8902]], ['star', [9734]], ['starf', [9733]], ['straightepsilon', [1013]], ['straightphi', [981]], ['strns', [175]], ['sub', [8834]], ['Sub', [8912]], ['subdot', [10941]], ['subE', [10949]], ['sube', [8838]], ['subedot', [10947]], ['submult', [10945]], ['subnE', [10955]], ['subne', [8842]], ['subplus', [10943]], ['subrarr', [10617]], ['subset', [8834]], ['Subset', [8912]], ['subseteq', [8838]], ['subseteqq', [10949]], ['SubsetEqual', [8838]], ['subsetneq', [8842]], ['subsetneqq', [10955]], ['subsim', [10951]], ['subsub', [10965]], ['subsup', [10963]], ['succapprox', [10936]], ['succ', [8827]], ['succcurlyeq', [8829]], ['Succeeds', [8827]], ['SucceedsEqual', [10928]], ['SucceedsSlantEqual', [8829]], ['SucceedsTilde', [8831]], ['succeq', [10928]], ['succnapprox', [10938]], ['succneqq', [10934]], ['succnsim', [8937]], ['succsim', [8831]], ['SuchThat', [8715]], ['sum', [8721]], ['Sum', [8721]], ['sung', [9834]], ['sup1', [185]], ['sup2', [178]], ['sup3', [179]], ['sup', [8835]], ['Sup', [8913]], ['supdot', [10942]], ['supdsub', [10968]], ['supE', [10950]], ['supe', [8839]], ['supedot', [10948]], ['Superset', [8835]], ['SupersetEqual', [8839]], ['suphsol', [10185]], ['suphsub', [10967]], ['suplarr', [10619]], ['supmult', [10946]], ['supnE', [10956]], ['supne', [8843]], ['supplus', [10944]], ['supset', [8835]], ['Supset', [8913]], ['supseteq', [8839]], ['supseteqq', [10950]], ['supsetneq', [8843]], ['supsetneqq', [10956]], ['supsim', [10952]], ['supsub', [10964]], ['supsup', [10966]], ['swarhk', [10534]], ['swarr', [8601]], ['swArr', [8665]], ['swarrow', [8601]], ['swnwar', [10538]], ['szlig', [223]], ['Tab', [9]], ['target', [8982]], ['Tau', [932]], ['tau', [964]], ['tbrk', [9140]], ['Tcaron', [356]], ['tcaron', [357]], ['Tcedil', [354]], ['tcedil', [355]], ['Tcy', [1058]], ['tcy', [1090]], ['tdot', [8411]], ['telrec', [8981]], ['Tfr', [120087]], ['tfr', [120113]], ['there4', [8756]], ['therefore', [8756]], ['Therefore', [8756]], ['Theta', [920]], ['theta', [952]], ['thetasym', [977]], ['thetav', [977]], ['thickapprox', [8776]], ['thicksim', [8764]], ['ThickSpace', [8287, 8202]], ['ThinSpace', [8201]], ['thinsp', [8201]], ['thkap', [8776]], ['thksim', [8764]], ['THORN', [222]], ['thorn', [254]], ['tilde', [732]], ['Tilde', [8764]], ['TildeEqual', [8771]], ['TildeFullEqual', [8773]], ['TildeTilde', [8776]], ['timesbar', [10801]], ['timesb', [8864]], ['times', [215]], ['timesd', [10800]], ['tint', [8749]], ['toea', [10536]], ['topbot', [9014]], ['topcir', [10993]], ['top', [8868]], ['Topf', [120139]], ['topf', [120165]], ['topfork', [10970]], ['tosa', [10537]], ['tprime', [8244]], ['trade', [8482]], ['TRADE', [8482]], ['triangle', [9653]], ['triangledown', [9663]], ['triangleleft', [9667]], ['trianglelefteq', [8884]], ['triangleq', [8796]], ['triangleright', [9657]], ['trianglerighteq', [8885]], ['tridot', [9708]], ['trie', [8796]], ['triminus', [10810]], ['TripleDot', [8411]], ['triplus', [10809]], ['trisb', [10701]], ['tritime', [10811]], ['trpezium', [9186]], ['Tscr', [119983]], ['tscr', [120009]], ['TScy', [1062]], ['tscy', [1094]], ['TSHcy', [1035]], ['tshcy', [1115]], ['Tstrok', [358]], ['tstrok', [359]], ['twixt', [8812]], ['twoheadleftarrow', [8606]], ['twoheadrightarrow', [8608]], ['Uacute', [218]], ['uacute', [250]], ['uarr', [8593]], ['Uarr', [8607]], ['uArr', [8657]], ['Uarrocir', [10569]], ['Ubrcy', [1038]], ['ubrcy', [1118]], ['Ubreve', [364]], ['ubreve', [365]], ['Ucirc', [219]], ['ucirc', [251]], ['Ucy', [1059]], ['ucy', [1091]], ['udarr', [8645]], ['Udblac', [368]], ['udblac', [369]], ['udhar', [10606]], ['ufisht', [10622]], ['Ufr', [120088]], ['ufr', [120114]], ['Ugrave', [217]], ['ugrave', [249]], ['uHar', [10595]], ['uharl', [8639]], ['uharr', [8638]], ['uhblk', [9600]], ['ulcorn', [8988]], ['ulcorner', [8988]], ['ulcrop', [8975]], ['ultri', [9720]], ['Umacr', [362]], ['umacr', [363]], ['uml', [168]], ['UnderBar', [95]], ['UnderBrace', [9183]], ['UnderBracket', [9141]], ['UnderParenthesis', [9181]], ['Union', [8899]], ['UnionPlus', [8846]], ['Uogon', [370]], ['uogon', [371]], ['Uopf', [120140]], ['uopf', [120166]], ['UpArrowBar', [10514]], ['uparrow', [8593]], ['UpArrow', [8593]], ['Uparrow', [8657]], ['UpArrowDownArrow', [8645]], ['updownarrow', [8597]], ['UpDownArrow', [8597]], ['Updownarrow', [8661]], ['UpEquilibrium', [10606]], ['upharpoonleft', [8639]], ['upharpoonright', [8638]], ['uplus', [8846]], ['UpperLeftArrow', [8598]], ['UpperRightArrow', [8599]], ['upsi', [965]], ['Upsi', [978]], ['upsih', [978]], ['Upsilon', [933]], ['upsilon', [965]], ['UpTeeArrow', [8613]], ['UpTee', [8869]], ['upuparrows', [8648]], ['urcorn', [8989]], ['urcorner', [8989]], ['urcrop', [8974]], ['Uring', [366]], ['uring', [367]], ['urtri', [9721]], ['Uscr', [119984]], ['uscr', [120010]], ['utdot', [8944]], ['Utilde', [360]], ['utilde', [361]], ['utri', [9653]], ['utrif', [9652]], ['uuarr', [8648]], ['Uuml', [220]], ['uuml', [252]], ['uwangle', [10663]], ['vangrt', [10652]], ['varepsilon', [1013]], ['varkappa', [1008]], ['varnothing', [8709]], ['varphi', [981]], ['varpi', [982]], ['varpropto', [8733]], ['varr', [8597]], ['vArr', [8661]], ['varrho', [1009]], ['varsigma', [962]], ['varsubsetneq', [8842, 65024]], ['varsubsetneqq', [10955, 65024]], ['varsupsetneq', [8843, 65024]], ['varsupsetneqq', [10956, 65024]], ['vartheta', [977]], ['vartriangleleft', [8882]], ['vartriangleright', [8883]], ['vBar', [10984]], ['Vbar', [10987]], ['vBarv', [10985]], ['Vcy', [1042]], ['vcy', [1074]], ['vdash', [8866]], ['vDash', [8872]], ['Vdash', [8873]], ['VDash', [8875]], ['Vdashl', [10982]], ['veebar', [8891]], ['vee', [8744]], ['Vee', [8897]], ['veeeq', [8794]], ['vellip', [8942]], ['verbar', [124]], ['Verbar', [8214]], ['vert', [124]], ['Vert', [8214]], ['VerticalBar', [8739]], ['VerticalLine', [124]], ['VerticalSeparator', [10072]], ['VerticalTilde', [8768]], ['VeryThinSpace', [8202]], ['Vfr', [120089]], ['vfr', [120115]], ['vltri', [8882]], ['vnsub', [8834, 8402]], ['vnsup', [8835, 8402]], ['Vopf', [120141]], ['vopf', [120167]], ['vprop', [8733]], ['vrtri', [8883]], ['Vscr', [119985]], ['vscr', [120011]], ['vsubnE', [10955, 65024]], ['vsubne', [8842, 65024]], ['vsupnE', [10956, 65024]], ['vsupne', [8843, 65024]], ['Vvdash', [8874]], ['vzigzag', [10650]], ['Wcirc', [372]], ['wcirc', [373]], ['wedbar', [10847]], ['wedge', [8743]], ['Wedge', [8896]], ['wedgeq', [8793]], ['weierp', [8472]], ['Wfr', [120090]], ['wfr', [120116]], ['Wopf', [120142]], ['wopf', [120168]], ['wp', [8472]], ['wr', [8768]], ['wreath', [8768]], ['Wscr', [119986]], ['wscr', [120012]], ['xcap', [8898]], ['xcirc', [9711]], ['xcup', [8899]], ['xdtri', [9661]], ['Xfr', [120091]], ['xfr', [120117]], ['xharr', [10231]], ['xhArr', [10234]], ['Xi', [926]], ['xi', [958]], ['xlarr', [10229]], ['xlArr', [10232]], ['xmap', [10236]], ['xnis', [8955]], ['xodot', [10752]], ['Xopf', [120143]], ['xopf', [120169]], ['xoplus', [10753]], ['xotime', [10754]], ['xrarr', [10230]], ['xrArr', [10233]], ['Xscr', [119987]], ['xscr', [120013]], ['xsqcup', [10758]], ['xuplus', [10756]], ['xutri', [9651]], ['xvee', [8897]], ['xwedge', [8896]], ['Yacute', [221]], ['yacute', [253]], ['YAcy', [1071]], ['yacy', [1103]], ['Ycirc', [374]], ['ycirc', [375]], ['Ycy', [1067]], ['ycy', [1099]], ['yen', [165]], ['Yfr', [120092]], ['yfr', [120118]], ['YIcy', [1031]], ['yicy', [1111]], ['Yopf', [120144]], ['yopf', [120170]], ['Yscr', [119988]], ['yscr', [120014]], ['YUcy', [1070]], ['yucy', [1102]], ['yuml', [255]], ['Yuml', [376]], ['Zacute', [377]], ['zacute', [378]], ['Zcaron', [381]], ['zcaron', [382]], ['Zcy', [1047]], ['zcy', [1079]], ['Zdot', [379]], ['zdot', [380]], ['zeetrf', [8488]], ['ZeroWidthSpace', [8203]], ['Zeta', [918]], ['zeta', [950]], ['zfr', [120119]], ['Zfr', [8488]], ['ZHcy', [1046]], ['zhcy', [1078]], ['zigrarr', [8669]], ['zopf', [120171]], ['Zopf', [8484]], ['Zscr', [119989]], ['zscr', [120015]], ['zwj', [8205]], ['zwnj', [8204]]];
-var DECODE_ONLY_ENTITIES = [['NewLine', [10]]];
-var alphaIndex = {};
-var charIndex = {};
-createIndexes(alphaIndex, charIndex);
-var Html5Entities = /** @class */ (function () {
- function Html5Entities() {
+class YoutubePlaylistImportForm extends FormApplication {
+ constructor(object, options) {
+ options.height = "auto";
+ super(object, options);
+ this.isWorking = false;
+ this._playlistItems = [];
+ this._playlistTitle = "";
+ this._youtubePlaylistImportService = new YouTubePlaylistImportService();
}
- Html5Entities.prototype.decode = function (str) {
- if (!str || !str.length) {
- return '';
- }
- return str.replace(/&(#?[\w\d]+);?/g, function (s, entity) {
- var chr;
- if (entity.charAt(0) === "#") {
- var code = entity.charAt(1) === 'x' ?
- parseInt(entity.substr(2).toLowerCase(), 16) :
- parseInt(entity.substr(1));
- if (!isNaN(code) || code >= -32768) {
- if (code <= 65535) {
- chr = String.fromCharCode(code);
- }
- else {
- chr = surrogate_pairs_1.fromCodePoint(code);
- }
- }
- }
- else {
- chr = alphaIndex[entity];
- }
- return chr || s;
+ static get defaultOptions() {
+ return mergeObject(super.defaultOptions, {
+ title: game.i18n.localize("Bellows.ImportPlaylist.Title"),
+ template: "/modules/bellows2/templates/apps/import-youtube-playlist.hbs"
});
- };
- Html5Entities.decode = function (str) {
- return new Html5Entities().decode(str);
- };
- Html5Entities.prototype.encode = function (str) {
- if (!str || !str.length) {
- return '';
- }
- var strLength = str.length;
- var result = '';
- var i = 0;
- while (i < strLength) {
- var charInfo = charIndex[str.charCodeAt(i)];
- if (charInfo) {
- var alpha = charInfo[str.charCodeAt(i + 1)];
- if (alpha) {
- i++;
- }
- else {
- alpha = charInfo[''];
- }
- if (alpha) {
- result += "&" + alpha + ";";
- i++;
- continue;
- }
- }
- result += str.charAt(i);
- i++;
- }
- return result;
- };
- Html5Entities.encode = function (str) {
- return new Html5Entities().encode(str);
- };
- Html5Entities.prototype.encodeNonUTF = function (str) {
- if (!str || !str.length) {
- return '';
- }
- var strLength = str.length;
- var result = '';
- var i = 0;
- while (i < strLength) {
- var c = str.charCodeAt(i);
- var charInfo = charIndex[c];
- if (charInfo) {
- var alpha = charInfo[str.charCodeAt(i + 1)];
- if (alpha) {
- i++;
- }
- else {
- alpha = charInfo[''];
- }
- if (alpha) {
- result += "&" + alpha + ";";
- i++;
- continue;
- }
- }
- if (c < 32 || c > 126) {
- if (c >= surrogate_pairs_1.highSurrogateFrom && c <= surrogate_pairs_1.highSurrogateTo) {
- result += '' + surrogate_pairs_1.getCodePoint(str, i) + ';';
- i++;
- }
- else {
- result += '' + c + ';';
- }
- }
- else {
- result += str.charAt(i);
- }
- i++;
+ }
+ activateListeners(html) {
+ super.activateListeners(html);
+ html.find("button[id='bellows-yt-import-btn-import']").on("click", (e) => this._onImport.call(this, e));
+ }
+ getData() {
+ return {
+ working: this.isWorking,
+ playlistTitle: this._playlistTitle,
+ playlistItems: this._playlistItems
+ };
+ }
+ async importPlaylist(playlistStr) {
+ var _a, _b, _c;
+ const key = this._youtubePlaylistImportService.extractPlaylistKey(playlistStr);
+ if (!key) {
+ (_a = ui.notifications) === null || _a === void 0 ? void 0 : _a.error(game.i18n.localize("Bellows.ImportPlaylist.Messages.InvalidKey"));
+ return;
}
- return result;
- };
- Html5Entities.encodeNonUTF = function (str) {
- return new Html5Entities().encodeNonUTF(str);
- };
- Html5Entities.prototype.encodeNonASCII = function (str) {
- if (!str || !str.length) {
- return '';
+ try {
+ this._playlistItems = await this._youtubePlaylistImportService.getPlaylistInfo(key);
+ this._playlistTitle = this._playlistItems[0].title;
}
- var strLength = str.length;
- var result = '';
- var i = 0;
- while (i < strLength) {
- var c = str.charCodeAt(i);
- if (c <= 255) {
- result += str[i++];
- continue;
- }
- if (c >= surrogate_pairs_1.highSurrogateFrom && c <= surrogate_pairs_1.highSurrogateTo) {
- result += '' + surrogate_pairs_1.getCodePoint(str, i) + ';';
- i += 2;
+ catch (ex) {
+ if (ex == "Invalid Playlist") {
+ (_b = ui.notifications) === null || _b === void 0 ? void 0 : _b.error(game.i18n.format("Bellows.ImportPlaylist.Messages.KeyNotFound", { playlistKey: key }));
}
else {
- result += '' + c + ';';
- i++;
+ (_c = ui.notifications) === null || _c === void 0 ? void 0 : _c.error(game.i18n.localize("Bellows.ImportPlaylist.Messages.Error"));
+ Utils.LogError(ex);
}
}
- return result;
- };
- Html5Entities.encodeNonASCII = function (str) {
- return new Html5Entities().encodeNonASCII(str);
- };
- return Html5Entities;
-}());
-exports.Html5Entities = Html5Entities;
-function createIndexes(alphaIndex, charIndex) {
- var i = ENTITIES.length;
- while (i--) {
- var _a = ENTITIES[i], alpha = _a[0], _b = _a[1], chr = _b[0], chr2 = _b[1];
- var addChar = (chr < 32 || chr > 126) || chr === 62 || chr === 60 || chr === 38 || chr === 34 || chr === 39;
- var charInfo = void 0;
- if (addChar) {
- charInfo = charIndex[chr] = charIndex[chr] || {};
- }
- if (chr2) {
- alphaIndex[alpha] = String.fromCharCode(chr) + String.fromCharCode(chr2);
- addChar && (charInfo[chr2] = alpha);
- }
- else {
- alphaIndex[alpha] = String.fromCharCode(chr);
- addChar && (charInfo[''] = alpha);
- }
- }
- i = DECODE_ONLY_ENTITIES.length;
- while (i--) {
- var _c = DECODE_ONLY_ENTITIES[i], alpha = _c[0], _d = _c[1], chr = _d[0], chr2 = _d[1];
- alphaIndex[alpha] = String.fromCharCode(chr) + (chr2 ? String.fromCharCode(chr2) : '');
+ }
+ async _onImport(e) {
+ var _a;
+ if (this.isWorking) {
+ (_a = ui.notifications) === null || _a === void 0 ? void 0 : _a.error(game.i18n.localize("Bellows.ImportPlaylist.Messages.AlreadyWorking"));
+ return;
+ }
+ this.isWorking = true;
+ this._playlistItems = [];
+ const button = $(e.currentTarget);
+ const playlistUri = button.siblings("input[id='bellows-yt-import-url-text").val();
+ await this.rerender();
+ await this.importPlaylist(playlistUri);
+ this.isWorking = false;
+ await this.rerender();
+ }
+ async rerender() {
+ await this._render(false);
+ this.setPosition();
+ }
+ async _updateObject(_e, formData) {
+ var _a, _b;
+ try {
+ await this._youtubePlaylistImportService.createFoundryVTTPlaylist(formData.playlistname, this._playlistItems, formData.playlistvolume);
+ (_a = ui.notifications) === null || _a === void 0 ? void 0 : _a.info(game.i18n.format("Bellows.ImportPlaylist.Messages.ImportComplete", { playlistName: formData.playlistname }));
+ }
+ catch (ex) {
+ Utils.LogError(ex);
+ (_b = ui.notifications) === null || _b === void 0 ? void 0 : _b.error(game.i18n.localize("Bellows.ImportPlaylist.Messages.Error"));
+ }
}
}
+;// CONCATENATED MODULE: ./src/module/features/YoutubeFeature.ts
-/***/ }),
-
-/***/ "./node_modules/html-entities/lib/index.js":
-/*!*************************************************!*\
- !*** ./node_modules/html-entities/lib/index.js ***!
- \*************************************************/
-/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
-
-"use strict";
-
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-var xml_entities_1 = __webpack_require__(/*! ./xml-entities */ "./node_modules/html-entities/lib/xml-entities.js");
-exports.XmlEntities = xml_entities_1.XmlEntities;
-var html4_entities_1 = __webpack_require__(/*! ./html4-entities */ "./node_modules/html-entities/lib/html4-entities.js");
-exports.Html4Entities = html4_entities_1.Html4Entities;
-var html5_entities_1 = __webpack_require__(/*! ./html5-entities */ "./node_modules/html-entities/lib/html5-entities.js");
-exports.Html5Entities = html5_entities_1.Html5Entities;
-exports.AllHtmlEntities = html5_entities_1.Html5Entities;
-/***/ }),
-
-/***/ "./node_modules/html-entities/lib/surrogate-pairs.js":
-/*!***********************************************************!*\
- !*** ./node_modules/html-entities/lib/surrogate-pairs.js ***!
- \***********************************************************/
-/***/ ((__unused_webpack_module, exports) => {
-
-"use strict";
-
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-exports.fromCodePoint = String.fromCodePoint || function (astralCodePoint) {
- return String.fromCharCode(Math.floor((astralCodePoint - 0x10000) / 0x400) + 0xD800, (astralCodePoint - 0x10000) % 0x400 + 0xDC00);
-};
-exports.getCodePoint = String.prototype.codePointAt ?
- function (input, position) {
- return input.codePointAt(position);
- } :
- function (input, position) {
- return (input.charCodeAt(position) - 0xD800) * 0x400
- + input.charCodeAt(position + 1) - 0xDC00 + 0x10000;
- };
-exports.highSurrogateFrom = 0xD800;
-exports.highSurrogateTo = 0xDBFF;
-
-
-/***/ }),
-
-/***/ "./node_modules/html-entities/lib/xml-entities.js":
-/*!********************************************************!*\
- !*** ./node_modules/html-entities/lib/xml-entities.js ***!
- \********************************************************/
-/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
-
-"use strict";
-
-Object.defineProperty(exports, "__esModule", ({ value: true }));
-var surrogate_pairs_1 = __webpack_require__(/*! ./surrogate-pairs */ "./node_modules/html-entities/lib/surrogate-pairs.js");
-var ALPHA_INDEX = {
- '<': '<',
- '>': '>',
- '"': '"',
- '&apos': '\'',
- '&': '&',
- '<': '<',
- '>': '>',
- '"': '"',
- ''': '\'',
- '&': '&'
-};
-var CHAR_INDEX = {
- 60: 'lt',
- 62: 'gt',
- 34: 'quot',
- 39: 'apos',
- 38: 'amp'
-};
-var CHAR_S_INDEX = {
- '<': '<',
- '>': '>',
- '"': '"',
- '\'': ''',
- '&': '&'
-};
-var XmlEntities = /** @class */ (function () {
- function XmlEntities() {
- }
- XmlEntities.prototype.encode = function (str) {
- if (!str || !str.length) {
- return '';
- }
- return str.replace(/[<>"'&]/g, function (s) {
- return CHAR_S_INDEX[s];
+class YoutubeApiFeature {
+ static hooks() {
+ Hooks.once("init", async () => {
+ Utils.LogDebug("Initializing YoutubeApi Feature");
+ await YoutubeIframeApi.initializeApi();
});
- };
- XmlEntities.encode = function (str) {
- return new XmlEntities().encode(str);
- };
- XmlEntities.prototype.decode = function (str) {
- if (!str || !str.length) {
- return '';
- }
- return str.replace(/?[0-9a-zA-Z]+;?/g, function (s) {
- if (s.charAt(1) === '#') {
- var code = s.charAt(2).toLowerCase() === 'x' ?
- parseInt(s.substr(3), 16) :
- parseInt(s.substr(2));
- if (!isNaN(code) || code >= -32768) {
- if (code <= 65535) {
- return String.fromCharCode(code);
- }
- else {
- return surrogate_pairs_1.fromCodePoint(code);
- }
- }
- return '';
+ Hooks.on("renderPlaylistDirectory", (_app, html) => {
+ var _a;
+ if (!((_a = game.user) === null || _a === void 0 ? void 0 : _a.isGM)) {
+ return;
}
- return ALPHA_INDEX[s] || s;
+ const importButton = $(`
+ `);
+ html.find(".directory-footer").append(importButton);
+ importButton.on("click", () => {
+ new YoutubePlaylistImportForm({}, {}).render(true);
+ });
});
- };
- XmlEntities.decode = function (str) {
- return new XmlEntities().decode(str);
- };
- XmlEntities.prototype.encodeNonUTF = function (str) {
- if (!str || !str.length) {
- return '';
- }
- var strLength = str.length;
- var result = '';
- var i = 0;
- while (i < strLength) {
- var c = str.charCodeAt(i);
- var alpha = CHAR_INDEX[c];
- if (alpha) {
- result += "&" + alpha + ";";
- i++;
- continue;
- }
- if (c < 32 || c > 126) {
- if (c >= surrogate_pairs_1.highSurrogateFrom && c <= surrogate_pairs_1.highSurrogateTo) {
- result += '' + surrogate_pairs_1.getCodePoint(str, i) + ';';
- i++;
- }
- else {
- result += '' + c + ';';
- }
- }
- else {
- result += str.charAt(i);
- }
- i++;
+ }
+}
+
+;// CONCATENATED MODULE: ./src/module/helper/TemplatePreloader.ts
+class TemplatePreloader {
+ /**
+ * Preload a set of templates to compile and cache them for fast access during rendering
+ */
+ static async preloadHandlebarsTemplates() {
+ const templatePaths = [];
+ return loadTemplates(templatePaths);
+ }
+}
+
+;// CONCATENATED MODULE: ./src/module/helper/Settings.ts
+class BellowsSettings {
+ static registerSettings() {
+ /*game.settings.register("bellows", "enableLegacyYoutubeImport", {
+ name: game.i18n.localize("Bellows.Settings.LegacyImport.Name"),
+ hint: game.i18n.localize("Bellows.Settings.LegacyImport.Hint"),
+ scope: "world",
+ type: Boolean,
+ default: false
+ });*/
+ }
+}
+
+;// CONCATENATED MODULE: ./src/module/services/streaming/YoutubeStreamIdExtractor.ts
+class YoutubeStreamIdExtractor {
+ extract(uri) {
+ /**
+ * Url regex string credit https://stackoverflow.com/questions/3717115/regular-expression-for-youtube-links
+ * should work for any given youtube link
+ */
+ const urlRegEx = /http(?:s?):\/\/(?:www\.)?youtu(?:be\.com\/watch\?v=|\.be\/)([\w\-_]*)(&(amp;)[\w=]*)?/;
+ //Plain video key
+ const keyRegEx = /^[a-zA-Z0-9_-]+$/;
+ if (!uri || uri.length === 0) {
+ throw new Error("Cannot extract an empty URI");
}
- return result;
- };
- XmlEntities.encodeNonUTF = function (str) {
- return new XmlEntities().encodeNonUTF(str);
- };
- XmlEntities.prototype.encodeNonASCII = function (str) {
- if (!str || !str.length) {
- return '';
+ const matches = urlRegEx.exec(uri);
+ if (matches) {
+ return matches[1];
}
- var strLength = str.length;
- var result = '';
- var i = 0;
- while (i < strLength) {
- var c = str.charCodeAt(i);
- if (c <= 255) {
- result += str[i++];
- continue;
- }
- if (c >= surrogate_pairs_1.highSurrogateFrom && c <= surrogate_pairs_1.highSurrogateTo) {
- result += '' + surrogate_pairs_1.getCodePoint(str, i) + ';';
- i++;
+ else {
+ const match = uri.match(keyRegEx);
+ if (match) {
+ return match[0];
}
else {
- result += '' + c + ';';
+ throw new Error("Invalid video Id");
}
- i++;
}
- return result;
- };
- XmlEntities.encodeNonASCII = function (str) {
- return new XmlEntities().encodeNonASCII(str);
- };
- return XmlEntities;
-}());
-exports.XmlEntities = XmlEntities;
-
+ }
+}
-/***/ }),
+;// CONCATENATED MODULE: ./src/module/factories/StreamIdExtractorFactory.ts
-/***/ "./node_modules/loglevel/lib/loglevel.js":
-/*!***********************************************!*\
- !*** ./node_modules/loglevel/lib/loglevel.js ***!
- \***********************************************/
-/***/ (function(module, exports, __webpack_require__) {
-var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/*
-* loglevel - https://github.com/pimterry/loglevel
-*
-* Copyright (c) 2013 Tim Perry
-* Licensed under the MIT license.
-*/
-(function (root, definition) {
- "use strict";
- if (true) {
- !(__WEBPACK_AMD_DEFINE_FACTORY__ = (definition),
- __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
- (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
- __WEBPACK_AMD_DEFINE_FACTORY__),
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
- } else {}
-}(this, function () {
- "use strict";
+class StreamIdExtractorFactory {
+ static getStreamIdExtractor(api) {
+ switch (api) {
+ case StreamType.youtube:
+ return new YoutubeStreamIdExtractor();
+ default:
+ throw new Error("No extractor is registered for given StreamType");
+ }
+ }
+}
- // Slightly dubious tricks to cut down minimized file size
- var noop = function() {};
- var undefinedType = "undefined";
- var isIE = (typeof window !== undefinedType) && (typeof window.navigator !== undefinedType) && (
- /Trident\/|MSIE /.test(window.navigator.userAgent)
- );
+;// CONCATENATED MODULE: ./src/module/integration/YoutubeStreamSound.ts
- var logMethods = [
- "trace",
- "debug",
- "info",
- "warn",
- "error"
- ];
- // Cross-browser bind equivalent that works at least back to IE6
- function bindMethod(obj, methodName) {
- var method = obj[methodName];
- if (typeof method.bind === 'function') {
- return method.bind(obj);
- } else {
- try {
- return Function.prototype.bind.call(method, obj);
- } catch (e) {
- // Missing bind shim or IE8 + Modernizr, fallback to wrapping
- return function() {
- return Function.prototype.apply.apply(method, [obj, arguments]);
- };
- }
+class YoutubeStreamSound {
+ constructor(src, preload = false) {
+ this.loaded = false;
+ this._loop = false;
+ this._scheduledEvents = new Set();
+ this._eventHandlerId = 1;
+ this._volume = 0;
+ this.events = { stop: {}, start: {}, end: {}, pause: {}, load: {}, };
+ this.src = src;
+ //@ts-ignore -- missing static var from community types, safe to ignore.
+ this.id = ++Sound._nodeId;
+ //ambient sounds need 'preloaded' sounds as they don't call .load.
+ //TODO: preload players in the background for a scene to enable instant playback
+ this.loaded = preload;
+ }
+ //foundry volume is between 0 & 1, YT player volume is between 0 and 100
+ get volume() {
+ if (this._player) {
+ return this._player.getVolume() / 100;
}
+ return this._volume;
}
-
- // Trace() doesn't print the message in IE, so for that case we need to wrap it
- function traceForIE() {
- if (console.log) {
- if (console.log.apply) {
- console.log.apply(console, arguments);
- } else {
- // In old IE, native console methods themselves don't have apply().
- Function.prototype.apply.apply(console.log, [console, arguments]);
- }
+ set volume(volume) {
+ if (this._player) {
+ this._player.setVolume(volume * 100);
}
- if (console.trace) console.trace();
+ this._volume = volume;
}
-
- // Build the best logging method possible for this env
- // Wherever possible we want to bind, not wrap, to preserve stack traces
- function realMethod(methodName) {
- if (methodName === 'debug') {
- methodName = 'log';
+ get currentTime() {
+ if (!this._player) {
+ return undefined;
}
-
- if (typeof console === undefinedType) {
- return false; // No method possible, for now - fixed later by enableLoggingWhenConsoleArrives
- } else if (methodName === 'trace' && isIE) {
- return traceForIE;
- } else if (console[methodName] !== undefined) {
- return bindMethod(console, methodName);
- } else if (console.log !== undefined) {
- return bindMethod(console, 'log');
- } else {
- return noop;
+ if (this.pausedTime) {
+ return this.pausedTime;
}
+ return this._player.getCurrentTime();
}
-
- // These private functions always need `this` to be set properly
-
- function replaceLoggingMethods(level, loggerName) {
- /*jshint validthis:true */
- for (var i = 0; i < logMethods.length; i++) {
- var methodName = logMethods[i];
- this[methodName] = (i < level) ?
- noop :
- this.methodFactory(methodName, level, loggerName);
+ get duration() {
+ var _a, _b;
+ if (!this._player) {
+ return 0;
}
-
- // Define log.log as an alias for log.debug
- this.log = this.debug;
+ return (_b = (_a = this._player) === null || _a === void 0 ? void 0 : _a.getDuration()) !== null && _b !== void 0 ? _b : 0;
}
-
- // In old IE versions, the console isn't present until you first open it.
- // We build realMethod() replacements here that regenerate logging methods
- function enableLoggingWhenConsoleArrives(methodName, level, loggerName) {
- return function () {
- if (typeof console !== undefinedType) {
- replaceLoggingMethods.call(this, level, loggerName);
- this[methodName].apply(this, arguments);
- }
- };
+ get playing() {
+ var _a, _b;
+ return ((_b = ((_a = this._player) === null || _a === void 0 ? void 0 : _a.getPlayerState()) == 1 /* PlayerState.PLAYING */) !== null && _b !== void 0 ? _b : false);
}
-
- // By default, we use closely bound real methods wherever possible, and
- // otherwise we wait for a console to appear, and then try again.
- function defaultMethodFactory(methodName, level, loggerName) {
- /*jshint validthis:true */
- return realMethod(methodName) ||
- enableLoggingWhenConsoleArrives.apply(this, arguments);
+ get loop() {
+ return this._loop;
}
-
- function Logger(name, defaultLevel, factory) {
- var self = this;
- var currentLevel;
- defaultLevel = defaultLevel == null ? "WARN" : defaultLevel;
-
- var storageKey = "loglevel";
- if (typeof name === "string") {
- storageKey += ":" + name;
- } else if (typeof name === "symbol") {
- storageKey = undefined;
- }
-
- function persistLevelIfPossible(levelNum) {
- var levelName = (logMethods[levelNum] || 'silent').toUpperCase();
-
- if (typeof window === undefinedType || !storageKey) return;
-
- // Use localStorage if available
- try {
- window.localStorage[storageKey] = levelName;
- return;
- } catch (ignore) {}
-
- // Use session cookie as fallback
- try {
- window.document.cookie =
- encodeURIComponent(storageKey) + "=" + levelName + ";";
- } catch (ignore) {}
- }
-
- function getPersistedLevel() {
- var storedLevel;
-
- if (typeof window === undefinedType || !storageKey) return;
-
- try {
- storedLevel = window.localStorage[storageKey];
- } catch (ignore) {}
-
- // Fallback to cookies if local storage gives us nothing
- if (typeof storedLevel === undefinedType) {
- try {
- var cookie = window.document.cookie;
- var location = cookie.indexOf(
- encodeURIComponent(storageKey) + "=");
- if (location !== -1) {
- storedLevel = /^([^;]+)/.exec(cookie.slice(location))[1];
- }
- } catch (ignore) {}
- }
-
- // If the stored level is not valid, treat it as if nothing was stored.
- if (self.levels[storedLevel] === undefined) {
- storedLevel = undefined;
- }
-
- return storedLevel;
- }
-
- function clearPersistedLevel() {
- if (typeof window === undefinedType || !storageKey) return;
-
- // Use localStorage if available
- try {
- window.localStorage.removeItem(storageKey);
- return;
- } catch (ignore) {}
-
- // Use session cookie as fallback
- try {
- window.document.cookie =
- encodeURIComponent(storageKey) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC";
- } catch (ignore) {}
- }
-
- /*
- *
- * Public logger API - see https://github.com/pimterry/loglevel for details
- *
- */
-
- self.name = name;
-
- self.levels = { "TRACE": 0, "DEBUG": 1, "INFO": 2, "WARN": 3,
- "ERROR": 4, "SILENT": 5};
-
- self.methodFactory = factory || defaultMethodFactory;
-
- self.getLevel = function () {
- return currentLevel;
- };
-
- self.setLevel = function (level, persist) {
- if (typeof level === "string" && self.levels[level.toUpperCase()] !== undefined) {
- level = self.levels[level.toUpperCase()];
- }
- if (typeof level === "number" && level >= 0 && level <= self.levels.SILENT) {
- currentLevel = level;
- if (persist !== false) { // defaults to true
- persistLevelIfPossible(level);
- }
- replaceLoggingMethods.call(self, level, name);
- if (typeof console === undefinedType && level < self.levels.SILENT) {
- return "No console available for logging";
- }
- } else {
- throw "log.setLevel() called with invalid level: " + level;
- }
- };
-
- self.setDefaultLevel = function (level) {
- defaultLevel = level;
- if (!getPersistedLevel()) {
- self.setLevel(level, false);
- }
- };
-
- self.resetLevel = function () {
- self.setLevel(defaultLevel, false);
- clearPersistedLevel();
- };
-
- self.enableAll = function(persist) {
- self.setLevel(self.levels.TRACE, persist);
- };
-
- self.disableAll = function(persist) {
- self.setLevel(self.levels.SILENT, persist);
- };
-
- // Initialize with the right level
- var initialLevel = getPersistedLevel();
- if (initialLevel == null) {
- initialLevel = defaultLevel;
- }
- self.setLevel(initialLevel, false);
+ set loop(looping) {
+ this._loop = looping;
+ if (!this._player)
+ return;
+ this._player.setLoop(looping);
}
-
- /*
- *
- * Top-level API
- *
- */
-
- var defaultLogger = new Logger();
-
- var _loggersByName = {};
- defaultLogger.getLogger = function getLogger(name) {
- if ((typeof name !== "symbol" && typeof name !== "string") || name === "") {
- throw new TypeError("You must supply a name when creating a logger.");
+ //currently don't support type - uses sin easing function
+ async fade(volume, { duration = 1000, from }) {
+ if (!this._player)
+ return;
+ //Current only support linear fade
+ const currentVolume = from !== null && from !== void 0 ? from : this._player.getVolume();
+ const delta = volume - currentVolume;
+ if (delta == 0) {
+ return Promise.resolve();
}
-
- var logger = _loggersByName[name];
- if (!logger) {
- logger = _loggersByName[name] = new Logger(
- name, defaultLogger.getLevel(), defaultLogger.methodFactory);
+ //clear existing handler
+ if (this._fadeIntervalHandler) {
+ clearInterval(this._fadeIntervalHandler);
}
- return logger;
- };
-
- // Grab the current global log variable in case of overwrite
- var _log = (typeof window !== undefinedType) ? window.log : undefined;
- defaultLogger.noConflict = function() {
- if (typeof window !== undefinedType &&
- window.log === defaultLogger) {
- window.log = _log;
+ const tickrate = 100;
+ const ticks = Math.floor(duration / tickrate);
+ let tick = 1;
+ return new Promise(resolve => {
+ this._fadeIntervalHandler = window.setInterval(() => {
+ var _a;
+ (_a = this._player) === null || _a === void 0 ? void 0 : _a.setVolume(currentVolume + (this._sinEasing(tick / ticks) * delta));
+ if (++tick === ticks + 1) {
+ clearInterval(this._fadeIntervalHandler);
+ this._fadeIntervalHandler = undefined;
+ resolve();
+ }
+ }, tickrate);
+ });
+ }
+ async load({ autoplay = false, autoplayOptions = {} } = {}) {
+ // Foundry delayed loading - await user gesture
+ if (game.audio.locked) {
+ Utils.LogDebug(`Delaying load of youtube stream sound ${this.src} until after first user gesture`);
+ //@ts-ignore -- types incorrectly define pending as an Array - just an array of functions...
+ await new Promise(resolve => game.audio.pending.push(resolve));
}
-
- return defaultLogger;
- };
-
- defaultLogger.getLoggers = function getLoggers() {
- return _loggersByName;
- };
-
- // ES6 default export, for compatibility
- defaultLogger['default'] = defaultLogger;
-
- return defaultLogger;
-}));
-
-
-/***/ }),
-
-/***/ "./node_modules/punycode/punycode.js":
-/*!*******************************************!*\
- !*** ./node_modules/punycode/punycode.js ***!
- \*******************************************/
-/***/ (function(module, exports, __webpack_require__) {
-
-/* module decorator */ module = __webpack_require__.nmd(module);
-var __WEBPACK_AMD_DEFINE_RESULT__;/*! https://mths.be/punycode v1.3.2 by @mathias */
-;(function(root) {
-
- /** Detect free variables */
- var freeExports = true && exports &&
- !exports.nodeType && exports;
- var freeModule = true && module &&
- !module.nodeType && module;
- var freeGlobal = typeof __webpack_require__.g == 'object' && __webpack_require__.g;
- if (
- freeGlobal.global === freeGlobal ||
- freeGlobal.window === freeGlobal ||
- freeGlobal.self === freeGlobal
- ) {
- root = freeGlobal;
- }
-
- /**
- * The `punycode` object.
- * @name punycode
- * @type Object
- */
- var punycode,
-
- /** Highest positive signed 32-bit float value */
- maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1
-
- /** Bootstring parameters */
- base = 36,
- tMin = 1,
- tMax = 26,
- skew = 38,
- damp = 700,
- initialBias = 72,
- initialN = 128, // 0x80
- delimiter = '-', // '\x2D'
-
- /** Regular expressions */
- regexPunycode = /^xn--/,
- regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars
- regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators
-
- /** Error messages */
- errors = {
- 'overflow': 'Overflow: input needs wider integers to process',
- 'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
- 'invalid-input': 'Invalid input'
- },
-
- /** Convenience shortcuts */
- baseMinusTMin = base - tMin,
- floor = Math.floor,
- stringFromCharCode = String.fromCharCode,
-
- /** Temporary variable */
- key;
-
- /*--------------------------------------------------------------------------*/
-
- /**
- * A generic error utility function.
- * @private
- * @param {String} type The error type.
- * @returns {Error} Throws a `RangeError` with the applicable error message.
- */
- function error(type) {
- throw RangeError(errors[type]);
- }
-
- /**
- * A generic `Array#map` utility function.
- * @private
- * @param {Array} array The array to iterate over.
- * @param {Function} callback The function that gets called for every array
- * item.
- * @returns {Array} A new array of values returned by the callback function.
- */
- function map(array, fn) {
- var length = array.length;
- var result = [];
- while (length--) {
- result[length] = fn(array[length]);
- }
- return result;
- }
-
- /**
- * A simple `Array#map`-like wrapper to work with domain name strings or email
- * addresses.
- * @private
- * @param {String} domain The domain name or email address.
- * @param {Function} callback The function that gets called for every
- * character.
- * @returns {Array} A new string of characters returned by the callback
- * function.
- */
- function mapDomain(string, fn) {
- var parts = string.split('@');
- var result = '';
- if (parts.length > 1) {
- // In email addresses, only the domain name should be punycoded. Leave
- // the local part (i.e. everything up to `@`) intact.
- result = parts[0] + '@';
- string = parts[1];
- }
- // Avoid `split(regex)` for IE8 compatibility. See #17.
- string = string.replace(regexSeparators, '\x2E');
- var labels = string.split('.');
- var encoded = map(labels, fn).join('.');
- return result + encoded;
- }
-
- /**
- * Creates an array containing the numeric code points of each Unicode
- * character in the string. While JavaScript uses UCS-2 internally,
- * this function will convert a pair of surrogate halves (each of which
- * UCS-2 exposes as separate characters) into a single code point,
- * matching UTF-16.
- * @see `punycode.ucs2.encode`
- * @see
- * @memberOf punycode.ucs2
- * @name decode
- * @param {String} string The Unicode input string (UCS-2).
- * @returns {Array} The new array of code points.
- */
- function ucs2decode(string) {
- var output = [],
- counter = 0,
- length = string.length,
- value,
- extra;
- while (counter < length) {
- value = string.charCodeAt(counter++);
- if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
- // high surrogate, and there is a next character
- extra = string.charCodeAt(counter++);
- if ((extra & 0xFC00) == 0xDC00) { // low surrogate
- output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
- } else {
- // unmatched surrogate; only append this code unit, in case the next
- // code unit is the high surrogate of a surrogate pair
- output.push(value);
- counter--;
- }
- } else {
- output.push(value);
- }
- }
- return output;
- }
-
- /**
- * Creates a string based on an array of numeric code points.
- * @see `punycode.ucs2.decode`
- * @memberOf punycode.ucs2
- * @name encode
- * @param {Array} codePoints The array of numeric code points.
- * @returns {String} The new Unicode string (UCS-2).
- */
- function ucs2encode(array) {
- return map(array, function(value) {
- var output = '';
- if (value > 0xFFFF) {
- value -= 0x10000;
- output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);
- value = 0xDC00 | value & 0x3FF;
- }
- output += stringFromCharCode(value);
- return output;
- }).join('');
- }
-
- /**
- * Converts a basic code point into a digit/integer.
- * @see `digitToBasic()`
- * @private
- * @param {Number} codePoint The basic numeric code point value.
- * @returns {Number} The numeric value of a basic code point (for use in
- * representing integers) in the range `0` to `base - 1`, or `base` if
- * the code point does not represent a value.
- */
- function basicToDigit(codePoint) {
- if (codePoint - 48 < 10) {
- return codePoint - 22;
- }
- if (codePoint - 65 < 26) {
- return codePoint - 65;
- }
- if (codePoint - 97 < 26) {
- return codePoint - 97;
- }
- return base;
- }
-
- /**
- * Converts a digit/integer into a basic code point.
- * @see `basicToDigit()`
- * @private
- * @param {Number} digit The numeric value of a basic code point.
- * @returns {Number} The basic code point whose value (when used for
- * representing integers) is `digit`, which needs to be in the range
- * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
- * used; else, the lowercase form is used. The behavior is undefined
- * if `flag` is non-zero and `digit` has no uppercase form.
- */
- function digitToBasic(digit, flag) {
- // 0..25 map to ASCII a..z or A..Z
- // 26..35 map to ASCII 0..9
- return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
- }
-
- /**
- * Bias adaptation function as per section 3.4 of RFC 3492.
- * http://tools.ietf.org/html/rfc3492#section-3.4
- * @private
- */
- function adapt(delta, numPoints, firstTime) {
- var k = 0;
- delta = firstTime ? floor(delta / damp) : delta >> 1;
- delta += floor(delta / numPoints);
- for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {
- delta = floor(delta / baseMinusTMin);
- }
- return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
- }
-
- /**
- * Converts a Punycode string of ASCII-only symbols to a string of Unicode
- * symbols.
- * @memberOf punycode
- * @param {String} input The Punycode string of ASCII-only symbols.
- * @returns {String} The resulting string of Unicode symbols.
- */
- function decode(input) {
- // Don't use UCS-2
- var output = [],
- inputLength = input.length,
- out,
- i = 0,
- n = initialN,
- bias = initialBias,
- basic,
- j,
- index,
- oldi,
- w,
- k,
- digit,
- t,
- /** Cached calculation results */
- baseMinusT;
-
- // Handle the basic code points: let `basic` be the number of input code
- // points before the last delimiter, or `0` if there is none, then copy
- // the first basic code points to the output.
-
- basic = input.lastIndexOf(delimiter);
- if (basic < 0) {
- basic = 0;
- }
-
- for (j = 0; j < basic; ++j) {
- // if it's not a basic code point
- if (input.charCodeAt(j) >= 0x80) {
- error('not-basic');
- }
- output.push(input.charCodeAt(j));
- }
-
- // Main decoding loop: start just after the last delimiter if any basic code
- // points were copied; start at the beginning otherwise.
-
- for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {
-
- // `index` is the index of the next character to be consumed.
- // Decode a generalized variable-length integer into `delta`,
- // which gets added to `i`. The overflow checking is easier
- // if we increase `i` as we go, then subtract off its starting
- // value at the end to obtain `delta`.
- for (oldi = i, w = 1, k = base; /* no condition */; k += base) {
-
- if (index >= inputLength) {
- error('invalid-input');
- }
-
- digit = basicToDigit(input.charCodeAt(index++));
-
- if (digit >= base || digit > floor((maxInt - i) / w)) {
- error('overflow');
- }
-
- i += digit * w;
- t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
-
- if (digit < t) {
- break;
- }
-
- baseMinusT = base - t;
- if (w > floor(maxInt / baseMinusT)) {
- error('overflow');
- }
-
- w *= baseMinusT;
-
- }
-
- out = output.length + 1;
- bias = adapt(i - oldi, out, oldi == 0);
-
- // `i` was supposed to wrap around from `out` to `0`,
- // incrementing `n` each time, so we'll fix that now:
- if (floor(i / out) > maxInt - n) {
- error('overflow');
- }
-
- n += floor(i / out);
- i %= out;
-
- // Insert `n` at position `i` of the output
- output.splice(i++, 0, n);
-
- }
-
- return ucs2encode(output);
- }
-
- /**
- * Converts a string of Unicode symbols (e.g. a domain name label) to a
- * Punycode string of ASCII-only symbols.
- * @memberOf punycode
- * @param {String} input The string of Unicode symbols.
- * @returns {String} The resulting Punycode string of ASCII-only symbols.
- */
- function encode(input) {
- var n,
- delta,
- handledCPCount,
- basicLength,
- bias,
- j,
- m,
- q,
- k,
- t,
- currentValue,
- output = [],
- /** `inputLength` will hold the number of code points in `input`. */
- inputLength,
- /** Cached calculation results */
- handledCPCountPlusOne,
- baseMinusT,
- qMinusT;
-
- // Convert the input in UCS-2 to Unicode
- input = ucs2decode(input);
-
- // Cache the length
- inputLength = input.length;
-
- // Initialize the state
- n = initialN;
- delta = 0;
- bias = initialBias;
-
- // Handle the basic code points
- for (j = 0; j < inputLength; ++j) {
- currentValue = input[j];
- if (currentValue < 0x80) {
- output.push(stringFromCharCode(currentValue));
- }
- }
-
- handledCPCount = basicLength = output.length;
-
- // `handledCPCount` is the number of code points that have been handled;
- // `basicLength` is the number of basic code points.
-
- // Finish the basic string - if it is not empty - with a delimiter
- if (basicLength) {
- output.push(delimiter);
- }
-
- // Main encoding loop:
- while (handledCPCount < inputLength) {
-
- // All non-basic code points < n have been handled already. Find the next
- // larger one:
- for (m = maxInt, j = 0; j < inputLength; ++j) {
- currentValue = input[j];
- if (currentValue >= n && currentValue < m) {
- m = currentValue;
- }
- }
-
- // Increase `delta` enough to advance the decoder's state to ,
- // but guard against overflow
- handledCPCountPlusOne = handledCPCount + 1;
- if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
- error('overflow');
- }
-
- delta += (m - n) * handledCPCountPlusOne;
- n = m;
-
- for (j = 0; j < inputLength; ++j) {
- currentValue = input[j];
-
- if (currentValue < n && ++delta > maxInt) {
- error('overflow');
- }
-
- if (currentValue == n) {
- // Represent delta as a generalized variable-length integer
- for (q = delta, k = base; /* no condition */; k += base) {
- t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
- if (q < t) {
- break;
- }
- qMinusT = q - t;
- baseMinusT = base - t;
- output.push(
- stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))
- );
- q = floor(qMinusT / baseMinusT);
- }
-
- output.push(stringFromCharCode(digitToBasic(q, 0)));
- bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
- delta = 0;
- ++handledCPCount;
- }
- }
-
- ++delta;
- ++n;
-
- }
- return output.join('');
- }
-
- /**
- * Converts a Punycode string representing a domain name or an email address
- * to Unicode. Only the Punycoded parts of the input will be converted, i.e.
- * it doesn't matter if you call it on a string that has already been
- * converted to Unicode.
- * @memberOf punycode
- * @param {String} input The Punycoded domain name or email address to
- * convert to Unicode.
- * @returns {String} The Unicode representation of the given Punycode
- * string.
- */
- function toUnicode(input) {
- return mapDomain(input, function(string) {
- return regexPunycode.test(string)
- ? decode(string.slice(4).toLowerCase())
- : string;
- });
- }
-
- /**
- * Converts a Unicode string representing a domain name or an email address to
- * Punycode. Only the non-ASCII parts of the domain name will be converted,
- * i.e. it doesn't matter if you call it with a domain that's already in
- * ASCII.
- * @memberOf punycode
- * @param {String} input The domain name or email address to convert, as a
- * Unicode string.
- * @returns {String} The Punycode representation of the given domain name or
- * email address.
- */
- function toASCII(input) {
- return mapDomain(input, function(string) {
- return regexNonASCII.test(string)
- ? 'xn--' + encode(string)
- : string;
- });
- }
-
- /*--------------------------------------------------------------------------*/
-
- /** Define the public API */
- punycode = {
- /**
- * A string representing the current Punycode.js version number.
- * @memberOf punycode
- * @type String
- */
- 'version': '1.3.2',
- /**
- * An object of methods to convert from JavaScript's internal character
- * representation (UCS-2) to Unicode code points, and back.
- * @see
- * @memberOf punycode
- * @type Object
- */
- 'ucs2': {
- 'decode': ucs2decode,
- 'encode': ucs2encode
- },
- 'decode': decode,
- 'encode': encode,
- 'toASCII': toASCII,
- 'toUnicode': toUnicode
- };
-
- /** Expose `punycode` */
- // Some AMD build optimizers, like r.js, check for specific condition patterns
- // like the following:
- if (
- true
- ) {
- !(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
- return punycode;
- }).call(exports, __webpack_require__, exports, module),
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
- } else {}
-
-}(this));
-
-
-/***/ }),
-
-/***/ "./node_modules/querystring/decode.js":
-/*!********************************************!*\
- !*** ./node_modules/querystring/decode.js ***!
- \********************************************/
-/***/ ((module) => {
-
-"use strict";
-// Copyright Joyent, Inc. and other Node contributors.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a
-// copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to permit
-// persons to whom the Software is furnished to do so, subject to the
-// following conditions:
-//
-// The above copyright notice and this permission notice shall be included
-// in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
-// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-// USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-
-
-// If obj.hasOwnProperty has been overridden, then calling
-// obj.hasOwnProperty(prop) will break.
-// See: https://github.com/joyent/node/issues/1707
-function hasOwnProperty(obj, prop) {
- return Object.prototype.hasOwnProperty.call(obj, prop);
-}
-
-module.exports = function(qs, sep, eq, options) {
- sep = sep || '&';
- eq = eq || '=';
- var obj = {};
-
- if (typeof qs !== 'string' || qs.length === 0) {
- return obj;
- }
-
- var regexp = /\+/g;
- qs = qs.split(sep);
-
- var maxKeys = 1000;
- if (options && typeof options.maxKeys === 'number') {
- maxKeys = options.maxKeys;
- }
-
- var len = qs.length;
- // maxKeys <= 0 means that we should not limit keys count
- if (maxKeys > 0 && len > maxKeys) {
- len = maxKeys;
- }
-
- for (var i = 0; i < len; ++i) {
- var x = qs[i].replace(regexp, '%20'),
- idx = x.indexOf(eq),
- kstr, vstr, k, v;
-
- if (idx >= 0) {
- kstr = x.substr(0, idx);
- vstr = x.substr(idx + 1);
- } else {
- kstr = x;
- vstr = '';
- }
-
- k = decodeURIComponent(kstr);
- v = decodeURIComponent(vstr);
-
- if (!hasOwnProperty(obj, k)) {
- obj[k] = v;
- } else if (Array.isArray(obj[k])) {
- obj[k].push(v);
- } else {
- obj[k] = [obj[k], v];
- }
- }
-
- return obj;
-};
-
-
-/***/ }),
-
-/***/ "./node_modules/querystring/encode.js":
-/*!********************************************!*\
- !*** ./node_modules/querystring/encode.js ***!
- \********************************************/
-/***/ ((module) => {
-
-"use strict";
-// Copyright Joyent, Inc. and other Node contributors.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a
-// copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to permit
-// persons to whom the Software is furnished to do so, subject to the
-// following conditions:
-//
-// The above copyright notice and this permission notice shall be included
-// in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
-// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-// USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-
-
-var stringifyPrimitive = function(v) {
- switch (typeof v) {
- case 'string':
- return v;
-
- case 'boolean':
- return v ? 'true' : 'false';
-
- case 'number':
- return isFinite(v) ? v : '';
-
- default:
- return '';
- }
-};
-
-module.exports = function(obj, sep, eq, name) {
- sep = sep || '&';
- eq = eq || '=';
- if (obj === null) {
- obj = undefined;
- }
-
- if (typeof obj === 'object') {
- return Object.keys(obj).map(function(k) {
- var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;
- if (Array.isArray(obj[k])) {
- return obj[k].map(function(v) {
- return ks + encodeURIComponent(stringifyPrimitive(v));
- }).join(sep);
- } else {
- return ks + encodeURIComponent(stringifyPrimitive(obj[k]));
- }
- }).join(sep);
-
- }
-
- if (!name) return '';
- return encodeURIComponent(stringifyPrimitive(name)) + eq +
- encodeURIComponent(stringifyPrimitive(obj));
-};
-
-
-/***/ }),
-
-/***/ "./node_modules/querystring/index.js":
-/*!*******************************************!*\
- !*** ./node_modules/querystring/index.js ***!
- \*******************************************/
-/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
-
-"use strict";
-
-
-exports.decode = exports.parse = __webpack_require__(/*! ./decode */ "./node_modules/querystring/decode.js");
-exports.encode = exports.stringify = __webpack_require__(/*! ./encode */ "./node_modules/querystring/encode.js");
-
-
-/***/ }),
-
-/***/ "./node_modules/sockjs-client/dist/sockjs.js":
-/*!***************************************************!*\
- !*** ./node_modules/sockjs-client/dist/sockjs.js ***!
- \***************************************************/
-/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
-
-/* sockjs-client v1.6.1 | http://sockjs.org | MIT license */
-(function(f){if(true){module.exports=f()}else { var g; }})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=undefined;if(!f&&c)return require(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=undefined,i=0;i 1) {
- // Make a copy so as not to interfere with a current dispatchEvent.
- this._listeners[eventType] = arr.slice(0, idx).concat(arr.slice(idx + 1));
- } else {
- delete this._listeners[eventType];
- }
- return;
- }
-};
-
-EventTarget.prototype.dispatchEvent = function() {
- var event = arguments[0];
- var t = event.type;
- // equivalent of Array.prototype.slice.call(arguments, 0);
- var args = arguments.length === 1 ? [event] : Array.apply(null, arguments);
- // TODO: This doesn't match the real behavior; per spec, onfoo get
- // their place in line from the /first/ time they're set from
- // non-null. Although WebKit bumps it to the end every time it's
- // set.
- if (this['on' + t]) {
- this['on' + t].apply(this, args);
- }
- if (t in this._listeners) {
- // Grab a reference to the listeners list. removeEventListener may alter the list.
- var listeners = this._listeners[t];
- for (var i = 0; i < listeners.length; i++) {
- listeners[i].apply(this, args);
- }
- }
-};
-
-module.exports = EventTarget;
-
-},{}],6:[function(require,module,exports){
-'use strict';
-
-var inherits = require('inherits')
- , Event = require('./event')
- ;
-
-function TransportMessageEvent(data) {
- Event.call(this);
- this.initEvent('message', false, false);
- this.data = data;
-}
-
-inherits(TransportMessageEvent, Event);
-
-module.exports = TransportMessageEvent;
-
-},{"./event":4,"inherits":57}],7:[function(require,module,exports){
-'use strict';
-
-var iframeUtils = require('./utils/iframe')
- ;
-
-function FacadeJS(transport) {
- this._transport = transport;
- transport.on('message', this._transportMessage.bind(this));
- transport.on('close', this._transportClose.bind(this));
-}
-
-FacadeJS.prototype._transportClose = function(code, reason) {
- iframeUtils.postMessage('c', JSON.stringify([code, reason]));
-};
-FacadeJS.prototype._transportMessage = function(frame) {
- iframeUtils.postMessage('t', frame);
-};
-FacadeJS.prototype._send = function(data) {
- this._transport.send(data);
-};
-FacadeJS.prototype._close = function() {
- this._transport.close();
- this._transport.removeAllListeners();
-};
-
-module.exports = FacadeJS;
-
-},{"./utils/iframe":47}],8:[function(require,module,exports){
-(function (process){(function (){
-'use strict';
-
-var urlUtils = require('./utils/url')
- , eventUtils = require('./utils/event')
- , FacadeJS = require('./facade')
- , InfoIframeReceiver = require('./info-iframe-receiver')
- , iframeUtils = require('./utils/iframe')
- , loc = require('./location')
- ;
-
-var debug = function() {};
-if (process.env.NODE_ENV !== 'production') {
- debug = require('debug')('sockjs-client:iframe-bootstrap');
-}
-
-module.exports = function(SockJS, availableTransports) {
- var transportMap = {};
- availableTransports.forEach(function(at) {
- if (at.facadeTransport) {
- transportMap[at.facadeTransport.transportName] = at.facadeTransport;
- }
- });
-
- // hard-coded for the info iframe
- // TODO see if we can make this more dynamic
- transportMap[InfoIframeReceiver.transportName] = InfoIframeReceiver;
- var parentOrigin;
-
- /* eslint-disable camelcase */
- SockJS.bootstrap_iframe = function() {
- /* eslint-enable camelcase */
- var facade;
- iframeUtils.currentWindowId = loc.hash.slice(1);
- var onMessage = function(e) {
- if (e.source !== parent) {
- return;
- }
- if (typeof parentOrigin === 'undefined') {
- parentOrigin = e.origin;
- }
- if (e.origin !== parentOrigin) {
- return;
- }
-
- var iframeMessage;
- try {
- iframeMessage = JSON.parse(e.data);
- } catch (ignored) {
- debug('bad json', e.data);
- return;
- }
-
- if (iframeMessage.windowId !== iframeUtils.currentWindowId) {
- return;
- }
- switch (iframeMessage.type) {
- case 's':
- var p;
- try {
- p = JSON.parse(iframeMessage.data);
- } catch (ignored) {
- debug('bad json', iframeMessage.data);
- break;
- }
- var version = p[0];
- var transport = p[1];
- var transUrl = p[2];
- var baseUrl = p[3];
- debug(version, transport, transUrl, baseUrl);
- // change this to semver logic
- if (version !== SockJS.version) {
- throw new Error('Incompatible SockJS! Main site uses:' +
- ' "' + version + '", the iframe:' +
- ' "' + SockJS.version + '".');
- }
-
- if (!urlUtils.isOriginEqual(transUrl, loc.href) ||
- !urlUtils.isOriginEqual(baseUrl, loc.href)) {
- throw new Error('Can\'t connect to different domain from within an ' +
- 'iframe. (' + loc.href + ', ' + transUrl + ', ' + baseUrl + ')');
- }
- facade = new FacadeJS(new transportMap[transport](transUrl, baseUrl));
- break;
- case 'm':
- facade._send(iframeMessage.data);
- break;
- case 'c':
- if (facade) {
- facade._close();
- }
- facade = null;
- break;
- }
- };
-
- eventUtils.attachEvent('message', onMessage);
-
- // Start
- iframeUtils.postMessage('s');
- };
-};
-
-}).call(this)}).call(this,{ env: {} })
-
-},{"./facade":7,"./info-iframe-receiver":10,"./location":13,"./utils/event":46,"./utils/iframe":47,"./utils/url":52,"debug":55}],9:[function(require,module,exports){
-(function (process){(function (){
-'use strict';
-
-var EventEmitter = require('events').EventEmitter
- , inherits = require('inherits')
- , objectUtils = require('./utils/object')
- ;
-
-var debug = function() {};
-if (process.env.NODE_ENV !== 'production') {
- debug = require('debug')('sockjs-client:info-ajax');
-}
-
-function InfoAjax(url, AjaxObject) {
- EventEmitter.call(this);
-
- var self = this;
- var t0 = +new Date();
- this.xo = new AjaxObject('GET', url);
-
- this.xo.once('finish', function(status, text) {
- var info, rtt;
- if (status === 200) {
- rtt = (+new Date()) - t0;
- if (text) {
- try {
- info = JSON.parse(text);
- } catch (e) {
- debug('bad json', text);
- }
- }
-
- if (!objectUtils.isObject(info)) {
- info = {};
- }
- }
- self.emit('finish', info, rtt);
- self.removeAllListeners();
- });
-}
-
-inherits(InfoAjax, EventEmitter);
-
-InfoAjax.prototype.close = function() {
- this.removeAllListeners();
- this.xo.close();
-};
-
-module.exports = InfoAjax;
-
-}).call(this)}).call(this,{ env: {} })
-
-},{"./utils/object":49,"debug":55,"events":3,"inherits":57}],10:[function(require,module,exports){
-'use strict';
-
-var inherits = require('inherits')
- , EventEmitter = require('events').EventEmitter
- , XHRLocalObject = require('./transport/sender/xhr-local')
- , InfoAjax = require('./info-ajax')
- ;
-
-function InfoReceiverIframe(transUrl) {
- var self = this;
- EventEmitter.call(this);
-
- this.ir = new InfoAjax(transUrl, XHRLocalObject);
- this.ir.once('finish', function(info, rtt) {
- self.ir = null;
- self.emit('message', JSON.stringify([info, rtt]));
- });
-}
-
-inherits(InfoReceiverIframe, EventEmitter);
-
-InfoReceiverIframe.transportName = 'iframe-info-receiver';
-
-InfoReceiverIframe.prototype.close = function() {
- if (this.ir) {
- this.ir.close();
- this.ir = null;
- }
- this.removeAllListeners();
-};
-
-module.exports = InfoReceiverIframe;
-
-},{"./info-ajax":9,"./transport/sender/xhr-local":37,"events":3,"inherits":57}],11:[function(require,module,exports){
-(function (process,global){(function (){
-'use strict';
-
-var EventEmitter = require('events').EventEmitter
- , inherits = require('inherits')
- , utils = require('./utils/event')
- , IframeTransport = require('./transport/iframe')
- , InfoReceiverIframe = require('./info-iframe-receiver')
- ;
-
-var debug = function() {};
-if (process.env.NODE_ENV !== 'production') {
- debug = require('debug')('sockjs-client:info-iframe');
-}
-
-function InfoIframe(baseUrl, url) {
- var self = this;
- EventEmitter.call(this);
-
- var go = function() {
- var ifr = self.ifr = new IframeTransport(InfoReceiverIframe.transportName, url, baseUrl);
-
- ifr.once('message', function(msg) {
- if (msg) {
- var d;
- try {
- d = JSON.parse(msg);
- } catch (e) {
- debug('bad json', msg);
- self.emit('finish');
- self.close();
- return;
- }
-
- var info = d[0], rtt = d[1];
- self.emit('finish', info, rtt);
- }
- self.close();
- });
-
- ifr.once('close', function() {
- self.emit('finish');
- self.close();
- });
- };
-
- // TODO this seems the same as the 'needBody' from transports
- if (!global.document.body) {
- utils.attachEvent('load', go);
- } else {
- go();
- }
-}
-
-inherits(InfoIframe, EventEmitter);
-
-InfoIframe.enabled = function() {
- return IframeTransport.enabled();
-};
-
-InfoIframe.prototype.close = function() {
- if (this.ifr) {
- this.ifr.close();
- }
- this.removeAllListeners();
- this.ifr = null;
-};
-
-module.exports = InfoIframe;
-
-}).call(this)}).call(this,{ env: {} },typeof __webpack_require__.g !== "undefined" ? __webpack_require__.g : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-
-},{"./info-iframe-receiver":10,"./transport/iframe":22,"./utils/event":46,"debug":55,"events":3,"inherits":57}],12:[function(require,module,exports){
-(function (process){(function (){
-'use strict';
-
-var EventEmitter = require('events').EventEmitter
- , inherits = require('inherits')
- , urlUtils = require('./utils/url')
- , XDR = require('./transport/sender/xdr')
- , XHRCors = require('./transport/sender/xhr-cors')
- , XHRLocal = require('./transport/sender/xhr-local')
- , XHRFake = require('./transport/sender/xhr-fake')
- , InfoIframe = require('./info-iframe')
- , InfoAjax = require('./info-ajax')
- ;
-
-var debug = function() {};
-if (process.env.NODE_ENV !== 'production') {
- debug = require('debug')('sockjs-client:info-receiver');
-}
-
-function InfoReceiver(baseUrl, urlInfo) {
- debug(baseUrl);
- var self = this;
- EventEmitter.call(this);
-
- setTimeout(function() {
- self.doXhr(baseUrl, urlInfo);
- }, 0);
-}
-
-inherits(InfoReceiver, EventEmitter);
-
-// TODO this is currently ignoring the list of available transports and the whitelist
-
-InfoReceiver._getReceiver = function(baseUrl, url, urlInfo) {
- // determine method of CORS support (if needed)
- if (urlInfo.sameOrigin) {
- return new InfoAjax(url, XHRLocal);
- }
- if (XHRCors.enabled) {
- return new InfoAjax(url, XHRCors);
- }
- if (XDR.enabled && urlInfo.sameScheme) {
- return new InfoAjax(url, XDR);
- }
- if (InfoIframe.enabled()) {
- return new InfoIframe(baseUrl, url);
- }
- return new InfoAjax(url, XHRFake);
-};
-
-InfoReceiver.prototype.doXhr = function(baseUrl, urlInfo) {
- var self = this
- , url = urlUtils.addPath(baseUrl, '/info')
- ;
- debug('doXhr', url);
-
- this.xo = InfoReceiver._getReceiver(baseUrl, url, urlInfo);
-
- this.timeoutRef = setTimeout(function() {
- debug('timeout');
- self._cleanup(false);
- self.emit('finish');
- }, InfoReceiver.timeout);
-
- this.xo.once('finish', function(info, rtt) {
- debug('finish', info, rtt);
- self._cleanup(true);
- self.emit('finish', info, rtt);
- });
-};
-
-InfoReceiver.prototype._cleanup = function(wasClean) {
- debug('_cleanup');
- clearTimeout(this.timeoutRef);
- this.timeoutRef = null;
- if (!wasClean && this.xo) {
- this.xo.close();
- }
- this.xo = null;
-};
-
-InfoReceiver.prototype.close = function() {
- debug('close');
- this.removeAllListeners();
- this._cleanup(false);
-};
-
-InfoReceiver.timeout = 8000;
-
-module.exports = InfoReceiver;
-
-}).call(this)}).call(this,{ env: {} })
-
-},{"./info-ajax":9,"./info-iframe":11,"./transport/sender/xdr":34,"./transport/sender/xhr-cors":35,"./transport/sender/xhr-fake":36,"./transport/sender/xhr-local":37,"./utils/url":52,"debug":55,"events":3,"inherits":57}],13:[function(require,module,exports){
-(function (global){(function (){
-'use strict';
-
-module.exports = global.location || {
- origin: 'http://localhost:80'
-, protocol: 'http:'
-, host: 'localhost'
-, port: 80
-, href: 'http://localhost/'
-, hash: ''
-};
-
-}).call(this)}).call(this,typeof __webpack_require__.g !== "undefined" ? __webpack_require__.g : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-
-},{}],14:[function(require,module,exports){
-(function (process,global){(function (){
-'use strict';
-
-require('./shims');
-
-var URL = require('url-parse')
- , inherits = require('inherits')
- , random = require('./utils/random')
- , escape = require('./utils/escape')
- , urlUtils = require('./utils/url')
- , eventUtils = require('./utils/event')
- , transport = require('./utils/transport')
- , objectUtils = require('./utils/object')
- , browser = require('./utils/browser')
- , log = require('./utils/log')
- , Event = require('./event/event')
- , EventTarget = require('./event/eventtarget')
- , loc = require('./location')
- , CloseEvent = require('./event/close')
- , TransportMessageEvent = require('./event/trans-message')
- , InfoReceiver = require('./info-receiver')
- ;
-
-var debug = function() {};
-if (process.env.NODE_ENV !== 'production') {
- debug = require('debug')('sockjs-client:main');
-}
-
-var transports;
-
-// follow constructor steps defined at http://dev.w3.org/html5/websockets/#the-websocket-interface
-function SockJS(url, protocols, options) {
- if (!(this instanceof SockJS)) {
- return new SockJS(url, protocols, options);
- }
- if (arguments.length < 1) {
- throw new TypeError("Failed to construct 'SockJS: 1 argument required, but only 0 present");
- }
- EventTarget.call(this);
-
- this.readyState = SockJS.CONNECTING;
- this.extensions = '';
- this.protocol = '';
-
- // non-standard extension
- options = options || {};
- if (options.protocols_whitelist) {
- log.warn("'protocols_whitelist' is DEPRECATED. Use 'transports' instead.");
- }
- this._transportsWhitelist = options.transports;
- this._transportOptions = options.transportOptions || {};
- this._timeout = options.timeout || 0;
-
- var sessionId = options.sessionId || 8;
- if (typeof sessionId === 'function') {
- this._generateSessionId = sessionId;
- } else if (typeof sessionId === 'number') {
- this._generateSessionId = function() {
- return random.string(sessionId);
- };
- } else {
- throw new TypeError('If sessionId is used in the options, it needs to be a number or a function.');
- }
-
- this._server = options.server || random.numberString(1000);
-
- // Step 1 of WS spec - parse and validate the url. Issue #8
- var parsedUrl = new URL(url);
- if (!parsedUrl.host || !parsedUrl.protocol) {
- throw new SyntaxError("The URL '" + url + "' is invalid");
- } else if (parsedUrl.hash) {
- throw new SyntaxError('The URL must not contain a fragment');
- } else if (parsedUrl.protocol !== 'http:' && parsedUrl.protocol !== 'https:') {
- throw new SyntaxError("The URL's scheme must be either 'http:' or 'https:'. '" + parsedUrl.protocol + "' is not allowed.");
- }
-
- var secure = parsedUrl.protocol === 'https:';
- // Step 2 - don't allow secure origin with an insecure protocol
- if (loc.protocol === 'https:' && !secure) {
- // exception is 127.0.0.0/8 and ::1 urls
- if (!urlUtils.isLoopbackAddr(parsedUrl.hostname)) {
- throw new Error('SecurityError: An insecure SockJS connection may not be initiated from a page loaded over HTTPS');
- }
- }
-
- // Step 3 - check port access - no need here
- // Step 4 - parse protocols argument
- if (!protocols) {
- protocols = [];
- } else if (!Array.isArray(protocols)) {
- protocols = [protocols];
- }
-
- // Step 5 - check protocols argument
- var sortedProtocols = protocols.sort();
- sortedProtocols.forEach(function(proto, i) {
- if (!proto) {
- throw new SyntaxError("The protocols entry '" + proto + "' is invalid.");
- }
- if (i < (sortedProtocols.length - 1) && proto === sortedProtocols[i + 1]) {
- throw new SyntaxError("The protocols entry '" + proto + "' is duplicated.");
- }
- });
-
- // Step 6 - convert origin
- var o = urlUtils.getOrigin(loc.href);
- this._origin = o ? o.toLowerCase() : null;
-
- // remove the trailing slash
- parsedUrl.set('pathname', parsedUrl.pathname.replace(/\/+$/, ''));
-
- // store the sanitized url
- this.url = parsedUrl.href;
- debug('using url', this.url);
-
- // Step 7 - start connection in background
- // obtain server info
- // http://sockjs.github.io/sockjs-protocol/sockjs-protocol-0.3.3.html#section-26
- this._urlInfo = {
- nullOrigin: !browser.hasDomain()
- , sameOrigin: urlUtils.isOriginEqual(this.url, loc.href)
- , sameScheme: urlUtils.isSchemeEqual(this.url, loc.href)
- };
-
- this._ir = new InfoReceiver(this.url, this._urlInfo);
- this._ir.once('finish', this._receiveInfo.bind(this));
-}
-
-inherits(SockJS, EventTarget);
-
-function userSetCode(code) {
- return code === 1000 || (code >= 3000 && code <= 4999);
-}
-
-SockJS.prototype.close = function(code, reason) {
- // Step 1
- if (code && !userSetCode(code)) {
- throw new Error('InvalidAccessError: Invalid code');
- }
- // Step 2.4 states the max is 123 bytes, but we are just checking length
- if (reason && reason.length > 123) {
- throw new SyntaxError('reason argument has an invalid length');
- }
-
- // Step 3.1
- if (this.readyState === SockJS.CLOSING || this.readyState === SockJS.CLOSED) {
- return;
- }
-
- // TODO look at docs to determine how to set this
- var wasClean = true;
- this._close(code || 1000, reason || 'Normal closure', wasClean);
-};
-
-SockJS.prototype.send = function(data) {
- // #13 - convert anything non-string to string
- // TODO this currently turns objects into [object Object]
- if (typeof data !== 'string') {
- data = '' + data;
- }
- if (this.readyState === SockJS.CONNECTING) {
- throw new Error('InvalidStateError: The connection has not been established yet');
- }
- if (this.readyState !== SockJS.OPEN) {
- return;
- }
- this._transport.send(escape.quote(data));
-};
-
-SockJS.version = require('./version');
-
-SockJS.CONNECTING = 0;
-SockJS.OPEN = 1;
-SockJS.CLOSING = 2;
-SockJS.CLOSED = 3;
-
-SockJS.prototype._receiveInfo = function(info, rtt) {
- debug('_receiveInfo', rtt);
- this._ir = null;
- if (!info) {
- this._close(1002, 'Cannot connect to server');
- return;
- }
-
- // establish a round-trip timeout (RTO) based on the
- // round-trip time (RTT)
- this._rto = this.countRTO(rtt);
- // allow server to override url used for the actual transport
- this._transUrl = info.base_url ? info.base_url : this.url;
- info = objectUtils.extend(info, this._urlInfo);
- debug('info', info);
- // determine list of desired and supported transports
- var enabledTransports = transports.filterToEnabled(this._transportsWhitelist, info);
- this._transports = enabledTransports.main;
- debug(this._transports.length + ' enabled transports');
-
- this._connect();
-};
-
-SockJS.prototype._connect = function() {
- for (var Transport = this._transports.shift(); Transport; Transport = this._transports.shift()) {
- debug('attempt', Transport.transportName);
- if (Transport.needBody) {
- if (!global.document.body ||
- (typeof global.document.readyState !== 'undefined' &&
- global.document.readyState !== 'complete' &&
- global.document.readyState !== 'interactive')) {
- debug('waiting for body');
- this._transports.unshift(Transport);
- eventUtils.attachEvent('load', this._connect.bind(this));
- return;
- }
- }
-
- // calculate timeout based on RTO and round trips. Default to 5s
- var timeoutMs = Math.max(this._timeout, (this._rto * Transport.roundTrips) || 5000);
- this._transportTimeoutId = setTimeout(this._transportTimeout.bind(this), timeoutMs);
- debug('using timeout', timeoutMs);
-
- var transportUrl = urlUtils.addPath(this._transUrl, '/' + this._server + '/' + this._generateSessionId());
- var options = this._transportOptions[Transport.transportName];
- debug('transport url', transportUrl);
- var transportObj = new Transport(transportUrl, this._transUrl, options);
- transportObj.on('message', this._transportMessage.bind(this));
- transportObj.once('close', this._transportClose.bind(this));
- transportObj.transportName = Transport.transportName;
- this._transport = transportObj;
-
- return;
- }
- this._close(2000, 'All transports failed', false);
-};
-
-SockJS.prototype._transportTimeout = function() {
- debug('_transportTimeout');
- if (this.readyState === SockJS.CONNECTING) {
- if (this._transport) {
- this._transport.close();
- }
-
- this._transportClose(2007, 'Transport timed out');
- }
-};
-
-SockJS.prototype._transportMessage = function(msg) {
- debug('_transportMessage', msg);
- var self = this
- , type = msg.slice(0, 1)
- , content = msg.slice(1)
- , payload
- ;
-
- // first check for messages that don't need a payload
- switch (type) {
- case 'o':
- this._open();
- return;
- case 'h':
- this.dispatchEvent(new Event('heartbeat'));
- debug('heartbeat', this.transport);
- return;
- }
-
- if (content) {
- try {
- payload = JSON.parse(content);
- } catch (e) {
- debug('bad json', content);
- }
- }
-
- if (typeof payload === 'undefined') {
- debug('empty payload', content);
- return;
- }
-
- switch (type) {
- case 'a':
- if (Array.isArray(payload)) {
- payload.forEach(function(p) {
- debug('message', self.transport, p);
- self.dispatchEvent(new TransportMessageEvent(p));
- });
- }
- break;
- case 'm':
- debug('message', this.transport, payload);
- this.dispatchEvent(new TransportMessageEvent(payload));
- break;
- case 'c':
- if (Array.isArray(payload) && payload.length === 2) {
- this._close(payload[0], payload[1], true);
- }
- break;
- }
-};
-
-SockJS.prototype._transportClose = function(code, reason) {
- debug('_transportClose', this.transport, code, reason);
- if (this._transport) {
- this._transport.removeAllListeners();
- this._transport = null;
- this.transport = null;
- }
-
- if (!userSetCode(code) && code !== 2000 && this.readyState === SockJS.CONNECTING) {
- this._connect();
- return;
- }
-
- this._close(code, reason);
-};
-
-SockJS.prototype._open = function() {
- debug('_open', this._transport && this._transport.transportName, this.readyState);
- if (this.readyState === SockJS.CONNECTING) {
- if (this._transportTimeoutId) {
- clearTimeout(this._transportTimeoutId);
- this._transportTimeoutId = null;
- }
- this.readyState = SockJS.OPEN;
- this.transport = this._transport.transportName;
- this.dispatchEvent(new Event('open'));
- debug('connected', this.transport);
- } else {
- // The server might have been restarted, and lost track of our
- // connection.
- this._close(1006, 'Server lost session');
- }
-};
-
-SockJS.prototype._close = function(code, reason, wasClean) {
- debug('_close', this.transport, code, reason, wasClean, this.readyState);
- var forceFail = false;
-
- if (this._ir) {
- forceFail = true;
- this._ir.close();
- this._ir = null;
- }
- if (this._transport) {
- this._transport.close();
- this._transport = null;
- this.transport = null;
- }
-
- if (this.readyState === SockJS.CLOSED) {
- throw new Error('InvalidStateError: SockJS has already been closed');
- }
-
- this.readyState = SockJS.CLOSING;
- setTimeout(function() {
- this.readyState = SockJS.CLOSED;
-
- if (forceFail) {
- this.dispatchEvent(new Event('error'));
- }
-
- var e = new CloseEvent('close');
- e.wasClean = wasClean || false;
- e.code = code || 1000;
- e.reason = reason;
-
- this.dispatchEvent(e);
- this.onmessage = this.onclose = this.onerror = null;
- debug('disconnected');
- }.bind(this), 0);
-};
-
-// See: http://www.erg.abdn.ac.uk/~gerrit/dccp/notes/ccid2/rto_estimator/
-// and RFC 2988.
-SockJS.prototype.countRTO = function(rtt) {
- // In a local environment, when using IE8/9 and the `jsonp-polling`
- // transport the time needed to establish a connection (the time that pass
- // from the opening of the transport to the call of `_dispatchOpen`) is
- // around 200msec (the lower bound used in the article above) and this
- // causes spurious timeouts. For this reason we calculate a value slightly
- // larger than that used in the article.
- if (rtt > 100) {
- return 4 * rtt; // rto > 400msec
- }
- return 300 + rtt; // 300msec < rto <= 400msec
-};
-
-module.exports = function(availableTransports) {
- transports = transport(availableTransports);
- require('./iframe-bootstrap')(SockJS, availableTransports);
- return SockJS;
-};
-
-}).call(this)}).call(this,{ env: {} },typeof __webpack_require__.g !== "undefined" ? __webpack_require__.g : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-
-},{"./event/close":2,"./event/event":4,"./event/eventtarget":5,"./event/trans-message":6,"./iframe-bootstrap":8,"./info-receiver":12,"./location":13,"./shims":15,"./utils/browser":44,"./utils/escape":45,"./utils/event":46,"./utils/log":48,"./utils/object":49,"./utils/random":50,"./utils/transport":51,"./utils/url":52,"./version":53,"debug":55,"inherits":57,"url-parse":60}],15:[function(require,module,exports){
-/* eslint-disable */
-/* jscs: disable */
-'use strict';
-
-// pulled specific shims from https://github.com/es-shims/es5-shim
-
-var ArrayPrototype = Array.prototype;
-var ObjectPrototype = Object.prototype;
-var FunctionPrototype = Function.prototype;
-var StringPrototype = String.prototype;
-var array_slice = ArrayPrototype.slice;
-
-var _toString = ObjectPrototype.toString;
-var isFunction = function (val) {
- return ObjectPrototype.toString.call(val) === '[object Function]';
-};
-var isArray = function isArray(obj) {
- return _toString.call(obj) === '[object Array]';
-};
-var isString = function isString(obj) {
- return _toString.call(obj) === '[object String]';
-};
-
-var supportsDescriptors = Object.defineProperty && (function () {
- try {
- Object.defineProperty({}, 'x', {});
- return true;
- } catch (e) { /* this is ES3 */
- return false;
- }
-}());
-
-// Define configurable, writable and non-enumerable props
-// if they don't exist.
-var defineProperty;
-if (supportsDescriptors) {
- defineProperty = function (object, name, method, forceAssign) {
- if (!forceAssign && (name in object)) { return; }
- Object.defineProperty(object, name, {
- configurable: true,
- enumerable: false,
- writable: true,
- value: method
- });
- };
-} else {
- defineProperty = function (object, name, method, forceAssign) {
- if (!forceAssign && (name in object)) { return; }
- object[name] = method;
- };
-}
-var defineProperties = function (object, map, forceAssign) {
- for (var name in map) {
- if (ObjectPrototype.hasOwnProperty.call(map, name)) {
- defineProperty(object, name, map[name], forceAssign);
- }
- }
-};
-
-var toObject = function (o) {
- if (o == null) { // this matches both null and undefined
- throw new TypeError("can't convert " + o + ' to object');
- }
- return Object(o);
-};
-
-//
-// Util
-// ======
-//
-
-// ES5 9.4
-// http://es5.github.com/#x9.4
-// http://jsperf.com/to-integer
-
-function toInteger(num) {
- var n = +num;
- if (n !== n) { // isNaN
- n = 0;
- } else if (n !== 0 && n !== (1 / 0) && n !== -(1 / 0)) {
- n = (n > 0 || -1) * Math.floor(Math.abs(n));
- }
- return n;
-}
-
-function ToUint32(x) {
- return x >>> 0;
-}
-
-//
-// Function
-// ========
-//
-
-// ES-5 15.3.4.5
-// http://es5.github.com/#x15.3.4.5
-
-function Empty() {}
-
-defineProperties(FunctionPrototype, {
- bind: function bind(that) { // .length is 1
- // 1. Let Target be the this value.
- var target = this;
- // 2. If IsCallable(Target) is false, throw a TypeError exception.
- if (!isFunction(target)) {
- throw new TypeError('Function.prototype.bind called on incompatible ' + target);
- }
- // 3. Let A be a new (possibly empty) internal list of all of the
- // argument values provided after thisArg (arg1, arg2 etc), in order.
- // XXX slicedArgs will stand in for "A" if used
- var args = array_slice.call(arguments, 1); // for normal call
- // 4. Let F be a new native ECMAScript object.
- // 11. Set the [[Prototype]] internal property of F to the standard
- // built-in Function prototype object as specified in 15.3.3.1.
- // 12. Set the [[Call]] internal property of F as described in
- // 15.3.4.5.1.
- // 13. Set the [[Construct]] internal property of F as described in
- // 15.3.4.5.2.
- // 14. Set the [[HasInstance]] internal property of F as described in
- // 15.3.4.5.3.
- var binder = function () {
-
- if (this instanceof bound) {
- // 15.3.4.5.2 [[Construct]]
- // When the [[Construct]] internal method of a function object,
- // F that was created using the bind function is called with a
- // list of arguments ExtraArgs, the following steps are taken:
- // 1. Let target be the value of F's [[TargetFunction]]
- // internal property.
- // 2. If target has no [[Construct]] internal method, a
- // TypeError exception is thrown.
- // 3. Let boundArgs be the value of F's [[BoundArgs]] internal
- // property.
- // 4. Let args be a new list containing the same values as the
- // list boundArgs in the same order followed by the same
- // values as the list ExtraArgs in the same order.
- // 5. Return the result of calling the [[Construct]] internal
- // method of target providing args as the arguments.
-
- var result = target.apply(
- this,
- args.concat(array_slice.call(arguments))
- );
- if (Object(result) === result) {
- return result;
- }
- return this;
-
- } else {
- // 15.3.4.5.1 [[Call]]
- // When the [[Call]] internal method of a function object, F,
- // which was created using the bind function is called with a
- // this value and a list of arguments ExtraArgs, the following
- // steps are taken:
- // 1. Let boundArgs be the value of F's [[BoundArgs]] internal
- // property.
- // 2. Let boundThis be the value of F's [[BoundThis]] internal
- // property.
- // 3. Let target be the value of F's [[TargetFunction]] internal
- // property.
- // 4. Let args be a new list containing the same values as the
- // list boundArgs in the same order followed by the same
- // values as the list ExtraArgs in the same order.
- // 5. Return the result of calling the [[Call]] internal method
- // of target providing boundThis as the this value and
- // providing args as the arguments.
-
- // equiv: target.call(this, ...boundArgs, ...args)
- return target.apply(
- that,
- args.concat(array_slice.call(arguments))
- );
-
- }
-
- };
-
- // 15. If the [[Class]] internal property of Target is "Function", then
- // a. Let L be the length property of Target minus the length of A.
- // b. Set the length own property of F to either 0 or L, whichever is
- // larger.
- // 16. Else set the length own property of F to 0.
-
- var boundLength = Math.max(0, target.length - args.length);
-
- // 17. Set the attributes of the length own property of F to the values
- // specified in 15.3.5.1.
- var boundArgs = [];
- for (var i = 0; i < boundLength; i++) {
- boundArgs.push('$' + i);
- }
-
- // XXX Build a dynamic function with desired amount of arguments is the only
- // way to set the length property of a function.
- // In environments where Content Security Policies enabled (Chrome extensions,
- // for ex.) all use of eval or Function costructor throws an exception.
- // However in all of these environments Function.prototype.bind exists
- // and so this code will never be executed.
- var bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this, arguments); }')(binder);
-
- if (target.prototype) {
- Empty.prototype = target.prototype;
- bound.prototype = new Empty();
- // Clean up dangling references.
- Empty.prototype = null;
- }
-
- // TODO
- // 18. Set the [[Extensible]] internal property of F to true.
-
- // TODO
- // 19. Let thrower be the [[ThrowTypeError]] function Object (13.2.3).
- // 20. Call the [[DefineOwnProperty]] internal method of F with
- // arguments "caller", PropertyDescriptor {[[Get]]: thrower, [[Set]]:
- // thrower, [[Enumerable]]: false, [[Configurable]]: false}, and
- // false.
- // 21. Call the [[DefineOwnProperty]] internal method of F with
- // arguments "arguments", PropertyDescriptor {[[Get]]: thrower,
- // [[Set]]: thrower, [[Enumerable]]: false, [[Configurable]]: false},
- // and false.
-
- // TODO
- // NOTE Function objects created using Function.prototype.bind do not
- // have a prototype property or the [[Code]], [[FormalParameters]], and
- // [[Scope]] internal properties.
- // XXX can't delete prototype in pure-js.
-
- // 22. Return F.
- return bound;
- }
-});
-
-//
-// Array
-// =====
-//
-
-// ES5 15.4.3.2
-// http://es5.github.com/#x15.4.3.2
-// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/isArray
-defineProperties(Array, { isArray: isArray });
-
-
-var boxedString = Object('a');
-var splitString = boxedString[0] !== 'a' || !(0 in boxedString);
-
-var properlyBoxesContext = function properlyBoxed(method) {
- // Check node 0.6.21 bug where third parameter is not boxed
- var properlyBoxesNonStrict = true;
- var properlyBoxesStrict = true;
- if (method) {
- method.call('foo', function (_, __, context) {
- if (typeof context !== 'object') { properlyBoxesNonStrict = false; }
- });
-
- method.call([1], function () {
- 'use strict';
- properlyBoxesStrict = typeof this === 'string';
- }, 'x');
- }
- return !!method && properlyBoxesNonStrict && properlyBoxesStrict;
-};
-
-defineProperties(ArrayPrototype, {
- forEach: function forEach(fun /*, thisp*/) {
- var object = toObject(this),
- self = splitString && isString(this) ? this.split('') : object,
- thisp = arguments[1],
- i = -1,
- length = self.length >>> 0;
-
- // If no callback function or if callback is not a callable function
- if (!isFunction(fun)) {
- throw new TypeError(); // TODO message
- }
-
- while (++i < length) {
- if (i in self) {
- // Invoke the callback function with call, passing arguments:
- // context, property value, property key, thisArg object
- // context
- fun.call(thisp, self[i], i, object);
- }
- }
- }
-}, !properlyBoxesContext(ArrayPrototype.forEach));
-
-// ES5 15.4.4.14
-// http://es5.github.com/#x15.4.4.14
-// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/indexOf
-var hasFirefox2IndexOfBug = Array.prototype.indexOf && [0, 1].indexOf(1, 2) !== -1;
-defineProperties(ArrayPrototype, {
- indexOf: function indexOf(sought /*, fromIndex */ ) {
- var self = splitString && isString(this) ? this.split('') : toObject(this),
- length = self.length >>> 0;
-
- if (!length) {
- return -1;
- }
-
- var i = 0;
- if (arguments.length > 1) {
- i = toInteger(arguments[1]);
- }
-
- // handle negative indices
- i = i >= 0 ? i : Math.max(0, length + i);
- for (; i < length; i++) {
- if (i in self && self[i] === sought) {
- return i;
- }
- }
- return -1;
- }
-}, hasFirefox2IndexOfBug);
-
-//
-// String
-// ======
-//
-
-// ES5 15.5.4.14
-// http://es5.github.com/#x15.5.4.14
-
-// [bugfix, IE lt 9, firefox 4, Konqueror, Opera, obscure browsers]
-// Many browsers do not split properly with regular expressions or they
-// do not perform the split correctly under obscure conditions.
-// See http://blog.stevenlevithan.com/archives/cross-browser-split
-// I've tested in many browsers and this seems to cover the deviant ones:
-// 'ab'.split(/(?:ab)*/) should be ["", ""], not [""]
-// '.'.split(/(.?)(.?)/) should be ["", ".", "", ""], not ["", ""]
-// 'tesst'.split(/(s)*/) should be ["t", undefined, "e", "s", "t"], not
-// [undefined, "t", undefined, "e", ...]
-// ''.split(/.?/) should be [], not [""]
-// '.'.split(/()()/) should be ["."], not ["", "", "."]
-
-var string_split = StringPrototype.split;
-if (
- 'ab'.split(/(?:ab)*/).length !== 2 ||
- '.'.split(/(.?)(.?)/).length !== 4 ||
- 'tesst'.split(/(s)*/)[1] === 't' ||
- 'test'.split(/(?:)/, -1).length !== 4 ||
- ''.split(/.?/).length ||
- '.'.split(/()()/).length > 1
-) {
- (function () {
- var compliantExecNpcg = /()??/.exec('')[1] === void 0; // NPCG: nonparticipating capturing group
-
- StringPrototype.split = function (separator, limit) {
- var string = this;
- if (separator === void 0 && limit === 0) {
- return [];
- }
-
- // If `separator` is not a regex, use native split
- if (_toString.call(separator) !== '[object RegExp]') {
- return string_split.call(this, separator, limit);
- }
-
- var output = [],
- flags = (separator.ignoreCase ? 'i' : '') +
- (separator.multiline ? 'm' : '') +
- (separator.extended ? 'x' : '') + // Proposed for ES6
- (separator.sticky ? 'y' : ''), // Firefox 3+
- lastLastIndex = 0,
- // Make `global` and avoid `lastIndex` issues by working with a copy
- separator2, match, lastIndex, lastLength;
- separator = new RegExp(separator.source, flags + 'g');
- string += ''; // Type-convert
- if (!compliantExecNpcg) {
- // Doesn't need flags gy, but they don't hurt
- separator2 = new RegExp('^' + separator.source + '$(?!\\s)', flags);
- }
- /* Values for `limit`, per the spec:
- * If undefined: 4294967295 // Math.pow(2, 32) - 1
- * If 0, Infinity, or NaN: 0
- * If positive number: limit = Math.floor(limit); if (limit > 4294967295) limit -= 4294967296;
- * If negative number: 4294967296 - Math.floor(Math.abs(limit))
- * If other: Type-convert, then use the above rules
- */
- limit = limit === void 0 ?
- -1 >>> 0 : // Math.pow(2, 32) - 1
- ToUint32(limit);
- while (match = separator.exec(string)) {
- // `separator.lastIndex` is not reliable cross-browser
- lastIndex = match.index + match[0].length;
- if (lastIndex > lastLastIndex) {
- output.push(string.slice(lastLastIndex, match.index));
- // Fix browsers whose `exec` methods don't consistently return `undefined` for
- // nonparticipating capturing groups
- if (!compliantExecNpcg && match.length > 1) {
- match[0].replace(separator2, function () {
- for (var i = 1; i < arguments.length - 2; i++) {
- if (arguments[i] === void 0) {
- match[i] = void 0;
- }
- }
- });
- }
- if (match.length > 1 && match.index < string.length) {
- ArrayPrototype.push.apply(output, match.slice(1));
- }
- lastLength = match[0].length;
- lastLastIndex = lastIndex;
- if (output.length >= limit) {
- break;
- }
- }
- if (separator.lastIndex === match.index) {
- separator.lastIndex++; // Avoid an infinite loop
- }
- }
- if (lastLastIndex === string.length) {
- if (lastLength || !separator.test('')) {
- output.push('');
- }
- } else {
- output.push(string.slice(lastLastIndex));
- }
- return output.length > limit ? output.slice(0, limit) : output;
- };
- }());
-
-// [bugfix, chrome]
-// If separator is undefined, then the result array contains just one String,
-// which is the this value (converted to a String). If limit is not undefined,
-// then the output array is truncated so that it contains no more than limit
-// elements.
-// "0".split(undefined, 0) -> []
-} else if ('0'.split(void 0, 0).length) {
- StringPrototype.split = function split(separator, limit) {
- if (separator === void 0 && limit === 0) { return []; }
- return string_split.call(this, separator, limit);
- };
-}
-
-// ECMA-262, 3rd B.2.3
-// Not an ECMAScript standard, although ECMAScript 3rd Edition has a
-// non-normative section suggesting uniform semantics and it should be
-// normalized across all browsers
-// [bugfix, IE lt 9] IE < 9 substr() with negative value not working in IE
-var string_substr = StringPrototype.substr;
-var hasNegativeSubstrBug = ''.substr && '0b'.substr(-1) !== 'b';
-defineProperties(StringPrototype, {
- substr: function substr(start, length) {
- return string_substr.call(
- this,
- start < 0 ? ((start = this.length + start) < 0 ? 0 : start) : start,
- length
- );
- }
-}, hasNegativeSubstrBug);
-
-},{}],16:[function(require,module,exports){
-'use strict';
-
-module.exports = [
- // streaming transports
- require('./transport/websocket')
-, require('./transport/xhr-streaming')
-, require('./transport/xdr-streaming')
-, require('./transport/eventsource')
-, require('./transport/lib/iframe-wrap')(require('./transport/eventsource'))
-
- // polling transports
-, require('./transport/htmlfile')
-, require('./transport/lib/iframe-wrap')(require('./transport/htmlfile'))
-, require('./transport/xhr-polling')
-, require('./transport/xdr-polling')
-, require('./transport/lib/iframe-wrap')(require('./transport/xhr-polling'))
-, require('./transport/jsonp-polling')
-];
-
-},{"./transport/eventsource":20,"./transport/htmlfile":21,"./transport/jsonp-polling":23,"./transport/lib/iframe-wrap":26,"./transport/websocket":38,"./transport/xdr-polling":39,"./transport/xdr-streaming":40,"./transport/xhr-polling":41,"./transport/xhr-streaming":42}],17:[function(require,module,exports){
-(function (process,global){(function (){
-'use strict';
-
-var EventEmitter = require('events').EventEmitter
- , inherits = require('inherits')
- , utils = require('../../utils/event')
- , urlUtils = require('../../utils/url')
- , XHR = global.XMLHttpRequest
- ;
-
-var debug = function() {};
-if (process.env.NODE_ENV !== 'production') {
- debug = require('debug')('sockjs-client:browser:xhr');
-}
-
-function AbstractXHRObject(method, url, payload, opts) {
- debug(method, url);
- var self = this;
- EventEmitter.call(this);
-
- setTimeout(function () {
- self._start(method, url, payload, opts);
- }, 0);
-}
-
-inherits(AbstractXHRObject, EventEmitter);
-
-AbstractXHRObject.prototype._start = function(method, url, payload, opts) {
- var self = this;
-
- try {
- this.xhr = new XHR();
- } catch (x) {
- // intentionally empty
- }
-
- if (!this.xhr) {
- debug('no xhr');
- this.emit('finish', 0, 'no xhr support');
- this._cleanup();
- return;
- }
-
- // several browsers cache POSTs
- url = urlUtils.addQuery(url, 't=' + (+new Date()));
-
- // Explorer tends to keep connection open, even after the
- // tab gets closed: http://bugs.jquery.com/ticket/5280
- this.unloadRef = utils.unloadAdd(function() {
- debug('unload cleanup');
- self._cleanup(true);
- });
- try {
- this.xhr.open(method, url, true);
- if (this.timeout && 'timeout' in this.xhr) {
- this.xhr.timeout = this.timeout;
- this.xhr.ontimeout = function() {
- debug('xhr timeout');
- self.emit('finish', 0, '');
- self._cleanup(false);
- };
- }
- } catch (e) {
- debug('exception', e);
- // IE raises an exception on wrong port.
- this.emit('finish', 0, '');
- this._cleanup(false);
- return;
- }
-
- if ((!opts || !opts.noCredentials) && AbstractXHRObject.supportsCORS) {
- debug('withCredentials');
- // Mozilla docs says https://developer.mozilla.org/en/XMLHttpRequest :
- // "This never affects same-site requests."
-
- this.xhr.withCredentials = true;
- }
- if (opts && opts.headers) {
- for (var key in opts.headers) {
- this.xhr.setRequestHeader(key, opts.headers[key]);
- }
- }
-
- this.xhr.onreadystatechange = function() {
- if (self.xhr) {
- var x = self.xhr;
- var text, status;
- debug('readyState', x.readyState);
- switch (x.readyState) {
- case 3:
- // IE doesn't like peeking into responseText or status
- // on Microsoft.XMLHTTP and readystate=3
- try {
- status = x.status;
- text = x.responseText;
- } catch (e) {
- // intentionally empty
- }
- debug('status', status);
- // IE returns 1223 for 204: http://bugs.jquery.com/ticket/1450
- if (status === 1223) {
- status = 204;
- }
-
- // IE does return readystate == 3 for 404 answers.
- if (status === 200 && text && text.length > 0) {
- debug('chunk');
- self.emit('chunk', status, text);
- }
- break;
- case 4:
- status = x.status;
- debug('status', status);
- // IE returns 1223 for 204: http://bugs.jquery.com/ticket/1450
- if (status === 1223) {
- status = 204;
- }
- // IE returns this for a bad port
- // http://msdn.microsoft.com/en-us/library/windows/desktop/aa383770(v=vs.85).aspx
- if (status === 12005 || status === 12029) {
- status = 0;
- }
-
- debug('finish', status, x.responseText);
- self.emit('finish', status, x.responseText);
- self._cleanup(false);
- break;
- }
- }
- };
-
- try {
- self.xhr.send(payload);
- } catch (e) {
- self.emit('finish', 0, '');
- self._cleanup(false);
- }
-};
-
-AbstractXHRObject.prototype._cleanup = function(abort) {
- debug('cleanup');
- if (!this.xhr) {
- return;
- }
- this.removeAllListeners();
- utils.unloadDel(this.unloadRef);
-
- // IE needs this field to be a function
- this.xhr.onreadystatechange = function() {};
- if (this.xhr.ontimeout) {
- this.xhr.ontimeout = null;
- }
-
- if (abort) {
- try {
- this.xhr.abort();
- } catch (x) {
- // intentionally empty
- }
- }
- this.unloadRef = this.xhr = null;
-};
-
-AbstractXHRObject.prototype.close = function() {
- debug('close');
- this._cleanup(true);
-};
-
-AbstractXHRObject.enabled = !!XHR;
-// override XMLHttpRequest for IE6/7
-// obfuscate to avoid firewalls
-var axo = ['Active'].concat('Object').join('X');
-if (!AbstractXHRObject.enabled && (axo in global)) {
- debug('overriding xmlhttprequest');
- XHR = function() {
- try {
- return new global[axo]('Microsoft.XMLHTTP');
- } catch (e) {
- return null;
- }
- };
- AbstractXHRObject.enabled = !!new XHR();
-}
-
-var cors = false;
-try {
- cors = 'withCredentials' in new XHR();
-} catch (ignored) {
- // intentionally empty
-}
-
-AbstractXHRObject.supportsCORS = cors;
-
-module.exports = AbstractXHRObject;
-
-}).call(this)}).call(this,{ env: {} },typeof __webpack_require__.g !== "undefined" ? __webpack_require__.g : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-
-},{"../../utils/event":46,"../../utils/url":52,"debug":55,"events":3,"inherits":57}],18:[function(require,module,exports){
-(function (global){(function (){
-module.exports = global.EventSource;
-
-}).call(this)}).call(this,typeof __webpack_require__.g !== "undefined" ? __webpack_require__.g : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-
-},{}],19:[function(require,module,exports){
-(function (global){(function (){
-'use strict';
-
-var Driver = global.WebSocket || global.MozWebSocket;
-if (Driver) {
- module.exports = function WebSocketBrowserDriver(url) {
- return new Driver(url);
- };
-} else {
- module.exports = undefined;
-}
-
-}).call(this)}).call(this,typeof __webpack_require__.g !== "undefined" ? __webpack_require__.g : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-
-},{}],20:[function(require,module,exports){
-'use strict';
-
-var inherits = require('inherits')
- , AjaxBasedTransport = require('./lib/ajax-based')
- , EventSourceReceiver = require('./receiver/eventsource')
- , XHRCorsObject = require('./sender/xhr-cors')
- , EventSourceDriver = require('eventsource')
- ;
-
-function EventSourceTransport(transUrl) {
- if (!EventSourceTransport.enabled()) {
- throw new Error('Transport created when disabled');
- }
-
- AjaxBasedTransport.call(this, transUrl, '/eventsource', EventSourceReceiver, XHRCorsObject);
-}
-
-inherits(EventSourceTransport, AjaxBasedTransport);
-
-EventSourceTransport.enabled = function() {
- return !!EventSourceDriver;
-};
-
-EventSourceTransport.transportName = 'eventsource';
-EventSourceTransport.roundTrips = 2;
-
-module.exports = EventSourceTransport;
-
-},{"./lib/ajax-based":24,"./receiver/eventsource":29,"./sender/xhr-cors":35,"eventsource":18,"inherits":57}],21:[function(require,module,exports){
-'use strict';
-
-var inherits = require('inherits')
- , HtmlfileReceiver = require('./receiver/htmlfile')
- , XHRLocalObject = require('./sender/xhr-local')
- , AjaxBasedTransport = require('./lib/ajax-based')
- ;
-
-function HtmlFileTransport(transUrl) {
- if (!HtmlfileReceiver.enabled) {
- throw new Error('Transport created when disabled');
- }
- AjaxBasedTransport.call(this, transUrl, '/htmlfile', HtmlfileReceiver, XHRLocalObject);
-}
-
-inherits(HtmlFileTransport, AjaxBasedTransport);
-
-HtmlFileTransport.enabled = function(info) {
- return HtmlfileReceiver.enabled && info.sameOrigin;
-};
-
-HtmlFileTransport.transportName = 'htmlfile';
-HtmlFileTransport.roundTrips = 2;
-
-module.exports = HtmlFileTransport;
-
-},{"./lib/ajax-based":24,"./receiver/htmlfile":30,"./sender/xhr-local":37,"inherits":57}],22:[function(require,module,exports){
-(function (process){(function (){
-'use strict';
-
-// Few cool transports do work only for same-origin. In order to make
-// them work cross-domain we shall use iframe, served from the
-// remote domain. New browsers have capabilities to communicate with
-// cross domain iframe using postMessage(). In IE it was implemented
-// from IE 8+, but of course, IE got some details wrong:
-// http://msdn.microsoft.com/en-us/library/cc197015(v=VS.85).aspx
-// http://stevesouders.com/misc/test-postmessage.php
-
-var inherits = require('inherits')
- , EventEmitter = require('events').EventEmitter
- , version = require('../version')
- , urlUtils = require('../utils/url')
- , iframeUtils = require('../utils/iframe')
- , eventUtils = require('../utils/event')
- , random = require('../utils/random')
- ;
-
-var debug = function() {};
-if (process.env.NODE_ENV !== 'production') {
- debug = require('debug')('sockjs-client:transport:iframe');
-}
-
-function IframeTransport(transport, transUrl, baseUrl) {
- if (!IframeTransport.enabled()) {
- throw new Error('Transport created when disabled');
- }
- EventEmitter.call(this);
-
- var self = this;
- this.origin = urlUtils.getOrigin(baseUrl);
- this.baseUrl = baseUrl;
- this.transUrl = transUrl;
- this.transport = transport;
- this.windowId = random.string(8);
-
- var iframeUrl = urlUtils.addPath(baseUrl, '/iframe.html') + '#' + this.windowId;
- debug(transport, transUrl, iframeUrl);
-
- this.iframeObj = iframeUtils.createIframe(iframeUrl, function(r) {
- debug('err callback');
- self.emit('close', 1006, 'Unable to load an iframe (' + r + ')');
- self.close();
- });
-
- this.onmessageCallback = this._message.bind(this);
- eventUtils.attachEvent('message', this.onmessageCallback);
-}
-
-inherits(IframeTransport, EventEmitter);
-
-IframeTransport.prototype.close = function() {
- debug('close');
- this.removeAllListeners();
- if (this.iframeObj) {
- eventUtils.detachEvent('message', this.onmessageCallback);
- try {
- // When the iframe is not loaded, IE raises an exception
- // on 'contentWindow'.
- this.postMessage('c');
- } catch (x) {
- // intentionally empty
- }
- this.iframeObj.cleanup();
- this.iframeObj = null;
- this.onmessageCallback = this.iframeObj = null;
- }
-};
-
-IframeTransport.prototype._message = function(e) {
- debug('message', e.data);
- if (!urlUtils.isOriginEqual(e.origin, this.origin)) {
- debug('not same origin', e.origin, this.origin);
- return;
- }
-
- var iframeMessage;
- try {
- iframeMessage = JSON.parse(e.data);
- } catch (ignored) {
- debug('bad json', e.data);
- return;
- }
-
- if (iframeMessage.windowId !== this.windowId) {
- debug('mismatched window id', iframeMessage.windowId, this.windowId);
- return;
- }
-
- switch (iframeMessage.type) {
- case 's':
- this.iframeObj.loaded();
- // window global dependency
- this.postMessage('s', JSON.stringify([
- version
- , this.transport
- , this.transUrl
- , this.baseUrl
- ]));
- break;
- case 't':
- this.emit('message', iframeMessage.data);
- break;
- case 'c':
- var cdata;
- try {
- cdata = JSON.parse(iframeMessage.data);
- } catch (ignored) {
- debug('bad json', iframeMessage.data);
- return;
- }
- this.emit('close', cdata[0], cdata[1]);
- this.close();
- break;
- }
-};
-
-IframeTransport.prototype.postMessage = function(type, data) {
- debug('postMessage', type, data);
- this.iframeObj.post(JSON.stringify({
- windowId: this.windowId
- , type: type
- , data: data || ''
- }), this.origin);
-};
-
-IframeTransport.prototype.send = function(message) {
- debug('send', message);
- this.postMessage('m', message);
-};
-
-IframeTransport.enabled = function() {
- return iframeUtils.iframeEnabled;
-};
-
-IframeTransport.transportName = 'iframe';
-IframeTransport.roundTrips = 2;
-
-module.exports = IframeTransport;
-
-}).call(this)}).call(this,{ env: {} })
-
-},{"../utils/event":46,"../utils/iframe":47,"../utils/random":50,"../utils/url":52,"../version":53,"debug":55,"events":3,"inherits":57}],23:[function(require,module,exports){
-(function (global){(function (){
-'use strict';
-
-// The simplest and most robust transport, using the well-know cross
-// domain hack - JSONP. This transport is quite inefficient - one
-// message could use up to one http request. But at least it works almost
-// everywhere.
-// Known limitations:
-// o you will get a spinning cursor
-// o for Konqueror a dumb timer is needed to detect errors
-
-var inherits = require('inherits')
- , SenderReceiver = require('./lib/sender-receiver')
- , JsonpReceiver = require('./receiver/jsonp')
- , jsonpSender = require('./sender/jsonp')
- ;
-
-function JsonPTransport(transUrl) {
- if (!JsonPTransport.enabled()) {
- throw new Error('Transport created when disabled');
- }
- SenderReceiver.call(this, transUrl, '/jsonp', jsonpSender, JsonpReceiver);
-}
-
-inherits(JsonPTransport, SenderReceiver);
-
-JsonPTransport.enabled = function() {
- return !!global.document;
-};
-
-JsonPTransport.transportName = 'jsonp-polling';
-JsonPTransport.roundTrips = 1;
-JsonPTransport.needBody = true;
-
-module.exports = JsonPTransport;
-
-}).call(this)}).call(this,typeof __webpack_require__.g !== "undefined" ? __webpack_require__.g : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-
-},{"./lib/sender-receiver":28,"./receiver/jsonp":31,"./sender/jsonp":33,"inherits":57}],24:[function(require,module,exports){
-(function (process){(function (){
-'use strict';
-
-var inherits = require('inherits')
- , urlUtils = require('../../utils/url')
- , SenderReceiver = require('./sender-receiver')
- ;
-
-var debug = function() {};
-if (process.env.NODE_ENV !== 'production') {
- debug = require('debug')('sockjs-client:ajax-based');
-}
-
-function createAjaxSender(AjaxObject) {
- return function(url, payload, callback) {
- debug('create ajax sender', url, payload);
- var opt = {};
- if (typeof payload === 'string') {
- opt.headers = {'Content-type': 'text/plain'};
- }
- var ajaxUrl = urlUtils.addPath(url, '/xhr_send');
- var xo = new AjaxObject('POST', ajaxUrl, payload, opt);
- xo.once('finish', function(status) {
- debug('finish', status);
- xo = null;
-
- if (status !== 200 && status !== 204) {
- return callback(new Error('http status ' + status));
- }
- callback();
- });
- return function() {
- debug('abort');
- xo.close();
- xo = null;
-
- var err = new Error('Aborted');
- err.code = 1000;
- callback(err);
- };
- };
-}
-
-function AjaxBasedTransport(transUrl, urlSuffix, Receiver, AjaxObject) {
- SenderReceiver.call(this, transUrl, urlSuffix, createAjaxSender(AjaxObject), Receiver, AjaxObject);
-}
-
-inherits(AjaxBasedTransport, SenderReceiver);
-
-module.exports = AjaxBasedTransport;
-
-}).call(this)}).call(this,{ env: {} })
-
-},{"../../utils/url":52,"./sender-receiver":28,"debug":55,"inherits":57}],25:[function(require,module,exports){
-(function (process){(function (){
-'use strict';
-
-var inherits = require('inherits')
- , EventEmitter = require('events').EventEmitter
- ;
-
-var debug = function() {};
-if (process.env.NODE_ENV !== 'production') {
- debug = require('debug')('sockjs-client:buffered-sender');
-}
-
-function BufferedSender(url, sender) {
- debug(url);
- EventEmitter.call(this);
- this.sendBuffer = [];
- this.sender = sender;
- this.url = url;
-}
-
-inherits(BufferedSender, EventEmitter);
-
-BufferedSender.prototype.send = function(message) {
- debug('send', message);
- this.sendBuffer.push(message);
- if (!this.sendStop) {
- this.sendSchedule();
- }
-};
-
-// For polling transports in a situation when in the message callback,
-// new message is being send. If the sending connection was started
-// before receiving one, it is possible to saturate the network and
-// timeout due to the lack of receiving socket. To avoid that we delay
-// sending messages by some small time, in order to let receiving
-// connection be started beforehand. This is only a halfmeasure and
-// does not fix the big problem, but it does make the tests go more
-// stable on slow networks.
-BufferedSender.prototype.sendScheduleWait = function() {
- debug('sendScheduleWait');
- var self = this;
- var tref;
- this.sendStop = function() {
- debug('sendStop');
- self.sendStop = null;
- clearTimeout(tref);
- };
- tref = setTimeout(function() {
- debug('timeout');
- self.sendStop = null;
- self.sendSchedule();
- }, 25);
-};
-
-BufferedSender.prototype.sendSchedule = function() {
- debug('sendSchedule', this.sendBuffer.length);
- var self = this;
- if (this.sendBuffer.length > 0) {
- var payload = '[' + this.sendBuffer.join(',') + ']';
- this.sendStop = this.sender(this.url, payload, function(err) {
- self.sendStop = null;
- if (err) {
- debug('error', err);
- self.emit('close', err.code || 1006, 'Sending error: ' + err);
- self.close();
- } else {
- self.sendScheduleWait();
- }
- });
- this.sendBuffer = [];
- }
-};
-
-BufferedSender.prototype._cleanup = function() {
- debug('_cleanup');
- this.removeAllListeners();
-};
-
-BufferedSender.prototype.close = function() {
- debug('close');
- this._cleanup();
- if (this.sendStop) {
- this.sendStop();
- this.sendStop = null;
- }
-};
-
-module.exports = BufferedSender;
-
-}).call(this)}).call(this,{ env: {} })
-
-},{"debug":55,"events":3,"inherits":57}],26:[function(require,module,exports){
-(function (global){(function (){
-'use strict';
-
-var inherits = require('inherits')
- , IframeTransport = require('../iframe')
- , objectUtils = require('../../utils/object')
- ;
-
-module.exports = function(transport) {
-
- function IframeWrapTransport(transUrl, baseUrl) {
- IframeTransport.call(this, transport.transportName, transUrl, baseUrl);
- }
-
- inherits(IframeWrapTransport, IframeTransport);
-
- IframeWrapTransport.enabled = function(url, info) {
- if (!global.document) {
- return false;
- }
-
- var iframeInfo = objectUtils.extend({}, info);
- iframeInfo.sameOrigin = true;
- return transport.enabled(iframeInfo) && IframeTransport.enabled();
- };
-
- IframeWrapTransport.transportName = 'iframe-' + transport.transportName;
- IframeWrapTransport.needBody = true;
- IframeWrapTransport.roundTrips = IframeTransport.roundTrips + transport.roundTrips - 1; // html, javascript (2) + transport - no CORS (1)
-
- IframeWrapTransport.facadeTransport = transport;
-
- return IframeWrapTransport;
-};
-
-}).call(this)}).call(this,typeof __webpack_require__.g !== "undefined" ? __webpack_require__.g : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-
-},{"../../utils/object":49,"../iframe":22,"inherits":57}],27:[function(require,module,exports){
-(function (process){(function (){
-'use strict';
-
-var inherits = require('inherits')
- , EventEmitter = require('events').EventEmitter
- ;
-
-var debug = function() {};
-if (process.env.NODE_ENV !== 'production') {
- debug = require('debug')('sockjs-client:polling');
-}
-
-function Polling(Receiver, receiveUrl, AjaxObject) {
- debug(receiveUrl);
- EventEmitter.call(this);
- this.Receiver = Receiver;
- this.receiveUrl = receiveUrl;
- this.AjaxObject = AjaxObject;
- this._scheduleReceiver();
-}
-
-inherits(Polling, EventEmitter);
-
-Polling.prototype._scheduleReceiver = function() {
- debug('_scheduleReceiver');
- var self = this;
- var poll = this.poll = new this.Receiver(this.receiveUrl, this.AjaxObject);
-
- poll.on('message', function(msg) {
- debug('message', msg);
- self.emit('message', msg);
- });
-
- poll.once('close', function(code, reason) {
- debug('close', code, reason, self.pollIsClosing);
- self.poll = poll = null;
-
- if (!self.pollIsClosing) {
- if (reason === 'network') {
- self._scheduleReceiver();
- } else {
- self.emit('close', code || 1006, reason);
- self.removeAllListeners();
- }
- }
- });
-};
-
-Polling.prototype.abort = function() {
- debug('abort');
- this.removeAllListeners();
- this.pollIsClosing = true;
- if (this.poll) {
- this.poll.abort();
- }
-};
-
-module.exports = Polling;
-
-}).call(this)}).call(this,{ env: {} })
-
-},{"debug":55,"events":3,"inherits":57}],28:[function(require,module,exports){
-(function (process){(function (){
-'use strict';
-
-var inherits = require('inherits')
- , urlUtils = require('../../utils/url')
- , BufferedSender = require('./buffered-sender')
- , Polling = require('./polling')
- ;
-
-var debug = function() {};
-if (process.env.NODE_ENV !== 'production') {
- debug = require('debug')('sockjs-client:sender-receiver');
-}
-
-function SenderReceiver(transUrl, urlSuffix, senderFunc, Receiver, AjaxObject) {
- var pollUrl = urlUtils.addPath(transUrl, urlSuffix);
- debug(pollUrl);
- var self = this;
- BufferedSender.call(this, transUrl, senderFunc);
-
- this.poll = new Polling(Receiver, pollUrl, AjaxObject);
- this.poll.on('message', function(msg) {
- debug('poll message', msg);
- self.emit('message', msg);
- });
- this.poll.once('close', function(code, reason) {
- debug('poll close', code, reason);
- self.poll = null;
- self.emit('close', code, reason);
- self.close();
- });
-}
-
-inherits(SenderReceiver, BufferedSender);
-
-SenderReceiver.prototype.close = function() {
- BufferedSender.prototype.close.call(this);
- debug('close');
- this.removeAllListeners();
- if (this.poll) {
- this.poll.abort();
- this.poll = null;
- }
-};
-
-module.exports = SenderReceiver;
-
-}).call(this)}).call(this,{ env: {} })
-
-},{"../../utils/url":52,"./buffered-sender":25,"./polling":27,"debug":55,"inherits":57}],29:[function(require,module,exports){
-(function (process){(function (){
-'use strict';
-
-var inherits = require('inherits')
- , EventEmitter = require('events').EventEmitter
- , EventSourceDriver = require('eventsource')
- ;
-
-var debug = function() {};
-if (process.env.NODE_ENV !== 'production') {
- debug = require('debug')('sockjs-client:receiver:eventsource');
-}
-
-function EventSourceReceiver(url) {
- debug(url);
- EventEmitter.call(this);
-
- var self = this;
- var es = this.es = new EventSourceDriver(url);
- es.onmessage = function(e) {
- debug('message', e.data);
- self.emit('message', decodeURI(e.data));
- };
- es.onerror = function(e) {
- debug('error', es.readyState, e);
- // ES on reconnection has readyState = 0 or 1.
- // on network error it's CLOSED = 2
- var reason = (es.readyState !== 2 ? 'network' : 'permanent');
- self._cleanup();
- self._close(reason);
- };
-}
-
-inherits(EventSourceReceiver, EventEmitter);
-
-EventSourceReceiver.prototype.abort = function() {
- debug('abort');
- this._cleanup();
- this._close('user');
-};
-
-EventSourceReceiver.prototype._cleanup = function() {
- debug('cleanup');
- var es = this.es;
- if (es) {
- es.onmessage = es.onerror = null;
- es.close();
- this.es = null;
- }
-};
-
-EventSourceReceiver.prototype._close = function(reason) {
- debug('close', reason);
- var self = this;
- // Safari and chrome < 15 crash if we close window before
- // waiting for ES cleanup. See:
- // https://code.google.com/p/chromium/issues/detail?id=89155
- setTimeout(function() {
- self.emit('close', null, reason);
- self.removeAllListeners();
- }, 200);
-};
-
-module.exports = EventSourceReceiver;
-
-}).call(this)}).call(this,{ env: {} })
-
-},{"debug":55,"events":3,"eventsource":18,"inherits":57}],30:[function(require,module,exports){
-(function (process,global){(function (){
-'use strict';
-
-var inherits = require('inherits')
- , iframeUtils = require('../../utils/iframe')
- , urlUtils = require('../../utils/url')
- , EventEmitter = require('events').EventEmitter
- , random = require('../../utils/random')
- ;
-
-var debug = function() {};
-if (process.env.NODE_ENV !== 'production') {
- debug = require('debug')('sockjs-client:receiver:htmlfile');
-}
-
-function HtmlfileReceiver(url) {
- debug(url);
- EventEmitter.call(this);
- var self = this;
- iframeUtils.polluteGlobalNamespace();
-
- this.id = 'a' + random.string(6);
- url = urlUtils.addQuery(url, 'c=' + decodeURIComponent(iframeUtils.WPrefix + '.' + this.id));
-
- debug('using htmlfile', HtmlfileReceiver.htmlfileEnabled);
- var constructFunc = HtmlfileReceiver.htmlfileEnabled ?
- iframeUtils.createHtmlfile : iframeUtils.createIframe;
-
- global[iframeUtils.WPrefix][this.id] = {
- start: function() {
- debug('start');
- self.iframeObj.loaded();
- }
- , message: function(data) {
- debug('message', data);
- self.emit('message', data);
- }
- , stop: function() {
- debug('stop');
- self._cleanup();
- self._close('network');
- }
- };
- this.iframeObj = constructFunc(url, function() {
- debug('callback');
- self._cleanup();
- self._close('permanent');
- });
-}
-
-inherits(HtmlfileReceiver, EventEmitter);
-
-HtmlfileReceiver.prototype.abort = function() {
- debug('abort');
- this._cleanup();
- this._close('user');
-};
-
-HtmlfileReceiver.prototype._cleanup = function() {
- debug('_cleanup');
- if (this.iframeObj) {
- this.iframeObj.cleanup();
- this.iframeObj = null;
- }
- delete global[iframeUtils.WPrefix][this.id];
-};
-
-HtmlfileReceiver.prototype._close = function(reason) {
- debug('_close', reason);
- this.emit('close', null, reason);
- this.removeAllListeners();
-};
-
-HtmlfileReceiver.htmlfileEnabled = false;
-
-// obfuscate to avoid firewalls
-var axo = ['Active'].concat('Object').join('X');
-if (axo in global) {
- try {
- HtmlfileReceiver.htmlfileEnabled = !!new global[axo]('htmlfile');
- } catch (x) {
- // intentionally empty
- }
-}
-
-HtmlfileReceiver.enabled = HtmlfileReceiver.htmlfileEnabled || iframeUtils.iframeEnabled;
-
-module.exports = HtmlfileReceiver;
-
-}).call(this)}).call(this,{ env: {} },typeof __webpack_require__.g !== "undefined" ? __webpack_require__.g : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-
-},{"../../utils/iframe":47,"../../utils/random":50,"../../utils/url":52,"debug":55,"events":3,"inherits":57}],31:[function(require,module,exports){
-(function (process,global){(function (){
-'use strict';
-
-var utils = require('../../utils/iframe')
- , random = require('../../utils/random')
- , browser = require('../../utils/browser')
- , urlUtils = require('../../utils/url')
- , inherits = require('inherits')
- , EventEmitter = require('events').EventEmitter
- ;
-
-var debug = function() {};
-if (process.env.NODE_ENV !== 'production') {
- debug = require('debug')('sockjs-client:receiver:jsonp');
-}
-
-function JsonpReceiver(url) {
- debug(url);
- var self = this;
- EventEmitter.call(this);
-
- utils.polluteGlobalNamespace();
-
- this.id = 'a' + random.string(6);
- var urlWithId = urlUtils.addQuery(url, 'c=' + encodeURIComponent(utils.WPrefix + '.' + this.id));
-
- global[utils.WPrefix][this.id] = this._callback.bind(this);
- this._createScript(urlWithId);
-
- // Fallback mostly for Konqueror - stupid timer, 35 seconds shall be plenty.
- this.timeoutId = setTimeout(function() {
- debug('timeout');
- self._abort(new Error('JSONP script loaded abnormally (timeout)'));
- }, JsonpReceiver.timeout);
-}
-
-inherits(JsonpReceiver, EventEmitter);
-
-JsonpReceiver.prototype.abort = function() {
- debug('abort');
- if (global[utils.WPrefix][this.id]) {
- var err = new Error('JSONP user aborted read');
- err.code = 1000;
- this._abort(err);
- }
-};
-
-JsonpReceiver.timeout = 35000;
-JsonpReceiver.scriptErrorTimeout = 1000;
-
-JsonpReceiver.prototype._callback = function(data) {
- debug('_callback', data);
- this._cleanup();
-
- if (this.aborting) {
- return;
- }
-
- if (data) {
- debug('message', data);
- this.emit('message', data);
- }
- this.emit('close', null, 'network');
- this.removeAllListeners();
-};
-
-JsonpReceiver.prototype._abort = function(err) {
- debug('_abort', err);
- this._cleanup();
- this.aborting = true;
- this.emit('close', err.code, err.message);
- this.removeAllListeners();
-};
-
-JsonpReceiver.prototype._cleanup = function() {
- debug('_cleanup');
- clearTimeout(this.timeoutId);
- if (this.script2) {
- this.script2.parentNode.removeChild(this.script2);
- this.script2 = null;
- }
- if (this.script) {
- var script = this.script;
- // Unfortunately, you can't really abort script loading of
- // the script.
- script.parentNode.removeChild(script);
- script.onreadystatechange = script.onerror =
- script.onload = script.onclick = null;
- this.script = null;
- }
- delete global[utils.WPrefix][this.id];
-};
-
-JsonpReceiver.prototype._scriptError = function() {
- debug('_scriptError');
- var self = this;
- if (this.errorTimer) {
- return;
- }
-
- this.errorTimer = setTimeout(function() {
- if (!self.loadedOkay) {
- self._abort(new Error('JSONP script loaded abnormally (onerror)'));
- }
- }, JsonpReceiver.scriptErrorTimeout);
-};
-
-JsonpReceiver.prototype._createScript = function(url) {
- debug('_createScript', url);
- var self = this;
- var script = this.script = global.document.createElement('script');
- var script2; // Opera synchronous load trick.
-
- script.id = 'a' + random.string(8);
- script.src = url;
- script.type = 'text/javascript';
- script.charset = 'UTF-8';
- script.onerror = this._scriptError.bind(this);
- script.onload = function() {
- debug('onload');
- self._abort(new Error('JSONP script loaded abnormally (onload)'));
- };
-
- // IE9 fires 'error' event after onreadystatechange or before, in random order.
- // Use loadedOkay to determine if actually errored
- script.onreadystatechange = function() {
- debug('onreadystatechange', script.readyState);
- if (/loaded|closed/.test(script.readyState)) {
- if (script && script.htmlFor && script.onclick) {
- self.loadedOkay = true;
- try {
- // In IE, actually execute the script.
- script.onclick();
- } catch (x) {
- // intentionally empty
- }
- }
- if (script) {
- self._abort(new Error('JSONP script loaded abnormally (onreadystatechange)'));
- }
- }
- };
- // IE: event/htmlFor/onclick trick.
- // One can't rely on proper order for onreadystatechange. In order to
- // make sure, set a 'htmlFor' and 'event' properties, so that
- // script code will be installed as 'onclick' handler for the
- // script object. Later, onreadystatechange, manually execute this
- // code. FF and Chrome doesn't work with 'event' and 'htmlFor'
- // set. For reference see:
- // http://jaubourg.net/2010/07/loading-script-as-onclick-handler-of.html
- // Also, read on that about script ordering:
- // http://wiki.whatwg.org/wiki/Dynamic_Script_Execution_Order
- if (typeof script.async === 'undefined' && global.document.attachEvent) {
- // According to mozilla docs, in recent browsers script.async defaults
- // to 'true', so we may use it to detect a good browser:
- // https://developer.mozilla.org/en/HTML/Element/script
- if (!browser.isOpera()) {
- // Naively assume we're in IE
- try {
- script.htmlFor = script.id;
- script.event = 'onclick';
- } catch (x) {
- // intentionally empty
- }
- script.async = true;
- } else {
- // Opera, second sync script hack
- script2 = this.script2 = global.document.createElement('script');
- script2.text = "try{var a = document.getElementById('" + script.id + "'); if(a)a.onerror();}catch(x){};";
- script.async = script2.async = false;
- }
- }
- if (typeof script.async !== 'undefined') {
- script.async = true;
- }
-
- var head = global.document.getElementsByTagName('head')[0];
- head.insertBefore(script, head.firstChild);
- if (script2) {
- head.insertBefore(script2, head.firstChild);
- }
-};
-
-module.exports = JsonpReceiver;
-
-}).call(this)}).call(this,{ env: {} },typeof __webpack_require__.g !== "undefined" ? __webpack_require__.g : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-
-},{"../../utils/browser":44,"../../utils/iframe":47,"../../utils/random":50,"../../utils/url":52,"debug":55,"events":3,"inherits":57}],32:[function(require,module,exports){
-(function (process){(function (){
-'use strict';
-
-var inherits = require('inherits')
- , EventEmitter = require('events').EventEmitter
- ;
-
-var debug = function() {};
-if (process.env.NODE_ENV !== 'production') {
- debug = require('debug')('sockjs-client:receiver:xhr');
-}
-
-function XhrReceiver(url, AjaxObject) {
- debug(url);
- EventEmitter.call(this);
- var self = this;
-
- this.bufferPosition = 0;
-
- this.xo = new AjaxObject('POST', url, null);
- this.xo.on('chunk', this._chunkHandler.bind(this));
- this.xo.once('finish', function(status, text) {
- debug('finish', status, text);
- self._chunkHandler(status, text);
- self.xo = null;
- var reason = status === 200 ? 'network' : 'permanent';
- debug('close', reason);
- self.emit('close', null, reason);
- self._cleanup();
- });
-}
-
-inherits(XhrReceiver, EventEmitter);
-
-XhrReceiver.prototype._chunkHandler = function(status, text) {
- debug('_chunkHandler', status);
- if (status !== 200 || !text) {
- return;
- }
-
- for (var idx = -1; ; this.bufferPosition += idx + 1) {
- var buf = text.slice(this.bufferPosition);
- idx = buf.indexOf('\n');
- if (idx === -1) {
- break;
- }
- var msg = buf.slice(0, idx);
- if (msg) {
- debug('message', msg);
- this.emit('message', msg);
- }
- }
-};
-
-XhrReceiver.prototype._cleanup = function() {
- debug('_cleanup');
- this.removeAllListeners();
-};
-
-XhrReceiver.prototype.abort = function() {
- debug('abort');
- if (this.xo) {
- this.xo.close();
- debug('close');
- this.emit('close', null, 'user');
- this.xo = null;
- }
- this._cleanup();
-};
-
-module.exports = XhrReceiver;
-
-}).call(this)}).call(this,{ env: {} })
-
-},{"debug":55,"events":3,"inherits":57}],33:[function(require,module,exports){
-(function (process,global){(function (){
-'use strict';
-
-var random = require('../../utils/random')
- , urlUtils = require('../../utils/url')
- ;
-
-var debug = function() {};
-if (process.env.NODE_ENV !== 'production') {
- debug = require('debug')('sockjs-client:sender:jsonp');
-}
-
-var form, area;
-
-function createIframe(id) {
- debug('createIframe', id);
- try {
- // ie6 dynamic iframes with target="" support (thanks Chris Lambacher)
- return global.document.createElement('