1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9972],{88339:function(a,b,c){c.d(b,{s:function(){return ig}});class d{constructor(e){this._retryDelays=void 0!==e?[...e,null]:[0,2000,10e3,30e3,null]}nextRetryDelayInMilliseconds(f){return this._retryDelays[f.previousRetryCount]}}class g extends Error{constructor(h,i){const j=new.target.prototype;super(`${h}: Status code '${i}'`),this.statusCode=i,this.__proto__=j}}class k extends Error{constructor(l="A timeout occurred."){const m=new.target.prototype;super(l),this.__proto__=m}}class n extends Error{constructor(o="An abort occurred."){const p=new.target.prototype;super(o),this.__proto__=p}}class q extends Error{constructor(r,s){const t=new.target.prototype;super(r),this.transport=s,this.errorType="UnsupportedTransportError",this.__proto__=t}}class u extends Error{constructor(v,w){const x=new.target.prototype;super(v),this.transport=w,this.errorType="DisabledTransportError",this.__proto__=x}}class y extends Error{constructor(z,A){const B=new.target.prototype;super(z),this.transport=A,this.errorType="FailedToStartTransportError",this.__proto__=B}}class C extends Error{constructor(D){const E=new.target.prototype;super(D),this.errorType="FailedToNegotiateWithServerError",this.__proto__=E}}class F extends Error{constructor(G,H){const I=new.target.prototype;super(G),this.innerErrors=H,this.__proto__=I}}class J{constructor(K,L,M){this.statusCode=K,this.statusText=L,this.content=M}}class N{get(O,P){return this.send({...P,method:"GET",url:O})}post(Q,R){return this.send({...R,method:"POST",url:Q})}delete(S,T){return this.send({...T,method:"DELETE",url:S})}getCookieString(U){return""}}(aa=ba||(ba={}))[aa.Trace=0]="Trace",aa[aa.Debug=1]="Debug",aa[aa.Information=2]="Information",aa[aa.Warning=3]="Warning",aa[aa.Error=4]="Error",aa[aa.Critical=5]="Critical",aa[aa.None=6]="None";class V{constructor(){}log(W,X){}}V.instance=new V();var Y,Z,$,_,aa,ba,ca,da,ea,fa,ga=c(34155);class ha{static isRequired(ia,ja){if(null==ia)throw new Error(`The '${ja}' argument is required.`)}static isNotEmpty(ka,la){if(!ka||ka.match(/^\s*$/))throw new Error(`The '${la}' argument should not be empty.`)}static isIn(ma,na,oa){if(!(ma in na))throw new Error(`Unknown ${oa} value: ${ma}.`)}}class pa{static get isBrowser(){return"object"==typeof window&&"object"==typeof window.document}static get isWebWorker(){return"object"==typeof self&&"importScripts"in self}static get isReactNative(){return"object"==typeof window&& void 0===window.document}static get isNode(){return!this.isBrowser&&!this.isWebWorker&&!this.isReactNative}}function qa(a,b){let c="";return sa(a)?(c=`Binary data of length ${a.byteLength}`,b&&(c+=`. Content: '${ra(a)}'`)):"string"==typeof a&&(c=`String data of length ${a.length}`,b&&(c+=`. Content: '${a}'`)),c}function ra(a){const b=new Uint8Array(a);let c="";return b.forEach(a=>{c+=`0x${a<16?"0":""}${a.toString(16)} `}),c.substr(0,c.length-1)}function sa(a){return a&&"undefined"!=typeof ArrayBuffer&&(a instanceof ArrayBuffer||a.constructor&&"ArrayBuffer"===a.constructor.name)}async function ta(a,b,c,d,e,f,g){let h={};if(e){const i=await e();i&&(h={["Authorization"]:`Bearer ${i}`})}const[j,k]=Da();h[j]=k,a.log(ba.Trace,`(${b} transport) sending data. ${qa(f,g.logMessageContent)}.`);const l=sa(f)?"arraybuffer":"text",m=await c.post(d,{content:f,headers:{...h,...g.headers},responseType:l,timeout:g.timeout,withCredentials:g.withCredentials});a.log(ba.Trace,`(${b} transport) request complete. Response status: ${m.statusCode}.`)}class ua{constructor(va,wa){this._subject=va,this._observer=wa}dispose(){const xa=this._subject.observers.indexOf(this._observer);xa> -1&&this._subject.observers.splice(xa,1),0===this._subject.observers.length&&this._subject.cancelCallback&&this._subject.cancelCallback().catch(a=>{})}}class ya{constructor(za){this._minLevel=za,this.out=console}log(Aa,Ba){if(Aa>=this._minLevel){const Ca=`[${new Date().toISOString()}] ${ba[Aa]}: ${Ba}`;switch(Aa){case ba.Critical:case ba.Error:this.out.error(Ca);break;case ba.Warning:this.out.warn(Ca);break;case ba.Information:this.out.info(Ca);break;default:this.out.log(Ca);break}}}}function Da(){let a="X-SignalR-User-Agent";return pa.isNode&&(a="User-Agent"),[a,Ea("6.0.4",Fa(),Ha(),Ga())]}function Ea(a,b,c,d){let e="Microsoft SignalR/";const f=a.split(".");return e+=`${f[0]}.${f[1]}`,e+=` (${a}; `,b&&""!==b?e+=`${b}; `:e+="Unknown OS; ",e+=`${c}`,d?e+=`; ${d}`:e+="; Unknown Runtime Version",e+=")"}function Fa(){if(!pa.isNode)return"";switch(ga.platform){case"win32":return"Windows NT";case"darwin":return"macOS";case"linux":return"Linux";default:return ga.platform}}function Ga(){if(pa.isNode)return ga.versions.node}function Ha(){return pa.isNode?"NodeJS":"Browser"}function Ia(a){return a.stack?a.stack:a.message?a.message:`${a}`}function Ja(a,b){let c;switch(b){case"arraybuffer":c=a.arrayBuffer();break;case"text":c=a.text();break;case"blob":case"document":case"json":throw new Error(`${b} is not supported.`);default:c=a.text();break}return c}class Ka{}Ka.Authorization="Authorization",Ka.Cookie="Cookie",(Y=ca||(ca={}
1))[Y.None=0]="None",Y[Y.WebSockets=1]="WebSockets",Y[Y.ServerSentEvents=2]="ServerSentEvents",Y[Y.LongPolling=4]="LongPolling",(Z=da||(da={}))[Z.Text=1]="Text",Z[Z.Binary=2]="Binary";class La{constructor(Ma,Na,Oa,Pa){this._httpClient=Ma,this._accessTokenFactory=Na,this._logger=Oa,this._pollAbort=new class{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}}(),this._options=Pa,this._running=!1,this.onreceive=null,this.onclose=null}get pollAborted(){return this._pollAbort.aborted}async connect(Qa,Ra){if(ha.isRequired(Qa,"url"),ha.isRequired(Ra,"transferFormat"),ha.isIn(Ra,da,"transferFormat"),this._url=Qa,this._logger.log(ba.Trace,"(LongPolling transport) Connecting."),Ra===da.Binary&&"undefined"!=typeof XMLHttpRequest&&"string"!=typeof new XMLHttpRequest().responseType)throw new Error("Binary protocols over XmlHttpRequest not implementing advanced features are not supported.");const[Sa,Ta]=Da(),Ua={[Sa]:Ta,...this._options.headers},Va={abortSignal:this._pollAbort.signal,headers:Ua,timeout:10e4,withCredentials:this._options.withCredentials};Ra===da.Binary&&(Va.responseType="arraybuffer");const Wa=await this._getAccessToken();this._updateHeaderToken(Va,Wa);const Xa=`${Qa}&_=${Date.now()}`;this._logger.log(ba.Trace,`(LongPolling transport) polling: ${Xa}.`);const Ya=await this._httpClient.get(Xa,Va);200!==Ya.statusCode?(this._logger.log(ba.Error,`(LongPolling transport) Unexpected response code: ${Ya.statusCode}.`),this._closeError=new g(Ya.statusText||"",Ya.statusCode),this._running=!1):this._running=!0,this._receiving=this._poll(this._url,Va)}async _getAccessToken(){return this._accessTokenFactory?await this._accessTokenFactory():null}_updateHeaderToken(Za,$a){if(Za.headers||(Za.headers={}),$a){Za.headers[Ka.Authorization]=`Bearer ${$a}`;return}Za.headers[Ka.Authorization]&&delete Za.headers[Ka.Authorization]}async _poll(_a,ab){try{for(;this._running;){const bb=await this._getAccessToken();this._updateHeaderToken(ab,bb);try{const cb=`${_a}&_=${Date.now()}`;this._logger.log(ba.Trace,`(LongPolling transport) polling: ${cb}.`);const db=await this._httpClient.get(cb,ab);204===db.statusCode?(this._logger.log(ba.Information,"(LongPolling transport) Poll terminated by server."),this._running=!1):200!==db.statusCode?(this._logger.log(ba.Error,`(LongPolling transport) Unexpected response code: ${db.statusCode}.`),this._closeError=new g(db.statusText||"",db.statusCode),this._running=!1):db.content?(this._logger.log(ba.Trace,`(LongPolling transport) data received. ${qa(db.content,this._options.logMessageContent)}.`),this.onreceive&&this.onreceive(db.content)):this._logger.log(ba.Trace,"(LongPolling transport) Poll timed out, reissuing.")}catch(eb){this._running?eb instanceof k?this._logger.log(ba.Trace,"(LongPolling transport) Poll timed out, reissuing."):(this._closeError=eb,this._running=!1):this._logger.log(ba.Trace,`(LongPolling transport) Poll errored after shutdown: ${eb.message}`)}}}finally{this._logger.log(ba.Trace,"(LongPolling transport) Polling complete."),this.pollAborted||this._raiseOnClose()}}async send(fb){return this._running?ta(this._logger,"LongPolling",this._httpClient,this._url,this._accessTokenFactory,fb,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}async stop(){this._logger.log(ba.Trace,"(LongPolling transport) Stopping polling."),this._running=!1,this._pollAbort.abort();try{await this._receiving,this._logger.log(ba.Trace,`(LongPolling transport) sending DELETE request to ${this._url}.`);const gb={},[hb,ib]=Da();gb[hb]=ib;const jb={headers:{...gb,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials},kb=await this._getAccessToken();this._updateHeaderToken(jb,kb),await this._httpClient.delete(this._url,jb),this._logger.log(ba.Trace,"(LongPolling transport) DELETE request sent.")}finally{this._logger.log(ba.Trace,"(LongPolling transport) Stop finished."),this._raiseOnClose()}}_raiseOnClose(){if(this.onclose){let lb="(LongPolling transport) Firing onclose event.";this._closeError&&(lb+=" Error: "+this._closeError),this._logger.log(ba.Trace,lb),this.onclose(this._closeError)}}}class mb{constructor(nb,ob,pb,qb){this._httpClient=nb,this._accessTokenFactory=ob,this._logger=pb,this._options=qb,this.onreceive=null,this.onclose
1=null}async connect(rb,sb){if(ha.isRequired(rb,"url"),ha.isRequired(sb,"transferFormat"),ha.isIn(sb,da,"transferFormat"),this._logger.log(ba.Trace,"(SSE transport) Connecting."),this._url=rb,this._accessTokenFactory){const tb=await this._accessTokenFactory();tb&&(rb+=(0>rb.indexOf("?")?"?":"&")+`access_token=${encodeURIComponent(tb)}`)}return new Promise((a,b)=>{let c=!1;if(sb!==da.Text){b(new Error("The Server-Sent Events transport only supports the 'Text' transfer format"));return}let d;if(pa.isBrowser||pa.isWebWorker)d=new this._options.EventSource(rb,{withCredentials:this._options.withCredentials});else{const e=this._httpClient.getCookieString(rb),f={};f.Cookie=e;const[g,h]=Da();f[g]=h,d=new this._options.EventSource(rb,{withCredentials:this._options.withCredentials,headers:{...f,...this._options.headers}})}try{d.onmessage=a=>{if(this.onreceive)try{this._logger.log(ba.Trace,`(SSE transport) data received. ${qa(a.data,this._options.logMessageContent)}.`),this.onreceive(a.data)}catch(b){this._close(b);return}},d.onerror=a=>{c?this._close():b(new 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."))},d.onopen=()=>{this._logger.log(ba.Information,`SSE connected to ${this._url}`),this._eventSource=d,c=!0,a()}}catch(i){b(i);return}})}async send(ub){return this._eventSource?ta(this._logger,"SSE",this._httpClient,this._url,this._accessTokenFactory,ub,this._options):Promise.reject(new Error("Cannot send until the transport is connected"))}stop(){return this._close(),Promise.resolve()}_close(vb){this._eventSource&&(this._eventSource.close(),this._eventSource=void 0,this.onclose&&this.onclose(vb))}}class wb{constructor(xb,yb,zb,Ab,Bb,Cb){this._logger=zb,this._accessTokenFactory=yb,this._logMessageContent=Ab,this._webSocketConstructor=Bb,this._httpClient=xb,this.onreceive=null,this.onclose=null,this._headers=Cb}async connect(Db,Eb){if(ha.isRequired(Db,"url"),ha.isRequired(Eb,"transferFormat"),ha.isIn(Eb,da,"transferFormat"),this._logger.log(ba.Trace,"(WebSockets transport) Connecting."),this._accessTokenFactory){const Fb=await this._accessTokenFactory();Fb&&(Db+=(0>Db.indexOf("?")?"?":"&")+`access_token=${encodeURIComponent(Fb)}`)}return new Promise((a,b)=>{Db=Db.replace(/^http/,"ws");let c;const d=this._httpClient.getCookieString(Db);let e=!1;if(pa.isNode){const f={},[g,h]=Da();f[g]=h,d&&(f[Ka.Cookie]=`${d}`),c=new this._webSocketConstructor(Db,void 0,{headers:{...f,...this._headers}})}c||(c=new this._webSocketConstructor(Db)),Eb===da.Binary&&(c.binaryType="arraybuffer"),c.onopen=b=>{this._logger.log(ba.Information,`WebSocket connected to ${Db}.`),this._webSocket=c,e=!0,a()},c.onerror=a=>{let b=null;b="undefined"!=typeof ErrorEvent&&a instanceof ErrorEvent?a.error:"There was an error with the transport",this._logger.log(ba.Information,`(WebSockets transport) ${b}.`)},c.onmessage=a=>{if(this._logger.log(ba.Trace,`(WebSockets transport) data received. ${qa(a.data,this._logMessageContent)}.`),this.onreceive)try{this.onreceive(a.data)}catch(b){this._close(b);return}},c.onclose=a=>{if(e)this._close(a);else{let c=null;c="undefined"!=typeof ErrorEvent&&a instanceof ErrorEvent?a.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.",b(new Error(c))}}})}send(Gb){return this._webSocket&&this._webSocket.readyState===this._webSocketConstructor.OPEN?(this._logger.log(ba.Trace,`(WebSockets transport) sending data. ${qa(Gb,this._logMessageContent)}.`),this._webSocket.send(Gb),Promise.resolve()):Promise.reject("WebSocket is not in the OPEN state")}stop(){return this._webSocket&&this._close(void 0),Promise.resolve()}_close(Hb){this._webSocket&&(this._webSocket.onclose=()=>{},this._webSocket.onmessage=()=>{},this._webSocket.onerror=()=>{},this._webSocket.close(),this._webSocket=void 0),this._logger.log(ba.Trace,"(WebSockets transport) socket closed."),this.onclose&&(this._isCloseEvent(Hb)&&(!1===Hb.wasClean||1000!==Hb.code)?this.onclose(new Error(`WebSocket closed with status code: ${Hb.code} (${Hb.reason||"no reason given"}).`)):Hb instanceof Error?this.onclose(Hb):this.onclose())}_isCloseEvent(Ib){return Ib&&"boolean"==typeof Ib.wasClean&&"number"==typeof Ib.code}}class Jb{constructor(Kb,Lb={}){var Mb;if(this._stopPromiseResolver=()=>{},this.features={},this._negotiateVersion=1,ha.isRequired(Kb,"url"),this._logger=void 0===(Mb=Lb.logger)?new ya(ba.Information):null===Mb?V.instance:void 0!==Mb.log?Mb:new ya(Mb),this.baseUrl=this._resolveUrl(Kb),(Lb=Lb||{}).logMessageContent=void 0!==Lb.logMessageContent&&Lb.logMessageContent,"boolean"==typeof Lb.withCredentials|| void 0===Lb.withCredentials)Lb.withCredentials=void 0===Lb.withCredentials||Lb.withCredentials;else throw new Error("withCredentials option was not a 'boolean' or 'undefined' value");Lb.timeout=void 0===Lb.timeout?10e4:Lb.timeout;let Nb=null,Ob=null;if(pa.isNode&&1){const Pb=require;Nb=Pb("ws"),Ob=Pb("eventsource")}pa.isNode||"undefined"==typeof WebSocket||Lb.WebSocket?pa.isNode&&!Lb.WebSocket&&Nb&&(Lb.WebSocket=Nb):Lb.WebSocket=WebSocket,pa.isNode||"undefined"==typeof EventSource||Lb.EventSource?pa.isNode&&!Lb.EventSource&& void 0!==Ob&&(Lb.EventSource=Ob):Lb.EventSource=EventSource,this._httpClient=Lb.httpClient||new class extends N{constructor(Qb){if(super(),"undefined"!=typeof fetch||pa.isNode)this._httpClient=new class extends N{constructor(Rb){if(super(),this._logger=Rb,"undefined"==typeof fetch){const Sb=require;this._jar=new(Sb("tough-cookie")).CookieJar(),this._fetchType=Sb("node-fetch"),this._fetchType=Sb("fetch-cookie")(this._fetchType,this._jar)}else this._fetchType=fetch.bind(function(){if("undefined"!=typeof globalThis)return globalThis;if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==c.g)return c.g;throw new Error("could not find global")}());if("undefined"==typeof AbortController){const Tb=require;this._abortControllerType=Tb("abort-controller")}else this._abortControllerType=AbortController}async send(Ub){if(Ub.abortSignal&&Ub.abortSignal.aborted)throw new n();if(!Ub.method)throw new Error("No method defined.");if(!Ub.url)throw new Error("No url defined.");const Vb=new this._abortControllerType();let Wb;Ub.abortSignal&&(Ub.abortSignal.onabort=()=>{Vb.abort(),Wb=new n()});let Xb=null;if(Ub.timeout){const Yb=Ub.timeout;Xb=setTimeout(()=>{Vb.abort(),this._logger.log(ba.Warning,"Timeout from HTTP request."),Wb=new k()},Yb)}let Zb;try{Zb=await this._fetchType(Ub.url,{body:Ub.content,cache:"no-cache",credentials:!0===Ub.withCredentials?"include":"same-origin",headers:{"Content-Type":"text/plain;charset=UTF-8","X-Requested-With":"XMLHttpRequest",...Ub.headers},method:Ub.method,mode:"cors",redirect:"follow",signal:Vb.signal})}catch($b){if(Wb)throw Wb;throw this._logger.log(ba.Warning,`Error from HTTP request. ${$b}.`),$b}finally{Xb&&clearTimeout(Xb),Ub.abortSignal&&(Ub.abortSignal.onabort=null)}if(!Zb.ok){const _b=await Ja(Zb,"text");throw new g(_b||Zb.statusText,Zb.status)}const ac=Ja(Zb,Ub.responseType),bc=await ac;
1return new J(Zb.status,Zb.statusText,bc)}getCookieString(cc){let dc="";return pa.isNode&&this._jar&&this._jar.getCookies(cc,(a,b)=>dc=b.join("; ")),dc}}(Qb);else if("undefined"!=typeof XMLHttpRequest)this._httpClient=new class extends N{constructor(ec){super(),this._logger=ec}send(fc){return fc.abortSignal&&fc.abortSignal.aborted?Promise.reject(new n()):fc.method?fc.url?new Promise((a,b)=>{const c=new XMLHttpRequest();c.open(fc.method,fc.url,!0),c.withCredentials=void 0===fc.withCredentials||fc.withCredentials,c.setRequestHeader("X-Requested-With","XMLHttpRequest"),c.setRequestHeader("Content-Type","text/plain;charset=UTF-8");const d=fc.headers;d&&Object.keys(d).forEach(a=>{c.setRequestHeader(a,d[a])}),fc.responseType&&(c.responseType=fc.responseType),fc.abortSignal&&(fc.abortSignal.onabort=()=>{c.abort(),b(new n())}),fc.timeout&&(c.timeout=fc.timeout),c.onload=()=>{fc.abortSignal&&(fc.abortSignal.onabort=null),c.status>=200&&c.status<300?a(new J(c.status,c.statusText,c.response||c.responseText)):b(new g(c.response||c.responseText||c.statusText,c.status))},c.onerror=()=>{this._logger.log(ba.Warning,`Error from HTTP request. ${c.status}: ${c.statusText}.`),b(new g(c.statusText,c.status))},c.ontimeout=()=>{this._logger.log(ba.Warning,"Timeout from HTTP request."),b(new k())},c.send(fc.content||"")}):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}}(Qb);else throw new Error("No usable HttpClient found.")}send(gc){return gc.abortSignal&&gc.abortSignal.aborted?Promise.reject(new n()):gc.method?gc.url?this._httpClient.send(gc):Promise.reject(new Error("No url defined.")):Promise.reject(new Error("No method defined."))}getCookieString(hc){return this._httpClient.getCookieString(hc)}}(this._logger),this._connectionState="Disconnected",this._connectionStarted=!1,this._options=Lb,this.onreceive=null,this.onclose=null}async start(ic){if(ic=ic||da.Binary,ha.isIn(ic,da,"transferFormat"),this._logger.log(ba.Debug,`Starting connection with transfer format '${da[ic]}'.`),"Disconnected"!==this._connectionState)return Promise.reject(new Error("Cannot start an HttpConnection that is not in the 'Disconnected' state."));if(this._connectionState="Connecting",this._startInternalPromise=this._startInternal(ic),await this._startInternalPromise,"Disconnecting"===this._connectionState){const jc="Failed to start the HttpConnection before stop() was called.";return this._logger.log(ba.Error,jc),await this._stopPromise,Promise.reject(new Error(jc))}if("Connected"!==this._connectionState){const kc="HttpConnection.startInternal completed gracefully but didn't enter the connection into the connected state!";return this._logger.log(ba.Error,kc),Promise.reject(new Error(kc))}this._connectionStarted=!0}send(lc){return"Connected"!==this._connectionState?Promise.reject(new Error("Cannot send data if the connection is not in the 'Connected' State.")):(this._sendQueue||(this._sendQueue=new ld(this.transport)),this._sendQueue.send(lc))}async stop(mc){return"Disconnected"===this._connectionState?(this._logger.log(ba.Debug,`Call to HttpConnection.stop(${mc}) ignored because the connection is already in the disconnected state.`),Promise.resolve()):"Disconnecting"===this._connectionState?(this._logger.log(ba.Debug,`Call to HttpConnection.stop(${mc}) ignored because the connection is already in the disconnecting state.`),this._stopPromise):void(this._connectionState="Disconnecting",this._stopPromise=new Promise(a=>{this._stopPromiseResolver=a}),await this._stopInternal(mc),await this._stopPromise)}async _stopInternal(nc){this._stopError=nc;try{await this._startInternalPromise}catch(oc){}if(this.transport){try{await this.transport.stop()}catch(pc){this._logger.log(ba.Error,`HttpConnection.transport.stop() threw error '${pc}'.`),this._stopConnection()}this.transport=void 0}else this._logger.log(ba.Debug,"HttpConnection.transport is undefined in HttpConnection.stop() because start() failed.")}async _startInternal(qc){let rc=this.baseUrl;this._accessTokenFactory=this._options.accessTokenFactory;try{if(this._options.skipNegotiation)if(this._options.transport===ca.WebSockets)this.transport=this._constructTrans
1port(ca.WebSockets),await this._startTransport(rc,qc);else throw new Error("Negotiation can only be skipped when using the WebSocket transport directly.");else{let sc=null,tc=0;do{if(sc=await this._getNegotiationResponse(rc),"Disconnecting"===this._connectionState||"Disconnected"===this._connectionState)throw new Error("The connection was stopped during negotiation.");if(sc.error)throw new Error(sc.error);if(sc.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.");if(sc.url&&(rc=sc.url),sc.accessToken){const uc=sc.accessToken;this._accessTokenFactory=()=>uc}tc++}while(sc.url&&tc<100)if(100===tc&&sc.url)throw new Error("Negotiate redirection limit exceeded.");await this._createTransport(rc,this._options.transport,sc,qc)}this.transport instanceof La&&(this.features.inherentKeepAlive=!0),"Connecting"===this._connectionState&&(this._logger.log(ba.Debug,"The HttpConnection connected successfully."),this._connectionState="Connected")}catch(vc){return this._logger.log(ba.Error,"Failed to start the connection: "+vc),this._connectionState="Disconnected",this.transport=void 0,this._stopPromiseResolver(),Promise.reject(vc)}}async _getNegotiationResponse(wc){const xc={};if(this._accessTokenFactory){const yc=await this._accessTokenFactory();yc&&(xc[Ka.Authorization]=`Bearer ${yc}`)}const[zc,Ac]=Da();xc[zc]=Ac;const Bc=this._resolveNegotiateUrl(wc);this._logger.log(ba.Debug,`Sending negotiation request: ${Bc}.`);try{const Cc=await this._httpClient.post(Bc,{content:"",headers:{...xc,...this._options.headers},timeout:this._options.timeout,withCredentials:this._options.withCredentials});if(200!==Cc.statusCode)return Promise.reject(new Error(`Unexpected status code returned from negotiate '${Cc.statusCode}'`));const Dc=JSON.parse(Cc.content);return(!Dc.negotiateVersion||Dc.negotiateVersion<1)&&(Dc.connectionToken=Dc.connectionId),Dc}catch(Ec){let Fc="Failed to complete negotiation with the server: "+Ec;return Ec instanceof g&&404===Ec.statusCode&&(Fc+=" Either this is not a SignalR endpoint or there is a proxy blocking the connection."),this._logger.log(ba.Error,Fc),Promise.reject(new C(Fc))}}_createConnectUrl(Gc,Hc){return Hc?Gc+(-1===Gc.indexOf("?")?"?":"&")+`id=${Hc}`:Gc}async _createTransport(Ic,Jc,Kc,Lc){let Mc=this._createConnectUrl(Ic,Kc.connectionToken);if(this._isITransport(Jc)){this._logger.log(ba.Debug,"Connection was provided an instance of ITransport, using that directly."),this.transport=Jc,await this._startTransport(Mc,Lc),this.connectionId=Kc.connectionId;return}const Nc=[],Oc=Kc.availableTransports||[];let Pc=Kc;for(const Qc of Oc){const Rc=this._resolveTransportOrError(Qc,Jc,Lc);if(Rc instanceof Error)Nc.push(`${Qc.transport} failed:`),Nc.push(Rc);else if(this._isITransport(Rc)){if(this.transport=Rc,!Pc){try{Pc=await this._getNegotiationResponse(Ic)}catch(Sc){return Promise.reject(Sc)}Mc=this._createConnectUrl(Ic,Pc.connectionToken)}try{await this._startTransport(Mc,Lc),this.connectionId=Pc.connectionId;return}catch(Tc){if(this._logger.log(ba.Error,`Failed to start the transport '${Qc.transport}': ${Tc}`),Pc=void 0,Nc.push(new y(`${Qc.transport} failed: ${Tc}`,ca[Qc.transport])),"Connecting"!==this._connectionState){const Uc="Failed to select transport before stop() was called.";return this._logger.log(ba.Debug,Uc),Promise.reject(new Error(Uc))}}}}return Nc.length>0?Promise.reject(new F(`Unable to connect to the server with any of the available transports. ${Nc.join(" ")}`,Nc)):Promise.reject(new Error("None of the transports supported by the client are supported by the server."))}_constructTransport(Vc){switch(Vc){case ca.WebSockets:if(!this._options.WebSocket)throw new Error("'WebSocket' is not supported in your environment.");return new wb(this._httpClient,this._accessTokenFactory,this._logger,this._options.logMessageContent,this._options.WebSocket,this._options.headers||{});case ca.ServerSentEvents:if(!this._options.EventSource)throw new Error("'EventSource' is not supported in your environment.");return new mb(this._httpClient,this._accessTokenFactory,this._logger,this._options);
1case ca.LongPolling:return new La(this._httpClient,this._accessTokenFactory,this._logger,this._options);default:throw new Error(`Unknown transport: ${Vc}.`)}}_startTransport(Wc,Xc){return this.transport.onreceive=this.onreceive,this.transport.onclose=a=>this._stopConnection(a),this.transport.connect(Wc,Xc)}_resolveTransportOrError(Yc,Zc,$c){const _c=ca[Yc.transport];if(null==_c)return this._logger.log(ba.Debug,`Skipping transport '${Yc.transport}' because it is not supported by this client.`),new Error(`Skipping transport '${Yc.transport}' because it is not supported by this client.`);if(!kd(Zc,_c))return this._logger.log(ba.Debug,`Skipping transport '${ca[_c]}' because it was disabled by the client.`),new u(`'${ca[_c]}' is disabled by the client.`,_c);{const ad=Yc.transferFormats.map(a=>da[a]);if(!(ad.indexOf($c)>=0))return this._logger.log(ba.Debug,`Skipping transport '${ca[_c]}' because it does not support the requested transfer format '${da[$c]}'.`),new Error(`'${ca[_c]}' does not support ${da[$c]}.`);if(_c===ca.WebSockets&&!this._options.WebSocket||_c===ca.ServerSentEvents&&!this._options.EventSource)return this._logger.log(ba.Debug,`Skipping transport '${ca[_c]}' because it is not supported in your environment.'`),new q(`'${ca[_c]}' is not supported in your environment.`,_c);this._logger.log(ba.Debug,`Selecting transport '${ca[_c]}'.`);try{return this._constructTransport(_c)}catch(bd){return bd}}}_isITransport(cd){return cd&&"object"==typeof cd&&"connect"in cd}_stopConnection(dd){if(this._logger.log(ba.Debug,`HttpConnection.stopConnection(${dd}) called while in state ${this._connectionState}.`),this.transport=void 0,dd=this._stopError||dd,this._stopError=void 0,"Disconnected"===this._connectionState){this._logger.log(ba.Debug,`Call to HttpConnection.stopConnection(${dd}) was ignored because the connection is already in the disconnected state.`);return}if("Connecting"===this._connectionState)throw this._logger.log(ba.Warning,`Call to HttpConnection.stopConnection(${dd}) was ignored because the connection is still in the connecting state.`),new Error(`HttpConnection.stopConnection(${dd}) was called while the connection is still in the connecting state.`);if("Disconnecting"===this._connectionState&&this._stopPromiseResolver(),dd?this._logger.log(ba.Error,`Connection disconnected with error '${dd}'.`):this._logger.log(ba.Information,"Connection disconnected."),this._sendQueue&&(this._sendQueue.stop().catch(a=>{this._logger.log(ba.Error,`TransportSendQueue.stop() threw error '${a}'.`)}),this._sendQueue=void 0),this.connectionId=void 0,this._connectionState="Disconnected",this._connectionStarted){this._connectionStarted=!1;try{this.onclose&&this.onclose(dd)}catch(ed){this._logger.log(ba.Error,`HttpConnection.onclose(${dd}) threw error '${ed}'.`)}}}_resolveUrl(fd){if(0===fd.lastIndexOf("https://",0)||0===fd.lastIndexOf("http://",0))return fd;if(!pa.isBrowser)throw new Error(`Cannot resolve '${fd}'.`);const gd=window.document.createElement("a");return gd.href=fd,this._logger.log(ba.Information,`Normalizing '${fd}' to '${gd.href}'.`),gd.href}_resolveNegotiateUrl(hd){const id=hd.indexOf("?");let jd=hd.substring(0,-1===id?hd.length:id);return"/"!==jd[jd.length-1]&&(jd+="/"),jd+="negotiate",-1===(jd+=-1===id?"":hd.substring(id)).indexOf("negotiateVersion")&&(jd+=-1===id?"?":"&",jd+="negotiateVersion="+this._negotiateVersion),jd}}function kd(a,b){return!a||(b&a)!=0}class ld{constructor(md){this._transport=md,this._buffer=[],this._executing=!0,this._sendBufferedData=new xd(),this._transportResult=new xd(),this._sendLoopPromise=this._sendLoop()}send(nd){return this._bufferData(nd),this._transportResult||(this._transportResult=new xd()),this._transportResult.promise}stop(){return this._executing=!1,this._sendBufferedData.resolve(),this._sendLoopPromise}_bufferData(od){if(this._buffer.length&& typeof this._buffer[0]!=typeof od)throw new Error(`Expected data to be of type ${typeof this._buffer} but was of type ${typeof od}`);this._buffer.push(od),this._sendBufferedData.resolve()}async _sendLoop(){for(;;){if(await this._sendBufferedData.promise,!this._executing){this._transportResult&&this._transportResult.reject("Connection stopped.");break}this._sendBufferedData=new xd();const pd=this._transportResult;this._transportResult=void 0;const qd="string"==typeof this._buffer[0]?this._buffer.join(""):ld._concatBuffers(this._buffer);this._buffer.length=0;try{await this._transport.send(qd),pd.resolve()}catch(rd){pd.reject(rd)}}}static _concatBuffers(sd){const td=sd.map(a=>a.byteLength).reduce((a,b)=>a+b),ud=new Uint8Array(td);let vd=0;for(const wd of sd)ud.set(new Uint8Array(wd),vd),vd+=wd.byteLength;return ud.buffer}}class xd{constructor(){this.promise=new Promise((a,b)=>([this._resolver,this._rejecter]=[a,b]))}resolve(){this._resolver()}reject(yd){this._rejecter(yd)}}class zd{static write(Ad){return`${Ad}${zd.RecordSeparator}`}static parse(Bd){if(Bd[Bd.length-1]!==zd.RecordSeparator)throw new Error("Message is incomplete.");const Cd=Bd.split(zd.RecordSeparator);return Cd.pop(),Cd}}zd.RecordSeparatorCode=30,zd.RecordSeparator=String.fromCharCode(zd.RecordSeparatorCode),($=ea||(ea={}))[$.Invocation=1]="Invocation",$[$.StreamItem=2]="StreamItem",$[$.Completion=3]="Completion",$[$.StreamInvocation=4]="StreamInvocation",$[$.CancelInvocation=5]="CancelInvocation",$[$.Ping=6]="Ping",$[$.Close=7]="Close";class Dd{constructor(){this.observers=[]}next(Ed){for(const Fd of this.observers)Fd.next(Ed)}error(Gd){for(const Hd of this.observers)Hd.error&&Hd.error(Gd)}complete(){for(const Id of this.observers)Id.complete&&Id.complete()}subscribe(Jd){return this.observers.push(Jd),new ua(this,Jd)}}(_=fa||(fa={})).Disconnected="Disconnected",_.Connecting="Connecting",_.Connected="Connected",_.Disconnecting="Disconnecting",_.Reconnecting="Reconnecting";class Kd{constructor(Ld,Md,Nd,Od){this._nextKeepAlive=0,this._freezeEventListener=()=>{this._logger.log(ba.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")},ha.isRequired(Ld,"connection"),ha.isRequired(Md,"logger"),ha.isRequired(Nd,"protocol"),this.serverTimeoutInMilliseconds=30e3,this.keepAliveIntervalInMilliseconds=15000,this._logger=Md,this._protocol=Nd,this.connection=Ld,this._reconnectPolicy=Od,this._handshakeProtocol=new class{writeHandshakeRequest
1(Pd){return zd.write(JSON.stringify(Pd))}parseHandshakeResponse(Qd){let Rd,Sd;if(sa(Qd)){const Td=new Uint8Array(Qd),Ud=Td.indexOf(zd.RecordSeparatorCode);if(-1===Ud)throw new Error("Message is incomplete.");const Vd=Ud+1;Rd=String.fromCharCode.apply(null,Array.prototype.slice.call(Td.slice(0,Vd))),Sd=Td.byteLength>Vd?Td.slice(Vd).buffer:null}else{const Wd=Qd,Xd=Wd.indexOf(zd.RecordSeparator);if(-1===Xd)throw new Error("Message is incomplete.");const Yd=Xd+1;Rd=Wd.substring(0,Yd),Sd=Wd.length>Yd?Wd.substring(Yd):null}const Zd=zd.parse(Rd),$d=JSON.parse(Zd[0]);if($d.type)throw new Error("Expected a handshake response from the server.");return[Sd,$d]}}(),this.connection.onreceive=a=>this._processIncomingData(a),this.connection.onclose=a=>this._connectionClosed(a),this._callbacks={},this._methods={},this._closedCallbacks=[],this._reconnectingCallbacks=[],this._reconnectedCallbacks=[],this._invocationId=0,this._receivedHandshakeResponse=!1,this._connectionState=fa.Disconnected,this._connectionStarted=!1,this._cachedPingMessage=this._protocol.writeMessage({type:ea.Ping})}static create(_d,ae,be,ce){return new Kd(_d,ae,be,ce)}get state(){return this._connectionState}get connectionId(){return this.connection?this.connection.connectionId||null:null}get baseUrl(){return this.connection.baseUrl||""}set baseUrl(de){if(this._connectionState!==fa.Disconnected&&this._connectionState!==fa.Reconnecting)throw new Error("The HubConnection must be in the Disconnected or Reconnecting state to change the url.");if(!de)throw new Error("The HubConnection url must be a valid url.");this.connection.baseUrl=de}start(){return this._startPromise=this._startWithStateTransitions(),this._startPromise}async _startWithStateTransitions(){if(this._connectionState!==fa.Disconnected)return Promise.reject(new Error("Cannot start a HubConnection that is not in the 'Disconnected' state."));this._connectionState=fa.Connecting,this._logger.log(ba.Debug,"Starting HubConnection.");try{await this._startInternal(),pa.isBrowser&&window.document.addEventListener("freeze",this._freezeEventListener),this._connectionState=fa.Connected,this._connectionStarted=!0,this._logger.log(ba.Debug,"HubConnection connected successfully.")}catch(ee){return this._connectionState=fa.Disconnected,this._logger.log(ba.Debug,`HubConnection failed to start successfully because of error '${ee}'.`),Promise.reject(ee)}}async _startInternal(){this._stopDuringStartError=void 0,this._receivedHandshakeResponse=!1;const fe=new Promise((a,b)=>{this._handshakeResolver=a,this._handshakeRejecter=b});await this.connection.start(this._protocol.transferFormat);try{const ge={protocol:this._protocol.name,version:this._protocol.version};if(this._logger.log(ba.Debug,"Sending handshake request."),await this._sendMessage(this._handshakeProtocol.writeHandshakeRequest(ge)),this._logger.log(ba.Information,`Using HubProtocol '${this._protocol.name}'.`),this._cleanupTimeout(),this._resetTimeoutPeriod(),this._resetKeepAliveInterval(),await fe,this._stopDuringStartError)throw this._stopDuringStartError}catch(he){throw this._logger.log(ba.Debug,`Hub handshake failed with error '${he}' during start(). Stopping HubConnection.`),this._cleanupTimeout(),this._cleanupPingTimer(),await this.connection.stop(he),he}}async stop(){const ie=this._startPromise;this._stopPromise=this._stopInternal(),await this._stopPromise;try{await ie}catch(je){}}_stopInternal(ke){return this._connectionState===fa.Disconnected?(this._logger.log(ba.Debug,`Call to HubConnection.stop(${ke}) ignored because it is already in the disconnected state.`),Promise.resolve()):this._connectionState===fa.Disconnecting?(this._logger.log(ba.Debug,`Call to HttpConnection.stop(${ke}) ignored because the connection is already in the disconnecting state.`),this._stopPromise):(this._connectionState=fa.Disconnecting,this._logger.log(ba.Debug,"Stopping HubConnection."),this._reconnectDelayHandle)?(this._logger.log(ba.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=ke||new Error("The connection was stopped before the hub handshake could complete."),this.connection.stop(ke))}stream(le,...me){const[ne,oe]=this._replaceStreamingParams(me),pe=this._createStreamInvocation(le,me,oe);let qe;const re=new Dd();return re.cancelCallback=()=>{const a=this._createCancelInvocation(pe.invocationId);return delete this._callbacks[pe.invocationId],qe.then(()=>this._sendWithProtocol(a))},this._callbacks[pe.invocationId]=(a,b)=>{if(b){re.error(b);return}a&&(a.type===ea.Completion?a.error?re.error(new Error(a.error)):re.complete():re.next(a.item))},qe=this._sendWithProtocol(pe).catch(a=>{re.error(a),delete this._callbacks[pe.invocationId]}),this._launchStreams(ne,qe),re}_sendMessage(se){return this._resetKeepAliveInterval(),this.connection.send(se)}_sendWithProtocol(te){return this._sendMessage(this._protocol.writeMessage(te))}send(ue,...ve){const[we,xe]=this._replaceStreamingParams(ve),ye=this._sendWithProtocol(this._createInvocation(ue,ve,!0,xe));return this._launchStreams(we,ye),ye}invoke(ze,...Ae){const[Be,Ce]=this._replaceStreamingParams(Ae),De=this._createInvocation(ze,Ae,!1,Ce),Ee=new Promise((a,b)=>{this._callbacks[De.invocationId]=(c,d)=>
1{if(d){b(d);return}c&&(c.type===ea.Completion?c.error?b(new Error(c.error)):a(c.result):b(new Error(`Unexpected message type: ${c.type}`)))};const c=this._sendWithProtocol(De).catch(a=>{b(a),delete this._callbacks[De.invocationId]});this._launchStreams(Be,c)});return Ee}on(Fe,Ge){Fe&&Ge&&(Fe=Fe.toLowerCase(),this._methods[Fe]||(this._methods[Fe]=[]),-1===this._methods[Fe].indexOf(Ge)&&this._methods[Fe].push(Ge))}off(He,Ie){if(He){He=He.toLowerCase();const Je=this._methods[He];if(Je)if(Ie){const Ke=Je.indexOf(Ie);-1!==Ke&&(Je.splice(Ke,1),0===Je.length&&delete this._methods[He])}else delete this._methods[He]}}onclose(Le){Le&&this._closedCallbacks.push(Le)}onreconnecting(Me){Me&&this._reconnectingCallbacks.push(Me)}onreconnected(Ne){Ne&&this._reconnectedCallbacks.push(Ne)}_processIncomingData(Oe){if(this._cleanupTimeout(),this._receivedHandshakeResponse||(Oe=this._processHandshakeResponse(Oe),this._receivedHandshakeResponse=!0),Oe){const Pe=this._protocol.parseMessages(Oe,this._logger);for(const Qe of Pe)switch(Qe.type){case ea.Invocation:this._invokeClientMethod(Qe);break;case ea.StreamItem:case ea.Completion:{const Re=this._callbacks[Qe.invocationId];if(Re){Qe.type===ea.Completion&&delete this._callbacks[Qe.invocationId];try{Re(Qe)}catch(Se){this._logger.log(ba.Error,`Stream callback threw error: ${Ia(Se)}`)}}break}case ea.Ping:break;case ea.Close:{this._logger.log(ba.Information,"Close message received from server.");const Te=Qe.error?new Error("Server returned an error on close: "+Qe.error):void 0;!0===Qe.allowReconnect?this.connection.stop(Te):this._stopPromise=this._stopInternal(Te);break}default:this._logger.log(ba.Warning,`Invalid message type: ${Qe.type}.`);break}}this._resetTimeoutPeriod()}_processHandshakeResponse(Ue){let Ve,We;try{[We,Ve]=this._handshakeProtocol.parseHandshakeResponse(Ue)}catch(Xe){const Ye="Error parsing handshake response: "+Xe;this._logger.log(ba.Error,Ye);const Ze=new Error(Ye);throw this._handshakeRejecter(Ze),Ze}if(Ve.error){const $e="Server returned handshake error: "+Ve.error;this._logger.log(ba.Error,$e);const _e=new Error($e);throw this._handshakeRejecter(_e),_e}return this._logger.log(ba.Debug,"Server handshake complete."),this._handshakeResolver(),We}_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 af=this._nextKeepAlive-new Date().getTime();af<0&&(af=0),this._pingServerHandle=setTimeout(async()=>{if(this._connectionState===fa.Connected)try{await this._sendMessage(this._cachedPingMessage)}catch{this._cleanupPingTimer()}},af)}}serverTimeout(){this.connection.stop(new Error("Server timeout elapsed without receiving a message from the server."))}_invokeClientMethod(bf){const cf=this._methods[bf.target.toLowerCase()];if(cf){try{cf.forEach(a=>a.apply(this,bf.arguments))}catch(df){this._logger.log(ba.Error,`A callback for the method ${bf.target.toLowerCase()} threw error '${df}'.`)}if(bf.invocationId){const ef="Server requested a response, which is not supported in this version of the client.";this._logger.log(ba.Error,ef),this._stopPromise=this._stopInternal(new Error(ef))}}else this._logger.log(ba.Warning,`No client method with the name '${bf.target}' found.`)}_connectionClosed(ff){this._logger.log(ba.Debug,`HubConnection.connectionClosed(${ff}) called while in state ${this._connectionState}.`),this._stopDuringStartError=this._stopDuringStartError||ff||new Error("The underlying connection was closed before the hub handshake could complete."),this._handshakeResolver&&this._handshakeResolver(),this._cancelCallbacksWithError(ff||new Error("Invocation canceled due to the underlying connection being closed.")),this._cleanupTimeout(),this._cleanupPingTimer(),this._connectionState===fa.Disconnecting?this._completeClose(ff):this._connectionState===fa.C
1onnected&&this._reconnectPolicy?this._reconnect(ff):this._connectionState===fa.Connected&&this._completeClose(ff)}_completeClose(gf){if(this._connectionStarted){this._connectionState=fa.Disconnected,this._connectionStarted=!1,pa.isBrowser&&window.document.removeEventListener("freeze",this._freezeEventListener);try{this._closedCallbacks.forEach(a=>a.apply(this,[gf]))}catch(hf){this._logger.log(ba.Error,`An onclose callback called with error '${gf}' threw error '${hf}'.`)}}}async _reconnect(jf){const kf=Date.now();let lf=0,mf=void 0!==jf?jf:new Error("Attempting to reconnect due to a unknown error."),nf=this._getNextRetryDelay(lf++,0,mf);if(null===nf){this._logger.log(ba.Debug,"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt."),this._completeClose(jf);return}if(this._connectionState=fa.Reconnecting,jf?this._logger.log(ba.Information,`Connection reconnecting because of error '${jf}'.`):this._logger.log(ba.Information,"Connection reconnecting."),0!==this._reconnectingCallbacks.length){try{this._reconnectingCallbacks.forEach(a=>a.apply(this,[jf]))}catch(of){this._logger.log(ba.Error,`An onreconnecting callback called with error '${jf}' threw error '${of}'.`)}if(this._connectionState!==fa.Reconnecting){this._logger.log(ba.Debug,"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.");return}}for(;null!==nf;){if(this._logger.log(ba.Information,`Reconnect attempt number ${lf} will start in ${nf} ms.`),await new Promise(a=>{this._reconnectDelayHandle=setTimeout(a,nf)}),this._reconnectDelayHandle=void 0,this._connectionState!==fa.Reconnecting){this._logger.log(ba.Debug,"Connection left the reconnecting state during reconnect delay. Done reconnecting.");return}try{if(await this._startInternal(),this._connectionState=fa.Connected,this._logger.log(ba.Information,"HubConnection reconnected successfully."),0!==this._reconnectedCallbacks.length)try{this._reconnectedCallbacks.forEach(a=>a.apply(this,[this.connection.connectionId]))}catch(pf){this._logger.log(ba.Error,`An onreconnected callback called with connectionId '${this.connection.connectionId}; threw error '${pf}'.`)}return}catch(qf){if(this._logger.log(ba.Information,`Reconnect attempt failed because of error '${qf}'.`),this._connectionState!==fa.Reconnecting){this._logger.log(ba.Debug,`Connection moved to the '${this._connectionState}' from the reconnecting state during reconnect attempt. Done reconnecting.`),this._connectionState===fa.Disconnecting&&this._completeClose();return}mf=qf instanceof Error?qf:new Error(qf.toString()),nf=this._getNextRetryDelay(lf++,Date.now()-kf,mf)}}this._logger.log(ba.Information,`Reconnect retries have been exhausted after ${Date.now()-kf} ms and ${lf} failed attempts. Connection disconnecting.`),this._completeClose()}_getNextRetryDelay(rf,sf,tf){try{return this._reconnectPolicy.nextRetryDelayInMilliseconds({elapsedMilliseconds:sf,previousRetryCount:rf,retryReason:tf})}catch(uf){return this._logger.log(ba.Error,`IRetryPolicy.nextRetryDelayInMilliseconds(${rf}, ${sf}) threw error '${uf}'.`),null}}_cancelCallbacksWithError(vf){const wf=this._callbacks;this._callbacks={},Object.keys(wf).forEach(a=>{const b=wf[a];try{b(null,vf)}catch(c){this._logger.log(ba.Error,`Stream 'error' callback called with '${vf}' threw error: ${Ia(c)}`)}})}_cleanupPingTimer(){this._pingServerHandle&&(clearTimeout(this._pingServerHandle),this._pingServerHandle=void 0)}_cleanupTimeout(){this._timeoutHandle&&clearTimeout(this._timeoutHandle)}_createInvocation(xf,yf,zf,Af){if(zf)return 0!==Af.length?{arguments:yf,streamIds:Af,target:xf,type:ea.Invocation}:{arguments:yf,target:xf,type:ea.Invocation};{const Bf=this._invocationId;return(this._invocationId++,0!==Af.length)?{arguments:yf,invocationId:Bf.toString(),streamIds:Af,target:xf,type:ea.Invocation}:{arguments:yf,invocationId:Bf.toString(),target:xf,type:ea.Invocation}}}_launchStreams(Cf,Df){if(0!==Cf.length)for(const Ef in Df||(Df=Promise.resolve()),Cf)Cf[Ef].subscribe({complete:()=>{Df=Df.then(()=>this._sendWithProtocol(this._createCompletionMessage(Ef)))},error:a=>{let b;b=a instanceof Error?a.message:a&&a.toString?a.toString():"Unknown error",Df=Df.then(()=>this._sendWithProtocol(this._createCompletionMessage(Ef,b)))},next:a=>{Df=Df.then(()=>this._sendWithProtocol(this._createStreamItemMessage(Ef,a)))}})}_replaceStreamingParams(Ff){const Gf=[],Hf=[];for(let If=0;If<Ff.length;If++){const Jf=Ff[If];if(this._isObservable(Jf)){const Kf=this._invocationId;this._invocationId++,Gf[Kf]=Jf,Hf.push(Kf.toString()),Ff.splice(If,1)}}return[Gf,Hf]}_isObservable(Lf){return Lf&&Lf.subscribe&&"function"==typeof Lf.subscribe}_createStreamInvocation(Mf,Nf,Of){const Pf=this._invocationId;
1return(this._invocationId++,0!==Of.length)?{arguments:Nf,invocationId:Pf.toString(),streamIds:Of,target:Mf,type:ea.StreamInvocation}:{arguments:Nf,invocationId:Pf.toString(),target:Mf,type:ea.StreamInvocation}}_createCancelInvocation(Qf){return{invocationId:Qf,type:ea.CancelInvocation}}_createStreamItemMessage(Rf,Sf){return{invocationId:Rf,item:Sf,type:ea.StreamItem}}_createCompletionMessage(Tf,Uf,Vf){return Uf?{error:Uf,invocationId:Tf,type:ea.Completion}:{invocationId:Tf,result:Vf,type:ea.Completion}}}class Wf{constructor(){this.name="json",this.version=1,this.transferFormat=da.Text}parseMessages(Xf,Yf){if("string"!=typeof Xf)throw new Error("Invalid input for JSON hub protocol. Expected a string.");if(!Xf)return[];null===Yf&&(Yf=V.instance);const Zf=zd.parse(Xf),$f=[];for(const _f of Zf){const ag=JSON.parse(_f);if("number"!=typeof ag.type)throw new Error("Invalid payload.");switch(ag.type){case ea.Invocation:this._isInvocationMessage(ag);break;case ea.StreamItem:this._isStreamItemMessage(ag);break;case ea.Completion:this._isCompletionMessage(ag);break;case ea.Ping:break;case ea.Close:break;default:Yf.log(ba.Information,"Unknown message type '"+ag.type+"' ignored.");continue}$f.push(ag)}return $f}writeMessage(bg){return zd.write(JSON.stringify(bg))}_isInvocationMessage(cg){this._assertNotEmptyString(cg.target,"Invalid payload for Invocation message."),void 0!==cg.invocationId&&this._assertNotEmptyString(cg.invocationId,"Invalid payload for Invocation message.")}_isStreamItemMessage(dg){if(this._assertNotEmptyString(dg.invocationId,"Invalid payload for StreamItem message."),void 0===dg.item)throw new Error("Invalid payload for StreamItem message.")}_isCompletionMessage(eg){if(eg.result&&eg.error)throw new Error("Invalid payload for Completion message.");!eg.result&&eg.error&&this._assertNotEmptyString(eg.error,"Invalid payload for Completion message."),this._assertNotEmptyString(eg.invocationId,"Invalid payload for Completion message.")}_assertNotEmptyString(fg,gg){if("string"!=typeof fg||""===fg)throw new Error(gg)}}const hg={trace:ba.Trace,debug:ba.Debug,info:ba.Information,information:ba.Information,warn:ba.Warning,warning:ba.Warning,error:ba.Error,critical:ba.Critical,none:ba.None};class ig{configureLogging(jg){if(ha.isRequired(jg,"logging"),rg(jg))this.logger=jg;else if("string"==typeof jg){const kg=function(a){const b=hg[a.toLowerCase()];if(void 0!==b)return b;throw new Error(`Unknown log level: ${a}`)}(jg);this.logger=new ya(kg)}else this.logger=new ya(jg);return this}withUrl(lg,mg){return ha.isRequired(lg,"url"),ha.isNotEmpty(lg,"url"),this.url=lg,"object"==typeof mg?this.httpConnectionOptions={...this.httpConnectionOptions,...mg}:this.httpConnectionOptions={...this.httpConnectionOptions,transport:mg},this}withHubProtocol(ng){return ha.isRequired(ng,"protocol"),this.protocol=ng,this}withAutomaticReconnect(og){if(this.reconnectPolicy)throw new Error("A reconnectPolicy has already been set.");return og?Array.isArray(og)?this.reconnectPolicy=new d(og):this.reconnectPolicy=og:this.reconnectPolicy=new d(),this}build(){const pg=this.httpConnectionOptions||{};if(void 0===pg.logger&&(pg.logger=this.logger),!this.url)throw new Error("The 'HubConnectionBuilder.withUrl' method must be called before building the connection.");const qg=new Jb(this.url,pg);return Kd.create(qg,this.logger||V.instance,this.protocol||new Wf(),this.reconnectPolicy)}}function rg(a){return void 0!==a.log}},57632:function(a,b,c){c.d(b,{Z:function(){return k}});const d="undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);var e={randomUUID:d};let f;const g=new Uint8Array(16);function h(){if(!f&&!(f="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return f(g)}const i=[];for(let j=0;j<256;++j)i.push((j+256).toString(16).slice(1));var k=function(a,b,c){if(e.randomUUID&&!b&&!a)return e.randomUUID();a=a||{};const d=a.random||(a.rng||h)();if(d[6]=15&d[6]|64,d[8]=63&d[8]|128,b){c=c||0;for(let f=0;f<16;++f)b[c+f]=d[f];return b}return(function(a,b=0){return i[a[b+0]]+i[a[b+1]]+i[a[b+2]]+i[a[b+3]]+"-"+i[a[b+4]]+i[a[b+5]]+"-"+i[a[b+6]]+i[a[b+7]]+"-"+i[a[b+8]]+i[a[b+9]]+"-"+i[a[b+10]]+i[a[b+11]]+i[a[b+12]]+i[a[b+13]]+i[a[b+14]]+i[a[b+15]]})(d)}}}])
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.