123456789 |
- (function(n,t){typeof exports=="object"&&typeof module=="object"?module.exports=t():typeof define=="function"&&define.amd?define([],t):typeof exports=="object"?exports.signalR=t():n.signalR=t()})(window,function(){return function(n){function t(r){if(i[r])return i[r].exports;var u=i[r]={i:r,l:!1,exports:{}};return n[r].call(u.exports,u,u.exports,t),u.l=!0,u.exports}var i={};return t.m=n,t.c=i,t.d=function(n,i,r){t.o(n,i)||Object.defineProperty(n,i,{enumerable:!0,get:r})},t.r=function(n){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"});Object.defineProperty(n,"__esModule",{value:!0})},t.t=function(n,i){var r,u;if((i&1&&(n=t(n)),i&8)||i&4&&typeof n=="object"&&n&&n.__esModule)return n;if(r=Object.create(null),t.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:n}),i&2&&typeof n!="string")for(u in n)t.d(r,u,function(t){return n[t]}.bind(null,u));return r},t.n=function(n){var i=n&&n.__esModule?function(){return n["default"]}:function(){return n};return t.d(i,"a",i),i},t.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},t.p="",t(t.s=0)}([function(n,t,i){"use strict";i.r(t);var u=i(1),f=i.n(u),r=i(3);i.d(t,"VERSION",function(){return r.VERSION});i.d(t,"AbortError",function(){return r.AbortError});i.d(t,"HttpError",function(){return r.HttpError});i.d(t,"TimeoutError",function(){return r.TimeoutError});i.d(t,"HttpClient",function(){return r.HttpClient});i.d(t,"HttpResponse",function(){return r.HttpResponse});i.d(t,"DefaultHttpClient",function(){return r.DefaultHttpClient});i.d(t,"HubConnection",function(){return r.HubConnection});i.d(t,"HubConnectionState",function(){return r.HubConnectionState});i.d(t,"HubConnectionBuilder",function(){return r.HubConnectionBuilder});i.d(t,"MessageType",function(){return r.MessageType});i.d(t,"LogLevel",function(){return r.LogLevel});i.d(t,"HttpTransportType",function(){return r.HttpTransportType});i.d(t,"TransferFormat",function(){return r.TransferFormat});i.d(t,"NullLogger",function(){return r.NullLogger});i.d(t,"JsonHubProtocol",function(){return r.JsonHubProtocol});i.d(t,"Subject",function(){return r.Subject});Uint8Array.prototype.indexOf||Object.defineProperty(Uint8Array.prototype,"indexOf",{value:Array.prototype.indexOf,writable:!0});Uint8Array.prototype.slice||Object.defineProperty(Uint8Array.prototype,"slice",{value:function(n,t){return new Uint8Array(Array.prototype.slice.call(this,n,t))},writable:!0});Uint8Array.prototype.forEach||Object.defineProperty(Uint8Array.prototype,"forEach",{value:Array.prototype.forEach,writable:!0})},function(n,t,i){(function(t){var r;
- /*!
- * @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(t,i){n.exports=i()})(this,function(){"use strict";function kt(n){var t=typeof n;return n!==null&&(t==="object"||t==="function")}function et(n){return typeof n=="function"}function dt(n){d=n}function gt(n){e=n}function ii(){return function(){return process.nextTick(h)}}function ri(){return typeof k!="undefined"?function(){k(h)}:g()}function ui(){var n=0,i=new lt(h),t=document.createTextNode("");return i.observe(t,{characterData:!0}),function(){t.data=n=++n%2}}function fi(){var n=new MessageChannel;return n.port1.onmessage=h,function(){return n.port2.postMessage(0)}}function g(){var n=setTimeout;return function(){return n(h,1)}}function h(){for(var t,i,n=0;n<s;n+=2)t=o[n],i=o[n+1],t(i),o[n]=undefined,o[n+1]=undefined;s=0}function ei(){try{var t=r,n=i(!function(){var n=new Error("Cannot find module 'vertx'");n.code="MODULE_NOT_FOUND";throw n;}());return k=n.runOnLoop||n.runOnContext,ri()}catch(f){return g()}}function tt(n,t){var u=this,i=new this.constructor(c),r,f;return i[v]===undefined&&wt(i),r=u._state,r?(f=arguments[r-1],e(function(){return pt(r,i,f,u._result)})):rt(u,i,n,t),i}function it(n){var i=this,t;return n&&typeof n=="object"&&n.constructor===i?n:(t=new i(c),w(t,n),t)}function c(){}function oi(){return new TypeError("You cannot resolve a promise with itself")}function si(){return new TypeError("A promises callback cannot return that same promise.")}function at(n){try{return n.then}catch(t){return p.error=t,p}}function hi(n,t,i,r){try{n.call(t,i,r)}catch(u){return u}}function ci(n,t,i){e(function(n){var r=!1,e=hi(i,t,function(i){r||(r=!0,t!==i?w(n,i):f(n,i))},function(t){r||(r=!0,u(n,t))},"Settle: "+(n._label||" unknown promise"));!r&&e&&(r=!0,u(n,e))},n)}function li(n,t){t._state===y?f(n,t._result):t._state===a?u(n,t._result):rt(t,undefined,function(t){return w(n,t)},function(t){return u(n,t)})}function vt(n,t,i){t.constructor===n.constructor&&i===tt&&t.constructor.resolve===it?li(n,t):i===p?(u(n,p.error),p.error=null):i===undefined?f(n,t):et(i)?ci(n,t,i):f(n,t)}function w(n,t){n===t?u(n,oi()):kt(t)?vt(n,t,at(t)):f(n,t)}function ai(n){n._onerror&&n._onerror(n._result);ut(n)}function f(n,t){n._state===l&&(n._result=t,n._state=y,n._subscribers.length!==0&&e(ut,n))}function u(n,t){n._state===l&&(n._state=a,n._result=t,e(ai,n))}function rt(n,t,i,r){var u=n._subscribers,f=u.length;n._onerror=null;u[f]=t;u[f+y]=i;u[f+a]=r;f===0&&n._state&&e(ut,n)}function ut(n){var i=n._subscribers,f=n._state,t;if(i.length!==0){var r=void 0,u=void 0,e=n._result;for(t=0;t<i.length;t+=3)r=i[t],u=i[t+f],r?pt(f,r,u,e):u(e);n._subscribers.length=0}}function yt(){this.error=null}function vi(n,t){try{return n(t)}catch(i){return b.error=i,b}}function pt(n,t,i,r){var s=et(i),e=void 0,h=void 0,o=void 0,c=void 0;if(s){if(e=vi(i,r),e===b?(c=!0,h=e.error,e.error=null):o=!0,t===e){u(t,si());return}}else e=r,o=!0;t._state!==l||(s&&o?w(t,e):c?u(t,h):n===y?f(t,e):n===a&&u(t,e))}function yi(n,t){try{t(function(t){w(n,t)},function(t){u(n,t)})}catch(i){u(n,i)}}function pi(){return ft++}function wt(n){n[v]=ft++;n._state=undefined;n._result=undefined;n._subscribers=[]}function wi(){return new Error("Array Methods must be provided an Array")}function wi(){return new Error("Array Methods must be provided an Array")}function bi(n){return new bt(this,n).promise}function ki(n){var t=this;return st(n)?new t(function(i,r){for(var f=n.length,u=0;u<f;u++)t.resolve(n[u]).then(i,r)}):new t(function(n,t){return t(new TypeError("You must pass an array to race."))})}function di(n){var i=this,t=new i(c);return u(t,n),t}function gi(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor");}function nr(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");}function tr(){var i=void 0,r,u;if(typeof t!="undefined")i=t;else if(typeof self!="undefined")i=self;else try{i=Function("return this")()}catch(f){throw new Error("polyfill failed because global object is unavailable in this environment");}if(r=i.Promise,r){u=null;try{u=Object.prototype.toString.call(r.resolve())}catch(f){}if(u==="[object Promise]"&&!r.cast)return}i.Promise=n}var ot=void 0,o,nt,v,b,ft,bt,n;ot=Array.isArray?Array.isArray:function(n){return Object.prototype.toString.call(n)==="[object Array]"};var st=ot,s=0,k=void 0,d=void 0,e=function(n,t){o[s]=n;o[s+1]=t;s+=2;s===2&&(d?d(h):nt())};var ht=typeof window!="undefined"?window:undefined,ct=ht||{},lt=ct.MutationObserver||ct.WebKitMutationObserver,ni=typeof self=="undefined"&&typeof process!="undefined"&&{}.toString.call(process)==="[object process]",ti=typeof Uint8ClampedArray!="undefined"&&typeof importScripts!="undefined"&&typeof MessageChannel!="undefined";o=new Array(1e3);nt=void 0;nt=ni?ii():lt?ui():ti?fi():ht===undefined&&!0?ei():g();v=Math.random().toString(36).substring(16);var l=void 0,y=1,a=2,p=new yt;return b=new yt,ft=0,bt=function(){function t(n,t){this._instanceConstructor=n;this.promise=new n(c);this.promise[v]||wt(this.promise);st(t)?(this.length=t.length,this._remaining=t.length,this._result=new Array(this.length),this.length===0?f(this.promise,this._result):(this.length=this.length||0,this._enumerate(t),this._remaining===0&&f(this.promise,this._result))):u(this.promise,wi())}return t.prototype._enumerate=function(n){for(var t=0;this._state===l&&t<n.length;t++)this._eachEntry(n[t],t)},t.prototype._eachEntry=function(t,i){var r=this._instanceConstructor,e=r.resolve,u,f;e===it?(u=at(t),u===tt&&t._state!==l?this._settledAt(t._state,i,t._result):typeof u!="function"?(this._remaining--,this._result[i]=t):r===n?(f=new r(c),vt(f,t,u),this._willSettleAt(f,i)):this._willSettleAt(new r(function(n){return n(t)}),i)):this._willSettleAt(e(t),i)},t.prototype._settledAt=function(n,t,i){var r=this.promise;r._state===l&&(this._remaining--,n===a?u(r,i):this._result[t]=i);this._remaining===0&&f(r,this._result)},t.prototype._willSettleAt=function(n,t){var i=this;rt(n,undefined,function(n){return i._settledAt(y,t,n)},function(n){return i._settledAt(a,t,n)})},t}(),n=function(){function n(t){this[v]=pi();this._result=this._state=undefined;this._subscribers=[];c!==t&&(typeof t!="function"&&gi(),this instanceof n?yi(this,t):nr())}return n.prototype.catch=function(n){return this.then(null,n)},n.prototype.finally=function(n){var t=this,i=t.constructor;return t.then(function(t){return i.resolve(n()).then(function(){return t})},function(t){return i.resolve(n()).then(function(){throw t;})})},n}(),n.prototype.then=tt,n.all=bi,n.race=ki,n.resolve=it,n.reject=di,n._setScheduler=dt,n._setAsap=gt,n._asap=e,n.polyfill=tr,n.Promise=n,n.polyfill(),n})}).call(this,i(2))},function(n){var t=function(){return this}();try{t=t||new Function("return this")()}catch(i){typeof window=="object"&&(t=window)}n.exports=t},function(n,t,i){"use strict";var r,u,o,f,s,h,c,e,l,a,v,y;i.r(t);i.d(t,"VERSION",function(){return y});r=i(4);i.d(t,"AbortError",function(){return r.AbortError});i.d(t,"HttpError",function(){return r.HttpError});i.d(t,"TimeoutError",function(){return r.TimeoutError});u=i(5);i.d(t,"HttpClient",function(){return u.HttpClient});i.d(t,"HttpResponse",function(){return u.HttpResponse});o=i(6);i.d(t,"DefaultHttpClient",function(){return o.DefaultHttpClient});f=i(10);i.d(t,"HubConnection",function(){return f.HubConnection});i.d(t,"HubConnectionState",function(){return f.HubConnectionState});s=i(17);i.d(t,"HubConnectionBuilder",function(){return s.HubConnectionBuilder});h=i(15);i.d(t,"MessageType",function(){return h.MessageType});c=i(9);i.d(t,"LogLevel",function(){return c.LogLevel});e=i(20);i.d(t,"HttpTransportType",function(){return e.HttpTransportType});i.d(t,"TransferFormat",function(){return e.TransferFormat});l=i(14);i.d(t,"NullLogger",function(){return l.NullLogger});a=i(25);i.d(t,"JsonHubProtocol",function(){return a.JsonHubProtocol});v=i(16);i.d(t,"Subject",function(){return v.Subject});y="3.1.8"},function(n,t,i){"use strict";i.r(t);i.d(t,"HttpError",function(){return u});i.d(t,"TimeoutError",function(){return f});i.d(t,"AbortError",function(){return e});var r=undefined&&undefined.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),u=function(n){function t(t,i){var u=this.constructor,r=this,f=u.prototype;return r=n.call(this,t)||this,r.statusCode=i,r.__proto__=f,r}return r(t,n),t}(Error),f=function(n){function t(t){var u=this.constructor,i,r;return t===void 0&&(t="A timeout occurred."),i=this,r=u.prototype,i=n.call(this,t)||this,i.__proto__=r,i}return r(t,n),t}(Error),e=function(n){function t(t){var u=this.constructor,i,r;return t===void 0&&(t="An abort occurred."),i=this,r=u.prototype,i=n.call(this,t)||this,i.__proto__=r,i}return r(t,n),t}(Error)},function(n,t,i){"use strict";i.r(t);i.d(t,"HttpResponse",function(){return u});i.d(t,"HttpClient",function(){return f});var r=undefined&&undefined.__assign||Object.assign||function(n){for(var t,r,i=1,u=arguments.length;i<u;i++){t=arguments[i];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},u=function(){function n(n,t,i){this.statusCode=n;this.statusText=t;this.content=i}return n}(),f=function(){function n(){}return n.prototype.get=function(n,t){return this.send(r({},t,{method:"GET",url:n}))},n.prototype.post=function(n,t){return this.send(r({},t,{method:"POST",url:n}))},n.prototype.delete=function(n,t){return this.send(r({},t,{method:"DELETE",url:n}))},n.prototype.getCookieString=function(){return""},n}()},function(n,t,i){"use strict";i.r(t);i.d(t,"DefaultHttpClient",function(){return s});var r=i(4),u=i(5),f=i(7),e=i(8),o=undefined&&undefined.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),s=function(n){function t(t){var i=n.call(this)||this;return i.httpClient=typeof XMLHttpRequest!="undefined"?new e.XhrHttpClient(t):new f.NodeHttpClient(t),i}return o(t,n),t.prototype.send=function(n){return n.abortSignal&&n.abortSignal.aborted?Promise.reject(new r.AbortError):n.method?n.url?this.httpClient.send(n):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))},t.prototype.getCookieString=function(n){return this.httpClient.getCookieString(n)},t}(u.HttpClient)},function(n,t,i){"use strict";i.r(t);i.d(t,"NodeHttpClient",function(){return f});var r=i(5),u=undefined&&undefined.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),f=function(n){function t(){return n.call(this)||this}return u(t,n),t.prototype.send=function(){return Promise.reject(new Error("If using Node either provide an XmlHttpRequest polyfill or consume the cjs or esm script instead of the browser/signalr.js one."))},t}(r.HttpClient)},function(n,t,i){"use strict";i.r(t);i.d(t,"XhrHttpClient",function(){return o});var r=i(4),u=i(5),f=i(9),e=undefined&&undefined.__extends||function(){var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])};return function(t,i){function r(){this.constructor=t}n(t,i);t.prototype=i===null?Object.create(i):(r.prototype=i.prototype,new r)}}(),o=function(n){function t(t){var i=n.call(this)||this;return i.logger=t,i}return e(t,n),t.prototype.send=function(n){var t=this;return n.abortSignal&&n.abortSignal.aborted?Promise.reject(new r.AbortError):n.method?n.url?new Promise(function(i,e){var o=new XMLHttpRequest,s;o.open(n.method,n.url,!0);o.withCredentials=!1;o.setRequestHeader("X-Requested-With","XMLHttpRequest");o.setRequestHeader("Content-Type","text/plain;charset=UTF-8");s=n.headers;s&&Object.keys(s).forEach(function(n){o.setRequestHeader(n,s[n])});n.responseType&&(o.responseType=n.responseType);n.abortSignal&&(n.abortSignal.onabort=function(){o.abort();e(new r.AbortError)});n.timeout&&(o.timeout=n.timeout);o.onload=function(){n.abortSignal&&(n.abortSignal.onabort=null);o.status>=200&&o.status<300?i(new u.HttpResponse(o.status,o.statusText,o.response||o.responseText)):e(new r.HttpError(o.statusText,o.status))};o.onerror=function(){t.logger.log(f.LogLevel.Warning,"Error from HTTP request. "+o.status+": "+o.statusText+".");e(new r.HttpError(o.statusText,o.status))};o.ontimeout=function(){t.logger.log(f.LogLevel.Warning,"Timeout from HTTP request.");e(new r.TimeoutError)};o.send(n.content||"")}):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))},t}(u.HttpClient)},function(n,t,i){"use strict";i.r(t);i.d(t,"LogLevel",function(){return r});var r;(function(n){n[n.Trace=0]="Trace";n[n.Debug=1]="Debug";n[n.Information=2]="Information";n[n.Warning=3]="Warning";n[n.Error=4]="Error";n[n.Critical=5]="Critical";n[n.None=6]="None"})(r||(r={}))},function(n,t,i){"use strict";var h;i.r(t);i.d(t,"HubConnectionState",function(){return u});i.d(t,"HubConnection",function(){return h});var c=i(11),f=i(15),r=i(9),l=i(16),s=i(13),e=undefined&&undefined.__awaiter||function(n,t,i,r){return new(i||(i=Promise))(function(u,f){function o(n){try{e(r.next(n))}catch(t){f(t)}}function s(n){try{e(r["throw"](n))}catch(t){f(t)}}function e(n){n.done?u(n.value):new i(function(t){t(n.value)}).then(o,s)}e((r=r.apply(n,t||[])).next())})},o=undefined&&undefined.__generator||function(n,t){function o(n){return function(t){return s([n,t])}}function s(e){if(f)throw new TypeError("Generator is already executing.");while(r)try{if(f=1,u&&(i=e[0]&2?u["return"]:e[0]?u["throw"]||((i=u["return"])&&i.call(u),0):u.next)&&!(i=i.call(u,e[1])).done)return i;(u=0,i)&&(e=[e[0]&2,i.value]);switch(e[0]){case 0:case 1:i=e;break;case 4:return r.label++,{value:e[1],done:!1};case 5:r.label++;u=e[1];e=[0];continue;case 7:e=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(e[0]===6||e[0]===2)){r=0;continue}if(e[0]===3&&(!i||e[1]>i[0]&&e[1]<i[3])){r.label=e[1];break}if(e[0]===6&&r.label<i[1]){r.label=i[1];i=e;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(e);break}i[2]&&r.ops.pop();r.trys.pop();continue}e=t.call(n,r)}catch(o){e=[6,o];u=0}finally{f=i=0}if(e[0]&5)throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},f,u,i,e;return e={next:o(0),"throw":o(1),"return":o(2)},typeof Symbol=="function"&&(e[Symbol.iterator]=function(){return this}),e},a=3e4,v=15e3,u;(function(n){n.Disconnected="Disconnected";n.Connecting="Connecting";n.Connected="Connected";n.Disconnecting="Disconnecting";n.Reconnecting="Reconnecting"})(u||(u={}));h=function(){function n(n,t,i,r){var e=this;s.Arg.isRequired(n,"connection");s.Arg.isRequired(t,"logger");s.Arg.isRequired(i,"protocol");this.serverTimeoutInMilliseconds=a;this.keepAliveIntervalInMilliseconds=v;this.logger=t;this.protocol=i;this.connection=n;this.reconnectPolicy=r;this.handshakeProtocol=new c.HandshakeProtocol;this.connection.onreceive=function(n){return e.processIncomingData(n)};this.connection.onclose=function(n){return e.connectionClosed(n)};this.callbacks={};this.methods={};this.closedCallbacks=[];this.reconnectingCallbacks=[];this.reconnectedCallbacks=[];this.invocationId=0;this.receivedHandshakeResponse=!1;this.connectionState=u.Disconnected;this.connectionStarted=!1;this.cachedPingMessage=this.protocol.writeMessage({type:f.MessageType.Ping})}return n.create=function(t,i,r,u){return new n(t,i,r,u)},Object.defineProperty(n.prototype,"state",{get:function(){return this.connectionState},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"connectionId",{get:function(){return this.connection?this.connection.connectionId||null:null},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"baseUrl",{get:function(){return this.connection.baseUrl||""},set:function(n){if(this.connectionState!==u.Disconnected&&this.connectionState!==u.Reconnecting)throw new Error("The HubConnection must be in the Disconnected or Reconnecting state to change the url.");if(!n)throw new Error("The HubConnection url must be a valid url.");this.connection.baseUrl=n},enumerable:!0,configurable:!0}),n.prototype.start=function(){return this.startPromise=this.startWithStateTransitions(),this.startPromise},n.prototype.startWithStateTransitions=function(){return e(this,void 0,void 0,function(){var n;return o(this,function(t){switch(t.label){case 0:if(this.connectionState!==u.Disconnected)return[2,Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."))];this.connectionState=u.Connecting;this.logger.log(r.LogLevel.Debug,"Starting HubConnection.");t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.startInternal()];case 2:return t.sent(),this.connectionState=u.Connected,this.connectionStarted=!0,this.logger.log(r.LogLevel.Debug,"HubConnection connected successfully."),[3,4];case 3:return n=t.sent(),this.connectionState=u.Disconnected,this.logger.log(r.LogLevel.Debug,"HubConnection failed to start successfully because of error '"+n+"'."),[2,Promise.reject(n)];case 4:return[2]}})})},n.prototype.startInternal=function(){return e(this,void 0,void 0,function(){var t,i,n,u=this;return o(this,function(f){switch(f.label){case 0:return this.stopDuringStartError=undefined,this.receivedHandshakeResponse=!1,t=new Promise(function(n,t){u.handshakeResolver=n;u.handshakeRejecter=t}),[4,this.connection.start(this.protocol.transferFormat)];case 1:f.sent();f.label=2;case 2:return f.trys.push([2,5,,7]),i={protocol:this.protocol.name,version:this.protocol.version},this.logger.log(r.LogLevel.Debug,"Sending handshake request."),[4,this.sendMessage(this.handshakeProtocol.writeHandshakeRequest(i))];case 3:return f.sent(),this.logger.log(r.LogLevel.Information,"Using HubProtocol '"+this.protocol.name+"'."),this.cleanupTimeout(),this.resetTimeoutPeriod(),this.resetKeepAliveInterval(),[4,t];case 4:if(f.sent(),this.stopDuringStartError)throw this.stopDuringStartError;return[3,7];case 5:return n=f.sent(),this.logger.log(r.LogLevel.Debug,"Hub handshake failed with error '"+n+"' during start(). Stopping HubConnection."),this.cleanupTimeout(),this.cleanupPingTimer(),[4,this.connection.stop(n)];case 6:f.sent();throw n;case 7:return[2]}})})},n.prototype.stop=function(){return e(this,void 0,void 0,function(){var n,t;return o(this,function(i){switch(i.label){case 0:return n=this.startPromise,this.stopPromise=this.stopInternal(),[4,this.stopPromise];case 1:i.sent();i.label=2;case 2:return i.trys.push([2,4,,5]),[4,n];case 3:return i.sent(),[3,5];case 4:return t=i.sent(),[3,5];case 5:return[2]}})})},n.prototype.stopInternal=function(n){return this.connectionState===u.Disconnected?(this.logger.log(r.LogLevel.Debug,"Call to HubConnection.stop("+n+") ignored because it is already in the disconnected state."),Promise.resolve()):this.connectionState===u.Disconnecting?(this.logger.log(r.LogLevel.Debug,"Call to HttpConnection.stop("+n+") ignored because the connection is already in the disconnecting state."),this.stopPromise):(this.connectionState=u.Disconnecting,this.logger.log(r.LogLevel.Debug,"Stopping HubConnection."),this.reconnectDelayHandle)?(this.logger.log(r.LogLevel.Debug,"Connection stopped during reconnect delay. Done reconnecting."),clearTimeout(this.reconnectDelayHandle),this.reconnectDelayHandle=undefined,this.completeClose(),Promise.resolve()):(this.cleanupTimeout(),this.cleanupPingTimer(),this.stopDuringStartError=n||new Error("The connection was stopped before the hub handshake could complete."),this.connection.stop(n))},n.prototype.stream=function(n){for(var r=this,e=[],u=1;u<arguments.length;u++)e[u-1]=arguments[u];var s=this.replaceStreamingParams(e),h=s[0],c=s[1],i=this.createStreamInvocation(n,e,c),o,t=new l.Subject;return t.cancelCallback=function(){var n=r.createCancelInvocation(i.invocationId);return delete r.callbacks[i.invocationId],o.then(function(){return r.sendWithProtocol(n)})},this.callbacks[i.invocationId]=function(n,i){if(i){t.error(i);return}n&&(n.type===f.MessageType.Completion?n.error?t.error(new Error(n.error)):t.complete():t.next(n.item))},o=this.sendWithProtocol(i).catch(function(n){t.error(n);delete r.callbacks[i.invocationId]}),this.launchStreams(h,o),t},n.prototype.sendMessage=function(n){return this.resetKeepAliveInterval(),this.connection.send(n)},n.prototype.sendWithProtocol=function(n){return this.sendMessage(this.protocol.writeMessage(n))},n.prototype.send=function(n){for(var i=[],t=1;t<arguments.length;t++)i[t-1]=arguments[t];var r=this.replaceStreamingParams(i),f=r[0],e=r[1],u=this.sendWithProtocol(this.createInvocation(n,i,!0,e));return this.launchStreams(f,u),u},n.prototype.invoke=function(n){for(var t=this,r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];var e=this.replaceStreamingParams(r),o=e[0],s=e[1],u=this.createInvocation(n,r,!1,s);return new Promise(function(n,i){t.callbacks[u.invocationId]=function(t,r){if(r){i(r);return}t&&(t.type===f.MessageType.Completion?t.error?i(new Error(t.error)):n(t.result):i(new Error("Unexpected message type: "+t.type)))};var r=t.sendWithProtocol(u).catch(function(n){i(n);delete t.callbacks[u.invocationId]});t.launchStreams(o,r)})},n.prototype.on=function(n,t){n&&t&&(n=n.toLowerCase(),this.methods[n]||(this.methods[n]=[]),this.methods[n].indexOf(t)===-1)&&this.methods[n].push(t)},n.prototype.off=function(n,t){var i,r;n&&(n=n.toLowerCase(),i=this.methods[n],i)&&(t?(r=i.indexOf(t),r!==-1&&(i.splice(r,1),i.length===0&&delete this.methods[n])):delete this.methods[n])},n.prototype.onclose=function(n){n&&this.closedCallbacks.push(n)},n.prototype.onreconnecting=function(n){n&&this.reconnectingCallbacks.push(n)},n.prototype.onreconnected=function(n){n&&this.reconnectedCallbacks.push(n)},n.prototype.processIncomingData=function(n){var s,i,u,t,e,o;if(this.cleanupTimeout(),this.receivedHandshakeResponse||(n=this.processHandshakeResponse(n),this.receivedHandshakeResponse=!0),n)for(s=this.protocol.parseMessages(n,this.logger),i=0,u=s;i<u.length;i++){t=u[i];switch(t.type){case f.MessageType.Invocation:this.invokeClientMethod(t);break;case f.MessageType.StreamItem:case f.MessageType.Completion:e=this.callbacks[t.invocationId];e&&(t.type===f.MessageType.Completion&&delete this.callbacks[t.invocationId],e(t));break;case f.MessageType.Ping:break;case f.MessageType.Close:this.logger.log(r.LogLevel.Information,"Close message received from server.");o=t.error?new Error("Server returned an error on close: "+t.error):undefined;t.allowReconnect===!0?this.connection.stop(o):this.stopPromise=this.stopInternal(o);break;default:this.logger.log(r.LogLevel.Warning,"Invalid message type: "+t.type+".")}}this.resetTimeoutPeriod()},n.prototype.processHandshakeResponse=function(n){var u,f,e,t,i;try{u=this.handshakeProtocol.parseHandshakeResponse(n);e=u[0];f=u[1]}catch(o){t="Error parsing handshake response: "+o;this.logger.log(r.LogLevel.Error,t);i=new Error(t);this.handshakeRejecter(i);throw i;}if(f.error){t="Server returned handshake error: "+f.error;this.logger.log(r.LogLevel.Error,t);i=new Error(t);this.handshakeRejecter(i);throw i;}else this.logger.log(r.LogLevel.Debug,"Server handshake complete.");return this.handshakeResolver(),e},n.prototype.resetKeepAliveInterval=function(){var n=this;this.cleanupPingTimer();this.pingServerHandle=setTimeout(function(){return e(n,void 0,void 0,function(){var n;return o(this,function(t){switch(t.label){case 0:if(!(this.connectionState===u.Connected))return[3,4];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.sendMessage(this.cachedPingMessage)];case 2:return t.sent(),[3,4];case 3:return n=t.sent(),this.cleanupPingTimer(),[3,4];case 4:return[2]}})})},this.keepAliveIntervalInMilliseconds)},n.prototype.resetTimeoutPeriod=function(){var n=this;this.connection.features&&this.connection.features.inherentKeepAlive||(this.timeoutHandle=setTimeout(function(){return n.serverTimeout()},this.serverTimeoutInMilliseconds))},n.prototype.serverTimeout=function(){this.connection.stop(new Error("Server timeout elapsed without receiving a message from the server."))},n.prototype.invokeClientMethod=function(n){var u=this,i=this.methods[n.target.toLowerCase()],t;if(i){try{i.forEach(function(t){return t.apply(u,n.arguments)})}catch(f){this.logger.log(r.LogLevel.Error,"A callback for the method "+n.target.toLowerCase()+" threw error '"+f+"'.")}n.invocationId&&(t="Server requested a response, which is not supported in this version of the client.",this.logger.log(r.LogLevel.Error,t),this.stopPromise=this.stopInternal(new Error(t)))}else this.logger.log(r.LogLevel.Warning,"No client method with the name '"+n.target+"' found.")},n.prototype.connectionClosed=function(n){this.logger.log(r.LogLevel.Debug,"HubConnection.connectionClosed("+n+") called while in state "+this.connectionState+".");this.stopDuringStartError=this.stopDuringStartError||n||new Error("The underlying connection was closed before the hub handshake could complete.");this.handshakeResolver&&this.handshakeResolver();this.cancelCallbacksWithError(n||new Error("Invocation canceled due to the underlying connection being closed."));this.cleanupTimeout();this.cleanupPingTimer();this.connectionState===u.Disconnecting?this.completeClose(n):this.connectionState===u.Connected&&this.reconnectPolicy?this.reconnect(n):this.connectionState===u.Connected&&this.completeClose(n)},n.prototype.completeClose=function(n){var t=this;if(this.connectionStarted){this.connectionState=u.Disconnected;this.connectionStarted=!1;try{this.closedCallbacks.forEach(function(i){return i.apply(t,[n])})}catch(i){this.logger.log(r.LogLevel.Error,"An onclose callback called with error '"+n+"' threw error '"+i+"'.")}}},n.prototype.reconnect=function(n){return e(this,void 0,void 0,function(){var h,i,e,t,f,s=this;return o(this,function(o){switch(o.label){case 0:if(h=Date.now(),i=0,e=n!==undefined?n:new Error("Attempting to reconnect due to a unknown error."),t=this.getNextRetryDelay(i++,0,e),t===null)return this.logger.log(r.LogLevel.Debug,"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."),this.completeClose(n),[2];if(this.connectionState=u.Reconnecting,n?this.logger.log(r.LogLevel.Information,"Connection reconnecting because of error '"+n+"'."):this.logger.log(r.LogLevel.Information,"Connection reconnecting."),this.onreconnecting){try{this.reconnectingCallbacks.forEach(function(t){return t.apply(s,[n])})}catch(c){this.logger.log(r.LogLevel.Error,"An onreconnecting callback called with error '"+n+"' threw error '"+c+"'.")}if(this.connectionState!==u.Reconnecting)return this.logger.log(r.LogLevel.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting."),[2]}o.label=1;case 1:return(t!==null)?(this.logger.log(r.LogLevel.Information,"Reconnect attempt number "+i+" will start in "+t+" ms."),[4,new Promise(function(n){s.reconnectDelayHandle=setTimeout(n,t)})]):[3,7];case 2:if(o.sent(),this.reconnectDelayHandle=undefined,this.connectionState!==u.Reconnecting)return this.logger.log(r.LogLevel.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting."),[2];o.label=3;case 3:return o.trys.push([3,5,,6]),[4,this.startInternal()];case 4:if(o.sent(),this.connectionState=u.Connected,this.logger.log(r.LogLevel.Information,"HubConnection reconnected successfully."),this.onreconnected)try{this.reconnectedCallbacks.forEach(function(n){return n.apply(s,[s.connection.connectionId])})}catch(c){this.logger.log(r.LogLevel.Error,"An onreconnected callback called with connectionId '"+this.connection.connectionId+"; threw error '"+c+"'.")}return[2];case 5:return(f=o.sent(),this.logger.log(r.LogLevel.Information,"Reconnect attempt failed because of error '"+f+"'."),this.connectionState!==u.Reconnecting)?(this.logger.log(r.LogLevel.Debug,"Connection left the reconnecting state during reconnect attempt. Done reconnecting."),[2]):(e=f instanceof Error?f:new Error(f.toString()),t=this.getNextRetryDelay(i++,Date.now()-h,e),[3,6]);case 6:return[3,1];case 7:return this.logger.log(r.LogLevel.Information,"Reconnect retries have been exhausted after "+(Date.now()-h)+" ms and "+i+" failed attempts. Connection disconnecting."),this.completeClose(),[2]}})})},n.prototype.getNextRetryDelay=function(n,t,i){try{return this.reconnectPolicy.nextRetryDelayInMilliseconds({elapsedMilliseconds:t,previousRetryCount:n,retryReason:i})}catch(u){return this.logger.log(r.LogLevel.Error,"IRetryPolicy.nextRetryDelayInMilliseconds("+n+", "+t+") threw error '"+u+"'."),null}},n.prototype.cancelCallbacksWithError=function(n){var t=this.callbacks;this.callbacks={};Object.keys(t).forEach(function(i){var r=t[i];r(null,n)})},n.prototype.cleanupPingTimer=function(){this.pingServerHandle&&clearTimeout(this.pingServerHandle)},n.prototype.cleanupTimeout=function(){this.timeoutHandle&&clearTimeout(this.timeoutHandle)},n.prototype.createInvocation=function(n,t,i,r){if(i)return{arguments:t,streamIds:r,target:n,type:f.MessageType.Invocation};var u=this.invocationId;return this.invocationId++,{arguments:t,invocationId:u.toString(),streamIds:r,target:n,type:f.MessageType.Invocation}},n.prototype.launchStreams=function(n,t){var i=this,r,u;if(n.length!==0){t||(t=Promise.resolve());r=function(r){n[r].subscribe({complete:function(){t=t.then(function(){return i.sendWithProtocol(i.createCompletionMessage(r))})},error:function(n){var u;u=n instanceof Error?n.message:n&&n.toString?n.toString():"Unknown error";t=t.then(function(){return i.sendWithProtocol(i.createCompletionMessage(r,u))})},next:function(n){t=t.then(function(){return i.sendWithProtocol(i.createStreamItemMessage(r,n))})}})};for(u in n)r(u)}},n.prototype.replaceStreamingParams=function(n){for(var i,r,u=[],f=[],t=0;t<n.length;t++)i=n[t],this.isObservable(i)&&(r=this.invocationId,this.invocationId++,u[r]=i,f.push(r.toString()),n.splice(t,1));return[u,f]},n.prototype.isObservable=function(n){return n&&n.subscribe&&typeof n.subscribe=="function"},n.prototype.createStreamInvocation=function(n,t,i){var r=this.invocationId;return this.invocationId++,{arguments:t,invocationId:r.toString(),streamIds:i,target:n,type:f.MessageType.StreamInvocation}},n.prototype.createCancelInvocation=function(n){return{invocationId:n,type:f.MessageType.CancelInvocation}},n.prototype.createStreamItemMessage=function(n,t){return{invocationId:n,item:t,type:f.MessageType.StreamItem}},n.prototype.createCompletionMessage=function(n,t,i){return t?{error:t,invocationId:n,type:f.MessageType.Completion}:{invocationId:n,result:i,type:f.MessageType.Completion}},n}()},function(n,t,i){"use strict";i.r(t);i.d(t,"HandshakeProtocol",function(){return f});var r=i(12),u=i(13),f=function(){function n(){}return n.prototype.writeHandshakeRequest=function(n){return r.TextMessageFormat.write(JSON.stringify(n))},n.prototype.parseHandshakeResponse=function(n){var c,o,s,f,e,i,t,l,h;if(Object(u.isArrayBuffer)(n)||typeof Buffer!="undefined"&&n instanceof Buffer){if(f=new Uint8Array(n),i=f.indexOf(r.TextMessageFormat.RecordSeparatorCode),i===-1)throw new Error("Message is incomplete.");t=i+1;o=String.fromCharCode.apply(null,f.slice(0,t));s=f.byteLength>t?f.slice(t).buffer:null}else{if(e=n,i=e.indexOf(r.TextMessageFormat.RecordSeparator),i===-1)throw new Error("Message is incomplete.");t=i+1;o=e.substring(0,t);s=e.length>t?e.substring(t):null}if(l=r.TextMessageFormat.parse(o),h=JSON.parse(l[0]),h.type)throw new Error("Expected a handshake response from the server.");return c=h,[s,c]},n}()},function(n,t,i){"use strict";i.r(t);i.d(t,"TextMessageFormat",function(){return r});var r=function(){function n(){}return n.write=function(t){return""+t+n.RecordSeparator},n.parse=function(t){if(t[t.length-1]!==n.RecordSeparator)throw new Error("Message is incomplete.");var i=t.split(n.RecordSeparator);return i.pop(),i},n.RecordSeparatorCode=30,n.RecordSeparator=String.fromCharCode(n.RecordSeparatorCode),n}()},function(n,t,i){"use strict";function e(n,t){var i="";return f(n)?(i="Binary data of length "+n.byteLength,t&&(i+=". Content: '"+o(n)+"'")):typeof n=="string"&&(i="String data of length "+n.length,t&&(i+=". Content: '"+n+"'")),i}function o(n){var i=new Uint8Array(n),t="";return i.forEach(function(n){var i=n<16?"0":"";t+="0x"+i+n.toString(16)+" "}),t.substr(0,t.length-1)}function f(n){return n&&typeof ArrayBuffer!="undefined"&&(n instanceof ArrayBuffer||n.constructor&&n.constructor.name==="ArrayBuffer")}function y(n,t,i,u,o,s,h){return c(this,void 0,void 0,function(){var c,v,a,y,p;return l(this,function(l){switch(l.label){case 0:return o?[4,o()]:[3,2];case 1:a=l.sent();a&&(v=(c={},c.Authorization="Bearer "+a,c));l.label=2;case 2:return n.log(r.LogLevel.Trace,"("+t+" transport) sending data. "+e(s,h)+"."),y=f(s)?"arraybuffer":"text",[4,i.post(u,{content:s,headers:v,responseType:y})];case 3:return p=l.sent(),n.log(r.LogLevel.Trace,"("+t+" transport) request complete. Response status: "+p.statusCode+"."),[2]}})})}function p(n){return n===undefined?new u(r.LogLevel.Information):n===null?h.NullLogger.instance:n.log?n:new u(n)}var s,u;i.r(t);i.d(t,"Arg",function(){return a});i.d(t,"Platform",function(){return v});i.d(t,"getDataDetail",function(){return e});i.d(t,"formatArrayBuffer",function(){return o});i.d(t,"isArrayBuffer",function(){return f});i.d(t,"sendMessage",function(){return y});i.d(t,"createLogger",function(){return p});i.d(t,"SubjectSubscription",function(){return s});i.d(t,"ConsoleLogger",function(){return u});var r=i(9),h=i(14),c=undefined&&undefined.__awaiter||function(n,t,i,r){return new(i||(i=Promise))(function(u,f){function o(n){try{e(r.next(n))}catch(t){f(t)}}function s(n){try{e(r["throw"](n))}catch(t){f(t)}}function e(n){n.done?u(n.value):new i(function(t){t(n.value)}).then(o,s)}e((r=r.apply(n,t||[])).next())})},l=undefined&&undefined.__generator||function(n,t){function o(n){return function(t){return s([n,t])}}function s(e){if(f)throw new TypeError("Generator is already executing.");while(r)try{if(f=1,u&&(i=e[0]&2?u["return"]:e[0]?u["throw"]||((i=u["return"])&&i.call(u),0):u.next)&&!(i=i.call(u,e[1])).done)return i;(u=0,i)&&(e=[e[0]&2,i.value]);switch(e[0]){case 0:case 1:i=e;break;case 4:return r.label++,{value:e[1],done:!1};case 5:r.label++;u=e[1];e=[0];continue;case 7:e=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(e[0]===6||e[0]===2)){r=0;continue}if(e[0]===3&&(!i||e[1]>i[0]&&e[1]<i[3])){r.label=e[1];break}if(e[0]===6&&r.label<i[1]){r.label=i[1];i=e;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(e);break}i[2]&&r.ops.pop();r.trys.pop();continue}e=t.call(n,r)}catch(o){e=[6,o];u=0}finally{f=i=0}if(e[0]&5)throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},f,u,i,e;return e={next:o(0),"throw":o(1),"return":o(2)},typeof Symbol=="function"&&(e[Symbol.iterator]=function(){return this}),e},a=function(){function n(){}return n.isRequired=function(n,t){if(n===null||n===undefined)throw new Error("The '"+t+"' argument is required.");},n.isIn=function(n,t,i){if(!(n in t))throw new Error("Unknown "+i+" value: "+n+".");},n}(),v=function(){function n(){}return Object.defineProperty(n,"isBrowser",{get:function(){return typeof window=="object"},enumerable:!0,configurable:!0}),Object.defineProperty(n,"isWebWorker",{get:function(){return typeof self=="object"&&"importScripts"in self},enumerable:!0,configurable:!0}),Object.defineProperty(n,"isNode",{get:function(){return!this.isBrowser&&!this.isWebWorker},enumerable:!0,configurable:!0}),n}();s=function(){function n(n,t){this.subject=n;this.observer=t}return n.prototype.dispose=function(){var n=this.subject.observers.indexOf(this.observer);n>-1&&this.subject.observers.splice(n,1);this.subject.observers.length===0&&this.subject.cancelCallback&&this.subject.cancelCallback().catch(function(){})},n}();u=function(){function n(n){this.minimumLogLevel=n;this.outputConsole=console}return n.prototype.log=function(n,t){if(n>=this.minimumLogLevel)switch(n){case r.LogLevel.Critical:case r.LogLevel.Error:this.outputConsole.error("["+(new Date).toISOString()+"] "+r.LogLevel[n]+": "+t);break;case r.LogLevel.Warning:this.outputConsole.warn("["+(new Date).toISOString()+"] "+r.LogLevel[n]+": "+t);break;case r.LogLevel.Information:this.outputConsole.info("["+(new Date).toISOString()+"] "+r.LogLevel[n]+": "+t);break;default:this.outputConsole.log("["+(new Date).toISOString()+"] "+r.LogLevel[n]+": "+t)}},n}()},function(n,t,i){"use strict";i.r(t);i.d(t,"NullLogger",function(){return r});var r=function(){function n(){}return n.prototype.log=function(){},n.instance=new n,n}()},function(n,t,i){"use strict";i.r(t);i.d(t,"MessageType",function(){return r});var r;(function(n){n[n.Invocation=1]="Invocation";n[n.StreamItem=2]="StreamItem";n[n.Completion=3]="Completion";n[n.StreamInvocation=4]="StreamInvocation";n[n.CancelInvocation=5]="CancelInvocation";n[n.Ping=6]="Ping";n[n.Close=7]="Close"})(r||(r={}))},function(n,t,i){"use strict";i.r(t);i.d(t,"Subject",function(){return u});var r=i(13),u=function(){function n(){this.observers=[]}return n.prototype.next=function(n){for(var r,t=0,i=this.observers;t<i.length;t++)r=i[t],r.next(n)},n.prototype.error=function(n){for(var r,t=0,i=this.observers;t<i.length;t++)r=i[t],r.error&&r.error(n)},n.prototype.complete=function(){for(var i,n=0,t=this.observers;n<t.length;n++)i=t[n],i.complete&&i.complete()},n.prototype.subscribe=function(n){return this.observers.push(n),new r.SubjectSubscription(this,n)},n}()},function(n,t,i){"use strict";function v(n){var t=a[n.toLowerCase()];if(typeof t!="undefined")return t;throw new Error("Unknown log level: "+n);}function y(n){return n.log!==undefined}var o;i.r(t);i.d(t,"HubConnectionBuilder",function(){return o});var f=i(18),s=i(19),h=i(10),r=i(9),c=i(25),l=i(14),u=i(13),e=undefined&&undefined.__assign||Object.assign||function(n){for(var t,r,i=1,u=arguments.length;i<u;i++){t=arguments[i];for(r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r])}return n},a={trace:r.LogLevel.Trace,debug:r.LogLevel.Debug,info:r.LogLevel.Information,information:r.LogLevel.Information,warn:r.LogLevel.Warning,warning:r.LogLevel.Warning,error:r.LogLevel.Error,critical:r.LogLevel.Critical,none:r.LogLevel.None};o=function(){function n(){}return n.prototype.configureLogging=function(n){if(u.Arg.isRequired(n,"logging"),y(n))this.logger=n;else if(typeof n=="string"){var t=v(n);this.logger=new u.ConsoleLogger(t)}else this.logger=new u.ConsoleLogger(n);return this},n.prototype.withUrl=function(n,t){return u.Arg.isRequired(n,"url"),this.url=n,this.httpConnectionOptions=typeof t=="object"?e({},this.httpConnectionOptions,t):e({},this.httpConnectionOptions,{transport:t}),this},n.prototype.withHubProtocol=function(n){return u.Arg.isRequired(n,"protocol"),this.protocol=n,this},n.prototype.withAutomaticReconnect=function(n){if(this.reconnectPolicy)throw new Error("A reconnectPolicy has already been set.");return this.reconnectPolicy=n?Array.isArray(n)?new f.DefaultReconnectPolicy(n):n:new f.DefaultReconnectPolicy,this},n.prototype.build=function(){var n=this.httpConnectionOptions||{},t;if(n.logger===undefined&&(n.logger=this.logger),!this.url)throw new Error("The 'HubConnectionBuilder.withUrl' method must be called before building the connection.");return t=new s.HttpConnection(this.url,n),h.HubConnection.create(t,this.logger||l.NullLogger.instance,this.protocol||new c.JsonHubProtocol,this.reconnectPolicy)},n}()},function(n,t,i){"use strict";i.r(t);i.d(t,"DefaultReconnectPolicy",function(){return u});var r=[0,2e3,1e4,3e4,null],u=function(){function n(n){this.retryDelays=n!==undefined?n.concat([null]):r}return n.prototype.nextRetryDelayInMilliseconds=function(n){return this.retryDelays[n.previousRetryCount]},n}()},function(n,t,i){"use strict";function d(n,t){return!n||(t&n)!=0}var l,p,a,s;i.r(t);i.d(t,"HttpConnection",function(){return p});i.d(t,"TransportSendQueue",function(){return a});var w=i(6),r=i(9),u=i(20),v=i(21),b=i(23),f=i(13),k=i(24),o=undefined&&undefined.__awaiter||function(n,t,i,r){return new(i||(i=Promise))(function(u,f){function o(n){try{e(r.next(n))}catch(t){f(t)}}function s(n){try{e(r["throw"](n))}catch(t){f(t)}}function e(n){n.done?u(n.value):new i(function(t){t(n.value)}).then(o,s)}e((r=r.apply(n,t||[])).next())})},e=undefined&&undefined.__generator||function(n,t){function o(n){return function(t){return s([n,t])}}function s(e){if(f)throw new TypeError("Generator is already executing.");while(r)try{if(f=1,u&&(i=e[0]&2?u["return"]:e[0]?u["throw"]||((i=u["return"])&&i.call(u),0):u.next)&&!(i=i.call(u,e[1])).done)return i;(u=0,i)&&(e=[e[0]&2,i.value]);switch(e[0]){case 0:case 1:i=e;break;case 4:return r.label++,{value:e[1],done:!1};case 5:r.label++;u=e[1];e=[0];continue;case 7:e=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(e[0]===6||e[0]===2)){r=0;continue}if(e[0]===3&&(!i||e[1]>i[0]&&e[1]<i[3])){r.label=e[1];break}if(e[0]===6&&r.label<i[1]){r.label=i[1];i=e;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(e);break}i[2]&&r.ops.pop();r.trys.pop();continue}e=t.call(n,r)}catch(o){e=[6,o];u=0}finally{f=i=0}if(e[0]&5)throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},f,u,i,e;return e={next:o(0),"throw":o(1),"return":o(2)},typeof Symbol=="function"&&(e[Symbol.iterator]=function(){return this}),e},y=100,h=null,c=null;f.Platform.isNode&&!0&&(l=require,h=l("ws"),c=l("eventsource"));p=function(){function n(n,t){t===void 0&&(t={});this.features={};this.negotiateVersion=1;f.Arg.isRequired(n,"url");this.logger=Object(f.createLogger)(t.logger);this.baseUrl=this.resolveUrl(n);t=t||{};t.logMessageContent=t.logMessageContent||!1;f.Platform.isNode||typeof WebSocket=="undefined"||t.WebSocket?f.Platform.isNode&&!t.WebSocket&&h&&(t.WebSocket=h):t.WebSocket=WebSocket;f.Platform.isNode||typeof EventSource=="undefined"||t.EventSource?f.Platform.isNode&&!t.EventSource&&typeof c!="undefined"&&(t.EventSource=c):t.EventSource=EventSource;this.httpClient=t.httpClient||new w.DefaultHttpClient(this.logger);this.connectionState="Disconnected";this.connectionStarted=!1;this.options=t;this.onreceive=null;this.onclose=null}return n.prototype.start=function(n){return o(this,void 0,void 0,function(){var t;return e(this,function(i){switch(i.label){case 0:return(n=n||u.TransferFormat.Binary,f.Arg.isIn(n,u.TransferFormat,"transferFormat"),this.logger.log(r.LogLevel.Debug,"Starting connection with transfer format '"+u.TransferFormat[n]+"'."),this.connectionState!=="Disconnected")?[2,Promise.reject(new Error("Cannot start an HttpConnection that is not in the 'Disconnected' state."))]:(this.connectionState="Connecting ",this.startInternalPromise=this.startInternal(n),[4,this.startInternalPromise]);case 1:return(i.sent(),!(this.connectionState==="Disconnecting"))?[3,3]:(t="Failed to start the HttpConnection before stop() was called.",this.logger.log(r.LogLevel.Error,t),[4,this.stopPromise]);case 2:return i.sent(),[2,Promise.reject(new Error(t))];case 3:if(this.connectionState!=="Connected")return t="HttpConnection.startInternal completed gracefully but didn't enter the connection into the connected state!",this.logger.log(r.LogLevel.Error,t),[2,Promise.reject(new Error(t))];i.label=4;case 4:return this.connectionStarted=!0,[2]}})})},n.prototype.send=function(n){return this.connectionState!=="Connected"?Promise.reject(new Error("Cannot send data if the connection is not in the 'Connected' State.")):(this.sendQueue||(this.sendQueue=new a(this.transport)),this.sendQueue.send(n))},n.prototype.stop=function(n){return o(this,void 0,void 0,function(){var t=this;return e(this,function(i){switch(i.label){case 0:return this.connectionState==="Disconnected"?(this.logger.log(r.LogLevel.Debug,"Call to HttpConnection.stop("+n+") ignored because the connection is already in the disconnected state."),[2,Promise.resolve()]):this.connectionState==="Disconnecting"?(this.logger.log(r.LogLevel.Debug,"Call to HttpConnection.stop("+n+") ignored because the connection is already in the disconnecting state."),[2,this.stopPromise]):(this.connectionState="Disconnecting",this.stopPromise=new Promise(function(n){t.stopPromiseResolver=n}),[4,this.stopInternal(n)]);case 1:return i.sent(),[4,this.stopPromise];case 2:return i.sent(),[2]}})})},n.prototype.stopInternal=function(n){return o(this,void 0,void 0,function(){var i,t;return e(this,function(u){switch(u.label){case 0:this.stopError=n;u.label=1;case 1:return u.trys.push([1,3,,4]),[4,this.startInternalPromise];case 2:return u.sent(),[3,4];case 3:return i=u.sent(),[3,4];case 4:if(!this.transport)return[3,9];u.label=5;case 5:return u.trys.push([5,7,,8]),[4,this.transport.stop()];case 6:return u.sent(),[3,8];case 7:return t=u.sent(),this.logger.log(r.LogLevel.Error,"HttpConnection.transport.stop() threw error '"+t+"'."),this.stopConnection(),[3,8];case 8:return this.transport=undefined,[3,10];case 9:this.logger.log(r.LogLevel.Debug,"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.");this.stopConnection();u.label=10;case 10:return[2]}})})},n.prototype.startInternal=function(n){return o(this,void 0,void 0,function(){var i,t,o,h,f,s;return e(this,function(c){switch(c.label){case 0:i=this.baseUrl;this.accessTokenFactory=this.options.accessTokenFactory;c.label=1;case 1:return(c.trys.push([1,12,,13]),!this.options.skipNegotiation)?[3,5]:(this.options.transport===u.HttpTransportType.WebSockets)?(this.transport=this.constructTransport(u.HttpTransportType.WebSockets),[4,this.startTransport(i,n)]):[3,3];case 2:return c.sent(),[3,4];case 3:throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");case 4:return[3,11];case 5:t=null;o=0;h=function(){var n;return e(this,function(r){switch(r.label){case 0:return[4,f.getNegotiationResponse(i)];case 1:if(t=r.sent(),f.connectionState==="Disconnecting"||f.connectionState==="Disconnected")throw new Error("The connection was stopped during negotiation.");if(t.error)throw new Error(t.error);if(t.ProtocolVersion)throw new Error("Detected a connection attempt to an ASP.NET SignalR Server. This client only supports connecting to an ASP.NET Core SignalR Server. See https://aka.ms/signalr-core-differences for details.");return t.url&&(i=t.url),t.accessToken&&(n=t.accessToken,f.accessTokenFactory=function(){return n}),o++,[2]}})};f=this;c.label=6;case 6:return[5,h()];case 7:c.sent();c.label=8;case 8:if(t.url&&o<y)return[3,6];c.label=9;case 9:if(o===y&&t.url)throw new Error("Negotiate redirection limit exceeded.");return[4,this.createTransport(i,this.options.transport,t,n)];case 10:c.sent();c.label=11;case 11:return this.transport instanceof v.LongPollingTransport&&(this.features.inherentKeepAlive=!0),this.connectionState==="Connecting "&&(this.logger.log(r.LogLevel.Debug,"The HttpConnection connected successfully."),this.connectionState="Connected"),[3,13];case 12:return s=c.sent(),this.logger.log(r.LogLevel.Error,"Failed to start the connection: "+s),this.connectionState="Disconnected",this.transport=undefined,[2,Promise.reject(s)];case 13:return[2]}})})},n.prototype.getNegotiationResponse=function(n){return o(this,void 0,void 0,function(){var u,h,f,o,i,t,s;return e(this,function(e){switch(e.label){case 0:return this.accessTokenFactory?[4,this.accessTokenFactory()]:[3,2];case 1:f=e.sent();f&&(h=(u={},u.Authorization="Bearer "+f,u));e.label=2;case 2:o=this.resolveNegotiateUrl(n);this.logger.log(r.LogLevel.Debug,"Sending negotiation request: "+o+".");e.label=3;case 3:return e.trys.push([3,5,,6]),[4,this.httpClient.post(o,{content:"",headers:h})];case 4:return(i=e.sent(),i.statusCode!==200)?[2,Promise.reject(new Error("Unexpected status code returned from negotiate "+i.statusCode))]:(t=JSON.parse(i.content),(!t.negotiateVersion||t.negotiateVersion<1)&&(t.connectionToken=t.connectionId),[2,t]);case 5:return s=e.sent(),this.logger.log(r.LogLevel.Error,"Failed to complete negotiation with the server: "+s),[2,Promise.reject(s)];case 6:return[2]}})})},n.prototype.createConnectUrl=function(n,t){return t?n+(n.indexOf("?")===-1?"?":"&")+("id="+t):n},n.prototype.createTransport=function(n,t,i,u){return o(this,void 0,void 0,function(){var c,o,p,f,l,a,s,h,w,v,y;return e(this,function(e){switch(e.label){case 0:return(c=this.createConnectUrl(n,i.connectionToken),!this.isITransport(t))?[3,2]:(this.logger.log(r.LogLevel.Debug,"Connection was provided an instance of ITransport, using that directly."),this.transport=t,[4,this.startTransport(c,u)]);case 1:return e.sent(),this.connectionId=i.connectionId,[2];case 2:o=[];p=i.availableTransports||[];f=i;l=0;a=p;e.label=3;case 3:return(l<a.length)?(s=a[l],h=this.resolveTransportOrError(s,t,u),!(h instanceof Error))?[3,4]:(o.push(s.transport+" failed: "+h),[3,12]):[3,13];case 4:if(!this.isITransport(h))return[3,12];if(this.transport=h,!!f)return[3,9];e.label=5;case 5:return e.trys.push([5,7,,8]),[4,this.getNegotiationResponse(n)];case 6:return f=e.sent(),[3,8];case 7:return w=e.sent(),[2,Promise.reject(w)];case 8:c=this.createConnectUrl(n,f.connectionToken);e.label=9;case 9:return e.trys.push([9,11,,12]),[4,this.startTransport(c,u)];case 10:return e.sent(),this.connectionId=f.connectionId,[2];case 11:return(v=e.sent(),this.logger.log(r.LogLevel.Error,"Failed to start the transport '"+s.transport+"': "+v),f=undefined,o.push(s.transport+" failed: "+v),this.connectionState!=="Connecting ")?(y="Failed to select transport before stop() was called.",this.logger.log(r.LogLevel.Debug,y),[2,Promise.reject(new Error(y))]):[3,12];case 12:return l++,[3,3];case 13:return o.length>0?[2,Promise.reject(new Error("Unable to connect to the server with any of the available transports. "+o.join(" ")))]:[2,Promise.reject(new Error("None of the transports supported by the client are supported by the server."))]}})})},n.prototype.constructTransport=function(n){switch(n){case u.HttpTransportType.WebSockets:if(!this.options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new k.WebSocketTransport(this.httpClient,this.accessTokenFactory,this.logger,this.options.logMessageContent||!1,this.options.WebSocket);case u.HttpTransportType.ServerSentEvents:if(!this.options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new b.ServerSentEventsTransport(this.httpClient,this.accessTokenFactory,this.logger,this.options.logMessageContent||!1,this.options.EventSource);case u.HttpTransportType.LongPolling:return new v.LongPollingTransport(this.httpClient,this.accessTokenFactory,this.logger,this.options.logMessageContent||!1);default:throw new Error("Unknown transport: "+n+".");}},n.prototype.startTransport=function(n,t){var i=this;return this.transport.onreceive=this.onreceive,this.transport.onclose=function(n){return i.stopConnection(n)},this.transport.connect(n,t)},n.prototype.resolveTransportOrError=function(n,t,i){var f=u.HttpTransportType[n.transport],e;if(f===null||f===undefined)return this.logger.log(r.LogLevel.Debug,"Skipping transport '"+n.transport+"' because it is not supported by this client."),new Error("Skipping transport '"+n.transport+"' because it is not supported by this client.");if(d(t,f))if(e=n.transferFormats.map(function(n){return u.TransferFormat[n]}),e.indexOf(i)>=0)if((f!==u.HttpTransportType.WebSockets||this.options.WebSocket)&&(f!==u.HttpTransportType.ServerSentEvents||this.options.EventSource)){this.logger.log(r.LogLevel.Debug,"Selecting transport '"+u.HttpTransportType[f]+"'.");try{return this.constructTransport(f)}catch(o){return o}}else return this.logger.log(r.LogLevel.Debug,"Skipping transport '"+u.HttpTransportType[f]+"' because it is not supported in your environment.'"),new Error("'"+u.HttpTransportType[f]+"' is not supported in your environment.");else return this.logger.log(r.LogLevel.Debug,"Skipping transport '"+u.HttpTransportType[f]+"' because it does not support the requested transfer format '"+u.TransferFormat[i]+"'."),new Error("'"+u.HttpTransportType[f]+"' does not support "+u.TransferFormat[i]+".");else return this.logger.log(r.LogLevel.Debug,"Skipping transport '"+u.HttpTransportType[f]+"' because it was disabled by the client."),new Error("'"+u.HttpTransportType[f]+"' is disabled by the client.")},n.prototype.isITransport=function(n){return n&&typeof n=="object"&&"connect"in n},n.prototype.stopConnection=function(n){var t=this;if(this.logger.log(r.LogLevel.Debug,"HttpConnection.stopConnection("+n+") called while in state "+this.connectionState+"."),this.transport=undefined,n=this.stopError||n,this.stopError=undefined,this.connectionState==="Disconnected"){this.logger.log(r.LogLevel.Debug,"Call to HttpConnection.stopConnection("+n+") was ignored because the connection is already in the disconnected state.");return}if(this.connectionState==="Connecting "){this.logger.log(r.LogLevel.Warning,"Call to HttpConnection.stopConnection("+n+") was ignored because the connection hasn't yet left the in the connecting state.");return}if(this.connectionState==="Disconnecting"&&this.stopPromiseResolver(),n?this.logger.log(r.LogLevel.Error,"Connection disconnected with error '"+n+"'."):this.logger.log(r.LogLevel.Information,"Connection disconnected."),this.sendQueue&&(this.sendQueue.stop().catch(function(n){t.logger.log(r.LogLevel.Error,"TransportSendQueue.stop() threw error '"+n+"'.")}),this.sendQueue=undefined),this.connectionId=undefined,this.connectionState="Disconnected",this.connectionStarted){this.connectionStarted=!1;try{if(this.onclose)this.onclose(n)}catch(i){this.logger.log(r.LogLevel.Error,"HttpConnection.onclose("+n+") threw error '"+i+"'.")}}},n.prototype.resolveUrl=function(n){if(n.lastIndexOf("https://",0)===0||n.lastIndexOf("http://",0)===0)return n;if(!f.Platform.isBrowser||!window.document)throw new Error("Cannot resolve '"+n+"'.");var t=window.document.createElement("a");return t.href=n,this.logger.log(r.LogLevel.Information,"Normalizing '"+n+"' to '"+t.href+"'."),t.href},n.prototype.resolveNegotiateUrl=function(n){var i=n.indexOf("?"),t=n.substring(0,i===-1?n.length:i);return t[t.length-1]!=="/"&&(t+="/"),t+="negotiate",t+=i===-1?"":n.substring(i),t.indexOf("negotiateVersion")===-1&&(t+=i===-1?"?":"&",t+="negotiateVersion="+this.negotiateVersion),t},n}();a=function(){function n(n){this.transport=n;this.buffer=[];this.executing=!0;this.sendBufferedData=new s;this.transportResult=new s;this.sendLoopPromise=this.sendLoop()}return n.prototype.send=function(n){return this.bufferData(n),this.transportResult||(this.transportResult=new s),this.transportResult.promise},n.prototype.stop=function(){return this.executing=!1,this.sendBufferedData.resolve(),this.sendLoopPromise},n.prototype.bufferData=function(n){if(this.buffer.length&&typeof this.buffer[0]!=typeof n)throw new Error("Expected data to be of type "+typeof this.buffer+" but was of type "+typeof n);this.buffer.push(n);this.sendBufferedData.resolve()},n.prototype.sendLoop=function(){return o(this,void 0,void 0,function(){var t,i,r;return e(this,function(u){switch(u.label){case 0:return[4,this.sendBufferedData.promise];case 1:if(u.sent(),!this.executing)return this.transportResult&&this.transportResult.reject("Connection stopped."),[3,6];this.sendBufferedData=new s;t=this.transportResult;this.transportResult=undefined;i=typeof this.buffer[0]=="string"?this.buffer.join(""):n.concatBuffers(this.buffer);this.buffer.length=0;u.label=2;case 2:return u.trys.push([2,4,,5]),[4,this.transport.send(i)];case 3:return u.sent(),t.resolve(),[3,5];case 4:return r=u.sent(),t.reject(r),[3,5];case 5:return[3,0];case 6:return[2]}})})},n.concatBuffers=function(n){for(var i,e=n.map(function(n){return n.byteLength}).reduce(function(n,t){return n+t}),r=new Uint8Array(e),u=0,t=0,f=n;t<f.length;t++)i=f[t],r.set(new Uint8Array(i),u),u+=i.byteLength;return r},n}();s=function(){function n(){var n=this;this.promise=new Promise(function(t,i){var r;return r=[t,i],n.resolver=r[0],n.rejecter=r[1],r})}return n.prototype.resolve=function(){this.resolver()},n.prototype.reject=function(n){this.rejecter(n)},n}()},function(n,t,i){"use strict";var r,u;i.r(t);i.d(t,"HttpTransportType",function(){return r});i.d(t,"TransferFormat",function(){return u}),function(n){n[n.None=0]="None";n[n.WebSockets=1]="WebSockets";n[n.ServerSentEvents=2]="ServerSentEvents";n[n.LongPolling=4]="LongPolling"}(r||(r={})),function(n){n[n.Text=1]="Text";n[n.Binary=2]="Binary"}(u||(u={}))},function(n,t,i){"use strict";i.r(t);i.d(t,"LongPollingTransport",function(){return c});var h=i(22),o=i(4),r=i(9),s=i(20),u=i(13),f=undefined&&undefined.__awaiter||function(n,t,i,r){return new(i||(i=Promise))(function(u,f){function o(n){try{e(r.next(n))}catch(t){f(t)}}function s(n){try{e(r["throw"](n))}catch(t){f(t)}}function e(n){n.done?u(n.value):new i(function(t){t(n.value)}).then(o,s)}e((r=r.apply(n,t||[])).next())})},e=undefined&&undefined.__generator||function(n,t){function o(n){return function(t){return s([n,t])}}function s(e){if(f)throw new TypeError("Generator is already executing.");while(r)try{if(f=1,u&&(i=e[0]&2?u["return"]:e[0]?u["throw"]||((i=u["return"])&&i.call(u),0):u.next)&&!(i=i.call(u,e[1])).done)return i;(u=0,i)&&(e=[e[0]&2,i.value]);switch(e[0]){case 0:case 1:i=e;break;case 4:return r.label++,{value:e[1],done:!1};case 5:r.label++;u=e[1];e=[0];continue;case 7:e=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(e[0]===6||e[0]===2)){r=0;continue}if(e[0]===3&&(!i||e[1]>i[0]&&e[1]<i[3])){r.label=e[1];break}if(e[0]===6&&r.label<i[1]){r.label=i[1];i=e;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(e);break}i[2]&&r.ops.pop();r.trys.pop();continue}e=t.call(n,r)}catch(o){e=[6,o];u=0}finally{f=i=0}if(e[0]&5)throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},f,u,i,e;return e={next:o(0),"throw":o(1),"return":o(2)},typeof Symbol=="function"&&(e[Symbol.iterator]=function(){return this}),e},c=function(){function n(n,t,i,r){this.httpClient=n;this.accessTokenFactory=t;this.logger=i;this.pollAbort=new h.AbortController;this.logMessageContent=r;this.running=!1;this.onreceive=null;this.onclose=null}return Object.defineProperty(n.prototype,"pollAborted",{get:function(){return this.pollAbort.aborted},enumerable:!0,configurable:!0}),n.prototype.connect=function(n,t){return f(this,void 0,void 0,function(){var i,c,h,f;return e(this,function(e){switch(e.label){case 0:if(u.Arg.isRequired(n,"url"),u.Arg.isRequired(t,"transferFormat"),u.Arg.isIn(t,s.TransferFormat,"transferFormat"),this.url=n,this.logger.log(r.LogLevel.Trace,"(LongPolling transport) Connecting."),t===s.TransferFormat.Binary&&typeof XMLHttpRequest!="undefined"&&typeof(new XMLHttpRequest).responseType!="string")throw new Error("Binary protocols over XmlHttpRequest not implementing advanced features are not supported.");return i={abortSignal:this.pollAbort.signal,headers:{},timeout:1e5},t===s.TransferFormat.Binary&&(i.responseType="arraybuffer"),[4,this.getAccessToken()];case 1:return c=e.sent(),this.updateHeaderToken(i,c),h=n+"&_="+Date.now(),this.logger.log(r.LogLevel.Trace,"(LongPolling transport) polling: "+h+"."),[4,this.httpClient.get(h,i)];case 2:return f=e.sent(),f.statusCode!==200?(this.logger.log(r.LogLevel.Error,"(LongPolling transport) Unexpected response code: "+f.statusCode+"."),this.closeError=new o.HttpError(f.statusText||"",f.statusCode),this.running=!1):this.running=!0,this.receiving=this.poll(this.url,i),[2]}})})},n.prototype.getAccessToken=function(){return f(this,void 0,void 0,function(){return e(this,function(n){switch(n.label){case 0:return this.accessTokenFactory?[4,this.accessTokenFactory()]:[3,2];case 1:return[2,n.sent()];case 2:return[2,null]}})})},n.prototype.updateHeaderToken=function(n,t){if(n.headers||(n.headers={}),t){n.headers.Authorization="Bearer "+t;return}n.headers.Authorization&&delete n.headers.Authorization},n.prototype.poll=function(n,t){return f(this,void 0,void 0,function(){var h,s,i,f;return e(this,function(e){switch(e.label){case 0:e.trys.push([0,,8,9]);e.label=1;case 1:return this.running?[4,this.getAccessToken()]:[3,7];case 2:h=e.sent();this.updateHeaderToken(t,h);e.label=3;case 3:return e.trys.push([3,5,,6]),s=n+"&_="+Date.now(),this.logger.log(r.LogLevel.Trace,"(LongPolling transport) polling: "+s+"."),[4,this.httpClient.get(s,t)];case 4:if(i=e.sent(),i.statusCode===204)this.logger.log(r.LogLevel.Information,"(LongPolling transport) Poll terminated by server."),this.running=!1;else if(i.statusCode!==200)this.logger.log(r.LogLevel.Error,"(LongPolling transport) Unexpected response code: "+i.statusCode+"."),this.closeError=new o.HttpError(i.statusText||"",i.statusCode),this.running=!1;else if(i.content){if(this.logger.log(r.LogLevel.Trace,"(LongPolling transport) data received. "+Object(u.getDataDetail)(i.content,this.logMessageContent)+"."),this.onreceive)this.onreceive(i.content)}else this.logger.log(r.LogLevel.Trace,"(LongPolling transport) Poll timed out, reissuing.");return[3,6];case 5:return f=e.sent(),this.running?f instanceof o.TimeoutError?this.logger.log(r.LogLevel.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this.closeError=f,this.running=!1):this.logger.log(r.LogLevel.Trace,"(LongPolling transport) Poll errored after shutdown: "+f.message),[3,6];case 6:return[3,1];case 7:return[3,9];case 8:return this.logger.log(r.LogLevel.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this.raiseOnClose(),[7];case 9:return[2]}})})},n.prototype.send=function(n){return f(this,void 0,void 0,function(){return e(this,function(){return this.running?[2,Object(u.sendMessage)(this.logger,"LongPolling",this.httpClient,this.url,this.accessTokenFactory,n,this.logMessageContent)]:[2,Promise.reject(new Error("Cannot send until the transport is connected"))]})})},n.prototype.stop=function(){return f(this,void 0,void 0,function(){var n,t;return e(this,function(i){switch(i.label){case 0:this.logger.log(r.LogLevel.Trace,"(LongPolling transport) Stopping polling.");this.running=!1;this.pollAbort.abort();i.label=1;case 1:return i.trys.push([1,,5,6]),[4,this.receiving];case 2:return i.sent(),this.logger.log(r.LogLevel.Trace,"(LongPolling transport) sending DELETE request to "+this.url+"."),n={headers:{}},[4,this.getAccessToken()];case 3:return t=i.sent(),this.updateHeaderToken(n,t),[4,this.httpClient.delete(this.url,n)];case 4:return i.sent(),this.logger.log(r.LogLevel.Trace,"(LongPolling transport) DELETE request sent."),[3,6];case 5:return this.logger.log(r.LogLevel.Trace,"(LongPolling transport) Stop finished."),this.raiseOnClose(),[7];case 6:return[2]}})})},n.prototype.raiseOnClose=function(){if(this.onclose){var n="(LongPolling transport) Firing onclose event.";this.closeError&&(n+=" Error: "+this.closeError);this.logger.log(r.LogLevel.Trace,n);this.onclose(this.closeError)}},n}()},function(n,t,i){"use strict";i.r(t);i.d(t,"AbortController",function(){return r});var r=function(){function n(){this.isAborted=!1;this.onabort=null}return n.prototype.abort=function(){this.isAborted||(this.isAborted=!0,this.onabort&&this.onabort())},Object.defineProperty(n.prototype,"signal",{get:function(){return this},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"aborted",{get:function(){return this.isAborted},enumerable:!0,configurable:!0}),n}()},function(n,t,i){"use strict";i.r(t);i.d(t,"ServerSentEventsTransport",function(){return s});var u=i(9),f=i(20),r=i(13),e=undefined&&undefined.__awaiter||function(n,t,i,r){return new(i||(i=Promise))(function(u,f){function o(n){try{e(r.next(n))}catch(t){f(t)}}function s(n){try{e(r["throw"](n))}catch(t){f(t)}}function e(n){n.done?u(n.value):new i(function(t){t(n.value)}).then(o,s)}e((r=r.apply(n,t||[])).next())})},o=undefined&&undefined.__generator||function(n,t){function o(n){return function(t){return s([n,t])}}function s(e){if(f)throw new TypeError("Generator is already executing.");while(r)try{if(f=1,u&&(i=e[0]&2?u["return"]:e[0]?u["throw"]||((i=u["return"])&&i.call(u),0):u.next)&&!(i=i.call(u,e[1])).done)return i;(u=0,i)&&(e=[e[0]&2,i.value]);switch(e[0]){case 0:case 1:i=e;break;case 4:return r.label++,{value:e[1],done:!1};case 5:r.label++;u=e[1];e=[0];continue;case 7:e=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(e[0]===6||e[0]===2)){r=0;continue}if(e[0]===3&&(!i||e[1]>i[0]&&e[1]<i[3])){r.label=e[1];break}if(e[0]===6&&r.label<i[1]){r.label=i[1];i=e;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(e);break}i[2]&&r.ops.pop();r.trys.pop();continue}e=t.call(n,r)}catch(o){e=[6,o];u=0}finally{f=i=0}if(e[0]&5)throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},f,u,i,e;return e={next:o(0),"throw":o(1),"return":o(2)},typeof Symbol=="function"&&(e[Symbol.iterator]=function(){return this}),e},s=function(){function n(n,t,i,r,u){this.httpClient=n;this.accessTokenFactory=t;this.logger=i;this.logMessageContent=r;this.eventSourceConstructor=u;this.onreceive=null;this.onclose=null}return n.prototype.connect=function(n,t){return e(this,void 0,void 0,function(){var e,i=this;return o(this,function(o){switch(o.label){case 0:return(r.Arg.isRequired(n,"url"),r.Arg.isRequired(t,"transferFormat"),r.Arg.isIn(t,f.TransferFormat,"transferFormat"),this.logger.log(u.LogLevel.Trace,"(SSE transport) Connecting."),this.url=n,!this.accessTokenFactory)?[3,2]:[4,this.accessTokenFactory()];case 1:e=o.sent();e&&(n+=(n.indexOf("?")<0?"?":"&")+("access_token="+encodeURIComponent(e)));o.label=2;case 2:return[2,new Promise(function(e,o){var h=!1,s,c;if(t!==f.TransferFormat.Text){o(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"));return}r.Platform.isBrowser||r.Platform.isWebWorker?s=new i.eventSourceConstructor(n,{withCredentials:!0}):(c=i.httpClient.getCookieString(n),s=new i.eventSourceConstructor(n,{withCredentials:!0,headers:{Cookie:c}}));try{s.onmessage=function(n){if(i.onreceive)try{i.logger.log(u.LogLevel.Trace,"(SSE transport) data received. "+Object(r.getDataDetail)(n.data,i.logMessageContent)+".");i.onreceive(n.data)}catch(t){i.close(t);return}};s.onerror=function(n){var t=new Error(n.data||"Error occurred");h?i.close(t):o(t)};s.onopen=function(){i.logger.log(u.LogLevel.Information,"SSE connected to "+i.url);i.eventSource=s;h=!0;e()}}catch(l){o(l);return}})]}})})},n.prototype.send=function(n){return e(this,void 0,void 0,function(){return o(this,function(){return this.eventSource?[2,Object(r.sendMessage)(this.logger,"SSE",this.httpClient,this.url,this.accessTokenFactory,n,this.logMessageContent)]:[2,Promise.reject(new Error("Cannot send until the transport is connected"))]})})},n.prototype.stop=function(){return this.close(),Promise.resolve()},n.prototype.close=function(n){if(this.eventSource&&(this.eventSource.close(),this.eventSource=undefined,this.onclose))this.onclose(n)},n}()},function(n,t,i){"use strict";i.r(t);i.d(t,"WebSocketTransport",function(){return s});var u=i(9),f=i(20),r=i(13),e=undefined&&undefined.__awaiter||function(n,t,i,r){return new(i||(i=Promise))(function(u,f){function o(n){try{e(r.next(n))}catch(t){f(t)}}function s(n){try{e(r["throw"](n))}catch(t){f(t)}}function e(n){n.done?u(n.value):new i(function(t){t(n.value)}).then(o,s)}e((r=r.apply(n,t||[])).next())})},o=undefined&&undefined.__generator||function(n,t){function o(n){return function(t){return s([n,t])}}function s(e){if(f)throw new TypeError("Generator is already executing.");while(r)try{if(f=1,u&&(i=e[0]&2?u["return"]:e[0]?u["throw"]||((i=u["return"])&&i.call(u),0):u.next)&&!(i=i.call(u,e[1])).done)return i;(u=0,i)&&(e=[e[0]&2,i.value]);switch(e[0]){case 0:case 1:i=e;break;case 4:return r.label++,{value:e[1],done:!1};case 5:r.label++;u=e[1];e=[0];continue;case 7:e=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(e[0]===6||e[0]===2)){r=0;continue}if(e[0]===3&&(!i||e[1]>i[0]&&e[1]<i[3])){r.label=e[1];break}if(e[0]===6&&r.label<i[1]){r.label=i[1];i=e;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(e);break}i[2]&&r.ops.pop();r.trys.pop();continue}e=t.call(n,r)}catch(o){e=[6,o];u=0}finally{f=i=0}if(e[0]&5)throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},f,u,i,e;return e={next:o(0),"throw":o(1),"return":o(2)},typeof Symbol=="function"&&(e[Symbol.iterator]=function(){return this}),e},s=function(){function n(n,t,i,r,u){this.logger=i;this.accessTokenFactory=t;this.logMessageContent=r;this.webSocketConstructor=u;this.httpClient=n;this.onreceive=null;this.onclose=null}return n.prototype.connect=function(n,t){return e(this,void 0,void 0,function(){var e,i=this;return o(this,function(o){switch(o.label){case 0:return(r.Arg.isRequired(n,"url"),r.Arg.isRequired(t,"transferFormat"),r.Arg.isIn(t,f.TransferFormat,"transferFormat"),this.logger.log(u.LogLevel.Trace,"(WebSockets transport) Connecting."),!this.accessTokenFactory)?[3,2]:[4,this.accessTokenFactory()];case 1:e=o.sent();e&&(n+=(n.indexOf("?")<0?"?":"&")+("access_token="+encodeURIComponent(e)));o.label=2;case 2:return[2,new Promise(function(e,o){n=n.replace(/^http/,"ws");var s,h=i.httpClient.getCookieString(n),c=!1;r.Platform.isNode&&h&&(s=new i.webSocketConstructor(n,undefined,{headers:{Cookie:""+h}}));s||(s=new i.webSocketConstructor(n));t===f.TransferFormat.Binary&&(s.binaryType="arraybuffer");s.onopen=function(){i.logger.log(u.LogLevel.Information,"WebSocket connected to "+n+".");i.webSocket=s;c=!0;e()};s.onerror=function(n){var t=null;t=typeof ErrorEvent!="undefined"&&n instanceof ErrorEvent?n.error:new Error("There was an error with the transport.");o(t)};s.onmessage=function(n){if(i.logger.log(u.LogLevel.Trace,"(WebSockets transport) data received. "+Object(r.getDataDetail)(n.data,i.logMessageContent)+"."),i.onreceive)i.onreceive(n.data)};s.onclose=function(n){if(c)i.close(n);else{var t=null;t=typeof ErrorEvent!="undefined"&&n instanceof ErrorEvent?n.error:new Error("There was an error with the transport.");o(t)}}})]}})})},n.prototype.send=function(n){return this.webSocket&&this.webSocket.readyState===this.webSocketConstructor.OPEN?(this.logger.log(u.LogLevel.Trace,"(WebSockets transport) sending data. "+Object(r.getDataDetail)(n,this.logMessageContent)+"."),this.webSocket.send(n),Promise.resolve()):Promise.reject("WebSocket is not in the OPEN state")},n.prototype.stop=function(){return this.webSocket&&this.close(undefined),Promise.resolve()},n.prototype.close=function(n){if(this.webSocket&&(this.webSocket.onclose=function(){},this.webSocket.onmessage=function(){},this.webSocket.onerror=function(){},this.webSocket.close(),this.webSocket=undefined),this.logger.log(u.LogLevel.Trace,"(WebSockets transport) socket closed."),this.onclose)if(n&&(n.wasClean===!1||n.code!==1e3))this.onclose(new Error("WebSocket closed with status code: "+n.code+" ("+n.reason+")."));else this.onclose()},n}()},function(n,t,i){"use strict";i.r(t);i.d(t,"JsonHubProtocol",function(){return h});var r=i(15),f=i(9),e=i(20),o=i(14),u=i(12),s="json",h=function(){function n(){this.name=s;this.version=1;this.transferFormat=e.TransferFormat.Text}return n.prototype.parseMessages=function(n,t){var c,s,e,h,l,i;if(typeof n!="string")throw new Error("Invalid input for JSON hub protocol. Expected a string.");if(!n)return[];for(t===null&&(t=o.NullLogger.instance),c=u.TextMessageFormat.parse(n),s=[],e=0,h=c;e<h.length;e++){if(l=h[e],i=JSON.parse(l),typeof i.type!="number")throw new Error("Invalid payload.");switch(i.type){case r.MessageType.Invocation:this.isInvocationMessage(i);break;case r.MessageType.StreamItem:this.isStreamItemMessage(i);break;case r.MessageType.Completion:this.isCompletionMessage(i);break;case r.MessageType.Ping:break;case r.MessageType.Close:break;default:t.log(f.LogLevel.Information,"Unknown message type '"+i.type+"' ignored.");continue}s.push(i)}return s},n.prototype.writeMessage=function(n){return u.TextMessageFormat.write(JSON.stringify(n))},n.prototype.isInvocationMessage=function(n){this.assertNotEmptyString(n.target,"Invalid payload for Invocation message.");n.invocationId!==undefined&&this.assertNotEmptyString(n.invocationId,"Invalid payload for Invocation message.")},n.prototype.isStreamItemMessage=function(n){if(this.assertNotEmptyString(n.invocationId,"Invalid payload for StreamItem message."),n.item===undefined)throw new Error("Invalid payload for StreamItem message.");},n.prototype.isCompletionMessage=function(n){if(n.result&&n.error)throw new Error("Invalid payload for Completion message.");!n.result&&n.error&&this.assertNotEmptyString(n.error,"Invalid payload for Completion message.");this.assertNotEmptyString(n.invocationId,"Invalid payload for Completion message.")},n.prototype.assertNotEmptyString=function(n,t){if(typeof n!="string"||n==="")throw new Error(t);},n}()}])});
|