diff --git a/src/Web/Web.csproj b/src/Web/Web.csproj
index 9e2848c..5554c12 100644
--- a/src/Web/Web.csproj
+++ b/src/Web/Web.csproj
@@ -11,6 +11,7 @@
+
diff --git a/src/Web/libman.json b/src/Web/libman.json
new file mode 100644
index 0000000..8c7a883
--- /dev/null
+++ b/src/Web/libman.json
@@ -0,0 +1,48 @@
+{
+ "version": "1.0",
+ "defaultProvider": "cdnjs",
+ "libraries": [
+ {
+ "library": "jquery@3.3.1",
+ "destination": "wwwroot/lib/jquery/"
+ },
+ {
+ "provider": "unpkg",
+ "library": "bootstrap@4.1.3",
+ "files": [
+ "dist/css/bootstrap.css",
+ "dist/css/bootstrap.css.map",
+ "dist/css/bootstrap.min.css",
+ "dist/css/bootstrap.min.css.map",
+ "dist/js/bootstrap.js",
+ "dist/js/bootstrap.min.js"
+ ],
+ "destination": "wwwroot/lib/bootstrap/"
+ },
+ {
+ "library": "jquery-validation-unobtrusive@3.2.10",
+ "destination": "wwwroot/lib/jquery-validation-unobtrusive/"
+ },
+ {
+ "library": "jquery-validate@1.17.0",
+ "destination": "wwwroot/lib/jquery-validate/",
+ "files": [
+ "jquery.validate.min.js",
+ "jquery.validate.js"
+ ]
+ },
+ {
+ "library": "toastr.js@2.1.4",
+ "destination": "wwwroot/lib/toastr/"
+ },
+ {
+ "provider": "unpkg",
+ "library": "@aspnet/signalr@1.0.3",
+ "files": [
+ "dist/browser/signalr.js",
+ "dist/browser/signalr.min.js"
+ ],
+ "destination": "wwwroot/lib/@aspnet/signalr/"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/src/Web/wwwroot/lib/@aspnet/signalr/dist/browser/signalr.js b/src/Web/wwwroot/lib/@aspnet/signalr/dist/browser/signalr.js
new file mode 100644
index 0000000..16b0954
--- /dev/null
+++ b/src/Web/wwwroot/lib/@aspnet/signalr/dist/browser/signalr.js
@@ -0,0 +1,3441 @@
+/**
+ * @overview ASP.NET Core SignalR JavaScript Client.
+ * @version 1.0.3.
+ * @license
+ * Copyright (c) .NET Foundation. All rights reserved.
+ * Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+ */
+(function (global, factory) {
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
+ typeof define === 'function' && define.amd ? define(factory) :
+ (global.signalR = factory());
+}(this, (function () { 'use strict';
+
+var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
+
+function commonjsRequire () {
+ throw new Error('Dynamic requires are not currently supported by rollup-plugin-commonjs');
+}
+
+function unwrapExports (x) {
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
+}
+
+function createCommonjsModule(fn, module) {
+ return module = { exports: {} }, fn(module, module.exports), module.exports;
+}
+
+/*! *****************************************************************************
+Copyright (c) Microsoft Corporation. All rights reserved.
+Licensed under the Apache License, Version 2.0 (the "License"); you may not use
+this file except in compliance with the License. You may obtain a copy of the
+License at http://www.apache.org/licenses/LICENSE-2.0
+
+THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
+WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
+MERCHANTABLITY OR NON-INFRINGEMENT.
+
+See the Apache Version 2.0 License for specific language governing permissions
+and limitations under the License.
+***************************************************************************** */
+/* global Reflect, Promise */
+
+var extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+
+function __extends(d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+}
+
+var __assign = Object.assign || function __assign(t) {
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
+ s = arguments[i];
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
+ }
+ return t;
+};
+
+function __rest(s, e) {
+ var t = {};
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
+ t[p] = s[p];
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
+ t[p[i]] = s[p[i]];
+ return t;
+}
+
+function __decorate(decorators, target, key, desc) {
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
+}
+
+function __param(paramIndex, decorator) {
+ return function (target, key) { decorator(target, key, paramIndex); }
+}
+
+function __metadata(metadataKey, metadataValue) {
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
+}
+
+function __awaiter(thisArg, _arguments, P, generator) {
+ return new (P || (P = Promise))(function (resolve, reject) {
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
+ function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
+ });
+}
+
+function __generator(thisArg, body) {
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
+ function verb(n) { return function (v) { return step([n, v]); }; }
+ function step(op) {
+ if (f) throw new TypeError("Generator is already executing.");
+ while (_) try {
+ if (f = 1, y && (t = y[op[0] & 2 ? "return" : op[0] ? "throw" : "next"]) && !(t = t.call(y, op[1])).done) return t;
+ if (y = 0, t) op = [0, t.value];
+ switch (op[0]) {
+ case 0: case 1: t = op; break;
+ case 4: _.label++; return { value: op[1], done: false };
+ case 5: _.label++; y = op[1]; op = [0]; continue;
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
+ default:
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
+ if (t[2]) _.ops.pop();
+ _.trys.pop(); continue;
+ }
+ op = body.call(thisArg, _);
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
+ }
+}
+
+function __exportStar(m, exports) {
+ for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
+}
+
+function __values(o) {
+ var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
+ if (m) return m.call(o);
+ return {
+ next: function () {
+ if (o && i >= o.length) o = void 0;
+ return { value: o && o[i++], done: !o };
+ }
+ };
+}
+
+function __read(o, n) {
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
+ if (!m) return o;
+ var i = m.call(o), r, ar = [], e;
+ try {
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
+ }
+ catch (error) { e = { error: error }; }
+ finally {
+ try {
+ if (r && !r.done && (m = i["return"])) m.call(i);
+ }
+ finally { if (e) throw e.error; }
+ }
+ return ar;
+}
+
+function __spread() {
+ for (var ar = [], i = 0; i < arguments.length; i++)
+ ar = ar.concat(__read(arguments[i]));
+ return ar;
+}
+
+function __await(v) {
+ return this instanceof __await ? (this.v = v, this) : new __await(v);
+}
+
+function __asyncGenerator(thisArg, _arguments, generator) {
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
+ return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
+ function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
+ function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
+ function fulfill(value) { resume("next", value); }
+ function reject(value) { resume("throw", value); }
+ function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
+}
+
+function __asyncDelegator(o) {
+ var i, p;
+ return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
+ function verb(n, f) { if (o[n]) i[n] = function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; }; }
+}
+
+function __asyncValues(o) {
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
+ var m = o[Symbol.asyncIterator];
+ return m ? m.call(o) : typeof __values === "function" ? __values(o) : o[Symbol.iterator]();
+}
+
+function __makeTemplateObject(cooked, raw) {
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
+ return cooked;
+}
+
+function __importStar(mod) {
+ if (mod && mod.__esModule) return mod;
+ var result = {};
+ if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
+ result.default = mod;
+ return result;
+}
+
+function __importDefault(mod) {
+ return (mod && mod.__esModule) ? mod : { default: mod };
+}
+
+
+var tslib_1 = Object.freeze({
+ __extends: __extends,
+ __assign: __assign,
+ __rest: __rest,
+ __decorate: __decorate,
+ __param: __param,
+ __metadata: __metadata,
+ __awaiter: __awaiter,
+ __generator: __generator,
+ __exportStar: __exportStar,
+ __values: __values,
+ __read: __read,
+ __spread: __spread,
+ __await: __await,
+ __asyncGenerator: __asyncGenerator,
+ __asyncDelegator: __asyncDelegator,
+ __asyncValues: __asyncValues,
+ __makeTemplateObject: __makeTemplateObject,
+ __importStar: __importStar,
+ __importDefault: __importDefault
+});
+
+var es6Promise_auto = createCommonjsModule(function (module, exports) {
+/*!
+ * @overview es6-promise - a tiny implementation of Promises/A+.
+ * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
+ * @license Licensed under MIT license
+ * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
+ * @version v4.2.2+97478eb6
+ */
+
+(function (global, factory) {
+ module.exports = factory();
+}(commonjsGlobal, (function () { function objectOrFunction(x) {
+ var type = typeof x;
+ return x !== null && (type === 'object' || type === 'function');
+}
+
+function isFunction(x) {
+ return typeof x === 'function';
+}
+
+
+
+var _isArray = void 0;
+if (Array.isArray) {
+ _isArray = Array.isArray;
+} else {
+ _isArray = function (x) {
+ return Object.prototype.toString.call(x) === '[object Array]';
+ };
+}
+
+var isArray = _isArray;
+
+var len = 0;
+var vertxNext = void 0;
+var customSchedulerFn = void 0;
+
+var asap = function asap(callback, arg) {
+ queue[len] = callback;
+ queue[len + 1] = arg;
+ len += 2;
+ if (len === 2) {
+ // If len is 2, that means that we need to schedule an async flush.
+ // If additional callbacks are queued before the queue is flushed, they
+ // will be processed by this flush that we are scheduling.
+ if (customSchedulerFn) {
+ customSchedulerFn(flush);
+ } else {
+ scheduleFlush();
+ }
+ }
+};
+
+function setScheduler(scheduleFn) {
+ customSchedulerFn = scheduleFn;
+}
+
+function setAsap(asapFn) {
+ asap = asapFn;
+}
+
+var browserWindow = typeof window !== 'undefined' ? window : undefined;
+var browserGlobal = browserWindow || {};
+var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;
+var isNode = typeof self === 'undefined' && typeof process !== 'undefined' && {}.toString.call(process) === '[object process]';
+
+// test for web worker but not in IE10
+var isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined';
+
+// node
+function useNextTick() {
+ // node version 0.10.x displays a deprecation warning when nextTick is used recursively
+ // see https://github.com/cujojs/when/issues/410 for details
+ return function () {
+ return process.nextTick(flush);
+ };
+}
+
+// vertx
+function useVertxTimer() {
+ if (typeof vertxNext !== 'undefined') {
+ return function () {
+ vertxNext(flush);
+ };
+ }
+
+ return useSetTimeout();
+}
+
+function useMutationObserver() {
+ var iterations = 0;
+ var observer = new BrowserMutationObserver(flush);
+ var node = document.createTextNode('');
+ observer.observe(node, { characterData: true });
+
+ return function () {
+ node.data = iterations = ++iterations % 2;
+ };
+}
+
+// web worker
+function useMessageChannel() {
+ var channel = new MessageChannel();
+ channel.port1.onmessage = flush;
+ return function () {
+ return channel.port2.postMessage(0);
+ };
+}
+
+function useSetTimeout() {
+ // Store setTimeout reference so es6-promise will be unaffected by
+ // other code modifying setTimeout (like sinon.useFakeTimers())
+ var globalSetTimeout = setTimeout;
+ return function () {
+ return globalSetTimeout(flush, 1);
+ };
+}
+
+var queue = new Array(1000);
+function flush() {
+ for (var i = 0; i < len; i += 2) {
+ var callback = queue[i];
+ var arg = queue[i + 1];
+
+ callback(arg);
+
+ queue[i] = undefined;
+ queue[i + 1] = undefined;
+ }
+
+ len = 0;
+}
+
+function attemptVertx() {
+ try {
+ var r = commonjsRequire;
+ var vertx = r('vertx');
+ vertxNext = vertx.runOnLoop || vertx.runOnContext;
+ return useVertxTimer();
+ } catch (e) {
+ return useSetTimeout();
+ }
+}
+
+var scheduleFlush = void 0;
+// Decide what async method to use to triggering processing of queued callbacks:
+if (isNode) {
+ scheduleFlush = useNextTick();
+} else if (BrowserMutationObserver) {
+ scheduleFlush = useMutationObserver();
+} else if (isWorker) {
+ scheduleFlush = useMessageChannel();
+} else if (browserWindow === undefined && typeof commonjsRequire === 'function') {
+ scheduleFlush = attemptVertx();
+} else {
+ scheduleFlush = useSetTimeout();
+}
+
+function then(onFulfillment, onRejection) {
+ var parent = this;
+
+ var child = new this.constructor(noop);
+
+ if (child[PROMISE_ID] === undefined) {
+ makePromise(child);
+ }
+
+ var _state = parent._state;
+
+
+ if (_state) {
+ var callback = arguments[_state - 1];
+ asap(function () {
+ return invokeCallback(_state, child, callback, parent._result);
+ });
+ } else {
+ subscribe(parent, child, onFulfillment, onRejection);
+ }
+
+ return child;
+}
+
+/**
+ `Promise.resolve` returns a promise that will become resolved with the
+ passed `value`. It is shorthand for the following:
+
+ ```javascript
+ let promise = new Promise(function(resolve, reject){
+ resolve(1);
+ });
+
+ promise.then(function(value){
+ // value === 1
+ });
+ ```
+
+ Instead of writing the above, your code now simply becomes the following:
+
+ ```javascript
+ let promise = Promise.resolve(1);
+
+ promise.then(function(value){
+ // value === 1
+ });
+ ```
+
+ @method resolve
+ @static
+ @param {Any} value value that the returned promise will be resolved with
+ Useful for tooling.
+ @return {Promise} a promise that will become fulfilled with the given
+ `value`
+*/
+function resolve$1(object) {
+ /*jshint validthis:true */
+ var Constructor = this;
+
+ if (object && typeof object === 'object' && object.constructor === Constructor) {
+ return object;
+ }
+
+ var promise = new Constructor(noop);
+ resolve(promise, object);
+ return promise;
+}
+
+var PROMISE_ID = Math.random().toString(36).substring(16);
+
+function noop() {}
+
+var PENDING = void 0;
+var FULFILLED = 1;
+var REJECTED = 2;
+
+var GET_THEN_ERROR = new ErrorObject();
+
+function selfFulfillment() {
+ return new TypeError("You cannot resolve a promise with itself");
+}
+
+function cannotReturnOwn() {
+ return new TypeError('A promises callback cannot return that same promise.');
+}
+
+function getThen(promise) {
+ try {
+ return promise.then;
+ } catch (error) {
+ GET_THEN_ERROR.error = error;
+ return GET_THEN_ERROR;
+ }
+}
+
+function tryThen(then$$1, value, fulfillmentHandler, rejectionHandler) {
+ try {
+ then$$1.call(value, fulfillmentHandler, rejectionHandler);
+ } catch (e) {
+ return e;
+ }
+}
+
+function handleForeignThenable(promise, thenable, then$$1) {
+ asap(function (promise) {
+ var sealed = false;
+ var error = tryThen(then$$1, thenable, function (value) {
+ if (sealed) {
+ return;
+ }
+ sealed = true;
+ if (thenable !== value) {
+ resolve(promise, value);
+ } else {
+ fulfill(promise, value);
+ }
+ }, function (reason) {
+ if (sealed) {
+ return;
+ }
+ sealed = true;
+
+ reject(promise, reason);
+ }, 'Settle: ' + (promise._label || ' unknown promise'));
+
+ if (!sealed && error) {
+ sealed = true;
+ reject(promise, error);
+ }
+ }, promise);
+}
+
+function handleOwnThenable(promise, thenable) {
+ if (thenable._state === FULFILLED) {
+ fulfill(promise, thenable._result);
+ } else if (thenable._state === REJECTED) {
+ reject(promise, thenable._result);
+ } else {
+ subscribe(thenable, undefined, function (value) {
+ return resolve(promise, value);
+ }, function (reason) {
+ return reject(promise, reason);
+ });
+ }
+}
+
+function handleMaybeThenable(promise, maybeThenable, then$$1) {
+ if (maybeThenable.constructor === promise.constructor && then$$1 === then && maybeThenable.constructor.resolve === resolve$1) {
+ handleOwnThenable(promise, maybeThenable);
+ } else {
+ if (then$$1 === GET_THEN_ERROR) {
+ reject(promise, GET_THEN_ERROR.error);
+ GET_THEN_ERROR.error = null;
+ } else if (then$$1 === undefined) {
+ fulfill(promise, maybeThenable);
+ } else if (isFunction(then$$1)) {
+ handleForeignThenable(promise, maybeThenable, then$$1);
+ } else {
+ fulfill(promise, maybeThenable);
+ }
+ }
+}
+
+function resolve(promise, value) {
+ if (promise === value) {
+ reject(promise, selfFulfillment());
+ } else if (objectOrFunction(value)) {
+ handleMaybeThenable(promise, value, getThen(value));
+ } else {
+ fulfill(promise, value);
+ }
+}
+
+function publishRejection(promise) {
+ if (promise._onerror) {
+ promise._onerror(promise._result);
+ }
+
+ publish(promise);
+}
+
+function fulfill(promise, value) {
+ if (promise._state !== PENDING) {
+ return;
+ }
+
+ promise._result = value;
+ promise._state = FULFILLED;
+
+ if (promise._subscribers.length !== 0) {
+ asap(publish, promise);
+ }
+}
+
+function reject(promise, reason) {
+ if (promise._state !== PENDING) {
+ return;
+ }
+ promise._state = REJECTED;
+ promise._result = reason;
+
+ asap(publishRejection, promise);
+}
+
+function subscribe(parent, child, onFulfillment, onRejection) {
+ var _subscribers = parent._subscribers;
+ var length = _subscribers.length;
+
+
+ parent._onerror = null;
+
+ _subscribers[length] = child;
+ _subscribers[length + FULFILLED] = onFulfillment;
+ _subscribers[length + REJECTED] = onRejection;
+
+ if (length === 0 && parent._state) {
+ asap(publish, parent);
+ }
+}
+
+function publish(promise) {
+ var subscribers = promise._subscribers;
+ var settled = promise._state;
+
+ if (subscribers.length === 0) {
+ return;
+ }
+
+ var child = void 0,
+ callback = void 0,
+ detail = promise._result;
+
+ for (var i = 0; i < subscribers.length; i += 3) {
+ child = subscribers[i];
+ callback = subscribers[i + settled];
+
+ if (child) {
+ invokeCallback(settled, child, callback, detail);
+ } else {
+ callback(detail);
+ }
+ }
+
+ promise._subscribers.length = 0;
+}
+
+function ErrorObject() {
+ this.error = null;
+}
+
+var TRY_CATCH_ERROR = new ErrorObject();
+
+function tryCatch(callback, detail) {
+ try {
+ return callback(detail);
+ } catch (e) {
+ TRY_CATCH_ERROR.error = e;
+ return TRY_CATCH_ERROR;
+ }
+}
+
+function invokeCallback(settled, promise, callback, detail) {
+ var hasCallback = isFunction(callback),
+ value = void 0,
+ error = void 0,
+ succeeded = void 0,
+ failed = void 0;
+
+ if (hasCallback) {
+ value = tryCatch(callback, detail);
+
+ if (value === TRY_CATCH_ERROR) {
+ failed = true;
+ error = value.error;
+ value.error = null;
+ } else {
+ succeeded = true;
+ }
+
+ if (promise === value) {
+ reject(promise, cannotReturnOwn());
+ return;
+ }
+ } else {
+ value = detail;
+ succeeded = true;
+ }
+
+ if (promise._state !== PENDING) {
+ // noop
+ } else if (hasCallback && succeeded) {
+ resolve(promise, value);
+ } else if (failed) {
+ reject(promise, error);
+ } else if (settled === FULFILLED) {
+ fulfill(promise, value);
+ } else if (settled === REJECTED) {
+ reject(promise, value);
+ }
+}
+
+function initializePromise(promise, resolver) {
+ try {
+ resolver(function resolvePromise(value) {
+ resolve(promise, value);
+ }, function rejectPromise(reason) {
+ reject(promise, reason);
+ });
+ } catch (e) {
+ reject(promise, e);
+ }
+}
+
+var id = 0;
+function nextId() {
+ return id++;
+}
+
+function makePromise(promise) {
+ promise[PROMISE_ID] = id++;
+ promise._state = undefined;
+ promise._result = undefined;
+ promise._subscribers = [];
+}
+
+function validationError() {
+ return new Error('Array Methods must be provided an Array');
+}
+
+function validationError() {
+ return new Error('Array Methods must be provided an Array');
+}
+
+var Enumerator = function () {
+ function Enumerator(Constructor, input) {
+ this._instanceConstructor = Constructor;
+ this.promise = new Constructor(noop);
+
+ if (!this.promise[PROMISE_ID]) {
+ makePromise(this.promise);
+ }
+
+ if (isArray(input)) {
+ this.length = input.length;
+ this._remaining = input.length;
+
+ this._result = new Array(this.length);
+
+ if (this.length === 0) {
+ fulfill(this.promise, this._result);
+ } else {
+ this.length = this.length || 0;
+ this._enumerate(input);
+ if (this._remaining === 0) {
+ fulfill(this.promise, this._result);
+ }
+ }
+ } else {
+ reject(this.promise, validationError());
+ }
+ }
+
+ Enumerator.prototype._enumerate = function _enumerate(input) {
+ for (var i = 0; this._state === PENDING && i < input.length; i++) {
+ this._eachEntry(input[i], i);
+ }
+ };
+
+ Enumerator.prototype._eachEntry = function _eachEntry(entry, i) {
+ var c = this._instanceConstructor;
+ var resolve$$1 = c.resolve;
+
+
+ if (resolve$$1 === resolve$1) {
+ var _then = getThen(entry);
+
+ if (_then === then && entry._state !== PENDING) {
+ this._settledAt(entry._state, i, entry._result);
+ } else if (typeof _then !== 'function') {
+ this._remaining--;
+ this._result[i] = entry;
+ } else if (c === Promise$2) {
+ var promise = new c(noop);
+ handleMaybeThenable(promise, entry, _then);
+ this._willSettleAt(promise, i);
+ } else {
+ this._willSettleAt(new c(function (resolve$$1) {
+ return resolve$$1(entry);
+ }), i);
+ }
+ } else {
+ this._willSettleAt(resolve$$1(entry), i);
+ }
+ };
+
+ Enumerator.prototype._settledAt = function _settledAt(state, i, value) {
+ var promise = this.promise;
+
+
+ if (promise._state === PENDING) {
+ this._remaining--;
+
+ if (state === REJECTED) {
+ reject(promise, value);
+ } else {
+ this._result[i] = value;
+ }
+ }
+
+ if (this._remaining === 0) {
+ fulfill(promise, this._result);
+ }
+ };
+
+ Enumerator.prototype._willSettleAt = function _willSettleAt(promise, i) {
+ var enumerator = this;
+
+ subscribe(promise, undefined, function (value) {
+ return enumerator._settledAt(FULFILLED, i, value);
+ }, function (reason) {
+ return enumerator._settledAt(REJECTED, i, reason);
+ });
+ };
+
+ return Enumerator;
+}();
+
+/**
+ `Promise.all` accepts an array of promises, and returns a new promise which
+ is fulfilled with an array of fulfillment values for the passed promises, or
+ rejected with the reason of the first passed promise to be rejected. It casts all
+ elements of the passed iterable to promises as it runs this algorithm.
+
+ Example:
+
+ ```javascript
+ let promise1 = resolve(1);
+ let promise2 = resolve(2);
+ let promise3 = resolve(3);
+ let promises = [ promise1, promise2, promise3 ];
+
+ Promise.all(promises).then(function(array){
+ // The array here would be [ 1, 2, 3 ];
+ });
+ ```
+
+ If any of the `promises` given to `all` are rejected, the first promise
+ that is rejected will be given as an argument to the returned promises's
+ rejection handler. For example:
+
+ Example:
+
+ ```javascript
+ let promise1 = resolve(1);
+ let promise2 = reject(new Error("2"));
+ let promise3 = reject(new Error("3"));
+ let promises = [ promise1, promise2, promise3 ];
+
+ Promise.all(promises).then(function(array){
+ // Code here never runs because there are rejected promises!
+ }, function(error) {
+ // error.message === "2"
+ });
+ ```
+
+ @method all
+ @static
+ @param {Array} entries array of promises
+ @param {String} label optional string for labeling the promise.
+ Useful for tooling.
+ @return {Promise} promise that is fulfilled when all `promises` have been
+ fulfilled, or rejected if any of them become rejected.
+ @static
+*/
+function all(entries) {
+ return new Enumerator(this, entries).promise;
+}
+
+/**
+ `Promise.race` returns a new promise which is settled in the same way as the
+ first passed promise to settle.
+
+ Example:
+
+ ```javascript
+ let promise1 = new Promise(function(resolve, reject){
+ setTimeout(function(){
+ resolve('promise 1');
+ }, 200);
+ });
+
+ let promise2 = new Promise(function(resolve, reject){
+ setTimeout(function(){
+ resolve('promise 2');
+ }, 100);
+ });
+
+ Promise.race([promise1, promise2]).then(function(result){
+ // result === 'promise 2' because it was resolved before promise1
+ // was resolved.
+ });
+ ```
+
+ `Promise.race` is deterministic in that only the state of the first
+ settled promise matters. For example, even if other promises given to the
+ `promises` array argument are resolved, but the first settled promise has
+ become rejected before the other promises became fulfilled, the returned
+ promise will become rejected:
+
+ ```javascript
+ let promise1 = new Promise(function(resolve, reject){
+ setTimeout(function(){
+ resolve('promise 1');
+ }, 200);
+ });
+
+ let promise2 = new Promise(function(resolve, reject){
+ setTimeout(function(){
+ reject(new Error('promise 2'));
+ }, 100);
+ });
+
+ Promise.race([promise1, promise2]).then(function(result){
+ // Code here never runs
+ }, function(reason){
+ // reason.message === 'promise 2' because promise 2 became rejected before
+ // promise 1 became fulfilled
+ });
+ ```
+
+ An example real-world use case is implementing timeouts:
+
+ ```javascript
+ Promise.race([ajax('foo.json'), timeout(5000)])
+ ```
+
+ @method race
+ @static
+ @param {Array} promises array of promises to observe
+ Useful for tooling.
+ @return {Promise} a promise which settles in the same way as the first passed
+ promise to settle.
+*/
+function race(entries) {
+ /*jshint validthis:true */
+ var Constructor = this;
+
+ if (!isArray(entries)) {
+ return new Constructor(function (_, reject) {
+ return reject(new TypeError('You must pass an array to race.'));
+ });
+ } else {
+ return new Constructor(function (resolve, reject) {
+ var length = entries.length;
+ for (var i = 0; i < length; i++) {
+ Constructor.resolve(entries[i]).then(resolve, reject);
+ }
+ });
+ }
+}
+
+/**
+ `Promise.reject` returns a promise rejected with the passed `reason`.
+ It is shorthand for the following:
+
+ ```javascript
+ let promise = new Promise(function(resolve, reject){
+ reject(new Error('WHOOPS'));
+ });
+
+ promise.then(function(value){
+ // Code here doesn't run because the promise is rejected!
+ }, function(reason){
+ // reason.message === 'WHOOPS'
+ });
+ ```
+
+ Instead of writing the above, your code now simply becomes the following:
+
+ ```javascript
+ let promise = Promise.reject(new Error('WHOOPS'));
+
+ promise.then(function(value){
+ // Code here doesn't run because the promise is rejected!
+ }, function(reason){
+ // reason.message === 'WHOOPS'
+ });
+ ```
+
+ @method reject
+ @static
+ @param {Any} reason value that the returned promise will be rejected with.
+ Useful for tooling.
+ @return {Promise} a promise rejected with the given `reason`.
+*/
+function reject$1(reason) {
+ /*jshint validthis:true */
+ var Constructor = this;
+ var promise = new Constructor(noop);
+ reject(promise, reason);
+ return promise;
+}
+
+function needsResolver() {
+ throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
+}
+
+function needsNew() {
+ throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
+}
+
+/**
+ Promise objects represent the eventual result of an asynchronous operation. The
+ primary way of interacting with a promise is through its `then` method, which
+ registers callbacks to receive either a promise's eventual value or the reason
+ why the promise cannot be fulfilled.
+
+ Terminology
+ -----------
+
+ - `promise` is an object or function with a `then` method whose behavior conforms to this specification.
+ - `thenable` is an object or function that defines a `then` method.
+ - `value` is any legal JavaScript value (including undefined, a thenable, or a promise).
+ - `exception` is a value that is thrown using the throw statement.
+ - `reason` is a value that indicates why a promise was rejected.
+ - `settled` the final resting state of a promise, fulfilled or rejected.
+
+ A promise can be in one of three states: pending, fulfilled, or rejected.
+
+ Promises that are fulfilled have a fulfillment value and are in the fulfilled
+ state. Promises that are rejected have a rejection reason and are in the
+ rejected state. A fulfillment value is never a thenable.
+
+ Promises can also be said to *resolve* a value. If this value is also a
+ promise, then the original promise's settled state will match the value's
+ settled state. So a promise that *resolves* a promise that rejects will
+ itself reject, and a promise that *resolves* a promise that fulfills will
+ itself fulfill.
+
+
+ Basic Usage:
+ ------------
+
+ ```js
+ let promise = new Promise(function(resolve, reject) {
+ // on success
+ resolve(value);
+
+ // on failure
+ reject(reason);
+ });
+
+ promise.then(function(value) {
+ // on fulfillment
+ }, function(reason) {
+ // on rejection
+ });
+ ```
+
+ Advanced Usage:
+ ---------------
+
+ Promises shine when abstracting away asynchronous interactions such as
+ `XMLHttpRequest`s.
+
+ ```js
+ function getJSON(url) {
+ return new Promise(function(resolve, reject){
+ let xhr = new XMLHttpRequest();
+
+ xhr.open('GET', url);
+ xhr.onreadystatechange = handler;
+ xhr.responseType = 'json';
+ xhr.setRequestHeader('Accept', 'application/json');
+ xhr.send();
+
+ function handler() {
+ if (this.readyState === this.DONE) {
+ if (this.status === 200) {
+ resolve(this.response);
+ } else {
+ reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));
+ }
+ }
+ };
+ });
+ }
+
+ getJSON('/posts.json').then(function(json) {
+ // on fulfillment
+ }, function(reason) {
+ // on rejection
+ });
+ ```
+
+ Unlike callbacks, promises are great composable primitives.
+
+ ```js
+ Promise.all([
+ getJSON('/posts'),
+ getJSON('/comments')
+ ]).then(function(values){
+ values[0] // => postsJSON
+ values[1] // => commentsJSON
+
+ return values;
+ });
+ ```
+
+ @class Promise
+ @param {Function} resolver
+ Useful for tooling.
+ @constructor
+*/
+
+var Promise$2 = function () {
+ function Promise(resolver) {
+ this[PROMISE_ID] = nextId();
+ this._result = this._state = undefined;
+ this._subscribers = [];
+
+ if (noop !== resolver) {
+ typeof resolver !== 'function' && needsResolver();
+ this instanceof Promise ? initializePromise(this, resolver) : needsNew();
+ }
+ }
+
+ /**
+ The primary way of interacting with a promise is through its `then` method,
+ which registers callbacks to receive either a promise's eventual value or the
+ reason why the promise cannot be fulfilled.
+ ```js
+ findUser().then(function(user){
+ // user is available
+ }, function(reason){
+ // user is unavailable, and you are given the reason why
+ });
+ ```
+ Chaining
+ --------
+ The return value of `then` is itself a promise. This second, 'downstream'
+ promise is resolved with the return value of the first promise's fulfillment
+ or rejection handler, or rejected if the handler throws an exception.
+ ```js
+ findUser().then(function (user) {
+ return user.name;
+ }, function (reason) {
+ return 'default name';
+ }).then(function (userName) {
+ // If `findUser` fulfilled, `userName` will be the user's name, otherwise it
+ // will be `'default name'`
+ });
+ findUser().then(function (user) {
+ throw new Error('Found user, but still unhappy');
+ }, function (reason) {
+ throw new Error('`findUser` rejected and we're unhappy');
+ }).then(function (value) {
+ // never reached
+ }, function (reason) {
+ // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.
+ // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.
+ });
+ ```
+ If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.
+ ```js
+ findUser().then(function (user) {
+ throw new PedagogicalException('Upstream error');
+ }).then(function (value) {
+ // never reached
+ }).then(function (value) {
+ // never reached
+ }, function (reason) {
+ // The `PedgagocialException` is propagated all the way down to here
+ });
+ ```
+ Assimilation
+ ------------
+ Sometimes the value you want to propagate to a downstream promise can only be
+ retrieved asynchronously. This can be achieved by returning a promise in the
+ fulfillment or rejection handler. The downstream promise will then be pending
+ until the returned promise is settled. This is called *assimilation*.
+ ```js
+ findUser().then(function (user) {
+ return findCommentsByAuthor(user);
+ }).then(function (comments) {
+ // The user's comments are now available
+ });
+ ```
+ If the assimliated promise rejects, then the downstream promise will also reject.
+ ```js
+ findUser().then(function (user) {
+ return findCommentsByAuthor(user);
+ }).then(function (comments) {
+ // If `findCommentsByAuthor` fulfills, we'll have the value here
+ }, function (reason) {
+ // If `findCommentsByAuthor` rejects, we'll have the reason here
+ });
+ ```
+ Simple Example
+ --------------
+ Synchronous Example
+ ```javascript
+ let result;
+ try {
+ result = findResult();
+ // success
+ } catch(reason) {
+ // failure
+ }
+ ```
+ Errback Example
+ ```js
+ findResult(function(result, err){
+ if (err) {
+ // failure
+ } else {
+ // success
+ }
+ });
+ ```
+ Promise Example;
+ ```javascript
+ findResult().then(function(result){
+ // success
+ }, function(reason){
+ // failure
+ });
+ ```
+ Advanced Example
+ --------------
+ Synchronous Example
+ ```javascript
+ let author, books;
+ try {
+ author = findAuthor();
+ books = findBooksByAuthor(author);
+ // success
+ } catch(reason) {
+ // failure
+ }
+ ```
+ Errback Example
+ ```js
+ function foundBooks(books) {
+ }
+ function failure(reason) {
+ }
+ findAuthor(function(author, err){
+ if (err) {
+ failure(err);
+ // failure
+ } else {
+ try {
+ findBoooksByAuthor(author, function(books, err) {
+ if (err) {
+ failure(err);
+ } else {
+ try {
+ foundBooks(books);
+ } catch(reason) {
+ failure(reason);
+ }
+ }
+ });
+ } catch(error) {
+ failure(err);
+ }
+ // success
+ }
+ });
+ ```
+ Promise Example;
+ ```javascript
+ findAuthor().
+ then(findBooksByAuthor).
+ then(function(books){
+ // found books
+ }).catch(function(reason){
+ // something went wrong
+ });
+ ```
+ @method then
+ @param {Function} onFulfilled
+ @param {Function} onRejected
+ Useful for tooling.
+ @return {Promise}
+ */
+
+ /**
+ `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same
+ as the catch block of a try/catch statement.
+ ```js
+ function findAuthor(){
+ throw new Error('couldn't find that author');
+ }
+ // synchronous
+ try {
+ findAuthor();
+ } catch(reason) {
+ // something went wrong
+ }
+ // async with promises
+ findAuthor().catch(function(reason){
+ // something went wrong
+ });
+ ```
+ @method catch
+ @param {Function} onRejection
+ Useful for tooling.
+ @return {Promise}
+ */
+
+
+ Promise.prototype.catch = function _catch(onRejection) {
+ return this.then(null, onRejection);
+ };
+
+ /**
+ `finally` will be invoked regardless of the promise's fate just as native
+ try/catch/finally behaves
+
+ Synchronous example:
+
+ ```js
+ findAuthor() {
+ if (Math.random() > 0.5) {
+ throw new Error();
+ }
+ return new Author();
+ }
+
+ try {
+ return findAuthor(); // succeed or fail
+ } catch(error) {
+ return findOtherAuther();
+ } finally {
+ // always runs
+ // doesn't affect the return value
+ }
+ ```
+
+ Asynchronous example:
+
+ ```js
+ findAuthor().catch(function(reason){
+ return findOtherAuther();
+ }).finally(function(){
+ // author was either found, or not
+ });
+ ```
+
+ @method finally
+ @param {Function} callback
+ @return {Promise}
+ */
+
+
+ Promise.prototype.finally = function _finally(callback) {
+ var promise = this;
+ var constructor = promise.constructor;
+
+ return promise.then(function (value) {
+ return constructor.resolve(callback()).then(function () {
+ return value;
+ });
+ }, function (reason) {
+ return constructor.resolve(callback()).then(function () {
+ throw reason;
+ });
+ });
+ };
+
+ return Promise;
+}();
+
+Promise$2.prototype.then = then;
+Promise$2.all = all;
+Promise$2.race = race;
+Promise$2.resolve = resolve$1;
+Promise$2.reject = reject$1;
+Promise$2._setScheduler = setScheduler;
+Promise$2._setAsap = setAsap;
+Promise$2._asap = asap;
+
+/*global self*/
+function polyfill() {
+ var local = void 0;
+
+ if (typeof commonjsGlobal !== 'undefined') {
+ local = commonjsGlobal;
+ } else if (typeof self !== 'undefined') {
+ local = self;
+ } else {
+ try {
+ local = Function('return this')();
+ } catch (e) {
+ throw new Error('polyfill failed because global object is unavailable in this environment');
+ }
+ }
+
+ var P = local.Promise;
+
+ if (P) {
+ var promiseToString = null;
+ try {
+ promiseToString = Object.prototype.toString.call(P.resolve());
+ } catch (e) {
+ // silently ignored
+ }
+
+ if (promiseToString === '[object Promise]' && !P.cast) {
+ return;
+ }
+ }
+
+ local.Promise = Promise$2;
+}
+
+// Strange compat..
+Promise$2.polyfill = polyfill;
+Promise$2.Promise = Promise$2;
+
+Promise$2.polyfill();
+
+return Promise$2;
+
+})));
+
+
+
+
+});
+
+var Errors = createCommonjsModule(function (module, exports) {
+Object.defineProperty(exports, "__esModule", { value: true });
+
+/** Error thrown when an HTTP request fails. */
+var HttpError = /** @class */ (function (_super) {
+ tslib_1.__extends(HttpError, _super);
+ /** Constructs a new instance of {@link HttpError}.
+ *
+ * @param {string} errorMessage A descriptive error message.
+ * @param {number} statusCode The HTTP status code represented by this error.
+ */
+ function HttpError(errorMessage, statusCode) {
+ var _newTarget = this.constructor;
+ var _this = this;
+ var trueProto = _newTarget.prototype;
+ _this = _super.call(this, errorMessage) || this;
+ _this.statusCode = statusCode;
+ // Workaround issue in Typescript compiler
+ // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200
+ _this.__proto__ = trueProto;
+ return _this;
+ }
+ return HttpError;
+}(Error));
+exports.HttpError = HttpError;
+/** Error thrown when a timeout elapses. */
+var TimeoutError = /** @class */ (function (_super) {
+ tslib_1.__extends(TimeoutError, _super);
+ /** Constructs a new instance of {@link TimeoutError}.
+ *
+ * @param {string} errorMessage A descriptive error message.
+ */
+ function TimeoutError(errorMessage) {
+ var _newTarget = this.constructor;
+ if (errorMessage === void 0) { errorMessage = "A timeout occurred."; }
+ var _this = this;
+ var trueProto = _newTarget.prototype;
+ _this = _super.call(this, errorMessage) || this;
+ // Workaround issue in Typescript compiler
+ // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200
+ _this.__proto__ = trueProto;
+ return _this;
+ }
+ return TimeoutError;
+}(Error));
+exports.TimeoutError = TimeoutError;
+
+});
+
+unwrapExports(Errors);
+var Errors_1 = Errors.HttpError;
+var Errors_2 = Errors.TimeoutError;
+
+var ILogger = createCommonjsModule(function (module, exports) {
+Object.defineProperty(exports, "__esModule", { value: true });
+// These values are designed to match the ASP.NET Log Levels since that's the pattern we're emulating here.
+/** Indicates the severity of a log message.
+ *
+ * Log Levels are ordered in increasing severity. So `Debug` is more severe than `Trace`, etc.
+ */
+var LogLevel;
+(function (LogLevel) {
+ /** Log level for very low severity diagnostic messages. */
+ LogLevel[LogLevel["Trace"] = 0] = "Trace";
+ /** Log level for low severity diagnostic messages. */
+ LogLevel[LogLevel["Debug"] = 1] = "Debug";
+ /** Log level for informational diagnostic messages. */
+ LogLevel[LogLevel["Information"] = 2] = "Information";
+ /** Log level for diagnostic messages that indicate a non-fatal problem. */
+ LogLevel[LogLevel["Warning"] = 3] = "Warning";
+ /** Log level for diagnostic messages that indicate a failure in the current operation. */
+ LogLevel[LogLevel["Error"] = 4] = "Error";
+ /** Log level for diagnostic messages that indicate a failure that will terminate the entire application. */
+ LogLevel[LogLevel["Critical"] = 5] = "Critical";
+ /** The highest possible log level. Used when configuring logging to indicate that no log messages should be emitted. */
+ LogLevel[LogLevel["None"] = 6] = "None";
+})(LogLevel = exports.LogLevel || (exports.LogLevel = {}));
+
+});
+
+unwrapExports(ILogger);
+var ILogger_1 = ILogger.LogLevel;
+
+var HttpClient_1 = createCommonjsModule(function (module, exports) {
+Object.defineProperty(exports, "__esModule", { value: true });
+
+
+
+/** Represents an HTTP response. */
+var HttpResponse = /** @class */ (function () {
+ function HttpResponse(statusCode, statusText, content) {
+ this.statusCode = statusCode;
+ this.statusText = statusText;
+ this.content = content;
+ }
+ return HttpResponse;
+}());
+exports.HttpResponse = HttpResponse;
+/** Abstraction over an HTTP client.
+ *
+ * This class provides an abstraction over an HTTP client so that a different implementation can be provided on different platforms.
+ */
+var HttpClient = /** @class */ (function () {
+ function HttpClient() {
+ }
+ HttpClient.prototype.get = function (url, options) {
+ return this.send(tslib_1.__assign({}, options, { method: "GET", url: url }));
+ };
+ HttpClient.prototype.post = function (url, options) {
+ return this.send(tslib_1.__assign({}, options, { method: "POST", url: url }));
+ };
+ HttpClient.prototype.delete = function (url, options) {
+ return this.send(tslib_1.__assign({}, options, { method: "DELETE", url: url }));
+ };
+ return HttpClient;
+}());
+exports.HttpClient = HttpClient;
+/** Default implementation of {@link HttpClient}. */
+var DefaultHttpClient = /** @class */ (function (_super) {
+ tslib_1.__extends(DefaultHttpClient, _super);
+ /** Creates a new instance of the {@link DefaultHttpClient}, using the provided {@link ILogger} to log messages. */
+ function DefaultHttpClient(logger) {
+ var _this = _super.call(this) || this;
+ _this.logger = logger;
+ return _this;
+ }
+ /** @inheritDoc */
+ DefaultHttpClient.prototype.send = function (request) {
+ var _this = this;
+ return new Promise(function (resolve, reject) {
+ var xhr = new XMLHttpRequest();
+ xhr.open(request.method, request.url, true);
+ xhr.withCredentials = true;
+ xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
+ // Explicitly setting the Content-Type header for React Native on Android platform.
+ xhr.setRequestHeader("Content-Type", "text/plain;charset=UTF-8");
+ if (request.headers) {
+ Object.keys(request.headers)
+ .forEach(function (header) { return xhr.setRequestHeader(header, request.headers[header]); });
+ }
+ if (request.responseType) {
+ xhr.responseType = request.responseType;
+ }
+ if (request.abortSignal) {
+ request.abortSignal.onabort = function () {
+ xhr.abort();
+ };
+ }
+ if (request.timeout) {
+ xhr.timeout = request.timeout;
+ }
+ xhr.onload = function () {
+ if (request.abortSignal) {
+ request.abortSignal.onabort = null;
+ }
+ if (xhr.status >= 200 && xhr.status < 300) {
+ resolve(new HttpResponse(xhr.status, xhr.statusText, xhr.response || xhr.responseText));
+ }
+ else {
+ reject(new Errors.HttpError(xhr.statusText, xhr.status));
+ }
+ };
+ xhr.onerror = function () {
+ _this.logger.log(ILogger.LogLevel.Warning, "Error from HTTP request. " + xhr.status + ": " + xhr.statusText);
+ reject(new Errors.HttpError(xhr.statusText, xhr.status));
+ };
+ xhr.ontimeout = function () {
+ _this.logger.log(ILogger.LogLevel.Warning, "Timeout from HTTP request.");
+ reject(new Errors.TimeoutError());
+ };
+ xhr.send(request.content || "");
+ });
+ };
+ return DefaultHttpClient;
+}(HttpClient));
+exports.DefaultHttpClient = DefaultHttpClient;
+
+});
+
+unwrapExports(HttpClient_1);
+var HttpClient_2 = HttpClient_1.HttpResponse;
+var HttpClient_3 = HttpClient_1.HttpClient;
+var HttpClient_4 = HttpClient_1.DefaultHttpClient;
+
+var TextMessageFormat_1 = createCommonjsModule(function (module, exports) {
+Object.defineProperty(exports, "__esModule", { value: true });
+// Not exported from index
+var TextMessageFormat = /** @class */ (function () {
+ function TextMessageFormat() {
+ }
+ TextMessageFormat.write = function (output) {
+ return "" + output + TextMessageFormat.RecordSeparator;
+ };
+ TextMessageFormat.parse = function (input) {
+ if (input[input.length - 1] !== TextMessageFormat.RecordSeparator) {
+ throw new Error("Message is incomplete.");
+ }
+ var messages = input.split(TextMessageFormat.RecordSeparator);
+ messages.pop();
+ return messages;
+ };
+ TextMessageFormat.RecordSeparatorCode = 0x1e;
+ TextMessageFormat.RecordSeparator = String.fromCharCode(TextMessageFormat.RecordSeparatorCode);
+ return TextMessageFormat;
+}());
+exports.TextMessageFormat = TextMessageFormat;
+
+});
+
+unwrapExports(TextMessageFormat_1);
+var TextMessageFormat_2 = TextMessageFormat_1.TextMessageFormat;
+
+var HandshakeProtocol_1 = createCommonjsModule(function (module, exports) {
+Object.defineProperty(exports, "__esModule", { value: true });
+
+var HandshakeProtocol = /** @class */ (function () {
+ function HandshakeProtocol() {
+ }
+ // Handshake request is always JSON
+ HandshakeProtocol.prototype.writeHandshakeRequest = function (handshakeRequest) {
+ return TextMessageFormat_1.TextMessageFormat.write(JSON.stringify(handshakeRequest));
+ };
+ HandshakeProtocol.prototype.parseHandshakeResponse = function (data) {
+ var responseMessage;
+ var messageData;
+ var remainingData;
+ if (data instanceof ArrayBuffer) {
+ // Format is binary but still need to read JSON text from handshake response
+ var binaryData = new Uint8Array(data);
+ var separatorIndex = binaryData.indexOf(TextMessageFormat_1.TextMessageFormat.RecordSeparatorCode);
+ if (separatorIndex === -1) {
+ throw new Error("Message is incomplete.");
+ }
+ // content before separator is handshake response
+ // optional content after is additional messages
+ var responseLength = separatorIndex + 1;
+ messageData = String.fromCharCode.apply(null, binaryData.slice(0, responseLength));
+ remainingData = (binaryData.byteLength > responseLength) ? binaryData.slice(responseLength).buffer : null;
+ }
+ else {
+ var textData = data;
+ var separatorIndex = textData.indexOf(TextMessageFormat_1.TextMessageFormat.RecordSeparator);
+ if (separatorIndex === -1) {
+ throw new Error("Message is incomplete.");
+ }
+ // content before separator is handshake response
+ // optional content after is additional messages
+ var responseLength = separatorIndex + 1;
+ messageData = textData.substring(0, responseLength);
+ remainingData = (textData.length > responseLength) ? textData.substring(responseLength) : null;
+ }
+ // At this point we should have just the single handshake message
+ var messages = TextMessageFormat_1.TextMessageFormat.parse(messageData);
+ responseMessage = JSON.parse(messages[0]);
+ // multiple messages could have arrived with handshake
+ // return additional data to be parsed as usual, or null if all parsed
+ return [remainingData, responseMessage];
+ };
+ return HandshakeProtocol;
+}());
+exports.HandshakeProtocol = HandshakeProtocol;
+
+});
+
+unwrapExports(HandshakeProtocol_1);
+var HandshakeProtocol_2 = HandshakeProtocol_1.HandshakeProtocol;
+
+var IHubProtocol = createCommonjsModule(function (module, exports) {
+Object.defineProperty(exports, "__esModule", { value: true });
+/** Defines the type of a Hub Message. */
+var MessageType;
+(function (MessageType) {
+ /** Indicates the message is an Invocation message and implements the {@link InvocationMessage} interface. */
+ MessageType[MessageType["Invocation"] = 1] = "Invocation";
+ /** Indicates the message is a StreamItem message and implements the {@link StreamItemMessage} interface. */
+ MessageType[MessageType["StreamItem"] = 2] = "StreamItem";
+ /** Indicates the message is a Completion message and implements the {@link CompletionMessage} interface. */
+ MessageType[MessageType["Completion"] = 3] = "Completion";
+ /** Indicates the message is a Stream Invocation message and implements the {@link StreamInvocationMessage} interface. */
+ MessageType[MessageType["StreamInvocation"] = 4] = "StreamInvocation";
+ /** Indicates the message is a Cancel Invocation message and implements the {@link CancelInvocationMessage} interface. */
+ MessageType[MessageType["CancelInvocation"] = 5] = "CancelInvocation";
+ /** Indicates the message is a Ping message and implements the {@link PingMessage} interface. */
+ MessageType[MessageType["Ping"] = 6] = "Ping";
+ /** Indicates the message is a Close message and implements the {@link CloseMessage} interface. */
+ MessageType[MessageType["Close"] = 7] = "Close";
+})(MessageType = exports.MessageType || (exports.MessageType = {}));
+
+});
+
+unwrapExports(IHubProtocol);
+var IHubProtocol_1 = IHubProtocol.MessageType;
+
+var Loggers = createCommonjsModule(function (module, exports) {
+Object.defineProperty(exports, "__esModule", { value: true });
+/** A logger that does nothing when log messages are sent to it. */
+var NullLogger = /** @class */ (function () {
+ function NullLogger() {
+ }
+ /** @inheritDoc */
+ NullLogger.prototype.log = function (logLevel, message) {
+ };
+ /** The singleton instance of the {@link NullLogger}. */
+ NullLogger.instance = new NullLogger();
+ return NullLogger;
+}());
+exports.NullLogger = NullLogger;
+
+});
+
+unwrapExports(Loggers);
+var Loggers_1 = Loggers.NullLogger;
+
+var Utils = createCommonjsModule(function (module, exports) {
+Object.defineProperty(exports, "__esModule", { value: true });
+
+
+
+var Arg = /** @class */ (function () {
+ function Arg() {
+ }
+ Arg.isRequired = function (val, name) {
+ if (val === null || val === undefined) {
+ throw new Error("The '" + name + "' argument is required.");
+ }
+ };
+ Arg.isIn = function (val, values, name) {
+ // TypeScript enums have keys for **both** the name and the value of each enum member on the type itself.
+ if (!(val in values)) {
+ throw new Error("Unknown " + name + " value: " + val + ".");
+ }
+ };
+ return Arg;
+}());
+exports.Arg = Arg;
+function getDataDetail(data, includeContent) {
+ var length = null;
+ if (data instanceof ArrayBuffer) {
+ length = "Binary data of length " + data.byteLength;
+ if (includeContent) {
+ length += ". Content: '" + formatArrayBuffer(data) + "'";
+ }
+ }
+ else if (typeof data === "string") {
+ length = "String data of length " + data.length;
+ if (includeContent) {
+ length += ". Content: '" + data + "'.";
+ }
+ }
+ return length;
+}
+exports.getDataDetail = getDataDetail;
+function formatArrayBuffer(data) {
+ var view = new Uint8Array(data);
+ // Uint8Array.map only supports returning another Uint8Array?
+ var str = "";
+ view.forEach(function (num) {
+ var pad = num < 16 ? "0" : "";
+ str += "0x" + pad + num.toString(16) + " ";
+ });
+ // Trim of trailing space.
+ return str.substr(0, str.length - 1);
+}
+exports.formatArrayBuffer = formatArrayBuffer;
+function sendMessage(logger, transportName, httpClient, url, accessTokenFactory, content, logMessageContent) {
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
+ var headers, token, response, _a;
+ return tslib_1.__generator(this, function (_b) {
+ switch (_b.label) {
+ case 0: return [4 /*yield*/, accessTokenFactory()];
+ case 1:
+ token = _b.sent();
+ if (token) {
+ headers = (_a = {}, _a["Authorization"] = "Bearer " + token, _a);
+ }
+ logger.log(ILogger.LogLevel.Trace, "(" + transportName + " transport) sending data. " + getDataDetail(content, logMessageContent) + ".");
+ return [4 /*yield*/, httpClient.post(url, {
+ content: content,
+ headers: headers,
+ })];
+ case 2:
+ response = _b.sent();
+ logger.log(ILogger.LogLevel.Trace, "(" + transportName + " transport) request complete. Response status: " + response.statusCode + ".");
+ return [2 /*return*/];
+ }
+ });
+ });
+}
+exports.sendMessage = sendMessage;
+function createLogger(logger) {
+ if (logger === undefined) {
+ return new ConsoleLogger(ILogger.LogLevel.Information);
+ }
+ if (logger === null) {
+ return Loggers.NullLogger.instance;
+ }
+ if (logger.log) {
+ return logger;
+ }
+ return new ConsoleLogger(logger);
+}
+exports.createLogger = createLogger;
+var Subject = /** @class */ (function () {
+ function Subject(cancelCallback) {
+ this.observers = [];
+ this.cancelCallback = cancelCallback;
+ }
+ Subject.prototype.next = function (item) {
+ for (var _i = 0, _a = this.observers; _i < _a.length; _i++) {
+ var observer = _a[_i];
+ observer.next(item);
+ }
+ };
+ Subject.prototype.error = function (err) {
+ for (var _i = 0, _a = this.observers; _i < _a.length; _i++) {
+ var observer = _a[_i];
+ if (observer.error) {
+ observer.error(err);
+ }
+ }
+ };
+ Subject.prototype.complete = function () {
+ for (var _i = 0, _a = this.observers; _i < _a.length; _i++) {
+ var observer = _a[_i];
+ if (observer.complete) {
+ observer.complete();
+ }
+ }
+ };
+ Subject.prototype.subscribe = function (observer) {
+ this.observers.push(observer);
+ return new SubjectSubscription(this, observer);
+ };
+ return Subject;
+}());
+exports.Subject = Subject;
+var SubjectSubscription = /** @class */ (function () {
+ function SubjectSubscription(subject, observer) {
+ this.subject = subject;
+ this.observer = observer;
+ }
+ SubjectSubscription.prototype.dispose = function () {
+ var index = this.subject.observers.indexOf(this.observer);
+ if (index > -1) {
+ this.subject.observers.splice(index, 1);
+ }
+ if (this.subject.observers.length === 0) {
+ this.subject.cancelCallback().catch(function (_) { });
+ }
+ };
+ return SubjectSubscription;
+}());
+exports.SubjectSubscription = SubjectSubscription;
+var ConsoleLogger = /** @class */ (function () {
+ function ConsoleLogger(minimumLogLevel) {
+ this.minimumLogLevel = minimumLogLevel;
+ }
+ ConsoleLogger.prototype.log = function (logLevel, message) {
+ if (logLevel >= this.minimumLogLevel) {
+ switch (logLevel) {
+ case ILogger.LogLevel.Critical:
+ case ILogger.LogLevel.Error:
+ console.error(ILogger.LogLevel[logLevel] + ": " + message);
+ break;
+ case ILogger.LogLevel.Warning:
+ console.warn(ILogger.LogLevel[logLevel] + ": " + message);
+ break;
+ case ILogger.LogLevel.Information:
+ console.info(ILogger.LogLevel[logLevel] + ": " + message);
+ break;
+ default:
+ // console.debug only goes to attached debuggers in Node, so we use console.log for Trace and Debug
+ console.log(ILogger.LogLevel[logLevel] + ": " + message);
+ break;
+ }
+ }
+ };
+ return ConsoleLogger;
+}());
+exports.ConsoleLogger = ConsoleLogger;
+
+});
+
+unwrapExports(Utils);
+var Utils_1 = Utils.Arg;
+var Utils_2 = Utils.getDataDetail;
+var Utils_3 = Utils.formatArrayBuffer;
+var Utils_4 = Utils.sendMessage;
+var Utils_5 = Utils.createLogger;
+var Utils_6 = Utils.Subject;
+var Utils_7 = Utils.SubjectSubscription;
+var Utils_8 = Utils.ConsoleLogger;
+
+var HubConnection_1 = createCommonjsModule(function (module, exports) {
+Object.defineProperty(exports, "__esModule", { value: true });
+
+
+
+
+
+var DEFAULT_TIMEOUT_IN_MS = 30 * 1000;
+/** Represents a connection to a SignalR Hub. */
+var HubConnection = /** @class */ (function () {
+ function HubConnection(connection, logger, protocol) {
+ var _this = this;
+ Utils.Arg.isRequired(connection, "connection");
+ Utils.Arg.isRequired(logger, "logger");
+ Utils.Arg.isRequired(protocol, "protocol");
+ this.serverTimeoutInMilliseconds = DEFAULT_TIMEOUT_IN_MS;
+ this.logger = logger;
+ this.protocol = protocol;
+ this.connection = connection;
+ this.handshakeProtocol = new HandshakeProtocol_1.HandshakeProtocol();
+ this.connection.onreceive = function (data) { return _this.processIncomingData(data); };
+ this.connection.onclose = function (error) { return _this.connectionClosed(error); };
+ this.callbacks = {};
+ this.methods = {};
+ this.closedCallbacks = [];
+ this.id = 0;
+ }
+ /** @internal */
+ // Using a public static factory method means we can have a private constructor and an _internal_
+ // create method that can be used by HubConnectionBuilder. An "internal" constructor would just
+ // be stripped away and the '.d.ts' file would have no constructor, which is interpreted as a
+ // public parameter-less constructor.
+ HubConnection.create = function (connection, logger, protocol) {
+ return new HubConnection(connection, logger, protocol);
+ };
+ /** Starts the connection.
+ *
+ * @returns {Promise} A Promise that resolves when the connection has been successfully established, or rejects with an error.
+ */
+ HubConnection.prototype.start = function () {
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
+ var handshakeRequest;
+ return tslib_1.__generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ handshakeRequest = {
+ protocol: this.protocol.name,
+ version: this.protocol.version,
+ };
+ this.logger.log(ILogger.LogLevel.Debug, "Starting HubConnection.");
+ this.receivedHandshakeResponse = false;
+ return [4 /*yield*/, this.connection.start(this.protocol.transferFormat)];
+ case 1:
+ _a.sent();
+ this.logger.log(ILogger.LogLevel.Debug, "Sending handshake request.");
+ return [4 /*yield*/, this.connection.send(this.handshakeProtocol.writeHandshakeRequest(handshakeRequest))];
+ case 2:
+ _a.sent();
+ this.logger.log(ILogger.LogLevel.Information, "Using HubProtocol '" + this.protocol.name + "'.");
+ // defensively cleanup timeout in case we receive a message from the server before we finish start
+ this.cleanupTimeout();
+ this.configureTimeout();
+ return [2 /*return*/];
+ }
+ });
+ });
+ };
+ /** Stops the connection.
+ *
+ * @returns {Promise} A Promise that resolves when the connection has been successfully terminated, or rejects with an error.
+ */
+ HubConnection.prototype.stop = function () {
+ this.logger.log(ILogger.LogLevel.Debug, "Stopping HubConnection.");
+ this.cleanupTimeout();
+ return this.connection.stop();
+ };
+ /** Invokes a streaming hub method on the server using the specified name and arguments.
+ *
+ * @typeparam T The type of the items returned by the server.
+ * @param {string} methodName The name of the server method to invoke.
+ * @param {any[]} args The arguments used to invoke the server method.
+ * @returns {IStreamResult} An object that yields results from the server as they are received.
+ */
+ HubConnection.prototype.stream = function (methodName) {
+ var _this = this;
+ var args = [];
+ for (var _i = 1; _i < arguments.length; _i++) {
+ args[_i - 1] = arguments[_i];
+ }
+ var invocationDescriptor = this.createStreamInvocation(methodName, args);
+ var subject = new Utils.Subject(function () {
+ var cancelInvocation = _this.createCancelInvocation(invocationDescriptor.invocationId);
+ var cancelMessage = _this.protocol.writeMessage(cancelInvocation);
+ delete _this.callbacks[invocationDescriptor.invocationId];
+ return _this.connection.send(cancelMessage);
+ });
+ this.callbacks[invocationDescriptor.invocationId] = function (invocationEvent, error) {
+ if (error) {
+ subject.error(error);
+ return;
+ }
+ if (invocationEvent.type === IHubProtocol.MessageType.Completion) {
+ if (invocationEvent.error) {
+ subject.error(new Error(invocationEvent.error));
+ }
+ else {
+ subject.complete();
+ }
+ }
+ else {
+ subject.next((invocationEvent.item));
+ }
+ };
+ var message = this.protocol.writeMessage(invocationDescriptor);
+ this.connection.send(message)
+ .catch(function (e) {
+ subject.error(e);
+ delete _this.callbacks[invocationDescriptor.invocationId];
+ });
+ return subject;
+ };
+ /** Invokes a hub method on the server using the specified name and arguments. Does not wait for a response from the receiver.
+ *
+ * The Promise returned by this method resolves when the client has sent the invocation to the server. The server may still
+ * be processing the invocation.
+ *
+ * @param {string} methodName The name of the server method to invoke.
+ * @param {any[]} args The arguments used to invoke the server method.
+ * @returns {Promise} A Promise that resolves when the invocation has been successfully sent, or rejects with an error.
+ */
+ HubConnection.prototype.send = function (methodName) {
+ var args = [];
+ for (var _i = 1; _i < arguments.length; _i++) {
+ args[_i - 1] = arguments[_i];
+ }
+ var invocationDescriptor = this.createInvocation(methodName, args, true);
+ var message = this.protocol.writeMessage(invocationDescriptor);
+ return this.connection.send(message);
+ };
+ /** Invokes a hub method on the server using the specified name and arguments.
+ *
+ * The Promise returned by this method resolves when the server indicates it has finished invoking the method. When the promise
+ * resolves, the server has finished invoking the method. If the server method returns a result, it is produced as the result of
+ * resolving the Promise.
+ *
+ * @typeparam T The expected return type.
+ * @param {string} methodName The name of the server method to invoke.
+ * @param {any[]} args The arguments used to invoke the server method.
+ * @returns {Promise} A Promise that resolves with the result of the server method (if any), or rejects with an error.
+ */
+ HubConnection.prototype.invoke = function (methodName) {
+ var _this = this;
+ var args = [];
+ for (var _i = 1; _i < arguments.length; _i++) {
+ args[_i - 1] = arguments[_i];
+ }
+ var invocationDescriptor = this.createInvocation(methodName, args, false);
+ var p = new Promise(function (resolve, reject) {
+ _this.callbacks[invocationDescriptor.invocationId] = function (invocationEvent, error) {
+ if (error) {
+ reject(error);
+ return;
+ }
+ if (invocationEvent.type === IHubProtocol.MessageType.Completion) {
+ var completionMessage = invocationEvent;
+ if (completionMessage.error) {
+ reject(new Error(completionMessage.error));
+ }
+ else {
+ resolve(completionMessage.result);
+ }
+ }
+ else {
+ reject(new Error("Unexpected message type: " + invocationEvent.type));
+ }
+ };
+ var message = _this.protocol.writeMessage(invocationDescriptor);
+ _this.connection.send(message)
+ .catch(function (e) {
+ reject(e);
+ delete _this.callbacks[invocationDescriptor.invocationId];
+ });
+ });
+ return p;
+ };
+ /** Registers a handler that will be invoked when the hub method with the specified method name is invoked.
+ *
+ * @param {string} methodName The name of the hub method to define.
+ * @param {Function} newMethod The handler that will be raised when the hub method is invoked.
+ */
+ HubConnection.prototype.on = function (methodName, newMethod) {
+ if (!methodName || !newMethod) {
+ return;
+ }
+ methodName = methodName.toLowerCase();
+ if (!this.methods[methodName]) {
+ this.methods[methodName] = [];
+ }
+ // Preventing adding the same handler multiple times.
+ if (this.methods[methodName].indexOf(newMethod) !== -1) {
+ return;
+ }
+ this.methods[methodName].push(newMethod);
+ };
+ HubConnection.prototype.off = function (methodName, method) {
+ if (!methodName) {
+ return;
+ }
+ methodName = methodName.toLowerCase();
+ var handlers = this.methods[methodName];
+ if (!handlers) {
+ return;
+ }
+ if (method) {
+ var removeIdx = handlers.indexOf(method);
+ if (removeIdx !== -1) {
+ handlers.splice(removeIdx, 1);
+ if (handlers.length === 0) {
+ delete this.methods[methodName];
+ }
+ }
+ }
+ else {
+ delete this.methods[methodName];
+ }
+ };
+ /** Registers a handler that will be invoked when the connection is closed.
+ *
+ * @param {Function} callback The handler that will be invoked when the connection is closed. Optionally receives a single argument containing the error that caused the connection to close (if any).
+ */
+ HubConnection.prototype.onclose = function (callback) {
+ if (callback) {
+ this.closedCallbacks.push(callback);
+ }
+ };
+ HubConnection.prototype.processIncomingData = function (data) {
+ this.cleanupTimeout();
+ if (!this.receivedHandshakeResponse) {
+ data = this.processHandshakeResponse(data);
+ this.receivedHandshakeResponse = true;
+ }
+ // Data may have all been read when processing handshake response
+ if (data) {
+ // Parse the messages
+ var messages = this.protocol.parseMessages(data, this.logger);
+ for (var _i = 0, messages_1 = messages; _i < messages_1.length; _i++) {
+ var message = messages_1[_i];
+ switch (message.type) {
+ case IHubProtocol.MessageType.Invocation:
+ this.invokeClientMethod(message);
+ break;
+ case IHubProtocol.MessageType.StreamItem:
+ case IHubProtocol.MessageType.Completion:
+ var callback = this.callbacks[message.invocationId];
+ if (callback != null) {
+ if (message.type === IHubProtocol.MessageType.Completion) {
+ delete this.callbacks[message.invocationId];
+ }
+ callback(message);
+ }
+ break;
+ case IHubProtocol.MessageType.Ping:
+ // Don't care about pings
+ break;
+ case IHubProtocol.MessageType.Close:
+ this.logger.log(ILogger.LogLevel.Information, "Close message received from server.");
+ this.connection.stop(message.error ? new Error("Server returned an error on close: " + message.error) : null);
+ break;
+ default:
+ this.logger.log(ILogger.LogLevel.Warning, "Invalid message type: " + message.type);
+ break;
+ }
+ }
+ }
+ this.configureTimeout();
+ };
+ HubConnection.prototype.processHandshakeResponse = function (data) {
+ var responseMessage;
+ var remainingData;
+ try {
+ _a = this.handshakeProtocol.parseHandshakeResponse(data), remainingData = _a[0], responseMessage = _a[1];
+ }
+ catch (e) {
+ var message = "Error parsing handshake response: " + e;
+ this.logger.log(ILogger.LogLevel.Error, message);
+ var error = new Error(message);
+ this.connection.stop(error);
+ throw error;
+ }
+ if (responseMessage.error) {
+ var message = "Server returned handshake error: " + responseMessage.error;
+ this.logger.log(ILogger.LogLevel.Error, message);
+ this.connection.stop(new Error(message));
+ }
+ else {
+ this.logger.log(ILogger.LogLevel.Debug, "Server handshake complete.");
+ }
+ return remainingData;
+ var _a;
+ };
+ HubConnection.prototype.configureTimeout = function () {
+ var _this = this;
+ if (!this.connection.features || !this.connection.features.inherentKeepAlive) {
+ // Set the timeout timer
+ this.timeoutHandle = setTimeout(function () { return _this.serverTimeout(); }, this.serverTimeoutInMilliseconds);
+ }
+ };
+ HubConnection.prototype.serverTimeout = function () {
+ // The server hasn't talked to us in a while. It doesn't like us anymore ... :(
+ // Terminate the connection
+ this.connection.stop(new Error("Server timeout elapsed without receiving a message from the server."));
+ };
+ HubConnection.prototype.invokeClientMethod = function (invocationMessage) {
+ var _this = this;
+ var methods = this.methods[invocationMessage.target.toLowerCase()];
+ if (methods) {
+ methods.forEach(function (m) { return m.apply(_this, invocationMessage.arguments); });
+ if (invocationMessage.invocationId) {
+ // This is not supported in v1. So we return an error to avoid blocking the server waiting for the response.
+ var message = "Server requested a response, which is not supported in this version of the client.";
+ this.logger.log(ILogger.LogLevel.Error, message);
+ this.connection.stop(new Error(message));
+ }
+ }
+ else {
+ this.logger.log(ILogger.LogLevel.Warning, "No client method with the name '" + invocationMessage.target + "' found.");
+ }
+ };
+ HubConnection.prototype.connectionClosed = function (error) {
+ var _this = this;
+ var callbacks = this.callbacks;
+ this.callbacks = {};
+ Object.keys(callbacks)
+ .forEach(function (key) {
+ var callback = callbacks[key];
+ callback(undefined, error ? error : new Error("Invocation canceled due to connection being closed."));
+ });
+ this.cleanupTimeout();
+ this.closedCallbacks.forEach(function (c) { return c.apply(_this, [error]); });
+ };
+ HubConnection.prototype.cleanupTimeout = function () {
+ if (this.timeoutHandle) {
+ clearTimeout(this.timeoutHandle);
+ }
+ };
+ HubConnection.prototype.createInvocation = function (methodName, args, nonblocking) {
+ if (nonblocking) {
+ return {
+ arguments: args,
+ target: methodName,
+ type: IHubProtocol.MessageType.Invocation,
+ };
+ }
+ else {
+ var id = this.id;
+ this.id++;
+ return {
+ arguments: args,
+ invocationId: id.toString(),
+ target: methodName,
+ type: IHubProtocol.MessageType.Invocation,
+ };
+ }
+ };
+ HubConnection.prototype.createStreamInvocation = function (methodName, args) {
+ var id = this.id;
+ this.id++;
+ return {
+ arguments: args,
+ invocationId: id.toString(),
+ target: methodName,
+ type: IHubProtocol.MessageType.StreamInvocation,
+ };
+ };
+ HubConnection.prototype.createCancelInvocation = function (id) {
+ return {
+ invocationId: id,
+ type: IHubProtocol.MessageType.CancelInvocation,
+ };
+ };
+ return HubConnection;
+}());
+exports.HubConnection = HubConnection;
+
+});
+
+unwrapExports(HubConnection_1);
+var HubConnection_2 = HubConnection_1.HubConnection;
+
+var ITransport = createCommonjsModule(function (module, exports) {
+Object.defineProperty(exports, "__esModule", { value: true });
+// This will be treated as a bit flag in the future, so we keep it using power-of-two values.
+/** Specifies a specific HTTP transport type. */
+var HttpTransportType;
+(function (HttpTransportType) {
+ /** Specifies no transport preference. */
+ HttpTransportType[HttpTransportType["None"] = 0] = "None";
+ /** Specifies the WebSockets transport. */
+ HttpTransportType[HttpTransportType["WebSockets"] = 1] = "WebSockets";
+ /** Specifies the Server-Sent Events transport. */
+ HttpTransportType[HttpTransportType["ServerSentEvents"] = 2] = "ServerSentEvents";
+ /** Specifies the Long Polling transport. */
+ HttpTransportType[HttpTransportType["LongPolling"] = 4] = "LongPolling";
+})(HttpTransportType = exports.HttpTransportType || (exports.HttpTransportType = {}));
+/** Specifies the transfer format for a connection. */
+var TransferFormat;
+(function (TransferFormat) {
+ /** Specifies that only text data will be transmitted over the connection. */
+ TransferFormat[TransferFormat["Text"] = 1] = "Text";
+ /** Specifies that binary data will be transmitted over the connection. */
+ TransferFormat[TransferFormat["Binary"] = 2] = "Binary";
+})(TransferFormat = exports.TransferFormat || (exports.TransferFormat = {}));
+
+});
+
+unwrapExports(ITransport);
+var ITransport_1 = ITransport.HttpTransportType;
+var ITransport_2 = ITransport.TransferFormat;
+
+var AbortController_1 = createCommonjsModule(function (module, exports) {
+Object.defineProperty(exports, "__esModule", { value: true });
+// Rough polyfill of https://developer.mozilla.org/en-US/docs/Web/API/AbortController
+// We don't actually ever use the API being polyfilled, we always use the polyfill because
+// it's a very new API right now.
+// Not exported from index.
+var AbortController = /** @class */ (function () {
+ function AbortController() {
+ this.isAborted = false;
+ }
+ AbortController.prototype.abort = function () {
+ if (!this.isAborted) {
+ this.isAborted = true;
+ if (this.onabort) {
+ this.onabort();
+ }
+ }
+ };
+ Object.defineProperty(AbortController.prototype, "signal", {
+ get: function () {
+ return this;
+ },
+ enumerable: true,
+ configurable: true
+ });
+ Object.defineProperty(AbortController.prototype, "aborted", {
+ get: function () {
+ return this.isAborted;
+ },
+ enumerable: true,
+ configurable: true
+ });
+ return AbortController;
+}());
+exports.AbortController = AbortController;
+
+});
+
+unwrapExports(AbortController_1);
+var AbortController_2 = AbortController_1.AbortController;
+
+var LongPollingTransport_1 = createCommonjsModule(function (module, exports) {
+Object.defineProperty(exports, "__esModule", { value: true });
+
+
+
+
+
+
+var SHUTDOWN_TIMEOUT = 5 * 1000;
+// Not exported from 'index', this type is internal.
+var LongPollingTransport = /** @class */ (function () {
+ function LongPollingTransport(httpClient, accessTokenFactory, logger, logMessageContent, shutdownTimeout) {
+ this.httpClient = httpClient;
+ this.accessTokenFactory = accessTokenFactory || (function () { return null; });
+ this.logger = logger;
+ this.pollAbort = new AbortController_1.AbortController();
+ this.logMessageContent = logMessageContent;
+ this.shutdownTimeout = shutdownTimeout || SHUTDOWN_TIMEOUT;
+ }
+ Object.defineProperty(LongPollingTransport.prototype, "pollAborted", {
+ // This is an internal type, not exported from 'index' so this is really just internal.
+ get: function () {
+ return this.pollAbort.aborted;
+ },
+ enumerable: true,
+ configurable: true
+ });
+ LongPollingTransport.prototype.connect = function (url, transferFormat) {
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
+ var pollOptions, token, closeError, pollUrl, response;
+ return tslib_1.__generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ Utils.Arg.isRequired(url, "url");
+ Utils.Arg.isRequired(transferFormat, "transferFormat");
+ Utils.Arg.isIn(transferFormat, ITransport.TransferFormat, "transferFormat");
+ this.url = url;
+ this.logger.log(ILogger.LogLevel.Trace, "(LongPolling transport) Connecting");
+ if (transferFormat === ITransport.TransferFormat.Binary && (typeof new XMLHttpRequest().responseType !== "string")) {
+ // This will work if we fix: https://github.com/aspnet/SignalR/issues/742
+ throw new Error("Binary protocols over XmlHttpRequest not implementing advanced features are not supported.");
+ }
+ pollOptions = {
+ abortSignal: this.pollAbort.signal,
+ headers: {},
+ timeout: 90000,
+ };
+ if (transferFormat === ITransport.TransferFormat.Binary) {
+ pollOptions.responseType = "arraybuffer";
+ }
+ return [4 /*yield*/, this.accessTokenFactory()];
+ case 1:
+ token = _a.sent();
+ this.updateHeaderToken(pollOptions, token);
+ pollUrl = url + "&_=" + Date.now();
+ this.logger.log(ILogger.LogLevel.Trace, "(LongPolling transport) polling: " + pollUrl);
+ return [4 /*yield*/, this.httpClient.get(pollUrl, pollOptions)];
+ case 2:
+ response = _a.sent();
+ if (response.statusCode !== 200) {
+ this.logger.log(ILogger.LogLevel.Error, "(LongPolling transport) Unexpected response code: " + response.statusCode);
+ // Mark running as false so that the poll immediately ends and runs the close logic
+ closeError = new Errors.HttpError(response.statusText, response.statusCode);
+ this.running = false;
+ }
+ else {
+ this.running = true;
+ }
+ this.poll(this.url, pollOptions, closeError);
+ return [2 /*return*/, Promise.resolve()];
+ }
+ });
+ });
+ };
+ LongPollingTransport.prototype.updateHeaderToken = function (request, token) {
+ if (token) {
+ // tslint:disable-next-line:no-string-literal
+ request.headers["Authorization"] = "Bearer " + token;
+ return;
+ }
+ // tslint:disable-next-line:no-string-literal
+ if (request.headers["Authorization"]) {
+ // tslint:disable-next-line:no-string-literal
+ delete request.headers["Authorization"];
+ }
+ };
+ LongPollingTransport.prototype.poll = function (url, pollOptions, closeError) {
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
+ var token, pollUrl, response, e_1;
+ return tslib_1.__generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ _a.trys.push([0, , 8, 9]);
+ _a.label = 1;
+ case 1:
+ if (!this.running) return [3 /*break*/, 7];
+ return [4 /*yield*/, this.accessTokenFactory()];
+ case 2:
+ token = _a.sent();
+ this.updateHeaderToken(pollOptions, token);
+ _a.label = 3;
+ case 3:
+ _a.trys.push([3, 5, , 6]);
+ pollUrl = url + "&_=" + Date.now();
+ this.logger.log(ILogger.LogLevel.Trace, "(LongPolling transport) polling: " + pollUrl);
+ return [4 /*yield*/, this.httpClient.get(pollUrl, pollOptions)];
+ case 4:
+ response = _a.sent();
+ if (response.statusCode === 204) {
+ this.logger.log(ILogger.LogLevel.Information, "(LongPolling transport) Poll terminated by server");
+ this.running = false;
+ }
+ else if (response.statusCode !== 200) {
+ this.logger.log(ILogger.LogLevel.Error, "(LongPolling transport) Unexpected response code: " + response.statusCode);
+ // Unexpected status code
+ closeError = new Errors.HttpError(response.statusText, response.statusCode);
+ this.running = false;
+ }
+ else {
+ // Process the response
+ if (response.content) {
+ this.logger.log(ILogger.LogLevel.Trace, "(LongPolling transport) data received. " + Utils.getDataDetail(response.content, this.logMessageContent));
+ if (this.onreceive) {
+ this.onreceive(response.content);
+ }
+ }
+ else {
+ // This is another way timeout manifest.
+ this.logger.log(ILogger.LogLevel.Trace, "(LongPolling transport) Poll timed out, reissuing.");
+ }
+ }
+ return [3 /*break*/, 6];
+ case 5:
+ e_1 = _a.sent();
+ if (!this.running) {
+ // Log but disregard errors that occur after we were stopped by DELETE
+ this.logger.log(ILogger.LogLevel.Trace, "(LongPolling transport) Poll errored after shutdown: " + e_1.message);
+ }
+ else {
+ if (e_1 instanceof Errors.TimeoutError) {
+ // Ignore timeouts and reissue the poll.
+ this.logger.log(ILogger.LogLevel.Trace, "(LongPolling transport) Poll timed out, reissuing.");
+ }
+ else {
+ // Close the connection with the error as the result.
+ closeError = e_1;
+ this.running = false;
+ }
+ }
+ return [3 /*break*/, 6];
+ case 6: return [3 /*break*/, 1];
+ case 7: return [3 /*break*/, 9];
+ case 8:
+ // Indicate that we've stopped so the shutdown timer doesn't get registered.
+ this.stopped = true;
+ // Clean up the shutdown timer if it was registered
+ if (this.shutdownTimer) {
+ clearTimeout(this.shutdownTimer);
+ }
+ // Fire our onclosed event
+ if (this.onclose) {
+ this.logger.log(ILogger.LogLevel.Trace, "(LongPolling transport) Firing onclose event. Error: " + (closeError || ""));
+ this.onclose(closeError);
+ }
+ this.logger.log(ILogger.LogLevel.Trace, "(LongPolling transport) Transport finished.");
+ return [7 /*endfinally*/];
+ case 9: return [2 /*return*/];
+ }
+ });
+ });
+ };
+ LongPollingTransport.prototype.send = function (data) {
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
+ return tslib_1.__generator(this, function (_a) {
+ if (!this.running) {
+ return [2 /*return*/, Promise.reject(new Error("Cannot send until the transport is connected"))];
+ }
+ return [2 /*return*/, Utils.sendMessage(this.logger, "LongPolling", this.httpClient, this.url, this.accessTokenFactory, data, this.logMessageContent)];
+ });
+ });
+ };
+ LongPollingTransport.prototype.stop = function () {
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
+ var _this = this;
+ var deleteOptions, token, response;
+ return tslib_1.__generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ _a.trys.push([0, , 3, 4]);
+ this.running = false;
+ this.logger.log(ILogger.LogLevel.Trace, "(LongPolling transport) sending DELETE request to " + this.url + ".");
+ deleteOptions = {
+ headers: {},
+ };
+ return [4 /*yield*/, this.accessTokenFactory()];
+ case 1:
+ token = _a.sent();
+ this.updateHeaderToken(deleteOptions, token);
+ return [4 /*yield*/, this.httpClient.delete(this.url, deleteOptions)];
+ case 2:
+ response = _a.sent();
+ this.logger.log(ILogger.LogLevel.Trace, "(LongPolling transport) DELETE request accepted.");
+ return [3 /*break*/, 4];
+ case 3:
+ // Abort the poll after the shutdown timeout if the server doesn't stop the poll.
+ if (!this.stopped) {
+ this.shutdownTimer = setTimeout(function () {
+ _this.logger.log(ILogger.LogLevel.Warning, "(LongPolling transport) server did not terminate after DELETE request, canceling poll.");
+ // Abort any outstanding poll
+ _this.pollAbort.abort();
+ }, this.shutdownTimeout);
+ }
+ return [7 /*endfinally*/];
+ case 4: return [2 /*return*/];
+ }
+ });
+ });
+ };
+ return LongPollingTransport;
+}());
+exports.LongPollingTransport = LongPollingTransport;
+
+});
+
+unwrapExports(LongPollingTransport_1);
+var LongPollingTransport_2 = LongPollingTransport_1.LongPollingTransport;
+
+var ServerSentEventsTransport_1 = createCommonjsModule(function (module, exports) {
+Object.defineProperty(exports, "__esModule", { value: true });
+
+
+
+
+var ServerSentEventsTransport = /** @class */ (function () {
+ function ServerSentEventsTransport(httpClient, accessTokenFactory, logger, logMessageContent) {
+ this.httpClient = httpClient;
+ this.accessTokenFactory = accessTokenFactory || (function () { return null; });
+ this.logger = logger;
+ this.logMessageContent = logMessageContent;
+ }
+ ServerSentEventsTransport.prototype.connect = function (url, transferFormat) {
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
+ var _this = this;
+ var token;
+ return tslib_1.__generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ Utils.Arg.isRequired(url, "url");
+ Utils.Arg.isRequired(transferFormat, "transferFormat");
+ Utils.Arg.isIn(transferFormat, ITransport.TransferFormat, "transferFormat");
+ if (typeof (EventSource) === "undefined") {
+ throw new Error("'EventSource' is not supported in your environment.");
+ }
+ this.logger.log(ILogger.LogLevel.Trace, "(SSE transport) Connecting");
+ return [4 /*yield*/, this.accessTokenFactory()];
+ case 1:
+ token = _a.sent();
+ if (token) {
+ url += (url.indexOf("?") < 0 ? "?" : "&") + ("access_token=" + encodeURIComponent(token));
+ }
+ this.url = url;
+ return [2 /*return*/, new Promise(function (resolve, reject) {
+ var opened = false;
+ if (transferFormat !== ITransport.TransferFormat.Text) {
+ reject(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"));
+ }
+ var eventSource = new EventSource(url, { withCredentials: true });
+ try {
+ eventSource.onmessage = function (e) {
+ if (_this.onreceive) {
+ try {
+ _this.logger.log(ILogger.LogLevel.Trace, "(SSE transport) data received. " + Utils.getDataDetail(e.data, _this.logMessageContent) + ".");
+ _this.onreceive(e.data);
+ }
+ catch (error) {
+ if (_this.onclose) {
+ _this.onclose(error);
+ }
+ return;
+ }
+ }
+ };
+ eventSource.onerror = function (e) {
+ var error = new Error(e.message || "Error occurred");
+ if (opened) {
+ _this.close(error);
+ }
+ else {
+ reject(error);
+ }
+ };
+ eventSource.onopen = function () {
+ _this.logger.log(ILogger.LogLevel.Information, "SSE connected to " + _this.url);
+ _this.eventSource = eventSource;
+ opened = true;
+ resolve();
+ };
+ }
+ catch (e) {
+ return Promise.reject(e);
+ }
+ })];
+ }
+ });
+ });
+ };
+ ServerSentEventsTransport.prototype.send = function (data) {
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
+ return tslib_1.__generator(this, function (_a) {
+ if (!this.eventSource) {
+ return [2 /*return*/, Promise.reject(new Error("Cannot send until the transport is connected"))];
+ }
+ return [2 /*return*/, Utils.sendMessage(this.logger, "SSE", this.httpClient, this.url, this.accessTokenFactory, data, this.logMessageContent)];
+ });
+ });
+ };
+ ServerSentEventsTransport.prototype.stop = function () {
+ this.close();
+ return Promise.resolve();
+ };
+ ServerSentEventsTransport.prototype.close = function (e) {
+ if (this.eventSource) {
+ this.eventSource.close();
+ this.eventSource = null;
+ if (this.onclose) {
+ this.onclose(e);
+ }
+ }
+ };
+ return ServerSentEventsTransport;
+}());
+exports.ServerSentEventsTransport = ServerSentEventsTransport;
+
+});
+
+unwrapExports(ServerSentEventsTransport_1);
+var ServerSentEventsTransport_2 = ServerSentEventsTransport_1.ServerSentEventsTransport;
+
+var WebSocketTransport_1 = createCommonjsModule(function (module, exports) {
+Object.defineProperty(exports, "__esModule", { value: true });
+
+
+
+
+var WebSocketTransport = /** @class */ (function () {
+ function WebSocketTransport(accessTokenFactory, logger, logMessageContent) {
+ this.logger = logger;
+ this.accessTokenFactory = accessTokenFactory || (function () { return null; });
+ this.logMessageContent = logMessageContent;
+ }
+ WebSocketTransport.prototype.connect = function (url, transferFormat) {
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
+ var _this = this;
+ var token;
+ return tslib_1.__generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ Utils.Arg.isRequired(url, "url");
+ Utils.Arg.isRequired(transferFormat, "transferFormat");
+ Utils.Arg.isIn(transferFormat, ITransport.TransferFormat, "transferFormat");
+ if (typeof (WebSocket) === "undefined") {
+ throw new Error("'WebSocket' is not supported in your environment.");
+ }
+ this.logger.log(ILogger.LogLevel.Trace, "(WebSockets transport) Connecting");
+ return [4 /*yield*/, this.accessTokenFactory()];
+ case 1:
+ token = _a.sent();
+ if (token) {
+ url += (url.indexOf("?") < 0 ? "?" : "&") + ("access_token=" + encodeURIComponent(token));
+ }
+ return [2 /*return*/, new Promise(function (resolve, reject) {
+ url = url.replace(/^http/, "ws");
+ var webSocket = new WebSocket(url);
+ if (transferFormat === ITransport.TransferFormat.Binary) {
+ webSocket.binaryType = "arraybuffer";
+ }
+ webSocket.onopen = function (event) {
+ _this.logger.log(ILogger.LogLevel.Information, "WebSocket connected to " + url);
+ _this.webSocket = webSocket;
+ resolve();
+ };
+ webSocket.onerror = function (event) {
+ reject(event.error);
+ };
+ webSocket.onmessage = function (message) {
+ _this.logger.log(ILogger.LogLevel.Trace, "(WebSockets transport) data received. " + Utils.getDataDetail(message.data, _this.logMessageContent) + ".");
+ if (_this.onreceive) {
+ _this.onreceive(message.data);
+ }
+ };
+ webSocket.onclose = function (event) {
+ // webSocket will be null if the transport did not start successfully
+ _this.logger.log(ILogger.LogLevel.Trace, "(WebSockets transport) socket closed.");
+ if (_this.onclose) {
+ if (event.wasClean === false || event.code !== 1000) {
+ _this.onclose(new Error("Websocket closed with status code: " + event.code + " (" + event.reason + ")"));
+ }
+ else {
+ _this.onclose();
+ }
+ }
+ };
+ })];
+ }
+ });
+ });
+ };
+ WebSocketTransport.prototype.send = function (data) {
+ if (this.webSocket && this.webSocket.readyState === WebSocket.OPEN) {
+ this.logger.log(ILogger.LogLevel.Trace, "(WebSockets transport) sending data. " + Utils.getDataDetail(data, this.logMessageContent) + ".");
+ this.webSocket.send(data);
+ return Promise.resolve();
+ }
+ return Promise.reject("WebSocket is not in the OPEN state");
+ };
+ WebSocketTransport.prototype.stop = function () {
+ if (this.webSocket) {
+ this.webSocket.close();
+ this.webSocket = null;
+ }
+ return Promise.resolve();
+ };
+ return WebSocketTransport;
+}());
+exports.WebSocketTransport = WebSocketTransport;
+
+});
+
+unwrapExports(WebSocketTransport_1);
+var WebSocketTransport_2 = WebSocketTransport_1.WebSocketTransport;
+
+var HttpConnection_1 = createCommonjsModule(function (module, exports) {
+Object.defineProperty(exports, "__esModule", { value: true });
+
+
+
+
+
+
+
+
+var MAX_REDIRECTS = 100;
+var HttpConnection = /** @class */ (function () {
+ function HttpConnection(url, options) {
+ if (options === void 0) { options = {}; }
+ this.features = {};
+ Utils.Arg.isRequired(url, "url");
+ this.logger = Utils.createLogger(options.logger);
+ this.baseUrl = this.resolveUrl(url);
+ options = options || {};
+ options.accessTokenFactory = options.accessTokenFactory || (function () { return null; });
+ options.logMessageContent = options.logMessageContent || false;
+ this.httpClient = options.httpClient || new HttpClient_1.DefaultHttpClient(this.logger);
+ this.connectionState = 2 /* Disconnected */;
+ this.options = options;
+ }
+ HttpConnection.prototype.start = function (transferFormat) {
+ transferFormat = transferFormat || ITransport.TransferFormat.Binary;
+ Utils.Arg.isIn(transferFormat, ITransport.TransferFormat, "transferFormat");
+ this.logger.log(ILogger.LogLevel.Debug, "Starting connection with transfer format '" + ITransport.TransferFormat[transferFormat] + "'.");
+ if (this.connectionState !== 2 /* Disconnected */) {
+ return Promise.reject(new Error("Cannot start a connection that is not in the 'Disconnected' state."));
+ }
+ this.connectionState = 0 /* Connecting */;
+ this.startPromise = this.startInternal(transferFormat);
+ return this.startPromise;
+ };
+ HttpConnection.prototype.send = function (data) {
+ if (this.connectionState !== 1 /* Connected */) {
+ throw new Error("Cannot send data if the connection is not in the 'Connected' State.");
+ }
+ return this.transport.send(data);
+ };
+ HttpConnection.prototype.stop = function (error) {
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
+ var e_1;
+ return tslib_1.__generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ this.connectionState = 2 /* Disconnected */;
+ _a.label = 1;
+ case 1:
+ _a.trys.push([1, 3, , 4]);
+ return [4 /*yield*/, this.startPromise];
+ case 2:
+ _a.sent();
+ return [3 /*break*/, 4];
+ case 3:
+ e_1 = _a.sent();
+ return [3 /*break*/, 4];
+ case 4:
+ if (!this.transport) return [3 /*break*/, 6];
+ this.stopError = error;
+ return [4 /*yield*/, this.transport.stop()];
+ case 5:
+ _a.sent();
+ this.transport = null;
+ _a.label = 6;
+ case 6: return [2 /*return*/];
+ }
+ });
+ });
+ };
+ HttpConnection.prototype.startInternal = function (transferFormat) {
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
+ var _this = this;
+ var url, negotiateResponse, redirects, _loop_1, this_1, state_1, e_2;
+ return tslib_1.__generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ url = this.baseUrl;
+ this.accessTokenFactory = this.options.accessTokenFactory;
+ _a.label = 1;
+ case 1:
+ _a.trys.push([1, 12, , 13]);
+ if (!this.options.skipNegotiation) return [3 /*break*/, 5];
+ if (!(this.options.transport === ITransport.HttpTransportType.WebSockets)) return [3 /*break*/, 3];
+ // No need to add a connection ID in this case
+ this.transport = this.constructTransport(ITransport.HttpTransportType.WebSockets);
+ // We should just call connect directly in this case.
+ // No fallback or negotiate in this case.
+ return [4 /*yield*/, this.transport.connect(url, transferFormat)];
+ case 2:
+ // We should just call connect directly in this case.
+ // No fallback or negotiate in this case.
+ _a.sent();
+ return [3 /*break*/, 4];
+ case 3: throw Error("Negotiation can only be skipped when using the WebSocket transport directly.");
+ case 4: return [3 /*break*/, 11];
+ case 5:
+ negotiateResponse = null;
+ redirects = 0;
+ _loop_1 = function () {
+ var accessToken_1;
+ return tslib_1.__generator(this, function (_a) {
+ switch (_a.label) {
+ case 0: return [4 /*yield*/, this_1.getNegotiationResponse(url)];
+ case 1:
+ negotiateResponse = _a.sent();
+ // the user tries to stop the connection when it is being started
+ if (this_1.connectionState === 2 /* Disconnected */) {
+ return [2 /*return*/, { value: void 0 }];
+ }
+ if (negotiateResponse.url) {
+ url = negotiateResponse.url;
+ }
+ if (negotiateResponse.accessToken) {
+ accessToken_1 = negotiateResponse.accessToken;
+ this_1.accessTokenFactory = function () { return accessToken_1; };
+ }
+ redirects++;
+ return [2 /*return*/];
+ }
+ });
+ };
+ this_1 = this;
+ _a.label = 6;
+ case 6: return [5 /*yield**/, _loop_1()];
+ case 7:
+ state_1 = _a.sent();
+ if (typeof state_1 === "object")
+ return [2 /*return*/, state_1.value];
+ _a.label = 8;
+ case 8:
+ if (negotiateResponse.url && redirects < MAX_REDIRECTS) return [3 /*break*/, 6];
+ _a.label = 9;
+ case 9:
+ if (redirects === MAX_REDIRECTS && negotiateResponse.url) {
+ throw Error("Negotiate redirection limit exceeded.");
+ }
+ return [4 /*yield*/, this.createTransport(url, this.options.transport, negotiateResponse, transferFormat)];
+ case 10:
+ _a.sent();
+ _a.label = 11;
+ case 11:
+ if (this.transport instanceof LongPollingTransport_1.LongPollingTransport) {
+ this.features.inherentKeepAlive = true;
+ }
+ this.transport.onreceive = this.onreceive;
+ this.transport.onclose = function (e) { return _this.stopConnection(e); };
+ // only change the state if we were connecting to not overwrite
+ // the state if the connection is already marked as Disconnected
+ this.changeState(0 /* Connecting */, 1 /* Connected */);
+ return [3 /*break*/, 13];
+ case 12:
+ e_2 = _a.sent();
+ this.logger.log(ILogger.LogLevel.Error, "Failed to start the connection: " + e_2);
+ this.connectionState = 2 /* Disconnected */;
+ this.transport = null;
+ throw e_2;
+ case 13: return [2 /*return*/];
+ }
+ });
+ });
+ };
+ HttpConnection.prototype.getNegotiationResponse = function (url) {
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
+ var token, headers, negotiateUrl, response, e_3, _a;
+ return tslib_1.__generator(this, function (_b) {
+ switch (_b.label) {
+ case 0: return [4 /*yield*/, this.accessTokenFactory()];
+ case 1:
+ token = _b.sent();
+ if (token) {
+ headers = (_a = {}, _a["Authorization"] = "Bearer " + token, _a);
+ }
+ negotiateUrl = this.resolveNegotiateUrl(url);
+ this.logger.log(ILogger.LogLevel.Debug, "Sending negotiation request: " + negotiateUrl);
+ _b.label = 2;
+ case 2:
+ _b.trys.push([2, 4, , 5]);
+ return [4 /*yield*/, this.httpClient.post(negotiateUrl, {
+ content: "",
+ headers: headers,
+ })];
+ case 3:
+ response = _b.sent();
+ if (response.statusCode !== 200) {
+ throw Error("Unexpected status code returned from negotiate " + response.statusCode);
+ }
+ return [2 /*return*/, JSON.parse(response.content)];
+ case 4:
+ e_3 = _b.sent();
+ this.logger.log(ILogger.LogLevel.Error, "Failed to complete negotiation with the server: " + e_3);
+ throw e_3;
+ case 5: return [2 /*return*/];
+ }
+ });
+ });
+ };
+ HttpConnection.prototype.createConnectUrl = function (url, connectionId) {
+ return url + (url.indexOf("?") === -1 ? "?" : "&") + ("id=" + connectionId);
+ };
+ HttpConnection.prototype.createTransport = function (url, requestedTransport, negotiateResponse, requestedTransferFormat) {
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
+ var connectUrl, transports, _i, transports_1, endpoint, transport, ex_1;
+ return tslib_1.__generator(this, function (_a) {
+ switch (_a.label) {
+ case 0:
+ connectUrl = this.createConnectUrl(url, negotiateResponse.connectionId);
+ if (!this.isITransport(requestedTransport)) return [3 /*break*/, 2];
+ this.logger.log(ILogger.LogLevel.Debug, "Connection was provided an instance of ITransport, using that directly.");
+ this.transport = requestedTransport;
+ return [4 /*yield*/, this.transport.connect(connectUrl, requestedTransferFormat)];
+ case 1:
+ _a.sent();
+ // only change the state if we were connecting to not overwrite
+ // the state if the connection is already marked as Disconnected
+ this.changeState(0 /* Connecting */, 1 /* Connected */);
+ return [2 /*return*/];
+ case 2:
+ transports = negotiateResponse.availableTransports;
+ _i = 0, transports_1 = transports;
+ _a.label = 3;
+ case 3:
+ if (!(_i < transports_1.length)) return [3 /*break*/, 9];
+ endpoint = transports_1[_i];
+ this.connectionState = 0 /* Connecting */;
+ transport = this.resolveTransport(endpoint, requestedTransport, requestedTransferFormat);
+ if (!(typeof transport === "number")) return [3 /*break*/, 8];
+ this.transport = this.constructTransport(transport);
+ if (!(negotiateResponse.connectionId === null)) return [3 /*break*/, 5];
+ return [4 /*yield*/, this.getNegotiationResponse(url)];
+ case 4:
+ negotiateResponse = _a.sent();
+ connectUrl = this.createConnectUrl(url, negotiateResponse.connectionId);
+ _a.label = 5;
+ case 5:
+ _a.trys.push([5, 7, , 8]);
+ return [4 /*yield*/, this.transport.connect(connectUrl, requestedTransferFormat)];
+ case 6:
+ _a.sent();
+ this.changeState(0 /* Connecting */, 1 /* Connected */);
+ return [2 /*return*/];
+ case 7:
+ ex_1 = _a.sent();
+ this.logger.log(ILogger.LogLevel.Error, "Failed to start the transport '" + ITransport.HttpTransportType[transport] + "': " + ex_1);
+ this.connectionState = 2 /* Disconnected */;
+ negotiateResponse.connectionId = null;
+ return [3 /*break*/, 8];
+ case 8:
+ _i++;
+ return [3 /*break*/, 3];
+ case 9: throw new Error("Unable to initialize any of the available transports.");
+ }
+ });
+ });
+ };
+ HttpConnection.prototype.constructTransport = function (transport) {
+ switch (transport) {
+ case ITransport.HttpTransportType.WebSockets:
+ return new WebSocketTransport_1.WebSocketTransport(this.accessTokenFactory, this.logger, this.options.logMessageContent);
+ case ITransport.HttpTransportType.ServerSentEvents:
+ return new ServerSentEventsTransport_1.ServerSentEventsTransport(this.httpClient, this.accessTokenFactory, this.logger, this.options.logMessageContent);
+ case ITransport.HttpTransportType.LongPolling:
+ return new LongPollingTransport_1.LongPollingTransport(this.httpClient, this.accessTokenFactory, this.logger, this.options.logMessageContent);
+ default:
+ throw new Error("Unknown transport: " + transport + ".");
+ }
+ };
+ HttpConnection.prototype.resolveTransport = function (endpoint, requestedTransport, requestedTransferFormat) {
+ var transport = ITransport.HttpTransportType[endpoint.transport];
+ if (transport === null || transport === undefined) {
+ this.logger.log(ILogger.LogLevel.Debug, "Skipping transport '" + endpoint.transport + "' because it is not supported by this client.");
+ }
+ else {
+ var transferFormats = endpoint.transferFormats.map(function (s) { return ITransport.TransferFormat[s]; });
+ if (transportMatches(requestedTransport, transport)) {
+ if (transferFormats.indexOf(requestedTransferFormat) >= 0) {
+ if ((transport === ITransport.HttpTransportType.WebSockets && typeof WebSocket === "undefined") ||
+ (transport === ITransport.HttpTransportType.ServerSentEvents && typeof EventSource === "undefined")) {
+ this.logger.log(ILogger.LogLevel.Debug, "Skipping transport '" + ITransport.HttpTransportType[transport] + "' because it is not supported in your environment.'");
+ }
+ else {
+ this.logger.log(ILogger.LogLevel.Debug, "Selecting transport '" + ITransport.HttpTransportType[transport] + "'");
+ return transport;
+ }
+ }
+ else {
+ this.logger.log(ILogger.LogLevel.Debug, "Skipping transport '" + ITransport.HttpTransportType[transport] + "' because it does not support the requested transfer format '" + ITransport.TransferFormat[requestedTransferFormat] + "'.");
+ }
+ }
+ else {
+ this.logger.log(ILogger.LogLevel.Debug, "Skipping transport '" + ITransport.HttpTransportType[transport] + "' because it was disabled by the client.");
+ }
+ }
+ return null;
+ };
+ HttpConnection.prototype.isITransport = function (transport) {
+ return transport && typeof (transport) === "object" && "connect" in transport;
+ };
+ HttpConnection.prototype.changeState = function (from, to) {
+ if (this.connectionState === from) {
+ this.connectionState = to;
+ return true;
+ }
+ return false;
+ };
+ HttpConnection.prototype.stopConnection = function (error) {
+ return tslib_1.__awaiter(this, void 0, void 0, function () {
+ return tslib_1.__generator(this, function (_a) {
+ this.transport = null;
+ // If we have a stopError, it takes precedence over the error from the transport
+ error = this.stopError || error;
+ if (error) {
+ this.logger.log(ILogger.LogLevel.Error, "Connection disconnected with error '" + error + "'.");
+ }
+ else {
+ this.logger.log(ILogger.LogLevel.Information, "Connection disconnected.");
+ }
+ this.connectionState = 2 /* Disconnected */;
+ if (this.onclose) {
+ this.onclose(error);
+ }
+ return [2 /*return*/];
+ });
+ });
+ };
+ HttpConnection.prototype.resolveUrl = function (url) {
+ // startsWith is not supported in IE
+ if (url.lastIndexOf("https://", 0) === 0 || url.lastIndexOf("http://", 0) === 0) {
+ return url;
+ }
+ if (typeof window === "undefined" || !window || !window.document) {
+ throw new Error("Cannot resolve '" + url + "'.");
+ }
+ // Setting the url to the href propery of an anchor tag handles normalization
+ // for us. There are 3 main cases.
+ // 1. Relative path normalization e.g "b" -> "http://localhost:5000/a/b"
+ // 2. Absolute path normalization e.g "/a/b" -> "http://localhost:5000/a/b"
+ // 3. Networkpath reference normalization e.g "//localhost:5000/a/b" -> "http://localhost:5000/a/b"
+ var aTag = window.document.createElement("a");
+ aTag.href = url;
+ this.logger.log(ILogger.LogLevel.Information, "Normalizing '" + url + "' to '" + aTag.href + "'.");
+ return aTag.href;
+ };
+ HttpConnection.prototype.resolveNegotiateUrl = function (url) {
+ var index = url.indexOf("?");
+ var negotiateUrl = url.substring(0, index === -1 ? url.length : index);
+ if (negotiateUrl[negotiateUrl.length - 1] !== "/") {
+ negotiateUrl += "/";
+ }
+ negotiateUrl += "negotiate";
+ negotiateUrl += index === -1 ? "" : url.substring(index);
+ return negotiateUrl;
+ };
+ return HttpConnection;
+}());
+exports.HttpConnection = HttpConnection;
+function transportMatches(requestedTransport, actualTransport) {
+ return !requestedTransport || ((actualTransport & requestedTransport) !== 0);
+}
+
+});
+
+unwrapExports(HttpConnection_1);
+var HttpConnection_2 = HttpConnection_1.HttpConnection;
+
+var JsonHubProtocol_1 = createCommonjsModule(function (module, exports) {
+Object.defineProperty(exports, "__esModule", { value: true });
+
+
+
+
+
+var JSON_HUB_PROTOCOL_NAME = "json";
+/** Implements the JSON Hub Protocol. */
+var JsonHubProtocol = /** @class */ (function () {
+ function JsonHubProtocol() {
+ /** @inheritDoc */
+ this.name = JSON_HUB_PROTOCOL_NAME;
+ /** @inheritDoc */
+ this.version = 1;
+ /** @inheritDoc */
+ this.transferFormat = ITransport.TransferFormat.Text;
+ }
+ /** Creates an array of {@link HubMessage} objects from the specified serialized representation.
+ *
+ * @param {string} input A string containing the serialized representation.
+ * @param {ILogger} logger A logger that will be used to log messages that occur during parsing.
+ */
+ JsonHubProtocol.prototype.parseMessages = function (input, logger) {
+ // The interface does allow "ArrayBuffer" to be passed in, but this implementation does not. So let's throw a useful error.
+ if (typeof input !== "string") {
+ throw new Error("Invalid input for JSON hub protocol. Expected a string.");
+ }
+ if (!input) {
+ return [];
+ }
+ if (logger === null) {
+ logger = Loggers.NullLogger.instance;
+ }
+ // Parse the messages
+ var messages = TextMessageFormat_1.TextMessageFormat.parse(input);
+ var hubMessages = [];
+ for (var _i = 0, messages_1 = messages; _i < messages_1.length; _i++) {
+ var message = messages_1[_i];
+ var parsedMessage = JSON.parse(message);
+ if (typeof parsedMessage.type !== "number") {
+ throw new Error("Invalid payload.");
+ }
+ switch (parsedMessage.type) {
+ case IHubProtocol.MessageType.Invocation:
+ this.isInvocationMessage(parsedMessage);
+ break;
+ case IHubProtocol.MessageType.StreamItem:
+ this.isStreamItemMessage(parsedMessage);
+ break;
+ case IHubProtocol.MessageType.Completion:
+ this.isCompletionMessage(parsedMessage);
+ break;
+ case IHubProtocol.MessageType.Ping:
+ // Single value, no need to validate
+ break;
+ case IHubProtocol.MessageType.Close:
+ // All optional values, no need to validate
+ break;
+ default:
+ // Future protocol changes can add message types, old clients can ignore them
+ logger.log(ILogger.LogLevel.Information, "Unknown message type '" + parsedMessage.type + "' ignored.");
+ continue;
+ }
+ hubMessages.push(parsedMessage);
+ }
+ return hubMessages;
+ };
+ /** Writes the specified {@link HubMessage} to a string and returns it.
+ *
+ * @param {HubMessage} message The message to write.
+ * @returns {string} A string containing the serialized representation of the message.
+ */
+ JsonHubProtocol.prototype.writeMessage = function (message) {
+ return TextMessageFormat_1.TextMessageFormat.write(JSON.stringify(message));
+ };
+ JsonHubProtocol.prototype.isInvocationMessage = function (message) {
+ this.assertNotEmptyString(message.target, "Invalid payload for Invocation message.");
+ if (message.invocationId !== undefined) {
+ this.assertNotEmptyString(message.invocationId, "Invalid payload for Invocation message.");
+ }
+ };
+ JsonHubProtocol.prototype.isStreamItemMessage = function (message) {
+ this.assertNotEmptyString(message.invocationId, "Invalid payload for StreamItem message.");
+ if (message.item === undefined) {
+ throw new Error("Invalid payload for StreamItem message.");
+ }
+ };
+ JsonHubProtocol.prototype.isCompletionMessage = function (message) {
+ if (message.result && message.error) {
+ throw new Error("Invalid payload for Completion message.");
+ }
+ if (!message.result && message.error) {
+ this.assertNotEmptyString(message.error, "Invalid payload for Completion message.");
+ }
+ this.assertNotEmptyString(message.invocationId, "Invalid payload for Completion message.");
+ };
+ JsonHubProtocol.prototype.assertNotEmptyString = function (value, errorMessage) {
+ if (typeof value !== "string" || value === "") {
+ throw new Error(errorMessage);
+ }
+ };
+ return JsonHubProtocol;
+}());
+exports.JsonHubProtocol = JsonHubProtocol;
+
+});
+
+unwrapExports(JsonHubProtocol_1);
+var JsonHubProtocol_2 = JsonHubProtocol_1.JsonHubProtocol;
+
+var HubConnectionBuilder_1 = createCommonjsModule(function (module, exports) {
+Object.defineProperty(exports, "__esModule", { value: true });
+
+
+
+
+
+/** A builder for configuring {@link HubConnection} instances. */
+var HubConnectionBuilder = /** @class */ (function () {
+ function HubConnectionBuilder() {
+ }
+ HubConnectionBuilder.prototype.configureLogging = function (logging) {
+ Utils.Arg.isRequired(logging, "logging");
+ if (isLogger(logging)) {
+ this.logger = logging;
+ }
+ else {
+ this.logger = new Utils.ConsoleLogger(logging);
+ }
+ return this;
+ };
+ HubConnectionBuilder.prototype.withUrl = function (url, transportTypeOrOptions) {
+ Utils.Arg.isRequired(url, "url");
+ this.url = url;
+ // Flow-typing knows where it's at. Since HttpTransportType is a number and IHttpConnectionOptions is guaranteed
+ // to be an object, we know (as does TypeScript) this comparison is all we need to figure out which overload was called.
+ if (typeof transportTypeOrOptions === "object") {
+ this.httpConnectionOptions = transportTypeOrOptions;
+ }
+ else {
+ this.httpConnectionOptions = {
+ transport: transportTypeOrOptions,
+ };
+ }
+ return this;
+ };
+ /** Configures the {@link HubConnection} to use the specified Hub Protocol.
+ *
+ * @param {IHubProtocol} protocol The {@link IHubProtocol} implementation to use.
+ */
+ HubConnectionBuilder.prototype.withHubProtocol = function (protocol) {
+ Utils.Arg.isRequired(protocol, "protocol");
+ this.protocol = protocol;
+ return this;
+ };
+ /** Creates a {@link HubConnection} from the configuration options specified in this builder.
+ *
+ * @returns {HubConnection} The configured {@link HubConnection}.
+ */
+ HubConnectionBuilder.prototype.build = function () {
+ // If httpConnectionOptions has a logger, use it. Otherwise, override it with the one
+ // provided to configureLogger
+ var httpConnectionOptions = this.httpConnectionOptions || {};
+ // If it's 'null', the user **explicitly** asked for null, don't mess with it.
+ if (httpConnectionOptions.logger === undefined) {
+ // If our logger is undefined or null, that's OK, the HttpConnection constructor will handle it.
+ httpConnectionOptions.logger = this.logger;
+ }
+ // Now create the connection
+ if (!this.url) {
+ throw new Error("The 'HubConnectionBuilder.withUrl' method must be called before building the connection.");
+ }
+ var connection = new HttpConnection_1.HttpConnection(this.url, httpConnectionOptions);
+ return HubConnection_1.HubConnection.create(connection, this.logger || Loggers.NullLogger.instance, this.protocol || new JsonHubProtocol_1.JsonHubProtocol());
+ };
+ return HubConnectionBuilder;
+}());
+exports.HubConnectionBuilder = HubConnectionBuilder;
+function isLogger(logger) {
+ return logger.log !== undefined;
+}
+
+});
+
+unwrapExports(HubConnectionBuilder_1);
+var HubConnectionBuilder_2 = HubConnectionBuilder_1.HubConnectionBuilder;
+
+var cjs = createCommonjsModule(function (module, exports) {
+Object.defineProperty(exports, "__esModule", { value: true });
+// Version token that will be replaced by the prepack command
+/** The version of the SignalR client. */
+exports.VERSION = "0.0.0-DEV_BUILD";
+
+exports.HttpError = Errors.HttpError;
+exports.TimeoutError = Errors.TimeoutError;
+
+exports.DefaultHttpClient = HttpClient_1.DefaultHttpClient;
+exports.HttpClient = HttpClient_1.HttpClient;
+exports.HttpResponse = HttpClient_1.HttpResponse;
+
+exports.HubConnection = HubConnection_1.HubConnection;
+
+exports.HubConnectionBuilder = HubConnectionBuilder_1.HubConnectionBuilder;
+
+exports.MessageType = IHubProtocol.MessageType;
+
+exports.LogLevel = ILogger.LogLevel;
+
+exports.HttpTransportType = ITransport.HttpTransportType;
+exports.TransferFormat = ITransport.TransferFormat;
+
+exports.NullLogger = Loggers.NullLogger;
+
+exports.JsonHubProtocol = JsonHubProtocol_1.JsonHubProtocol;
+
+});
+
+unwrapExports(cjs);
+var cjs_1 = cjs.VERSION;
+var cjs_2 = cjs.HttpError;
+var cjs_3 = cjs.TimeoutError;
+var cjs_4 = cjs.DefaultHttpClient;
+var cjs_5 = cjs.HttpClient;
+var cjs_6 = cjs.HttpResponse;
+var cjs_7 = cjs.HubConnection;
+var cjs_8 = cjs.HubConnectionBuilder;
+var cjs_9 = cjs.MessageType;
+var cjs_10 = cjs.LogLevel;
+var cjs_11 = cjs.HttpTransportType;
+var cjs_12 = cjs.TransferFormat;
+var cjs_13 = cjs.NullLogger;
+var cjs_14 = cjs.JsonHubProtocol;
+
+var browserIndex = createCommonjsModule(function (module, exports) {
+Object.defineProperty(exports, "__esModule", { value: true });
+
+// This is where we add any polyfills we'll need for the browser. It is the entry module for browser-specific builds.
+
+// Copy from Array.prototype into Uint8Array to polyfill on IE. It's OK because the implementations of indexOf and slice use properties
+// that exist on Uint8Array with the same name, and JavaScript is magic.
+// We make them 'writable' because the Buffer polyfill messes with it as well.
+if (!Uint8Array.prototype.indexOf) {
+ Object.defineProperty(Uint8Array.prototype, "indexOf", {
+ value: Array.prototype.indexOf,
+ writable: true,
+ });
+}
+if (!Uint8Array.prototype.slice) {
+ Object.defineProperty(Uint8Array.prototype, "slice", {
+ value: Array.prototype.slice,
+ writable: true,
+ });
+}
+if (!Uint8Array.prototype.forEach) {
+ Object.defineProperty(Uint8Array.prototype, "forEach", {
+ value: Array.prototype.forEach,
+ writable: true,
+ });
+}
+tslib_1.__exportStar(cjs, exports);
+
+});
+
+var browserIndex$1 = unwrapExports(browserIndex);
+
+return browserIndex$1;
+
+})));
+//# sourceMappingURL=signalr.js.map
diff --git a/src/Web/wwwroot/lib/@aspnet/signalr/dist/browser/signalr.min.js b/src/Web/wwwroot/lib/@aspnet/signalr/dist/browser/signalr.min.js
new file mode 100644
index 0000000..261be26
--- /dev/null
+++ b/src/Web/wwwroot/lib/@aspnet/signalr/dist/browser/signalr.min.js
@@ -0,0 +1,17 @@
+/**
+ * @overview ASP.NET Core SignalR JavaScript Client.
+ * @version 1.0.3.
+ * @license
+ * Copyright (c) .NET Foundation. All rights reserved.
+ * Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+ */
+(function(global,factory){typeof exports==="object"&&typeof module!=="undefined"?module.exports=factory():typeof define==="function"&&define.amd?define(factory):global.signalR=factory()})(this,function(){"use strict";var commonjsGlobal=typeof window!=="undefined"?window:typeof global!=="undefined"?global:typeof self!=="undefined"?self:{};function commonjsRequire(){throw new Error("Dynamic requires are not currently supported by rollup-plugin-commonjs")}function unwrapExports(x){return x&&x.__esModule&&Object.prototype.hasOwnProperty.call(x,"default")?x["default"]:x}function createCommonjsModule(fn,module){return module={exports:{}},fn(module,module.exports),module.exports}var extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)if(b.hasOwnProperty(p))d[p]=b[p]};function __extends(d,b){extendStatics(d,b);function __(){this.constructor=d}d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __)}var __assign=Object.assign||function __assign(t){for(var s,i=1,n=arguments.length;i=0;i--)if(d=decorators[i])r=(c<3?d(r):c>3?d(target,key,r):d(target,key))||r;return c>3&&r&&Object.defineProperty(target,key,r),r}function __param(paramIndex,decorator){return function(target,key){decorator(target,key,paramIndex)}}function __metadata(metadataKey,metadataValue){if(typeof Reflect==="object"&&typeof Reflect.metadata==="function")return Reflect.metadata(metadataKey,metadataValue)}function __awaiter(thisArg,_arguments,P,generator){return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator["throw"](value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):new P(function(resolve){resolve(result.value)}).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})}function __generator(thisArg,body){var _={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1]},trys:[],ops:[]},f,y,t,g;return g={next:verb(0),throw:verb(1),return:verb(2)},typeof Symbol==="function"&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return step([n,v])}}function step(op){if(f)throw new TypeError("Generator is already executing.");while(_)try{if(f=1,y&&(t=y[op[0]&2?"return":op[0]?"throw":"next"])&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[0,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return{value:op[1],done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue}if(op[0]===3&&(!t||op[1]>t[0]&&op[1]=o.length)o=void 0;return{value:o&&o[i++],done:!o}}}}function __read(o,n){var m=typeof Symbol==="function"&&o[Symbol.iterator];if(!m)return o;var i=m.call(o),r,ar=[],e;try{while((n===void 0||n-- >0)&&!(r=i.next()).done)ar.push(r.value)}catch(error){e={error:error}}finally{try{if(r&&!r.done&&(m=i["return"]))m.call(i)}finally{if(e)throw e.error}}return ar}function __spread(){for(var ar=[],i=0;i1||resume(n,v)})}}function resume(n,v){try{step(g[n](v))}catch(e){settle(q[0][3],e)}}function step(r){r.value instanceof __await?Promise.resolve(r.value.v).then(fulfill,reject):settle(q[0][2],r)}function fulfill(value){resume("next",value)}function reject(value){resume("throw",value)}function settle(f,v){if(f(v),q.shift(),q.length)resume(q[0][0],q[0][1])}}function __asyncDelegator(o){var i,p;return i={},verb("next"),verb("throw",function(e){throw e}),verb("return"),i[Symbol.iterator]=function(){return this},i;function verb(n,f){if(o[n])i[n]=function(v){return(p=!p)?{value:__await(o[n](v)),done:n==="return"}:f?f(v):v}}}function __asyncValues(o){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var m=o[Symbol.asyncIterator];return m?m.call(o):typeof __values==="function"?__values(o):o[Symbol.iterator]()}function __makeTemplateObject(cooked,raw){if(Object.defineProperty){Object.defineProperty(cooked,"raw",{value:raw})}else{cooked.raw=raw}return cooked}function __importStar(mod){if(mod&&mod.__esModule)return mod;var result={};if(mod!=null)for(var k in mod)if(Object.hasOwnProperty.call(mod,k))result[k]=mod[k];result.default=mod;return result}function __importDefault(mod){return mod&&mod.__esModule?mod:{default:mod}}var tslib_1=Object.freeze({__extends:__extends,__assign:__assign,__rest:__rest,__decorate:__decorate,__param:__param,__metadata:__metadata,__awaiter:__awaiter,__generator:__generator,__exportStar:__exportStar,__values:__values,__read:__read,__spread:__spread,__await:__await,__asyncGenerator:__asyncGenerator,__asyncDelegator:__asyncDelegator,__asyncValues:__asyncValues,__makeTemplateObject:__makeTemplateObject,__importStar:__importStar,__importDefault:__importDefault});var es6Promise_auto=createCommonjsModule(function(module,exports){
+/*!
+ * @overview es6-promise - a tiny implementation of Promises/A+.
+ * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
+ * @license Licensed under MIT license
+ * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
+ * @version v4.2.2+97478eb6
+ */
+(function(global,factory){module.exports=factory()})(commonjsGlobal,function(){function objectOrFunction(x){var type=typeof x;return x!==null&&(type==="object"||type==="function")}function isFunction(x){return typeof x==="function"}var _isArray=void 0;if(Array.isArray){_isArray=Array.isArray}else{_isArray=function(x){return Object.prototype.toString.call(x)==="[object Array]"}}var isArray=_isArray;var len=0;var vertxNext=void 0;var customSchedulerFn=void 0;var asap=function asap(callback,arg){queue[len]=callback;queue[len+1]=arg;len+=2;if(len===2){if(customSchedulerFn){customSchedulerFn(flush)}else{scheduleFlush()}}};function setScheduler(scheduleFn){customSchedulerFn=scheduleFn}function setAsap(asapFn){asap=asapFn}var browserWindow=typeof window!=="undefined"?window:undefined;var browserGlobal=browserWindow||{};var BrowserMutationObserver=browserGlobal.MutationObserver||browserGlobal.WebKitMutationObserver;var isNode=typeof self==="undefined"&&typeof process!=="undefined"&&{}.toString.call(process)==="[object process]";var isWorker=typeof Uint8ClampedArray!=="undefined"&&typeof importScripts!=="undefined"&&typeof MessageChannel!=="undefined";function useNextTick(){return function(){return process.nextTick(flush)}}function useVertxTimer(){if(typeof vertxNext!=="undefined"){return function(){vertxNext(flush)}}return useSetTimeout()}function useMutationObserver(){var iterations=0;var observer=new BrowserMutationObserver(flush);var node=document.createTextNode("");observer.observe(node,{characterData:true});return function(){node.data=iterations=++iterations%2}}function useMessageChannel(){var channel=new MessageChannel;channel.port1.onmessage=flush;return function(){return channel.port2.postMessage(0)}}function useSetTimeout(){var globalSetTimeout=setTimeout;return function(){return globalSetTimeout(flush,1)}}var queue=new Array(1e3);function flush(){for(var i=0;i=200&&xhr.status<300){resolve(new HttpResponse(xhr.status,xhr.statusText,xhr.response||xhr.responseText))}else{reject(new Errors.HttpError(xhr.statusText,xhr.status))}};xhr.onerror=function(){_this.logger.log(ILogger.LogLevel.Warning,"Error from HTTP request. "+xhr.status+": "+xhr.statusText);reject(new Errors.HttpError(xhr.statusText,xhr.status))};xhr.ontimeout=function(){_this.logger.log(ILogger.LogLevel.Warning,"Timeout from HTTP request.");reject(new Errors.TimeoutError)};xhr.send(request.content||"")})};return DefaultHttpClient}(HttpClient);exports.DefaultHttpClient=DefaultHttpClient});unwrapExports(HttpClient_1);var HttpClient_2=HttpClient_1.HttpResponse;var HttpClient_3=HttpClient_1.HttpClient;var HttpClient_4=HttpClient_1.DefaultHttpClient;var TextMessageFormat_1=createCommonjsModule(function(module,exports){Object.defineProperty(exports,"__esModule",{value:true});var TextMessageFormat=function(){function TextMessageFormat(){}TextMessageFormat.write=function(output){return""+output+TextMessageFormat.RecordSeparator};TextMessageFormat.parse=function(input){if(input[input.length-1]!==TextMessageFormat.RecordSeparator){throw new Error("Message is incomplete.")}var messages=input.split(TextMessageFormat.RecordSeparator);messages.pop();return messages};TextMessageFormat.RecordSeparatorCode=30;TextMessageFormat.RecordSeparator=String.fromCharCode(TextMessageFormat.RecordSeparatorCode);return TextMessageFormat}();exports.TextMessageFormat=TextMessageFormat});unwrapExports(TextMessageFormat_1);var TextMessageFormat_2=TextMessageFormat_1.TextMessageFormat;var HandshakeProtocol_1=createCommonjsModule(function(module,exports){Object.defineProperty(exports,"__esModule",{value:true});var HandshakeProtocol=function(){function HandshakeProtocol(){}HandshakeProtocol.prototype.writeHandshakeRequest=function(handshakeRequest){return TextMessageFormat_1.TextMessageFormat.write(JSON.stringify(handshakeRequest))};HandshakeProtocol.prototype.parseHandshakeResponse=function(data){var responseMessage;var messageData;var remainingData;if(data instanceof ArrayBuffer){var binaryData=new Uint8Array(data);var separatorIndex=binaryData.indexOf(TextMessageFormat_1.TextMessageFormat.RecordSeparatorCode);if(separatorIndex===-1){throw new Error("Message is incomplete.")}var responseLength=separatorIndex+1;messageData=String.fromCharCode.apply(null,binaryData.slice(0,responseLength));remainingData=binaryData.byteLength>responseLength?binaryData.slice(responseLength).buffer:null}else{var textData=data;var separatorIndex=textData.indexOf(TextMessageFormat_1.TextMessageFormat.RecordSeparator);if(separatorIndex===-1){throw new Error("Message is incomplete.")}var responseLength=separatorIndex+1;messageData=textData.substring(0,responseLength);remainingData=textData.length>responseLength?textData.substring(responseLength):null}var messages=TextMessageFormat_1.TextMessageFormat.parse(messageData);responseMessage=JSON.parse(messages[0]);return[remainingData,responseMessage]};return HandshakeProtocol}();exports.HandshakeProtocol=HandshakeProtocol});unwrapExports(HandshakeProtocol_1);var HandshakeProtocol_2=HandshakeProtocol_1.HandshakeProtocol;var IHubProtocol=createCommonjsModule(function(module,exports){Object.defineProperty(exports,"__esModule",{value:true});var MessageType;(function(MessageType){MessageType[MessageType["Invocation"]=1]="Invocation";MessageType[MessageType["StreamItem"]=2]="StreamItem";MessageType[MessageType["Completion"]=3]="Completion";MessageType[MessageType["StreamInvocation"]=4]="StreamInvocation";MessageType[MessageType["CancelInvocation"]=5]="CancelInvocation";MessageType[MessageType["Ping"]=6]="Ping";MessageType[MessageType["Close"]=7]="Close"})(MessageType=exports.MessageType||(exports.MessageType={}))});unwrapExports(IHubProtocol);var IHubProtocol_1=IHubProtocol.MessageType;var Loggers=createCommonjsModule(function(module,exports){Object.defineProperty(exports,"__esModule",{value:true});var NullLogger=function(){function NullLogger(){}NullLogger.prototype.log=function(logLevel,message){};NullLogger.instance=new NullLogger;return NullLogger}();exports.NullLogger=NullLogger});unwrapExports(Loggers);var Loggers_1=Loggers.NullLogger;var Utils=createCommonjsModule(function(module,exports){Object.defineProperty(exports,"__esModule",{value:true});var Arg=function(){function Arg(){}Arg.isRequired=function(val,name){if(val===null||val===undefined){throw new Error("The '"+name+"' argument is required.")}};Arg.isIn=function(val,values,name){if(!(val in values)){throw new Error("Unknown "+name+" value: "+val+".")}};return Arg}();exports.Arg=Arg;function getDataDetail(data,includeContent){var length=null;if(data instanceof ArrayBuffer){length="Binary data of length "+data.byteLength;if(includeContent){length+=". Content: '"+formatArrayBuffer(data)+"'"}}else if(typeof data==="string"){length="String data of length "+data.length;if(includeContent){length+=". Content: '"+data+"'."}}return length}exports.getDataDetail=getDataDetail;function formatArrayBuffer(data){var view=new Uint8Array(data);var str="";view.forEach(function(num){var pad=num<16?"0":"";str+="0x"+pad+num.toString(16)+" "});return str.substr(0,str.length-1)}exports.formatArrayBuffer=formatArrayBuffer;function sendMessage(logger,transportName,httpClient,url,accessTokenFactory,content,logMessageContent){return tslib_1.__awaiter(this,void 0,void 0,function(){var headers,token,response,_a;return tslib_1.__generator(this,function(_b){switch(_b.label){case 0:return[4,accessTokenFactory()];case 1:token=_b.sent();if(token){headers=(_a={},_a["Authorization"]="Bearer "+token,_a)}logger.log(ILogger.LogLevel.Trace,"("+transportName+" transport) sending data. "+getDataDetail(content,logMessageContent)+".");return[4,httpClient.post(url,{content:content,headers:headers})];case 2:response=_b.sent();logger.log(ILogger.LogLevel.Trace,"("+transportName+" transport) request complete. Response status: "+response.statusCode+".");return[2]}})})}exports.sendMessage=sendMessage;function createLogger(logger){if(logger===undefined){return new ConsoleLogger(ILogger.LogLevel.Information)}if(logger===null){return Loggers.NullLogger.instance}if(logger.log){return logger}return new ConsoleLogger(logger)}exports.createLogger=createLogger;var Subject=function(){function Subject(cancelCallback){this.observers=[];this.cancelCallback=cancelCallback}Subject.prototype.next=function(item){for(var _i=0,_a=this.observers;_i<_a.length;_i++){var observer=_a[_i];observer.next(item)}};Subject.prototype.error=function(err){for(var _i=0,_a=this.observers;_i<_a.length;_i++){var observer=_a[_i];if(observer.error){observer.error(err)}}};Subject.prototype.complete=function(){for(var _i=0,_a=this.observers;_i<_a.length;_i++){var observer=_a[_i];if(observer.complete){observer.complete()}}};Subject.prototype.subscribe=function(observer){this.observers.push(observer);return new SubjectSubscription(this,observer)};return Subject}();exports.Subject=Subject;var SubjectSubscription=function(){function SubjectSubscription(subject,observer){this.subject=subject;this.observer=observer}SubjectSubscription.prototype.dispose=function(){var index=this.subject.observers.indexOf(this.observer);if(index>-1){this.subject.observers.splice(index,1)}if(this.subject.observers.length===0){this.subject.cancelCallback().catch(function(_){})}};return SubjectSubscription}();exports.SubjectSubscription=SubjectSubscription;var ConsoleLogger=function(){function ConsoleLogger(minimumLogLevel){this.minimumLogLevel=minimumLogLevel}ConsoleLogger.prototype.log=function(logLevel,message){if(logLevel>=this.minimumLogLevel){switch(logLevel){case ILogger.LogLevel.Critical:case ILogger.LogLevel.Error:console.error(ILogger.LogLevel[logLevel]+": "+message);break;case ILogger.LogLevel.Warning:console.warn(ILogger.LogLevel[logLevel]+": "+message);break;case ILogger.LogLevel.Information:console.info(ILogger.LogLevel[logLevel]+": "+message);break;default:console.log(ILogger.LogLevel[logLevel]+": "+message);break}}};return ConsoleLogger}();exports.ConsoleLogger=ConsoleLogger});unwrapExports(Utils);var Utils_1=Utils.Arg;var Utils_2=Utils.getDataDetail;var Utils_3=Utils.formatArrayBuffer;var Utils_4=Utils.sendMessage;var Utils_5=Utils.createLogger;var Utils_6=Utils.Subject;var Utils_7=Utils.SubjectSubscription;var Utils_8=Utils.ConsoleLogger;var HubConnection_1=createCommonjsModule(function(module,exports){Object.defineProperty(exports,"__esModule",{value:true});var DEFAULT_TIMEOUT_IN_MS=30*1e3;var HubConnection=function(){function HubConnection(connection,logger,protocol){var _this=this;Utils.Arg.isRequired(connection,"connection");Utils.Arg.isRequired(logger,"logger");Utils.Arg.isRequired(protocol,"protocol");this.serverTimeoutInMilliseconds=DEFAULT_TIMEOUT_IN_MS;this.logger=logger;this.protocol=protocol;this.connection=connection;this.handshakeProtocol=new HandshakeProtocol_1.HandshakeProtocol;this.connection.onreceive=function(data){return _this.processIncomingData(data)};this.connection.onclose=function(error){return _this.connectionClosed(error)};this.callbacks={};this.methods={};this.closedCallbacks=[];this.id=0}HubConnection.create=function(connection,logger,protocol){return new HubConnection(connection,logger,protocol)};HubConnection.prototype.start=function(){return tslib_1.__awaiter(this,void 0,void 0,function(){var handshakeRequest;return tslib_1.__generator(this,function(_a){switch(_a.label){case 0:handshakeRequest={protocol:this.protocol.name,version:this.protocol.version};this.logger.log(ILogger.LogLevel.Debug,"Starting HubConnection.");this.receivedHandshakeResponse=false;return[4,this.connection.start(this.protocol.transferFormat)];case 1:_a.sent();this.logger.log(ILogger.LogLevel.Debug,"Sending handshake request.");return[4,this.connection.send(this.handshakeProtocol.writeHandshakeRequest(handshakeRequest))];case 2:_a.sent();this.logger.log(ILogger.LogLevel.Information,"Using HubProtocol '"+this.protocol.name+"'.");this.cleanupTimeout();this.configureTimeout();return[2]}})})};HubConnection.prototype.stop=function(){this.logger.log(ILogger.LogLevel.Debug,"Stopping HubConnection.");this.cleanupTimeout();return this.connection.stop()};HubConnection.prototype.stream=function(methodName){var _this=this;var args=[];for(var _i=1;_i"));this.onclose(closeError)}this.logger.log(ILogger.LogLevel.Trace,"(LongPolling transport) Transport finished.");return[7];case 9:return[2]}})})};LongPollingTransport.prototype.send=function(data){return tslib_1.__awaiter(this,void 0,void 0,function(){return tslib_1.__generator(this,function(_a){if(!this.running){return[2,Promise.reject(new Error("Cannot send until the transport is connected"))]}return[2,Utils.sendMessage(this.logger,"LongPolling",this.httpClient,this.url,this.accessTokenFactory,data,this.logMessageContent)]})})};LongPollingTransport.prototype.stop=function(){return tslib_1.__awaiter(this,void 0,void 0,function(){var _this=this;var deleteOptions,token,response;return tslib_1.__generator(this,function(_a){switch(_a.label){case 0:_a.trys.push([0,,3,4]);this.running=false;this.logger.log(ILogger.LogLevel.Trace,"(LongPolling transport) sending DELETE request to "+this.url+".");deleteOptions={headers:{}};return[4,this.accessTokenFactory()];case 1:token=_a.sent();this.updateHeaderToken(deleteOptions,token);return[4,this.httpClient.delete(this.url,deleteOptions)];case 2:response=_a.sent();this.logger.log(ILogger.LogLevel.Trace,"(LongPolling transport) DELETE request accepted.");return[3,4];case 3:if(!this.stopped){this.shutdownTimer=setTimeout(function(){_this.logger.log(ILogger.LogLevel.Warning,"(LongPolling transport) server did not terminate after DELETE request, canceling poll.");_this.pollAbort.abort()},this.shutdownTimeout)}return[7];case 4:return[2]}})})};return LongPollingTransport}();exports.LongPollingTransport=LongPollingTransport});unwrapExports(LongPollingTransport_1);var LongPollingTransport_2=LongPollingTransport_1.LongPollingTransport;var ServerSentEventsTransport_1=createCommonjsModule(function(module,exports){Object.defineProperty(exports,"__esModule",{value:true});var ServerSentEventsTransport=function(){function ServerSentEventsTransport(httpClient,accessTokenFactory,logger,logMessageContent){this.httpClient=httpClient;this.accessTokenFactory=accessTokenFactory||function(){return null};this.logger=logger;this.logMessageContent=logMessageContent}ServerSentEventsTransport.prototype.connect=function(url,transferFormat){return tslib_1.__awaiter(this,void 0,void 0,function(){var _this=this;var token;return tslib_1.__generator(this,function(_a){switch(_a.label){case 0:Utils.Arg.isRequired(url,"url");Utils.Arg.isRequired(transferFormat,"transferFormat");Utils.Arg.isIn(transferFormat,ITransport.TransferFormat,"transferFormat");if(typeof EventSource==="undefined"){throw new Error("'EventSource' is not supported in your environment.")}this.logger.log(ILogger.LogLevel.Trace,"(SSE transport) Connecting");return[4,this.accessTokenFactory()];case 1:token=_a.sent();if(token){url+=(url.indexOf("?")<0?"?":"&")+("access_token="+encodeURIComponent(token))}this.url=url;return[2,new Promise(function(resolve,reject){var opened=false;if(transferFormat!==ITransport.TransferFormat.Text){reject(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"))}var eventSource=new EventSource(url,{withCredentials:true});try{eventSource.onmessage=function(e){if(_this.onreceive){try{_this.logger.log(ILogger.LogLevel.Trace,"(SSE transport) data received. "+Utils.getDataDetail(e.data,_this.logMessageContent)+".");_this.onreceive(e.data)}catch(error){if(_this.onclose){_this.onclose(error)}return}}};eventSource.onerror=function(e){var error=new Error(e.message||"Error occurred");if(opened){_this.close(error)}else{reject(error)}};eventSource.onopen=function(){_this.logger.log(ILogger.LogLevel.Information,"SSE connected to "+_this.url);_this.eventSource=eventSource;opened=true;resolve()}}catch(e){return Promise.reject(e)}})]}})})};ServerSentEventsTransport.prototype.send=function(data){return tslib_1.__awaiter(this,void 0,void 0,function(){return tslib_1.__generator(this,function(_a){if(!this.eventSource){return[2,Promise.reject(new Error("Cannot send until the transport is connected"))]}return[2,Utils.sendMessage(this.logger,"SSE",this.httpClient,this.url,this.accessTokenFactory,data,this.logMessageContent)]})})};ServerSentEventsTransport.prototype.stop=function(){this.close();return Promise.resolve()};ServerSentEventsTransport.prototype.close=function(e){if(this.eventSource){this.eventSource.close();this.eventSource=null;if(this.onclose){this.onclose(e)}}};return ServerSentEventsTransport}();exports.ServerSentEventsTransport=ServerSentEventsTransport});unwrapExports(ServerSentEventsTransport_1);var ServerSentEventsTransport_2=ServerSentEventsTransport_1.ServerSentEventsTransport;var WebSocketTransport_1=createCommonjsModule(function(module,exports){Object.defineProperty(exports,"__esModule",{value:true});var WebSocketTransport=function(){function WebSocketTransport(accessTokenFactory,logger,logMessageContent){this.logger=logger;this.accessTokenFactory=accessTokenFactory||function(){return null};this.logMessageContent=logMessageContent}WebSocketTransport.prototype.connect=function(url,transferFormat){return tslib_1.__awaiter(this,void 0,void 0,function(){var _this=this;var token;return tslib_1.__generator(this,function(_a){switch(_a.label){case 0:Utils.Arg.isRequired(url,"url");Utils.Arg.isRequired(transferFormat,"transferFormat");Utils.Arg.isIn(transferFormat,ITransport.TransferFormat,"transferFormat");if(typeof WebSocket==="undefined"){throw new Error("'WebSocket' is not supported in your environment.")}this.logger.log(ILogger.LogLevel.Trace,"(WebSockets transport) Connecting");return[4,this.accessTokenFactory()];case 1:token=_a.sent();if(token){url+=(url.indexOf("?")<0?"?":"&")+("access_token="+encodeURIComponent(token))}return[2,new Promise(function(resolve,reject){url=url.replace(/^http/,"ws");var webSocket=new WebSocket(url);if(transferFormat===ITransport.TransferFormat.Binary){webSocket.binaryType="arraybuffer"}webSocket.onopen=function(event){_this.logger.log(ILogger.LogLevel.Information,"WebSocket connected to "+url);_this.webSocket=webSocket;resolve()};webSocket.onerror=function(event){reject(event.error)};webSocket.onmessage=function(message){_this.logger.log(ILogger.LogLevel.Trace,"(WebSockets transport) data received. "+Utils.getDataDetail(message.data,_this.logMessageContent)+".");if(_this.onreceive){_this.onreceive(message.data)}};webSocket.onclose=function(event){_this.logger.log(ILogger.LogLevel.Trace,"(WebSockets transport) socket closed.");if(_this.onclose){if(event.wasClean===false||event.code!==1e3){_this.onclose(new Error("Websocket closed with status code: "+event.code+" ("+event.reason+")"))}else{_this.onclose()}}}})]}})})};WebSocketTransport.prototype.send=function(data){if(this.webSocket&&this.webSocket.readyState===WebSocket.OPEN){this.logger.log(ILogger.LogLevel.Trace,"(WebSockets transport) sending data. "+Utils.getDataDetail(data,this.logMessageContent)+".");this.webSocket.send(data);return Promise.resolve()}return Promise.reject("WebSocket is not in the OPEN state")};WebSocketTransport.prototype.stop=function(){if(this.webSocket){this.webSocket.close();this.webSocket=null}return Promise.resolve()};return WebSocketTransport}();exports.WebSocketTransport=WebSocketTransport});unwrapExports(WebSocketTransport_1);var WebSocketTransport_2=WebSocketTransport_1.WebSocketTransport;var HttpConnection_1=createCommonjsModule(function(module,exports){Object.defineProperty(exports,"__esModule",{value:true});var MAX_REDIRECTS=100;var HttpConnection=function(){function HttpConnection(url,options){if(options===void 0){options={}}this.features={};Utils.Arg.isRequired(url,"url");this.logger=Utils.createLogger(options.logger);this.baseUrl=this.resolveUrl(url);options=options||{};options.accessTokenFactory=options.accessTokenFactory||function(){return null};options.logMessageContent=options.logMessageContent||false;this.httpClient=options.httpClient||new HttpClient_1.DefaultHttpClient(this.logger);this.connectionState=2;this.options=options}HttpConnection.prototype.start=function(transferFormat){transferFormat=transferFormat||ITransport.TransferFormat.Binary;Utils.Arg.isIn(transferFormat,ITransport.TransferFormat,"transferFormat");this.logger.log(ILogger.LogLevel.Debug,"Starting connection with transfer format '"+ITransport.TransferFormat[transferFormat]+"'.");if(this.connectionState!==2){return Promise.reject(new Error("Cannot start a connection that is not in the 'Disconnected' state."))}this.connectionState=0;this.startPromise=this.startInternal(transferFormat);return this.startPromise};HttpConnection.prototype.send=function(data){if(this.connectionState!==1){throw new Error("Cannot send data if the connection is not in the 'Connected' State.")}return this.transport.send(data)};HttpConnection.prototype.stop=function(error){return tslib_1.__awaiter(this,void 0,void 0,function(){var e_1;return tslib_1.__generator(this,function(_a){switch(_a.label){case 0:this.connectionState=2;_a.label=1;case 1:_a.trys.push([1,3,,4]);return[4,this.startPromise];case 2:_a.sent();return[3,4];case 3:e_1=_a.sent();return[3,4];case 4:if(!this.transport)return[3,6];this.stopError=error;return[4,this.transport.stop()];case 5:_a.sent();this.transport=null;_a.label=6;case 6:return[2]}})})};HttpConnection.prototype.startInternal=function(transferFormat){return tslib_1.__awaiter(this,void 0,void 0,function(){var _this=this;var url,negotiateResponse,redirects,_loop_1,this_1,state_1,e_2;return tslib_1.__generator(this,function(_a){switch(_a.label){case 0:url=this.baseUrl;this.accessTokenFactory=this.options.accessTokenFactory;_a.label=1;case 1:_a.trys.push([1,12,,13]);if(!this.options.skipNegotiation)return[3,5];if(!(this.options.transport===ITransport.HttpTransportType.WebSockets))return[3,3];this.transport=this.constructTransport(ITransport.HttpTransportType.WebSockets);return[4,this.transport.connect(url,transferFormat)];case 2:_a.sent();return[3,4];case 3:throw Error("Negotiation can only be skipped when using the WebSocket transport directly.");case 4:return[3,11];case 5:negotiateResponse=null;redirects=0;_loop_1=function(){var accessToken_1;return tslib_1.__generator(this,function(_a){switch(_a.label){case 0:return[4,this_1.getNegotiationResponse(url)];case 1:negotiateResponse=_a.sent();if(this_1.connectionState===2){return[2,{value:void 0}]}if(negotiateResponse.url){url=negotiateResponse.url}if(negotiateResponse.accessToken){accessToken_1=negotiateResponse.accessToken;this_1.accessTokenFactory=function(){return accessToken_1}}redirects++;return[2]}})};this_1=this;_a.label=6;case 6:return[5,_loop_1()];case 7:state_1=_a.sent();if(typeof state_1==="object")return[2,state_1.value];_a.label=8;case 8:if(negotiateResponse.url&&redirects=0){if(transport===ITransport.HttpTransportType.WebSockets&&typeof WebSocket==="undefined"||transport===ITransport.HttpTransportType.ServerSentEvents&&typeof EventSource==="undefined"){this.logger.log(ILogger.LogLevel.Debug,"Skipping transport '"+ITransport.HttpTransportType[transport]+"' because it is not supported in your environment.'")}else{this.logger.log(ILogger.LogLevel.Debug,"Selecting transport '"+ITransport.HttpTransportType[transport]+"'");return transport}}else{this.logger.log(ILogger.LogLevel.Debug,"Skipping transport '"+ITransport.HttpTransportType[transport]+"' because it does not support the requested transfer format '"+ITransport.TransferFormat[requestedTransferFormat]+"'.")}}else{this.logger.log(ILogger.LogLevel.Debug,"Skipping transport '"+ITransport.HttpTransportType[transport]+"' because it was disabled by the client.")}}return null};HttpConnection.prototype.isITransport=function(transport){return transport&&typeof transport==="object"&&"connect"in transport};HttpConnection.prototype.changeState=function(from,to){if(this.connectionState===from){this.connectionState=to;return true}return false};HttpConnection.prototype.stopConnection=function(error){return tslib_1.__awaiter(this,void 0,void 0,function(){return tslib_1.__generator(this,function(_a){this.transport=null;error=this.stopError||error;if(error){this.logger.log(ILogger.LogLevel.Error,"Connection disconnected with error '"+error+"'.")}else{this.logger.log(ILogger.LogLevel.Information,"Connection disconnected.")}this.connectionState=2;if(this.onclose){this.onclose(error)}return[2]})})};HttpConnection.prototype.resolveUrl=function(url){if(url.lastIndexOf("https://",0)===0||url.lastIndexOf("http://",0)===0){return url}if(typeof window==="undefined"||!window||!window.document){throw new Error("Cannot resolve '"+url+"'.")}var aTag=window.document.createElement("a");aTag.href=url;this.logger.log(ILogger.LogLevel.Information,"Normalizing '"+url+"' to '"+aTag.href+"'.");return aTag.href};HttpConnection.prototype.resolveNegotiateUrl=function(url){var index=url.indexOf("?");var negotiateUrl=url.substring(0,index===-1?url.length:index);if(negotiateUrl[negotiateUrl.length-1]!=="/"){negotiateUrl+="/"}negotiateUrl+="negotiate";negotiateUrl+=index===-1?"":url.substring(index);return negotiateUrl};return HttpConnection}();exports.HttpConnection=HttpConnection;function transportMatches(requestedTransport,actualTransport){return!requestedTransport||(actualTransport&requestedTransport)!==0}});unwrapExports(HttpConnection_1);var HttpConnection_2=HttpConnection_1.HttpConnection;var JsonHubProtocol_1=createCommonjsModule(function(module,exports){Object.defineProperty(exports,"__esModule",{value:true});var JSON_HUB_PROTOCOL_NAME="json";var JsonHubProtocol=function(){function JsonHubProtocol(){this.name=JSON_HUB_PROTOCOL_NAME;this.version=1;this.transferFormat=ITransport.TransferFormat.Text}JsonHubProtocol.prototype.parseMessages=function(input,logger){if(typeof input!=="string"){throw new Error("Invalid input for JSON hub protocol. Expected a string.")}if(!input){return[]}if(logger===null){logger=Loggers.NullLogger.instance}var messages=TextMessageFormat_1.TextMessageFormat.parse(input);var hubMessages=[];for(var _i=0,messages_1=messages;_i" )
+ .attr( "name", validator.submitButton.name )
+ .val( $( validator.submitButton ).val() )
+ .appendTo( validator.currentForm );
+ }
+
+ if ( validator.settings.submitHandler ) {
+ result = validator.settings.submitHandler.call( validator, validator.currentForm, event );
+ if ( hidden ) {
+
+ // And clean up afterwards; thanks to no-block-scope, hidden can be referenced
+ hidden.remove();
+ }
+ if ( result !== undefined ) {
+ return result;
+ }
+ return false;
+ }
+ return true;
+ }
+
+ // Prevent submit for invalid forms or custom submit handlers
+ if ( validator.cancelSubmit ) {
+ validator.cancelSubmit = false;
+ return handle();
+ }
+ if ( validator.form() ) {
+ if ( validator.pendingRequest ) {
+ validator.formSubmitted = true;
+ return false;
+ }
+ return handle();
+ } else {
+ validator.focusInvalid();
+ return false;
+ }
+ } );
+ }
+
+ return validator;
+ },
+
+ // https://jqueryvalidation.org/valid/
+ valid: function() {
+ var valid, validator, errorList;
+
+ if ( $( this[ 0 ] ).is( "form" ) ) {
+ valid = this.validate().form();
+ } else {
+ errorList = [];
+ valid = true;
+ validator = $( this[ 0 ].form ).validate();
+ this.each( function() {
+ valid = validator.element( this ) && valid;
+ if ( !valid ) {
+ errorList = errorList.concat( validator.errorList );
+ }
+ } );
+ validator.errorList = errorList;
+ }
+ return valid;
+ },
+
+ // https://jqueryvalidation.org/rules/
+ rules: function( command, argument ) {
+ var element = this[ 0 ],
+ settings, staticRules, existingRules, data, param, filtered;
+
+ // If nothing is selected, return empty object; can't chain anyway
+ if ( element == null ) {
+ return;
+ }
+
+ if ( !element.form && element.hasAttribute( "contenteditable" ) ) {
+ element.form = this.closest( "form" )[ 0 ];
+ element.name = this.attr( "name" );
+ }
+
+ if ( element.form == null ) {
+ return;
+ }
+
+ if ( command ) {
+ settings = $.data( element.form, "validator" ).settings;
+ staticRules = settings.rules;
+ existingRules = $.validator.staticRules( element );
+ switch ( command ) {
+ case "add":
+ $.extend( existingRules, $.validator.normalizeRule( argument ) );
+
+ // Remove messages from rules, but allow them to be set separately
+ delete existingRules.messages;
+ staticRules[ element.name ] = existingRules;
+ if ( argument.messages ) {
+ settings.messages[ element.name ] = $.extend( settings.messages[ element.name ], argument.messages );
+ }
+ break;
+ case "remove":
+ if ( !argument ) {
+ delete staticRules[ element.name ];
+ return existingRules;
+ }
+ filtered = {};
+ $.each( argument.split( /\s/ ), function( index, method ) {
+ filtered[ method ] = existingRules[ method ];
+ delete existingRules[ method ];
+ } );
+ return filtered;
+ }
+ }
+
+ data = $.validator.normalizeRules(
+ $.extend(
+ {},
+ $.validator.classRules( element ),
+ $.validator.attributeRules( element ),
+ $.validator.dataRules( element ),
+ $.validator.staticRules( element )
+ ), element );
+
+ // Make sure required is at front
+ if ( data.required ) {
+ param = data.required;
+ delete data.required;
+ data = $.extend( { required: param }, data );
+ }
+
+ // Make sure remote is at back
+ if ( data.remote ) {
+ param = data.remote;
+ delete data.remote;
+ data = $.extend( data, { remote: param } );
+ }
+
+ return data;
+ }
+} );
+
+// Custom selectors
+$.extend( $.expr.pseudos || $.expr[ ":" ], { // '|| $.expr[ ":" ]' here enables backwards compatibility to jQuery 1.7. Can be removed when dropping jQ 1.7.x support
+
+ // https://jqueryvalidation.org/blank-selector/
+ blank: function( a ) {
+ return !$.trim( "" + $( a ).val() );
+ },
+
+ // https://jqueryvalidation.org/filled-selector/
+ filled: function( a ) {
+ var val = $( a ).val();
+ return val !== null && !!$.trim( "" + val );
+ },
+
+ // https://jqueryvalidation.org/unchecked-selector/
+ unchecked: function( a ) {
+ return !$( a ).prop( "checked" );
+ }
+} );
+
+// Constructor for validator
+$.validator = function( options, form ) {
+ this.settings = $.extend( true, {}, $.validator.defaults, options );
+ this.currentForm = form;
+ this.init();
+};
+
+// https://jqueryvalidation.org/jQuery.validator.format/
+$.validator.format = function( source, params ) {
+ if ( arguments.length === 1 ) {
+ return function() {
+ var args = $.makeArray( arguments );
+ args.unshift( source );
+ return $.validator.format.apply( this, args );
+ };
+ }
+ if ( params === undefined ) {
+ return source;
+ }
+ if ( arguments.length > 2 && params.constructor !== Array ) {
+ params = $.makeArray( arguments ).slice( 1 );
+ }
+ if ( params.constructor !== Array ) {
+ params = [ params ];
+ }
+ $.each( params, function( i, n ) {
+ source = source.replace( new RegExp( "\\{" + i + "\\}", "g" ), function() {
+ return n;
+ } );
+ } );
+ return source;
+};
+
+$.extend( $.validator, {
+
+ defaults: {
+ messages: {},
+ groups: {},
+ rules: {},
+ errorClass: "error",
+ pendingClass: "pending",
+ validClass: "valid",
+ errorElement: "label",
+ focusCleanup: false,
+ focusInvalid: true,
+ errorContainer: $( [] ),
+ errorLabelContainer: $( [] ),
+ onsubmit: true,
+ ignore: ":hidden",
+ ignoreTitle: false,
+ onfocusin: function( element ) {
+ this.lastActive = element;
+
+ // Hide error label and remove error class on focus if enabled
+ if ( this.settings.focusCleanup ) {
+ if ( this.settings.unhighlight ) {
+ this.settings.unhighlight.call( this, element, this.settings.errorClass, this.settings.validClass );
+ }
+ this.hideThese( this.errorsFor( element ) );
+ }
+ },
+ onfocusout: function( element ) {
+ if ( !this.checkable( element ) && ( element.name in this.submitted || !this.optional( element ) ) ) {
+ this.element( element );
+ }
+ },
+ onkeyup: function( element, event ) {
+
+ // Avoid revalidate the field when pressing one of the following keys
+ // Shift => 16
+ // Ctrl => 17
+ // Alt => 18
+ // Caps lock => 20
+ // End => 35
+ // Home => 36
+ // Left arrow => 37
+ // Up arrow => 38
+ // Right arrow => 39
+ // Down arrow => 40
+ // Insert => 45
+ // Num lock => 144
+ // AltGr key => 225
+ var excludedKeys = [
+ 16, 17, 18, 20, 35, 36, 37,
+ 38, 39, 40, 45, 144, 225
+ ];
+
+ if ( event.which === 9 && this.elementValue( element ) === "" || $.inArray( event.keyCode, excludedKeys ) !== -1 ) {
+ return;
+ } else if ( element.name in this.submitted || element.name in this.invalid ) {
+ this.element( element );
+ }
+ },
+ onclick: function( element ) {
+
+ // Click on selects, radiobuttons and checkboxes
+ if ( element.name in this.submitted ) {
+ this.element( element );
+
+ // Or option elements, check parent select in that case
+ } else if ( element.parentNode.name in this.submitted ) {
+ this.element( element.parentNode );
+ }
+ },
+ highlight: function( element, errorClass, validClass ) {
+ if ( element.type === "radio" ) {
+ this.findByName( element.name ).addClass( errorClass ).removeClass( validClass );
+ } else {
+ $( element ).addClass( errorClass ).removeClass( validClass );
+ }
+ },
+ unhighlight: function( element, errorClass, validClass ) {
+ if ( element.type === "radio" ) {
+ this.findByName( element.name ).removeClass( errorClass ).addClass( validClass );
+ } else {
+ $( element ).removeClass( errorClass ).addClass( validClass );
+ }
+ }
+ },
+
+ // https://jqueryvalidation.org/jQuery.validator.setDefaults/
+ setDefaults: function( settings ) {
+ $.extend( $.validator.defaults, settings );
+ },
+
+ messages: {
+ required: "This field is required.",
+ remote: "Please fix this field.",
+ email: "Please enter a valid email address.",
+ url: "Please enter a valid URL.",
+ date: "Please enter a valid date.",
+ dateISO: "Please enter a valid date (ISO).",
+ number: "Please enter a valid number.",
+ digits: "Please enter only digits.",
+ equalTo: "Please enter the same value again.",
+ maxlength: $.validator.format( "Please enter no more than {0} characters." ),
+ minlength: $.validator.format( "Please enter at least {0} characters." ),
+ rangelength: $.validator.format( "Please enter a value between {0} and {1} characters long." ),
+ range: $.validator.format( "Please enter a value between {0} and {1}." ),
+ max: $.validator.format( "Please enter a value less than or equal to {0}." ),
+ min: $.validator.format( "Please enter a value greater than or equal to {0}." ),
+ step: $.validator.format( "Please enter a multiple of {0}." )
+ },
+
+ autoCreateRanges: false,
+
+ prototype: {
+
+ init: function() {
+ this.labelContainer = $( this.settings.errorLabelContainer );
+ this.errorContext = this.labelContainer.length && this.labelContainer || $( this.currentForm );
+ this.containers = $( this.settings.errorContainer ).add( this.settings.errorLabelContainer );
+ this.submitted = {};
+ this.valueCache = {};
+ this.pendingRequest = 0;
+ this.pending = {};
+ this.invalid = {};
+ this.reset();
+
+ var groups = ( this.groups = {} ),
+ rules;
+ $.each( this.settings.groups, function( key, value ) {
+ if ( typeof value === "string" ) {
+ value = value.split( /\s/ );
+ }
+ $.each( value, function( index, name ) {
+ groups[ name ] = key;
+ } );
+ } );
+ rules = this.settings.rules;
+ $.each( rules, function( key, value ) {
+ rules[ key ] = $.validator.normalizeRule( value );
+ } );
+
+ function delegate( event ) {
+
+ // Set form expando on contenteditable
+ if ( !this.form && this.hasAttribute( "contenteditable" ) ) {
+ this.form = $( this ).closest( "form" )[ 0 ];
+ this.name = $( this ).attr( "name" );
+ }
+
+ var validator = $.data( this.form, "validator" ),
+ eventType = "on" + event.type.replace( /^validate/, "" ),
+ settings = validator.settings;
+ if ( settings[ eventType ] && !$( this ).is( settings.ignore ) ) {
+ settings[ eventType ].call( validator, this, event );
+ }
+ }
+
+ $( this.currentForm )
+ .on( "focusin.validate focusout.validate keyup.validate",
+ ":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'], " +
+ "[type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], " +
+ "[type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'], " +
+ "[type='radio'], [type='checkbox'], [contenteditable], [type='button']", delegate )
+
+ // Support: Chrome, oldIE
+ // "select" is provided as event.target when clicking a option
+ .on( "click.validate", "select, option, [type='radio'], [type='checkbox']", delegate );
+
+ if ( this.settings.invalidHandler ) {
+ $( this.currentForm ).on( "invalid-form.validate", this.settings.invalidHandler );
+ }
+ },
+
+ // https://jqueryvalidation.org/Validator.form/
+ form: function() {
+ this.checkForm();
+ $.extend( this.submitted, this.errorMap );
+ this.invalid = $.extend( {}, this.errorMap );
+ if ( !this.valid() ) {
+ $( this.currentForm ).triggerHandler( "invalid-form", [ this ] );
+ }
+ this.showErrors();
+ return this.valid();
+ },
+
+ checkForm: function() {
+ this.prepareForm();
+ for ( var i = 0, elements = ( this.currentElements = this.elements() ); elements[ i ]; i++ ) {
+ this.check( elements[ i ] );
+ }
+ return this.valid();
+ },
+
+ // https://jqueryvalidation.org/Validator.element/
+ element: function( element ) {
+ var cleanElement = this.clean( element ),
+ checkElement = this.validationTargetFor( cleanElement ),
+ v = this,
+ result = true,
+ rs, group;
+
+ if ( checkElement === undefined ) {
+ delete this.invalid[ cleanElement.name ];
+ } else {
+ this.prepareElement( checkElement );
+ this.currentElements = $( checkElement );
+
+ // If this element is grouped, then validate all group elements already
+ // containing a value
+ group = this.groups[ checkElement.name ];
+ if ( group ) {
+ $.each( this.groups, function( name, testgroup ) {
+ if ( testgroup === group && name !== checkElement.name ) {
+ cleanElement = v.validationTargetFor( v.clean( v.findByName( name ) ) );
+ if ( cleanElement && cleanElement.name in v.invalid ) {
+ v.currentElements.push( cleanElement );
+ result = v.check( cleanElement ) && result;
+ }
+ }
+ } );
+ }
+
+ rs = this.check( checkElement ) !== false;
+ result = result && rs;
+ if ( rs ) {
+ this.invalid[ checkElement.name ] = false;
+ } else {
+ this.invalid[ checkElement.name ] = true;
+ }
+
+ if ( !this.numberOfInvalids() ) {
+
+ // Hide error containers on last error
+ this.toHide = this.toHide.add( this.containers );
+ }
+ this.showErrors();
+
+ // Add aria-invalid status for screen readers
+ $( element ).attr( "aria-invalid", !rs );
+ }
+
+ return result;
+ },
+
+ // https://jqueryvalidation.org/Validator.showErrors/
+ showErrors: function( errors ) {
+ if ( errors ) {
+ var validator = this;
+
+ // Add items to error list and map
+ $.extend( this.errorMap, errors );
+ this.errorList = $.map( this.errorMap, function( message, name ) {
+ return {
+ message: message,
+ element: validator.findByName( name )[ 0 ]
+ };
+ } );
+
+ // Remove items from success list
+ this.successList = $.grep( this.successList, function( element ) {
+ return !( element.name in errors );
+ } );
+ }
+ if ( this.settings.showErrors ) {
+ this.settings.showErrors.call( this, this.errorMap, this.errorList );
+ } else {
+ this.defaultShowErrors();
+ }
+ },
+
+ // https://jqueryvalidation.org/Validator.resetForm/
+ resetForm: function() {
+ if ( $.fn.resetForm ) {
+ $( this.currentForm ).resetForm();
+ }
+ this.invalid = {};
+ this.submitted = {};
+ this.prepareForm();
+ this.hideErrors();
+ var elements = this.elements()
+ .removeData( "previousValue" )
+ .removeAttr( "aria-invalid" );
+
+ this.resetElements( elements );
+ },
+
+ resetElements: function( elements ) {
+ var i;
+
+ if ( this.settings.unhighlight ) {
+ for ( i = 0; elements[ i ]; i++ ) {
+ this.settings.unhighlight.call( this, elements[ i ],
+ this.settings.errorClass, "" );
+ this.findByName( elements[ i ].name ).removeClass( this.settings.validClass );
+ }
+ } else {
+ elements
+ .removeClass( this.settings.errorClass )
+ .removeClass( this.settings.validClass );
+ }
+ },
+
+ numberOfInvalids: function() {
+ return this.objectLength( this.invalid );
+ },
+
+ objectLength: function( obj ) {
+ /* jshint unused: false */
+ var count = 0,
+ i;
+ for ( i in obj ) {
+
+ // This check allows counting elements with empty error
+ // message as invalid elements
+ if ( obj[ i ] !== undefined && obj[ i ] !== null && obj[ i ] !== false ) {
+ count++;
+ }
+ }
+ return count;
+ },
+
+ hideErrors: function() {
+ this.hideThese( this.toHide );
+ },
+
+ hideThese: function( errors ) {
+ errors.not( this.containers ).text( "" );
+ this.addWrapper( errors ).hide();
+ },
+
+ valid: function() {
+ return this.size() === 0;
+ },
+
+ size: function() {
+ return this.errorList.length;
+ },
+
+ focusInvalid: function() {
+ if ( this.settings.focusInvalid ) {
+ try {
+ $( this.findLastActive() || this.errorList.length && this.errorList[ 0 ].element || [] )
+ .filter( ":visible" )
+ .focus()
+
+ // Manually trigger focusin event; without it, focusin handler isn't called, findLastActive won't have anything to find
+ .trigger( "focusin" );
+ } catch ( e ) {
+
+ // Ignore IE throwing errors when focusing hidden elements
+ }
+ }
+ },
+
+ findLastActive: function() {
+ var lastActive = this.lastActive;
+ return lastActive && $.grep( this.errorList, function( n ) {
+ return n.element.name === lastActive.name;
+ } ).length === 1 && lastActive;
+ },
+
+ elements: function() {
+ var validator = this,
+ rulesCache = {};
+
+ // Select all valid inputs inside the form (no submit or reset buttons)
+ return $( this.currentForm )
+ .find( "input, select, textarea, [contenteditable]" )
+ .not( ":submit, :reset, :image, :disabled" )
+ .not( this.settings.ignore )
+ .filter( function() {
+ var name = this.name || $( this ).attr( "name" ); // For contenteditable
+ if ( !name && validator.settings.debug && window.console ) {
+ console.error( "%o has no name assigned", this );
+ }
+
+ // Set form expando on contenteditable
+ if ( this.hasAttribute( "contenteditable" ) ) {
+ this.form = $( this ).closest( "form" )[ 0 ];
+ this.name = name;
+ }
+
+ // Select only the first element for each name, and only those with rules specified
+ if ( name in rulesCache || !validator.objectLength( $( this ).rules() ) ) {
+ return false;
+ }
+
+ rulesCache[ name ] = true;
+ return true;
+ } );
+ },
+
+ clean: function( selector ) {
+ return $( selector )[ 0 ];
+ },
+
+ errors: function() {
+ var errorClass = this.settings.errorClass.split( " " ).join( "." );
+ return $( this.settings.errorElement + "." + errorClass, this.errorContext );
+ },
+
+ resetInternals: function() {
+ this.successList = [];
+ this.errorList = [];
+ this.errorMap = {};
+ this.toShow = $( [] );
+ this.toHide = $( [] );
+ },
+
+ reset: function() {
+ this.resetInternals();
+ this.currentElements = $( [] );
+ },
+
+ prepareForm: function() {
+ this.reset();
+ this.toHide = this.errors().add( this.containers );
+ },
+
+ prepareElement: function( element ) {
+ this.reset();
+ this.toHide = this.errorsFor( element );
+ },
+
+ elementValue: function( element ) {
+ var $element = $( element ),
+ type = element.type,
+ val, idx;
+
+ if ( type === "radio" || type === "checkbox" ) {
+ return this.findByName( element.name ).filter( ":checked" ).val();
+ } else if ( type === "number" && typeof element.validity !== "undefined" ) {
+ return element.validity.badInput ? "NaN" : $element.val();
+ }
+
+ if ( element.hasAttribute( "contenteditable" ) ) {
+ val = $element.text();
+ } else {
+ val = $element.val();
+ }
+
+ if ( type === "file" ) {
+
+ // Modern browser (chrome & safari)
+ if ( val.substr( 0, 12 ) === "C:\\fakepath\\" ) {
+ return val.substr( 12 );
+ }
+
+ // Legacy browsers
+ // Unix-based path
+ idx = val.lastIndexOf( "/" );
+ if ( idx >= 0 ) {
+ return val.substr( idx + 1 );
+ }
+
+ // Windows-based path
+ idx = val.lastIndexOf( "\\" );
+ if ( idx >= 0 ) {
+ return val.substr( idx + 1 );
+ }
+
+ // Just the file name
+ return val;
+ }
+
+ if ( typeof val === "string" ) {
+ return val.replace( /\r/g, "" );
+ }
+ return val;
+ },
+
+ check: function( element ) {
+ element = this.validationTargetFor( this.clean( element ) );
+
+ var rules = $( element ).rules(),
+ rulesCount = $.map( rules, function( n, i ) {
+ return i;
+ } ).length,
+ dependencyMismatch = false,
+ val = this.elementValue( element ),
+ result, method, rule, normalizer;
+
+ // Prioritize the local normalizer defined for this element over the global one
+ // if the former exists, otherwise user the global one in case it exists.
+ if ( typeof rules.normalizer === "function" ) {
+ normalizer = rules.normalizer;
+ } else if ( typeof this.settings.normalizer === "function" ) {
+ normalizer = this.settings.normalizer;
+ }
+
+ // If normalizer is defined, then call it to retreive the changed value instead
+ // of using the real one.
+ // Note that `this` in the normalizer is `element`.
+ if ( normalizer ) {
+ val = normalizer.call( element, val );
+
+ if ( typeof val !== "string" ) {
+ throw new TypeError( "The normalizer should return a string value." );
+ }
+
+ // Delete the normalizer from rules to avoid treating it as a pre-defined method.
+ delete rules.normalizer;
+ }
+
+ for ( method in rules ) {
+ rule = { method: method, parameters: rules[ method ] };
+ try {
+ result = $.validator.methods[ method ].call( this, val, element, rule.parameters );
+
+ // If a method indicates that the field is optional and therefore valid,
+ // don't mark it as valid when there are no other rules
+ if ( result === "dependency-mismatch" && rulesCount === 1 ) {
+ dependencyMismatch = true;
+ continue;
+ }
+ dependencyMismatch = false;
+
+ if ( result === "pending" ) {
+ this.toHide = this.toHide.not( this.errorsFor( element ) );
+ return;
+ }
+
+ if ( !result ) {
+ this.formatAndAdd( element, rule );
+ return false;
+ }
+ } catch ( e ) {
+ if ( this.settings.debug && window.console ) {
+ console.log( "Exception occurred when checking element " + element.id + ", check the '" + rule.method + "' method.", e );
+ }
+ if ( e instanceof TypeError ) {
+ e.message += ". Exception occurred when checking element " + element.id + ", check the '" + rule.method + "' method.";
+ }
+
+ throw e;
+ }
+ }
+ if ( dependencyMismatch ) {
+ return;
+ }
+ if ( this.objectLength( rules ) ) {
+ this.successList.push( element );
+ }
+ return true;
+ },
+
+ // Return the custom message for the given element and validation method
+ // specified in the element's HTML5 data attribute
+ // return the generic message if present and no method specific message is present
+ customDataMessage: function( element, method ) {
+ return $( element ).data( "msg" + method.charAt( 0 ).toUpperCase() +
+ method.substring( 1 ).toLowerCase() ) || $( element ).data( "msg" );
+ },
+
+ // Return the custom message for the given element name and validation method
+ customMessage: function( name, method ) {
+ var m = this.settings.messages[ name ];
+ return m && ( m.constructor === String ? m : m[ method ] );
+ },
+
+ // Return the first defined argument, allowing empty strings
+ findDefined: function() {
+ for ( var i = 0; i < arguments.length; i++ ) {
+ if ( arguments[ i ] !== undefined ) {
+ return arguments[ i ];
+ }
+ }
+ return undefined;
+ },
+
+ // The second parameter 'rule' used to be a string, and extended to an object literal
+ // of the following form:
+ // rule = {
+ // method: "method name",
+ // parameters: "the given method parameters"
+ // }
+ //
+ // The old behavior still supported, kept to maintain backward compatibility with
+ // old code, and will be removed in the next major release.
+ defaultMessage: function( element, rule ) {
+ if ( typeof rule === "string" ) {
+ rule = { method: rule };
+ }
+
+ var message = this.findDefined(
+ this.customMessage( element.name, rule.method ),
+ this.customDataMessage( element, rule.method ),
+
+ // 'title' is never undefined, so handle empty string as undefined
+ !this.settings.ignoreTitle && element.title || undefined,
+ $.validator.messages[ rule.method ],
+ "Warning: No message defined for " + element.name + ""
+ ),
+ theregex = /\$?\{(\d+)\}/g;
+ if ( typeof message === "function" ) {
+ message = message.call( this, rule.parameters, element );
+ } else if ( theregex.test( message ) ) {
+ message = $.validator.format( message.replace( theregex, "{$1}" ), rule.parameters );
+ }
+
+ return message;
+ },
+
+ formatAndAdd: function( element, rule ) {
+ var message = this.defaultMessage( element, rule );
+
+ this.errorList.push( {
+ message: message,
+ element: element,
+ method: rule.method
+ } );
+
+ this.errorMap[ element.name ] = message;
+ this.submitted[ element.name ] = message;
+ },
+
+ addWrapper: function( toToggle ) {
+ if ( this.settings.wrapper ) {
+ toToggle = toToggle.add( toToggle.parent( this.settings.wrapper ) );
+ }
+ return toToggle;
+ },
+
+ defaultShowErrors: function() {
+ var i, elements, error;
+ for ( i = 0; this.errorList[ i ]; i++ ) {
+ error = this.errorList[ i ];
+ if ( this.settings.highlight ) {
+ this.settings.highlight.call( this, error.element, this.settings.errorClass, this.settings.validClass );
+ }
+ this.showLabel( error.element, error.message );
+ }
+ if ( this.errorList.length ) {
+ this.toShow = this.toShow.add( this.containers );
+ }
+ if ( this.settings.success ) {
+ for ( i = 0; this.successList[ i ]; i++ ) {
+ this.showLabel( this.successList[ i ] );
+ }
+ }
+ if ( this.settings.unhighlight ) {
+ for ( i = 0, elements = this.validElements(); elements[ i ]; i++ ) {
+ this.settings.unhighlight.call( this, elements[ i ], this.settings.errorClass, this.settings.validClass );
+ }
+ }
+ this.toHide = this.toHide.not( this.toShow );
+ this.hideErrors();
+ this.addWrapper( this.toShow ).show();
+ },
+
+ validElements: function() {
+ return this.currentElements.not( this.invalidElements() );
+ },
+
+ invalidElements: function() {
+ return $( this.errorList ).map( function() {
+ return this.element;
+ } );
+ },
+
+ showLabel: function( element, message ) {
+ var place, group, errorID, v,
+ error = this.errorsFor( element ),
+ elementID = this.idOrName( element ),
+ describedBy = $( element ).attr( "aria-describedby" );
+
+ if ( error.length ) {
+
+ // Refresh error/success class
+ error.removeClass( this.settings.validClass ).addClass( this.settings.errorClass );
+
+ // Replace message on existing label
+ error.html( message );
+ } else {
+
+ // Create error element
+ error = $( "<" + this.settings.errorElement + ">" )
+ .attr( "id", elementID + "-error" )
+ .addClass( this.settings.errorClass )
+ .html( message || "" );
+
+ // Maintain reference to the element to be placed into the DOM
+ place = error;
+ if ( this.settings.wrapper ) {
+
+ // Make sure the element is visible, even in IE
+ // actually showing the wrapped element is handled elsewhere
+ place = error.hide().show().wrap( "<" + this.settings.wrapper + "/>" ).parent();
+ }
+ if ( this.labelContainer.length ) {
+ this.labelContainer.append( place );
+ } else if ( this.settings.errorPlacement ) {
+ this.settings.errorPlacement.call( this, place, $( element ) );
+ } else {
+ place.insertAfter( element );
+ }
+
+ // Link error back to the element
+ if ( error.is( "label" ) ) {
+
+ // If the error is a label, then associate using 'for'
+ error.attr( "for", elementID );
+
+ // If the element is not a child of an associated label, then it's necessary
+ // to explicitly apply aria-describedby
+ } else if ( error.parents( "label[for='" + this.escapeCssMeta( elementID ) + "']" ).length === 0 ) {
+ errorID = error.attr( "id" );
+
+ // Respect existing non-error aria-describedby
+ if ( !describedBy ) {
+ describedBy = errorID;
+ } else if ( !describedBy.match( new RegExp( "\\b" + this.escapeCssMeta( errorID ) + "\\b" ) ) ) {
+
+ // Add to end of list if not already present
+ describedBy += " " + errorID;
+ }
+ $( element ).attr( "aria-describedby", describedBy );
+
+ // If this element is grouped, then assign to all elements in the same group
+ group = this.groups[ element.name ];
+ if ( group ) {
+ v = this;
+ $.each( v.groups, function( name, testgroup ) {
+ if ( testgroup === group ) {
+ $( "[name='" + v.escapeCssMeta( name ) + "']", v.currentForm )
+ .attr( "aria-describedby", error.attr( "id" ) );
+ }
+ } );
+ }
+ }
+ }
+ if ( !message && this.settings.success ) {
+ error.text( "" );
+ if ( typeof this.settings.success === "string" ) {
+ error.addClass( this.settings.success );
+ } else {
+ this.settings.success( error, element );
+ }
+ }
+ this.toShow = this.toShow.add( error );
+ },
+
+ errorsFor: function( element ) {
+ var name = this.escapeCssMeta( this.idOrName( element ) ),
+ describer = $( element ).attr( "aria-describedby" ),
+ selector = "label[for='" + name + "'], label[for='" + name + "'] *";
+
+ // 'aria-describedby' should directly reference the error element
+ if ( describer ) {
+ selector = selector + ", #" + this.escapeCssMeta( describer )
+ .replace( /\s+/g, ", #" );
+ }
+
+ return this
+ .errors()
+ .filter( selector );
+ },
+
+ // See https://api.jquery.com/category/selectors/, for CSS
+ // meta-characters that should be escaped in order to be used with JQuery
+ // as a literal part of a name/id or any selector.
+ escapeCssMeta: function( string ) {
+ return string.replace( /([\\!"#$%&'()*+,./:;<=>?@\[\]^`{|}~])/g, "\\$1" );
+ },
+
+ idOrName: function( element ) {
+ return this.groups[ element.name ] || ( this.checkable( element ) ? element.name : element.id || element.name );
+ },
+
+ validationTargetFor: function( element ) {
+
+ // If radio/checkbox, validate first element in group instead
+ if ( this.checkable( element ) ) {
+ element = this.findByName( element.name );
+ }
+
+ // Always apply ignore filter
+ return $( element ).not( this.settings.ignore )[ 0 ];
+ },
+
+ checkable: function( element ) {
+ return ( /radio|checkbox/i ).test( element.type );
+ },
+
+ findByName: function( name ) {
+ return $( this.currentForm ).find( "[name='" + this.escapeCssMeta( name ) + "']" );
+ },
+
+ getLength: function( value, element ) {
+ switch ( element.nodeName.toLowerCase() ) {
+ case "select":
+ return $( "option:selected", element ).length;
+ case "input":
+ if ( this.checkable( element ) ) {
+ return this.findByName( element.name ).filter( ":checked" ).length;
+ }
+ }
+ return value.length;
+ },
+
+ depend: function( param, element ) {
+ return this.dependTypes[ typeof param ] ? this.dependTypes[ typeof param ]( param, element ) : true;
+ },
+
+ dependTypes: {
+ "boolean": function( param ) {
+ return param;
+ },
+ "string": function( param, element ) {
+ return !!$( param, element.form ).length;
+ },
+ "function": function( param, element ) {
+ return param( element );
+ }
+ },
+
+ optional: function( element ) {
+ var val = this.elementValue( element );
+ return !$.validator.methods.required.call( this, val, element ) && "dependency-mismatch";
+ },
+
+ startRequest: function( element ) {
+ if ( !this.pending[ element.name ] ) {
+ this.pendingRequest++;
+ $( element ).addClass( this.settings.pendingClass );
+ this.pending[ element.name ] = true;
+ }
+ },
+
+ stopRequest: function( element, valid ) {
+ this.pendingRequest--;
+
+ // Sometimes synchronization fails, make sure pendingRequest is never < 0
+ if ( this.pendingRequest < 0 ) {
+ this.pendingRequest = 0;
+ }
+ delete this.pending[ element.name ];
+ $( element ).removeClass( this.settings.pendingClass );
+ if ( valid && this.pendingRequest === 0 && this.formSubmitted && this.form() ) {
+ $( this.currentForm ).submit();
+
+ // Remove the hidden input that was used as a replacement for the
+ // missing submit button. The hidden input is added by `handle()`
+ // to ensure that the value of the used submit button is passed on
+ // for scripted submits triggered by this method
+ if ( this.submitButton ) {
+ $( "input:hidden[name='" + this.submitButton.name + "']", this.currentForm ).remove();
+ }
+
+ this.formSubmitted = false;
+ } else if ( !valid && this.pendingRequest === 0 && this.formSubmitted ) {
+ $( this.currentForm ).triggerHandler( "invalid-form", [ this ] );
+ this.formSubmitted = false;
+ }
+ },
+
+ previousValue: function( element, method ) {
+ method = typeof method === "string" && method || "remote";
+
+ return $.data( element, "previousValue" ) || $.data( element, "previousValue", {
+ old: null,
+ valid: true,
+ message: this.defaultMessage( element, { method: method } )
+ } );
+ },
+
+ // Cleans up all forms and elements, removes validator-specific events
+ destroy: function() {
+ this.resetForm();
+
+ $( this.currentForm )
+ .off( ".validate" )
+ .removeData( "validator" )
+ .find( ".validate-equalTo-blur" )
+ .off( ".validate-equalTo" )
+ .removeClass( "validate-equalTo-blur" );
+ }
+
+ },
+
+ classRuleSettings: {
+ required: { required: true },
+ email: { email: true },
+ url: { url: true },
+ date: { date: true },
+ dateISO: { dateISO: true },
+ number: { number: true },
+ digits: { digits: true },
+ creditcard: { creditcard: true }
+ },
+
+ addClassRules: function( className, rules ) {
+ if ( className.constructor === String ) {
+ this.classRuleSettings[ className ] = rules;
+ } else {
+ $.extend( this.classRuleSettings, className );
+ }
+ },
+
+ classRules: function( element ) {
+ var rules = {},
+ classes = $( element ).attr( "class" );
+
+ if ( classes ) {
+ $.each( classes.split( " " ), function() {
+ if ( this in $.validator.classRuleSettings ) {
+ $.extend( rules, $.validator.classRuleSettings[ this ] );
+ }
+ } );
+ }
+ return rules;
+ },
+
+ normalizeAttributeRule: function( rules, type, method, value ) {
+
+ // Convert the value to a number for number inputs, and for text for backwards compability
+ // allows type="date" and others to be compared as strings
+ if ( /min|max|step/.test( method ) && ( type === null || /number|range|text/.test( type ) ) ) {
+ value = Number( value );
+
+ // Support Opera Mini, which returns NaN for undefined minlength
+ if ( isNaN( value ) ) {
+ value = undefined;
+ }
+ }
+
+ if ( value || value === 0 ) {
+ rules[ method ] = value;
+ } else if ( type === method && type !== "range" ) {
+
+ // Exception: the jquery validate 'range' method
+ // does not test for the html5 'range' type
+ rules[ method ] = true;
+ }
+ },
+
+ attributeRules: function( element ) {
+ var rules = {},
+ $element = $( element ),
+ type = element.getAttribute( "type" ),
+ method, value;
+
+ for ( method in $.validator.methods ) {
+
+ // Support for in both html5 and older browsers
+ if ( method === "required" ) {
+ value = element.getAttribute( method );
+
+ // Some browsers return an empty string for the required attribute
+ // and non-HTML5 browsers might have required="" markup
+ if ( value === "" ) {
+ value = true;
+ }
+
+ // Force non-HTML5 browsers to return bool
+ value = !!value;
+ } else {
+ value = $element.attr( method );
+ }
+
+ this.normalizeAttributeRule( rules, type, method, value );
+ }
+
+ // 'maxlength' may be returned as -1, 2147483647 ( IE ) and 524288 ( safari ) for text inputs
+ if ( rules.maxlength && /-1|2147483647|524288/.test( rules.maxlength ) ) {
+ delete rules.maxlength;
+ }
+
+ return rules;
+ },
+
+ dataRules: function( element ) {
+ var rules = {},
+ $element = $( element ),
+ type = element.getAttribute( "type" ),
+ method, value;
+
+ for ( method in $.validator.methods ) {
+ value = $element.data( "rule" + method.charAt( 0 ).toUpperCase() + method.substring( 1 ).toLowerCase() );
+ this.normalizeAttributeRule( rules, type, method, value );
+ }
+ return rules;
+ },
+
+ staticRules: function( element ) {
+ var rules = {},
+ validator = $.data( element.form, "validator" );
+
+ if ( validator.settings.rules ) {
+ rules = $.validator.normalizeRule( validator.settings.rules[ element.name ] ) || {};
+ }
+ return rules;
+ },
+
+ normalizeRules: function( rules, element ) {
+
+ // Handle dependency check
+ $.each( rules, function( prop, val ) {
+
+ // Ignore rule when param is explicitly false, eg. required:false
+ if ( val === false ) {
+ delete rules[ prop ];
+ return;
+ }
+ if ( val.param || val.depends ) {
+ var keepRule = true;
+ switch ( typeof val.depends ) {
+ case "string":
+ keepRule = !!$( val.depends, element.form ).length;
+ break;
+ case "function":
+ keepRule = val.depends.call( element, element );
+ break;
+ }
+ if ( keepRule ) {
+ rules[ prop ] = val.param !== undefined ? val.param : true;
+ } else {
+ $.data( element.form, "validator" ).resetElements( $( element ) );
+ delete rules[ prop ];
+ }
+ }
+ } );
+
+ // Evaluate parameters
+ $.each( rules, function( rule, parameter ) {
+ rules[ rule ] = $.isFunction( parameter ) && rule !== "normalizer" ? parameter( element ) : parameter;
+ } );
+
+ // Clean number parameters
+ $.each( [ "minlength", "maxlength" ], function() {
+ if ( rules[ this ] ) {
+ rules[ this ] = Number( rules[ this ] );
+ }
+ } );
+ $.each( [ "rangelength", "range" ], function() {
+ var parts;
+ if ( rules[ this ] ) {
+ if ( $.isArray( rules[ this ] ) ) {
+ rules[ this ] = [ Number( rules[ this ][ 0 ] ), Number( rules[ this ][ 1 ] ) ];
+ } else if ( typeof rules[ this ] === "string" ) {
+ parts = rules[ this ].replace( /[\[\]]/g, "" ).split( /[\s,]+/ );
+ rules[ this ] = [ Number( parts[ 0 ] ), Number( parts[ 1 ] ) ];
+ }
+ }
+ } );
+
+ if ( $.validator.autoCreateRanges ) {
+
+ // Auto-create ranges
+ if ( rules.min != null && rules.max != null ) {
+ rules.range = [ rules.min, rules.max ];
+ delete rules.min;
+ delete rules.max;
+ }
+ if ( rules.minlength != null && rules.maxlength != null ) {
+ rules.rangelength = [ rules.minlength, rules.maxlength ];
+ delete rules.minlength;
+ delete rules.maxlength;
+ }
+ }
+
+ return rules;
+ },
+
+ // Converts a simple string to a {string: true} rule, e.g., "required" to {required:true}
+ normalizeRule: function( data ) {
+ if ( typeof data === "string" ) {
+ var transformed = {};
+ $.each( data.split( /\s/ ), function() {
+ transformed[ this ] = true;
+ } );
+ data = transformed;
+ }
+ return data;
+ },
+
+ // https://jqueryvalidation.org/jQuery.validator.addMethod/
+ addMethod: function( name, method, message ) {
+ $.validator.methods[ name ] = method;
+ $.validator.messages[ name ] = message !== undefined ? message : $.validator.messages[ name ];
+ if ( method.length < 3 ) {
+ $.validator.addClassRules( name, $.validator.normalizeRule( name ) );
+ }
+ },
+
+ // https://jqueryvalidation.org/jQuery.validator.methods/
+ methods: {
+
+ // https://jqueryvalidation.org/required-method/
+ required: function( value, element, param ) {
+
+ // Check if dependency is met
+ if ( !this.depend( param, element ) ) {
+ return "dependency-mismatch";
+ }
+ if ( element.nodeName.toLowerCase() === "select" ) {
+
+ // Could be an array for select-multiple or a string, both are fine this way
+ var val = $( element ).val();
+ return val && val.length > 0;
+ }
+ if ( this.checkable( element ) ) {
+ return this.getLength( value, element ) > 0;
+ }
+ return value.length > 0;
+ },
+
+ // https://jqueryvalidation.org/email-method/
+ email: function( value, element ) {
+
+ // From https://html.spec.whatwg.org/multipage/forms.html#valid-e-mail-address
+ // Retrieved 2014-01-14
+ // If you have a problem with this implementation, report a bug against the above spec
+ // Or use custom methods to implement your own email validation
+ return this.optional( element ) || /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test( value );
+ },
+
+ // https://jqueryvalidation.org/url-method/
+ url: function( value, element ) {
+
+ // Copyright (c) 2010-2013 Diego Perini, MIT licensed
+ // https://gist.github.com/dperini/729294
+ // see also https://mathiasbynens.be/demo/url-regex
+ // modified to allow protocol-relative URLs
+ return this.optional( element ) || /^(?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})).?)(?::\d{2,5})?(?:[/?#]\S*)?$/i.test( value );
+ },
+
+ // https://jqueryvalidation.org/date-method/
+ date: function( value, element ) {
+ return this.optional( element ) || !/Invalid|NaN/.test( new Date( value ).toString() );
+ },
+
+ // https://jqueryvalidation.org/dateISO-method/
+ dateISO: function( value, element ) {
+ return this.optional( element ) || /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test( value );
+ },
+
+ // https://jqueryvalidation.org/number-method/
+ number: function( value, element ) {
+ return this.optional( element ) || /^(?:-?\d+|-?\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test( value );
+ },
+
+ // https://jqueryvalidation.org/digits-method/
+ digits: function( value, element ) {
+ return this.optional( element ) || /^\d+$/.test( value );
+ },
+
+ // https://jqueryvalidation.org/minlength-method/
+ minlength: function( value, element, param ) {
+ var length = $.isArray( value ) ? value.length : this.getLength( value, element );
+ return this.optional( element ) || length >= param;
+ },
+
+ // https://jqueryvalidation.org/maxlength-method/
+ maxlength: function( value, element, param ) {
+ var length = $.isArray( value ) ? value.length : this.getLength( value, element );
+ return this.optional( element ) || length <= param;
+ },
+
+ // https://jqueryvalidation.org/rangelength-method/
+ rangelength: function( value, element, param ) {
+ var length = $.isArray( value ) ? value.length : this.getLength( value, element );
+ return this.optional( element ) || ( length >= param[ 0 ] && length <= param[ 1 ] );
+ },
+
+ // https://jqueryvalidation.org/min-method/
+ min: function( value, element, param ) {
+ return this.optional( element ) || value >= param;
+ },
+
+ // https://jqueryvalidation.org/max-method/
+ max: function( value, element, param ) {
+ return this.optional( element ) || value <= param;
+ },
+
+ // https://jqueryvalidation.org/range-method/
+ range: function( value, element, param ) {
+ return this.optional( element ) || ( value >= param[ 0 ] && value <= param[ 1 ] );
+ },
+
+ // https://jqueryvalidation.org/step-method/
+ step: function( value, element, param ) {
+ var type = $( element ).attr( "type" ),
+ errorMessage = "Step attribute on input type " + type + " is not supported.",
+ supportedTypes = [ "text", "number", "range" ],
+ re = new RegExp( "\\b" + type + "\\b" ),
+ notSupported = type && !re.test( supportedTypes.join() ),
+ decimalPlaces = function( num ) {
+ var match = ( "" + num ).match( /(?:\.(\d+))?$/ );
+ if ( !match ) {
+ return 0;
+ }
+
+ // Number of digits right of decimal point.
+ return match[ 1 ] ? match[ 1 ].length : 0;
+ },
+ toInt = function( num ) {
+ return Math.round( num * Math.pow( 10, decimals ) );
+ },
+ valid = true,
+ decimals;
+
+ // Works only for text, number and range input types
+ // TODO find a way to support input types date, datetime, datetime-local, month, time and week
+ if ( notSupported ) {
+ throw new Error( errorMessage );
+ }
+
+ decimals = decimalPlaces( param );
+
+ // Value can't have too many decimals
+ if ( decimalPlaces( value ) > decimals || toInt( value ) % toInt( param ) !== 0 ) {
+ valid = false;
+ }
+
+ return this.optional( element ) || valid;
+ },
+
+ // https://jqueryvalidation.org/equalTo-method/
+ equalTo: function( value, element, param ) {
+
+ // Bind to the blur event of the target in order to revalidate whenever the target field is updated
+ var target = $( param );
+ if ( this.settings.onfocusout && target.not( ".validate-equalTo-blur" ).length ) {
+ target.addClass( "validate-equalTo-blur" ).on( "blur.validate-equalTo", function() {
+ $( element ).valid();
+ } );
+ }
+ return value === target.val();
+ },
+
+ // https://jqueryvalidation.org/remote-method/
+ remote: function( value, element, param, method ) {
+ if ( this.optional( element ) ) {
+ return "dependency-mismatch";
+ }
+
+ method = typeof method === "string" && method || "remote";
+
+ var previous = this.previousValue( element, method ),
+ validator, data, optionDataString;
+
+ if ( !this.settings.messages[ element.name ] ) {
+ this.settings.messages[ element.name ] = {};
+ }
+ previous.originalMessage = previous.originalMessage || this.settings.messages[ element.name ][ method ];
+ this.settings.messages[ element.name ][ method ] = previous.message;
+
+ param = typeof param === "string" && { url: param } || param;
+ optionDataString = $.param( $.extend( { data: value }, param.data ) );
+ if ( previous.old === optionDataString ) {
+ return previous.valid;
+ }
+
+ previous.old = optionDataString;
+ validator = this;
+ this.startRequest( element );
+ data = {};
+ data[ element.name ] = value;
+ $.ajax( $.extend( true, {
+ mode: "abort",
+ port: "validate" + element.name,
+ dataType: "json",
+ data: data,
+ context: validator.currentForm,
+ success: function( response ) {
+ var valid = response === true || response === "true",
+ errors, message, submitted;
+
+ validator.settings.messages[ element.name ][ method ] = previous.originalMessage;
+ if ( valid ) {
+ submitted = validator.formSubmitted;
+ validator.resetInternals();
+ validator.toHide = validator.errorsFor( element );
+ validator.formSubmitted = submitted;
+ validator.successList.push( element );
+ validator.invalid[ element.name ] = false;
+ validator.showErrors();
+ } else {
+ errors = {};
+ message = response || validator.defaultMessage( element, { method: method, parameters: value } );
+ errors[ element.name ] = previous.message = message;
+ validator.invalid[ element.name ] = true;
+ validator.showErrors( errors );
+ }
+ previous.valid = valid;
+ validator.stopRequest( element, valid );
+ }
+ }, param ) );
+ return "pending";
+ }
+ }
+
+} );
+
+// Ajax mode: abort
+// usage: $.ajax({ mode: "abort"[, port: "uniqueport"]});
+// if mode:"abort" is used, the previous request on that port (port can be undefined) is aborted via XMLHttpRequest.abort()
+
+var pendingRequests = {},
+ ajax;
+
+// Use a prefilter if available (1.5+)
+if ( $.ajaxPrefilter ) {
+ $.ajaxPrefilter( function( settings, _, xhr ) {
+ var port = settings.port;
+ if ( settings.mode === "abort" ) {
+ if ( pendingRequests[ port ] ) {
+ pendingRequests[ port ].abort();
+ }
+ pendingRequests[ port ] = xhr;
+ }
+ } );
+} else {
+
+ // Proxy ajax
+ ajax = $.ajax;
+ $.ajax = function( settings ) {
+ var mode = ( "mode" in settings ? settings : $.ajaxSettings ).mode,
+ port = ( "port" in settings ? settings : $.ajaxSettings ).port;
+ if ( mode === "abort" ) {
+ if ( pendingRequests[ port ] ) {
+ pendingRequests[ port ].abort();
+ }
+ pendingRequests[ port ] = ajax.apply( this, arguments );
+ return pendingRequests[ port ];
+ }
+ return ajax.apply( this, arguments );
+ };
+}
+return $;
+}));
\ No newline at end of file
diff --git a/src/Web/wwwroot/lib/jquery-validate/jquery.validate.min.js b/src/Web/wwwroot/lib/jquery-validate/jquery.validate.min.js
new file mode 100644
index 0000000..20402da
--- /dev/null
+++ b/src/Web/wwwroot/lib/jquery-validate/jquery.validate.min.js
@@ -0,0 +1,4 @@
+/*! jQuery Validation Plugin - v1.17.0 - 7/29/2017
+ * https://jqueryvalidation.org/
+ * Copyright (c) 2017 Jörn Zaefferer; Licensed MIT */
+!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof module&&module.exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){a.extend(a.fn,{validate:function(b){if(!this.length)return void(b&&b.debug&&window.console&&console.warn("Nothing selected, can't validate, returning nothing."));var c=a.data(this[0],"validator");return c?c:(this.attr("novalidate","novalidate"),c=new a.validator(b,this[0]),a.data(this[0],"validator",c),c.settings.onsubmit&&(this.on("click.validate",":submit",function(b){c.submitButton=b.currentTarget,a(this).hasClass("cancel")&&(c.cancelSubmit=!0),void 0!==a(this).attr("formnovalidate")&&(c.cancelSubmit=!0)}),this.on("submit.validate",function(b){function d(){var d,e;return c.submitButton&&(c.settings.submitHandler||c.formSubmitted)&&(d=a("").attr("name",c.submitButton.name).val(a(c.submitButton).val()).appendTo(c.currentForm)),!c.settings.submitHandler||(e=c.settings.submitHandler.call(c,c.currentForm,b),d&&d.remove(),void 0!==e&&e)}return c.settings.debug&&b.preventDefault(),c.cancelSubmit?(c.cancelSubmit=!1,d()):c.form()?c.pendingRequest?(c.formSubmitted=!0,!1):d():(c.focusInvalid(),!1)})),c)},valid:function(){var b,c,d;return a(this[0]).is("form")?b=this.validate().form():(d=[],b=!0,c=a(this[0].form).validate(),this.each(function(){b=c.element(this)&&b,b||(d=d.concat(c.errorList))}),c.errorList=d),b},rules:function(b,c){var d,e,f,g,h,i,j=this[0];if(null!=j&&(!j.form&&j.hasAttribute("contenteditable")&&(j.form=this.closest("form")[0],j.name=this.attr("name")),null!=j.form)){if(b)switch(d=a.data(j.form,"validator").settings,e=d.rules,f=a.validator.staticRules(j),b){case"add":a.extend(f,a.validator.normalizeRule(c)),delete f.messages,e[j.name]=f,c.messages&&(d.messages[j.name]=a.extend(d.messages[j.name],c.messages));break;case"remove":return c?(i={},a.each(c.split(/\s/),function(a,b){i[b]=f[b],delete f[b]}),i):(delete e[j.name],f)}return g=a.validator.normalizeRules(a.extend({},a.validator.classRules(j),a.validator.attributeRules(j),a.validator.dataRules(j),a.validator.staticRules(j)),j),g.required&&(h=g.required,delete g.required,g=a.extend({required:h},g)),g.remote&&(h=g.remote,delete g.remote,g=a.extend(g,{remote:h})),g}}}),a.extend(a.expr.pseudos||a.expr[":"],{blank:function(b){return!a.trim(""+a(b).val())},filled:function(b){var c=a(b).val();return null!==c&&!!a.trim(""+c)},unchecked:function(b){return!a(b).prop("checked")}}),a.validator=function(b,c){this.settings=a.extend(!0,{},a.validator.defaults,b),this.currentForm=c,this.init()},a.validator.format=function(b,c){return 1===arguments.length?function(){var c=a.makeArray(arguments);return c.unshift(b),a.validator.format.apply(this,c)}:void 0===c?b:(arguments.length>2&&c.constructor!==Array&&(c=a.makeArray(arguments).slice(1)),c.constructor!==Array&&(c=[c]),a.each(c,function(a,c){b=b.replace(new RegExp("\\{"+a+"\\}","g"),function(){return c})}),b)},a.extend(a.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",pendingClass:"pending",validClass:"valid",errorElement:"label",focusCleanup:!1,focusInvalid:!0,errorContainer:a([]),errorLabelContainer:a([]),onsubmit:!0,ignore:":hidden",ignoreTitle:!1,onfocusin:function(a){this.lastActive=a,this.settings.focusCleanup&&(this.settings.unhighlight&&this.settings.unhighlight.call(this,a,this.settings.errorClass,this.settings.validClass),this.hideThese(this.errorsFor(a)))},onfocusout:function(a){this.checkable(a)||!(a.name in this.submitted)&&this.optional(a)||this.element(a)},onkeyup:function(b,c){var d=[16,17,18,20,35,36,37,38,39,40,45,144,225];9===c.which&&""===this.elementValue(b)||a.inArray(c.keyCode,d)!==-1||(b.name in this.submitted||b.name in this.invalid)&&this.element(b)},onclick:function(a){a.name in this.submitted?this.element(a):a.parentNode.name in this.submitted&&this.element(a.parentNode)},highlight:function(b,c,d){"radio"===b.type?this.findByName(b.name).addClass(c).removeClass(d):a(b).addClass(c).removeClass(d)},unhighlight:function(b,c,d){"radio"===b.type?this.findByName(b.name).removeClass(c).addClass(d):a(b).removeClass(c).addClass(d)}},setDefaults:function(b){a.extend(a.validator.defaults,b)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",equalTo:"Please enter the same value again.",maxlength:a.validator.format("Please enter no more than {0} characters."),minlength:a.validator.format("Please enter at least {0} characters."),rangelength:a.validator.format("Please enter a value between {0} and {1} characters long."),range:a.validator.format("Please enter a value between {0} and {1}."),max:a.validator.format("Please enter a value less than or equal to {0}."),min:a.validator.format("Please enter a value greater than or equal to {0}."),step:a.validator.format("Please enter a multiple of {0}.")},autoCreateRanges:!1,prototype:{init:function(){function b(b){!this.form&&this.hasAttribute("contenteditable")&&(this.form=a(this).closest("form")[0],this.name=a(this).attr("name"));var c=a.data(this.form,"validator"),d="on"+b.type.replace(/^validate/,""),e=c.settings;e[d]&&!a(this).is(e.ignore)&&e[d].call(c,this,b)}this.labelContainer=a(this.settings.errorLabelContainer),this.errorContext=this.labelContainer.length&&this.labelContainer||a(this.currentForm),this.containers=a(this.settings.errorContainer).add(this.settings.errorLabelContainer),this.submitted={},this.valueCache={},this.pendingRequest=0,this.pending={},this.invalid={},this.reset();var c,d=this.groups={};a.each(this.settings.groups,function(b,c){"string"==typeof c&&(c=c.split(/\s/)),a.each(c,function(a,c){d[c]=b})}),c=this.settings.rules,a.each(c,function(b,d){c[b]=a.validator.normalizeRule(d)}),a(this.currentForm).on("focusin.validate focusout.validate keyup.validate",":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'], [type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'], [type='radio'], [type='checkbox'], [contenteditable], [type='button']",b).on("click.validate","select, option, [type='radio'], [type='checkbox']",b),this.settings.invalidHandler&&a(this.currentForm).on("invalid-form.validate",this.settings.invalidHandler)},form:function(){return this.checkForm(),a.extend(this.submitted,this.errorMap),this.invalid=a.extend({},this.errorMap),this.valid()||a(this.currentForm).triggerHandler("invalid-form",[this]),this.showErrors(),this.valid()},checkForm:function(){this.prepareForm();for(var a=0,b=this.currentElements=this.elements();b[a];a++)this.check(b[a]);return this.valid()},element:function(b){var c,d,e=this.clean(b),f=this.validationTargetFor(e),g=this,h=!0;return void 0===f?delete this.invalid[e.name]:(this.prepareElement(f),this.currentElements=a(f),d=this.groups[f.name],d&&a.each(this.groups,function(a,b){b===d&&a!==f.name&&(e=g.validationTargetFor(g.clean(g.findByName(a))),e&&e.name in g.invalid&&(g.currentElements.push(e),h=g.check(e)&&h))}),c=this.check(f)!==!1,h=h&&c,c?this.invalid[f.name]=!1:this.invalid[f.name]=!0,this.numberOfInvalids()||(this.toHide=this.toHide.add(this.containers)),this.showErrors(),a(b).attr("aria-invalid",!c)),h},showErrors:function(b){if(b){var c=this;a.extend(this.errorMap,b),this.errorList=a.map(this.errorMap,function(a,b){return{message:a,element:c.findByName(b)[0]}}),this.successList=a.grep(this.successList,function(a){return!(a.name in b)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){a.fn.resetForm&&a(this.currentForm).resetForm(),this.invalid={},this.submitted={},this.prepareForm(),this.hideErrors();var b=this.elements().removeData("previousValue").removeAttr("aria-invalid");this.resetElements(b)},resetElements:function(a){var b;if(this.settings.unhighlight)for(b=0;a[b];b++)this.settings.unhighlight.call(this,a[b],this.settings.errorClass,""),this.findByName(a[b].name).removeClass(this.settings.validClass);else a.removeClass(this.settings.errorClass).removeClass(this.settings.validClass)},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(a){var b,c=0;for(b in a)void 0!==a[b]&&null!==a[b]&&a[b]!==!1&&c++;return c},hideErrors:function(){this.hideThese(this.toHide)},hideThese:function(a){a.not(this.containers).text(""),this.addWrapper(a).hide()},valid:function(){return 0===this.size()},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{a(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(b){}},findLastActive:function(){var b=this.lastActive;return b&&1===a.grep(this.errorList,function(a){return a.element.name===b.name}).length&&b},elements:function(){var b=this,c={};return a(this.currentForm).find("input, select, textarea, [contenteditable]").not(":submit, :reset, :image, :disabled").not(this.settings.ignore).filter(function(){var d=this.name||a(this).attr("name");return!d&&b.settings.debug&&window.console&&console.error("%o has no name assigned",this),this.hasAttribute("contenteditable")&&(this.form=a(this).closest("form")[0],this.name=d),!(d in c||!b.objectLength(a(this).rules()))&&(c[d]=!0,!0)})},clean:function(b){return a(b)[0]},errors:function(){var b=this.settings.errorClass.split(" ").join(".");return a(this.settings.errorElement+"."+b,this.errorContext)},resetInternals:function(){this.successList=[],this.errorList=[],this.errorMap={},this.toShow=a([]),this.toHide=a([])},reset:function(){this.resetInternals(),this.currentElements=a([])},prepareForm:function(){this.reset(),this.toHide=this.errors().add(this.containers)},prepareElement:function(a){this.reset(),this.toHide=this.errorsFor(a)},elementValue:function(b){var c,d,e=a(b),f=b.type;return"radio"===f||"checkbox"===f?this.findByName(b.name).filter(":checked").val():"number"===f&&"undefined"!=typeof b.validity?b.validity.badInput?"NaN":e.val():(c=b.hasAttribute("contenteditable")?e.text():e.val(),"file"===f?"C:\\fakepath\\"===c.substr(0,12)?c.substr(12):(d=c.lastIndexOf("/"),d>=0?c.substr(d+1):(d=c.lastIndexOf("\\"),d>=0?c.substr(d+1):c)):"string"==typeof c?c.replace(/\r/g,""):c)},check:function(b){b=this.validationTargetFor(this.clean(b));var c,d,e,f,g=a(b).rules(),h=a.map(g,function(a,b){return b}).length,i=!1,j=this.elementValue(b);if("function"==typeof g.normalizer?f=g.normalizer:"function"==typeof this.settings.normalizer&&(f=this.settings.normalizer),f){if(j=f.call(b,j),"string"!=typeof j)throw new TypeError("The normalizer should return a string value.");delete g.normalizer}for(d in g){e={method:d,parameters:g[d]};try{if(c=a.validator.methods[d].call(this,j,b,e.parameters),"dependency-mismatch"===c&&1===h){i=!0;continue}if(i=!1,"pending"===c)return void(this.toHide=this.toHide.not(this.errorsFor(b)));if(!c)return this.formatAndAdd(b,e),!1}catch(k){throw this.settings.debug&&window.console&&console.log("Exception occurred when checking element "+b.id+", check the '"+e.method+"' method.",k),k instanceof TypeError&&(k.message+=". Exception occurred when checking element "+b.id+", check the '"+e.method+"' method."),k}}if(!i)return this.objectLength(g)&&this.successList.push(b),!0},customDataMessage:function(b,c){return a(b).data("msg"+c.charAt(0).toUpperCase()+c.substring(1).toLowerCase())||a(b).data("msg")},customMessage:function(a,b){var c=this.settings.messages[a];return c&&(c.constructor===String?c:c[b])},findDefined:function(){for(var a=0;aWarning: No message defined for "+b.name+""),e=/\$?\{(\d+)\}/g;return"function"==typeof d?d=d.call(this,c.parameters,b):e.test(d)&&(d=a.validator.format(d.replace(e,"{$1}"),c.parameters)),d},formatAndAdd:function(a,b){var c=this.defaultMessage(a,b);this.errorList.push({message:c,element:a,method:b.method}),this.errorMap[a.name]=c,this.submitted[a.name]=c},addWrapper:function(a){return this.settings.wrapper&&(a=a.add(a.parent(this.settings.wrapper))),a},defaultShowErrors:function(){var a,b,c;for(a=0;this.errorList[a];a++)c=this.errorList[a],this.settings.highlight&&this.settings.highlight.call(this,c.element,this.settings.errorClass,this.settings.validClass),this.showLabel(c.element,c.message);if(this.errorList.length&&(this.toShow=this.toShow.add(this.containers)),this.settings.success)for(a=0;this.successList[a];a++)this.showLabel(this.successList[a]);if(this.settings.unhighlight)for(a=0,b=this.validElements();b[a];a++)this.settings.unhighlight.call(this,b[a],this.settings.errorClass,this.settings.validClass);this.toHide=this.toHide.not(this.toShow),this.hideErrors(),this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return a(this.errorList).map(function(){return this.element})},showLabel:function(b,c){var d,e,f,g,h=this.errorsFor(b),i=this.idOrName(b),j=a(b).attr("aria-describedby");h.length?(h.removeClass(this.settings.validClass).addClass(this.settings.errorClass),h.html(c)):(h=a("<"+this.settings.errorElement+">").attr("id",i+"-error").addClass(this.settings.errorClass).html(c||""),d=h,this.settings.wrapper&&(d=h.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()),this.labelContainer.length?this.labelContainer.append(d):this.settings.errorPlacement?this.settings.errorPlacement.call(this,d,a(b)):d.insertAfter(b),h.is("label")?h.attr("for",i):0===h.parents("label[for='"+this.escapeCssMeta(i)+"']").length&&(f=h.attr("id"),j?j.match(new RegExp("\\b"+this.escapeCssMeta(f)+"\\b"))||(j+=" "+f):j=f,a(b).attr("aria-describedby",j),e=this.groups[b.name],e&&(g=this,a.each(g.groups,function(b,c){c===e&&a("[name='"+g.escapeCssMeta(b)+"']",g.currentForm).attr("aria-describedby",h.attr("id"))})))),!c&&this.settings.success&&(h.text(""),"string"==typeof this.settings.success?h.addClass(this.settings.success):this.settings.success(h,b)),this.toShow=this.toShow.add(h)},errorsFor:function(b){var c=this.escapeCssMeta(this.idOrName(b)),d=a(b).attr("aria-describedby"),e="label[for='"+c+"'], label[for='"+c+"'] *";return d&&(e=e+", #"+this.escapeCssMeta(d).replace(/\s+/g,", #")),this.errors().filter(e)},escapeCssMeta:function(a){return a.replace(/([\\!"#$%&'()*+,.\/:;<=>?@\[\]^`{|}~])/g,"\\$1")},idOrName:function(a){return this.groups[a.name]||(this.checkable(a)?a.name:a.id||a.name)},validationTargetFor:function(b){return this.checkable(b)&&(b=this.findByName(b.name)),a(b).not(this.settings.ignore)[0]},checkable:function(a){return/radio|checkbox/i.test(a.type)},findByName:function(b){return a(this.currentForm).find("[name='"+this.escapeCssMeta(b)+"']")},getLength:function(b,c){switch(c.nodeName.toLowerCase()){case"select":return a("option:selected",c).length;case"input":if(this.checkable(c))return this.findByName(c.name).filter(":checked").length}return b.length},depend:function(a,b){return!this.dependTypes[typeof a]||this.dependTypes[typeof a](a,b)},dependTypes:{"boolean":function(a){return a},string:function(b,c){return!!a(b,c.form).length},"function":function(a,b){return a(b)}},optional:function(b){var c=this.elementValue(b);return!a.validator.methods.required.call(this,c,b)&&"dependency-mismatch"},startRequest:function(b){this.pending[b.name]||(this.pendingRequest++,a(b).addClass(this.settings.pendingClass),this.pending[b.name]=!0)},stopRequest:function(b,c){this.pendingRequest--,this.pendingRequest<0&&(this.pendingRequest=0),delete this.pending[b.name],a(b).removeClass(this.settings.pendingClass),c&&0===this.pendingRequest&&this.formSubmitted&&this.form()?(a(this.currentForm).submit(),this.submitButton&&a("input:hidden[name='"+this.submitButton.name+"']",this.currentForm).remove(),this.formSubmitted=!1):!c&&0===this.pendingRequest&&this.formSubmitted&&(a(this.currentForm).triggerHandler("invalid-form",[this]),this.formSubmitted=!1)},previousValue:function(b,c){return c="string"==typeof c&&c||"remote",a.data(b,"previousValue")||a.data(b,"previousValue",{old:null,valid:!0,message:this.defaultMessage(b,{method:c})})},destroy:function(){this.resetForm(),a(this.currentForm).off(".validate").removeData("validator").find(".validate-equalTo-blur").off(".validate-equalTo").removeClass("validate-equalTo-blur")}},classRuleSettings:{required:{required:!0},email:{email:!0},url:{url:!0},date:{date:!0},dateISO:{dateISO:!0},number:{number:!0},digits:{digits:!0},creditcard:{creditcard:!0}},addClassRules:function(b,c){b.constructor===String?this.classRuleSettings[b]=c:a.extend(this.classRuleSettings,b)},classRules:function(b){var c={},d=a(b).attr("class");return d&&a.each(d.split(" "),function(){this in a.validator.classRuleSettings&&a.extend(c,a.validator.classRuleSettings[this])}),c},normalizeAttributeRule:function(a,b,c,d){/min|max|step/.test(c)&&(null===b||/number|range|text/.test(b))&&(d=Number(d),isNaN(d)&&(d=void 0)),d||0===d?a[c]=d:b===c&&"range"!==b&&(a[c]=!0)},attributeRules:function(b){var c,d,e={},f=a(b),g=b.getAttribute("type");for(c in a.validator.methods)"required"===c?(d=b.getAttribute(c),""===d&&(d=!0),d=!!d):d=f.attr(c),this.normalizeAttributeRule(e,g,c,d);return e.maxlength&&/-1|2147483647|524288/.test(e.maxlength)&&delete e.maxlength,e},dataRules:function(b){var c,d,e={},f=a(b),g=b.getAttribute("type");for(c in a.validator.methods)d=f.data("rule"+c.charAt(0).toUpperCase()+c.substring(1).toLowerCase()),this.normalizeAttributeRule(e,g,c,d);return e},staticRules:function(b){var c={},d=a.data(b.form,"validator");return d.settings.rules&&(c=a.validator.normalizeRule(d.settings.rules[b.name])||{}),c},normalizeRules:function(b,c){return a.each(b,function(d,e){if(e===!1)return void delete b[d];if(e.param||e.depends){var f=!0;switch(typeof e.depends){case"string":f=!!a(e.depends,c.form).length;break;case"function":f=e.depends.call(c,c)}f?b[d]=void 0===e.param||e.param:(a.data(c.form,"validator").resetElements(a(c)),delete b[d])}}),a.each(b,function(d,e){b[d]=a.isFunction(e)&&"normalizer"!==d?e(c):e}),a.each(["minlength","maxlength"],function(){b[this]&&(b[this]=Number(b[this]))}),a.each(["rangelength","range"],function(){var c;b[this]&&(a.isArray(b[this])?b[this]=[Number(b[this][0]),Number(b[this][1])]:"string"==typeof b[this]&&(c=b[this].replace(/[\[\]]/g,"").split(/[\s,]+/),b[this]=[Number(c[0]),Number(c[1])]))}),a.validator.autoCreateRanges&&(null!=b.min&&null!=b.max&&(b.range=[b.min,b.max],delete b.min,delete b.max),null!=b.minlength&&null!=b.maxlength&&(b.rangelength=[b.minlength,b.maxlength],delete b.minlength,delete b.maxlength)),b},normalizeRule:function(b){if("string"==typeof b){var c={};a.each(b.split(/\s/),function(){c[this]=!0}),b=c}return b},addMethod:function(b,c,d){a.validator.methods[b]=c,a.validator.messages[b]=void 0!==d?d:a.validator.messages[b],c.length<3&&a.validator.addClassRules(b,a.validator.normalizeRule(b))},methods:{required:function(b,c,d){if(!this.depend(d,c))return"dependency-mismatch";if("select"===c.nodeName.toLowerCase()){var e=a(c).val();return e&&e.length>0}return this.checkable(c)?this.getLength(b,c)>0:b.length>0},email:function(a,b){return this.optional(b)||/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(a)},url:function(a,b){return this.optional(b)||/^(?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})).?)(?::\d{2,5})?(?:[\/?#]\S*)?$/i.test(a)},date:function(a,b){return this.optional(b)||!/Invalid|NaN/.test(new Date(a).toString())},dateISO:function(a,b){return this.optional(b)||/^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test(a)},number:function(a,b){return this.optional(b)||/^(?:-?\d+|-?\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(a)},digits:function(a,b){return this.optional(b)||/^\d+$/.test(a)},minlength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||e>=d},maxlength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||e<=d},rangelength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||e>=d[0]&&e<=d[1]},min:function(a,b,c){return this.optional(b)||a>=c},max:function(a,b,c){return this.optional(b)||a<=c},range:function(a,b,c){return this.optional(b)||a>=c[0]&&a<=c[1]},step:function(b,c,d){var e,f=a(c).attr("type"),g="Step attribute on input type "+f+" is not supported.",h=["text","number","range"],i=new RegExp("\\b"+f+"\\b"),j=f&&!i.test(h.join()),k=function(a){var b=(""+a).match(/(?:\.(\d+))?$/);return b&&b[1]?b[1].length:0},l=function(a){return Math.round(a*Math.pow(10,e))},m=!0;if(j)throw new Error(g);return e=k(d),(k(b)>e||l(b)%l(d)!==0)&&(m=!1),this.optional(c)||m},equalTo:function(b,c,d){var e=a(d);return this.settings.onfocusout&&e.not(".validate-equalTo-blur").length&&e.addClass("validate-equalTo-blur").on("blur.validate-equalTo",function(){a(c).valid()}),b===e.val()},remote:function(b,c,d,e){if(this.optional(c))return"dependency-mismatch";e="string"==typeof e&&e||"remote";var f,g,h,i=this.previousValue(c,e);return this.settings.messages[c.name]||(this.settings.messages[c.name]={}),i.originalMessage=i.originalMessage||this.settings.messages[c.name][e],this.settings.messages[c.name][e]=i.message,d="string"==typeof d&&{url:d}||d,h=a.param(a.extend({data:b},d.data)),i.old===h?i.valid:(i.old=h,f=this,this.startRequest(c),g={},g[c.name]=b,a.ajax(a.extend(!0,{mode:"abort",port:"validate"+c.name,dataType:"json",data:g,context:f.currentForm,success:function(a){var d,g,h,j=a===!0||"true"===a;f.settings.messages[c.name][e]=i.originalMessage,j?(h=f.formSubmitted,f.resetInternals(),f.toHide=f.errorsFor(c),f.formSubmitted=h,f.successList.push(c),f.invalid[c.name]=!1,f.showErrors()):(d={},g=a||f.defaultMessage(c,{method:e,parameters:b}),d[c.name]=i.message=g,f.invalid[c.name]=!0,f.showErrors(d)),i.valid=j,f.stopRequest(c,j)}},d)),"pending")}}});var b,c={};return a.ajaxPrefilter?a.ajaxPrefilter(function(a,b,d){var e=a.port;"abort"===a.mode&&(c[e]&&c[e].abort(),c[e]=d)}):(b=a.ajax,a.ajax=function(d){var e=("mode"in d?d:a.ajaxSettings).mode,f=("port"in d?d:a.ajaxSettings).port;return"abort"===e?(c[f]&&c[f].abort(),c[f]=b.apply(this,arguments),c[f]):b.apply(this,arguments)}),a});
\ No newline at end of file
diff --git a/src/Web/wwwroot/lib/jquery/core.js b/src/Web/wwwroot/lib/jquery/core.js
new file mode 100644
index 0000000..3a1c0cc
--- /dev/null
+++ b/src/Web/wwwroot/lib/jquery/core.js
@@ -0,0 +1,399 @@
+/* global Symbol */
+// Defining this global in .eslintrc.json would create a danger of using the global
+// unguarded in another place, it seems safer to define global only for this module
+
+define( [
+ "./var/arr",
+ "./var/document",
+ "./var/getProto",
+ "./var/slice",
+ "./var/concat",
+ "./var/push",
+ "./var/indexOf",
+ "./var/class2type",
+ "./var/toString",
+ "./var/hasOwn",
+ "./var/fnToString",
+ "./var/ObjectFunctionString",
+ "./var/support",
+ "./var/isFunction",
+ "./var/isWindow",
+ "./core/DOMEval",
+ "./core/toType"
+], function( arr, document, getProto, slice, concat, push, indexOf,
+ class2type, toString, hasOwn, fnToString, ObjectFunctionString,
+ support, isFunction, isWindow, DOMEval, toType ) {
+
+"use strict";
+
+var
+ version = "3.3.1",
+
+ // Define a local copy of jQuery
+ jQuery = function( selector, context ) {
+
+ // The jQuery object is actually just the init constructor 'enhanced'
+ // Need init if jQuery is called (just allow error to be thrown if not included)
+ return new jQuery.fn.init( selector, context );
+ },
+
+ // Support: Android <=4.0 only
+ // Make sure we trim BOM and NBSP
+ rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
+
+jQuery.fn = jQuery.prototype = {
+
+ // The current version of jQuery being used
+ jquery: version,
+
+ constructor: jQuery,
+
+ // The default length of a jQuery object is 0
+ length: 0,
+
+ toArray: function() {
+ return slice.call( this );
+ },
+
+ // Get the Nth element in the matched element set OR
+ // Get the whole matched element set as a clean array
+ get: function( num ) {
+
+ // Return all the elements in a clean array
+ if ( num == null ) {
+ return slice.call( this );
+ }
+
+ // Return just the one element from the set
+ return num < 0 ? this[ num + this.length ] : this[ num ];
+ },
+
+ // Take an array of elements and push it onto the stack
+ // (returning the new matched element set)
+ pushStack: function( elems ) {
+
+ // Build a new jQuery matched element set
+ var ret = jQuery.merge( this.constructor(), elems );
+
+ // Add the old object onto the stack (as a reference)
+ ret.prevObject = this;
+
+ // Return the newly-formed element set
+ return ret;
+ },
+
+ // Execute a callback for every element in the matched set.
+ each: function( callback ) {
+ return jQuery.each( this, callback );
+ },
+
+ map: function( callback ) {
+ return this.pushStack( jQuery.map( this, function( elem, i ) {
+ return callback.call( elem, i, elem );
+ } ) );
+ },
+
+ slice: function() {
+ return this.pushStack( slice.apply( this, arguments ) );
+ },
+
+ first: function() {
+ return this.eq( 0 );
+ },
+
+ last: function() {
+ return this.eq( -1 );
+ },
+
+ eq: function( i ) {
+ var len = this.length,
+ j = +i + ( i < 0 ? len : 0 );
+ return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
+ },
+
+ end: function() {
+ return this.prevObject || this.constructor();
+ },
+
+ // For internal use only.
+ // Behaves like an Array's method, not like a jQuery method.
+ push: push,
+ sort: arr.sort,
+ splice: arr.splice
+};
+
+jQuery.extend = jQuery.fn.extend = function() {
+ var options, name, src, copy, copyIsArray, clone,
+ target = arguments[ 0 ] || {},
+ i = 1,
+ length = arguments.length,
+ deep = false;
+
+ // Handle a deep copy situation
+ if ( typeof target === "boolean" ) {
+ deep = target;
+
+ // Skip the boolean and the target
+ target = arguments[ i ] || {};
+ i++;
+ }
+
+ // Handle case when target is a string or something (possible in deep copy)
+ if ( typeof target !== "object" && !isFunction( target ) ) {
+ target = {};
+ }
+
+ // Extend jQuery itself if only one argument is passed
+ if ( i === length ) {
+ target = this;
+ i--;
+ }
+
+ for ( ; i < length; i++ ) {
+
+ // Only deal with non-null/undefined values
+ if ( ( options = arguments[ i ] ) != null ) {
+
+ // Extend the base object
+ for ( name in options ) {
+ src = target[ name ];
+ copy = options[ name ];
+
+ // Prevent never-ending loop
+ if ( target === copy ) {
+ continue;
+ }
+
+ // Recurse if we're merging plain objects or arrays
+ if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
+ ( copyIsArray = Array.isArray( copy ) ) ) ) {
+
+ if ( copyIsArray ) {
+ copyIsArray = false;
+ clone = src && Array.isArray( src ) ? src : [];
+
+ } else {
+ clone = src && jQuery.isPlainObject( src ) ? src : {};
+ }
+
+ // Never move original objects, clone them
+ target[ name ] = jQuery.extend( deep, clone, copy );
+
+ // Don't bring in undefined values
+ } else if ( copy !== undefined ) {
+ target[ name ] = copy;
+ }
+ }
+ }
+ }
+
+ // Return the modified object
+ return target;
+};
+
+jQuery.extend( {
+
+ // Unique for each copy of jQuery on the page
+ expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
+
+ // Assume jQuery is ready without the ready module
+ isReady: true,
+
+ error: function( msg ) {
+ throw new Error( msg );
+ },
+
+ noop: function() {},
+
+ isPlainObject: function( obj ) {
+ var proto, Ctor;
+
+ // Detect obvious negatives
+ // Use toString instead of jQuery.type to catch host objects
+ if ( !obj || toString.call( obj ) !== "[object Object]" ) {
+ return false;
+ }
+
+ proto = getProto( obj );
+
+ // Objects with no prototype (e.g., `Object.create( null )`) are plain
+ if ( !proto ) {
+ return true;
+ }
+
+ // Objects with prototype are plain iff they were constructed by a global Object function
+ Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
+ return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
+ },
+
+ isEmptyObject: function( obj ) {
+
+ /* eslint-disable no-unused-vars */
+ // See https://github.com/eslint/eslint/issues/6125
+ var name;
+
+ for ( name in obj ) {
+ return false;
+ }
+ return true;
+ },
+
+ // Evaluates a script in a global context
+ globalEval: function( code ) {
+ DOMEval( code );
+ },
+
+ each: function( obj, callback ) {
+ var length, i = 0;
+
+ if ( isArrayLike( obj ) ) {
+ length = obj.length;
+ for ( ; i < length; i++ ) {
+ if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
+ break;
+ }
+ }
+ } else {
+ for ( i in obj ) {
+ if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
+ break;
+ }
+ }
+ }
+
+ return obj;
+ },
+
+ // Support: Android <=4.0 only
+ trim: function( text ) {
+ return text == null ?
+ "" :
+ ( text + "" ).replace( rtrim, "" );
+ },
+
+ // results is for internal usage only
+ makeArray: function( arr, results ) {
+ var ret = results || [];
+
+ if ( arr != null ) {
+ if ( isArrayLike( Object( arr ) ) ) {
+ jQuery.merge( ret,
+ typeof arr === "string" ?
+ [ arr ] : arr
+ );
+ } else {
+ push.call( ret, arr );
+ }
+ }
+
+ return ret;
+ },
+
+ inArray: function( elem, arr, i ) {
+ return arr == null ? -1 : indexOf.call( arr, elem, i );
+ },
+
+ // Support: Android <=4.0 only, PhantomJS 1 only
+ // push.apply(_, arraylike) throws on ancient WebKit
+ merge: function( first, second ) {
+ var len = +second.length,
+ j = 0,
+ i = first.length;
+
+ for ( ; j < len; j++ ) {
+ first[ i++ ] = second[ j ];
+ }
+
+ first.length = i;
+
+ return first;
+ },
+
+ grep: function( elems, callback, invert ) {
+ var callbackInverse,
+ matches = [],
+ i = 0,
+ length = elems.length,
+ callbackExpect = !invert;
+
+ // Go through the array, only saving the items
+ // that pass the validator function
+ for ( ; i < length; i++ ) {
+ callbackInverse = !callback( elems[ i ], i );
+ if ( callbackInverse !== callbackExpect ) {
+ matches.push( elems[ i ] );
+ }
+ }
+
+ return matches;
+ },
+
+ // arg is for internal usage only
+ map: function( elems, callback, arg ) {
+ var length, value,
+ i = 0,
+ ret = [];
+
+ // Go through the array, translating each of the items to their new values
+ if ( isArrayLike( elems ) ) {
+ length = elems.length;
+ for ( ; i < length; i++ ) {
+ value = callback( elems[ i ], i, arg );
+
+ if ( value != null ) {
+ ret.push( value );
+ }
+ }
+
+ // Go through every key on the object,
+ } else {
+ for ( i in elems ) {
+ value = callback( elems[ i ], i, arg );
+
+ if ( value != null ) {
+ ret.push( value );
+ }
+ }
+ }
+
+ // Flatten any nested arrays
+ return concat.apply( [], ret );
+ },
+
+ // A global GUID counter for objects
+ guid: 1,
+
+ // jQuery.support is not used in Core but other projects attach their
+ // properties to it so it needs to exist.
+ support: support
+} );
+
+if ( typeof Symbol === "function" ) {
+ jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
+}
+
+// Populate the class2type map
+jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
+function( i, name ) {
+ class2type[ "[object " + name + "]" ] = name.toLowerCase();
+} );
+
+function isArrayLike( obj ) {
+
+ // Support: real iOS 8.2 only (not reproducible in simulator)
+ // `in` check used to prevent JIT error (gh-2145)
+ // hasOwn isn't used here due to false negatives
+ // regarding Nodelist length in IE
+ var length = !!obj && "length" in obj && obj.length,
+ type = toType( obj );
+
+ if ( isFunction( obj ) || isWindow( obj ) ) {
+ return false;
+ }
+
+ return type === "array" || length === 0 ||
+ typeof length === "number" && length > 0 && ( length - 1 ) in obj;
+}
+
+return jQuery;
+} );
diff --git a/src/Web/wwwroot/lib/jquery/jquery.js b/src/Web/wwwroot/lib/jquery/jquery.js
new file mode 100644
index 0000000..9b5206b
--- /dev/null
+++ b/src/Web/wwwroot/lib/jquery/jquery.js
@@ -0,0 +1,10364 @@
+/*!
+ * jQuery JavaScript Library v3.3.1
+ * https://jquery.com/
+ *
+ * Includes Sizzle.js
+ * https://sizzlejs.com/
+ *
+ * Copyright JS Foundation and other contributors
+ * Released under the MIT license
+ * https://jquery.org/license
+ *
+ * Date: 2018-01-20T17:24Z
+ */
+( function( global, factory ) {
+
+ "use strict";
+
+ if ( typeof module === "object" && typeof module.exports === "object" ) {
+
+ // For CommonJS and CommonJS-like environments where a proper `window`
+ // is present, execute the factory and get jQuery.
+ // For environments that do not have a `window` with a `document`
+ // (such as Node.js), expose a factory as module.exports.
+ // This accentuates the need for the creation of a real `window`.
+ // e.g. var jQuery = require("jquery")(window);
+ // See ticket #14549 for more info.
+ module.exports = global.document ?
+ factory( global, true ) :
+ function( w ) {
+ if ( !w.document ) {
+ throw new Error( "jQuery requires a window with a document" );
+ }
+ return factory( w );
+ };
+ } else {
+ factory( global );
+ }
+
+// Pass this if window is not defined yet
+} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
+
+// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
+// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
+// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
+// enough that all such attempts are guarded in a try block.
+"use strict";
+
+var arr = [];
+
+var document = window.document;
+
+var getProto = Object.getPrototypeOf;
+
+var slice = arr.slice;
+
+var concat = arr.concat;
+
+var push = arr.push;
+
+var indexOf = arr.indexOf;
+
+var class2type = {};
+
+var toString = class2type.toString;
+
+var hasOwn = class2type.hasOwnProperty;
+
+var fnToString = hasOwn.toString;
+
+var ObjectFunctionString = fnToString.call( Object );
+
+var support = {};
+
+var isFunction = function isFunction( obj ) {
+
+ // Support: Chrome <=57, Firefox <=52
+ // In some browsers, typeof returns "function" for HTML