From 91ae4c046c62ade068eb5c408750fa7690cb82da Mon Sep 17 00:00:00 2001 From: dicky Date: Tue, 28 Aug 2018 18:25:42 -0700 Subject: [PATCH] Updated SignalR .NET Core client to 1.0.3. --- ASP.NET Core Demo/WebApplication.Knockout/package.json | 2 +- .../WebApplication.Knockout/wwwroot/lib/signalr.js | 4 +++- .../WebApplication.React/wwwroot/lib/bundle.min.js | 4 +++- .../WebApplication.React/wwwroot/lib/signalR-netcore.js | 4 +++- dist/signalR-netcore.js | 4 +++- dist/signalR-netcore.min.js | 4 ++-- package.json | 2 +- src/signalR-netcore.js | 4 +++- 8 files changed, 19 insertions(+), 9 deletions(-) diff --git a/ASP.NET Core Demo/WebApplication.Knockout/package.json b/ASP.NET Core Demo/WebApplication.Knockout/package.json index ac780ad7..24df37d0 100644 --- a/ASP.NET Core Demo/WebApplication.Knockout/package.json +++ b/ASP.NET Core Demo/WebApplication.Knockout/package.json @@ -8,7 +8,7 @@ "knockout": "^3.4.1", "requirejs": "^2.3.2", "signalr": "^2.2.2", - "@aspnet/signalr": "1.0.0" + "@aspnet/signalr": "1.0.3" }, "devDependencies": { "grunt": "^1.0.1", diff --git a/ASP.NET Core Demo/WebApplication.Knockout/wwwroot/lib/signalr.js b/ASP.NET Core Demo/WebApplication.Knockout/wwwroot/lib/signalr.js index af3b18a4..16b09542 100644 --- a/ASP.NET Core Demo/WebApplication.Knockout/wwwroot/lib/signalr.js +++ b/ASP.NET Core Demo/WebApplication.Knockout/wwwroot/lib/signalr.js @@ -1,6 +1,6 @@ /** * @overview ASP.NET Core SignalR JavaScript Client. - * @version 1.0.0. + * @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. @@ -1552,6 +1552,8 @@ var DefaultHttpClient = /** @class */ (function (_super) { 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]); }); diff --git a/ASP.NET Core Demo/WebApplication.React/wwwroot/lib/bundle.min.js b/ASP.NET Core Demo/WebApplication.React/wwwroot/lib/bundle.min.js index d905e511..284336d6 100644 --- a/ASP.NET Core Demo/WebApplication.React/wwwroot/lib/bundle.min.js +++ b/ASP.NET Core Demo/WebApplication.React/wwwroot/lib/bundle.min.js @@ -9380,7 +9380,7 @@ if (true) /* WEBPACK VAR INJECTION */(function(global, process) {/** * @overview ASP.NET Core SignalR JavaScript Client. - * @version 1.0.0. + * @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. @@ -10934,6 +10934,8 @@ if (true) 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]); }); diff --git a/ASP.NET Core Demo/WebApplication.React/wwwroot/lib/signalR-netcore.js b/ASP.NET Core Demo/WebApplication.React/wwwroot/lib/signalR-netcore.js index aabb77fc..4c673fdc 100644 --- a/ASP.NET Core Demo/WebApplication.React/wwwroot/lib/signalR-netcore.js +++ b/ASP.NET Core Demo/WebApplication.React/wwwroot/lib/signalR-netcore.js @@ -1,6 +1,6 @@ /** * @overview ASP.NET Core SignalR JavaScript Client. - * @version 1.0.0. + * @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. @@ -1554,6 +1554,8 @@ 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]); }); diff --git a/dist/signalR-netcore.js b/dist/signalR-netcore.js index aabb77fc..4c673fdc 100644 --- a/dist/signalR-netcore.js +++ b/dist/signalR-netcore.js @@ -1,6 +1,6 @@ /** * @overview ASP.NET Core SignalR JavaScript Client. - * @version 1.0.0. + * @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. @@ -1554,6 +1554,8 @@ 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]); }); diff --git a/dist/signalR-netcore.min.js b/dist/signalR-netcore.min.js index 69957f3b..81d1ae07 100644 --- a/dist/signalR-netcore.min.js +++ b/dist/signalR-netcore.min.js @@ -1,2 +1,2 @@ -!function(a,b){"object"==typeof exports&&"undefined"!=typeof module?module.exports=b():"function"==typeof define&&define.amd?define(b):a.signalR=b()}(this,function(){"use strict";function a(){throw new Error("Dynamic requires are not currently supported by rollup-plugin-commonjs")}function b(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}function c(a,b){return b={exports:{}},a(b,b.exports),b.exports}function d(a,b){function c(){this.constructor=a}w(a,b),a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)}function e(a,b){var c={};for(var d in a)Object.prototype.hasOwnProperty.call(a,d)&&b.indexOf(d)<0&&(c[d]=a[d]);if(null!=a&&"function"==typeof Object.getOwnPropertySymbols)for(var e=0,d=Object.getOwnPropertySymbols(a);e=0;h--)(e=a[h])&&(g=(f<3?e(g):f>3?e(b,c,g):e(b,c))||g);return f>3&&g&&Object.defineProperty(b,c,g),g}function g(a,b){return function(c,d){b(c,d,a)}}function h(a,b){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(a,b)}function i(a,b,c,d){return new(c||(c=Promise))(function(e,f){function g(a){try{i(d.next(a))}catch(a){f(a)}}function h(a){try{i(d.throw(a))}catch(a){f(a)}}function i(a){a.done?e(a.value):new c(function(b){b(a.value)}).then(g,h)}i((d=d.apply(a,b||[])).next())})}function j(a,b){function c(a){return function(b){return d([a,b])}}function d(c){if(e)throw new TypeError("Generator is already executing.");for(;i;)try{if(e=1,f&&(g=f[2&c[0]?"return":c[0]?"throw":"next"])&&!(g=g.call(f,c[1])).done)return g;switch(f=0,g&&(c=[0,g.value]),c[0]){case 0:case 1:g=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,f=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(g=i.trys,!(g=g.length>0&&g[g.length-1])&&(6===c[0]||2===c[0])){i=0;continue}if(3===c[0]&&(!g||c[1]>g[0]&&c[1]=a.length&&(a=void 0),{value:a&&a[c++],done:!a}}}}function m(a,b){var c="function"==typeof Symbol&&a[Symbol.iterator];if(!c)return a;var d,e,f=c.call(a),g=[];try{for(;(void 0===b||b-- >0)&&!(d=f.next()).done;)g.push(d.value)}catch(a){e={error:a}}finally{try{d&&!d.done&&(c=f.return)&&c.call(f)}finally{if(e)throw e.error}}return g}function n(){for(var a=[],b=0;b1||e(a,b)})})}function e(a,b){try{f(k[a](b))}catch(a){i(l[0][3],a)}}function f(a){a.value instanceof o?Promise.resolve(a.value.v).then(g,h):i(l[0][2],a)}function g(a){e("next",a)}function h(a){e("throw",a)}function i(a,b){a(b),l.shift(),l.length&&e(l[0][0],l[0][1])}if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var j,k=c.apply(a,b||[]),l=[];return j={},d("next"),d("throw"),d("return"),j[Symbol.asyncIterator]=function(){return this},j}function q(a){function b(b,e){a[b]&&(c[b]=function(c){return(d=!d)?{value:o(a[b](c)),done:"return"===b}:e?e(c):c})}var c,d;return c={},b("next"),b("throw",function(a){throw a}),b("return"),c[Symbol.iterator]=function(){return this},c}function r(a){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var b=a[Symbol.asyncIterator];return b?b.call(a):"function"==typeof l?l(a):a[Symbol.iterator]()}function s(a,b){return Object.defineProperty?Object.defineProperty(a,"raw",{value:b}):a.raw=b,a}function t(a){if(a&&a.__esModule)return a;var b={};if(null!=a)for(var c in a)Object.hasOwnProperty.call(a,c)&&(b[c]=a[c]);return b.default=a,b}function u(a){return a&&a.__esModule?a:{default:a}}var v="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},w=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])},x=Object.assign||function(a){for(var b,c=1,d=arguments.length;c=200&&f.status<300?d(new c(f.status,f.statusText,f.response||f.responseText)):e(new z.HttpError(f.statusText,f.status))},f.onerror=function(){b.logger.log(A.LogLevel.Warning,"Error from HTTP request. "+f.status+": "+f.statusText),e(new z.HttpError(f.statusText,f.status))},f.ontimeout=function(){b.logger.log(A.LogLevel.Warning,"Timeout from HTTP request."),e(new z.TimeoutError)},f.send(a.content||"")})},b}(d);b.DefaultHttpClient=e}));b(B);var C=(B.HttpResponse,B.HttpClient,B.DefaultHttpClient,c(function(a,b){Object.defineProperty(b,"__esModule",{value:!0});var c=function(){function a(){}return a.write=function(b){return""+b+a.RecordSeparator},a.parse=function(b){if(b[b.length-1]!==a.RecordSeparator)throw new Error("Message is incomplete.");var c=b.split(a.RecordSeparator);return c.pop(),c},a.RecordSeparatorCode=30,a.RecordSeparator=String.fromCharCode(a.RecordSeparatorCode),a}();b.TextMessageFormat=c}));b(C);var D=(C.TextMessageFormat,c(function(a,b){Object.defineProperty(b,"__esModule",{value:!0});var c=function(){function a(){}return a.prototype.writeHandshakeRequest=function(a){return C.TextMessageFormat.write(JSON.stringify(a))},a.prototype.parseHandshakeResponse=function(a){var b,c,d;if(a instanceof ArrayBuffer){var e=new Uint8Array(a),f=e.indexOf(C.TextMessageFormat.RecordSeparatorCode);if(f===-1)throw new Error("Message is incomplete.");var g=f+1;c=String.fromCharCode.apply(null,e.slice(0,g)),d=e.byteLength>g?e.slice(g).buffer:null}else{var h=a,f=h.indexOf(C.TextMessageFormat.RecordSeparator);if(f===-1)throw new Error("Message is incomplete.");var g=f+1;c=h.substring(0,g),d=h.length>g?h.substring(g):null}var i=C.TextMessageFormat.parse(c);return b=JSON.parse(i[0]),[d,b]},a}();b.HandshakeProtocol=c}));b(D);var E=(D.HandshakeProtocol,c(function(a,b){Object.defineProperty(b,"__esModule",{value:!0});var c;!function(a){a[a.Invocation=1]="Invocation",a[a.StreamItem=2]="StreamItem",a[a.Completion=3]="Completion",a[a.StreamInvocation=4]="StreamInvocation",a[a.CancelInvocation=5]="CancelInvocation",a[a.Ping=6]="Ping",a[a.Close=7]="Close"}(c=b.MessageType||(b.MessageType={}))}));b(E);var F=(E.MessageType,c(function(a,b){Object.defineProperty(b,"__esModule",{value:!0});var c=function(){function a(){}return a.prototype.log=function(a,b){},a.instance=new a,a}();b.NullLogger=c}));b(F);var G=(F.NullLogger,c(function(a,b){function c(a,b){var c=null;return a instanceof ArrayBuffer?(c="Binary data of length "+a.byteLength,b&&(c+=". Content: '"+d(a)+"'")):"string"==typeof a&&(c="String data of length "+a.length,b&&(c+=". Content: '"+a+"'.")),c}function d(a){var b=new Uint8Array(a),c="";return b.forEach(function(a){var b=a<16?"0":"";c+="0x"+b+a.toString(16)+" "}),c.substr(0,c.length-1)}function e(a,b,d,e,f,g,h){return y.__awaiter(this,void 0,void 0,function(){var i,j,k,l;return y.__generator(this,function(m){switch(m.label){case 0:return[4,f()];case 1:return j=m.sent(),j&&(l={},l.Authorization="Bearer "+j,i=l),a.log(A.LogLevel.Trace,"("+b+" transport) sending data. "+c(g,h)+"."),[4,d.post(e,{content:g,headers:i})];case 2:return k=m.sent(),a.log(A.LogLevel.Trace,"("+b+" transport) request complete. Response status: "+k.statusCode+"."),[2]}})})}function f(a){return void 0===a?new j(A.LogLevel.Information):null===a?F.NullLogger.instance:a.log?a:new j(a)}Object.defineProperty(b,"__esModule",{value:!0});var g=function(){function a(){}return a.isRequired=function(a,b){if(null===a||void 0===a)throw new Error("The '"+b+"' argument is required.")},a.isIn=function(a,b,c){if(!(a in b))throw new Error("Unknown "+c+" value: "+a+".")},a}();b.Arg=g,b.getDataDetail=c,b.formatArrayBuffer=d,b.sendMessage=e,b.createLogger=f;var h=function(){function a(a){this.observers=[],this.cancelCallback=a}return a.prototype.next=function(a){for(var b=0,c=this.observers;b-1&&this.subject.observers.splice(a,1),0===this.subject.observers.length&&this.subject.cancelCallback().catch(function(a){})},a}();b.SubjectSubscription=i;var j=function(){function a(a){this.minimumLogLevel=a}return a.prototype.log=function(a,b){if(a>=this.minimumLogLevel)switch(a){case A.LogLevel.Critical:case A.LogLevel.Error:console.error(A.LogLevel[a]+": "+b);break;case A.LogLevel.Warning:console.warn(A.LogLevel[a]+": "+b);break;case A.LogLevel.Information:console.info(A.LogLevel[a]+": "+b);break;default:console.log(A.LogLevel[a]+": "+b)}},a}();b.ConsoleLogger=j}));b(G);var H=(G.Arg,G.getDataDetail,G.formatArrayBuffer,G.sendMessage,G.createLogger,G.Subject,G.SubjectSubscription,G.ConsoleLogger,c(function(a,b){Object.defineProperty(b,"__esModule",{value:!0});var c=3e4,d=function(){function a(a,b,d){var e=this;G.Arg.isRequired(a,"connection"),G.Arg.isRequired(b,"logger"),G.Arg.isRequired(d,"protocol"),this.serverTimeoutInMilliseconds=c,this.logger=b,this.protocol=d,this.connection=a,this.handshakeProtocol=new D.HandshakeProtocol,this.connection.onreceive=function(a){return e.processIncomingData(a)},this.connection.onclose=function(a){return e.connectionClosed(a)},this.callbacks={},this.methods={},this.closedCallbacks=[],this.id=0}return a.create=function(b,c,d){return new a(b,c,d)},a.prototype.start=function(){return y.__awaiter(this,void 0,void 0,function(){var a;return y.__generator(this,function(b){switch(b.label){case 0:return a={protocol:this.protocol.name,version:this.protocol.version},this.logger.log(A.LogLevel.Debug,"Starting HubConnection."),this.receivedHandshakeResponse=!1,[4,this.connection.start(this.protocol.transferFormat)];case 1:return b.sent(),this.logger.log(A.LogLevel.Debug,"Sending handshake request."),[4,this.connection.send(this.handshakeProtocol.writeHandshakeRequest(a))];case 2:return b.sent(),this.logger.log(A.LogLevel.Information,"Using HubProtocol '"+this.protocol.name+"'."),this.cleanupTimeout(),this.configureTimeout(),[2]}})})},a.prototype.stop=function(){return this.logger.log(A.LogLevel.Debug,"Stopping HubConnection."),this.cleanupTimeout(),this.connection.stop()},a.prototype.stream=function(a){for(var b=this,c=[],d=1;d")),this.onclose(c)),this.logger.log(A.LogLevel.Trace,"(LongPolling transport) Transport finished."),[7];case 9:return[2]}})})},a.prototype.send=function(a){return y.__awaiter(this,void 0,void 0,function(){return y.__generator(this,function(b){return this.running?[2,G.sendMessage(this.logger,"LongPolling",this.httpClient,this.url,this.accessTokenFactory,a,this.logMessageContent)]:[2,Promise.reject(new Error("Cannot send until the transport is connected"))]})})},a.prototype.stop=function(){return y.__awaiter(this,void 0,void 0,function(){var a,b,c,d=this;return y.__generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,,3,4]),this.running=!1,this.logger.log(A.LogLevel.Trace,"(LongPolling transport) sending DELETE request to "+this.url+"."),a={headers:{}},[4,this.accessTokenFactory()];case 1:return b=e.sent(),this.updateHeaderToken(a,b),[4,this.httpClient.delete(this.url,a)];case 2:return c=e.sent(),this.logger.log(A.LogLevel.Trace,"(LongPolling transport) DELETE request accepted."),[3,4];case 3:return this.stopped||(this.shutdownTimer=setTimeout(function(){d.logger.log(A.LogLevel.Warning,"(LongPolling transport) server did not terminate after DELETE request, canceling poll."),d.pollAbort.abort()},this.shutdownTimeout)),[7];case 4:return[2]}})})},a}();b.LongPollingTransport=d}));b(K);var L=(K.LongPollingTransport,c(function(a,b){Object.defineProperty(b,"__esModule",{value:!0});var c=function(){function a(a,b,c,d){this.httpClient=a,this.accessTokenFactory=b||function(){return null},this.logger=c,this.logMessageContent=d}return a.prototype.connect=function(a,b){return y.__awaiter(this,void 0,void 0,function(){var c,d=this;return y.__generator(this,function(e){switch(e.label){case 0:if(G.Arg.isRequired(a,"url"),G.Arg.isRequired(b,"transferFormat"),G.Arg.isIn(b,I.TransferFormat,"transferFormat"),"undefined"==typeof EventSource)throw new Error("'EventSource' is not supported in your environment.");return this.logger.log(A.LogLevel.Trace,"(SSE transport) Connecting"),[4,this.accessTokenFactory()];case 1:return c=e.sent(),c&&(a+=(a.indexOf("?")<0?"?":"&")+("access_token="+encodeURIComponent(c))),this.url=a,[2,new Promise(function(c,e){var f=!1;b!==I.TransferFormat.Text&&e(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"));var g=new EventSource(a,{withCredentials:!0});try{g.onmessage=function(a){if(d.onreceive)try{d.logger.log(A.LogLevel.Trace,"(SSE transport) data received. "+G.getDataDetail(a.data,d.logMessageContent)+"."),d.onreceive(a.data)}catch(a){return void(d.onclose&&d.onclose(a))}},g.onerror=function(a){var b=new Error(a.message||"Error occurred");f?d.close(b):e(b)},g.onopen=function(){d.logger.log(A.LogLevel.Information,"SSE connected to "+d.url),d.eventSource=g, -f=!0,c()}}catch(a){return Promise.reject(a)}})]}})})},a.prototype.send=function(a){return y.__awaiter(this,void 0,void 0,function(){return y.__generator(this,function(b){return this.eventSource?[2,G.sendMessage(this.logger,"SSE",this.httpClient,this.url,this.accessTokenFactory,a,this.logMessageContent)]:[2,Promise.reject(new Error("Cannot send until the transport is connected"))]})})},a.prototype.stop=function(){return this.close(),Promise.resolve()},a.prototype.close=function(a){this.eventSource&&(this.eventSource.close(),this.eventSource=null,this.onclose&&this.onclose(a))},a}();b.ServerSentEventsTransport=c}));b(L);var M=(L.ServerSentEventsTransport,c(function(a,b){Object.defineProperty(b,"__esModule",{value:!0});var c=function(){function a(a,b,c){this.logger=b,this.accessTokenFactory=a||function(){return null},this.logMessageContent=c}return a.prototype.connect=function(a,b){return y.__awaiter(this,void 0,void 0,function(){var c,d=this;return y.__generator(this,function(e){switch(e.label){case 0:if(G.Arg.isRequired(a,"url"),G.Arg.isRequired(b,"transferFormat"),G.Arg.isIn(b,I.TransferFormat,"transferFormat"),"undefined"==typeof WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return this.logger.log(A.LogLevel.Trace,"(WebSockets transport) Connecting"),[4,this.accessTokenFactory()];case 1:return c=e.sent(),c&&(a+=(a.indexOf("?")<0?"?":"&")+("access_token="+encodeURIComponent(c))),[2,new Promise(function(c,e){a=a.replace(/^http/,"ws");var f=new WebSocket(a);b===I.TransferFormat.Binary&&(f.binaryType="arraybuffer"),f.onopen=function(b){d.logger.log(A.LogLevel.Information,"WebSocket connected to "+a),d.webSocket=f,c()},f.onerror=function(a){e(a.error)},f.onmessage=function(a){d.logger.log(A.LogLevel.Trace,"(WebSockets transport) data received. "+G.getDataDetail(a.data,d.logMessageContent)+"."),d.onreceive&&d.onreceive(a.data)},f.onclose=function(a){d.logger.log(A.LogLevel.Trace,"(WebSockets transport) socket closed."),d.onclose&&(a.wasClean===!1||1e3!==a.code?d.onclose(new Error("Websocket closed with status code: "+a.code+" ("+a.reason+")")):d.onclose())}})]}})})},a.prototype.send=function(a){return this.webSocket&&this.webSocket.readyState===WebSocket.OPEN?(this.logger.log(A.LogLevel.Trace,"(WebSockets transport) sending data. "+G.getDataDetail(a,this.logMessageContent)+"."),this.webSocket.send(a),Promise.resolve()):Promise.reject("WebSocket is not in the OPEN state")},a.prototype.stop=function(){return this.webSocket&&(this.webSocket.close(),this.webSocket=null),Promise.resolve()},a}();b.WebSocketTransport=c}));b(M);var N=(M.WebSocketTransport,c(function(a,b){function c(a,b){return!a||0!==(b&a)}Object.defineProperty(b,"__esModule",{value:!0});var d=100,e=function(){function a(a,b){void 0===b&&(b={}),this.features={},G.Arg.isRequired(a,"url"),this.logger=G.createLogger(b.logger),this.baseUrl=this.resolveUrl(a),b=b||{},b.accessTokenFactory=b.accessTokenFactory||function(){return null},b.logMessageContent=b.logMessageContent||!1,this.httpClient=b.httpClient||new B.DefaultHttpClient(this.logger),this.connectionState=2,this.options=b}return a.prototype.start=function(a){return a=a||I.TransferFormat.Binary,G.Arg.isIn(a,I.TransferFormat,"transferFormat"),this.logger.log(A.LogLevel.Debug,"Starting connection with transfer format '"+I.TransferFormat[a]+"'."),2!==this.connectionState?Promise.reject(new Error("Cannot start a connection that is not in the 'Disconnected' state.")):(this.connectionState=0,this.startPromise=this.startInternal(a),this.startPromise)},a.prototype.send=function(a){if(1!==this.connectionState)throw new Error("Cannot send data if the connection is not in the 'Connected' State.");return this.transport.send(a)},a.prototype.stop=function(a){return y.__awaiter(this,void 0,void 0,function(){var b;return y.__generator(this,function(c){switch(c.label){case 0:this.connectionState=2,c.label=1;case 1:return c.trys.push([1,3,,4]),[4,this.startPromise];case 2:return c.sent(),[3,4];case 3:return b=c.sent(),[3,4];case 4:return this.transport?(this.stopError=a,[4,this.transport.stop()]):[3,6];case 5:c.sent(),this.transport=null,c.label=6;case 6:return[2]}})})},a.prototype.startInternal=function(a){return y.__awaiter(this,void 0,void 0,function(){var b,c,e,f,g,h,i,j=this;return y.__generator(this,function(k){switch(k.label){case 0:b=this.baseUrl,this.accessTokenFactory=this.options.accessTokenFactory,k.label=1;case 1:return k.trys.push([1,12,,13]),this.options.skipNegotiation?this.options.transport!==I.HttpTransportType.WebSockets?[3,3]:(this.transport=this.constructTransport(I.HttpTransportType.WebSockets),[4,this.transport.connect(b,a)]):[3,5];case 2:return k.sent(),[3,4];case 3:throw Error("Negotiation can only be skipped when using the WebSocket transport directly.");case 4:return[3,11];case 5:c=null,e=0,f=function(){var a;return y.__generator(this,function(d){switch(d.label){case 0:return[4,g.getNegotiationResponse(b)];case 1:return c=d.sent(),2===g.connectionState?[2,{value:void 0}]:(c.url&&(b=c.url),c.accessToken&&(a=c.accessToken,g.accessTokenFactory=function(){return a}),e++,[2])}})},g=this,k.label=6;case 6:return[5,f()];case 7:if(h=k.sent(),"object"==typeof h)return[2,h.value];k.label=8;case 8:if(c.url&&e=0){if(!(e===I.HttpTransportType.WebSockets&&"undefined"==typeof WebSocket||e===I.HttpTransportType.ServerSentEvents&&"undefined"==typeof EventSource))return this.logger.log(A.LogLevel.Debug,"Selecting transport '"+I.HttpTransportType[e]+"'"),e;this.logger.log(A.LogLevel.Debug,"Skipping transport '"+I.HttpTransportType[e]+"' because it is not supported in your environment.'")}else this.logger.log(A.LogLevel.Debug,"Skipping transport '"+I.HttpTransportType[e]+"' because it does not support the requested transfer format '"+I.TransferFormat[d]+"'.");else this.logger.log(A.LogLevel.Debug,"Skipping transport '"+I.HttpTransportType[e]+"' because it was disabled by the client.")}return null},a.prototype.isITransport=function(a){return a&&"object"==typeof a&&"connect"in a},a.prototype.changeState=function(a,b){return this.connectionState===a&&(this.connectionState=b,!0)},a.prototype.stopConnection=function(a){return y.__awaiter(this,void 0,void 0,function(){return y.__generator(this,function(b){return this.transport=null,a=this.stopError||a,a?this.logger.log(A.LogLevel.Error,"Connection disconnected with error '"+a+"'."):this.logger.log(A.LogLevel.Information,"Connection disconnected."),this.connectionState=2,this.onclose&&this.onclose(a),[2]})})},a.prototype.resolveUrl=function(a){if(0===a.lastIndexOf("https://",0)||0===a.lastIndexOf("http://",0))return a;if("undefined"==typeof window||!window||!window.document)throw new Error("Cannot resolve '"+a+"'.");var b=window.document.createElement("a");return b.href=a,this.logger.log(A.LogLevel.Information,"Normalizing '"+a+"' to '"+b.href+"'."),b.href},a.prototype.resolveNegotiateUrl=function(a){var b=a.indexOf("?"),c=a.substring(0,b===-1?a.length:b);return"/"!==c[c.length-1]&&(c+="/"),c+="negotiate",c+=b===-1?"":a.substring(b)},a}();b.HttpConnection=e}));b(N);var O=(N.HttpConnection,c(function(a,b){Object.defineProperty(b,"__esModule",{value:!0});var c="json",d=function(){function a(){this.name=c,this.version=1,this.transferFormat=I.TransferFormat.Text}return a.prototype.parseMessages=function(a,b){if("string"!=typeof a)throw new Error("Invalid input for JSON hub protocol. Expected a string.");if(!a)return[];null===b&&(b=F.NullLogger.instance);for(var c=C.TextMessageFormat.parse(a),d=[],e=0,f=c;e=0;h--)(e=a[h])&&(g=(f<3?e(g):f>3?e(b,c,g):e(b,c))||g);return f>3&&g&&Object.defineProperty(b,c,g),g}function g(a,b){return function(c,d){b(c,d,a)}}function h(a,b){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(a,b)}function i(a,b,c,d){return new(c||(c=Promise))(function(e,f){function g(a){try{i(d.next(a))}catch(a){f(a)}}function h(a){try{i(d.throw(a))}catch(a){f(a)}}function i(a){a.done?e(a.value):new c(function(b){b(a.value)}).then(g,h)}i((d=d.apply(a,b||[])).next())})}function j(a,b){function c(a){return function(b){return d([a,b])}}function d(c){if(e)throw new TypeError("Generator is already executing.");for(;i;)try{if(e=1,f&&(g=f[2&c[0]?"return":c[0]?"throw":"next"])&&!(g=g.call(f,c[1])).done)return g;switch(f=0,g&&(c=[0,g.value]),c[0]){case 0:case 1:g=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,f=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(g=i.trys,!(g=g.length>0&&g[g.length-1])&&(6===c[0]||2===c[0])){i=0;continue}if(3===c[0]&&(!g||c[1]>g[0]&&c[1]=a.length&&(a=void 0),{value:a&&a[c++],done:!a}}}}function m(a,b){var c="function"==typeof Symbol&&a[Symbol.iterator];if(!c)return a;var d,e,f=c.call(a),g=[];try{for(;(void 0===b||b-- >0)&&!(d=f.next()).done;)g.push(d.value)}catch(a){e={error:a}}finally{try{d&&!d.done&&(c=f.return)&&c.call(f)}finally{if(e)throw e.error}}return g}function n(){for(var a=[],b=0;b1||e(a,b)})})}function e(a,b){try{f(k[a](b))}catch(a){i(l[0][3],a)}}function f(a){a.value instanceof o?Promise.resolve(a.value.v).then(g,h):i(l[0][2],a)}function g(a){e("next",a)}function h(a){e("throw",a)}function i(a,b){a(b),l.shift(),l.length&&e(l[0][0],l[0][1])}if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var j,k=c.apply(a,b||[]),l=[];return j={},d("next"),d("throw"),d("return"),j[Symbol.asyncIterator]=function(){return this},j}function q(a){function b(b,e){a[b]&&(c[b]=function(c){return(d=!d)?{value:o(a[b](c)),done:"return"===b}:e?e(c):c})}var c,d;return c={},b("next"),b("throw",function(a){throw a}),b("return"),c[Symbol.iterator]=function(){return this},c}function r(a){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var b=a[Symbol.asyncIterator];return b?b.call(a):"function"==typeof l?l(a):a[Symbol.iterator]()}function s(a,b){return Object.defineProperty?Object.defineProperty(a,"raw",{value:b}):a.raw=b,a}function t(a){if(a&&a.__esModule)return a;var b={};if(null!=a)for(var c in a)Object.hasOwnProperty.call(a,c)&&(b[c]=a[c]);return b.default=a,b}function u(a){return a&&a.__esModule?a:{default:a}}var v="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},w=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(a,b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c])},x=Object.assign||function(a){for(var b,c=1,d=arguments.length;c=200&&f.status<300?d(new c(f.status,f.statusText,f.response||f.responseText)):e(new z.HttpError(f.statusText,f.status))},f.onerror=function(){b.logger.log(A.LogLevel.Warning,"Error from HTTP request. "+f.status+": "+f.statusText),e(new z.HttpError(f.statusText,f.status))},f.ontimeout=function(){b.logger.log(A.LogLevel.Warning,"Timeout from HTTP request."),e(new z.TimeoutError)},f.send(a.content||"")})},b}(d);b.DefaultHttpClient=e}));b(B);var C=(B.HttpResponse,B.HttpClient,B.DefaultHttpClient,c(function(a,b){Object.defineProperty(b,"__esModule",{value:!0});var c=function(){function a(){}return a.write=function(b){return""+b+a.RecordSeparator},a.parse=function(b){if(b[b.length-1]!==a.RecordSeparator)throw new Error("Message is incomplete.");var c=b.split(a.RecordSeparator);return c.pop(),c},a.RecordSeparatorCode=30,a.RecordSeparator=String.fromCharCode(a.RecordSeparatorCode),a}();b.TextMessageFormat=c}));b(C);var D=(C.TextMessageFormat,c(function(a,b){Object.defineProperty(b,"__esModule",{value:!0});var c=function(){function a(){}return a.prototype.writeHandshakeRequest=function(a){return C.TextMessageFormat.write(JSON.stringify(a))},a.prototype.parseHandshakeResponse=function(a){var b,c,d;if(a instanceof ArrayBuffer){var e=new Uint8Array(a),f=e.indexOf(C.TextMessageFormat.RecordSeparatorCode);if(f===-1)throw new Error("Message is incomplete.");var g=f+1;c=String.fromCharCode.apply(null,e.slice(0,g)),d=e.byteLength>g?e.slice(g).buffer:null}else{var h=a,f=h.indexOf(C.TextMessageFormat.RecordSeparator);if(f===-1)throw new Error("Message is incomplete.");var g=f+1;c=h.substring(0,g),d=h.length>g?h.substring(g):null}var i=C.TextMessageFormat.parse(c);return b=JSON.parse(i[0]),[d,b]},a}();b.HandshakeProtocol=c}));b(D);var E=(D.HandshakeProtocol,c(function(a,b){Object.defineProperty(b,"__esModule",{value:!0});var c;!function(a){a[a.Invocation=1]="Invocation",a[a.StreamItem=2]="StreamItem",a[a.Completion=3]="Completion",a[a.StreamInvocation=4]="StreamInvocation",a[a.CancelInvocation=5]="CancelInvocation",a[a.Ping=6]="Ping",a[a.Close=7]="Close"}(c=b.MessageType||(b.MessageType={}))}));b(E);var F=(E.MessageType,c(function(a,b){Object.defineProperty(b,"__esModule",{value:!0});var c=function(){function a(){}return a.prototype.log=function(a,b){},a.instance=new a,a}();b.NullLogger=c}));b(F);var G=(F.NullLogger,c(function(a,b){function c(a,b){var c=null;return a instanceof ArrayBuffer?(c="Binary data of length "+a.byteLength,b&&(c+=". Content: '"+d(a)+"'")):"string"==typeof a&&(c="String data of length "+a.length,b&&(c+=". Content: '"+a+"'.")),c}function d(a){var b=new Uint8Array(a),c="";return b.forEach(function(a){var b=a<16?"0":"";c+="0x"+b+a.toString(16)+" "}),c.substr(0,c.length-1)}function e(a,b,d,e,f,g,h){return y.__awaiter(this,void 0,void 0,function(){var i,j,k,l;return y.__generator(this,function(m){switch(m.label){case 0:return[4,f()];case 1:return j=m.sent(),j&&(l={},l.Authorization="Bearer "+j,i=l),a.log(A.LogLevel.Trace,"("+b+" transport) sending data. "+c(g,h)+"."),[4,d.post(e,{content:g,headers:i})];case 2:return k=m.sent(),a.log(A.LogLevel.Trace,"("+b+" transport) request complete. Response status: "+k.statusCode+"."),[2]}})})}function f(a){return void 0===a?new j(A.LogLevel.Information):null===a?F.NullLogger.instance:a.log?a:new j(a)}Object.defineProperty(b,"__esModule",{value:!0});var g=function(){function a(){}return a.isRequired=function(a,b){if(null===a||void 0===a)throw new Error("The '"+b+"' argument is required.")},a.isIn=function(a,b,c){if(!(a in b))throw new Error("Unknown "+c+" value: "+a+".")},a}();b.Arg=g,b.getDataDetail=c,b.formatArrayBuffer=d,b.sendMessage=e,b.createLogger=f;var h=function(){function a(a){this.observers=[],this.cancelCallback=a}return a.prototype.next=function(a){for(var b=0,c=this.observers;b-1&&this.subject.observers.splice(a,1),0===this.subject.observers.length&&this.subject.cancelCallback().catch(function(a){})},a}();b.SubjectSubscription=i;var j=function(){function a(a){this.minimumLogLevel=a}return a.prototype.log=function(a,b){if(a>=this.minimumLogLevel)switch(a){case A.LogLevel.Critical:case A.LogLevel.Error:console.error(A.LogLevel[a]+": "+b);break;case A.LogLevel.Warning:console.warn(A.LogLevel[a]+": "+b);break;case A.LogLevel.Information:console.info(A.LogLevel[a]+": "+b);break;default:console.log(A.LogLevel[a]+": "+b)}},a}();b.ConsoleLogger=j}));b(G);var H=(G.Arg,G.getDataDetail,G.formatArrayBuffer,G.sendMessage,G.createLogger,G.Subject,G.SubjectSubscription,G.ConsoleLogger,c(function(a,b){Object.defineProperty(b,"__esModule",{value:!0});var c=3e4,d=function(){function a(a,b,d){var e=this;G.Arg.isRequired(a,"connection"),G.Arg.isRequired(b,"logger"),G.Arg.isRequired(d,"protocol"),this.serverTimeoutInMilliseconds=c,this.logger=b,this.protocol=d,this.connection=a,this.handshakeProtocol=new D.HandshakeProtocol,this.connection.onreceive=function(a){return e.processIncomingData(a)},this.connection.onclose=function(a){return e.connectionClosed(a)},this.callbacks={},this.methods={},this.closedCallbacks=[],this.id=0}return a.create=function(b,c,d){return new a(b,c,d)},a.prototype.start=function(){return y.__awaiter(this,void 0,void 0,function(){var a;return y.__generator(this,function(b){switch(b.label){case 0:return a={protocol:this.protocol.name,version:this.protocol.version},this.logger.log(A.LogLevel.Debug,"Starting HubConnection."),this.receivedHandshakeResponse=!1,[4,this.connection.start(this.protocol.transferFormat)];case 1:return b.sent(),this.logger.log(A.LogLevel.Debug,"Sending handshake request."),[4,this.connection.send(this.handshakeProtocol.writeHandshakeRequest(a))];case 2:return b.sent(),this.logger.log(A.LogLevel.Information,"Using HubProtocol '"+this.protocol.name+"'."),this.cleanupTimeout(),this.configureTimeout(),[2]}})})},a.prototype.stop=function(){return this.logger.log(A.LogLevel.Debug,"Stopping HubConnection."),this.cleanupTimeout(),this.connection.stop()},a.prototype.stream=function(a){for(var b=this,c=[],d=1;d")),this.onclose(c)),this.logger.log(A.LogLevel.Trace,"(LongPolling transport) Transport finished."),[7];case 9:return[2]}})})},a.prototype.send=function(a){return y.__awaiter(this,void 0,void 0,function(){return y.__generator(this,function(b){return this.running?[2,G.sendMessage(this.logger,"LongPolling",this.httpClient,this.url,this.accessTokenFactory,a,this.logMessageContent)]:[2,Promise.reject(new Error("Cannot send until the transport is connected"))]})})},a.prototype.stop=function(){return y.__awaiter(this,void 0,void 0,function(){var a,b,c,d=this;return y.__generator(this,function(e){switch(e.label){case 0:return e.trys.push([0,,3,4]),this.running=!1,this.logger.log(A.LogLevel.Trace,"(LongPolling transport) sending DELETE request to "+this.url+"."),a={headers:{}},[4,this.accessTokenFactory()];case 1:return b=e.sent(),this.updateHeaderToken(a,b),[4,this.httpClient.delete(this.url,a)];case 2:return c=e.sent(),this.logger.log(A.LogLevel.Trace,"(LongPolling transport) DELETE request accepted."),[3,4];case 3:return this.stopped||(this.shutdownTimer=setTimeout(function(){d.logger.log(A.LogLevel.Warning,"(LongPolling transport) server did not terminate after DELETE request, canceling poll."),d.pollAbort.abort()},this.shutdownTimeout)),[7];case 4:return[2]}})})},a}();b.LongPollingTransport=d}));b(K);var L=(K.LongPollingTransport,c(function(a,b){Object.defineProperty(b,"__esModule",{value:!0});var c=function(){function a(a,b,c,d){this.httpClient=a,this.accessTokenFactory=b||function(){return null},this.logger=c,this.logMessageContent=d}return a.prototype.connect=function(a,b){return y.__awaiter(this,void 0,void 0,function(){var c,d=this;return y.__generator(this,function(e){switch(e.label){case 0:if(G.Arg.isRequired(a,"url"),G.Arg.isRequired(b,"transferFormat"),G.Arg.isIn(b,I.TransferFormat,"transferFormat"),"undefined"==typeof EventSource)throw new Error("'EventSource' is not supported in your environment.");return this.logger.log(A.LogLevel.Trace,"(SSE transport) Connecting"),[4,this.accessTokenFactory()];case 1:return c=e.sent(),c&&(a+=(a.indexOf("?")<0?"?":"&")+("access_token="+encodeURIComponent(c))),this.url=a,[2,new Promise(function(c,e){var f=!1;b!==I.TransferFormat.Text&&e(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"));var g=new EventSource(a,{withCredentials:!0});try{g.onmessage=function(a){if(d.onreceive)try{d.logger.log(A.LogLevel.Trace,"(SSE transport) data received. "+G.getDataDetail(a.data,d.logMessageContent)+"."),d.onreceive(a.data)}catch(a){return void(d.onclose&&d.onclose(a))}},g.onerror=function(a){var b=new Error(a.message||"Error occurred");f?d.close(b):e(b)},g.onopen=function(){d.logger.log(A.LogLevel.Information,"SSE connected to "+d.url), +d.eventSource=g,f=!0,c()}}catch(a){return Promise.reject(a)}})]}})})},a.prototype.send=function(a){return y.__awaiter(this,void 0,void 0,function(){return y.__generator(this,function(b){return this.eventSource?[2,G.sendMessage(this.logger,"SSE",this.httpClient,this.url,this.accessTokenFactory,a,this.logMessageContent)]:[2,Promise.reject(new Error("Cannot send until the transport is connected"))]})})},a.prototype.stop=function(){return this.close(),Promise.resolve()},a.prototype.close=function(a){this.eventSource&&(this.eventSource.close(),this.eventSource=null,this.onclose&&this.onclose(a))},a}();b.ServerSentEventsTransport=c}));b(L);var M=(L.ServerSentEventsTransport,c(function(a,b){Object.defineProperty(b,"__esModule",{value:!0});var c=function(){function a(a,b,c){this.logger=b,this.accessTokenFactory=a||function(){return null},this.logMessageContent=c}return a.prototype.connect=function(a,b){return y.__awaiter(this,void 0,void 0,function(){var c,d=this;return y.__generator(this,function(e){switch(e.label){case 0:if(G.Arg.isRequired(a,"url"),G.Arg.isRequired(b,"transferFormat"),G.Arg.isIn(b,I.TransferFormat,"transferFormat"),"undefined"==typeof WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return this.logger.log(A.LogLevel.Trace,"(WebSockets transport) Connecting"),[4,this.accessTokenFactory()];case 1:return c=e.sent(),c&&(a+=(a.indexOf("?")<0?"?":"&")+("access_token="+encodeURIComponent(c))),[2,new Promise(function(c,e){a=a.replace(/^http/,"ws");var f=new WebSocket(a);b===I.TransferFormat.Binary&&(f.binaryType="arraybuffer"),f.onopen=function(b){d.logger.log(A.LogLevel.Information,"WebSocket connected to "+a),d.webSocket=f,c()},f.onerror=function(a){e(a.error)},f.onmessage=function(a){d.logger.log(A.LogLevel.Trace,"(WebSockets transport) data received. "+G.getDataDetail(a.data,d.logMessageContent)+"."),d.onreceive&&d.onreceive(a.data)},f.onclose=function(a){d.logger.log(A.LogLevel.Trace,"(WebSockets transport) socket closed."),d.onclose&&(a.wasClean===!1||1e3!==a.code?d.onclose(new Error("Websocket closed with status code: "+a.code+" ("+a.reason+")")):d.onclose())}})]}})})},a.prototype.send=function(a){return this.webSocket&&this.webSocket.readyState===WebSocket.OPEN?(this.logger.log(A.LogLevel.Trace,"(WebSockets transport) sending data. "+G.getDataDetail(a,this.logMessageContent)+"."),this.webSocket.send(a),Promise.resolve()):Promise.reject("WebSocket is not in the OPEN state")},a.prototype.stop=function(){return this.webSocket&&(this.webSocket.close(),this.webSocket=null),Promise.resolve()},a}();b.WebSocketTransport=c}));b(M);var N=(M.WebSocketTransport,c(function(a,b){function c(a,b){return!a||0!==(b&a)}Object.defineProperty(b,"__esModule",{value:!0});var d=100,e=function(){function a(a,b){void 0===b&&(b={}),this.features={},G.Arg.isRequired(a,"url"),this.logger=G.createLogger(b.logger),this.baseUrl=this.resolveUrl(a),b=b||{},b.accessTokenFactory=b.accessTokenFactory||function(){return null},b.logMessageContent=b.logMessageContent||!1,this.httpClient=b.httpClient||new B.DefaultHttpClient(this.logger),this.connectionState=2,this.options=b}return a.prototype.start=function(a){return a=a||I.TransferFormat.Binary,G.Arg.isIn(a,I.TransferFormat,"transferFormat"),this.logger.log(A.LogLevel.Debug,"Starting connection with transfer format '"+I.TransferFormat[a]+"'."),2!==this.connectionState?Promise.reject(new Error("Cannot start a connection that is not in the 'Disconnected' state.")):(this.connectionState=0,this.startPromise=this.startInternal(a),this.startPromise)},a.prototype.send=function(a){if(1!==this.connectionState)throw new Error("Cannot send data if the connection is not in the 'Connected' State.");return this.transport.send(a)},a.prototype.stop=function(a){return y.__awaiter(this,void 0,void 0,function(){var b;return y.__generator(this,function(c){switch(c.label){case 0:this.connectionState=2,c.label=1;case 1:return c.trys.push([1,3,,4]),[4,this.startPromise];case 2:return c.sent(),[3,4];case 3:return b=c.sent(),[3,4];case 4:return this.transport?(this.stopError=a,[4,this.transport.stop()]):[3,6];case 5:c.sent(),this.transport=null,c.label=6;case 6:return[2]}})})},a.prototype.startInternal=function(a){return y.__awaiter(this,void 0,void 0,function(){var b,c,e,f,g,h,i,j=this;return y.__generator(this,function(k){switch(k.label){case 0:b=this.baseUrl,this.accessTokenFactory=this.options.accessTokenFactory,k.label=1;case 1:return k.trys.push([1,12,,13]),this.options.skipNegotiation?this.options.transport!==I.HttpTransportType.WebSockets?[3,3]:(this.transport=this.constructTransport(I.HttpTransportType.WebSockets),[4,this.transport.connect(b,a)]):[3,5];case 2:return k.sent(),[3,4];case 3:throw Error("Negotiation can only be skipped when using the WebSocket transport directly.");case 4:return[3,11];case 5:c=null,e=0,f=function(){var a;return y.__generator(this,function(d){switch(d.label){case 0:return[4,g.getNegotiationResponse(b)];case 1:return c=d.sent(),2===g.connectionState?[2,{value:void 0}]:(c.url&&(b=c.url),c.accessToken&&(a=c.accessToken,g.accessTokenFactory=function(){return a}),e++,[2])}})},g=this,k.label=6;case 6:return[5,f()];case 7:if(h=k.sent(),"object"==typeof h)return[2,h.value];k.label=8;case 8:if(c.url&&e=0){if(!(e===I.HttpTransportType.WebSockets&&"undefined"==typeof WebSocket||e===I.HttpTransportType.ServerSentEvents&&"undefined"==typeof EventSource))return this.logger.log(A.LogLevel.Debug,"Selecting transport '"+I.HttpTransportType[e]+"'"),e;this.logger.log(A.LogLevel.Debug,"Skipping transport '"+I.HttpTransportType[e]+"' because it is not supported in your environment.'")}else this.logger.log(A.LogLevel.Debug,"Skipping transport '"+I.HttpTransportType[e]+"' because it does not support the requested transfer format '"+I.TransferFormat[d]+"'.");else this.logger.log(A.LogLevel.Debug,"Skipping transport '"+I.HttpTransportType[e]+"' because it was disabled by the client.")}return null},a.prototype.isITransport=function(a){return a&&"object"==typeof a&&"connect"in a},a.prototype.changeState=function(a,b){return this.connectionState===a&&(this.connectionState=b,!0)},a.prototype.stopConnection=function(a){return y.__awaiter(this,void 0,void 0,function(){return y.__generator(this,function(b){return this.transport=null,a=this.stopError||a,a?this.logger.log(A.LogLevel.Error,"Connection disconnected with error '"+a+"'."):this.logger.log(A.LogLevel.Information,"Connection disconnected."),this.connectionState=2,this.onclose&&this.onclose(a),[2]})})},a.prototype.resolveUrl=function(a){if(0===a.lastIndexOf("https://",0)||0===a.lastIndexOf("http://",0))return a;if("undefined"==typeof window||!window||!window.document)throw new Error("Cannot resolve '"+a+"'.");var b=window.document.createElement("a");return b.href=a,this.logger.log(A.LogLevel.Information,"Normalizing '"+a+"' to '"+b.href+"'."),b.href},a.prototype.resolveNegotiateUrl=function(a){var b=a.indexOf("?"),c=a.substring(0,b===-1?a.length:b);return"/"!==c[c.length-1]&&(c+="/"),c+="negotiate",c+=b===-1?"":a.substring(b)},a}();b.HttpConnection=e}));b(N);var O=(N.HttpConnection,c(function(a,b){Object.defineProperty(b,"__esModule",{value:!0});var c="json",d=function(){function a(){this.name=c,this.version=1,this.transferFormat=I.TransferFormat.Text}return a.prototype.parseMessages=function(a,b){if("string"!=typeof a)throw new Error("Invalid input for JSON hub protocol. Expected a string.");if(!a)return[];null===b&&(b=F.NullLogger.instance);for(var c=C.TextMessageFormat.parse(a),d=[],e=0,f=c;e