diff --git a/src/TypedSignalR.Client.DevTools.UI/EmbeddedResourcePathProvider.cs b/src/TypedSignalR.Client.DevTools.UI/EmbeddedResourcePathProvider.cs index d713c3d..9b6a7dd 100644 --- a/src/TypedSignalR.Client.DevTools.UI/EmbeddedResourcePathProvider.cs +++ b/src/TypedSignalR.Client.DevTools.UI/EmbeddedResourcePathProvider.cs @@ -13,17 +13,17 @@ internal static class EmbeddedResourcePathProvider "signalr-dev/404.html", "signalr-dev/index.html", "signalr-dev/spec-test.json", - "signalr-dev/_next/static/chunks/97-3247e2d57fb64c2a.js", - "signalr-dev/_next/static/chunks/framework-7751730b10fa0f74.js", - "signalr-dev/_next/static/chunks/main-19f18dac8026c78d.js", + "signalr-dev/_next/static/chunks/830-9d48ffa709498335.js", + "signalr-dev/_next/static/chunks/framework-2c79e2a64abdb08b.js", + "signalr-dev/_next/static/chunks/main-558fc47eb84446ba.js", "signalr-dev/_next/static/chunks/polyfills-c67a75d1b6f99dc8.js", - "signalr-dev/_next/static/chunks/webpack-8985bb90fc6ade1b.js", - "signalr-dev/_next/static/chunks/pages/index-fd63c8be9d9399e5.js", - "signalr-dev/_next/static/chunks/pages/_app-35c64dd111690593.js", - "signalr-dev/_next/static/chunks/pages/_error-e4f561a102d9bb14.js", - "signalr-dev/_next/static/css/276ae7c0387fc2e1.css", - "signalr-dev/_next/static/F8GCcZC0KAUzdlfCGpHhM/_buildManifest.js", - "signalr-dev/_next/static/F8GCcZC0KAUzdlfCGpHhM/_ssgManifest.js", + "signalr-dev/_next/static/chunks/webpack-e65c1d101fc3e111.js", + "signalr-dev/_next/static/chunks/pages/index-da9b02e27c214c1f.js", + "signalr-dev/_next/static/chunks/pages/_app-3fbddd7878bee85f.js", + "signalr-dev/_next/static/chunks/pages/_error-8353112a01355ec2.js", + "signalr-dev/_next/static/css/eecc0ebe6e775f93.css", + "signalr-dev/_next/static/EXbk27KQSM-qv6yzRb185/_buildManifest.js", + "signalr-dev/_next/static/EXbk27KQSM-qv6yzRb185/_ssgManifest.js", }; public static IReadOnlyList GetPaths() => _paths; diff --git a/src/TypedSignalR.Client.DevTools.UI/signalr-dev/404.html b/src/TypedSignalR.Client.DevTools.UI/signalr-dev/404.html index 53c1209..d345200 100644 --- a/src/TypedSignalR.Client.DevTools.UI/signalr-dev/404.html +++ b/src/TypedSignalR.Client.DevTools.UI/signalr-dev/404.html @@ -1,12 +1 @@ -404: This page could not be found

404

This page could not be found.

\ No newline at end of file +404: This page could not be found

404

This page could not be found.

\ No newline at end of file diff --git a/src/TypedSignalR.Client.DevTools.UI/signalr-dev/_next/static/EXbk27KQSM-qv6yzRb185/_buildManifest.js b/src/TypedSignalR.Client.DevTools.UI/signalr-dev/_next/static/EXbk27KQSM-qv6yzRb185/_buildManifest.js new file mode 100644 index 0000000..f450b84 --- /dev/null +++ b/src/TypedSignalR.Client.DevTools.UI/signalr-dev/_next/static/EXbk27KQSM-qv6yzRb185/_buildManifest.js @@ -0,0 +1 @@ +self.__BUILD_MANIFEST={__rewrites:{beforeFiles:[],afterFiles:[],fallback:[]},"/":["static/chunks/830-9d48ffa709498335.js","static/chunks/pages/index-da9b02e27c214c1f.js"],"/_error":["static/chunks/pages/_error-8353112a01355ec2.js"],sortedPages:["/","/_app","/_error"]},self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB(); \ No newline at end of file diff --git a/src/TypedSignalR.Client.DevTools.UI/signalr-dev/_next/static/F8GCcZC0KAUzdlfCGpHhM/_ssgManifest.js b/src/TypedSignalR.Client.DevTools.UI/signalr-dev/_next/static/EXbk27KQSM-qv6yzRb185/_ssgManifest.js similarity index 100% rename from src/TypedSignalR.Client.DevTools.UI/signalr-dev/_next/static/F8GCcZC0KAUzdlfCGpHhM/_ssgManifest.js rename to src/TypedSignalR.Client.DevTools.UI/signalr-dev/_next/static/EXbk27KQSM-qv6yzRb185/_ssgManifest.js diff --git a/src/TypedSignalR.Client.DevTools.UI/signalr-dev/_next/static/F8GCcZC0KAUzdlfCGpHhM/_buildManifest.js b/src/TypedSignalR.Client.DevTools.UI/signalr-dev/_next/static/F8GCcZC0KAUzdlfCGpHhM/_buildManifest.js deleted file mode 100644 index 49b0179..0000000 --- a/src/TypedSignalR.Client.DevTools.UI/signalr-dev/_next/static/F8GCcZC0KAUzdlfCGpHhM/_buildManifest.js +++ /dev/null @@ -1 +0,0 @@ -self.__BUILD_MANIFEST={__rewrites:{beforeFiles:[],afterFiles:[],fallback:[]},"/":["static/chunks/97-3247e2d57fb64c2a.js","static/chunks/pages/index-fd63c8be9d9399e5.js"],"/_error":["static/chunks/pages/_error-e4f561a102d9bb14.js"],sortedPages:["/","/_app","/_error"]},self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB(); \ No newline at end of file diff --git a/src/TypedSignalR.Client.DevTools.UI/signalr-dev/_next/static/chunks/830-9d48ffa709498335.js b/src/TypedSignalR.Client.DevTools.UI/signalr-dev/_next/static/chunks/830-9d48ffa709498335.js new file mode 100644 index 0000000..215b71f --- /dev/null +++ b/src/TypedSignalR.Client.DevTools.UI/signalr-dev/_next/static/chunks/830-9d48ffa709498335.js @@ -0,0 +1 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[830],{7830:function(t,e,o){"use strict";o.d(e,{s:function(){return z}});let n=[0,2e3,1e4,3e4,null];class r{constructor(t){this._retryDelays=void 0!==t?[...t,null]:n}nextRetryDelayInMilliseconds(t){return this._retryDelays[t.previousRetryCount]}}class i{}i.Authorization="Authorization",i.Cookie="Cookie";class s{constructor(t,e,o){this.statusCode=t,this.statusText=e,this.content=o}}class a{get(t,e){return this.send({...e,method:"GET",url:t})}post(t,e){return this.send({...e,method:"POST",url:t})}delete(t,e){return this.send({...e,method:"DELETE",url:t})}getCookieString(t){return""}}class c extends a{constructor(t,e){super(),this._innerClient=t,this._accessTokenFactory=e}async send(t){let e=!0;this._accessTokenFactory&&(!this._accessToken||t.url&&t.url.indexOf("/negotiate?")>0)&&(e=!1,this._accessToken=await this._accessTokenFactory()),this._setAuthorizationHeader(t);let o=await this._innerClient.send(t);return e&&401===o.statusCode&&this._accessTokenFactory?(this._accessToken=await this._accessTokenFactory(),this._setAuthorizationHeader(t),await this._innerClient.send(t)):o}_setAuthorizationHeader(t){t.headers||(t.headers={}),this._accessToken?t.headers[i.Authorization]=`Bearer ${this._accessToken}`:this._accessTokenFactory&&t.headers[i.Authorization]&&delete t.headers[i.Authorization]}getCookieString(t){return this._innerClient.getCookieString(t)}}class l extends Error{constructor(t,e){let o=new.target.prototype;super(`${t}: Status code '${e}'`),this.statusCode=e,this.__proto__=o}}class h extends Error{constructor(t="A timeout occurred."){let e=new.target.prototype;super(t),this.__proto__=e}}class u extends Error{constructor(t="An abort occurred."){let e=new.target.prototype;super(t),this.__proto__=e}}class g extends Error{constructor(t,e){let o=new.target.prototype;super(t),this.transport=e,this.errorType="UnsupportedTransportError",this.__proto__=o}}class d extends Error{constructor(t,e){let o=new.target.prototype;super(t),this.transport=e,this.errorType="DisabledTransportError",this.__proto__=o}}class p extends Error{constructor(t,e){let o=new.target.prototype;super(t),this.transport=e,this.errorType="FailedToStartTransportError",this.__proto__=o}}class _ extends Error{constructor(t){let e=new.target.prototype;super(t),this.errorType="FailedToNegotiateWithServerError",this.__proto__=e}}class f extends Error{constructor(t,e){let o=new.target.prototype;super(t),this.innerErrors=e,this.__proto__=o}}var m,b,v,w,y,C,S,k,E=o(239),T=o(7968);class I extends a{constructor(t){if(super(),this._logger=t,"undefined"==typeof fetch){let t=require;this._jar=new(t("tough-cookie")).CookieJar,this._fetchType=t("node-fetch"),this._fetchType=t("fetch-cookie")(this._fetchType,this._jar)}else this._fetchType=fetch.bind((0,T.E9)());if("undefined"==typeof AbortController){let t=require;this._abortControllerType=t("abort-controller")}else this._abortControllerType=AbortController}async send(t){let e,o;if(t.abortSignal&&t.abortSignal.aborted)throw new u;if(!t.method)throw Error("No method defined.");if(!t.url)throw Error("No url defined.");let n=new this._abortControllerType;t.abortSignal&&(t.abortSignal.onabort=()=>{n.abort(),e=new u});let r=null;if(t.timeout){let o=t.timeout;r=setTimeout(()=>{n.abort(),this._logger.log(E.i.Warning,"Timeout from HTTP request."),e=new h},o)}""===t.content&&(t.content=void 0),t.content&&(t.headers=t.headers||{},(0,T.eP)(t.content)?t.headers["Content-Type"]="application/octet-stream":t.headers["Content-Type"]="text/plain;charset=UTF-8");try{o=await this._fetchType(t.url,{body:t.content,cache:"no-cache",credentials:!0===t.withCredentials?"include":"same-origin",headers:{"X-Requested-With":"XMLHttpRequest",...t.headers},method:t.method,mode:"cors",redirect:"follow",signal:n.signal})}catch(t){if(e)throw e;throw this._logger.log(E.i.Warning,`Error from HTTP request. ${t}.`),t}finally{r&&clearTimeout(r),t.abortSignal&&(t.abortSignal.onabort=null)}if(!o.ok){let t=await P(o,"text");throw new l(t||o.statusText,o.status)}let i=P(o,t.responseType),a=await i;return new s(o.status,o.statusText,a)}getCookieString(t){let e="";return T.t4.isNode&&this._jar&&this._jar.getCookies(t,(t,o)=>e=o.join("; ")),e}}function P(t,e){let o;switch(e){case"arraybuffer":o=t.arrayBuffer();break;case"text":default:o=t.text();break;case"blob":case"document":case"json":throw Error(`${e} is not supported.`)}return o}class $ extends a{constructor(t){super(),this._logger=t}send(t){return t.abortSignal&&t.abortSignal.aborted?Promise.reject(new u):t.method?t.url?new Promise((e,o)=>{let n=new XMLHttpRequest;n.open(t.method,t.url,!0),n.withCredentials=void 0===t.withCredentials||t.withCredentials,n.setRequestHeader("X-Requested-With","XMLHttpRequest"),""===t.content&&(t.content=void 0),t.content&&((0,T.eP)(t.content)?n.setRequestHeader("Content-Type","application/octet-stream"):n.setRequestHeader("Content-Type","text/plain;charset=UTF-8"));let r=t.headers;r&&Object.keys(r).forEach(t=>{n.setRequestHeader(t,r[t])}),t.responseType&&(n.responseType=t.responseType),t.abortSignal&&(t.abortSignal.onabort=()=>{n.abort(),o(new u)}),t.timeout&&(n.timeout=t.timeout),n.onload=()=>{t.abortSignal&&(t.abortSignal.onabort=null),n.status>=200&&n.status<300?e(new s(n.status,n.statusText,n.response||n.responseText)):o(new l(n.response||n.responseText||n.statusText,n.status))},n.onerror=()=>{this._logger.log(E.i.Warning,`Error from HTTP request. ${n.status}: ${n.statusText}.`),o(new l(n.statusText,n.status))},n.ontimeout=()=>{this._logger.log(E.i.Warning,"Timeout from HTTP request."),o(new h)},n.send(t.content)}):Promise.reject(Error("No url defined.")):Promise.reject(Error("No method defined."))}}class D extends a{constructor(t){if(super(),"undefined"!=typeof fetch||T.t4.isNode)this._httpClient=new I(t);else if("undefined"!=typeof XMLHttpRequest)this._httpClient=new $(t);else throw Error("No usable HttpClient found.")}send(t){return t.abortSignal&&t.abortSignal.aborted?Promise.reject(new u):t.method?t.url?this._httpClient.send(t):Promise.reject(Error("No url defined.")):Promise.reject(Error("No method defined."))}getCookieString(t){return this._httpClient.getCookieString(t)}}(m=y||(y={}))[m.None=0]="None",m[m.WebSockets=1]="WebSockets",m[m.ServerSentEvents=2]="ServerSentEvents",m[m.LongPolling=4]="LongPolling",(b=C||(C={}))[b.Text=1]="Text",b[b.Binary=2]="Binary";class R{constructor(){this._isAborted=!1,this.onabort=null}abort(){!this._isAborted&&(this._isAborted=!0,this.onabort&&this.onabort())}get signal(){return this}get aborted(){return this._isAborted}}class x{constructor(t,e,o){this._httpClient=t,this._logger=e,this._pollAbort=new R,this._options=o,this._running=!1,this.onreceive=null,this.onclose=null}get pollAborted(){return this._pollAbort.aborted}async connect(t,e){if(T.j7.isRequired(t,"url"),T.j7.isRequired(e,"transferFormat"),T.j7.isIn(e,C,"transferFormat"),this._url=t,this._logger.log(E.i.Trace,"(LongPolling transport) Connecting."),e===C.Binary&&"undefined"!=typeof XMLHttpRequest&&"string"!=typeof new XMLHttpRequest().responseType)throw Error("Binary protocols over XmlHttpRequest not implementing advanced features are not supported.");let[o,n]=(0,T.hS)(),r={[o]:n,...this._options.headers},i={abortSignal:this._pollAbort.signal,headers:r,timeout:1e5,withCredentials:this._options.withCredentials};e===C.Binary&&(i.responseType="arraybuffer");let s=`${t}&_=${Date.now()}`;this._logger.log(E.i.Trace,`(LongPolling transport) polling: ${s}.`);let a=await this._httpClient.get(s,i);200!==a.statusCode?(this._logger.log(E.i.Error,`(LongPolling transport) Unexpected response code: ${a.statusCode}.`),this._closeError=new l(a.statusText||"",a.statusCode),this._running=!1):this._running=!0,this._receiving=this._poll(this._url,i)}async _poll(t,e){try{for(;this._running;)try{let o=`${t}&_=${Date.now()}`;this._logger.log(E.i.Trace,`(LongPolling transport) polling: ${o}.`);let n=await this._httpClient.get(o,e);204===n.statusCode?(this._logger.log(E.i.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):200!==n.statusCode?(this._logger.log(E.i.Error,`(LongPolling transport) Unexpected response code: ${n.statusCode}.`),this._closeError=new l(n.statusText||"",n.statusCode),this._running=!1):n.content?(this._logger.log(E.i.Trace,`(LongPolling transport) data received. ${(0,T.o4)(n.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(n.content)):this._logger.log(E.i.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(t){this._running?t instanceof h?this._logger.log(E.i.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=t,this._running=!1):this._logger.log(E.i.Trace,`(LongPolling transport) Poll errored after shutdown: ${t.message}`)}}finally{this._logger.log(E.i.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}}async send(t){return this._running?(0,T.bG)(this._logger,"LongPolling",this._httpClient,this._url,t,this._options):Promise.reject(Error("Cannot send until the transport is connected"))}async stop(){this._logger.log(E.i.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{await this._receiving,this._logger.log(E.i.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);let t={},[e,o]=(0,T.hS)();t[e]=o;let n={headers:{...t,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials};await this._httpClient.delete(this._url,n),this._logger.log(E.i.Trace,"(LongPolling transport) DELETE request sent.")}finally{this._logger.log(E.i.Trace,"(LongPolling transport) Stop finished."),this._raiseOnClose()}}_raiseOnClose(){if(this.onclose){let t="(LongPolling transport) Firing onclose event.";this._closeError&&(t+=" Error: "+this._closeError),this._logger.log(E.i.Trace,t),this.onclose(this._closeError)}}}class H{constructor(t,e,o,n){this._httpClient=t,this._accessToken=e,this._logger=o,this._options=n,this.onreceive=null,this.onclose=null}async connect(t,e){return T.j7.isRequired(t,"url"),T.j7.isRequired(e,"transferFormat"),T.j7.isIn(e,C,"transferFormat"),this._logger.log(E.i.Trace,"(SSE transport) Connecting."),this._url=t,this._accessToken&&(t+=(0>t.indexOf("?")?"?":"&")+`access_token=${encodeURIComponent(this._accessToken)}`),new Promise((o,n)=>{let r,i=!1;if(e!==C.Text){n(Error("The Server-Sent Events transport only supports the 'Text' transfer format"));return}if(T.t4.isBrowser||T.t4.isWebWorker)r=new this._options.EventSource(t,{withCredentials:this._options.withCredentials});else{let e=this._httpClient.getCookieString(t),o={};o.Cookie=e;let[n,i]=(0,T.hS)();o[n]=i,r=new this._options.EventSource(t,{withCredentials:this._options.withCredentials,headers:{...o,...this._options.headers}})}try{r.onmessage=t=>{if(this.onreceive)try{this._logger.log(E.i.Trace,`(SSE transport) data received. ${(0,T.o4)(t.data,this._options.logMessageContent)}.`),this.onreceive(t.data)}catch(t){this._close(t);return}},r.onerror=t=>{i?this._close():n(Error("EventSource failed to connect. The connection could not be found on the server, either the connection ID is not present on the server, or a proxy is refusing/buffering the connection. If you have multiple servers check that sticky sessions are enabled."))},r.onopen=()=>{this._logger.log(E.i.Information,`SSE connected to ${this._url}`),this._eventSource=r,i=!0,o()}}catch(t){n(t);return}})}async send(t){return this._eventSource?(0,T.bG)(this._logger,"SSE",this._httpClient,this._url,t,this._options):Promise.reject(Error("Cannot send until the transport is connected"))}stop(){return this._close(),Promise.resolve()}_close(t){this._eventSource&&(this._eventSource.close(),this._eventSource=void 0,this.onclose&&this.onclose(t))}}class j{constructor(t,e,o,n,r,i){this._logger=o,this._accessTokenFactory=e,this._logMessageContent=n,this._webSocketConstructor=r,this._httpClient=t,this.onreceive=null,this.onclose=null,this._headers=i}async connect(t,e){let o;return T.j7.isRequired(t,"url"),T.j7.isRequired(e,"transferFormat"),T.j7.isIn(e,C,"transferFormat"),this._logger.log(E.i.Trace,"(WebSockets transport) Connecting."),this._accessTokenFactory&&(o=await this._accessTokenFactory()),new Promise((n,r)=>{let s;t=t.replace(/^http/,"ws");let a=this._httpClient.getCookieString(t),c=!1;if(T.t4.isNode||T.t4.isReactNative){let e={},[n,r]=(0,T.hS)();e[n]=r,o&&(e[i.Authorization]=`Bearer ${o}`),a&&(e[i.Cookie]=a),s=new this._webSocketConstructor(t,void 0,{headers:{...e,...this._headers}})}else o&&(t+=(0>t.indexOf("?")?"?":"&")+`access_token=${encodeURIComponent(o)}`);s||(s=new this._webSocketConstructor(t)),e===C.Binary&&(s.binaryType="arraybuffer"),s.onopen=e=>{this._logger.log(E.i.Information,`WebSocket connected to ${t}.`),this._webSocket=s,c=!0,n()},s.onerror=t=>{let e=null;e="undefined"!=typeof ErrorEvent&&t instanceof ErrorEvent?t.error:"There was an error with the transport",this._logger.log(E.i.Information,`(WebSockets transport) ${e}.`)},s.onmessage=t=>{if(this._logger.log(E.i.Trace,`(WebSockets transport) data received. ${(0,T.o4)(t.data,this._logMessageContent)}.`),this.onreceive)try{this.onreceive(t.data)}catch(t){this._close(t);return}},s.onclose=t=>{c?this._close(t):r(Error("undefined"!=typeof ErrorEvent&&t instanceof ErrorEvent?t.error:"WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled."))}})}send(t){return this._webSocket&&this._webSocket.readyState===this._webSocketConstructor.OPEN?(this._logger.log(E.i.Trace,`(WebSockets transport) sending data. ${(0,T.o4)(t,this._logMessageContent)}.`),this._webSocket.send(t),Promise.resolve()):Promise.reject("WebSocket is not in the OPEN state")}stop(){return this._webSocket&&this._close(void 0),Promise.resolve()}_close(t){this._webSocket&&(this._webSocket.onclose=()=>{},this._webSocket.onmessage=()=>{},this._webSocket.onerror=()=>{},this._webSocket.close(),this._webSocket=void 0),this._logger.log(E.i.Trace,"(WebSockets transport) socket closed."),this.onclose&&(this._isCloseEvent(t)&&(!1===t.wasClean||1e3!==t.code)?this.onclose(Error(`WebSocket closed with status code: ${t.code} (${t.reason||"no reason given"}).`)):t instanceof Error?this.onclose(t):this.onclose())}_isCloseEvent(t){return t&&"boolean"==typeof t.wasClean&&"number"==typeof t.code}}class W{constructor(t,e={}){if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,T.j7.isRequired(t,"url"),this._logger=(0,T.hu)(e.logger),this.baseUrl=this._resolveUrl(t),(e=e||{}).logMessageContent=void 0!==e.logMessageContent&&e.logMessageContent,"boolean"==typeof e.withCredentials||void 0===e.withCredentials)e.withCredentials=void 0===e.withCredentials||e.withCredentials;else throw Error("withCredentials option was not a 'boolean' or 'undefined' value");e.timeout=void 0===e.timeout?1e5:e.timeout;let o=null,n=null;if(T.t4.isNode){let t=require;o=t("ws"),n=t("eventsource")}T.t4.isNode||"undefined"==typeof WebSocket||e.WebSocket?T.t4.isNode&&!e.WebSocket&&o&&(e.WebSocket=o):e.WebSocket=WebSocket,T.t4.isNode||"undefined"==typeof EventSource||e.EventSource?T.t4.isNode&&!e.EventSource&&void 0!==n&&(e.EventSource=n):e.EventSource=EventSource,this._httpClient=new c(e.httpClient||new D(this._logger),e.accessTokenFactory),this._connectionState="Disconnected",this._connectionStarted=!1,this._options=e,this.onreceive=null,this.onclose=null}async start(t){if(t=t||C.Binary,T.j7.isIn(t,C,"transferFormat"),this._logger.log(E.i.Debug,`Starting connection with transfer format '${C[t]}'.`),"Disconnected"!==this._connectionState)return Promise.reject(Error("Cannot start an HttpConnection that is not in the 'Disconnected' state."));if(this._connectionState="Connecting",this._startInternalPromise=this._startInternal(t),await this._startInternalPromise,"Disconnecting"===this._connectionState){let t="Failed to start the HttpConnection before stop() was called.";return this._logger.log(E.i.Error,t),await this._stopPromise,Promise.reject(new u(t))}if("Connected"!==this._connectionState){let t="HttpConnection.startInternal completed gracefully but didn't enter the connection into the connected state!";return this._logger.log(E.i.Error,t),Promise.reject(new u(t))}this._connectionStarted=!0}send(t){return"Connected"!==this._connectionState?Promise.reject(Error("Cannot send data if the connection is not in the 'Connected' State.")):(this._sendQueue||(this._sendQueue=new N(this.transport)),this._sendQueue.send(t))}async stop(t){return"Disconnected"===this._connectionState?(this._logger.log(E.i.Debug,`Call to HttpConnection.stop(${t}) ignored because the connection is already in the disconnected state.`),Promise.resolve()):"Disconnecting"===this._connectionState?(this._logger.log(E.i.Debug,`Call to HttpConnection.stop(${t}) ignored because the connection is already in the disconnecting state.`),this._stopPromise):void(this._connectionState="Disconnecting",this._stopPromise=new Promise(t=>{this._stopPromiseResolver=t}),await this._stopInternal(t),await this._stopPromise)}async _stopInternal(t){this._stopError=t;try{await this._startInternalPromise}catch(t){}if(this.transport){try{await this.transport.stop()}catch(t){this._logger.log(E.i.Error,`HttpConnection.transport.stop() threw error '${t}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(E.i.Debug,"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.")}async _startInternal(t){let e=this.baseUrl;this._accessTokenFactory=this._options.accessTokenFactory,this._httpClient._accessTokenFactory=this._accessTokenFactory;try{if(this._options.skipNegotiation){if(this._options.transport===y.WebSockets)this.transport=this._constructTransport(y.WebSockets),await this._startTransport(e,t);else throw Error("Negotiation can only be skipped when using the WebSocket transport directly.")}else{let o=null,n=0;do{if(o=await this._getNegotiationResponse(e),"Disconnecting"===this._connectionState||"Disconnected"===this._connectionState)throw new u("The connection was stopped during negotiation.");if(o.error)throw Error(o.error);if(o.ProtocolVersion)throw 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.");if(o.url&&(e=o.url),o.accessToken){let t=o.accessToken;this._accessTokenFactory=()=>t,this._httpClient._accessToken=t,this._httpClient._accessTokenFactory=void 0}n++}while(o.url&&n<100);if(100===n&&o.url)throw Error("Negotiate redirection limit exceeded.");await this._createTransport(e,this._options.transport,o,t)}this.transport instanceof x&&(this.features.inherentKeepAlive=!0),"Connecting"===this._connectionState&&(this._logger.log(E.i.Debug,"The HttpConnection connected successfully."),this._connectionState="Connected")}catch(t){return this._logger.log(E.i.Error,"Failed to start the connection: "+t),this._connectionState="Disconnected",this.transport=void 0,this._stopPromiseResolver(),Promise.reject(t)}}async _getNegotiationResponse(t){let e={},[o,n]=(0,T.hS)();e[o]=n;let r=this._resolveNegotiateUrl(t);this._logger.log(E.i.Debug,`Sending negotiation request: ${r}.`);try{let t=await this._httpClient.post(r,{content:"",headers:{...e,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials});if(200!==t.statusCode)return Promise.reject(Error(`Unexpected status code returned from negotiate '${t.statusCode}'`));let o=JSON.parse(t.content);return(!o.negotiateVersion||o.negotiateVersion<1)&&(o.connectionToken=o.connectionId),o}catch(e){let t="Failed to complete negotiation with the server: "+e;return e instanceof l&&404===e.statusCode&&(t+=" Either this is not a SignalR endpoint or there is a proxy blocking the connection."),this._logger.log(E.i.Error,t),Promise.reject(new _(t))}}_createConnectUrl(t,e){return e?t+(-1===t.indexOf("?")?"?":"&")+`id=${e}`:t}async _createTransport(t,e,o,n){let r=this._createConnectUrl(t,o.connectionToken);if(this._isITransport(e)){this._logger.log(E.i.Debug,"Connection was provided an instance of ITransport, using that directly."),this.transport=e,await this._startTransport(r,n),this.connectionId=o.connectionId;return}let i=[],s=o.availableTransports||[],a=o;for(let o of s){let s=this._resolveTransportOrError(o,e,n);if(s instanceof Error)i.push(`${o.transport} failed:`),i.push(s);else if(this._isITransport(s)){if(this.transport=s,!a){try{a=await this._getNegotiationResponse(t)}catch(t){return Promise.reject(t)}r=this._createConnectUrl(t,a.connectionToken)}try{await this._startTransport(r,n),this.connectionId=a.connectionId;return}catch(t){if(this._logger.log(E.i.Error,`Failed to start the transport '${o.transport}': ${t}`),a=void 0,i.push(new p(`${o.transport} failed: ${t}`,y[o.transport])),"Connecting"!==this._connectionState){let t="Failed to select transport before stop() was called.";return this._logger.log(E.i.Debug,t),Promise.reject(new u(t))}}}}return i.length>0?Promise.reject(new f(`Unable to connect to the server with any of the available transports. ${i.join(" ")}`,i)):Promise.reject(Error("None of the transports supported by the client are supported by the server."))}_constructTransport(t){switch(t){case y.WebSockets:if(!this._options.WebSocket)throw Error("'WebSocket' is not supported in your environment.");return new j(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case y.ServerSentEvents:if(!this._options.EventSource)throw Error("'EventSource' is not supported in your environment.");return new H(this._httpClient,this._httpClient._accessToken,this._logger,this._options);case y.LongPolling:return new x(this._httpClient,this._logger,this._options);default:throw Error(`Unknown transport: ${t}.`)}}_startTransport(t,e){return this.transport.onreceive=this.onreceive,this.transport.onclose=t=>this._stopConnection(t),this.transport.connect(t,e)}_resolveTransportOrError(t,e,o){let n=y[t.transport];if(null==n)return this._logger.log(E.i.Debug,`Skipping transport '${t.transport}' because it is not supported by this client.`),Error(`Skipping transport '${t.transport}' because it is not supported by this client.`);if(e&&(n&e)==0)return this._logger.log(E.i.Debug,`Skipping transport '${y[n]}' because it was disabled by the client.`),new d(`'${y[n]}' is disabled by the client.`,n);{let e=t.transferFormats.map(t=>C[t]);if(!(e.indexOf(o)>=0))return this._logger.log(E.i.Debug,`Skipping transport '${y[n]}' because it does not support the requested transfer format '${C[o]}'.`),Error(`'${y[n]}' does not support ${C[o]}.`);if(n===y.WebSockets&&!this._options.WebSocket||n===y.ServerSentEvents&&!this._options.EventSource)return this._logger.log(E.i.Debug,`Skipping transport '${y[n]}' because it is not supported in your environment.'`),new g(`'${y[n]}' is not supported in your environment.`,n);this._logger.log(E.i.Debug,`Selecting transport '${y[n]}'.`);try{return this._constructTransport(n)}catch(t){return t}}}_isITransport(t){return t&&"object"==typeof t&&"connect"in t}_stopConnection(t){if(this._logger.log(E.i.Debug,`HttpConnection.stopConnection(${t}) called while in state ${this._connectionState}.`),this.transport=void 0,t=this._stopError||t,this._stopError=void 0,"Disconnected"===this._connectionState){this._logger.log(E.i.Debug,`Call to HttpConnection.stopConnection(${t}) was ignored because the connection is already in the disconnected state.`);return}if("Connecting"===this._connectionState)throw this._logger.log(E.i.Warning,`Call to HttpConnection.stopConnection(${t}) was ignored because the connection is still in the connecting state.`),Error(`HttpConnection.stopConnection(${t}) was called while the connection is still in the connecting state.`);if("Disconnecting"===this._connectionState&&this._stopPromiseResolver(),t?this._logger.log(E.i.Error,`Connection disconnected with error '${t}'.`):this._logger.log(E.i.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch(t=>{this._logger.log(E.i.Error,`TransportSendQueue.stop() threw error '${t}'.`)}),this._sendQueue=void 0),this.connectionId=void 0,this._connectionState="Disconnected",this._connectionStarted){this._connectionStarted=!1;try{this.onclose&&this.onclose(t)}catch(e){this._logger.log(E.i.Error,`HttpConnection.onclose(${t}) threw error '${e}'.`)}}}_resolveUrl(t){if(0===t.lastIndexOf("https://",0)||0===t.lastIndexOf("http://",0))return t;if(!T.t4.isBrowser)throw Error(`Cannot resolve '${t}'.`);let e=window.document.createElement("a");return e.href=t,this._logger.log(E.i.Information,`Normalizing '${t}' to '${e.href}'.`),e.href}_resolveNegotiateUrl(t){let e=t.indexOf("?"),o=t.substring(0,-1===e?t.length:e);return"/"!==o[o.length-1]&&(o+="/"),-1===(o+="negotiate"+(-1===e?"":t.substring(e))).indexOf("negotiateVersion")&&(o+=(-1===e?"?":"&")+"negotiateVersion="+this._negotiateVersion),o}}class N{constructor(t){this._transport=t,this._buffer=[],this._executing=!0,this._sendBufferedData=new M,this._transportResult=new M,this._sendLoopPromise=this._sendLoop()}send(t){return this._bufferData(t),this._transportResult||(this._transportResult=new M),this._transportResult.promise}stop(){return this._executing=!1,this._sendBufferedData.resolve(),this._sendLoopPromise}_bufferData(t){if(this._buffer.length&&typeof this._buffer[0]!=typeof t)throw Error(`Expected data to be of type ${typeof this._buffer} but was of type ${typeof t}`);this._buffer.push(t),this._sendBufferedData.resolve()}async _sendLoop(){for(;;){if(await this._sendBufferedData.promise,!this._executing){this._transportResult&&this._transportResult.reject("Connection stopped.");break}this._sendBufferedData=new M;let t=this._transportResult;this._transportResult=void 0;let e="string"==typeof this._buffer[0]?this._buffer.join(""):N._concatBuffers(this._buffer);this._buffer.length=0;try{await this._transport.send(e),t.resolve()}catch(e){t.reject(e)}}}static _concatBuffers(t){let e=t.map(t=>t.byteLength).reduce((t,e)=>t+e),o=new Uint8Array(e),n=0;for(let e of t)o.set(new Uint8Array(e),n),n+=e.byteLength;return o.buffer}}class M{constructor(){this.promise=new Promise((t,e)=>([this._resolver,this._rejecter]=[t,e]))}resolve(){this._resolver()}reject(t){this._rejecter(t)}}class A{static write(t){return`${t}${A.RecordSeparator}`}static parse(t){if(t[t.length-1]!==A.RecordSeparator)throw Error("Message is incomplete.");let e=t.split(A.RecordSeparator);return e.pop(),e}}A.RecordSeparatorCode=30,A.RecordSeparator=String.fromCharCode(A.RecordSeparatorCode);class L{writeHandshakeRequest(t){return A.write(JSON.stringify(t))}parseHandshakeResponse(t){let e,o;if((0,T.eP)(t)){let n=new Uint8Array(t),r=n.indexOf(A.RecordSeparatorCode);if(-1===r)throw Error("Message is incomplete.");let i=r+1;e=String.fromCharCode.apply(null,Array.prototype.slice.call(n.slice(0,i))),o=n.byteLength>i?n.slice(i).buffer:null}else{let n=t.indexOf(A.RecordSeparator);if(-1===n)throw Error("Message is incomplete.");let r=n+1;e=t.substring(0,r),o=t.length>r?t.substring(r):null}let n=A.parse(e),r=JSON.parse(n[0]);if(r.type)throw Error("Expected a handshake response from the server.");return[o,r]}}(v=S||(S={}))[v.Invocation=1]="Invocation",v[v.StreamItem=2]="StreamItem",v[v.Completion=3]="Completion",v[v.StreamInvocation=4]="StreamInvocation",v[v.CancelInvocation=5]="CancelInvocation",v[v.Ping=6]="Ping",v[v.Close=7]="Close";var q=o(5403);(w=k||(k={})).Disconnected="Disconnected",w.Connecting="Connecting",w.Connected="Connected",w.Disconnecting="Disconnecting",w.Reconnecting="Reconnecting";class O{constructor(t,e,o,n){this._nextKeepAlive=0,this._freezeEventListener=()=>{this._logger.log(E.i.Warning,"The page is being frozen, this will likely lead to the connection being closed and messages being lost. For more information see the docs at https://docs.microsoft.com/aspnet/core/signalr/javascript-client#bsleep")},T.j7.isRequired(t,"connection"),T.j7.isRequired(e,"logger"),T.j7.isRequired(o,"protocol"),this.serverTimeoutInMilliseconds=3e4,this.keepAliveIntervalInMilliseconds=15e3,this._logger=e,this._protocol=o,this.connection=t,this._reconnectPolicy=n,this._handshakeProtocol=new L,this.connection.onreceive=t=>this._processIncomingData(t),this.connection.onclose=t=>this._connectionClosed(t),this._callbacks={},this._methods={},this._closedCallbacks=[],this._reconnectingCallbacks=[],this._reconnectedCallbacks=[],this._invocationId=0,this._receivedHandshakeResponse=!1,this._connectionState=k.Disconnected,this._connectionStarted=!1,this._cachedPingMessage=this._protocol.writeMessage({type:S.Ping})}static create(t,e,o,n){return new O(t,e,o,n)}get state(){return this._connectionState}get connectionId(){return this.connection&&this.connection.connectionId||null}get baseUrl(){return this.connection.baseUrl||""}set baseUrl(t){if(this._connectionState!==k.Disconnected&&this._connectionState!==k.Reconnecting)throw Error("The HubConnection must be in the Disconnected or Reconnecting state to change the url.");if(!t)throw Error("The HubConnection url must be a valid url.");this.connection.baseUrl=t}start(){return this._startPromise=this._startWithStateTransitions(),this._startPromise}async _startWithStateTransitions(){if(this._connectionState!==k.Disconnected)return Promise.reject(Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));this._connectionState=k.Connecting,this._logger.log(E.i.Debug,"Starting HubConnection.");try{await this._startInternal(),T.t4.isBrowser&&window.document.addEventListener("freeze",this._freezeEventListener),this._connectionState=k.Connected,this._connectionStarted=!0,this._logger.log(E.i.Debug,"HubConnection connected successfully.")}catch(t){return this._connectionState=k.Disconnected,this._logger.log(E.i.Debug,`HubConnection failed to start successfully because of error '${t}'.`),Promise.reject(t)}}async _startInternal(){this._stopDuringStartError=void 0,this._receivedHandshakeResponse=!1;let t=new Promise((t,e)=>{this._handshakeResolver=t,this._handshakeRejecter=e});await this.connection.start(this._protocol.transferFormat);try{let e={protocol:this._protocol.name,version:this._protocol.version};if(this._logger.log(E.i.Debug,"Sending handshake request."),await this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(e)),this._logger.log(E.i.Information,`Using HubProtocol '${this._protocol.name}'.`),this._cleanupTimeout(),this._resetTimeoutPeriod(),this._resetKeepAliveInterval(),await t,this._stopDuringStartError)throw this._stopDuringStartError;this.connection.features.inherentKeepAlive||await this._sendMessage(this._cachedPingMessage)}catch(t){throw this._logger.log(E.i.Debug,`Hub handshake failed with error '${t}' during start(). Stopping HubConnection.`),this._cleanupTimeout(),this._cleanupPingTimer(),await this.connection.stop(t),t}}async stop(){let t=this._startPromise;this._stopPromise=this._stopInternal(),await this._stopPromise;try{await t}catch(t){}}_stopInternal(t){return this._connectionState===k.Disconnected?(this._logger.log(E.i.Debug,`Call to HubConnection.stop(${t}) ignored because it is already in the disconnected state.`),Promise.resolve()):this._connectionState===k.Disconnecting?(this._logger.log(E.i.Debug,`Call to HttpConnection.stop(${t}) ignored because the connection is already in the disconnecting state.`),this._stopPromise):(this._connectionState=k.Disconnecting,this._logger.log(E.i.Debug,"Stopping HubConnection."),this._reconnectDelayHandle)?(this._logger.log(E.i.Debug,"Connection stopped during reconnect delay. Done reconnecting."),clearTimeout(this._reconnectDelayHandle),this._reconnectDelayHandle=void 0,this._completeClose(),Promise.resolve()):(this._cleanupTimeout(),this._cleanupPingTimer(),this._stopDuringStartError=t||new u("The connection was stopped before the hub handshake could complete."),this.connection.stop(t))}stream(t,...e){let o;let[n,r]=this._replaceStreamingParams(e),i=this._createStreamInvocation(t,e,r),s=new q.x;return s.cancelCallback=()=>{let t=this._createCancelInvocation(i.invocationId);return delete this._callbacks[i.invocationId],o.then(()=>this._sendWithProtocol(t))},this._callbacks[i.invocationId]=(t,e)=>{if(e){s.error(e);return}t&&(t.type===S.Completion?t.error?s.error(Error(t.error)):s.complete():s.next(t.item))},o=this._sendWithProtocol(i).catch(t=>{s.error(t),delete this._callbacks[i.invocationId]}),this._launchStreams(n,o),s}_sendMessage(t){return this._resetKeepAliveInterval(),this.connection.send(t)}_sendWithProtocol(t){return this._sendMessage(this._protocol.writeMessage(t))}send(t,...e){let[o,n]=this._replaceStreamingParams(e),r=this._sendWithProtocol(this._createInvocation(t,e,!0,n));return this._launchStreams(o,r),r}invoke(t,...e){let[o,n]=this._replaceStreamingParams(e),r=this._createInvocation(t,e,!1,n),i=new Promise((t,e)=>{this._callbacks[r.invocationId]=(o,n)=>{if(n){e(n);return}o&&(o.type===S.Completion?o.error?e(Error(o.error)):t(o.result):e(Error(`Unexpected message type: ${o.type}`)))};let n=this._sendWithProtocol(r).catch(t=>{e(t),delete this._callbacks[r.invocationId]});this._launchStreams(o,n)});return i}on(t,e){t&&e&&(t=t.toLowerCase(),this._methods[t]||(this._methods[t]=[]),-1===this._methods[t].indexOf(e)&&this._methods[t].push(e))}off(t,e){if(!t)return;t=t.toLowerCase();let o=this._methods[t];if(o){if(e){let n=o.indexOf(e);-1!==n&&(o.splice(n,1),0===o.length&&delete this._methods[t])}else delete this._methods[t]}}onclose(t){t&&this._closedCallbacks.push(t)}onreconnecting(t){t&&this._reconnectingCallbacks.push(t)}onreconnected(t){t&&this._reconnectedCallbacks.push(t)}_processIncomingData(t){if(this._cleanupTimeout(),this._receivedHandshakeResponse||(t=this._processHandshakeResponse(t),this._receivedHandshakeResponse=!0),t){let e=this._protocol.parseMessages(t,this._logger);for(let t of e)switch(t.type){case S.Invocation:this._invokeClientMethod(t);break;case S.StreamItem:case S.Completion:{let e=this._callbacks[t.invocationId];if(e){t.type===S.Completion&&delete this._callbacks[t.invocationId];try{e(t)}catch(t){this._logger.log(E.i.Error,`Stream callback threw error: ${(0,T.HH)(t)}`)}}break}case S.Ping:break;case S.Close:{this._logger.log(E.i.Information,"Close message received from server.");let e=t.error?Error("Server returned an error on close: "+t.error):void 0;!0===t.allowReconnect?this.connection.stop(e):this._stopPromise=this._stopInternal(e);break}default:this._logger.log(E.i.Warning,`Invalid message type: ${t.type}.`)}}this._resetTimeoutPeriod()}_processHandshakeResponse(t){let e,o;try{[o,e]=this._handshakeProtocol.parseHandshakeResponse(t)}catch(o){let t="Error parsing handshake response: "+o;this._logger.log(E.i.Error,t);let e=Error(t);throw this._handshakeRejecter(e),e}if(e.error){let t="Server returned handshake error: "+e.error;this._logger.log(E.i.Error,t);let o=Error(t);throw this._handshakeRejecter(o),o}return this._logger.log(E.i.Debug,"Server handshake complete."),this._handshakeResolver(),o}_resetKeepAliveInterval(){this.connection.features.inherentKeepAlive||(this._nextKeepAlive=new Date().getTime()+this.keepAliveIntervalInMilliseconds,this._cleanupPingTimer())}_resetTimeoutPeriod(){if((!this.connection.features||!this.connection.features.inherentKeepAlive)&&(this._timeoutHandle=setTimeout(()=>this.serverTimeout(),this.serverTimeoutInMilliseconds),void 0===this._pingServerHandle)){let t=this._nextKeepAlive-new Date().getTime();t<0&&(t=0),this._pingServerHandle=setTimeout(async()=>{if(this._connectionState===k.Connected)try{await this._sendMessage(this._cachedPingMessage)}catch{this._cleanupPingTimer()}},t)}}serverTimeout(){this.connection.stop(Error("Server timeout elapsed without receiving a message from the server."))}async _invokeClientMethod(t){let e,o,n;let r=t.target.toLowerCase(),i=this._methods[r];if(!i){this._logger.log(E.i.Warning,`No client method with the name '${r}' found.`),t.invocationId&&(this._logger.log(E.i.Warning,`No result given for '${r}' method and invocation ID '${t.invocationId}'.`),await this._sendWithProtocol(this._createCompletionMessage(t.invocationId,"Client didn't provide a result.",null)));return}let s=i.slice(),a=!!t.invocationId;for(let i of s)try{let s=e;e=await i.apply(this,t.arguments),a&&e&&s&&(this._logger.log(E.i.Error,`Multiple results provided for '${r}'. Sending error to server.`),n=this._createCompletionMessage(t.invocationId,"Client provided multiple results.",null)),o=void 0}catch(t){o=t,this._logger.log(E.i.Error,`A callback for the method '${r}' threw error '${t}'.`)}n?await this._sendWithProtocol(n):a?(o?n=this._createCompletionMessage(t.invocationId,`${o}`,null):void 0!==e?n=this._createCompletionMessage(t.invocationId,null,e):(this._logger.log(E.i.Warning,`No result given for '${r}' method and invocation ID '${t.invocationId}'.`),n=this._createCompletionMessage(t.invocationId,"Client didn't provide a result.",null)),await this._sendWithProtocol(n)):e&&this._logger.log(E.i.Error,`Result given for '${r}' method but server is not expecting a result.`)}_connectionClosed(t){this._logger.log(E.i.Debug,`HubConnection.connectionClosed(${t}) called while in state ${this._connectionState}.`),this._stopDuringStartError=this._stopDuringStartError||t||new u("The underlying connection was closed before the hub handshake could complete."),this._handshakeResolver&&this._handshakeResolver(),this._cancelCallbacksWithError(t||Error("Invocation canceled due to the underlying connection being closed.")),this._cleanupTimeout(),this._cleanupPingTimer(),this._connectionState===k.Disconnecting?this._completeClose(t):this._connectionState===k.Connected&&this._reconnectPolicy?this._reconnect(t):this._connectionState===k.Connected&&this._completeClose(t)}_completeClose(t){if(this._connectionStarted){this._connectionState=k.Disconnected,this._connectionStarted=!1,T.t4.isBrowser&&window.document.removeEventListener("freeze",this._freezeEventListener);try{this._closedCallbacks.forEach(e=>e.apply(this,[t]))}catch(e){this._logger.log(E.i.Error,`An onclose callback called with error '${t}' threw error '${e}'.`)}}}async _reconnect(t){let e=Date.now(),o=0,n=void 0!==t?t:Error("Attempting to reconnect due to a unknown error."),r=this._getNextRetryDelay(o++,0,n);if(null===r){this._logger.log(E.i.Debug,"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."),this._completeClose(t);return}if(this._connectionState=k.Reconnecting,t?this._logger.log(E.i.Information,`Connection reconnecting because of error '${t}'.`):this._logger.log(E.i.Information,"Connection reconnecting."),0!==this._reconnectingCallbacks.length){try{this._reconnectingCallbacks.forEach(e=>e.apply(this,[t]))}catch(e){this._logger.log(E.i.Error,`An onreconnecting callback called with error '${t}' threw error '${e}'.`)}if(this._connectionState!==k.Reconnecting){this._logger.log(E.i.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.");return}}for(;null!==r;){if(this._logger.log(E.i.Information,`Reconnect attempt number ${o} will start in ${r} ms.`),await new Promise(t=>{this._reconnectDelayHandle=setTimeout(t,r)}),this._reconnectDelayHandle=void 0,this._connectionState!==k.Reconnecting){this._logger.log(E.i.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");return}try{if(await this._startInternal(),this._connectionState=k.Connected,this._logger.log(E.i.Information,"HubConnection reconnected successfully."),0!==this._reconnectedCallbacks.length)try{this._reconnectedCallbacks.forEach(t=>t.apply(this,[this.connection.connectionId]))}catch(t){this._logger.log(E.i.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${t}'.`)}return}catch(t){if(this._logger.log(E.i.Information,`Reconnect attempt failed because of error '${t}'.`),this._connectionState!==k.Reconnecting){this._logger.log(E.i.Debug,`Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`),this._connectionState===k.Disconnecting&&this._completeClose();return}n=t instanceof Error?t:Error(t.toString()),r=this._getNextRetryDelay(o++,Date.now()-e,n)}}this._logger.log(E.i.Information,`Reconnect retries have been exhausted after ${Date.now()-e} ms and ${o} failed attempts. Connection disconnecting.`),this._completeClose()}_getNextRetryDelay(t,e,o){try{return this._reconnectPolicy.nextRetryDelayInMilliseconds({elapsedMilliseconds:e,previousRetryCount:t,retryReason:o})}catch(o){return this._logger.log(E.i.Error,`IRetryPolicy.nextRetryDelayInMilliseconds(${t}, ${e}) threw error '${o}'.`),null}}_cancelCallbacksWithError(t){let e=this._callbacks;this._callbacks={},Object.keys(e).forEach(o=>{let n=e[o];try{n(null,t)}catch(e){this._logger.log(E.i.Error,`Stream 'error' callback called with '${t}' threw error: ${(0,T.HH)(e)}`)}})}_cleanupPingTimer(){this._pingServerHandle&&(clearTimeout(this._pingServerHandle),this._pingServerHandle=void 0)}_cleanupTimeout(){this._timeoutHandle&&clearTimeout(this._timeoutHandle)}_createInvocation(t,e,o,n){if(o)return 0!==n.length?{arguments:e,streamIds:n,target:t,type:S.Invocation}:{arguments:e,target:t,type:S.Invocation};{let o=this._invocationId;return(this._invocationId++,0!==n.length)?{arguments:e,invocationId:o.toString(),streamIds:n,target:t,type:S.Invocation}:{arguments:e,invocationId:o.toString(),target:t,type:S.Invocation}}}_launchStreams(t,e){if(0!==t.length)for(let o in e||(e=Promise.resolve()),t)t[o].subscribe({complete:()=>{e=e.then(()=>this._sendWithProtocol(this._createCompletionMessage(o)))},error:t=>{let n;n=t instanceof Error?t.message:t&&t.toString?t.toString():"Unknown error",e=e.then(()=>this._sendWithProtocol(this._createCompletionMessage(o,n)))},next:t=>{e=e.then(()=>this._sendWithProtocol(this._createStreamItemMessage(o,t)))}})}_replaceStreamingParams(t){let e=[],o=[];for(let n=0;n{o+=`0x${t<16?"0":""}${t.toString(16)} `}),o.substr(0,o.length-1)}(t)}'`)):"string"==typeof t&&(o=`String data of length ${t.length}`,e&&(o+=`. Content: '${t}'`)),o}function l(t){return t&&"undefined"!=typeof ArrayBuffer&&(t instanceof ArrayBuffer||t.constructor&&"ArrayBuffer"===t.constructor.name)}async function h(t,e,o,r,i,s){let a={},[h,u]=p();a[h]=u,t.log(n.i.Trace,`(${e} transport) sending data. ${c(i,s.logMessageContent)}.`);let g=l(i)?"arraybuffer":"text",d=await o.post(r,{content:i,headers:{...a,...s.headers},responseType:g,timeout:s.timeout,withCredentials:s.withCredentials});t.log(n.i.Trace,`(${e} transport) request complete. Response status: ${d.statusCode}.`)}function u(t){return void 0===t?new d(n.i.Information):null===t?r.W.instance:void 0!==t.log?t:new d(t)}class g{constructor(t,e){this._subject=t,this._observer=e}dispose(){let t=this._subject.observers.indexOf(this._observer);t>-1&&this._subject.observers.splice(t,1),0===this._subject.observers.length&&this._subject.cancelCallback&&this._subject.cancelCallback().catch(t=>{})}}class d{constructor(t){this._minLevel=t,this.out=console}log(t,e){if(t>=this._minLevel){let o=`[${new Date().toISOString()}] ${n.i[t]}: ${e}`;switch(t){case n.i.Critical:case n.i.Error:this.out.error(o);break;case n.i.Warning:this.out.warn(o);break;case n.i.Information:this.out.info(o);break;default:this.out.log(o)}}}}function p(){let t="X-SignalR-User-Agent";return a.isNode&&(t="User-Agent"),[t,function(t,e,o,n){let r="Microsoft SignalR/",i=t.split(".");return r+=`${i[0]}.${i[1]} (${t}; `,e&&""!==e?r+=`${e}; `:r+="Unknown OS; ",r+=`${o}`,n?r+=`; ${n}`:r+="; Unknown Runtime Version",r+=")"}("7.0.3",function(){if(!a.isNode)return"";switch(i.platform){case"win32":return"Windows NT";case"darwin":return"macOS";case"linux":return"Linux";default:return i.platform}}(),a.isNode?"NodeJS":"Browser",function(){if(a.isNode)return i.versions.node}())]}function _(t){return t.stack?t.stack:t.message?t.message:`${t}`}function f(){if("undefined"!=typeof globalThis)return globalThis;if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==o.g)return o.g;throw Error("could not find global")}},3454:function(t,e,o){"use strict";var n,r;t.exports=(null==(n=o.g.process)?void 0:n.env)&&"object"==typeof(null==(r=o.g.process)?void 0:r.env)?o.g.process:o(7663)},7663:function(t){!function(){var e={229:function(t){var e,o,n,r=t.exports={};function i(){throw Error("setTimeout has not been defined")}function s(){throw Error("clearTimeout has not been defined")}function a(t){if(e===setTimeout)return setTimeout(t,0);if((e===i||!e)&&setTimeout)return e=setTimeout,setTimeout(t,0);try{return e(t,0)}catch(o){try{return e.call(null,t,0)}catch(o){return e.call(this,t,0)}}}!function(){try{e="function"==typeof setTimeout?setTimeout:i}catch(t){e=i}try{o="function"==typeof clearTimeout?clearTimeout:s}catch(t){o=s}}();var c=[],l=!1,h=-1;function u(){l&&n&&(l=!1,n.length?c=n.concat(c):h=-1,c.length&&g())}function g(){if(!l){var t=a(u);l=!0;for(var e=c.length;e;){for(n=c,c=[];++h1)for(var o=1;o{e.abort(),o=new a});let n=null;if(t.timeout){let r=t.timeout;n=setTimeout(()=>{e.abort(),this._logger.log(w.i.Warning,"Timeout from HTTP request."),o=new s},r)}let c;try{c=await this._fetchType(t.url,{body:t.content,cache:"no-cache",credentials:!0===t.withCredentials?"include":"same-origin",headers:{"Content-Type":"text/plain;charset=UTF-8","X-Requested-With":"XMLHttpRequest",...t.headers},method:t.method,mode:"cors",redirect:"follow",signal:e.signal})}catch(l){if(o)throw o;throw this._logger.log(w.i.Warning,`Error from HTTP request. ${l}.`),l}finally{n&&clearTimeout(n),t.abortSignal&&(t.abortSignal.onabort=null)}if(!c.ok){let h=await S(c,"text");throw new i(h||c.statusText,c.status)}let u=S(c,t.responseType),g=await u;return new d(c.status,c.statusText,g)}getCookieString(t){let e="";return y.t4.isNode&&this._jar&&this._jar.getCookies(t,(t,o)=>e=o.join("; ")),e}}function S(t,e){let o;switch(e){case"arraybuffer":o=t.arrayBuffer();break;case"text":default:o=t.text();break;case"blob":case"document":case"json":throw Error(`${e} is not supported.`)}return o}class C extends p{constructor(t){super(),this._logger=t}send(t){return t.abortSignal&&t.abortSignal.aborted?Promise.reject(new a):t.method?t.url?new Promise((e,o)=>{let n=new XMLHttpRequest;n.open(t.method,t.url,!0),n.withCredentials=void 0===t.withCredentials||t.withCredentials,n.setRequestHeader("X-Requested-With","XMLHttpRequest"),n.setRequestHeader("Content-Type","text/plain;charset=UTF-8");let r=t.headers;r&&Object.keys(r).forEach(t=>{n.setRequestHeader(t,r[t])}),t.responseType&&(n.responseType=t.responseType),t.abortSignal&&(t.abortSignal.onabort=()=>{n.abort(),o(new a)}),t.timeout&&(n.timeout=t.timeout),n.onload=()=>{t.abortSignal&&(t.abortSignal.onabort=null),n.status>=200&&n.status<300?e(new d(n.status,n.statusText,n.response||n.responseText)):o(new i(n.response||n.responseText||n.statusText,n.status))},n.onerror=()=>{this._logger.log(w.i.Warning,`Error from HTTP request. ${n.status}: ${n.statusText}.`),o(new i(n.statusText,n.status))},n.ontimeout=()=>{this._logger.log(w.i.Warning,"Timeout from HTTP request."),o(new s)},n.send(t.content||"")}):Promise.reject(Error("No url defined.")):Promise.reject(Error("No method defined."))}}class E extends p{constructor(t){if(super(),"undefined"!=typeof fetch||y.t4.isNode)this._httpClient=new v(t);else if("undefined"!=typeof XMLHttpRequest)this._httpClient=new C(t);else throw Error("No usable HttpClient found.")}send(t){return t.abortSignal&&t.abortSignal.aborted?Promise.reject(new a):t.method?t.url?this._httpClient.send(t):Promise.reject(Error("No url defined.")):Promise.reject(Error("No method defined."))}getCookieString(t){return this._httpClient.getCookieString(t)}}class k{}k.Authorization="Authorization",k.Cookie="Cookie",(W=_||(_={}))[W.None=0]="None",W[W.WebSockets=1]="WebSockets",W[W.ServerSentEvents=2]="ServerSentEvents",W[W.LongPolling=4]="LongPolling",(A=f||(f={}))[A.Text=1]="Text",A[A.Binary=2]="Binary";class T{constructor(){this._isAborted=!1,this.onabort=null}abort(){!this._isAborted&&(this._isAborted=!0,this.onabort&&this.onabort())}get signal(){return this}get aborted(){return this._isAborted}}class I{constructor(t,e,o,n){this._httpClient=t,this._accessTokenFactory=e,this._logger=o,this._pollAbort=new T,this._options=n,this._running=!1,this.onreceive=null,this.onclose=null}get pollAborted(){return this._pollAbort.aborted}async connect(t,e){if(y.j7.isRequired(t,"url"),y.j7.isRequired(e,"transferFormat"),y.j7.isIn(e,f,"transferFormat"),this._url=t,this._logger.log(w.i.Trace,"(LongPolling transport) Connecting."),e===f.Binary&&"undefined"!=typeof XMLHttpRequest&&"string"!=typeof new XMLHttpRequest().responseType)throw Error("Binary protocols over XmlHttpRequest not implementing advanced features are not supported.");let[o,n]=(0,y.hS)(),r={[o]:n,...this._options.headers},s={abortSignal:this._pollAbort.signal,headers:r,timeout:1e5,withCredentials:this._options.withCredentials};e===f.Binary&&(s.responseType="arraybuffer");let a=await this._getAccessToken();this._updateHeaderToken(s,a);let c=`${t}&_=${Date.now()}`;this._logger.log(w.i.Trace,`(LongPolling transport) polling: ${c}.`);let l=await this._httpClient.get(c,s);200!==l.statusCode?(this._logger.log(w.i.Error,`(LongPolling transport) Unexpected response code: ${l.statusCode}.`),this._closeError=new i(l.statusText||"",l.statusCode),this._running=!1):this._running=!0,this._receiving=this._poll(this._url,s)}async _getAccessToken(){return this._accessTokenFactory?await this._accessTokenFactory():null}_updateHeaderToken(t,e){if(t.headers||(t.headers={}),e){t.headers[k.Authorization]=`Bearer ${e}`;return}t.headers[k.Authorization]&&delete t.headers[k.Authorization]}async _poll(t,e){try{for(;this._running;){let o=await this._getAccessToken();this._updateHeaderToken(e,o);try{let n=`${t}&_=${Date.now()}`;this._logger.log(w.i.Trace,`(LongPolling transport) polling: ${n}.`);let r=await this._httpClient.get(n,e);204===r.statusCode?(this._logger.log(w.i.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):200!==r.statusCode?(this._logger.log(w.i.Error,`(LongPolling transport) Unexpected response code: ${r.statusCode}.`),this._closeError=new i(r.statusText||"",r.statusCode),this._running=!1):r.content?(this._logger.log(w.i.Trace,`(LongPolling transport) data received. ${(0,y.o4)(r.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(r.content)):this._logger.log(w.i.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(a){this._running?a instanceof s?this._logger.log(w.i.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=a,this._running=!1):this._logger.log(w.i.Trace,`(LongPolling transport) Poll errored after shutdown: ${a.message}`)}}}finally{this._logger.log(w.i.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}}async send(t){return this._running?(0,y.bG)(this._logger,"LongPolling",this._httpClient,this._url,this._accessTokenFactory,t,this._options):Promise.reject(Error("Cannot send until the transport is connected"))}async stop(){this._logger.log(w.i.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{await this._receiving,this._logger.log(w.i.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);let t={},[e,o]=(0,y.hS)();t[e]=o;let n={headers:{...t,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials},r=await this._getAccessToken();this._updateHeaderToken(n,r),await this._httpClient.delete(this._url,n),this._logger.log(w.i.Trace,"(LongPolling transport) DELETE request sent.")}finally{this._logger.log(w.i.Trace,"(LongPolling transport) Stop finished."),this._raiseOnClose()}}_raiseOnClose(){if(this.onclose){let t="(LongPolling transport) Firing onclose event.";this._closeError&&(t+=" Error: "+this._closeError),this._logger.log(w.i.Trace,t),this.onclose(this._closeError)}}}class P{constructor(t,e,o,n){this._httpClient=t,this._accessTokenFactory=e,this._logger=o,this._options=n,this.onreceive=null,this.onclose=null}async connect(t,e){if(y.j7.isRequired(t,"url"),y.j7.isRequired(e,"transferFormat"),y.j7.isIn(e,f,"transferFormat"),this._logger.log(w.i.Trace,"(SSE transport) Connecting."),this._url=t,this._accessTokenFactory){let o=await this._accessTokenFactory();o&&(t+=(0>t.indexOf("?")?"?":"&")+`access_token=${encodeURIComponent(o)}`)}return new Promise((o,n)=>{let r=!1;if(e!==f.Text){n(Error("The Server-Sent Events transport only supports the 'Text' transfer format"));return}let i;if(y.t4.isBrowser||y.t4.isWebWorker)i=new this._options.EventSource(t,{withCredentials:this._options.withCredentials});else{let s=this._httpClient.getCookieString(t),a={};a.Cookie=s;let[c,l]=(0,y.hS)();a[c]=l,i=new this._options.EventSource(t,{withCredentials:this._options.withCredentials,headers:{...a,...this._options.headers}})}try{i.onmessage=t=>{if(this.onreceive)try{this._logger.log(w.i.Trace,`(SSE transport) data received. ${(0,y.o4)(t.data,this._options.logMessageContent)}.`),this.onreceive(t.data)}catch(e){this._close(e);return}},i.onerror=t=>{r?this._close():n(Error("EventSource failed to connect. The connection could not be found on the server, either the connection ID is not present on the server, or a proxy is refusing/buffering the connection. If you have multiple servers check that sticky sessions are enabled."))},i.onopen=()=>{this._logger.log(w.i.Information,`SSE connected to ${this._url}`),this._eventSource=i,r=!0,o()}}catch(h){n(h);return}})}async send(t){return this._eventSource?(0,y.bG)(this._logger,"SSE",this._httpClient,this._url,this._accessTokenFactory,t,this._options):Promise.reject(Error("Cannot send until the transport is connected"))}stop(){return this._close(),Promise.resolve()}_close(t){this._eventSource&&(this._eventSource.close(),this._eventSource=void 0,this.onclose&&this.onclose(t))}}class ${constructor(t,e,o,n,r,i){this._logger=o,this._accessTokenFactory=e,this._logMessageContent=n,this._webSocketConstructor=r,this._httpClient=t,this.onreceive=null,this.onclose=null,this._headers=i}async connect(t,e){if(y.j7.isRequired(t,"url"),y.j7.isRequired(e,"transferFormat"),y.j7.isIn(e,f,"transferFormat"),this._logger.log(w.i.Trace,"(WebSockets transport) Connecting."),this._accessTokenFactory){let o=await this._accessTokenFactory();o&&(t+=(0>t.indexOf("?")?"?":"&")+`access_token=${encodeURIComponent(o)}`)}return new Promise((o,n)=>{t=t.replace(/^http/,"ws");let r,i=this._httpClient.getCookieString(t),s=!1;if(y.t4.isNode){let a={},[c,l]=(0,y.hS)();a[c]=l,i&&(a[k.Cookie]=`${i}`),r=new this._webSocketConstructor(t,void 0,{headers:{...a,...this._headers}})}r||(r=new this._webSocketConstructor(t)),e===f.Binary&&(r.binaryType="arraybuffer"),r.onopen=e=>{this._logger.log(w.i.Information,`WebSocket connected to ${t}.`),this._webSocket=r,s=!0,o()},r.onerror=t=>{let e=null;e="undefined"!=typeof ErrorEvent&&t instanceof ErrorEvent?t.error:"There was an error with the transport",this._logger.log(w.i.Information,`(WebSockets transport) ${e}.`)},r.onmessage=t=>{if(this._logger.log(w.i.Trace,`(WebSockets transport) data received. ${(0,y.o4)(t.data,this._logMessageContent)}.`),this.onreceive)try{this.onreceive(t.data)}catch(e){this._close(e);return}},r.onclose=t=>{if(s)this._close(t);else{let e=null;n(Error("undefined"!=typeof ErrorEvent&&t instanceof ErrorEvent?t.error:"WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled."))}}})}send(t){return this._webSocket&&this._webSocket.readyState===this._webSocketConstructor.OPEN?(this._logger.log(w.i.Trace,`(WebSockets transport) sending data. ${(0,y.o4)(t,this._logMessageContent)}.`),this._webSocket.send(t),Promise.resolve()):Promise.reject("WebSocket is not in the OPEN state")}stop(){return this._webSocket&&this._close(void 0),Promise.resolve()}_close(t){this._webSocket&&(this._webSocket.onclose=()=>{},this._webSocket.onmessage=()=>{},this._webSocket.onerror=()=>{},this._webSocket.close(),this._webSocket=void 0),this._logger.log(w.i.Trace,"(WebSockets transport) socket closed."),this.onclose&&(this._isCloseEvent(t)&&(!1===t.wasClean||1e3!==t.code)?this.onclose(Error(`WebSocket closed with status code: ${t.code} (${t.reason||"no reason given"}).`)):t instanceof Error?this.onclose(t):this.onclose())}_isCloseEvent(t){return t&&"boolean"==typeof t.wasClean&&"number"==typeof t.code}}class D{constructor(t,e={}){if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,y.j7.isRequired(t,"url"),this._logger=(0,y.hu)(e.logger),this.baseUrl=this._resolveUrl(t),(e=e||{}).logMessageContent=void 0!==e.logMessageContent&&e.logMessageContent,"boolean"==typeof e.withCredentials||void 0===e.withCredentials)e.withCredentials=void 0===e.withCredentials||e.withCredentials;else throw Error("withCredentials option was not a 'boolean' or 'undefined' value");e.timeout=void 0===e.timeout?1e5:e.timeout;let o=null,n=null;if(y.t4.isNode){let r=require;o=r("ws"),n=r("eventsource")}y.t4.isNode||"undefined"==typeof WebSocket||e.WebSocket?y.t4.isNode&&!e.WebSocket&&o&&(e.WebSocket=o):e.WebSocket=WebSocket,y.t4.isNode||"undefined"==typeof EventSource||e.EventSource?y.t4.isNode&&!e.EventSource&&void 0!==n&&(e.EventSource=n):e.EventSource=EventSource,this._httpClient=e.httpClient||new E(this._logger),this._connectionState="Disconnected",this._connectionStarted=!1,this._options=e,this.onreceive=null,this.onclose=null}async start(t){if(t=t||f.Binary,y.j7.isIn(t,f,"transferFormat"),this._logger.log(w.i.Debug,`Starting connection with transfer format '${f[t]}'.`),"Disconnected"!==this._connectionState)return Promise.reject(Error("Cannot start an HttpConnection that is not in the 'Disconnected' state."));if(this._connectionState="Connecting",this._startInternalPromise=this._startInternal(t),await this._startInternalPromise,"Disconnecting"===this._connectionState){let e="Failed to start the HttpConnection before stop() was called.";return this._logger.log(w.i.Error,e),await this._stopPromise,Promise.reject(Error(e))}if("Connected"!==this._connectionState){let o="HttpConnection.startInternal completed gracefully but didn't enter the connection into the connected state!";return this._logger.log(w.i.Error,o),Promise.reject(Error(o))}this._connectionStarted=!0}send(t){return"Connected"!==this._connectionState?Promise.reject(Error("Cannot send data if the connection is not in the 'Connected' State.")):(this._sendQueue||(this._sendQueue=new R(this.transport)),this._sendQueue.send(t))}async stop(t){return"Disconnected"===this._connectionState?(this._logger.log(w.i.Debug,`Call to HttpConnection.stop(${t}) ignored because the connection is already in the disconnected state.`),Promise.resolve()):"Disconnecting"===this._connectionState?(this._logger.log(w.i.Debug,`Call to HttpConnection.stop(${t}) ignored because the connection is already in the disconnecting state.`),this._stopPromise):void(this._connectionState="Disconnecting",this._stopPromise=new Promise(t=>{this._stopPromiseResolver=t}),await this._stopInternal(t),await this._stopPromise)}async _stopInternal(t){this._stopError=t;try{await this._startInternalPromise}catch(e){}if(this.transport){try{await this.transport.stop()}catch(o){this._logger.log(w.i.Error,`HttpConnection.transport.stop() threw error '${o}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(w.i.Debug,"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.")}async _startInternal(t){let e=this.baseUrl;this._accessTokenFactory=this._options.accessTokenFactory;try{if(this._options.skipNegotiation){if(this._options.transport===_.WebSockets)this.transport=this._constructTransport(_.WebSockets),await this._startTransport(e,t);else throw Error("Negotiation can only be skipped when using the WebSocket transport directly.")}else{let o=null,n=0;do{if(o=await this._getNegotiationResponse(e),"Disconnecting"===this._connectionState||"Disconnected"===this._connectionState)throw Error("The connection was stopped during negotiation.");if(o.error)throw Error(o.error);if(o.ProtocolVersion)throw 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.");if(o.url&&(e=o.url),o.accessToken){let r=o.accessToken;this._accessTokenFactory=()=>r}n++}while(o.url&&n<100);if(100===n&&o.url)throw Error("Negotiate redirection limit exceeded.");await this._createTransport(e,this._options.transport,o,t)}this.transport instanceof I&&(this.features.inherentKeepAlive=!0),"Connecting"===this._connectionState&&(this._logger.log(w.i.Debug,"The HttpConnection connected successfully."),this._connectionState="Connected")}catch(i){return this._logger.log(w.i.Error,"Failed to start the connection: "+i),this._connectionState="Disconnected",this.transport=void 0,this._stopPromiseResolver(),Promise.reject(i)}}async _getNegotiationResponse(t){let e={};if(this._accessTokenFactory){let o=await this._accessTokenFactory();o&&(e[k.Authorization]=`Bearer ${o}`)}let[n,r]=(0,y.hS)();e[n]=r;let s=this._resolveNegotiateUrl(t);this._logger.log(w.i.Debug,`Sending negotiation request: ${s}.`);try{let a=await this._httpClient.post(s,{content:"",headers:{...e,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials});if(200!==a.statusCode)return Promise.reject(Error(`Unexpected status code returned from negotiate '${a.statusCode}'`));let c=JSON.parse(a.content);return(!c.negotiateVersion||c.negotiateVersion<1)&&(c.connectionToken=c.connectionId),c}catch(h){let l="Failed to complete negotiation with the server: "+h;return h instanceof i&&404===h.statusCode&&(l+=" Either this is not a SignalR endpoint or there is a proxy blocking the connection."),this._logger.log(w.i.Error,l),Promise.reject(new u(l))}}_createConnectUrl(t,e){return e?t+(-1===t.indexOf("?")?"?":"&")+`id=${e}`:t}async _createTransport(t,e,o,n){let r=this._createConnectUrl(t,o.connectionToken);if(this._isITransport(e)){this._logger.log(w.i.Debug,"Connection was provided an instance of ITransport, using that directly."),this.transport=e,await this._startTransport(r,n),this.connectionId=o.connectionId;return}let i=[],s=o.availableTransports||[],a=o;for(let c of s){let l=this._resolveTransportOrError(c,e,n);if(l instanceof Error)i.push(`${c.transport} failed:`),i.push(l);else if(this._isITransport(l)){if(this.transport=l,!a){try{a=await this._getNegotiationResponse(t)}catch(u){return Promise.reject(u)}r=this._createConnectUrl(t,a.connectionToken)}try{await this._startTransport(r,n),this.connectionId=a.connectionId;return}catch(p){if(this._logger.log(w.i.Error,`Failed to start the transport '${c.transport}': ${p}`),a=void 0,i.push(new h(`${c.transport} failed: ${p}`,_[c.transport])),"Connecting"!==this._connectionState){let d="Failed to select transport before stop() was called.";return this._logger.log(w.i.Debug,d),Promise.reject(Error(d))}}}}return i.length>0?Promise.reject(new g(`Unable to connect to the server with any of the available transports. ${i.join(" ")}`,i)):Promise.reject(Error("None of the transports supported by the client are supported by the server."))}_constructTransport(t){switch(t){case _.WebSockets:if(!this._options.WebSocket)throw Error("'WebSocket' is not supported in your environment.");return new $(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case _.ServerSentEvents:if(!this._options.EventSource)throw Error("'EventSource' is not supported in your environment.");return new P(this._httpClient,this._accessTokenFactory,this._logger,this._options);case _.LongPolling:return new I(this._httpClient,this._accessTokenFactory,this._logger,this._options);default:throw Error(`Unknown transport: ${t}.`)}}_startTransport(t,e){return this.transport.onreceive=this.onreceive,this.transport.onclose=t=>this._stopConnection(t),this.transport.connect(t,e)}_resolveTransportOrError(t,e,o){var n,r;let i=_[t.transport];if(null==i)return this._logger.log(w.i.Debug,`Skipping transport '${t.transport}' because it is not supported by this client.`),Error(`Skipping transport '${t.transport}' because it is not supported by this client.`);if(n=e,r=i,n&&(r&n)==0)return this._logger.log(w.i.Debug,`Skipping transport '${_[i]}' because it was disabled by the client.`),new l(`'${_[i]}' is disabled by the client.`,i);{let s=t.transferFormats.map(t=>f[t]);if(!(s.indexOf(o)>=0))return this._logger.log(w.i.Debug,`Skipping transport '${_[i]}' because it does not support the requested transfer format '${f[o]}'.`),Error(`'${_[i]}' does not support ${f[o]}.`);if(i===_.WebSockets&&!this._options.WebSocket||i===_.ServerSentEvents&&!this._options.EventSource)return this._logger.log(w.i.Debug,`Skipping transport '${_[i]}' because it is not supported in your environment.'`),new c(`'${_[i]}' is not supported in your environment.`,i);this._logger.log(w.i.Debug,`Selecting transport '${_[i]}'.`);try{return this._constructTransport(i)}catch(a){return a}}}_isITransport(t){return t&&"object"==typeof t&&"connect"in t}_stopConnection(t){if(this._logger.log(w.i.Debug,`HttpConnection.stopConnection(${t}) called while in state ${this._connectionState}.`),this.transport=void 0,t=this._stopError||t,this._stopError=void 0,"Disconnected"===this._connectionState){this._logger.log(w.i.Debug,`Call to HttpConnection.stopConnection(${t}) was ignored because the connection is already in the disconnected state.`);return}if("Connecting"===this._connectionState)throw this._logger.log(w.i.Warning,`Call to HttpConnection.stopConnection(${t}) was ignored because the connection is still in the connecting state.`),Error(`HttpConnection.stopConnection(${t}) was called while the connection is still in the connecting state.`);if("Disconnecting"===this._connectionState&&this._stopPromiseResolver(),t?this._logger.log(w.i.Error,`Connection disconnected with error '${t}'.`):this._logger.log(w.i.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch(t=>{this._logger.log(w.i.Error,`TransportSendQueue.stop() threw error '${t}'.`)}),this._sendQueue=void 0),this.connectionId=void 0,this._connectionState="Disconnected",this._connectionStarted){this._connectionStarted=!1;try{this.onclose&&this.onclose(t)}catch(e){this._logger.log(w.i.Error,`HttpConnection.onclose(${t}) threw error '${e}'.`)}}}_resolveUrl(t){if(0===t.lastIndexOf("https://",0)||0===t.lastIndexOf("http://",0))return t;if(!y.t4.isBrowser)throw Error(`Cannot resolve '${t}'.`);let e=window.document.createElement("a");return e.href=t,this._logger.log(w.i.Information,`Normalizing '${t}' to '${e.href}'.`),e.href}_resolveNegotiateUrl(t){let e=t.indexOf("?"),o=t.substring(0,-1===e?t.length:e);return"/"!==o[o.length-1]&&(o+="/"),o+="negotiate",-1===(o+=-1===e?"":t.substring(e)).indexOf("negotiateVersion")&&(o+=-1===e?"?":"&",o+="negotiateVersion="+this._negotiateVersion),o}}class R{constructor(t){this._transport=t,this._buffer=[],this._executing=!0,this._sendBufferedData=new x,this._transportResult=new x,this._sendLoopPromise=this._sendLoop()}send(t){return this._bufferData(t),this._transportResult||(this._transportResult=new x),this._transportResult.promise}stop(){return this._executing=!1,this._sendBufferedData.resolve(),this._sendLoopPromise}_bufferData(t){if(this._buffer.length&&typeof this._buffer[0]!=typeof t)throw Error(`Expected data to be of type ${typeof this._buffer} but was of type ${typeof t}`);this._buffer.push(t),this._sendBufferedData.resolve()}async _sendLoop(){for(;;){if(await this._sendBufferedData.promise,!this._executing){this._transportResult&&this._transportResult.reject("Connection stopped.");break}this._sendBufferedData=new x;let t=this._transportResult;this._transportResult=void 0;let e="string"==typeof this._buffer[0]?this._buffer.join(""):R._concatBuffers(this._buffer);this._buffer.length=0;try{await this._transport.send(e),t.resolve()}catch(o){t.reject(o)}}}static _concatBuffers(t){let e=t.map(t=>t.byteLength).reduce((t,e)=>t+e),o=new Uint8Array(e),n=0;for(let r of t)o.set(new Uint8Array(r),n),n+=r.byteLength;return o.buffer}}class x{constructor(){this.promise=new Promise((t,e)=>([this._resolver,this._rejecter]=[t,e]))}resolve(){this._resolver()}reject(t){this._rejecter(t)}}class H{static write(t){return`${t}${H.RecordSeparator}`}static parse(t){if(t[t.length-1]!==H.RecordSeparator)throw Error("Message is incomplete.");let e=t.split(H.RecordSeparator);return e.pop(),e}}H.RecordSeparatorCode=30,H.RecordSeparator=String.fromCharCode(H.RecordSeparatorCode);class j{writeHandshakeRequest(t){return H.write(JSON.stringify(t))}parseHandshakeResponse(t){let e,o;if((0,y.eP)(t)){let n=new Uint8Array(t),r=n.indexOf(H.RecordSeparatorCode);if(-1===r)throw Error("Message is incomplete.");let i=r+1;e=String.fromCharCode.apply(null,Array.prototype.slice.call(n.slice(0,i))),o=n.byteLength>i?n.slice(i).buffer:null}else{let s=t.indexOf(H.RecordSeparator);if(-1===s)throw Error("Message is incomplete.");let a=s+1;e=t.substring(0,a),o=t.length>a?t.substring(a):null}let c=H.parse(e),l=JSON.parse(c[0]);if(l.type)throw Error("Expected a handshake response from the server.");return[o,l]}}(N=m||(m={}))[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";var W,A,N,L,M=o(5403);(L=b||(b={})).Disconnected="Disconnected",L.Connecting="Connecting",L.Connected="Connected",L.Disconnecting="Disconnecting",L.Reconnecting="Reconnecting";class q{constructor(t,e,o,n){this._nextKeepAlive=0,this._freezeEventListener=()=>{this._logger.log(w.i.Warning,"The page is being frozen, this will likely lead to the connection being closed and messages being lost. For more information see the docs at https://docs.microsoft.com/aspnet/core/signalr/javascript-client#bsleep")},y.j7.isRequired(t,"connection"),y.j7.isRequired(e,"logger"),y.j7.isRequired(o,"protocol"),this.serverTimeoutInMilliseconds=3e4,this.keepAliveIntervalInMilliseconds=15e3,this._logger=e,this._protocol=o,this.connection=t,this._reconnectPolicy=n,this._handshakeProtocol=new j,this.connection.onreceive=t=>this._processIncomingData(t),this.connection.onclose=t=>this._connectionClosed(t),this._callbacks={},this._methods={},this._closedCallbacks=[],this._reconnectingCallbacks=[],this._reconnectedCallbacks=[],this._invocationId=0,this._receivedHandshakeResponse=!1,this._connectionState=b.Disconnected,this._connectionStarted=!1,this._cachedPingMessage=this._protocol.writeMessage({type:m.Ping})}static create(t,e,o,n){return new q(t,e,o,n)}get state(){return this._connectionState}get connectionId(){return this.connection&&this.connection.connectionId||null}get baseUrl(){return this.connection.baseUrl||""}set baseUrl(t){if(this._connectionState!==b.Disconnected&&this._connectionState!==b.Reconnecting)throw Error("The HubConnection must be in the Disconnected or Reconnecting state to change the url.");if(!t)throw Error("The HubConnection url must be a valid url.");this.connection.baseUrl=t}start(){return this._startPromise=this._startWithStateTransitions(),this._startPromise}async _startWithStateTransitions(){if(this._connectionState!==b.Disconnected)return Promise.reject(Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));this._connectionState=b.Connecting,this._logger.log(w.i.Debug,"Starting HubConnection.");try{await this._startInternal(),y.t4.isBrowser&&window.document.addEventListener("freeze",this._freezeEventListener),this._connectionState=b.Connected,this._connectionStarted=!0,this._logger.log(w.i.Debug,"HubConnection connected successfully.")}catch(t){return this._connectionState=b.Disconnected,this._logger.log(w.i.Debug,`HubConnection failed to start successfully because of error '${t}'.`),Promise.reject(t)}}async _startInternal(){this._stopDuringStartError=void 0,this._receivedHandshakeResponse=!1;let t=new Promise((t,e)=>{this._handshakeResolver=t,this._handshakeRejecter=e});await this.connection.start(this._protocol.transferFormat);try{let e={protocol:this._protocol.name,version:this._protocol.version};if(this._logger.log(w.i.Debug,"Sending handshake request."),await this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(e)),this._logger.log(w.i.Information,`Using HubProtocol '${this._protocol.name}'.`),this._cleanupTimeout(),this._resetTimeoutPeriod(),this._resetKeepAliveInterval(),await t,this._stopDuringStartError)throw this._stopDuringStartError}catch(o){throw this._logger.log(w.i.Debug,`Hub handshake failed with error '${o}' during start(). Stopping HubConnection.`),this._cleanupTimeout(),this._cleanupPingTimer(),await this.connection.stop(o),o}}async stop(){let t=this._startPromise;this._stopPromise=this._stopInternal(),await this._stopPromise;try{await t}catch(e){}}_stopInternal(t){return this._connectionState===b.Disconnected?(this._logger.log(w.i.Debug,`Call to HubConnection.stop(${t}) ignored because it is already in the disconnected state.`),Promise.resolve()):this._connectionState===b.Disconnecting?(this._logger.log(w.i.Debug,`Call to HttpConnection.stop(${t}) ignored because the connection is already in the disconnecting state.`),this._stopPromise):(this._connectionState=b.Disconnecting,this._logger.log(w.i.Debug,"Stopping HubConnection."),this._reconnectDelayHandle)?(this._logger.log(w.i.Debug,"Connection stopped during reconnect delay. Done reconnecting."),clearTimeout(this._reconnectDelayHandle),this._reconnectDelayHandle=void 0,this._completeClose(),Promise.resolve()):(this._cleanupTimeout(),this._cleanupPingTimer(),this._stopDuringStartError=t||Error("The connection was stopped before the hub handshake could complete."),this.connection.stop(t))}stream(t,...e){let[o,n]=this._replaceStreamingParams(e),r=this._createStreamInvocation(t,e,n),i,s=new M.x;return s.cancelCallback=()=>{let t=this._createCancelInvocation(r.invocationId);return delete this._callbacks[r.invocationId],i.then(()=>this._sendWithProtocol(t))},this._callbacks[r.invocationId]=(t,e)=>{if(e){s.error(e);return}t&&(t.type===m.Completion?t.error?s.error(Error(t.error)):s.complete():s.next(t.item))},i=this._sendWithProtocol(r).catch(t=>{s.error(t),delete this._callbacks[r.invocationId]}),this._launchStreams(o,i),s}_sendMessage(t){return this._resetKeepAliveInterval(),this.connection.send(t)}_sendWithProtocol(t){return this._sendMessage(this._protocol.writeMessage(t))}send(t,...e){let[o,n]=this._replaceStreamingParams(e),r=this._sendWithProtocol(this._createInvocation(t,e,!0,n));return this._launchStreams(o,r),r}invoke(t,...e){let[o,n]=this._replaceStreamingParams(e),r=this._createInvocation(t,e,!1,n),i=new Promise((t,e)=>{this._callbacks[r.invocationId]=(o,n)=>{if(n){e(n);return}o&&(o.type===m.Completion?o.error?e(Error(o.error)):t(o.result):e(Error(`Unexpected message type: ${o.type}`)))};let n=this._sendWithProtocol(r).catch(t=>{e(t),delete this._callbacks[r.invocationId]});this._launchStreams(o,n)});return i}on(t,e){if(t&&e)t=t.toLowerCase(),this._methods[t]||(this._methods[t]=[]),-1===this._methods[t].indexOf(e)&&this._methods[t].push(e)}off(t,e){if(!t)return;t=t.toLowerCase();let o=this._methods[t];if(o){if(e){let n=o.indexOf(e);-1!==n&&(o.splice(n,1),0===o.length&&delete this._methods[t])}else delete this._methods[t]}}onclose(t){t&&this._closedCallbacks.push(t)}onreconnecting(t){t&&this._reconnectingCallbacks.push(t)}onreconnected(t){t&&this._reconnectedCallbacks.push(t)}_processIncomingData(t){if(this._cleanupTimeout(),this._receivedHandshakeResponse||(t=this._processHandshakeResponse(t),this._receivedHandshakeResponse=!0),t){let e=this._protocol.parseMessages(t,this._logger);for(let o of e)switch(o.type){case m.Invocation:this._invokeClientMethod(o);break;case m.StreamItem:case m.Completion:{let n=this._callbacks[o.invocationId];if(n){o.type===m.Completion&&delete this._callbacks[o.invocationId];try{n(o)}catch(r){this._logger.log(w.i.Error,`Stream callback threw error: ${(0,y.HH)(r)}`)}}break}case m.Ping:break;case m.Close:{this._logger.log(w.i.Information,"Close message received from server.");let i=o.error?Error("Server returned an error on close: "+o.error):void 0;!0===o.allowReconnect?this.connection.stop(i):this._stopPromise=this._stopInternal(i);break}default:this._logger.log(w.i.Warning,`Invalid message type: ${o.type}.`)}}this._resetTimeoutPeriod()}_processHandshakeResponse(t){let e,o;try{[o,e]=this._handshakeProtocol.parseHandshakeResponse(t)}catch(i){let n="Error parsing handshake response: "+i;this._logger.log(w.i.Error,n);let r=Error(n);throw this._handshakeRejecter(r),r}if(e.error){let s="Server returned handshake error: "+e.error;this._logger.log(w.i.Error,s);let a=Error(s);throw this._handshakeRejecter(a),a}return this._logger.log(w.i.Debug,"Server handshake complete."),this._handshakeResolver(),o}_resetKeepAliveInterval(){!this.connection.features.inherentKeepAlive&&(this._nextKeepAlive=new Date().getTime()+this.keepAliveIntervalInMilliseconds,this._cleanupPingTimer())}_resetTimeoutPeriod(){if((!this.connection.features||!this.connection.features.inherentKeepAlive)&&(this._timeoutHandle=setTimeout(()=>this.serverTimeout(),this.serverTimeoutInMilliseconds),void 0===this._pingServerHandle)){let t=this._nextKeepAlive-new Date().getTime();t<0&&(t=0),this._pingServerHandle=setTimeout(async()=>{if(this._connectionState===b.Connected)try{await this._sendMessage(this._cachedPingMessage)}catch{this._cleanupPingTimer()}},t)}}serverTimeout(){this.connection.stop(Error("Server timeout elapsed without receiving a message from the server."))}_invokeClientMethod(t){let e=this._methods[t.target.toLowerCase()];if(e){try{e.forEach(e=>e.apply(this,t.arguments))}catch(o){this._logger.log(w.i.Error,`A callback for the method ${t.target.toLowerCase()} threw error '${o}'.`)}if(t.invocationId){let n="Server requested a response, which is not supported in this version of the client.";this._logger.log(w.i.Error,n),this._stopPromise=this._stopInternal(Error(n))}}else this._logger.log(w.i.Warning,`No client method with the name '${t.target}' found.`)}_connectionClosed(t){this._logger.log(w.i.Debug,`HubConnection.connectionClosed(${t}) called while in state ${this._connectionState}.`),this._stopDuringStartError=this._stopDuringStartError||t||Error("The underlying connection was closed before the hub handshake could complete."),this._handshakeResolver&&this._handshakeResolver(),this._cancelCallbacksWithError(t||Error("Invocation canceled due to the underlying connection being closed.")),this._cleanupTimeout(),this._cleanupPingTimer(),this._connectionState===b.Disconnecting?this._completeClose(t):this._connectionState===b.Connected&&this._reconnectPolicy?this._reconnect(t):this._connectionState===b.Connected&&this._completeClose(t)}_completeClose(t){if(this._connectionStarted){this._connectionState=b.Disconnected,this._connectionStarted=!1,y.t4.isBrowser&&window.document.removeEventListener("freeze",this._freezeEventListener);try{this._closedCallbacks.forEach(e=>e.apply(this,[t]))}catch(e){this._logger.log(w.i.Error,`An onclose callback called with error '${t}' threw error '${e}'.`)}}}async _reconnect(t){let e=Date.now(),o=0,n=void 0!==t?t:Error("Attempting to reconnect due to a unknown error."),r=this._getNextRetryDelay(o++,0,n);if(null===r){this._logger.log(w.i.Debug,"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."),this._completeClose(t);return}if(this._connectionState=b.Reconnecting,t?this._logger.log(w.i.Information,`Connection reconnecting because of error '${t}'.`):this._logger.log(w.i.Information,"Connection reconnecting."),0!==this._reconnectingCallbacks.length){try{this._reconnectingCallbacks.forEach(e=>e.apply(this,[t]))}catch(i){this._logger.log(w.i.Error,`An onreconnecting callback called with error '${t}' threw error '${i}'.`)}if(this._connectionState!==b.Reconnecting){this._logger.log(w.i.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.");return}}for(;null!==r;){if(this._logger.log(w.i.Information,`Reconnect attempt number ${o} will start in ${r} ms.`),await new Promise(t=>{this._reconnectDelayHandle=setTimeout(t,r)}),this._reconnectDelayHandle=void 0,this._connectionState!==b.Reconnecting){this._logger.log(w.i.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");return}try{if(await this._startInternal(),this._connectionState=b.Connected,this._logger.log(w.i.Information,"HubConnection reconnected successfully."),0!==this._reconnectedCallbacks.length)try{this._reconnectedCallbacks.forEach(t=>t.apply(this,[this.connection.connectionId]))}catch(s){this._logger.log(w.i.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${s}'.`)}return}catch(a){if(this._logger.log(w.i.Information,`Reconnect attempt failed because of error '${a}'.`),this._connectionState!==b.Reconnecting){this._logger.log(w.i.Debug,`Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`),this._connectionState===b.Disconnecting&&this._completeClose();return}n=a instanceof Error?a:Error(a.toString()),r=this._getNextRetryDelay(o++,Date.now()-e,n)}}this._logger.log(w.i.Information,`Reconnect retries have been exhausted after ${Date.now()-e} ms and ${o} failed attempts. Connection disconnecting.`),this._completeClose()}_getNextRetryDelay(t,e,o){try{return this._reconnectPolicy.nextRetryDelayInMilliseconds({elapsedMilliseconds:e,previousRetryCount:t,retryReason:o})}catch(n){return this._logger.log(w.i.Error,`IRetryPolicy.nextRetryDelayInMilliseconds(${t}, ${e}) threw error '${n}'.`),null}}_cancelCallbacksWithError(t){let e=this._callbacks;this._callbacks={},Object.keys(e).forEach(o=>{let n=e[o];try{n(null,t)}catch(r){this._logger.log(w.i.Error,`Stream 'error' callback called with '${t}' threw error: ${(0,y.HH)(r)}`)}})}_cleanupPingTimer(){this._pingServerHandle&&(clearTimeout(this._pingServerHandle),this._pingServerHandle=void 0)}_cleanupTimeout(){this._timeoutHandle&&clearTimeout(this._timeoutHandle)}_createInvocation(t,e,o,n){if(o)return 0!==n.length?{arguments:e,streamIds:n,target:t,type:m.Invocation}:{arguments:e,target:t,type:m.Invocation};{let r=this._invocationId;return(this._invocationId++,0!==n.length)?{arguments:e,invocationId:r.toString(),streamIds:n,target:t,type:m.Invocation}:{arguments:e,invocationId:r.toString(),target:t,type:m.Invocation}}}_launchStreams(t,e){if(0!==t.length)for(let o in e||(e=Promise.resolve()),t)t[o].subscribe({complete:()=>{e=e.then(()=>this._sendWithProtocol(this._createCompletionMessage(o)))},error:t=>{let n;n=t instanceof Error?t.message:t&&t.toString?t.toString():"Unknown error",e=e.then(()=>this._sendWithProtocol(this._createCompletionMessage(o,n)))},next:t=>{e=e.then(()=>this._sendWithProtocol(this._createStreamItemMessage(o,t)))}})}_replaceStreamingParams(t){let e=[],o=[];for(let n=0;n{o+=`0x${t<16?"0":""}${t.toString(16)} `}),o.substr(0,o.length-1)}(t)}'`)):"string"==typeof t&&(o=`String data of length ${t.length}`,e&&(o+=`. Content: '${t}'`)),o}function l(t){return t&&"undefined"!=typeof ArrayBuffer&&(t instanceof ArrayBuffer||t.constructor&&"ArrayBuffer"===t.constructor.name)}async function h(t,e,o,r,i,s,a){let h={};if(i){let u=await i();u&&(h={Authorization:`Bearer ${u}`})}let[g,d]=p();h[g]=d,t.log(n.i.Trace,`(${e} transport) sending data. ${c(s,a.logMessageContent)}.`);let _=l(s)?"arraybuffer":"text",f=await o.post(r,{content:s,headers:{...h,...a.headers},responseType:_,timeout:a.timeout,withCredentials:a.withCredentials});t.log(n.i.Trace,`(${e} transport) request complete. Response status: ${f.statusCode}.`)}function u(t){return void 0===t?new d(n.i.Information):null===t?r.W.instance:void 0!==t.log?t:new d(t)}class g{constructor(t,e){this._subject=t,this._observer=e}dispose(){let t=this._subject.observers.indexOf(this._observer);t>-1&&this._subject.observers.splice(t,1),0===this._subject.observers.length&&this._subject.cancelCallback&&this._subject.cancelCallback().catch(t=>{})}}class d{constructor(t){this._minLevel=t,this.out=console}log(t,e){if(t>=this._minLevel){let o=`[${new Date().toISOString()}] ${n.i[t]}: ${e}`;switch(t){case n.i.Critical:case n.i.Error:this.out.error(o);break;case n.i.Warning:this.out.warn(o);break;case n.i.Information:this.out.info(o);break;default:this.out.log(o)}}}}function p(){let t="X-SignalR-User-Agent";return a.isNode&&(t="User-Agent"),[t,function(t,e,o,n){let r="Microsoft SignalR/",i=t.split(".");return r+=`${i[0]}.${i[1]}`,r+=` (${t}; `,e&&""!==e?r+=`${e}; `:r+="Unknown OS; ",r+=`${o}`,n?r+=`; ${n}`:r+="; Unknown Runtime Version",r+=")"}("6.0.10",function(){if(!a.isNode)return"";switch(i.platform){case"win32":return"Windows NT";case"darwin":return"macOS";case"linux":return"Linux";default:return i.platform}}(),a.isNode?"NodeJS":"Browser",function(){if(a.isNode)return i.versions.node}())]}function _(t){return t.stack?t.stack:t.message?t.message:`${t}`}function f(){if("undefined"!=typeof globalThis)return globalThis;if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==o.g)return o.g;throw Error("could not find global")}},3454:function(t,e,o){"use strict";var n,r;t.exports=(null==(n=o.g.process)?void 0:n.env)&&"object"==typeof(null==(r=o.g.process)?void 0:r.env)?o.g.process:o(7663)},7663:function(t){!function(){var e={229:function(t){var e,o,n,r=t.exports={};function i(){throw Error("setTimeout has not been defined")}function s(){throw Error("clearTimeout has not been defined")}function a(t){if(e===setTimeout)return setTimeout(t,0);if((e===i||!e)&&setTimeout)return e=setTimeout,setTimeout(t,0);try{return e(t,0)}catch(n){try{return e.call(null,t,0)}catch(o){return e.call(this,t,0)}}}!function(){try{e="function"==typeof setTimeout?setTimeout:i}catch(t){e=i}try{o="function"==typeof clearTimeout?clearTimeout:s}catch(n){o=s}}();var c=[],l=!1,h=-1;function u(){l&&n&&(l=!1,n.length?c=n.concat(c):h=-1,c.length&&g())}function g(){if(!l){var t=a(u);l=!0;for(var e=c.length;e;){for(n=c,c=[];++h1)for(var o=1;ot.length)&&(e=t.length);for(var o=0,n=Array(e);o